Merge with /home/wd/git/u-boot/custodian/u-boot-testing
authorWolfgang Denk <wd@denx.de>
Tue, 3 Jul 2007 13:07:56 +0000 (15:07 +0200)
committerWolfgang Denk <wd@denx.de>
Tue, 3 Jul 2007 13:07:56 +0000 (15:07 +0200)
197 files changed:
CHANGELOG
MAINTAINERS
MAKEALL
Makefile
board/amcc/acadia/Makefile
board/amcc/acadia/acadia.c
board/amcc/acadia/cmd_acadia.c [new file with mode: 0644]
board/amcc/acadia/config.mk
board/amcc/acadia/memory.c
board/amcc/acadia/pll.c [moved from board/amcc/acadia/cpr.c with 100% similarity]
board/amcc/acadia/u-boot-nand.lds [new file with mode: 0644]
board/amcc/bamboo/Makefile
board/amcc/bamboo/bamboo.c
board/amcc/bamboo/config.mk
board/amcc/bamboo/flash.c
board/amcc/bamboo/init.S
board/amcc/bamboo/u-boot-nand.lds [new file with mode: 0644]
board/amcc/ebony/ebony.c
board/amcc/katmai/katmai.c
board/amcc/luan/luan.c
board/amcc/ocotea/ocotea.c
board/amcc/sequoia/Makefile
board/amcc/sequoia/cmd_sequoia.c [new file with mode: 0644]
board/amcc/sequoia/sdram.c
board/amcc/sequoia/sequoia.c
board/amcc/taishan/taishan.c
board/amcc/yosemite/yosemite.c
board/amcc/yucca/yucca.c
board/bf537-stamp/ether_bf537.c
board/bf537-stamp/flash-defines.h
board/bf537-stamp/stm_m25p64.c
board/bf537-stamp/u-boot.lds.S
board/esd/cpci405/cpci405.c
board/lpc2292sodimm/Makefile
board/lpc2292sodimm/flash.c
board/lwmon5/Makefile [new file with mode: 0644]
board/lwmon5/config.mk [new file with mode: 0644]
board/lwmon5/init.S [new file with mode: 0644]
board/lwmon5/lwmon5.c [new file with mode: 0644]
board/lwmon5/sdram.c [new file with mode: 0644]
board/lwmon5/sdram.h [new file with mode: 0644]
board/lwmon5/u-boot.lds [new file with mode: 0644]
board/motionpro/motionpro.c
board/mpc8641hpcn/Makefile
board/mpc8641hpcn/config.mk
board/mpc8641hpcn/u-boot.lds
board/pcs440ep/pcs440ep.c
board/prodrive/alpr/alpr.c
board/prodrive/p3p440/p3p440.c
board/sandburst/common/sb_common.c
board/siemens/SMN42/Makefile [new file with mode: 0644]
board/siemens/SMN42/config.mk [new file with mode: 0644]
board/siemens/SMN42/flash.c [new file with mode: 0755]
board/siemens/SMN42/lowlevel_init.S [new file with mode: 0644]
board/siemens/SMN42/smn42.c [new file with mode: 0644]
board/siemens/SMN42/u-boot.lds [new file with mode: 0644]
board/smdk2400/lowlevel_init.S
board/stxssa/config.mk
board/tqm5200/tqm5200.c
board/xpedite1k/xpedite1k.c
common/cmd_flash.c
common/cmd_ide.c
common/cmd_log.c
common/cmd_misc.c
common/cmd_pcmcia.c
common/main.c
common/soft_i2c.c
cpu/74xx_7xx/start.S
cpu/arm720t/lpc2292/Makefile [new file with mode: 0644]
cpu/arm720t/lpc2292/flash.c [new file with mode: 0644]
cpu/arm720t/lpc2292/iap_entry.S [moved from board/lpc2292sodimm/iap_entry.S with 100% similarity]
cpu/arm720t/lpc2292/mmc.c [moved from board/lpc2292sodimm/mmc.c with 97% similarity]
cpu/arm720t/lpc2292/mmc_hw.c [moved from board/lpc2292sodimm/mmc_hw.c with 99% similarity]
cpu/arm720t/lpc2292/mmc_hw.h [moved from board/lpc2292sodimm/mmc_hw.h with 100% similarity]
cpu/arm720t/lpc2292/spi.c [moved from board/lpc2292sodimm/spi.c with 97% similarity]
cpu/mpc5xx/start.S
cpu/mpc5xxx/cpu_init.c
cpu/mpc5xxx/fec.c
cpu/mpc5xxx/start.S
cpu/mpc8220/start.S
cpu/mpc824x/start.S
cpu/mpc8260/start.S
cpu/mpc83xx/start.S
cpu/mpc85xx/start.S
cpu/mpc86xx/resetvec.S [deleted file]
cpu/mpc86xx/start.S
cpu/mpc8xx/start.S
cpu/ppc4xx/405gp_pci.c
cpu/ppc4xx/44x_spd_ddr.c
cpu/ppc4xx/44x_spd_ddr2.c
cpu/ppc4xx/config.mk
cpu/ppc4xx/cpu.c
cpu/ppc4xx/cpu_init.c
cpu/ppc4xx/gpio.c
cpu/ppc4xx/ndfc.c
cpu/ppc4xx/start.S
cpu/ppc4xx/tlb.c
cpu/ppc4xx/traps.c [changed mode: 0644->0755]
disk/part.c [changed mode: 0644->0755]
doc/README.mpc8641hpcn
doc/README.ppc440
drivers/Makefile
drivers/enc28j60.c [moved from board/lpc2292sodimm/eth.c with 80% similarity, mode: 0755]
drivers/nand/nand_ecc.c
fs/fat/fat.c [changed mode: 0644->0755]
include/74xx_7xx.h
include/asm-arm/arch-arm720t/hardware.h
include/asm-arm/arch-lpc2292/hardware.h [new file with mode: 0644]
include/asm-arm/arch-lpc2292/lpc2292_registers.h [moved from include/asm-arm/arch-arm720t/lpc2292_registers.h with 100% similarity]
include/asm-arm/arch-lpc2292/mmc.h [moved from include/asm-arm/arch-arm720t/mmc.h with 100% similarity]
include/asm-arm/arch-lpc2292/spi.h [moved from board/lpc2292sodimm/spi.h with 100% similarity]
include/asm-ppc/gpio.h
include/asm-ppc/io.h
include/asm-ppc/processor.h
include/common.h
include/configs/BC3450.h
include/configs/CPCI405.h
include/configs/CPCI4052.h
include/configs/CPCI405AB.h
include/configs/CPCI405DT.h
include/configs/CPCI440.h
include/configs/IceCube.h
include/configs/KAREF.h
include/configs/METROBOX.h
include/configs/MPC8641HPCN.h
include/configs/PM520.h
include/configs/SMN42.h [new file with mode: 0755]
include/configs/TB5200.h
include/configs/TOP5200.h
include/configs/TQM5200.h
include/configs/Total5200.h
include/configs/XPEDITE1K.h
include/configs/acadia.h
include/configs/aev.h
include/configs/alpr.h
include/configs/bamboo.h
include/configs/canmb.h
include/configs/cpci5200.h
include/configs/ebony.h
include/configs/hmi1001.h
include/configs/inka4x0.h
include/configs/katmai.h
include/configs/lpc2292sodimm.h [changed mode: 0644->0755]
include/configs/luan.h
include/configs/lwmon5.h [new file with mode: 0644]
include/configs/mcc200.h
include/configs/motionpro.h
include/configs/o2dnt.h
include/configs/ocotea.h
include/configs/p3p440.h
include/configs/pcs440ep.h
include/configs/pf5200.h
include/configs/sc3.h
include/configs/sequoia.h
include/configs/smmaco4.h
include/configs/spieval.h
include/configs/stxssa.h
include/configs/taishan.h
include/configs/uc101.h
include/configs/v38b.h
include/configs/yosemite.h
include/configs/yucca.h
include/logbuff.h
include/mpc5xx.h
include/mpc5xxx.h
include/mpc8220.h
include/mpc824x.h
include/mpc8260.h
include/mpc83xx.h
include/mpc85xx.h
include/mpc86xx.h
include/mpc8xx.h
include/post.h
include/ppc405.h
include/ppc440.h
include/ppc4xx.h
include/ppc_asm.tmpl
include/status_led.h
lib_ppc/board.c
nand_spl/board/amcc/acadia/Makefile [new file with mode: 0644]
nand_spl/board/amcc/acadia/config.mk [new file with mode: 0644]
nand_spl/board/amcc/acadia/u-boot.lds [new file with mode: 0644]
nand_spl/board/amcc/bamboo/Makefile [new file with mode: 0644]
nand_spl/board/amcc/bamboo/config.mk [new file with mode: 0644]
nand_spl/board/amcc/bamboo/sdram.c [new file with mode: 0644]
nand_spl/board/amcc/bamboo/u-boot.lds [new file with mode: 0644]
nand_spl/board/amcc/sequoia/Makefile
nand_spl/nand_boot.c
post/cpu/ppc4xx/Makefile [new file with mode: 0644]
post/cpu/ppc4xx/fpu.c [new file with mode: 0644]
post/cpu/ppc4xx/spr.c [new file with mode: 0644]
post/cpu/ppc4xx/uart.c [new file with mode: 0644]
post/cpu/ppc4xx/watchdog.c [new file with mode: 0644]
post/lib_ppc/asm.S
post/lib_ppc/b.c
post/post.c
post/tests.c

index 24d805e..e3c21f9 100644 (file)
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,9 +1,636 @@
+commit 2dc64451b4c08ffd619372abfdc2506a2e2363b9
+Author: Igor Lisitsin <igor@emcraft.com>
+Date:  Wed Apr 18 14:55:19 2007 +0400
+
+    Adapt log buffer code to support Linux 2.6
+
+    A new environment variable, "logversion", selects the log buffer
+    behaviour. If it is not set or set to a value other than 2, then the
+    old, Linux 2.4.4, behaviour is selected.
+
+    Signed-off-by: Igor Lisitsin <igor@emcraft.com>
+    --
+
+commit a11e06965ec91270c51853407ff1261d3c740386
+Author: Igor Lisitsin <igor@emcraft.com>
+Date:  Wed Mar 28 19:06:19 2007 +0400
+
+    Extend POST support for PPC440
+
+    Added memory, CPU, UART, I2C and SPR POST tests for PPC440.
+
+    Signed-off-by: Igor Lisitsin <igor@emcraft.com>
+    --
+
+commit 02032e8f14751a1a751b09240a4f1cf9f8a2077f
+Author: Rafal Jaworowski <raj@semihalf.com>
+Date:  Fri Jun 22 14:58:04 2007 +0200
+
+    [ppc] Fix build breakage for all non-4xx PowerPC variants.
+
+    - adapt to the more generic EXCEPTION_PROLOG and CRIT_EXCEPTION macros
+    - minor 4xx cleanup
+
+commit 83b4cfa3d629dff0264366263c5e94d9a50ad80b
+Author: Wolfgang Denk <wd@denx.de>
+Date:  Wed Jun 20 18:14:24 2007 +0200
+
+    Coding style cleanup. Refresh CHANGELOG.
+
+commit b3f9ec86e388207fd03dcdf7b145b9ed080bf024
+Author: Stefan Roese <sr@denx.de>
+Date:  Tue Jun 19 17:22:44 2007 +0200
+
+    ppc4xx: Add bootstrap command for AMCC Sequoia (440EPx) eval board
+
+    This patch adds a board command to configure the I2C bootstrap EEPROM
+    values. Right now 533 and 667MHz are supported for booting either via NOR
+    or NAND FLASH. Here the usage:
+
+    => bootstrap 533 nor       ;to configure the board for 533MHz NOR booting
+    => bootstrap 667 nand      ;to configure the board for 667MHz NNAND booting
+
+    Signed-off-by: Stefan Roese <sr@denx.de>
+
+commit df8a24cdd30151505cf57bbee5289e91bf53bd1b
+Author: Stefan Roese <sr@denx.de>
+Date:  Tue Jun 19 16:42:31 2007 +0200
+
+    [ppc4xx] Fix problem with NAND booting on AMCC Acadia
+
+    The latest changes showed a problem with the location of the NAND-SPL
+    image in the OCM and the init-data area (incl. cache). This patch
+    fixes this problem.
+
+    Signed-off-by: Stefan Roese <sr@denx.de>
+
+commit 86ba99e34194394052d24c04dc40d1263d29a26f
+Author: Stefan Roese <sr@denx.de>
+Date:  Tue Jun 19 16:40:58 2007 +0200
+
+    [ppc4xx] Change board/amcc/acadia/cpr.c to pll.c
+
+    Signed-off-by: Stefan Roese <sr@denx.de>
+
+commit e73846b7cf1e29ae635bf9bb5570269663df2ee5
+Author: Stefan Roese <sr@denx.de>
+Date:  Fri Jun 15 11:33:41 2007 +0200
+
+    [ppc4xx] Change lwmon5 port to work with recent 440 exception rework
+
+    Now CONFIG_440 has to be defined in all PPC440 board config files.
+
+    Signed-off-by: Stefan Roese <sr@denx.de>
+
+commit efa35cf12d914d4caba942acd5a6c45f217de302
+Author: Grzegorz Bernacki <gjb@semihalf.com>
+Date:  Fri Jun 15 11:19:28 2007 +0200
+
+    ppc4xx: Clean up 440 exceptions handling
+
+    - Introduced dedicated switches for building 440 and 405 images required
+      for 440-specific machine instructions like 'rfmci' etc.
+
+    - Exception vectors moved to the proper location (_start moved away from
+      the critical exception handler space, which it occupied)
+
+    - CriticalInput now serviced (with default handler)
+
+    - MachineCheck properly serviced (added a dedicated handler and return
+      subroutine)
+
+    - Overall cleanup of exceptions declared with STD_EXCEPTION macro (unused,
+      unhandled and those not relevant for 4xx were eliminated)
+
+    - Eliminated Linux leftovers, removed dead code
+
+    Signed-off-by: Grzegorz Bernacki <gjb@semihalf.com>
+    Signed-off-by: Rafal Jaworowski <raj@semihalf.com>
+    Signed-off-by: Stefan Roese <sr@denx.de>
+
+commit b765ffb773f5a3cd5aa94ec76b6a05276b8cd5b2
+Author: Stefan Roese <sr@denx.de>
+Date:  Fri Jun 15 08:18:01 2007 +0200
+
+    [ppc4xx] Add initial lwmon5 board support
+
+    This patch adds initial support for the Liebherr lwmon5 board euqipped
+    with an AMCC 440EPx PowerPC.
+
+    Signed-off-by: Stefan Roese <sr@denx.de>
+
+commit 85f737376d5ff3d5f0d45a8b657686326d175307
+Author: Stefan Roese <sr@denx.de>
+Date:  Fri Jun 15 07:39:43 2007 +0200
+
+    [ppc4xx] Extend 44x GPIO setup with default output state
+
+    The board config array CFG_440_GPIO_TABLE for the ppc440 GPIO setup
+    is extended with the default GPIO output state (level).
+
+    Signed-off-by: Stefan Roese <sr@denx.de>
+
+commit dbca208518e5e7f01a6420588d1cd6e60db74c2b
+Author: Stefan Roese <sr@denx.de>
+Date:  Thu Jun 14 11:14:32 2007 +0200
+
+    [ppc4xx] Extend program_tlb() with virtual & physical addresses
+
+    Now program_tlb() allows to program a TLB (or multiple) with
+    different virtual and physical addresses. With this change, now one
+    physical region (e.g. SDRAM) can be mapped 2 times, once with caches
+    diabled and once with caches enabled.
+
+    Signed-off-by: Stefan Roese <sr@denx.de>
+
+commit 9912121f7ed804ea58fd62f3f230b5dcfc357d88
+Author: Detlev Zundel <dzu@denx.de>
+Date:  Wed May 23 19:02:41 2007 +0200
+
+    Change 'repeatable' attribute of some commands to sensible values.
+
+    Most prominently this changes 'erase' to be non-repeatable.
+
+    Signed-off-by: Detlev Zundel <dzu@denx.de>
+
+commit 5afb202093f6a001797db92cf695b93a70ea9ab4
+Author: Detlev Zundel <dzu@denx.de>
+Date:  Wed May 23 18:47:48 2007 +0200
+
+    Fix 'run' not to continue after interrupted command
+
+    Signed-off-by: Detlev Zundel <dzu@denx.de>
+
+commit 8f8416fada9faf94b9a92f21fe6000643cb521d5
+Author: Bartlomiej Sieka <tur@semihalf.com>
+Date:  Fri Jun 8 14:52:22 2007 +0200
+
+    TQM5200: Add Flat Device Tree support, update default env. accordingly.
+
+    Signed-off-by: Jan Wrobel <wrr@semihalf.com>
+    Acked-by: Bartlomiej Sieka <tur@semihalf.com>
+
+commit 9045f33c023f698660a2e45d1b2194c0711abebc
+Author: Wolfgang Denk <wd@denx.de>
+Date:  Fri Jun 8 10:24:58 2007 +0200
+
+    Fix config problems on SC3 board; make ide_reset_timeout work.
+
+commit fba3fb0449b8a54542aed1e729de76e7f5a2ff1b
+Author: Benoît Monin <bmonin@adeneo.eu>
+Date:  Fri Jun 8 09:55:24 2007 +0200
+
+    [PATCH] fix gpio setting when using CFG_440_GPIO_TABLE
+
+    Set the correct value in GPIOx_TCR when configuring the gpio
+    with CFG_440_GPIO_TABLE.
+
+    Signed-off-by: Benoit Monin <bmonin@adeneo.eu>
+    Signed-off-by: Stefan Roese <sr@denx.de>
+
+commit 725671ccd2cd04c9ebc50c9e5a94dd8cbade66b7
+Author: Wolfgang Denk <wd@denx.de>
+Date:  Wed Jun 6 16:26:56 2007 +0200
+
+    Coding Style cleanup; generate new CHANGELOG file.
+
+    Signed-off-by: Wolfgang Denk <wd@denx.de>
+
+commit c440bfe6d6d92d66478a7e84402b31f48413617b
+Author: Stefan Roese <sr@denx.de>
+Date:  Wed Jun 6 11:42:13 2007 +0200
+
+    ppc4xx: Add NAND booting support for AMCC Acadia (405EZ) eval board
+
+    This patch adds NAND booting support for the AMCC Acadia eval board.
+
+    Please make sure to configure jumper J7 to position 2-3 when booting
+    from NOR, and to position 1-2 when booting for NAND.
+
+    I also added a board command to configure the I2C bootstrap EEPROM
+    values. Right now only 267MHz is support for booting either via NOR
+    or NAND FLASH. Here the usage:
+
+    => bootstrap 267 nor       ;to configure the board for 267MHz NOR booting
+    => bootstrap 267 nand      ;to configure the board for 267MHz NNAND booting
+
+    Signed-off-by: Stefan Roese <sr@denx.de>
+
+commit 32922cdc470fdfd39bea0c1c4f582d3fb340421e
+Author: Ed Swarthout <Ed.Swarthout@freescale.com>
+Date:  Tue Jun 5 12:30:52 2007 -0500
+
+    mpc8641 image size cleanup
+
+    e600 does not have a bootpg restriction.
+    Move the version string to beginning of image at fff00000.
+    Resetvec.S is not needed.
+    Update flash copy instructions.
+    Add tftpflash env variable
+
+    Signed-off-by: Ed Swarthout <Ed.Swarthout@freescale.com>
+    Signed-off-by: Jon Loeliger <jdl@freescale.com>
+
+commit e3cbe1f93c5722f8ebbad468e30c069a2b511097
+Author: Benoît Monin <bmonin@adeneo.eu>
+Date:  Mon Jun 4 08:36:05 2007 +0200
+
+    [PATCH] Fix ppc4xx bootstrap letter displayed on startup
+
+    The attached patch is mainly cosmetic, allowing u-boot to
+    display the correct bootstrap option letter according to the
+    datasheets.
+
+    The original patch was extended with 405EZ support by Stefan
+    Roese.
+
+    Signed-off-by: Benoit Monin <bmonin@adeneo.eu>
+    Signed-off-by: Stefan Roese <sr@denx.de>
+
+commit 18d156eb37c90fadc8ec7a81a3b89176161f85b7
+Author: Stefan Roese <sr@denx.de>
+Date:  Fri Jun 1 16:18:17 2007 +0200
+
+    ppc4xx: Add missing file for Bamboo NAND booting support
+
+    Signed-off-by: Stefan Roese <sr@denx.de>
+
+commit 155a96478a0881e6da96cbbbcf34952d6a3b1b4b
+Author: Stefan Roese <sr@denx.de>
+Date:  Fri Jun 1 15:58:19 2007 +0200
+
+    ppc4xx: Undo Sequoia patch for dynamic EBC speed support of 83MHz
+
+    This patch undoes the patch by Jeff Mann with commit-id ada4697d. As
+    suggested by AMCC it is not recommended to dynamically change the EBC
+    speed after bootup. So we undo this change to be on the safe side.
+
+    Signed-off-by: Stefan Roese <sr@denx.de>
+
+commit 9d9096043e8f713d4bf1743d32e1459e6a11644b
+Author: Stefan Roese <sr@denx.de>
+Date:  Fri Jun 1 15:29:04 2007 +0200
+
+    ppc4xx: Update Sequoia NAND booting support with ECC
+
+    Signed-off-by: Stefan Roese <sr@denx.de>
+
+commit cf959c7d6687567c308e366e9581e1a5aff5cc5b
+Author: Stefan Roese <sr@denx.de>
+Date:  Fri Jun 1 15:27:11 2007 +0200
+
+    ppc4xx: Add NAND booting support for AMCC Bamboo (440EP) eval board
+
+    This patch adds NAND booting support for the AMCC Bamboo eval board.
+    Since the NAND-SPL boot image is limited to 4kbytes, this version
+    only supports the onboard 64MBytes of DDR. The DIMM modules can't be
+    supported, since the setup code for I2C DIMM autodetection and
+    configuration is too big for this NAND bootloader.
+
+    Signed-off-by: Stefan Roese <sr@denx.de>
+
+commit 42be56f53c8b107868e6125c8524ae84293e95a7
+Author: Stefan Roese <sr@denx.de>
+Date:  Fri Jun 1 15:23:04 2007 +0200
+
+    NAND: Add ECC support to NAND booting support in nand_spl/nand_boot.c
+
+    The U-Boot NAND booting support is now extended to support ECC
+    upon loading of the NAND U-Boot image.
+
+    Tested on AMCC Sequoia (440EPx) and Bamboo (440EP).
+
+    Signed-off-by: Stefan Roese <sr@denx.de>
+
+commit a471db07fbb65a841ffc9f4f112562b945230f98
+Author: Stefan Roese <sr@denx.de>
+Date:  Fri Jun 1 15:19:29 2007 +0200
+
+    ppc4xx: Prepare Bamboo port for NAND booting support
+
+    This patch updates the "normal" Bamboo NOR booting port, so
+    that it is compatible with the coming soon NAND booting
+    Bamboo port.
+
+    It also enables the 2nd NAND flash on the Bamboo.
+
+    Signed-off-by: Stefan Roese <sr@denx.de>
+
+commit 53ad02103fb8be4138a9937a8ab91fcdff7b4987
+Author: Stefan Roese <sr@denx.de>
+Date:  Fri Jun 1 15:16:58 2007 +0200
+
+    ppc4xx: Update in_be32() functions and friends to latest Linux version
+
+    Signed-off-by: Stefan Roese <sr@denx.de>
+
+commit 91da09cfbce0c1de05d6d84aa8363d666fa7ea3c
+Author: Stefan Roese <sr@denx.de>
+Date:  Fri Jun 1 15:15:12 2007 +0200
+
+    NAND: Add hardware ECC support to the PPC4xx NAND driver ndfc.c
+
+    This patch adds hardware ECC support to the NDFC driver. It also
+    changes the register access from using the "simple" in32/out32
+    functions to the in_be32/out_be32 functions, which make sure
+    that the access is correctly synced. This is the only recommended
+    access to SoC registers in the current Linux kernel.
+
+    Signed-off-by: Stefan Roese <sr@denx.de>
+
+commit 17b5e862287cca76f19dcf8b741e61a7d06617f2
+Author: Stefan Roese <sr@denx.de>
+Date:  Fri Jun 1 15:12:15 2007 +0200
+
+    NAND: Update nand_ecc.c to latest Linux version
+
+    This patch updates the nand_ecc code to the latest Linux version.
+    The main reason for this is the more compact code. This makes
+    it possible to include the ECC code into the NAND bootloader
+    image (NAND_SPL) for PPC4xx.
+
+    Signed-off-by: Stefan Roese <sr@denx.de>
+
+commit d2d432760d2199d0e8558fdd9d1789b8131abcf7
+Author: Stefan Roese <sr@denx.de>
+Date:  Fri Jun 1 15:09:50 2007 +0200
+
+    ppc4xx: 44x DDR driver code cleanup and small fix for Bamboo
+
+    Signed-off-by: Stefan Roese <sr@denx.de>
+
+commit e4bbed2803a2ad0521c7362f5d3e065f99abaedc
+Author: Stefan Roese <sr@denx.de>
+Date:  Fri Jun 1 13:45:24 2007 +0200
+
+    ppc4xx: Change Luan config file to support ECC
+
+    With the updated 44x DDR2 driver the Luan board now supports
+    ECC generation and checking.
+
+    Signed-off-by: Stefan Roese <sr@denx.de>
+
+commit 7187db73491c8de0fb56efb5e5134ba5ec443089
+Author: Stefan Roese <sr@denx.de>
+Date:  Fri Jun 1 13:45:00 2007 +0200
+
+    ppc4xx: Update 44x_spd_ddr2 code (440SP/440SPe)
+
+    Add config option for 180 degree advance clock control as needed
+    for the AMCC Luan eval board.
+
+    Signed-off-by: Stefan Roese <sr@denx.de>
+
+commit ee1529838abbfaa35f14e3ffbeaaba693159475f
+Author: Wolfgang Denk <wd@denx.de>
+Date:  Thu May 31 17:20:09 2007 +0200
+
+    Add support for STX GP3SSA (stxssa) Board with 4 MiB flash.
+
+    Signed-off-by: Wolfgang Denk <wd@denx.de>
+
+commit 7049288fb1f16f1b317140226cdebd07bd416395
+Author: Bartlomiej Sieka <tur@semihalf.com>
+Date:  Sun May 27 17:26:46 2007 +0200
+
+    Motion-PRO: Code cleanup, fix of a typo in OF_STDOUT_PATH.
+
+    Signed-off-by: Bartlomiej Sieka <tur@semihalf.com>
+
+commit 4520fd4d2c450da49637216aa0e53739b61c60ac
+Author: Bartlomiej Sieka <tur@semihalf.com>
+Date:  Sun May 27 17:06:36 2007 +0200
+
+    Motion-PRO: Add support for redundant environment.
+
+    Enable redundant environment, add a MTD partition for it; also add env.
+    variable command for passing MTD partitions to the kernel command line.
+
+    Signed-off-by: Piotr Kruszynski <ppk@semihalf.com>
+    Acked-by: Bartlomiej Sieka <tur@semihalf.com>
+
+commit a26eabeec31746f06d309103690892805696e344
+Author: Bartlomiej Sieka <tur@semihalf.com>
+Date:  Sun May 27 17:05:11 2007 +0200
+
+    Motion-PRO: Change maximum console buffer size from 256 to 1024 bytes.
+
+    Allow passing longer command line to the kernel - useful especially
+    for passing MTD partition layout.
+
+    Signed-off-by: Piotr Kruszynski <ppk@semihalf.com>
+    Acked-by: Bartlomiej Sieka <tur@semihalf.com>
+
+commit 9160b96f71483a116de81c68985e8ee306d36764
+Author: Bartlomiej Sieka <tur@semihalf.com>
+Date:  Sun May 27 17:04:18 2007 +0200
+
+    Fix: Add missing NULL termination in strings expanded by macros parser.
+
+    Signed-off-by: Piotr Kruszynski <ppk@semihalf.com>
+    Acked-by: Bartlomiej Sieka <tur@semihalf.com>
+
+commit 630ec84aef7228fc1dbfb38dec78541403a786cd
+Author: Bartlomiej Sieka <tur@semihalf.com>
+Date:  Sun May 27 17:03:37 2007 +0200
+
+    Motion-PRO: Update EEPROM's page write bits and write delay.
+
+    Change EEPROM configuration according to the datasheet: "The 24C01A and 24C02A
+    have a page write capability of two bytes", and "This device offers fast (1ms)
+    byte write". Add 3ms of extra delay.
+
+    Signed-off-by: Piotr Kruszynski <ppk@semihalf.com>
+    Acked-by: Bartlomiej Sieka <tur@semihalf.com>
+
+commit c00125e07c1ebc125bab40e1e18bceed8be0c162
+Author: Bartlomiej Sieka <tur@semihalf.com>
+Date:  Sun May 27 16:58:45 2007 +0200
+
+    MPC5XXX, Motion-PRO: Fix PHY initialization problem.
+
+    After being reset in mpc5xxx_fec_init_phy(), PHY goes into FX mode, in which
+    networking does not function. This commit switches PHY to TX mode by clearing
+    the FX_SEL bit of Mode Control Register. It also reverses commit
+    008861a2f3ef2c062744d733787c7e530a1b8761, i.e., a temporary workaround.
+
+    Signed-off-by: Grzegorz Bernacki <gjb@semihalf.com>
+    Acked-by: Bartlomiej Sieka <tur@semihalf.com>
+
+commit 93b78f534a6e708b4cf1a4ffb4d8438c67a007db
+Author: Bartlomiej Sieka <tur@semihalf.com>
+Date:  Sun May 27 16:57:15 2007 +0200
+
+    Motion-PRO: Add support for the temperature sensor.
+
+    Signed-off-by: Piotr Kruszynski <ppk@semihalf.com>
+    Acked-by: Bartlomiej Sieka <tur@semihalf.com>
+
+commit c75e639630cc132dc19cd1ecda5922c0db0bfbba
+Author: Bartlomiej Sieka <tur@semihalf.com>
+Date:  Sun May 27 16:55:23 2007 +0200
+
+    Motion-PRO: Add displaying of CPLD revision information during boot.
+
+    Signed-off-by: Jan Wrobel <wrr@semihalf.com>
+    Acked-by: Bartlomiej Sieka <tur@semihalf.com>
+
+commit c99512d6bd3973f01ca2fc4896d829b46e68f150
+Author: Bartlomiej Sieka <tur@semihalf.com>
+Date:  Sun May 27 16:53:43 2007 +0200
+
+    MPC5xxx: Change names of defines related to IPB and PCI clocks.
+
+    Both CFG_PCISPEED_66 and CFG_IPBSPEED_133 are misnamed, as defining
+    them does not cause PCI or IPB clocks to run at the specified speed.
+    Instead, they configure divisors used to calculate said clocks. This
+    patch renames the defines according to their real function.
+
+    Signed-off-by: Grzegorz Bernacki <gjb@semihalf.com>
+    Acked-by: Bartlomiej Sieka <tur@semihalf.com>
+
+commit a11c0b85dc3664bb3c1e781137118730c8f619ab
+Author: Bartlomiej Sieka <tur@semihalf.com>
+Date:  Sun May 27 16:51:48 2007 +0200
+
+    Motion-PRO: Add LED support.
+
+    Signed-off-by: Jan Wrobel <wrr@semihalf.com>
+    Signed-off-by: Marian Balakowicz <m8@semihalf.com>
+    Acked-by: Bartlomiej Sieka <tur@semihalf.com>
+
+commit d756894722c888d09a9fa1df8323753772d3dcce
+Author: Stefan Roese <sr@denx.de>
+Date:  Thu May 24 09:49:00 2007 +0200
+
+    ppc4xx: Fix small 405EZ OCM initilization bug in start.S
+
+    As pointed out by Bruce Adler <bruce.adler@acm.org> this patch
+    fixes a small bug in the 405EZ OCM initialization. Thanks for
+    spotting.
+
+    Signed-off-by: Stefan Roese <sr@denx.de>
+
+commit 5d4a179013d59a76446462e1eb0a969fba63eb81
+Author: Stefan Roese <sr@denx.de>
+Date:  Thu May 24 08:22:09 2007 +0200
+
+    ppc4xx: Update AMCC Acadia support for board revision 1.1
+
+    This patch updates the Acadia (405EZ) support for the new 1.1 board
+    revision. It also adds support for NAND FLASH via the 4xx NDFC.
+
+    Please note that the jumper J7 must be in position 2-3 for this
+    NAND support. Position 1-2 is for NAND booting only. NAND booting
+    support will follow later.
+
+    Signed-off-by: Stefan Roese <sr@denx.de>
+
+commit 9f0077abd69f7a7c756a915b961037302be3e6f2
+Author: Stefan Roese <sr@denx.de>
+Date:  Tue May 22 12:48:09 2007 +0200
+
+    ppc4xx: Use do { ... } while (0) for CPR & SDR access macros
+
+    Signed-off-by: Stefan Roese <sr@denx.de>
+
+commit 6f3dfc139a838b0841c151efe00ad47db2366e79
+Author: Stefan Roese <sr@denx.de>
+Date:  Tue May 22 12:46:10 2007 +0200
+
+    ppc4xx: Add 405 support to 4xx NAND driver ndfc.c
+
+    This patch adds support for 405 PPC's to the 4xx NAND driver
+    ndfc.c. This is in preparation for the new AMCC 405EZ.
+
+    Signed-off-by: Stefan Roese <sr@denx.de>
+
+commit 10603d76767426be803dadd4fb688b97eb69481c
+Author: Stefan Roese <sr@denx.de>
+Date:  Mon May 21 07:41:22 2007 +0200
+
+    ppc4xx: Fix problem in 405EZ OCM initialization
+
+    As spotted by Bruce Adler this patch fixes an initialization problem
+    for the 405EZ OCM.
+
+    Signed-off-by: Stefan Roese <sr@denx.de>
+
+commit 3e3b956906eba9e4ad7931581ecedaad10eccce8
+Author: Peter Pearse <peter.pearse@arm.com>
+Date:  Fri May 18 16:47:03 2007 +0100
+
+    Reduce line lengths to 80 characters max.
+
+commit 93ef45c9ddfdd9fc17c4e74bd8e2f2456580eb72
+Author: Peter Pearse <peter.pearse@arm.com>
+Date:  Fri May 18 14:34:07 2007 +0100
+
+    Makefile permissions
+
+commit 1443a31457d68f7e8f0b9403e9832ec1e79dc59d
+Author: Peter Pearse <peter.pearse@arm.com>
+Date:  Fri May 18 14:33:11 2007 +0100
+
+    Makefile permissions
+
+commit 70124c2602ae2d4c5d3dba05b482d91548242de8
+Author: Stefano Babic <sbabic@denx.de>
+Date:  Wed May 16 14:49:12 2007 +0200
+
+    Fix compile problem cause my Microblaze merge
+
+    Signed-off-by: Stefano Babic <sbabic@denx.de>
+
+commit ada4697d0230d6da552867777f98a67ec3ba2579
+Author: Jeffrey Mann <mannj@embeddedplanet.com>
+Date:  Wed May 16 13:23:10 2007 +0200
+
+    [PATCH] Run new sequoia boards with an EBC speed of 83MHz
+
+    Because the Sequoia board does not boot with an EBC faster than 66MHz,
+    the clock divider are changed after the initial boot process.
+
+    This allows for maximum clocking speeds  to be achieved on newer boards.
+    Sequoia boards with 666.66 MHz processors require that the EBC divider
+    be set to 3 in order to start the initial boot process at a slower EBC
+    speed. After the initial boot process, the divider can be set back to 2,
+    which will cause the boards to run at 83.333MHz. This is backward
+    compatible with boards with 533.33 MHz processors, as these boards will
+    already be set with an EBC divider of 2.
+
+    Signed-off-by: Jeffrey Mann <mannj@embeddedplanet.com>
+
+commit a7676ea7732f3c596805079fed7e5c9fac652cfc
+Author: Wolfgang Denk <wd@denx.de>
+Date:  Wed May 16 01:16:53 2007 +0200
+
+    Minor Coding Style cleanup, update CHANGELOG.
+
+    Signed-off-by: Wolfgang Denk <wd@denx.de>
+
 commit d62f64cc23a940eafe712c776b3249e4160753d1
 Author: Wolfgang Denk <wd@denx.de>
 Date:  Wed May 16 00:13:33 2007 +0200
 
     Coding Style Cleanup, new CHANGELOG
 
+commit 61936667e86a250ae12fd2dc189d3588f0a59e0b
+Author: Stefan Roese <sr@denx.de>
+Date:  Fri May 11 12:01:49 2007 +0200
+
+    ppc4xx: Add mtcpr/mfcpr access macros
+
+    Signed-off-by: Stefan Roese <sr@denx.de>
+
+commit 343c48bd84606c4025c8a7c7263fda465d6e284c
+Author: Stefan Roese <sr@denx.de>
+Date:  Fri May 11 12:01:06 2007 +0200
+
+    ppc4xx: Set bd->bi_pci_busfreq on 440EPx/GRx too
+
+    Signed-off-by: Stefan Roese <sr@denx.de>
+
 commit 7d98ba770a7eaefa29ce927f31a0956df85bf650
 Author: Piotr Kruszynski <ppk@semihalf.com>
 Date:  Thu May 10 16:55:52 2007 +0200
@@ -11,6 +638,48 @@ Date:       Thu May 10 16:55:52 2007 +0200
     [Motion-PRO] Add MTD and JFFS2 support, also add default partition
     definition.
 
+commit 65fb6a676e821f9570a2a376dc204bf611ce5f81
+Author: Peter Pearse <peter.pearse@arm.com>
+Date:  Wed May 9 11:42:44 2007 +0100
+
+    Add the board directory for SMN42
+
+commit 160131bf965785419626df6c388729fe0b597992
+Author: Peter Pearse <peter.pearse@arm.com>
+Date:  Wed May 9 11:41:58 2007 +0100
+
+    Add the files for the SMN42 board
+
+commit 5c6d2b5a500f8c49670de8910150b78a41f781fc
+Author: Peter Pearse <peter.pearse@arm.com>
+Date:  Wed May 9 11:40:34 2007 +0100
+
+    Remove the deleted files for the SMN42 patch
+
+commit b0d8f5bf0d215adc9424cb228b2484dbf07f7761
+Author: Peter Pearse <peter.pearse@arm.com>
+Date:  Wed May 9 11:37:56 2007 +0100
+
+    New board SMN42 branch
+
+commit 29f3be0caf0799ca6b89dfd9824c15619a50000f
+Author: Peter Pearse <peter.pearse@arm.com>
+Date:  Wed May 9 10:24:38 2007 +0100
+
+    Makefile permissions
+
+commit b84289b595731e8851df46e893845cc1322c9b9b
+Author: Ed Swarthout <Ed.Swarthout@freescale.com>
+Date:  Tue May 8 14:17:07 2007 -0500
+
+    8641hpcn: Fix Makefile after moving pixis to board/freescale.
+
+    The OBJTREE != SRCTREE build scenario was broken.
+    This fixes it.
+
+    Signed-off-by: Ed Swarthout <Ed.Swarthout@freescale.com>
+    Signed-off-by: Jon Loeliger <jdl@freescale.com>
+
 commit e69f66c6ebe82bbbd1da766bc4eda40ec7ee5af1
 Author: Michal Simek <monstr@monstr.eu>
 Date:  Tue May 8 15:57:43 2007 +0200
@@ -93,6 +762,18 @@ Date:       Mon May 7 19:43:10 2007 +0200
 
     fix: read and write MSR - repair number of parameters
 
+commit 193b4a3bb3acaddf798da8de0da05d94ba8774ee
+Author: Jeffrey Mann <mannj@embeddedplanet.com>
+Date:  Mon May 7 19:42:49 2007 +0200
+
+    [PATCH] ppc4xx: Fix CONFIG_SYS_CLK_FREQ definition in Sequoia config file
+
+    A '3' got cut off in the formatting of the last patch to automatically
+    change the clock speed of the system clock on sequoia board.
+
+    Signed-off-by: Jeffrey Mann <mannj@embeddedplanet.com>
+    Signed-off-by: Stefan Roese <sr@denx.de>
+
 commit 19bf1fbad7f19d5a120be9b1daf136e052fcab39
 Author: Michal Simek <monstr@monstr.eu>
 Date:  Mon May 7 19:33:51 2007 +0200
index 2eaef17..693b115 100644 (file)
@@ -282,6 +282,7 @@ Stefan Roese <sr@denx.de>
        bunbinga                PPC405EP
        ebony                   PPC440GP
        katmai                  PPC440SPe
+       lwmon5                  PPC440EPx
        ocotea                  PPC440GX
        p3p440                  PPC440GP
        pcs440ep                PPC440EP
diff --git a/MAKEALL b/MAKEALL
index 6c8eb9c..f931e1d 100755 (executable)
--- a/MAKEALL
+++ b/MAKEALL
@@ -75,22 +75,23 @@ LIST_8xx="  \
 #########################################################################
 
 LIST_4xx="     \
-       acadia          ADCIOP          alpr            AP1000          \
-       AR405           ASH405          bamboo          bubinga         \
-       CANBT           CMS700          CPCI2DP         CPCI405         \
-       CPCI4052        CPCI405AB       CPCI405DT       CPCI440         \
-       CPCIISER4       CRAYL1          csb272          csb472          \
-       DASA_SIM        DP405           DU405           ebony           \
-       ERIC            EXBITGEN        G2000           HH405           \
-       HUB405          JSE             KAREF           katmai          \
-       luan            METROBOX        MIP405          MIP405T         \
-       ML2             ml300           ocotea          OCRTC           \
-       ORSG            p3p440          PCI405          pcs440ep        \
-       PIP405          PLU405          PMC405          PPChameleonEVB  \
-       sbc405          sc3             sequoia         sequoia_nand    \
-       taishan         VOH405          VOM405          W7OLMC          \
-       W7OLMG          walnut          WUH405          XPEDITE1K       \
-       yellowstone     yosemite        yucca                           \
+       acadia          acadia_nand     ADCIOP          alpr            \
+       AP1000          AR405           ASH405          bamboo          \
+       bamboo_nand     bubinga         CANBT           CMS700          \
+       CPCI2DP         CPCI405         CPCI4052        CPCI405AB       \
+       CPCI405DT       CPCI440         CPCIISER4       CRAYL1          \
+       csb272          csb472          DASA_SIM        DP405           \
+       DU405           ebony           ERIC            EXBITGEN        \
+       G2000           HH405           HUB405          JSE             \
+       KAREF           katmai          luan            lwmon5          \
+       METROBOX        MIP405          MIP405T         ML2             \
+       ml300           ocotea          OCRTC           ORSG            \
+       p3p440          PCI405          pcs440ep        PIP405          \
+       PLU405          PMC405          PPChameleonEVB  sbc405          \
+       sc3             sequoia         sequoia_nand    taishan         \
+       VOH405          VOM405          W7OLMC          W7OLMG          \
+       walnut          WUH405          XPEDITE1K       yellowstone     \
+       yosemite        yucca                                           \
 "
 
 #########################################################################
@@ -194,7 +195,7 @@ LIST_SA="assabet dnp1110 gcplus lart shannon"
 LIST_ARM7="    \
        armadillo       B2              ep7312          evb4510         \
        impa7           integratorap    ap7             ap720t          \
-       lpc2292sodimm   modnet50                                        \
+       lpc2292sodimm   modnet50        SMN42                           \
 "
 
 #########################################################################
index caa5a0e..2d8cff3 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -173,9 +173,6 @@ endif
 ifeq ($(CPU),mpc85xx)
 OBJS += cpu/$(CPU)/resetvec.o
 endif
-ifeq ($(CPU),mpc86xx)
-OBJS += cpu/$(CPU)/resetvec.o
-endif
 ifeq ($(CPU),bf533)
 OBJS += cpu/$(CPU)/start1.o    cpu/$(CPU)/interrupt.o  cpu/$(CPU)/cache.o
 OBJS += cpu/$(CPU)/flush.o     cpu/$(CPU)/init_sdram.o
@@ -1017,6 +1014,15 @@ xtract_4xx = $(subst _25,,$(subst _33,,$(subst _BA,,$(subst _ME,,$(subst _HI,,$(
 acadia_config: unconfig
        @$(MKCONFIG) $(@:_config=) ppc ppc4xx acadia amcc
 
+acadia_nand_config:    unconfig
+       @mkdir -p $(obj)include
+       @mkdir -p $(obj)nand_spl
+       @mkdir -p $(obj)board/amcc/acadia
+       @echo "#define CONFIG_NAND_U_BOOT" > $(obj)include/config.h
+       @$(MKCONFIG) -n $@ -a acadia ppc ppc4xx acadia amcc
+       @echo "TEXT_BASE = 0x01000000" > $(obj)board/amcc/acadia/config.tmp
+       @echo "CONFIG_NAND_U_BOOT = y" >> $(obj)include/config.mk
+
 ADCIOP_config: unconfig
        @$(MKCONFIG) $(@:_config=) ppc ppc4xx adciop esd
 
@@ -1038,6 +1044,15 @@ ASH405_config:   unconfig
 bamboo_config: unconfig
        @$(MKCONFIG) $(@:_config=) ppc ppc4xx bamboo amcc
 
+bamboo_nand_config:    unconfig
+       @mkdir -p $(obj)include
+       @mkdir -p $(obj)nand_spl
+       @mkdir -p $(obj)board/amcc/bamboo
+       @echo "#define CONFIG_NAND_U_BOOT" > $(obj)include/config.h
+       @$(MKCONFIG) -n $@ -a bamboo ppc ppc4xx bamboo amcc
+       @echo "TEXT_BASE = 0x01000000" > $(obj)board/amcc/bamboo/config.tmp
+       @echo "CONFIG_NAND_U_BOOT = y" >> $(obj)include/config.mk
+
 bubinga_config:        unconfig
        @$(MKCONFIG) $(@:_config=) ppc ppc4xx bubinga amcc
 
@@ -1124,6 +1139,9 @@ katmai_config:    unconfig
 luan_config:   unconfig
        @$(MKCONFIG) $(@:_config=) ppc ppc4xx luan amcc
 
+lwmon5_config: unconfig
+       @$(MKCONFIG) $(@:_config=) ppc ppc4xx lwmon5
+
 METROBOX_config: unconfig
        @$(MKCONFIG) $(@:_config=) ppc ppc4xx metrobox sandburst
 
@@ -1792,8 +1810,16 @@ sbc8560_66_config:      unconfig
 stxgp3_config:         unconfig
        @$(MKCONFIG) $(@:_config=) ppc mpc85xx stxgp3
 
-stxssa_config:         unconfig
-       @$(MKCONFIG) $(@:_config=) ppc mpc85xx stxssa
+stxssa_config          \
+stxssa_4M_config:      unconfig
+       @mkdir -p $(obj)include
+       @if [ "$(findstring _4M_,$@)" ] ; then \
+               echo "#define CONFIG_STXSSA_4M" >>$(obj)include/config.h ; \
+               echo "... with 4 MiB flash memory" ; \
+       else \
+               >$(obj)include/config.h ; \
+       fi
+       @$(MKCONFIG) -a stxssa ppc mpc85xx stxssa
 
 TQM8540_config         \
 TQM8541_config         \
@@ -2113,7 +2139,10 @@ evb4510_config : unconfig
        @$(MKCONFIG) $(@:_config=) arm arm720t evb4510
 
 lpc2292sodimm_config:  unconfig
-       @$(MKCONFIG) $(@:_config=) arm arm720t lpc2292sodimm
+       @$(MKCONFIG) $(@:_config=) arm arm720t lpc2292sodimm NULL lpc2292
+
+SMN42_config   :       unconfig
+       @$(MKCONFIG) $(@:_config=) arm arm720t SMN42 siemens lpc2292
 
 #########################################################################
 ## XScale Systems
index abcbf3e..c56b273 100644 (file)
@@ -25,7 +25,7 @@ include $(TOPDIR)/config.mk
 
 LIB    = $(obj)lib$(BOARD).a
 
-COBJS  = $(BOARD).o cpr.o memory.o
+COBJS  = $(BOARD).o cmd_acadia.o memory.o pll.o
 SOBJS  =
 
 SRCS   := $(SOBJS:.o=.S) $(COBJS:.o=.c)
index baf598c..8b82ea4 100644 (file)
@@ -31,13 +31,13 @@ static void acadia_gpio_init(void)
        /*
         * GPIO0 setup (select GPIO or alternate function)
         */
-               out32(GPIO0_OSRL, CFG_GPIO0_OSRL);
-               out32(GPIO0_OSRH, CFG_GPIO0_OSRH);      /* output select */
-               out32(GPIO0_ISR1L, CFG_GPIO0_ISR1L);
-               out32(GPIO0_ISR1H, CFG_GPIO0_ISR1H);    /* input select */
-               out32(GPIO0_TSRL, CFG_GPIO0_TSRL);
-               out32(GPIO0_TSRH, CFG_GPIO0_TSRH);      /* three-state select */
-               out32(GPIO0_TCR, CFG_GPIO0_TCR);  /* enable output driver for outputs */
+       out32(GPIO0_OSRL, CFG_GPIO0_OSRL);
+       out32(GPIO0_OSRH, CFG_GPIO0_OSRH);      /* output select */
+       out32(GPIO0_ISR1L, CFG_GPIO0_ISR1L);
+       out32(GPIO0_ISR1H, CFG_GPIO0_ISR1H);    /* input select */
+       out32(GPIO0_TSRL, CFG_GPIO0_TSRL);
+       out32(GPIO0_TSRH, CFG_GPIO0_TSRH);      /* three-state select */
+       out32(GPIO0_TCR, CFG_GPIO0_TCR);  /* enable output driver for outputs */
 
        /*
         * Ultra (405EZ) was nice enough to add another GPIO controller
@@ -55,13 +55,25 @@ int board_early_init_f(void)
 {
        unsigned int reg;
 
+#if !defined(CONFIG_NAND_U_BOOT)
        /* don't reinit PLL when booting via I2C bootstrap option */
        mfsdr(SDR_PINSTP, reg);
        if (reg != 0xf0000000)
                board_pll_init_f();
+#endif
 
        acadia_gpio_init();
 
+       /* Configure 405EZ for NAND usage */
+       mtsdr(sdrnand0, SDR_NAND0_NDEN | SDR_NAND0_NDAREN | SDR_NAND0_NDRBEN);
+       mfsdr(sdrultra0, reg);
+       reg &= ~SDR_ULTRA0_CSN_MASK;
+       reg |= (SDR_ULTRA0_CSNSEL0 >> CFG_NAND_CS) |
+               SDR_ULTRA0_NDGPIOBP |
+               SDR_ULTRA0_EBCRDYEN |
+               SDR_ULTRA0_NFSRSTEN;
+       mtsdr(sdrultra0, reg);
+
        /* USB Host core needs this bit set */
        mfsdr(sdrultra1, reg);
        mtsdr(sdrultra1, reg | SDR_ULTRA1_LEDNENABLE);
@@ -91,8 +103,11 @@ int misc_init_f(void)
 int checkboard(void)
 {
        char *s = getenv("serial#");
+       u8 rev;
+
+       rev = in8(CFG_CPLD_BASE + 0);
+       printf("Board: Acadia - AMCC PPC405EZ Evaluation Board, Rev. %X", rev);
 
-       printf("Board: Acadia - AMCC PPC405EZ Evaluation Board");
        if (s != NULL) {
                puts(", serial# ");
                puts(s);
diff --git a/board/amcc/acadia/cmd_acadia.c b/board/amcc/acadia/cmd_acadia.c
new file mode 100644 (file)
index 0000000..fb7ea35
--- /dev/null
@@ -0,0 +1,101 @@
+/*
+ * (C) Copyright 2007
+ * Stefan Roese, DENX Software Engineering, sr@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 <command.h>
+#include <i2c.h>
+
+static u8 boot_267_nor[] = {
+       0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x8e, 0x00,
+       0x14, 0xc0, 0x36, 0xcc, 0x00, 0x0c, 0x00, 0x00,
+       0x00, 0x00, 0x00, 0x00
+};
+
+static u8 boot_267_nand[] = {
+       0xd0, 0x38, 0xc3, 0x50, 0x13, 0x88, 0x8e, 0x00,
+       0x14, 0xc0, 0x36, 0xcc, 0x00, 0x0c, 0x00, 0x00,
+       0x00, 0x00, 0x00, 0x00
+};
+
+static int do_bootstrap(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
+{
+       u8 chip;
+       u8 *buf;
+       int cpu_freq;
+
+       if (argc < 3) {
+               printf("Usage:\n%s\n", cmdtp->usage);
+               return 1;
+       }
+
+       cpu_freq = simple_strtol(argv[1], NULL, 10);
+       if (cpu_freq != 267) {
+               printf("Unsupported cpu-frequency - only 267 supported\n");
+               return 1;
+       }
+
+       /* use 0x50 as I2C EEPROM address for now */
+       chip = 0x50;
+
+       if ((strcmp(argv[2], "nor") != 0) &&
+           (strcmp(argv[2], "nand") != 0)) {
+               printf("Unsupported boot-device - only nor|nand support\n");
+               return 1;
+       }
+
+       if (strcmp(argv[2], "nand") == 0) {
+               switch (cpu_freq) {
+               case 267:
+                       buf = boot_267_nand;
+                       break;
+               default:
+                       break;
+               }
+       } else {
+               switch (cpu_freq) {
+               case 267:
+                       buf = boot_267_nor;
+                       break;
+               default:
+                       break;
+               }
+       }
+
+       if (i2c_write(chip, 0, 1, buf, 16) != 0)
+               printf("Error writing to EEPROM at address 0x%x\n", chip);
+       udelay(CFG_EEPROM_PAGE_WRITE_DELAY_MS * 1000);
+       if (i2c_write(chip, 0x10, 1, buf+16, 4) != 0)
+               printf("Error2 writing to EEPROM at address 0x%x\n", chip);
+
+       printf("Done\n");
+       printf("Please power-cycle the board for the changes to take effect\n");
+
+       return 0;
+}
+
+U_BOOT_CMD(
+       bootstrap,      3,      0,      do_bootstrap,
+       "bootstrap - program the I2C bootstrap EEPROM\n",
+       "<cpu-freq> <nor|nand> - program the I2C bootstrap EEPROM\n"
+       );
index c8566ec..af5a46c 100644 (file)
 # MA 02111-1307 USA
 #
 
+#
+# AMCC 405EZ Reference Platform (Acadia) board
+#
+
+sinclude $(OBJTREE)/board/$(BOARDDIR)/config.tmp
+
 ifndef TEXT_BASE
 TEXT_BASE = 0xFFFC0000
 endif
index 5375d36..9346d2c 100644 (file)
@@ -31,6 +31,8 @@
 #include <asm/io.h>
 #include <asm/gpio.h>
 
+extern void board_pll_init_f(void);
+
 /*
  * sdram_init - Dummy implementation for start.S, spd_sdram used on this board!
  */
@@ -39,6 +41,7 @@ void sdram_init(void)
        return;
 }
 
+#if !defined(CONFIG_NAND_U_BOOT) || defined(CONFIG_NAND_SPL)
 static void cram_bcr_write(u32 wr_val)
 {
        wr_val <<= 2;
@@ -62,9 +65,21 @@ static void cram_bcr_write(u32 wr_val)
 
        return;
 }
+#endif
 
 long int initdram(int board_type)
 {
+#if defined(CONFIG_NAND_SPL)
+       u32 reg;
+
+       /* don't reinit PLL when booting via I2C bootstrap option */
+       mfsdr(SDR_PINSTP, reg);
+       if (reg != 0xf0000000)
+               board_pll_init_f();
+#endif
+
+#if !defined(CONFIG_NAND_U_BOOT) || defined(CONFIG_NAND_SPL)
+       int i;
        u32 val;
 
        /* 1. EBC need to program READY, CLK, ADV for ASync mode */
@@ -92,7 +107,12 @@ long int initdram(int board_type)
 
        /* Config EBC to use RDY */
        mfsdr(sdrultra0, val);
-       mtsdr(sdrultra0, val | 0x04000000);
+       mtsdr(sdrultra0, val | SDR_ULTRA0_EBCRDYEN);
+
+       /* Wait a short while, since for NAND booting this is too fast */
+       for (i=0; i<200000; i++)
+               ;
+#endif
 
        return (CFG_MBYTES_RAM << 20);
 }
diff --git a/board/amcc/acadia/u-boot-nand.lds b/board/amcc/acadia/u-boot-nand.lds
new file mode 100644 (file)
index 0000000..a5dae0e
--- /dev/null
@@ -0,0 +1,137 @@
+/*
+ * (C) Copyright 2007
+ * 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);
+SECTIONS
+{
+  /* Read-only sections, merged into text segment: */
+  . = + SIZEOF_HEADERS;
+  .interp : { *(.interp) }
+  .hash          : { *(.hash)          }
+  .dynsym        : { *(.dynsym)                }
+  .dynstr        : { *(.dynstr)                }
+  .rel.text      : { *(.rel.text)              }
+  .rela.text     : { *(.rela.text)     }
+  .rel.data      : { *(.rel.data)              }
+  .rela.data     : { *(.rela.data)     }
+  .rel.rodata    : { *(.rel.rodata)    }
+  .rela.rodata   : { *(.rela.rodata)   }
+  .rel.got       : { *(.rel.got)               }
+  .rela.got      : { *(.rela.got)              }
+  .rel.ctors     : { *(.rel.ctors)     }
+  .rela.ctors    : { *(.rela.ctors)    }
+  .rel.dtors     : { *(.rel.dtors)     }
+  .rela.dtors    : { *(.rela.dtors)    }
+  .rel.bss       : { *(.rel.bss)               }
+  .rela.bss      : { *(.rela.bss)              }
+  .rel.plt       : { *(.rel.plt)               }
+  .rela.plt      : { *(.rela.plt)              }
+  .init          : { *(.init)  }
+  .plt : { *(.plt) }
+  .text      :
+  {
+    /* WARNING - the following is hand-optimized to fit within */
+    /* the sector layout of our flash chips!   XXX FIXME XXX   */
+
+    cpu/ppc4xx/start.o (.text)
+
+    /* Align to next NAND block */
+    . = ALIGN(0x4000);
+    common/environment.o  (.ppcenv)
+    /* Keep some space here for redundant env and potential bad env blocks */
+    . = ALIGN(0x10000);
+
+    *(.text)
+    *(.fixup)
+    *(.got1)
+  }
+  _etext = .;
+  PROVIDE (etext = .);
+  .rodata    :
+  {
+    *(.rodata)
+    *(.rodata1)
+    *(.rodata.str1.4)
+  }
+  .fini      : { *(.fini)    } =0
+  .ctors     : { *(.ctors)   }
+  .dtors     : { *(.dtors)   }
+
+  /* Read-write section, merged into data segment: */
+  . = (. + 0x00FF) & 0xFFFFFF00;
+  _erotext = .;
+  PROVIDE (erotext = .);
+  .reloc   :
+  {
+    *(.got)
+    _GOT2_TABLE_ = .;
+    *(.got2)
+    _FIXUP_TABLE_ = .;
+    *(.fixup)
+  }
+  __got2_entries = (_FIXUP_TABLE_ - _GOT2_TABLE_) >>2;
+  __fixup_entries = (. - _FIXUP_TABLE_)>>2;
+
+  .data    :
+  {
+    *(.data)
+    *(.data1)
+    *(.sdata)
+    *(.sdata2)
+    *(.dynamic)
+    CONSTRUCTORS
+  }
+  _edata  =  .;
+  PROVIDE (edata = .);
+
+  . = .;
+  __u_boot_cmd_start = .;
+  .u_boot_cmd : { *(.u_boot_cmd) }
+  __u_boot_cmd_end = .;
+
+
+  . = .;
+  __start___ex_table = .;
+  __ex_table : { *(__ex_table) }
+  __stop___ex_table = .;
+
+  . = ALIGN(256);
+  __init_begin = .;
+  .text.init : { *(.text.init) }
+  .data.init : { *(.data.init) }
+  . = ALIGN(256);
+  __init_end = .;
+
+  __bss_start = .;
+  .bss       :
+  {
+   *(.sbss) *(.scommon)
+   *(.dynbss)
+   *(.bss)
+   *(COMMON)
+  }
+
+  _end = . ;
+  PROVIDE (end = .);
+}
index 5da96e9..d01cc49 100644 (file)
@@ -1,5 +1,5 @@
 #
-# (C) Copyright 2002-2006
+# (C) Copyright 2002-2007
 # Wolfgang Denk, DENX Software Engineering, wd@denx.de.
 #
 # See file CREDITS for list of people who contributed to this
@@ -33,7 +33,7 @@ OBJS  := $(addprefix $(obj),$(COBJS))
 SOBJS  := $(addprefix $(obj),$(SOBJS))
 
 $(LIB):        $(OBJS) $(SOBJS)
-       $(AR) $(ARFLAGS) $@ $(OBJS)
+       $(AR) $(ARFLAGS) $@ $(OBJS) $(SOBJS)
 
 clean:
        rm -f $(SOBJS) $(OBJS)
index 6260b01..caf6690 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * (C) Copyright 2005
+ * (C) Copyright 2005-2007
  * Stefan Roese, DENX Software Engineering, sr@denx.de.
  *
  * See file CREDITS for list of people who contributed to this
@@ -291,6 +291,7 @@ int checkboard(void)
        return (0);
 }
 
+#if !(defined(CONFIG_NAND_U_BOOT) || defined(CONFIG_NAND_SPL))
 /*************************************************************************
  *
  * init_spd_array -- Bamboo has one bank onboard sdram (plus DIMM)
@@ -345,10 +346,12 @@ static void init_spd_array(void)
        cfg_simulate_spd_eeprom[25]    = 0x00;    /* SDRAM Cycle Time (cas latency 1.5) = N.A */
        cfg_simulate_spd_eeprom[12]    = 0x82;    /* refresh Rate Type: Normal (15.625us) + Self refresh */
 }
+#endif
 
 long int initdram (int board_type)
 {
-       long dram_size = 0;
+#if !(defined(CONFIG_NAND_U_BOOT) || defined(CONFIG_NAND_SPL))
+       long dram_size;
 
        /*
         * First write simulated values in eeprom array for onboard bank 0
@@ -358,6 +361,9 @@ long int initdram (int board_type)
        dram_size = spd_sdram();
 
        return dram_size;
+#else
+       return CFG_MBYTES_SDRAM << 20;
+#endif
 }
 
 #if defined(CFG_DRAM_TEST)
@@ -410,7 +416,7 @@ int testdram(void)
  *     certain pre-initialization actions.
  *
  ************************************************************************/
-#if defined(CONFIG_PCI) && defined(CFG_PCI_PRE_INIT)
+#if defined(CONFIG_PCI)
 int pci_pre_init(struct pci_controller *hose)
 {
        unsigned long addr;
@@ -451,7 +457,7 @@ int pci_pre_init(struct pci_controller *hose)
 
        return 1;
 }
-#endif                         /* defined(CONFIG_PCI) && defined(CFG_PCI_PRE_INIT) */
+#endif /* defined(CONFIG_PCI) */
 
 /*************************************************************************
  *  pci_target_init
@@ -881,11 +887,11 @@ void ext_bus_cntlr_init(void)
                /*------------------------------------------------------------------------- */
        case BOOT_FROM_NAND_FLASH0:
                /*------------------------------------------------------------------------- */
-               ebc0_cs0_bnap_value = 0;
-               ebc0_cs0_bncr_value = 0;
+               ebc0_cs0_bnap_value = EBC0_BNAP_NAND_FLASH;
+               ebc0_cs0_bncr_value = EBC0_BNCR_NAND_FLASH_CS1;
 
-               ebc0_cs1_bnap_value = EBC0_BNAP_NAND_FLASH;
-               ebc0_cs1_bncr_value = EBC0_BNCR_NAND_FLASH_CS1;
+               ebc0_cs1_bnap_value = 0;
+               ebc0_cs1_bncr_value = 0;
                ebc0_cs2_bnap_value = 0;
                ebc0_cs2_bncr_value = 0;
                ebc0_cs3_bnap_value = 0;
@@ -1409,10 +1415,10 @@ void update_ndfc_ios(void)
        gpio_tab[GPIO0][6].in_out = GPIO_OUT;       /* EBC_CS_N(1) */
        gpio_tab[GPIO0][6].alt_nb = GPIO_ALT1;
 
-#if 0
        gpio_tab[GPIO0][7].in_out = GPIO_OUT;       /* EBC_CS_N(2) */
        gpio_tab[GPIO0][7].alt_nb = GPIO_ALT1;
 
+#if 0
        gpio_tab[GPIO0][7].in_out = GPIO_OUT;       /* EBC_CS_N(3) */
        gpio_tab[GPIO0][7].alt_nb = GPIO_ALT1;
 #endif
@@ -1900,12 +1906,21 @@ void configure_ppc440ep_pins(void)
        {
                update_ndfc_ios();
 
+#if !(defined(CONFIG_NAND_U_BOOT) || defined(CONFIG_NAND_SPL))
                mtsdr(sdr_cust0, SDR0_CUST0_MUX_NDFC_SEL   |
                      SDR0_CUST0_NDFC_ENABLE    |
                      SDR0_CUST0_NDFC_BW_8_BIT  |
                      SDR0_CUST0_NDFC_ARE_MASK  |
                      SDR0_CUST0_CHIPSELGAT_EN1 |
                      SDR0_CUST0_CHIPSELGAT_EN2);
+#else
+               mtsdr(sdr_cust0, SDR0_CUST0_MUX_NDFC_SEL   |
+                     SDR0_CUST0_NDFC_ENABLE    |
+                     SDR0_CUST0_NDFC_BW_8_BIT  |
+                     SDR0_CUST0_NDFC_ARE_MASK  |
+                     SDR0_CUST0_CHIPSELGAT_EN0 |
+                     SDR0_CUST0_CHIPSELGAT_EN2);
+#endif
 
                ndfc_selection_in_fpga();
        }
index 9d7f4c3..b46527d 100644 (file)
@@ -1,5 +1,5 @@
 #
-# (C) Copyright 2002-2006
+# (C) Copyright 2002-2007
 # Wolfgang Denk, DENX Software Engineering, wd@denx.de.
 #
 # See file CREDITS for list of people who contributed to this
 # MA 02111-1307 USA
 #
 
+sinclude $(OBJTREE)/board/$(BOARDDIR)/config.tmp
+
+ifndef TEXT_BASE
 TEXT_BASE = 0xFFFA0000
+endif
 
 PLATFORM_CPPFLAGS += -DCONFIG_440=1
 
index a30ab7a..8a2e832 100644 (file)
@@ -53,7 +53,7 @@ flash_info_t flash_info[CFG_MAX_FLASH_BANKS]; /* info for FLASH chips        */
 static unsigned long flash_addr_table[][CFG_MAX_FLASH_BANKS] = {
        {0x87800001, 0xFFF00000, 0xFFF80000}, /* 0:boot from small flash */
        {0x00000000, 0x00000000, 0x00000000}, /* 1:boot from pci 66      */
-       {0x00000000, 0x00000000, 0x00000000}, /* 2:boot from nand flash  */
+       {0x87800001, 0x00000000, 0x00000000}, /* 0:boot from nand flash  */
        {0x87F00000, 0x87F80000, 0xFFC00001}, /* 3:boot from big flash 33*/
        {0x87F00000, 0x87F80000, 0xFFC00001}, /* 4:boot from big flash 66*/
        {0x00000000, 0x00000000, 0x00000000}, /* 5:boot from             */
@@ -134,10 +134,10 @@ unsigned long flash_init(void)
                flash_info[i].size = 0;
 
                /* check whether the address is 0 */
-               if (flash_addr_table[index][i] == 0) {
+               if (flash_addr_table[index][i] == 0)
                        continue;
-               }
 
+               DEBUGF("Detection bank %d...\n", i);
                /* call flash_get_size() to initialize sector address */
                size_b[i] = flash_get_size((vu_long *) flash_addr_table[index][i],
                                   &flash_info[i]);
index 7820107..1459eec 100644 (file)
@@ -1,74 +1,31 @@
 /*
-*
-* 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
-*/
+ * (C) Copyright 2007
+ * Stefan Roese, DENX Software Engineering, sr@denx.de.
+ *
+ *  Copyright (C) 2002 Scott McNutt <smcnutt@artesyncp.com>
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.         See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
 
 #include <ppc_asm.tmpl>
 #include <config.h>
-
-/* General */
-#define TLB_VALID   0x00000200
-
-/* Supported page sizes */
-
-#define SZ_1K      0x00000000
-#define SZ_4K      0x00000010
-#define SZ_16K     0x00000020
-#define SZ_64K     0x00000030
-#define SZ_256K            0x00000040
-#define SZ_1M      0x00000050
-#define SZ_8M       0x00000060
-#define SZ_16M     0x00000070
-#define SZ_256M            0x00000090
-
-/* Storage attributes */
-#define SA_W       0x00000800      /* Write-through */
-#define SA_I       0x00000400      /* Caching inhibited */
-#define SA_M       0x00000200      /* Memory coherence */
-#define SA_G       0x00000100      /* Guarded */
-#define SA_E       0x00000080      /* Endian */
-
-/* Access control */
-#define AC_X       0x00000024      /* Execute */
-#define AC_W       0x00000012      /* Write */
-#define AC_R       0x00000009      /* Read */
-
-/* Some handy macros */
-
-#define EPN(e)         ((e) & 0xfffffc00)
-#define TLB0(epn,sz)   ( (EPN((epn)) | (sz) | TLB_VALID ) )
-#define TLB1(rpn,erpn) ( ((rpn)&0xfffffc00) | (erpn) )
-#define TLB2(a)                ( (a)&0x00000fbf )
-
-#define tlbtab_start\
-       mflr    r1  ;\
-       bl 0f       ;
-
-#define tlbtab_end\
-       .long 0, 0, 0   ;   \
-0:     mflr    r0      ;   \
-       mtlr    r1      ;   \
-       blr             ;
-
-#define tlbentry(epn,sz,rpn,erpn,attr)\
-       .long TLB0(epn,sz),TLB1(rpn,erpn),TLB2(attr)
-
+#include <asm-ppc/mmu.h>
 
 /**************************************************************************
  * TLB TABLE
  *  Pointer to the table is returned in r1
  *
  *************************************************************************/
-
-    .section .bootpg,"ax"
-    .globl tlbtab
+       .section .bootpg,"ax"
+       .globl tlbtab
 
 tlbtab:
-    tlbtab_start
-
-    /*
-     * BOOT_CS (FLASH) must be first. Before relocation SA_I can be off to use the
-     * speed up boot process. It is patched after relocation to enable SA_I
-     */
-    tlbentry( CFG_BOOT_BASE_ADDR, SZ_256M, CFG_BOOT_BASE_ADDR, 0, AC_R|AC_W|AC_X|SA_G/*|SA_I*/)
-
-    /* TLB-entry for init-ram in dcache (SA_I must be turned off!) */
-    tlbentry( CFG_INIT_RAM_ADDR, SZ_64K, CFG_INIT_RAM_ADDR, 0, AC_R|AC_W|AC_X|SA_G )
-
-    tlbentry( CFG_SDRAM_BASE, SZ_256M, CFG_SDRAM_BASE, 0, AC_R|AC_W|AC_X|SA_G|SA_I )
-    tlbentry( CFG_PCI_BASE, SZ_256M, CFG_PCI_BASE, 0, AC_R|AC_W|SA_G|SA_I )
-    tlbentry( CFG_NVRAM_BASE_ADDR, SZ_256M, CFG_NVRAM_BASE_ADDR, 0, AC_R|AC_W|AC_X|SA_W|SA_I )
-    tlbentry( CFG_NAND_ADDR, SZ_256M, CFG_NAND_ADDR, 0, AC_R|AC_W|AC_X|SA_W|SA_I )
-
-    /* PCI */
-    tlbentry( CFG_PCI_MEMBASE, SZ_256M, CFG_PCI_MEMBASE, 0, AC_R|AC_W|SA_G|SA_I )
-    tlbentry( CFG_PCI_MEMBASE1, SZ_256M, CFG_PCI_MEMBASE1, 0, AC_R|AC_W|SA_G|SA_I )
-    tlbentry( CFG_PCI_MEMBASE2, SZ_256M, CFG_PCI_MEMBASE2, 0, AC_R|AC_W|SA_G|SA_I )
-    tlbentry( CFG_PCI_MEMBASE3, SZ_256M, CFG_PCI_MEMBASE3, 0, AC_R|AC_W|SA_G|SA_I )
-
-    /* USB 2.0 Device */
-    tlbentry( CFG_USB_DEVICE, SZ_1K, CFG_USB_DEVICE, 0, AC_R|AC_W|SA_G|SA_I )
-
-    tlbtab_end
+       tlbtab_start
+
+       /*
+        * BOOT_CS (FLASH) must be first. Before relocation SA_I can be off to use the
+        * speed up boot process. It is patched after relocation to enable SA_I
+        */
+#ifndef CONFIG_NAND_SPL
+       tlbentry(CFG_BOOT_BASE_ADDR, SZ_256M, CFG_BOOT_BASE_ADDR, 0, AC_R|AC_W|AC_X|SA_G)
+#else
+       tlbentry(CFG_NAND_BOOT_SPL_SRC, SZ_4K, CFG_NAND_BOOT_SPL_SRC, 0, AC_R|AC_W|AC_X|SA_G)
+#endif
+
+       /* TLB-entry for init-ram in dcache (SA_I must be turned off!) */
+       tlbentry(CFG_INIT_RAM_ADDR, SZ_4K, CFG_INIT_RAM_ADDR, 0, AC_R|AC_W|AC_X|SA_G)
+
+       tlbentry(CFG_SDRAM_BASE, SZ_256M, CFG_SDRAM_BASE, 0, AC_R|AC_W|AC_X|SA_G|SA_I)
+
+       /* PCI base & peripherals */
+       tlbentry(CFG_PCI_BASE, SZ_256M, CFG_PCI_BASE, 0, AC_R|AC_W|SA_G|SA_I)
+
+       tlbentry(CFG_NVRAM_BASE_ADDR, SZ_256M, CFG_NVRAM_BASE_ADDR, 0, AC_R|AC_W|AC_X|SA_W|SA_I)
+       tlbentry(CFG_NAND_ADDR, SZ_4K, CFG_NAND_ADDR, 0, AC_R|AC_W|AC_X|SA_W|SA_I)
+
+       /* PCI */
+       tlbentry(CFG_PCI_MEMBASE, SZ_256M, CFG_PCI_MEMBASE, 0, AC_R|AC_W|SA_G|SA_I)
+       tlbentry(CFG_PCI_MEMBASE1, SZ_256M, CFG_PCI_MEMBASE1, 0, AC_R|AC_W|SA_G|SA_I)
+       tlbentry(CFG_PCI_MEMBASE2, SZ_256M, CFG_PCI_MEMBASE2, 0, AC_R|AC_W|SA_G|SA_I)
+       tlbentry(CFG_PCI_MEMBASE3, SZ_256M, CFG_PCI_MEMBASE3, 0, AC_R|AC_W|SA_G|SA_I)
+
+       /* USB 2.0 Device */
+       tlbentry(CFG_USB_DEVICE, SZ_1K, CFG_USB_DEVICE, 0, AC_R|AC_W|SA_G|SA_I)
+
+       tlbtab_end
+
+#if defined(CONFIG_NAND_U_BOOT) && !defined(CONFIG_NAND_SPL)
+       /*
+        * For NAND booting the first TLB has to be reconfigured to full size
+        * and with caching disabled after running from RAM!
+        */
+#define TLB00  TLB0(CFG_BOOT_BASE_ADDR, SZ_256M)
+#define TLB01  TLB1(CFG_BOOT_BASE_ADDR, 0)
+#define TLB02  TLB2(AC_R|AC_W|AC_X|SA_G|SA_I)
+
+       .globl  reconfig_tlb0
+reconfig_tlb0:
+       sync
+       isync
+       addi    r4,r0,0x0000            /* TLB entry #0 */
+       lis     r5,TLB00@h
+       ori     r5,r5,TLB00@l
+       tlbwe   r5,r4,0x0000            /* Save it out */
+       lis     r5,TLB01@h
+       ori     r5,r5,TLB01@l
+       tlbwe   r5,r4,0x0001            /* Save it out */
+       lis     r5,TLB02@h
+       ori     r5,r5,TLB02@l
+       tlbwe   r5,r4,0x0002            /* Save it out */
+       sync
+       isync
+       blr
+#endif
diff --git a/board/amcc/bamboo/u-boot-nand.lds b/board/amcc/bamboo/u-boot-nand.lds
new file mode 100644 (file)
index 0000000..a5dae0e
--- /dev/null
@@ -0,0 +1,137 @@
+/*
+ * (C) Copyright 2007
+ * 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);
+SECTIONS
+{
+  /* Read-only sections, merged into text segment: */
+  . = + SIZEOF_HEADERS;
+  .interp : { *(.interp) }
+  .hash          : { *(.hash)          }
+  .dynsym        : { *(.dynsym)                }
+  .dynstr        : { *(.dynstr)                }
+  .rel.text      : { *(.rel.text)              }
+  .rela.text     : { *(.rela.text)     }
+  .rel.data      : { *(.rel.data)              }
+  .rela.data     : { *(.rela.data)     }
+  .rel.rodata    : { *(.rel.rodata)    }
+  .rela.rodata   : { *(.rela.rodata)   }
+  .rel.got       : { *(.rel.got)               }
+  .rela.got      : { *(.rela.got)              }
+  .rel.ctors     : { *(.rel.ctors)     }
+  .rela.ctors    : { *(.rela.ctors)    }
+  .rel.dtors     : { *(.rel.dtors)     }
+  .rela.dtors    : { *(.rela.dtors)    }
+  .rel.bss       : { *(.rel.bss)               }
+  .rela.bss      : { *(.rela.bss)              }
+  .rel.plt       : { *(.rel.plt)               }
+  .rela.plt      : { *(.rela.plt)              }
+  .init          : { *(.init)  }
+  .plt : { *(.plt) }
+  .text      :
+  {
+    /* WARNING - the following is hand-optimized to fit within */
+    /* the sector layout of our flash chips!   XXX FIXME XXX   */
+
+    cpu/ppc4xx/start.o (.text)
+
+    /* Align to next NAND block */
+    . = ALIGN(0x4000);
+    common/environment.o  (.ppcenv)
+    /* Keep some space here for redundant env and potential bad env blocks */
+    . = ALIGN(0x10000);
+
+    *(.text)
+    *(.fixup)
+    *(.got1)
+  }
+  _etext = .;
+  PROVIDE (etext = .);
+  .rodata    :
+  {
+    *(.rodata)
+    *(.rodata1)
+    *(.rodata.str1.4)
+  }
+  .fini      : { *(.fini)    } =0
+  .ctors     : { *(.ctors)   }
+  .dtors     : { *(.dtors)   }
+
+  /* Read-write section, merged into data segment: */
+  . = (. + 0x00FF) & 0xFFFFFF00;
+  _erotext = .;
+  PROVIDE (erotext = .);
+  .reloc   :
+  {
+    *(.got)
+    _GOT2_TABLE_ = .;
+    *(.got2)
+    _FIXUP_TABLE_ = .;
+    *(.fixup)
+  }
+  __got2_entries = (_FIXUP_TABLE_ - _GOT2_TABLE_) >>2;
+  __fixup_entries = (. - _FIXUP_TABLE_)>>2;
+
+  .data    :
+  {
+    *(.data)
+    *(.data1)
+    *(.sdata)
+    *(.sdata2)
+    *(.dynamic)
+    CONSTRUCTORS
+  }
+  _edata  =  .;
+  PROVIDE (edata = .);
+
+  . = .;
+  __u_boot_cmd_start = .;
+  .u_boot_cmd : { *(.u_boot_cmd) }
+  __u_boot_cmd_end = .;
+
+
+  . = .;
+  __start___ex_table = .;
+  __ex_table : { *(__ex_table) }
+  __stop___ex_table = .;
+
+  . = ALIGN(256);
+  __init_begin = .;
+  .text.init : { *(.text.init) }
+  .data.init : { *(.data.init) }
+  . = ALIGN(256);
+  __init_end = .;
+
+  __bss_start = .;
+  .bss       :
+  {
+   *(.sbss) *(.scommon)
+   *(.dynbss)
+   *(.bss)
+   *(COMMON)
+  }
+
+  _end = . ;
+  PROVIDE (end = .);
+}
index dcafac9..ededb3e 100644 (file)
@@ -207,14 +207,14 @@ long int fixed_sdram(void)
  *     certain pre-initialization actions.
  *
  ************************************************************************/
-#if defined(CONFIG_PCI) && defined(CFG_PCI_PRE_INIT)
+#if defined(CONFIG_PCI)
 int pci_pre_init(struct pci_controller *hose)
 {
        unsigned long strap;
 
        /*--------------------------------------------------------------------------+
-     * The ebony board is always configured as the host & requires the
-     * PCI arbiter to be enabled.
+        * The ebony board is always configured as the host & requires the
+        * PCI arbiter to be enabled.
         *--------------------------------------------------------------------------*/
        strap = mfdcr(cpc0_strp1);
        if ((strap & 0x00100000) == 0) {
@@ -224,7 +224,7 @@ int pci_pre_init(struct pci_controller *hose)
 
        return 1;
 }
-#endif                         /* defined(CONFIG_PCI) && defined(CFG_PCI_PRE_INIT) */
+#endif /* defined(CONFIG_PCI) */
 
 /*************************************************************************
  *  pci_target_init
index 286bdc1..b804d55 100644 (file)
@@ -292,7 +292,7 @@ int testdram (void)
  *     certain pre-initialization actions.
  *
  ************************************************************************/
-#if defined(CONFIG_PCI) && defined(CFG_PCI_PRE_INIT)
+#if defined(CONFIG_PCI)
 int pci_pre_init(struct pci_controller * hose )
 {
        unsigned long strap;
@@ -309,7 +309,7 @@ int pci_pre_init(struct pci_controller * hose )
 
        return 1;
 }
-#endif /* defined(CONFIG_PCI) && defined(CFG_PCI_PRE_INIT) */
+#endif /* defined(CONFIG_PCI) */
 
 /*************************************************************************
  *  pci_target_init
index 778aafc..2eff3b3 100644 (file)
@@ -161,7 +161,7 @@ int testdram(void)
  *     certain pre-initialization actions.
  *
  ************************************************************************/
-#if defined(CONFIG_PCI) && defined(CFG_PCI_PRE_INIT)
+#if defined(CONFIG_PCI)
 int pci_pre_init( struct pci_controller *hose )
 {
        unsigned long strap;
@@ -179,7 +179,7 @@ int pci_pre_init( struct pci_controller *hose )
 
        return  1;
 }
-#endif /* defined(CONFIG_PCI) && defined(CFG_PCI_PRE_INIT) */
+#endif /* defined(CONFIG_PCI) */
 
 
 /*************************************************************************
index 3f6d204..3bd1b81 100644 (file)
@@ -306,7 +306,7 @@ long int fixed_sdram (void)
  *     certain pre-initialization actions.
  *
  ************************************************************************/
-#if defined(CONFIG_PCI) && defined(CFG_PCI_PRE_INIT)
+#if defined(CONFIG_PCI)
 int pci_pre_init(struct pci_controller * hose )
 {
        unsigned long strap;
@@ -323,7 +323,7 @@ int pci_pre_init(struct pci_controller * hose )
 
        return 1;
 }
-#endif /* defined(CONFIG_PCI) && defined(CFG_PCI_PRE_INIT) */
+#endif /* defined(CONFIG_PCI) */
 
 /*************************************************************************
  *  pci_target_init
index 06ef7f9..e1c9ad4 100644 (file)
@@ -25,7 +25,7 @@ include $(TOPDIR)/config.mk
 
 LIB    = $(obj)lib$(BOARD).a
 
-COBJS  = $(BOARD).o sdram.o
+COBJS  = $(BOARD).o cmd_sequoia.o sdram.o
 SOBJS  = init.o
 
 SRCS   := $(SOBJS:.o=.S) $(COBJS:.o=.c)
diff --git a/board/amcc/sequoia/cmd_sequoia.c b/board/amcc/sequoia/cmd_sequoia.c
new file mode 100644 (file)
index 0000000..6fc60ea
--- /dev/null
@@ -0,0 +1,111 @@
+/*
+ * (C) Copyright 2007
+ * Stefan Roese, DENX Software Engineering, sr@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 <command.h>
+#include <i2c.h>
+
+static u8 boot_533_nor[] = {
+       0x87, 0x78, 0x82, 0x52, 0x09, 0x57, 0xa0, 0x30,
+       0x40, 0x08, 0x23, 0x50, 0x0d, 0x05, 0x00, 0x00
+};
+
+static u8 boot_533_nand[] = {
+       0x87, 0x78, 0x82, 0x52, 0x09, 0x57, 0xd0, 0x10,
+       0xa0, 0x68, 0x23, 0x58, 0x0d, 0x05, 0x00, 0x00
+};
+
+static u8 boot_667_nor[] = {
+       0x87, 0x78, 0xa2, 0x52, 0x09, 0xd7, 0xa0, 0x30,
+       0x40, 0x08, 0x23, 0x50, 0x0d, 0x05, 0x00, 0x00
+};
+
+static u8 boot_667_nand[] = {
+       0x87, 0x78, 0xa2, 0x52, 0x09, 0xd7, 0xd0, 0x10,
+       0xa0, 0x68, 0x23, 0x58, 0x0d, 0x05, 0x00, 0x00
+};
+
+static int do_bootstrap(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
+{
+       u8 chip;
+       u8 *buf;
+       int cpu_freq;
+
+       if (argc < 3) {
+               printf("Usage:\n%s\n", cmdtp->usage);
+               return 1;
+       }
+
+       cpu_freq = simple_strtol(argv[1], NULL, 10);
+       if (!((cpu_freq == 533) || (cpu_freq == 667))) {
+               printf("Unsupported cpu-frequency - only 533 and 667 supported\n");
+               return 1;
+       }
+
+       /* use 0x52 as I2C EEPROM address for now */
+       chip = 0x52;
+
+       if ((strcmp(argv[2], "nor") != 0) &&
+           (strcmp(argv[2], "nand") != 0)) {
+               printf("Unsupported boot-device - only nor|nand support\n");
+               return 1;
+       }
+
+       if (strcmp(argv[2], "nand") == 0) {
+               switch (cpu_freq) {
+               default:
+               case 533:
+                       buf = boot_533_nand;
+                       break;
+               case 667:
+                       buf = boot_667_nand;
+                       break;
+               }
+       } else {
+               switch (cpu_freq) {
+               default:
+               case 533:
+                       buf = boot_533_nor;
+                       break;
+               case 667:
+                       buf = boot_667_nor;
+                       break;
+               }
+       }
+
+       if (i2c_write(chip, 0, 1, buf, 16) != 0)
+               printf("Error writing to EEPROM at address 0x%x\n", chip);
+       udelay(CFG_EEPROM_PAGE_WRITE_DELAY_MS * 1000);
+
+       printf("Done\n");
+       printf("Please power-cycle the board for the changes to take effect\n");
+
+       return 0;
+}
+
+U_BOOT_CMD(
+       bootstrap,      3,      0,      do_bootstrap,
+       "bootstrap - program the I2C bootstrap EEPROM\n",
+       "<cpu-freq> <nor|nand> - program the I2C bootstrap EEPROM\n"
+       );
index d045df1..78e2cb4 100644 (file)
@@ -387,7 +387,11 @@ void denali_core_search_data_eye(unsigned long memory_size)
 long int initdram (int board_type)
 {
 #if !defined(CONFIG_NAND_U_BOOT) || defined(CONFIG_NAND_SPL)
+#if !defined(CONFIG_NAND_SPL)
        ulong speed = get_bus_freq(0);
+#else
+       ulong speed = 133333333;        /* 133MHz is on the safe side   */
+#endif
 
        mtsdram(DDR0_02, 0x00000000);
 
index 930fa71..b437653 100644 (file)
@@ -363,8 +363,8 @@ int checkboard(void)
        printf("Board: Rainier - AMCC PPC440GRx Evaluation Board");
 #endif
 
-       rev = *(u8 *)(CFG_BCSR_BASE + 0);
-       val = *(u8 *)(CFG_BCSR_BASE + 5) & 0x01;
+       rev = in8(CFG_BCSR_BASE + 0);
+       val = in8(CFG_BCSR_BASE + 5) & 0x01;
        printf(", Rev. %X, PCI=%d MHz", rev, val ? 66 : 33);
 
        if (s != NULL) {
@@ -426,23 +426,10 @@ int testdram(void)
  *     certain pre-initialization actions.
  *
  ************************************************************************/
-#if defined(CONFIG_PCI) && defined(CFG_PCI_PRE_INIT)
+#if defined(CONFIG_PCI)
 int pci_pre_init(struct pci_controller *hose)
 {
        unsigned long addr;
-#if 0
-       /*--------------------------------------------------------------------------+
-        *      Cactus is always configured as the host & requires the
-        *      PCI arbiter to be enabled ???
-        *--------------------------------------------------------------------------*/
-       unsigned long strap;
-       mfsdr(sdr_sdstp1, strap);
-       if ((strap & SDR0_SDSTP1_PAE_MASK) == 0) {
-               printf("PCI: SDR0_STRP1[PAE] not set.\n");
-               printf("PCI: Configuration aborted.\n");
-               return 0;
-       }
-#endif
 
        /*-------------------------------------------------------------------------+
          | Set priority for all PLB3 devices to 0.
@@ -480,7 +467,7 @@ int pci_pre_init(struct pci_controller *hose)
 
        return 1;
 }
-#endif                         /* defined(CONFIG_PCI) && defined(CFG_PCI_PRE_INIT) */
+#endif /* defined(CONFIG_PCI) */
 
 /*************************************************************************
  *  pci_target_init
@@ -586,3 +573,13 @@ int is_pci_host(struct pci_controller *hose)
        return (1);
 }
 #endif                         /* defined(CONFIG_PCI) */
+#if defined(CONFIG_POST)
+/*
+ * Returns 1 if keys pressed to start the power-on long-running tests
+ * Called from board_init_f().
+ */
+int post_hotkeys_pressed(void)
+{
+       return 0;       /* No hotkeys supported */
+}
+#endif /* CONFIG_POST */
index 1a2e53b..bc976c7 100644 (file)
@@ -236,7 +236,7 @@ int testdram (void)
  *     certain pre-initialization actions.
  *
  ************************************************************************/
-#if defined(CONFIG_PCI) && defined(CFG_PCI_PRE_INIT)
+#if defined(CONFIG_PCI)
 int pci_pre_init(struct pci_controller * hose )
 {
        unsigned long strap;
@@ -253,7 +253,7 @@ int pci_pre_init(struct pci_controller * hose )
 
        return 1;
 }
-#endif /* defined(CONFIG_PCI) && defined(CFG_PCI_PRE_INIT) */
+#endif /* defined(CONFIG_PCI) */
 
 /*************************************************************************
  *  pci_target_init
index c2e12ba..912f09e 100644 (file)
@@ -385,7 +385,7 @@ int testdram(void)
  *     certain pre-initialization actions.
  *
  ************************************************************************/
-#if defined(CONFIG_PCI) && defined(CFG_PCI_PRE_INIT)
+#if defined(CONFIG_PCI)
 int pci_pre_init(struct pci_controller *hose)
 {
        unsigned long addr;
@@ -426,7 +426,7 @@ int pci_pre_init(struct pci_controller *hose)
 
        return 1;
 }
-#endif                         /* defined(CONFIG_PCI) && defined(CFG_PCI_PRE_INIT) */
+#endif /* defined(CONFIG_PCI) */
 
 /*************************************************************************
  *  pci_target_init
index 90eaab1..7316c34 100644 (file)
@@ -604,7 +604,7 @@ int testdram (void)
  *     certain pre-initialization actions.
  *
  ************************************************************************/
-#if defined(CONFIG_PCI) && defined(CFG_PCI_PRE_INIT)
+#if defined(CONFIG_PCI)
 int pci_pre_init(struct pci_controller * hose )
 {
        unsigned long strap;
@@ -621,7 +621,7 @@ int pci_pre_init(struct pci_controller * hose )
 
        return 1;
 }
-#endif /* defined(CONFIG_PCI) && defined(CFG_PCI_PRE_INIT) */
+#endif /* defined(CONFIG_PCI) */
 
 /*************************************************************************
  *  pci_target_init
index f00837a..807b9e8 100644 (file)
@@ -48,7 +48,7 @@
 #define TXBUF_BASE_ADDR                0xFF800000
 #define TX_BUF_CNT             1
 
-#define TOUT_LOOP              1000000
+#define TOUT_LOOP              1000000
 
 ADI_ETHER_BUFFER *txbuf[TX_BUF_CNT];
 ADI_ETHER_BUFFER *rxbuf[PKTBUFSRX];
index acc1e86..1fa7a10 100644 (file)
@@ -44,9 +44,9 @@
 #define ERASE_SECT             6
 #define READ                   7
 #define GET_SECTNUM            8
-#define FLASH_START_L          0x0000
-#define FLASH_START_H          0x2000
-#define FLASH_MAN_ST           2
+#define FLASH_START_L          0x0000
+#define FLASH_START_H          0x2000
+#define FLASH_MAN_ST           2
 #define RESET_VAL              0xF0
 
 flash_info_t flash_info[CFG_MAX_FLASH_BANKS];
index 7077e85..d9c08ee 100644 (file)
@@ -9,7 +9,7 @@
 
 /* Application definitions */
 
-#define        NUM_SECTORS     128     /* number of sectors */
+#define        NUM_SECTORS     128     /* number of sectors */
 #define SECTOR_SIZE    0x10000
 #define NOP_NUM                1000
 
index 3fb2d0c..8632097 100644 (file)
@@ -33,7 +33,7 @@ SEARCH_DIR(/lib); SEARCH_DIR(/usr/lib); SEARCH_DIR(/usr/local/lib);
    __DYNAMIC = 0;    */
 MEMORY
  {
- ram :            ORIGIN = (CFG_MONITOR_BASE), LENGTH = (256 * 1024)
+ ram :    ORIGIN = (CFG_MONITOR_BASE), LENGTH = (256 * 1024)
  l1_code : ORIGIN = 0xFFA00000, LENGTH = 0xC000
  l1_data : ORIGIN = 0xFF900000, LENGTH = 0x4000
  }
@@ -47,11 +47,11 @@ SECTIONS
   .dynsym        : { *(.dynsym)                }
   .dynstr        : { *(.dynstr)                }
   .rel.text      : { *(.rel.text)      }
-  .rela.text     : { *(.rela.text)     }
+  .rela.text     : { *(.rela.text)     }
   .rel.data      : { *(.rel.data)      }
-  .rela.data     : { *(.rela.data)     }
-  .rel.rodata    : { *(.rel.rodata)    }
-  .rela.rodata   : { *(.rela.rodata)   }
+  .rela.data     : { *(.rela.data)     }
+  .rel.rodata    : { *(.rel.rodata)    }
+  .rela.rodata   : { *(.rela.rodata)   }
   .rel.got       : { *(.rel.got)       }
   .rela.got      : { *(.rela.got)      }
   .rel.ctors     : { *(.rel.ctors)     }
@@ -68,7 +68,7 @@ SECTIONS
   .text      :
   {
     /* WARNING - the following is hand-optimized to fit within */
-    /* the sector before the environment sector. If it throws  */
+    /* the sector before the environment sector. If it throws  */
     /* an error during compilation remove an object here to get        */
     /* it linked after the configuration sector.               */
 
index f803610..2ed0fc2 100644 (file)
 
 #include <common.h>
 #include <asm/processor.h>
+#include <asm/io.h>
 #include <command.h>
 #include <malloc.h>
 #include <net.h>
+#include <pci.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -179,11 +181,15 @@ int board_early_init_f (void)
        mtdcr(uicsr, 0xFFFFFFFF);       /* clear all ints */
        mtdcr(uicer, 0x00000000);       /* disable all ints */
        mtdcr(uiccr, 0x00000000);       /* set all to be non-critical*/
+#ifdef CONFIG_CPCI405_6U
        if (cpci405_version() == 3) {
                mtdcr(uicpr, 0xFFFFFF99);       /* set int polarities */
        } else {
                mtdcr(uicpr, 0xFFFFFF81);       /* set int polarities */
        }
+#else
+       mtdcr(uicpr, 0xFFFFFF81);       /* set int polarities */
+#endif
        mtdcr(uictr, 0x10000000);       /* set int trigger levels */
        mtdcr(uicvcr, 0x00000001);      /* set vect base=0,INT0 highest priority*/
        mtdcr(uicsr, 0xFFFFFFFF);       /* clear all ints */
@@ -227,10 +233,10 @@ int cpci405_version(void)
         */
        cntrl0Reg = mfdcr(cntrl0);
        mtdcr(cntrl0, cntrl0Reg | 0x03000000);
-       out32(GPIO0_ODR, in32(GPIO0_ODR) & ~0x00180000);
-       out32(GPIO0_TCR, in32(GPIO0_TCR) & ~0x00180000);
+       out_be32((void*)GPIO0_ODR, in_be32((void*)GPIO0_ODR) & ~0x00180000);
+       out_be32((void*)GPIO0_TCR, in_be32((void*)GPIO0_TCR) & ~0x00180000);
        udelay(1000);                   /* wait some time before reading input */
-       value = in32(GPIO0_IR) & 0x00180000;       /* get config bits */
+       value = in_be32((void*)GPIO0_IR) & 0x00180000;       /* get config bits */
 
        /*
         * Restore GPIO settings
@@ -245,7 +251,7 @@ int cpci405_version(void)
                /* CS2==0 && CS3==1 -> version 2 */
                return 2;
        case 0x00100000:
-               /* CS2==1 && CS3==0 -> version 3 */
+               /* CS2==1 && CS3==0 -> version 3 or 6U board */
                return 3;
        case 0x00000000:
                /* CS2==0 && CS3==0 -> version 4 */
@@ -283,7 +289,6 @@ int misc_init_r (void)
         * On CPCI-405 version 2 the environment is saved in eeprom!
         * FPGA can be gzip compressed (malloc) and booted this late.
         */
-
        if (cpci405_version() >= 2) {
                /*
                 * Setup GPIO pins (CS6+CS7 as GPIO)
@@ -354,6 +359,7 @@ int misc_init_r (void)
                SET_FPGA(FPGA_PRG | FPGA_CLK | FPGA_DATA);
                udelay(1000); /* wait 1ms */
 
+#ifdef CONFIG_CPCI405_6U
                if (cpci405_version() == 3) {
                        volatile unsigned short *fpga_mode = (unsigned short *)CFG_FPGA_BASE_ADDR;
                        volatile unsigned char *leds = (unsigned char *)CFG_LED_ADDR;
@@ -375,6 +381,7 @@ int misc_init_r (void)
                        udelay(100);
                        *fpga_mode &= ~(CFG_FPGA_MODE_DUART_RESET);
                }
+#endif
        }
        else {
                puts("\n*** U-Boot Version does not match Board Version!\n");
@@ -493,12 +500,6 @@ int checkboard (void)
 #endif
 
        putc ('\n');
-
-       /*
-        * Disable sleep mode in LXT971
-        */
-       lxt971_no_sleep();
-
        return 0;
 }
 
@@ -511,24 +512,22 @@ long int initdram (int board_type)
        mtdcr(memcfga, mem_mb0cf);
        val = mfdcr(memcfgd);
 
-#if 0
-       printf("\nmb0cf=%x\n", val); /* test-only */
-       printf("strap=%x\n", mfdcr(strap)); /* test-only */
-#endif
-
        return (4*1024*1024 << ((val & 0x000e0000) >> 17));
 }
 
-/* ------------------------------------------------------------------------- */
 
-int testdram (void)
+void reset_phy(void)
 {
-       /* TODO: XXX XXX XXX */
-       printf ("test: 16 MB - ok\n");
+#ifdef CONFIG_LXT971_NO_SLEEP
 
-       return (0);
+       /*
+        * Disable sleep mode in LXT971
+        */
+       lxt971_no_sleep();
+#endif
 }
 
+
 /* ------------------------------------------------------------------------- */
 
 #ifdef CONFIG_CPCI405_VER2
@@ -552,6 +551,41 @@ void ide_set_reset(int on)
 #endif /* CONFIG_CPCI405_VER2 */
 
 
+#if defined(CONFIG_PCI)
+void cpci405_pci_fixup_irq(struct pci_controller *hose, pci_dev_t dev)
+{
+       unsigned char int_line = 0xff;
+
+       /*
+        * Write pci interrupt line register (cpci405 specific)
+        */
+       switch (PCI_DEV(dev) & 0x03) {
+       case 0:
+               int_line = 27 + 2;
+               break;
+       case 1:
+               int_line = 27 + 3;
+               break;
+       case 2:
+               int_line = 27 + 0;
+               break;
+       case 3:
+               int_line = 27 + 1;
+               break;
+       }
+
+       pci_hose_write_config_byte(hose, dev, PCI_INTERRUPT_LINE, int_line);
+}
+
+int pci_pre_init(struct pci_controller *hose)
+{
+       hose->fixup_irq = cpci405_pci_fixup_irq;
+       return 1;
+}
+#endif /* defined(CONFIG_PCI) */
+
+
+
 #ifdef CONFIG_CPCI405AB
 
 #define ONE_WIRE_CLEAR   (*(volatile unsigned short *)(CFG_FPGA_BASE_ADDR + CFG_FPGA_MODE) \
index 5a30198..18a95d7 100644 (file)
@@ -1,7 +1,6 @@
 #
-# (C) Copyright 2002
-# Sysgo Real-Time Solutions, GmbH <www.elinos.com>
-# Marius Groeger <mgroeger@sysgo.de>
+# (C) Copyright 2007
+# Wolfgang Denk, DENX Software Engineering, wd@denx.de.
 #
 # See file CREDITS for list of people who contributed to this
 # project.
 
 include $(TOPDIR)/config.mk
 
-LIB    = lib$(BOARD).a
+LIB    = $(obj)lib$(BOARD).a
 
-OBJS   := lpc2292sodimm.o flash.o mmc.o spi.o mmc_hw.o eth.o
-SOBJS  := lowlevel_init.o iap_entry.o
+COBJS  := flash.o lpc2292sodimm.o
+SOBJTS := lowlevel_init.o
 
-$(LIB):        $(OBJS) $(SOBJS)
-       $(AR) crv $@ $(OBJS) $(SOBJS)
+SRCS   := $(SOBJTS:.o=.S) $(COBJS:.o=.c)
+OBJS   := $(addprefix $(obj),$(COBJS))
+SOBJS  := $(addprefix $(obj),$(SOBJTS))
 
-# this MUST be compiled as thumb code!
-iap_entry.o:
-       arm-linux-gcc  -D__ASSEMBLY__ -g  -Os   -fno-strict-aliasing  \
-       -fno-common -ffixed-r8 -msoft-float  -D__KERNEL__ \
-       -DTEXT_BASE=0x81500000  -I/home/garyj/proj/LPC/u-boot/include \
-       -fno-builtin -ffreestanding -nostdinc -isystem \
-       /opt/eldk/arm/usr/bin/../lib/gcc/arm-linux/4.0.0/include -pipe  \
-       -DCONFIG_ARM -D__ARM__ -march=armv4t -mtune=arm7tdmi -mabi=apcs-gnu \
-       -c -o iap_entry.o iap_entry.S
+$(LIB):        $(obj).depend $(OBJS) $(SOBJS)
+       $(AR) crv $@ $(OBJS) $(SOBJS)
 
 clean:
        rm -f $(SOBJS) $(OBJS)
 
 distclean:     clean
-       rm -f $(LIB) core *.bak .depend
+       rm -f $(LIB) core *.bak $(obj).depend
 
 #########################################################################
 
-.depend:       Makefile $(SOBJS:.o=.S) $(OBJS:.o=.c)
-               $(CC) -M $(CPPFLAGS) $(SOBJS:.o=.S) $(OBJS:.o=.c) > $@
+# defines $(obj).depend target
+include $(SRCTREE)/rules.mk
 
--include .depend
+sinclude $(obj).depend
 
 #########################################################################
index 55aaabf..0fb0843 100644 (file)
@@ -1,6 +1,9 @@
 /*
  * (C) Copyright 2006 Embedded Artists AB <www.embeddedartists.com>
  *
+ * Modified to use the routines in cpu/arm720t/lpc2292/flash.c by
+ * Gary Jennejohn <garyj@denx,de>
+ *
  * 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
 #include <common.h>
 #include <asm/arch/hardware.h>
 
-/* IAP commands use 32 bytes at the top of CPU internal sram, we
-   use 512 bytes below that */
-#define COPY_BUFFER_LOCATION 0x40003de0
-
-#define IAP_LOCATION 0x7ffffff1
-#define IAP_CMD_PREPARE 50
-#define IAP_CMD_COPY 51
-#define IAP_CMD_ERASE 52
-#define IAP_CMD_CHECK 53
-#define IAP_CMD_ID 54
-#define IAP_CMD_VERSION 55
-#define IAP_CMD_COMPARE 56
-
-#define IAP_RET_CMD_SUCCESS 0
-
 #define SST_BASEADDR 0x80000000
 #define SST_ADDR1 ((volatile ushort*)(SST_BASEADDR + (0x5555 << 1)))
 #define SST_ADDR2 ((volatile ushort*)(SST_BASEADDR + (0x2AAA << 1)))
 
 
-static unsigned long command[5];
-static unsigned long result[2];
-
 flash_info_t flash_info[CFG_MAX_FLASH_BANKS];
 
-extern void iap_entry(unsigned long * command, unsigned long * result);
-
-/*-----------------------------------------------------------------------
- *
- */
-int get_flash_sector(flash_info_t * info, ulong flash_addr)
-{
-       int i;
-
-       for(i=1; i < (info->sector_count); i++) {
-               if (flash_addr < (info->start[i]))
-                       break;
-       }
-
-       return (i-1);
-}
-
-/*-----------------------------------------------------------------------
- * This function assumes that flash_addr is aligned on 512 bytes boundary
- * in flash. This function also assumes that prepare have been called
- * for the sector in question.
- */
-int copy_buffer_to_flash(flash_info_t * info, ulong flash_addr)
-{
-       int first_sector;
-       int last_sector;
-
-       first_sector = get_flash_sector(info, flash_addr);
-       last_sector = get_flash_sector(info, flash_addr + 512 - 1);
-
-       /* prepare sectors for write */
-       command[0] = IAP_CMD_PREPARE;
-       command[1] = first_sector;
-       command[2] = last_sector;
-       iap_entry(command, result);
-       if (result[0] != IAP_RET_CMD_SUCCESS) {
-               printf("IAP prepare failed\n");
-               return ERR_PROG_ERROR;
-       }
-
-       command[0] = IAP_CMD_COPY;
-       command[1] = flash_addr;
-       command[2] = COPY_BUFFER_LOCATION;
-       command[3] = 512;
-       command[4] = CFG_SYS_CLK_FREQ >> 10;
-       iap_entry(command, result);
-       if (result[0] != IAP_RET_CMD_SUCCESS) {
-               printf("IAP copy failed\n");
-               return 1;
-       }
-
-       return 0;
-}
+extern int lpc2292_copy_buffer_to_flash(flash_info_t *, ulong);
+extern int lpc2292_flash_erase(flash_info_t *, int, int);
+extern int lpc2292_write_buff (flash_info_t *, uchar *, ulong, ulong);
 
 /*-----------------------------------------------------------------------
  *
@@ -220,56 +155,6 @@ void flash_print_info (flash_info_t * info)
        printf ("\n");
 }
 
-/*-----------------------------------------------------------------------
- */
-
-int flash_erase_philips (flash_info_t * info, int s_first, int s_last)
-{
-       int flag;
-       int prot;
-       int sect;
-
-       prot = 0;
-       for (sect = s_first; sect <= s_last; ++sect) {
-               if (info->protect[sect]) {
-                       prot++;
-               }
-       }
-       if (prot)
-               return ERR_PROTECTED;
-
-
-       flag = disable_interrupts();
-
-       printf ("Erasing %d sectors starting at sector %2d.\n"
-       "This make take some time ... ",
-       s_last - s_first + 1, s_first);
-
-       command[0] = IAP_CMD_PREPARE;
-       command[1] = s_first;
-       command[2] = s_last;
-       iap_entry(command, result);
-       if (result[0] != IAP_RET_CMD_SUCCESS) {
-               printf("IAP prepare failed\n");
-               return ERR_PROTECTED;
-       }
-
-       command[0] = IAP_CMD_ERASE;
-       command[1] = s_first;
-       command[2] = s_last;
-       command[3] = CFG_SYS_CLK_FREQ >> 10;
-       iap_entry(command, result);
-       if (result[0] != IAP_RET_CMD_SUCCESS) {
-               printf("IAP erase failed\n");
-               return ERR_PROTECTED;
-       }
-
-       if (flag)
-               enable_interrupts();
-
-       return ERR_OK;
-}
-
 int flash_erase_sst (flash_info_t * info, int s_first, int s_last)
 {
        int i;
@@ -294,7 +179,7 @@ int flash_erase (flash_info_t * info, int s_first, int s_last)
                case (SST_MANUFACT & FLASH_VENDMASK):
                        return flash_erase_sst(info, s_first, s_last);
                case (PHILIPS_LPC2292 & FLASH_VENDMASK):
-                       return flash_erase_philips(info, s_first, s_last);
+                       return lpc2292_flash_erase(info, s_first, s_last);
                default:
                        return ERR_PROTECTED;
        }
@@ -353,122 +238,13 @@ int write_buff_sst (flash_info_t * info, uchar * src, ulong addr, ulong cnt)
        return ret;
 }
 
-int write_buff_philips (flash_info_t * info,
-                       uchar * src,
-                       ulong addr,
-                       ulong cnt)
-{
-       int first_copy_size;
-       int last_copy_size;
-       int first_block;
-       int last_block;
-       int nbr_mid_blocks;
-       uchar memmap_value;
-       ulong i;
-       uchar* src_org;
-       uchar* dst_org;
-       int ret = ERR_OK;
-
-       src_org = src;
-       dst_org = (uchar*)addr;
-
-       first_block = addr / 512;
-       last_block = (addr + cnt) / 512;
-       nbr_mid_blocks = last_block - first_block - 1;
-
-       first_copy_size = 512 - (addr % 512);
-       last_copy_size = (addr + cnt) % 512;
-
-#if 0
-       printf("\ncopy first block: (1) %lX -> %lX 0x200 bytes, "
-               "(2) %lX -> %lX 0x%X bytes, (3) %lX -> %lX 0x200 bytes\n",
-       (ulong)(first_block * 512),
-       (ulong)COPY_BUFFER_LOCATION,
-       (ulong)src,
-       (ulong)(COPY_BUFFER_LOCATION + 512 - first_copy_size),
-       first_copy_size,
-       (ulong)COPY_BUFFER_LOCATION,
-       (ulong)(first_block * 512));
-#endif
-
-       /* copy first block */
-       memcpy((void*)COPY_BUFFER_LOCATION,
-               (void*)(first_block * 512), 512);
-       memcpy((void*)(COPY_BUFFER_LOCATION + 512 - first_copy_size),
-               src, first_copy_size);
-       copy_buffer_to_flash(info, first_block * 512);
-       src += first_copy_size;
-       addr += first_copy_size;
-
-       /* copy middle blocks */
-       for (i = 0; i < nbr_mid_blocks; i++) {
-#if 0
-               printf("copy middle block: %lX -> %lX 512 bytes, "
-               "%lX -> %lX 512 bytes\n",
-               (ulong)src,
-               (ulong)COPY_BUFFER_LOCATION,
-               (ulong)COPY_BUFFER_LOCATION,
-               (ulong)addr);
-#endif
-               memcpy((void*)COPY_BUFFER_LOCATION, src, 512);
-               copy_buffer_to_flash(info, addr);
-               src += 512;
-               addr += 512;
-       }
-
-
-       if (last_copy_size > 0) {
-#if 0
-               printf("copy last block: (1) %lX -> %lX 0x200 bytes, "
-               "(2) %lX -> %lX 0x%X bytes, (3) %lX -> %lX x200 bytes\n",
-               (ulong)(last_block * 512),
-               (ulong)COPY_BUFFER_LOCATION,
-               (ulong)src,
-               (ulong)(COPY_BUFFER_LOCATION),
-               last_copy_size,
-               (ulong)COPY_BUFFER_LOCATION,
-               (ulong)addr);
-#endif
-               /* copy last block */
-               memcpy((void*)COPY_BUFFER_LOCATION,
-                       (void*)(last_block * 512), 512);
-               memcpy((void*)COPY_BUFFER_LOCATION,
-                       src, last_copy_size);
-               copy_buffer_to_flash(info, addr);
-       }
-
-       /* verify write */
-       memmap_value = GET8(MEMMAP);
-
-       disable_interrupts();
-
-       PUT8(MEMMAP, 01);               /* we must make sure that initial 64
-                                                          bytes are taken from flash when we
-                                                          do the compare */
-
-       for (i = 0; i < cnt; i++) {
-               if (*dst_org != *src_org){
-                       printf("Write failed. Byte %lX differs\n", i);
-                       ret = ERR_PROG_ERROR;
-                       break;
-               }
-               dst_org++;
-               src_org++;
-       }
-
-       PUT8(MEMMAP, memmap_value);
-       enable_interrupts();
-
-       return ret;
-}
-
 int write_buff (flash_info_t * info, uchar * src, ulong addr, ulong cnt)
 {
        switch (info->flash_id & FLASH_VENDMASK) {
                case (SST_MANUFACT & FLASH_VENDMASK):
                        return write_buff_sst(info, src, addr, cnt);
                case (PHILIPS_LPC2292 & FLASH_VENDMASK):
-                       return write_buff_philips(info, src, addr, cnt);
+                       return lpc2292_write_buff(info, src, addr, cnt);
                default:
                        return ERR_PROG_ERROR;
        }
diff --git a/board/lwmon5/Makefile b/board/lwmon5/Makefile
new file mode 100644 (file)
index 0000000..06ef7f9
--- /dev/null
@@ -0,0 +1,51 @@
+#
+# (C) Copyright 2002-2006
+# 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    = $(obj)lib$(BOARD).a
+
+COBJS  = $(BOARD).o sdram.o
+SOBJS  = init.o
+
+SRCS   := $(SOBJS:.o=.S) $(COBJS:.o=.c)
+OBJS   := $(addprefix $(obj),$(COBJS))
+SOBJS  := $(addprefix $(obj),$(SOBJS))
+
+$(LIB):        $(OBJS) $(SOBJS)
+       $(AR) $(ARFLAGS) $@ $(OBJS) $(SOBJS)
+
+clean:
+       rm -f $(SOBJS) $(OBJS)
+
+distclean:     clean
+       rm -f $(LIB) core *.bak .depend
+
+#########################################################################
+
+# defines $(obj).depend target
+include $(SRCTREE)/rules.mk
+
+sinclude $(obj).depend
+
+#########################################################################
diff --git a/board/lwmon5/config.mk b/board/lwmon5/config.mk
new file mode 100644 (file)
index 0000000..bf2b879
--- /dev/null
@@ -0,0 +1,39 @@
+#
+# (C) Copyright 2002
+# Wolfgang Denk, DENX Software Engineering, wd@denx.de.
+#
+# See file CREDITS for list of people who contributed to this
+# project.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 2 of
+# the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+# MA 02111-1307 USA
+#
+#
+# lwmon5 (440EPx)
+#
+
+ifndef TEXT_BASE
+TEXT_BASE = 0xFFF80000
+endif
+
+PLATFORM_CPPFLAGS += -DCONFIG_440=1
+
+ifeq ($(debug),1)
+PLATFORM_CPPFLAGS += -DDEBUG
+endif
+
+ifeq ($(dbcr),1)
+PLATFORM_CPPFLAGS += -DCFG_INIT_DBCR=0x8cff0000
+endif
diff --git a/board/lwmon5/init.S b/board/lwmon5/init.S
new file mode 100644 (file)
index 0000000..6798e80
--- /dev/null
@@ -0,0 +1,90 @@
+/*
+ * (C) Copyright 2007
+ * Stefan Roese, DENX Software Engineering, sr@denx.de.
+ *
+ *  Copyright (C) 2002 Scott McNutt <smcnutt@artesyncp.com>
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.         See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+#include <ppc_asm.tmpl>
+#include <config.h>
+#include <asm-ppc/mmu.h>
+
+/**************************************************************************
+ * TLB TABLE
+ *
+ * This table is used by the cpu boot code to setup the initial tlb
+ * entries. Rather than make broad assumptions in the cpu source tree,
+ * this table lets each board set things up however they like.
+ *
+ *  Pointer to the table is returned in r1
+ *
+ *************************************************************************/
+       .section .bootpg,"ax"
+       .globl tlbtab
+
+tlbtab:
+       tlbtab_start
+
+       /*
+        * BOOT_CS (FLASH) must be first. Before relocation SA_I can be off to use the
+        * speed up boot process. It is patched after relocation to enable SA_I
+        */
+       tlbentry(CFG_BOOT_BASE_ADDR, SZ_256M, CFG_BOOT_BASE_ADDR, 1, AC_R|AC_W|AC_X|SA_G)
+
+       /*
+        * TLB entries for SDRAM are not needed on this platform.
+        * They are dynamically generated in the SPD DDR(2) detection
+        * routine.
+        */
+
+#ifdef CFG_INIT_RAM_DCACHE
+       /* TLB-entry for init-ram in dcache (SA_I must be turned off!) */
+       tlbentry(CFG_INIT_RAM_ADDR, SZ_64K, CFG_INIT_RAM_ADDR, 0, AC_R|AC_W|AC_X|SA_G)
+#endif
+
+       /* TLB-entry for PCI Memory */
+       tlbentry(CFG_PCI_MEMBASE, SZ_256M, CFG_PCI_MEMBASE, 1, AC_R|AC_W|SA_G|SA_I)
+       tlbentry(CFG_PCI_MEMBASE1, SZ_256M, CFG_PCI_MEMBASE1, 1, AC_R|AC_W|SA_G|SA_I)
+       tlbentry(CFG_PCI_MEMBASE2, SZ_256M, CFG_PCI_MEMBASE2, 1, AC_R|AC_W|SA_G|SA_I)
+       tlbentry(CFG_PCI_MEMBASE3, SZ_256M, CFG_PCI_MEMBASE3, 1, AC_R|AC_W|SA_G|SA_I)
+
+       /* TLB-entry for the FPGA Chip select 2 */
+       tlbentry(CFG_FPGA_BASE_0, SZ_1M, CFG_FPGA_BASE_0, 1, AC_R|AC_W|AC_X|SA_I|SA_G)
+
+       /* TLB-entry for the FPGA Chip select 3 */
+       tlbentry(CFG_FPGA_BASE_1, SZ_1M, CFG_FPGA_BASE_1, 1,AC_R|AC_W|AC_X|SA_I|SA_G)
+
+       /* TLB-entry for the LIME Controller */
+       tlbentry(CFG_LIME_BASE_0, SZ_16M, CFG_LIME_BASE_0, 1, AC_R|AC_W|AC_X|SA_I|SA_G)
+       tlbentry(CFG_LIME_BASE_1, SZ_16M, CFG_LIME_BASE_1, 1, AC_R|AC_W|AC_X|SA_I|SA_G)
+       tlbentry(CFG_LIME_BASE_2, SZ_16M, CFG_LIME_BASE_2, 1, AC_R|AC_W|AC_X|SA_I|SA_G)
+       tlbentry(CFG_LIME_BASE_3, SZ_16M, CFG_LIME_BASE_3, 1, AC_R|AC_W|AC_X|SA_I|SA_G)
+
+       /* TLB-entry for Internal Registers & OCM */
+       tlbentry(0xe0000000, SZ_16M, 0xe0000000, 0,  AC_R|AC_W|AC_X|SA_I)
+
+       /*TLB-entry PCI registers*/
+       tlbentry(0xEEC00000, SZ_1K, 0xEEC00000, 1,  AC_R|AC_W|AC_X|SA_G|SA_I)
+
+       /* TLB-entry for peripherals */
+       tlbentry(0xEF000000, SZ_16M, 0xEF000000, 1, AC_R|AC_W|AC_X|SA_G|SA_I)
+
+       tlbtab_end
diff --git a/board/lwmon5/lwmon5.c b/board/lwmon5/lwmon5.c
new file mode 100644 (file)
index 0000000..d5b8f8c
--- /dev/null
@@ -0,0 +1,464 @@
+/*
+ * (C) Copyright 2007
+ * Stefan Roese, DENX Software Engineering, sr@denx.de.
+ *
+ * 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 <ppc440.h>
+#include <asm/gpio.h>
+
+DECLARE_GLOBAL_DATA_PTR;
+
+extern flash_info_t flash_info[CFG_MAX_FLASH_BANKS]; /* info for FLASH chips   */
+
+ulong flash_get_size (ulong base, int banknum);
+
+int board_early_init_f(void)
+{
+       u32 sdr0_pfc1, sdr0_pfc2;
+       u32 reg;
+
+       /* PLB Write pipelining disabled. Denali Core workaround */
+       mtdcr(plb0_acr, 0xDE000000);
+       mtdcr(plb1_acr, 0xDE000000);
+
+       /*--------------------------------------------------------------------
+        * Setup the interrupt controller polarities, triggers, etc.
+        *-------------------------------------------------------------------*/
+       mtdcr(uic0sr, 0xffffffff);  /* clear all. if write with 1 then the status is cleared  */
+       mtdcr(uic0er, 0x00000000);  /* disable all */
+       mtdcr(uic0cr, 0x00000000);  /* we have not critical interrupts at the moment */
+       mtdcr(uic0pr, 0xfffff7ff);  /* Adjustment of the polarity */
+       mtdcr(uic0tr, 0x00000810);  /* per ref-board manual */
+       mtdcr(uic0vr, 0x00000000);  /* int31 highest, base=0x000 is within DDRAM */
+       mtdcr(uic0sr, 0xffffffff);  /* clear all */
+
+       mtdcr(uic1sr, 0xffffffff);  /* clear all */
+       mtdcr(uic1er, 0x00000000);  /* disable all */
+       mtdcr(uic1cr, 0x00000000);  /* all non-critical */
+       mtdcr(uic1pr, 0xFFFFC7AD);  /* Adjustment of the polarity */
+       mtdcr(uic1tr, 0x0600384A);  /* per ref-board manual */
+       mtdcr(uic1vr, 0x00000000);  /* int31 highest, base=0x000 is within DDRAM */
+       mtdcr(uic1sr, 0xffffffff);  /* clear all */
+
+       mtdcr(uic2sr, 0xffffffff);  /* clear all */
+       mtdcr(uic2er, 0x00000000);  /* disable all */
+       mtdcr(uic2cr, 0x00000000);  /* all non-critical */
+       mtdcr(uic2pr, 0x27C00000);  /* Adjustment of the polarity */
+       mtdcr(uic2tr, 0xDFC00000);  /* per ref-board manual */
+       mtdcr(uic2vr, 0x00000000);  /* int31 highest, base=0x000 is within DDRAM */
+       mtdcr(uic2sr, 0xffffffff);  /* clear all. Why this??? */
+
+       /* Trace Pins are disabled. SDR0_PFC0 Register */
+       mtsdr(SDR0_PFC0, 0x0);
+
+       /* select Ethernet pins */
+       mfsdr(SDR0_PFC1, sdr0_pfc1);
+       /* SMII via ZMII */
+       sdr0_pfc1 = (sdr0_pfc1 & ~SDR0_PFC1_SELECT_MASK) |
+               SDR0_PFC1_SELECT_CONFIG_6;
+       mfsdr(SDR0_PFC2, sdr0_pfc2);
+       sdr0_pfc2 = (sdr0_pfc2 & ~SDR0_PFC2_SELECT_MASK) |
+               SDR0_PFC2_SELECT_CONFIG_6;
+
+       /* enable SPI (SCP) */
+       sdr0_pfc1 = (sdr0_pfc1 & ~SDR0_PFC1_SIS_MASK) | SDR0_PFC1_SIS_SCP_SEL;
+
+       mtsdr(SDR0_PFC2, sdr0_pfc2);
+       mtsdr(SDR0_PFC1, sdr0_pfc1);
+
+       mtsdr(SDR0_PFC4, 0x80000000);
+
+       /* PCI arbiter disabled */
+       /* PCI Host Configuration disbaled */
+       mfsdr(sdr_pci0, reg);
+       reg = 0;
+       mtsdr(sdr_pci0, 0x00000000 | reg);
+
+       gpio_write_bit(CFG_GPIO_FLASH_WP, 1);
+
+       return 0;
+}
+
+/*---------------------------------------------------------------------------+
+  | misc_init_r.
+  +---------------------------------------------------------------------------*/
+int misc_init_r(void)
+{
+       u32 pbcr;
+       int size_val = 0;
+       u32 reg;
+       unsigned long usb2d0cr = 0;
+       unsigned long usb2phy0cr, usb2h0cr = 0;
+       unsigned long sdr0_pfc1;
+
+       /*
+        * FLASH stuff...
+        */
+
+       /* Re-do sizing to get full correct info */
+
+       /* adjust flash start and offset */
+       gd->bd->bi_flashstart = 0 - gd->bd->bi_flashsize;
+       gd->bd->bi_flashoffset = 0;
+
+       mfebc(pb0cr, pbcr);
+       switch (gd->bd->bi_flashsize) {
+       case 1 << 20:
+               size_val = 0;
+               break;
+       case 2 << 20:
+               size_val = 1;
+               break;
+       case 4 << 20:
+               size_val = 2;
+               break;
+       case 8 << 20:
+               size_val = 3;
+               break;
+       case 16 << 20:
+               size_val = 4;
+               break;
+       case 32 << 20:
+               size_val = 5;
+               break;
+       case 64 << 20:
+               size_val = 6;
+               break;
+       case 128 << 20:
+               size_val = 7;
+               break;
+       }
+       pbcr = (pbcr & 0x0001ffff) | gd->bd->bi_flashstart | (size_val << 17);
+       mtebc(pb0cr, pbcr);
+
+       /*
+        * Re-check to get correct base address
+        */
+       flash_get_size(gd->bd->bi_flashstart, 0);
+
+       /* Monitor protection ON by default */
+       (void)flash_protect(FLAG_PROTECT_SET,
+                           -CFG_MONITOR_LEN,
+                           0xffffffff,
+                           &flash_info[0]);
+
+       /* Env protection ON by default */
+       (void)flash_protect(FLAG_PROTECT_SET,
+                           CFG_ENV_ADDR_REDUND,
+                           CFG_ENV_ADDR_REDUND + 2*CFG_ENV_SECT_SIZE - 1,
+                           &flash_info[0]);
+
+       /*
+        * USB suff...
+        */
+       /* SDR Setting */
+       mfsdr(SDR0_PFC1, sdr0_pfc1);
+       mfsdr(SDR0_USB0, usb2d0cr);
+       mfsdr(SDR0_USB2PHY0CR, usb2phy0cr);
+       mfsdr(SDR0_USB2H0CR, usb2h0cr);
+
+       usb2phy0cr = usb2phy0cr &~SDR0_USB2PHY0CR_XOCLK_MASK;
+       usb2phy0cr = usb2phy0cr | SDR0_USB2PHY0CR_XOCLK_EXTERNAL;       /*0*/
+       usb2phy0cr = usb2phy0cr &~SDR0_USB2PHY0CR_WDINT_MASK;
+       usb2phy0cr = usb2phy0cr | SDR0_USB2PHY0CR_WDINT_16BIT_30MHZ;    /*1*/
+       usb2phy0cr = usb2phy0cr &~SDR0_USB2PHY0CR_DVBUS_MASK;
+       usb2phy0cr = usb2phy0cr | SDR0_USB2PHY0CR_DVBUS_PURDIS;         /*0*/
+       usb2phy0cr = usb2phy0cr &~SDR0_USB2PHY0CR_DWNSTR_MASK;
+       usb2phy0cr = usb2phy0cr | SDR0_USB2PHY0CR_DWNSTR_HOST;          /*1*/
+       usb2phy0cr = usb2phy0cr &~SDR0_USB2PHY0CR_UTMICN_MASK;
+       usb2phy0cr = usb2phy0cr | SDR0_USB2PHY0CR_UTMICN_HOST;          /*1*/
+
+       /* An 8-bit/60MHz interface is the only possible alternative
+          when connecting the Device to the PHY */
+       usb2h0cr   = usb2h0cr &~SDR0_USB2H0CR_WDINT_MASK;
+       usb2h0cr   = usb2h0cr | SDR0_USB2H0CR_WDINT_16BIT_30MHZ;        /*1*/
+
+       mtsdr(SDR0_PFC1, sdr0_pfc1);
+       mtsdr(SDR0_USB0, usb2d0cr);
+       mtsdr(SDR0_USB2PHY0CR, usb2phy0cr);
+       mtsdr(SDR0_USB2H0CR, usb2h0cr);
+
+       /*
+        * Clear resets
+        */
+       udelay (1000);
+       mtsdr(SDR0_SRST1, 0x00000000);
+       udelay (1000);
+       mtsdr(SDR0_SRST0, 0x00000000);
+
+       printf("USB:   Host(int phy) Device(ext phy)\n");
+
+       /*
+        * Clear PLB4A0_ACR[WRP]
+        * This fix will make the MAL burst disabling patch for the Linux
+        * EMAC driver obsolete.
+        */
+       reg = mfdcr(plb4_acr) & ~PLB4_ACR_WRP;
+       mtdcr(plb4_acr, reg);
+
+       /*
+        * Reset Lime controller
+        */
+       gpio_write_bit(CFG_GPIO_LIME_S, 1);
+       udelay(500);
+       gpio_write_bit(CFG_GPIO_LIME_RST, 1);
+
+       /*
+        * Reset PHY's
+        */
+       gpio_write_bit(CFG_GPIO_PHY0_RST, 0);
+       gpio_write_bit(CFG_GPIO_PHY1_RST, 0);
+       udelay(100);
+       gpio_write_bit(CFG_GPIO_PHY0_RST, 1);
+       gpio_write_bit(CFG_GPIO_PHY1_RST, 1);
+
+       /*
+        * Reset USB hub
+        */
+       gpio_write_bit(CFG_GPIO_HUB_RST, 0);
+       udelay(100);
+       gpio_write_bit(CFG_GPIO_HUB_RST, 1);
+
+       return 0;
+}
+
+int checkboard(void)
+{
+       char *s = getenv("serial#");
+
+       printf("Board: lwmon5");
+
+       if (s != NULL) {
+               puts(", serial# ");
+               puts(s);
+       }
+       putc('\n');
+
+       return (0);
+}
+
+#if defined(CFG_DRAM_TEST)
+int testdram(void)
+{
+       unsigned long *mem = (unsigned long *)0;
+       const unsigned long kend = (1024 / sizeof(unsigned long));
+       unsigned long k, n;
+
+       mtmsr(0);
+
+       for (k = 0; k < CFG_MBYTES_SDRAM;
+            ++k, mem += (1024 / sizeof(unsigned long))) {
+               if ((k & 1023) == 0) {
+                       printf("%3d MB\r", k / 1024);
+               }
+
+               memset(mem, 0xaaaaaaaa, 1024);
+               for (n = 0; n < kend; ++n) {
+                       if (mem[n] != 0xaaaaaaaa) {
+                               printf("SDRAM test fails at: %08x\n",
+                                      (uint) & mem[n]);
+                               return 1;
+                       }
+               }
+
+               memset(mem, 0x55555555, 1024);
+               for (n = 0; n < kend; ++n) {
+                       if (mem[n] != 0x55555555) {
+                               printf("SDRAM test fails at: %08x\n",
+                                      (uint) & mem[n]);
+                               return 1;
+                       }
+               }
+       }
+       printf("SDRAM test passes\n");
+       return 0;
+}
+#endif
+
+/*************************************************************************
+ *  pci_pre_init
+ *
+ *  This routine is called just prior to registering the hose and gives
+ *  the board the opportunity to check things. Returning a value of zero
+ *  indicates that things are bad & PCI initialization should be aborted.
+ *
+ *     Different boards may wish to customize the pci controller structure
+ *     (add regions, override default access routines, etc) or perform
+ *     certain pre-initialization actions.
+ *
+ ************************************************************************/
+#if defined(CONFIG_PCI)
+int pci_pre_init(struct pci_controller *hose)
+{
+       unsigned long addr;
+
+       /*-------------------------------------------------------------------------+
+         | Set priority for all PLB3 devices to 0.
+         | Set PLB3 arbiter to fair mode.
+         +-------------------------------------------------------------------------*/
+       mfsdr(sdr_amp1, addr);
+       mtsdr(sdr_amp1, (addr & 0x000000FF) | 0x0000FF00);
+       addr = mfdcr(plb3_acr);
+       mtdcr(plb3_acr, addr | 0x80000000);
+
+       /*-------------------------------------------------------------------------+
+         | Set priority for all PLB4 devices to 0.
+         +-------------------------------------------------------------------------*/
+       mfsdr(sdr_amp0, addr);
+       mtsdr(sdr_amp0, (addr & 0x000000FF) | 0x0000FF00);
+       addr = mfdcr(plb4_acr) | 0xa0000000;    /* Was 0x8---- */
+       mtdcr(plb4_acr, addr);
+
+       /*-------------------------------------------------------------------------+
+         | Set Nebula PLB4 arbiter to fair mode.
+         +-------------------------------------------------------------------------*/
+       /* Segment0 */
+       addr = (mfdcr(plb0_acr) & ~plb0_acr_ppm_mask) | plb0_acr_ppm_fair;
+       addr = (addr & ~plb0_acr_hbu_mask) | plb0_acr_hbu_enabled;
+       addr = (addr & ~plb0_acr_rdp_mask) | plb0_acr_rdp_4deep;
+       addr = (addr & ~plb0_acr_wrp_mask) | plb0_acr_wrp_2deep;
+       mtdcr(plb0_acr, addr);
+
+       /* Segment1 */
+       addr = (mfdcr(plb1_acr) & ~plb1_acr_ppm_mask) | plb1_acr_ppm_fair;
+       addr = (addr & ~plb1_acr_hbu_mask) | plb1_acr_hbu_enabled;
+       addr = (addr & ~plb1_acr_rdp_mask) | plb1_acr_rdp_4deep;
+       addr = (addr & ~plb1_acr_wrp_mask) | plb1_acr_wrp_2deep;
+       mtdcr(plb1_acr, addr);
+
+       return 1;
+}
+#endif /* defined(CONFIG_PCI) */
+
+/*************************************************************************
+ *  pci_target_init
+ *
+ *     The bootstrap configuration provides default settings for the pci
+ *     inbound map (PIM). But the bootstrap config choices are limited and
+ *     may not be sufficient for a given board.
+ *
+ ************************************************************************/
+#if defined(CONFIG_PCI) && defined(CFG_PCI_TARGET_INIT)
+void pci_target_init(struct pci_controller *hose)
+{
+       /*--------------------------------------------------------------------------+
+        * Set up Direct MMIO registers
+        *--------------------------------------------------------------------------*/
+       /*--------------------------------------------------------------------------+
+         | PowerPC440EPX PCI Master configuration.
+         | Map one 1Gig range of PLB/processor addresses to PCI memory space.
+         |   PLB address 0xA0000000-0xDFFFFFFF ==> PCI address 0xA0000000-0xDFFFFFFF
+         |   Use byte reversed out routines to handle endianess.
+         | Make this region non-prefetchable.
+         +--------------------------------------------------------------------------*/
+       out32r(PCIX0_PMM0MA, 0x00000000);       /* PMM0 Mask/Attribute - disabled b4 setting */
+       out32r(PCIX0_PMM0LA, CFG_PCI_MEMBASE);  /* PMM0 Local Address */
+       out32r(PCIX0_PMM0PCILA, CFG_PCI_MEMBASE);       /* PMM0 PCI Low Address */
+       out32r(PCIX0_PMM0PCIHA, 0x00000000);    /* PMM0 PCI High Address */
+       out32r(PCIX0_PMM0MA, 0xE0000001);       /* 512M + No prefetching, and enable region */
+
+       out32r(PCIX0_PMM1MA, 0x00000000);       /* PMM0 Mask/Attribute - disabled b4 setting */
+       out32r(PCIX0_PMM1LA, CFG_PCI_MEMBASE2); /* PMM0 Local Address */
+       out32r(PCIX0_PMM1PCILA, CFG_PCI_MEMBASE2);      /* PMM0 PCI Low Address */
+       out32r(PCIX0_PMM1PCIHA, 0x00000000);    /* PMM0 PCI High Address */
+       out32r(PCIX0_PMM1MA, 0xE0000001);       /* 512M + No prefetching, and enable region */
+
+       out32r(PCIX0_PTM1MS, 0x00000001);       /* Memory Size/Attribute */
+       out32r(PCIX0_PTM1LA, 0);        /* Local Addr. Reg */
+       out32r(PCIX0_PTM2MS, 0);        /* Memory Size/Attribute */
+       out32r(PCIX0_PTM2LA, 0);        /* Local Addr. Reg */
+
+       /*--------------------------------------------------------------------------+
+        * Set up Configuration registers
+        *--------------------------------------------------------------------------*/
+
+       /* Program the board's subsystem id/vendor id */
+       pci_write_config_word(0, PCI_SUBSYSTEM_VENDOR_ID,
+                             CFG_PCI_SUBSYS_VENDORID);
+       pci_write_config_word(0, PCI_SUBSYSTEM_ID, CFG_PCI_SUBSYS_ID);
+
+       /* Configure command register as bus master */
+       pci_write_config_word(0, PCI_COMMAND, PCI_COMMAND_MASTER);
+
+       /* 240nS PCI clock */
+       pci_write_config_word(0, PCI_LATENCY_TIMER, 1);
+
+       /* No error reporting */
+       pci_write_config_word(0, PCI_ERREN, 0);
+
+       pci_write_config_dword(0, PCI_BRDGOPT2, 0x00000101);
+
+}
+#endif                         /* defined(CONFIG_PCI) && defined(CFG_PCI_TARGET_INIT) */
+
+/*************************************************************************
+ *  pci_master_init
+ *
+ ************************************************************************/
+#if defined(CONFIG_PCI) && defined(CFG_PCI_MASTER_INIT)
+void pci_master_init(struct pci_controller *hose)
+{
+       unsigned short temp_short;
+
+       /*--------------------------------------------------------------------------+
+         | Write the PowerPC440 EP PCI Configuration regs.
+         |   Enable PowerPC440 EP to be a master on the PCI bus (PMM).
+         |   Enable PowerPC440 EP to act as a PCI memory target (PTM).
+         +--------------------------------------------------------------------------*/
+       pci_read_config_word(0, PCI_COMMAND, &temp_short);
+       pci_write_config_word(0, PCI_COMMAND,
+                             temp_short | PCI_COMMAND_MASTER |
+                             PCI_COMMAND_MEMORY);
+}
+#endif                         /* defined(CONFIG_PCI) && defined(CFG_PCI_MASTER_INIT) */
+
+/*************************************************************************
+ *  is_pci_host
+ *
+ *     This routine is called to determine if a pci scan should be
+ *     performed. With various hardware environments (especially cPCI and
+ *     PPMC) it's insufficient to depend on the state of the arbiter enable
+ *     bit in the strap register, or generic host/adapter assumptions.
+ *
+ *     Rather than hard-code a bad assumption in the general 440 code, the
+ *     440 pci code requires the board to decide at runtime.
+ *
+ *     Return 0 for adapter mode, non-zero for host (monarch) mode.
+ *
+ *
+ ************************************************************************/
+#if defined(CONFIG_PCI)
+int is_pci_host(struct pci_controller *hose)
+{
+       /* Cactus is always configured as host. */
+       return (1);
+}
+#endif                         /* defined(CONFIG_PCI) */
+
+void hw_watchdog_reset(void)
+{
+       int val;
+
+       /*
+        * Toggle watchdog output
+        */
+       val = gpio_read_out_bit(CFG_GPIO_WATCHDOG) == 0 ? 1 : 0;
+       gpio_write_bit(CFG_GPIO_WATCHDOG, val);
+}
diff --git a/board/lwmon5/sdram.c b/board/lwmon5/sdram.c
new file mode 100644 (file)
index 0000000..85811ad
--- /dev/null
@@ -0,0 +1,598 @@
+/*
+ * (C) Copyright 2006
+ * Sylvie Gohl,                    AMCC/IBM, gohl.sylvie@fr.ibm.com
+ * Jacqueline Pira-Ferriol, AMCC/IBM, jpira-ferriol@fr.ibm.com
+ * Thierry Roman,          AMCC/IBM, thierry_roman@fr.ibm.com
+ * Alain Saurel,           AMCC/IBM, alain.saurel@fr.ibm.com
+ * Robert Snyder,          AMCC/IBM, rob.snyder@fr.ibm.com
+ *
+ * (C) Copyright 2007
+ * Stefan Roese, DENX Software Engineering, sr@denx.de.
+ *
+ * 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 for debugging output (obviously ;-)) */
+#if 0
+#define DEBUG
+#endif
+
+#include <common.h>
+#include <asm/processor.h>
+#include <asm/mmu.h>
+#include <asm/io.h>
+#include <ppc440.h>
+
+#include "sdram.h"
+
+/*
+ * This DDR2 setup code can dynamically setup the TLB entries for the DDR2 memory
+ * region. Right now the cache should still be disabled in U-Boot because of the
+ * EMAC driver, that need it's buffer descriptor to be located in non cached
+ * memory.
+ *
+ * If at some time this restriction doesn't apply anymore, just define
+ * CFG_ENABLE_SDRAM_CACHE in the board config file and this code should setup
+ * everything correctly.
+ */
+#ifdef CFG_ENABLE_SDRAM_CACHE
+#define MY_TLB_WORD2_I_ENABLE  0                       /* enable caching on SDRAM */
+#else
+#define MY_TLB_WORD2_I_ENABLE  TLB_WORD2_I_ENABLE      /* disable caching on SDRAM */
+#endif
+
+void program_tlb(u32 phys_addr, u32 virt_addr, u32 size, u32 tlb_word2_i_value);
+void dcbz_area(u32 start_address, u32 num_bytes);
+void dflush(void);
+
+#ifdef CONFIG_ADD_RAM_INFO
+static u32 is_ecc_enabled(void)
+{
+       u32 val;
+
+       mfsdram(DDR0_22, val);
+       val &= DDR0_22_CTRL_RAW_MASK;
+       if (val)
+               return 1;
+       else
+               return 0;
+}
+
+void board_add_ram_info(int use_default)
+{
+       PPC440_SYS_INFO board_cfg;
+       u32 val;
+
+       if (is_ecc_enabled())
+               puts(" (ECC");
+       else
+               puts(" (ECC not");
+
+       get_sys_info(&board_cfg);
+       printf(" enabled, %d MHz", (board_cfg.freqPLB * 2) / 1000000);
+
+       mfsdram(DDR0_03, val);
+       val = DDR0_03_CASLAT_DECODE(val);
+       printf(", CL%d)", val);
+}
+#endif
+
+static int wait_for_dlllock(void)
+{
+       u32 val;
+       int wait = 0;
+
+       /*
+        * Wait for the DCC master delay line to finish calibration
+        */
+       mtdcr(ddrcfga, DDR0_17);
+       val = DDR0_17_DLLLOCKREG_UNLOCKED;
+
+       while (wait != 0xffff) {
+               val = mfdcr(ddrcfgd);
+               if ((val & DDR0_17_DLLLOCKREG_MASK) == DDR0_17_DLLLOCKREG_LOCKED)
+                       /* dlllockreg bit on */
+                       return 0;
+               else
+                       wait++;
+       }
+       debug("0x%04x: DDR0_17 Value (dlllockreg bit): 0x%08x\n", wait, val);
+       debug("Waiting for dlllockreg bit to raise\n");
+
+       return -1;
+}
+
+#if defined(CONFIG_DDR_DATA_EYE)
+int wait_for_dram_init_complete(void)
+{
+       u32 val;
+       int wait = 0;
+
+       /*
+        * Wait for 'DRAM initialization complete' bit in status register
+        */
+       mtdcr(ddrcfga, DDR0_00);
+
+       while (wait != 0xffff) {
+               val = mfdcr(ddrcfgd);
+               if ((val & DDR0_00_INT_STATUS_BIT6) == DDR0_00_INT_STATUS_BIT6)
+                       /* 'DRAM initialization complete' bit */
+                       return 0;
+               else
+                       wait++;
+       }
+
+       debug("DRAM initialization complete bit in status register did not rise\n");
+
+       return -1;
+}
+
+#define NUM_TRIES 64
+#define NUM_READS 10
+
+void denali_core_search_data_eye(u32 start_addr, u32 memory_size)
+{
+       int k, j;
+       u32 val;
+       u32 wr_dqs_shift, dqs_out_shift, dll_dqs_delay_X;
+       u32 max_passing_cases = 0, wr_dqs_shift_with_max_passing_cases = 0;
+       u32 passing_cases = 0, dll_dqs_delay_X_sw_val = 0;
+       u32 dll_dqs_delay_X_start_window = 0, dll_dqs_delay_X_end_window = 0;
+       volatile u32 *ram_pointer;
+       u32 test[NUM_TRIES] = {
+               0x00000000, 0x00000000, 0xFFFFFFFF, 0xFFFFFFFF,
+               0x00000000, 0x00000000, 0xFFFFFFFF, 0xFFFFFFFF,
+               0xFFFFFFFF, 0xFFFFFFFF, 0x00000000, 0x00000000,
+               0xFFFFFFFF, 0xFFFFFFFF, 0x00000000, 0x00000000,
+               0xAAAAAAAA, 0xAAAAAAAA, 0x55555555, 0x55555555,
+               0xAAAAAAAA, 0xAAAAAAAA, 0x55555555, 0x55555555,
+               0x55555555, 0x55555555, 0xAAAAAAAA, 0xAAAAAAAA,
+               0x55555555, 0x55555555, 0xAAAAAAAA, 0xAAAAAAAA,
+               0xA5A5A5A5, 0xA5A5A5A5, 0x5A5A5A5A, 0x5A5A5A5A,
+               0xA5A5A5A5, 0xA5A5A5A5, 0x5A5A5A5A, 0x5A5A5A5A,
+               0x5A5A5A5A, 0x5A5A5A5A, 0xA5A5A5A5, 0xA5A5A5A5,
+               0x5A5A5A5A, 0x5A5A5A5A, 0xA5A5A5A5, 0xA5A5A5A5,
+               0xAA55AA55, 0xAA55AA55, 0x55AA55AA, 0x55AA55AA,
+               0xAA55AA55, 0xAA55AA55, 0x55AA55AA, 0x55AA55AA,
+               0x55AA55AA, 0x55AA55AA, 0xAA55AA55, 0xAA55AA55,
+               0x55AA55AA, 0x55AA55AA, 0xAA55AA55, 0xAA55AA55 };
+
+       ram_pointer = (volatile u32 *)start_addr;
+
+       for (wr_dqs_shift = 64; wr_dqs_shift < 96; wr_dqs_shift++) {
+               /*for (wr_dqs_shift=1; wr_dqs_shift<96; wr_dqs_shift++) {*/
+
+               /*
+                * De-assert 'start' parameter.
+                */
+               mtdcr(ddrcfga, DDR0_02);
+               val = (mfdcr(ddrcfgd) & ~DDR0_02_START_MASK) | DDR0_02_START_OFF;
+               mtdcr(ddrcfgd, val);
+
+               /*
+                * Set 'wr_dqs_shift'
+                */
+               mtdcr(ddrcfga, DDR0_09);
+               val = (mfdcr(ddrcfgd) & ~DDR0_09_WR_DQS_SHIFT_MASK)
+                       | DDR0_09_WR_DQS_SHIFT_ENCODE(wr_dqs_shift);
+               mtdcr(ddrcfgd, val);
+
+               /*
+                * Set 'dqs_out_shift' = wr_dqs_shift + 32
+                */
+               dqs_out_shift = wr_dqs_shift + 32;
+               mtdcr(ddrcfga, DDR0_22);
+               val = (mfdcr(ddrcfgd) & ~DDR0_22_DQS_OUT_SHIFT_MASK)
+                       | DDR0_22_DQS_OUT_SHIFT_ENCODE(dqs_out_shift);
+               mtdcr(ddrcfgd, val);
+
+               passing_cases = 0;
+
+               for (dll_dqs_delay_X = 1; dll_dqs_delay_X < 64; dll_dqs_delay_X++) {
+                       /*for (dll_dqs_delay_X=1; dll_dqs_delay_X<128; dll_dqs_delay_X++) {*/
+                       /*
+                        * Set 'dll_dqs_delay_X'.
+                        */
+                       /* dll_dqs_delay_0 */
+                       mtdcr(ddrcfga, DDR0_17);
+                       val = (mfdcr(ddrcfgd) & ~DDR0_17_DLL_DQS_DELAY_0_MASK)
+                               | DDR0_17_DLL_DQS_DELAY_0_ENCODE(dll_dqs_delay_X);
+                       mtdcr(ddrcfgd, val);
+                       /* dll_dqs_delay_1 to dll_dqs_delay_4 */
+                       mtdcr(ddrcfga, DDR0_18);
+                       val = (mfdcr(ddrcfgd) & ~DDR0_18_DLL_DQS_DELAY_X_MASK)
+                               | DDR0_18_DLL_DQS_DELAY_4_ENCODE(dll_dqs_delay_X)
+                               | DDR0_18_DLL_DQS_DELAY_3_ENCODE(dll_dqs_delay_X)
+                               | DDR0_18_DLL_DQS_DELAY_2_ENCODE(dll_dqs_delay_X)
+                               | DDR0_18_DLL_DQS_DELAY_1_ENCODE(dll_dqs_delay_X);
+                       mtdcr(ddrcfgd, val);
+                       /* dll_dqs_delay_5 to dll_dqs_delay_8 */
+                       mtdcr(ddrcfga, DDR0_19);
+                       val = (mfdcr(ddrcfgd) & ~DDR0_19_DLL_DQS_DELAY_X_MASK)
+                               | DDR0_19_DLL_DQS_DELAY_8_ENCODE(dll_dqs_delay_X)
+                               | DDR0_19_DLL_DQS_DELAY_7_ENCODE(dll_dqs_delay_X)
+                               | DDR0_19_DLL_DQS_DELAY_6_ENCODE(dll_dqs_delay_X)
+                               | DDR0_19_DLL_DQS_DELAY_5_ENCODE(dll_dqs_delay_X);
+                       mtdcr(ddrcfgd, val);
+
+                       ppcMsync();
+                       ppcMbar();
+
+                       /*
+                        * Assert 'start' parameter.
+                        */
+                       mtdcr(ddrcfga, DDR0_02);
+                       val = (mfdcr(ddrcfgd) & ~DDR0_02_START_MASK) | DDR0_02_START_ON;
+                       mtdcr(ddrcfgd, val);
+
+                       ppcMsync();
+                       ppcMbar();
+
+                       /*
+                        * Wait for the DCC master delay line to finish calibration
+                        */
+                       if (wait_for_dlllock() != 0) {
+                               printf("dlllock did not occur !!!\n");
+                               printf("denali_core_search_data_eye!!!\n");
+                               printf("wr_dqs_shift = %d - dll_dqs_delay_X = %d\n",
+                                      wr_dqs_shift, dll_dqs_delay_X);
+                               hang();
+                       }
+                       ppcMsync();
+                       ppcMbar();
+
+                       if (wait_for_dram_init_complete() != 0) {
+                               printf("dram init complete did not occur !!!\n");
+                               printf("denali_core_search_data_eye!!!\n");
+                               printf("wr_dqs_shift = %d - dll_dqs_delay_X = %d\n",
+                                      wr_dqs_shift, dll_dqs_delay_X);
+                               hang();
+                       }
+                       udelay(100);  /* wait 100us to ensure init is really completed !!! */
+
+                       /* write values */
+                       for (j=0; j<NUM_TRIES; j++) {
+                               ram_pointer[j] = test[j];
+
+                               /* clear any cache at ram location */
+                               __asm__("dcbf 0,%0": :"r" (&ram_pointer[j]));
+                       }
+
+                       /* read values back */
+                       for (j=0; j<NUM_TRIES; j++) {
+                               for (k=0; k<NUM_READS; k++) {
+                                       /* clear any cache at ram location */
+                                       __asm__("dcbf 0,%0": :"r" (&ram_pointer[j]));
+
+                                       if (ram_pointer[j] != test[j])
+                                               break;
+                               }
+
+                               /* read error */
+                               if (k != NUM_READS)
+                                       break;
+                       }
+
+                       /* See if the dll_dqs_delay_X value passed.*/
+                       if (j < NUM_TRIES) {
+                               /* Failed */
+                               passing_cases = 0;
+                               /* break; */
+                       } else {
+                               /* Passed */
+                               if (passing_cases == 0)
+                                       dll_dqs_delay_X_sw_val = dll_dqs_delay_X;
+                               passing_cases++;
+                               if (passing_cases >= max_passing_cases) {
+                                       max_passing_cases = passing_cases;
+                                       wr_dqs_shift_with_max_passing_cases = wr_dqs_shift;
+                                       dll_dqs_delay_X_start_window = dll_dqs_delay_X_sw_val;
+                                       dll_dqs_delay_X_end_window = dll_dqs_delay_X;
+                               }
+                       }
+
+                       /*
+                        * De-assert 'start' parameter.
+                        */
+                       mtdcr(ddrcfga, DDR0_02);
+                       val = (mfdcr(ddrcfgd) & ~DDR0_02_START_MASK) | DDR0_02_START_OFF;
+                       mtdcr(ddrcfgd, val);
+
+               } /* for (dll_dqs_delay_X=0; dll_dqs_delay_X<128; dll_dqs_delay_X++) */
+
+       } /* for (wr_dqs_shift=0; wr_dqs_shift<96; wr_dqs_shift++) */
+
+       /*
+        * Largest passing window is now detected.
+        */
+
+       /* Compute dll_dqs_delay_X value */
+       dll_dqs_delay_X = (dll_dqs_delay_X_end_window + dll_dqs_delay_X_start_window) / 2;
+       wr_dqs_shift = wr_dqs_shift_with_max_passing_cases;
+
+       debug("DQS calibration - Window detected:\n");
+       debug("max_passing_cases = %d\n", max_passing_cases);
+       debug("wr_dqs_shift      = %d\n", wr_dqs_shift);
+       debug("dll_dqs_delay_X   = %d\n", dll_dqs_delay_X);
+       debug("dll_dqs_delay_X window = %d - %d\n",
+             dll_dqs_delay_X_start_window, dll_dqs_delay_X_end_window);
+
+       /*
+        * De-assert 'start' parameter.
+        */
+       mtdcr(ddrcfga, DDR0_02);
+       val = (mfdcr(ddrcfgd) & ~DDR0_02_START_MASK) | DDR0_02_START_OFF;
+       mtdcr(ddrcfgd, val);
+
+       /*
+        * Set 'wr_dqs_shift'
+        */
+       mtdcr(ddrcfga, DDR0_09);
+       val = (mfdcr(ddrcfgd) & ~DDR0_09_WR_DQS_SHIFT_MASK)
+               | DDR0_09_WR_DQS_SHIFT_ENCODE(wr_dqs_shift);
+       mtdcr(ddrcfgd, val);
+       debug("DDR0_09=0x%08lx\n", val);
+
+       /*
+        * Set 'dqs_out_shift' = wr_dqs_shift + 32
+        */
+       dqs_out_shift = wr_dqs_shift + 32;
+       mtdcr(ddrcfga, DDR0_22);
+       val = (mfdcr(ddrcfgd) & ~DDR0_22_DQS_OUT_SHIFT_MASK)
+               | DDR0_22_DQS_OUT_SHIFT_ENCODE(dqs_out_shift);
+       mtdcr(ddrcfgd, val);
+       debug("DDR0_22=0x%08lx\n", val);
+
+       /*
+        * Set 'dll_dqs_delay_X'.
+        */
+       /* dll_dqs_delay_0 */
+       mtdcr(ddrcfga, DDR0_17);
+       val = (mfdcr(ddrcfgd) & ~DDR0_17_DLL_DQS_DELAY_0_MASK)
+               | DDR0_17_DLL_DQS_DELAY_0_ENCODE(dll_dqs_delay_X);
+       mtdcr(ddrcfgd, val);
+       debug("DDR0_17=0x%08lx\n", val);
+
+       /* dll_dqs_delay_1 to dll_dqs_delay_4 */
+       mtdcr(ddrcfga, DDR0_18);
+       val = (mfdcr(ddrcfgd) & ~DDR0_18_DLL_DQS_DELAY_X_MASK)
+               | DDR0_18_DLL_DQS_DELAY_4_ENCODE(dll_dqs_delay_X)
+               | DDR0_18_DLL_DQS_DELAY_3_ENCODE(dll_dqs_delay_X)
+               | DDR0_18_DLL_DQS_DELAY_2_ENCODE(dll_dqs_delay_X)
+               | DDR0_18_DLL_DQS_DELAY_1_ENCODE(dll_dqs_delay_X);
+       mtdcr(ddrcfgd, val);
+       debug("DDR0_18=0x%08lx\n", val);
+
+       /* dll_dqs_delay_5 to dll_dqs_delay_8 */
+       mtdcr(ddrcfga, DDR0_19);
+       val = (mfdcr(ddrcfgd) & ~DDR0_19_DLL_DQS_DELAY_X_MASK)
+               | DDR0_19_DLL_DQS_DELAY_8_ENCODE(dll_dqs_delay_X)
+               | DDR0_19_DLL_DQS_DELAY_7_ENCODE(dll_dqs_delay_X)
+               | DDR0_19_DLL_DQS_DELAY_6_ENCODE(dll_dqs_delay_X)
+               | DDR0_19_DLL_DQS_DELAY_5_ENCODE(dll_dqs_delay_X);
+       mtdcr(ddrcfgd, val);
+       debug("DDR0_19=0x%08lx\n", val);
+
+       /*
+        * Assert 'start' parameter.
+        */
+       mtdcr(ddrcfga, DDR0_02);
+       val = (mfdcr(ddrcfgd) & ~DDR0_02_START_MASK) | DDR0_02_START_ON;
+       mtdcr(ddrcfgd, val);
+
+       ppcMsync();
+       ppcMbar();
+
+       /*
+        * Wait for the DCC master delay line to finish calibration
+        */
+       if (wait_for_dlllock() != 0) {
+               printf("dlllock did not occur !!!\n");
+               hang();
+       }
+       ppcMsync();
+       ppcMbar();
+
+       if (wait_for_dram_init_complete() != 0) {
+               printf("dram init complete did not occur !!!\n");
+               hang();
+       }
+       udelay(100);  /* wait 100us to ensure init is really completed !!! */
+}
+#endif /* CONFIG_DDR_DATA_EYE */
+
+#ifdef CONFIG_DDR_ECC
+static void wait_ddr_idle(void)
+{
+       /*
+        * Controller idle status cannot be determined for Denali
+        * DDR2 code. Just return here.
+        */
+}
+
+static void blank_string(int size)
+{
+       int i;
+
+       for (i=0; i<size; i++)
+               putc('\b');
+       for (i=0; i<size; i++)
+               putc(' ');
+       for (i=0; i<size; i++)
+               putc('\b');
+}
+
+static void program_ecc(u32 start_address,
+                       u32 num_bytes,
+                       u32 tlb_word2_i_value)
+{
+       u32 current_address;
+       u32 end_address;
+       u32 address_increment;
+       u32 val;
+       char str[] = "ECC generation -";
+       char slash[] = "\\|/-\\|/-";
+       int loop = 0;
+       int loopi = 0;
+
+       current_address = start_address;
+
+       sync();
+       eieio();
+       wait_ddr_idle();
+
+       if (tlb_word2_i_value == TLB_WORD2_I_ENABLE) {
+               /* ECC bit set method for non-cached memory */
+               address_increment = 4;
+               end_address = current_address + num_bytes;
+
+               puts(str);
+
+               while (current_address < end_address) {
+                       *((u32 *)current_address) = 0x00000000;
+                       current_address += address_increment;
+
+                       if ((loop++ % (2 << 20)) == 0) {
+                               putc('\b');
+                               putc(slash[loopi++ % 8]);
+                       }
+               }
+
+               blank_string(strlen(str));
+       } else {
+               /* ECC bit set method for cached memory */
+               dcbz_area(start_address, num_bytes);
+               dflush();
+       }
+
+       sync();
+       eieio();
+       wait_ddr_idle();
+
+       /* Clear error status */
+       mfsdram(DDR0_00, val);
+       mtsdram(DDR0_00, val | DDR0_00_INT_ACK_ALL);
+
+       /* Set 'int_mask' parameter to functionnal value */
+       mfsdram(DDR0_01, val);
+       mtsdram(DDR0_01, ((val &~ DDR0_01_INT_MASK_MASK) | DDR0_01_INT_MASK_ALL_OFF));
+
+       sync();
+       eieio();
+       wait_ddr_idle();
+}
+#endif
+
+static __inline__ u32 get_mcsr(void)
+{
+       u32 val;
+
+       asm volatile("mfspr %0, 0x23c" : "=r" (val) :);
+       return val;
+}
+
+static __inline__ void set_mcsr(u32 val)
+{
+       asm volatile("mtspr 0x23c, %0" : "=r" (val) :);
+}
+
+/*************************************************************************
+ *
+ * initdram -- 440EPx's DDR controller is a DENALI Core
+ *
+ ************************************************************************/
+long int initdram (int board_type)
+{
+       u32 val;
+
+       mtsdram(DDR0_02, 0x00000000);
+
+       mtsdram(DDR0_00, 0x0000190A);
+       mtsdram(DDR0_01, 0x01000000);
+       mtsdram(DDR0_03, 0x02030603); /* A suitable burst length was taken. CAS is right for our board */
+
+       mtsdram(DDR0_04, 0x0A030300);
+       mtsdram(DDR0_05, 0x02020308);
+       mtsdram(DDR0_06, 0x0103C812);
+       mtsdram(DDR0_07, 0x00090100);
+       mtsdram(DDR0_08, 0x02c80001);
+       mtsdram(DDR0_09, 0x00011D5F);
+       mtsdram(DDR0_10, 0x00000300);
+       mtsdram(DDR0_11, 0x000CC800);
+       mtsdram(DDR0_12, 0x00000003);
+       mtsdram(DDR0_14, 0x00000000);
+       mtsdram(DDR0_17, 0x1e000000);
+       mtsdram(DDR0_18, 0x1e1e1e1e);
+       mtsdram(DDR0_19, 0x1e1e1e1e);
+       mtsdram(DDR0_20, 0x0B0B0B0B);
+       mtsdram(DDR0_21, 0x0B0B0B0B);
+#ifdef CONFIG_DDR_ECC
+       mtsdram(DDR0_22, 0x00267F0B | DDR0_22_CTRL_RAW_ECC_ENABLE); /* enable ECC       */
+#else
+       mtsdram(DDR0_22, 0x00267F0B);
+#endif
+
+       mtsdram(DDR0_23, 0x01000000);
+       mtsdram(DDR0_24, 0x01010001);
+
+       mtsdram(DDR0_26, 0x2D93028A);
+       mtsdram(DDR0_27, 0x0784682B);
+
+       mtsdram(DDR0_28, 0x00000080);
+       mtsdram(DDR0_31, 0x00000000);
+       mtsdram(DDR0_42, 0x01000006);
+
+       mtsdram(DDR0_43, 0x030A0200);
+       mtsdram(DDR0_44, 0x00000003);
+       mtsdram(DDR0_02, 0x00000001); /* Activate the denali core */
+
+       wait_for_dlllock();
+
+       /*
+        * Program tlb entries for this size (dynamic)
+        */
+       program_tlb(0, 0, CFG_MBYTES_SDRAM << 20, MY_TLB_WORD2_I_ENABLE);
+
+       /*
+        * Setup 2nd TLB with same physical address but different virtual address
+        * with cache enabled. This is done for fast ECC generation.
+        */
+       program_tlb(0, CFG_DDR_CACHED_ADDR, CFG_MBYTES_SDRAM << 20, 0);
+
+#ifdef CONFIG_DDR_DATA_EYE
+       /*
+        * Perform data eye search if requested.
+        */
+       denali_core_search_data_eye(CFG_DDR_CACHED_ADDR, CFG_MBYTES_SDRAM << 20);
+
+       /*
+        * Clear possible errors resulting from data-eye-search.
+        * If not done, then we could get an interrupt later on when
+        * exceptions are enabled.
+        */
+       val = get_mcsr();
+       set_mcsr(val);
+#endif
+
+#ifdef CONFIG_DDR_ECC
+       /*
+        * If ECC is enabled, initialize the parity bits.
+        */
+       program_ecc(CFG_DDR_CACHED_ADDR, CFG_MBYTES_SDRAM << 20, 0);
+#endif
+
+       return (CFG_MBYTES_SDRAM << 20);
+}
diff --git a/board/lwmon5/sdram.h b/board/lwmon5/sdram.h
new file mode 100644 (file)
index 0000000..7f847aa
--- /dev/null
@@ -0,0 +1,505 @@
+/*
+ * (C) Copyright 2006
+ * Sylvie Gohl,             AMCC/IBM, gohl.sylvie@fr.ibm.com
+ * Jacqueline Pira-Ferriol, AMCC/IBM, jpira-ferriol@fr.ibm.com
+ * Thierry Roman,           AMCC/IBM, thierry_roman@fr.ibm.com
+ * Alain Saurel,            AMCC/IBM, alain.saurel@fr.ibm.com
+ * Robert Snyder,           AMCC/IBM, rob.snyder@fr.ibm.com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+#ifndef _SPD_SDRAM_DENALI_H_
+#define _SPD_SDRAM_DENALI_H_
+
+#define ppcMsync       sync
+#define ppcMbar                eieio
+
+/* General definitions */
+#define MAX_SPD_BYTE        128         /* highest SPD byte # to read */
+#define DENALI_REG_NUMBER   45          /* 45 Regs in PPC440EPx Denali Core */
+#define SUPPORTED_DIMMS_NB  7           /* Number of supported DIMM modules types */
+#define SDRAM_NONE          0           /* No DIMM detected in Slot */
+#define MAXRANKS            2           /* 2 ranks maximum */
+
+/* Supported PLB Frequencies */
+#define PLB_FREQ_133MHZ     133333333
+#define PLB_FREQ_152MHZ     152000000
+#define PLB_FREQ_160MHZ     160000000
+#define PLB_FREQ_166MHZ     166666666
+
+/* Denali Core Registers */
+#define SDRAM_DCR_BASE 0x10
+
+#define DDR_DCR_BASE 0x10
+#define ddrcfga  (DDR_DCR_BASE+0x0)   /* DDR configuration address reg */
+#define ddrcfgd  (DDR_DCR_BASE+0x1)   /* DDR configuration data reg    */
+
+/*-----------------------------------------------------------------------------+
+  | Values for ddrcfga register - indirect addressing of these regs
+  +-----------------------------------------------------------------------------*/
+
+#define DDR0_00                         0x00
+#define DDR0_00_INT_ACK_MASK              0x7F000000 /* Write only */
+#define DDR0_00_INT_ACK_ALL               0x7F000000
+#define DDR0_00_INT_ACK_ENCODE(n)           ((((unsigned long)(n))&0x7F)<<24)
+#define DDR0_00_INT_ACK_DECODE(n)           ((((unsigned long)(n))>>24)&0x7F)
+/* Status */
+#define DDR0_00_INT_STATUS_MASK           0x00FF0000 /* Read only */
+/* Bit0. A single access outside the defined PHYSICAL memory space detected. */
+#define DDR0_00_INT_STATUS_BIT0           0x00010000
+/* Bit1. Multiple accesses outside the defined PHYSICAL memory space detected. */
+#define DDR0_00_INT_STATUS_BIT1           0x00020000
+/* Bit2. Single correctable ECC event detected */
+#define DDR0_00_INT_STATUS_BIT2           0x00040000
+/* Bit3. Multiple correctable ECC events detected. */
+#define DDR0_00_INT_STATUS_BIT3           0x00080000
+/* Bit4. Single uncorrectable ECC event detected. */
+#define DDR0_00_INT_STATUS_BIT4           0x00100000
+/* Bit5. Multiple uncorrectable ECC events detected. */
+#define DDR0_00_INT_STATUS_BIT5           0x00200000
+/* Bit6. DRAM initialization complete. */
+#define DDR0_00_INT_STATUS_BIT6           0x00400000
+/* Bit7. Logical OR of all lower bits. */
+#define DDR0_00_INT_STATUS_BIT7           0x00800000
+
+#define DDR0_00_INT_STATUS_ENCODE(n)        ((((unsigned long)(n))&0xFF)<<16)
+#define DDR0_00_INT_STATUS_DECODE(n)        ((((unsigned long)(n))>>16)&0xFF)
+#define DDR0_00_DLL_INCREMENT_MASK        0x00007F00
+#define DDR0_00_DLL_INCREMENT_ENCODE(n)     ((((unsigned long)(n))&0x7F)<<8)
+#define DDR0_00_DLL_INCREMENT_DECODE(n)     ((((unsigned long)(n))>>8)&0x7F)
+#define DDR0_00_DLL_START_POINT_MASK      0x0000007F
+#define DDR0_00_DLL_START_POINT_ENCODE(n)   ((((unsigned long)(n))&0x7F)<<0)
+#define DDR0_00_DLL_START_POINT_DECODE(n)   ((((unsigned long)(n))>>0)&0x7F)
+
+
+#define DDR0_01                         0x01
+#define DDR0_01_PLB0_DB_CS_LOWER_MASK     0x1F000000
+#define DDR0_01_PLB0_DB_CS_LOWER_ENCODE(n)  ((((unsigned long)(n))&0x1F)<<24)
+#define DDR0_01_PLB0_DB_CS_LOWER_DECODE(n)  ((((unsigned long)(n))>>24)&0x1F)
+#define DDR0_01_PLB0_DB_CS_UPPER_MASK     0x001F0000
+#define DDR0_01_PLB0_DB_CS_UPPER_ENCODE(n)  ((((unsigned long)(n))&0x1F)<<16)
+#define DDR0_01_PLB0_DB_CS_UPPER_DECODE(n)  ((((unsigned long)(n))>>16)&0x1F)
+#define DDR0_01_OUT_OF_RANGE_TYPE_MASK    0x00000700 /* Read only */
+#define DDR0_01_OUT_OF_RANGE_TYPE_ENCODE(n)               ((((unsigned long)(n))&0x7)<<8)
+#define DDR0_01_OUT_OF_RANGE_TYPE_DECODE(n)               ((((unsigned long)(n))>>8)&0x7)
+#define DDR0_01_INT_MASK_MASK             0x000000FF
+#define DDR0_01_INT_MASK_ENCODE(n)          ((((unsigned long)(n))&0xFF)<<0)
+#define DDR0_01_INT_MASK_DECODE(n)          ((((unsigned long)(n))>>0)&0xFF)
+#define DDR0_01_INT_MASK_ALL_ON           0x000000FF
+#define DDR0_01_INT_MASK_ALL_OFF          0x00000000
+
+#define DDR0_02                         0x02
+#define DDR0_02_MAX_CS_REG_MASK           0x02000000 /* Read only */
+#define DDR0_02_MAX_CS_REG_ENCODE(n)        ((((unsigned long)(n))&0x2)<<24)
+#define DDR0_02_MAX_CS_REG_DECODE(n)        ((((unsigned long)(n))>>24)&0x2)
+#define DDR0_02_MAX_COL_REG_MASK          0x000F0000 /* Read only */
+#define DDR0_02_MAX_COL_REG_ENCODE(n)       ((((unsigned long)(n))&0xF)<<16)
+#define DDR0_02_MAX_COL_REG_DECODE(n)       ((((unsigned long)(n))>>16)&0xF)
+#define DDR0_02_MAX_ROW_REG_MASK          0x00000F00 /* Read only */
+#define DDR0_02_MAX_ROW_REG_ENCODE(n)       ((((unsigned long)(n))&0xF)<<8)
+#define DDR0_02_MAX_ROW_REG_DECODE(n)       ((((unsigned long)(n))>>8)&0xF)
+#define DDR0_02_START_MASK                0x00000001
+#define DDR0_02_START_ENCODE(n)             ((((unsigned long)(n))&0x1)<<0)
+#define DDR0_02_START_DECODE(n)             ((((unsigned long)(n))>>0)&0x1)
+#define DDR0_02_START_OFF                 0x00000000
+#define DDR0_02_START_ON                  0x00000001
+
+#define DDR0_03                         0x03
+#define DDR0_03_BSTLEN_MASK               0x07000000
+#define DDR0_03_BSTLEN_ENCODE(n)            ((((unsigned long)(n))&0x7)<<24)
+#define DDR0_03_BSTLEN_DECODE(n)            ((((unsigned long)(n))>>24)&0x7)
+#define DDR0_03_CASLAT_MASK               0x00070000
+#define DDR0_03_CASLAT_ENCODE(n)            ((((unsigned long)(n))&0x7)<<16)
+#define DDR0_03_CASLAT_DECODE(n)            ((((unsigned long)(n))>>16)&0x7)
+#define DDR0_03_CASLAT_LIN_MASK           0x00000F00
+#define DDR0_03_CASLAT_LIN_ENCODE(n)        ((((unsigned long)(n))&0xF)<<8)
+#define DDR0_03_CASLAT_LIN_DECODE(n)        ((((unsigned long)(n))>>8)&0xF)
+#define DDR0_03_INITAREF_MASK             0x0000000F
+#define DDR0_03_INITAREF_ENCODE(n)          ((((unsigned long)(n))&0xF)<<0)
+#define DDR0_03_INITAREF_DECODE(n)          ((((unsigned long)(n))>>0)&0xF)
+
+#define DDR0_04                         0x04
+#define DDR0_04_TRC_MASK                  0x1F000000
+#define DDR0_04_TRC_ENCODE(n)               ((((unsigned long)(n))&0x1F)<<24)
+#define DDR0_04_TRC_DECODE(n)               ((((unsigned long)(n))>>24)&0x1F)
+#define DDR0_04_TRRD_MASK                 0x00070000
+#define DDR0_04_TRRD_ENCODE(n)              ((((unsigned long)(n))&0x7)<<16)
+#define DDR0_04_TRRD_DECODE(n)              ((((unsigned long)(n))>>16)&0x7)
+#define DDR0_04_TRTP_MASK                 0x00000700
+#define DDR0_04_TRTP_ENCODE(n)              ((((unsigned long)(n))&0x7)<<8)
+#define DDR0_04_TRTP_DECODE(n)              ((((unsigned long)(n))>>8)&0x7)
+
+#define DDR0_05                         0x05
+#define DDR0_05_TMRD_MASK                 0x1F000000
+#define DDR0_05_TMRD_ENCODE(n)              ((((unsigned long)(n))&0x1F)<<24)
+#define DDR0_05_TMRD_DECODE(n)              ((((unsigned long)(n))>>24)&0x1F)
+#define DDR0_05_TEMRS_MASK                0x00070000
+#define DDR0_05_TEMRS_ENCODE(n)             ((((unsigned long)(n))&0x7)<<16)
+#define DDR0_05_TEMRS_DECODE(n)             ((((unsigned long)(n))>>16)&0x7)
+#define DDR0_05_TRP_MASK                  0x00000F00
+#define DDR0_05_TRP_ENCODE(n)               ((((unsigned long)(n))&0xF)<<8)
+#define DDR0_05_TRP_DECODE(n)               ((((unsigned long)(n))>>8)&0xF)
+#define DDR0_05_TRAS_MIN_MASK             0x000000FF
+#define DDR0_05_TRAS_MIN_ENCODE(n)          ((((unsigned long)(n))&0xFF)<<0)
+#define DDR0_05_TRAS_MIN_DECODE(n)          ((((unsigned long)(n))>>0)&0xFF)
+
+#define DDR0_06                         0x06
+#define DDR0_06_WRITEINTERP_MASK          0x01000000
+#define DDR0_06_WRITEINTERP_ENCODE(n)       ((((unsigned long)(n))&0x1)<<24)
+#define DDR0_06_WRITEINTERP_DECODE(n)       ((((unsigned long)(n))>>24)&0x1)
+#define DDR0_06_TWTR_MASK                 0x00070000
+#define DDR0_06_TWTR_ENCODE(n)              ((((unsigned long)(n))&0x7)<<16)
+#define DDR0_06_TWTR_DECODE(n)              ((((unsigned long)(n))>>16)&0x7)
+#define DDR0_06_TDLL_MASK                 0x0000FF00
+#define DDR0_06_TDLL_ENCODE(n)              ((((unsigned long)(n))&0xFF)<<8)
+#define DDR0_06_TDLL_DECODE(n)              ((((unsigned long)(n))>>8)&0xFF)
+#define DDR0_06_TRFC_MASK                 0x0000007F
+#define DDR0_06_TRFC_ENCODE(n)              ((((unsigned long)(n))&0x7F)<<0)
+#define DDR0_06_TRFC_DECODE(n)              ((((unsigned long)(n))>>0)&0x7F)
+
+#define DDR0_07                         0x07
+#define DDR0_07_NO_CMD_INIT_MASK          0x01000000
+#define DDR0_07_NO_CMD_INIT_ENCODE(n)       ((((unsigned long)(n))&0x1)<<24)
+#define DDR0_07_NO_CMD_INIT_DECODE(n)       ((((unsigned long)(n))>>24)&0x1)
+#define DDR0_07_TFAW_MASK                 0x001F0000
+#define DDR0_07_TFAW_ENCODE(n)              ((((unsigned long)(n))&0x1F)<<16)
+#define DDR0_07_TFAW_DECODE(n)              ((((unsigned long)(n))>>16)&0x1F)
+#define DDR0_07_AUTO_REFRESH_MODE_MASK    0x00000100
+#define DDR0_07_AUTO_REFRESH_MODE_ENCODE(n) ((((unsigned long)(n))&0x1)<<8)
+#define DDR0_07_AUTO_REFRESH_MODE_DECODE(n) ((((unsigned long)(n))>>8)&0x1)
+#define DDR0_07_AREFRESH_MASK             0x00000001
+#define DDR0_07_AREFRESH_ENCODE(n)          ((((unsigned long)(n))&0x1)<<0)
+#define DDR0_07_AREFRESH_DECODE(n)          ((((unsigned long)(n))>>0)&0x1)
+
+#define DDR0_08                         0x08
+#define DDR0_08_WRLAT_MASK                0x07000000
+#define DDR0_08_WRLAT_ENCODE(n)             ((((unsigned long)(n))&0x7)<<24)
+#define DDR0_08_WRLAT_DECODE(n)             ((((unsigned long)(n))>>24)&0x7)
+#define DDR0_08_TCPD_MASK                 0x00FF0000
+#define DDR0_08_TCPD_ENCODE(n)              ((((unsigned long)(n))&0xFF)<<16)
+#define DDR0_08_TCPD_DECODE(n)              ((((unsigned long)(n))>>16)&0xFF)
+#define DDR0_08_DQS_N_EN_MASK             0x00000100
+#define DDR0_08_DQS_N_EN_ENCODE(n)          ((((unsigned long)(n))&0x1)<<8)
+#define DDR0_08_DQS_N_EN_DECODE(n)          ((((unsigned long)(n))>>8)&0x1)
+#define DDR0_08_DDRII_SDRAM_MODE_MASK     0x00000001
+#define DDR0_08_DDRII_ENCODE(n)             ((((unsigned long)(n))&0x1)<<0)
+#define DDR0_08_DDRII_DECODE(n)             ((((unsigned long)(n))>>0)&0x1)
+
+#define DDR0_09                         0x09
+#define DDR0_09_OCD_ADJUST_PDN_CS_0_MASK  0x1F000000
+#define DDR0_09_OCD_ADJUST_PDN_CS_0_ENCODE(n) ((((unsigned long)(n))&0x1F)<<24)
+#define DDR0_09_OCD_ADJUST_PDN_CS_0_DECODE(n) ((((unsigned long)(n))>>24)&0x1F)
+#define DDR0_09_RTT_0_MASK                0x00030000
+#define DDR0_09_RTT_0_ENCODE(n)             ((((unsigned long)(n))&0x3)<<16)
+#define DDR0_09_RTT_0_DECODE(n)             ((((unsigned long)(n))>>16)&0x3)
+#define DDR0_09_WR_DQS_SHIFT_BYPASS_MASK  0x00007F00
+#define DDR0_09_WR_DQS_SHIFT_BYPASS_ENCODE(n) ((((unsigned long)(n))&0x7F)<<8)
+#define DDR0_09_WR_DQS_SHIFT_BYPASS_DECODE(n) ((((unsigned long)(n))>>8)&0x7F)
+#define DDR0_09_WR_DQS_SHIFT_MASK         0x0000007F
+#define DDR0_09_WR_DQS_SHIFT_ENCODE(n)      ((((unsigned long)(n))&0x7F)<<0)
+#define DDR0_09_WR_DQS_SHIFT_DECODE(n)      ((((unsigned long)(n))>>0)&0x7F)
+
+#define DDR0_10                         0x0A
+#define DDR0_10_WRITE_MODEREG_MASK        0x00010000 /* Write only */
+#define DDR0_10_WRITE_MODEREG_ENCODE(n)     ((((unsigned long)(n))&0x1)<<16)
+#define DDR0_10_WRITE_MODEREG_DECODE(n)     ((((unsigned long)(n))>>16)&0x1)
+#define DDR0_10_CS_MAP_MASK               0x00000300
+#define DDR0_10_CS_MAP_NO_MEM             0x00000000
+#define DDR0_10_CS_MAP_RANK0_INSTALLED    0x00000100
+#define DDR0_10_CS_MAP_RANK1_INSTALLED    0x00000200
+#define DDR0_10_CS_MAP_ENCODE(n)            ((((unsigned long)(n))&0x3)<<8)
+#define DDR0_10_CS_MAP_DECODE(n)            ((((unsigned long)(n))>>8)&0x3)
+#define DDR0_10_OCD_ADJUST_PUP_CS_0_MASK  0x0000001F
+#define DDR0_10_OCD_ADJUST_PUP_CS_0_ENCODE(n) ((((unsigned long)(n))&0x1F)<<0)
+#define DDR0_10_OCD_ADJUST_PUP_CS_0_DECODE(n) ((((unsigned long)(n))>>0)&0x1F)
+
+#define DDR0_11                         0x0B
+#define DDR0_11_SREFRESH_MASK             0x01000000
+#define DDR0_11_SREFRESH_ENCODE(n)          ((((unsigned long)(n))&0x1)<<24)
+#define DDR0_11_SREFRESH_DECODE(n)          ((((unsigned long)(n))>>24)&0x1F)
+#define DDR0_11_TXSNR_MASK                0x00FF0000
+#define DDR0_11_TXSNR_ENCODE(n)             ((((unsigned long)(n))&0xFF)<<16)
+#define DDR0_11_TXSNR_DECODE(n)             ((((unsigned long)(n))>>16)&0xFF)
+#define DDR0_11_TXSR_MASK                 0x0000FF00
+#define DDR0_11_TXSR_ENCODE(n)              ((((unsigned long)(n))&0xFF)<<8)
+#define DDR0_11_TXSR_DECODE(n)              ((((unsigned long)(n))>>8)&0xFF)
+
+#define DDR0_12                         0x0C
+#define DDR0_12_TCKE_MASK                 0x0000007
+#define DDR0_12_TCKE_ENCODE(n)              ((((unsigned long)(n))&0x7)<<0)
+#define DDR0_12_TCKE_DECODE(n)              ((((unsigned long)(n))>>0)&0x7)
+
+#define DDR0_13                         0x0D
+
+#define DDR0_14                         0x0E
+#define DDR0_14_DLL_BYPASS_MODE_MASK      0x01000000
+#define DDR0_14_DLL_BYPASS_MODE_ENCODE(n)   ((((unsigned long)(n))&0x1)<<24)
+#define DDR0_14_DLL_BYPASS_MODE_DECODE(n)   ((((unsigned long)(n))>>24)&0x1)
+#define DDR0_14_REDUC_MASK                0x00010000
+#define DDR0_14_REDUC_64BITS              0x00000000
+#define DDR0_14_REDUC_32BITS              0x00010000
+#define DDR0_14_REDUC_ENCODE(n)             ((((unsigned long)(n))&0x1)<<16)
+#define DDR0_14_REDUC_DECODE(n)             ((((unsigned long)(n))>>16)&0x1)
+#define DDR0_14_REG_DIMM_ENABLE_MASK      0x00000100
+#define DDR0_14_REG_DIMM_ENABLE_ENCODE(n)   ((((unsigned long)(n))&0x1)<<8)
+#define DDR0_14_REG_DIMM_ENABLE_DECODE(n)   ((((unsigned long)(n))>>8)&0x1)
+
+#define DDR0_15                         0x0F
+
+#define DDR0_16                         0x10
+
+#define DDR0_17                         0x11
+#define DDR0_17_DLL_DQS_DELAY_0_MASK      0x7F000000
+#define DDR0_17_DLL_DQS_DELAY_0_ENCODE(n)   ((((unsigned long)(n))&0x7F)<<24)
+#define DDR0_17_DLL_DQS_DELAY_0_DECODE(n)   ((((unsigned long)(n))>>24)&0x7F)
+#define DDR0_17_DLLLOCKREG_MASK           0x00010000 /* Read only */
+#define DDR0_17_DLLLOCKREG_LOCKED         0x00010000
+#define DDR0_17_DLLLOCKREG_UNLOCKED       0x00000000
+#define DDR0_17_DLLLOCKREG_ENCODE(n)        ((((unsigned long)(n))&0x1)<<16)
+#define DDR0_17_DLLLOCKREG_DECODE(n)        ((((unsigned long)(n))>>16)&0x1)
+#define DDR0_17_DLL_LOCK_MASK             0x00007F00 /* Read only */
+#define DDR0_17_DLL_LOCK_ENCODE(n)          ((((unsigned long)(n))&0x7F)<<8)
+#define DDR0_17_DLL_LOCK_DECODE(n)          ((((unsigned long)(n))>>8)&0x7F)
+
+#define DDR0_18                         0x12
+#define DDR0_18_DLL_DQS_DELAY_X_MASK      0x7F7F7F7F
+#define DDR0_18_DLL_DQS_DELAY_4_MASK      0x7F000000
+#define DDR0_18_DLL_DQS_DELAY_4_ENCODE(n)   ((((unsigned long)(n))&0x7F)<<24)
+#define DDR0_18_DLL_DQS_DELAY_4_DECODE(n)   ((((unsigned long)(n))>>24)&0x7F)
+#define DDR0_18_DLL_DQS_DELAY_3_MASK      0x007F0000
+#define DDR0_18_DLL_DQS_DELAY_3_ENCODE(n)   ((((unsigned long)(n))&0x7F)<<16)
+#define DDR0_18_DLL_DQS_DELAY_3_DECODE(n)   ((((unsigned long)(n))>>16)&0x7F)
+#define DDR0_18_DLL_DQS_DELAY_2_MASK      0x00007F00
+#define DDR0_18_DLL_DQS_DELAY_2_ENCODE(n)   ((((unsigned long)(n))&0x7F)<<8)
+#define DDR0_18_DLL_DQS_DELAY_2_DECODE(n)   ((((unsigned long)(n))>>8)&0x7F)
+#define DDR0_18_DLL_DQS_DELAY_1_MASK      0x0000007F
+#define DDR0_18_DLL_DQS_DELAY_1_ENCODE(n)   ((((unsigned long)(n))&0x7F)<<0)
+#define DDR0_18_DLL_DQS_DELAY_1_DECODE(n)   ((((unsigned long)(n))>>0)&0x7F)
+
+#define DDR0_19                         0x13
+#define DDR0_19_DLL_DQS_DELAY_X_MASK      0x7F7F7F7F
+#define DDR0_19_DLL_DQS_DELAY_8_MASK      0x7F000000
+#define DDR0_19_DLL_DQS_DELAY_8_ENCODE(n)   ((((unsigned long)(n))&0x7F)<<24)
+#define DDR0_19_DLL_DQS_DELAY_8_DECODE(n)   ((((unsigned long)(n))>>24)&0x7F)
+#define DDR0_19_DLL_DQS_DELAY_7_MASK      0x007F0000
+#define DDR0_19_DLL_DQS_DELAY_7_ENCODE(n)   ((((unsigned long)(n))&0x7F)<<16)
+#define DDR0_19_DLL_DQS_DELAY_7_DECODE(n)   ((((unsigned long)(n))>>16)&0x7F)
+#define DDR0_19_DLL_DQS_DELAY_6_MASK      0x00007F00
+#define DDR0_19_DLL_DQS_DELAY_6_ENCODE(n)   ((((unsigned long)(n))&0x7F)<<8)
+#define DDR0_19_DLL_DQS_DELAY_6_DECODE(n)   ((((unsigned long)(n))>>8)&0x7F)
+#define DDR0_19_DLL_DQS_DELAY_5_MASK      0x0000007F
+#define DDR0_19_DLL_DQS_DELAY_5_ENCODE(n)   ((((unsigned long)(n))&0x7F)<<0)
+#define DDR0_19_DLL_DQS_DELAY_5_DECODE(n)   ((((unsigned long)(n))>>0)&0x7F)
+
+#define DDR0_20                         0x14
+#define DDR0_20_DLL_DQS_BYPASS_3_MASK      0x7F000000
+#define DDR0_20_DLL_DQS_BYPASS_3_ENCODE(n)   ((((unsigned long)(n))&0x7F)<<24)
+#define DDR0_20_DLL_DQS_BYPASS_3_DECODE(n)   ((((unsigned long)(n))>>24)&0x7F)
+#define DDR0_20_DLL_DQS_BYPASS_2_MASK      0x007F0000
+#define DDR0_20_DLL_DQS_BYPASS_2_ENCODE(n)   ((((unsigned long)(n))&0x7F)<<16)
+#define DDR0_20_DLL_DQS_BYPASS_2_DECODE(n)   ((((unsigned long)(n))>>16)&0x7F)
+#define DDR0_20_DLL_DQS_BYPASS_1_MASK      0x00007F00
+#define DDR0_20_DLL_DQS_BYPASS_1_ENCODE(n)   ((((unsigned long)(n))&0x7F)<<8)
+#define DDR0_20_DLL_DQS_BYPASS_1_DECODE(n)   ((((unsigned long)(n))>>8)&0x7F)
+#define DDR0_20_DLL_DQS_BYPASS_0_MASK      0x0000007F
+#define DDR0_20_DLL_DQS_BYPASS_0_ENCODE(n)   ((((unsigned long)(n))&0x7F)<<0)
+#define DDR0_20_DLL_DQS_BYPASS_0_DECODE(n)   ((((unsigned long)(n))>>0)&0x7F)
+
+#define DDR0_21                         0x15
+#define DDR0_21_DLL_DQS_BYPASS_7_MASK      0x7F000000
+#define DDR0_21_DLL_DQS_BYPASS_7_ENCODE(n)   ((((unsigned long)(n))&0x7F)<<24)
+#define DDR0_21_DLL_DQS_BYPASS_7_DECODE(n)   ((((unsigned long)(n))>>24)&0x7F)
+#define DDR0_21_DLL_DQS_BYPASS_6_MASK      0x007F0000
+#define DDR0_21_DLL_DQS_BYPASS_6_ENCODE(n)   ((((unsigned long)(n))&0x7F)<<16)
+#define DDR0_21_DLL_DQS_BYPASS_6_DECODE(n)   ((((unsigned long)(n))>>16)&0x7F)
+#define DDR0_21_DLL_DQS_BYPASS_5_MASK      0x00007F00
+#define DDR0_21_DLL_DQS_BYPASS_5_ENCODE(n)   ((((unsigned long)(n))&0x7F)<<8)
+#define DDR0_21_DLL_DQS_BYPASS_5_DECODE(n)   ((((unsigned long)(n))>>8)&0x7F)
+#define DDR0_21_DLL_DQS_BYPASS_4_MASK      0x0000007F
+#define DDR0_21_DLL_DQS_BYPASS_4_ENCODE(n)   ((((unsigned long)(n))&0x7F)<<0)
+#define DDR0_21_DLL_DQS_BYPASS_4_DECODE(n)   ((((unsigned long)(n))>>0)&0x7F)
+
+#define DDR0_22                         0x16
+/* ECC */
+#define DDR0_22_CTRL_RAW_MASK             0x03000000
+#define DDR0_22_CTRL_RAW_ECC_DISABLE      0x00000000 /* ECC not being used */
+#define DDR0_22_CTRL_RAW_ECC_CHECK_ONLY   0x01000000 /* ECC checking is on, but no attempts to correct*/
+#define DDR0_22_CTRL_RAW_NO_ECC_RAM       0x02000000 /* No ECC RAM storage available */
+#define DDR0_22_CTRL_RAW_ECC_ENABLE       0x03000000 /* ECC checking and correcting on */
+#define DDR0_22_CTRL_RAW_ENCODE(n)          ((((unsigned long)(n))&0x3)<<24)
+#define DDR0_22_CTRL_RAW_DECODE(n)          ((((unsigned long)(n))>>24)&0x3)
+
+#define DDR0_22_DQS_OUT_SHIFT_BYPASS_MASK 0x007F0000
+#define DDR0_22_DQS_OUT_SHIFT_BYPASS_ENCODE(n) ((((unsigned long)(n))&0x7F)<<16)
+#define DDR0_22_DQS_OUT_SHIFT_BYPASS_DECODE(n) ((((unsigned long)(n))>>16)&0x7F)
+#define DDR0_22_DQS_OUT_SHIFT_MASK        0x00007F00
+#define DDR0_22_DQS_OUT_SHIFT_ENCODE(n)     ((((unsigned long)(n))&0x7F)<<8)
+#define DDR0_22_DQS_OUT_SHIFT_DECODE(n)     ((((unsigned long)(n))>>8)&0x7F)
+#define DDR0_22_DLL_DQS_BYPASS_8_MASK     0x0000007F
+#define DDR0_22_DLL_DQS_BYPASS_8_ENCODE(n)  ((((unsigned long)(n))&0x7F)<<0)
+#define DDR0_22_DLL_DQS_BYPASS_8_DECODE(n)  ((((unsigned long)(n))>>0)&0x7F)
+
+
+#define DDR0_23                         0x17
+#define DDR0_23_ODT_RD_MAP_CS0_MASK       0x03000000
+#define DDR0_23_ODT_RD_MAP_CS0_ENCODE(n)   ((((unsigned long)(n))&0x3)<<24)
+#define DDR0_23_ODT_RD_MAP_CS0_DECODE(n)   ((((unsigned long)(n))>>24)&0x3)
+#define DDR0_23_ECC_C_SYND_MASK           0x00FF0000 /* Read only */
+#define DDR0_23_ECC_C_SYND_ENCODE(n)        ((((unsigned long)(n))&0xFF)<<16)
+#define DDR0_23_ECC_C_SYND_DECODE(n)        ((((unsigned long)(n))>>16)&0xFF)
+#define DDR0_23_ECC_U_SYND_MASK           0x0000FF00 /* Read only */
+#define DDR0_23_ECC_U_SYND_ENCODE(n)        ((((unsigned long)(n))&0xFF)<<8)
+#define DDR0_23_ECC_U_SYND_DECODE(n)        ((((unsigned long)(n))>>8)&0xFF)
+#define DDR0_23_FWC_MASK                  0x00000001 /* Write only */
+#define DDR0_23_FWC_ENCODE(n)               ((((unsigned long)(n))&0x1)<<0)
+#define DDR0_23_FWC_DECODE(n)               ((((unsigned long)(n))>>0)&0x1)
+
+#define DDR0_24                         0x18
+#define DDR0_24_RTT_PAD_TERMINATION_MASK  0x03000000
+#define DDR0_24_RTT_PAD_TERMINATION_ENCODE(n) ((((unsigned long)(n))&0x3)<<24)
+#define DDR0_24_RTT_PAD_TERMINATION_DECODE(n) ((((unsigned long)(n))>>24)&0x3)
+#define DDR0_24_ODT_WR_MAP_CS1_MASK       0x00030000
+#define DDR0_24_ODT_WR_MAP_CS1_ENCODE(n)    ((((unsigned long)(n))&0x3)<<16)
+#define DDR0_24_ODT_WR_MAP_CS1_DECODE(n)    ((((unsigned long)(n))>>16)&0x3)
+#define DDR0_24_ODT_RD_MAP_CS1_MASK       0x00000300
+#define DDR0_24_ODT_RD_MAP_CS1_ENCODE(n)    ((((unsigned long)(n))&0x3)<<8)
+#define DDR0_24_ODT_RD_MAP_CS1_DECODE(n)    ((((unsigned long)(n))>>8)&0x3)
+#define DDR0_24_ODT_WR_MAP_CS0_MASK       0x00000003
+#define DDR0_24_ODT_WR_MAP_CS0_ENCODE(n)    ((((unsigned long)(n))&0x3)<<0)
+#define DDR0_24_ODT_WR_MAP_CS0_DECODE(n)    ((((unsigned long)(n))>>0)&0x3)
+
+#define DDR0_25                         0x19
+#define DDR0_25_VERSION_MASK              0xFFFF0000 /* Read only */
+#define DDR0_25_VERSION_ENCODE(n)           ((((unsigned long)(n))&0xFFFF)<<16)
+#define DDR0_25_VERSION_DECODE(n)           ((((unsigned long)(n))>>16)&0xFFFF)
+#define DDR0_25_OUT_OF_RANGE_LENGTH_MASK  0x000003FF /* Read only */
+#define DDR0_25_OUT_OF_RANGE_LENGTH_ENCODE(n) ((((unsigned long)(n))&0x3FF)<<0)
+#define DDR0_25_OUT_OF_RANGE_LENGTH_DECODE(n) ((((unsigned long)(n))>>0)&0x3FF)
+
+#define DDR0_26                         0x1A
+#define DDR0_26_TRAS_MAX_MASK             0xFFFF0000
+#define DDR0_26_TRAS_MAX_ENCODE(n)          ((((unsigned long)(n))&0xFFFF)<<16)
+#define DDR0_26_TRAS_MAX_DECODE(n)          ((((unsigned long)(n))>>16)&0xFFFF)
+#define DDR0_26_TREF_MASK                 0x00003FFF
+#define DDR0_26_TREF_ENCODE(n)              ((((unsigned long)(n))&0x3FF)<<0)
+#define DDR0_26_TREF_DECODE(n)              ((((unsigned long)(n))>>0)&0x3FF)
+
+#define DDR0_27                         0x1B
+#define DDR0_27_EMRS_DATA_MASK            0x3FFF0000
+#define DDR0_27_EMRS_DATA_ENCODE(n)         ((((unsigned long)(n))&0x3FFF)<<16)
+#define DDR0_27_EMRS_DATA_DECODE(n)         ((((unsigned long)(n))>>16)&0x3FFF)
+#define DDR0_27_TINIT_MASK                0x0000FFFF
+#define DDR0_27_TINIT_ENCODE(n)             ((((unsigned long)(n))&0xFFFF)<<0)
+#define DDR0_27_TINIT_DECODE(n)             ((((unsigned long)(n))>>0)&0xFFFF)
+
+#define DDR0_28                         0x1C
+#define DDR0_28_EMRS3_DATA_MASK           0x3FFF0000
+#define DDR0_28_EMRS3_DATA_ENCODE(n)        ((((unsigned long)(n))&0x3FFF)<<16)
+#define DDR0_28_EMRS3_DATA_DECODE(n)        ((((unsigned long)(n))>>16)&0x3FFF)
+#define DDR0_28_EMRS2_DATA_MASK           0x00003FFF
+#define DDR0_28_EMRS2_DATA_ENCODE(n)        ((((unsigned long)(n))&0x3FFF)<<0)
+#define DDR0_28_EMRS2_DATA_DECODE(n)        ((((unsigned long)(n))>>0)&0x3FFF)
+
+#define DDR0_29                         0x1D
+
+#define DDR0_30                         0x1E
+
+#define DDR0_31                         0x1F
+#define DDR0_31_XOR_CHECK_BITS_MASK       0x0000FFFF
+#define DDR0_31_XOR_CHECK_BITS_ENCODE(n)    ((((unsigned long)(n))&0xFFFF)<<0)
+#define DDR0_31_XOR_CHECK_BITS_DECODE(n)    ((((unsigned long)(n))>>0)&0xFFFF)
+
+#define DDR0_32                         0x20
+#define DDR0_32_OUT_OF_RANGE_ADDR_MASK    0xFFFFFFFF /* Read only */
+#define DDR0_32_OUT_OF_RANGE_ADDR_ENCODE(n) ((((unsigned long)(n))&0xFFFFFFFF)<<0)
+#define DDR0_32_OUT_OF_RANGE_ADDR_DECODE(n) ((((unsigned long)(n))>>0)&0xFFFFFFFF)
+
+#define DDR0_33                         0x21
+#define DDR0_33_OUT_OF_RANGE_ADDR_MASK    0x00000001 /* Read only */
+#define DDR0_33_OUT_OF_RANGE_ADDR_ENCODE(n) ((((unsigned long)(n))&0x1)<<0)
+#define DDR0_33_OUT_OF_RANGE_ADDR_DECODE(n)               ((((unsigned long)(n))>>0)&0x1)
+
+#define DDR0_34                         0x22
+#define DDR0_34_ECC_U_ADDR_MASK           0xFFFFFFFF /* Read only */
+#define DDR0_34_ECC_U_ADDR_ENCODE(n)        ((((unsigned long)(n))&0xFFFFFFFF)<<0)
+#define DDR0_34_ECC_U_ADDR_DECODE(n)        ((((unsigned long)(n))>>0)&0xFFFFFFFF)
+
+#define DDR0_35                         0x23
+#define DDR0_35_ECC_U_ADDR_MASK           0x00000001 /* Read only */
+#define DDR0_35_ECC_U_ADDR_ENCODE(n)        ((((unsigned long)(n))&0x1)<<0)
+#define DDR0_35_ECC_U_ADDR_DECODE(n)        ((((unsigned long)(n))>>0)&0x1)
+
+#define DDR0_36                         0x24
+#define DDR0_36_ECC_U_DATA_MASK           0xFFFFFFFF /* Read only */
+#define DDR0_36_ECC_U_DATA_ENCODE(n)        ((((unsigned long)(n))&0xFFFFFFFF)<<0)
+#define DDR0_36_ECC_U_DATA_DECODE(n)        ((((unsigned long)(n))>>0)&0xFFFFFFFF)
+
+#define DDR0_37                         0x25
+#define DDR0_37_ECC_U_DATA_MASK           0xFFFFFFFF /* Read only */
+#define DDR0_37_ECC_U_DATA_ENCODE(n)        ((((unsigned long)(n))&0xFFFFFFFF)<<0)
+#define DDR0_37_ECC_U_DATA_DECODE(n)        ((((unsigned long)(n))>>0)&0xFFFFFFFF)
+
+#define DDR0_38                         0x26
+#define DDR0_38_ECC_C_ADDR_MASK           0xFFFFFFFF /* Read only */
+#define DDR0_38_ECC_C_ADDR_ENCODE(n)        ((((unsigned long)(n))&0xFFFFFFFF)<<0)
+#define DDR0_38_ECC_C_ADDR_DECODE(n)        ((((unsigned long)(n))>>0)&0xFFFFFFFF)
+
+#define DDR0_39                         0x27
+#define DDR0_39_ECC_C_ADDR_MASK           0x00000001 /* Read only */
+#define DDR0_39_ECC_C_ADDR_ENCODE(n)        ((((unsigned long)(n))&0x1)<<0)
+#define DDR0_39_ECC_C_ADDR_DECODE(n)        ((((unsigned long)(n))>>0)&0x1)
+
+#define DDR0_40                         0x28
+#define DDR0_40_ECC_C_DATA_MASK           0xFFFFFFFF /* Read only */
+#define DDR0_40_ECC_C_DATA_ENCODE(n)        ((((unsigned long)(n))&0xFFFFFFFF)<<0)
+#define DDR0_40_ECC_C_DATA_DECODE(n)        ((((unsigned long)(n))>>0)&0xFFFFFFFF)
+
+#define DDR0_41                         0x29
+#define DDR0_41_ECC_C_DATA_MASK           0xFFFFFFFF /* Read only */
+#define DDR0_41_ECC_C_DATA_ENCODE(n)        ((((unsigned long)(n))&0xFFFFFFFF)<<0)
+#define DDR0_41_ECC_C_DATA_DECODE(n)        ((((unsigned long)(n))>>0)&0xFFFFFFFF)
+
+#define DDR0_42                         0x2A
+#define DDR0_42_ADDR_PINS_MASK            0x07000000
+#define DDR0_42_ADDR_PINS_ENCODE(n)         ((((unsigned long)(n))&0x7)<<24)
+#define DDR0_42_ADDR_PINS_DECODE(n)         ((((unsigned long)(n))>>24)&0x7)
+#define DDR0_42_CASLAT_LIN_GATE_MASK      0x0000000F
+#define DDR0_42_CASLAT_LIN_GATE_ENCODE(n)   ((((unsigned long)(n))&0xF)<<0)
+#define DDR0_42_CASLAT_LIN_GATE_DECODE(n)   ((((unsigned long)(n))>>0)&0xF)
+
+#define DDR0_43                         0x2B
+#define DDR0_43_TWR_MASK                  0x07000000
+#define DDR0_43_TWR_ENCODE(n)               ((((unsigned long)(n))&0x7)<<24)
+#define DDR0_43_TWR_DECODE(n)               ((((unsigned long)(n))>>24)&0x7)
+#define DDR0_43_APREBIT_MASK              0x000F0000
+#define DDR0_43_APREBIT_ENCODE(n)           ((((unsigned long)(n))&0xF)<<16)
+#define DDR0_43_APREBIT_DECODE(n)           ((((unsigned long)(n))>>16)&0xF)
+#define DDR0_43_COLUMN_SIZE_MASK          0x00000700
+#define DDR0_43_COLUMN_SIZE_ENCODE(n)       ((((unsigned long)(n))&0x7)<<8)
+#define DDR0_43_COLUMN_SIZE_DECODE(n)       ((((unsigned long)(n))>>8)&0x7)
+#define DDR0_43_EIGHT_BANK_MODE_MASK      0x00000001
+#define DDR0_43_EIGHT_BANK_MODE_8_BANKS     0x00000001
+#define DDR0_43_EIGHT_BANK_MODE_4_BANKS     0x00000000
+#define DDR0_43_EIGHT_BANK_MODE_ENCODE(n)   ((((unsigned long)(n))&0x1)<<0)
+#define DDR0_43_EIGHT_BANK_MODE_DECODE(n)   ((((unsigned long)(n))>>0)&0x1)
+
+#define DDR0_44                         0x2C
+#define DDR0_44_TRCD_MASK                 0x000000FF
+#define DDR0_44_TRCD_ENCODE(n)              ((((unsigned long)(n))&0xFF)<<0)
+#define DDR0_44_TRCD_DECODE(n)              ((((unsigned long)(n))>>0)&0xFF)
+
+#endif /* _SPD_SDRAM_DENALI_H_ */
diff --git a/board/lwmon5/u-boot.lds b/board/lwmon5/u-boot.lds
new file mode 100644 (file)
index 0000000..a423f98
--- /dev/null
@@ -0,0 +1,145 @@
+/*
+ * (C) Copyright 2002
+ * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+OUTPUT_ARCH(powerpc)
+SEARCH_DIR(/lib); SEARCH_DIR(/usr/lib); SEARCH_DIR(/usr/local/lib); SEARCH_DIR(/usr/local/powerpc-any-elf/lib);
+/* Do we need any of these for elf?
+   __DYNAMIC = 0;    */
+SECTIONS
+{
+  .resetvec 0xFFFFFFFC :
+  {
+    *(.resetvec)
+  } = 0xffff
+
+  .bootpg 0xFFFFF000 :
+  {
+    cpu/ppc4xx/start.o (.bootpg)
+  } = 0xffff
+
+  /* Read-only sections, merged into text segment: */
+  . = + SIZEOF_HEADERS;
+  .interp : { *(.interp) }
+  .hash          : { *(.hash)          }
+  .dynsym        : { *(.dynsym)                }
+  .dynstr        : { *(.dynstr)                }
+  .rel.text      : { *(.rel.text)              }
+  .rela.text     : { *(.rela.text)     }
+  .rel.data      : { *(.rel.data)              }
+  .rela.data     : { *(.rela.data)     }
+  .rel.rodata    : { *(.rel.rodata)    }
+  .rela.rodata   : { *(.rela.rodata)   }
+  .rel.got       : { *(.rel.got)               }
+  .rela.got      : { *(.rela.got)              }
+  .rel.ctors     : { *(.rel.ctors)     }
+  .rela.ctors    : { *(.rela.ctors)    }
+  .rel.dtors     : { *(.rel.dtors)     }
+  .rela.dtors    : { *(.rela.dtors)    }
+  .rel.bss       : { *(.rel.bss)               }
+  .rela.bss      : { *(.rela.bss)              }
+  .rel.plt       : { *(.rel.plt)               }
+  .rela.plt      : { *(.rela.plt)              }
+  .init          : { *(.init)  }
+  .plt : { *(.plt) }
+  .text      :
+  {
+    /* WARNING - the following is hand-optimized to fit within */
+    /* the sector layout of our flash chips!   XXX FIXME XXX   */
+
+    cpu/ppc4xx/start.o (.text)
+
+    *(.text)
+    *(.fixup)
+    *(.got1)
+  }
+  _etext = .;
+  PROVIDE (etext = .);
+  .rodata    :
+  {
+    *(.rodata)
+    *(.rodata1)
+    *(.rodata.str1.4)
+  }
+  .fini      : { *(.fini)    } =0
+  .ctors     : { *(.ctors)   }
+  .dtors     : { *(.dtors)   }
+
+  /* Read-write section, merged into data segment: */
+  . = (. + 0x00FF) & 0xFFFFFF00;
+  _erotext = .;
+  PROVIDE (erotext = .);
+  .reloc   :
+  {
+    *(.got)
+    _GOT2_TABLE_ = .;
+    *(.got2)
+    _FIXUP_TABLE_ = .;
+    *(.fixup)
+  }
+  __got2_entries = (_FIXUP_TABLE_ - _GOT2_TABLE_) >>2;
+  __fixup_entries = (. - _FIXUP_TABLE_)>>2;
+
+  .data    :
+  {
+    *(.data)
+    *(.data1)
+    *(.sdata)
+    *(.sdata2)
+    *(.dynamic)
+    CONSTRUCTORS
+  }
+  _edata  =  .;
+  PROVIDE (edata = .);
+
+  . = .;
+  __u_boot_cmd_start = .;
+  .u_boot_cmd : { *(.u_boot_cmd) }
+  __u_boot_cmd_end = .;
+
+
+  . = .;
+  __start___ex_table = .;
+  __ex_table : { *(__ex_table) }
+  __stop___ex_table = .;
+
+  . = ALIGN(256);
+  __init_begin = .;
+  .text.init : { *(.text.init) }
+  .data.init : { *(.data.init) }
+  . = ALIGN(256);
+  __init_end = .;
+
+  __bss_start = .;
+  .bss       :
+  {
+   *(.sbss) *(.scommon)
+   *(.dynbss)
+   *(.bss)
+   *(COMMON)
+  }
+
+  ppcenv_assert = ASSERT(. < 0xFFFF8000, ".bss section too big, overlaps .ppcenv section. Please update your confguration: CFG_MONITOR_BASE, CFG_MONITOR_LEN and TEXT_BASE may need to be modified.");
+
+  _end = . ;
+  PROVIDE (end = .);
+}
index 58985b8..6eb5fe9 100644 (file)
 
 #include <common.h>
 #include <mpc5xxx.h>
-
+#include <miiphy.h>
 #if defined(CONFIG_OF_FLAT_TREE)
 #include <ft_build.h>
 #endif
 
+#if defined(CONFIG_STATUS_LED)
+#include <status_led.h>
+#endif /* CONFIG_STATUS_LED */
+
 /* Kollmorgen DPR initialization data */
 struct init_elem {
        unsigned long addr;
@@ -78,11 +82,27 @@ int board_early_init_r(void)
 }
 
 
+/*
+ * Additional PHY intialization. After being reset in mpc5xxx_fec_init_phy(),
+ * PHY goes into FX mode.  To take it out of the FX mode and switch into
+ * desired TX operation, one needs to clear the FX_SEL bit of Mode Control
+ * Register.
+ */
+void reset_phy(void)
+{
+       unsigned short mode_control;
+
+       miiphy_read("FEC ETHERNET", CONFIG_PHY_ADDR, 0x15, &mode_control);
+       miiphy_write("FEC ETHERNET", CONFIG_PHY_ADDR, 0x15,
+                       mode_control & 0xfffe);
+       return;
+}
+
 #ifndef CFG_RAMBOOT
 /*
  * Helper function to initialize SDRAM controller.
  */
-static void sdram_start (int hi_addr)
+static void sdram_start(int hi_addr)
 {
        long hi_addr_bit = hi_addr ? 0x01000000 : 0;
 
@@ -114,7 +134,7 @@ static void sdram_start (int hi_addr)
 /*
  * Initalize SDRAM - configure SDRAM controller, detect memory size.
  */
-long int initdram (int board_type)
+long int initdram(int board_type)
 {
        ulong dramsize = 0;
 #ifndef CFG_RAMBOOT
@@ -168,9 +188,10 @@ long int initdram (int board_type)
 }
 
 
-int checkboard (void)
+int checkboard(void)
 {
-       puts("Board: Promess Motion-PRO board\n");
+       uchar rev = *(vu_char *)CPLD_REV_REGISTER;
+       printf("Board: Promess Motion-PRO board (CPLD rev. 0x%02x)\n", rev);
        return 0;
 }
 
@@ -181,3 +202,29 @@ void ft_board_setup(void *blob, bd_t *bd)
        ft_cpu_setup(blob, bd);
 }
 #endif /* defined(CONFIG_OF_FLAT_TREE) && defined(CONFIG_OF_BOARD_SETUP) */
+
+
+#if defined(CONFIG_STATUS_LED)
+void __led_init(led_id_t regaddr, int state)
+{
+       *((vu_long *) regaddr) |= ENABLE_GPIO_OUT;
+
+       if (state == STATUS_LED_ON)
+               *((vu_long *) regaddr) |= LED_ON;
+       else
+               *((vu_long *) regaddr) &= ~LED_ON;
+}
+
+void __led_set(led_id_t regaddr, int state)
+{
+       if (state == STATUS_LED_ON)
+               *((vu_long *) regaddr) |= LED_ON;
+       else
+               *((vu_long *) regaddr) &= ~LED_ON;
+}
+
+void __led_toggle(led_id_t regaddr)
+{
+       *((vu_long *) regaddr) ^= LED_ON;
+}
+#endif /* CONFIG_STATUS_LED */
index 9625211..df56b31 100644 (file)
 
 include $(TOPDIR)/config.mk
 
+ifneq ($(OBJTREE),$(SRCTREE))
+$(shell mkdir -p $(obj)../freescale/common)
+endif
+
 LIB    = $(obj)lib$(BOARD).a
 
 COBJS  := $(BOARD).o sys_eeprom.o \
index 989a40b..f778dcb 100644 (file)
@@ -25,7 +25,7 @@
 # default CCSRBAR is at 0xff700000
 # assume U-Boot is less than 0.5MB
 #
-TEXT_BASE = 0xfff01000
+TEXT_BASE = 0xfff00000
 
 PLATFORM_CPPFLAGS += -DCONFIG_MPC86xx=1
 PLATFORM_CPPFLAGS += -DCONFIG_MPC8641=1 -maltivec -mabi=altivec -msoft-float
index 13c1acf..34b50e4 100644 (file)
@@ -1,7 +1,5 @@
 /*
- * (C) Copyright 2004, Freescale, Inc.
- * (C) Copyright 2002,2003, Motorola,Inc.
- * Jeff Brown
+ * Copyright 2006, 2007 Freescale Semiconductor, Inc.
  *
  * See file CREDITS for list of people who contributed to this
  * project.
  */
 
 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 0xFFF00100 :
-  {
-    *(.resetvec)
-  } = 0xffff
-
-  .bootpg 0xFFF70000 :
-  {
-    cpu/mpc86xx/start.o        (.bootpg)
-    board/mpc8641hpcn/init.o (.bootpg)
-  } = 0xffff
 
   /* Read-only sections, merged into text segment: */
-  . = + 1024;
   .interp : { *(.interp) }
   .hash          : { *(.hash)          }
   .dynsym        : { *(.dynsym)                }
@@ -66,7 +51,7 @@ SECTIONS
   .text      :
   {
     cpu/mpc86xx/start.o        (.text)
-    board/mpc8641hpcn/init.o (.text)
+    board/mpc8641hpcn/init.o (.bootpg)
     cpu/mpc86xx/traps.o (.text)
     cpu/mpc86xx/interrupts.o (.text)
     cpu/mpc86xx/cpu_init.o (.text)
@@ -88,6 +73,7 @@ SECTIONS
     *(.rodata)
     *(.rodata1)
     *(.rodata.str1.4)
+    *(.eh_frame)
   }
   .fini      : { *(.fini)    } =0
   .ctors     : { *(.ctors)   }
index 8858f0a..b73ab2a 100644 (file)
@@ -217,7 +217,7 @@ int testdram(void)
  *     certain pre-initialization actions.
  *
  ************************************************************************/
-#if defined(CONFIG_PCI) && defined(CFG_PCI_PRE_INIT)
+#if defined(CONFIG_PCI)
 int pci_pre_init(struct pci_controller *hose)
 {
        unsigned long addr;
@@ -258,7 +258,7 @@ int pci_pre_init(struct pci_controller *hose)
 
        return 1;
 }
-#endif                         /* defined(CONFIG_PCI) && defined(CFG_PCI_PRE_INIT) */
+#endif /* defined(CONFIG_PCI) */
 
 /*************************************************************************
  *  pci_target_init
index 5abc87d..b764499 100644 (file)
@@ -172,7 +172,7 @@ int testdram (void)
  *     certain pre-initialization actions.
  *
  ************************************************************************/
-#if defined(CONFIG_PCI) && defined(CFG_PCI_PRE_INIT)
+#if defined(CONFIG_PCI)
 int pci_pre_init(struct pci_controller * hose )
 {
        unsigned long strap;
@@ -192,7 +192,7 @@ int pci_pre_init(struct pci_controller * hose )
 
        return 1;
 }
-#endif /* defined(CONFIG_PCI) && defined(CFG_PCI_PRE_INIT) */
+#endif /* defined(CONFIG_PCI) */
 
 /*************************************************************************
  *  pci_target_init
index 2f28e9d..1a8aacb 100644 (file)
@@ -176,7 +176,7 @@ int misc_init_r (void)
  *     certain pre-initialization actions.
  *
  ************************************************************************/
-#if defined(CONFIG_PCI) && defined(CFG_PCI_PRE_INIT)
+#if defined(CONFIG_PCI)
 int pci_pre_init(struct pci_controller *hose)
 {
        unsigned long strap;
@@ -193,7 +193,7 @@ int pci_pre_init(struct pci_controller *hose)
 
        return 1;
 }
-#endif                         /* defined(CONFIG_PCI) && defined(CFG_PCI_PRE_INIT) */
+#endif /* defined(CONFIG_PCI) */
 
 /*************************************************************************
  *  pci_target_init
index 7816472..8a831fa 100644 (file)
@@ -313,7 +313,7 @@ long int fixed_sdram (void)
  *     certain pre-initialization actions.
  *
  ************************************************************************/
-#if defined(CONFIG_PCI) && defined(CFG_PCI_PRE_INIT)
+#if defined(CONFIG_PCI)
 int pci_pre_init(struct pci_controller * hose )
 {
        unsigned long strap;
@@ -330,7 +330,7 @@ int pci_pre_init(struct pci_controller * hose )
 
        return 1;
 }
-#endif /* defined(CONFIG_PCI) && defined(CFG_PCI_PRE_INIT) */
+#endif /* defined(CONFIG_PCI) */
 
 /*************************************************************************
  *  pci_target_init
diff --git a/board/siemens/SMN42/Makefile b/board/siemens/SMN42/Makefile
new file mode 100644 (file)
index 0000000..2c7b54b
--- /dev/null
@@ -0,0 +1,51 @@
+#
+# (C) Copyright 2007
+# 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    = $(obj)lib$(BOARD).a
+
+COBJS  := flash.o smn42.o
+SOBJTS := lowlevel_init.o
+
+SRCS   := $(SOBJTS:.o=.S) $(COBJS:.o=.c)
+OBJS   := $(addprefix $(obj),$(COBJS))
+SOBJS  := $(addprefix $(obj),$(SOBJTS))
+
+$(LIB):        $(obj).depend $(OBJS) $(SOBJS)
+       $(AR) crv $@ $(OBJS) $(SOBJS)
+
+clean:
+       rm -f $(SOBJS) $(OBJS)
+
+distclean:     clean
+       rm -f $(LIB) core *.bak $(obj).depend
+
+#########################################################################
+
+# defines $(obj).depend target
+include $(SRCTREE)/rules.mk
+
+sinclude $(obj).depend
+
+#########################################################################
diff --git a/board/siemens/SMN42/config.mk b/board/siemens/SMN42/config.mk
new file mode 100644 (file)
index 0000000..b28f418
--- /dev/null
@@ -0,0 +1,30 @@
+#
+# (C) Copyright 2000
+# Sysgo Real-Time Solutions, GmbH <www.elinos.com>
+# Marius Groeger <mgroeger@sysgo.de>
+#
+# (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
+#
+
+#address where u-boot will be relocated
+#TEXT_BASE = 0x0
+TEXT_BASE = 0x81500000
diff --git a/board/siemens/SMN42/flash.c b/board/siemens/SMN42/flash.c
new file mode 100755 (executable)
index 0000000..7d4977e
--- /dev/null
@@ -0,0 +1,475 @@
+/*
+ * (C) Copyright 2006 Embedded Artists AB <www.embeddedartists.com>
+ *
+ * (C) Copyright 2007 Gary Jennejohn garyj@denx.de
+ * Modified to use the routines in cpu/arm720t/lpc2292/flash.c.
+ * Heavily modified to support the SMN42 board from Siemens
+ *
+ * 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/byteorder.h>
+#include <asm/arch/hardware.h>
+
+static unsigned long flash_addr_table[CFG_MAX_FLASH_BANKS] = CFG_FLASH_BANKS_LIST;
+flash_info_t flash_info[CFG_MAX_FLASH_BANKS];
+
+extern int lpc2292_copy_buffer_to_flash(flash_info_t *, ulong);
+extern int lpc2292_flash_erase(flash_info_t *, int, int);
+extern int lpc2292_write_buff (flash_info_t *, uchar *, ulong, ulong);
+static unsigned long ext_flash_init(void);
+static int ext_flash_erase(flash_info_t *, int, int);
+static int ext_write_buff(flash_info_t *, uchar *, ulong, ulong);
+
+/*-----------------------------------------------------------------------
+ */
+
+ulong flash_init (void)
+{
+       int j, k;
+       ulong size = 0;
+       ulong flashbase = 0;
+
+       flash_info[0].flash_id = PHILIPS_LPC2292;
+       flash_info[0].size = 0x003E000; /* 256 - 8 KB */
+       flash_info[0].sector_count = 17;
+       memset (flash_info[0].protect, 0, 17);
+       flashbase = 0x00000000;
+       for (j = 0, k = 0; j < 8; j++, k++) {
+               flash_info[0].start[k] = flashbase;
+               flashbase += 0x00002000;
+       }
+       for (j = 0; j < 2; j++, k++) {
+               flash_info[0].start[k] = flashbase;
+               flashbase += 0x00010000;
+       }
+       for (j = 0; j < 7; j++, k++) {
+               flash_info[0].start[k] = flashbase;
+               flashbase += 0x00002000;
+       }
+       size += flash_info[0].size;
+
+       /* Protect monitor and environment sectors */
+       flash_protect (FLAG_PROTECT_SET,
+                0x0,
+                0x0 + monitor_flash_len - 1,
+                &flash_info[0]);
+
+       flash_protect (FLAG_PROTECT_SET,
+                CFG_ENV_ADDR,
+                CFG_ENV_ADDR + CFG_ENV_SIZE - 1,
+                &flash_info[0]);
+
+       size += ext_flash_init();
+
+       return size;
+}
+
+/*-----------------------------------------------------------------------
+ */
+void flash_print_info (flash_info_t * info)
+{
+       int i;
+       int erased = 0;
+       unsigned long j;
+       unsigned long count;
+       unsigned char *p;
+
+       switch (info->flash_id & FLASH_VENDMASK) {
+       case (PHILIPS_LPC2292 & FLASH_VENDMASK):
+               printf("Philips: ");
+               break;
+       case FLASH_MAN_AMD:
+               printf("AMD: ");
+               break;
+       default:
+               printf ("Unknown Vendor ");
+               break;
+       }
+
+       switch (info->flash_id & FLASH_TYPEMASK) {
+       case (PHILIPS_LPC2292 & FLASH_TYPEMASK):
+               printf("LPC2292 internal flash\n");
+               break;
+       case FLASH_S29GL128N:
+               printf ("S29GL128N (128 Mbit, uniform sector size)\n");
+               break;
+       default:
+               printf("Unknown Chip Type\n");
+               return;
+       }
+
+       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++) {
+               if ((i % 5) == 0) {
+                       printf ("\n   ");
+               }
+               if (i < (info->sector_count - 1)) {
+                       count = info->start[i+1] - info->start[i];
+               }
+               else {
+                       count = info->start[0] + info->size - info->start[i];
+               }
+               p = (unsigned char*)(info->start[i]);
+               erased = 1;
+               for (j = 0; j < count; j++) {
+                       if (*p != 0xFF) {
+                               erased = 0;
+                               break;
+                       }
+                       p++;
+               }
+               printf (" %08lX%s%s", info->start[i], info->protect[i] ? " RO" : "   ",
+                       erased ? " E" : "  ");
+       }
+       printf ("\n");
+}
+
+int flash_erase (flash_info_t * info, int s_first, int s_last)
+{
+       switch (info->flash_id & FLASH_TYPEMASK) {
+               case (PHILIPS_LPC2292 & FLASH_TYPEMASK):
+                       return lpc2292_flash_erase(info, s_first, s_last);
+               case FLASH_S29GL128N:
+                       return ext_flash_erase(info, s_first, s_last);
+               default:
+                       return ERR_PROTECTED;
+       }
+       return ERR_PROTECTED;
+}
+
+int write_buff (flash_info_t * info, uchar * src, ulong addr, ulong cnt)
+{
+       switch (info->flash_id & FLASH_TYPEMASK) {
+               case (PHILIPS_LPC2292 & FLASH_TYPEMASK):
+                       return lpc2292_write_buff(info, src, addr, cnt);
+               case FLASH_S29GL128N:
+                       return ext_write_buff(info, src, addr, cnt);
+               default:
+                       return ERR_PROG_ERROR;
+       }
+       return ERR_PROG_ERROR;
+}
+
+/*--------------------------------------------------------------------------
+ * From here on is code for the external S29GL128N taken from cam5200_flash.c
+ */
+
+#define CFG_FLASH_WORD_SIZE unsigned short
+
+static int wait_for_DQ7_32(flash_info_t * info, int sect)
+{
+       ulong start, now, last;
+       volatile CFG_FLASH_WORD_SIZE *addr =
+               (CFG_FLASH_WORD_SIZE *) (info->start[sect]);
+
+       start = get_timer(0);
+       last = start;
+       while ((addr[0] & (CFG_FLASH_WORD_SIZE) 0x00800080) !=
+                       (CFG_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 ext_flash_erase(flash_info_t * info, int s_first, int s_last)
+{
+       volatile CFG_FLASH_WORD_SIZE *addr = (CFG_FLASH_WORD_SIZE *) (info->start[0]);
+       volatile CFG_FLASH_WORD_SIZE *addr2;
+       int flag, prot, sect, l_sect, ret;
+
+       ret = 0;
+       if ((s_first < 0) || (s_first > s_last)) {
+               if (info->flash_id == FLASH_UNKNOWN)
+                       printf("- missing\n");
+               else
+                       printf("- no sectors to erase\n");
+               return 1;
+       }
+
+       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!", prot);
+
+       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 = (CFG_FLASH_WORD_SIZE *) (info->start[sect]);
+
+                       addr[CFG_FLASH_ADDR0] = (CFG_FLASH_WORD_SIZE) 0x00AA00AA;
+                       addr[CFG_FLASH_ADDR1] = (CFG_FLASH_WORD_SIZE) 0x00550055;
+                       addr[CFG_FLASH_ADDR0] = (CFG_FLASH_WORD_SIZE) 0x00800080;
+                       addr[CFG_FLASH_ADDR0] = (CFG_FLASH_WORD_SIZE) 0x00AA00AA;
+                       addr[CFG_FLASH_ADDR1] = (CFG_FLASH_WORD_SIZE) 0x00550055;
+                       addr2[0] = (CFG_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)!!
+                        */
+                       ret = wait_for_DQ7_32(info, sect);
+                       if (ret) {
+                               ret = ERR_PROTECTED;
+                               break;
+                       }
+               }
+       }
+
+       /* 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 = (CFG_FLASH_WORD_SIZE *) info->start[0];
+       addr[0] = (CFG_FLASH_WORD_SIZE) 0x00F000F0;     /* reset bank */
+
+       if (ret)
+               printf(" error\n");
+       else
+               printf(" done\n");
+       return ret;
+}
+
+static ulong flash_get_size(vu_long * addr, flash_info_t * info)
+{
+       short i;
+       CFG_FLASH_WORD_SIZE value;
+       ulong base = (ulong) addr;
+       volatile CFG_FLASH_WORD_SIZE *addr2 = (CFG_FLASH_WORD_SIZE *) addr;
+
+       /* Write auto select command: read Manufacturer ID */
+       addr2[CFG_FLASH_ADDR0] = (CFG_FLASH_WORD_SIZE) 0x00AA00AA;
+       addr2[CFG_FLASH_ADDR1] = (CFG_FLASH_WORD_SIZE) 0x00550055;
+       addr2[CFG_FLASH_ADDR0] = (CFG_FLASH_WORD_SIZE) 0x00900090;
+       udelay(1000);
+
+       value = addr2[0];
+
+       switch (value) {
+               case (CFG_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 (CFG_FLASH_WORD_SIZE)AMD_ID_MIRROR:
+                       value = addr2[14];
+                       switch(value) {
+                               case (CFG_FLASH_WORD_SIZE)AMD_ID_GL128N_2:
+                                       value = addr2[15];
+                                       if (value != (CFG_FLASH_WORD_SIZE)AMD_ID_GL128N_3) {
+                                               info->flash_id = FLASH_UNKNOWN;
+                                       } else {
+                                               info->flash_id += FLASH_S29GL128N;
+                                               info->sector_count = 128;
+                                               info->size = 0x01000000;
+                                       }
+                                       break;
+                               default:
+                                       info->flash_id = FLASH_UNKNOWN;
+                                       return(0);
+                       }
+                       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 * 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 */
+               addr2 = (volatile CFG_FLASH_WORD_SIZE *)(info->start[i]);
+
+               info->protect[i] = addr2[2] & 1;
+       }
+
+       /* issue bank reset to return to read mode */
+       addr2[0] = (CFG_FLASH_WORD_SIZE) 0x00F000F0;
+
+       return (info->size);
+}
+
+static unsigned long ext_flash_init(void)
+{
+       unsigned long total_b = 0;
+       unsigned long size_b[CFG_MAX_FLASH_BANKS];
+       int i;
+
+       /* Init: no FLASHes known */
+       for (i = 1; i < CFG_MAX_FLASH_BANKS; ++i) {
+               flash_info[i].flash_id = FLASH_UNKNOWN;
+               flash_info[i].sector_count = -1;
+               flash_info[i].size = 0;
+
+               /* call flash_get_size() to initialize sector address */
+               size_b[i] = flash_get_size((vu_long *) flash_addr_table[i],
+                               &flash_info[i]);
+
+               flash_info[i].size = size_b[i];
+
+               if (flash_info[i].flash_id == FLASH_UNKNOWN) {
+                       printf("## Unknown FLASH on Bank %d - Size = 0x%08lx = %ld MB\n",
+                                       i+1, size_b[i], size_b[i] << 20);
+                       flash_info[i].sector_count = -1;
+                       flash_info[i].size = 0;
+               }
+
+               total_b += flash_info[i].size;
+       }
+
+       return total_b;
+}
+
+static int write_word(flash_info_t * info, ulong dest, ushort data)
+{
+       volatile CFG_FLASH_WORD_SIZE *addr2 = (CFG_FLASH_WORD_SIZE *) (info->start[0]);
+       volatile CFG_FLASH_WORD_SIZE *dest2 = (CFG_FLASH_WORD_SIZE *) dest;
+       volatile CFG_FLASH_WORD_SIZE *data2 = (CFG_FLASH_WORD_SIZE *) &data;
+       ulong start;
+       int flag;
+
+       /* Check if Flash is (sufficiently) erased */
+       if ((*dest2 & *data2) != *data2) {
+               return (2);
+       }
+
+       /* Disable interrupts which might cause a timeout here */
+       flag = disable_interrupts();
+
+       addr2[CFG_FLASH_ADDR0] = (CFG_FLASH_WORD_SIZE) 0x00AA00AA;
+       addr2[CFG_FLASH_ADDR1] = (CFG_FLASH_WORD_SIZE) 0x00550055;
+       addr2[CFG_FLASH_ADDR0] = (CFG_FLASH_WORD_SIZE) 0x00A000A0;
+       *dest2 = *data2;
+
+       /* re-enable interrupts if necessary */
+       if (flag)
+               enable_interrupts();
+
+       /* data polling for D7 */
+       start = get_timer(0);
+       while ((*dest2 & (CFG_FLASH_WORD_SIZE) 0x00800080) !=
+                       (*data2 & (CFG_FLASH_WORD_SIZE) 0x00800080)) {
+
+               if (get_timer(start) > CFG_FLASH_WRITE_TOUT) {
+                       printf("WRITE_TOUT\n");
+                       return (1);
+               }
+       }
+       return (0);
+}
+
+/*-----------------------------------------------------------------------
+ * This is taken from the original flash.c for the LPC2292 SODIMM board
+ * and modified to suit.
+ */
+
+int ext_write_buff(flash_info_t * info, uchar * src, ulong addr, ulong cnt)
+{
+       ushort tmp;
+       ulong i;
+       uchar* src_org;
+       uchar* dst_org;
+       ulong cnt_org = cnt;
+       int ret = ERR_OK;
+
+       src_org = src;
+       dst_org = (uchar*)addr;
+
+       if (addr & 1) {         /* if odd address */
+               tmp = *((uchar*)(addr - 1)); /* little endian */
+               tmp |= (*src << 8);
+               if (write_word(info, addr - 1, tmp))
+                       return ERR_PROG_ERROR;
+               addr += 1;
+               cnt -= 1;
+               src++;
+       }
+       while (cnt > 1) {
+               tmp = ((*(src+1)) << 8) + (*src); /* little endian */
+               if (write_word(info, addr, tmp))
+                       return ERR_PROG_ERROR;
+               addr += 2;
+               src += 2;
+               cnt -= 2;
+       }
+       if (cnt > 0) {
+               tmp = (*((uchar*)(addr + 1))) << 8;
+               tmp |= *src;
+               if (write_word(info, addr, tmp))
+                       return ERR_PROG_ERROR;
+       }
+
+       for (i = 0; i < cnt_org; i++) {
+               if (*dst_org != *src_org) {
+                       printf("Write failed. Byte %lX differs\n", i);
+                       ret = ERR_PROG_ERROR;
+                       break;
+               }
+               dst_org++;
+               src_org++;
+       }
+
+       return ret;
+}
diff --git a/board/siemens/SMN42/lowlevel_init.S b/board/siemens/SMN42/lowlevel_init.S
new file mode 100644 (file)
index 0000000..11abb63
--- /dev/null
@@ -0,0 +1,123 @@
+/*
+ * (C) Copyright 2006 Embedded Artists AB <www.embeddedartists.com>
+ *
+ * Slight modifications made to support the SMN42 board from Siemens.
+ * 2007 Gary Jennejohn garyj@denx.de
+ *
+ * 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/hardware.h>
+
+/* some parameters for the board */
+/* setting up the CPU-internal memory */
+#define        SRAM_START      0x40000000
+#define        SRAM_SIZE       0x00004000
+#define   BCFG0_VALUE 0x1000ffef
+#define   BCFG1_VALUE 0x10005D2F
+#define   BCFG2_VALUE 0x10005D2F
+/*
+ * For P0.18 to set ZZ to the SRAMs to 1. Also set P0.2 (SCL) and P0.3 (SDA)
+ * for the bit-banger I2C driver correctly.
+ */
+#define   IO0_VALUE   0x4000C
+
+_TEXT_BASE:
+       .word   TEXT_BASE
+MEMMAP_ADR:
+       .word   MEMMAP
+BCFG0_ADR:
+       .word BCFG0
+_BCFG0_VALUE:
+       .word BCFG0_VALUE
+BCFG1_ADR:
+       .word   BCFG1
+_BCFG1_VALUE:
+       .word   BCFG1_VALUE
+BCFG2_ADR:
+       .word   BCFG2
+_BCFG2_VALUE:
+       .word   BCFG2_VALUE
+IO0DIR_ADR:
+       .word   IO0DIR
+_IO0DIR_VALUE:
+       .word   IO0_VALUE
+IO0SET_ADR:
+       .word   IO0SET
+_IO0SET_VALUE:
+       .word   IO0_VALUE
+PINSEL2_ADR:
+       .word   PINSEL2
+PINSEL2_MASK:
+       .word   0x00000000
+PINSEL2_VALUE:
+       .word   0x0F804914
+
+.extern _start
+
+.globl lowlevel_init
+lowlevel_init:
+       /* set up memory control register for bank 0 */
+       ldr r0, _BCFG0_VALUE
+       ldr r1, BCFG0_ADR
+       str r0, [r1]
+
+       /* set up memory control register for bank 1 */
+       ldr     r0, _BCFG1_VALUE
+       ldr     r1, BCFG1_ADR
+       str     r0, [r1]
+
+       /* set up memory control register for bank 2 */
+       ldr     r0, _BCFG2_VALUE
+       ldr     r1, BCFG2_ADR
+       str     r0, [r1]
+
+       /* set IO0DIR to make P0.2, P0.3  and P0.18 outputs */
+       ldr     r0, _IO0DIR_VALUE
+       ldr     r1, IO0DIR_ADR
+       str     r0, [r1]
+
+       /* set P0.18 to 1 */
+       ldr     r0, _IO0SET_VALUE
+       ldr     r1, IO0SET_ADR
+       str     r0, [r1]
+
+       /* set up PINSEL2 for bus-pins */
+       ldr     r0, PINSEL2_ADR
+       ldr     r1, [r0]
+       ldr     r2, PINSEL2_MASK
+       ldr     r3, PINSEL2_VALUE
+       and     r1, r1, r2
+       orr     r1, r1, r3
+       str     r1, [r0]
+
+       /* move vectors to beginning of SRAM */
+       mov     r2, #SRAM_START
+       mov     r0, #0 /*_start*/
+       ldmneia r0!, {r3-r10}
+       stmneia r2!, {r3-r10}
+       ldmneia r0, {r3-r9}
+       stmneia r2, {r3-r9}
+
+       /* Set-up MEMMAP register, so vectors are taken from SRAM */
+       ldr     r0, MEMMAP_ADR
+       mov     r1, #0x02       /* vectors re-mapped to static RAM */
+       str     r1, [r0]
+
+       /* everything is fine now */
+       mov     pc, lr
diff --git a/board/siemens/SMN42/smn42.c b/board/siemens/SMN42/smn42.c
new file mode 100644 (file)
index 0000000..cbfc76c
--- /dev/null
@@ -0,0 +1,62 @@
+/*
+ * (C) Copyright 2002
+ * Sysgo Real-Time Solutions, GmbH <www.elinos.com>
+ * Marius Groeger <mgroeger@sysgo.de>
+ *
+ * (C) Copyright 2005 Rowel Atienza <rowel@diwalabs.com>
+ * Armadillo board HT1070
+ *
+ * (C) Copyright 2007 Gary Jennejohn <garyj@denx.de>
+ * Siemens board SMN42
+ *
+ * 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 <clps7111.h>
+
+/* ------------------------------------------------------------------------- */
+
+
+/*
+ * Miscellaneous platform dependent initialisations
+ */
+
+int board_init (void)
+{
+       DECLARE_GLOBAL_DATA_PTR;
+
+       /* arch number MACH_TYPE_ARMADILLO - not official*/
+       gd->bd->bi_arch_number = 83;
+
+       /* location of boot parameters */
+       gd->bd->bi_boot_params = PHYS_SDRAM_1 + 0x00000100;
+
+       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);
+}
diff --git a/board/siemens/SMN42/u-boot.lds b/board/siemens/SMN42/u-boot.lds
new file mode 100644 (file)
index 0000000..64d946c
--- /dev/null
@@ -0,0 +1,55 @@
+/*
+ * (C) Copyright 2000
+ * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm")
+OUTPUT_ARCH(arm)
+ENTRY(_start)
+SECTIONS
+{
+       . = 0x00000000;
+
+       . = ALIGN(4);
+       .text      :
+       {
+         cpu/arm720t/start.o   (.text)
+         *(.text)
+       }
+
+       . = ALIGN(4);
+       .rodata : { *(.rodata) }
+
+       . = ALIGN(4);
+       .data : { *(.data) }
+
+       . = ALIGN(4);
+       .got : { *(.got) }
+
+       __u_boot_cmd_start = .;
+       .u_boot_cmd : { *(.u_boot_cmd) }
+       __u_boot_cmd_end = .;
+
+       . = ALIGN(4);
+       __bss_start = .;
+       .bss : { *(.bss) }
+       _end = .;
+}
index a5de806..a7959f3 100644 (file)
 #define TREFMD 0x0     /* CBR(CAS before RAS)/auto refresh */
 #define Trp    0x0     /* 2 clk */
 #define Trc    0x3     /* 7 clk */
-#define Tchr   0x2     /* 3 clk */
+#define Tchr   0x2     /* 3 clk */
 
 #define REFCNT 1113    /* period=15.6 us, HCLK=60Mhz, (2048+1-15.6*66) */
 
index 30f42c5..5f4fc74 100644 (file)
 # MA 02111-1307 USA
 #
 
-#
 # default CCARBAR is at 0xff700000
 # assume U-Boot is less than 0.5MB
 # U-Boot is less than 256K, so push
 # it further up into the flash
 #
-TEXT_BASE = 0xfffC0000
+TEXT_BASE = 0xFFFC0000
 
 PLATFORM_CPPFLAGS += -DCONFIG_MPC85xx=1
 PLATFORM_CPPFLAGS += -DCONFIG_E500=1
index a4322b6..cf97603 100644 (file)
 #include <pci.h>
 #include <asm/processor.h>
 
+#if defined(CONFIG_OF_FLAT_TREE)
+#include <ft_build.h>
+#endif
+
 #ifdef CONFIG_VIDEO_SM501
 #include <sm501.h>
 #endif
@@ -775,3 +779,10 @@ int board_get_height (void)
 }
 
 #endif /* CONFIG_VIDEO_SM501 */
+
+#if defined(CONFIG_OF_FLAT_TREE) && defined(CONFIG_OF_BOARD_SETUP)
+void ft_board_setup(void *blob, bd_t *bd)
+{
+       ft_cpu_setup(blob, bd);
+}
+#endif /* defined(CONFIG_OF_FLAT_TREE) && defined(CONFIG_OF_BOARD_SETUP) */
index a569b53..8411cf0 100644 (file)
@@ -209,7 +209,7 @@ long int fixed_sdram (void)
  *     certain pre-initialization actions.
  *
  ************************************************************************/
-#if defined(CONFIG_PCI) && defined(CFG_PCI_PRE_INIT)
+#if defined(CONFIG_PCI)
 int pci_pre_init(struct pci_controller * hose )
 {
        unsigned long strap;
@@ -227,7 +227,7 @@ int pci_pre_init(struct pci_controller * hose )
 #endif
        return 1;
 }
-#endif /* defined(CONFIG_PCI) && defined(CFG_PCI_PRE_INIT) */
+#endif /* defined(CONFIG_PCI) */
 
 /*************************************************************************
  *  pci_target_init
index cb1c5bb..a34ab79 100644 (file)
@@ -690,7 +690,7 @@ U_BOOT_CMD(
 );
 
 U_BOOT_CMD(
-       erase,   3,   1,  do_flerase,
+       erase,   3,   0,  do_flerase,
        "erase   - erase FLASH memory\n",
        "start end\n"
        "    - erase FLASH from addr 'start' to addr 'end'\n"
@@ -704,7 +704,7 @@ U_BOOT_CMD(
 );
 
 U_BOOT_CMD(
-       protect,  4,  1,   do_protect,
+       protect,  4,  0,   do_protect,
        "protect - enable or disable FLASH write protection\n",
        "on  start end\n"
        "    - protect FLASH from addr 'start' to addr 'end'\n"
index ce99a41..e308474 100644 (file)
@@ -514,11 +514,11 @@ void ide_init (void)
        unsigned char c;
        int i, bus;
 #if defined(CONFIG_AMIGAONEG3SE) || defined(CONFIG_SC3)
-       unsigned int ata_reset_time;
+       unsigned int ata_reset_time = ATA_RESET_TIME;
+       char *s;
 #endif
 #ifdef CONFIG_AMIGAONEG3SE
        unsigned int max_bus_scan;
-       char *s;
 #endif
 #ifdef CONFIG_IDE_8xx_PCCARD
        extern int pcmcia_on (void);
index 042a403..fba8bd8 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * (C) Copyright 2002
+ * (C) Copyright 2002-2007
  * Detlev Zundel, DENX Software Engineering, dzu@denx.de.
  *
  * Code used from linux/kernel/printk.c
@@ -60,45 +60,40 @@ static char buf[1024];
 /* This combination will not print messages with the default loglevel */
 static unsigned console_loglevel = 3;
 static unsigned default_message_loglevel = 4;
-static unsigned char *log_buf = NULL;
-static unsigned long *ext_log_size;
-static unsigned long *ext_log_start;
-static unsigned long *ext_logged_chars;
-#define log_size (*ext_log_size)
-#define log_start (*ext_log_start)
-#define logged_chars (*ext_logged_chars)
+static unsigned log_version = 1;
+static logbuff_t *log;
 
-/* Forced by code, eh! */
-#define LOGBUFF_MAGIC 0xc0de4ced
-
-/* The mapping used here has to be the same as in setup_ext_logbuff ()
-   in linux/kernel/printk */
 void logbuff_init_ptrs (void)
 {
-       unsigned long *ext_tag;
-       unsigned long post_word;
+       unsigned long tag, post_word;
        char *s;
 
-       log_buf = (unsigned char *)(gd->bd->bi_memsize-LOGBUFF_LEN);
-       ext_tag = (unsigned long *)(log_buf)-4;
-       ext_log_start = (unsigned long *)(log_buf)-3;
-       ext_log_size = (unsigned long *)(log_buf)-2;
-       ext_logged_chars = (unsigned long *)(log_buf)-1;
+       log = (logbuff_t *)(gd->bd->bi_memsize-LOGBUFF_LEN) - 1;
+
+       /* Set up log version */
+       if ((s = getenv ("logversion")) != NULL)
+               log_version = (int)simple_strtoul (s, NULL, 10);
+
+       if (log_version == 2)
+               tag = log->v2.tag;
+       else
+               tag = log->v1.tag;
        post_word = post_word_load();
 #ifdef CONFIG_POST
        /* The post routines have setup the word so we can simply test it */
-       if (post_word_load () & POST_COLDBOOT) {
-               logged_chars = log_size = log_start = 0;
-               *ext_tag = LOGBUFF_MAGIC;
-       }
+       if (tag != LOGBUFF_MAGIC || (post_word & POST_COLDBOOT)) {
+               logbuff_reset ();
+       }
 #else
        /* No post routines, so we do our own checking                    */
-       if (post_word != LOGBUFF_MAGIC) {
-               logged_chars = log_size = log_start = 0;
+       if (tag != LOGBUFF_MAGIC || post_word != LOGBUFF_MAGIC) {
+               logbuff_reset ();
                post_word_store (LOGBUFF_MAGIC);
-               *ext_tag = LOGBUFF_MAGIC;
-       }
+       }
 #endif
+       if (log_version == 2 && (long)log->v2.start > (long)log->v2.con)
+               log->v2.start = log->v2.con;
+
        /* Initialize default loglevel if present */
        if ((s = getenv ("loglevel")) != NULL)
                console_loglevel = (int)simple_strtoul (s, NULL, 10);
@@ -106,6 +101,15 @@ void logbuff_init_ptrs (void)
        gd->post_log_word |= LOGBUFF_INITIALIZED;
 }
 
+void logbuff_reset (void)
+{
+       memset (log, 0, sizeof (logbuff_t));
+       if (log_version == 2)
+               log->v2.tag = LOGBUFF_MAGIC;
+       else
+               log->v1.tag = LOGBUFF_MAGIC;
+}
+
 int drv_logbuff_init (void)
 {
        device_t logdev;
@@ -162,7 +166,7 @@ void logbuff_log(char *msg)
 int do_log (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
 {
        char *s;
-       unsigned long i;
+       unsigned long i, start, size;
 
        if (strcmp(argv[1],"append") == 0) {
                /* Log concatenation of all arguments separated by spaces */
@@ -177,21 +181,34 @@ int do_log (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
 
        case 2:
                if (strcmp(argv[1],"show") == 0) {
-                       for (i=0; i < (log_size&LOGBUFF_MASK); i++) {
-                               s = (char *)log_buf+((log_start+i)&LOGBUFF_MASK);
+                       if (log_version == 2) {
+                               start = log->v2.start;
+                               size = log->v2.end - log->v2.start;
+                       }
+                       else {
+                               start = log->v1.start;
+                               size = log->v1.size;
+                       }
+                       for (i=0; i < (size&LOGBUFF_MASK); i++) {
+                               s = (char *)log->buf+((start+i)&LOGBUFF_MASK);
                                putc (*s);
                        }
                        return 0;
                } else if (strcmp(argv[1],"reset") == 0) {
-                       log_start    = 0;
-                       log_size     = 0;
-                       logged_chars = 0;
+                       logbuff_reset ();
                        return 0;
                } else if (strcmp(argv[1],"info") == 0) {
-                       printf ("Logbuffer   at  %08lx\n", (unsigned long)log_buf);
-                       printf ("log_start    =  %08lx\n", log_start);
-                       printf ("log_size     =  %08lx\n", log_size);
-                       printf ("logged_chars =  %08lx\n", logged_chars);
+                       printf ("Logbuffer   at  %08lx\n", (unsigned long)log->buf);
+                       if (log_version == 2) {
+                               printf ("log_start    =  %08lx\n", log->v2.start);
+                               printf ("log_end      =  %08lx\n", log->v2.end);
+                               printf ("logged_chars =  %08lx\n", log->v2.chars);
+                       }
+                       else {
+                               printf ("log_start    =  %08lx\n", log->v1.start);
+                               printf ("log_size     =  %08lx\n", log->v1.size);
+                               printf ("logged_chars =  %08lx\n", log->v1.chars);
+                       }
                        return 0;
                }
                printf ("Usage:\n%s\n", cmdtp->usage);
@@ -202,7 +219,7 @@ int do_log (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
                return 1;
        }
 }
-#if defined(CONFIG_LOGBUFFER)
+
 U_BOOT_CMD(
        log,     255,   1,      do_log,
        "log     - manipulate logbuffer\n",
@@ -211,7 +228,7 @@ U_BOOT_CMD(
        "log show   - show contents\n"
        "log append <msg> - append <msg> to the logbuffer\n"
 );
-#endif /* CONFIG_LOGBUFFER */
+
 static int logbuff_printk(const char *line)
 {
        int i;
@@ -241,13 +258,22 @@ static int logbuff_printk(const char *line)
                }
                line_feed = 0;
                for (; p < buf_end; p++) {
-                       log_buf[(log_start+log_size) & LOGBUFF_MASK] = *p;
-                       if (log_size < LOGBUFF_LEN)
-                               log_size++;
-                       else
-                               log_start++;
-
-                       logged_chars++;
+                       if (log_version == 2) {
+                               log->buf[log->v2.end & LOGBUFF_MASK] = *p;
+                               log->v2.end++;
+                               if (log->v2.end - log->v2.start > LOGBUFF_LEN)
+                                       log->v2.start++;
+                               log->v2.chars++;
+                       }
+                       else {
+                               log->buf[(log->v1.start + log->v1.size) &
+                                        LOGBUFF_MASK] = *p;
+                               if (log->v1.size < LOGBUFF_LEN)
+                                       log->v1.size++;
+                               else
+                                       log->v1.start++;
+                               log->v1.chars++;
+                       }
                        if (*p == '\n') {
                                line_feed = 1;
                                break;
index 67ee9e8..a99222d 100644 (file)
@@ -63,7 +63,7 @@ U_BOOT_CMD(
 #endif  /* CONFIG_COMMANDS & CFG_CMD_IRQ */
 
 U_BOOT_CMD(
-       sleep ,    2,    2,     do_sleep,
+       sleep ,    2,    1,     do_sleep,
        "sleep   - delay execution for some time\n",
        "N\n"
        "    - delay execution for N seconds (N is _decimal_ !!!)\n"
index 2eb5b26..b1a594f 100644 (file)
@@ -87,7 +87,7 @@ int do_pinit (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
 }
 
 U_BOOT_CMD(
-       pinit,  2,      1,      do_pinit,
+       pinit,  2,      0,      do_pinit,
        "pinit   - PCMCIA sub-system\n",
        "on  - power on PCMCIA socket\n"
                        "pinit off - power off PCMCIA socket\n"
index f41d95c..a00ebc1 100644 (file)
@@ -962,7 +962,7 @@ int readline (const char *const prompt)
                        n = 0;
                        continue;
 
-               case 0x17:                              /* ^W - erase word      */
+               case 0x17:                              /* ^W - erase word      */
                        p=delete_char(console_buffer, p, &col, &n, plen);
                        while ((n > 0) && (*p != ' ')) {
                                p=delete_char(console_buffer, p, &col, &n, plen);
@@ -1191,6 +1191,8 @@ static void process_macros (const char *input, char *output)
 
        if (outputcnt)
                *output = 0;
+       else
+               *(output - 1) = 0;
 
 #ifdef DEBUG_PARSER
        printf ("[PROCESS_MACROS] OUTPUT len %d: \"%s\"\n",
@@ -1334,7 +1336,7 @@ int run_command (const char *cmd, int flag)
 
                /* Did the user stop this? */
                if (had_ctrlc ())
-                       return 0;       /* if stopped then not repeatable */
+                       return -1;      /* if stopped then not repeatable */
        }
 
        return rc ? rc : repeatable;
index edad51b..0f6e3a9 100644 (file)
@@ -36,6 +36,9 @@
 #ifdef CONFIG_IXP425                   /* only valid for IXP425 */
 #include <asm/arch/ixp425.h>
 #endif
+#ifdef CONFIG_LPC2292
+#include <asm/arch/hardware.h>
+#endif
 #include <i2c.h>
 
 #if defined(CONFIG_SOFT_I2C)
index 1143038..b5834b9 100644 (file)
@@ -125,7 +125,7 @@ _start_of_vectors:
 /* Alignment exception. */
        . = 0x600
 Alignment:
-       EXCEPTION_PROLOG
+       EXCEPTION_PROLOG(SRR0, SRR1)
        mfspr   r4,DAR
        stw     r4,_DAR(r21)
        mfspr   r5,DSISR
@@ -143,7 +143,7 @@ Alignment:
 /* Program check exception */
        . = 0x700
 ProgramCheck:
-       EXCEPTION_PROLOG
+       EXCEPTION_PROLOG(SRR0, SRR1)
        addi    r3,r1,STACK_FRAME_OVERHEAD
        li      r20,MSR_KERNEL
        rlwimi  r20,r23,0,16,16         /* copy EE bit from saved MSR */
diff --git a/cpu/arm720t/lpc2292/Makefile b/cpu/arm720t/lpc2292/Makefile
new file mode 100644 (file)
index 0000000..240f1e3
--- /dev/null
@@ -0,0 +1,50 @@
+#
+# (C) Copyright 2000-2007
+# 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    = $(obj)lib$(SOC).a
+
+COBJS  = flash.o mmc.o mmc_hw.o spi.o
+SOBJS  = $(obj)iap_entry.o
+
+SRCS   := $(COBJS:.o=.c)
+OBJS   := $(addprefix $(obj),$(COBJS))
+
+all:   $(obj).depend $(LIB)
+
+$(LIB):        $(OBJS) $(SOBJS)
+       $(AR) $(ARFLAGS) $@ $(OBJS) $(SOBJS)
+
+# this MUST be compiled as thumb code!
+$(SOBJS):
+       $(CC) $(AFLAGS) -march=armv4t -c -o $(SOBJS) iap_entry.S
+
+#########################################################################
+
+# defines $(obj).depend target
+include $(SRCTREE)/rules.mk
+
+sinclude $(obj).depend
+
+#########################################################################
diff --git a/cpu/arm720t/lpc2292/flash.c b/cpu/arm720t/lpc2292/flash.c
new file mode 100644 (file)
index 0000000..e5c8697
--- /dev/null
@@ -0,0 +1,249 @@
+/*
+ * (C) Copyright 2006 Embedded Artists AB <www.embeddedartists.com>
+ *
+ * Modified to remove all but the IAP-command related code by
+ * Gary Jennejohn <garyj@denx.de>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+#include <common.h>
+#include <asm/arch/hardware.h>
+
+/* IAP commands use 32 bytes at the top of CPU internal sram, we
+   use 512 bytes below that */
+#define COPY_BUFFER_LOCATION 0x40003de0
+
+#define IAP_LOCATION 0x7ffffff1
+#define IAP_CMD_PREPARE 50
+#define IAP_CMD_COPY 51
+#define IAP_CMD_ERASE 52
+#define IAP_CMD_CHECK 53
+#define IAP_CMD_ID 54
+#define IAP_CMD_VERSION 55
+#define IAP_CMD_COMPARE 56
+
+#define IAP_RET_CMD_SUCCESS 0
+
+static unsigned long command[5];
+static unsigned long result[2];
+
+extern void iap_entry(unsigned long * command, unsigned long * result);
+
+/*-----------------------------------------------------------------------
+ *
+ */
+static int get_flash_sector(flash_info_t * info, ulong flash_addr)
+{
+       int i;
+
+       for(i = 1; i < (info->sector_count); i++) {
+               if (flash_addr < (info->start[i]))
+                       break;
+       }
+
+       return (i-1);
+}
+
+/*-----------------------------------------------------------------------
+ * This function assumes that flash_addr is aligned on 512 bytes boundary
+ * in flash. This function also assumes that prepare have been called
+ * for the sector in question.
+ */
+int lpc2292_copy_buffer_to_flash(flash_info_t * info, ulong flash_addr)
+{
+       int first_sector;
+       int last_sector;
+
+       first_sector = get_flash_sector(info, flash_addr);
+       last_sector = get_flash_sector(info, flash_addr + 512 - 1);
+
+       /* prepare sectors for write */
+       command[0] = IAP_CMD_PREPARE;
+       command[1] = first_sector;
+       command[2] = last_sector;
+       iap_entry(command, result);
+       if (result[0] != IAP_RET_CMD_SUCCESS) {
+               printf("IAP prepare failed\n");
+               return ERR_PROG_ERROR;
+       }
+
+       command[0] = IAP_CMD_COPY;
+       command[1] = flash_addr;
+       command[2] = COPY_BUFFER_LOCATION;
+       command[3] = 512;
+       command[4] = CFG_SYS_CLK_FREQ >> 10;
+       iap_entry(command, result);
+       if (result[0] != IAP_RET_CMD_SUCCESS) {
+               printf("IAP copy failed\n");
+               return 1;
+       }
+
+       return 0;
+}
+
+/*-----------------------------------------------------------------------
+ */
+
+int lpc2292_flash_erase (flash_info_t * info, int s_first, int s_last)
+{
+       int flag;
+       int prot;
+       int sect;
+
+       prot = 0;
+       for (sect = s_first; sect <= s_last; ++sect) {
+               if (info->protect[sect]) {
+                       prot++;
+               }
+       }
+       if (prot)
+               return ERR_PROTECTED;
+
+
+       flag = disable_interrupts();
+
+       printf ("Erasing %d sectors starting at sector %2d.\n"
+       "This make take some time ... ",
+       s_last - s_first + 1, s_first);
+
+       command[0] = IAP_CMD_PREPARE;
+       command[1] = s_first;
+       command[2] = s_last;
+       iap_entry(command, result);
+       if (result[0] != IAP_RET_CMD_SUCCESS) {
+               printf("IAP prepare failed\n");
+               return ERR_PROTECTED;
+       }
+
+       command[0] = IAP_CMD_ERASE;
+       command[1] = s_first;
+       command[2] = s_last;
+       command[3] = CFG_SYS_CLK_FREQ >> 10;
+       iap_entry(command, result);
+       if (result[0] != IAP_RET_CMD_SUCCESS) {
+               printf("IAP erase failed\n");
+               return ERR_PROTECTED;
+       }
+
+       if (flag)
+               enable_interrupts();
+
+       return ERR_OK;
+}
+
+int lpc2292_write_buff (flash_info_t * info, uchar * src, ulong addr,
+                       ulong cnt)
+{
+       int first_copy_size;
+       int last_copy_size;
+       int first_block;
+       int last_block;
+       int nbr_mid_blocks;
+       uchar memmap_value;
+       ulong i;
+       uchar* src_org;
+       uchar* dst_org;
+       int ret = ERR_OK;
+
+       src_org = src;
+       dst_org = (uchar*)addr;
+
+       first_block = addr / 512;
+       last_block = (addr + cnt) / 512;
+       nbr_mid_blocks = last_block - first_block - 1;
+
+       first_copy_size = 512 - (addr % 512);
+       last_copy_size = (addr + cnt) % 512;
+
+       debug("\ncopy first block: (1) %lX -> %lX 0x200 bytes, "
+               "(2) %lX -> %lX 0x%X bytes, (3) %lX -> %lX 0x200 bytes\n",
+       (ulong)(first_block * 512),
+       (ulong)COPY_BUFFER_LOCATION,
+       (ulong)src,
+       (ulong)(COPY_BUFFER_LOCATION + 512 - first_copy_size),
+       first_copy_size,
+       (ulong)COPY_BUFFER_LOCATION,
+       (ulong)(first_block * 512));
+
+       /* copy first block */
+       memcpy((void*)COPY_BUFFER_LOCATION,
+               (void*)(first_block * 512), 512);
+       memcpy((void*)(COPY_BUFFER_LOCATION + 512 - first_copy_size),
+               src, first_copy_size);
+       lpc2292_copy_buffer_to_flash(info, first_block * 512);
+       src += first_copy_size;
+       addr += first_copy_size;
+
+       /* copy middle blocks */
+       for (i = 0; i < nbr_mid_blocks; i++) {
+               debug("copy middle block: %lX -> %lX 512 bytes, "
+               "%lX -> %lX 512 bytes\n",
+               (ulong)src,
+               (ulong)COPY_BUFFER_LOCATION,
+               (ulong)COPY_BUFFER_LOCATION,
+               (ulong)addr);
+
+               memcpy((void*)COPY_BUFFER_LOCATION, src, 512);
+               lpc2292_copy_buffer_to_flash(info, addr);
+               src += 512;
+               addr += 512;
+       }
+
+
+       if (last_copy_size > 0) {
+               debug("copy last block: (1) %lX -> %lX 0x200 bytes, "
+               "(2) %lX -> %lX 0x%X bytes, (3) %lX -> %lX x200 bytes\n",
+               (ulong)(last_block * 512),
+               (ulong)COPY_BUFFER_LOCATION,
+               (ulong)src,
+               (ulong)(COPY_BUFFER_LOCATION),
+               last_copy_size,
+               (ulong)COPY_BUFFER_LOCATION,
+               (ulong)addr);
+
+               /* copy last block */
+               memcpy((void*)COPY_BUFFER_LOCATION,
+                       (void*)(last_block * 512), 512);
+               memcpy((void*)COPY_BUFFER_LOCATION,
+                       src, last_copy_size);
+               lpc2292_copy_buffer_to_flash(info, addr);
+       }
+
+       /* verify write */
+       memmap_value = GET8(MEMMAP);
+
+       disable_interrupts();
+
+       PUT8(MEMMAP, 01);               /* we must make sure that initial 64
+                                                          bytes are taken from flash when we
+                                                          do the compare */
+
+       for (i = 0; i < cnt; i++) {
+               if (*dst_org != *src_org){
+                       printf("Write failed. Byte %lX differs\n", i);
+                       ret = ERR_PROG_ERROR;
+                       break;
+               }
+               dst_org++;
+               src_org++;
+       }
+
+       PUT8(MEMMAP, memmap_value);
+       enable_interrupts();
+
+       return ret;
+}
similarity index 97%
rename from board/lpc2292sodimm/mmc.c
rename to cpu/arm720t/lpc2292/mmc.c
index 1c0922f..fd7f149 100644 (file)
@@ -23,7 +23,7 @@
 #include <part.h>
 #include <fat.h>
 #include "mmc_hw.h"
-#include "spi.h"
+#include <asm/arch/spi.h>
 
 #ifdef CONFIG_MMC
 
@@ -44,7 +44,7 @@ block_dev_desc_t * mmc_get_dev(int dev)
 unsigned long mmc_block_read(int dev,
                             unsigned long start,
                             lbaint_t blkcnt,
-                            unsigned long *buffer)
+                            void *buffer)
 {
        unsigned long rc = 0;
        unsigned char *p = (unsigned char *)buffer;
@@ -101,6 +101,9 @@ int mmc_init(int verbose)
                printf("mmc_init\n");
 
        spi_init();
+       /* this meeds to be done twice */
+       mmc_hw_init();
+       udelay(1000);
        mmc_hw_init();
 
        mmc_hw_get_parameters();
similarity index 99%
rename from board/lpc2292sodimm/mmc_hw.c
rename to cpu/arm720t/lpc2292/mmc_hw.c
index 31f2a79..b4dc4a6 100644 (file)
@@ -20,7 +20,7 @@
 #include <config.h>
 #include <common.h>
 #include <asm/arch/hardware.h>
-#include "spi.h"
+#include <asm/arch/spi.h>
 
 #define MMC_Enable() PUT32(IO1CLR, 1l << 22)
 #define MMC_Disable() PUT32(IO1SET, 1l << 22)
similarity index 97%
rename from board/lpc2292sodimm/spi.c
rename to cpu/arm720t/lpc2292/spi.c
index 4ba1468..d296bda 100644 (file)
@@ -21,7 +21,7 @@
 #include <common.h>
 #include <asm/errno.h>
 #include <asm/arch/hardware.h>
-#include "spi.h"
+#include <asm/arch/spi.h>
 
 unsigned long spi_flags;
 unsigned char spi_idle = 0x00;
index 087435e..0637003 100644 (file)
@@ -155,7 +155,7 @@ in_flash:
        /* Initialize some SPRs that are hard to access from C                  */
        /*----------------------------------------------------------------------*/
 
-       lis     r3, CFG_IMMR@h                  /* Pass IMMR as arg1 to C routine */
+       lis     r3, CFG_IMMR@h                  /* Pass IMMR as arg1 to C routine */
        lis     r2, CFG_INIT_SP_ADDR@h
        ori     r1, r2, CFG_INIT_SP_ADDR@l      /* Set up the stack in internal SRAM */
        /* Note: R0 is still 0 here */
@@ -210,7 +210,7 @@ _start_of_vectors:
 /* Alignment exception. */
        . = 0x600
 Alignment:
-       EXCEPTION_PROLOG
+       EXCEPTION_PROLOG(SRR0, SRR1)
        mfspr   r4,DAR
        stw     r4,_DAR(r21)
        mfspr   r5,DSISR
@@ -228,7 +228,7 @@ Alignment:
 /* Program check exception */
        . = 0x700
 ProgramCheck:
-       EXCEPTION_PROLOG
+       EXCEPTION_PROLOG(SRR0, SRR1)
        addi    r3,r1,STACK_FRAME_OVERHEAD
        li      r20,MSR_KERNEL
        rlwimi  r20,r23,0,16,16         /* copy EE bit from saved MSR */
index 7e65821..d744030 100644 (file)
@@ -156,21 +156,21 @@ void cpu_init_f (void)
        *(vu_long *)(MPC5XXX_XLBARB + 0x40) |= (1 << 15);
        *(vu_long *)(MPC5XXX_XLBARB + 0x70) = CFG_SDRAM_BASE | 0x1d;
 
-# if defined(CFG_IPBSPEED_133)
+# if defined(CFG_IPBCLK_EQUALS_XLBCLK)
        /* Motorola reports IPB should better run at 133 MHz. */
        *(vu_long *)MPC5XXX_ADDECR |= 1;
        /* pci_clk_sel = 0x02, ipb_clk_sel = 0x00; */
        addecr = *(vu_long *)MPC5XXX_CDM_CFG;
        addecr &= ~0x103;
-#  if defined(CFG_PCISPEED_66)
+#  if defined(CFG_PCICLK_EQUALS_IPBCLK_DIV2)
        /* pci_clk_sel = 0x01 -> IPB_CLK/2 */
        addecr |= 0x01;
 #  else
        /* pci_clk_sel = 0x02 -> XLB_CLK/4 = IPB_CLK/4 */
        addecr |= 0x02;
-#  endif /* CFG_PCISPEED_66 */
+#  endif /* CFG_PCICLK_EQUALS_IPBCLK_DIV2 */
        *(vu_long *)MPC5XXX_CDM_CFG = addecr;
-# endif        /* CFG_IPBSPEED_133 */
+# endif        /* CFG_IPBCLK_EQUALS_XLBCLK */
        /* Configure the XLB Arbiter */
        *(vu_long *)MPC5XXX_XLBARB_MPRIEN = 0xff;
        *(vu_long *)MPC5XXX_XLBARB_MPRIVAL = 0x11111111;
index 00e8911..8136366 100644 (file)
@@ -395,9 +395,7 @@ static int mpc5xxx_fec_init(struct eth_device *dev, bd_t * bis)
 static int mpc5xxx_fec_init_phy(struct eth_device *dev, bd_t * bis)
 {
        mpc5xxx_fec_priv *fec = (mpc5xxx_fec_priv *)dev->priv;
-#ifndef CONFIG_MOTIONPRO
        const uint8 phyAddr = CONFIG_PHY_ADDR;  /* Only one PHY */
-#endif /* !CONFIG_MOTIONPRO */
 
 #if (DEBUG & 0x1)
        printf ("mpc5xxx_fec_init_phy... Begin\n");
@@ -437,7 +435,6 @@ static int mpc5xxx_fec_init_phy(struct eth_device *dev, bd_t * bis)
  * PHY initialization for the Motion-PRO board, until a proper fix is found.
  */
 
-#ifndef CONFIG_MOTIONPRO
        if (fec->xcv_type != SEVENWIRE) {
                /*
                 * Set MII_SPEED = (1/(mii_speed * 2)) * System Clock
@@ -564,7 +561,6 @@ static int mpc5xxx_fec_init_phy(struct eth_device *dev, bd_t * bis)
                }
 
        }
-#endif /* !CONFIG_MOTIONPRO */
 
 #if (DEBUG & 0x2)
        if (fec->xcv_type != SEVENWIRE)
index 3936b55..9b1bd48 100644 (file)
@@ -208,7 +208,7 @@ _start_of_vectors:
 /* Alignment exception. */
        . = 0x600
 Alignment:
-       EXCEPTION_PROLOG
+       EXCEPTION_PROLOG(SRR0, SRR1)
        mfspr   r4,DAR
        stw     r4,_DAR(r21)
        mfspr   r5,DSISR
@@ -227,7 +227,7 @@ Alignment:
 /* Program check exception */
        . = 0x700
 ProgramCheck:
-       EXCEPTION_PROLOG
+       EXCEPTION_PROLOG(SRR0, SRR1)
        addi    r3,r1,STACK_FRAME_OVERHEAD
        li      r20,MSR_KERNEL
        rlwimi  r20,r23,0,16,16         /* copy EE bit from saved MSR */
index 5233202..b5145ca 100644 (file)
@@ -169,7 +169,7 @@ _start_of_vectors:
 /* Alignment exception. */
        . = 0x600
 Alignment:
-       EXCEPTION_PROLOG
+       EXCEPTION_PROLOG(SRR0, SRR1)
        mfspr   r4,DAR
        stw     r4,_DAR(r21)
        mfspr   r5,DSISR
@@ -188,7 +188,7 @@ Alignment:
 /* Program check exception */
        . = 0x700
 ProgramCheck:
-       EXCEPTION_PROLOG
+       EXCEPTION_PROLOG(SRR0, SRR1)
        addi    r3,r1,STACK_FRAME_OVERHEAD
        li      r20,MSR_KERNEL
        rlwimi  r20,r23,0,16,16     /* copy EE bit from saved MSR */
index 9ff052c..784edc3 100644 (file)
@@ -220,7 +220,7 @@ _start_of_vectors:
 /* Alignment exception. */
        . = EXC_OFF_ALIGN
 Alignment:
-       EXCEPTION_PROLOG
+       EXCEPTION_PROLOG(SRR0, SRR1)
        mfspr   r4,DAR
        stw     r4,_DAR(r21)
        mfspr   r5,DSISR
@@ -238,7 +238,7 @@ Alignment:
 /* Program check exception */
        . = EXC_OFF_PROGRAM
 ProgramCheck:
-       EXCEPTION_PROLOG
+       EXCEPTION_PROLOG(SRR0, SRR1)
        addi    r3,r1,STACK_FRAME_OVERHEAD
        li      r20,MSR_KERNEL
        rlwimi  r20,r23,0,16,16         /* copy EE bit from saved MSR */
index 2e93bbb..7f5dc81 100644 (file)
@@ -279,7 +279,7 @@ _start_of_vectors:
 /* Alignment exception. */
        . = 0x600
 Alignment:
-       EXCEPTION_PROLOG
+       EXCEPTION_PROLOG(SRR0, SRR1)
        mfspr   r4,DAR
        stw     r4,_DAR(r21)
        mfspr   r5,DSISR
@@ -298,7 +298,7 @@ Alignment:
 /* Program check exception */
        . = 0x700
 ProgramCheck:
-       EXCEPTION_PROLOG
+       EXCEPTION_PROLOG(SRR0, SRR1)
        addi    r3,r1,STACK_FRAME_OVERHEAD
        li      r20,MSR_KERNEL
        rlwimi  r20,r23,0,16,16         /* copy EE bit from saved MSR */
@@ -676,13 +676,13 @@ init_debug:
        bdnz    1b
 
        /* Load the Instruction Address Breakpoint Register (IABR).     */
-       /*                                                              */
+       /*                                                              */
        /* The address to load is stored in the first word of dual port */
        /* ram and should be preserved while the power is on, so you    */
        /* can plug addresses into that location then reset the cpu and */
        /* this code will load that address into the IABR after the     */
        /* reset.                                                       */
-       /*                                                              */
+       /*                                                              */
        /* When the program counter matches the contents of the IABR,   */
        /* an exception is generated (before the instruction at that    */
        /* location completes). The vector for this exception is 0x1300 */
index 6ee9ec9..496c8a5 100644 (file)
@@ -263,7 +263,7 @@ _start_of_vectors:
 /* Alignment exception. */
        . = 0x600
 Alignment:
-       EXCEPTION_PROLOG
+       EXCEPTION_PROLOG(SRR0, SRR1)
        mfspr   r4,DAR
        stw     r4,_DAR(r21)
        mfspr   r5,DSISR
@@ -282,7 +282,7 @@ Alignment:
 /* Program check exception */
        . = 0x700
 ProgramCheck:
-       EXCEPTION_PROLOG
+       EXCEPTION_PROLOG(SRR0, SRR1)
        addi    r3,r1,STACK_FRAME_OVERHEAD
        li      r20,MSR_KERNEL
        rlwimi  r20,r23,0,16,16         /* copy EE bit from saved MSR */
index 20c7ebc..77c155c 100644 (file)
@@ -457,7 +457,7 @@ _start_of_vectors:
 /* Alignment exception. */
        . = 0x0600
 Alignment:
-       EXCEPTION_PROLOG
+       EXCEPTION_PROLOG(SRR0, SRR1)
        mfspr   r4,DAR
        stw     r4,_DAR(r21)
        mfspr   r5,DSISR
@@ -475,7 +475,7 @@ Alignment:
 /* Program check exception */
        . = 0x0700
 ProgramCheck:
-       EXCEPTION_PROLOG
+       EXCEPTION_PROLOG(SRR0, SRR1)
        addi    r3,r1,STACK_FRAME_OVERHEAD
        li      r20,MSR_KERNEL
        rlwimi  r20,r23,0,16,16         /* copy EE bit from saved MSR */
diff --git a/cpu/mpc86xx/resetvec.S b/cpu/mpc86xx/resetvec.S
deleted file mode 100644 (file)
index 9a552f6..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-       .section .resetvec,"ax"
-       b _start
index 67c56db..412745b 100644 (file)
@@ -116,7 +116,7 @@ _start_of_vectors:
 /* Alignment exception. */
        . = 0x600
 Alignment:
-       EXCEPTION_PROLOG
+       EXCEPTION_PROLOG(SRR0, SRR1)
        mfspr   r4,DAR
        stw     r4,_DAR(r21)
        mfspr   r5,DSISR
@@ -134,7 +134,7 @@ Alignment:
 /* Program check exception */
        . = 0x700
 ProgramCheck:
-       EXCEPTION_PROLOG
+       EXCEPTION_PROLOG(SRR0, SRR1)
        addi    r3,r1,STACK_FRAME_OVERHEAD
        li      r20,MSR_KERNEL
        rlwimi  r20,r23,0,16,16         /* copy EE bit from saved MSR */
index 33a3f6c..eca4b50 100644 (file)
@@ -224,7 +224,7 @@ _start_of_vectors:
 /* Alignment exception. */
        . = 0x600
 Alignment:
-       EXCEPTION_PROLOG
+       EXCEPTION_PROLOG(SRR0, SRR1)
        mfspr   r4,DAR
        stw     r4,_DAR(r21)
        mfspr   r5,DSISR
@@ -242,7 +242,7 @@ Alignment:
 /* Program check exception */
        . = 0x700
 ProgramCheck:
-       EXCEPTION_PROLOG
+       EXCEPTION_PROLOG(SRR0, SRR1)
        addi    r3,r1,STACK_FRAME_OVERHEAD
        li      r20,MSR_KERNEL
        rlwimi  r20,r23,0,16,16         /* copy EE bit from saved MSR */
index 7134355..2837929 100644 (file)
 #include <asm/processor.h>
 #include <pci.h>
 
+#ifdef CONFIG_PCI
+
 DECLARE_GLOBAL_DATA_PTR;
 
-#if defined(CONFIG_405GP) || defined(CONFIG_405EP)
+/*
+ * Board-specific pci initialization
+ * Platform code can reimplement pci_pre_init() if needed
+ */
+int __pci_pre_init(struct pci_controller *hose)
+{
+       return 1;
+}
+int pci_pre_init(struct pci_controller *hose) __attribute__((weak, alias("__pci_pre_init")));
 
-#ifdef CONFIG_PCI
+#if defined(CONFIG_405GP) || defined(CONFIG_405EP)
 
 #if defined(CONFIG_PMC405)
 ushort pmc405_pci_subsys_deviceid(void);
@@ -191,6 +201,13 @@ void pci_405gp_init(struct pci_controller *hose)
        if (hose->pci_fb)
                pciauto_region_init(hose->pci_fb);
 
+       /* Let board change/modify hose & do initial checks */
+       if (pci_pre_init (hose) == 0) {
+               printf("PCI: Board-specific initialization failed.\n");
+               printf("PCI: Configuration aborted.\n");
+               return;
+       }
+
        pci_register_hose(hose);
 
        /*--------------------------------------------------------------------------+
@@ -380,7 +397,7 @@ void pci_405gp_setup_vga(struct pci_controller *hose, pci_dev_t dev,
        pci_hose_write_config_dword(hose, dev, PCI_COMMAND, cmdstat);
 }
 
-#if !(defined(CONFIG_PIP405) || defined (CONFIG_MIP405)) && !(defined (CONFIG_SOLIDCARD3))
+#if !(defined(CONFIG_PIP405) || defined (CONFIG_MIP405)) && !(defined (CONFIG_SC3))
 
 /*
  *As is these functs get called out of flash Not a horrible
@@ -416,14 +433,12 @@ void pci_init_board(void)
 
 #endif
 
-#endif /* CONFIG_PCI */
-
 #endif /* CONFIG_405GP */
 
 /*-----------------------------------------------------------------------------+
  * CONFIG_440
  *-----------------------------------------------------------------------------*/
-#if defined(CONFIG_440) && defined(CONFIG_PCI)
+#if defined(CONFIG_440)
 
 static struct pci_controller ppc440_hose = {0};
 
@@ -496,14 +511,12 @@ void pci_440_init (struct pci_controller *hose)
 
        pci_setup_indirect(hose, PCIX0_CFGADR, PCIX0_CFGDATA);
 
-#if defined(CFG_PCI_PRE_INIT)
        /* Let board change/modify hose & do initial checks */
        if (pci_pre_init (hose) == 0) {
                printf("PCI: Board-specific initialization failed.\n");
                printf("PCI: Configuration aborted.\n");
                return;
        }
-#endif
 
        pci_register_hose( hose );
 
@@ -575,4 +588,5 @@ void pci_init_board(void)
 #endif
 }
 
-#endif /* CONFIG_440 & CONFIG_PCI */
+#endif /* CONFIG_440 */
+#endif /* CONFIG_PCI */
index 10b4c18..e24cd81 100644 (file)
@@ -20,7 +20,7 @@
  * Jun Gu, Artesyn Technology, jung@artesyncp.com
  * Support for AMCC 440 based on OpenBIOS draminit.c from IBM.
  *
- * (C) Copyright 2005
+ * (C) Copyright 2005-2007
  * Stefan Roese, DENX Software Engineering, sr@denx.de.
  *
  * See file CREDITS for list of people who contributed to this
  * MA 02111-1307 USA
  */
 
+/* define DEBUG for debugging output (obviously ;-)) */
+#if 0
+#define DEBUG
+#endif
+
 #include <common.h>
 #include <asm/processor.h>
 #include <i2c.h>
 #define MY_TLB_WORD2_I_ENABLE  TLB_WORD2_I_ENABLE      /* disable caching on SDRAM */
 #endif
 
-const unsigned long test[NUMMEMTESTS][NUMMEMWORDS] = {
-       {0x00000000, 0x00000000, 0xFFFFFFFF, 0xFFFFFFFF, 0x00000000, 0x00000000,
-        0xFFFFFFFF, 0xFFFFFFFF},
-       {0xFFFFFFFF, 0xFFFFFFFF, 0x00000000, 0x00000000, 0xFFFFFFFF, 0xFFFFFFFF,
-        0x00000000, 0x00000000},
-       {0xAAAAAAAA, 0xAAAAAAAA, 0x55555555, 0x55555555, 0xAAAAAAAA, 0xAAAAAAAA,
-        0x55555555, 0x55555555},
-       {0x55555555, 0x55555555, 0xAAAAAAAA, 0xAAAAAAAA, 0x55555555, 0x55555555,
-        0xAAAAAAAA, 0xAAAAAAAA},
-       {0xA5A5A5A5, 0xA5A5A5A5, 0x5A5A5A5A, 0x5A5A5A5A, 0xA5A5A5A5, 0xA5A5A5A5,
-        0x5A5A5A5A, 0x5A5A5A5A},
-       {0x5A5A5A5A, 0x5A5A5A5A, 0xA5A5A5A5, 0xA5A5A5A5, 0x5A5A5A5A, 0x5A5A5A5A,
-        0xA5A5A5A5, 0xA5A5A5A5},
-       {0xAA55AA55, 0xAA55AA55, 0x55AA55AA, 0x55AA55AA, 0xAA55AA55, 0xAA55AA55,
-        0x55AA55AA, 0x55AA55AA},
-       {0x55AA55AA, 0x55AA55AA, 0xAA55AA55, 0xAA55AA55, 0x55AA55AA, 0x55AA55AA,
-        0xAA55AA55, 0xAA55AA55}
-};
-
 /* bank_parms is used to sort the bank sizes by descending order */
 struct bank_param {
        unsigned long cr;
@@ -276,48 +262,39 @@ typedef struct bank_param BANKPARMS;
 #ifdef CFG_SIMULATE_SPD_EEPROM
 extern unsigned char cfg_simulate_spd_eeprom[128];
 #endif
-void program_tlb(u32 start, u32 size, u32 tlb_word2_i_value);
-
-unsigned char spd_read(uchar chip, uint addr);
-
-void get_spd_info(unsigned long* dimm_populated,
-                 unsigned char* iic0_dimm_addr,
-                 unsigned long  num_dimm_banks);
-
-void check_mem_type
-(unsigned long* dimm_populated,
- unsigned char* iic0_dimm_addr,
- unsigned long num_dimm_banks);
-
-void check_volt_type
-(unsigned long* dimm_populated,
- unsigned char* iic0_dimm_addr,
- unsigned long num_dimm_banks);
-
-void program_cfg0(unsigned long* dimm_populated,
-                 unsigned char* iic0_dimm_addr,
-                 unsigned long  num_dimm_banks);
-
-void program_cfg1(unsigned long* dimm_populated,
-                 unsigned char* iic0_dimm_addr,
-                 unsigned long  num_dimm_banks);
-
-void program_rtr (unsigned long* dimm_populated,
-                 unsigned char* iic0_dimm_addr,
-                 unsigned long  num_dimm_banks);
-
-void program_tr0 (unsigned long* dimm_populated,
-                 unsigned char* iic0_dimm_addr,
-                 unsigned long  num_dimm_banks);
-
-void program_tr1 (void);
-
-void program_ecc (unsigned long         num_bytes);
+void program_tlb(u32 phys_addr, u32 virt_addr, u32 size, u32 tlb_word2_i_value);
+
+static unsigned char spd_read(uchar chip, uint addr);
+static void get_spd_info(unsigned long *dimm_populated,
+                        unsigned char *iic0_dimm_addr,
+                        unsigned long num_dimm_banks);
+static void check_mem_type(unsigned long *dimm_populated,
+                          unsigned char *iic0_dimm_addr,
+                          unsigned long num_dimm_banks);
+static void check_volt_type(unsigned long *dimm_populated,
+                           unsigned char *iic0_dimm_addr,
+                           unsigned long num_dimm_banks);
+static void program_cfg0(unsigned long *dimm_populated,
+                        unsigned char *iic0_dimm_addr,
+                        unsigned long  num_dimm_banks);
+static void program_cfg1(unsigned long *dimm_populated,
+                        unsigned char *iic0_dimm_addr,
+                        unsigned long num_dimm_banks);
+static void program_rtr(unsigned long *dimm_populated,
+                       unsigned char *iic0_dimm_addr,
+                       unsigned long num_dimm_banks);
+static void program_tr0(unsigned long *dimm_populated,
+                       unsigned char *iic0_dimm_addr,
+                       unsigned long num_dimm_banks);
+static void program_tr1(void);
+
+#ifdef CONFIG_DDR_ECC
+static void program_ecc(unsigned long num_bytes);
+#endif
 
-unsigned
-long  program_bxcr(unsigned long* dimm_populated,
-                  unsigned char* iic0_dimm_addr,
-                  unsigned long  num_dimm_banks);
+static unsigned long program_bxcr(unsigned long *dimm_populated,
+                                 unsigned char *iic0_dimm_addr,
+                                 unsigned long num_dimm_banks);
 
 /*
  * This function is reading data from the DIMM module EEPROM over the SPD bus
@@ -328,7 +305,6 @@ long  program_bxcr(unsigned long* dimm_populated,
  * BUG: Don't handle ECC memory
  * BUG: A few values in the TR register is currently hardcoded
  */
-
 long int spd_sdram(void) {
        unsigned char iic0_dimm_addr[] = SPD_EEPROM_ADDRESS;
        unsigned long dimm_populated[sizeof(iic0_dimm_addr)];
@@ -397,7 +373,7 @@ long int spd_sdram(void) {
 
 #ifdef CONFIG_PROG_SDRAM_TLB /* this define should eventually be removed */
        /* and program tlb entries for this size (dynamic) */
-       program_tlb(0, total_size, MY_TLB_WORD2_I_ENABLE);
+       program_tlb(0, 0, total_size, MY_TLB_WORD2_I_ENABLE);
 #endif
 
        /*
@@ -421,9 +397,8 @@ long int spd_sdram(void) {
         */
        while (1) {
                mfsdram(mem_mcsts, mcsts);
-               if ((mcsts & SDRAM_MCSTS_MRSC) != 0) {
+               if ((mcsts & SDRAM_MCSTS_MRSC) != 0)
                        break;
-               }
        }
 
        /*
@@ -431,14 +406,17 @@ long int spd_sdram(void) {
         */
        program_tr1();
 
+#ifdef CONFIG_DDR_ECC
        /*
-        * if ECC is enabled, initialize parity bits
+        * If ecc is enabled, initialize the parity bits.
         */
+       program_ecc(total_size);
+#endif
 
        return total_size;
 }
 
-unsigned char spd_read(uchar chip, uint addr)
+static unsigned char spd_read(uchar chip, uint addr)
 {
        unsigned char data[2];
 
@@ -460,9 +438,9 @@ unsigned char spd_read(uchar chip, uint addr)
        return 0;
 }
 
-void get_spd_info(unsigned long*   dimm_populated,
-                 unsigned char*   iic0_dimm_addr,
-                 unsigned long    num_dimm_banks)
+static void get_spd_info(unsigned long *dimm_populated,
+                        unsigned char *iic0_dimm_addr,
+                        unsigned long num_dimm_banks)
 {
        unsigned long dimm_num;
        unsigned long dimm_found;
@@ -480,14 +458,10 @@ void get_spd_info(unsigned long*   dimm_populated,
                if ((num_of_bytes != 0) && (total_size != 0)) {
                        dimm_populated[dimm_num] = TRUE;
                        dimm_found = TRUE;
-#if 0
-                       printf("DIMM slot %lu: populated\n", dimm_num);
-#endif
+                       debug("DIMM slot %lu: populated\n", dimm_num);
                } else {
                        dimm_populated[dimm_num] = FALSE;
-#if 0
-                       printf("DIMM slot %lu: Not populated\n", dimm_num);
-#endif
+                       debug("DIMM slot %lu: Not populated\n", dimm_num);
                }
        }
 
@@ -497,9 +471,9 @@ void get_spd_info(unsigned long*   dimm_populated,
        }
 }
 
-void check_mem_type(unsigned long*   dimm_populated,
-                   unsigned char*   iic0_dimm_addr,
-                   unsigned long    num_dimm_banks)
+static void check_mem_type(unsigned long *dimm_populated,
+                          unsigned char *iic0_dimm_addr,
+                          unsigned long num_dimm_banks)
 {
        unsigned long dimm_num;
        unsigned char dimm_type;
@@ -509,9 +483,7 @@ void check_mem_type(unsigned long*   dimm_populated,
                        dimm_type = spd_read(iic0_dimm_addr[dimm_num], 2);
                        switch (dimm_type) {
                        case 7:
-#if 0
-                               printf("DIMM slot %lu: DDR SDRAM detected\n", dimm_num);
-#endif
+                               debug("DIMM slot %lu: DDR SDRAM detected\n", dimm_num);
                                break;
                        default:
                                printf("ERROR: Unsupported DIMM detected in slot %lu.\n",
@@ -525,10 +497,9 @@ void check_mem_type(unsigned long*   dimm_populated,
        }
 }
 
-
-void check_volt_type(unsigned long*   dimm_populated,
-                    unsigned char*   iic0_dimm_addr,
-                    unsigned long    num_dimm_banks)
+static void check_volt_type(unsigned long *dimm_populated,
+                           unsigned char *iic0_dimm_addr,
+                           unsigned long num_dimm_banks)
 {
        unsigned long dimm_num;
        unsigned long voltage_type;
@@ -541,18 +512,16 @@ void check_volt_type(unsigned long*   dimm_populated,
                                       dimm_num);
                                hang();
                        } else {
-#if 0
-                               printf("DIMM %lu voltage level supported.\n", dimm_num);
-#endif
+                               debug("DIMM %lu voltage level supported.\n", dimm_num);
                        }
                        break;
                }
        }
 }
 
-void program_cfg0(unsigned long* dimm_populated,
-                 unsigned char* iic0_dimm_addr,
-                 unsigned long  num_dimm_banks)
+static void program_cfg0(unsigned long *dimm_populated,
+                        unsigned char *iic0_dimm_addr,
+                        unsigned long num_dimm_banks)
 {
        unsigned long dimm_num;
        unsigned long cfg0;
@@ -640,9 +609,9 @@ void program_cfg0(unsigned long* dimm_populated,
        mtsdram(mem_cfg0, cfg0);
 }
 
-void program_cfg1(unsigned long* dimm_populated,
-                 unsigned char* iic0_dimm_addr,
-                 unsigned long  num_dimm_banks)
+static void program_cfg1(unsigned long *dimm_populated,
+                        unsigned char *iic0_dimm_addr,
+                        unsigned long num_dimm_banks)
 {
        unsigned long cfg1;
        mfsdram(mem_cfg1, cfg1);
@@ -658,9 +627,9 @@ void program_cfg1(unsigned long* dimm_populated,
        mtsdram(mem_cfg1, cfg1);
 }
 
-void program_rtr (unsigned long* dimm_populated,
-                 unsigned char* iic0_dimm_addr,
-                 unsigned long  num_dimm_banks)
+static void program_rtr(unsigned long *dimm_populated,
+                       unsigned char *iic0_dimm_addr,
+                       unsigned long num_dimm_banks)
 {
        unsigned long dimm_num;
        unsigned long bus_period_x_10;
@@ -676,7 +645,6 @@ void program_rtr (unsigned long* dimm_populated,
        get_sys_info(&sys_info);
        bus_period_x_10 = ONE_BILLION / (sys_info.freqPLB / 10);
 
-
        for (dimm_num = 0;  dimm_num < num_dimm_banks; dimm_num++) {
                if (dimm_populated[dimm_num] == TRUE) {
                        refresh_rate_type = 0x7F & spd_read(iic0_dimm_addr[dimm_num], 12);
@@ -719,9 +687,9 @@ void program_rtr (unsigned long* dimm_populated,
        mtsdram(mem_rtr, sdram_rtr);
 }
 
-void program_tr0 (unsigned long* dimm_populated,
-                 unsigned char* iic0_dimm_addr,
-                 unsigned long  num_dimm_banks)
+static void program_tr0(unsigned long *dimm_populated,
+                        unsigned char *iic0_dimm_addr,
+                        unsigned long num_dimm_banks)
 {
        unsigned long dimm_num;
        unsigned long tr0;
@@ -1001,13 +969,73 @@ void program_tr0 (unsigned long* dimm_populated,
                break;
        }
 
-#if 0
-       printf("tr0: %x\n", tr0);
-#endif
+       debug("tr0: %x\n", tr0);
        mtsdram(mem_tr0, tr0);
 }
 
-void program_tr1 (void)
+static int short_mem_test(void)
+{
+       unsigned long i, j;
+       unsigned long bxcr_num;
+       unsigned long *membase;
+       const unsigned long test[NUMMEMTESTS][NUMMEMWORDS] = {
+               {0x00000000, 0x00000000, 0xFFFFFFFF, 0xFFFFFFFF,
+                0x00000000, 0x00000000, 0xFFFFFFFF, 0xFFFFFFFF},
+               {0xFFFFFFFF, 0xFFFFFFFF, 0x00000000, 0x00000000,
+                0xFFFFFFFF, 0xFFFFFFFF, 0x00000000, 0x00000000},
+               {0xAAAAAAAA, 0xAAAAAAAA, 0x55555555, 0x55555555,
+                0xAAAAAAAA, 0xAAAAAAAA, 0x55555555, 0x55555555},
+               {0x55555555, 0x55555555, 0xAAAAAAAA, 0xAAAAAAAA,
+                0x55555555, 0x55555555, 0xAAAAAAAA, 0xAAAAAAAA},
+               {0xA5A5A5A5, 0xA5A5A5A5, 0x5A5A5A5A, 0x5A5A5A5A,
+                0xA5A5A5A5, 0xA5A5A5A5, 0x5A5A5A5A, 0x5A5A5A5A},
+               {0x5A5A5A5A, 0x5A5A5A5A, 0xA5A5A5A5, 0xA5A5A5A5,
+                0x5A5A5A5A, 0x5A5A5A5A, 0xA5A5A5A5, 0xA5A5A5A5},
+               {0xAA55AA55, 0xAA55AA55, 0x55AA55AA, 0x55AA55AA,
+                0xAA55AA55, 0xAA55AA55, 0x55AA55AA, 0x55AA55AA},
+               {0x55AA55AA, 0x55AA55AA, 0xAA55AA55, 0xAA55AA55,
+                0x55AA55AA, 0x55AA55AA, 0xAA55AA55, 0xAA55AA55}};
+
+       for (bxcr_num = 0; bxcr_num < MAXBXCR; bxcr_num++) {
+               mtdcr(memcfga, mem_b0cr + (bxcr_num << 2));
+               if ((mfdcr(memcfgd) & SDRAM_BXCR_SDBE) == SDRAM_BXCR_SDBE) {
+                       /* Bank is enabled */
+                       membase = (unsigned long*)
+                               (mfdcr(memcfgd) & SDRAM_BXCR_SDBA_MASK);
+
+                       /*
+                        * Run the short memory test
+                        */
+                       for (i = 0; i < NUMMEMTESTS; i++) {
+                               for (j = 0; j < NUMMEMWORDS; j++) {
+                                       membase[j] = test[i][j];
+                                       ppcDcbf((unsigned long)&(membase[j]));
+                               }
+
+                               for (j = 0; j < NUMMEMWORDS; j++) {
+                                       if (membase[j] != test[i][j]) {
+                                               ppcDcbf((unsigned long)&(membase[j]));
+                                               return 0;
+                                       }
+                                       ppcDcbf((unsigned long)&(membase[j]));
+                               }
+
+                               if (j < NUMMEMWORDS)
+                                       return 0;
+                       }
+
+                       /*
+                        * see if the rdclt value passed
+                        */
+                       if (i < NUMMEMTESTS)
+                               return 0;
+               }
+       }
+
+       return 1;
+}
+
+static void program_tr1(void)
 {
        unsigned long tr0;
        unsigned long tr1;
@@ -1015,8 +1043,7 @@ void program_tr1 (void)
        unsigned long ecc_temp;
        unsigned long dlycal;
        unsigned long dly_val;
-       unsigned long i, j, k;
-       unsigned long bxcr_num;
+       unsigned long k;
        unsigned long max_pass_length;
        unsigned long current_pass_length;
        unsigned long current_fail_length;
@@ -1029,7 +1056,6 @@ void program_tr1 (void)
        unsigned char window_found;
        unsigned char fail_found;
        unsigned char pass_found;
-       unsigned long * membase;
        PPC440_SYS_INFO sys_info;
 
        /*
@@ -1079,55 +1105,16 @@ void program_tr1 (void)
        window_found = FALSE;
        fail_found = FALSE;
        pass_found = FALSE;
-#ifdef DEBUG
-       printf("Starting memory test ");
-#endif
+       debug("Starting memory test ");
+
        for (k = 0; k < NUMHALFCYCLES; k++) {
-               for (rdclt = 0; rdclt < dly_val; rdclt++)  {
+               for (rdclt = 0; rdclt < dly_val; rdclt++) {
                        /*
                         * Set the timing reg for the test.
                         */
                        mtsdram(mem_tr1, (tr1 | SDRAM_TR1_RDCT_ENCODE(rdclt)));
 
-                       for (bxcr_num = 0; bxcr_num < MAXBXCR; bxcr_num++) {
-                               mtdcr(memcfga, mem_b0cr + (bxcr_num<<2));
-                               if ((mfdcr(memcfgd) & SDRAM_BXCR_SDBE) == SDRAM_BXCR_SDBE) {
-                                       /* Bank is enabled */
-                                       membase = (unsigned long*)
-                                               (mfdcr(memcfgd) & SDRAM_BXCR_SDBA_MASK);
-
-                                       /*
-                                        * Run the short memory test
-                                        */
-                                       for (i = 0; i < NUMMEMTESTS; i++) {
-                                               for (j = 0; j < NUMMEMWORDS; j++) {
-                                                       membase[j] = test[i][j];
-                                                       ppcDcbf((unsigned long)&(membase[j]));
-                                               }
-
-                                               for (j = 0; j < NUMMEMWORDS; j++) {
-                                                       if (membase[j] != test[i][j]) {
-                                                               ppcDcbf((unsigned long)&(membase[j]));
-                                                               break;
-                                                       }
-                                                       ppcDcbf((unsigned long)&(membase[j]));
-                                               }
-
-                                               if (j < NUMMEMWORDS) {
-                                                       break;
-                                               }
-                                       }
-
-                                       /*
-                                        * see if the rdclt value passed
-                                        */
-                                       if (i < NUMMEMTESTS) {
-                                               break;
-                                       }
-                               }
-                       }
-
-                       if (bxcr_num == MAXBXCR) {
+                       if (short_mem_test()) {
                                if (fail_found == TRUE) {
                                        pass_found = TRUE;
                                        if (current_pass_length == 0) {
@@ -1157,9 +1144,8 @@ void program_tr1 (void)
                                }
                        }
                }
-#ifdef DEBUG
-               printf(".");
-#endif
+               debug(".");
+
                if (window_found == TRUE) {
                        break;
                }
@@ -1167,9 +1153,7 @@ void program_tr1 (void)
                tr1 = tr1 ^ SDRAM_TR1_RDCD_MASK;
                rdclt_offset += dly_val;
        }
-#ifdef DEBUG
-       printf("\n");
-#endif
+       debug("\n");
 
        /*
         * make sure we find the window
@@ -1218,18 +1202,17 @@ void program_tr1 (void)
        }
        tr1 |= SDRAM_TR1_RDCT_ENCODE(rdclt_average);
 
-#if 0
-       printf("tr1: %x\n", tr1);
-#endif
+       debug("tr1: %x\n", tr1);
+
        /*
         * program SDRAM Timing Register 1 TR1
         */
        mtsdram(mem_tr1, tr1);
 }
 
-unsigned long program_bxcr(unsigned long* dimm_populated,
-                          unsigned char* iic0_dimm_addr,
-                          unsigned long  num_dimm_banks)
+static unsigned long program_bxcr(unsigned long *dimm_populated,
+                                 unsigned char *iic0_dimm_addr,
+                                 unsigned long num_dimm_banks)
 {
        unsigned long dimm_num;
        unsigned long bank_base_addr;
@@ -1262,8 +1245,8 @@ unsigned long program_bxcr(unsigned long* dimm_populated,
 #ifdef CONFIG_BAMBOO
        /*
         * This next section is hardware dependent and must be programmed
-        * to match the hardware.  For bammboo, the following holds...
-        * 1. SDRAM0_B0CR: Bank 0 of dimm 0 ctrl_bank_num : 0
+        * to match the hardware.  For bamboo, the following holds...
+        * 1. SDRAM0_B0CR: Bank 0 of dimm 0 ctrl_bank_num : 0 (soldered onboard)
         * 2. SDRAM0_B1CR: Bank 0 of dimm 1 ctrl_bank_num : 1
         * 3. SDRAM0_B2CR: Bank 1 of dimm 1 ctrl_bank_num : 1
         * 4. SDRAM0_B3CR: Bank 0 of dimm 2 ctrl_bank_num : 3
@@ -1273,10 +1256,12 @@ unsigned long program_bxcr(unsigned long* dimm_populated,
        ctrl_bank_num[1] = 1;
        ctrl_bank_num[2] = 3;
 #else
+       /*
+        * Ocotea, Ebony and the other IBM/AMCC eval boards have
+        * 2 DIMM slots with each max 2 banks
+        */
        ctrl_bank_num[0] = 0;
-       ctrl_bank_num[1] = 1;
-       ctrl_bank_num[2] = 2;
-       ctrl_bank_num[3] = 3;
+       ctrl_bank_num[1] = 2;
 #endif
 
        /*
@@ -1290,6 +1275,8 @@ unsigned long program_bxcr(unsigned long* dimm_populated,
                        num_col_addr = spd_read(iic0_dimm_addr[dimm_num], 4);
                        num_banks    = spd_read(iic0_dimm_addr[dimm_num], 5);
                        bank_size_id = spd_read(iic0_dimm_addr[dimm_num], 31);
+                       debug("DIMM%d: row=%d col=%d banks=%d\n", dimm_num,
+                             num_row_addr, num_col_addr, num_banks);
 
                        /*
                         * Set the SDRAM0_BxCR regs
@@ -1353,11 +1340,14 @@ unsigned long program_bxcr(unsigned long* dimm_populated,
                         */
                        cr |= SDRAM_BXCR_SDBE;
 
-                       for (i = 0; i < num_banks; i++) {
-                               bank_parms[ctrl_bank_num[dimm_num]+i+dimm_num].bank_size_bytes =
-                                       (4 * 1024 * 1024) * bank_size_id;
-                               bank_parms[ctrl_bank_num[dimm_num]+i+dimm_num].cr = cr;
-                       }
+                       for (i = 0; i < num_banks; i++) {
+                               bank_parms[ctrl_bank_num[dimm_num]+i].bank_size_bytes =
+                                       (4 << 20) * bank_size_id;
+                               bank_parms[ctrl_bank_num[dimm_num]+i].cr = cr;
+                               debug("DIMM%d-bank %d (SDRAM0_B%dCR): bank_size_bytes=%d\n",
+                                     dimm_num, i, ctrl_bank_num[dimm_num]+i,
+                                     bank_parms[ctrl_bank_num[dimm_num]+i].bank_size_bytes);
+                       }
                }
        }
 
@@ -1400,13 +1390,15 @@ unsigned long program_bxcr(unsigned long* dimm_populated,
                                bank_parms[sorted_bank_num[bx_cr_num]].cr;
                        mtdcr(memcfgd, temp);
                        bank_base_addr += bank_parms[sorted_bank_num[bx_cr_num]].bank_size_bytes;
+                       debug("SDRAM0_B%dCR=0x%08lx\n", sorted_bank_num[bx_cr_num], temp);
                }
        }
 
        return(bank_base_addr);
 }
 
-void program_ecc (unsigned long         num_bytes)
+#ifdef CONFIG_DDR_ECC
+static void program_ecc(unsigned long num_bytes)
 {
        unsigned long bank_base_addr;
        unsigned long current_address;
@@ -1425,14 +1417,12 @@ void program_ecc (unsigned long  num_bytes)
        bank_base_addr = CFG_SDRAM_BASE;
 
        if ((cfg0 & SDRAM_CFG0_MCHK_MASK) != SDRAM_CFG0_MCHK_NON) {
-               mtsdram(mem_cfg0, (cfg0 & ~SDRAM_CFG0_MCHK_MASK) |
-                       SDRAM_CFG0_MCHK_GEN);
+               mtsdram(mem_cfg0, (cfg0 & ~SDRAM_CFG0_MCHK_MASK) | SDRAM_CFG0_MCHK_GEN);
 
-               if ((cfg0 & SDRAM_CFG0_DMWD_MASK) == SDRAM_CFG0_DMWD_32) {
+               if ((cfg0 & SDRAM_CFG0_DMWD_MASK) == SDRAM_CFG0_DMWD_32)
                        address_increment = 4;
-               } else {
+               else
                        address_increment = 8;
-               }
 
                current_address = (unsigned long)(bank_base_addr);
                end_address = (unsigned long)(bank_base_addr) + num_bytes;
@@ -1446,4 +1436,5 @@ void program_ecc (unsigned long    num_bytes)
                        SDRAM_CFG0_MCHK_CHK);
        }
 }
+#endif /* CONFIG_DDR_ECC */
 #endif /* CONFIG_SPD_EEPROM */
index 2ecd3e4..b5c0f53 100644 (file)
@@ -58,8 +58,8 @@
 #define SDRAM_DDR2     2
 #define SDRAM_NONE     0
 
-#define MAXDIMMS       2
-#define MAXRANKS       4
+#define MAXDIMMS       2
+#define MAXRANKS       4
 #define MAXBXCF                4
 #define MAX_SPD_BYTES  256   /* Max number of bytes on the DIMM's SPD EEPROM */
 
@@ -144,7 +144,7 @@ typedef enum ddr_cas_id {
  * Prototypes
  *-----------------------------------------------------------------------------*/
 static unsigned long sdram_memsize(void);
-void program_tlb(u32 start, u32 size, u32 tlb_word2_i_value);
+void program_tlb(u32 phys_addr, u32 virt_addr, u32 size, u32 tlb_word2_i_value);
 static void get_spd_info(unsigned long *dimm_populated,
                         unsigned char *iic0_dimm_addr,
                         unsigned long num_dimm_banks);
@@ -465,7 +465,11 @@ long int initdram(int board_type)
         * Set the SDRAM Clock Timing Register
         *-----------------------------------------------------------------*/
        mfsdram(SDRAM_CLKTR, val);
+#ifdef CFG_44x_DDR2_CKTR_180
+       mtsdram(SDRAM_CLKTR, (val & ~SDRAM_CLKTR_CLKP_MASK) | SDRAM_CLKTR_CLKP_180_DEG_ADV);
+#else
        mtsdram(SDRAM_CLKTR, (val & ~SDRAM_CLKTR_CLKP_MASK) | SDRAM_CLKTR_CLKP_0_DEG);
+#endif
 
        /*------------------------------------------------------------------
         * Program the BxCF registers.
@@ -524,7 +528,7 @@ long int initdram(int board_type)
        dram_size = sdram_memsize();
 
        /* and program tlb entries for this size (dynamic) */
-       program_tlb(0, dram_size, MY_TLB_WORD2_I_ENABLE);
+       program_tlb(0, 0, dram_size, MY_TLB_WORD2_I_ENABLE);
 
        /*------------------------------------------------------------------
         * DQS calibration.
@@ -1117,7 +1121,8 @@ static void program_codt(unsigned long *dimm_populated,
                                modt3 = 0x00000000;
                        }
                        if (total_rank == 4) {
-                               codt |= CALC_ODT_R(0) | CALC_ODT_R(1) | CALC_ODT_R(2) | CALC_ODT_R(3);
+                               codt |= CALC_ODT_R(0) | CALC_ODT_R(1) |
+                                       CALC_ODT_R(2) | CALC_ODT_R(3);
                                modt0 = CALC_ODT_RW(2);
                                modt1 = 0x00000000;
                                modt2 = CALC_ODT_RW(0);
index 119e061..4fd5108 100644 (file)
 #
 
 PLATFORM_RELFLAGS += -fPIC -ffixed-r14 -meabi -fno-strict-aliasing
+PLATFORM_CPPFLAGS += -DCONFIG_4xx -ffixed-r2 -ffixed-r29 -mstring -msoft-float
 
-PLATFORM_CPPFLAGS += -DCONFIG_4xx -ffixed-r2 -ffixed-r29 -mstring -Wa,-m405 -mcpu=405 -msoft-float
+cfg=$(shell grep configs $(OBJTREE)/include/config.h | sed 's/.*<\(configs.*\)>/\1/')
+is440=$(shell grep CONFIG_440 $(TOPDIR)/include/$(cfg))
+
+ifneq (,$(findstring CONFIG_440,$(is440)))
+PLATFORM_CPPFLAGS += -Wa,-m440 -mcpu=440
+else
+PLATFORM_CPPFLAGS += -Wa,-m405 -mcpu=405
+endif
index 8e6bc84..c07bc0c 100644 (file)
@@ -139,6 +139,7 @@ static char *bootstrap_str[] = {
        "Reserved",
        "I2C (Addr 0x50)",
 };
+static char bootstrap_char[] = { 'A', 'B', 'C', 'B', 'D', 'E', 'x', 'F' };
 #endif
 
 #if defined(CONFIG_440SP) || defined(CONFIG_440SPE)
@@ -149,6 +150,7 @@ static char *bootstrap_str[] = {
        "I2C (Addr 0x54)",
        "I2C (Addr 0x50)",
 };
+static char bootstrap_char[] = { 'A', 'B', 'C', 'D'};
 #endif
 
 #if defined(CONFIG_440EP) || defined(CONFIG_440GR)
@@ -163,6 +165,7 @@ static char *bootstrap_str[] = {
        "PCI",
        "I2C (Addr 0x52)",
 };
+static char bootstrap_char[] = { 'A', 'B', 'C', 'D', 'E', 'G', 'F', 'H' };
 #endif
 
 #if defined(CONFIG_440EPX) || defined(CONFIG_440GRX)
@@ -177,6 +180,7 @@ static char *bootstrap_str[] = {
        "PCI",
        "I2C (Addr 0x52)",
 };
+static char bootstrap_char[] = { 'A', 'B', 'C', 'D', 'E', 'G', 'F', 'H' };
 #endif
 
 #if defined(CONFIG_405EZ)
@@ -199,6 +203,8 @@ static char *bootstrap_str[] = {
        "SPI (slow)",
        "I2C (Addr 0x50)",
 };
+static char bootstrap_char[] = { 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', \
+                                'I', 'x', 'K', 'L', 'M', 'N', 'O', 'P' };
 #endif
 
 #if defined(SDR0_PINSTP_SHIFT)
@@ -427,7 +433,7 @@ int checkcpu (void)
        printf ("       I2C boot EEPROM %sabled\n", i2c_bootrom_enabled() ? "en" : "dis");
 #endif /* I2C_BOOTROM */
 #if defined(SDR0_PINSTP_SHIFT)
-       printf ("       Bootstrap Option %c - ", (char)bootstrap_option() + 'A');
+       printf ("       Bootstrap Option %c - ", bootstrap_char[bootstrap_option()]);
        printf ("Boot ROM Location %s\n", bootstrap_str[bootstrap_option()]);
 #endif /* SDR0_PINSTP_SHIFT */
 
index 66e8637..351da36 100644 (file)
@@ -153,7 +153,7 @@ cpu_init_f (void)
         */
        asm volatile("  bl      0f"             ::: "lr");
        asm volatile("0:        mflr    3"              ::: "r3");
-       asm volatile("  addi    4, 0, 14"       ::: "r4");
+       asm volatile("  addi    4, 0, 14"       ::: "r4");
        asm volatile("  mtctr   4"              ::: "ctr");
        asm volatile("1:        icbt    0, 3");
        asm volatile("  addi    3, 3, 32"       ::: "r3");
@@ -211,6 +211,8 @@ cpu_init_f (void)
        val = mfspr(tcr);
 #if defined(CONFIG_440EP) || defined(CONFIG_440GR)
        val |= 0xb8000000;      /* generate system reset after 1.34 seconds */
+#elif defined(CONFIG_440EPX)
+       val |= 0xb0000000;      /* generate system reset after 1.34 seconds */
 #else
        val |= 0xf0000000;      /* generate system reset after 2.684 seconds */
 #endif
index dd84e58..5235203 100644 (file)
@@ -103,6 +103,18 @@ void gpio_write_bit(int pin, int val)
                out32(GPIO0_OR + offs, in32(GPIO0_OR + offs) & ~GPIO_VAL(pin));
 }
 
+int gpio_read_out_bit(int pin)
+{
+       u32 offs = 0;
+
+       if (pin >= GPIO_MAX) {
+               offs = 0x100;
+               pin -= GPIO_MAX;
+       }
+
+       return (in32(GPIO0_OR + offs) & GPIO_VAL(pin) ? 1 : 0);
+}
+
 #if defined(CFG_440_GPIO_TABLE)
 void gpio_set_chip_configuration(void)
 {
@@ -157,12 +169,38 @@ void gpio_set_chip_configuration(void)
                                switch (gpio_tab[gpio_core][i].alt_nb) {
                                case GPIO_SEL:
                                        if (gpio_core == GPIO0) {
-                                               reg = in32(GPIO0_TCR) | (0x80000000 >> (j));
+                                               /*
+                                                * Setup output value
+                                                * 1 -> high level
+                                                * 0 -> low level
+                                                * else -> don't touch
+                                                */
+                                               reg = in32(GPIO0_OR);
+                                               if (gpio_tab[gpio_core][i].out_val == GPIO_OUT_1)
+                                                       reg |= (0x80000000 >> (i));
+                                               else if (gpio_tab[gpio_core][i].out_val == GPIO_OUT_0)
+                                                       reg &= ~(0x80000000 >> (i));
+                                               out32(GPIO0_OR, reg);
+
+                                               reg = in32(GPIO0_TCR) | (0x80000000 >> (i));
                                                out32(GPIO0_TCR, reg);
                                        }
 
                                        if (gpio_core == GPIO1) {
-                                               reg = in32(GPIO1_TCR) | (0x80000000 >> (j));
+                                               /*
+                                                * Setup output value
+                                                * 1 -> high level
+                                                * 0 -> low level
+                                                * else -> don't touch
+                                                */
+                                               reg = in32(GPIO0_OR);
+                                               if (gpio_tab[gpio_core][i].out_val == GPIO_OUT_1)
+                                                       reg |= (0x80000000 >> (i));
+                                               else if (gpio_tab[gpio_core][i].out_val == GPIO_OUT_0)
+                                                       reg &= ~(0x80000000 >> (i));
+                                               out32(GPIO0_OR, reg);
+
+                                               reg = in32(GPIO1_TCR) | (0x80000000 >> (i));
                                                out32(GPIO1_TCR, reg);
                                        }
 
index b198ff4..f63fc79 100644 (file)
@@ -3,7 +3,7 @@
  *   Platform independend driver for NDFC (NanD Flash Controller)
  *   integrated into EP440 cores
  *
- * (C) Copyright 2006
+ * (C) Copyright 2006-2007
  * Stefan Roese, DENX Software Engineering, sr@denx.de.
  *
  * Based on original work by
 
 #if (CONFIG_COMMANDS & CFG_CMD_NAND) && !defined(CFG_NAND_LEGACY) && \
        (defined(CONFIG_440EP) || defined(CONFIG_440GR) ||           \
-        defined(CONFIG_440EPX) || defined(CONFIG_440GRX))
+        defined(CONFIG_440EPX) || defined(CONFIG_440GRX) ||         \
+        defined(CONFIG_405EZ))
 
 #include <nand.h>
 #include <linux/mtd/ndfc.h>
+#include <linux/mtd/nand_ecc.h>
 #include <asm/processor.h>
-#include <ppc440.h>
+#include <asm/io.h>
+#include <ppc4xx.h>
 
 static u8 hwctl = 0;
 
@@ -69,11 +72,11 @@ static void ndfc_write_byte(struct mtd_info *mtdinfo, u_char byte)
        ulong base = (ulong) this->IO_ADDR_W & 0xfffffffc;
 
        if (hwctl & 0x1)
-               out8(base + NDFC_CMD, byte);
+               out_8((u8 *)(base + NDFC_CMD), byte);
        else if (hwctl & 0x2)
-               out8(base + NDFC_ALE, byte);
+               out_8((u8 *)(base + NDFC_ALE), byte);
        else
-               out8(base + NDFC_DATA, byte);
+               out_8((u8 *)(base + NDFC_DATA), byte);
 }
 
 static u_char ndfc_read_byte(struct mtd_info *mtdinfo)
@@ -81,7 +84,7 @@ static u_char ndfc_read_byte(struct mtd_info *mtdinfo)
        struct nand_chip *this = mtdinfo->priv;
        ulong base = (ulong) this->IO_ADDR_W & 0xfffffffc;
 
-       return (in8(base + NDFC_DATA));
+       return (in_8((u8 *)(base + NDFC_DATA)));
 }
 
 static int ndfc_dev_ready(struct mtd_info *mtdinfo)
@@ -89,17 +92,41 @@ static int ndfc_dev_ready(struct mtd_info *mtdinfo)
        struct nand_chip *this = mtdinfo->priv;
        ulong base = (ulong) this->IO_ADDR_W & 0xfffffffc;
 
-       while (!(in32(base + NDFC_STAT) & NDFC_STAT_IS_READY))
+       while (!(in_be32((u32 *)(base + NDFC_STAT)) & NDFC_STAT_IS_READY))
                ;
 
        return 1;
 }
 
-#ifndef CONFIG_NAND_SPL
-/*
- * Don't use these speedup functions in NAND boot image, since the image
- * has to fit into 4kByte.
- */
+static void ndfc_enable_hwecc(struct mtd_info *mtdinfo, int mode)
+{
+       struct nand_chip *this = mtdinfo->priv;
+       ulong base = (ulong) this->IO_ADDR_W & 0xfffffffc;
+       u32 ccr;
+
+       ccr = in_be32((u32 *)(base + NDFC_CCR));
+       ccr |= NDFC_CCR_RESET_ECC;
+       out_be32((u32 *)(base + NDFC_CCR), ccr);
+}
+
+static int ndfc_calculate_ecc(struct mtd_info *mtdinfo,
+                             const u_char *dat, u_char *ecc_code)
+{
+       struct nand_chip *this = mtdinfo->priv;
+       ulong base = (ulong) this->IO_ADDR_W & 0xfffffffc;
+       u32 ecc;
+       u8 *p = (u8 *)&ecc;
+
+       ecc = in_be32((u32 *)(base + NDFC_ECC));
+
+       /* The NDFC uses Smart Media (SMC) bytes order
+        */
+       ecc_code[0] = p[2];
+       ecc_code[1] = p[1];
+       ecc_code[2] = p[3];
+
+       return 0;
+}
 
 /*
  * Speedups for buffer read/write/verify
@@ -115,9 +142,14 @@ static void ndfc_read_buf(struct mtd_info *mtdinfo, uint8_t *buf, int len)
        uint32_t *p = (uint32_t *) buf;
 
        for (;len > 0; len -= 4)
-               *p++ = in32(base + NDFC_DATA);
+               *p++ = in_be32((u32 *)(base + NDFC_DATA));
 }
 
+#ifndef CONFIG_NAND_SPL
+/*
+ * Don't use these speedup functions in NAND boot image, since the image
+ * has to fit into 4kByte.
+ */
 static void ndfc_write_buf(struct mtd_info *mtdinfo, const uint8_t *buf, int len)
 {
        struct nand_chip *this = mtdinfo->priv;
@@ -125,7 +157,7 @@ static void ndfc_write_buf(struct mtd_info *mtdinfo, const uint8_t *buf, int len
        uint32_t *p = (uint32_t *) buf;
 
        for (; len > 0; len -= 4)
-               out32(base + NDFC_DATA, *p++);
+               out_be32((u32 *)(base + NDFC_DATA), *p++);
 }
 
 static int ndfc_verify_buf(struct mtd_info *mtdinfo, const uint8_t *buf, int len)
@@ -135,7 +167,7 @@ static int ndfc_verify_buf(struct mtd_info *mtdinfo, const uint8_t *buf, int len
        uint32_t *p = (uint32_t *) buf;
 
        for (; len > 0; len -= 4)
-               if (*p++ != in32(base + NDFC_DATA))
+               if (*p++ != in_be32((u32 *)(base + NDFC_DATA)))
                        return -1;
 
        return 0;
@@ -152,8 +184,8 @@ void board_nand_select_device(struct nand_chip *nand, int chip)
        ulong base = (ulong)nand->IO_ADDR_W & 0xfffffffc;
 
        /* Set NandFlash Core Configuration Register */
-       /* 1col x 2 rows */
-       out32(base + NDFC_CCR, 0x00000000 | (cs << 24));
+       /* 1 col x 2 rows */
+       out_be32((u32 *)(base + NDFC_CCR), 0x00000000 | (cs << 24));
 }
 
 int board_nand_init(struct nand_chip *nand)
@@ -161,23 +193,25 @@ int board_nand_init(struct nand_chip *nand)
        int cs = (ulong)nand->IO_ADDR_W & 0x00000003;
        ulong base = (ulong)nand->IO_ADDR_W & 0xfffffffc;
 
-       nand->eccmode = NAND_ECC_SOFT;
-
        nand->hwcontrol  = ndfc_hwcontrol;
        nand->read_byte  = ndfc_read_byte;
+       nand->read_buf   = ndfc_read_buf;
        nand->write_byte = ndfc_write_byte;
        nand->dev_ready  = ndfc_dev_ready;
 
+       nand->eccmode = NAND_ECC_HW3_256;
+       nand->enable_hwecc = ndfc_enable_hwecc;
+       nand->calculate_ecc = ndfc_calculate_ecc;
+       nand->correct_data = nand_correct_data;
+
 #ifndef CONFIG_NAND_SPL
        nand->write_buf  = ndfc_write_buf;
-       nand->read_buf   = ndfc_read_buf;
        nand->verify_buf = ndfc_verify_buf;
 #else
        /*
         * Setup EBC (CS0 only right now)
         */
-       mtdcr(ebccfga, xbcfg);
-       mtdcr(ebccfgd, 0xb8400000);
+       mtebc(EBC0_CFG, 0xb8400000);
 
        mtebc(pb0cr, CFG_EBC_PB0CR);
        mtebc(pb0ap, CFG_EBC_PB0AP);
@@ -187,7 +221,7 @@ int board_nand_init(struct nand_chip *nand)
         * Select required NAND chip in NDFC
         */
        board_nand_select_device(nand, cs);
-       out32(base + NDFC_BCFG0 + (cs << 2), 0x80002222);
+       out_be32((u32 *)(base + NDFC_BCFG0 + (cs << 2)), 0x80002222);
        return 0;
 }
 
index a96083c..dfe813c 100644 (file)
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  * MA 02111-1307 USA
  */
-/*------------------------------------------------------------------------------+ */
-/* */
-/*      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 */
-/*------------------------------------------------------------------------------- */
+/*------------------------------------------------------------------------------+
+ *
+ *      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
+ *-------------------------------------------------------------------------------
+ */
 
 /*  U-Boot - Startup Code for AMCC 4xx PowerPC based Embedded Boards
  *
@@ -59,7 +60,6 @@
  *  address and (s)dram will be positioned at address 0
  */
 #include <config.h>
-#include <mpc8xx.h>
 #include <ppc4xx.h>
 #include <version.h>
 
 # endif
 #endif /* CFG_INIT_DCACHE_CS */
 
+#define function_prolog(func_name)     .text; \
+                                       .align 2; \
+                                       .globl func_name; \
+                                       func_name:
+#define function_epilog(func_name)     .type func_name,@function; \
+                                       .size func_name,.-func_name
+
 /* We don't want the  MMU yet.
 */
 #undef MSR_KERNEL
         * NAND U-Boot image is started from offset 0
         */
        .text
+#if defined(CONFIG_440)
        bl      reconfig_tlb0
+#endif
        GET_GOT
        bl      cpu_init_f      /* run low-level CPU init code     (from Flash) */
        bl      board_init_f
@@ -285,11 +294,13 @@ skip_debug_init:
        mtspr   ivor7,r1        /* Floating point unavailable */
        li      r1,0x0c00
        mtspr   ivor8,r1        /* System call */
-       li      r1,0x1000
-       mtspr   ivor10,r1       /* Decrementer (PIT for 440) */
-       li      r1,0x1400
-       mtspr   ivor13,r1       /* Data TLB error */
+       li      r1,0x0a00
+       mtspr   ivor9,r1        /* Auxiliary Processor unavailable */
+       li      r1,0x0900
+       mtspr   ivor10,r1       /* Decrementer */
        li      r1,0x1300
+       mtspr   ivor13,r1       /* Data TLB error */
+       li      r1,0x1400
        mtspr   ivor14,r1       /* Instr TLB error */
        li      r1,0x2000
        mtspr   ivor15,r1       /* Debug */
@@ -388,8 +399,9 @@ rsttlb:     tlbwe   r0,r1,0x0000    /* Invalidate all entries (V=0)*/
 2:
 
 #if defined(CONFIG_NAND_SPL)
+#if defined(CONFIG_440EPX) || defined(CONFIG_440GRX)
        /*
-        * Enable internal SRAM
+        * Enable internal SRAM (only on 440EPx/GRx, 440EP/GR have no OCM)
         */
        lis     r2,0x7fff
        ori     r2,r2,0xffff
@@ -399,6 +411,45 @@ rsttlb:    tlbwe   r0,r1,0x0000    /* Invalidate all entries (V=0)*/
        mfdcr   r1,isram0_pmeg
        and     r1,r1,r2                /* Disable pwr mgmt */
        mtdcr   isram0_pmeg,r1
+#endif
+#if defined(CONFIG_440EP)
+       /*
+        * On 440EP with no internal SRAM, we setup SDRAM very early
+        * and copy the NAND_SPL to SDRAM and jump to it
+        */
+       /* Clear Dcache to use as RAM */
+       addis   r3,r0,CFG_INIT_RAM_ADDR@h
+       ori     r3,r3,CFG_INIT_RAM_ADDR@l
+       addis   r4,r0,CFG_INIT_RAM_END@h
+       ori     r4,r4,CFG_INIT_RAM_END@l
+       rlwinm. r5,r4,0,27,31
+       rlwinm  r5,r4,27,5,31
+       beq     ..d_ran3
+       addi    r5,r5,0x0001
+..d_ran3:
+       mtctr   r5
+..d_ag3:
+       dcbz    r0,r3
+       addi    r3,r3,32
+       bdnz    ..d_ag3
+       /*----------------------------------------------------------------*/
+       /* Setup the stack in internal SRAM */
+       /*----------------------------------------------------------------*/
+       lis     r1,CFG_INIT_RAM_ADDR@h
+       ori     r1,r1,CFG_INIT_SP_OFFSET@l
+       li      r0,0
+       stwu    r0,-4(r1)
+       stwu    r0,-4(r1)               /* Terminate call chain */
+
+       stwu    r1,-8(r1)               /* Save back chain and move SP */
+       lis     r0,RESET_VECTOR@h       /* Address of reset vector */
+       ori     r0,r0, RESET_VECTOR@l
+       stwu    r1,-8(r1)               /* Save back chain and move SP */
+       stw     r0,+12(r1)              /* Save return addr (underflow vect) */
+       sync
+       bl      early_sdram_init
+       sync
+#endif /* CONFIG_440EP */
 
        /*
         * Copy SPL from cache into internal SRAM
@@ -429,7 +480,7 @@ spl_loop:
 start_ram:
        sync
        isync
-#endif
+#endif /* CONFIG_NAND_SPL */
 
        bl      3f
        b       _start
@@ -454,11 +505,81 @@ version_string:
        .ascii " (", __DATE__, " - ", __TIME__, ")"
        .ascii CONFIG_IDENT_STRING, "\0"
 
-/*
- * Maybe this should be moved somewhere else because the current
- * location (0x100) is where the CriticalInput Execption should be.
- */
        . = EXC_OFF_SYS_RESET
+       .globl  _start_of_vectors
+_start_of_vectors:
+
+/* Critical input. */
+       CRIT_EXCEPTION(0x100, CritcalInput, UnknownException)
+
+#ifdef CONFIG_440
+/* Machine check */
+       MCK_EXCEPTION(0x200, MachineCheck, MachineCheckException)
+#else
+       CRIT_EXCEPTION(0x200, MachineCheck, MachineCheckException)
+#endif /* CONFIG_440 */
+
+/* Data Storage exception. */
+       STD_EXCEPTION(0x300, DataStorage, UnknownException)
+
+/* Instruction Storage exception. */
+       STD_EXCEPTION(0x400, InstStorage, UnknownException)
+
+/* External Interrupt exception. */
+       STD_EXCEPTION(0x500, ExtInterrupt, external_interrupt)
+
+/* Alignment exception. */
+       . = 0x600
+Alignment:
+       EXCEPTION_PROLOG(SRR0, SRR1)
+       mfspr   r4,DAR
+       stw     r4,_DAR(r21)
+       mfspr   r5,DSISR
+       stw     r5,_DSISR(r21)
+       addi    r3,r1,STACK_FRAME_OVERHEAD
+       li      r20,MSR_KERNEL
+       rlwimi  r20,r23,0,16,16         /* copy EE bit from saved MSR */
+       lwz     r6,GOT(transfer_to_handler)
+       mtlr    r6
+       blrl
+.L_Alignment:
+       .long   AlignmentException - _start + _START_OFFSET
+       .long   int_return - _start + _START_OFFSET
+
+/* Program check exception */
+       . = 0x700
+ProgramCheck:
+       EXCEPTION_PROLOG(SRR0, SRR1)
+       addi    r3,r1,STACK_FRAME_OVERHEAD
+       li      r20,MSR_KERNEL
+       rlwimi  r20,r23,0,16,16         /* copy EE bit from saved MSR */
+       lwz     r6,GOT(transfer_to_handler)
+       mtlr    r6
+       blrl
+.L_ProgramCheck:
+       .long   ProgramCheckException - _start + _START_OFFSET
+       .long   int_return - _start + _START_OFFSET
+
+#ifdef CONFIG_440
+       STD_EXCEPTION(0x800, FPUnavailable, UnknownException)
+       STD_EXCEPTION(0x900, Decrementer, DecrementerPITException)
+       STD_EXCEPTION(0xa00, APU, UnknownException)
+#endif
+       STD_EXCEPTION(0xc00, SystemCall, UnknownException)
+
+#ifdef CONFIG_440
+       STD_EXCEPTION(0x1300, DataTLBError, UnknownException)
+       STD_EXCEPTION(0x1400, InstructionTLBError, UnknownException)
+#else
+       STD_EXCEPTION(0x1000, PIT, DecrementerPITException)
+       STD_EXCEPTION(0x1100, InstructionTLBMiss, UnknownException)
+       STD_EXCEPTION(0x1200, DataTLBMiss, UnknownException)
+#endif
+       CRIT_EXCEPTION(0x2000, DebugBreakpoint, DebugException )
+
+       .globl  _end_of_vectors
+_end_of_vectors:
+       . = _START_OFFSET
 #endif
        .globl  _start
 _start:
@@ -768,22 +889,22 @@ _start:
         */
        lis     r3,CFG_OCM_DATA_ADDR@h  /* OCM location */
        ori     r3,r3,CFG_OCM_DATA_ADDR@l
-       ori     r3,r3,0x8270    /* 32K Offset, 16K for Bank 1, R/W/Enable */
+       ori     r3,r3,0x0270            /* 16K for Bank 1, R/W/Enable */
        mtdcr   ocmplb3cr1,r3           /* Set PLB Access */
        ori     r3,r3,0x4000            /* Add 0x4000 for bank 2 */
        mtdcr   ocmplb3cr2,r3           /* Set PLB Access */
        isync
 
-       lis     r3,CFG_OCM_DATA_ADDR@h  /* OCM location */
+       lis     r3,CFG_OCM_DATA_ADDR@h  /* OCM location */
        ori     r3,r3,CFG_OCM_DATA_ADDR@l
-       ori     r3,r3,0x0270            /* 16K for Bank 1, R/W/Enable */
-       mtdcr   ocmdscr1, r3            /* Set Data Side */
-       mtdcr   ocmiscr1, r3            /* Set Instruction Side */
+       ori     r3,r3,0x0270            /* 16K for Bank 1, R/W/Enable */
+       mtdcr   ocmdscr1, r3            /* Set Data Side */
+       mtdcr   ocmiscr1, r3            /* Set Instruction Side */
        ori     r3,r3,0x4000            /* Add 0x4000 for bank 2 */
-       mtdcr   ocmdscr2, r3            /* Set Data Side */
-       mtdcr   ocmiscr2, r3            /* Set Instruction Side */
-       addis   r3,0,0x0800             /* OCM Data Parity Disable - 1 Wait State */
-       mtdcr   ocmdsisdpc,r4
+       mtdcr   ocmdscr2, r3            /* Set Data Side */
+       mtdcr   ocmiscr2, r3            /* Set Instruction Side */
+       addis   r3,0,0x0800             /* OCM Data Parity Disable - 1 Wait State */
+       mtdcr   ocmdsisdpc,r3
 
        isync
 #else /* CONFIG_405EZ */
@@ -801,7 +922,7 @@ _start:
        mtdcr   ocmdscntl, r4           /* set data-side IRAM config */
        isync
 
-       lis     r3,CFG_OCM_DATA_ADDR@h  /* OCM location */
+       lis     r3,CFG_OCM_DATA_ADDR@h  /* OCM location */
        ori     r3,r3,CFG_OCM_DATA_ADDR@l
        mtdcr   ocmdsarc, r3
        addis   r4, 0, 0xC000           /* OCM data area enabled */
@@ -810,6 +931,38 @@ _start:
 #endif /* CONFIG_405EZ */
 #endif
 
+#ifdef CONFIG_NAND_SPL
+       /*
+        * Copy SPL from cache into internal SRAM
+        */
+       li      r4,(CFG_NAND_BOOT_SPL_SIZE >> 2) - 1
+       mtctr   r4
+       lis     r2,CFG_NAND_BOOT_SPL_SRC@h
+       ori     r2,r2,CFG_NAND_BOOT_SPL_SRC@l
+       lis     r3,CFG_NAND_BOOT_SPL_DST@h
+       ori     r3,r3,CFG_NAND_BOOT_SPL_DST@l
+spl_loop:
+       lwzu    r4,4(r2)
+       stwu    r4,4(r3)
+       bdnz    spl_loop
+
+       /*
+        * Jump to code in RAM
+        */
+       bl      00f
+00:    mflr    r10
+       lis     r3,(CFG_NAND_BOOT_SPL_SRC - CFG_NAND_BOOT_SPL_DST)@h
+       ori     r3,r3,(CFG_NAND_BOOT_SPL_SRC - CFG_NAND_BOOT_SPL_DST)@l
+       sub     r10,r10,r3
+       addi    r10,r10,28
+       mtlr    r10
+       blr
+
+start_ram:
+       sync
+       isync
+#endif /* CONFIG_NAND_SPL */
+
        /*----------------------------------------------------------------------- */
        /* Setup temporary stack in DCACHE or OCM if needed for SDRAM SPD. */
        /*----------------------------------------------------------------------- */
@@ -920,119 +1073,22 @@ _start:
        stw     r0, +12(r1)             /* Save return addr (underflow vect) */
 #endif /* !(CFG_INIT_DCACHE_CS || !CFG_TEM_STACK_OCM) */
 
+#ifdef CONFIG_NAND_SPL
+       bl      nand_boot               /* will not return */
+#else
        GET_GOT                 /* initialize GOT access                        */
 
        bl      cpu_init_f      /* run low-level CPU init code     (from Flash) */
 
        /* NEVER RETURNS! */
        bl      board_init_f    /* run first part of init code (from Flash)     */
+#endif /* CONFIG_NAND_SPL */
 
 #endif /* CONFIG_405GP || CONFIG_405CR || CONFIG_405 || CONFIG_405EP */
        /*----------------------------------------------------------------------- */
 
 
 #ifndef CONFIG_NAND_SPL
-/*****************************************************************************/
-       .globl  _start_of_vectors
-_start_of_vectors:
-
-#if 0
-/*TODO Fixup _start above so we can do this*/
-/* Critical input. */
-       CRIT_EXCEPTION(0x100, CritcalInput, CritcalInputException)
-#endif
-
-/* Machine check */
-       CRIT_EXCEPTION(0x200, MachineCheck, MachineCheckException)
-
-/* Data Storage exception. */
-       STD_EXCEPTION(0x300, DataStorage, UnknownException)
-
-/* Instruction Storage exception. */
-       STD_EXCEPTION(0x400, InstStorage, UnknownException)
-
-/* External Interrupt exception. */
-       STD_EXCEPTION(0x500, ExtInterrupt, external_interrupt)
-
-/* Alignment exception. */
-       . = 0x600
-Alignment:
-       EXCEPTION_PROLOG
-       mfspr   r4,DAR
-       stw     r4,_DAR(r21)
-       mfspr   r5,DSISR
-       stw     r5,_DSISR(r21)
-       addi    r3,r1,STACK_FRAME_OVERHEAD
-       li      r20,MSR_KERNEL
-       rlwimi  r20,r23,0,16,16         /* copy EE bit from saved MSR */
-       lwz     r6,GOT(transfer_to_handler)
-       mtlr    r6
-       blrl
-.L_Alignment:
-       .long   AlignmentException - _start + EXC_OFF_SYS_RESET
-       .long   int_return - _start + EXC_OFF_SYS_RESET
-
-/* Program check exception */
-       . = 0x700
-ProgramCheck:
-       EXCEPTION_PROLOG
-       addi    r3,r1,STACK_FRAME_OVERHEAD
-       li      r20,MSR_KERNEL
-       rlwimi  r20,r23,0,16,16         /* copy EE bit from saved MSR */
-       lwz     r6,GOT(transfer_to_handler)
-       mtlr    r6
-       blrl
-.L_ProgramCheck:
-       .long   ProgramCheckException - _start + EXC_OFF_SYS_RESET
-       .long   int_return - _start + EXC_OFF_SYS_RESET
-
-       /* No FPU on MPC8xx.  This exception is not supposed to happen.
-       */
-       STD_EXCEPTION(0x800, FPUnavailable, UnknownException)
-
-       /* I guess we could implement decrementer, and may have
-        * to someday for timekeeping.
-        */
-       STD_EXCEPTION(0x900, Decrementer, timer_interrupt)
-       STD_EXCEPTION(0xa00, Trap_0a, UnknownException)
-       STD_EXCEPTION(0xb00, Trap_0b, UnknownException)
-       STD_EXCEPTION(0xc00, SystemCall, UnknownException)
-       STD_EXCEPTION(0xd00, SingleStep, UnknownException)
-
-       STD_EXCEPTION(0xe00, Trap_0e, UnknownException)
-       STD_EXCEPTION(0xf00, Trap_0f, UnknownException)
-
-       /* On the MPC8xx, this is a software emulation interrupt.  It occurs
-        * for all unimplemented and illegal instructions.
-        */
-       STD_EXCEPTION(0x1000, PIT, PITException)
-
-       STD_EXCEPTION(0x1100, InstructionTLBMiss, UnknownException)
-       STD_EXCEPTION(0x1200, DataTLBMiss, UnknownException)
-       STD_EXCEPTION(0x1300, InstructionTLBError, UnknownException)
-       STD_EXCEPTION(0x1400, DataTLBError, UnknownException)
-
-       STD_EXCEPTION(0x1500, Reserved5, UnknownException)
-       STD_EXCEPTION(0x1600, Reserved6, UnknownException)
-       STD_EXCEPTION(0x1700, Reserved7, UnknownException)
-       STD_EXCEPTION(0x1800, Reserved8, UnknownException)
-       STD_EXCEPTION(0x1900, Reserved9, UnknownException)
-       STD_EXCEPTION(0x1a00, ReservedA, UnknownException)
-       STD_EXCEPTION(0x1b00, ReservedB, UnknownException)
-
-       STD_EXCEPTION(0x1c00, DataBreakpoint, UnknownException)
-       STD_EXCEPTION(0x1d00, InstructionBreakpoint, UnknownException)
-       STD_EXCEPTION(0x1e00, PeripheralBreakpoint, UnknownException)
-       STD_EXCEPTION(0x1f00, DevPortBreakpoint, UnknownException)
-
-       CRIT_EXCEPTION(0x2000, DebugBreakpoint, DebugException )
-
-       .globl  _end_of_vectors
-_end_of_vectors:
-
-
-       . = 0x2100
-
 /*
  * This code finishes saving the registers to the exception frame
  * and jumps to the appropriate handler for the exception.
@@ -1048,28 +1104,12 @@ transfer_to_handler:
        SAVE_4GPRS(8, r21)
        SAVE_8GPRS(12, r21)
        SAVE_8GPRS(24, r21)
-#if 0
-       andi.   r23,r23,MSR_PR
-       mfspr   r23,SPRG3               /* if from user, fix up tss.regs */
-       beq     2f
-       addi    r24,r1,STACK_FRAME_OVERHEAD
-       stw     r24,PT_REGS(r23)
-2:     addi    r2,r23,-TSS             /* set r2 to current */
-       tovirt(r2,r2,r23)
-#endif
        mflr    r23
        andi.   r24,r23,0x3f00          /* get vector offset */
        stw     r24,TRAP(r21)
        li      r22,0
        stw     r22,RESULT(r21)
        mtspr   SPRG2,r22               /* r1 is now kernel sp */
-#if 0
-       addi    r24,r2,TASK_STRUCT_SIZE /* check for kernel stack overflow */
-       cmplw   0,r1,r2
-       cmplw   1,r1,r24
-       crand   1,1,4
-       bgt     stack_ovf               /* if r2 < r1 < r2+TASK_STRUCT_SIZE */
-#endif
        lwz     r24,0(r23)              /* virtual address of handler */
        lwz     r23,4(r23)              /* where to go when done */
        mtspr   SRR0,r24
@@ -1130,34 +1170,64 @@ crit_return:
        REST_GPR(31, r1)
        lwz     r2,_NIP(r1)     /* Restore environment */
        lwz     r0,_MSR(r1)
-       mtspr   990,r2          /* SRR2 */
-       mtspr   991,r0          /* SRR3 */
+       mtspr   csrr0,r2
+       mtspr   csrr1,r0
        lwz     r0,GPR0(r1)
        lwz     r2,GPR2(r1)
        lwz     r1,GPR1(r1)
        SYNC
        rfci
-#endif /* CONFIG_NAND_SPL */
 
-/* Cache functions.
-*/
-invalidate_icache:
-       iccci   r0,r0                   /* for 405, iccci invalidates the */
-       blr                             /*   entire I cache */
+#ifdef CONFIG_440
+mck_return:
+       mfmsr   r28             /* Disable interrupts */
+       li      r4,0
+       ori     r4,r4,MSR_EE
+       andc    r28,r28,r4
+       SYNC                    /* Some chip revs need this... */
+       mtmsr   r28
+       SYNC
+       lwz     r2,_CTR(r1)
+       lwz     r0,_LINK(r1)
+       mtctr   r2
+       mtlr    r0
+       lwz     r2,_XER(r1)
+       lwz     r0,_CCR(r1)
+       mtspr   XER,r2
+       mtcrf   0xFF,r0
+       REST_10GPRS(3, r1)
+       REST_10GPRS(13, r1)
+       REST_8GPRS(23, r1)
+       REST_GPR(31, r1)
+       lwz     r2,_NIP(r1)     /* Restore environment */
+       lwz     r0,_MSR(r1)
+       mtspr   mcsrr0,r2
+       mtspr   mcsrr1,r0
+       lwz     r0,GPR0(r1)
+       lwz     r2,GPR2(r1)
+       lwz     r1,GPR1(r1)
+       SYNC
+       rfmci
+#endif /* CONFIG_440 */
 
-invalidate_dcache:
-       addi    r6,0,0x0000             /* clear GPR 6 */
-       /* Do loop for # of dcache congruence classes. */
-       lis     r7, (CFG_DCACHE_SIZE / CFG_CACHELINE_SIZE / 2)@ha       /* TBS for large sized cache */
-       ori     r7, r7, (CFG_DCACHE_SIZE / CFG_CACHELINE_SIZE / 2)@l
-                                       /* NOTE: dccci invalidates both */
-       mtctr   r7                      /* ways in the D cache */
-..dcloop:
-       dccci   0,r6                    /* invalidate line */
-       addi    r6,r6, CFG_CACHELINE_SIZE /* bump to next line */
-       bdnz    ..dcloop
+
+/*
+ * Cache functions.
+ *
+ * NOTE: currently the 440s run with dcache _disabled_ once relocated to DRAM,
+ * although for some cache-ralated calls stubs have to be provided to satisfy
+ * symbols resolution.
+ *
+ */
+#ifdef CONFIG_440
+       .globl  dcache_disable
+dcache_disable:
        blr
 
+       .globl  dcache_status
+dcache_status:
+       blr
+#else
 flush_dcache:
        addis   r9,r0,0x0002            /* set mask for EE and CE msr bits */
        ori     r9,r9,0x8000
@@ -1236,42 +1306,13 @@ dcache_status:
        mfdccr  r3
        srwi    r3, r3, 31      /* >>31 => select bit 0 */
        blr
+#endif
 
        .globl get_pvr
 get_pvr:
        mfspr   r3, PVR
        blr
 
-#if !defined(CONFIG_440)
-       .globl wr_pit
-wr_pit:
-       mtspr   pit, r3
-       blr
-#endif
-
-       .globl wr_tcr
-wr_tcr:
-       mtspr   tcr, r3
-       blr
-
-/*------------------------------------------------------------------------------- */
-/* Function:    in8 */
-/* Description:         Input 8 bits */
-/*------------------------------------------------------------------------------- */
-       .globl  in8
-in8:
-       lbz     r3,0x0000(r3)
-       blr
-
-/*------------------------------------------------------------------------------- */
-/* Function:    out8 */
-/* Description:         Output 8 bits */
-/*------------------------------------------------------------------------------- */
-       .globl  out8
-out8:
-       stb     r4,0x0000(r3)
-       blr
-
 /*------------------------------------------------------------------------------- */
 /* Function:    out16 */
 /* Description:         Output 16 bits */
@@ -1291,15 +1332,6 @@ out16r:
        blr
 
 /*------------------------------------------------------------------------------- */
-/* Function:    out32 */
-/* Description:         Output 32 bits */
-/*------------------------------------------------------------------------------- */
-       .globl  out32
-out32:
-       stw     r4,0x0000(r3)
-       blr
-
-/*------------------------------------------------------------------------------- */
 /* Function:    out32r */
 /* Description:         Byte reverse and output 32 bits */
 /*------------------------------------------------------------------------------- */
@@ -1327,15 +1359,6 @@ in16r:
        blr
 
 /*------------------------------------------------------------------------------- */
-/* Function:    in32 */
-/* Description:         Input 32 bits */
-/*------------------------------------------------------------------------------- */
-       .globl  in32
-in32:
-       lwz     3,0x0000(3)
-       blr
-
-/*------------------------------------------------------------------------------- */
 /* Function:    in32r */
 /* Description:         Input 32 bits and byte reverse */
 /*------------------------------------------------------------------------------- */
@@ -1377,9 +1400,6 @@ ppcSync:
        sync
        blr
 
-/*------------------------------------------------------------------------------*/
-
-#ifndef CONFIG_NAND_SPL
 /*
  * void relocate_code (addr_sp, gd, addr_moni)
  *
@@ -1490,7 +1510,7 @@ relocate_code:
  * initialization, now running from RAM.
  */
 
-       addi    r0, r10, in_ram - _start + EXC_OFF_SYS_RESET
+       addi    r0, r10, in_ram - _start + _START_OFFSET
        mtlr    r0
        blr                             /* NEVER RETURNS! */
 
@@ -1560,7 +1580,7 @@ clear_bss:
         */
        .globl  trap_init
 trap_init:
-       lwz     r7, GOT(_start)
+       lwz     r7, GOT(_start_of_vectors)
        lwz     r8, GOT(_end_of_vectors)
 
        li      r9, 0x100               /* reset vector always at 0x100 */
@@ -1580,35 +1600,48 @@ trap_init:
        /*
         * relocate `hdlr' and `int_return' entries
         */
-       li      r7, .L_MachineCheck - _start + EXC_OFF_SYS_RESET
-       li      r8, Alignment - _start + EXC_OFF_SYS_RESET
+       li      r7, .L_MachineCheck - _start + _START_OFFSET
+       li      r8, Alignment - _start + _START_OFFSET
 2:
        bl      trap_reloc
-       addi    r7, r7, 0x100           /* next exception vector        */
+       addi    r7, r7, 0x100           /* next exception vector */
        cmplw   0, r7, r8
        blt     2b
 
-       li      r7, .L_Alignment - _start + EXC_OFF_SYS_RESET
+       li      r7, .L_Alignment - _start + _START_OFFSET
        bl      trap_reloc
 
-       li      r7, .L_ProgramCheck - _start + EXC_OFF_SYS_RESET
+       li      r7, .L_ProgramCheck - _start + _START_OFFSET
        bl      trap_reloc
 
-       li      r7, .L_FPUnavailable - _start + EXC_OFF_SYS_RESET
-       li      r8, SystemCall - _start + EXC_OFF_SYS_RESET
-3:
+#ifdef CONFIG_440
+       li      r7, .L_FPUnavailable - _start + _START_OFFSET
        bl      trap_reloc
-       addi    r7, r7, 0x100           /* next exception vector        */
-       cmplw   0, r7, r8
-       blt     3b
 
-       li      r7, .L_SingleStep - _start + EXC_OFF_SYS_RESET
-       li      r8, _end_of_vectors - _start + EXC_OFF_SYS_RESET
-4:
+       li      r7, .L_Decrementer - _start + _START_OFFSET
+       bl      trap_reloc
+
+       li      r7, .L_APU - _start + _START_OFFSET
+       bl      trap_reloc
+
+       li      r7, .L_InstructionTLBError - _start + _START_OFFSET
+       bl      trap_reloc
+
+       li      r7, .L_DataTLBError - _start + _START_OFFSET
+       bl      trap_reloc
+#else /* CONFIG_440 */
+       li      r7, .L_PIT - _start + _START_OFFSET
+       bl      trap_reloc
+
+       li      r7, .L_InstructionTLBMiss - _start + _START_OFFSET
+       bl      trap_reloc
+
+       li      r7, .L_DataTLBMiss - _start + _START_OFFSET
+       bl      trap_reloc
+#endif /* CONFIG_440 */
+
+       li      r7, .L_DebugBreakpoint - _start + _START_OFFSET
        bl      trap_reloc
-       addi    r7, r7, 0x100           /* next exception vector        */
-       cmplw   0, r7, r8
-       blt     4b
 
 #if !defined(CONFIG_440)
        addi    r7,r0,0x1000            /* set ME bit (Machine Exceptions) */
@@ -1644,8 +1677,105 @@ trap_reloc:
        stw     r0, 4(r7)
 
        blr
+
+#if defined(CONFIG_440)
+/*----------------------------------------------------------------------------+
+| dcbz_area.
++----------------------------------------------------------------------------*/
+       function_prolog(dcbz_area)
+       rlwinm. r5,r4,0,27,31
+       rlwinm  r5,r4,27,5,31
+       beq     ..d_ra2
+       addi    r5,r5,0x0001
+..d_ra2:mtctr  r5
+..d_ag2:dcbz   r0,r3
+       addi    r3,r3,32
+       bdnz    ..d_ag2
+       sync
+       blr
+       function_epilog(dcbz_area)
+
+/*----------------------------------------------------------------------------+
+| dflush.  Assume 32K at vector address is cachable.
++----------------------------------------------------------------------------*/
+       function_prolog(dflush)
+       mfmsr   r9
+       rlwinm  r8,r9,0,15,13
+       rlwinm  r8,r8,0,17,15
+       mtmsr   r8
+       addi    r3,r0,0x0000
+       mtspr   dvlim,r3
+       mfspr   r3,ivpr
+       addi    r4,r0,1024
+       mtctr   r4
+..dflush_loop:
+       lwz     r6,0x0(r3)
+       addi    r3,r3,32
+       bdnz    ..dflush_loop
+       addi    r3,r3,-32
+       mtctr   r4
+..ag:  dcbf    r0,r3
+       addi    r3,r3,-32
+       bdnz    ..ag
+       sync
+       mtmsr   r9
+       blr
+       function_epilog(dflush)
+#endif /* CONFIG_440 */
 #endif /* CONFIG_NAND_SPL */
 
+/*------------------------------------------------------------------------------- */
+/* Function:    in8 */
+/* Description:         Input 8 bits */
+/*------------------------------------------------------------------------------- */
+       .globl  in8
+in8:
+       lbz     r3,0x0000(r3)
+       blr
+
+/*------------------------------------------------------------------------------- */
+/* Function:    out8 */
+/* Description:         Output 8 bits */
+/*------------------------------------------------------------------------------- */
+       .globl  out8
+out8:
+       stb     r4,0x0000(r3)
+       blr
+
+/*------------------------------------------------------------------------------- */
+/* Function:    out32 */
+/* Description:         Output 32 bits */
+/*------------------------------------------------------------------------------- */
+       .globl  out32
+out32:
+       stw     r4,0x0000(r3)
+       blr
+
+/*------------------------------------------------------------------------------- */
+/* Function:    in32 */
+/* Description:         Input 32 bits */
+/*------------------------------------------------------------------------------- */
+       .globl  in32
+in32:
+       lwz     3,0x0000(3)
+       blr
+
+invalidate_icache:
+       iccci   r0,r0                   /* for 405, iccci invalidates the */
+       blr                             /*   entire I cache */
+
+invalidate_dcache:
+       addi    r6,0,0x0000             /* clear GPR 6 */
+       /* Do loop for # of dcache congruence classes. */
+       lis     r7, (CFG_DCACHE_SIZE / CFG_CACHELINE_SIZE / 2)@ha       /* TBS for large sized cache */
+       ori     r7, r7, (CFG_DCACHE_SIZE / CFG_CACHELINE_SIZE / 2)@l
+                                       /* NOTE: dccci invalidates both */
+       mtctr   r7                      /* ways in the D cache */
+..dcloop:
+       dccci   0,r6                    /* invalidate line */
+       addi    r6,r6, CFG_CACHELINE_SIZE /* bump to next line */
+       bdnz    ..dcloop
+       blr
 
 /**************************************************************************/
 /* PPC405EP specific stuff                                               */
@@ -1892,13 +2022,6 @@ pll_wait:
 #endif /* CONFIG_405EP */
 
 #if defined(CONFIG_440)
-#define function_prolog(func_name)     .text; \
-                                       .align 2; \
-                                       .globl func_name; \
-                                       func_name:
-#define function_epilog(func_name)     .type func_name,@function; \
-                                       .size func_name,.-func_name
-
 /*----------------------------------------------------------------------------+
 | mttlb3.
 +----------------------------------------------------------------------------*/
@@ -1946,47 +2069,4 @@ pll_wait:
        TLBRE(3,3,0)
        blr
        function_epilog(mftlb1)
-
-/*----------------------------------------------------------------------------+
-| dcbz_area.
-+----------------------------------------------------------------------------*/
-       function_prolog(dcbz_area)
-       rlwinm. r5,r4,0,27,31
-       rlwinm  r5,r4,27,5,31
-       beq     ..d_ra2
-       addi    r5,r5,0x0001
-..d_ra2:mtctr  r5
-..d_ag2:dcbz   r0,r3
-       addi    r3,r3,32
-       bdnz    ..d_ag2
-       sync
-       blr
-       function_epilog(dcbz_area)
-
-/*----------------------------------------------------------------------------+
-| dflush.  Assume 32K at vector address is cachable.
-+----------------------------------------------------------------------------*/
-       function_prolog(dflush)
-       mfmsr   r9
-       rlwinm  r8,r9,0,15,13
-       rlwinm  r8,r8,0,17,15
-       mtmsr   r8
-       addi    r3,r0,0x0000
-       mtspr   dvlim,r3
-       mfspr   r3,ivpr
-       addi    r4,r0,1024
-       mtctr   r4
-..dflush_loop:
-       lwz     r6,0x0(r3)
-       addi    r3,r3,32
-       bdnz    ..dflush_loop
-       addi    r3,r3,-32
-       mtctr   r4
-..ag:  dcbf    r0,r3
-       addi    r3,r3,-32
-       bdnz    ..ag
-       sync
-       mtmsr   r9
-       blr
-       function_epilog(dflush)
 #endif /* CONFIG_440 */
index 50344a4..049a785 100644 (file)
@@ -36,7 +36,8 @@ typedef struct region {
        unsigned long tlb_word2_i_value;
 } region_t;
 
-static int add_tlb_entry(unsigned long base_addr,
+static int add_tlb_entry(unsigned long phys_addr,
+                        unsigned long virt_addr,
                         unsigned long tlb_word0_size_value,
                         unsigned long tlb_word2_i_value)
 {
@@ -55,9 +56,9 @@ static int add_tlb_entry(unsigned long base_addr,
                return -1;
 
        /* Second, create the TLB entry */
-       tlb_word0_value = TLB_WORD0_EPN_ENCODE(base_addr) | TLB_WORD0_V_ENABLE |
+       tlb_word0_value = TLB_WORD0_EPN_ENCODE(virt_addr) | TLB_WORD0_V_ENABLE |
                TLB_WORD0_TS_0 | tlb_word0_size_value;
-       tlb_word1_value = TLB_WORD1_RPN_ENCODE(base_addr) | TLB_WORD1_ERPN_ENCODE(0);
+       tlb_word1_value = TLB_WORD1_RPN_ENCODE(phys_addr) | TLB_WORD1_ERPN_ENCODE(0);
        tlb_word2_value = TLB_WORD2_U0_DISABLE | TLB_WORD2_U1_DISABLE |
                TLB_WORD2_U2_DISABLE | TLB_WORD2_U3_DISABLE |
                TLB_WORD2_W_DISABLE | tlb_word2_i_value |
@@ -81,7 +82,9 @@ static int add_tlb_entry(unsigned long base_addr,
        return 0;
 }
 
-static void program_tlb_addr(unsigned long base_addr, unsigned long mem_size,
+static void program_tlb_addr(unsigned long phys_addr,
+                            unsigned long virt_addr,
+                            unsigned long mem_size,
                             unsigned long tlb_word2_i_value)
 {
        int rc;
@@ -91,70 +94,86 @@ static void program_tlb_addr(unsigned long base_addr, unsigned long mem_size,
        while (mem_size != 0) {
                rc = 0;
                /* Add the TLB entries in to map the region. */
-               if (((base_addr & TLB_256MB_ALIGN_MASK) == base_addr) &&
+               if (((phys_addr & TLB_256MB_ALIGN_MASK) == phys_addr) &&
                    (mem_size >= TLB_256MB_SIZE)) {
                        /* Add a 256MB TLB entry */
-                       if ((rc = add_tlb_entry(base_addr, TLB_WORD0_SIZE_256MB, tlb_i)) == 0) {
+                       if ((rc = add_tlb_entry(phys_addr, virt_addr,
+                                               TLB_WORD0_SIZE_256MB, tlb_i)) == 0) {
                                mem_size -= TLB_256MB_SIZE;
-                               base_addr += TLB_256MB_SIZE;
+                               phys_addr += TLB_256MB_SIZE;
+                               virt_addr += TLB_256MB_SIZE;
                        }
-               } else if (((base_addr & TLB_16MB_ALIGN_MASK) == base_addr) &&
+               } else if (((phys_addr & TLB_16MB_ALIGN_MASK) == phys_addr) &&
                           (mem_size >= TLB_16MB_SIZE)) {
                        /* Add a 16MB TLB entry */
-                       if ((rc = add_tlb_entry(base_addr, TLB_WORD0_SIZE_16MB, tlb_i)) == 0) {
+                       if ((rc = add_tlb_entry(phys_addr, virt_addr,
+                                               TLB_WORD0_SIZE_16MB, tlb_i)) == 0) {
                                mem_size -= TLB_16MB_SIZE;
-                               base_addr += TLB_16MB_SIZE;
+                               phys_addr += TLB_16MB_SIZE;
+                               virt_addr += TLB_16MB_SIZE;
                        }
-               } else if (((base_addr & TLB_1MB_ALIGN_MASK) == base_addr) &&
+               } else if (((phys_addr & TLB_1MB_ALIGN_MASK) == phys_addr) &&
                           (mem_size >= TLB_1MB_SIZE)) {
                        /* Add a 1MB TLB entry */
-                       if ((rc = add_tlb_entry(base_addr, TLB_WORD0_SIZE_1MB, tlb_i)) == 0) {
+                       if ((rc = add_tlb_entry(phys_addr, virt_addr,
+                                               TLB_WORD0_SIZE_1MB, tlb_i)) == 0) {
                                mem_size -= TLB_1MB_SIZE;
-                               base_addr += TLB_1MB_SIZE;
+                               phys_addr += TLB_1MB_SIZE;
+                               virt_addr += TLB_1MB_SIZE;
                        }
-               } else if (((base_addr & TLB_256KB_ALIGN_MASK) == base_addr) &&
+               } else if (((phys_addr & TLB_256KB_ALIGN_MASK) == phys_addr) &&
                           (mem_size >= TLB_256KB_SIZE)) {
                        /* Add a 256KB TLB entry */
-                       if ((rc = add_tlb_entry(base_addr, TLB_WORD0_SIZE_256KB, tlb_i)) == 0) {
+                       if ((rc = add_tlb_entry(phys_addr, virt_addr,
+                                               TLB_WORD0_SIZE_256KB, tlb_i)) == 0) {
                                mem_size -= TLB_256KB_SIZE;
-                               base_addr += TLB_256KB_SIZE;
+                               phys_addr += TLB_256KB_SIZE;
+                               virt_addr += TLB_256KB_SIZE;
                        }
-               } else if (((base_addr & TLB_64KB_ALIGN_MASK) == base_addr) &&
+               } else if (((phys_addr & TLB_64KB_ALIGN_MASK) == phys_addr) &&
                           (mem_size >= TLB_64KB_SIZE)) {
                        /* Add a 64KB TLB entry */
-                       if ((rc = add_tlb_entry(base_addr, TLB_WORD0_SIZE_64KB, tlb_i)) == 0) {
+                       if ((rc = add_tlb_entry(phys_addr, virt_addr,
+                                               TLB_WORD0_SIZE_64KB, tlb_i)) == 0) {
                                mem_size -= TLB_64KB_SIZE;
-                               base_addr += TLB_64KB_SIZE;
+                               phys_addr += TLB_64KB_SIZE;
+                               virt_addr += TLB_64KB_SIZE;
                        }
-               } else if (((base_addr & TLB_16KB_ALIGN_MASK) == base_addr) &&
+               } else if (((phys_addr & TLB_16KB_ALIGN_MASK) == phys_addr) &&
                           (mem_size >= TLB_16KB_SIZE)) {
                        /* Add a 16KB TLB entry */
-                       if ((rc = add_tlb_entry(base_addr, TLB_WORD0_SIZE_16KB, tlb_i)) == 0) {
+                       if ((rc = add_tlb_entry(phys_addr, virt_addr,
+                                               TLB_WORD0_SIZE_16KB, tlb_i)) == 0) {
                                mem_size -= TLB_16KB_SIZE;
-                               base_addr += TLB_16KB_SIZE;
+                               phys_addr += TLB_16KB_SIZE;
+                               virt_addr += TLB_16KB_SIZE;
                        }
-               } else if (((base_addr & TLB_4KB_ALIGN_MASK) == base_addr) &&
+               } else if (((phys_addr & TLB_4KB_ALIGN_MASK) == phys_addr) &&
                           (mem_size >= TLB_4KB_SIZE)) {
                        /* Add a 4KB TLB entry */
-                       if ((rc = add_tlb_entry(base_addr, TLB_WORD0_SIZE_4KB, tlb_i)) == 0) {
+                       if ((rc = add_tlb_entry(phys_addr, virt_addr,
+                                               TLB_WORD0_SIZE_4KB, tlb_i)) == 0) {
                                mem_size -= TLB_4KB_SIZE;
-                               base_addr += TLB_4KB_SIZE;
+                               phys_addr += TLB_4KB_SIZE;
+                               virt_addr += TLB_4KB_SIZE;
                        }
-               } else if (((base_addr & TLB_1KB_ALIGN_MASK) == base_addr) &&
+               } else if (((phys_addr & TLB_1KB_ALIGN_MASK) == phys_addr) &&
                           (mem_size >= TLB_1KB_SIZE)) {
                        /* Add a 1KB TLB entry */
-                       if ((rc = add_tlb_entry(base_addr, TLB_WORD0_SIZE_1KB, tlb_i)) == 0) {
+                       if ((rc = add_tlb_entry(phys_addr, virt_addr,
+                                               TLB_WORD0_SIZE_1KB, tlb_i)) == 0) {
                                mem_size -= TLB_1KB_SIZE;
-                               base_addr += TLB_1KB_SIZE;
+                               phys_addr += TLB_1KB_SIZE;
+                               virt_addr += TLB_1KB_SIZE;
                        }
                } else {
                        printf("ERROR: no TLB size exists for the base address 0x%0X.\n",
-                               base_addr);
+                               phys_addr);
                }
 
                if (rc != 0)
                        printf("ERROR: no TLB entries available for the base addr 0x%0X.\n",
-                               base_addr);
+                               phys_addr);
        }
 
        return;
@@ -166,16 +185,16 @@ static void program_tlb_addr(unsigned long base_addr, unsigned long mem_size,
  * Common usage for boards with SDRAM DIMM modules to dynamically
  * configure the TLB's for the SDRAM
  */
-void program_tlb(u32 start, u32 size, u32 tlb_word2_i_value)
+void program_tlb(u32 phys_addr, u32 virt_addr, u32 size, u32 tlb_word2_i_value)
 {
        region_t region_array;
 
-       region_array.base = start;
+       region_array.base = phys_addr;
        region_array.size = size;
        region_array.tlb_word2_i_value = tlb_word2_i_value;     /* en-/disable cache */
 
        /* Call the routine to add in the tlb entries for the memory regions */
-       program_tlb_addr(region_array.base, region_array.size,
+       program_tlb_addr(region_array.base, virt_addr, region_array.size,
                         region_array.tlb_word2_i_value);
 
        return;
old mode 100644 (file)
new mode 100755 (executable)
index 6aecca2..eb9420e
@@ -36,6 +36,8 @@
 #include <command.h>
 #include <asm/processor.h>
 
+DECLARE_GLOBAL_DATA_PTR;
+
 #if (CONFIG_COMMANDS & CFG_CMD_KGDB)
 int (*debugger_exception_handler)(struct pt_regs *) = 0;
 #endif
@@ -45,8 +47,7 @@ extern unsigned long search_exception_table(unsigned long);
 
 /* THIS NEEDS CHANGING to use the board info structure.
  */
-#define END_OF_MEM     0x00400000
-
+#define END_OF_MEM     (gd->bd->bi_memstart + gd->bd->bi_memsize)
 
 static __inline__ void set_tsr(unsigned long val)
 {
@@ -110,7 +111,7 @@ void show_regs(struct pt_regs * regs)
 {
        int i;
 
-       printf("NIP: %08lX XER: %08lX LR: %08lX REGS: %p TRAP: %04lx DAR: %08lX\n",
+       printf("NIP: %08lX XER: %08lX LR: %08lX REGS: %p TRAP: %04lx DEAR: %08lX\n",
               regs->nip, regs->xer, regs->link, regs, regs->trap, regs->dar);
        printf("MSR: %08lx EE: %01x PR: %01x FP: %01x ME: %01x IR/DR: %01x%01x\n",
               regs->msr, regs->msr&MSR_EE ? 1 : 0, regs->msr&MSR_PR ? 1 : 0,
@@ -120,14 +121,12 @@ void show_regs(struct pt_regs * regs)
 
        printf("\n");
        for (i = 0;  i < 32;  i++) {
-               if ((i % 8) == 0)
-               {
+               if ((i % 8) == 0) {
                        printf("GPR%02d: ", i);
                }
 
                printf("%08lX ", regs->gpr[i]);
-               if ((i % 8) == 7)
-               {
+               if ((i % 8) == 7) {
                        printf("\n");
                }
        }
@@ -139,13 +138,16 @@ _exception(int signr, struct pt_regs *regs)
 {
        show_regs(regs);
        print_backtrace((unsigned long *)regs->gpr[1]);
-       panic("Exception in kernel pc %lx signal %d",regs->nip,signr);
+       panic("Exception");
 }
 
 void
 MachineCheckException(struct pt_regs *regs)
 {
-       unsigned long fixup;
+       unsigned long fixup, val;
+#if defined(CONFIG_440EPX) || defined(CONFIG_440GRX)
+       u32 value2;
+#endif
 
        /* Probing PCI using config cycles cause this exception
         * when a device is not present.  Catch it and return to
@@ -161,26 +163,132 @@ MachineCheckException(struct pt_regs *regs)
                return;
 #endif
 
-       printf("Machine check in kernel mode.\n");
+       printf("Machine Check Exception.\n");
        printf("Caused by (from msr): ");
-       printf("regs %p ",regs);
-       switch( regs->msr & 0x000F0000) {
-       case (0x80000000>>12):
-               printf("Machine check signal - probably due to mm fault\n"
-                      "with mmu off\n");
+       printf("regs %p ", regs);
+
+       val = get_esr();
+
+#if !defined(CONFIG_440)
+       if (val& ESR_IMCP) {
+               printf("Instruction");
+               mtspr(ESR, val & ~ESR_IMCP);
+       } else {
+               printf("Data");
+       }
+       printf(" machine check.\n");
+
+#elif defined(CONFIG_440)
+       if (val& ESR_IMCP){
+               printf("Instruction Synchronous Machine Check exception\n");
+               mtspr(SPRN_ESR, val & ~ESR_IMCP);
+       } else {
+               val = mfspr(MCSR);
+               if (val & MCSR_IB)
+                       printf("Instruction Read PLB Error\n");
+               if (val & MCSR_DRB)
+                       printf("Data Read PLB Error\n");
+               if (val & MCSR_DWB)
+                       printf("Data Write PLB Error\n");
+               if (val & MCSR_TLBP)
+                       printf("TLB Parity Error\n");
+               if (val & MCSR_ICP){
+                       /*flush_instruction_cache(); */
+                       printf("I-Cache Parity Error\n");
+               }
+               if (val & MCSR_DCSP)
+                       printf("D-Cache Search Parity Error\n");
+               if (val & MCSR_DCFP)
+                       printf("D-Cache Flush Parity Error\n");
+               if (val & MCSR_IMPE)
+                       printf("Machine Check exception is imprecise\n");
+
+               /* Clear MCSR */
+               mtspr(SPRN_MCSR, val);
+       }
+#if defined(CONFIG_440EPX) || defined(CONFIG_440GRX)
+       mfsdram(DDR0_00, val) ;
+       printf("DDR0: DDR0_00 %p\n", val);
+       val = (val >> 16) & 0xff;
+       if (val & 0x80)
+               printf("DDR0: At least one interrupt active\n");
+       if (val & 0x40)
+               printf("DDR0: DRAM initialization complete.\n");
+       if (val & 0x20)
+               printf("DDR0: Multiple uncorrectable ECC events.\n");
+       if (val & 0x10)
+               printf("DDR0: Single uncorrectable ECC event.\n");
+       if (val & 0x08)
+               printf("DDR0: Multiple correctable ECC events.\n");
+       if (val & 0x04)
+               printf("DDR0: Single correctable ECC event.\n");
+       if (val & 0x02)
+               printf("Multiple accesses outside the defined"
+                      " physical memory space detected\n");
+       if (val & 0x01)
+               printf("DDR0: Single access outside the defined"
+                      " physical memory space detected.\n");
+
+       mfsdram(DDR0_01, val);
+       val = (val >> 8) & 0x7;
+       switch (val ) {
+       case 0:
+               printf("DDR0: Write Out-of-Range command\n");
+               break;
+       case 1:
+               printf("DDR0: Read Out-of-Range command\n");
                break;
-       case (0x80000000>>13):
-               printf("Transfer error ack signal\n");
+       case 2:
+               printf("DDR0: Masked write Out-of-Range command\n");
                break;
-       case (0x80000000>>14):
-               printf("Data parity signal\n");
+       case 4:
+               printf("DDR0: Wrap write Out-of-Range command\n");
                break;
-       case (0x80000000>>15):
-               printf("Address parity signal\n");
+       case 5:
+               printf("DDR0: Wrap read Out-of-Range command\n");
                break;
        default:
-               printf("Unknown values in msr\n");
+               mfsdram(DDR0_01, value2);
+               printf("DDR0: No DDR0 error know 0x%x %p\n", val, value2);
        }
+       mfsdram(DDR0_23, val);
+       if ( (val >> 16) & 0xff)
+               printf("DDR0: Syndrome for correctable ECC event 0x%x\n",
+                      (val >> 16) & 0xff);
+       mfsdram(DDR0_23, val);
+       if ( (val >> 8) & 0xff)
+               printf("DDR0: Syndrome for uncorrectable ECC event 0x%x\n",
+                      (val >> 8) & 0xff);
+       mfsdram(DDR0_33, val);
+       if (val)
+               printf("DDR0: Address of command that caused an "
+                      "Out-of-Range interrupt %p\n", val);
+       mfsdram(DDR0_34, val);
+       if (val)
+               printf("DDR0: Address of uncorrectable ECC event %p\n", val);
+       mfsdram(DDR0_35, val);
+       if (val)
+               printf("DDR0: Address of uncorrectable ECC event %p\n", val);
+       mfsdram(DDR0_36, val);
+       if (val)
+               printf("DDR0: Data of uncorrectable ECC event 0x%08x\n", val);
+       mfsdram(DDR0_37, val);
+       if (val)
+               printf("DDR0: Data of uncorrectable ECC event 0x%08x\n", val);
+       mfsdram(DDR0_38, val);
+       if (val)
+               printf("DDR0: Address of correctable ECC event %p\n", val);
+       mfsdram(DDR0_39, val);
+       if (val)
+               printf("DDR0: Address of correctable ECC event %p\n", val);
+       mfsdram(DDR0_40, val);
+       if (val)
+               printf("DDR0: Data of correctable ECC event 0x%08x\n", val);
+       mfsdram(DDR0_41, val);
+       if (val)
+               printf("DDR0: Data of correctable ECC event 0x%08x\n", val);
+#endif /* CONFIG_440EPX */
+#endif /* CONFIG_440 */
        show_regs(regs);
        print_backtrace((unsigned long *)regs->gpr[1]);
        panic("machine check");
@@ -224,7 +332,7 @@ ProgramCheckException(struct pt_regs *regs)
 }
 
 void
-PITException(struct pt_regs *regs)
+DecrementerPITException(struct pt_regs *regs)
 {
        /*
         * Reset PIT interrupt
@@ -272,17 +380,17 @@ addr_probe(uint *addr)
 
        __asm__ __volatile__(                   \
                "1:     lwz %0,0(%1)\n"         \
-                                               "       eieio\n"                \
-                                               "       li %0,0\n"              \
-                                               "2:\n"                          \
-                                               ".section .fixup,\"ax\"\n"      \
-                                               "3:     li %0,-1\n"             \
-                                               "       b 2b\n"                 \
-                                               ".section __ex_table,\"a\"\n"   \
-                                               "       .align 2\n"             \
-                                               "       .long 1b,3b\n"          \
-                                               ".text"                         \
-                                               : "=r" (retval) : "r"(addr));
+               "       eieio\n"                \
+               "       li %0,0\n"              \
+               "2:\n"                          \
+               ".section .fixup,\"ax\"\n"      \
+               "3:     li %0,-1\n"             \
+               "       b 2b\n"                 \
+               ".section __ex_table,\"a\"\n"   \
+               "       .align 2\n"             \
+               "       .long 1b,3b\n"          \
+               ".text"                         \
+               : "=r" (retval) : "r"(addr));
 
        return (retval);
 #endif
old mode 100644 (file)
new mode 100755 (executable)
index acc1a74..255b140
@@ -180,6 +180,7 @@ void dev_print (block_dev_desc_t *dev_desc)
      (CONFIG_COMMANDS & CFG_CMD_SCSI)  || \
      (CONFIG_COMMANDS & CFG_CMD_USB)   || \
      defined(CONFIG_MMC)               || \
+     (defined(CONFIG_MMC) && defined(CONFIG_LPC2292)) || \
      defined(CONFIG_SYSTEMACE)          )
 
 #if defined(CONFIG_MAC_PARTITION) || \
@@ -219,7 +220,8 @@ void init_part (block_dev_desc_t * dev_desc)
 }
 
 
-int get_partition_info (block_dev_desc_t *dev_desc, int part, disk_partition_t *info)
+int get_partition_info (block_dev_desc_t *dev_desc, int part
+                                       , disk_partition_t *info)
 {
                switch (dev_desc->part_type) {
 #ifdef CONFIG_MAC_PARTITION
@@ -325,7 +327,8 @@ void print_part (block_dev_desc_t * dev_desc)
 
 
 #else  /* neither MAC nor DOS nor ISO partition configured */
-# error neither CONFIG_MAC_PARTITION nor CONFIG_DOS_PARTITION nor CONFIG_ISO_PARTITION configured!
+# error neither CONFIG_MAC_PARTITION nor CONFIG_DOS_PARTITION
+# error nor CONFIG_ISO_PARTITION configured!
 #endif
 
 #endif /* (CONFIG_COMMANDS & CFG_CMD_IDE) || CONFIG_COMMANDS & CFG_CMD_SCSI) */
index 3b88f8b..ac56cca 100644 (file)
@@ -96,14 +96,17 @@ To Flash U-Boot into the booting bank (0xFFC00000 - 0xFFFFFFFF):
 
        tftp 1000000 u-boot.bin
        protect off all
-       erase fff00000 ffffffff
-       cp.b 1000000 fff00100 80000
+       erase fff00000 +$filesize
+       cp.b 1000000 fff00000 $filesize
+
+or use tftpflash command:
+       run tftpflash
 
 To Flash U-boot into the alternative bank (0xFF800000 - 0xFFBFFFFF):
 
        tftp 1000000 u-boot.bin
-       erase ffb00000 ffbfffff
-       cp.b 1000000 ffb00100 80000
+       erase ffb00000 +$filesize
+       cp.b 1000000 ffb00000 $filesize
 
 
 4. Memory Map
index 08f34f5..2e04aba 100644 (file)
@@ -146,12 +146,13 @@ that maps in a single PCI I/O space and PCI memory space. The I/O
 space begins at PCI I/O address 0 and the PCI memory space is
 256 MB starting at PCI address CFG_PCI_TARGBASE. After the
 pci_controller structure is initialized, the cpu-specific code will
-call the routine pci_pre_init() if the CFG_PCI_PRE_INIT flag is
-defined. This routine is implemented by board-specific code & is where
-the board can over-ride/extend the default pci_controller structure
-settings and do other pre-initialization tasks. If pci_pre_init()
-returns a value of zero, PCI initialization is aborted; otherwise the
-controller structure is registered and initialization continues.
+call the routine pci_pre_init(). This routine is implemented by
+board-specific code & is where the board can over-ride/extend the
+default pci_controller structure settings and exspecially provide
+a routine to map the PCI interrupts and do other pre-initialization
+tasks. If pci_pre_init() returns a value of zero, PCI initialization
+is aborted; otherwise the controller structure is registered and
+initialization continues.
 
 The default 440GP PCI target configuration is minimal -- it assumes that
 the strapping registers are set as necessary. Since the strapping bits
index 8ad530f..48fd4ea 100644 (file)
@@ -30,7 +30,7 @@ LIB   = $(obj)libdrivers.a
 COBJS  = 3c589.o 5701rls.o ali512x.o ata_piix.o atmel_usart.o \
          bcm570x.o bcm570x_autoneg.o cfb_console.o cfi_flash.o \
          cs8900.o ct69000.o dataflash.o dc2114x.o dm9000x.o \
-         e1000.o eepro100.o \
+         e1000.o eepro100.o enc28j60.o \
          i8042.o inca-ip_sw.o keyboard.o \
          lan91c96.o macb.o \
          natsemi.o ne2000.o netarm_eth.o netconsole.o \
old mode 100644 (file)
new mode 100755 (executable)
similarity index 80%
rename from board/lpc2292sodimm/eth.c
rename to drivers/enc28j60.c
index 249ab04..98303ac
 
 #include <config.h>
 #include <common.h>
+#ifdef CONFIG_ENC28J60
 #include <net.h>
 #include <asm/arch/hardware.h>
-#include "spi.h"
+#include <asm/arch/spi.h>
 
 /*
  * Control Registers in Bank 0
@@ -36,7 +37,7 @@
 #define CTL_REG_ERXSTL  0x08
 #define CTL_REG_ERXSTH  0x09
 #define CTL_REG_ERXNDL  0x0A
-#define CTL_REG_ERXNDA  0x0B
+#define CTL_REG_ERXNDH  0x0B
 #define CTL_REG_ERXRDPTL 0x0C
 #define CTL_REG_ERXRDPTH 0x0D
 #define CTL_REG_ERXWRPTL 0x0E
 
 #define PHY_REG_PHID1 0x02
 #define PHY_REG_PHID2 0x03
-
+/* taken from the Linux driver */
+#define PHY_REG_PHCON1 0x00
+#define PHY_REG_PHCON2 0x10
+#define PHY_REG_PHLCON 0x14
 
 /*
  * Receive Filter Register (ERXFCON) bits
 /* Use the lower memory for receiver buffer. See errata pt. 5 */
 #define ENC_RX_BUF_START 0x0000
 #define ENC_TX_BUF_START 0x1800
+/* taken from the Linux driver */
+#define ENC_RX_BUF_END   0x17ff
+#define ENC_TX_BUF_END   0x1fff
 
 /* maximum frame length */
 #define ENC_MAX_FRM_LEN 1518
@@ -293,6 +300,7 @@ static void encBitClr (unsigned char regNo, unsigned char data);
 static void encReset (void);
 static void encInit (unsigned char *pEthAddr);
 static unsigned short phyRead (unsigned char addr);
+static void phyWrite(unsigned char, unsigned short);
 static void encPoll (void);
 static void encRx (void);
 
@@ -318,10 +326,12 @@ static int rxResetCounter = 0;
 #define RX_RESET_COUNTER 1000;
 
 /*-----------------------------------------------------------------------------
- * Returns 0 when failes otherwize 1
+ * Always returns 0
  */
 int eth_init (bd_t * bis)
 {
+       unsigned char estatVal;
+
        /* configure GPIO */
        (*((volatile unsigned long *) IO1DIR)) |= ENC_SPI_SLAVE_CS;
        (*((volatile unsigned long *) IO1DIR)) |= ENC_RESET;
@@ -332,6 +342,14 @@ int eth_init (bd_t * bis)
 
        spi_init ();
 
+       /* taken from the Linux driver - dangerous stuff here! */
+       /* Wait for CLKRDY to become set (i.e., check that we can communicate with
+          the ENC) */
+       do
+       {
+               estatVal = m_nic_read(CTL_REG_ESTAT);
+       } while ((estatVal & 0x08) || (~estatVal & ENC_ESTAT_CLKRDY));
+
        /* initialize controller */
        encReset ();
        encInit (bis->bi_enetaddr);
@@ -353,6 +371,10 @@ int eth_send (volatile void *packet, int length)
        m_nic_write (CTL_REG_EWRPTL, (ENC_TX_BUF_START & 0xff));
        m_nic_write (CTL_REG_EWRPTH, (ENC_TX_BUF_START >> 8));
 
+       /* set ETXND */
+       m_nic_write (CTL_REG_ETXNDL, (length + ENC_TX_BUF_START) & 0xFF);
+       m_nic_write (CTL_REG_ETXNDH, (length + ENC_TX_BUF_START) >> 8);
+
        /* set ETXST */
        m_nic_write (CTL_REG_ETXSTL, ENC_TX_BUF_START & 0xFF);
        m_nic_write (CTL_REG_ETXSTH, ENC_TX_BUF_START >> 8);
@@ -360,9 +382,15 @@ int eth_send (volatile void *packet, int length)
        /* write packet */
        m_nic_write_data (length, (unsigned char *) packet);
 
-       /* set ETXND */
-       m_nic_write (CTL_REG_ETXNDL, (length + ENC_TX_BUF_START) & 0xFF);
-       m_nic_write (CTL_REG_ETXNDH, (length + ENC_TX_BUF_START) >> 8);
+       /* taken from the Linux driver */
+       /* Verify that the internal transmit logic has not been altered by excessive
+          collisions.  See Errata B4 12 and 14.
+        */
+       if (m_nic_read(CTL_REG_EIR) & ENC_EIR_TXERIF) {
+               m_nic_bfs(CTL_REG_ECON1, ENC_ECON1_TXRST);
+               m_nic_bfc(CTL_REG_ECON1, ENC_ECON1_TXRST);
+       }
+       m_nic_bfc(CTL_REG_EIR, (ENC_EIR_TXERIF | ENC_EIR_TXIF));
 
        /* set ECON1.TXRTS */
        m_nic_bfs (CTL_REG_ECON1, ENC_ECON1_TXRTS);
@@ -423,8 +451,10 @@ static void encPoll (void)
        volatile unsigned char estat_reg;
        unsigned char pkt_cnt;
 
+#ifdef CONFIG_USE_IRQ
        /* clear global interrupt enable bit in enc28j60 */
        m_nic_bfc (CTL_REG_EIE, ENC_EIE_INTIE);
+#endif
        estat_reg = m_nic_read (CTL_REG_ESTAT);
 
        eir_reg = m_nic_read (CTL_REG_EIR);
@@ -462,8 +492,10 @@ static void encPoll (void)
                m_nic_bfc (CTL_REG_EIR, ENC_EIR_TXERIF);
        }
 
+#ifdef CONFIG_USE_IRQ
        /* set global interrupt enable bit in enc28j60 */
        m_nic_bfs (CTL_REG_EIE, ENC_EIE_INTIE);
+#endif
 }
 
 static void encRx (void)
@@ -473,6 +505,7 @@ static void encRx (void)
        unsigned short status;
        unsigned char eir_reg;
        unsigned char pkt_cnt = 0;
+       unsigned short rxbuf_rdpt;
 
        /* switch to bank 0 */
        m_nic_bfc (CTL_REG_ECON1, (ENC_ECON1_BSEL1 | ENC_ECON1_BSEL0));
@@ -489,18 +522,19 @@ static void encRx (void)
                status = buffer[4];
                status |= (unsigned short) buffer[5] << 8;
 
-               if (pkt_len <= ENC_MAX_FRM_LEN) {
+               if (pkt_len <= ENC_MAX_FRM_LEN)
                        copy_len = pkt_len;
-               } else {
+               else
                        copy_len = 0;
-                       /*      p_priv->stats.rx_dropped++; */
-                       /* we will drop this packet */
-               }
 
-               if ((status & (1L << 7)) == 0) {        /* check Received Ok bit */
+               if ((status & (1L << 7)) == 0) /* check Received Ok bit */
+                       copy_len = 0;
+
+               /* taken from the Linux driver */
+               /* check if next pointer is resonable */
+               if ((((unsigned int)next_pointer_msb << 8) |
+                       (unsigned int)next_pointer_lsb) >= ENC_TX_BUF_START)
                        copy_len = 0;
-                       /*      p_priv->stats.rx_errors++; */
-               }
 
                if (copy_len > 0) {
                        m_nic_read_data (copy_len, buffer);
@@ -513,6 +547,22 @@ static void encRx (void)
                /* decrease packet counter */
                m_nic_bfs (CTL_REG_ECON2, ENC_ECON2_PKTDEC);
 
+               /* taken from the Linux driver */
+               /* Only odd values should be written to ERXRDPTL,
+                * see errata B4 pt.13
+                */
+               rxbuf_rdpt = (next_pointer_msb << 8 | next_pointer_lsb) - 1;
+               if ((rxbuf_rdpt < (m_nic_read(CTL_REG_ERXSTH) << 8 |
+                               m_nic_read(CTL_REG_ERXSTL))) || (rxbuf_rdpt >
+                               (m_nic_read(CTL_REG_ERXNDH) << 8 |
+                               m_nic_read(CTL_REG_ERXNDL)))) {
+                       m_nic_write(CTL_REG_ERXRDPTL, m_nic_read(CTL_REG_ERXNDL));
+                       m_nic_write(CTL_REG_ERXRDPTH, m_nic_read(CTL_REG_ERXNDH));
+               } else {
+                       m_nic_write(CTL_REG_ERXRDPTL, rxbuf_rdpt & 0xFF);
+                       m_nic_write(CTL_REG_ERXRDPTH, rxbuf_rdpt >> 8);
+               }
+
                /* move to bank 1 */
                m_nic_bfc (CTL_REG_ECON1, ENC_ECON1_BSEL1);
                m_nic_bfs (CTL_REG_ECON1, ENC_ECON1_BSEL0);
@@ -535,8 +585,6 @@ static void encRx (void)
 
                eir_reg = m_nic_read (CTL_REG_EIR);
        } while (pkt_cnt);      /* Use EPKTCNT not EIR.PKTIF flag, see errata pt. 6 */
-       m_nic_write (CTL_REG_ERXRDPTL, next_pointer_lsb);
-       m_nic_write (CTL_REG_ERXRDPTH, next_pointer_msb);
 }
 
 static void encWriteReg (unsigned char regNo, unsigned char data)
@@ -700,12 +748,6 @@ static void encReset (void)
 
        /* sleep 1 ms. See errata pt. 2 */
        udelay (1000);
-
-#if 0
-       (*((volatile unsigned long *) IO1CLR)) &= ENC_RESET;
-       mdelay (5);
-       (*((volatile unsigned long *) IO1SET)) &= ENC_RESET;
-#endif
 }
 
 static void encInit (unsigned char *pEthAddr)
@@ -720,44 +762,21 @@ static void encInit (unsigned char *pEthAddr)
         * Setup the buffer space. The reset values are valid for the
         * other pointers.
         */
-#if 0
        /* We shall not write to ERXST, see errata pt. 5. Instead we
           have to make sure that ENC_RX_BUS_START is 0. */
        m_nic_write_retry (CTL_REG_ERXSTL, (ENC_RX_BUF_START & 0xFF), 1);
        m_nic_write_retry (CTL_REG_ERXSTH, (ENC_RX_BUF_START >> 8), 1);
-#endif
+
+       /* taken from the Linux driver */
+       m_nic_write_retry (CTL_REG_ERXNDL, (ENC_RX_BUF_END & 0xFF), 1);
+       m_nic_write_retry (CTL_REG_ERXNDH, (ENC_RX_BUF_END >> 8), 1);
+
        m_nic_write_retry (CTL_REG_ERDPTL, (ENC_RX_BUF_START & 0xFF), 1);
        m_nic_write_retry (CTL_REG_ERDPTH, (ENC_RX_BUF_START >> 8), 1);
 
        next_pointer_lsb = (ENC_RX_BUF_START & 0xFF);
        next_pointer_msb = (ENC_RX_BUF_START >> 8);
 
-       /*
-        * For tracking purposes, the ERXRDPT registers should be programmed with
-        * the same value. This is the read pointer.
-        */
-       m_nic_write (CTL_REG_ERXRDPTL, (ENC_RX_BUF_START & 0xFF));
-       m_nic_write_retry (CTL_REG_ERXRDPTH, (ENC_RX_BUF_START >> 8), 1);
-
-       /* Setup receive filters. */
-
-       /* move to bank 1 */
-       m_nic_bfc (CTL_REG_ECON1, ENC_ECON1_BSEL1);
-       m_nic_bfs (CTL_REG_ECON1, ENC_ECON1_BSEL0);
-
-       /* OR-filtering, Unicast, CRC-check and broadcast */
-       m_nic_write_retry (CTL_REG_ERXFCON,
-                          (ENC_RFR_UCEN | ENC_RFR_CRCEN | ENC_RFR_BCEN), 1);
-
-       /* Wait for Oscillator Start-up Timer (OST). */
-       while ((m_nic_read (CTL_REG_ESTAT) & ENC_ESTAT_CLKRDY) == 0) {
-               static int cnt = 0;
-
-               if (cnt++ >= 1000) {
-                       cnt = 0;
-               }
-       }
-
        /* verify identification */
        phid1 = phyRead (PHY_REG_PHID1);
        phid2 = phyRead (PHY_REG_PHID2);
@@ -780,16 +799,34 @@ static void encInit (unsigned char *pEthAddr)
        /* switch to bank 2 */
        m_nic_bfc (CTL_REG_ECON1, ENC_ECON1_BSEL0);
        m_nic_bfs (CTL_REG_ECON1, ENC_ECON1_BSEL1);
-       /* clear MAC reset bits */
-       m_nic_write_retry (CTL_REG_MACON2, 0, 1);
 
        /* enable MAC to receive frames */
-       m_nic_write_retry (CTL_REG_MACON1, ENC_MACON1_MARXEN, 10);
+       /* added some bits from the Linux driver */
+       m_nic_write_retry (CTL_REG_MACON1
+               ,(ENC_MACON1_MARXEN | ENC_MACON1_TXPAUS | ENC_MACON1_RXPAUS)
+               ,10);
 
        /* configure pad, tx-crc and duplex */
-       /* TODO maybe enable FRMLNEN */
-       m_nic_write_retry (CTL_REG_MACON3,
-                          (ENC_MACON3_PADCFG0 | ENC_MACON3_TXCRCEN), 10);
+       /* added a bit from the Linux driver */
+       m_nic_write_retry (CTL_REG_MACON3
+               ,(ENC_MACON3_PADCFG0 | ENC_MACON3_TXCRCEN | ENC_MACON3_FRMLNEN)
+               ,10);
+
+       /* added 4 new lines from the Linux driver */
+       /* Allow infinite deferals if the medium is continously busy */
+       m_nic_write_retry(CTL_REG_MACON4, (1<<6) /*ENC_MACON4_DEFER*/, 10);
+
+       /* Late collisions occur beyond 63 bytes */
+       m_nic_write_retry(CTL_REG_MACLCON2, 63, 10);
+
+       /* Set (low byte) Non-Back-to_Back Inter-Packet Gap. Recommended 0x12 */
+       m_nic_write_retry(CTL_REG_MAIPGL, 0x12, 10);
+
+       /*
+       * Set (high byte) Non-Back-to_Back Inter-Packet Gap. Recommended
+       * 0x0c for half-duplex. Nothing for full-duplex
+       */
+       m_nic_write_retry(CTL_REG_MAIPGH, 0x0C, 10);
 
        /* set maximum frame length */
        m_nic_write_retry (CTL_REG_MAMXFLL, (ENC_MAX_FRM_LEN & 0xff), 10);
@@ -801,15 +838,6 @@ static void encInit (unsigned char *pEthAddr)
         */
        m_nic_write_retry (CTL_REG_MABBIPG, 0x12, 10);
 
-       /* Set (low byte) Non-Back-to_Back Inter-Packet Gap. Recommended 0x12 */
-       m_nic_write_retry (CTL_REG_MAIPGL, 0x12, 10);
-
-       /*
-        * Set (high byte) Non-Back-to_Back Inter-Packet Gap. Recommended
-        * 0x0c for half-duplex. Nothing for full-duplex
-        */
-       m_nic_write_retry (CTL_REG_MAIPGH, 0x0C, 10);
-
        /* set MAC address */
 
        /* switch to bank 3 */
@@ -823,18 +851,35 @@ static void encInit (unsigned char *pEthAddr)
        m_nic_write_retry (CTL_REG_MAADR5, pEthAddr[0], 1);
 
        /*
-        * Receive settings
+       * PHY Initialization taken from the Linux driver
         */
 
-       /* auto-increment RX-pointer when reading a received packet */
-       m_nic_bfs (CTL_REG_ECON2, ENC_ECON2_AUTOINC);
+       /* Prevent automatic loopback of data beeing transmitted by setting
+          ENC_PHCON2_HDLDIS */
+       phyWrite(PHY_REG_PHCON2, (1<<8));
+
+       /* LEDs configuration
+        * LEDA: LACFG = 0100 -> display link status
+        * LEDB: LBCFG = 0111 -> display TX & RX activity
+        * STRCH = 1 -> LED pulses
+        */
+       phyWrite(PHY_REG_PHLCON, 0x0472);
 
+       /* Reset PDPXMD-bit => half duplex */
+       phyWrite(PHY_REG_PHCON1, 0);
+
+       /*
+        * Receive settings
+        */
+
+#ifdef CONFIG_USE_IRQ
        /* enable interrupts */
        m_nic_bfs (CTL_REG_EIE, ENC_EIE_PKTIE);
        m_nic_bfs (CTL_REG_EIE, ENC_EIE_TXIE);
        m_nic_bfs (CTL_REG_EIE, ENC_EIE_RXERIE);
        m_nic_bfs (CTL_REG_EIE, ENC_EIE_TXERIE);
        m_nic_bfs (CTL_REG_EIE, ENC_EIE_INTIE);
+#endif
 }
 
 /*****************************************************************************
@@ -864,6 +909,11 @@ static unsigned short phyRead (unsigned char addr)
        /* set MICMD.MIIRD */
        m_nic_write (CTL_REG_MICMD, ENC_MICMD_MIIRD);
 
+       /* taken from the Linux driver */
+       /* move to bank 3 */
+       m_nic_bfs(CTL_REG_ECON1, ENC_ECON1_BSEL0);
+       m_nic_bfs(CTL_REG_ECON1, ENC_ECON1_BSEL1);
+
        /* poll MISTAT.BUSY bit until operation is complete */
        while ((m_nic_read (CTL_REG_MISTAT) & ENC_MISTAT_BUSY) != 0) {
                static int cnt = 0;
@@ -875,6 +925,11 @@ static unsigned short phyRead (unsigned char addr)
                }
        }
 
+       /* taken from the Linux driver */
+       /* move to bank 2 */
+       m_nic_bfc(CTL_REG_ECON1, ENC_ECON1_BSEL0);
+       m_nic_bfs(CTL_REG_ECON1, ENC_ECON1_BSEL1);
+
        /* clear MICMD.MIIRD */
        m_nic_write (CTL_REG_MICMD, 0);
 
@@ -883,3 +938,46 @@ static unsigned short phyRead (unsigned char addr)
 
        return ret;
 }
+
+/*****************************************************************************
+ *
+ * Taken from the Linux driver.
+ * Description:
+ * Write PHY registers.
+ *
+ * NOTE! This function will change to Bank 3.
+ *
+ * Params:
+ * [in] addr address of the register to write to
+ * [in] data to be written
+ *
+ * Returns:
+ *    None
+ */
+static void phyWrite(unsigned char addr, unsigned short data)
+{
+       /* move to bank 2 */
+       m_nic_bfc(CTL_REG_ECON1, ENC_ECON1_BSEL0);
+       m_nic_bfs(CTL_REG_ECON1, ENC_ECON1_BSEL1);
+
+       /* write address to MIREGADR */
+       m_nic_write(CTL_REG_MIREGADR, addr);
+
+       m_nic_write(CTL_REG_MIWRL, data & 0xff);
+       m_nic_write(CTL_REG_MIWRH, data >> 8);
+
+       /* move to bank 3 */
+       m_nic_bfs(CTL_REG_ECON1, ENC_ECON1_BSEL0);
+       m_nic_bfs(CTL_REG_ECON1, ENC_ECON1_BSEL1);
+
+       /* poll MISTAT.BUSY bit until operation is complete */
+       while((m_nic_read(CTL_REG_MISTAT) & ENC_MISTAT_BUSY) != 0) {
+               static int cnt = 0;
+
+               if(cnt++ >= 1000) {
+                       cnt = 0;
+               }
+       }
+}
+
+#endif /* CONFIG_ENC28J60 */
index f33be96..90274e6 100644 (file)
 #if (CONFIG_COMMANDS & CFG_CMD_NAND) && !defined(CFG_NAND_LEGACY)
 
 #include<linux/mtd/mtd.h>
+
+/*
+ * NAND-SPL has no sofware ECC for now, so don't include nand_calculate_ecc(),
+ * only nand_correct_data() is needed
+ */
+
+#ifndef CONFIG_NAND_SPL
 /*
  * Pre-calculated 256-way 1 byte column parity
  */
@@ -62,90 +69,75 @@ static const u_char nand_ecc_precalc_table[] = {
        0x00, 0x55, 0x56, 0x03, 0x59, 0x0c, 0x0f, 0x5a, 0x5a, 0x0f, 0x0c, 0x59, 0x03, 0x56, 0x55, 0x00
 };
 
-
-/**
- * nand_trans_result - [GENERIC] create non-inverted ECC
- * @reg2:      line parity reg 2
- * @reg3:      line parity reg 3
- * @ecc_code:  ecc
- *
- * Creates non-inverted ECC code from line parity
- */
-static void nand_trans_result(u_char reg2, u_char reg3,
-       u_char *ecc_code)
-{
-       u_char a, b, i, tmp1, tmp2;
-
-       /* Initialize variables */
-       a = b = 0x80;
-       tmp1 = tmp2 = 0;
-
-       /* Calculate first ECC byte */
-       for (i = 0; i < 4; i++) {
-               if (reg3 & a)           /* LP15,13,11,9 --> ecc_code[0] */
-                       tmp1 |= b;
-               b >>= 1;
-               if (reg2 & a)           /* LP14,12,10,8 --> ecc_code[0] */
-                       tmp1 |= b;
-               b >>= 1;
-               a >>= 1;
-       }
-
-       /* Calculate second ECC byte */
-       b = 0x80;
-       for (i = 0; i < 4; i++) {
-               if (reg3 & a)           /* LP7,5,3,1 --> ecc_code[1] */
-                       tmp2 |= b;
-               b >>= 1;
-               if (reg2 & a)           /* LP6,4,2,0 --> ecc_code[1] */
-                       tmp2 |= b;
-               b >>= 1;
-               a >>= 1;
-       }
-
-       /* Store two of the ECC bytes */
-       ecc_code[0] = tmp1;
-       ecc_code[1] = tmp2;
-}
-
 /**
- * nand_calculate_ecc - [NAND Interface] Calculate 3 byte ECC code for 256 byte block
+ * nand_calculate_ecc - [NAND Interface] Calculate 3-byte ECC for 256-byte block
  * @mtd:       MTD block structure
  * @dat:       raw data
  * @ecc_code:  buffer for ECC
  */
-int nand_calculate_ecc(struct mtd_info *mtd, const u_char *dat, u_char *ecc_code)
+int nand_calculate_ecc(struct mtd_info *mtd, const u_char *dat,
+                      u_char *ecc_code)
 {
-       u_char idx, reg1, reg2, reg3;
-       int j;
+       uint8_t idx, reg1, reg2, reg3, tmp1, tmp2;
+       int i;
 
        /* Initialize variables */
        reg1 = reg2 = reg3 = 0;
-       ecc_code[0] = ecc_code[1] = ecc_code[2] = 0;
 
        /* Build up column parity */
-       for(j = 0; j < 256; j++) {
-
+       for(i = 0; i < 256; i++) {
                /* Get CP0 - CP5 from table */
-               idx = nand_ecc_precalc_table[dat[j]];
+               idx = nand_ecc_precalc_table[*dat++];
                reg1 ^= (idx & 0x3f);
 
                /* All bit XOR = 1 ? */
                if (idx & 0x40) {
-                       reg3 ^= (u_char) j;
-                       reg2 ^= ~((u_char) j);
+                       reg3 ^= (uint8_t) i;
+                       reg2 ^= ~((uint8_t) i);
                }
        }
 
        /* Create non-inverted ECC code from line parity */
-       nand_trans_result(reg2, reg3, ecc_code);
+       tmp1  = (reg3 & 0x80) >> 0; /* B7 -> B7 */
+       tmp1 |= (reg2 & 0x80) >> 1; /* B7 -> B6 */
+       tmp1 |= (reg3 & 0x40) >> 1; /* B6 -> B5 */
+       tmp1 |= (reg2 & 0x40) >> 2; /* B6 -> B4 */
+       tmp1 |= (reg3 & 0x20) >> 2; /* B5 -> B3 */
+       tmp1 |= (reg2 & 0x20) >> 3; /* B5 -> B2 */
+       tmp1 |= (reg3 & 0x10) >> 3; /* B4 -> B1 */
+       tmp1 |= (reg2 & 0x10) >> 4; /* B4 -> B0 */
+
+       tmp2  = (reg3 & 0x08) << 4; /* B3 -> B7 */
+       tmp2 |= (reg2 & 0x08) << 3; /* B3 -> B6 */
+       tmp2 |= (reg3 & 0x04) << 3; /* B2 -> B5 */
+       tmp2 |= (reg2 & 0x04) << 2; /* B2 -> B4 */
+       tmp2 |= (reg3 & 0x02) << 2; /* B1 -> B3 */
+       tmp2 |= (reg2 & 0x02) << 1; /* B1 -> B2 */
+       tmp2 |= (reg3 & 0x01) << 1; /* B0 -> B1 */
+       tmp2 |= (reg2 & 0x01) << 0; /* B7 -> B0 */
 
        /* Calculate final ECC code */
-       ecc_code[0] = ~ecc_code[0];
-       ecc_code[1] = ~ecc_code[1];
+#ifdef CONFIG_MTD_NAND_ECC_SMC
+       ecc_code[0] = ~tmp2;
+       ecc_code[1] = ~tmp1;
+#else
+       ecc_code[0] = ~tmp1;
+       ecc_code[1] = ~tmp2;
+#endif
        ecc_code[2] = ((~reg1) << 2) | 0x03;
+
        return 0;
 }
+#endif /* CONFIG_NAND_SPL */
+
+static inline int countbits(uint32_t byte)
+{
+       int res = 0;
+
+       for (;byte; byte >>= 1)
+               res += byte & 0x01;
+       return res;
+}
 
 /**
  * nand_correct_data - [NAND Interface] Detect and correct bit error(s)
@@ -156,88 +148,52 @@ int nand_calculate_ecc(struct mtd_info *mtd, const u_char *dat, u_char *ecc_code
  *
  * Detect and correct a 1 bit error for 256 byte block
  */
-int nand_correct_data(struct mtd_info *mtd, u_char *dat, u_char *read_ecc, u_char *calc_ecc)
+int nand_correct_data(struct mtd_info *mtd, u_char *dat,
+                     u_char *read_ecc, u_char *calc_ecc)
 {
-       u_char a, b, c, d1, d2, d3, add, bit, i;
+       uint8_t s0, s1, s2;
+
+#ifdef CONFIG_MTD_NAND_ECC_SMC
+       s0 = calc_ecc[0] ^ read_ecc[0];
+       s1 = calc_ecc[1] ^ read_ecc[1];
+       s2 = calc_ecc[2] ^ read_ecc[2];
+#else
+       s1 = calc_ecc[0] ^ read_ecc[0];
+       s0 = calc_ecc[1] ^ read_ecc[1];
+       s2 = calc_ecc[2] ^ read_ecc[2];
+#endif
+       if ((s0 | s1 | s2) == 0)
+               return 0;
 
-       /* Do error detection */
-       d1 = calc_ecc[0] ^ read_ecc[0];
-       d2 = calc_ecc[1] ^ read_ecc[1];
-       d3 = calc_ecc[2] ^ read_ecc[2];
+       /* Check for a single bit error */
+       if( ((s0 ^ (s0 >> 1)) & 0x55) == 0x55 &&
+           ((s1 ^ (s1 >> 1)) & 0x55) == 0x55 &&
+           ((s2 ^ (s2 >> 1)) & 0x54) == 0x54) {
 
-       if ((d1 | d2 | d3) == 0) {
-               /* No errors */
-               return 0;
-       }
-       else {
-               a = (d1 ^ (d1 >> 1)) & 0x55;
-               b = (d2 ^ (d2 >> 1)) & 0x55;
-               c = (d3 ^ (d3 >> 1)) & 0x54;
-
-               /* Found and will correct single bit error in the data */
-               if ((a == 0x55) && (b == 0x55) && (c == 0x54)) {
-                       c = 0x80;
-                       add = 0;
-                       a = 0x80;
-                       for (i=0; i<4; i++) {
-                               if (d1 & c)
-                                       add |= a;
-                               c >>= 2;
-                               a >>= 1;
-                       }
-                       c = 0x80;
-                       for (i=0; i<4; i++) {
-                               if (d2 & c)
-                                       add |= a;
-                               c >>= 2;
-                               a >>= 1;
-                       }
-                       bit = 0;
-                       b = 0x04;
-                       c = 0x80;
-                       for (i=0; i<3; i++) {
-                               if (d3 & c)
-                                       bit |= b;
-                               c >>= 2;
-                               b >>= 1;
-                       }
-                       b = 0x01;
-                       a = dat[add];
-                       a ^= (b << bit);
-                       dat[add] = a;
-                       return 1;
-               } else {
-                       i = 0;
-                       while (d1) {
-                               if (d1 & 0x01)
-                                       ++i;
-                               d1 >>= 1;
-                       }
-                       while (d2) {
-                               if (d2 & 0x01)
-                                       ++i;
-                               d2 >>= 1;
-                       }
-                       while (d3) {
-                               if (d3 & 0x01)
-                                       ++i;
-                               d3 >>= 1;
-                       }
-                       if (i == 1) {
-                               /* ECC Code Error Correction */
-                               read_ecc[0] = calc_ecc[0];
-                               read_ecc[1] = calc_ecc[1];
-                               read_ecc[2] = calc_ecc[2];
-                               return 2;
-                       }
-                       else {
-                               /* Uncorrectable Error */
-                               return -1;
-                       }
-               }
+               uint32_t byteoffs, bitnum;
+
+               byteoffs = (s1 << 0) & 0x80;
+               byteoffs |= (s1 << 1) & 0x40;
+               byteoffs |= (s1 << 2) & 0x20;
+               byteoffs |= (s1 << 3) & 0x10;
+
+               byteoffs |= (s0 >> 4) & 0x08;
+               byteoffs |= (s0 >> 3) & 0x04;
+               byteoffs |= (s0 >> 2) & 0x02;
+               byteoffs |= (s0 >> 1) & 0x01;
+
+               bitnum = (s2 >> 5) & 0x04;
+               bitnum |= (s2 >> 4) & 0x02;
+               bitnum |= (s2 >> 3) & 0x01;
+
+               dat[byteoffs] ^= (1 << bitnum);
+
+               return 1;
        }
 
-       /* Should never happen */
+       if(countbits(s0 | ((uint32_t)s1 << 8) | ((uint32_t)s2 <<16)) == 1)
+               return 1;
+
        return -1;
 }
 
old mode 100644 (file)
new mode 100755 (executable)
index a823b5a..3007608
@@ -59,7 +59,8 @@ int disk_read (__u32 startblock, __u32 getsize, __u8 * bufptr)
        if (cur_dev == NULL)
                return -1;
        if (cur_dev->block_read) {
-               return cur_dev->block_read (cur_dev->dev, startblock, getsize, (unsigned long *)bufptr);
+               return cur_dev->block_read (cur_dev->dev
+                       , startblock, getsize, (unsigned long *)bufptr);
        }
        return -1;
 }
@@ -89,8 +90,11 @@ fat_register_device(block_dev_desc_t *dev_desc, int part_no)
                part_offset=0;
        }
        else {
-#if (CONFIG_COMMANDS & CFG_CMD_IDE) || (CONFIG_COMMANDS & CFG_CMD_SCSI) || \
-    (CONFIG_COMMANDS & CFG_CMD_USB) || defined(CONFIG_SYSTEMACE)
+#if ((CONFIG_COMMANDS & CFG_CMD_IDE)   || \
+     (CONFIG_COMMANDS & CFG_CMD_SCSI)  || \
+     (CONFIG_COMMANDS & CFG_CMD_USB)   || \
+     (defined(CONFIG_MMC) && defined(CONFIG_LPC2292)) || \
+     defined(CONFIG_SYSTEMACE)          )
                disk_partition_t info;
                if(!get_partition_info(dev_desc, part_no, &info)) {
                        part_offset = info.start;
@@ -993,7 +997,8 @@ file_fat_detectfs(void)
        memcpy (vol_label, volinfo.volume_label, 11);
        vol_label[11] = '\0';
        volinfo.fs_type[5]='\0';
-       printf("Partition %d: Filesystem: %s \"%s\"\n",cur_part,volinfo.fs_type,vol_label);
+       printf("Partition %d: Filesystem: %s \"%s\"\n"
+                       ,cur_part,volinfo.fs_type,vol_label);
        return 0;
 }
 
index ba73bae..4a03cec 100644 (file)
@@ -34,6 +34,7 @@
  * Exception offsets (PowerPC standard)
  */
 #define EXC_OFF_SYS_RESET        0x0100      /* default system reset offset */
+#define _START_OFFSET          EXC_OFF_SYS_RESET
 
 /*----------------------------------------------------------------
  * l2cr values
index 1e9cd41..3056ca7 100644 (file)
@@ -36,8 +36,6 @@
 /* include armadillo specific hardware file if there was one */
 #elif defined(CONFIG_INTEGRATOR) && defined(CONFIG_ARCH_INTEGRATOR)
 /* include IntegratorCP/CM720T specific hardware file if there was one */
-#elif defined(CONFIG_LPC2292)
-#include <asm-arm/arch-arm720t/lpc2292_registers.h>
 #else
 #error No hardware file defined for this configuration
 #endif
diff --git a/include/asm-arm/arch-lpc2292/hardware.h b/include/asm-arm/arch-lpc2292/hardware.h
new file mode 100644 (file)
index 0000000..fd2b464
--- /dev/null
@@ -0,0 +1,33 @@
+#ifndef __ASM_ARCH_HARDWARE_H
+#define __ASM_ARCH_HARDWARE_H
+
+/*
+ * Copyright (c) 2004  Cucy Systems (http://www.cucy.com)
+ * Curt Brune <curt@cucy.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
+ */
+
+#if defined(CONFIG_LPC2292)
+#include <asm-arm/arch-lpc2292/lpc2292_registers.h>
+#else
+#error No hardware file defined for this configuration
+#endif
+
+#endif /* __ASM_ARCH_HARDWARE_H */
index 114dc92..c9b6a36 100644 (file)
@@ -45,12 +45,14 @@ typedef enum gpio_driver { GPIO_DIS, GPIO_IN, GPIO_OUT, GPIO_BI } gpio_driver_t;
 typedef enum gpio_out   { GPIO_OUT_0, GPIO_OUT_1, GPIO_OUT_NO_CHG } gpio_out_t;
 
 typedef struct {
-       unsigned long add;      /* gpio core base address       */
-       gpio_driver_t in_out;   /* Driver Setting               */
-       gpio_select_t alt_nb;   /* Selected Alternate           */
+       unsigned long   add;    /* gpio core base address       */
+       gpio_driver_t   in_out; /* Driver Setting               */
+       gpio_select_t   alt_nb; /* Selected Alternate           */
+       gpio_out_t      out_val;/* Default Output Value         */
 } gpio_param_s;
 #endif
 
 void gpio_config(int pin, int in_out, int gpio_alt, int out_val);
 void gpio_write_bit(int pin, int val);
+int gpio_read_out_bit(int pin);
 void gpio_set_chip_configuration(void);
index bbc9ba0..03289bc 100644 (file)
@@ -105,6 +105,11 @@ static inline void sync(void)
        __asm__ __volatile__ ("sync" : : : "memory");
 }
 
+static inline void isync(void)
+{
+       __asm__ __volatile__ ("isync" : : : "memory");
+}
+
 /* Enforce in-order execution of data I/O.
  * No distinction between read/write on PPC; use eieio for all three.
  */
@@ -114,74 +119,90 @@ static inline void sync(void)
 
 /*
  * 8, 16 and 32 bit, big and little endian I/O operations, with barrier.
+ *
+ * Read operations have additional twi & isync to make sure the read
+ * is actually performed (i.e. the data has come back) before we start
+ * executing any following instructions.
  */
-extern inline int in_8(volatile u8 *addr)
+#define __iomem
+extern inline int in_8(const volatile unsigned char __iomem *addr)
 {
-    int ret;
+       int ret;
 
-    __asm__ __volatile__("lbz%U1%X1 %0,%1; eieio" : "=r" (ret) : "m" (*addr));
-    return ret;
+       __asm__ __volatile__(
+               "sync; lbz%U1%X1 %0,%1;\n"
+               "twi 0,%0,0;\n"
+               "isync" : "=r" (ret) : "m" (*addr));
+       return ret;
 }
 
-extern inline void out_8(volatile u8 *addr, int val)
+extern inline void out_8(volatile unsigned char __iomem *addr, int val)
 {
-    __asm__ __volatile__("stb%U0%X0 %1,%0; eieio" : "=m" (*addr) : "r" (val));
+       __asm__ __volatile__("stb%U0%X0 %1,%0; eieio" : "=m" (*addr) : "r" (val));
 }
 
-extern inline int in_le16(volatile u16 *addr)
+extern inline int in_le16(const volatile unsigned short __iomem *addr)
 {
-    int ret;
+       int ret;
 
-    __asm__ __volatile__("lhbrx %0,0,%1; eieio" : "=r" (ret) :
-                 "r" (addr), "m" (*addr));
-    return ret;
+       __asm__ __volatile__("sync; lhbrx %0,0,%1;\n"
+                            "twi 0,%0,0;\n"
+                            "isync" : "=r" (ret) :
+                             "r" (addr), "m" (*addr));
+       return ret;
 }
 
-extern inline int in_be16(volatile u16 *addr)
+extern inline int in_be16(const volatile unsigned short __iomem *addr)
 {
-    int ret;
+       int ret;
 
-    __asm__ __volatile__("lhz%U1%X1 %0,%1; eieio" : "=r" (ret) : "m" (*addr));
-    return ret;
+       __asm__ __volatile__("sync; lhz%U1%X1 %0,%1;\n"
+                            "twi 0,%0,0;\n"
+                            "isync" : "=r" (ret) : "m" (*addr));
+       return ret;
 }
 
-extern inline void out_le16(volatile u16 *addr, int val)
+extern inline void out_le16(volatile unsigned short __iomem *addr, int val)
 {
-    __asm__ __volatile__("sthbrx %1,0,%2; eieio" : "=m" (*addr) :
-                 "r" (val), "r" (addr));
+       __asm__ __volatile__("sync; sthbrx %1,0,%2" : "=m" (*addr) :
+                             "r" (val), "r" (addr));
 }
 
-extern inline void out_be16(volatile u16 *addr, int val)
+extern inline void out_be16(volatile unsigned short __iomem *addr, int val)
 {
-    __asm__ __volatile__("sth%U0%X0 %1,%0; eieio" : "=m" (*addr) : "r" (val));
+       __asm__ __volatile__("sync; sth%U0%X0 %1,%0" : "=m" (*addr) : "r" (val));
 }
 
-extern inline unsigned in_le32(volatile u32 *addr)
+extern inline unsigned in_le32(const volatile unsigned __iomem *addr)
 {
-    unsigned ret;
+       unsigned ret;
 
-    __asm__ __volatile__("lwbrx %0,0,%1; eieio" : "=r" (ret) :
-                "r" (addr), "m" (*addr));
-    return ret;
+       __asm__ __volatile__("sync; lwbrx %0,0,%1;\n"
+                            "twi 0,%0,0;\n"
+                            "isync" : "=r" (ret) :
+                            "r" (addr), "m" (*addr));
+       return ret;
 }
 
-extern inline unsigned in_be32(volatile u32 *addr)
+extern inline unsigned in_be32(const volatile unsigned __iomem *addr)
 {
-    unsigned ret;
+       unsigned ret;
 
-    __asm__ __volatile__("lwz%U1%X1 %0,%1; eieio" : "=r" (ret) : "m" (*addr));
-    return ret;
+       __asm__ __volatile__("sync; lwz%U1%X1 %0,%1;\n"
+                            "twi 0,%0,0;\n"
+                            "isync" : "=r" (ret) : "m" (*addr));
+       return ret;
 }
 
-extern inline void out_le32(volatile unsigned *addr, int val)
+extern inline void out_le32(volatile unsigned __iomem *addr, int val)
 {
-    __asm__ __volatile__("stwbrx %1,0,%2; eieio" : "=m" (*addr) :
-                "r" (val), "r" (addr));
+       __asm__ __volatile__("sync; stwbrx %1,0,%2" : "=m" (*addr) :
+                            "r" (val), "r" (addr));
 }
 
-extern inline void out_be32(volatile unsigned *addr, int val)
+extern inline void out_be32(volatile unsigned __iomem *addr, int val)
 {
-    __asm__ __volatile__("stw%U0%X0 %1,%0; eieio" : "=m" (*addr) : "r" (val));
+       __asm__ __volatile__("sync; stw%U0%X0 %1,%0" : "=m" (*addr) : "r" (val));
 }
 
 #endif
index 5efc3ee..9780fe1 100644 (file)
 #define MSR_DWE         (1<<10)         /* Debug Wait Enable (4xx) */
 #define MSR_UBLE        (1<<10)         /* BTB lock enable (e500) */
 #define MSR_BE         (1<<9)          /* Branch Trace */
-#define MSR_DE         (1<<9)          /* Debug Exception Enable */
+#define MSR_DE         (1<<9)          /* Debug Exception Enable */
 #define MSR_FE1                (1<<8)          /* Floating Exception mode 1 */
 #define MSR_IP         (1<<6)          /* Exception prefix 0x000/0xFFF */
-#define MSR_IR         (1<<5)          /* Instruction Relocate */
+#define MSR_IR         (1<<5)          /* Instruction Relocate */
 #define MSR_IS          (1<<5)          /* Book E Instruction space */
-#define MSR_DR         (1<<4)          /* Data Relocate */
+#define MSR_DR         (1<<4)          /* Data Relocate */
 #define MSR_DS          (1<<4)          /* Book E Data space */
 #define MSR_PE         (1<<3)          /* Protection Enable */
 #define MSR_PX         (1<<2)          /* Protection Exclusive Mode */
 #define MSR_PMM         (1<<2)          /* Performance monitor mark bit (e500) */
 #define MSR_RI         (1<<1)          /* Recoverable Exception */
-#define MSR_LE         (1<<0)          /* Little Endian */
+#define MSR_LE         (1<<0)          /* Little Endian */
 
 #ifdef CONFIG_APUS_FAST_EXCEPT
 #define MSR_           MSR_ME|MSR_IP|MSR_RI
 #define   DBCR_EDM     0x80000000
 #define   DBCR_IDM     0x40000000
 #define   DBCR_RST(x)  (((x) & 0x3) << 28)
-#define     DBCR_RST_NONE              0
-#define     DBCR_RST_CORE              1
-#define     DBCR_RST_CHIP              2
+#define     DBCR_RST_NONE              0
+#define     DBCR_RST_CORE              1
+#define     DBCR_RST_CHIP              2
 #define     DBCR_RST_SYSTEM            3
 #define   DBCR_IC      0x08000000      /* Instruction Completion Debug Evnt */
 #define   DBCR_BT      0x04000000      /* Branch Taken Debug Event */
 #define SPRN_ICMP      0x3D5   /* Instruction TLB Compare Register */
 #define SPRN_ICTC      0x3FB   /* Instruction Cache Throttling Control Reg */
 #define SPRN_IMISS     0x3D4   /* Instruction TLB Miss Register */
-#define SPRN_IMMR      0x27E   /* Internal Memory Map Register */
+#define SPRN_IMMR      0x27E   /* Internal Memory Map Register */
 #define SPRN_LDSTCR    0x3F8   /* Load/Store Control Register */
 #define SPRN_L2CR      0x3F9   /* Level 2 Cache Control Regsiter */
 #define SPRN_LR                0x008   /* Link Register */
 #define SPRN_SRR0      0x01A   /* Save/Restore Register 0 */
 #define SPRN_SRR1      0x01B   /* Save/Restore Register 1 */
 #define SPRN_SRR2      0x3DE   /* Save/Restore Register 2 */
-#define SPRN_SRR3      0x3DF   /* Save/Restore Register 3 */
+#define SPRN_SRR3      0x3DF   /* Save/Restore Register 3 */
 #ifdef CONFIG_BOOKE
 #define SPRN_SVR       0x3FF   /* System Version Register */
 #else
 #define SPRN_PID1       0x279   /* Process ID Register 1 */
 #define SPRN_PID2       0x27a   /* Process ID Register 2 */
 #define SPRN_MCSR      0x23c   /* Machine Check Syndrome register */
+#ifdef CONFIG_440
+#define MCSR_MCS       0x80000000      /* Machine Check Summary */
+#define MCSR_IB                0x40000000      /* Instruction PLB Error */
+#define MCSR_DRB       0x20000000      /* Data Read PLB Error */
+#define MCSR_DWB       0x10000000      /* Data Write PLB Error */
+#define MCSR_TLBP      0x08000000      /* TLB Parity Error */
+#define MCSR_ICP       0x04000000      /* I-Cache Parity Error */
+#define MCSR_DCSP      0x02000000      /* D-Cache Search Parity Error */
+#define MCSR_DCFP      0x01000000      /* D-Cache Flush Parity Error */
+#define MCSR_IMPE      0x00800000      /* Imprecise Machine Check Exception */
+#endif
 #define ESR_ST          0x00800000      /* Store Operation */
 
 #if defined(CONFIG_MPC86xx)
 #define DBCR0  SPRN_DBCR0      /* Debug Control Register 0 */
 #define DBCR1  SPRN_DBCR1      /* Debug Control Register 1 */
 #define DBSR   SPRN_DBSR       /* Debug Status Register */
-#define DCMP   SPRN_DCMP       /* Data TLB Compare Register */
-#define DEC    SPRN_DEC        /* Decrement Register */
-#define DMISS  SPRN_DMISS      /* Data TLB Miss Register */
+#define DCMP   SPRN_DCMP       /* Data TLB Compare Register */
+#define DEC    SPRN_DEC        /* Decrement Register */
+#define DMISS  SPRN_DMISS      /* Data TLB Miss Register */
 #define DSISR  SPRN_DSISR      /* Data Storage Interrupt Status Register */
-#define EAR    SPRN_EAR        /* External Address Register */
+#define EAR    SPRN_EAR        /* External Address Register */
 #define ESR    SPRN_ESR        /* Exception Syndrome Register */
 #define HASH1  SPRN_HASH1      /* Primary Hash Address Register */
 #define HASH2  SPRN_HASH2      /* Secondary Hash Address Register */
 #define HID0   SPRN_HID0       /* Hardware Implementation Register 0 */
 #define HID1   SPRN_HID1       /* Hardware Implementation Register 1 */
-#define IABR   SPRN_IABR       /* Instruction Address Breakpoint Register */
+#define IABR   SPRN_IABR       /* Instruction Address Breakpoint Register */
 #define IAC1   SPRN_IAC1       /* Instruction Address Register 1 */
 #define IAC2   SPRN_IAC2       /* Instruction Address Register 2 */
 #define IBAT0L SPRN_IBAT0L     /* Instruction BAT 0 Lower Register */
 #define IBAT5U SPRN_IBAT5U     /* Instruction BAT 5 Upper Register */
 #define IBAT6L SPRN_IBAT6L     /* Instruction BAT 6 Lower Register */
 #define IBAT6U SPRN_IBAT6U     /* Instruction BAT 6 Upper Register */
-#define IBAT7L         SPRN_IBAT7L     /* Instruction BAT 7 Lower Register */
+#define IBAT7L SPRN_IBAT7L     /* Instruction BAT 7 Lower Register */
 #define IBAT7U SPRN_IBAT7U     /* Instruction BAT 7 Lower Register */
 #define ICMP   SPRN_ICMP       /* Instruction TLB Compare Register */
 #define IMISS  SPRN_IMISS      /* Instruction TLB Miss Register */
-#define IMMR   SPRN_IMMR       /* PPC 860/821 Internal Memory Map Register */
+#define IMMR   SPRN_IMMR       /* PPC 860/821 Internal Memory Map Register */
 #define LDSTCR SPRN_LDSTCR     /* Load/Store Control Register */
-#define L2CR   SPRN_L2CR       /* PPC 750 L2 control register */
+#define L2CR   SPRN_L2CR       /* PPC 750 L2 control register */
 #define LR     SPRN_LR
 #define MBAR    SPRN_MBAR       /* System memory base address */
 #if defined(CONFIG_MPC86xx)
 #define SVR    SPRN_SVR        /* System-On-Chip Version Register */
 #define PVR    SPRN_PVR        /* Processor Version */
 #define RPA    SPRN_RPA        /* Required Physical Address Register */
-#define SDR1   SPRN_SDR1       /* MMU hash base register */
+#define SDR1   SPRN_SDR1       /* MMU hash base register */
 #define SPR0   SPRN_SPRG0      /* Supervisor Private Registers */
 #define SPR1   SPRN_SPRG1
 #define SPR2   SPRN_SPRG2
 #define SPRG7   SPRN_SPRG7
 #define SRR0   SPRN_SRR0       /* Save and Restore Register 0 */
 #define SRR1   SPRN_SRR1       /* Save and Restore Register 1 */
+#define SRR2   SPRN_SRR2       /* Save and Restore Register 2 */
+#define SRR3   SPRN_SRR3       /* Save and Restore Register 3 */
 #define SVR    SPRN_SVR        /* System Version Register */
 #define TBRL   SPRN_TBRL       /* Time Base Read Lower Register */
 #define TBRU   SPRN_TBRU       /* Time Base Read Upper Register */
 #define IVOR35 SPRN_IVOR35
 #define MCSRR0 SPRN_MCSRR0
 #define MCSRR1 SPRN_MCSRR1
-#define L1CSR0         SPRN_L1CSR0
+#define L1CSR0 SPRN_L1CSR0
 #define L1CSR1 SPRN_L1CSR1
 #define MCSR   SPRN_MCSR
 #define MMUCSR0        SPRN_MMUCSR0
 #define PID1   SPRN_PID1
 #define PID2   SPRN_PID2
 #define MAS0   SPRN_MAS0
-#define MAS1   SPRN_MAS1
+#define MAS1   SPRN_MAS1
 #define MAS2   SPRN_MAS2
 #define MAS3   SPRN_MAS3
 #define MAS4   SPRN_MAS4
 
 #define DCRN_BEAR      0x090   /* Bus Error Address Register */
 #define DCRN_BESR      0x091   /* Bus Error Syndrome Register */
-#define   BESR_DSES            0x80000000      /* Data-Side Error Status */
+#define   BESR_DSES    0x80000000      /* Data-Side Error Status */
 #define   BESR_DMES    0x40000000      /* DMA Error Status */
 #define   BESR_RWS     0x20000000      /* Read/Write Status */
 #define   BESR_ETMASK  0x1C000000      /* Error Type */
 #define   IOCR_E3LP    0x01000000
 #define   IOCR_E4TE    0x00800000
 #define   IOCR_E4LP    0x00400000
-#define   IOCR_EDT             0x00080000
-#define   IOCR_SOR             0x00040000
+#define   IOCR_EDT     0x00080000
+#define   IOCR_SOR     0x00040000
 #define   IOCR_EDO     0x00008000
 #define   IOCR_2XC     0x00004000
 #define   IOCR_ATC     0x00002000
 #define PVR_823                PVR_821
 #define PVR_850                PVR_821
 #define PVR_860                PVR_821
-#define PVR_7400               0x000C0000
+#define PVR_7400       0x000C0000
 #define PVR_8240       0x00810100
 
 /*
index 3c4b37b..d8b6b46 100644 (file)
@@ -38,7 +38,7 @@ typedef volatile unsigned char        vu_char;
 #include <linux/string.h>
 #include <asm/ptrace.h>
 #include <stdarg.h>
-#if defined(CONFIG_PCI) && defined(CONFIG_440)
+#if defined(CONFIG_PCI) && (defined(CONFIG_4xx) && !defined(CONFIG_AP1000))
 #include <pci.h>
 #endif
 #if defined(CONFIG_8xx)
@@ -248,10 +248,11 @@ void      pci_init      (void);
 void   pci_init_board(void);
 void   pciinfo       (int, int);
 
-#if defined(CONFIG_PCI) && defined(CONFIG_440)
-#   if defined(CFG_PCI_PRE_INIT)
+#if defined(CONFIG_PCI) && (defined(CONFIG_4xx) && !defined(CONFIG_AP1000))
     int           pci_pre_init        (struct pci_controller * );
-#   endif
+#endif
+
+#if defined(CONFIG_PCI) && defined(CONFIG_440)
 #   if defined(CFG_PCI_TARGET_INIT)
        void    pci_target_init      (struct pci_controller *);
 #   endif
index 5b54f30..bc30977 100644 (file)
 /*
  * IPB Bus clocking configuration.
  */
-#define CFG_IPBSPEED_133               /* define for 133MHz speed */
+#define CFG_IPBCLK_EQUALS_XLBCLK               /* define for 133MHz speed */
 
 /*
  * PCI Bus clocking configuration
  *
  * Actually a PCI Clock of 66 MHz is only set (in cpu_init.c) if
- * CFG_IPBSPEED_133 is defined. This is because a PCI Clock of 66 MHz yet
- * hasn't been tested with a IPB Bus Clock of 66 MHz.
+ * CFG_IPBCLK_EQUALS_XLBCLK is defined. This is because a PCI Clock
+ *  of 66 MHz yet hasn't been tested with a IPB Bus Clock of 66 MHz.
  */
-#if defined(CFG_IPBSPEED_133)
-# define CFG_PCISPEED_66                       /* define for 66MHz speed */
+#if defined(CFG_IPBCLK_EQUALS_XLBCLK)
+# define CFG_PCICLK_EQUALS_IPBCLK_DIV2 /* define for 66MHz speed */
 #endif
 
 /*
 
 #define CFG_BOOTCS_START       CFG_FLASH_BASE
 #define CFG_BOOTCS_SIZE                CFG_FLASH_SIZE
-#ifdef CFG_PCISPEED_66
+#ifdef CFG_PCICLK_EQUALS_IPBCLK_DIV2
 # define CFG_BOOTCS_CFG                0x0008DF30      /* for pci_clk  = 66 MHz */
 #else
 # define CFG_BOOTCS_CFG                0x0004DF30      /* for pci_clk = 33 MHz  */
index 047e2f1..9acde1e 100644 (file)
 #define CONFIG_MII             1       /* MII PHY management           */
 #define CONFIG_PHY_ADDR                0       /* PHY address                  */
 #define CONFIG_LXT971_NO_SLEEP  1       /* disable sleep mode in LXT971 */
+#define CONFIG_RESET_PHY_R      1       /* use reset_phy() to disable phy sleep mode */
+
+#define CONFIG_NET_MULTI       1
+#undef  CONFIG_HAS_ETH1
 
 #define CONFIG_BOOTP_MASK      (CONFIG_BOOTP_DEFAULT | \
                                 CONFIG_BOOTP_DNS | \
index d756f44..3fc99c5 100644 (file)
@@ -37,6 +37,7 @@
 #define CONFIG_4xx             1       /* ...member of PPC4xx family   */
 #define CONFIG_CPCI405         1       /* ...on a CPCI405 board        */
 #define CONFIG_CPCI405_VER2    1       /* ...version 2                 */
+#undef  CONFIG_CPCI405_6U               /* enable this for 6U boards    */
 
 #define CONFIG_BOARD_EARLY_INIT_F 1    /* call board_early_init_f()    */
 
 #define CONFIG_MII             1       /* MII PHY management           */
 #define CONFIG_PHY_ADDR                0       /* PHY address                  */
 #define CONFIG_LXT971_NO_SLEEP  1       /* disable sleep mode in LXT971 */
+#define CONFIG_RESET_PHY_R      1       /* use reset_phy() to disable phy sleep mode */
+
+#define CONFIG_NET_MULTI       1
+#undef  CONFIG_HAS_ETH1
 
 #define CONFIG_RTC_M48T35A     1               /* ST Electronics M48 timekeeper */
 
index 852d94a..4e2e1a8 100644 (file)
 #define CONFIG_MII             1       /* MII PHY management           */
 #define CONFIG_PHY_ADDR                0       /* PHY address                  */
 #define CONFIG_LXT971_NO_SLEEP  1       /* disable sleep mode in LXT971 */
+#define CONFIG_RESET_PHY_R      1       /* use reset_phy() to disable phy sleep mode */
+
+#define CONFIG_NET_MULTI       1
+#undef  CONFIG_HAS_ETH1
 
 #define CONFIG_RTC_M48T35A     1               /* ST Electronics M48 timekeeper */
 
index 2260327..ab302df 100644 (file)
 #define CONFIG_MII             1       /* MII PHY management           */
 #define CONFIG_PHY_ADDR                0       /* PHY address                  */
 #define CONFIG_LXT971_NO_SLEEP  1       /* disable sleep mode in LXT971 */
+#define CONFIG_RESET_PHY_R      1       /* use reset_phy() to disable phy sleep mode */
+
+#define CONFIG_NET_MULTI       1
+#undef  CONFIG_HAS_ETH1
 
 #define CONFIG_RTC_M48T35A     1               /* ST Electronics M48 timekeeper */
 
index 90d3a8d..7b5f728 100644 (file)
@@ -33,6 +33,7 @@
  *----------------------------------------------------------------------*/
 #define CONFIG_CPCI440         1           /* Board is ebony           */
 #define CONFIG_440GP           1           /* Specifc GP support       */
+#define CONFIG_440             1           /* ... PPC440 family        */
 #define CONFIG_4xx             1           /* ... PPC4xx family        */
 #define CONFIG_BOARD_EARLY_INIT_F 1        /* Call board_early_init_f  */
 #undef CFG_DRAM_TEST                       /* Disable-takes long time! */
index 5988112..73be069 100644 (file)
  * IPB Bus clocking configuration.
  */
 #if defined(CONFIG_LITE5200B)
-#define CFG_IPBSPEED_133       /* define for 133MHz speed */
+#define CFG_IPBCLK_EQUALS_XLBCLK       /* define for 133MHz speed */
 #else
-#undef CFG_IPBSPEED_133        /* define for 133MHz speed */
+#undef CFG_IPBCLK_EQUALS_XLBCLK        /* define for 133MHz speed */
 #endif
 #endif /* CONFIG_MPC5200 */
 
index 2ad6f06..48b94ee 100644 (file)
@@ -38,6 +38,7 @@
  *----------------------------------------------------------------------*/
 #define CONFIG_KAREF        1          /* Board is Kamino Ref Variant */
 #define CONFIG_440GX             1          /* Specifc GX support      */
+#define CONFIG_440               1          /* ... PPC440 family       */
 #define CONFIG_4xx               1          /* ... PPC4xx family       */
 #define CONFIG_BOARD_EARLY_INIT_F 1         /* Call board_pre_init     */
 #define CONFIG_MISC_INIT_F       1          /* Call board misc_init_f  */
 #define CFG_PCI_TARGBASE      (CFG_PCI_MEMBASE)
 
 /* Board-specific PCI */
-#define CFG_PCI_PRE_INIT                    /* enable board pci_pre_init*/
 #define CFG_PCI_TARGET_INIT                 /* let board init pci target*/
 
 #define CFG_PCI_SUBSYS_VENDORID 0x17BA      /* Sandburst */
index 465a4ec..7aae2bd 100644 (file)
  *----------------------------------------------------------------------*/
 #define CONFIG_METROBOX                  1          /* Board is Metrobox       */
 #define CONFIG_440GX             1          /* Specifc GX support      */
+#define CONFIG_440               1          /* ... PPC440 family       */
 #define CONFIG_4xx               1          /* ... PPC4xx family       */
 #define CONFIG_BOARD_EARLY_INIT_F 1         /* Call board_pre_init     */
 #define CONFIG_MISC_INIT_F       1          /* Call board misc_init_f  */
 #define CFG_PCI_TARGBASE      (CFG_PCI_MEMBASE)
 
 /* Board-specific PCI */
-#define CFG_PCI_PRE_INIT                    /* enable board pci_pre_init*/
 #define CFG_PCI_TARGET_INIT                 /* let board init pci target*/
 
 #define CFG_PCI_SUBSYS_VENDORID 0x17BA      /* Sandburst */
index 43a9d6f..12af24f 100644 (file)
 #define CONFIG_HOSTNAME                unknown
 #define CONFIG_ROOTPATH                /opt/nfsroot
 #define CONFIG_BOOTFILE                uImage
+#define CONFIG_UBOOTPATH       u-boot.bin      /* U-Boot image on TFTP server */
 
 #define CONFIG_SERVERIP                192.168.1.1
 #define CONFIG_GATEWAYIP       192.168.1.1
 
 #define        CONFIG_EXTRA_ENV_SETTINGS                                       \
    "netdev=eth0\0"                                                      \
+   "uboot=" MK_STR(CONFIG_UBOOTPATH) "\0"                              \
+   "tftpflash=tftpboot $loadaddr $uboot; "                     \
+       "protect off " MK_STR(TEXT_BASE) " +$filesize; "        \
+       "erase " MK_STR(TEXT_BASE) " +$filesize; "              \
+       "cp.b $loadaddr " MK_STR(TEXT_BASE) " $filesize; "      \
+       "protect on " MK_STR(TEXT_BASE) " +$filesize; "         \
+       "cmp.b $loadaddr " MK_STR(TEXT_BASE) " $filesize\0"     \
    "consoledev=ttyS0\0"                                                 \
    "ramdiskaddr=2000000\0"                                             \
    "ramdiskfile=your.ramdisk.u-boot\0"                                  \
-   "dtbaddr=400000\0"                                          \
+   "dtbaddr=c00000\0"                                          \
    "dtbfile=mpc8641_hpcn.dtb\0"                                  \
    "en-wd=mw.b f8100010 0x08; echo -expect:- 08; md.b f8100010 1\0" \
    "dis-wd=mw.b f8100010 0x00; echo -expect:- 00; md.b f8100010 1\0" \
index 9c241e6..7d91a01 100644 (file)
 /*
  * IPB Bus clocking configuration.
  */
-#undef CFG_IPBSPEED_133                /* define for 133MHz speed */
+#undef CFG_IPBCLK_EQUALS_XLBCLK                /* define for 133MHz speed */
 #endif
 /*
  * I2C configuration
diff --git a/include/configs/SMN42.h b/include/configs/SMN42.h
new file mode 100755 (executable)
index 0000000..d588818
--- /dev/null
@@ -0,0 +1,199 @@
+/*
+ * (C) Copyright 2007
+ * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
+ *
+ * Configuation settings for the SMN42 board from Siemens.
+ *
+ * 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 __CONFIG_H
+#define __CONFIG_H
+
+/*
+ * If we are developing, we might want to start u-boot from ram
+ * so we MUST NOT initialize critical regs like mem-timing ...
+ */
+#undef CONFIG_INIT_CRITICAL            /* undef for developing */
+
+#undef CONFIG_SKIP_LOWLEVEL_INIT
+#undef CONFIG_SKIP_RELOCATE_UBOOT
+
+/*
+ * High Level Configuration Options
+ * (easy to change)
+ */
+#define CONFIG_ARM7            1       /* This is a ARM7 CPU   */
+#define CONFIG_ARM_THUMB       1       /* this is an ARM720TDMI */
+#define CONFIG_LPC2292
+#undef CONFIG_ARM7_REVD                /* disable ARM720 REV.D Workarounds */
+
+#undef CONFIG_USE_IRQ                  /* don't need them anymore */
+
+/*
+ * Size of malloc() pool
+ */
+#define CFG_MALLOC_LEN         (CFG_ENV_SIZE + 128*1024)
+#define CFG_GBL_DATA_SIZE      128     /* size in bytes reserved for initial data */
+
+/*
+ * Hardware drivers
+ */
+
+/*
+ * select serial console configuration
+ */
+#define CONFIG_SERIAL1         1       /* we use Serial line 1 */
+
+/* allow to overwrite serial and ethaddr */
+#define CONFIG_ENV_OVERWRITE
+
+#define CONFIG_BAUDRATE                115200
+
+#define CONFIG_BOOTP_MASK      (CONFIG_BOOTP_DEFAULT|CONFIG_BOOTP_BOOTFILESIZE)
+
+/* enable I2C and select the hardware/software driver */
+#undef CONFIG_HARD_I2C                 /* I2C with hardware support    */
+#define CONFIG_SOFT_I2C                1       /* I2C bit-banged               */
+/* this would be 0xAE if E0, E1 and E2 were pulled high */
+#define CFG_I2C_SLAVE          0xA0
+#define CFG_I2C_EEPROM_ADDR    (0xA0 >> 1)
+#define CFG_I2C_EEPROM_ADDR_LEN 2 /* 16 bit address */
+#define CFG_EEPROM_PAGE_WRITE_BITS 6 /* 64 bytes per write */
+#define CFG_EEPROM_PAGE_WRITE_DELAY_MS 20
+/* not used but required by devices.c */
+#define CFG_I2C_SPEED 10000
+
+#ifdef CONFIG_SOFT_I2C
+/*
+ * Software (bit-bang) I2C driver configuration
+ */
+#define SCL            0x00000004              /* P0.2 */
+#define SDA            0x00000008              /* P0.3 */
+
+#define        I2C_READ        ((GET32(IO0PIN) & SDA) ? 1 : 0)
+#define        I2C_SDA(x)      { if (x) PUT32(IO0SET, SDA); else PUT32(IO0CLR, SDA); }
+#define        I2C_SCL(x)      { if (x) PUT32(IO0SET, SCL); else PUT32(IO0CLR, SCL); }
+#define        I2C_DELAY       { udelay(100); }
+#define        I2C_ACTIVE      { unsigned int i2ctmp; \
+                                         i2ctmp = GET32(IO0DIR); \
+                                         i2ctmp |= SDA; \
+                                         PUT32(IO0DIR, i2ctmp); }
+#define        I2C_TRISTATE    { unsigned int i2ctmp; \
+                                             i2ctmp = GET32(IO0DIR); \
+                                             i2ctmp &= ~SDA; \
+                                                 PUT32(IO0DIR, i2ctmp); }
+#endif /* CONFIG_SOFT_I2C */
+
+/*
+ * Supported commands
+ */
+#define CONFIG_COMMANDS               (CONFIG_CMD_DFL  | \
+                               CFG_CMD_DHCP    | \
+                               CFG_CMD_FAT             | \
+                               CFG_CMD_MMC             | \
+                               CFG_CMD_NET             | \
+                               CFG_CMD_EEPROM  | \
+                               CFG_CMD_PING)
+
+#define CONFIG_DOS_PARTITION
+
+/* this must be included AFTER the definition of CONFIG_COMMANDS (if any) */
+#include <cmd_confdefs.h>
+
+#define CONFIG_BOOTDELAY       5
+
+/*
+ * Miscellaneous configurable options
+ */
+#define        CFG_LONGHELP                            /* undef to save memory         */
+#define        CFG_PROMPT              "SMN42 # " /* Monitor Command Prompt    */
+#define        CFG_CBSIZE              256             /* Console I/O Buffer Size      */
+#define        CFG_PBSIZE (CFG_CBSIZE+sizeof(CFG_PROMPT)+16) /* Print Buffer Size */
+#define        CFG_MAXARGS             16              /* max number of command args   */
+#define CFG_BARGSIZE           CFG_CBSIZE      /* Boot Argument Buffer Size    */
+
+#define CFG_MEMTEST_START      0x81800000      /* memtest works on     */
+#define CFG_MEMTEST_END                0x83000000      /* 24 MB in SRAM        */
+
+#undef CFG_CLKS_IN_HZ          /* everything, incl board info, in Hz */
+
+#define        CFG_LOAD_ADDR           0x81000000      /* default load address */
+                                               /* for uClinux img is here*/
+
+#define CFG_SYS_CLK_FREQ       58982400        /* Hz */
+#define        CFG_HZ                  2048            /* decrementer freq in Hz */
+
+                                               /* valid baudrates */
+#define CFG_BAUDRATE_TABLE     { 9600, 19200, 38400, 57600, 115200 }
+
+/*-----------------------------------------------------------------------
+ * Stack sizes
+ *
+ * The stack sizes are set up in start.S using the settings below
+ */
+#define CONFIG_STACKSIZE       (128*1024)      /* regular stack */
+#ifdef CONFIG_USE_IRQ
+#define CONFIG_STACKSIZE_IRQ   (4*1024)        /* IRQ stack */
+#define CONFIG_STACKSIZE_FIQ   (4*1024)        /* FIQ stack */
+#endif
+
+/*-----------------------------------------------------------------------
+ * Physical Memory Map
+ */
+#define CONFIG_NR_DRAM_BANKS   1          /* we have 1 bank of SRAM */
+#define PHYS_SDRAM_1           0x81000000 /* SRAM Bank #1 */
+#define PHYS_SDRAM_1_SIZE      0x02000000 /* 32 MB SRAM */
+
+/* This is the external flash */
+#define PHYS_FLASH_1           0x80000000 /* Flash Bank #1 */
+#define PHYS_FLASH_SIZE                0x01000000 /* 16 MB */
+
+/*-----------------------------------------------------------------------
+ * FLASH and environment organization
+ */
+
+/*
+ * The first entry in CFG_FLASH_BANKS_LIST is a dummy, but it must be present.
+ */
+#define CFG_FLASH_BANKS_LIST   { 0, PHYS_FLASH_1 }
+#define CFG_FLASH_ADDR0                        0x555
+#define CFG_FLASH_ADDR1                        0x2AA
+#define CFG_FLASH_ERASE_TOUT   16384   /* Timeout for Flash Erase (in ms) */
+#define CFG_FLASH_WRITE_TOUT   5       /* Timeout for Flash Write (in ms) */
+
+#define CFG_MAX_FLASH_SECT     128  /* max number of sectors on one chip    */
+
+#define CFG_MAX_FLASH_BANKS    2       /* max number of memory banks           */
+
+#define        CFG_ENV_IS_IN_FLASH     1
+/* The Environment Sector is in the CPU-internal flash */
+#define CFG_FLASH_BASE         0
+#define CFG_ENV_OFFSET         0x3C000
+#define CFG_ENV_ADDR           (CFG_FLASH_BASE + CFG_ENV_OFFSET)
+#define CFG_ENV_SIZE           0x2000 /* Total Size of Environment Sector      */
+
+#define CONFIG_CMDLINE_TAG
+#define CONFIG_SETUP_MEMORY_TAGS
+#define CONFIG_INITRD_TAG
+#define CONFIG_MMC                     1
+/* we use this ethernet chip */
+#define CONFIG_ENC28J60
+
+#endif /* __CONFIG_H */
index 8a6e5a6..712668a 100644 (file)
 /*
  * IPB Bus clocking configuration.
  */
-#define CFG_IPBSPEED_133               /* define for 133MHz speed */
+#define CFG_IPBCLK_EQUALS_XLBCLK               /* define for 133MHz speed */
 
-#if defined(CFG_IPBSPEED_133)
+#if defined(CFG_IPBCLK_EQUALS_XLBCLK)
 /*
  * PCI Bus clocking configuration
  *
  * Actually a PCI Clock of 66 MHz is only set (in cpu_init.c) if
- * CFG_IPBSPEED_133 is defined. This is because a PCI Clock of 66 MHz yet hasn't
- * been tested with a IPB Bus Clock of 66 MHz.
+ * CFG_IPBCLK_EQUALS_XLBCLK is defined. This is because a PCI Clock
+ * of 66 MHz yet hasn't been tested with a IPB Bus Clock of 66 MHz.
  */
-#define CFG_PCISPEED_66                        /* define for 66MHz speed */
+#define CFG_PCICLK_EQUALS_IPBCLK_DIV2          /* define for 66MHz speed */
 #endif
 
 /*
 
 #define CFG_BOOTCS_START       CFG_FLASH_BASE
 #define CFG_BOOTCS_SIZE                CFG_FLASH_SIZE
-#ifdef CFG_PCISPEED_66
+#ifdef CFG_PCICLK_EQUALS_IPBCLK_DIV2
 #define CFG_BOOTCS_CFG         0x0008DF30 /* for pci_clk  = 66 MHz */
 #else
 #define CFG_BOOTCS_CFG         0x0004DF30 /* for pci_clk = 33 MHz */
index f41dbd0..1cc9ce9 100644 (file)
 /*
  * IPB Bus clocking configuration.
  */
-#undef CFG_IPBSPEED_133                /* define for 133MHz speed */
+#undef CFG_IPBCLK_EQUALS_XLBCLK                /* define for 133MHz speed */
 
 /*
  * I2C configuration
index 7069b35..aa3627b 100644 (file)
@@ -44,7 +44,7 @@
 
 #define CFG_MPC5XXX_CLKIN      33000000 /* ... running at 33.000000MHz         */
 
-#define BOOTFLAG_COLD          0x01    /* Normal Power-On: Boot from FLASH     */
+#define BOOTFLAG_COLD          0x01    /* Normal Power-On: Boot from FLASH     */
 #define BOOTFLAG_WARM          0x02    /* Software reboot                      */
 
 #define CFG_CACHELINE_SIZE     32      /* For MPC5xxx CPUs                     */
 #ifndef CONFIG_CAM5200
 #define CUSTOM_ENV_SETTINGS                                            \
        "bootfile=/tftpboot/tqm5200/uImage\0"                           \
+       "bootfile_fdt=/tftpboot/tqm5200/uImage_fdt\0"                   \
+       "fdt_file=/tftpboot/tqm5200/tqm5200.dtb\0"                      \
        "u-boot=/tftpboot/tqm5200/u-boot.bin\0"
 #else
-#define CUSTOM_ENV_SETTINGS                                            \
+#define CUSTOM_ENV_SETTINGS                                            \
        "bootfile=cam5200/uImage\0"                                     \
        "u-boot=cam5200/u-boot.bin\0"                                   \
        "setup=tftp 200000 cam5200/setup.img; autoscr 200000\0"
 #endif
 
 #define CONFIG_EXTRA_ENV_SETTINGS                                      \
+       "console=ttyS0\0"                                               \
+       "kernel_addr=200000\0"                                          \
+       "fdt_addr=400000\0"                                             \
+       "hostname=tqm5200\0"                                            \
        "netdev=eth0\0"                                                 \
        "rootpath=/opt/eldk/ppc_6xx\0"                                  \
        "ramargs=setenv bootargs root=/dev/ram rw\0"                    \
                "ip=${ipaddr}:${serverip}:${gatewayip}:${netmask}"      \
                ":${hostname}:${netdev}:off panic=1\0"                  \
        "addcons=setenv bootargs ${bootargs} "                          \
-               "console=ttyS0,${baudrate}\0"                           \
+               "console=${console},${baudrate}\0"                      \
        "flash_self=run ramargs addip addcons;"                         \
                "bootm ${kernel_addr} ${ramdisk_addr}\0"                \
        "flash_nfs=run nfsargs addip addcons;"                          \
                "bootm ${kernel_addr}\0"                                \
-       "net_nfs=tftp 200000 ${bootfile};run nfsargs addip addcons;"    \
-               "bootm\0"                                               \
+       "net_nfs=tftp ${kernel_addr} ${bootfile};"                      \
+               "run nfsargs addip addcons;bootm\0"                     \
+       "net_nfs_fdt=tftp ${kernel_addr} ${bootfile_fdt};"              \
+               "tftp ${fdt_addr} ${fdt_file};setenv console ttyPSC0;"  \
+               "run nfsargs addip addcons;"                            \
+               "bootm ${kernel_addr} - ${fdt_addr}\0"                  \
        CUSTOM_ENV_SETTINGS                                             \
        "load=tftp 200000 ${u-boot}\0"                                  \
        ENV_UPDT                                                        \
 /*
  * IPB Bus clocking configuration.
  */
-#define CFG_IPBSPEED_133               /* define for 133MHz speed */
+#define CFG_IPBCLK_EQUALS_XLBCLK               /* define for 133MHz speed */
 
-#if defined(CFG_IPBSPEED_133) && !defined(CONFIG_CAM5200)
+#if defined(CFG_IPBCLK_EQUALS_XLBCLK) && !defined(CONFIG_CAM5200)
 /*
  * PCI Bus clocking configuration
  *
  * Actually a PCI Clock of 66 MHz is only set (in cpu_init.c) if
- * CFG_IPBSPEED_133 is defined. This is because a PCI Clock of 66 MHz yet hasn't
- * been tested with a IPB Bus Clock of 66 MHz.
+ * CFG_IPBCLK_EQUALS_XLBCLK is defined. This is because a PCI Clock of
+ * 66 MHz yet hasn't been tested with a IPB Bus Clock of 66 MHz.
  */
-#define CFG_PCISPEED_66                        /* define for 66MHz speed */
+#define CFG_PCICLK_EQUALS_IPBCLK_DIV2  /* define for 66MHz speed */
 #endif
 
 /*
 
 #define CFG_BOOTCS_START       CFG_FLASH_BASE
 #define CFG_BOOTCS_SIZE                CFG_FLASH_SIZE
-#ifdef CFG_PCISPEED_66
+#ifdef CFG_PCICLK_EQUALS_IPBCLK_DIV2
 #define CFG_BOOTCS_CFG         0x0008DF30 /* for pci_clk  = 66 MHz */
 #else
 #define CFG_BOOTCS_CFG         0x0004DF30 /* for pci_clk = 33 MHz */
 /* Interval between registers                                               */
 #define CFG_ATA_STRIDE         4
 
+/*-----------------------------------------------------------------------
+ * Open firmware flat tree support
+ *-----------------------------------------------------------------------
+ */
+#define CONFIG_OF_FLAT_TREE    1
+#define CONFIG_OF_BOARD_SETUP  1
+
+/* maximum size of the flat tree (8K) */
+#define OF_FLAT_TREE_MAX_SIZE  8192
+#define OF_CPU                 "PowerPC,5200@0"
+#define OF_SOC                 "soc5200@f0000000"
+#define OF_TBCLK               (bd->bi_busfreq / 4)
+#define OF_STDOUT_PATH         "/soc5200@f0000000/serial@2000"
+
 #endif /* __CONFIG_H */
index 8175703..d8686dd 100644 (file)
 /*
  * IPB Bus clocking configuration.
  */
-#undef CFG_IPBSPEED_133                /* define for 133MHz speed */
+#undef CFG_IPBCLK_EQUALS_XLBCLK                /* define for 133MHz speed */
 #endif
 
 /*
index 9b32514..f2ad097 100644 (file)
@@ -238,7 +238,6 @@ extern void out32(unsigned int, unsigned long);
 #define CFG_PCI_TARGBASE    0x80000000 /* PCIaddr mapped to CFG_PCI_MEMBASE */
 
 /* Board-specific PCI */
-#define CFG_PCI_PRE_INIT               /* enable board pci_pre_init()  */
 #define CFG_PCI_TARGET_INIT                /* let board init pci target    */
 
 #define CFG_PCI_SUBSYS_VENDORID 0x1014 /* IBM */
index 35b6a51..517d130 100644 (file)
@@ -34,7 +34,9 @@
 #define CONFIG_ACADIA          1               /* Board is Acadia      */
 #define CONFIG_4xx             1               /* ... PPC4xx family    */
 #define CONFIG_405EZ           1               /* Specifc 405EZ support*/
-#define CONFIG_SYS_CLK_FREQ    66666666        /* external freq to pll */
+/* Detect Acadia PLL input clock automatically via CPLD bit            */
+#define CONFIG_SYS_CLK_FREQ    ((in8(CFG_CPLD_BASE + 0) == 0x0c) ? \
+                               66666666 : 33333000)
 
 #define CONFIG_BOARD_EARLY_INIT_F 1            /* Call board_early_init_f */
 #define CONFIG_MISC_INIT_F     1               /* Call misc_init_f     */
@@ -73,7 +75,7 @@
 #define CFG_TEMP_STACK_OCM     1               /* OCM as init ram      */
 
 /* On Chip Memory location */
-#define CFG_OCM_DATA_ADDR      0xF8000000
+#define CFG_OCM_DATA_ADDR      0xf8000000
 #define CFG_OCM_DATA_SIZE      0x4000                  /* 16K of onchip SRAM           */
 #define CFG_INIT_RAM_ADDR      CFG_OCM_DATA_ADDR       /* inside of SRAM               */
 #define CFG_INIT_RAM_END       CFG_OCM_DATA_SIZE       /* End of used area in RAM      */
 /*-----------------------------------------------------------------------
  * FLASH related
  *----------------------------------------------------------------------*/
+#if !defined(CONFIG_NAND_U_BOOT) && !defined(CONFIG_NAND_SPL)
 #define CFG_FLASH_CFI                  /* The flash is CFI compatible  */
 #define CFG_FLASH_CFI_DRIVER           /* Use common CFI driver        */
 
 #define CFG_FLASH_USE_BUFFER_WRITE 1   /* use buffered writes (20x faster)     */
 #define CFG_FLASH_EMPTY_INFO           /* print 'E' for empty sector on flinfo */
 
+#define        _CFG_CMD_INCLUDE        (CFG_CMD_ALL)
+#else
+#define        CFG_NO_FLASH            1       /* No NOR on Acadia when NAND-booting   */
+#define        _CFG_CMD_INCLUDE        ((CFG_CMD_ALL) & ~(CFG_CMD_FLASH | CFG_CMD_IMLS))
+#endif
+
 #ifdef CFG_ENV_IS_IN_FLASH
 #define CFG_ENV_SECT_SIZE      0x40000 /* size of one complete sector  */
 #define CFG_ENV_ADDR           (CFG_MONITOR_BASE-CFG_ENV_SECT_SIZE)
 #define CFG_ENV_SIZE_REDUND    (CFG_ENV_SIZE)
 #endif
 
+/*
+ * IPL (Initial Program Loader, integrated inside CPU)
+ * Will load first 4k from NAND (SPL) into cache and execute it from there.
+ *
+ * SPL (Secondary Program Loader)
+ * Will load special U-Boot version (NUB) from NAND and execute it. This SPL
+ * has to fit into 4kByte. It sets up the CPU and configures the SDRAM
+ * controller and the NAND controller so that the special U-Boot image can be
+ * loaded from NAND to SDRAM.
+ *
+ * NUB (NAND U-Boot)
+ * This NAND U-Boot (NUB) is a special U-Boot version which can be started
+ * from RAM. Therefore it mustn't (re-)configure the SDRAM controller.
+ *
+ * On 440EPx the SPL is copied to SDRAM before the NAND controller is
+ * set up. While still running from cache, I experienced problems accessing
+ * the NAND controller.        sr - 2006-08-25
+ */
+#define CFG_NAND_BOOT_SPL_SRC  0xfffff000      /* SPL location                 */
+#define CFG_NAND_BOOT_SPL_SIZE (4 << 10)       /* SPL size                     */
+#define CFG_NAND_BOOT_SPL_DST  (CFG_OCM_DATA_ADDR + (16 << 10)) /* Copy SPL here*/
+#define CFG_NAND_U_BOOT_DST    0x01000000      /* Load NUB to this addr        */
+#define CFG_NAND_U_BOOT_START  CFG_NAND_U_BOOT_DST /* Start NUB from this addr */
+#define CFG_NAND_BOOT_SPL_DELTA        (CFG_NAND_BOOT_SPL_SRC - CFG_NAND_BOOT_SPL_DST)
+
+/*
+ * Define the partitioning of the NAND chip (only RAM U-Boot is needed here)
+ */
+#define CFG_NAND_U_BOOT_OFFS   (16 << 10)      /* Offset to RAM U-Boot image   */
+#define CFG_NAND_U_BOOT_SIZE   (384 << 10)     /* Size of RAM U-Boot image     */
+
+/*
+ * Now the NAND chip has to be defined (no autodetection used!)
+ */
+#define CFG_NAND_PAGE_SIZE     512             /* NAND chip page size          */
+#define CFG_NAND_BLOCK_SIZE    (16 << 10)      /* NAND chip block size         */
+#define CFG_NAND_PAGE_COUNT    32              /* NAND chip page count         */
+#define CFG_NAND_BAD_BLOCK_POS 5               /* Location of bad block marker */
+#undef CFG_NAND_4_ADDR_CYCLE                   /* No fourth addr used (<=32MB) */
+
+#define CFG_NAND_ECCSIZE       256
+#define CFG_NAND_ECCBYTES      3
+#define CFG_NAND_ECCSTEPS      (CFG_NAND_PAGE_SIZE / CFG_NAND_ECCSIZE)
+#define CFG_NAND_OOBSIZE       16
+#define CFG_NAND_ECCTOTAL      (CFG_NAND_ECCBYTES * CFG_NAND_ECCSTEPS)
+#define CFG_NAND_ECCPOS                {0, 1, 2, 3, 6, 7}
+
+#ifdef CFG_ENV_IS_IN_NAND
+/*
+ * For NAND booting the environment is embedded in the U-Boot image. Please take
+ * look at the file board/amcc/sequoia/u-boot-nand.lds for details.
+ */
+#define CFG_ENV_SIZE           CFG_NAND_BLOCK_SIZE
+#define CFG_ENV_OFFSET         (CFG_NAND_U_BOOT_OFFS + CFG_ENV_SIZE)
+#define CFG_ENV_OFFSET_REDUND  (CFG_ENV_OFFSET + CFG_ENV_SIZE)
+#endif
+
 /*-----------------------------------------------------------------------
  * RAM (CRAM)
  *----------------------------------------------------------------------*/
        "update=protect off fffc0000 ffffffff;era fffc0000 ffffffff;"   \
                "cp.b ${fileaddr} fffc0000 ${filesize};"                \
                "setenv filesize;saveenv\0"                             \
-       "upd=run load;run update\0"                                     \
+       "upd=run load update\0"                                         \
+       "nload=tftp 200000 acadia/u-boot-nand.bin\0"                    \
+       "nupdate=nand erase 0 60000;nand write 200000 0 60000;"         \
+               "setenv filesize;saveenv\0"                             \
+       "nupd=run nload nupdate\0"                                      \
        "kozio=bootm ffc60000\0"                                        \
        ""
 #define CONFIG_BOOTCOMMAND     "run flash_self"
 #define CONFIG_USB_OHCI
 #define CONFIG_USB_STORAGE
 
-#if 0 /* test-only */
-#define TEST_ONLY_NAND
-#endif
-
-#ifdef TEST_ONLY_NAND
-#define CMD_NAND               CFG_CMD_NAND
-#else
-#define CMD_NAND               0
-#endif
-
 /* Partitions */
 #define CONFIG_MAC_PARTITION
 #define CONFIG_DOS_PARTITION
 
 #define CONFIG_SUPPORT_VFAT
 
-#define CONFIG_COMMANDS       (CONFIG_CMD_DFL  |       \
-                              CFG_CMD_ASKENV   |       \
-                              CFG_CMD_DHCP     |       \
-                              CFG_CMD_DTT      |       \
-                              CFG_CMD_DIAG     |       \
-                              CFG_CMD_EEPROM   |       \
-                              CFG_CMD_ELF      |       \
-                              CFG_CMD_FAT      |       \
-                              CFG_CMD_I2C      |       \
-                              CFG_CMD_IRQ      |       \
-                              CFG_CMD_MII      |       \
-                              CMD_NAND         |       \
-                              CFG_CMD_NET      |       \
-                              CFG_CMD_NFS      |       \
-                              CFG_CMD_PCI      |       \
-                              CFG_CMD_PING     |       \
-                              CFG_CMD_REGINFO  |       \
-                              CFG_CMD_USB)
+#define CONFIG_COMMANDS        ((CONFIG_CMD_DFL & _CFG_CMD_INCLUDE)    |       \
+                        CFG_CMD_ASKENV |                               \
+                        CFG_CMD_DHCP   |                               \
+                        CFG_CMD_DTT    |                               \
+                        CFG_CMD_DIAG   |                               \
+                        CFG_CMD_EEPROM |                               \
+                        CFG_CMD_ELF    |                               \
+                        CFG_CMD_FAT    |                               \
+                        CFG_CMD_I2C    |                               \
+                        CFG_CMD_IRQ    |                               \
+                        CFG_CMD_MII    |                               \
+                        CFG_CMD_NAND   |                               \
+                        CFG_CMD_NET    |                               \
+                        CFG_CMD_NFS    |                               \
+                        CFG_CMD_PCI    |                               \
+                        CFG_CMD_PING   |                               \
+                        CFG_CMD_REGINFO |                              \
+                        CFG_CMD_USB)
 
 /* this must be included AFTER the definition of CONFIG_COMMANDS (if any) */
 #include <cmd_confdefs.h>
  */
 #define CFG_BOOTMAPSZ          (8 << 20)       /* Initial Memory map for Linux */
 
-#ifdef TEST_ONLY_NAND
 /*-----------------------------------------------------------------------
  * NAND FLASH
  *----------------------------------------------------------------------*/
 #define NAND_MAX_CHIPS         1
 #define CFG_NAND_BASE          (CFG_NAND_ADDR + CFG_NAND_CS)
 #define CFG_NAND_SELECT_DEVICE  1      /* nand driver supports mutipl. chips   */
-#endif
 
 /*-----------------------------------------------------------------------
  * Cache Configuration
 /*-----------------------------------------------------------------------
  * External Bus Controller (EBC) Setup
  *----------------------------------------------------------------------*/
-#define CFG_NAND_CS            0               /* NAND chip connected to CSx   */
-
+#if !defined(CONFIG_NAND_U_BOOT) && !defined(CONFIG_NAND_SPL)
+#define CFG_NAND_CS            3
 /* Memory Bank 0 (Flash) initialization                                                */
 #define CFG_EBC_PB0AP          0x03337200
 #define CFG_EBC_PB0CR          0xfe0bc000
 
+/* Memory Bank 3 (NAND-FLASH) initialization                                   */
+#define CFG_EBC_PB3AP          0x018003c0
+#define CFG_EBC_PB3CR          (CFG_NAND_ADDR | 0x1c000)
+
 /* Just initial configuration for CRAM. Will be changed in memory.c to sync mode*/
 /* Memory Bank 1 (CRAM) initialization                                         */
 #define CFG_EBC_PB1AP          0x030400c0
 /* Memory Bank 2 (CRAM) initialization                                         */
 #define CFG_EBC_PB2AP          0x030400c0
 #define CFG_EBC_PB2CR          0x020bc000
+#else
+#define CFG_NAND_CS            0               /* NAND chip connected to CSx   */
+/* Memory Bank 0 (NAND-FLASH) initialization                                   */
+#define CFG_EBC_PB0AP          0x018003c0
+#define CFG_EBC_PB0CR          (CFG_NAND_ADDR | 0x1c000)
 
-/* Memory Bank 3 (NAND-FLASH) initialization                                   */
-#define CFG_EBC_PB3AP          0x018003c0
-#define CFG_EBC_PB3CR          (CFG_NAND_ADDR | 0x1c000)
+/*
+ * When NAND-booting the CRAM EBC setup must be done in sync mode, since the
+ * NAND-SPL already initialized the CRAM and EBC to sync mode.
+ */
+/* Memory Bank 1 (CRAM) initialization                                         */
+#define CFG_EBC_PB1AP          0x9C0201C0
+#define CFG_EBC_PB1CR          0x000bc000
+
+/* Memory Bank 2 (CRAM) initialization                                         */
+#define CFG_EBC_PB2AP          0x9C0201C0
+#define CFG_EBC_PB2CR          0x020bc000
+#endif
 
 /* Memory Bank 4 (CPLD) initialization                                         */
 #define CFG_EBC_PB4AP          0x04006000
  * GPIO Setup
  *----------------------------------------------------------------------*/
 #define CFG_GPIO_CRAM_CLK      8
-#define CFG_GPIO_CRAM_WAIT     9
+#define CFG_GPIO_CRAM_WAIT     9               /* GPIO-In              */
 #define CFG_GPIO_CRAM_ADV      10
-#define CFG_GPIO_CRAM_CRE      (32 + 21)
+#define CFG_GPIO_CRAM_CRE      (32 + 21)       /* GPIO-Out             */
 
 /*-----------------------------------------------------------------------
  * Definitions for GPIO_0 setup (PPC405EZ specific)
  *
- * GPIO0[0-3]  - External Bus Controller CS_4 - CS_7 Outputs
+ * GPIO0[0-2]  - External Bus Controller CS_4 - CS_6 Outputs
+ * GPIO0[3]    - NAND FLASH Controller CE3 (NFCE3) Output
  * GPIO0[4]    - External Bus Controller Hold Input
  * GPIO0[5]    - External Bus Controller Priority Input
  * GPIO0[6]    - External Bus Controller HLDA Output
  * GPIO0[28-30]        - Trace Outputs / PWM Inputs
  * GPIO0[31]   - PWM_8 I/O
  */
-#define CFG_GPIO0_TCR          0xC0000000
-#define CFG_GPIO0_OSRL         0x50000000
-#define CFG_GPIO0_OSRH         0x00000055
-#define CFG_GPIO0_ISR1L                0x00000000
+#define CFG_GPIO0_TCR          0xC0A00000
+#define CFG_GPIO0_OSRL         0x50004400
+#define CFG_GPIO0_OSRH         0x02000055
+#define CFG_GPIO0_ISR1L                0x00001000
 #define CFG_GPIO0_ISR1H                0x00000055
-#define CFG_GPIO0_TSRL         0x00000000
+#define CFG_GPIO0_TSRL         0x02000000
 #define CFG_GPIO0_TSRH         0x00000055
 
 /*-----------------------------------------------------------------------
  * GPIO1[16]   - SPI_SS_1_N Output
  * GPIO1[17-20]        - Trace Output/External Interrupts IRQ0 - IRQ3 inputs
  */
-#define CFG_GPIO1_OSRH         0x55455555
+#define CFG_GPIO1_TCR          0xFFFF8414
 #define CFG_GPIO1_OSRL         0x40000110
-#define CFG_GPIO1_ISR1H                0x00000000
+#define CFG_GPIO1_OSRH         0x55455555
 #define CFG_GPIO1_ISR1L                0x15555445
-#define CFG_GPIO1_TSRH         0x00000000
+#define CFG_GPIO1_ISR1H                0x00000000
 #define CFG_GPIO1_TSRL         0x00000000
-#define CFG_GPIO1_TCR          0xFFFF8014
+#define CFG_GPIO1_TSRH         0x00000000
 
 /*
  * Internal Definitions
index 8d9f0a1..f6f530c 100644 (file)
 /*
  * IPB Bus clocking configuration.
  */
-#define CFG_IPBSPEED_133               /* define for 133MHz speed */
+#define CFG_IPBCLK_EQUALS_XLBCLK               /* define for 133MHz speed */
 
-#if defined(CFG_IPBSPEED_133)
+#if defined(CFG_IPBCLK_EQUALS_XLBCLK)
 /*
  * PCI Bus clocking configuration
  *
  * Actually a PCI Clock of 66 MHz is only set (in cpu_init.c) if
- * CFG_IPBSPEED_133 is defined. This is because a PCI Clock of 66 MHz yet hasn't
- * been tested with a IPB Bus Clock of 66 MHz.
+ * CFG_IPBCLK_EQUALS_XLBCLK is defined. This is because a PCI Clock
+ * of 66 MHz yet hasn't been tested with a IPB Bus Clock of 66 MHz.
  */
-#define CFG_PCISPEED_66                        /* define for 66MHz speed */
+#define CFG_PCICLK_EQUALS_IPBCLK_DIV2  /* define for 66MHz speed */
 #endif
 
 /*
 
 #define CFG_BOOTCS_START       CFG_FLASH_BASE
 #define CFG_BOOTCS_SIZE                CFG_FLASH_SIZE
-#ifdef CFG_PCISPEED_66
+#ifdef CFG_PCICLK_EQUALS_IPBCLK_DIV2
 #define CFG_BOOTCS_CFG         0x0008DF30 /* for pci_clk  = 66 MHz */
 #else
 #define CFG_BOOTCS_CFG         0x0004DF30 /* for pci_clk = 33 MHz */
index 67f62d3..df057d9 100644 (file)
@@ -29,6 +29,7 @@
  *----------------------------------------------------------------------*/
 #define CONFIG_ALPR            1           /* Board is ebony           */
 #define CONFIG_440GX           1           /* Specifc GX support       */
+#define CONFIG_440             1           /* ... PPC440 family        */
 #define CONFIG_4xx             1           /* ... PPC4xx family        */
 #define CONFIG_BOARD_EARLY_INIT_F 1        /* Call board_pre_init      */
 #define CONFIG_LAST_STAGE_INIT 1           /* call last_stage_init()   */
@@ -94,7 +95,7 @@
 
 #define CFG_ENV_IS_IN_FLASH     1      /* use FLASH for environment vars       */
 
-#define CFG_ENV_SECT_SIZE      0x10000         /* size of one complete sector  */
+#define CFG_ENV_SECT_SIZE      0x10000 /* size of one complete sector          */
 #define CFG_ENV_ADDR           (CFG_MONITOR_BASE-CFG_ENV_SECT_SIZE)
 #define        CFG_ENV_SIZE            0x2000  /* Total Size of Environment Sector     */
 
 
 #define CONFIG_CMDLINE_EDITING 1       /* add command line history     */
 #define CONFIG_LOOPW            1       /* enable loopw command         */
-#define CONFIG_MX_CYCLIC       1       /* enable mdc/mwc commands      */
+#define CONFIG_MX_CYCLIC       1       /* enable mdc/mwc commands      */
 #define CONFIG_ZERO_BOOTDELAY_CHECK    /* check for keypress on bootdelay==0 */
 #define CONFIG_VERSION_VARIABLE        1       /* include version env variable */
 
 #define CONFIG_PCI_BOOTDELAY   1       /* enable pci bootdelay variable*/
 
 /* Board-specific PCI */
-#define CFG_PCI_PRE_INIT               /* enable board pci_pre_init()  */
 #define CFG_PCI_TARGET_INIT            /* let board init pci target    */
 #define CFG_PCI_MASTER_INIT
 
index db58a9f..d58344d 100644 (file)
@@ -32,6 +32,7 @@
  *----------------------------------------------------------------------*/
 #define CONFIG_BAMBOO          1       /* Board is BAMBOO              */
 #define CONFIG_440EP           1       /* Specific PPC440EP support    */
+#define CONFIG_440             1       /* ... PPC440 family            */
 #define CONFIG_4xx             1       /* ... PPC4xx family            */
 #define CONFIG_SYS_CLK_FREQ    33333333    /* external freq to pll     */
 
@@ -50,7 +51,7 @@
  *----------------------------------------------------------------------*/
 #define CFG_MONITOR_LEN                (384 * 1024)    /* Reserve 384 kB for Monitor   */
 #define CFG_MALLOC_LEN         (256 * 1024)    /* Reserve 256 kB for malloc()  */
-#define CFG_MONITOR_BASE       (-CFG_MONITOR_LEN)
+#define CFG_MONITOR_BASE       TEXT_BASE
 #define CFG_SDRAM_BASE         0x00000000          /* _must_ be 0      */
 #define CFG_FLASH_BASE         0xfff00000          /* start of FLASH   */
 #define CFG_PCI_MEMBASE                0xa0000000          /* mapped pci memory*/
@@ -73,9 +74,9 @@
  * Initial RAM & stack pointer (placed in SDRAM)
  *----------------------------------------------------------------------*/
 #define CFG_INIT_RAM_DCACHE    1               /* d-cache as init ram  */
-#define CFG_INIT_RAM_ADDR      0x70000000              /* DCache       */
+#define CFG_INIT_RAM_ADDR      0x70000000      /* DCache       */
 #define CFG_INIT_RAM_END       (4 << 10)
-#define CFG_GBL_DATA_SIZE      256                     /* num bytes initial data       */
+#define CFG_GBL_DATA_SIZE      256             /* num bytes initial data       */
 #define CFG_GBL_DATA_OFFSET    (CFG_INIT_RAM_END - CFG_GBL_DATA_SIZE)
 #define CFG_INIT_SP_OFFSET     CFG_GBL_DATA_OFFSET
 
 /*-----------------------------------------------------------------------
  * Environment
  *----------------------------------------------------------------------*/
-/*
- * Define here the location of the environment variables (FLASH or EEPROM).
- * Note: DENX encourages to use redundant environment in FLASH.
- */
-#if 1
+#if !defined(CONFIG_NAND_U_BOOT) && !defined(CONFIG_NAND_SPL)
 #define CFG_ENV_IS_IN_FLASH     1      /* use FLASH for environment vars       */
 #else
-#define CFG_ENV_IS_IN_EEPROM   1       /* use EEPROM for environment vars      */
+#define CFG_ENV_IS_IN_NAND     1       /* use NAND for environment vars        */
+#define CFG_ENV_IS_EMBEDDED    1       /* use embedded environment */
 #endif
 
 /*-----------------------------------------------------------------------
  * FLASH related
  *----------------------------------------------------------------------*/
-#define CFG_MAX_FLASH_BANKS    3                   /* number of banks      */
-#define CFG_MAX_FLASH_SECT     256                 /* sectors per device   */
+#define CFG_MAX_FLASH_BANKS    3       /* number of banks                      */
+#define CFG_MAX_FLASH_SECT     256     /* sectors per device                   */
 
 #undef CFG_FLASH_CHECKSUM
 #define CFG_FLASH_ERASE_TOUT   120000  /* Timeout for Flash Erase (in ms)      */
 #define CFG_FLASH_ADDR1         0x2aa
 #define CFG_FLASH_WORD_SIZE     unsigned char
 
-#define CFG_FLASH_2ND_16BIT_DEV 1         /* bamboo has 8 and 16bit device      */
-#define CFG_FLASH_2ND_ADDR      0x87800000  /* bamboo has 8 and 16bit device    */
+#define CFG_FLASH_2ND_16BIT_DEV 1      /* bamboo has 8 and 16bit device        */
+#define CFG_FLASH_2ND_ADDR      0x87800000  /* bamboo has 8 and 16bit device   */
 
 #ifdef CFG_ENV_IS_IN_FLASH
-#define CFG_ENV_SECT_SIZE      0x10000         /* size of one complete sector  */
-#define CFG_ENV_ADDR           (CFG_MONITOR_BASE-CFG_ENV_SECT_SIZE)
+#define CFG_ENV_SECT_SIZE      0x10000 /* size of one complete sector          */
+#define CFG_ENV_ADDR           ((-CFG_MONITOR_LEN)-CFG_ENV_SECT_SIZE)
 #define        CFG_ENV_SIZE            0x2000  /* Total Size of Environment Sector     */
 
 /* Address and size of Redundant Environment Sector    */
 #define CFG_ENV_SIZE_REDUND    (CFG_ENV_SIZE)
 #endif /* CFG_ENV_IS_IN_FLASH */
 
+/*
+ * IPL (Initial Program Loader, integrated inside CPU)
+ * Will load first 4k from NAND (SPL) into cache and execute it from there.
+ *
+ * SPL (Secondary Program Loader)
+ * Will load special U-Boot version (NUB) from NAND and execute it. This SPL
+ * has to fit into 4kByte. It sets up the CPU and configures the SDRAM
+ * controller and the NAND controller so that the special U-Boot image can be
+ * loaded from NAND to SDRAM.
+ *
+ * NUB (NAND U-Boot)
+ * This NAND U-Boot (NUB) is a special U-Boot version which can be started
+ * from RAM. Therefore it mustn't (re-)configure the SDRAM controller.
+ *
+ * On 440EPx the SPL is copied to SDRAM before the NAND controller is
+ * set up. While still running from cache, I experienced problems accessing
+ * the NAND controller.        sr - 2006-08-25
+ */
+#define CFG_NAND_BOOT_SPL_SRC  0xfffff000      /* SPL location                 */
+#define CFG_NAND_BOOT_SPL_SIZE (4 << 10)       /* SPL size                     */
+#define CFG_NAND_BOOT_SPL_DST  0x00800000      /* Copy SPL here                */
+#define CFG_NAND_U_BOOT_DST    0x01000000      /* Load NUB to this addr        */
+#define CFG_NAND_U_BOOT_START  CFG_NAND_U_BOOT_DST /* Start NUB from this addr */
+#define CFG_NAND_BOOT_SPL_DELTA        (CFG_NAND_BOOT_SPL_SRC - CFG_NAND_BOOT_SPL_DST)
+
+/*
+ * Define the partitioning of the NAND chip (only RAM U-Boot is needed here)
+ */
+#define CFG_NAND_U_BOOT_OFFS   (16 << 10)      /* Offset to RAM U-Boot image   */
+#define CFG_NAND_U_BOOT_SIZE   (384 << 10)     /* Size of RAM U-Boot image     */
+
+/*
+ * Now the NAND chip has to be defined (no autodetection used!)
+ */
+#define CFG_NAND_PAGE_SIZE     512             /* NAND chip page size          */
+#define CFG_NAND_BLOCK_SIZE    (16 << 10)      /* NAND chip block size         */
+#define CFG_NAND_PAGE_COUNT    32              /* NAND chip page count         */
+#define CFG_NAND_BAD_BLOCK_POS 5               /* Location of bad block marker */
+#define CFG_NAND_4_ADDR_CYCLE  1               /* Fourth addr used (>32MB)     */
+
+#define CFG_NAND_ECCSIZE       256
+#define CFG_NAND_ECCBYTES      3
+#define CFG_NAND_ECCSTEPS      (CFG_NAND_PAGE_SIZE / CFG_NAND_ECCSIZE)
+#define CFG_NAND_OOBSIZE       16
+#define CFG_NAND_ECCTOTAL      (CFG_NAND_ECCBYTES * CFG_NAND_ECCSTEPS)
+#define CFG_NAND_ECCPOS                {0, 1, 2, 3, 6, 7}
+
+#ifdef CFG_ENV_IS_IN_NAND
+/*
+ * For NAND booting the environment is embedded in the U-Boot image. Please take
+ * look at the file board/amcc/sequoia/u-boot-nand.lds for details.
+ */
+#define CFG_ENV_SIZE           CFG_NAND_BLOCK_SIZE
+#define CFG_ENV_OFFSET         (CFG_NAND_U_BOOT_OFFS + CFG_ENV_SIZE)
+#define CFG_ENV_OFFSET_REDUND  (CFG_ENV_OFFSET + CFG_ENV_SIZE)
+#endif
+
 /*-----------------------------------------------------------------------
  * NAND FLASH
  *----------------------------------------------------------------------*/
-#define CFG_MAX_NAND_DEVICE    1
-#define NAND_MAX_CHIPS         1
-#define CFG_NAND_CS            1
+#define CFG_MAX_NAND_DEVICE    2
+#define NAND_MAX_CHIPS         CFG_MAX_NAND_DEVICE
 #define CFG_NAND_BASE          (CFG_NAND_ADDR + CFG_NAND_CS)
+#define CFG_NAND_BASE_LIST     { CFG_NAND_BASE, CFG_NAND_ADDR + 2 }
 #define CFG_NAND_SELECT_DEVICE  1      /* nand driver supports mutipl. chips   */
 
+#if !defined(CONFIG_NAND_U_BOOT) && !defined(CONFIG_NAND_SPL)
+#define CFG_NAND_CS            1
+#else
+#define CFG_NAND_CS            0               /* NAND chip connected to CSx   */
+/* Memory Bank 0 (NAND-FLASH) initialization                                   */
+#define CFG_EBC_PB0AP          0x018003c0
+#define CFG_EBC_PB0CR          (CFG_NAND_ADDR | 0x1c000)
+#endif
+
 /*-----------------------------------------------------------------------
  * DDR SDRAM
  *----------------------------------------------------------------------------- */
 #define CONFIG_SPD_EEPROM               /* Use SPD EEPROM for setup             */
 #undef CONFIG_DDR_ECC                  /* don't use ECC                        */
 #define CFG_SIMULATE_SPD_EEPROM        0xff    /* simulate spd eeprom on this address  */
-#define SPD_EEPROM_ADDRESS      {CFG_SIMULATE_SPD_EEPROM, 0x50, 0x51}
+#define SPD_EEPROM_ADDRESS     {CFG_SIMULATE_SPD_EEPROM, 0x50, 0x51}
+#define CFG_MBYTES_SDRAM       (64)    /* 64MB fixed size for early-sdram-init */
 
 /*-----------------------------------------------------------------------
  * I2C
 #define CFG_PCI_TARGBASE        0x80000000 /* PCIaddr mapped to CFG_PCI_MEMBASE*/
 
 /* Board-specific PCI */
-#define CFG_PCI_PRE_INIT                /* enable board pci_pre_init()  */
 #define CFG_PCI_TARGET_INIT
 #define CFG_PCI_MASTER_INIT
 
index 2c160a4..ec6d57e 100644 (file)
 /*
  * IPB Bus clocking configuration.
  */
-#undef CFG_IPBSPEED_133                /* define for 133MHz speed */
+#undef CFG_IPBCLK_EQUALS_XLBCLK                /* define for 133MHz speed */
 
 /*
  * Flash configuration, expect one 16 Megabyte Bank at most
index f9586fb..f5efcd9 100644 (file)
 /*
  * IPB Bus clocking configuration.
  */
-#undef CFG_IPBSPEED_133                /* define for 133MHz speed */
+#undef CFG_IPBCLK_EQUALS_XLBCLK                /* define for 133MHz speed */
 #endif
 /*
  * I2C configuration
index a42319b..4a1385c 100644 (file)
@@ -32,6 +32,7 @@
  *----------------------------------------------------------------------*/
 #define CONFIG_EBONY           1           /* Board is ebony           */
 #define CONFIG_440GP           1           /* Specifc GP support       */
+#define CONFIG_440             1           /* ... PPC440 family        */
 #define CONFIG_4xx             1           /* ... PPC4xx family        */
 #define CONFIG_BOARD_EARLY_INIT_F 1        /* Call board_early_init_f  */
 #undef CFG_DRAM_TEST                       /* Disable-takes long time! */
 #define CFG_FLASH_WORD_SIZE     unsigned char
 
 #ifdef CFG_ENV_IS_IN_FLASH
-#define CFG_ENV_SECT_SIZE      0x10000         /* size of one complete sector  */
+#define CFG_ENV_SECT_SIZE      0x10000 /* size of one complete sector          */
 #define CFG_ENV_ADDR           (CFG_MONITOR_BASE-CFG_ENV_SECT_SIZE)
 #define        CFG_ENV_SIZE            0x4000  /* Total Size of Environment Sector     */
 
 #define CFG_PCI_TARGBASE    0x80000000  /* PCIaddr mapped to CFG_PCI_MEMBASE */
 
 /* Board-specific PCI */
-#define CFG_PCI_PRE_INIT                /* enable board pci_pre_init()  */
 #define CFG_PCI_TARGET_INIT                /* let board init pci target    */
 
 #define CFG_PCI_SUBSYS_VENDORID 0x10e8 /* AMCC */
index 095b5f6..4d813d8 100644 (file)
 /*
  * IPB Bus clocking configuration.
  */
-#undef CFG_IPBSPEED_133                /* define for 133MHz speed */
+#undef CFG_IPBCLK_EQUALS_XLBCLK                /* define for 133MHz speed */
 
 /*
  * I2C configuration
index 773d5d2..ad3cf06 100644 (file)
 /*
  * IPB Bus clocking configuration.
  */
-#define CFG_IPBSPEED_133               /* define for 133MHz speed */
+#define CFG_IPBCLK_EQUALS_XLBCLK               /* define for 133MHz speed */
 
 /*
  * Flash configuration
index cc47a16..a7eda07 100644 (file)
 #undef CONFIG_PCI_CONFIG_HOST_BRIDGE
 
 /* Board-specific PCI */
-#define CFG_PCI_PRE_INIT       1       /* enable board pci_pre_init()  */
 #define CFG_PCI_TARGET_INIT            /* let board init pci target    */
 #undef CFG_PCI_MASTER_INIT
 
old mode 100644 (file)
new mode 100755 (executable)
index 7e51523..7b6c695
@@ -1,12 +1,8 @@
 /*
- * (C) Copyright 2000
- * Sysgo Real-Time Solutions, GmbH <www.elinos.com>
- * Marius Groeger <mgroeger@sysgo.de>
+ * (C) Copyright 2007
+ * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
  *
- * Configuation settings for the EP7312 board.
- *
- * Modified to work on Armadillo HT1070 ARM720T board
- * (C) Copyright 2005 Rowel Atienza rowel@diwalabs.com
+ * Configuation settings for the LPC2292SODIMM board from Embedded Artists.
  *
  * See file CREDITS for list of people who contributed to this
  * project.
@@ -31,7 +27,7 @@
 #define __CONFIG_H
 
 /*
- * If we are developing, we might want to start armboot from ram
+ * If we are developing, we might want to start u-boot from ram
  * so we MUST NOT initialize critical regs like mem-timing ...
  */
 #undef CONFIG_INIT_CRITICAL            /* undef for developing */
@@ -46,7 +42,7 @@
 #define CONFIG_ARM7            1       /* This is a ARM7 CPU   */
 #define CONFIG_ARM_THUMB       1       /* this is an ARM720TDMI */
 #define CONFIG_LPC2292
-#undef  CONFIG_ARM7_REVD               /* disable ARM720 REV.D Workarounds */
+#undef CONFIG_ARM7_REVD                /* disable ARM720 REV.D Workarounds */
 
 #undef CONFIG_USE_IRQ                  /* don't need them anymore */
 
@@ -70,7 +66,7 @@
 
 #define CONFIG_BAUDRATE                115200
 
-#define CONFIG_BOOTP_MASK       (CONFIG_BOOTP_DEFAULT|CONFIG_BOOTP_BOOTFILESIZE)
+#define CONFIG_BOOTP_MASK      (CONFIG_BOOTP_DEFAULT|CONFIG_BOOTP_BOOTFILESIZE)
 
 /*
  * Supported commands
 #define CFG_MEMTEST_START      0x40000000      /* memtest works on     */
 #define CFG_MEMTEST_END                0x40000000      /* 4 ... 8 MB in DRAM   */
 
-#undef  CFG_CLKS_IN_HZ         /* everything, incl board info, in Hz */
+#undef CFG_CLKS_IN_HZ          /* everything, incl board info, in Hz */
 
-#define        CFG_LOAD_ADDR           0x00040000      /* default load address for armadillo: kernel img is here*/
+#define        CFG_LOAD_ADDR           0x00040000      /* default load address for     */
+                                               /* armadillo: kernel img is here*/
 
-#define CFG_SYS_CLK_FREQ        58982400        /* Hz */
+#define CFG_SYS_CLK_FREQ       58982400        /* Hz */
 #define        CFG_HZ                  2048            /* decrementer freq in Hz */
 
                                                /* valid baudrates */
 #define CONFIG_SETUP_MEMORY_TAGS
 #define CONFIG_INITRD_TAG
 #define CONFIG_MMC 1
+/* we use this ethernet chip */
+#define CONFIG_ENC28J60
 
 #endif /* __CONFIG_H */
index 9c8769b..cbb59c5 100644 (file)
  *----------------------------------------------------------------------*/
 #define CONFIG_SPD_EEPROM      1       /* Use SPD EEPROM for setup     */
 #define SPD_EEPROM_ADDRESS     {0x53, 0x52}    /* SPD i2c spd addresses*/
-#undef CONFIG_DDR_ECC                  /* no ECC support for now       */
+#define CONFIG_DDR_ECC         1       /* with ECC support             */
+#define CFG_44x_DDR2_CKTR_180  1       /* use 180 deg advance          */
 
 /*-----------------------------------------------------------------------
  * I2C
 #define CONFIG_PCI_SCAN_SHOW            /* show pci devices on startup  */
 
 /* Board-specific PCI */
-#define CFG_PCI_PRE_INIT                /* enable board pci_pre_init()  */
 #define CFG_PCI_TARGET_INIT
 #undef  CFG_PCI_MASTER_INIT
 
diff --git a/include/configs/lwmon5.h b/include/configs/lwmon5.h
new file mode 100644 (file)
index 0000000..c6f67fe
--- /dev/null
@@ -0,0 +1,437 @@
+/*
+ * (C) Copyright 2007
+ * Stefan Roese, DENX Software Engineering, sr@denx.de.
+ *
+ * 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
+ */
+
+/************************************************************************
+ * lwmon5.h - configuration for lwmon5 board
+ ***********************************************************************/
+#ifndef __CONFIG_H
+#define __CONFIG_H
+
+/*-----------------------------------------------------------------------
+ * High Level Configuration Options
+ *----------------------------------------------------------------------*/
+#define CONFIG_LWMON5          1               /* Board is lwmon5      */
+#define CONFIG_440EPX          1               /* Specific PPC440EPx   */
+#define CONFIG_440             1               /* ... PPC440 family    */
+#define CONFIG_4xx             1               /* ... PPC4xx family    */
+#define CONFIG_SYS_CLK_FREQ    33300000        /* external freq to pll */
+
+#define CONFIG_BOARD_EARLY_INIT_F 1    /* Call board_early_init_f      */
+#define CONFIG_MISC_INIT_R     1       /* Call misc_init_r             */
+#define CONFIG_ADD_RAM_INFO    1       /* Print additional info        */
+
+/*-----------------------------------------------------------------------
+ * Base addresses -- Note these are effective addresses where the
+ * actual resources get mapped (not physical addresses)
+ *----------------------------------------------------------------------*/
+#define CFG_MONITOR_LEN                (512 * 1024)    /* Reserve 512 kB for Monitor   */
+#define CFG_MALLOC_LEN         (512 * 1024)    /* Reserve 512 kB for malloc()  */
+
+#define CFG_BOOT_BASE_ADDR     0xf0000000
+#define CFG_SDRAM_BASE         0x00000000      /* _must_ be 0          */
+#define CFG_FLASH_BASE         0xfc000000      /* start of FLASH       */
+#define CFG_MONITOR_BASE       TEXT_BASE
+#define CFG_LIME_BASE_0         0xc0000000
+#define CFG_LIME_BASE_1         0xc1000000
+#define CFG_LIME_BASE_2         0xc2000000
+#define CFG_LIME_BASE_3         0xc3000000
+#define CFG_FPGA_BASE_0         0xc4000000
+#define CFG_FPGA_BASE_1         0xc4200000
+#define CFG_OCM_BASE           0xe0010000      /* ocm                  */
+#define CFG_PCI_BASE           0xe0000000      /* Internal PCI regs    */
+#define CFG_PCI_MEMBASE                0x80000000      /* mapped pci memory    */
+#define CFG_PCI_MEMBASE1       CFG_PCI_MEMBASE  + 0x10000000
+#define CFG_PCI_MEMBASE2       CFG_PCI_MEMBASE1 + 0x10000000
+#define CFG_PCI_MEMBASE3       CFG_PCI_MEMBASE2 + 0x10000000
+
+/* Don't change either of these */
+#define CFG_PERIPHERAL_BASE    0xef600000      /* internal peripherals */
+
+#define CFG_USB2D0_BASE                0xe0000100
+#define CFG_USB_DEVICE         0xe0000000
+#define CFG_USB_HOST           0xe0000400
+
+/*-----------------------------------------------------------------------
+ * Initial RAM & stack pointer
+ *----------------------------------------------------------------------*/
+/* 440EPx/440GRx have 16KB of internal SRAM, so no need for D-Cache    */
+#define CFG_INIT_RAM_OCM       1               /* OCM as init ram      */
+#define CFG_INIT_RAM_ADDR      CFG_OCM_BASE    /* OCM                  */
+
+#define CFG_INIT_RAM_END       (4 << 10)
+#define CFG_GBL_DATA_SIZE      256             /* num bytes initial data */
+#define CFG_GBL_DATA_OFFSET    (CFG_INIT_RAM_END - CFG_GBL_DATA_SIZE)
+#define CFG_INIT_SP_OFFSET     CFG_GBL_DATA_OFFSET
+
+/*-----------------------------------------------------------------------
+ * Serial Port
+ *----------------------------------------------------------------------*/
+#undef CFG_EXT_SERIAL_CLOCK            /* no external clock provided   */
+#define CONFIG_BAUDRATE                115200
+#define CONFIG_SERIAL_MULTI     1
+/* define this if you want console on UART1 */
+#define CONFIG_UART1_CONSOLE   1       /* use UART1 as console         */
+
+#define CFG_BAUDRATE_TABLE                                             \
+       {300, 600, 1200, 2400, 4800, 9600, 19200, 38400, 57600, 115200}
+
+/*-----------------------------------------------------------------------
+ * Environment
+ *----------------------------------------------------------------------*/
+#define CFG_ENV_IS_IN_FLASH     1      /* use FLASH for environment vars       */
+
+/*-----------------------------------------------------------------------
+ * FLASH related
+ *----------------------------------------------------------------------*/
+#define CFG_FLASH_CFI                          /* The flash is CFI compatible  */
+#define CFG_FLASH_CFI_DRIVER                   /* Use common CFI driver        */
+
+#define CFG_FLASH_BANKS_LIST   { CFG_FLASH_BASE }
+
+#define CFG_MAX_FLASH_BANKS    1       /* max number of memory banks           */
+#define CFG_MAX_FLASH_SECT     512     /* max number of sectors on one chip    */
+
+#define CFG_FLASH_ERASE_TOUT   120000  /* Timeout for Flash Erase (in ms)      */
+#define CFG_FLASH_WRITE_TOUT   500     /* Timeout for Flash Write (in ms)      */
+
+#define CFG_FLASH_USE_BUFFER_WRITE 1   /* use buffered writes (20x faster)     */
+#define CFG_FLASH_PROTECTION   1       /* use hardware flash protection        */
+
+#define CFG_FLASH_EMPTY_INFO           /* print 'E' for empty sector on flinfo */
+#define CFG_FLASH_QUIET_TEST   1       /* don't warn upon unknown flash        */
+
+#define CFG_ENV_SECT_SIZE      0x40000 /* size of one complete sector          */
+#define CFG_ENV_ADDR           ((-CFG_MONITOR_LEN)-CFG_ENV_SECT_SIZE)
+#define        CFG_ENV_SIZE            0x2000  /* Total Size of Environment Sector     */
+
+/* Address and size of Redundant Environment Sector    */
+#define CFG_ENV_ADDR_REDUND    (CFG_ENV_ADDR-CFG_ENV_SECT_SIZE)
+#define CFG_ENV_SIZE_REDUND    (CFG_ENV_SIZE)
+
+/*-----------------------------------------------------------------------
+ * DDR SDRAM
+ *----------------------------------------------------------------------*/
+#define CFG_MBYTES_SDRAM       (256)           /* 256MB                        */
+#define CFG_DDR_CACHED_ADDR    0x40000000      /* setup 2nd TLB cached here    */
+#define CONFIG_DDR_DATA_EYE    1               /* use DDR2 optimization        */
+#if 0 /* test-only: disable ECC for now */
+#define CONFIG_DDR_ECC         1               /* enable ECC                   */
+#endif
+
+/*-----------------------------------------------------------------------
+ * I2C
+ *----------------------------------------------------------------------*/
+#define CONFIG_HARD_I2C                1               /* I2C with hardware support    */
+#undef CONFIG_SOFT_I2C                         /* I2C bit-banged               */
+#define CFG_I2C_SPEED          400000          /* I2C speed and slave address  */
+#define CFG_I2C_SLAVE          0x7F
+
+#define CFG_I2C_MULTI_EEPROMS
+#define CFG_I2C_EEPROM_ADDR    (0xa8>>1)
+#define CFG_I2C_EEPROM_ADDR_LEN 1
+#define CFG_EEPROM_PAGE_WRITE_ENABLE
+#define CFG_EEPROM_PAGE_WRITE_BITS 3
+#define CFG_EEPROM_PAGE_WRITE_DELAY_MS 10
+
+#define CONFIG_RTC_PCF8563     1               /* enable Philips PCF8563 RTC   */
+#define CFG_I2C_RTC_ADDR       0x51            /* Philips PCF8563 RTC address  */
+
+#define CONFIG_PREBOOT "echo;"                                         \
+       "echo Type \"run flash_nfs\" to mount root filesystem over NFS;" \
+       "echo"
+
+#undef CONFIG_BOOTARGS
+
+#define        CONFIG_EXTRA_ENV_SETTINGS                                       \
+       "hostname=lwmon5\0"                                             \
+       "netdev=eth0\0"                                                 \
+       "nfsargs=setenv bootargs root=/dev/nfs rw "                     \
+               "nfsroot=${serverip}:${rootpath}\0"                     \
+       "ramargs=setenv bootargs root=/dev/ram rw\0"                    \
+       "addip=setenv bootargs ${bootargs} "                            \
+               "ip=${ipaddr}:${serverip}:${gatewayip}:${netmask}"      \
+               ":${hostname}:${netdev}:off panic=1\0"                  \
+       "addtty=setenv bootargs ${bootargs} console=ttyS1,${baudrate}\0"\
+       "flash_nfs=run nfsargs addip addtty;"                           \
+               "bootm ${kernel_addr}\0"                                \
+       "flash_self=run ramargs addip addtty;"                          \
+               "bootm ${kernel_addr} ${ramdisk_addr}\0"                \
+       "net_nfs=tftp 200000 ${bootfile};run nfsargs addip addtty;"     \
+               "bootm\0"                                               \
+       "rootpath=/opt/eldk/ppc_4xxFP\0"                                \
+       "bootfile=/tftpboot/lwmon5/uImage\0"                            \
+       "kernel_addr=FC000000\0"                                        \
+       "ramdisk_addr=FC180000\0"                                       \
+       "load=tftp 200000 /tftpboot/${hostname}/u-boot.bin\0"           \
+       "update=protect off FFF80000 FFFFFFFF;era FFF80000 FFFFFFFF;"   \
+               "cp.b 200000 FFF80000 80000\0"                          \
+       "upd=run load;run update\0"                                     \
+       ""
+#define CONFIG_BOOTCOMMAND     "run flash_self"
+
+#if 0
+#define CONFIG_BOOTDELAY       -1      /* autoboot disabled            */
+#else
+#define CONFIG_BOOTDELAY       5       /* autoboot after 5 seconds     */
+#endif
+
+#define CONFIG_LOADS_ECHO      1       /* echo on for serial download  */
+#define CFG_LOADS_BAUD_CHANGE  1       /* allow baudrate change        */
+
+#define        CONFIG_IBM_EMAC4_V4     1
+#define CONFIG_MII             1       /* MII PHY management           */
+#define CONFIG_PHY_ADDR                3       /* PHY address, See schematics  */
+
+#define CONFIG_PHY_RESET        1      /* reset phy upon startup         */
+
+#define CONFIG_HAS_ETH0
+#define CFG_RX_ETH_BUFFER      32      /* Number of ethernet rx buffers & descriptors */
+
+#define CONFIG_NET_MULTI       1
+#define CONFIG_HAS_ETH1                1       /* add support for "eth1addr"   */
+#define CONFIG_PHY1_ADDR       1
+
+/* USB */
+#ifdef CONFIG_440EPX
+#define CONFIG_USB_OHCI
+#define CONFIG_USB_STORAGE
+
+/* Comment this out to enable USB 1.1 device */
+#define USB_2_0_DEVICE
+
+#define CMD_USB                        CFG_CMD_USB
+#else
+#define CMD_USB                        0       /* no USB on 440GRx             */
+#endif /* CONFIG_440EPX */
+
+/* Partitions */
+#define CONFIG_MAC_PARTITION
+#define CONFIG_DOS_PARTITION
+#define CONFIG_ISO_PARTITION
+
+#define CONFIG_COMMANDS       (CONFIG_CMD_DFL  |       \
+                              CFG_CMD_ASKENV   |       \
+                              CFG_CMD_DATE     |       \
+                              CFG_CMD_DHCP     |       \
+                              CFG_CMD_DIAG     |       \
+                              CFG_CMD_EEPROM   |       \
+                              CFG_CMD_ELF      |       \
+                              CFG_CMD_FAT      |       \
+                              CFG_CMD_I2C      |       \
+                              CFG_CMD_IRQ      |       \
+                              CFG_CMD_MII      |       \
+                              CFG_CMD_NET      |       \
+                              CFG_CMD_NFS      |       \
+                              CFG_CMD_PCI      |       \
+                              CFG_CMD_PING     |       \
+                              CFG_CMD_REGINFO  |       \
+                              CFG_CMD_SDRAM    |       \
+                              CMD_USB)
+
+#define CONFIG_SUPPORT_VFAT
+
+/* this must be included AFTER the definition of CONFIG_COMMANDS (if any) */
+#include <cmd_confdefs.h>
+
+/*-----------------------------------------------------------------------
+ * Miscellaneous configurable options
+ *----------------------------------------------------------------------*/
+#define CFG_LONGHELP                   /* undef to save memory         */
+#define CFG_PROMPT             "=> "   /* Monitor Command Prompt       */
+#if (CONFIG_COMMANDS & CFG_CMD_KGDB)
+#define CFG_CBSIZE             1024    /* Console I/O Buffer Size      */
+#else
+#define CFG_CBSIZE             256     /* Console I/O Buffer Size      */
+#endif
+#define CFG_PBSIZE              (CFG_CBSIZE+sizeof(CFG_PROMPT)+16) /* Print Buffer Size */
+#define CFG_MAXARGS            16      /* max number of command args   */
+#define CFG_BARGSIZE           CFG_CBSIZE /* Boot Argument Buffer Size */
+
+#define CFG_MEMTEST_START      0x0400000 /* memtest works on           */
+#define CFG_MEMTEST_END                0x0C00000 /* 4 ... 12 MB in DRAM        */
+
+#define CFG_LOAD_ADDR          0x100000  /* default load address       */
+#define CFG_EXTBDINFO          1       /* To use extended board_into (bd_t) */
+
+#define CFG_HZ                 1000    /* decrementer freq: 1 ms ticks */
+
+#define CONFIG_CMDLINE_EDITING 1       /* add command line history     */
+#define CONFIG_LOOPW            1       /* enable loopw command         */
+#define CONFIG_MX_CYCLIC        1       /* enable mdc/mwc commands      */
+#define CONFIG_ZERO_BOOTDELAY_CHECK    /* check for keypress on bootdelay==0 */
+#define CONFIG_VERSION_VARIABLE 1      /* include version env variable */
+
+/*-----------------------------------------------------------------------
+ * PCI stuff
+ *----------------------------------------------------------------------*/
+/* General PCI */
+#define CONFIG_PCI                     /* include pci support          */
+#undef CONFIG_PCI_PNP                  /* do (not) pci plug-and-play   */
+#define CONFIG_PCI_SCAN_SHOW           /* show pci devices on startup  */
+#define CFG_PCI_TARGBASE        0x80000000 /* PCIaddr mapped to CFG_PCI_MEMBASE*/
+
+/* Board-specific PCI */
+#define CFG_PCI_TARGET_INIT
+#define CFG_PCI_MASTER_INIT
+
+#define CFG_PCI_SUBSYS_VENDORID 0x10e8 /* AMCC                         */
+#define CFG_PCI_SUBSYS_ID       0xcafe /* Whatever                     */
+
+#define CONFIG_HW_WATCHDOG     1       /* Use external HW-Watchdog     */
+
+/*
+ * For booting Linux, the board info and command line data
+ * have to be in the first 8 MB of memory, since this is
+ * the maximum mapped by the Linux kernel during initialization.
+ */
+#define CFG_BOOTMAPSZ          (8 << 20)       /* Initial Memory map for Linux */
+
+/*-----------------------------------------------------------------------
+ * External Bus Controller (EBC) Setup
+ *----------------------------------------------------------------------*/
+#define CFG_FLASH              CFG_FLASH_BASE
+
+/* Memory Bank 0 (NOR-FLASH) initialization                                    */
+#define CFG_EBC_PB0AP          0x03050200
+#define CFG_EBC_PB0CR          (CFG_FLASH | 0xdc000)
+
+/* Memory Bank 1 (Lime) initialization                                         */
+#define CFG_EBC_PB1AP          0x01004380
+#define CFG_EBC_PB1CR          (CFG_LIME_BASE_0 | 0xdc000)
+
+/* Memory Bank 2 (FPGA) initialization                                         */
+#define CFG_EBC_PB2AP          0x01004400
+#define CFG_EBC_PB2CR          (CFG_FPGA_BASE_0 | 0x1c000)
+
+/* Memory Bank 3 (FPGA2) initialization                                                */
+#define CFG_EBC_PB3AP          0x01004400
+#define CFG_EBC_PB3CR          (CFG_FPGA_BASE_1 | 0x1c000)
+
+#define CFG_EBC_CFG            0xb8400000
+
+/*-----------------------------------------------------------------------
+ * GPIO Setup
+ *----------------------------------------------------------------------*/
+#define CFG_GPIO_PHY1_RST      12
+#define CFG_GPIO_FLASH_WP      14
+#define CFG_GPIO_PHY0_RST      22
+#define CFG_GPIO_HUB_RST       50
+#define CFG_GPIO_WATCHDOG      58
+#define CFG_GPIO_LIME_S                59
+#define CFG_GPIO_LIME_RST      60
+
+/*-----------------------------------------------------------------------
+ * PPC440 GPIO Configuration
+ */
+#define CFG_440_GPIO_TABLE { /*          Out             GPIO  Alternate1      Alternate2      Alternate3 */ \
+{                                                                                      \
+/* GPIO Core 0 */                                                                      \
+{GPIO0_BASE, GPIO_OUT, GPIO_ALT1, GPIO_OUT_0}, /* GPIO0        EBC_ADDR(7)     DMA_REQ(2)      */      \
+{GPIO0_BASE, GPIO_OUT, GPIO_ALT1, GPIO_OUT_0}, /* GPIO1        EBC_ADDR(6)     DMA_ACK(2)      */      \
+{GPIO0_BASE, GPIO_OUT, GPIO_ALT1, GPIO_OUT_0}, /* GPIO2        EBC_ADDR(5)     DMA_EOT/TC(2)   */      \
+{GPIO0_BASE, GPIO_OUT, GPIO_ALT1, GPIO_OUT_0}, /* GPIO3        EBC_ADDR(4)     DMA_REQ(3)      */      \
+{GPIO0_BASE, GPIO_OUT, GPIO_ALT1, GPIO_OUT_0}, /* GPIO4        EBC_ADDR(3)     DMA_ACK(3)      */      \
+{GPIO0_BASE, GPIO_OUT, GPIO_ALT1, GPIO_OUT_0}, /* GPIO5        EBC_ADDR(2)     DMA_EOT/TC(3)   */      \
+{GPIO0_BASE, GPIO_OUT, GPIO_ALT1, GPIO_OUT_0}, /* GPIO6        EBC_CS_N(1)                     */      \
+{GPIO0_BASE, GPIO_OUT, GPIO_ALT1, GPIO_OUT_0}, /* GPIO7        EBC_CS_N(2)                     */      \
+{GPIO0_BASE, GPIO_OUT, GPIO_ALT1, GPIO_OUT_0}, /* GPIO8        EBC_CS_N(3)                     */      \
+{GPIO0_BASE, GPIO_OUT, GPIO_ALT1, GPIO_OUT_0}, /* GPIO9        EBC_CS_N(4)                     */      \
+{GPIO0_BASE, GPIO_OUT, GPIO_ALT1, GPIO_OUT_0}, /* GPIO10 EBC_CS_N(5)                   */      \
+{GPIO0_BASE, GPIO_IN , GPIO_SEL , GPIO_OUT_0}, /* GPIO11 EBC_BUS_ERR                   */      \
+{GPIO0_BASE, GPIO_OUT, GPIO_SEL , GPIO_OUT_0}, /* GPIO12                               */      \
+{GPIO0_BASE, GPIO_OUT, GPIO_SEL , GPIO_OUT_0}, /* GPIO13                               */      \
+{GPIO0_BASE, GPIO_OUT, GPIO_SEL , GPIO_OUT_1}, /* GPIO14                               */      \
+{GPIO0_BASE, GPIO_OUT, GPIO_SEL , GPIO_OUT_0}, /* GPIO15                               */      \
+{GPIO0_BASE, GPIO_OUT, GPIO_ALT1, GPIO_OUT_0}, /* GPIO16 GMCTxD(4)                     */      \
+{GPIO0_BASE, GPIO_OUT, GPIO_ALT1, GPIO_OUT_0}, /* GPIO17 GMCTxD(5)                     */      \
+{GPIO0_BASE, GPIO_OUT, GPIO_ALT1, GPIO_OUT_0}, /* GPIO18 GMCTxD(6)                     */      \
+{GPIO0_BASE, GPIO_OUT, GPIO_ALT1, GPIO_OUT_0}, /* GPIO19 GMCTxD(7)                     */      \
+{GPIO0_BASE, GPIO_IN , GPIO_ALT1, GPIO_OUT_0}, /* GPIO20 RejectPkt0                    */      \
+{GPIO0_BASE, GPIO_IN , GPIO_ALT1, GPIO_OUT_0}, /* GPIO21 RejectPkt1                    */      \
+{GPIO0_BASE, GPIO_OUT, GPIO_SEL , GPIO_OUT_0}, /* GPIO22                               */      \
+{GPIO0_BASE, GPIO_OUT, GPIO_ALT1, GPIO_OUT_0}, /* GPIO23 SCPD0                         */      \
+{GPIO0_BASE, GPIO_OUT, GPIO_ALT1, GPIO_OUT_0}, /* GPIO24 GMCTxD(2)                     */      \
+{GPIO0_BASE, GPIO_OUT, GPIO_ALT1, GPIO_OUT_0}, /* GPIO25 GMCTxD(3)                     */      \
+{GPIO0_BASE, GPIO_IN , GPIO_SEL , GPIO_OUT_0}, /* GPIO26                               */      \
+{GPIO0_BASE, GPIO_IN , GPIO_SEL , GPIO_OUT_0}, /* GPIO27 EXT_EBC_REQ   USB2D_RXERROR   */      \
+{GPIO0_BASE, GPIO_OUT, GPIO_SEL , GPIO_OUT_0}, /* GPIO28               USB2D_TXVALID   */      \
+{GPIO0_BASE, GPIO_OUT, GPIO_SEL , GPIO_OUT_0}, /* GPIO29 EBC_EXT_HDLA  USB2D_PAD_SUSPNDM */    \
+{GPIO0_BASE, GPIO_IN , GPIO_SEL , GPIO_OUT_0}, /* GPIO30 EBC_EXT_ACK   USB2D_XCVRSELECT*/      \
+{GPIO0_BASE, GPIO_IN , GPIO_SEL , GPIO_OUT_0}, /* GPIO31 EBC_EXR_BUSREQ        USB2D_TERMSELECT*/      \
+},                                                                                     \
+{                                                                                      \
+/* GPIO Core 1 */                                                                      \
+{GPIO1_BASE, GPIO_IN , GPIO_ALT2, GPIO_OUT_0}, /* GPIO32 USB2D_OPMODE0 EBC_DATA(2)     */      \
+{GPIO1_BASE, GPIO_IN , GPIO_ALT2, GPIO_OUT_0}, /* GPIO33 USB2D_OPMODE1 EBC_DATA(3)     */      \
+{GPIO1_BASE, GPIO_OUT, GPIO_ALT3, GPIO_OUT_0}, /* GPIO34 UART0_DCD_N   UART1_DSR_CTS_N UART2_SOUT*/ \
+{GPIO1_BASE, GPIO_IN , GPIO_ALT3, GPIO_OUT_0}, /* GPIO35 UART0_8PIN_DSR_N UART1_RTS_DTR_N UART2_SIN*/ \
+{GPIO1_BASE, GPIO_IN , GPIO_ALT2, GPIO_OUT_0}, /* GPIO36 UART0_8PIN_CTS_N EBC_DATA(0)  UART3_SIN*/ \
+{GPIO1_BASE, GPIO_OUT, GPIO_ALT2, GPIO_OUT_0}, /* GPIO37 UART0_RTS_N   EBC_DATA(1)     UART3_SOUT*/ \
+{GPIO1_BASE, GPIO_OUT, GPIO_ALT2, GPIO_OUT_0}, /* GPIO38 UART0_DTR_N   UART1_SOUT      */      \
+{GPIO1_BASE, GPIO_IN , GPIO_ALT2, GPIO_OUT_0}, /* GPIO39 UART0_RI_N    UART1_SIN       */      \
+{GPIO1_BASE, GPIO_IN , GPIO_ALT1, GPIO_OUT_0}, /* GPIO40 UIC_IRQ(0)                    */      \
+{GPIO1_BASE, GPIO_IN , GPIO_ALT1, GPIO_OUT_0}, /* GPIO41 UIC_IRQ(1)                    */      \
+{GPIO1_BASE, GPIO_IN , GPIO_ALT1, GPIO_OUT_0}, /* GPIO42 UIC_IRQ(2)                    */      \
+{GPIO1_BASE, GPIO_IN , GPIO_ALT1, GPIO_OUT_0}, /* GPIO43 UIC_IRQ(3)                    */      \
+{GPIO1_BASE, GPIO_IN , GPIO_ALT1, GPIO_OUT_0}, /* GPIO44 UIC_IRQ(4)    DMA_ACK(1)      */      \
+{GPIO1_BASE, GPIO_IN , GPIO_ALT1, GPIO_OUT_0}, /* GPIO45 UIC_IRQ(6)    DMA_EOT/TC(1)   */      \
+{GPIO1_BASE, GPIO_IN , GPIO_ALT1, GPIO_OUT_0}, /* GPIO46 UIC_IRQ(7)    DMA_REQ(0)      */      \
+{GPIO1_BASE, GPIO_IN , GPIO_ALT1, GPIO_OUT_0}, /* GPIO47 UIC_IRQ(8)    DMA_ACK(0)      */      \
+{GPIO1_BASE, GPIO_IN , GPIO_ALT1, GPIO_OUT_0}, /* GPIO48 UIC_IRQ(9)    DMA_EOT/TC(0)   */      \
+{GPIO1_BASE, GPIO_OUT, GPIO_SEL , GPIO_OUT_1}, /* GPIO49  Unselect via TraceSelect Bit */      \
+{GPIO1_BASE, GPIO_OUT, GPIO_SEL , GPIO_OUT_0}, /* GPIO50  Unselect via TraceSelect Bit */      \
+{GPIO1_BASE, GPIO_IN , GPIO_SEL , GPIO_OUT_0}, /* GPIO51  Unselect via TraceSelect Bit */      \
+{GPIO1_BASE, GPIO_IN , GPIO_SEL , GPIO_OUT_0}, /* GPIO52  Unselect via TraceSelect Bit */      \
+{GPIO1_BASE, GPIO_OUT, GPIO_SEL , GPIO_OUT_1}, /* GPIO53  Unselect via TraceSelect Bit */      \
+{GPIO1_BASE, GPIO_OUT, GPIO_SEL , GPIO_OUT_0}, /* GPIO54  Unselect via TraceSelect Bit */      \
+{GPIO1_BASE, GPIO_OUT, GPIO_SEL , GPIO_OUT_1}, /* GPIO55  Unselect via TraceSelect Bit */      \
+{GPIO1_BASE, GPIO_OUT, GPIO_SEL , GPIO_OUT_0}, /* GPIO56  Unselect via TraceSelect Bit */      \
+{GPIO1_BASE, GPIO_OUT, GPIO_SEL , GPIO_OUT_1}, /* GPIO57  Unselect via TraceSelect Bit */      \
+{GPIO1_BASE, GPIO_OUT, GPIO_SEL , GPIO_OUT_1}, /* GPIO58  Unselect via TraceSelect Bit */      \
+{GPIO1_BASE, GPIO_OUT, GPIO_SEL , GPIO_OUT_0}, /* GPIO59  Unselect via TraceSelect Bit */      \
+{GPIO1_BASE, GPIO_OUT, GPIO_SEL , GPIO_OUT_0}, /* GPIO60  Unselect via TraceSelect Bit */      \
+{GPIO1_BASE, GPIO_IN , GPIO_SEL , GPIO_OUT_0}, /* GPIO61  Unselect via TraceSelect Bit */      \
+{GPIO1_BASE, GPIO_IN , GPIO_SEL , GPIO_OUT_0}, /* GPIO62  Unselect via TraceSelect Bit */      \
+{GPIO1_BASE, GPIO_OUT, GPIO_SEL , GPIO_OUT_0}, /* GPIO63  Unselect via TraceSelect Bit */      \
+}                                                                                      \
+}
+
+/*-----------------------------------------------------------------------
+ * Cache Configuration
+ *----------------------------------------------------------------------*/
+#define CFG_DCACHE_SIZE                (32<<10)  /* For AMCC 440 CPUs                  */
+#define CFG_CACHELINE_SIZE     32            /* ...                                */
+#if (CONFIG_COMMANDS & CFG_CMD_KGDB)
+#define CFG_CACHELINE_SHIFT    5             /* log base 2 of the above value  */
+#endif
+
+/*
+ * Internal Definitions
+ *
+ * Boot Flags
+ */
+#define BOOTFLAG_COLD  0x01            /* Normal Power-On: Boot from FLASH     */
+#define BOOTFLAG_WARM  0x02            /* Software reboot                      */
+
+#if (CONFIG_COMMANDS & CFG_CMD_KGDB)
+#define CONFIG_KGDB_BAUDRATE   230400  /* speed to run kgdb serial port */
+#define CONFIG_KGDB_SER_INDEX  2           /* which serial port to use */
+#endif
+#endif /* __CONFIG_H */
index 621a81c..c2324a0 100644 (file)
 /*
  * IPB Bus clocking configuration.
  */
-#define CFG_IPBSPEED_133               /* define for 133MHz speed */
+#define CFG_IPBCLK_EQUALS_XLBCLK               /* define for 133MHz speed */
 
 /*
  * I2C configuration
index e6e0eb1..e3899a5 100644 (file)
@@ -54,7 +54,8 @@
                                CFG_CMD_JFFS2   | \
                                CFG_CMD_I2C     | \
                                CFG_CMD_DATE    | \
-                               CFG_CMD_EEPROM)
+                               CFG_CMD_EEPROM  | \
+                               CFG_CMD_DTT)
 
 /* this must be included AFTER the definition of CONFIG_COMMANDS (if any) */
 #include <cmd_confdefs.h>
@@ -75,7 +76,7 @@
 #define CONFIG_MPC5xxx_FEC     1
 #define CONFIG_PHY_ADDR                0x2
 #define CONFIG_PHY_TYPE                0x79c874
-
+#define CONFIG_RESET_PHY_R     1
 
 /*
  * Autobooting
        "fdt_file=/tftpboot/motionpro/motionpro.dtb\0"                  \
        "ramdisk_file=/tftpboot/motionpro/uRamdisk\0"                   \
        "multi_image_file=kernel+initrd+dtb.img\0"                      \
-       "load=tftp $(u-boot_addr) $(u-boot)\0"                          \
+       "load=tftp ${u-boot_addr} ${u-boot}\0"                          \
        "update=prot off fff00000 fff3ffff; era fff00000 fff3ffff; "    \
-               "cp.b $(u-boot_addr) fff00000 $(filesize);"             \
+               "cp.b ${u-boot_addr} fff00000 ${filesize};"             \
                "prot on fff00000 fff3ffff\0"                           \
        "ramargs=setenv bootargs root=/dev/ram rw\0"                    \
        "nfsargs=setenv bootargs root=/dev/nfs rw "                     \
-               "nfsroot=$(serverip):$(rootpath)\0"                     \
+               "nfsroot=${serverip}:${rootpath}\0"                     \
        "fat_args=setenv bootargs rw\0"                                 \
-       "addip=setenv bootargs $(bootargs) "                            \
-               "ip=$(ipaddr):$(serverip):$(gatewayip):"                \
-               "$(netmask):$(hostname):$(netdev):off panic=1 "         \
-               "console=$(console)\0"                                  \
-       "net_nfs=tftp $(kernel_addr) $(bootfile); "                     \
-               "tftp $(fdt_addr) $(fdt_file); run nfsargs addip; "     \
-               "bootm $(kernel_addr) - $(fdt_addr)\0"                  \
-       "net_self=tftp $(kernel_addr) $(bootfile); "                    \
-               "tftp $(fdt_addr) $(fdt_file); "                        \
-               "tftp $(ramdisk_addr) $(ramdisk_file); "                \
+       "addmtd=setenv bootargs ${bootargs} ${mtdparts}\0"              \
+       "addip=setenv bootargs ${bootargs} "                            \
+               "ip=${ipaddr}:${serverip}:${gatewayip}:"                \
+               "${netmask}:${hostname}:${netdev}:off panic=1 "         \
+               "console=${console}\0"                                  \
+       "net_nfs=tftp ${kernel_addr} ${bootfile}; "                     \
+               "tftp ${fdt_addr} ${fdt_file}; run nfsargs addip; "     \
+               "bootm ${kernel_addr} - ${fdt_addr}\0"                  \
+       "net_self=tftp ${kernel_addr} ${bootfile}; "                    \
+               "tftp ${fdt_addr} ${fdt_file}; "                        \
+               "tftp ${ramdisk_addr} ${ramdisk_file}; "                \
                "run ramargs addip; "                                   \
-               "bootm $(kernel_addr) $(ramdisk_addr) $(fdt_addr)\0"    \
+               "bootm ${kernel_addr} ${ramdisk_addr} ${fdt_addr}\0"    \
        "fat_multi=run fat_args addip; fatload ide 0:1 "                \
                "${multi_image_addr} ${multi_image_file}; "             \
                "bootm ${multi_image_addr}\0"                           \
 
 
 /*
- * Set IPB speed to 100MHz (yes, the #define is misnamed)
+ * Set IPB speed to 100MHz
  */
-#define CFG_IPBSPEED_133
+#define CFG_IPBCLK_EQUALS_XLBCLK
 
 
 /*
 #define MTDIDS_DEFAULT         "nor0=motionpro-0"
 #define MTDPARTS_DEFAULT       "mtdparts=motionpro-0:"                   \
                                        "13m(fs),2m(kernel),256k(uboot)," \
-                                       "64k(env),64k(dtb),-(user_data)"
+                                       "64k(env),64k(redund_env),64k(dtb)," \
+                                       "-(user_data)"
 
 /*
  * IDE/ATA configuration
  * EEPROM configuration
  */
 #define CFG_I2C_EEPROM_ADDR_LEN                1
-#define CFG_EEPROM_PAGE_WRITE_BITS     3
-#define CFG_EEPROM_PAGE_WRITE_DELAY_MS 70
+#define CFG_EEPROM_PAGE_WRITE_ENABLE   1       /* DTT driver needs this */
+#define CFG_EEPROM_PAGE_WRITE_BITS     1       /* 2 bytes per write cycle */
+#define CFG_EEPROM_PAGE_WRITE_DELAY_MS 5       /* 2ms/cycle + 3ms extra */
 #define CFG_I2C_MULTI_EEPROMS          1       /* 2 EEPROMs (addr:50,52) */
 
 
 
 
 /*
+ * Status LED configuration
+ */
+#define CONFIG_STATUS_LED              /* Status LED enabled */
+#define CONFIG_BOARD_SPECIFIC_LED
+
+#define ENABLE_GPIO_OUT                0x00000024
+#define LED_ON                 0x00000010
+
+#ifndef __ASSEMBLY__
+/*
+ * In case of Motion-PRO, a LED is identified by its corresponding
+ * GPT Enable and Mode Select Register.
+ */
+typedef volatile unsigned long * led_id_t;
+
+extern void __led_init(led_id_t id, int state);
+extern void __led_toggle(led_id_t id);
+extern void __led_set(led_id_t id, int state);
+#endif /* __ASSEMBLY__ */
+
+
+/*
+ * Temperature sensor
+ */
+#define CONFIG_DTT_LM75                1
+#define CONFIG_DTT_SENSORS     { 0x49 }
+
+
+/*
  * Environment settings
  */
 #define CFG_ENV_IS_IN_FLASH    1
 #define CFG_ENV_SIZE           0x1000
 #define CFG_ENV_SECT_SIZE      0x10000
 
+/* Configuration of redundant environment */
+#define CFG_ENV_ADDR_REDUND    (CFG_ENV_ADDR + CFG_ENV_SECT_SIZE)
+#define CFG_ENV_SIZE_REDUND    (CFG_ENV_SIZE)
 
 /*
  * Pin multiplexing configuration
 
 
 /*
+ * Motion-PRO's CPLD revision control register
+ */
+#define CPLD_REV_REGISTER      (CFG_CS2_START + 0x06)
+
+
+/*
  * Miscellaneous configurable options
  */
 #define CFG_LONGHELP                   /* undef to save memory    */
 #define CFG_PROMPT             "=> "   /* Monitor Command Prompt   */
-#define CFG_CBSIZE             256     /* Console I/O Buffer Size  */
+#define CFG_CBSIZE             1024    /* Console I/O Buffer Size */
 #define CFG_PBSIZE (CFG_CBSIZE+sizeof(CFG_PROMPT)+16)  /* Print Buffer Size */
 #define CFG_MAXARGS            16              /* max number of command args */
 #define CFG_BARGSIZE           CFG_CBSIZE      /* Boot Argument Buffer Size */
 #define OF_CPU                 "PowerPC,5200@0"
 #define OF_SOC                 "soc5200@f0000000"
 #define OF_TBCLK               (bd->bi_busfreq / 4)
-#define OF_STDOUT_PAT          "/soc5200@f0000000/serial@2000"
+#define OF_STDOUT_PATH         "/soc5200@f0000000/serial@2000"
 
 #endif /* __CONFIG_H */
index 5c05a74..63d0da7 100644 (file)
 /*
  * IPB Bus clocking configuration.
  */
-#define CFG_IPBSPEED_133               /* define for 133MHz speed */
+#define CFG_IPBCLK_EQUALS_XLBCLK               /* define for 133MHz speed */
 
-#if defined(CFG_IPBSPEED_133)
+#if defined(CFG_IPBCLK_EQUALS_XLBCLK)
 /*
  * PCI Bus clocking configuration
  *
  * Actually a PCI Clock of 66 MHz is only set (in cpu_init.c) if
- * CFG_IPBSPEED_133 is defined. This is because a PCI Clock of 66 MHz yet hasn't
- * been tested with a IPB Bus Clock of 66 MHz.
+ * CFG_IPBCLK_EQUALS_XLBCLK is defined. This is because a PCI Clock
+ *  of 66 MHz yet hasn't been tested with a IPB Bus Clock of 66 MHz.
  */
-#define CFG_PCISPEED_66                        /* define for 66MHz speed */
+#define CFG_PCICLK_EQUALS_IPBCLK_DIV2  /* define for 66MHz speed */
 #endif
 #endif
 
 #define CFG_BOOTCS_START       CFG_FLASH_BASE
 #define CFG_BOOTCS_SIZE                CFG_FLASH_SIZE
 
-#ifdef CFG_PCISPEED_66
+#ifdef CFG_PCICLK_EQUALS_IPBCLK_DIV2
 /*
  * For 66 MHz PCI clock additional Wait State is needed for CS0 (flash).
  */
index fe4e638..68e8cec 100644 (file)
@@ -41,6 +41,7 @@
  *----------------------------------------------------------------------*/
 #define CONFIG_OCOTEA          1           /* Board is ebony           */
 #define CONFIG_440GX           1           /* Specifc GX support       */
+#define CONFIG_440             1           /* ... PPC440 family        */
 #define CONFIG_4xx             1           /* ... PPC4xx family        */
 #define CONFIG_BOARD_EARLY_INIT_F 1        /* Call board_pre_init      */
 #undef CFG_DRAM_TEST                       /* Disable-takes long time! */
 #define CFG_FLASH_WORD_SIZE     unsigned char
 
 #ifdef CFG_ENV_IS_IN_FLASH
-#define CFG_ENV_SECT_SIZE      0x10000         /* size of one complete sector  */
+#define CFG_ENV_SECT_SIZE      0x10000         /* size of one complete sector  */
 #define CFG_ENV_ADDR           (CFG_MONITOR_BASE-CFG_ENV_SECT_SIZE)
 #define        CFG_ENV_SIZE            0x4000  /* Total Size of Environment Sector     */
 
 #define CFG_PCI_TARGBASE    0x80000000 /* PCIaddr mapped to CFG_PCI_MEMBASE */
 
 /* Board-specific PCI */
-#define CFG_PCI_PRE_INIT               /* enable board pci_pre_init()  */
 #define CFG_PCI_TARGET_INIT            /* let board init pci target    */
 
 #define CFG_PCI_SUBSYS_VENDORID 0x10e8 /* AMCC */
index aa0901f..22f9f84 100644 (file)
@@ -35,6 +35,7 @@
  *----------------------------------------------------------------------*/
 #define CONFIG_P3P440          1           /* Board is P3P440          */
 #define CONFIG_440GP           1           /* Specifc GP support       */
+#define CONFIG_440             1           /* ... PPC440 family        */
 #define CONFIG_4xx             1           /* ... PPC4xx family        */
 #define CONFIG_BOARD_EARLY_INIT_F 1        /* Call board_early_init_f  */
 #define CONFIG_MISC_INIT_R     1           /* Call misc_init_r         */
 #define CFG_PCI_TARGBASE    0x80000000  /* PCIaddr mapped to CFG_PCI_MEMBASE */
 
 /* Board-specific PCI */
-#define CFG_PCI_PRE_INIT                /* enable board pci_pre_init()  */
 #define CFG_PCI_TARGET_INIT                /* let board init pci target    */
 
 #define CONFIG_DISABLE_PISE_TEST       /* disable PISE test (PCIX only)*/
 
 #define CFG_ENV_IS_IN_FLASH     1      /* use FLASH for environment vars       */
 
-#define CFG_ENV_SECT_SIZE      0x20000         /* size of one complete sector  */
+#define CFG_ENV_SECT_SIZE      0x20000 /* size of one complete sector          */
 #define CFG_ENV_ADDR           (CFG_MONITOR_BASE-CFG_ENV_SECT_SIZE)
 #define        CFG_ENV_SIZE            0x2000  /* Total Size of Environment Sector     */
 
index 23bdfc8..751b512 100644 (file)
@@ -32,6 +32,7 @@
  *----------------------------------------------------------------------*/
 #define CONFIG_PCS440EP                1       /* Board is PCS440EP            */
 #define CONFIG_440EP           1       /* Specific PPC440EP support    */
+#define CONFIG_440             1       /* ... PPC440 family            */
 #define CONFIG_4xx             1       /* ... PPC4xx family            */
 #define CONFIG_SYS_CLK_FREQ    33333333    /* external freq to pll     */
 
 #define CFG_FLASH_EMPTY_INFO           /* print 'E' for empty sector on flinfo */
 
 #ifdef CFG_ENV_IS_IN_FLASH
-#define CFG_ENV_SECT_SIZE      0x10000         /* size of one complete sector  */
+#define CFG_ENV_SECT_SIZE      0x10000 /* size of one complete sector          */
 #define CFG_ENV_ADDR           (CFG_MONITOR_BASE-CFG_ENV_SECT_SIZE)
 #define        CFG_ENV_SIZE            0x2000  /* Total Size of Environment Sector     */
 
 #define CFG_PCI_TARGBASE        0x80000000 /* PCIaddr mapped to CFG_PCI_MEMBASE*/
 
 /* Board-specific PCI */
-#define CFG_PCI_PRE_INIT                /* enable board pci_pre_init()  */
 #define CFG_PCI_TARGET_INIT
 #define CFG_PCI_MASTER_INIT
 
 /*-----------------------------------------------------------------------
  * PPC440 GPIO Configuration
  */
-#define CFG_440_GPIO_TABLE { /*                GPIO    Alternate1      Alternate2      Alternate3 */ \
+#define CFG_440_GPIO_TABLE { /*          Out                  GPIO     Alternate1      Alternate2   Alternate3 */ \
 {                                                                                      \
 /* GPIO Core 0 */                                                                      \
-{ GPIO0_BASE, GPIO_OUT, GPIO_SEL },  /* GPIO0  EBC_ADDR(7)     DMA_REQ(2)      */      \
-{ GPIO0_BASE, GPIO_OUT, GPIO_SEL },  /* GPIO1  EBC_ADDR(6)     DMA_ACK(2)      */      \
-{ GPIO0_BASE, GPIO_OUT, GPIO_SEL },  /* GPIO2  EBC_ADDR(5)     DMA_EOT/TC(2)   */      \
-{ GPIO0_BASE, GPIO_OUT, GPIO_SEL },  /* GPIO3  EBC_ADDR(4)     DMA_REQ(3)      */      \
-{ GPIO0_BASE, GPIO_OUT, GPIO_SEL },  /* GPIO4  EBC_ADDR(3)     DMA_ACK(3)      */      \
-{ GPIO0_BASE, GPIO_OUT, GPIO_SEL },  /* GPIO5  EBC_ADDR(2)     DMA_EOT/TC(3)   */      \
-{ GPIO0_BASE, GPIO_OUT, GPIO_ALT1 }, /* GPIO6  EBC_CS_N(1)                     */      \
-{ GPIO0_BASE, GPIO_OUT, GPIO_ALT1 }, /* GPIO7  EBC_CS_N(2)                     */      \
-{ GPIO0_BASE, GPIO_OUT, GPIO_ALT1 }, /* GPIO8  EBC_CS_N(3)                     */      \
-{ GPIO0_BASE, GPIO_OUT, GPIO_ALT1 }, /* GPIO9  EBC_CS_N(4)                     */      \
-{ GPIO0_BASE, GPIO_OUT, GPIO_SEL },  /* GPIO10 EBC_CS_N(5)                     */      \
-{ GPIO0_BASE, GPIO_OUT, GPIO_SEL },  /* GPIO11 EBC_BUS_ERR                     */      \
-{ GPIO0_BASE, GPIO_IN,  GPIO_ALT1 }, /* GPIO12 ZII_p0Rxd(0)                    */      \
-{ GPIO0_BASE, GPIO_IN,  GPIO_ALT1 }, /* GPIO13 ZII_p0Rxd(1)                    */      \
-{ GPIO0_BASE, GPIO_IN,  GPIO_ALT1 }, /* GPIO14 ZII_p0Rxd(2)                    */      \
-{ GPIO0_BASE, GPIO_IN,  GPIO_ALT1 }, /* GPIO15 ZII_p0Rxd(3)                    */      \
-{ GPIO0_BASE, GPIO_OUT, GPIO_ALT1 }, /* GPIO16 ZII_p0Txd(0)                    */      \
-{ GPIO0_BASE, GPIO_OUT, GPIO_ALT1 }, /* GPIO17 ZII_p0Txd(1)                    */      \
-{ GPIO0_BASE, GPIO_OUT, GPIO_ALT1 }, /* GPIO18 ZII_p0Txd(2)                    */      \
-{ GPIO0_BASE, GPIO_OUT, GPIO_ALT1 }, /* GPIO19 ZII_p0Txd(3)                    */      \
-{ GPIO0_BASE, GPIO_IN,  GPIO_ALT1 }, /* GPIO20 ZII_p0Rx_er                     */      \
-{ GPIO0_BASE, GPIO_IN,  GPIO_ALT1 }, /* GPIO21 ZII_p0Rx_dv                     */      \
-{ GPIO0_BASE, GPIO_IN,  GPIO_ALT1 }, /* GPIO22 ZII_p0RxCrs                     */      \
-{ GPIO0_BASE, GPIO_OUT, GPIO_ALT1 }, /* GPIO23 ZII_p0Tx_er                     */      \
-{ GPIO0_BASE, GPIO_OUT, GPIO_ALT1 }, /* GPIO24 ZII_p0Tx_en                     */      \
-{ GPIO0_BASE, GPIO_IN,  GPIO_ALT1 }, /* GPIO25 ZII_p0Col                       */      \
-{ GPIO0_BASE, GPIO_IN,  GPIO_SEL },  /* GPIO26                 USB2D_RXVALID   */      \
-{ GPIO0_BASE, GPIO_IN,  GPIO_SEL },  /* GPIO27 EXT_EBC_REQ     USB2D_RXERROR   */      \
-{ GPIO0_BASE, GPIO_IN,  GPIO_SEL },  /* GPIO28                 USB2D_TXVALID   */      \
-{ GPIO0_BASE, GPIO_IN,  GPIO_SEL },  /* GPIO29 EBC_EXT_HDLA    USB2D_PAD_SUSPNDM */    \
-{ GPIO0_BASE, GPIO_IN,  GPIO_SEL },  /* GPIO30 EBC_EXT_ACK     USB2D_XCVRSELECT*/      \
-{ GPIO0_BASE, GPIO_IN,  GPIO_SEL },  /* GPIO31 EBC_EXR_BUSREQ  USB2D_TERMSELECT*/      \
+{GPIO0_BASE, GPIO_OUT, GPIO_SEL, GPIO_OUT_NO_CHG},  /* GPIO0   EBC_ADDR(7)     DMA_REQ(2)      */ \
+{GPIO0_BASE, GPIO_OUT, GPIO_SEL, GPIO_OUT_NO_CHG},  /* GPIO1   EBC_ADDR(6)     DMA_ACK(2)      */      \
+{GPIO0_BASE, GPIO_OUT, GPIO_SEL, GPIO_OUT_NO_CHG},  /* GPIO2   EBC_ADDR(5)     DMA_EOT/TC(2)   */      \
+{GPIO0_BASE, GPIO_OUT, GPIO_SEL, GPIO_OUT_NO_CHG},  /* GPIO3   EBC_ADDR(4)     DMA_REQ(3)      */      \
+{GPIO0_BASE, GPIO_OUT, GPIO_SEL, GPIO_OUT_NO_CHG},  /* GPIO4   EBC_ADDR(3)     DMA_ACK(3)      */      \
+{GPIO0_BASE, GPIO_OUT, GPIO_SEL, GPIO_OUT_NO_CHG},  /* GPIO5   EBC_ADDR(2)     DMA_EOT/TC(3)   */      \
+{GPIO0_BASE, GPIO_OUT, GPIO_ALT1, GPIO_OUT_NO_CHG}, /* GPIO6   EBC_CS_N(1)                     */      \
+{GPIO0_BASE, GPIO_OUT, GPIO_ALT1, GPIO_OUT_NO_CHG}, /* GPIO7   EBC_CS_N(2)                     */      \
+{GPIO0_BASE, GPIO_OUT, GPIO_ALT1, GPIO_OUT_NO_CHG}, /* GPIO8   EBC_CS_N(3)                     */      \
+{GPIO0_BASE, GPIO_OUT, GPIO_ALT1, GPIO_OUT_NO_CHG}, /* GPIO9   EBC_CS_N(4)                     */      \
+{GPIO0_BASE, GPIO_OUT, GPIO_SEL, GPIO_OUT_NO_CHG},  /* GPIO10  EBC_CS_N(5)                     */      \
+{GPIO0_BASE, GPIO_OUT, GPIO_SEL, GPIO_OUT_NO_CHG},  /* GPIO11  EBC_BUS_ERR                     */      \
+{GPIO0_BASE, GPIO_IN,  GPIO_ALT1, GPIO_OUT_NO_CHG}, /* GPIO12  ZII_p0Rxd(0)                    */      \
+{GPIO0_BASE, GPIO_IN,  GPIO_ALT1, GPIO_OUT_NO_CHG}, /* GPIO13  ZII_p0Rxd(1)                    */      \
+{GPIO0_BASE, GPIO_IN,  GPIO_ALT1, GPIO_OUT_NO_CHG}, /* GPIO14  ZII_p0Rxd(2)                    */      \
+{GPIO0_BASE, GPIO_IN,  GPIO_ALT1, GPIO_OUT_NO_CHG}, /* GPIO15  ZII_p0Rxd(3)                    */      \
+{GPIO0_BASE, GPIO_OUT, GPIO_ALT1, GPIO_OUT_NO_CHG}, /* GPIO16  ZII_p0Txd(0)                    */      \
+{GPIO0_BASE, GPIO_OUT, GPIO_ALT1, GPIO_OUT_NO_CHG}, /* GPIO17  ZII_p0Txd(1)                    */      \
+{GPIO0_BASE, GPIO_OUT, GPIO_ALT1, GPIO_OUT_NO_CHG}, /* GPIO18  ZII_p0Txd(2)                    */      \
+{GPIO0_BASE, GPIO_OUT, GPIO_ALT1, GPIO_OUT_NO_CHG}, /* GPIO19  ZII_p0Txd(3)                    */      \
+{GPIO0_BASE, GPIO_IN,  GPIO_ALT1, GPIO_OUT_NO_CHG}, /* GPIO20  ZII_p0Rx_er                     */      \
+{GPIO0_BASE, GPIO_IN,  GPIO_ALT1, GPIO_OUT_NO_CHG}, /* GPIO21  ZII_p0Rx_dv                     */      \
+{GPIO0_BASE, GPIO_IN,  GPIO_ALT1, GPIO_OUT_NO_CHG}, /* GPIO22  ZII_p0RxCrs                     */      \
+{GPIO0_BASE, GPIO_OUT, GPIO_ALT1, GPIO_OUT_NO_CHG}, /* GPIO23  ZII_p0Tx_er                     */      \
+{GPIO0_BASE, GPIO_OUT, GPIO_ALT1, GPIO_OUT_NO_CHG}, /* GPIO24  ZII_p0Tx_en                     */      \
+{GPIO0_BASE, GPIO_IN,  GPIO_ALT1, GPIO_OUT_NO_CHG}, /* GPIO25  ZII_p0Col                       */      \
+{GPIO0_BASE, GPIO_IN,  GPIO_SEL, GPIO_OUT_NO_CHG},  /* GPIO26                  USB2D_RXVALID   */      \
+{GPIO0_BASE, GPIO_IN,  GPIO_SEL, GPIO_OUT_NO_CHG},  /* GPIO27  EXT_EBC_REQ     USB2D_RXERROR   */      \
+{GPIO0_BASE, GPIO_IN,  GPIO_SEL, GPIO_OUT_NO_CHG},  /* GPIO28                  USB2D_TXVALID   */      \
+{GPIO0_BASE, GPIO_IN,  GPIO_SEL, GPIO_OUT_NO_CHG},  /* GPIO29  EBC_EXT_HDLA    USB2D_PAD_SUSPNDM */    \
+{GPIO0_BASE, GPIO_IN,  GPIO_SEL, GPIO_OUT_NO_CHG},  /* GPIO30  EBC_EXT_ACK     USB2D_XCVRSELECT*/      \
+{GPIO0_BASE, GPIO_IN,  GPIO_SEL, GPIO_OUT_NO_CHG},  /* GPIO31  EBC_EXR_BUSREQ  USB2D_TERMSELECT*/      \
 },                                                                                     \
 {                                                                                      \
 /* GPIO Core 1 */                                                                      \
-{ GPIO1_BASE, GPIO_IN,  GPIO_SEL },  /* GPIO32 USB2D_OPMODE0                   */      \
-{ GPIO1_BASE, GPIO_IN,  GPIO_SEL },  /* GPIO33 USB2D_OPMODE1                   */      \
-{ GPIO1_BASE, GPIO_OUT, GPIO_ALT3 }, /* GPIO34 UART0_DCD_N     UART1_DSR_CTS_N UART2_SOUT*/ \
-{ GPIO1_BASE, GPIO_IN,  GPIO_ALT3 }, /* GPIO35 UART0_8PIN_DSR_N UART1_RTS_DTR_N UART2_SIN*/ \
-{ GPIO1_BASE, GPIO_IN,  GPIO_ALT1 }, /* GPIO36 UART0_8PIN_CTS_N                UART3_SIN*/ \
-{ GPIO1_BASE, GPIO_OUT, GPIO_ALT1 }, /* GPIO37 UART0_RTS_N                     */      \
-{ GPIO1_BASE, GPIO_OUT, GPIO_ALT2 }, /* GPIO38 UART0_DTR_N     UART1_SOUT      */      \
-{ GPIO1_BASE, GPIO_IN,  GPIO_ALT2 }, /* GPIO39 UART0_RI_N      UART1_SIN       */      \
-{ GPIO1_BASE, GPIO_IN,  GPIO_ALT1 }, /* GPIO40 UIC_IRQ(0)                      */      \
-{ GPIO1_BASE, GPIO_IN,  GPIO_ALT1 }, /* GPIO41 UIC_IRQ(1)                      */      \
-{ GPIO1_BASE, GPIO_IN,  GPIO_ALT1 }, /* GPIO42 UIC_IRQ(2)                      */      \
-{ GPIO1_BASE, GPIO_IN,  GPIO_ALT1 }, /* GPIO43 UIC_IRQ(3)                      */      \
-{ GPIO1_BASE, GPIO_IN,  GPIO_ALT1 }, /* GPIO44 UIC_IRQ(4)      DMA_ACK(1)      */      \
-{ GPIO1_BASE, GPIO_IN,  GPIO_SEL },  /* GPIO45 UIC_IRQ(6)      DMA_EOT/TC(1)   */      \
-{ GPIO1_BASE, GPIO_BI,  GPIO_SEL },  /* GPIO46 UIC_IRQ(7)      DMA_REQ(0)      */      \
-{ GPIO1_BASE, GPIO_IN,  GPIO_SEL },  /* GPIO47 UIC_IRQ(8)      DMA_ACK(0)      */      \
-{ GPIO1_BASE, GPIO_IN,  GPIO_SEL },  /* GPIO48 UIC_IRQ(9)      DMA_EOT/TC(0)   */      \
-{ GPIO1_BASE, GPIO_IN,  GPIO_SEL },  /* GPIO49  Unselect via TraceSelect Bit   */      \
-{ GPIO1_BASE, GPIO_IN,  GPIO_SEL },  /* GPIO50  Unselect via TraceSelect Bit   */      \
-{ GPIO1_BASE, GPIO_IN,  GPIO_SEL },  /* GPIO51  Unselect via TraceSelect Bit   */      \
-{ GPIO1_BASE, GPIO_IN,  GPIO_SEL },  /* GPIO52  Unselect via TraceSelect Bit   */      \
-{ GPIO1_BASE, GPIO_IN,  GPIO_SEL },  /* GPIO53  Unselect via TraceSelect Bit   */      \
-{ GPIO1_BASE, GPIO_IN,  GPIO_SEL },  /* GPIO54  Unselect via TraceSelect Bit   */      \
-{ GPIO1_BASE, GPIO_IN,  GPIO_SEL },  /* GPIO55  Unselect via TraceSelect Bit   */      \
-{ GPIO1_BASE, GPIO_IN,  GPIO_SEL },  /* GPIO56  Unselect via TraceSelect Bit   */      \
-{ GPIO1_BASE, GPIO_IN,  GPIO_SEL },  /* GPIO57  Unselect via TraceSelect Bit   */      \
-{ GPIO1_BASE, GPIO_IN,  GPIO_SEL },  /* GPIO58  Unselect via TraceSelect Bit   */      \
-{ GPIO1_BASE, GPIO_IN,  GPIO_SEL },  /* GPIO59  Unselect via TraceSelect Bit   */      \
-{ GPIO1_BASE, GPIO_IN,  GPIO_SEL },  /* GPIO60  Unselect via TraceSelect Bit   */      \
-{ GPIO1_BASE, GPIO_IN,  GPIO_SEL },  /* GPIO61  Unselect via TraceSelect Bit   */      \
-{ GPIO1_BASE, GPIO_IN,  GPIO_SEL },  /* GPIO62  Unselect via TraceSelect Bit   */      \
-{ GPIO1_BASE, GPIO_IN,  GPIO_SEL },  /* GPIO63  Unselect via TraceSelect Bit   */      \
+{GPIO1_BASE, GPIO_IN,  GPIO_SEL, GPIO_OUT_NO_CHG},  /* GPIO32  USB2D_OPMODE0                   */      \
+{GPIO1_BASE, GPIO_IN,  GPIO_SEL, GPIO_OUT_NO_CHG},  /* GPIO33  USB2D_OPMODE1                   */      \
+{GPIO1_BASE, GPIO_OUT, GPIO_ALT3, GPIO_OUT_NO_CHG}, /* GPIO34  UART0_DCD_N     UART1_DSR_CTS_N UART2_SOUT*/ \
+{GPIO1_BASE, GPIO_IN,  GPIO_ALT3, GPIO_OUT_NO_CHG}, /* GPIO35  UART0_8PIN_DSR_N UART1_RTS_DTR_N UART2_SIN*/ \
+{GPIO1_BASE, GPIO_IN,  GPIO_ALT1, GPIO_OUT_NO_CHG}, /* GPIO36  UART0_8PIN_CTS_N                UART3_SIN*/ \
+{GPIO1_BASE, GPIO_OUT, GPIO_ALT1, GPIO_OUT_NO_CHG}, /* GPIO37  UART0_RTS_N                     */      \
+{GPIO1_BASE, GPIO_OUT, GPIO_ALT2, GPIO_OUT_NO_CHG}, /* GPIO38  UART0_DTR_N     UART1_SOUT      */      \
+{GPIO1_BASE, GPIO_IN,  GPIO_ALT2, GPIO_OUT_NO_CHG}, /* GPIO39  UART0_RI_N      UART1_SIN       */      \
+{GPIO1_BASE, GPIO_IN,  GPIO_ALT1, GPIO_OUT_NO_CHG}, /* GPIO40  UIC_IRQ(0)                      */      \
+{GPIO1_BASE, GPIO_IN,  GPIO_ALT1, GPIO_OUT_NO_CHG}, /* GPIO41  UIC_IRQ(1)                      */      \
+{GPIO1_BASE, GPIO_IN,  GPIO_ALT1, GPIO_OUT_NO_CHG}, /* GPIO42  UIC_IRQ(2)                      */      \
+{GPIO1_BASE, GPIO_IN,  GPIO_ALT1, GPIO_OUT_NO_CHG}, /* GPIO43  UIC_IRQ(3)                      */      \
+{GPIO1_BASE, GPIO_IN,  GPIO_ALT1, GPIO_OUT_NO_CHG}, /* GPIO44  UIC_IRQ(4)      DMA_ACK(1)      */      \
+{GPIO1_BASE, GPIO_IN,  GPIO_SEL, GPIO_OUT_NO_CHG},  /* GPIO45  UIC_IRQ(6)      DMA_EOT/TC(1)   */      \
+{GPIO1_BASE, GPIO_BI,  GPIO_SEL, GPIO_OUT_NO_CHG},  /* GPIO46  UIC_IRQ(7)      DMA_REQ(0)      */      \
+{GPIO1_BASE, GPIO_IN,  GPIO_SEL, GPIO_OUT_NO_CHG},  /* GPIO47  UIC_IRQ(8)      DMA_ACK(0)      */      \
+{GPIO1_BASE, GPIO_IN,  GPIO_SEL, GPIO_OUT_NO_CHG},  /* GPIO48  UIC_IRQ(9)      DMA_EOT/TC(0)   */      \
+{GPIO1_BASE, GPIO_IN,  GPIO_SEL, GPIO_OUT_NO_CHG},  /* GPIO49  Unselect via TraceSelect Bit    */      \
+{GPIO1_BASE, GPIO_IN,  GPIO_SEL, GPIO_OUT_NO_CHG},  /* GPIO50  Unselect via TraceSelect Bit    */      \
+{GPIO1_BASE, GPIO_IN,  GPIO_SEL, GPIO_OUT_NO_CHG},  /* GPIO51  Unselect via TraceSelect Bit    */      \
+{GPIO1_BASE, GPIO_IN,  GPIO_SEL, GPIO_OUT_NO_CHG},  /* GPIO52  Unselect via TraceSelect Bit    */      \
+{GPIO1_BASE, GPIO_IN,  GPIO_SEL, GPIO_OUT_NO_CHG},  /* GPIO53  Unselect via TraceSelect Bit    */      \
+{GPIO1_BASE, GPIO_IN,  GPIO_SEL, GPIO_OUT_NO_CHG},  /* GPIO54  Unselect via TraceSelect Bit    */      \
+{GPIO1_BASE, GPIO_IN,  GPIO_SEL, GPIO_OUT_NO_CHG},  /* GPIO55  Unselect via TraceSelect Bit    */      \
+{GPIO1_BASE, GPIO_IN,  GPIO_SEL, GPIO_OUT_NO_CHG},  /* GPIO56  Unselect via TraceSelect Bit    */      \
+{GPIO1_BASE, GPIO_IN,  GPIO_SEL, GPIO_OUT_NO_CHG},  /* GPIO57  Unselect via TraceSelect Bit    */      \
+{GPIO1_BASE, GPIO_IN,  GPIO_SEL, GPIO_OUT_NO_CHG},  /* GPIO58  Unselect via TraceSelect Bit    */      \
+{GPIO1_BASE, GPIO_IN,  GPIO_SEL, GPIO_OUT_NO_CHG},  /* GPIO59  Unselect via TraceSelect Bit    */      \
+{GPIO1_BASE, GPIO_IN,  GPIO_SEL, GPIO_OUT_NO_CHG},  /* GPIO60  Unselect via TraceSelect Bit    */      \
+{GPIO1_BASE, GPIO_IN,  GPIO_SEL, GPIO_OUT_NO_CHG},  /* GPIO61  Unselect via TraceSelect Bit    */      \
+{GPIO1_BASE, GPIO_IN,  GPIO_SEL, GPIO_OUT_NO_CHG},  /* GPIO62  Unselect via TraceSelect Bit    */      \
+{GPIO1_BASE, GPIO_IN,  GPIO_SEL, GPIO_OUT_NO_CHG},  /* GPIO63  Unselect via TraceSelect Bit    */      \
 }                                                                                      \
 }
 
index fefdb3c..7151a9e 100644 (file)
 /*
  * IPB Bus clocking configuration.
  */
-#undef CFG_IPBSPEED_133                /* define for 133MHz speed */
+#undef CFG_IPBCLK_EQUALS_XLBCLK                /* define for 133MHz speed */
 #endif
 /*
  * I2C configuration
index 6b6acfa..e4357b0 100644 (file)
@@ -58,7 +58,7 @@
  * 0xFFE00000 .... 0xFFFFFFFF -> BOOT-ROM (2 MiB)
  */
 
-#define CONFIG_SOLIDCARD3      1
+#define CONFIG_SC3     1
 #define CONFIG_4xx     1
 #define CONFIG_405GP   1
 
 #if 1  /* feel free to disable for development */
 #define CONFIG_AUTOBOOT_KEYED          /* Enable password protection   */
 #define CONFIG_AUTOBOOT_PROMPT         "\nSC3 - booting... stop with ENTER\n"
-#define CONFIG_AUTOBOOT_DELAY_STR      "\n"    /* 1st "password"       */
+#define CONFIG_AUTOBOOT_DELAY_STR      "\r"    /* 1st "password"       */
+#define CONFIG_AUTOBOOT_DELAY_STR2     "\n"    /* 1st "password"       */
 #endif
 
 /*
index b7f79c2..44bc955 100644 (file)
 #else
 #define CONFIG_440GRX          1               /* Specific PPC440GRx   */
 #endif
+#define CONFIG_440             1               /* ... PPC440 family    */
 #define CONFIG_4xx             1               /* ... PPC4xx family    */
 /* Detect Sequoia PLL input clock automatically via CPLD bit           */
 #define CONFIG_SYS_CLK_FREQ    ((in8(CFG_BCSR_BASE + 3) & 0x80) ? \
-                               3333333 : 33000000)
+                               33333333 : 33000000)
 
 #define CONFIG_BOARD_EARLY_INIT_F 1            /* Call board_early_init_f */
 #define CONFIG_MISC_INIT_R     1               /* Call misc_init_r     */
@@ -58,6 +59,7 @@
 #define CFG_MONITOR_BASE       TEXT_BASE
 #define CFG_NAND_ADDR          0xd0000000      /* NAND Flash           */
 #define CFG_OCM_BASE           0xe0010000      /* ocm                  */
+#define CFG_OCM_DATA_ADDR      CFG_OCM_BASE
 #define CFG_PCI_BASE           0xe0000000      /* Internal PCI regs    */
 #define CFG_PCI_MEMBASE                0x80000000      /* mapped pci memory    */
 #define CFG_PCI_MEMBASE1       CFG_PCI_MEMBASE  + 0x10000000
@@ -80,7 +82,7 @@
 #define CFG_INIT_RAM_END       (4 << 10)
 #define CFG_GBL_DATA_SIZE      256             /* num bytes initial data */
 #define CFG_GBL_DATA_OFFSET    (CFG_INIT_RAM_END - CFG_GBL_DATA_SIZE)
-#define CFG_INIT_SP_OFFSET     CFG_GBL_DATA_OFFSET
+#define CFG_INIT_SP_OFFSET     CFG_POST_WORD_ADDR
 
 /*-----------------------------------------------------------------------
  * Serial Port
 #define CFG_FLASH_QUIET_TEST   1       /* don't warn upon unknown flash        */
 
 #ifdef CFG_ENV_IS_IN_FLASH
-#define CFG_ENV_SECT_SIZE      0x20000         /* size of one complete sector  */
+#define CFG_ENV_SECT_SIZE      0x20000 /* size of one complete sector          */
 #define CFG_ENV_ADDR           ((-CFG_MONITOR_LEN)-CFG_ENV_SECT_SIZE)
 #define        CFG_ENV_SIZE            0x2000  /* Total Size of Environment Sector     */
 
 /*
  * Now the NAND chip has to be defined (no autodetection used!)
  */
-#define CFG_NAND_PAGE_SIZE     (512)           /* NAND chip page size          */
+#define CFG_NAND_PAGE_SIZE     512             /* NAND chip page size          */
 #define CFG_NAND_BLOCK_SIZE    (16 << 10)      /* NAND chip block size         */
-#define CFG_NAND_PAGE_COUNT    (32)            /* NAND chip page count         */
-#define CFG_NAND_BAD_BLOCK_POS (5)             /* Location of bad block marker */
+#define CFG_NAND_PAGE_COUNT    32              /* NAND chip page count         */
+#define CFG_NAND_BAD_BLOCK_POS 5               /* Location of bad block marker */
 #undef CFG_NAND_4_ADDR_CYCLE                   /* No fourth addr used (<=32MB) */
 
+#define CFG_NAND_ECCSIZE       256
+#define CFG_NAND_ECCBYTES      3
+#define CFG_NAND_ECCSTEPS      (CFG_NAND_PAGE_SIZE / CFG_NAND_ECCSIZE)
+#define CFG_NAND_OOBSIZE       16
+#define CFG_NAND_ECCTOTAL      (CFG_NAND_ECCBYTES * CFG_NAND_ECCSTEPS)
+#define CFG_NAND_ECCPOS                {0, 1, 2, 3, 6, 7}
+
 #ifdef CFG_ENV_IS_IN_NAND
 /*
  * For NAND booting the environment is embedded in the U-Boot image. Please take
                               CFG_CMD_SDRAM    |       \
                               CMD_USB)
 
+/* POST support */
+#define CONFIG_POST            (CFG_POST_MEMORY   | \
+                                CFG_POST_CPU      | \
+                                CFG_POST_UART     | \
+                                CFG_POST_I2C      | \
+                                CFG_POST_SPR)
+
+#define CFG_POST_WORD_ADDR     (CFG_GBL_DATA_OFFSET - 0x4)
+#define CONFIG_LOGBUFFER
+
+#define CFG_CONSOLE_IS_IN_ENV /* Otherwise it catches logbuffer as output */
+
 #define CONFIG_SUPPORT_VFAT
 
 /* this must be included AFTER the definition of CONFIG_COMMANDS (if any) */
 #define CFG_PCI_TARGBASE        0x80000000 /* PCIaddr mapped to CFG_PCI_MEMBASE*/
 
 /* Board-specific PCI */
-#define CFG_PCI_PRE_INIT               /* enable board pci_pre_init()  */
 #define CFG_PCI_TARGET_INIT
 #define CFG_PCI_MASTER_INIT
 
index e106b3b..185c2d4 100644 (file)
 /*
  * IPB Bus clocking configuration.
  */
-#define CFG_IPBSPEED_133               /* define for 133MHz speed */
+#define CFG_IPBCLK_EQUALS_XLBCLK               /* define for 133MHz speed */
 
-#if defined(CFG_IPBSPEED_133)
+#if defined(CFG_IPBCLK_EQUALS_XLBCLK)
 /*
  * PCI Bus clocking configuration
  *
  * Actually a PCI Clock of 66 MHz is only set (in cpu_init.c) if
- * CFG_IPBSPEED_133 is defined. This is because a PCI Clock of 66 MHz yet hasn't
- * been tested with a IPB Bus Clock of 66 MHz.
+ * CFG_IPBCLK_EQUALS_XLBCLK is defined. This is because a PCI Clock
+ * of 66 MHz yet hasn't been tested with a IPB Bus Clock of 66 MHz.
  */
-#define CFG_PCISPEED_66                        /* define for 66MHz speed */
+#define CFG_PCICLK_EQUALS_IPBCLK_DIV2  /* define for 66MHz speed */
 #endif
 
 /*
 
 #define CFG_BOOTCS_START       CFG_FLASH_BASE
 #define CFG_BOOTCS_SIZE                CFG_FLASH_SIZE
-#ifdef CFG_PCISPEED_66
+#ifdef CFG_PCICLK_EQUALS_IPBCLK_DIV2
 #define CFG_BOOTCS_CFG         0x0008DF30 /* for pci_clk  = 66 MHz */
 #else
 #define CFG_BOOTCS_CFG         0x0004DF30 /* for pci_clk = 33 MHz */
index f40dde2..9888d11 100644 (file)
 /*
  * IPB Bus clocking configuration.
  */
-#define CFG_IPBSPEED_133               /* define for 133MHz speed */
+#define CFG_IPBCLK_EQUALS_XLBCLK               /* define for 133MHz speed */
 
-#if defined(CFG_IPBSPEED_133)
+#if defined(CFG_IPBCLK_EQUALS_XLBCLK)
 /*
  * PCI Bus clocking configuration
  *
  * Actually a PCI Clock of 66 MHz is only set (in cpu_init.c) if
- * CFG_IPBSPEED_133 is defined. This is because a PCI Clock of 66 MHz yet hasn't
- * been tested with a IPB Bus Clock of 66 MHz.
+ * CFG_IPBCLK_EQUALS_XLBCLK is defined. This is because a PCI Clock
+ * of 66 MHz yet hasn't been tested with a IPB Bus Clock of 66 MHz.
  */
-#define CFG_PCISPEED_66                        /* define for 66MHz speed */
+#define CFG_PCICLK_EQUALS_IPBCLK_DIV2  /* define for 66MHz speed */
 #endif
 
 /*
 
 #define CFG_BOOTCS_START       CFG_FLASH_BASE
 #define CFG_BOOTCS_SIZE                CFG_FLASH_SIZE
-#ifdef CFG_PCISPEED_66
+#ifdef CFG_PCICLK_EQUALS_IPBCLK_DIV2
 #define CFG_BOOTCS_CFG         0x0008DF30 /* for pci_clk  = 66 MHz */
 #else
 #define CFG_BOOTCS_CFG         0x0004DF30 /* for pci_clk = 33 MHz */
index 2a34185..a14cd50 100644 (file)
  * This address, however, is used to configure a 256M local bus
  * window that includes the Config latch below.
  */
-#define CFG_LBC_OPTION_BASE    0xf0000000      /* Localbus Extension */
+#define CFG_LBC_OPTION_BASE    0xF0000000      /* Localbus Extension */
 #define CFG_LBC_OPTION_SIZE    256             /* 256MB */
 
 /* There are various flash options used, we configure for the largest,
  * which is 64Mbytes.  The CFI works fine and will discover the proper
  * sizes.
  */
-#define CFG_FLASH_BASE         0xFC000000      /* start of FLASH 64M    */
-#define CFG_BR0_PRELIM         0xFC001801      /* port size 32bit      */
-#define CFG_OR0_PRELIM         0xFC000FF7      /* 64 MB Flash           */
+#ifdef CONFIG_STXSSA_4M
+#define CFG_FLASH_BASE         0xFFC00000      /* start of  4 MiB flash */
+#else
+#define CFG_FLASH_BASE         0xFC000000      /* start of 64 MiB flash */
+#endif
+#define CFG_BR0_PRELIM (CFG_FLASH_BASE | 0x1801) /* port size 32bit     */
+#define CFG_OR0_PRELIM (CFG_FLASH_BASE | 0x0FF7)
 
 #define CFG_FLASH_CFI          1
 #define CFG_FLASH_CFI_DRIVER   1
 /* The configuration latch is Chip Select 1.
  * It's an 8-bit latch in the lower 8 bits of the word.
  */
-#define CFG_LBC_CFGLATCH_BASE  0xfb000000      /* Base of config latch */
-#define CFG_BR1_PRELIM         0xfb001801      /* 32-bit port */
-#define CFG_OR1_PRELIM         0xffff0ff7      /* 64K is enough */
+#define CFG_LBC_CFGLATCH_BASE  0xFB000000      /* Base of config latch */
+#define CFG_BR1_PRELIM         0xFB001801      /* 32-bit port */
+#define CFG_OR1_PRELIM         0xFFFF0FF7      /* 64K is enough */
 
 #define CFG_MONITOR_BASE       TEXT_BASE       /* start of monitor     */
 
 
 /* Environment - default config is in flash, see below */
 #if 0  /* in EEPROM */
-#define CFG_ENV_IS_IN_EEPROM   1
-#define CFG_ENV_OFFSET         0
-#define CFG_ENV_SIZE           2048
+# define CFG_ENV_IS_IN_EEPROM  1
+# define CFG_ENV_OFFSET                0
+# define CFG_ENV_SIZE          2048
 #else  /* in flash */
-#define        CFG_ENV_IS_IN_FLASH     1
-#define CFG_ENV_SECT_SIZE      0x40000
-
-#define        CFG_ENV_ADDR            (CFG_MONITOR_BASE - CFG_ENV_SECT_SIZE)
-#define        CFG_ENV_SIZE            0x4000
-#define CFG_ENV_ADDR_REDUND    (CFG_ENV_ADDR - CFG_ENV_SECT_SIZE)
-#define CFG_ENV_SIZE_REDUND    (CFG_ENV_SIZE)
+# define CFG_ENV_IS_IN_FLASH   1
+# ifdef CONFIG_STXSSA_4M
+#  define CFG_ENV_SECT_SIZE    0x20000
+# else /* default configuration - 64 MiB flash */
+#  define CFG_ENV_SECT_SIZE    0x40000
+# endif
+# define CFG_ENV_ADDR          (CFG_MONITOR_BASE - CFG_ENV_SECT_SIZE)
+# define CFG_ENV_SIZE          0x4000
+# define CFG_ENV_ADDR_REDUND   (CFG_ENV_ADDR - CFG_ENV_SECT_SIZE)
+# define CFG_ENV_SIZE_REDUND   (CFG_ENV_SIZE)
 #endif
 
 #define CONFIG_LOADS_ECHO      1       /* echo on for serial download  */
index 2b28f93..d756be7 100644 (file)
@@ -30,6 +30,7 @@
  *----------------------------------------------------------------------*/
 #define CONFIG_TAISHAN         1       /* Board is taishan             */
 #define CONFIG_440GX           1       /* Specifc GX support           */
+#define CONFIG_440             1       /* ... PPC440 family            */
 #define CONFIG_4xx             1       /* ... PPC4xx family            */
 #undef CFG_DRAM_TEST                   /* Disable-takes long time!     */
 #define CONFIG_SYS_CLK_FREQ    33333333 /* external freq to pll        */
 #define CONFIG_EMAC_NR_START   2       /* start with EMAC 2 (skip 0&1) */
 #define CONFIG_MII             1       /* MII PHY management           */
 #define CONFIG_NET_MULTI       1
-#define CONFIG_PHY_ADDR                0xff         /* no phy on EMAC0         */
-#define CONFIG_PHY1_ADDR       0xff         /* no phy on EMAC1         */
+#define CONFIG_PHY_ADDR                0xff         /* no phy on EMAC0         */
+#define CONFIG_PHY1_ADDR       0xff         /* no phy on EMAC1         */
 #define CONFIG_PHY2_ADDR       0x1
 #define CONFIG_PHY3_ADDR       0x3
 #define CONFIG_ET1011C_PHY     1
 #define CFG_PCI_TARGBASE    0x80000000 /* PCIaddr mapped to CFG_PCI_MEMBASE */
 
 /* Board-specific PCI */
-#define CFG_PCI_PRE_INIT               /* enable board pci_pre_init()  */
 #define CFG_PCI_TARGET_INIT            /* let board init pci target    */
 
 #define CFG_PCI_SUBSYS_VENDORID 0x10e8 /* AMCC */
index 8cd8e9b..ff061ee 100644 (file)
 /*
  * IPB Bus clocking configuration.
  */
-#define CFG_IPBSPEED_133               /* define for 133MHz speed */
+#define CFG_IPBCLK_EQUALS_XLBCLK               /* define for 133MHz speed */
 
 /*
  * I2C configuration
index e19591d..0b7b19e 100644 (file)
 /*
  * IPB Bus clocking configuration.
  */
-#undef CFG_IPBSPEED_133                        /* define for 133MHz speed */
+#undef CFG_IPBCLK_EQUALS_XLBCLK                        /* define for 133MHz speed */
 #endif
 
 /*
index b68ae54..3b106ef 100644 (file)
@@ -38,6 +38,7 @@
 #define CONFIG_440GR           1       /* Specific PPC440GR support    */
 #define CONFIG_HOSTNAME                yellowstone
 #endif
+#define CONFIG_440             1       /* ... PPC440 family            */
 #define CONFIG_4xx             1       /* ... PPC4xx family            */
 #define CONFIG_SYS_CLK_FREQ    66666666    /* external freq to pll     */
 
 #define CFG_FLASH_EMPTY_INFO           /* print 'E' for empty sector on flinfo */
 
 #ifdef CFG_ENV_IS_IN_FLASH
-#define CFG_ENV_SECT_SIZE      0x20000         /* size of one complete sector  */
+#define CFG_ENV_SECT_SIZE      0x20000 /* size of one complete sector          */
 #define CFG_ENV_ADDR           (CFG_MONITOR_BASE-CFG_ENV_SECT_SIZE)
 #define        CFG_ENV_SIZE            0x2000  /* Total Size of Environment Sector     */
 
 #define CFG_PCI_TARGBASE        0x80000000 /* PCIaddr mapped to CFG_PCI_MEMBASE*/
 
 /* Board-specific PCI */
-#define CFG_PCI_PRE_INIT                /* enable board pci_pre_init()  */
 #define CFG_PCI_TARGET_INIT
 #define CFG_PCI_MASTER_INIT
 
index 7f8b022..1fdcc4b 100644 (file)
 #undef CONFIG_PCI_CONFIG_HOST_BRIDGE
 
 /* Board-specific PCI */
-#define CFG_PCI_PRE_INIT       1       /* enable board pci_pre_init()  */
 #define CFG_PCI_TARGET_INIT            /* let board init pci target    */
 #undef CFG_PCI_MASTER_INIT
 
index 3acfc18..d415729 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * (C) Copyright 2002
+ * (C) Copyright 2002-2007
  * Detlev Zundel, dzu@denx.de.
  *
  * See file CREDITS for list of people who contributed to this
@@ -25,6 +25,7 @@
 
 #ifdef CONFIG_LOGBUFFER
 
+#define LOGBUFF_MAGIC  0xc0de4ced      /* Forced by code, eh!  */
 #define LOGBUFF_LEN    (16384) /* Must be 16k right now */
 #define LOGBUFF_MASK   (LOGBUFF_LEN-1)
 #define LOGBUFF_OVERHEAD (4096) /* Logbuffer overhead for extra info */
 
 #define LOGBUFF_INITIALIZED    (1<<31)
 
+/* The mapping used here has to be the same as in setup_ext_logbuff ()
+   in linux/kernel/printk */
+
+typedef struct {
+       union {
+               struct {
+                       unsigned long   tag;
+                       unsigned long   start;
+                       unsigned long   con;
+                       unsigned long   end;
+                       unsigned long   chars;
+               } v2;
+               struct {
+                       unsigned long   dummy;
+                       unsigned long   tag;
+                       unsigned long   start;
+                       unsigned long   size;
+                       unsigned long   chars;
+               } v1;
+       };
+       unsigned char   buf[0];
+} logbuff_t;
+
 int drv_logbuff_init (void);
 void logbuff_init_ptrs (void);
 void logbuff_log(char *msg);
index 7508f6d..414651f 100644 (file)
@@ -36,6 +36,7 @@
  * Exception offsets (PowerPC standard)
  */
 #define EXC_OFF_SYS_RESET      0x0100  /* System reset                         */
+#define _START_OFFSET          EXC_OFF_SYS_RESET
 
 /*-----------------------------------------------------------------------
  * ISB bit in IMMR to set internal memory map
 #define SIUMCR_DBPC01  0x00080000      /* - " -                                */
 #define SIUMCR_DBPC10  0x00100000      /* - " -                                */
 #define SIUMCR_DBPC11  0x00180000      /* - " -                                */
-#define SIUMCR_GPC00   0x00000000      /* General Pins Config                  */
-#define SIUMCR_GPC01   0x00020000      /* General Pins Config                  */
-#define SIUMCR_GPC10   0x00040000      /* General Pins Config                  */
-#define SIUMCR_GPC11   0x00060000      /* General Pins Config                  */
+#define SIUMCR_GPC00   0x00000000      /* General Pins Config                  */
+#define SIUMCR_GPC01   0x00020000      /* General Pins Config                  */
+#define SIUMCR_GPC10   0x00040000      /* General Pins Config                  */
+#define SIUMCR_GPC11   0x00060000      /* General Pins Config                  */
 #define SIUMCR_DLK     0x00010000      /* Debug Register Lock                  */
 #define SIUMCR_SC00    0x00000000      /* Multi Chip 32 bit                    */
 #define SIUMCR_SC01    0x00004000      /* Muilt Chip 16 bit                    */
@@ -89,7 +90,7 @@
 #define SIUMCR_MLRC01  0x00000400      /* - " -                                */
 #define SIUMCR_MLRC10  0x00000800      /* - " -                                */
 #define SIUMCR_MLRC11  0x00000c00      /* - " -                                */
-#define SIUMCR_MTSC    0x00000100      /* Memory transfer                      */
+#define SIUMCR_MTSC    0x00000100      /* Memory transfer                      */
 
 /*-----------------------------------------------------------------------
  * TBSCR - Time Base Status and Control Register
  * SCCR - System Clock and reset Control Register
  */
 #define SCCR_DFNL_MSK  0x00000070      /* DFNL mask                            */
-#define SCCR_DFNH_MSK  0x00000007      /* DFNH mask                            */
+#define SCCR_DFNH_MSK  0x00000007      /* DFNH mask                            */
 #define SCCR_DFNL_SHIFT 0x0000004      /* DFNL shift value                     */
 #define SCCR_RTSEL     0x00100000      /* RTC circuit input source select      */
 #define SCCR_EBDF00    0x00000000      /* Division factor 1. CLKOUT is GCLK2   */
 #define SCCR_EBDF11    0x00060000      /* reserved                             */
 #define SCCR_TBS       0x02000000      /* Time Base Source                     */
-#define SCCR_RTDIV     0x01000000      /* RTC Clock Divide                     */
+#define SCCR_RTDIV     0x01000000      /* RTC Clock Divide                     */
 #define SCCR_COM00     0x00000000      /* full strength CLKOUT output buffer   */
 #define SCCR_COM01     0x20000000      /* half strength CLKOUT output buffer   */
 #define SCCR_DFNL000   0x00000000      /* Division by 2 (default = minimum)    */
 /*-----------------------------------------------------------------------
  * MC - Memory Controller
  */
-#define BR_V           0x00000001      /* Bank valid                           */
-#define BR_BI          0x00000002      /* Burst inhibit                        */
-#define BR_PS_8                0x00000400      /* 8 bit port size                      */
-#define BR_PS_16       0x00000800      /* 16 bit port size                     */
-#define BR_PS_32       0x00000000      /* 32 bit port size                     */
+#define BR_V           0x00000001      /* Bank valid                           */
+#define BR_BI          0x00000002      /* Burst inhibit                        */
+#define BR_PS_8                0x00000400      /* 8 bit port size                      */
+#define BR_PS_16       0x00000800      /* 16 bit port size                     */
+#define BR_PS_32       0x00000000      /* 32 bit port size                     */
 #define BR_LBDIR       0x00000008      /* Late burst data in progess           */
 #define BR_SETA                0x00000004      /* External Data Acknowledge            */
 #define OR_SCY_3       0x00000030      /* 3 clock cycles wait states           */
 /*-----------------------------------------------------------------------
  * UMCR - UIMB Module Configuration Register
  */
-#define UMCR_FSPEED    0x00000000      /* Full speed. Opposit of UMCR_HSPEED   */
-#define UMCR_HSPEED    0x10000000      /* Half speed                           */
+#define UMCR_FSPEED    0x00000000      /* Full speed. Opposit of UMCR_HSPEED   */
+#define UMCR_HSPEED    0x10000000      /* Half speed                           */
 
 /*-----------------------------------------------------------------------
  * ICTRL - I-Bus Support Control Register
  * SCI - Serial communication interface
  */
 
-#define SCI_TDRE       0x0100          /* Transmit data register empty         */
-#define SCI_TE         0x0008          /* Transmitter enabled                  */
+#define SCI_TDRE       0x0100          /* Transmit data register empty         */
+#define SCI_TE         0x0008          /* Transmitter enabled                  */
 #define SCI_RE         0x0004          /* Receiver enabled                     */
-#define SCI_RDRF       0x0040          /* Receive data register full           */
-#define SCI_PE         0x0400          /* Parity enable                        */
-#define SCI_SCXBR_MK   0x1fff          /* Baudrate mask                        */
-#define SCI_SCXDR_MK   0x00ff          /* Data register mask                   */
+#define SCI_RDRF       0x0040          /* Receive data register full           */
+#define SCI_PE         0x0400          /* Parity enable                        */
+#define SCI_SCXBR_MK   0x1fff          /* Baudrate mask                        */
+#define SCI_SCXDR_MK   0x00ff          /* Data register mask                   */
 #define SCI_M_11       0x0200          /* Frame size is 11 bit                 */
 #define SCI_M_10       0x0000          /* Frame size is 10 bit                 */
-#define SCI_PORT_1     ((int)1)        /* Place this later somewhere better    */
+#define SCI_PORT_1     ((int)1)        /* Place this later somewhere better    */
 #define SCI_PORT_2     ((int)2)
 
 #endif /* __MPC5XX_H__ */
index 089aa13..a4581a3 100644 (file)
@@ -39,6 +39,7 @@
 
 /* Exception offsets (PowerPC standard) */
 #define EXC_OFF_SYS_RESET      0x0100
+#define _START_OFFSET          EXC_OFF_SYS_RESET
 
 /* useful macros for manipulating CSx_START/STOP */
 #if defined(CONFIG_MGT5100)
index ff7acc6..d3b1457 100644 (file)
@@ -35,6 +35,7 @@
 
 /* Exception offsets (PowerPC standard) */
 #define EXC_OFF_SYS_RESET   0x0100
+#define _START_OFFSET  EXC_OFF_SYS_RESET
 
 /* Internal memory map */
 /* MPC8220 Internal Register MMAP */
index 30fc795..30f01d5 100644 (file)
@@ -88,7 +88,7 @@
 #define        PREP_PCI_MEMORY_BUS     0x80000000
 #define        PREP_PCI_MEMORY_SIZE    0x80000000
 #define MPC107_PCI_CMD         0x80000004      /* MPC107 PCI cmd reg */
-#define MPC107_PCI_STAT        0x80000006      /* MPC107 PCI status reg */
+#define MPC107_PCI_STAT                0x80000006      /* MPC107 PCI status reg */
 #define PROC_INT1_ADR          0x800000a8      /* MPC107 Processor i/f cfg1 */
 #define PROC_INT2_ADR          0x800000ac      /* MPC107 Processor i/f cfg2 */
 #define MEM_CONT1_ADR          0x800000f0      /* MPC107 Memory control config. 1 */
@@ -98,8 +98,8 @@
 #define MEM_ERREN1_ADR         0x800000c0      /* MPC107 Memory error enable 1 */
 #define MEM_START1_ADR         0x80000080      /* MPC107 Memory starting addr */
 #define MEM_START2_ADR         0x80000084      /* MPC107 Memory starting addr-lo */
-#define XMEM_START1_ADR        0x80000088      /* MPC107 Extended mem. start addr-hi*/
-#define XMEM_START2_ADR        0x8000008c      /* MPC107 Extended mem. start addr-lo*/
+#define XMEM_START1_ADR                0x80000088      /* MPC107 Extended mem. start addr-hi*/
+#define XMEM_START2_ADR                0x8000008c      /* MPC107 Extended mem. start addr-lo*/
 #define MEM_END1_ADR           0x80000090      /* MPC107 Memory ending address */
 #define MEM_END2_ADR           0x80000094      /* MPC107 Memory ending addr-lo */
 #define XMEM_END1_ADR          0x80000098      /* MPC107 Extended mem. end addrs-hi */
 #define EXC_OFF_JMDDI          0x1600  /* Java Mode denorm detect Interr -- WTF??*/
 #define EXC_OFF_RMTE           0x2000  /* Run Mode or Trace Exception */
 
+#define _START_OFFSET          EXC_OFF_SYS_RESET
+
 #define MAP_A_CONFIG_ADDR_HIGH 0x8000  /* Upper half of CONFIG_ADDR for Map A */
 #define MAP_A_CONFIG_ADDR_LOW  0x0CF8  /* Lower half of CONFIG_ADDR for Map A */
 #define MAP_A_CONFIG_DATA_HIGH 0x8000  /* Upper half of CONFIG_DAT for Map A */
index d9dd92d..0525294 100644 (file)
@@ -53,7 +53,7 @@
  * Exception offsets (PowerPC standard)
  */
 #define EXC_OFF_SYS_RESET      0x0100  /* System reset                 */
-
+#define _START_OFFSET          EXC_OFF_SYS_RESET
 
 /*-----------------------------------------------------------------------
  * BCR - Bus Configuration Register                                     4-25
 #define PSDMR_CL_3          0x00000003 /* CAS Latency = 3              */
 
 /*-----------------------------------------------------------------------
- * LSDMR - Local Bus SDRAM Mode Register                               10-24
+ * LSDMR - Local Bus SDRAM Mode Register                               10-24
  */
 
 /*
 /*-----------------------------------------------------------------------
  * TMR1-TMR4 - Timer Mode Registers                                    17-6
  */
-#define TMRx_PS_MSK            0xff00  /* Prescaler Value              */
+#define TMRx_PS_MSK            0xff00  /* Prescaler Value              */
 #define TMRx_CE_MSK            0x00c0  /* Capture Edge and Enable Interrupt*/
-#define TMRx_OM                        0x0020  /* Output Mode                  */
+#define TMRx_OM                        0x0020  /* Output Mode                  */
 #define TMRx_ORI               0x0010  /* Output Reference Interrupt Enable*/
-#define TMRx_FRR               0x0008  /* Free Run/Restart             */
+#define TMRx_FRR               0x0008  /* Free Run/Restart             */
 #define TMRx_ICLK_MSK          0x0006  /* Timer Input Clock Source mask */
-#define TMRx_GE                        0x0001  /* Gate Enable                  */
+#define TMRx_GE                        0x0001  /* Gate Enable                  */
 
 #define TMRx_CE_INTR_DIS       0x0000  /* Disable Interrupt on capture event*/
 #define TMRx_CE_RISING         0x0040  /* Capture on Rising TINx edge only */
 #define TMRx_CE_FALLING                0x0080  /* Capture on Falling TINx edge only */
-#define TMRx_CE_ANY            0x00c0  /* Capture on any TINx edge     */
+#define TMRx_CE_ANY            0x00c0  /* Capture on any TINx edge     */
 
-#define TMRx_ICLK_IN_CAS       0x0000  /* Internally cascaded input    */
+#define TMRx_ICLK_IN_CAS       0x0000  /* Internally cascaded input    */
 #define TMRx_ICLK_IN_GEN       0x0002  /* Internal General system clock*/
 #define TMRx_ICLK_IN_GEN_DIV16 0x0004  /* Internal General system clk div 16*/
-#define TMRx_ICLK_TIN_PIN      0x0006  /* TINx pin                     */
+#define TMRx_ICLK_TIN_PIN      0x0006  /* TINx pin                     */
 
 
 /*-----------------------------------------------------------------------
index 60fc214..336c0ac 100644 (file)
@@ -25,6 +25,7 @@
 /* System reset offset (PowerPC standard)
  */
 #define EXC_OFF_SYS_RESET              0x0100
+#define        _START_OFFSET                   EXC_OFF_SYS_RESET
 
 /* IMMRBAR - Internal Memory Register Base Address
  */
 #define HRCWH_ROM_LOC_LOCAL_32BIT      0x00700000
 
 #if defined(CONFIG_MPC831X)
-#define HRCWH_ROM_LOC_NAND_SP_8BIT     0x00100000
+#define HRCWH_ROM_LOC_NAND_SP_8BIT     0x00100000
 #define HRCWH_ROM_LOC_NAND_SP_16BIT    0x00200000
-#define HRCWH_ROM_LOC_NAND_LP_8BIT     0x00500000
+#define HRCWH_ROM_LOC_NAND_LP_8BIT     0x00500000
 #define HRCWH_ROM_LOC_NAND_LP_16BIT    0x00600000
 
 #define HRCWH_RL_EXT_LEGACY            0x00000000
 #define FCR_CMD1               0x00FF0000
 #define FCR_CMD1_SHIFT         16
 #define FCR_CMD2               0x0000FF00
-#define FCR_CMD2_SHIFT         8
+#define FCR_CMD2_SHIFT         8
 #define FCR_CMD3               0x000000FF
 #define FCR_CMD3_SHIFT         0
 
 /* LTESR - Transfer Error Status Register
  */
 #define LTESR_BM               0x80000000
-#define LTESR_FCT              0x40000000
-#define LTESR_PAR              0x20000000
+#define LTESR_FCT              0x40000000
+#define LTESR_PAR              0x20000000
 #define LTESR_WP               0x04000000
 #define LTESR_ATMW             0x00800000
 #define LTESR_ATMR             0x00400000
index a4d99b2..6fbd504 100644 (file)
@@ -8,6 +8,7 @@
 #define __MPC85xx_H__
 
 #define EXC_OFF_SYS_RESET      0x0100  /* System reset */
+#define        _START_OFFSET           EXC_OFF_SYS_RESET
 
 #if defined(CONFIG_E500)
 #include <e500.h>
index 673bfed..9fd349a 100644 (file)
@@ -8,7 +8,7 @@
 #define __MPC86xx_H__
 
 #define EXC_OFF_SYS_RESET      0x0100  /* System reset offset */
-
+#define _START_OFFSET          EXC_OFF_SYS_RESET
 
 /*
  * platform register addresses
index 2911758..bef748f 100644 (file)
@@ -35,7 +35,7 @@
  * Exception offsets (PowerPC standard)
  */
 #define EXC_OFF_SYS_RESET      0x0100  /* System reset                         */
-
+#define _START_OFFSET          EXC_OFF_SYS_RESET
 
 /*-----------------------------------------------------------------------
  * SYPCR - System Protection Control Register                          11-9
 #define SCCR_DFBRG10   0x00001000      /* BRGCLK division by 16                */
 #define SCCR_DFBRG11   0x00001800      /* BRGCLK division by 64                */
 #define SCCR_DFNL000   0x00000000      /* Division by 2 (default = minimum)    */
-#define SCCR_DFNL001   0x00000100      /* Division by 4                        */
-#define SCCR_DFNL010   0x00000200      /* Division by 8                        */
-#define SCCR_DFNL011   0x00000300      /* Division by 16                       */
-#define SCCR_DFNL100   0x00000400      /* Division by 32                       */
-#define SCCR_DFNL101   0x00000500      /* Division by 64                       */
-#define SCCR_DFNL110   0x00000600      /* Division by 128                      */
+#define SCCR_DFNL001   0x00000100      /* Division by 4                        */
+#define SCCR_DFNL010   0x00000200      /* Division by 8                        */
+#define SCCR_DFNL011   0x00000300      /* Division by 16                       */
+#define SCCR_DFNL100   0x00000400      /* Division by 32                       */
+#define SCCR_DFNL101   0x00000500      /* Division by 64                       */
+#define SCCR_DFNL110   0x00000600      /* Division by 128                      */
 #define SCCR_DFNL111   0x00000700      /* Division by 256 (maximum)            */
 #define SCCR_DFNH000   0x00000000      /* Division by 1 (default = minimum)    */
 #define SCCR_DFNH110   0x000000D0      /* Division by 64 (maximum)             */
index cdefbdd..8259e5d 100644 (file)
@@ -91,6 +91,7 @@ extern int post_hotkeys_pressed(void);
 #define CFG_POST_SYSMON                0x00000800
 #define CFG_POST_DSP           0x00001000
 #define CFG_POST_CODEC         0x00002000
+#define CFG_POST_FPU           0x00004000
 
 #endif /* CONFIG_POST */
 
index a2503a9..8e64731 100644 (file)
 /*--------------------------------------------------------------------- */
        #define  srr2  0x3de      /* save/restore register 2 */
        #define  srr3  0x3df      /* save/restore register 3 */
+
+       /*
+        * 405 does not really have CSRR0/1 but SRR2/3 are used during critical
+        * exception for the exact same purposes - let's alias them and have a
+        * common handling in crit_return() and CRIT_EXCEPTION
+        */
+       #define  csrr0 srr2
+       #define  csrr1 srr3
+
        #define  dbsr  0x3f0      /* debug status register */
        #define  dbcr0 0x3f2      /* debug control register 0 */
        #define  dbcr1 0x3bd      /* debug control register 1 */
 #define UIC_USBH1      0x00040000      /* USB Host 1                   */
 #define UIC_USBH2      0x00020000      /* USB Host 2                   */
 #define UIC_USBDEV     0x00010000      /* USB Device                   */
-#define UIC_ENET       0x00008000      /* Ethernet interrupt status    */
-#define UIC_ENET1      0x00008000      /* dummy define                 */
+#define UIC_ENET       0x00008000      /* Ethernet interrupt status    */
+#define UIC_ENET1      0x00008000      /* dummy define                 */
 #define UIC_EMAC_WAKE  0x00004000      /* EMAC wake up                 */
 
 #define UIC_MADMAL     0x00002000      /* Logical OR of following MadMAL int */
-#define UIC_MAL_SERR   0x00002000      /*   MAL SERR                   */
+#define UIC_MAL_SERR   0x00002000      /*   MAL SERR                   */
 #define UIC_MAL_TXDE   0x00002000      /*   MAL TXDE                   */
 #define UIC_MAL_RXDE   0x00002000      /*   MAL RXDE                   */
 
 #define sdrcfga (SDR_DCR_BASE+0x0)     /* ADDR */
 #define sdrcfgd (SDR_DCR_BASE+0x1)     /* Data */
 
-#define mtsdr(reg, data) mtdcr(sdrcfga,reg);mtdcr(sdrcfgd,data)
-#define mfsdr(reg, data) mtdcr(sdrcfga,reg);data = mfdcr(sdrcfgd)
+#define mtsdr(reg, data)       do { mtdcr(sdrcfga,reg);mtdcr(sdrcfgd,data); } while (0)
+#define mfsdr(reg, data)       do { mtdcr(sdrcfga,reg);data = mfdcr(sdrcfgd); } while (0)
 
 #define sdrnand0       0x4000
 #define sdrultra0      0x4040
 #define sdricintstat   0x4510
 
 #define SDR_NAND0_NDEN         0x80000000
+#define SDR_NAND0_NDBTEN       0x40000000
+#define SDR_NAND0_NDBADR_MASK  0x30000000
+#define SDR_NAND0_NDBPG_MASK   0x0f000000
+#define SDR_NAND0_NDAREN       0x00800000
+#define SDR_NAND0_NDRBEN       0x00400000
 
 #define SDR_ULTRA0_NDGPIOBP    0x80000000
 #define SDR_ULTRA0_CSN_MASK    0x78000000
 #define SDR_ULTRA0_CSNSEL1     0x20000000
 #define SDR_ULTRA0_CSNSEL2     0x10000000
 #define SDR_ULTRA0_CSNSEL3     0x08000000
+#define SDR_ULTRA0_EBCRDYEN    0x04000000
+#define SDR_ULTRA0_SPISSINEN   0x02000000
+#define SDR_ULTRA0_NFSRSTEN    0x01000000
 
 #define SDR_ULTRA1_LEDNENABLE  0x40000000
 
 /*
  * Macro for accessing the indirect CPR register
  */
-#define mtcpr(reg, data)  mtdcr(cprcfga,reg);mtdcr(cprcfgd,data)
-#define mfcpr(reg, data)  mtdcr(cprcfga,reg);data = mfdcr(cprcfgd)
+#define mtcpr(reg, data)       do { mtdcr(cprcfga,reg);mtdcr(cprcfgd,data); } while (0)
+#define mfcpr(reg, data)       do { mtdcr(cprcfga,reg);data = mfdcr(cprcfgd); } while (0)
 
 #define CPR_CLKUPD_ENPLLCH_EN  0x40000000     /* Enable CPR PLL Changes */
 #define CPR_CLKUPD_ENDVCH_EN   0x20000000     /* Enable CPR Sys. Div. Changes */
 #define cntrl0  (CNTRL_DCR_BASE+0x1)  /* Control 0 register                  */
 #define cntrl1  (CNTRL_DCR_BASE+0x2)  /* Control 1 register                 */
 #define reset   (CNTRL_DCR_BASE+0x3)  /* reset register                             */
-#define strap   (CNTRL_DCR_BASE+0x4)  /* strap register                             */
+#define strap   (CNTRL_DCR_BASE+0x4)  /* strap register                             */
 
 #define ecr     (0xaa)                /* edge conditioner register (405gpr)  */
 
 | UART Register Offsets
 '----------------------------------------------------------------------------*/
 #define                DATA_REG        0x00
-#define                DL_LSB          0x00
-#define                DL_MSB          0x01
+#define                DL_LSB          0x00
+#define                DL_MSB          0x01
 #define                INT_ENABLE      0x01
 #define                FIFO_CONTROL    0x02
 #define                LINE_CONTROL    0x03
 #define                MODEM_CONTROL   0x04
-#define                LINE_STATUS     0x05
+#define                LINE_STATUS     0x05
 #define                MODEM_STATUS    0x06
 #define                SCRATCH         0x07
 
index bc1d7aa..76330f1 100644 (file)
 #define         ivor13 0x19d   /* interrupt vector offset register 13 */
 #define         ivor14 0x19e   /* interrupt vector offset register 14 */
 #define         ivor15 0x19f   /* interrupt vector offset register 15 */
-#if defined(CONFIG_440GX) || \
-    defined(CONFIG_440EP) || defined(CONFIG_440GR) || \
-    defined(CONFIG_440EPX) || defined(CONFIG_440GRX) || \
-    defined(CONFIG_440SP) || defined(CONFIG_440SPE)
+#if defined(CONFIG_440)
 #define         mcsrr0 0x23a   /* machine check save/restore register 0 */
 #define         mcsrr1 0x23b   /* mahcine check save/restore register 1 */
 #define         mcsr   0x23c   /* machine check status register */
 #define         icdbtrh 0x39f  /* instruction cache debug tag register high */
 #define         mmucr  0x3b2   /* mmu control register */
 #define         ccr0   0x3b3   /* core configuration register 0 */
-#define  ccr1          0x378   /* core configuration for 440x5 only */
+#define  ccr1  0x378   /* core configuration for 440x5 only */
 #define         icdbdr 0x3d3   /* instruction cache debug data register */
 #define         dbdr   0x3f3   /* debug data register */
 
 #define clk_opbd       0x00c0
 #define clk_perd       0x00e0
 #define clk_mald       0x0100
-#define clk_spcid      0x0120
+#define clk_spcid      0x0120
 #define clk_icfg       0x0140
 
 /* 440gx sdr register definations */
 #define sdr_sdstp3     0x4003
 #endif /* CONFIG_440GX */
 
+#ifdef CONFIG_440
+/*----------------------------------------------------------------------------+
+| Core Configuration/MMU configuration for 440 (CCR1 for 440x5 only).
++----------------------------------------------------------------------------*/
+#define CCR0_PRE               0x40000000
+#define CCR0_CRPE              0x08000000
+#define CCR0_DSTG              0x00200000
+#define CCR0_DAPUIB            0x00100000
+#define CCR0_DTB               0x00008000
+#define CCR0_GICBT             0x00004000
+#define CCR0_GDCBT             0x00002000
+#define CCR0_FLSTA             0x00000100
+#define CCR0_ICSLC_MASK                0x0000000C
+#define CCR0_ICSLT_MASK                0x00000003
+#define CCR1_TCS_MASK          0x00000080
+#define CCR1_TCS_INTCLK                0x00000000
+#define CCR1_TCS_EXTCLK                0x00000080
+#define MMUCR_SWOA             0x01000000
+#define MMUCR_U1TE             0x00400000
+#define MMUCR_U2SWOAE          0x00200000
+#define MMUCR_DULXE            0x00800000
+#define MMUCR_IULXE            0x00400000
+#define MMUCR_STS              0x00100000
+#define MMUCR_STID_MASK                0x000000FF
+#endif /* CONFIG_440 */
+
 #ifdef CONFIG_440SPE
 #undef sdr_sdstp2
 #define sdr_sdstp2     0x0022
 #define sdr_sdstp6     0x4005
 #define sdr_sdstp7     0x4007
 
-/*----------------------------------------------------------------------------+
-| Core Configuration/MMU configuration for 440 (CCR1 for 440x5 only).
-+----------------------------------------------------------------------------*/
-#define CCR0_PRE               0x40000000
-#define CCR0_CRPE              0x08000000
-#define CCR0_DSTG              0x00200000
-#define CCR0_DAPUIB            0x00100000
-#define CCR0_DTB               0x00008000
-#define CCR0_GICBT             0x00004000
-#define CCR0_GDCBT             0x00002000
-#define CCR0_FLSTA             0x00000100
-#define CCR0_ICSLC_MASK                0x0000000C
-#define CCR0_ICSLT_MASK                0x00000003
-#define CCR1_TCS_MASK          0x00000080
-#define CCR1_TCS_INTCLK                0x00000000
-#define CCR1_TCS_EXTCLK                0x00000080
-#define MMUCR_SEOA             0x01000000
-#define MMUCR_U1TE             0x00400000
-#define MMUCR_U2SWOAE          0x00200000
-#define MMUCR_DULXE            0x00800000
-#define MMUCR_IULXE            0x00400000
-#define MMUCR_STS              0x00100000
-#define MMUCR_STID_MASK                0x000000FF
-
 #define SDR0_CFGADDR           0x00E
 #define SDR0_CFGDATA           0x00F
 
 #define SDRAM_CODT_CKSE_SINGLE_END             0x00000008
 #define SDRAM_CODT_FEEBBACK_RCV_SINGLE_END     0x00000004
 #define SDRAM_CODT_FEEBBACK_DRV_SINGLE_END     0x00000002
-#define SDRAM_CODT_IO_HIZ                      0x00000000
-#define SDRAM_CODT_IO_NMODE                    0x00000001
+#define SDRAM_CODT_IO_HIZ                      0x00000000
+#define SDRAM_CODT_IO_NMODE                    0x00000001
 
 /*-----------------------------------------------------------------------------+
 |  SDRAM Mode Register
 #define plb1_bearl                (PLB_ARBITER_BASE+ 0x0C)
 #define plb1_bearh                (PLB_ARBITER_BASE+ 0x0D)
 
-#if defined(CONFIG_440EP) || defined(CONFIG_440GR)
+#if defined(CONFIG_440EP) || defined(CONFIG_440GR) || \
+    defined(CONFIG_440EPX) || defined(CONFIG_440GRX)
 /* Pin Function Control Register 1 */
 #define SDR0_PFC1                    0x4101
 #define   SDR0_PFC1_U1ME_MASK         0x02000000    /* UART1 Mode Enable */
 #define   SDR0_PFC2_SELECT_CONFIG_5            0xC0000000   /* 2xRTBI  using RGMII bridge */
 #define   SDR0_PFC2_SELECT_CONFIG_6            0x40000000   /* 2xSMII  using  ZMII bridge */
 
+#define SDR0_PFC4              0x4104
+
 /* USB2PHY0 Control Register */
 #define SDR0_USB2PHY0CR               0x4103
 #define   SDR0_USB2PHY0CR_UTMICN_MASK          0x00100000 /*  PHY UTMI interface connection */
 /*----------------------------------------------------------------------------+
 | Clock / Power-on-reset DCR's.
 +----------------------------------------------------------------------------*/
-#define CPR0_CFGADDR                   0x00C
-#define CPR0_CFGDATA                   0x00D
-
 #define CPR0_CLKUPD                    0x20
 #define CPR0_CLKUPD_BSY_MASK           0x80000000
 #define CPR0_CLKUPD_BSY_COMPLETED      0x00000000
 #define mtsdr(reg, data)       do { mtdcr(sdrcfga,reg);mtdcr(sdrcfgd,data); } while (0)
 #define mfsdr(reg, data)       do { mtdcr(sdrcfga,reg);data = mfdcr(sdrcfgd); } while (0)
 
+/*
+ * All 44x except 440GP have CPR registers (indirect DCR)
+ */
+#if !defined(CONFIG_440GP)
+#define CPR0_CFGADDR           0x00C
+#define CPR0_CFGDATA           0x00D
+
+#define mtcpr(reg, data)       do { \
+               mtdcr(CPR0_CFGADDR, reg); \
+               mtdcr(CPR0_CFGDATA, data); \
+       } while (0)
+
+#define mfcpr(reg, data)       do { \
+               mtdcr(CPR0_CFGADDR, reg); \
+               data = mfdcr(CPR0_CFGDATA); \
+       } while (0)
+#endif
 
 #ifndef __ASSEMBLY__
 
index 67759c7..ca241d2 100644 (file)
@@ -22,6 +22,8 @@
 #ifndef        __PPC4XX_H__
 #define __PPC4XX_H__
 
+#define EXC_OFF_SYS_RESET      0x0100  /* System reset                         */
+#define _START_OFFSET          (EXC_OFF_SYS_RESET + 0x2000)
 
 #if defined(CONFIG_440)
 #include <ppc440.h>
index 3e47e82..9f4029f 100644 (file)
 
 #if  defined(CONFIG_5xx)
 /* Some special purpose registers */
-#define DER    149             /* Debug Enable Register                */
-#define COUNTA 150             /* Breakpoint Counter                   */
-#define COUNTB 151             /* Breakpoint Counter                   */
-#define LCTRL1 156             /* Load/Store Support                   */
-#define LCTRL2 157             /* Load/Store Support                   */
+#define DER    149             /* Debug Enable Register                */
+#define COUNTA 150             /* Breakpoint Counter                   */
+#define COUNTB 151             /* Breakpoint Counter                   */
+#define LCTRL1 156             /* Load/Store Support                   */
+#define LCTRL2 157             /* Load/Store Support                   */
 #define ICTRL  158             /* I-Bus Support Control Register       */
 #define EID    81
 #endif /* CONFIG_5xx */
  * We assume sprg3 has the physical address of the current
  * task's thread_struct.
  */
-#define EXCEPTION_PROLOG       \
+#define EXCEPTION_PROLOG(reg1, reg2)   \
        mtspr   SPRG0,r20;      \
        mtspr   SPRG1,r21;      \
        mfcr    r20;            \
        stw     r22,_CTR(r21);  \
        mfspr   r20,XER;        \
        stw     r20,_XER(r21);  \
-       mfspr   r22,SRR0;       \
-       mfspr   r23,SRR1;       \
+       mfspr   r20,DEAR;       \
+       stw     r20,_DAR(r21);  \
+       mfspr   r22,reg1;       \
+       mfspr   r23,reg2;       \
        stw     r0,GPR0(r21);   \
        stw     r1,GPR1(r21);   \
        stw     r2,GPR2(r21);   \
  */
 
 /*
- * Critical exception entry code.  This is just like the other exception
- * code except that it uses SRR2 and SRR3 instead of SRR0 and SRR1.
- */
-#define CRITICAL_EXCEPTION_PROLOG       \
-       mtspr   SPRG0,r20;      \
-       mtspr   SPRG1,r21;      \
-       mfcr    r20;            \
-       subi    r21,r1,INT_FRAME_SIZE+STACK_UNDERHEAD;  /* alloc exc. frame */\
-       stw     r20,_CCR(r21);          /* save registers */ \
-       stw     r22,GPR22(r21); \
-       stw     r23,GPR23(r21); \
-       mfspr   r20,SPRG0;      \
-       stw     r20,GPR20(r21); \
-       mfspr   r22,SPRG1;      \
-       stw     r22,GPR21(r21); \
-       mflr    r20;            \
-       stw     r20,_LINK(r21); \
-       mfctr   r22;            \
-       stw     r22,_CTR(r21);  \
-       mfspr   r20,XER;        \
-       stw     r20,_XER(r21);  \
-       mfspr   r22,990;        /* SRR2 */      \
-       mfspr   r23,991;        /* SRR3 */      \
-       stw     r0,GPR0(r21);   \
-       stw     r1,GPR1(r21);   \
-       stw     r2,GPR2(r21);   \
-       stw     r1,0(r21);      \
-       mr      r1,r21;                 /* set new kernel sp */ \
-       SAVE_4GPRS(3, r21);
-/*
- * Note: code which follows this uses cr0.eq (set if from kernel),
- * r21, r22 (SRR2), and r23 (SRR3).
- */
-
-/*
  * Exception vectors.
  *
  * The data words for `hdlr' and `int_return' are initialized with
 #define STD_EXCEPTION(n, label, hdlr)                  \
        . = n;                                          \
 label:                                                 \
-       EXCEPTION_PROLOG;                               \
+       EXCEPTION_PROLOG(SRR0, SRR1);                   \
        lwz     r3,GOT(transfer_to_handler);            \
        mtlr    r3;                                     \
        addi    r3,r1,STACK_FRAME_OVERHEAD;             \
        li      r20,MSR_KERNEL;                         \
        rlwimi  r20,r23,0,25,25;                        \
-       blrl    ;                                       \
+       blrl;                                           \
 .L_ ## label :                                         \
-       .long   hdlr - _start + EXC_OFF_SYS_RESET;      \
-       .long   int_return - _start + EXC_OFF_SYS_RESET
-
-
-#define CRIT_EXCEPTION(n, label, hdlr)                  \
-       . = n;                                          \
-label:                                                  \
-       CRITICAL_EXCEPTION_PROLOG;                      \
-       lwz     r3,GOT(transfer_to_handler);            \
-       mtlr    r3;                                     \
-       addi    r3,r1,STACK_FRAME_OVERHEAD;             \
-       li      r20,(MSR_KERNEL & ~(MSR_ME|MSR_DE|MSR_CE)); \
-       rlwimi  r20,r23,0,25,25;                        \
-       blrl    ;                                       \
-.L_ ## label :                                          \
-       .long   hdlr - _start + EXC_OFF_SYS_RESET;      \
-       .long   crit_return - _start + EXC_OFF_SYS_RESET
+       .long   hdlr - _start + _START_OFFSET;          \
+       .long   int_return - _start + _START_OFFSET
+
+#define CRIT_EXCEPTION(n, label, hdlr)                         \
+       . = n;                                                  \
+label:                                                         \
+       EXCEPTION_PROLOG(CSRR0, CSRR1);                         \
+       lwz     r3,GOT(transfer_to_handler);                    \
+       mtlr    r3;                                             \
+       addi    r3,r1,STACK_FRAME_OVERHEAD;                     \
+       li      r20,(MSR_KERNEL & ~(MSR_ME|MSR_DE|MSR_CE));     \
+       rlwimi  r20,r23,0,25,25;                                \
+       blrl;                                                   \
+.L_ ## label :                                                 \
+       .long   hdlr - _start + _START_OFFSET;                  \
+       .long   crit_return - _start + _START_OFFSET
+
+#ifdef CONFIG_440
+#define MCK_EXCEPTION(n, label, hdlr)                          \
+       . = n;                                                  \
+label:                                                         \
+       EXCEPTION_PROLOG(MCSRR0, MCSRR1);                       \
+       lwz     r3,GOT(transfer_to_handler);                    \
+       mtlr    r3;                                             \
+       addi    r3,r1,STACK_FRAME_OVERHEAD;                     \
+       li      r20,(MSR_KERNEL & ~(MSR_ME|MSR_DE|MSR_CE));     \
+       rlwimi  r20,r23,0,25,25;                                \
+       blrl;                                                   \
+.L_ ## label :                                                 \
+       .long   hdlr - _start + _START_OFFSET;                  \
+       .long   mck_return - _start + _START_OFFSET
+#endif /* CONFIG_440  */
 
 #endif /* __PPC_ASM_TMPL__ */
index db4c60f..71a202f 100644 (file)
@@ -355,6 +355,18 @@ void status_led_set  (int led, int state);
 # define STATUS_LED_ACTIVE     0               /* LED on for bit == 0 */
 # define STATUS_LED_BOOT       0               /* LED 0 used for boot status */
 
+#elif defined(CONFIG_MOTIONPRO)
+
+#define STATUS_LED_BIT         ((vu_long *) MPC5XXX_GPT6_ENABLE)
+#define STATUS_LED_PERIOD      (CFG_HZ / 10)
+#define STATUS_LED_STATE       STATUS_LED_BLINKING
+
+#define STATUS_LED_BIT1                ((vu_long *) MPC5XXX_GPT7_ENABLE)
+#define STATUS_LED_PERIOD1     (CFG_HZ / 10)
+#define STATUS_LED_STATE1      STATUS_LED_OFF
+
+#define STATUS_LED_BOOT                0       /* LED 0 used for boot status */
+
 #else
 # error Status LED configuration missing
 #endif
index 1e7f172..c4fc580 100644 (file)
@@ -76,7 +76,7 @@
 extern int update_flash_size (int flash_size);
 #endif
 
-#if defined(CONFIG_SOLIDCARD3)
+#if defined(CONFIG_SC3)
 extern void sc3_read_eeprom(void);
 #endif
 
@@ -564,7 +564,9 @@ void board_init_f (ulong bootflag)
 
        bd->bi_procfreq = gd->cpu_clk;  /* Processor Speed, In Hz */
        bd->bi_plb_busfreq = gd->bus_clk;
-#if defined(CONFIG_405GP) || defined(CONFIG_405EP) || defined(CONFIG_440EP) || defined(CONFIG_440GR)
+#if defined(CONFIG_405GP) || defined(CONFIG_405EP) || \
+    defined(CONFIG_440EP) || defined(CONFIG_440GR) || \
+    defined(CONFIG_440EPX) || defined(CONFIG_440GRX)
        bd->bi_pci_busfreq = get_PCI_freq ();
        bd->bi_opbfreq = get_OPB_freq ();
 #elif defined(CONFIG_XILINX_ML300)
@@ -818,7 +820,7 @@ void board_init_r (gd_t *id, ulong dest_addr)
 #endif /* CONFIG_405GP, CONFIG_405EP */
 #endif /* CFG_EXTBDINFO */
 
-#if defined(CONFIG_SOLIDCARD3)
+#if defined(CONFIG_SC3)
        sc3_read_eeprom();
 #endif
        s = getenv ("ethaddr");
@@ -927,7 +929,7 @@ void board_init_r (gd_t *id, ulong dest_addr)
     defined(CONFIG_KUP4X)      || \
     defined(CONFIG_LWMON)      || \
     defined(CONFIG_PCU_E)      || \
-    defined(CONFIG_SOLIDCARD3) || \
+    defined(CONFIG_SC3)                || \
     defined(CONFIG_W7O)                || \
     defined(CONFIG_MISC_INIT_R)
        /* miscellaneous platform dependent initialisations */
diff --git a/nand_spl/board/amcc/acadia/Makefile b/nand_spl/board/amcc/acadia/Makefile
new file mode 100644 (file)
index 0000000..926476f
--- /dev/null
@@ -0,0 +1,114 @@
+#
+# (C) Copyright 2007
+# Stefan Roese, DENX Software Engineering, sr@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
+include $(TOPDIR)/nand_spl/board/$(BOARDDIR)/config.mk
+
+LDSCRIPT= $(TOPDIR)/nand_spl/board/$(BOARDDIR)/u-boot.lds
+LDFLAGS        = -Bstatic -T $(LDSCRIPT) -Ttext $(TEXT_BASE) $(PLATFORM_LDFLAGS)
+AFLAGS += -DCONFIG_NAND_SPL
+CFLAGS += -DCONFIG_NAND_SPL
+
+SOBJS  = start.o resetvec.o
+COBJS  = gpio.o nand_boot.o nand_ecc.o memory.o ndfc.o pll.o
+
+SRCS   := $(addprefix $(obj),$(SOBJS:.o=.S) $(COBJS:.o=.c))
+OBJS   := $(addprefix $(obj),$(SOBJS) $(COBJS))
+__OBJS := $(SOBJS) $(COBJS)
+LNDIR  := $(OBJTREE)/nand_spl/board/$(BOARDDIR)
+
+nandobj        := $(OBJTREE)/nand_spl/
+
+ALL    = $(nandobj)u-boot-spl $(nandobj)u-boot-spl.bin $(nandobj)u-boot-spl-16k.bin \
+       $(nandobj)System.map
+
+all:   $(obj).depend $(ALL)
+
+$(nandobj)u-boot-spl-16k.bin: $(nandobj)u-boot-spl
+       $(OBJCOPY) ${OBJCFLAGS} --pad-to=$(PAD_TO) -O binary $< $@
+
+$(nandobj)u-boot-spl.bin:      $(nandobj)u-boot-spl
+       $(OBJCOPY) ${OBJCFLAGS} -O binary $< $@
+
+$(nandobj)u-boot-spl:  $(OBJS)
+       cd $(LNDIR) && $(LD) $(LDFLAGS) $$UNDEF_SYM $(__OBJS) \
+               -Map $(nandobj)u-boot-spl.map \
+               -o $(nandobj)u-boot-spl
+
+$(nandobj)System.map:  $(nandobj)u-boot-spl
+               @$(NM) $< | \
+               grep -v '\(compiled\)\|\(\.o$$\)\|\( [aUw] \)\|\(\.\.ng$$\)\|\(LASH[RL]DI\)' | \
+               sort > $(nandobj)System.map
+
+# create symbolic links for common files
+
+# from cpu directory
+$(obj)gpio.c:
+       @rm -f $(obj)gpio.c
+       ln -s $(SRCTREE)/cpu/ppc4xx/gpio.c $(obj)gpio.c
+
+$(obj)ndfc.c:
+       @rm -f $(obj)ndfc.c
+       ln -s $(SRCTREE)/cpu/ppc4xx/ndfc.c $(obj)ndfc.c
+
+$(obj)resetvec.S:
+       @rm -f $(obj)resetvec.S
+       ln -s $(SRCTREE)/cpu/ppc4xx/resetvec.S $(obj)resetvec.S
+
+$(obj)start.S:
+       @rm -f $(obj)start.S
+       ln -s $(SRCTREE)/cpu/ppc4xx/start.S $(obj)start.S
+
+# from board directory
+$(obj)memory.c:
+       @rm -f $(obj)memory.c
+       ln -s $(SRCTREE)/board/amcc/acadia/memory.c $(obj)memory.c
+
+$(obj)pll.c:
+       @rm -f $(obj)pll.c
+       ln -s $(SRCTREE)/board/amcc/acadia/pll.c $(obj)pll.c
+
+# from nand_spl directory
+$(obj)nand_boot.c:
+       @rm -f $(obj)nand_boot.c
+       ln -s $(SRCTREE)/nand_spl/nand_boot.c $(obj)nand_boot.c
+
+# from drivers/nand directory
+$(obj)nand_ecc.c:
+       @rm -f $(obj)nand_ecc.c
+       ln -s $(SRCTREE)/drivers/nand/nand_ecc.c $(obj)nand_ecc.c
+
+#########################################################################
+
+$(obj)%.o:     $(obj)%.S
+       $(CC) $(AFLAGS) -c -o $@ $<
+
+$(obj)%.o:     $(obj)%.c
+       $(CC) $(CFLAGS) -c -o $@ $<
+
+# defines $(obj).depend target
+include $(SRCTREE)/rules.mk
+
+sinclude $(obj).depend
+
+#########################################################################
diff --git a/nand_spl/board/amcc/acadia/config.mk b/nand_spl/board/amcc/acadia/config.mk
new file mode 100644 (file)
index 0000000..3b140fa
--- /dev/null
@@ -0,0 +1,47 @@
+#
+# (C) Copyright 2007
+# Stefan Roese, DENX Software Engineering, sr@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
+#
+#
+# AMCC 405EZ Reference Platform (Acadia) board
+#
+
+#
+# TEXT_BASE for SPL:
+#
+# On 4xx platforms the SPL is located at 0xfffff000...0xffffffff,
+# in the last 4kBytes of memory space in cache.
+# We will copy this SPL into internal SRAM in start.S. So we set
+# TEXT_BASE to starting address in internal SRAM here.
+#
+TEXT_BASE = 0xf8004000
+
+# PAD_TO used to generate a 16kByte binary needed for the combined image
+# -> PAD_TO = TEXT_BASE + 0x4000
+PAD_TO = 0xf8008000
+
+ifeq ($(debug),1)
+PLATFORM_CPPFLAGS += -DDEBUG
+endif
+
+ifeq ($(dbcr),1)
+PLATFORM_CPPFLAGS += -DCFG_INIT_DBCR=0x8cff0000
+endif
diff --git a/nand_spl/board/amcc/acadia/u-boot.lds b/nand_spl/board/amcc/acadia/u-boot.lds
new file mode 100644 (file)
index 0000000..a07a773
--- /dev/null
@@ -0,0 +1,63 @@
+/*
+ * (C) Copyright 2007
+ * Stefan Roese, DENX Software Engineering, sr@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:common)
+SECTIONS
+{
+  .resetvec 0xf8004ffc :
+  {
+    *(.resetvec)
+  } = 0xffff
+
+  .text      :
+  {
+    start.o    (.text)
+    nand_boot.o        (.text)
+    ndfc.o     (.text)
+
+    *(.text)
+    *(.fixup)
+  }
+  _etext = .;
+
+  .data    :
+  {
+    *(.rodata*)
+    *(.data*)
+    *(.sdata*)
+    __got2_start = .;
+    *(.got2)
+    __got2_end = .;
+  }
+
+  _edata  =  .;
+
+  __bss_start = .;
+  .bss       :
+  {
+   *(.sbss)
+   *(.bss)
+  }
+
+  _end = . ;
+}
diff --git a/nand_spl/board/amcc/bamboo/Makefile b/nand_spl/board/amcc/bamboo/Makefile
new file mode 100644 (file)
index 0000000..0df86f9
--- /dev/null
@@ -0,0 +1,100 @@
+#
+# (C) Copyright 2007
+# Stefan Roese, DENX Software Engineering, sr@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
+include $(TOPDIR)/nand_spl/board/$(BOARDDIR)/config.mk
+
+LDSCRIPT= $(TOPDIR)/nand_spl/board/$(BOARDDIR)/u-boot.lds
+LDFLAGS        = -Bstatic -T $(LDSCRIPT) -Ttext $(TEXT_BASE) $(PLATFORM_LDFLAGS)
+AFLAGS += -DCONFIG_NAND_SPL
+CFLAGS += -DCONFIG_NAND_SPL
+
+SOBJS  = start.o init.o resetvec.o
+COBJS  = nand_boot.o nand_ecc.o ndfc.o sdram.o
+
+SRCS   := $(addprefix $(obj),$(SOBJS:.o=.S) $(COBJS:.o=.c))
+OBJS   := $(addprefix $(obj),$(SOBJS) $(COBJS))
+__OBJS := $(SOBJS) $(COBJS)
+LNDIR  := $(OBJTREE)/nand_spl/board/$(BOARDDIR)
+
+nandobj        := $(OBJTREE)/nand_spl/
+
+ALL    = $(nandobj)u-boot-spl $(nandobj)u-boot-spl.bin $(nandobj)u-boot-spl-16k.bin
+
+all:   $(obj).depend $(ALL)
+
+$(nandobj)u-boot-spl-16k.bin: $(nandobj)u-boot-spl
+       $(OBJCOPY) ${OBJCFLAGS} --pad-to=$(PAD_TO) -O binary $< $@
+
+$(nandobj)u-boot-spl.bin:      $(nandobj)u-boot-spl
+       $(OBJCOPY) ${OBJCFLAGS} -O binary $< $@
+
+$(nandobj)u-boot-spl:  $(OBJS)
+       cd $(LNDIR) && $(LD) $(LDFLAGS) $$UNDEF_SYM $(__OBJS) \
+               -Map $(nandobj)u-boot-spl.map \
+               -o $(nandobj)u-boot-spl
+
+# create symbolic links for common files
+
+# from cpu directory
+$(obj)ndfc.c:
+       @rm -f $(obj)ndfc.c
+       ln -s $(SRCTREE)/cpu/ppc4xx/ndfc.c $(obj)ndfc.c
+
+$(obj)resetvec.S:
+       @rm -f $(obj)resetvec.S
+       ln -s $(SRCTREE)/cpu/ppc4xx/resetvec.S $(obj)resetvec.S
+
+$(obj)start.S:
+       @rm -f $(obj)start.S
+       ln -s $(SRCTREE)/cpu/ppc4xx/start.S $(obj)start.S
+
+# from board directory
+$(obj)init.S:
+       @rm -f $(obj)init.S
+       ln -s $(SRCTREE)/board/amcc/bamboo/init.S $(obj)init.S
+
+# from nand_spl directory
+$(obj)nand_boot.c:
+       @rm -f $(obj)nand_boot.c
+       ln -s $(SRCTREE)/nand_spl/nand_boot.c $(obj)nand_boot.c
+
+# from drivers/nand directory
+$(obj)nand_ecc.c:
+       @rm -f $(obj)nand_ecc.c
+       ln -s $(SRCTREE)/drivers/nand/nand_ecc.c $(obj)nand_ecc.c
+
+#########################################################################
+
+$(obj)%.o:     $(obj)%.S
+       $(CC) $(AFLAGS) -c -o $@ $<
+
+$(obj)%.o:     $(obj)%.c
+       $(CC) $(CFLAGS) -c -o $@ $<
+
+# defines $(obj).depend target
+include $(SRCTREE)/rules.mk
+
+sinclude $(obj).depend
+
+#########################################################################
diff --git a/nand_spl/board/amcc/bamboo/config.mk b/nand_spl/board/amcc/bamboo/config.mk
new file mode 100644 (file)
index 0000000..f7ec751
--- /dev/null
@@ -0,0 +1,49 @@
+#
+# (C) Copyright 2007
+# Stefan Roese, DENX Software Engineering, sr@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
+#
+#
+# AMCC 440EP Reference Platform (Bamboo) board
+#
+
+#
+# TEXT_BASE for SPL:
+#
+# On 440EP(x) platforms the SPL is located at 0xfffff000...0xffffffff,
+# in the last 4kBytes of memory space in cache.
+# We will copy this SPL into instruction-cache in start.S. So we set
+# TEXT_BASE to starting address in i-cache here.
+#
+TEXT_BASE = 0x00800000
+
+# PAD_TO used to generate a 16kByte binary needed for the combined image
+# -> PAD_TO = TEXT_BASE + 0x4000
+PAD_TO = 0x00804000
+
+PLATFORM_CPPFLAGS += -DCONFIG_440=1
+
+ifeq ($(debug),1)
+PLATFORM_CPPFLAGS += -DDEBUG
+endif
+
+ifeq ($(dbcr),1)
+PLATFORM_CPPFLAGS += -DCFG_INIT_DBCR=0x8cff0000
+endif
diff --git a/nand_spl/board/amcc/bamboo/sdram.c b/nand_spl/board/amcc/bamboo/sdram.c
new file mode 100644 (file)
index 0000000..4f09072
--- /dev/null
@@ -0,0 +1,92 @@
+/*
+ * (C) Copyright 2007
+ * Stefan Roese, DENX Software Engineering, sr@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 <ppc4xx.h>
+#include <asm/processor.h>
+#include <asm/io.h>
+
+static void wait_init_complete(void)
+{
+       u32 val;
+
+       do {
+               mfsdram(mem_mcsts, val);
+       } while (!(val & 0x80000000));
+}
+
+/*
+ * early_sdram_init()
+ *
+ * As the name already indicates, this function is called very early
+ * from start.S and configures the SDRAM with fixed values. This is needed,
+ * since the 440EP has no internal SRAM and the 4kB NAND_SPL loader has
+ * not enough free space to implement the complete I2C SPD DDR autodetection
+ * routines. Therefore the Bamboo only supports the onboard 64MBytes of SDRAM
+ * when booting from NAND flash.
+ */
+void early_sdram_init(void)
+{
+       /*
+        * Soft-reset SDRAM controller.
+        */
+       mtsdr(sdr_srst, SDR0_SRST_DMC);
+       mtsdr(sdr_srst, 0x00000000);
+
+       /*
+        * Disable memory controller.
+        */
+       mtsdram(mem_cfg0, 0x00000000);
+
+       /*
+        * Setup some default
+        */
+       mtsdram(mem_uabba, 0x00000000); /* ubba=0 (default)             */
+       mtsdram(mem_slio, 0x00000000);  /* rdre=0 wrre=0 rarw=0         */
+       mtsdram(mem_devopt, 0x00000000); /* dll=0 ds=0 (normal)         */
+       mtsdram(mem_wddctr, 0x00000000); /* wrcp=0 dcd=0                */
+       mtsdram(mem_clktr, 0x40000000); /* clkp=1 (90 deg wr) dcdt=0    */
+
+       /*
+        * Following for CAS Latency = 2.5 @ 133 MHz PLB
+        */
+       mtsdram(mem_b0cr, 0x00082001);
+       mtsdram(mem_tr0, 0x41094012);
+       mtsdram(mem_tr1, 0x8080083d);   /* SS=T2 SL=STAGE 3 CD=1 CT=0x00*/
+       mtsdram(mem_rtr, 0x04100000);   /* Interval 7.8µs @ 133MHz PLB  */
+       mtsdram(mem_cfg1, 0x00000000);  /* Self-refresh exit, disable PM*/
+
+       /*
+        * Enable the controller, then wait for DCEN to complete
+        */
+       mtsdram(mem_cfg0, 0x80000000); /* DCEN=1, PMUD=0*/
+       wait_init_complete();
+}
+
+long int initdram(int board_type)
+{
+       /*
+        * Nothing to do here, just return size of fixed SDRAM setup
+        */
+       return CFG_MBYTES_SDRAM << 20;
+}
diff --git a/nand_spl/board/amcc/bamboo/u-boot.lds b/nand_spl/board/amcc/bamboo/u-boot.lds
new file mode 100644 (file)
index 0000000..28228f8
--- /dev/null
@@ -0,0 +1,65 @@
+/*
+ * (C) Copyright 2007
+ * Stefan Roese, DENX Software Engineering, sr@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:common)
+SECTIONS
+{
+  .resetvec 0x00800FFC :
+  {
+    *(.resetvec)
+  } = 0xffff
+
+  .text      :
+  {
+    start.o    (.text)
+    init.o     (.text)
+    nand_boot.o        (.text)
+    sdram.o    (.text)
+    ndfc.o     (.text)
+
+    *(.text)
+    *(.fixup)
+  }
+  _etext = .;
+
+  .data    :
+  {
+    *(.rodata*)
+    *(.data*)
+    *(.sdata*)
+    __got2_start = .;
+    *(.got2)
+    __got2_end = .;
+  }
+
+  _edata  =  .;
+
+  __bss_start = .;
+  .bss       :
+  {
+   *(.sbss)
+   *(.bss)
+  }
+
+  _end = . ;
+}
index b42da8c..ec1be5a 100644 (file)
@@ -1,5 +1,5 @@
 #
-# (C) Copyright 2006
+# (C) Copyright 2006-2007
 # Stefan Roese, DENX Software Engineering, sr@denx.de.
 #
 # See file CREDITS for list of people who contributed to this
@@ -30,7 +30,7 @@ AFLAGS        += -DCONFIG_NAND_SPL
 CFLAGS += -DCONFIG_NAND_SPL
 
 SOBJS  = start.o init.o resetvec.o
-COBJS  = nand_boot.o ndfc.o sdram.o
+COBJS  = nand_boot.o nand_ecc.o ndfc.o sdram.o
 
 SRCS   := $(addprefix $(obj),$(SOBJS:.o=.S) $(COBJS:.o=.c))
 OBJS   := $(addprefix $(obj),$(SOBJS) $(COBJS))
@@ -85,6 +85,11 @@ $(obj)nand_boot.c:
        @rm -f $(obj)nand_boot.c
        ln -s $(SRCTREE)/nand_spl/nand_boot.c $(obj)nand_boot.c
 
+# from drivers/nand directory
+$(obj)nand_ecc.c:
+       @rm -f $(obj)nand_ecc.c
+       ln -s $(SRCTREE)/drivers/nand/nand_ecc.c $(obj)nand_ecc.c
+
 #########################################################################
 
 $(obj)%.o:     $(obj)%.S
index a136fb7..840a596 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * (C) Copyright 2006
+ * (C) Copyright 2006-2007
  * Stefan Roese, DENX Software Engineering, sr@denx.de.
  *
  * This program is free software; you can redistribute it and/or
 #define CFG_NAND_READ_DELAY \
        { volatile int dummy; int i; for (i=0; i<10000; i++) dummy = i; }
 
+static int nand_ecc_pos[] = CFG_NAND_ECCPOS;
+
 extern void board_nand_init(struct nand_chip *nand);
-extern void ndfc_hwcontrol(struct mtd_info *mtdinfo, int cmd);
-extern void ndfc_write_byte(struct mtd_info *mtdinfo, u_char byte);
-extern u_char ndfc_read_byte(struct mtd_info *mtdinfo);
-extern int ndfc_dev_ready(struct mtd_info *mtdinfo);
-extern int jump_to_ram(ulong delta);
-extern int jump_to_uboot(ulong addr);
 
-static int nand_is_bad_block(struct mtd_info *mtd, int block)
+static int nand_command(struct mtd_info *mtd, int block, int page, int offs, u8 cmd)
 {
        struct nand_chip *this = mtd->priv;
-       int page_addr = block * CFG_NAND_PAGE_COUNT;
+       int page_addr = page + block * CFG_NAND_PAGE_COUNT;
+
+       if (this->dev_ready)
+               this->dev_ready(mtd);
+       else
+               CFG_NAND_READ_DELAY;
 
        /* Begin command latch cycle */
        this->hwcontrol(mtd, NAND_CTL_SETCLE);
-       this->write_byte(mtd, NAND_CMD_READOOB);
+       this->write_byte(mtd, cmd);
        /* Set ALE and clear CLE to start address cycle */
        this->hwcontrol(mtd, NAND_CTL_CLRCLE);
        this->hwcontrol(mtd, NAND_CTL_SETALE);
        /* Column address */
-       this->write_byte(mtd, CFG_NAND_BAD_BLOCK_POS);                  /* A[7:0] */
+       this->write_byte(mtd, offs);                                    /* A[7:0] */
        this->write_byte(mtd, (uchar)(page_addr & 0xff));               /* A[16:9] */
        this->write_byte(mtd, (uchar)((page_addr >> 8) & 0xff));        /* A[24:17] */
 #ifdef CFG_NAND_4_ADDR_CYCLE
@@ -62,6 +63,15 @@ static int nand_is_bad_block(struct mtd_info *mtd, int block)
        else
                CFG_NAND_READ_DELAY;
 
+       return 0;
+}
+
+static int nand_is_bad_block(struct mtd_info *mtd, int block)
+{
+       struct nand_chip *this = mtd->priv;
+
+       nand_command(mtd, block, 0, CFG_NAND_BAD_BLOCK_POS, NAND_CMD_READOOB);
+
        /*
         * Read on byte
         */
@@ -74,39 +84,46 @@ static int nand_is_bad_block(struct mtd_info *mtd, int block)
 static int nand_read_page(struct mtd_info *mtd, int block, int page, uchar *dst)
 {
        struct nand_chip *this = mtd->priv;
-       int page_addr = page + block * CFG_NAND_PAGE_COUNT;
+       u_char *ecc_calc;
+       u_char *ecc_code;
+       u_char *oob_data;
        int i;
+       int eccsize = CFG_NAND_ECCSIZE;
+       int eccbytes = CFG_NAND_ECCBYTES;
+       int eccsteps = CFG_NAND_ECCSTEPS;
+       uint8_t *p = dst;
+       int stat;
 
-       /* Begin command latch cycle */
-       this->hwcontrol(mtd, NAND_CTL_SETCLE);
-       this->write_byte(mtd, NAND_CMD_READ0);
-       /* Set ALE and clear CLE to start address cycle */
-       this->hwcontrol(mtd, NAND_CTL_CLRCLE);
-       this->hwcontrol(mtd, NAND_CTL_SETALE);
-       /* Column address */
-       this->write_byte(mtd, 0);                                       /* A[7:0] */
-       this->write_byte(mtd, (uchar)(page_addr & 0xff));               /* A[16:9] */
-       this->write_byte(mtd, (uchar)((page_addr >> 8) & 0xff));        /* A[24:17] */
-#ifdef CFG_NAND_4_ADDR_CYCLE
-       /* One more address cycle for devices > 32MiB */
-       this->write_byte(mtd, (uchar)((page_addr >> 16) & 0x0f));       /* A[xx:25] */
-#endif
-       /* Latch in address */
-       this->hwcontrol(mtd, NAND_CTL_CLRALE);
+       nand_command(mtd, block, page, 0, NAND_CMD_READ0);
 
-       /*
-        * Wait a while for the data to be ready
+       /* No malloc available for now, just use some temporary locations
+        * in SDRAM
         */
-       if (this->dev_ready)
-               this->dev_ready(mtd);
-       else
-               CFG_NAND_READ_DELAY;
+       ecc_calc = (u_char *)(CFG_SDRAM_BASE + 0x10000);
+       ecc_code = ecc_calc + 0x100;
+       oob_data = ecc_calc + 0x200;
+
+       for (i = 0; eccsteps; eccsteps--, i += eccbytes, p += eccsize) {
+               this->enable_hwecc(mtd, NAND_ECC_READ);
+               this->read_buf(mtd, p, eccsize);
+               this->calculate_ecc(mtd, p, &ecc_calc[i]);
+       }
+       this->read_buf(mtd, oob_data, CFG_NAND_OOBSIZE);
 
-       /*
-        * Read page into buffer
-        */
-       for (i=0; i<CFG_NAND_PAGE_SIZE; i++)
-               *dst++ = this->read_byte(mtd);
+       /* Pick the ECC bytes out of the oob data */
+       for (i = 0; i < CFG_NAND_ECCTOTAL; i++)
+               ecc_code[i] = oob_data[nand_ecc_pos[i]];
+
+       eccsteps = CFG_NAND_ECCSTEPS;
+       p = dst;
+
+       for (i = 0 ; eccsteps; eccsteps--, i += eccbytes, p += eccsize) {
+               /* No chance to do something with the possible error message
+                * from correct_data(). We just hope that all possible errors
+                * are corrected by this routine.
+                */
+               stat = this->correct_data(mtd, p, &ecc_code[i], &ecc_calc[i]);
+       }
 
        return 0;
 }
diff --git a/post/cpu/ppc4xx/Makefile b/post/cpu/ppc4xx/Makefile
new file mode 100644 (file)
index 0000000..8e8ab50
--- /dev/null
@@ -0,0 +1,28 @@
+#
+# (C) Copyright 2002-2007
+# 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
+#
+
+LIB    = libpostppc4xx.a
+
+COBJS  = fpu.o spr.o uart.o watchdog.o
+
+include $(TOPDIR)/post/rules.mk
diff --git a/post/cpu/ppc4xx/fpu.c b/post/cpu/ppc4xx/fpu.c
new file mode 100644 (file)
index 0000000..1935c01
--- /dev/null
@@ -0,0 +1,55 @@
+/*
+ *  Copyright (C) 2007 Wolfgang Denk <wd@denx.de>
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+#include <config.h>
+
+#ifdef CONFIG_POST
+#if defined(CONFIG_440EP) || \
+    defined(CONFIG_440EPX)
+
+#include <ppc4xx.h>
+#include <asm/processor.h>
+
+
+int fpu_status(void)
+{
+       if (mfspr(ccr0) & CCR0_DAPUIB)
+               return 0; /* Disabled */
+       else
+               return 1; /* Enabled */
+}
+
+
+void fpu_disable(void)
+{
+       mtspr(ccr0, mfspr(ccr0) | CCR0_DAPUIB);
+       mtmsr(mfmsr() & ~MSR_FP);
+}
+
+
+void fpu_enable(void)
+{
+       mtspr(ccr0, mfspr(ccr0) & ~CCR0_DAPUIB);
+       mtmsr(mfmsr() | MSR_FP);
+}
+#endif
+#endif
diff --git a/post/cpu/ppc4xx/spr.c b/post/cpu/ppc4xx/spr.c
new file mode 100644 (file)
index 0000000..f62526a
--- /dev/null
@@ -0,0 +1,176 @@
+/*
+ * (C) Copyright 2007
+ * 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>
+
+/*
+ * SPR test
+ *
+ * The test checks the contents of Special Purpose Registers (SPR) listed
+ * in the spr_test_list array below.
+ * Each SPR value is read using mfspr instruction, some bits are masked
+ * according to the table and the resulting value is compared to the
+ * corresponding table value.
+ */
+
+#ifdef CONFIG_POST
+
+#include <post.h>
+
+#if CONFIG_POST & CFG_POST_SPR
+
+static struct
+{
+    int number;
+    char * name;
+    unsigned long mask;
+    unsigned long value;
+} spr_test_list [] = {
+       /* Standard Special-Purpose Registers */
+
+       {0x001, "XER",          0x00000000,     0x00000000},
+       {0x008, "LR",           0x00000000,     0x00000000},
+       {0x009, "CTR",          0x00000000,     0x00000000},
+       {0x016, "DEC",          0x00000000,     0x00000000},
+       {0x01a, "SRR0",         0x00000000,     0x00000000},
+       {0x01b, "SRR1",         0x00000000,     0x00000000},
+       {0x110, "SPRG0",        0x00000000,     0x00000000},
+       {0x111, "SPRG1",        0x00000000,     0x00000000},
+       {0x112, "SPRG2",        0x00000000,     0x00000000},
+       {0x113, "SPRG3",        0x00000000,     0x00000000},
+       {0x11f, "PVR",          0x00000000,     0x00000000},
+
+       /* Additional Special-Purpose Registers */
+
+       {0x30,  "PID",          0x00000000,     0x00000000},
+       {0x3a,  "CSRR0",        0x00000000,     0x00000000},
+       {0x3b,  "CSRR1",        0x00000000,     0x00000000},
+       {0x3d,  "DEAR",         0x00000000,     0x00000000},
+       {0x3e,  "ESR",          0x00000000,     0x00000000},
+       {0x3f,  "IVPR",         0xffff0000,     0x00000000},
+       {0x100, "USPRG0",       0x00000000,     0x00000000},
+       {0x104, "SPRG4",        0x00000000,     0x00000000},
+       {0x105, "SPRG5",        0x00000000,     0x00000000},
+       {0x106, "SPRG6",        0x00000000,     0x00000000},
+       {0x107, "SPRG7",        0x00000000,     0x00000000},
+       {0x10c, "TBL",          0x00000000,     0x00000000},
+       {0x10d, "TBU",          0x00000000,     0x00000000},
+       {0x11e, "PIR",          0x0000000f,     0x00000000},
+       {0x130, "DBSR",         0x00000000,     0x00000000},
+       {0x134, "DBCR0",        0x00000000,     0x00000000},
+       {0x135, "DBCR1",        0x00000000,     0x00000000},
+       {0x136, "DBCR2",        0x00000000,     0x00000000},
+       {0x138, "IAC1",         0x00000000,     0x00000000},
+       {0x139, "IAC2",         0x00000000,     0x00000000},
+       {0x13a, "IAC3",         0x00000000,     0x00000000},
+       {0x13b, "IAC4",         0x00000000,     0x00000000},
+       {0x13c, "DAC1",         0x00000000,     0x00000000},
+       {0x13d, "DAC2",         0x00000000,     0x00000000},
+       {0x13e, "DVC1",         0x00000000,     0x00000000},
+       {0x13f, "DVC2",         0x00000000,     0x00000000},
+       {0x150, "TSR",          0x00000000,     0x00000000},
+       {0x154, "TCR",          0x00000000,     0x00000000},
+       {0x190, "IVOR0",        0x00000000,     0x00000000},
+       {0x191, "IVOR1",        0x00000000,     0x00000000},
+       {0x192, "IVOR2",        0x00000000,     0x00000000},
+       {0x193, "IVOR3",        0x00000000,     0x00000000},
+       {0x194, "IVOR4",        0x00000000,     0x00000000},
+       {0x195, "IVOR5",        0x00000000,     0x00000000},
+       {0x196, "IVOR6",        0x00000000,     0x00000000},
+       {0x197, "IVOR7",        0x00000000,     0x00000000},
+       {0x198, "IVOR8",        0x00000000,     0x00000000},
+       {0x199, "IVOR9",        0x00000000,     0x00000000},
+       {0x19a, "IVOR10",       0x00000000,     0x00000000},
+       {0x19b, "IVOR11",       0x00000000,     0x00000000},
+       {0x19c, "IVOR12",       0x00000000,     0x00000000},
+       {0x19d, "IVOR13",       0x00000000,     0x00000000},
+       {0x19e, "IVOR14",       0x00000000,     0x00000000},
+       {0x19f, "IVOR15",       0x00000000,     0x00000000},
+       {0x23a, "MCSRR0",       0x00000000,     0x00000000},
+       {0x23b, "MCSRR1",       0x00000000,     0x00000000},
+       {0x23c, "MCSR",         0x00000000,     0x00000000},
+       {0x370, "INV0",         0x00000000,     0x00000000},
+       {0x371, "INV1",         0x00000000,     0x00000000},
+       {0x372, "INV2",         0x00000000,     0x00000000},
+       {0x373, "INV3",         0x00000000,     0x00000000},
+       {0x374, "ITV0",         0x00000000,     0x00000000},
+       {0x375, "ITV1",         0x00000000,     0x00000000},
+       {0x376, "ITV2",         0x00000000,     0x00000000},
+       {0x377, "ITV3",         0x00000000,     0x00000000},
+       {0x378, "CCR1",         0x00000000,     0x00000000},
+       {0x390, "DNV0",         0x00000000,     0x00000000},
+       {0x391, "DNV1",         0x00000000,     0x00000000},
+       {0x392, "DNV2",         0x00000000,     0x00000000},
+       {0x393, "DNV3",         0x00000000,     0x00000000},
+       {0x394, "DTV0",         0x00000000,     0x00000000},
+       {0x395, "DTV1",         0x00000000,     0x00000000},
+       {0x396, "DTV2",         0x00000000,     0x00000000},
+       {0x397, "DTV3",         0x00000000,     0x00000000},
+       {0x398, "DVLIM",        0x00000000,     0x00000000},
+       {0x399, "IVLIM",        0x00000000,     0x00000000},
+       {0x39b, "RSTCFG",       0x00000000,     0x00000000},
+       {0x39c, "DCDBTRL",      0x00000000,     0x00000000},
+       {0x39d, "DCDBTRH",      0x00000000,     0x00000000},
+       {0x39e, "ICDBTRL",      0x00000000,     0x00000000},
+       {0x39f, "ICDBTRH",      0x00000000,     0x00000000},
+       {0x3b2, "MMUCR",        0x00000000,     0x00000000},
+       {0x3b3, "CCR0",         0x00000000,     0x00000000},
+       {0x3d3, "ICDBDR",       0x00000000,     0x00000000},
+       {0x3f3, "DBDR",         0x00000000,     0x00000000},
+};
+
+static int spr_test_list_size =
+               sizeof (spr_test_list) / sizeof (spr_test_list[0]);
+
+int spr_post_test (int flags)
+{
+       int ret = 0;
+       int i;
+
+       unsigned long code[] = {
+               0x7c6002a6,                             /* mfspr r3,SPR */
+               0x4e800020                              /* blr          */
+       };
+       unsigned long (*get_spr) (void) = (void *) code;
+
+       for (i = 0; i < spr_test_list_size; i++) {
+               int num = spr_test_list[i].number;
+
+               /* mfspr r3,num */
+               code[0] = 0x7c6002a6 | ((num & 0x1F) << 16) | ((num & 0x3E0) << 6);
+
+               asm volatile ("isync");
+
+               if ((get_spr () & spr_test_list[i].mask) !=
+                       (spr_test_list[i].value & spr_test_list[i].mask)) {
+                       post_log ("The value of %s special register "
+                                 "is incorrect: 0x%08X\n",
+                                       spr_test_list[i].name, get_spr ());
+                       ret = -1;
+               }
+       }
+
+       return ret;
+}
+#endif /* CONFIG_POST & CFG_POST_SPR */
+#endif /* CONFIG_POST */
diff --git a/post/cpu/ppc4xx/uart.c b/post/cpu/ppc4xx/uart.c
new file mode 100644 (file)
index 0000000..f220dba
--- /dev/null
@@ -0,0 +1,214 @@
+/*
+ * (C) Copyright 2007
+ * 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>
+
+/*
+ * UART test
+ *
+ * The controllers are configured to loopback mode and several
+ * characters are transmitted.
+ */
+
+#ifdef CONFIG_POST
+
+#include <post.h>
+
+#if CONFIG_POST & CFG_POST_UART
+
+#include <asm/processor.h>
+#include <serial.h>
+
+#define UART0_BASE  CFG_PERIPHERAL_BASE + 0x00000300
+#define UART1_BASE  CFG_PERIPHERAL_BASE + 0x00000400
+#define UART2_BASE  CFG_PERIPHERAL_BASE + 0x00000500
+#define UART3_BASE  CFG_PERIPHERAL_BASE + 0x00000600
+
+#define CR0_MASK        0xdfffffff
+#define CR0_EXTCLK_ENA  0x00800000
+#define CR0_UDIV_POS    0
+#define UDIV_SUBTRACT  0
+#define UART0_SDR      sdr_uart0
+#define UART1_SDR      sdr_uart1
+#define UART2_SDR      sdr_uart2
+#define UART3_SDR      sdr_uart3
+#define MFREG(a, d)    mfsdr(a, d)
+#define MTREG(a, d)    mtsdr(a, d)
+
+#define UART_RBR    0x00
+#define UART_THR    0x00
+#define UART_IER    0x01
+#define UART_IIR    0x02
+#define UART_FCR    0x02
+#define UART_LCR    0x03
+#define UART_MCR    0x04
+#define UART_LSR    0x05
+#define UART_MSR    0x06
+#define UART_SCR    0x07
+#define UART_DLL    0x00
+#define UART_DLM    0x01
+
+/*
+  Line Status Register.
+*/
+#define asyncLSRDataReady1            0x01
+#define asyncLSROverrunError1         0x02
+#define asyncLSRParityError1          0x04
+#define asyncLSRFramingError1         0x08
+#define asyncLSRBreakInterrupt1       0x10
+#define asyncLSRTxHoldEmpty1          0x20
+#define asyncLSRTxShiftEmpty1         0x40
+#define asyncLSRRxFifoError1          0x80
+
+DECLARE_GLOBAL_DATA_PTR;
+
+static int uart_post_init (unsigned long dev_base)
+{
+       unsigned long reg;
+       unsigned long udiv;
+       unsigned short bdiv;
+       volatile char val;
+#ifdef CFG_EXT_SERIAL_CLOCK
+       unsigned long tmp;
+#endif
+       int i;
+
+       for (i = 0; i < 3500; i++) {
+               if (in8 (dev_base + UART_LSR) & asyncLSRTxHoldEmpty1)
+                       break;
+               udelay (100);
+       }
+       MFREG(UART0_SDR, reg);
+       reg &= ~CR0_MASK;
+
+#ifdef CFG_EXT_SERIAL_CLOCK
+       reg |= CR0_EXTCLK_ENA;
+       udiv = 1;
+       tmp  = gd->baudrate * 16;
+       bdiv = (CFG_EXT_SERIAL_CLOCK + tmp / 2) / tmp;
+#else
+       /* For 440, the cpu clock is on divider chain A, UART on divider
+        * chain B ... so cpu clock is irrelevant. Get the "optimized"
+        * values that are subject to the 1/2 opb clock constraint
+        */
+       serial_divs (gd->baudrate, &udiv, &bdiv);
+#endif
+
+       reg |= (udiv - UDIV_SUBTRACT) << CR0_UDIV_POS;  /* set the UART divisor */
+
+       /*
+        * Configure input clock to baudrate generator for all
+        * available serial ports here
+        */
+       MTREG(UART0_SDR, reg);
+#if defined(UART1_SDR)
+       MTREG(UART1_SDR, reg);
+#endif
+#if defined(UART2_SDR)
+       MTREG(UART2_SDR, reg);
+#endif
+#if defined(UART3_SDR)
+       MTREG(UART3_SDR, reg);
+#endif
+
+       out8(dev_base + UART_LCR, 0x80);        /* set DLAB bit */
+       out8(dev_base + UART_DLL, bdiv);        /* set baudrate divisor */
+       out8(dev_base + UART_DLM, bdiv >> 8);   /* set baudrate divisor */
+       out8(dev_base + UART_LCR, 0x03);        /* clear DLAB; set 8 bits, no parity */
+       out8(dev_base + UART_FCR, 0x00);        /* disable FIFO */
+       out8(dev_base + UART_MCR, 0x10);        /* enable loopback mode */
+       val = in8(dev_base + UART_LSR);         /* clear line status */
+       val = in8(dev_base + UART_RBR);         /* read receive buffer */
+       out8(dev_base + UART_SCR, 0x00);        /* set scratchpad */
+       out8(dev_base + UART_IER, 0x00);        /* set interrupt enable reg */
+
+       return 0;
+}
+
+static void uart_post_putc (unsigned long dev_base, char c)
+{
+       int i;
+
+       out8 (dev_base + UART_THR, c);  /* put character out */
+
+       /* Wait for transfer completion */
+       for (i = 0; i < 3500; i++) {
+               if (in8 (dev_base + UART_LSR) & asyncLSRTxHoldEmpty1)
+                       break;
+               udelay (100);
+       }
+}
+
+static int uart_post_getc (unsigned long dev_base)
+{
+       int i;
+
+       /* Wait for character available */
+       for (i = 0; i < 3500; i++) {
+               if (in8 (dev_base + UART_LSR) & asyncLSRDataReady1)
+                       break;
+               udelay (100);
+       }
+       return 0xff & in8 (dev_base + UART_RBR);
+}
+
+static int test_ctlr (unsigned long dev_base, int index)
+{
+       int res = -1;
+       char test_str[] = "*** UART Test String ***\r\n";
+       int i;
+
+       uart_post_init (dev_base);
+
+       for (i = 0; i < sizeof (test_str) - 1; i++) {
+               uart_post_putc (dev_base, test_str[i]);
+               if (uart_post_getc (dev_base) != test_str[i])
+                       goto done;
+       }
+       res = 0;
+done:
+       if (res)
+               post_log ("uart%d test failed\n", index);
+
+       return res;
+}
+
+int uart_post_test (int flags)
+{
+       int i, res = 0;
+       static unsigned long base[] = {
+               UART0_BASE, UART1_BASE, UART2_BASE, UART3_BASE
+       };
+
+       for (i = 0; i < sizeof (base) / sizeof (base[0]); i++) {
+               if (test_ctlr (base[i], i))
+                       res = -1;
+       }
+       serial_reinit_all ();
+
+       return res;
+}
+
+#endif /* CONFIG_POST & CFG_POST_UART */
+
+#endif /* CONFIG_POST */
diff --git a/post/cpu/ppc4xx/watchdog.c b/post/cpu/ppc4xx/watchdog.c
new file mode 100644 (file)
index 0000000..3c76cfd
--- /dev/null
@@ -0,0 +1,68 @@
+/*
+ * (C) Copyright 2007
+ * 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>
+
+/*
+ * Watchdog test
+ *
+ * The test verifies the watchdog timer operation.
+ * On the first iteration, the test routine disables interrupts and
+ * makes a 10-second delay. If the system does not reboot during this delay,
+ * the watchdog timer is not operational and the test fails. If the system
+ * reboots, on the second iteration the test routine reports a success.
+ */
+
+#ifdef CONFIG_POST
+
+#include <post.h>
+#include <watchdog.h>
+
+#if CONFIG_POST & CFG_POST_WATCHDOG
+
+int watchdog_post_test (int flags)
+{
+       if (flags & POST_REBOOT) {
+               /* Test passed */
+
+               return 0;
+       } else {
+               /* 10-second delay */
+               int ints = disable_interrupts ();
+               ulong base = post_time_ms (0);
+
+               while (post_time_ms (base) < 10000)
+                       ;
+               if (ints)
+                       enable_interrupts ();
+
+               /*
+                * If we have reached this point, the watchdog timer
+                * does not work
+                */
+               return -1;
+       }
+}
+
+#endif /* CONFIG_POST & CFG_POST_WATCHDOG */
+#endif /* CONFIG_POST */
index a0815a4..5e72b34 100644 (file)
@@ -34,6 +34,7 @@
 /* void cpu_post_exec_02 (ulong *code, ulong op1, ulong op2); */
        .global cpu_post_exec_02
 cpu_post_exec_02:
+       isync
        mflr    r0
        stwu    r0, -4(r1)
 
@@ -56,6 +57,7 @@ cpu_post_exec_02:
 /* void cpu_post_exec_04 (ulong *code, ulong op1, ulong op2, ulong op3, ulong op4); */
        .global cpu_post_exec_04
 cpu_post_exec_04:
+       isync
        mflr    r0
        stwu    r0, -4(r1)
 
@@ -80,6 +82,7 @@ cpu_post_exec_04:
 /* void cpu_post_exec_12 (ulong *code, ulong *res, ulong op1, ulong op2); */
        .global cpu_post_exec_12
 cpu_post_exec_12:
+       isync
        mflr    r0
        stwu    r0, -4(r1)
        stwu    r4, -4(r1)
@@ -100,6 +103,7 @@ cpu_post_exec_12:
 /* void cpu_post_exec_11 (ulong *code, ulong *res, ulong op1); */
        .global cpu_post_exec_11
 cpu_post_exec_11:
+       isync
        mflr    r0
        stwu    r0, -4(r1)
        stwu    r4, -4(r1)
@@ -119,6 +123,7 @@ cpu_post_exec_11:
 /* void cpu_post_exec_21 (ulong *code, ulong *cr, ulong *res, ulong op1); */
        .global cpu_post_exec_21
 cpu_post_exec_21:
+       isync
        mflr    r0
        stwu    r0, -4(r1)
        stwu    r4, -4(r1)
@@ -148,6 +153,7 @@ cpu_post_exec_21:
     ulong op2); */
        .global cpu_post_exec_22
 cpu_post_exec_22:
+       isync
        mflr    r0
        stwu    r0, -4(r1)
        stwu    r4, -4(r1)
@@ -177,6 +183,7 @@ cpu_post_exec_22:
 /* void cpu_post_exec_12w (ulong *code, ulong *op1, ulong op2, ulong op3); */
        .global cpu_post_exec_12w
 cpu_post_exec_12w:
+       isync
        mflr    r0
        stwu    r0, -4(r1)
        stwu    r4, -4(r1)
@@ -198,6 +205,7 @@ cpu_post_exec_12w:
 /* void cpu_post_exec_11w (ulong *code, ulong *op1, ulong op2); */
        .global cpu_post_exec_11w
 cpu_post_exec_11w:
+       isync
        mflr    r0
        stwu    r0, -4(r1)
        stwu    r4, -4(r1)
@@ -218,6 +226,7 @@ cpu_post_exec_11w:
 /* void cpu_post_exec_22w (ulong *code, ulong *op1, ulong op2, ulong *op3); */
        .global cpu_post_exec_22w
 cpu_post_exec_22w:
+       isync
        mflr    r0
        stwu    r0, -4(r1)
        stwu    r4, -4(r1)
@@ -241,6 +250,7 @@ cpu_post_exec_22w:
 /* void cpu_post_exec_21w (ulong *code, ulong *op1, ulong *op2); */
        .global cpu_post_exec_21w
 cpu_post_exec_21w:
+       isync
        mflr    r0
        stwu    r0, -4(r1)
        stwu    r4, -4(r1)
@@ -263,6 +273,7 @@ cpu_post_exec_21w:
 /* void cpu_post_exec_21x (ulong *code, ulong *op1, ulong *op2, ulong op3); */
        .global cpu_post_exec_21x
 cpu_post_exec_21x:
+       isync
        mflr    r0
        stwu    r0, -4(r1)
        stwu    r4, -4(r1)
@@ -286,6 +297,7 @@ cpu_post_exec_21x:
     ulong cr); */
        .global cpu_post_exec_31
 cpu_post_exec_31:
+       isync
        mflr    r0
        stwu    r0, -4(r1)
        stwu    r4, -4(r1)
index b4b17c8..6e276c4 100644 (file)
@@ -49,7 +49,7 @@ extern void cpu_post_exec_31 (ulong *code, ulong *ctr, ulong *lr, ulong *jump,
     ulong cr);
 
 static int cpu_post_test_bc (ulong cmd, ulong bo, ulong bi,
-    int pjump, int dec, int link, ulong pctr, ulong cr)
+    int pjump, int decr, int link, ulong pctr, ulong cr)
 {
     int ret = 0;
     ulong lr = 0;
@@ -77,7 +77,7 @@ static int cpu_post_test_bc (ulong cmd, ulong bo, ulong bi,
        ret = pjump == jump ? 0 : -1;
     if (ret == 0)
     {
-       if (dec)
+       if (decr)
            ret = pctr == ctr + 1 ? 0 : -1;
        else
            ret = pctr == ctr ? 0 : -1;
@@ -163,7 +163,7 @@ int cpu_post_test_b (void)
                    {
                        for (ctr = 1; ctr <= 2 && ret == 0; ctr++)
                        {
-                           int dec = cd < 2;
+                           int decr = cd < 2;
                            int cr = cond ? 0x80000000 : 0x00000000;
                            int jumpc = cc >= 2 ||
                                        (cc == 0 && !cond) ||
@@ -174,7 +174,7 @@ int cpu_post_test_b (void)
                            int jump = jumpc && jumpd;
 
                            ret = cpu_post_test_bc (link ? OP_BCL : OP_BC,
-                               (cc << 3) + (cd << 1), 0, jump, dec, link,
+                               (cc << 3) + (cd << 1), 0, jump, decr, link,
                                ctr, cr);
 
                            if (ret != 0)
index ac41990..28435cc 100644 (file)
@@ -428,7 +428,7 @@ void post_reloc (void)
 unsigned long post_time_ms (unsigned long base)
 {
 #ifdef CONFIG_PPC
-       return (unsigned long)get_ticks () / (get_tbclk () / CFG_HZ) - base;
+       return (unsigned long)(get_ticks () / (get_tbclk () / CFG_HZ)) - base;
 #else
 #warning "Not implemented yet"
        return 0; /* Not implemented yet */
index 3bccd1a..f3604b2 100644 (file)
@@ -37,6 +37,7 @@ extern int i2c_post_test (int flags);
 extern int rtc_post_test (int flags);
 extern int memory_post_test (int flags);
 extern int cpu_post_test (int flags);
+extern int fpu_post_test (int flags);
 extern int uart_post_test (int flags);
 extern int ether_post_test (int flags);
 extern int spi_post_test (int flags);
@@ -126,6 +127,19 @@ struct post_test post_list[] =
        CFG_POST_CPU
     },
 #endif
+#if CONFIG_POST & CFG_POST_FPU
+    {
+       "FPU test",
+       "fpu",
+       "This test verifies the arithmetic logic unit of"
+       " FPU.",
+       POST_RAM | POST_ALWAYS,
+       &fpu_post_test,
+       NULL,
+       NULL,
+       CFG_POST_FPU
+    },
+#endif
 #if CONFIG_POST & CFG_POST_UART
     {
        "UART test",