]> git.sur5r.net Git - u-boot/commitdiff
Merge branch 'master' of git://www.denx.de/git/u-boot-fdt
authorWolfgang Denk <wd@denx.de>
Wed, 11 Jun 2008 20:30:47 +0000 (22:30 +0200)
committerWolfgang Denk <wd@denx.de>
Wed, 11 Jun 2008 20:30:47 +0000 (22:30 +0200)
290 files changed:
CREDITS
MAINTAINERS
MAKEALL
Makefile
README
board/amcc/acadia/memory.c
board/amcc/bamboo/bamboo.c
board/amcc/bubinga/bubinga.c
board/amcc/canyonlands/canyonlands.c
board/amcc/ebony/ebony.c
board/amcc/katmai/katmai.c
board/amcc/kilauea/Makefile
board/amcc/kilauea/init.S [deleted file]
board/amcc/kilauea/memory.c [deleted file]
board/amcc/luan/luan.c
board/amcc/makalu/Makefile
board/amcc/makalu/init.S
board/amcc/makalu/memory.c [deleted file]
board/amcc/ocotea/ocotea.c
board/amcc/sequoia/config.mk
board/amcc/sequoia/sequoia.c
board/amcc/taihu/taihu.c
board/amcc/taishan/taishan.c
board/amcc/walnut/walnut.c
board/amcc/yosemite/yosemite.c
board/amcc/yucca/yucca.c
board/amirix/ap1000/init.S
board/atum8548/law.c
board/cray/L1/init.S
board/csb272/csb272.c
board/csb472/csb472.c
board/eric/eric.c
board/esd/ar405/ar405.c
board/esd/canbt/canbt.c
board/exbitgen/exbitgen.c
board/freescale/mpc8540ads/law.c
board/freescale/mpc8540ads/mpc8540ads.c
board/freescale/mpc8541cds/law.c
board/freescale/mpc8541cds/mpc8541cds.c
board/freescale/mpc8544ds/law.c
board/freescale/mpc8544ds/mpc8544ds.c
board/freescale/mpc8548cds/law.c
board/freescale/mpc8548cds/mpc8548cds.c
board/freescale/mpc8555cds/law.c
board/freescale/mpc8555cds/mpc8555cds.c
board/freescale/mpc8560ads/law.c
board/freescale/mpc8560ads/mpc8560ads.c
board/freescale/mpc8568mds/law.c
board/freescale/mpc8568mds/mpc8568mds.c
board/freescale/mpc8610hpcd/law.c
board/freescale/mpc8610hpcd/mpc8610hpcd.c
board/freescale/mpc8641hpcn/law.c
board/freescale/mpc8641hpcn/mpc8641hpcn.c
board/g2000/g2000.c
board/jse/init.S
board/lwmon5/lwmon5.c
board/ml2/init.S
board/mpc8540eval/law.c
board/mpl/mip405/init.S
board/mpl/pip405/init.S
board/mvblm7/Makefile [new file with mode: 0644]
board/mvblm7/config.mk [new file with mode: 0644]
board/mvblm7/fpga.c [new file with mode: 0644]
board/mvblm7/fpga.h [new file with mode: 0644]
board/mvblm7/mvblm7.c [new file with mode: 0644]
board/mvblm7/mvblm7.h [new file with mode: 0644]
board/mvblm7/mvblm7_autoscript [new file with mode: 0644]
board/mvblm7/pci.c [new file with mode: 0644]
board/netstal/hcu4/hcu4.c
board/netstal/hcu5/sdram.c
board/netstal/mcu25/mcu25.c
board/pcs440ep/pcs440ep.c
board/pm854/law.c
board/pm856/law.c
board/prodrive/alpr/alpr.c
board/sbc8548/law.c
board/sbc8560/law.c
board/sbc8641d/law.c
board/socrates/Makefile
board/socrates/config.mk
board/socrates/law.c
board/socrates/nand.c [new file with mode: 0644]
board/socrates/socrates.c
board/socrates/tlb.c
board/socrates/upm_table.h [new file with mode: 0644]
board/stxgp3/law.c
board/stxssa/law.c
board/tqc/tqm5200/Makefile [new file with mode: 0644]
board/tqc/tqm5200/cam5200_flash.c [new file with mode: 0644]
board/tqc/tqm5200/cmd_stk52xx.c [new file with mode: 0644]
board/tqc/tqm5200/cmd_tb5200.c [new file with mode: 0644]
board/tqc/tqm5200/config.mk [new file with mode: 0644]
board/tqc/tqm5200/mt48lc16m16a2-75.h [new file with mode: 0644]
board/tqc/tqm5200/tqm5200.c [new file with mode: 0644]
board/tqc/tqm8260/Makefile [new file with mode: 0644]
board/tqc/tqm8260/config.mk [new file with mode: 0644]
board/tqc/tqm8260/flash.c [new file with mode: 0644]
board/tqc/tqm8260/tqm8260.c [new file with mode: 0644]
board/tqc/tqm8272/Makefile [new file with mode: 0644]
board/tqc/tqm8272/config.mk [new file with mode: 0644]
board/tqc/tqm8272/tqm8272.c [new file with mode: 0644]
board/tqc/tqm834x/Makefile [new file with mode: 0644]
board/tqc/tqm834x/config.mk [new file with mode: 0644]
board/tqc/tqm834x/pci.c [new file with mode: 0644]
board/tqc/tqm834x/tqm834x.c [new file with mode: 0644]
board/tqc/tqm85xx/Makefile [new file with mode: 0644]
board/tqc/tqm85xx/config.mk [new file with mode: 0644]
board/tqc/tqm85xx/law.c [new file with mode: 0644]
board/tqc/tqm85xx/nand.c [new file with mode: 0644]
board/tqc/tqm85xx/sdram.c [new file with mode: 0644]
board/tqc/tqm85xx/tlb.c [new file with mode: 0644]
board/tqc/tqm85xx/tqm85xx.c [new file with mode: 0644]
board/tqc/tqm85xx/u-boot.lds [new file with mode: 0644]
board/tqc/tqm8xx/Makefile [new file with mode: 0644]
board/tqc/tqm8xx/config.mk [new file with mode: 0644]
board/tqc/tqm8xx/flash.c [new file with mode: 0644]
board/tqc/tqm8xx/load_sernum_ethaddr.c [new file with mode: 0644]
board/tqc/tqm8xx/tqm8xx.c [new file with mode: 0644]
board/tqc/tqm8xx/u-boot.lds [new file with mode: 0644]
board/tqc/tqm8xx/u-boot.lds.debug [new file with mode: 0644]
board/tqm5200/Makefile [deleted file]
board/tqm5200/cam5200_flash.c [deleted file]
board/tqm5200/cmd_stk52xx.c [deleted file]
board/tqm5200/cmd_tb5200.c [deleted file]
board/tqm5200/config.mk [deleted file]
board/tqm5200/mt48lc16m16a2-75.h [deleted file]
board/tqm5200/tqm5200.c [deleted file]
board/tqm8260/Makefile [deleted file]
board/tqm8260/config.mk [deleted file]
board/tqm8260/flash.c [deleted file]
board/tqm8260/tqm8260.c [deleted file]
board/tqm8272/Makefile [deleted file]
board/tqm8272/config.mk [deleted file]
board/tqm8272/tqm8272.c [deleted file]
board/tqm834x/Makefile [deleted file]
board/tqm834x/config.mk [deleted file]
board/tqm834x/pci.c [deleted file]
board/tqm834x/tqm834x.c [deleted file]
board/tqm85xx/Makefile [deleted file]
board/tqm85xx/config.mk [deleted file]
board/tqm85xx/law.c [deleted file]
board/tqm85xx/sdram.c [deleted file]
board/tqm85xx/tlb.c [deleted file]
board/tqm85xx/tqm85xx.c [deleted file]
board/tqm85xx/u-boot.lds [deleted file]
board/tqm8xx/Makefile [deleted file]
board/tqm8xx/config.mk [deleted file]
board/tqm8xx/flash.c [deleted file]
board/tqm8xx/load_sernum_ethaddr.c [deleted file]
board/tqm8xx/tqm8xx.c [deleted file]
board/tqm8xx/u-boot.lds [deleted file]
board/tqm8xx/u-boot.lds.debug [deleted file]
board/w7o/w7o.c
board/xilinx/ml300/init.S
board/zeus/zeus.c
common/env_nand.c
cpu/mpc85xx/cpu.c
cpu/mpc85xx/cpu_init.c
cpu/mpc85xx/fdt.c
cpu/mpc85xx/spd_sdram.c
cpu/mpc85xx/traps.c
cpu/mpc86xx/cpu_init.c
cpu/mpc86xx/spd_sdram.c
cpu/mpc86xx/traps.c
cpu/ppc4xx/44x_spd_ddr.c
cpu/ppc4xx/44x_spd_ddr2.c
cpu/ppc4xx/4xx_uart.c
cpu/ppc4xx/Makefile
cpu/ppc4xx/cpu_init.c
cpu/ppc4xx/ecc.c [new file with mode: 0644]
cpu/ppc4xx/ecc.h [new file with mode: 0644]
cpu/ppc4xx/sdram.c
cpu/ppc4xx/start.S
cpu/ppc4xx/traps.c
doc/README.mvblm7 [new file with mode: 0644]
drivers/input/ps2ser.c
drivers/misc/fsl_law.c
drivers/mtd/cfi_flash.c
drivers/mtd/nand/fsl_upm.c
drivers/mtd/nand/nand_base.c
drivers/net/3c589.c
drivers/net/Makefile
drivers/net/bcm570x.c
drivers/net/cs8900.c
drivers/net/dc2114x.c
drivers/net/dm9000x.c
drivers/net/e1000.c
drivers/net/e1000.h
drivers/net/eepro100.c
drivers/net/enc28j60.c
drivers/net/fsl_mcdmafec.c
drivers/net/inca-ip_sw.c
drivers/net/ks8695eth.c
drivers/net/lan91c96.c
drivers/net/macb.c
drivers/net/mcffec.c
drivers/net/natsemi.c
drivers/net/netarm_eth.c
drivers/net/netconsole.c
drivers/net/ns7520_eth.c
drivers/net/ns8382x.c
drivers/net/ns9750_eth.c
drivers/net/pcnet.c
drivers/net/plb2800_eth.c
drivers/net/rtl8019.c
drivers/net/rtl8139.c
drivers/net/rtl8169.c
drivers/net/s3c4510b_eth.c
drivers/net/smc91111.c
drivers/net/smc911x.c
drivers/net/tigon3.c
drivers/net/tsec.c
drivers/net/tsi108_eth.c
drivers/net/uli526x.c
drivers/net/vsc7385.c
include/asm-ppc/fsl_law.h
include/asm-ppc/fsl_lbc.h [new file with mode: 0644]
include/asm-ppc/global_data.h
include/asm-ppc/io.h
include/asm-ppc/ppc4xx-sdram.h [new file with mode: 0644]
include/asm-ppc/processor.h
include/configs/CPCI4052.h
include/configs/CPCI405AB.h
include/configs/CPCI405DT.h
include/configs/MPC8315ERDB.h
include/configs/MPC8349EMDS.h
include/configs/MPC8349ITX.h
include/configs/MPC8360EMDS.h
include/configs/MPC8360ERDK.h
include/configs/MPC837XEMDS.h
include/configs/MPC8540ADS.h
include/configs/MPC8541CDS.h
include/configs/MPC8544DS.h
include/configs/MPC8548CDS.h
include/configs/MPC8555CDS.h
include/configs/MPC8560ADS.h
include/configs/MPC8568MDS.h
include/configs/MPC8610HPCD.h
include/configs/MPC8641HPCN.h
include/configs/MVBLM7.h [new file with mode: 0644]
include/configs/SBC8540.h
include/configs/TQM834x.h
include/configs/TQM85xx.h
include/configs/acadia.h
include/configs/alpr.h
include/configs/amcc-common.h [new file with mode: 0644]
include/configs/bamboo.h
include/configs/bubinga.h
include/configs/canyonlands.h
include/configs/ebony.h
include/configs/katmai.h
include/configs/kilauea.h
include/configs/luan.h
include/configs/makalu.h
include/configs/ocotea.h
include/configs/sbc8560.h
include/configs/scb9328.h
include/configs/sequoia.h
include/configs/socrates.h
include/configs/stxgp3.h
include/configs/stxssa.h
include/configs/taihu.h
include/configs/taishan.h
include/configs/trizepsiv.h
include/configs/walnut.h
include/configs/yosemite.h
include/configs/yucca.h
include/linux/mtd/fsl_upm.h
include/linux/mtd/mtd-abi.h
include/mpc83xx.h
include/mpc85xx.h
include/mpc86xx.h
include/pci_ids.h
include/ppc405.h
include/ppc440.h
include/ppc4xx.h
lib_generic/md5.c
lib_generic/sha1.c
lib_ppc/board.c
nand_spl/board/amcc/acadia/Makefile
nand_spl/board/amcc/bamboo/Makefile
nand_spl/board/amcc/bamboo/sdram.c
nand_spl/board/amcc/canyonlands/Makefile
nand_spl/board/amcc/kilauea/Makefile
nand_spl/board/amcc/kilauea/config.mk
nand_spl/board/amcc/kilauea/u-boot.lds
nand_spl/board/amcc/sequoia/Makefile
nand_spl/nand_boot.c
net/net.c
post/cpu/ppc4xx/uart.c

diff --git a/CREDITS b/CREDITS
index e84ef38ea87247b3137683ac735521d28ab3f01f..aa576827518001832effbe8e70c61c2c01d79913 100644 (file)
--- a/CREDITS
+++ b/CREDITS
@@ -424,6 +424,10 @@ N: Paolo Scaffardi
 E: arsenio@tin.it
 D: FADS823 configuration, MPC823 video support, I2C, wireless keyboard, lots more
 
+N: Andre Schwarz
+E: andre.schwarz@matrix-vision.de
+D: Support for Matrix Vision boards (MVBLM7)
+
 N: Robert Schwebel
 E: r.schwebel@pengutronix.de
 D: Support for csb226, logodl and innokom boards (PXA2xx)
index d3dfd48037028bf98f8b6593a7fe5adf42176c9d..357cab3e857d93b662a2adaa17fa1d2ce8b12767 100644 (file)
@@ -371,6 +371,10 @@ Peter De Schrijver <p2@mind.be>
 
        ML2                     PPC4xx
 
+Andre Schwarz <andre.schwarz@matrix-vision.de>
+
+       mvblm7                  MPC8343
+
 Timur Tabi <timur@freescale.com>
 
        MPC8349E-mITX           MPC8349
diff --git a/MAKEALL b/MAKEALL
index 3cb1d246e3f417a178860b77adf1aa2b08129986..8a0233cca22b5d9e3bb7173e3a7d95b8069d8c26 100755 (executable)
--- a/MAKEALL
+++ b/MAKEALL
@@ -331,6 +331,7 @@ LIST_83xx="         \
        MPC8360ERDK_66  \
        MPC837XEMDS     \
        MPC837XERDB     \
+       MVBLM7          \
        sbc8349         \
        TQM834x         \
 "
@@ -360,6 +361,7 @@ LIST_85xx="         \
        stxssa          \
        TQM8540         \
        TQM8541         \
+       TQM8548         \
        TQM8555         \
        TQM8560         \
 "
index cc988e14e1ea1c286fd3c9652c200f3af2456316..ac129e46c263d4bb73d836775d47603d23609004 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -486,7 +486,7 @@ PATI_config:                unconfig
 #########################################################################
 
 aev_config: unconfig
-       @$(MKCONFIG) -a aev ppc mpc5xxx tqm5200
+       @$(MKCONFIG) -a aev ppc mpc5xxx tqm5200 tqc
 
 BC3450_config: unconfig
        @$(MKCONFIG) -a BC3450 ppc mpc5xxx bc3450
@@ -640,13 +640,13 @@ PM520_ROMBOOT_DDR_config: unconfig
        @$(MKCONFIG) -a PM520 ppc mpc5xxx pm520
 
 smmaco4_config: unconfig
-       @$(MKCONFIG) -a smmaco4 ppc mpc5xxx tqm5200
+       @$(MKCONFIG) -a smmaco4 ppc mpc5xxx tqm5200 tqc
 
 cm5200_config: unconfig
        @$(MKCONFIG) -a cm5200 ppc mpc5xxx cm5200
 
 spieval_config:        unconfig
-       @$(MKCONFIG) -a spieval ppc mpc5xxx tqm5200
+       @$(MKCONFIG) -a spieval ppc mpc5xxx tqm5200 tqc
 
 TB5200_B_config \
 TB5200_config: unconfig
@@ -655,7 +655,7 @@ TB5200_config:      unconfig
                { echo "#define CONFIG_TQM5200_B"       >>$(obj)include/config.h ; \
                  $(XECHO) "... with MPC5200B processor" ; \
                }
-       @$(MKCONFIG) -n $@ -a TB5200 ppc mpc5xxx tqm5200
+       @$(MKCONFIG) -n $@ -a TB5200 ppc mpc5xxx tqm5200 tqc
 
 MINI5200_config        \
 EVAL5200_config        \
@@ -704,7 +704,7 @@ TQM5200_B_HIGHBOOT_config \
 TQM5200_config \
 TQM5200_STK100_config: unconfig
        @mkdir -p $(obj)include
-       @mkdir -p $(obj)board/tqm5200
+       @mkdir -p $(obj)board/tqc/tqm5200
        @[ -z "$(findstring cam5200,$@)" ] || \
                { echo "#define CONFIG_CAM5200" >>$(obj)include/config.h ; \
                  echo "#define CONFIG_TQM5200S"        >>$(obj)include/config.h ; \
@@ -737,7 +737,7 @@ TQM5200_STK100_config:      unconfig
        @[ -z "$(findstring HIGHBOOT,$@)" ] || \
                { echo "TEXT_BASE = 0xFFF00000" >$(obj)board/tqm5200/config.tmp ; \
                }
-       @$(MKCONFIG) -n $@ -a TQM5200 ppc mpc5xxx tqm5200
+       @$(MKCONFIG) -n $@ -a TQM5200 ppc mpc5xxx tqm5200 tqc
 uc101_config:          unconfig
        @$(MKCONFIG) uc101 ppc mpc5xxx uc101
 motionpro_config:      unconfig
@@ -830,7 +830,7 @@ hermes_config       :       unconfig
        @$(MKCONFIG) $(@:_config=) ppc mpc8xx hermes
 
 HMI10_config   :       unconfig
-       @$(MKCONFIG) $(@:_config=) ppc mpc8xx tqm8xx
+       @$(MKCONFIG) $(@:_config=) ppc mpc8xx tqm8xx tqc
 
 IAD210_config: unconfig
        @$(MKCONFIG) $(@:_config=) ppc mpc8xx IAD210 siemens
@@ -1059,7 +1059,7 @@ RRvision_LCD_config:      unconfig
        @$(MKCONFIG) -a RRvision ppc mpc8xx RRvision
 
 SM850_config   :       unconfig
-       @$(MKCONFIG) $(@:_config=) ppc mpc8xx tqm8xx
+       @$(MKCONFIG) $(@:_config=) ppc mpc8xx tqm8xx tqc
 
 spc1920_config:                unconfig
        @$(MKCONFIG) $(@:_config=) ppc mpc8xx spc1920
@@ -1109,13 +1109,13 @@ virtlab2_config:        unconfig
                  echo "#define CONFIG_NEC_NL6448BC20"  >>$(obj)include/config.h ; \
                  $(XECHO) "... with LCD display" ; \
                }
-       @$(MKCONFIG) -a $(call xtract_8xx,$@) ppc mpc8xx tqm8xx
+       @$(MKCONFIG) -a $(call xtract_8xx,$@) ppc mpc8xx tqm8xx tqc
 
 TTTech_config: unconfig
        @mkdir -p $(obj)include
        @echo "#define CONFIG_LCD" >$(obj)include/config.h
        @echo "#define CONFIG_SHARP_LQ104V7DS01" >>$(obj)include/config.h
-       @$(MKCONFIG) -a TQM823L ppc mpc8xx tqm8xx
+       @$(MKCONFIG) -a TQM823L ppc mpc8xx tqm8xx tqc
 
 uc100_config   :       unconfig
        @$(MKCONFIG) $(@:_config=) ppc mpc8xx uc100
@@ -1130,7 +1130,7 @@ wtk_config:       unconfig
        @mkdir -p $(obj)include
        @echo "#define CONFIG_LCD" >$(obj)include/config.h
        @echo "#define CONFIG_SHARP_LQ065T9DR51U" >>$(obj)include/config.h
-       @$(MKCONFIG) -a TQM823L ppc mpc8xx tqm8xx
+       @$(MKCONFIG) -a TQM823L ppc mpc8xx tqm8xx tqc
 
 #########################################################################
 ## PPC4xx Systems
@@ -1784,10 +1784,10 @@ TQM8265_AA_config:  unconfig
                echo "#undef CONFIG_BUSMODE_60x"  >>$(obj)include/config.h ; \
                $(XECHO) "... without 60x Bus Mode" ; \
        fi
-       @$(MKCONFIG) -a TQM8260 ppc mpc8260 tqm8260
+       @$(MKCONFIG) -a TQM8260 ppc mpc8260 tqm8260 tqc
 
 TQM8272_config: unconfig
-       @$(MKCONFIG) TQM8272 ppc mpc8260 tqm8272
+       @$(MKCONFIG) TQM8272 ppc mpc8260 tqm8272 tqc
 
 VoVPN-GW_66MHz_config  \
 VoVPN-GW_100MHz_config:                unconfig
@@ -2107,11 +2107,14 @@ MPC837XEMDS_HOST_config:        unconfig
 MPC837XERDB_config:    unconfig
        @$(MKCONFIG) -a MPC837XERDB ppc mpc83xx mpc837xerdb freescale
 
+MVBLM7_config: unconfig
+       @$(MKCONFIG) $(@:_config=) ppc mpc83xx mvblm7
+
 sbc8349_config:                unconfig
        @$(MKCONFIG) $(@:_config=) ppc mpc83xx sbc8349
 
 TQM834x_config:        unconfig
-       @$(MKCONFIG) $(@:_config=) ppc mpc83xx tqm834x
+       @$(MKCONFIG) $(@:_config=) ppc mpc83xx tqm834x tqc
 
 
 #########################################################################
@@ -2230,6 +2233,7 @@ stxssa_4M_config: unconfig
 
 TQM8540_config         \
 TQM8541_config         \
+TQM8548_config         \
 TQM8555_config         \
 TQM8560_config:                unconfig
        @mkdir -p $(obj)include
@@ -2238,9 +2242,8 @@ TQM8560_config:           unconfig
        echo "#define CONFIG_MPC$${CTYPE}">>$(obj)include/config.h; \
        echo "#define CONFIG_TQM$${CTYPE}">>$(obj)include/config.h; \
        echo "#define CONFIG_HOSTNAME tqm$${CTYPE}">>$(obj)include/config.h; \
-       echo "#define CONFIG_BOARDNAME \"TQM$${CTYPE}\"">>$(obj)include/config.h; \
-       echo "#define CFG_BOOTFILE_PATH \"/tftpboot/tqm$${CTYPE}/uImage\"">>$(obj)include/config.h
-       @$(MKCONFIG) -a TQM85xx ppc mpc85xx tqm85xx
+       echo "#define CONFIG_BOARDNAME \"TQM$${CTYPE}\"">>$(obj)include/config.h;
+       @$(MKCONFIG) -a TQM85xx ppc mpc85xx tqm85xx tqc
 
 #########################################################################
 ## MPC86xx Systems
diff --git a/README b/README
index 5dfc9fe7e18e40f7e50c7867ba44d7aec1e82d1d..62cdfd03e810734a17ef014261b805917aa5c66a 100644 (file)
--- a/README
+++ b/README
@@ -779,6 +779,21 @@ The following options need to be configured:
                        Define this to use i/o functions instead of macros
                        (some hardware wont work with macros)
 
+               CONFIG_DRIVER_SMC911X
+               Support for SMSC's LAN911x and LAN921x chips
+
+                       CONFIG_DRIVER_SMC911X_BASE
+                       Define this to hold the physical address
+                       of the device (I/O space)
+
+                       CONFIG_DRIVER_SMC911X_32_BIT
+                       Define this if data bus is 32 bits
+
+                       CONFIG_DRIVER_SMC911X_16_BIT
+                       Define this if data bus is 16 bits. If your processor
+                       automatically converts one 32 bit word to two 16 bit
+                       words you may also try CONFIG_DRIVER_SMC911X_32_BIT.
+
 - USB Support:
                At the moment only the UHCI host controller is
                supported (PIP405, MIP405, MPC5200); define
index 709d41e41aa456eaf7d60f4ea05296b66453b604..3dec3159a597008075d47caaeef9bac464a59de6 100644 (file)
 
 extern void board_pll_init_f(void);
 
-/*
- * sdram_init - Dummy implementation for start.S, spd_sdram used on this board!
- */
-void sdram_init(void)
-{
-       return;
-}
-
 #if !defined(CONFIG_NAND_U_BOOT) || defined(CONFIG_NAND_SPL)
 static void cram_bcr_write(u32 wr_val)
 {
@@ -116,10 +108,3 @@ long int initdram(int board_type)
 
        return (CFG_MBYTES_RAM << 20);
 }
-
-#ifndef CONFIG_NAND_SPL
-int testdram(void)
-{
-       return (0);
-}
-#endif
index 50771879e1b21ce762cb250565125375f37eaef4..0c7d69e78379aa7bc5fe9cc02670d4dcdfe74e87 100644 (file)
@@ -466,73 +466,6 @@ long int initdram (int board_type)
 #endif
 }
 
-#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, *p32, ctr;
-       const unsigned long bend = CFG_MBYTES_SDRAM * 1024 * 1024;
-
-       mtmsr(0);
-
-       for (k = 0; k < CFG_MBYTES_SDRAM*1024;
-            ++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;
-                       }
-               }
-       }
-
-       /*
-        * Perform a sequence test to ensure that all
-        * memory locations are uniquely addressable
-        */
-       ctr = 0;
-       p32 = 0;
-       while ((unsigned long)p32 != bend) {
-               if (0 == ((unsigned long)p32 & ((1<<20)-1)))
-                       printf("Writing %3d MB\r", (unsigned long)p32 >> 20);
-               *p32++ = ctr++;
-       }
-
-       ctr = 0;
-       p32 = 0;
-       while ((unsigned long)p32 != bend) {
-               if (0 == ((unsigned long)p32 & ((1<<20)-1)))
-                       printf("Verifying %3d MB\r", (unsigned long)p32 >> 20);
-
-               if (*p32 != ctr) {
-                       printf("SDRAM test fails at: %08x\n", p32);
-                       return 1;
-               }
-
-               ctr++;
-               p32++;
-       }
-
-       printf("SDRAM test passes\n");
-       return 0;
-}
-#endif
-
 /*************************************************************************
  *  pci_pre_init
  *
index 66e7509da899d92f3483a6c21f58c8a8d1fbf805..9d508b8937e0f005ab06c832203a195741a5a337 100644 (file)
@@ -66,14 +66,6 @@ int checkboard(void)
        return (0);
 }
 
-/*
- * sdram_init - Dummy implementation for start.S, spd_sdram used on this board!
- */
-void sdram_init(void)
-{
-       return;
-}
-
 /* -------------------------------------------------------------------------
   initdram(int board_type) reads EEPROM via I2c. EEPROM contains all of
   the necessary info for SDRAM controller configuration
@@ -85,11 +77,3 @@ long int initdram(int board_type)
        ret = spd_sdram();
        return ret;
 }
-
-int testdram(void)
-{
-       /* TODO: XXX XXX XXX */
-       printf("test: xxx MB - ok\n");
-
-       return (0);
-}
index 0f6606127815ba7e1ab799ca6f18f08f24a07dd3..4e3b349ef816622d72c6edb10d122e1c26e37d8b 100644 (file)
@@ -211,44 +211,6 @@ long int initdram(int board_type)
 }
 #endif
 
-#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_KBYTES_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_target_init
  *
index ededb3e7e11c79411451c10a11bf7b2081889491..c6375aca8d7f19c1d74d1bf77e51d48ea469c2e0 100644 (file)
@@ -116,36 +116,6 @@ long int initdram(int board_type)
        return dram_size;
 }
 
-#if defined(CFG_DRAM_TEST)
-int testdram(void)
-{
-       uint *pstart = (uint *) 0x00000000;
-       uint *pend = (uint *) 0x08000000;
-       uint *p;
-
-       for (p = pstart; p < pend; p++)
-               *p = 0xaaaaaaaa;
-
-       for (p = pstart; p < pend; p++) {
-               if (*p != 0xaaaaaaaa) {
-                       printf("SDRAM test fails at: %08x\n", (uint) p);
-                       return 1;
-               }
-       }
-
-       for (p = pstart; p < pend; p++)
-               *p = 0x55555555;
-
-       for (p = pstart; p < pend; p++) {
-               if (*p != 0x55555555) {
-                       printf("SDRAM test fails at: %08x\n", (uint) p);
-                       return 1;
-               }
-       }
-       return 0;
-}
-#endif
-
 #if !defined(CONFIG_SPD_EEPROM)
 /*************************************************************************
  *  fixed sdram init -- doesn't use serial presence detect.
index 193083fd4606fa3284c414f1602c9c086e1ddb10..3a0b18f30dc8517020c5c2f73c90e40853af9dfa 100644 (file)
@@ -258,36 +258,6 @@ u32 ddr_clktr(u32 default_val) {
        return (SDRAM_CLKTR_CLKP_90_DEG_ADV);
 }
 
-#if defined(CFG_DRAM_TEST)
-int testdram (void)
-{
-       uint *pstart = (uint *) 0x00000000;
-       uint *pend = (uint *) 0x08000000;
-       uint *p;
-
-       for (p = pstart; p < pend; p++)
-               *p = 0xaaaaaaaa;
-
-       for (p = pstart; p < pend; p++) {
-               if (*p != 0xaaaaaaaa) {
-                       printf ("SDRAM test fails at: %08x\n", (uint) p);
-                       return 1;
-               }
-       }
-
-       for (p = pstart; p < pend; p++)
-               *p = 0x55555555;
-
-       for (p = pstart; p < pend; p++) {
-               if (*p != 0x55555555) {
-                       printf ("SDRAM test fails at: %08x\n", (uint) p);
-                       return 1;
-               }
-       }
-       return 0;
-}
-#endif
-
 /*************************************************************************
  *  pci_pre_init
  *
index 39328c2bda6a29f9c7c849bd8c67c3a3770d258a..981ef3a97e848f792309e21ddcf53bf83ac47ea3 100644 (file)
@@ -25,8 +25,7 @@ include $(TOPDIR)/config.mk
 
 LIB    = $(obj)lib$(BOARD).a
 
-COBJS  = $(BOARD).o cmd_pll.o memory.o
-SOBJS  = init.o
+COBJS  = $(BOARD).o cmd_pll.o
 
 SRCS   := $(SOBJS:.o=.S) $(COBJS:.o=.c)
 OBJS   := $(addprefix $(obj),$(SOBJS) $(COBJS))
diff --git a/board/amcc/kilauea/init.S b/board/amcc/kilauea/init.S
deleted file mode 100644 (file)
index 8cd534c..0000000
+++ /dev/null
@@ -1,154 +0,0 @@
-/*
- * (C) Copyright 2007-2008
- * Stefan Roese, DENX Software Engineering, sr@denx.de.
- *
- * Based on code provided from UDTech and AMCC
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.         See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-
-#include <config.h>
-#include <ppc4xx.h>
-
-#include <ppc_asm.tmpl>
-#include <ppc_defs.h>
-
-#define mtsdram_as(reg, value)         \
-       addi    r4,0,reg        ;       \
-       mtdcr   memcfga,r4      ;       \
-       addis   r4,0,value@h    ;       \
-       ori     r4,r4,value@l   ;       \
-       mtdcr   memcfgd,r4      ;
-
-       .globl  ext_bus_cntlr_init
-ext_bus_cntlr_init:
-#if !defined(CONFIG_NAND_U_BOOT) || defined(CONFIG_NAND_SPL)
-
-       /*
-        * DDR2 setup
-        */
-
-       /* Following the DDR Core Manual, here is the initialization */
-
-       /* Step 1 */
-
-       /* Step 2 */
-
-       /* Step 3 */
-
-       /* base=00000000, size=256MByte (6), mode=7 (n*10*8) */
-       mtsdram_as(SDRAM_MB0CF, 0x00006701);
-
-       /* SET SDRAM_MB1CF - Not enabled */
-       mtsdram_as(SDRAM_MB1CF, 0x00000000);
-
-       /* SET SDRAM_MB2CF  - Not enabled */
-       mtsdram_as(SDRAM_MB2CF, 0x00000000);
-
-       /* SET SDRAM_MB3CF  - Not enabled */
-       mtsdram_as(SDRAM_MB3CF, 0x00000000);
-
-       /* SDRAM_CLKTR: Adv Addr clock by 180 deg */
-       mtsdram_as(SDRAM_CLKTR, 0x80000000);
-
-       /* Refresh Time register (0x30) Refresh every 7.8125uS */
-       mtsdram_as(SDRAM_RTR, 0x06180000);
-
-       /* SDRAM_SDTR1 */
-       mtsdram_as(SDRAM_SDTR1, 0x80201000);
-
-       /* SDRAM_SDTR2  */
-       mtsdram_as(SDRAM_SDTR2, 0x32204232);
-
-       /* SDRAM_SDTR3  */
-       mtsdram_as(SDRAM_SDTR3, 0x080b0d1a);
-
-       mtsdram_as(SDRAM_MMODE, 0x00000442);
-       mtsdram_as(SDRAM_MEMODE, 0x00000404);
-
-       /* SDRAM0_MCOPT1 (0X20) No ECC Gen */
-       mtsdram_as(SDRAM_MCOPT1, 0x04322000);
-
-       /* NOP */
-       mtsdram_as(SDRAM_INITPLR0, 0xa8380000);
-       /* precharge 3 DDR clock cycle */
-       mtsdram_as(SDRAM_INITPLR1, 0x81900400);
-       /* EMR2 twr = 2tck */
-       mtsdram_as(SDRAM_INITPLR2, 0x81020000);
-       /* EMR3  twr = 2tck */
-       mtsdram_as(SDRAM_INITPLR3, 0x81030000);
-       /* EMR DLL ENABLE twr = 2tck */
-       mtsdram_as(SDRAM_INITPLR4, 0x81010404);
-       /* MR w/ DLL reset
-        * Note: 5 is CL.  May need to be changed
-        */
-       mtsdram_as(SDRAM_INITPLR5, 0x81000542);
-       /* precharge 3 DDR clock cycle */
-       mtsdram_as(SDRAM_INITPLR6, 0x81900400);
-       /* Auto-refresh trfc = 26tck */
-       mtsdram_as(SDRAM_INITPLR7, 0x8D080000);
-       /* Auto-refresh trfc = 26tck */
-       mtsdram_as(SDRAM_INITPLR8, 0x8D080000);
-       /* Auto-refresh */
-       mtsdram_as(SDRAM_INITPLR9, 0x8D080000);
-       /* Auto-refresh */
-       mtsdram_as(SDRAM_INITPLR10, 0x8D080000);
-       /* MRS - normal operation; wait 2 cycle (set wait to tMRD) */
-       mtsdram_as(SDRAM_INITPLR11, 0x81000442);
-       mtsdram_as(SDRAM_INITPLR12, 0x81010780);
-       mtsdram_as(SDRAM_INITPLR13, 0x81010400);
-       mtsdram_as(SDRAM_INITPLR14, 0x00000000);
-       mtsdram_as(SDRAM_INITPLR15, 0x00000000);
-
-       /* SET MCIF0_CODT   Die Termination On */
-       mtsdram_as(SDRAM_CODT, 0x0080f837);
-       mtsdram_as(SDRAM_MODT0, 0x01800000);
-       mtsdram_as(SDRAM_MODT1, 0x00000000);
-
-       mtsdram_as(SDRAM_WRDTR, 0x00000000);
-
-       /* SDRAM0_MCOPT2 (0X21) Start initialization */
-       mtsdram_as(SDRAM_MCOPT2, 0x20000000);
-
-       /* Step 5 */
-       lis     r3,0x1  /* 400000 =  wait 100ms */
-       mtctr   r3
-
-pll_wait:
-       bdnz    pll_wait
-
-       /* Step 6 */
-
-       /* SDRAM_DLCR */
-       mtsdram_as(SDRAM_DLCR, 0x030000a5);
-
-       /* SDRAM_RDCC */
-       mtsdram_as(SDRAM_RDCC, 0x40000000);
-
-       /* SDRAM_RQDC */
-       mtsdram_as(SDRAM_RQDC, 0x80000038);
-
-       /* SDRAM_RFDC */
-       mtsdram_as(SDRAM_RFDC, 0x00000209);
-
-       /* Enable memory controller */
-       mtsdram_as(SDRAM_MCOPT2, 0x28000000);
-#endif /* #ifndef CONFIG_NAND_U_BOOT */
-
-       blr
diff --git a/board/amcc/kilauea/memory.c b/board/amcc/kilauea/memory.c
deleted file mode 100644 (file)
index 1d7a3fa..0000000
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * (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 <asm/processor.h>
-#include <i2c.h>
-
-void sdram_init(void)
-{
-       return;
-}
-
-long int initdram(int board_type)
-{
-       return (CFG_MBYTES_SDRAM << 20);
-}
-
-#if defined(CFG_DRAM_TEST)
-int testdram (void)
-{
-    printf ("testdram\n");
-#if defined (CONFIG_NAND_U_BOOT)
-    return 0;
-#endif
-       uint *pstart = (uint *) 0x00000000;
-       uint *pend = (uint *) 0x00001000;
-       uint *p;
-
-       for (p = pstart; p < pend; p++) {
-               *p = 0xaaaaaaaa;
-       }
-
-       for (p = pstart; p < pend; p++) {
-               if (*p != 0xaaaaaaaa) {
-#if !defined (CONFIG_NAND_SPL)
-                       printf ("SDRAM test fails at: %08x\n", (uint) p);
-#endif
-                       return 1;
-               }
-       }
-
-       for (p = pstart; p < pend; p++) {
-               *p = 0x55555555;
-       }
-
-       for (p = pstart; p < pend; p++) {
-               if (*p != 0x55555555) {
-#if !defined (CONFIG_NAND_SPL)
-                       printf ("SDRAM test fails at: %08x\n", (uint) p);
-#endif
-                       return 1;
-               }
-       }
-#if !defined (CONFIG_NAND_SPL)
-       printf ("SDRAM test passed!!!\n");
-#endif
-       return 0;
-}
-#endif
index f964511c572b23db7dfa44d1f4ee319fdcf95886..b14b6e1b5611da3cc651439957bee0b2d96936d4 100644 (file)
@@ -125,50 +125,6 @@ u32 ddr_clktr(u32 default_val) {
        return (SDRAM_CLKTR_CLKP_180_DEG_ADV);
 }
 
-/*************************************************************************
- *  int testdram()
- *
- ************************************************************************/
-#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_KBYTES_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
  *
index 39328c2bda6a29f9c7c849bd8c67c3a3770d258a..4def0d44d5090f6a17757aeb8f67fa7aa0872196 100644 (file)
@@ -25,7 +25,7 @@ include $(TOPDIR)/config.mk
 
 LIB    = $(obj)lib$(BOARD).a
 
-COBJS  = $(BOARD).o cmd_pll.o memory.o
+COBJS  = $(BOARD).o cmd_pll.o
 SOBJS  = init.o
 
 SRCS   := $(SOBJS:.o=.S) $(COBJS:.o=.c)
index 11c5b1971ed48a856555e66e53e677019eef2c53..4d0f4609e62fa701fbdd8051c0bbcaa9f90d8217 100644 (file)
@@ -1,8 +1,11 @@
 /*
+ * Copyright (c) 2008 Nuovation System Designs, LLC
+ *   Grant Erickson <gerickson@nuovations.com>
+ *
  * (C) Copyright 2007-2008
  * Stefan Roese, DENX Software Engineering, sr@denx.de.
  *
- * Based on code provided from Senao and AMCC
+ * Originally based on code provided from Senao and AMCC
  *
  * See file CREDITS for list of people who contributed to this
  * project.
  * MA 02111-1307 USA
  */
 
-#include <config.h>
-#include <ppc4xx.h>
-
-#include <ppc_asm.tmpl>
-#include <ppc_defs.h>
-
-#define mtsdram_as(reg, value)         \
-       addi    r4,0,reg        ;       \
-       mtdcr   memcfga,r4      ;       \
-       addis   r4,0,value@h    ;       \
-       ori     r4,r4,value@l   ;       \
-       mtdcr   memcfgd,r4      ;
-
        .globl  ext_bus_cntlr_init
 ext_bus_cntlr_init:
-
-       /*
-        * DDR2 setup
-        */
-
-       /* Following the DDR Core Manual, here is the initialization */
-
-       /* Step 1 */
-
-       /* Step 2 */
-
-       /* Step 3 */
-
-       /* base=00000000, size=128MByte (5), mode=2 (n*10*4) */
-       mtsdram_as(SDRAM_MB0CF, 0x00005201);
-
-       /* base=08000000, size=128MByte (5), mode=2 (n*10*4) */
-       mtsdram_as(SDRAM_MB1CF, (0x08000000 >> 3) | 0x5201);
-
-       /* SDRAM_CLKTR: Adv Addr clock by 180 deg */
-       mtsdram_as(SDRAM_CLKTR,0x80000000);
-
-       /* Refresh Time register (0x30) Refresh every 7.8125uS */
-       mtsdram_as(SDRAM_RTR, 0x06180000);
-
-       /* SDRAM_SDTR1 */
-       mtsdram_as(SDRAM_SDTR1, 0x80201000);
-
-       /* SDRAM_SDTR2  */
-       mtsdram_as(SDRAM_SDTR2, 0x32204232);
-
-       /* SDRAM_SDTR3  */
-       mtsdram_as(SDRAM_SDTR3, 0x080b0d1a);
-
-       mtsdram_as(SDRAM_MMODE, 0x00000442);
-       mtsdram_as(SDRAM_MEMODE, 0x00000404);
-
-       /* SDRAM0_MCOPT1 (0X20) No ECC Gen */
-       mtsdram_as(SDRAM_MCOPT1, 0x04322000);
-
-       /* NOP */
-       mtsdram_as(SDRAM_INITPLR0, 0xa8380000);
-       /* precharge 3 DDR clock cycle */
-       mtsdram_as(SDRAM_INITPLR1, 0x81900400);
-       /* EMR2 twr = 2tck */
-       mtsdram_as(SDRAM_INITPLR2, 0x81020000);
-       /* EMR3  twr = 2tck */
-       mtsdram_as(SDRAM_INITPLR3, 0x81030000);
-       /* EMR DLL ENABLE twr = 2tck */
-       mtsdram_as(SDRAM_INITPLR4, 0x81010404);
-       /* MR w/ DLL reset
-        * Note: 5 is CL.  May need to be changed
-        */
-       mtsdram_as(SDRAM_INITPLR5, 0x81000542);
-       /* precharge 3 DDR clock cycle */
-       mtsdram_as(SDRAM_INITPLR6, 0x81900400);
-       /* Auto-refresh trfc = 26tck */
-       mtsdram_as(SDRAM_INITPLR7, 0x8D080000);
-       /* Auto-refresh trfc = 26tck */
-       mtsdram_as(SDRAM_INITPLR8, 0x8D080000);
-       /* Auto-refresh */
-       mtsdram_as(SDRAM_INITPLR9, 0x8D080000);
-       /* Auto-refresh */
-       mtsdram_as(SDRAM_INITPLR10, 0x8D080000);
-       /* MRS - normal operation; wait 2 cycle (set wait to tMRD) */
-       mtsdram_as(SDRAM_INITPLR11, 0x81000442);
-       mtsdram_as(SDRAM_INITPLR12, 0x81010780);
-       mtsdram_as(SDRAM_INITPLR13, 0x81010400);
-       mtsdram_as(SDRAM_INITPLR14, 0x00000000);
-       mtsdram_as(SDRAM_INITPLR15, 0x00000000);
-
-       /* SET MCIF0_CODT   Die Termination On */
-       mtsdram_as(SDRAM_CODT, 0x0080f837);
-       mtsdram_as(SDRAM_MODT0, 0x01800000);
-#if 0 /* test-only: not sure if 0 is ok when 2nd bank is used */
-       mtsdram_as(SDRAM_MODT1, 0x00000000);
-#endif
-
-       mtsdram_as(SDRAM_WRDTR, 0x00000000);
-
-       /* SDRAM0_MCOPT2 (0X21) Start initialization */
-       mtsdram_as(SDRAM_MCOPT2, 0x20000000);
-
-       /* Step 5 */
-       lis     r3,0x1  /* 400000 =  wait 100ms */
-       mtctr   r3
-
-pll_wait:
-       bdnz    pll_wait
-
-       /* Step 6 */
-
-       /* SDRAM_DLCR */
-       mtsdram_as(SDRAM_DLCR, 0x030000a5);
-
-       /* SDRAM_RDCC */
-       mtsdram_as(SDRAM_RDCC, 0x40000000);
-
-       /* SDRAM_RQDC */
-       mtsdram_as(SDRAM_RQDC, 0x80000038);
-
-       /* SDRAM_RFDC */
-       mtsdram_as(SDRAM_RFDC, 0x00000209);
-
-       /* Enable memory controller */
-       mtsdram_as(SDRAM_MCOPT2, 0x28000000);
-
        blr
diff --git a/board/amcc/makalu/memory.c b/board/amcc/makalu/memory.c
deleted file mode 100644 (file)
index b03b60b..0000000
+++ /dev/null
@@ -1,188 +0,0 @@
-/*
- * (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 <asm/processor.h>
-
-void sdram_init(void)
-{
-       return;
-}
-
-long int initdram(int board_type)
-{
-       /*
-        * Same as on Kilauea, Makalu generates exception 0x200
-        * (machine check) after trap_init() in board_init_f,
-        * when SDRAM is initialized here (late) and d-cache is
-        * used earlier as INIT_RAM.
-        * So for now, initialize DDR2 in init.S very early and
-        * also use it for INIT_RAM. Then this exception doesn't
-        * occur.
-        */
-#if 0
-       u32 val;
-
-       /* base=00000000, size=128MByte (5), mode=2 (n*10*4) */
-       mtsdram(SDRAM_MB0CF, 0x00005201);
-
-       /* SET SDRAM_MB1CF - Not enabled */
-       mtsdram(SDRAM_MB1CF, 0x00000000);
-
-       /* SET SDRAM_MB2CF  - Not enabled */
-       mtsdram(SDRAM_MB2CF, 0x00000000);
-
-       /* SET SDRAM_MB3CF  - Not enabled */
-       mtsdram(SDRAM_MB3CF, 0x00000000);
-
-       /* SDRAM_CLKTR: Adv Addr clock by 90 deg */
-       mtsdram(SDRAM_CLKTR, 0x80000000);
-
-       /* Refresh Time register (0x30) Refresh every 7.8125uS */
-       mtsdram(SDRAM_RTR, 0x06180000);
-
-       /* SDRAM_SDTR1 */
-       mtsdram(SDRAM_SDTR1, 0x80201000);
-
-       /* SDRAM_SDTR2  */
-       mtsdram(SDRAM_SDTR2, 0x32204232);
-
-       /* SDRAM_SDTR3  */
-       mtsdram(SDRAM_SDTR3, 0x080b0d1a);
-
-       mtsdram(SDRAM_MMODE, 0x00000442);
-       mtsdram(SDRAM_MEMODE, 0x00000404);
-
-       /* SDRAM0_MCOPT1 (0X20) No ECC Gen */
-       mtsdram(SDRAM_MCOPT1, 0x04322000);
-
-       /* NOP */
-       mtsdram(SDRAM_INITPLR0, 0xa8380000);
-       /* precharge 3 DDR clock cycle */
-       mtsdram(SDRAM_INITPLR1, 0x81900400);
-       /* EMR2 twr = 2tck */
-       mtsdram(SDRAM_INITPLR2, 0x81020000);
-       /* EMR3  twr = 2tck */
-       mtsdram(SDRAM_INITPLR3, 0x81030000);
-       /* EMR DLL ENABLE twr = 2tck */
-       mtsdram(SDRAM_INITPLR4, 0x81010404);
-       /* MR w/ DLL reset
-        * Note: 5 is CL.  May need to be changed
-        */
-       mtsdram(SDRAM_INITPLR5, 0x81000542);
-       /* precharge 3 DDR clock cycle */
-       mtsdram(SDRAM_INITPLR6, 0x81900400);
-       /* Auto-refresh trfc = 26tck */
-       mtsdram(SDRAM_INITPLR7, 0x8D080000);
-       /* Auto-refresh trfc = 26tck */
-       mtsdram(SDRAM_INITPLR8, 0x8D080000);
-       /* Auto-refresh */
-       mtsdram(SDRAM_INITPLR9, 0x8D080000);
-       /* Auto-refresh */
-       mtsdram(SDRAM_INITPLR10, 0x8D080000);
-       /* MRS - normal operation; wait 2 cycle (set wait to tMRD) */
-       mtsdram(SDRAM_INITPLR11, 0x81000442);
-       mtsdram(SDRAM_INITPLR12, 0x81010780);
-       mtsdram(SDRAM_INITPLR13, 0x81010400);
-       mtsdram(SDRAM_INITPLR14, 0x00000000);
-       mtsdram(SDRAM_INITPLR15, 0x00000000);
-
-       /* SET MCIF0_CODT   Die Termination On */
-       mtsdram(SDRAM_CODT, 0x0080f837);
-       mtsdram(SDRAM_MODT0, 0x01800000);
-       mtsdram(SDRAM_MODT1, 0x00000000);
-
-       mtsdram(SDRAM_WRDTR, 0x00000000);
-
-       /* SDRAM0_MCOPT2 (0X21) Start initialization */
-       mtsdram(SDRAM_MCOPT2, 0x20000000);
-
-       /* Step 5 */
-       do {
-               mfsdram(SDRAM_MCSTAT, val);
-       } while ((val & SDRAM_MCSTAT_MIC_COMP) != SDRAM_MCSTAT_MIC_COMP);
-
-       /* Step 6 */
-
-       /* SDRAM_DLCR */
-       mtsdram(SDRAM_DLCR, 0x030000a5);
-
-       /* SDRAM_RDCC */
-       mtsdram(SDRAM_RDCC, 0x40000000);
-
-       /* SDRAM_RQDC */
-       mtsdram(SDRAM_RQDC, 0x80000038);
-
-       /* SDRAM_RFDC */
-       mtsdram(SDRAM_RFDC, 0x00000209);
-
-       /* Enable memory controller */
-       mfsdram(SDRAM_MCOPT2, val);
-       val |= SDRAM_MCOPT2_DCEN_ENABLE;
-       mtsdram(SDRAM_MCOPT2, val);
-#endif
-       return (CFG_MBYTES_SDRAM << 20);
-}
-
-#if defined(CFG_DRAM_TEST)
-int testdram (void)
-{
-    printf ("testdram\n");
-#if defined (CONFIG_NAND_U_BOOT)
-    return 0;
-#endif
-       uint *pstart = (uint *) 0x00000000;
-       uint *pend = (uint *) 0x00001000;
-       uint *p;
-
-       for (p = pstart; p < pend; p++) {
-               *p = 0xaaaaaaaa;
-       }
-
-       for (p = pstart; p < pend; p++) {
-               if (*p != 0xaaaaaaaa) {
-#if !defined (CONFIG_NAND_SPL)
-                       printf ("SDRAM test fails at: %08x\n", (uint) p);
-#endif
-                       return 1;
-               }
-       }
-
-       for (p = pstart; p < pend; p++) {
-               *p = 0x55555555;
-       }
-
-       for (p = pstart; p < pend; p++) {
-               if (*p != 0x55555555) {
-#if !defined (CONFIG_NAND_SPL)
-                       printf ("SDRAM test fails at: %08x\n", (uint) p);
-#endif
-                       return 1;
-               }
-       }
-#if !defined (CONFIG_NAND_SPL)
-       printf ("SDRAM test passed!!!\n");
-#endif
-       return 0;
-}
-#endif
index 3bd1b81400644515502e487ae4dd8a686b2f0a9a..79c1a1b496d86981f40f1742617345a02198765a 100644 (file)
@@ -214,36 +214,6 @@ long int initdram (int board_type)
 }
 
 
-#if defined(CFG_DRAM_TEST)
-int testdram (void)
-{
-       uint *pstart = (uint *) 0x00000000;
-       uint *pend = (uint *) 0x08000000;
-       uint *p;
-
-       for (p = pstart; p < pend; p++)
-               *p = 0xaaaaaaaa;
-
-       for (p = pstart; p < pend; p++) {
-               if (*p != 0xaaaaaaaa) {
-                       printf ("SDRAM test fails at: %08x\n", (uint) p);
-                       return 1;
-               }
-       }
-
-       for (p = pstart; p < pend; p++)
-               *p = 0x55555555;
-
-       for (p = pstart; p < pend; p++) {
-               if (*p != 0x55555555) {
-                       printf ("SDRAM test fails at: %08x\n", (uint) p);
-                       return 1;
-               }
-       }
-       return 0;
-}
-#endif
-
 #if !defined(CONFIG_SPD_EEPROM)
 /*************************************************************************
  *  fixed sdram init -- doesn't use serial presence detect.
index e62b8d30e41e09d70481af20dc1c294b02e69c20..5e04ee4e369464e11aae6177dc88155a53d4313b 100644 (file)
@@ -28,6 +28,10 @@ sinclude $(OBJTREE)/board/$(BOARDDIR)/config.tmp
 
 ifndef TEXT_BASE
 TEXT_BASE = 0xFFFA0000
+#
+# When defining CONFIG_VIDEO, TEXT_BASE needs to be 0xFFF80000
+# TEXT_BASE = 0xFFF80000
+#
 endif
 
 PLATFORM_CPPFLAGS += -DCONFIG_440=1
index 6bcb3ab198141a1e9b62e9db974e1789e268cf97..5ff9787d3d769deb2f4c9692636284fade2c35a5 100644 (file)
@@ -329,44 +329,6 @@ int checkboard(void)
        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
-
 #if defined(CONFIG_PCI) && defined(CONFIG_PCI_PNP)
 /*
  * Assign interrupts to PCI devices.
index 891b4d924980fc6d8fbf3919198b5899b06b79ec..e4fdf4ae74ab9463ef4f6bcdfc9308cd9d661606 100644 (file)
@@ -200,45 +200,3 @@ int pci_pre_init(struct pci_controller *hose)
        return 1;
 }
 #endif /* CONFIG_PCI */
-
-#ifdef CFG_DRAM_TEST
-int testdram(void)
-{
-       unsigned long *mem = (unsigned long *)0;
-       const unsigned long kend = (1024 / sizeof(unsigned long));
-       unsigned long k, n;
-       unsigned long msr;
-       unsigned long total_kbytes = CFG_SDRAM_SIZE_PER_BANK * CFG_SDRAM_BANKS / 1024;
-
-       msr = mfmsr();
-       mtmsr(msr & ~(MSR_EE));
-
-       for (k = 0; k < total_kbytes ;
-            ++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");
-       mtmsr(msr);
-
-       return 0;
-}
-#endif /* CFG_DRAM_TEST */
index f00397ed197936d00d69e3cf56b5cbca7570ea91..b6c306539e40752f6f2984102d08e528f768129f 100644 (file)
@@ -196,36 +196,6 @@ int checkboard (void)
        return (0);
 }
 
-#if defined(CFG_DRAM_TEST)
-int testdram (void)
-{
-       uint *pstart = (uint *) 0x04000000;
-       uint *pend = (uint *) 0x0fc00000;
-       uint *p;
-
-       for (p = pstart; p < pend; p++)
-               *p = 0xaaaaaaaa;
-
-       for (p = pstart; p < pend; p++) {
-               if (*p != 0xaaaaaaaa) {
-                       printf ("SDRAM test fails at: %08x\n", (uint) p);
-                       return 1;
-               }
-       }
-
-       for (p = pstart; p < pend; p++)
-               *p = 0x55555555;
-
-       for (p = pstart; p < pend; p++) {
-               if (*p != 0x55555555) {
-                       printf ("SDRAM test fails at: %08x\n", (uint) p);
-                       return 1;
-               }
-       }
-       return 0;
-}
-#endif
-
 /*************************************************************************
  *  pci_pre_init
  *
index 292e02609e2380847ef92e2493d6b4dab4ff144b..641987e871ce0bbaca92a3461d0067190763b4a0 100644 (file)
@@ -85,14 +85,6 @@ int checkboard(void)
        return (0);
 }
 
-/*
- * sdram_init - Dummy implementation for start.S, spd_sdram used on this board!
- */
-void sdram_init(void)
-{
-       return;
-}
-
 /*
  * initdram(int board_type) reads EEPROM via I2c. EEPROM contains all of
  * the necessary info for SDRAM controller configuration
@@ -101,11 +93,3 @@ long int initdram(int board_type)
 {
        return spd_sdram();
 }
-
-int testdram(void)
-{
-       /* TODO: XXX XXX XXX */
-       printf("test: xxx MB - ok\n");
-
-       return (0);
-}
index 212fab8d08edbfb938d3e15934f248108c025855..83455375def6c5831261e7c82291ced16b664f2e 100644 (file)
@@ -200,7 +200,7 @@ int checkboard(void)
 }
 
 /*************************************************************************
- *  sdram_init -- doesn't use serial presence detect.
+ *  initdram -- doesn't use serial presence detect.
  *
  *  Assumes:    256 MB, ECC, non-registered
  *              PLB @ 133 MHz
@@ -281,7 +281,7 @@ void sdram_tr1_set(int ram_address, int* tr1_value)
        *tr1_value = (first_good + last_bad) / 2;
 }
 
-void sdram_init(void)
+long int initdram(int board)
 {
        register uint reg;
        int tr1_bank1, tr1_bank2;
@@ -327,57 +327,11 @@ void sdram_init(void)
 
        sdram_tr1_set(0x00000000, &tr1_bank1);
        sdram_tr1_set(0x08000000, &tr1_bank2);
-       mtsdram(mem_tr1, (((tr1_bank1+tr1_bank2)/2) | 0x80800800) );
-}
+       mtsdram(mem_tr1, (((tr1_bank1+tr1_bank2)/2) | 0x80800800));
 
-/*************************************************************************
- *  long int initdram
- *
- ************************************************************************/
-long int initdram(int board)
-{
-       sdram_init();
        return CFG_SDRAM_BANKS * (CFG_KBYTES_SDRAM * 1024);     /* return bytes */
 }
 
-#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_KBYTES_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
  *
index 11d1743355c7fc7e81ae275f9731a48105b7e4bd..6608893651b22727b713b983d1f3d79268b527d8 100644 (file)
@@ -586,36 +586,6 @@ u32 ddr_clktr(u32 default_val) {
        return default_val;
 }
 
-#if defined(CFG_DRAM_TEST)
-int testdram (void)
-{
-       uint *pstart = (uint *) 0x00000000;
-       uint *pend = (uint *) 0x08000000;
-       uint *p;
-
-       for (p = pstart; p < pend; p++)
-               *p = 0xaaaaaaaa;
-
-       for (p = pstart; p < pend; p++) {
-               if (*p != 0xaaaaaaaa) {
-                       printf ("SDRAM test fails at: %08x\n", (uint) p);
-                       return 1;
-               }
-       }
-
-       for (p = pstart; p < pend; p++)
-               *p = 0x55555555;
-
-       for (p = pstart; p < pend; p++) {
-               if (*p != 0x55555555) {
-                       printf ("SDRAM test fails at: %08x\n", (uint) p);
-                       return 1;
-               }
-       }
-       return 0;
-}
-#endif
-
 /*************************************************************************
  *  pci_pre_init
  *
index 3aaa5c2f1a59a95ec7f2f3b3081a67c812265711..65f13e17a6406a3e64c262d7557e88c8fa53b965 100644 (file)
@@ -28,7 +28,3 @@
        .globl  ext_bus_cntlr_init
 ext_bus_cntlr_init:
        blr
-
-       .globl  sdram_init
-sdram_init:
-       blr
index 3606cbb52f4d5006992b0172b6483865a73c17a1..b66fd7b29703e34a4b2e488474144cbcc1e22957 100644 (file)
  */
 
 struct law_entry law_table[] = {
-       SET_LAW_ENTRY(2, CFG_PCI1_MEM_PHYS, LAW_SIZE_512M, LAW_TRGT_IF_PCI_1),
-       SET_LAW_ENTRY(3, CFG_PCI1_IO_PHYS, LAWAR_SIZE_1M, LAW_TRGT_IF_PCI_1),
-       SET_LAW_ENTRY(4, CFG_PCI2_MEM_PHYS, LAW_SIZE_512M, LAW_TRGT_IF_PCI_2),
-       SET_LAW_ENTRY(5, CFG_PCI2_IO_PHYS, LAW_SIZE_1M, LAW_TRGT_IF_PCI_2),
-       SET_LAW_ENTRY(6, CFG_PCIE1_MEM_PHYS, LAW_SIZE_512M, LAW_TRGT_IF_PCIE_1),
-       SET_LAW_ENTRY(7, CFG_PCIE1_IO_PHYS, LAW_SIZE_1M, LAW_TRGT_IF_PCIE_1),
+       SET_LAW(CFG_PCI1_MEM_PHYS, LAW_SIZE_512M, LAW_TRGT_IF_PCI_1),
+       SET_LAW(CFG_PCI1_IO_PHYS, LAWAR_SIZE_1M, LAW_TRGT_IF_PCI_1),
+       SET_LAW(CFG_PCI2_MEM_PHYS, LAW_SIZE_512M, LAW_TRGT_IF_PCI_2),
+       SET_LAW(CFG_PCI2_IO_PHYS, LAW_SIZE_1M, LAW_TRGT_IF_PCI_2),
+       SET_LAW(CFG_PCIE1_MEM_PHYS, LAW_SIZE_512M, LAW_TRGT_IF_PCIE_1),
+       SET_LAW(CFG_PCIE1_IO_PHYS, LAW_SIZE_1M, LAW_TRGT_IF_PCIE_1),
        /* LBC window - maps 256M 0xf0000000 -> 0xffffffff */
-       SET_LAW_ENTRY(8, CFG_LBC_CACHE_BASE, LAW_SIZE_256M, LAW_TRGT_IF_LBC),
+       SET_LAW(CFG_LBC_CACHE_BASE, LAW_SIZE_256M, LAW_TRGT_IF_LBC),
 };
 
 int num_law_entries = ARRAY_SIZE(law_table);
index 72a10d3a1bf499f5892726b77698167dad062d79..4b6b3f400303bb1fdb7803debc49a80081eb4847 100644 (file)
@@ -134,14 +134,3 @@ ext_bus_cntlr_init:
        mtdcr   ebccfgd,r4
 
        blr
-
-/*----------------------------------------------------------------------------- */
-/* Function:   sdram_init */
-/* Description:        Configures SDRAM memory banks. */
-/*                             NOTE: for CrayL1 we have ECC memory, so enable it. */
-/*....now done in C in L1.c:init_sdram for readability. */
-/*----------------------------------------------------------------------------- */
-       .globl  sdram_init
-
-sdram_init:
- blr
index 24c6f0d9869f6940f563398f361ab1aae9a85c0e..640412d10d1bb3d7ba5e694d2ce6890a2076fba9 100644 (file)
@@ -27,6 +27,8 @@
 #include <miiphy.h>
 #include <ppc4xx_enet.h>
 
+void sdram_init(void);
+
 /*
  * Configuration data for AMIS FS6377-01 Programmable 3-PLL Clock Generator
  *
@@ -124,6 +126,13 @@ long initdram (int board_type)
        ulong bank_size;
        ulong tmp;
 
+       /*
+        * ToDo: Move the asm init routine sdram_init() to this C file,
+        * or even better use some common ppc4xx code available
+        * in cpu/ppc4xx
+        */
+       sdram_init();
+
        tot_size = 0;
 
        mtdcr (memcfga, mem_mb0cf);
index 833bbce923d90859f818d76fefcc1b985a82fad6..1fbf17f9441aada8eec3675e4aa9338642fb1a8f 100644 (file)
@@ -27,6 +27,8 @@
 #include <miiphy.h>
 #include <ppc4xx_enet.h>
 
+void sdram_init(void);
+
 /*
  * board_early_init_f: do early board initialization
  *
@@ -92,6 +94,13 @@ long initdram (int board_type)
        ulong bank_size;
        ulong tmp;
 
+       /*
+        * ToDo: Move the asm init routine sdram_init() to this C file,
+        * or even better use some common ppc4xx code available
+        * in cpu/ppc4xx
+        */
+       sdram_init();
+
        tot_size = 0;
 
        mtdcr (memcfga, mem_mb0cf);
index 5413ae15c75e24d12b6fd78d3eade2ab4f235c82..14ba9b0a4132d9f1dc81b3b4bdba0946a8f30a06 100644 (file)
@@ -31,6 +31,8 @@
 #define PPC405GP_GPIO0_ODR     0xef600718      /* GPIO Open Drain */
 #define PPC405GP_GPIO0_IR      0xef60071c      /* GPIO Input */
 
+void sdram_init(void);
+
 int board_early_init_f (void)
 {
 
@@ -127,6 +129,12 @@ long int initdram (int board_type)
        int TotalSize;
 #endif
 
+       /*
+        * ToDo: Move the asm init routine sdram_init() to this C file,
+        * or even better use some common ppc4xx code available
+        * in cpu/ppc4xx
+        */
+       sdram_init();
 
 #ifdef CONFIG_ERIC
        /*
index dfead3363c208a0eb95068cb1f41fb7f40f23335..3abcfe690e9a2ee584d8ca238064a319932a1681 100644 (file)
@@ -190,28 +190,6 @@ int checkboard (void)
        return 0;
 }
 
-/* ------------------------------------------------------------------------- */
-
-long int initdram (int board_type)
-{
-       unsigned long val;
-
-       mtdcr(memcfga, mem_mb0cf);
-       val = mfdcr(memcfgd);
-
-       return (4*1024*1024 << ((val & 0x000e0000) >> 17));
-}
-
-/* ------------------------------------------------------------------------- */
-
-int testdram (void)
-{
-       /* TODO: XXX XXX XXX */
-       printf ("test: 16 MB - ok\n");
-
-       return (0);
-}
-
 
 #if 1 /* test-only: some internal test routines... */
 /*
index 055a39773061ac05cb8839d07b4d8d1a0430e701..30fa605abb62ae5bce1468f7bc7b299d60c752a3 100644 (file)
@@ -181,22 +181,3 @@ int checkboard (void)
 
        return 0;
 }
-
-/* ------------------------------------------------------------------------- */
-
-long int initdram (int board_type)
-{
-       return (16 * 1024 * 1024);
-}
-
-/* ------------------------------------------------------------------------- */
-
-int testdram (void)
-{
-       /* TODO: XXX XXX XXX */
-       printf ("test: 16 MB - ok\n");
-
-       return (0);
-}
-
-/* ------------------------------------------------------------------------- */
index 39a97225f8c615e750cfcea5d72670aa2f2110ac..49031cfce6660b62e26cc40551c81a024157be5b 100644 (file)
@@ -3,6 +3,8 @@
 #include <common.h>
 #include "exbitgen.h"
 
+void sdram_init(void);
+
 /* ************************************************************************ */
 int board_early_init_f (void)
 /* ------------------------------------------------------------------------ --
@@ -83,6 +85,13 @@ long int initdram (int board_type)
        ulong bank_size;
        ulong tmp;
 
+       /*
+        * ToDo: Move the asm init routine sdram_init() to this C file,
+        * or even better use some common ppc4xx code available
+        * in cpu/ppc4xx
+        */
+       sdram_init();
+
        tot_size = 0;
 
        mtdcr (memcfga, mem_mb0cf);
index 785576a35a709539f108e6e511bd709eb11e1d9e..3b8bd05ad122565198fbc1bb1c4bf26022ab81d3 100644 (file)
 
 struct law_entry law_table[] = {
 #ifndef CONFIG_SPD_EEPROM
-       SET_LAW_ENTRY(1, CFG_DDR_SDRAM_BASE, LAW_SIZE_128M, LAW_TRGT_IF_DDR),
+       SET_LAW(CFG_DDR_SDRAM_BASE, LAW_SIZE_128M, LAW_TRGT_IF_DDR),
 #endif
-       SET_LAW_ENTRY(2, CFG_PCI1_MEM_PHYS, LAW_SIZE_512M, LAW_TRGT_IF_PCI),
+       SET_LAW(CFG_PCI1_MEM_PHYS, LAW_SIZE_512M, LAW_TRGT_IF_PCI),
        /* This is not so much the SDRAM map as it is the whole localbus map. */
-       SET_LAW_ENTRY(3, CFG_LBC_SDRAM_BASE, LAW_SIZE_256M, LAW_TRGT_IF_LBC),
-       SET_LAW_ENTRY(4, CFG_PCI1_IO_PHYS, LAW_SIZE_1M, LAW_TRGT_IF_PCI),
-       SET_LAW_ENTRY(5, CFG_RIO_MEM_BASE, LAWAR_SIZE_512M, LAW_TRGT_IF_RIO),
+       SET_LAW(CFG_LBC_SDRAM_BASE, LAW_SIZE_256M, LAW_TRGT_IF_LBC),
+       SET_LAW(CFG_PCI1_IO_PHYS, LAW_SIZE_1M, LAW_TRGT_IF_PCI),
+       SET_LAW(CFG_RIO_MEM_BASE, LAWAR_SIZE_512M, LAW_TRGT_IF_RIO),
 };
 
 int num_law_entries = ARRAY_SIZE(law_table);
index a951b9e9a32514c8b2f40da9c4cebd397b0cce1b..051f98570f815f5bfaa3f55d9ffc1941a184e96e 100644 (file)
@@ -41,12 +41,6 @@ void local_bus_init(void);
 void sdram_init(void);
 long int fixed_sdram(void);
 
-
-int board_early_init_f (void)
-{
-    return 0;
-}
-
 int checkboard (void)
 {
        puts("Board: ADS\n");
@@ -230,42 +224,6 @@ sdram_init(void)
        udelay(100);
 }
 
-
-#if defined(CFG_DRAM_TEST)
-int testdram (void)
-{
-       uint *pstart = (uint *) CFG_MEMTEST_START;
-       uint *pend = (uint *) CFG_MEMTEST_END;
-       uint *p;
-
-       printf("SDRAM test phase 1:\n");
-       for (p = pstart; p < pend; p++)
-               *p = 0xaaaaaaaa;
-
-       for (p = pstart; p < pend; p++) {
-               if (*p != 0xaaaaaaaa) {
-                       printf ("SDRAM test fails at: %08x\n", (uint) p);
-                       return 1;
-               }
-       }
-
-       printf("SDRAM test phase 2:\n");
-       for (p = pstart; p < pend; p++)
-               *p = 0x55555555;
-
-       for (p = pstart; p < pend; p++) {
-               if (*p != 0x55555555) {
-                       printf ("SDRAM test fails at: %08x\n", (uint) p);
-                       return 1;
-               }
-       }
-
-       printf("SDRAM test passed.\n");
-       return 0;
-}
-#endif
-
-
 #if !defined(CONFIG_SPD_EEPROM)
 /*************************************************************************
  *  fixed sdram init -- doesn't use serial presence detect.
index 0ac223c53c0c17355906c2bab2b46148f325acde..fbf2bdc07f7fa8e4a9e8fcb47b137d06abff19d3 100644 (file)
  */
 
 struct law_entry law_table[] = {
-       SET_LAW_ENTRY(2, CFG_PCI1_MEM_PHYS, LAW_SIZE_512M, LAW_TRGT_IF_PCI),
-       SET_LAW_ENTRY(3, CFG_PCI2_MEM_PHYS, LAW_SIZE_512M, LAW_TRGT_IF_PCI_2),
-       SET_LAW_ENTRY(4, CFG_PCI1_IO_PHYS, LAW_SIZE_1M, LAW_TRGT_IF_PCI),
-       SET_LAW_ENTRY(5, CFG_PCI2_IO_PHYS, LAW_SIZE_1M, LAW_TRGT_IF_PCI_2),
+       SET_LAW(CFG_PCI1_MEM_PHYS, LAW_SIZE_512M, LAW_TRGT_IF_PCI),
+       SET_LAW(CFG_PCI2_MEM_PHYS, LAW_SIZE_512M, LAW_TRGT_IF_PCI_2),
+       SET_LAW(CFG_PCI1_IO_PHYS, LAW_SIZE_1M, LAW_TRGT_IF_PCI),
+       SET_LAW(CFG_PCI2_IO_PHYS, LAW_SIZE_1M, LAW_TRGT_IF_PCI_2),
        /* LBC window - maps 256M 0xf0000000 -> 0xffffffff */
-       SET_LAW_ENTRY(6, CFG_LBC_SDRAM_BASE, LAW_SIZE_256M, LAW_TRGT_IF_LBC),
+       SET_LAW(CFG_LBC_SDRAM_BASE, LAW_SIZE_256M, LAW_TRGT_IF_LBC),
 };
 
 int num_law_entries = ARRAY_SIZE(law_table);
index 62c8d63cdcf709d6eb6c1d4e9bfb4b74c755478d..420a89ab1fd56624717ae51a3cc0e8d1c471efdd 100644 (file)
@@ -196,11 +196,6 @@ const iop_conf_t iop_conf_tab[4][32] = {
     }
 };
 
-int board_early_init_f (void)
-{
-       return 0;
-}
-
 int checkboard (void)
 {
        volatile ccsr_gur_t *gur = (void *)(CFG_MPC85xx_GUTS_ADDR);
@@ -425,45 +420,6 @@ sdram_init(void)
 #endif /* enable SDRAM init */
 }
 
-#if defined(CFG_DRAM_TEST)
-int
-testdram(void)
-{
-       uint *pstart = (uint *) CFG_MEMTEST_START;
-       uint *pend = (uint *) CFG_MEMTEST_END;
-       uint *p;
-
-       printf("Testing DRAM from 0x%08x to 0x%08x\n",
-              CFG_MEMTEST_START,
-              CFG_MEMTEST_END);
-
-       printf("DRAM test phase 1:\n");
-       for (p = pstart; p < pend; p++)
-               *p = 0xaaaaaaaa;
-
-       for (p = pstart; p < pend; p++) {
-               if (*p != 0xaaaaaaaa) {
-                       printf ("DRAM test fails at: %08x\n", (uint) p);
-                       return 1;
-               }
-       }
-
-       printf("DRAM test phase 2:\n");
-       for (p = pstart; p < pend; p++)
-               *p = 0x55555555;
-
-       for (p = pstart; p < pend; p++) {
-               if (*p != 0x55555555) {
-                       printf ("DRAM test fails at: %08x\n", (uint) p);
-                       return 1;
-               }
-       }
-
-       printf("DRAM test passed.\n");
-       return 0;
-}
-#endif
-
 #if defined(CONFIG_PCI)
 /* For some reason the Tundra PCI bridge shows up on itself as a
  * different device.  Work around that by refusing to configure it.
index 433e509fc02c2f04e3728269d7b10a111845ff83..a82dedea3b41da70c33cb57be8d7fe9d74d7f9b3 100644 (file)
 #include <asm/mmu.h>
 
 struct law_entry law_table[] = {
-       SET_LAW_ENTRY(2, CFG_PCI1_MEM_PHYS, LAW_SIZE_512M, LAW_TRGT_IF_PCI),
-       SET_LAW_ENTRY(3, CFG_PCI1_IO_PHYS, LAW_SIZE_64K, LAW_TRGT_IF_PCI),
-       SET_LAW_ENTRY(4, CFG_LBC_CACHE_BASE, LAWAR_SIZE_256M, LAW_TRGT_IF_LBC),
-       SET_LAW_ENTRY(5, CFG_PCIE1_MEM_PHYS, LAWAR_SIZE_256M, LAW_TRGT_IF_PCIE_1),
-       SET_LAW_ENTRY(6, CFG_PCIE1_IO_PHYS, LAW_SIZE_64K, LAW_TRGT_IF_PCIE_1),
-       SET_LAW_ENTRY(7, CFG_PCIE2_MEM_PHYS, LAWAR_SIZE_512M, LAW_TRGT_IF_PCIE_2),
-       SET_LAW_ENTRY(8, CFG_PCIE2_IO_PHYS, LAW_SIZE_64K, LAW_TRGT_IF_PCIE_2),
+       SET_LAW(CFG_PCI1_MEM_PHYS, LAW_SIZE_512M, LAW_TRGT_IF_PCI),
+       SET_LAW(CFG_PCI1_IO_PHYS, LAW_SIZE_64K, LAW_TRGT_IF_PCI),
+       SET_LAW(CFG_LBC_CACHE_BASE, LAWAR_SIZE_256M, LAW_TRGT_IF_LBC),
+       SET_LAW(CFG_PCIE1_MEM_PHYS, LAWAR_SIZE_256M, LAW_TRGT_IF_PCIE_1),
+       SET_LAW(CFG_PCIE1_IO_PHYS, LAW_SIZE_64K, LAW_TRGT_IF_PCIE_1),
+       SET_LAW(CFG_PCIE2_MEM_PHYS, LAWAR_SIZE_512M, LAW_TRGT_IF_PCIE_2),
+       SET_LAW(CFG_PCIE2_IO_PHYS, LAW_SIZE_64K, LAW_TRGT_IF_PCIE_2),
        /* contains both PCIE3 MEM & IO space */
-       SET_LAW_ENTRY(9, CFG_PCIE3_MEM_PHYS, LAW_SIZE_4M, LAW_TRGT_IF_PCIE_3),
+       SET_LAW(CFG_PCIE3_MEM_PHYS, LAW_SIZE_4M, LAW_TRGT_IF_PCIE_3),
 };
 
 int num_law_entries = ARRAY_SIZE(law_table);
index dd10af8092e0e1a4887e77bf6efe351ceb6870a0..5041426edca5fe10131cf36232cff66ca5b61f74 100644 (file)
@@ -40,11 +40,6 @@ extern void ddr_enable_ecc(unsigned int dram_size);
 
 void sdram_init(void);
 
-int board_early_init_f (void)
-{
-       return 0;
-}
-
 int checkboard (void)
 {
        volatile ccsr_gur_t *gur = (void *)(CFG_MPC85xx_GUTS_ADDR);
@@ -83,45 +78,6 @@ initdram(int board_type)
        return dram_size;
 }
 
-#if defined(CFG_DRAM_TEST)
-int
-testdram(void)
-{
-       uint *pstart = (uint *) CFG_MEMTEST_START;
-       uint *pend = (uint *) CFG_MEMTEST_END;
-       uint *p;
-
-       printf("Testing DRAM from 0x%08x to 0x%08x\n",
-              CFG_MEMTEST_START,
-              CFG_MEMTEST_END);
-
-       printf("DRAM test phase 1:\n");
-       for (p = pstart; p < pend; p++)
-               *p = 0xaaaaaaaa;
-
-       for (p = pstart; p < pend; p++) {
-               if (*p != 0xaaaaaaaa) {
-                       printf ("DRAM test fails at: %08x\n", (uint) p);
-                       return 1;
-               }
-       }
-
-       printf("DRAM test phase 2:\n");
-       for (p = pstart; p < pend; p++)
-               *p = 0x55555555;
-
-       for (p = pstart; p < pend; p++) {
-               if (*p != 0x55555555) {
-                       printf ("DRAM test fails at: %08x\n", (uint) p);
-                       return 1;
-               }
-       }
-
-       printf("DRAM test passed.\n");
-       return 0;
-}
-#endif
-
 #ifdef CONFIG_PCI1
 static struct pci_controller pci1_hose;
 #endif
index 0ee53e2c13a93da9ea1e35582ca11952e8ff2908..34b9d1c4dfcb1c90978172258ff147bb7a3a7ef8 100644 (file)
 
 struct law_entry law_table[] = {
 #ifdef CFG_PCI1_MEM_PHYS
-       SET_LAW_ENTRY(2, CFG_PCI1_MEM_PHYS, LAW_SIZE_512M, LAW_TRGT_IF_PCI),
-       SET_LAW_ENTRY(3, CFG_PCI1_IO_PHYS, LAW_SIZE_1M, LAW_TRGT_IF_PCI),
+       SET_LAW(CFG_PCI1_MEM_PHYS, LAW_SIZE_512M, LAW_TRGT_IF_PCI),
+       SET_LAW(CFG_PCI1_IO_PHYS, LAW_SIZE_1M, LAW_TRGT_IF_PCI),
 #endif
 #ifdef CFG_PCI2_MEM_PHYS
-       SET_LAW_ENTRY(4, CFG_PCI2_MEM_PHYS, LAW_SIZE_512M, LAW_TRGT_IF_PCI_2),
-       SET_LAW_ENTRY(5, CFG_PCI2_IO_PHYS, LAW_SIZE_1M, LAW_TRGT_IF_PCI_2),
+       SET_LAW(CFG_PCI2_MEM_PHYS, LAW_SIZE_512M, LAW_TRGT_IF_PCI_2),
+       SET_LAW(CFG_PCI2_IO_PHYS, LAW_SIZE_1M, LAW_TRGT_IF_PCI_2),
 #endif
 #ifdef CFG_PCIE1_MEM_PHYS
-       SET_LAW_ENTRY(6, CFG_PCIE1_MEM_PHYS, LAW_SIZE_512M, LAW_TRGT_IF_PCIE_1),
-       SET_LAW_ENTRY(7, CFG_PCIE1_IO_PHYS, LAW_SIZE_1M, LAW_TRGT_IF_PCIE_1),
+       SET_LAW(CFG_PCIE1_MEM_PHYS, LAW_SIZE_512M, LAW_TRGT_IF_PCIE_1),
+       SET_LAW(CFG_PCIE1_IO_PHYS, LAW_SIZE_1M, LAW_TRGT_IF_PCIE_1),
 #endif
        /* LBC window - maps 256M 0xf0000000 -> 0xffffffff */
-       SET_LAW_ENTRY(8, CFG_LBC_SDRAM_BASE, LAW_SIZE_256M, LAW_TRGT_IF_LBC),
+       SET_LAW(CFG_LBC_SDRAM_BASE, LAW_SIZE_256M, LAW_TRGT_IF_LBC),
 #ifdef CFG_RIO_MEM_PHYS
-       SET_LAW_ENTRY(9, CFG_RIO_MEM_PHYS, LAW_SIZE_512M, LAW_TRGT_IF_RIO),
+       SET_LAW(CFG_RIO_MEM_PHYS, LAW_SIZE_512M, LAW_TRGT_IF_RIO),
 #endif
 };
 
index efe2a3a3def57c761ff648e6a5a7b71998475b6e..ad29734b20f245d1de3a9654bdd7c72efb60d325 100644 (file)
@@ -45,11 +45,6 @@ DECLARE_GLOBAL_DATA_PTR;
 void local_bus_init(void);
 void sdram_init(void);
 
-int board_early_init_f (void)
-{
-       return 0;
-}
-
 int checkboard (void)
 {
        volatile ccsr_gur_t *gur = (void *)(CFG_MPC85xx_GUTS_ADDR);
@@ -250,45 +245,6 @@ sdram_init(void)
 #endif /* enable SDRAM init */
 }
 
-#if defined(CFG_DRAM_TEST)
-int
-testdram(void)
-{
-       uint *pstart = (uint *) CFG_MEMTEST_START;
-       uint *pend = (uint *) CFG_MEMTEST_END;
-       uint *p;
-
-       printf("Testing DRAM from 0x%08x to 0x%08x\n",
-              CFG_MEMTEST_START,
-              CFG_MEMTEST_END);
-
-       printf("DRAM test phase 1:\n");
-       for (p = pstart; p < pend; p++)
-               *p = 0xaaaaaaaa;
-
-       for (p = pstart; p < pend; p++) {
-               if (*p != 0xaaaaaaaa) {
-                       printf ("DRAM test fails at: %08x\n", (uint) p);
-                       return 1;
-               }
-       }
-
-       printf("DRAM test phase 2:\n");
-       for (p = pstart; p < pend; p++)
-               *p = 0x55555555;
-
-       for (p = pstart; p < pend; p++) {
-               if (*p != 0x55555555) {
-                       printf ("DRAM test fails at: %08x\n", (uint) p);
-                       return 1;
-               }
-       }
-
-       printf("DRAM test passed.\n");
-       return 0;
-}
-#endif
-
 #if defined(CONFIG_PCI) || defined(CONFIG_PCI1)
 /* For some reason the Tundra PCI bridge shows up on itself as a
  * different device.  Work around that by refusing to configure it.
index 0ac223c53c0c17355906c2bab2b46148f325acde..fbf2bdc07f7fa8e4a9e8fcb47b137d06abff19d3 100644 (file)
  */
 
 struct law_entry law_table[] = {
-       SET_LAW_ENTRY(2, CFG_PCI1_MEM_PHYS, LAW_SIZE_512M, LAW_TRGT_IF_PCI),
-       SET_LAW_ENTRY(3, CFG_PCI2_MEM_PHYS, LAW_SIZE_512M, LAW_TRGT_IF_PCI_2),
-       SET_LAW_ENTRY(4, CFG_PCI1_IO_PHYS, LAW_SIZE_1M, LAW_TRGT_IF_PCI),
-       SET_LAW_ENTRY(5, CFG_PCI2_IO_PHYS, LAW_SIZE_1M, LAW_TRGT_IF_PCI_2),
+       SET_LAW(CFG_PCI1_MEM_PHYS, LAW_SIZE_512M, LAW_TRGT_IF_PCI),
+       SET_LAW(CFG_PCI2_MEM_PHYS, LAW_SIZE_512M, LAW_TRGT_IF_PCI_2),
+       SET_LAW(CFG_PCI1_IO_PHYS, LAW_SIZE_1M, LAW_TRGT_IF_PCI),
+       SET_LAW(CFG_PCI2_IO_PHYS, LAW_SIZE_1M, LAW_TRGT_IF_PCI_2),
        /* LBC window - maps 256M 0xf0000000 -> 0xffffffff */
-       SET_LAW_ENTRY(6, CFG_LBC_SDRAM_BASE, LAW_SIZE_256M, LAW_TRGT_IF_LBC),
+       SET_LAW(CFG_LBC_SDRAM_BASE, LAW_SIZE_256M, LAW_TRGT_IF_LBC),
 };
 
 int num_law_entries = ARRAY_SIZE(law_table);
index 8acbba4208f35f1e60ebb40bce7f6705b734c2ff..74e20cb23fe16d706b8ad2e32ef2d833207d8626 100644 (file)
@@ -194,11 +194,6 @@ const iop_conf_t iop_conf_tab[4][32] = {
     }
 };
 
-int board_early_init_f (void)
-{
-       return 0;
-}
-
 int checkboard (void)
 {
        volatile ccsr_gur_t *gur = (void *)(CFG_MPC85xx_GUTS_ADDR);
@@ -422,45 +417,6 @@ sdram_init(void)
 #endif /* enable SDRAM init */
 }
 
-#if defined(CFG_DRAM_TEST)
-int
-testdram(void)
-{
-       uint *pstart = (uint *) CFG_MEMTEST_START;
-       uint *pend = (uint *) CFG_MEMTEST_END;
-       uint *p;
-
-       printf("Testing DRAM from 0x%08x to 0x%08x\n",
-              CFG_MEMTEST_START,
-              CFG_MEMTEST_END);
-
-       printf("DRAM test phase 1:\n");
-       for (p = pstart; p < pend; p++)
-               *p = 0xaaaaaaaa;
-
-       for (p = pstart; p < pend; p++) {
-               if (*p != 0xaaaaaaaa) {
-                       printf ("DRAM test fails at: %08x\n", (uint) p);
-                       return 1;
-               }
-       }
-
-       printf("DRAM test phase 2:\n");
-       for (p = pstart; p < pend; p++)
-               *p = 0x55555555;
-
-       for (p = pstart; p < pend; p++) {
-               if (*p != 0x55555555) {
-                       printf ("DRAM test fails at: %08x\n", (uint) p);
-                       return 1;
-               }
-       }
-
-       printf("DRAM test passed.\n");
-       return 0;
-}
-#endif
-
 #ifdef CONFIG_PCI
 /* For some reason the Tundra PCI bridge shows up on itself as a
  * different device.  Work around that by refusing to configure it
index 785576a35a709539f108e6e511bd709eb11e1d9e..3b8bd05ad122565198fbc1bb1c4bf26022ab81d3 100644 (file)
 
 struct law_entry law_table[] = {
 #ifndef CONFIG_SPD_EEPROM
-       SET_LAW_ENTRY(1, CFG_DDR_SDRAM_BASE, LAW_SIZE_128M, LAW_TRGT_IF_DDR),
+       SET_LAW(CFG_DDR_SDRAM_BASE, LAW_SIZE_128M, LAW_TRGT_IF_DDR),
 #endif
-       SET_LAW_ENTRY(2, CFG_PCI1_MEM_PHYS, LAW_SIZE_512M, LAW_TRGT_IF_PCI),
+       SET_LAW(CFG_PCI1_MEM_PHYS, LAW_SIZE_512M, LAW_TRGT_IF_PCI),
        /* This is not so much the SDRAM map as it is the whole localbus map. */
-       SET_LAW_ENTRY(3, CFG_LBC_SDRAM_BASE, LAW_SIZE_256M, LAW_TRGT_IF_LBC),
-       SET_LAW_ENTRY(4, CFG_PCI1_IO_PHYS, LAW_SIZE_1M, LAW_TRGT_IF_PCI),
-       SET_LAW_ENTRY(5, CFG_RIO_MEM_BASE, LAWAR_SIZE_512M, LAW_TRGT_IF_RIO),
+       SET_LAW(CFG_LBC_SDRAM_BASE, LAW_SIZE_256M, LAW_TRGT_IF_LBC),
+       SET_LAW(CFG_PCI1_IO_PHYS, LAW_SIZE_1M, LAW_TRGT_IF_PCI),
+       SET_LAW(CFG_RIO_MEM_BASE, LAWAR_SIZE_512M, LAW_TRGT_IF_RIO),
 };
 
 int num_law_entries = ARRAY_SIZE(law_table);
index 8d4b8a8b5a1b48d3639e42200c2f4f85287eb219..144b584800d3d70c0c22b28941c991ce976ce5c3 100644 (file)
@@ -212,12 +212,6 @@ typedef struct bcsr_ {
        volatile unsigned char bcsr5;
 } bcsr_t;
 
-
-int board_early_init_f (void)
-{
-    return 0;
-}
-
 void reset_phy (void)
 {
 #if defined(CONFIG_ETHER_ON_FCC) /* avoid compile warnings for now */
@@ -433,42 +427,6 @@ sdram_init(void)
        udelay(100);
 }
 
-
-#if defined(CFG_DRAM_TEST)
-int testdram (void)
-{
-       uint *pstart = (uint *) CFG_MEMTEST_START;
-       uint *pend = (uint *) CFG_MEMTEST_END;
-       uint *p;
-
-       printf("SDRAM test phase 1:\n");
-       for (p = pstart; p < pend; p++)
-               *p = 0xaaaaaaaa;
-
-       for (p = pstart; p < pend; p++) {
-               if (*p != 0xaaaaaaaa) {
-                       printf ("SDRAM test fails at: %08x\n", (uint) p);
-                       return 1;
-               }
-       }
-
-       printf("SDRAM test phase 2:\n");
-       for (p = pstart; p < pend; p++)
-               *p = 0x55555555;
-
-       for (p = pstart; p < pend; p++) {
-               if (*p != 0x55555555) {
-                       printf ("SDRAM test fails at: %08x\n", (uint) p);
-                       return 1;
-               }
-       }
-
-       printf("SDRAM test passed.\n");
-       return 0;
-}
-#endif
-
-
 #if !defined(CONFIG_SPD_EEPROM)
 /*************************************************************************
  *  fixed sdram init -- doesn't use serial presence detect.
index 5e96ea73a290fe97d456d06e4af65dc5967e1d76..3bc24c5c9b3b8393cf6292dcfd2dbbf68cea8204 100644 (file)
  */
 
 struct law_entry law_table[] = {
-       SET_LAW_ENTRY(2, CFG_PCI1_MEM_PHYS, LAW_SIZE_512M, LAW_TRGT_IF_PCI),
-       SET_LAW_ENTRY(3, CFG_PCIE1_MEM_PHYS, LAW_SIZE_512M, LAW_TRGT_IF_PCIE_1),
-       SET_LAW_ENTRY(4, CFG_PCI1_IO_PHYS, LAW_SIZE_8M, LAW_TRGT_IF_PCI),
-       SET_LAW_ENTRY(5, CFG_PCIE1_IO_PHYS, LAW_SIZE_8M, LAW_TRGT_IF_PCIE_1),
-       SET_LAW_ENTRY(6, CFG_SRIO_MEM_BASE, LAW_SIZE_512M, LAW_TRGT_IF_RIO),
+       SET_LAW(CFG_PCI1_MEM_PHYS, LAW_SIZE_512M, LAW_TRGT_IF_PCI),
+       SET_LAW(CFG_PCIE1_MEM_PHYS, LAW_SIZE_512M, LAW_TRGT_IF_PCIE_1),
+       SET_LAW(CFG_PCI1_IO_PHYS, LAW_SIZE_8M, LAW_TRGT_IF_PCI),
+       SET_LAW(CFG_PCIE1_IO_PHYS, LAW_SIZE_8M, LAW_TRGT_IF_PCIE_1),
+       SET_LAW(CFG_SRIO_MEM_BASE, LAW_SIZE_512M, LAW_TRGT_IF_RIO),
        /* LBC window - maps 256M.  That's SDRAM, BCSR, PIBs, and Flash */
-       SET_LAW_ENTRY(7, CFG_LBC_SDRAM_BASE, LAW_SIZE_256M, LAW_TRGT_IF_LBC),
+       SET_LAW(CFG_LBC_SDRAM_BASE, LAW_SIZE_256M, LAW_TRGT_IF_LBC),
 };
 
 int num_law_entries = ARRAY_SIZE(law_table);
index 4568aa1df59ba55b49c60b4d50439c9c988f9814..f1928abf98cdcb6123358ddc66ebaeab24c883d8 100644 (file)
@@ -292,45 +292,6 @@ sdram_init(void)
 #endif /* enable SDRAM init */
 }
 
-#if defined(CFG_DRAM_TEST)
-int
-testdram(void)
-{
-       uint *pstart = (uint *) CFG_MEMTEST_START;
-       uint *pend = (uint *) CFG_MEMTEST_END;
-       uint *p;
-
-       printf("Testing DRAM from 0x%08x to 0x%08x\n",
-              CFG_MEMTEST_START,
-              CFG_MEMTEST_END);
-
-       printf("DRAM test phase 1:\n");
-       for (p = pstart; p < pend; p++)
-               *p = 0xaaaaaaaa;
-
-       for (p = pstart; p < pend; p++) {
-               if (*p != 0xaaaaaaaa) {
-                       printf ("DRAM test fails at: %08x\n", (uint) p);
-                       return 1;
-               }
-       }
-
-       printf("DRAM test phase 2:\n");
-       for (p = pstart; p < pend; p++)
-               *p = 0x55555555;
-
-       for (p = pstart; p < pend; p++) {
-               if (*p != 0x55555555) {
-                       printf ("DRAM test fails at: %08x\n", (uint) p);
-                       return 1;
-               }
-       }
-
-       printf("DRAM test passed.\n");
-       return 0;
-}
-#endif
-
 #if defined(CONFIG_PCI)
 #ifndef CONFIG_PCI_PNP
 static struct pci_config_table pci_mpc8568mds_config_table[] = {
index b4d222d1ae82011cd0c00158f335e88cf25b4b13..91b922b86b1bd3bd92bca44c6a8cfa038e94b142 100644 (file)
 
 struct law_entry law_table[] = {
 #if !defined(CONFIG_SPD_EEPROM)
-       SET_LAW_ENTRY(1, CFG_DDR_SDRAM_BASE, LAW_SIZE_512M, LAW_TRGT_IF_DDR_1),
+       SET_LAW(CFG_DDR_SDRAM_BASE, LAW_SIZE_512M, LAW_TRGT_IF_DDR_1),
 #endif
-       SET_LAW_ENTRY(2, CFG_PCIE1_MEM_BASE, LAW_SIZE_256M, LAW_TRGT_IF_PCIE_1),
-       SET_LAW_ENTRY(3, CFG_PCIE2_MEM_BASE, LAW_SIZE_256M, LAW_TRGT_IF_PCIE_2),
-       SET_LAW_ENTRY(4, PIXIS_BASE, LAW_SIZE_2M, LAW_TRGT_IF_LBC),
-       SET_LAW_ENTRY(5, CFG_PCIE1_IO_PHYS, LAW_SIZE_1M, LAW_TRGT_IF_PCIE_1),
-       SET_LAW_ENTRY(6, CFG_PCIE2_IO_PHYS, LAW_SIZE_1M, LAW_TRGT_IF_PCIE_2),
-       SET_LAW_ENTRY(7, CFG_FLASH_BASE, LAW_SIZE_256M, LAW_TRGT_IF_LBC),
-       SET_LAW_ENTRY(8, CFG_PCI1_MEM_PHYS, LAW_SIZE_256M, LAW_TRGT_IF_PCI_1),
-       SET_LAW_ENTRY(9, CFG_PCI1_IO_PHYS, LAW_SIZE_1M, LAW_TRGT_IF_PCI_1)
+       SET_LAW(CFG_PCIE1_MEM_BASE, LAW_SIZE_256M, LAW_TRGT_IF_PCIE_1),
+       SET_LAW(CFG_PCIE2_MEM_BASE, LAW_SIZE_256M, LAW_TRGT_IF_PCIE_2),
+       SET_LAW(PIXIS_BASE, LAW_SIZE_2M, LAW_TRGT_IF_LBC),
+       SET_LAW(CFG_PCIE1_IO_PHYS, LAW_SIZE_1M, LAW_TRGT_IF_PCIE_1),
+       SET_LAW(CFG_PCIE2_IO_PHYS, LAW_SIZE_1M, LAW_TRGT_IF_PCIE_2),
+       SET_LAW(CFG_FLASH_BASE, LAW_SIZE_256M, LAW_TRGT_IF_LBC),
+       SET_LAW(CFG_PCI1_MEM_PHYS, LAW_SIZE_256M, LAW_TRGT_IF_PCI_1),
+       SET_LAW(CFG_PCI1_IO_PHYS, LAW_SIZE_1M, LAW_TRGT_IF_PCI_1)
 };
 
 int num_law_entries = ARRAY_SIZE(law_table);
index 3a855b590356ec027bfd0eeb41cb5fd0293e8ef5..ce563dc67a996d018c3f1c435115d28bacc59bbc 100644 (file)
@@ -141,42 +141,6 @@ initdram(int board_type)
 }
 
 
-#if defined(CFG_DRAM_TEST)
-int
-testdram(void)
-{
-       uint *pstart = (uint *) CFG_MEMTEST_START;
-       uint *pend = (uint *) CFG_MEMTEST_END;
-       uint *p;
-
-       puts("SDRAM test phase 1:\n");
-       for (p = pstart; p < pend; p++)
-               *p = 0xaaaaaaaa;
-
-       for (p = pstart; p < pend; p++) {
-               if (*p != 0xaaaaaaaa) {
-                       printf("SDRAM test fails at: %08x\n", (uint) p);
-                       return 1;
-               }
-       }
-
-       puts("SDRAM test phase 2:\n");
-       for (p = pstart; p < pend; p++)
-               *p = 0x55555555;
-
-       for (p = pstart; p < pend; p++) {
-               if (*p != 0x55555555) {
-                       printf("SDRAM test fails at: %08x\n", (uint) p);
-                       return 1;
-               }
-       }
-
-       puts("SDRAM test passed.\n");
-       return 0;
-}
-#endif
-
-
 #if !defined(CONFIG_SPD_EEPROM)
 /*
  * Fixed sdram init -- doesn't use serial presence detect.
index 245f420576851f0c70bbd6ca7b69b8be6a6de8e4..2d6c3c1759abe2afb1f6ef630786a805dee5275e 100644 (file)
 
 struct law_entry law_table[] = {
 #if !defined(CONFIG_SPD_EEPROM)
-       SET_LAW_ENTRY(1, CFG_DDR_SDRAM_BASE, LAW_SIZE_256M, LAW_TRGT_IF_DDR_1),
+       SET_LAW(CFG_DDR_SDRAM_BASE, LAW_SIZE_256M, LAW_TRGT_IF_DDR_1),
 #endif
-       SET_LAW_ENTRY(2, CFG_PCI1_MEM_BASE, LAW_SIZE_512M, LAW_TRGT_IF_PCI_1),
-       SET_LAW_ENTRY(3, CFG_PCI2_MEM_BASE, LAW_SIZE_512M, LAW_TRGT_IF_PCI_2),
-       SET_LAW_ENTRY(4, PIXIS_BASE, LAW_SIZE_2M, LAW_TRGT_IF_LBC),
-       SET_LAW_ENTRY(5, CFG_PCI1_IO_PHYS, LAW_SIZE_16M, LAW_TRGT_IF_PCI_1),
-       SET_LAW_ENTRY(6, CFG_PCI2_IO_PHYS, LAW_SIZE_16M, LAW_TRGT_IF_PCI_2),
-       SET_LAW_ENTRY(7, (CFG_FLASH_BASE & 0xfe000000), LAW_SIZE_32M, LAW_TRGT_IF_LBC),
+       SET_LAW(CFG_PCI1_MEM_BASE, LAW_SIZE_512M, LAW_TRGT_IF_PCI_1),
+       SET_LAW(CFG_PCI2_MEM_BASE, LAW_SIZE_512M, LAW_TRGT_IF_PCI_2),
+       SET_LAW(PIXIS_BASE, LAW_SIZE_2M, LAW_TRGT_IF_LBC),
+       SET_LAW(CFG_PCI1_IO_PHYS, LAW_SIZE_16M, LAW_TRGT_IF_PCI_1),
+       SET_LAW(CFG_PCI2_IO_PHYS, LAW_SIZE_16M, LAW_TRGT_IF_PCI_2),
+       SET_LAW((CFG_FLASH_BASE & 0xfe000000), LAW_SIZE_32M, LAW_TRGT_IF_LBC),
 #if !defined(CONFIG_SPD_EEPROM)
-       SET_LAW_ENTRY(8, CFG_DDR_SDRAM_BASE, LAW_SIZE_256M, LAW_TRGT_IF_DDR_2),
+       SET_LAW(CFG_DDR_SDRAM_BASE, LAW_SIZE_256M, LAW_TRGT_IF_DDR_2),
 #endif
-       SET_LAW_ENTRY(9, CFG_RIO_MEM_PHYS, LAW_SIZE_512M, LAW_TRGT_IF_RIO)
+       SET_LAW(CFG_RIO_MEM_PHYS, LAW_SIZE_512M, LAW_TRGT_IF_RIO)
 };
 
 int num_law_entries = ARRAY_SIZE(law_table);
index bb1f927b95ab190bb0e78953a4293edf9c53d21c..915fb58ee9c86db6fe4b45f0fa7db3bca601239f 100644 (file)
@@ -81,42 +81,6 @@ initdram(int board_type)
 }
 
 
-#if defined(CFG_DRAM_TEST)
-int
-testdram(void)
-{
-       uint *pstart = (uint *) CFG_MEMTEST_START;
-       uint *pend = (uint *) CFG_MEMTEST_END;
-       uint *p;
-
-       puts("SDRAM test phase 1:\n");
-       for (p = pstart; p < pend; p++)
-               *p = 0xaaaaaaaa;
-
-       for (p = pstart; p < pend; p++) {
-               if (*p != 0xaaaaaaaa) {
-                       printf("SDRAM test fails at: %08x\n", (uint) p);
-                       return 1;
-               }
-       }
-
-       puts("SDRAM test phase 2:\n");
-       for (p = pstart; p < pend; p++)
-               *p = 0x55555555;
-
-       for (p = pstart; p < pend; p++) {
-               if (*p != 0x55555555) {
-                       printf("SDRAM test fails at: %08x\n", (uint) p);
-                       return 1;
-               }
-       }
-
-       puts("SDRAM test passed.\n");
-       return 0;
-}
-#endif
-
-
 #if !defined(CONFIG_SPD_EEPROM)
 /*
  * Fixed sdram init -- doesn't use serial presence detect.
index 2dfd87c78e596c6267a21ddab7ba01a6d05a27c2..9fcab74849834b91790b13a533b205ad3b611d9e 100644 (file)
@@ -149,41 +149,6 @@ long int initdram (int board_type)
 }
 
 
-#if 1 /* test-only */
-void sdram_init(void)
-{
-       init_sdram_static_settings();
-}
-#endif
-
-
-#if 0 /* test-only */
-long int initdram (int board_type)
-{
-       unsigned long val;
-
-       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));
-}
-#endif
-
-
-int testdram (void)
-{
-       /* TODO: XXX XXX XXX */
-       printf ("test: 16 MB - ok\n");
-
-       return (0);
-}
-
-
 #if defined(CONFIG_CMD_NAND)
 #include <linux/mtd/nand_legacy.h>
 extern struct nand_chip nand_dev_desc[CFG_MAX_NAND_DEVICE];
index 231cd1caf56be57ab95dd4b4231f01ad9fd26681..c564ed3c94ec36a28d2a3ccd43c53d3c19aa080b 100644 (file)
@@ -93,13 +93,3 @@ ext_bus_cntlr_init:
        mtdcr   ebccfgd,r4
 
        blr
-
-
-/*----------------------------------------------------------------------- */
-/* Function:     sdram_init                                               */
-/* Description:  This function is called by cpu/ppc4xx/start.S code       */
-/*               to get the SDRAM initialized.                            */
-/*----------------------------------------------------------------------- */
-       .globl  sdram_init
-sdram_init:
-       blr
index b63fbdc0cdd5e59e3a77ea832cd02fae9d91026b..85795b7c2a787d86e32eabd8bd008f51af612fa5 100644 (file)
@@ -275,44 +275,6 @@ int checkboard(void)
        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
  *
index 80f98c5bd90b7ee65ce14fbafc5729d162bbf6b4..9064d3b669bbeffd5a977bcdaa660bc0457f6c2c 100644 (file)
@@ -28,7 +28,3 @@
        .globl  ext_bus_cntlr_init
 ext_bus_cntlr_init:
        blr
-
-       .globl  sdram_init
-sdram_init:
-       blr
index 273ec5c06f69560e55c32a04f5b231c50d1d69cd..cfcd73e9e142cb3987eeef671b2f737d759244c3 100644 (file)
 
 struct law_entry law_table[] = {
 #ifndef CONFIG_SPD_EEPROM
-       SET_LAW_ENTRY(1, CFG_DDR_SDRAM_BASE, LAW_SIZE_128M, LAW_TRGT_IF_DDR),
+       SET_LAW(CFG_DDR_SDRAM_BASE, LAW_SIZE_128M, LAW_TRGT_IF_DDR),
 #endif
-       SET_LAW_ENTRY(2, CFG_PCI_MEM_PHYS, LAW_SIZE_256M, LAW_TRGT_IF_PCI),
+       SET_LAW(CFG_PCI_MEM_PHYS, LAW_SIZE_256M, LAW_TRGT_IF_PCI),
 #ifndef CONFIG_RAM_AS_FLASH
-       SET_LAW_ENTRY(3, CFG_LBC_SDRAM_BASE, LAW_SIZE_128M, LAW_TRGT_IF_LBC),
+       SET_LAW(CFG_LBC_SDRAM_BASE, LAW_SIZE_128M, LAW_TRGT_IF_LBC),
 #endif
 };
 
index 3351b5b840ee5cf8c8bbe1dcf0cbf3bb8aba5d7e..f00a871dfd509b6901fa5cced5b6fb69fd58194f 100644 (file)
@@ -178,19 +178,6 @@ ext_bus_cntlr_init:
   nop                          /* pass2 DCR errata #8 */
   blr
 
-/*-----------------------------------------------------------------------------
- * Function:     sdram_init
- * Description:  Configures the internal SRAM memory. and setup the
- *               Stackpointer in it.
- *----------------------------------------------------------------------------- */
-       .globl  sdram_init
-
-sdram_init:
-
-
-  blr
-
-
 #if defined(CONFIG_BOOT_PCI)
     .section .bootpg,"ax"
     .globl _start_pci
index 39f2ea534aef259218468a99baf9c7d2befbf1ca..838432525dee57effa8f8d4709b7b6aaed99747e 100644 (file)
   nop                          /* pass2 DCR errata #8 */
   blr
 
-/*-----------------------------------------------------------------------------
- * Function:     sdram_init
- * Description:  Configures the internal SRAM memory. and setup the
- *               Stackpointer in it.
- *----------------------------------------------------------------------------- */
-       .globl  sdram_init
-
-sdram_init:
-
-
-  blr
-
-
 #if defined(CONFIG_BOOT_PCI)
     .section .bootpg,"ax"
     .globl _start_pci
diff --git a/board/mvblm7/Makefile b/board/mvblm7/Makefile
new file mode 100644 (file)
index 0000000..84cd14a
--- /dev/null
@@ -0,0 +1,48 @@
+#
+# Copyright (C) Freescale Semiconductor, Inc. 2006. All rights reserved.
+#
+# 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 pci.o fpga.o
+
+SRCS   := $(SOBJS:.o=.S) $(COBJS:.o=.c)
+OBJS   := $(addprefix $(obj),$(COBJS))
+SOBJS  := $(addprefix $(obj),$(SOBJS))
+
+$(LIB):        $(obj).depend $(OBJS)
+       $(AR) $(ARFLAGS) $@ $(OBJS)
+
+clean:
+       rm -f $(SOBJS) $(OBJS)
+
+distclean:     clean
+       rm -f $(LIB) core *.bak .depend
+
+#########################################################################
+
+include $(SRCTREE)/rules.mk
+
+sinclude $(obj).depend
+
+#########################################################################
diff --git a/board/mvblm7/config.mk b/board/mvblm7/config.mk
new file mode 100644 (file)
index 0000000..1d85f4f
--- /dev/null
@@ -0,0 +1,25 @@
+#
+# Copyright (C) Freescale Semiconductor, Inc. 2006. All rights reserved.
+#
+# 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
+#
+
+sinclude $(OBJTREE)/board/$(BOARDDIR)/config.tmp
+
+TEXT_BASE  = 0xFFF00000
diff --git a/board/mvblm7/fpga.c b/board/mvblm7/fpga.c
new file mode 100644 (file)
index 0000000..a60af01
--- /dev/null
@@ -0,0 +1,188 @@
+/*
+ * (C) Copyright 2002
+ * Rich Ireland, Enterasys Networks, rireland@enterasys.com.
+ * Keith Outwater, keith_outwater@mvis.com.
+ *
+ * (C) Copyright 2008
+ * Andre Schwarz, Matrix Vision GmbH, andre.schwarz@matrix-vision.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 <ACEX1K.h>
+#include <command.h>
+#include "fpga.h"
+#include "mvblm7.h"
+
+#ifdef FPGA_DEBUG
+#define fpga_debug(fmt, args...)      printf("%s: "fmt, __func__, ##args)
+#else
+#define fpga_debug(fmt, args...)
+#endif
+
+Altera_CYC2_Passive_Serial_fns altera_fns = {
+       fpga_null_fn,
+       fpga_config_fn,
+       fpga_status_fn,
+       fpga_done_fn,
+       fpga_wr_fn,
+       fpga_null_fn,
+       fpga_null_fn,
+       0
+};
+
+Altera_desc cyclone2 = {
+       Altera_CYC2,
+       passive_serial,
+       Altera_EP2C20_SIZE,
+       (void *) &altera_fns,
+       NULL,
+       0
+};
+
+DECLARE_GLOBAL_DATA_PTR;
+
+int mvblm7_init_fpga(void)
+{
+       fpga_debug("Initialize FPGA interface (reloc 0x%.8lx)\n",
+               gd->reloc_off);
+       fpga_init(gd->reloc_off);
+       fpga_add(fpga_altera, &cyclone2);
+       fpga_config_fn(0, 1, 0);
+       udelay(60);
+
+       return 1;
+}
+
+int fpga_null_fn(int cookie)
+{
+       return 0;
+}
+
+int fpga_config_fn(int assert, int flush, int cookie)
+{
+       volatile immap_t *im = (volatile immap_t *)CFG_IMMR;
+       volatile gpio83xx_t *gpio = (volatile gpio83xx_t *)&im->gpio[0];
+       u32 dvo = gpio->dat;
+
+       fpga_debug("SET config : %s\n", assert ? "low" : "high");
+       if (assert)
+               dvo |= FPGA_CONFIG;
+       else
+               dvo &= ~FPGA_CONFIG;
+
+       if (flush)
+               gpio->dat = dvo;
+
+       return assert;
+}
+
+int fpga_done_fn(int cookie)
+{
+       volatile immap_t *im = (volatile immap_t *)CFG_IMMR;
+       volatile gpio83xx_t *gpio = (volatile gpio83xx_t *)&im->gpio[0];
+       int result = 0;
+
+       udelay(10);
+       fpga_debug("CONF_DONE check ... ");
+       if (gpio->dat & FPGA_CONF_DONE)  {
+               fpga_debug("high\n");
+               result = 1;
+       } else
+               fpga_debug("low\n");
+
+       return result;
+}
+
+int fpga_status_fn(int cookie)
+{
+       volatile immap_t *im = (volatile immap_t *)CFG_IMMR;
+       volatile gpio83xx_t *gpio = (volatile gpio83xx_t *)&im->gpio[0];
+       int result = 0;
+
+       fpga_debug("STATUS check ... ");
+       if (gpio->dat & FPGA_STATUS)  {
+               fpga_debug("high\n");
+               result = 1;
+       } else
+               fpga_debug("low\n");
+
+       return result;
+}
+
+int fpga_clk_fn(int assert_clk, int flush, int cookie)
+{
+       volatile immap_t *im = (volatile immap_t *)CFG_IMMR;
+       volatile gpio83xx_t *gpio = (volatile gpio83xx_t *)&im->gpio[0];
+       u32 dvo = gpio->dat;
+
+       fpga_debug("CLOCK %s\n", assert_clk ? "high" : "low");
+       if (assert_clk)
+               dvo |= FPGA_CCLK;
+       else
+               dvo &= ~FPGA_CCLK;
+
+       if (flush)
+               gpio->dat = dvo;
+
+       return assert_clk;
+}
+
+static inline int _write_fpga(u8 val, int dump)
+{
+       volatile immap_t *im = (volatile immap_t *)CFG_IMMR;
+       volatile gpio83xx_t *gpio = (volatile gpio83xx_t *)&im->gpio[0];
+       int i;
+       u32 dvo = gpio->dat;
+
+       if (dump)
+               fpga_debug("  %02x -> ", val);
+       for (i = 0; i < 8; i++) {
+               dvo &= ~FPGA_CCLK;
+               gpio->dat = dvo;
+               dvo &= ~FPGA_DIN;
+               if (dump)
+                       fpga_debug("%d ", val&1);
+               if (val & 1)
+                       dvo |= FPGA_DIN;
+               gpio->dat = dvo;
+               dvo |= FPGA_CCLK;
+               gpio->dat = dvo;
+               val >>= 1;
+       }
+       if (dump)
+               fpga_debug("\n");
+
+       return 0;
+}
+
+int fpga_wr_fn(void *buf, size_t len, int flush, int cookie)
+{
+       unsigned char *data = (unsigned char *) buf;
+       int i;
+
+       fpga_debug("fpga_wr: buf %p / size %d\n", buf, len);
+       for (i = 0; i < len; i++)
+               _write_fpga(data[i], 0);
+       fpga_debug("\n");
+
+       return FPGA_SUCCESS;
+}
diff --git a/board/mvblm7/fpga.h b/board/mvblm7/fpga.h
new file mode 100644 (file)
index 0000000..19277eb
--- /dev/null
@@ -0,0 +1,34 @@
+/*
+ * (C) Copyright 2002
+ * Rich Ireland, Enterasys Networks, rireland@enterasys.com.
+ * Keith Outwater, keith_outwater@mvis.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
+ *
+ */
+
+extern int mvblm7_init_fpga(void);
+
+extern int fpga_pgm_fn(int assert_pgm, int flush, int cookie);
+extern int fpga_status_fn(int cookie);
+extern int fpga_config_fn(int assert, int flush, int cookie);
+extern int fpga_done_fn(int cookie);
+extern int fpga_clk_fn(int assert_clk, int flush, int cookie);
+extern int fpga_wr_fn(void *buf, size_t len, int flush, int cookie);
+extern int fpga_null_fn(int cookie);
diff --git a/board/mvblm7/mvblm7.c b/board/mvblm7/mvblm7.c
new file mode 100644 (file)
index 0000000..c02c59c
--- /dev/null
@@ -0,0 +1,157 @@
+/*
+ * Copyright (C) Freescale Semiconductor, Inc. 2006. All rights reserved.
+ *
+ * (C) Copyright 2008
+ * Andre Schwarz, Matrix Vision GmbH, andre.schwarz@matrix-vision.de
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS for A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+#include <common.h>
+#include <ioports.h>
+#include <mpc83xx.h>
+#include <asm/mpc8349_pci.h>
+#include <pci.h>
+#include <spi.h>
+#include <asm/mmu.h>
+#if defined(CONFIG_OF_LIBFDT)
+#include <libfdt.h>
+#endif
+
+#include "mvblm7.h"
+
+int fixed_sdram(void)
+{
+       volatile immap_t *im = (immap_t *)CFG_IMMR;
+       u32 msize = 0;
+       u32 ddr_size;
+       u32 ddr_size_log2;
+
+       msize = CFG_DDR_SIZE;
+       for (ddr_size = msize << 20, ddr_size_log2 = 0;
+               (ddr_size > 1);
+               ddr_size = ddr_size >> 1, ddr_size_log2++) {
+               if (ddr_size & 1)
+                       return -1;
+       }
+       im->sysconf.ddrlaw[0].bar = ((CFG_DDR_SDRAM_BASE>>12) & 0xfffff);
+       im->sysconf.ddrlaw[0].ar = LAWAR_EN | ((ddr_size_log2 - 1) &
+               LAWAR_SIZE);
+
+       im->ddr.csbnds[0].csbnds = CFG_DDR_CS0_BNDS;
+       im->ddr.cs_config[0] = CFG_DDR_CS0_CONFIG;
+       im->ddr.timing_cfg_0 = CFG_DDR_TIMING_0;
+       im->ddr.timing_cfg_1 = CFG_DDR_TIMING_1;
+       im->ddr.timing_cfg_2 = CFG_DDR_TIMING_2;
+       im->ddr.timing_cfg_3 = CFG_DDR_TIMING_3;
+       im->ddr.sdram_cfg = CFG_DDR_SDRAM_CFG;
+       im->ddr.sdram_cfg2 = CFG_DDR_SDRAM_CFG2;
+       im->ddr.sdram_mode = CFG_DDR_MODE;
+       im->ddr.sdram_interval = CFG_DDR_INTERVAL;
+       im->ddr.sdram_clk_cntl = CFG_DDR_CLK_CNTL;
+
+       udelay(300);
+
+       im->ddr.sdram_cfg |= SDRAM_CFG_MEM_EN;
+
+       return CFG_DDR_SIZE;
+}
+
+long int initdram(int board_type)
+{
+       volatile immap_t *im = (immap_t *) CFG_IMMR;
+       u32 msize = 0;
+
+       if ((im->sysconf.immrbar & IMMRBAR_BASE_ADDR) != (u32) im)
+               return -1;
+
+       im->sysconf.ddrlaw[0].bar = CFG_DDR_BASE & LAWBAR_BAR;
+       msize = fixed_sdram();
+
+       /* return total bus RAM size(bytes) */
+       return msize * 1024 * 1024;
+}
+
+int checkboard(void)
+{
+       puts("Board: Matrix Vision mvBlueLYNX-M7 " MV_VERSION "\n");
+
+       return 0;
+}
+
+u8 *dhcp_vendorex_prep(u8 *e)
+{
+       char *ptr;
+
+       /* DHCP vendor-class-identifier = 60 */
+       ptr = getenv("dhcp_vendor-class-identifier");
+       if (ptr) {
+               *e++ = 60;
+               *e++ = strlen(ptr);
+               while (*ptr)
+                       *e++ = *ptr++;
+       }
+       /* DHCP_CLIENT_IDENTIFIER = 61 */
+       ptr = getenv("dhcp_client_id");
+       if (ptr) {
+               *e++ = 61;
+               *e++ = strlen(ptr);
+               while (*ptr)
+                       *e++ = *ptr++;
+       }
+
+       return e;
+}
+
+u8 *dhcp_vendorex_proc(u8 *popt)
+{
+       return NULL;
+}
+
+#ifdef CONFIG_HARD_SPI
+int spi_cs_is_valid(unsigned int bus, unsigned int cs)
+{
+        return bus == 0 && cs == 0;
+}
+
+void spi_cs_activate(struct spi_slave *slave)
+{
+        volatile gpio83xx_t *iopd = &((immap_t *)CFG_IMMR)->gpio[0];
+
+        iopd->dat &= ~MVBLM7_MMC_CS;
+}
+
+void spi_cs_deactivate(struct spi_slave *slave)
+{
+        volatile gpio83xx_t *iopd = &((immap_t *)CFG_IMMR)->gpio[0];
+
+        iopd->dat |= ~MVBLM7_MMC_CS;
+}
+#endif
+
+#if defined(CONFIG_OF_BOARD_SETUP)
+void ft_board_setup(void *blob, bd_t *bd)
+{
+       ft_cpu_setup(blob, bd);
+#ifdef CONFIG_PCI
+       ft_pci_setup(blob, bd);
+#endif
+}
+
+#endif
diff --git a/board/mvblm7/mvblm7.h b/board/mvblm7/mvblm7.h
new file mode 100644 (file)
index 0000000..03e9f41
--- /dev/null
@@ -0,0 +1,21 @@
+#ifndef __MVBC_H__
+#define __MVBC_H__
+
+#define MV_GPIO
+
+#define FPGA_CONFIG     0x80000000
+#define FPGA_CCLK       0x40000000
+#define FPGA_DIN        0x20000000
+#define FPGA_STATUS     0x10000000
+#define FPGA_CONF_DONE  0x08000000
+#define MMC_CS         0x04000000
+
+#define WD_WDI          0x00400000
+#define WD_TS           0x00200000
+#define MAN_RST         0x00100000
+
+#define MV_GPIO_DAT    (WD_TS)
+#define MV_GPIO_OUT    (FPGA_CONFIG|FPGA_DIN|FPGA_CCLK|WD_TS|WD_WDI|MMC_CS)
+#define MV_GPIO_ODE    (FPGA_CONFIG|MAN_RST)
+
+#endif
diff --git a/board/mvblm7/mvblm7_autoscript b/board/mvblm7/mvblm7_autoscript
new file mode 100644 (file)
index 0000000..ec6e34e
--- /dev/null
@@ -0,0 +1,37 @@
+echo
+echo "==== running autoscript ===="
+echo
+setenv bootdtb bootm \${kernel_boot} \${mv_initrd_addr_ram} \${mv_dtb_addr_ram}
+setenv ramkernel setenv kernel_boot \${loadaddr}
+setenv flashkernel setenv kernel_boot \${mv_kernel_addr}
+setenv cpird cp \${mv_initrd_addr} \${mv_initrd_addr_ram} \${mv_initrd_length}
+setenv bootfromflash run flashkernel cpird ramparam bootdtb
+setenv getdtb tftp \${mv_dtb_addr_ram} \${dtb_name}
+setenv cpdtb cp \${mv_dtb_addr} \${mv_dtb_addr_ram} 0x2000
+setenv rundtb fdt addr \${mv_dtb_addr_ram}\;fdt boardsetup
+setenv bootfromnet tftp \${mv_initrd_addr_ram} \${initrd_name}\;run ramkernel
+setenv set_static_ip setenv ipaddr \${static_ipaddr}
+setenv set_static_nm setenv netmask \${static_netmask}
+setenv set_static_gw setenv gatewayip \${static_gateway}
+setenv set_ip setenv ip \${ipaddr}::\${gatewayip}:\${netmask}
+setenv ramparam setenv bootargs root=/dev/ram0 ro rootfstype=squashfs
+if test ${autoscr_boot} != no;
+then
+  if test ${netboot} = yes;
+  then
+    bootp
+    if test $? = 0;
+    then
+      echo "=== bootp succeeded -> netboot ==="
+      run set_ip
+      run getdtb rundtb bootfromnet ramparam bootdtb
+    else
+      echo "=== netboot failed ==="
+    fi
+  fi
+  run set_static_ip set_static_nm set_static_gw set_ip
+  echo "=== bootfromflash ==="
+  run cpdtb rundtb bootfromflash
+else
+  echo "=== boot stopped with autoscr_boot no ==="
+fi
diff --git a/board/mvblm7/pci.c b/board/mvblm7/pci.c
new file mode 100644 (file)
index 0000000..ef34a6b
--- /dev/null
@@ -0,0 +1,133 @@
+/*
+ * Copyright (C) Freescale Semiconductor, Inc. 2006. All rights reserved.
+ *
+ * (C) Copyright 2008
+ * Andre Schwarz, Matrix Vision GmbH, andre.schwarz@matrix-vision.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>
+#if defined(CONFIG_OF_LIBFDT)
+#include <libfdt.h>
+#endif
+#include <pci.h>
+#include <mpc83xx.h>
+#include <fpga.h>
+#include "mvblm7.h"
+#include "fpga.h"
+
+DECLARE_GLOBAL_DATA_PTR;
+
+int mvblm7_load_fpga(void)
+{
+       size_t data_size = 0;
+       void *fpga_data = NULL;
+       char *datastr = getenv("fpgadata");
+       char *sizestr = getenv("fpgadatasize");
+
+       if (datastr)
+               fpga_data = (void *)simple_strtoul(datastr, NULL, 16);
+       if (sizestr)
+               data_size = (size_t)simple_strtoul(sizestr, NULL, 16);
+
+       return fpga_load(0, fpga_data, data_size);
+}
+
+static struct pci_region pci_regions[] = {
+       {
+               bus_start: CFG_PCI1_MEM_BASE,
+               phys_start: CFG_PCI1_MEM_PHYS,
+               size: CFG_PCI1_MEM_SIZE,
+               flags: PCI_REGION_MEM | PCI_REGION_PREFETCH
+       },
+       {
+               bus_start: CFG_PCI1_MMIO_BASE,
+               phys_start: CFG_PCI1_MMIO_PHYS,
+               size: CFG_PCI1_MMIO_SIZE,
+               flags: PCI_REGION_MEM
+       },
+       {
+               bus_start: CFG_PCI1_IO_BASE,
+               phys_start: CFG_PCI1_IO_PHYS,
+               size: CFG_PCI1_IO_SIZE,
+               flags: PCI_REGION_IO
+       }
+};
+
+void pci_init_board(void)
+{
+       char *s;
+       int i;
+       int warmboot;
+       int load_fpga;
+       volatile immap_t *immr;
+       volatile pcictrl83xx_t *pci_ctrl;
+       volatile gpio83xx_t *gpio;
+       volatile clk83xx_t *clk;
+       volatile law83xx_t *pci_law;
+       struct pci_region *reg[] = { pci_regions };
+
+       load_fpga = 1;
+       immr = (immap_t *) CFG_IMMR;
+       clk = (clk83xx_t *) &immr->clk;
+       pci_ctrl = immr->pci_ctrl;
+       pci_law = immr->sysconf.pcilaw;
+       gpio  = (volatile gpio83xx_t *)&immr->gpio[0];
+
+       s = getenv("skip_fpga");
+       if (s) {
+               printf("found 'skip_fpga' -> FPGA _not_ loaded !\n");
+               load_fpga = 0;
+       }
+
+       gpio->dat = MV_GPIO_DAT;
+       gpio->odr = MV_GPIO_ODE;
+       if (load_fpga)
+               gpio->dir = MV_GPIO_OUT;
+       else
+               gpio->dir = MV_GPIO_OUT & ~(FPGA_DIN|FPGA_CCLK);
+
+       printf("SICRH / SICRL : 0x%08x / 0x%08x\n", immr->sysconf.sicrh,
+               immr->sysconf.sicrl);
+
+       mvblm7_init_fpga();
+       if (load_fpga)
+               mvblm7_load_fpga();
+
+       /* Enable PCI_CLK_OUTPUTs 0 and 1 with 1:1 clocking */
+       clk->occr = 0xc0000000;
+
+       pci_ctrl[0].gcr = 0;
+       udelay(2000);
+       pci_ctrl[0].gcr = 1;
+
+       for (i = 0; i < 1000; ++i)
+               udelay(1000);
+
+       pci_law[0].bar = CFG_PCI1_MEM_PHYS & LAWBAR_BAR;
+       pci_law[0].ar = LBLAWAR_EN | LBLAWAR_1GB;
+
+       pci_law[1].bar = CFG_PCI1_IO_PHYS & LAWBAR_BAR;
+       pci_law[1].ar = LBLAWAR_EN | LBLAWAR_1MB;
+
+       warmboot = gd->bd->bi_bootflags & BOOTFLAG_WARM;
+
+       mpc83xx_pci_init(1, reg, warmboot);
+}
index dc526fcd7aa275c3ac3f9210bc0ff56089f49cd5..42c7c16cdf01ca5eed700d1b6bb14fa415bd29f9 100644 (file)
@@ -120,15 +120,6 @@ void hcu_led_set(u32 value)
        out_be32((u32 *)GPIO0_OR, tmp);
 }
 
-/*
- * sdram_init - Dummy implementation for start.S, spd_sdram  or initdram
- *             used for HCUx
- */
-void sdram_init(void)
-{
-       return;
-}
-
 /*
  * hcu_get_slot
  */
index 6b1b53a4d058bb62d08d583fe94e8a3555e3ec8e..d8817b831af0b51178756f1744ae41dd3daa0986 100644 (file)
 void hcu_led_set(u32 value);
 void dcbz_area(u32 start_address, u32 num_bytes);
 
-#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    */
-
-#define DDR0_01_INT_MASK_MASK             0x000000FF
-#define DDR0_00_INT_ACK_ALL               0x7F000000
-#define DDR0_01_INT_MASK_ALL_ON           0x000000FF
-#define DDR0_01_INT_MASK_ALL_OFF          0x00000000
-
-#define DDR0_17_DLLLOCKREG_MASK           0x00010000 /* Read only */
-#define DDR0_17_DLLLOCKREG_UNLOCKED       0x00000000
-#define DDR0_17_DLLLOCKREG_LOCKED         0x00010000
-
-#define DDR0_22                         0x16
-/* ECC */
-#define DDR0_22_CTRL_RAW_MASK             0x03000000
-#define DDR0_22_CTRL_RAW_ECC_DISABLE      0x00000000 /* ECC not enabled */
-#define DDR0_22_CTRL_RAW_ECC_CHECK_ONLY   0x01000000 /* ECC no correction */
-#define DDR0_22_CTRL_RAW_NO_ECC_RAM       0x02000000 /* Not a ECC RAM*/
-#define DDR0_22_CTRL_RAW_ECC_ENABLE       0x03000000 /* ECC correcting on */
-#define DDR0_03_CASLAT_DECODE(n)            ((((unsigned long)(n))>>16)&0x7)
-
 #define ECC_RAM                                0x03267F0B
 #define NO_ECC_RAM                     0x00267F0B
 
@@ -111,11 +89,11 @@ static int wait_for_dlllock(void)
        /* -----------------------------------------------------------+
         * Wait for the DCC master delay line to finish calibration
         * ----------------------------------------------------------*/
-       mtdcr(ddrcfga, DDR0_17);
+       mtdcr(memcfga, DDR0_17);
        val = DDR0_17_DLLLOCKREG_UNLOCKED;
 
        while (wait != 0xffff) {
-               val = mfdcr(ddrcfgd);
+               val = mfdcr(memcfgd);
                if ((val & DDR0_17_DLLLOCKREG_MASK) ==
                    DDR0_17_DLLLOCKREG_LOCKED)
                        /* dlllockreg bit on */
index 2b21444e2d2069b0a39f351b3b67f262fddf8ae1..07891f6785a83844c9780d031c23cbb7199f088b 100644 (file)
@@ -127,15 +127,6 @@ void hcu_led_set(u32 value)
    out_be16((u16 *)MCU25_LED_REGISTER_ADDRESS, value);
 }
 
-/*
- * sdram_init - Dummy implementation for start.S, spd_sdram  or initdram
- *             used for HCUx
- */
-void sdram_init(void)
-{
-       return;
-}
-
 /*
  * hcu_get_slot
  */
index 620000a229e14b35b8de1b9af859ed6e97b78fe1..2b8992ec1dc1e97f5d5ee88dc50e8753335463ec 100644 (file)
@@ -553,44 +553,6 @@ long int initdram (int board_type)
        return dram_size;
 }
 
-#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_KBYTES_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
  *
index cb6b37f95d57dbaddf7645719d11dda981f0fd19..d74d17abdf763bf5ac07c8d8dfe1e6d8611e5427 100644 (file)
 
 struct law_entry law_table[] = {
 #ifndef CONFIG_SPD_EEPROM
-       SET_LAW_ENTRY(1, CFG_DDR_SDRAM_BASE, LAW_SIZE_256M, LAW_TRGT_IF_DDR),
+       SET_LAW(CFG_DDR_SDRAM_BASE, LAW_SIZE_256M, LAW_TRGT_IF_DDR),
 #endif
-       SET_LAW_ENTRY(2, CFG_PCI1_MEM_PHYS, LAW_SIZE_512M, LAW_TRGT_IF_PCI),
+       SET_LAW(CFG_PCI1_MEM_PHYS, LAW_SIZE_512M, LAW_TRGT_IF_PCI),
        /* This is not so much the SDRAM map as it is the whole localbus map. */
-       SET_LAW_ENTRY(3, CFG_LBC_SDRAM_BASE, LAW_SIZE_256M, LAW_TRGT_IF_LBC),
-       SET_LAW_ENTRY(4, CFG_PCI1_IO_PHYS, LAW_SIZE_16M, LAW_TRGT_IF_PCI),
-       SET_LAW_ENTRY(5, CFG_RIO_MEM_BASE, LAWAR_SIZE_512M, LAW_TRGT_IF_RIO),
+       SET_LAW(CFG_LBC_SDRAM_BASE, LAW_SIZE_256M, LAW_TRGT_IF_LBC),
+       SET_LAW(CFG_PCI1_IO_PHYS, LAW_SIZE_16M, LAW_TRGT_IF_PCI),
+       SET_LAW(CFG_RIO_MEM_BASE, LAWAR_SIZE_512M, LAW_TRGT_IF_RIO),
 };
 
 int num_law_entries = ARRAY_SIZE(law_table);
index cb6b37f95d57dbaddf7645719d11dda981f0fd19..d74d17abdf763bf5ac07c8d8dfe1e6d8611e5427 100644 (file)
 
 struct law_entry law_table[] = {
 #ifndef CONFIG_SPD_EEPROM
-       SET_LAW_ENTRY(1, CFG_DDR_SDRAM_BASE, LAW_SIZE_256M, LAW_TRGT_IF_DDR),
+       SET_LAW(CFG_DDR_SDRAM_BASE, LAW_SIZE_256M, LAW_TRGT_IF_DDR),
 #endif
-       SET_LAW_ENTRY(2, CFG_PCI1_MEM_PHYS, LAW_SIZE_512M, LAW_TRGT_IF_PCI),
+       SET_LAW(CFG_PCI1_MEM_PHYS, LAW_SIZE_512M, LAW_TRGT_IF_PCI),
        /* This is not so much the SDRAM map as it is the whole localbus map. */
-       SET_LAW_ENTRY(3, CFG_LBC_SDRAM_BASE, LAW_SIZE_256M, LAW_TRGT_IF_LBC),
-       SET_LAW_ENTRY(4, CFG_PCI1_IO_PHYS, LAW_SIZE_16M, LAW_TRGT_IF_PCI),
-       SET_LAW_ENTRY(5, CFG_RIO_MEM_BASE, LAWAR_SIZE_512M, LAW_TRGT_IF_RIO),
+       SET_LAW(CFG_LBC_SDRAM_BASE, LAW_SIZE_256M, LAW_TRGT_IF_LBC),
+       SET_LAW(CFG_PCI1_IO_PHYS, LAW_SIZE_16M, LAW_TRGT_IF_PCI),
+       SET_LAW(CFG_RIO_MEM_BASE, LAWAR_SIZE_512M, LAW_TRGT_IF_RIO),
 };
 
 int num_law_entries = ARRAY_SIZE(law_table);
index 287f32e587a0ec398d3280fbfdbf04e0d3f97a23..8d60936881f4571f8975b8493ce00837b4a5f350 100644 (file)
@@ -132,36 +132,6 @@ int checkboard (void)
        return (0);
 }
 
-#if defined(CFG_DRAM_TEST)
-int testdram (void)
-{
-       uint *pstart = (uint *) 0x00000000;
-       uint *pend = (uint *) 0x08000000;
-       uint *p;
-
-       for (p = pstart; p < pend; p++)
-               *p = 0xaaaaaaaa;
-
-       for (p = pstart; p < pend; p++) {
-               if (*p != 0xaaaaaaaa) {
-                       printf ("SDRAM test fails at: %08x\n", (uint) p);
-                       return 1;
-               }
-       }
-
-       for (p = pstart; p < pend; p++)
-               *p = 0x55555555;
-
-       for (p = pstart; p < pend; p++) {
-               if (*p != 0x55555555) {
-                       printf ("SDRAM test fails at: %08x\n", (uint) p);
-                       return 1;
-               }
-       }
-       return 0;
-}
-#endif
-
 /*************************************************************************
  *  pci_pre_init
  *
index bcf3468ba68a71162377fecbb4ec8bf04c702c46..ab54260b0631109dc572113a9ef9772791d1006e 100644 (file)
 
 struct law_entry law_table[] = {
 #ifndef CONFIG_SPD_EEPROM
-       SET_LAW_ENTRY(1, CFG_DDR_SDRAM_BASE, LAW_SIZE_256M, LAW_TRGT_IF_DDR),
+       SET_LAW(CFG_DDR_SDRAM_BASE, LAW_SIZE_256M, LAW_TRGT_IF_DDR),
 #endif
-       SET_LAW_ENTRY(2, CFG_PCI1_MEM_PHYS, LAW_SIZE_512M, LAW_TRGT_IF_PCI),
-       SET_LAW_ENTRY(3, CFG_PCI1_IO_PHYS, LAW_SIZE_16M, LAW_TRGT_IF_PCI),
+       SET_LAW(CFG_PCI1_MEM_PHYS, LAW_SIZE_512M, LAW_TRGT_IF_PCI),
+       SET_LAW(CFG_PCI1_IO_PHYS, LAW_SIZE_16M, LAW_TRGT_IF_PCI),
        /* LBC window - maps 256M 0xf0000000 -> 0xffffffff */
-       SET_LAW_ENTRY(4, CFG_LBC_SDRAM_BASE, LAW_SIZE_256M, LAW_TRGT_IF_LBC),
+       SET_LAW(CFG_LBC_SDRAM_BASE, LAW_SIZE_256M, LAW_TRGT_IF_LBC),
 };
 
 int num_law_entries = ARRAY_SIZE(law_table);
index e370853e969132fbb12eccd1f6b84eac00fba348..10dedb481c2c7a1a8b6fc2fb13a40c751e391803 100644 (file)
 
 struct law_entry law_table[] = {
 #ifndef CONFIG_SPD_EEPROM
-       SET_LAW_ENTRY(1, CFG_DDR_SDRAM_BASE, LAW_SIZE_512M, LAW_TRGT_IF_DDR),
+       SET_LAW(CFG_DDR_SDRAM_BASE, LAW_SIZE_512M, LAW_TRGT_IF_DDR),
 #endif
-       SET_LAW_ENTRY(2, CFG_PCI_MEM_PHYS, LAW_SIZE_256M, LAW_TRGT_IF_PCI),
-       SET_LAW_ENTRY(3, CFG_LBC_SDRAM_BASE, LAW_SIZE_512M, LAW_TRGT_IF_LBC),
+       SET_LAW(CFG_PCI_MEM_PHYS, LAW_SIZE_256M, LAW_TRGT_IF_PCI),
+       SET_LAW(CFG_LBC_SDRAM_BASE, LAW_SIZE_512M, LAW_TRGT_IF_LBC),
 };
 
 int num_law_entries = ARRAY_SIZE(law_table);
index d403873d9e0009f955ed5acbb3e4b60e362adbea..801c5b75f74a1698a73eef5b651f50c5fc549718 100644 (file)
 
 
 struct law_entry law_table[] = {
-       SET_LAW_ENTRY(1, CFG_DDR_SDRAM_BASE, LAW_SIZE_256M, LAW_TRGT_IF_DDR_1),
-       SET_LAW_ENTRY(2, CFG_PCI1_MEM_BASE, LAW_SIZE_512M, LAW_TRGT_IF_PCI_1),
-       SET_LAW_ENTRY(3, CFG_PCI2_MEM_BASE, LAW_SIZE_512M, LAW_TRGT_IF_PCI_2),
-       SET_LAW_ENTRY(4, 0xf8000000, LAW_SIZE_2M, LAW_TRGT_IF_LBC),
-       SET_LAW_ENTRY(5, CFG_PCI1_IO_BASE, LAW_SIZE_16M, LAW_TRGT_IF_PCI_1),
-       SET_LAW_ENTRY(6, CFG_PCI2_IO_BASE, LAW_SIZE_16M, LAW_TRGT_IF_PCI_2),
-       SET_LAW_ENTRY(7, 0xfe000000, LAW_SIZE_32M, LAW_TRGT_IF_LBC),
-       SET_LAW_ENTRY(8, CFG_DDR_SDRAM_BASE, LAW_SIZE_256M, LAW_TRGT_IF_DDR_2),
-       SET_LAW_ENTRY(9, CFG_RIO_MEM_BASE, LAW_SIZE_512M, LAW_TRGT_IF_RIO)
+       SET_LAW(CFG_DDR_SDRAM_BASE, LAW_SIZE_256M, LAW_TRGT_IF_DDR_1),
+       SET_LAW(CFG_PCI1_MEM_BASE, LAW_SIZE_512M, LAW_TRGT_IF_PCI_1),
+       SET_LAW(CFG_PCI2_MEM_BASE, LAW_SIZE_512M, LAW_TRGT_IF_PCI_2),
+       SET_LAW(0xf8000000, LAW_SIZE_2M, LAW_TRGT_IF_LBC),
+       SET_LAW(CFG_PCI1_IO_BASE, LAW_SIZE_16M, LAW_TRGT_IF_PCI_1),
+       SET_LAW(CFG_PCI2_IO_BASE, LAW_SIZE_16M, LAW_TRGT_IF_PCI_2),
+       SET_LAW(0xfe000000, LAW_SIZE_32M, LAW_TRGT_IF_LBC),
+       SET_LAW(CFG_DDR_SDRAM_BASE, LAW_SIZE_256M, LAW_TRGT_IF_DDR_2),
+       SET_LAW(CFG_RIO_MEM_BASE, LAW_SIZE_512M, LAW_TRGT_IF_RIO)
 };
 
 int num_law_entries = ARRAY_SIZE(law_table);
index 6453f2480f1bbf94ea42eeab428746766aa5784f..11503ebe17198bedeaa452d6c9fef56f2ef7b234 100644 (file)
@@ -28,7 +28,7 @@ include $(TOPDIR)/config.mk
 LIB    = $(obj)lib$(BOARD).a
 #
 
-COBJS  := $(BOARD).o law.o tlb.o sdram.o
+COBJS  := $(BOARD).o law.o tlb.o sdram.o nand.o
 
 SRCS   := $(SOBJS:.o=.S) $(COBJS:.o=.c)
 OBJS   := $(addprefix $(obj),$(COBJS))
index 1cf5d380df0ed5918caa52ee46e0a58e262739e8..4f1729440a7fb66ae76523f1102026c17ce07101 100644 (file)
@@ -25,6 +25,5 @@
 #
 # socrates board
 # default CCARBAR is at 0xff700000
-# assume U-Boot is less than 256k
 #
-TEXT_BASE = 0xfffc0000
+TEXT_BASE = 0xfffa0000
index 5f4b8ca4f90c375bc07e287641026cfebe25e6c7..35c4a900a9bcd70995ca7c3235dbf77a17a89512 100644 (file)
 /*
  * LAW(Local Access Window) configuration:
  *
- * 0x0000_0000    0x7fff_ffff     DDR                     2G
+ * 0x0000_0000    0x2fff_ffff     DDR                     512M
  * 0x8000_0000    0x9fff_ffff     PCI1 MEM                512M
- * 0xc000_0000    0xdfff_ffff     RapidIO                 512M
- * 0xe000_0000    0xe000_ffff     CCSR                    1M
+ * 0xc000_0000    0xc00f_ffff     FPGA                    1M
+ * 0xe000_0000    0xe00f_ffff     CCSR                    1M (mapped by CCSRBAR)
  * 0xe200_0000    0xe2ff_ffff     PCI1 IO                 16M
- * 0xf800_0000    0xf80f_ffff     BCSR                    1M
- * 0xfe00_0000    0xffff_ffff     FLASH (boot bank)       32M
+ * 0xfc00_0000    0xffff_ffff     FLASH                   64M
  *
  * Notes:
  *    CCSRBAR and L2-as-SRAM don't need a configured Local Access Window.
  */
 
 struct law_entry law_table[] = {
-       SET_LAW_ENTRY(1, CFG_DDR_SDRAM_BASE, LAW_SIZE_512M, LAW_TRGT_IF_DDR),
-       SET_LAW_ENTRY(2, CFG_PCI1_MEM_PHYS, LAW_SIZE_512M, LAW_TRGT_IF_PCI),
-       SET_LAW_ENTRY(3, CFG_LBC_FLASH_BASE, LAW_SIZE_128M, LAW_TRGT_IF_LBC),
-       SET_LAW_ENTRY(4, CFG_PCI1_IO_PHYS, LAW_SIZE_16M, LAW_TRGT_IF_PCI),
-       SET_LAW_ENTRY(5, CFG_RIO_MEM_BASE, LAWAR_SIZE_512M, LAW_TRGT_IF_RIO),
+       SET_LAW(CFG_DDR_SDRAM_BASE, LAW_SIZE_512M, LAW_TRGT_IF_DDR),
+       SET_LAW(CFG_PCI1_MEM_PHYS, LAW_SIZE_512M, LAW_TRGT_IF_PCI),
+       SET_LAW(CFG_LBC_FLASH_BASE, LAW_SIZE_128M, LAW_TRGT_IF_LBC),
+       SET_LAW(CFG_PCI1_IO_PHYS, LAW_SIZE_16M, LAW_TRGT_IF_PCI),
+#if defined(CFG_FPGA_BASE)
+       SET_LAW(CFG_FPGA_BASE, LAWAR_SIZE_1M, LAW_TRGT_IF_LBC),
+#endif
 };
 
 int num_law_entries = ARRAY_SIZE(law_table);
diff --git a/board/socrates/nand.c b/board/socrates/nand.c
new file mode 100644 (file)
index 0000000..fc82ecb
--- /dev/null
@@ -0,0 +1,218 @@
+/*
+ * (C) Copyright 2008
+ * Sergei Poselenov, Emcraft Systems, sposelenov@emcraft.com.
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.         See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+#include <common.h>
+
+#if defined(CFG_NAND_BASE)
+#include <nand.h>
+#include <asm/errno.h>
+#include <asm/io.h>
+
+static int state;
+static void nand_write_byte(struct mtd_info *mtd, u_char byte);
+static void nand_write_buf(struct mtd_info *mtd, const u_char *buf, int len);
+static void nand_write_word(struct mtd_info *mtd, u16 word);
+static u_char nand_read_byte(struct mtd_info *mtd);
+static u16 nand_read_word(struct mtd_info *mtd);
+static void nand_read_buf(struct mtd_info *mtd, u_char *buf, int len);
+static int nand_verify_buf(struct mtd_info *mtd, const u_char *buf, int len);
+static int nand_device_ready(struct mtd_info *mtdinfo);
+static void nand_hwcontrol(struct mtd_info *mtdinfo, int cmd);
+
+#define FPGA_NAND_CMD_MASK             (0x7 << 28)
+#define FPGA_NAND_CMD_COMMAND  (0x0 << 28)
+#define FPGA_NAND_CMD_ADDR             (0x1 << 28)
+#define FPGA_NAND_CMD_READ             (0x2 << 28)
+#define FPGA_NAND_CMD_WRITE            (0x3 << 28)
+#define FPGA_NAND_BUSY                 (0x1 << 15)
+#define FPGA_NAND_ENABLE               (0x1 << 31)
+#define FPGA_NAND_DATA_SHIFT   16
+
+/**
+ * nand_write_byte -  write one byte to the chip
+ * @mtd:       MTD device structure
+ * @byte:      pointer to data byte to write
+ */
+static void nand_write_byte(struct mtd_info *mtd, u_char byte)
+{
+       nand_write_buf(mtd, (const uchar *)&byte, sizeof(byte));
+}
+
+/**
+ * nand_write_word -  write one word to the chip
+ * @mtd:       MTD device structure
+ * @word:      data word to write
+ */
+static void nand_write_word(struct mtd_info *mtd, u16 word)
+{
+       nand_write_buf(mtd, (const uchar *)&word, sizeof(word));
+}
+
+/**
+ * nand_write_buf -  write buffer to chip
+ * @mtd:       MTD device structure
+ * @buf:       data buffer
+ * @len:       number of bytes to write
+ */
+static void nand_write_buf(struct mtd_info *mtd, const u_char *buf, int len)
+{
+       int i;
+       struct nand_chip *this = mtd->priv;
+       long val;
+
+       if ((state & FPGA_NAND_CMD_MASK) == FPGA_NAND_CMD_MASK) {
+               /* Write data */
+               val = (state & FPGA_NAND_ENABLE) | FPGA_NAND_CMD_WRITE;
+       } else {
+               /* Write address or command */
+               val = state;
+       }
+
+       for (i = 0; i < len; i++) {
+               out_be32(this->IO_ADDR_W, val | (buf[i] << FPGA_NAND_DATA_SHIFT));
+       }
+}
+
+
+/**
+ * nand_read_byte -  read one byte from the chip
+ * @mtd:       MTD device structure
+ */
+static u_char nand_read_byte(struct mtd_info *mtd)
+{
+       u8 byte;
+       nand_read_buf(mtd, (uchar *)&byte, sizeof(byte));
+       return byte;
+}
+
+/**
+ * nand_read_word -  read one word from the chip
+ * @mtd:       MTD device structure
+ */
+static u16 nand_read_word(struct mtd_info *mtd)
+{
+       u16 word;
+       nand_read_buf(mtd, (uchar *)&word, sizeof(word));
+       return word;
+}
+
+/**
+ * nand_read_buf -  read chip data into buffer
+ * @mtd:       MTD device structure
+ * @buf:       buffer to store date
+ * @len:       number of bytes to read
+ */
+static void nand_read_buf(struct mtd_info *mtd, u_char *buf, int len)
+{
+       int i;
+       struct nand_chip *this = mtd->priv;
+       int val;
+
+       val = (state & FPGA_NAND_ENABLE) | FPGA_NAND_CMD_READ;
+
+       out_be32(this->IO_ADDR_W, val);
+       for (i = 0; i < len; i++) {
+               buf[i] = (in_be32(this->IO_ADDR_R) >> FPGA_NAND_DATA_SHIFT) & 0xff;
+       }
+}
+
+/**
+ * nand_verify_buf -  Verify chip data against buffer
+ * @mtd:       MTD device structure
+ * @buf:       buffer containing the data to compare
+ * @len:       number of bytes to compare
+ */
+static int nand_verify_buf(struct mtd_info *mtd, const u_char *buf, int len)
+{
+       int i;
+
+       for (i = 0; i < len; i++) {
+               if (buf[i] != nand_read_byte(mtd));
+               return -EFAULT;
+       }
+       return 0;
+}
+
+/**
+ * nand_device_ready - Check the NAND device is ready for next command.
+ * @mtd:       MTD device structure
+ */
+static int nand_device_ready(struct mtd_info *mtdinfo)
+{
+       struct nand_chip *this = mtdinfo->priv;
+
+       if (in_be32(this->IO_ADDR_W) & FPGA_NAND_BUSY)
+               return 0; /* busy */
+       return 1;
+}
+
+/**
+ * nand_hwcontrol - NAND control functions wrapper.
+ * @mtd:       MTD device structure
+ * @cmd:       Command
+ */
+static void nand_hwcontrol(struct mtd_info *mtdinfo, int cmd)
+{
+
+       switch(cmd) {
+       case NAND_CTL_CLRALE:
+               state |= FPGA_NAND_CMD_MASK; /* use all 1s to mark */
+               break;
+       case NAND_CTL_CLRCLE:
+               state |= FPGA_NAND_CMD_MASK; /* use all 1s to mark */
+               break;
+       case NAND_CTL_SETCLE:
+               state = (state & ~FPGA_NAND_CMD_MASK) | FPGA_NAND_CMD_COMMAND;
+               break;
+       case NAND_CTL_SETALE:
+               state = (state & ~FPGA_NAND_CMD_MASK) | FPGA_NAND_CMD_ADDR;
+               break;
+       case NAND_CTL_SETNCE:
+               state |= FPGA_NAND_ENABLE;
+               break;
+       case NAND_CTL_CLRNCE:
+               state &= ~FPGA_NAND_ENABLE;
+               break;
+       default:
+               printf("%s: unknown cmd %#x\n", __FUNCTION__, cmd);
+               break;
+       }
+}
+
+int board_nand_init(struct nand_chip *nand)
+{
+       nand->hwcontrol = nand_hwcontrol;
+       nand->eccmode = NAND_ECC_SOFT;
+       nand->dev_ready = nand_device_ready;
+       nand->write_byte = nand_write_byte;
+       nand->read_byte = nand_read_byte;
+       nand->write_word = nand_write_word;
+       nand->read_word = nand_read_word;
+       nand->write_buf = nand_write_buf;
+       nand->read_buf = nand_read_buf;
+       nand->verify_buf = nand_verify_buf;
+
+       return 0;
+}
+
+#endif
index 15c647884b48690884943f4eb512d4bf7aba773f..d791f1135f1036614a264c03af3dcad39b3f1243 100644 (file)
 #include <flash.h>
 #include <libfdt.h>
 #include <fdt_support.h>
+#include <asm/io.h>
 
+#if defined(CFG_FPGA_BASE)
+#include "upm_table.h"
+#endif
 DECLARE_GLOBAL_DATA_PTR;
 
 extern flash_info_t flash_info[];      /* FLASH chips info */
@@ -58,7 +62,8 @@ int checkboard (void)
        putc('\n');
 
 #ifdef CONFIG_PCI
-       if (gur->porpllsr & (1<<15)) {
+       /* Check the PCI_clk sel bit */
+       if (in_be32(&gur->porpllsr) & (1<<15)) {
                src = "SYSCLK";
                f = CONFIG_SYS_CLK_FREQ;
        } else {
@@ -74,7 +79,10 @@ int checkboard (void)
         * Initialize local bus.
         */
        local_bus_init ();
-
+#if defined(CFG_FPGA_BASE)
+       /* Init UPMA for FPGA access */
+       upmconfig(UPMA, (uint *)UPMTableA, sizeof(UPMTableA)/sizeof(int));
+#endif
        return 0;
 }
 
@@ -216,5 +224,15 @@ ft_board_setup(void *blob, bd_t *bd)
        if (rc)
                printf("Unable to update property NOR mapping, err=%s\n",
                       fdt_strerror(rc));
+
+#if defined (CFG_FPGA_BASE)
+       memset(val, 0, sizeof(val));
+       val[0] = CFG_FPGA_BASE;
+       rc = fdt_find_and_setprop(blob, "/localbus/fpga", "virtual-reg",
+                                 val, sizeof(val), 1);
+       if (rc)
+               printf("Unable to update property \"fpga\", err=%s\n",
+                      fdt_strerror(rc));
+#endif
 }
 #endif /* defined(CONFIG_OF_LIBFDT) && defined(CONFIG_OF_BOARD_SETUP) */
index b80caea5e06546ef5cf69fff8ae56fba67726387..aea99ada20adeaaab9995c5b6ca2b7f4c654d1a7 100644 (file)
@@ -46,16 +46,13 @@ struct fsl_e_tlb_entry tlb_table[] = {
 
 
        /*
-        * TLB 0, 1:    128M    Non-cacheable, guarded
-        * 0xf8000000   128M    FLASH
+        * TLB 0:       64M     Non-cacheable, guarded
+        * 0xfc000000   64M     FLASH
         * Out of reset this entry is only 4K.
         */
        SET_TLB_ENTRY(1, CFG_FLASH_BASE, CFG_FLASH_BASE,
                      MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
                      0, 1, BOOKE_PAGESZ_64M, 1),
-       SET_TLB_ENTRY(1, CFG_FLASH_BASE + 0x4000000, CFG_FLASH_BASE + 0x4000000,
-                     MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
-                     0, 0, BOOKE_PAGESZ_64M, 1),
 
        /*
         * TLB 2:       256M    Non-cacheable, guarded
@@ -73,21 +70,15 @@ struct fsl_e_tlb_entry tlb_table[] = {
                      MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
                      0, 3, BOOKE_PAGESZ_256M, 1),
 
+#if defined(CFG_FPGA_BASE)
        /*
-        * TLB 4:       256M    Non-cacheable, guarded
-        * 0xc0000000   256M    Rapid IO MEM First half
-        */
-       SET_TLB_ENTRY(1, CFG_RIO_MEM_BASE, CFG_RIO_MEM_BASE,
-                     MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
-                     0, 4, BOOKE_PAGESZ_256M, 1),
-
-       /*
-        * TLB 5:       256M    Non-cacheable, guarded
-        * 0xd0000000   256M    Rapid IO MEM Second half
+        * TLB 4:       1M      Non-cacheable, guarded
+        * 0xc0000000   1M      FPGA and NAND
         */
-       SET_TLB_ENTRY(1, CFG_RIO_MEM_BASE + 0x10000000, CFG_RIO_MEM_BASE + 0x10000000,
+       SET_TLB_ENTRY(1, CFG_FPGA_BASE, CFG_FPGA_BASE,
                      MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
-                     0, 5, BOOKE_PAGESZ_256M, 1),
+                     0, 4, BOOKE_PAGESZ_1M, 1),
+#endif
 
        /*
         * TLB 6:       64M     Non-cacheable, guarded
diff --git a/board/socrates/upm_table.h b/board/socrates/upm_table.h
new file mode 100644 (file)
index 0000000..f26d8a7
--- /dev/null
@@ -0,0 +1,55 @@
+/*
+ * (C) Copyright 2008
+ * Sergei Poselenov, Emcraft Systems, sposelenov@emcraft.com.
+ *
+ * Copyright 2004, 2007 Freescale Semiconductor, Inc.
+ * (C) Copyright 2003 Motorola Inc.
+ * Xianghua Xiao, (X.Xiao@motorola.com)
+ *
+ * (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
+ */
+
+#ifndef __UPM_TABLE_H
+#define __UPM_TABLE_H
+
+/* UPM Table Configuration Code for FPGA access */
+static const unsigned int UPMTableA[] =
+{
+       0x00fcfc00,  0x00fcfc00,  0x00fcfc00,  0x00fcfc00, //Words 0 to 3
+       0x00fcfc00,  0x00fcfc00,  0x00fcfc00,  0x00fcfc05, //Words 4 to 7
+       0x00fcfc00,  0x00fcfc00,  0x00fcfc04,  0x00fcfc04, //Words 8 to 11
+       0x00fcfc04,  0x00fcfc04,  0x00fcfc04,  0x00fcfc04, //Words 12 to 15
+       0x00fcfc04,  0x00fcfc04,  0x00fcfc00,  0xfffffc00, //Words 16 to 19
+       0xfffffc00,  0xfffffc00,  0xfffffc00,  0xfffffc01, //Words 20 to 23
+       0x0ffffc00,  0x0ffffc00,  0x0ffffc00,  0x00f3fc04, //Words 24 to 27
+       0x0ffffc00,  0xfffffc01,  0xfffffc00,  0xfffffc01, //Words 28 to 31
+       0x0ffffc00,  0x00f3fc04,  0x00f3fc04,  0x00f3fc04, //Words 32 to 35
+       0x00f3fc04,  0x00f3fc04,  0x00f3fc04,  0x00f3fc04, //Words 36 to 39
+       0x00f3fc04,  0x0ffffc00,  0xfffffc00,  0xfffffc00, //Words 40 to 43
+       0xfffffc01,  0xfffffc00,  0xfffffc00,  0xfffffc01, //Words 44 to 47
+       0xfffffc00,  0xfffffc00,  0xfffffc00,  0xfffffc00, //Words 48 to 51
+       0xfffffc00,  0xfffffc00,  0xfffffc00,  0xfffffc00, //Words 52 to 55
+       0xfffffc00,  0xfffffc00,  0xfffffc00,  0xfffffc01, //Words 56 to 59
+       0xfffffc00,  0xfffffc00,  0xfffffc00,  0xfffffc01  //Words 60 to 63
+};
+
+#endif
index 312b3c55717c7413edfb272372c3d2634761b91e..a7e9ceb033cf69d84522069ddf2828318487a6cc 100644 (file)
 
 struct law_entry law_table[] = {
 #ifndef CONFIG_SPD_EEPROM
-       SET_LAW_ENTRY(1, CFG_DDR_SDRAM_BASE, LAW_SIZE_128M, LAW_TRGT_IF_DDR),
+       SET_LAW(CFG_DDR_SDRAM_BASE, LAW_SIZE_128M, LAW_TRGT_IF_DDR),
 #endif
-       SET_LAW_ENTRY(2, CFG_PCI1_MEM_PHYS, LAW_SIZE_512M, LAW_TRGT_IF_PCI),
+       SET_LAW(CFG_PCI1_MEM_PHYS, LAW_SIZE_512M, LAW_TRGT_IF_PCI),
        /* This is not so much the SDRAM map as it is the whole localbus map. */
-       SET_LAW_ENTRY(3, CFG_LBC_SDRAM_BASE, LAW_SIZE_256M, LAW_TRGT_IF_LBC),
-       SET_LAW_ENTRY(4, CFG_PCI1_IO_PHYS, LAW_SIZE_16M, LAW_TRGT_IF_PCI),
-       SET_LAW_ENTRY(5, CFG_RIO_MEM_BASE, LAWAR_SIZE_512M, LAW_TRGT_IF_RIO),
+       SET_LAW(CFG_LBC_SDRAM_BASE, LAW_SIZE_256M, LAW_TRGT_IF_LBC),
+       SET_LAW(CFG_PCI1_IO_PHYS, LAW_SIZE_16M, LAW_TRGT_IF_PCI),
+       SET_LAW(CFG_RIO_MEM_BASE, LAWAR_SIZE_512M, LAW_TRGT_IF_RIO),
 };
 
 int num_law_entries = ARRAY_SIZE(law_table);
index 2b25292988c9e91cac512ffeb68e1bb469ed7cab..8730cdfc4e669e1a3d2a6e93fe488f9bc58d192e 100644 (file)
 
 struct law_entry law_table[] = {
 #ifndef CONFIG_SPD_EEPROM
-       SET_LAW_ENTRY(1, CFG_DDR_SDRAM_BASE, LAW_SIZE_128M, LAW_TRGT_IF_DDR),
+       SET_LAW(CFG_DDR_SDRAM_BASE, LAW_SIZE_128M, LAW_TRGT_IF_DDR),
 #endif
-       SET_LAW_ENTRY(2, CFG_PCI1_MEM_PHYS, LAW_SIZE_512M, LAW_TRGT_IF_PCI_1),
-       SET_LAW_ENTRY(3, CFG_PCI2_MEM_PHYS, LAW_SIZE_512M, LAW_TRGT_IF_PCI_2),
-       SET_LAW_ENTRY(4, CFG_PCI1_IO_PHYS, LAW_SIZE_16M, LAW_TRGT_IF_PCI_1),
-       SET_LAW_ENTRY(5, CFG_PCI2_IO_PHYS, LAW_SIZE_16M, LAW_TRGT_IF_PCI_2),
+       SET_LAW(CFG_PCI1_MEM_PHYS, LAW_SIZE_512M, LAW_TRGT_IF_PCI_1),
+       SET_LAW(CFG_PCI2_MEM_PHYS, LAW_SIZE_512M, LAW_TRGT_IF_PCI_2),
+       SET_LAW(CFG_PCI1_IO_PHYS, LAW_SIZE_16M, LAW_TRGT_IF_PCI_1),
+       SET_LAW(CFG_PCI2_IO_PHYS, LAW_SIZE_16M, LAW_TRGT_IF_PCI_2),
        /* Map the whole localbus, including flash and reset latch. */
-       SET_LAW_ENTRY(6, CFG_LBC_OPTION_BASE, LAWAR_SIZE_256M, LAW_TRGT_IF_LBC),
+       SET_LAW(CFG_LBC_OPTION_BASE, LAWAR_SIZE_256M, LAW_TRGT_IF_LBC),
 };
 
 int num_law_entries = ARRAY_SIZE(law_table);
diff --git a/board/tqc/tqm5200/Makefile b/board/tqc/tqm5200/Makefile
new file mode 100644 (file)
index 0000000..a5ce7bd
--- /dev/null
@@ -0,0 +1,53 @@
+#
+# (C) Copyright 2003-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 cmd_stk52xx.o cmd_tb5200.o cam5200_flash.o
+
+SRCS   := $(SOBJS:.o=.S) $(COBJS:.o=.c)
+OBJS   := $(addprefix $(obj),$(COBJS))
+SOBJS  := $(addprefix $(obj),$(SOBJS))
+
+$(LIB):        $(obj).depend $(OBJS)
+       $(AR) $(ARFLAGS) $@ $(OBJS)
+
+clean:
+       rm -f $(SOBJS) $(OBJS)
+
+distclean:     clean
+       rm -f $(LIB) core *.bak .depend
+
+cam5200_flash.o:       cam5200_flash.c
+       $(CC) $(CFLAGS) -fno-strict-aliasing -c -o $@ $<
+
+#########################################################################
+
+# defines $(obj).depend target
+include $(SRCTREE)/rules.mk
+
+sinclude $(obj).depend
+
+#########################################################################
diff --git a/board/tqc/tqm5200/cam5200_flash.c b/board/tqc/tqm5200/cam5200_flash.c
new file mode 100644 (file)
index 0000000..b3f095d
--- /dev/null
@@ -0,0 +1,786 @@
+/*
+ * (C) Copyright 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 <common.h>
+#include <mpc5xxx.h>
+#include <asm/processor.h>
+
+#if defined(CONFIG_CAM5200) && defined(CONFIG_CAM5200_NIOSFLASH)
+
+#if 0
+#define DEBUGF(x...) printf(x)
+#else
+#define DEBUGF(x...)
+#endif
+
+#define swap16(x) __swab16(x)
+
+flash_info_t flash_info[CFG_MAX_FLASH_BANKS];  /* info for FLASH chips */
+
+/*
+ * CAM5200 is a TQM5200B based board. Additionally it also features
+ * a NIOS cpu. The NIOS CPU peripherals are accessible through MPC5xxx
+ * Local Bus on CS5. This includes 32 bit wide RAM and SRAM as well as
+ * 16 bit wide flash device. Big Endian order on a 32 bit CS5 makes
+ * access to flash chip slightly more complicated as additional byte
+ * swapping is necessary within each 16 bit wide flash 'word'.
+ *
+ * This driver's task is to handle both flash devices: 32 bit TQM5200B
+ * flash chip and 16 bit NIOS cpu flash chip. In the below
+ * flash_addr_table table we use least significant address bit to mark
+ * 16 bit flash bank and two sets of routines *_32 and *_16 to handle
+ * specifics of both flashes.
+ */
+static unsigned long flash_addr_table[][CFG_MAX_FLASH_BANKS] = {
+       {CFG_BOOTCS_START, CFG_CS5_START | 1}
+};
+
+/*-----------------------------------------------------------------------
+ * Functions
+ */
+static int write_word(flash_info_t * info, ulong dest, ulong data);
+#ifdef CFG_FLASH_2ND_16BIT_DEV
+static int write_word_32(flash_info_t * info, ulong dest, ulong data);
+static int write_word_16(flash_info_t * info, ulong dest, ulong data);
+static int flash_erase_32(flash_info_t * info, int s_first, int s_last);
+static int flash_erase_16(flash_info_t * info, int s_first, int s_last);
+static ulong flash_get_size_32(vu_long * addr, flash_info_t * info);
+static ulong flash_get_size_16(vu_long * addr, flash_info_t * info);
+#endif
+
+void flash_print_info(flash_info_t * info)
+{
+       int i, k;
+       int size, erased;
+       volatile unsigned long *flash;
+
+       if (info->flash_id == FLASH_UNKNOWN) {
+               printf("missing or unknown FLASH type\n");
+               return;
+       }
+
+       switch (info->flash_id & FLASH_VENDMASK) {
+               case FLASH_MAN_AMD:
+                       printf("AMD ");
+                       break;
+               case FLASH_MAN_FUJ:
+                       printf("FUJITSU ");
+                       break;
+               default:
+                       printf("Unknown Vendor ");
+                       break;
+       }
+
+       switch (info->flash_id & FLASH_TYPEMASK) {
+               case FLASH_S29GL128N:
+                       printf ("S29GL128N (256 Mbit, uniform sector size)\n");
+                       break;
+               case FLASH_AM320B:
+                       printf ("29LV320B (32 Mbit, bottom boot sect)\n");
+                       break;
+               case FLASH_AM320T:
+                       printf ("29LV320T (32 Mbit, top boot sect)\n");
+                       break;
+               default:
+                       printf("Unknown Chip Type\n");
+                       break;
+       }
+
+       printf("  Size: %ld KB in %d Sectors\n",
+                       info->size >> 10, info->sector_count);
+
+       printf("  Sector Start Addresses:");
+       for (i = 0; i < info->sector_count; ++i) {
+               /*
+                * Check if whole sector is erased
+                */
+               if (i != (info->sector_count - 1))
+                       size = info->start[i + 1] - info->start[i];
+               else
+                       size = info->start[0] + info->size - info->start[i];
+
+               erased = 1;
+               flash = (volatile unsigned long *)info->start[i];
+               size = size >> 2;       /* divide by 4 for longword access */
+
+               for (k = 0; k < size; k++) {
+                       if (*flash++ != 0xffffffff) {
+                               erased = 0;
+                               break;
+                       }
+               }
+
+               if ((i % 5) == 0)
+                       printf("\n   ");
+
+               printf(" %08lX%s%s", info->start[i],
+                               erased ? " E" : "  ",
+                               info->protect[i] ? "RO " : "   ");
+       }
+       printf("\n");
+       return;
+}
+
+
+/*
+ * The following code cannot be run from FLASH!
+ */
+#ifdef CFG_FLASH_2ND_16BIT_DEV
+static ulong flash_get_size(vu_long * addr, flash_info_t * info)
+{
+
+       DEBUGF("get_size: FLASH ADDR %08lx\n", addr);
+
+       /* bit 0 used for big flash marking */
+       if ((ulong)addr & 0x1)
+               return flash_get_size_16((vu_long *)((ulong)addr & 0xfffffffe), info);
+       else
+               return flash_get_size_32(addr, info);
+}
+
+static ulong flash_get_size_32(vu_long * addr, flash_info_t * info)
+#else
+static ulong flash_get_size(vu_long * addr, flash_info_t * info)
+#endif
+{
+       short i;
+       CFG_FLASH_WORD_SIZE value;
+       ulong base = (ulong) addr;
+       volatile CFG_FLASH_WORD_SIZE *addr2 = (CFG_FLASH_WORD_SIZE *) addr;
+
+       DEBUGF("get_size32: FLASH ADDR: %08x\n", (unsigned)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];
+       DEBUGF("FLASH MANUFACT: %x\n", value);
+
+       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            */
+       DEBUGF("\nFLASH DEVICEID: %x\n", value);
+
+       switch (value) {
+               case AMD_ID_MIRROR:
+                       DEBUGF("Mirror Bit flash: addr[14] = %08lX  addr[15] = %08lX\n",
+                                       addr[14], addr[15]);
+                       switch(addr[14]) {
+                               case AMD_ID_GL128N_2:
+                                       if (addr[15] != AMD_ID_GL128N_3) {
+                                               DEBUGF("Chip: S29GL128N -> unknown\n");
+                                               info->flash_id = FLASH_UNKNOWN;
+                                       } else {
+                                               DEBUGF("Chip: S29GL128N\n");
+                                               info->flash_id += FLASH_S29GL128N;
+                                               info->sector_count = 128;
+                                               info->size = 0x02000000;
+                                       }
+                                       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 * 0x00040000);
+
+       /* check for protected sectors */
+       for (i = 0; i < info->sector_count; i++) {
+               /* read sector protection at sector address, (A7 .. A0) = 0x02 */
+               /* D0 = 1 if protected */
+               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 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;
+}
+
+#ifdef CFG_FLASH_2ND_16BIT_DEV
+int flash_erase(flash_info_t * info, int s_first, int s_last)
+{
+       if ((info->flash_id & FLASH_TYPEMASK) == FLASH_AM320B) {
+               return flash_erase_16(info, s_first, s_last);
+       } else {
+               return flash_erase_32(info, s_first, s_last);
+       }
+}
+
+static int flash_erase_32(flash_info_t * info, int s_first, int s_last)
+#else
+int flash_erase(flash_info_t * info, int s_first, int s_last)
+#endif
+{
+       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;
+
+       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)!!
+                        */
+                       wait_for_DQ7_32(info, sect);
+               }
+       }
+
+       /* re-enable interrupts if necessary */
+       if (flag)
+               enable_interrupts();
+
+       /* wait at least 80us - let's wait 1 ms */
+       udelay(1000);
+
+       /* reset to read mode */
+       addr = (CFG_FLASH_WORD_SIZE *) info->start[0];
+       addr[0] = (CFG_FLASH_WORD_SIZE) 0x00F000F0;     /* reset bank */
+
+       printf(" done\n");
+       return 0;
+}
+
+/*-----------------------------------------------------------------------
+ * Copy memory to flash, returns:
+ * 0 - OK
+ * 1 - write timeout
+ * 2 - Flash not erased
+ */
+int write_buff(flash_info_t * info, uchar * src, ulong addr, ulong cnt)
+{
+       ulong cp, wp, data;
+       int i, l, rc;
+
+       wp = (addr & ~3);       /* get lower word aligned address */
+
+       /*
+        * handle unaligned start bytes
+        */
+       if ((l = addr - wp) != 0) {
+               data = 0;
+               for (i = 0, cp = wp; i < l; ++i, ++cp)
+                       data = (data << 8) | (*(uchar *) cp);
+
+               for (; i < 4 && cnt > 0; ++i) {
+                       data = (data << 8) | *src++;
+                       --cnt;
+                       ++cp;
+               }
+
+               for (; cnt == 0 && i < 4; ++i, ++cp)
+                       data = (data << 8) | (*(uchar *) cp);
+
+               if ((rc = write_word(info, wp, data)) != 0)
+                       return (rc);
+
+               wp += 4;
+       }
+
+       /*
+        * handle word aligned part
+        */
+       while (cnt >= 4) {
+               data = 0;
+               for (i = 0; i < 4; ++i)
+                       data = (data << 8) | *src++;
+
+               if ((rc = write_word(info, wp, data)) != 0)
+                       return (rc);
+
+               wp += 4;
+               cnt -= 4;
+       }
+
+       if (cnt == 0)
+               return (0);
+
+       /*
+        * handle unaligned tail bytes
+        */
+       data = 0;
+       for (i = 0, cp = wp; i < 4 && cnt > 0; ++i, ++cp) {
+               data = (data << 8) | *src++;
+               --cnt;
+       }
+       for (; i < 4; ++i, ++cp)
+               data = (data << 8) | (*(uchar *) cp);
+
+       return (write_word(info, wp, data));
+}
+
+/*-----------------------------------------------------------------------
+ * Copy memory to flash, returns:
+ * 0 - OK
+ * 1 - write timeout
+ * 2 - Flash not erased
+ */
+#ifdef CFG_FLASH_2ND_16BIT_DEV
+static int write_word(flash_info_t * info, ulong dest, ulong data)
+{
+       if ((info->flash_id & FLASH_TYPEMASK) == FLASH_AM320B) {
+               return write_word_16(info, dest, data);
+       } else {
+               return write_word_32(info, dest, data);
+       }
+}
+
+static int write_word_32(flash_info_t * info, ulong dest, ulong data)
+#else
+static int write_word(flash_info_t * info, ulong dest, ulong data)
+#endif
+{
+       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 i, flag;
+
+       /* Check if Flash is (sufficiently) erased */
+       if ((*((vu_long *)dest) & data) != data)
+               return (2);
+
+       for (i = 0; i < 4 / sizeof(CFG_FLASH_WORD_SIZE); i++) {
+               /* 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[i] = data2[i];
+
+               /* re-enable interrupts if necessary */
+               if (flag)
+                       enable_interrupts();
+
+               /* data polling for D7 */
+               start = get_timer(0);
+               while ((dest2[i] & (CFG_FLASH_WORD_SIZE) 0x00800080) !=
+                               (data2[i] & (CFG_FLASH_WORD_SIZE) 0x00800080)) {
+
+                       if (get_timer(start) > CFG_FLASH_WRITE_TOUT)
+                               return (1);
+               }
+       }
+
+       return (0);
+}
+
+#ifdef CFG_FLASH_2ND_16BIT_DEV
+
+#undef  CFG_FLASH_WORD_SIZE
+#define CFG_FLASH_WORD_SIZE unsigned short
+
+/*
+ * The following code cannot be run from FLASH!
+ */
+static ulong flash_get_size_16(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;
+
+       DEBUGF("get_size16: FLASH ADDR: %08x\n", (unsigned)addr);
+
+       /* issue bank reset to return to read mode */
+       addr2[0] = (CFG_FLASH_WORD_SIZE) 0xF000F000;
+
+       /* Write auto select command: read Manufacturer ID */
+       addr2[CFG_FLASH_ADDR0] = (CFG_FLASH_WORD_SIZE) 0xAA00AA00;
+       addr2[CFG_FLASH_ADDR1] = (CFG_FLASH_WORD_SIZE) 0x55005500;
+       addr2[CFG_FLASH_ADDR0] = (CFG_FLASH_WORD_SIZE) 0x90009000;
+       udelay(1000);
+
+       value = swap16(addr2[0]);
+       DEBUGF("FLASH MANUFACT: %x\n", value);
+
+       switch (value) {
+               case (CFG_FLASH_WORD_SIZE) AMD_MANUFACT:
+                       info->flash_id = FLASH_MAN_AMD;
+                       break;
+               case (CFG_FLASH_WORD_SIZE) FUJ_MANUFACT:
+                       info->flash_id = FLASH_MAN_FUJ;
+                       break;
+               default:
+                       info->flash_id = FLASH_UNKNOWN;
+                       info->sector_count = 0;
+                       info->size = 0;
+                       return (0);     /* no or unknown flash  */
+       }
+
+       value = swap16(addr2[1]);       /* device ID            */
+       DEBUGF("\nFLASH DEVICEID: %x\n", value);
+
+       switch (value) {
+               case (CFG_FLASH_WORD_SIZE)AMD_ID_LV320B:
+                       info->flash_id += FLASH_AM320B;
+                       info->sector_count = 71;
+                       info->size = 0x00400000;
+                       break;  /* => 4 MB      */
+               case (CFG_FLASH_WORD_SIZE)AMD_ID_LV320T:
+                       info->flash_id += FLASH_AM320T;
+                       info->sector_count = 71;
+                       info->size = 0x00400000;
+                       break;  /* => 4 MB      */
+               default:
+                       info->flash_id = FLASH_UNKNOWN;
+                       return (0);     /* => no or unknown flash */
+       }
+
+       if (info->flash_id & FLASH_BTYPE) {
+               /* set sector offsets for bottom boot block type        */
+               info->start[0] = base + 0x00000000;
+               info->start[1] = base + 0x00002000;
+               info->start[2] = base + 0x00004000;
+               info->start[3] = base + 0x00006000;
+               info->start[4] = base + 0x00008000;
+               info->start[5] = base + 0x0000a000;
+               info->start[6] = base + 0x0000c000;
+               info->start[7] = base + 0x0000e000;
+
+               for (i = 8; i < info->sector_count; i++)
+                       info->start[i] = base + (i * 0x00010000) - 0x00070000;
+       } else {
+               /* set sector offsets for top boot block type           */
+               i = info->sector_count - 1;
+               info->start[i--] = base + info->size - 0x00002000;
+               info->start[i--] = base + info->size - 0x00004000;
+               info->start[i--] = base + info->size - 0x00006000;
+               info->start[i--] = base + info->size - 0x00008000;
+               info->start[i--] = base + info->size - 0x0000a000;
+               info->start[i--] = base + info->size - 0x0000c000;
+               info->start[i--] = base + info->size - 0x0000e000;
+
+               for (; i >= 0; i--)
+                       info->start[i] = base + i * 0x00010000;
+       }
+
+       /* check for protected sectors */
+       for (i = 0; i < info->sector_count; i++) {
+               /* read sector protection at sector address, (A7 .. A0) = 0x02 */
+               /* D0 = 1 if protected */
+               addr2 = (volatile 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) 0xF000F000;
+
+       return (info->size);
+}
+
+static int wait_for_DQ7_16(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) 0x80008000) !=
+                       (CFG_FLASH_WORD_SIZE) 0x80008000) {
+               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;
+}
+
+static int flash_erase_16(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;
+
+       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) 0xAA00AA00;
+                       addr[CFG_FLASH_ADDR1] = (CFG_FLASH_WORD_SIZE) 0x55005500;
+                       addr[CFG_FLASH_ADDR0] = (CFG_FLASH_WORD_SIZE) 0x80008000;
+                       addr[CFG_FLASH_ADDR0] = (CFG_FLASH_WORD_SIZE) 0xAA00AA00;
+                       addr[CFG_FLASH_ADDR1] = (CFG_FLASH_WORD_SIZE) 0x55005500;
+                       addr2[0] = (CFG_FLASH_WORD_SIZE) 0x30003000;    /* sector erase */
+
+                       l_sect = sect;
+                       /*
+                        * Wait for each sector to complete, it's more
+                        * reliable.  According to AMD Spec, you must
+                        * issue all erase commands within a specified
+                        * timeout.  This has been seen to fail, especially
+                        * if printf()s are included (for debug)!!
+                        */
+                       wait_for_DQ7_16(info, sect);
+               }
+       }
+
+       /* re-enable interrupts if necessary */
+       if (flag)
+               enable_interrupts();
+
+       /* wait at least 80us - let's wait 1 ms */
+       udelay(1000);
+
+       /* reset to read mode */
+       addr = (CFG_FLASH_WORD_SIZE *) info->start[0];
+       addr[0] = (CFG_FLASH_WORD_SIZE) 0xF000F000;     /* reset bank */
+
+       printf(" done\n");
+       return 0;
+}
+
+static int write_word_16(flash_info_t * info, ulong dest, ulong 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 i;
+
+       /* Check if Flash is (sufficiently) erased */
+       for (i = 0; i < 4 / sizeof(CFG_FLASH_WORD_SIZE); i++) {
+               if ((dest2[i] & swap16(data2[i])) != swap16(data2[i]))
+                       return (2);
+       }
+
+       for (i = 0; i < 4 / sizeof(CFG_FLASH_WORD_SIZE); i++) {
+               int flag;
+
+               /* Disable interrupts which might cause a timeout here */
+               flag = disable_interrupts();
+
+               addr2[CFG_FLASH_ADDR0] = (CFG_FLASH_WORD_SIZE) 0xAA00AA00;
+               addr2[CFG_FLASH_ADDR1] = (CFG_FLASH_WORD_SIZE) 0x55005500;
+               addr2[CFG_FLASH_ADDR0] = (CFG_FLASH_WORD_SIZE) 0xA000A000;
+
+               dest2[i] = swap16(data2[i]);
+
+               /* re-enable interrupts if necessary */
+               if (flag)
+                       enable_interrupts();
+
+               /* data polling for D7 */
+               start = get_timer(0);
+               while ((dest2[i] & (CFG_FLASH_WORD_SIZE) 0x80008000) !=
+                               (swap16(data2[i]) & (CFG_FLASH_WORD_SIZE) 0x80008000)) {
+
+                       if (get_timer(start) > CFG_FLASH_WRITE_TOUT) {
+                               return (1);
+                       }
+               }
+       }
+
+       return (0);
+}
+#endif /* CFG_FLASH_2ND_16BIT_DEV */
+
+/*-----------------------------------------------------------------------
+ * Functions
+ */
+static ulong flash_get_size(vu_long * addr, flash_info_t * info);
+static int write_word(flash_info_t * info, ulong dest, ulong data);
+
+/*-----------------------------------------------------------------------
+ */
+
+unsigned long flash_init(void)
+{
+       unsigned long total_b = 0;
+       unsigned long size_b[CFG_MAX_FLASH_BANKS];
+       unsigned short index = 0;
+       int i;
+
+       DEBUGF("\n");
+       DEBUGF("FLASH: Index: %d\n", index);
+
+       /* Init: no FLASHes known */
+       for (i = 0; i < CFG_MAX_FLASH_BANKS; ++i) {
+               flash_info[i].flash_id = FLASH_UNKNOWN;
+               flash_info[i].sector_count = -1;
+               flash_info[i].size = 0;
+
+               /* check whether the address is 0 */
+               if (flash_addr_table[index][i] == 0)
+                       continue;
+
+               /* call flash_get_size() to initialize sector address */
+               size_b[i] = flash_get_size((vu_long *) flash_addr_table[index][i],
+                               &flash_info[i]);
+
+               flash_info[i].size = size_b[i];
+
+               if (flash_info[i].flash_id == FLASH_UNKNOWN) {
+                       printf("## Unknown FLASH on Bank %d - Size = 0x%08lx = %ld MB\n",
+                                       i+1, size_b[i], size_b[i] << 20);
+                       flash_info[i].sector_count = -1;
+                       flash_info[i].size = 0;
+               }
+
+               /* Monitor protection ON by default */
+               (void)flash_protect(FLAG_PROTECT_SET, CFG_MONITOR_BASE,
+                                   CFG_MONITOR_BASE + CFG_MONITOR_LEN - 1,
+                                   &flash_info[i]);
+#if defined(CFG_ENV_IS_IN_FLASH)
+               (void)flash_protect(FLAG_PROTECT_SET, CFG_ENV_ADDR,
+                                   CFG_ENV_ADDR + CFG_ENV_SECT_SIZE - 1,
+                                   &flash_info[i]);
+#if defined(CFG_ENV_ADDR_REDUND)
+               (void)flash_protect(FLAG_PROTECT_SET, CFG_ENV_ADDR_REDUND,
+                                   CFG_ENV_ADDR_REDUND + CFG_ENV_SECT_SIZE - 1,
+                                   &flash_info[i]);
+#endif
+#endif
+               total_b += flash_info[i].size;
+       }
+
+       return total_b;
+}
+#endif /* if defined(CONFIG_CAM5200) && defined(CONFIG_CAM5200_NIOSFLASH) */
diff --git a/board/tqc/tqm5200/cmd_stk52xx.c b/board/tqc/tqm5200/cmd_stk52xx.c
new file mode 100644 (file)
index 0000000..7472ca9
--- /dev/null
@@ -0,0 +1,1247 @@
+/*
+ * (C) Copyright 2005
+ * Martin Krause, TQ-Systems GmbH, martin.krause@tqs.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
+ */
+
+/*
+ * STK52XX specific functions
+ */
+/*#define DEBUG*/
+
+#include <common.h>
+#include <command.h>
+
+#if defined(CONFIG_CMD_BSP)
+
+#if defined(CONFIG_STK52XX) || defined(CONFIG_FO300)
+#define DEFAULT_VOL    45
+#define DEFAULT_FREQ   500
+#define DEFAULT_DURATION       200
+#define LEFT           1
+#define RIGHT          2
+#define LEFT_RIGHT     3
+#define BL_OFF         0
+#define BL_ON          1
+
+#define SM501_GPIO_CTRL_LOW            0x00000008UL
+#define SM501_GPIO_CTRL_HIGH           0x0000000CUL
+#define SM501_POWER_MODE0_GATE         0x00000040UL
+#define SM501_POWER_MODE1_GATE         0x00000048UL
+#define POWER_MODE_GATE_GPIO_PWM_I2C   0x00000040UL
+#define SM501_GPIO_DATA_LOW            0x00010000UL
+#define SM501_GPIO_DATA_HIGH           0x00010004UL
+#define SM501_GPIO_DATA_DIR_LOW                0x00010008UL
+#define SM501_GPIO_DATA_DIR_HIGH       0x0001000CUL
+#define SM501_PANEL_DISPLAY_CONTROL    0x00080000UL
+
+static int i2s_squarewave(unsigned long duration, unsigned int freq,
+                         unsigned int channel);
+static int i2s_sawtooth(unsigned long duration, unsigned int freq,
+                       unsigned int channel);
+static void spi_init(void);
+static int spi_transmit(unsigned char data);
+static void pcm1772_write_reg(unsigned char addr, unsigned char data);
+static void set_attenuation(unsigned char attenuation);
+
+static void spi_init(void)
+{
+       struct mpc5xxx_spi *spi = (struct mpc5xxx_spi*)MPC5XXX_SPI;
+       struct mpc5xxx_gpio *gpio = (struct mpc5xxx_gpio*)MPC5XXX_GPIO;
+
+       /* PSC3 as SPI and GPIOs */
+       gpio->port_config &= 0xFFFFF0FF;
+       gpio->port_config |= 0x00000800;
+       /*
+        * Its important to use the correct order when initializing the
+        * registers
+        */
+       spi->ddr = 0x0F; /* set all SPI pins as output */
+       spi->pdr = 0x08; /* set SS high */
+       spi->cr1 = 0x50; /* SPI is master, SS is general purpose output */
+       spi->cr2 = 0x00; /* normal operation */
+       spi->brr = 0xFF; /* baud rate: IPB clock / 2048 */
+}
+
+static int spi_transmit(unsigned char data)
+{
+       int dummy;
+       struct mpc5xxx_spi *spi = (struct mpc5xxx_spi*)MPC5XXX_SPI;
+
+       spi->dr = data;
+       /* wait for SPI transmission completed */
+       while(!(spi->sr & 0x80))
+       {
+               if (spi->sr & 0x40)     /* if write collision occured */
+               {
+                       /* do dummy read to clear status register */
+                       dummy = spi->dr;
+                       printf ("SPI write collision\n");
+                       return -1;
+               }
+       }
+       return (spi->dr);
+}
+
+static void pcm1772_write_reg(unsigned char addr, unsigned char data)
+{
+       struct mpc5xxx_spi *spi = (struct mpc5xxx_spi*)MPC5XXX_SPI;
+
+       spi->pdr = 0x00; /* Set SS low */
+       spi_transmit(addr);
+       spi_transmit(data);
+       /* wait some time to meet MS# hold time of PCM1772 */
+       udelay (1);
+       spi->pdr = 0x08; /* set SS high */
+}
+
+static void set_attenuation(unsigned char attenuation)
+{
+       pcm1772_write_reg(0x01, attenuation); /* left channel */
+       debug ("PCM1772 attenuation left set to %d.\n", attenuation);
+       pcm1772_write_reg(0x02, attenuation); /* right channel */
+       debug ("PCM1772 attenuation right set to %d.\n", attenuation);
+}
+
+void amplifier_init(void)
+{
+       static int init_done = 0;
+       int i;
+       struct mpc5xxx_gpio *gpio = (struct mpc5xxx_gpio*)MPC5XXX_GPIO;
+
+       /* Do this only once, because of the long time delay */
+       if (!init_done) {
+               /* configure PCM1772 audio format as I2S */
+               pcm1772_write_reg(0x03, 0x01);
+               /* enable audio amplifier */
+               gpio->sint_gpioe |=  0x02;      /* PSC3_5 as GPIO */
+               gpio->sint_ode &= ~0x02;        /* PSC3_5 is not open Drain */
+               gpio->sint_dvo &= ~0x02;        /* PSC3_5 is LOW */
+               gpio->sint_ddr |=  0x02;        /* PSC3_5 as output */
+               /*
+                * wait some time to allow amplifier to recover from shutdown
+                * mode.
+                */
+               for(i = 0; i < 350; i++)
+                       udelay(1000);
+               /*
+                * The used amplifier (LM4867) has a so called "pop and click"
+                * elmination filter. The input signal of the amplifier must
+                * exceed a certain level once after power up to activate the
+                * generation of the output signal. This is achieved by
+                * sending a low frequent (nearly inaudible) sawtooth with a
+                * sufficient signal level.
+                */
+               set_attenuation(50);
+               i2s_sawtooth (200, 5, LEFT_RIGHT);
+               init_done = 1;
+       }
+}
+
+static void i2s_init(void)
+{
+       unsigned long i;
+       struct mpc5xxx_psc *psc = (struct mpc5xxx_psc*)MPC5XXX_PSC2;;
+       struct mpc5xxx_gpio *gpio = (struct mpc5xxx_gpio*)MPC5XXX_GPIO;
+
+       gpio->port_config |= 0x00000070; /* PSC2 ports as Codec with MCLK */
+       psc->command = (PSC_RX_DISABLE | PSC_TX_DISABLE);
+       psc->sicr = 0x22E00000;         /* 16 bit data; I2S */
+
+       *(vu_long *)(CFG_MBAR + 0x22C) = 0x805d; /* PSC2 CDM MCLK config; MCLK
+                                                 * 5.617 MHz */
+       *(vu_long *)(CFG_MBAR + 0x214) |= 0x00000040; /* CDM clock enable
+                                                      * register */
+       psc->ccr = 0x1F03;      /* 16 bit data width; 5.617MHz MCLK */
+       psc->ctur = 0x0F;       /* 16 bit frame width */
+
+       for(i=0;i<128;i++)
+       {
+               psc->psc_buffer_32 = 0; /* clear tx fifo */
+       }
+}
+
+static int i2s_play_wave(unsigned long addr, unsigned long len)
+{
+       unsigned long i;
+       unsigned char *wave_file = (uchar *)addr + 44;  /* quick'n dirty: skip
+                                                        * wav header*/
+       unsigned char swapped[4];
+       struct mpc5xxx_psc *psc = (struct mpc5xxx_psc*)MPC5XXX_PSC2;
+
+       /*
+        * play wave file in memory; bytes/words are be swapped
+        */
+       psc->command = (PSC_RX_ENABLE | PSC_TX_ENABLE);
+
+       for(i = 0;i < (len / 4); i++) {
+               swapped[3]=*wave_file++;
+               swapped[2]=*wave_file++;
+               swapped[1]=*wave_file++;
+               swapped[0]=*wave_file++;
+               psc->psc_buffer_32 =  *((unsigned long*)swapped);
+               while (psc->tfnum > 400) {
+                       if(ctrlc())
+                               return 0;
+               }
+       }
+       while (psc->tfnum > 0);         /* wait for fifo empty */
+       udelay (100);
+       psc->command = (PSC_RX_DISABLE | PSC_TX_DISABLE);
+       return 0;
+}
+
+static int i2s_sawtooth(unsigned long duration, unsigned int freq,
+                       unsigned int channel)
+{
+       long i,j;
+       unsigned long data;
+       struct mpc5xxx_psc *psc = (struct mpc5xxx_psc*)MPC5XXX_PSC2;
+
+       psc->command = (PSC_RX_ENABLE | PSC_TX_ENABLE);
+
+       /*
+        * Generate sawtooth. Start with middle level up to highest level. Then
+        * go to lowest level and back to middle level.
+        */
+       for(j = 0; j < ((duration * freq) / 1000); j++) {
+               for(i = 0; i <= 0x7FFF; i += (0x7FFF/(44100/(freq*4)))) {
+                       data = (i & 0xFFFF);
+                       /* data format: right data left data) */
+                       if (channel == LEFT_RIGHT)
+                               data |= (data<<16);
+                       if (channel == RIGHT)
+                               data = (data<<16);
+                       psc->psc_buffer_32 = data;
+                       while (psc->tfnum > 400);
+               }
+               for(i = 0x7FFF; i >= -0x7FFF; i -= (0xFFFF/(44100/(freq*2)))) {
+                       data = (i & 0xFFFF);
+                       /* data format: right data left data) */
+                       if (channel == LEFT_RIGHT)
+                               data |= (data<<16);
+                       if (channel == RIGHT)
+                               data = (data<<16);
+                       psc->psc_buffer_32 = data;
+                       while (psc->tfnum > 400);
+               }
+               for(i = -0x7FFF; i <= 0; i += (0x7FFF/(44100/(freq*4)))) {
+                       data = (i & 0xFFFF);
+                       /* data format: right data left data) */
+                       if (channel == LEFT_RIGHT)
+                               data |= (data<<16);
+                       if (channel == RIGHT)
+                               data = (data<<16);
+                       psc->psc_buffer_32 = data;
+                       while (psc->tfnum > 400);
+               }
+       }
+       while (psc->tfnum > 0);         /* wait for fifo empty */
+       udelay (100);
+       psc->command = (PSC_RX_DISABLE | PSC_TX_DISABLE);
+
+       return 0;
+}
+
+static int i2s_squarewave(unsigned long duration, unsigned int freq,
+                        unsigned int channel)
+{
+       long i,j;
+       unsigned long data;
+       struct mpc5xxx_psc *psc = (struct mpc5xxx_psc*)MPC5XXX_PSC2;
+
+       psc->command = (PSC_RX_ENABLE | PSC_TX_ENABLE);
+
+       /*
+        * Generate sqarewave. Start with high level, duty cycle 1:1.
+        */
+       for(j = 0; j < ((duration * freq) / 1000); j++) {
+               for(i = 0; i < (44100/(freq*2)); i ++) {
+                       data = 0x7FFF;
+                       /* data format: right data left data) */
+                       if (channel == LEFT_RIGHT)
+                               data |= (data<<16);
+                       if (channel == RIGHT)
+                               data = (data<<16);
+                       psc->psc_buffer_32 = data;
+                       while (psc->tfnum > 400);
+               }
+               for(i = 0; i < (44100/(freq*2)); i ++) {
+                       data = 0x8000;
+                       /* data format: right data left data) */
+                       if (channel == LEFT_RIGHT)
+                               data |= (data<<16);
+                       if (channel == RIGHT)
+                               data = (data<<16);
+                       psc->psc_buffer_32 = data;
+                       while (psc->tfnum > 400);
+               }
+       }
+       while (psc->tfnum > 0);         /* wait for fifo empty */
+       udelay (100);
+       psc->command = (PSC_RX_DISABLE | PSC_TX_DISABLE);
+
+       return 0;
+}
+
+static int cmd_sound(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
+{
+       unsigned long reg, val, duration;
+       char *tmp;
+       unsigned int freq, channel;
+       unsigned char volume;
+       int rcode = 1;
+
+#ifdef CONFIG_STK52XX_REV100
+       printf ("Revision 100 of STK52XX not supported!\n");
+       return 1;
+#endif
+       spi_init();
+       i2s_init();
+       amplifier_init();
+
+       if ((tmp = getenv ("volume")) != NULL) {
+               volume = simple_strtoul (tmp, NULL, 10);
+       } else {
+               volume = DEFAULT_VOL;
+       }
+       set_attenuation(volume);
+
+       switch (argc) {
+       case 0:
+       case 1:
+               printf ("Usage:\n%s\n", cmdtp->usage);
+               return 1;
+       case 2:
+               if (strncmp(argv[1],"saw",3) == 0) {
+                       printf ("Play sawtooth\n");
+                       rcode = i2s_sawtooth (DEFAULT_DURATION, DEFAULT_FREQ,
+                                             LEFT_RIGHT);
+                       return rcode;
+               } else if (strncmp(argv[1],"squ",3) == 0) {
+                       printf ("Play squarewave\n");
+                       rcode = i2s_squarewave (DEFAULT_DURATION, DEFAULT_FREQ,
+                                               LEFT_RIGHT);
+                       return rcode;
+               }
+
+               printf ("Usage:\n%s\n", cmdtp->usage);
+               return 1;
+       case 3:
+               if (strncmp(argv[1],"saw",3) == 0) {
+                       duration = simple_strtoul(argv[2], NULL, 10);
+                       printf ("Play sawtooth\n");
+                       rcode = i2s_sawtooth (duration, DEFAULT_FREQ,
+                                             LEFT_RIGHT);
+                       return rcode;
+               } else if (strncmp(argv[1],"squ",3) == 0) {
+                       duration = simple_strtoul(argv[2], NULL, 10);
+                       printf ("Play squarewave\n");
+                       rcode = i2s_squarewave (duration, DEFAULT_FREQ,
+                                               LEFT_RIGHT);
+                       return rcode;
+               }
+               printf ("Usage:\n%s\n", cmdtp->usage);
+               return 1;
+       case 4:
+               if (strncmp(argv[1],"saw",3) == 0) {
+                       duration = simple_strtoul(argv[2], NULL, 10);
+                       freq = (unsigned int)simple_strtoul(argv[3], NULL, 10);
+                       printf ("Play sawtooth\n");
+                       rcode = i2s_sawtooth (duration, freq,
+                                             LEFT_RIGHT);
+                       return rcode;
+               } else if (strncmp(argv[1],"squ",3) == 0) {
+                       duration = simple_strtoul(argv[2], NULL, 10);
+                       freq = (unsigned int)simple_strtoul(argv[3], NULL, 10);
+                       printf ("Play squarewave\n");
+                       rcode = i2s_squarewave (duration, freq,
+                                               LEFT_RIGHT);
+                       return rcode;
+               } else if (strcmp(argv[1],"pcm1772") == 0) {
+                       reg = simple_strtoul(argv[2], NULL, 10);
+                       val = simple_strtoul(argv[3], NULL, 10);
+                       printf("Set PCM1772 %lu. %lu\n", reg, val);
+                       pcm1772_write_reg((uchar)reg, (uchar)val);
+                       return 0;
+               }
+               printf ("Usage:\n%s\n", cmdtp->usage);
+               return 1;
+       case 5:
+               if (strncmp(argv[1],"saw",3) == 0) {
+                       duration = simple_strtoul(argv[2], NULL, 10);
+                       freq = (unsigned int)simple_strtoul(argv[3], NULL, 10);
+                       if (strncmp(argv[4],"l",1) == 0)
+                               channel = LEFT;
+                       else if (strncmp(argv[4],"r",1) == 0)
+                               channel = RIGHT;
+                       else
+                               channel = LEFT_RIGHT;
+                       printf ("Play squarewave\n");
+                       rcode = i2s_sawtooth (duration, freq,
+                                             channel);
+                       return rcode;
+               } else if (strncmp(argv[1],"squ",3) == 0) {
+                       duration = simple_strtoul(argv[2], NULL, 10);
+                       freq = (unsigned int)simple_strtoul(argv[3], NULL, 10);
+                       if (strncmp(argv[4],"l",1) == 0)
+                               channel = LEFT;
+                       else if (strncmp(argv[4],"r",1) == 0)
+                               channel = RIGHT;
+                       else
+                               channel = LEFT_RIGHT;
+                       printf ("Play squarewave\n");
+                       rcode = i2s_squarewave (duration, freq,
+                                               channel);
+                       return rcode;
+               }
+               printf ("Usage:\n%s\n", cmdtp->usage);
+               return 1;
+       }
+       printf ("Usage:\nsound cmd [arg1] [arg2] ...\n");
+       return 1;
+}
+
+static int cmd_wav(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
+{
+       unsigned long length, addr;
+       unsigned char volume;
+       int rcode = 1;
+       char *tmp;
+
+#ifdef CONFIG_STK52XX_REV100
+       printf ("Revision 100 of STK52XX not supported!\n");
+       return 1;
+#endif
+       spi_init();
+       i2s_init();
+       amplifier_init();
+
+       switch (argc) {
+
+       case 3:
+               length = simple_strtoul(argv[2], NULL, 16);
+               addr = simple_strtoul(argv[1], NULL, 16);
+               break;
+
+       case 2:
+               if ((tmp = getenv ("filesize")) != NULL) {
+                       length = simple_strtoul (tmp, NULL, 16);
+               } else {
+                       puts ("No filesize provided\n");
+                       return 1;
+               }
+               addr = simple_strtoul(argv[1], NULL, 16);
+
+       case 1:
+               if ((tmp = getenv ("filesize")) != NULL) {
+                       length = simple_strtoul (tmp, NULL, 16);
+               } else {
+                       puts ("No filesize provided\n");
+                       return 1;
+               }
+               if ((tmp = getenv ("loadaddr")) != NULL) {
+                       addr = simple_strtoul (tmp, NULL, 16);
+               } else {
+                       puts ("No loadaddr provided\n");
+                       return 1;
+               }
+               break;
+
+       default:
+               printf("Usage:\nwav <addr> <length[s]\n");
+               return 1;
+               break;
+       }
+
+       if ((tmp = getenv ("volume")) != NULL) {
+               volume = simple_strtoul (tmp, NULL, 10);
+       } else {
+               volume = DEFAULT_VOL;
+       }
+       set_attenuation(volume);
+
+       printf("Play wave file at %#p with length %#x\n", addr, length);
+       rcode = i2s_play_wave(addr, length);
+
+       return rcode;
+}
+
+static int cmd_beep(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
+{
+       unsigned char volume;
+       unsigned int channel;
+       int rcode;
+       char *tmp;
+
+#ifdef CONFIG_STK52XX_REV100
+       printf ("Revision 100 of STK52XX not supported!\n");
+       return 1;
+#endif
+       spi_init();
+       i2s_init();
+       amplifier_init();
+
+       switch (argc) {
+       case 0:
+       case 1:
+               channel = LEFT_RIGHT;
+               break;
+       case 2:
+               if (strncmp(argv[1],"l",1) == 0)
+                       channel = LEFT;
+               else if (strncmp(argv[1],"r",1) == 0)
+                       channel = RIGHT;
+               else
+                       channel = LEFT_RIGHT;
+               break;
+       default:
+               printf ("Usage:\n%s\n", cmdtp->usage);
+               return 1;
+       }
+
+       if ((tmp = getenv ("volume")) != NULL) {
+               volume = simple_strtoul (tmp, NULL, 10);
+       } else {
+               volume = DEFAULT_VOL;
+       }
+       set_attenuation(volume);
+
+       printf("Beep on ");
+       if (channel == LEFT)
+               printf ("left ");
+       else if (channel == RIGHT)
+               printf ("right ");
+       else
+               printf ("left and right ");
+       printf ("channel\n");
+
+       rcode = i2s_squarewave (DEFAULT_DURATION, DEFAULT_FREQ, channel);
+
+       return rcode;
+}
+#endif
+
+#if defined(CONFIG_STK52XX)
+void led_init(void)
+{
+       struct mpc5xxx_gpio *gpio = (struct mpc5xxx_gpio *)MPC5XXX_GPIO;
+       struct mpc5xxx_gpt_0_7 *gpt = (struct mpc5xxx_gpt_0_7 *)MPC5XXX_GPT;
+
+       /* configure PSC3 for SPI and GPIO */
+       gpio->port_config &= ~(0x00000F00);
+       gpio->port_config |=   0x00000800;
+
+       gpio->simple_gpioe &= ~(0x00000F00);
+       gpio->simple_gpioe |=   0x00000F00;
+
+       gpio->simple_ddr &= ~(0x00000F00);
+       gpio->simple_ddr |=   0x00000F00;
+
+       /* configure timer 4-7 for simple GPIO output */
+       gpt->gpt4.emsr |=  0x00000024;
+       gpt->gpt5.emsr |=  0x00000024;
+       gpt->gpt6.emsr |=  0x00000024;
+       gpt->gpt7.emsr |=  0x00000024;
+
+#ifndef CONFIG_TQM5200S
+       /* enable SM501 GPIO control (in both power modes) */
+       *(vu_long *) (SM501_MMIO_BASE+SM501_POWER_MODE0_GATE) |=
+               POWER_MODE_GATE_GPIO_PWM_I2C;
+       *(vu_long *) (SM501_MMIO_BASE+SM501_POWER_MODE1_GATE) |=
+               POWER_MODE_GATE_GPIO_PWM_I2C;
+
+       /* configure SM501 gpio pins 24-27 as output */
+       *(vu_long *) (SM501_MMIO_BASE+SM501_GPIO_CTRL_LOW) &= ~(0xF << 24);
+       *(vu_long *) (SM501_MMIO_BASE+SM501_GPIO_DATA_DIR_LOW) |= (0xF << 24);
+
+       /* configure SM501 gpio pins 48-51 as output */
+       *(vu_long *) (SM501_MMIO_BASE+SM501_GPIO_DATA_DIR_HIGH) |= (0xF << 16);
+#endif /* !CONFIG_TQM5200S */
+}
+
+/*
+ * return 1 if led number unknown
+ * return 0 else
+ */
+int do_led(char *argv[])
+{
+       struct mpc5xxx_gpio *gpio = (struct mpc5xxx_gpio *)MPC5XXX_GPIO;
+       struct mpc5xxx_gpt_0_7 *gpt = (struct mpc5xxx_gpt_0_7 *)MPC5XXX_GPT;
+
+       switch  (simple_strtoul(argv[2], NULL, 10)) {
+
+       case 0:
+               if (strcmp (argv[3], "on") == 0) {
+                       gpio->simple_dvo |=   (1 << 8);
+               } else {
+                       gpio->simple_dvo &= ~(1 << 8);
+               }
+               break;
+
+       case 1:
+               if (strcmp (argv[3], "on") == 0) {
+                       gpio->simple_dvo |=   (1 << 9);
+               } else {
+                       gpio->simple_dvo &= ~(1 << 9);
+               }
+               break;
+
+       case 2:
+               if (strcmp (argv[3], "on") == 0) {
+                       gpio->simple_dvo |=   (1 << 10);
+               } else {
+                       gpio->simple_dvo &= ~(1 << 10);
+               }
+               break;
+
+       case 3:
+               if (strcmp (argv[3], "on") == 0) {
+                       gpio->simple_dvo |=   (1 << 11);
+               } else {
+                       gpio->simple_dvo &= ~(1 << 11);
+               }
+               break;
+
+       case 4:
+               if (strcmp (argv[3], "on") == 0) {
+                       gpt->gpt4.emsr |=  (1 << 4);
+               } else {
+                       gpt->gpt4.emsr &=  ~(1 << 4);
+               }
+               break;
+
+       case 5:
+               if (strcmp (argv[3], "on") == 0) {
+                       gpt->gpt5.emsr |=  (1 << 4);
+               } else {
+                       gpt->gpt5.emsr &=  ~(1 << 4);
+               }
+               break;
+
+       case 6:
+               if (strcmp (argv[3], "on") == 0) {
+                       gpt->gpt6.emsr |=  (1 << 4);
+               } else {
+                       gpt->gpt6.emsr &=  ~(1 << 4);
+               }
+               break;
+
+       case 7:
+               if (strcmp (argv[3], "on") == 0) {
+                       gpt->gpt7.emsr |=  (1 << 4);
+               } else {
+                       gpt->gpt7.emsr &=  ~(1 << 4);
+               }
+               break;
+#ifndef CONFIG_TQM5200S
+       case 24:
+               if (strcmp (argv[3], "on") == 0) {
+                       *(vu_long *) (SM501_MMIO_BASE+SM501_GPIO_DATA_LOW) |=
+                               (0x1 << 24);
+               } else {
+                       *(vu_long *) (SM501_MMIO_BASE+SM501_GPIO_DATA_LOW) &=
+                               ~(0x1 << 24);
+               }
+               break;
+
+       case 25:
+               if (strcmp (argv[3], "on") == 0) {
+                       *(vu_long *) (SM501_MMIO_BASE+SM501_GPIO_DATA_LOW) |=
+                               (0x1 << 25);
+               } else {
+                       *(vu_long *) (SM501_MMIO_BASE+SM501_GPIO_DATA_LOW) &=
+                               ~(0x1 << 25);
+               }
+               break;
+
+       case 26:
+               if (strcmp (argv[3], "on") == 0) {
+                       *(vu_long *) (SM501_MMIO_BASE+SM501_GPIO_DATA_LOW) |=
+                               (0x1 << 26);
+               } else {
+                       *(vu_long *) (SM501_MMIO_BASE+SM501_GPIO_DATA_LOW) &=
+                               ~(0x1 << 26);
+               }
+               break;
+
+       case 27:
+               if (strcmp (argv[3], "on") == 0) {
+                       *(vu_long *) (SM501_MMIO_BASE+SM501_GPIO_DATA_LOW) |=
+                               (0x1 << 27);
+               } else {
+                       *(vu_long *) (SM501_MMIO_BASE+SM501_GPIO_DATA_LOW) &=
+                               ~(0x1 << 27);
+               }
+               break;
+
+       case 48:
+               if (strcmp (argv[3], "on") == 0) {
+                       *(vu_long *) (SM501_MMIO_BASE+SM501_GPIO_DATA_HIGH) |=
+                               (0x1 << 16);
+               } else {
+                       *(vu_long *) (SM501_MMIO_BASE+SM501_GPIO_DATA_HIGH) &=
+                               ~(0x1 << 16);
+               }
+               break;
+
+       case 49:
+               if (strcmp (argv[3], "on") == 0) {
+                       *(vu_long *) (SM501_MMIO_BASE+SM501_GPIO_DATA_HIGH) |=
+                               (0x1 << 17);
+               } else {
+                       *(vu_long *) (SM501_MMIO_BASE+SM501_GPIO_DATA_HIGH) &=
+                               ~(0x1 << 17);
+               }
+               break;
+
+       case 50:
+               if (strcmp (argv[3], "on") == 0) {
+                       *(vu_long *) (SM501_MMIO_BASE+SM501_GPIO_DATA_HIGH) |=
+                               (0x1 << 18);
+               } else {
+                       *(vu_long *) (SM501_MMIO_BASE+SM501_GPIO_DATA_HIGH) &=
+                               ~(0x1 << 18);
+               }
+               break;
+
+       case 51:
+               if (strcmp (argv[3], "on") == 0) {
+                       *(vu_long *) (SM501_MMIO_BASE+SM501_GPIO_DATA_HIGH) |=
+                               (0x1 << 19);
+               } else {
+                       *(vu_long *) (SM501_MMIO_BASE+SM501_GPIO_DATA_HIGH) &=
+                               ~(0x1 << 19);
+               }
+               break;
+#endif /* !CONFIG_TQM5200S */
+       default:
+               printf ("%s: invalid led number %s\n", __FUNCTION__, argv[2]);
+               return 1;
+       }
+
+       return 0;
+}
+#endif
+
+#if defined(CONFIG_STK52XX) || defined(CONFIG_FO300)
+/*
+ * return 1 on CAN initialization failure
+ * return 0 if no failure
+ */
+int can_init(void)
+{
+       static int init_done = 0;
+       int i;
+       struct mpc5xxx_mscan *can1 =
+               (struct mpc5xxx_mscan *)(CFG_MBAR + 0x0900);
+       struct mpc5xxx_mscan *can2 =
+               (struct mpc5xxx_mscan *)(CFG_MBAR + 0x0980);
+
+       /* GPIO configuration of the CAN pins is done in TQM5200.h */
+
+       if (!init_done) {
+               /* init CAN 1 */
+               can1->canctl1 |= 0x80;  /* CAN enable */
+               udelay(100);
+
+               i = 0;
+               can1->canctl0 |= 0x02;  /* sleep mode */
+               /* wait until sleep mode reached */
+               while (!(can1->canctl1 & 0x02)) {
+                       udelay(10);
+               i++;
+               if (i == 10) {
+                       printf ("%s: CAN1 initialize error, "
+                               "can not enter sleep mode!\n",
+                               __FUNCTION__);
+                       return 1;
+               }
+               }
+               i = 0;
+               can1->canctl0 = 0x01;   /* enter init mode */
+               /* wait until init mode reached */
+               while (!(can1->canctl1 & 0x01)) {
+                       udelay(10);
+                       i++;
+                       if (i == 10) {
+                               printf ("%s: CAN1 initialize error, "
+                                       "can not enter init mode!\n",
+                                       __FUNCTION__);
+                               return 1;
+                       }
+               }
+               can1->canctl1 = 0x80;
+               can1->canctl1 |= 0x40;
+               can1->canbtr0 = 0x0F;
+               can1->canbtr1 = 0x7F;
+               can1->canidac &= ~(0x30);
+               can1->canidar1 = 0x00;
+               can1->canidar3 = 0x00;
+               can1->canidar5 = 0x00;
+               can1->canidar7 = 0x00;
+               can1->canidmr0 = 0xFF;
+               can1->canidmr1 = 0xFF;
+               can1->canidmr2 = 0xFF;
+               can1->canidmr3 = 0xFF;
+               can1->canidmr4 = 0xFF;
+               can1->canidmr5 = 0xFF;
+               can1->canidmr6 = 0xFF;
+               can1->canidmr7 = 0xFF;
+
+               i = 0;
+               can1->canctl0 &= ~(0x01);       /* leave init mode */
+               can1->canctl0 &= ~(0x02);
+               /* wait until init and sleep mode left */
+               while ((can1->canctl1 & 0x01) || (can1->canctl1 & 0x02)) {
+                       udelay(10);
+                       i++;
+                       if (i == 10) {
+                               printf ("%s: CAN1 initialize error, "
+                                       "can not leave init/sleep mode!\n",
+                                       __FUNCTION__);
+                               return 1;
+                       }
+               }
+
+               /* init CAN 2 */
+               can2->canctl1 |= 0x80;  /* CAN enable */
+               udelay(100);
+
+               i = 0;
+               can2->canctl0 |= 0x02;  /* sleep mode */
+               /* wait until sleep mode reached */
+               while (!(can2->canctl1 & 0x02)) {
+                       udelay(10);
+                       i++;
+                       if (i == 10) {
+                               printf ("%s: CAN2 initialize error, "
+                                       "can not enter sleep mode!\n",
+                                       __FUNCTION__);
+                               return 1;
+                       }
+               }
+               i = 0;
+               can2->canctl0 = 0x01;   /* enter init mode */
+               /* wait until init mode reached */
+               while (!(can2->canctl1 & 0x01)) {
+                       udelay(10);
+                       i++;
+                       if (i == 10) {
+                               printf ("%s: CAN2 initialize error, "
+                                       "can not enter init mode!\n",
+                                       __FUNCTION__);
+                               return 1;
+                       }
+               }
+               can2->canctl1 = 0x80;
+               can2->canctl1 |= 0x40;
+               can2->canbtr0 = 0x0F;
+               can2->canbtr1 = 0x7F;
+               can2->canidac &= ~(0x30);
+               can2->canidar1 = 0x00;
+               can2->canidar3 = 0x00;
+               can2->canidar5 = 0x00;
+               can2->canidar7 = 0x00;
+               can2->canidmr0 = 0xFF;
+               can2->canidmr1 = 0xFF;
+               can2->canidmr2 = 0xFF;
+               can2->canidmr3 = 0xFF;
+               can2->canidmr4 = 0xFF;
+               can2->canidmr5 = 0xFF;
+               can2->canidmr6 = 0xFF;
+               can2->canidmr7 = 0xFF;
+               can2->canctl0 &= ~(0x01);       /* leave init mode */
+               can2->canctl0 &= ~(0x02);
+
+               i = 0;
+               /* wait until init mode left */
+               while ((can2->canctl1 & 0x01) || (can2->canctl1 & 0x02)) {
+                       udelay(10);
+                       i++;
+                       if (i == 10) {
+                               printf ("%s: CAN2 initialize error, "
+                                       "can not leave init/sleep mode!\n",
+                                       __FUNCTION__);
+                               return 1;
+                       }
+               }
+               init_done = 1;
+       }
+       return 0;
+}
+
+/*
+ * return 1 on CAN failure
+ * return 0 if no failure
+ */
+int do_can(char *argv[])
+{
+       int i;
+       struct mpc5xxx_mscan *can1 =
+               (struct mpc5xxx_mscan *)(CFG_MBAR + 0x0900);
+       struct mpc5xxx_mscan *can2 =
+               (struct mpc5xxx_mscan *)(CFG_MBAR + 0x0980);
+
+       /* send a message on CAN1 */
+       can1->cantbsel = 0x01;
+       can1->cantxfg.idr[0] = 0x55;
+       can1->cantxfg.idr[1] = 0x00;
+       can1->cantxfg.idr[1] &= ~0x8;
+       can1->cantxfg.idr[1] &= ~0x10;
+       can1->cantxfg.dsr[0] = 0xCC;
+       can1->cantxfg.dlr = 1;
+       can1->cantxfg.tbpr = 0;
+       can1->cantflg = 0x01;
+
+       i = 0;
+       while ((can1->cantflg & 0x01) == 0) {
+               i++;
+               if (i == 10) {
+                       printf ("%s: CAN1 send timeout, "
+                               "can not send message!\n",
+                               __FUNCTION__);
+                       return 1;
+               }
+               udelay(1000);
+       }
+       udelay(1000);
+
+       i = 0;
+       while (!(can2->canrflg & 0x01)) {
+               i++;
+               if (i == 10) {
+                       printf ("%s: CAN2 receive timeout, "
+                               "no message received!\n",
+                               __FUNCTION__);
+                       return 1;
+               }
+               udelay(1000);
+       }
+
+       if (can2->canrxfg.dsr[0] != 0xCC) {
+               printf ("%s: CAN2 receive error, "
+                        "data mismatch!\n",
+                       __FUNCTION__);
+               return 1;
+       }
+
+       /* send a message on CAN2 */
+       can2->cantbsel = 0x01;
+       can2->cantxfg.idr[0] = 0x55;
+       can2->cantxfg.idr[1] = 0x00;
+       can2->cantxfg.idr[1] &= ~0x8;
+       can2->cantxfg.idr[1] &= ~0x10;
+       can2->cantxfg.dsr[0] = 0xCC;
+       can2->cantxfg.dlr = 1;
+       can2->cantxfg.tbpr = 0;
+       can2->cantflg = 0x01;
+
+       i = 0;
+       while ((can2->cantflg & 0x01) == 0) {
+               i++;
+               if (i == 10) {
+                       printf ("%s: CAN2 send error, "
+                               "can not send message!\n",
+                               __FUNCTION__);
+                       return 1;
+               }
+               udelay(1000);
+       }
+       udelay(1000);
+
+       i = 0;
+       while (!(can1->canrflg & 0x01)) {
+               i++;
+               if (i == 10) {
+                       printf ("%s: CAN1 receive timeout, "
+                               "no message received!\n",
+                               __FUNCTION__);
+                       return 1;
+               }
+               udelay(1000);
+       }
+
+       if (can1->canrxfg.dsr[0] != 0xCC) {
+               printf ("%s: CAN1 receive error 0x%02x\n",
+                       __FUNCTION__, (can1->canrxfg.dsr[0]));
+               return 1;
+       }
+
+       return 0;
+}
+
+/*
+ * return 1 if rs232 port unknown
+ * return 2 on txd/rxd failure (only rs232 2)
+ * return 3 on rts/cts failure
+ * return 0 if no failure
+ */
+int do_rs232(char *argv[])
+{
+       int error_status = 0;
+       struct mpc5xxx_gpio *gpio = (struct mpc5xxx_gpio *)MPC5XXX_GPIO;
+       struct mpc5xxx_psc *psc1 = (struct mpc5xxx_psc *)MPC5XXX_PSC1;
+
+       switch  (simple_strtoul(argv[2], NULL, 10)) {
+
+       case 1:
+               /* check RTS <-> CTS loop */
+               /* set rts to 0 */
+               psc1->op1 |= 0x01;
+
+               /* wait some time before requesting status */
+               udelay(10);
+
+               /* check status at cts */
+               if ((psc1->ip & 0x01) != 0) {
+                       error_status = 3;
+                       printf ("%s: failure at rs232_1, cts status is %d "
+                               "(should be 0)\n",
+                               __FUNCTION__, (psc1->ip & 0x01));
+               }
+
+               /* set rts to 1 */
+               psc1->op0 |= 0x01;
+
+               /* wait some time before requesting status */
+               udelay(10);
+
+               /* check status at cts */
+               if ((psc1->ip & 0x01) != 1) {
+                       error_status = 3;
+                       printf ("%s: failure at rs232_1, cts status is %d "
+                               "(should be 1)\n",
+                               __FUNCTION__, (psc1->ip & 0x01));
+               }
+
+               break;
+
+       case 2:
+               /* set PSC3_0, PSC3_2 as output and PSC3_1, PSC3_3 as input */
+               gpio->simple_ddr &= ~(0x00000F00);
+               gpio->simple_ddr |=   0x00000500;
+
+               /* check TXD <-> RXD loop */
+               /* set TXD to 1 */
+               gpio->simple_dvo |=   (1 << 8);
+
+               /* wait some time before requesting status */
+               udelay(10);
+
+               if ((gpio->simple_ival & 0x00000200) != 0x00000200) {
+                       error_status = 2;
+                       printf ("%s: failure at rs232_2, rxd status is %d "
+                               "(should be 1)\n",
+                               __FUNCTION__,
+                               (gpio->simple_ival & 0x00000200) >> 9);
+               }
+
+               /* set TXD to 0 */
+               gpio->simple_dvo &= ~(1 << 8);
+
+               /* wait some time before requesting status */
+               udelay(10);
+
+               if ((gpio->simple_ival & 0x00000200) != 0x00000000) {
+                       error_status = 2;
+                       printf ("%s: failure at rs232_2, rxd status is %d "
+                               "(should be 0)\n",
+                               __FUNCTION__,
+                               (gpio->simple_ival & 0x00000200) >> 9);
+               }
+
+               /* check RTS <-> CTS loop */
+               /* set RTS to 1 */
+               gpio->simple_dvo |=   (1 << 10);
+
+               /* wait some time before requesting status */
+               udelay(10);
+
+               if ((gpio->simple_ival & 0x00000800) != 0x00000800) {
+                       error_status = 3;
+                       printf ("%s: failure at rs232_2, cts status is %d "
+                               "(should be 1)\n",
+                               __FUNCTION__,
+                               (gpio->simple_ival & 0x00000800) >> 11);
+               }
+
+               /* set RTS to 0 */
+               gpio->simple_dvo &= ~(1 << 10);
+
+               /* wait some time before requesting status */
+               udelay(10);
+
+               if ((gpio->simple_ival & 0x00000800) != 0x00000000) {
+                       error_status = 3;
+                       printf ("%s: failure at rs232_2, cts status is %d "
+                               "(should be 0)\n",
+                               __FUNCTION__,
+                               (gpio->simple_ival & 0x00000800) >> 11);
+               }
+
+               /* set PSC3_0, PSC3_1, PSC3_2 and PSC3_3 as output */
+               gpio->simple_ddr &= ~(0x00000F00);
+               gpio->simple_ddr |=   0x00000F00;
+               break;
+
+       default:
+               printf ("%s: invalid rs232 number %s\n", __FUNCTION__, argv[2]);
+               error_status = 1;
+               break;
+       }
+
+       return error_status;
+}
+
+#if !defined(CONFIG_FO300) && !defined(CONFIG_TQM5200S)
+static void sm501_backlight (unsigned int state)
+{
+       if (state == BL_ON) {
+               *(vu_long *)(SM501_MMIO_BASE+SM501_PANEL_DISPLAY_CONTROL) |=
+                       (1 << 26) | (1 << 27);
+       } else if (state == BL_OFF)
+               *(vu_long *)(SM501_MMIO_BASE+SM501_PANEL_DISPLAY_CONTROL) &=
+                       ~((1 << 26) | (1 << 27));
+}
+#endif /* !CONFIG_FO300 & !CONFIG_TQM5200S */
+
+int cmd_fkt(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
+{
+       int rcode;
+
+#ifdef CONFIG_STK52XX_REV100
+       printf ("Revision 100 of STK52XX not supported!\n");
+       return 1;
+#endif
+#if defined(CONFIG_STK52XX)
+       led_init();
+#endif
+       can_init();
+
+       switch (argc) {
+
+       case 0:
+       case 1:
+               break;
+
+       case 2:
+               if (strncmp (argv[1], "can", 3) == 0) {
+                       rcode = do_can (argv);
+                       if (rcode == 0)
+                               printf ("OK\n");
+                       else
+                               printf ("Error\n");
+                       return rcode;
+               }
+               break;
+
+       case 3:
+               if (strncmp (argv[1], "rs232", 3) == 0) {
+                       rcode = do_rs232 (argv);
+                       if (rcode == 0)
+                               printf ("OK\n");
+                       else
+                               printf ("Error\n");
+                       return rcode;
+#if !defined(CONFIG_FO300) && !defined(CONFIG_TQM5200S)
+               } else if (strncmp (argv[1], "backlight", 4) == 0) {
+                       if (strncmp (argv[2], "on", 2) == 0) {
+                               sm501_backlight (BL_ON);
+                               return 0;
+                       }
+                       else if (strncmp (argv[2], "off", 3) == 0) {
+                               sm501_backlight (BL_OFF);
+                               return 0;
+                       }
+#endif /* !CONFIG_FO300 & !CONFIG_TQM5200S */
+               }
+               break;
+
+#if defined(CONFIG_STK52XX)
+       case 4:
+               if (strcmp (argv[1], "led") == 0) {
+                       return (do_led (argv));
+               }
+               break;
+#endif
+
+       default:
+               break;
+       }
+
+       printf ("Usage:\nfkt cmd [arg1] [arg2] ...\n");
+       return 1;
+}
+
+
+U_BOOT_CMD(
+       sound ,    5,    1,     cmd_sound,
+       "sound   - Sound sub-system\n",
+       "saw [duration] [freq] [channel]\n"
+       "    - generate sawtooth for 'duration' ms with frequency 'freq'\n"
+       "      on left \"l\" or right \"r\" channel\n"
+       "sound square [duration] [freq] [channel]\n"
+       "    - generate squarewave for 'duration' ms with frequency 'freq'\n"
+       "      on left \"l\" or right \"r\" channel\n"
+       "pcm1772 reg val\n"
+);
+
+U_BOOT_CMD(
+       wav ,    3,    1,     cmd_wav,
+       "wav     - play wav file\n",
+       "[addr] [bytes]\n"
+       "    - play wav file at address 'addr' with length 'bytes'\n"
+);
+
+U_BOOT_CMD(
+       beep ,    2,    1,     cmd_beep,
+       "beep    - play short beep\n",
+       "[channel]\n"
+       "    - play short beep on \"l\"eft or \"r\"ight channel\n"
+);
+#endif /* CONFIG_STK52XX  || CONFIG_FO300 */
+
+#if defined(CONFIG_STK52XX)
+U_BOOT_CMD(
+       fkt ,   4,      1,      cmd_fkt,
+       "fkt     - Function test routines\n",
+       "led number on/off\n"
+       "     - 'number's like printed on STK52XX board\n"
+       "fkt can\n"
+       "     - loopback plug for X83 required\n"
+       "fkt rs232 number\n"
+       "     - loopback plug(s) for X2 required\n"
+#ifndef CONFIG_TQM5200S
+       "fkt backlight on/off\n"
+       "     - switch backlight on or off\n"
+#endif /* !CONFIG_TQM5200S */
+);
+#elif defined(CONFIG_FO300)
+U_BOOT_CMD(
+       fkt ,   3,      1,      cmd_fkt,
+       "fkt     - Function test routines\n",
+       "fkt can\n"
+       "     - loopback plug for X16/X29 required\n"
+       "fkt rs232 number\n"
+       "     - loopback plug(s) for X21/X22 required\n"
+);
+#endif
+#endif
diff --git a/board/tqc/tqm5200/cmd_tb5200.c b/board/tqc/tqm5200/cmd_tb5200.c
new file mode 100644 (file)
index 0000000..214dca6
--- /dev/null
@@ -0,0 +1,104 @@
+/*
+ * (C) Copyright 2005 - 2006
+ * Martin Krause, TQ-Systems GmbH, martin.krause@tqs.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
+ */
+
+/*
+ * TB5200 specific functions
+ */
+/*#define DEBUG*/
+
+#include <common.h>
+#include <command.h>
+
+#if defined(CONFIG_CMD_BSP)
+#if defined (CONFIG_TB5200)
+
+#define SM501_PANEL_DISPLAY_CONTROL    0x00080000UL
+
+static void led_init(void)
+{
+       struct mpc5xxx_gpt_0_7 *gpt = (struct mpc5xxx_gpt_0_7 *)MPC5XXX_GPT;
+
+       /* configure timer 4 for simple GPIO output */
+       gpt->gpt4.emsr |=  0x00000024;
+}
+
+int cmd_led(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
+{
+       struct mpc5xxx_gpt_0_7 *gpt = (struct mpc5xxx_gpt_0_7 *)MPC5XXX_GPT;
+
+       led_init();
+
+       if (strcmp (argv[1], "on") == 0) {
+               debug ("switch status LED on\n");
+               gpt->gpt4.emsr |=  (1 << 4);
+       } else if (strcmp (argv[1], "off") == 0) {
+               debug ("switch status LED off\n");
+               gpt->gpt4.emsr &=  ~(1 << 4);
+       } else {
+               printf ("Usage:\nled on/off\n");
+               return 1;
+       }
+
+       return 0;
+}
+
+static void sm501_backlight (unsigned int state)
+{
+       if (state == 1) {
+               *(vu_long *)(SM501_MMIO_BASE+SM501_PANEL_DISPLAY_CONTROL) |=
+                       (1 << 26) | (1 << 27);
+       } else if (state == 0)
+               *(vu_long *)(SM501_MMIO_BASE+SM501_PANEL_DISPLAY_CONTROL) &=
+                       ~((1 << 26) | (1 << 27));
+}
+
+int cmd_backlight(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
+{
+       if (strcmp (argv[1], "on") == 0) {
+               debug ("switch backlight on\n");
+               sm501_backlight (1);
+       } else if (strcmp (argv[1], "off") == 0) {
+               debug ("switch backlight off\n");
+               sm501_backlight (0);
+       } else {
+               printf ("Usage:\nbacklight on/off\n");
+               return 1;
+       }
+
+       return 0;
+}
+
+U_BOOT_CMD(
+       led ,   2,      1,      cmd_led,
+       "led     - switch status LED on or off\n",
+       "on/off\n"
+);
+
+U_BOOT_CMD(
+       backlight ,     2,      1,      cmd_backlight,
+       "backlight - switch backlight on or off\n",
+       "on/off\n"
+       );
+
+#endif /* CONFIG_STK52XX */
+#endif
diff --git a/board/tqc/tqm5200/config.mk b/board/tqc/tqm5200/config.mk
new file mode 100644 (file)
index 0000000..d72dfe7
--- /dev/null
@@ -0,0 +1,46 @@
+#
+# (C) Copyright 2004
+# Wolfgang Denk, DENX Software Engineering, wd@denx.de.
+#
+# See file CREDITS for list of people who contributed to this
+# project.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 2 of
+# the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+# MA 02111-1307 USA
+#
+
+#
+# TQM5200 board:
+#
+#      Valid values for TEXT_BASE are:
+#
+#      0xFC000000   boot low (standard configuration with room for max 64 MByte
+#                   Flash ROM)
+#      0xFFF00000   boot high (for a backup copy of U-Boot)
+#      0x00100000   boot from RAM (for testing only)
+#
+
+sinclude $(OBJTREE)/board/$(BOARDDIR)/config.tmp
+
+ifndef TEXT_BASE
+## Standard: boot low
+TEXT_BASE = 0xFC000000
+## For a backup copy of U-Boot at the end of flash: boot high
+# TEXT_BASE = 0xFFF00000
+## For testing: boot from RAM
+# TEXT_BASE = 0x00100000
+endif
+
+PLATFORM_CPPFLAGS += -DTEXT_BASE=$(TEXT_BASE) -I$(TOPDIR)/board
diff --git a/board/tqc/tqm5200/mt48lc16m16a2-75.h b/board/tqc/tqm5200/mt48lc16m16a2-75.h
new file mode 100644 (file)
index 0000000..3f1e169
--- /dev/null
@@ -0,0 +1,47 @@
+/*
+ * (C) Copyright 2004
+ * Mark Jonas, Freescale Semiconductor, mark.jonas@motorola.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
+ */
+
+#define SDRAM_DDR      0               /* is SDR */
+
+#if defined(CONFIG_MPC5200)
+/* Settings for XLB = 132 MHz */
+#define SDRAM_MODE     0x00CD0000
+/* #define SDRAM_MODE  0x008D0000 */ /* CAS latency 2 */
+#define SDRAM_CONTROL  0x504F0000
+#define SDRAM_CONFIG1  0xD2322800
+/* #define SDRAM_CONFIG1       0xD2222800 */ /* CAS latency 2 */
+/*#define SDRAM_CONFIG1        0xD7322800 */ /* SDRAM controller bug workaround */
+#define SDRAM_CONFIG2  0x8AD70000
+/*#define SDRAM_CONFIG2        0xDDD70000 */ /* SDRAM controller bug workaround */
+
+#elif defined(CONFIG_MGT5100)
+/* Settings for XLB = 66 MHz */
+#define SDRAM_MODE     0x008D0000
+#define SDRAM_CONTROL  0x504F0000
+#define SDRAM_CONFIG1  0xC2222600
+#define SDRAM_CONFIG2  0x88B70004
+#define SDRAM_ADDRSEL  0x02000000
+
+#else
+#error Neither CONFIG_MPC5200 or CONFIG_MGT5100 defined
+#endif
diff --git a/board/tqc/tqm5200/tqm5200.c b/board/tqc/tqm5200/tqm5200.c
new file mode 100644 (file)
index 0000000..f9891db
--- /dev/null
@@ -0,0 +1,751 @@
+/*
+ * (C) Copyright 2003-2006
+ * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
+ *
+ * (C) Copyright 2004
+ * Mark Jonas, Freescale Semiconductor, mark.jonas@motorola.com.
+ *
+ * (C) Copyright 2004-2006
+ * Martin Krause, TQ-Systems GmbH, martin.krause@tqs.de
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.         See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+#include <common.h>
+#include <mpc5xxx.h>
+#include <pci.h>
+#include <asm/processor.h>
+#include <libfdt.h>
+
+#ifdef CONFIG_VIDEO_SM501
+#include <sm501.h>
+#endif
+
+#if defined(CONFIG_MPC5200_DDR)
+#include "mt46v16m16-75.h"
+#else
+#include "mt48lc16m16a2-75.h"
+#endif
+
+#ifdef CONFIG_OF_LIBFDT
+#include <fdt_support.h>
+#endif /* CONFIG_OF_LIBFDT */
+
+DECLARE_GLOBAL_DATA_PTR;
+
+#ifdef CONFIG_PS2MULT
+void ps2mult_early_init(void);
+#endif
+
+#ifndef CFG_RAMBOOT
+static void sdram_start (int hi_addr)
+{
+       long hi_addr_bit = hi_addr ? 0x01000000 : 0;
+
+       /* unlock mode register */
+       *(vu_long *)MPC5XXX_SDRAM_CTRL = SDRAM_CONTROL | 0x80000000 |
+               hi_addr_bit;
+       __asm__ volatile ("sync");
+
+       /* precharge all banks */
+       *(vu_long *)MPC5XXX_SDRAM_CTRL = SDRAM_CONTROL | 0x80000002 |
+               hi_addr_bit;
+       __asm__ volatile ("sync");
+
+#if SDRAM_DDR
+       /* set mode register: extended mode */
+       *(vu_long *)MPC5XXX_SDRAM_MODE = SDRAM_EMODE;
+       __asm__ volatile ("sync");
+
+       /* set mode register: reset DLL */
+       *(vu_long *)MPC5XXX_SDRAM_MODE = SDRAM_MODE | 0x04000000;
+       __asm__ volatile ("sync");
+#endif
+
+       /* precharge all banks */
+       *(vu_long *)MPC5XXX_SDRAM_CTRL = SDRAM_CONTROL | 0x80000002 |
+               hi_addr_bit;
+       __asm__ volatile ("sync");
+
+       /* auto refresh */
+       *(vu_long *)MPC5XXX_SDRAM_CTRL = SDRAM_CONTROL | 0x80000004 |
+               hi_addr_bit;
+       __asm__ volatile ("sync");
+
+       /* set mode register */
+       *(vu_long *)MPC5XXX_SDRAM_MODE = SDRAM_MODE;
+       __asm__ volatile ("sync");
+
+       /* normal operation */
+       *(vu_long *)MPC5XXX_SDRAM_CTRL = SDRAM_CONTROL | hi_addr_bit;
+       __asm__ volatile ("sync");
+}
+#endif
+
+/*
+ * ATTENTION: Although partially referenced initdram does NOT make real use
+ *           use of CFG_SDRAM_BASE. The code does not work if CFG_SDRAM_BASE
+ *           is something else than 0x00000000.
+ */
+
+long int initdram (int board_type)
+{
+       ulong dramsize = 0;
+       ulong dramsize2 = 0;
+       uint svr, pvr;
+
+#ifndef CFG_RAMBOOT
+       ulong test1, test2;
+
+       /* setup SDRAM chip selects */
+       *(vu_long *)MPC5XXX_SDRAM_CS0CFG = 0x0000001c; /* 512MB at 0x0 */
+       *(vu_long *)MPC5XXX_SDRAM_CS1CFG = 0x40000000; /* disabled */
+       __asm__ volatile ("sync");
+
+       /* setup config registers */
+       *(vu_long *)MPC5XXX_SDRAM_CONFIG1 = SDRAM_CONFIG1;
+       *(vu_long *)MPC5XXX_SDRAM_CONFIG2 = SDRAM_CONFIG2;
+       __asm__ volatile ("sync");
+
+#if SDRAM_DDR
+       /* set tap delay */
+       *(vu_long *)MPC5XXX_CDM_PORCFG = SDRAM_TAPDELAY;
+       __asm__ volatile ("sync");
+#endif
+
+       /* find RAM size using SDRAM CS0 only */
+       sdram_start(0);
+       test1 = get_ram_size((long *)CFG_SDRAM_BASE, 0x20000000);
+       sdram_start(1);
+       test2 = get_ram_size((long *)CFG_SDRAM_BASE, 0x20000000);
+       if (test1 > test2) {
+               sdram_start(0);
+               dramsize = test1;
+       } else {
+               dramsize = test2;
+       }
+
+       /* memory smaller than 1MB is impossible */
+       if (dramsize < (1 << 20)) {
+               dramsize = 0;
+       }
+
+       /* set SDRAM CS0 size according to the amount of RAM found */
+       if (dramsize > 0) {
+               *(vu_long *)MPC5XXX_SDRAM_CS0CFG = 0x13 +
+                       __builtin_ffs(dramsize >> 20) - 1;
+       } else {
+               *(vu_long *)MPC5XXX_SDRAM_CS0CFG = 0; /* disabled */
+       }
+
+       /* let SDRAM CS1 start right after CS0 */
+       *(vu_long *)MPC5XXX_SDRAM_CS1CFG = dramsize + 0x0000001c; /* 512MB */
+
+       /* find RAM size using SDRAM CS1 only */
+       if (!dramsize)
+               sdram_start(0);
+       test2 = test1 = get_ram_size((long *)(CFG_SDRAM_BASE + dramsize), 0x20000000);
+       if (!dramsize) {
+               sdram_start(1);
+               test2 = get_ram_size((long *)(CFG_SDRAM_BASE + dramsize), 0x20000000);
+       }
+       if (test1 > test2) {
+               sdram_start(0);
+               dramsize2 = test1;
+       } else {
+               dramsize2 = test2;
+       }
+
+       /* memory smaller than 1MB is impossible */
+       if (dramsize2 < (1 << 20)) {
+               dramsize2 = 0;
+       }
+
+       /* set SDRAM CS1 size according to the amount of RAM found */
+       if (dramsize2 > 0) {
+               *(vu_long *)MPC5XXX_SDRAM_CS1CFG = dramsize
+                       | (0x13 + __builtin_ffs(dramsize2 >> 20) - 1);
+       } else {
+               *(vu_long *)MPC5XXX_SDRAM_CS1CFG = dramsize; /* disabled */
+       }
+
+#else /* CFG_RAMBOOT */
+
+       /* retrieve size of memory connected to SDRAM CS0 */
+       dramsize = *(vu_long *)MPC5XXX_SDRAM_CS0CFG & 0xFF;
+       if (dramsize >= 0x13) {
+               dramsize = (1 << (dramsize - 0x13)) << 20;
+       } else {
+               dramsize = 0;
+       }
+
+       /* retrieve size of memory connected to SDRAM CS1 */
+       dramsize2 = *(vu_long *)MPC5XXX_SDRAM_CS1CFG & 0xFF;
+       if (dramsize2 >= 0x13) {
+               dramsize2 = (1 << (dramsize2 - 0x13)) << 20;
+       } else {
+               dramsize2 = 0;
+       }
+#endif /* CFG_RAMBOOT */
+
+       /*
+        * On MPC5200B we need to set the special configuration delay in the
+        * DDR controller. Please refer to Freescale's AN3221 "MPC5200B SDRAM
+        * Initialization and Configuration", 3.3.1 SDelay--MBAR + 0x0190:
+        *
+        * "The SDelay should be written to a value of 0x00000004. It is
+        * required to account for changes caused by normal wafer processing
+        * parameters."
+        */
+       svr = get_svr();
+       pvr = get_pvr();
+       if ((SVR_MJREV(svr) >= 2) &&
+           (PVR_MAJ(pvr) == 1) && (PVR_MIN(pvr) == 4)) {
+
+               *(vu_long *)MPC5XXX_SDRAM_SDELAY = 0x04;
+               __asm__ volatile ("sync");
+       }
+
+#if defined(CONFIG_TQM5200_B)
+       return dramsize + dramsize2;
+#else
+       return dramsize;
+#endif /* CONFIG_TQM5200_B */
+}
+
+int checkboard (void)
+{
+#if defined(CONFIG_AEVFIFO)
+       puts ("Board: AEVFIFO\n");
+       return 0;
+#endif
+
+#if defined(CONFIG_TQM5200S)
+# define MODULE_NAME   "TQM5200S"
+#else
+# define MODULE_NAME   "TQM5200"
+#endif
+
+#if defined(CONFIG_STK52XX)
+# define CARRIER_NAME  "STK52xx"
+#elif defined(CONFIG_TB5200)
+# define CARRIER_NAME  "TB5200"
+#elif defined(CONFIG_CAM5200)
+# define CARRIER_NAME  "CAM5200"
+#elif defined(CONFIG_FO300)
+# define CARRIER_NAME  "FO300"
+#else
+# error "UNKNOWN"
+#endif
+
+       puts (  "Board: " MODULE_NAME " (TQ-Components GmbH)\n"
+               "       on a " CARRIER_NAME " carrier board\n");
+
+       return 0;
+}
+
+#undef MODULE_NAME
+#undef CARRIER_NAME
+
+void flash_preinit(void)
+{
+       /*
+        * Now, when we are in RAM, enable flash write
+        * access for detection process.
+        * Note that CS_BOOT cannot be cleared when
+        * executing in flash.
+        */
+       *(vu_long *)MPC5XXX_BOOTCS_CFG &= ~0x1; /* clear RO */
+}
+
+
+#ifdef CONFIG_PCI
+static struct pci_controller hose;
+
+extern void pci_mpc5xxx_init(struct pci_controller *);
+
+void pci_init_board(void)
+{
+       pci_mpc5xxx_init(&hose);
+}
+#endif
+
+#if defined(CONFIG_CMD_IDE) && defined(CONFIG_IDE_RESET)
+
+#if defined (CONFIG_MINIFAP)
+#define SM501_POWER_MODE0_GATE         0x00000040UL
+#define SM501_POWER_MODE1_GATE         0x00000048UL
+#define POWER_MODE_GATE_GPIO_PWM_I2C   0x00000040UL
+#define SM501_GPIO_DATA_DIR_HIGH       0x0001000CUL
+#define SM501_GPIO_DATA_HIGH           0x00010004UL
+#define SM501_GPIO_51                  0x00080000UL
+#endif /* CONFIG MINIFAP */
+
+void init_ide_reset (void)
+{
+       debug ("init_ide_reset\n");
+
+#if defined (CONFIG_MINIFAP)
+       /* Configure GPIO_51 of the SM501 grafic controller as ATA reset */
+
+       /* enable GPIO control (in both power modes) */
+       *(vu_long *) (SM501_MMIO_BASE+SM501_POWER_MODE0_GATE) |=
+               POWER_MODE_GATE_GPIO_PWM_I2C;
+       *(vu_long *) (SM501_MMIO_BASE+SM501_POWER_MODE1_GATE) |=
+               POWER_MODE_GATE_GPIO_PWM_I2C;
+       /* configure GPIO51 as output */
+       *(vu_long *) (SM501_MMIO_BASE+SM501_GPIO_DATA_DIR_HIGH) |=
+               SM501_GPIO_51;
+#else
+       /* Configure PSC1_4 as GPIO output for ATA reset */
+       *(vu_long *) MPC5XXX_WU_GPIO_ENABLE |= GPIO_PSC1_4;
+       *(vu_long *) MPC5XXX_WU_GPIO_DIR    |= GPIO_PSC1_4;
+
+       /* by default the ATA reset is de-asserted */
+       *(vu_long *) MPC5XXX_WU_GPIO_DATA_O |=  GPIO_PSC1_4;
+#endif
+}
+
+void ide_set_reset (int idereset)
+{
+       debug ("ide_reset(%d)\n", idereset);
+
+#if defined (CONFIG_MINIFAP)
+       if (idereset) {
+               *(vu_long *) (SM501_MMIO_BASE+SM501_GPIO_DATA_HIGH) &=
+                       ~SM501_GPIO_51;
+       } else {
+               *(vu_long *) (SM501_MMIO_BASE+SM501_GPIO_DATA_HIGH) |=
+                       SM501_GPIO_51;
+       }
+#else
+       if (idereset) {
+               *(vu_long *) MPC5XXX_WU_GPIO_DATA_O &= ~GPIO_PSC1_4;
+       } else {
+               *(vu_long *) MPC5XXX_WU_GPIO_DATA_O |=  GPIO_PSC1_4;
+       }
+#endif
+}
+#endif
+
+#ifdef CONFIG_POST
+/*
+ * Reads GPIO pin PSC6_3. A keypress is reported, if PSC6_3 is low. If PSC6_3
+ * is left open, no keypress is detected.
+ */
+int post_hotkeys_pressed(void)
+{
+#ifdef CONFIG_STK52XX
+       struct mpc5xxx_gpio *gpio;
+
+       gpio = (struct mpc5xxx_gpio*) MPC5XXX_GPIO;
+
+       /*
+        * Configure PSC6_1 and PSC6_3 as GPIO. PSC6 then couldn't be used in
+        * CODEC or UART mode. Consumer IrDA should still be possible.
+        */
+       gpio->port_config &= ~(0x07000000);
+       gpio->port_config |=   0x03000000;
+
+       /* Enable GPIO for GPIO_IRDA_1 (IR_USB_CLK pin) = PSC6_3 */
+       gpio->simple_gpioe |= 0x20000000;
+
+       /* Configure GPIO_IRDA_1 as input */
+       gpio->simple_ddr &= ~(0x20000000);
+
+       return ((gpio->simple_ival & 0x20000000) ? 0 : 1);
+#else
+       return 0;
+#endif
+}
+#endif
+
+#if defined(CONFIG_POST) || defined(CONFIG_LOGBUFFER)
+
+void post_word_store (ulong a)
+{
+       volatile ulong *save_addr =
+               (volatile ulong *)(MPC5XXX_SRAM + MPC5XXX_SRAM_POST_SIZE);
+
+       *save_addr = a;
+}
+
+ulong post_word_load (void)
+{
+       volatile ulong *save_addr =
+               (volatile ulong *)(MPC5XXX_SRAM + MPC5XXX_SRAM_POST_SIZE);
+
+       return *save_addr;
+}
+#endif /* CONFIG_POST || CONFIG_LOGBUFFER*/
+
+#ifdef CONFIG_BOARD_EARLY_INIT_R
+int board_early_init_r (void)
+{
+
+       extern int usb_cpu_init(void);
+
+#ifdef CONFIG_PS2MULT
+       ps2mult_early_init();
+#endif /* CONFIG_PS2MULT */
+
+#if defined(CONFIG_USB_OHCI_NEW) && defined(CFG_USB_OHCI_CPU_INIT)
+       /* Low level USB init, required for proper kernel operation */
+       usb_cpu_init();
+#endif
+
+       return (0);
+}
+#endif
+
+#ifdef CONFIG_FO300
+int silent_boot (void)
+{
+       vu_long timer3_status;
+
+       /* Configure GPT3 as GPIO input */
+       *(vu_long *)MPC5XXX_GPT3_ENABLE = 0x00000004;
+
+       /* Read in TIMER_3 pin status */
+       timer3_status = *(vu_long *)MPC5XXX_GPT3_STATUS;
+
+#ifdef FO300_SILENT_CONSOLE_WHEN_S1_CLOSED
+       /* Force silent console mode if S1 switch
+        * is in closed position (TIMER_3 pin status is LOW). */
+       if (MPC5XXX_GPT_GPIO_PIN(timer3_status) == 0)
+               return 1;
+#else
+       /* Force silent console mode if S1 switch
+        * is in open position (TIMER_3 pin status is HIGH). */
+       if (MPC5XXX_GPT_GPIO_PIN(timer3_status) == 1)
+               return 1;
+#endif
+
+       return 0;
+}
+
+int board_early_init_f (void)
+{
+       if (silent_boot())
+               gd->flags |= GD_FLG_SILENT;
+
+       return 0;
+}
+#endif /* CONFIG_FO300 */
+
+int last_stage_init (void)
+{
+       /*
+        * auto scan for really existing devices and re-set chip select
+        * configuration.
+        */
+       u16 save, tmp;
+       int restore;
+
+       /*
+        * Check for SRAM and SRAM size
+        */
+
+       /* save original SRAM content  */
+       save = *(volatile u16 *)CFG_CS2_START;
+       restore = 1;
+
+       /* write test pattern to SRAM */
+       *(volatile u16 *)CFG_CS2_START = 0xA5A5;
+       __asm__ volatile ("sync");
+       /*
+        * Put a different pattern on the data lines: otherwise they may float
+        * long enough to read back what we wrote.
+        */
+       tmp = *(volatile u16 *)CFG_FLASH_BASE;
+       if (tmp == 0xA5A5)
+               puts ("!! possible error in SRAM detection\n");
+
+       if (*(volatile u16 *)CFG_CS2_START != 0xA5A5) {
+               /* no SRAM at all, disable cs */
+               *(vu_long *)MPC5XXX_ADDECR &= ~(1 << 18);
+               *(vu_long *)MPC5XXX_CS2_START = 0x0000FFFF;
+               *(vu_long *)MPC5XXX_CS2_STOP = 0x0000FFFF;
+               restore = 0;
+               __asm__ volatile ("sync");
+       } else if (*(volatile u16 *)(CFG_CS2_START + (1<<19)) == 0xA5A5) {
+               /* make sure that we access a mirrored address */
+               *(volatile u16 *)CFG_CS2_START = 0x1111;
+               __asm__ volatile ("sync");
+               if (*(volatile u16 *)(CFG_CS2_START + (1<<19)) == 0x1111) {
+                       /* SRAM size = 512 kByte */
+                       *(vu_long *)MPC5XXX_CS2_STOP = STOP_REG(CFG_CS2_START,
+                                                               0x80000);
+                       __asm__ volatile ("sync");
+                       puts ("SRAM:  512 kB\n");
+               }
+               else
+                       puts ("!! possible error in SRAM detection\n");
+       } else {
+               puts ("SRAM:  1 MB\n");
+       }
+       /* restore origianl SRAM content  */
+       if (restore) {
+               *(volatile u16 *)CFG_CS2_START = save;
+               __asm__ volatile ("sync");
+       }
+
+#ifndef CONFIG_TQM5200S        /* The TQM5200S has no SM501 grafic controller */
+       /*
+        * Check for Grafic Controller
+        */
+
+       /* save origianl FB content  */
+       save = *(volatile u16 *)CFG_CS1_START;
+       restore = 1;
+
+       /* write test pattern to FB memory */
+       *(volatile u16 *)CFG_CS1_START = 0xA5A5;
+       __asm__ volatile ("sync");
+       /*
+        * Put a different pattern on the data lines: otherwise they may float
+        * long enough to read back what we wrote.
+        */
+       tmp = *(volatile u16 *)CFG_FLASH_BASE;
+       if (tmp == 0xA5A5)
+               puts ("!! possible error in grafic controller detection\n");
+
+       if (*(volatile u16 *)CFG_CS1_START != 0xA5A5) {
+               /* no grafic controller at all, disable cs */
+               *(vu_long *)MPC5XXX_ADDECR &= ~(1 << 17);
+               *(vu_long *)MPC5XXX_CS1_START = 0x0000FFFF;
+               *(vu_long *)MPC5XXX_CS1_STOP = 0x0000FFFF;
+               restore = 0;
+               __asm__ volatile ("sync");
+       } else {
+               puts ("VGA:   SMI501 (Voyager) with 8 MB\n");
+       }
+       /* restore origianl FB content  */
+       if (restore) {
+               *(volatile u16 *)CFG_CS1_START = save;
+               __asm__ volatile ("sync");
+       }
+
+#ifdef CONFIG_FO300
+       if (silent_boot()) {
+               setenv("bootdelay", "0");
+               disable_ctrlc(1);
+       }
+#endif
+#endif /* !CONFIG_TQM5200S */
+
+       return 0;
+}
+
+#ifdef CONFIG_VIDEO_SM501
+
+#ifdef CONFIG_FO300
+#define DISPLAY_WIDTH   800
+#else
+#define DISPLAY_WIDTH   640
+#endif
+#define DISPLAY_HEIGHT  480
+
+#ifdef CONFIG_VIDEO_SM501_8BPP
+#error CONFIG_VIDEO_SM501_8BPP not supported.
+#endif /* CONFIG_VIDEO_SM501_8BPP */
+
+#ifdef CONFIG_VIDEO_SM501_16BPP
+#error CONFIG_VIDEO_SM501_16BPP not supported.
+#endif /* CONFIG_VIDEO_SM501_16BPP */
+#ifdef CONFIG_VIDEO_SM501_32BPP
+static const SMI_REGS init_regs [] =
+{
+#if 0 /* CRT only */
+       {0x00004, 0x0},
+       {0x00048, 0x00021807},
+       {0x0004C, 0x10090a01},
+       {0x00054, 0x1},
+       {0x00040, 0x00021807},
+       {0x00044, 0x10090a01},
+       {0x00054, 0x0},
+       {0x80200, 0x00010000},
+       {0x80204, 0x0},
+       {0x80208, 0x0A000A00},
+       {0x8020C, 0x02fa027f},
+       {0x80210, 0x004a028b},
+       {0x80214, 0x020c01df},
+       {0x80218, 0x000201e9},
+       {0x80200, 0x00013306},
+#else  /* panel + CRT */
+#ifdef CONFIG_FO300
+       {0x00004, 0x0},
+       {0x00048, 0x00021807},
+       {0x0004C, 0x301a0a01},
+       {0x00054, 0x1},
+       {0x00040, 0x00021807},
+       {0x00044, 0x091a0a01},
+       {0x00054, 0x0},
+       {0x80000, 0x0f013106},
+       {0x80004, 0xc428bb17},
+       {0x8000C, 0x00000000},
+       {0x80010, 0x0C800C80},
+       {0x80014, 0x03200000},
+       {0x80018, 0x01e00000},
+       {0x8001C, 0x00000000},
+       {0x80020, 0x01e00320},
+       {0x80024, 0x042a031f},
+       {0x80028, 0x0086034a},
+       {0x8002C, 0x020c01df},
+       {0x80030, 0x000201ea},
+       {0x80200, 0x00010000},
+#else
+       {0x00004, 0x0},
+       {0x00048, 0x00021807},
+       {0x0004C, 0x091a0a01},
+       {0x00054, 0x1},
+       {0x00040, 0x00021807},
+       {0x00044, 0x091a0a01},
+       {0x00054, 0x0},
+       {0x80000, 0x0f013106},
+       {0x80004, 0xc428bb17},
+       {0x8000C, 0x00000000},
+       {0x80010, 0x0a000a00},
+       {0x80014, 0x02800000},
+       {0x80018, 0x01e00000},
+       {0x8001C, 0x00000000},
+       {0x80020, 0x01e00280},
+       {0x80024, 0x02fa027f},
+       {0x80028, 0x004a028b},
+       {0x8002C, 0x020c01df},
+       {0x80030, 0x000201e9},
+       {0x80200, 0x00010000},
+#endif /* #ifdef CONFIG_FO300 */
+#endif
+       {0, 0}
+};
+#endif /* CONFIG_VIDEO_SM501_32BPP */
+
+#ifdef CONFIG_CONSOLE_EXTRA_INFO
+/*
+ * Return text to be printed besides the logo.
+ */
+void video_get_info_str (int line_number, char *info)
+{
+       if (line_number == 1) {
+       strcpy (info, " Board: TQM5200 (TQ-Components GmbH)");
+#if defined (CONFIG_STK52XX) || defined (CONFIG_TB5200) || defined(CONFIG_FO300)
+       } else if (line_number == 2) {
+#if defined (CONFIG_STK52XX)
+               strcpy (info, "        on a STK52xx carrier board");
+#endif
+#if defined (CONFIG_TB5200)
+               strcpy (info, "        on a TB5200 carrier board");
+#endif
+#if defined (CONFIG_FO300)
+               strcpy (info, "        on a FO300 carrier board");
+#endif
+#endif
+       }
+       else {
+               info [0] = '\0';
+       }
+}
+#endif
+
+/*
+ * Returns SM501 register base address. First thing called in the
+ * driver. Checks if SM501 is physically present.
+ */
+unsigned int board_video_init (void)
+{
+       u16 save, tmp;
+       int restore, ret;
+
+       /*
+        * Check for Grafic Controller
+        */
+
+       /* save origianl FB content  */
+       save = *(volatile u16 *)CFG_CS1_START;
+       restore = 1;
+
+       /* write test pattern to FB memory */
+       *(volatile u16 *)CFG_CS1_START = 0xA5A5;
+       __asm__ volatile ("sync");
+       /*
+        * Put a different pattern on the data lines: otherwise they may float
+        * long enough to read back what we wrote.
+        */
+       tmp = *(volatile u16 *)CFG_FLASH_BASE;
+       if (tmp == 0xA5A5)
+               puts ("!! possible error in grafic controller detection\n");
+
+       if (*(volatile u16 *)CFG_CS1_START != 0xA5A5) {
+               /* no grafic controller found */
+               restore = 0;
+               ret = 0;
+       } else {
+               ret = SM501_MMIO_BASE;
+       }
+
+       if (restore) {
+               *(volatile u16 *)CFG_CS1_START = save;
+               __asm__ volatile ("sync");
+       }
+       return ret;
+}
+
+/*
+ * Returns SM501 framebuffer address
+ */
+unsigned int board_video_get_fb (void)
+{
+       return SM501_FB_BASE;
+}
+
+/*
+ * Called after initializing the SM501 and before clearing the screen.
+ */
+void board_validate_screen (unsigned int base)
+{
+}
+
+/*
+ * Return a pointer to the initialization sequence.
+ */
+const SMI_REGS *board_get_regs (void)
+{
+       return init_regs;
+}
+
+int board_get_width (void)
+{
+       return DISPLAY_WIDTH;
+}
+
+int board_get_height (void)
+{
+       return DISPLAY_HEIGHT;
+}
+
+#endif /* CONFIG_VIDEO_SM501 */
+
+#if defined(CONFIG_OF_LIBFDT) && defined(CONFIG_OF_BOARD_SETUP)
+void ft_board_setup(void *blob, bd_t *bd)
+{
+       ft_cpu_setup(blob, bd);
+       fdt_fixup_memory(blob, (u64)bd->bi_memstart, (u64)bd->bi_memsize);
+}
+#endif /* defined(CONFIG_OF_LIBFDT) && defined(CONFIG_OF_BOARD_SETUP) */
diff --git a/board/tqc/tqm8260/Makefile b/board/tqc/tqm8260/Makefile
new file mode 100644 (file)
index 0000000..61221fd
--- /dev/null
@@ -0,0 +1,47 @@
+#
+# (C) Copyright 2001-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
+ifneq ($(OBJTREE),$(SRCTREE))
+$(shell mkdir -p $(obj)../tqm8xx/)
+endif
+
+LIB    = $(obj)lib$(BOARD).a
+
+COBJS  = $(BOARD).o flash.o ../tqm8xx/load_sernum_ethaddr.o
+
+SRCS   := $(SOBJS:.o=.S) $(COBJS:.o=.c)
+OBJS   := $(addprefix $(obj),$(COBJS))
+SOBJS  := $(addprefix $(obj),$(SOBJS))
+
+$(LIB):        $(obj).depend $(OBJS)
+       $(AR) $(ARFLAGS) $@ $(OBJS)
+
+#########################################################################
+
+# defines $(obj).depend target
+include $(SRCTREE)/rules.mk
+
+sinclude $(obj).depend
+
+#########################################################################
diff --git a/board/tqc/tqm8260/config.mk b/board/tqc/tqm8260/config.mk
new file mode 100644 (file)
index 0000000..1fe9952
--- /dev/null
@@ -0,0 +1,34 @@
+#
+# (C) Copyright 2001
+# Wolfgang Denk, DENX Software Engineering, wd@denx.de.
+#
+# See file CREDITS for list of people who contributed to this
+# project.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 2 of
+# the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+# MA 02111-1307 USA
+#
+
+#
+# TQM8260 boards
+#
+
+# This should be equal to the CFG_FLASH_BASE define in config_TQM8260.h
+# for the "final" configuration, with U-Boot in flash, or the address
+# in RAM where U-Boot is loaded at for debugging.
+#
+TEXT_BASE = 0x40000000
+
+PLATFORM_CPPFLAGS += -DTEXT_BASE=$(TEXT_BASE) -I$(TOPDIR)
diff --git a/board/tqc/tqm8260/flash.c b/board/tqc/tqm8260/flash.c
new file mode 100644 (file)
index 0000000..056fe81
--- /dev/null
@@ -0,0 +1,488 @@
+/*
+ * (C) Copyright 2001, 2002
+ * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
+ *
+ * Flash Routines for AMD devices on the TQM8260 board
+ *
+ *--------------------------------------------------------------------
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+#include <common.h>
+#include <mpc8xx.h>
+
+#define V_ULONG(a)     (*(volatile unsigned long *)( a ))
+#define V_BYTE(a)      (*(volatile unsigned char *)( a ))
+
+
+flash_info_t flash_info[CFG_MAX_FLASH_BANKS];
+
+
+/*-----------------------------------------------------------------------
+ */
+void flash_reset (void)
+{
+       if (flash_info[0].flash_id != FLASH_UNKNOWN) {
+               V_ULONG (flash_info[0].start[0]) = 0x00F000F0;
+               V_ULONG (flash_info[0].start[0] + 4) = 0x00F000F0;
+       }
+}
+
+/*-----------------------------------------------------------------------
+ */
+ulong flash_get_size (ulong baseaddr, flash_info_t * info)
+{
+       short i;
+       unsigned long flashtest_h, flashtest_l;
+
+       /* Write auto select command sequence and test FLASH answer */
+       V_ULONG (baseaddr + ((ulong) 0x0555 << 3)) = 0x00AA00AA;
+       V_ULONG (baseaddr + ((ulong) 0x02AA << 3)) = 0x00550055;
+       V_ULONG (baseaddr + ((ulong) 0x0555 << 3)) = 0x00900090;
+       V_ULONG (baseaddr + 4 + ((ulong) 0x0555 << 3)) = 0x00AA00AA;
+       V_ULONG (baseaddr + 4 + ((ulong) 0x02AA << 3)) = 0x00550055;
+       V_ULONG (baseaddr + 4 + ((ulong) 0x0555 << 3)) = 0x00900090;
+
+       flashtest_h = V_ULONG (baseaddr);       /* manufacturer ID     */
+       flashtest_l = V_ULONG (baseaddr + 4);
+
+       switch ((int) flashtest_h) {
+       case AMD_MANUFACT:
+               info->flash_id = FLASH_MAN_AMD;
+               break;
+       case FUJ_MANUFACT:
+               info->flash_id = FLASH_MAN_FUJ;
+               break;
+       default:
+               info->flash_id = FLASH_UNKNOWN;
+               info->sector_count = 0;
+               info->size = 0;
+               return (0);                     /* no or unknown flash     */
+       }
+
+       flashtest_h = V_ULONG (baseaddr + 8);   /* device ID           */
+       flashtest_l = V_ULONG (baseaddr + 12);
+       if (flashtest_h != flashtest_l) {
+               info->flash_id = FLASH_UNKNOWN;
+       } else {
+               switch (flashtest_h) {
+               case AMD_ID_LV800T:
+                       info->flash_id += FLASH_AM800T;
+                       info->sector_count = 19;
+                       info->size = 0x00400000;
+                       break;                  /* 4 * 1 MB = 4 MB  */
+               case AMD_ID_LV800B:
+                       info->flash_id += FLASH_AM800B;
+                       info->sector_count = 19;
+                       info->size = 0x00400000;
+                       break;                  /* 4 * 1 MB = 4 MB  */
+               case AMD_ID_LV160T:
+                       info->flash_id += FLASH_AM160T;
+                       info->sector_count = 35;
+                       info->size = 0x00800000;
+                       break;                  /* 4 * 2 MB = 8 MB  */
+               case AMD_ID_LV160B:
+                       info->flash_id += FLASH_AM160B;
+                       info->sector_count = 35;
+                       info->size = 0x00800000;
+                       break;                  /* 4 * 2 MB = 8 MB  */
+               case AMD_ID_DL322T:
+                       info->flash_id += FLASH_AMDL322T;
+                       info->sector_count = 71;
+                       info->size = 0x01000000;
+                       break;                  /* 4 * 4 MB = 16 MB */
+               case AMD_ID_DL322B:
+                       info->flash_id += FLASH_AMDL322B;
+                       info->sector_count = 71;
+                       info->size = 0x01000000;
+                       break;                  /* 4 * 4 MB = 16 MB */
+               case AMD_ID_DL323T:
+                       info->flash_id += FLASH_AMDL323T;
+                       info->sector_count = 71;
+                       info->size = 0x01000000;
+                       break;                  /* 4 * 4 MB = 16 MB */
+               case AMD_ID_DL323B:
+                       info->flash_id += FLASH_AMDL323B;
+                       info->sector_count = 71;
+                       info->size = 0x01000000;
+                       break;                  /* 4 * 4 MB = 16 MB */
+               case AMD_ID_LV640U:
+                       info->flash_id += FLASH_AM640U;
+                       info->sector_count = 128;
+                       info->size = 0x02000000;
+                       break;                  /* 4 * 8 MB = 32 MB */
+               default:
+                       info->flash_id = FLASH_UNKNOWN;
+                       return (0);             /* no or unknown flash     */
+               }
+       }
+
+       if (flashtest_h == AMD_ID_LV640U) {
+
+               /* set up sector start adress table (uniform sector type) */
+               for (i = 0; i < info->sector_count; i++)
+                       info->start[i] = baseaddr + (i * 0x00040000);
+
+       } else if (info->flash_id & FLASH_BTYPE) {
+
+               /* set up sector start adress table (bottom sector type) */
+               info->start[0] = baseaddr + 0x00000000;
+               info->start[1] = baseaddr + 0x00010000;
+               info->start[2] = baseaddr + 0x00018000;
+               info->start[3] = baseaddr + 0x00020000;
+               for (i = 4; i < info->sector_count; i++) {
+                       info->start[i] = baseaddr + (i * 0x00040000) - 0x000C0000;
+               }
+
+       } else {
+
+               /* set up sector start adress table (top sector type) */
+               i = info->sector_count - 1;
+               info->start[i--] = baseaddr + info->size - 0x00010000;
+               info->start[i--] = baseaddr + info->size - 0x00018000;
+               info->start[i--] = baseaddr + info->size - 0x00020000;
+               for (; i >= 0; i--) {
+                       info->start[i] = baseaddr + i * 0x00040000;
+               }
+       }
+
+       /* check for protected sectors */
+       for (i = 0; i < info->sector_count; i++) {
+               /* read sector protection at sector address, (A7 .. A0) = 0x02 */
+               if ((V_ULONG (info->start[i] + 16) & 0x00010001) ||
+                       (V_ULONG (info->start[i] + 20) & 0x00010001)) {
+                       info->protect[i] = 1;   /* D0 = 1 if protected */
+               } else {
+                       info->protect[i] = 0;
+               }
+       }
+
+       flash_reset ();
+       return (info->size);
+}
+
+/*-----------------------------------------------------------------------
+ */
+unsigned long flash_init (void)
+{
+       unsigned long size_b0 = 0;
+       int i;
+
+       /* Init: no FLASHes known */
+       for (i = 0; i < CFG_MAX_FLASH_BANKS; ++i) {
+               flash_info[i].flash_id = FLASH_UNKNOWN;
+       }
+
+       /* Static FLASH Bank configuration here (only one bank) */
+
+       size_b0 = flash_get_size (CFG_FLASH0_BASE, &flash_info[0]);
+       if (flash_info[0].flash_id == FLASH_UNKNOWN || size_b0 == 0) {
+               printf ("## Unknown FLASH on Bank 0 - Size = 0x%08lx = %ld MB\n",
+                               size_b0, size_b0 >> 20);
+       }
+
+       /*
+        * protect monitor and environment sectors
+        */
+
+#if CFG_MONITOR_BASE >= CFG_FLASH0_BASE
+       flash_protect (FLAG_PROTECT_SET,
+                      CFG_MONITOR_BASE,
+                      CFG_MONITOR_BASE + monitor_flash_len - 1, &flash_info[0]);
+#endif
+
+#if (CFG_ENV_IS_IN_FLASH == 1) && defined(CFG_ENV_ADDR)
+# ifndef  CFG_ENV_SIZE
+#  define CFG_ENV_SIZE CFG_ENV_SECT_SIZE
+# endif
+       flash_protect (FLAG_PROTECT_SET,
+                      CFG_ENV_ADDR,
+                      CFG_ENV_ADDR + CFG_ENV_SIZE - 1, &flash_info[0]);
+#endif
+
+       return (size_b0);
+}
+
+/*-----------------------------------------------------------------------
+ */
+void flash_print_info (flash_info_t * info)
+{
+       int i;
+
+       if (info->flash_id == FLASH_UNKNOWN) {
+               printf ("missing or unknown FLASH type\n");
+               return;
+       }
+
+       switch (info->flash_id & FLASH_VENDMASK) {
+       case FLASH_MAN_AMD:
+               printf ("AMD ");
+               break;
+       case FLASH_MAN_FUJ:
+               printf ("FUJITSU ");
+               break;
+       default:
+               printf ("Unknown Vendor ");
+               break;
+       }
+
+       switch (info->flash_id & FLASH_TYPEMASK) {
+       case FLASH_AM800T:
+               printf ("29LV800T (8 M, top sector)\n");
+               break;
+       case FLASH_AM800B:
+               printf ("29LV800T (8 M, bottom sector)\n");
+               break;
+       case FLASH_AM160T:
+               printf ("29LV160T (16 M, top sector)\n");
+               break;
+       case FLASH_AM160B:
+               printf ("29LV160B (16 M, bottom sector)\n");
+               break;
+       case FLASH_AMDL322T:
+               printf ("29DL322T (32 M, top sector)\n");
+               break;
+       case FLASH_AMDL322B:
+               printf ("29DL322B (32 M, bottom sector)\n");
+               break;
+       case FLASH_AMDL323T:
+               printf ("29DL323T (32 M, top sector)\n");
+               break;
+       case FLASH_AMDL323B:
+               printf ("29DL323B (32 M, bottom sector)\n");
+               break;
+       case FLASH_AM640U:
+               printf ("29LV640D (64 M, uniform sector)\n");
+               break;
+       default:
+               printf ("Unknown Chip Type\n");
+               break;
+       }
+
+       printf ("  Size: %ld MB in %d Sectors\n",
+                       info->size >> 20, info->sector_count);
+
+       printf ("  Sector Start Addresses:");
+       for (i = 0; i < info->sector_count; ++i) {
+               if ((i % 5) == 0)
+                       printf ("\n   ");
+               printf (" %08lX%s",
+                       info->start[i],
+                       info->protect[i] ? " (RO)" : "     "
+               );
+       }
+       printf ("\n");
+       return;
+}
+
+/*-----------------------------------------------------------------------
+ */
+int flash_erase (flash_info_t * info, int s_first, int s_last)
+{
+       int flag, prot, sect, l_sect;
+       ulong start, now, last;
+
+       if ((s_first < 0) || (s_first > s_last)) {
+               if (info->flash_id == FLASH_UNKNOWN) {
+                       printf ("- missing\n");
+               } else {
+                       printf ("- no sectors to erase\n");
+               }
+               return 1;
+       }
+
+       prot = 0;
+       for (sect = s_first; sect <= s_last; sect++) {
+               if (info->protect[sect])
+                       prot++;
+       }
+
+       if (prot) {
+               printf ("- Warning: %d protected sectors will not be erased!\n",
+                       prot);
+       } else {
+               printf ("\n");
+       }
+
+       l_sect = -1;
+
+       /* Disable interrupts which might cause a timeout here */
+       flag = disable_interrupts ();
+
+       V_ULONG (info->start[0] + (0x0555 << 3)) = 0x00AA00AA;
+       V_ULONG (info->start[0] + (0x02AA << 3)) = 0x00550055;
+       V_ULONG (info->start[0] + (0x0555 << 3)) = 0x00800080;
+       V_ULONG (info->start[0] + (0x0555 << 3)) = 0x00AA00AA;
+       V_ULONG (info->start[0] + (0x02AA << 3)) = 0x00550055;
+       V_ULONG (info->start[0] + 4 + (0x0555 << 3)) = 0x00AA00AA;
+       V_ULONG (info->start[0] + 4 + (0x02AA << 3)) = 0x00550055;
+       V_ULONG (info->start[0] + 4 + (0x0555 << 3)) = 0x00800080;
+       V_ULONG (info->start[0] + 4 + (0x0555 << 3)) = 0x00AA00AA;
+       V_ULONG (info->start[0] + 4 + (0x02AA << 3)) = 0x00550055;
+       udelay (1000);
+
+       /* Start erase on unprotected sectors */
+       for (sect = s_first; sect <= s_last; sect++) {
+               if (info->protect[sect] == 0) { /* not protected */
+                       V_ULONG (info->start[sect]) = 0x00300030;
+                       V_ULONG (info->start[sect] + 4) = 0x00300030;
+                       l_sect = sect;
+               }
+       }
+
+       /* re-enable interrupts if necessary */
+       if (flag)
+               enable_interrupts ();
+
+       /* wait at least 80us - let's wait 1 ms */
+       udelay (1000);
+
+       /*
+        * We wait for the last triggered sector
+        */
+       if (l_sect < 0)
+               goto DONE;
+
+       start = get_timer (0);
+       last = start;
+       while ((V_ULONG (info->start[l_sect]) & 0x00800080) != 0x00800080 ||
+              (V_ULONG (info->start[l_sect] + 4) & 0x00800080) != 0x00800080)
+       {
+               if ((now = get_timer (start)) > CFG_FLASH_ERASE_TOUT) {
+                       printf ("Timeout\n");
+                       return 1;
+               }
+               /* show that we're waiting */
+               if ((now - last) > 1000) {      /* every second */
+                       serial_putc ('.');
+                       last = now;
+               }
+       }
+
+  DONE:
+       /* reset to read mode */
+       flash_reset ();
+
+       printf (" done\n");
+       return 0;
+}
+
+static int write_dword (flash_info_t *, ulong, unsigned char *);
+
+/*-----------------------------------------------------------------------
+ * Copy memory to flash, returns:
+ * 0 - OK
+ * 1 - write timeout
+ * 2 - Flash not erased
+ */
+
+int write_buff (flash_info_t * info, uchar * src, ulong addr, ulong cnt)
+{
+       ulong dp;
+       static unsigned char bb[8];
+       int i, l, rc, cc = cnt;
+
+       dp = (addr & ~7);               /* get lower dword aligned address */
+
+       /*
+        * handle unaligned start bytes
+        */
+       if ((l = addr - dp) != 0) {
+               for (i = 0; i < 8; i++)
+                       bb[i] = (i < l || (i - l) >= cc) ? V_BYTE (dp + i) : *src++;
+               if ((rc = write_dword (info, dp, bb)) != 0) {
+                       return (rc);
+               }
+               dp += 8;
+               cc -= 8 - l;
+       }
+
+       /*
+        * handle word aligned part
+        */
+       while (cc >= 8) {
+               if ((rc = write_dword (info, dp, src)) != 0) {
+                       return (rc);
+               }
+               dp += 8;
+               src += 8;
+               cc -= 8;
+       }
+
+       if (cc <= 0) {
+               return (0);
+       }
+
+       /*
+        * handle unaligned tail bytes
+        */
+       for (i = 0; i < 8; i++) {
+               bb[i] = (i < cc) ? *src++ : V_BYTE (dp + i);
+       }
+       return (write_dword (info, dp, bb));
+}
+
+/*-----------------------------------------------------------------------
+ * Write a dword to Flash, returns:
+ * 0 - OK
+ * 1 - write timeout
+ * 2 - Flash not erased
+ */
+static int write_dword (flash_info_t * info, ulong dest, unsigned char *pdata)
+{
+       ulong start, cl, ch;
+       int flag, i;
+
+       for (ch = 0, i = 0; i < 4; i++)
+               ch = (ch << 8) + *pdata++;      /* high word    */
+       for (cl = 0, i = 0; i < 4; i++)
+               cl = (cl << 8) + *pdata++;      /* low word */
+
+       /* Check if Flash is (sufficiently) erased */
+       if ((*((vu_long *) dest) & ch) != ch
+               || (*((vu_long *) (dest + 4)) & cl) != cl) {
+               return (2);
+       }
+
+       /* Disable interrupts which might cause a timeout here */
+       flag = disable_interrupts ();
+
+       V_ULONG (info->start[0] + (0x0555 << 3)) = 0x00AA00AA;
+       V_ULONG (info->start[0] + (0x02AA << 3)) = 0x00550055;
+       V_ULONG (info->start[0] + (0x0555 << 3)) = 0x00A000A0;
+       V_ULONG (dest) = ch;
+       V_ULONG (info->start[0] + 4 + (0x0555 << 3)) = 0x00AA00AA;
+       V_ULONG (info->start[0] + 4 + (0x02AA << 3)) = 0x00550055;
+       V_ULONG (info->start[0] + 4 + (0x0555 << 3)) = 0x00A000A0;
+       V_ULONG (dest + 4) = cl;
+
+       /* re-enable interrupts if necessary */
+       if (flag)
+               enable_interrupts ();
+
+       /* data polling for D7 */
+       start = get_timer (0);
+       while (((V_ULONG (dest) & 0x00800080) != (ch & 0x00800080)) ||
+                  ((V_ULONG (dest + 4) & 0x00800080) != (cl & 0x00800080))) {
+               if (get_timer (start) > CFG_FLASH_WRITE_TOUT) {
+                       return (1);
+               }
+       }
+       return (0);
+}
diff --git a/board/tqc/tqm8260/tqm8260.c b/board/tqc/tqm8260/tqm8260.c
new file mode 100644 (file)
index 0000000..736c410
--- /dev/null
@@ -0,0 +1,368 @@
+/*
+ * (C) Copyright 2001
+ * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+#include <common.h>
+#include <ioports.h>
+#include <mpc8260.h>
+
+/*
+ * I/O Port configuration table
+ *
+ * if conf is 1, then that port pin will be configured at boot time
+ * according to the five values podr/pdir/ppar/psor/pdat for that entry
+ */
+
+const iop_conf_t iop_conf_tab[4][32] = {
+
+    /* Port A configuration */
+    {  /*            conf ppar psor pdir podr pdat */
+       /* PA31 */ {   0,   0,   0,   1,   0,   0   }, /* FCC1 *ATMTXEN */
+       /* PA30 */ {   0,   0,   0,   1,   0,   0   }, /* FCC1 ATMTCA   */
+       /* PA29 */ {   0,   0,   0,   1,   0,   0   }, /* FCC1 ATMTSOC  */
+       /* PA28 */ {   0,   0,   0,   1,   0,   0   }, /* FCC1 *ATMRXEN */
+       /* PA27 */ {   0,   0,   0,   1,   0,   0   }, /* FCC1 ATMRSOC */
+       /* PA26 */ {   0,   0,   0,   1,   0,   0   }, /* FCC1 ATMRCA */
+       /* PA25 */ {   0,   0,   0,   1,   0,   0   }, /* FCC1 ATMTXD[0] */
+       /* PA24 */ {   0,   0,   0,   1,   0,   0   }, /* FCC1 ATMTXD[1] */
+       /* PA23 */ {   0,   0,   0,   1,   0,   0   }, /* FCC1 ATMTXD[2] */
+       /* PA22 */ {   0,   0,   0,   1,   0,   0   }, /* FCC1 ATMTXD[3] */
+       /* PA21 */ {   0,   0,   0,   1,   0,   0   }, /* FCC1 ATMTXD[4] */
+       /* PA20 */ {   0,   0,   0,   1,   0,   0   }, /* FCC1 ATMTXD[5] */
+       /* PA19 */ {   0,   0,   0,   1,   0,   0   }, /* FCC1 ATMTXD[6] */
+       /* PA18 */ {   0,   0,   0,   1,   0,   0   }, /* FCC1 ATMTXD[7] */
+       /* PA17 */ {   0,   0,   0,   1,   0,   0   }, /* FCC1 ATMRXD[7] */
+       /* PA16 */ {   0,   0,   0,   1,   0,   0   }, /* FCC1 ATMRXD[6] */
+       /* PA15 */ {   0,   0,   0,   1,   0,   0   }, /* FCC1 ATMRXD[5] */
+       /* PA14 */ {   0,   0,   0,   1,   0,   0   }, /* FCC1 ATMRXD[4] */
+       /* PA13 */ {   0,   0,   0,   1,   0,   0   }, /* FCC1 ATMRXD[3] */
+       /* PA12 */ {   0,   0,   0,   1,   0,   0   }, /* FCC1 ATMRXD[2] */
+       /* PA11 */ {   0,   0,   0,   1,   0,   0   }, /* FCC1 ATMRXD[1] */
+       /* PA10 */ {   0,   0,   0,   1,   0,   0   }, /* FCC1 ATMRXD[0] */
+       /* PA9  */ {   1,   1,   0,   1,   0,   0   }, /* SMC2 TXD */
+       /* PA8  */ {   1,   1,   0,   0,   0,   0   }, /* SMC2 RXD */
+       /* PA7  */ {   0,   0,   0,   1,   0,   0   }, /* PA7 */
+       /* PA6  */ {   0,   0,   0,   1,   0,   0   }, /* PA6 */
+       /* PA5  */ {   0,   0,   0,   1,   0,   0   }, /* PA5 */
+       /* PA4  */ {   0,   0,   0,   1,   0,   0   }, /* PA4 */
+       /* PA3  */ {   0,   0,   0,   1,   0,   0   }, /* PA3 */
+       /* PA2  */ {   0,   0,   0,   1,   0,   0   }, /* PA2 */
+       /* PA1  */ {   0,   0,   0,   1,   0,   0   }, /* PA1 */
+       /* PA0  */ {   0,   0,   0,   1,   0,   0   }  /* PA0 */
+    },
+
+    /* Port B configuration */
+    {   /*           conf ppar psor pdir podr pdat */
+       /* PB31 */ {   1,   1,   0,   1,   0,   0   }, /* FCC2 MII TX_ER */
+       /* PB30 */ {   1,   1,   0,   0,   0,   0   }, /* FCC2 MII RX_DV */
+       /* PB29 */ {   1,   1,   1,   1,   0,   0   }, /* FCC2 MII TX_EN */
+       /* PB28 */ {   1,   1,   0,   0,   0,   0   }, /* FCC2 MII RX_ER */
+       /* PB27 */ {   1,   1,   0,   0,   0,   0   }, /* FCC2 MII COL */
+       /* PB26 */ {   1,   1,   0,   0,   0,   0   }, /* FCC2 MII CRS */
+       /* PB25 */ {   1,   1,   0,   1,   0,   0   }, /* FCC2 MII TxD[3] */
+       /* PB24 */ {   1,   1,   0,   1,   0,   0   }, /* FCC2 MII TxD[2] */
+       /* PB23 */ {   1,   1,   0,   1,   0,   0   }, /* FCC2 MII TxD[1] */
+       /* PB22 */ {   1,   1,   0,   1,   0,   0   }, /* FCC2 MII TxD[0] */
+       /* PB21 */ {   1,   1,   0,   0,   0,   0   }, /* FCC2 MII RxD[0] */
+       /* PB20 */ {   1,   1,   0,   0,   0,   0   }, /* FCC2 MII RxD[1] */
+       /* PB19 */ {   1,   1,   0,   0,   0,   0   }, /* FCC2 MII RxD[2] */
+       /* PB18 */ {   1,   1,   0,   0,   0,   0   }, /* FCC2 MII RxD[3] */
+       /* PB17 */ {   0,   0,   0,   0,   0,   0   }, /* PB17 */
+       /* PB16 */ {   0,   0,   0,   0,   0,   0   }, /* PB16 */
+       /* PB15 */ {   0,   0,   0,   0,   0,   0   }, /* PB15 */
+       /* PB14 */ {   0,   0,   0,   0,   0,   0   }, /* PB14 */
+       /* PB13 */ {   0,   0,   0,   0,   0,   0   }, /* PB13 */
+       /* PB12 */ {   0,   0,   0,   0,   0,   0   }, /* PB12 */
+       /* PB11 */ {   0,   0,   0,   0,   0,   0   }, /* PB11 */
+       /* PB10 */ {   0,   0,   0,   0,   0,   0   }, /* PB10 */
+       /* PB9  */ {   0,   0,   0,   0,   0,   0   }, /* PB9 */
+       /* PB8  */ {   0,   0,   0,   0,   0,   0   }, /* PB8 */
+       /* PB7  */ {   0,   0,   0,   0,   0,   0   }, /* PB7 */
+       /* PB6  */ {   0,   0,   0,   0,   0,   0   }, /* PB6 */
+       /* PB5  */ {   0,   0,   0,   0,   0,   0   }, /* PB5 */
+       /* PB4  */ {   0,   0,   0,   0,   0,   0   }, /* PB4 */
+       /* PB3  */ {   0,   0,   0,   0,   0,   0   }, /* pin doesn't exist */
+       /* PB2  */ {   0,   0,   0,   0,   0,   0   }, /* pin doesn't exist */
+       /* PB1  */ {   0,   0,   0,   0,   0,   0   }, /* pin doesn't exist */
+       /* PB0  */ {   0,   0,   0,   0,   0,   0   }  /* pin doesn't exist */
+    },
+
+    /* Port C */
+    {   /*           conf ppar psor pdir podr pdat */
+       /* PC31 */ {   0,   0,   0,   1,   0,   0   }, /* PC31 */
+       /* PC30 */ {   0,   0,   0,   1,   0,   0   }, /* PC30 */
+       /* PC29 */ {   1,   1,   1,   0,   0,   0   }, /* SCC1 EN *CLSN */
+       /* PC28 */ {   0,   0,   0,   1,   0,   0   }, /* PC28 */
+       /* PC27 */ {   0,   0,   0,   1,   0,   0   }, /* PC27 */
+       /* PC26 */ {   0,   0,   0,   1,   0,   0   }, /* PC26 */
+       /* PC25 */ {   0,   0,   0,   1,   0,   0   }, /* PC25 */
+       /* PC24 */ {   0,   0,   0,   1,   0,   0   }, /* PC24 */
+       /* PC23 */ {   0,   1,   0,   1,   0,   0   }, /* ATMTFCLK */
+       /* PC22 */ {   0,   1,   0,   0,   0,   0   }, /* ATMRFCLK */
+       /* PC21 */ {   1,   1,   0,   0,   0,   0   }, /* SCC1 EN RXCLK */
+       /* PC20 */ {   1,   1,   0,   0,   0,   0   }, /* SCC1 EN TXCLK */
+       /* PC19 */ {   1,   1,   0,   0,   0,   0   }, /* FCC2 MII RX_CLK */
+       /* PC18 */ {   1,   1,   0,   0,   0,   0   }, /* FCC2 MII TX_CLK */
+       /* PC17 */ {   0,   0,   0,   1,   0,   0   }, /* PC17 */
+       /* PC16 */ {   0,   0,   0,   1,   0,   0   }, /* PC16 */
+       /* PC15 */ {   0,   0,   0,   1,   0,   0   }, /* PC15 */
+       /* PC14 */ {   1,   1,   0,   0,   0,   0   }, /* SCC1 EN *CD */
+       /* PC13 */ {   0,   0,   0,   1,   0,   0   }, /* PC13 */
+       /* PC12 */ {   0,   0,   0,   1,   0,   0   }, /* PC12 */
+       /* PC11 */ {   0,   0,   0,   1,   0,   0   }, /* PC11 */
+       /* PC10 */ {   0,   0,   0,   1,   0,   0   }, /* FCC2 MDC */
+       /* PC9  */ {   0,   0,   0,   1,   0,   0   }, /* FCC2 MDIO */
+       /* PC8  */ {   0,   0,   0,   1,   0,   0   }, /* PC8 */
+       /* PC7  */ {   0,   0,   0,   1,   0,   0   }, /* PC7 */
+       /* PC6  */ {   0,   0,   0,   1,   0,   0   }, /* PC6 */
+       /* PC5  */ {   0,   0,   0,   1,   0,   0   }, /* PC5 */
+       /* PC4  */ {   0,   0,   0,   1,   0,   0   }, /* PC4 */
+       /* PC3  */ {   0,   0,   0,   1,   0,   0   }, /* PC3 */
+       /* PC2  */ {   0,   0,   0,   1,   0,   1   }, /* ENET FDE */
+       /* PC1  */ {   0,   0,   0,   1,   0,   0   }, /* ENET DSQE */
+       /* PC0  */ {   0,   0,   0,   1,   0,   0   }, /* ENET LBK */
+    },
+
+    /* Port D */
+    {   /*           conf ppar psor pdir podr pdat */
+       /* PD31 */ {   1,   1,   0,   0,   0,   0   }, /* SCC1 EN RxD */
+       /* PD30 */ {   1,   1,   1,   1,   0,   0   }, /* SCC1 EN TxD */
+       /* PD29 */ {   1,   1,   0,   1,   0,   0   }, /* SCC1 EN TENA */
+       /* PD28 */ {   0,   0,   0,   1,   0,   0   }, /* PD28 */
+       /* PD27 */ {   0,   0,   0,   1,   0,   0   }, /* PD27 */
+       /* PD26 */ {   0,   0,   0,   1,   0,   0   }, /* PD26 */
+       /* PD25 */ {   0,   0,   0,   1,   0,   0   }, /* PD25 */
+       /* PD24 */ {   0,   0,   0,   1,   0,   0   }, /* PD24 */
+       /* PD23 */ {   0,   0,   0,   1,   0,   0   }, /* PD23 */
+       /* PD22 */ {   0,   0,   0,   1,   0,   0   }, /* PD22 */
+       /* PD21 */ {   0,   0,   0,   1,   0,   0   }, /* PD21 */
+       /* PD20 */ {   0,   0,   0,   1,   0,   0   }, /* PD20 */
+       /* PD19 */ {   0,   0,   0,   1,   0,   0   }, /* PD19 */
+       /* PD18 */ {   0,   0,   0,   1,   0,   0   }, /* PD19 */
+       /* PD17 */ {   0,   1,   0,   0,   0,   0   }, /* FCC1 ATMRXPRTY */
+       /* PD16 */ {   0,   1,   0,   1,   0,   0   }, /* FCC1 ATMTXPRTY */
+#if defined(CONFIG_SOFT_I2C)
+       /* PD15 */ {   1,   0,   0,   1,   1,   1   }, /* I2C SDA */
+       /* PD14 */ {   1,   0,   0,   1,   1,   1   }, /* I2C SCL */
+#else
+#if defined(CONFIG_HARD_I2C)
+       /* PD15 */ {   1,   1,   1,   0,   1,   0   }, /* I2C SDA */
+       /* PD14 */ {   1,   1,   1,   0,   1,   0   }, /* I2C SCL */
+#else /* normal I/O port pins */
+       /* PD15 */ {   0,   1,   1,   0,   1,   0   }, /* I2C SDA */
+       /* PD14 */ {   0,   1,   1,   0,   1,   0   }, /* I2C SCL */
+#endif
+#endif
+       /* PD13 */ {   0,   0,   0,   0,   0,   0   }, /* PD13 */
+       /* PD12 */ {   0,   0,   0,   0,   0,   0   }, /* PD12 */
+       /* PD11 */ {   0,   0,   0,   0,   0,   0   }, /* PD11 */
+       /* PD10 */ {   0,   0,   0,   0,   0,   0   }, /* PD10 */
+       /* PD9  */ {   1,   1,   0,   1,   0,   0   }, /* SMC1 TXD */
+       /* PD8  */ {   1,   1,   0,   0,   0,   0   }, /* SMC1 RXD */
+       /* PD7  */ {   0,   0,   0,   1,   0,   1   }, /* PD7 */
+       /* PD6  */ {   0,   0,   0,   1,   0,   1   }, /* PD6 */
+       /* PD5  */ {   0,   0,   0,   1,   0,   1   }, /* PD5 */
+       /* PD4  */ {   0,   0,   0,   1,   0,   1   }, /* PD4 */
+       /* PD3  */ {   0,   0,   0,   0,   0,   0   }, /* pin doesn't exist */
+       /* PD2  */ {   0,   0,   0,   0,   0,   0   }, /* pin doesn't exist */
+       /* PD1  */ {   0,   0,   0,   0,   0,   0   }, /* pin doesn't exist */
+       /* PD0  */ {   0,   0,   0,   0,   0,   0   }  /* pin doesn't exist */
+    }
+};
+
+/* ------------------------------------------------------------------------- */
+
+/* Check Board Identity:
+ */
+int checkboard (void)
+{
+       char str[64];
+       int i = getenv_r ("serial#", str, sizeof (str));
+
+       puts ("Board: ");
+
+       if (!i || strncmp (str, "TQM82", 5)) {
+               puts ("### No HW ID - assuming TQM8260\n");
+               return (0);
+       }
+
+       puts (str);
+       putc ('\n');
+
+       return 0;
+}
+
+/* ------------------------------------------------------------------------- */
+
+/* Try SDRAM initialization with P/LSDMR=sdmr and ORx=orx
+ *
+ * This routine performs standard 8260 initialization sequence
+ * and calculates the available memory size. It may be called
+ * several times to try different SDRAM configurations on both
+ * 60x and local buses.
+ */
+static long int try_init (volatile memctl8260_t * memctl, ulong sdmr,
+                                                 ulong orx, volatile uchar * base)
+{
+       volatile uchar c = 0xff;
+       volatile uint *sdmr_ptr;
+       volatile uint *orx_ptr;
+       ulong maxsize, size;
+       int i;
+
+       /* We must be able to test a location outsize the maximum legal size
+        * to find out THAT we are outside; but this address still has to be
+        * mapped by the controller. That means, that the initial mapping has
+        * to be (at least) twice as large as the maximum expected size.
+        */
+       maxsize = (1 + (~orx | 0x7fff)) / 2;
+
+       /* Since CFG_SDRAM_BASE is always 0 (??), we assume that
+        * we are configuring CS1 if base != 0
+        */
+       sdmr_ptr = base ? &memctl->memc_lsdmr : &memctl->memc_psdmr;
+       orx_ptr = base ? &memctl->memc_or2 : &memctl->memc_or1;
+
+       *orx_ptr = orx;
+
+       /*
+        * Quote from 8260 UM (10.4.2 SDRAM Power-On Initialization, 10-35):
+        *
+        * "At system reset, initialization software must set up the
+        *  programmable parameters in the memory controller banks registers
+        *  (ORx, BRx, P/LSDMR). After all memory parameters are configured,
+        *  system software should execute the following initialization sequence
+        *  for each SDRAM device.
+        *
+        *  1. Issue a PRECHARGE-ALL-BANKS command
+        *  2. Issue eight CBR REFRESH commands
+        *  3. Issue a MODE-SET command to initialize the mode register
+        *
+        *  The initial commands are executed by setting P/LSDMR[OP] and
+        *  accessing the SDRAM with a single-byte transaction."
+        *
+        * The appropriate BRx/ORx registers have already been set when we
+        * get here. The SDRAM can be accessed at the address CFG_SDRAM_BASE.
+        */
+
+       *sdmr_ptr = sdmr | PSDMR_OP_PREA;
+       *base = c;
+
+       *sdmr_ptr = sdmr | PSDMR_OP_CBRR;
+       for (i = 0; i < 8; i++)
+               *base = c;
+
+       *sdmr_ptr = sdmr | PSDMR_OP_MRW;
+       *(base + CFG_MRS_OFFS) = c;     /* setting MR on address lines */
+
+       *sdmr_ptr = sdmr | PSDMR_OP_NORM | PSDMR_RFEN;
+       *base = c;
+
+       size = get_ram_size((long *)base, maxsize);
+       *orx_ptr = orx | ~(size - 1);
+
+       return (size);
+}
+
+long int initdram (int board_type)
+{
+       volatile immap_t *immap = (immap_t *) CFG_IMMR;
+       volatile memctl8260_t *memctl = &immap->im_memctl;
+
+#ifndef CFG_RAMBOOT
+       long size8, size9;
+#endif
+       long psize, lsize;
+
+       psize = 16 * 1024 * 1024;
+       lsize = 0;
+
+       memctl->memc_psrt = CFG_PSRT;
+       memctl->memc_mptpr = CFG_MPTPR;
+
+#if 0                                                  /* Just for debugging */
+#define        prt_br_or(brX,orX) do {                         \
+    ulong start =  memctl->memc_ ## brX & 0xFFFF8000;  \
+    ulong sizem = ~memctl->memc_ ## orX | 0x00007FFF;  \
+    printf ("\n"                                       \
+           #brX " 0x%08x  " #orX " 0x%08x "            \
+           "==> 0x%08lx ... 0x%08lx = %ld MB\n",       \
+       memctl->memc_ ## brX, memctl->memc_ ## orX,     \
+       start, start+sizem, (sizem+1)>>20);             \
+    } while (0)
+       prt_br_or (br0, or0);
+       prt_br_or (br1, or1);
+       prt_br_or (br2, or2);
+       prt_br_or (br3, or3);
+#endif
+
+#ifndef CFG_RAMBOOT
+       /* 60x SDRAM setup:
+        */
+       size8 = try_init (memctl, CFG_PSDMR_8COL, CFG_OR1_8COL,
+                                         (uchar *) CFG_SDRAM_BASE);
+       size9 = try_init (memctl, CFG_PSDMR_9COL, CFG_OR1_9COL,
+                                         (uchar *) CFG_SDRAM_BASE);
+
+       if (size8 < size9) {
+               psize = size9;
+               printf ("(60x:9COL - %ld MB, ", psize >> 20);
+       } else {
+               psize = try_init (memctl, CFG_PSDMR_8COL, CFG_OR1_8COL,
+                                                 (uchar *) CFG_SDRAM_BASE);
+               printf ("(60x:8COL - %ld MB, ", psize >> 20);
+       }
+
+       /* Local SDRAM setup:
+        */
+#ifdef CFG_INIT_LOCAL_SDRAM
+       memctl->memc_lsrt = CFG_LSRT;
+       size8 = try_init (memctl, CFG_LSDMR_8COL, CFG_OR2_8COL,
+                                         (uchar *) SDRAM_BASE2_PRELIM);
+       size9 = try_init (memctl, CFG_LSDMR_9COL, CFG_OR2_9COL,
+                                         (uchar *) SDRAM_BASE2_PRELIM);
+
+       if (size8 < size9) {
+               lsize = size9;
+               printf ("Local:9COL - %ld MB) using ", lsize >> 20);
+       } else {
+               lsize = try_init (memctl, CFG_LSDMR_8COL, CFG_OR2_8COL,
+                                                 (uchar *) SDRAM_BASE2_PRELIM);
+               printf ("Local:8COL - %ld MB) using ", lsize >> 20);
+       }
+
+#if 0
+       /* Set up BR2 so that the local SDRAM goes
+        * right after the 60x SDRAM
+        */
+       memctl->memc_br2 = (CFG_BR2_PRELIM & ~BRx_BA_MSK) |
+                       (CFG_SDRAM_BASE + psize);
+#endif
+#endif /* CFG_INIT_LOCAL_SDRAM */
+#endif /* CFG_RAMBOOT */
+
+       icache_enable ();
+
+       return (psize);
+}
+
+/* ------------------------------------------------------------------------- */
diff --git a/board/tqc/tqm8272/Makefile b/board/tqc/tqm8272/Makefile
new file mode 100644 (file)
index 0000000..6730263
--- /dev/null
@@ -0,0 +1,47 @@
+#
+# (C) Copyright 2001-2008
+# 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
+ifneq ($(OBJTREE),$(SRCTREE))
+$(shell mkdir -p $(obj)../tqm8xx/)
+endif
+
+LIB    = $(obj)lib$(BOARD).a
+
+COBJS  = $(BOARD).o ../tqm8xx/load_sernum_ethaddr.o
+
+SRCS   := $(SOBJS:.o=.S) $(COBJS:.o=.c)
+OBJS   := $(addprefix $(obj),$(COBJS))
+SOBJS  := $(addprefix $(obj),$(SOBJS))
+
+$(LIB):        $(obj).depend $(OBJS)
+       $(AR) $(ARFLAGS) $@ $(OBJS)
+
+#########################################################################
+
+# defines $(obj).depend target
+include $(SRCTREE)/rules.mk
+
+sinclude $(obj).depend
+
+#########################################################################
diff --git a/board/tqc/tqm8272/config.mk b/board/tqc/tqm8272/config.mk
new file mode 100644 (file)
index 0000000..af7a81e
--- /dev/null
@@ -0,0 +1,34 @@
+#
+# (C) Copyright 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
+#
+
+#
+# TQM8272 boards
+#
+
+# This should be equal to the CFG_FLASH_BASE define in config_TQM8260.h
+# for the "final" configuration, with U-Boot in flash, or the address
+# in RAM where U-Boot is loaded at for debugging.
+#
+TEXT_BASE = 0x40000000
+
+PLATFORM_CPPFLAGS += -DTEXT_BASE=$(TEXT_BASE) -I$(TOPDIR)
diff --git a/board/tqc/tqm8272/tqm8272.c b/board/tqc/tqm8272/tqm8272.c
new file mode 100644 (file)
index 0000000..ec1a37c
--- /dev/null
@@ -0,0 +1,1230 @@
+/*
+ * (C) Copyright 2006
+ * Heiko Schocher, DENX Software Engineering, hs@denx.de.
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.         See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+#include <common.h>
+#include <ioports.h>
+#include <mpc8260.h>
+
+#include <command.h>
+#ifdef CONFIG_PCI
+#include <pci.h>
+#include <asm/m8260_pci.h>
+#endif
+
+#if 0
+#define deb_printf(fmt,arg...) \
+       printf ("TQM8272 %s %s: " fmt,__FILE__, __FUNCTION__, ##arg)
+#else
+#define deb_printf(fmt,arg...) \
+       do { } while (0)
+#endif
+
+#if defined(CONFIG_BOARD_GET_CPU_CLK_F)
+unsigned long board_get_cpu_clk_f (void);
+#endif
+
+/*
+ * I/O Port configuration table
+ *
+ * if conf is 1, then that port pin will be configured at boot time
+ * according to the five values podr/pdir/ppar/psor/pdat for that entry
+ */
+
+const iop_conf_t iop_conf_tab[4][32] = {
+
+    /* Port A configuration */
+    {  /*            conf ppar psor pdir podr pdat */
+       /* PA31 */ {   0,   0,   0,   1,   0,   0   }, /* FCC1 *ATMTXEN */
+       /* PA30 */ {   0,   0,   0,   1,   0,   0   }, /* FCC1 ATMTCA   */
+       /* PA29 */ {   0,   0,   0,   1,   0,   0   }, /* FCC1 ATMTSOC  */
+       /* PA28 */ {   0,   0,   0,   1,   0,   0   }, /* FCC1 *ATMRXEN */
+       /* PA27 */ {   0,   0,   0,   1,   0,   0   }, /* FCC1 ATMRSOC */
+       /* PA26 */ {   0,   0,   0,   1,   0,   0   }, /* FCC1 ATMRCA */
+       /* PA25 */ {   0,   0,   0,   1,   0,   0   }, /* FCC1 ATMTXD[0] */
+       /* PA24 */ {   0,   0,   0,   1,   0,   0   }, /* FCC1 ATMTXD[1] */
+       /* PA23 */ {   0,   0,   0,   1,   0,   0   }, /* FCC1 ATMTXD[2] */
+       /* PA22 */ {   0,   0,   0,   1,   0,   0   }, /* FCC1 ATMTXD[3] */
+       /* PA21 */ {   0,   0,   0,   1,   0,   0   }, /* FCC1 ATMTXD[4] */
+       /* PA20 */ {   0,   0,   0,   1,   0,   0   }, /* FCC1 ATMTXD[5] */
+       /* PA19 */ {   0,   0,   0,   1,   0,   0   }, /* FCC1 ATMTXD[6] */
+       /* PA18 */ {   0,   0,   0,   1,   0,   0   }, /* FCC1 ATMTXD[7] */
+       /* PA17 */ {   0,   0,   0,   1,   0,   0   }, /* FCC1 ATMRXD[7] */
+       /* PA16 */ {   0,   0,   0,   1,   0,   0   }, /* FCC1 ATMRXD[6] */
+       /* PA15 */ {   0,   0,   0,   1,   0,   0   }, /* FCC1 ATMRXD[5] */
+       /* PA14 */ {   0,   0,   0,   1,   0,   0   }, /* FCC1 ATMRXD[4] */
+       /* PA13 */ {   0,   0,   0,   1,   0,   0   }, /* FCC1 ATMRXD[3] */
+       /* PA12 */ {   0,   0,   0,   1,   0,   0   }, /* FCC1 ATMRXD[2] */
+       /* PA11 */ {   0,   0,   0,   1,   0,   0   }, /* FCC1 ATMRXD[1] */
+       /* PA10 */ {   0,   0,   0,   1,   0,   0   }, /* FCC1 ATMRXD[0] */
+       /* PA9  */ {   1,   1,   0,   1,   0,   0   }, /* SMC2 TXD */
+       /* PA8  */ {   1,   1,   0,   0,   0,   0   }, /* SMC2 RXD */
+       /* PA7  */ {   0,   0,   0,   1,   0,   0   }, /* PA7 */
+       /* PA6  */ {   0,   0,   0,   1,   0,   0   }, /* PA6 */
+       /* PA5  */ {   0,   0,   0,   1,   0,   0   }, /* PA5 */
+       /* PA4  */ {   0,   0,   0,   1,   0,   0   }, /* PA4 */
+       /* PA3  */ {   0,   0,   0,   1,   0,   0   }, /* PA3 */
+       /* PA2  */ {   0,   0,   0,   1,   0,   0   }, /* PA2 */
+       /* PA1  */ {   0,   0,   0,   1,   0,   0   }, /* PA1 */
+       /* PA0  */ {   0,   0,   0,   1,   0,   0   }  /* PA0 */
+    },
+
+    /* Port B configuration */
+    {  /*            conf ppar psor pdir podr pdat */
+       /* PB31 */ {   1,   1,   0,   1,   0,   0   }, /* FCC2 MII TX_ER */
+       /* PB30 */ {   1,   1,   0,   0,   0,   0   }, /* FCC2 MII RX_DV */
+       /* PB29 */ {   1,   1,   1,   1,   0,   0   }, /* FCC2 MII TX_EN */
+       /* PB28 */ {   1,   1,   0,   0,   0,   0   }, /* FCC2 MII RX_ER */
+       /* PB27 */ {   1,   1,   0,   0,   0,   0   }, /* FCC2 MII COL */
+       /* PB26 */ {   1,   1,   0,   0,   0,   0   }, /* FCC2 MII CRS */
+       /* PB25 */ {   1,   1,   0,   1,   0,   0   }, /* FCC2 MII TxD[3] */
+       /* PB24 */ {   1,   1,   0,   1,   0,   0   }, /* FCC2 MII TxD[2] */
+       /* PB23 */ {   1,   1,   0,   1,   0,   0   }, /* FCC2 MII TxD[1] */
+       /* PB22 */ {   1,   1,   0,   1,   0,   0   }, /* FCC2 MII TxD[0] */
+       /* PB21 */ {   1,   1,   0,   0,   0,   0   }, /* FCC2 MII RxD[0] */
+       /* PB20 */ {   1,   1,   0,   0,   0,   0   }, /* FCC2 MII RxD[1] */
+       /* PB19 */ {   1,   1,   0,   0,   0,   0   }, /* FCC2 MII RxD[2] */
+       /* PB18 */ {   1,   1,   0,   0,   0,   0   }, /* FCC2 MII RxD[3] */
+       /* PB17 */ {   0,   0,   0,   0,   0,   0   }, /* PB17 */
+       /* PB16 */ {   0,   0,   0,   0,   0,   0   }, /* PB16 */
+       /* PB15 */ {   0,   0,   0,   0,   0,   0   }, /* PB15 */
+       /* PB14 */ {   0,   0,   0,   0,   0,   0   }, /* PB14 */
+       /* PB13 */ {   0,   0,   0,   0,   0,   0   }, /* PB13 */
+       /* PB12 */ {   0,   0,   0,   0,   0,   0   }, /* PB12 */
+       /* PB11 */ {   0,   0,   0,   0,   0,   0   }, /* PB11 */
+       /* PB10 */ {   0,   0,   0,   0,   0,   0   }, /* PB10 */
+       /* PB9  */ {   0,   0,   0,   0,   0,   0   }, /* PB9 */
+       /* PB8  */ {   0,   0,   0,   0,   0,   0   }, /* PB8 */
+       /* PB7  */ {   0,   0,   0,   0,   0,   0   }, /* PB7 */
+       /* PB6  */ {   0,   0,   0,   0,   0,   0   }, /* PB6 */
+       /* PB5  */ {   0,   0,   0,   0,   0,   0   }, /* PB5 */
+       /* PB4  */ {   0,   0,   0,   0,   0,   0   }, /* PB4 */
+       /* PB3  */ {   0,   0,   0,   0,   0,   0   }, /* pin doesn't exist */
+       /* PB2  */ {   0,   0,   0,   0,   0,   0   }, /* pin doesn't exist */
+       /* PB1  */ {   0,   0,   0,   0,   0,   0   }, /* pin doesn't exist */
+       /* PB0  */ {   0,   0,   0,   0,   0,   0   }  /* pin doesn't exist */
+    },
+
+    /* Port C */
+    {  /*            conf ppar psor pdir podr pdat */
+       /* PC31 */ {   0,   0,   0,   1,   0,   0   }, /* PC31 */
+       /* PC30 */ {   0,   0,   0,   0,   0,   0   }, /* PC30 */
+       /* PC29 */ {   1,   1,   1,   0,   0,   0   }, /* SCC1 EN *CLSN */
+       /* PC28 */ {   0,   0,   0,   1,   0,   0   }, /* PC28 */
+       /* PC27 */ {   0,   0,   0,   1,   0,   0   }, /* PC27 */
+       /* PC26 */ {   0,   0,   0,   1,   0,   0   }, /* PC26 */
+       /* PC25 */ {   0,   0,   0,   1,   0,   0   }, /* PC25 */
+       /* PC24 */ {   0,   0,   0,   1,   0,   0   }, /* PC24 */
+       /* PC23 */ {   0,   1,   0,   1,   0,   0   }, /* ATMTFCLK */
+       /* PC22 */ {   0,   1,   0,   0,   0,   0   }, /* ATMRFCLK */
+       /* PC21 */ {   1,   1,   0,   0,   0,   0   }, /* SCC1 EN RXCLK */
+       /* PC20 */ {   1,   1,   0,   0,   0,   0   }, /* SCC1 EN TXCLK */
+       /* PC19 */ {   1,   1,   0,   0,   0,   0   }, /* FCC2 MII RX_CLK */
+       /* PC18 */ {   1,   1,   0,   0,   0,   0   }, /* FCC2 MII TX_CLK */
+       /* PC17 */ {   1,   0,   0,   1,   0,   0   }, /* PC17 MDC */
+       /* PC16 */ {   1,   0,   0,   0,   0,   0   }, /* PC16 MDIO*/
+       /* PC15 */ {   0,   0,   0,   1,   0,   0   }, /* PC15 */
+       /* PC14 */ {   1,   1,   0,   0,   0,   0   }, /* SCC1 EN *CD */
+       /* PC13 */ {   0,   0,   0,   1,   0,   0   }, /* PC13 */
+       /* PC12 */ {   0,   0,   0,   1,   0,   0   }, /* PC12 */
+       /* PC11 */ {   0,   0,   0,   1,   0,   0   }, /* PC11 */
+       /* PC10 */ {   0,   0,   0,   1,   0,   0   }, /* PC10 */
+       /* PC9  */ {   0,   0,   0,   1,   0,   0   }, /* PC9 */
+       /* PC8  */ {   0,   0,   0,   1,   0,   0   }, /* PC8 */
+       /* PC7  */ {   0,   0,   0,   1,   0,   0   }, /* PC7 */
+       /* PC6  */ {   0,   0,   0,   1,   0,   0   }, /* PC6 */
+       /* PC5  */ {   1,   1,   0,   1,   0,   0   }, /* PC5 SMC1 TXD */
+       /* PC4  */ {   1,   1,   0,   0,   0,   0   }, /* PC4 SMC1 RXD */
+       /* PC3  */ {   0,   0,   0,   1,   0,   0   }, /* PC3 */
+       /* PC2  */ {   0,   0,   0,   1,   0,   1   }, /* ENET FDE */
+       /* PC1  */ {   0,   0,   0,   1,   0,   0   }, /* ENET DSQE */
+       /* PC0  */ {   0,   0,   0,   1,   0,   0   }, /* ENET LBK */
+    },
+
+    /* Port D */
+    {  /*            conf ppar psor pdir podr pdat */
+       /* PD31 */ {   1,   1,   0,   0,   0,   0   }, /* SCC1 EN RxD */
+       /* PD30 */ {   1,   1,   1,   1,   0,   0   }, /* SCC1 EN TxD */
+       /* PD29 */ {   1,   1,   0,   1,   0,   0   }, /* SCC1 EN TENA */
+       /* PD28 */ {   0,   0,   0,   1,   0,   0   }, /* PD28 */
+       /* PD27 */ {   0,   0,   0,   1,   0,   0   }, /* PD27 */
+       /* PD26 */ {   0,   0,   0,   1,   0,   0   }, /* PD26 */
+       /* PD25 */ {   0,   0,   0,   1,   0,   0   }, /* PD25 */
+       /* PD24 */ {   0,   0,   0,   1,   0,   0   }, /* PD24 */
+       /* PD23 */ {   0,   0,   0,   1,   0,   0   }, /* PD23 */
+       /* PD22 */ {   0,   0,   0,   1,   0,   0   }, /* PD22 */
+       /* PD21 */ {   0,   0,   0,   1,   0,   0   }, /* PD21 */
+       /* PD20 */ {   0,   0,   0,   1,   0,   0   }, /* PD20 */
+       /* PD19 */ {   0,   0,   0,   1,   0,   0   }, /* PD19 */
+       /* PD18 */ {   0,   0,   0,   1,   0,   0   }, /* PD19 */
+       /* PD17 */ {   0,   1,   0,   0,   0,   0   }, /* FCC1 ATMRXPRTY */
+       /* PD16 */ {   0,   1,   0,   1,   0,   0   }, /* FCC1 ATMTXPRTY */
+#if defined(CONFIG_SOFT_I2C)
+       /* PD15 */ {   1,   0,   0,   1,   1,   1   }, /* I2C SDA */
+       /* PD14 */ {   1,   0,   0,   1,   1,   1   }, /* I2C SCL */
+#else
+#if defined(CONFIG_HARD_I2C)
+       /* PD15 */ {   1,   1,   1,   0,   1,   0   }, /* I2C SDA */
+       /* PD14 */ {   1,   1,   1,   0,   1,   0   }, /* I2C SCL */
+#else /* normal I/O port pins */
+       /* PD15 */ {   0,   1,   1,   0,   1,   0   }, /* I2C SDA */
+       /* PD14 */ {   0,   1,   1,   0,   1,   0   }, /* I2C SCL */
+#endif
+#endif
+       /* PD13 */ {   0,   0,   0,   0,   0,   0   }, /* PD13 */
+       /* PD12 */ {   0,   0,   0,   0,   0,   0   }, /* PD12 */
+       /* PD11 */ {   0,   0,   0,   0,   0,   0   }, /* PD11 */
+       /* PD10 */ {   0,   0,   0,   0,   0,   0   }, /* PD10 */
+       /* PD9  */ {   1,   1,   0,   1,   0,   0   }, /* SMC1 TXD */
+       /* PD8  */ {   1,   1,   0,   0,   0,   0   }, /* SMC1 RXD */
+       /* PD7  */ {   0,   0,   0,   1,   0,   1   }, /* PD7 */
+       /* PD6  */ {   0,   0,   0,   1,   0,   1   }, /* PD6 */
+       /* PD5  */ {   0,   0,   0,   1,   0,   0   }, /* PD5 */
+       /* PD4  */ {   0,   0,   0,   1,   0,   1   }, /* PD4 */
+       /* PD3  */ {   0,   0,   0,   0,   0,   0   }, /* pin doesn't exist */
+       /* PD2  */ {   0,   0,   0,   0,   0,   0   }, /* pin doesn't exist */
+       /* PD1  */ {   0,   0,   0,   0,   0,   0   }, /* pin doesn't exist */
+       /* PD0  */ {   0,   0,   0,   0,   0,   0   }  /* pin doesn't exist */
+    }
+};
+
+#define _NOT_USED_     0xFFFFFFFF
+
+/* UPM pattern for bus clock = 66.7 MHz */
+static const uint upmTable67[] =
+{
+    /* Offset  UPM Read Single RAM array entry -> NAND Read Data */
+    /* 0x00 */ 0x0fa3f100, 0x0fa3b000, 0x0fa33100, 0x0fa33000,
+    /* 0x04 */ 0x0fa33000, 0x0fa33004, 0xfffffc01, 0xfffffc00,
+
+               /* UPM Read Burst RAM array entry -> unused */
+    /* 0x08 */ 0xfffffc00, 0xfffffc00, 0xfffffc00, 0xfffffc00,
+    /* 0x0C */ 0xfffffc00, 0xfffffc00, 0xfffffc00, 0xfffffc00,
+
+               /* UPM Read Burst RAM array entry -> unused */
+    /* 0x10 */ 0xfffffc00, 0xfffffc00, 0xfffffc00, 0xfffffc00,
+    /* 0x14 */ 0xfffffc00, 0xfffffc00, 0xfffffc00, 0xfffffc00,
+
+               /* UPM Write Single RAM array entry -> NAND Write Data, ADDR and CMD */
+    /* 0x18 */ 0x00a3fc00, 0x00a3fc00, 0x00a3fc00, 0x00a3fc00,
+    /* 0x1C */ 0x0fa3fc00, 0x0fa3fc04, 0xfffffc01, 0xfffffc00,
+
+               /* UPM Write Burst RAM array entry -> unused */
+    /* 0x20 */ 0xfffffc00, 0xfffffc00, 0xfffffc00, 0xfffffc00,
+    /* 0x24 */ 0xfffffc00, 0xfffffc00, 0xfffffc00, 0xfffffc00,
+    /* 0x28 */ 0xfffffc00, 0xfffffc00, 0xfffffc00, 0xfffffc00,
+    /* 0x2C */ 0xfffffc00, 0xfffffc00, 0xfffffc00, 0xfffffc01,
+
+               /* UPM Refresh Timer RAM array entry -> unused */
+    /* 0x30 */ 0xfffffc00, 0xfffffc00, 0xfffffc00, 0xfffffc00,
+    /* 0x34 */ 0xfffffc00, 0xfffffc00, 0xfffffc00, 0xfffffc00,
+    /* 0x38 */ 0xfffffc00, 0xfffffc00, 0xfffffc00, 0xfffffc01,
+
+               /* UPM Exception RAM array entry -> unsused */
+    /* 0x3C */ 0xfffffc00, 0xfffffc00, 0xfffffc00, 0xfffffc01,
+};
+
+/* UPM pattern for bus clock = 100 MHz */
+static const uint upmTable100[] =
+{
+    /* Offset  UPM Read Single RAM array entry -> NAND Read Data */
+    /* 0x00 */ 0x0fa3f200, 0x0fa3b000, 0x0fa33300, 0x0fa33000,
+    /* 0x04 */ 0x0fa33000, 0x0fa33004, 0xfffffc01, 0xfffffc00,
+
+               /* UPM Read Burst RAM array entry -> unused */
+    /* 0x08 */ 0xfffffc00, 0xfffffc00, 0xfffffc00, 0xfffffc00,
+    /* 0x0C */ 0xfffffc00, 0xfffffc00, 0xfffffc00, 0xfffffc00,
+
+               /* UPM Read Burst RAM array entry -> unused */
+    /* 0x10 */ 0xfffffc00, 0xfffffc00, 0xfffffc00, 0xfffffc00,
+    /* 0x14 */ 0xfffffc00, 0xfffffc00, 0xfffffc00, 0xfffffc00,
+
+               /* UPM Write Single RAM array entry -> NAND Write Data, ADDR and CMD */
+    /* 0x18 */ 0x00a3ff00, 0x00a3fc00, 0x00a3fc00, 0x0fa3fc00,
+    /* 0x1C */ 0x0fa3fc00, 0x0fa3fc04, 0xfffffc01, 0xfffffc00,
+
+               /* UPM Write Burst RAM array entry -> unused */
+    /* 0x20 */ 0xfffffc00, 0xfffffc00, 0xfffffc00, 0xfffffc00,
+    /* 0x24 */ 0xfffffc00, 0xfffffc00, 0xfffffc00, 0xfffffc00,
+    /* 0x28 */ 0xfffffc00, 0xfffffc00, 0xfffffc00, 0xfffffc00,
+    /* 0x2C */ 0xfffffc00, 0xfffffc00, 0xfffffc00, 0xfffffc01,
+
+               /* UPM Refresh Timer RAM array entry -> unused */
+    /* 0x30 */ 0xfffffc00, 0xfffffc00, 0xfffffc00, 0xfffffc00,
+    /* 0x34 */ 0xfffffc00, 0xfffffc00, 0xfffffc00, 0xfffffc00,
+    /* 0x38 */ 0xfffffc00, 0xfffffc00, 0xfffffc00, 0xfffffc01,
+
+               /* UPM Exception RAM array entry -> unsused */
+    /* 0x3C */ 0xfffffc00, 0xfffffc00, 0xfffffc00, 0xfffffc01,
+};
+
+/* UPM pattern for bus clock = 133.3 MHz */
+static const uint upmTable133[] =
+{
+    /* Offset  UPM Read Single RAM array entry -> NAND Read Data */
+    /* 0x00 */ 0x0fa3f300, 0x0fa3b000, 0x0fa33300, 0x0fa33000,
+    /* 0x04 */ 0x0fa33200, 0x0fa33004, 0xfffffc01, 0xfffffc00,
+
+               /* UPM Read Burst RAM array entry -> unused */
+    /* 0x08 */ 0xfffffc00, 0xfffffc00, 0xfffffc00, 0xfffffc00,
+    /* 0x0C */ 0xfffffc00, 0xfffffc00, 0xfffffc00, 0xfffffc00,
+
+               /* UPM Read Burst RAM array entry -> unused */
+    /* 0x10 */ 0xfffffc00, 0xfffffc00, 0xfffffc00, 0xfffffc00,
+    /* 0x14 */ 0xfffffc00, 0xfffffc00, 0xfffffc00, 0xfffffc00,
+
+               /* UPM Write Single RAM array entry -> NAND Write Data, ADDR and CMD */
+    /* 0x18 */ 0x00a3ff00, 0x00a3fc00, 0x00a3fd00, 0x0fa3fc00,
+    /* 0x1C */ 0x0fa3fd00, 0x0fa3fc04, 0xfffffc01, 0xfffffc00,
+
+               /* UPM Write Burst RAM array entry -> unused */
+    /* 0x20 */ 0xfffffc00, 0xfffffc00, 0xfffffc00, 0xfffffc00,
+    /* 0x24 */ 0xfffffc00, 0xfffffc00, 0xfffffc00, 0xfffffc00,
+    /* 0x28 */ 0xfffffc00, 0xfffffc00, 0xfffffc00, 0xfffffc00,
+    /* 0x2C */ 0xfffffc00, 0xfffffc00, 0xfffffc00, 0xfffffc01,
+
+               /* UPM Refresh Timer RAM array entry -> unused */
+    /* 0x30 */ 0xfffffc00, 0xfffffc00, 0xfffffc00, 0xfffffc00,
+    /* 0x34 */ 0xfffffc00, 0xfffffc00, 0xfffffc00, 0xfffffc00,
+    /* 0x38 */ 0xfffffc00, 0xfffffc00, 0xfffffc00, 0xfffffc01,
+
+               /* UPM Exception RAM array entry -> unsused */
+    /* 0x3C */ 0xfffffc00, 0xfffffc00, 0xfffffc00, 0xfffffc01,
+};
+
+static int     chipsel = 0;
+
+/* UPM pattern for slow init */
+static const uint upmTableSlow[] =
+{
+    /* Offset  UPM Read Single RAM array entry */
+    /* 0x00 */ 0xffffee00, 0x00ffcc80, 0x00ffcf00, 0x00ffdc00,
+    /* 0x04 */ 0x00ffce80, 0x00ffcc00, 0x00ffee00, 0x3fffcc07,
+
+               /* UPM Read Burst RAM array entry -> unused */
+    /* 0x08 */ 0xfffffc00, 0xfffffc00, 0xfffffc00, 0xfffffc00,
+    /* 0x0C */ 0xfffffc00, 0xfffffc00, 0xfffffc00, 0xfffffc00,
+
+               /* UPM Read Burst RAM array entry -> unused */
+    /* 0x10 */ 0xfffffc00, 0xfffffc00, 0xfffffc00, 0xfffffc00,
+    /* 0x14 */ 0xfffffc00, 0xfffffc00, 0xfffffc00, 0xfffffc00,
+
+               /* UPM Write Single RAM array entry */
+    /* 0x18 */ 0xffffee00, 0x00ffec80, 0x00ffef00, 0x00fffc80,
+    /* 0x1C */ 0x00fffe00, 0x00ffec00, 0x0fffef00, 0x3fffec05,
+
+               /* UPM Write Burst RAM array entry -> unused */
+    /* 0x20 */ 0xfffffc00, 0xfffffc00, 0xfffffc00, 0xfffffc00,
+    /* 0x24 */ 0xfffffc00, 0xfffffc00, 0xfffffc00, 0xfffffc00,
+    /* 0x28 */ 0xfffffc00, 0xfffffc00, 0xfffffc00, 0xfffffc00,
+    /* 0x2C */ 0xfffffc00, 0xfffffc00, 0xfffffc00, 0xfffffc01,
+
+               /* UPM Refresh Timer RAM array entry -> unused */
+    /* 0x30 */ 0xfffffc00, 0xfffffc00, 0xfffffc00, 0xfffffc00,
+    /* 0x34 */ 0xfffffc00, 0xfffffc00, 0xfffffc00, 0xfffffc00,
+    /* 0x38 */ 0xfffffc00, 0xfffffc00, 0xfffffc00, 0xfffffc01,
+
+               /* UPM Exception RAM array entry -> unused */
+    /* 0x3C */ 0xfffffc00, 0xfffffc00, 0xfffffc00, 0xfffffc01,
+};
+
+/* UPM pattern for fast init */
+static const uint upmTableFast[] =
+{
+    /* Offset  UPM Read Single RAM array entry */
+    /* 0x00 */ 0xffffee00, 0x00ffcc80, 0x00ffcd80, 0x00ffdc00,
+    /* 0x04 */ 0x00ffdc00, 0x00ffcf00, 0x00ffec00, 0x3fffcc07,
+
+               /* UPM Read Burst RAM array entry -> unused */
+    /* 0x08 */ 0xfffffc00, 0xfffffc00, 0xfffffc00, 0xfffffc00,
+    /* 0x0C */ 0xfffffc00, 0xfffffc00, 0xfffffc00, 0xfffffc00,
+
+               /* UPM Read Burst RAM array entry -> unused */
+    /* 0x10 */ 0xfffffc00, 0xfffffc00, 0xfffffc00, 0xfffffc00,
+    /* 0x14 */ 0xfffffc00, 0xfffffc00, 0xfffffc00, 0xfffffc00,
+
+               /* UPM Write Single RAM array entry */
+    /* 0x18 */ 0xffffee00, 0x00ffec80, 0x00ffee80, 0x00fffc00,
+    /* 0x1C */ 0x00fffc00, 0x00ffec00, 0x0fffef00, 0x3fffec05,
+
+               /* UPM Write Burst RAM array entry -> unused */
+    /* 0x20 */ 0xfffffc00, 0xfffffc00, 0xfffffc00, 0xfffffc00,
+    /* 0x24 */ 0xfffffc00, 0xfffffc00, 0xfffffc00, 0xfffffc00,
+    /* 0x28 */ 0xfffffc00, 0xfffffc00, 0xfffffc00, 0xfffffc00,
+    /* 0x2C */ 0xfffffc00, 0xfffffc00, 0xfffffc00, 0xfffffc01,
+
+               /* UPM Refresh Timer RAM array entry -> unused */
+    /* 0x30 */ 0xfffffc00, 0xfffffc00, 0xfffffc00, 0xfffffc00,
+    /* 0x34 */ 0xfffffc00, 0xfffffc00, 0xfffffc00, 0xfffffc00,
+    /* 0x38 */ 0xfffffc00, 0xfffffc00, 0xfffffc00, 0xfffffc01,
+
+               /* UPM Exception RAM array entry -> unused */
+    /* 0x3C */ 0xfffffc00, 0xfffffc00, 0xfffffc00, 0xfffffc01,
+};
+
+
+/* ------------------------------------------------------------------------- */
+
+/* Check Board Identity:
+ */
+int checkboard (void)
+{
+       char *p = (char *) HWIB_INFO_START_ADDR;
+
+       puts ("Board: ");
+       if (*((unsigned long *)p) == (unsigned long)CFG_HWINFO_MAGIC) {
+               puts (p);
+       } else {
+               puts ("No HWIB assuming TQM8272");
+       }
+       putc ('\n');
+
+       return 0;
+}
+
+/* ------------------------------------------------------------------------- */
+#if defined(CONFIG_BOARD_GET_CPU_CLK_F)
+static int get_cas_latency (void)
+{
+       /* get it from the option -ts in CIB */
+       /* default is 3 */
+       int     ret = 3;
+       int     pos = 0;
+       char    *p = (char *) CIB_INFO_START_ADDR;
+
+       while ((*p != '\0') && (pos < CIB_INFO_LEN)) {
+               if (*p < ' ' || *p > '~') { /* ASCII strings! */
+                       return ret;
+               }
+               if (*p == '-') {
+                       if ((p[1] == 't') && (p[2] == 's')) {
+                               return (p[4] - '0');
+                       }
+               }
+               p++;
+               pos++;
+       }
+       return ret;
+}
+#endif
+
+static ulong set_sdram_timing (volatile uint *sdmr_ptr, ulong sdmr, int col)
+{
+#if defined(CONFIG_BOARD_GET_CPU_CLK_F)
+       int     clk = board_get_cpu_clk_f ();
+       volatile immap_t *immr = (immap_t *)CFG_IMMR;
+       int     busmode = (immr->im_siu_conf.sc_bcr & BCR_EBM ? 1 : 0);
+       int     cas;
+
+       sdmr = sdmr & ~(PSDMR_RFRC_MSK | PSDMR_PRETOACT_MSK | PSDMR_WRC_MSK | \
+                        PSDMR_BUFCMD);
+       if (busmode) {
+               switch (clk) {
+                       case 66666666:
+                               sdmr |= (PSDMR_RFRC_66MHZ_60X | \
+                                       PSDMR_PRETOACT_66MHZ_60X | \
+                                       PSDMR_WRC_66MHZ_60X | \
+                                       PSDMR_BUFCMD_66MHZ_60X);
+                               break;
+                       case 100000000:
+                               sdmr |= (PSDMR_RFRC_100MHZ_60X | \
+                                       PSDMR_PRETOACT_100MHZ_60X | \
+                                       PSDMR_WRC_100MHZ_60X | \
+                                       PSDMR_BUFCMD_100MHZ_60X);
+                               break;
+
+               }
+       } else {
+               switch (clk) {
+                       case 66666666:
+                               sdmr |= (PSDMR_RFRC_66MHZ_SINGLE | \
+                                       PSDMR_PRETOACT_66MHZ_SINGLE | \
+                                       PSDMR_WRC_66MHZ_SINGLE | \
+                                       PSDMR_BUFCMD_66MHZ_SINGLE);
+                               break;
+                       case 100000000:
+                               sdmr |= (PSDMR_RFRC_100MHZ_SINGLE | \
+                                       PSDMR_PRETOACT_100MHZ_SINGLE | \
+                                       PSDMR_WRC_100MHZ_SINGLE | \
+                                       PSDMR_BUFCMD_100MHZ_SINGLE);
+                               break;
+                       case 133333333:
+                               sdmr |= (PSDMR_RFRC_133MHZ_SINGLE | \
+                                       PSDMR_PRETOACT_133MHZ_SINGLE | \
+                                       PSDMR_WRC_133MHZ_SINGLE | \
+                                       PSDMR_BUFCMD_133MHZ_SINGLE);
+                               break;
+               }
+       }
+       cas = get_cas_latency();
+       sdmr &=~ (PSDMR_CL_MSK | PSDMR_LDOTOPRE_MSK);
+       sdmr |= cas;
+       sdmr |= ((cas - 1) << 6);
+       return sdmr;
+#else
+       return sdmr;
+#endif
+}
+
+/* Try SDRAM initialization with P/LSDMR=sdmr and ORx=orx
+ *
+ * This routine performs standard 8260 initialization sequence
+ * and calculates the available memory size. It may be called
+ * several times to try different SDRAM configurations on both
+ * 60x and local buses.
+ */
+static long int try_init (volatile memctl8260_t * memctl, ulong sdmr,
+                                                 ulong orx, volatile uchar * base, int col)
+{
+       volatile uchar c = 0xff;
+       volatile uint *sdmr_ptr;
+       volatile uint *orx_ptr;
+       ulong maxsize, size;
+       int i;
+
+       /* We must be able to test a location outsize the maximum legal size
+        * to find out THAT we are outside; but this address still has to be
+        * mapped by the controller. That means, that the initial mapping has
+        * to be (at least) twice as large as the maximum expected size.
+        */
+       maxsize = (1 + (~orx | 0x7fff)) / 2;
+
+       /* Since CFG_SDRAM_BASE is always 0 (??), we assume that
+        * we are configuring CS1 if base != 0
+        */
+       sdmr_ptr = base ? &memctl->memc_lsdmr : &memctl->memc_psdmr;
+       orx_ptr = base ? &memctl->memc_or2 : &memctl->memc_or1;
+
+       *orx_ptr = orx;
+       sdmr = set_sdram_timing (sdmr_ptr, sdmr, col);
+       /*
+        * Quote from 8260 UM (10.4.2 SDRAM Power-On Initialization, 10-35):
+        *
+        * "At system reset, initialization software must set up the
+        *  programmable parameters in the memory controller banks registers
+        *  (ORx, BRx, P/LSDMR). After all memory parameters are configured,
+        *  system software should execute the following initialization sequence
+        *  for each SDRAM device.
+        *
+        *  1. Issue a PRECHARGE-ALL-BANKS command
+        *  2. Issue eight CBR REFRESH commands
+        *  3. Issue a MODE-SET command to initialize the mode register
+        *
+        *  The initial commands are executed by setting P/LSDMR[OP] and
+        *  accessing the SDRAM with a single-byte transaction."
+        *
+        * The appropriate BRx/ORx registers have already been set when we
+        * get here. The SDRAM can be accessed at the address CFG_SDRAM_BASE.
+        */
+
+       *sdmr_ptr = sdmr | PSDMR_OP_PREA;
+       *base = c;
+
+       *sdmr_ptr = sdmr | PSDMR_OP_CBRR;
+       for (i = 0; i < 8; i++)
+               *base = c;
+
+       *sdmr_ptr = sdmr | PSDMR_OP_MRW;
+       *(base + CFG_MRS_OFFS) = c;     /* setting MR on address lines */
+
+       *sdmr_ptr = sdmr | PSDMR_OP_NORM | PSDMR_RFEN;
+       *base = c;
+
+       size = get_ram_size((long *)base, maxsize);
+       *orx_ptr = orx | ~(size - 1);
+
+       return (size);
+}
+
+long int initdram (int board_type)
+{
+       volatile immap_t *immap = (immap_t *) CFG_IMMR;
+       volatile memctl8260_t *memctl = &immap->im_memctl;
+
+#ifndef CFG_RAMBOOT
+       long size8, size9;
+#endif
+       long psize, lsize;
+
+       psize = 16 * 1024 * 1024;
+       lsize = 0;
+
+       memctl->memc_psrt = CFG_PSRT;
+       memctl->memc_mptpr = CFG_MPTPR;
+
+#ifndef CFG_RAMBOOT
+       /* 60x SDRAM setup:
+        */
+       size8 = try_init (memctl, CFG_PSDMR_8COL, CFG_OR1_8COL,
+                                         (uchar *) CFG_SDRAM_BASE, 8);
+       size9 = try_init (memctl, CFG_PSDMR_9COL, CFG_OR1_9COL,
+                                         (uchar *) CFG_SDRAM_BASE, 9);
+
+       if (size8 < size9) {
+               psize = size9;
+               printf ("(60x:9COL - %ld MB, ", psize >> 20);
+       } else {
+               psize = try_init (memctl, CFG_PSDMR_8COL, CFG_OR1_8COL,
+                                                 (uchar *) CFG_SDRAM_BASE, 8);
+               printf ("(60x:8COL - %ld MB, ", psize >> 20);
+       }
+
+#endif /* CFG_RAMBOOT */
+
+       icache_enable ();
+
+       return (psize);
+}
+
+
+static inline int scanChar (char *p, int len, unsigned long *number)
+{
+       int     akt = 0;
+
+       *number = 0;
+       while (akt < len) {
+               if ((*p >= '0') && (*p <= '9')) {
+                       *number *= 10;
+                       *number += *p - '0';
+                       p += 1;
+               } else {
+                       if (*p == '-')  return akt;
+                       return -1;
+               }
+               akt ++;
+       }
+       return akt;
+}
+
+typedef struct{
+       int     Bus;
+       int     flash;
+       int     flash_nr;
+       int     ram;
+       int     ram_cs;
+       int     nand;
+       int     nand_cs;
+       int     eeprom;
+       int     can;
+       unsigned long   cpunr;
+       unsigned long   option;
+       int     SecEng;
+       int     cpucl;
+       int     cpmcl;
+       int     buscl;
+       int     busclk_real_ok;
+       int     busclk_real;
+       unsigned char   OK;
+       unsigned char  ethaddr[20];
+} HWIB_INFO;
+
+HWIB_INFO      hwinf = {0, 0, 1, 0, 1, 0, 0, 0, 0, 8272, 0 ,0,
+                        0, 0, 0, 0, 0, 0};
+
+static int dump_hwib(void)
+{
+       HWIB_INFO       *hw = &hwinf;
+       volatile immap_t *immr = (immap_t *)CFG_IMMR;
+       char *s = getenv("serial#");
+
+       if (hw->OK) {
+               printf ("HWIB on %x\n", HWIB_INFO_START_ADDR);
+               printf ("serial : %s\n", s);
+               printf ("ethaddr: %s\n", hw->ethaddr);
+               printf ("FLASH  : %x nr:%d\n", hw->flash, hw->flash_nr);
+               printf ("RAM    : %x cs:%d\n", hw->ram, hw->ram_cs);
+               printf ("CPU    : %d\n", hw->cpunr);
+               printf ("CAN    : %d\n", hw->can);
+               if (hw->eeprom) printf ("EEprom : %x\n", hw->eeprom);
+               else printf ("No EEprom\n");
+               if (hw->nand) {
+                       printf ("NAND   : %x\n", hw->nand);
+                       printf ("NAND CS: %d\n", hw->nand_cs);
+               } else { printf ("No NAND\n");}
+               printf ("Bus %s mode.\n", (hw->Bus ? "60x" : "Single PQII"));
+               printf ("  real : %s\n", (immr->im_siu_conf.sc_bcr & BCR_EBM ? \
+                                "60x" : "Single PQII"));
+               printf ("Option : %x\n", hw->option);
+               printf ("%s Security Engine\n", (hw->SecEng ? "with" : "no"));
+               printf ("CPM Clk: %d\n", hw->cpmcl);
+               printf ("CPU Clk: %d\n", hw->cpucl);
+               printf ("Bus Clk: %d\n", hw->buscl);
+               if (hw->busclk_real_ok) {
+                       printf ("  real Clk: %d\n", hw->busclk_real);
+               }
+               printf ("CAS    : %d\n", get_cas_latency());
+       } else {
+               printf("HWIB @%x not OK\n", HWIB_INFO_START_ADDR);
+       }
+       return 0;
+}
+
+static inline int search_real_busclk (int *clk)
+{
+       int     part = 0, pos = 0;
+       char *p = (char *) CIB_INFO_START_ADDR;
+       int     ok = 0;
+
+       while ((*p != '\0') && (pos < CIB_INFO_LEN)) {
+               if (*p < ' ' || *p > '~') { /* ASCII strings! */
+                       return 0;
+               }
+               switch (part) {
+               default:
+                       if (*p == '-') {
+                               ++part;
+                       }
+                       break;
+               case 3:
+                       if (*p == '-') {
+                               ++part;
+                               break;
+                       }
+                       if (*p == 'b') {
+                               ok = 1;
+                               p++;
+                               break;
+                       }
+                       if (ok) {
+                               switch (*p) {
+                               case '6':
+                                       *clk = 66666666;
+                                       return 1;
+                                       break;
+                               case '1':
+                                       if (p[1] == '3') {
+                                               *clk = 133333333;
+                                       } else {
+                                               *clk = 100000000;
+                                       }
+                                       return 1;
+                                       break;
+                               }
+                       }
+                       break;
+               }
+               p++;
+       }
+       return 0;
+}
+
+int analyse_hwib (void)
+{
+       char    *p = (char *) HWIB_INFO_START_ADDR;
+       int     anz;
+       int     part = 1, i = 0, pos = 0;
+       HWIB_INFO       *hw = &hwinf;
+
+       deb_printf(" %s pointer: %p\n", __FUNCTION__, p);
+       /* Head = TQM */
+       if (*((unsigned long *)p) != (unsigned long)CFG_HWINFO_MAGIC) {
+               deb_printf("No HWIB\n");
+               return -1;
+       }
+       p += 3;
+       if (scanChar (p, 4, &hw->cpunr) < 0) {
+               deb_printf("No CPU\n");
+               return -2;
+       }
+       p +=4;
+
+       hw->flash = 0x200000 << (*p - 'A');
+       p++;
+       hw->flash_nr = *p - '0';
+       p++;
+
+       hw->ram = 0x2000000 << (*p - 'A');
+       p++;
+       if (*p == '2') {
+               hw->ram_cs = 2;
+               p++;
+       }
+
+       if (*p == 'A') hw->can = 1;
+       if (*p == 'B') hw->can = 2;
+       p +=1;
+       p +=1;  /* connector */
+       if (*p != '0') {
+               hw->eeprom = 0x1000 << (*p - 'A');
+       }
+       p++;
+
+       if ((*p < '0') || (*p > '9')) {
+               /* NAND before z-option */
+               hw->nand = 0x8000000 << (*p - 'A');
+               p++;
+               hw->nand_cs = *p - '0';
+               p += 2;
+       }
+       /* z-option */
+       anz = scanChar (p, 4, &hw->option);
+       if (anz < 0) {
+               deb_printf("No option\n");
+               return -3;
+       }
+       if (hw->option & 0x8) hw->Bus = 1;
+       p += anz;
+       if (*p != '-') {
+               deb_printf("No -\n");
+               return -4;
+       }
+       p++;
+       /* C option */
+       if (*p == 'E') {
+               hw->SecEng = 1;
+               p++;
+       }
+       switch (*p) {
+               case 'M': hw->cpucl = 266666666;
+                       break;
+               case 'P': hw->cpucl = 300000000;
+                       break;
+               case 'T': hw->cpucl = 400000000;
+                       break;
+               default:
+                       deb_printf("No CPU Clk: %c\n", *p);
+                       return -5;
+                       break;
+       }
+       p++;
+       switch (*p) {
+               case 'I': hw->cpmcl = 200000000;
+                       break;
+               case 'M': hw->cpmcl = 300000000;
+                       break;
+               default:
+                       deb_printf("No CPM Clk\n");
+                       return -6;
+                       break;
+       }
+       p++;
+       switch (*p) {
+               case 'B': hw->buscl = 66666666;
+                       break;
+               case 'E': hw->buscl = 100000000;
+                       break;
+               case 'F': hw->buscl = 133333333;
+                       break;
+               default:
+                       deb_printf("No BUS Clk\n");
+                       return -7;
+                       break;
+       }
+       p++;
+
+       hw->OK = 1;
+       /* search MAC Address */
+       while ((*p != '\0') && (pos < CFG_HWINFO_SIZE)) {
+               if (*p < ' ' || *p > '~') { /* ASCII strings! */
+                       return 0;
+               }
+               switch (part) {
+               default:
+                       if (*p == ' ') {
+                               ++part;
+                               i = 0;
+                       }
+                       break;
+               case 3:                 /* Copy MAC address */
+                       if (*p == ' ') {
+                               ++part;
+                               i = 0;
+                               break;
+                       }
+                       hw->ethaddr[i++] = *p;
+                       if ((i % 3) == 2)
+                               hw->ethaddr[i++] = ':';
+                       break;
+
+               }
+               p++;
+       }
+
+       hw->busclk_real_ok = search_real_busclk (&hw->busclk_real);
+       return 0;
+}
+
+#if defined(CONFIG_GET_CPU_STR_F)
+/* !! This routine runs from Flash */
+char get_cpu_str_f (char *buf)
+{
+       char *p = (char *) HWIB_INFO_START_ADDR;
+       int     i = 0;
+
+       buf[i++] = 'M';
+       buf[i++] = 'P';
+       buf[i++] = 'C';
+       if (*((unsigned long *)p) == (unsigned long)CFG_HWINFO_MAGIC) {
+               buf[i++] = *&p[3];
+               buf[i++] = *&p[4];
+               buf[i++] = *&p[5];
+               buf[i++] = *&p[6];
+       } else {
+               buf[i++] = '8';
+               buf[i++] = '2';
+               buf[i++] = '7';
+               buf[i++] = 'x';
+       }
+       buf[i++] = 0;
+       return 0;
+}
+#endif
+
+#if defined(CONFIG_BOARD_GET_CPU_CLK_F)
+/* !! This routine runs from Flash */
+unsigned long board_get_cpu_clk_f (void)
+{
+       char *p = (char *) HWIB_INFO_START_ADDR;
+       int i = 0;
+
+       if (*((unsigned long *)p) == (unsigned long)CFG_HWINFO_MAGIC) {
+               if (search_real_busclk (&i))
+                       return i;
+       }
+       return CONFIG_8260_CLKIN;
+}
+#endif
+
+#if CONFIG_BOARD_EARLY_INIT_R
+
+static int can_test (unsigned long off)
+{
+       volatile unsigned char  *base   = (unsigned char *) (CFG_CAN_BASE + off);
+
+       *(base + 0x17) = 'T';
+       *(base + 0x18) = 'Q';
+       *(base + 0x19) = 'M';
+       if ((*(base + 0x17) != 'T') ||
+           (*(base + 0x18) != 'Q') ||
+           (*(base + 0x19) != 'M')) {
+               return 0;
+       }
+       return 1;
+}
+
+static int can_config_one (unsigned long off)
+{
+       volatile unsigned char  *ctrl   = (unsigned char *) (CFG_CAN_BASE + off);
+       volatile unsigned char  *cpu_if = (unsigned char *) (CFG_CAN_BASE + off + 0x02);
+       volatile unsigned char  *clkout = (unsigned char *) (CFG_CAN_BASE + off + 0x1f);
+       unsigned char temp;
+
+       *cpu_if = 0x45;
+       temp = *ctrl;
+       temp |= 0x40;
+       *ctrl   = temp;
+       *clkout = 0x20;
+       temp = *ctrl;
+       temp &= ~0x40;
+       *ctrl   = temp;
+       return 0;
+}
+
+static int can_config (void)
+{
+       int     ret = 0;
+       can_config_one (0);
+       if (hwinf.can == 2) {
+               can_config_one (0x100);
+       }
+       /* make Test if they really there */
+       ret += can_test (0);
+       ret += can_test (0x100);
+       return ret;
+}
+
+static int init_can (void)
+{
+       volatile immap_t * immr = (immap_t *)CFG_IMMR;
+       volatile memctl8260_t *memctl = &immr->im_memctl;
+       int     count = 0;
+
+       if ((hwinf.OK) && (hwinf.can)) {
+               memctl->memc_or4 = CFG_CAN_OR;
+               memctl->memc_br4 = CFG_CAN_BR;
+               /* upm Init */
+               upmconfig (UPMC, (uint *) upmTableFast,
+                          sizeof (upmTableFast) / sizeof (uint));
+               memctl->memc_mcmr =     (MxMR_DSx_3_CYCL |
+                                       MxMR_GPL_x4DIS |
+                                       MxMR_RLFx_2X |
+                                       MxMR_WLFx_2X |
+                                       MxMR_OP_NORM);
+               /* can configure */
+               count = can_config ();
+               printf ("CAN:   %d @ %x\n", count, CFG_CAN_BASE);
+               if (hwinf.can != count) printf("!!! difference to HWIB\n");
+       } else {
+               printf ("CAN:   No\n");
+       }
+       return 0;
+}
+
+int board_early_init_r(void)
+{
+       analyse_hwib ();
+       init_can ();
+       return 0;
+}
+#endif
+
+int do_hwib_dump (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[])
+{
+       dump_hwib ();
+       return 0;
+}
+
+U_BOOT_CMD(
+         hwib, 1,      1,      do_hwib_dump,
+         "hwib    - dump HWIB'\n",
+         "\n"
+);
+
+#ifdef CFG_UPDATE_FLASH_SIZE
+static int get_flash_timing (void)
+{
+       /* get it from the option -tf in CIB */
+       /* default is 0x00000c84 */
+       int     ret = 0x00000c84;
+       int     pos = 0;
+       int     nr = 0;
+       char    *p = (char *) CIB_INFO_START_ADDR;
+
+       while ((*p != '\0') && (pos < CIB_INFO_LEN)) {
+               if (*p < ' ' || *p > '~') { /* ASCII strings! */
+                       return ret;
+               }
+               if (*p == '-') {
+                       if ((p[1] == 't') && (p[2] == 'f')) {
+                               p += 6;
+                               ret = 0;
+                               while (nr < 8) {
+                               if ((*p >= '0') && (*p <= '9')) {
+                                       ret *= 0x10;
+                                       ret += *p - '0';
+                                       p += 1;
+                                       nr ++;
+                               } else if ((*p >= 'A') && (*p <= 'F')) {
+                                       ret *= 10;
+                                       ret += *p - '7';
+                                       p += 1;
+                                       nr ++;
+                               } else {
+                                       if (nr < 8) return 0x00000c84;
+                                       return ret;
+                               }
+                               }
+                       }
+               }
+               p++;
+               pos++;
+       }
+       return ret;
+}
+
+/* Update the Flash_Size and the Flash Timing */
+int update_flash_size (int flash_size)
+{
+       volatile immap_t * immr = (immap_t *)CFG_IMMR;
+       volatile memctl8260_t *memctl = &immr->im_memctl;
+       unsigned long reg;
+       unsigned long tim;
+
+       /* I must use reg, otherwise the board hang */
+       reg = memctl->memc_or0;
+       reg &= ~ORxU_AM_MSK;
+       reg |= MEG_TO_AM(flash_size >> 20);
+       tim = get_flash_timing ();
+       reg &= ~0xfff;
+       reg |= (tim & 0xfff);
+       memctl->memc_or0 = reg;
+       return 0;
+}
+#endif
+
+#if defined(CONFIG_CMD_NAND)
+
+#include <nand.h>
+#include <linux/mtd/mtd.h>
+
+static u8 hwctl = 0;
+
+static void upmnand_hwcontrol(struct mtd_info *mtdinfo, int cmd)
+{
+       switch (cmd) {
+       case NAND_CTL_SETCLE:
+               hwctl |= 0x1;
+               break;
+       case NAND_CTL_CLRCLE:
+               hwctl &= ~0x1;
+               break;
+
+       case NAND_CTL_SETALE:
+               hwctl |= 0x2;
+               break;
+
+       case NAND_CTL_CLRALE:
+               hwctl &= ~0x2;
+               break;
+       }
+}
+
+static void upmnand_write_byte(struct mtd_info *mtdinfo, u_char byte)
+{
+       struct nand_chip *this = mtdinfo->priv;
+       ulong base = (ulong) (this->IO_ADDR_W + chipsel * CFG_NAND_CS_DIST);
+
+       if (hwctl & 0x1) {
+               WRITE_NAND_UPM(byte, base, CFG_NAND_UPM_WRITE_CMD_OFS);
+       } else if (hwctl & 0x2) {
+               WRITE_NAND_UPM(byte, base, CFG_NAND_UPM_WRITE_ADDR_OFS);
+       } else {
+               WRITE_NAND(byte, base);
+       }
+}
+
+static u_char upmnand_read_byte(struct mtd_info *mtdinfo)
+{
+       struct nand_chip *this = mtdinfo->priv;
+       ulong base = (ulong) (this->IO_ADDR_W + chipsel * CFG_NAND_CS_DIST);
+
+       return READ_NAND(base);
+}
+
+static int tqm8272_dev_ready(struct mtd_info *mtdinfo)
+{
+       /* constant delay (see also tR in the datasheet) */
+       udelay(12); \
+       return 1;
+}
+
+#ifndef CONFIG_NAND_SPL
+static void tqm8272_read_buf(struct mtd_info *mtdinfo, uint8_t *buf, int len)
+{
+       struct nand_chip *this = mtdinfo->priv;
+       unsigned char *base = (unsigned char *) (this->IO_ADDR_W + chipsel * CFG_NAND_CS_DIST);
+       int     i;
+
+       for (i = 0; i< len; i++)
+               buf[i] = *base;
+}
+
+static void tqm8272_write_buf(struct mtd_info *mtdinfo, const uint8_t *buf, int len)
+{
+       struct nand_chip *this = mtdinfo->priv;
+       unsigned char *base = (unsigned char *) (this->IO_ADDR_W + chipsel * CFG_NAND_CS_DIST);
+       int     i;
+
+       for (i = 0; i< len; i++)
+               *base = buf[i];
+}
+
+static int tqm8272_verify_buf(struct mtd_info *mtdinfo, const uint8_t *buf, int len)
+{
+       struct nand_chip *this = mtdinfo->priv;
+       unsigned char *base = (unsigned char *) (this->IO_ADDR_W + chipsel * CFG_NAND_CS_DIST);
+       int     i;
+
+       for (i = 0; i < len; i++)
+               if (buf[i] != *base)
+                       return -1;
+       return 0;
+}
+#endif /* #ifndef CONFIG_NAND_SPL */
+
+void board_nand_select_device(struct nand_chip *nand, int chip)
+{
+       chipsel = chip;
+}
+
+int board_nand_init(struct nand_chip *nand)
+{
+       static  int     UpmInit = 0;
+       volatile immap_t * immr = (immap_t *)CFG_IMMR;
+       volatile memctl8260_t *memctl = &immr->im_memctl;
+
+       if (hwinf.nand == 0) return -1;
+
+       /* Setup the UPM */
+       if (UpmInit == 0) {
+               switch (hwinf.busclk_real) {
+               case 100000000:
+                       upmconfig (UPMB, (uint *) upmTable100,
+                          sizeof (upmTable100) / sizeof (uint));
+                       break;
+               case 133333333:
+                       upmconfig (UPMB, (uint *) upmTable133,
+                          sizeof (upmTable133) / sizeof (uint));
+                       break;
+               default:
+                       upmconfig (UPMB, (uint *) upmTable67,
+                          sizeof (upmTable67) / sizeof (uint));
+                       break;
+               }
+               UpmInit = 1;
+       }
+
+       /* Setup the memctrl */
+       memctl->memc_or3 = CFG_NAND_OR;
+       memctl->memc_br3 = CFG_NAND_BR;
+       memctl->memc_mbmr = (MxMR_OP_NORM);
+
+       nand->eccmode = NAND_ECC_SOFT;
+
+       nand->hwcontrol  = upmnand_hwcontrol;
+       nand->read_byte  = upmnand_read_byte;
+       nand->write_byte = upmnand_write_byte;
+       nand->dev_ready  = tqm8272_dev_ready;
+
+#ifndef CONFIG_NAND_SPL
+       nand->write_buf  = tqm8272_write_buf;
+       nand->read_buf   = tqm8272_read_buf;
+       nand->verify_buf = tqm8272_verify_buf;
+#endif
+
+       /*
+        * Select required NAND chip
+        */
+       board_nand_select_device(nand, 0);
+       return 0;
+}
+
+#endif
+
+#ifdef CONFIG_PCI
+struct pci_controller hose;
+
+int board_early_init_f (void)
+{
+       volatile immap_t *immap = (immap_t *) CFG_IMMR;
+
+       immap->im_clkrst.car_sccr |= M826X_SCCR_PCI_MODE_EN;
+       return 0;
+}
+
+extern void pci_mpc8250_init(struct pci_controller *);
+
+void pci_init_board(void)
+{
+       pci_mpc8250_init(&hose);
+}
+#endif
diff --git a/board/tqc/tqm834x/Makefile b/board/tqc/tqm834x/Makefile
new file mode 100644 (file)
index 0000000..4c0d204
--- /dev/null
@@ -0,0 +1,52 @@
+#
+# (C) Copyright 2006
+# Wolfgang Denk, DENX Software Engineering, wd@denx.de.
+#
+# Copyright 2004 Freescale Semiconductor, Inc.
+#
+# See file CREDITS for list of people who contributed to this
+# project.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 2 of
+# the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+# MA 02111-1307 USA
+#
+
+include $(TOPDIR)/config.mk
+
+LIB    = $(obj)lib$(BOARD).a
+
+COBJS  = $(BOARD).o pci.o
+
+SRCS   := $(SOBJS:.o=.S) $(COBJS:.o=.c)
+OBJS   := $(addprefix $(obj),$(COBJS))
+SOBJS  := $(addprefix $(obj),$(SOBJS))
+
+$(LIB):        $(obj).depend $(OBJS)
+       $(AR) $(ARFLAGS) $@ $(OBJS)
+
+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/tqc/tqm834x/config.mk b/board/tqc/tqm834x/config.mk
new file mode 100644 (file)
index 0000000..f172c4e
--- /dev/null
@@ -0,0 +1,23 @@
+#
+# Copyright 2004 Freescale Semiconductor, Inc.
+#
+# See file CREDITS for list of people who contributed to this
+# project.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 2 of
+# the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+# MA 02111-1307 USA
+#
+
+TEXT_BASE   =   0x80000000
diff --git a/board/tqc/tqm834x/pci.c b/board/tqc/tqm834x/pci.c
new file mode 100644 (file)
index 0000000..e3d0309
--- /dev/null
@@ -0,0 +1,220 @@
+/*
+ * (C) Copyright 2005
+ * 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 <asm/mmu.h>
+#include <common.h>
+#include <pci.h>
+
+#ifdef CONFIG_PCI
+
+/* System RAM mapped to PCI space */
+#define CONFIG_PCI_SYS_MEM_BUS CFG_SDRAM_BASE
+#define CONFIG_PCI_SYS_MEM_PHYS        CFG_SDRAM_BASE
+#define CONFIG_PCI_SYS_MEM_SIZE        (1024 * 1024 * 1024)
+
+#ifndef CONFIG_PCI_PNP
+static struct pci_config_table pci_tqm834x_config_table[] = {
+       {PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID,
+        PCI_IDSEL_NUMBER, PCI_ANY_ID,
+        pci_cfgfunc_config_device, {PCI_ENET0_IOADDR,
+                                    PCI_ENET0_MEMADDR,
+                                    PCI_COMMAND_MEMORY | PCI_COMMAND_MASTER
+               }
+       },
+       {}
+};
+#endif
+
+static struct pci_controller pci1_hose = {
+#ifndef CONFIG_PCI_PNP
+       config_table:pci_tqm834x_config_table,
+#endif
+};
+
+
+/**************************************************************************
+ * pci_init_board()
+ *
+ * NOTICE: MPC8349 internally has two PCI controllers (PCI1 and PCI2) but since
+ * per TQM834x design physical connections to external devices (PCI sockets)
+ * are routed only to the PCI1 we do not account for the second one - this code
+ * supports PCI1 module only. Should support for the PCI2 be required in the
+ * future it needs a separate pci_controller structure (above) and handling -
+ * please refer to other boards' implementation for dual PCI host controllers,
+ * for example board/Marvell/db64360/pci.c, pci_init_board()
+ *
+ */
+void
+pci_init_board(void)
+{
+       volatile immap_t *      immr;
+       volatile clk83xx_t *    clk;
+       volatile law83xx_t *    pci_law;
+       volatile pot83xx_t *    pci_pot;
+       volatile pcictrl83xx_t *        pci_ctrl;
+       volatile pciconf83xx_t *        pci_conf;
+       u16 reg16;
+       u32 reg32;
+       struct  pci_controller * hose;
+
+       immr = (immap_t *)CFG_IMMR;
+       clk = (clk83xx_t *)&immr->clk;
+       pci_law = immr->sysconf.pcilaw;
+       pci_pot = immr->ios.pot;
+       pci_ctrl = immr->pci_ctrl;
+       pci_conf = immr->pci_conf;
+
+       hose = &pci1_hose;
+
+       /*
+        * Configure PCI controller and PCI_CLK_OUTPUT
+        */
+
+       /*
+        * WARNING! only PCI_CLK_OUTPUT1 is enabled here as this is the one
+        * line actually used for clocking all external PCI devices in TQM83xx.
+        * Enabling other PCI_CLK_OUTPUT lines may lead to board's hang for
+        * unknown reasons - particularly PCI_CLK_OUTPUT6 and PCI_CLK_OUTPUT7
+        * are known to hang the board; this issue is under investigation
+        * (13 oct 05)
+        */
+       reg32 = OCCR_PCICOE1;
+#if 0
+       /* enabling all PCI_CLK_OUTPUT lines HANGS the board... */
+       reg32 = 0xff000000;
+#endif
+       if (clk->spmr & SPMR_CKID) {
+               /* PCI Clock is half CONFIG_83XX_CLKIN so need to set up OCCR
+                * fields accordingly */
+               reg32 |= (OCCR_PCI1CR | OCCR_PCI2CR);
+
+               reg32 |= (OCCR_PCICD0 | OCCR_PCICD1 | OCCR_PCICD2 \
+                         | OCCR_PCICD3 | OCCR_PCICD4 | OCCR_PCICD5 \
+                         | OCCR_PCICD6 | OCCR_PCICD7);
+       }
+
+       clk->occr = reg32;
+       udelay(2000);
+
+       /*
+        * Release PCI RST Output signal
+        */
+       pci_ctrl[0].gcr = 0;
+       udelay(2000);
+       pci_ctrl[0].gcr = 1;
+       udelay(2000);
+
+       /*
+        * Configure PCI Local Access Windows
+        */
+       pci_law[0].bar = CFG_PCI1_MEM_PHYS & LAWBAR_BAR;
+       pci_law[0].ar = LAWAR_EN | LAWAR_SIZE_512M;
+
+       pci_law[1].bar = CFG_PCI1_IO_PHYS & LAWBAR_BAR;
+       pci_law[1].ar = LAWAR_EN | LAWAR_SIZE_16M;
+
+       /*
+        * Configure PCI Outbound Translation Windows
+        */
+
+       /* PCI1 mem space */
+       pci_pot[0].potar = (CFG_PCI1_MEM_BASE >> 12) & POTAR_TA_MASK;
+       pci_pot[0].pobar = (CFG_PCI1_MEM_PHYS >> 12) & POBAR_BA_MASK;
+       pci_pot[0].pocmr = POCMR_EN | (POCMR_CM_512M & POCMR_CM_MASK);
+
+       /* PCI1 IO space */
+       pci_pot[1].potar = (CFG_PCI1_IO_BASE >> 12) & POTAR_TA_MASK;
+       pci_pot[1].pobar = (CFG_PCI1_IO_PHYS >> 12) & POBAR_BA_MASK;
+       pci_pot[1].pocmr = POCMR_EN | POCMR_IO | (POCMR_CM_16M & POCMR_CM_MASK);
+
+       /*
+        * Configure PCI Inbound Translation Windows
+        */
+
+       /* we need RAM mapped to PCI space for the devices to
+        * access main memory */
+       pci_ctrl[0].pitar1 = 0x0;
+       pci_ctrl[0].pibar1 = 0x0;
+       pci_ctrl[0].piebar1 = 0x0;
+       pci_ctrl[0].piwar1 = PIWAR_EN | PIWAR_PF | PIWAR_RTT_SNOOP | PIWAR_WTT_SNOOP | PIWAR_IWS_256M;
+
+       hose->first_busno = 0;
+       hose->last_busno = 0xff;
+
+       /* PCI memory space */
+       pci_set_region(hose->regions + 0,
+                      CFG_PCI1_MEM_BASE,
+                      CFG_PCI1_MEM_PHYS,
+                      CFG_PCI1_MEM_SIZE,
+                      PCI_REGION_MEM);
+
+       /* PCI IO space */
+       pci_set_region(hose->regions + 1,
+                      CFG_PCI1_IO_BASE,
+                      CFG_PCI1_IO_PHYS,
+                      CFG_PCI1_IO_SIZE,
+                      PCI_REGION_IO);
+
+       /* System memory space */
+       pci_set_region(hose->regions + 2,
+                      CONFIG_PCI_SYS_MEM_BUS,
+                      CONFIG_PCI_SYS_MEM_PHYS,
+                      CONFIG_PCI_SYS_MEM_SIZE,
+                      PCI_REGION_MEM | PCI_REGION_MEMORY);
+
+       hose->region_count = 3;
+
+       pci_setup_indirect(hose,
+                          (CFG_IMMR+0x8300),
+                          (CFG_IMMR+0x8304));
+
+       pci_register_hose(hose);
+
+       /*
+        * Write to Command register
+        */
+       reg16 = 0xff;
+       pci_hose_read_config_word (hose, PCI_BDF(0,0,0), PCI_COMMAND,
+                                       &reg16);
+       reg16 |= PCI_COMMAND_SERR | PCI_COMMAND_MASTER | PCI_COMMAND_MEMORY;
+       pci_hose_write_config_word(hose, PCI_BDF(0,0,0), PCI_COMMAND,
+                                       reg16);
+
+       /*
+        * Clear non-reserved bits in status register.
+        */
+       pci_hose_write_config_word(hose, PCI_BDF(0,0,0), PCI_STATUS,
+                                       0xffff);
+       pci_hose_write_config_byte(hose, PCI_BDF(0,0,0), PCI_LATENCY_TIMER,
+                                       0x80);
+
+#ifdef CONFIG_PCI_SCAN_SHOW
+       printf("PCI:   Bus Dev VenId DevId Class Int\n");
+#endif
+       /*
+        * Hose scan.
+        */
+       hose->last_busno = pci_hose_scan(hose);
+}
+#endif /* CONFIG_PCI */
diff --git a/board/tqc/tqm834x/tqm834x.c b/board/tqc/tqm834x/tqm834x.c
new file mode 100644 (file)
index 0000000..aea985c
--- /dev/null
@@ -0,0 +1,433 @@
+/*
+ * (C) Copyright 2005
+ * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ */
+
+#include <common.h>
+#include <ioports.h>
+#include <mpc83xx.h>
+#include <asm/mpc8349_pci.h>
+#include <i2c.h>
+#include <miiphy.h>
+#include <asm-ppc/mmu.h>
+#include <pci.h>
+
+DECLARE_GLOBAL_DATA_PTR;
+
+#define IOSYNC                 asm("eieio")
+#define ISYNC                  asm("isync")
+#define SYNC                   asm("sync")
+#define FPW                    FLASH_PORT_WIDTH
+#define FPWV                   FLASH_PORT_WIDTHV
+
+#define DDR_MAX_SIZE_PER_CS    0x20000000
+
+#if defined(DDR_CASLAT_20)
+#define TIMING_CASLAT          TIMING_CFG1_CASLAT_20
+#define MODE_CASLAT            DDR_MODE_CASLAT_20
+#else
+#define TIMING_CASLAT          TIMING_CFG1_CASLAT_25
+#define MODE_CASLAT            DDR_MODE_CASLAT_25
+#endif
+
+#define INITIAL_CS_CONFIG      (CSCONFIG_EN | CSCONFIG_ROW_BIT_12 | \
+                               CSCONFIG_COL_BIT_9)
+
+/* Global variable used to store detected number of banks */
+int tqm834x_num_flash_banks;
+
+/* External definitions */
+ulong flash_get_size (ulong base, int banknum);
+extern flash_info_t flash_info[];
+
+/* Local functions */
+static int detect_num_flash_banks(void);
+static long int get_ddr_bank_size(short cs, volatile long *base);
+static void set_cs_bounds(short cs, long base, long size);
+static void set_cs_config(short cs, long config);
+static void set_ddr_config(void);
+
+/* Local variable */
+static volatile immap_t *im = (immap_t *)CFG_IMMR;
+
+/**************************************************************************
+ * Board initialzation after relocation to RAM. Used to detect the number
+ * of Flash banks on TQM834x.
+ */
+int board_early_init_r (void) {
+       /* sanity check, IMMARBAR should be mirrored at offset zero of IMMR */
+       if ((im->sysconf.immrbar & IMMRBAR_BASE_ADDR) != (u32)im)
+               return 0;
+
+       /* detect the number of Flash banks */
+       return detect_num_flash_banks();
+}
+
+/**************************************************************************
+ * DRAM initalization and size detection
+ */
+long int initdram (int board_type)
+{
+       long bank_size;
+       long size;
+       int cs;
+
+       /* during size detection, set up the max DDRLAW size */
+       im->sysconf.ddrlaw[0].bar = CFG_DDR_BASE;
+       im->sysconf.ddrlaw[0].ar = (LAWAR_EN | LAWAR_SIZE_2G);
+
+       /* set CS bounds to maximum size */
+       for(cs = 0; cs < 4; ++cs) {
+               set_cs_bounds(cs,
+                       CFG_DDR_BASE + (cs * DDR_MAX_SIZE_PER_CS),
+                       DDR_MAX_SIZE_PER_CS);
+
+               set_cs_config(cs, INITIAL_CS_CONFIG);
+       }
+
+       /* configure ddr controller */
+       set_ddr_config();
+
+       udelay(200);
+
+       /* enable DDR controller */
+       im->ddr.sdram_cfg = (SDRAM_CFG_MEM_EN |
+               SDRAM_CFG_SREN |
+               SDRAM_CFG_SDRAM_TYPE_DDR1);
+       SYNC;
+
+       /* size detection */
+       debug("\n");
+       size = 0;
+       for(cs = 0; cs < 4; ++cs) {
+               debug("\nDetecting Bank%d\n", cs);
+
+               bank_size = get_ddr_bank_size(cs,
+                       (volatile long*)(CFG_DDR_BASE + size));
+               size += bank_size;
+
+               debug("DDR Bank%d size: %d MiB\n\n", cs, bank_size >> 20);
+
+               /* exit if less than one bank */
+               if(size < DDR_MAX_SIZE_PER_CS) break;
+       }
+
+       return size;
+}
+
+/**************************************************************************
+ * checkboard()
+ */
+int checkboard (void)
+{
+       puts("Board: TQM834x\n");
+
+#ifdef CONFIG_PCI
+       volatile immap_t * immr;
+       u32 w, f;
+
+       immr = (immap_t *)CFG_IMMR;
+       if (!(immr->reset.rcwh & HRCWH_PCI_HOST)) {
+               printf("PCI:   NOT in host mode..?!\n");
+               return 0;
+       }
+
+       /* get bus width */
+       w = 32;
+       if (immr->reset.rcwh & HRCWH_64_BIT_PCI)
+               w = 64;
+
+       /* get clock */
+       f = gd->pci_clk;
+
+       printf("PCI1:  %d bit, %d MHz\n", w, f / 1000000);
+#else
+       printf("PCI:   disabled\n");
+#endif
+       return 0;
+}
+
+
+/**************************************************************************
+ *
+ * Local functions
+ *
+ *************************************************************************/
+
+/**************************************************************************
+ * Detect the number of flash banks (1 or 2). Store it in
+ * a global variable tqm834x_num_flash_banks.
+ * Bank detection code based on the Monitor code.
+ */
+static int detect_num_flash_banks(void)
+{
+       typedef unsigned long FLASH_PORT_WIDTH;
+       typedef volatile unsigned long FLASH_PORT_WIDTHV;
+       FPWV *bank1_base;
+       FPWV *bank2_base;
+       FPW bank1_read;
+       FPW bank2_read;
+       ulong bank1_size;
+       ulong bank2_size;
+       ulong total_size;
+
+       tqm834x_num_flash_banks = 2;    /* assume two banks */
+
+       /* Get bank 1 and 2 information */
+       bank1_size = flash_get_size(CFG_FLASH_BASE, 0);
+       debug("Bank1 size: %lu\n", bank1_size);
+       bank2_size = flash_get_size(CFG_FLASH_BASE + bank1_size, 1);
+       debug("Bank2 size: %lu\n", bank2_size);
+       total_size = bank1_size + bank2_size;
+
+       if (bank2_size > 0) {
+               /* Seems like we've got bank 2, but maybe it's mirrored 1 */
+
+               /* Set the base addresses */
+               bank1_base = (FPWV *) (CFG_FLASH_BASE);
+               bank2_base = (FPWV *) (CFG_FLASH_BASE + bank1_size);
+
+               /* Put bank 2 into CFI command mode and read */
+               bank2_base[0x55] = 0x00980098;
+               IOSYNC;
+               ISYNC;
+               bank2_read = bank2_base[0x10];
+
+               /* Read from bank 1 (it's in read mode) */
+               bank1_read = bank1_base[0x10];
+
+               /* Reset Flash */
+               bank1_base[0] = 0x00F000F0;
+               bank2_base[0] = 0x00F000F0;
+
+               if (bank2_read == bank1_read) {
+                       /*
+                        * Looks like just one bank, but not sure yet. Let's
+                        * read from bank 2 in autosoelect mode.
+                        */
+                       bank2_base[0x0555] = 0x00AA00AA;
+                       bank2_base[0x02AA] = 0x00550055;
+                       bank2_base[0x0555] = 0x00900090;
+                       IOSYNC;
+                       ISYNC;
+                       bank2_read = bank2_base[0x10];
+
+                       /* Read from bank 1 (it's in read mode) */
+                       bank1_read = bank1_base[0x10];
+
+                       /* Reset Flash */
+                       bank1_base[0] = 0x00F000F0;
+                       bank2_base[0] = 0x00F000F0;
+
+                       if (bank2_read == bank1_read) {
+                               /*
+                                * In both CFI command and autoselect modes,
+                                * we got the some data reading from Flash.
+                                * There is only one mirrored bank.
+                                */
+                               tqm834x_num_flash_banks = 1;
+                               total_size = bank1_size;
+                       }
+               }
+       }
+
+       debug("Number of flash banks detected: %d\n", tqm834x_num_flash_banks);
+
+       /* set OR0 and BR0 */
+       im->lbus.bank[0].or = CFG_OR_TIMING_FLASH |
+               (-(total_size) & OR_GPCM_AM);
+       im->lbus.bank[0].br = (CFG_FLASH_BASE & BR_BA) |
+               (BR_MS_GPCM | BR_PS_32 | BR_V);
+
+       return (0);
+}
+
+/*************************************************************************
+ * Detect the size of a ddr bank. Sets CS bounds and CS config accordingly.
+ */
+static long int get_ddr_bank_size(short cs, volatile long *base)
+{
+       /* This array lists all valid DDR SDRAM configurations, with
+        * Bank sizes in bytes. (Refer to Table 9-27 in the MPC8349E RM).
+        * The last entry has to to have size equal 0 and is igonred during
+        * autodection. Bank sizes must be in increasing order of size
+        */
+       struct {
+               long row;
+               long col;
+               long size;
+       } conf[] = {
+               {CSCONFIG_ROW_BIT_12,   CSCONFIG_COL_BIT_8,     32 << 20},
+               {CSCONFIG_ROW_BIT_12,   CSCONFIG_COL_BIT_9,     64 << 20},
+               {CSCONFIG_ROW_BIT_12,   CSCONFIG_COL_BIT_10,    128 << 20},
+               {CSCONFIG_ROW_BIT_13,   CSCONFIG_COL_BIT_9,     128 << 20},
+               {CSCONFIG_ROW_BIT_13,   CSCONFIG_COL_BIT_10,    256 << 20},
+               {CSCONFIG_ROW_BIT_13,   CSCONFIG_COL_BIT_11,    512 << 20},
+               {CSCONFIG_ROW_BIT_14,   CSCONFIG_COL_BIT_10,    512 << 20},
+               {CSCONFIG_ROW_BIT_14,   CSCONFIG_COL_BIT_11,    1024 << 20},
+               {0,                     0,                      0}
+       };
+
+       int i;
+       int detected;
+       long size;
+
+       detected = -1;
+       for(i = 0; conf[i].size != 0; ++i) {
+
+               /* set sdram bank configuration */
+               set_cs_config(cs, CSCONFIG_EN | conf[i].col | conf[i].row);
+
+               debug("Getting RAM size...\n");
+               size = get_ram_size(base, DDR_MAX_SIZE_PER_CS);
+
+               if((size == conf[i].size) && (i == detected + 1))
+                       detected = i;
+
+               debug("Trying %ld x %ld (%ld MiB) at addr %p, detected: %ld MiB\n",
+                       conf[i].row,
+                       conf[i].col,
+                       conf[i].size >> 20,
+                       base,
+                       size >> 20);
+       }
+
+       if(detected == -1){
+               /* disable empty cs */
+               debug("\nNo valid configurations for CS%d, disabling...\n", cs);
+               set_cs_config(cs, 0);
+               return 0;
+       }
+
+       debug("\nDetected configuration %ld x %ld (%ld MiB) at addr %p\n",
+                       conf[detected].row, conf[detected].col, conf[detected].size >> 20, base);
+
+       /* configure cs ro detected params */
+       set_cs_config(cs, CSCONFIG_EN | conf[detected].row |
+                       conf[detected].col);
+
+       set_cs_bounds(cs, (long)base, conf[detected].size);
+
+       return(conf[detected].size);
+}
+
+/**************************************************************************
+ * Sets DDR bank CS bounds.
+ */
+static void set_cs_bounds(short cs, long base, long size)
+{
+       debug("Setting bounds %08x, %08x for cs %d\n", base, size, cs);
+       if(size == 0){
+               im->ddr.csbnds[cs].csbnds = 0x00000000;
+       } else {
+               im->ddr.csbnds[cs].csbnds =
+                       ((base >> CSBNDS_SA_SHIFT) & CSBNDS_SA) |
+                       (((base + size - 1) >> CSBNDS_EA_SHIFT) &
+                               CSBNDS_EA);
+       }
+       SYNC;
+}
+
+/**************************************************************************
+ * Sets DDR banks CS configuration.
+ * config == 0x00000000 disables the CS.
+ */
+static void set_cs_config(short cs, long config)
+{
+       debug("Setting config %08x for cs %d\n", config, cs);
+       im->ddr.cs_config[cs] = config;
+       SYNC;
+}
+
+/**************************************************************************
+ * Sets DDR clocks, timings and configuration.
+ */
+static void set_ddr_config(void) {
+       /* clock control */
+       im->ddr.sdram_clk_cntl = DDR_SDRAM_CLK_CNTL_SS_EN |
+               DDR_SDRAM_CLK_CNTL_CLK_ADJUST_05;
+       SYNC;
+
+       /* timing configuration */
+       im->ddr.timing_cfg_1 =
+               (4 << TIMING_CFG1_PRETOACT_SHIFT) |
+               (7 << TIMING_CFG1_ACTTOPRE_SHIFT) |
+               (4 << TIMING_CFG1_ACTTORW_SHIFT)  |
+               (5 << TIMING_CFG1_REFREC_SHIFT)   |
+               (3 << TIMING_CFG1_WRREC_SHIFT)    |
+               (3 << TIMING_CFG1_ACTTOACT_SHIFT) |
+               (1 << TIMING_CFG1_WRTORD_SHIFT)   |
+               (TIMING_CFG1_CASLAT & TIMING_CASLAT);
+
+       im->ddr.timing_cfg_2 =
+               TIMING_CFG2_CPO_DEF |
+               (2 << TIMING_CFG2_WR_DATA_DELAY_SHIFT);
+       SYNC;
+
+       /* don't enable DDR controller yet */
+       im->ddr.sdram_cfg =
+               SDRAM_CFG_SREN |
+               SDRAM_CFG_SDRAM_TYPE_DDR1;
+       SYNC;
+
+       /* Set SDRAM mode */
+       im->ddr.sdram_mode =
+               ((DDR_MODE_EXT_MODEREG | DDR_MODE_WEAK) <<
+                       SDRAM_MODE_ESD_SHIFT) |
+               ((DDR_MODE_MODEREG | DDR_MODE_BLEN_4) <<
+                       SDRAM_MODE_SD_SHIFT) |
+               ((DDR_MODE_CASLAT << SDRAM_MODE_SD_SHIFT) &
+                       MODE_CASLAT);
+       SYNC;
+
+       /* Set fast SDRAM refresh rate */
+       im->ddr.sdram_interval =
+               (DDR_REFINT_166MHZ_7US << SDRAM_INTERVAL_REFINT_SHIFT) |
+               (DDR_BSTOPRE << SDRAM_INTERVAL_BSTOPRE_SHIFT);
+       SYNC;
+
+       /* Workaround for DDR6 Erratum
+        * see MPC8349E Device Errata Rev.8, 2/2006
+        * This workaround influences the MPC internal "input enables"
+        * dependent on CAS latency and MPC revision. According to errata
+        * sheet the internal reserved registers for this workaround are
+        * not available from revision 2.0 and up.
+        */
+
+       /* Get REVID from register SPRIDR. Skip workaround if rev >= 2.0
+        * (0x200)
+        */
+       if ((im->sysconf.spridr & SPRIDR_REVID) < 0x200) {
+
+               /* There is a internal reserved register at IMMRBAR+0x2F00
+                * which has to be written with a certain value defined by
+                * errata sheet.
+                */
+               u32 *reserved_p = (u32 *)((u8 *)im + 0x2f00);
+
+#if defined(DDR_CASLAT_20)
+               *reserved_p = 0x201c0000;
+#else
+               *reserved_p = 0x202c0000;
+#endif
+       }
+}
diff --git a/board/tqc/tqm85xx/Makefile b/board/tqc/tqm85xx/Makefile
new file mode 100644 (file)
index 0000000..8ea07f2
--- /dev/null
@@ -0,0 +1,56 @@
+#
+# (C) Copyright 2001-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-y        += $(BOARD).o
+COBJS-y        += sdram.o
+COBJS-y        += law.o
+COBJS-y        += tlb.o
+
+COBJS-$(CONFIG_NAND) += nand.o
+
+COBJS  := $(COBJS-y)
+SRCS   := $(SOBJS:.o=.S) $(COBJS:.o=.c)
+OBJS   := $(addprefix $(obj),$(COBJS))
+SOBJS  := $(addprefix $(obj),$(SOBJS))
+
+$(LIB):        $(obj).depend $(OBJS) $(SOBJS)
+       $(AR) $(ARFLAGS) $@ $(OBJS)
+
+clean:
+       rm -f $(OBJS) $(SOBJS)
+
+distclean:     clean
+       rm -f $(LIB) core *.bak .depend
+
+#########################################################################
+
+# defines $(obj).depend target
+include $(SRCTREE)/rules.mk
+
+sinclude $(obj).depend
+
+#########################################################################
diff --git a/board/tqc/tqm85xx/config.mk b/board/tqc/tqm85xx/config.mk
new file mode 100644 (file)
index 0000000..52e84ad
--- /dev/null
@@ -0,0 +1,29 @@
+# Copyright 2004 Freescale Semiconductor.
+# Modified by Xianghua Xiao, X.Xiao@motorola.com
+# (C) Copyright 2002,Motorola Inc.
+#
+# See file CREDITS for list of people who contributed to this
+# project.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 2 of
+# the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+# MA 02111-1307 USA
+#
+
+#
+# tqm85xx board
+# default CCARBAR is at 0xff700000
+# assume U-Boot is less than 256k
+#
+TEXT_BASE = 0xfffc0000
diff --git a/board/tqc/tqm85xx/law.c b/board/tqc/tqm85xx/law.c
new file mode 100644 (file)
index 0000000..de3ea00
--- /dev/null
@@ -0,0 +1,86 @@
+/*
+ * Copyright 2008 Freescale Semiconductor, Inc.
+ *
+ * (C) Copyright 2000
+ * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+#include <common.h>
+#include <asm/fsl_law.h>
+#include <asm/mmu.h>
+
+/*
+ * LAW(Local Access Window) configuration:
+ *
+ * Standard mapping:
+ *
+ * 0x0000_0000    0x7fff_ffff     DDR                     2G
+ * 0x8000_0000    0x9fff_ffff     PCI1 MEM                512M
+ * 0xc000_0000    0xdfff_ffff     RapidIO or PCI express  512M
+ * 0xe000_0000    0xe000_ffff     CCSR                    1M
+ * 0xe200_0000    0xe2ff_ffff     PCI1 IO                 16M
+ * 0xe300_0000    0xe3ff_ffff     CAN and NAND Flash      16M
+ * 0xef00_0000    0xefff_ffff     PCI express IO          16M
+ * 0xfc00_0000    0xffff_ffff     FLASH (boot bank)       128M
+ *
+ * Big FLASH mapping:
+ *
+ * 0x0000_0000    0x7fff_ffff     DDR                     2G
+ * 0x8000_0000    0x9fff_ffff     PCI1 MEM                512M
+ * 0xa000_0000    0xa000_ffff     CCSR                    1M
+ * 0xa200_0000    0xa2ff_ffff     PCI1 IO                 16M
+ * 0xa300_0000    0xa3ff_ffff     CAN and NAND Flash      16M
+ * 0xaf00_0000    0xafff_ffff     PCI express IO          16M
+ * 0xb000_0000    0xbfff_ffff     RapidIO or PCI express  256M
+ * 0xc000_0000    0xffff_ffff     FLASH (boot bank)       1G
+ *
+ * Notes:
+ *    CCSRBAR and L2-as-SRAM don't need a configured Local Access Window.
+ *    If flash is 8M at default position (last 8M), no LAW needed.
+ */
+
+#ifdef CONFIG_TQM_BIGFLASH
+#define LAW_3_SIZE LAW_SIZE_1G
+#define LAW_5_SIZE LAW_SIZE_256M
+#else
+#define LAW_3_SIZE LAW_SIZE_128M
+#define LAW_5_SIZE LAW_SIZE_512M
+#endif
+
+struct law_entry law_table[] = {
+       SET_LAW(CFG_DDR_SDRAM_BASE, LAW_SIZE_512M, LAW_TRGT_IF_DDR),
+       SET_LAW(CFG_PCI1_MEM_PHYS, LAW_SIZE_512M, LAW_TRGT_IF_PCI),
+       SET_LAW(CFG_LBC_FLASH_BASE, LAW_3_SIZE, LAW_TRGT_IF_LBC),
+       SET_LAW(CFG_PCI1_IO_PHYS, LAW_SIZE_16M, LAW_TRGT_IF_PCI),
+#ifdef CONFIG_PCIE1
+       SET_LAW(CFG_PCIE1_MEM_BASE, LAW_5_SIZE, LAW_TRGT_IF_PCIE_1),
+#else /* !CONFIG_PCIE1 */
+       SET_LAW(CFG_RIO_MEM_BASE, LAW_5_SIZE, LAW_TRGT_IF_RIO),
+#endif /* CONFIG_PCIE1 */
+#if defined(CONFIG_CAN_DRIVER) || defined(CONFIG_NAND)
+       SET_LAW(CFG_CAN_BASE, LAW_SIZE_16M, LAW_TRGT_IF_LBC),
+#endif /* CONFIG_CAN_DRIVER || CONFIG_NAND */
+#ifdef CONFIG_PCIE1
+       SET_LAW(CFG_PCIE1_IO_BASE, LAW_SIZE_16M, LAW_TRGT_IF_PCIE_1),
+#endif /* CONFIG_PCIE */
+};
+
+int num_law_entries = ARRAY_SIZE (law_table);
diff --git a/board/tqc/tqm85xx/nand.c b/board/tqc/tqm85xx/nand.c
new file mode 100644 (file)
index 0000000..fe3b31f
--- /dev/null
@@ -0,0 +1,469 @@
+/*
+ * (C) Copyright 2008 Wolfgang Grandegger <wg@denx.de>
+ *
+ * (C) Copyright 2006
+ * Thomas Waehner, TQ-System GmbH, thomas.waehner@tqs.de.
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.         See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+#include <common.h>
+#include <asm/processor.h>
+#include <asm/immap_85xx.h>
+#include <asm/processor.h>
+#include <asm/mmu.h>
+#include <asm/io.h>
+#include <asm/errno.h>
+#include <linux/mtd/mtd.h>
+#include <linux/mtd/fsl_upm.h>
+#include <ioports.h>
+
+#include <nand.h>
+
+DECLARE_GLOBAL_DATA_PTR;
+
+extern uint get_lbc_clock (void);
+
+/* index of UPM RAM array run pattern for NAND command cycle */
+#define        CFG_NAN_UPM_WRITE_CMD_OFS       0x08
+
+/* index of UPM RAM array run pattern for NAND address cycle */
+#define        CFG_NAND_UPM_WRITE_ADDR_OFS     0x10
+
+/* Structure for table with supported UPM timings */
+struct upm_freq {
+       ulong freq;
+       const u32 *upm_patt;
+       uchar gpl4_disable;
+       uchar ehtr;
+       uchar ead;
+};
+
+/* NAND-FLASH UPM tables for TQM85XX according to TQM8548.pq.timing.101.doc */
+
+/* UPM pattern for bus clock = 25 MHz */
+static const u32 upm_patt_25[] = {
+       /* Offset *//* UPM Read Single RAM array entry -> NAND Read Data */
+       /* 0x00 */ 0x0ff32000, 0x0fa32000, 0x3fb32005, 0xfffffc00,
+       /* 0x04 */ 0xfffffc00, 0xfffffc00, 0xfffffc00, 0xfffffc00,
+
+       /* UPM Read Burst RAM array entry -> NAND Write CMD */
+       /* 0x08 */ 0x00ff2c30, 0x00ff2c30, 0x0fff2c35, 0xfffffc00,
+       /* 0x0C */ 0xfffffc00, 0xfffffc00, 0xfffffc00, 0xfffffc00,
+
+       /* UPM Read Burst RAM array entry -> NAND Write ADDR */
+       /* 0x10 */ 0x00f3ec30, 0x00f3ec30, 0x0ff3ec35, 0xfffffc00,
+       /* 0x14 */ 0xfffffc00, 0xfffffc00, 0xfffffc00, 0xfffffc00,
+
+       /* UPM Write Single RAM array entry -> NAND Write Data */
+       /* 0x18 */ 0x00f32c00, 0x00f32c00, 0x0ff32c05, 0xfffffc00,
+       /* 0x1C */ 0xfffffc00, 0xfffffc00, 0xfffffc00, 0xfffffc00,
+
+       /* UPM Write Burst RAM array entry -> unused */
+       /* 0x20 */ 0xfffffc00, 0xfffffc00, 0xfffffc00, 0xfffffc00,
+       /* 0x24 */ 0xfffffc00, 0xfffffc00, 0xfffffc00, 0xfffffc00,
+       /* 0x28 */ 0xfffffc00, 0xfffffc00, 0xfffffc00, 0xfffffc00,
+       /* 0x2C */ 0xfffffc00, 0xfffffc00, 0xfffffc00, 0xfffffc01,
+
+       /* UPM Refresh Timer RAM array entry -> unused */
+       /* 0x30 */ 0xfffffc00, 0xfffffc00, 0xfffffc00, 0xfffffc00,
+       /* 0x34 */ 0xfffffc00, 0xfffffc00, 0xfffffc00, 0xfffffc00,
+       /* 0x38 */ 0xfffffc00, 0xfffffc00, 0xfffffc00, 0xfffffc01,
+
+       /* UPM Exception RAM array entry -> unsused */
+       /* 0x3C */ 0xfffffc00, 0xfffffc00, 0xfffffc00, 0xfffffc01,
+};
+
+/* UPM pattern for bus clock = 33.3 MHz */
+static const u32 upm_patt_33[] = {
+       /* Offset *//* UPM Read Single RAM array entry -> NAND Read Data */
+       /* 0x00 */ 0x0ff32000, 0x0fa32100, 0x3fb32005, 0xfffffc00,
+       /* 0x04 */ 0xfffffc00, 0xfffffc00, 0xfffffc00, 0xfffffc00,
+
+       /* UPM Read Burst RAM array entry -> NAND Write CMD */
+       /* 0x08 */ 0x00ff2c30, 0x00ff2c30, 0x0fff2c35, 0xfffffc00,
+       /* 0x0C */ 0xfffffc00, 0xfffffc00, 0xfffffc00, 0xfffffc00,
+
+       /* UPM Read Burst RAM array entry -> NAND Write ADDR */
+       /* 0x10 */ 0x00f3ec30, 0x00f3ec30, 0x0ff3ec35, 0xfffffc00,
+       /* 0x14 */ 0xfffffc00, 0xfffffc00, 0xfffffc00, 0xfffffc00,
+
+       /* UPM Write Single RAM array entry -> NAND Write Data */
+       /* 0x18 */ 0x00f32c00, 0x00f32c00, 0x0ff32c05, 0xfffffc00,
+       /* 0x1C */ 0xfffffc00, 0xfffffc00, 0xfffffc00, 0xfffffc00,
+
+       /* UPM Write Burst RAM array entry -> unused */
+       /* 0x20 */ 0xfffffc00, 0xfffffc00, 0xfffffc00, 0xfffffc00,
+       /* 0x24 */ 0xfffffc00, 0xfffffc00, 0xfffffc00, 0xfffffc00,
+       /* 0x28 */ 0xfffffc00, 0xfffffc00, 0xfffffc00, 0xfffffc00,
+       /* 0x2C */ 0xfffffc00, 0xfffffc00, 0xfffffc00, 0xfffffc01,
+
+       /* UPM Refresh Timer RAM array entry -> unused */
+       /* 0x30 */ 0xfffffc00, 0xfffffc00, 0xfffffc00, 0xfffffc00,
+       /* 0x34 */ 0xfffffc00, 0xfffffc00, 0xfffffc00, 0xfffffc00,
+       /* 0x38 */ 0xfffffc00, 0xfffffc00, 0xfffffc00, 0xfffffc01,
+
+       /* UPM Exception RAM array entry -> unsused */
+       /* 0x3C */ 0xfffffc00, 0xfffffc00, 0xfffffc00, 0xfffffc01,
+};
+
+/* UPM pattern for bus clock = 41.7 MHz */
+static const u32 upm_patt_42[] = {
+       /* Offset *//* UPM Read Single RAM array entry -> NAND Read Data */
+       /* 0x00 */ 0x0ff32000, 0x0fa32100, 0x3fb32005, 0xfffffc00,
+       /* 0x04 */ 0xfffffc00, 0xfffffc00, 0xfffffc00, 0xfffffc00,
+
+       /* UPM Read Burst RAM array entry -> NAND Write CMD */
+       /* 0x08 */ 0x00ff2c30, 0x00ff2c30, 0x0fff2c35, 0xfffffc00,
+       /* 0x0C */ 0xfffffc00, 0xfffffc00, 0xfffffc00, 0xfffffc00,
+
+       /* UPM Read Burst RAM array entry -> NAND Write ADDR */
+       /* 0x10 */ 0x00f3ec30, 0x00f3ec30, 0x0ff3ec35, 0xfffffc00,
+       /* 0x14 */ 0xfffffc00, 0xfffffc00, 0xfffffc00, 0xfffffc00,
+
+       /* UPM Write Single RAM array entry -> NAND Write Data */
+       /* 0x18 */ 0x00f32c00, 0x00f32c00, 0x0ff32c05, 0xfffffc00,
+       /* 0x1C */ 0xfffffc00, 0xfffffc00, 0xfffffc00, 0xfffffc00,
+
+       /* UPM Write Burst RAM array entry -> unused */
+       /* 0x20 */ 0xfffffc00, 0xfffffc00, 0xfffffc00, 0xfffffc00,
+       /* 0x24 */ 0xfffffc00, 0xfffffc00, 0xfffffc00, 0xfffffc00,
+       /* 0x28 */ 0xfffffc00, 0xfffffc00, 0xfffffc00, 0xfffffc00,
+       /* 0x2C */ 0xfffffc00, 0xfffffc00, 0xfffffc00, 0xfffffc01,
+
+       /* UPM Refresh Timer RAM array entry -> unused */
+       /* 0x30 */ 0xfffffc00, 0xfffffc00, 0xfffffc00, 0xfffffc00,
+       /* 0x34 */ 0xfffffc00, 0xfffffc00, 0xfffffc00, 0xfffffc00,
+       /* 0x38 */ 0xfffffc00, 0xfffffc00, 0xfffffc00, 0xfffffc01,
+
+       /* UPM Exception RAM array entry -> unsused */
+       /* 0x3C */ 0xfffffc00, 0xfffffc00, 0xfffffc00, 0xfffffc01,
+};
+
+/* UPM pattern for bus clock = 50 MHz */
+static const u32 upm_patt_50[] = {
+       /* Offset *//* UPM Read Single RAM array entry -> NAND Read Data */
+       /* 0x00 */ 0x0ff33000, 0x0fa33100, 0x0fa33005, 0xfffffc00,
+       /* 0x04 */ 0xfffffc00, 0xfffffc00, 0xfffffc00, 0xfffffc00,
+
+       /* UPM Read Burst RAM array entry -> NAND Write CMD */
+       /* 0x08 */ 0x00ff3d30, 0x00ff3c30, 0x0fff3c35, 0xfffffc00,
+       /* 0x0C */ 0xfffffc00, 0xfffffc00, 0xfffffc00, 0xfffffc00,
+
+       /* UPM Read Burst RAM array entry -> NAND Write ADDR */
+       /* 0x10 */ 0x00f3fd30, 0x00f3fc30, 0x0ff3fc35, 0xfffffc00,
+       /* 0x14 */ 0xfffffc00, 0xfffffc00, 0xfffffc00, 0xfffffc00,
+
+       /* UPM Write Single RAM array entry -> NAND Write Data */
+       /* 0x18 */ 0x00f33d00, 0x00f33c00, 0x0ff33c05, 0xfffffc00,
+       /* 0x1C */ 0xfffffc00, 0xfffffc00, 0xfffffc00, 0xfffffc00,
+
+       /* UPM Write Burst RAM array entry -> unused */
+       /* 0x20 */ 0xfffffc00, 0xfffffc00, 0xfffffc00, 0xfffffc00,
+       /* 0x24 */ 0xfffffc00, 0xfffffc00, 0xfffffc00, 0xfffffc00,
+       /* 0x28 */ 0xfffffc00, 0xfffffc00, 0xfffffc00, 0xfffffc00,
+       /* 0x2C */ 0xfffffc00, 0xfffffc00, 0xfffffc00, 0xfffffc01,
+
+       /* UPM Refresh Timer RAM array entry -> unused */
+       /* 0x30 */ 0xfffffc00, 0xfffffc00, 0xfffffc00, 0xfffffc00,
+       /* 0x34 */ 0xfffffc00, 0xfffffc00, 0xfffffc00, 0xfffffc00,
+       /* 0x38 */ 0xfffffc00, 0xfffffc00, 0xfffffc00, 0xfffffc01,
+
+       /* UPM Exception RAM array entry -> unsused */
+       /* 0x3C */ 0xfffffc00, 0xfffffc00, 0xfffffc00, 0xfffffc01,
+};
+
+/* UPM pattern for bus clock = 66.7 MHz */
+static const u32 upm_patt_67[] = {
+       /* Offset *//* UPM Read Single RAM array entry -> NAND Read Data */
+       /* 0x00 */ 0x0ff33000, 0x0fe33000, 0x0fa33100, 0x0fa33000,
+       /* 0x04 */ 0x0fa33005, 0xfffffc00, 0xfffffc00, 0xfffffc00,
+
+       /* UPM Read Burst RAM array entry -> NAND Write CMD */
+       /* 0x08 */ 0x00ff3d30, 0x00ff3c30, 0x0fff3c30, 0x0fff3c35,
+       /* 0x0C */ 0xfffffc00, 0xfffffc00, 0xfffffc00, 0xfffffc00,
+
+       /* UPM Read Burst RAM array entry -> NAND Write ADDR */
+       /* 0x10 */ 0x00f3fd30, 0x00f3fc30, 0x0ff3fc30, 0x0ff3fc35,
+       /* 0x14 */ 0xfffffc00, 0xfffffc00, 0xfffffc00, 0xfffffc00,
+
+       /* UPM Write Single RAM array entry -> NAND Write Data */
+       /* 0x18 */ 0x00f33d00, 0x00f33c00, 0x0ff33c00, 0x0ff33c05,
+       /* 0x1C */ 0xfffffc00, 0xfffffc00, 0xfffffc00, 0xfffffc00,
+
+       /* UPM Write Burst RAM array entry -> unused */
+       /* 0x20 */ 0xfffffc00, 0xfffffc00, 0xfffffc00, 0xfffffc00,
+       /* 0x24 */ 0xfffffc00, 0xfffffc00, 0xfffffc00, 0xfffffc00,
+       /* 0x28 */ 0xfffffc00, 0xfffffc00, 0xfffffc00, 0xfffffc00,
+       /* 0x2C */ 0xfffffc00, 0xfffffc00, 0xfffffc00, 0xfffffc01,
+
+       /* UPM Refresh Timer RAM array entry -> unused */
+       /* 0x30 */ 0xfffffc00, 0xfffffc00, 0xfffffc00, 0xfffffc00,
+       /* 0x34 */ 0xfffffc00, 0xfffffc00, 0xfffffc00, 0xfffffc00,
+       /* 0x38 */ 0xfffffc00, 0xfffffc00, 0xfffffc00, 0xfffffc01,
+
+       /* UPM Exception RAM array entry -> unsused */
+       /* 0x3C */ 0xfffffc00, 0xfffffc00, 0xfffffc00, 0xfffffc01,
+};
+
+/* UPM pattern for bus clock = 83.3 MHz */
+static const u32 upm_patt_83[] = {
+       /* Offset *//* UPM Read Single RAM array entry -> NAND Read Data */
+       /* 0x00 */ 0x0ff33000, 0x0fe33000, 0x0fa33100, 0x0fa33000,
+       /* 0x04 */ 0x0fa33005, 0xfffffc00, 0xfffffc00, 0xfffffc00,
+
+       /* UPM Read Burst RAM array entry -> NAND Write CMD */
+       /* 0x08 */ 0x00ff3e30, 0x00ff3c30, 0x0fff3c30, 0x0fff3c35,
+       /* 0x0C */ 0xfffffc00, 0xfffffc00, 0xfffffc00, 0xfffffc00,
+
+       /* UPM Read Burst RAM array entry -> NAND Write ADDR */
+       /* 0x10 */ 0x00f3fe30, 0x00f3fc30, 0x0ff3fc30, 0x0ff3fc35,
+       /* 0x14 */ 0xfffffc00, 0xfffffc00, 0xfffffc00, 0xfffffc00,
+
+       /* UPM Write Single RAM array entry -> NAND Write Data */
+       /* 0x18 */ 0x00f33e00, 0x00f33c00, 0x0ff33c00, 0x0ff33c05,
+       /* 0x1C */ 0xfffffc00, 0xfffffc00, 0xfffffc00, 0xfffffc00,
+
+       /* UPM Write Burst RAM array entry -> unused */
+       /* 0x20 */ 0xfffffc00, 0xfffffc00, 0xfffffc00, 0xfffffc00,
+       /* 0x24 */ 0xfffffc00, 0xfffffc00, 0xfffffc00, 0xfffffc00,
+       /* 0x28 */ 0xfffffc00, 0xfffffc00, 0xfffffc00, 0xfffffc00,
+       /* 0x2C */ 0xfffffc00, 0xfffffc00, 0xfffffc00, 0xfffffc01,
+
+       /* UPM Refresh Timer RAM array entry -> unused */
+       /* 0x30 */ 0xfffffc00, 0xfffffc00, 0xfffffc00, 0xfffffc00,
+       /* 0x34 */ 0xfffffc00, 0xfffffc00, 0xfffffc00, 0xfffffc00,
+       /* 0x38 */ 0xfffffc00, 0xfffffc00, 0xfffffc00, 0xfffffc01,
+
+       /* UPM Exception RAM array entry -> unsused */
+       /* 0x3C */ 0xfffffc00, 0xfffffc00, 0xfffffc00, 0xfffffc01,
+};
+
+/* UPM pattern for bus clock = 100 MHz */
+static const u32 upm_patt_100[] = {
+       /* Offset *//* UPM Read Single RAM array entry -> NAND Read Data */
+       /* 0x00 */ 0x0ff33100, 0x0fe33000, 0x0fa33200, 0x0fa33000,
+       /* 0x04 */ 0x0fa33005, 0xfffffc00, 0xfffffc00, 0xfffffc00,
+
+       /* UPM Read Burst RAM array entry -> NAND Write CMD */
+       /* 0x08 */ 0x00ff3f30, 0x00ff3c30, 0x0fff3c30, 0x0fff3c35,
+       /* 0x0C */ 0xfffffc00, 0xfffffc00, 0xfffffc00, 0xfffffc00,
+
+       /* UPM Read Burst RAM array entry -> NAND Write ADDR */
+       /* 0x10 */ 0x00f3ff30, 0x00f3fc30, 0x0ff3fc30, 0x0ff3fc35,
+       /* 0x14 */ 0xfffffc00, 0xfffffc00, 0xfffffc00, 0xfffffc00,
+
+       /* UPM Write Single RAM array entry -> NAND Write Data */
+       /* 0x18 */ 0x00f33f00, 0x00f33c00, 0x0ff33c00, 0x0ff33c05,
+       /* 0x1C */ 0xfffffc00, 0xfffffc00, 0xfffffc00, 0xfffffc00,
+
+       /* UPM Write Burst RAM array entry -> unused */
+       /* 0x20 */ 0xfffffc00, 0xfffffc00, 0xfffffc00, 0xfffffc00,
+       /* 0x24 */ 0xfffffc00, 0xfffffc00, 0xfffffc00, 0xfffffc00,
+       /* 0x28 */ 0xfffffc00, 0xfffffc00, 0xfffffc00, 0xfffffc00,
+       /* 0x2C */ 0xfffffc00, 0xfffffc00, 0xfffffc00, 0xfffffc01,
+
+       /* UPM Refresh Timer RAM array entry -> unused */
+       /* 0x30 */ 0xfffffc00, 0xfffffc00, 0xfffffc00, 0xfffffc00,
+       /* 0x34 */ 0xfffffc00, 0xfffffc00, 0xfffffc00, 0xfffffc00,
+       /* 0x38 */ 0xfffffc00, 0xfffffc00, 0xfffffc00, 0xfffffc01,
+
+       /* UPM Exception RAM array entry -> unsused */
+       /* 0x3C */ 0xfffffc00, 0xfffffc00, 0xfffffc00, 0xfffffc01,
+};
+
+/* UPM pattern for bus clock = 133.3 MHz */
+static const u32 upm_patt_133[] = {
+       /* Offset *//* UPM Read Single RAM array entry -> NAND Read Data */
+       /* 0x00 */ 0x0ff33100, 0x0fe33000, 0x0fa33300, 0x0fa33000,
+       /* 0x04 */ 0x0fa33000, 0x0fa33005, 0xfffffc00, 0xfffffc00,
+
+       /* UPM Read Burst RAM array entry -> NAND Write CMD */
+       /* 0x08 */ 0x00ff3f30, 0x00ff3d30, 0x0fff3d30, 0x0fff3c35,
+       /* 0x0C */ 0xfffffc00, 0xfffffc00, 0xfffffc00, 0xfffffc00,
+
+       /* UPM Read Burst RAM array entry -> NAND Write ADDR */
+       /* 0x10 */ 0x00f3ff30, 0x00f3fd30, 0x0ff3fd30, 0x0ff3fc35,
+       /* 0x14 */ 0xfffffc00, 0xfffffc00, 0xfffffc00, 0xfffffc00,
+
+       /* UPM Write Single RAM array entry -> NAND Write Data */
+       /* 0x18 */ 0x00f33f00, 0x00f33d00, 0x0ff33d00, 0x0ff33c05,
+       /* 0x1C */ 0xfffffc00, 0xfffffc00, 0xfffffc00, 0xfffffc00,
+
+       /* UPM Write Burst RAM array entry -> unused */
+       /* 0x20 */ 0xfffffc00, 0xfffffc00, 0xfffffc00, 0xfffffc00,
+       /* 0x24 */ 0xfffffc00, 0xfffffc00, 0xfffffc00, 0xfffffc00,
+       /* 0x28 */ 0xfffffc00, 0xfffffc00, 0xfffffc00, 0xfffffc00,
+       /* 0x2C */ 0xfffffc00, 0xfffffc00, 0xfffffc00, 0xfffffc01,
+
+       /* UPM Refresh Timer RAM array entry -> unused */
+       /* 0x30 */ 0xfffffc00, 0xfffffc00, 0xfffffc00, 0xfffffc00,
+       /* 0x34 */ 0xfffffc00, 0xfffffc00, 0xfffffc00, 0xfffffc00,
+       /* 0x38 */ 0xfffffc00, 0xfffffc00, 0xfffffc00, 0xfffffc01,
+
+       /* UPM Exception RAM array entry -> unsused */
+       /* 0x3C */ 0xfffffc00, 0xfffffc00, 0xfffffc00, 0xfffffc01,
+};
+
+/* UPM pattern for bus clock = 166.7 MHz */
+static const u32 upm_patt_167[] = {
+       /* Offset *//* UPM Read Single RAM array entry -> NAND Read Data */
+       /* 0x00 */ 0x0ff33200, 0x0fe33000, 0x0fa33300, 0x0fa33300,
+       /* 0x04 */ 0x0fa33005, 0xfffffc00, 0xfffffc00, 0xfffffc00,
+
+       /* UPM Read Burst RAM array entry -> NAND Write CMD */
+       /* 0x08 */ 0x00ff3f30, 0x00ff3f30, 0x0fff3e30, 0xffff3c35,
+       /* 0x0C */ 0xfffffc00, 0xfffffc00, 0xfffffc00, 0xfffffc00,
+
+       /* UPM Read Burst RAM array entry -> NAND Write ADDR */
+       /* 0x10 */ 0x00f3ff30, 0x00f3ff30, 0x0ff3fe30, 0x0ff3fc35,
+       /* 0x14 */ 0xfffffc00, 0xfffffc00, 0xfffffc00, 0xfffffc00,
+
+       /* UPM Write Single RAM array entry -> NAND Write Data */
+       /* 0x18 */ 0x00f33f00, 0x00f33f00, 0x0ff33e00, 0x0ff33c05,
+       /* 0x1C */ 0xfffffc00, 0xfffffc00, 0xfffffc00, 0xfffffc00,
+
+       /* UPM Write Burst RAM array entry -> unused */
+       /* 0x20 */ 0xfffffc00, 0xfffffc00, 0xfffffc00, 0xfffffc00,
+       /* 0x24 */ 0xfffffc00, 0xfffffc00, 0xfffffc00, 0xfffffc00,
+       /* 0x28 */ 0xfffffc00, 0xfffffc00, 0xfffffc00, 0xfffffc00,
+       /* 0x2C */ 0xfffffc00, 0xfffffc00, 0xfffffc00, 0xfffffc01,
+
+       /* UPM Refresh Timer RAM array entry -> unused */
+       /* 0x30 */ 0xfffffc00, 0xfffffc00, 0xfffffc00, 0xfffffc00,
+       /* 0x34 */ 0xfffffc00, 0xfffffc00, 0xfffffc00, 0xfffffc00,
+       /* 0x38 */ 0xfffffc00, 0xfffffc00, 0xfffffc00, 0xfffffc01,
+
+       /* UPM Exception RAM array entry -> unsused */
+       /* 0x3C */ 0xfffffc00, 0xfffffc00, 0xfffffc00, 0xfffffc01,
+};
+
+/* Supported UPM timings */
+struct upm_freq upm_freq_table[] = {
+       /* nominal freq. | ptr to table | GPL4 dis. | EHTR  | EAD */
+       {25000000, upm_patt_25, 1, 0, 0},
+       {33333333, upm_patt_33, 1, 0, 0},
+       {41666666, upm_patt_42, 1, 0, 0},
+       {50000000, upm_patt_50, 0, 0, 0},
+       {66666666, upm_patt_67, 0, 0, 0},
+       {83333333, upm_patt_83, 0, 0, 0},
+       {100000000, upm_patt_100, 0, 1, 1},
+       {133333333, upm_patt_133, 0, 1, 1},
+       {166666666, upm_patt_167, 0, 1, 1},
+};
+
+#define UPM_FREQS (sizeof(upm_freq_table) / sizeof(struct upm_freq))
+
+volatile const u32 *nand_upm_patt;
+
+/*
+ * write into UPMB ram
+ */
+static void upmb_write (u_char addr, ulong val)
+{
+       volatile ccsr_lbc_t *lbc = (void *)(CFG_MPC85xx_LBC_ADDR);
+
+       out_be32 (&lbc->mdr, val);
+
+       clrsetbits_be32(&lbc->mbmr, MxMR_MAD_MSK,
+                       MxMR_OP_WARR | (addr & MxMR_MAD_MSK));
+
+       /* dummy access to perform write */
+       out_8 ((void __iomem *)CFG_NAND0_BASE, 0);
+
+       clrbits_be32(&lbc->mbmr, MxMR_OP_WARR);
+}
+
+/*
+ * Initialize UPM for NAND flash access.
+ */
+static void nand_upm_setup (volatile ccsr_lbc_t *lbc)
+{
+       uint i;
+       uint or3 = CFG_OR3_PRELIM;
+       uint clock = get_lbc_clock ();
+
+       out_be32 (&lbc->br3, 0);        /* disable bank and reset all bits */
+       out_be32 (&lbc->br3, CFG_BR3_PRELIM);
+
+       /*
+        * Search appropriate UPM table for bus clock.
+        * If the bus clock exceeds a tolerated value, take the UPM timing for
+        * the next higher supported frequency to ensure that access works
+        * (even the access may be slower then).
+        */
+       for (i = 0; (i < UPM_FREQS) && (clock > upm_freq_table[i].freq); i++)
+               ;
+
+       if (i >= UPM_FREQS)
+       /* no valid entry found */
+               /* take last entry with configuration for max. bus clock */
+               i--;
+
+       if (upm_freq_table[i].ehtr) {
+               /* EHTR must be set due to TQM8548 timing specification */
+               or3 |= OR_UPM_EHTR;
+       }
+       if (upm_freq_table[i].ead)
+               /* EAD must be set due to TQM8548 timing specification */
+               or3 |= OR_UPM_EAD;
+
+       out_be32 (&lbc->or3, or3);
+
+       /* Assign address of table */
+       nand_upm_patt = upm_freq_table[i].upm_patt;
+
+       for (i = 0; i < 64; i++) {
+               upmb_write (i, *nand_upm_patt);
+               nand_upm_patt++;
+       }
+
+       /* Put UPM back to normal operation mode */
+       if (upm_freq_table[i].gpl4_disable)
+               /* GPL4 must be disabled according to timing specification */
+               out_be32 (&lbc->mbmr, MxMR_OP_NORM | MxMR_GPL_x4DIS);
+
+       return;
+}
+
+static struct fsl_upm_nand fun = {
+       .width = 8,
+       .upm_cmd_offset = 0x08,
+       .upm_addr_offset = 0x10,
+       .chip_delay = NAND_BIG_DELAY_US,
+};
+
+void board_nand_select_device (struct nand_chip *nand, int chip)
+{
+}
+
+int board_nand_init (struct nand_chip *nand)
+{
+       volatile ccsr_lbc_t *lbc = (void *)(CFG_MPC85xx_LBC_ADDR);
+
+       if (!nand_upm_patt)
+               nand_upm_setup (lbc);
+
+       fun.upm.io_addr = nand->IO_ADDR_R;
+       fun.upm.mxmr = (void __iomem *)&lbc->mbmr;
+       fun.upm.mdr = (void __iomem *)&lbc->mdr;
+       fun.upm.mar = (void __iomem *)&lbc->mar;
+
+       return fsl_upm_nand_init (nand, &fun);
+}
diff --git a/board/tqc/tqm85xx/sdram.c b/board/tqc/tqm85xx/sdram.c
new file mode 100644 (file)
index 0000000..442ff66
--- /dev/null
@@ -0,0 +1,371 @@
+/*
+ * (C) Copyright 2005
+ * 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 <asm/processor.h>
+#include <asm/immap_85xx.h>
+#include <asm/processor.h>
+#include <asm/mmu.h>
+
+struct sdram_conf_s {
+       unsigned long size;
+       unsigned long reg;
+#ifdef CONFIG_TQM8548
+       unsigned long refresh;
+#endif /* CONFIG_TQM8548 */
+};
+
+typedef struct sdram_conf_s sdram_conf_t;
+
+#ifdef CONFIG_TQM8548
+sdram_conf_t ddr_cs_conf[] = {
+       {(512 << 20), 0x80044102, 0x0001A000},  /* 512MB, 13x10(4)      */
+       {(256 << 20), 0x80040102, 0x00014000},  /* 256MB, 13x10(4)      */
+       {(128 << 20), 0x80040101, 0x0000C000},  /* 128MB, 13x9(4)       */
+};
+#else /* !CONFIG_TQM8548 */
+sdram_conf_t ddr_cs_conf[] = {
+       {(512 << 20), 0x80000202},      /* 512MB, 14x10(4)      */
+       {(256 << 20), 0x80000102},      /* 256MB, 13x10(4)      */
+       {(128 << 20), 0x80000101},      /* 128MB, 13x9(4)       */
+       {( 64 << 20), 0x80000001},      /*  64MB, 12x9(4)       */
+};
+#endif /* CONFIG_TQM8548 */
+
+#define        N_DDR_CS_CONF (sizeof(ddr_cs_conf) / sizeof(ddr_cs_conf[0]))
+
+int cas_latency (void);
+
+/*
+ * Autodetect onboard DDR SDRAM on 85xx platforms
+ *
+ * NOTE: Some of the hardcoded values are hardware dependant,
+ *       so this should be extended for other future boards
+ *       using this routine!
+ */
+long int sdram_setup (int casl)
+{
+       int i;
+       volatile ccsr_ddr_t *ddr = (void *)(CFG_MPC85xx_DDR_ADDR);
+#ifdef CONFIG_TQM8548
+       volatile ccsr_gur_t *gur = (void *)(CFG_MPC85xx_GUTS_ADDR);
+#else /* !CONFIG_TQM8548 */
+       unsigned long cfg_ddr_timing1;
+       unsigned long cfg_ddr_mode;
+#endif /* CONFIG_TQM8548 */
+
+       /*
+        * Disable memory controller.
+        */
+       ddr->cs0_config = 0;
+       ddr->sdram_cfg = 0;
+
+#ifdef CONFIG_TQM8548
+       ddr->cs0_bnds = (ddr_cs_conf[0].size - 1) >> 24;
+       ddr->cs0_config = ddr_cs_conf[0].reg;
+       ddr->timing_cfg_3 = 0x00010000;
+
+       /* TIMING CFG 1, 533MHz
+        * PRETOACT: 4 Clocks
+        * ACTTOPRE: 12 Clocks
+        * ACTTORW:  4 Clocks
+        * CASLAT:   4 Clocks
+        * REFREC:   34 Clocks
+        * WRREC:    4 Clocks
+        * ACTTOACT: 3 Clocks
+        * WRTORD:   2 Clocks
+        */
+       ddr->timing_cfg_1 = 0x4C47A432;
+
+       /* TIMING CFG 2, 533MHz
+        * ADD_LAT:       3 Clocks
+        * CPO:           READLAT + 1
+        * WR_LAT:        3 Clocks
+        * RD_TO_PRE:     2 Clocks
+        * WR_DATA_DELAY: 1/2 Clock
+        * CKE_PLS:       1 Clock
+        * FOUR_ACT:      13 Clocks
+        */
+       ddr->timing_cfg_2 = 0x3318484D;
+
+       /* DDR SDRAM Mode, 533MHz
+        * MRS:          Extended Mode Register
+        * OUT:          Outputs enabled
+        * RDQS:         no
+        * DQS:          enabled
+        * OCD:          default state
+        * RTT:          75 Ohms
+        * Posted CAS:   3 Clocks
+        * ODS:          reduced strength
+        * DLL:          enabled
+        * MR:           Mode Register
+        * PD:           fast exit
+        * WR:           4 Clocks
+        * DLL:          no DLL reset
+        * TM:           normal
+        * CAS latency:  4 Clocks
+        * BT:           sequential
+        * Burst length: 4
+        */
+       ddr->sdram_mode = 0x439E0642;
+
+       /* DDR SDRAM Interval, 533MHz
+        * REFINT:  1040 Clocks
+        * BSTOPRE: 256
+        */
+       ddr->sdram_interval = (1040 << 16) | 0x100;
+
+       /*
+        * workaround for erratum DD10 of MPC8458 family below rev. 2.0:
+        * DDR IO receiver must be set to an acceptable bias point by modifying
+        * a hidden register.
+        */
+       if (SVR_REV (get_svr ()) < 0x20) {
+               gur->ddrioovcr = 0x90000000;    /* enable, VSEL 1.8V */
+       }
+
+       /* DDR SDRAM CFG 2
+        * FRC_SR:      normal mode
+        * SR_IE:       no self-refresh interrupt
+        * DLL_RST_DIS: don't care, leave at reset value
+        * DQS_CFG:     differential DQS signals
+        * ODT_CFG:     assert ODT to internal IOs only during reads to DRAM
+        * LVWx_CFG:    don't care, leave at reset value
+        * NUM_PR:      1 refresh will be issued at a time
+        * DM_CFG:      don't care, leave at reset value
+        * D_INIT:      no data initialization
+        */
+       ddr->sdram_cfg_2 = 0x04401000;
+
+       /* DDR SDRAM MODE 2
+        * MRS: Extended Mode Register 2
+        */
+       ddr->sdram_mode_2 = 0x8000C000;
+
+       /* DDR SDRAM CLK CNTL
+        * CLK_ADJUST: 1/2 Clock 0x02000000
+        * CLK_ADJUST: 5/8 Clock 0x02800000
+        */
+       ddr->sdram_clk_cntl = 0x02800000;
+
+       /* wait for clock stabilization */
+       asm ("sync;isync;msync");
+       udelay(1000);
+
+       /* DDR SDRAM CLK CNTL
+        * MEM_EN:       enabled
+        * SREN:         don't care, leave at reset value
+        * ECC_EN:       no error report
+        * RD_EN:        no register DIMMs
+        * SDRAM_TYPE:   DDR2
+        * DYN_PWR:      no power management
+        * 32_BE:        don't care, leave at reset value
+        * 8_BE:         4 beat burst
+        * NCAP:         don't care, leave at reset value
+        * 2T_EN:        1T Timing
+        * BA_INTLV_CTL: no interleaving
+        * x32_EN:       x16 organization
+        * PCHB8:        MA[10] for auto-precharge
+        * HSE:          half strength for single and 2-layer stacks
+        * (full strength for 3- and 4-layer stacks no yet considered)
+        * MEM_HALT:     no halt
+        * BI:           automatic initialization
+        */
+       ddr->sdram_cfg = 0x83000008;
+       asm ("sync; isync; msync");
+       udelay(1000);
+
+#else /* !CONFIG_TQM8548 */
+       switch (casl) {
+       case 20:
+               cfg_ddr_timing1 = 0x47405331 | (3 << 16);
+               cfg_ddr_mode = 0x40020002 | (2 << 4);
+               break;
+
+       case 25:
+               cfg_ddr_timing1 = 0x47405331 | (4 << 16);
+               cfg_ddr_mode = 0x40020002 | (6 << 4);
+               break;
+
+       case 30:
+       default:
+               cfg_ddr_timing1 = 0x47405331 | (5 << 16);
+               cfg_ddr_mode = 0x40020002 | (3 << 4);
+               break;
+       }
+
+       ddr->cs0_bnds = (ddr_cs_conf[0].size - 1) >> 24;
+       ddr->cs0_config = ddr_cs_conf[0].reg;
+       ddr->timing_cfg_1 = cfg_ddr_timing1;
+       ddr->timing_cfg_2 = 0x00000800;         /* P9-45,may need tuning */
+       ddr->sdram_mode = cfg_ddr_mode;
+       ddr->sdram_interval = 0x05160100;       /* autocharge,no open page */
+       ddr->err_disable = 0x0000000D;
+
+       asm ("sync; isync; msync");
+       udelay (1000);
+
+       ddr->sdram_cfg = 0xc2000000;            /* unbuffered,no DYN_PWR */
+       asm ("sync; isync; msync");
+       udelay (1000);
+#endif /* CONFIG_TQM8548 */
+
+       for (i = 0; i < N_DDR_CS_CONF; i++) {
+               ddr->cs0_config = ddr_cs_conf[i].reg;
+
+               if (get_ram_size (0, ddr_cs_conf[i].size) ==
+                   ddr_cs_conf[i].size) {
+                       /*
+                        * size detected -> set Chip Select Bounds Register
+                        */
+                       ddr->cs0_bnds = (ddr_cs_conf[i].size - 1) >> 24;
+
+                       break;
+               }
+       }
+
+#ifdef CONFIG_TQM8548
+       if (i < N_DDR_CS_CONF) {
+               /* Adjust refresh rate for DDR2 */
+
+               ddr->timing_cfg_3 = ddr_cs_conf[i].refresh & 0x00070000;
+
+               ddr->timing_cfg_1 = (ddr->timing_cfg_1 & 0xFFFF0FFF) |
+                   (ddr_cs_conf[i].refresh & 0x0000F000);
+
+               return ddr_cs_conf[i].size;
+       }
+#endif /* CONFIG_TQM8548 */
+
+       /* return size if detected, else return 0 */
+       return (i < N_DDR_CS_CONF) ? ddr_cs_conf[i].size : 0;
+}
+
+void board_add_ram_info (int use_default)
+{
+       int casl;
+
+       if (use_default)
+               casl = CONFIG_DDR_DEFAULT_CL;
+       else
+               casl = cas_latency ();
+
+       puts (" (CL=");
+       switch (casl) {
+       case 20:
+               puts ("2)");
+               break;
+
+       case 25:
+               puts ("2.5)");
+               break;
+
+       case 30:
+               puts ("3)");
+               break;
+       }
+}
+
+long int initdram (int board_type)
+{
+       long dram_size = 0;
+       int casl;
+
+#if defined(CONFIG_DDR_DLL)
+       /*
+        * This DLL-Override only used on TQM8540 and TQM8560
+        */
+       {
+               volatile ccsr_gur_t *gur = (void *)(CFG_MPC85xx_GUTS_ADDR);
+               int i, x;
+
+               x = 10;
+
+               /*
+                * Work around to stabilize DDR DLL
+                */
+               gur->ddrdllcr = 0x81000000;
+               asm ("sync; isync; msync");
+               udelay (200);
+               while (gur->ddrdllcr != 0x81000100) {
+                       gur->devdisr = gur->devdisr | 0x00010000;
+                       asm ("sync; isync; msync");
+                       for (i = 0; i < x; i++)
+                               ;
+                       gur->devdisr = gur->devdisr & 0xfff7ffff;
+                       asm ("sync; isync; msync");
+                       x++;
+               }
+       }
+#endif
+
+       casl = cas_latency ();
+       dram_size = sdram_setup (casl);
+       if ((dram_size == 0) && (casl != CONFIG_DDR_DEFAULT_CL)) {
+               /*
+                * Try again with default CAS latency
+                */
+               puts ("Problem with CAS lantency");
+               board_add_ram_info (1);
+               puts (", using default CL!\n");
+               casl = CONFIG_DDR_DEFAULT_CL;
+               dram_size = sdram_setup (casl);
+               puts ("       ");
+       }
+
+       return dram_size;
+}
+
+#if defined(CFG_DRAM_TEST)
+int testdram (void)
+{
+       uint *pstart = (uint *) CFG_MEMTEST_START;
+       uint *pend = (uint *) CFG_MEMTEST_END;
+       uint *p;
+
+       printf ("SDRAM test phase 1:\n");
+       for (p = pstart; p < pend; p++)
+               *p = 0xaaaaaaaa;
+
+       for (p = pstart; p < pend; p++) {
+               if (*p != 0xaaaaaaaa) {
+                       printf ("SDRAM test fails at: %08x\n", (uint) p);
+                       return 1;
+               }
+       }
+
+       printf ("SDRAM test phase 2:\n");
+       for (p = pstart; p < pend; p++)
+               *p = 0x55555555;
+
+       for (p = pstart; p < pend; p++) {
+               if (*p != 0x55555555) {
+                       printf ("SDRAM test fails at: %08x\n", (uint) p);
+                       return 1;
+               }
+       }
+
+       printf ("SDRAM test passed.\n");
+       return 0;
+}
+#endif
diff --git a/board/tqc/tqm85xx/tlb.c b/board/tqc/tqm85xx/tlb.c
new file mode 100644 (file)
index 0000000..380448a
--- /dev/null
@@ -0,0 +1,248 @@
+/*
+ * Copyright 2008 Freescale Semiconductor, Inc.
+ *
+ * (C) Copyright 2000
+ * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+#include <common.h>
+#include <asm/mmu.h>
+
+struct fsl_e_tlb_entry tlb_table[] = {
+       /* TLB 0 - for temp stack in cache */
+       SET_TLB_ENTRY (0, CFG_INIT_RAM_ADDR, CFG_INIT_RAM_ADDR,
+                      MAS3_SX | MAS3_SW | MAS3_SR, 0,
+                      0, 0, BOOKE_PAGESZ_4K, 0),
+       SET_TLB_ENTRY (0, CFG_INIT_RAM_ADDR + 4 * 1024,
+                      CFG_INIT_RAM_ADDR + 4 * 1024,
+                      MAS3_SX | MAS3_SW | MAS3_SR, 0,
+                      0, 0, BOOKE_PAGESZ_4K, 0),
+       SET_TLB_ENTRY (0, CFG_INIT_RAM_ADDR + 8 * 1024,
+                      CFG_INIT_RAM_ADDR + 8 * 1024,
+                      MAS3_SX | MAS3_SW | MAS3_SR, 0,
+                      0, 0, BOOKE_PAGESZ_4K, 0),
+       SET_TLB_ENTRY (0, CFG_INIT_RAM_ADDR + 12 * 1024,
+                      CFG_INIT_RAM_ADDR + 12 * 1024,
+                      MAS3_SX | MAS3_SW | MAS3_SR, 0,
+                      0, 0, BOOKE_PAGESZ_4K, 0),
+
+#ifndef CONFIG_TQM_BIGFLASH
+       /*
+        * TLB 0, 1:    128M    Non-cacheable, guarded
+        * 0xf8000000   128M    FLASH
+        * Out of reset this entry is only 4K.
+        */
+       SET_TLB_ENTRY (1, CFG_FLASH_BASE, CFG_FLASH_BASE,
+                      MAS3_SX | MAS3_SW | MAS3_SR, MAS2_I | MAS2_G,
+                      0, 1, BOOKE_PAGESZ_64M, 1),
+       SET_TLB_ENTRY (1, CFG_FLASH_BASE + 0x4000000,
+                      CFG_FLASH_BASE + 0x4000000,
+                      MAS3_SX | MAS3_SW | MAS3_SR, MAS2_I | MAS2_G,
+                      0, 0, BOOKE_PAGESZ_64M, 1),
+
+       /*
+        * TLB 2:       256M    Non-cacheable, guarded
+        * 0x80000000   256M    PCI1 MEM First half
+        */
+       SET_TLB_ENTRY (1, CFG_PCI1_MEM_PHYS, CFG_PCI1_MEM_PHYS,
+                      MAS3_SX | MAS3_SW | MAS3_SR, MAS2_I | MAS2_G,
+                      0, 2, BOOKE_PAGESZ_256M, 1),
+
+       /*
+        * TLB 3:       256M    Non-cacheable, guarded
+        * 0x90000000   256M    PCI1 MEM Second half
+        */
+       SET_TLB_ENTRY (1, CFG_PCI1_MEM_PHYS + 0x10000000,
+                      CFG_PCI1_MEM_PHYS + 0x10000000,
+                      MAS3_SX | MAS3_SW | MAS3_SR, MAS2_I | MAS2_G,
+                      0, 3, BOOKE_PAGESZ_256M, 1),
+
+#ifdef CONFIG_PCIE1
+       /*
+        * TLB 4:       256M    Non-cacheable, guarded
+        * 0xc0000000   256M    PCI express MEM First half
+        */
+       SET_TLB_ENTRY (1, CFG_PCIE1_MEM_BASE, CFG_PCIE1_MEM_BASE,
+                      MAS3_SX | MAS3_SW | MAS3_SR, MAS2_I | MAS2_G,
+                      0, 4, BOOKE_PAGESZ_256M, 1),
+
+       /*
+        * TLB 5:       256M    Non-cacheable, guarded
+        * 0xd0000000   256M    PCI express MEM Second half
+        */
+       SET_TLB_ENTRY (1, CFG_PCIE1_MEM_BASE + 0x10000000,
+                      CFG_PCIE1_MEM_BASE + 0x10000000,
+                      MAS3_SX | MAS3_SW | MAS3_SR, MAS2_I | MAS2_G,
+                      0, 5, BOOKE_PAGESZ_256M, 1),
+#else /* !CONFIG_PCIE */
+       /*
+        * TLB 4:       256M    Non-cacheable, guarded
+        * 0xc0000000   256M    Rapid IO MEM First half
+        */
+       SET_TLB_ENTRY (1, CFG_RIO_MEM_BASE, CFG_RIO_MEM_BASE,
+                      MAS3_SX | MAS3_SW | MAS3_SR, MAS2_I | MAS2_G,
+                      0, 4, BOOKE_PAGESZ_256M, 1),
+
+       /*
+        * TLB 5:       256M    Non-cacheable, guarded
+        * 0xd0000000   256M    Rapid IO MEM Second half
+        */
+       SET_TLB_ENTRY (1, CFG_RIO_MEM_BASE + 0x10000000,
+                      CFG_RIO_MEM_BASE + 0x10000000,
+                      MAS3_SX | MAS3_SW | MAS3_SR, MAS2_I | MAS2_G,
+                      0, 5, BOOKE_PAGESZ_256M, 1),
+#endif /* CONFIG_PCIE */
+
+       /*
+        * TLB 6:        64M    Non-cacheable, guarded
+        * 0xe0000000     1M    CCSRBAR
+        * 0xe2000000    16M    PCI1 IO
+        * 0xe3000000    16M    CAN and NAND Flash
+        */
+       SET_TLB_ENTRY (1, CFG_CCSRBAR, CFG_CCSRBAR_PHYS,
+                      MAS3_SX | MAS3_SW | MAS3_SR, MAS2_I | MAS2_G,
+                      0, 6, BOOKE_PAGESZ_64M, 1),
+
+       /*
+        * TLB 7+8:     512M     DDR, cache disabled (needed for memory test)
+        * 0x00000000   512M     DDR System memory
+        * Without SPD EEPROM configured DDR, this must be setup manually.
+        * Make sure the TLB count at the top of this table is correct.
+        * Likely it needs to be increased by two for these entries.
+        */
+       SET_TLB_ENTRY (1, CFG_DDR_SDRAM_BASE, CFG_DDR_SDRAM_BASE,
+                      MAS3_SX | MAS3_SW | MAS3_SR, MAS2_I | MAS2_G,
+                      0, 7, BOOKE_PAGESZ_256M, 1),
+
+       SET_TLB_ENTRY (1, CFG_DDR_SDRAM_BASE + 0x10000000,
+                      CFG_DDR_SDRAM_BASE + 0x10000000,
+                      MAS3_SX | MAS3_SW | MAS3_SR, MAS2_I | MAS2_G,
+                      0, 8, BOOKE_PAGESZ_256M, 1),
+
+#ifdef CONFIG_PCIE1
+       /*
+        * TLB 9:        16M    Non-cacheable, guarded
+        * 0xef000000    16M    PCI express IO
+        */
+       SET_TLB_ENTRY (1, CFG_PCIE1_IO_BASE, CFG_PCIE1_IO_BASE,
+                      MAS3_SX | MAS3_SW | MAS3_SR, MAS2_I | MAS2_G,
+                      0, 9, BOOKE_PAGESZ_16M, 1),
+#endif /* CONFIG_PCIE */
+
+#else /* CONFIG_TQM_BIGFLASH */
+
+       /*
+        * TLB 0,1,2,3:   1G    Non-cacheable, guarded
+        * 0xc0000000     1G    FLASH
+        * Out of reset this entry is only 4K.
+        */
+       SET_TLB_ENTRY (1, CFG_FLASH_BASE, CFG_FLASH_BASE,
+                      MAS3_SX | MAS3_SW | MAS3_SR, MAS2_I | MAS2_G,
+                      0, 3, BOOKE_PAGESZ_256M, 1),
+       SET_TLB_ENTRY (1, CFG_FLASH_BASE + 0x10000000,
+                      CFG_FLASH_BASE + 0x10000000,
+                      MAS3_SX | MAS3_SW | MAS3_SR, MAS2_I | MAS2_G,
+                      0, 2, BOOKE_PAGESZ_256M, 1),
+       SET_TLB_ENTRY (1, CFG_FLASH_BASE + 0x20000000,
+                      CFG_FLASH_BASE + 0x20000000,
+                      MAS3_SX | MAS3_SW | MAS3_SR, MAS2_I | MAS2_G,
+                      0, 1, BOOKE_PAGESZ_256M, 1),
+       SET_TLB_ENTRY (1, CFG_FLASH_BASE + 0x30000000,
+                      CFG_FLASH_BASE + 0x30000000,
+                      MAS3_SX | MAS3_SW | MAS3_SR, MAS2_I | MAS2_G,
+                      0, 0, BOOKE_PAGESZ_256M, 1),
+
+       /*
+        * TLB 4:       256M    Non-cacheable, guarded
+        * 0x80000000   256M    PCI1 MEM First half
+        */
+       SET_TLB_ENTRY (1, CFG_PCI1_MEM_PHYS, CFG_PCI1_MEM_PHYS,
+                      MAS3_SX | MAS3_SW | MAS3_SR, MAS2_I | MAS2_G,
+                      0, 4, BOOKE_PAGESZ_256M, 1),
+
+       /*
+        * TLB 5:       256M    Non-cacheable, guarded
+        * 0x90000000   256M    PCI1 MEM Second half
+        */
+       SET_TLB_ENTRY (1, CFG_PCI1_MEM_PHYS + 0x10000000,
+                      CFG_PCI1_MEM_PHYS + 0x10000000,
+                      MAS3_SX | MAS3_SW | MAS3_SR, MAS2_I | MAS2_G,
+                      0, 5, BOOKE_PAGESZ_256M, 1),
+
+#ifdef CONFIG_PCIE1
+       /*
+        * TLB 6:       256M    Non-cacheable, guarded
+        * 0xc0000000   256M    PCI express MEM First half
+        */
+       SET_TLB_ENTRY (1, CFG_PCIE1_MEM_BASE, CFG_PCIE1_MEM_BASE,
+                      MAS3_SX | MAS3_SW | MAS3_SR, MAS2_I | MAS2_G,
+                      0, 6, BOOKE_PAGESZ_256M, 1),
+#else /* !CONFIG_PCIE */
+       /*
+        * TLB 6:       256M    Non-cacheable, guarded
+        * 0xb0000000   256M    Rapid IO MEM First half
+        */
+       SET_TLB_ENTRY (1, CFG_RIO_MEM_BASE, CFG_RIO_MEM_BASE,
+                      MAS3_SX | MAS3_SW | MAS3_SR, MAS2_I | MAS2_G,
+                      0, 6, BOOKE_PAGESZ_256M, 1),
+
+#endif /* CONFIG_PCIE */
+
+       /*
+        * TLB 7:        64M    Non-cacheable, guarded
+        * 0xa0000000     1M    CCSRBAR
+        * 0xa2000000    16M    PCI1 IO
+        * 0xa3000000    16M    CAN and NAND Flash
+        */
+       SET_TLB_ENTRY (1, CFG_CCSRBAR, CFG_CCSRBAR_PHYS,
+                      MAS3_SX | MAS3_SW | MAS3_SR, MAS2_I | MAS2_G,
+                      0, 7, BOOKE_PAGESZ_64M, 1),
+
+       /*
+        * TLB 8+9:     512M     DDR, cache disabled (needed for memory test)
+        * 0x00000000   512M     DDR System memory
+        * Without SPD EEPROM configured DDR, this must be setup manually.
+        * Make sure the TLB count at the top of this table is correct.
+        * Likely it needs to be increased by two for these entries.
+        */
+       SET_TLB_ENTRY (1, CFG_DDR_SDRAM_BASE, CFG_DDR_SDRAM_BASE,
+                      MAS3_SX | MAS3_SW | MAS3_SR, MAS2_I | MAS2_G,
+                      0, 8, BOOKE_PAGESZ_256M, 1),
+
+       SET_TLB_ENTRY (1, CFG_DDR_SDRAM_BASE + 0x10000000,
+                      CFG_DDR_SDRAM_BASE + 0x10000000,
+                      MAS3_SX | MAS3_SW | MAS3_SR, MAS2_I | MAS2_G,
+                      0, 9, BOOKE_PAGESZ_256M, 1),
+
+#ifdef CONFIG_PCIE1
+       /*
+        * TLB 10:       16M    Non-cacheable, guarded
+        * 0xaf000000    16M    PCI express IO
+        */
+       SET_TLB_ENTRY (1, CFG_PCIE1_IO_BASE, CFG_PCIE1_IO_BASE,
+                      MAS3_SX | MAS3_SW | MAS3_SR, MAS2_I | MAS2_G,
+                      0, 10, BOOKE_PAGESZ_16M, 1),
+#endif /* CONFIG_PCIE */
+
+#endif /* CONFIG_TQM_BIGFLASH */
+};
+
+int num_tlb_entries = ARRAY_SIZE (tlb_table);
diff --git a/board/tqc/tqm85xx/tqm85xx.c b/board/tqc/tqm85xx/tqm85xx.c
new file mode 100644 (file)
index 0000000..f1c2e58
--- /dev/null
@@ -0,0 +1,744 @@
+/*
+ * (C) Copyright 2008 Wolfgang Grandegger <wg@denx.de>
+ *
+ * (C) Copyright 2006
+ * Thomas Waehner, TQ-Systems GmbH, thomas.waehner@tqs.de.
+ *
+ * (C) Copyright 2005
+ * Stefan Roese, DENX Software Engineering, sr@denx.de.
+ *
+ * Copyright 2004 Freescale Semiconductor.
+ * (C) Copyright 2002,2003, Motorola Inc.
+ * Xianghua Xiao, (X.Xiao@motorola.com)
+ *
+ * (C) Copyright 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 <common.h>
+#include <pci.h>
+#include <asm/processor.h>
+#include <asm/immap_85xx.h>
+#include <asm/immap_fsl_pci.h>
+#include <asm/io.h>
+#include <ioports.h>
+#include <flash.h>
+#include <libfdt.h>
+#include <fdt_support.h>
+
+DECLARE_GLOBAL_DATA_PTR;
+
+extern flash_info_t flash_info[];      /* FLASH chips info */
+
+void local_bus_init (void);
+ulong flash_get_size (ulong base, int banknum);
+
+#ifdef CONFIG_PS2MULT
+void ps2mult_early_init (void);
+#endif
+
+#ifdef CONFIG_CPM2
+/*
+ * I/O Port configuration table
+ *
+ * if conf is 1, then that port pin will be configured at boot time
+ * according to the five values podr/pdir/ppar/psor/pdat for that entry
+ */
+
+const iop_conf_t iop_conf_tab[4][32] = {
+
+       /* Port A: conf, ppar, psor, pdir, podr, pdat */
+       {
+        {1, 1, 1, 0, 0, 0},    /* PA31: FCC1 MII COL */
+        {1, 1, 1, 0, 0, 0},    /* PA30: FCC1 MII CRS */
+        {1, 1, 1, 1, 0, 0},    /* PA29: FCC1 MII TX_ER */
+        {1, 1, 1, 1, 0, 0},    /* PA28: FCC1 MII TX_EN */
+        {1, 1, 1, 0, 0, 0},    /* PA27: FCC1 MII RX_DV */
+        {1, 1, 1, 0, 0, 0},    /* PA26: FCC1 MII RX_ER */
+        {0, 1, 0, 1, 0, 0},    /* PA25: FCC1 ATMTXD[0] */
+        {0, 1, 0, 1, 0, 0},    /* PA24: FCC1 ATMTXD[1] */
+        {0, 1, 0, 1, 0, 0},    /* PA23: FCC1 ATMTXD[2] */
+        {0, 1, 0, 1, 0, 0},    /* PA22: FCC1 ATMTXD[3] */
+        {1, 1, 0, 1, 0, 0},    /* PA21: FCC1 MII TxD[3] */
+        {1, 1, 0, 1, 0, 0},    /* PA20: FCC1 MII TxD[2] */
+        {1, 1, 0, 1, 0, 0},    /* PA19: FCC1 MII TxD[1] */
+        {1, 1, 0, 1, 0, 0},    /* PA18: FCC1 MII TxD[0] */
+        {1, 1, 0, 0, 0, 0},    /* PA17: FCC1 MII RxD[0] */
+        {1, 1, 0, 0, 0, 0},    /* PA16: FCC1 MII RxD[1] */
+        {1, 1, 0, 0, 0, 0},    /* PA15: FCC1 MII RxD[2] */
+        {1, 1, 0, 0, 0, 0},    /* PA14: FCC1 MII RxD[3] */
+        {0, 1, 0, 0, 0, 0},    /* PA13: FCC1 ATMRXD[3] */
+        {0, 1, 0, 0, 0, 0},    /* PA12: FCC1 ATMRXD[2] */
+        {0, 1, 0, 0, 0, 0},    /* PA11: FCC1 ATMRXD[1] */
+        {0, 1, 0, 0, 0, 0},    /* PA10: FCC1 ATMRXD[0] */
+        {0, 1, 1, 1, 0, 0},    /* PA9 : FCC1 L1TXD */
+        {0, 1, 1, 0, 0, 0},    /* PA8 : FCC1 L1RXD */
+        {0, 0, 0, 1, 0, 0},    /* PA7 : PA7 */
+        {0, 1, 1, 1, 0, 0},    /* PA6 : TDM A1 L1RSYNC */
+        {0, 0, 0, 1, 0, 0},    /* PA5 : PA5 */
+        {0, 0, 0, 1, 0, 0},    /* PA4 : PA4 */
+        {0, 0, 0, 1, 0, 0},    /* PA3 : PA3 */
+        {0, 0, 0, 1, 0, 0},    /* PA2 : PA2 */
+        {0, 0, 0, 0, 0, 0},    /* PA1 : FREERUN */
+        {0, 0, 0, 1, 0, 0}     /* PA0 : PA0 */
+        },
+
+       /* Port B: conf, ppar, psor, pdir, podr, pdat */
+       {
+        {1, 1, 0, 1, 0, 0},    /* PB31: FCC2 MII TX_ER */
+        {1, 1, 0, 0, 0, 0},    /* PB30: FCC2 MII RX_DV */
+        {1, 1, 1, 1, 0, 0},    /* PB29: FCC2 MII TX_EN */
+        {1, 1, 0, 0, 0, 0},    /* PB28: FCC2 MII RX_ER */
+        {1, 1, 0, 0, 0, 0},    /* PB27: FCC2 MII COL */
+        {1, 1, 0, 0, 0, 0},    /* PB26: FCC2 MII CRS */
+        {1, 1, 0, 1, 0, 0},    /* PB25: FCC2 MII TxD[3] */
+        {1, 1, 0, 1, 0, 0},    /* PB24: FCC2 MII TxD[2] */
+        {1, 1, 0, 1, 0, 0},    /* PB23: FCC2 MII TxD[1] */
+        {1, 1, 0, 1, 0, 0},    /* PB22: FCC2 MII TxD[0] */
+        {1, 1, 0, 0, 0, 0},    /* PB21: FCC2 MII RxD[0] */
+        {1, 1, 0, 0, 0, 0},    /* PB20: FCC2 MII RxD[1] */
+        {1, 1, 0, 0, 0, 0},    /* PB19: FCC2 MII RxD[2] */
+        {1, 1, 0, 0, 0, 0},    /* PB18: FCC2 MII RxD[3] */
+        {1, 1, 0, 0, 0, 0},    /* PB17: FCC3:RX_DIV */
+        {1, 1, 0, 0, 0, 0},    /* PB16: FCC3:RX_ERR */
+        {1, 1, 0, 1, 0, 0},    /* PB15: FCC3:TX_ERR */
+        {1, 1, 0, 1, 0, 0},    /* PB14: FCC3:TX_EN */
+        {1, 1, 0, 0, 0, 0},    /* PB13: FCC3:COL */
+        {1, 1, 0, 0, 0, 0},    /* PB12: FCC3:CRS */
+        {1, 1, 0, 0, 0, 0},    /* PB11: FCC3:RXD */
+        {1, 1, 0, 0, 0, 0},    /* PB10: FCC3:RXD */
+        {1, 1, 0, 0, 0, 0},    /* PB9 : FCC3:RXD */
+        {1, 1, 0, 0, 0, 0},    /* PB8 : FCC3:RXD */
+        {1, 1, 0, 1, 0, 0},    /* PB7 : FCC3:TXD */
+        {1, 1, 0, 1, 0, 0},    /* PB6 : FCC3:TXD */
+        {1, 1, 0, 1, 0, 0},    /* PB5 : FCC3:TXD */
+        {1, 1, 0, 1, 0, 0},    /* PB4 : FCC3:TXD */
+        {0, 0, 0, 0, 0, 0},    /* PB3 : pin doesn't exist */
+        {0, 0, 0, 0, 0, 0},    /* PB2 : pin doesn't exist */
+        {0, 0, 0, 0, 0, 0},    /* PB1 : pin doesn't exist */
+        {0, 0, 0, 0, 0, 0}     /* PB0 : pin doesn't exist */
+        },
+
+       /* Port C: conf, ppar, psor, pdir, podr, pdat */
+       {
+        {0, 0, 0, 1, 0, 0},    /* PC31: PC31 */
+        {0, 0, 0, 1, 0, 0},    /* PC30: PC30 */
+        {0, 1, 1, 0, 0, 0},    /* PC29: SCC1 EN *CLSN */
+        {0, 0, 0, 1, 0, 0},    /* PC28: PC28 */
+        {0, 0, 0, 1, 0, 0},    /* PC27: UART Clock in */
+        {0, 0, 0, 1, 0, 0},    /* PC26: PC26 */
+        {0, 0, 0, 1, 0, 0},    /* PC25: PC25 */
+        {0, 0, 0, 1, 0, 0},    /* PC24: PC24 */
+        {0, 1, 0, 1, 0, 0},    /* PC23: ATMTFCLK */
+        {0, 1, 0, 0, 0, 0},    /* PC22: ATMRFCLK */
+        {1, 1, 0, 0, 0, 0},    /* PC21: SCC1 EN RXCLK */
+        {1, 1, 0, 0, 0, 0},    /* PC20: SCC1 EN TXCLK */
+        {1, 1, 0, 0, 0, 0},    /* PC19: FCC2 MII RX_CLK CLK13 */
+        {1, 1, 0, 0, 0, 0},    /* PC18: FCC Tx Clock (CLK14) */
+        {1, 1, 0, 0, 0, 0},    /* PC17: PC17 */
+        {1, 1, 0, 0, 0, 0},    /* PC16: FCC Tx Clock (CLK16) */
+        {0, 1, 0, 0, 0, 0},    /* PC15: PC15 */
+        {0, 1, 0, 0, 0, 0},    /* PC14: SCC1 EN *CD */
+        {0, 1, 0, 0, 0, 0},    /* PC13: PC13 */
+        {0, 1, 0, 1, 0, 0},    /* PC12: PC12 */
+        {0, 0, 0, 1, 0, 0},    /* PC11: LXT971 transmit control */
+        {0, 0, 0, 1, 0, 0},    /* PC10: FETHMDC */
+        {0, 0, 0, 0, 0, 0},    /* PC9 : FETHMDIO */
+        {0, 0, 0, 1, 0, 0},    /* PC8 : PC8 */
+        {0, 0, 0, 1, 0, 0},    /* PC7 : PC7 */
+        {0, 0, 0, 1, 0, 0},    /* PC6 : PC6 */
+        {0, 0, 0, 1, 0, 0},    /* PC5 : PC5 */
+        {0, 0, 0, 1, 0, 0},    /* PC4 : PC4 */
+        {0, 0, 0, 1, 0, 0},    /* PC3 : PC3 */
+        {0, 0, 0, 1, 0, 1},    /* PC2 : ENET FDE */
+        {0, 0, 0, 1, 0, 0},    /* PC1 : ENET DSQE */
+        {0, 0, 0, 1, 0, 0},    /* PC0 : ENET LBK */
+        },
+
+       /* Port D: conf, ppar, psor, pdir, podr, pdat */
+       {
+#ifdef CONFIG_TQM8560
+        {1, 1, 0, 0, 0, 0},    /* PD31: SCC1 EN RxD */
+        {1, 1, 1, 1, 0, 0},    /* PD30: SCC1 EN TxD */
+        {1, 1, 0, 1, 0, 0},    /* PD29: SCC1 EN TENA */
+#else /* !CONFIG_TQM8560 */
+        {0, 0, 0, 0, 0, 0},    /* PD31: PD31 */
+        {0, 0, 0, 0, 0, 0},    /* PD30: PD30 */
+        {0, 0, 0, 0, 0, 0},    /* PD29: PD29 */
+#endif /* CONFIG_TQM8560 */
+        {1, 1, 0, 0, 0, 0},    /* PD28: PD28 */
+        {1, 1, 0, 1, 0, 0},    /* PD27: PD27 */
+        {1, 1, 0, 1, 0, 0},    /* PD26: PD26 */
+        {0, 0, 0, 1, 0, 0},    /* PD25: PD25 */
+        {0, 0, 0, 1, 0, 0},    /* PD24: PD24 */
+        {0, 0, 0, 1, 0, 0},    /* PD23: PD23 */
+        {0, 0, 0, 1, 0, 0},    /* PD22: PD22 */
+        {0, 0, 0, 1, 0, 0},    /* PD21: PD21 */
+        {0, 0, 0, 1, 0, 0},    /* PD20: PD20 */
+        {0, 0, 0, 1, 0, 0},    /* PD19: PD19 */
+        {0, 0, 0, 1, 0, 0},    /* PD18: PD18 */
+        {0, 1, 0, 0, 0, 0},    /* PD17: FCC1 ATMRXPRTY */
+        {0, 1, 0, 1, 0, 0},    /* PD16: FCC1 ATMTXPRTY */
+        {0, 1, 1, 0, 1, 0},    /* PD15: I2C SDA */
+        {0, 0, 0, 1, 0, 0},    /* PD14: LED */
+        {0, 0, 0, 0, 0, 0},    /* PD13: PD13 */
+        {0, 0, 0, 0, 0, 0},    /* PD12: PD12 */
+        {0, 0, 0, 0, 0, 0},    /* PD11: PD11 */
+        {0, 0, 0, 0, 0, 0},    /* PD10: PD10 */
+        {0, 1, 0, 1, 0, 0},    /* PD9 : SMC1 TXD */
+        {0, 1, 0, 0, 0, 0},    /* PD8 : SMC1 RXD */
+        {0, 0, 0, 1, 0, 1},    /* PD7 : PD7 */
+        {0, 0, 0, 1, 0, 1},    /* PD6 : PD6 */
+        {0, 0, 0, 1, 0, 1},    /* PD5 : PD5 */
+        {0, 0, 0, 1, 0, 1},    /* PD4 : PD4 */
+        {0, 0, 0, 0, 0, 0},    /* PD3 : pin doesn't exist */
+        {0, 0, 0, 0, 0, 0},    /* PD2 : pin doesn't exist */
+        {0, 0, 0, 0, 0, 0},    /* PD1 : pin doesn't exist */
+        {0, 0, 0, 0, 0, 0}     /* PD0 : pin doesn't exist */
+        }
+};
+#endif /*  CONFIG_CPM2 */
+
+#define CASL_STRING1   "casl=xx"
+#define CASL_STRING2   "casl="
+
+static const int casl_table[] = { 20, 25, 30 };
+#define        N_CASL (sizeof(casl_table) / sizeof(casl_table[0]))
+
+int cas_latency (void)
+{
+       char *s = getenv ("serial#");
+       int casl;
+       int val;
+       int i;
+
+       casl = CONFIG_DDR_DEFAULT_CL;
+
+       if (s != NULL) {
+               if (strncmp(s + strlen (s) - strlen (CASL_STRING1),
+                           CASL_STRING2, strlen (CASL_STRING2)) == 0) {
+                       val = simple_strtoul (s + strlen (s) - 2, NULL, 10);
+
+                       for (i = 0; i < N_CASL; ++i) {
+                               if (val == casl_table[i]) {
+                                       return val;
+                               }
+                       }
+               }
+       }
+
+       return casl;
+}
+
+int checkboard (void)
+{
+       char *s = getenv ("serial#");
+
+       printf ("Board: %s", CONFIG_BOARDNAME);
+       if (s != NULL) {
+               puts (", serial# ");
+               puts (s);
+       }
+       putc ('\n');
+
+       /*
+        * Initialize local bus.
+        */
+       local_bus_init ();
+
+       return 0;
+}
+
+int misc_init_r (void)
+{
+       volatile ccsr_lbc_t *memctl = (void *)(CFG_MPC85xx_LBC_ADDR);
+
+       /*
+        * Adjust flash start and offset to detected values
+        */
+       gd->bd->bi_flashstart = 0 - gd->bd->bi_flashsize;
+       gd->bd->bi_flashoffset = 0;
+
+       /*
+        * Recalculate CS configuration if second FLASH bank is available
+        */
+       if (flash_info[0].size > 0) {
+               memctl->or1 = ((-flash_info[0].size) & 0xffff8000) |
+                       (CFG_OR1_PRELIM & 0x00007fff);
+               memctl->br1 = gd->bd->bi_flashstart |
+                       (CFG_BR1_PRELIM & 0x00007fff);
+               /*
+                * Re-check to get correct base address for bank 1
+                */
+               flash_get_size (gd->bd->bi_flashstart, 0);
+       } else {
+               memctl->or1 = 0;
+               memctl->br1 = 0;
+       }
+
+       /*
+        *  If bank 1 is equipped, bank 0 is mapped after bank 1
+        */
+       memctl->or0 = ((-flash_info[1].size) & 0xffff8000) |
+               (CFG_OR0_PRELIM & 0x00007fff);
+       memctl->br0 = (gd->bd->bi_flashstart + flash_info[0].size) |
+               (CFG_BR0_PRELIM & 0x00007fff);
+       /*
+        * Re-check to get correct base address for bank 0
+        */
+       flash_get_size (gd->bd->bi_flashstart + flash_info[0].size, 1);
+
+       /*
+        * Re-do flash protection upon new addresses
+        */
+       flash_protect (FLAG_PROTECT_CLEAR,
+                      gd->bd->bi_flashstart, 0xffffffff,
+                      &flash_info[CFG_MAX_FLASH_BANKS - 1]);
+
+       /* Monitor protection ON by default */
+       flash_protect (FLAG_PROTECT_SET,
+                      CFG_MONITOR_BASE,
+                      CFG_MONITOR_BASE + monitor_flash_len - 1,
+                      &flash_info[CFG_MAX_FLASH_BANKS - 1]);
+
+       /* Environment protection ON by default */
+       flash_protect (FLAG_PROTECT_SET,
+                      CFG_ENV_ADDR,
+                      CFG_ENV_ADDR + CFG_ENV_SECT_SIZE - 1,
+                      &flash_info[CFG_MAX_FLASH_BANKS - 1]);
+
+#ifdef CFG_ENV_ADDR_REDUND
+       /* Redundant environment protection ON by default */
+       flash_protect (FLAG_PROTECT_SET,
+                      CFG_ENV_ADDR_REDUND,
+                      CFG_ENV_ADDR_REDUND + CFG_ENV_SIZE_REDUND - 1,
+                      &flash_info[CFG_MAX_FLASH_BANKS - 1]);
+#endif
+
+       return 0;
+}
+
+#ifdef CONFIG_CAN_DRIVER
+/*
+ * Initialize UPMC RAM
+ */
+static void upmc_write (u_char addr, uint val)
+{
+       volatile ccsr_lbc_t *lbc = (void *)(CFG_MPC85xx_LBC_ADDR);
+
+       out_be32 (&lbc->mdr, val);
+
+       clrsetbits_be32(&lbc->mcmr, MxMR_MAD_MSK,
+                       MxMR_OP_WARR | (addr & MxMR_MAD_MSK));
+
+       /* dummy access to perform write */
+       out_8 ((void __iomem *)CFG_CAN_BASE, 0);
+
+       /* normal operation */
+       clrbits_be32(&lbc->mcmr, MxMR_OP_WARR);
+}
+#endif /* CONFIG_CAN_DRIVER */
+
+uint get_lbc_clock (void)
+{
+       volatile ccsr_lbc_t *lbc = (void *)(CFG_MPC85xx_LBC_ADDR);
+       sys_info_t sys_info;
+       ulong clkdiv = lbc->lcrr & 0x0f;
+
+       get_sys_info (&sys_info);
+
+       if (clkdiv == 2 || clkdiv == 4 || clkdiv == 8) {
+#ifdef CONFIG_MPC8548
+               /*
+                * Yes, the entire PQ38 family use the same
+                * bit-representation for twice the clock divider value.
+                */
+               clkdiv *= 2;
+#endif
+               return sys_info.freqSystemBus / clkdiv;
+       }
+
+       puts("Invalid clock divider value in CFG_LBC_LCRR\n");
+
+       return 0;
+}
+
+/*
+ * Initialize Local Bus
+ */
+void local_bus_init (void)
+{
+       volatile ccsr_gur_t *gur = (void *)(CFG_MPC85xx_GUTS_ADDR);
+       volatile ccsr_lbc_t *lbc = (void *)(CFG_MPC85xx_LBC_ADDR);
+       uint lbc_mhz = get_lbc_clock ()  / 1000000;
+
+#ifdef CONFIG_MPC8548
+       uint svr = get_svr ();
+       uint lcrr;
+
+       /*
+        * MPC revision < 2.0
+        * According to MPC8548E_Device_Errata Rev. L, Erratum LBIU1:
+        * Modify engineering use only register at address 0xE_0F20.
+        * "1. Read register at offset 0xE_0F20
+        * 2. And value with 0x0000_FFFF
+        * 3. OR result with 0x0000_0004
+        * 4. Write result back to offset 0xE_0F20."
+        *
+        * According to MPC8548E_Device_Errata Rev. L, Erratum LBIU2:
+        * Modify engineering use only register at address 0xE_0F20.
+        * "1. Read register at offset 0xE_0F20
+        * 2. And value with 0xFFFF_FFDF
+        * 3. Write result back to offset 0xE_0F20."
+        *
+        * Since it is the same register, we do the modification in one step.
+        */
+       if (SVR_MAJ (svr) < 2) {
+               uint dummy = gur->lbiuiplldcr1;
+               dummy &= 0x0000FFDF;
+               dummy |= 0x00000004;
+               gur->lbiuiplldcr1 = dummy;
+       }
+
+       lcrr = CFG_LBC_LCRR;
+
+       /*
+        * Local Bus Clock > 83.3 MHz. According to timing
+        * specifications set LCRR[EADC] to 2 delay cycles.
+        */
+       if (lbc_mhz > 83) {
+               lcrr &= ~LCRR_EADC;
+               lcrr |= LCRR_EADC_2;
+       }
+
+       /*
+        * According to MPC8548ERMAD Rev. 1.3, 13.3.1.16, 13-30
+        * disable PLL bypass for Local Bus Clock > 83 MHz.
+        */
+       if (lbc_mhz >= 66)
+               lcrr &= (~LCRR_DBYP);   /* DLL Enabled */
+
+       else
+               lcrr |= LCRR_DBYP;      /* DLL Bypass */
+
+       lbc->lcrr = lcrr;
+       asm ("sync;isync;msync");
+
+       /*
+        * According to MPC8548ERMAD Rev.1.3 read back LCRR
+        * and terminate with isync
+        */
+       lcrr = lbc->lcrr;
+       asm ("isync;");
+
+       /* let DLL stabilize */
+       udelay (500);
+
+#else /* !CONFIG_MPC8548 */
+
+       /*
+        * Errata LBC11.
+        * Fix Local Bus clock glitch when DLL is enabled.
+        *
+        * If localbus freq is < 66Mhz, DLL bypass mode must be used.
+        * If localbus freq is > 133Mhz, DLL can be safely enabled.
+        * Between 66 and 133, the DLL is enabled with an override workaround.
+        */
+
+       if (lbc_mhz < 66) {
+               lbc->lcrr = CFG_LBC_LCRR | LCRR_DBYP;   /* DLL Bypass */
+               lbc->ltedr = 0xa4c80000;        /* DK: !!! */
+
+       } else if (lbc_mhz >= 133) {
+               lbc->lcrr = CFG_LBC_LCRR & (~LCRR_DBYP);        /* DLL Enabled */
+
+       } else {
+               /*
+                * On REV1 boards, need to change CLKDIV before enable DLL.
+                * Default CLKDIV is 8, change it to 4 temporarily.
+                */
+               uint pvr = get_pvr ();
+               uint temp_lbcdll = 0;
+
+               if (pvr == PVR_85xx_REV1) {
+                       /* FIXME: Justify the high bit here. */
+                       lbc->lcrr = 0x10000004;
+               }
+
+               lbc->lcrr = CFG_LBC_LCRR & (~LCRR_DBYP);        /* DLL Enabled */
+               udelay (200);
+
+               /*
+                * Sample LBC DLL ctrl reg, upshift it to set the
+                * override bits.
+                */
+               temp_lbcdll = gur->lbcdllcr;
+               gur->lbcdllcr = (((temp_lbcdll & 0xff) << 16) | 0x80000000);
+               asm ("sync;isync;msync");
+       }
+#endif /* !CONFIG_MPC8548 */
+
+#ifdef CONFIG_CAN_DRIVER
+       /*
+        * According to timing specifications EAD must be
+        * set if Local Bus Clock is > 83 MHz.
+        */
+       if (lbc_mhz > 83)
+               out_be32 (&lbc->or2, CFG_OR2_CAN | OR_UPM_EAD);
+       else
+               out_be32 (&lbc->or2, CFG_OR2_CAN);
+       out_be32 (&lbc->br2, CFG_BR2_CAN);
+
+       /* LGPL4 is UPWAIT */
+       out_be32(&lbc->mcmr, MxMR_DSx_3_CYCL | MxMR_GPL_x4DIS | MxMR_WLFx_3X);
+
+       /* Initialize UPMC for CAN: single read */
+       upmc_write (0x00, 0xFFFFED00);
+       upmc_write (0x01, 0xCCFFCC00);
+       upmc_write (0x02, 0x00FFCF00);
+       upmc_write (0x03, 0x00FFCF00);
+       upmc_write (0x04, 0x00FFDC00);
+       upmc_write (0x05, 0x00FFCF00);
+       upmc_write (0x06, 0x00FFED00);
+       upmc_write (0x07, 0x3FFFCC07);
+
+       /* Initialize UPMC for CAN: single write */
+       upmc_write (0x18, 0xFFFFED00);
+       upmc_write (0x19, 0xCCFFEC00);
+       upmc_write (0x1A, 0x00FFED80);
+       upmc_write (0x1B, 0x00FFED80);
+       upmc_write (0x1C, 0x00FFFC00);
+       upmc_write (0x1D, 0x0FFFEC00);
+       upmc_write (0x1E, 0x0FFFEF00);
+       upmc_write (0x1F, 0x3FFFEC05);
+#endif /* CONFIG_CAN_DRIVER */
+}
+
+/*
+ * Initialize PCI Devices, report devices found.
+ */
+static int first_free_busno;
+
+#if defined(CONFIG_PCI) || defined(CONFIG_PCI1)
+static struct pci_controller pci1_hose;
+#endif /* CONFIG_PCI || CONFIG_PCI1 */
+
+#ifdef CONFIG_PCIE1
+static struct pci_controller pcie1_hose;
+#endif /* CONFIG_PCIE1 */
+
+static inline void init_pci1(void)
+{
+       volatile ccsr_gur_t *gur = (void *)(CFG_MPC85xx_GUTS_ADDR);
+#if defined(CONFIG_PCI) || defined(CONFIG_PCI1)
+       uint host_agent = (gur->porbmsr & MPC85xx_PORBMSR_HA) >> 16;
+       volatile ccsr_fsl_pci_t *pci = (ccsr_fsl_pci_t *)CFG_PCI1_ADDR;
+       extern void fsl_pci_init(struct pci_controller *hose);
+       struct pci_controller *hose = &pci1_hose;
+
+       /* PORDEVSR[15] */
+       uint pci_32 = gur->pordevsr & MPC85xx_PORDEVSR_PCI1_PCI32;
+       /* PORDEVSR[14] */
+       uint pci_arb = gur->pordevsr & MPC85xx_PORDEVSR_PCI1_ARB;
+       /* PORPLLSR[16] */
+       uint pci_clk_sel = gur->porpllsr & MPC85xx_PORDEVSR_PCI1_SPD;
+
+       uint pci_agent = (host_agent == 3) || (host_agent == 4 ) ||
+               (host_agent == 6);
+
+       uint pci_speed = CONFIG_SYS_CLK_FREQ;   /* PCI PSPEED in [4:5] */
+
+       if (!(gur->devdisr & MPC85xx_DEVDISR_PCI1)) {
+               printf ("PCI1:  %d bit, %s MHz, %s, %s, %s\n",
+                       (pci_32) ? 32 : 64,
+                       (pci_speed == 33333333) ? "33" :
+                       (pci_speed == 66666666) ? "66" : "unknown",
+                       pci_clk_sel ? "sync" : "async",
+                       pci_agent ? "agent" : "host",
+                       pci_arb ? "arbiter" : "external-arbiter");
+
+
+               /* inbound */
+               pci_set_region (hose->regions + 0,
+                               CFG_PCI_MEMORY_BUS,
+                               CFG_PCI_MEMORY_PHYS,
+                               CFG_PCI_MEMORY_SIZE,
+                               PCI_REGION_MEM | PCI_REGION_MEMORY);
+
+
+               /* outbound memory */
+               pci_set_region (hose->regions + 1,
+                               CFG_PCI1_MEM_BASE,
+                               CFG_PCI1_MEM_PHYS,
+                               CFG_PCI1_MEM_SIZE,
+                               PCI_REGION_MEM);
+
+               /* outbound io */
+               pci_set_region (hose->regions + 2,
+                               CFG_PCI1_IO_BASE,
+                               CFG_PCI1_IO_PHYS,
+                               CFG_PCI1_IO_SIZE,
+                               PCI_REGION_IO);
+
+               hose->region_count = 3;
+
+               hose->first_busno = first_free_busno;
+               pci_setup_indirect (hose, (int)&pci->cfg_addr,
+                                   (int)&pci->cfg_data);
+
+               fsl_pci_init (hose);
+
+               printf ("       PCI on bus %02x..%02x\n",
+                       hose->first_busno, hose->last_busno);
+
+               first_free_busno = hose->last_busno + 1;
+#ifdef CONFIG_PCIX_CHECK
+               if (!(gur->pordevsr & PORDEVSR_PCI)) {
+                       ushort reg16 =
+                               PCI_X_CMD_MAX_SPLIT | PCI_X_CMD_MAX_READ |
+                               PCI_X_CMD_ERO | PCI_X_CMD_DPERR_E;
+                       uint dev = PCI_BDF(hose->first_busno, 0, 0);
+
+                       /* PCI-X init */
+                       if (CONFIG_SYS_CLK_FREQ < 66000000)
+                               puts ("PCI-X will only work at 66 MHz\n");
+
+                       pci_hose_write_config_word (hose, dev, PCIX_COMMAND,
+                                                   reg16);
+               }
+#endif
+       } else {
+               puts ("PCI1:  disabled\n");
+       }
+#else /* !(CONFIG_PCI || CONFIG_PCI1) */
+       gur->devdisr |= MPC85xx_DEVDISR_PCI1; /* disable */
+#endif /* CONFIG_PCI || CONFIG_PCI1) */
+}
+
+static inline void init_pcie1(void)
+{
+       volatile ccsr_gur_t *gur = (void *)(CFG_MPC85xx_GUTS_ADDR);
+#ifdef CONFIG_PCIE1
+       uint io_sel = (gur->pordevsr & MPC85xx_PORDEVSR_IO_SEL) >> 19;
+       uint host_agent = (gur->porbmsr & MPC85xx_PORBMSR_HA) >> 16;
+       volatile ccsr_fsl_pci_t *pci = (ccsr_fsl_pci_t *)CFG_PCIE1_ADDR;
+       extern void fsl_pci_init(struct pci_controller *hose);
+       struct pci_controller *hose = &pcie1_hose;
+       int pcie_ep =  (host_agent == 0) || (host_agent == 2 ) ||
+               (host_agent == 3);
+
+       int pcie_configured  = io_sel >= 1;
+
+       if (pcie_configured && !(gur->devdisr & MPC85xx_DEVDISR_PCIE)){
+               printf ("PCIe:  %s, base address %x",
+                       pcie_ep ? "End point" : "Root complex", (uint)pci);
+
+               if (pci->pme_msg_det) {
+                       pci->pme_msg_det = 0xffffffff;
+                       debug (", with errors. Clearing. Now 0x%08x",
+                              pci->pme_msg_det);
+               }
+               puts ("\n");
+
+               /* inbound */
+               pci_set_region (hose->regions + 0,
+                               CFG_PCI_MEMORY_BUS,
+                               CFG_PCI_MEMORY_PHYS,
+                               CFG_PCI_MEMORY_SIZE,
+                               PCI_REGION_MEM | PCI_REGION_MEMORY);
+
+               /* outbound memory */
+               pci_set_region (hose->regions + 1,
+                               CFG_PCIE1_MEM_BASE,
+                               CFG_PCIE1_MEM_PHYS,
+                               CFG_PCIE1_MEM_SIZE,
+                               PCI_REGION_MEM);
+
+               /* outbound io */
+               pci_set_region (hose->regions + 2,
+                               CFG_PCIE1_IO_BASE,
+                               CFG_PCIE1_IO_PHYS,
+                               CFG_PCIE1_IO_SIZE,
+                               PCI_REGION_IO);
+
+               hose->region_count = 3;
+
+               hose->first_busno = first_free_busno;
+               pci_setup_indirect(hose, (int)&pci->cfg_addr,
+                                  (int)&pci->cfg_data);
+
+               fsl_pci_init (hose);
+               printf ("       PCIe on bus %02x..%02x\n",
+                       hose->first_busno, hose->last_busno);
+
+               first_free_busno = hose->last_busno + 1;
+
+       } else {
+               printf ("PCIe:  disabled\n");
+       }
+#else /* !CONFIG_PCIE1 */
+       gur->devdisr |= MPC85xx_DEVDISR_PCIE; /* disable */
+#endif /* CONFIG_PCIE1 */
+}
+
+void pci_init_board (void)
+{
+       init_pci1();
+       init_pcie1();
+}
+
+#ifdef CONFIG_OF_BOARD_SETUP
+void ft_board_setup (void *blob, bd_t *bd)
+{
+       int node, tmp[2];
+       const char *path;
+
+       ft_cpu_setup (blob, bd);
+
+       node = fdt_path_offset (blob, "/aliases");
+       tmp[0] = 0;
+       if (node >= 0) {
+#if defined(CONFIG_PCI) || defined(CONFIG_PCI1)
+               path = fdt_getprop (blob, node, "pci0", NULL);
+               if (path) {
+                       tmp[1] = pci1_hose.last_busno - pci1_hose.first_busno;
+                       do_fixup_by_path (blob, path, "bus-range", &tmp, 8, 1);
+               }
+#endif /* CONFIG_PCI || CONFIG_PCI1 */
+#ifdef CONFIG_PCIE1
+               path = fdt_getprop (blob, node, "pci1", NULL);
+               if (path) {
+                       tmp[1] = pcie1_hose.last_busno - pcie1_hose.first_busno;
+                       do_fixup_by_path (blob, path, "bus-range", &tmp, 8, 1);
+               }
+#endif /* CONFIG_PCIE1 */
+       }
+}
+#endif /* CONFIG_OF_BOARD_SETUP */
+
+#ifdef CONFIG_BOARD_EARLY_INIT_R
+int board_early_init_r (void)
+{
+#ifdef CONFIG_PS2MULT
+       ps2mult_early_init ();
+#endif /* CONFIG_PS2MULT */
+       return (0);
+}
+#endif /* CONFIG_BOARD_EARLY_INIT_R */
diff --git a/board/tqc/tqm85xx/u-boot.lds b/board/tqc/tqm85xx/u-boot.lds
new file mode 100644 (file)
index 0000000..8cb551a
--- /dev/null
@@ -0,0 +1,147 @@
+/*
+ * (C) Copyright 2002,2003, Motorola,Inc.
+ * Xianghua Xiao, X.Xiao@motorola.com.
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.         See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+OUTPUT_ARCH(powerpc)
+/* Do we need any of these for elf?
+   __DYNAMIC = 0;    */
+SECTIONS
+{
+  .resetvec 0xFFFFFFFC :
+  {
+    *(.resetvec)
+  } = 0xffff
+
+  .bootpg 0xFFFFF000 :
+  {
+    cpu/mpc85xx/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             :
+  {
+    cpu/mpc85xx/start.o (.text)
+    cpu/mpc85xx/traps.o (.text)
+    cpu/mpc85xx/interrupts.o (.text)
+    cpu/mpc85xx/cpu_init.o (.text)
+    cpu/mpc85xx/cpu.o (.text)
+    cpu/mpc85xx/speed.o (.text)
+    cpu/mpc85xx/pci.o (.text)
+    common/dlmalloc.o (.text)
+    lib_generic/crc32.o (.text)
+    lib_ppc/extable.o (.text)
+    lib_generic/zlib.o (.text)
+    *(.text)
+    *(.fixup)
+    *(.got1)
+   }
+    _etext = .;
+    PROVIDE (etext = .);
+    .rodata    :
+   {
+    *(.rodata)
+    *(.rodata1)
+    *(.rodata.str1.4)
+    *(.eh_frame)
+  }
+  .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 (NOLOAD)             :
+  {
+   *(.sbss) *(.scommon)
+   *(.dynbss)
+   *(.bss)
+   *(COMMON)
+  }
+  _end = . ;
+  PROVIDE (end = .);
+}
diff --git a/board/tqc/tqm8xx/Makefile b/board/tqc/tqm8xx/Makefile
new file mode 100644 (file)
index 0000000..b48934b
--- /dev/null
@@ -0,0 +1,44 @@
+#
+# (C) Copyright 2000-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 flash.o load_sernum_ethaddr.o
+
+SRCS   := $(SOBJS:.o=.S) $(COBJS:.o=.c)
+OBJS   := $(addprefix $(obj),$(COBJS))
+SOBJS  := $(addprefix $(obj),$(SOBJS))
+
+$(LIB):        $(obj).depend $(OBJS)
+       $(AR) $(ARFLAGS) $@ $(OBJS)
+
+#########################################################################
+
+# defines $(obj).depend target
+include $(SRCTREE)/rules.mk
+
+sinclude $(obj).depend
+
+#########################################################################
diff --git a/board/tqc/tqm8xx/config.mk b/board/tqc/tqm8xx/config.mk
new file mode 100644 (file)
index 0000000..9d6080b
--- /dev/null
@@ -0,0 +1,28 @@
+#
+# (C) Copyright 2000
+# Wolfgang Denk, DENX Software Engineering, wd@denx.de.
+#
+# See file CREDITS for list of people who contributed to this
+# project.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 2 of
+# the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+# MA 02111-1307 USA
+#
+
+#
+# TQM8xxL boards
+#
+
+TEXT_BASE = 0x40000000
diff --git a/board/tqc/tqm8xx/flash.c b/board/tqc/tqm8xx/flash.c
new file mode 100644 (file)
index 0000000..4342ebc
--- /dev/null
@@ -0,0 +1,834 @@
+/*
+ * (C) Copyright 2000-2004
+ * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+#if 0
+#define DEBUG
+#endif
+
+#include <common.h>
+#include <mpc8xx.h>
+#include <environment.h>
+
+#include <asm/processor.h>
+
+DECLARE_GLOBAL_DATA_PTR;
+
+#if !defined(CFG_FLASH_CFI_DRIVER) /* do not use if CFI driver is configured */
+
+#if defined(CONFIG_TQM8xxL) && !defined(CONFIG_TQM866M) \
+    && !defined(CONFIG_TQM885D)
+# ifndef CFG_OR_TIMING_FLASH_AT_50MHZ
+#  define CFG_OR_TIMING_FLASH_AT_50MHZ (OR_ACS_DIV1  | OR_TRLX | OR_CSNT_SAM | \
+                                        OR_SCY_2_CLK | OR_EHTR | OR_BI)
+# endif
+#endif /* CONFIG_TQM8xxL/M, !TQM866M, !TQM885D */
+
+#ifndef        CFG_ENV_ADDR
+#define CFG_ENV_ADDR   (CFG_FLASH_BASE + CFG_ENV_OFFSET)
+#endif
+
+flash_info_t   flash_info[CFG_MAX_FLASH_BANKS]; /* info for FLASH chips        */
+
+/*-----------------------------------------------------------------------
+ * Functions
+ */
+static ulong flash_get_size (vu_long *addr, flash_info_t *info);
+static int write_word (flash_info_t *info, ulong dest, ulong data);
+
+/*-----------------------------------------------------------------------
+ */
+
+unsigned long flash_init (void)
+{
+       volatile immap_t     *immap  = (immap_t *)CFG_IMMR;
+       volatile memctl8xx_t *memctl = &immap->im_memctl;
+       unsigned long size_b0, size_b1;
+       int i;
+
+#ifdef CFG_OR_TIMING_FLASH_AT_50MHZ
+       int scy, trlx, flash_or_timing, clk_diff;
+
+       scy = (CFG_OR_TIMING_FLASH_AT_50MHZ & OR_SCY_MSK) >> 4;
+       if (CFG_OR_TIMING_FLASH_AT_50MHZ & OR_TRLX) {
+               trlx = OR_TRLX;
+               scy *= 2;
+       } else
+               trlx = 0;
+
+               /* We assume that each 10MHz of bus clock require 1-clk SCY
+                * adjustment.
+                */
+       clk_diff = (gd->bus_clk / 1000000) - 50;
+
+               /* We need proper rounding here. This is what the "+5" and "-5"
+                * are here for.
+                */
+       if (clk_diff >= 0)
+               scy += (clk_diff + 5) / 10;
+       else
+               scy += (clk_diff - 5) / 10;
+
+               /* For bus frequencies above 50MHz, we want to use relaxed timing
+                * (OR_TRLX).
+                */
+       if (gd->bus_clk >= 50000000)
+               trlx = OR_TRLX;
+       else
+               trlx = 0;
+
+       if (trlx)
+               scy /= 2;
+
+       if (scy > 0xf)
+               scy = 0xf;
+       if (scy < 1)
+               scy = 1;
+
+       flash_or_timing = (scy << 4) | trlx |
+                         (CFG_OR_TIMING_FLASH_AT_50MHZ & ~(OR_TRLX | OR_SCY_MSK));
+#endif
+       /* Init: no FLASHes known */
+       for (i=0; i<CFG_MAX_FLASH_BANKS; ++i) {
+               flash_info[i].flash_id = FLASH_UNKNOWN;
+       }
+
+       /* Static FLASH Bank configuration here - FIXME XXX */
+
+       debug ("\n## Get flash bank 1 size @ 0x%08x\n",FLASH_BASE0_PRELIM);
+
+       size_b0 = flash_get_size((vu_long *)FLASH_BASE0_PRELIM, &flash_info[0]);
+
+       debug ("## Get flash bank 2 size @ 0x%08x\n",FLASH_BASE1_PRELIM);
+
+       if (flash_info[0].flash_id == FLASH_UNKNOWN) {
+               printf ("## Unknown FLASH on Bank 0 - Size = 0x%08lx = %ld MB\n",
+                       size_b0, size_b0<<20);
+       }
+
+       size_b1 = flash_get_size((vu_long *)FLASH_BASE1_PRELIM, &flash_info[1]);
+
+       debug ("## Prelim. Flash bank sizes: %08lx + 0x%08lx\n",size_b0,size_b1);
+
+       if (size_b1 > size_b0) {
+               printf ("## ERROR: "
+                       "Bank 1 (0x%08lx = %ld MB) > Bank 0 (0x%08lx = %ld MB)\n",
+                       size_b1, size_b1<<20,
+                       size_b0, size_b0<<20
+               );
+               flash_info[0].flash_id  = FLASH_UNKNOWN;
+               flash_info[1].flash_id  = FLASH_UNKNOWN;
+               flash_info[0].sector_count      = -1;
+               flash_info[1].sector_count      = -1;
+               flash_info[0].size              = 0;
+               flash_info[1].size              = 0;
+               return (0);
+       }
+
+       debug  ("## Before remap: "
+               "BR0: 0x%08x    OR0: 0x%08x    "
+               "BR1: 0x%08x    OR1: 0x%08x\n",
+               memctl->memc_br0, memctl->memc_or0,
+               memctl->memc_br1, memctl->memc_or1);
+
+       /* Remap FLASH according to real size */
+#ifndef        CFG_OR_TIMING_FLASH_AT_50MHZ
+       memctl->memc_or0 = CFG_OR_TIMING_FLASH | (-size_b0 & OR_AM_MSK);
+#else
+       memctl->memc_or0 = flash_or_timing | (-size_b0 & OR_AM_MSK);
+#endif
+       memctl->memc_br0 = (CFG_FLASH_BASE & BR_BA_MSK) | BR_MS_GPCM | BR_V;
+
+       debug ("## BR0: 0x%08x    OR0: 0x%08x\n",
+               memctl->memc_br0, memctl->memc_or0);
+
+       /* Re-do sizing to get full correct info */
+       size_b0 = flash_get_size((vu_long *)CFG_FLASH_BASE, &flash_info[0]);
+
+#if CFG_MONITOR_BASE >= CFG_FLASH_BASE
+       /* monitor protection ON by default */
+       debug ("Protect monitor: %08lx ... %08lx\n",
+               (ulong)CFG_MONITOR_BASE,
+               (ulong)CFG_MONITOR_BASE + monitor_flash_len - 1);
+
+       flash_protect(FLAG_PROTECT_SET,
+                     CFG_MONITOR_BASE,
+                     CFG_MONITOR_BASE + monitor_flash_len - 1,
+                     &flash_info[0]);
+#endif
+
+#ifdef CFG_ENV_IS_IN_FLASH
+       /* ENV protection ON by default */
+# ifdef CFG_ENV_ADDR_REDUND
+       debug ("Protect primary   environment: %08lx ... %08lx\n",
+               (ulong)CFG_ENV_ADDR,
+               (ulong)CFG_ENV_ADDR + CFG_ENV_SECT_SIZE - 1);
+# else
+       debug ("Protect environment: %08lx ... %08lx\n",
+               (ulong)CFG_ENV_ADDR,
+               (ulong)CFG_ENV_ADDR + CFG_ENV_SECT_SIZE - 1);
+# endif
+
+       flash_protect(FLAG_PROTECT_SET,
+                     CFG_ENV_ADDR,
+                     CFG_ENV_ADDR + CFG_ENV_SECT_SIZE - 1,
+                     &flash_info[0]);
+#endif
+
+#ifdef CFG_ENV_ADDR_REDUND
+       debug ("Protect redundand environment: %08lx ... %08lx\n",
+               (ulong)CFG_ENV_ADDR_REDUND,
+               (ulong)CFG_ENV_ADDR_REDUND + CFG_ENV_SECT_SIZE - 1);
+
+       flash_protect(FLAG_PROTECT_SET,
+                     CFG_ENV_ADDR_REDUND,
+                     CFG_ENV_ADDR_REDUND + CFG_ENV_SECT_SIZE - 1,
+                     &flash_info[0]);
+#endif
+
+       if (size_b1) {
+#ifndef        CFG_OR_TIMING_FLASH_AT_50MHZ
+               memctl->memc_or1 = CFG_OR_TIMING_FLASH | (-size_b1 & 0xFFFF8000);
+#else
+               memctl->memc_or1 = flash_or_timing | (-size_b1 & 0xFFFF8000);
+#endif
+               memctl->memc_br1 = ((CFG_FLASH_BASE + size_b0) & BR_BA_MSK) |
+                                   BR_MS_GPCM | BR_V;
+
+               debug ("## BR1: 0x%08x    OR1: 0x%08x\n",
+                       memctl->memc_br1, memctl->memc_or1);
+
+               /* Re-do sizing to get full correct info */
+               size_b1 = flash_get_size((vu_long *)(CFG_FLASH_BASE + size_b0),
+                                         &flash_info[1]);
+
+#if CFG_MONITOR_BASE >= CFG_FLASH_BASE
+               /* monitor protection ON by default */
+               flash_protect(FLAG_PROTECT_SET,
+                             CFG_MONITOR_BASE,
+                             CFG_MONITOR_BASE+monitor_flash_len-1,
+                             &flash_info[1]);
+#endif
+
+#ifdef CFG_ENV_IS_IN_FLASH
+               /* ENV protection ON by default */
+               flash_protect(FLAG_PROTECT_SET,
+                             CFG_ENV_ADDR,
+                             CFG_ENV_ADDR+CFG_ENV_SIZE-1,
+                             &flash_info[1]);
+#endif
+       } else {
+               memctl->memc_br1 = 0;           /* invalidate bank */
+
+               flash_info[1].flash_id = FLASH_UNKNOWN;
+               flash_info[1].sector_count = -1;
+               flash_info[1].size = 0;
+
+               debug ("## DISABLE BR1: 0x%08x    OR1: 0x%08x\n",
+                       memctl->memc_br1, memctl->memc_or1);
+       }
+
+       debug ("## Final Flash bank sizes: %08lx + 0x%08lx\n",size_b0,size_b1);
+
+       flash_info[0].size = size_b0;
+       flash_info[1].size = size_b1;
+
+       return (size_b0 + size_b1);
+}
+
+/*-----------------------------------------------------------------------
+ */
+void flash_print_info  (flash_info_t *info)
+{
+       int i;
+
+       if (info->flash_id == FLASH_UNKNOWN) {
+               printf ("missing or unknown FLASH type\n");
+               return;
+       }
+
+       switch (info->flash_id & FLASH_VENDMASK) {
+       case FLASH_MAN_AMD:     printf ("AMD ");                break;
+       case FLASH_MAN_FUJ:     printf ("FUJITSU ");            break;
+       default:                printf ("Unknown Vendor ");     break;
+       }
+
+       switch (info->flash_id & FLASH_TYPEMASK) {
+#ifdef CONFIG_TQM8xxM  /* mirror bit flash */
+       case FLASH_AMLV128U:    printf ("AM29LV128ML (128Mbit, uniform sector size)\n");
+                               break;
+       case FLASH_AMLV320U:    printf ("AM29LV320ML (32Mbit, uniform sector size)\n");
+                               break;
+       case FLASH_AMLV640U:    printf ("AM29LV640ML (64Mbit, uniform sector size)\n");
+                               break;
+       case FLASH_AMLV320B:    printf ("AM29LV320MB (32Mbit, bottom boot sect)\n");
+                               break;
+# else /* ! TQM8xxM */
+       case FLASH_AM400B:      printf ("AM29LV400B (4 Mbit, bottom boot sect)\n");
+                               break;
+       case FLASH_AM400T:      printf ("AM29LV400T (4 Mbit, top boot sector)\n");
+                               break;
+       case FLASH_AM800B:      printf ("AM29LV800B (8 Mbit, bottom boot sect)\n");
+                               break;
+       case FLASH_AM800T:      printf ("AM29LV800T (8 Mbit, top boot sector)\n");
+                               break;
+       case FLASH_AM320B:      printf ("AM29LV320B (32 Mbit, bottom boot sect)\n");
+                               break;
+       case FLASH_AM320T:      printf ("AM29LV320T (32 Mbit, top boot sector)\n");
+                               break;
+#endif /* TQM8xxM */
+       case FLASH_AM160B:      printf ("AM29LV160B (16 Mbit, bottom boot sect)\n");
+                               break;
+       case FLASH_AM160T:      printf ("AM29LV160T (16 Mbit, top boot sector)\n");
+                               break;
+       case FLASH_AMDL163B:    printf ("AM29DL163B (16 Mbit, bottom boot sect)\n");
+                               break;
+       default:                printf ("Unknown Chip Type\n");
+                               break;
+       }
+
+       printf ("  Size: %ld MB in %d Sectors\n",
+               info->size >> 20, info->sector_count);
+
+       printf ("  Sector Start Addresses:");
+       for (i=0; i<info->sector_count; ++i) {
+               if ((i % 5) == 0)
+                       printf ("\n   ");
+               printf (" %08lX%s",
+                       info->start[i],
+                       info->protect[i] ? " (RO)" : "     "
+               );
+       }
+       printf ("\n");
+       return;
+}
+
+/*-----------------------------------------------------------------------
+ */
+
+
+/*-----------------------------------------------------------------------
+ */
+
+/*
+ * The following code cannot be run from FLASH!
+ */
+
+static ulong flash_get_size (vu_long *addr, flash_info_t *info)
+{
+       short i;
+       ulong value;
+       ulong base = (ulong)addr;
+
+       /* Write auto select command: read Manufacturer ID */
+       addr[0x0555] = 0x00AA00AA;
+       addr[0x02AA] = 0x00550055;
+       addr[0x0555] = 0x00900090;
+
+       value = addr[0];
+
+       debug ("Manuf. ID @ 0x%08lx: 0x%08lx\n", (ulong)addr, value);
+
+       switch (value) {
+       case AMD_MANUFACT:
+               debug ("Manufacturer: AMD\n");
+               info->flash_id = FLASH_MAN_AMD;
+               break;
+       case FUJ_MANUFACT:
+               debug ("Manufacturer: FUJITSU\n");
+               info->flash_id = FLASH_MAN_FUJ;
+               break;
+       default:
+               debug ("Manufacturer: *** unknown ***\n");
+               info->flash_id = FLASH_UNKNOWN;
+               info->sector_count = 0;
+               info->size = 0;
+               return (0);                     /* no or unknown flash  */
+       }
+
+       value = addr[1];                        /* device ID            */
+
+       debug ("Device ID @ 0x%08lx: 0x%08lx\n", (ulong)(&addr[1]), value);
+
+       switch (value) {
+#ifdef CONFIG_TQM8xxM  /* mirror bit flash */
+       case AMD_ID_MIRROR:
+               debug ("Mirror Bit flash: addr[14] = %08lX  addr[15] = %08lX\n",
+                       addr[14], addr[15]);
+               /* Special case for AMLV320MH/L */
+               if ((addr[14] & 0x00ff00ff) == 0x001d001d &&
+                   (addr[15] & 0x00ff00ff) == 0x00000000) {
+                       debug ("Chip: AMLV320MH/L\n");
+                       info->flash_id += FLASH_AMLV320U;
+                       info->sector_count = 64;
+                       info->size = 0x00800000;        /* => 8 MB */
+                       break;
+               }
+               switch(addr[14]) {
+               case AMD_ID_LV128U_2:
+                       if (addr[15] != AMD_ID_LV128U_3) {
+                               debug ("Chip: AMLV128U -> unknown\n");
+                               info->flash_id = FLASH_UNKNOWN;
+                       } else {
+                               debug ("Chip: AMLV128U\n");
+                               info->flash_id += FLASH_AMLV128U;
+                               info->sector_count = 256;
+                               info->size = 0x02000000;
+                       }
+                       break;                          /* => 32 MB     */
+               case AMD_ID_LV640U_2:
+                       if (addr[15] != AMD_ID_LV640U_3) {
+                               debug ("Chip: AMLV640U -> unknown\n");
+                               info->flash_id = FLASH_UNKNOWN;
+                       } else {
+                               debug ("Chip: AMLV640U\n");
+                               info->flash_id += FLASH_AMLV640U;
+                               info->sector_count = 128;
+                               info->size = 0x01000000;
+                       }
+                       break;                          /* => 16 MB     */
+               case AMD_ID_LV320B_2:
+                       if (addr[15] != AMD_ID_LV320B_3) {
+                               debug ("Chip: AMLV320B -> unknown\n");
+                               info->flash_id = FLASH_UNKNOWN;
+                       } else {
+                               debug ("Chip: AMLV320B\n");
+                               info->flash_id += FLASH_AMLV320B;
+                               info->sector_count = 71;
+                               info->size = 0x00800000;
+                       }
+                       break;                          /* =>  8 MB     */
+               default:
+                       debug ("Chip: *** unknown ***\n");
+                       info->flash_id = FLASH_UNKNOWN;
+                       break;
+               }
+               break;
+# else /* ! TQM8xxM */
+       case AMD_ID_LV400T:
+               info->flash_id += FLASH_AM400T;
+               info->sector_count = 11;
+               info->size = 0x00100000;
+               break;                                  /* => 1 MB              */
+
+       case AMD_ID_LV400B:
+               info->flash_id += FLASH_AM400B;
+               info->sector_count = 11;
+               info->size = 0x00100000;
+               break;                                  /* => 1 MB              */
+
+       case AMD_ID_LV800T:
+               info->flash_id += FLASH_AM800T;
+               info->sector_count = 19;
+               info->size = 0x00200000;
+               break;                                  /* => 2 MB      */
+
+       case AMD_ID_LV800B:
+               info->flash_id += FLASH_AM800B;
+               info->sector_count = 19;
+               info->size = 0x00200000;
+               break;                                  /* => 2 MB      */
+
+       case AMD_ID_LV320T:
+               info->flash_id += FLASH_AM320T;
+               info->sector_count = 71;
+               info->size = 0x00800000;
+               break;                                  /* => 8 MB      */
+
+       case AMD_ID_LV320B:
+               info->flash_id += FLASH_AM320B;
+               info->sector_count = 71;
+               info->size = 0x00800000;
+               break;                                  /* => 8 MB      */
+#endif /* TQM8xxM */
+
+       case AMD_ID_LV160T:
+               info->flash_id += FLASH_AM160T;
+               info->sector_count = 35;
+               info->size = 0x00400000;
+               break;                                  /* => 4 MB      */
+
+       case AMD_ID_LV160B:
+               info->flash_id += FLASH_AM160B;
+               info->sector_count = 35;
+               info->size = 0x00400000;
+               break;                                  /* => 4 MB      */
+
+       case AMD_ID_DL163B:
+               info->flash_id += FLASH_AMDL163B;
+               info->sector_count = 39;
+               info->size = 0x00400000;
+               break;                                  /* => 4 MB      */
+
+       default:
+               info->flash_id = FLASH_UNKNOWN;
+               return (0);                     /* => no or unknown flash */
+       }
+
+       /* set up sector start address table */
+       switch (value) {
+#ifdef CONFIG_TQM8xxM  /* mirror bit flash */
+       case AMD_ID_MIRROR:
+               switch (info->flash_id & FLASH_TYPEMASK) {
+                       /* only known types here - no default */
+               case FLASH_AMLV128U:
+               case FLASH_AMLV640U:
+               case FLASH_AMLV320U:
+                       for (i = 0; i < info->sector_count; i++) {
+                               info->start[i] = base;
+                               base += 0x20000;
+                       }
+                       break;
+               case FLASH_AMLV320B:
+                       for (i = 0; i < info->sector_count; i++) {
+                               info->start[i] = base;
+                               /*
+                                * The first 8 sectors are 8 kB,
+                                * all the other ones  are 64 kB
+                                */
+                               base += (i < 8)
+                                       ?  2 * ( 8 << 10)
+                                       :  2 * (64 << 10);
+                       }
+                       break;
+               }
+               break;
+# else /* ! TQM8xxM */
+       case AMD_ID_LV400B:
+       case AMD_ID_LV800B:
+               /* set sector offsets for bottom boot block type        */
+               info->start[0] = base + 0x00000000;
+               info->start[1] = base + 0x00008000;
+               info->start[2] = base + 0x0000C000;
+               info->start[3] = base + 0x00010000;
+               for (i = 4; i < info->sector_count; i++) {
+                       info->start[i] = base + (i * 0x00020000) - 0x00060000;
+               }
+               break;
+       case AMD_ID_LV400T:
+       case AMD_ID_LV800T:
+               /* set sector offsets for top boot block type           */
+               i = info->sector_count - 1;
+               info->start[i--] = base + info->size - 0x00008000;
+               info->start[i--] = base + info->size - 0x0000C000;
+               info->start[i--] = base + info->size - 0x00010000;
+               for (; i >= 0; i--) {
+                       info->start[i] = base + i * 0x00020000;
+               }
+               break;
+       case AMD_ID_LV320B:
+               for (i = 0; i < info->sector_count; i++) {
+                       info->start[i] = base;
+                       /*
+                        * The first 8 sectors are 8 kB,
+                        * all the other ones  are 64 kB
+                        */
+                       base += (i < 8)
+                               ?  2 * ( 8 << 10)
+                               :  2 * (64 << 10);
+               }
+               break;
+       case AMD_ID_LV320T:
+               for (i = 0; i < info->sector_count; i++) {
+                       info->start[i] = base;
+                       /*
+                        * The last 8 sectors are 8 kB,
+                        * all the other ones  are 64 kB
+                        */
+                       base += (i < (info->sector_count - 8))
+                               ?  2 * (64 << 10)
+                               :  2 * ( 8 << 10);
+               }
+               break;
+#endif /* TQM8xxM */
+       case AMD_ID_LV160B:
+               /* set sector offsets for bottom boot block type        */
+               info->start[0] = base + 0x00000000;
+               info->start[1] = base + 0x00008000;
+               info->start[2] = base + 0x0000C000;
+               info->start[3] = base + 0x00010000;
+               for (i = 4; i < info->sector_count; i++) {
+                       info->start[i] = base + (i * 0x00020000) - 0x00060000;
+               }
+               break;
+       case AMD_ID_LV160T:
+               /* set sector offsets for top boot block type           */
+               i = info->sector_count - 1;
+               info->start[i--] = base + info->size - 0x00008000;
+               info->start[i--] = base + info->size - 0x0000C000;
+               info->start[i--] = base + info->size - 0x00010000;
+               for (; i >= 0; i--) {
+                       info->start[i] = base + i * 0x00020000;
+               }
+               break;
+       case AMD_ID_DL163B:
+               for (i = 0; i < info->sector_count; i++) {
+                       info->start[i] = base;
+                       /*
+                        * The first 8 sectors are 8 kB,
+                        * all the other ones  are 64 kB
+                        */
+                       base += (i < 8)
+                               ?  2 * ( 8 << 10)
+                               :  2 * (64 << 10);
+               }
+               break;
+       default:
+               return (0);
+               break;
+       }
+
+#if 0
+       /* check for protected sectors */
+       for (i = 0; i < info->sector_count; i++) {
+               /* read sector protection at sector address, (A7 .. A0) = 0x02 */
+               /* D0 = 1 if protected */
+               addr = (volatile unsigned long *)(info->start[i]);
+               info->protect[i] = addr[2] & 1;
+       }
+#endif
+
+       /*
+        * Prevent writes to uninitialized FLASH.
+        */
+       if (info->flash_id != FLASH_UNKNOWN) {
+               addr = (volatile unsigned long *)info->start[0];
+
+               *addr = 0x00F000F0;     /* reset bank */
+       }
+
+       return (info->size);
+}
+
+
+/*-----------------------------------------------------------------------
+ */
+
+int    flash_erase (flash_info_t *info, int s_first, int s_last)
+{
+       vu_long *addr = (vu_long*)(info->start[0]);
+       int flag, prot, sect, l_sect;
+       ulong start, now, last;
+
+       debug ("flash_erase: first: %d last: %d\n", s_first, s_last);
+
+       if ((s_first < 0) || (s_first > s_last)) {
+               if (info->flash_id == FLASH_UNKNOWN) {
+                       printf ("- missing\n");
+               } else {
+                       printf ("- no sectors to erase\n");
+               }
+               return 1;
+       }
+
+       if ((info->flash_id == FLASH_UNKNOWN) ||
+           (info->flash_id > FLASH_AMD_COMP)) {
+               printf ("Can't erase unknown flash type %08lx - aborted\n",
+                       info->flash_id);
+               return 1;
+       }
+
+       prot = 0;
+       for (sect=s_first; sect<=s_last; ++sect) {
+               if (info->protect[sect]) {
+                       prot++;
+               }
+       }
+
+       if (prot) {
+               printf ("- Warning: %d protected sectors will not be erased!\n",
+                       prot);
+       } else {
+               printf ("\n");
+       }
+
+       l_sect = -1;
+
+       /* Disable interrupts which might cause a timeout here */
+       flag = disable_interrupts();
+
+       addr[0x0555] = 0x00AA00AA;
+       addr[0x02AA] = 0x00550055;
+       addr[0x0555] = 0x00800080;
+       addr[0x0555] = 0x00AA00AA;
+       addr[0x02AA] = 0x00550055;
+
+       /* Start erase on unprotected sectors */
+       for (sect = s_first; sect<=s_last; sect++) {
+               if (info->protect[sect] == 0) { /* not protected */
+                       addr = (vu_long*)(info->start[sect]);
+                       addr[0] = 0x00300030;
+                       l_sect = sect;
+               }
+       }
+
+       /* re-enable interrupts if necessary */
+       if (flag)
+               enable_interrupts();
+
+       /* wait at least 80us - let's wait 1 ms */
+       udelay (1000);
+
+       /*
+        * We wait for the last triggered sector
+        */
+       if (l_sect < 0)
+               goto DONE;
+
+       start = get_timer (0);
+       last  = start;
+       addr = (vu_long*)(info->start[l_sect]);
+       while ((addr[0] & 0x00800080) != 0x00800080) {
+               if ((now = get_timer(start)) > CFG_FLASH_ERASE_TOUT) {
+                       printf ("Timeout\n");
+                       return 1;
+               }
+               /* show that we're waiting */
+               if ((now - last) > 1000) {      /* every second */
+                       putc ('.');
+                       last = now;
+               }
+       }
+
+DONE:
+       /* reset to read mode */
+       addr = (volatile unsigned long *)info->start[0];
+       addr[0] = 0x00F000F0;   /* reset bank */
+
+       printf (" done\n");
+       return 0;
+}
+
+/*-----------------------------------------------------------------------
+ * Copy memory to flash, returns:
+ * 0 - OK
+ * 1 - write timeout
+ * 2 - Flash not erased
+ */
+
+int write_buff (flash_info_t *info, uchar *src, ulong addr, ulong cnt)
+{
+       ulong cp, wp, data;
+       int i, l, rc;
+
+       wp = (addr & ~3);       /* get lower word aligned address */
+
+       /*
+        * handle unaligned start bytes
+        */
+       if ((l = addr - wp) != 0) {
+               data = 0;
+               for (i=0, cp=wp; i<l; ++i, ++cp) {
+                       data = (data << 8) | (*(uchar *)cp);
+               }
+               for (; i<4 && cnt>0; ++i) {
+                       data = (data << 8) | *src++;
+                       --cnt;
+                       ++cp;
+               }
+               for (; cnt==0 && i<4; ++i, ++cp) {
+                       data = (data << 8) | (*(uchar *)cp);
+               }
+
+               if ((rc = write_word(info, wp, data)) != 0) {
+                       return (rc);
+               }
+               wp += 4;
+       }
+
+       /*
+        * handle word aligned part
+        */
+       while (cnt >= 4) {
+               data = 0;
+               for (i=0; i<4; ++i) {
+                       data = (data << 8) | *src++;
+               }
+               if ((rc = write_word(info, wp, data)) != 0) {
+                       return (rc);
+               }
+               wp  += 4;
+               cnt -= 4;
+       }
+
+       if (cnt == 0) {
+               return (0);
+       }
+
+       /*
+        * handle unaligned tail bytes
+        */
+       data = 0;
+       for (i=0, cp=wp; i<4 && cnt>0; ++i, ++cp) {
+               data = (data << 8) | *src++;
+               --cnt;
+       }
+       for (; i<4; ++i, ++cp) {
+               data = (data << 8) | (*(uchar *)cp);
+       }
+
+       return (write_word(info, wp, data));
+}
+
+/*-----------------------------------------------------------------------
+ * Write a word to Flash, returns:
+ * 0 - OK
+ * 1 - write timeout
+ * 2 - Flash not erased
+ */
+static int write_word (flash_info_t *info, ulong dest, ulong data)
+{
+       vu_long *addr = (vu_long*)(info->start[0]);
+       ulong start;
+       int flag;
+
+       /* Check if Flash is (sufficiently) erased */
+       if ((*((vu_long *)dest) & data) != data) {
+               return (2);
+       }
+       /* Disable interrupts which might cause a timeout here */
+       flag = disable_interrupts();
+
+       addr[0x0555] = 0x00AA00AA;
+       addr[0x02AA] = 0x00550055;
+       addr[0x0555] = 0x00A000A0;
+
+       *((vu_long *)dest) = data;
+
+       /* re-enable interrupts if necessary */
+       if (flag)
+               enable_interrupts();
+
+       /* data polling for D7 */
+       start = get_timer (0);
+       while ((*((vu_long *)dest) & 0x00800080) != (data & 0x00800080)) {
+               if (get_timer(start) > CFG_FLASH_WRITE_TOUT) {
+                       return (1);
+               }
+       }
+       return (0);
+}
+
+/*-----------------------------------------------------------------------
+ */
+
+#endif /* !defined(CFG_FLASH_CFI_DRIVER) */
diff --git a/board/tqc/tqm8xx/load_sernum_ethaddr.c b/board/tqc/tqm8xx/load_sernum_ethaddr.c
new file mode 100644 (file)
index 0000000..143f368
--- /dev/null
@@ -0,0 +1,105 @@
+/*
+ * (C) Copyright 2000, 2001, 2002
+ * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+#include <common.h>
+#include <mpc8xx.h>
+
+/*-----------------------------------------------------------------------
+ * Process Hardware Information Block:
+ *
+ * If we boot on a system fresh from factory, check if the Hardware
+ * Information Block exists and save the information it contains.
+ *
+ * The TQM8xxL / TQM82xx Hardware Information Block is defined as
+ * follows:
+ * - located in first flash bank
+ * - starts at offset 0x0003FFC0
+ * - size 0x00000040
+ *
+ * Internal structure:
+ * - sequence of ASCII character strings
+ * - fields separated by a single space character (0x20)
+ * - last field terminated by NUL character (0x00)
+ * - remaining space filled with NUL characters (0x00)
+ *
+ * Fields in Hardware Information Block:
+ * 1) Module Type
+ * 2) Serial Number
+ * 3) First MAC Address
+ * 4) Number of additional MAC addresses
+ */
+
+void load_sernum_ethaddr (void)
+{
+       unsigned char *hwi;
+       unsigned char  serial [CFG_HWINFO_SIZE];
+       unsigned char  ethaddr[CFG_HWINFO_SIZE];
+       unsigned short ih, is, ie, part;
+
+       hwi = (unsigned char *)(CFG_FLASH_BASE + CFG_HWINFO_OFFSET);
+       ih = is = ie = 0;
+
+       if (*((unsigned long *)hwi) != (unsigned long)CFG_HWINFO_MAGIC) {
+               return;
+       }
+
+       part = 1;
+
+       /* copy serial # / MAC address */
+       while ((hwi[ih] != '\0') && (ih < CFG_HWINFO_SIZE)) {
+               if (hwi[ih] < ' ' || hwi[ih] > '~') { /* ASCII strings! */
+                       return;
+               }
+               switch (part) {
+               default:                /* Copy serial # */
+                       if (hwi[ih] == ' ') {
+                               ++part;
+                       }
+                       serial[is++] = hwi[ih];
+                       break;
+               case 3:                 /* Copy MAC address */
+                       if (hwi[ih] == ' ') {
+                               ++part;
+                               break;
+                       }
+                       ethaddr[ie++] = hwi[ih];
+                       if ((ie % 3) == 2)
+                               ethaddr[ie++] = ':';
+                       break;
+               }
+               ++ih;
+       }
+       serial[is]  = '\0';
+       if (ie && ethaddr[ie-1] == ':')
+               --ie;
+       ethaddr[ie] = '\0';
+
+       /* set serial# and ethaddr if not yet defined */
+       if (getenv("serial#") == NULL) {
+               setenv ((char *)"serial#", (char *)serial);
+       }
+
+       if (getenv("ethaddr") == NULL) {
+               setenv ((char *)"ethaddr", (char *)ethaddr);
+       }
+}
diff --git a/board/tqc/tqm8xx/tqm8xx.c b/board/tqc/tqm8xx/tqm8xx.c
new file mode 100644 (file)
index 0000000..18bf2a8
--- /dev/null
@@ -0,0 +1,554 @@
+/*
+ * (C) Copyright 2000-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
+ */
+
+#if 0
+#define DEBUG
+#endif
+
+#include <common.h>
+#include <mpc8xx.h>
+#ifdef CONFIG_PS2MULT
+#include <ps2mult.h>
+#endif
+
+DECLARE_GLOBAL_DATA_PTR;
+
+static long int dram_size (long int, long int *, long int);
+
+#define        _NOT_USED_      0xFFFFFFFF
+
+/* UPM initialization table for SDRAM: 40, 50, 66 MHz CLKOUT @ CAS latency 2, tWR=2 */
+const uint sdram_table[] =
+{
+       /*
+        * Single Read. (Offset 0 in UPMA RAM)
+        */
+       0x1F0DFC04, 0xEEAFBC04, 0x11AF7C04, 0xEFBAFC00,
+       0x1FF5FC47, /* last */
+       /*
+        * SDRAM Initialization (offset 5 in UPMA RAM)
+        *
+        * This is no UPM entry point. The following definition uses
+        * the remaining space to establish an initialization
+        * sequence, which is executed by a RUN command.
+        *
+        */
+                   0x1FF5FC34, 0xEFEABC34, 0x1FB57C35, /* last */
+       /*
+        * Burst Read. (Offset 8 in UPMA RAM)
+        */
+       0x1F0DFC04, 0xEEAFBC04, 0x10AF7C04, 0xF0AFFC00,
+       0xF0AFFC00, 0xF1AFFC00, 0xEFBAFC00, 0x1FF5FC47, /* last */
+       _NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
+       _NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
+       /*
+        * Single Write. (Offset 18 in UPMA RAM)
+        */
+       0x1F0DFC04, 0xEEABBC00, 0x11B77C04, 0xEFFAFC44,
+       0x1FF5FC47, /* last */
+                   _NOT_USED_, _NOT_USED_, _NOT_USED_,
+       /*
+        * Burst Write. (Offset 20 in UPMA RAM)
+        */
+       0x1F0DFC04, 0xEEABBC00, 0x10A77C00, 0xF0AFFC00,
+       0xF0AFFC00, 0xF0AFFC04, 0xE1BAFC44, 0x1FF5FC47, /* last */
+       _NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
+       _NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
+       /*
+        * Refresh  (Offset 30 in UPMA RAM)
+        */
+       0x1FFD7C84, 0xFFFFFC04, 0xFFFFFC04, 0xFFFFFC04,
+       0xFFFFFC84, 0xFFFFFC07, /* last */
+                               _NOT_USED_, _NOT_USED_,
+       _NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
+       /*
+        * Exception. (Offset 3c in UPMA RAM)
+        */
+       0xFFFFFC07, /* last */
+                   _NOT_USED_, _NOT_USED_, _NOT_USED_,
+};
+
+/* ------------------------------------------------------------------------- */
+
+
+/*
+ * Check Board Identity:
+ *
+ * Test TQ ID string (TQM8xx...)
+ * If present, check for "L" type (no second DRAM bank),
+ * otherwise "L" type is assumed as default.
+ *
+ * Set board_type to 'L' for "L" type, 'M' for "M" type, 0 else.
+ */
+
+int checkboard (void)
+{
+       char *s = getenv ("serial#");
+
+       puts ("Board: ");
+
+       if (!s || strncmp (s, "TQM8", 4)) {
+               puts ("### No HW ID - assuming TQM8xxL\n");
+               return (0);
+       }
+
+       if ((*(s + 6) == 'L')) {        /* a TQM8xxL type */
+               gd->board_type = 'L';
+       }
+
+       if ((*(s + 6) == 'M')) {        /* a TQM8xxM type */
+               gd->board_type = 'M';
+       }
+
+       if ((*(s + 6) == 'D')) {        /* a TQM885D type */
+               gd->board_type = 'D';
+       }
+
+       for (; *s; ++s) {
+               if (*s == ' ')
+                       break;
+               putc (*s);
+       }
+#ifdef CONFIG_VIRTLAB2
+       puts (" (Virtlab2)");
+#endif
+       putc ('\n');
+
+       return (0);
+}
+
+/* ------------------------------------------------------------------------- */
+
+long int initdram (int board_type)
+{
+       volatile immap_t *immap = (immap_t *) CFG_IMMR;
+       volatile memctl8xx_t *memctl = &immap->im_memctl;
+       long int size8, size9, size10;
+       long int size_b0 = 0;
+       long int size_b1 = 0;
+
+       upmconfig (UPMA, (uint *) sdram_table,
+                          sizeof (sdram_table) / sizeof (uint));
+
+       /*
+        * Preliminary prescaler for refresh (depends on number of
+        * banks): This value is selected for four cycles every 62.4 us
+        * with two SDRAM banks or four cycles every 31.2 us with one
+        * bank. It will be adjusted after memory sizing.
+        */
+       memctl->memc_mptpr = CFG_MPTPR_2BK_8K;
+
+       /*
+        * The following value is used as an address (i.e. opcode) for
+        * the LOAD MODE REGISTER COMMAND during SDRAM initialisation. If
+        * the port size is 32bit the SDRAM does NOT "see" the lower two
+        * address lines, i.e. mar=0x00000088 -> opcode=0x00000022 for
+        * MICRON SDRAMs:
+        * ->    0 00 010 0 010
+        *       |  |   | |   +- Burst Length = 4
+        *       |  |   | +----- Burst Type   = Sequential
+        *       |  |   +------- CAS Latency  = 2
+        *       |  +----------- Operating Mode = Standard
+        *       +-------------- Write Burst Mode = Programmed Burst Length
+        */
+       memctl->memc_mar = 0x00000088;
+
+       /*
+        * Map controller banks 2 and 3 to the SDRAM banks 2 and 3 at
+        * preliminary addresses - these have to be modified after the
+        * SDRAM size has been determined.
+        */
+       memctl->memc_or2 = CFG_OR2_PRELIM;
+       memctl->memc_br2 = CFG_BR2_PRELIM;
+
+#ifndef        CONFIG_CAN_DRIVER
+       if ((board_type != 'L') &&
+           (board_type != 'M') &&
+           (board_type != 'D') ) {     /* only one SDRAM bank on L, M and D modules */
+               memctl->memc_or3 = CFG_OR3_PRELIM;
+               memctl->memc_br3 = CFG_BR3_PRELIM;
+       }
+#endif                                                 /* CONFIG_CAN_DRIVER */
+
+       memctl->memc_mamr = CFG_MAMR_8COL & (~(MAMR_PTAE));     /* no refresh yet */
+
+       udelay (200);
+
+       /* perform SDRAM initializsation sequence */
+
+       memctl->memc_mcr = 0x80004105;  /* SDRAM bank 0 */
+       udelay (1);
+       memctl->memc_mcr = 0x80004230;  /* SDRAM bank 0 - execute twice */
+       udelay (1);
+
+#ifndef        CONFIG_CAN_DRIVER
+       if ((board_type != 'L') &&
+           (board_type != 'M') &&
+           (board_type != 'D') ) {     /* only one SDRAM bank on L, M and D modules */
+               memctl->memc_mcr = 0x80006105;  /* SDRAM bank 1 */
+               udelay (1);
+               memctl->memc_mcr = 0x80006230;  /* SDRAM bank 1 - execute twice */
+               udelay (1);
+       }
+#endif                                                 /* CONFIG_CAN_DRIVER */
+
+       memctl->memc_mamr |= MAMR_PTAE; /* enable refresh */
+
+       udelay (1000);
+
+       /*
+        * Check Bank 0 Memory Size for re-configuration
+        *
+        * try 8 column mode
+        */
+       size8 = dram_size (CFG_MAMR_8COL, SDRAM_BASE2_PRELIM, SDRAM_MAX_SIZE);
+       debug ("SDRAM Bank 0 in 8 column mode: %ld MB\n", size8 >> 20);
+
+       udelay (1000);
+
+       /*
+        * try 9 column mode
+        */
+       size9 = dram_size (CFG_MAMR_9COL, SDRAM_BASE2_PRELIM, SDRAM_MAX_SIZE);
+       debug ("SDRAM Bank 0 in 9 column mode: %ld MB\n", size9 >> 20);
+
+       udelay(1000);
+
+#if defined(CFG_MAMR_10COL)
+       /*
+        * try 10 column mode
+        */
+       size10 = dram_size (CFG_MAMR_10COL, SDRAM_BASE2_PRELIM, SDRAM_MAX_SIZE);
+       debug ("SDRAM Bank 0 in 10 column mode: %ld MB\n", size10 >> 20);
+#else
+       size10 = 0;
+#endif /* CFG_MAMR_10COL */
+
+       if ((size8 < size10) && (size9 < size10)) {
+               size_b0 = size10;
+       } else if ((size8 < size9) && (size10 < size9)) {
+               size_b0 = size9;
+               memctl->memc_mamr = CFG_MAMR_9COL;
+               udelay (500);
+       } else {
+               size_b0 = size8;
+               memctl->memc_mamr = CFG_MAMR_8COL;
+               udelay (500);
+       }
+       debug ("SDRAM Bank 0: %ld MB\n", size_b0 >> 20);
+
+#ifndef        CONFIG_CAN_DRIVER
+       if ((board_type != 'L') &&
+           (board_type != 'M') &&
+           (board_type != 'D') ) {     /* only one SDRAM bank on L, M and D modules */
+               /*
+                * Check Bank 1 Memory Size
+                * use current column settings
+                * [9 column SDRAM may also be used in 8 column mode,
+                *  but then only half the real size will be used.]
+                */
+               size_b1 = dram_size (memctl->memc_mamr, (long int *)SDRAM_BASE3_PRELIM,
+                                    SDRAM_MAX_SIZE);
+               debug ("SDRAM Bank 1: %ld MB\n", size_b1 >> 20);
+       } else {
+               size_b1 = 0;
+       }
+#endif /* CONFIG_CAN_DRIVER */
+
+       udelay (1000);
+
+       /*
+        * Adjust refresh rate depending on SDRAM type, both banks
+        * For types > 128 MBit leave it at the current (fast) rate
+        */
+       if ((size_b0 < 0x02000000) && (size_b1 < 0x02000000)) {
+               /* reduce to 15.6 us (62.4 us / quad) */
+               memctl->memc_mptpr = CFG_MPTPR_2BK_4K;
+               udelay (1000);
+       }
+
+       /*
+        * Final mapping: map bigger bank first
+        */
+       if (size_b1 > size_b0) {        /* SDRAM Bank 1 is bigger - map first   */
+
+               memctl->memc_or3 = ((-size_b1) & 0xFFFF0000) | CFG_OR_TIMING_SDRAM;
+               memctl->memc_br3 = (CFG_SDRAM_BASE & BR_BA_MSK) | BR_MS_UPMA | BR_V;
+
+               if (size_b0 > 0) {
+                       /*
+                        * Position Bank 0 immediately above Bank 1
+                        */
+                       memctl->memc_or2 = ((-size_b0) & 0xFFFF0000) | CFG_OR_TIMING_SDRAM;
+                       memctl->memc_br2 = ((CFG_SDRAM_BASE & BR_BA_MSK) | BR_MS_UPMA | BR_V)
+                                          + size_b1;
+               } else {
+                       unsigned long reg;
+
+                       /*
+                        * No bank 0
+                        *
+                        * invalidate bank
+                        */
+                       memctl->memc_br2 = 0;
+
+                       /* adjust refresh rate depending on SDRAM type, one bank */
+                       reg = memctl->memc_mptpr;
+                       reg >>= 1;                      /* reduce to CFG_MPTPR_1BK_8K / _4K */
+                       memctl->memc_mptpr = reg;
+               }
+
+       } else {                                        /* SDRAM Bank 0 is bigger - map first   */
+
+               memctl->memc_or2 = ((-size_b0) & 0xFFFF0000) | CFG_OR_TIMING_SDRAM;
+               memctl->memc_br2 =
+                               (CFG_SDRAM_BASE & BR_BA_MSK) | BR_MS_UPMA | BR_V;
+
+               if (size_b1 > 0) {
+                       /*
+                        * Position Bank 1 immediately above Bank 0
+                        */
+                       memctl->memc_or3 =
+                                       ((-size_b1) & 0xFFFF0000) | CFG_OR_TIMING_SDRAM;
+                       memctl->memc_br3 =
+                                       ((CFG_SDRAM_BASE & BR_BA_MSK) | BR_MS_UPMA | BR_V)
+                                       + size_b0;
+               } else {
+                       unsigned long reg;
+
+#ifndef        CONFIG_CAN_DRIVER
+                       /*
+                        * No bank 1
+                        *
+                        * invalidate bank
+                        */
+                       memctl->memc_br3 = 0;
+#endif                                                 /* CONFIG_CAN_DRIVER */
+
+                       /* adjust refresh rate depending on SDRAM type, one bank */
+                       reg = memctl->memc_mptpr;
+                       reg >>= 1;                      /* reduce to CFG_MPTPR_1BK_8K / _4K */
+                       memctl->memc_mptpr = reg;
+               }
+       }
+
+       udelay (10000);
+
+#ifdef CONFIG_CAN_DRIVER
+       /* UPM initialization for CAN @ CLKOUT <= 66 MHz */
+
+       /* Initialize OR3 / BR3 */
+       memctl->memc_or3 = CFG_OR3_CAN;
+       memctl->memc_br3 = CFG_BR3_CAN;
+
+       /* Initialize MBMR */
+       memctl->memc_mbmr = MBMR_GPL_B4DIS;     /* GPL_B4 ouput line Disable */
+
+       /* Initialize UPMB for CAN: single read */
+       memctl->memc_mdr = 0xFFFFCC04;
+       memctl->memc_mcr = 0x0100 | UPMB;
+
+       memctl->memc_mdr = 0x0FFFD004;
+       memctl->memc_mcr = 0x0101 | UPMB;
+
+       memctl->memc_mdr = 0x0FFFC000;
+       memctl->memc_mcr = 0x0102 | UPMB;
+
+       memctl->memc_mdr = 0x3FFFC004;
+       memctl->memc_mcr = 0x0103 | UPMB;
+
+       memctl->memc_mdr = 0xFFFFDC07;
+       memctl->memc_mcr = 0x0104 | UPMB;
+
+       /* Initialize UPMB for CAN: single write */
+       memctl->memc_mdr = 0xFFFCCC04;
+       memctl->memc_mcr = 0x0118 | UPMB;
+
+       memctl->memc_mdr = 0xCFFCDC04;
+       memctl->memc_mcr = 0x0119 | UPMB;
+
+       memctl->memc_mdr = 0x3FFCC000;
+       memctl->memc_mcr = 0x011A | UPMB;
+
+       memctl->memc_mdr = 0xFFFCC004;
+       memctl->memc_mcr = 0x011B | UPMB;
+
+       memctl->memc_mdr = 0xFFFDC405;
+       memctl->memc_mcr = 0x011C | UPMB;
+#endif                                                 /* CONFIG_CAN_DRIVER */
+
+#ifdef CONFIG_ISP1362_USB
+       /* Initialize OR5 / BR5 */
+       memctl->memc_or5 = CFG_OR5_ISP1362;
+       memctl->memc_br5 = CFG_BR5_ISP1362;
+#endif                                                 /* CONFIG_ISP1362_USB */
+
+
+       return (size_b0 + size_b1);
+}
+
+/* ------------------------------------------------------------------------- */
+
+/*
+ * Check memory range for valid RAM. A simple memory test determines
+ * the actually available RAM size between addresses `base' and
+ * `base + maxsize'. Some (not all) hardware errors are detected:
+ * - short between address lines
+ * - short between data lines
+ */
+
+static long int dram_size (long int mamr_value, long int *base, long int maxsize)
+{
+       volatile immap_t *immap = (immap_t *) CFG_IMMR;
+       volatile memctl8xx_t *memctl = &immap->im_memctl;
+
+       memctl->memc_mamr = mamr_value;
+
+       return (get_ram_size(base, maxsize));
+}
+
+/* ------------------------------------------------------------------------- */
+
+#ifdef CONFIG_PS2MULT
+
+#ifdef CONFIG_HMI10
+#define BASE_BAUD ( 1843200 / 16 )
+struct serial_state rs_table[] = {
+       { BASE_BAUD, 4,  (void*)0xec140000 },
+       { BASE_BAUD, 2,  (void*)0xec150000 },
+       { BASE_BAUD, 6,  (void*)0xec160000 },
+       { BASE_BAUD, 10, (void*)0xec170000 },
+};
+
+#ifdef CONFIG_BOARD_EARLY_INIT_R
+int board_early_init_r (void)
+{
+       ps2mult_early_init();
+       return (0);
+}
+#endif
+#endif /* CONFIG_HMI10 */
+
+#endif /* CONFIG_PS2MULT */
+
+/* ---------------------------------------------------------------------------- */
+/* HMI10 specific stuff                                                                */
+/* ---------------------------------------------------------------------------- */
+#ifdef CONFIG_HMI10
+
+int misc_init_r (void)
+{
+# ifdef CONFIG_IDE_LED
+       volatile immap_t *immap = (immap_t *) CFG_IMMR;
+
+       /* Configure PA15 as output port */
+       immap->im_ioport.iop_padir |= 0x0001;
+       immap->im_ioport.iop_paodr |= 0x0001;
+       immap->im_ioport.iop_papar &= ~0x0001;
+       immap->im_ioport.iop_padat &= ~0x0001;  /* turn it off */
+# endif
+       return (0);
+}
+
+# ifdef CONFIG_IDE_LED
+void ide_led (uchar led, uchar status)
+{
+       volatile immap_t *immap = (immap_t *) CFG_IMMR;
+
+       /* We have one led for both pcmcia slots */
+       if (status) {                           /* led on */
+               immap->im_ioport.iop_padat |= 0x0001;
+       } else {
+               immap->im_ioport.iop_padat &= ~0x0001;
+       }
+}
+# endif
+#endif /* CONFIG_HMI10 */
+
+/* ---------------------------------------------------------------------------- */
+/* NSCU specific stuff                                                         */
+/* ---------------------------------------------------------------------------- */
+#ifdef CONFIG_NSCU
+
+int misc_init_r (void)
+{
+       volatile immap_t *immr = (immap_t *) CFG_IMMR;
+
+       /* wake up ethernet module */
+       immr->im_ioport.iop_pcpar &= ~0x0004; /* GPIO pin       */
+       immr->im_ioport.iop_pcdir |=  0x0004; /* output         */
+       immr->im_ioport.iop_pcso  &= ~0x0004; /* for clarity    */
+       immr->im_ioport.iop_pcdat |=  0x0004; /* enable         */
+
+       return (0);
+}
+#endif /* CONFIG_NSCU */
+
+/* ---------------------------------------------------------------------------- */
+/* TK885D specific initializaion                                               */
+/* ---------------------------------------------------------------------------- */
+#ifdef CONFIG_TK885D
+#include <miiphy.h>
+int last_stage_init(void)
+{
+       const unsigned char phy[] = {CONFIG_FEC1_PHY, CONFIG_FEC2_PHY};
+       unsigned short reg;
+       int ret, i = 100;
+       char *s;
+
+       mii_init();
+       /* Without this delay 0xff is read from the UART buffer later in
+        * abortboot() and autoboot is aborted */
+       udelay(10000);
+       while (tstc() && i--)
+               (void)getc();
+
+       /* Check if auto-negotiation is prohibited */
+       s = getenv("phy_auto_nego");
+
+       if (!s || !strcmp(s, "on"))
+               /* Nothing to do - autonegotiation by default */
+               return 0;
+
+       for (i = 0; i < 2; i++) {
+               ret = miiphy_read("FEC ETHERNET", phy[i], PHY_BMCR, &reg);
+               if (ret) {
+                       printf("Cannot read BMCR on PHY %d\n", phy[i]);
+                       return 0;
+               }
+               /* Auto-negotiation off, hard set full duplex, 100Mbps */
+               ret = miiphy_write("FEC ETHERNET", phy[i],
+                                  PHY_BMCR, (reg | PHY_BMCR_100MB |
+                                             PHY_BMCR_DPLX) & ~PHY_BMCR_AUTON);
+               if (ret) {
+                       printf("Cannot write BMCR on PHY %d\n", phy[i]);
+                       return 0;
+               }
+       }
+
+       return 0;
+}
+
+#endif
+
+/* ------------------------------------------------------------------------- */
diff --git a/board/tqc/tqm8xx/u-boot.lds b/board/tqc/tqm8xx/u-boot.lds
new file mode 100644 (file)
index 0000000..8c46e46
--- /dev/null
@@ -0,0 +1,143 @@
+/*
+ * (C) Copyright 2000
+ * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+OUTPUT_ARCH(powerpc)
+/* Do we need any of these for elf?
+   __DYNAMIC = 0;    */
+SECTIONS
+{
+  /* Read-only sections, merged into text segment: */
+  . = + SIZEOF_HEADERS;
+  .interp : { *(.interp) }
+  .hash          : { *(.hash)          }
+  .dynsym        : { *(.dynsym)                }
+  .dynstr        : { *(.dynstr)                }
+  .rel.text      : { *(.rel.text)      }
+  .rela.text     : { *(.rela.text)     }
+  .rel.data      : { *(.rel.data)      }
+  .rela.data     : { *(.rela.data)     }
+  .rel.rodata    : { *(.rel.rodata)    }
+  .rela.rodata   : { *(.rela.rodata)   }
+  .rel.got       : { *(.rel.got)       }
+  .rela.got      : { *(.rela.got)      }
+  .rel.ctors     : { *(.rel.ctors)     }
+  .rela.ctors    : { *(.rela.ctors)    }
+  .rel.dtors     : { *(.rel.dtors)     }
+  .rela.dtors    : { *(.rela.dtors)    }
+  .rel.bss       : { *(.rel.bss)       }
+  .rela.bss      : { *(.rela.bss)      }
+  .rel.plt       : { *(.rel.plt)       }
+  .rela.plt      : { *(.rela.plt)      }
+  .init          : { *(.init)          }
+  .plt : { *(.plt) }
+  .text      :
+  {
+    /* WARNING - the following is hand-optimized to fit within */
+    /* the sector layout of our flash chips!   XXX FIXME XXX   */
+
+    cpu/mpc8xx/start.o         (.text)
+    cpu/mpc8xx/traps.o         (.text)
+    common/dlmalloc.o          (.text)
+    lib_ppc/ppcstring.o                (.text)
+    lib_generic/vsprintf.o     (.text)
+    lib_generic/crc32.o                (.text)
+    lib_generic/zlib.o         (.text)
+    lib_ppc/cache.o            (.text)
+    lib_ppc/time.o             (.text)
+
+    . = DEFINED(env_offset) ? env_offset : .;
+    common/environment.o       (.ppcenv)
+
+    *(.text)
+    *(.fixup)
+    *(.got1)
+  }
+  _etext = .;
+  PROVIDE (etext = .);
+  .rodata    :
+  {
+    *(.rodata)
+    *(.rodata1)
+    *(.rodata.str1.4)
+    *(.eh_frame)
+  }
+  .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 (NOLOAD)       :
+  {
+   *(.sbss) *(.scommon)
+   *(.dynbss)
+   *(.bss)
+   *(COMMON)
+  }
+  _end = . ;
+  PROVIDE (end = .);
+}
diff --git a/board/tqc/tqm8xx/u-boot.lds.debug b/board/tqc/tqm8xx/u-boot.lds.debug
new file mode 100644 (file)
index 0000000..c33581d
--- /dev/null
@@ -0,0 +1,136 @@
+/*
+ * (C) Copyright 2000
+ * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+OUTPUT_ARCH(powerpc)
+/* Do we need any of these for elf?
+   __DYNAMIC = 0;    */
+SECTIONS
+{
+  /* Read-only sections, merged into text segment: */
+  . = + SIZEOF_HEADERS;
+  .interp : { *(.interp) }
+  .hash          : { *(.hash)          }
+  .dynsym        : { *(.dynsym)                }
+  .dynstr        : { *(.dynstr)                }
+  .rel.text      : { *(.rel.text)              }
+  .rela.text     : { *(.rela.text)     }
+  .rel.data      : { *(.rel.data)              }
+  .rela.data     : { *(.rela.data)     }
+  .rel.rodata    : { *(.rel.rodata)    }
+  .rela.rodata   : { *(.rela.rodata)   }
+  .rel.got       : { *(.rel.got)               }
+  .rela.got      : { *(.rela.got)              }
+  .rel.ctors     : { *(.rel.ctors)     }
+  .rela.ctors    : { *(.rela.ctors)    }
+  .rel.dtors     : { *(.rel.dtors)     }
+  .rela.dtors    : { *(.rela.dtors)    }
+  .rel.bss       : { *(.rel.bss)               }
+  .rela.bss      : { *(.rela.bss)              }
+  .rel.plt       : { *(.rel.plt)               }
+  .rela.plt      : { *(.rela.plt)              }
+  .init          : { *(.init)  }
+  .plt : { *(.plt) }
+  .text      :
+  {
+    /* WARNING - the following is hand-optimized to fit within */
+    /* the sector layout of our flash chips!   XXX FIXME XXX   */
+
+    cpu/mpc8xx/start.o (.text)
+    common/dlmalloc.o  (.text)
+    lib_generic/vsprintf.o     (.text)
+    lib_generic/crc32.o                (.text)
+
+    . = env_offset;
+    common/environment.o(.text)
+
+    *(.text)
+    *(.fixup)
+    *(.got1)
+  }
+  _etext = .;
+  PROVIDE (etext = .);
+  .rodata    :
+  {
+    *(.rodata)
+    *(.rodata1)
+    *(.rodata.str1.4)
+    *(.eh_frame)
+  }
+  .fini      : { *(.fini)    } =0
+  .ctors     : { *(.ctors)   }
+  .dtors     : { *(.dtors)   }
+
+  /* Read-write section, merged into data segment: */
+  . = (. + 0x0FFF) & 0xFFFFF000;
+  _erotext = .;
+  PROVIDE (erotext = .);
+  .reloc   :
+  {
+    *(.got)
+    _GOT2_TABLE_ = .;
+    *(.got2)
+    _FIXUP_TABLE_ = .;
+    *(.fixup)
+  }
+  __got2_entries = (_FIXUP_TABLE_ - _GOT2_TABLE_) >>2;
+  __fixup_entries = (. - _FIXUP_TABLE_)>>2;
+
+  .data    :
+  {
+    *(.data)
+    *(.data1)
+    *(.sdata)
+    *(.sdata2)
+    *(.dynamic)
+    CONSTRUCTORS
+  }
+  _edata  =  .;
+  PROVIDE (edata = .);
+
+  __u_boot_cmd_start = .;
+  .u_boot_cmd : { *(.u_boot_cmd) }
+  __u_boot_cmd_end = .;
+
+
+  __start___ex_table = .;
+  __ex_table : { *(__ex_table) }
+  __stop___ex_table = .;
+
+  . = ALIGN(4096);
+  __init_begin = .;
+  .text.init : { *(.text.init) }
+  .data.init : { *(.data.init) }
+  . = ALIGN(4096);
+  __init_end = .;
+
+  __bss_start = .;
+  .bss       :
+  {
+   *(.sbss) *(.scommon)
+   *(.dynbss)
+   *(.bss)
+   *(COMMON)
+  }
+  _end = . ;
+  PROVIDE (end = .);
+}
diff --git a/board/tqm5200/Makefile b/board/tqm5200/Makefile
deleted file mode 100644 (file)
index a5ce7bd..0000000
+++ /dev/null
@@ -1,53 +0,0 @@
-#
-# (C) Copyright 2003-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 cmd_stk52xx.o cmd_tb5200.o cam5200_flash.o
-
-SRCS   := $(SOBJS:.o=.S) $(COBJS:.o=.c)
-OBJS   := $(addprefix $(obj),$(COBJS))
-SOBJS  := $(addprefix $(obj),$(SOBJS))
-
-$(LIB):        $(obj).depend $(OBJS)
-       $(AR) $(ARFLAGS) $@ $(OBJS)
-
-clean:
-       rm -f $(SOBJS) $(OBJS)
-
-distclean:     clean
-       rm -f $(LIB) core *.bak .depend
-
-cam5200_flash.o:       cam5200_flash.c
-       $(CC) $(CFLAGS) -fno-strict-aliasing -c -o $@ $<
-
-#########################################################################
-
-# defines $(obj).depend target
-include $(SRCTREE)/rules.mk
-
-sinclude $(obj).depend
-
-#########################################################################
diff --git a/board/tqm5200/cam5200_flash.c b/board/tqm5200/cam5200_flash.c
deleted file mode 100644 (file)
index b3f095d..0000000
+++ /dev/null
@@ -1,786 +0,0 @@
-/*
- * (C) Copyright 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 <common.h>
-#include <mpc5xxx.h>
-#include <asm/processor.h>
-
-#if defined(CONFIG_CAM5200) && defined(CONFIG_CAM5200_NIOSFLASH)
-
-#if 0
-#define DEBUGF(x...) printf(x)
-#else
-#define DEBUGF(x...)
-#endif
-
-#define swap16(x) __swab16(x)
-
-flash_info_t flash_info[CFG_MAX_FLASH_BANKS];  /* info for FLASH chips */
-
-/*
- * CAM5200 is a TQM5200B based board. Additionally it also features
- * a NIOS cpu. The NIOS CPU peripherals are accessible through MPC5xxx
- * Local Bus on CS5. This includes 32 bit wide RAM and SRAM as well as
- * 16 bit wide flash device. Big Endian order on a 32 bit CS5 makes
- * access to flash chip slightly more complicated as additional byte
- * swapping is necessary within each 16 bit wide flash 'word'.
- *
- * This driver's task is to handle both flash devices: 32 bit TQM5200B
- * flash chip and 16 bit NIOS cpu flash chip. In the below
- * flash_addr_table table we use least significant address bit to mark
- * 16 bit flash bank and two sets of routines *_32 and *_16 to handle
- * specifics of both flashes.
- */
-static unsigned long flash_addr_table[][CFG_MAX_FLASH_BANKS] = {
-       {CFG_BOOTCS_START, CFG_CS5_START | 1}
-};
-
-/*-----------------------------------------------------------------------
- * Functions
- */
-static int write_word(flash_info_t * info, ulong dest, ulong data);
-#ifdef CFG_FLASH_2ND_16BIT_DEV
-static int write_word_32(flash_info_t * info, ulong dest, ulong data);
-static int write_word_16(flash_info_t * info, ulong dest, ulong data);
-static int flash_erase_32(flash_info_t * info, int s_first, int s_last);
-static int flash_erase_16(flash_info_t * info, int s_first, int s_last);
-static ulong flash_get_size_32(vu_long * addr, flash_info_t * info);
-static ulong flash_get_size_16(vu_long * addr, flash_info_t * info);
-#endif
-
-void flash_print_info(flash_info_t * info)
-{
-       int i, k;
-       int size, erased;
-       volatile unsigned long *flash;
-
-       if (info->flash_id == FLASH_UNKNOWN) {
-               printf("missing or unknown FLASH type\n");
-               return;
-       }
-
-       switch (info->flash_id & FLASH_VENDMASK) {
-               case FLASH_MAN_AMD:
-                       printf("AMD ");
-                       break;
-               case FLASH_MAN_FUJ:
-                       printf("FUJITSU ");
-                       break;
-               default:
-                       printf("Unknown Vendor ");
-                       break;
-       }
-
-       switch (info->flash_id & FLASH_TYPEMASK) {
-               case FLASH_S29GL128N:
-                       printf ("S29GL128N (256 Mbit, uniform sector size)\n");
-                       break;
-               case FLASH_AM320B:
-                       printf ("29LV320B (32 Mbit, bottom boot sect)\n");
-                       break;
-               case FLASH_AM320T:
-                       printf ("29LV320T (32 Mbit, top boot sect)\n");
-                       break;
-               default:
-                       printf("Unknown Chip Type\n");
-                       break;
-       }
-
-       printf("  Size: %ld KB in %d Sectors\n",
-                       info->size >> 10, info->sector_count);
-
-       printf("  Sector Start Addresses:");
-       for (i = 0; i < info->sector_count; ++i) {
-               /*
-                * Check if whole sector is erased
-                */
-               if (i != (info->sector_count - 1))
-                       size = info->start[i + 1] - info->start[i];
-               else
-                       size = info->start[0] + info->size - info->start[i];
-
-               erased = 1;
-               flash = (volatile unsigned long *)info->start[i];
-               size = size >> 2;       /* divide by 4 for longword access */
-
-               for (k = 0; k < size; k++) {
-                       if (*flash++ != 0xffffffff) {
-                               erased = 0;
-                               break;
-                       }
-               }
-
-               if ((i % 5) == 0)
-                       printf("\n   ");
-
-               printf(" %08lX%s%s", info->start[i],
-                               erased ? " E" : "  ",
-                               info->protect[i] ? "RO " : "   ");
-       }
-       printf("\n");
-       return;
-}
-
-
-/*
- * The following code cannot be run from FLASH!
- */
-#ifdef CFG_FLASH_2ND_16BIT_DEV
-static ulong flash_get_size(vu_long * addr, flash_info_t * info)
-{
-
-       DEBUGF("get_size: FLASH ADDR %08lx\n", addr);
-
-       /* bit 0 used for big flash marking */
-       if ((ulong)addr & 0x1)
-               return flash_get_size_16((vu_long *)((ulong)addr & 0xfffffffe), info);
-       else
-               return flash_get_size_32(addr, info);
-}
-
-static ulong flash_get_size_32(vu_long * addr, flash_info_t * info)
-#else
-static ulong flash_get_size(vu_long * addr, flash_info_t * info)
-#endif
-{
-       short i;
-       CFG_FLASH_WORD_SIZE value;
-       ulong base = (ulong) addr;
-       volatile CFG_FLASH_WORD_SIZE *addr2 = (CFG_FLASH_WORD_SIZE *) addr;
-
-       DEBUGF("get_size32: FLASH ADDR: %08x\n", (unsigned)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];
-       DEBUGF("FLASH MANUFACT: %x\n", value);
-
-       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            */
-       DEBUGF("\nFLASH DEVICEID: %x\n", value);
-
-       switch (value) {
-               case AMD_ID_MIRROR:
-                       DEBUGF("Mirror Bit flash: addr[14] = %08lX  addr[15] = %08lX\n",
-                                       addr[14], addr[15]);
-                       switch(addr[14]) {
-                               case AMD_ID_GL128N_2:
-                                       if (addr[15] != AMD_ID_GL128N_3) {
-                                               DEBUGF("Chip: S29GL128N -> unknown\n");
-                                               info->flash_id = FLASH_UNKNOWN;
-                                       } else {
-                                               DEBUGF("Chip: S29GL128N\n");
-                                               info->flash_id += FLASH_S29GL128N;
-                                               info->sector_count = 128;
-                                               info->size = 0x02000000;
-                                       }
-                                       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 * 0x00040000);
-
-       /* check for protected sectors */
-       for (i = 0; i < info->sector_count; i++) {
-               /* read sector protection at sector address, (A7 .. A0) = 0x02 */
-               /* D0 = 1 if protected */
-               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 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;
-}
-
-#ifdef CFG_FLASH_2ND_16BIT_DEV
-int flash_erase(flash_info_t * info, int s_first, int s_last)
-{
-       if ((info->flash_id & FLASH_TYPEMASK) == FLASH_AM320B) {
-               return flash_erase_16(info, s_first, s_last);
-       } else {
-               return flash_erase_32(info, s_first, s_last);
-       }
-}
-
-static int flash_erase_32(flash_info_t * info, int s_first, int s_last)
-#else
-int flash_erase(flash_info_t * info, int s_first, int s_last)
-#endif
-{
-       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;
-
-       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)!!
-                        */
-                       wait_for_DQ7_32(info, sect);
-               }
-       }
-
-       /* re-enable interrupts if necessary */
-       if (flag)
-               enable_interrupts();
-
-       /* wait at least 80us - let's wait 1 ms */
-       udelay(1000);
-
-       /* reset to read mode */
-       addr = (CFG_FLASH_WORD_SIZE *) info->start[0];
-       addr[0] = (CFG_FLASH_WORD_SIZE) 0x00F000F0;     /* reset bank */
-
-       printf(" done\n");
-       return 0;
-}
-
-/*-----------------------------------------------------------------------
- * Copy memory to flash, returns:
- * 0 - OK
- * 1 - write timeout
- * 2 - Flash not erased
- */
-int write_buff(flash_info_t * info, uchar * src, ulong addr, ulong cnt)
-{
-       ulong cp, wp, data;
-       int i, l, rc;
-
-       wp = (addr & ~3);       /* get lower word aligned address */
-
-       /*
-        * handle unaligned start bytes
-        */
-       if ((l = addr - wp) != 0) {
-               data = 0;
-               for (i = 0, cp = wp; i < l; ++i, ++cp)
-                       data = (data << 8) | (*(uchar *) cp);
-
-               for (; i < 4 && cnt > 0; ++i) {
-                       data = (data << 8) | *src++;
-                       --cnt;
-                       ++cp;
-               }
-
-               for (; cnt == 0 && i < 4; ++i, ++cp)
-                       data = (data << 8) | (*(uchar *) cp);
-
-               if ((rc = write_word(info, wp, data)) != 0)
-                       return (rc);
-
-               wp += 4;
-       }
-
-       /*
-        * handle word aligned part
-        */
-       while (cnt >= 4) {
-               data = 0;
-               for (i = 0; i < 4; ++i)
-                       data = (data << 8) | *src++;
-
-               if ((rc = write_word(info, wp, data)) != 0)
-                       return (rc);
-
-               wp += 4;
-               cnt -= 4;
-       }
-
-       if (cnt == 0)
-               return (0);
-
-       /*
-        * handle unaligned tail bytes
-        */
-       data = 0;
-       for (i = 0, cp = wp; i < 4 && cnt > 0; ++i, ++cp) {
-               data = (data << 8) | *src++;
-               --cnt;
-       }
-       for (; i < 4; ++i, ++cp)
-               data = (data << 8) | (*(uchar *) cp);
-
-       return (write_word(info, wp, data));
-}
-
-/*-----------------------------------------------------------------------
- * Copy memory to flash, returns:
- * 0 - OK
- * 1 - write timeout
- * 2 - Flash not erased
- */
-#ifdef CFG_FLASH_2ND_16BIT_DEV
-static int write_word(flash_info_t * info, ulong dest, ulong data)
-{
-       if ((info->flash_id & FLASH_TYPEMASK) == FLASH_AM320B) {
-               return write_word_16(info, dest, data);
-       } else {
-               return write_word_32(info, dest, data);
-       }
-}
-
-static int write_word_32(flash_info_t * info, ulong dest, ulong data)
-#else
-static int write_word(flash_info_t * info, ulong dest, ulong data)
-#endif
-{
-       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 i, flag;
-
-       /* Check if Flash is (sufficiently) erased */
-       if ((*((vu_long *)dest) & data) != data)
-               return (2);
-
-       for (i = 0; i < 4 / sizeof(CFG_FLASH_WORD_SIZE); i++) {
-               /* 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[i] = data2[i];
-
-               /* re-enable interrupts if necessary */
-               if (flag)
-                       enable_interrupts();
-
-               /* data polling for D7 */
-               start = get_timer(0);
-               while ((dest2[i] & (CFG_FLASH_WORD_SIZE) 0x00800080) !=
-                               (data2[i] & (CFG_FLASH_WORD_SIZE) 0x00800080)) {
-
-                       if (get_timer(start) > CFG_FLASH_WRITE_TOUT)
-                               return (1);
-               }
-       }
-
-       return (0);
-}
-
-#ifdef CFG_FLASH_2ND_16BIT_DEV
-
-#undef  CFG_FLASH_WORD_SIZE
-#define CFG_FLASH_WORD_SIZE unsigned short
-
-/*
- * The following code cannot be run from FLASH!
- */
-static ulong flash_get_size_16(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;
-
-       DEBUGF("get_size16: FLASH ADDR: %08x\n", (unsigned)addr);
-
-       /* issue bank reset to return to read mode */
-       addr2[0] = (CFG_FLASH_WORD_SIZE) 0xF000F000;
-
-       /* Write auto select command: read Manufacturer ID */
-       addr2[CFG_FLASH_ADDR0] = (CFG_FLASH_WORD_SIZE) 0xAA00AA00;
-       addr2[CFG_FLASH_ADDR1] = (CFG_FLASH_WORD_SIZE) 0x55005500;
-       addr2[CFG_FLASH_ADDR0] = (CFG_FLASH_WORD_SIZE) 0x90009000;
-       udelay(1000);
-
-       value = swap16(addr2[0]);
-       DEBUGF("FLASH MANUFACT: %x\n", value);
-
-       switch (value) {
-               case (CFG_FLASH_WORD_SIZE) AMD_MANUFACT:
-                       info->flash_id = FLASH_MAN_AMD;
-                       break;
-               case (CFG_FLASH_WORD_SIZE) FUJ_MANUFACT:
-                       info->flash_id = FLASH_MAN_FUJ;
-                       break;
-               default:
-                       info->flash_id = FLASH_UNKNOWN;
-                       info->sector_count = 0;
-                       info->size = 0;
-                       return (0);     /* no or unknown flash  */
-       }
-
-       value = swap16(addr2[1]);       /* device ID            */
-       DEBUGF("\nFLASH DEVICEID: %x\n", value);
-
-       switch (value) {
-               case (CFG_FLASH_WORD_SIZE)AMD_ID_LV320B:
-                       info->flash_id += FLASH_AM320B;
-                       info->sector_count = 71;
-                       info->size = 0x00400000;
-                       break;  /* => 4 MB      */
-               case (CFG_FLASH_WORD_SIZE)AMD_ID_LV320T:
-                       info->flash_id += FLASH_AM320T;
-                       info->sector_count = 71;
-                       info->size = 0x00400000;
-                       break;  /* => 4 MB      */
-               default:
-                       info->flash_id = FLASH_UNKNOWN;
-                       return (0);     /* => no or unknown flash */
-       }
-
-       if (info->flash_id & FLASH_BTYPE) {
-               /* set sector offsets for bottom boot block type        */
-               info->start[0] = base + 0x00000000;
-               info->start[1] = base + 0x00002000;
-               info->start[2] = base + 0x00004000;
-               info->start[3] = base + 0x00006000;
-               info->start[4] = base + 0x00008000;
-               info->start[5] = base + 0x0000a000;
-               info->start[6] = base + 0x0000c000;
-               info->start[7] = base + 0x0000e000;
-
-               for (i = 8; i < info->sector_count; i++)
-                       info->start[i] = base + (i * 0x00010000) - 0x00070000;
-       } else {
-               /* set sector offsets for top boot block type           */
-               i = info->sector_count - 1;
-               info->start[i--] = base + info->size - 0x00002000;
-               info->start[i--] = base + info->size - 0x00004000;
-               info->start[i--] = base + info->size - 0x00006000;
-               info->start[i--] = base + info->size - 0x00008000;
-               info->start[i--] = base + info->size - 0x0000a000;
-               info->start[i--] = base + info->size - 0x0000c000;
-               info->start[i--] = base + info->size - 0x0000e000;
-
-               for (; i >= 0; i--)
-                       info->start[i] = base + i * 0x00010000;
-       }
-
-       /* check for protected sectors */
-       for (i = 0; i < info->sector_count; i++) {
-               /* read sector protection at sector address, (A7 .. A0) = 0x02 */
-               /* D0 = 1 if protected */
-               addr2 = (volatile 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) 0xF000F000;
-
-       return (info->size);
-}
-
-static int wait_for_DQ7_16(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) 0x80008000) !=
-                       (CFG_FLASH_WORD_SIZE) 0x80008000) {
-               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;
-}
-
-static int flash_erase_16(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;
-
-       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) 0xAA00AA00;
-                       addr[CFG_FLASH_ADDR1] = (CFG_FLASH_WORD_SIZE) 0x55005500;
-                       addr[CFG_FLASH_ADDR0] = (CFG_FLASH_WORD_SIZE) 0x80008000;
-                       addr[CFG_FLASH_ADDR0] = (CFG_FLASH_WORD_SIZE) 0xAA00AA00;
-                       addr[CFG_FLASH_ADDR1] = (CFG_FLASH_WORD_SIZE) 0x55005500;
-                       addr2[0] = (CFG_FLASH_WORD_SIZE) 0x30003000;    /* sector erase */
-
-                       l_sect = sect;
-                       /*
-                        * Wait for each sector to complete, it's more
-                        * reliable.  According to AMD Spec, you must
-                        * issue all erase commands within a specified
-                        * timeout.  This has been seen to fail, especially
-                        * if printf()s are included (for debug)!!
-                        */
-                       wait_for_DQ7_16(info, sect);
-               }
-       }
-
-       /* re-enable interrupts if necessary */
-       if (flag)
-               enable_interrupts();
-
-       /* wait at least 80us - let's wait 1 ms */
-       udelay(1000);
-
-       /* reset to read mode */
-       addr = (CFG_FLASH_WORD_SIZE *) info->start[0];
-       addr[0] = (CFG_FLASH_WORD_SIZE) 0xF000F000;     /* reset bank */
-
-       printf(" done\n");
-       return 0;
-}
-
-static int write_word_16(flash_info_t * info, ulong dest, ulong 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 i;
-
-       /* Check if Flash is (sufficiently) erased */
-       for (i = 0; i < 4 / sizeof(CFG_FLASH_WORD_SIZE); i++) {
-               if ((dest2[i] & swap16(data2[i])) != swap16(data2[i]))
-                       return (2);
-       }
-
-       for (i = 0; i < 4 / sizeof(CFG_FLASH_WORD_SIZE); i++) {
-               int flag;
-
-               /* Disable interrupts which might cause a timeout here */
-               flag = disable_interrupts();
-
-               addr2[CFG_FLASH_ADDR0] = (CFG_FLASH_WORD_SIZE) 0xAA00AA00;
-               addr2[CFG_FLASH_ADDR1] = (CFG_FLASH_WORD_SIZE) 0x55005500;
-               addr2[CFG_FLASH_ADDR0] = (CFG_FLASH_WORD_SIZE) 0xA000A000;
-
-               dest2[i] = swap16(data2[i]);
-
-               /* re-enable interrupts if necessary */
-               if (flag)
-                       enable_interrupts();
-
-               /* data polling for D7 */
-               start = get_timer(0);
-               while ((dest2[i] & (CFG_FLASH_WORD_SIZE) 0x80008000) !=
-                               (swap16(data2[i]) & (CFG_FLASH_WORD_SIZE) 0x80008000)) {
-
-                       if (get_timer(start) > CFG_FLASH_WRITE_TOUT) {
-                               return (1);
-                       }
-               }
-       }
-
-       return (0);
-}
-#endif /* CFG_FLASH_2ND_16BIT_DEV */
-
-/*-----------------------------------------------------------------------
- * Functions
- */
-static ulong flash_get_size(vu_long * addr, flash_info_t * info);
-static int write_word(flash_info_t * info, ulong dest, ulong data);
-
-/*-----------------------------------------------------------------------
- */
-
-unsigned long flash_init(void)
-{
-       unsigned long total_b = 0;
-       unsigned long size_b[CFG_MAX_FLASH_BANKS];
-       unsigned short index = 0;
-       int i;
-
-       DEBUGF("\n");
-       DEBUGF("FLASH: Index: %d\n", index);
-
-       /* Init: no FLASHes known */
-       for (i = 0; i < CFG_MAX_FLASH_BANKS; ++i) {
-               flash_info[i].flash_id = FLASH_UNKNOWN;
-               flash_info[i].sector_count = -1;
-               flash_info[i].size = 0;
-
-               /* check whether the address is 0 */
-               if (flash_addr_table[index][i] == 0)
-                       continue;
-
-               /* call flash_get_size() to initialize sector address */
-               size_b[i] = flash_get_size((vu_long *) flash_addr_table[index][i],
-                               &flash_info[i]);
-
-               flash_info[i].size = size_b[i];
-
-               if (flash_info[i].flash_id == FLASH_UNKNOWN) {
-                       printf("## Unknown FLASH on Bank %d - Size = 0x%08lx = %ld MB\n",
-                                       i+1, size_b[i], size_b[i] << 20);
-                       flash_info[i].sector_count = -1;
-                       flash_info[i].size = 0;
-               }
-
-               /* Monitor protection ON by default */
-               (void)flash_protect(FLAG_PROTECT_SET, CFG_MONITOR_BASE,
-                                   CFG_MONITOR_BASE + CFG_MONITOR_LEN - 1,
-                                   &flash_info[i]);
-#if defined(CFG_ENV_IS_IN_FLASH)
-               (void)flash_protect(FLAG_PROTECT_SET, CFG_ENV_ADDR,
-                                   CFG_ENV_ADDR + CFG_ENV_SECT_SIZE - 1,
-                                   &flash_info[i]);
-#if defined(CFG_ENV_ADDR_REDUND)
-               (void)flash_protect(FLAG_PROTECT_SET, CFG_ENV_ADDR_REDUND,
-                                   CFG_ENV_ADDR_REDUND + CFG_ENV_SECT_SIZE - 1,
-                                   &flash_info[i]);
-#endif
-#endif
-               total_b += flash_info[i].size;
-       }
-
-       return total_b;
-}
-#endif /* if defined(CONFIG_CAM5200) && defined(CONFIG_CAM5200_NIOSFLASH) */
diff --git a/board/tqm5200/cmd_stk52xx.c b/board/tqm5200/cmd_stk52xx.c
deleted file mode 100644 (file)
index 7472ca9..0000000
+++ /dev/null
@@ -1,1247 +0,0 @@
-/*
- * (C) Copyright 2005
- * Martin Krause, TQ-Systems GmbH, martin.krause@tqs.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
- */
-
-/*
- * STK52XX specific functions
- */
-/*#define DEBUG*/
-
-#include <common.h>
-#include <command.h>
-
-#if defined(CONFIG_CMD_BSP)
-
-#if defined(CONFIG_STK52XX) || defined(CONFIG_FO300)
-#define DEFAULT_VOL    45
-#define DEFAULT_FREQ   500
-#define DEFAULT_DURATION       200
-#define LEFT           1
-#define RIGHT          2
-#define LEFT_RIGHT     3
-#define BL_OFF         0
-#define BL_ON          1
-
-#define SM501_GPIO_CTRL_LOW            0x00000008UL
-#define SM501_GPIO_CTRL_HIGH           0x0000000CUL
-#define SM501_POWER_MODE0_GATE         0x00000040UL
-#define SM501_POWER_MODE1_GATE         0x00000048UL
-#define POWER_MODE_GATE_GPIO_PWM_I2C   0x00000040UL
-#define SM501_GPIO_DATA_LOW            0x00010000UL
-#define SM501_GPIO_DATA_HIGH           0x00010004UL
-#define SM501_GPIO_DATA_DIR_LOW                0x00010008UL
-#define SM501_GPIO_DATA_DIR_HIGH       0x0001000CUL
-#define SM501_PANEL_DISPLAY_CONTROL    0x00080000UL
-
-static int i2s_squarewave(unsigned long duration, unsigned int freq,
-                         unsigned int channel);
-static int i2s_sawtooth(unsigned long duration, unsigned int freq,
-                       unsigned int channel);
-static void spi_init(void);
-static int spi_transmit(unsigned char data);
-static void pcm1772_write_reg(unsigned char addr, unsigned char data);
-static void set_attenuation(unsigned char attenuation);
-
-static void spi_init(void)
-{
-       struct mpc5xxx_spi *spi = (struct mpc5xxx_spi*)MPC5XXX_SPI;
-       struct mpc5xxx_gpio *gpio = (struct mpc5xxx_gpio*)MPC5XXX_GPIO;
-
-       /* PSC3 as SPI and GPIOs */
-       gpio->port_config &= 0xFFFFF0FF;
-       gpio->port_config |= 0x00000800;
-       /*
-        * Its important to use the correct order when initializing the
-        * registers
-        */
-       spi->ddr = 0x0F; /* set all SPI pins as output */
-       spi->pdr = 0x08; /* set SS high */
-       spi->cr1 = 0x50; /* SPI is master, SS is general purpose output */
-       spi->cr2 = 0x00; /* normal operation */
-       spi->brr = 0xFF; /* baud rate: IPB clock / 2048 */
-}
-
-static int spi_transmit(unsigned char data)
-{
-       int dummy;
-       struct mpc5xxx_spi *spi = (struct mpc5xxx_spi*)MPC5XXX_SPI;
-
-       spi->dr = data;
-       /* wait for SPI transmission completed */
-       while(!(spi->sr & 0x80))
-       {
-               if (spi->sr & 0x40)     /* if write collision occured */
-               {
-                       /* do dummy read to clear status register */
-                       dummy = spi->dr;
-                       printf ("SPI write collision\n");
-                       return -1;
-               }
-       }
-       return (spi->dr);
-}
-
-static void pcm1772_write_reg(unsigned char addr, unsigned char data)
-{
-       struct mpc5xxx_spi *spi = (struct mpc5xxx_spi*)MPC5XXX_SPI;
-
-       spi->pdr = 0x00; /* Set SS low */
-       spi_transmit(addr);
-       spi_transmit(data);
-       /* wait some time to meet MS# hold time of PCM1772 */
-       udelay (1);
-       spi->pdr = 0x08; /* set SS high */
-}
-
-static void set_attenuation(unsigned char attenuation)
-{
-       pcm1772_write_reg(0x01, attenuation); /* left channel */
-       debug ("PCM1772 attenuation left set to %d.\n", attenuation);
-       pcm1772_write_reg(0x02, attenuation); /* right channel */
-       debug ("PCM1772 attenuation right set to %d.\n", attenuation);
-}
-
-void amplifier_init(void)
-{
-       static int init_done = 0;
-       int i;
-       struct mpc5xxx_gpio *gpio = (struct mpc5xxx_gpio*)MPC5XXX_GPIO;
-
-       /* Do this only once, because of the long time delay */
-       if (!init_done) {
-               /* configure PCM1772 audio format as I2S */
-               pcm1772_write_reg(0x03, 0x01);
-               /* enable audio amplifier */
-               gpio->sint_gpioe |=  0x02;      /* PSC3_5 as GPIO */
-               gpio->sint_ode &= ~0x02;        /* PSC3_5 is not open Drain */
-               gpio->sint_dvo &= ~0x02;        /* PSC3_5 is LOW */
-               gpio->sint_ddr |=  0x02;        /* PSC3_5 as output */
-               /*
-                * wait some time to allow amplifier to recover from shutdown
-                * mode.
-                */
-               for(i = 0; i < 350; i++)
-                       udelay(1000);
-               /*
-                * The used amplifier (LM4867) has a so called "pop and click"
-                * elmination filter. The input signal of the amplifier must
-                * exceed a certain level once after power up to activate the
-                * generation of the output signal. This is achieved by
-                * sending a low frequent (nearly inaudible) sawtooth with a
-                * sufficient signal level.
-                */
-               set_attenuation(50);
-               i2s_sawtooth (200, 5, LEFT_RIGHT);
-               init_done = 1;
-       }
-}
-
-static void i2s_init(void)
-{
-       unsigned long i;
-       struct mpc5xxx_psc *psc = (struct mpc5xxx_psc*)MPC5XXX_PSC2;;
-       struct mpc5xxx_gpio *gpio = (struct mpc5xxx_gpio*)MPC5XXX_GPIO;
-
-       gpio->port_config |= 0x00000070; /* PSC2 ports as Codec with MCLK */
-       psc->command = (PSC_RX_DISABLE | PSC_TX_DISABLE);
-       psc->sicr = 0x22E00000;         /* 16 bit data; I2S */
-
-       *(vu_long *)(CFG_MBAR + 0x22C) = 0x805d; /* PSC2 CDM MCLK config; MCLK
-                                                 * 5.617 MHz */
-       *(vu_long *)(CFG_MBAR + 0x214) |= 0x00000040; /* CDM clock enable
-                                                      * register */
-       psc->ccr = 0x1F03;      /* 16 bit data width; 5.617MHz MCLK */
-       psc->ctur = 0x0F;       /* 16 bit frame width */
-
-       for(i=0;i<128;i++)
-       {
-               psc->psc_buffer_32 = 0; /* clear tx fifo */
-       }
-}
-
-static int i2s_play_wave(unsigned long addr, unsigned long len)
-{
-       unsigned long i;
-       unsigned char *wave_file = (uchar *)addr + 44;  /* quick'n dirty: skip
-                                                        * wav header*/
-       unsigned char swapped[4];
-       struct mpc5xxx_psc *psc = (struct mpc5xxx_psc*)MPC5XXX_PSC2;
-
-       /*
-        * play wave file in memory; bytes/words are be swapped
-        */
-       psc->command = (PSC_RX_ENABLE | PSC_TX_ENABLE);
-
-       for(i = 0;i < (len / 4); i++) {
-               swapped[3]=*wave_file++;
-               swapped[2]=*wave_file++;
-               swapped[1]=*wave_file++;
-               swapped[0]=*wave_file++;
-               psc->psc_buffer_32 =  *((unsigned long*)swapped);
-               while (psc->tfnum > 400) {
-                       if(ctrlc())
-                               return 0;
-               }
-       }
-       while (psc->tfnum > 0);         /* wait for fifo empty */
-       udelay (100);
-       psc->command = (PSC_RX_DISABLE | PSC_TX_DISABLE);
-       return 0;
-}
-
-static int i2s_sawtooth(unsigned long duration, unsigned int freq,
-                       unsigned int channel)
-{
-       long i,j;
-       unsigned long data;
-       struct mpc5xxx_psc *psc = (struct mpc5xxx_psc*)MPC5XXX_PSC2;
-
-       psc->command = (PSC_RX_ENABLE | PSC_TX_ENABLE);
-
-       /*
-        * Generate sawtooth. Start with middle level up to highest level. Then
-        * go to lowest level and back to middle level.
-        */
-       for(j = 0; j < ((duration * freq) / 1000); j++) {
-               for(i = 0; i <= 0x7FFF; i += (0x7FFF/(44100/(freq*4)))) {
-                       data = (i & 0xFFFF);
-                       /* data format: right data left data) */
-                       if (channel == LEFT_RIGHT)
-                               data |= (data<<16);
-                       if (channel == RIGHT)
-                               data = (data<<16);
-                       psc->psc_buffer_32 = data;
-                       while (psc->tfnum > 400);
-               }
-               for(i = 0x7FFF; i >= -0x7FFF; i -= (0xFFFF/(44100/(freq*2)))) {
-                       data = (i & 0xFFFF);
-                       /* data format: right data left data) */
-                       if (channel == LEFT_RIGHT)
-                               data |= (data<<16);
-                       if (channel == RIGHT)
-                               data = (data<<16);
-                       psc->psc_buffer_32 = data;
-                       while (psc->tfnum > 400);
-               }
-               for(i = -0x7FFF; i <= 0; i += (0x7FFF/(44100/(freq*4)))) {
-                       data = (i & 0xFFFF);
-                       /* data format: right data left data) */
-                       if (channel == LEFT_RIGHT)
-                               data |= (data<<16);
-                       if (channel == RIGHT)
-                               data = (data<<16);
-                       psc->psc_buffer_32 = data;
-                       while (psc->tfnum > 400);
-               }
-       }
-       while (psc->tfnum > 0);         /* wait for fifo empty */
-       udelay (100);
-       psc->command = (PSC_RX_DISABLE | PSC_TX_DISABLE);
-
-       return 0;
-}
-
-static int i2s_squarewave(unsigned long duration, unsigned int freq,
-                        unsigned int channel)
-{
-       long i,j;
-       unsigned long data;
-       struct mpc5xxx_psc *psc = (struct mpc5xxx_psc*)MPC5XXX_PSC2;
-
-       psc->command = (PSC_RX_ENABLE | PSC_TX_ENABLE);
-
-       /*
-        * Generate sqarewave. Start with high level, duty cycle 1:1.
-        */
-       for(j = 0; j < ((duration * freq) / 1000); j++) {
-               for(i = 0; i < (44100/(freq*2)); i ++) {
-                       data = 0x7FFF;
-                       /* data format: right data left data) */
-                       if (channel == LEFT_RIGHT)
-                               data |= (data<<16);
-                       if (channel == RIGHT)
-                               data = (data<<16);
-                       psc->psc_buffer_32 = data;
-                       while (psc->tfnum > 400);
-               }
-               for(i = 0; i < (44100/(freq*2)); i ++) {
-                       data = 0x8000;
-                       /* data format: right data left data) */
-                       if (channel == LEFT_RIGHT)
-                               data |= (data<<16);
-                       if (channel == RIGHT)
-                               data = (data<<16);
-                       psc->psc_buffer_32 = data;
-                       while (psc->tfnum > 400);
-               }
-       }
-       while (psc->tfnum > 0);         /* wait for fifo empty */
-       udelay (100);
-       psc->command = (PSC_RX_DISABLE | PSC_TX_DISABLE);
-
-       return 0;
-}
-
-static int cmd_sound(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
-{
-       unsigned long reg, val, duration;
-       char *tmp;
-       unsigned int freq, channel;
-       unsigned char volume;
-       int rcode = 1;
-
-#ifdef CONFIG_STK52XX_REV100
-       printf ("Revision 100 of STK52XX not supported!\n");
-       return 1;
-#endif
-       spi_init();
-       i2s_init();
-       amplifier_init();
-
-       if ((tmp = getenv ("volume")) != NULL) {
-               volume = simple_strtoul (tmp, NULL, 10);
-       } else {
-               volume = DEFAULT_VOL;
-       }
-       set_attenuation(volume);
-
-       switch (argc) {
-       case 0:
-       case 1:
-               printf ("Usage:\n%s\n", cmdtp->usage);
-               return 1;
-       case 2:
-               if (strncmp(argv[1],"saw",3) == 0) {
-                       printf ("Play sawtooth\n");
-                       rcode = i2s_sawtooth (DEFAULT_DURATION, DEFAULT_FREQ,
-                                             LEFT_RIGHT);
-                       return rcode;
-               } else if (strncmp(argv[1],"squ",3) == 0) {
-                       printf ("Play squarewave\n");
-                       rcode = i2s_squarewave (DEFAULT_DURATION, DEFAULT_FREQ,
-                                               LEFT_RIGHT);
-                       return rcode;
-               }
-
-               printf ("Usage:\n%s\n", cmdtp->usage);
-               return 1;
-       case 3:
-               if (strncmp(argv[1],"saw",3) == 0) {
-                       duration = simple_strtoul(argv[2], NULL, 10);
-                       printf ("Play sawtooth\n");
-                       rcode = i2s_sawtooth (duration, DEFAULT_FREQ,
-                                             LEFT_RIGHT);
-                       return rcode;
-               } else if (strncmp(argv[1],"squ",3) == 0) {
-                       duration = simple_strtoul(argv[2], NULL, 10);
-                       printf ("Play squarewave\n");
-                       rcode = i2s_squarewave (duration, DEFAULT_FREQ,
-                                               LEFT_RIGHT);
-                       return rcode;
-               }
-               printf ("Usage:\n%s\n", cmdtp->usage);
-               return 1;
-       case 4:
-               if (strncmp(argv[1],"saw",3) == 0) {
-                       duration = simple_strtoul(argv[2], NULL, 10);
-                       freq = (unsigned int)simple_strtoul(argv[3], NULL, 10);
-                       printf ("Play sawtooth\n");
-                       rcode = i2s_sawtooth (duration, freq,
-                                             LEFT_RIGHT);
-                       return rcode;
-               } else if (strncmp(argv[1],"squ",3) == 0) {
-                       duration = simple_strtoul(argv[2], NULL, 10);
-                       freq = (unsigned int)simple_strtoul(argv[3], NULL, 10);
-                       printf ("Play squarewave\n");
-                       rcode = i2s_squarewave (duration, freq,
-                                               LEFT_RIGHT);
-                       return rcode;
-               } else if (strcmp(argv[1],"pcm1772") == 0) {
-                       reg = simple_strtoul(argv[2], NULL, 10);
-                       val = simple_strtoul(argv[3], NULL, 10);
-                       printf("Set PCM1772 %lu. %lu\n", reg, val);
-                       pcm1772_write_reg((uchar)reg, (uchar)val);
-                       return 0;
-               }
-               printf ("Usage:\n%s\n", cmdtp->usage);
-               return 1;
-       case 5:
-               if (strncmp(argv[1],"saw",3) == 0) {
-                       duration = simple_strtoul(argv[2], NULL, 10);
-                       freq = (unsigned int)simple_strtoul(argv[3], NULL, 10);
-                       if (strncmp(argv[4],"l",1) == 0)
-                               channel = LEFT;
-                       else if (strncmp(argv[4],"r",1) == 0)
-                               channel = RIGHT;
-                       else
-                               channel = LEFT_RIGHT;
-                       printf ("Play squarewave\n");
-                       rcode = i2s_sawtooth (duration, freq,
-                                             channel);
-                       return rcode;
-               } else if (strncmp(argv[1],"squ",3) == 0) {
-                       duration = simple_strtoul(argv[2], NULL, 10);
-                       freq = (unsigned int)simple_strtoul(argv[3], NULL, 10);
-                       if (strncmp(argv[4],"l",1) == 0)
-                               channel = LEFT;
-                       else if (strncmp(argv[4],"r",1) == 0)
-                               channel = RIGHT;
-                       else
-                               channel = LEFT_RIGHT;
-                       printf ("Play squarewave\n");
-                       rcode = i2s_squarewave (duration, freq,
-                                               channel);
-                       return rcode;
-               }
-               printf ("Usage:\n%s\n", cmdtp->usage);
-               return 1;
-       }
-       printf ("Usage:\nsound cmd [arg1] [arg2] ...\n");
-       return 1;
-}
-
-static int cmd_wav(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
-{
-       unsigned long length, addr;
-       unsigned char volume;
-       int rcode = 1;
-       char *tmp;
-
-#ifdef CONFIG_STK52XX_REV100
-       printf ("Revision 100 of STK52XX not supported!\n");
-       return 1;
-#endif
-       spi_init();
-       i2s_init();
-       amplifier_init();
-
-       switch (argc) {
-
-       case 3:
-               length = simple_strtoul(argv[2], NULL, 16);
-               addr = simple_strtoul(argv[1], NULL, 16);
-               break;
-
-       case 2:
-               if ((tmp = getenv ("filesize")) != NULL) {
-                       length = simple_strtoul (tmp, NULL, 16);
-               } else {
-                       puts ("No filesize provided\n");
-                       return 1;
-               }
-               addr = simple_strtoul(argv[1], NULL, 16);
-
-       case 1:
-               if ((tmp = getenv ("filesize")) != NULL) {
-                       length = simple_strtoul (tmp, NULL, 16);
-               } else {
-                       puts ("No filesize provided\n");
-                       return 1;
-               }
-               if ((tmp = getenv ("loadaddr")) != NULL) {
-                       addr = simple_strtoul (tmp, NULL, 16);
-               } else {
-                       puts ("No loadaddr provided\n");
-                       return 1;
-               }
-               break;
-
-       default:
-               printf("Usage:\nwav <addr> <length[s]\n");
-               return 1;
-               break;
-       }
-
-       if ((tmp = getenv ("volume")) != NULL) {
-               volume = simple_strtoul (tmp, NULL, 10);
-       } else {
-               volume = DEFAULT_VOL;
-       }
-       set_attenuation(volume);
-
-       printf("Play wave file at %#p with length %#x\n", addr, length);
-       rcode = i2s_play_wave(addr, length);
-
-       return rcode;
-}
-
-static int cmd_beep(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
-{
-       unsigned char volume;
-       unsigned int channel;
-       int rcode;
-       char *tmp;
-
-#ifdef CONFIG_STK52XX_REV100
-       printf ("Revision 100 of STK52XX not supported!\n");
-       return 1;
-#endif
-       spi_init();
-       i2s_init();
-       amplifier_init();
-
-       switch (argc) {
-       case 0:
-       case 1:
-               channel = LEFT_RIGHT;
-               break;
-       case 2:
-               if (strncmp(argv[1],"l",1) == 0)
-                       channel = LEFT;
-               else if (strncmp(argv[1],"r",1) == 0)
-                       channel = RIGHT;
-               else
-                       channel = LEFT_RIGHT;
-               break;
-       default:
-               printf ("Usage:\n%s\n", cmdtp->usage);
-               return 1;
-       }
-
-       if ((tmp = getenv ("volume")) != NULL) {
-               volume = simple_strtoul (tmp, NULL, 10);
-       } else {
-               volume = DEFAULT_VOL;
-       }
-       set_attenuation(volume);
-
-       printf("Beep on ");
-       if (channel == LEFT)
-               printf ("left ");
-       else if (channel == RIGHT)
-               printf ("right ");
-       else
-               printf ("left and right ");
-       printf ("channel\n");
-
-       rcode = i2s_squarewave (DEFAULT_DURATION, DEFAULT_FREQ, channel);
-
-       return rcode;
-}
-#endif
-
-#if defined(CONFIG_STK52XX)
-void led_init(void)
-{
-       struct mpc5xxx_gpio *gpio = (struct mpc5xxx_gpio *)MPC5XXX_GPIO;
-       struct mpc5xxx_gpt_0_7 *gpt = (struct mpc5xxx_gpt_0_7 *)MPC5XXX_GPT;
-
-       /* configure PSC3 for SPI and GPIO */
-       gpio->port_config &= ~(0x00000F00);
-       gpio->port_config |=   0x00000800;
-
-       gpio->simple_gpioe &= ~(0x00000F00);
-       gpio->simple_gpioe |=   0x00000F00;
-
-       gpio->simple_ddr &= ~(0x00000F00);
-       gpio->simple_ddr |=   0x00000F00;
-
-       /* configure timer 4-7 for simple GPIO output */
-       gpt->gpt4.emsr |=  0x00000024;
-       gpt->gpt5.emsr |=  0x00000024;
-       gpt->gpt6.emsr |=  0x00000024;
-       gpt->gpt7.emsr |=  0x00000024;
-
-#ifndef CONFIG_TQM5200S
-       /* enable SM501 GPIO control (in both power modes) */
-       *(vu_long *) (SM501_MMIO_BASE+SM501_POWER_MODE0_GATE) |=
-               POWER_MODE_GATE_GPIO_PWM_I2C;
-       *(vu_long *) (SM501_MMIO_BASE+SM501_POWER_MODE1_GATE) |=
-               POWER_MODE_GATE_GPIO_PWM_I2C;
-
-       /* configure SM501 gpio pins 24-27 as output */
-       *(vu_long *) (SM501_MMIO_BASE+SM501_GPIO_CTRL_LOW) &= ~(0xF << 24);
-       *(vu_long *) (SM501_MMIO_BASE+SM501_GPIO_DATA_DIR_LOW) |= (0xF << 24);
-
-       /* configure SM501 gpio pins 48-51 as output */
-       *(vu_long *) (SM501_MMIO_BASE+SM501_GPIO_DATA_DIR_HIGH) |= (0xF << 16);
-#endif /* !CONFIG_TQM5200S */
-}
-
-/*
- * return 1 if led number unknown
- * return 0 else
- */
-int do_led(char *argv[])
-{
-       struct mpc5xxx_gpio *gpio = (struct mpc5xxx_gpio *)MPC5XXX_GPIO;
-       struct mpc5xxx_gpt_0_7 *gpt = (struct mpc5xxx_gpt_0_7 *)MPC5XXX_GPT;
-
-       switch  (simple_strtoul(argv[2], NULL, 10)) {
-
-       case 0:
-               if (strcmp (argv[3], "on") == 0) {
-                       gpio->simple_dvo |=   (1 << 8);
-               } else {
-                       gpio->simple_dvo &= ~(1 << 8);
-               }
-               break;
-
-       case 1:
-               if (strcmp (argv[3], "on") == 0) {
-                       gpio->simple_dvo |=   (1 << 9);
-               } else {
-                       gpio->simple_dvo &= ~(1 << 9);
-               }
-               break;
-
-       case 2:
-               if (strcmp (argv[3], "on") == 0) {
-                       gpio->simple_dvo |=   (1 << 10);
-               } else {
-                       gpio->simple_dvo &= ~(1 << 10);
-               }
-               break;
-
-       case 3:
-               if (strcmp (argv[3], "on") == 0) {
-                       gpio->simple_dvo |=   (1 << 11);
-               } else {
-                       gpio->simple_dvo &= ~(1 << 11);
-               }
-               break;
-
-       case 4:
-               if (strcmp (argv[3], "on") == 0) {
-                       gpt->gpt4.emsr |=  (1 << 4);
-               } else {
-                       gpt->gpt4.emsr &=  ~(1 << 4);
-               }
-               break;
-
-       case 5:
-               if (strcmp (argv[3], "on") == 0) {
-                       gpt->gpt5.emsr |=  (1 << 4);
-               } else {
-                       gpt->gpt5.emsr &=  ~(1 << 4);
-               }
-               break;
-
-       case 6:
-               if (strcmp (argv[3], "on") == 0) {
-                       gpt->gpt6.emsr |=  (1 << 4);
-               } else {
-                       gpt->gpt6.emsr &=  ~(1 << 4);
-               }
-               break;
-
-       case 7:
-               if (strcmp (argv[3], "on") == 0) {
-                       gpt->gpt7.emsr |=  (1 << 4);
-               } else {
-                       gpt->gpt7.emsr &=  ~(1 << 4);
-               }
-               break;
-#ifndef CONFIG_TQM5200S
-       case 24:
-               if (strcmp (argv[3], "on") == 0) {
-                       *(vu_long *) (SM501_MMIO_BASE+SM501_GPIO_DATA_LOW) |=
-                               (0x1 << 24);
-               } else {
-                       *(vu_long *) (SM501_MMIO_BASE+SM501_GPIO_DATA_LOW) &=
-                               ~(0x1 << 24);
-               }
-               break;
-
-       case 25:
-               if (strcmp (argv[3], "on") == 0) {
-                       *(vu_long *) (SM501_MMIO_BASE+SM501_GPIO_DATA_LOW) |=
-                               (0x1 << 25);
-               } else {
-                       *(vu_long *) (SM501_MMIO_BASE+SM501_GPIO_DATA_LOW) &=
-                               ~(0x1 << 25);
-               }
-               break;
-
-       case 26:
-               if (strcmp (argv[3], "on") == 0) {
-                       *(vu_long *) (SM501_MMIO_BASE+SM501_GPIO_DATA_LOW) |=
-                               (0x1 << 26);
-               } else {
-                       *(vu_long *) (SM501_MMIO_BASE+SM501_GPIO_DATA_LOW) &=
-                               ~(0x1 << 26);
-               }
-               break;
-
-       case 27:
-               if (strcmp (argv[3], "on") == 0) {
-                       *(vu_long *) (SM501_MMIO_BASE+SM501_GPIO_DATA_LOW) |=
-                               (0x1 << 27);
-               } else {
-                       *(vu_long *) (SM501_MMIO_BASE+SM501_GPIO_DATA_LOW) &=
-                               ~(0x1 << 27);
-               }
-               break;
-
-       case 48:
-               if (strcmp (argv[3], "on") == 0) {
-                       *(vu_long *) (SM501_MMIO_BASE+SM501_GPIO_DATA_HIGH) |=
-                               (0x1 << 16);
-               } else {
-                       *(vu_long *) (SM501_MMIO_BASE+SM501_GPIO_DATA_HIGH) &=
-                               ~(0x1 << 16);
-               }
-               break;
-
-       case 49:
-               if (strcmp (argv[3], "on") == 0) {
-                       *(vu_long *) (SM501_MMIO_BASE+SM501_GPIO_DATA_HIGH) |=
-                               (0x1 << 17);
-               } else {
-                       *(vu_long *) (SM501_MMIO_BASE+SM501_GPIO_DATA_HIGH) &=
-                               ~(0x1 << 17);
-               }
-               break;
-
-       case 50:
-               if (strcmp (argv[3], "on") == 0) {
-                       *(vu_long *) (SM501_MMIO_BASE+SM501_GPIO_DATA_HIGH) |=
-                               (0x1 << 18);
-               } else {
-                       *(vu_long *) (SM501_MMIO_BASE+SM501_GPIO_DATA_HIGH) &=
-                               ~(0x1 << 18);
-               }
-               break;
-
-       case 51:
-               if (strcmp (argv[3], "on") == 0) {
-                       *(vu_long *) (SM501_MMIO_BASE+SM501_GPIO_DATA_HIGH) |=
-                               (0x1 << 19);
-               } else {
-                       *(vu_long *) (SM501_MMIO_BASE+SM501_GPIO_DATA_HIGH) &=
-                               ~(0x1 << 19);
-               }
-               break;
-#endif /* !CONFIG_TQM5200S */
-       default:
-               printf ("%s: invalid led number %s\n", __FUNCTION__, argv[2]);
-               return 1;
-       }
-
-       return 0;
-}
-#endif
-
-#if defined(CONFIG_STK52XX) || defined(CONFIG_FO300)
-/*
- * return 1 on CAN initialization failure
- * return 0 if no failure
- */
-int can_init(void)
-{
-       static int init_done = 0;
-       int i;
-       struct mpc5xxx_mscan *can1 =
-               (struct mpc5xxx_mscan *)(CFG_MBAR + 0x0900);
-       struct mpc5xxx_mscan *can2 =
-               (struct mpc5xxx_mscan *)(CFG_MBAR + 0x0980);
-
-       /* GPIO configuration of the CAN pins is done in TQM5200.h */
-
-       if (!init_done) {
-               /* init CAN 1 */
-               can1->canctl1 |= 0x80;  /* CAN enable */
-               udelay(100);
-
-               i = 0;
-               can1->canctl0 |= 0x02;  /* sleep mode */
-               /* wait until sleep mode reached */
-               while (!(can1->canctl1 & 0x02)) {
-                       udelay(10);
-               i++;
-               if (i == 10) {
-                       printf ("%s: CAN1 initialize error, "
-                               "can not enter sleep mode!\n",
-                               __FUNCTION__);
-                       return 1;
-               }
-               }
-               i = 0;
-               can1->canctl0 = 0x01;   /* enter init mode */
-               /* wait until init mode reached */
-               while (!(can1->canctl1 & 0x01)) {
-                       udelay(10);
-                       i++;
-                       if (i == 10) {
-                               printf ("%s: CAN1 initialize error, "
-                                       "can not enter init mode!\n",
-                                       __FUNCTION__);
-                               return 1;
-                       }
-               }
-               can1->canctl1 = 0x80;
-               can1->canctl1 |= 0x40;
-               can1->canbtr0 = 0x0F;
-               can1->canbtr1 = 0x7F;
-               can1->canidac &= ~(0x30);
-               can1->canidar1 = 0x00;
-               can1->canidar3 = 0x00;
-               can1->canidar5 = 0x00;
-               can1->canidar7 = 0x00;
-               can1->canidmr0 = 0xFF;
-               can1->canidmr1 = 0xFF;
-               can1->canidmr2 = 0xFF;
-               can1->canidmr3 = 0xFF;
-               can1->canidmr4 = 0xFF;
-               can1->canidmr5 = 0xFF;
-               can1->canidmr6 = 0xFF;
-               can1->canidmr7 = 0xFF;
-
-               i = 0;
-               can1->canctl0 &= ~(0x01);       /* leave init mode */
-               can1->canctl0 &= ~(0x02);
-               /* wait until init and sleep mode left */
-               while ((can1->canctl1 & 0x01) || (can1->canctl1 & 0x02)) {
-                       udelay(10);
-                       i++;
-                       if (i == 10) {
-                               printf ("%s: CAN1 initialize error, "
-                                       "can not leave init/sleep mode!\n",
-                                       __FUNCTION__);
-                               return 1;
-                       }
-               }
-
-               /* init CAN 2 */
-               can2->canctl1 |= 0x80;  /* CAN enable */
-               udelay(100);
-
-               i = 0;
-               can2->canctl0 |= 0x02;  /* sleep mode */
-               /* wait until sleep mode reached */
-               while (!(can2->canctl1 & 0x02)) {
-                       udelay(10);
-                       i++;
-                       if (i == 10) {
-                               printf ("%s: CAN2 initialize error, "
-                                       "can not enter sleep mode!\n",
-                                       __FUNCTION__);
-                               return 1;
-                       }
-               }
-               i = 0;
-               can2->canctl0 = 0x01;   /* enter init mode */
-               /* wait until init mode reached */
-               while (!(can2->canctl1 & 0x01)) {
-                       udelay(10);
-                       i++;
-                       if (i == 10) {
-                               printf ("%s: CAN2 initialize error, "
-                                       "can not enter init mode!\n",
-                                       __FUNCTION__);
-                               return 1;
-                       }
-               }
-               can2->canctl1 = 0x80;
-               can2->canctl1 |= 0x40;
-               can2->canbtr0 = 0x0F;
-               can2->canbtr1 = 0x7F;
-               can2->canidac &= ~(0x30);
-               can2->canidar1 = 0x00;
-               can2->canidar3 = 0x00;
-               can2->canidar5 = 0x00;
-               can2->canidar7 = 0x00;
-               can2->canidmr0 = 0xFF;
-               can2->canidmr1 = 0xFF;
-               can2->canidmr2 = 0xFF;
-               can2->canidmr3 = 0xFF;
-               can2->canidmr4 = 0xFF;
-               can2->canidmr5 = 0xFF;
-               can2->canidmr6 = 0xFF;
-               can2->canidmr7 = 0xFF;
-               can2->canctl0 &= ~(0x01);       /* leave init mode */
-               can2->canctl0 &= ~(0x02);
-
-               i = 0;
-               /* wait until init mode left */
-               while ((can2->canctl1 & 0x01) || (can2->canctl1 & 0x02)) {
-                       udelay(10);
-                       i++;
-                       if (i == 10) {
-                               printf ("%s: CAN2 initialize error, "
-                                       "can not leave init/sleep mode!\n",
-                                       __FUNCTION__);
-                               return 1;
-                       }
-               }
-               init_done = 1;
-       }
-       return 0;
-}
-
-/*
- * return 1 on CAN failure
- * return 0 if no failure
- */
-int do_can(char *argv[])
-{
-       int i;
-       struct mpc5xxx_mscan *can1 =
-               (struct mpc5xxx_mscan *)(CFG_MBAR + 0x0900);
-       struct mpc5xxx_mscan *can2 =
-               (struct mpc5xxx_mscan *)(CFG_MBAR + 0x0980);
-
-       /* send a message on CAN1 */
-       can1->cantbsel = 0x01;
-       can1->cantxfg.idr[0] = 0x55;
-       can1->cantxfg.idr[1] = 0x00;
-       can1->cantxfg.idr[1] &= ~0x8;
-       can1->cantxfg.idr[1] &= ~0x10;
-       can1->cantxfg.dsr[0] = 0xCC;
-       can1->cantxfg.dlr = 1;
-       can1->cantxfg.tbpr = 0;
-       can1->cantflg = 0x01;
-
-       i = 0;
-       while ((can1->cantflg & 0x01) == 0) {
-               i++;
-               if (i == 10) {
-                       printf ("%s: CAN1 send timeout, "
-                               "can not send message!\n",
-                               __FUNCTION__);
-                       return 1;
-               }
-               udelay(1000);
-       }
-       udelay(1000);
-
-       i = 0;
-       while (!(can2->canrflg & 0x01)) {
-               i++;
-               if (i == 10) {
-                       printf ("%s: CAN2 receive timeout, "
-                               "no message received!\n",
-                               __FUNCTION__);
-                       return 1;
-               }
-               udelay(1000);
-       }
-
-       if (can2->canrxfg.dsr[0] != 0xCC) {
-               printf ("%s: CAN2 receive error, "
-                        "data mismatch!\n",
-                       __FUNCTION__);
-               return 1;
-       }
-
-       /* send a message on CAN2 */
-       can2->cantbsel = 0x01;
-       can2->cantxfg.idr[0] = 0x55;
-       can2->cantxfg.idr[1] = 0x00;
-       can2->cantxfg.idr[1] &= ~0x8;
-       can2->cantxfg.idr[1] &= ~0x10;
-       can2->cantxfg.dsr[0] = 0xCC;
-       can2->cantxfg.dlr = 1;
-       can2->cantxfg.tbpr = 0;
-       can2->cantflg = 0x01;
-
-       i = 0;
-       while ((can2->cantflg & 0x01) == 0) {
-               i++;
-               if (i == 10) {
-                       printf ("%s: CAN2 send error, "
-                               "can not send message!\n",
-                               __FUNCTION__);
-                       return 1;
-               }
-               udelay(1000);
-       }
-       udelay(1000);
-
-       i = 0;
-       while (!(can1->canrflg & 0x01)) {
-               i++;
-               if (i == 10) {
-                       printf ("%s: CAN1 receive timeout, "
-                               "no message received!\n",
-                               __FUNCTION__);
-                       return 1;
-               }
-               udelay(1000);
-       }
-
-       if (can1->canrxfg.dsr[0] != 0xCC) {
-               printf ("%s: CAN1 receive error 0x%02x\n",
-                       __FUNCTION__, (can1->canrxfg.dsr[0]));
-               return 1;
-       }
-
-       return 0;
-}
-
-/*
- * return 1 if rs232 port unknown
- * return 2 on txd/rxd failure (only rs232 2)
- * return 3 on rts/cts failure
- * return 0 if no failure
- */
-int do_rs232(char *argv[])
-{
-       int error_status = 0;
-       struct mpc5xxx_gpio *gpio = (struct mpc5xxx_gpio *)MPC5XXX_GPIO;
-       struct mpc5xxx_psc *psc1 = (struct mpc5xxx_psc *)MPC5XXX_PSC1;
-
-       switch  (simple_strtoul(argv[2], NULL, 10)) {
-
-       case 1:
-               /* check RTS <-> CTS loop */
-               /* set rts to 0 */
-               psc1->op1 |= 0x01;
-
-               /* wait some time before requesting status */
-               udelay(10);
-
-               /* check status at cts */
-               if ((psc1->ip & 0x01) != 0) {
-                       error_status = 3;
-                       printf ("%s: failure at rs232_1, cts status is %d "
-                               "(should be 0)\n",
-                               __FUNCTION__, (psc1->ip & 0x01));
-               }
-
-               /* set rts to 1 */
-               psc1->op0 |= 0x01;
-
-               /* wait some time before requesting status */
-               udelay(10);
-
-               /* check status at cts */
-               if ((psc1->ip & 0x01) != 1) {
-                       error_status = 3;
-                       printf ("%s: failure at rs232_1, cts status is %d "
-                               "(should be 1)\n",
-                               __FUNCTION__, (psc1->ip & 0x01));
-               }
-
-               break;
-
-       case 2:
-               /* set PSC3_0, PSC3_2 as output and PSC3_1, PSC3_3 as input */
-               gpio->simple_ddr &= ~(0x00000F00);
-               gpio->simple_ddr |=   0x00000500;
-
-               /* check TXD <-> RXD loop */
-               /* set TXD to 1 */
-               gpio->simple_dvo |=   (1 << 8);
-
-               /* wait some time before requesting status */
-               udelay(10);
-
-               if ((gpio->simple_ival & 0x00000200) != 0x00000200) {
-                       error_status = 2;
-                       printf ("%s: failure at rs232_2, rxd status is %d "
-                               "(should be 1)\n",
-                               __FUNCTION__,
-                               (gpio->simple_ival & 0x00000200) >> 9);
-               }
-
-               /* set TXD to 0 */
-               gpio->simple_dvo &= ~(1 << 8);
-
-               /* wait some time before requesting status */
-               udelay(10);
-
-               if ((gpio->simple_ival & 0x00000200) != 0x00000000) {
-                       error_status = 2;
-                       printf ("%s: failure at rs232_2, rxd status is %d "
-                               "(should be 0)\n",
-                               __FUNCTION__,
-                               (gpio->simple_ival & 0x00000200) >> 9);
-               }
-
-               /* check RTS <-> CTS loop */
-               /* set RTS to 1 */
-               gpio->simple_dvo |=   (1 << 10);
-
-               /* wait some time before requesting status */
-               udelay(10);
-
-               if ((gpio->simple_ival & 0x00000800) != 0x00000800) {
-                       error_status = 3;
-                       printf ("%s: failure at rs232_2, cts status is %d "
-                               "(should be 1)\n",
-                               __FUNCTION__,
-                               (gpio->simple_ival & 0x00000800) >> 11);
-               }
-
-               /* set RTS to 0 */
-               gpio->simple_dvo &= ~(1 << 10);
-
-               /* wait some time before requesting status */
-               udelay(10);
-
-               if ((gpio->simple_ival & 0x00000800) != 0x00000000) {
-                       error_status = 3;
-                       printf ("%s: failure at rs232_2, cts status is %d "
-                               "(should be 0)\n",
-                               __FUNCTION__,
-                               (gpio->simple_ival & 0x00000800) >> 11);
-               }
-
-               /* set PSC3_0, PSC3_1, PSC3_2 and PSC3_3 as output */
-               gpio->simple_ddr &= ~(0x00000F00);
-               gpio->simple_ddr |=   0x00000F00;
-               break;
-
-       default:
-               printf ("%s: invalid rs232 number %s\n", __FUNCTION__, argv[2]);
-               error_status = 1;
-               break;
-       }
-
-       return error_status;
-}
-
-#if !defined(CONFIG_FO300) && !defined(CONFIG_TQM5200S)
-static void sm501_backlight (unsigned int state)
-{
-       if (state == BL_ON) {
-               *(vu_long *)(SM501_MMIO_BASE+SM501_PANEL_DISPLAY_CONTROL) |=
-                       (1 << 26) | (1 << 27);
-       } else if (state == BL_OFF)
-               *(vu_long *)(SM501_MMIO_BASE+SM501_PANEL_DISPLAY_CONTROL) &=
-                       ~((1 << 26) | (1 << 27));
-}
-#endif /* !CONFIG_FO300 & !CONFIG_TQM5200S */
-
-int cmd_fkt(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
-{
-       int rcode;
-
-#ifdef CONFIG_STK52XX_REV100
-       printf ("Revision 100 of STK52XX not supported!\n");
-       return 1;
-#endif
-#if defined(CONFIG_STK52XX)
-       led_init();
-#endif
-       can_init();
-
-       switch (argc) {
-
-       case 0:
-       case 1:
-               break;
-
-       case 2:
-               if (strncmp (argv[1], "can", 3) == 0) {
-                       rcode = do_can (argv);
-                       if (rcode == 0)
-                               printf ("OK\n");
-                       else
-                               printf ("Error\n");
-                       return rcode;
-               }
-               break;
-
-       case 3:
-               if (strncmp (argv[1], "rs232", 3) == 0) {
-                       rcode = do_rs232 (argv);
-                       if (rcode == 0)
-                               printf ("OK\n");
-                       else
-                               printf ("Error\n");
-                       return rcode;
-#if !defined(CONFIG_FO300) && !defined(CONFIG_TQM5200S)
-               } else if (strncmp (argv[1], "backlight", 4) == 0) {
-                       if (strncmp (argv[2], "on", 2) == 0) {
-                               sm501_backlight (BL_ON);
-                               return 0;
-                       }
-                       else if (strncmp (argv[2], "off", 3) == 0) {
-                               sm501_backlight (BL_OFF);
-                               return 0;
-                       }
-#endif /* !CONFIG_FO300 & !CONFIG_TQM5200S */
-               }
-               break;
-
-#if defined(CONFIG_STK52XX)
-       case 4:
-               if (strcmp (argv[1], "led") == 0) {
-                       return (do_led (argv));
-               }
-               break;
-#endif
-
-       default:
-               break;
-       }
-
-       printf ("Usage:\nfkt cmd [arg1] [arg2] ...\n");
-       return 1;
-}
-
-
-U_BOOT_CMD(
-       sound ,    5,    1,     cmd_sound,
-       "sound   - Sound sub-system\n",
-       "saw [duration] [freq] [channel]\n"
-       "    - generate sawtooth for 'duration' ms with frequency 'freq'\n"
-       "      on left \"l\" or right \"r\" channel\n"
-       "sound square [duration] [freq] [channel]\n"
-       "    - generate squarewave for 'duration' ms with frequency 'freq'\n"
-       "      on left \"l\" or right \"r\" channel\n"
-       "pcm1772 reg val\n"
-);
-
-U_BOOT_CMD(
-       wav ,    3,    1,     cmd_wav,
-       "wav     - play wav file\n",
-       "[addr] [bytes]\n"
-       "    - play wav file at address 'addr' with length 'bytes'\n"
-);
-
-U_BOOT_CMD(
-       beep ,    2,    1,     cmd_beep,
-       "beep    - play short beep\n",
-       "[channel]\n"
-       "    - play short beep on \"l\"eft or \"r\"ight channel\n"
-);
-#endif /* CONFIG_STK52XX  || CONFIG_FO300 */
-
-#if defined(CONFIG_STK52XX)
-U_BOOT_CMD(
-       fkt ,   4,      1,      cmd_fkt,
-       "fkt     - Function test routines\n",
-       "led number on/off\n"
-       "     - 'number's like printed on STK52XX board\n"
-       "fkt can\n"
-       "     - loopback plug for X83 required\n"
-       "fkt rs232 number\n"
-       "     - loopback plug(s) for X2 required\n"
-#ifndef CONFIG_TQM5200S
-       "fkt backlight on/off\n"
-       "     - switch backlight on or off\n"
-#endif /* !CONFIG_TQM5200S */
-);
-#elif defined(CONFIG_FO300)
-U_BOOT_CMD(
-       fkt ,   3,      1,      cmd_fkt,
-       "fkt     - Function test routines\n",
-       "fkt can\n"
-       "     - loopback plug for X16/X29 required\n"
-       "fkt rs232 number\n"
-       "     - loopback plug(s) for X21/X22 required\n"
-);
-#endif
-#endif
diff --git a/board/tqm5200/cmd_tb5200.c b/board/tqm5200/cmd_tb5200.c
deleted file mode 100644 (file)
index 214dca6..0000000
+++ /dev/null
@@ -1,104 +0,0 @@
-/*
- * (C) Copyright 2005 - 2006
- * Martin Krause, TQ-Systems GmbH, martin.krause@tqs.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
- */
-
-/*
- * TB5200 specific functions
- */
-/*#define DEBUG*/
-
-#include <common.h>
-#include <command.h>
-
-#if defined(CONFIG_CMD_BSP)
-#if defined (CONFIG_TB5200)
-
-#define SM501_PANEL_DISPLAY_CONTROL    0x00080000UL
-
-static void led_init(void)
-{
-       struct mpc5xxx_gpt_0_7 *gpt = (struct mpc5xxx_gpt_0_7 *)MPC5XXX_GPT;
-
-       /* configure timer 4 for simple GPIO output */
-       gpt->gpt4.emsr |=  0x00000024;
-}
-
-int cmd_led(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
-{
-       struct mpc5xxx_gpt_0_7 *gpt = (struct mpc5xxx_gpt_0_7 *)MPC5XXX_GPT;
-
-       led_init();
-
-       if (strcmp (argv[1], "on") == 0) {
-               debug ("switch status LED on\n");
-               gpt->gpt4.emsr |=  (1 << 4);
-       } else if (strcmp (argv[1], "off") == 0) {
-               debug ("switch status LED off\n");
-               gpt->gpt4.emsr &=  ~(1 << 4);
-       } else {
-               printf ("Usage:\nled on/off\n");
-               return 1;
-       }
-
-       return 0;
-}
-
-static void sm501_backlight (unsigned int state)
-{
-       if (state == 1) {
-               *(vu_long *)(SM501_MMIO_BASE+SM501_PANEL_DISPLAY_CONTROL) |=
-                       (1 << 26) | (1 << 27);
-       } else if (state == 0)
-               *(vu_long *)(SM501_MMIO_BASE+SM501_PANEL_DISPLAY_CONTROL) &=
-                       ~((1 << 26) | (1 << 27));
-}
-
-int cmd_backlight(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
-{
-       if (strcmp (argv[1], "on") == 0) {
-               debug ("switch backlight on\n");
-               sm501_backlight (1);
-       } else if (strcmp (argv[1], "off") == 0) {
-               debug ("switch backlight off\n");
-               sm501_backlight (0);
-       } else {
-               printf ("Usage:\nbacklight on/off\n");
-               return 1;
-       }
-
-       return 0;
-}
-
-U_BOOT_CMD(
-       led ,   2,      1,      cmd_led,
-       "led     - switch status LED on or off\n",
-       "on/off\n"
-);
-
-U_BOOT_CMD(
-       backlight ,     2,      1,      cmd_backlight,
-       "backlight - switch backlight on or off\n",
-       "on/off\n"
-       );
-
-#endif /* CONFIG_STK52XX */
-#endif
diff --git a/board/tqm5200/config.mk b/board/tqm5200/config.mk
deleted file mode 100644 (file)
index d72dfe7..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-#
-# (C) Copyright 2004
-# Wolfgang Denk, DENX Software Engineering, wd@denx.de.
-#
-# See file CREDITS for list of people who contributed to this
-# project.
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License as
-# published by the Free Software Foundation; either version 2 of
-# the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
-# MA 02111-1307 USA
-#
-
-#
-# TQM5200 board:
-#
-#      Valid values for TEXT_BASE are:
-#
-#      0xFC000000   boot low (standard configuration with room for max 64 MByte
-#                   Flash ROM)
-#      0xFFF00000   boot high (for a backup copy of U-Boot)
-#      0x00100000   boot from RAM (for testing only)
-#
-
-sinclude $(OBJTREE)/board/$(BOARDDIR)/config.tmp
-
-ifndef TEXT_BASE
-## Standard: boot low
-TEXT_BASE = 0xFC000000
-## For a backup copy of U-Boot at the end of flash: boot high
-# TEXT_BASE = 0xFFF00000
-## For testing: boot from RAM
-# TEXT_BASE = 0x00100000
-endif
-
-PLATFORM_CPPFLAGS += -DTEXT_BASE=$(TEXT_BASE) -I$(TOPDIR)/board
diff --git a/board/tqm5200/mt48lc16m16a2-75.h b/board/tqm5200/mt48lc16m16a2-75.h
deleted file mode 100644 (file)
index 3f1e169..0000000
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * (C) Copyright 2004
- * Mark Jonas, Freescale Semiconductor, mark.jonas@motorola.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
- */
-
-#define SDRAM_DDR      0               /* is SDR */
-
-#if defined(CONFIG_MPC5200)
-/* Settings for XLB = 132 MHz */
-#define SDRAM_MODE     0x00CD0000
-/* #define SDRAM_MODE  0x008D0000 */ /* CAS latency 2 */
-#define SDRAM_CONTROL  0x504F0000
-#define SDRAM_CONFIG1  0xD2322800
-/* #define SDRAM_CONFIG1       0xD2222800 */ /* CAS latency 2 */
-/*#define SDRAM_CONFIG1        0xD7322800 */ /* SDRAM controller bug workaround */
-#define SDRAM_CONFIG2  0x8AD70000
-/*#define SDRAM_CONFIG2        0xDDD70000 */ /* SDRAM controller bug workaround */
-
-#elif defined(CONFIG_MGT5100)
-/* Settings for XLB = 66 MHz */
-#define SDRAM_MODE     0x008D0000
-#define SDRAM_CONTROL  0x504F0000
-#define SDRAM_CONFIG1  0xC2222600
-#define SDRAM_CONFIG2  0x88B70004
-#define SDRAM_ADDRSEL  0x02000000
-
-#else
-#error Neither CONFIG_MPC5200 or CONFIG_MGT5100 defined
-#endif
diff --git a/board/tqm5200/tqm5200.c b/board/tqm5200/tqm5200.c
deleted file mode 100644 (file)
index f9891db..0000000
+++ /dev/null
@@ -1,751 +0,0 @@
-/*
- * (C) Copyright 2003-2006
- * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
- *
- * (C) Copyright 2004
- * Mark Jonas, Freescale Semiconductor, mark.jonas@motorola.com.
- *
- * (C) Copyright 2004-2006
- * Martin Krause, TQ-Systems GmbH, martin.krause@tqs.de
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.         See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-
-#include <common.h>
-#include <mpc5xxx.h>
-#include <pci.h>
-#include <asm/processor.h>
-#include <libfdt.h>
-
-#ifdef CONFIG_VIDEO_SM501
-#include <sm501.h>
-#endif
-
-#if defined(CONFIG_MPC5200_DDR)
-#include "mt46v16m16-75.h"
-#else
-#include "mt48lc16m16a2-75.h"
-#endif
-
-#ifdef CONFIG_OF_LIBFDT
-#include <fdt_support.h>
-#endif /* CONFIG_OF_LIBFDT */
-
-DECLARE_GLOBAL_DATA_PTR;
-
-#ifdef CONFIG_PS2MULT
-void ps2mult_early_init(void);
-#endif
-
-#ifndef CFG_RAMBOOT
-static void sdram_start (int hi_addr)
-{
-       long hi_addr_bit = hi_addr ? 0x01000000 : 0;
-
-       /* unlock mode register */
-       *(vu_long *)MPC5XXX_SDRAM_CTRL = SDRAM_CONTROL | 0x80000000 |
-               hi_addr_bit;
-       __asm__ volatile ("sync");
-
-       /* precharge all banks */
-       *(vu_long *)MPC5XXX_SDRAM_CTRL = SDRAM_CONTROL | 0x80000002 |
-               hi_addr_bit;
-       __asm__ volatile ("sync");
-
-#if SDRAM_DDR
-       /* set mode register: extended mode */
-       *(vu_long *)MPC5XXX_SDRAM_MODE = SDRAM_EMODE;
-       __asm__ volatile ("sync");
-
-       /* set mode register: reset DLL */
-       *(vu_long *)MPC5XXX_SDRAM_MODE = SDRAM_MODE | 0x04000000;
-       __asm__ volatile ("sync");
-#endif
-
-       /* precharge all banks */
-       *(vu_long *)MPC5XXX_SDRAM_CTRL = SDRAM_CONTROL | 0x80000002 |
-               hi_addr_bit;
-       __asm__ volatile ("sync");
-
-       /* auto refresh */
-       *(vu_long *)MPC5XXX_SDRAM_CTRL = SDRAM_CONTROL | 0x80000004 |
-               hi_addr_bit;
-       __asm__ volatile ("sync");
-
-       /* set mode register */
-       *(vu_long *)MPC5XXX_SDRAM_MODE = SDRAM_MODE;
-       __asm__ volatile ("sync");
-
-       /* normal operation */
-       *(vu_long *)MPC5XXX_SDRAM_CTRL = SDRAM_CONTROL | hi_addr_bit;
-       __asm__ volatile ("sync");
-}
-#endif
-
-/*
- * ATTENTION: Although partially referenced initdram does NOT make real use
- *           use of CFG_SDRAM_BASE. The code does not work if CFG_SDRAM_BASE
- *           is something else than 0x00000000.
- */
-
-long int initdram (int board_type)
-{
-       ulong dramsize = 0;
-       ulong dramsize2 = 0;
-       uint svr, pvr;
-
-#ifndef CFG_RAMBOOT
-       ulong test1, test2;
-
-       /* setup SDRAM chip selects */
-       *(vu_long *)MPC5XXX_SDRAM_CS0CFG = 0x0000001c; /* 512MB at 0x0 */
-       *(vu_long *)MPC5XXX_SDRAM_CS1CFG = 0x40000000; /* disabled */
-       __asm__ volatile ("sync");
-
-       /* setup config registers */
-       *(vu_long *)MPC5XXX_SDRAM_CONFIG1 = SDRAM_CONFIG1;
-       *(vu_long *)MPC5XXX_SDRAM_CONFIG2 = SDRAM_CONFIG2;
-       __asm__ volatile ("sync");
-
-#if SDRAM_DDR
-       /* set tap delay */
-       *(vu_long *)MPC5XXX_CDM_PORCFG = SDRAM_TAPDELAY;
-       __asm__ volatile ("sync");
-#endif
-
-       /* find RAM size using SDRAM CS0 only */
-       sdram_start(0);
-       test1 = get_ram_size((long *)CFG_SDRAM_BASE, 0x20000000);
-       sdram_start(1);
-       test2 = get_ram_size((long *)CFG_SDRAM_BASE, 0x20000000);
-       if (test1 > test2) {
-               sdram_start(0);
-               dramsize = test1;
-       } else {
-               dramsize = test2;
-       }
-
-       /* memory smaller than 1MB is impossible */
-       if (dramsize < (1 << 20)) {
-               dramsize = 0;
-       }
-
-       /* set SDRAM CS0 size according to the amount of RAM found */
-       if (dramsize > 0) {
-               *(vu_long *)MPC5XXX_SDRAM_CS0CFG = 0x13 +
-                       __builtin_ffs(dramsize >> 20) - 1;
-       } else {
-               *(vu_long *)MPC5XXX_SDRAM_CS0CFG = 0; /* disabled */
-       }
-
-       /* let SDRAM CS1 start right after CS0 */
-       *(vu_long *)MPC5XXX_SDRAM_CS1CFG = dramsize + 0x0000001c; /* 512MB */
-
-       /* find RAM size using SDRAM CS1 only */
-       if (!dramsize)
-               sdram_start(0);
-       test2 = test1 = get_ram_size((long *)(CFG_SDRAM_BASE + dramsize), 0x20000000);
-       if (!dramsize) {
-               sdram_start(1);
-               test2 = get_ram_size((long *)(CFG_SDRAM_BASE + dramsize), 0x20000000);
-       }
-       if (test1 > test2) {
-               sdram_start(0);
-               dramsize2 = test1;
-       } else {
-               dramsize2 = test2;
-       }
-
-       /* memory smaller than 1MB is impossible */
-       if (dramsize2 < (1 << 20)) {
-               dramsize2 = 0;
-       }
-
-       /* set SDRAM CS1 size according to the amount of RAM found */
-       if (dramsize2 > 0) {
-               *(vu_long *)MPC5XXX_SDRAM_CS1CFG = dramsize
-                       | (0x13 + __builtin_ffs(dramsize2 >> 20) - 1);
-       } else {
-               *(vu_long *)MPC5XXX_SDRAM_CS1CFG = dramsize; /* disabled */
-       }
-
-#else /* CFG_RAMBOOT */
-
-       /* retrieve size of memory connected to SDRAM CS0 */
-       dramsize = *(vu_long *)MPC5XXX_SDRAM_CS0CFG & 0xFF;
-       if (dramsize >= 0x13) {
-               dramsize = (1 << (dramsize - 0x13)) << 20;
-       } else {
-               dramsize = 0;
-       }
-
-       /* retrieve size of memory connected to SDRAM CS1 */
-       dramsize2 = *(vu_long *)MPC5XXX_SDRAM_CS1CFG & 0xFF;
-       if (dramsize2 >= 0x13) {
-               dramsize2 = (1 << (dramsize2 - 0x13)) << 20;
-       } else {
-               dramsize2 = 0;
-       }
-#endif /* CFG_RAMBOOT */
-
-       /*
-        * On MPC5200B we need to set the special configuration delay in the
-        * DDR controller. Please refer to Freescale's AN3221 "MPC5200B SDRAM
-        * Initialization and Configuration", 3.3.1 SDelay--MBAR + 0x0190:
-        *
-        * "The SDelay should be written to a value of 0x00000004. It is
-        * required to account for changes caused by normal wafer processing
-        * parameters."
-        */
-       svr = get_svr();
-       pvr = get_pvr();
-       if ((SVR_MJREV(svr) >= 2) &&
-           (PVR_MAJ(pvr) == 1) && (PVR_MIN(pvr) == 4)) {
-
-               *(vu_long *)MPC5XXX_SDRAM_SDELAY = 0x04;
-               __asm__ volatile ("sync");
-       }
-
-#if defined(CONFIG_TQM5200_B)
-       return dramsize + dramsize2;
-#else
-       return dramsize;
-#endif /* CONFIG_TQM5200_B */
-}
-
-int checkboard (void)
-{
-#if defined(CONFIG_AEVFIFO)
-       puts ("Board: AEVFIFO\n");
-       return 0;
-#endif
-
-#if defined(CONFIG_TQM5200S)
-# define MODULE_NAME   "TQM5200S"
-#else
-# define MODULE_NAME   "TQM5200"
-#endif
-
-#if defined(CONFIG_STK52XX)
-# define CARRIER_NAME  "STK52xx"
-#elif defined(CONFIG_TB5200)
-# define CARRIER_NAME  "TB5200"
-#elif defined(CONFIG_CAM5200)
-# define CARRIER_NAME  "CAM5200"
-#elif defined(CONFIG_FO300)
-# define CARRIER_NAME  "FO300"
-#else
-# error "UNKNOWN"
-#endif
-
-       puts (  "Board: " MODULE_NAME " (TQ-Components GmbH)\n"
-               "       on a " CARRIER_NAME " carrier board\n");
-
-       return 0;
-}
-
-#undef MODULE_NAME
-#undef CARRIER_NAME
-
-void flash_preinit(void)
-{
-       /*
-        * Now, when we are in RAM, enable flash write
-        * access for detection process.
-        * Note that CS_BOOT cannot be cleared when
-        * executing in flash.
-        */
-       *(vu_long *)MPC5XXX_BOOTCS_CFG &= ~0x1; /* clear RO */
-}
-
-
-#ifdef CONFIG_PCI
-static struct pci_controller hose;
-
-extern void pci_mpc5xxx_init(struct pci_controller *);
-
-void pci_init_board(void)
-{
-       pci_mpc5xxx_init(&hose);
-}
-#endif
-
-#if defined(CONFIG_CMD_IDE) && defined(CONFIG_IDE_RESET)
-
-#if defined (CONFIG_MINIFAP)
-#define SM501_POWER_MODE0_GATE         0x00000040UL
-#define SM501_POWER_MODE1_GATE         0x00000048UL
-#define POWER_MODE_GATE_GPIO_PWM_I2C   0x00000040UL
-#define SM501_GPIO_DATA_DIR_HIGH       0x0001000CUL
-#define SM501_GPIO_DATA_HIGH           0x00010004UL
-#define SM501_GPIO_51                  0x00080000UL
-#endif /* CONFIG MINIFAP */
-
-void init_ide_reset (void)
-{
-       debug ("init_ide_reset\n");
-
-#if defined (CONFIG_MINIFAP)
-       /* Configure GPIO_51 of the SM501 grafic controller as ATA reset */
-
-       /* enable GPIO control (in both power modes) */
-       *(vu_long *) (SM501_MMIO_BASE+SM501_POWER_MODE0_GATE) |=
-               POWER_MODE_GATE_GPIO_PWM_I2C;
-       *(vu_long *) (SM501_MMIO_BASE+SM501_POWER_MODE1_GATE) |=
-               POWER_MODE_GATE_GPIO_PWM_I2C;
-       /* configure GPIO51 as output */
-       *(vu_long *) (SM501_MMIO_BASE+SM501_GPIO_DATA_DIR_HIGH) |=
-               SM501_GPIO_51;
-#else
-       /* Configure PSC1_4 as GPIO output for ATA reset */
-       *(vu_long *) MPC5XXX_WU_GPIO_ENABLE |= GPIO_PSC1_4;
-       *(vu_long *) MPC5XXX_WU_GPIO_DIR    |= GPIO_PSC1_4;
-
-       /* by default the ATA reset is de-asserted */
-       *(vu_long *) MPC5XXX_WU_GPIO_DATA_O |=  GPIO_PSC1_4;
-#endif
-}
-
-void ide_set_reset (int idereset)
-{
-       debug ("ide_reset(%d)\n", idereset);
-
-#if defined (CONFIG_MINIFAP)
-       if (idereset) {
-               *(vu_long *) (SM501_MMIO_BASE+SM501_GPIO_DATA_HIGH) &=
-                       ~SM501_GPIO_51;
-       } else {
-               *(vu_long *) (SM501_MMIO_BASE+SM501_GPIO_DATA_HIGH) |=
-                       SM501_GPIO_51;
-       }
-#else
-       if (idereset) {
-               *(vu_long *) MPC5XXX_WU_GPIO_DATA_O &= ~GPIO_PSC1_4;
-       } else {
-               *(vu_long *) MPC5XXX_WU_GPIO_DATA_O |=  GPIO_PSC1_4;
-       }
-#endif
-}
-#endif
-
-#ifdef CONFIG_POST
-/*
- * Reads GPIO pin PSC6_3. A keypress is reported, if PSC6_3 is low. If PSC6_3
- * is left open, no keypress is detected.
- */
-int post_hotkeys_pressed(void)
-{
-#ifdef CONFIG_STK52XX
-       struct mpc5xxx_gpio *gpio;
-
-       gpio = (struct mpc5xxx_gpio*) MPC5XXX_GPIO;
-
-       /*
-        * Configure PSC6_1 and PSC6_3 as GPIO. PSC6 then couldn't be used in
-        * CODEC or UART mode. Consumer IrDA should still be possible.
-        */
-       gpio->port_config &= ~(0x07000000);
-       gpio->port_config |=   0x03000000;
-
-       /* Enable GPIO for GPIO_IRDA_1 (IR_USB_CLK pin) = PSC6_3 */
-       gpio->simple_gpioe |= 0x20000000;
-
-       /* Configure GPIO_IRDA_1 as input */
-       gpio->simple_ddr &= ~(0x20000000);
-
-       return ((gpio->simple_ival & 0x20000000) ? 0 : 1);
-#else
-       return 0;
-#endif
-}
-#endif
-
-#if defined(CONFIG_POST) || defined(CONFIG_LOGBUFFER)
-
-void post_word_store (ulong a)
-{
-       volatile ulong *save_addr =
-               (volatile ulong *)(MPC5XXX_SRAM + MPC5XXX_SRAM_POST_SIZE);
-
-       *save_addr = a;
-}
-
-ulong post_word_load (void)
-{
-       volatile ulong *save_addr =
-               (volatile ulong *)(MPC5XXX_SRAM + MPC5XXX_SRAM_POST_SIZE);
-
-       return *save_addr;
-}
-#endif /* CONFIG_POST || CONFIG_LOGBUFFER*/
-
-#ifdef CONFIG_BOARD_EARLY_INIT_R
-int board_early_init_r (void)
-{
-
-       extern int usb_cpu_init(void);
-
-#ifdef CONFIG_PS2MULT
-       ps2mult_early_init();
-#endif /* CONFIG_PS2MULT */
-
-#if defined(CONFIG_USB_OHCI_NEW) && defined(CFG_USB_OHCI_CPU_INIT)
-       /* Low level USB init, required for proper kernel operation */
-       usb_cpu_init();
-#endif
-
-       return (0);
-}
-#endif
-
-#ifdef CONFIG_FO300
-int silent_boot (void)
-{
-       vu_long timer3_status;
-
-       /* Configure GPT3 as GPIO input */
-       *(vu_long *)MPC5XXX_GPT3_ENABLE = 0x00000004;
-
-       /* Read in TIMER_3 pin status */
-       timer3_status = *(vu_long *)MPC5XXX_GPT3_STATUS;
-
-#ifdef FO300_SILENT_CONSOLE_WHEN_S1_CLOSED
-       /* Force silent console mode if S1 switch
-        * is in closed position (TIMER_3 pin status is LOW). */
-       if (MPC5XXX_GPT_GPIO_PIN(timer3_status) == 0)
-               return 1;
-#else
-       /* Force silent console mode if S1 switch
-        * is in open position (TIMER_3 pin status is HIGH). */
-       if (MPC5XXX_GPT_GPIO_PIN(timer3_status) == 1)
-               return 1;
-#endif
-
-       return 0;
-}
-
-int board_early_init_f (void)
-{
-       if (silent_boot())
-               gd->flags |= GD_FLG_SILENT;
-
-       return 0;
-}
-#endif /* CONFIG_FO300 */
-
-int last_stage_init (void)
-{
-       /*
-        * auto scan for really existing devices and re-set chip select
-        * configuration.
-        */
-       u16 save, tmp;
-       int restore;
-
-       /*
-        * Check for SRAM and SRAM size
-        */
-
-       /* save original SRAM content  */
-       save = *(volatile u16 *)CFG_CS2_START;
-       restore = 1;
-
-       /* write test pattern to SRAM */
-       *(volatile u16 *)CFG_CS2_START = 0xA5A5;
-       __asm__ volatile ("sync");
-       /*
-        * Put a different pattern on the data lines: otherwise they may float
-        * long enough to read back what we wrote.
-        */
-       tmp = *(volatile u16 *)CFG_FLASH_BASE;
-       if (tmp == 0xA5A5)
-               puts ("!! possible error in SRAM detection\n");
-
-       if (*(volatile u16 *)CFG_CS2_START != 0xA5A5) {
-               /* no SRAM at all, disable cs */
-               *(vu_long *)MPC5XXX_ADDECR &= ~(1 << 18);
-               *(vu_long *)MPC5XXX_CS2_START = 0x0000FFFF;
-               *(vu_long *)MPC5XXX_CS2_STOP = 0x0000FFFF;
-               restore = 0;
-               __asm__ volatile ("sync");
-       } else if (*(volatile u16 *)(CFG_CS2_START + (1<<19)) == 0xA5A5) {
-               /* make sure that we access a mirrored address */
-               *(volatile u16 *)CFG_CS2_START = 0x1111;
-               __asm__ volatile ("sync");
-               if (*(volatile u16 *)(CFG_CS2_START + (1<<19)) == 0x1111) {
-                       /* SRAM size = 512 kByte */
-                       *(vu_long *)MPC5XXX_CS2_STOP = STOP_REG(CFG_CS2_START,
-                                                               0x80000);
-                       __asm__ volatile ("sync");
-                       puts ("SRAM:  512 kB\n");
-               }
-               else
-                       puts ("!! possible error in SRAM detection\n");
-       } else {
-               puts ("SRAM:  1 MB\n");
-       }
-       /* restore origianl SRAM content  */
-       if (restore) {
-               *(volatile u16 *)CFG_CS2_START = save;
-               __asm__ volatile ("sync");
-       }
-
-#ifndef CONFIG_TQM5200S        /* The TQM5200S has no SM501 grafic controller */
-       /*
-        * Check for Grafic Controller
-        */
-
-       /* save origianl FB content  */
-       save = *(volatile u16 *)CFG_CS1_START;
-       restore = 1;
-
-       /* write test pattern to FB memory */
-       *(volatile u16 *)CFG_CS1_START = 0xA5A5;
-       __asm__ volatile ("sync");
-       /*
-        * Put a different pattern on the data lines: otherwise they may float
-        * long enough to read back what we wrote.
-        */
-       tmp = *(volatile u16 *)CFG_FLASH_BASE;
-       if (tmp == 0xA5A5)
-               puts ("!! possible error in grafic controller detection\n");
-
-       if (*(volatile u16 *)CFG_CS1_START != 0xA5A5) {
-               /* no grafic controller at all, disable cs */
-               *(vu_long *)MPC5XXX_ADDECR &= ~(1 << 17);
-               *(vu_long *)MPC5XXX_CS1_START = 0x0000FFFF;
-               *(vu_long *)MPC5XXX_CS1_STOP = 0x0000FFFF;
-               restore = 0;
-               __asm__ volatile ("sync");
-       } else {
-               puts ("VGA:   SMI501 (Voyager) with 8 MB\n");
-       }
-       /* restore origianl FB content  */
-       if (restore) {
-               *(volatile u16 *)CFG_CS1_START = save;
-               __asm__ volatile ("sync");
-       }
-
-#ifdef CONFIG_FO300
-       if (silent_boot()) {
-               setenv("bootdelay", "0");
-               disable_ctrlc(1);
-       }
-#endif
-#endif /* !CONFIG_TQM5200S */
-
-       return 0;
-}
-
-#ifdef CONFIG_VIDEO_SM501
-
-#ifdef CONFIG_FO300
-#define DISPLAY_WIDTH   800
-#else
-#define DISPLAY_WIDTH   640
-#endif
-#define DISPLAY_HEIGHT  480
-
-#ifdef CONFIG_VIDEO_SM501_8BPP
-#error CONFIG_VIDEO_SM501_8BPP not supported.
-#endif /* CONFIG_VIDEO_SM501_8BPP */
-
-#ifdef CONFIG_VIDEO_SM501_16BPP
-#error CONFIG_VIDEO_SM501_16BPP not supported.
-#endif /* CONFIG_VIDEO_SM501_16BPP */
-#ifdef CONFIG_VIDEO_SM501_32BPP
-static const SMI_REGS init_regs [] =
-{
-#if 0 /* CRT only */
-       {0x00004, 0x0},
-       {0x00048, 0x00021807},
-       {0x0004C, 0x10090a01},
-       {0x00054, 0x1},
-       {0x00040, 0x00021807},
-       {0x00044, 0x10090a01},
-       {0x00054, 0x0},
-       {0x80200, 0x00010000},
-       {0x80204, 0x0},
-       {0x80208, 0x0A000A00},
-       {0x8020C, 0x02fa027f},
-       {0x80210, 0x004a028b},
-       {0x80214, 0x020c01df},
-       {0x80218, 0x000201e9},
-       {0x80200, 0x00013306},
-#else  /* panel + CRT */
-#ifdef CONFIG_FO300
-       {0x00004, 0x0},
-       {0x00048, 0x00021807},
-       {0x0004C, 0x301a0a01},
-       {0x00054, 0x1},
-       {0x00040, 0x00021807},
-       {0x00044, 0x091a0a01},
-       {0x00054, 0x0},
-       {0x80000, 0x0f013106},
-       {0x80004, 0xc428bb17},
-       {0x8000C, 0x00000000},
-       {0x80010, 0x0C800C80},
-       {0x80014, 0x03200000},
-       {0x80018, 0x01e00000},
-       {0x8001C, 0x00000000},
-       {0x80020, 0x01e00320},
-       {0x80024, 0x042a031f},
-       {0x80028, 0x0086034a},
-       {0x8002C, 0x020c01df},
-       {0x80030, 0x000201ea},
-       {0x80200, 0x00010000},
-#else
-       {0x00004, 0x0},
-       {0x00048, 0x00021807},
-       {0x0004C, 0x091a0a01},
-       {0x00054, 0x1},
-       {0x00040, 0x00021807},
-       {0x00044, 0x091a0a01},
-       {0x00054, 0x0},
-       {0x80000, 0x0f013106},
-       {0x80004, 0xc428bb17},
-       {0x8000C, 0x00000000},
-       {0x80010, 0x0a000a00},
-       {0x80014, 0x02800000},
-       {0x80018, 0x01e00000},
-       {0x8001C, 0x00000000},
-       {0x80020, 0x01e00280},
-       {0x80024, 0x02fa027f},
-       {0x80028, 0x004a028b},
-       {0x8002C, 0x020c01df},
-       {0x80030, 0x000201e9},
-       {0x80200, 0x00010000},
-#endif /* #ifdef CONFIG_FO300 */
-#endif
-       {0, 0}
-};
-#endif /* CONFIG_VIDEO_SM501_32BPP */
-
-#ifdef CONFIG_CONSOLE_EXTRA_INFO
-/*
- * Return text to be printed besides the logo.
- */
-void video_get_info_str (int line_number, char *info)
-{
-       if (line_number == 1) {
-       strcpy (info, " Board: TQM5200 (TQ-Components GmbH)");
-#if defined (CONFIG_STK52XX) || defined (CONFIG_TB5200) || defined(CONFIG_FO300)
-       } else if (line_number == 2) {
-#if defined (CONFIG_STK52XX)
-               strcpy (info, "        on a STK52xx carrier board");
-#endif
-#if defined (CONFIG_TB5200)
-               strcpy (info, "        on a TB5200 carrier board");
-#endif
-#if defined (CONFIG_FO300)
-               strcpy (info, "        on a FO300 carrier board");
-#endif
-#endif
-       }
-       else {
-               info [0] = '\0';
-       }
-}
-#endif
-
-/*
- * Returns SM501 register base address. First thing called in the
- * driver. Checks if SM501 is physically present.
- */
-unsigned int board_video_init (void)
-{
-       u16 save, tmp;
-       int restore, ret;
-
-       /*
-        * Check for Grafic Controller
-        */
-
-       /* save origianl FB content  */
-       save = *(volatile u16 *)CFG_CS1_START;
-       restore = 1;
-
-       /* write test pattern to FB memory */
-       *(volatile u16 *)CFG_CS1_START = 0xA5A5;
-       __asm__ volatile ("sync");
-       /*
-        * Put a different pattern on the data lines: otherwise they may float
-        * long enough to read back what we wrote.
-        */
-       tmp = *(volatile u16 *)CFG_FLASH_BASE;
-       if (tmp == 0xA5A5)
-               puts ("!! possible error in grafic controller detection\n");
-
-       if (*(volatile u16 *)CFG_CS1_START != 0xA5A5) {
-               /* no grafic controller found */
-               restore = 0;
-               ret = 0;
-       } else {
-               ret = SM501_MMIO_BASE;
-       }
-
-       if (restore) {
-               *(volatile u16 *)CFG_CS1_START = save;
-               __asm__ volatile ("sync");
-       }
-       return ret;
-}
-
-/*
- * Returns SM501 framebuffer address
- */
-unsigned int board_video_get_fb (void)
-{
-       return SM501_FB_BASE;
-}
-
-/*
- * Called after initializing the SM501 and before clearing the screen.
- */
-void board_validate_screen (unsigned int base)
-{
-}
-
-/*
- * Return a pointer to the initialization sequence.
- */
-const SMI_REGS *board_get_regs (void)
-{
-       return init_regs;
-}
-
-int board_get_width (void)
-{
-       return DISPLAY_WIDTH;
-}
-
-int board_get_height (void)
-{
-       return DISPLAY_HEIGHT;
-}
-
-#endif /* CONFIG_VIDEO_SM501 */
-
-#if defined(CONFIG_OF_LIBFDT) && defined(CONFIG_OF_BOARD_SETUP)
-void ft_board_setup(void *blob, bd_t *bd)
-{
-       ft_cpu_setup(blob, bd);
-       fdt_fixup_memory(blob, (u64)bd->bi_memstart, (u64)bd->bi_memsize);
-}
-#endif /* defined(CONFIG_OF_LIBFDT) && defined(CONFIG_OF_BOARD_SETUP) */
diff --git a/board/tqm8260/Makefile b/board/tqm8260/Makefile
deleted file mode 100644 (file)
index 61221fd..0000000
+++ /dev/null
@@ -1,47 +0,0 @@
-#
-# (C) Copyright 2001-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
-ifneq ($(OBJTREE),$(SRCTREE))
-$(shell mkdir -p $(obj)../tqm8xx/)
-endif
-
-LIB    = $(obj)lib$(BOARD).a
-
-COBJS  = $(BOARD).o flash.o ../tqm8xx/load_sernum_ethaddr.o
-
-SRCS   := $(SOBJS:.o=.S) $(COBJS:.o=.c)
-OBJS   := $(addprefix $(obj),$(COBJS))
-SOBJS  := $(addprefix $(obj),$(SOBJS))
-
-$(LIB):        $(obj).depend $(OBJS)
-       $(AR) $(ARFLAGS) $@ $(OBJS)
-
-#########################################################################
-
-# defines $(obj).depend target
-include $(SRCTREE)/rules.mk
-
-sinclude $(obj).depend
-
-#########################################################################
diff --git a/board/tqm8260/config.mk b/board/tqm8260/config.mk
deleted file mode 100644 (file)
index 1fe9952..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-#
-# (C) Copyright 2001
-# Wolfgang Denk, DENX Software Engineering, wd@denx.de.
-#
-# See file CREDITS for list of people who contributed to this
-# project.
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License as
-# published by the Free Software Foundation; either version 2 of
-# the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
-# MA 02111-1307 USA
-#
-
-#
-# TQM8260 boards
-#
-
-# This should be equal to the CFG_FLASH_BASE define in config_TQM8260.h
-# for the "final" configuration, with U-Boot in flash, or the address
-# in RAM where U-Boot is loaded at for debugging.
-#
-TEXT_BASE = 0x40000000
-
-PLATFORM_CPPFLAGS += -DTEXT_BASE=$(TEXT_BASE) -I$(TOPDIR)
diff --git a/board/tqm8260/flash.c b/board/tqm8260/flash.c
deleted file mode 100644 (file)
index 056fe81..0000000
+++ /dev/null
@@ -1,488 +0,0 @@
-/*
- * (C) Copyright 2001, 2002
- * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
- *
- * Flash Routines for AMD devices on the TQM8260 board
- *
- *--------------------------------------------------------------------
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-
-#include <common.h>
-#include <mpc8xx.h>
-
-#define V_ULONG(a)     (*(volatile unsigned long *)( a ))
-#define V_BYTE(a)      (*(volatile unsigned char *)( a ))
-
-
-flash_info_t flash_info[CFG_MAX_FLASH_BANKS];
-
-
-/*-----------------------------------------------------------------------
- */
-void flash_reset (void)
-{
-       if (flash_info[0].flash_id != FLASH_UNKNOWN) {
-               V_ULONG (flash_info[0].start[0]) = 0x00F000F0;
-               V_ULONG (flash_info[0].start[0] + 4) = 0x00F000F0;
-       }
-}
-
-/*-----------------------------------------------------------------------
- */
-ulong flash_get_size (ulong baseaddr, flash_info_t * info)
-{
-       short i;
-       unsigned long flashtest_h, flashtest_l;
-
-       /* Write auto select command sequence and test FLASH answer */
-       V_ULONG (baseaddr + ((ulong) 0x0555 << 3)) = 0x00AA00AA;
-       V_ULONG (baseaddr + ((ulong) 0x02AA << 3)) = 0x00550055;
-       V_ULONG (baseaddr + ((ulong) 0x0555 << 3)) = 0x00900090;
-       V_ULONG (baseaddr + 4 + ((ulong) 0x0555 << 3)) = 0x00AA00AA;
-       V_ULONG (baseaddr + 4 + ((ulong) 0x02AA << 3)) = 0x00550055;
-       V_ULONG (baseaddr + 4 + ((ulong) 0x0555 << 3)) = 0x00900090;
-
-       flashtest_h = V_ULONG (baseaddr);       /* manufacturer ID     */
-       flashtest_l = V_ULONG (baseaddr + 4);
-
-       switch ((int) flashtest_h) {
-       case AMD_MANUFACT:
-               info->flash_id = FLASH_MAN_AMD;
-               break;
-       case FUJ_MANUFACT:
-               info->flash_id = FLASH_MAN_FUJ;
-               break;
-       default:
-               info->flash_id = FLASH_UNKNOWN;
-               info->sector_count = 0;
-               info->size = 0;
-               return (0);                     /* no or unknown flash     */
-       }
-
-       flashtest_h = V_ULONG (baseaddr + 8);   /* device ID           */
-       flashtest_l = V_ULONG (baseaddr + 12);
-       if (flashtest_h != flashtest_l) {
-               info->flash_id = FLASH_UNKNOWN;
-       } else {
-               switch (flashtest_h) {
-               case AMD_ID_LV800T:
-                       info->flash_id += FLASH_AM800T;
-                       info->sector_count = 19;
-                       info->size = 0x00400000;
-                       break;                  /* 4 * 1 MB = 4 MB  */
-               case AMD_ID_LV800B:
-                       info->flash_id += FLASH_AM800B;
-                       info->sector_count = 19;
-                       info->size = 0x00400000;
-                       break;                  /* 4 * 1 MB = 4 MB  */
-               case AMD_ID_LV160T:
-                       info->flash_id += FLASH_AM160T;
-                       info->sector_count = 35;
-                       info->size = 0x00800000;
-                       break;                  /* 4 * 2 MB = 8 MB  */
-               case AMD_ID_LV160B:
-                       info->flash_id += FLASH_AM160B;
-                       info->sector_count = 35;
-                       info->size = 0x00800000;
-                       break;                  /* 4 * 2 MB = 8 MB  */
-               case AMD_ID_DL322T:
-                       info->flash_id += FLASH_AMDL322T;
-                       info->sector_count = 71;
-                       info->size = 0x01000000;
-                       break;                  /* 4 * 4 MB = 16 MB */
-               case AMD_ID_DL322B:
-                       info->flash_id += FLASH_AMDL322B;
-                       info->sector_count = 71;
-                       info->size = 0x01000000;
-                       break;                  /* 4 * 4 MB = 16 MB */
-               case AMD_ID_DL323T:
-                       info->flash_id += FLASH_AMDL323T;
-                       info->sector_count = 71;
-                       info->size = 0x01000000;
-                       break;                  /* 4 * 4 MB = 16 MB */
-               case AMD_ID_DL323B:
-                       info->flash_id += FLASH_AMDL323B;
-                       info->sector_count = 71;
-                       info->size = 0x01000000;
-                       break;                  /* 4 * 4 MB = 16 MB */
-               case AMD_ID_LV640U:
-                       info->flash_id += FLASH_AM640U;
-                       info->sector_count = 128;
-                       info->size = 0x02000000;
-                       break;                  /* 4 * 8 MB = 32 MB */
-               default:
-                       info->flash_id = FLASH_UNKNOWN;
-                       return (0);             /* no or unknown flash     */
-               }
-       }
-
-       if (flashtest_h == AMD_ID_LV640U) {
-
-               /* set up sector start adress table (uniform sector type) */
-               for (i = 0; i < info->sector_count; i++)
-                       info->start[i] = baseaddr + (i * 0x00040000);
-
-       } else if (info->flash_id & FLASH_BTYPE) {
-
-               /* set up sector start adress table (bottom sector type) */
-               info->start[0] = baseaddr + 0x00000000;
-               info->start[1] = baseaddr + 0x00010000;
-               info->start[2] = baseaddr + 0x00018000;
-               info->start[3] = baseaddr + 0x00020000;
-               for (i = 4; i < info->sector_count; i++) {
-                       info->start[i] = baseaddr + (i * 0x00040000) - 0x000C0000;
-               }
-
-       } else {
-
-               /* set up sector start adress table (top sector type) */
-               i = info->sector_count - 1;
-               info->start[i--] = baseaddr + info->size - 0x00010000;
-               info->start[i--] = baseaddr + info->size - 0x00018000;
-               info->start[i--] = baseaddr + info->size - 0x00020000;
-               for (; i >= 0; i--) {
-                       info->start[i] = baseaddr + i * 0x00040000;
-               }
-       }
-
-       /* check for protected sectors */
-       for (i = 0; i < info->sector_count; i++) {
-               /* read sector protection at sector address, (A7 .. A0) = 0x02 */
-               if ((V_ULONG (info->start[i] + 16) & 0x00010001) ||
-                       (V_ULONG (info->start[i] + 20) & 0x00010001)) {
-                       info->protect[i] = 1;   /* D0 = 1 if protected */
-               } else {
-                       info->protect[i] = 0;
-               }
-       }
-
-       flash_reset ();
-       return (info->size);
-}
-
-/*-----------------------------------------------------------------------
- */
-unsigned long flash_init (void)
-{
-       unsigned long size_b0 = 0;
-       int i;
-
-       /* Init: no FLASHes known */
-       for (i = 0; i < CFG_MAX_FLASH_BANKS; ++i) {
-               flash_info[i].flash_id = FLASH_UNKNOWN;
-       }
-
-       /* Static FLASH Bank configuration here (only one bank) */
-
-       size_b0 = flash_get_size (CFG_FLASH0_BASE, &flash_info[0]);
-       if (flash_info[0].flash_id == FLASH_UNKNOWN || size_b0 == 0) {
-               printf ("## Unknown FLASH on Bank 0 - Size = 0x%08lx = %ld MB\n",
-                               size_b0, size_b0 >> 20);
-       }
-
-       /*
-        * protect monitor and environment sectors
-        */
-
-#if CFG_MONITOR_BASE >= CFG_FLASH0_BASE
-       flash_protect (FLAG_PROTECT_SET,
-                      CFG_MONITOR_BASE,
-                      CFG_MONITOR_BASE + monitor_flash_len - 1, &flash_info[0]);
-#endif
-
-#if (CFG_ENV_IS_IN_FLASH == 1) && defined(CFG_ENV_ADDR)
-# ifndef  CFG_ENV_SIZE
-#  define CFG_ENV_SIZE CFG_ENV_SECT_SIZE
-# endif
-       flash_protect (FLAG_PROTECT_SET,
-                      CFG_ENV_ADDR,
-                      CFG_ENV_ADDR + CFG_ENV_SIZE - 1, &flash_info[0]);
-#endif
-
-       return (size_b0);
-}
-
-/*-----------------------------------------------------------------------
- */
-void flash_print_info (flash_info_t * info)
-{
-       int i;
-
-       if (info->flash_id == FLASH_UNKNOWN) {
-               printf ("missing or unknown FLASH type\n");
-               return;
-       }
-
-       switch (info->flash_id & FLASH_VENDMASK) {
-       case FLASH_MAN_AMD:
-               printf ("AMD ");
-               break;
-       case FLASH_MAN_FUJ:
-               printf ("FUJITSU ");
-               break;
-       default:
-               printf ("Unknown Vendor ");
-               break;
-       }
-
-       switch (info->flash_id & FLASH_TYPEMASK) {
-       case FLASH_AM800T:
-               printf ("29LV800T (8 M, top sector)\n");
-               break;
-       case FLASH_AM800B:
-               printf ("29LV800T (8 M, bottom sector)\n");
-               break;
-       case FLASH_AM160T:
-               printf ("29LV160T (16 M, top sector)\n");
-               break;
-       case FLASH_AM160B:
-               printf ("29LV160B (16 M, bottom sector)\n");
-               break;
-       case FLASH_AMDL322T:
-               printf ("29DL322T (32 M, top sector)\n");
-               break;
-       case FLASH_AMDL322B:
-               printf ("29DL322B (32 M, bottom sector)\n");
-               break;
-       case FLASH_AMDL323T:
-               printf ("29DL323T (32 M, top sector)\n");
-               break;
-       case FLASH_AMDL323B:
-               printf ("29DL323B (32 M, bottom sector)\n");
-               break;
-       case FLASH_AM640U:
-               printf ("29LV640D (64 M, uniform sector)\n");
-               break;
-       default:
-               printf ("Unknown Chip Type\n");
-               break;
-       }
-
-       printf ("  Size: %ld MB in %d Sectors\n",
-                       info->size >> 20, info->sector_count);
-
-       printf ("  Sector Start Addresses:");
-       for (i = 0; i < info->sector_count; ++i) {
-               if ((i % 5) == 0)
-                       printf ("\n   ");
-               printf (" %08lX%s",
-                       info->start[i],
-                       info->protect[i] ? " (RO)" : "     "
-               );
-       }
-       printf ("\n");
-       return;
-}
-
-/*-----------------------------------------------------------------------
- */
-int flash_erase (flash_info_t * info, int s_first, int s_last)
-{
-       int flag, prot, sect, l_sect;
-       ulong start, now, last;
-
-       if ((s_first < 0) || (s_first > s_last)) {
-               if (info->flash_id == FLASH_UNKNOWN) {
-                       printf ("- missing\n");
-               } else {
-                       printf ("- no sectors to erase\n");
-               }
-               return 1;
-       }
-
-       prot = 0;
-       for (sect = s_first; sect <= s_last; sect++) {
-               if (info->protect[sect])
-                       prot++;
-       }
-
-       if (prot) {
-               printf ("- Warning: %d protected sectors will not be erased!\n",
-                       prot);
-       } else {
-               printf ("\n");
-       }
-
-       l_sect = -1;
-
-       /* Disable interrupts which might cause a timeout here */
-       flag = disable_interrupts ();
-
-       V_ULONG (info->start[0] + (0x0555 << 3)) = 0x00AA00AA;
-       V_ULONG (info->start[0] + (0x02AA << 3)) = 0x00550055;
-       V_ULONG (info->start[0] + (0x0555 << 3)) = 0x00800080;
-       V_ULONG (info->start[0] + (0x0555 << 3)) = 0x00AA00AA;
-       V_ULONG (info->start[0] + (0x02AA << 3)) = 0x00550055;
-       V_ULONG (info->start[0] + 4 + (0x0555 << 3)) = 0x00AA00AA;
-       V_ULONG (info->start[0] + 4 + (0x02AA << 3)) = 0x00550055;
-       V_ULONG (info->start[0] + 4 + (0x0555 << 3)) = 0x00800080;
-       V_ULONG (info->start[0] + 4 + (0x0555 << 3)) = 0x00AA00AA;
-       V_ULONG (info->start[0] + 4 + (0x02AA << 3)) = 0x00550055;
-       udelay (1000);
-
-       /* Start erase on unprotected sectors */
-       for (sect = s_first; sect <= s_last; sect++) {
-               if (info->protect[sect] == 0) { /* not protected */
-                       V_ULONG (info->start[sect]) = 0x00300030;
-                       V_ULONG (info->start[sect] + 4) = 0x00300030;
-                       l_sect = sect;
-               }
-       }
-
-       /* re-enable interrupts if necessary */
-       if (flag)
-               enable_interrupts ();
-
-       /* wait at least 80us - let's wait 1 ms */
-       udelay (1000);
-
-       /*
-        * We wait for the last triggered sector
-        */
-       if (l_sect < 0)
-               goto DONE;
-
-       start = get_timer (0);
-       last = start;
-       while ((V_ULONG (info->start[l_sect]) & 0x00800080) != 0x00800080 ||
-              (V_ULONG (info->start[l_sect] + 4) & 0x00800080) != 0x00800080)
-       {
-               if ((now = get_timer (start)) > CFG_FLASH_ERASE_TOUT) {
-                       printf ("Timeout\n");
-                       return 1;
-               }
-               /* show that we're waiting */
-               if ((now - last) > 1000) {      /* every second */
-                       serial_putc ('.');
-                       last = now;
-               }
-       }
-
-  DONE:
-       /* reset to read mode */
-       flash_reset ();
-
-       printf (" done\n");
-       return 0;
-}
-
-static int write_dword (flash_info_t *, ulong, unsigned char *);
-
-/*-----------------------------------------------------------------------
- * Copy memory to flash, returns:
- * 0 - OK
- * 1 - write timeout
- * 2 - Flash not erased
- */
-
-int write_buff (flash_info_t * info, uchar * src, ulong addr, ulong cnt)
-{
-       ulong dp;
-       static unsigned char bb[8];
-       int i, l, rc, cc = cnt;
-
-       dp = (addr & ~7);               /* get lower dword aligned address */
-
-       /*
-        * handle unaligned start bytes
-        */
-       if ((l = addr - dp) != 0) {
-               for (i = 0; i < 8; i++)
-                       bb[i] = (i < l || (i - l) >= cc) ? V_BYTE (dp + i) : *src++;
-               if ((rc = write_dword (info, dp, bb)) != 0) {
-                       return (rc);
-               }
-               dp += 8;
-               cc -= 8 - l;
-       }
-
-       /*
-        * handle word aligned part
-        */
-       while (cc >= 8) {
-               if ((rc = write_dword (info, dp, src)) != 0) {
-                       return (rc);
-               }
-               dp += 8;
-               src += 8;
-               cc -= 8;
-       }
-
-       if (cc <= 0) {
-               return (0);
-       }
-
-       /*
-        * handle unaligned tail bytes
-        */
-       for (i = 0; i < 8; i++) {
-               bb[i] = (i < cc) ? *src++ : V_BYTE (dp + i);
-       }
-       return (write_dword (info, dp, bb));
-}
-
-/*-----------------------------------------------------------------------
- * Write a dword to Flash, returns:
- * 0 - OK
- * 1 - write timeout
- * 2 - Flash not erased
- */
-static int write_dword (flash_info_t * info, ulong dest, unsigned char *pdata)
-{
-       ulong start, cl, ch;
-       int flag, i;
-
-       for (ch = 0, i = 0; i < 4; i++)
-               ch = (ch << 8) + *pdata++;      /* high word    */
-       for (cl = 0, i = 0; i < 4; i++)
-               cl = (cl << 8) + *pdata++;      /* low word */
-
-       /* Check if Flash is (sufficiently) erased */
-       if ((*((vu_long *) dest) & ch) != ch
-               || (*((vu_long *) (dest + 4)) & cl) != cl) {
-               return (2);
-       }
-
-       /* Disable interrupts which might cause a timeout here */
-       flag = disable_interrupts ();
-
-       V_ULONG (info->start[0] + (0x0555 << 3)) = 0x00AA00AA;
-       V_ULONG (info->start[0] + (0x02AA << 3)) = 0x00550055;
-       V_ULONG (info->start[0] + (0x0555 << 3)) = 0x00A000A0;
-       V_ULONG (dest) = ch;
-       V_ULONG (info->start[0] + 4 + (0x0555 << 3)) = 0x00AA00AA;
-       V_ULONG (info->start[0] + 4 + (0x02AA << 3)) = 0x00550055;
-       V_ULONG (info->start[0] + 4 + (0x0555 << 3)) = 0x00A000A0;
-       V_ULONG (dest + 4) = cl;
-
-       /* re-enable interrupts if necessary */
-       if (flag)
-               enable_interrupts ();
-
-       /* data polling for D7 */
-       start = get_timer (0);
-       while (((V_ULONG (dest) & 0x00800080) != (ch & 0x00800080)) ||
-                  ((V_ULONG (dest + 4) & 0x00800080) != (cl & 0x00800080))) {
-               if (get_timer (start) > CFG_FLASH_WRITE_TOUT) {
-                       return (1);
-               }
-       }
-       return (0);
-}
diff --git a/board/tqm8260/tqm8260.c b/board/tqm8260/tqm8260.c
deleted file mode 100644 (file)
index 736c410..0000000
+++ /dev/null
@@ -1,368 +0,0 @@
-/*
- * (C) Copyright 2001
- * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-
-#include <common.h>
-#include <ioports.h>
-#include <mpc8260.h>
-
-/*
- * I/O Port configuration table
- *
- * if conf is 1, then that port pin will be configured at boot time
- * according to the five values podr/pdir/ppar/psor/pdat for that entry
- */
-
-const iop_conf_t iop_conf_tab[4][32] = {
-
-    /* Port A configuration */
-    {  /*            conf ppar psor pdir podr pdat */
-       /* PA31 */ {   0,   0,   0,   1,   0,   0   }, /* FCC1 *ATMTXEN */
-       /* PA30 */ {   0,   0,   0,   1,   0,   0   }, /* FCC1 ATMTCA   */
-       /* PA29 */ {   0,   0,   0,   1,   0,   0   }, /* FCC1 ATMTSOC  */
-       /* PA28 */ {   0,   0,   0,   1,   0,   0   }, /* FCC1 *ATMRXEN */
-       /* PA27 */ {   0,   0,   0,   1,   0,   0   }, /* FCC1 ATMRSOC */
-       /* PA26 */ {   0,   0,   0,   1,   0,   0   }, /* FCC1 ATMRCA */
-       /* PA25 */ {   0,   0,   0,   1,   0,   0   }, /* FCC1 ATMTXD[0] */
-       /* PA24 */ {   0,   0,   0,   1,   0,   0   }, /* FCC1 ATMTXD[1] */
-       /* PA23 */ {   0,   0,   0,   1,   0,   0   }, /* FCC1 ATMTXD[2] */
-       /* PA22 */ {   0,   0,   0,   1,   0,   0   }, /* FCC1 ATMTXD[3] */
-       /* PA21 */ {   0,   0,   0,   1,   0,   0   }, /* FCC1 ATMTXD[4] */
-       /* PA20 */ {   0,   0,   0,   1,   0,   0   }, /* FCC1 ATMTXD[5] */
-       /* PA19 */ {   0,   0,   0,   1,   0,   0   }, /* FCC1 ATMTXD[6] */
-       /* PA18 */ {   0,   0,   0,   1,   0,   0   }, /* FCC1 ATMTXD[7] */
-       /* PA17 */ {   0,   0,   0,   1,   0,   0   }, /* FCC1 ATMRXD[7] */
-       /* PA16 */ {   0,   0,   0,   1,   0,   0   }, /* FCC1 ATMRXD[6] */
-       /* PA15 */ {   0,   0,   0,   1,   0,   0   }, /* FCC1 ATMRXD[5] */
-       /* PA14 */ {   0,   0,   0,   1,   0,   0   }, /* FCC1 ATMRXD[4] */
-       /* PA13 */ {   0,   0,   0,   1,   0,   0   }, /* FCC1 ATMRXD[3] */
-       /* PA12 */ {   0,   0,   0,   1,   0,   0   }, /* FCC1 ATMRXD[2] */
-       /* PA11 */ {   0,   0,   0,   1,   0,   0   }, /* FCC1 ATMRXD[1] */
-       /* PA10 */ {   0,   0,   0,   1,   0,   0   }, /* FCC1 ATMRXD[0] */
-       /* PA9  */ {   1,   1,   0,   1,   0,   0   }, /* SMC2 TXD */
-       /* PA8  */ {   1,   1,   0,   0,   0,   0   }, /* SMC2 RXD */
-       /* PA7  */ {   0,   0,   0,   1,   0,   0   }, /* PA7 */
-       /* PA6  */ {   0,   0,   0,   1,   0,   0   }, /* PA6 */
-       /* PA5  */ {   0,   0,   0,   1,   0,   0   }, /* PA5 */
-       /* PA4  */ {   0,   0,   0,   1,   0,   0   }, /* PA4 */
-       /* PA3  */ {   0,   0,   0,   1,   0,   0   }, /* PA3 */
-       /* PA2  */ {   0,   0,   0,   1,   0,   0   }, /* PA2 */
-       /* PA1  */ {   0,   0,   0,   1,   0,   0   }, /* PA1 */
-       /* PA0  */ {   0,   0,   0,   1,   0,   0   }  /* PA0 */
-    },
-
-    /* Port B configuration */
-    {   /*           conf ppar psor pdir podr pdat */
-       /* PB31 */ {   1,   1,   0,   1,   0,   0   }, /* FCC2 MII TX_ER */
-       /* PB30 */ {   1,   1,   0,   0,   0,   0   }, /* FCC2 MII RX_DV */
-       /* PB29 */ {   1,   1,   1,   1,   0,   0   }, /* FCC2 MII TX_EN */
-       /* PB28 */ {   1,   1,   0,   0,   0,   0   }, /* FCC2 MII RX_ER */
-       /* PB27 */ {   1,   1,   0,   0,   0,   0   }, /* FCC2 MII COL */
-       /* PB26 */ {   1,   1,   0,   0,   0,   0   }, /* FCC2 MII CRS */
-       /* PB25 */ {   1,   1,   0,   1,   0,   0   }, /* FCC2 MII TxD[3] */
-       /* PB24 */ {   1,   1,   0,   1,   0,   0   }, /* FCC2 MII TxD[2] */
-       /* PB23 */ {   1,   1,   0,   1,   0,   0   }, /* FCC2 MII TxD[1] */
-       /* PB22 */ {   1,   1,   0,   1,   0,   0   }, /* FCC2 MII TxD[0] */
-       /* PB21 */ {   1,   1,   0,   0,   0,   0   }, /* FCC2 MII RxD[0] */
-       /* PB20 */ {   1,   1,   0,   0,   0,   0   }, /* FCC2 MII RxD[1] */
-       /* PB19 */ {   1,   1,   0,   0,   0,   0   }, /* FCC2 MII RxD[2] */
-       /* PB18 */ {   1,   1,   0,   0,   0,   0   }, /* FCC2 MII RxD[3] */
-       /* PB17 */ {   0,   0,   0,   0,   0,   0   }, /* PB17 */
-       /* PB16 */ {   0,   0,   0,   0,   0,   0   }, /* PB16 */
-       /* PB15 */ {   0,   0,   0,   0,   0,   0   }, /* PB15 */
-       /* PB14 */ {   0,   0,   0,   0,   0,   0   }, /* PB14 */
-       /* PB13 */ {   0,   0,   0,   0,   0,   0   }, /* PB13 */
-       /* PB12 */ {   0,   0,   0,   0,   0,   0   }, /* PB12 */
-       /* PB11 */ {   0,   0,   0,   0,   0,   0   }, /* PB11 */
-       /* PB10 */ {   0,   0,   0,   0,   0,   0   }, /* PB10 */
-       /* PB9  */ {   0,   0,   0,   0,   0,   0   }, /* PB9 */
-       /* PB8  */ {   0,   0,   0,   0,   0,   0   }, /* PB8 */
-       /* PB7  */ {   0,   0,   0,   0,   0,   0   }, /* PB7 */
-       /* PB6  */ {   0,   0,   0,   0,   0,   0   }, /* PB6 */
-       /* PB5  */ {   0,   0,   0,   0,   0,   0   }, /* PB5 */
-       /* PB4  */ {   0,   0,   0,   0,   0,   0   }, /* PB4 */
-       /* PB3  */ {   0,   0,   0,   0,   0,   0   }, /* pin doesn't exist */
-       /* PB2  */ {   0,   0,   0,   0,   0,   0   }, /* pin doesn't exist */
-       /* PB1  */ {   0,   0,   0,   0,   0,   0   }, /* pin doesn't exist */
-       /* PB0  */ {   0,   0,   0,   0,   0,   0   }  /* pin doesn't exist */
-    },
-
-    /* Port C */
-    {   /*           conf ppar psor pdir podr pdat */
-       /* PC31 */ {   0,   0,   0,   1,   0,   0   }, /* PC31 */
-       /* PC30 */ {   0,   0,   0,   1,   0,   0   }, /* PC30 */
-       /* PC29 */ {   1,   1,   1,   0,   0,   0   }, /* SCC1 EN *CLSN */
-       /* PC28 */ {   0,   0,   0,   1,   0,   0   }, /* PC28 */
-       /* PC27 */ {   0,   0,   0,   1,   0,   0   }, /* PC27 */
-       /* PC26 */ {   0,   0,   0,   1,   0,   0   }, /* PC26 */
-       /* PC25 */ {   0,   0,   0,   1,   0,   0   }, /* PC25 */
-       /* PC24 */ {   0,   0,   0,   1,   0,   0   }, /* PC24 */
-       /* PC23 */ {   0,   1,   0,   1,   0,   0   }, /* ATMTFCLK */
-       /* PC22 */ {   0,   1,   0,   0,   0,   0   }, /* ATMRFCLK */
-       /* PC21 */ {   1,   1,   0,   0,   0,   0   }, /* SCC1 EN RXCLK */
-       /* PC20 */ {   1,   1,   0,   0,   0,   0   }, /* SCC1 EN TXCLK */
-       /* PC19 */ {   1,   1,   0,   0,   0,   0   }, /* FCC2 MII RX_CLK */
-       /* PC18 */ {   1,   1,   0,   0,   0,   0   }, /* FCC2 MII TX_CLK */
-       /* PC17 */ {   0,   0,   0,   1,   0,   0   }, /* PC17 */
-       /* PC16 */ {   0,   0,   0,   1,   0,   0   }, /* PC16 */
-       /* PC15 */ {   0,   0,   0,   1,   0,   0   }, /* PC15 */
-       /* PC14 */ {   1,   1,   0,   0,   0,   0   }, /* SCC1 EN *CD */
-       /* PC13 */ {   0,   0,   0,   1,   0,   0   }, /* PC13 */
-       /* PC12 */ {   0,   0,   0,   1,   0,   0   }, /* PC12 */
-       /* PC11 */ {   0,   0,   0,   1,   0,   0   }, /* PC11 */
-       /* PC10 */ {   0,   0,   0,   1,   0,   0   }, /* FCC2 MDC */
-       /* PC9  */ {   0,   0,   0,   1,   0,   0   }, /* FCC2 MDIO */
-       /* PC8  */ {   0,   0,   0,   1,   0,   0   }, /* PC8 */
-       /* PC7  */ {   0,   0,   0,   1,   0,   0   }, /* PC7 */
-       /* PC6  */ {   0,   0,   0,   1,   0,   0   }, /* PC6 */
-       /* PC5  */ {   0,   0,   0,   1,   0,   0   }, /* PC5 */
-       /* PC4  */ {   0,   0,   0,   1,   0,   0   }, /* PC4 */
-       /* PC3  */ {   0,   0,   0,   1,   0,   0   }, /* PC3 */
-       /* PC2  */ {   0,   0,   0,   1,   0,   1   }, /* ENET FDE */
-       /* PC1  */ {   0,   0,   0,   1,   0,   0   }, /* ENET DSQE */
-       /* PC0  */ {   0,   0,   0,   1,   0,   0   }, /* ENET LBK */
-    },
-
-    /* Port D */
-    {   /*           conf ppar psor pdir podr pdat */
-       /* PD31 */ {   1,   1,   0,   0,   0,   0   }, /* SCC1 EN RxD */
-       /* PD30 */ {   1,   1,   1,   1,   0,   0   }, /* SCC1 EN TxD */
-       /* PD29 */ {   1,   1,   0,   1,   0,   0   }, /* SCC1 EN TENA */
-       /* PD28 */ {   0,   0,   0,   1,   0,   0   }, /* PD28 */
-       /* PD27 */ {   0,   0,   0,   1,   0,   0   }, /* PD27 */
-       /* PD26 */ {   0,   0,   0,   1,   0,   0   }, /* PD26 */
-       /* PD25 */ {   0,   0,   0,   1,   0,   0   }, /* PD25 */
-       /* PD24 */ {   0,   0,   0,   1,   0,   0   }, /* PD24 */
-       /* PD23 */ {   0,   0,   0,   1,   0,   0   }, /* PD23 */
-       /* PD22 */ {   0,   0,   0,   1,   0,   0   }, /* PD22 */
-       /* PD21 */ {   0,   0,   0,   1,   0,   0   }, /* PD21 */
-       /* PD20 */ {   0,   0,   0,   1,   0,   0   }, /* PD20 */
-       /* PD19 */ {   0,   0,   0,   1,   0,   0   }, /* PD19 */
-       /* PD18 */ {   0,   0,   0,   1,   0,   0   }, /* PD19 */
-       /* PD17 */ {   0,   1,   0,   0,   0,   0   }, /* FCC1 ATMRXPRTY */
-       /* PD16 */ {   0,   1,   0,   1,   0,   0   }, /* FCC1 ATMTXPRTY */
-#if defined(CONFIG_SOFT_I2C)
-       /* PD15 */ {   1,   0,   0,   1,   1,   1   }, /* I2C SDA */
-       /* PD14 */ {   1,   0,   0,   1,   1,   1   }, /* I2C SCL */
-#else
-#if defined(CONFIG_HARD_I2C)
-       /* PD15 */ {   1,   1,   1,   0,   1,   0   }, /* I2C SDA */
-       /* PD14 */ {   1,   1,   1,   0,   1,   0   }, /* I2C SCL */
-#else /* normal I/O port pins */
-       /* PD15 */ {   0,   1,   1,   0,   1,   0   }, /* I2C SDA */
-       /* PD14 */ {   0,   1,   1,   0,   1,   0   }, /* I2C SCL */
-#endif
-#endif
-       /* PD13 */ {   0,   0,   0,   0,   0,   0   }, /* PD13 */
-       /* PD12 */ {   0,   0,   0,   0,   0,   0   }, /* PD12 */
-       /* PD11 */ {   0,   0,   0,   0,   0,   0   }, /* PD11 */
-       /* PD10 */ {   0,   0,   0,   0,   0,   0   }, /* PD10 */
-       /* PD9  */ {   1,   1,   0,   1,   0,   0   }, /* SMC1 TXD */
-       /* PD8  */ {   1,   1,   0,   0,   0,   0   }, /* SMC1 RXD */
-       /* PD7  */ {   0,   0,   0,   1,   0,   1   }, /* PD7 */
-       /* PD6  */ {   0,   0,   0,   1,   0,   1   }, /* PD6 */
-       /* PD5  */ {   0,   0,   0,   1,   0,   1   }, /* PD5 */
-       /* PD4  */ {   0,   0,   0,   1,   0,   1   }, /* PD4 */
-       /* PD3  */ {   0,   0,   0,   0,   0,   0   }, /* pin doesn't exist */
-       /* PD2  */ {   0,   0,   0,   0,   0,   0   }, /* pin doesn't exist */
-       /* PD1  */ {   0,   0,   0,   0,   0,   0   }, /* pin doesn't exist */
-       /* PD0  */ {   0,   0,   0,   0,   0,   0   }  /* pin doesn't exist */
-    }
-};
-
-/* ------------------------------------------------------------------------- */
-
-/* Check Board Identity:
- */
-int checkboard (void)
-{
-       char str[64];
-       int i = getenv_r ("serial#", str, sizeof (str));
-
-       puts ("Board: ");
-
-       if (!i || strncmp (str, "TQM82", 5)) {
-               puts ("### No HW ID - assuming TQM8260\n");
-               return (0);
-       }
-
-       puts (str);
-       putc ('\n');
-
-       return 0;
-}
-
-/* ------------------------------------------------------------------------- */
-
-/* Try SDRAM initialization with P/LSDMR=sdmr and ORx=orx
- *
- * This routine performs standard 8260 initialization sequence
- * and calculates the available memory size. It may be called
- * several times to try different SDRAM configurations on both
- * 60x and local buses.
- */
-static long int try_init (volatile memctl8260_t * memctl, ulong sdmr,
-                                                 ulong orx, volatile uchar * base)
-{
-       volatile uchar c = 0xff;
-       volatile uint *sdmr_ptr;
-       volatile uint *orx_ptr;
-       ulong maxsize, size;
-       int i;
-
-       /* We must be able to test a location outsize the maximum legal size
-        * to find out THAT we are outside; but this address still has to be
-        * mapped by the controller. That means, that the initial mapping has
-        * to be (at least) twice as large as the maximum expected size.
-        */
-       maxsize = (1 + (~orx | 0x7fff)) / 2;
-
-       /* Since CFG_SDRAM_BASE is always 0 (??), we assume that
-        * we are configuring CS1 if base != 0
-        */
-       sdmr_ptr = base ? &memctl->memc_lsdmr : &memctl->memc_psdmr;
-       orx_ptr = base ? &memctl->memc_or2 : &memctl->memc_or1;
-
-       *orx_ptr = orx;
-
-       /*
-        * Quote from 8260 UM (10.4.2 SDRAM Power-On Initialization, 10-35):
-        *
-        * "At system reset, initialization software must set up the
-        *  programmable parameters in the memory controller banks registers
-        *  (ORx, BRx, P/LSDMR). After all memory parameters are configured,
-        *  system software should execute the following initialization sequence
-        *  for each SDRAM device.
-        *
-        *  1. Issue a PRECHARGE-ALL-BANKS command
-        *  2. Issue eight CBR REFRESH commands
-        *  3. Issue a MODE-SET command to initialize the mode register
-        *
-        *  The initial commands are executed by setting P/LSDMR[OP] and
-        *  accessing the SDRAM with a single-byte transaction."
-        *
-        * The appropriate BRx/ORx registers have already been set when we
-        * get here. The SDRAM can be accessed at the address CFG_SDRAM_BASE.
-        */
-
-       *sdmr_ptr = sdmr | PSDMR_OP_PREA;
-       *base = c;
-
-       *sdmr_ptr = sdmr | PSDMR_OP_CBRR;
-       for (i = 0; i < 8; i++)
-               *base = c;
-
-       *sdmr_ptr = sdmr | PSDMR_OP_MRW;
-       *(base + CFG_MRS_OFFS) = c;     /* setting MR on address lines */
-
-       *sdmr_ptr = sdmr | PSDMR_OP_NORM | PSDMR_RFEN;
-       *base = c;
-
-       size = get_ram_size((long *)base, maxsize);
-       *orx_ptr = orx | ~(size - 1);
-
-       return (size);
-}
-
-long int initdram (int board_type)
-{
-       volatile immap_t *immap = (immap_t *) CFG_IMMR;
-       volatile memctl8260_t *memctl = &immap->im_memctl;
-
-#ifndef CFG_RAMBOOT
-       long size8, size9;
-#endif
-       long psize, lsize;
-
-       psize = 16 * 1024 * 1024;
-       lsize = 0;
-
-       memctl->memc_psrt = CFG_PSRT;
-       memctl->memc_mptpr = CFG_MPTPR;
-
-#if 0                                                  /* Just for debugging */
-#define        prt_br_or(brX,orX) do {                         \
-    ulong start =  memctl->memc_ ## brX & 0xFFFF8000;  \
-    ulong sizem = ~memctl->memc_ ## orX | 0x00007FFF;  \
-    printf ("\n"                                       \
-           #brX " 0x%08x  " #orX " 0x%08x "            \
-           "==> 0x%08lx ... 0x%08lx = %ld MB\n",       \
-       memctl->memc_ ## brX, memctl->memc_ ## orX,     \
-       start, start+sizem, (sizem+1)>>20);             \
-    } while (0)
-       prt_br_or (br0, or0);
-       prt_br_or (br1, or1);
-       prt_br_or (br2, or2);
-       prt_br_or (br3, or3);
-#endif
-
-#ifndef CFG_RAMBOOT
-       /* 60x SDRAM setup:
-        */
-       size8 = try_init (memctl, CFG_PSDMR_8COL, CFG_OR1_8COL,
-                                         (uchar *) CFG_SDRAM_BASE);
-       size9 = try_init (memctl, CFG_PSDMR_9COL, CFG_OR1_9COL,
-                                         (uchar *) CFG_SDRAM_BASE);
-
-       if (size8 < size9) {
-               psize = size9;
-               printf ("(60x:9COL - %ld MB, ", psize >> 20);
-       } else {
-               psize = try_init (memctl, CFG_PSDMR_8COL, CFG_OR1_8COL,
-                                                 (uchar *) CFG_SDRAM_BASE);
-               printf ("(60x:8COL - %ld MB, ", psize >> 20);
-       }
-
-       /* Local SDRAM setup:
-        */
-#ifdef CFG_INIT_LOCAL_SDRAM
-       memctl->memc_lsrt = CFG_LSRT;
-       size8 = try_init (memctl, CFG_LSDMR_8COL, CFG_OR2_8COL,
-                                         (uchar *) SDRAM_BASE2_PRELIM);
-       size9 = try_init (memctl, CFG_LSDMR_9COL, CFG_OR2_9COL,
-                                         (uchar *) SDRAM_BASE2_PRELIM);
-
-       if (size8 < size9) {
-               lsize = size9;
-               printf ("Local:9COL - %ld MB) using ", lsize >> 20);
-       } else {
-               lsize = try_init (memctl, CFG_LSDMR_8COL, CFG_OR2_8COL,
-                                                 (uchar *) SDRAM_BASE2_PRELIM);
-               printf ("Local:8COL - %ld MB) using ", lsize >> 20);
-       }
-
-#if 0
-       /* Set up BR2 so that the local SDRAM goes
-        * right after the 60x SDRAM
-        */
-       memctl->memc_br2 = (CFG_BR2_PRELIM & ~BRx_BA_MSK) |
-                       (CFG_SDRAM_BASE + psize);
-#endif
-#endif /* CFG_INIT_LOCAL_SDRAM */
-#endif /* CFG_RAMBOOT */
-
-       icache_enable ();
-
-       return (psize);
-}
-
-/* ------------------------------------------------------------------------- */
diff --git a/board/tqm8272/Makefile b/board/tqm8272/Makefile
deleted file mode 100644 (file)
index 6730263..0000000
+++ /dev/null
@@ -1,47 +0,0 @@
-#
-# (C) Copyright 2001-2008
-# 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
-ifneq ($(OBJTREE),$(SRCTREE))
-$(shell mkdir -p $(obj)../tqm8xx/)
-endif
-
-LIB    = $(obj)lib$(BOARD).a
-
-COBJS  = $(BOARD).o ../tqm8xx/load_sernum_ethaddr.o
-
-SRCS   := $(SOBJS:.o=.S) $(COBJS:.o=.c)
-OBJS   := $(addprefix $(obj),$(COBJS))
-SOBJS  := $(addprefix $(obj),$(SOBJS))
-
-$(LIB):        $(obj).depend $(OBJS)
-       $(AR) $(ARFLAGS) $@ $(OBJS)
-
-#########################################################################
-
-# defines $(obj).depend target
-include $(SRCTREE)/rules.mk
-
-sinclude $(obj).depend
-
-#########################################################################
diff --git a/board/tqm8272/config.mk b/board/tqm8272/config.mk
deleted file mode 100644 (file)
index af7a81e..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-#
-# (C) Copyright 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
-#
-
-#
-# TQM8272 boards
-#
-
-# This should be equal to the CFG_FLASH_BASE define in config_TQM8260.h
-# for the "final" configuration, with U-Boot in flash, or the address
-# in RAM where U-Boot is loaded at for debugging.
-#
-TEXT_BASE = 0x40000000
-
-PLATFORM_CPPFLAGS += -DTEXT_BASE=$(TEXT_BASE) -I$(TOPDIR)
diff --git a/board/tqm8272/tqm8272.c b/board/tqm8272/tqm8272.c
deleted file mode 100644 (file)
index ec1a37c..0000000
+++ /dev/null
@@ -1,1230 +0,0 @@
-/*
- * (C) Copyright 2006
- * Heiko Schocher, DENX Software Engineering, hs@denx.de.
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.         See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-
-#include <common.h>
-#include <ioports.h>
-#include <mpc8260.h>
-
-#include <command.h>
-#ifdef CONFIG_PCI
-#include <pci.h>
-#include <asm/m8260_pci.h>
-#endif
-
-#if 0
-#define deb_printf(fmt,arg...) \
-       printf ("TQM8272 %s %s: " fmt,__FILE__, __FUNCTION__, ##arg)
-#else
-#define deb_printf(fmt,arg...) \
-       do { } while (0)
-#endif
-
-#if defined(CONFIG_BOARD_GET_CPU_CLK_F)
-unsigned long board_get_cpu_clk_f (void);
-#endif
-
-/*
- * I/O Port configuration table
- *
- * if conf is 1, then that port pin will be configured at boot time
- * according to the five values podr/pdir/ppar/psor/pdat for that entry
- */
-
-const iop_conf_t iop_conf_tab[4][32] = {
-
-    /* Port A configuration */
-    {  /*            conf ppar psor pdir podr pdat */
-       /* PA31 */ {   0,   0,   0,   1,   0,   0   }, /* FCC1 *ATMTXEN */
-       /* PA30 */ {   0,   0,   0,   1,   0,   0   }, /* FCC1 ATMTCA   */
-       /* PA29 */ {   0,   0,   0,   1,   0,   0   }, /* FCC1 ATMTSOC  */
-       /* PA28 */ {   0,   0,   0,   1,   0,   0   }, /* FCC1 *ATMRXEN */
-       /* PA27 */ {   0,   0,   0,   1,   0,   0   }, /* FCC1 ATMRSOC */
-       /* PA26 */ {   0,   0,   0,   1,   0,   0   }, /* FCC1 ATMRCA */
-       /* PA25 */ {   0,   0,   0,   1,   0,   0   }, /* FCC1 ATMTXD[0] */
-       /* PA24 */ {   0,   0,   0,   1,   0,   0   }, /* FCC1 ATMTXD[1] */
-       /* PA23 */ {   0,   0,   0,   1,   0,   0   }, /* FCC1 ATMTXD[2] */
-       /* PA22 */ {   0,   0,   0,   1,   0,   0   }, /* FCC1 ATMTXD[3] */
-       /* PA21 */ {   0,   0,   0,   1,   0,   0   }, /* FCC1 ATMTXD[4] */
-       /* PA20 */ {   0,   0,   0,   1,   0,   0   }, /* FCC1 ATMTXD[5] */
-       /* PA19 */ {   0,   0,   0,   1,   0,   0   }, /* FCC1 ATMTXD[6] */
-       /* PA18 */ {   0,   0,   0,   1,   0,   0   }, /* FCC1 ATMTXD[7] */
-       /* PA17 */ {   0,   0,   0,   1,   0,   0   }, /* FCC1 ATMRXD[7] */
-       /* PA16 */ {   0,   0,   0,   1,   0,   0   }, /* FCC1 ATMRXD[6] */
-       /* PA15 */ {   0,   0,   0,   1,   0,   0   }, /* FCC1 ATMRXD[5] */
-       /* PA14 */ {   0,   0,   0,   1,   0,   0   }, /* FCC1 ATMRXD[4] */
-       /* PA13 */ {   0,   0,   0,   1,   0,   0   }, /* FCC1 ATMRXD[3] */
-       /* PA12 */ {   0,   0,   0,   1,   0,   0   }, /* FCC1 ATMRXD[2] */
-       /* PA11 */ {   0,   0,   0,   1,   0,   0   }, /* FCC1 ATMRXD[1] */
-       /* PA10 */ {   0,   0,   0,   1,   0,   0   }, /* FCC1 ATMRXD[0] */
-       /* PA9  */ {   1,   1,   0,   1,   0,   0   }, /* SMC2 TXD */
-       /* PA8  */ {   1,   1,   0,   0,   0,   0   }, /* SMC2 RXD */
-       /* PA7  */ {   0,   0,   0,   1,   0,   0   }, /* PA7 */
-       /* PA6  */ {   0,   0,   0,   1,   0,   0   }, /* PA6 */
-       /* PA5  */ {   0,   0,   0,   1,   0,   0   }, /* PA5 */
-       /* PA4  */ {   0,   0,   0,   1,   0,   0   }, /* PA4 */
-       /* PA3  */ {   0,   0,   0,   1,   0,   0   }, /* PA3 */
-       /* PA2  */ {   0,   0,   0,   1,   0,   0   }, /* PA2 */
-       /* PA1  */ {   0,   0,   0,   1,   0,   0   }, /* PA1 */
-       /* PA0  */ {   0,   0,   0,   1,   0,   0   }  /* PA0 */
-    },
-
-    /* Port B configuration */
-    {  /*            conf ppar psor pdir podr pdat */
-       /* PB31 */ {   1,   1,   0,   1,   0,   0   }, /* FCC2 MII TX_ER */
-       /* PB30 */ {   1,   1,   0,   0,   0,   0   }, /* FCC2 MII RX_DV */
-       /* PB29 */ {   1,   1,   1,   1,   0,   0   }, /* FCC2 MII TX_EN */
-       /* PB28 */ {   1,   1,   0,   0,   0,   0   }, /* FCC2 MII RX_ER */
-       /* PB27 */ {   1,   1,   0,   0,   0,   0   }, /* FCC2 MII COL */
-       /* PB26 */ {   1,   1,   0,   0,   0,   0   }, /* FCC2 MII CRS */
-       /* PB25 */ {   1,   1,   0,   1,   0,   0   }, /* FCC2 MII TxD[3] */
-       /* PB24 */ {   1,   1,   0,   1,   0,   0   }, /* FCC2 MII TxD[2] */
-       /* PB23 */ {   1,   1,   0,   1,   0,   0   }, /* FCC2 MII TxD[1] */
-       /* PB22 */ {   1,   1,   0,   1,   0,   0   }, /* FCC2 MII TxD[0] */
-       /* PB21 */ {   1,   1,   0,   0,   0,   0   }, /* FCC2 MII RxD[0] */
-       /* PB20 */ {   1,   1,   0,   0,   0,   0   }, /* FCC2 MII RxD[1] */
-       /* PB19 */ {   1,   1,   0,   0,   0,   0   }, /* FCC2 MII RxD[2] */
-       /* PB18 */ {   1,   1,   0,   0,   0,   0   }, /* FCC2 MII RxD[3] */
-       /* PB17 */ {   0,   0,   0,   0,   0,   0   }, /* PB17 */
-       /* PB16 */ {   0,   0,   0,   0,   0,   0   }, /* PB16 */
-       /* PB15 */ {   0,   0,   0,   0,   0,   0   }, /* PB15 */
-       /* PB14 */ {   0,   0,   0,   0,   0,   0   }, /* PB14 */
-       /* PB13 */ {   0,   0,   0,   0,   0,   0   }, /* PB13 */
-       /* PB12 */ {   0,   0,   0,   0,   0,   0   }, /* PB12 */
-       /* PB11 */ {   0,   0,   0,   0,   0,   0   }, /* PB11 */
-       /* PB10 */ {   0,   0,   0,   0,   0,   0   }, /* PB10 */
-       /* PB9  */ {   0,   0,   0,   0,   0,   0   }, /* PB9 */
-       /* PB8  */ {   0,   0,   0,   0,   0,   0   }, /* PB8 */
-       /* PB7  */ {   0,   0,   0,   0,   0,   0   }, /* PB7 */
-       /* PB6  */ {   0,   0,   0,   0,   0,   0   }, /* PB6 */
-       /* PB5  */ {   0,   0,   0,   0,   0,   0   }, /* PB5 */
-       /* PB4  */ {   0,   0,   0,   0,   0,   0   }, /* PB4 */
-       /* PB3  */ {   0,   0,   0,   0,   0,   0   }, /* pin doesn't exist */
-       /* PB2  */ {   0,   0,   0,   0,   0,   0   }, /* pin doesn't exist */
-       /* PB1  */ {   0,   0,   0,   0,   0,   0   }, /* pin doesn't exist */
-       /* PB0  */ {   0,   0,   0,   0,   0,   0   }  /* pin doesn't exist */
-    },
-
-    /* Port C */
-    {  /*            conf ppar psor pdir podr pdat */
-       /* PC31 */ {   0,   0,   0,   1,   0,   0   }, /* PC31 */
-       /* PC30 */ {   0,   0,   0,   0,   0,   0   }, /* PC30 */
-       /* PC29 */ {   1,   1,   1,   0,   0,   0   }, /* SCC1 EN *CLSN */
-       /* PC28 */ {   0,   0,   0,   1,   0,   0   }, /* PC28 */
-       /* PC27 */ {   0,   0,   0,   1,   0,   0   }, /* PC27 */
-       /* PC26 */ {   0,   0,   0,   1,   0,   0   }, /* PC26 */
-       /* PC25 */ {   0,   0,   0,   1,   0,   0   }, /* PC25 */
-       /* PC24 */ {   0,   0,   0,   1,   0,   0   }, /* PC24 */
-       /* PC23 */ {   0,   1,   0,   1,   0,   0   }, /* ATMTFCLK */
-       /* PC22 */ {   0,   1,   0,   0,   0,   0   }, /* ATMRFCLK */
-       /* PC21 */ {   1,   1,   0,   0,   0,   0   }, /* SCC1 EN RXCLK */
-       /* PC20 */ {   1,   1,   0,   0,   0,   0   }, /* SCC1 EN TXCLK */
-       /* PC19 */ {   1,   1,   0,   0,   0,   0   }, /* FCC2 MII RX_CLK */
-       /* PC18 */ {   1,   1,   0,   0,   0,   0   }, /* FCC2 MII TX_CLK */
-       /* PC17 */ {   1,   0,   0,   1,   0,   0   }, /* PC17 MDC */
-       /* PC16 */ {   1,   0,   0,   0,   0,   0   }, /* PC16 MDIO*/
-       /* PC15 */ {   0,   0,   0,   1,   0,   0   }, /* PC15 */
-       /* PC14 */ {   1,   1,   0,   0,   0,   0   }, /* SCC1 EN *CD */
-       /* PC13 */ {   0,   0,   0,   1,   0,   0   }, /* PC13 */
-       /* PC12 */ {   0,   0,   0,   1,   0,   0   }, /* PC12 */
-       /* PC11 */ {   0,   0,   0,   1,   0,   0   }, /* PC11 */
-       /* PC10 */ {   0,   0,   0,   1,   0,   0   }, /* PC10 */
-       /* PC9  */ {   0,   0,   0,   1,   0,   0   }, /* PC9 */
-       /* PC8  */ {   0,   0,   0,   1,   0,   0   }, /* PC8 */
-       /* PC7  */ {   0,   0,   0,   1,   0,   0   }, /* PC7 */
-       /* PC6  */ {   0,   0,   0,   1,   0,   0   }, /* PC6 */
-       /* PC5  */ {   1,   1,   0,   1,   0,   0   }, /* PC5 SMC1 TXD */
-       /* PC4  */ {   1,   1,   0,   0,   0,   0   }, /* PC4 SMC1 RXD */
-       /* PC3  */ {   0,   0,   0,   1,   0,   0   }, /* PC3 */
-       /* PC2  */ {   0,   0,   0,   1,   0,   1   }, /* ENET FDE */
-       /* PC1  */ {   0,   0,   0,   1,   0,   0   }, /* ENET DSQE */
-       /* PC0  */ {   0,   0,   0,   1,   0,   0   }, /* ENET LBK */
-    },
-
-    /* Port D */
-    {  /*            conf ppar psor pdir podr pdat */
-       /* PD31 */ {   1,   1,   0,   0,   0,   0   }, /* SCC1 EN RxD */
-       /* PD30 */ {   1,   1,   1,   1,   0,   0   }, /* SCC1 EN TxD */
-       /* PD29 */ {   1,   1,   0,   1,   0,   0   }, /* SCC1 EN TENA */
-       /* PD28 */ {   0,   0,   0,   1,   0,   0   }, /* PD28 */
-       /* PD27 */ {   0,   0,   0,   1,   0,   0   }, /* PD27 */
-       /* PD26 */ {   0,   0,   0,   1,   0,   0   }, /* PD26 */
-       /* PD25 */ {   0,   0,   0,   1,   0,   0   }, /* PD25 */
-       /* PD24 */ {   0,   0,   0,   1,   0,   0   }, /* PD24 */
-       /* PD23 */ {   0,   0,   0,   1,   0,   0   }, /* PD23 */
-       /* PD22 */ {   0,   0,   0,   1,   0,   0   }, /* PD22 */
-       /* PD21 */ {   0,   0,   0,   1,   0,   0   }, /* PD21 */
-       /* PD20 */ {   0,   0,   0,   1,   0,   0   }, /* PD20 */
-       /* PD19 */ {   0,   0,   0,   1,   0,   0   }, /* PD19 */
-       /* PD18 */ {   0,   0,   0,   1,   0,   0   }, /* PD19 */
-       /* PD17 */ {   0,   1,   0,   0,   0,   0   }, /* FCC1 ATMRXPRTY */
-       /* PD16 */ {   0,   1,   0,   1,   0,   0   }, /* FCC1 ATMTXPRTY */
-#if defined(CONFIG_SOFT_I2C)
-       /* PD15 */ {   1,   0,   0,   1,   1,   1   }, /* I2C SDA */
-       /* PD14 */ {   1,   0,   0,   1,   1,   1   }, /* I2C SCL */
-#else
-#if defined(CONFIG_HARD_I2C)
-       /* PD15 */ {   1,   1,   1,   0,   1,   0   }, /* I2C SDA */
-       /* PD14 */ {   1,   1,   1,   0,   1,   0   }, /* I2C SCL */
-#else /* normal I/O port pins */
-       /* PD15 */ {   0,   1,   1,   0,   1,   0   }, /* I2C SDA */
-       /* PD14 */ {   0,   1,   1,   0,   1,   0   }, /* I2C SCL */
-#endif
-#endif
-       /* PD13 */ {   0,   0,   0,   0,   0,   0   }, /* PD13 */
-       /* PD12 */ {   0,   0,   0,   0,   0,   0   }, /* PD12 */
-       /* PD11 */ {   0,   0,   0,   0,   0,   0   }, /* PD11 */
-       /* PD10 */ {   0,   0,   0,   0,   0,   0   }, /* PD10 */
-       /* PD9  */ {   1,   1,   0,   1,   0,   0   }, /* SMC1 TXD */
-       /* PD8  */ {   1,   1,   0,   0,   0,   0   }, /* SMC1 RXD */
-       /* PD7  */ {   0,   0,   0,   1,   0,   1   }, /* PD7 */
-       /* PD6  */ {   0,   0,   0,   1,   0,   1   }, /* PD6 */
-       /* PD5  */ {   0,   0,   0,   1,   0,   0   }, /* PD5 */
-       /* PD4  */ {   0,   0,   0,   1,   0,   1   }, /* PD4 */
-       /* PD3  */ {   0,   0,   0,   0,   0,   0   }, /* pin doesn't exist */
-       /* PD2  */ {   0,   0,   0,   0,   0,   0   }, /* pin doesn't exist */
-       /* PD1  */ {   0,   0,   0,   0,   0,   0   }, /* pin doesn't exist */
-       /* PD0  */ {   0,   0,   0,   0,   0,   0   }  /* pin doesn't exist */
-    }
-};
-
-#define _NOT_USED_     0xFFFFFFFF
-
-/* UPM pattern for bus clock = 66.7 MHz */
-static const uint upmTable67[] =
-{
-    /* Offset  UPM Read Single RAM array entry -> NAND Read Data */
-    /* 0x00 */ 0x0fa3f100, 0x0fa3b000, 0x0fa33100, 0x0fa33000,
-    /* 0x04 */ 0x0fa33000, 0x0fa33004, 0xfffffc01, 0xfffffc00,
-
-               /* UPM Read Burst RAM array entry -> unused */
-    /* 0x08 */ 0xfffffc00, 0xfffffc00, 0xfffffc00, 0xfffffc00,
-    /* 0x0C */ 0xfffffc00, 0xfffffc00, 0xfffffc00, 0xfffffc00,
-
-               /* UPM Read Burst RAM array entry -> unused */
-    /* 0x10 */ 0xfffffc00, 0xfffffc00, 0xfffffc00, 0xfffffc00,
-    /* 0x14 */ 0xfffffc00, 0xfffffc00, 0xfffffc00, 0xfffffc00,
-
-               /* UPM Write Single RAM array entry -> NAND Write Data, ADDR and CMD */
-    /* 0x18 */ 0x00a3fc00, 0x00a3fc00, 0x00a3fc00, 0x00a3fc00,
-    /* 0x1C */ 0x0fa3fc00, 0x0fa3fc04, 0xfffffc01, 0xfffffc00,
-
-               /* UPM Write Burst RAM array entry -> unused */
-    /* 0x20 */ 0xfffffc00, 0xfffffc00, 0xfffffc00, 0xfffffc00,
-    /* 0x24 */ 0xfffffc00, 0xfffffc00, 0xfffffc00, 0xfffffc00,
-    /* 0x28 */ 0xfffffc00, 0xfffffc00, 0xfffffc00, 0xfffffc00,
-    /* 0x2C */ 0xfffffc00, 0xfffffc00, 0xfffffc00, 0xfffffc01,
-
-               /* UPM Refresh Timer RAM array entry -> unused */
-    /* 0x30 */ 0xfffffc00, 0xfffffc00, 0xfffffc00, 0xfffffc00,
-    /* 0x34 */ 0xfffffc00, 0xfffffc00, 0xfffffc00, 0xfffffc00,
-    /* 0x38 */ 0xfffffc00, 0xfffffc00, 0xfffffc00, 0xfffffc01,
-
-               /* UPM Exception RAM array entry -> unsused */
-    /* 0x3C */ 0xfffffc00, 0xfffffc00, 0xfffffc00, 0xfffffc01,
-};
-
-/* UPM pattern for bus clock = 100 MHz */
-static const uint upmTable100[] =
-{
-    /* Offset  UPM Read Single RAM array entry -> NAND Read Data */
-    /* 0x00 */ 0x0fa3f200, 0x0fa3b000, 0x0fa33300, 0x0fa33000,
-    /* 0x04 */ 0x0fa33000, 0x0fa33004, 0xfffffc01, 0xfffffc00,
-
-               /* UPM Read Burst RAM array entry -> unused */
-    /* 0x08 */ 0xfffffc00, 0xfffffc00, 0xfffffc00, 0xfffffc00,
-    /* 0x0C */ 0xfffffc00, 0xfffffc00, 0xfffffc00, 0xfffffc00,
-
-               /* UPM Read Burst RAM array entry -> unused */
-    /* 0x10 */ 0xfffffc00, 0xfffffc00, 0xfffffc00, 0xfffffc00,
-    /* 0x14 */ 0xfffffc00, 0xfffffc00, 0xfffffc00, 0xfffffc00,
-
-               /* UPM Write Single RAM array entry -> NAND Write Data, ADDR and CMD */
-    /* 0x18 */ 0x00a3ff00, 0x00a3fc00, 0x00a3fc00, 0x0fa3fc00,
-    /* 0x1C */ 0x0fa3fc00, 0x0fa3fc04, 0xfffffc01, 0xfffffc00,
-
-               /* UPM Write Burst RAM array entry -> unused */
-    /* 0x20 */ 0xfffffc00, 0xfffffc00, 0xfffffc00, 0xfffffc00,
-    /* 0x24 */ 0xfffffc00, 0xfffffc00, 0xfffffc00, 0xfffffc00,
-    /* 0x28 */ 0xfffffc00, 0xfffffc00, 0xfffffc00, 0xfffffc00,
-    /* 0x2C */ 0xfffffc00, 0xfffffc00, 0xfffffc00, 0xfffffc01,
-
-               /* UPM Refresh Timer RAM array entry -> unused */
-    /* 0x30 */ 0xfffffc00, 0xfffffc00, 0xfffffc00, 0xfffffc00,
-    /* 0x34 */ 0xfffffc00, 0xfffffc00, 0xfffffc00, 0xfffffc00,
-    /* 0x38 */ 0xfffffc00, 0xfffffc00, 0xfffffc00, 0xfffffc01,
-
-               /* UPM Exception RAM array entry -> unsused */
-    /* 0x3C */ 0xfffffc00, 0xfffffc00, 0xfffffc00, 0xfffffc01,
-};
-
-/* UPM pattern for bus clock = 133.3 MHz */
-static const uint upmTable133[] =
-{
-    /* Offset  UPM Read Single RAM array entry -> NAND Read Data */
-    /* 0x00 */ 0x0fa3f300, 0x0fa3b000, 0x0fa33300, 0x0fa33000,
-    /* 0x04 */ 0x0fa33200, 0x0fa33004, 0xfffffc01, 0xfffffc00,
-
-               /* UPM Read Burst RAM array entry -> unused */
-    /* 0x08 */ 0xfffffc00, 0xfffffc00, 0xfffffc00, 0xfffffc00,
-    /* 0x0C */ 0xfffffc00, 0xfffffc00, 0xfffffc00, 0xfffffc00,
-
-               /* UPM Read Burst RAM array entry -> unused */
-    /* 0x10 */ 0xfffffc00, 0xfffffc00, 0xfffffc00, 0xfffffc00,
-    /* 0x14 */ 0xfffffc00, 0xfffffc00, 0xfffffc00, 0xfffffc00,
-
-               /* UPM Write Single RAM array entry -> NAND Write Data, ADDR and CMD */
-    /* 0x18 */ 0x00a3ff00, 0x00a3fc00, 0x00a3fd00, 0x0fa3fc00,
-    /* 0x1C */ 0x0fa3fd00, 0x0fa3fc04, 0xfffffc01, 0xfffffc00,
-
-               /* UPM Write Burst RAM array entry -> unused */
-    /* 0x20 */ 0xfffffc00, 0xfffffc00, 0xfffffc00, 0xfffffc00,
-    /* 0x24 */ 0xfffffc00, 0xfffffc00, 0xfffffc00, 0xfffffc00,
-    /* 0x28 */ 0xfffffc00, 0xfffffc00, 0xfffffc00, 0xfffffc00,
-    /* 0x2C */ 0xfffffc00, 0xfffffc00, 0xfffffc00, 0xfffffc01,
-
-               /* UPM Refresh Timer RAM array entry -> unused */
-    /* 0x30 */ 0xfffffc00, 0xfffffc00, 0xfffffc00, 0xfffffc00,
-    /* 0x34 */ 0xfffffc00, 0xfffffc00, 0xfffffc00, 0xfffffc00,
-    /* 0x38 */ 0xfffffc00, 0xfffffc00, 0xfffffc00, 0xfffffc01,
-
-               /* UPM Exception RAM array entry -> unsused */
-    /* 0x3C */ 0xfffffc00, 0xfffffc00, 0xfffffc00, 0xfffffc01,
-};
-
-static int     chipsel = 0;
-
-/* UPM pattern for slow init */
-static const uint upmTableSlow[] =
-{
-    /* Offset  UPM Read Single RAM array entry */
-    /* 0x00 */ 0xffffee00, 0x00ffcc80, 0x00ffcf00, 0x00ffdc00,
-    /* 0x04 */ 0x00ffce80, 0x00ffcc00, 0x00ffee00, 0x3fffcc07,
-
-               /* UPM Read Burst RAM array entry -> unused */
-    /* 0x08 */ 0xfffffc00, 0xfffffc00, 0xfffffc00, 0xfffffc00,
-    /* 0x0C */ 0xfffffc00, 0xfffffc00, 0xfffffc00, 0xfffffc00,
-
-               /* UPM Read Burst RAM array entry -> unused */
-    /* 0x10 */ 0xfffffc00, 0xfffffc00, 0xfffffc00, 0xfffffc00,
-    /* 0x14 */ 0xfffffc00, 0xfffffc00, 0xfffffc00, 0xfffffc00,
-
-               /* UPM Write Single RAM array entry */
-    /* 0x18 */ 0xffffee00, 0x00ffec80, 0x00ffef00, 0x00fffc80,
-    /* 0x1C */ 0x00fffe00, 0x00ffec00, 0x0fffef00, 0x3fffec05,
-
-               /* UPM Write Burst RAM array entry -> unused */
-    /* 0x20 */ 0xfffffc00, 0xfffffc00, 0xfffffc00, 0xfffffc00,
-    /* 0x24 */ 0xfffffc00, 0xfffffc00, 0xfffffc00, 0xfffffc00,
-    /* 0x28 */ 0xfffffc00, 0xfffffc00, 0xfffffc00, 0xfffffc00,
-    /* 0x2C */ 0xfffffc00, 0xfffffc00, 0xfffffc00, 0xfffffc01,
-
-               /* UPM Refresh Timer RAM array entry -> unused */
-    /* 0x30 */ 0xfffffc00, 0xfffffc00, 0xfffffc00, 0xfffffc00,
-    /* 0x34 */ 0xfffffc00, 0xfffffc00, 0xfffffc00, 0xfffffc00,
-    /* 0x38 */ 0xfffffc00, 0xfffffc00, 0xfffffc00, 0xfffffc01,
-
-               /* UPM Exception RAM array entry -> unused */
-    /* 0x3C */ 0xfffffc00, 0xfffffc00, 0xfffffc00, 0xfffffc01,
-};
-
-/* UPM pattern for fast init */
-static const uint upmTableFast[] =
-{
-    /* Offset  UPM Read Single RAM array entry */
-    /* 0x00 */ 0xffffee00, 0x00ffcc80, 0x00ffcd80, 0x00ffdc00,
-    /* 0x04 */ 0x00ffdc00, 0x00ffcf00, 0x00ffec00, 0x3fffcc07,
-
-               /* UPM Read Burst RAM array entry -> unused */
-    /* 0x08 */ 0xfffffc00, 0xfffffc00, 0xfffffc00, 0xfffffc00,
-    /* 0x0C */ 0xfffffc00, 0xfffffc00, 0xfffffc00, 0xfffffc00,
-
-               /* UPM Read Burst RAM array entry -> unused */
-    /* 0x10 */ 0xfffffc00, 0xfffffc00, 0xfffffc00, 0xfffffc00,
-    /* 0x14 */ 0xfffffc00, 0xfffffc00, 0xfffffc00, 0xfffffc00,
-
-               /* UPM Write Single RAM array entry */
-    /* 0x18 */ 0xffffee00, 0x00ffec80, 0x00ffee80, 0x00fffc00,
-    /* 0x1C */ 0x00fffc00, 0x00ffec00, 0x0fffef00, 0x3fffec05,
-
-               /* UPM Write Burst RAM array entry -> unused */
-    /* 0x20 */ 0xfffffc00, 0xfffffc00, 0xfffffc00, 0xfffffc00,
-    /* 0x24 */ 0xfffffc00, 0xfffffc00, 0xfffffc00, 0xfffffc00,
-    /* 0x28 */ 0xfffffc00, 0xfffffc00, 0xfffffc00, 0xfffffc00,
-    /* 0x2C */ 0xfffffc00, 0xfffffc00, 0xfffffc00, 0xfffffc01,
-
-               /* UPM Refresh Timer RAM array entry -> unused */
-    /* 0x30 */ 0xfffffc00, 0xfffffc00, 0xfffffc00, 0xfffffc00,
-    /* 0x34 */ 0xfffffc00, 0xfffffc00, 0xfffffc00, 0xfffffc00,
-    /* 0x38 */ 0xfffffc00, 0xfffffc00, 0xfffffc00, 0xfffffc01,
-
-               /* UPM Exception RAM array entry -> unused */
-    /* 0x3C */ 0xfffffc00, 0xfffffc00, 0xfffffc00, 0xfffffc01,
-};
-
-
-/* ------------------------------------------------------------------------- */
-
-/* Check Board Identity:
- */
-int checkboard (void)
-{
-       char *p = (char *) HWIB_INFO_START_ADDR;
-
-       puts ("Board: ");
-       if (*((unsigned long *)p) == (unsigned long)CFG_HWINFO_MAGIC) {
-               puts (p);
-       } else {
-               puts ("No HWIB assuming TQM8272");
-       }
-       putc ('\n');
-
-       return 0;
-}
-
-/* ------------------------------------------------------------------------- */
-#if defined(CONFIG_BOARD_GET_CPU_CLK_F)
-static int get_cas_latency (void)
-{
-       /* get it from the option -ts in CIB */
-       /* default is 3 */
-       int     ret = 3;
-       int     pos = 0;
-       char    *p = (char *) CIB_INFO_START_ADDR;
-
-       while ((*p != '\0') && (pos < CIB_INFO_LEN)) {
-               if (*p < ' ' || *p > '~') { /* ASCII strings! */
-                       return ret;
-               }
-               if (*p == '-') {
-                       if ((p[1] == 't') && (p[2] == 's')) {
-                               return (p[4] - '0');
-                       }
-               }
-               p++;
-               pos++;
-       }
-       return ret;
-}
-#endif
-
-static ulong set_sdram_timing (volatile uint *sdmr_ptr, ulong sdmr, int col)
-{
-#if defined(CONFIG_BOARD_GET_CPU_CLK_F)
-       int     clk = board_get_cpu_clk_f ();
-       volatile immap_t *immr = (immap_t *)CFG_IMMR;
-       int     busmode = (immr->im_siu_conf.sc_bcr & BCR_EBM ? 1 : 0);
-       int     cas;
-
-       sdmr = sdmr & ~(PSDMR_RFRC_MSK | PSDMR_PRETOACT_MSK | PSDMR_WRC_MSK | \
-                        PSDMR_BUFCMD);
-       if (busmode) {
-               switch (clk) {
-                       case 66666666:
-                               sdmr |= (PSDMR_RFRC_66MHZ_60X | \
-                                       PSDMR_PRETOACT_66MHZ_60X | \
-                                       PSDMR_WRC_66MHZ_60X | \
-                                       PSDMR_BUFCMD_66MHZ_60X);
-                               break;
-                       case 100000000:
-                               sdmr |= (PSDMR_RFRC_100MHZ_60X | \
-                                       PSDMR_PRETOACT_100MHZ_60X | \
-                                       PSDMR_WRC_100MHZ_60X | \
-                                       PSDMR_BUFCMD_100MHZ_60X);
-                               break;
-
-               }
-       } else {
-               switch (clk) {
-                       case 66666666:
-                               sdmr |= (PSDMR_RFRC_66MHZ_SINGLE | \
-                                       PSDMR_PRETOACT_66MHZ_SINGLE | \
-                                       PSDMR_WRC_66MHZ_SINGLE | \
-                                       PSDMR_BUFCMD_66MHZ_SINGLE);
-                               break;
-                       case 100000000:
-                               sdmr |= (PSDMR_RFRC_100MHZ_SINGLE | \
-                                       PSDMR_PRETOACT_100MHZ_SINGLE | \
-                                       PSDMR_WRC_100MHZ_SINGLE | \
-                                       PSDMR_BUFCMD_100MHZ_SINGLE);
-                               break;
-                       case 133333333:
-                               sdmr |= (PSDMR_RFRC_133MHZ_SINGLE | \
-                                       PSDMR_PRETOACT_133MHZ_SINGLE | \
-                                       PSDMR_WRC_133MHZ_SINGLE | \
-                                       PSDMR_BUFCMD_133MHZ_SINGLE);
-                               break;
-               }
-       }
-       cas = get_cas_latency();
-       sdmr &=~ (PSDMR_CL_MSK | PSDMR_LDOTOPRE_MSK);
-       sdmr |= cas;
-       sdmr |= ((cas - 1) << 6);
-       return sdmr;
-#else
-       return sdmr;
-#endif
-}
-
-/* Try SDRAM initialization with P/LSDMR=sdmr and ORx=orx
- *
- * This routine performs standard 8260 initialization sequence
- * and calculates the available memory size. It may be called
- * several times to try different SDRAM configurations on both
- * 60x and local buses.
- */
-static long int try_init (volatile memctl8260_t * memctl, ulong sdmr,
-                                                 ulong orx, volatile uchar * base, int col)
-{
-       volatile uchar c = 0xff;
-       volatile uint *sdmr_ptr;
-       volatile uint *orx_ptr;
-       ulong maxsize, size;
-       int i;
-
-       /* We must be able to test a location outsize the maximum legal size
-        * to find out THAT we are outside; but this address still has to be
-        * mapped by the controller. That means, that the initial mapping has
-        * to be (at least) twice as large as the maximum expected size.
-        */
-       maxsize = (1 + (~orx | 0x7fff)) / 2;
-
-       /* Since CFG_SDRAM_BASE is always 0 (??), we assume that
-        * we are configuring CS1 if base != 0
-        */
-       sdmr_ptr = base ? &memctl->memc_lsdmr : &memctl->memc_psdmr;
-       orx_ptr = base ? &memctl->memc_or2 : &memctl->memc_or1;
-
-       *orx_ptr = orx;
-       sdmr = set_sdram_timing (sdmr_ptr, sdmr, col);
-       /*
-        * Quote from 8260 UM (10.4.2 SDRAM Power-On Initialization, 10-35):
-        *
-        * "At system reset, initialization software must set up the
-        *  programmable parameters in the memory controller banks registers
-        *  (ORx, BRx, P/LSDMR). After all memory parameters are configured,
-        *  system software should execute the following initialization sequence
-        *  for each SDRAM device.
-        *
-        *  1. Issue a PRECHARGE-ALL-BANKS command
-        *  2. Issue eight CBR REFRESH commands
-        *  3. Issue a MODE-SET command to initialize the mode register
-        *
-        *  The initial commands are executed by setting P/LSDMR[OP] and
-        *  accessing the SDRAM with a single-byte transaction."
-        *
-        * The appropriate BRx/ORx registers have already been set when we
-        * get here. The SDRAM can be accessed at the address CFG_SDRAM_BASE.
-        */
-
-       *sdmr_ptr = sdmr | PSDMR_OP_PREA;
-       *base = c;
-
-       *sdmr_ptr = sdmr | PSDMR_OP_CBRR;
-       for (i = 0; i < 8; i++)
-               *base = c;
-
-       *sdmr_ptr = sdmr | PSDMR_OP_MRW;
-       *(base + CFG_MRS_OFFS) = c;     /* setting MR on address lines */
-
-       *sdmr_ptr = sdmr | PSDMR_OP_NORM | PSDMR_RFEN;
-       *base = c;
-
-       size = get_ram_size((long *)base, maxsize);
-       *orx_ptr = orx | ~(size - 1);
-
-       return (size);
-}
-
-long int initdram (int board_type)
-{
-       volatile immap_t *immap = (immap_t *) CFG_IMMR;
-       volatile memctl8260_t *memctl = &immap->im_memctl;
-
-#ifndef CFG_RAMBOOT
-       long size8, size9;
-#endif
-       long psize, lsize;
-
-       psize = 16 * 1024 * 1024;
-       lsize = 0;
-
-       memctl->memc_psrt = CFG_PSRT;
-       memctl->memc_mptpr = CFG_MPTPR;
-
-#ifndef CFG_RAMBOOT
-       /* 60x SDRAM setup:
-        */
-       size8 = try_init (memctl, CFG_PSDMR_8COL, CFG_OR1_8COL,
-                                         (uchar *) CFG_SDRAM_BASE, 8);
-       size9 = try_init (memctl, CFG_PSDMR_9COL, CFG_OR1_9COL,
-                                         (uchar *) CFG_SDRAM_BASE, 9);
-
-       if (size8 < size9) {
-               psize = size9;
-               printf ("(60x:9COL - %ld MB, ", psize >> 20);
-       } else {
-               psize = try_init (memctl, CFG_PSDMR_8COL, CFG_OR1_8COL,
-                                                 (uchar *) CFG_SDRAM_BASE, 8);
-               printf ("(60x:8COL - %ld MB, ", psize >> 20);
-       }
-
-#endif /* CFG_RAMBOOT */
-
-       icache_enable ();
-
-       return (psize);
-}
-
-
-static inline int scanChar (char *p, int len, unsigned long *number)
-{
-       int     akt = 0;
-
-       *number = 0;
-       while (akt < len) {
-               if ((*p >= '0') && (*p <= '9')) {
-                       *number *= 10;
-                       *number += *p - '0';
-                       p += 1;
-               } else {
-                       if (*p == '-')  return akt;
-                       return -1;
-               }
-               akt ++;
-       }
-       return akt;
-}
-
-typedef struct{
-       int     Bus;
-       int     flash;
-       int     flash_nr;
-       int     ram;
-       int     ram_cs;
-       int     nand;
-       int     nand_cs;
-       int     eeprom;
-       int     can;
-       unsigned long   cpunr;
-       unsigned long   option;
-       int     SecEng;
-       int     cpucl;
-       int     cpmcl;
-       int     buscl;
-       int     busclk_real_ok;
-       int     busclk_real;
-       unsigned char   OK;
-       unsigned char  ethaddr[20];
-} HWIB_INFO;
-
-HWIB_INFO      hwinf = {0, 0, 1, 0, 1, 0, 0, 0, 0, 8272, 0 ,0,
-                        0, 0, 0, 0, 0, 0};
-
-static int dump_hwib(void)
-{
-       HWIB_INFO       *hw = &hwinf;
-       volatile immap_t *immr = (immap_t *)CFG_IMMR;
-       char *s = getenv("serial#");
-
-       if (hw->OK) {
-               printf ("HWIB on %x\n", HWIB_INFO_START_ADDR);
-               printf ("serial : %s\n", s);
-               printf ("ethaddr: %s\n", hw->ethaddr);
-               printf ("FLASH  : %x nr:%d\n", hw->flash, hw->flash_nr);
-               printf ("RAM    : %x cs:%d\n", hw->ram, hw->ram_cs);
-               printf ("CPU    : %d\n", hw->cpunr);
-               printf ("CAN    : %d\n", hw->can);
-               if (hw->eeprom) printf ("EEprom : %x\n", hw->eeprom);
-               else printf ("No EEprom\n");
-               if (hw->nand) {
-                       printf ("NAND   : %x\n", hw->nand);
-                       printf ("NAND CS: %d\n", hw->nand_cs);
-               } else { printf ("No NAND\n");}
-               printf ("Bus %s mode.\n", (hw->Bus ? "60x" : "Single PQII"));
-               printf ("  real : %s\n", (immr->im_siu_conf.sc_bcr & BCR_EBM ? \
-                                "60x" : "Single PQII"));
-               printf ("Option : %x\n", hw->option);
-               printf ("%s Security Engine\n", (hw->SecEng ? "with" : "no"));
-               printf ("CPM Clk: %d\n", hw->cpmcl);
-               printf ("CPU Clk: %d\n", hw->cpucl);
-               printf ("Bus Clk: %d\n", hw->buscl);
-               if (hw->busclk_real_ok) {
-                       printf ("  real Clk: %d\n", hw->busclk_real);
-               }
-               printf ("CAS    : %d\n", get_cas_latency());
-       } else {
-               printf("HWIB @%x not OK\n", HWIB_INFO_START_ADDR);
-       }
-       return 0;
-}
-
-static inline int search_real_busclk (int *clk)
-{
-       int     part = 0, pos = 0;
-       char *p = (char *) CIB_INFO_START_ADDR;
-       int     ok = 0;
-
-       while ((*p != '\0') && (pos < CIB_INFO_LEN)) {
-               if (*p < ' ' || *p > '~') { /* ASCII strings! */
-                       return 0;
-               }
-               switch (part) {
-               default:
-                       if (*p == '-') {
-                               ++part;
-                       }
-                       break;
-               case 3:
-                       if (*p == '-') {
-                               ++part;
-                               break;
-                       }
-                       if (*p == 'b') {
-                               ok = 1;
-                               p++;
-                               break;
-                       }
-                       if (ok) {
-                               switch (*p) {
-                               case '6':
-                                       *clk = 66666666;
-                                       return 1;
-                                       break;
-                               case '1':
-                                       if (p[1] == '3') {
-                                               *clk = 133333333;
-                                       } else {
-                                               *clk = 100000000;
-                                       }
-                                       return 1;
-                                       break;
-                               }
-                       }
-                       break;
-               }
-               p++;
-       }
-       return 0;
-}
-
-int analyse_hwib (void)
-{
-       char    *p = (char *) HWIB_INFO_START_ADDR;
-       int     anz;
-       int     part = 1, i = 0, pos = 0;
-       HWIB_INFO       *hw = &hwinf;
-
-       deb_printf(" %s pointer: %p\n", __FUNCTION__, p);
-       /* Head = TQM */
-       if (*((unsigned long *)p) != (unsigned long)CFG_HWINFO_MAGIC) {
-               deb_printf("No HWIB\n");
-               return -1;
-       }
-       p += 3;
-       if (scanChar (p, 4, &hw->cpunr) < 0) {
-               deb_printf("No CPU\n");
-               return -2;
-       }
-       p +=4;
-
-       hw->flash = 0x200000 << (*p - 'A');
-       p++;
-       hw->flash_nr = *p - '0';
-       p++;
-
-       hw->ram = 0x2000000 << (*p - 'A');
-       p++;
-       if (*p == '2') {
-               hw->ram_cs = 2;
-               p++;
-       }
-
-       if (*p == 'A') hw->can = 1;
-       if (*p == 'B') hw->can = 2;
-       p +=1;
-       p +=1;  /* connector */
-       if (*p != '0') {
-               hw->eeprom = 0x1000 << (*p - 'A');
-       }
-       p++;
-
-       if ((*p < '0') || (*p > '9')) {
-               /* NAND before z-option */
-               hw->nand = 0x8000000 << (*p - 'A');
-               p++;
-               hw->nand_cs = *p - '0';
-               p += 2;
-       }
-       /* z-option */
-       anz = scanChar (p, 4, &hw->option);
-       if (anz < 0) {
-               deb_printf("No option\n");
-               return -3;
-       }
-       if (hw->option & 0x8) hw->Bus = 1;
-       p += anz;
-       if (*p != '-') {
-               deb_printf("No -\n");
-               return -4;
-       }
-       p++;
-       /* C option */
-       if (*p == 'E') {
-               hw->SecEng = 1;
-               p++;
-       }
-       switch (*p) {
-               case 'M': hw->cpucl = 266666666;
-                       break;
-               case 'P': hw->cpucl = 300000000;
-                       break;
-               case 'T': hw->cpucl = 400000000;
-                       break;
-               default:
-                       deb_printf("No CPU Clk: %c\n", *p);
-                       return -5;
-                       break;
-       }
-       p++;
-       switch (*p) {
-               case 'I': hw->cpmcl = 200000000;
-                       break;
-               case 'M': hw->cpmcl = 300000000;
-                       break;
-               default:
-                       deb_printf("No CPM Clk\n");
-                       return -6;
-                       break;
-       }
-       p++;
-       switch (*p) {
-               case 'B': hw->buscl = 66666666;
-                       break;
-               case 'E': hw->buscl = 100000000;
-                       break;
-               case 'F': hw->buscl = 133333333;
-                       break;
-               default:
-                       deb_printf("No BUS Clk\n");
-                       return -7;
-                       break;
-       }
-       p++;
-
-       hw->OK = 1;
-       /* search MAC Address */
-       while ((*p != '\0') && (pos < CFG_HWINFO_SIZE)) {
-               if (*p < ' ' || *p > '~') { /* ASCII strings! */
-                       return 0;
-               }
-               switch (part) {
-               default:
-                       if (*p == ' ') {
-                               ++part;
-                               i = 0;
-                       }
-                       break;
-               case 3:                 /* Copy MAC address */
-                       if (*p == ' ') {
-                               ++part;
-                               i = 0;
-                               break;
-                       }
-                       hw->ethaddr[i++] = *p;
-                       if ((i % 3) == 2)
-                               hw->ethaddr[i++] = ':';
-                       break;
-
-               }
-               p++;
-       }
-
-       hw->busclk_real_ok = search_real_busclk (&hw->busclk_real);
-       return 0;
-}
-
-#if defined(CONFIG_GET_CPU_STR_F)
-/* !! This routine runs from Flash */
-char get_cpu_str_f (char *buf)
-{
-       char *p = (char *) HWIB_INFO_START_ADDR;
-       int     i = 0;
-
-       buf[i++] = 'M';
-       buf[i++] = 'P';
-       buf[i++] = 'C';
-       if (*((unsigned long *)p) == (unsigned long)CFG_HWINFO_MAGIC) {
-               buf[i++] = *&p[3];
-               buf[i++] = *&p[4];
-               buf[i++] = *&p[5];
-               buf[i++] = *&p[6];
-       } else {
-               buf[i++] = '8';
-               buf[i++] = '2';
-               buf[i++] = '7';
-               buf[i++] = 'x';
-       }
-       buf[i++] = 0;
-       return 0;
-}
-#endif
-
-#if defined(CONFIG_BOARD_GET_CPU_CLK_F)
-/* !! This routine runs from Flash */
-unsigned long board_get_cpu_clk_f (void)
-{
-       char *p = (char *) HWIB_INFO_START_ADDR;
-       int i = 0;
-
-       if (*((unsigned long *)p) == (unsigned long)CFG_HWINFO_MAGIC) {
-               if (search_real_busclk (&i))
-                       return i;
-       }
-       return CONFIG_8260_CLKIN;
-}
-#endif
-
-#if CONFIG_BOARD_EARLY_INIT_R
-
-static int can_test (unsigned long off)
-{
-       volatile unsigned char  *base   = (unsigned char *) (CFG_CAN_BASE + off);
-
-       *(base + 0x17) = 'T';
-       *(base + 0x18) = 'Q';
-       *(base + 0x19) = 'M';
-       if ((*(base + 0x17) != 'T') ||
-           (*(base + 0x18) != 'Q') ||
-           (*(base + 0x19) != 'M')) {
-               return 0;
-       }
-       return 1;
-}
-
-static int can_config_one (unsigned long off)
-{
-       volatile unsigned char  *ctrl   = (unsigned char *) (CFG_CAN_BASE + off);
-       volatile unsigned char  *cpu_if = (unsigned char *) (CFG_CAN_BASE + off + 0x02);
-       volatile unsigned char  *clkout = (unsigned char *) (CFG_CAN_BASE + off + 0x1f);
-       unsigned char temp;
-
-       *cpu_if = 0x45;
-       temp = *ctrl;
-       temp |= 0x40;
-       *ctrl   = temp;
-       *clkout = 0x20;
-       temp = *ctrl;
-       temp &= ~0x40;
-       *ctrl   = temp;
-       return 0;
-}
-
-static int can_config (void)
-{
-       int     ret = 0;
-       can_config_one (0);
-       if (hwinf.can == 2) {
-               can_config_one (0x100);
-       }
-       /* make Test if they really there */
-       ret += can_test (0);
-       ret += can_test (0x100);
-       return ret;
-}
-
-static int init_can (void)
-{
-       volatile immap_t * immr = (immap_t *)CFG_IMMR;
-       volatile memctl8260_t *memctl = &immr->im_memctl;
-       int     count = 0;
-
-       if ((hwinf.OK) && (hwinf.can)) {
-               memctl->memc_or4 = CFG_CAN_OR;
-               memctl->memc_br4 = CFG_CAN_BR;
-               /* upm Init */
-               upmconfig (UPMC, (uint *) upmTableFast,
-                          sizeof (upmTableFast) / sizeof (uint));
-               memctl->memc_mcmr =     (MxMR_DSx_3_CYCL |
-                                       MxMR_GPL_x4DIS |
-                                       MxMR_RLFx_2X |
-                                       MxMR_WLFx_2X |
-                                       MxMR_OP_NORM);
-               /* can configure */
-               count = can_config ();
-               printf ("CAN:   %d @ %x\n", count, CFG_CAN_BASE);
-               if (hwinf.can != count) printf("!!! difference to HWIB\n");
-       } else {
-               printf ("CAN:   No\n");
-       }
-       return 0;
-}
-
-int board_early_init_r(void)
-{
-       analyse_hwib ();
-       init_can ();
-       return 0;
-}
-#endif
-
-int do_hwib_dump (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[])
-{
-       dump_hwib ();
-       return 0;
-}
-
-U_BOOT_CMD(
-         hwib, 1,      1,      do_hwib_dump,
-         "hwib    - dump HWIB'\n",
-         "\n"
-);
-
-#ifdef CFG_UPDATE_FLASH_SIZE
-static int get_flash_timing (void)
-{
-       /* get it from the option -tf in CIB */
-       /* default is 0x00000c84 */
-       int     ret = 0x00000c84;
-       int     pos = 0;
-       int     nr = 0;
-       char    *p = (char *) CIB_INFO_START_ADDR;
-
-       while ((*p != '\0') && (pos < CIB_INFO_LEN)) {
-               if (*p < ' ' || *p > '~') { /* ASCII strings! */
-                       return ret;
-               }
-               if (*p == '-') {
-                       if ((p[1] == 't') && (p[2] == 'f')) {
-                               p += 6;
-                               ret = 0;
-                               while (nr < 8) {
-                               if ((*p >= '0') && (*p <= '9')) {
-                                       ret *= 0x10;
-                                       ret += *p - '0';
-                                       p += 1;
-                                       nr ++;
-                               } else if ((*p >= 'A') && (*p <= 'F')) {
-                                       ret *= 10;
-                                       ret += *p - '7';
-                                       p += 1;
-                                       nr ++;
-                               } else {
-                                       if (nr < 8) return 0x00000c84;
-                                       return ret;
-                               }
-                               }
-                       }
-               }
-               p++;
-               pos++;
-       }
-       return ret;
-}
-
-/* Update the Flash_Size and the Flash Timing */
-int update_flash_size (int flash_size)
-{
-       volatile immap_t * immr = (immap_t *)CFG_IMMR;
-       volatile memctl8260_t *memctl = &immr->im_memctl;
-       unsigned long reg;
-       unsigned long tim;
-
-       /* I must use reg, otherwise the board hang */
-       reg = memctl->memc_or0;
-       reg &= ~ORxU_AM_MSK;
-       reg |= MEG_TO_AM(flash_size >> 20);
-       tim = get_flash_timing ();
-       reg &= ~0xfff;
-       reg |= (tim & 0xfff);
-       memctl->memc_or0 = reg;
-       return 0;
-}
-#endif
-
-#if defined(CONFIG_CMD_NAND)
-
-#include <nand.h>
-#include <linux/mtd/mtd.h>
-
-static u8 hwctl = 0;
-
-static void upmnand_hwcontrol(struct mtd_info *mtdinfo, int cmd)
-{
-       switch (cmd) {
-       case NAND_CTL_SETCLE:
-               hwctl |= 0x1;
-               break;
-       case NAND_CTL_CLRCLE:
-               hwctl &= ~0x1;
-               break;
-
-       case NAND_CTL_SETALE:
-               hwctl |= 0x2;
-               break;
-
-       case NAND_CTL_CLRALE:
-               hwctl &= ~0x2;
-               break;
-       }
-}
-
-static void upmnand_write_byte(struct mtd_info *mtdinfo, u_char byte)
-{
-       struct nand_chip *this = mtdinfo->priv;
-       ulong base = (ulong) (this->IO_ADDR_W + chipsel * CFG_NAND_CS_DIST);
-
-       if (hwctl & 0x1) {
-               WRITE_NAND_UPM(byte, base, CFG_NAND_UPM_WRITE_CMD_OFS);
-       } else if (hwctl & 0x2) {
-               WRITE_NAND_UPM(byte, base, CFG_NAND_UPM_WRITE_ADDR_OFS);
-       } else {
-               WRITE_NAND(byte, base);
-       }
-}
-
-static u_char upmnand_read_byte(struct mtd_info *mtdinfo)
-{
-       struct nand_chip *this = mtdinfo->priv;
-       ulong base = (ulong) (this->IO_ADDR_W + chipsel * CFG_NAND_CS_DIST);
-
-       return READ_NAND(base);
-}
-
-static int tqm8272_dev_ready(struct mtd_info *mtdinfo)
-{
-       /* constant delay (see also tR in the datasheet) */
-       udelay(12); \
-       return 1;
-}
-
-#ifndef CONFIG_NAND_SPL
-static void tqm8272_read_buf(struct mtd_info *mtdinfo, uint8_t *buf, int len)
-{
-       struct nand_chip *this = mtdinfo->priv;
-       unsigned char *base = (unsigned char *) (this->IO_ADDR_W + chipsel * CFG_NAND_CS_DIST);
-       int     i;
-
-       for (i = 0; i< len; i++)
-               buf[i] = *base;
-}
-
-static void tqm8272_write_buf(struct mtd_info *mtdinfo, const uint8_t *buf, int len)
-{
-       struct nand_chip *this = mtdinfo->priv;
-       unsigned char *base = (unsigned char *) (this->IO_ADDR_W + chipsel * CFG_NAND_CS_DIST);
-       int     i;
-
-       for (i = 0; i< len; i++)
-               *base = buf[i];
-}
-
-static int tqm8272_verify_buf(struct mtd_info *mtdinfo, const uint8_t *buf, int len)
-{
-       struct nand_chip *this = mtdinfo->priv;
-       unsigned char *base = (unsigned char *) (this->IO_ADDR_W + chipsel * CFG_NAND_CS_DIST);
-       int     i;
-
-       for (i = 0; i < len; i++)
-               if (buf[i] != *base)
-                       return -1;
-       return 0;
-}
-#endif /* #ifndef CONFIG_NAND_SPL */
-
-void board_nand_select_device(struct nand_chip *nand, int chip)
-{
-       chipsel = chip;
-}
-
-int board_nand_init(struct nand_chip *nand)
-{
-       static  int     UpmInit = 0;
-       volatile immap_t * immr = (immap_t *)CFG_IMMR;
-       volatile memctl8260_t *memctl = &immr->im_memctl;
-
-       if (hwinf.nand == 0) return -1;
-
-       /* Setup the UPM */
-       if (UpmInit == 0) {
-               switch (hwinf.busclk_real) {
-               case 100000000:
-                       upmconfig (UPMB, (uint *) upmTable100,
-                          sizeof (upmTable100) / sizeof (uint));
-                       break;
-               case 133333333:
-                       upmconfig (UPMB, (uint *) upmTable133,
-                          sizeof (upmTable133) / sizeof (uint));
-                       break;
-               default:
-                       upmconfig (UPMB, (uint *) upmTable67,
-                          sizeof (upmTable67) / sizeof (uint));
-                       break;
-               }
-               UpmInit = 1;
-       }
-
-       /* Setup the memctrl */
-       memctl->memc_or3 = CFG_NAND_OR;
-       memctl->memc_br3 = CFG_NAND_BR;
-       memctl->memc_mbmr = (MxMR_OP_NORM);
-
-       nand->eccmode = NAND_ECC_SOFT;
-
-       nand->hwcontrol  = upmnand_hwcontrol;
-       nand->read_byte  = upmnand_read_byte;
-       nand->write_byte = upmnand_write_byte;
-       nand->dev_ready  = tqm8272_dev_ready;
-
-#ifndef CONFIG_NAND_SPL
-       nand->write_buf  = tqm8272_write_buf;
-       nand->read_buf   = tqm8272_read_buf;
-       nand->verify_buf = tqm8272_verify_buf;
-#endif
-
-       /*
-        * Select required NAND chip
-        */
-       board_nand_select_device(nand, 0);
-       return 0;
-}
-
-#endif
-
-#ifdef CONFIG_PCI
-struct pci_controller hose;
-
-int board_early_init_f (void)
-{
-       volatile immap_t *immap = (immap_t *) CFG_IMMR;
-
-       immap->im_clkrst.car_sccr |= M826X_SCCR_PCI_MODE_EN;
-       return 0;
-}
-
-extern void pci_mpc8250_init(struct pci_controller *);
-
-void pci_init_board(void)
-{
-       pci_mpc8250_init(&hose);
-}
-#endif
diff --git a/board/tqm834x/Makefile b/board/tqm834x/Makefile
deleted file mode 100644 (file)
index 4c0d204..0000000
+++ /dev/null
@@ -1,52 +0,0 @@
-#
-# (C) Copyright 2006
-# Wolfgang Denk, DENX Software Engineering, wd@denx.de.
-#
-# Copyright 2004 Freescale Semiconductor, Inc.
-#
-# See file CREDITS for list of people who contributed to this
-# project.
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License as
-# published by the Free Software Foundation; either version 2 of
-# the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
-# MA 02111-1307 USA
-#
-
-include $(TOPDIR)/config.mk
-
-LIB    = $(obj)lib$(BOARD).a
-
-COBJS  = $(BOARD).o pci.o
-
-SRCS   := $(SOBJS:.o=.S) $(COBJS:.o=.c)
-OBJS   := $(addprefix $(obj),$(COBJS))
-SOBJS  := $(addprefix $(obj),$(SOBJS))
-
-$(LIB):        $(obj).depend $(OBJS)
-       $(AR) $(ARFLAGS) $@ $(OBJS)
-
-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/tqm834x/config.mk b/board/tqm834x/config.mk
deleted file mode 100644 (file)
index f172c4e..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-#
-# Copyright 2004 Freescale Semiconductor, Inc.
-#
-# See file CREDITS for list of people who contributed to this
-# project.
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License as
-# published by the Free Software Foundation; either version 2 of
-# the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
-# MA 02111-1307 USA
-#
-
-TEXT_BASE   =   0x80000000
diff --git a/board/tqm834x/pci.c b/board/tqm834x/pci.c
deleted file mode 100644 (file)
index e3d0309..0000000
+++ /dev/null
@@ -1,220 +0,0 @@
-/*
- * (C) Copyright 2005
- * 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 <asm/mmu.h>
-#include <common.h>
-#include <pci.h>
-
-#ifdef CONFIG_PCI
-
-/* System RAM mapped to PCI space */
-#define CONFIG_PCI_SYS_MEM_BUS CFG_SDRAM_BASE
-#define CONFIG_PCI_SYS_MEM_PHYS        CFG_SDRAM_BASE
-#define CONFIG_PCI_SYS_MEM_SIZE        (1024 * 1024 * 1024)
-
-#ifndef CONFIG_PCI_PNP
-static struct pci_config_table pci_tqm834x_config_table[] = {
-       {PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID,
-        PCI_IDSEL_NUMBER, PCI_ANY_ID,
-        pci_cfgfunc_config_device, {PCI_ENET0_IOADDR,
-                                    PCI_ENET0_MEMADDR,
-                                    PCI_COMMAND_MEMORY | PCI_COMMAND_MASTER
-               }
-       },
-       {}
-};
-#endif
-
-static struct pci_controller pci1_hose = {
-#ifndef CONFIG_PCI_PNP
-       config_table:pci_tqm834x_config_table,
-#endif
-};
-
-
-/**************************************************************************
- * pci_init_board()
- *
- * NOTICE: MPC8349 internally has two PCI controllers (PCI1 and PCI2) but since
- * per TQM834x design physical connections to external devices (PCI sockets)
- * are routed only to the PCI1 we do not account for the second one - this code
- * supports PCI1 module only. Should support for the PCI2 be required in the
- * future it needs a separate pci_controller structure (above) and handling -
- * please refer to other boards' implementation for dual PCI host controllers,
- * for example board/Marvell/db64360/pci.c, pci_init_board()
- *
- */
-void
-pci_init_board(void)
-{
-       volatile immap_t *      immr;
-       volatile clk83xx_t *    clk;
-       volatile law83xx_t *    pci_law;
-       volatile pot83xx_t *    pci_pot;
-       volatile pcictrl83xx_t *        pci_ctrl;
-       volatile pciconf83xx_t *        pci_conf;
-       u16 reg16;
-       u32 reg32;
-       struct  pci_controller * hose;
-
-       immr = (immap_t *)CFG_IMMR;
-       clk = (clk83xx_t *)&immr->clk;
-       pci_law = immr->sysconf.pcilaw;
-       pci_pot = immr->ios.pot;
-       pci_ctrl = immr->pci_ctrl;
-       pci_conf = immr->pci_conf;
-
-       hose = &pci1_hose;
-
-       /*
-        * Configure PCI controller and PCI_CLK_OUTPUT
-        */
-
-       /*
-        * WARNING! only PCI_CLK_OUTPUT1 is enabled here as this is the one
-        * line actually used for clocking all external PCI devices in TQM83xx.
-        * Enabling other PCI_CLK_OUTPUT lines may lead to board's hang for
-        * unknown reasons - particularly PCI_CLK_OUTPUT6 and PCI_CLK_OUTPUT7
-        * are known to hang the board; this issue is under investigation
-        * (13 oct 05)
-        */
-       reg32 = OCCR_PCICOE1;
-#if 0
-       /* enabling all PCI_CLK_OUTPUT lines HANGS the board... */
-       reg32 = 0xff000000;
-#endif
-       if (clk->spmr & SPMR_CKID) {
-               /* PCI Clock is half CONFIG_83XX_CLKIN so need to set up OCCR
-                * fields accordingly */
-               reg32 |= (OCCR_PCI1CR | OCCR_PCI2CR);
-
-               reg32 |= (OCCR_PCICD0 | OCCR_PCICD1 | OCCR_PCICD2 \
-                         | OCCR_PCICD3 | OCCR_PCICD4 | OCCR_PCICD5 \
-                         | OCCR_PCICD6 | OCCR_PCICD7);
-       }
-
-       clk->occr = reg32;
-       udelay(2000);
-
-       /*
-        * Release PCI RST Output signal
-        */
-       pci_ctrl[0].gcr = 0;
-       udelay(2000);
-       pci_ctrl[0].gcr = 1;
-       udelay(2000);
-
-       /*
-        * Configure PCI Local Access Windows
-        */
-       pci_law[0].bar = CFG_PCI1_MEM_PHYS & LAWBAR_BAR;
-       pci_law[0].ar = LAWAR_EN | LAWAR_SIZE_512M;
-
-       pci_law[1].bar = CFG_PCI1_IO_PHYS & LAWBAR_BAR;
-       pci_law[1].ar = LAWAR_EN | LAWAR_SIZE_16M;
-
-       /*
-        * Configure PCI Outbound Translation Windows
-        */
-
-       /* PCI1 mem space */
-       pci_pot[0].potar = (CFG_PCI1_MEM_BASE >> 12) & POTAR_TA_MASK;
-       pci_pot[0].pobar = (CFG_PCI1_MEM_PHYS >> 12) & POBAR_BA_MASK;
-       pci_pot[0].pocmr = POCMR_EN | (POCMR_CM_512M & POCMR_CM_MASK);
-
-       /* PCI1 IO space */
-       pci_pot[1].potar = (CFG_PCI1_IO_BASE >> 12) & POTAR_TA_MASK;
-       pci_pot[1].pobar = (CFG_PCI1_IO_PHYS >> 12) & POBAR_BA_MASK;
-       pci_pot[1].pocmr = POCMR_EN | POCMR_IO | (POCMR_CM_16M & POCMR_CM_MASK);
-
-       /*
-        * Configure PCI Inbound Translation Windows
-        */
-
-       /* we need RAM mapped to PCI space for the devices to
-        * access main memory */
-       pci_ctrl[0].pitar1 = 0x0;
-       pci_ctrl[0].pibar1 = 0x0;
-       pci_ctrl[0].piebar1 = 0x0;
-       pci_ctrl[0].piwar1 = PIWAR_EN | PIWAR_PF | PIWAR_RTT_SNOOP | PIWAR_WTT_SNOOP | PIWAR_IWS_256M;
-
-       hose->first_busno = 0;
-       hose->last_busno = 0xff;
-
-       /* PCI memory space */
-       pci_set_region(hose->regions + 0,
-                      CFG_PCI1_MEM_BASE,
-                      CFG_PCI1_MEM_PHYS,
-                      CFG_PCI1_MEM_SIZE,
-                      PCI_REGION_MEM);
-
-       /* PCI IO space */
-       pci_set_region(hose->regions + 1,
-                      CFG_PCI1_IO_BASE,
-                      CFG_PCI1_IO_PHYS,
-                      CFG_PCI1_IO_SIZE,
-                      PCI_REGION_IO);
-
-       /* System memory space */
-       pci_set_region(hose->regions + 2,
-                      CONFIG_PCI_SYS_MEM_BUS,
-                      CONFIG_PCI_SYS_MEM_PHYS,
-                      CONFIG_PCI_SYS_MEM_SIZE,
-                      PCI_REGION_MEM | PCI_REGION_MEMORY);
-
-       hose->region_count = 3;
-
-       pci_setup_indirect(hose,
-                          (CFG_IMMR+0x8300),
-                          (CFG_IMMR+0x8304));
-
-       pci_register_hose(hose);
-
-       /*
-        * Write to Command register
-        */
-       reg16 = 0xff;
-       pci_hose_read_config_word (hose, PCI_BDF(0,0,0), PCI_COMMAND,
-                                       &reg16);
-       reg16 |= PCI_COMMAND_SERR | PCI_COMMAND_MASTER | PCI_COMMAND_MEMORY;
-       pci_hose_write_config_word(hose, PCI_BDF(0,0,0), PCI_COMMAND,
-                                       reg16);
-
-       /*
-        * Clear non-reserved bits in status register.
-        */
-       pci_hose_write_config_word(hose, PCI_BDF(0,0,0), PCI_STATUS,
-                                       0xffff);
-       pci_hose_write_config_byte(hose, PCI_BDF(0,0,0), PCI_LATENCY_TIMER,
-                                       0x80);
-
-#ifdef CONFIG_PCI_SCAN_SHOW
-       printf("PCI:   Bus Dev VenId DevId Class Int\n");
-#endif
-       /*
-        * Hose scan.
-        */
-       hose->last_busno = pci_hose_scan(hose);
-}
-#endif /* CONFIG_PCI */
diff --git a/board/tqm834x/tqm834x.c b/board/tqm834x/tqm834x.c
deleted file mode 100644 (file)
index aea985c..0000000
+++ /dev/null
@@ -1,433 +0,0 @@
-/*
- * (C) Copyright 2005
- * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- *
- */
-
-#include <common.h>
-#include <ioports.h>
-#include <mpc83xx.h>
-#include <asm/mpc8349_pci.h>
-#include <i2c.h>
-#include <miiphy.h>
-#include <asm-ppc/mmu.h>
-#include <pci.h>
-
-DECLARE_GLOBAL_DATA_PTR;
-
-#define IOSYNC                 asm("eieio")
-#define ISYNC                  asm("isync")
-#define SYNC                   asm("sync")
-#define FPW                    FLASH_PORT_WIDTH
-#define FPWV                   FLASH_PORT_WIDTHV
-
-#define DDR_MAX_SIZE_PER_CS    0x20000000
-
-#if defined(DDR_CASLAT_20)
-#define TIMING_CASLAT          TIMING_CFG1_CASLAT_20
-#define MODE_CASLAT            DDR_MODE_CASLAT_20
-#else
-#define TIMING_CASLAT          TIMING_CFG1_CASLAT_25
-#define MODE_CASLAT            DDR_MODE_CASLAT_25
-#endif
-
-#define INITIAL_CS_CONFIG      (CSCONFIG_EN | CSCONFIG_ROW_BIT_12 | \
-                               CSCONFIG_COL_BIT_9)
-
-/* Global variable used to store detected number of banks */
-int tqm834x_num_flash_banks;
-
-/* External definitions */
-ulong flash_get_size (ulong base, int banknum);
-extern flash_info_t flash_info[];
-
-/* Local functions */
-static int detect_num_flash_banks(void);
-static long int get_ddr_bank_size(short cs, volatile long *base);
-static void set_cs_bounds(short cs, long base, long size);
-static void set_cs_config(short cs, long config);
-static void set_ddr_config(void);
-
-/* Local variable */
-static volatile immap_t *im = (immap_t *)CFG_IMMR;
-
-/**************************************************************************
- * Board initialzation after relocation to RAM. Used to detect the number
- * of Flash banks on TQM834x.
- */
-int board_early_init_r (void) {
-       /* sanity check, IMMARBAR should be mirrored at offset zero of IMMR */
-       if ((im->sysconf.immrbar & IMMRBAR_BASE_ADDR) != (u32)im)
-               return 0;
-
-       /* detect the number of Flash banks */
-       return detect_num_flash_banks();
-}
-
-/**************************************************************************
- * DRAM initalization and size detection
- */
-long int initdram (int board_type)
-{
-       long bank_size;
-       long size;
-       int cs;
-
-       /* during size detection, set up the max DDRLAW size */
-       im->sysconf.ddrlaw[0].bar = CFG_DDR_BASE;
-       im->sysconf.ddrlaw[0].ar = (LAWAR_EN | LAWAR_SIZE_2G);
-
-       /* set CS bounds to maximum size */
-       for(cs = 0; cs < 4; ++cs) {
-               set_cs_bounds(cs,
-                       CFG_DDR_BASE + (cs * DDR_MAX_SIZE_PER_CS),
-                       DDR_MAX_SIZE_PER_CS);
-
-               set_cs_config(cs, INITIAL_CS_CONFIG);
-       }
-
-       /* configure ddr controller */
-       set_ddr_config();
-
-       udelay(200);
-
-       /* enable DDR controller */
-       im->ddr.sdram_cfg = (SDRAM_CFG_MEM_EN |
-               SDRAM_CFG_SREN |
-               SDRAM_CFG_SDRAM_TYPE_DDR1);
-       SYNC;
-
-       /* size detection */
-       debug("\n");
-       size = 0;
-       for(cs = 0; cs < 4; ++cs) {
-               debug("\nDetecting Bank%d\n", cs);
-
-               bank_size = get_ddr_bank_size(cs,
-                       (volatile long*)(CFG_DDR_BASE + size));
-               size += bank_size;
-
-               debug("DDR Bank%d size: %d MiB\n\n", cs, bank_size >> 20);
-
-               /* exit if less than one bank */
-               if(size < DDR_MAX_SIZE_PER_CS) break;
-       }
-
-       return size;
-}
-
-/**************************************************************************
- * checkboard()
- */
-int checkboard (void)
-{
-       puts("Board: TQM834x\n");
-
-#ifdef CONFIG_PCI
-       volatile immap_t * immr;
-       u32 w, f;
-
-       immr = (immap_t *)CFG_IMMR;
-       if (!(immr->reset.rcwh & HRCWH_PCI_HOST)) {
-               printf("PCI:   NOT in host mode..?!\n");
-               return 0;
-       }
-
-       /* get bus width */
-       w = 32;
-       if (immr->reset.rcwh & HRCWH_64_BIT_PCI)
-               w = 64;
-
-       /* get clock */
-       f = gd->pci_clk;
-
-       printf("PCI1:  %d bit, %d MHz\n", w, f / 1000000);
-#else
-       printf("PCI:   disabled\n");
-#endif
-       return 0;
-}
-
-
-/**************************************************************************
- *
- * Local functions
- *
- *************************************************************************/
-
-/**************************************************************************
- * Detect the number of flash banks (1 or 2). Store it in
- * a global variable tqm834x_num_flash_banks.
- * Bank detection code based on the Monitor code.
- */
-static int detect_num_flash_banks(void)
-{
-       typedef unsigned long FLASH_PORT_WIDTH;
-       typedef volatile unsigned long FLASH_PORT_WIDTHV;
-       FPWV *bank1_base;
-       FPWV *bank2_base;
-       FPW bank1_read;
-       FPW bank2_read;
-       ulong bank1_size;
-       ulong bank2_size;
-       ulong total_size;
-
-       tqm834x_num_flash_banks = 2;    /* assume two banks */
-
-       /* Get bank 1 and 2 information */
-       bank1_size = flash_get_size(CFG_FLASH_BASE, 0);
-       debug("Bank1 size: %lu\n", bank1_size);
-       bank2_size = flash_get_size(CFG_FLASH_BASE + bank1_size, 1);
-       debug("Bank2 size: %lu\n", bank2_size);
-       total_size = bank1_size + bank2_size;
-
-       if (bank2_size > 0) {
-               /* Seems like we've got bank 2, but maybe it's mirrored 1 */
-
-               /* Set the base addresses */
-               bank1_base = (FPWV *) (CFG_FLASH_BASE);
-               bank2_base = (FPWV *) (CFG_FLASH_BASE + bank1_size);
-
-               /* Put bank 2 into CFI command mode and read */
-               bank2_base[0x55] = 0x00980098;
-               IOSYNC;
-               ISYNC;
-               bank2_read = bank2_base[0x10];
-
-               /* Read from bank 1 (it's in read mode) */
-               bank1_read = bank1_base[0x10];
-
-               /* Reset Flash */
-               bank1_base[0] = 0x00F000F0;
-               bank2_base[0] = 0x00F000F0;
-
-               if (bank2_read == bank1_read) {
-                       /*
-                        * Looks like just one bank, but not sure yet. Let's
-                        * read from bank 2 in autosoelect mode.
-                        */
-                       bank2_base[0x0555] = 0x00AA00AA;
-                       bank2_base[0x02AA] = 0x00550055;
-                       bank2_base[0x0555] = 0x00900090;
-                       IOSYNC;
-                       ISYNC;
-                       bank2_read = bank2_base[0x10];
-
-                       /* Read from bank 1 (it's in read mode) */
-                       bank1_read = bank1_base[0x10];
-
-                       /* Reset Flash */
-                       bank1_base[0] = 0x00F000F0;
-                       bank2_base[0] = 0x00F000F0;
-
-                       if (bank2_read == bank1_read) {
-                               /*
-                                * In both CFI command and autoselect modes,
-                                * we got the some data reading from Flash.
-                                * There is only one mirrored bank.
-                                */
-                               tqm834x_num_flash_banks = 1;
-                               total_size = bank1_size;
-                       }
-               }
-       }
-
-       debug("Number of flash banks detected: %d\n", tqm834x_num_flash_banks);
-
-       /* set OR0 and BR0 */
-       im->lbus.bank[0].or = CFG_OR_TIMING_FLASH |
-               (-(total_size) & OR_GPCM_AM);
-       im->lbus.bank[0].br = (CFG_FLASH_BASE & BR_BA) |
-               (BR_MS_GPCM | BR_PS_32 | BR_V);
-
-       return (0);
-}
-
-/*************************************************************************
- * Detect the size of a ddr bank. Sets CS bounds and CS config accordingly.
- */
-static long int get_ddr_bank_size(short cs, volatile long *base)
-{
-       /* This array lists all valid DDR SDRAM configurations, with
-        * Bank sizes in bytes. (Refer to Table 9-27 in the MPC8349E RM).
-        * The last entry has to to have size equal 0 and is igonred during
-        * autodection. Bank sizes must be in increasing order of size
-        */
-       struct {
-               long row;
-               long col;
-               long size;
-       } conf[] = {
-               {CSCONFIG_ROW_BIT_12,   CSCONFIG_COL_BIT_8,     32 << 20},
-               {CSCONFIG_ROW_BIT_12,   CSCONFIG_COL_BIT_9,     64 << 20},
-               {CSCONFIG_ROW_BIT_12,   CSCONFIG_COL_BIT_10,    128 << 20},
-               {CSCONFIG_ROW_BIT_13,   CSCONFIG_COL_BIT_9,     128 << 20},
-               {CSCONFIG_ROW_BIT_13,   CSCONFIG_COL_BIT_10,    256 << 20},
-               {CSCONFIG_ROW_BIT_13,   CSCONFIG_COL_BIT_11,    512 << 20},
-               {CSCONFIG_ROW_BIT_14,   CSCONFIG_COL_BIT_10,    512 << 20},
-               {CSCONFIG_ROW_BIT_14,   CSCONFIG_COL_BIT_11,    1024 << 20},
-               {0,                     0,                      0}
-       };
-
-       int i;
-       int detected;
-       long size;
-
-       detected = -1;
-       for(i = 0; conf[i].size != 0; ++i) {
-
-               /* set sdram bank configuration */
-               set_cs_config(cs, CSCONFIG_EN | conf[i].col | conf[i].row);
-
-               debug("Getting RAM size...\n");
-               size = get_ram_size(base, DDR_MAX_SIZE_PER_CS);
-
-               if((size == conf[i].size) && (i == detected + 1))
-                       detected = i;
-
-               debug("Trying %ld x %ld (%ld MiB) at addr %p, detected: %ld MiB\n",
-                       conf[i].row,
-                       conf[i].col,
-                       conf[i].size >> 20,
-                       base,
-                       size >> 20);
-       }
-
-       if(detected == -1){
-               /* disable empty cs */
-               debug("\nNo valid configurations for CS%d, disabling...\n", cs);
-               set_cs_config(cs, 0);
-               return 0;
-       }
-
-       debug("\nDetected configuration %ld x %ld (%ld MiB) at addr %p\n",
-                       conf[detected].row, conf[detected].col, conf[detected].size >> 20, base);
-
-       /* configure cs ro detected params */
-       set_cs_config(cs, CSCONFIG_EN | conf[detected].row |
-                       conf[detected].col);
-
-       set_cs_bounds(cs, (long)base, conf[detected].size);
-
-       return(conf[detected].size);
-}
-
-/**************************************************************************
- * Sets DDR bank CS bounds.
- */
-static void set_cs_bounds(short cs, long base, long size)
-{
-       debug("Setting bounds %08x, %08x for cs %d\n", base, size, cs);
-       if(size == 0){
-               im->ddr.csbnds[cs].csbnds = 0x00000000;
-       } else {
-               im->ddr.csbnds[cs].csbnds =
-                       ((base >> CSBNDS_SA_SHIFT) & CSBNDS_SA) |
-                       (((base + size - 1) >> CSBNDS_EA_SHIFT) &
-                               CSBNDS_EA);
-       }
-       SYNC;
-}
-
-/**************************************************************************
- * Sets DDR banks CS configuration.
- * config == 0x00000000 disables the CS.
- */
-static void set_cs_config(short cs, long config)
-{
-       debug("Setting config %08x for cs %d\n", config, cs);
-       im->ddr.cs_config[cs] = config;
-       SYNC;
-}
-
-/**************************************************************************
- * Sets DDR clocks, timings and configuration.
- */
-static void set_ddr_config(void) {
-       /* clock control */
-       im->ddr.sdram_clk_cntl = DDR_SDRAM_CLK_CNTL_SS_EN |
-               DDR_SDRAM_CLK_CNTL_CLK_ADJUST_05;
-       SYNC;
-
-       /* timing configuration */
-       im->ddr.timing_cfg_1 =
-               (4 << TIMING_CFG1_PRETOACT_SHIFT) |
-               (7 << TIMING_CFG1_ACTTOPRE_SHIFT) |
-               (4 << TIMING_CFG1_ACTTORW_SHIFT)  |
-               (5 << TIMING_CFG1_REFREC_SHIFT)   |
-               (3 << TIMING_CFG1_WRREC_SHIFT)    |
-               (3 << TIMING_CFG1_ACTTOACT_SHIFT) |
-               (1 << TIMING_CFG1_WRTORD_SHIFT)   |
-               (TIMING_CFG1_CASLAT & TIMING_CASLAT);
-
-       im->ddr.timing_cfg_2 =
-               TIMING_CFG2_CPO_DEF |
-               (2 << TIMING_CFG2_WR_DATA_DELAY_SHIFT);
-       SYNC;
-
-       /* don't enable DDR controller yet */
-       im->ddr.sdram_cfg =
-               SDRAM_CFG_SREN |
-               SDRAM_CFG_SDRAM_TYPE_DDR1;
-       SYNC;
-
-       /* Set SDRAM mode */
-       im->ddr.sdram_mode =
-               ((DDR_MODE_EXT_MODEREG | DDR_MODE_WEAK) <<
-                       SDRAM_MODE_ESD_SHIFT) |
-               ((DDR_MODE_MODEREG | DDR_MODE_BLEN_4) <<
-                       SDRAM_MODE_SD_SHIFT) |
-               ((DDR_MODE_CASLAT << SDRAM_MODE_SD_SHIFT) &
-                       MODE_CASLAT);
-       SYNC;
-
-       /* Set fast SDRAM refresh rate */
-       im->ddr.sdram_interval =
-               (DDR_REFINT_166MHZ_7US << SDRAM_INTERVAL_REFINT_SHIFT) |
-               (DDR_BSTOPRE << SDRAM_INTERVAL_BSTOPRE_SHIFT);
-       SYNC;
-
-       /* Workaround for DDR6 Erratum
-        * see MPC8349E Device Errata Rev.8, 2/2006
-        * This workaround influences the MPC internal "input enables"
-        * dependent on CAS latency and MPC revision. According to errata
-        * sheet the internal reserved registers for this workaround are
-        * not available from revision 2.0 and up.
-        */
-
-       /* Get REVID from register SPRIDR. Skip workaround if rev >= 2.0
-        * (0x200)
-        */
-       if ((im->sysconf.spridr & SPRIDR_REVID) < 0x200) {
-
-               /* There is a internal reserved register at IMMRBAR+0x2F00
-                * which has to be written with a certain value defined by
-                * errata sheet.
-                */
-               u32 *reserved_p = (u32 *)((u8 *)im + 0x2f00);
-
-#if defined(DDR_CASLAT_20)
-               *reserved_p = 0x201c0000;
-#else
-               *reserved_p = 0x202c0000;
-#endif
-       }
-}
diff --git a/board/tqm85xx/Makefile b/board/tqm85xx/Makefile
deleted file mode 100644 (file)
index 52f5ef9..0000000
+++ /dev/null
@@ -1,50 +0,0 @@
-#
-# (C) Copyright 2001-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 law.o tlb.o
-
-SRCS   := $(SOBJS:.o=.S) $(COBJS:.o=.c)
-OBJS   := $(addprefix $(obj),$(COBJS))
-SOBJS  := $(addprefix $(obj),$(SOBJS))
-
-$(LIB):        $(obj).depend $(OBJS) $(SOBJS)
-       $(AR) $(ARFLAGS) $@ $(OBJS)
-
-clean:
-       rm -f $(OBJS) $(SOBJS)
-
-distclean:     clean
-       rm -f $(LIB) core *.bak .depend
-
-#########################################################################
-
-# defines $(obj).depend target
-include $(SRCTREE)/rules.mk
-
-sinclude $(obj).depend
-
-#########################################################################
diff --git a/board/tqm85xx/config.mk b/board/tqm85xx/config.mk
deleted file mode 100644 (file)
index 52e84ad..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-# Copyright 2004 Freescale Semiconductor.
-# Modified by Xianghua Xiao, X.Xiao@motorola.com
-# (C) Copyright 2002,Motorola Inc.
-#
-# See file CREDITS for list of people who contributed to this
-# project.
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License as
-# published by the Free Software Foundation; either version 2 of
-# the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
-# MA 02111-1307 USA
-#
-
-#
-# tqm85xx board
-# default CCARBAR is at 0xff700000
-# assume U-Boot is less than 256k
-#
-TEXT_BASE = 0xfffc0000
diff --git a/board/tqm85xx/law.c b/board/tqm85xx/law.c
deleted file mode 100644 (file)
index 224af6c..0000000
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Copyright 2008 Freescale Semiconductor, Inc.
- *
- * (C) Copyright 2000
- * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-
-#include <common.h>
-#include <asm/fsl_law.h>
-#include <asm/mmu.h>
-
-/*
- * LAW(Local Access Window) configuration:
- *
- * 0x0000_0000    0x7fff_ffff     DDR                     2G
- * 0x8000_0000    0x9fff_ffff     PCI1 MEM                512M
- * 0xc000_0000    0xdfff_ffff     RapidIO                 512M
- * 0xe000_0000    0xe000_ffff     CCSR                    1M
- * 0xe200_0000    0xe2ff_ffff     PCI1 IO                 16M
- * 0xf800_0000    0xf80f_ffff     BCSR                    1M
- * 0xfe00_0000    0xffff_ffff     FLASH (boot bank)       32M
- *
- * Notes:
- *    CCSRBAR and L2-as-SRAM don't need a configured Local Access Window.
- *    If flash is 8M at default position (last 8M), no LAW needed.
- */
-
-struct law_entry law_table[] = {
-       SET_LAW_ENTRY(1, CFG_DDR_SDRAM_BASE, LAW_SIZE_512M, LAW_TRGT_IF_DDR),
-       SET_LAW_ENTRY(2, CFG_PCI1_MEM_PHYS, LAW_SIZE_512M, LAW_TRGT_IF_PCI),
-       SET_LAW_ENTRY(3, CFG_LBC_FLASH_BASE, LAW_SIZE_128M, LAW_TRGT_IF_LBC),
-       SET_LAW_ENTRY(4, CFG_PCI1_IO_PHYS, LAW_SIZE_16M, LAW_TRGT_IF_PCI),
-       SET_LAW_ENTRY(5, CFG_RIO_MEM_BASE, LAWAR_SIZE_512M, LAW_TRGT_IF_RIO),
-};
-
-int num_law_entries = ARRAY_SIZE(law_table);
diff --git a/board/tqm85xx/sdram.c b/board/tqm85xx/sdram.c
deleted file mode 100644 (file)
index 788a48c..0000000
+++ /dev/null
@@ -1,223 +0,0 @@
-/*
- * (C) Copyright 2005
- * 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 <asm/processor.h>
-#include <asm/immap_85xx.h>
-#include <asm/processor.h>
-#include <asm/mmu.h>
-
-struct sdram_conf_s {
-       unsigned long size;
-       unsigned long reg;
-};
-
-typedef struct sdram_conf_s sdram_conf_t;
-
-sdram_conf_t ddr_cs_conf[] = {
-       {(512 << 20), 0x80000202},      /* 512MB, 14x10(4)      */
-       {(256 << 20), 0x80000102},      /* 256MB, 13x10(4)      */
-       {(128 << 20), 0x80000101},      /* 128MB, 13x9(4)       */
-       {(64  << 20), 0x80000001},      /* 64MB,  12x9(4)       */
-};
-
-#define        N_DDR_CS_CONF (sizeof(ddr_cs_conf) / sizeof(ddr_cs_conf[0]))
-
-int cas_latency(void);
-
-/*
- * Autodetect onboard DDR SDRAM on 85xx platforms
- *
- * NOTE: Some of the hardcoded values are hardware dependant,
- *       so this should be extended for other future boards
- *       using this routine!
- */
-long int sdram_setup(int casl)
-{
-       int i;
-       volatile ccsr_ddr_t *ddr = (void *)(CFG_MPC85xx_DDR_ADDR);
-       unsigned long cfg_ddr_timing1;
-       unsigned long cfg_ddr_mode;
-
-       /*
-        * Disable memory controller.
-        */
-       ddr->cs0_config = 0;
-       ddr->sdram_cfg = 0;
-
-       switch (casl) {
-       case 20:
-               cfg_ddr_timing1 = 0x47405331 | (3 << 16);
-               cfg_ddr_mode = 0x40020002 | (2 << 4);
-               break;
-
-       case 25:
-               cfg_ddr_timing1 = 0x47405331 | (4 << 16);
-               cfg_ddr_mode = 0x40020002 | (6 << 4);
-               break;
-
-       case 30:
-       default:
-               cfg_ddr_timing1 = 0x47405331 | (5 << 16);
-               cfg_ddr_mode = 0x40020002 | (3 << 4);
-               break;
-       }
-
-       ddr->cs0_bnds = (ddr_cs_conf[0].size - 1) >> 24;
-       ddr->cs0_config = ddr_cs_conf[0].reg;
-       ddr->timing_cfg_1 = cfg_ddr_timing1;
-       ddr->timing_cfg_2 = 0x00000800;         /* P9-45,may need tuning */
-       ddr->sdram_mode = cfg_ddr_mode;
-       ddr->sdram_interval = 0x05160100;       /* autocharge,no open page */
-       ddr->err_disable = 0x0000000D;
-
-       asm ("sync;isync;msync");
-       udelay(1000);
-
-       ddr->sdram_cfg = 0xc2000000;            /* unbuffered,no DYN_PWR */
-       asm ("sync; isync; msync");
-       udelay(1000);
-
-       for (i=0; i<N_DDR_CS_CONF; i++) {
-               ddr->cs0_config = ddr_cs_conf[i].reg;
-
-               if (get_ram_size(0, ddr_cs_conf[i].size) == ddr_cs_conf[i].size) {
-                       /*
-                        * OK, size detected -> all done
-                        */
-                       return ddr_cs_conf[i].size;
-               }
-       }
-
-       return 0;                               /* nothing found !              */
-}
-
-void board_add_ram_info(int use_default)
-{
-       int casl;
-
-       if (use_default)
-               casl = CONFIG_DDR_DEFAULT_CL;
-       else
-               casl = cas_latency();
-
-       puts(" (CL=");
-       switch (casl) {
-       case 20:
-               puts("2)");
-               break;
-
-       case 25:
-               puts("2.5)");
-               break;
-
-       case 30:
-               puts("3)");
-               break;
-       }
-}
-
-long int initdram (int board_type)
-{
-       long dram_size = 0;
-       int casl;
-
-#if defined(CONFIG_DDR_DLL)
-       /*
-        * This DLL-Override only used on TQM8540 and TQM8560
-        */
-       {
-               volatile ccsr_gur_t *gur = (void *)(CFG_MPC85xx_GUTS_ADDR);
-               int i,x;
-
-               x = 10;
-
-               /*
-                * Work around to stabilize DDR DLL
-                */
-               gur->ddrdllcr = 0x81000000;
-               asm("sync;isync;msync");
-               udelay (200);
-               while (gur->ddrdllcr != 0x81000100) {
-                       gur->devdisr = gur->devdisr | 0x00010000;
-                       asm("sync;isync;msync");
-                       for (i=0; i<x; i++)
-                               ;
-                       gur->devdisr = gur->devdisr & 0xfff7ffff;
-                       asm("sync;isync;msync");
-                       x++;
-               }
-       }
-#endif
-
-       casl = cas_latency();
-       dram_size = sdram_setup(casl);
-       if ((dram_size == 0) && (casl != CONFIG_DDR_DEFAULT_CL)) {
-               /*
-                * Try again with default CAS latency
-                */
-               puts("Problem with CAS lantency");
-               board_add_ram_info(1);
-               puts(", using default CL!\n");
-               casl = CONFIG_DDR_DEFAULT_CL;
-               dram_size = sdram_setup(casl);
-               puts("       ");
-       }
-
-       return dram_size;
-}
-
-#if defined(CFG_DRAM_TEST)
-int testdram (void)
-{
-       uint *pstart = (uint *) CFG_MEMTEST_START;
-       uint *pend = (uint *) CFG_MEMTEST_END;
-       uint *p;
-
-       printf ("SDRAM test phase 1:\n");
-       for (p = pstart; p < pend; p++)
-               *p = 0xaaaaaaaa;
-
-       for (p = pstart; p < pend; p++) {
-               if (*p != 0xaaaaaaaa) {
-                       printf ("SDRAM test fails at: %08x\n", (uint) p);
-                       return 1;
-               }
-       }
-
-       printf ("SDRAM test phase 2:\n");
-       for (p = pstart; p < pend; p++)
-               *p = 0x55555555;
-
-       for (p = pstart; p < pend; p++) {
-               if (*p != 0x55555555) {
-                       printf ("SDRAM test fails at: %08x\n", (uint) p);
-                       return 1;
-               }
-       }
-
-       printf ("SDRAM test passed.\n");
-       return 0;
-}
-#endif
diff --git a/board/tqm85xx/tlb.c b/board/tqm85xx/tlb.c
deleted file mode 100644 (file)
index ad26cae..0000000
+++ /dev/null
@@ -1,114 +0,0 @@
-/*
- * Copyright 2008 Freescale Semiconductor, Inc.
- *
- * (C) Copyright 2000
- * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-
-#include <common.h>
-#include <asm/mmu.h>
-
-struct fsl_e_tlb_entry tlb_table[] = {
-       /* TLB 0 - for temp stack in cache */
-       SET_TLB_ENTRY(0, CFG_INIT_RAM_ADDR, CFG_INIT_RAM_ADDR,
-                     MAS3_SX|MAS3_SW|MAS3_SR, 0,
-                     0, 0, BOOKE_PAGESZ_4K, 0),
-       SET_TLB_ENTRY(0, CFG_INIT_RAM_ADDR + 4 * 1024 , CFG_INIT_RAM_ADDR + 4 * 1024,
-                     MAS3_SX|MAS3_SW|MAS3_SR, 0,
-                     0, 0, BOOKE_PAGESZ_4K, 0),
-       SET_TLB_ENTRY(0, CFG_INIT_RAM_ADDR + 8 * 1024 , CFG_INIT_RAM_ADDR + 8 * 1024,
-                     MAS3_SX|MAS3_SW|MAS3_SR, 0,
-                     0, 0, BOOKE_PAGESZ_4K, 0),
-       SET_TLB_ENTRY(0, CFG_INIT_RAM_ADDR + 12 * 1024 , CFG_INIT_RAM_ADDR + 12 * 1024,
-                     MAS3_SX|MAS3_SW|MAS3_SR, 0,
-                     0, 0, BOOKE_PAGESZ_4K, 0),
-
-
-       /*
-        * TLB 0, 1:    128M    Non-cacheable, guarded
-        * 0xf8000000   128M    FLASH
-        * Out of reset this entry is only 4K.
-        */
-       SET_TLB_ENTRY(1, CFG_FLASH_BASE, CFG_FLASH_BASE,
-                     MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
-                     0, 1, BOOKE_PAGESZ_64M, 1),
-       SET_TLB_ENTRY(1, CFG_FLASH_BASE + 0x4000000, CFG_FLASH_BASE + 0x4000000,
-                     MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
-                     0, 0, BOOKE_PAGESZ_64M, 1),
-
-       /*
-        * TLB 2:       256M    Non-cacheable, guarded
-        * 0x80000000   256M    PCI1 MEM First half
-        */
-       SET_TLB_ENTRY(1, CFG_PCI1_MEM_PHYS, CFG_PCI1_MEM_PHYS,
-                     MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
-                     0, 2, BOOKE_PAGESZ_256M, 1),
-
-       /*
-        * TLB 3:       256M    Non-cacheable, guarded
-        * 0x90000000   256M    PCI1 MEM Second half
-        */
-       SET_TLB_ENTRY(1, CFG_PCI1_MEM_PHYS + 0x10000000, CFG_PCI1_MEM_PHYS + 0x10000000,
-                     MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
-                     0, 3, BOOKE_PAGESZ_256M, 1),
-
-       /*
-        * TLB 4:       256M    Non-cacheable, guarded
-        * 0xc0000000   256M    Rapid IO MEM First half
-        */
-       SET_TLB_ENTRY(1, CFG_RIO_MEM_BASE, CFG_RIO_MEM_BASE,
-                     MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
-                     0, 4, BOOKE_PAGESZ_256M, 1),
-
-       /*
-        * TLB 5:       256M    Non-cacheable, guarded
-        * 0xd0000000   256M    Rapid IO MEM Second half
-        */
-       SET_TLB_ENTRY(1, CFG_RIO_MEM_BASE + 0x10000000, CFG_RIO_MEM_BASE + 0x10000000,
-                     MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
-                     0, 5, BOOKE_PAGESZ_256M, 1),
-
-       /*
-        * TLB 6:       64M     Non-cacheable, guarded
-        * 0xe000_0000  1M      CCSRBAR
-        * 0xe200_0000  16M     PCI1 IO
-        */
-       SET_TLB_ENTRY(1, CFG_CCSRBAR, CFG_CCSRBAR_PHYS,
-                     MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
-                     0, 6, BOOKE_PAGESZ_64M, 1),
-
-       /*
-        * TLB 7+8:     512M    DDR, cache disabled (needed for memory test)
-        * 0x00000000  512M     DDR System memory
-        * Without SPD EEPROM configured DDR, this must be setup manually.
-        * Make sure the TLB count at the top of this table is correct.
-        * Likely it needs to be increased by two for these entries.
-        */
-       SET_TLB_ENTRY(1, CFG_DDR_SDRAM_BASE, CFG_DDR_SDRAM_BASE,
-                     MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
-                     0, 7, BOOKE_PAGESZ_256M, 1),
-
-       SET_TLB_ENTRY(1, CFG_DDR_SDRAM_BASE + 0x10000000, CFG_DDR_SDRAM_BASE + 0x10000000,
-                     MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
-                     0, 8, BOOKE_PAGESZ_256M, 1),
-};
-
-int num_tlb_entries = ARRAY_SIZE(tlb_table);
diff --git a/board/tqm85xx/tqm85xx.c b/board/tqm85xx/tqm85xx.c
deleted file mode 100644 (file)
index 8fa0162..0000000
+++ /dev/null
@@ -1,419 +0,0 @@
-/*
- * (C) Copyright 2005
- * Stefan Roese, DENX Software Engineering, sr@denx.de.
- *
- * Copyright 2004 Freescale Semiconductor.
- * (C) Copyright 2002,2003, Motorola Inc.
- * Xianghua Xiao, (X.Xiao@motorola.com)
- *
- * (C) Copyright 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 <common.h>
-#include <pci.h>
-#include <asm/processor.h>
-#include <asm/immap_85xx.h>
-#include <ioports.h>
-#include <flash.h>
-
-DECLARE_GLOBAL_DATA_PTR;
-
-extern flash_info_t flash_info[];      /* FLASH chips info */
-
-void local_bus_init (void);
-ulong flash_get_size (ulong base, int banknum);
-
-#ifdef CONFIG_PS2MULT
-void ps2mult_early_init(void);
-#endif
-
-#ifdef CONFIG_CPM2
-/*
- * I/O Port configuration table
- *
- * if conf is 1, then that port pin will be configured at boot time
- * according to the five values podr/pdir/ppar/psor/pdat for that entry
- */
-
-const iop_conf_t iop_conf_tab[4][32] = {
-
-    /* Port A configuration */
-    {   /*            conf ppar psor pdir podr pdat */
-       /* PA31 */ {   1,   1,   1,   0,   0,   0   }, /* FCC1 MII COL */
-       /* PA30 */ {   1,   1,   1,   0,   0,   0   }, /* FCC1 MII CRS */
-       /* PA29 */ {   1,   1,   1,   1,   0,   0   }, /* FCC1 MII TX_ER */
-       /* PA28 */ {   1,   1,   1,   1,   0,   0   }, /* FCC1 MII TX_EN */
-       /* PA27 */ {   1,   1,   1,   0,   0,   0   }, /* FCC1 MII RX_DV */
-       /* PA26 */ {   1,   1,   1,   0,   0,   0   }, /* FCC1 MII RX_ER */
-       /* PA25 */ {   0,   1,   0,   1,   0,   0   }, /* FCC1 ATMTXD[0] */
-       /* PA24 */ {   0,   1,   0,   1,   0,   0   }, /* FCC1 ATMTXD[1] */
-       /* PA23 */ {   0,   1,   0,   1,   0,   0   }, /* FCC1 ATMTXD[2] */
-       /* PA22 */ {   0,   1,   0,   1,   0,   0   }, /* FCC1 ATMTXD[3] */
-       /* PA21 */ {   1,   1,   0,   1,   0,   0   }, /* FCC1 MII TxD[3] */
-       /* PA20 */ {   1,   1,   0,   1,   0,   0   }, /* FCC1 MII TxD[2] */
-       /* PA19 */ {   1,   1,   0,   1,   0,   0   }, /* FCC1 MII TxD[1] */
-       /* PA18 */ {   1,   1,   0,   1,   0,   0   }, /* FCC1 MII TxD[0] */
-       /* PA17 */ {   1,   1,   0,   0,   0,   0   }, /* FCC1 MII RxD[0] */
-       /* PA16 */ {   1,   1,   0,   0,   0,   0   }, /* FCC1 MII RxD[1] */
-       /* PA15 */ {   1,   1,   0,   0,   0,   0   }, /* FCC1 MII RxD[2] */
-       /* PA14 */ {   1,   1,   0,   0,   0,   0   }, /* FCC1 MII RxD[3] */
-       /* PA13 */ {   0,   1,   0,   0,   0,   0   }, /* FCC1 ATMRXD[3] */
-       /* PA12 */ {   0,   1,   0,   0,   0,   0   }, /* FCC1 ATMRXD[2] */
-       /* PA11 */ {   0,   1,   0,   0,   0,   0   }, /* FCC1 ATMRXD[1] */
-       /* PA10 */ {   0,   1,   0,   0,   0,   0   }, /* FCC1 ATMRXD[0] */
-       /* PA9  */ {   0,   1,   1,   1,   0,   0   }, /* FCC1 L1TXD */
-       /* PA8  */ {   0,   1,   1,   0,   0,   0   }, /* FCC1 L1RXD */
-       /* PA7  */ {   0,   0,   0,   1,   0,   0   }, /* PA7 */
-       /* PA6  */ {   0,   1,   1,   1,   0,   0   }, /* TDM A1 L1RSYNC */
-       /* PA5  */ {   0,   0,   0,   1,   0,   0   }, /* PA5 */
-       /* PA4  */ {   0,   0,   0,   1,   0,   0   }, /* PA4 */
-       /* PA3  */ {   0,   0,   0,   1,   0,   0   }, /* PA3 */
-       /* PA2  */ {   0,   0,   0,   1,   0,   0   }, /* PA2 */
-       /* PA1  */ {   0,   0,   0,   0,   0,   0   }, /* FREERUN */
-       /* PA0  */ {   0,   0,   0,   1,   0,   0   }  /* PA0 */
-    },
-
-    /* Port B configuration */
-    {   /*            conf ppar psor pdir podr pdat */
-       /* PB31 */ {   1,   1,   0,   1,   0,   0   }, /* FCC2 MII TX_ER */
-       /* PB30 */ {   1,   1,   0,   0,   0,   0   }, /* FCC2 MII RX_DV */
-       /* PB29 */ {   1,   1,   1,   1,   0,   0   }, /* FCC2 MII TX_EN */
-       /* PB28 */ {   1,   1,   0,   0,   0,   0   }, /* FCC2 MII RX_ER */
-       /* PB27 */ {   1,   1,   0,   0,   0,   0   }, /* FCC2 MII COL */
-       /* PB26 */ {   1,   1,   0,   0,   0,   0   }, /* FCC2 MII CRS */
-       /* PB25 */ {   1,   1,   0,   1,   0,   0   }, /* FCC2 MII TxD[3] */
-       /* PB24 */ {   1,   1,   0,   1,   0,   0   }, /* FCC2 MII TxD[2] */
-       /* PB23 */ {   1,   1,   0,   1,   0,   0   }, /* FCC2 MII TxD[1] */
-       /* PB22 */ {   1,   1,   0,   1,   0,   0   }, /* FCC2 MII TxD[0] */
-       /* PB21 */ {   1,   1,   0,   0,   0,   0   }, /* FCC2 MII RxD[0] */
-       /* PB20 */ {   1,   1,   0,   0,   0,   0   }, /* FCC2 MII RxD[1] */
-       /* PB19 */ {   1,   1,   0,   0,   0,   0   }, /* FCC2 MII RxD[2] */
-       /* PB18 */ {   1,   1,   0,   0,   0,   0   }, /* FCC2 MII RxD[3] */
-       /* PB17 */ {   1,   1,   0,   0,   0,   0   }, /* FCC3:RX_DIV */
-       /* PB16 */ {   1,   1,   0,   0,   0,   0   }, /* FCC3:RX_ERR */
-       /* PB15 */ {   1,   1,   0,   1,   0,   0   }, /* FCC3:TX_ERR */
-       /* PB14 */ {   1,   1,   0,   1,   0,   0   }, /* FCC3:TX_EN */
-       /* PB13 */ {   1,   1,   0,   0,   0,   0   }, /* FCC3:COL */
-       /* PB12 */ {   1,   1,   0,   0,   0,   0   }, /* FCC3:CRS */
-       /* PB11 */ {   1,   1,   0,   0,   0,   0   }, /* FCC3:RXD */
-       /* PB10 */ {   1,   1,   0,   0,   0,   0   }, /* FCC3:RXD */
-       /* PB9  */ {   1,   1,   0,   0,   0,   0   }, /* FCC3:RXD */
-       /* PB8  */ {   1,   1,   0,   0,   0,   0   }, /* FCC3:RXD */
-       /* PB7  */ {   1,   1,   0,   1,   0,   0   }, /* FCC3:TXD */
-       /* PB6  */ {   1,   1,   0,   1,   0,   0   }, /* FCC3:TXD */
-       /* PB5  */ {   1,   1,   0,   1,   0,   0   }, /* FCC3:TXD */
-       /* PB4  */ {   1,   1,   0,   1,   0,   0   }, /* FCC3:TXD */
-       /* PB3  */ {   0,   0,   0,   0,   0,   0   }, /* pin doesn't exist */
-       /* PB2  */ {   0,   0,   0,   0,   0,   0   }, /* pin doesn't exist */
-       /* PB1  */ {   0,   0,   0,   0,   0,   0   }, /* pin doesn't exist */
-       /* PB0  */ {   0,   0,   0,   0,   0,   0   }  /* pin doesn't exist */
-    },
-
-    /* Port C */
-    {   /*            conf ppar psor pdir podr pdat */
-       /* PC31 */ {   0,   0,   0,   1,   0,   0   }, /* PC31 */
-       /* PC30 */ {   0,   0,   0,   1,   0,   0   }, /* PC30 */
-       /* PC29 */ {   0,   1,   1,   0,   0,   0   }, /* SCC1 EN *CLSN */
-       /* PC28 */ {   0,   0,   0,   1,   0,   0   }, /* PC28 */
-       /* PC27 */ {   0,   0,   0,   1,   0,   0   }, /* UART Clock in */
-       /* PC26 */ {   0,   0,   0,   1,   0,   0   }, /* PC26 */
-       /* PC25 */ {   0,   0,   0,   1,   0,   0   }, /* PC25 */
-       /* PC24 */ {   0,   0,   0,   1,   0,   0   }, /* PC24 */
-       /* PC23 */ {   0,   1,   0,   1,   0,   0   }, /* ATMTFCLK */
-       /* PC22 */ {   0,   1,   0,   0,   0,   0   }, /* ATMRFCLK */
-       /* PC21 */ {   1,   1,   0,   0,   0,   0   }, /* SCC1 EN RXCLK */
-       /* PC20 */ {   1,   1,   0,   0,   0,   0   }, /* SCC1 EN TXCLK */
-       /* PC19 */ {   1,   1,   0,   0,   0,   0   }, /* FCC2 MII RX_CLK CLK13 */
-       /* PC18 */ {   1,   1,   0,   0,   0,   0   }, /* FCC Tx Clock (CLK14) */
-       /* PC17 */ {   1,   1,   0,   0,   0,   0   }, /* PC17 */
-       /* PC16 */ {   1,   1,   0,   0,   0,   0   }, /* FCC Tx Clock (CLK16) */
-       /* PC15 */ {   0,   1,   0,   0,   0,   0   }, /* PC15 */
-       /* PC14 */ {   0,   1,   0,   0,   0,   0   }, /* SCC1 EN *CD */
-       /* PC13 */ {   0,   1,   0,   0,   0,   0   }, /* PC13 */
-       /* PC12 */ {   0,   1,   0,   1,   0,   0   }, /* PC12 */
-       /* PC11 */ {   0,   0,   0,   1,   0,   0   }, /* LXT971 transmit control */
-       /* PC10 */ {   0,   0,   0,   1,   0,   0   }, /* FETHMDC */
-       /* PC9  */ {   0,   0,   0,   0,   0,   0   }, /* FETHMDIO */
-       /* PC8  */ {   0,   0,   0,   1,   0,   0   }, /* PC8 */
-       /* PC7  */ {   0,   0,   0,   1,   0,   0   }, /* PC7 */
-       /* PC6  */ {   0,   0,   0,   1,   0,   0   }, /* PC6 */
-       /* PC5  */ {   0,   0,   0,   1,   0,   0   }, /* PC5 */
-       /* PC4  */ {   0,   0,   0,   1,   0,   0   }, /* PC4 */
-       /* PC3  */ {   0,   0,   0,   1,   0,   0   }, /* PC3 */
-       /* PC2  */ {   0,   0,   0,   1,   0,   1   }, /* ENET FDE */
-       /* PC1  */ {   0,   0,   0,   1,   0,   0   }, /* ENET DSQE */
-       /* PC0  */ {   0,   0,   0,   1,   0,   0   }, /* ENET LBK */
-    },
-
-    /* Port D */
-    {   /*            conf ppar psor pdir podr pdat */
-       /* PD31 */ {   1,   1,   0,   0,   0,   0   }, /* SCC1 EN RxD */
-       /* PD30 */ {   1,   1,   1,   1,   0,   0   }, /* SCC1 EN TxD */
-       /* PD29 */ {   1,   1,   0,   1,   0,   0   }, /* SCC1 EN TENA */
-       /* PD28 */ {   1,   1,   0,   0,   0,   0   }, /* PD28 */
-       /* PD27 */ {   1,   1,   0,   1,   0,   0   }, /* PD27 */
-       /* PD26 */ {   1,   1,   0,   1,   0,   0   }, /* PD26 */
-       /* PD25 */ {   0,   0,   0,   1,   0,   0   }, /* PD25 */
-       /* PD24 */ {   0,   0,   0,   1,   0,   0   }, /* PD24 */
-       /* PD23 */ {   0,   0,   0,   1,   0,   0   }, /* PD23 */
-       /* PD22 */ {   0,   0,   0,   1,   0,   0   }, /* PD22 */
-       /* PD21 */ {   0,   0,   0,   1,   0,   0   }, /* PD21 */
-       /* PD20 */ {   0,   0,   0,   1,   0,   0   }, /* PD20 */
-       /* PD19 */ {   0,   0,   0,   1,   0,   0   }, /* PD19 */
-       /* PD18 */ {   0,   0,   0,   1,   0,   0   }, /* PD18 */
-       /* PD17 */ {   0,   1,   0,   0,   0,   0   }, /* FCC1 ATMRXPRTY */
-       /* PD16 */ {   0,   1,   0,   1,   0,   0   }, /* FCC1 ATMTXPRTY */
-       /* PD15 */ {   0,   1,   1,   0,   1,   0   }, /* I2C SDA */
-       /* PD14 */ {   0,   0,   0,   1,   0,   0   }, /* LED */
-       /* PD13 */ {   0,   0,   0,   0,   0,   0   }, /* PD13 */
-       /* PD12 */ {   0,   0,   0,   0,   0,   0   }, /* PD12 */
-       /* PD11 */ {   0,   0,   0,   0,   0,   0   }, /* PD11 */
-       /* PD10 */ {   0,   0,   0,   0,   0,   0   }, /* PD10 */
-       /* PD9  */ {   0,   1,   0,   1,   0,   0   }, /* SMC1 TXD */
-       /* PD8  */ {   0,   1,   0,   0,   0,   0   }, /* SMC1 RXD */
-       /* PD7  */ {   0,   0,   0,   1,   0,   1   }, /* PD7 */
-       /* PD6  */ {   0,   0,   0,   1,   0,   1   }, /* PD6 */
-       /* PD5  */ {   0,   0,   0,   1,   0,   1   }, /* PD5 */
-       /* PD4  */ {   0,   0,   0,   1,   0,   1   }, /* PD4 */
-       /* PD3  */ {   0,   0,   0,   0,   0,   0   }, /* pin doesn't exist */
-       /* PD2  */ {   0,   0,   0,   0,   0,   0   }, /* pin doesn't exist */
-       /* PD1  */ {   0,   0,   0,   0,   0,   0   }, /* pin doesn't exist */
-       /* PD0  */ {   0,   0,   0,   0,   0,   0   }  /* pin doesn't exist */
-    }
-};
-#endif /*  CONFIG_CPM2 */
-
-#define CASL_STRING1   "casl=xx"
-#define CASL_STRING2   "casl="
-
-static const int casl_table[] = { 20, 25, 30 };
-#define        N_CASL (sizeof(casl_table) / sizeof(casl_table[0]))
-
-int cas_latency(void)
-{
-       char *s = getenv("serial#");
-       int casl;
-       int val;
-       int i;
-
-       casl = CONFIG_DDR_DEFAULT_CL;
-
-       if (s != NULL) {
-               if (strncmp(s + strlen(s) - strlen(CASL_STRING1), CASL_STRING2,
-                           strlen(CASL_STRING2)) == 0) {
-                       val = simple_strtoul(s + strlen(s) - 2, NULL, 10);
-
-                       for (i=0; i<N_CASL; ++i) {
-                               if (val == casl_table[i]) {
-                                       return val;
-                               }
-                       }
-               }
-       }
-
-       return casl;
-}
-
-int checkboard (void)
-{
-       char *s = getenv("serial#");
-
-       printf("Board: %s", CONFIG_BOARDNAME);
-       if (s != NULL) {
-               puts(", serial# ");
-               puts(s);
-       }
-       putc('\n');
-
-#ifdef CONFIG_PCI
-       printf ("PCI1:  32 bit, %d MHz (compiled)\n",
-               CONFIG_SYS_CLK_FREQ / 1000000);
-#else
-       printf ("PCI1:  disabled\n");
-#endif
-
-       /*
-        * Initialize local bus.
-        */
-       local_bus_init ();
-
-       return 0;
-}
-
-int misc_init_r (void)
-{
-       volatile ccsr_lbc_t *memctl = (void *)(CFG_MPC85xx_LBC_ADDR);
-
-       /*
-        * Adjust flash start and offset to detected values
-        */
-       gd->bd->bi_flashstart = 0 - gd->bd->bi_flashsize;
-       gd->bd->bi_flashoffset = 0;
-
-       /*
-        * Check if boot FLASH isn't max size
-        */
-       if (gd->bd->bi_flashsize < (0 - CFG_FLASH0)) {
-               memctl->or0 = gd->bd->bi_flashstart | (CFG_OR0_PRELIM & 0x00007fff);
-               memctl->br0 = gd->bd->bi_flashstart | (CFG_BR0_PRELIM & 0x00007fff);
-
-               /*
-                * Re-check to get correct base address
-                */
-               flash_get_size(gd->bd->bi_flashstart, CFG_MAX_FLASH_BANKS - 1);
-       }
-
-       /*
-        * Check if only one FLASH bank is available
-        */
-       if (gd->bd->bi_flashsize != CFG_MAX_FLASH_BANKS * (0 - CFG_FLASH0)) {
-               memctl->or1 = 0;
-               memctl->br1 = 0;
-
-               /*
-                * Re-do flash protection upon new addresses
-                */
-               flash_protect (FLAG_PROTECT_CLEAR,
-                              gd->bd->bi_flashstart, 0xffffffff,
-                              &flash_info[CFG_MAX_FLASH_BANKS - 1]);
-
-               /* Monitor protection ON by default */
-               flash_protect (FLAG_PROTECT_SET,
-                              CFG_MONITOR_BASE, CFG_MONITOR_BASE + monitor_flash_len - 1,
-                              &flash_info[CFG_MAX_FLASH_BANKS - 1]);
-
-               /* Environment protection ON by default */
-               flash_protect (FLAG_PROTECT_SET,
-                              CFG_ENV_ADDR,
-                              CFG_ENV_ADDR + CFG_ENV_SECT_SIZE - 1,
-                              &flash_info[CFG_MAX_FLASH_BANKS - 1]);
-
-               /* Redundant environment protection ON by default */
-               flash_protect (FLAG_PROTECT_SET,
-                              CFG_ENV_ADDR_REDUND,
-                              CFG_ENV_ADDR_REDUND + CFG_ENV_SIZE_REDUND - 1,
-                              &flash_info[CFG_MAX_FLASH_BANKS - 1]);
-       }
-
-       return 0;
-}
-
-/*
- * Initialize Local Bus
- */
-void local_bus_init (void)
-{
-       volatile ccsr_gur_t *gur = (void *)(CFG_MPC85xx_GUTS_ADDR);
-       volatile ccsr_lbc_t *lbc = (void *)(CFG_MPC85xx_LBC_ADDR);
-
-       uint clkdiv;
-       uint lbc_hz;
-       sys_info_t sysinfo;
-
-       /*
-        * Errata LBC11.
-        * Fix Local Bus clock glitch when DLL is enabled.
-        *
-        * If localbus freq is < 66Mhz, DLL bypass mode must be used.
-        * If localbus freq is > 133Mhz, DLL can be safely enabled.
-        * Between 66 and 133, the DLL is enabled with an override workaround.
-        */
-
-       get_sys_info (&sysinfo);
-       clkdiv = lbc->lcrr & 0x0f;
-       lbc_hz = sysinfo.freqSystemBus / 1000000 / clkdiv;
-
-       if (lbc_hz < 66) {
-               lbc->lcrr = CFG_LBC_LCRR | 0x80000000;  /* DLL Bypass */
-               lbc->ltedr = 0xa4c80000;        /* DK: !!! */
-
-       } else if (lbc_hz >= 133) {
-               lbc->lcrr = CFG_LBC_LCRR & (~0x80000000);       /* DLL Enabled */
-
-       } else {
-               /*
-                * On REV1 boards, need to change CLKDIV before enable DLL.
-                * Default CLKDIV is 8, change it to 4 temporarily.
-                */
-               uint pvr = get_pvr ();
-               uint temp_lbcdll = 0;
-
-               if (pvr == PVR_85xx_REV1) {
-                       /* FIXME: Justify the high bit here. */
-                       lbc->lcrr = 0x10000004;
-               }
-
-               lbc->lcrr = CFG_LBC_LCRR & (~0x80000000);       /* DLL Enabled */
-               udelay (200);
-
-               /*
-                * Sample LBC DLL ctrl reg, upshift it to set the
-                * override bits.
-                */
-               temp_lbcdll = gur->lbcdllcr;
-               gur->lbcdllcr = (((temp_lbcdll & 0xff) << 16) | 0x80000000);
-               asm ("sync;isync;msync");
-       }
-}
-
-#if defined(CONFIG_PCI)
-/*
- * Initialize PCI Devices, report devices found.
- */
-
-#ifndef CONFIG_PCI_PNP
-static struct pci_config_table pci_mpc85xxads_config_table[] = {
-       {PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID,
-        PCI_IDSEL_NUMBER, PCI_ANY_ID,
-        pci_cfgfunc_config_device, {PCI_ENET0_IOADDR,
-                                    PCI_ENET0_MEMADDR,
-                                    PCI_COMMAND_MEMORY |
-                                    PCI_COMMAND_MASTER}},
-       {}
-};
-#endif
-
-
-static struct pci_controller hose = {
-#ifndef CONFIG_PCI_PNP
-       config_table:pci_mpc85xxads_config_table,
-#endif
-};
-
-#endif /* CONFIG_PCI */
-
-
-void pci_init_board (void)
-{
-#ifdef CONFIG_PCI
-       pci_mpc85xx_init (&hose);
-#endif /* CONFIG_PCI */
-}
-
-#ifdef CONFIG_BOARD_EARLY_INIT_R
-int board_early_init_r (void)
-{
-#ifdef CONFIG_PS2MULT
-       ps2mult_early_init();
-#endif /* CONFIG_PS2MULT */
-       return (0);
-}
-#endif /* CONFIG_BOARD_EARLY_INIT_R */
diff --git a/board/tqm85xx/u-boot.lds b/board/tqm85xx/u-boot.lds
deleted file mode 100644 (file)
index 8cb551a..0000000
+++ /dev/null
@@ -1,147 +0,0 @@
-/*
- * (C) Copyright 2002,2003, Motorola,Inc.
- * Xianghua Xiao, X.Xiao@motorola.com.
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.         See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-
-OUTPUT_ARCH(powerpc)
-/* Do we need any of these for elf?
-   __DYNAMIC = 0;    */
-SECTIONS
-{
-  .resetvec 0xFFFFFFFC :
-  {
-    *(.resetvec)
-  } = 0xffff
-
-  .bootpg 0xFFFFF000 :
-  {
-    cpu/mpc85xx/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             :
-  {
-    cpu/mpc85xx/start.o (.text)
-    cpu/mpc85xx/traps.o (.text)
-    cpu/mpc85xx/interrupts.o (.text)
-    cpu/mpc85xx/cpu_init.o (.text)
-    cpu/mpc85xx/cpu.o (.text)
-    cpu/mpc85xx/speed.o (.text)
-    cpu/mpc85xx/pci.o (.text)
-    common/dlmalloc.o (.text)
-    lib_generic/crc32.o (.text)
-    lib_ppc/extable.o (.text)
-    lib_generic/zlib.o (.text)
-    *(.text)
-    *(.fixup)
-    *(.got1)
-   }
-    _etext = .;
-    PROVIDE (etext = .);
-    .rodata    :
-   {
-    *(.rodata)
-    *(.rodata1)
-    *(.rodata.str1.4)
-    *(.eh_frame)
-  }
-  .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 (NOLOAD)             :
-  {
-   *(.sbss) *(.scommon)
-   *(.dynbss)
-   *(.bss)
-   *(COMMON)
-  }
-  _end = . ;
-  PROVIDE (end = .);
-}
diff --git a/board/tqm8xx/Makefile b/board/tqm8xx/Makefile
deleted file mode 100644 (file)
index b48934b..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-#
-# (C) Copyright 2000-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 flash.o load_sernum_ethaddr.o
-
-SRCS   := $(SOBJS:.o=.S) $(COBJS:.o=.c)
-OBJS   := $(addprefix $(obj),$(COBJS))
-SOBJS  := $(addprefix $(obj),$(SOBJS))
-
-$(LIB):        $(obj).depend $(OBJS)
-       $(AR) $(ARFLAGS) $@ $(OBJS)
-
-#########################################################################
-
-# defines $(obj).depend target
-include $(SRCTREE)/rules.mk
-
-sinclude $(obj).depend
-
-#########################################################################
diff --git a/board/tqm8xx/config.mk b/board/tqm8xx/config.mk
deleted file mode 100644 (file)
index 9d6080b..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-#
-# (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
-#
-
-#
-# TQM8xxL boards
-#
-
-TEXT_BASE = 0x40000000
diff --git a/board/tqm8xx/flash.c b/board/tqm8xx/flash.c
deleted file mode 100644 (file)
index 4342ebc..0000000
+++ /dev/null
@@ -1,834 +0,0 @@
-/*
- * (C) Copyright 2000-2004
- * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-
-#if 0
-#define DEBUG
-#endif
-
-#include <common.h>
-#include <mpc8xx.h>
-#include <environment.h>
-
-#include <asm/processor.h>
-
-DECLARE_GLOBAL_DATA_PTR;
-
-#if !defined(CFG_FLASH_CFI_DRIVER) /* do not use if CFI driver is configured */
-
-#if defined(CONFIG_TQM8xxL) && !defined(CONFIG_TQM866M) \
-    && !defined(CONFIG_TQM885D)
-# ifndef CFG_OR_TIMING_FLASH_AT_50MHZ
-#  define CFG_OR_TIMING_FLASH_AT_50MHZ (OR_ACS_DIV1  | OR_TRLX | OR_CSNT_SAM | \
-                                        OR_SCY_2_CLK | OR_EHTR | OR_BI)
-# endif
-#endif /* CONFIG_TQM8xxL/M, !TQM866M, !TQM885D */
-
-#ifndef        CFG_ENV_ADDR
-#define CFG_ENV_ADDR   (CFG_FLASH_BASE + CFG_ENV_OFFSET)
-#endif
-
-flash_info_t   flash_info[CFG_MAX_FLASH_BANKS]; /* info for FLASH chips        */
-
-/*-----------------------------------------------------------------------
- * Functions
- */
-static ulong flash_get_size (vu_long *addr, flash_info_t *info);
-static int write_word (flash_info_t *info, ulong dest, ulong data);
-
-/*-----------------------------------------------------------------------
- */
-
-unsigned long flash_init (void)
-{
-       volatile immap_t     *immap  = (immap_t *)CFG_IMMR;
-       volatile memctl8xx_t *memctl = &immap->im_memctl;
-       unsigned long size_b0, size_b1;
-       int i;
-
-#ifdef CFG_OR_TIMING_FLASH_AT_50MHZ
-       int scy, trlx, flash_or_timing, clk_diff;
-
-       scy = (CFG_OR_TIMING_FLASH_AT_50MHZ & OR_SCY_MSK) >> 4;
-       if (CFG_OR_TIMING_FLASH_AT_50MHZ & OR_TRLX) {
-               trlx = OR_TRLX;
-               scy *= 2;
-       } else
-               trlx = 0;
-
-               /* We assume that each 10MHz of bus clock require 1-clk SCY
-                * adjustment.
-                */
-       clk_diff = (gd->bus_clk / 1000000) - 50;
-
-               /* We need proper rounding here. This is what the "+5" and "-5"
-                * are here for.
-                */
-       if (clk_diff >= 0)
-               scy += (clk_diff + 5) / 10;
-       else
-               scy += (clk_diff - 5) / 10;
-
-               /* For bus frequencies above 50MHz, we want to use relaxed timing
-                * (OR_TRLX).
-                */
-       if (gd->bus_clk >= 50000000)
-               trlx = OR_TRLX;
-       else
-               trlx = 0;
-
-       if (trlx)
-               scy /= 2;
-
-       if (scy > 0xf)
-               scy = 0xf;
-       if (scy < 1)
-               scy = 1;
-
-       flash_or_timing = (scy << 4) | trlx |
-                         (CFG_OR_TIMING_FLASH_AT_50MHZ & ~(OR_TRLX | OR_SCY_MSK));
-#endif
-       /* Init: no FLASHes known */
-       for (i=0; i<CFG_MAX_FLASH_BANKS; ++i) {
-               flash_info[i].flash_id = FLASH_UNKNOWN;
-       }
-
-       /* Static FLASH Bank configuration here - FIXME XXX */
-
-       debug ("\n## Get flash bank 1 size @ 0x%08x\n",FLASH_BASE0_PRELIM);
-
-       size_b0 = flash_get_size((vu_long *)FLASH_BASE0_PRELIM, &flash_info[0]);
-
-       debug ("## Get flash bank 2 size @ 0x%08x\n",FLASH_BASE1_PRELIM);
-
-       if (flash_info[0].flash_id == FLASH_UNKNOWN) {
-               printf ("## Unknown FLASH on Bank 0 - Size = 0x%08lx = %ld MB\n",
-                       size_b0, size_b0<<20);
-       }
-
-       size_b1 = flash_get_size((vu_long *)FLASH_BASE1_PRELIM, &flash_info[1]);
-
-       debug ("## Prelim. Flash bank sizes: %08lx + 0x%08lx\n",size_b0,size_b1);
-
-       if (size_b1 > size_b0) {
-               printf ("## ERROR: "
-                       "Bank 1 (0x%08lx = %ld MB) > Bank 0 (0x%08lx = %ld MB)\n",
-                       size_b1, size_b1<<20,
-                       size_b0, size_b0<<20
-               );
-               flash_info[0].flash_id  = FLASH_UNKNOWN;
-               flash_info[1].flash_id  = FLASH_UNKNOWN;
-               flash_info[0].sector_count      = -1;
-               flash_info[1].sector_count      = -1;
-               flash_info[0].size              = 0;
-               flash_info[1].size              = 0;
-               return (0);
-       }
-
-       debug  ("## Before remap: "
-               "BR0: 0x%08x    OR0: 0x%08x    "
-               "BR1: 0x%08x    OR1: 0x%08x\n",
-               memctl->memc_br0, memctl->memc_or0,
-               memctl->memc_br1, memctl->memc_or1);
-
-       /* Remap FLASH according to real size */
-#ifndef        CFG_OR_TIMING_FLASH_AT_50MHZ
-       memctl->memc_or0 = CFG_OR_TIMING_FLASH | (-size_b0 & OR_AM_MSK);
-#else
-       memctl->memc_or0 = flash_or_timing | (-size_b0 & OR_AM_MSK);
-#endif
-       memctl->memc_br0 = (CFG_FLASH_BASE & BR_BA_MSK) | BR_MS_GPCM | BR_V;
-
-       debug ("## BR0: 0x%08x    OR0: 0x%08x\n",
-               memctl->memc_br0, memctl->memc_or0);
-
-       /* Re-do sizing to get full correct info */
-       size_b0 = flash_get_size((vu_long *)CFG_FLASH_BASE, &flash_info[0]);
-
-#if CFG_MONITOR_BASE >= CFG_FLASH_BASE
-       /* monitor protection ON by default */
-       debug ("Protect monitor: %08lx ... %08lx\n",
-               (ulong)CFG_MONITOR_BASE,
-               (ulong)CFG_MONITOR_BASE + monitor_flash_len - 1);
-
-       flash_protect(FLAG_PROTECT_SET,
-                     CFG_MONITOR_BASE,
-                     CFG_MONITOR_BASE + monitor_flash_len - 1,
-                     &flash_info[0]);
-#endif
-
-#ifdef CFG_ENV_IS_IN_FLASH
-       /* ENV protection ON by default */
-# ifdef CFG_ENV_ADDR_REDUND
-       debug ("Protect primary   environment: %08lx ... %08lx\n",
-               (ulong)CFG_ENV_ADDR,
-               (ulong)CFG_ENV_ADDR + CFG_ENV_SECT_SIZE - 1);
-# else
-       debug ("Protect environment: %08lx ... %08lx\n",
-               (ulong)CFG_ENV_ADDR,
-               (ulong)CFG_ENV_ADDR + CFG_ENV_SECT_SIZE - 1);
-# endif
-
-       flash_protect(FLAG_PROTECT_SET,
-                     CFG_ENV_ADDR,
-                     CFG_ENV_ADDR + CFG_ENV_SECT_SIZE - 1,
-                     &flash_info[0]);
-#endif
-
-#ifdef CFG_ENV_ADDR_REDUND
-       debug ("Protect redundand environment: %08lx ... %08lx\n",
-               (ulong)CFG_ENV_ADDR_REDUND,
-               (ulong)CFG_ENV_ADDR_REDUND + CFG_ENV_SECT_SIZE - 1);
-
-       flash_protect(FLAG_PROTECT_SET,
-                     CFG_ENV_ADDR_REDUND,
-                     CFG_ENV_ADDR_REDUND + CFG_ENV_SECT_SIZE - 1,
-                     &flash_info[0]);
-#endif
-
-       if (size_b1) {
-#ifndef        CFG_OR_TIMING_FLASH_AT_50MHZ
-               memctl->memc_or1 = CFG_OR_TIMING_FLASH | (-size_b1 & 0xFFFF8000);
-#else
-               memctl->memc_or1 = flash_or_timing | (-size_b1 & 0xFFFF8000);
-#endif
-               memctl->memc_br1 = ((CFG_FLASH_BASE + size_b0) & BR_BA_MSK) |
-                                   BR_MS_GPCM | BR_V;
-
-               debug ("## BR1: 0x%08x    OR1: 0x%08x\n",
-                       memctl->memc_br1, memctl->memc_or1);
-
-               /* Re-do sizing to get full correct info */
-               size_b1 = flash_get_size((vu_long *)(CFG_FLASH_BASE + size_b0),
-                                         &flash_info[1]);
-
-#if CFG_MONITOR_BASE >= CFG_FLASH_BASE
-               /* monitor protection ON by default */
-               flash_protect(FLAG_PROTECT_SET,
-                             CFG_MONITOR_BASE,
-                             CFG_MONITOR_BASE+monitor_flash_len-1,
-                             &flash_info[1]);
-#endif
-
-#ifdef CFG_ENV_IS_IN_FLASH
-               /* ENV protection ON by default */
-               flash_protect(FLAG_PROTECT_SET,
-                             CFG_ENV_ADDR,
-                             CFG_ENV_ADDR+CFG_ENV_SIZE-1,
-                             &flash_info[1]);
-#endif
-       } else {
-               memctl->memc_br1 = 0;           /* invalidate bank */
-
-               flash_info[1].flash_id = FLASH_UNKNOWN;
-               flash_info[1].sector_count = -1;
-               flash_info[1].size = 0;
-
-               debug ("## DISABLE BR1: 0x%08x    OR1: 0x%08x\n",
-                       memctl->memc_br1, memctl->memc_or1);
-       }
-
-       debug ("## Final Flash bank sizes: %08lx + 0x%08lx\n",size_b0,size_b1);
-
-       flash_info[0].size = size_b0;
-       flash_info[1].size = size_b1;
-
-       return (size_b0 + size_b1);
-}
-
-/*-----------------------------------------------------------------------
- */
-void flash_print_info  (flash_info_t *info)
-{
-       int i;
-
-       if (info->flash_id == FLASH_UNKNOWN) {
-               printf ("missing or unknown FLASH type\n");
-               return;
-       }
-
-       switch (info->flash_id & FLASH_VENDMASK) {
-       case FLASH_MAN_AMD:     printf ("AMD ");                break;
-       case FLASH_MAN_FUJ:     printf ("FUJITSU ");            break;
-       default:                printf ("Unknown Vendor ");     break;
-       }
-
-       switch (info->flash_id & FLASH_TYPEMASK) {
-#ifdef CONFIG_TQM8xxM  /* mirror bit flash */
-       case FLASH_AMLV128U:    printf ("AM29LV128ML (128Mbit, uniform sector size)\n");
-                               break;
-       case FLASH_AMLV320U:    printf ("AM29LV320ML (32Mbit, uniform sector size)\n");
-                               break;
-       case FLASH_AMLV640U:    printf ("AM29LV640ML (64Mbit, uniform sector size)\n");
-                               break;
-       case FLASH_AMLV320B:    printf ("AM29LV320MB (32Mbit, bottom boot sect)\n");
-                               break;
-# else /* ! TQM8xxM */
-       case FLASH_AM400B:      printf ("AM29LV400B (4 Mbit, bottom boot sect)\n");
-                               break;
-       case FLASH_AM400T:      printf ("AM29LV400T (4 Mbit, top boot sector)\n");
-                               break;
-       case FLASH_AM800B:      printf ("AM29LV800B (8 Mbit, bottom boot sect)\n");
-                               break;
-       case FLASH_AM800T:      printf ("AM29LV800T (8 Mbit, top boot sector)\n");
-                               break;
-       case FLASH_AM320B:      printf ("AM29LV320B (32 Mbit, bottom boot sect)\n");
-                               break;
-       case FLASH_AM320T:      printf ("AM29LV320T (32 Mbit, top boot sector)\n");
-                               break;
-#endif /* TQM8xxM */
-       case FLASH_AM160B:      printf ("AM29LV160B (16 Mbit, bottom boot sect)\n");
-                               break;
-       case FLASH_AM160T:      printf ("AM29LV160T (16 Mbit, top boot sector)\n");
-                               break;
-       case FLASH_AMDL163B:    printf ("AM29DL163B (16 Mbit, bottom boot sect)\n");
-                               break;
-       default:                printf ("Unknown Chip Type\n");
-                               break;
-       }
-
-       printf ("  Size: %ld MB in %d Sectors\n",
-               info->size >> 20, info->sector_count);
-
-       printf ("  Sector Start Addresses:");
-       for (i=0; i<info->sector_count; ++i) {
-               if ((i % 5) == 0)
-                       printf ("\n   ");
-               printf (" %08lX%s",
-                       info->start[i],
-                       info->protect[i] ? " (RO)" : "     "
-               );
-       }
-       printf ("\n");
-       return;
-}
-
-/*-----------------------------------------------------------------------
- */
-
-
-/*-----------------------------------------------------------------------
- */
-
-/*
- * The following code cannot be run from FLASH!
- */
-
-static ulong flash_get_size (vu_long *addr, flash_info_t *info)
-{
-       short i;
-       ulong value;
-       ulong base = (ulong)addr;
-
-       /* Write auto select command: read Manufacturer ID */
-       addr[0x0555] = 0x00AA00AA;
-       addr[0x02AA] = 0x00550055;
-       addr[0x0555] = 0x00900090;
-
-       value = addr[0];
-
-       debug ("Manuf. ID @ 0x%08lx: 0x%08lx\n", (ulong)addr, value);
-
-       switch (value) {
-       case AMD_MANUFACT:
-               debug ("Manufacturer: AMD\n");
-               info->flash_id = FLASH_MAN_AMD;
-               break;
-       case FUJ_MANUFACT:
-               debug ("Manufacturer: FUJITSU\n");
-               info->flash_id = FLASH_MAN_FUJ;
-               break;
-       default:
-               debug ("Manufacturer: *** unknown ***\n");
-               info->flash_id = FLASH_UNKNOWN;
-               info->sector_count = 0;
-               info->size = 0;
-               return (0);                     /* no or unknown flash  */
-       }
-
-       value = addr[1];                        /* device ID            */
-
-       debug ("Device ID @ 0x%08lx: 0x%08lx\n", (ulong)(&addr[1]), value);
-
-       switch (value) {
-#ifdef CONFIG_TQM8xxM  /* mirror bit flash */
-       case AMD_ID_MIRROR:
-               debug ("Mirror Bit flash: addr[14] = %08lX  addr[15] = %08lX\n",
-                       addr[14], addr[15]);
-               /* Special case for AMLV320MH/L */
-               if ((addr[14] & 0x00ff00ff) == 0x001d001d &&
-                   (addr[15] & 0x00ff00ff) == 0x00000000) {
-                       debug ("Chip: AMLV320MH/L\n");
-                       info->flash_id += FLASH_AMLV320U;
-                       info->sector_count = 64;
-                       info->size = 0x00800000;        /* => 8 MB */
-                       break;
-               }
-               switch(addr[14]) {
-               case AMD_ID_LV128U_2:
-                       if (addr[15] != AMD_ID_LV128U_3) {
-                               debug ("Chip: AMLV128U -> unknown\n");
-                               info->flash_id = FLASH_UNKNOWN;
-                       } else {
-                               debug ("Chip: AMLV128U\n");
-                               info->flash_id += FLASH_AMLV128U;
-                               info->sector_count = 256;
-                               info->size = 0x02000000;
-                       }
-                       break;                          /* => 32 MB     */
-               case AMD_ID_LV640U_2:
-                       if (addr[15] != AMD_ID_LV640U_3) {
-                               debug ("Chip: AMLV640U -> unknown\n");
-                               info->flash_id = FLASH_UNKNOWN;
-                       } else {
-                               debug ("Chip: AMLV640U\n");
-                               info->flash_id += FLASH_AMLV640U;
-                               info->sector_count = 128;
-                               info->size = 0x01000000;
-                       }
-                       break;                          /* => 16 MB     */
-               case AMD_ID_LV320B_2:
-                       if (addr[15] != AMD_ID_LV320B_3) {
-                               debug ("Chip: AMLV320B -> unknown\n");
-                               info->flash_id = FLASH_UNKNOWN;
-                       } else {
-                               debug ("Chip: AMLV320B\n");
-                               info->flash_id += FLASH_AMLV320B;
-                               info->sector_count = 71;
-                               info->size = 0x00800000;
-                       }
-                       break;                          /* =>  8 MB     */
-               default:
-                       debug ("Chip: *** unknown ***\n");
-                       info->flash_id = FLASH_UNKNOWN;
-                       break;
-               }
-               break;
-# else /* ! TQM8xxM */
-       case AMD_ID_LV400T:
-               info->flash_id += FLASH_AM400T;
-               info->sector_count = 11;
-               info->size = 0x00100000;
-               break;                                  /* => 1 MB              */
-
-       case AMD_ID_LV400B:
-               info->flash_id += FLASH_AM400B;
-               info->sector_count = 11;
-               info->size = 0x00100000;
-               break;                                  /* => 1 MB              */
-
-       case AMD_ID_LV800T:
-               info->flash_id += FLASH_AM800T;
-               info->sector_count = 19;
-               info->size = 0x00200000;
-               break;                                  /* => 2 MB      */
-
-       case AMD_ID_LV800B:
-               info->flash_id += FLASH_AM800B;
-               info->sector_count = 19;
-               info->size = 0x00200000;
-               break;                                  /* => 2 MB      */
-
-       case AMD_ID_LV320T:
-               info->flash_id += FLASH_AM320T;
-               info->sector_count = 71;
-               info->size = 0x00800000;
-               break;                                  /* => 8 MB      */
-
-       case AMD_ID_LV320B:
-               info->flash_id += FLASH_AM320B;
-               info->sector_count = 71;
-               info->size = 0x00800000;
-               break;                                  /* => 8 MB      */
-#endif /* TQM8xxM */
-
-       case AMD_ID_LV160T:
-               info->flash_id += FLASH_AM160T;
-               info->sector_count = 35;
-               info->size = 0x00400000;
-               break;                                  /* => 4 MB      */
-
-       case AMD_ID_LV160B:
-               info->flash_id += FLASH_AM160B;
-               info->sector_count = 35;
-               info->size = 0x00400000;
-               break;                                  /* => 4 MB      */
-
-       case AMD_ID_DL163B:
-               info->flash_id += FLASH_AMDL163B;
-               info->sector_count = 39;
-               info->size = 0x00400000;
-               break;                                  /* => 4 MB      */
-
-       default:
-               info->flash_id = FLASH_UNKNOWN;
-               return (0);                     /* => no or unknown flash */
-       }
-
-       /* set up sector start address table */
-       switch (value) {
-#ifdef CONFIG_TQM8xxM  /* mirror bit flash */
-       case AMD_ID_MIRROR:
-               switch (info->flash_id & FLASH_TYPEMASK) {
-                       /* only known types here - no default */
-               case FLASH_AMLV128U:
-               case FLASH_AMLV640U:
-               case FLASH_AMLV320U:
-                       for (i = 0; i < info->sector_count; i++) {
-                               info->start[i] = base;
-                               base += 0x20000;
-                       }
-                       break;
-               case FLASH_AMLV320B:
-                       for (i = 0; i < info->sector_count; i++) {
-                               info->start[i] = base;
-                               /*
-                                * The first 8 sectors are 8 kB,
-                                * all the other ones  are 64 kB
-                                */
-                               base += (i < 8)
-                                       ?  2 * ( 8 << 10)
-                                       :  2 * (64 << 10);
-                       }
-                       break;
-               }
-               break;
-# else /* ! TQM8xxM */
-       case AMD_ID_LV400B:
-       case AMD_ID_LV800B:
-               /* set sector offsets for bottom boot block type        */
-               info->start[0] = base + 0x00000000;
-               info->start[1] = base + 0x00008000;
-               info->start[2] = base + 0x0000C000;
-               info->start[3] = base + 0x00010000;
-               for (i = 4; i < info->sector_count; i++) {
-                       info->start[i] = base + (i * 0x00020000) - 0x00060000;
-               }
-               break;
-       case AMD_ID_LV400T:
-       case AMD_ID_LV800T:
-               /* set sector offsets for top boot block type           */
-               i = info->sector_count - 1;
-               info->start[i--] = base + info->size - 0x00008000;
-               info->start[i--] = base + info->size - 0x0000C000;
-               info->start[i--] = base + info->size - 0x00010000;
-               for (; i >= 0; i--) {
-                       info->start[i] = base + i * 0x00020000;
-               }
-               break;
-       case AMD_ID_LV320B:
-               for (i = 0; i < info->sector_count; i++) {
-                       info->start[i] = base;
-                       /*
-                        * The first 8 sectors are 8 kB,
-                        * all the other ones  are 64 kB
-                        */
-                       base += (i < 8)
-                               ?  2 * ( 8 << 10)
-                               :  2 * (64 << 10);
-               }
-               break;
-       case AMD_ID_LV320T:
-               for (i = 0; i < info->sector_count; i++) {
-                       info->start[i] = base;
-                       /*
-                        * The last 8 sectors are 8 kB,
-                        * all the other ones  are 64 kB
-                        */
-                       base += (i < (info->sector_count - 8))
-                               ?  2 * (64 << 10)
-                               :  2 * ( 8 << 10);
-               }
-               break;
-#endif /* TQM8xxM */
-       case AMD_ID_LV160B:
-               /* set sector offsets for bottom boot block type        */
-               info->start[0] = base + 0x00000000;
-               info->start[1] = base + 0x00008000;
-               info->start[2] = base + 0x0000C000;
-               info->start[3] = base + 0x00010000;
-               for (i = 4; i < info->sector_count; i++) {
-                       info->start[i] = base + (i * 0x00020000) - 0x00060000;
-               }
-               break;
-       case AMD_ID_LV160T:
-               /* set sector offsets for top boot block type           */
-               i = info->sector_count - 1;
-               info->start[i--] = base + info->size - 0x00008000;
-               info->start[i--] = base + info->size - 0x0000C000;
-               info->start[i--] = base + info->size - 0x00010000;
-               for (; i >= 0; i--) {
-                       info->start[i] = base + i * 0x00020000;
-               }
-               break;
-       case AMD_ID_DL163B:
-               for (i = 0; i < info->sector_count; i++) {
-                       info->start[i] = base;
-                       /*
-                        * The first 8 sectors are 8 kB,
-                        * all the other ones  are 64 kB
-                        */
-                       base += (i < 8)
-                               ?  2 * ( 8 << 10)
-                               :  2 * (64 << 10);
-               }
-               break;
-       default:
-               return (0);
-               break;
-       }
-
-#if 0
-       /* check for protected sectors */
-       for (i = 0; i < info->sector_count; i++) {
-               /* read sector protection at sector address, (A7 .. A0) = 0x02 */
-               /* D0 = 1 if protected */
-               addr = (volatile unsigned long *)(info->start[i]);
-               info->protect[i] = addr[2] & 1;
-       }
-#endif
-
-       /*
-        * Prevent writes to uninitialized FLASH.
-        */
-       if (info->flash_id != FLASH_UNKNOWN) {
-               addr = (volatile unsigned long *)info->start[0];
-
-               *addr = 0x00F000F0;     /* reset bank */
-       }
-
-       return (info->size);
-}
-
-
-/*-----------------------------------------------------------------------
- */
-
-int    flash_erase (flash_info_t *info, int s_first, int s_last)
-{
-       vu_long *addr = (vu_long*)(info->start[0]);
-       int flag, prot, sect, l_sect;
-       ulong start, now, last;
-
-       debug ("flash_erase: first: %d last: %d\n", s_first, s_last);
-
-       if ((s_first < 0) || (s_first > s_last)) {
-               if (info->flash_id == FLASH_UNKNOWN) {
-                       printf ("- missing\n");
-               } else {
-                       printf ("- no sectors to erase\n");
-               }
-               return 1;
-       }
-
-       if ((info->flash_id == FLASH_UNKNOWN) ||
-           (info->flash_id > FLASH_AMD_COMP)) {
-               printf ("Can't erase unknown flash type %08lx - aborted\n",
-                       info->flash_id);
-               return 1;
-       }
-
-       prot = 0;
-       for (sect=s_first; sect<=s_last; ++sect) {
-               if (info->protect[sect]) {
-                       prot++;
-               }
-       }
-
-       if (prot) {
-               printf ("- Warning: %d protected sectors will not be erased!\n",
-                       prot);
-       } else {
-               printf ("\n");
-       }
-
-       l_sect = -1;
-
-       /* Disable interrupts which might cause a timeout here */
-       flag = disable_interrupts();
-
-       addr[0x0555] = 0x00AA00AA;
-       addr[0x02AA] = 0x00550055;
-       addr[0x0555] = 0x00800080;
-       addr[0x0555] = 0x00AA00AA;
-       addr[0x02AA] = 0x00550055;
-
-       /* Start erase on unprotected sectors */
-       for (sect = s_first; sect<=s_last; sect++) {
-               if (info->protect[sect] == 0) { /* not protected */
-                       addr = (vu_long*)(info->start[sect]);
-                       addr[0] = 0x00300030;
-                       l_sect = sect;
-               }
-       }
-
-       /* re-enable interrupts if necessary */
-       if (flag)
-               enable_interrupts();
-
-       /* wait at least 80us - let's wait 1 ms */
-       udelay (1000);
-
-       /*
-        * We wait for the last triggered sector
-        */
-       if (l_sect < 0)
-               goto DONE;
-
-       start = get_timer (0);
-       last  = start;
-       addr = (vu_long*)(info->start[l_sect]);
-       while ((addr[0] & 0x00800080) != 0x00800080) {
-               if ((now = get_timer(start)) > CFG_FLASH_ERASE_TOUT) {
-                       printf ("Timeout\n");
-                       return 1;
-               }
-               /* show that we're waiting */
-               if ((now - last) > 1000) {      /* every second */
-                       putc ('.');
-                       last = now;
-               }
-       }
-
-DONE:
-       /* reset to read mode */
-       addr = (volatile unsigned long *)info->start[0];
-       addr[0] = 0x00F000F0;   /* reset bank */
-
-       printf (" done\n");
-       return 0;
-}
-
-/*-----------------------------------------------------------------------
- * Copy memory to flash, returns:
- * 0 - OK
- * 1 - write timeout
- * 2 - Flash not erased
- */
-
-int write_buff (flash_info_t *info, uchar *src, ulong addr, ulong cnt)
-{
-       ulong cp, wp, data;
-       int i, l, rc;
-
-       wp = (addr & ~3);       /* get lower word aligned address */
-
-       /*
-        * handle unaligned start bytes
-        */
-       if ((l = addr - wp) != 0) {
-               data = 0;
-               for (i=0, cp=wp; i<l; ++i, ++cp) {
-                       data = (data << 8) | (*(uchar *)cp);
-               }
-               for (; i<4 && cnt>0; ++i) {
-                       data = (data << 8) | *src++;
-                       --cnt;
-                       ++cp;
-               }
-               for (; cnt==0 && i<4; ++i, ++cp) {
-                       data = (data << 8) | (*(uchar *)cp);
-               }
-
-               if ((rc = write_word(info, wp, data)) != 0) {
-                       return (rc);
-               }
-               wp += 4;
-       }
-
-       /*
-        * handle word aligned part
-        */
-       while (cnt >= 4) {
-               data = 0;
-               for (i=0; i<4; ++i) {
-                       data = (data << 8) | *src++;
-               }
-               if ((rc = write_word(info, wp, data)) != 0) {
-                       return (rc);
-               }
-               wp  += 4;
-               cnt -= 4;
-       }
-
-       if (cnt == 0) {
-               return (0);
-       }
-
-       /*
-        * handle unaligned tail bytes
-        */
-       data = 0;
-       for (i=0, cp=wp; i<4 && cnt>0; ++i, ++cp) {
-               data = (data << 8) | *src++;
-               --cnt;
-       }
-       for (; i<4; ++i, ++cp) {
-               data = (data << 8) | (*(uchar *)cp);
-       }
-
-       return (write_word(info, wp, data));
-}
-
-/*-----------------------------------------------------------------------
- * Write a word to Flash, returns:
- * 0 - OK
- * 1 - write timeout
- * 2 - Flash not erased
- */
-static int write_word (flash_info_t *info, ulong dest, ulong data)
-{
-       vu_long *addr = (vu_long*)(info->start[0]);
-       ulong start;
-       int flag;
-
-       /* Check if Flash is (sufficiently) erased */
-       if ((*((vu_long *)dest) & data) != data) {
-               return (2);
-       }
-       /* Disable interrupts which might cause a timeout here */
-       flag = disable_interrupts();
-
-       addr[0x0555] = 0x00AA00AA;
-       addr[0x02AA] = 0x00550055;
-       addr[0x0555] = 0x00A000A0;
-
-       *((vu_long *)dest) = data;
-
-       /* re-enable interrupts if necessary */
-       if (flag)
-               enable_interrupts();
-
-       /* data polling for D7 */
-       start = get_timer (0);
-       while ((*((vu_long *)dest) & 0x00800080) != (data & 0x00800080)) {
-               if (get_timer(start) > CFG_FLASH_WRITE_TOUT) {
-                       return (1);
-               }
-       }
-       return (0);
-}
-
-/*-----------------------------------------------------------------------
- */
-
-#endif /* !defined(CFG_FLASH_CFI_DRIVER) */
diff --git a/board/tqm8xx/load_sernum_ethaddr.c b/board/tqm8xx/load_sernum_ethaddr.c
deleted file mode 100644 (file)
index 143f368..0000000
+++ /dev/null
@@ -1,105 +0,0 @@
-/*
- * (C) Copyright 2000, 2001, 2002
- * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-
-#include <common.h>
-#include <mpc8xx.h>
-
-/*-----------------------------------------------------------------------
- * Process Hardware Information Block:
- *
- * If we boot on a system fresh from factory, check if the Hardware
- * Information Block exists and save the information it contains.
- *
- * The TQM8xxL / TQM82xx Hardware Information Block is defined as
- * follows:
- * - located in first flash bank
- * - starts at offset 0x0003FFC0
- * - size 0x00000040
- *
- * Internal structure:
- * - sequence of ASCII character strings
- * - fields separated by a single space character (0x20)
- * - last field terminated by NUL character (0x00)
- * - remaining space filled with NUL characters (0x00)
- *
- * Fields in Hardware Information Block:
- * 1) Module Type
- * 2) Serial Number
- * 3) First MAC Address
- * 4) Number of additional MAC addresses
- */
-
-void load_sernum_ethaddr (void)
-{
-       unsigned char *hwi;
-       unsigned char  serial [CFG_HWINFO_SIZE];
-       unsigned char  ethaddr[CFG_HWINFO_SIZE];
-       unsigned short ih, is, ie, part;
-
-       hwi = (unsigned char *)(CFG_FLASH_BASE + CFG_HWINFO_OFFSET);
-       ih = is = ie = 0;
-
-       if (*((unsigned long *)hwi) != (unsigned long)CFG_HWINFO_MAGIC) {
-               return;
-       }
-
-       part = 1;
-
-       /* copy serial # / MAC address */
-       while ((hwi[ih] != '\0') && (ih < CFG_HWINFO_SIZE)) {
-               if (hwi[ih] < ' ' || hwi[ih] > '~') { /* ASCII strings! */
-                       return;
-               }
-               switch (part) {
-               default:                /* Copy serial # */
-                       if (hwi[ih] == ' ') {
-                               ++part;
-                       }
-                       serial[is++] = hwi[ih];
-                       break;
-               case 3:                 /* Copy MAC address */
-                       if (hwi[ih] == ' ') {
-                               ++part;
-                               break;
-                       }
-                       ethaddr[ie++] = hwi[ih];
-                       if ((ie % 3) == 2)
-                               ethaddr[ie++] = ':';
-                       break;
-               }
-               ++ih;
-       }
-       serial[is]  = '\0';
-       if (ie && ethaddr[ie-1] == ':')
-               --ie;
-       ethaddr[ie] = '\0';
-
-       /* set serial# and ethaddr if not yet defined */
-       if (getenv("serial#") == NULL) {
-               setenv ((char *)"serial#", (char *)serial);
-       }
-
-       if (getenv("ethaddr") == NULL) {
-               setenv ((char *)"ethaddr", (char *)ethaddr);
-       }
-}
diff --git a/board/tqm8xx/tqm8xx.c b/board/tqm8xx/tqm8xx.c
deleted file mode 100644 (file)
index 18bf2a8..0000000
+++ /dev/null
@@ -1,554 +0,0 @@
-/*
- * (C) Copyright 2000-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
- */
-
-#if 0
-#define DEBUG
-#endif
-
-#include <common.h>
-#include <mpc8xx.h>
-#ifdef CONFIG_PS2MULT
-#include <ps2mult.h>
-#endif
-
-DECLARE_GLOBAL_DATA_PTR;
-
-static long int dram_size (long int, long int *, long int);
-
-#define        _NOT_USED_      0xFFFFFFFF
-
-/* UPM initialization table for SDRAM: 40, 50, 66 MHz CLKOUT @ CAS latency 2, tWR=2 */
-const uint sdram_table[] =
-{
-       /*
-        * Single Read. (Offset 0 in UPMA RAM)
-        */
-       0x1F0DFC04, 0xEEAFBC04, 0x11AF7C04, 0xEFBAFC00,
-       0x1FF5FC47, /* last */
-       /*
-        * SDRAM Initialization (offset 5 in UPMA RAM)
-        *
-        * This is no UPM entry point. The following definition uses
-        * the remaining space to establish an initialization
-        * sequence, which is executed by a RUN command.
-        *
-        */
-                   0x1FF5FC34, 0xEFEABC34, 0x1FB57C35, /* last */
-       /*
-        * Burst Read. (Offset 8 in UPMA RAM)
-        */
-       0x1F0DFC04, 0xEEAFBC04, 0x10AF7C04, 0xF0AFFC00,
-       0xF0AFFC00, 0xF1AFFC00, 0xEFBAFC00, 0x1FF5FC47, /* last */
-       _NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
-       _NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
-       /*
-        * Single Write. (Offset 18 in UPMA RAM)
-        */
-       0x1F0DFC04, 0xEEABBC00, 0x11B77C04, 0xEFFAFC44,
-       0x1FF5FC47, /* last */
-                   _NOT_USED_, _NOT_USED_, _NOT_USED_,
-       /*
-        * Burst Write. (Offset 20 in UPMA RAM)
-        */
-       0x1F0DFC04, 0xEEABBC00, 0x10A77C00, 0xF0AFFC00,
-       0xF0AFFC00, 0xF0AFFC04, 0xE1BAFC44, 0x1FF5FC47, /* last */
-       _NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
-       _NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
-       /*
-        * Refresh  (Offset 30 in UPMA RAM)
-        */
-       0x1FFD7C84, 0xFFFFFC04, 0xFFFFFC04, 0xFFFFFC04,
-       0xFFFFFC84, 0xFFFFFC07, /* last */
-                               _NOT_USED_, _NOT_USED_,
-       _NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
-       /*
-        * Exception. (Offset 3c in UPMA RAM)
-        */
-       0xFFFFFC07, /* last */
-                   _NOT_USED_, _NOT_USED_, _NOT_USED_,
-};
-
-/* ------------------------------------------------------------------------- */
-
-
-/*
- * Check Board Identity:
- *
- * Test TQ ID string (TQM8xx...)
- * If present, check for "L" type (no second DRAM bank),
- * otherwise "L" type is assumed as default.
- *
- * Set board_type to 'L' for "L" type, 'M' for "M" type, 0 else.
- */
-
-int checkboard (void)
-{
-       char *s = getenv ("serial#");
-
-       puts ("Board: ");
-
-       if (!s || strncmp (s, "TQM8", 4)) {
-               puts ("### No HW ID - assuming TQM8xxL\n");
-               return (0);
-       }
-
-       if ((*(s + 6) == 'L')) {        /* a TQM8xxL type */
-               gd->board_type = 'L';
-       }
-
-       if ((*(s + 6) == 'M')) {        /* a TQM8xxM type */
-               gd->board_type = 'M';
-       }
-
-       if ((*(s + 6) == 'D')) {        /* a TQM885D type */
-               gd->board_type = 'D';
-       }
-
-       for (; *s; ++s) {
-               if (*s == ' ')
-                       break;
-               putc (*s);
-       }
-#ifdef CONFIG_VIRTLAB2
-       puts (" (Virtlab2)");
-#endif
-       putc ('\n');
-
-       return (0);
-}
-
-/* ------------------------------------------------------------------------- */
-
-long int initdram (int board_type)
-{
-       volatile immap_t *immap = (immap_t *) CFG_IMMR;
-       volatile memctl8xx_t *memctl = &immap->im_memctl;
-       long int size8, size9, size10;
-       long int size_b0 = 0;
-       long int size_b1 = 0;
-
-       upmconfig (UPMA, (uint *) sdram_table,
-                          sizeof (sdram_table) / sizeof (uint));
-
-       /*
-        * Preliminary prescaler for refresh (depends on number of
-        * banks): This value is selected for four cycles every 62.4 us
-        * with two SDRAM banks or four cycles every 31.2 us with one
-        * bank. It will be adjusted after memory sizing.
-        */
-       memctl->memc_mptpr = CFG_MPTPR_2BK_8K;
-
-       /*
-        * The following value is used as an address (i.e. opcode) for
-        * the LOAD MODE REGISTER COMMAND during SDRAM initialisation. If
-        * the port size is 32bit the SDRAM does NOT "see" the lower two
-        * address lines, i.e. mar=0x00000088 -> opcode=0x00000022 for
-        * MICRON SDRAMs:
-        * ->    0 00 010 0 010
-        *       |  |   | |   +- Burst Length = 4
-        *       |  |   | +----- Burst Type   = Sequential
-        *       |  |   +------- CAS Latency  = 2
-        *       |  +----------- Operating Mode = Standard
-        *       +-------------- Write Burst Mode = Programmed Burst Length
-        */
-       memctl->memc_mar = 0x00000088;
-
-       /*
-        * Map controller banks 2 and 3 to the SDRAM banks 2 and 3 at
-        * preliminary addresses - these have to be modified after the
-        * SDRAM size has been determined.
-        */
-       memctl->memc_or2 = CFG_OR2_PRELIM;
-       memctl->memc_br2 = CFG_BR2_PRELIM;
-
-#ifndef        CONFIG_CAN_DRIVER
-       if ((board_type != 'L') &&
-           (board_type != 'M') &&
-           (board_type != 'D') ) {     /* only one SDRAM bank on L, M and D modules */
-               memctl->memc_or3 = CFG_OR3_PRELIM;
-               memctl->memc_br3 = CFG_BR3_PRELIM;
-       }
-#endif                                                 /* CONFIG_CAN_DRIVER */
-
-       memctl->memc_mamr = CFG_MAMR_8COL & (~(MAMR_PTAE));     /* no refresh yet */
-
-       udelay (200);
-
-       /* perform SDRAM initializsation sequence */
-
-       memctl->memc_mcr = 0x80004105;  /* SDRAM bank 0 */
-       udelay (1);
-       memctl->memc_mcr = 0x80004230;  /* SDRAM bank 0 - execute twice */
-       udelay (1);
-
-#ifndef        CONFIG_CAN_DRIVER
-       if ((board_type != 'L') &&
-           (board_type != 'M') &&
-           (board_type != 'D') ) {     /* only one SDRAM bank on L, M and D modules */
-               memctl->memc_mcr = 0x80006105;  /* SDRAM bank 1 */
-               udelay (1);
-               memctl->memc_mcr = 0x80006230;  /* SDRAM bank 1 - execute twice */
-               udelay (1);
-       }
-#endif                                                 /* CONFIG_CAN_DRIVER */
-
-       memctl->memc_mamr |= MAMR_PTAE; /* enable refresh */
-
-       udelay (1000);
-
-       /*
-        * Check Bank 0 Memory Size for re-configuration
-        *
-        * try 8 column mode
-        */
-       size8 = dram_size (CFG_MAMR_8COL, SDRAM_BASE2_PRELIM, SDRAM_MAX_SIZE);
-       debug ("SDRAM Bank 0 in 8 column mode: %ld MB\n", size8 >> 20);
-
-       udelay (1000);
-
-       /*
-        * try 9 column mode
-        */
-       size9 = dram_size (CFG_MAMR_9COL, SDRAM_BASE2_PRELIM, SDRAM_MAX_SIZE);
-       debug ("SDRAM Bank 0 in 9 column mode: %ld MB\n", size9 >> 20);
-
-       udelay(1000);
-
-#if defined(CFG_MAMR_10COL)
-       /*
-        * try 10 column mode
-        */
-       size10 = dram_size (CFG_MAMR_10COL, SDRAM_BASE2_PRELIM, SDRAM_MAX_SIZE);
-       debug ("SDRAM Bank 0 in 10 column mode: %ld MB\n", size10 >> 20);
-#else
-       size10 = 0;
-#endif /* CFG_MAMR_10COL */
-
-       if ((size8 < size10) && (size9 < size10)) {
-               size_b0 = size10;
-       } else if ((size8 < size9) && (size10 < size9)) {
-               size_b0 = size9;
-               memctl->memc_mamr = CFG_MAMR_9COL;
-               udelay (500);
-       } else {
-               size_b0 = size8;
-               memctl->memc_mamr = CFG_MAMR_8COL;
-               udelay (500);
-       }
-       debug ("SDRAM Bank 0: %ld MB\n", size_b0 >> 20);
-
-#ifndef        CONFIG_CAN_DRIVER
-       if ((board_type != 'L') &&
-           (board_type != 'M') &&
-           (board_type != 'D') ) {     /* only one SDRAM bank on L, M and D modules */
-               /*
-                * Check Bank 1 Memory Size
-                * use current column settings
-                * [9 column SDRAM may also be used in 8 column mode,
-                *  but then only half the real size will be used.]
-                */
-               size_b1 = dram_size (memctl->memc_mamr, (long int *)SDRAM_BASE3_PRELIM,
-                                    SDRAM_MAX_SIZE);
-               debug ("SDRAM Bank 1: %ld MB\n", size_b1 >> 20);
-       } else {
-               size_b1 = 0;
-       }
-#endif /* CONFIG_CAN_DRIVER */
-
-       udelay (1000);
-
-       /*
-        * Adjust refresh rate depending on SDRAM type, both banks
-        * For types > 128 MBit leave it at the current (fast) rate
-        */
-       if ((size_b0 < 0x02000000) && (size_b1 < 0x02000000)) {
-               /* reduce to 15.6 us (62.4 us / quad) */
-               memctl->memc_mptpr = CFG_MPTPR_2BK_4K;
-               udelay (1000);
-       }
-
-       /*
-        * Final mapping: map bigger bank first
-        */
-       if (size_b1 > size_b0) {        /* SDRAM Bank 1 is bigger - map first   */
-
-               memctl->memc_or3 = ((-size_b1) & 0xFFFF0000) | CFG_OR_TIMING_SDRAM;
-               memctl->memc_br3 = (CFG_SDRAM_BASE & BR_BA_MSK) | BR_MS_UPMA | BR_V;
-
-               if (size_b0 > 0) {
-                       /*
-                        * Position Bank 0 immediately above Bank 1
-                        */
-                       memctl->memc_or2 = ((-size_b0) & 0xFFFF0000) | CFG_OR_TIMING_SDRAM;
-                       memctl->memc_br2 = ((CFG_SDRAM_BASE & BR_BA_MSK) | BR_MS_UPMA | BR_V)
-                                          + size_b1;
-               } else {
-                       unsigned long reg;
-
-                       /*
-                        * No bank 0
-                        *
-                        * invalidate bank
-                        */
-                       memctl->memc_br2 = 0;
-
-                       /* adjust refresh rate depending on SDRAM type, one bank */
-                       reg = memctl->memc_mptpr;
-                       reg >>= 1;                      /* reduce to CFG_MPTPR_1BK_8K / _4K */
-                       memctl->memc_mptpr = reg;
-               }
-
-       } else {                                        /* SDRAM Bank 0 is bigger - map first   */
-
-               memctl->memc_or2 = ((-size_b0) & 0xFFFF0000) | CFG_OR_TIMING_SDRAM;
-               memctl->memc_br2 =
-                               (CFG_SDRAM_BASE & BR_BA_MSK) | BR_MS_UPMA | BR_V;
-
-               if (size_b1 > 0) {
-                       /*
-                        * Position Bank 1 immediately above Bank 0
-                        */
-                       memctl->memc_or3 =
-                                       ((-size_b1) & 0xFFFF0000) | CFG_OR_TIMING_SDRAM;
-                       memctl->memc_br3 =
-                                       ((CFG_SDRAM_BASE & BR_BA_MSK) | BR_MS_UPMA | BR_V)
-                                       + size_b0;
-               } else {
-                       unsigned long reg;
-
-#ifndef        CONFIG_CAN_DRIVER
-                       /*
-                        * No bank 1
-                        *
-                        * invalidate bank
-                        */
-                       memctl->memc_br3 = 0;
-#endif                                                 /* CONFIG_CAN_DRIVER */
-
-                       /* adjust refresh rate depending on SDRAM type, one bank */
-                       reg = memctl->memc_mptpr;
-                       reg >>= 1;                      /* reduce to CFG_MPTPR_1BK_8K / _4K */
-                       memctl->memc_mptpr = reg;
-               }
-       }
-
-       udelay (10000);
-
-#ifdef CONFIG_CAN_DRIVER
-       /* UPM initialization for CAN @ CLKOUT <= 66 MHz */
-
-       /* Initialize OR3 / BR3 */
-       memctl->memc_or3 = CFG_OR3_CAN;
-       memctl->memc_br3 = CFG_BR3_CAN;
-
-       /* Initialize MBMR */
-       memctl->memc_mbmr = MBMR_GPL_B4DIS;     /* GPL_B4 ouput line Disable */
-
-       /* Initialize UPMB for CAN: single read */
-       memctl->memc_mdr = 0xFFFFCC04;
-       memctl->memc_mcr = 0x0100 | UPMB;
-
-       memctl->memc_mdr = 0x0FFFD004;
-       memctl->memc_mcr = 0x0101 | UPMB;
-
-       memctl->memc_mdr = 0x0FFFC000;
-       memctl->memc_mcr = 0x0102 | UPMB;
-
-       memctl->memc_mdr = 0x3FFFC004;
-       memctl->memc_mcr = 0x0103 | UPMB;
-
-       memctl->memc_mdr = 0xFFFFDC07;
-       memctl->memc_mcr = 0x0104 | UPMB;
-
-       /* Initialize UPMB for CAN: single write */
-       memctl->memc_mdr = 0xFFFCCC04;
-       memctl->memc_mcr = 0x0118 | UPMB;
-
-       memctl->memc_mdr = 0xCFFCDC04;
-       memctl->memc_mcr = 0x0119 | UPMB;
-
-       memctl->memc_mdr = 0x3FFCC000;
-       memctl->memc_mcr = 0x011A | UPMB;
-
-       memctl->memc_mdr = 0xFFFCC004;
-       memctl->memc_mcr = 0x011B | UPMB;
-
-       memctl->memc_mdr = 0xFFFDC405;
-       memctl->memc_mcr = 0x011C | UPMB;
-#endif                                                 /* CONFIG_CAN_DRIVER */
-
-#ifdef CONFIG_ISP1362_USB
-       /* Initialize OR5 / BR5 */
-       memctl->memc_or5 = CFG_OR5_ISP1362;
-       memctl->memc_br5 = CFG_BR5_ISP1362;
-#endif                                                 /* CONFIG_ISP1362_USB */
-
-
-       return (size_b0 + size_b1);
-}
-
-/* ------------------------------------------------------------------------- */
-
-/*
- * Check memory range for valid RAM. A simple memory test determines
- * the actually available RAM size between addresses `base' and
- * `base + maxsize'. Some (not all) hardware errors are detected:
- * - short between address lines
- * - short between data lines
- */
-
-static long int dram_size (long int mamr_value, long int *base, long int maxsize)
-{
-       volatile immap_t *immap = (immap_t *) CFG_IMMR;
-       volatile memctl8xx_t *memctl = &immap->im_memctl;
-
-       memctl->memc_mamr = mamr_value;
-
-       return (get_ram_size(base, maxsize));
-}
-
-/* ------------------------------------------------------------------------- */
-
-#ifdef CONFIG_PS2MULT
-
-#ifdef CONFIG_HMI10
-#define BASE_BAUD ( 1843200 / 16 )
-struct serial_state rs_table[] = {
-       { BASE_BAUD, 4,  (void*)0xec140000 },
-       { BASE_BAUD, 2,  (void*)0xec150000 },
-       { BASE_BAUD, 6,  (void*)0xec160000 },
-       { BASE_BAUD, 10, (void*)0xec170000 },
-};
-
-#ifdef CONFIG_BOARD_EARLY_INIT_R
-int board_early_init_r (void)
-{
-       ps2mult_early_init();
-       return (0);
-}
-#endif
-#endif /* CONFIG_HMI10 */
-
-#endif /* CONFIG_PS2MULT */
-
-/* ---------------------------------------------------------------------------- */
-/* HMI10 specific stuff                                                                */
-/* ---------------------------------------------------------------------------- */
-#ifdef CONFIG_HMI10
-
-int misc_init_r (void)
-{
-# ifdef CONFIG_IDE_LED
-       volatile immap_t *immap = (immap_t *) CFG_IMMR;
-
-       /* Configure PA15 as output port */
-       immap->im_ioport.iop_padir |= 0x0001;
-       immap->im_ioport.iop_paodr |= 0x0001;
-       immap->im_ioport.iop_papar &= ~0x0001;
-       immap->im_ioport.iop_padat &= ~0x0001;  /* turn it off */
-# endif
-       return (0);
-}
-
-# ifdef CONFIG_IDE_LED
-void ide_led (uchar led, uchar status)
-{
-       volatile immap_t *immap = (immap_t *) CFG_IMMR;
-
-       /* We have one led for both pcmcia slots */
-       if (status) {                           /* led on */
-               immap->im_ioport.iop_padat |= 0x0001;
-       } else {
-               immap->im_ioport.iop_padat &= ~0x0001;
-       }
-}
-# endif
-#endif /* CONFIG_HMI10 */
-
-/* ---------------------------------------------------------------------------- */
-/* NSCU specific stuff                                                         */
-/* ---------------------------------------------------------------------------- */
-#ifdef CONFIG_NSCU
-
-int misc_init_r (void)
-{
-       volatile immap_t *immr = (immap_t *) CFG_IMMR;
-
-       /* wake up ethernet module */
-       immr->im_ioport.iop_pcpar &= ~0x0004; /* GPIO pin       */
-       immr->im_ioport.iop_pcdir |=  0x0004; /* output         */
-       immr->im_ioport.iop_pcso  &= ~0x0004; /* for clarity    */
-       immr->im_ioport.iop_pcdat |=  0x0004; /* enable         */
-
-       return (0);
-}
-#endif /* CONFIG_NSCU */
-
-/* ---------------------------------------------------------------------------- */
-/* TK885D specific initializaion                                               */
-/* ---------------------------------------------------------------------------- */
-#ifdef CONFIG_TK885D
-#include <miiphy.h>
-int last_stage_init(void)
-{
-       const unsigned char phy[] = {CONFIG_FEC1_PHY, CONFIG_FEC2_PHY};
-       unsigned short reg;
-       int ret, i = 100;
-       char *s;
-
-       mii_init();
-       /* Without this delay 0xff is read from the UART buffer later in
-        * abortboot() and autoboot is aborted */
-       udelay(10000);
-       while (tstc() && i--)
-               (void)getc();
-
-       /* Check if auto-negotiation is prohibited */
-       s = getenv("phy_auto_nego");
-
-       if (!s || !strcmp(s, "on"))
-               /* Nothing to do - autonegotiation by default */
-               return 0;
-
-       for (i = 0; i < 2; i++) {
-               ret = miiphy_read("FEC ETHERNET", phy[i], PHY_BMCR, &reg);
-               if (ret) {
-                       printf("Cannot read BMCR on PHY %d\n", phy[i]);
-                       return 0;
-               }
-               /* Auto-negotiation off, hard set full duplex, 100Mbps */
-               ret = miiphy_write("FEC ETHERNET", phy[i],
-                                  PHY_BMCR, (reg | PHY_BMCR_100MB |
-                                             PHY_BMCR_DPLX) & ~PHY_BMCR_AUTON);
-               if (ret) {
-                       printf("Cannot write BMCR on PHY %d\n", phy[i]);
-                       return 0;
-               }
-       }
-
-       return 0;
-}
-
-#endif
-
-/* ------------------------------------------------------------------------- */
diff --git a/board/tqm8xx/u-boot.lds b/board/tqm8xx/u-boot.lds
deleted file mode 100644 (file)
index 8c46e46..0000000
+++ /dev/null
@@ -1,143 +0,0 @@
-/*
- * (C) Copyright 2000
- * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-
-OUTPUT_ARCH(powerpc)
-/* Do we need any of these for elf?
-   __DYNAMIC = 0;    */
-SECTIONS
-{
-  /* Read-only sections, merged into text segment: */
-  . = + SIZEOF_HEADERS;
-  .interp : { *(.interp) }
-  .hash          : { *(.hash)          }
-  .dynsym        : { *(.dynsym)                }
-  .dynstr        : { *(.dynstr)                }
-  .rel.text      : { *(.rel.text)      }
-  .rela.text     : { *(.rela.text)     }
-  .rel.data      : { *(.rel.data)      }
-  .rela.data     : { *(.rela.data)     }
-  .rel.rodata    : { *(.rel.rodata)    }
-  .rela.rodata   : { *(.rela.rodata)   }
-  .rel.got       : { *(.rel.got)       }
-  .rela.got      : { *(.rela.got)      }
-  .rel.ctors     : { *(.rel.ctors)     }
-  .rela.ctors    : { *(.rela.ctors)    }
-  .rel.dtors     : { *(.rel.dtors)     }
-  .rela.dtors    : { *(.rela.dtors)    }
-  .rel.bss       : { *(.rel.bss)       }
-  .rela.bss      : { *(.rela.bss)      }
-  .rel.plt       : { *(.rel.plt)       }
-  .rela.plt      : { *(.rela.plt)      }
-  .init          : { *(.init)          }
-  .plt : { *(.plt) }
-  .text      :
-  {
-    /* WARNING - the following is hand-optimized to fit within */
-    /* the sector layout of our flash chips!   XXX FIXME XXX   */
-
-    cpu/mpc8xx/start.o         (.text)
-    cpu/mpc8xx/traps.o         (.text)
-    common/dlmalloc.o          (.text)
-    lib_ppc/ppcstring.o                (.text)
-    lib_generic/vsprintf.o     (.text)
-    lib_generic/crc32.o                (.text)
-    lib_generic/zlib.o         (.text)
-    lib_ppc/cache.o            (.text)
-    lib_ppc/time.o             (.text)
-
-    . = DEFINED(env_offset) ? env_offset : .;
-    common/environment.o       (.ppcenv)
-
-    *(.text)
-    *(.fixup)
-    *(.got1)
-  }
-  _etext = .;
-  PROVIDE (etext = .);
-  .rodata    :
-  {
-    *(.rodata)
-    *(.rodata1)
-    *(.rodata.str1.4)
-    *(.eh_frame)
-  }
-  .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 (NOLOAD)       :
-  {
-   *(.sbss) *(.scommon)
-   *(.dynbss)
-   *(.bss)
-   *(COMMON)
-  }
-  _end = . ;
-  PROVIDE (end = .);
-}
diff --git a/board/tqm8xx/u-boot.lds.debug b/board/tqm8xx/u-boot.lds.debug
deleted file mode 100644 (file)
index c33581d..0000000
+++ /dev/null
@@ -1,136 +0,0 @@
-/*
- * (C) Copyright 2000
- * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-
-OUTPUT_ARCH(powerpc)
-/* Do we need any of these for elf?
-   __DYNAMIC = 0;    */
-SECTIONS
-{
-  /* Read-only sections, merged into text segment: */
-  . = + SIZEOF_HEADERS;
-  .interp : { *(.interp) }
-  .hash          : { *(.hash)          }
-  .dynsym        : { *(.dynsym)                }
-  .dynstr        : { *(.dynstr)                }
-  .rel.text      : { *(.rel.text)              }
-  .rela.text     : { *(.rela.text)     }
-  .rel.data      : { *(.rel.data)              }
-  .rela.data     : { *(.rela.data)     }
-  .rel.rodata    : { *(.rel.rodata)    }
-  .rela.rodata   : { *(.rela.rodata)   }
-  .rel.got       : { *(.rel.got)               }
-  .rela.got      : { *(.rela.got)              }
-  .rel.ctors     : { *(.rel.ctors)     }
-  .rela.ctors    : { *(.rela.ctors)    }
-  .rel.dtors     : { *(.rel.dtors)     }
-  .rela.dtors    : { *(.rela.dtors)    }
-  .rel.bss       : { *(.rel.bss)               }
-  .rela.bss      : { *(.rela.bss)              }
-  .rel.plt       : { *(.rel.plt)               }
-  .rela.plt      : { *(.rela.plt)              }
-  .init          : { *(.init)  }
-  .plt : { *(.plt) }
-  .text      :
-  {
-    /* WARNING - the following is hand-optimized to fit within */
-    /* the sector layout of our flash chips!   XXX FIXME XXX   */
-
-    cpu/mpc8xx/start.o (.text)
-    common/dlmalloc.o  (.text)
-    lib_generic/vsprintf.o     (.text)
-    lib_generic/crc32.o                (.text)
-
-    . = env_offset;
-    common/environment.o(.text)
-
-    *(.text)
-    *(.fixup)
-    *(.got1)
-  }
-  _etext = .;
-  PROVIDE (etext = .);
-  .rodata    :
-  {
-    *(.rodata)
-    *(.rodata1)
-    *(.rodata.str1.4)
-    *(.eh_frame)
-  }
-  .fini      : { *(.fini)    } =0
-  .ctors     : { *(.ctors)   }
-  .dtors     : { *(.dtors)   }
-
-  /* Read-write section, merged into data segment: */
-  . = (. + 0x0FFF) & 0xFFFFF000;
-  _erotext = .;
-  PROVIDE (erotext = .);
-  .reloc   :
-  {
-    *(.got)
-    _GOT2_TABLE_ = .;
-    *(.got2)
-    _FIXUP_TABLE_ = .;
-    *(.fixup)
-  }
-  __got2_entries = (_FIXUP_TABLE_ - _GOT2_TABLE_) >>2;
-  __fixup_entries = (. - _FIXUP_TABLE_)>>2;
-
-  .data    :
-  {
-    *(.data)
-    *(.data1)
-    *(.sdata)
-    *(.sdata2)
-    *(.dynamic)
-    CONSTRUCTORS
-  }
-  _edata  =  .;
-  PROVIDE (edata = .);
-
-  __u_boot_cmd_start = .;
-  .u_boot_cmd : { *(.u_boot_cmd) }
-  __u_boot_cmd_end = .;
-
-
-  __start___ex_table = .;
-  __ex_table : { *(__ex_table) }
-  __stop___ex_table = .;
-
-  . = ALIGN(4096);
-  __init_begin = .;
-  .text.init : { *(.text.init) }
-  .data.init : { *(.data.init) }
-  . = ALIGN(4096);
-  __init_end = .;
-
-  __bss_start = .;
-  .bss       :
-  {
-   *(.sbss) *(.scommon)
-   *(.dynbss)
-   *(.bss)
-   *(COMMON)
-  }
-  _end = . ;
-  PROVIDE (end = .);
-}
index c56c269daecc0418412354ec978b4b2967cbe347..7a3d63a4bf30c5326d0b9d67d26750cb8b785b8e 100644 (file)
@@ -31,6 +31,7 @@
 #include <watchdog.h>
 
 unsigned long get_dram_size (void);
+void sdram_init(void);
 
 /*
  * Macros to transform values
@@ -153,6 +154,13 @@ int checkboard (void)
 
 long int initdram (int board_type)
 {
+       /*
+        * ToDo: Move the asm init routine sdram_init() to this C file,
+        * or even better use some common ppc4xx code available
+        * in cpu/ppc4xx
+        */
+       sdram_init();
+
        return get_dram_size ();
 }
 
index f753df851aadcd8993cb4f33ae7a5fa50157b8d5..a282c9ae228d4957c27a72267544fa3a9dc82af9 100644 (file)
@@ -42,7 +42,3 @@
        .globl ext_bus_cntlr_init
 ext_bus_cntlr_init:
        blr
-
-       .globl sdram_init
-sdram_init:
-       blr
index 4ab853f8f566ad5f5fe9895c0b4f5d136aa61e19..1239ea0bd9aa698ba27618bc6086b094c35bc26d 100644 (file)
@@ -213,51 +213,6 @@ long int initdram (int board_type)
        return detect_sdram_size();
 }
 
-#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;
-       unsigned long msr;
-       unsigned long total_kbytes;
-
-       total_kbytes = detect_sdram_size();
-
-       msr = mfmsr();
-       mtmsr(msr & ~(MSR_EE));
-
-       for (k = 0; k < total_kbytes ;
-            ++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");
-       mtmsr(msr);
-
-       return 0;
-}
-#endif
-
 static int default_env_var(char *buf, char *var)
 {
        char *ptr;
index 3a98d2b944b17b8853766cbb6bfcd6f4b136f58d..a48e98e50911f8aa31fe7e922b9290da61e4ae44 100644 (file)
@@ -1,4 +1,7 @@
 /*
+ * (C) Copyright 2008
+ * Stuart Wood, Lab X Technologies <stuart.wood@labxtechnologies.com>
+ *
  * (C) Copyright 2004
  * Jian Zhang, Texas Instruments, jzhang@ti.com.
 
 #error CONFIG_INFERNO not supported yet
 #endif
 
+#ifndef CFG_ENV_RANGE
+#define CFG_ENV_RANGE  CFG_ENV_SIZE
+#endif
+
 int nand_legacy_rw (struct nand_chip* nand, int cmd,
            size_t start, size_t len,
            size_t * retlen, u_char * buf);
@@ -148,35 +155,71 @@ int env_init(void)
  * The legacy NAND code saved the environment in the first NAND device i.e.,
  * nand_dev_desc + 0. This is also the behaviour using the new NAND code.
  */
+int writeenv(size_t offset, u_char *buf)
+{
+       size_t end = offset + CFG_ENV_RANGE;
+       size_t amount_saved = 0;
+       size_t blocksize;
+
+       u_char *char_ptr;
+
+       blocksize = nand_info[0].erasesize;
+
+       while (amount_saved < CFG_ENV_SIZE && offset < end) {
+               if (nand_block_isbad(&nand_info[0], offset)) {
+                       offset += blocksize;
+               } else {
+                       char_ptr = &buf[amount_saved];
+                       if (nand_write(&nand_info[0], offset, &blocksize,
+                                       char_ptr))
+                               return 1;
+                       offset += blocksize;
+                       amount_saved += blocksize;
+               }
+       }
+       if (amount_saved != CFG_ENV_SIZE)
+               return 1;
+
+       return 0;
+}
 #ifdef CFG_ENV_OFFSET_REDUND
 int saveenv(void)
 {
        size_t total;
        int ret = 0;
+       nand_erase_options_t nand_erase_options;
 
        env_ptr->flags++;
        total = CFG_ENV_SIZE;
 
+       nand_erase_options.length = CFG_ENV_RANGE;
+       nand_erase_options.quiet = 0;
+       nand_erase_options.jffs2 = 0;
+       nand_erase_options.scrub = 0;
+
+       if (CFG_ENV_RANGE < CFG_ENV_SIZE)
+               return 1;
        if(gd->env_valid == 1) {
-               puts ("Erasing redundant Nand...");
-               if (nand_erase(&nand_info[0],
-                              CFG_ENV_OFFSET_REDUND, CFG_ENV_SIZE))
+               puts ("Erasing redundant Nand...\n");
+               nand_erase_options.offset = CFG_ENV_OFFSET_REDUND;
+               if (nand_erase_opts(&nand_info[0], &nand_erase_options))
                        return 1;
+
                puts ("Writing to redundant Nand... ");
-               ret = nand_write(&nand_info[0], CFG_ENV_OFFSET_REDUND, &total,
-                                (u_char*) env_ptr);
+               ret = writeenv(CFG_ENV_OFFSET_REDUND, (u_char *) env_ptr);
        } else {
-               puts ("Erasing Nand...");
-               if (nand_erase(&nand_info[0],
-                              CFG_ENV_OFFSET, CFG_ENV_SIZE))
+               puts ("Erasing Nand...\n");
+               nand_erase_options.offset = CFG_ENV_OFFSET;
+               if (nand_erase_opts(&nand_info[0], &nand_erase_options))
                        return 1;
 
                puts ("Writing to Nand... ");
-               ret = nand_write(&nand_info[0], CFG_ENV_OFFSET, &total,
-                                (u_char*) env_ptr);
+               ret = writeenv(CFG_ENV_OFFSET, (u_char *) env_ptr);
        }
-       if (ret || total != CFG_ENV_SIZE)
+       if (ret) {
+               puts("FAILED!\n");
                return 1;
+       }
 
        puts ("done\n");
        gd->env_valid = (gd->env_valid == 2 ? 1 : 2);
@@ -188,15 +231,24 @@ int saveenv(void)
        size_t total;
        int ret = 0;
 
-       puts ("Erasing Nand...");
-       if (nand_erase(&nand_info[0], CFG_ENV_OFFSET, CFG_ENV_SIZE))
+       nand_erase_options.length = CFG_ENV_RANGE;
+       nand_erase_options.quiet = 0;
+       nand_erase_options.jffs2 = 0;
+       nand_erase_options.scrub = 0;
+       nand_erase_options.offset = CFG_ENV_OFFSET;
+
+       if (CFG_ENV_RANGE < CFG_ENV_SIZE)
+               return 1;
+       puts ("Erasing Nand...\n");
+       if (nand_erase_opts(&nand_info[0], &nand_erase_options))
                return 1;
 
        puts ("Writing to Nand... ");
        total = CFG_ENV_SIZE;
-       ret = nand_write(&nand_info[0], CFG_ENV_OFFSET, &total, (u_char*)env_ptr);
-       if (ret || total != CFG_ENV_SIZE)
+       if (writeenv(CFG_ENV_OFFSET, env_ptr)) {
+               puts("FAILED!\n");
                return 1;
+       }
 
        puts ("done\n");
        return ret;
@@ -204,6 +256,33 @@ int saveenv(void)
 #endif /* CFG_ENV_OFFSET_REDUND */
 #endif /* CMD_SAVEENV */
 
+int readenv (size_t offset, u_char * buf)
+{
+       size_t end = offset + CFG_ENV_RANGE;
+       size_t amount_loaded = 0;
+       size_t blocksize;
+
+       u_char *char_ptr;
+
+       blocksize = nand_info[0].erasesize;
+
+       while (amount_loaded < CFG_ENV_SIZE && offset < end) {
+               if (nand_block_isbad(&nand_info[0], offset)) {
+                       offset += blocksize;
+               } else {
+                       char_ptr = &buf[amount_loaded];
+                       if (nand_read(&nand_info[0], offset, &blocksize, char_ptr))
+                               return 1;
+                       offset += blocksize;
+                       amount_loaded += blocksize;
+               }
+       }
+       if (amount_loaded != CFG_ENV_SIZE)
+               return 1;
+
+       return 0;
+}
+
 #ifdef CFG_ENV_OFFSET_REDUND
 void env_relocate_spec (void)
 {
@@ -217,10 +296,10 @@ void env_relocate_spec (void)
        tmp_env1 = (env_t *) malloc(CFG_ENV_SIZE);
        tmp_env2 = (env_t *) malloc(CFG_ENV_SIZE);
 
-       nand_read(&nand_info[0], CFG_ENV_OFFSET, &total,
-                 (u_char*) tmp_env1);
-       nand_read(&nand_info[0], CFG_ENV_OFFSET_REDUND, &total,
-                 (u_char*) tmp_env2);
+       if (readenv(CFG_ENV_OFFSET, (u_char *) tmp_env1))
+               puts("No Valid Environment Area Found\n");
+       if (readenv(CFG_ENV_OFFSET_REDUND, (u_char *) tmp_env2))
+               puts("No Valid Reundant Environment Area Found\n");
 
        crc1_ok = (crc32(0, tmp_env1->data, ENV_SIZE) == tmp_env1->crc);
        crc2_ok = (crc32(0, tmp_env2->data, ENV_SIZE) == tmp_env2->crc);
@@ -269,7 +348,7 @@ void env_relocate_spec (void)
        int ret;
 
        total = CFG_ENV_SIZE;
-       ret = nand_read(&nand_info[0], CFG_ENV_OFFSET, &total, (u_char*)env_ptr);
+       ret = readenv(CFG_ENV_OFFSET, env_ptr);
        if (ret || total != CFG_ENV_SIZE)
                return use_default();
 
index 98733834e0621627080572a08797756066bbf80b..2b7e753ece156e8fdfa83fb2e1d6e55b10d13289 100644 (file)
 #include <watchdog.h>
 #include <command.h>
 #include <asm/cache.h>
+#include <asm/io.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
-struct cpu_type {
-       char name[15];
-       u32 soc_ver;
+struct cpu_type cpu_type_list [] = {
+       CPU_TYPE_ENTRY(8533, 8533),
+       CPU_TYPE_ENTRY(8533, 8533_E),
+       CPU_TYPE_ENTRY(8540, 8540),
+       CPU_TYPE_ENTRY(8541, 8541),
+       CPU_TYPE_ENTRY(8541, 8541_E),
+       CPU_TYPE_ENTRY(8543, 8543),
+       CPU_TYPE_ENTRY(8543, 8543_E),
+       CPU_TYPE_ENTRY(8544, 8544),
+       CPU_TYPE_ENTRY(8544, 8544_E),
+       CPU_TYPE_ENTRY(8545, 8545),
+       CPU_TYPE_ENTRY(8545, 8545_E),
+       CPU_TYPE_ENTRY(8547, 8547_E),
+       CPU_TYPE_ENTRY(8548, 8548),
+       CPU_TYPE_ENTRY(8548, 8548_E),
+       CPU_TYPE_ENTRY(8555, 8555),
+       CPU_TYPE_ENTRY(8555, 8555_E),
+       CPU_TYPE_ENTRY(8560, 8560),
+       CPU_TYPE_ENTRY(8567, 8567),
+       CPU_TYPE_ENTRY(8567, 8567_E),
+       CPU_TYPE_ENTRY(8568, 8568),
+       CPU_TYPE_ENTRY(8568, 8568_E),
+       CPU_TYPE_ENTRY(8572, 8572),
+       CPU_TYPE_ENTRY(8572, 8572_E),
 };
 
-#define CPU_TYPE_ENTRY(x) {#x, SVR_##x}
+struct cpu_type *identify_cpu(uint ver)
+{
+       int i;
+       for (i = 0; i < ARRAY_SIZE(cpu_type_list); i++)
+               if (cpu_type_list[i].soc_ver == ver)
+                       return &cpu_type_list[i];
 
-struct cpu_type cpu_type_list [] = {
-       CPU_TYPE_ENTRY(8533),
-       CPU_TYPE_ENTRY(8533_E),
-       CPU_TYPE_ENTRY(8540),
-       CPU_TYPE_ENTRY(8541),
-       CPU_TYPE_ENTRY(8541_E),
-       CPU_TYPE_ENTRY(8543),
-       CPU_TYPE_ENTRY(8543_E),
-       CPU_TYPE_ENTRY(8544),
-       CPU_TYPE_ENTRY(8544_E),
-       CPU_TYPE_ENTRY(8545),
-       CPU_TYPE_ENTRY(8545_E),
-       CPU_TYPE_ENTRY(8547_E),
-       CPU_TYPE_ENTRY(8548),
-       CPU_TYPE_ENTRY(8548_E),
-       CPU_TYPE_ENTRY(8555),
-       CPU_TYPE_ENTRY(8555_E),
-       CPU_TYPE_ENTRY(8560),
-       CPU_TYPE_ENTRY(8567),
-       CPU_TYPE_ENTRY(8567_E),
-       CPU_TYPE_ENTRY(8568),
-       CPU_TYPE_ENTRY(8568_E),
-       CPU_TYPE_ENTRY(8572),
-       CPU_TYPE_ENTRY(8572_E),
-};
+       return NULL;
+}
 
 int checkcpu (void)
 {
@@ -74,9 +78,13 @@ int checkcpu (void)
        uint fam;
        uint ver;
        uint major, minor;
-       int i;
-       u32 ddr_ratio;
+       struct cpu_type *cpu;
+#ifdef CONFIG_DDR_CLK_FREQ
        volatile ccsr_gur_t *gur = (void *)(CFG_MPC85xx_GUTS_ADDR);
+       u32 ddr_ratio = ((gur->porpllsr) & 0x00003e00) >> 9;
+#else
+       u32 ddr_ratio = 0;
+#endif
 
        svr = get_svr();
        ver = SVR_SOC_VER(svr);
@@ -85,14 +93,15 @@ int checkcpu (void)
 
        puts("CPU:   ");
 
-       for (i = 0; i < ARRAY_SIZE(cpu_type_list); i++)
-               if (cpu_type_list[i].soc_ver == ver) {
-                       puts(cpu_type_list[i].name);
-                       break;
-               }
+       cpu = identify_cpu(ver);
+       if (cpu) {
+               puts(cpu->name);
 
-       if (i == ARRAY_SIZE(cpu_type_list))
+               if (svr & 0x80000)
+                       puts("E");
+       } else {
                puts("Unknown");
+       }
 
        printf(", Version: %d.%d, (0x%08x)\n", major, minor, svr);
 
@@ -118,7 +127,7 @@ int checkcpu (void)
        puts("Clock Configuration:\n");
        printf("       CPU:%4lu MHz, ", DIV_ROUND_UP(sysinfo.freqProcessor,1000000));
        printf("CCB:%4lu MHz,\n", DIV_ROUND_UP(sysinfo.freqSystemBus,1000000));
-       ddr_ratio = ((gur->porpllsr) & 0x00003e00) >> 9;
+
        switch (ddr_ratio) {
        case 0x0:
                printf("       DDR:%4lu MHz (%lu MT/s data rate), ",
@@ -159,7 +168,7 @@ int checkcpu (void)
        }
 
 #ifdef CONFIG_CPM2
-       printf("CPM:  %lu Mhz\n", sysinfo.freqSystemBus / 1000000);
+       printf("CPM:   %lu Mhz\n", sysinfo.freqSystemBus / 1000000);
 #endif
 
        puts("L1:    D-cache 32 kB enabled\n       I-cache 32 kB enabled\n");
@@ -279,3 +288,68 @@ int dma_xfer(void *dest, uint count, void *src) {
        return dma_check();
 }
 #endif
+/*
+ * Configures a UPM. Currently, the loop fields in MxMR (RLF, WLF and TLF)
+ * are hardcoded as "1"."size" is the number or entries, not a sizeof.
+ */
+void upmconfig (uint upm, uint * table, uint size)
+{
+       int i, mdr, mad, old_mad = 0;
+       volatile u32 *mxmr;
+       volatile ccsr_lbc_t *lbc = (void *)(CFG_MPC85xx_LBC_ADDR);
+       int loopval = 0x00004440;
+       volatile u32 *brp,*orp;
+       volatile u8* dummy = NULL;
+       int upmmask;
+
+       switch (upm) {
+       case UPMA:
+               mxmr = &lbc->mamr;
+               upmmask = BR_MS_UPMA;
+               break;
+       case UPMB:
+               mxmr = &lbc->mbmr;
+               upmmask = BR_MS_UPMB;
+               break;
+       case UPMC:
+               mxmr = &lbc->mcmr;
+               upmmask = BR_MS_UPMC;
+               break;
+       default:
+               printf("%s: Bad UPM index %d to configure\n", __FUNCTION__, upm);
+               hang();
+       }
+
+       /* Find the address for the dummy write transaction */
+       for (brp = &lbc->br0, orp = &lbc->or0, i = 0; i < 8;
+                i++, brp += 2, orp += 2) {
+               
+               /* Look for a valid BR with selected UPM */
+               if ((in_be32(brp) & (BR_V | upmmask)) == (BR_V | upmmask)) {
+                       dummy = (volatile u8*)(in_be32(brp) >> BR_BA_SHIFT);
+                       break;
+               }
+       }
+
+       if (i == 8) {
+               printf("Error: %s() could not find matching BR\n", __FUNCTION__);
+               hang();
+       }
+
+       for (i = 0; i < size; i++) {
+               /* 1 */
+               out_be32(mxmr, loopval | 0x10000000 | i); /* OP_WRITE */
+               /* 2 */
+               out_be32(&lbc->mdr, table[i]);
+               /* 3 */
+               mdr = in_be32(&lbc->mdr);
+               /* 4 */
+               *(volatile u8 *)dummy = 0;
+               /* 5 */
+               do {
+                       mad = in_be32(mxmr) & 0x3f;
+               } while (mad <= old_mad && !(!mad && i == (size-1)));
+               old_mad = mad;
+       }
+       out_be32(mxmr, loopval); /* OP_NORMAL */
+}
index e3240b519ee8d5d44fe716d6a74edbcf88458565..736aef17256873ad1c6f9999a2da3e9f5457cbbe 100644 (file)
@@ -148,6 +148,12 @@ void cpu_init_early_f(void)
        }
 #endif
 
+       /* Pointer is writable since we allocated a register for it */
+       gd = (gd_t *) (CFG_INIT_RAM_ADDR + CFG_GBL_DATA_OFFSET);
+
+       /* Clear initial global data */
+       memset ((void *) gd, 0, sizeof (gd_t));
+
        init_laws();
        invalidate_tlb(0);
        init_tlbs();
@@ -168,12 +174,6 @@ void cpu_init_f (void)
        disable_tlb(14);
        disable_tlb(15);
 
-       /* Pointer is writable since we allocated a register for it */
-       gd = (gd_t *) (CFG_INIT_RAM_ADDR + CFG_GBL_DATA_OFFSET);
-
-       /* Clear initial global data */
-       memset ((void *) gd, 0, sizeof (gd_t));
-
 #ifdef CONFIG_CPM2
        config_8560_ioports((ccsr_cpm_t *)CFG_MPC85xx_CPM_ADDR);
 #endif
@@ -254,16 +254,7 @@ void cpu_init_f (void)
 
 int cpu_init_r(void)
 {
-#ifdef CONFIG_CLEAR_LAW0
-#ifdef CONFIG_FSL_LAW
-       disable_law(0);
-#else
-       volatile ccsr_local_ecm_t *ecm = (void *)(CFG_MPC85xx_ECM_ADDR);
-
-       /* clear alternate boot location LAW (used for sdram, or ddr bank) */
-       ecm->lawar0 = 0;
-#endif
-#endif
+       puts ("L2:    ");
 
 #if defined(CONFIG_L2_CACHE)
        volatile ccsr_l2cache_t *l2cache = (void *)CFG_MPC85xx_L2_ADDR;
@@ -281,17 +272,17 @@ int cpu_init_r(void)
        case 0x20000000:
                if (ver == SVR_8548 || ver == SVR_8548_E ||
                    ver == SVR_8544 || ver == SVR_8568_E) {
-                       printf ("L2 cache 512KB:");
+                       puts ("512 KB ");
                        /* set L2E=1, L2I=1, & L2SRAM=0 */
                        cache_ctl = 0xc0000000;
                } else {
-                       printf ("L2 cache 256KB:");
+                       puts("256 KB ");
                        /* set L2E=1, L2I=1, & L2BLKSZ=2 (256 Kbyte) */
                        cache_ctl = 0xc8000000;
                }
                break;
        case 0x10000000:
-               printf ("L2 cache 256KB:");
+               puts("256 KB ");
                if (ver == SVR_8544 || ver == SVR_8544_E) {
                        cache_ctl = 0xc0000000; /* set L2E=1, L2I=1, & L2SRAM=0 */
                }
@@ -299,18 +290,18 @@ int cpu_init_r(void)
        case 0x30000000:
        case 0x00000000:
        default:
-               printf ("L2 cache unknown size (0x%08x)\n", cache_ctl);
+               printf(" unknown size (0x%08x)\n", cache_ctl);
                return -1;
        }
 
        if (l2cache->l2ctl & 0x80000000) {
-               printf(" already enabled.");
+               puts("already enabled");
                l2srbar = l2cache->l2srbar0;
 #ifdef CFG_INIT_L2_ADDR
                if (l2cache->l2ctl & 0x00010000 && l2srbar >= CFG_FLASH_BASE) {
                        l2srbar = CFG_INIT_L2_ADDR;
                        l2cache->l2srbar0 = l2srbar;
-                       printf("  Moving to 0x%08x", CFG_INIT_L2_ADDR);
+                       printf("moving to 0x%08x", CFG_INIT_L2_ADDR);
                }
 #endif /* CFG_INIT_L2_ADDR */
                puts("\n");
@@ -318,10 +309,10 @@ int cpu_init_r(void)
                asm("msync;isync");
                l2cache->l2ctl = cache_ctl; /* invalidate & enable */
                asm("msync;isync");
-               printf(" enabled\n");
+               puts("enabled\n");
        }
 #else
-       printf("L2 cache: disabled\n");
+       puts("disabled\n");
 #endif
 #ifdef CONFIG_QE
        uint qe_base = CFG_IMMR + 0x00080000; /* QE immr base */
index bb87740baa6a41fc2fe80ae73290bdbeecd59b85..92952e6d6ef6679446180100023e6f401aa69ada 100644 (file)
@@ -26,6 +26,7 @@
 #include <common.h>
 #include <libfdt.h>
 #include <fdt_support.h>
+#include <asm/processor.h>
 
 extern void ft_qe_setup(void *blob);
 #ifdef CONFIG_MP
@@ -77,6 +78,131 @@ void ft_fixup_cpu(void *blob, u64 memory_limit)
 }
 #endif
 
+#ifdef CONFIG_L2_CACHE
+/* return size in kilobytes */
+static inline u32 l2cache_size(void)
+{
+       volatile ccsr_l2cache_t *l2cache = (void *)CFG_MPC85xx_L2_ADDR;
+       volatile u32 l2siz_field = (l2cache->l2ctl >> 28) & 0x3;
+       u32 ver = SVR_SOC_VER(get_svr());
+
+       switch (l2siz_field) {
+       case 0x0:
+               break;
+       case 0x1:
+               if (ver == SVR_8540 || ver == SVR_8560   ||
+                   ver == SVR_8541 || ver == SVR_8541_E ||
+                   ver == SVR_8555 || ver == SVR_8555_E)
+                       return 128;
+               else
+                       return 256;
+               break;
+       case 0x2:
+               if (ver == SVR_8540 || ver == SVR_8560   ||
+                   ver == SVR_8541 || ver == SVR_8541_E ||
+                   ver == SVR_8555 || ver == SVR_8555_E)
+                       return 256;
+               else
+                       return 512;
+               break;
+       case 0x3:
+               return 1024;
+               break;
+       }
+
+       return 0;
+}
+
+static inline void ft_fixup_l2cache(void *blob)
+{
+       int len, off;
+       u32 *ph;
+       struct cpu_type *cpu = identify_cpu(SVR_SOC_VER(get_svr()));
+       char compat_buf[38];
+
+       const u32 line_size = 32;
+       const u32 num_ways = 8;
+       const u32 size = l2cache_size() * 1024;
+       const u32 num_sets = size / (line_size * num_ways);
+
+       off = fdt_node_offset_by_prop_value(blob, -1, "device_type", "cpu", 4);
+       if (off < 0) {
+               debug("no cpu node fount\n");
+               return;
+       }
+
+       ph = (u32 *)fdt_getprop(blob, off, "next-level-cache", 0);
+
+       if (ph == NULL) {
+               debug("no next-level-cache property\n");
+               return ;
+       }
+
+       off = fdt_node_offset_by_phandle(blob, *ph);
+       if (off < 0) {
+               printf("%s: %s\n", __func__, fdt_strerror(off));
+               return ;
+       }
+
+       if (cpu) {
+               len = sprintf(compat_buf, "fsl,mpc%s-l2-cache-controller",
+                               cpu->name);
+               sprintf(&compat_buf[len + 1], "cache");
+       }
+       fdt_setprop(blob, off, "cache-unified", NULL, 0);
+       fdt_setprop_cell(blob, off, "cache-block-size", line_size);
+       fdt_setprop_cell(blob, off, "cache-line-size", line_size);
+       fdt_setprop_cell(blob, off, "cache-size", size);
+       fdt_setprop_cell(blob, off, "cache-sets", num_sets);
+       fdt_setprop_cell(blob, off, "cache-level", 2);
+       fdt_setprop(blob, off, "compatible", compat_buf, sizeof(compat_buf));
+}
+#else
+#define ft_fixup_l2cache(x)
+#endif
+
+static inline void ft_fixup_cache(void *blob)
+{
+       int off;
+
+       off = fdt_node_offset_by_prop_value(blob, -1, "device_type", "cpu", 4);
+
+       while (off != -FDT_ERR_NOTFOUND) {
+               u32 l1cfg0 = mfspr(SPRN_L1CFG0);
+               u32 l1cfg1 = mfspr(SPRN_L1CFG1);
+               u32 isize, iline_size, inum_sets, inum_ways;
+               u32 dsize, dline_size, dnum_sets, dnum_ways;
+
+               /* d-side config */
+               dsize = (l1cfg0 & 0x7ff) * 1024;
+               dnum_ways = ((l1cfg0 >> 11) & 0xff) + 1;
+               dline_size = (((l1cfg0 >> 23) & 0x3) + 1) * 32;
+               dnum_sets = dsize / (dline_size * dnum_ways);
+
+               fdt_setprop_cell(blob, off, "d-cache-block-size", dline_size);
+               fdt_setprop_cell(blob, off, "d-cache-line-size", dline_size);
+               fdt_setprop_cell(blob, off, "d-cache-size", dsize);
+               fdt_setprop_cell(blob, off, "d-cache-sets", dnum_sets);
+
+               /* i-side config */
+               isize = (l1cfg1 & 0x7ff) * 1024;
+               inum_ways = ((l1cfg1 >> 11) & 0xff) + 1;
+               iline_size = (((l1cfg1 >> 23) & 0x3) + 1) * 32;
+               inum_sets = isize / (iline_size * inum_ways);
+
+               fdt_setprop_cell(blob, off, "i-cache-block-size", iline_size);
+               fdt_setprop_cell(blob, off, "i-cache-line-size", iline_size);
+               fdt_setprop_cell(blob, off, "i-cache-size", isize);
+               fdt_setprop_cell(blob, off, "i-cache-sets", inum_sets);
+
+               off = fdt_node_offset_by_prop_value(blob, off,
+                               "device_type", "cpu", 4);
+       }
+
+       ft_fixup_l2cache(blob);
+}
+
+
 void ft_cpu_setup(void *blob, bd_t *bd)
 {
 #if defined(CONFIG_HAS_ETH0) || defined(CONFIG_HAS_ETH1) ||\
@@ -114,4 +240,6 @@ void ft_cpu_setup(void *blob, bd_t *bd)
 #ifdef CONFIG_MP
        ft_fixup_cpu(blob, (u64)bd->bi_memstart + (u64)bd->bi_memsize);
 #endif
+
+       ft_fixup_cache(blob);
 }
index e3a824999c93955a91ab48041e1d85a5d02641a1..8e321eb07320fc3133c8179afb6b49bdc5951f3a 100644 (file)
@@ -1090,7 +1090,7 @@ setup_laws_and_tlbs(unsigned int memsize)
         */
 
 #ifdef CONFIG_FSL_LAW
-       set_law(1, CFG_DDR_SDRAM_BASE, law_size, LAW_TRGT_IF_DDR);
+       set_next_law(CFG_DDR_SDRAM_BASE, law_size, LAW_TRGT_IF_DDR);
 #endif
 
        /*
index 2381fb0654c09c4752b12c155a69d315a6a824e6..fd36658cb077a2bd8c57a719c089d02515bb0184 100644 (file)
@@ -50,10 +50,12 @@ int (*debugger_exception_handler)(struct pt_regs *) = 0;
 extern unsigned long search_exception_table(unsigned long);
 
 /*
- * End of memory as shown by board info and determined by DDR setup.
+ * End of addressable memory.  This may be less than the actual
+ * amount of memory on the system if we're unable to keep all
+ * the memory mapped in.
  */
-#define END_OF_MEM     (gd->bd->bi_memstart + gd->bd->bi_memsize)
-
+extern ulong get_effective_memsize(void);
+#define END_OF_MEM (gd->bd->bi_memstart + get_effective_memsize())
 
 static __inline__ void set_tsr(unsigned long val)
 {
index 0efd855a396ac3ed59fea7d5a3068440a94cbf2f..78ba1ea8e5aafbfd761456c69aa5f6723dd3e617 100644 (file)
@@ -119,8 +119,5 @@ void cpu_init_f(void)
  */
 int cpu_init_r(void)
 {
-#ifdef CONFIG_FSL_LAW
-       disable_law(0);
-#endif
        return 0;
 }
index 5cc0c266f06ce9cd62cd1894a3c1958226fee236..e26db7c3bf59083587c7fb3b9a6891859f6468db 100644 (file)
@@ -1183,7 +1183,7 @@ spd_sdram(void)
                 * Set up LAWBAR for DDR 1 space.
                 */
 #ifdef CONFIG_FSL_LAW
-               set_law(1, CFG_DDR_SDRAM_BASE, law_size_interleaved, LAW_TRGT_IF_DDR_INTRLV);
+               set_next_law(CFG_DDR_SDRAM_BASE, law_size_interleaved, LAW_TRGT_IF_DDR_INTRLV);
 #endif
                debug("Interleaved memory size is 0x%08lx\n", memsize_total);
 
@@ -1238,7 +1238,7 @@ spd_sdram(void)
                 * Set up LAWBAR for DDR 1 space.
                 */
 #ifdef CONFIG_FSL_LAW
-               set_law(1, CFG_DDR_SDRAM_BASE, law_size_ddr1, LAW_TRGT_IF_DDR_1);
+               set_next_law(CFG_DDR_SDRAM_BASE, law_size_ddr1, LAW_TRGT_IF_DDR_1);
 #endif
        }
 
@@ -1265,7 +1265,7 @@ spd_sdram(void)
                 * Set up LAWBAR for DDR 2 space.
                 */
 #ifdef CONFIG_FSL_LAW
-               set_law(8,
+               set_next_law(
                        (ddr1_enabled ? (memsize_ddr1 * 1024 * 1024) : CFG_DDR_SDRAM_BASE),
                        law_size_ddr2, LAW_TRGT_IF_DDR_2);
 #endif
index 04c2e1331b645c531c1b3a74209f996031e5b1b9..5695c3e453ae9bc6f852cea5b0b5737dbb690d20 100644 (file)
@@ -43,7 +43,13 @@ int (*debugger_exception_handler)(struct pt_regs *) = 0;
 /* Returns 0 if exception not found and fixup otherwise.  */
 extern unsigned long search_exception_table(unsigned long);
 
-#define END_OF_MEM (gd->bd->bi_memstart + gd->bd->bi_memsize)
+/*
+ * End of addressable memory.  This may be less than the actual
+ * amount of memory on the system if we're unable to keep all
+ * the memory mapped in.
+ */
+extern ulong get_effective_memsize(void);
+#define END_OF_MEM (gd->bd->bi_memstart + get_effective_memsize())
 
 /*
  * Trap & Exception support
index b9cf5cbfccaf0b8ebdfa4a32616c2ebd3674cbae..9efcedefed0a36e5c5994ed699b2cd1a77b33aac 100644 (file)
@@ -53,6 +53,8 @@
 #include <ppc4xx.h>
 #include <asm/mmu.h>
 
+#include "ecc.h"
+
 #if defined(CONFIG_SPD_EEPROM) &&                                      \
        (defined(CONFIG_440GP) || defined(CONFIG_440GX) ||              \
         defined(CONFIG_440EP) || defined(CONFIG_440GR))
@@ -79,157 +81,6 @@ void __spd_ddr_init_hang (void)
 }
 void spd_ddr_init_hang (void) __attribute__((weak, alias("__spd_ddr_init_hang")));
 
-/*-----------------------------------------------------------------------------
-  |  Memory Controller Options 0
-  +-----------------------------------------------------------------------------*/
-#define SDRAM_CFG0_DCEN                0x80000000      /* SDRAM Controller Enable      */
-#define SDRAM_CFG0_MCHK_MASK   0x30000000      /* Memory data errchecking mask */
-#define SDRAM_CFG0_MCHK_NON    0x00000000      /* No ECC generation            */
-#define SDRAM_CFG0_MCHK_GEN    0x20000000      /* ECC generation               */
-#define SDRAM_CFG0_MCHK_CHK    0x30000000      /* ECC generation and checking  */
-#define SDRAM_CFG0_RDEN                0x08000000      /* Registered DIMM enable       */
-#define SDRAM_CFG0_PMUD                0x04000000      /* Page management unit         */
-#define SDRAM_CFG0_DMWD_MASK   0x02000000      /* DRAM width mask              */
-#define SDRAM_CFG0_DMWD_32     0x00000000      /* 32 bits                      */
-#define SDRAM_CFG0_DMWD_64     0x02000000      /* 64 bits                      */
-#define SDRAM_CFG0_UIOS_MASK   0x00C00000      /* Unused IO State              */
-#define SDRAM_CFG0_PDP         0x00200000      /* Page deallocation policy     */
-
-/*-----------------------------------------------------------------------------
-  |  Memory Controller Options 1
-  +-----------------------------------------------------------------------------*/
-#define SDRAM_CFG1_SRE         0x80000000      /* Self-Refresh Entry           */
-#define SDRAM_CFG1_PMEN                0x40000000      /* Power Management Enable      */
-
-/*-----------------------------------------------------------------------------+
-  |  SDRAM DEVPOT Options
-  +-----------------------------------------------------------------------------*/
-#define SDRAM_DEVOPT_DLL       0x80000000
-#define SDRAM_DEVOPT_DS                0x40000000
-
-/*-----------------------------------------------------------------------------+
-  |  SDRAM MCSTS Options
-  +-----------------------------------------------------------------------------*/
-#define SDRAM_MCSTS_MRSC       0x80000000
-#define SDRAM_MCSTS_SRMS       0x40000000
-#define SDRAM_MCSTS_CIS                0x20000000
-
-/*-----------------------------------------------------------------------------
-  |  SDRAM Refresh Timer Register
-  +-----------------------------------------------------------------------------*/
-#define SDRAM_RTR_RINT_MASK      0xFFFF0000
-#define SDRAM_RTR_RINT_ENCODE(n)  (((n) << 16) & SDRAM_RTR_RINT_MASK)
-#define sdram_HZ_to_ns(hertz)    (1000000000/(hertz))
-
-/*-----------------------------------------------------------------------------+
-  |  SDRAM UABus Base Address Reg
-  +-----------------------------------------------------------------------------*/
-#define SDRAM_UABBA_UBBA_MASK  0x0000000F
-
-/*-----------------------------------------------------------------------------+
-  |  Memory Bank 0-7 configuration
-  +-----------------------------------------------------------------------------*/
-#define SDRAM_BXCR_SDBA_MASK   0xff800000        /* Base address             */
-#define SDRAM_BXCR_SDSZ_MASK   0x000e0000        /* Size                     */
-#define SDRAM_BXCR_SDSZ_8      0x00020000        /*   8M                     */
-#define SDRAM_BXCR_SDSZ_16     0x00040000        /*  16M                     */
-#define SDRAM_BXCR_SDSZ_32     0x00060000        /*  32M                     */
-#define SDRAM_BXCR_SDSZ_64     0x00080000        /*  64M                     */
-#define SDRAM_BXCR_SDSZ_128    0x000a0000        /* 128M                     */
-#define SDRAM_BXCR_SDSZ_256    0x000c0000        /* 256M                     */
-#define SDRAM_BXCR_SDSZ_512    0x000e0000        /* 512M                     */
-#define SDRAM_BXCR_SDAM_MASK   0x0000e000        /* Addressing mode          */
-#define SDRAM_BXCR_SDAM_1      0x00000000        /*   Mode 1                 */
-#define SDRAM_BXCR_SDAM_2      0x00002000        /*   Mode 2                 */
-#define SDRAM_BXCR_SDAM_3      0x00004000        /*   Mode 3                 */
-#define SDRAM_BXCR_SDAM_4      0x00006000        /*   Mode 4                 */
-#define SDRAM_BXCR_SDBE                0x00000001        /* Memory Bank Enable       */
-
-/*-----------------------------------------------------------------------------+
-  |  SDRAM TR0 Options
-  +-----------------------------------------------------------------------------*/
-#define SDRAM_TR0_SDWR_MASK    0x80000000
-#define         SDRAM_TR0_SDWR_2_CLK   0x00000000
-#define         SDRAM_TR0_SDWR_3_CLK   0x80000000
-#define SDRAM_TR0_SDWD_MASK    0x40000000
-#define         SDRAM_TR0_SDWD_0_CLK   0x00000000
-#define         SDRAM_TR0_SDWD_1_CLK   0x40000000
-#define SDRAM_TR0_SDCL_MASK    0x01800000
-#define         SDRAM_TR0_SDCL_2_0_CLK 0x00800000
-#define         SDRAM_TR0_SDCL_2_5_CLK 0x01000000
-#define         SDRAM_TR0_SDCL_3_0_CLK 0x01800000
-#define SDRAM_TR0_SDPA_MASK    0x000C0000
-#define         SDRAM_TR0_SDPA_2_CLK   0x00040000
-#define         SDRAM_TR0_SDPA_3_CLK   0x00080000
-#define         SDRAM_TR0_SDPA_4_CLK   0x000C0000
-#define SDRAM_TR0_SDCP_MASK    0x00030000
-#define         SDRAM_TR0_SDCP_2_CLK   0x00000000
-#define         SDRAM_TR0_SDCP_3_CLK   0x00010000
-#define         SDRAM_TR0_SDCP_4_CLK   0x00020000
-#define         SDRAM_TR0_SDCP_5_CLK   0x00030000
-#define SDRAM_TR0_SDLD_MASK    0x0000C000
-#define         SDRAM_TR0_SDLD_1_CLK   0x00000000
-#define         SDRAM_TR0_SDLD_2_CLK   0x00004000
-#define SDRAM_TR0_SDRA_MASK    0x0000001C
-#define         SDRAM_TR0_SDRA_6_CLK   0x00000000
-#define         SDRAM_TR0_SDRA_7_CLK   0x00000004
-#define         SDRAM_TR0_SDRA_8_CLK   0x00000008
-#define         SDRAM_TR0_SDRA_9_CLK   0x0000000C
-#define         SDRAM_TR0_SDRA_10_CLK  0x00000010
-#define         SDRAM_TR0_SDRA_11_CLK  0x00000014
-#define         SDRAM_TR0_SDRA_12_CLK  0x00000018
-#define         SDRAM_TR0_SDRA_13_CLK  0x0000001C
-#define SDRAM_TR0_SDRD_MASK    0x00000003
-#define         SDRAM_TR0_SDRD_2_CLK   0x00000001
-#define         SDRAM_TR0_SDRD_3_CLK   0x00000002
-#define         SDRAM_TR0_SDRD_4_CLK   0x00000003
-
-/*-----------------------------------------------------------------------------+
-  |  SDRAM TR1 Options
-  +-----------------------------------------------------------------------------*/
-#define SDRAM_TR1_RDSS_MASK    0xC0000000
-#define         SDRAM_TR1_RDSS_TR0     0x00000000
-#define         SDRAM_TR1_RDSS_TR1     0x40000000
-#define         SDRAM_TR1_RDSS_TR2     0x80000000
-#define         SDRAM_TR1_RDSS_TR3     0xC0000000
-#define SDRAM_TR1_RDSL_MASK    0x00C00000
-#define         SDRAM_TR1_RDSL_STAGE1  0x00000000
-#define         SDRAM_TR1_RDSL_STAGE2  0x00400000
-#define         SDRAM_TR1_RDSL_STAGE3  0x00800000
-#define SDRAM_TR1_RDCD_MASK    0x00000800
-#define         SDRAM_TR1_RDCD_RCD_0_0 0x00000000
-#define         SDRAM_TR1_RDCD_RCD_1_2 0x00000800
-#define SDRAM_TR1_RDCT_MASK    0x000001FF
-#define         SDRAM_TR1_RDCT_ENCODE(x)  (((x) << 0) & SDRAM_TR1_RDCT_MASK)
-#define         SDRAM_TR1_RDCT_DECODE(x)  (((x) & SDRAM_TR1_RDCT_MASK) >> 0)
-#define         SDRAM_TR1_RDCT_MIN     0x00000000
-#define         SDRAM_TR1_RDCT_MAX     0x000001FF
-
-/*-----------------------------------------------------------------------------+
-  |  SDRAM WDDCTR Options
-  +-----------------------------------------------------------------------------*/
-#define SDRAM_WDDCTR_WRCP_MASK 0xC0000000
-#define         SDRAM_WDDCTR_WRCP_0DEG   0x00000000
-#define         SDRAM_WDDCTR_WRCP_90DEG  0x40000000
-#define         SDRAM_WDDCTR_WRCP_180DEG 0x80000000
-#define SDRAM_WDDCTR_DCD_MASK  0x000001FF
-
-/*-----------------------------------------------------------------------------+
-  |  SDRAM CLKTR Options
-  +-----------------------------------------------------------------------------*/
-#define SDRAM_CLKTR_CLKP_MASK  0xC0000000
-#define         SDRAM_CLKTR_CLKP_0DEG    0x00000000
-#define         SDRAM_CLKTR_CLKP_90DEG   0x40000000
-#define         SDRAM_CLKTR_CLKP_180DEG  0x80000000
-#define SDRAM_CLKTR_DCDT_MASK  0x000001FF
-
-/*-----------------------------------------------------------------------------+
-  |  SDRAM DLYCAL Options
-  +-----------------------------------------------------------------------------*/
-#define SDRAM_DLYCAL_DLCV_MASK 0x000003FC
-#define         SDRAM_DLYCAL_DLCV_ENCODE(x) (((x)<<2) & SDRAM_DLYCAL_DLCV_MASK)
-#define         SDRAM_DLYCAL_DLCV_DECODE(x) (((x) & SDRAM_DLYCAL_DLCV_MASK)>>2)
-
 /*-----------------------------------------------------------------------------+
   |  General Definition
   +-----------------------------------------------------------------------------*/
@@ -296,10 +147,6 @@ static void program_tr0(unsigned long *dimm_populated,
                        unsigned long num_dimm_banks);
 static void program_tr1(void);
 
-#ifdef CONFIG_DDR_ECC
-static void program_ecc(unsigned long num_bytes);
-#endif
-
 static unsigned long program_bxcr(unsigned long *dimm_populated,
                                  unsigned char *iic0_dimm_addr,
                                  unsigned long num_dimm_banks);
@@ -418,7 +265,7 @@ long int spd_sdram(void) {
        /*
         * If ecc is enabled, initialize the parity bits.
         */
-       program_ecc(total_size);
+       ecc_init(CFG_SDRAM_BASE, total_size);
 #endif
 
        return total_size;
@@ -1402,45 +1249,4 @@ static unsigned long program_bxcr(unsigned long *dimm_populated,
 
        return(bank_base_addr);
 }
-
-#ifdef CONFIG_DDR_ECC
-static void program_ecc(unsigned long num_bytes)
-{
-       unsigned long bank_base_addr;
-       unsigned long current_address;
-       unsigned long end_address;
-       unsigned long address_increment;
-       unsigned long cfg0;
-
-       /*
-        * get Memory Controller Options 0 data
-        */
-       mfsdram(mem_cfg0, cfg0);
-
-       /*
-        * reset the bank_base address
-        */
-       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);
-
-               if ((cfg0 & SDRAM_CFG0_DMWD_MASK) == SDRAM_CFG0_DMWD_32)
-                       address_increment = 4;
-               else
-                       address_increment = 8;
-
-               current_address = (unsigned long)(bank_base_addr);
-               end_address = (unsigned long)(bank_base_addr) + num_bytes;
-
-               while (current_address < end_address) {
-                       *((unsigned long*)current_address) = 0x00000000;
-                       current_address += address_increment;
-               }
-
-               mtsdram(mem_cfg0, (cfg0 & ~SDRAM_CFG0_MCHK_MASK) |
-                       SDRAM_CFG0_MCHK_CHK);
-       }
-}
-#endif /* CONFIG_DDR_ECC */
 #endif /* CONFIG_SPD_EEPROM */
index ec76b718bccb1f2b86215259bc16f20f80f9d8fc..521491820d7a89e616352a3421397fb7f875719b 100644 (file)
@@ -3,9 +3,12 @@
  * This SPD SDRAM detection code supports AMCC PPC44x cpu's with a
  * DDR2 controller (non Denali Core). Those currently are:
  *
- * 405:                405EX
+ * 405:                405EX(r)
  * 440/460:    440SP/440SPe/460EX/460GT
  *
+ * Copyright (c) 2008 Nuovation System Designs, LLC
+ *   Grant Erickson <gerickson@nuovations.com>
+
  * (C) Copyright 2007-2008
  * Stefan Roese, DENX Software Engineering, sr@denx.de.
  *
@@ -45,6 +48,8 @@
 #include <asm/mmu.h>
 #include <asm/cache.h>
 
+#include "ecc.h"
+
 #if defined(CONFIG_SPD_EEPROM) &&                              \
        (defined(CONFIG_440SP) || defined(CONFIG_440SPE) || \
         defined(CONFIG_460EX) || defined(CONFIG_460GT))
@@ -3064,9 +3069,127 @@ static void ppc440sp_sdram_register_dump(void)
        dcr_data = mfdcr(SDRAM_R3BAS);
        printf("        MQ3_B0BAS       = 0x%08X\n", dcr_data);
 }
-#else
+#else /* !defined(DEBUG) */
 static void ppc440sp_sdram_register_dump(void)
 {
 }
-#endif
-#endif /* CONFIG_SPD_EEPROM */
+#endif /* defined(DEBUG) */
+#elif defined(CONFIG_405EX)
+/*-----------------------------------------------------------------------------
+ * Function:   initdram
+ * Description: Configures the PPC405EX(r) DDR1/DDR2 SDRAM memory
+ *             banks. The configuration is performed using static, compile-
+ *             time parameters.
+ *---------------------------------------------------------------------------*/
+long initdram(int board_type)
+{
+       /*
+        * Only run this SDRAM init code once. For NAND booting
+        * targets like Kilauea, we call initdram() early from the
+        * 4k NAND booting image (CONFIG_NAND_SPL) from nand_boot().
+        * Later on the NAND U-Boot image runs (CONFIG_NAND_U_BOOT)
+        * which calls initdram() again. This time the controller
+        * mustn't be reconfigured again since we're already running
+        * from SDRAM.
+        */
+#if !defined(CONFIG_NAND_U_BOOT) || defined(CONFIG_NAND_SPL)
+       unsigned long val;
+
+       /* Set Memory Bank Configuration Registers */
+
+       mtsdram(SDRAM_MB0CF, CFG_SDRAM0_MB0CF);
+       mtsdram(SDRAM_MB1CF, CFG_SDRAM0_MB1CF);
+       mtsdram(SDRAM_MB2CF, CFG_SDRAM0_MB2CF);
+       mtsdram(SDRAM_MB3CF, CFG_SDRAM0_MB3CF);
+
+       /* Set Memory Clock Timing Register */
+
+       mtsdram(SDRAM_CLKTR, CFG_SDRAM0_CLKTR);
+
+       /* Set Refresh Time Register */
+
+       mtsdram(SDRAM_RTR, CFG_SDRAM0_RTR);
+
+       /* Set SDRAM Timing Registers */
+
+       mtsdram(SDRAM_SDTR1, CFG_SDRAM0_SDTR1);
+       mtsdram(SDRAM_SDTR2, CFG_SDRAM0_SDTR2);
+       mtsdram(SDRAM_SDTR3, CFG_SDRAM0_SDTR3);
+
+       /* Set Mode and Extended Mode Registers */
+
+       mtsdram(SDRAM_MMODE, CFG_SDRAM0_MMODE);
+       mtsdram(SDRAM_MEMODE, CFG_SDRAM0_MEMODE);
+
+       /* Set Memory Controller Options 1 Register */
+
+       mtsdram(SDRAM_MCOPT1, CFG_SDRAM0_MCOPT1);
+
+       /* Set Manual Initialization Control Registers */
+
+       mtsdram(SDRAM_INITPLR0, CFG_SDRAM0_INITPLR0);
+       mtsdram(SDRAM_INITPLR1, CFG_SDRAM0_INITPLR1);
+       mtsdram(SDRAM_INITPLR2, CFG_SDRAM0_INITPLR2);
+       mtsdram(SDRAM_INITPLR3, CFG_SDRAM0_INITPLR3);
+       mtsdram(SDRAM_INITPLR4, CFG_SDRAM0_INITPLR4);
+       mtsdram(SDRAM_INITPLR5, CFG_SDRAM0_INITPLR5);
+       mtsdram(SDRAM_INITPLR6, CFG_SDRAM0_INITPLR6);
+       mtsdram(SDRAM_INITPLR7, CFG_SDRAM0_INITPLR7);
+       mtsdram(SDRAM_INITPLR8, CFG_SDRAM0_INITPLR8);
+       mtsdram(SDRAM_INITPLR9, CFG_SDRAM0_INITPLR9);
+       mtsdram(SDRAM_INITPLR10, CFG_SDRAM0_INITPLR10);
+       mtsdram(SDRAM_INITPLR11, CFG_SDRAM0_INITPLR11);
+       mtsdram(SDRAM_INITPLR12, CFG_SDRAM0_INITPLR12);
+       mtsdram(SDRAM_INITPLR13, CFG_SDRAM0_INITPLR13);
+       mtsdram(SDRAM_INITPLR14, CFG_SDRAM0_INITPLR14);
+       mtsdram(SDRAM_INITPLR15, CFG_SDRAM0_INITPLR15);
+
+       /* Set On-Die Termination Registers */
+
+       mtsdram(SDRAM_CODT, CFG_SDRAM0_CODT);
+       mtsdram(SDRAM_MODT0, CFG_SDRAM0_MODT0);
+       mtsdram(SDRAM_MODT1, CFG_SDRAM0_MODT1);
+
+       /* Set Write Timing Register */
+
+       mtsdram(SDRAM_WRDTR, CFG_SDRAM0_WRDTR);
+
+       /*
+        * Start Initialization by SDRAM0_MCOPT2[SREN] = 0 and
+        * SDRAM0_MCOPT2[IPTR] = 1
+        */
+
+       mtsdram(SDRAM_MCOPT2, (SDRAM_MCOPT2_SREN_EXIT |
+                              SDRAM_MCOPT2_IPTR_EXECUTE));
+
+       /*
+        * Poll SDRAM0_MCSTAT[MIC] for assertion to indicate the
+        * completion of initialization.
+        */
+
+       do {
+               mfsdram(SDRAM_MCSTAT, val);
+       } while ((val & SDRAM_MCSTAT_MIC_MASK) != SDRAM_MCSTAT_MIC_COMP);
+
+       /* Set Delay Control Registers */
+
+       mtsdram(SDRAM_DLCR, CFG_SDRAM0_DLCR);
+       mtsdram(SDRAM_RDCC, CFG_SDRAM0_RDCC);
+       mtsdram(SDRAM_RQDC, CFG_SDRAM0_RQDC);
+       mtsdram(SDRAM_RFDC, CFG_SDRAM0_RFDC);
+
+       /*
+        * Enable Controller by SDRAM0_MCOPT2[DCEN] = 1:
+        */
+
+       mfsdram(SDRAM_MCOPT2, val);
+       mtsdram(SDRAM_MCOPT2, val | SDRAM_MCOPT2_DCEN_ENABLE);
+
+#if defined(CONFIG_DDR_ECC)
+       ecc_init(CFG_SDRAM_BASE, CFG_MBYTES_SDRAM << 20);
+#endif /* defined(CONFIG_DDR_ECC) */
+#endif /* !defined(CONFIG_NAND_U_BOOT) || defined(CONFIG_NAND_SPL) */
+
+       return (CFG_MBYTES_SDRAM << 20);
+}
+#endif /* defined(CONFIG_SPD_EEPROM) && defined(CONFIG_440SP) || ... */
index ffbc222e7a9b54030071bc34f6339159ebaa65cf..a7587d4351fa1773926006827ef707d9214166f2 100644 (file)
@@ -98,14 +98,14 @@ DECLARE_GLOBAL_DATA_PTR;
 #define UDIV_SUBTRACT  0
 #define UART0_SDR      sdr_uart0
 #define UART1_SDR      sdr_uart1
-#if defined(CONFIG_440EP) || defined(CONFIG_440EPx) || \
-    defined(CONFIG_440GR) || defined(CONFIG_440GRx) || \
-    defined(CONFIG_440SP) || defined(CONFIG_440SPe) || \
+#if defined(CONFIG_440EP) || defined(CONFIG_440EPX) || \
+    defined(CONFIG_440GR) || defined(CONFIG_440GRX) || \
+    defined(CONFIG_440SP) || defined(CONFIG_440SPE) || \
     defined(CONFIG_460EX) || defined(CONFIG_460GT)
 #define UART2_SDR      sdr_uart2
 #endif
-#if defined(CONFIG_440EP) || defined(CONFIG_440EPx) || \
-    defined(CONFIG_440GR) || defined(CONFIG_440GRx) || \
+#if defined(CONFIG_440EP) || defined(CONFIG_440EPX) || \
+    defined(CONFIG_440GR) || defined(CONFIG_440GRX) || \
     defined(CONFIG_460EX) || defined(CONFIG_460GT)
 #define UART3_SDR      sdr_uart3
 #endif
index 178c5c67425a52bb49bb99d0a2accfb1268bb04c..800bb41d01463b1ae4956debcf80f118c57408e8 100644 (file)
@@ -45,6 +45,7 @@ COBJS += cpu.o
 COBJS  += cpu_init.o
 COBJS  += denali_data_eye.o
 COBJS  += denali_spd_ddr2.o
+COBJS  += ecc.o
 COBJS  += fdt.o
 COBJS  += gpio.o
 COBJS  += i2c.o
index 42eabfe568a5b6b0d48a5ebb8eb9bf435dcfe1f3..1e9423a89bf18ea06de44b62259528b4d9e03d9c 100644 (file)
 DECLARE_GLOBAL_DATA_PTR;
 #endif
 
-#ifdef CFG_INIT_DCACHE_CS
-# if (CFG_INIT_DCACHE_CS == 0)
-#  define PBxAP pb0ap
-#  define PBxCR pb0cr
-#  if (defined(CFG_EBC_PB0AP) && defined(CFG_EBC_PB0CR))
-#   define PBxAP_VAL CFG_EBC_PB0AP
-#   define PBxCR_VAL CFG_EBC_PB0CR
-#  endif
-# endif
-# if (CFG_INIT_DCACHE_CS == 1)
-#  define PBxAP pb1ap
-#  define PBxCR pb1cr
-#  if (defined(CFG_EBC_PB1AP) && defined(CFG_EBC_PB1CR))
-#   define PBxAP_VAL CFG_EBC_PB1AP
-#   define PBxCR_VAL CFG_EBC_PB1CR
-#  endif
-# endif
-# if (CFG_INIT_DCACHE_CS == 2)
-#  define PBxAP pb2ap
-#  define PBxCR pb2cr
-#  if (defined(CFG_EBC_PB2AP) && defined(CFG_EBC_PB2CR))
-#   define PBxAP_VAL CFG_EBC_PB2AP
-#   define PBxCR_VAL CFG_EBC_PB2CR
-#  endif
-# endif
-# if (CFG_INIT_DCACHE_CS == 3)
-#  define PBxAP pb3ap
-#  define PBxCR pb3cr
-#  if (defined(CFG_EBC_PB3AP) && defined(CFG_EBC_PB3CR))
-#   define PBxAP_VAL CFG_EBC_PB3AP
-#   define PBxCR_VAL CFG_EBC_PB3CR
-#  endif
-# endif
-# if (CFG_INIT_DCACHE_CS == 4)
-#  define PBxAP pb4ap
-#  define PBxCR pb4cr
-#  if (defined(CFG_EBC_PB4AP) && defined(CFG_EBC_PB4CR))
-#   define PBxAP_VAL CFG_EBC_PB4AP
-#   define PBxCR_VAL CFG_EBC_PB4CR
-#  endif
-# endif
-# if (CFG_INIT_DCACHE_CS == 5)
-#  define PBxAP pb5ap
-#  define PBxCR pb5cr
-#  if (defined(CFG_EBC_PB5AP) && defined(CFG_EBC_PB5CR))
-#   define PBxAP_VAL CFG_EBC_PB5AP
-#   define PBxCR_VAL CFG_EBC_PB5CR
-#  endif
-# endif
-# if (CFG_INIT_DCACHE_CS == 6)
-#  define PBxAP pb6ap
-#  define PBxCR pb6cr
-#  if (defined(CFG_EBC_PB6AP) && defined(CFG_EBC_PB6CR))
-#   define PBxAP_VAL CFG_EBC_PB6AP
-#   define PBxCR_VAL CFG_EBC_PB6CR
-#  endif
-# endif
-# if (CFG_INIT_DCACHE_CS == 7)
-#  define PBxAP pb7ap
-#  define PBxCR pb7cr
-#  if (defined(CFG_EBC_PB7AP) && defined(CFG_EBC_PB7CR))
-#   define PBxAP_VAL CFG_EBC_PB7AP
-#   define PBxCR_VAL CFG_EBC_PB7CR
-#  endif
-# endif
-#endif /* CFG_INIT_DCACHE_CS */
-
 #ifndef CFG_PLL_RECONFIG
 #define CFG_PLL_RECONFIG       0
 #endif
@@ -353,24 +286,6 @@ int cpu_init_r (void)
        uint pvr = get_pvr();
 #endif
 
-#ifdef CFG_INIT_DCACHE_CS
-       /*
-        * Flush and invalidate dcache, then disable CS for temporary stack.
-        * Afterwards, this CS can be used for other purposes
-        */
-       dcache_disable();   /* flush and invalidate dcache */
-       mtebc(PBxAP, 0);
-       mtebc(PBxCR, 0);    /* disable CS for temporary stack */
-
-#if (defined(PBxAP_VAL) && defined(PBxCR_VAL))
-       /*
-        * Write new value into CS register
-        */
-       mtebc(PBxAP, PBxAP_VAL);
-       mtebc(PBxCR, PBxCR_VAL);
-#endif
-#endif /* CFG_INIT_DCACHE_CS */
-
        /*
         * Write Ethernetaddress into on-chip register
         */
diff --git a/cpu/ppc4xx/ecc.c b/cpu/ppc4xx/ecc.c
new file mode 100644 (file)
index 0000000..a2eb07b
--- /dev/null
@@ -0,0 +1,122 @@
+/*
+ *    Copyright (c) 2008 Nuovation System Designs, LLC
+ *      Grant Erickson <gerickson@nuovations.com>
+ *
+ *    (C) Copyright 2005-2007
+ *    Stefan Roese, DENX Software Engineering, sr@denx.de.
+ *
+ *    (C) Copyright 2002
+ *    Jun Gu, Artesyn Technology, jung@artesyncp.com
+ *
+ *    (C) Copyright 2001
+ *    Bill Hunter, Wave 7 Optics, williamhunter@attbi.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 abe 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
+ *
+ *    Description:
+ *     This file implements generic DRAM ECC initialization for
+ *     PowerPC processors using a SDRAM DDR/DDR2 controller,
+ *     including the 405EX(r), 440GP/GX/EP/GR, 440SP(E), and
+ *     460EX/GT.
+ */
+
+#include <common.h>
+#include <ppc4xx.h>
+#include <ppc_asm.tmpl>
+#include <ppc_defs.h>
+#include <asm/processor.h>
+#include <asm/io.h>
+
+#include "ecc.h"
+
+#if defined(CONFIG_SDRAM_PPC4xx_IBM_DDR) || \
+    defined(CONFIG_SDRAM_PPC4xx_IBM_DDR2)
+#if defined(CONFIG_DDR_ECC) || defined(CONFIG_SDRAM_ECC)
+/*
+ *  void ecc_init()
+ *
+ *  Description:
+ *    This routine initializes a range of DRAM ECC memory with known
+ *    data and enables ECC checking.
+ *
+ *  TO DO:
+ *    - Improve performance by utilizing cache.
+ *    - Further generalize to make usable by other 4xx variants (e.g.
+ *      440EPx, et al).
+ *
+ *  Input(s):
+ *    start - A pointer to the start of memory covered by ECC requiring
+ *           initialization.
+ *    size  - The size, in bytes, of the memory covered by ECC requiring
+ *           initialization.
+ *
+ *  Output(s):
+ *    start - A pointer to the start of memory covered by ECC with
+ *           CFG_ECC_PATTERN written to all locations and ECC data
+ *           primed.
+ *
+ *  Returns:
+ *    N/A
+ */
+void ecc_init(unsigned long * const start, unsigned long size)
+{
+       const unsigned long pattern = CFG_ECC_PATTERN;
+       unsigned long * const end = (unsigned long * const)((long)start + size);
+       unsigned long * current = start;
+       unsigned long mcopt1;
+       long increment;
+
+       if (start >= end)
+               return;
+
+       mfsdram(SDRAM_ECC_CFG, mcopt1);
+
+       /* Enable ECC generation without checking or reporting */
+
+       mtsdram(SDRAM_ECC_CFG, ((mcopt1 & ~SDRAM_ECC_CFG_MCHK_MASK) |
+                               SDRAM_ECC_CFG_MCHK_GEN));
+
+       increment = sizeof(u32);
+
+#if defined(CONFIG_440)
+       /*
+        * Look at the geometry of SDRAM (data width) to determine whether we
+        * can skip words when writing.
+        */
+
+       if ((mcopt1 & SDRAM_ECC_CFG_DMWD_MASK) != SDRAM_ECC_CFG_DMWD_32)
+               increment = sizeof(u64);
+#endif /* defined(CONFIG_440) */
+
+       while (current < end) {
+               *current = pattern;
+                current = (unsigned long *)((long)current + increment);
+       }
+
+       /* Wait until the writes are finished. */
+
+       sync();
+
+       /* Enable ECC generation with checking and no reporting */
+
+       mtsdram(SDRAM_ECC_CFG, ((mcopt1 & ~SDRAM_ECC_CFG_MCHK_MASK) |
+                               SDRAM_ECC_CFG_MCHK_CHK));
+}
+#endif /* defined(CONFIG_DDR_ECC) || defined(CONFIG_SDRAM_ECC) */
+#endif /* defined(CONFIG_SDRAM_PPC4xx_IBM_DDR)... */
diff --git a/cpu/ppc4xx/ecc.h b/cpu/ppc4xx/ecc.h
new file mode 100644 (file)
index 0000000..aecf291
--- /dev/null
@@ -0,0 +1,69 @@
+/*
+ *    Copyright (c) 2008 Nuovation System Designs, LLC
+ *     Grant Erickson <gerickson@nuovations.com>
+ *
+ *    Copyright (c) 2007 DENX Software Engineering, GmbH
+ *     Stefan Roese <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 abe 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
+ *
+ *    Description:
+ *     This file implements ECC initialization for PowerPC processors
+ *     using the SDRAM DDR2 controller, including the 405EX(r),
+ *     440SP(E), 460EX and 460GT.
+ *
+ */
+
+#ifndef _ECC_H_
+#define _ECC_H_
+
+#if !defined(CFG_ECC_PATTERN)
+#define        CFG_ECC_PATTERN 0x00000000
+#endif /* !defined(CFG_ECC_PATTERN) */
+
+/*
+ * Since the IBM DDR controller used on 440GP/GX/EP/GR is not register
+ * compatible to the IBM DDR/2 controller used on 405EX/440SP/SPe/460EX/GT
+ * we need to make some processor dependant defines used later on by the
+ * driver.
+ */
+
+/* For 440GP/GX/EP/GR */
+#if defined(CONFIG_SDRAM_PPC4xx_IBM_DDR)
+#define SDRAM_ECC_CFG          SDRAM_CFG0
+#define SDRAM_ECC_CFG_MCHK_MASK        SDRAM_CFG0_MCHK_MASK
+#define SDRAM_ECC_CFG_MCHK_GEN SDRAM_CFG0_MCHK_GEN
+#define SDRAM_ECC_CFG_MCHK_CHK SDRAM_CFG0_MCHK_CHK
+#define SDRAM_ECC_CFG_DMWD_MASK        SDRAM_CFG0_DMWD_MASK
+#define SDRAM_ECC_CFG_DMWD_32  SDRAM_CFG0_DMWD_32
+#endif
+
+/* For 405EX/440SP/SPe/460EX/GT */
+#if defined(CONFIG_SDRAM_PPC4xx_IBM_DDR2)
+#define SDRAM_ECC_CFG          SDRAM_MCOPT1
+#define SDRAM_ECC_CFG_MCHK_MASK        SDRAM_MCOPT1_MCHK_MASK
+#define SDRAM_ECC_CFG_MCHK_GEN SDRAM_MCOPT1_MCHK_GEN
+#define SDRAM_ECC_CFG_MCHK_CHK SDRAM_MCOPT1_MCHK_CHK
+#define SDRAM_ECC_CFG_DMWD_MASK        SDRAM_MCOPT1_DMWD_MASK
+#define SDRAM_ECC_CFG_DMWD_32  SDRAM_MCOPT1_DMWD_32
+#endif
+
+extern void ecc_init(unsigned long * const start, unsigned long size);
+
+#endif /* _ECC_H_ */
index 2724d91f0f15fb8f4934e7ad2e1037785441e215..c7771addaac890229cc182a226467762e8f40f50 100644 (file)
@@ -31,6 +31,7 @@
 #include <ppc4xx.h>
 #include <asm/processor.h>
 #include "sdram.h"
+#include "ecc.h"
 
 #ifdef CONFIG_SDRAM_BANK0
 
@@ -163,7 +164,7 @@ static ulong compute_rtr(ulong speed, ulong rows, ulong refresh)
 /*
  * Autodetect onboard SDRAM on 405 platforms
  */
-void sdram_init(void)
+long int initdram(int board_type)
 {
        ulong speed;
        ulong sdtr1;
@@ -231,9 +232,15 @@ void sdram_init(void)
                                mtsdram(mem_mcopt1, 0);
                        }
 #endif
-                       return;
+
+                       /*
+                        * OK, size detected -> all done
+                        */
+                       return mb0cf[i].size;
                }
        }
+
+       return 0;
 }
 
 #else /* CONFIG_440 */
@@ -332,49 +339,6 @@ static void sdram_tr1_set(int ram_address, int* tr1_value)
        *tr1_value = (first_good + last_bad) / 2;
 }
 
-#ifdef CONFIG_SDRAM_ECC
-static void ecc_init(ulong start, ulong size)
-{
-       ulong   current_addr;           /* current byte address */
-       ulong   end_addr;               /* end of memory region */
-       ulong   addr_inc;               /* address skip between writes */
-       ulong   cfg0_reg;               /* for restoring ECC state */
-
-       /*
-        * TODO: Enable dcache before running this test (speedup)
-        */
-
-       mfsdram(mem_cfg0, cfg0_reg);
-       mtsdram(mem_cfg0, (cfg0_reg & ~SDRAM_CFG0_MEMCHK) | SDRAM_CFG0_MEMCHK_GEN);
-
-       /*
-        * look at geometry of SDRAM (data width) to determine whether we
-        * can skip words when writing
-        */
-       if ((cfg0_reg & SDRAM_CFG0_DRAMWDTH) == SDRAM_CFG0_DRAMWDTH_32)
-               addr_inc = 4;
-       else
-               addr_inc = 8;
-
-       current_addr = start;
-       end_addr = start + size;
-
-       while (current_addr < end_addr) {
-               *((ulong *)current_addr) = 0x00000000;
-               current_addr += addr_inc;
-       }
-
-       /*
-        * TODO: Flush dcache and disable it again
-        */
-
-       /*
-        * Enable ecc checking and parity errors
-        */
-       mtsdram(mem_cfg0, (cfg0_reg & ~SDRAM_CFG0_MEMCHK) | SDRAM_CFG0_MEMCHK_CHK);
-}
-#endif
-
 /*
  * Autodetect onboard DDR SDRAM on 440 platforms
  *
index 0008170128afaaa786318c40f250f88b961d28e9..426bf3c6f9a966b21917e4d2348b56dfc5b3c9cf 100644 (file)
@@ -3,6 +3,8 @@
  *  Copyright (C) 1999 Magnus Damm <kieraypc01.p.y.kie.era.ericsson.se>
  *  Copyright (C) 2000,2001,2002 Wolfgang Denk <wd@denx.de>
  *  Copyright (C) 2007 Stefan Roese <sr@denx.de>, DENX Software Engineering
+ *  Copyright (c) 2008 Nuovation System Designs, LLC
+ *    Grant Erickson <gerickson@nuovations.com>
  *
  * See file CREDITS for list of people who contributed to this
  * project.
 # if (CFG_INIT_DCACHE_CS == 0)
 #  define PBxAP pb0ap
 #  define PBxCR pb0cr
+#  if (defined(CFG_EBC_PB0AP) && defined(CFG_EBC_PB0CR))
+#   define PBxAP_VAL CFG_EBC_PB0AP
+#   define PBxCR_VAL CFG_EBC_PB0CR
+#  endif
 # endif
 # if (CFG_INIT_DCACHE_CS == 1)
 #  define PBxAP pb1ap
 #  define PBxCR pb1cr
+#  if (defined(CFG_EBC_PB1AP) && defined(CFG_EBC_PB1CR))
+#   define PBxAP_VAL CFG_EBC_PB1AP
+#   define PBxCR_VAL CFG_EBC_PB1CR
+#  endif
 # endif
 # if (CFG_INIT_DCACHE_CS == 2)
 #  define PBxAP pb2ap
 #  define PBxCR pb2cr
+#  if (defined(CFG_EBC_PB2AP) && defined(CFG_EBC_PB2CR))
+#   define PBxAP_VAL CFG_EBC_PB2AP
+#   define PBxCR_VAL CFG_EBC_PB2CR
+#  endif
 # endif
 # if (CFG_INIT_DCACHE_CS == 3)
 #  define PBxAP pb3ap
 #  define PBxCR pb3cr
+#  if (defined(CFG_EBC_PB3AP) && defined(CFG_EBC_PB3CR))
+#   define PBxAP_VAL CFG_EBC_PB3AP
+#   define PBxCR_VAL CFG_EBC_PB3CR
+#  endif
 # endif
 # if (CFG_INIT_DCACHE_CS == 4)
 #  define PBxAP pb4ap
 #  define PBxCR pb4cr
+#  if (defined(CFG_EBC_PB4AP) && defined(CFG_EBC_PB4CR))
+#   define PBxAP_VAL CFG_EBC_PB4AP
+#   define PBxCR_VAL CFG_EBC_PB4CR
+#  endif
 # endif
 # if (CFG_INIT_DCACHE_CS == 5)
 #  define PBxAP pb5ap
 #  define PBxCR pb5cr
+#  if (defined(CFG_EBC_PB5AP) && defined(CFG_EBC_PB5CR))
+#   define PBxAP_VAL CFG_EBC_PB5AP
+#   define PBxCR_VAL CFG_EBC_PB5CR
+#  endif
 # endif
 # if (CFG_INIT_DCACHE_CS == 6)
 #  define PBxAP pb6ap
 #  define PBxCR pb6cr
+#  if (defined(CFG_EBC_PB6AP) && defined(CFG_EBC_PB6CR))
+#   define PBxAP_VAL CFG_EBC_PB6AP
+#   define PBxCR_VAL CFG_EBC_PB6CR
+#  endif
 # endif
 # if (CFG_INIT_DCACHE_CS == 7)
 #  define PBxAP pb7ap
 #  define PBxCR pb7cr
+#  if (defined(CFG_EBC_PB7AP) && defined(CFG_EBC_PB7CR))
+#   define PBxAP_VAL CFG_EBC_PB7AP
+#   define PBxCR_VAL CFG_EBC_PB7CR
+#  endif
+# endif
+# ifndef PBxAP_VAL
+#  define PBxAP_VAL    0
+# endif
+# ifndef PBxCR_VAL
+#  define PBxCR_VAL    0
+# endif
+/*
+ * Memory Bank x (nothingness) initialization CFG_INIT_RAM_ADDR + 64 MiB
+ * used as temporary stack pointer for the primordial stack
+ */
+# ifndef CFG_INIT_DCACHE_PBxAR
+#  define CFG_INIT_DCACHE_PBxAR        (EBC_BXAP_BME_DISABLED                  | \
+                                EBC_BXAP_TWT_ENCODE(7)                 | \
+                                EBC_BXAP_BCE_DISABLE                   | \
+                                EBC_BXAP_BCT_2TRANS                    | \
+                                EBC_BXAP_CSN_ENCODE(0)                 | \
+                                EBC_BXAP_OEN_ENCODE(0)                 | \
+                                EBC_BXAP_WBN_ENCODE(0)                 | \
+                                EBC_BXAP_WBF_ENCODE(0)                 | \
+                                EBC_BXAP_TH_ENCODE(2)                  | \
+                                EBC_BXAP_RE_DISABLED                   | \
+                                EBC_BXAP_SOR_NONDELAYED                | \
+                                EBC_BXAP_BEM_WRITEONLY                 | \
+                                EBC_BXAP_PEN_DISABLED)
+# endif /* CFG_INIT_DCACHE_PBxAR */
+# ifndef CFG_INIT_DCACHE_PBxCR
+#  define CFG_INIT_DCACHE_PBxCR        (EBC_BXCR_BAS_ENCODE(CFG_INIT_RAM_ADDR) | \
+                                EBC_BXCR_BS_64MB                       | \
+                                EBC_BXCR_BU_RW                         | \
+                                EBC_BXCR_BW_16BIT)
+# endif /* CFG_INIT_DCACHE_PBxCR */
+# ifndef CFG_INIT_RAM_PATTERN
+#  define CFG_INIT_RAM_PATTERN 0xDEADDEAD
 # endif
 #endif /* CFG_INIT_DCACHE_CS */
 
 #error Only 4k of init-ram is supported - please adjust CFG_INIT_RAM_END!
 #endif
 
+/*
+ * Unless otherwise overriden, enable two 128MB cachable instruction regions
+ * at CFG_SDRAM_BASE and another 128MB cacheable instruction region covering
+ * NOR flash at CFG_FLASH_BASE. Disable all cacheable data regions.
+ */
+#if !defined(CFG_FLASH_BASE)
+/* If not already defined, set it to the "last" 128MByte region */
+# define CFG_FLASH_BASE                0xf8000000
+#endif
+#if !defined(CFG_ICACHE_SACR_VALUE)
+# define CFG_ICACHE_SACR_VALUE         \
+               (PPC_128MB_SACR_VALUE(CFG_SDRAM_BASE + (  0 << 20)) | \
+                PPC_128MB_SACR_VALUE(CFG_SDRAM_BASE + (128 << 20)) | \
+                PPC_128MB_SACR_VALUE(CFG_FLASH_BASE))
+#endif /* !defined(CFG_ICACHE_SACR_VALUE) */
+
+#if !defined(CFG_DCACHE_SACR_VALUE)
+# define CFG_DCACHE_SACR_VALUE         \
+               (0x00000000)
+#endif /* !defined(CFG_DCACHE_SACR_VALUE) */
+
 #define function_prolog(func_name)     .text; \
                                        .align 2; \
                                        .globl func_name; \
 
 
        .extern ext_bus_cntlr_init
-       .extern sdram_init
 #ifdef CONFIG_NAND_U_BOOT
        .extern reconfig_tlb0
 #endif
@@ -401,97 +489,6 @@ rsttlb:    tlbwe   r0,r1,0x0000    /* Invalidate all entries (V=0)*/
        /* Continue from 'normal' start */
        /*----------------------------------------------------------------*/
 2:
-
-#if defined(CONFIG_NAND_SPL)
-#if defined(CONFIG_440EPX) || defined(CONFIG_440GRX) || \
-    defined(CONFIG_460EX) || defined(CONFIG_460GT)
-       /*
-        * Enable internal SRAM (only on 440EPx/GRx, 440EP/GR have no OCM)
-        */
-       lis     r2,0x7fff
-       ori     r2,r2,0xffff
-       mfdcr   r1,isram0_dpc
-       and     r1,r1,r2                /* Disable parity check */
-       mtdcr   isram0_dpc,r1
-       mfdcr   r1,isram0_pmeg
-       and     r1,r1,r2                /* Disable pwr mgmt */
-       mtdcr   isram0_pmeg,r1
-#if defined(CONFIG_460EX) || defined(CONFIG_460GT)
-       lis     r1,0x4000               /* BAS = 8000_0000 */
-       ori     r1,r1,0x4580            /* 16k */
-       mtdcr   isram0_sb0cr,r1
-#endif
-#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
-        */
-       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 */
-
        bl      3f
        b       _start
 
@@ -746,7 +743,7 @@ _start:
        stw     r0,+12(r1)              /* Save return addr (underflow vect) */
 
 #ifdef CONFIG_NAND_SPL
-       bl      nand_boot               /* will not return */
+       bl      nand_boot_common        /* will not return */
 #else
        GET_GOT
 
@@ -840,16 +837,16 @@ _start:
        /* make sure above stores all comlete before going on */
        sync
 
-       /*----------------------------------------------------------------------- */
-       /* Enable two 128MB cachable regions. */
-       /*----------------------------------------------------------------------- */
-       addis   r1,r0,0xc000
-       addi    r1,r1,0x0001
-       mticcr  r1                      /* instruction cache */
+       /* Set-up icache cacheability. */
+       lis     r1, CFG_ICACHE_SACR_VALUE@h
+       ori     r1, r1, CFG_ICACHE_SACR_VALUE@l
+       mticcr  r1
+       isync
 
-       addis   r1,r0,0x0000
-       addi    r1,r1,0x0000
-       mtdccr  r1                      /* data cache */
+       /* Set-up dcache cacheability. */
+       lis     r1, CFG_DCACHE_SACR_VALUE@h
+       ori     r1, r1, CFG_DCACHE_SACR_VALUE@l
+       mtdccr  r1
 
        addis   r1,r0,CFG_INIT_RAM_ADDR@h
        ori     r1,r1,CFG_INIT_SP_OFFSET /* set up the stack to SDRAM */
@@ -892,39 +889,33 @@ _start:
                                        /* dbsr is cleared by setting bits to 1) */
        mtdbsr  r4                      /* clear/reset the dbsr */
 
-       /*----------------------------------------------------------------------- */
-       /* Invalidate I and D caches. Enable I cache for defined memory regions */
-       /* to speed things up. Leave the D cache disabled for now. It will be */
-       /* enabled/left disabled later based on user selected menu options. */
-       /* Be aware that the I cache may be disabled later based on the menu */
-       /* options as well. See miscLib/main.c. */
-       /*----------------------------------------------------------------------- */
+       /* Invalidate the i- and d-caches. */
        bl      invalidate_icache
        bl      invalidate_dcache
 
-       /*----------------------------------------------------------------------- */
-       /* Enable two 128MB cachable regions. */
-       /*----------------------------------------------------------------------- */
-       lis     r4,0xc000
-       ori     r4,r4,0x0001
-       mticcr  r4                      /* instruction cache */
+       /* Set-up icache cacheability. */
+       lis     r4, CFG_ICACHE_SACR_VALUE@h
+       ori     r4, r4, CFG_ICACHE_SACR_VALUE@l
+       mticcr  r4
        isync
 
-       lis     r4,0x0000
-       ori     r4,r4,0x0000
-       mtdccr  r4                      /* data cache */
+       /* Set-up dcache cacheability. */
+       lis     r4, CFG_DCACHE_SACR_VALUE@h
+       ori     r4, r4, CFG_DCACHE_SACR_VALUE@l
+       mtdccr  r4
 
-#if !(defined(CFG_EBC_PB0AP) && defined(CFG_EBC_PB0CR)) || defined(CONFIG_405EX)
+#if !(defined(CFG_EBC_PB0AP) && defined(CFG_EBC_PB0CR))
        /*----------------------------------------------------------------------- */
        /* Tune the speed and size for flash CS0  */
        /*----------------------------------------------------------------------- */
        bl      ext_bus_cntlr_init
 #endif
+
 #if !(defined(CFG_INIT_DCACHE_CS) || defined(CFG_TEMP_STACK_OCM))
        /*
-        * Boards like the Kilauea (405EX) don't have OCM and can't use
-        * DCache for init-ram. So setup stack here directly after the
-        * SDRAM is initialized.
+        * For boards that don't have OCM and can't use the data cache
+        * for their primordial stack, setup stack here directly after the
+        * SDRAM is initialized in ext_bus_cntlr_init.
         */
        lis     r1, CFG_INIT_RAM_ADDR@h
        ori     r1,r1,CFG_INIT_SP_OFFSET /* set up the stack in SDRAM */
@@ -1007,83 +998,90 @@ _start:
 #endif /* CONFIG_405EZ */
 #endif
 
-#ifdef CONFIG_NAND_SPL
+       /*----------------------------------------------------------------------- */
+       /* Setup temporary stack in DCACHE or OCM if needed for SDRAM SPD. */
+       /*----------------------------------------------------------------------- */
+#ifdef CFG_INIT_DCACHE_CS
+       li      r4, PBxAP
+       mtdcr   ebccfga, r4
+       lis     r4, CFG_INIT_DCACHE_PBxAR@h
+       ori     r4, r4, CFG_INIT_DCACHE_PBxAR@l
+       mtdcr   ebccfgd, r4
+
+       addi    r4, 0, PBxCR
+       mtdcr   ebccfga, r4
+       lis     r4, CFG_INIT_DCACHE_PBxCR@h
+       ori     r4, r4, CFG_INIT_DCACHE_PBxCR@l
+       mtdcr   ebccfgd, r4
+
        /*
-        * Copy SPL from cache into internal SRAM
+        * Enable the data cache for the 128MB storage access control region
+        * at CFG_INIT_RAM_ADDR.
         */
-       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
+       mfdccr  r4
+       oris    r4, r4, PPC_128MB_SACR_VALUE(CFG_INIT_RAM_ADDR)@h
+       ori     r4, r4, PPC_128MB_SACR_VALUE(CFG_INIT_RAM_ADDR)@l
+       mtdccr  r4
 
        /*
-        * Jump to code in RAM
+        * Preallocate data cache lines to be used to avoid a subsequent
+        * cache miss and an ensuing machine check exception when exceptions
+        * are enabled.
         */
-       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
+       li      r0, 0
 
-start_ram:
-       sync
-       isync
-#endif /* CONFIG_NAND_SPL */
+       lis     r3, CFG_INIT_RAM_ADDR@h
+       ori     r3, r3, CFG_INIT_RAM_ADDR@l
 
-       /*----------------------------------------------------------------------- */
-       /* Setup temporary stack in DCACHE or OCM if needed for SDRAM SPD. */
-       /*----------------------------------------------------------------------- */
-#ifdef CFG_INIT_DCACHE_CS
-       /*----------------------------------------------------------------------- */
-       /* Memory Bank x (nothingness) initialization 1GB+64MEG */
-       /* used as temporary stack pointer for stage0  */
-       /*----------------------------------------------------------------------- */
-       li      r4,PBxAP
-       mtdcr   ebccfga,r4
-       lis     r4,0x0380
-       ori     r4,r4,0x0480
-       mtdcr   ebccfgd,r4
-
-       addi    r4,0,PBxCR
-       mtdcr   ebccfga,r4
-       lis     r4,0x400D
-       ori     r4,r4,0xa000
-       mtdcr   ebccfgd,r4
-
-       /* turn on data cache for this region */
-       lis     r4,0x0080
-       mtdccr  r4
+       lis     r4, CFG_INIT_RAM_END@h
+       ori     r4, r4, CFG_INIT_RAM_END@l
+
+       /*
+        * Convert the size, in bytes, to the number of cache lines/blocks
+        * to preallocate.
+        */
+       clrlwi. r5, r4, (32 - L1_CACHE_SHIFT)
+       srwi    r5, r4, L1_CACHE_SHIFT
+       beq     ..load_counter
+       addi    r5, r5, 0x0001
+..load_counter:
+       mtctr   r5
 
-       /* set stack pointer and clear stack to known value */
+       /* Preallocate the computed number of cache blocks. */
+..alloc_dcache_block:
+       dcba    r0, r3
+       addi    r3, r3, L1_CACHE_BYTES
+       bdnz    ..alloc_dcache_block
+       sync
 
-       lis     r1,CFG_INIT_RAM_ADDR@h
-       ori     r1,r1,CFG_INIT_SP_OFFSET@l
+       /*
+        * Load the initial stack pointer and data area and convert the size,
+        * in bytes, to the number of words to initialize to a known value.
+        */
+       lis     r1, CFG_INIT_RAM_ADDR@h
+       ori     r1, r1, CFG_INIT_SP_OFFSET@l
 
-       li      r4,2048                 /* we store 2048 words to stack */
+       lis     r4, (CFG_INIT_RAM_END >> 2)@h
+       ori     r4, r4, (CFG_INIT_RAM_END >> 2)@l
        mtctr   r4
 
-       lis     r2,CFG_INIT_RAM_ADDR@h          /* we also clear data area */
-       ori     r2,r2,CFG_INIT_RAM_END@l        /* so cant copy value from r1 */
+       lis     r2, CFG_INIT_RAM_ADDR@h
+       ori     r2, r2, CFG_INIT_RAM_END@l
 
-       lis     r4,0xdead               /* we store 0xdeaddead in the stack */
-       ori     r4,r4,0xdead
+       lis     r4, CFG_INIT_RAM_PATTERN@h
+       ori     r4, r4, CFG_INIT_RAM_PATTERN@l
 
 ..stackloop:
-       stwu    r4,-4(r2)
+       stwu    r4, -4(r2)
        bdnz    ..stackloop
 
-       li      r0, 0                   /* Make room for stack frame header and */
-       stwu    r0, -4(r1)              /* clear final stack frame so that      */
-       stwu    r0, -4(r1)              /* stack backtraces terminate cleanly   */
+       /*
+        * Make room for stack frame header and clear final stack frame so
+        * that stack backtraces terminate cleanly.
+        */
+       stwu    r0, -4(r1)
+       stwu    r0, -4(r1)
+
        /*
         * Set up a dummy frame to store reset vector as return address.
         * this causes stack underflow to reset board.
@@ -1120,13 +1118,8 @@ start_ram:
        stw     r0, +12(r1)             /* Save return addr (underflow vect) */
 #endif /* CFG_INIT_DCACHE_CS */
 
-       /*----------------------------------------------------------------------- */
-       /* Initialize SDRAM Controller  */
-       /*----------------------------------------------------------------------- */
-       bl      sdram_init
-
 #ifdef CONFIG_NAND_SPL
-       bl      nand_boot               /* will not return */
+       bl      nand_boot_common        /* will not return */
 #else
        GET_GOT                 /* initialize GOT access                        */
 
@@ -1328,33 +1321,72 @@ in32r:
  * This "function" does not return, instead it continues in RAM
  * after relocating the monitor code.
  *
- * r3 = dest
- * r4 = src
- * r5 = length in bytes
- * r6 = cachelinesize
+ * r3 = Relocated stack pointer
+ * r4 = Relocated global data pointer
+ * r5 = Relocated text pointer
  */
        .globl  relocate_code
 relocate_code:
-#ifdef CONFIG_4xx_DCACHE
+#if defined(CONFIG_4xx_DCACHE) || defined(CFG_INIT_DCACHE_CS)
        /*
-        * We need to flush the Init Data before the dcache will be
-        * invalidated
+        * We need to flush the initial global data (gd_t) before the dcache
+        * will be invalidated.
         */
 
-       /* save regs */
-       mr      r9,r3
-       mr      r10,r4
-       mr      r11,r5
+       /* Save registers */
+       mr      r9, r3
+       mr      r10, r4
+       mr      r11, r5
 
-       mr      r3,r4
-       addi    r4,r4,0x200     /* should be enough for init data */
+       /* Flush initial global data range */
+       mr      r3, r4
+       addi    r4, r4, CFG_GBL_DATA_SIZE@l
        bl      flush_dcache_range
 
-       /* restore regs */
-       mr      r3,r9
-       mr      r4,r10
-       mr      r5,r11
-#endif
+#if defined(CFG_INIT_DCACHE_CS)
+       /*
+        * Undo the earlier data cache set-up for the primordial stack and
+        * data area. First, invalidate the data cache and then disable data
+        * cacheability for that area. Finally, restore the EBC values, if
+        * any.
+        */
+
+       /* Invalidate the primordial stack and data area in cache */
+       lis     r3, CFG_INIT_RAM_ADDR@h
+       ori     r3, r3, CFG_INIT_RAM_ADDR@l
+
+       lis     r4, CFG_INIT_RAM_END@h
+       ori     r4, r4, CFG_INIT_RAM_END@l
+       add     r4, r4, r3
+
+       bl      invalidate_dcache_range
+
+       /* Disable cacheability for the region */
+       mfdccr  r3
+       lis     r4, ~PPC_128MB_SACR_VALUE(CFG_INIT_RAM_ADDR)@h
+       ori     r4, r4, ~PPC_128MB_SACR_VALUE(CFG_INIT_RAM_ADDR)@l
+       and     r3, r3, r4
+       mtdccr  r3
+
+       /* Restore the EBC parameters */
+       li      r3, PBxAP
+       mtdcr   ebccfga, r3
+       lis     r3, PBxAP_VAL@h
+       ori     r3, r3, PBxAP_VAL@l
+       mtdcr   ebccfgd, r3
+
+       li      r3, PBxCR
+       mtdcr   ebccfga, r3
+       lis     r3, PBxCR_VAL@h
+       ori     r3, r3, PBxCR_VAL@l
+       mtdcr   ebccfgd, r3
+#endif /* defined(CFG_INIT_DCACHE_CS) */
+
+       /* Restore registers */
+       mr      r3, r9
+       mr      r4, r10
+       mr      r5, r11
+#endif /* defined(CONFIG_4xx_DCACHE) || defined(CFG_INIT_DCACHE_CS) */
 
 #ifdef CFG_INIT_RAM_DCACHE
        /*
@@ -1396,13 +1428,13 @@ relocate_code:
        addi    r1,r0,CFG_TLB_FOR_BOOT_FLASH    /* Use defined TLB */
 #else
        addi    r1,r0,0x0000            /* Default TLB entry is #0 */
-#endif
+#endif /* CFG_TLB_FOR_BOOT_FLASH */
        tlbre   r0,r1,0x0002            /* Read contents */
        ori     r0,r0,0x0c00            /* Or in the inhibit, write through bit */
        tlbwe   r0,r1,0x0002            /* Save it out */
        sync
        isync
-#endif
+#endif /* defined(CONFIG_440EP) || ... || defined(CONFIG_460GT) */
        mr      r1,  r3         /* Set new stack pointer                */
        mr      r9,  r4         /* Save copy of Init Data pointer       */
        mr      r10, r5         /* Save copy of Destination Address     */
@@ -1425,7 +1457,7 @@ relocate_code:
 
        /* First our own GOT */
        add     r14, r14, r15
-       /* the the one used by the C code */
+       /* then the one used by the C code */
        add     r30, r30, r15
 
        /*
@@ -2024,3 +2056,75 @@ pll_wait:
        blr
        function_epilog(mftlb1)
 #endif /* CONFIG_440 */
+
+#if defined(CONFIG_NAND_SPL)
+/*
+ * void nand_boot_relocate(dst, src, bytes)
+ *
+ * r3 = Destination address to copy code to (in SDRAM)
+ * r4 = Source address to copy code from
+ * r5 = size to copy in bytes
+ */
+nand_boot_relocate:
+       mr      r6,r3
+       mr      r7,r4
+       mflr    r8
+
+       /*
+        * Copy SPL from icache into SDRAM
+        */
+       subi    r3,r3,4
+       subi    r4,r4,4
+       srwi    r5,r5,2
+       mtctr   r5
+..spl_loop:
+       lwzu    r0,4(r4)
+       stwu    r0,4(r3)
+       bdnz    ..spl_loop
+
+       /*
+        * Calculate "corrected" link register, so that we "continue"
+        * in execution in destination range
+        */
+       sub     r3,r7,r6        /* r3 = src - dst */
+       sub     r8,r8,r3        /* r8 = link-reg - (src - dst) */
+       mtlr    r8
+       blr
+
+nand_boot_common:
+       /*
+        * First initialize SDRAM. It has to be available *before* calling
+        * nand_boot().
+        */
+       lis     r3,CFG_SDRAM_BASE@h
+       ori     r3,r3,CFG_SDRAM_BASE@l
+       bl      initdram
+
+       /*
+        * Now copy the 4k SPL code into SDRAM and continue execution
+        * from there.
+        */
+       lis     r3,CFG_NAND_BOOT_SPL_DST@h
+       ori     r3,r3,CFG_NAND_BOOT_SPL_DST@l
+       lis     r4,CFG_NAND_BOOT_SPL_SRC@h
+       ori     r4,r4,CFG_NAND_BOOT_SPL_SRC@l
+       lis     r5,CFG_NAND_BOOT_SPL_SIZE@h
+       ori     r5,r5,CFG_NAND_BOOT_SPL_SIZE@l
+       bl      nand_boot_relocate
+
+       /*
+        * We're running from SDRAM now!!!
+        *
+        * It is necessary for 4xx systems to relocate from running at
+        * the original location (0xfffffxxx) to somewhere else (SDRAM
+        * preferably). This is because CS0 needs to be reconfigured for
+        * NAND access. And we can't reconfigure this CS when currently
+        * "running" from it.
+        */
+
+       /*
+        * Finally call nand_boot() to load main NAND U-Boot image from
+        * NAND and jump to it.
+        */
+       bl      nand_boot               /* will not return */
+#endif /* CONFIG_NAND_SPL */
index 38b6f89555007a9ac4614a4a88af3599af63d69c..8b7e32a17bc643ece8a49a50ad565b87507d4e4f 100644 (file)
@@ -170,7 +170,7 @@ MachineCheckException(struct pt_regs *regs)
 
        val = get_esr();
 
-#if !defined(CONFIG_440)
+#if !defined(CONFIG_440) && !defined(CONFIG_405EX)
        if (val& ESR_IMCP) {
                printf("Instruction");
                mtspr(ESR, val & ~ESR_IMCP);
@@ -179,7 +179,7 @@ MachineCheckException(struct pt_regs *regs)
        }
        printf(" machine check.\n");
 
-#elif defined(CONFIG_440)
+#elif defined(CONFIG_440) || defined(CONFIG_405EX)
        if (val& ESR_IMCP){
                printf("Instruction Synchronous Machine Check exception\n");
                mtspr(SPRN_ESR, val & ~ESR_IMCP);
@@ -187,10 +187,15 @@ MachineCheckException(struct pt_regs *regs)
                val = mfspr(MCSR);
                if (val & MCSR_IB)
                        printf("Instruction Read PLB Error\n");
+#if defined(CONFIG_440)
                if (val & MCSR_DRB)
                        printf("Data Read PLB Error\n");
                if (val & MCSR_DWB)
                        printf("Data Write PLB Error\n");
+#else
+               if (val & MCSR_DB)
+                       printf("Data PLB Error\n");
+#endif
                if (val & MCSR_TLBP)
                        printf("TLB Parity Error\n");
                if (val & MCSR_ICP){
diff --git a/doc/README.mvblm7 b/doc/README.mvblm7
new file mode 100644 (file)
index 0000000..6a40888
--- /dev/null
@@ -0,0 +1,85 @@
+Matrix Vision mvBlueLYNX-M7 (mvBL-M7)
+-------------------------------------
+
+1.     Board Description
+
+       The mvBL-M7 is a 120x120mm single board computing platform
+       with strong focus on stereo image processing applications.
+
+       Power Supply is either VDC 12-48V or Pover over Ethernet (PoE)
+       on any port (requires add-on board).
+
+2      System Components
+
+2.1    CPU     
+       Freescale MPC8343VRAGDB CPU running at 400MHz core and 266MHz csb.
+       512MByte DDR-II memory @ 133MHz.
+       8 MByte Nor Flash on local bus.
+       2 Vitesse VSC8601 RGMII ethernet Phys.
+       1 USB host controller over ULPI I/F.
+       2 serial ports. Console running on ttyS0 @ 115200 8N1.
+       1 SD-Card slot connected to SPI.
+       System configuration (HRCW) is taken from I2C EEPROM.
+
+2.2    PCI
+       A miniPCI Type-III socket is present. PCI clock fixed at 66MHz.
+       
+2.3    FPGA
+       Altera Cyclone-II EP2C20/35 with PCI DMA engines.
+       Connects to dual Matrix Vision specific CCD/CMOS sensor interfaces.
+       Utilizes another 256MB DDR-II memory and 32-128MB Nand Flash.
+
+2.3.1  I/O @ FPGA
+       2x8 Outputs : Infineon High-Side Switches to Main Supply.
+       2x8 Inputs  : Programmable input threshold + trigger capabilities
+       2 dedicated flash interfaces for illuminator boards.
+       Cross trigger for chaining several boards.
+
+2.4    I2C
+       Bus1:
+               MAX5381 DAC @ 0x60 for 1st digital input threshold.
+               LM75 @ 0x90 for temperature monitoring.
+               EEPROM @ 0xA0 for system setup (HRCW etc.) + vendor specifics.
+               1st image sensor interface (slave adresses depend on sensor)
+       Bus2:
+               MAX5381 DAC @ 0x60 for 2nd digital input threshold.
+               2nd image sensor interface (slave adresses depend on sensor)
+
+3      Flash layout.
+
+       reset vector is 0xFFF00100, i.e. "HIGHBOOT".
+
+       FF800000        environment
+       FF802000        redundant environment
+       FF804000        u-boot script image
+       FF806000        redundant u-boot script image
+       FF808000        device tree blob
+       FF80A000        redundant device tree blob
+       FF80C000        tbd.
+       FF80E000        tbd.
+       FF810000        kernel
+       FFC00000        root FS
+       FFF00000        u-boot
+       FFF80000        FPGA raw bit file
+
+       mtd partitions are propagated to linux kernel via device tree blob.
+
+4      Booting
+
+       On startup the bootscript @ FF804000 is executed. This script can be
+       exchanged easily. Default boot mode is "boot from flash", i.e. system
+       works stand-alone.
+
+       This behaviour depends on some environment variables :
+
+       "netboot" : yes ->try dhcp/bootp and boot from network.
+       A "dhcp_client_id" and "dhcp_vendor-class-identifier" can be used for
+       DHCP server configuration, e.g. to provide different images to
+       different devices.
+
+       During netboot the system tries to get 3 image files:
+       1. Kernel - name + data is given during BOOTP.
+       2. Initrd - name is stored in "initrd_name"
+       3. device tree blob - name is stored in "dtb_name"
+       Fallback files are the flash versions.
+
index 4e304f7407cfbe61b848c9a7c20407211342d07b..c1741eac67d425fe7a1e18809e06f840581616fb 100644 (file)
@@ -49,7 +49,8 @@ DECLARE_GLOBAL_DATA_PTR;
 #error CONFIG_PS2SERIAL must be in 1 ... 6
 #endif
 
-#elif defined(CONFIG_MPC8540) || defined(CONFIG_MPC8541) || defined(CONFIG_MPC8555)
+#elif defined(CONFIG_MPC8540) || defined(CONFIG_MPC8541) || \
+      defined(CONFIG_MPC8548) || defined(CONFIG_MPC8555)
 
 #if CONFIG_PS2SERIAL == 1
 #define COM_BASE (CFG_CCSRBAR+0x4500)
@@ -65,7 +66,9 @@ static int    ps2ser_getc_hw(void);
 static void    ps2ser_interrupt(void *dev_id);
 
 extern struct  serial_state rs_table[]; /* in serial.c */
-#if !defined(CONFIG_MPC5xxx) && !defined(CONFIG_MPC8540) && !defined(CONFIG_MPC8541) && !defined(CONFIG_MPC8555)
+#if !defined(CONFIG_MPC5xxx) && !defined(CONFIG_MPC8540) && \
+    !defined(CONFIG_MPC8541) && !defined(CONFIG_MPC8548) && \
+    !defined(CONFIG_MPC8555)
 static struct  serial_state *state;
 #endif
 
@@ -120,7 +123,8 @@ int ps2ser_init(void)
        return (0);
 }
 
-#elif defined(CONFIG_MPC8540) || defined(CONFIG_MPC8541) || defined(CONFIG_MPC8555)
+#elif defined(CONFIG_MPC8540) || defined(CONFIG_MPC8541) || \
+      defined(CONFIG_MPC8548) || defined(CONFIG_MPC8555)
 int ps2ser_init(void)
 {
        NS16550_t com_port = (NS16550_t)COM_BASE;
@@ -186,7 +190,8 @@ void ps2ser_putc(int chr)
 {
 #ifdef CONFIG_MPC5xxx
        volatile struct mpc5xxx_psc *psc = (struct mpc5xxx_psc *)PSC_BASE;
-#elif defined(CONFIG_MPC8540) || defined(CONFIG_MPC8541) || defined(CONFIG_MPC8555)
+#elif defined(CONFIG_MPC8540) || defined(CONFIG_MPC8541) || \
+      defined(CONFIG_MPC8548) || defined(CONFIG_MPC8555)
        NS16550_t com_port = (NS16550_t)COM_BASE;
 #endif
 #ifdef DEBUG
@@ -197,7 +202,8 @@ void ps2ser_putc(int chr)
        while (!(psc->psc_status & PSC_SR_TXRDY));
 
        psc->psc_buffer_8 = chr;
-#elif defined(CONFIG_MPC8540) || defined(CONFIG_MPC8541) || defined(CONFIG_MPC8555)
+#elif defined(CONFIG_MPC8540) || defined(CONFIG_MPC8541) || \
+      defined(CONFIG_MPC8548) || defined(CONFIG_MPC8555)
        while ((com_port->lsr & LSR_THRE) == 0);
        com_port->thr = chr;
 #else
@@ -211,7 +217,8 @@ static int ps2ser_getc_hw(void)
 {
 #ifdef CONFIG_MPC5xxx
        volatile struct mpc5xxx_psc *psc = (struct mpc5xxx_psc *)PSC_BASE;
-#elif defined(CONFIG_MPC8540) || defined(CONFIG_MPC8541) || defined(CONFIG_MPC8555)
+#elif defined(CONFIG_MPC8540) || defined(CONFIG_MPC8541) || \
+      defined(CONFIG_MPC8548) || defined(CONFIG_MPC8555)
        NS16550_t com_port = (NS16550_t)COM_BASE;
 #endif
        int res = -1;
@@ -220,7 +227,8 @@ static int ps2ser_getc_hw(void)
        if (psc->psc_status & PSC_SR_RXRDY) {
                res = (psc->psc_buffer_8);
        }
-#elif defined(CONFIG_MPC8540) || defined(CONFIG_MPC8541) || defined(CONFIG_MPC8555)
+#elif defined(CONFIG_MPC8540) || defined(CONFIG_MPC8541) || \
+      defined(CONFIG_MPC8548) || defined(CONFIG_MPC8555)
        if (com_port->lsr & LSR_DR) {
                res = com_port->rbr;
        }
@@ -279,7 +287,8 @@ static void ps2ser_interrupt(void *dev_id)
 {
 #ifdef CONFIG_MPC5xxx
        volatile struct mpc5xxx_psc *psc = (struct mpc5xxx_psc *)PSC_BASE;
-#elif defined(CONFIG_MPC8540) || defined(CONFIG_MPC8541) || defined(CONFIG_MPC8555)
+#elif defined(CONFIG_MPC8540) || defined(CONFIG_MPC8541) || \
+      defined(CONFIG_MPC8548) || defined(CONFIG_MPC8555)
        NS16550_t com_port = (NS16550_t)COM_BASE;
 #endif
        int chr;
@@ -289,7 +298,8 @@ static void ps2ser_interrupt(void *dev_id)
                chr = ps2ser_getc_hw();
 #ifdef CONFIG_MPC5xxx
                status = psc->psc_status;
-#elif defined(CONFIG_MPC8540) || defined(CONFIG_MPC8541) || defined(CONFIG_MPC8555)
+#elif defined(CONFIG_MPC8540) || defined(CONFIG_MPC8541) || \
+      defined(CONFIG_MPC8548) || defined(CONFIG_MPC8555)
                status = com_port->lsr;
 #else
                status = ps2ser_in(UART_IIR);
@@ -305,7 +315,8 @@ static void ps2ser_interrupt(void *dev_id)
                }
 #ifdef CONFIG_MPC5xxx
        } while (status & PSC_SR_RXRDY);
-#elif defined(CONFIG_MPC8540) || defined(CONFIG_MPC8541) || defined(CONFIG_MPC8555)
+#elif defined(CONFIG_MPC8540) || defined(CONFIG_MPC8541) || \
+      defined(CONFIG_MPC8548) || defined(CONFIG_MPC8555)
        } while (status & LSR_DR);
 #else
        } while (status & UART_IIR_RDI);
index dca6a4da4a0ab83a2487b8c36e328876a1b2b1bb..48ece4f090b8c2af5e9705529ad22fafa43f7de1 100644 (file)
 #include <asm/fsl_law.h>
 #include <asm/io.h>
 
+DECLARE_GLOBAL_DATA_PTR;
+
 #define LAWAR_EN       0x80000000
-#define FSL_HW_NUM_LAWS 10     /* number of LAWs in the hw implementation */
+/* number of LAWs in the hw implementation */
+#if defined(CONFIG_MPC8540) || defined(CONFIG_MPC8541) || \
+    defined(CONFIG_MPC8560) || defined(CONFIG_MPC8555)
+#define FSL_HW_NUM_LAWS 8
+#elif defined(CONFIG_MPC8548) || defined(CONFIG_MPC8544) || \
+      defined(CONFIG_MPC8568) || \
+      defined(CONFIG_MPC8641) || defined(CONFIG_MPC8610)
+#define FSL_HW_NUM_LAWS 10
+#elif defined(CONFIG_MPC8572)
+#define FSL_HW_NUM_LAWS 12
+#else
+#error FSL_HW_NUM_LAWS not defined for this platform
+#endif
 
 void set_law(u8 idx, phys_addr_t addr, enum law_size sz, enum law_trgt_if id)
 {
@@ -36,18 +50,53 @@ void set_law(u8 idx, phys_addr_t addr, enum law_size sz, enum law_trgt_if id)
        volatile u32 *lawbar = base + 8 * idx;
        volatile u32 *lawar = base + 8 * idx + 2;
 
+       gd->used_laws |= (1 << idx);
+
        out_be32(lawbar, addr >> 12);
        out_be32(lawar, LAWAR_EN | ((u32)id << 20) | (u32)sz);
 
        return ;
 }
 
+int set_next_law(phys_addr_t addr, enum law_size sz, enum law_trgt_if id)
+{
+       u32 idx = ffz(gd->used_laws);
+
+       if (idx >= FSL_HW_NUM_LAWS)
+               return -1;
+
+       set_law(idx, addr, sz, id);
+
+       return idx;
+}
+
+int set_last_law(phys_addr_t addr, enum law_size sz, enum law_trgt_if id)
+{
+       u32 idx;
+
+       /* we have no LAWs free */
+       if (gd->used_laws == -1)
+               return -1;
+
+       /* grab the last free law */
+       idx = __ilog2(~(gd->used_laws));
+
+       if (idx >= FSL_HW_NUM_LAWS)
+               return -1;
+
+       set_law(idx, addr, sz, id);
+
+       return idx;
+}
+
 void disable_law(u8 idx)
 {
        volatile u32 *base = (volatile u32 *)(CFG_IMMR + 0xc08);
        volatile u32 *lawbar = base + 8 * idx;
        volatile u32 *lawar = base + 8 * idx + 2;
 
+       gd->used_laws &= ~(1 << idx);
+
        out_be32(lawar, 0);
        out_be32(lawbar, 0);
 
@@ -75,14 +124,16 @@ void print_laws(void)
 void init_laws(void)
 {
        int i;
-       u8 law_idx = 0;
 
-       for (i = 0; i < num_law_entries; i++) {
-               if (law_table[i].index != -1)
-                       law_idx = law_table[i].index;
+       gd->used_laws = ~((1 << FSL_HW_NUM_LAWS) - 1);
 
-               set_law(law_idx++, law_table[i].addr,
-                       law_table[i].size, law_table[i].trgt_id);
+       for (i = 0; i < num_law_entries; i++) {
+               if (law_table[i].index == -1)
+                       set_next_law(law_table[i].addr, law_table[i].size,
+                                       law_table[i].trgt_id);
+               else
+                       set_law(law_table[i].index, law_table[i].addr,
+                               law_table[i].size, law_table[i].trgt_id);
        }
 
        return ;
index d84f0fc55e23106129a066878a7ce9d428556687..d505bc8e87b2d8475941c8e908b3ec92bc1af77f 100644 (file)
@@ -76,7 +76,9 @@
 #define FLASH_CMD_PROTECT_SET          0x01
 #define FLASH_CMD_PROTECT_CLEAR                0xD0
 #define FLASH_CMD_CLEAR_STATUS         0x50
+#define FLASH_CMD_READ_STATUS          0x70
 #define FLASH_CMD_WRITE_TO_BUFFER      0xE8
+#define FLASH_CMD_WRITE_BUFFER_PROG    0xE9
 #define FLASH_CMD_WRITE_BUFFER_CONFIRM 0xD0
 
 #define FLASH_STATUS_DONE              0x80
 #define CFI_CMDSET_MITSU_STANDARD      256
 #define CFI_CMDSET_MITSU_EXTENDED      257
 #define CFI_CMDSET_SST                 258
+#define CFI_CMDSET_INTEL_PROG_REGIONS  512
 
 #ifdef CFG_FLASH_CFI_AMD_RESET /* needed for STM_ID_29W320DB on UC100 */
 # undef  FLASH_CMD_RESET
@@ -298,17 +301,25 @@ static inline void flash_unmap(flash_info_t *info, flash_sect_t sect,
 /*-----------------------------------------------------------------------
  * make a proper sized command based on the port and chip widths
  */
-static void flash_make_cmd (flash_info_t * info, uchar cmd, void *cmdbuf)
+static void flash_make_cmd (flash_info_t * info, ulong cmd, void *cmdbuf)
 {
        int i;
+       int cword_offset;
+       int cp_offset;
+       uchar val;
        uchar *cp = (uchar *) cmdbuf;
 
+       for (i = info->portwidth; i > 0; i--){
+               cword_offset = (info->portwidth-i)%info->chipwidth;
 #if defined(__LITTLE_ENDIAN) || defined(CFG_WRITE_SWAPPED_DATA)
-       for (i = info->portwidth; i > 0; i--)
+               cp_offset = info->portwidth - i;
+               val = *((uchar*)&cmd + cword_offset);
 #else
-       for (i = 1; i <= info->portwidth; i++)
+               cp_offset = i - 1;
+               val = *((uchar*)&cmd + sizeof(ulong) - cword_offset - 1);
 #endif
-               *cp++ = (i & (info->chipwidth - 1)) ? '\0' : cmd;
+               cp[cp_offset] = (cword_offset >= sizeof(ulong)) ? 0x00 : val;
+       }
 }
 
 #ifdef DEBUG
@@ -422,7 +433,7 @@ static ulong flash_read_long (flash_info_t * info, flash_sect_t sect,
  * Write a proper sized command to the correct address
  */
 static void flash_write_cmd (flash_info_t * info, flash_sect_t sect,
-                            uint offset, uchar cmd)
+                            uint offset, ulong cmd)
 {
 
        void *addr;
@@ -605,6 +616,7 @@ static int flash_is_busy (flash_info_t * info, flash_sect_t sect)
        int retval;
 
        switch (info->vendor) {
+       case CFI_CMDSET_INTEL_PROG_REGIONS:
        case CFI_CMDSET_INTEL_STANDARD:
        case CFI_CMDSET_INTEL_EXTENDED:
                retval = !flash_isset (info, sect, 0, FLASH_STATUS_DONE);
@@ -664,6 +676,7 @@ static int flash_full_status_check (flash_info_t * info, flash_sect_t sector,
 
        retcode = flash_status_check (info, sector, tout, prompt);
        switch (info->vendor) {
+       case CFI_CMDSET_INTEL_PROG_REGIONS:
        case CFI_CMDSET_INTEL_EXTENDED:
        case CFI_CMDSET_INTEL_STANDARD:
                if ((retcode == ERR_OK)
@@ -792,6 +805,7 @@ static int flash_write_cfiword (flash_info_t * info, ulong dest,
        flag = disable_interrupts ();
 
        switch (info->vendor) {
+       case CFI_CMDSET_INTEL_PROG_REGIONS:
        case CFI_CMDSET_INTEL_EXTENDED:
        case CFI_CMDSET_INTEL_STANDARD:
                flash_write_cmd (info, 0, 0, FLASH_CMD_CLEAR_STATUS);
@@ -846,6 +860,7 @@ static int flash_write_cfibuffer (flash_info_t * info, ulong dest, uchar * cp,
        int flag = 0;
        uint offset = 0;
        unsigned int shift;
+       uchar write_cmd;
 
        switch (info->portwidth) {
        case FLASH_CFI_8BIT:
@@ -900,10 +915,14 @@ static int flash_write_cfibuffer (flash_info_t * info, ulong dest, uchar * cp,
        sector = find_sector (info, dest);
 
        switch (info->vendor) {
+       case CFI_CMDSET_INTEL_PROG_REGIONS:
        case CFI_CMDSET_INTEL_STANDARD:
        case CFI_CMDSET_INTEL_EXTENDED:
+               write_cmd = (info->vendor == CFI_CMDSET_INTEL_PROG_REGIONS) ?
+                                       FLASH_CMD_WRITE_BUFFER_PROG : FLASH_CMD_WRITE_TO_BUFFER;
                flash_write_cmd (info, sector, 0, FLASH_CMD_CLEAR_STATUS);
-               flash_write_cmd (info, sector, 0, FLASH_CMD_WRITE_TO_BUFFER);
+               flash_write_cmd (info, sector, 0, FLASH_CMD_READ_STATUS);
+               flash_write_cmd (info, sector, 0, write_cmd);
                retcode = flash_status_check (info, sector,
                                              info->buffer_write_tout,
                                              "write to buffer");
@@ -911,7 +930,7 @@ static int flash_write_cfibuffer (flash_info_t * info, ulong dest, uchar * cp,
                        /* reduce the number of loops by the width of
                         * the port */
                        cnt = len >> shift;
-                       flash_write_cmd (info, sector, 0, (uchar) cnt - 1);
+                       flash_write_cmd (info, sector, 0, cnt - 1);
                        while (cnt-- > 0) {
                                switch (info->portwidth) {
                                case FLASH_CFI_8BIT:
@@ -1038,6 +1057,7 @@ int flash_erase (flash_info_t * info, int s_first, int s_last)
        for (sect = s_first; sect <= s_last; sect++) {
                if (info->protect[sect] == 0) { /* not protected */
                        switch (info->vendor) {
+                       case CFI_CMDSET_INTEL_PROG_REGIONS:
                        case CFI_CMDSET_INTEL_STANDARD:
                        case CFI_CMDSET_INTEL_EXTENDED:
                                flash_write_cmd (info, sect, 0,
@@ -1106,6 +1126,9 @@ void flash_print_info (flash_info_t * info)
                        info->size >> 20, info->sector_count);
        printf ("  ");
        switch (info->vendor) {
+               case CFI_CMDSET_INTEL_PROG_REGIONS:
+                       printf ("Intel Prog Regions");
+                       break;
                case CFI_CMDSET_INTEL_STANDARD:
                        printf ("Intel Standard");
                        break;
@@ -1496,6 +1519,7 @@ static void flash_read_jedec_ids (flash_info_t * info)
        info->device_id2      = 0;
 
        switch (info->vendor) {
+       case CFI_CMDSET_INTEL_PROG_REGIONS:
        case CFI_CMDSET_INTEL_STANDARD:
        case CFI_CMDSET_INTEL_EXTENDED:
                cmdset_intel_read_jedec_ids(info);
@@ -1550,6 +1574,7 @@ static int flash_detect_legacy(ulong base, int banknum)
                }
 
                switch(info->vendor) {
+               case CFI_CMDSET_INTEL_PROG_REGIONS:
                case CFI_CMDSET_INTEL_STANDARD:
                case CFI_CMDSET_INTEL_EXTENDED:
                        info->cmd_reset = FLASH_CMD_RESET;
@@ -1747,6 +1772,7 @@ ulong flash_get_size (ulong base, int banknum)
 #endif
 
                switch (info->vendor) {
+               case CFI_CMDSET_INTEL_PROG_REGIONS:
                case CFI_CMDSET_INTEL_STANDARD:
                case CFI_CMDSET_INTEL_EXTENDED:
                        cmdset_intel_init(info, &qry);
@@ -1824,6 +1850,7 @@ ulong flash_get_size (ulong base, int banknum)
                                 * supported devices (intel...)
                                 */
                                switch (info->vendor) {
+                               case CFI_CMDSET_INTEL_PROG_REGIONS:
                                case CFI_CMDSET_INTEL_EXTENDED:
                                case CFI_CMDSET_INTEL_STANDARD:
                                        info->protect[sect_cnt] =
index 5cc410a5e2f7313ef8f0574bcc6aba1140d81859..67ae9c8d5b1f624d20bed54e9190acbf532bac94 100644 (file)
 #include <linux/mtd/fsl_upm.h>
 #include <nand.h>
 
-#define FSL_UPM_MxMR_OP_NO (0 << 28) /* normal operation */
-#define FSL_UPM_MxMR_OP_WA (1 << 28) /* write array */
-#define FSL_UPM_MxMR_OP_RA (2 << 28) /* read array */
-#define FSL_UPM_MxMR_OP_RP (3 << 28) /* run pattern */
+static int fsl_upm_in_pattern;
 
 static void fsl_upm_start_pattern(struct fsl_upm *upm, u32 pat_offset)
 {
-       out_be32(upm->mxmr, FSL_UPM_MxMR_OP_RP | pat_offset);
+       clrsetbits_be32(upm->mxmr, MxMR_MAD_MSK, MxMR_OP_RUNP | pat_offset);
 }
 
 static void fsl_upm_end_pattern(struct fsl_upm *upm)
 {
-       out_be32(upm->mxmr, FSL_UPM_MxMR_OP_NO);
-       while (in_be32(upm->mxmr) != FSL_UPM_MxMR_OP_NO)
+       clrbits_be32(upm->mxmr, MxMR_OP_RUNP);
+
+       while (in_be32(upm->mxmr) & MxMR_OP_RUNP)
                eieio();
 }
 
 static void fsl_upm_run_pattern(struct fsl_upm *upm, int width, u32 cmd)
 {
-       out_be32(upm->mar, cmd << (32 - width * 8));
-       out_8(upm->io_addr, 0x0);
-}
-
-static void fsl_upm_setup(struct fsl_upm *upm)
-{
-       int i;
-
-       /* write upm array */
-       out_be32(upm->mxmr, FSL_UPM_MxMR_OP_WA);
-
-       for (i = 0; i < 64; i++) {
-               out_be32(upm->mdr, upm->array[i]);
+       out_be32(upm->mar, cmd << (32 - width));
+       switch (width) {
+       case 8:
                out_8(upm->io_addr, 0x0);
+               break;
+       case 16:
+               out_be16(upm->io_addr, 0x0);
+               break;
+       case 32:
+               out_be32(upm->io_addr, 0x0);
+               break;
        }
-
-       /* normal operation */
-       out_be32(upm->mxmr, FSL_UPM_MxMR_OP_NO);
-       while (in_be32(upm->mxmr) != FSL_UPM_MxMR_OP_NO)
-               eieio();
 }
 
-static void fun_cmdfunc(struct mtd_info *mtd, unsigned command, int column,
-                       int page_addr)
+static void nand_hwcontrol (struct mtd_info *mtd, int cmd)
 {
        struct nand_chip *chip = mtd->priv;
        struct fsl_upm_nand *fun = chip->priv;
 
-       fsl_upm_start_pattern(&fun->upm, fun->upm_cmd_offset);
-
-       if (command == NAND_CMD_SEQIN) {
-               int readcmd;
-
-               if (column >= mtd->oobblock) {
-                       /* OOB area */
-                       column -= mtd->oobblock;
-                       readcmd = NAND_CMD_READOOB;
-               } else if (column < 256) {
-                       /* First 256 bytes --> READ0 */
-                       readcmd = NAND_CMD_READ0;
-               } else {
-                       column -= 256;
-                       readcmd = NAND_CMD_READ1;
-               }
-               fsl_upm_run_pattern(&fun->upm, fun->width, readcmd);
+       switch (cmd) {
+       case NAND_CTL_SETCLE:
+               fsl_upm_start_pattern(&fun->upm, fun->upm_cmd_offset);
+               fsl_upm_in_pattern++;
+               break;
+       case NAND_CTL_SETALE:
+               fsl_upm_start_pattern(&fun->upm, fun->upm_addr_offset);
+               fsl_upm_in_pattern++;
+               break;
+       case NAND_CTL_CLRCLE:
+       case NAND_CTL_CLRALE:
+               fsl_upm_end_pattern(&fun->upm);
+               fsl_upm_in_pattern--;
+               break;
        }
+}
 
-       fsl_upm_run_pattern(&fun->upm, fun->width, command);
-
-       fsl_upm_end_pattern(&fun->upm);
-
-       fsl_upm_start_pattern(&fun->upm, fun->upm_addr_offset);
-
-       if (column != -1)
-               fsl_upm_run_pattern(&fun->upm, fun->width, column);
+static void nand_write_byte(struct mtd_info *mtd, u_char byte)
+{
+       struct nand_chip *chip = mtd->priv;
 
-       if (page_addr != -1) {
-               fsl_upm_run_pattern(&fun->upm, fun->width, page_addr);
-               fsl_upm_run_pattern(&fun->upm, fun->width,
-                                   (page_addr >> 8) & 0xFF);
-               if (chip->chipsize > (32 << 20)) {
-                       fsl_upm_run_pattern(&fun->upm, fun->width,
-                                           (page_addr >> 16) & 0x0f);
-               }
-       }
+       if (fsl_upm_in_pattern) {
+               struct fsl_upm_nand *fun = chip->priv;
 
-       fsl_upm_end_pattern(&fun->upm);
+               fsl_upm_run_pattern(&fun->upm, fun->width, byte);
 
-       if (fun->wait_pattern) {
                /*
                 * Some boards/chips needs this. At least on MPC8360E-RDK we
                 * need it. Probably weird chip, because I don't see any need
                 * for this on MPC8555E + Samsung K9F1G08U0A. Usually here are
                 * 0-2 unexpected busy states per block read.
                 */
-               while (!fun->dev_ready())
-                       debug("unexpected busy state\n");
+               if (fun->wait_pattern) {
+                       while (!fun->dev_ready())
+                               debug("unexpected busy state\n");
+               }
+       } else {
+               out_8(chip->IO_ADDR_W, byte);
        }
 }
 
-static void nand_write_byte(struct mtd_info *mtd, u_char byte)
-{
-       struct nand_chip *chip = mtd->priv;
-
-       out_8(chip->IO_ADDR_W, byte);
-}
-
 static u8 nand_read_byte(struct mtd_info *mtd)
 {
        struct nand_chip *chip = mtd->priv;
@@ -164,10 +135,6 @@ static int nand_verify_buf(struct mtd_info *mtd, const u_char *buf, int len)
        return 0;
 }
 
-static void nand_hwcontrol(struct mtd_info *mtd, int cmd)
-{
-}
-
 static int nand_dev_ready(struct mtd_info *mtd)
 {
        struct nand_chip *chip = mtd->priv;
@@ -178,23 +145,20 @@ static int nand_dev_ready(struct mtd_info *mtd)
 
 int fsl_upm_nand_init(struct nand_chip *chip, struct fsl_upm_nand *fun)
 {
-       /* yet only 8 bit accessors implemented */
-       if (fun->width != 1)
+       if (fun->width != 8 && fun->width != 16 && fun->width != 32)
                return -ENOSYS;
 
-       fsl_upm_setup(&fun->upm);
-
        chip->priv = fun;
        chip->chip_delay = fun->chip_delay;
        chip->eccmode = NAND_ECC_SOFT;
-       chip->cmdfunc = fun_cmdfunc;
        chip->hwcontrol = nand_hwcontrol;
        chip->read_byte = nand_read_byte;
        chip->read_buf = nand_read_buf;
        chip->write_byte = nand_write_byte;
        chip->write_buf = nand_write_buf;
        chip->verify_buf = nand_verify_buf;
-       chip->dev_ready = nand_dev_ready;
+       if (fun->dev_ready)
+               chip->dev_ready = nand_dev_ready;
 
        return 0;
 }
index 5aef31cd180789b1e60dc0f67918f6558c79244c..740d3fcc3737e637c731daa93ca4e93fd737b8d3 100644 (file)
@@ -113,18 +113,22 @@ static struct nand_oobinfo nand_oob_64 = {
        .oobfree = { {2, 38} }
 };
 
-/* This is used for padding purposes in nand_write_oob */
-static u_char ffchars[] = {
-       0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
-       0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
-       0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
-       0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
-       0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
-       0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
-       0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
-       0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+static struct nand_oobinfo nand_oob_128 = {
+       .useecc = MTD_NANDECC_AUTOPLACE,
+       .eccbytes = 48,
+       .eccpos = {
+               80,  81,  82,  83,  84,  85,  86,  87,
+               88,  89,  90,  91,  92,  93,  94,  95,
+               96,  97,  98,  99, 100, 101, 102, 103,
+               104, 105, 106, 107, 108, 109, 110, 111,
+               112, 113, 114, 115, 116, 117, 118, 119,
+               120, 121, 122, 123, 124, 125, 126, 127},
+       .oobfree = { {2, 78} }
 };
 
+/* This is used for padding purposes in nand_write_oob */
+static u_char *ffchars;
+
 /*
  * NAND low-level MTD interface functions
  */
@@ -193,6 +197,10 @@ static void nand_release_device (struct mtd_info *mtd)
 {
        struct nand_chip *this = mtd->priv;
        this->select_chip(mtd, -1);     /* De-select the NAND device */
+       if (ffchars) {
+               kfree(ffchars);
+               ffchars = NULL;
+       }
 }
 #endif
 
@@ -891,7 +899,7 @@ static int nand_write_page (struct mtd_info *mtd, struct nand_chip *this, int pa
        u_char *oob_buf,  struct nand_oobinfo *oobsel, int cached)
 {
        int     i, status;
-       u_char  ecc_code[32];
+       u_char  ecc_code[NAND_MAX_OOBSIZE];
        int     eccmode = oobsel->useecc ? this->eccmode : NAND_ECC_NONE;
        uint    *oob_config = oobsel->eccpos;
        int     datidx = 0, eccidx = 0, eccsteps = this->eccsteps;
@@ -1112,8 +1120,8 @@ static int nand_read_ecc (struct mtd_info *mtd, loff_t from, size_t len,
        int read = 0, oob = 0, ecc_status = 0, ecc_failed = 0;
        struct nand_chip *this = mtd->priv;
        u_char *data_poi, *oob_data = oob_buf;
-       u_char ecc_calc[32];
-       u_char ecc_code[32];
+       u_char ecc_calc[NAND_MAX_OOBSIZE];
+       u_char ecc_code[NAND_MAX_OOBSIZE];
        int eccmode, eccsteps;
        unsigned *oob_config;
        int     datidx;
@@ -1811,6 +1819,15 @@ static int nand_write_oob (struct mtd_info *mtd, loff_t to, size_t len, size_t *
        if (NAND_MUST_PAD(this)) {
                /* Write out desired data */
                this->cmdfunc (mtd, NAND_CMD_SEQIN, mtd->oobblock, page & this->pagemask);
+               if (!ffchars) {
+                       if (!(ffchars = kmalloc (mtd->oobsize, GFP_KERNEL))) {
+                               DEBUG (MTD_DEBUG_LEVEL0, "nand_write_oob: "
+                                          "No memory for padding array, need %d bytes", mtd->oobsize);
+                               ret = -ENOMEM;
+                               goto out;
+                       }
+                       memset(ffchars, 0xff, mtd->oobsize);
+               }
                /* prepad 0xff for partial programming */
                this->write_buf(mtd, ffchars, column);
                /* write data */
@@ -2479,6 +2496,9 @@ int nand_scan (struct mtd_info *mtd, int maxchips)
                case 64:
                        this->autooob = &nand_oob_64;
                        break;
+               case 128:
+                       this->autooob = &nand_oob_128;
+                       break;
                default:
                        printk (KERN_WARNING "No oob scheme defined for oobsize %d\n",
                                mtd->oobsize);
index 3f1e770efe17f99081b16ff7647359e6de8f4d0b..0cf8dff689fe066b48bfad1fe2df276db682e411 100644 (file)
@@ -26,8 +26,6 @@
 #include <command.h>
 #include <net.h>
 
-#ifdef CONFIG_DRIVER_3C589
-
 #include "3c589.h"
 
 
@@ -514,6 +512,3 @@ int eth_send(volatile void *packet, int length) {
 
        return length;
 }
-
-
-#endif /* CONFIG_DRIVER_3C589 */
index 5b031c9af198654a5790e94e2c9c866a25ed1456..84be2887569eaa4534f35aa55f65b02bb423cc77 100644 (file)
@@ -25,45 +25,45 @@ include $(TOPDIR)/config.mk
 
 LIB    := $(obj)libnet.a
 
-COBJS-y += 3c589.o
-COBJS-y += bcm570x.o bcm570x_autoneg.o 5701rls.o
+COBJS-$(CONFIG_DRIVER_3C589) += 3c589.o
+COBJS-$(CONFIG_BCM570x) += bcm570x.o bcm570x_autoneg.o 5701rls.o
 COBJS-$(CONFIG_BFIN_MAC) += bfin_mac.o
-COBJS-y += cs8900.o
-COBJS-y += dc2114x.o
-COBJS-y += dm9000x.o
-COBJS-y += e1000.o
-COBJS-y += eepro100.o
-COBJS-y += enc28j60.o
-COBJS-y += fsl_mcdmafec.o
+COBJS-$(CONFIG_DRIVER_CS8900) += cs8900.o
+COBJS-$(CONFIG_TULIP) += dc2114x.o
+COBJS-$(CONFIG_DRIVER_DM9000) += dm9000x.o
+COBJS-$(CONFIG_E1000) += e1000.o
+COBJS-$(CONFIG_EEPRO100) += eepro100.o
+COBJS-$(CONFIG_ENC28J60) += enc28j60.o
+COBJS-$(CONFIG_FSLDMAFEC) += fsl_mcdmafec.o
 COBJS-$(CONFIG_GRETH) += greth.o
-COBJS-y += inca-ip_sw.o
-COBJS-y += ks8695eth.o
-COBJS-y += lan91c96.o
-COBJS-y += macb.o
-COBJS-y += mcffec.o
-COBJS-y += natsemi.o
+COBJS-$(CONFIG_INCA_IP_SWITCH) += inca-ip_sw.o
+COBJS-$(CONFIG_DRIVER_KS8695ETH) += ks8695eth.o
+COBJS-$(CONFIG_DRIVER_LAN91C96) += lan91c96.o
+COBJS-$(CONFIG_MACB) += macb.o
+COBJS-$(CONFIG_MCFFEC) += mcffec.o
+COBJS-$(CONFIG_NATSEMI) += natsemi.o
 ifeq ($(CONFIG_DRIVER_NE2000),y)
 COBJS-y += ne2000.o
 COBJS-$(CONFIG_DRIVER_AX88796L) += ax88796.o
 endif
-COBJS-y += netarm_eth.o
-COBJS-y += netconsole.o
-COBJS-y += ns7520_eth.o
-COBJS-y += ns8382x.o
-COBJS-y += ns9750_eth.o
-COBJS-y += pcnet.o
-COBJS-y += plb2800_eth.o
-COBJS-y += rtl8019.o
-COBJS-y += rtl8139.o
-COBJS-y += rtl8169.o
-COBJS-y += s3c4510b_eth.o
-COBJS-y += smc91111.o
-COBJS-y += smc911x.o
-COBJS-y += tigon3.o
-COBJS-y += tsec.o
-COBJS-y += tsi108_eth.o
-COBJS-y += uli526x.o
-COBJS-y += vsc7385.o
+COBJS-$(CONFIG_DRIVER_NETARMETH) += netarm_eth.o
+COBJS-$(CONFIG_NETCONSOLE) += netconsole.o
+COBJS-$(CONFIG_DRIVER_NS7520_ETHERNET) += ns7520_eth.o
+COBJS-$(CONFIG_NS8382X) += ns8382x.o
+COBJS-$(CONFIG_DRIVER_NS9750_ETHERNET) += ns9750_eth.o
+COBJS-$(CONFIG_PCNET) += pcnet.o
+COBJS-$(CONFIG_PLB2800_ETHER) += plb2800_eth.o
+COBJS-$(CONFIG_DRIVER_RTL8019) += rtl8019.o
+COBJS-$(CONFIG_RTL8139) += rtl8139.o
+COBJS-$(CONFIG_RTL8169) += rtl8169.o
+COBJS-$(CONFIG_DRIVER_S3C4510_ETH) += s3c4510b_eth.o
+COBJS-$(CONFIG_DRIVER_SMC91111) += smc91111.o
+COBJS-$(CONFIG_DRIVER_SMC911X) += smc911x.o
+COBJS-$(CONFIG_TIGON3) += tigon3.o bcm570x_autoneg.o 5701rls.o
+COBJS-$(CONFIG_TSEC_ENET) += tsec.o
+COBJS-$(CONFIG_TSI108_ETH) += tsi108_eth.o
+COBJS-$(CONFIG_ULI526X) += uli526x.o
+COBJS-$(CONFIG_VSC7385_ENET) += vsc7385.o
 COBJS-$(CONFIG_XILINX_EMAC) += xilinx_emac.o
 COBJS-$(CONFIG_XILINX_EMACLITE) += xilinx_emaclite.o
 
index 5ad31d1fdb6e29145ec4ed7e944f053a89fe1cd8..6b28b95ebc6418471594252c817f016dead63065 100644 (file)
@@ -6,9 +6,6 @@
 
 #include <common.h>
 
-#if defined(CONFIG_CMD_NET) \
-       && (!defined(CONFIG_NET_MULTI)) && defined(CONFIG_BCM570x)
-
 #ifdef CONFIG_BMW
 #include <mpc824x.h>
 #endif
@@ -1599,5 +1596,3 @@ PQQ_ENTRY QQ_GetTail (PQQ_CONTAINER pQueue, unsigned int Idx)
 
        return pQueue->Array[Idx];
 }
-
-#endif
index 458b517d1fc65db8566659d3a556ff88d74f6702..ae1983ac0b56bcfc539a45b8cf8bc6f33b780dc5 100644 (file)
 #include "cs8900.h"
 #include <net.h>
 
-#ifdef CONFIG_DRIVER_CS8900
-
-#if defined(CONFIG_CMD_NET)
-
 #undef DEBUG
 
 /* packet page register access functions */
@@ -315,7 +311,3 @@ int cs8900_e2prom_write(unsigned char addr, unsigned short value)
 
        return 0;
 }
-
-#endif /* CONFIG_CMD_NET */
-
-#endif /* CONFIG_DRIVER_CS8900 */
index 1d728d8b307bfad4f07e94758b54f922f14b7248..811723904d0f28b640f44585b12b5821dee8549e 100644 (file)
  */
 
 #include <common.h>
-
-#if defined(CONFIG_CMD_NET) \
-       && defined(CONFIG_NET_MULTI) && defined(CONFIG_TULIP)
-
 #include <malloc.h>
 #include <net.h>
 #include <pci.h>
@@ -766,5 +762,3 @@ static void update_srom(struct eth_device *dev, bd_t *bis)
        }
 }
 #endif /* UPDATE_SROM */
-
-#endif
index 68901cd818e004d5f6132b965cafa11f34d20c12..844fb766d8c08edbbe9e686f6f631f46799be580 100644 (file)
@@ -36,7 +36,24 @@ v1.2   03/18/2003       Weilun Huang <weilun_huang@davicom.com.tw>:
 
 --------------------------------------
 
-       12/15/2003       Initial port to u-boot by Sascha Hauer <saschahauer@web.de>
+       12/15/2003       Initial port to u-boot by
+                               Sascha Hauer <saschahauer@web.de>
+
+       06/03/2008      Remy Bohmer <linux@bohmer.net>
+                       - Fixed the driver to work with DM9000A.
+                         (check on ISR receive status bit before reading the
+                         FIFO as described in DM9000 programming guide and
+                         application notes)
+                       - Added autodetect of databus width.
+                       - Made debug code compile again.
+                       - Adapt eth_send such that it matches the DM9000*
+                         application notes. Needed to make it work properly
+                         for DM9000A.
+                       - Adapted reset procedure to match DM9000 application
+                         notes (i.e. double reset)
+                       - some minor code cleanups
+                       These changes are tested with DM9000{A,EP,E} together
+                       with a 200MHz Atmel AT91SAM92161 core
 
 TODO: Homerun NIC and longrun NIC are not functional, only internal at the
       moment.
@@ -47,8 +64,6 @@ TODO: Homerun NIC and longrun NIC are not functional, only internal at the
 #include <net.h>
 #include <asm/io.h>
 
-#ifdef CONFIG_DRIVER_DM9000
-
 #include "dm9000x.h"
 
 /* Board/System/Debug information/definition ---------------- */
@@ -59,10 +74,22 @@ TODO: Homerun NIC and longrun NIC are not functional, only internal at the
 /* #define CONFIG_DM9000_DEBUG */
 
 #ifdef CONFIG_DM9000_DEBUG
-#define DM9000_DBG(fmt,args...) printf(fmt ,##args)
-#else                          /*  */
+#define DM9000_DBG(fmt,args...) printf(fmt, ##args)
+#define DM9000_DMP_PACKET(func,packet,length)  \
+       do { \
+               int i;                                                  \
+               printf(func ": length: %d\n", length);                  \
+               for (i = 0; i < length; i++) {                          \
+                       if (i % 8 == 0)                                 \
+                               printf("\n%s: %02x: ", func, i);        \
+                       printf("%02x ", ((unsigned char *) packet)[i]); \
+               } printf("\n");                                         \
+       } while(0)
+#else
 #define DM9000_DBG(fmt,args...)
-#endif                         /*  */
+#define DM9000_DMP_PACKET(func,packet,length)
+#endif
+
 enum DM9000_PHY_mode { DM9000_10MHD = 0, DM9000_100MHD =
            1, DM9000_10MFD = 4, DM9000_100MFD = 5, DM9000_AUTO =
            8, DM9000_1M_HPNA = 0x10
@@ -84,8 +111,11 @@ typedef struct board_info {
        u8 device_wait_reset;   /* device state */
        u8 nic_type;            /* NIC type */
        unsigned char srom[128];
+       void (*outblk)(volatile void *data_ptr, int count);
+       void (*inblk)(void *data_ptr, int count);
+       void (*rx_status)(u16 *RxStatus, u16 *RxLen);
 } board_info_t;
-board_info_t dmfe_info;
+static board_info_t dm9000_info;
 
 /* For module input parameter */
 static int media_mode = DM9000_AUTO;
@@ -124,10 +154,85 @@ dump_regs(void)
        DM9000_DBG("TSRII (0x04): %02x\n", DM9000_ior(4));
        DM9000_DBG("RCR   (0x05): %02x\n", DM9000_ior(5));
        DM9000_DBG("RSR   (0x06): %02x\n", DM9000_ior(6));
-       DM9000_DBG("ISR   (0xFE): %02x\n", DM9000_ior(ISR));
+       DM9000_DBG("ISR   (0xFE): %02x\n", DM9000_ior(DM9000_ISR));
        DM9000_DBG("\n");
 }
-#endif                         /*  */
+#endif
+
+static void dm9000_outblk_8bit(volatile void *data_ptr, int count)
+{
+       int i;
+       for (i = 0; i < count; i++)
+               DM9000_outb((((u8 *) data_ptr)[i] & 0xff), DM9000_DATA);
+}
+
+static void dm9000_outblk_16bit(volatile void *data_ptr, int count)
+{
+       int i;
+       u32 tmplen = (count + 1) / 2;
+
+       for (i = 0; i < tmplen; i++)
+               DM9000_outw(((u16 *) data_ptr)[i], DM9000_DATA);
+}
+static void dm9000_outblk_32bit(volatile void *data_ptr, int count)
+{
+       int i;
+       u32 tmplen = (count + 3) / 4;
+
+       for (i = 0; i < tmplen; i++)
+               DM9000_outl(((u32 *) data_ptr)[i], DM9000_DATA);
+}
+
+static void dm9000_inblk_8bit(void *data_ptr, int count)
+{
+       int i;
+       for (i = 0; i < count; i++)
+               ((u8 *) data_ptr)[i] = DM9000_inb(DM9000_DATA);
+}
+
+static void dm9000_inblk_16bit(void *data_ptr, int count)
+{
+       int i;
+       u32 tmplen = (count + 1) / 2;
+
+       for (i = 0; i < tmplen; i++)
+               ((u16 *) data_ptr)[i] = DM9000_inw(DM9000_DATA);
+}
+static void dm9000_inblk_32bit(void *data_ptr, int count)
+{
+       int i;
+       u32 tmplen = (count + 3) / 4;
+
+       for (i = 0; i < tmplen; i++)
+               ((u32 *) data_ptr)[i] = DM9000_inl(DM9000_DATA);
+}
+
+static void dm9000_rx_status_32bit(u16 *RxStatus, u16 *RxLen)
+{
+       u32 tmpdata;
+
+       DM9000_outb(DM9000_MRCMD, DM9000_IO);
+
+       tmpdata = DM9000_inl(DM9000_DATA);
+       *RxStatus = tmpdata;
+       *RxLen = tmpdata >> 16;
+}
+
+static void dm9000_rx_status_16bit(u16 *RxStatus, u16 *RxLen)
+{
+       DM9000_outb(DM9000_MRCMD, DM9000_IO);
+
+       *RxStatus = DM9000_inw(DM9000_DATA);
+       *RxLen = DM9000_inw(DM9000_DATA);
+}
+
+static void dm9000_rx_status_8bit(u16 *RxStatus, u16 *RxLen)
+{
+       DM9000_outb(DM9000_MRCMD, DM9000_IO);
+
+       *RxStatus = DM9000_inb(DM9000_DATA) + (DM9000_inb(DM9000_DATA) << 8);
+       *RxLen = DM9000_inb(DM9000_DATA) + (DM9000_inb(DM9000_DATA) << 8);
+}
 
 /*
   Search DM9000 board, allocate space and register it
@@ -236,7 +341,7 @@ program_dm9802(void)
 static void
 identify_nic(void)
 {
-       struct board_info *db = &dmfe_info;     /* Point a board information structure */
+       struct board_info *db = &dm9000_info;
        u16 phy_reg3;
        DM9000_iow(DM9000_NCR, NCR_EXT_PHY);
        phy_reg3 = phy_read(3);
@@ -263,9 +368,35 @@ identify_nic(void)
 static void
 dm9000_reset(void)
 {
-       DM9000_DBG("resetting\n");
-       DM9000_iow(DM9000_NCR, NCR_RST);
-       udelay(1000);           /* delay 1ms */
+       DM9000_DBG("resetting DM9000\n");
+
+       /* Reset DM9000,
+          see DM9000 Application Notes V1.22 Jun 11, 2004 page 29 */
+
+       /* DEBUG: Make all GPIO pins outputs */
+       DM9000_iow(DM9000_GPCR, 0x0F);
+       /* Step 1: Power internal PHY by writing 0 to GPIO0 pin */
+       DM9000_iow(DM9000_GPR, 0);
+       /* Step 2: Software reset */
+       DM9000_iow(DM9000_NCR, 3);
+
+       do {
+               DM9000_DBG("resetting the DM9000, 1st reset\n");
+               udelay(25); /* Wait at least 20 us */
+       } while (DM9000_ior(DM9000_NCR) & 1);
+
+       DM9000_iow(DM9000_NCR, 0);
+       DM9000_iow(DM9000_NCR, 3); /* Issue a second reset */
+
+       do {
+               DM9000_DBG("resetting the DM9000, 2nd reset\n");
+               udelay(25); /* Wait at least 20 us */
+       } while (DM9000_ior(DM9000_NCR) & 1);
+
+       /* Check whether the ethernet controller is present */
+       if ((DM9000_ior(DM9000_PIDL) != 0x0) ||
+           (DM9000_ior(DM9000_PIDH) != 0x90))
+               printf("ERROR: resetting DM9000 -> not responding\n");
 }
 
 /* Initilize dm9000 board
@@ -274,12 +405,46 @@ int
 eth_init(bd_t * bd)
 {
        int i, oft, lnk;
+       u8 io_mode;
+       struct board_info *db = &dm9000_info;
+
        DM9000_DBG("eth_init()\n");
 
        /* RESET device */
        dm9000_reset();
        dm9000_probe();
 
+       /* Auto-detect 8/16/32 bit mode, ISR Bit 6+7 indicate bus width */
+       io_mode = DM9000_ior(DM9000_ISR) >> 6;
+
+       switch (io_mode) {
+       case 0x0:  /* 16-bit mode */
+               printf("DM9000: running in 16 bit mode\n");
+               db->outblk    = dm9000_outblk_16bit;
+               db->inblk     = dm9000_inblk_16bit;
+               db->rx_status = dm9000_rx_status_16bit;
+               break;
+       case 0x01:  /* 32-bit mode */
+               printf("DM9000: running in 32 bit mode\n");
+               db->outblk    = dm9000_outblk_32bit;
+               db->inblk     = dm9000_inblk_32bit;
+               db->rx_status = dm9000_rx_status_32bit;
+               break;
+       case 0x02: /* 8 bit mode */
+               printf("DM9000: running in 8 bit mode\n");
+               db->outblk    = dm9000_outblk_8bit;
+               db->inblk     = dm9000_inblk_8bit;
+               db->rx_status = dm9000_rx_status_8bit;
+               break;
+       default:
+               /* Assume 8 bit mode, will probably not work anyway */
+               printf("DM9000: Undefined IO-mode:0x%x\n", io_mode);
+               db->outblk    = dm9000_outblk_8bit;
+               db->inblk     = dm9000_inblk_8bit;
+               db->rx_status = dm9000_rx_status_8bit;
+               break;
+       }
+
        /* NIC Type: FASTETHER, HOMERUN, LONGRUN */
        identify_nic();
 
@@ -289,15 +454,22 @@ eth_init(bd_t * bd)
        /* Set PHY */
        set_PHY_mode();
 
-       /* Program operating register */
-       DM9000_iow(DM9000_NCR, 0x0);    /* only intern phy supported by now */
-       DM9000_iow(DM9000_TCR, 0);      /* TX Polling clear */
-       DM9000_iow(DM9000_BPTR, 0x3f);  /* Less 3Kb, 200us */
-       DM9000_iow(DM9000_FCTR, FCTR_HWOT(3) | FCTR_LWOT(8));   /* Flow Control : High/Low Water */
-       DM9000_iow(DM9000_FCR, 0x0);    /* SH FIXME: This looks strange! Flow Control */
-       DM9000_iow(DM9000_SMCR, 0);     /* Special Mode */
-       DM9000_iow(DM9000_NSR, NSR_WAKEST | NSR_TX2END | NSR_TX1END);   /* clear TX status */
-       DM9000_iow(DM9000_ISR, 0x0f);   /* Clear interrupt status */
+       /* Program operating register, only intern phy supported by now */
+       DM9000_iow(DM9000_NCR, 0x0);
+       /* TX Polling clear */
+       DM9000_iow(DM9000_TCR, 0);
+       /* Less 3Kb, 200us */
+       DM9000_iow(DM9000_BPTR, 0x3f);
+       /* Flow Control : High/Low Water */
+       DM9000_iow(DM9000_FCTR, FCTR_HWOT(3) | FCTR_LWOT(8));
+       /* SH FIXME: This looks strange! Flow Control */
+       DM9000_iow(DM9000_FCR, 0x0);
+       /* Special Mode */
+       DM9000_iow(DM9000_SMCR, 0);
+       /* clear TX status */
+       DM9000_iow(DM9000_NSR, NSR_WAKEST | NSR_TX2END | NSR_TX1END);
+       /* Clear interrupt status */
+       DM9000_iow(DM9000_ISR, 0x0f);
 
        /* Set Node address */
 #ifndef CONFIG_AT91SAM9261EK
@@ -333,8 +505,11 @@ eth_init(bd_t * bd)
        DM9000_DBG("\n");
 
        /* Activate DM9000 */
-       DM9000_iow(DM9000_RCR, RCR_DIS_LONG | RCR_DIS_CRC | RCR_RXEN);  /* RX enable */
-       DM9000_iow(DM9000_IMR, IMR_PAR);        /* Enable TX/RX interrupt mask */
+       /* RX enable */
+       DM9000_iow(DM9000_RCR, RCR_DIS_LONG | RCR_DIS_CRC | RCR_RXEN);
+       /* Enable TX/RX interrupt mask */
+       DM9000_iow(DM9000_IMR, IMR_PAR);
+
        i = 0;
        while (!(phy_read(1) & 0x20)) { /* autonegation complete bit */
                udelay(1000);
@@ -376,54 +551,37 @@ eth_init(bd_t * bd)
 int
 eth_send(volatile void *packet, int length)
 {
-       char *data_ptr;
-       u32 tmplen, i;
        int tmo;
-       DM9000_DBG("eth_send: length: %d\n", length);
-       for (i = 0; i < length; i++) {
-               if (i % 8 == 0)
-                       DM9000_DBG("\nSend: 02x: ", i);
-               DM9000_DBG("%02x ", ((unsigned char *) packet)[i]);
-       } DM9000_DBG("\n");
-
-       /* Move data to DM9000 TX RAM */
-       data_ptr = (char *) packet;
-       DM9000_outb(DM9000_MWCMD, DM9000_IO);
+       struct board_info *db = &dm9000_info;
 
-#ifdef CONFIG_DM9000_USE_8BIT
-       /* Byte mode */
-       for (i = 0; i < length; i++)
-               DM9000_outb((data_ptr[i] & 0xff), DM9000_DATA);
+       DM9000_DMP_PACKET("eth_send", packet, length);
 
-#endif                         /*  */
-#ifdef CONFIG_DM9000_USE_16BIT
-       tmplen = (length + 1) / 2;
-       for (i = 0; i < tmplen; i++)
-               DM9000_outw(((u16 *) data_ptr)[i], DM9000_DATA);
+       DM9000_iow(DM9000_ISR, IMR_PTM); /* Clear Tx bit in ISR */
 
-#endif                         /*  */
-#ifdef CONFIG_DM9000_USE_32BIT
-       tmplen = (length + 3) / 4;
-       for (i = 0; i < tmplen; i++)
-               DM9000_outl(((u32 *) data_ptr)[i], DM9000_DATA);
+       /* Move data to DM9000 TX RAM */
+       DM9000_outb(DM9000_MWCMD, DM9000_IO); /* Prepare for TX-data */
 
-#endif                         /*  */
+       /* push the data to the TX-fifo */
+       (db->outblk)(packet, length);
 
        /* Set TX length to DM9000 */
        DM9000_iow(DM9000_TXPLL, length & 0xff);
        DM9000_iow(DM9000_TXPLH, (length >> 8) & 0xff);
 
        /* Issue TX polling command */
-       DM9000_iow(DM9000_TCR, TCR_TXREQ);      /* Cleared after TX complete */
+       DM9000_iow(DM9000_TCR, TCR_TXREQ); /* Cleared after TX complete */
 
        /* wait for end of transmission */
        tmo = get_timer(0) + 5 * CFG_HZ;
-       while (DM9000_ior(DM9000_TCR) & TCR_TXREQ) {
+       while ( !(DM9000_ior(DM9000_NSR) & (NSR_TX1END | NSR_TX2END)) ||
+               !(DM9000_ior(DM9000_ISR) & IMR_PTM) ) {
                if (get_timer(0) >= tmo) {
                        printf("transmission timeout\n");
                        break;
                }
        }
+       DM9000_iow(DM9000_ISR, IMR_PTM); /* Clear Tx bit in ISR */
+
        DM9000_DBG("transmit done\n\n");
        return 0;
 }
@@ -452,86 +610,67 @@ eth_rx(void)
 {
        u8 rxbyte, *rdptr = (u8 *) NetRxPackets[0];
        u16 RxStatus, RxLen = 0;
-       u32 tmplen, i;
-#ifdef CONFIG_DM9000_USE_32BIT
-       u32 tmpdata;
-#endif
+       struct board_info *db = &dm9000_info;
 
-       /* Check packet ready or not */
-       DM9000_ior(DM9000_MRCMDX);      /* Dummy read */
-       rxbyte = DM9000_inb(DM9000_DATA);       /* Got most updated data */
-       if (rxbyte == 0)
+       /* Check packet ready or not, we must check
+          the ISR status first for DM9000A */
+       if (!(DM9000_ior(DM9000_ISR) & 0x01)) /* Rx-ISR bit must be set. */
                return 0;
 
-       /* Status check: this byte must be 0 or 1 */
-       if (rxbyte > 1) {
-               DM9000_iow(DM9000_RCR, 0x00);   /* Stop Device */
-               DM9000_iow(DM9000_ISR, 0x80);   /* Stop INT request */
-               DM9000_DBG("rx status check: %d\n", rxbyte);
-       }
-       DM9000_DBG("receiving packet\n");
-
-       /* A packet ready now  & Get status/length */
-       DM9000_outb(DM9000_MRCMD, DM9000_IO);
+       DM9000_iow(DM9000_ISR, 0x01); /* clear PR status latched in bit 0 */
 
-#ifdef CONFIG_DM9000_USE_8BIT
-       RxStatus = DM9000_inb(DM9000_DATA) + (DM9000_inb(DM9000_DATA) << 8);
-       RxLen = DM9000_inb(DM9000_DATA) + (DM9000_inb(DM9000_DATA) << 8);
-
-#endif                         /*  */
-#ifdef CONFIG_DM9000_USE_16BIT
-       RxStatus = DM9000_inw(DM9000_DATA);
-       RxLen = DM9000_inw(DM9000_DATA);
-
-#endif                         /*  */
-#ifdef CONFIG_DM9000_USE_32BIT
-       tmpdata = DM9000_inl(DM9000_DATA);
-       RxStatus = tmpdata;
-       RxLen = tmpdata >> 16;
+       /* There is _at least_ 1 package in the fifo, read them all */
+       for (;;) {
+               DM9000_ior(DM9000_MRCMDX);      /* Dummy read */
 
-#endif                         /*  */
-       DM9000_DBG("rx status: 0x%04x rx len: %d\n", RxStatus, RxLen);
+               /* Get most updated data,
+                  only look at bits 0:1, See application notes DM9000 */
+               rxbyte = DM9000_inb(DM9000_DATA) & 0x03;
 
-       /* Move data from DM9000 */
-       /* Read received packet from RX SRAM */
-#ifdef CONFIG_DM9000_USE_8BIT
-       for (i = 0; i < RxLen; i++)
-               rdptr[i] = DM9000_inb(DM9000_DATA);
-
-#endif                         /*  */
-#ifdef CONFIG_DM9000_USE_16BIT
-       tmplen = (RxLen + 1) / 2;
-       for (i = 0; i < tmplen; i++)
-               ((u16 *) rdptr)[i] = DM9000_inw(DM9000_DATA);
+               /* Status check: this byte must be 0 or 1 */
+               if (rxbyte > DM9000_PKT_RDY) {
+                       DM9000_iow(DM9000_RCR, 0x00);   /* Stop Device */
+                       DM9000_iow(DM9000_ISR, 0x80);   /* Stop INT request */
+                       printf("DM9000 error: status check fail: 0x%x\n",
+                               rxbyte);
+                       return 0;
+               }
 
-#endif                         /*  */
-#ifdef CONFIG_DM9000_USE_32BIT
-       tmplen = (RxLen + 3) / 4;
-       for (i = 0; i < tmplen; i++)
-               ((u32 *) rdptr)[i] = DM9000_inl(DM9000_DATA);
+               if (rxbyte != DM9000_PKT_RDY)
+                       return 0; /* No packet received, ignore */
+
+               DM9000_DBG("receiving packet\n");
+
+               /* A packet ready now  & Get status/length */
+               (db->rx_status)(&RxStatus, &RxLen);
+
+               DM9000_DBG("rx status: 0x%04x rx len: %d\n", RxStatus, RxLen);
+
+               /* Move data from DM9000 */
+               /* Read received packet from RX SRAM */
+               (db->inblk)(rdptr, RxLen);
+
+               if ((RxStatus & 0xbf00) || (RxLen < 0x40)
+                       || (RxLen > DM9000_PKT_MAX)) {
+                       if (RxStatus & 0x100) {
+                               printf("rx fifo error\n");
+                       }
+                       if (RxStatus & 0x200) {
+                               printf("rx crc error\n");
+                       }
+                       if (RxStatus & 0x8000) {
+                               printf("rx length error\n");
+                       }
+                       if (RxLen > DM9000_PKT_MAX) {
+                               printf("rx length too big\n");
+                               dm9000_reset();
+                       }
+               } else {
+                       DM9000_DMP_PACKET("eth_rx", rdptr, RxLen);
 
-#endif                         /*  */
-       if ((RxStatus & 0xbf00) || (RxLen < 0x40)
-           || (RxLen > DM9000_PKT_MAX)) {
-               if (RxStatus & 0x100) {
-                       printf("rx fifo error\n");
+                       DM9000_DBG("passing packet to upper layer\n");
+                       NetReceive(NetRxPackets[0], RxLen);
                }
-               if (RxStatus & 0x200) {
-                       printf("rx crc error\n");
-               }
-               if (RxStatus & 0x8000) {
-                       printf("rx length error\n");
-               }
-               if (RxLen > DM9000_PKT_MAX) {
-                       printf("rx length too big\n");
-                       dm9000_reset();
-               }
-       } else {
-
-               /* Pass to upper layer */
-               DM9000_DBG("passing packet to upper layer\n");
-               NetReceive(NetRxPackets[0], RxLen);
-               return RxLen;
        }
        return 0;
 }
@@ -592,12 +731,12 @@ phy_read(int reg)
        /* Fill the phyxcer register into REG_0C */
        DM9000_iow(DM9000_EPAR, DM9000_PHY | reg);
        DM9000_iow(DM9000_EPCR, 0xc);   /* Issue phyxcer read command */
-       udelay(100);            /* Wait read complete */
+       udelay(100);                    /* Wait read complete */
        DM9000_iow(DM9000_EPCR, 0x0);   /* Clear phyxcer read command */
        val = (DM9000_ior(DM9000_EPDRH) << 8) | DM9000_ior(DM9000_EPDRL);
 
        /* The read data keeps on REG_0D & REG_0E */
-       DM9000_DBG("phy_read(%d): %d\n", reg, val);
+       DM9000_DBG("phy_read(0x%x): 0x%x\n", reg, val);
        return val;
 }
 
@@ -615,8 +754,7 @@ phy_write(int reg, u16 value)
        DM9000_iow(DM9000_EPDRL, (value & 0xff));
        DM9000_iow(DM9000_EPDRH, ((value >> 8) & 0xff));
        DM9000_iow(DM9000_EPCR, 0xa);   /* Issue phyxcer write command */
-       udelay(500);            /* Wait write complete */
+       udelay(500);                    /* Wait write complete */
        DM9000_iow(DM9000_EPCR, 0x0);   /* Clear phyxcer write command */
-       DM9000_DBG("phy_write(reg:%d, value:%d)\n", reg, value);
+       DM9000_DBG("phy_write(reg:0x%x, value:0x%x)\n", reg, value);
 }
-#endif                         /* CONFIG_DRIVER_DM9000 */
index c53c226d2810a5ae1e8a2b57e021a8f5688fd1d1..c31029ab5502c34971d74c6185150af03e3e64a1 100644 (file)
@@ -44,9 +44,6 @@ tested on both gig copper and gig fiber boards
 
 #include "e1000.h"
 
-#if defined(CONFIG_CMD_NET) \
-       && defined(CONFIG_NET_MULTI) && defined(CONFIG_E1000)
-
 #define TOUT_LOOP   100000
 
 #undef virt_to_bus
@@ -83,6 +80,7 @@ static struct pci_device_id supported[] = {
        {PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82546EB_FIBER},
        {PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82540EM_LOM},
        {PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82541ER},
+       {PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82541GI_LF},
 };
 
 /* Function forward declarations */
@@ -646,6 +644,7 @@ e1000_set_mac_type(struct e1000_hw *hw)
                hw->mac_type = e1000_82546;
                break;
        case E1000_DEV_ID_82541ER:
+       case E1000_DEV_ID_82541GI_LF:
                hw->mac_type = e1000_82541_rev_2;
                break;
        default:
@@ -3059,5 +3058,3 @@ e1000_initialize(bd_t * bis)
        }
        return 1;
 }
-
-#endif
index 851467d81c9e2a310eb8c55572e74311c38ead07..23b2eb9b498a80ccb4e49a20740b34e3ba245a8f 100644 (file)
@@ -222,7 +222,8 @@ struct e1000_phy_stats {
 #define E1000_DEV_ID_82546EB_COPPER 0x1010
 #define E1000_DEV_ID_82546EB_FIBER  0x1012
 #define E1000_DEV_ID_82541ER       0x1078
-#define NUM_DEV_IDS 14
+#define E1000_DEV_ID_82541GI_LF            0x107C
+#define NUM_DEV_IDS 15
 
 #define NODE_ADDRESS_SIZE 6
 #define ETH_LENGTH_OF_ADDRESS 6
index 96ed2710c21419286ed0ae02ac6db893b8a23442..9de0fb5e46c2c46969d017a05b7bb1b9a9382125 100644 (file)
@@ -30,9 +30,6 @@
 
 #undef DEBUG
 
-#if defined(CONFIG_CMD_NET) \
-       && defined(CONFIG_NET_MULTI) && defined(CONFIG_EEPRO100)
-
        /* Ethernet chip registers.
         */
 #define SCBStatus              0       /* Rx/Command Unit Status *Word* */
@@ -944,5 +941,3 @@ static void read_hw_addr (struct eth_device *dev, bd_t * bis)
 #endif
        }
 }
-
-#endif
index 98303aceee9fd9be20e857c271aea6a81a4456e2..5c24b0d9f9d3f0f6e88c466af9a93037e7f16532 100644 (file)
@@ -17,7 +17,6 @@
 
 #include <config.h>
 #include <common.h>
-#ifdef CONFIG_ENC28J60
 #include <net.h>
 #include <asm/arch/hardware.h>
 #include <asm/arch/spi.h>
@@ -979,5 +978,3 @@ static void phyWrite(unsigned char addr, unsigned short data)
                }
        }
 }
-
-#endif /* CONFIG_ENC28J60 */
index 2ef91f2d224eafd2f0d77cb873a48635dc4b0319..f2bdba6184c03fd5b59a1e824f87d31dc6fac9f2 100644 (file)
@@ -31,7 +31,6 @@
 #include <net.h>
 #include <miiphy.h>
 
-#ifdef CONFIG_FSLDMAFEC
 #undef ET_DEBUG
 #undef MII_DEBUG
 
@@ -49,7 +48,6 @@
 #define BD_ENET_RX_ERR (BD_ENET_RX_LG | BD_ENET_RX_NO | BD_ENET_RX_CR | \
                         BD_ENET_RX_OV | BD_ENET_RX_TR)
 
-#if defined(CONFIG_CMD_NET) && defined(CONFIG_NET_MULTI)
 #include <asm/immap.h>
 #include <asm/fsl_mcdmafec.h>
 
@@ -586,6 +584,3 @@ int mcdmafec_initialize(bd_t * bis)
 
        return 1;
 }
-
-#endif                         /* CONFIG_CMD_NET && CONFIG_NET_MULTI */
-#endif                         /* CONFIG_FSLDMAFEC */
index e4aaed6afbc6c1709987c5fbc3226cc0a5487525..ffdd1f3f3717ad53a6e169fff83145c0c445209f 100644 (file)
@@ -26,9 +26,6 @@
 
 #include <common.h>
 
-#if defined(CONFIG_CMD_NET) \
-       && defined(CONFIG_NET_MULTI) && defined(CONFIG_INCA_IP_SWITCH)
-
 #include <malloc.h>
 #include <net.h>
 #include <asm/inca-ip.h>
@@ -813,5 +810,3 @@ Fail:
        return -1;
 }
 #endif /* CONFIG_INCA_IP_SWITCH_AMDIX */
-
-#endif
index b598dd7f23d2cbd3d79723e1033e16ac6b1994ef..7f3e0c2e491f5ca98e1f92f5d394a8edce88c927 100644 (file)
@@ -21,8 +21,6 @@
 /****************************************************************************/
 
 #include <common.h>
-
-#ifdef CONFIG_DRIVER_KS8695ETH
 #include <malloc.h>
 #include <net.h>
 #include <asm/io.h>
@@ -234,5 +232,3 @@ int eth_send(volatile void *packet, int len)
 
        return len;
 }
-
-#endif /* CONFIG_DRIVER_KS8695ETH */
index 51cfb7e3e2cccc95b2a1d4ef99ff42751d513d09..c23a4000a2860cfa596fd864c11da8ff4b22c4b6 100644 (file)
 #include "lan91c96.h"
 #include <net.h>
 
-#ifdef CONFIG_DRIVER_LAN91C96
-
-#if defined(CONFIG_CMD_NET)
-
 /*------------------------------------------------------------------------
  *
  * Configuration options, for the experienced user to change.
@@ -865,9 +861,6 @@ static int smc_hw_init ()
 }
 #endif /* 0 */
 
-#endif /* CONFIG_CMD_NET */
-
-
 /* smc_get_ethaddr (bd_t * bd)
  *
  * This checks both the environment and the ROM for an ethernet address. If
@@ -963,5 +956,3 @@ int get_rom_mac (unsigned char *v_rom_mac)
        return (1);
 #endif
 }
-
-#endif /* CONFIG_DRIVER_LAN91C96 */
index e5733f6e5b23c6ad7a05dfbda0b5a3d783f701f7..aa39284d1d92de04d2ecdc643d3c30dd45e5f51b 100644 (file)
@@ -17,9 +17,6 @@
  */
 #include <common.h>
 
-#if defined(CONFIG_MACB) \
-       && (defined(CONFIG_CMD_NET) || defined(CONFIG_CMD_MII))
-
 /*
  * The u-boot networking stack is a little weird.  It seems like the
  * networking core allocates receive buffers up front without any
@@ -593,5 +590,3 @@ int miiphy_write(unsigned char addr, unsigned char reg, unsigned short value)
 }
 
 #endif
-
-#endif /* CONFIG_MACB */
index 5ab4726ff584ad6609e016ebedd0b6664d1432fa..58ed5e32c6b22a49f2252b04074e93475861ac6b 100644 (file)
@@ -27,8 +27,6 @@
 #include <common.h>
 #include <malloc.h>
 
-#ifdef CONFIG_MCFFEC
-
 #include <asm/fec.h>
 #include <asm/immap.h>
 
@@ -51,8 +49,6 @@
 
 DECLARE_GLOBAL_DATA_PTR;
 
-#if defined(CONFIG_CMD_NET) && defined(CONFIG_NET_MULTI)
-
 struct fec_info_s fec_info[] = {
 #ifdef CFG_FEC0_IOBASE
        {
@@ -125,11 +121,17 @@ void setFecDuplexSpeed(volatile fec_t * fecp, bd_t * bd, int dup_spd)
        }
 
        if ((dup_spd & 0xFFFF) == _100BASET) {
+#ifdef CONFIG_MCF5445x
+               fecp->rcr &= ~0x200;    /* disabled 10T base */
+#endif
 #ifdef MII_DEBUG
                printf("100Mbps\n");
 #endif
                bd->bi_ethspeed = 100;
        } else {
+#ifdef CONFIG_MCF5445x
+               fecp->rcr |= 0x200;     /* enabled 10T base */
+#endif
 #ifdef MII_DEBUG
                printf("10Mbps\n");
 #endif
@@ -599,6 +601,3 @@ int mcffec_initialize(bd_t * bis)
 
        return 1;
 }
-
-#endif                         /* CONFIG_CMD_NET, FEC_ENET & NET_MULTI */
-#endif                         /* CONFIG_MCFFEC */
index a523959812b87eeb812b815af0bcba22e358c20f..4aee0481dbe48b09b325699394cfd66607b8ccf5 100644 (file)
@@ -56,9 +56,6 @@
 #include <asm/io.h>
 #include <pci.h>
 
-#if defined(CONFIG_CMD_NET) \
-       && defined(CONFIG_NET_MULTI) && defined(CONFIG_NATSEMI)
-
 /* defines */
 #define EEPROM_SIZE 0xb /*12 16-bit chunks, or 24 bytes*/
 
@@ -878,5 +875,3 @@ natsemi_disable(struct eth_device *dev)
        /* Restore PME enable bit */
        OUTL(dev, SavedClkRun, ClkRun);
 }
-
-#endif
index ecf45dc92f6ed8e0c18ddef1b3c12f6115d1a978..c011809b6fd4b2e19ea085fb116a04bea5aa98a2 100644 (file)
 
 
 #include <common.h>
-
-#ifdef CONFIG_DRIVER_NETARMETH
 #include <command.h>
 #include <net.h>
 #include "netarm_eth.h"
 #include <asm/arch/netarm_registers.h>
 
-#if defined(CONFIG_CMD_NET)
-
 static int na_mii_poll_busy (void);
 
 static void na_get_mac_addr (void)
@@ -352,7 +348,3 @@ extern int eth_send (volatile void *packet, int length)
        printf ("eth_send timeout\n");
        return 1;
 }
-
-#endif /* CONFIG_CMD_NET */
-
-#endif /* CONFIG_DRIVER_NETARMETH */
index 69089f92cec913b1ab6d0c33f94273d8cc10badf..b2ee5eaba498635c45bc272a423933c4477e95a1 100644 (file)
@@ -22,9 +22,6 @@
  */
 
 #include <common.h>
-
-#ifdef CONFIG_NETCONSOLE
-
 #include <command.h>
 #include <devices.h>
 #include <net.h>
@@ -263,5 +260,3 @@ int drv_nc_init (void)
 
        return (rc == 0) ? 1 : rc;
 }
-
-#endif /* CONFIG_NETCONSOLE */
index a5a20dfd72ef24f3dc1d75a4c58c54cdb66e0fd1..37411dfeb12633a8771689b61e98688e506f5903 100644 (file)
@@ -15,8 +15,6 @@
 
 #include <common.h>
 
-#if defined(CONFIG_DRIVER_NS7520_ETHERNET)
-
 #include <net.h>               /* NetSendPacket */
 #include <asm/arch/netarm_registers.h>
 #include <asm/arch/netarm_dma_module.h>
@@ -846,14 +844,11 @@ extern int ns7520_miiphy_write(char *devname, unsigned char const addr,
        return (ret);
 }
 #endif                         /* defined(CONFIG_MII) */
-#endif                         /* CONFIG_DRIVER_NS7520_ETHERNET */
 
 int ns7520_miiphy_initialize(bd_t *bis)
 {
-#if defined(CONFIG_DRIVER_NS7520_ETHERNET)
 #if defined(CONFIG_MII)
        miiphy_register("ns7520phy", ns7520_miiphy_read, ns7520_miiphy_write);
-#endif
 #endif
        return 0;
 }
index c807dd4c7b85851e5c216643ae56c6b75a5d40d3..0b9a3ae66d3ecd4823dfc8620faa8cafa602f3d9 100644 (file)
@@ -56,9 +56,6 @@
 #include <asm/io.h>
 #include <pci.h>
 
-#if defined(CONFIG_CMD_NET) \
-       && defined(CONFIG_NET_MULTI) && defined(CONFIG_NS8382X)
-
 /* defines */
 #define DSIZE     0x00000FFF
 #define ETH_ALEN               6
@@ -859,5 +856,3 @@ ns8382x_disable(struct eth_device *dev)
        /* Restore PME enable bit */
        OUTL(dev, SavedClkRun, ClkRun);
 }
-
-#endif
index 067ff8efabe227ede618ff91a7620dd69aa38182..0559710ccf62d570ee2e08eb9531ef3210eb71b8 100644 (file)
@@ -37,8 +37,6 @@
 
 #include "ns9750_eth.h"                /* for Ethernet and PHY */
 
-#ifdef CONFIG_DRIVER_NS9750_ETHERNET
-
 /* some definition to make transistion to linux easier */
 
 #define NS9750_DRIVER_NAME     "eth"
@@ -793,5 +791,3 @@ static unsigned int ns9750_mii_poll_busy (void)
 
        return unTimeout;
 }
-
-#endif /* CONFIG_DRIVER_NS9750_ETHERNET */
index aa04e8f185976e0f3248171f227d887ac0e23a3e..a4f02141063621588bd4ca837b5e7e36563091c6 100644 (file)
@@ -45,9 +45,6 @@
 #define PCNET_DEBUG2(fmt,args...)
 #endif
 
-#if defined(CONFIG_CMD_NET) \
-       && defined(CONFIG_NET_MULTI) && defined(CONFIG_PCNET)
-
 #if !defined(CONF_PCNET_79C973) && defined(CONF_PCNET_79C975)
 #error "Macro for PCnet chip version is not defined!"
 #endif
@@ -537,4 +534,3 @@ static void pcnet_halt (struct eth_device *dev)
                printf ("%s: TIMEOUT: controller reset failed\n", dev->name);
        }
 }
-#endif
index b8cc57aa78b3226a057e405c5eadd22d465c1af6..dad842c728dc03075e03fbe2ddd7231ced4b108f 100644 (file)
  */
 
 #include <common.h>
-
-#if defined(CONFIG_CMD_NET) \
-       && defined(CONFIG_NET_MULTI) && defined(CONFIG_PLB2800_ETHER)
-
 #include <malloc.h>
 #include <net.h>
 #include <asm/addrspace.h>
@@ -392,5 +388,3 @@ static unsigned char * plb2800_get_mac_addr(void)
 
        return addr;
 }
-
-#endif /* CONFIG_PLB2800_ETHER */
index 9d62cab34670e096e18f3b7ee00075dcc7ea5588..3ddf91793cd4baad16733360bf45eed3ce60e232 100644 (file)
 #include "rtl8019.h"
 #include <net.h>
 
-#ifdef CONFIG_DRIVER_RTL8019
-
-#if defined(CONFIG_CMD_NET)
-
 /* packet page register access functions */
 
 static unsigned char get_reg (unsigned int regno)
@@ -271,7 +267,3 @@ extern int eth_send (volatile void *packet, int length)
 
        return 0;
 }
-
-#endif /* CONFIG_CMD_NET */
-
-#endif /* CONFIG_DRIVER_RTL8019 */
index 097f6841aeeeaa6d018ed737f55a7f7d9283a5f8..4fd20ac4fe1efed50b177d7bc6e95002fdab41b8 100644 (file)
@@ -77,9 +77,6 @@
 #include <asm/io.h>
 #include <pci.h>
 
-#if defined(CONFIG_CMD_NET) && defined(CONFIG_NET_MULTI) && \
-       defined(CONFIG_RTL8139)
-
 #define RTL_TIMEOUT    100000
 
 #define ETH_FRAME_LEN          1514
@@ -545,4 +542,3 @@ static void rtl_disable(struct eth_device *dev)
                udelay (100); /* wait 100us */
        }
 }
-#endif
index 6c4c9ff63ec05a00e5c69cc13b9900a3e74a51a7..7423bc0eb8e01565f779d9b35c0d03e2390409a5 100644 (file)
@@ -58,9 +58,6 @@
 #include <asm/io.h>
 #include <pci.h>
 
-#if defined(CONFIG_CMD_NET) && defined(CONFIG_NET_MULTI) && \
-       defined(CONFIG_RTL8169)
-
 #undef DEBUG_RTL8169
 #undef DEBUG_RTL8169_TX
 #undef DEBUG_RTL8169_RX
@@ -887,5 +884,3 @@ int rtl8169_initialize(bd_t *bis)
        }
        return card_number;
 }
-
-#endif
index 3d9066abeaf781812934a04350c3fb8c31bf0b64..6dcb244861b6210c4a45c93e6888a7c2143ad734 100644 (file)
@@ -25,9 +25,6 @@
  */
 
 #include <common.h>
-
-#ifdef CONFIG_DRIVER_S3C4510_ETH
-
 #include <command.h>
 #include <net.h>
 #include <asm/hardware.h>
@@ -242,5 +239,3 @@ void eth_halt(void)
        /* disable MAC */
        PUT_REG( REG_MACCON, ETH_HaltReg);
 }
-
-#endif
index 8061f12979dbbbf5317079d49a932f6c48794cb7..e8b235b4ab8f0636c5a160b80cf147dd0f2a8b21 100644 (file)
@@ -65,8 +65,6 @@
 #include "smc91111.h"
 #include <net.h>
 
-#ifdef CONFIG_DRIVER_SMC91111
-
 /* Use power-down feature of the chip */
 #define POWER_DOWN     0
 
@@ -1620,4 +1618,3 @@ int get_rom_mac (uchar *v_rom_mac)
        return (valid_mac ? 1 : 0);
 #endif
 }
-#endif /* CONFIG_DRIVER_SMC91111 */
index 5302cb5223ac9fecad63707ddec1acab10996ba2..7555cb967b8941c125d93be7b0de156e2c83ea25 100644 (file)
  */
 
 #include <common.h>
-
-#ifdef CONFIG_DRIVER_SMC911X
-
 #include <command.h>
 #include <net.h>
 #include <miiphy.h>
 
+#if defined (CONFIG_DRIVER_SMC911X_32_BIT) && \
+       defined (CONFIG_DRIVER_SMC911X_16_BIT)
+#error "SMC911X: Only one of CONFIG_DRIVER_SMC911X_32_BIT and \
+       CONFIG_DRIVER_SMC911X_16_BIT shall be set"
+#endif
+
 #ifdef CONFIG_DRIVER_SMC911X_32_BIT
 static inline u32 reg_read(u32 addr)
 {
@@ -39,9 +42,20 @@ static inline void reg_write(u32 addr, u32 val)
 {
        *(volatile u32*)addr = val;
 }
+#elif CONFIG_DRIVER_SMC911X_16_BIT
+static inline u32 reg_read(u32 addr)
+{
+       volatile u16 *addr_16 = (u16 *)addr;
+       return ((*addr_16 & 0x0000ffff) | (*(addr_16 + 1) << 16));
+}
+static inline void reg_write(u32 addr, u32 val)
+{
+       *(volatile u16*)addr = (u16)val;
+       *(volatile u16*)(addr + 2) = (u16)(val >> 16);
+}
 #else
-#error "SMC911X: Only 32-bit bus is supported"
-#endif
+#error "SMC911X: undefined bus width"
+#endif /* CONFIG_DRIVER_SMC911X_16_BIT */
 
 #define mdelay(n)       udelay((n)*1000)
 
@@ -682,5 +696,3 @@ int eth_rx(void)
 
        return 0;
 }
-
-#endif                         /* CONFIG_DRIVER_SMC911X */
index 5f6a4ecd0abe84de297b9ba0bfdbdc66c2bf2a0a..ab448b0f810cddd92b3b68da8ca9d6c03f4e495f 100644 (file)
@@ -12,8 +12,7 @@
 /******************************************************************************/
 #include <common.h>
 #include <asm/types.h>
-#if defined(CONFIG_CMD_NET) && !defined(CONFIG_NET_MULTI) && \
-       defined(CONFIG_TIGON3)
+
 #ifdef CONFIG_BMW
 #include <mpc824x.h>
 #endif
@@ -5695,5 +5694,3 @@ LM_DmaTest (PLM_DEVICE_BLOCK pDevice, PLM_UINT8 pBufferVirt,
        }
        return LM_STATUS_SUCCESS;
 }
-
-#endif
index c7af930b6b0cbf8af807457a903f07434ec843b3..6e0f2c6fd081baa19d80a985717d470a1f78bc2d 100644 (file)
@@ -17,7 +17,6 @@
 #include <net.h>
 #include <command.h>
 
-#if defined(CONFIG_TSEC_ENET)
 #include "tsec.h"
 #include "miiphy.h"
 
@@ -1128,6 +1127,36 @@ struct phy_info phy_info_M88E1111S = {
                           },
 };
 
+struct phy_info phy_info_M88E1118 = {
+       0x01410e1,
+       "Marvell 88E1118",
+       4,
+       (struct phy_cmd[]){     /* config */
+               /* Reset and configure the PHY */
+               {MIIM_CONTROL, MIIM_CONTROL_RESET, NULL},
+               {0x16, 0x0002, NULL}, /* Change Page Number */
+               {0x15, 0x1070, NULL}, /* Delay RGMII TX and RX */
+               {MIIM_GBIT_CONTROL, MIIM_GBIT_CONTROL_INIT, NULL},
+               {MIIM_ANAR, MIIM_ANAR_INIT, NULL},
+               {MIIM_CONTROL, MIIM_CONTROL_RESET, NULL},
+               {MIIM_CONTROL, MIIM_CONTROL_INIT, &mii_cr_init},
+               {miim_end,}
+               },
+       (struct phy_cmd[]){     /* startup */
+               {0x16, 0x0000, NULL}, /* Change Page Number */
+               /* Status is read once to clear old link state */
+               {MIIM_STATUS, miim_read, NULL},
+               /* Auto-negotiate */
+               /* Read the status */
+               {MIIM_88E1011_PHY_STATUS, miim_read,
+                &mii_parse_88E1011_psr},
+               {miim_end,}
+               },
+       (struct phy_cmd[]){     /* shutdown */
+               {miim_end,}
+               },
+};
+
 static unsigned int m88e1145_setmode(uint mii_reg, struct tsec_private *priv)
 {
        uint mii_data = read_phy_reg(priv, mii_reg);
@@ -1492,6 +1521,7 @@ struct phy_info *phy_info[] = {
        &phy_info_BCM5464S,
        &phy_info_M88E1011S,
        &phy_info_M88E1111S,
+       &phy_info_M88E1118,
        &phy_info_M88E1145,
        &phy_info_M88E1149S,
        &phy_info_dm9161,
@@ -1710,5 +1740,3 @@ tsec_mcast_addr (struct eth_device *dev, u8 mcast_mac, u8 set)
        return 0;
 }
 #endif /* Multicast TFTP ? */
-
-#endif /* CONFIG_TSEC_ENET */
index a09115e6ddd01156abd394ff3896f1113e1d5f58..57c0dc3ceac7ccd62e553f95e04de8f1fd6e033a 100644 (file)
@@ -27,9 +27,6 @@
 
 #include <config.h>
 
-#if defined(CONFIG_CMD_NET) && defined(CONFIG_NET_MULTI) \
-       && defined(CONFIG_TSI108_ETH)
-
 #if !defined(CONFIG_TSI108_ETH_NUM_PORTS) || (CONFIG_TSI108_ETH_NUM_PORTS > 2)
 #error "CONFIG_TSI108_ETH_NUM_PORTS must be defined as 1 or 2"
 #endif
@@ -1032,5 +1029,3 @@ static void tsi108_eth_halt (struct eth_device *dev)
        /* Put MAC into reset state. */
        reg_MAC_CONFIG_1(base) = MAC_CONFIG_1_SOFT_RESET;
 }
-
-#endif
index 79d29ae82200fac7d4f5de69df2e5b67ba412af0..7145b722647e7c5db6e64d796f9fa316f7931b0f 100644 (file)
@@ -22,9 +22,6 @@
 
 /* some kernel function compatible define */
 
-#if defined(CONFIG_CMD_NET) && defined(CONFIG_NET_MULTI) && \
-       defined(CONFIG_ULI526X)
-
 #undef DEBUG
 
 /* Board/System/Debug information/definition */
@@ -993,4 +990,3 @@ static void set_mac_addr(struct eth_device *dev)
        udelay(10);
        return;
 }
-#endif
index 4095bce5bfcb9009a93660cbfe7fb0075799affa..4e7259fd96930bde6cdf38ff22ecb7ccfe0380dd 100644 (file)
@@ -13,9 +13,6 @@
  */
 
 #include <config.h>
-
-#ifdef CONFIG_VSC7385_ENET
-
 #include <common.h>
 #include <asm/io.h>
 #include <asm/errno.h>
@@ -97,5 +94,3 @@ int vsc7385_upload_firmware(void *firmware, unsigned int size)
 
        return 0;
 }
-
-#endif
index e955c756e8946609fb64f0b5aec4a3b63f0b17fc..227bf8326c0979bd6384d2873463269cd047be71 100644 (file)
@@ -6,6 +6,9 @@
 #define SET_LAW_ENTRY(idx, a, sz, trgt) \
        { .index = idx, .addr = a, .size = sz, .trgt_id = trgt }
 
+#define SET_LAW(a, sz, trgt) \
+       { .index = -1, .addr = a, .size = sz, .trgt_id = trgt }
+
 enum law_size {
        LAW_SIZE_4K = 0xb,
        LAW_SIZE_8K,
@@ -70,6 +73,8 @@ struct law_entry {
 };
 
 extern void set_law(u8 idx, phys_addr_t addr, enum law_size sz, enum law_trgt_if id);
+extern int set_next_law(phys_addr_t addr, enum law_size sz, enum law_trgt_if id);
+extern int set_last_law(phys_addr_t addr, enum law_size sz, enum law_trgt_if id);
 extern void disable_law(u8 idx);
 extern void init_laws(void);
 extern void print_laws(void);
diff --git a/include/asm-ppc/fsl_lbc.h b/include/asm-ppc/fsl_lbc.h
new file mode 100644 (file)
index 0000000..c4af797
--- /dev/null
@@ -0,0 +1,301 @@
+/*
+ * Copyright (C) 2004-2008 Freescale Semiconductor, Inc.
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ */
+
+#ifndef __ASM_PPC_FSL_LBC_H
+#define __ASM_PPC_FSL_LBC_H
+
+#include <config.h>
+
+/* BR - Base Registers
+ */
+#define BR0                            0x5000          /* Register offset to immr */
+#define BR1                            0x5008
+#define BR2                            0x5010
+#define BR3                            0x5018
+#define BR4                            0x5020
+#define BR5                            0x5028
+#define BR6                            0x5030
+#define BR7                            0x5038
+
+#define BR_BA                          0xFFFF8000
+#define BR_BA_SHIFT                    15
+#define BR_PS                          0x00001800
+#define BR_PS_SHIFT                    11
+#define BR_PS_8                                0x00000800      /* Port Size 8 bit */
+#define BR_PS_16                       0x00001000      /* Port Size 16 bit */
+#define BR_PS_32                       0x00001800      /* Port Size 32 bit */
+#define BR_DECC                                0x00000600
+#define BR_DECC_SHIFT                  9
+#define BR_DECC_OFF                    0x00000000
+#define BR_DECC_CHK                    0x00000200
+#define BR_DECC_CHK_GEN                        0x00000400
+#define BR_WP                          0x00000100
+#define BR_WP_SHIFT                    8
+#define BR_MSEL                                0x000000E0
+#define BR_MSEL_SHIFT                  5
+#define BR_MS_GPCM                     0x00000000      /* GPCM */
+#define BR_MS_FCM                      0x00000020      /* FCM */
+#ifdef CONFIG_MPC83xx
+#define BR_MS_SDRAM                    0x00000060      /* SDRAM */
+#elif defined(CONFIG_MPC85xx)
+#define BR_MS_SDRAM                    0x00000000      /* SDRAM */
+#endif
+#define BR_MS_UPMA                     0x00000080      /* UPMA */
+#define BR_MS_UPMB                     0x000000A0      /* UPMB */
+#define BR_MS_UPMC                     0x000000C0      /* UPMC */
+#if !defined(CONFIG_MPC834X)
+#define BR_ATOM                                0x0000000C
+#define BR_ATOM_SHIFT                  2
+#endif
+#define BR_V                           0x00000001
+#define BR_V_SHIFT                     0
+
+#define UPMA                   0
+#define UPMB                   1
+#define UPMC                   2
+
+#if defined(CONFIG_MPC834X)
+#define BR_RES                         ~(BR_BA | BR_PS | BR_DECC | BR_WP | BR_MSEL | BR_V)
+#else
+#define BR_RES                         ~(BR_BA | BR_PS | BR_DECC | BR_WP | BR_MSEL | BR_ATOM | BR_V)
+#endif
+
+/* OR - Option Registers
+ */
+#define OR0                            0x5004          /* Register offset to immr */
+#define OR1                            0x500C
+#define OR2                            0x5014
+#define OR3                            0x501C
+#define OR4                            0x5024
+#define OR5                            0x502C
+#define OR6                            0x5034
+#define OR7                            0x503C
+
+#define OR_GPCM_AM                     0xFFFF8000
+#define OR_GPCM_AM_SHIFT               15
+#define OR_GPCM_BCTLD                  0x00001000
+#define OR_GPCM_BCTLD_SHIFT            12
+#define OR_GPCM_CSNT                   0x00000800
+#define OR_GPCM_CSNT_SHIFT             11
+#define OR_GPCM_ACS                    0x00000600
+#define OR_GPCM_ACS_SHIFT              9
+#define OR_GPCM_ACS_DIV2               0x00000600
+#define OR_GPCM_ACS_DIV4               0x00000400
+#define OR_GPCM_XACS                   0x00000100
+#define OR_GPCM_XACS_SHIFT             8
+#define OR_GPCM_SCY                    0x000000F0
+#define OR_GPCM_SCY_SHIFT              4
+#define OR_GPCM_SCY_1                  0x00000010
+#define OR_GPCM_SCY_2                  0x00000020
+#define OR_GPCM_SCY_3                  0x00000030
+#define OR_GPCM_SCY_4                  0x00000040
+#define OR_GPCM_SCY_5                  0x00000050
+#define OR_GPCM_SCY_6                  0x00000060
+#define OR_GPCM_SCY_7                  0x00000070
+#define OR_GPCM_SCY_8                  0x00000080
+#define OR_GPCM_SCY_9                  0x00000090
+#define OR_GPCM_SCY_10                 0x000000a0
+#define OR_GPCM_SCY_11                 0x000000b0
+#define OR_GPCM_SCY_12                 0x000000c0
+#define OR_GPCM_SCY_13                 0x000000d0
+#define OR_GPCM_SCY_14                 0x000000e0
+#define OR_GPCM_SCY_15                 0x000000f0
+#define OR_GPCM_SETA                   0x00000008
+#define OR_GPCM_SETA_SHIFT             3
+#define OR_GPCM_TRLX                   0x00000004
+#define OR_GPCM_TRLX_SHIFT             2
+#define OR_GPCM_EHTR                   0x00000002
+#define OR_GPCM_EHTR_SHIFT             1
+#define OR_GPCM_EAD                    0x00000001
+#define OR_GPCM_EAD_SHIFT              0
+
+/* helpers to convert values into an OR address mask (GPCM mode) */
+#define P2SZ_TO_AM(s)  ((~((s) - 1)) & 0xffff8000)     /* must be pow of 2 */
+#define MEG_TO_AM(m)   P2SZ_TO_AM((m) << 20)
+
+#define OR_FCM_AM                      0xFFFF8000
+#define OR_FCM_AM_SHIFT                                15
+#define OR_FCM_BCTLD                   0x00001000
+#define OR_FCM_BCTLD_SHIFT                     12
+#define OR_FCM_PGS                     0x00000400
+#define OR_FCM_PGS_SHIFT                       10
+#define OR_FCM_CSCT                    0x00000200
+#define OR_FCM_CSCT_SHIFT                       9
+#define OR_FCM_CST                     0x00000100
+#define OR_FCM_CST_SHIFT                        8
+#define OR_FCM_CHT                     0x00000080
+#define OR_FCM_CHT_SHIFT                        7
+#define OR_FCM_SCY                     0x00000070
+#define OR_FCM_SCY_SHIFT                        4
+#define OR_FCM_SCY_1                   0x00000010
+#define OR_FCM_SCY_2                   0x00000020
+#define OR_FCM_SCY_3                   0x00000030
+#define OR_FCM_SCY_4                   0x00000040
+#define OR_FCM_SCY_5                   0x00000050
+#define OR_FCM_SCY_6                   0x00000060
+#define OR_FCM_SCY_7                   0x00000070
+#define OR_FCM_RST                     0x00000008
+#define OR_FCM_RST_SHIFT                        3
+#define OR_FCM_TRLX                    0x00000004
+#define OR_FCM_TRLX_SHIFT                       2
+#define OR_FCM_EHTR                    0x00000002
+#define OR_FCM_EHTR_SHIFT                       1
+
+#define OR_UPM_AM                      0xFFFF8000
+#define OR_UPM_AM_SHIFT                        15
+#define OR_UPM_XAM                     0x00006000
+#define OR_UPM_XAM_SHIFT               13
+#define OR_UPM_BCTLD                   0x00001000
+#define OR_UPM_BCTLD_SHIFT             12
+#define OR_UPM_BI                      0x00000100
+#define OR_UPM_BI_SHIFT                        8
+#define OR_UPM_TRLX                    0x00000004
+#define OR_UPM_TRLX_SHIFT              2
+#define OR_UPM_EHTR                    0x00000002
+#define OR_UPM_EHTR_SHIFT              1
+#define OR_UPM_EAD                     0x00000001
+#define OR_UPM_EAD_SHIFT               0
+
+#define OR_SDRAM_AM                    0xFFFF8000
+#define OR_SDRAM_AM_SHIFT              15
+#define OR_SDRAM_XAM                   0x00006000
+#define OR_SDRAM_XAM_SHIFT             13
+#define OR_SDRAM_COLS                  0x00001C00
+#define OR_SDRAM_COLS_SHIFT            10
+#define OR_SDRAM_ROWS                  0x000001C0
+#define OR_SDRAM_ROWS_SHIFT            6
+#define OR_SDRAM_PMSEL                 0x00000020
+#define OR_SDRAM_PMSEL_SHIFT           5
+#define OR_SDRAM_EAD                   0x00000001
+#define OR_SDRAM_EAD_SHIFT             0
+
+#define OR_AM_32KB                     0xFFFF8000
+#define OR_AM_64KB                     0xFFFF0000
+#define OR_AM_128KB                    0xFFFE0000
+#define OR_AM_256KB                    0xFFFC0000
+#define OR_AM_512KB                    0xFFF80000
+#define OR_AM_1MB                      0xFFF00000
+#define OR_AM_2MB                      0xFFE00000
+#define OR_AM_4MB                      0xFFC00000
+#define OR_AM_8MB                      0xFF800000
+#define OR_AM_16MB                     0xFF000000
+#define OR_AM_32MB                     0xFE000000
+#define OR_AM_64MB                     0xFC000000
+#define OR_AM_128MB                    0xF8000000
+#define OR_AM_256MB                    0xF0000000
+#define OR_AM_512MB                    0xE0000000
+#define OR_AM_1GB                      0xC0000000
+#define OR_AM_2GB                      0x80000000
+#define OR_AM_4GB                      0x00000000
+
+/* MxMR - UPM Machine A/B/C Mode Registers
+ */
+#define MxMR_MAD_MSK           0x0000003f /* Machine Address Mask         */
+#define MxMR_TLFx_MSK          0x000003c0 /* Refresh Loop Field Mask      */
+#define MxMR_WLFx_MSK          0x00003c00 /* Write Loop Field Mask        */
+#define MxMR_WLFx_1X           0x00000400 /*   executed 1 time            */
+#define MxMR_WLFx_2X           0x00000800 /*   executed 2 times           */
+#define MxMR_WLFx_3X           0x00000c00 /*   executed 3 times           */
+#define MxMR_WLFx_4X           0x00001000 /*   executed 4 times           */
+#define MxMR_WLFx_5X           0x00001400 /*   executed 5 times           */
+#define MxMR_WLFx_6X           0x00001800 /*   executed 6 times           */
+#define MxMR_WLFx_7X           0x00001c00 /*   executed 7 times           */
+#define MxMR_WLFx_8X           0x00002000 /*   executed 8 times           */
+#define MxMR_WLFx_9X           0x00002400 /*   executed 9 times           */
+#define MxMR_WLFx_10X          0x00002800 /*   executed 10 times          */
+#define MxMR_WLFx_11X          0x00002c00 /*   executed 11 times          */
+#define MxMR_WLFx_12X          0x00003000 /*   executed 12 times          */
+#define MxMR_WLFx_13X          0x00003400 /*   executed 13 times          */
+#define MxMR_WLFx_14X          0x00003800 /*   executed 14 times          */
+#define MxMR_WLFx_15X          0x00003c00 /*   executed 15 times          */
+#define MxMR_WLFx_16X          0x00000000 /*   executed 16 times          */
+#define MxMR_RLFx_MSK          0x0003c000 /* Read Loop Field Mask         */
+#define MxMR_GPL_x4DIS         0x00040000 /* GPL_A4 Ouput Line Disable    */
+#define MxMR_G0CLx_MSK         0x00380000 /* General Line 0 Control Mask  */
+#define MxMR_DSx_1_CYCL                0x00000000 /* 1 cycle Disable Period       */
+#define MxMR_DSx_2_CYCL                0x00400000 /* 2 cycle Disable Period       */
+#define MxMR_DSx_3_CYCL                0x00800000 /* 3 cycle Disable Period       */
+#define MxMR_DSx_4_CYCL                0x00c00000 /* 4 cycle Disable Period       */
+#define MxMR_DSx_MSK           0x00c00000 /* Disable Timer Period Mask    */
+#define MxMR_AMx_MSK           0x07000000 /* Addess Multiplex Size Mask   */
+#define MxMR_OP_NORM           0x00000000 /* Normal Operation             */
+#define MxMR_OP_WARR           0x10000000 /* Write to Array               */
+#define MxMR_OP_RARR           0x20000000 /* Read from Array              */
+#define MxMR_OP_RUNP           0x30000000 /* Run Pattern                  */
+#define MxMR_OP_MSK            0x30000000 /* Command Opcode Mask          */
+#define MxMR_RFEN              0x40000000 /* Refresh Enable               */
+#define MxMR_BSEL              0x80000000 /* Bus Select                   */
+
+#define LBLAWAR_EN                     0x80000000
+#define LBLAWAR_4KB                    0x0000000B
+#define LBLAWAR_8KB                    0x0000000C
+#define LBLAWAR_16KB                   0x0000000D
+#define LBLAWAR_32KB                   0x0000000E
+#define LBLAWAR_64KB                   0x0000000F
+#define LBLAWAR_128KB                  0x00000010
+#define LBLAWAR_256KB                  0x00000011
+#define LBLAWAR_512KB                  0x00000012
+#define LBLAWAR_1MB                    0x00000013
+#define LBLAWAR_2MB                    0x00000014
+#define LBLAWAR_4MB                    0x00000015
+#define LBLAWAR_8MB                    0x00000016
+#define LBLAWAR_16MB                   0x00000017
+#define LBLAWAR_32MB                   0x00000018
+#define LBLAWAR_64MB                   0x00000019
+#define LBLAWAR_128MB                  0x0000001A
+#define LBLAWAR_256MB                  0x0000001B
+#define LBLAWAR_512MB                  0x0000001C
+#define LBLAWAR_1GB                    0x0000001D
+#define LBLAWAR_2GB                    0x0000001E
+
+/* LBCR - Local Bus Configuration Register
+ */
+#define LBCR_LDIS                      0x80000000
+#define LBCR_LDIS_SHIFT                        31
+#define LBCR_BCTLC                     0x00C00000
+#define LBCR_BCTLC_SHIFT               22
+#define LBCR_LPBSE                     0x00020000
+#define LBCR_LPBSE_SHIFT               17
+#define LBCR_EPAR                      0x00010000
+#define LBCR_EPAR_SHIFT                        16
+#define LBCR_BMT                       0x0000FF00
+#define LBCR_BMT_SHIFT                 8
+
+/* LCRR - Clock Ratio Register
+ */
+#define LCRR_DBYP                      0x80000000
+#define LCRR_DBYP_SHIFT                        31
+#define LCRR_BUFCMDC                   0x30000000
+#define LCRR_BUFCMDC_SHIFT             28
+#define LCRR_BUFCMDC_1                 0x10000000
+#define LCRR_BUFCMDC_2                 0x20000000
+#define LCRR_BUFCMDC_3                 0x30000000
+#define LCRR_BUFCMDC_4                 0x00000000
+#define LCRR_ECL                       0x03000000
+#define LCRR_ECL_SHIFT                 24
+#define LCRR_ECL_4                     0x00000000
+#define LCRR_ECL_5                     0x01000000
+#define LCRR_ECL_6                     0x02000000
+#define LCRR_ECL_7                     0x03000000
+#define LCRR_EADC                      0x00030000
+#define LCRR_EADC_SHIFT                        16
+#define LCRR_EADC_1                    0x00010000
+#define LCRR_EADC_2                    0x00020000
+#define LCRR_EADC_3                    0x00030000
+#define LCRR_EADC_4                    0x00000000
+#define LCRR_CLKDIV                    0x0000000F
+#define LCRR_CLKDIV_SHIFT              0
+#define LCRR_CLKDIV_2                  0x00000002
+#define LCRR_CLKDIV_4                  0x00000004
+#define LCRR_CLKDIV_8                  0x00000008
+
+#endif /* __ASM_PPC_FSL_LBC_H */
index ea702662f8a2fef500537f70f9b710ac896bc826..8cf7b6fb3d76d7f3e74bf0ac1caf16440671d649 100644 (file)
@@ -96,6 +96,9 @@ typedef       struct  global_data {
        uint mp_alloc_base;
        uint mp_alloc_top;
 #endif /* CONFIG_QE */
+#if defined(CONFIG_FSL_LAW)
+       u32 used_laws;
+#endif
 #if defined(CONFIG_MPC5xxx)
        unsigned long   ipb_clk;
        unsigned long   pci_clk;
index 7cc28bfe3a25c3bc048e46b0aa933b257184de4b..c3496818f048b44c2df1c2ffa0da66353849e1e4 100644 (file)
@@ -238,6 +238,42 @@ extern inline void out_be32(volatile unsigned __iomem *addr, int val)
        __asm__ __volatile__("sync; stw%U0%X0 %1,%0" : "=m" (*addr) : "r" (val));
 }
 
+/* Clear and set bits in one shot. These macros can be used to clear and
+ * set multiple bits in a register using a single call. These macros can
+ * also be used to set a multiple-bit bit pattern using a mask, by
+ * specifying the mask in the 'clear' parameter and the new bit pattern
+ * in the 'set' parameter.
+ */
+
+#define clrbits(type, addr, clear) \
+       out_##type((addr), in_##type(addr) & ~(clear))
+
+#define setbits(type, addr, set) \
+       out_##type((addr), in_##type(addr) | (set))
+
+#define clrsetbits(type, addr, clear, set) \
+       out_##type((addr), (in_##type(addr) & ~(clear)) | (set))
+
+#define clrbits_be32(addr, clear) clrbits(be32, addr, clear)
+#define setbits_be32(addr, set) setbits(be32, addr, set)
+#define clrsetbits_be32(addr, clear, set) clrsetbits(be32, addr, clear, set)
+
+#define clrbits_le32(addr, clear) clrbits(le32, addr, clear)
+#define setbits_le32(addr, set) setbits(le32, addr, set)
+#define clrsetbits_le32(addr, clear, set) clrsetbits(le32, addr, clear, set)
+
+#define clrbits_be16(addr, clear) clrbits(be16, addr, clear)
+#define setbits_be16(addr, set) setbits(be16, addr, set)
+#define clrsetbits_be16(addr, clear, set) clrsetbits(be16, addr, clear, set)
+
+#define clrbits_le16(addr, clear) clrbits(le16, addr, clear)
+#define setbits_le16(addr, set) setbits(le16, addr, set)
+#define clrsetbits_le16(addr, clear, set) clrsetbits(le16, addr, clear, set)
+
+#define clrbits_8(addr, clear) clrbits(8, addr, clear)
+#define setbits_8(addr, set) setbits(8, addr, set)
+#define clrsetbits_8(addr, clear, set) clrsetbits(8, addr, clear, set)
+
 /*
  * Given a physical address and a length, return a virtual address
  * that can be used to access the memory range with the caching
diff --git a/include/asm-ppc/ppc4xx-sdram.h b/include/asm-ppc/ppc4xx-sdram.h
new file mode 100644 (file)
index 0000000..83931f1
--- /dev/null
@@ -0,0 +1,1156 @@
+/*
+ * (C) Copyright 2008
+ * 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
+ */
+
+#ifndef _PPC4xx_SDRAM_H_
+#define _PPC4xx_SDRAM_H_
+
+#if defined(CONFIG_SDRAM_PPC4xx_IBM_SDRAM)
+
+/*
+ * SDRAM Controller
+ */
+/*
+ * XXX - ToDo: Revisit file to change all these lower case defines into
+ * upper case. Also needs to be done in the controller setup code too
+ * of course. sr, 2008-06-02
+ */
+#ifndef CONFIG_405EP
+#define mem_besra      0x00    /* bus error syndrome reg a             */
+#define mem_besrsa     0x04    /* bus error syndrome reg set a         */
+#define mem_besrb      0x08    /* bus error syndrome reg b             */
+#define mem_besrsb     0x0c    /* bus error syndrome reg set b         */
+#define mem_bear       0x10    /* bus error address reg                */
+#endif
+#define mem_mcopt1     0x20    /* memory controller options 1          */
+#define mem_status     0x24    /* memory status                        */
+#define mem_rtr                0x30    /* refresh timer reg                    */
+#define mem_pmit       0x34    /* power management idle timer          */
+#define mem_mb0cf      0x40    /* memory bank 0 configuration          */
+#define mem_mb1cf      0x44    /* memory bank 1 configuration          */
+#ifndef CONFIG_405EP
+#define mem_mb2cf      0x48    /* memory bank 2 configuration          */
+#define mem_mb3cf      0x4c    /* memory bank 3 configuration          */
+#endif
+#define mem_sdtr1      0x80    /* timing reg 1                         */
+#ifndef CONFIG_405EP
+#define mem_ecccf      0x94    /* ECC configuration                    */
+#define mem_eccerr     0x98    /* ECC error status                     */
+#endif
+
+#endif /* CONFIG_SDRAM_PPC4xx_IBM_SDRAM */
+
+#if defined(CONFIG_SDRAM_PPC4xx_IBM_DDR)
+
+/*
+ * Memory controller registers
+ */
+#define SDRAM_CFG0     0x20    /* memory controller options 0          */
+#define SDRAM_CFG1     0x21    /* memory controller options 1          */
+
+/*
+ * XXX - ToDo: Revisit file to change all these lower case defines into
+ * upper case. Also needs to be done in the controller setup code too
+ * of course. sr, 2008-06-02
+ */
+#define mem_besr0_clr  0x0000  /* bus error status reg 0 (clr)         */
+#define mem_besr0_set  0x0004  /* bus error status reg 0 (set)         */
+#define mem_besr1_clr  0x0008  /* bus error status reg 1 (clr)         */
+#define mem_besr1_set  0x000c  /* bus error status reg 1 (set)         */
+#define mem_bear       0x0010  /* bus error address reg                */
+#define mem_mirq_clr   0x0011  /* bus master interrupt (clr)           */
+#define mem_mirq_set   0x0012  /* bus master interrupt (set)           */
+#define mem_slio       0x0018  /* ddr sdram slave interface options    */
+#define mem_cfg0       0x0020  /* ddr sdram options 0                  */
+#define mem_cfg1       0x0021  /* ddr sdram options 1                  */
+#define mem_devopt     0x0022  /* ddr sdram device options             */
+#define mem_mcsts      0x0024  /* memory controller status             */
+#define mem_rtr                0x0030  /* refresh timer register               */
+#define mem_pmit       0x0034  /* power management idle timer          */
+#define mem_uabba      0x0038  /* plb UABus base address               */
+#define mem_b0cr       0x0040  /* ddr sdram bank 0 configuration       */
+#define mem_b1cr       0x0044  /* ddr sdram bank 1 configuration       */
+#define mem_b2cr       0x0048  /* ddr sdram bank 2 configuration       */
+#define mem_b3cr       0x004c  /* ddr sdram bank 3 configuration       */
+#define mem_tr0                0x0080  /* sdram timing register 0              */
+#define mem_tr1                0x0081  /* sdram timing register 1              */
+#define mem_clktr      0x0082  /* ddr clock timing register            */
+#define mem_wddctr     0x0083  /* write data/dm/dqs clock timing reg   */
+#define mem_dlycal     0x0084  /* delay line calibration register      */
+#define mem_eccesr     0x0098  /* ECC error status                     */
+
+/*
+ * Memory Controller Options 0
+ */
+#define SDRAM_CFG0_DCEN                0x80000000      /* SDRAM Controller Enable      */
+#define SDRAM_CFG0_MCHK_MASK   0x30000000      /* Memory data errchecking mask */
+#define SDRAM_CFG0_MCHK_NON    0x00000000      /* No ECC generation            */
+#define SDRAM_CFG0_MCHK_GEN    0x20000000      /* ECC generation               */
+#define SDRAM_CFG0_MCHK_CHK    0x30000000      /* ECC generation and checking  */
+#define SDRAM_CFG0_RDEN                0x08000000      /* Registered DIMM enable       */
+#define SDRAM_CFG0_PMUD                0x04000000      /* Page management unit         */
+#define SDRAM_CFG0_DMWD_MASK   0x02000000      /* DRAM width mask              */
+#define SDRAM_CFG0_DMWD_32     0x00000000      /* 32 bits                      */
+#define SDRAM_CFG0_DMWD_64     0x02000000      /* 64 bits                      */
+#define SDRAM_CFG0_UIOS_MASK   0x00C00000      /* Unused IO State              */
+#define SDRAM_CFG0_PDP         0x00200000      /* Page deallocation policy     */
+
+/*
+ * Memory Controller Options 1
+ */
+#define SDRAM_CFG1_SRE         0x80000000      /* Self-Refresh Entry           */
+#define SDRAM_CFG1_PMEN                0x40000000      /* Power Management Enable      */
+
+/*
+ * SDRAM DEVPOT Options
+ */
+#define SDRAM_DEVOPT_DLL       0x80000000
+#define SDRAM_DEVOPT_DS                0x40000000
+
+/*
+ * SDRAM MCSTS Options
+ */
+#define SDRAM_MCSTS_MRSC       0x80000000
+#define SDRAM_MCSTS_SRMS       0x40000000
+#define SDRAM_MCSTS_CIS                0x20000000
+
+/*
+ * SDRAM Refresh Timer Register
+ */
+#define SDRAM_RTR_RINT_MASK      0xFFFF0000
+#define SDRAM_RTR_RINT_ENCODE(n)  (((n) << 16) & SDRAM_RTR_RINT_MASK)
+
+/*
+ * SDRAM UABus Base Address Reg
+ */
+#define SDRAM_UABBA_UBBA_MASK  0x0000000F
+
+/*
+ * Memory Bank 0-7 configuration
+ */
+#define SDRAM_BXCR_SDBA_MASK   0xff800000        /* Base address             */
+#define SDRAM_BXCR_SDSZ_MASK   0x000e0000        /* Size                     */
+#define SDRAM_BXCR_SDSZ_8      0x00020000        /*   8M                     */
+#define SDRAM_BXCR_SDSZ_16     0x00040000        /*  16M                     */
+#define SDRAM_BXCR_SDSZ_32     0x00060000        /*  32M                     */
+#define SDRAM_BXCR_SDSZ_64     0x00080000        /*  64M                     */
+#define SDRAM_BXCR_SDSZ_128    0x000a0000        /* 128M                     */
+#define SDRAM_BXCR_SDSZ_256    0x000c0000        /* 256M                     */
+#define SDRAM_BXCR_SDSZ_512    0x000e0000        /* 512M                     */
+#define SDRAM_BXCR_SDAM_MASK   0x0000e000        /* Addressing mode          */
+#define SDRAM_BXCR_SDAM_1      0x00000000        /*   Mode 1                 */
+#define SDRAM_BXCR_SDAM_2      0x00002000        /*   Mode 2                 */
+#define SDRAM_BXCR_SDAM_3      0x00004000        /*   Mode 3                 */
+#define SDRAM_BXCR_SDAM_4      0x00006000        /*   Mode 4                 */
+#define SDRAM_BXCR_SDBE                0x00000001        /* Memory Bank Enable       */
+
+/*
+ * SDRAM TR0 Options
+ */
+#define SDRAM_TR0_SDWR_MASK    0x80000000
+#define         SDRAM_TR0_SDWR_2_CLK   0x00000000
+#define         SDRAM_TR0_SDWR_3_CLK   0x80000000
+#define SDRAM_TR0_SDWD_MASK    0x40000000
+#define         SDRAM_TR0_SDWD_0_CLK   0x00000000
+#define         SDRAM_TR0_SDWD_1_CLK   0x40000000
+#define SDRAM_TR0_SDCL_MASK    0x01800000
+#define         SDRAM_TR0_SDCL_2_0_CLK 0x00800000
+#define         SDRAM_TR0_SDCL_2_5_CLK 0x01000000
+#define         SDRAM_TR0_SDCL_3_0_CLK 0x01800000
+#define SDRAM_TR0_SDPA_MASK    0x000C0000
+#define         SDRAM_TR0_SDPA_2_CLK   0x00040000
+#define         SDRAM_TR0_SDPA_3_CLK   0x00080000
+#define         SDRAM_TR0_SDPA_4_CLK   0x000C0000
+#define SDRAM_TR0_SDCP_MASK    0x00030000
+#define         SDRAM_TR0_SDCP_2_CLK   0x00000000
+#define         SDRAM_TR0_SDCP_3_CLK   0x00010000
+#define         SDRAM_TR0_SDCP_4_CLK   0x00020000
+#define         SDRAM_TR0_SDCP_5_CLK   0x00030000
+#define SDRAM_TR0_SDLD_MASK    0x0000C000
+#define         SDRAM_TR0_SDLD_1_CLK   0x00000000
+#define         SDRAM_TR0_SDLD_2_CLK   0x00004000
+#define SDRAM_TR0_SDRA_MASK    0x0000001C
+#define         SDRAM_TR0_SDRA_6_CLK   0x00000000
+#define         SDRAM_TR0_SDRA_7_CLK   0x00000004
+#define         SDRAM_TR0_SDRA_8_CLK   0x00000008
+#define         SDRAM_TR0_SDRA_9_CLK   0x0000000C
+#define         SDRAM_TR0_SDRA_10_CLK  0x00000010
+#define         SDRAM_TR0_SDRA_11_CLK  0x00000014
+#define         SDRAM_TR0_SDRA_12_CLK  0x00000018
+#define         SDRAM_TR0_SDRA_13_CLK  0x0000001C
+#define SDRAM_TR0_SDRD_MASK    0x00000003
+#define         SDRAM_TR0_SDRD_2_CLK   0x00000001
+#define         SDRAM_TR0_SDRD_3_CLK   0x00000002
+#define         SDRAM_TR0_SDRD_4_CLK   0x00000003
+
+/*
+ * SDRAM TR1 Options
+ */
+#define SDRAM_TR1_RDSS_MASK    0xC0000000
+#define         SDRAM_TR1_RDSS_TR0     0x00000000
+#define         SDRAM_TR1_RDSS_TR1     0x40000000
+#define         SDRAM_TR1_RDSS_TR2     0x80000000
+#define         SDRAM_TR1_RDSS_TR3     0xC0000000
+#define SDRAM_TR1_RDSL_MASK    0x00C00000
+#define         SDRAM_TR1_RDSL_STAGE1  0x00000000
+#define         SDRAM_TR1_RDSL_STAGE2  0x00400000
+#define         SDRAM_TR1_RDSL_STAGE3  0x00800000
+#define SDRAM_TR1_RDCD_MASK    0x00000800
+#define         SDRAM_TR1_RDCD_RCD_0_0 0x00000000
+#define         SDRAM_TR1_RDCD_RCD_1_2 0x00000800
+#define SDRAM_TR1_RDCT_MASK    0x000001FF
+#define         SDRAM_TR1_RDCT_ENCODE(x)  (((x) << 0) & SDRAM_TR1_RDCT_MASK)
+#define         SDRAM_TR1_RDCT_DECODE(x)  (((x) & SDRAM_TR1_RDCT_MASK) >> 0)
+#define         SDRAM_TR1_RDCT_MIN     0x00000000
+#define         SDRAM_TR1_RDCT_MAX     0x000001FF
+
+/*
+ * SDRAM WDDCTR Options
+ */
+#define SDRAM_WDDCTR_WRCP_MASK 0xC0000000
+#define         SDRAM_WDDCTR_WRCP_0DEG   0x00000000
+#define         SDRAM_WDDCTR_WRCP_90DEG  0x40000000
+#define         SDRAM_WDDCTR_WRCP_180DEG 0x80000000
+#define SDRAM_WDDCTR_DCD_MASK  0x000001FF
+
+/*
+ * SDRAM CLKTR Options
+ */
+#define SDRAM_CLKTR_CLKP_MASK  0xC0000000
+#define         SDRAM_CLKTR_CLKP_0DEG    0x00000000
+#define         SDRAM_CLKTR_CLKP_90DEG   0x40000000
+#define         SDRAM_CLKTR_CLKP_180DEG  0x80000000
+#define SDRAM_CLKTR_DCDT_MASK  0x000001FF
+
+/*
+ * SDRAM DLYCAL Options
+ */
+#define SDRAM_DLYCAL_DLCV_MASK 0x000003FC
+#define         SDRAM_DLYCAL_DLCV_ENCODE(x) (((x)<<2) & SDRAM_DLYCAL_DLCV_MASK)
+#define         SDRAM_DLYCAL_DLCV_DECODE(x) (((x) & SDRAM_DLYCAL_DLCV_MASK)>>2)
+
+#endif /* CONFIG_SDRAM_PPC4xx_IBM_DDR */
+
+#if defined(CONFIG_SDRAM_PPC4xx_IBM_DDR2)
+
+#define SDRAM_DLYCAL_DLCV_MASK         0x000003FC
+#define SDRAM_DLYCAL_DLCV_ENCODE(x)    (((x)<<2) & SDRAM_DLYCAL_DLCV_MASK)
+#define SDRAM_DLYCAL_DLCV_DECODE(x)    (((x) & SDRAM_DLYCAL_DLCV_MASK)>>2)
+
+/*
+ * Memory queue defines
+ */
+#define SDRAMQ_DCR_BASE        0x040
+
+#define SDRAM_R0BAS    (SDRAMQ_DCR_BASE+0x0)   /* rank 0 base address & size  */
+#define SDRAM_R1BAS    (SDRAMQ_DCR_BASE+0x1)   /* rank 1 base address & size  */
+#define SDRAM_R2BAS    (SDRAMQ_DCR_BASE+0x2)   /* rank 2 base address & size  */
+#define SDRAM_R3BAS    (SDRAMQ_DCR_BASE+0x3)   /* rank 3 base address & size  */
+#define SDRAM_CONF1HB  (SDRAMQ_DCR_BASE+0x5)   /* configuration 1 HB          */
+#define SDRAM_ERRSTATHB        (SDRAMQ_DCR_BASE+0x7)   /* error status HB             */
+#define SDRAM_ERRADDUHB        (SDRAMQ_DCR_BASE+0x8)   /* error address upper 32 HB   */
+#define SDRAM_ERRADDLHB        (SDRAMQ_DCR_BASE+0x9)   /* error address lower 32 HB   */
+#define SDRAM_PLBADDULL        (SDRAMQ_DCR_BASE+0xA)   /* PLB base address upper 32 LL */
+#define SDRAM_CONF1LL  (SDRAMQ_DCR_BASE+0xB)   /* configuration 1 LL          */
+#define SDRAM_ERRSTATLL        (SDRAMQ_DCR_BASE+0xC)   /* error status LL             */
+#define SDRAM_ERRADDULL        (SDRAMQ_DCR_BASE+0xD)   /* error address upper 32 LL   */
+#define SDRAM_ERRADDLLL        (SDRAMQ_DCR_BASE+0xE)   /* error address lower 32 LL   */
+#define SDRAM_CONFPATHB        (SDRAMQ_DCR_BASE+0xF)   /* configuration between paths */
+#define SDRAM_PLBADDUHB        (SDRAMQ_DCR_BASE+0x10)  /* PLB base address upper 32 LL */
+
+#if !defined(CONFIG_405EX)
+/*
+ * Memory Bank 0-7 configuration
+ */
+#if defined(CONFIG_440SPE) || \
+    defined(CONFIG_460EX) || defined(CONFIG_460GT)
+#define SDRAM_RXBAS_SDBA_MASK          0xFFE00000      /* Base address */
+#define SDRAM_RXBAS_SDBA_ENCODE(n)     ((((u32)(n))&0xFFE00000)>>2)
+#define SDRAM_RXBAS_SDBA_DECODE(n)     ((((u32)(n))&0xFFE00000)<<2)
+#endif /* CONFIG_440SPE */
+#if defined(CONFIG_440SP)
+#define SDRAM_RXBAS_SDBA_MASK          0xFF800000      /* Base address */
+#define SDRAM_RXBAS_SDBA_ENCODE(n)     ((((u32)(n))&0xFF800000))
+#define SDRAM_RXBAS_SDBA_DECODE(n)     ((((u32)(n))&0xFF800000))
+#endif /* CONFIG_440SP */
+#define SDRAM_RXBAS_SDSZ_MASK          0x0000FFC0      /* Size         */
+#define SDRAM_RXBAS_SDSZ_ENCODE(n)     ((((u32)(n))&0x3FF)<<6)
+#define SDRAM_RXBAS_SDSZ_DECODE(n)     ((((u32)(n))>>6)&0x3FF)
+#define SDRAM_RXBAS_SDSZ_0             0x00000000      /*   0M         */
+#define SDRAM_RXBAS_SDSZ_8             0x0000FFC0      /*   8M         */
+#define SDRAM_RXBAS_SDSZ_16            0x0000FF80      /*  16M         */
+#define SDRAM_RXBAS_SDSZ_32            0x0000FF00      /*  32M         */
+#define SDRAM_RXBAS_SDSZ_64            0x0000FE00      /*  64M         */
+#define SDRAM_RXBAS_SDSZ_128           0x0000FC00      /* 128M         */
+#define SDRAM_RXBAS_SDSZ_256           0x0000F800      /* 256M         */
+#define SDRAM_RXBAS_SDSZ_512           0x0000F000      /* 512M         */
+#define SDRAM_RXBAS_SDSZ_1024          0x0000E000      /* 1024M        */
+#define SDRAM_RXBAS_SDSZ_2048          0x0000C000      /* 2048M        */
+#define SDRAM_RXBAS_SDSZ_4096          0x00008000      /* 4096M        */
+#else /* CONFIG_405EX */
+/*
+ * XXX - ToDo:
+ * Revisit this file to check if all these 405EX defines are correct and
+ * can be used in the common 44x_spd_ddr2 code as well. sr, 2008-06-02
+ */
+#define SDRAM_RXBAS_SDSZ_MASK          PPC_REG_VAL(19, 0xF)
+#define SDRAM_RXBAS_SDSZ_4MB           PPC_REG_VAL(19, 0x0)
+#define SDRAM_RXBAS_SDSZ_8MB           PPC_REG_VAL(19, 0x1)
+#define SDRAM_RXBAS_SDSZ_16MB          PPC_REG_VAL(19, 0x2)
+#define SDRAM_RXBAS_SDSZ_32MB          PPC_REG_VAL(19, 0x3)
+#define SDRAM_RXBAS_SDSZ_64MB          PPC_REG_VAL(19, 0x4)
+#define SDRAM_RXBAS_SDSZ_128MB         PPC_REG_VAL(19, 0x5)
+#define SDRAM_RXBAS_SDSZ_256MB         PPC_REG_VAL(19, 0x6)
+#define SDRAM_RXBAS_SDSZ_512MB         PPC_REG_VAL(19, 0x7)
+#define SDRAM_RXBAS_SDSZ_1024MB                PPC_REG_VAL(19, 0x8)
+#define SDRAM_RXBAS_SDSZ_2048MB                PPC_REG_VAL(19, 0x9)
+#define SDRAM_RXBAS_SDSZ_4096MB                PPC_REG_VAL(19, 0xA)
+#define SDRAM_RXBAS_SDSZ_8192MB                PPC_REG_VAL(19, 0xB)
+#define SDRAM_RXBAS_SDSZ_8             SDRAM_RXBAS_SDSZ_8MB
+#define SDRAM_RXBAS_SDSZ_16            SDRAM_RXBAS_SDSZ_16MB
+#define SDRAM_RXBAS_SDSZ_32            SDRAM_RXBAS_SDSZ_32MB
+#define SDRAM_RXBAS_SDSZ_64            SDRAM_RXBAS_SDSZ_64MB
+#define SDRAM_RXBAS_SDSZ_128           SDRAM_RXBAS_SDSZ_128MB
+#define SDRAM_RXBAS_SDSZ_256           SDRAM_RXBAS_SDSZ_256MB
+#define SDRAM_RXBAS_SDSZ_512           SDRAM_RXBAS_SDSZ_512MB
+#define SDRAM_RXBAS_SDSZ_1024          SDRAM_RXBAS_SDSZ_1024MB
+#define SDRAM_RXBAS_SDSZ_2048          SDRAM_RXBAS_SDSZ_2048MB
+#define SDRAM_RXBAS_SDSZ_4096          SDRAM_RXBAS_SDSZ_4096MB
+#define SDRAM_RXBAS_SDSZ_8192          SDRAM_RXBAS_SDSZ_8192MB
+#define SDRAM_RXBAS_SDAM_MODE0         PPC_REG_VAL(23, 0x0)
+#define SDRAM_RXBAS_SDAM_MODE1         PPC_REG_VAL(23, 0x1)
+#define SDRAM_RXBAS_SDAM_MODE2         PPC_REG_VAL(23, 0x2)
+#define SDRAM_RXBAS_SDAM_MODE3         PPC_REG_VAL(23, 0x3)
+#define SDRAM_RXBAS_SDAM_MODE4         PPC_REG_VAL(23, 0x4)
+#define SDRAM_RXBAS_SDAM_MODE5         PPC_REG_VAL(23, 0x5)
+#define SDRAM_RXBAS_SDAM_MODE6         PPC_REG_VAL(23, 0x6)
+#define SDRAM_RXBAS_SDAM_MODE7         PPC_REG_VAL(23, 0x7)
+#define SDRAM_RXBAS_SDAM_MODE8         PPC_REG_VAL(23, 0x8)
+#define SDRAM_RXBAS_SDAM_MODE9         PPC_REG_VAL(23, 0x9)
+#define SDRAM_RXBAS_SDBE_DISABLE       PPC_REG_VAL(31, 0x0)
+#define SDRAM_RXBAS_SDBE_ENABLE                PPC_REG_VAL(31, 0x1)
+#endif /* CONFIG_405EX */
+
+/*
+ * Memory controller registers
+ */
+#define SDRAM_MCSTAT   0x14    /* memory controller status                  */
+#define SDRAM_MCOPT1   0x20    /* memory controller options 1               */
+#define SDRAM_MCOPT2   0x21    /* memory controller options 2               */
+#define SDRAM_MODT0    0x22    /* on die termination for bank 0             */
+#define SDRAM_MODT1    0x23    /* on die termination for bank 1             */
+#define SDRAM_MODT2    0x24    /* on die termination for bank 2             */
+#define SDRAM_MODT3    0x25    /* on die termination for bank 3             */
+#define SDRAM_CODT     0x26    /* on die termination for controller         */
+#define SDRAM_VVPR     0x27    /* variable VRef programmming                */
+#define SDRAM_OPARS    0x28    /* on chip driver control setup              */
+#define SDRAM_OPART    0x29    /* on chip driver control trigger            */
+#define SDRAM_RTR      0x30    /* refresh timer                             */
+#define SDRAM_PMIT     0x34    /* power management idle timer               */
+#define SDRAM_MB0CF    0x40    /* memory bank 0 configuration               */
+#define SDRAM_MB1CF    0x44    /* memory bank 1 configuration               */
+#define SDRAM_MB2CF    0x48
+#define SDRAM_MB3CF    0x4C
+#define SDRAM_INITPLR0 0x50    /* manual initialization control             */
+#define SDRAM_INITPLR1 0x51    /* manual initialization control             */
+#define SDRAM_INITPLR2 0x52    /* manual initialization control             */
+#define SDRAM_INITPLR3 0x53    /* manual initialization control             */
+#define SDRAM_INITPLR4 0x54    /* manual initialization control             */
+#define SDRAM_INITPLR5 0x55    /* manual initialization control             */
+#define SDRAM_INITPLR6 0x56    /* manual initialization control             */
+#define SDRAM_INITPLR7 0x57    /* manual initialization control             */
+#define SDRAM_INITPLR8 0x58    /* manual initialization control             */
+#define SDRAM_INITPLR9 0x59    /* manual initialization control             */
+#define SDRAM_INITPLR10        0x5a    /* manual initialization control             */
+#define SDRAM_INITPLR11        0x5b    /* manual initialization control             */
+#define SDRAM_INITPLR12        0x5c    /* manual initialization control             */
+#define SDRAM_INITPLR13        0x5d    /* manual initialization control             */
+#define SDRAM_INITPLR14        0x5e    /* manual initialization control             */
+#define SDRAM_INITPLR15        0x5f    /* manual initialization control             */
+#define SDRAM_RQDC     0x70    /* read DQS delay control                    */
+#define SDRAM_RFDC     0x74    /* read feedback delay control               */
+#define SDRAM_RDCC     0x78    /* read data capture control                 */
+#define SDRAM_DLCR     0x7A    /* delay line calibration                    */
+#define SDRAM_CLKTR    0x80    /* DDR clock timing                          */
+#define SDRAM_WRDTR    0x81    /* write data, DQS, DM clock, timing         */
+#define SDRAM_SDTR1    0x85    /* DDR SDRAM timing 1                        */
+#define SDRAM_SDTR2    0x86    /* DDR SDRAM timing 2                        */
+#define SDRAM_SDTR3    0x87    /* DDR SDRAM timing 3                        */
+#define SDRAM_MMODE    0x88    /* memory mode                               */
+#define SDRAM_MEMODE   0x89    /* memory extended mode                      */
+#define SDRAM_ECCCR    0x98    /* ECC error status                          */
+#define SDRAM_CID      0xA4    /* core ID                                   */
+#define SDRAM_RID      0xA8    /* revision ID                               */
+#define SDRAM_RTSR     0xB1    /* run time status tracking                  */
+
+/*
+ * Memory Controller Status
+ */
+#define SDRAM_MCSTAT_MIC_MASK          0x80000000      /* Memory init status mask      */
+#define SDRAM_MCSTAT_MIC_NOTCOMP       0x00000000      /* Mem init not complete        */
+#define SDRAM_MCSTAT_MIC_COMP          0x80000000      /* Mem init complete            */
+#define SDRAM_MCSTAT_SRMS_MASK         0x40000000      /* Mem self refresh stat mask   */
+#define SDRAM_MCSTAT_SRMS_NOT_SF       0x00000000      /* Mem not in self refresh      */
+#define SDRAM_MCSTAT_SRMS_SF           0x40000000      /* Mem in self refresh          */
+#define SDRAM_MCSTAT_IDLE_MASK         0x20000000      /* Mem self refresh stat mask   */
+#define SDRAM_MCSTAT_IDLE_NOT          0x00000000      /* Mem contr not idle           */
+#define SDRAM_MCSTAT_IDLE              0x20000000      /* Mem contr idle               */
+
+/*
+ * Memory Controller Options 1
+ */
+#define SDRAM_MCOPT1_MCHK_MASK         0x30000000 /* Memory data err check mask*/
+#define SDRAM_MCOPT1_MCHK_NON          0x00000000 /* No ECC generation         */
+#define SDRAM_MCOPT1_MCHK_GEN          0x20000000 /* ECC generation            */
+#define SDRAM_MCOPT1_MCHK_CHK          0x10000000 /* ECC generation and check  */
+#define SDRAM_MCOPT1_MCHK_CHK_REP      0x30000000 /* ECC generation, chk, report*/
+#define SDRAM_MCOPT1_MCHK_CHK_DECODE(n)        ((((u32)(n))>>28)&0x3)
+#define SDRAM_MCOPT1_RDEN_MASK         0x08000000 /* Registered DIMM mask      */
+#define SDRAM_MCOPT1_RDEN              0x08000000 /* Registered DIMM enable    */
+#define SDRAM_MCOPT1_PMU_MASK          0x06000000 /* Page management unit mask */
+#define SDRAM_MCOPT1_PMU_CLOSE         0x00000000 /* PMU Close                 */
+#define SDRAM_MCOPT1_PMU_OPEN          0x04000000 /* PMU Open                  */
+#define SDRAM_MCOPT1_PMU_AUTOCLOSE     0x02000000 /* PMU AutoClose             */
+#define SDRAM_MCOPT1_DMWD_MASK         0x01000000 /* DRAM width mask           */
+#define SDRAM_MCOPT1_DMWD_32           0x00000000 /* 32 bits                   */
+#define SDRAM_MCOPT1_DMWD_64           0x01000000 /* 64 bits                   */
+#define SDRAM_MCOPT1_UIOS_MASK         0x00C00000 /* Unused IO State           */
+#define SDRAM_MCOPT1_BCNT_MASK         0x00200000 /* Bank count                */
+#define SDRAM_MCOPT1_4_BANKS           0x00000000 /* 4 Banks                   */
+#define SDRAM_MCOPT1_8_BANKS           0x00200000 /* 8 Banks                   */
+#define SDRAM_MCOPT1_DDR_TYPE_MASK     0x00100000 /* DDR Memory Type mask      */
+#define SDRAM_MCOPT1_DDR1_TYPE         0x00000000 /* DDR1 Memory Type          */
+#define SDRAM_MCOPT1_DDR2_TYPE         0x00100000 /* DDR2 Memory Type          */
+#define SDRAM_MCOPT1_QDEP              0x00020000 /* 4 commands deep           */
+#define SDRAM_MCOPT1_RWOO_MASK         0x00008000 /* Out of Order Read mask    */
+#define SDRAM_MCOPT1_RWOO_DISABLED     0x00000000 /* disabled                  */
+#define SDRAM_MCOPT1_RWOO_ENABLED      0x00008000 /* enabled                   */
+#define SDRAM_MCOPT1_WOOO_MASK         0x00004000 /* Out of Order Write mask   */
+#define SDRAM_MCOPT1_WOOO_DISABLED     0x00000000 /* disabled                  */
+#define SDRAM_MCOPT1_WOOO_ENABLED      0x00004000 /* enabled                   */
+#define SDRAM_MCOPT1_DCOO_MASK         0x00002000 /* All Out of Order mask     */
+#define SDRAM_MCOPT1_DCOO_DISABLED     0x00002000 /* disabled                  */
+#define SDRAM_MCOPT1_DCOO_ENABLED      0x00000000 /* enabled                   */
+#define SDRAM_MCOPT1_DREF_MASK         0x00001000 /* Deferred refresh mask     */
+#define SDRAM_MCOPT1_DREF_NORMAL       0x00000000 /* normal refresh            */
+#define SDRAM_MCOPT1_DREF_DEFER_4      0x00001000 /* defer up to 4 refresh cmd */
+
+/*
+ * Memory Controller Options 2
+ */
+#define SDRAM_MCOPT2_SREN_MASK         0x80000000 /* Self Test mask            */
+#define SDRAM_MCOPT2_SREN_EXIT         0x00000000 /* Self Test exit            */
+#define SDRAM_MCOPT2_SREN_ENTER                0x80000000 /* Self Test enter           */
+#define SDRAM_MCOPT2_PMEN_MASK         0x40000000 /* Power Management mask     */
+#define SDRAM_MCOPT2_PMEN_DISABLE      0x00000000 /* disable                   */
+#define SDRAM_MCOPT2_PMEN_ENABLE       0x40000000 /* enable                    */
+#define SDRAM_MCOPT2_IPTR_MASK         0x20000000 /* Init Trigger Reg mask     */
+#define SDRAM_MCOPT2_IPTR_IDLE         0x00000000 /* idle                      */
+#define SDRAM_MCOPT2_IPTR_EXECUTE      0x20000000 /* execute preloaded init    */
+#define SDRAM_MCOPT2_XSRP_MASK         0x10000000 /* Exit Self Refresh Prevent */
+#define SDRAM_MCOPT2_XSRP_ALLOW                0x00000000 /* allow self refresh exit   */
+#define SDRAM_MCOPT2_XSRP_PREVENT      0x10000000 /* prevent self refresh exit */
+#define SDRAM_MCOPT2_DCEN_MASK         0x08000000 /* SDRAM Controller Enable   */
+#define SDRAM_MCOPT2_DCEN_DISABLE      0x00000000 /* SDRAM Controller Enable   */
+#define SDRAM_MCOPT2_DCEN_ENABLE       0x08000000 /* SDRAM Controller Enable   */
+#define SDRAM_MCOPT2_ISIE_MASK         0x04000000 /* Init Seq Interruptable mas*/
+#define SDRAM_MCOPT2_ISIE_DISABLE      0x00000000 /* disable                   */
+#define SDRAM_MCOPT2_ISIE_ENABLE       0x04000000 /* enable                    */
+
+/*
+ * SDRAM Refresh Timer Register
+ */
+#define SDRAM_RTR_RINT_MASK            0xFFF80000
+#define SDRAM_RTR_RINT_ENCODE(n)       ((((u32)(n))&0xFFF8)<<16)
+#define SDRAM_RTR_RINT_DECODE(n)       ((((u32)(n))>>16)&0xFFF8)
+
+/*
+ * SDRAM Read DQS Delay Control Register
+ */
+#define SDRAM_RQDC_RQDE_MASK           0x80000000
+#define SDRAM_RQDC_RQDE_DISABLE                0x00000000
+#define SDRAM_RQDC_RQDE_ENABLE         0x80000000
+#define SDRAM_RQDC_RQFD_MASK           0x000001FF
+#define SDRAM_RQDC_RQFD_ENCODE(n)      ((((u32)(n))&0x1FF)<<0)
+
+#define SDRAM_RQDC_RQFD_MAX            0x1FF
+
+/*
+ * SDRAM Read Data Capture Control Register
+ */
+#define SDRAM_RDCC_RDSS_MASK           0xC0000000
+#define SDRAM_RDCC_RDSS_T1             0x00000000
+#define SDRAM_RDCC_RDSS_T2             0x40000000
+#define SDRAM_RDCC_RDSS_T3             0x80000000
+#define SDRAM_RDCC_RDSS_T4             0xC0000000
+#define SDRAM_RDCC_RSAE_MASK           0x00000001
+#define SDRAM_RDCC_RSAE_DISABLE                0x00000001
+#define SDRAM_RDCC_RSAE_ENABLE         0x00000000
+
+/*
+ * SDRAM Read Feedback Delay Control Register
+ */
+#define SDRAM_RFDC_ARSE_MASK           0x80000000
+#define SDRAM_RFDC_ARSE_DISABLE                0x80000000
+#define SDRAM_RFDC_ARSE_ENABLE         0x00000000
+#define SDRAM_RFDC_RFOS_MASK           0x007F0000
+#define SDRAM_RFDC_RFOS_ENCODE(n)      ((((u32)(n))&0x7F)<<16)
+#define SDRAM_RFDC_RFFD_MASK           0x000007FF
+#define SDRAM_RFDC_RFFD_ENCODE(n)      ((((u32)(n))&0x7FF)<<0)
+
+#define SDRAM_RFDC_RFFD_MAX            0x7FF
+
+/*
+ * SDRAM Delay Line Calibration Register
+ */
+#define SDRAM_DLCR_DCLM_MASK           0x80000000
+#define SDRAM_DLCR_DCLM_MANUEL         0x80000000
+#define SDRAM_DLCR_DCLM_AUTO           0x00000000
+#define SDRAM_DLCR_DLCR_MASK           0x08000000
+#define SDRAM_DLCR_DLCR_CALIBRATE      0x08000000
+#define SDRAM_DLCR_DLCR_IDLE           0x00000000
+#define SDRAM_DLCR_DLCS_MASK           0x07000000
+#define SDRAM_DLCR_DLCS_NOT_RUN                0x00000000
+#define SDRAM_DLCR_DLCS_IN_PROGRESS    0x01000000
+#define SDRAM_DLCR_DLCS_COMPLETE       0x02000000
+#define SDRAM_DLCR_DLCS_CONT_DONE      0x03000000
+#define SDRAM_DLCR_DLCS_ERROR          0x04000000
+#define SDRAM_DLCR_DLCV_MASK           0x000001FF
+#define SDRAM_DLCR_DLCV_ENCODE(n)      ((((u32)(n))&0x1FF)<<0)
+#define SDRAM_DLCR_DLCV_DECODE(n)      ((((u32)(n))>>0)&0x1FF)
+
+/*
+ * SDRAM Controller On Die Termination Register
+ */
+#define SDRAM_CODT_ODT_ON                      0x80000000
+#define SDRAM_CODT_ODT_OFF                     0x00000000
+#define SDRAM_CODT_DQS_VOLTAGE_DDR_MASK                0x00000020
+#define SDRAM_CODT_DQS_2_5_V_DDR1              0x00000000
+#define SDRAM_CODT_DQS_1_8_V_DDR2              0x00000020
+#define SDRAM_CODT_DQS_MASK                    0x00000010
+#define SDRAM_CODT_DQS_DIFFERENTIAL            0x00000000
+#define SDRAM_CODT_DQS_SINGLE_END              0x00000010
+#define SDRAM_CODT_CKSE_DIFFERENTIAL           0x00000000
+#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
+
+/*
+ * SDRAM Mode Register
+ */
+#define SDRAM_MMODE_WR_MASK            0x00000E00
+#define SDRAM_MMODE_WR_DDR1            0x00000000
+#define SDRAM_MMODE_WR_DDR2_3_CYC      0x00000400
+#define SDRAM_MMODE_WR_DDR2_4_CYC      0x00000600
+#define SDRAM_MMODE_WR_DDR2_5_CYC      0x00000800
+#define SDRAM_MMODE_WR_DDR2_6_CYC      0x00000A00
+#define SDRAM_MMODE_DCL_MASK           0x00000070
+#define SDRAM_MMODE_DCL_DDR1_2_0_CLK   0x00000020
+#define SDRAM_MMODE_DCL_DDR1_2_5_CLK   0x00000060
+#define SDRAM_MMODE_DCL_DDR1_3_0_CLK   0x00000030
+#define SDRAM_MMODE_DCL_DDR2_2_0_CLK   0x00000020
+#define SDRAM_MMODE_DCL_DDR2_3_0_CLK   0x00000030
+#define SDRAM_MMODE_DCL_DDR2_4_0_CLK   0x00000040
+#define SDRAM_MMODE_DCL_DDR2_5_0_CLK   0x00000050
+#define SDRAM_MMODE_DCL_DDR2_6_0_CLK   0x00000060
+#define SDRAM_MMODE_DCL_DDR2_7_0_CLK   0x00000070
+
+/*
+ * SDRAM Extended Mode Register
+ */
+#define SDRAM_MEMODE_DIC_MASK          0x00000002
+#define SDRAM_MEMODE_DIC_NORMAL                0x00000000
+#define SDRAM_MEMODE_DIC_WEAK          0x00000002
+#define SDRAM_MEMODE_DLL_MASK          0x00000001
+#define SDRAM_MEMODE_DLL_DISABLE       0x00000001
+#define SDRAM_MEMODE_DLL_ENABLE                0x00000000
+#define SDRAM_MEMODE_RTT_MASK          0x00000044
+#define SDRAM_MEMODE_RTT_DISABLED      0x00000000
+#define SDRAM_MEMODE_RTT_75OHM         0x00000004
+#define SDRAM_MEMODE_RTT_150OHM                0x00000040
+#define SDRAM_MEMODE_DQS_MASK          0x00000400
+#define SDRAM_MEMODE_DQS_DISABLE       0x00000400
+#define SDRAM_MEMODE_DQS_ENABLE                0x00000000
+
+/*
+ * SDRAM Clock Timing Register
+ */
+#define SDRAM_CLKTR_CLKP_MASK          0xC0000000
+#define SDRAM_CLKTR_CLKP_0_DEG         0x00000000
+#define SDRAM_CLKTR_CLKP_180_DEG_ADV   0x80000000
+#define SDRAM_CLKTR_CLKP_90_DEG_ADV    0x40000000
+#define SDRAM_CLKTR_CLKP_270_DEG_ADV   0xC0000000
+
+/*
+ * SDRAM Write Timing Register
+ */
+#define SDRAM_WRDTR_LLWP_MASK          0x10000000
+#define SDRAM_WRDTR_LLWP_DIS           0x10000000
+#define SDRAM_WRDTR_LLWP_1_CYC         0x00000000
+#define SDRAM_WRDTR_WTR_MASK           0x0E000000
+#define SDRAM_WRDTR_WTR_0_DEG          0x06000000
+#define SDRAM_WRDTR_WTR_90_DEG_ADV     0x04000000
+#define SDRAM_WRDTR_WTR_180_DEG_ADV    0x02000000
+#define SDRAM_WRDTR_WTR_270_DEG_ADV    0x00000000
+
+/*
+ * SDRAM SDTR1 Options
+ */
+#define SDRAM_SDTR1_LDOF_MASK          0x80000000
+#define SDRAM_SDTR1_LDOF_1_CLK         0x00000000
+#define SDRAM_SDTR1_LDOF_2_CLK         0x80000000
+#define SDRAM_SDTR1_RTW_MASK           0x00F00000
+#define SDRAM_SDTR1_RTW_2_CLK          0x00200000
+#define SDRAM_SDTR1_RTW_3_CLK          0x00300000
+#define SDRAM_SDTR1_WTWO_MASK          0x000F0000
+#define SDRAM_SDTR1_WTWO_0_CLK         0x00000000
+#define SDRAM_SDTR1_WTWO_1_CLK         0x00010000
+#define SDRAM_SDTR1_RTRO_MASK          0x0000F000
+#define SDRAM_SDTR1_RTRO_1_CLK         0x00001000
+#define SDRAM_SDTR1_RTRO_2_CLK         0x00002000
+
+/*
+ * SDRAM SDTR2 Options
+ */
+#define SDRAM_SDTR2_RCD_MASK           0xF0000000
+#define SDRAM_SDTR2_RCD_1_CLK          0x10000000
+#define SDRAM_SDTR2_RCD_2_CLK          0x20000000
+#define SDRAM_SDTR2_RCD_3_CLK          0x30000000
+#define SDRAM_SDTR2_RCD_4_CLK          0x40000000
+#define SDRAM_SDTR2_RCD_5_CLK          0x50000000
+#define SDRAM_SDTR2_WTR_MASK           0x0F000000
+#define SDRAM_SDTR2_WTR_1_CLK          0x01000000
+#define SDRAM_SDTR2_WTR_2_CLK          0x02000000
+#define SDRAM_SDTR2_WTR_3_CLK          0x03000000
+#define SDRAM_SDTR2_WTR_4_CLK          0x04000000
+#define SDRAM_SDTR3_WTR_ENCODE(n)      ((((u32)(n))&0xF)<<24)
+#define SDRAM_SDTR2_XSNR_MASK          0x00FF0000
+#define SDRAM_SDTR2_XSNR_8_CLK         0x00080000
+#define SDRAM_SDTR2_XSNR_16_CLK                0x00100000
+#define SDRAM_SDTR2_XSNR_32_CLK                0x00200000
+#define SDRAM_SDTR2_XSNR_64_CLK                0x00400000
+#define SDRAM_SDTR2_WPC_MASK           0x0000F000
+#define SDRAM_SDTR2_WPC_2_CLK          0x00002000
+#define SDRAM_SDTR2_WPC_3_CLK          0x00003000
+#define SDRAM_SDTR2_WPC_4_CLK          0x00004000
+#define SDRAM_SDTR2_WPC_5_CLK          0x00005000
+#define SDRAM_SDTR2_WPC_6_CLK          0x00006000
+#define SDRAM_SDTR3_WPC_ENCODE(n)      ((((u32)(n))&0xF)<<12)
+#define SDRAM_SDTR2_RPC_MASK           0x00000F00
+#define SDRAM_SDTR2_RPC_2_CLK          0x00000200
+#define SDRAM_SDTR2_RPC_3_CLK          0x00000300
+#define SDRAM_SDTR2_RPC_4_CLK          0x00000400
+#define SDRAM_SDTR2_RP_MASK            0x000000F0
+#define SDRAM_SDTR2_RP_3_CLK           0x00000030
+#define SDRAM_SDTR2_RP_4_CLK           0x00000040
+#define SDRAM_SDTR2_RP_5_CLK           0x00000050
+#define SDRAM_SDTR2_RP_6_CLK           0x00000060
+#define SDRAM_SDTR2_RP_7_CLK           0x00000070
+#define SDRAM_SDTR2_RRD_MASK           0x0000000F
+#define SDRAM_SDTR2_RRD_2_CLK          0x00000002
+#define SDRAM_SDTR2_RRD_3_CLK          0x00000003
+
+/*
+ * SDRAM SDTR3 Options
+ */
+#define SDRAM_SDTR3_RAS_MASK           0x1F000000
+#define SDRAM_SDTR3_RAS_ENCODE(n)      ((((u32)(n))&0x1F)<<24)
+#define SDRAM_SDTR3_RC_MASK            0x001F0000
+#define SDRAM_SDTR3_RC_ENCODE(n)       ((((u32)(n))&0x1F)<<16)
+#define SDRAM_SDTR3_XCS_MASK           0x00001F00
+#define SDRAM_SDTR3_XCS                        0x00000D00
+#define SDRAM_SDTR3_RFC_MASK           0x0000003F
+#define SDRAM_SDTR3_RFC_ENCODE(n)      ((((u32)(n))&0x3F)<<0)
+
+/*
+ * Memory Bank 0-1 configuration
+ */
+#define SDRAM_BXCF_M_AM_MASK           0x00000F00      /* Addressing mode      */
+#define SDRAM_BXCF_M_AM_0              0x00000000      /*   Mode 0             */
+#define SDRAM_BXCF_M_AM_1              0x00000100      /*   Mode 1             */
+#define SDRAM_BXCF_M_AM_2              0x00000200      /*   Mode 2             */
+#define SDRAM_BXCF_M_AM_3              0x00000300      /*   Mode 3             */
+#define SDRAM_BXCF_M_AM_4              0x00000400      /*   Mode 4             */
+#define SDRAM_BXCF_M_AM_5              0x00000500      /*   Mode 5             */
+#define SDRAM_BXCF_M_AM_6              0x00000600      /*   Mode 6             */
+#define SDRAM_BXCF_M_AM_7              0x00000700      /*   Mode 7             */
+#define SDRAM_BXCF_M_AM_8              0x00000800      /*   Mode 8             */
+#define SDRAM_BXCF_M_AM_9              0x00000900      /*   Mode 9             */
+#define SDRAM_BXCF_M_BE_MASK           0x00000001      /* Memory Bank Enable   */
+#define SDRAM_BXCF_M_BE_DISABLE                0x00000000      /* Memory Bank Enable   */
+#define SDRAM_BXCF_M_BE_ENABLE         0x00000001      /* Memory Bank Enable   */
+
+#define SDRAM_RTSR_TRK1SM_MASK         0xC0000000      /* Tracking State Mach 1*/
+#define SDRAM_RTSR_TRK1SM_ATBASE       0x00000000      /* atbase state         */
+#define SDRAM_RTSR_TRK1SM_MISSED       0x40000000      /* missed state         */
+#define SDRAM_RTSR_TRK1SM_ATPLS1       0x80000000      /* atpls1 state         */
+#define SDRAM_RTSR_TRK1SM_RESET                0xC0000000      /* reset  state         */
+
+#define SDR0_MFR_FIXD                  0x10000000      /* Workaround for PCI/DMA */
+
+#endif /* CONFIG_SDRAM_PPC4xx_IBM_DDR2 */
+
+#if defined(CONFIG_SDRAM_PPC4xx_DENALI_DDR2)
+/*
+ * SDRAM Controller
+ */
+#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)      ((((u32)(n))&0x7F)<<24)
+#define DDR0_00_INT_ACK_DECODE(n)      ((((u32)(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)   ((((u32)(n))&0xFF)<<16)
+#define DDR0_00_INT_STATUS_DECODE(n)   ((((u32)(n))>>16)&0xFF)
+#define DDR0_00_DLL_INCREMENT_MASK     0x00007F00
+#define DDR0_00_DLL_INCREMENT_ENCODE(n)        ((((u32)(n))&0x7F)<<8)
+#define DDR0_00_DLL_INCREMENT_DECODE(n)        ((((u32)(n))>>8)&0x7F)
+#define DDR0_00_DLL_START_POINT_MASK   0x0000007F
+#define DDR0_00_DLL_START_POINT_ENCODE(n) ((((u32)(n))&0x7F)<<0)
+#define DDR0_00_DLL_START_POINT_DECODE(n) ((((u32)(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) ((((u32)(n))&0x1F)<<24)
+#define DDR0_01_PLB0_DB_CS_LOWER_DECODE(n) ((((u32)(n))>>24)&0x1F)
+#define DDR0_01_PLB0_DB_CS_UPPER_MASK  0x001F0000
+#define DDR0_01_PLB0_DB_CS_UPPER_ENCODE(n) ((((u32)(n))&0x1F)<<16)
+#define DDR0_01_PLB0_DB_CS_UPPER_DECODE(n) ((((u32)(n))>>16)&0x1F)
+#define DDR0_01_OUT_OF_RANGE_TYPE_MASK 0x00000700      /* Read only */
+#define DDR0_01_OUT_OF_RANGE_TYPE_ENCODE(n) ((((u32)(n))&0x7)<<8)
+#define DDR0_01_OUT_OF_RANGE_TYPE_DECODE(n) ((((u32)(n))>>8)&0x7)
+#define DDR0_01_INT_MASK_MASK          0x000000FF
+#define DDR0_01_INT_MASK_ENCODE(n)     ((((u32)(n))&0xFF)<<0)
+#define DDR0_01_INT_MASK_DECODE(n)     ((((u32)(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)   ((((u32)(n))&0x2)<<24)
+#define DDR0_02_MAX_CS_REG_DECODE(n)   ((((u32)(n))>>24)&0x2)
+#define DDR0_02_MAX_COL_REG_MASK       0x000F0000      /* Read only */
+#define DDR0_02_MAX_COL_REG_ENCODE(n)  ((((u32)(n))&0xF)<<16)
+#define DDR0_02_MAX_COL_REG_DECODE(n)  ((((u32)(n))>>16)&0xF)
+#define DDR0_02_MAX_ROW_REG_MASK       0x00000F00      /* Read only */
+#define DDR0_02_MAX_ROW_REG_ENCODE(n)  ((((u32)(n))&0xF)<<8)
+#define DDR0_02_MAX_ROW_REG_DECODE(n)  ((((u32)(n))>>8)&0xF)
+#define DDR0_02_START_MASK             0x00000001
+#define DDR0_02_START_ENCODE(n)                ((((u32)(n))&0x1)<<0)
+#define DDR0_02_START_DECODE(n)                ((((u32)(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)       ((((u32)(n))&0x7)<<24)
+#define DDR0_03_BSTLEN_DECODE(n)       ((((u32)(n))>>24)&0x7)
+#define DDR0_03_CASLAT_MASK            0x00070000
+#define DDR0_03_CASLAT_ENCODE(n)       ((((u32)(n))&0x7)<<16)
+#define DDR0_03_CASLAT_DECODE(n)       ((((u32)(n))>>16)&0x7)
+#define DDR0_03_CASLAT_LIN_MASK                0x00000F00
+#define DDR0_03_CASLAT_LIN_ENCODE(n)   ((((u32)(n))&0xF)<<8)
+#define DDR0_03_CASLAT_LIN_DECODE(n)   ((((u32)(n))>>8)&0xF)
+#define DDR0_03_INITAREF_MASK          0x0000000F
+#define DDR0_03_INITAREF_ENCODE(n)     ((((u32)(n))&0xF)<<0)
+#define DDR0_03_INITAREF_DECODE(n)     ((((u32)(n))>>0)&0xF)
+
+#define DDR0_04                                0x04
+#define DDR0_04_TRC_MASK               0x1F000000
+#define DDR0_04_TRC_ENCODE(n)          ((((u32)(n))&0x1F)<<24)
+#define DDR0_04_TRC_DECODE(n)          ((((u32)(n))>>24)&0x1F)
+#define DDR0_04_TRRD_MASK              0x00070000
+#define DDR0_04_TRRD_ENCODE(n)         ((((u32)(n))&0x7)<<16)
+#define DDR0_04_TRRD_DECODE(n)         ((((u32)(n))>>16)&0x7)
+#define DDR0_04_TRTP_MASK              0x00000700
+#define DDR0_04_TRTP_ENCODE(n)         ((((u32)(n))&0x7)<<8)
+#define DDR0_04_TRTP_DECODE(n)         ((((u32)(n))>>8)&0x7)
+
+#define DDR0_05                                0x05
+#define DDR0_05_TMRD_MASK              0x1F000000
+#define DDR0_05_TMRD_ENCODE(n)         ((((u32)(n))&0x1F)<<24)
+#define DDR0_05_TMRD_DECODE(n)         ((((u32)(n))>>24)&0x1F)
+#define DDR0_05_TEMRS_MASK             0x00070000
+#define DDR0_05_TEMRS_ENCODE(n)                ((((u32)(n))&0x7)<<16)
+#define DDR0_05_TEMRS_DECODE(n)                ((((u32)(n))>>16)&0x7)
+#define DDR0_05_TRP_MASK               0x00000F00
+#define DDR0_05_TRP_ENCODE(n)          ((((u32)(n))&0xF)<<8)
+#define DDR0_05_TRP_DECODE(n)          ((((u32)(n))>>8)&0xF)
+#define DDR0_05_TRAS_MIN_MASK          0x000000FF
+#define DDR0_05_TRAS_MIN_ENCODE(n)     ((((u32)(n))&0xFF)<<0)
+#define DDR0_05_TRAS_MIN_DECODE(n)     ((((u32)(n))>>0)&0xFF)
+
+#define DDR0_06                                0x06
+#define DDR0_06_WRITEINTERP_MASK       0x01000000
+#define DDR0_06_WRITEINTERP_ENCODE(n)  ((((u32)(n))&0x1)<<24)
+#define DDR0_06_WRITEINTERP_DECODE(n)  ((((u32)(n))>>24)&0x1)
+#define DDR0_06_TWTR_MASK              0x00070000
+#define DDR0_06_TWTR_ENCODE(n)         ((((u32)(n))&0x7)<<16)
+#define DDR0_06_TWTR_DECODE(n)         ((((u32)(n))>>16)&0x7)
+#define DDR0_06_TDLL_MASK              0x0000FF00
+#define DDR0_06_TDLL_ENCODE(n)         ((((u32)(n))&0xFF)<<8)
+#define DDR0_06_TDLL_DECODE(n)         ((((u32)(n))>>8)&0xFF)
+#define DDR0_06_TRFC_MASK              0x0000007F
+#define DDR0_06_TRFC_ENCODE(n)         ((((u32)(n))&0x7F)<<0)
+#define DDR0_06_TRFC_DECODE(n)         ((((u32)(n))>>0)&0x7F)
+
+#define DDR0_07                                0x07
+#define DDR0_07_NO_CMD_INIT_MASK       0x01000000
+#define DDR0_07_NO_CMD_INIT_ENCODE(n)  ((((u32)(n))&0x1)<<24)
+#define DDR0_07_NO_CMD_INIT_DECODE(n)  ((((u32)(n))>>24)&0x1)
+#define DDR0_07_TFAW_MASK              0x001F0000
+#define DDR0_07_TFAW_ENCODE(n)         ((((u32)(n))&0x1F)<<16)
+#define DDR0_07_TFAW_DECODE(n)         ((((u32)(n))>>16)&0x1F)
+#define DDR0_07_AUTO_REFRESH_MODE_MASK 0x00000100
+#define DDR0_07_AUTO_REFRESH_MODE_ENCODE(n) ((((u32)(n))&0x1)<<8)
+#define DDR0_07_AUTO_REFRESH_MODE_DECODE(n) ((((u32)(n))>>8)&0x1)
+#define DDR0_07_AREFRESH_MASK          0x00000001
+#define DDR0_07_AREFRESH_ENCODE(n)     ((((u32)(n))&0x1)<<0)
+#define DDR0_07_AREFRESH_DECODE(n)     ((((u32)(n))>>0)&0x1)
+
+#define DDR0_08                                0x08
+#define DDR0_08_WRLAT_MASK             0x07000000
+#define DDR0_08_WRLAT_ENCODE(n)                ((((u32)(n))&0x7)<<24)
+#define DDR0_08_WRLAT_DECODE(n)                ((((u32)(n))>>24)&0x7)
+#define DDR0_08_TCPD_MASK              0x00FF0000
+#define DDR0_08_TCPD_ENCODE(n)         ((((u32)(n))&0xFF)<<16)
+#define DDR0_08_TCPD_DECODE(n)         ((((u32)(n))>>16)&0xFF)
+#define DDR0_08_DQS_N_EN_MASK          0x00000100
+#define DDR0_08_DQS_N_EN_ENCODE(n)     ((((u32)(n))&0x1)<<8)
+#define DDR0_08_DQS_N_EN_DECODE(n)     ((((u32)(n))>>8)&0x1)
+#define DDR0_08_DDRII_SDRAM_MODE_MASK  0x00000001
+#define DDR0_08_DDRII_ENCODE(n)                ((((u32)(n))&0x1)<<0)
+#define DDR0_08_DDRII_DECODE(n)                ((((u32)(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) ((((u32)(n))&0x1F)<<24)
+#define DDR0_09_OCD_ADJUST_PDN_CS_0_DECODE(n) ((((u32)(n))>>24)&0x1F)
+#define DDR0_09_RTT_0_MASK             0x00030000
+#define DDR0_09_RTT_0_ENCODE(n)                ((((u32)(n))&0x3)<<16)
+#define DDR0_09_RTT_0_DECODE(n)                ((((u32)(n))>>16)&0x3)
+#define DDR0_09_WR_DQS_SHIFT_BYPASS_MASK  0x00007F00
+#define DDR0_09_WR_DQS_SHIFT_BYPASS_ENCODE(n) ((((u32)(n))&0x7F)<<8)
+#define DDR0_09_WR_DQS_SHIFT_BYPASS_DECODE(n) ((((u32)(n))>>8)&0x7F)
+#define DDR0_09_WR_DQS_SHIFT_MASK      0x0000007F
+#define DDR0_09_WR_DQS_SHIFT_ENCODE(n) ((((u32)(n))&0x7F)<<0)
+#define DDR0_09_WR_DQS_SHIFT_DECODE(n) ((((u32)(n))>>0)&0x7F)
+
+#define DDR0_10                                0x0A
+#define DDR0_10_WRITE_MODEREG_MASK     0x00010000      /* Write only */
+#define DDR0_10_WRITE_MODEREG_ENCODE(n)        ((((u32)(n))&0x1)<<16)
+#define DDR0_10_WRITE_MODEREG_DECODE(n)        ((((u32)(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)       ((((u32)(n))&0x3)<<8)
+#define DDR0_10_CS_MAP_DECODE(n)       ((((u32)(n))>>8)&0x3)
+#define DDR0_10_OCD_ADJUST_PUP_CS_0_MASK  0x0000001F
+#define DDR0_10_OCD_ADJUST_PUP_CS_0_ENCODE(n) ((((u32)(n))&0x1F)<<0)
+#define DDR0_10_OCD_ADJUST_PUP_CS_0_DECODE(n) ((((u32)(n))>>0)&0x1F)
+
+#define DDR0_11                                0x0B
+#define DDR0_11_SREFRESH_MASK          0x01000000
+#define DDR0_11_SREFRESH_ENCODE(n)     ((((u32)(n))&0x1)<<24)
+#define DDR0_11_SREFRESH_DECODE(n)     ((((u32)(n))>>24)&0x1F)
+#define DDR0_11_TXSNR_MASK             0x00FF0000
+#define DDR0_11_TXSNR_ENCODE(n)                ((((u32)(n))&0xFF)<<16)
+#define DDR0_11_TXSNR_DECODE(n)                ((((u32)(n))>>16)&0xFF)
+#define DDR0_11_TXSR_MASK              0x0000FF00
+#define DDR0_11_TXSR_ENCODE(n)         ((((u32)(n))&0xFF)<<8)
+#define DDR0_11_TXSR_DECODE(n)         ((((u32)(n))>>8)&0xFF)
+
+#define DDR0_12                                0x0C
+#define DDR0_12_TCKE_MASK              0x0000007
+#define DDR0_12_TCKE_ENCODE(n)         ((((u32)(n))&0x7)<<0)
+#define DDR0_12_TCKE_DECODE(n)         ((((u32)(n))>>0)&0x7)
+
+#define DDR0_14                                0x0E
+#define DDR0_14_DLL_BYPASS_MODE_MASK   0x01000000
+#define DDR0_14_DLL_BYPASS_MODE_ENCODE(n) ((((u32)(n))&0x1)<<24)
+#define DDR0_14_DLL_BYPASS_MODE_DECODE(n) ((((u32)(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)                ((((u32)(n))&0x1)<<16)
+#define DDR0_14_REDUC_DECODE(n)                ((((u32)(n))>>16)&0x1)
+#define DDR0_14_REG_DIMM_ENABLE_MASK   0x00000100
+#define DDR0_14_REG_DIMM_ENABLE_ENCODE(n) ((((u32)(n))&0x1)<<8)
+#define DDR0_14_REG_DIMM_ENABLE_DECODE(n) ((((u32)(n))>>8)&0x1)
+
+#define DDR0_17                                0x11
+#define DDR0_17_DLL_DQS_DELAY_0_MASK   0x7F000000
+#define DDR0_17_DLL_DQS_DELAY_0_ENCODE(n) ((((u32)(n))&0x7F)<<24)
+#define DDR0_17_DLL_DQS_DELAY_0_DECODE(n) ((((u32)(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)   ((((u32)(n))&0x1)<<16)
+#define DDR0_17_DLLLOCKREG_DECODE(n)   ((((u32)(n))>>16)&0x1)
+#define DDR0_17_DLL_LOCK_MASK          0x00007F00      /* Read only */
+#define DDR0_17_DLL_LOCK_ENCODE(n)     ((((u32)(n))&0x7F)<<8)
+#define DDR0_17_DLL_LOCK_DECODE(n)     ((((u32)(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) ((((u32)(n))&0x7F)<<24)
+#define DDR0_18_DLL_DQS_DELAY_4_DECODE(n) ((((u32)(n))>>24)&0x7F)
+#define DDR0_18_DLL_DQS_DELAY_3_MASK   0x007F0000
+#define DDR0_18_DLL_DQS_DELAY_3_ENCODE(n) ((((u32)(n))&0x7F)<<16)
+#define DDR0_18_DLL_DQS_DELAY_3_DECODE(n) ((((u32)(n))>>16)&0x7F)
+#define DDR0_18_DLL_DQS_DELAY_2_MASK   0x00007F00
+#define DDR0_18_DLL_DQS_DELAY_2_ENCODE(n) ((((u32)(n))&0x7F)<<8)
+#define DDR0_18_DLL_DQS_DELAY_2_DECODE(n) ((((u32)(n))>>8)&0x7F)
+#define DDR0_18_DLL_DQS_DELAY_1_MASK   0x0000007F
+#define DDR0_18_DLL_DQS_DELAY_1_ENCODE(n) ((((u32)(n))&0x7F)<<0)
+#define DDR0_18_DLL_DQS_DELAY_1_DECODE(n) ((((u32)(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) ((((u32)(n))&0x7F)<<24)
+#define DDR0_19_DLL_DQS_DELAY_8_DECODE(n) ((((u32)(n))>>24)&0x7F)
+#define DDR0_19_DLL_DQS_DELAY_7_MASK   0x007F0000
+#define DDR0_19_DLL_DQS_DELAY_7_ENCODE(n) ((((u32)(n))&0x7F)<<16)
+#define DDR0_19_DLL_DQS_DELAY_7_DECODE(n) ((((u32)(n))>>16)&0x7F)
+#define DDR0_19_DLL_DQS_DELAY_6_MASK   0x00007F00
+#define DDR0_19_DLL_DQS_DELAY_6_ENCODE(n) ((((u32)(n))&0x7F)<<8)
+#define DDR0_19_DLL_DQS_DELAY_6_DECODE(n) ((((u32)(n))>>8)&0x7F)
+#define DDR0_19_DLL_DQS_DELAY_5_MASK   0x0000007F
+#define DDR0_19_DLL_DQS_DELAY_5_ENCODE(n) ((((u32)(n))&0x7F)<<0)
+#define DDR0_19_DLL_DQS_DELAY_5_DECODE(n) ((((u32)(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) ((((u32)(n))&0x7F)<<24)
+#define DDR0_20_DLL_DQS_BYPASS_3_DECODE(n) ((((u32)(n))>>24)&0x7F)
+#define DDR0_20_DLL_DQS_BYPASS_2_MASK  0x007F0000
+#define DDR0_20_DLL_DQS_BYPASS_2_ENCODE(n) ((((u32)(n))&0x7F)<<16)
+#define DDR0_20_DLL_DQS_BYPASS_2_DECODE(n) ((((u32)(n))>>16)&0x7F)
+#define DDR0_20_DLL_DQS_BYPASS_1_MASK  0x00007F00
+#define DDR0_20_DLL_DQS_BYPASS_1_ENCODE(n) ((((u32)(n))&0x7F)<<8)
+#define DDR0_20_DLL_DQS_BYPASS_1_DECODE(n) ((((u32)(n))>>8)&0x7F)
+#define DDR0_20_DLL_DQS_BYPASS_0_MASK  0x0000007F
+#define DDR0_20_DLL_DQS_BYPASS_0_ENCODE(n) ((((u32)(n))&0x7F)<<0)
+#define DDR0_20_DLL_DQS_BYPASS_0_DECODE(n) ((((u32)(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) ((((u32)(n))&0x7F)<<24)
+#define DDR0_21_DLL_DQS_BYPASS_7_DECODE(n) ((((u32)(n))>>24)&0x7F)
+#define DDR0_21_DLL_DQS_BYPASS_6_MASK  0x007F0000
+#define DDR0_21_DLL_DQS_BYPASS_6_ENCODE(n) ((((u32)(n))&0x7F)<<16)
+#define DDR0_21_DLL_DQS_BYPASS_6_DECODE(n) ((((u32)(n))>>16)&0x7F)
+#define DDR0_21_DLL_DQS_BYPASS_5_MASK  0x00007F00
+#define DDR0_21_DLL_DQS_BYPASS_5_ENCODE(n) ((((u32)(n))&0x7F)<<8)
+#define DDR0_21_DLL_DQS_BYPASS_5_DECODE(n) ((((u32)(n))>>8)&0x7F)
+#define DDR0_21_DLL_DQS_BYPASS_4_MASK  0x0000007F
+#define DDR0_21_DLL_DQS_BYPASS_4_ENCODE(n) ((((u32)(n))&0x7F)<<0)
+#define DDR0_21_DLL_DQS_BYPASS_4_DECODE(n) ((((u32)(n))>>0)&0x7F)
+
+#define DDR0_22                                0x16
+#define DDR0_22_CTRL_RAW_MASK          0x03000000
+#define DDR0_22_CTRL_RAW_ECC_DISABLE   0x00000000
+#define DDR0_22_CTRL_RAW_ECC_CHECK_ONLY        0x01000000
+#define DDR0_22_CTRL_RAW_NO_ECC_RAM    0x02000000
+#define DDR0_22_CTRL_RAW_ECC_ENABLE    0x03000000
+#define DDR0_22_CTRL_RAW_ENCODE(n)     ((((u32)(n))&0x3)<<24)
+#define DDR0_22_CTRL_RAW_DECODE(n)     ((((u32)(n))>>24)&0x3)
+#define DDR0_22_DQS_OUT_SHIFT_BYPASS_MASK 0x007F0000
+#define DDR0_22_DQS_OUT_SHIFT_BYPASS_ENCODE(n) ((((u32)(n))&0x7F)<<16)
+#define DDR0_22_DQS_OUT_SHIFT_BYPASS_DECODE(n) ((((u32)(n))>>16)&0x7F)
+#define DDR0_22_DQS_OUT_SHIFT_MASK     0x00007F00
+#define DDR0_22_DQS_OUT_SHIFT_ENCODE(n)        ((((u32)(n))&0x7F)<<8)
+#define DDR0_22_DQS_OUT_SHIFT_DECODE(n)        ((((u32)(n))>>8)&0x7F)
+#define DDR0_22_DLL_DQS_BYPASS_8_MASK  0x0000007F
+#define DDR0_22_DLL_DQS_BYPASS_8_ENCODE(n) ((((u32)(n))&0x7F)<<0)
+#define DDR0_22_DLL_DQS_BYPASS_8_DECODE(n) ((((u32)(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) ((((u32)(n))&0x3)<<24)
+#define DDR0_23_ODT_RD_MAP_CS0_DECODE(n) ((((u32)(n))>>24)&0x3)
+#define DDR0_23_ECC_C_SYND_MASK                0x00FF0000      /* Read only */
+#define DDR0_23_ECC_C_SYND_ENCODE(n)   ((((u32)(n))&0xFF)<<16)
+#define DDR0_23_ECC_C_SYND_DECODE(n)   ((((u32)(n))>>16)&0xFF)
+#define DDR0_23_ECC_U_SYND_MASK                0x0000FF00      /* Read only */
+#define DDR0_23_ECC_U_SYND_ENCODE(n)   ((((u32)(n))&0xFF)<<8)
+#define DDR0_23_ECC_U_SYND_DECODE(n)   ((((u32)(n))>>8)&0xFF)
+#define DDR0_23_FWC_MASK               0x00000001      /* Write only */
+#define DDR0_23_FWC_ENCODE(n)          ((((u32)(n))&0x1)<<0)
+#define DDR0_23_FWC_DECODE(n)          ((((u32)(n))>>0)&0x1)
+
+#define DDR0_24                                0x18
+#define DDR0_24_RTT_PAD_TERMINATION_MASK 0x03000000
+#define DDR0_24_RTT_PAD_TERMINATION_ENCODE(n) ((((u32)(n))&0x3)<<24)
+#define DDR0_24_RTT_PAD_TERMINATION_DECODE(n) ((((u32)(n))>>24)&0x3)
+#define DDR0_24_ODT_WR_MAP_CS1_MASK    0x00030000
+#define DDR0_24_ODT_WR_MAP_CS1_ENCODE(n) ((((u32)(n))&0x3)<<16)
+#define DDR0_24_ODT_WR_MAP_CS1_DECODE(n) ((((u32)(n))>>16)&0x3)
+#define DDR0_24_ODT_RD_MAP_CS1_MASK    0x00000300
+#define DDR0_24_ODT_RD_MAP_CS1_ENCODE(n) ((((u32)(n))&0x3)<<8)
+#define DDR0_24_ODT_RD_MAP_CS1_DECODE(n) ((((u32)(n))>>8)&0x3)
+#define DDR0_24_ODT_WR_MAP_CS0_MASK    0x00000003
+#define DDR0_24_ODT_WR_MAP_CS0_ENCODE(n) ((((u32)(n))&0x3)<<0)
+#define DDR0_24_ODT_WR_MAP_CS0_DECODE(n) ((((u32)(n))>>0)&0x3)
+
+#define DDR0_25                                0x19
+#define DDR0_25_VERSION_MASK           0xFFFF0000      /* Read only */
+#define DDR0_25_VERSION_ENCODE(n)      ((((u32)(n))&0xFFFF)<<16)
+#define DDR0_25_VERSION_DECODE(n)      ((((u32)(n))>>16)&0xFFFF)
+#define DDR0_25_OUT_OF_RANGE_LENGTH_MASK  0x000003FF   /* Read only */
+#define DDR0_25_OUT_OF_RANGE_LENGTH_ENCODE(n) ((((u32)(n))&0x3FF)<<0)
+#define DDR0_25_OUT_OF_RANGE_LENGTH_DECODE(n) ((((u32)(n))>>0)&0x3FF)
+
+#define DDR0_26                                0x1A
+#define DDR0_26_TRAS_MAX_MASK          0xFFFF0000
+#define DDR0_26_TRAS_MAX_ENCODE(n)     ((((u32)(n))&0xFFFF)<<16)
+#define DDR0_26_TRAS_MAX_DECODE(n)     ((((u32)(n))>>16)&0xFFFF)
+#define DDR0_26_TREF_MASK              0x00003FFF
+#define DDR0_26_TREF_ENCODE(n)         ((((u32)(n))&0x3FFF)<<0)
+#define DDR0_26_TREF_DECODE(n)         ((((u32)(n))>>0)&0x3FFF)
+
+#define DDR0_27                                0x1B
+#define DDR0_27_EMRS_DATA_MASK         0x3FFF0000
+#define DDR0_27_EMRS_DATA_ENCODE(n)    ((((u32)(n))&0x3FFF)<<16)
+#define DDR0_27_EMRS_DATA_DECODE(n)    ((((u32)(n))>>16)&0x3FFF)
+#define DDR0_27_TINIT_MASK             0x0000FFFF
+#define DDR0_27_TINIT_ENCODE(n)                ((((u32)(n))&0xFFFF)<<0)
+#define DDR0_27_TINIT_DECODE(n)                ((((u32)(n))>>0)&0xFFFF)
+
+#define DDR0_28                                0x1C
+#define DDR0_28_EMRS3_DATA_MASK                0x3FFF0000
+#define DDR0_28_EMRS3_DATA_ENCODE(n)   ((((u32)(n))&0x3FFF)<<16)
+#define DDR0_28_EMRS3_DATA_DECODE(n)   ((((u32)(n))>>16)&0x3FFF)
+#define DDR0_28_EMRS2_DATA_MASK                0x00003FFF
+#define DDR0_28_EMRS2_DATA_ENCODE(n)   ((((u32)(n))&0x3FFF)<<0)
+#define DDR0_28_EMRS2_DATA_DECODE(n)   ((((u32)(n))>>0)&0x3FFF)
+
+#define DDR0_31                                0x1F
+#define DDR0_31_XOR_CHECK_BITS_MASK    0x0000FFFF
+#define DDR0_31_XOR_CHECK_BITS_ENCODE(n) ((((u32)(n))&0xFFFF)<<0)
+#define DDR0_31_XOR_CHECK_BITS_DECODE(n) ((((u32)(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) ((((u32)(n))&0xFFFFFFFF)<<0)
+#define DDR0_32_OUT_OF_RANGE_ADDR_DECODE(n) ((((u32)(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) ((((u32)(n))&0x1)<<0)
+#define DDR0_33_OUT_OF_RANGE_ADDR_DECODE(n) ((((u32)(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)   ((((u32)(n))&0xFFFFFFFF)<<0)
+#define DDR0_34_ECC_U_ADDR_DECODE(n)   ((((u32)(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)   ((((u32)(n))&0x1)<<0)
+#define DDR0_35_ECC_U_ADDR_DECODE(n)   ((((u32)(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)   ((((u32)(n))&0xFFFFFFFF)<<0)
+#define DDR0_36_ECC_U_DATA_DECODE(n)   ((((u32)(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)   ((((u32)(n))&0xFFFFFFFF)<<0)
+#define DDR0_37_ECC_U_DATA_DECODE(n)   ((((u32)(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)   ((((u32)(n))&0xFFFFFFFF)<<0)
+#define DDR0_38_ECC_C_ADDR_DECODE(n)   ((((u32)(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)   ((((u32)(n))&0x1)<<0)
+#define DDR0_39_ECC_C_ADDR_DECODE(n)   ((((u32)(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)   ((((u32)(n))&0xFFFFFFFF)<<0)
+#define DDR0_40_ECC_C_DATA_DECODE(n)   ((((u32)(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)   ((((u32)(n))&0xFFFFFFFF)<<0)
+#define DDR0_41_ECC_C_DATA_DECODE(n)   ((((u32)(n))>>0)&0xFFFFFFFF)
+
+#define DDR0_42                                0x2A
+#define DDR0_42_ADDR_PINS_MASK         0x07000000
+#define DDR0_42_ADDR_PINS_ENCODE(n)    ((((u32)(n))&0x7)<<24)
+#define DDR0_42_ADDR_PINS_DECODE(n)    ((((u32)(n))>>24)&0x7)
+#define DDR0_42_CASLAT_LIN_GATE_MASK   0x0000000F
+#define DDR0_42_CASLAT_LIN_GATE_ENCODE(n) ((((u32)(n))&0xF)<<0)
+#define DDR0_42_CASLAT_LIN_GATE_DECODE(n) ((((u32)(n))>>0)&0xF)
+
+#define DDR0_43                                0x2B
+#define DDR0_43_TWR_MASK               0x07000000
+#define DDR0_43_TWR_ENCODE(n)          ((((u32)(n))&0x7)<<24)
+#define DDR0_43_TWR_DECODE(n)          ((((u32)(n))>>24)&0x7)
+#define DDR0_43_APREBIT_MASK           0x000F0000
+#define DDR0_43_APREBIT_ENCODE(n)      ((((u32)(n))&0xF)<<16)
+#define DDR0_43_APREBIT_DECODE(n)      ((((u32)(n))>>16)&0xF)
+#define DDR0_43_COLUMN_SIZE_MASK       0x00000700
+#define DDR0_43_COLUMN_SIZE_ENCODE(n)  ((((u32)(n))&0x7)<<8)
+#define DDR0_43_COLUMN_SIZE_DECODE(n)  ((((u32)(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) ((((u32)(n))&0x1)<<0)
+#define DDR0_43_EIGHT_BANK_MODE_DECODE(n) ((((u32)(n))>>0)&0x1)
+
+#define DDR0_44                                0x2C
+#define DDR0_44_TRCD_MASK              0x000000FF
+#define DDR0_44_TRCD_ENCODE(n)         ((((u32)(n))&0xFF)<<0)
+#define DDR0_44_TRCD_DECODE(n)         ((((u32)(n))>>0)&0xFF)
+
+#endif /* CONFIG_SDRAM_PPC4xx_DENALI_DDR2 */
+
+#endif /* _PPC4xx_SDRAM_H_ */
index 8bdfb9ddf3938269f211b6f0c8f5db3741857b16..139e6869df767f1ae0ca39508a76a74914f28624 100644 (file)
 #define SPRN_PID2      0x27a   /* Process ID Register 2 */
 #define SPRN_MCSR      0x23c   /* Machine Check Syndrome register */
 #define SPRN_MCAR      0x23d   /* Machine Check Address register */
-#ifdef CONFIG_440
 #define MCSR_MCS       0x80000000      /* Machine Check Summary */
 #define MCSR_IB                0x40000000      /* Instruction PLB Error */
+#if defined(CONFIG_440)
 #define MCSR_DRB       0x20000000      /* Data Read PLB Error */
 #define MCSR_DWB       0x10000000      /* Data Write PLB Error */
+#else
+#define MCSR_DB                0x20000000      /* Data PLB Error */
+#endif /* defined(CONFIG_440) */
 #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)
@@ -960,6 +962,17 @@ n:
 #define SR15   15
 
 #ifndef __ASSEMBLY__
+
+struct cpu_type {
+       char name[15];
+       u32 soc_ver;
+};
+
+struct cpu_type *identify_cpu(uint ver);
+
+#define CPU_TYPE_ENTRY(n, v) \
+       { .name = #n, .soc_ver = SVR_##v, }
+
 #ifndef CONFIG_MACH_SPECIFIC
 extern int _machine;
 extern int have_of;
index b248639fd0d2ebac843c7b1969152f757b7b3bcd..fd49f569aeb90bd67234911f8fc65385505096b1 100644 (file)
 #define CONFIG_CMD_FAT
 #define CONFIG_CMD_ELF
 #define CONFIG_CMD_DATE
-#define CONFIG_CMD_JFFS2
 #define CONFIG_CMD_I2C
 #define CONFIG_CMD_MII
 #define CONFIG_CMD_PING
 #define CONFIG_CMD_BSP
 #define CONFIG_CMD_EEPROM
 
-
-#if 0 /* test-only */
-#define CONFIG_NETCONSOLE
-#define CONFIG_NET_MULTI
-
-#ifdef CONFIG_NET_MULTI
-#define CONFIG_PHY1_ADDR       1       /* PHY address: for NetConsole  */
-#endif
-#endif
-
 #define CONFIG_MAC_PARTITION
 #define CONFIG_DOS_PARTITION
 
 #define CONFIG_SUPPORT_VFAT
 
-#if 0 /* test-only */
-#define CONFIG_AUTO_UPDATE      1       /* autoupdate via compactflash  */
-#endif
-
 #undef CONFIG_WATCHDOG                 /* watchdog disabled            */
 
 #define CONFIG_SDRAM_BANK0     1       /* init onboard SDRAM bank 0    */
 
 #define CFG_FLASH_EMPTY_INFO           /* print 'E' for empty sector on flinfo */
 
-
-/*
- * JFFS2 partitions
- */
-
-/* No command line, one static partition, use whole device */
-#undef CONFIG_JFFS2_CMDLINE
-#define CONFIG_JFFS2_DEV               "nor0"
-#define CONFIG_JFFS2_PART_SIZE         0xFFFFFFFF
-#define CONFIG_JFFS2_PART_OFFSET       0x00000000
-
-/* mtdparts command line support */
-
-/* Use first bank for JFFS2, second bank contains U-Boot.
- *
- * Note: fake mtd_id's used, no linux mtd map file.
- */
-/*
-#define CONFIG_JFFS2_CMDLINE
-#define MTDIDS_DEFAULT         "nor0=cpci4052-0"
-#define MTDPARTS_DEFAULT       "mtdparts=cpci4052-0:-(jffs2)"
-*/
-
 #if 0 /* Use NVRAM for environment variables */
 /*-----------------------------------------------------------------------
  * NVRAM organization
index 1e9597dc619420bb4fb92ae8930c77f6e34cf864..55dd6296de045200c45ecc7e69c8573c9b87dfa0 100644 (file)
@@ -88,7 +88,6 @@
 #define CONFIG_CMD_FAT
 #define CONFIG_CMD_ELF
 #define CONFIG_CMD_DATE
-#define CONFIG_CMD_JFFS2
 #define CONFIG_CMD_I2C
 #define CONFIG_CMD_MII
 #define CONFIG_CMD_PING
 
 #define CFG_FLASH_EMPTY_INFO           /* print 'E' for empty sector on flinfo */
 
-/*
- * JFFS2 partitions
- */
-/* No command line, one static partition */
-#undef CONFIG_JFFS2_CMDLINE
-#define CONFIG_JFFS2_DEV               "nor0"
-#define CONFIG_JFFS2_PART_SIZE         0xFFFFFFFF
-#define CONFIG_JFFS2_PART_OFFSET       0x00000000
-
-/* mtdparts command line support */
-
-/* Use first bank for JFFS2, second bank contains U-Boot.
- *
- * Note: fake mtd_id's used, no linux mtd map file.
- */
-/*
-#define CONFIG_JFFS2_CMDLINE
-#define MTDIDS_DEFAULT         "nor0=cpci405ab-0"
-#define MTDPARTS_DEFAULT       "mtdparts=cpci405ab-0:-(jffs2)"
-*/
-
 /*-----------------------------------------------------------------------
  * I2C EEPROM (CAT24WC32) for environment
  */
index a8029eae9d18fb43d7f0f6f54f204cac85e3ce74..6b585bed5f719ef844ab1f75e0c68ee2708d2ba5 100644 (file)
 #define CONFIG_CMD_FAT
 #define CONFIG_CMD_ELF
 #define CONFIG_CMD_DATE
-#define CONFIG_CMD_JFFS2
 #define CONFIG_CMD_I2C
 #define CONFIG_CMD_MII
 #define CONFIG_CMD_PING
 #define CONFIG_CMD_BSP
 #define CONFIG_CMD_EEPROM
 
-
-#if 0 /* test-only */
-#define CONFIG_NETCONSOLE
-#define CONFIG_NET_MULTI
-
-#ifdef CONFIG_NET_MULTI
-#define CONFIG_PHY1_ADDR       1       /* PHY address: for NetConsole  */
-#endif
-#endif
-
 #define CONFIG_MAC_PARTITION
 #define CONFIG_DOS_PARTITION
 
 
 #define CFG_FLASH_EMPTY_INFO           /* print 'E' for empty sector on flinfo */
 
-/*
- * JFFS2 partitions
- */
-/* No command line, one static partition */
-#undef CONFIG_JFFS2_CMDLINE
-#define CONFIG_JFFS2_DEV               "nor0"
-#define CONFIG_JFFS2_PART_SIZE         0xFFFFFFFF
-#define CONFIG_JFFS2_PART_OFFSET       0x00000000
-
-/* mtdparts command line support */
-
-/* Use first bank for JFFS2, second bank contains U-Boot.
- *
- * Note: fake mtd_id's used, no linux mtd map file.
- */
-/*
-#define CONFIG_JFFS2_CMDLINE
-#define MTDIDS_DEFAULT         "nor0=cpci405dt-0"
-#define MTDPARTS_DEFAULT       "mtdparts=cpci405dt-0:-(jffs2)"
-*/
-
 #if 0 /* Use NVRAM for environment variables */
 /*-----------------------------------------------------------------------
  * NVRAM organization
 #define CFG_GBL_DATA_OFFSET    (CFG_INIT_RAM_END - CFG_GBL_DATA_SIZE)
 #define CFG_INIT_SP_OFFSET     CFG_GBL_DATA_OFFSET
 
-
 /*
  * Internal Definitions
  *
index 7a5d0aa1dde27d54114ee5e58c8c6cca004bb378..095f6658c1f06018ffd66f05350cd70605c6b6ca 100644 (file)
 #define CFG_OR0_PRELIM         ( (~(CFG_FLASH_SIZE - 1) << 20) \
                                | OR_UPM_XAM \
                                | OR_GPCM_CSNT \
-                               | OR_GPCM_ACS_0b11 \
+                               | OR_GPCM_ACS_DIV2 \
                                | OR_GPCM_XACS \
                                | OR_GPCM_SCY_15 \
                                | OR_GPCM_TRLX \
index bd775400032d36d383491c0846b6593b03da2bc4..37e3ca40b3f52c3ec57d2b57c807a764c8ac7aa4 100644 (file)
                                (2 << BR_PS_SHIFT) |    /* 16 bit port size */   \
                                BR_V)                   /* valid */
 #define CFG_OR0_PRELIM         ((~(CFG_FLASH_SIZE - 1) << 20) | OR_UPM_XAM | \
-                               OR_GPCM_CSNT | OR_GPCM_ACS_0b11 | OR_GPCM_XACS | OR_GPCM_SCY_15 | \
+                               OR_GPCM_CSNT | OR_GPCM_ACS_DIV2 | OR_GPCM_XACS | OR_GPCM_SCY_15 | \
                                OR_GPCM_TRLX | OR_GPCM_EHTR | OR_GPCM_EAD)
 #define CFG_LBLAWBAR0_PRELIM   CFG_FLASH_BASE  /* window base at flash base */
 #define CFG_LBLAWAR0_PRELIM    0x80000018      /* 32 MB window size */
index 38410a1764ce80fcff596b13fbb3a543cc8c8b67..82d06867be791c2fa87081620266dc4f2921289d 100644 (file)
@@ -211,7 +211,7 @@ boards, we say we have two, but don't display a message if we find only one. */
 
 #define CFG_BR0_PRELIM         (CFG_FLASH_BASE | BR_PS_16 | BR_V)
 #define CFG_OR0_PRELIM         ((~(CFG_FLASH_SIZE - 1) << 20) | OR_UPM_XAM | \
-                               OR_GPCM_CSNT | OR_GPCM_ACS_0b11 | OR_GPCM_XACS | OR_GPCM_SCY_15 | \
+                               OR_GPCM_CSNT | OR_GPCM_ACS_DIV2 | OR_GPCM_XACS | OR_GPCM_SCY_15 | \
                                OR_GPCM_TRLX | OR_GPCM_EHTR | OR_GPCM_EAD)
 #define CFG_LBLAWBAR0_PRELIM   CFG_FLASH_BASE
 #define CFG_LBLAWAR0_PRELIM    (LBLAWAR_EN | (0x13 + CFG_FLASH_SIZE_SHIFT))
@@ -236,7 +236,7 @@ boards, we say we have two, but don't display a message if we find only one. */
 
 #define CFG_LED_BASE           0xF9000000
 #define CFG_BR2_PRELIM         (CFG_LED_BASE | BR_PS_8 | BR_V)
-#define CFG_OR2_PRELIM         (OR_AM_2MB | OR_GPCM_CSNT | OR_GPCM_ACS_0b11 | \
+#define CFG_OR2_PRELIM         (OR_AM_2MB | OR_GPCM_CSNT | OR_GPCM_ACS_DIV2 | \
                                OR_GPCM_XACS | OR_GPCM_SCY_9 | OR_GPCM_TRLX | \
                                OR_GPCM_EHTR | OR_GPCM_EAD)
 
index fcfbe6f82199734ee2578325536e92b6e835cfc1..b4bff9a2be38e286f86aa0962bbe7c13c767f08b 100644 (file)
                        (2 << BR_PS_SHIFT) | /* 16 bit port size */ \
                        BR_V)   /* valid */
 #define CFG_OR0_PRELIM         ((~(CFG_FLASH_SIZE - 1) << 20) | OR_UPM_XAM | \
-                               OR_GPCM_CSNT | OR_GPCM_ACS_0b11 | OR_GPCM_XACS | OR_GPCM_SCY_15 | \
+                               OR_GPCM_CSNT | OR_GPCM_ACS_DIV2 | OR_GPCM_XACS | OR_GPCM_SCY_15 | \
                                OR_GPCM_TRLX | OR_GPCM_EHTR | OR_GPCM_EAD)
 
 #define CFG_MAX_FLASH_BANKS    1 /* number of banks */
index adedcb95af6010469ee7828034eafad5e8a424ea..ca8d53cf25303fb42ac1a9cec272dcd5de87b4e1 100644 (file)
                        (2 << BR_PS_SHIFT) | /* 16 bit port size */ \
                        BR_V)   /* valid */
 #define CFG_OR0_PRELIM         ((~(CFG_FLASH_SIZE - 1) << 20) | OR_UPM_XAM | \
-                               OR_GPCM_CSNT | OR_GPCM_ACS_0b11 | \
+                               OR_GPCM_CSNT | OR_GPCM_ACS_DIV2 | \
                                OR_GPCM_XACS | OR_GPCM_SCY_15 | \
                                OR_GPCM_TRLX | OR_GPCM_EHTR | OR_GPCM_EAD)
 
index 4e159a0b462715411d8b8d3994aeb667dbe00077..0dd02795a628ba40924004453d8fc2d004636517 100644 (file)
 #define CFG_OR0_PRELIM         ( (~(CFG_FLASH_SIZE - 1) << 20) \
                                | OR_UPM_XAM \
                                | OR_GPCM_CSNT \
-                               | OR_GPCM_ACS_0b11 \
+                               | OR_GPCM_ACS_DIV2 \
                                | OR_GPCM_XACS \
                                | OR_GPCM_SCY_15 \
                                | OR_GPCM_TRLX \
index 57197598086f3de2c79ac419a6b539571d7723ec..d1d3cc360692f02e3ead3714c44150f24d0ce4ac 100644 (file)
@@ -87,9 +87,6 @@
 #define CONFIG_BTB                     /* toggle branch predition */
 #define CONFIG_ADDR_STREAMING          /* toggle addr streaming */
 
-#define CONFIG_BOARD_EARLY_INIT_F      1       /* Call board_pre_init */
-
-#undef CFG_DRAM_TEST                   /* memory test, takes time */
 #define CFG_MEMTEST_START      0x00200000      /* memtest region */
 #define CFG_MEMTEST_END                0x00400000
 
index 5b3ea05e6396068359a137a2130da46a1f5bd252..a64565db931f5c2ecda6647c2f48361415ea6d6c 100644 (file)
@@ -73,9 +73,6 @@ extern unsigned long get_clock_freq(void);
 #define CONFIG_BTB                         /* toggle branch predition */
 #define CONFIG_ADDR_STREAMING              /* toggle addr streaming   */
 
-#define CONFIG_BOARD_EARLY_INIT_F      1       /* Call board_pre_init */
-
-#undef CFG_DRAM_TEST                   /* memory test, takes time */
 #define CFG_MEMTEST_START      0x00200000      /* memtest works on */
 #define CFG_MEMTEST_END                0x00400000
 
index ffe9e0089d2239b7d1a6cac1e4ddd4b34efad6d9..669f4d7c8b9aedc1ac87f230ddfbd30235b19167 100644 (file)
@@ -77,19 +77,14 @@ extern unsigned long get_board_sys_clk(unsigned long dummy);
 #define CONFIG_L2_CACHE                        /* toggle L2 cache */
 #define CONFIG_BTB                     /* toggle branch predition */
 #define CONFIG_ADDR_STREAMING          /* toggle addr streaming */
-#define CONFIG_CLEAR_LAW0              /* Clear LAW0 in cpu_init_r */
 
 /*
  * Only possible on E500 Version 2 or newer cores.
  */
 #define CONFIG_ENABLE_36BIT_PHYS       1
 
-#define CONFIG_BOARD_EARLY_INIT_F      1       /* Call board_pre_init */
-
-#undef CFG_DRAM_TEST                   /* memory test, takes time */
 #define CFG_MEMTEST_START      0x00200000      /* memtest works on */
 #define CFG_MEMTEST_END                0x00400000
-#define CFG_ALT_MEMTEST
 #define CONFIG_PANIC_HANG      /* do not reset board on panic */
 
 /*
@@ -171,6 +166,7 @@ extern unsigned long get_board_sys_clk(unsigned long dummy);
 #undef CFG_FLASH_CHECKSUM
 #define CFG_FLASH_ERASE_TOUT   60000           /* Flash Erase Timeout (ms) */
 #define CFG_FLASH_WRITE_TOUT   500             /* Flash Write Timeout (ms) */
+#define CONFIG_FLASH_SHOW_PROGRESS 45 /* count down from 45/5: 9..1 */
 
 #define CFG_MONITOR_BASE       TEXT_BASE       /* start of monitor */
 
index fc8ad8813feeea30f179990fab802a8784736b2b..acf6f0dce6a2d2cb00dbe4ddf92dc0a389a58673 100644 (file)
@@ -87,9 +87,6 @@ extern unsigned long get_clock_freq(void);
  */
 #define CONFIG_ENABLE_36BIT_PHYS       1
 
-#define CONFIG_BOARD_EARLY_INIT_F      1       /* Call board_pre_init */
-
-#undef CFG_DRAM_TEST                   /* memory test, takes time */
 #define CFG_MEMTEST_START      0x00200000      /* memtest works on */
 #define CFG_MEMTEST_END                0x00400000
 
index e8383455c404968c7891dc203771ed6815eddae4..1948c0d276fd1eb0a16d7cdcf1eac6e7be1c6b32 100644 (file)
@@ -73,9 +73,6 @@ extern unsigned long get_clock_freq(void);
 #define CONFIG_BTB                         /* toggle branch predition */
 #define CONFIG_ADDR_STREAMING              /* toggle addr streaming   */
 
-#define CONFIG_BOARD_EARLY_INIT_F      1       /* Call board_pre_init */
-
-#undef CFG_DRAM_TEST                   /* memory test, takes time */
 #define CFG_MEMTEST_START      0x00200000      /* memtest works on */
 #define CFG_MEMTEST_END                0x00400000
 
index 9c95cc6567da72a5e31251f7396d95c07c67b446..edf8525179c08d74811b8689c885543843e78e88 100644 (file)
@@ -40,6 +40,7 @@
 #define CONFIG_MPC85xx         1       /* MPC8540/MPC8560 */
 #define CONFIG_CPM2            1       /* has CPM2 */
 #define CONFIG_MPC8560ADS      1       /* MPC8560ADS board specific */
+#define CONFIG_MPC8560         1
 
 #define CONFIG_PCI
 #define CONFIG_TSEC_ENET               /* tsec ethernet support */
 #define CONFIG_BTB                     /* toggle branch predition */
 #define CONFIG_ADDR_STREAMING          /* toggle addr streaming */
 
-#define CONFIG_BOARD_EARLY_INIT_F      1       /* Call board_pre_init */
-
 #define CFG_INIT_DBCR DBCR_IDM         /* Enable Debug Exceptions */
 
-#undef CFG_DRAM_TEST                   /* memory test, takes time */
 #define CFG_MEMTEST_START      0x00200000      /* memtest region */
 #define CFG_MEMTEST_END                0x00400000
 
index a7c69d293caf922b0146ae9b50c37001c3e0c036..9e6bb44ff925f93a529b6c4d9acc531858a22d8a 100644 (file)
@@ -80,7 +80,6 @@ extern unsigned long get_clock_freq(void);
 
 #define CONFIG_BOARD_EARLY_INIT_F      1       /* Call board_pre_init */
 
-#undef CFG_DRAM_TEST                   /* memory test, takes time */
 #define CFG_MEMTEST_START      0x00200000      /* memtest works on */
 #define CFG_MEMTEST_END                0x00400000
 
index a051b6d39bf64ab79faf36bca9b43a370773c4a1..fc168909e717c8d4cf65580207650c474a5ff262 100644 (file)
 #define CONFIG_BOARD_EARLY_INIT_F      1       /* Call board_pre_init */
 #define CONFIG_MISC_INIT_R             1
 
-#undef CFG_DRAM_TEST                   /* memory test, takes time */
 #define CFG_MEMTEST_START      0x00200000      /* memtest region */
 #define CFG_MEMTEST_END                0x00400000
-#define CFG_ALT_MEMTEST
 
 /*
  * Base addresses -- Note these are effective addresses where the
index 49ee7ffd3a2568d65e3f5000e96ebc5eed3e91e1..455e154222be31eacce44f511eeab8aa2294cd0b 100644 (file)
@@ -87,7 +87,6 @@ extern unsigned long get_board_sys_clk(unsigned long dummy);
 
 #define CONFIG_BOARD_EARLY_INIT_F      1       /* Call board_pre_init */
 
-#undef CFG_DRAM_TEST                   /* memory test, takes time */
 #define CFG_MEMTEST_START      0x00200000      /* memtest region */
 #define CFG_MEMTEST_END                0x00400000
 
diff --git a/include/configs/MVBLM7.h b/include/configs/MVBLM7.h
new file mode 100644 (file)
index 0000000..349ca14
--- /dev/null
@@ -0,0 +1,479 @@
+/*
+ * Copyright (C) Matrix Vision GmbH 2008
+ *
+ * Matrix Vision mvBlueLYNX-M7 configuration file
+ * based on Freescale's MPC8349ITX.
+ *
+ * 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
+
+#define MV_VERSION  "v1.0.1"
+
+/*
+ * High Level Configuration Options
+ */
+#define CONFIG_E300    1
+#define CONFIG_MPC83XX 1
+#define CONFIG_MPC834X 1
+#define CONFIG_MPC8343 1
+
+#define CFG_IMMR               0xE0000000
+
+#define CONFIG_PCI
+#define CONFIG_83XX_GENERIC_PCI
+#define CONFIG_PCI_SKIP_HOST_BRIDGE
+#define CONFIG_HARD_I2C
+#define CONFIG_TSEC_ENET
+#define CONFIG_MPC8XXX_SPI
+#define CONFIG_HARD_SPI
+#define MVBLM7_MMC_CS   0x04000000
+
+/* I2C */
+#undef CONFIG_SOFT_I2C
+
+#define CONFIG_FSL_I2C
+#define CONFIG_I2C_MULTI_BUS
+#define CONFIG_I2C_CMD_TREE
+#define CFG_I2C_OFFSET         0x3000
+#define CFG_I2C2_OFFSET                0x3100
+
+#define CFG_I2C_SPEED          100000
+#define CFG_I2C_SLAVE          0x7F
+
+/*
+ * DDR Setup
+ */
+#define CFG_DDR_BASE           0x00000000
+#define CFG_SDRAM_BASE         CFG_DDR_BASE
+#define CFG_DDR_SDRAM_BASE     CFG_DDR_BASE
+#define CFG_83XX_DDR_USES_CS0  1
+#define CFG_MEMTEST_START      (60<<20)
+#define CFG_MEMTEST_END                (70<<20)
+
+#define CFG_DDR_SDRAM_CLK_CNTL (DDR_SDRAM_CLK_CNTL_SS_EN | \
+                               DDR_SDRAM_CLK_CNTL_CLK_ADJUST_05
+
+#define CFG_DDR_SIZE           256
+
+/* HC, 75Ohm, DDR-II, DRQ */
+#define CFG_DDRCDR             0x80000001
+/* EN, ODT_WR, 3BA, 14row, 10col */
+#define CFG_DDR_CS0_CONFIG     0x80014102
+#define CFG_DDR_CS1_CONFIG     0x0
+#define CFG_DDR_CS2_CONFIG     0x0
+#define CFG_DDR_CS3_CONFIG     0x0
+
+#define CFG_DDR_CS0_BNDS       0x0000000f
+#define CFG_DDR_CS1_BNDS       0x0
+#define CFG_DDR_CS2_BNDS       0x0
+#define CFG_DDR_CS3_BNDS       0x0
+
+#define CFG_DDR_CLK_CNTL       0x02000000
+
+#define CFG_DDR_TIMING_0       0x00260802
+#define CFG_DDR_TIMING_1       0x2625b221
+#define CFG_DDR_TIMING_2       0x1f9820c7
+#define CFG_DDR_TIMING_3       0x00000000
+
+/* ~MEM_EN, SREN, DDR-II, 32_BE */
+#define CFG_DDR_SDRAM_CFG      0x43080000
+#define CFG_DDR_SDRAM_CFG2     0x00401000
+#define CFG_DDR_INTERVAL       0x04060100
+
+#define CFG_DDR_MODE           0x078e0232
+
+/* Flash */
+#define CFG_FLASH_CFI
+#define CFG_FLASH_CFI_DRIVER
+#define CFG_FLASH_CFI_WIDTH    FLASH_CFI_16BIT
+
+#define CFG_FLASH_BASE         0xFF800000
+#define CFG_FLASH_SIZE         8
+#define CFG_FLASH_SIZE_SHIFT   3
+#define CFG_FLASH_EMPTY_INFO
+#define CFG_FLASH_ERASE_TOUT   60000
+#define CFG_FLASH_WRITE_TOUT   500
+#define CFG_MAX_FLASH_BANKS    1
+#define CFG_MAX_FLASH_SECT     256
+
+#define CFG_BR0_PRELIM         (CFG_FLASH_BASE | BR_PS_16 | BR_V)
+#define CFG_OR0_PRELIM         ((~(CFG_FLASH_SIZE - 1) << 20) | OR_UPM_XAM |  \
+                               OR_GPCM_CSNT | OR_GPCM_ACS_DIV2 | OR_GPCM_XACS|\
+                               OR_GPCM_SCY_15 | OR_GPCM_TRLX | OR_GPCM_EHTR | \
+                               OR_GPCM_EAD)
+#define CFG_LBLAWBAR0_PRELIM   CFG_FLASH_BASE
+#define CFG_LBLAWAR0_PRELIM    (LBLAWAR_EN | (0x13 + CFG_FLASH_SIZE_SHIFT))
+
+/*
+ * U-Boot memory configuration
+ */
+#define CFG_MONITOR_BASE       TEXT_BASE
+#undef CFG_RAMBOOT
+
+#define CONFIG_L1_INIT_RAM
+#define CFG_INIT_RAM_LOCK
+#define CFG_INIT_RAM_ADDR      0xFD000000      /* Initial RAM address */
+#define CFG_INIT_RAM_END       0x1000          /* End of used area in RAM*/
+
+#define CFG_GBL_DATA_SIZE      0x100           /* 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
+
+/* CFG_MONITOR_LEN must be a multiple of CFG_ENV_SECT_SIZE */
+#define CFG_MONITOR_LEN                (512 * 1024)
+#define CFG_MALLOC_LEN         (512 * 1024)
+
+/*
+ * Local Bus LCRR and LBCR regs
+ *  LCRR:  DLL bypass, Clock divider is 4
+ * External Local Bus rate is
+ *  CLKIN * HRCWL_CSB_TO_CLKIN / HRCWL_LCL_BUS_TO_SCB_CLK / LCRR_CLKDIV
+ */
+#define CFG_LCRR       (LCRR_DBYP | LCRR_CLKDIV_4)
+#define CFG_LBC_LBCR   0x00000000
+
+/* LB sdram refresh timer, about 6us */
+#define CFG_LBC_LSRT   0x32000000
+/* LB refresh timer prescal, 266MHz/32*/
+#define CFG_LBC_MRTPR  0x20000000
+
+/*
+ * Serial Port
+ */
+#define CONFIG_CONS_INDEX      1
+#undef CONFIG_SERIAL_SOFTWARE_FIFO
+#define CFG_NS16550
+#define CFG_NS16550_SERIAL
+#define CFG_NS16550_REG_SIZE   1
+#define CFG_NS16550_CLK                get_bus_freq(0)
+
+#define CFG_BAUDRATE_TABLE  \
+       {300, 600, 1200, 2400, 4800, 9600, 19200, 38400, 115200}
+
+#define CONFIG_CONSOLE         ttyS0
+#define CONFIG_BAUDRATE                115200
+
+#define CFG_NS16550_COM1       (CFG_IMMR + 0x4500)
+#define CFG_NS16550_COM2       (CFG_IMMR + 0x4600)
+
+/* pass open firmware flat tree */
+#define CONFIG_OF_LIBFDT               1
+#define CONFIG_OF_BOARD_SETUP          1
+#define CONFIG_OF_STDOUT_VIA_ALIAS     1
+#define MV_DTB_NAME    "mvblm7.dtb"
+
+/*
+ * PCI
+ */
+#define CFG_PCI1_MEM_BASE      0x80000000
+#define CFG_PCI1_MEM_PHYS      CFG_PCI1_MEM_BASE
+#define CFG_PCI1_MEM_SIZE      0x10000000
+#define CFG_PCI1_MMIO_BASE     (CFG_PCI1_MEM_BASE + CFG_PCI1_MEM_SIZE)
+#define CFG_PCI1_MMIO_PHYS     CFG_PCI1_MMIO_BASE
+#define CFG_PCI1_MMIO_SIZE     0x10000000
+#define CFG_PCI1_IO_BASE       0x00000000
+#define CFG_PCI1_IO_PHYS       0xE2000000
+#define CFG_PCI1_IO_SIZE       0x01000000
+
+#define _IO_BASE               0x00000000
+
+#define CONFIG_NET_MULTI       1
+#define CONFIG_NET_RETRY_COUNT 3
+
+#define PCI_66M
+#define CONFIG_83XX_CLKIN      66666667
+#define CONFIG_PCI_PNP
+#define CONFIG_PCI_SCAN_SHOW
+
+/* TSEC */
+#define CONFIG_GMII
+#define CFG_VSC8601_SKEWFIX
+#define        CFG_VSC8601_SKEW_TX     3
+#define        CFG_VSC8601_SKEW_RX     3
+
+#define CONFIG_TSEC1
+#define CONFIG_TSEC2
+
+#define CONFIG_HAS_ETH0
+#define CONFIG_TSEC1_NAME      "TSEC0"
+#define CONFIG_FEC1_PHY_NORXERR
+#define CFG_TSEC1_OFFSET       0x24000
+#define CFG_TSEC1              (CFG_IMMR+CFG_TSEC1_OFFSET)
+#define TSEC1_PHY_ADDR         0x10
+#define TSEC1_PHYIDX           0
+#define TSEC1_FLAGS            (TSEC_GIGABIT|TSEC_REDUCED)
+
+#define CONFIG_HAS_ETH1
+#define CONFIG_TSEC2_NAME      "TSEC1"
+#define CONFIG_FEC2_PHY_NORXERR
+#define CFG_TSEC2_OFFSET       0x25000
+#define CFG_TSEC2              (CFG_IMMR+CFG_TSEC2_OFFSET)
+#define TSEC2_PHY_ADDR         0x11
+#define TSEC2_PHYIDX           0
+#define TSEC2_FLAGS            (TSEC_GIGABIT|TSEC_REDUCED)
+
+#define CONFIG_ETHPRIME                "TSEC0"
+
+#define CONFIG_BOOTP_VENDOREX
+#define CONFIG_BOOTP_SUBNETMASK
+#define CONFIG_BOOTP_GATEWAY
+#define CONFIG_BOOTP_DNS
+#define CONFIG_BOOTP_DNS2
+#define CONFIG_BOOTP_HOSTNAME
+#define CONFIG_BOOTP_BOOTFILESIZE
+#define CONFIG_BOOTP_BOOTPATH
+#define CONFIG_BOOTP_NTPSERVER
+#define CONFIG_BOOTP_RANDOM_DELAY
+#define CONFIG_BOOTP_SEND_HOSTNAME
+
+/* USB */
+#define CONFIG_HAS_FSL_DR_USB
+
+/*
+ * Environment
+ */
+#undef  CFG_FLASH_PROTECTION
+#define CONFIG_ENV_OVERWRITE
+
+#define CFG_ENV_IS_IN_FLASH    1
+#define CFG_ENV_ADDR           0xFF800000
+#define CFG_ENV_SIZE           0x2000
+#define CFG_ENV_SECT_SIZE      0x2000
+#define CFG_ENV_ADDR_REDUND    (CFG_ENV_ADDR+CFG_ENV_SIZE)
+#define CFG_ENV_SIZE_REDUND    CFG_ENV_SIZE
+
+#define CONFIG_LOADS_ECHO 
+#define CFG_LOADS_BAUD_CHANGE
+
+/*
+ * Command line configuration.
+ */
+#include <config_cmd_default.h>
+
+#define CONFIG_CMD_CACHE
+#define CONFIG_CMD_IRQ
+#define CONFIG_CMD_NET
+#define CONFIG_CMD_MII
+#define CONFIG_CMD_PING
+#define CONFIG_CMD_DHCP
+#define CONFIG_CMD_SDRAM
+#define CONFIG_CMD_PCI
+#define CONFIG_CMD_I2C
+#define CONFIG_CMD_FPGA
+
+#undef CONFIG_WATCHDOG
+
+/*
+ * Miscellaneous configurable options
+ */
+#define CFG_LONGHELP
+#define CONFIG_CMDLINE_EDITING
+#define CFG_HUSH_PARSER
+#define CFG_PROMPT_HUSH_PS2 "> "
+
+/* default load address */
+#define CFG_LOAD_ADDR  0x2000000
+/* default location for tftp and bootm */
+#define CONFIG_LOADADDR        0x200000
+
+#define CFG_PROMPT     "mvBL-M7> "
+#define CFG_CBSIZE     256
+
+#define CFG_PBSIZE     (CFG_CBSIZE + sizeof(CFG_PROMPT) + 16)
+#define CFG_MAXARGS    16
+#define CFG_BARGSIZE   CFG_CBSIZE
+#define CFG_HZ         1000
+
+/*
+ * For booting Linux, the board info and command line data
+ * have to be in the first 8 MB of memory, since this is
+ * the maximum mapped by the Linux kernel during initialization.
+ */
+#define CFG_BOOTMAPSZ  (8 << 20)       /* Initial Memory map for Linux*/
+
+#define CFG_HRCW_LOW   0x0
+#define CFG_HRCW_HIGH  0x0
+
+/*
+ * System performance
+ */
+#define CFG_ACR_PIPE_DEP       3       /* Arbiter pipeline depth (0-3) */
+#define CFG_ACR_RPTCNT         3       /* Arbiter repeat count (0-7) */
+#define CFG_SPCR_TSEC1EP       3       /* TSEC1 emergency priority (0-3) */
+#define CFG_SPCR_TSEC2EP       3       /* TSEC2 emergency priority (0-3) */
+
+/* clocking */
+#define CFG_SCCR_ENCCM         0
+#define CFG_SCCR_USBMPHCM      0
+#define        CFG_SCCR_USBDRCM        2
+#define CFG_SCCR_TSEC1CM       1
+#define CFG_SCCR_TSEC2CM       1
+
+#define CFG_SICRH      0x1fff8003
+#define CFG_SICRL      (SICRL_LDP_A | SICRL_USB1 | SICRL_USB0)
+
+#define CFG_HID0_INIT  0x000000000
+#define CFG_HID0_FINAL CFG_HID0_INIT
+
+#define CFG_HID2       HID2_HBE
+
+/* DDR  */
+#define CFG_IBAT0L     (CFG_SDRAM_BASE | BATL_PP_10 | BATL_MEMCOHERENCE)
+#define CFG_IBAT0U     (CFG_SDRAM_BASE | BATU_BL_256M | BATU_VS | BATU_VP)
+
+/* PCI  */
+#define CFG_IBAT1L     (CFG_PCI1_MEM_BASE | BATL_PP_10 | BATL_MEMCOHERENCE)
+#define CFG_IBAT1U     (CFG_PCI1_MEM_BASE | BATU_BL_256M | BATU_VS | BATU_VP)
+#define CFG_IBAT2L     (CFG_PCI1_MMIO_BASE | BATL_PP_10 | BATL_CACHEINHIBIT |\
+                               BATL_GUARDEDSTORAGE)
+#define CFG_IBAT2U     (CFG_PCI1_MMIO_BASE | BATU_BL_256M | BATU_VS | BATU_VP)
+
+/* no PCI2 */
+#define CFG_IBAT3L     0
+#define CFG_IBAT3U     0
+#define CFG_IBAT4L     0
+#define CFG_IBAT4U     0
+
+/* IMMRBAR @ 0xE0000000, PCI IO @ 0xE2000000 & BCSR @ 0xE2400000 */
+#define CFG_IBAT5L     (CFG_IMMR | BATL_PP_10 | BATL_CACHEINHIBIT | \
+                               BATL_GUARDEDSTORAGE)
+#define CFG_IBAT5U     (CFG_IMMR | BATU_BL_256M | BATU_VS | BATU_VP)
+
+/* stack in DCACHE 0xFDF00000 & FLASH @ 0xFF800000 */
+#define CFG_IBAT6L     (0xF0000000 | BATL_PP_10 | BATL_MEMCOHERENCE)
+#define CFG_IBAT6U     (0xF0000000 | BATU_BL_256M | BATU_VS | BATU_VP)
+#define CFG_IBAT7L     0
+#define CFG_IBAT7U     0
+
+#define CFG_DBAT0L     CFG_IBAT0L
+#define CFG_DBAT0U     CFG_IBAT0U
+#define CFG_DBAT1L     CFG_IBAT1L
+#define CFG_DBAT1U     CFG_IBAT1U
+#define CFG_DBAT2L     CFG_IBAT2L
+#define CFG_DBAT2U     CFG_IBAT2U
+#define CFG_DBAT3L     CFG_IBAT3L
+#define CFG_DBAT3U     CFG_IBAT3U
+#define CFG_DBAT4L     CFG_IBAT4L
+#define CFG_DBAT4U     CFG_IBAT4U
+#define CFG_DBAT5L     CFG_IBAT5L
+#define CFG_DBAT5U     CFG_IBAT5U
+#define CFG_DBAT6L     CFG_IBAT6L
+#define CFG_DBAT6U     CFG_IBAT6U
+#define CFG_DBAT7L     CFG_IBAT7L
+#define CFG_DBAT7U     CFG_IBAT7U
+
+/*
+ * Internal Definitions
+ *
+ * Boot Flags
+ */
+#define BOOTFLAG_COLD  0x01    /* Normal Power-On: Boot from FLASH */
+#define BOOTFLAG_WARM  0x02    /* Software reboot */
+
+
+/*
+ * Environment Configuration
+ */
+#define CONFIG_ENV_OVERWRITE
+
+#define CONFIG_NETDEV          eth0
+
+/* Default path and filenames */
+#define CONFIG_BOOTDELAY               5
+#define CONFIG_AUTOBOOT_KEYED
+#define CONFIG_AUTOBOOT_STOP_STR       "s"
+#define CONFIG_ZERO_BOOTDELAY_CHECK
+#define CONFIG_RESET_TO_RETRY          1000
+
+#define MV_CI                  "mvBL-M7"
+#define MV_VCI                 "mvBL-M7"
+#define MV_FPGA_DATA           "0xfff80000"
+#define MV_FPGA_SIZE           "0x76ca2"
+#define MV_KERNEL_ADDR         "0xff810000"
+#define MV_INITRD_ADDR         "0xffc00000"
+#define MV_AUTOSCR_ADDR                "0xff804000"
+#define MV_AUTOSCR_ADDR2       "0xff806000"
+#define MV_DTB_ADDR            "0xff808000"
+#define MV_INITRD_LENGTH       "0x00300000"
+
+#define CONFIG_SHOW_BOOT_PROGRESS 1
+
+#define MV_KERNEL_ADDR_RAM     "0x00100000"
+#define MV_DTB_ADDR_RAM                "0x00600000"
+#define MV_INITRD_ADDR_RAM     "0x01000000"
+
+#define CONFIG_BOOTCOMMAND     "if imi ${autoscr_addr}; \
+                                       then autoscr ${autoscr_addr};  \
+                                       else autoscr ${autoscr_addr2}; \
+                               fi;"
+#define CONFIG_BOOTARGS                "root=/dev/ram ro rootfstype=squashfs"
+
+#define CONFIG_EXTRA_ENV_SETTINGS                              \
+       "console_nr=0\0"                                        \
+       "stdin=serial\0"                                        \
+       "stdout=serial\0"                                       \
+       "stderr=serial\0"                                       \
+       "fpga=0\0"                                              \
+       "fpgadata=" MV_FPGA_DATA "\0"                           \
+       "fpgadatasize=" MV_FPGA_SIZE "\0"                       \
+       "autoscr_addr=" MV_AUTOSCR_ADDR "\0"                    \
+       "autoscr_addr2=" MV_AUTOSCR_ADDR2 "\0"                  \
+       "mv_kernel_addr=" MV_KERNEL_ADDR "\0"                   \
+       "mv_kernel_addr_ram=" MV_KERNEL_ADDR_RAM "\0"           \
+       "mv_initrd_addr=" MV_INITRD_ADDR "\0"                   \
+       "mv_initrd_addr_ram=" MV_INITRD_ADDR_RAM "\0"           \
+       "mv_initrd_length=" MV_INITRD_LENGTH "\0"               \
+       "mv_dtb_addr=" MV_DTB_ADDR "\0"                         \
+       "mv_dtb_addr_ram=" MV_DTB_ADDR_RAM "\0"                 \
+       "dtb_name=" MV_DTB_NAME "\0"                            \
+       "mv_version=" MV_VERSION "\0"                           \
+       "dhcp_client_id=" MV_CI "\0"                            \
+       "dhcp_vendor-class-identifier=" MV_VCI "\0"             \
+       "netretry=no\0"                                         \
+       "use_static_ipaddr=no\0"                                \
+       "static_ipaddr=192.168.90.10\0"                         \
+       "static_netmask=255.255.255.0\0"                        \
+       "static_gateway=0.0.0.0\0"                              \
+       "initrd_name=uInitrd.mvblm7-xenorfs\0"                  \
+       "zcip=no\0"                                             \
+       "netboot=yes\0"                                         \
+       "mvtest=Ff\0"                                           \
+       "tried_bootfromflash=no\0"                              \
+       "tried_bootfromnet=no\0"                                \
+       "bootfile=mvblm72625.boot\0"                            \
+       "use_dhcp=yes\0"                                        \
+       "gev_start=yes\0"                                       \
+       "mvbcdma_debug=0\0"                                     \
+       "mvbcia_debug=0\0"                                      \
+       "propdev_debug=0\0"                                     \
+       "gevss_debug=0\0"                                       \
+       "watchdog=0\0"                                          \
+       "usb_dr_mode=host\0"                                    \
+       ""
+
+#define CONFIG_FPGA_COUNT      1
+#define CONFIG_FPGA            CFG_ALTERA_CYCLON2
+#define CONFIG_FPGA_ALTERA
+#define CONFIG_FPGA_CYCLON2
+
+#endif
index ff64378f201c8b16b6e45d2fb6fec7a6a839af1c..8a53fdd0cb875a26d664ff2af41726d1df860999 100644 (file)
@@ -49,6 +49,7 @@
 #define CONFIG_CPM2            1       /* has CPM2 */
 
 #define CONFIG_SBC8540         1       /* configuration for SBC8560 board */
+#define CONFIG_MPC8540         1
 
 #define CONFIG_MPC8560ADS      1       /* MPC8560ADS board specific (supplement)       */
 
index 89fc46541607359d5f92582ba098159e0c9ea6d9..0d2ca7225b184e6e305b40a265c52b449db627ff 100644 (file)
@@ -113,7 +113,7 @@ extern int tqm834x_num_flash_banks;
                                        BR_MS_GPCM | BR_PS_32 | BR_V)
 
 /* FLASH timing (0x0000_0c54) */
-#define CFG_OR_TIMING_FLASH    (OR_GPCM_CSNT | OR_GPCM_ACS_0b10 | \
+#define CFG_OR_TIMING_FLASH    (OR_GPCM_CSNT | OR_GPCM_ACS_DIV4 | \
                                        OR_GPCM_SCY_5 | OR_GPCM_TRLX)
 
 #define CFG_PRELIM_OR_AM       0xc0000000      /* OR addr mask: 1 GiB */
index fca5f74df79c16583285ebdda37b0efd74224126..d18f2346c649997dee426f9b2bf57b97bab3390c 100644 (file)
@@ -1,4 +1,7 @@
 /*
+ * (C) Copyright 2007
+ * Thomas Waehner, TQ-System GmbH, thomas.waehner@tqs.de.
+ *
  * (C) Copyright 2005
  * Stefan Roese, DENX Software Engineering, sr@denx.de.
  *
@@ -27,7 +30,7 @@
  */
 
 /*
- * TQM85xx (8560/40/55/41) board configuration file
+ * TQM85xx (8560/40/55/41/48) board configuration file
  */
 
 #ifndef __CONFIG_H
 #define CONFIG_MPC85xx         1       /* MPC8540/60/55/41             */
 
 #define CONFIG_PCI
+#define CONFIG_FSL_PCI_INIT    1       /* Use common FSL init code     */
+#define CONFIG_PCIX_CHECK              /* PCIX olny works at 66 MHz    */
+#ifdef CONFIG_TQM8548
+#define CONFIG_PCI1
+#define CONFIG_PCIE1
+#define CONFIG_FSL_PCIE_RESET  1       /* need PCIe reset errata       */
+#endif
+
 #define CONFIG_TSEC_ENET               /* tsec ethernet support        */
 
 #define CONFIG_MISC_INIT_R     1       /* Call misc_init_r             */
 
+ /*
+ * Configuration for big NOR Flashes
+ *
+ * Define CONFIG_TQM_BIGFLASH for boards with more than 128 MiB NOR Flash.
+ * Please be aware, that this changes the whole memory map (new CCSRBAR
+ * address, etc). You have to use an adapted Linux kernel or FDT blob
+ * if this option is set.
+ */
+#undef CONFIG_TQM_BIGFLASH
+
+/*
+ * NAND flash support (disabled by default)
+ *
+ * Warning: NAND support will likely increase the U-Boot image size
+ * to more than 256 KB. Please adjust TEXT_BASE if necessary.
+ */
+#undef CONFIG_NAND
+
 /*
- * Only MPC8540 doesn't have CPM module
+ * MPC8540 and MPC8548 don't have CPM module
  */
-#ifndef CONFIG_MPC8540
+#if !defined(CONFIG_MPC8540) && !defined(CONFIG_MPC8548)
 #define CONFIG_CPM2            1       /* has CPM2                     */
 #endif
 
-#define CONFIG_FSL_LAW         1       /* Use common FSL init code */
+#define CONFIG_FSL_LAW         1       /* Use common FSL init code     */
+
+#undef CONFIG_CAN_DRIVER               /* CAN Driver support           */
 
 /*
  * sysclk for MPC85xx
  *
  * Two valid values are:
- *    33000000
- *    66000000
+ *    33333333
+ *    66666666
  *
  * Most PCI cards are still 33Mhz, so in the presence of PCI, 33MHz
  * is likely the desired value here, so that is now the default.
  * actual resources get mapped (not physical addresses)
  */
 #define CFG_CCSRBAR_DEFAULT    0xFF700000      /* CCSRBAR Default      */
+#ifdef CONFIG_TQM_BIGFLASH
+#define CFG_CCSRBAR            0xA0000000      /* relocated CCSRBAR    */
+#else /* !CONFIG_TQM_BIGFLASH */
 #define CFG_CCSRBAR            0xE0000000      /* relocated CCSRBAR    */
+#endif /* CONFIG_TQM_BIGFLASH */
 #define CFG_CCSRBAR_PHYS       CFG_CCSRBAR     /* physical addr of CCSRBAR */
 #define CFG_IMMR               CFG_CCSRBAR     /* PQII uses CFG_IMMR   */
 
+#define CFG_PCI1_ADDR          (CFG_CCSRBAR + 0x8000)
+#define CFG_PCI2_ADDR          (CFG_CCSRBAR + 0x9000)
+#define CFG_PCIE1_ADDR         (CFG_CCSRBAR + 0xa000)
+
 /*
  * DDR Setup
  */
 /* TQM8540 & 8560 need DLL-override */
 #define CONFIG_DDR_DLL                         /* DLL fix needed       */
 #define CONFIG_DDR_DEFAULT_CL  25              /* CAS latency 2,5      */
-#endif /* defined(CONFIG_TQM8540) || defined(CONFIG_TQM8560) */
+#endif /* CONFIG_TQM8540 || CONFIG_TQM8560 */
 
-#if defined(CONFIG_TQM8541) || defined(CONFIG_TQM8555)
+#if defined(CONFIG_TQM8541) || defined(CONFIG_TQM8555) || \
+    defined(CONFIG_TQM8548)
 #define CONFIG_DDR_DEFAULT_CL  30              /* CAS latency 3        */
-#endif /* defined(CONFIG_TQM8541) || defined(CONFIG_TQM8555) */
+#endif /* CONFIG_TQM8541 || CONFIG_TQM8555 || CONFIG_TQM8548 */
+
+/*
+ * Old TQM85xx boards have 'M' type Spansion Flashes from the S29GLxxxM
+ * series while new boards have 'N' type Flashes from the S29GLxxxN
+ * series, which have bigger sectors: 2 x 128 instead of 2 x 64 KB.
+ */
+#ifdef CONFIG_TQM8548
+#define CONFIG_TQM_FLASH_N_TYPE
+#endif /* CONFIG_TQM8548 */
 
 /*
  * Flash on the Local Bus
  */
+#ifdef CONFIG_TQM_BIGFLASH
+#define CFG_FLASH0             0xE0000000
+#define CFG_FLASH1             0xC0000000
+#else /* !CONFIG_TQM_BIGFLASH */
 #define CFG_FLASH0             0xFC000000
 #define CFG_FLASH1             0xF8000000
+#endif /* CONFIG_TQM_BIGFLASH */
 #define CFG_FLASH_BANKS_LIST   { CFG_FLASH1, CFG_FLASH0 }
 
 #define CFG_LBC_FLASH_BASE     CFG_FLASH1      /* Localbus flash start */
-#define CFG_FLASH_BASE         CFG_LBC_FLASH_BASE /* start of FLASH    */
+#define CFG_FLASH_BASE         CFG_LBC_FLASH_BASE  /* start of FLASH   */
 
+/* Default ORx timings are for <= 41.7 MHz Local Bus Clock.
+ *
+ * Note: According to timing specifications external addr latch delay
+ * (EAD, bit #0) must be set if Local Bus Clock is > 83 MHz.
+ *
+ * For other Local Bus Clocks see following table:
+ *
+ * Clock/MHz   CFG_ORx_PRELIM
+ * 166         0x.....CA5
+ * 133         0x.....C85
+ * 100         0x.....C65
+ *  83         0x.....FA2
+ *  66         0x.....C82
+ *  50         0x.....C60
+ *  42         0x.....040
+ *  33         0x.....030
+ *  25         0x.....020
+ *
+ */
+#ifdef CONFIG_TQM_BIGFLASH
+#define CFG_BR0_PRELIM         0xE0001801      /* port size 32bit      */
+#define CFG_OR0_PRELIM         0xE0000040      /* 512MB Flash          */
+#define CFG_BR1_PRELIM         0xC0001801      /* port size 32bit      */
+#define CFG_OR1_PRELIM         0xE0000040      /* 512MB Flash          */
+#else /* !CONFIG_TQM_BIGFLASH */
 #define CFG_BR0_PRELIM         0xfc001801      /* port size 32bit      */
 #define CFG_OR0_PRELIM         0xfc000040      /* 64MB Flash           */
 #define CFG_BR1_PRELIM         0xf8001801      /* port size 32bit      */
 #define CFG_OR1_PRELIM         0xfc000040      /* 64MB Flash           */
+#endif /* CONFIG_TQM_BIGFLASH */
 
-#define CFG_FLASH_CFI                          /* flash is CFI compat. */
-#define CFG_FLASH_CFI_DRIVER                   /* Use common CFI driver*/
+#define CFG_FLASH_CFI                  /* flash is CFI compat.         */
+#define CFG_FLASH_CFI_DRIVER           /* Use common CFI driver        */
 #define CFG_FLASH_EMPTY_INFO           /* print 'E' for empty sector   */
 #define CFG_FLASH_QUIET_TEST   1       /* don't warn upon unknown flash*/
+#define CFG_FLASH_USE_BUFFER_WRITE     1 /* speed up output to Flash   */
 
-#define CFG_MAX_FLASH_BANKS    2               /* number of banks      */
-#define CFG_MAX_FLASH_SECT     512             /* sectors per device   */
+#define CFG_MAX_FLASH_BANKS    2       /* number of banks              */
+#define CFG_MAX_FLASH_SECT     512     /* sectors per device           */
 #undef CFG_FLASH_CHECKSUM
 #define CFG_FLASH_ERASE_TOUT   60000   /* Flash Erase Timeout (ms)     */
 #define CFG_FLASH_WRITE_TOUT   500     /* Flash Write Timeout (ms)     */
 
 #define CFG_MONITOR_BASE       TEXT_BASE       /* start of monitor     */
 
-#define CFG_LBC_LCRR           0x00030008    /* LB clock ratio reg     */
-#define CFG_LBC_LBCR           0x00000000    /* LB config reg          */
-#define CFG_LBC_LSRT           0x20000000    /* LB sdram refresh timer */
-#define CFG_LBC_MRTPR          0x20000000    /* LB refresh timer presc.*/
+/*
+ * Note: when changing the Local Bus clock divider you have to
+ * change the timing values in CFG_ORx_PRELIM.
+ *
+ * LCRR[00:03] CLKDIV: System (CCB) clock divider. Valid values are 2, 4, 8.
+ * LCRR[16:17] EADC  : External address delay cycles. It should be set to 2
+ *                     for Local Bus Clock > 83.3 MHz.
+ */
+#define CFG_LBC_LCRR           0x00030008      /* LB clock ratio reg   */
+#define CFG_LBC_LBCR           0x00000000      /* LB config reg        */
+#define CFG_LBC_LSRT           0x20000000      /* LB sdram refresh timer */
+#define CFG_LBC_MRTPR          0x20000000      /* LB refresh timer presc.*/
 
 #define CONFIG_L1_INIT_RAM
 #define CFG_INIT_RAM_LOCK      1
-#define CFG_INIT_RAM_ADDR      0xe4010000      /* Initial RAM address  */
+#define CFG_INIT_RAM_ADDR      (CFG_CCSRBAR \
+                                + 0x04010000)  /* Initial RAM address  */
 #define CFG_INIT_RAM_END       0x4000          /* End used area in RAM */
 
-#define CFG_GBL_DATA_SIZE      128             /* num bytes initial data*/
+#define CFG_GBL_DATA_SIZE      128     /* 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_MONITOR_LEN                (256 * 1024)    /* Reserve 256kB for Mon*/
-#define CFG_MALLOC_LEN         (128 * 1024)    /* Reserved for malloc  */
+#define CFG_MONITOR_LEN                (~TEXT_BASE + 1)/* Reserved for Monitor */
+#define CFG_MALLOC_LEN         (384 * 1024)    /* Reserved for malloc  */
 
 /* Serial Port */
 #if defined(CONFIG_TQM8560)
 
-#define CONFIG_CONS_ON_SCC      /* define if console on SCC */
-#undef  CONFIG_CONS_NONE        /* define if console on something else */
-#define CONFIG_CONS_INDEX       1  /* which serial channel for console */
+#define CONFIG_CONS_ON_SCC     /* define if console on SCC             */
+#undef CONFIG_CONS_NONE        /* define if console on something else  */
+#define CONFIG_CONS_INDEX      1 /* which serial channel for console   */
 
-#else  /* ! TQM8560 */
+#else /* !CONFIG_TQM8560 */
 
 #define CONFIG_CONS_INDEX     1
 #undef CONFIG_SERIAL_SOFTWARE_FIFO
 #define CFG_NS16550_COM2       (CFG_CCSRBAR+0x4600)
 
 /* PS/2 Keyboard */
-#if !defined(CONFIG_TQM8560)
 #define CONFIG_PS2KBD                  /* AT-PS/2 Keyboard             */
 #define CONFIG_PS2MULT                 /* .. on PS/2 Multiplexer       */
 #define CONFIG_PS2SERIAL       2       /* .. on DUART2                 */
 #define CONFIG_PS2MULT_DELAY   (CFG_HZ/2)      /* Initial delay        */
 #define CONFIG_BOARD_EARLY_INIT_R      1
-#endif /* !CONFIG_TQM8560 */
 
 #endif /* CONFIG_TQM8560 */
 
-#define CONFIG_BAUDRATE         115200
+#define CONFIG_BAUDRATE                115200
 
-#define CFG_BAUDRATE_TABLE  \
-       {300, 600, 1200, 2400, 4800, 9600, 19200, 38400,115200}
+#define CFG_BAUDRATE_TABLE     \
+       {300, 600, 1200, 2400, 4800, 9600, 19200, 38400, 115200}
 
 #define CONFIG_CMDLINE_EDITING 1       /* add command line history     */
 #define CFG_HUSH_PARSER                1       /* Use the HUSH parser          */
 #define        CFG_PROMPT_HUSH_PS2     "> "
 #endif
 
+/* pass open firmware flat tree */
+#define CONFIG_OF_LIBFDT               1
+#define CONFIG_OF_BOARD_SETUP          1
+#define CONFIG_OF_STDOUT_VIA_ALIAS     1
+
+/* CAN */
+#define CFG_CAN_BASE           (CFG_CCSRBAR \
+                                + 0x03000000)  /* CAN base address     */
+#ifdef CONFIG_CAN_DRIVER
+#define CFG_CAN_OR_AM          0xFFFF8000      /* 32 KiB address mask  */
+#define CFG_OR2_CAN            (CFG_CAN_OR_AM | OR_UPM_BI)
+#define CFG_BR2_CAN            ((CFG_CAN_BASE & BR_BA) | \
+                                BR_PS_8 | BR_MS_UPMC | BR_V)
+#endif /* CONFIG_CAN_DRIVER */
 
 /*
  * I2C
  */
-#define CONFIG_FSL_I2C         /* Use FSL common I2C driver */
+#define CONFIG_FSL_I2C                 /* Use FSL common I2C driver    */
 #define CONFIG_HARD_I2C                        /* I2C with hardware support    */
 #undef CONFIG_SOFT_I2C                 /* I2C bit-banged               */
 #define CFG_I2C_SPEED          400000  /* I2C speed and slave address  */
 #define CFG_EEPROM_PAGE_WRITE_BITS     5       /* =32 Bytes per write  */
 #define CFG_EEPROM_PAGE_WRITE_ENABLE
 #define CFG_EEPROM_PAGE_WRITE_DELAY_MS 20
-#define CFG_I2C_MULTI_EEPROMS          1       /* more than one eeprom */
+#define CFG_I2C_MULTI_EEPROMS          1       /* more than one eeprom */
 
 /* I2C SYSMON (LM75) */
 #define CONFIG_DTT_LM75                1               /* ON Semi's LM75       */
 #define CFG_DTT_LOW_TEMP       -30
 #define CFG_DTT_HYSTERESIS     3
 
+#ifndef CONFIG_PCIE1
 /* RapidIO MMU */
+#ifdef CONFIG_TQM_BIGFLASH
+#define CFG_RIO_MEM_BASE       0xb0000000      /* base address         */
+#define CFG_RIO_MEM_SIZE       0x10000000      /* 256M                 */
+#else /* !CONFIG_TQM_BIGFLASH */
 #define CFG_RIO_MEM_BASE       0xc0000000      /* base address         */
+#define CFG_RIO_MEM_SIZE       0x20000000      /* 512M                 */
+#endif /* CONFIG_TQM_BIGFLASH */
 #define CFG_RIO_MEM_PHYS       CFG_RIO_MEM_BASE
-#define CFG_RIO_MEM_SIZE       0x20000000      /* 128M                 */
+#endif /* CONFIG_PCIE1 */
+
+/* NAND FLASH */
+#ifdef CONFIG_NAND
+
+#undef CFG_NAND_LEGACY
+
+#define CONFIG_NAND_FSL_UPM    1
+
+#define        CONFIG_MTD_NAND_ECC_JFFS2       1       /* use JFFS2 ECC        */
+
+/* address distance between chip selects */
+#define        CFG_NAND_SELECT_DEVICE  1
+#define        CFG_NAND_CS_DIST        0x200
+
+#define CFG_NAND_SIZE          0x8000
+#define CFG_NAND0_BASE         (CFG_CCSRBAR + 0x03010000)
+#define CFG_NAND1_BASE         (CFG_NAND0_BASE + CFG_NAND_CS_DIST)
+#define CFG_NAND2_BASE         (CFG_NAND1_BASE + CFG_NAND_CS_DIST)
+#define CFG_NAND3_BASE         (CFG_NAND2_BASE + CFG_NAND_CS_DIST)
+
+#define CFG_MAX_NAND_DEVICE     2      /* Max number of NAND devices   */
+#define NAND_MAX_CHIPS         1
+
+#if (CFG_MAX_NAND_DEVICE == 1)
+#define CFG_NAND_BASE_LIST { CFG_NAND0_BASE }
+#elif (CFG_MAX_NAND_DEVICE == 2)
+#define        CFG_NAND_QUIET_TEST     1
+#define CFG_NAND_BASE_LIST { CFG_NAND0_BASE, \
+                            CFG_NAND1_BASE, \
+}
+#elif (CFG_MAX_NAND_DEVICE == 4)
+#define        CFG_NAND_QUIET_TEST     1
+#define CFG_NAND_BASE_LIST { CFG_NAND0_BASE, \
+                            CFG_NAND1_BASE, \
+                            CFG_NAND2_BASE, \
+                            CFG_NAND3_BASE, \
+}
+#endif
+
+/* CS3 for NAND Flash */
+#define CFG_BR3_PRELIM         ((CFG_NAND0_BASE & BR_BA) | BR_PS_8 | \
+                                BR_MS_UPMB | BR_V)
+#define CFG_OR3_PRELIM         (P2SZ_TO_AM(CFG_NAND_SIZE) | OR_UPM_BI)
+
+#define NAND_BIG_DELAY_US       25     /* max tR for Samsung devices   */
+
+#endif /* CONFIG_NAND */
 
 /*
  * General PCI
 #define CFG_PCI1_MEM_BASE      0x80000000
 #define CFG_PCI1_MEM_PHYS      CFG_PCI1_MEM_BASE
 #define CFG_PCI1_MEM_SIZE      0x20000000      /* 512M                 */
-#define CFG_PCI1_IO_BASE       0xe2000000
+#define CFG_PCI1_IO_BASE       (CFG_CCSRBAR + 0x02000000)
 #define CFG_PCI1_IO_PHYS       CFG_PCI1_IO_BASE
-#define CFG_PCI1_IO_SIZE       0x1000000       /* 16M                  */
+#define CFG_PCI1_IO_SIZE       0x1000000       /*  16M                 */
+
+/* PCI view of System Memory */
+#define CFG_PCI_MEMORY_BUS     0x00000000
+#define CFG_PCI_MEMORY_PHYS    0x00000000
+#define CFG_PCI_MEMORY_SIZE    0x80000000
+
+#ifdef CONFIG_PCIE1
+/*
+ * General PCI express
+ * Addresses are mapped 1-1.
+ */
+#ifdef CONFIG_TQM_BIGFLASH
+#define CFG_PCIE1_MEM_BASE     0xb0000000
+#define CFG_PCIE1_MEM_SIZE     0x10000000      /* 512M                 */
+#define CFG_PCIE1_IO_BASE      0xaf000000
+#else /* !CONFIG_TQM_BIGFLASH */
+#define CFG_PCIE1_MEM_BASE     0xc0000000
+#define CFG_PCIE1_MEM_SIZE     0x20000000      /* 512M                 */
+#define CFG_PCIE1_IO_BASE      0xef000000
+#endif /* CONFIG_TQM_BIGFLASH */
+#define CFG_PCIE1_MEM_PHYS     CFG_PCIE1_MEM_BASE
+#define CFG_PCIE1_IO_PHYS      CFG_PCIE1_IO_BASE
+#define CFG_PCIE1_IO_SIZE      0x1000000       /* 16M                  */
+#endif /* CONFIG_PCIE1 */
 
 #if defined(CONFIG_PCI)
 
 #undef CONFIG_PCI_SCAN_SHOW            /* show pci devices on startup  */
 #define CFG_PCI_SUBSYS_VENDORID 0x1057 /* Motorola                     */
 
-#endif /* CONFIG_PCI */
-
+#endif /* CONFIG_PCI */
 
 #define CONFIG_NET_MULTI       1
 
 #define CONFIG_HAS_ETH1
 #define CONFIG_HAS_ETH2
 
+#ifdef CONFIG_TQM8548
+/*
+ * TQM8548 has 4 ethernet ports. 4 ETSEC's.
+ *
+ * On the STK85xx Starterkit the ETSEC3/4 ports are on an
+ * additional adapter (AIO) between module and Starterkit.
+ */
+#define CONFIG_TSEC3   1
+#define CONFIG_TSEC3_NAME      "TSEC2"
+#define CONFIG_TSEC4   1
+#define CONFIG_TSEC4_NAME      "TSEC3"
+#define TSEC3_PHY_ADDR         4
+#define TSEC4_PHY_ADDR         5
+#define TSEC3_PHYIDX           0
+#define TSEC4_PHYIDX           0
+#define TSEC3_FLAGS            (TSEC_GIGABIT | TSEC_REDUCED)
+#define TSEC4_FLAGS            (TSEC_GIGABIT | TSEC_REDUCED)
+#define CONFIG_HAS_ETH3
+#define CONFIG_HAS_ETH4
+#endif /* CONFIG_TQM8548 */
+
 /* Options are TSEC[0-1], FEC */
 #define CONFIG_ETHPRIME                "TSEC0"
 
  * FCC2: a - c (X50.2 - 1)
  */
 #define CONFIG_ETHER_ON_FCC
-#define        CONFIG_ETHER_INDEX    1         /* FCC channel for ethernet     */
+#define        CONFIG_ETHER_INDEX    1 /* FCC channel for ethernet     */
 #endif
 
 #if defined(CONFIG_TQM8560)
  * FCC3: a - d (X50.2 - 3)
  */
 #define CONFIG_ETHER_ON_FCC
-#define        CONFIG_ETHER_INDEX    3         /* FCC channel for ethernet     */
+#define        CONFIG_ETHER_INDEX    3 /* FCC channel for ethernet     */
 #endif
 
 #if defined(CONFIG_ETHER_ON_FCC) && (CONFIG_ETHER_INDEX == 1)
 #define CONFIG_ETHER_ON_FCC1
-#define CFG_CMXFCR_MASK1       (CMXFCR_FC1 | CMXFCR_RF1CS_MSK | CMXFCR_TF1CS_MSK)
+#define CFG_CMXFCR_MASK1       (CMXFCR_FC1 | CMXFCR_RF1CS_MSK | \
+                                CMXFCR_TF1CS_MSK)
 #define CFG_CMXFCR_VALUE1      (CMXFCR_RF1CS_CLK11 | CMXFCR_TF1CS_CLK12)
 #define CFG_CPMFCR_RAMTYPE     0
 #define CFG_FCC_PSMR           (FCC_PSMR_FDE | FCC_PSMR_LPB)
 
 #if defined(CONFIG_ETHER_ON_FCC) && (CONFIG_ETHER_INDEX == 2)
 #define CONFIG_ETHER_ON_FCC2
-#define CFG_CMXFCR_MASK2       (CMXFCR_FC2 | CMXFCR_RF2CS_MSK | CMXFCR_TF2CS_MSK)
+#define CFG_CMXFCR_MASK2       (CMXFCR_FC2 | CMXFCR_RF2CS_MSK | \
+                                CMXFCR_TF2CS_MSK)
 #define CFG_CMXFCR_VALUE2      (CMXFCR_RF2CS_CLK16 | CMXFCR_TF2CS_CLK13)
 #define CFG_CPMFCR_RAMTYPE     0
 #define CFG_FCC_PSMR           (FCC_PSMR_FDE | FCC_PSMR_LPB)
 
 #if defined(CONFIG_ETHER_ON_FCC) && (CONFIG_ETHER_INDEX == 3)
 #define CONFIG_ETHER_ON_FCC3
-#define CFG_CMXFCR_MASK3       (CMXFCR_FC3 | CMXFCR_RF3CS_MSK | CMXFCR_TF3CS_MSK)
+#define CFG_CMXFCR_MASK3       (CMXFCR_FC3 | CMXFCR_RF3CS_MSK | \
+                                CMXFCR_TF3CS_MSK)
 #define CFG_CMXFCR_VALUE3      (CMXFCR_RF3CS_CLK15 | CMXFCR_TF3CS_CLK14)
 #define CFG_CPMFCR_RAMTYPE     0
 #define CFG_FCC_PSMR           (FCC_PSMR_FDE | FCC_PSMR_LPB)
  * Environment
  */
 #define CFG_ENV_IS_IN_FLASH    1
-#define CFG_ENV_ADDR           (CFG_MONITOR_BASE - 0x20000)
-#define CFG_ENV_SECT_SIZE      0x20000 /* 128K(one sector) for env     */
+
+#ifdef CONFIG_TQM_FLASH_N_TYPE
+#define CFG_ENV_SECT_SIZE      0x40000 /* 256K (one sector) for env    */
+#else /* !CONFIG_TQM_FLASH_N_TYPE */
+#define CFG_ENV_SECT_SIZE      0x20000 /* 128K (one sector) for env    */
+#endif /* CONFIG_TQM_FLASH_N_TYPE */
+#define CFG_ENV_ADDR           (CFG_MONITOR_BASE - CFG_ENV_SECT_SIZE)
 #define CFG_ENV_SIZE           0x2000
-#define CFG_ENV_ADDR_REDUND    (CFG_ENV_ADDR-CFG_ENV_SECT_SIZE)
+#define CFG_ENV_ADDR_REDUND    (CFG_ENV_ADDR - CFG_ENV_SECT_SIZE)
 #define CFG_ENV_SIZE_REDUND    (CFG_ENV_SIZE)
 
 #define CONFIG_LOADS_ECHO      1       /* echo on for serial download  */
 #define CFG_LOADS_BAUD_CHANGE  1       /* allow baudrate change        */
 
-#define        CONFIG_TIMESTAMP                /* Print image info with ts     */
-
+#define        CONFIG_TIMESTAMP        /* Print image info with ts     */
 
 /*
  * BOOTP options
 #define CONFIG_BOOTP_GATEWAY
 #define CONFIG_BOOTP_HOSTNAME
 
+#ifdef CONFIG_NAND
+/*
+ * Use NAND-FLash as JFFS2 device
+ */
+#define CONFIG_CMD_NAND
+#define CONFIG_CMD_JFFS2
+
+#define        CONFIG_JFFS2_NAND       1
+
+#ifdef CONFIG_JFFS2_CMDLINE
+#define MTDIDS_DEFAULT         "nand0=TQM85xx-nand"
+#define MTDPARTS_DEFAULT       "mtdparts=TQM85xx-nand:-"
+#else
+#define CONFIG_JFFS2_DEV       "nand0" /* NAND device jffs2 lives on   */
+#define CONFIG_JFFS2_PART_OFFSET 0     /* start of jffs2 partition     */
+#define CONFIG_JFFS2_PART_SIZE 0x200000 /* size of jffs2 partition     */
+#endif /* CONFIG_JFFS2_CMDLINE */
+
+#endif /* CONFIG_NAND */
 
 /*
  * Command line configuration.
 #define CONFIG_CMD_MII
 
 #if defined(CONFIG_PCI)
-    #define CONFIG_CMD_PCI
+#define CONFIG_CMD_PCI
 #endif
 
-
 #undef CONFIG_WATCHDOG                 /* watchdog disabled            */
 
 /*
 #define CFG_PROMPT     "=> "           /* Monitor Command Prompt       */
 
 #if defined(CONFIG_CMD_KGDB)
-    #define CFG_CBSIZE 1024            /* Console I/O Buffer Size      */
+#define CFG_CBSIZE     1024            /* Console I/O Buffer Size      */
 #else
-    #define CFG_CBSIZE 256             /* Console I/O Buffer Size      */
+#define CFG_CBSIZE     256             /* Console I/O Buffer Size      */
 #endif
 
-#define CFG_PBSIZE (CFG_CBSIZE+sizeof(CFG_PROMPT)+16) /* Print Buf Size        */
+#define CFG_PBSIZE     (CFG_CBSIZE + \
+                        sizeof(CFG_PROMPT) + 16)   /* Print Buf Size   */
 #define CFG_MAXARGS    16              /* max number of command args   */
 #define CFG_BARGSIZE   CFG_CBSIZE      /* Boot Argument Buffer Size    */
 #define CFG_HZ         1000            /* decrementer freq: 1ms ticks  */
 #define CONFIG_KGDB_SER_INDEX  2       /* which serial port to use     */
 #endif
 
-
 #define CONFIG_LOADADDR         200000         /* default addr for tftp & bootm*/
 
 #define CONFIG_BOOTDELAY 5             /* -1 disables auto-boot        */
 
 #undef CONFIG_BOOTARGS         /* the boot command will set bootargs   */
 
+
+/*
+ * Setup some board specific values for the default environment variables
+ */
+#ifdef CONFIG_CPM2
+#define CFG_ENV_CONSDEV                "consdev=ttyCPM0\0"
+#else
+#define CFG_ENV_CONSDEV                "consdev=ttyS0\0"
+#endif
+#define CFG_ENV_FDT_FILE       "fdt_file="MK_STR(CONFIG_HOSTNAME)"/" \
+                               MK_STR(CONFIG_HOSTNAME)".dtb\0"
+#define CFG_ENV_BOOTFILE       "bootfile="MK_STR(CONFIG_HOSTNAME)"/uImage\0"
+#define CFG_ENV_UBOOT          "uboot="MK_STR(CONFIG_HOSTNAME)"/u-boot.bin\0" \
+                               "uboot_addr="MK_STR(TEXT_BASE)"\0"
+
 #define        CONFIG_EXTRA_ENV_SETTINGS                                       \
-       "bootfile="CFG_BOOTFILE_PATH"\0"                                \
+       CFG_ENV_BOOTFILE                                                \
+       CFG_ENV_FDT_FILE                                                \
+       CFG_ENV_CONSDEV                                                 \
        "netdev=eth0\0"                                                 \
-       "consdev=ttyS0\0"                                               \
        "nfsargs=setenv bootargs root=/dev/nfs rw "                     \
                "nfsroot=$serverip:$rootpath\0"                         \
        "ramargs=setenv bootargs root=/dev/ram rw\0"                    \
        "addcons=setenv bootargs $bootargs "                            \
                "console=$consdev,$baudrate\0"                          \
        "flash_nfs=run nfsargs addip addcons;"                          \
-               "bootm $kernel_addr\0"                                  \
+               "bootm $kernel_addr - $fdt_addr\0"                      \
        "flash_self=run ramargs addip addcons;"                         \
-               "bootm $kernel_addr $ramdisk_addr\0"                    \
-       "net_nfs=tftp $loadaddr $bootfile;"                             \
-               "run nfsargs addip addcons;bootm\0"                     \
+               "bootm $kernel_addr $ramdisk_addr $fdt_addr\0"          \
+       "net_nfs=tftp $kernel_addr_r $bootfile;"                        \
+               "tftp $fdt_addr_r $fdt_file;"                           \
+               "run nfsargs addip addcons;"                            \
+               "bootm $kernel_addr_r - $fdt_addr_r\0"                  \
        "rootpath=/opt/eldk/ppc_85xx\0"                                 \
-       "kernel_addr=FE000000\0"                                        \
-       "ramdisk_addr=FE180000\0"                                       \
-       "load=tftp 100000 /tftpboot/$hostname/u-boot.bin\0"             \
-       "update=protect off fffc0000 ffffffff;era fffc0000 ffffffff;"   \
-               "cp.b 100000 fffc0000 40000;"                           \
+       "fdt_addr_r=900000\0"                                           \
+       "kernel_addr_r=1000000\0"                                       \
+       "fdt_addr=ffec0000\0"                                           \
+       "kernel_addr=ffd00000\0"                                        \
+       "ramdisk_addr=ff800000\0"                                       \
+       CFG_ENV_UBOOT                                                   \
+       "load=tftp 100000 $uboot\0"                                     \
+       "update=protect off $uboot_addr +$filesize;"                    \
+               "erase $uboot_addr +$filesize;"                         \
+               "cp.b 100000 $uboot_addr $filesize;"                    \
                "setenv filesize;saveenv\0"                             \
        "upd=run load update\0"                                         \
        ""
 #define CONFIG_BOOTCOMMAND     "run flash_self"
 
-#endif /* __CONFIG_H */
+#endif /* __CONFIG_H */
index bbf726dc62549ce59dd799c60b061b2160f771c5..9092a7c0962e5efea73d0d96d910a4c417c44f90 100644 (file)
 #define CONFIG_ACADIA          1               /* Board is Acadia      */
 #define CONFIG_4xx             1               /* ... PPC4xx family    */
 #define CONFIG_405EZ           1               /* Specifc 405EZ support*/
+
+/*
+ * Include common defines/options for all AMCC eval boards
+ */
+#define CONFIG_HOSTNAME                acadia
+#include "amcc-common.h"
+
 /* Detect Acadia PLL input clock automatically via CPLD bit            */
 #define CONFIG_SYS_CLK_FREQ    ((in8(CFG_CPLD_BASE + 0) == 0x0c) ? \
                                66666666 : 33333000)
  * Base addresses -- Note these are effective addresses where the
  * actual resources get mapped (not physical addresses)
  *----------------------------------------------------------------------*/
-#define CFG_SDRAM_BASE         0x00000000
 #define CFG_FLASH_BASE         0xfe000000
 #define CFG_CPLD_BASE          0x80000000
 #define CFG_NAND_ADDR          0xd0000000
 #define CFG_USB_HOST           0xef603000      /* USB OHCI 1.1 controller      */
 
-#define CFG_MONITOR_BASE       TEXT_BASE
-#define CFG_MONITOR_LEN                (0xFFFFFFFF - CFG_MONITOR_BASE + 1)
-#define CFG_MALLOC_LEN         (512 * 1024)/* Reserve 512 kB for malloc()      */
-
 /*-----------------------------------------------------------------------
  * Initial RAM & stack pointer
  *----------------------------------------------------------------------*/
  *----------------------------------------------------------------------*/
 #undef CFG_EXT_SERIAL_CLOCK                    /* external serial clock */
 #define CFG_BASE_BAUD          691200
-#define CONFIG_BAUDRATE                115200
-#define CONFIG_SERIAL_MULTI     1
-
-/* The following table includes the supported baudrates */
-#define CFG_BAUDRATE_TABLE     \
-       {300, 600, 1200, 2400, 4800, 9600, 19200, 38400, 57600, 115200, 230400}
 
 /*-----------------------------------------------------------------------
  * Environment
 /*-----------------------------------------------------------------------
  * 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_DTT_LOW_TEMP       -30
 #define CFG_DTT_HYSTERESIS     3
 
-#if 0 /* test-only... */
-/*-----------------------------------------------------------------------
- * SPI stuff - Define to include SPI control
- *-----------------------------------------------------------------------
- */
-#define CONFIG_SPI
-#endif
-
 /*-----------------------------------------------------------------------
  * Ethernet
  *----------------------------------------------------------------------*/
-#define CONFIG_MII             1       /* MII PHY management           */
 #define        CONFIG_PHY_ADDR         0       /* PHY address                  */
-#define CONFIG_NET_MULTI       1
-#define CFG_RX_ETH_BUFFER      16      /* # of rx buffers & descriptors*/
 #define CONFIG_HAS_ETH0                1
 
-#define CONFIG_NETCONSOLE              /* include NetConsole support   */
-
-#define CONFIG_PREBOOT "echo;" \
-       "echo Type \\\"run flash_nfs\\\" to mount root filesystem over NFS;" \
-       "echo"
-
-#undef CONFIG_BOOTARGS
-
-#define xstr(s) str(s)
-#define str(s) #s
-
+/*
+ * Default environment variables
+ */
 #define        CONFIG_EXTRA_ENV_SETTINGS                                       \
-       "netdev=eth0\0"                                                 \
-       "hostname=acadia\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=ttyS0,${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_4xx\0"                          \
-       "bootfile=acadia/uImage\0"                                      \
+       CONFIG_AMCC_DEF_ENV                                             \
+       CONFIG_AMCC_DEF_ENV_PPC                                         \
+       CONFIG_AMCC_DEF_ENV_NOR_UPD                                     \
+       CONFIG_AMCC_DEF_ENV_NAND_UPD                                    \
        "kernel_addr=fff10000\0"                                        \
        "ramdisk_addr=fff20000\0"                                       \
-       "initrd_high=30000000\0"                                        \
-       "load=tftp 200000 acadia/u-boot.bin\0"                          \
-       "update=protect off " xstr(CFG_MONITOR_BASE) " FFFFFFFF;"       \
-               "era " xstr(CFG_MONITOR_BASE) " FFFFFFFF;"              \
-               "cp.b ${fileaddr} " xstr(CFG_MONITOR_BASE) " ${filesize};" \
-               "setenv filesize;saveenv\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"
-
-#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_USB_OHCI
 #define CONFIG_USB_STORAGE
 #define CONFIG_SUPPORT_VFAT
 
 /*
- * BOOTP options
+ * Commands additional to the ones defined in amcc-common.h
  */
-#define CONFIG_BOOTP_BOOTFILESIZE
-#define CONFIG_BOOTP_BOOTPATH
-#define CONFIG_BOOTP_GATEWAY
-#define CONFIG_BOOTP_HOSTNAME
-
-
-/*
- * Command line configuration.
- */
-#include <config_cmd_default.h>
-
-#define CONFIG_CMD_ASKENV
-#define CONFIG_CMD_DHCP
 #define CONFIG_CMD_DTT
-#define CONFIG_CMD_DIAG
-#define CONFIG_CMD_EEPROM
-#define CONFIG_CMD_ELF
-#define CONFIG_CMD_FAT
-#define CONFIG_CMD_I2C
-#define CONFIG_CMD_IRQ
-#define CONFIG_CMD_MII
 #define CONFIG_CMD_NAND
-#define CONFIG_CMD_NET
-#define CONFIG_CMD_NFS
-#define CONFIG_CMD_PCI
-#define CONFIG_CMD_PING
-#define CONFIG_CMD_REGINFO
 #define CONFIG_CMD_USB
 
 /*
 #undef CONFIG_CMD_IMLS
 #endif
 
-#undef CONFIG_WATCHDOG                                 /* watchdog disabled            */
-
-/*-----------------------------------------------------------------------
- * Miscellaneous configurable options
- *----------------------------------------------------------------------*/
-#define CFG_LONGHELP                   /* undef to save memory         */
-#define CFG_PROMPT             "=> "   /* Monitor Command Prompt       */
-#if defined(CONFIG_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 */
-
-/*
- * 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 */
-
 /*-----------------------------------------------------------------------
  * NAND FLASH
  *----------------------------------------------------------------------*/
 #define CFG_GPIO1_TSRL         0x00000000
 #define CFG_GPIO1_TSRH         0x00000000
 
-/*
- * Internal Definitions
- *
- * Boot Flags
- */
-#define BOOTFLAG_COLD  0x01            /* Normal Power-On: Boot from FLASH     */
-#define BOOTFLAG_WARM  0x02            /* Software reboot                      */
-
-#if defined(CONFIG_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
-
-/* pass open firmware flat tree */
-#define CONFIG_OF_LIBFDT       1
-#define CONFIG_OF_BOARD_SETUP  1
-
 #endif /* __CONFIG_H */
index 3e906c4251570833c7528db4de4356ded6a2193d..fb6feb52749be94bd7560e54ecdfb91ce19e19ed 100644 (file)
@@ -33,7 +33,6 @@
 #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()   */
-#undef CFG_DRAM_TEST                       /* Disable-takes long time! */
 #define CONFIG_SYS_CLK_FREQ    33333333    /* external freq to pll     */
 #define CONFIG_4xx_DCACHE              /* Enable i- and d-cache        */
 
diff --git a/include/configs/amcc-common.h b/include/configs/amcc-common.h
new file mode 100644 (file)
index 0000000..1f27d78
--- /dev/null
@@ -0,0 +1,259 @@
+/*
+ * (C) Copyright 2008
+ * Stefan Roese, DENX Software Engineering, sr@denx.de.
+ *
+ * Common configuration options for all AMCC boards
+ *
+ * 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 __AMCC_COMMON_H
+#define __AMCC_COMMON_H
+
+#define CFG_SDRAM_BASE         0x00000000      /* _must_ be 0          */
+#define CFG_MONITOR_BASE       TEXT_BASE       /* Start of U-Boot      */
+#define CFG_MONITOR_LEN                (0xFFFFFFFF - CFG_MONITOR_BASE + 1)
+#define CFG_MALLOC_LEN         (1 << 20)       /* Reserved for malloc  */
+
+/*
+ * UART
+ */
+#define CONFIG_BAUDRATE                115200
+#define CONFIG_SERIAL_MULTI
+#define CFG_BAUDRATE_TABLE  \
+    {300, 600, 1200, 2400, 4800, 9600, 19200, 38400, 57600, 115200, 230400}
+
+/*
+ * I2C
+ */
+#define CONFIG_HARD_I2C                        /* I2C with hardware support    */
+#define CFG_I2C_SLAVE          0x7F
+
+/*
+ * Ethernet/EMAC/PHY
+ */
+#define CONFIG_MII                     /* MII PHY management           */
+#define CONFIG_NET_MULTI
+#define CONFIG_NETCONSOLE              /* include NetConsole support   */
+#if defined(CONFIG_440)
+#define CFG_RX_ETH_BUFFER      32      /* number of eth rx buffers     */
+#else
+#define CFG_RX_ETH_BUFFER      16      /* number of eth rx buffers     */
+#endif
+
+/*
+ * Commands
+ */
+#include <config_cmd_default.h>
+
+#define CONFIG_CMD_ASKENV
+#if defined(CONFIG_440)
+#define CONFIG_CMD_CACHE
+#endif
+#define CONFIG_CMD_DHCP
+#define CONFIG_CMD_DIAG
+#define CONFIG_CMD_EEPROM
+#define CONFIG_CMD_ELF
+#define CONFIG_CMD_I2C
+#define CONFIG_CMD_IRQ
+#define CONFIG_CMD_MII
+#define CONFIG_CMD_NET
+#define CONFIG_CMD_NFS
+#define CONFIG_CMD_PING
+#define CONFIG_CMD_REGINFO
+
+/*
+ * Miscellaneous configurable options
+ */
+#define CONFIG_BOOTDELAY       5       /* autoboot after 5 seconds     */
+#define CFG_LONGHELP                   /* undef to save memory         */
+#define CFG_PROMPT             "=> "   /* Monitor Command Prompt       */
+#if defined(CONFIG_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)
+#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                  /* To use extended board_into (bd_t) */
+
+#define CFG_HZ                 1000    /* decrementer freq: 1 ms ticks */
+
+#define CONFIG_CMDLINE_EDITING         /* add command line history     */
+#define CONFIG_AUTO_COMPLETE           /* add autocompletion support   */
+#define CONFIG_LOOPW                   /* enable loopw command         */
+#define CONFIG_MX_CYCLIC               /* enable mdc/mwc commands      */
+#define CONFIG_ZERO_BOOTDELAY_CHECK    /* check for keypress on bootdelay==0 */
+#define CONFIG_VERSION_VARIABLE        /* include version env variable */
+#define CFG_CONSOLE_INFO_QUIET         /* don't print console @ startup*/
+
+#define CFG_HUSH_PARSER                        /* Use the HUSH parser          */
+#ifdef CFG_HUSH_PARSER
+#define        CFG_PROMPT_HUSH_PS2     "> "
+#endif
+
+#define CONFIG_LOADS_ECHO              /* echo on for serial download  */
+#define CFG_LOADS_BAUD_CHANGE          /* allow baudrate change        */
+
+/*
+ * BOOTP options
+ */
+#define CONFIG_BOOTP_BOOTFILESIZE
+#define CONFIG_BOOTP_BOOTPATH
+#define CONFIG_BOOTP_GATEWAY
+#define CONFIG_BOOTP_HOSTNAME
+#define CONFIG_BOOTP_SUBNETMASK
+
+/*
+ * 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 */
+
+/*
+ * Internal Definitions
+ */
+#if defined(CONFIG_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
+
+/*
+ * Pass open firmware flat tree
+ */
+#define CONFIG_OF_LIBFDT
+#define CONFIG_OF_BOARD_SETUP
+
+/*
+ * Booting and default environment
+ */
+#define CONFIG_PREBOOT "echo;" \
+       "echo Type \"run flash_nfs\" to mount root filesystem over NFS;" \
+       "echo"
+#define CONFIG_BOOTCOMMAND     "run flash_self"
+
+/*
+ * Only very few boards have default console not on ttyS0 (like Taishan)
+ */
+#if !defined(CONFIG_USE_TTY)
+#define CONFIG_USE_TTY ttyS0
+#endif
+
+/*
+ * Only some 4xx PPC's are equipped with an FPU
+ */
+#if defined(CONFIG_440EP) || defined(CONFIG_440EPX) || \
+    defined(CONFIG_460EX) || defined(CONFIG_460GT)
+#define CONFIG_AMCC_DEF_ENV_ROOTPATH   "rootpath=/opt/eldk/ppc_4xxFP\0"
+#else
+#define CONFIG_AMCC_DEF_ENV_ROOTPATH   "rootpath=/opt/eldk/ppc_4xx\0"
+#endif
+
+/*
+ * Only some boards need to extend the bootargs by some additional
+ * parameters (like Makalu)
+ */
+#if !defined(CONFIG_ADDMISC)
+#define CONFIG_ADDMISC "addmisc=setenv bootargs ${bootargs}\0"
+#endif
+
+#define xstr(s)        str(s)
+#define str(s) #s
+
+/*
+ * General common environment variables shared on all AMCC eval boards
+ */
+#define CONFIG_AMCC_DEF_ENV                                            \
+       "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=" xstr(CONFIG_USE_TTY) ",${baudrate}\0"       \
+       CONFIG_ADDMISC                                                  \
+       "initrd_high=30000000\0"                                        \
+       "kernel_addr_r=400000\0"                                        \
+       "fdt_addr_r=800000\0"                                           \
+       "hostname=" xstr(CONFIG_HOSTNAME) "\0"                          \
+       "bootfile=" xstr(CONFIG_HOSTNAME) "/uImage\0"                   \
+       CONFIG_AMCC_DEF_ENV_ROOTPATH
+
+/*
+ * Default environment for arch/powerpc booting
+ * for boards that are ported to arch/powerpc
+ */
+#define CONFIG_AMCC_DEF_ENV_POWERPC                                    \
+       "flash_self=run ramargs addip addtty addmisc;"                  \
+               "bootm ${kernel_addr} ${ramdisk_addr} ${fdt_addr}\0"    \
+       "flash_nfs=run nfsargs addip addtty addmisc;"                   \
+               "bootm ${kernel_addr} - ${fdt_addr}\0"                  \
+       "net_nfs=tftp ${kernel_addr_r} ${bootfile}; "                   \
+               "tftp ${fdt_addr_r} ${fdt_file}; "                      \
+               "run nfsargs addip addtty addmisc;"                     \
+               "bootm ${kernel_addr_r} - ${fdt_addr_r}\0"              \
+       "fdt_file=" xstr(CONFIG_HOSTNAME) "/" xstr(CONFIG_HOSTNAME) ".dtb\0"
+
+/*
+ * Default environment for arch/ppc booting,
+ * for boards that are not ported to arch/powerpc yet
+ */
+#define CONFIG_AMCC_DEF_ENV_PPC                                                \
+       "flash_self=run ramargs addip addtty addmisc;"                  \
+               "bootm ${kernel_addr} ${ramdisk_addr}\0"                \
+       "flash_nfs=run nfsargs addip addtty addmisc;"                   \
+               "bootm ${kernel_addr}\0"                                \
+       "net_nfs=tftp ${kernel_addr_r} ${bootfile};"                    \
+               "run nfsargs addip addtty addmisc;"                     \
+               "bootm ${kernel_addr_r}\0"
+
+/*
+ * Default environment for arch/ppc booting (old version),
+ * for boards that are ported to arch/ppc and arch/powerpc
+ */
+#define CONFIG_AMCC_DEF_ENV_PPC_OLD                                    \
+       "flash_self_old=run ramargs addip addtty addmisc;"              \
+               "bootm ${kernel_addr} ${ramdisk_addr}\0"                \
+       "flash_nfs_old=run nfsargs addip addtty addmisc;"               \
+               "bootm ${kernel_addr}\0"                                \
+       "net_nfs_old=tftp ${kernel_addr_r} ${bootfile};"                \
+               "run nfsargs addip addtty addmisc;"                     \
+               "bootm ${kernel_addr_r}\0"
+
+#define CONFIG_AMCC_DEF_ENV_NOR_UPD                                    \
+       "load=tftp 200000 " xstr(CONFIG_HOSTNAME) "/u-boot.bin\0"       \
+       "update=protect off " xstr(CFG_MONITOR_BASE) " FFFFFFFF;"       \
+               "era " xstr(CFG_MONITOR_BASE) " FFFFFFFF;"              \
+               "cp.b ${fileaddr} " xstr(CFG_MONITOR_BASE) " ${filesize};" \
+               "setenv filesize;saveenv\0"                             \
+       "upd=run load update\0"                                         \
+
+#define CONFIG_AMCC_DEF_ENV_NAND_UPD                                   \
+       "nload=tftp 200000 " xstr(CONFIG_HOSTNAME) "/u-boot-nand.bin\0" \
+       "nupdate=nand erase 0 100000;nand write 200000 0 100000;"       \
+               "setenv filesize;saveenv\0"                             \
+       "nupd=run nload nupdate\0"
+
+#endif /* __AMCC_COMMON_H */
index 2f0df8ad2d02f5b8e8b8866c6ee978fef1928338..41058f88cf99ef0db75214cafd5d08e51911e750 100644 (file)
 #define CONFIG_4xx             1       /* ... PPC4xx family            */
 #define CONFIG_SYS_CLK_FREQ    33333333    /* external freq to pll     */
 
+/*
+ * Include common defines/options for all AMCC eval boards
+ */
+#define CONFIG_HOSTNAME                bamboo
+#include "amcc-common.h"
+
 #define CONFIG_BOARD_EARLY_INIT_F 1     /* Call board_early_init_f     */
 
 /*
  * Base addresses -- Note these are effective addresses where the
  * actual resources get mapped (not physical addresses)
  *----------------------------------------------------------------------*/
-#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       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*/
 #define CFG_PCI_MEMBASE1        CFG_PCI_MEMBASE  + 0x10000000
  * Serial Port
  *----------------------------------------------------------------------*/
 #define CFG_EXT_SERIAL_CLOCK   11059200 /* use external 11.059MHz clk  */
-#define CONFIG_BAUDRATE                115200
-#define CONFIG_SERIAL_MULTI     1
 /* define this if you want console on UART1 */
 #undef CONFIG_UART1_CONSOLE
 
-#define CFG_BAUDRATE_TABLE  \
-    {300, 600, 1200, 2400, 4800, 9600, 19200, 38400, 57600, 115200}
-
 /*-----------------------------------------------------------------------
  * NVRAM/RTC
  *
 #define SPD_EEPROM_ADDRESS     {CFG_SIMULATE_SPD_EEPROM, 0x50, 0x51}
 #define CFG_MBYTES_SDRAM       (64)    /* 64MB fixed size for early-sdram-init */
 #define CONFIG_PROG_SDRAM_TLB
-#undef  CFG_DRAM_TEST
 
 /*-----------------------------------------------------------------------
  * 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_ENV_OFFSET         0x0
 #endif /* CFG_ENV_IS_IN_EEPROM */
 
-#define CONFIG_PREBOOT "echo;" \
-       "echo Type \\\"run flash_nfs\\\" to mount root filesystem over NFS;" \
-       "echo"
-
-#undef CONFIG_BOOTARGS
-
+/*
+ * Default environment variables
+ */
 #define        CONFIG_EXTRA_ENV_SETTINGS                                       \
-       "netdev=eth0\0"                                                 \
-       "hostname=bamboo\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=ttyS0,${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_4xx\0"                                  \
-       "bootfile=/tftpboot/bamboo/uImage\0"                            \
+       CONFIG_AMCC_DEF_ENV                                             \
+       CONFIG_AMCC_DEF_ENV_POWERPC                                     \
+       CONFIG_AMCC_DEF_ENV_PPC_OLD                                     \
+       CONFIG_AMCC_DEF_ENV_NOR_UPD                                     \
+       CONFIG_AMCC_DEF_ENV_NAND_UPD                                    \
        "kernel_addr=fff00000\0"                                        \
        "ramdisk_addr=fff10000\0"                                       \
-       "initrd_high=30000000\0"                                        \
-       "load=tftp 100000 /tftpboot/bamboo/u-boot.bin\0"                \
-       "update=protect off fffa0000 ffffffff;era fffa0000 ffffffff;"   \
-               "cp.b 100000 fffa0000 60000;"                           \
-               "setenv filesize;saveenv\0"                             \
-       "upd=run load 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_BAUDRATE                115200
-
-#define CONFIG_LOADS_ECHO      1       /* echo on for serial download  */
-#define CFG_LOADS_BAUD_CHANGE  1       /* allow baudrate change        */
 
 #define CONFIG_HAS_ETH0
-#define CONFIG_MII             1       /* MII PHY management           */
 #define CONFIG_PHY_ADDR                0       /* PHY address, See schematics  */
 #define CONFIG_PHY1_ADDR        1
 
 #define CONFIG_HAS_ETH1                1       /* add support for "eth1addr"   */
 #endif /* CONFIG_BAMBOO_NAND */
 
-#define CFG_RX_ETH_BUFFER      32      /* Number of ethernet rx buffers & descriptors */
-
-#define CONFIG_NETCONSOLE              /* include NetConsole support   */
-#define CONFIG_NET_MULTI        1       /* required for netconsole      */
-
-/* Partitions */
-#define CONFIG_MAC_PARTITION
-#define CONFIG_DOS_PARTITION
-#define CONFIG_ISO_PARTITION
-
 #ifdef CONFIG_440EP
 /* USB */
 #define CONFIG_USB_OHCI
 #define USB_2_0_DEVICE
 #endif /*CONFIG_440EP*/
 
-
 /*
- * BOOTP options
+ * Commands additional to the ones defined in amcc-common.h
  */
-#define CONFIG_BOOTP_BOOTFILESIZE
-#define CONFIG_BOOTP_BOOTPATH
-#define CONFIG_BOOTP_GATEWAY
-#define CONFIG_BOOTP_HOSTNAME
-
-
-/*
- * Command line configuration.
- */
-#include <config_cmd_default.h>
-
-
-#define CONFIG_CMD_ASKENV
 #define CONFIG_CMD_DATE
-#define CONFIG_CMD_DHCP
-#define CONFIG_CMD_DIAG
-#define CONFIG_CMD_ELF
-#define CONFIG_CMD_EEPROM
-#define CONFIG_CMD_I2C
-#define CONFIG_CMD_IRQ
-#define CONFIG_CMD_MII
-#define CONFIG_CMD_NET
-#define CONFIG_CMD_NFS
+#define CONFIG_CMD_EXT2
+#define CONFIG_CMD_FAT
 #define CONFIG_CMD_PCI
-#define CONFIG_CMD_PING
-#define CONFIG_CMD_REGINFO
 #define CONFIG_CMD_SDRAM
-#define CONFIG_CMD_USB
-#define CONFIG_CMD_FAT
-#define CONFIG_CMD_EXT2
 #define CONFIG_CMD_SNTP
+#define CONFIG_CMD_USB
 
 #ifdef CONFIG_BAMBOO_NAND
 #define CONFIG_CMD_NAND
 #endif
 
-
 #define CONFIG_SUPPORT_VFAT
 
-/*
- * Miscellaneous configurable options
- */
-#define CFG_LONGHELP                   /* undef to save memory         */
-#define CFG_PROMPT             "=> "   /* Monitor Command Prompt       */
-#if defined(CONFIG_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 CONFIG_LYNXKDI          1       /* support kdi files            */
-
-#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 */
+/* Partitions */
+#define CONFIG_MAC_PARTITION
+#define CONFIG_DOS_PARTITION
+#define CONFIG_ISO_PARTITION
 
 /*-----------------------------------------------------------------------
  * PCI stuff
 #define CFG_PCI_SUBSYS_VENDORID 0x10e8 /* AMCC */
 #define CFG_PCI_SUBSYS_ID       0xcafe /* Whatever */
 
-/*
- * 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 */
-
-/*
- * Internal Definitions
- *
- * Boot Flags
- */
-#define BOOTFLAG_COLD  0x01            /* Normal Power-On: Boot from FLASH     */
-#define BOOTFLAG_WARM  0x02            /* Software reboot                      */
-
-#if defined(CONFIG_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
-
-/* pass open firmware flat tree */
-#define CONFIG_OF_LIBFDT       1
-#define CONFIG_OF_BOARD_SETUP  1
-
 #endif /* __CONFIG_H */
index 75dd4e7e67772a9bb25b79bbfdd57906c66e64b9..acce82f621159f896143dd8a2bf1444a640c983a 100644 (file)
 #define CONFIG_4xx             1       /* ...member of PPC4xx family   */
 #define CONFIG_BUBINGA         1       /* ...on a BUBINGA board        */
 
+/*
+ * Include common defines/options for all AMCC eval boards
+ */
+#define CONFIG_HOSTNAME                bubinga
+#include "amcc-common.h"
+
 #define CONFIG_BOARD_EARLY_INIT_F 1    /* Call board_early_init_f      */
 
 #define CONFIG_SYS_CLK_FREQ     33333333 /* external frequency to pll   */
 #define CFG_ENV_IS_IN_NVRAM    1       /* use NVRAM for environment vars       */
 #endif
 
-#define CONFIG_PREBOOT "echo;" \
-       "echo Type \\\"run flash_nfs\\\" to mount root filesystem over NFS;" \
-       "echo"
-
-#undef CONFIG_BOOTARGS
-
+/*
+ * Default environment variables
+ */
 #define        CONFIG_EXTRA_ENV_SETTINGS                                       \
-       "netdev=eth0\0"                                                 \
-       "hostname=bubinga\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=ttyS0,${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_4xx\0"                                  \
-       "bootfile=/tftpboot/bubinga/uImage\0"                           \
+       CONFIG_AMCC_DEF_ENV                                             \
+       CONFIG_AMCC_DEF_ENV_PPC                                         \
+       CONFIG_AMCC_DEF_ENV_NOR_UPD                                     \
        "kernel_addr=fff80000\0"                                        \
        "ramdisk_addr=fff90000\0"                                       \
-       "initrd_high=30000000\0"                                        \
-       "load=tftp 100000 /tftpboot/bubinga/u-boot.bin\0"               \
-       "update=protect off fffc0000 ffffffff;era fffc0000 ffffffff;"   \
-               "cp.b 100000 fffc0000 40000;"                           \
-               "setenv filesize;saveenv\0"                             \
-       "upd=run load update\0"                                         \
        ""
-#define CONFIG_BOOTCOMMAND     "run net_nfs"
-
-#if 0
-#define CONFIG_BOOTDELAY       -1      /* autoboot disabled            */
-#else
-#define CONFIG_BOOTDELAY       5       /* autoboot after 5 seconds     */
-#endif
-
-#define CONFIG_BAUDRATE                115200
 
-#define CONFIG_LOADS_ECHO      1       /* echo on for serial download  */
-#define CFG_LOADS_BAUD_CHANGE  1       /* allow baudrate change        */
-
-#define CONFIG_MII             1       /* MII PHY management           */
 #define        CONFIG_PHY_ADDR         1       /* PHY address                  */
 #define CONFIG_HAS_ETH0
 #define CONFIG_HAS_ETH1
 #define CONFIG_PHY1_ADDR       2       /* EMAC1 PHY address            */
-#define CONFIG_NET_MULTI       1
-#define CFG_RX_ETH_BUFFER      16      /* Number of ethernet rx buffers & descriptors */
-
-#define CONFIG_NETCONSOLE              /* include NetConsole support   */
 
 #define CONFIG_RTC_DS174x      1       /* use DS1743 RTC in Bubinga    */
 
-
-/*
- * BOOTP options
- */
-#define CONFIG_BOOTP_BOOTFILESIZE
-#define CONFIG_BOOTP_BOOTPATH
-#define CONFIG_BOOTP_GATEWAY
-#define CONFIG_BOOTP_HOSTNAME
-
-
 /*
- * Command line configuration.
+ * Commands additional to the ones defined in amcc-common.h
  */
-#include <config_cmd_default.h>
-
-#define CONFIG_CMD_ASKENV
-#define CONFIG_CMD_CACHE
 #define CONFIG_CMD_DATE
-#define CONFIG_CMD_DHCP
-#define CONFIG_CMD_EEPROM
-#define CONFIG_CMD_ELF
-#define CONFIG_CMD_I2C
-#define CONFIG_CMD_IRQ
-#define CONFIG_CMD_MII
-#define CONFIG_CMD_NET
 #define CONFIG_CMD_PCI
-#define CONFIG_CMD_PING
-#define CONFIG_CMD_REGINFO
 #define CONFIG_CMD_SDRAM
 #define CONFIG_CMD_SNTP
 
-
-#undef CONFIG_WATCHDOG                 /* watchdog disabled            */
-
 #define CONFIG_SPD_EEPROM      1       /* use SPD EEPROM for setup    */
 
-/*
- * Miscellaneous configurable options
- */
-#define CFG_LONGHELP                   /* undef to save memory         */
-#define CFG_PROMPT     "=> "           /* Monitor Command Prompt       */
-#if defined(CONFIG_CMD_KGDB)
-#define        CFG_CBSIZE      1024            /* Console I/O Buffer Size      */
-#else
-#define        CFG_CBSIZE      256             /* Console I/O Buffer Size      */
-#endif
-#define CFG_PBSIZE (CFG_CBSIZE+sizeof(CFG_PROMPT)+16) /* Print Buffer Size */
-#define CFG_MAXARGS    16              /* max number of command args   */
-#define CFG_BARGSIZE   CFG_CBSIZE      /* Boot Argument Buffer Size    */
-
-#define CFG_MEMTEST_START      0x0400000       /* memtest works on     */
-#define CFG_MEMTEST_END                0x0C00000       /* 4 ... 12 MB in DRAM  */
-
 /*
  * If CFG_EXT_SERIAL_CLOCK, then the UART divisor is 1.
  * If CFG_405_UART_ERRATA_59, then UART divisor is 31.
 #undef  CFG_405_UART_ERRATA_59         /* 405GP/CR Rev. D silicon */
 #define CFG_BASE_BAUD       691200
 
-/* The following table includes the supported baudrates */
-#define CFG_BAUDRATE_TABLE  \
-    {300, 600, 1200, 2400, 4800, 9600, 19200, 38400, 57600, 115200, 230400}
-
-#define CFG_LOAD_ADDR          0x100000        /* default load address */
-#define CFG_EXTBDINFO          1       /* To use extended board_into (bd_t) */
-
-#define        CFG_HZ          1000            /* decrementer freq: 1 ms ticks */
-
-#define CONFIG_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 */
-
 /*-----------------------------------------------------------------------
  * I2C stuff
  *-----------------------------------------------------------------------
  */
-#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_NOPROBES       { 0x69 }        /* avoid iprobe hangup (why?) */
 #define CFG_EEPROM_PAGE_WRITE_DELAY_MS 6       /* 24C02 requires 5ms delay */
 /*-----------------------------------------------------------------------
  * Start addresses for the final memory configuration
  * (Set up by the startup code)
- * Please note that CFG_SDRAM_BASE _must_ start at 0
  */
-#define CFG_SDRAM_BASE         0x00000000
 #define CFG_SRAM_BASE          0xFFF00000
 #define CFG_FLASH_BASE         0xFFF80000
-#define CFG_MONITOR_LEN                (256 * 1024)    /* Reserve 256 kB for Monitor   */
-#define CFG_MALLOC_LEN         (128 * 1024)    /* Reserve 128 kB for malloc()  */
-#define CFG_MONITOR_BASE       (-CFG_MONITOR_LEN)
-
-/*
- * For booting Linux, the board info and command line data
- * have to be in the first 8 MB of memory, since this is
- * the maximum mapped by the Linux kernel during initialization.
- */
-#define CFG_BOOTMAPSZ          (8 << 20)       /* Initial Memory map for Linux */
 
 /*-----------------------------------------------------------------------
  * FLASH organization
 #define FPGA_REG1_OFFB_FLASH  0x02       /* Off board flash                   */
 #define FPGA_REG1_SRAM_BOOT   0x01       /* SRAM at 0xFFF80000 not Flash      */
 
-/*
- * Internal Definitions
- *
- * Boot Flags
- */
-#define BOOTFLAG_COLD  0x01            /* Normal Power-On: Boot from FLASH     */
-#define BOOTFLAG_WARM  0x02            /* Software reboot                      */
-
-#if defined(CONFIG_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
-
-/* pass open firmware flat tree */
-#define CONFIG_OF_LIBFDT       1
-#define CONFIG_OF_BOARD_SETUP  1
-
 #endif /* __CONFIG_H */
index 3dd577aae7f9e00ccf157d2295d81d31d26d6660..ac2e5d99e01401234508a994bc2dba55bba810f9 100644 (file)
 /* This config file is used for Canyonlands (460EX) and Glacier (460GT)        */
 #ifndef CONFIG_CANYONLANDS
 #define CONFIG_460GT           1       /* Specific PPC460GT            */
+#define CONFIG_HOSTNAME                glacier
 #else
 #define CONFIG_460EX           1       /* Specific PPC460EX            */
+#define CONFIG_HOSTNAME                canyonlands
 #endif
 #define CONFIG_440             1
 #define CONFIG_4xx             1       /* ... PPC4xx family */
 
+/*
+ * Include common defines/options for all AMCC eval boards
+ */
+#include "amcc-common.h"
+
 #define CONFIG_SYS_CLK_FREQ    66666667        /* external freq to pll */
 
 #define CONFIG_BOARD_EARLY_INIT_F      1       /* Call board_early_init_f */
@@ -47,8 +54,6 @@
  * Base addresses -- Note these are effective addresses where the
  * actual resources get mapped (not physical addresses)
  *----------------------------------------------------------------------*/
-#define CFG_SDRAM_BASE         0x00000000      /* _must_ be 0  */
-
 #define CFG_PCI_MEMBASE                0x80000000      /* mapped PCI memory    */
 #define CFG_PCI_BASE           0xd0000000      /* internal PCI regs    */
 #define CFG_PCI_TARGBASE       CFG_PCI_MEMBASE
 
 #define CFG_AHB_BASE           0xE2000000      /* internal AHB peripherals     */
 
-#define CFG_MONITOR_BASE       TEXT_BASE
-#define CFG_MONITOR_LEN                (384 * 1024)    /* Reserve 384 kB for Monitor */
-#define CFG_MALLOC_LEN         (512 * 1024)    /* Reserve 512 kB for malloc()*/
-
 /*-----------------------------------------------------------------------
  * Initial RAM & stack pointer (placed in OCM)
  *----------------------------------------------------------------------*/
 /*-----------------------------------------------------------------------
  * Serial Port
  *----------------------------------------------------------------------*/
-#define CONFIG_BAUDRATE                115200
-#define CONFIG_SERIAL_MULTI    1
 #undef CONFIG_UART1_CONSOLE    /* define this if you want console on UART1 */
 
-#define CFG_BAUDRATE_TABLE  \
-    {300, 600, 1200, 2400, 4800, 9600, 19200, 38400, 57600, 115200}
-
 /*-----------------------------------------------------------------------
  * Environment
  *----------------------------------------------------------------------*/
 /*-----------------------------------------------------------------------
  * 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_SPEED          400000  /* I2C speed                    */
 
 #define CFG_I2C_MULTI_EEPROMS
 #define CFG_I2C_EEPROM_ADDR            (0xa8>>1)
  * Ethernet
  *----------------------------------------------------------------------*/
 #define CONFIG_IBM_EMAC4_V4    1
-#define CONFIG_MII             1       /* MII PHY management           */
 #define CONFIG_PHY_ADDR                0       /* PHY address, See schematics  */
 #define CONFIG_PHY1_ADDR       1
 #define CONFIG_HAS_ETH0
 #define CONFIG_HAS_ETH2
 #define CONFIG_HAS_ETH3
 #endif
-#define CONFIG_NET_MULTI       1
 
 #define CONFIG_PHY_RESET       1       /* reset phy upon startup       */
 #define CONFIG_PHY_GIGE                1       /* Include GbE speed/duplex detection */
 #define CONFIG_PHY_DYNAMIC_ANEG        1
 
-#define CFG_RX_ETH_BUFFER      32      /* Number of ethernet rx buffers & descriptors */
-
 /*-----------------------------------------------------------------------
  * USB-OHCI
  *----------------------------------------------------------------------*/
 #define CFG_USB_OHCI_MAX_ROOT_PORTS 15
 #endif
 
-/*-----------------------------------------------------------------------
- * Default environment
- *----------------------------------------------------------------------*/
-#define CONFIG_PREBOOT "echo;" \
-       "echo Type \"run flash_nfs\" to mount root filesystem over NFS;" \
-       "echo"
-
-#undef CONFIG_BOOTARGS
-
-/* Setup some board specific values for the default environment variables */
-#ifdef CONFIG_CANYONLANDS
-#define CONFIG_HOSTNAME                canyonlands
-#define CFG_BOOTFILE           "bootfile=canyonlands/uImage\0"
-#define CFG_DTBFILE            "fdt_file=canyonlands/canyonlands.dtb\0"
-#define CFG_ROOTPATH           "rootpath=/opt/eldk/ppc_4xxFP\0"
-#else
-#define CONFIG_HOSTNAME                glacier
-#define CFG_BOOTFILE           "bootfile=glacier/uImage\0"
-#define CFG_DTBFILE            "fdt_file=glacier/glacier.dtb\0"
-#define CFG_ROOTPATH           "rootpath=/opt/eldk/ppc_4xx\0"
-#endif
-
+/*
+ * Default environment variables
+ */
 #define        CONFIG_EXTRA_ENV_SETTINGS                                       \
-       CFG_BOOTFILE                                                    \
-       CFG_DTBFILE                                                     \
-       CFG_ROOTPATH                                                    \
-       "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=ttyS0,${baudrate}\0"\
-       "flash_self=run ramargs addip addtty;"                          \
-               "bootm ${kernel_addr} ${ramdisk_addr} ${fdt_addr}\0"    \
-       "flash_nfs=run nfsargs addip addtty;"                           \
-               "bootm ${kernel_addr} - ${fdt_addr}\0"                  \
-       "net_nfs=tftp ${kernel_addr_r} ${bootfile}; "                   \
-               "tftp ${fdt_addr_r} ${fdt_file}; "                      \
-               "run nfsargs addip addtty;"                             \
-               "bootm ${kernel_addr_r} - ${fdt_addr_r}\0"              \
-       "kernel_addr_r=400000\0"                                        \
-       "fdt_addr_r=800000\0"                                           \
+       CONFIG_AMCC_DEF_ENV                                             \
+       CONFIG_AMCC_DEF_ENV_POWERPC                                     \
+       CONFIG_AMCC_DEF_ENV_NOR_UPD                                     \
+       CONFIG_AMCC_DEF_ENV_NAND_UPD                                    \
        "kernel_addr=fc000000\0"                                        \
        "fdt_addr=fc1e0000\0"                                           \
        "ramdisk_addr=fc200000\0"                                       \
-       "initrd_high=30000000\0"                                        \
-       "load=tftp 200000 ${hostname}/u-boot.bin\0"                     \
-       "update=protect off fffa0000 ffffffff;era fffa0000 ffffffff;"   \
-               "cp.b ${fileaddr} fffa0000 ${filesize};"                \
-               "setenv filesize;saveenv\0"                             \
-       "upd=run load update\0"                                         \
-       "nload=tftp 200000 ${hostname}/u-boot-nand.bin\0"               \
-       "nupdate=nand erase 0 100000;nand write 200000 0 100000;"       \
-               "setenv filesize;saveenv\0"                             \
-       "nupd=run nload nupdate\0"                                      \
        "pciconfighost=1\0"                                             \
        "pcie_mode=RP:RP\0"                                             \
        ""
-#define CONFIG_BOOTCOMMAND     "run flash_self"
-
-#define CONFIG_BOOTDELAY       5       /* autoboot after 5 seconds     */
-
-#define CONFIG_LOADS_ECHO      1       /* echo on for serial download  */
-#define CFG_LOADS_BAUD_CHANGE          /* allow baudrate change        */
 
 /*
- * BOOTP options
+ * Commands additional to the ones defined in amcc-common.h
  */
-#define CONFIG_BOOTP_BOOTFILESIZE
-#define CONFIG_BOOTP_BOOTPATH
-#define CONFIG_BOOTP_GATEWAY
-#define CONFIG_BOOTP_HOSTNAME
-#define CONFIG_BOOTP_SUBNETMASK
-
-/*
- * Command line configuration.
- */
-#include <config_cmd_default.h>
-
-#define CONFIG_CMD_ASKENV
 #define CONFIG_CMD_DATE
-#define CONFIG_CMD_DHCP
 #define CONFIG_CMD_DTT
-#define CONFIG_CMD_DIAG
-#define CONFIG_CMD_EEPROM
-#define CONFIG_CMD_ELF
-#define CONFIG_CMD_I2C
-#define CONFIG_CMD_IRQ
-#define CONFIG_CMD_MII
 #define CONFIG_CMD_NAND
-#define CONFIG_CMD_NET
-#define CONFIG_CMD_NFS
 #define CONFIG_CMD_PCI
-#define CONFIG_CMD_PING
-#define CONFIG_CMD_REGINFO
 #define CONFIG_CMD_SDRAM
+#define CONFIG_CMD_SNTP
 #ifdef CONFIG_460EX
 #define CONFIG_CMD_EXT2
 #define CONFIG_CMD_FAT
 #define CONFIG_DOS_PARTITION
 #define CONFIG_ISO_PARTITION
 
-/*-----------------------------------------------------------------------
- * Miscellaneous configurable options
- *----------------------------------------------------------------------*/
-#define CFG_LONGHELP                   /* undef to save memory         */
-#define CFG_PROMPT             "=> "   /* Monitor Command Prompt       */
-#if defined(CONFIG_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_AUTO_COMPLETE   1       /* add autocompletion support   */
-#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 */
-#define CFG_CONSOLE_INFO_QUIET 1       /* don't print console @ startup*/
-
-#define CFG_HUSH_PARSER                1       /* Use the HUSH parser          */
-#ifdef CFG_HUSH_PARSER
-#define        CFG_PROMPT_HUSH_PS2     "> "
-#endif
-
 /*-----------------------------------------------------------------------
  * PCI stuff
  *----------------------------------------------------------------------*/
 #define CFG_PCI_SUBSYS_VENDORID 0x1014 /* IBM                          */
 #define CFG_PCI_SUBSYS_DEVICEID 0xcafe /* Whatever                     */
 
-/*
- * 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 */
-
-/*
- * Internal Definitions
- */
-#if defined(CONFIG_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
-
 /*-----------------------------------------------------------------------
  * External Bus Controller (EBC) Setup
  *----------------------------------------------------------------------*/
 }
 #endif
 
-/* pass open firmware flat tree */
-#define CONFIG_OF_LIBFDT       1
-#define CONFIG_OF_BOARD_SETUP  1
-
 #endif /* __CONFIG_H */
index ba68fd4b9674a48678e18056d4ed1a6a49607fc5..df444d8e9613aa7ecc084e8e3038a51b2cb3ca4e 100644 (file)
 #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 CONFIG_SYS_CLK_FREQ    33333333    /* external freq to pll     */
 
+/*
+ * Include common defines/options for all AMCC eval boards
+ */
+#define CONFIG_HOSTNAME                ebony
+#include "amcc-common.h"
+
 /*
  * Define here the location of the environment variables (FLASH or NVRAM).
  * Note: DENX encourages to use redundant environment in FLASH. NVRAM is only
@@ -55,7 +60,6 @@
  *----------------------------------------------------------------------*/
 #define CFG_SDRAM_BASE     0x00000000      /* _must_ be 0              */
 #define CFG_FLASH_BASE     0xff800000      /* start of FLASH           */
-#define CFG_MONITOR_BASE    0xfffc0000     /* start of monitor         */
 #define CFG_PCI_MEMBASE            0x80000000      /* mapped pci memory        */
 #define CFG_PERIPHERAL_BASE 0xe0000000     /* internal peripherals     */
 #define CFG_ISRAM_BASE     0xc0000000      /* internal SRAM            */
 #define CFG_GBL_DATA_OFFSET    (CFG_INIT_RAM_END - CFG_GBL_DATA_SIZE)
 #define CFG_INIT_SP_OFFSET     CFG_GBL_DATA_OFFSET
 
-#define CFG_MONITOR_LEN            (256 * 1024)    /* Reserve 256 kB for Mon   */
-#define CFG_MALLOC_LEN     (128 * 1024)    /* Reserve 128 kB for malloc*/
-
 /*-----------------------------------------------------------------------
  * Serial Port
  *----------------------------------------------------------------------*/
 #undef CONFIG_SERIAL_SOFTWARE_FIFO
 #define CFG_EXT_SERIAL_CLOCK   (1843200 * 6)   /* Ext clk @ 11.059 MHz */
-#define CONFIG_BAUDRATE                115200
-
-#define CFG_BAUDRATE_TABLE  \
-    {300, 600, 1200, 2400, 4800, 9600, 19200, 38400}
 
 /*-----------------------------------------------------------------------
  * NVRAM/RTC
 /*-----------------------------------------------------------------------
  * 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_EEPROM_PAGE_WRITE_BITS 3
 #define CFG_EEPROM_PAGE_WRITE_DELAY_MS 10
 
-#define CONFIG_PREBOOT "echo;" \
-       "echo Type \\\"run flash_nfs\\\" to mount root filesystem over NFS;" \
-       "echo"
-
-#undef CONFIG_BOOTARGS
-
+/*
+ * Default environment variables
+ */
 #define        CONFIG_EXTRA_ENV_SETTINGS                                       \
-       "netdev=eth0\0"                                                 \
-       "hostname=ebony\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=ttyS0,${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_4xx\0"                                  \
-       "bootfile=/tftpboot/ebony/uImage\0"                             \
+       CONFIG_AMCC_DEF_ENV                                             \
+       CONFIG_AMCC_DEF_ENV_POWERPC                                     \
+       CONFIG_AMCC_DEF_ENV_PPC_OLD                                     \
+       CONFIG_AMCC_DEF_ENV_NOR_UPD                                     \
        "kernel_addr=ff800000\0"                                        \
        "ramdisk_addr=ff810000\0"                                       \
-       "initrd_high=30000000\0"                                        \
-       "load=tftp 100000 /tftpboot/ebony/u-boot.bin\0"                 \
-       "update=protect off fffc0000 ffffffff;era fffc0000 ffffffff;"   \
-               "cp.b 100000 fffc0000 40000;"                           \
-               "setenv filesize;saveenv\0"                             \
-       "upd=run load 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_BAUDRATE                115200
-
-#define CONFIG_LOADS_ECHO      1       /* echo on for serial download  */
-#define CFG_LOADS_BAUD_CHANGE  1       /* allow baudrate change        */
-
-#define CONFIG_MII             1       /* MII PHY management           */
 #define CONFIG_PHY_ADDR                8       /* PHY address                  */
 #define CONFIG_HAS_ETH0
 #define CONFIG_HAS_ETH1
 #define CONFIG_PHY1_ADDR       9       /* EMAC1 PHY address            */
-#define CONFIG_NET_MULTI       1
-#define CFG_RX_ETH_BUFFER      32      /* Number of ethernet rx buffers & descriptors */
-
-#define CONFIG_NETCONSOLE              /* include NetConsole support   */
-
 
 /*
- * BOOTP options
+ * Commands additional to the ones defined in amcc-common.h
  */
-#define CONFIG_BOOTP_BOOTFILESIZE
-#define CONFIG_BOOTP_BOOTPATH
-#define CONFIG_BOOTP_GATEWAY
-#define CONFIG_BOOTP_HOSTNAME
-
-
-/*
- * Command line configuration.
- */
-#include <config_cmd_default.h>
-
-#define CONFIG_CMD_ASKENV
 #define CONFIG_CMD_DATE
-#define CONFIG_CMD_DHCP
-#define CONFIG_CMD_DIAG
-#define CONFIG_CMD_ELF
-#define CONFIG_CMD_EEPROM
-#define CONFIG_CMD_I2C
-#define CONFIG_CMD_IRQ
-#define CONFIG_CMD_MII
-#define CONFIG_CMD_NET
-#define CONFIG_CMD_NFS
 #define CONFIG_CMD_PCI
-#define CONFIG_CMD_PING
-#define CONFIG_CMD_REGINFO
 #define CONFIG_CMD_SDRAM
 #define CONFIG_CMD_SNTP
 
-
-#undef CONFIG_WATCHDOG                 /* watchdog disabled            */
-
-/*
- * Miscellaneous configurable options
- */
-#define CFG_LONGHELP                   /* undef to save memory         */
-#define CFG_PROMPT     "=> "           /* Monitor Command Prompt       */
-#if defined(CONFIG_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
  *-----------------------------------------------------------------------
 #define CFG_PCI_SUBSYS_VENDORID 0x10e8 /* AMCC */
 #define CFG_PCI_SUBSYS_DEVICEID 0xcafe  /* Whatever */
 
-/*
- * 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 */
-
-/*
- * Internal Definitions
- *
- * Boot Flags
- */
-#define BOOTFLAG_COLD  0x01            /* Normal Power-On: Boot from FLASH     */
-#define BOOTFLAG_WARM  0x02            /* Software reboot                      */
-
-#if defined(CONFIG_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
-
-/* pass open firmware flat tree */
-#define CONFIG_OF_LIBFDT       1
-#define CONFIG_OF_BOARD_SETUP  1
-
 #endif /* __CONFIG_H */
index cce883fd85ff344c03511dcc26148cfaf80bbded..d3789bd67a89fac1c1b835d1ed2511faacd22a69 100644 (file)
 #define CONFIG_4xx                     1       /* ... PPC4xx family    */
 #define CONFIG_440                     1       /* ... PPC440 family    */
 #define CONFIG_440SPE                  1       /* Specifc SPe support  */
-#undef CFG_DRAM_TEST                           /* Disable-takes long time */
 #define CONFIG_SYS_CLK_FREQ    33333333        /* external freq to pll */
+#define CFG_4xx_RESET_TYPE     0x2     /* use chip reset on this board */
+
+/*
+ * Include common defines/options for all AMCC eval boards
+ */
+#define CONFIG_HOSTNAME                katmai
+#include "amcc-common.h"
 
 #define CONFIG_BOARD_EARLY_INIT_F 1    /* Call board_pre_init          */
 #define        CONFIG_MISC_INIT_F      1       /* Use misc_init_f()            */
@@ -48,7 +54,6 @@
  * Base addresses -- Note these are effective addresses where the
  * actual resources get mapped (not physical addresses)
  *----------------------------------------------------------------------*/
-#define CFG_SDRAM_BASE         0x00000000      /* _must_ be 0          */
 #define CFG_FLASH_BASE         0xff000000      /* start of FLASH       */
 #define CFG_PERIPHERAL_BASE    0xa0000000      /* internal peripherals */
 #define CFG_ISRAM_BASE         0x90000000      /* internal SRAM        */
 
 #define CFG_ACE_BASE           0xfe000000      /* Xilinx ACE controller - Compact Flash */
 
-#define CFG_MONITOR_BASE       TEXT_BASE
-#define CFG_MONITOR_LEN                (0xFFFFFFFF - CFG_MONITOR_BASE + 1)
-#define CFG_MALLOC_LEN         (512 * 1024)    /* Reserve 512 kB for malloc */
-
 /*-----------------------------------------------------------------------
  * Initial RAM & stack pointer (placed in internal SRAM)
  *----------------------------------------------------------------------*/
 /*-----------------------------------------------------------------------
  * Serial Port
  *----------------------------------------------------------------------*/
-#define CONFIG_SERIAL_MULTI    1
 #undef CONFIG_UART1_CONSOLE
 #undef CFG_EXT_SERIAL_CLOCK
-#define CONFIG_BAUDRATE                115200
-#define CFG_BAUDRATE_TABLE  \
-       {300, 600, 1200, 2400, 4800, 9600, 19200, 38400, 57600, 115200}
 
 /*-----------------------------------------------------------------------
  * DDR SDRAM
 /*-----------------------------------------------------------------------
  * I2C
  *----------------------------------------------------------------------*/
-#define CONFIG_HARD_I2C                1       /* I2C with hardware support    */
-#undef CONFIG_SOFT_I2C                 /* I2C bit-banged               */
 #define CFG_I2C_SPEED          100000  /* I2C speed and slave address  */
-#define CFG_I2C_SLAVE          0x7F
 
 #define CONFIG_I2C_MULTI_BUS
 #define CONFIG_I2C_CMD_TREE
  *----------------------------------------------------------------------*/
 #define        CFG_ENV_IS_IN_FLASH     1       /* Environment uses flash       */
 
-#define CONFIG_PREBOOT "echo;" \
-       "echo Type \\\"run flash_nfs\\\" to mount root filesystem over NFS;" \
-       "echo"
-
-#undef CONFIG_BOOTARGS
-
-#define xstr(s) str(s)
-#define str(s) #s
-
+/*
+ * Default environment variables
+ */
 #define        CONFIG_EXTRA_ENV_SETTINGS                                       \
-       "netdev=eth0\0"                                                 \
-       "hostname=katmai\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=ttyS0,${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"                                               \
-       "net_nfs_fdt=tftp 200000 ${bootfile};"                          \
-               "tftp ${fdt_addr} ${fdt_file};"                         \
-               "run nfsargs addip addtty;"                             \
-               "bootm 200000 - ${fdt_addr}\0"                          \
-       "rootpath=/opt/eldk/ppc_4xx\0"                                  \
-       "bootfile=katmai/uImage\0"                                      \
-       "fdt_file=katmai/katmai.dtb\0"                                  \
-       "fdt_addr=400000\0"                                             \
+       CONFIG_AMCC_DEF_ENV                                             \
+       CONFIG_AMCC_DEF_ENV_POWERPC                                     \
+       CONFIG_AMCC_DEF_ENV_PPC_OLD                                     \
+       CONFIG_AMCC_DEF_ENV_NOR_UPD                                     \
        "kernel_addr=fff10000\0"                                        \
        "ramdisk_addr=fff20000\0"                                       \
-       "initrd_high=30000000\0"                                        \
-       "load=tftp 200000 katmai/u-boot.bin\0"                          \
-       "update=protect off " xstr(CFG_MONITOR_BASE) " FFFFFFFF;"       \
-               "era " xstr(CFG_MONITOR_BASE) " FFFFFFFF;"              \
-               "cp.b ${fileaddr} " xstr(CFG_MONITOR_BASE) " ${filesize};" \
-               "setenv filesize;saveenv\0"                             \
-       "upd=run load update\0"                                         \
        "kozio=bootm ffc60000\0"                                        \
        "pciconfighost=1\0"                                             \
        "pcie_mode=RP:RP:RP\0"                                          \
        ""
-#define CONFIG_BOOTCOMMAND     "run flash_self"
-
-#define CONFIG_BOOTDELAY       5       /* autoboot after 5 seconds     */
-
-#define CONFIG_LOADS_ECHO      1       /* echo on for serial download  */
-#define CFG_LOADS_BAUD_CHANGE  1       /* allow baudrate change        */
-
-
-/*
- * BOOTP options
- */
-#define CONFIG_BOOTP_BOOTFILESIZE
-#define CONFIG_BOOTP_BOOTPATH
-#define CONFIG_BOOTP_GATEWAY
-#define CONFIG_BOOTP_HOSTNAME
-
 
 /*
- * Command line configuration.
+ * Commands additional to the ones defined in amcc-common.h
  */
-#include <config_cmd_default.h>
-
-#define CONFIG_CMD_ASKENV
-#define CONFIG_CMD_EEPROM
 #define CONFIG_CMD_DATE
-#define CONFIG_CMD_DHCP
-#define CONFIG_CMD_DIAG
-#define CONFIG_CMD_DTT
-#define CONFIG_CMD_ELF
-#define CONFIG_CMD_EXT2
-#define CONFIG_CMD_FAT
-#define CONFIG_CMD_I2C
-#define CONFIG_CMD_IRQ
-#define CONFIG_CMD_MII
-#define CONFIG_CMD_NET
-#define CONFIG_CMD_NFS
 #define CONFIG_CMD_PCI
-#define CONFIG_CMD_PING
-#define CONFIG_CMD_REGINFO
 #define CONFIG_CMD_SDRAM
 #define CONFIG_CMD_SNTP
 
 #define        CONFIG_IBM_EMAC4_V4     1       /* 440SPe has this EMAC version */
-#define CONFIG_MII             1       /* MII PHY management           */
 #define CONFIG_PHY_ADDR                1       /* PHY address, See schematics  */
 #define CONFIG_HAS_ETH0
 #define CONFIG_PHY_RESET        1      /* reset phy upon startup       */
 #define CONFIG_PHY_RESET_DELAY 1000
 #define CONFIG_CIS8201_PHY     1       /* Enable 'special' RGMII mode for Cicada phy */
 #define CONFIG_PHY_GIGE                1       /* Include GbE speed/duplex detection */
-#define CFG_RX_ETH_BUFFER      32      /* Number of ethernet rx buffers & descriptors */
-
-#define CONFIG_NETCONSOLE              /* include NetConsole support   */
-#define CONFIG_NET_MULTI               /* needed for NetConsole        */
-
-#undef CONFIG_WATCHDOG                 /* watchdog disabled            */
-
-/*
- * Miscellaneous configurable options
- */
-#define CFG_LONGHELP                           /* undef to save memory         */
-#define CFG_PROMPT             "=> "           /* Monitor Command Prompt       */
-
-#if defined(CONFIG_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 */
-
-#define CFG_4xx_RESET_TYPE     0x2     /* use chip reset on this board */
 
 /*-----------------------------------------------------------------------
  * FLASH related
 #define CFG_GPIO_TCR           GPIO_VAL(CFG_GPIO_RS232_FORCEOFF)
 #define CFG_GPIO_ODR           0
 
-/*
- * 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*/
-
-/*
- * Internal Definitions
- *
- * Boot Flags
- */
-#define BOOTFLAG_COLD  0x01            /* Normal Power-On: Boot from FLASH */
-#define BOOTFLAG_WARM  0x02            /* Software reboot */
-
-#if defined(CONFIG_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
-
-/* pass open firmware flat tree */
-#define CONFIG_OF_LIBFDT       1
-#define CONFIG_OF_BOARD_SETUP  1
-
 #endif /* __CONFIG_H */
index a59676870f676ff83d510dcd4efcacf738e2dde0..9c1a3a4c1e5f4d042a23ae1592bd2358cfd215fe 100644 (file)
@@ -1,4 +1,7 @@
 /*
+ * Copyright (c) 2008 Nuovation System Designs, LLC
+ *   Grant Erickson <gerickson@nuovations.com>
+ *
  * (C) Copyright 2007
  * Stefan Roese, DENX Software Engineering, sr@denx.de.
  *
 #define CONFIG_405EX           1               /* Specifc 405EX support*/
 #define CONFIG_SYS_CLK_FREQ    33333333        /* ext frequency to pll */
 
+/*
+ * Include common defines/options for all AMCC eval boards
+ */
+#define CONFIG_HOSTNAME                kilauea
+#include "amcc-common.h"
+
 #define CONFIG_BOARD_EARLY_INIT_F 1            /* Call board_early_init_f */
 #define CONFIG_MISC_INIT_R     1               /* Call misc_init_r     */
 #define CONFIG_BOARD_EMAC_COUNT
  * Base addresses -- Note these are effective addresses where the
  * actual resources get mapped (not physical addresses)
  *----------------------------------------------------------------------*/
-#define CFG_SDRAM_BASE         0x00000000
 #define CFG_FLASH_BASE         0xFC000000
 #define CFG_NAND_ADDR          0xF8000000
 #define CFG_FPGA_BASE          0xF0000000
 #define CFG_PERIPHERAL_BASE    0xEF600000      /* internal peripherals*/
-#define CFG_MONITOR_LEN                (384 * 1024)    /* Reserve 384 kB for Monitor   */
-#define CFG_MALLOC_LEN         (512 * 1024)    /* Reserve 512 kB for malloc()  */
-#define CFG_MONITOR_BASE       (TEXT_BASE)
 
 /*-----------------------------------------------------------------------
- * Initial RAM & stack pointer
- *----------------------------------------------------------------------*/
-#define CFG_INIT_RAM_ADDR      0x02000000      /* inside of SDRAM      */
-#define CFG_INIT_RAM_END       (4 << 10)
+ * Initial RAM & Stack Pointer Configuration Options
+ *
+ *   There are traditionally three options for the primordial
+ *   (i.e. initial) stack usage on the 405-series:
+ *
+ *      1) On-chip Memory (OCM) (i.e. SRAM)
+ *      2) Data cache
+ *      3) SDRAM
+ *
+ *   For the 405EX(r), there is no OCM, so we are left with (2) or (3)
+ *   the latter of which is less than desireable since it requires
+ *   setting up the SDRAM and ECC in assembly code.
+ *
+ *   To use (2), define 'CFG_INIT_DCACHE_CS' to be an unused chip
+ *   select on the External Bus Controller (EBC) and then select a
+ *   value for 'CFG_INIT_RAM_ADDR' outside of the range of valid,
+ *   physical SDRAM. Otherwise, undefine 'CFG_INIT_DCACHE_CS' and
+ *   select a value for 'CFG_INIT_RAM_ADDR' within the range of valid,
+ *   physical SDRAM to use (3).
+ *-----------------------------------------------------------------------*/
+
+#define CFG_INIT_DCACHE_CS     4
+
+#if defined(CFG_INIT_DCACHE_CS)
+#define CFG_INIT_RAM_ADDR      (CFG_SDRAM_BASE + ( 1 << 30))   /*  1 GiB */
+#else
+#define CFG_INIT_RAM_ADDR      (CFG_SDRAM_BASE + (32 << 20))   /* 32 MiB */
+#endif /* defined(CFG_INIT_DCACHE_CS) */
+
+#define CFG_INIT_RAM_END        (4 << 10)                      /*  4 KiB */
 #define CFG_GBL_DATA_SIZE      256             /* num bytes initial data */
 #define CFG_GBL_DATA_OFFSET    (CFG_INIT_RAM_END - CFG_GBL_DATA_SIZE)
-/* reserve some memory for POST and BOOT limit info */
-#define CFG_INIT_SP_OFFSET     (CFG_GBL_DATA_OFFSET - 16)
 
-/* extra data in init-ram */
-#define CFG_POST_WORD_ADDR     (CFG_GBL_DATA_OFFSET - 4)
-#define CFG_POST_MAGIC         (CFG_INIT_RAM_ADDR + CFG_GBL_DATA_OFFSET - 8)
-#define CFG_POST_VAL           (CFG_INIT_RAM_ADDR + CFG_GBL_DATA_OFFSET - 12)
-#define CFG_OCM_DATA_ADDR      CFG_INIT_RAM_ADDR /* for commproc.c     */
+/*
+ * If the data cache is being used for the primordial stack and global
+ * data area, the POST word must be placed somewhere else. The General
+ * Purpose Timer (GPT) is unused by u-boot and the kernel and preserves
+ * its compare and mask register contents across reset, so it is used
+ * for the POST word.
+ */
+
+#if defined(CFG_INIT_DCACHE_CS)
+# define CFG_INIT_SP_OFFSET    CFG_GBL_DATA_OFFSET
+# define CFG_POST_ALT_WORD_ADDR        (CFG_PERIPHERAL_BASE + GPT0_COMP6)
+#else
+# define CFG_INIT_EXTRA_SIZE   16
+# define CFG_INIT_SP_OFFSET    (CFG_GBL_DATA_OFFSET - CFG_INIT_EXTRA_SIZE)
+# define CFG_POST_WORD_ADDR    (CFG_GBL_DATA_OFFSET - 4)
+# define CFG_OCM_DATA_ADDR     CFG_INIT_RAM_ADDR
+#endif /* defined(CFG_INIT_DCACHE_CS) */
 
 /*-----------------------------------------------------------------------
  * Serial Port
  *----------------------------------------------------------------------*/
 #define CFG_EXT_SERIAL_CLOCK   11059200        /* ext. 11.059MHz clk   */
-#define CONFIG_BAUDRATE                115200
-#define CONFIG_SERIAL_MULTI     1
 /* define this if you want console on UART1 */
 #undef CONFIG_UART1_CONSOLE
 
-#define CFG_BAUDRATE_TABLE                                             \
-       {300, 600, 1200, 2400, 4800, 9600, 19200, 38400, 57600, 115200}
-
 /*-----------------------------------------------------------------------
  * Environment
  *----------------------------------------------------------------------*/
  * 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
+ * On 405EX the SPL is copied to SDRAM before the NAND controller is
+ * set up. While still running from location 0xfffff000...0xffffffff the
+ * NAND controller cannot be accessed since it is attached to CS0 too.
  */
 #define CFG_NAND_BOOT_SPL_SRC  0xfffff000      /* SPL location                 */
 #define CFG_NAND_BOOT_SPL_SIZE (4 << 10)       /* SPL size                     */
  *----------------------------------------------------------------------*/
 #define CFG_MBYTES_SDRAM        (256)          /* 256MB                        */
 
+#define        CFG_SDRAM0_MB0CF_BASE   ((  0 << 20) + CFG_SDRAM_BASE)
+
+/* DDR1/2 SDRAM Device Control Register Data Values */
+#define CFG_SDRAM0_MB0CF       ((CFG_SDRAM0_MB0CF_BASE >> 3)   | \
+                                SDRAM_RXBAS_SDSZ_256MB         | \
+                                SDRAM_RXBAS_SDAM_MODE7         | \
+                                SDRAM_RXBAS_SDBE_ENABLE)
+#define CFG_SDRAM0_MB1CF       SDRAM_RXBAS_SDBE_DISABLE
+#define CFG_SDRAM0_MB2CF       SDRAM_RXBAS_SDBE_DISABLE
+#define CFG_SDRAM0_MB3CF       SDRAM_RXBAS_SDBE_DISABLE
+#define CFG_SDRAM0_MCOPT1      0x04322000
+#define CFG_SDRAM0_MCOPT2      0x00000000
+#define CFG_SDRAM0_MODT0       0x01800000
+#define CFG_SDRAM0_MODT1       0x00000000
+#define CFG_SDRAM0_CODT                0x0080f837
+#define CFG_SDRAM0_RTR         0x06180000
+#define CFG_SDRAM0_INITPLR0    0xa8380000
+#define CFG_SDRAM0_INITPLR1    0x81900400
+#define CFG_SDRAM0_INITPLR2    0x81020000
+#define CFG_SDRAM0_INITPLR3    0x81030000
+#define CFG_SDRAM0_INITPLR4    0x81010404
+#define CFG_SDRAM0_INITPLR5    0x81000542
+#define CFG_SDRAM0_INITPLR6    0x81900400
+#define CFG_SDRAM0_INITPLR7    0x8D080000
+#define CFG_SDRAM0_INITPLR8    0x8D080000
+#define CFG_SDRAM0_INITPLR9    0x8D080000
+#define CFG_SDRAM0_INITPLR10   0x8D080000
+#define CFG_SDRAM0_INITPLR11   0x81000442
+#define CFG_SDRAM0_INITPLR12   0x81010780
+#define CFG_SDRAM0_INITPLR13   0x81010400
+#define CFG_SDRAM0_INITPLR14   0x00000000
+#define CFG_SDRAM0_INITPLR15   0x00000000
+#define CFG_SDRAM0_RQDC                0x80000038
+#define CFG_SDRAM0_RFDC                0x00000209
+#define CFG_SDRAM0_RDCC                0x40000000
+#define CFG_SDRAM0_DLCR                0x030000a5
+#define CFG_SDRAM0_CLKTR       0x80000000
+#define CFG_SDRAM0_WRDTR       0x00000000
+#define CFG_SDRAM0_SDTR1       0x80201000
+#define CFG_SDRAM0_SDTR2       0x32204232
+#define CFG_SDRAM0_SDTR3       0x080b0d1a
+#define CFG_SDRAM0_MMODE       0x00000442
+#define CFG_SDRAM0_MEMODE      0x00000404
+
 /*-----------------------------------------------------------------------
  * I2C
  *----------------------------------------------------------------------*/
-#define CONFIG_HARD_I2C                1       /* I2C with hardware support    */
 #define CFG_I2C_SPEED          400000  /* I2C speed and slave address  */
-#define CFG_I2C_SLAVE          0x7F
 
 #define CFG_EEPROM_PAGE_WRITE_DELAY_MS 6       /* 24C02 requires 5ms delay */
 #define CFG_I2C_EEPROM_ADDR    0x52    /* I2C boot EEPROM (24C02BN)    */
  *----------------------------------------------------------------------*/
 #define CONFIG_M88E1111_PHY    1
 #define CONFIG_IBM_EMAC4_V4    1
-#define CONFIG_MII             1       /* MII PHY management           */
 #define CONFIG_PHY_ADDR                1       /* PHY address, See schematics  */
 
 #define CONFIG_PHY_RESET       1       /* reset phy upon startup       */
 
 #define CONFIG_HAS_ETH0                1
 
-#define CONFIG_NET_MULTI       1
 #define CONFIG_HAS_ETH1                1       /* add support for "eth1addr"   */
 #define CONFIG_PHY1_ADDR       2
 
-#define CFG_RX_ETH_BUFFER      32      /* Number of ethernet rx buffers & descriptors */
-
-#define CONFIG_PREBOOT "echo;" \
-       "echo Type \\\"run flash_nfs\\\" to mount root filesystem over NFS;" \
-       "echo"
-
-#undef CONFIG_BOOTARGS
-
+/*
+ * Default environment variables
+ */
 #define        CONFIG_EXTRA_ENV_SETTINGS                                       \
+       CONFIG_AMCC_DEF_ENV                                             \
+       CONFIG_AMCC_DEF_ENV_POWERPC                                     \
+       CONFIG_AMCC_DEF_ENV_PPC_OLD                                     \
+       CONFIG_AMCC_DEF_ENV_NOR_UPD                                     \
+       CONFIG_AMCC_DEF_ENV_NAND_UPD                                    \
        "logversion=2\0"                                                \
-       "netdev=eth0\0"                                                 \
-       "hostname=kilauea\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=ttyS0,${baudrate}\0"\
-       "flash_self_old=run ramargs addip addtty;"                      \
-               "bootm ${kernel_addr} ${ramdisk_addr}\0"                \
-       "flash_self=run ramargs addip addtty;"                          \
-               "bootm ${kernel_addr} ${ramdisk_addr} ${fdt_addr}\0"    \
-       "flash_nfs_old=run nfsargs addip addtty;"                       \
-               "bootm ${kernel_addr}\0"                                \
-       "flash_nfs=run nfsargs addip addtty;"                           \
-               "bootm ${kernel_addr} - ${fdt_addr}\0"                  \
-       "net_nfs_old=tftp ${kernel_addr_r} ${bootfile};"                \
-               "run nfsargs addip addtty;bootm ${kernel_addr_r}\0"     \
-       "net_nfs=tftp ${kernel_addr_r} ${bootfile}; "                   \
-               "tftp ${fdt_addr_r} ${fdt_file}; "                      \
-               "run nfsargs addip addtty;"                             \
-               "bootm ${kernel_addr_r} - ${fdt_addr_r}\0"              \
-       "rootpath=/opt/eldk/ppc_4xx\0"                                  \
-       "bootfile=kilauea/uImage\0"                                     \
-       "fdt_file=kilauea/kilauea.dtb\0"                                \
-       "kernel_addr_r=400000\0"                                        \
-       "fdt_addr_r=800000\0"                                           \
        "kernel_addr=fc000000\0"                                        \
        "fdt_addr=fc1e0000\0"                                           \
        "ramdisk_addr=fc200000\0"                                       \
-       "initrd_high=30000000\0"                                        \
-       "load=tftp 200000 kilauea/u-boot.bin\0"                         \
-       "update=protect off fffa0000 ffffffff;era fffa0000 ffffffff;"   \
-               "cp.b ${fileaddr} fffa0000 ${filesize};"                \
-               "setenv filesize;saveenv\0"                             \
-       "upd=run load update\0"                                         \
-       "nload=tftp 200000 kilauea/u-boot-nand.bin\0"                   \
-       "nupdate=nand erase 0 60000;nand write 200000 0 60000;"         \
-               "setenv filesize;saveenv\0"                             \
-       "nupd=run nload nupdate\0"                                      \
        "pciconfighost=1\0"                                             \
        "pcie_mode=RP:RP\0"                                             \
        ""
-#define CONFIG_BOOTCOMMAND     "run flash_self"
-
-#define CONFIG_BOOTDELAY       5       /* autoboot after 5 seconds     */
-
-#define CONFIG_LOADS_ECHO      1       /* echo on for serial download  */
-#define CFG_LOADS_BAUD_CHANGE          /* allow baudrate change        */
 
 /*
- * BOOTP options
+ * Commands additional to the ones defined in amcc-common.h
  */
-#define CONFIG_BOOTP_BOOTFILESIZE
-#define CONFIG_BOOTP_BOOTPATH
-#define CONFIG_BOOTP_GATEWAY
-#define CONFIG_BOOTP_HOSTNAME
-#define CONFIG_BOOTP_SUBNETMASK
-
-/*
- * Command line configuration.
- */
-#include <config_cmd_default.h>
-
-#define CONFIG_CMD_ASKENV
 #define CONFIG_CMD_DATE
-#define CONFIG_CMD_DHCP
-#define CONFIG_CMD_DIAG
-#define CONFIG_CMD_DTT
-#define CONFIG_CMD_EEPROM
-#define CONFIG_CMD_ELF
-#define CONFIG_CMD_I2C
-#define CONFIG_CMD_IRQ
 #define CONFIG_CMD_LOG
-#define CONFIG_CMD_MII
 #define CONFIG_CMD_NAND
-#define CONFIG_CMD_NET
-#define CONFIG_CMD_NFS
 #define CONFIG_CMD_PCI
-#define CONFIG_CMD_PING
-#define CONFIG_CMD_REGINFO
 #define CONFIG_CMD_SNTP
 
 /* POST support */
-#define CONFIG_POST            (CFG_POST_MEMORY        | \
-                                CFG_POST_CACHE         | \
+#define CONFIG_POST            (CFG_POST_CACHE         | \
                                 CFG_POST_CPU           | \
                                 CFG_POST_ETHER         | \
                                 CFG_POST_I2C           | \
 
 #define CFG_CONSOLE_IS_IN_ENV /* Otherwise it catches logbuffer as output */
 
-#undef CONFIG_WATCHDOG                 /* watchdog disabled            */
-
-/*-----------------------------------------------------------------------
- * Miscellaneous configurable options
- *----------------------------------------------------------------------*/
-#define CFG_LONGHELP                   /* undef to save memory         */
-#define CFG_PROMPT             "=> "   /* Monitor Command Prompt       */
-#if defined(CONFIG_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 */
-#define CFG_CONSOLE_INFO_QUIET 1       /* don't print console @ startup*/
-
 /*-----------------------------------------------------------------------
  * PCI stuff
  *----------------------------------------------------------------------*/
 /* base address of inbound PCIe window */
 #define CFG_PCIE_INBOUND_BASE  0x0000000000000000ULL
 
-/*
- * 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
  *----------------------------------------------------------------------*/
 
 /* Memory Bank 2 (FPGA) initialization                                         */
 #define CFG_EBC_PB2AP           0x9400C800
-#define CFG_EBC_PB2CR           0xF0018000 /*  BAS=0x800,BS=1MB,BU=R/W,BW=8bit */
+#define CFG_EBC_PB2CR          (CFG_FPGA_BASE | 0x18000)
 
 #define CFG_EBC_CFG            0x7FC00000 /*  EBC0_CFG */
 
 }                                                                                              \
 }
 
-/*
- * Internal Definitions
- *
- * Boot Flags
- */
-#define BOOTFLAG_COLD  0x01            /* Normal Power-On: Boot from FLASH     */
-#define BOOTFLAG_WARM  0x02            /* Software reboot                      */
-
-#if defined(CONFIG_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
-
 /*-----------------------------------------------------------------------
  * Some Kilauea stuff..., mainly fpga registers
  */
 #define CFG_FPGA_USER_LED0             0x00000200
 #define CFG_FPGA_USER_LED1             0x00000100
 
-/* pass open firmware flat tree */
-#define CONFIG_OF_LIBFDT       1
-#define CONFIG_OF_BOARD_SETUP  1
-
 #endif /* __CONFIG_H */
index 37151d31fdd2fe03056f42afe3ee6c6a5ff36621..805cc59b306a610ec9757063e7a78460f07c8616 100644 (file)
 #define CONFIG_440             1
 #define CONFIG_SYS_CLK_FREQ    33333333 /* external freq to pll        */
 
+/*
+ * Include common defines/options for all AMCC eval boards
+ */
+#define CONFIG_HOSTNAME                luan
+#include "amcc-common.h"
+
 #define CONFIG_BOARD_EARLY_INIT_F 1    /* call board_early_init_f()    */
 #define CONFIG_MISC_INIT_R     1       /* call misc_init_r()           */
 
  * Base addresses -- Note these are effective addresses where the
  * actual resources get mapped (not physical addresses)
  *----------------------------------------------------------------------*/
-#define CFG_MONITOR_LEN                (256 * 1024)    /* Reserve 256 kB for Monitor */
-#define CFG_MALLOC_LEN         (256 * 1024)    /* Reserve 256 kB for malloc  */
-#define CFG_MONITOR_BASE       (-CFG_MONITOR_LEN)
-#define CFG_SDRAM_BASE         0x00000000      /* MUST be zero */
-
 #define CFG_LARGE_FLASH                0xffc00000      /* 4MB flash address CS0 */
 #define CFG_SMALL_FLASH                0xff900000      /* 1MB flash address CS2 */
 #define CFG_SRAM_BASE          0xff800000      /* 1MB SRAM  address CS2 */
@@ -68,7 +69,6 @@
 #define CFG_FLASH_BASE         CFG_SMALL_FLASH
 #endif
 
-#undef CFG_DRAM_TEST
 #if CFG_SRAM_BASE
 #define CFG_KBYTES_SDRAM       1024*2
 #else
  * Serial Port
  *----------------------------------------------------------------------*/
 #define CFG_EXT_SERIAL_CLOCK   11059200 /* external 11.059MHz clk */
-#define CONFIG_BAUDRATE                115200
-#undef  CONFIG_SERIAL_MULTI
 #undef  CONFIG_UART1_CONSOLE           /* define if you want console on UART1 */
 
-#define CFG_BAUDRATE_TABLE  \
-    {300, 600, 1200, 2400, 4800, 9600, 19200, 38400, 57600, 115200}
-
 /*-----------------------------------------------------------------------
  * Environment
  *----------------------------------------------------------------------*/
 /*-----------------------------------------------------------------------
  * 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_EEPROM_PAGE_WRITE_BITS 3
 #define CFG_EEPROM_PAGE_WRITE_DELAY_MS 10
 
-#define CONFIG_PREBOOT "echo;" \
-       "echo Type \\\"run flash_nfs\\\" to mount root filesystem over NFS;" \
-       "echo"
-
-#undef CONFIG_BOOTARGS
-
-#define CONFIG_EXTRA_ENV_SETTINGS                                      \
-       "netdev=eth0\0"                                                 \
-       "hostname=luan\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=ttyS0,$(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_4xx\0"                                  \
-       "bootfile=/tftpboot/luan/uImage\0"                              \
+/*
+ * Default environment variables
+ */
+#define        CONFIG_EXTRA_ENV_SETTINGS                                       \
+       CONFIG_AMCC_DEF_ENV                                             \
+       CONFIG_AMCC_DEF_ENV_PPC                                         \
+       CONFIG_AMCC_DEF_ENV_NOR_UPD                                     \
        "kernel_addr=fc000000\0"                                        \
        "ramdisk_addr=fc100000\0"                                       \
-       "initrd_high=30000000\0"                                        \
-       "load=tftp 100000 /tftpboot/luan/u-boot.bin\0"                  \
-       "update=protect off fffc0000 ffffffff;era fffc0000 ffffffff;"   \
-               "cp.b 100000 fffc0000 40000;"                           \
-               "setenv filesize;saveenv\0"                             \
-       "upd=run load 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_HAS_ETH0
-#define CONFIG_MII             1       /* MII PHY management           */
 #define CONFIG_PHY_ADDR                1
 #define CONFIG_CIS8201_PHY     1       /* Enable 'special' RGMII mode for Cicada phy */
 #define CONFIG_PHY_GIGE                1       /* Include GbE speed/duplex detection */
 
-#define CFG_RX_ETH_BUFFER      32      /* Number of ethernet rx buffers & descriptors */
-
-#define CONFIG_NETCONSOLE              /* include NetConsole support   */
-#define CONFIG_NET_MULTI               /* needed for NetConsole        */
-
 #ifdef DEBUG
 #define CONFIG_PANIC_HANG
 #else
 #endif
 
 /*
- * BOOTP options
+ * Commands additional to the ones defined in amcc-common.h
  */
-#define CONFIG_BOOTP_BOOTFILESIZE
-#define CONFIG_BOOTP_BOOTPATH
-#define CONFIG_BOOTP_GATEWAY
-#define CONFIG_BOOTP_HOSTNAME
-
-/*
- * Command line configuration.
- */
-#include <config_cmd_default.h>
-
-#define CONFIG_CMD_ASKENV
-#define CONFIG_CMD_DHCP
-#define CONFIG_CMD_EEPROM
-#define CONFIG_CMD_I2C
-#define CONFIG_CMD_IRQ
-#define CONFIG_CMD_MII
-#define CONFIG_CMD_NET
-#define CONFIG_CMD_NFS
 #define CONFIG_CMD_PCI
-#define CONFIG_CMD_PING
-#define CONFIG_CMD_REGINFO
 #define CONFIG_CMD_SDRAM
 
-/*
- * Miscellaneous configurable options
- */
-#define CFG_LONGHELP                   /* undef to save memory         */
-#define CFG_PROMPT             "=> "   /* Monitor Command Prompt       */
-#if defined(CONFIG_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) */
-#undef  CONFIG_LYNXKDI                 /* support kdi files            */
-
-#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
  *-----------------------------------------------------------------------
 
 #endif
 
-/*
- * 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 */
-
-/*
- * Internal Definitions
- *
- * Boot Flags
- */
-#define BOOTFLAG_COLD  0x01            /* Normal Power-On: Boot from FLASH     */
-#define BOOTFLAG_WARM  0x02            /* Software reboot                      */
-
-#if defined(CONFIG_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
-
-/* pass open firmware flat tree */
-#define CONFIG_OF_LIBFDT       1
-#define CONFIG_OF_BOARD_SETUP  1
-
 #endif /* __CONFIG_H */
index af066f3a8ad817cd77f40a657e154c5f042cc460..65b240e0f18e33a12706a27499a0e166f33b5780 100644 (file)
@@ -1,4 +1,7 @@
 /*
+ * Copyright (c) 2008 Nuovation System Designs, LLC
+ *   Grant Erickson <gerickson@nuovations.com>
+ *
  * (C) Copyright 2007-2008
  * Stefan Roese, DENX Software Engineering, sr@denx.de.
  *
 #define CONFIG_405EX           1               /* Specifc 405EX support*/
 #define CONFIG_SYS_CLK_FREQ    33330000        /* ext frequency to pll */
 
+/*
+ * Include common defines/options for all AMCC eval boards
+ */
+#define CONFIG_HOSTNAME        makalu
+#define CONFIG_ADDMISC "addmisc=setenv bootargs ${bootargs} rtc-x1205.probe=0,0x6f\0"
+#include "amcc-common.h"
+
 #define CONFIG_BOARD_EARLY_INIT_F 1            /* Call board_early_init_f */
 #define CONFIG_MISC_INIT_R     1               /* Call misc_init_r     */
 
  * Base addresses -- Note these are effective addresses where the
  * actual resources get mapped (not physical addresses)
  *----------------------------------------------------------------------*/
-#define CFG_SDRAM_BASE         0x00000000
 #define CFG_FLASH_BASE         0xFC000000
 #define CFG_FPGA_BASE          0xF0000000
 #define CFG_PERIPHERAL_BASE    0xEF600000      /* internal peripherals*/
-#define CFG_MONITOR_LEN                (384 * 1024)    /* Reserve 384 kB for Monitor   */
-#define CFG_MALLOC_LEN         (512 * 1024)    /* Reserve 512 kB for malloc()  */
-#define CFG_MONITOR_BASE       (TEXT_BASE)
 
 /*-----------------------------------------------------------------------
- * Initial RAM & stack pointer
- *----------------------------------------------------------------------*/
-#define CFG_INIT_RAM_ADDR      0x02000000      /* inside of SDRAM      */
-#define CFG_INIT_RAM_END       (4 << 10)
+ * Initial RAM & Stack Pointer Configuration Options
+ *
+ *   There are traditionally three options for the primordial
+ *   (i.e. initial) stack usage on the 405-series:
+ *
+ *      1) On-chip Memory (OCM) (i.e. SRAM)
+ *      2) Data cache
+ *      3) SDRAM
+ *
+ *   For the 405EX(r), there is no OCM, so we are left with (2) or (3)
+ *   the latter of which is less than desireable since it requires
+ *   setting up the SDRAM and ECC in assembly code.
+ *
+ *   To use (2), define 'CFG_INIT_DCACHE_CS' to be an unused chip
+ *   select on the External Bus Controller (EBC) and then select a
+ *   value for 'CFG_INIT_RAM_ADDR' outside of the range of valid,
+ *   physical SDRAM. Otherwise, undefine 'CFG_INIT_DCACHE_CS' and
+ *   select a value for 'CFG_INIT_RAM_ADDR' within the range of valid,
+ *   physical SDRAM to use (3).
+ *-----------------------------------------------------------------------*/
+
+#define CFG_INIT_DCACHE_CS     4
+
+#if defined(CFG_INIT_DCACHE_CS)
+#define CFG_INIT_RAM_ADDR      (CFG_SDRAM_BASE + ( 1 << 30))   /*  1 GiB */
+#else
+#define CFG_INIT_RAM_ADDR      (CFG_SDRAM_BASE + (32 << 20))   /* 32 MiB */
+#endif /* defined(CFG_INIT_DCACHE_CS) */
+
+#define CFG_INIT_RAM_END        (4 << 10)                      /*  4 KiB */
 #define CFG_GBL_DATA_SIZE      256             /* num bytes initial data */
 #define CFG_GBL_DATA_OFFSET    (CFG_INIT_RAM_END - CFG_GBL_DATA_SIZE)
-/* reserve some memory for POST and BOOT limit info */
-#define CFG_INIT_SP_OFFSET     (CFG_GBL_DATA_OFFSET - 16)
 
-/* extra data in init-ram */
-#define CFG_POST_WORD_ADDR     (CFG_GBL_DATA_OFFSET - 4)
-#define CFG_POST_MAGIC         (CFG_INIT_RAM_ADDR + CFG_GBL_DATA_OFFSET - 8)
-#define CFG_POST_VAL           (CFG_INIT_RAM_ADDR + CFG_GBL_DATA_OFFSET - 12)
-#define CFG_OCM_DATA_ADDR      CFG_INIT_RAM_ADDR /* for commproc.c     */
+/*
+ * If the data cache is being used for the primordial stack and global
+ * data area, the POST word must be placed somewhere else. The General
+ * Purpose Timer (GPT) is unused by u-boot and the kernel and preserves
+ * its compare and mask register contents across reset, so it is used
+ * for the POST word.
+ */
+
+#if defined(CFG_INIT_DCACHE_CS)
+# define CFG_INIT_SP_OFFSET    CFG_GBL_DATA_OFFSET
+# define CFG_POST_ALT_WORD_ADDR        (CFG_PERIPHERAL_BASE + GPT0_COMP6)
+#else
+# define CFG_INIT_EXTRA_SIZE   16
+# define CFG_INIT_SP_OFFSET    (CFG_GBL_DATA_OFFSET - CFG_INIT_EXTRA_SIZE)
+# define CFG_POST_WORD_ADDR    (CFG_GBL_DATA_OFFSET - 4)
+# define CFG_OCM_DATA_ADDR     CFG_INIT_RAM_ADDR
+#endif /* defined(CFG_INIT_DCACHE_CS) */
 
 /*-----------------------------------------------------------------------
  * Serial Port
  *----------------------------------------------------------------------*/
 #undef CFG_EXT_SERIAL_CLOCK                    /* no ext. clk          */
-#define CONFIG_BAUDRATE                115200
-#define CONFIG_SERIAL_MULTI     1
 /* define this if you want console on UART1 */
 #undef CONFIG_UART1_CONSOLE
 
-#define CFG_BAUDRATE_TABLE                                             \
-       {300, 600, 1200, 2400, 4800, 9600, 19200, 38400, 57600, 115200}
-
 /*-----------------------------------------------------------------------
  * Environment
  *----------------------------------------------------------------------*/
 /*-----------------------------------------------------------------------
  * DDR SDRAM
  *----------------------------------------------------------------------*/
-#define CFG_MBYTES_SDRAM       256
+#define CFG_MBYTES_SDRAM        (256)          /* 256MB                        */
+
+#define        CFG_SDRAM0_MB0CF_BASE   ((  0 << 20) + CFG_SDRAM_BASE)
+#define        CFG_SDRAM0_MB1CF_BASE   ((128 << 20) + CFG_SDRAM_BASE)
+
+/* DDR1/2 SDRAM Device Control Register Data Values */
+#define CFG_SDRAM0_MB0CF       ((CFG_SDRAM0_MB0CF_BASE >> 3)   | \
+                                SDRAM_RXBAS_SDSZ_128MB         | \
+                                SDRAM_RXBAS_SDAM_MODE2         | \
+                                SDRAM_RXBAS_SDBE_ENABLE)
+#define CFG_SDRAM0_MB1CF       ((CFG_SDRAM0_MB1CF_BASE >> 3)   | \
+                                SDRAM_RXBAS_SDSZ_128MB         | \
+                                SDRAM_RXBAS_SDAM_MODE2         | \
+                                SDRAM_RXBAS_SDBE_ENABLE)
+#define CFG_SDRAM0_MB2CF       SDRAM_RXBAS_SDBE_DISABLE
+#define CFG_SDRAM0_MB3CF       SDRAM_RXBAS_SDBE_DISABLE
+#define CFG_SDRAM0_MCOPT1      0x04322000
+#define CFG_SDRAM0_MCOPT2      0x00000000
+#define CFG_SDRAM0_MODT0       0x01800000
+#define CFG_SDRAM0_MODT1       0x00000000
+#define CFG_SDRAM0_CODT                0x0080f837
+#define CFG_SDRAM0_RTR         0x06180000
+#define CFG_SDRAM0_INITPLR0    0xa8380000
+#define CFG_SDRAM0_INITPLR1    0x81900400
+#define CFG_SDRAM0_INITPLR2    0x81020000
+#define CFG_SDRAM0_INITPLR3    0x81030000
+#define CFG_SDRAM0_INITPLR4    0x81010404
+#define CFG_SDRAM0_INITPLR5    0x81000542
+#define CFG_SDRAM0_INITPLR6    0x81900400
+#define CFG_SDRAM0_INITPLR7    0x8D080000
+#define CFG_SDRAM0_INITPLR8    0x8D080000
+#define CFG_SDRAM0_INITPLR9    0x8D080000
+#define CFG_SDRAM0_INITPLR10   0x8D080000
+#define CFG_SDRAM0_INITPLR11   0x81000442
+#define CFG_SDRAM0_INITPLR12   0x81010780
+#define CFG_SDRAM0_INITPLR13   0x81010400
+#define CFG_SDRAM0_INITPLR14   0x00000000
+#define CFG_SDRAM0_INITPLR15   0x00000000
+#define CFG_SDRAM0_RQDC                0x80000038
+#define CFG_SDRAM0_RFDC                0x00000209
+#define CFG_SDRAM0_RDCC                0x40000000
+#define CFG_SDRAM0_DLCR                0x030000a5
+#define CFG_SDRAM0_CLKTR       0x80000000
+#define CFG_SDRAM0_WRDTR       0x00000000
+#define CFG_SDRAM0_SDTR1       0x80201000
+#define CFG_SDRAM0_SDTR2       0x32204232
+#define CFG_SDRAM0_SDTR3       0x080b0d1a
+#define CFG_SDRAM0_MMODE       0x00000442
+#define CFG_SDRAM0_MEMODE      0x00000404
 
 /*-----------------------------------------------------------------------
  * I2C
  *----------------------------------------------------------------------*/
-#define CONFIG_HARD_I2C                1       /* I2C with hardware support    */
 #define CFG_I2C_SPEED          400000  /* I2C speed and slave address  */
-#define CFG_I2C_SLAVE          0x7F
 
 #define CFG_EEPROM_PAGE_WRITE_DELAY_MS 6       /* 24C02 requires 5ms delay */
 #define CFG_I2C_EEPROM_ADDR    0x52    /* I2C boot EEPROM (24C02BN)    */
  *----------------------------------------------------------------------*/
 #define CONFIG_M88E1111_PHY    1
 #define CONFIG_IBM_EMAC4_V4    1
-#define CONFIG_MII             1       /* MII PHY management           */
 #define CONFIG_PHY_ADDR                6       /* PHY address, See schematics  */
 
 #define CONFIG_PHY_RESET       1       /* reset phy upon startup       */
 
 #define CONFIG_HAS_ETH0                1
 
-#define CONFIG_NET_MULTI       1
 #define CONFIG_HAS_ETH1                1       /* add support for "eth1addr"   */
 #define CONFIG_PHY1_ADDR       0
 
-#define CFG_RX_ETH_BUFFER      32      /* Number of ethernet rx buffers & descriptors */
-
-#define CONFIG_PREBOOT "echo;" \
-       "echo Type \\\"run flash_nfs\\\" to mount root filesystem over NFS;" \
-       "echo"
-
-#undef CONFIG_BOOTARGS
-
+/*
+ * Default environment variables
+ */
 #define        CONFIG_EXTRA_ENV_SETTINGS                                       \
-       "logversion=2\0"                                                \
-       "netdev=eth0\0"                                                 \
-       "hostname=makalu\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=ttyS0,${baudrate}\0"\
-       "addmisc=setenv bootargs ${bootargs} rtc-x1205.probe=0,0x6f\0"  \
-       "flash_self_old=run ramargs addip addtty addmisc;"              \
-               "bootm ${kernel_addr} ${ramdisk_addr}\0"                \
-       "flash_self=run ramargs addip addtty addmisc;"                  \
-               "bootm ${kernel_addr} ${ramdisk_addr} ${fdt_addr}\0"    \
-       "flash_nfs_old=run nfsargs addip addtty addmisc;"               \
-               "bootm ${kernel_addr}\0"                                \
-       "flash_nfs=run nfsargs addip addtty addmisc;"                   \
-               "bootm ${kernel_addr} - ${fdt_addr}\0"                  \
-       "net_nfs_old=tftp ${kernel_addr_r} ${bootfile};"                \
-               "run nfsargs addip addtty addmisc;"                     \
-               "bootm ${kernel_addr_r}\0"                              \
-       "net_nfs=tftp ${kernel_addr_r} ${bootfile}; "                   \
-               "tftp ${fdt_addr_r} ${fdt_file}; "                      \
-               "run nfsargs addip addtty addmisc;"                     \
-               "bootm ${kernel_addr_r} - ${fdt_addr_r}\0"              \
-       "rootpath=/opt/eldk/ppc_4xx\0"                                  \
-       "bootfile=makalu/uImage\0"                                      \
-       "fdt_file=makalu/makalu.dtb\0"                                  \
-       "kernel_addr_r=400000\0"                                        \
-       "fdt_addr_r=800000\0"                                           \
+       CONFIG_AMCC_DEF_ENV                                             \
+       CONFIG_AMCC_DEF_ENV_POWERPC                                     \
+       CONFIG_AMCC_DEF_ENV_PPC_OLD                                     \
+       CONFIG_AMCC_DEF_ENV_NOR_UPD                                     \
        "kernel_addr=fc000000\0"                                        \
        "fdt_addr=fc1e0000\0"                                           \
        "ramdisk_addr=fc200000\0"                                       \
-       "initrd_high=30000000\0"                                        \
-       "load=tftp 200000 makalu/u-boot.bin\0"                          \
-       "update=protect off fffa0000 ffffffff;era fffa0000 ffffffff;"   \
-               "cp.b ${fileaddr} fffa0000 ${filesize};"                \
-               "setenv filesize;saveenv\0"                             \
-       "upd=run load update\0"                                         \
        "pciconfighost=1\0"                                             \
        "pcie_mode=RP:RP\0"                                             \
        ""
-#define CONFIG_BOOTCOMMAND     "run flash_self"
-
-#define CONFIG_BOOTDELAY       5       /* autoboot after 5 seconds     */
-
-#define CONFIG_LOADS_ECHO      1       /* echo on for serial download  */
-#define CFG_LOADS_BAUD_CHANGE          /* allow baudrate change        */
 
 /*
- * BOOTP options
+ * Commands additional to the ones defined in amcc-common.h
  */
-#define CONFIG_BOOTP_BOOTFILESIZE
-#define CONFIG_BOOTP_BOOTPATH
-#define CONFIG_BOOTP_GATEWAY
-#define CONFIG_BOOTP_HOSTNAME
-#define CONFIG_BOOTP_SUBNETMASK
-
-/*
- * Command line configuration.
- */
-#include <config_cmd_default.h>
-
-#define CONFIG_CMD_ASKENV
 #define CONFIG_CMD_DATE
-#define CONFIG_CMD_DHCP
-#define CONFIG_CMD_DIAG
 #define CONFIG_CMD_DTT
-#define CONFIG_CMD_EEPROM
-#define CONFIG_CMD_ELF
-#define CONFIG_CMD_I2C
-#define CONFIG_CMD_IRQ
 #define CONFIG_CMD_LOG
-#define CONFIG_CMD_MII
-#define CONFIG_CMD_NET
-#define CONFIG_CMD_NFS
 #define CONFIG_CMD_PCI
-#define CONFIG_CMD_PING
-#define CONFIG_CMD_REGINFO
 #define CONFIG_CMD_SNTP
 
 /* POST support */
-#define CONFIG_POST            (CFG_POST_MEMORY        | \
-                                CFG_POST_CACHE         | \
+#define CONFIG_POST            (CFG_POST_CACHE         | \
                                 CFG_POST_CPU           | \
                                 CFG_POST_ETHER         | \
                                 CFG_POST_I2C           | \
 
 #define CFG_CONSOLE_IS_IN_ENV /* Otherwise it catches logbuffer as output */
 
-#undef CONFIG_WATCHDOG                 /* watchdog disabled            */
-
-/*-----------------------------------------------------------------------
- * Miscellaneous configurable options
- *----------------------------------------------------------------------*/
-#define CFG_LONGHELP                   /* undef to save memory         */
-#define CFG_PROMPT             "=> "   /* Monitor Command Prompt       */
-#if defined(CONFIG_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 */
-#define CFG_CONSOLE_INFO_QUIET 1       /* don't print console @ startup*/
-
 /*-----------------------------------------------------------------------
  * PCI stuff
  *----------------------------------------------------------------------*/
 /* base address of inbound PCIe window */
 #define CFG_PCIE_INBOUND_BASE  0x0000000000000000ULL
 
-/*
- * 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_GPIO_PCIE_CLKREQ   27
 #define CFG_GPIO_PCIE_WAKE     28
 
-/*
- * Internal Definitions
- *
- * Boot Flags
- */
-#define BOOTFLAG_COLD  0x01            /* Normal Power-On: Boot from FLASH     */
-#define BOOTFLAG_WARM  0x02            /* Software reboot                      */
-
-#if defined(CONFIG_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
-
-/* pass open firmware flat tree */
-#define CONFIG_OF_LIBFDT       1
-#define CONFIG_OF_BOARD_SETUP  1
-
 #endif /* __CONFIG_H */
index be2b3ec7efd55fe55066f4ddd1ea2310c73cea72..407aae72102c1db8fd71510a53bd2dbaf32a947e 100644 (file)
 #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 CONFIG_SYS_CLK_FREQ    33333333    /* external freq to pll     */
 
+/*
+ * Include common defines/options for all AMCC eval boards
+ */
+#define CONFIG_HOSTNAME                ocotea
+#include "amcc-common.h"
+
 /*-----------------------------------------------------------------------
  * Base addresses -- Note these are effective addresses where the
  * actual resources get mapped (not physical addresses)
  *----------------------------------------------------------------------*/
-#define CFG_SDRAM_BASE     0x00000000      /* _must_ be 0              */
 #define CFG_FLASH_BASE     0xff800000      /* start of FLASH           */
-#define CFG_MONITOR_BASE    0xfffc0000     /* start of monitor         */
 #define CFG_PCI_MEMBASE            0x80000000      /* mapped pci memory        */
 #define CFG_PERIPHERAL_BASE 0xe0000000     /* internal peripherals     */
 #define CFG_ISRAM_BASE     0xc0000000      /* internal SRAM            */
 #define CFG_POST_WORD_ADDR     (CFG_GBL_DATA_OFFSET - 0x4)
 #define CFG_INIT_SP_OFFSET     CFG_POST_WORD_ADDR
 
-#define CFG_MONITOR_LEN            (256 * 1024)    /* Reserve 256 kB for Mon   */
-#define CFG_MALLOC_LEN     (128 * 1024)    /* Reserve 128 kB for malloc*/
-
 /*-----------------------------------------------------------------------
  * Serial Port
  *----------------------------------------------------------------------*/
 #undef CONFIG_SERIAL_SOFTWARE_FIFO
 #define CFG_EXT_SERIAL_CLOCK   (1843200 * 6)   /* Ext clk @ 11.059 MHz */
-#define CONFIG_BAUDRATE                115200
-
-#define CFG_BAUDRATE_TABLE  \
-    {300, 600, 1200, 2400, 4800, 9600, 19200, 38400, 57600, 115200}
 
 /*-----------------------------------------------------------------------
  * Environment
 /*-----------------------------------------------------------------------
  * 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_EEPROM_PAGE_WRITE_BITS 3
 #define CFG_EEPROM_PAGE_WRITE_DELAY_MS 10
 
-#define CONFIG_PREBOOT "echo;" \
-       "echo Type \\\"run flash_nfs\\\" to mount root filesystem over NFS;" \
-       "echo"
-
-#undef CONFIG_BOOTARGS
-
+/*
+ * Default environment variables
+ */
 #define        CONFIG_EXTRA_ENV_SETTINGS                                       \
-       "netdev=eth0\0"                                                 \
-       "hostname=ocotea\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=ttyS0,${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_4xx\0"                                  \
-       "bootfile=/tftpboot/ocotea/uImage\0"                            \
+       CONFIG_AMCC_DEF_ENV                                             \
+       CONFIG_AMCC_DEF_ENV_PPC                                         \
+       CONFIG_AMCC_DEF_ENV_NOR_UPD                                     \
        "kernel_addr=fff00000\0"                                        \
        "ramdisk_addr=fff10000\0"                                       \
-       "initrd_high=30000000\0"                                        \
-       "load=tftp 100000 /tftpboot/ocotea/u-boot.bin\0"                \
-       "update=protect off fffc0000 ffffffff;era fffc0000 ffffffff;"   \
-               "cp.b 100000 fffc0000 40000;"                           \
-               "setenv filesize;saveenv\0"                             \
-       "upd=run load 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_BAUDRATE                115200
-
-#define CONFIG_LOADS_ECHO      1       /* echo on for serial download  */
-#define CFG_LOADS_BAUD_CHANGE  1       /* allow baudrate change        */
-
-#define CONFIG_MII             1       /* MII PHY management           */
-#define CONFIG_NET_MULTI       1
 #define CONFIG_PHY_ADDR                1       /* PHY address, See schematics  */
 #define CONFIG_PHY1_ADDR       2
 #define CONFIG_PHY2_ADDR       0x10
 #define CONFIG_PHY_GIGE                1       /* Include GbE speed/duplex detection */
 #define CONFIG_PHY_RESET        1       /* reset phy upon startup         */
 #define CONFIG_PHY_RESET_DELAY 1000
-#define CFG_RX_ETH_BUFFER      32      /* Number of ethernet rx buffers & descriptors */
-
-#define CONFIG_NETCONSOLE              /* include NetConsole support   */
-
 
 /*
- * BOOTP options
+ * Commands additional to the ones defined in amcc-common.h
  */
-#define CONFIG_BOOTP_BOOTFILESIZE
-#define CONFIG_BOOTP_BOOTPATH
-#define CONFIG_BOOTP_GATEWAY
-#define CONFIG_BOOTP_HOSTNAME
-
-
-/*
- * Command line configuration.
- */
-#include <config_cmd_default.h>
-
-#define CONFIG_CMD_ASKENV
 #define CONFIG_CMD_DATE
-#define CONFIG_CMD_DHCP
-#define CONFIG_CMD_DIAG
-#define CONFIG_CMD_ELF
-#define CONFIG_CMD_EEPROM
-#define CONFIG_CMD_I2C
-#define CONFIG_CMD_IRQ
-#define CONFIG_CMD_MII
-#define CONFIG_CMD_NET
-#define CONFIG_CMD_NFS
 #define CONFIG_CMD_PCI
-#define CONFIG_CMD_PING
-#define CONFIG_CMD_REGINFO
 #define CONFIG_CMD_SDRAM
 #define CONFIG_CMD_SNTP
 
-
-#undef CONFIG_WATCHDOG                 /* watchdog disabled            */
-
-/*
- * Miscellaneous configurable options
- */
-#define CFG_LONGHELP                   /* undef to save memory         */
-#define CFG_PROMPT     "=> "           /* Monitor Command Prompt       */
-#if defined(CONFIG_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
  *-----------------------------------------------------------------------
 #define CFG_PCI_SUBSYS_VENDORID 0x10e8 /* AMCC */
 #define CFG_PCI_SUBSYS_DEVICEID 0xcafe /* Whatever */
 
-/*
- * 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 */
-
-/*
- * Internal Definitions
- *
- * Boot Flags
- */
-#define BOOTFLAG_COLD  0x01            /* Normal Power-On: Boot from FLASH     */
-#define BOOTFLAG_WARM  0x02            /* Software reboot                      */
-
-#if defined(CONFIG_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
-
-/* pass open firmware flat tree */
-#define CONFIG_OF_LIBFDT       1
-#define CONFIG_OF_BOARD_SETUP  1
-
 #endif /* __CONFIG_H */
index 81a1e072c6d93ffbf6b5688a19a9652811f7c019..146eafe9cca00b63c41e5f05bb3abd6922ab81a9 100644 (file)
@@ -42,6 +42,7 @@
 
 #define CONFIG_CPM2            1       /* has CPM2 */
 #define CONFIG_SBC8560         1       /* configuration for SBC8560 board */
+#define CONFIG_MPC8560         1
 
 /* XXX flagging this as something I might want to delete */
 #define CONFIG_MPC8560ADS      1       /* MPC8560ADS board specific    */
index d140241bff485a729edb0ecb814b1e995b41ca86..4ae25adde04c139017ad199e28fcb0ad72e87d2b 100644 (file)
 #define CFG_CS5U_VAL 0x00008400
 #define CFG_CS5L_VAL 0x00000D03
 
-#define CONFIG_DRIVER_DM9000           1
 #define CONFIG_DRIVER_DM9000           1
 #define CONFIG_DM9000_BASE             0x16000000
 #define DM9000_IO                      CONFIG_DM9000_BASE
 #define DM9000_DATA                    (CONFIG_DM9000_BASE+4)
-/* #define CONFIG_DM9000_USE_8BIT */
-#define CONFIG_DM9000_USE_16BIT
-/* #define CONFIG_DM9000_USE_32BIT */
 
 /* f_{dpll}=2*f{ref}*(MFI+MFN/(MFD+1))/(PD+1)
    f_ref=16,777MHz
index 48251f39486c5dee7632a52727bfbdec07dbfe7c..f4eefae2f498654c62d9bb07ee67d86eb4984c7b 100644 (file)
 /* This config file is used for Sequoia (440EPx) and Rainier (440GRx)  */
 #ifndef CONFIG_RAINIER
 #define CONFIG_440EPX          1       /* Specific PPC440EPx           */
+#define CONFIG_HOSTNAME                sequoia
 #else
 #define CONFIG_440GRX          1       /* Specific PPC440GRx           */
+#define CONFIG_HOSTNAME                rainier
 #endif
 #define CONFIG_440             1       /* ... PPC440 family            */
 #define CONFIG_4xx             1       /* ... PPC4xx family            */
+
+/*
+ * Include common defines/options for all AMCC eval boards
+ */
+#include "amcc-common.h"
+
 /* Detect Sequoia PLL input clock automatically via CPLD bit           */
 #define CONFIG_SYS_CLK_FREQ    ((in8(CFG_BCSR_BASE + 3) & 0x80) ? \
                                33333333 : 33000000)
  * Base addresses -- Note these are effective addresses where the actual
  * resources get mapped (not physical addresses).
  */
-#ifndef CONFIG_VIDEO
-#define CFG_MONITOR_LEN                (384 * 1024) /* Reserve 384 kiB for Monitor  */
-#define CFG_MALLOC_LEN         (256 * 1024) /* Reserve 256 kiB for malloc() */
-#else
-#define CFG_MONITOR_LEN                (512 * 1024)    /* Reserve 512 kB for Monitor   */
-#define CFG_MALLOC_LEN         (1024 * 1024)   /* Reserve 1024 kB for malloc() */
-#endif
-
 #define CFG_TLB_FOR_BOOT_FLASH 0x0003
 #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_NAND_ADDR          0xd0000000      /* NAND Flash           */
 #define CFG_OCM_BASE           0xe0010000      /* ocm                  */
 #define CFG_OCM_DATA_ADDR      CFG_OCM_BASE
  * Serial Port
  */
 #define CFG_EXT_SERIAL_CLOCK   11059200        /* ext. 11.059MHz clk   */
-#define CONFIG_BAUDRATE                115200
-#define CONFIG_SERIAL_MULTI    1
 /* define this if you want console on UART1 */
 #undef CONFIG_UART1_CONSOLE
 
-#define CFG_BAUDRATE_TABLE                                             \
-       {300, 600, 1200, 2400, 4800, 9600, 19200, 38400, 57600, 115200}
-
 /*
  * Environment
  */
 /*
  * 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_DTT_LOW_TEMP       -30
 #define CFG_DTT_HYSTERESIS     3
 
-#define CONFIG_PREBOOT "echo;"                                         \
-       "echo Type \\\"run flash_nfs\\\" to mount root filesystem over NFS;" \
-       "echo"
-
-#undef CONFIG_BOOTARGS
-
-/* Setup some board specific values for the default environment variables */
-#ifndef CONFIG_RAINIER
-#define CONFIG_HOSTNAME                sequoia
-#define CFG_BOOTFILE           "bootfile=sequoia/uImage\0"
-#define CFG_DTBFILE            "fdt_file=sequoia/sequoia.dtb\0"
-#define CFG_ROOTPATH           "rootpath=/opt/eldk/ppc_4xxFP\0"
-#else
-#define CONFIG_HOSTNAME                rainier
-#define CFG_BOOTFILE           "bootfile=rainier/uImage\0"
-#define CFG_DTBFILE            "fdt_file=rainier/rainier.dtb\0"
-#define CFG_ROOTPATH           "rootpath=/opt/eldk/ppc_4xx\0"
-#endif
-
+/*
+ * Default environment variables
+ */
 #define        CONFIG_EXTRA_ENV_SETTINGS                                       \
-       CFG_BOOTFILE                                                    \
-       CFG_ROOTPATH                                                    \
-       "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=ttyS0,${baudrate}\0"\
-       "addmisc=setenv bootargs ${bootargs}\0"                         \
-       "flash_nfs=run nfsargs addip addtty addmisc;"                   \
-               "bootm ${kernel_addr}\0"                                \
-       "flash_self=run ramargs addip addtty addmisc;"                  \
-               "bootm ${kernel_addr} ${ramdisk_addr}\0"                \
-       "net_nfs=tftp 200000 ${bootfile};"                              \
-               "run nfsargs addip addtty addmisc;"                     \
-               "bootm\0"                                               \
-       "fdt_file=sequoia/sequoia.dtb\0"                                \
-       "fdt_addr=400000\0"                                             \
-       "net_nfs_fdt=tftp 200000 ${bootfile};"                          \
-               "tftp ${fdt_addr} ${fdt_file};"                         \
-               "run nfsargs addip addtty addmisc;"                     \
-               "bootm 200000 - ${fdt_addr}\0"                          \
+       CONFIG_AMCC_DEF_ENV                                             \
+       CONFIG_AMCC_DEF_ENV_POWERPC                                     \
+       CONFIG_AMCC_DEF_ENV_PPC_OLD                                     \
+       CONFIG_AMCC_DEF_ENV_NOR_UPD                                     \
+       CONFIG_AMCC_DEF_ENV_NAND_UPD                                    \
        "kernel_addr=FC000000\0"                                        \
        "ramdisk_addr=FC180000\0"                                       \
-       "load=tftp 200000 /tftpboot/${hostname}/u-boot.bin\0"           \
-       "update=protect off FFFA0000 FFFFFFFF;era FFFA0000 FFFFFFFF;"   \
-               "cp.b 200000 FFFA0000 60000\0"                          \
-       "upd=run load 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_M88E1111_PHY    1
 #define        CONFIG_IBM_EMAC4_V4     1
-#define CONFIG_MII             1       /* MII PHY management           */
 #define CONFIG_PHY_ADDR                0       /* PHY address, See schematics  */
 
 #define CONFIG_PHY_RESET        1      /* reset phy upon startup       */
 #define CONFIG_PHY_GIGE                1       /* Include GbE speed/duplex detection */
 
 #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
 
 #define CONFIG_ISO_PARTITION
 
 /*
- * BOOTP options
+ * Commands additional to the ones defined in amcc-common.h
  */
-#define CONFIG_BOOTP_BOOTFILESIZE
-#define CONFIG_BOOTP_BOOTPATH
-#define CONFIG_BOOTP_GATEWAY
-#define CONFIG_BOOTP_HOSTNAME
-#define CONFIG_BOOTP_SUBNETMASK
-
-/*
- * Command line configuration.
- */
-#include <config_cmd_default.h>
-
-#define CONFIG_CMD_ASKENV
-#define CONFIG_CMD_DHCP
 #define CONFIG_CMD_DTT
-#define CONFIG_CMD_DIAG
-#define CONFIG_CMD_EEPROM
-#define CONFIG_CMD_ELF
 #define CONFIG_CMD_FAT
-#define CONFIG_CMD_I2C
-#define CONFIG_CMD_IRQ
-#define CONFIG_CMD_MII
 #define CONFIG_CMD_NAND
-#define CONFIG_CMD_NET
-#define CONFIG_CMD_NFS
 #define CONFIG_CMD_PCI
-#define CONFIG_CMD_PING
-#define CONFIG_CMD_REGINFO
 #define CONFIG_CMD_SDRAM
 
 #ifdef CONFIG_440EPX
 
 #define CONFIG_SUPPORT_VFAT
 
-/*
- * Miscellaneous configurable options
- */
-#define CFG_LONGHELP                   /* undef to save memory         */
-#define CFG_PROMPT             "=> "   /* Monitor Command Prompt       */
-#if defined(CONFIG_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
  */
 #define CFG_PCI_SUBSYS_VENDORID 0x10e8 /* AMCC                         */
 #define CFG_PCI_SUBSYS_ID       0xcafe /* Whatever                     */
 
-/*
- * 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
  */
 }                                                                                      \
 }
 
-/*
- * Internal Definitions
- *
- * Boot Flags
- */
-#define BOOTFLAG_COLD  0x01    /* Normal Power-On: Boot from FLASH     */
-#define BOOTFLAG_WARM  0x02    /* Software reboot                      */
-
-#if defined(CONFIG_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
-
-/* pass open firmware flat tree */
-#define CONFIG_OF_LIBFDT       1
-#define CONFIG_OF_BOARD_SETUP  1
-
 #ifdef CONFIG_VIDEO
 #define CONFIG_BIOSEMU                 /* x86 bios emulator for vga bios */
 #define CONFIG_ATI_RADEON_FB           /* use radeon framebuffer driver */
index 6dc9effde46175e8839c7a3437ce68f8c9a08528..16274137dc6ba01a4c40428a070aa3acaaf1fc3c 100644 (file)
 #define CFG_INIT_SP_OFFSET     CFG_GBL_DATA_OFFSET
 
 #define CFG_MONITOR_LEN                (256 * 1024)    /* Reserve 256kB for Mon*/
-#define CFG_MALLOC_LEN         (128 * 1024)    /* Reserved for malloc  */
+#define CFG_MALLOC_LEN         (256 * 1024)    /* Reserved for malloc  */
 
 /* Serial Port */
 
 #define CFG_EEPROM_PAGE_WRITE_ENABLE   /* necessary for the LM75 chip */
 #define CFG_EEPROM_PAGE_WRITE_BITS     4
 
-/* RapidIO MMU */
-#define CFG_RIO_MEM_BASE       0xc0000000      /* base address         */
-#define CFG_RIO_MEM_PHYS       CFG_RIO_MEM_BASE
-#define CFG_RIO_MEM_SIZE       0x20000000      /* 128M                 */
-
 /*
  * General PCI
  * Memory space is mapped 1-1.
 
 #if defined(CONFIG_PCI)
 #define CONFIG_PCI_PNP                 /* do pci plug-and-play         */
-
-#define CONFIG_EEPRO100
-#undef CONFIG_TULIP
-
-#define CONFIG_PCI_SCAN_SHOW           /* show pci devices on startup  */
-#define CFG_PCI_SUBSYS_VENDORID 0x1057 /* Motorola                     */
-
+#undef CONFIG_PCI_SCAN_SHOW            /* show pci devices on startup  */
 #endif /* CONFIG_PCI */
 
 
                "tftp ${fdt_addr_r} ${fdt_file}; "                      \
                "run nfsargs addip addcons;"                            \
                "bootm ${kernel_addr_r} - ${fdt_addr_r}\0"              \
-       "fdt_file=$hostname/socrates.dtb\0"                                     \
+       "fdt_file=$hostname/socrates.dtb\0"                             \
        "fdt_addr_r=B00000\0"                                           \
        "fdt_addr=FC1E0000\0"                                           \
-       "rootpath=/opt/eldk/ppc_85xx\0"                                 \
+       "rootpath=/opt/eldk/ppc_85xxDP\0"                               \
        "kernel_addr=FC000000\0"                                        \
        "kernel_addr_r=200000\0"                                        \
        "ramdisk_addr=FC200000\0"                                       \
 #define CONFIG_DOS_PARTITION           1
 #define CONFIG_USB_STORAGE             1
 
+/* FPGA and NAND */
+#define CFG_FPGA_BASE                  0xc0000000
+#define CFG_BR3_PRELIM                 0xc0001881 /* UPMA, 32-bit */
+#define CFG_OR3_PRELIM                 0xfff00000  /* 1 MB */
+
+#define CFG_NAND_BASE                  (CFG_FPGA_BASE + 0x70)
+#define CFG_MAX_NAND_DEVICE            1
+#define NAND_MAX_CHIPS                 1
+#define CONFIG_CMD_NAND
+
 #endif /* __CONFIG_H */
index ec04a30bec99a97ea7ed1d5f3f9ad93ffc4dda59..6e8213d72a5ed7cdfbeec57996569f7a9fd6dad8 100644 (file)
@@ -41,6 +41,7 @@
 #define CONFIG_MPC85xx         1       /* MPC8540/MPC8560      */
 #define CONFIG_CPM2            1       /* has CPM2 */
 #define CONFIG_STXGP3          1       /* Silicon Tx GPPP board specific*/
+#define CONFIG_MPC8560         1
 
 #undef  CONFIG_PCI                     /* pci ethernet support */
 #define CONFIG_TSEC_ENET               /* tsec ethernet support*/
index d033c866d73a7aaafde97296cc2d5ac2cc575c32..a1e9789ea01b512b1a1ea64c428ffc9f067c549e 100644 (file)
@@ -41,6 +41,7 @@
 #define CONFIG_MPC85xx         1       /* MPC8540/MPC8560      */
 #define CONFIG_CPM2            1       /* has CPM2 */
 #define CONFIG_STXSSA          1       /* Silicon Tx GPPP SSA board specific*/
+#define CONFIG_MPC8560         1
 
 #define CONFIG_PCI                     /* PCI ethernet support */
 #define CONFIG_TSEC_ENET               /* tsec ethernet support*/
index c060b1e340b91fc1f6a3ee37deca4fe7fe7b1f39..86f776df20e193e9b2d8a61826297cd9eb5e335e 100644 (file)
 #define CONFIG_4xx             1       /*  member of PPC4xx family */
 #define CONFIG_TAIHU           1       /*  on a taihu board */
 
+/*
+ * Include common defines/options for all AMCC eval boards
+ */
+#define CONFIG_HOSTNAME                taihu
+#include "amcc-common.h"
+
 #define CONFIG_BOARD_EARLY_INIT_F 1    /* call board_early_init_f */
 
 #define CONFIG_SYS_CLK_FREQ     33000000 /* external frequency to pll   */
 
 #define CFG_ENV_IS_IN_FLASH     1      /* use FLASH for environment vars */
 
-#define CONFIG_ENV_OVERWRITE 1
-#define CONFIG_PREBOOT "echo;" \
-       "echo Type \\\"run flash_nfs\\\" to mount root filesystem over NFS;" \
-       "echo"
-
-#undef CONFIG_BOOTARGS
-#define CONFIG_EXTRA_ENV_SETTINGS                                      \
-       "bootfile=/tftpboot/taihu/uImage\0"                             \
-       "rootpath=/opt/eldk/ppc_4xx\0"                                  \
-       "netdev=eth0\0"                                                 \
-       "hostname=taihu\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=ttyS0,${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"                                               \
+/*
+ * Default environment variables
+ */
+#define        CONFIG_EXTRA_ENV_SETTINGS                                       \
+       CONFIG_AMCC_DEF_ENV                                             \
+       CONFIG_AMCC_DEF_ENV_PPC                                         \
+       CONFIG_AMCC_DEF_ENV_NOR_UPD                                     \
        "kernel_addr=FC000000\0"                                        \
        "ramdisk_addr=FC180000\0"                                       \
-       "load=tftp 200000 /tftpboot/taihu/u-boot.bin\0"                 \
-       "update=protect off FFFC0000 FFFFFFFF;era FFFC0000 FFFFFFFF;"   \
-               "cp.b 200000 FFFC0000 40000\0"                          \
-       "upd=run load 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_MII             1       /* MII PHY management           */
 #define CONFIG_PHY_ADDR                0x14    /* PHY address                  */
 #define CONFIG_HAS_ETH0
 #define CONFIG_HAS_ETH1
 #define CONFIG_PHY1_ADDR       0x10    /* EMAC1 PHY address            */
-#define CONFIG_NET_MULTI       1
-#define CFG_RX_ETH_BUFFER      16      /* Number of ethernet rx buffers & descriptors */
 #define CONFIG_PHY_RESET       1
 
 /*
- * BOOTP options
+ * Commands additional to the ones defined in amcc-common.h
  */
-#define CONFIG_BOOTP_BOOTFILESIZE
-#define CONFIG_BOOTP_BOOTPATH
-#define CONFIG_BOOTP_GATEWAY
-#define CONFIG_BOOTP_HOSTNAME
-
-/*
- * Command line configuration.
- */
-#include <config_cmd_default.h>
-
-#define CONFIG_CMD_ASKENV
 #define CONFIG_CMD_CACHE
-#define CONFIG_CMD_DHCP
-#define CONFIG_CMD_EEPROM
-#define CONFIG_CMD_ELF
-#define CONFIG_CMD_I2C
-#define CONFIG_CMD_IRQ
-#define CONFIG_CMD_MII
-#define CONFIG_CMD_NET
 #define CONFIG_CMD_PCI
-#define CONFIG_CMD_PING
-#define CONFIG_CMD_REGINFO
 #define CONFIG_CMD_SDRAM
 #define CONFIG_CMD_SPI
 
-#undef CONFIG_WATCHDOG                 /* watchdog disabled */
-
 #undef CONFIG_SPD_EEPROM               /* use SPD EEPROM for setup */
 #define CFG_SDRAM_SIZE_PER_BANK 0x04000000 /* 64MB */
 #define CFG_SDRAM_BANKS                2
 #define CFG_SDRAM_tRCD          20     /* ACTIVE-to-READ delay */
 #define CFG_SDRAM_tRFC         66      /* Auto refresh period */
 
-/*
- * Miscellaneous configurable options
- */
-#define CFG_LONGHELP                   /* undef to save memory         */
-#define CFG_PROMPT     "=> "           /* Monitor Command Prompt       */
-#if defined(CONFIG_CMD_KGDB)
-#define CFG_CBSIZE     1024            /* Console I/O Buffer Size      */
-#else
-#define CFG_CBSIZE     256             /* Console I/O Buffer Size      */
-#endif
-#define CFG_PBSIZE (CFG_CBSIZE+sizeof(CFG_PROMPT)+16) /* print buffer Size */
-#define CFG_MAXARGS    16              /* max number of command args   */
-#define CFG_BARGSIZE   CFG_CBSIZE      /* Boot Argument Buffer Size    */
-
-#define CFG_MEMTEST_START  0x0400000   /* memtest works on     */
-#define CFG_MEMTEST_END           0x0C00000    /* 4 ... 12 MB in DRAM  */
-
 /*
  * If CFG_EXT_SERIAL_CLOCK, then the UART divisor is 1.
  * If CFG_405_UART_ERRATA_59, then UART divisor is 31.
 #undef  CFG_EXT_SERIAL_CLOCK           /* external serial clock */
 #undef  CFG_405_UART_ERRATA_59         /* 405GP/CR Rev. D silicon */
 #define CFG_BASE_BAUD          691200
-
-#define CONFIG_BAUDRATE                115200
-
 #define CONFIG_UART1_CONSOLE   1
 
-/* The following table includes the supported baudrates */
-#define CFG_BAUDRATE_TABLE  \
-    {300, 600, 1200, 2400, 4800, 9600, 19200, 38400, 57600, 115200, 230400}
-
-#define CFG_LOAD_ADDR      0x100000    /* default load address */
-#define CFG_EXTBDINFO          1       /* To use extended board_into (bd_t) */
-
-#define CFG_HZ                 1000    /* decrementer freq: 1 ms ticks */
-
-#define CONFIG_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 */
-#define CFG_CONSOLE_INFO_QUIET 1       /* don't print console @ startup*/
-
 /*-----------------------------------------------------------------------
  * I2C stuff
  *-----------------------------------------------------------------------
  */
-#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_NOPROBES       { 0x69 } /* avoid iprobe hangup (why?) */
 #define CFG_EEPROM_PAGE_WRITE_DELAY_MS 6 /* 24C02 requires 5ms delay */
@@ -278,25 +189,12 @@ unsigned char spi_read(void);
 /*-----------------------------------------------------------------------
  * Start addresses for the final memory configuration
  * (Set up by the startup code)
- * Please note that CFG_SDRAM_BASE _must_ start at 0
  */
-#define CFG_SDRAM_BASE         0x00000000
 #define CFG_FLASH_BASE         0xFFE00000
-#define CFG_MONITOR_LEN                (256 * 1024)    /* Reserve 256 kB for Monitor   */
-#define CFG_MALLOC_LEN         (128 * 1024)    /* Reserve 128 kB for malloc()  */
-#define CFG_MONITOR_BASE       (-CFG_MONITOR_LEN)
-
-/*
- * For booting Linux, the board info and command line data
- * have to be in the first 8 MB of memory, since this is
- * the maximum mapped by the Linux kernel during initialization.
- */
-#define CFG_BOOTMAPSZ          (8 << 20)       /* Initial Memory map for Linux */
 
 /*-----------------------------------------------------------------------
  * FLASH organization
  */
-
 #define CFG_MAX_FLASH_BANKS    2       /* max number of memory banks           */
 #define CFG_MAX_FLASH_SECT     256     /* max number of sectors on one chip    */
 
@@ -421,21 +319,5 @@ unsigned char spi_read(void);
 
 #define CPLD_REG0_ADDR 0x50100000
 #define CPLD_REG1_ADDR 0x50100001
-/*
- * Internal Definitions
- *
- * Boot Flags
- */
-#define BOOTFLAG_COLD  0x01            /* Normal Power-On: Boot from FLASH */
-#define BOOTFLAG_WARM  0x02            /* Software reboot */
-
-#if defined(CONFIG_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
-
-/* pass open firmware flat tree */
-#define CONFIG_OF_LIBFDT       1
-#define CONFIG_OF_BOARD_SETUP  1
 
 #endif /* __CONFIG_H */
index 1879d38522099ed3d7be6eed1a1cccc6a9d49cff..ba421925edcd1b2d400ca47cc7cdeaab8d89ae7a 100644 (file)
 #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        */
 
+/*
+ * Include common defines/options for all AMCC eval boards
+ */
+#define CONFIG_HOSTNAME                taishan
+#define CONFIG_USE_TTY         ttyS1
+#include "amcc-common.h"
+
 #define CONFIG_BOARD_EARLY_INIT_F 1    /* Call board_pre_init          */
 #define CONFIG_MISC_INIT_R     1       /* Call misc_init_r             */
 
@@ -42,9 +48,7 @@
  * Base addresses -- Note these are effective addresses where the
  * actual resources get mapped (not physical addresses)
  *----------------------------------------------------------------------*/
-#define CFG_SDRAM_BASE         0x00000000      /* _must_ be 0          */
 #define CFG_FLASH_BASE         0xfc000000      /* start of FLASH       */
-#define CFG_MONITOR_BASE       0xfffc0000      /* start of monitor     */
 #define CFG_PCI_MEMBASE                0x80000000      /* mapped pci memory    */
 #define CFG_PERIPHERAL_BASE    0xe0000000      /* internal peripherals */
 #define CFG_ISRAM_BASE         0xc0000000      /* internal SRAM        */
 #define CFG_POST_WORD_ADDR     (CFG_GBL_DATA_OFFSET - 0x4)
 #define CFG_INIT_SP_OFFSET     CFG_POST_WORD_ADDR
 
-#define CFG_MONITOR_LEN                (256 * 1024)    /* Reserve 256 kB for Mon*/
-#define CFG_MALLOC_LEN         (1024 * 1024)   /* Reserve 1024 kB for malloc*/
-
 /*-----------------------------------------------------------------------
  * Serial Port
  *----------------------------------------------------------------------*/
 #define CONFIG_UART1_CONSOLE   1       /* use of UART1 as console      */
-#define CONFIG_SERIAL_MULTI     1      /* enable serial multi support  */
 #define CFG_EXT_SERIAL_CLOCK   (1843200 * 6)   /* Ext clk @ 11.059 MHz */
-#define CONFIG_BAUDRATE                115200
-
-#define CFG_BAUDRATE_TABLE  \
-    {300, 600, 1200, 2400, 4800, 9600, 19200, 38400, 57600, 115200}
 
 /*-----------------------------------------------------------------------
  * Environment
 /*-----------------------------------------------------------------------
  * 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
 
 #undef CFG_I2C_MULTI_EEPROMS
 #define CFG_I2C_EEPROM_ADDR    0x50
 #define CFG_DTT_LOW_TEMP       -30
 #define CFG_DTT_HYSTERESIS     3
 
-/*-----------------------------------------------------------------------
- * Environment
- *----------------------------------------------------------------------*/
-
-#define CONFIG_PREBOOT "echo;" \
-       "echo Type \\\"run flash_nfs\\\" to mount root filesystem over NFS;" \
-       "echo"
-
-#undef CONFIG_BOOTARGS
-
+/*
+ * Default environment variables
+ */
 #define        CONFIG_EXTRA_ENV_SETTINGS                                       \
-       "netdev=eth0\0"                                                 \
-       "hostname=taishan\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_4xx\0"                                  \
-       "bootfile=/tftpboot/taishan/uImage\0"                           \
+       CONFIG_AMCC_DEF_ENV                                             \
+       CONFIG_AMCC_DEF_ENV_POWERPC                                     \
+       CONFIG_AMCC_DEF_ENV_PPC_OLD                                     \
+       CONFIG_AMCC_DEF_ENV_NOR_UPD                                     \
        "kernel_addr=fc000000\0"                                        \
        "ramdisk_addr=fc180000\0"                                       \
-       "initrd_high=30000000\0"                                        \
-       "load=tftp 100000 /tftpboot/taishan/u-boot.bin\0"               \
-       "update=protect off fffc0000 ffffffff;era fffc0000 ffffffff;"   \
-               "cp.b 100000 fffc0000 40000;"                           \
-               "setenv filesize;saveenv\0"                             \
-       "upd=run load update\0"                                         \
-       "fixedip=setenv bootargs $(bootargs) ip=$(ipaddr):$(serverip):" \
-       "$(gatewayip):$(netmask):$(hostname):$(netdev):off panic=1\0"   \
-       "dhcp=setenv bootargs $(bootargs) ip=dhcp\0"                    \
        "kozio=bootm 0xffe00000\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_BAUDRATE                115200
-#define CONFIG_LOADS_ECHO      1       /* echo on for serial download  */
-#define CFG_LOADS_BAUD_CHANGE  1       /* allow baudrate change        */
 
 /*-----------------------------------------------------------------------
  * Networking
  *----------------------------------------------------------------------*/
 #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_PHY2_ADDR       0x1
 #define CONFIG_PHY_GIGE                1       /* Include GbE speed/duplex detection */
 #define CONFIG_PHY_RESET        1       /* reset phy upon startup         */
 #define CONFIG_PHY_RESET_DELAY 1000
-#define CFG_RX_ETH_BUFFER      32      /* Number of ethernet rx buffers & descriptors */
-
-#define CONFIG_NETCONSOLE              /* include NetConsole support   */
-
-
-/*
- * BOOTP options
- */
-#define CONFIG_BOOTP_BOOTFILESIZE
-#define CONFIG_BOOTP_BOOTPATH
-#define CONFIG_BOOTP_GATEWAY
-#define CONFIG_BOOTP_HOSTNAME
-
 
 /*
- * Command line configuration.
+ * Commands additional to the ones defined in amcc-common.h
  */
-#include <config_cmd_default.h>
-
-#define CONFIG_CMD_ASKENV
-#define CONFIG_CMD_DHCP
-#define CONFIG_CMD_DIAG
 #define CONFIG_CMD_DTT
-#define CONFIG_CMD_ELF
-#define CONFIG_CMD_EEPROM
-#define CONFIG_CMD_I2C
-#define CONFIG_CMD_IRQ
-#define CONFIG_CMD_MII
-#define CONFIG_CMD_NET
-#define CONFIG_CMD_NFS
 #define CONFIG_CMD_PCI
-#define CONFIG_CMD_PING
-#define CONFIG_CMD_REGINFO
-
-
-#undef CONFIG_WATCHDOG                 /* watchdog disabled            */
-
-/*-----------------------------------------------------------------------
- * Miscellaneous configurable options
- *----------------------------------------------------------------------*/
-#define CFG_LONGHELP                   /* undef to save memory         */
-#define CFG_PROMPT             "=> "   /* Monitor Command Prompt       */
-#if defined(CONFIG_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
 #define CFG_PCI_SUBSYS_VENDORID 0x10e8 /* AMCC */
 #define CFG_PCI_SUBSYS_DEVICEID 0xcafe /* Whatever */
 
-/*
- * 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 */
-
-/*
- * Internal Definitions
- *
- * Boot Flags
- */
-#define BOOTFLAG_COLD  0x01            /* Normal Power-On: Boot from FLASH     */
-#define BOOTFLAG_WARM  0x02            /* Software reboot                      */
-
-#if defined(CONFIG_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
-
-/* pass open firmware flat tree */
-#define CONFIG_OF_LIBFDT       1
-#define CONFIG_OF_BOARD_SETUP  1
-
 #endif /* __CONFIG_H */
index 25155ad34958bf3bdea6be7e841b1dbcf78b4797..f77dd14f1a857d27124beb65412ca2269fe54ac1 100644 (file)
 #define CFG_MCIO0_VAL          0x00008407
 #define CFG_MCIO1_VAL          0x0000c108
 
-#define CONFIG_DRIVER_DM9000           1
 #define CONFIG_DRIVER_DM9000           1
 #define CONFIG_DM9000_BASE     0x08000000
 #define DM9000_IO                      CONFIG_DM9000_BASE
 #define DM9000_DATA                    (CONFIG_DM9000_BASE+0x8004)
-/* #define CONFIG_DM9000_USE_8BIT */
-/* #define CONFIG_DM9000_USE_16BIT */
-#define CONFIG_DM9000_USE_32BIT
 
 #define CONFIG_USB_OHCI_NEW    1
 #define CFG_USB_OHCI_BOARD_INIT        1
index adc420b9ade46063212829eea0543f89ed92391a..e19c5f34825a5ead1926d8195f9387400edb1c7b 100644 (file)
 #define CONFIG_WALNUT          1       /* ...on a WALNUT board         */
                                        /* ...and on a SYCAMORE board   */
 
+/*
+ * Include common defines/options for all AMCC eval boards
+ */
+#define CONFIG_HOSTNAME                walnut
+#include "amcc-common.h"
+
 #define CONFIG_BOARD_EARLY_INIT_F 1    /* Call board_early_init_f      */
 
 #define CONFIG_SYS_CLK_FREQ    33333333 /* external frequency to pll   */
 
-#define CONFIG_PREBOOT "echo;" \
-       "echo Type \\\"run flash_nfs\\\" to mount root filesystem over NFS;" \
-       "echo"
-
-#undef CONFIG_BOOTARGS
-
-#define CONFIG_EXTRA_ENV_SETTINGS                                      \
-       "netdev=eth0\0"                                                 \
-       "hostname=walnut\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=ttyS0,${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_4xx\0"                                  \
-       "bootfile=/tftpboot/walnut/uImage\0"                            \
+/*
+ * Default environment variables
+ */
+#define        CONFIG_EXTRA_ENV_SETTINGS                                       \
+       CONFIG_AMCC_DEF_ENV                                             \
+       CONFIG_AMCC_DEF_ENV_POWERPC                                     \
+       CONFIG_AMCC_DEF_ENV_PPC_OLD                                     \
+       CONFIG_AMCC_DEF_ENV_NOR_UPD                                     \
        "kernel_addr=fff80000\0"                                        \
        "ramdisk_addr=fff80000\0"                                       \
-       "initrd_high=30000000\0"                                        \
-       "load=tftp 100000 /tftpboot/walnut/u-boot.bin\0"                \
-       "update=protect off fffc0000 ffffffff;era fffc0000 ffffffff;"   \
-               "cp.b 100000 fffc0000 40000;"                           \
-               "setenv filesize;saveenv\0"                             \
-       "upd=run load update\0"                                         \
        ""
-#define CONFIG_BOOTCOMMAND     "run net_nfs"
-
-#if 0
-#define CONFIG_BOOTDELAY       -1      /* autoboot disabled            */
-#else
-#define CONFIG_BOOTDELAY       5       /* autoboot after 5 seconds     */
-#endif
-
-#define CONFIG_BAUDRATE                115200
-
-#define CONFIG_LOADS_ECHO      1       /* echo on for serial download  */
-#define CFG_LOADS_BAUD_CHANGE  1       /* allow baudrate change        */
 
-#define CONFIG_MII             1       /* MII PHY management           */
 #define CONFIG_PHY_ADDR                1       /* PHY address                  */
-
-#define CFG_RX_ETH_BUFFER      16      /* use 16 rx buffer on 405 emac */
 #define CONFIG_HAS_ETH0                1
 
-#define CONFIG_NETCONSOLE              /* include NetConsole support   */
-#define CONFIG_NET_MULTI               /* needed for NetConsole        */
-
 #define CONFIG_RTC_DS174x      1       /* use DS1743 RTC in Walnut     */
 
-
-/*
- * BOOTP options
- */
-#define CONFIG_BOOTP_BOOTFILESIZE
-#define CONFIG_BOOTP_BOOTPATH
-#define CONFIG_BOOTP_GATEWAY
-#define CONFIG_BOOTP_HOSTNAME
-
-
 /*
- * Command line configuration.
+ * Commands additional to the ones defined in amcc-common.h
  */
-#include <config_cmd_default.h>
-
-#define CONFIG_CMD_ASKENV
 #define CONFIG_CMD_DATE
-#define CONFIG_CMD_DHCP
-#define CONFIG_CMD_DIAG
-#define CONFIG_CMD_EEPROM
-#define CONFIG_CMD_ELF
-#define CONFIG_CMD_I2C
-#define CONFIG_CMD_IRQ
-#define CONFIG_CMD_MII
-#define CONFIG_CMD_NET
-#define CONFIG_CMD_NFS
 #define CONFIG_CMD_PCI
-#define CONFIG_CMD_PING
-#define CONFIG_CMD_REGINFO
 #define CONFIG_CMD_SDRAM
 #define CONFIG_CMD_SNTP
 
-
-#undef CONFIG_WATCHDOG                 /* watchdog disabled            */
-
 #define CONFIG_SPD_EEPROM      1       /* use SPD EEPROM for setup    */
 
-/*
- * Miscellaneous configurable options
- */
-#define CFG_LONGHELP                   /* undef to save memory         */
-#define CFG_PROMPT     "=> "           /* Monitor Command Prompt       */
-#if defined(CONFIG_CMD_KGDB)
-#define CFG_CBSIZE     1024            /* Console I/O Buffer Size      */
-#else
-#define CFG_CBSIZE     256             /* Console I/O Buffer Size      */
-#endif
-#define CFG_PBSIZE (CFG_CBSIZE+sizeof(CFG_PROMPT)+16) /* Print Buffer Size */
-#define CFG_MAXARGS    16              /* max number of command args   */
-#define CFG_BARGSIZE   CFG_CBSIZE      /* Boot Argument Buffer Size    */
-
-#define CFG_MEMTEST_START      0x0400000       /* memtest works on     */
-#define CFG_MEMTEST_END                0x0C00000       /* 4 ... 12 MB in DRAM  */
-
 /*
  * If CFG_EXT_SERIAL_CLOCK, then the UART divisor is 1.
  * If CFG_405_UART_ERRATA_59, then UART divisor is 31.
 #undef CFG_405_UART_ERRATA_59         /* 405GP/CR Rev. D silicon */
 #define CFG_BASE_BAUD      691200
 
-/* The following table includes the supported baudrates */
-#define CFG_BAUDRATE_TABLE  \
-    {300, 600, 1200, 2400, 4800, 9600, 19200, 38400, 57600, 115200, 230400}
-
-#define CFG_LOAD_ADDR          0x100000        /* default load address */
-#define CFG_EXTBDINFO          1       /* To use extended board_into (bd_t) */
-
-#define CFG_HZ         1000            /* decrementer freq: 1 ms ticks */
-
-#define CONFIG_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 */
-
 /*-----------------------------------------------------------------------
  * I2C stuff
  *-----------------------------------------------------------------------
  */
-#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)
 /*-----------------------------------------------------------------------
  * Start addresses for the final memory configuration
  * (Set up by the startup code)
- * Please note that CFG_SDRAM_BASE _must_ start at 0
  */
-#define CFG_SDRAM_BASE         0x00000000
 #define CFG_FLASH_BASE         0xFFF80000
-#define CFG_MONITOR_LEN                (256 * 1024)    /* Reserve 256 kB for Monitor   */
-#define CFG_MALLOC_LEN         (128 * 1024)    /* Reserve 128 kB for malloc()  */
-#define CFG_MONITOR_BASE       (-CFG_MONITOR_LEN)
 
 /*
  * Define here the location of the environment variables (FLASH or NVRAM).
 #define CFG_ENV_IS_IN_NVRAM    1       /* use NVRAM for environment vars       */
 #endif
 
-/*
- * For booting Linux, the board info and command line data
- * have to be in the first 8 MB of memory, since this is
- * the maximum mapped by the Linux kernel during initialization.
- */
-#define CFG_BOOTMAPSZ          (8 << 20)       /* Initial Memory map for Linux */
-
 /*-----------------------------------------------------------------------
  * FLASH organization
  */
  */
 #define SPD_EEPROM_ADDRESS     0x50
 
-/*
- * Internal Definitions
- *
- * Boot Flags
- */
-#define BOOTFLAG_COLD  0x01            /* Normal Power-On: Boot from FLASH     */
-#define BOOTFLAG_WARM  0x02            /* Software reboot                      */
-
-#if defined(CONFIG_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
-
-/* pass open firmware flat tree */
-#define CONFIG_OF_LIBFDT       1
-#define CONFIG_OF_BOARD_SETUP  1
-
 #endif /* __CONFIG_H */
index f22e79824cd0e5774239c349b46bc35f411bbad5..891b515d4ec56e0a020c0547fa7bd3c4335f05d7 100644 (file)
 #define CONFIG_4xx             1       /* ... PPC4xx family            */
 #define CONFIG_SYS_CLK_FREQ    66666666    /* external freq to pll     */
 
+/*
+ * Include common defines/options for all AMCC eval boards
+ */
+#include "amcc-common.h"
+
 #define CONFIG_BOARD_EARLY_INIT_F 1     /* Call board_early_init_f     */
 #define CONFIG_MISC_INIT_R     1       /* call misc_init_r()           */
 #define CONFIG_BOARD_RESET     1       /* call board_reset()           */
  * 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         (256 * 1024)    /* Reserve 256 kB for malloc()  */
-#define CFG_MONITOR_BASE       (-CFG_MONITOR_LEN)
-#define CFG_SDRAM_BASE         0x00000000          /* _must_ be 0      */
 #define CFG_FLASH_BASE         0xfc000000          /* start of FLASH   */
 #define CFG_PCI_MEMBASE                0xa0000000          /* mapped pci memory*/
 #define CFG_PCI_MEMBASE1        CFG_PCI_MEMBASE  + 0x10000000
  * Serial Port
  *----------------------------------------------------------------------*/
 #define CFG_EXT_SERIAL_CLOCK   11059200 /* use external 11.059MHz clk  */
-#define CONFIG_BAUDRATE                115200
-#define CONFIG_SERIAL_MULTI     1
 /*define this if you want console on UART1*/
 #undef CONFIG_UART1_CONSOLE
 
-#define CFG_BAUDRATE_TABLE  \
-    {300, 600, 1200, 2400, 4800, 9600, 19200, 38400, 57600, 115200}
-
 /*-----------------------------------------------------------------------
  * Environment
  *----------------------------------------------------------------------*/
 /*-----------------------------------------------------------------------
  * 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_DTT_LOW_TEMP       -30
 #define CFG_DTT_HYSTERESIS     3
 
-#define CONFIG_PREBOOT "echo;" \
-       "echo Type \\\"run flash_nfs\\\" to mount root filesystem over NFS;" \
-       "echo"
-
-#undef CONFIG_BOOTARGS
-
-/* Setup some board specific values for the default environment variables */
-#ifndef CONFIG_YELLOWSTONE
-#define CONFIG_HOSTNAME                yosemite
-#define CFG_BOOTFILE           "bootfile=/tftpboot/yosemite/uImage\0"
-#define CFG_ROOTPATH           "rootpath=/opt/eldk/ppc_4xxFP\0"
-#else
-#define CONFIG_HOSTNAME                yellowstone
-#define CFG_BOOTFILE           "bootfile=/tftpboot/yellowstone/uImage\0"
-#define CFG_ROOTPATH           "rootpath=/opt/eldk/ppc_4xx\0"
-#endif
-
+/*
+ * Default environment variables
+ */
 #define        CONFIG_EXTRA_ENV_SETTINGS                                       \
-       CFG_BOOTFILE                                                    \
-       CFG_ROOTPATH                                                    \
-       "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=ttyS0,${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"                                               \
-       "bootfile=/tftpboot/${hostname}/uImage\0"                       \
+       CONFIG_AMCC_DEF_ENV                                             \
+       CONFIG_AMCC_DEF_ENV_POWERPC                                     \
+       CONFIG_AMCC_DEF_ENV_PPC_OLD                                     \
+       CONFIG_AMCC_DEF_ENV_NOR_UPD                                     \
        "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;"                           \
-               "setenv filesize;saveenv\0"                             \
-       "upd=run load 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_BAUDRATE                115200
-
-#define CONFIG_LOADS_ECHO      1       /* echo on for serial download  */
-#define CFG_LOADS_BAUD_CHANGE  1       /* allow baudrate change        */
 
-#define CONFIG_MII             1       /* MII PHY management           */
-#define CONFIG_NET_MULTI        1      /* required for netconsole      */
-#define CONFIG_PHY1_ADDR        3
 #define CONFIG_HAS_ETH0                1       /* add support for "ethaddr"    */
 #define CONFIG_HAS_ETH1                1       /* add support for "eth1addr"   */
 #define CONFIG_PHY_ADDR                1       /* PHY address, See schematics  */
-
-#define CFG_RX_ETH_BUFFER      32      /* Number of ethernet rx buffers & descriptors */
-
-#define CONFIG_NETCONSOLE              /* include NetConsole support   */
+#define CONFIG_PHY1_ADDR        3
 
 /* Partitions */
 #define CONFIG_MAC_PARTITION
 #define CONFIG_HW_WATCHDOG                     /* watchdog */
 #endif
 
-
 /*
- * BOOTP options
+ * Commands additional to the ones defined in amcc-common.h
  */
-#define CONFIG_BOOTP_BOOTFILESIZE
-#define CONFIG_BOOTP_BOOTPATH
-#define CONFIG_BOOTP_GATEWAY
-#define CONFIG_BOOTP_HOSTNAME
-
-
-/*
- * Command line configuration.
- */
-#include <config_cmd_default.h>
-
-#define CONFIG_CMD_ASKENV
-#define CONFIG_CMD_DHCP
-#define CONFIG_CMD_DIAG
 #define CONFIG_CMD_DTT
-#define CONFIG_CMD_ELF
-#define CONFIG_CMD_EEPROM
-#define CONFIG_CMD_I2C
-#define CONFIG_CMD_IRQ
-#define CONFIG_CMD_MII
-#define CONFIG_CMD_NET
-#define CONFIG_CMD_NFS
 #define CONFIG_CMD_PCI
-#define CONFIG_CMD_PING
-#define CONFIG_CMD_REGINFO
-#define CONFIG_CMD_SDRAM
 
 #ifdef CONFIG_440EP
     #define CONFIG_CMD_USB
     #define CONFIG_CMD_EXT2
 #endif
 
-
-/*
- * Miscellaneous configurable options
- */
-#define CFG_LONGHELP                   /* undef to save memory         */
-#define CFG_PROMPT             "=> "   /* Monitor Command Prompt       */
-#if defined(CONFIG_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 CONFIG_LYNXKDI          1       /* support kdi files            */
-
-#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
  *-----------------------------------------------------------------------
 #define CFG_PCI_SUBSYS_VENDORID 0x10e8 /* AMCC */
 #define CFG_PCI_SUBSYS_ID       0xcafe /* Whatever */
 
-/*
- * 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_BCSR5_PCI66EN      0x80
 
-/*
- * Internal Definitions
- *
- * Boot Flags
- */
-#define BOOTFLAG_COLD  0x01            /* Normal Power-On: Boot from FLASH     */
-#define BOOTFLAG_WARM  0x02            /* Software reboot                      */
-
-#if defined(CONFIG_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
-
-/* pass open firmware flat tree */
-#define CONFIG_OF_LIBFDT       1
-#define CONFIG_OF_BOARD_SETUP  1
-
 #endif /* __CONFIG_H */
index 6f9d3e3c6f3477f56c06a4ef6dbc0b17b8eb616e..026fef67ce4ce01774aab82cbff0438a0f254c18 100644 (file)
 #define CONFIG_440                     1       /* ... PPC440 family    */
 #define CONFIG_440SPE                  1       /* Specifc SPe support  */
 #define CONFIG_BOARD_EARLY_INIT_F      1       /* Call board_pre_init  */
-#undef CFG_DRAM_TEST                           /* Disable-takes long time */
 #define CONFIG_SYS_CLK_FREQ    33333333        /* external freq to pll */
 #define EXTCLK_33_33           33333333
 #define EXTCLK_66_66           66666666
 #define EXTCLK_50              50000000
 #define EXTCLK_83              83333333
 
+/*
+ * Include common defines/options for all AMCC eval boards
+ */
+#define CONFIG_HOSTNAME                yucca
+#include "amcc-common.h"
+
 #define        CONFIG_MISC_INIT_F      1       /* Use misc_init_f()            */
 #undef  CONFIG_SHOW_BOOT_PROGRESS
 #undef  CONFIG_STRESS
@@ -53,9 +58,7 @@
  * Base addresses -- Note these are effective addresses where the
  * actual resources get mapped (not physical addresses)
  *----------------------------------------------------------------------*/
-#define CFG_SDRAM_BASE         0x00000000      /* _must_ be 0          */
 #define CFG_FLASH_BASE         0xfff00000      /* start of FLASH       */
-#define CFG_MONITOR_BASE       0xfffb0000      /* start of monitor     */
 #define CFG_PERIPHERAL_BASE    0xa0000000      /* internal peripherals */
 #define CFG_ISRAM_BASE         0x90000000      /* internal SRAM        */
 
 #define CFG_POST_WORD_ADDR     (CFG_GBL_DATA_OFFSET - 0x4)
 #define CFG_INIT_SP_OFFSET     CFG_POST_WORD_ADDR
 
-#define CFG_MONITOR_LEN                (320 * 1024)    /* Reserve 320 kB for Mon */
-#define CFG_MALLOC_LEN         (512 * 1024)    /* Reserve 512 kB for malloc */
-
 /*-----------------------------------------------------------------------
  * Serial Port
  *----------------------------------------------------------------------*/
-#define CONFIG_SERIAL_MULTI    1
 #undef CONFIG_UART1_CONSOLE
 
 #undef CONFIG_SERIAL_SOFTWARE_FIFO
 #undef CFG_EXT_SERIAL_CLOCK
 /* #define CFG_EXT_SERIAL_CLOCK        (1843200 * 6) */ /* Ext clk @ 11.059 MHz */
 
-#define CONFIG_BAUDRATE                115200
-
-#define CFG_BAUDRATE_TABLE  \
-       {300, 600, 1200, 2400, 4800, 9600, 19200, 38400, 57600, 115200}
-
 /*-----------------------------------------------------------------------
  * DDR SDRAM
  *----------------------------------------------------------------------*/
 /*-----------------------------------------------------------------------
  * 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 IIC0_BOOTPROM_ADDR     0x50
 #define IIC0_ALT_BOOTPROM_ADDR 0x54
 #undef CFG_ENV_IS_IN_EEPROM            /* ... not in EEPROM            */
 #define CONFIG_ENV_OVERWRITE   1
 
-#define CONFIG_PREBOOT "echo;" \
-       "echo Type \\\"run flash_nfs\\\" to mount root filesystem over NFS;" \
-       "echo"
-
-#undef CONFIG_BOOTARGS
-
+/*
+ * Default environment variables
+ */
 #define        CONFIG_EXTRA_ENV_SETTINGS                                       \
-       "netdev=eth0\0"                                                 \
-       "hostname=yucca\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=ttyS0,${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_4xx\0"                                  \
-       "bootfile=yucca/uImage\0"                                       \
+       CONFIG_AMCC_DEF_ENV                                             \
+       CONFIG_AMCC_DEF_ENV_PPC                                         \
+       CONFIG_AMCC_DEF_ENV_NOR_UPD                                     \
        "kernel_addr=E7F10000\0"                                        \
        "ramdisk_addr=E7F20000\0"                                       \
-       "initrd_high=30000000\0"                                        \
-       "load=tftp 100000 yuca/u-boot.bin\0"                            \
-       "update=protect off 2:4-7;era 2:4-7;"                           \
-               "cp.b ${fileaddr} FFFB0000 ${filesize};"                \
-               "setenv filesize;saveenv\0"                             \
-       "upd=run load update\0"                                         \
        "pciconfighost=1\0"                                             \
        "pcie_mode=RP:EP:EP\0"                                          \
        ""
-#define CONFIG_BOOTCOMMAND     "run flash_self"
-
-#define CONFIG_BOOTDELAY       5       /* autoboot after 5 seconds     */
-
-#define CONFIG_LOADS_ECHO      1       /* echo on for serial download  */
-#define CFG_LOADS_BAUD_CHANGE  1       /* allow baudrate change        */
-
 
 /*
- * BOOTP options
+ * Commands additional to the ones defined in amcc-common.h
  */
-#define CONFIG_BOOTP_BOOTFILESIZE
-#define CONFIG_BOOTP_BOOTPATH
-#define CONFIG_BOOTP_GATEWAY
-#define CONFIG_BOOTP_HOSTNAME
-
-
-/*
- * Command line configuration.
- */
-#include <config_cmd_default.h>
-
-#define CONFIG_CMD_ASKENV
-#define CONFIG_CMD_EEPROM
-#define CONFIG_CMD_DHCP
-#define CONFIG_CMD_DIAG
-#define CONFIG_CMD_ELF
-#define CONFIG_CMD_I2C
-#define CONFIG_CMD_IRQ
-#define CONFIG_CMD_MII
-#define CONFIG_CMD_NET
-#define CONFIG_CMD_NFS
 #define CONFIG_CMD_PCI
-#define CONFIG_CMD_PING
-#define CONFIG_CMD_REGINFO
 #define CONFIG_CMD_SDRAM
 
-
 #define        CONFIG_IBM_EMAC4_V4     1
-#define CONFIG_MII             1       /* MII PHY management           */
-#undef CONFIG_NET_MULTI
 #define CONFIG_PHY_ADDR                1       /* PHY address, See schematics  */
 #define CONFIG_HAS_ETH0
 #define CONFIG_PHY_RESET        1      /* reset phy upon startup       */
 #define CONFIG_PHY_RESET_DELAY 1000
 #define CONFIG_CIS8201_PHY     1       /* Enable 'special' RGMII mode for Cicada phy */
 #define CONFIG_PHY_GIGE                1       /* Include GbE speed/duplex detection */
-#define CFG_RX_ETH_BUFFER      32      /* Number of ethernet rx buffers & descriptors */
-
-#define CONFIG_NETCONSOLE              /* include NetConsole support   */
-#define CONFIG_NET_MULTI               /* needed for NetConsole        */
-
-#undef CONFIG_WATCHDOG                 /* watchdog disabled            */
-
-/*
- * Miscellaneous configurable options
- */
-#define CFG_LONGHELP                           /* undef to save memory         */
-#define CFG_PROMPT             "=> "           /* Monitor Command Prompt       */
-
-#if defined(CONFIG_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 */
 
 /*-----------------------------------------------------------------------
  * FLASH related
 /* Support for Intel 82557/82559/82559ER chips. */
 #define CONFIG_EEPRO100
 
-/*
- * 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*/
-
-/*
- * Internal Definitions
- *
- * Boot Flags
- */
-#define BOOTFLAG_COLD  0x01            /* Normal Power-On: Boot from FLASH */
-#define BOOTFLAG_WARM  0x02            /* Software reboot */
-
-#if defined(CONFIG_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
-
 /* FB Divisor selection */
 #define FPGA_FB_DIV_6          6
 #define FPGA_FB_DIV_10         10
 #define PERIOD_33_33MHZ                30000   /* 30ns */
 #define PERIOD_25_00MHZ                40000   /* 40ns */
 
-/*---------------------------------------------------------------------------*/
-
-/* pass open firmware flat tree */
-#define CONFIG_OF_LIBFDT       1
-#define CONFIG_OF_BOARD_SETUP  1
-
 #endif /* __CONFIG_H */
index 634ff0291cac1375a57ce1c0b5af89513745ad26..49fd8a60ff924dedaf20064b0852ab5fc1d9ae51 100644 (file)
@@ -16,7 +16,6 @@
 #include <linux/mtd/nand.h>
 
 struct fsl_upm {
-       const u32 *array;
        void __iomem *mdr;
        void __iomem *mxmr;
        void __iomem *mar;
index 72d7341d7548e9e1fa901c471c73232875a12a24..4cebea9597998fb4dc085b76a7a24c1670f46bf8 100644 (file)
@@ -93,7 +93,7 @@ struct nand_oobinfo {
        uint32_t useecc;
        uint32_t eccbytes;
        uint32_t oobfree[8][2];
-       uint32_t eccpos[32];
+       uint32_t eccpos[48];
 };
 
 #endif /* __MTD_ABI_H__ */
index d2e1e2bb6c8705256568decada830cd0b3f5d25c..939b82541a26ca35432ea0eec4f2689b041553c3 100644 (file)
@@ -14,6 +14,7 @@
 #define __MPC83XX_H__
 
 #include <config.h>
+#include <asm/fsl_lbc.h>
 #if defined(CONFIG_E300)
 #include <asm/e300.h>
 #endif
 #define CSCONFIG_EN                    0x80000000
 #define CSCONFIG_AP                    0x00800000
 #define CSCONFIG_ODT_WR_ACS            0x00010000
+#define CSCONFIG_BANK_BIT_3            0x00004000
 #define CSCONFIG_ROW_BIT               0x00000700
 #define CSCONFIG_ROW_BIT_12            0x00000000
 #define CSCONFIG_ROW_BIT_13            0x00000100
 #define ECC_ERROR_MAN_SBEC             (0xff000000>>24)        /* Single Bit Error Counter 0..255 */
 #define ECC_ERROR_MAN_SBEC_SHIFT       0
 
-/* BR - Base Registers
- */
-#define BR0                            0x5000          /* Register offset to immr */
-#define BR1                            0x5008
-#define BR2                            0x5010
-#define BR3                            0x5018
-#define BR4                            0x5020
-#define BR5                            0x5028
-#define BR6                            0x5030
-#define BR7                            0x5038
-
-#define BR_BA                          0xFFFF8000
-#define BR_BA_SHIFT                    15
-#define BR_PS                          0x00001800
-#define BR_PS_SHIFT                    11
-#define BR_PS_8                                0x00000800      /* Port Size 8 bit */
-#define BR_PS_16                       0x00001000      /* Port Size 16 bit */
-#define BR_PS_32                       0x00001800      /* Port Size 32 bit */
-#define BR_DECC                                0x00000600
-#define BR_DECC_SHIFT                  9
-#define BR_DECC_OFF                    0x00000000
-#define BR_DECC_CHK                    0x00000200
-#define BR_DECC_CHK_GEN                        0x00000400
-#define BR_WP                          0x00000100
-#define BR_WP_SHIFT                    8
-#define BR_MSEL                                0x000000E0
-#define BR_MSEL_SHIFT                  5
-#define BR_MS_GPCM                     0x00000000      /* GPCM */
-#define BR_MS_FCM                      0x00000020      /* FCM */
-#define BR_MS_SDRAM                    0x00000060      /* SDRAM */
-#define BR_MS_UPMA                     0x00000080      /* UPMA */
-#define BR_MS_UPMB                     0x000000A0      /* UPMB */
-#define BR_MS_UPMC                     0x000000C0      /* UPMC */
-#if !defined(CONFIG_MPC834X)
-#define BR_ATOM                                0x0000000C
-#define BR_ATOM_SHIFT                  2
-#endif
-#define BR_V                           0x00000001
-#define BR_V_SHIFT                     0
-
-#if defined(CONFIG_MPC834X)
-#define BR_RES                         ~(BR_BA | BR_PS | BR_DECC | BR_WP | BR_MSEL | BR_V)
-#else
-#define BR_RES                         ~(BR_BA | BR_PS | BR_DECC | BR_WP | BR_MSEL | BR_ATOM | BR_V)
-#endif
-
-/* OR - Option Registers
- */
-#define OR0                            0x5004          /* Register offset to immr */
-#define OR1                            0x500C
-#define OR2                            0x5014
-#define OR3                            0x501C
-#define OR4                            0x5024
-#define OR5                            0x502C
-#define OR6                            0x5034
-#define OR7                            0x503C
-
-#define OR_GPCM_AM                     0xFFFF8000
-#define OR_GPCM_AM_SHIFT               15
-#define OR_GPCM_BCTLD                  0x00001000
-#define OR_GPCM_BCTLD_SHIFT            12
-#define OR_GPCM_CSNT                   0x00000800
-#define OR_GPCM_CSNT_SHIFT             11
-#define OR_GPCM_ACS                    0x00000600
-#define OR_GPCM_ACS_SHIFT              9
-#define OR_GPCM_ACS_0b10               0x00000400
-#define OR_GPCM_ACS_0b11               0x00000600
-#define OR_GPCM_XACS                   0x00000100
-#define OR_GPCM_XACS_SHIFT             8
-#define OR_GPCM_SCY                    0x000000F0
-#define OR_GPCM_SCY_SHIFT              4
-#define OR_GPCM_SCY_1                  0x00000010
-#define OR_GPCM_SCY_2                  0x00000020
-#define OR_GPCM_SCY_3                  0x00000030
-#define OR_GPCM_SCY_4                  0x00000040
-#define OR_GPCM_SCY_5                  0x00000050
-#define OR_GPCM_SCY_6                  0x00000060
-#define OR_GPCM_SCY_7                  0x00000070
-#define OR_GPCM_SCY_8                  0x00000080
-#define OR_GPCM_SCY_9                  0x00000090
-#define OR_GPCM_SCY_10                 0x000000a0
-#define OR_GPCM_SCY_11                 0x000000b0
-#define OR_GPCM_SCY_12                 0x000000c0
-#define OR_GPCM_SCY_13                 0x000000d0
-#define OR_GPCM_SCY_14                 0x000000e0
-#define OR_GPCM_SCY_15                 0x000000f0
-#define OR_GPCM_SETA                   0x00000008
-#define OR_GPCM_SETA_SHIFT             3
-#define OR_GPCM_TRLX                   0x00000004
-#define OR_GPCM_TRLX_SHIFT             2
-#define OR_GPCM_EHTR                   0x00000002
-#define OR_GPCM_EHTR_SHIFT             1
-#define OR_GPCM_EAD                    0x00000001
-#define OR_GPCM_EAD_SHIFT              0
-
-#define OR_FCM_AM                      0xFFFF8000
-#define OR_FCM_AM_SHIFT                                15
-#define OR_FCM_BCTLD                   0x00001000
-#define OR_FCM_BCTLD_SHIFT                     12
-#define OR_FCM_PGS                     0x00000400
-#define OR_FCM_PGS_SHIFT                       10
-#define OR_FCM_CSCT                    0x00000200
-#define OR_FCM_CSCT_SHIFT                       9
-#define OR_FCM_CST                     0x00000100
-#define OR_FCM_CST_SHIFT                        8
-#define OR_FCM_CHT                     0x00000080
-#define OR_FCM_CHT_SHIFT                        7
-#define OR_FCM_SCY                     0x00000070
-#define OR_FCM_SCY_SHIFT                        4
-#define OR_FCM_SCY_1                   0x00000010
-#define OR_FCM_SCY_2                   0x00000020
-#define OR_FCM_SCY_3                   0x00000030
-#define OR_FCM_SCY_4                   0x00000040
-#define OR_FCM_SCY_5                   0x00000050
-#define OR_FCM_SCY_6                   0x00000060
-#define OR_FCM_SCY_7                   0x00000070
-#define OR_FCM_RST                     0x00000008
-#define OR_FCM_RST_SHIFT                        3
-#define OR_FCM_TRLX                    0x00000004
-#define OR_FCM_TRLX_SHIFT                       2
-#define OR_FCM_EHTR                    0x00000002
-#define OR_FCM_EHTR_SHIFT                       1
-
-#define OR_UPM_AM                      0xFFFF8000
-#define OR_UPM_AM_SHIFT                        15
-#define OR_UPM_XAM                     0x00006000
-#define OR_UPM_XAM_SHIFT               13
-#define OR_UPM_BCTLD                   0x00001000
-#define OR_UPM_BCTLD_SHIFT             12
-#define OR_UPM_BI                      0x00000100
-#define OR_UPM_BI_SHIFT                        8
-#define OR_UPM_TRLX                    0x00000004
-#define OR_UPM_TRLX_SHIFT              2
-#define OR_UPM_EHTR                    0x00000002
-#define OR_UPM_EHTR_SHIFT              1
-#define OR_UPM_EAD                     0x00000001
-#define OR_UPM_EAD_SHIFT               0
-
-#define OR_SDRAM_AM                    0xFFFF8000
-#define OR_SDRAM_AM_SHIFT              15
-#define OR_SDRAM_XAM                   0x00006000
-#define OR_SDRAM_XAM_SHIFT             13
-#define OR_SDRAM_COLS                  0x00001C00
-#define OR_SDRAM_COLS_SHIFT            10
-#define OR_SDRAM_ROWS                  0x000001C0
-#define OR_SDRAM_ROWS_SHIFT            6
-#define OR_SDRAM_PMSEL                 0x00000020
-#define OR_SDRAM_PMSEL_SHIFT           5
-#define OR_SDRAM_EAD                   0x00000001
-#define OR_SDRAM_EAD_SHIFT             0
-
-#define OR_AM_32KB                     0xFFFF8000
-#define OR_AM_64KB                     0xFFFF0000
-#define OR_AM_128KB                    0xFFFE0000
-#define OR_AM_256KB                    0xFFFC0000
-#define OR_AM_512KB                    0xFFF80000
-#define OR_AM_1MB                      0xFFF00000
-#define OR_AM_2MB                      0xFFE00000
-#define OR_AM_4MB                      0xFFC00000
-#define OR_AM_8MB                      0xFF800000
-#define OR_AM_16MB                     0xFF000000
-#define OR_AM_32MB                     0xFE000000
-#define OR_AM_64MB                     0xFC000000
-#define OR_AM_128MB                    0xF8000000
-#define OR_AM_256MB                    0xF0000000
-#define OR_AM_512MB                    0xE0000000
-#define OR_AM_1GB                      0xC0000000
-#define OR_AM_2GB                      0x80000000
-#define OR_AM_4GB                      0x00000000
-
-#define LBLAWAR_EN                     0x80000000
-#define LBLAWAR_4KB                    0x0000000B
-#define LBLAWAR_8KB                    0x0000000C
-#define LBLAWAR_16KB                   0x0000000D
-#define LBLAWAR_32KB                   0x0000000E
-#define LBLAWAR_64KB                   0x0000000F
-#define LBLAWAR_128KB                  0x00000010
-#define LBLAWAR_256KB                  0x00000011
-#define LBLAWAR_512KB                  0x00000012
-#define LBLAWAR_1MB                    0x00000013
-#define LBLAWAR_2MB                    0x00000014
-#define LBLAWAR_4MB                    0x00000015
-#define LBLAWAR_8MB                    0x00000016
-#define LBLAWAR_16MB                   0x00000017
-#define LBLAWAR_32MB                   0x00000018
-#define LBLAWAR_64MB                   0x00000019
-#define LBLAWAR_128MB                  0x0000001A
-#define LBLAWAR_256MB                  0x0000001B
-#define LBLAWAR_512MB                  0x0000001C
-#define LBLAWAR_1GB                    0x0000001D
-#define LBLAWAR_2GB                    0x0000001E
-
-/* LBCR - Local Bus Configuration Register
- */
-#define LBCR_LDIS                      0x80000000
-#define LBCR_LDIS_SHIFT                        31
-#define LBCR_BCTLC                     0x00C00000
-#define LBCR_BCTLC_SHIFT               22
-#define LBCR_LPBSE                     0x00020000
-#define LBCR_LPBSE_SHIFT               17
-#define LBCR_EPAR                      0x00010000
-#define LBCR_EPAR_SHIFT                        16
-#define LBCR_BMT                       0x0000FF00
-#define LBCR_BMT_SHIFT                 8
-
-/* LCRR - Clock Ratio Register
- */
-#define LCRR_DBYP                      0x80000000
-#define LCRR_DBYP_SHIFT                        31
-#define LCRR_BUFCMDC                   0x30000000
-#define LCRR_BUFCMDC_SHIFT             28
-#define LCRR_BUFCMDC_1                 0x10000000
-#define LCRR_BUFCMDC_2                 0x20000000
-#define LCRR_BUFCMDC_3                 0x30000000
-#define LCRR_BUFCMDC_4                 0x00000000
-#define LCRR_ECL                       0x03000000
-#define LCRR_ECL_SHIFT                 24
-#define LCRR_ECL_4                     0x00000000
-#define LCRR_ECL_5                     0x01000000
-#define LCRR_ECL_6                     0x02000000
-#define LCRR_ECL_7                     0x03000000
-#define LCRR_EADC                      0x00030000
-#define LCRR_EADC_SHIFT                        16
-#define LCRR_EADC_1                    0x00010000
-#define LCRR_EADC_2                    0x00020000
-#define LCRR_EADC_3                    0x00030000
-#define LCRR_EADC_4                    0x00000000
-#define LCRR_CLKDIV                    0x0000000F
-#define LCRR_CLKDIV_SHIFT              0
-#define LCRR_CLKDIV_2                  0x00000002
-#define LCRR_CLKDIV_4                  0x00000004
-#define LCRR_CLKDIV_8                  0x00000008
-
 /* DMAMR - DMA Mode Register
  */
 #define DMA_CHANNEL_START                      0x00000001      /* Bit - DMAMRn CS */
index 321b24f755182a6fa02cab312ab3d5fd10f345b4..a4d4d655266685385012a68c6c37a1c5fdcd5791 100644 (file)
@@ -6,6 +6,8 @@
 #ifndef        __MPC85xx_H__
 #define __MPC85xx_H__
 
+#include <asm/fsl_lbc.h>
+
 /* define for common ppc_asm.tmpl */
 #define EXC_OFF_SYS_RESET      0x100   /* System reset */
 #define _START_OFFSET          0
 #define SCCR_DFBRG10    0x00000002      /* BRGCLK division by 64 */
 #define SCCR_DFBRG11    0x00000003      /* BRGCLK division by 256 */
 
-/*
- * Local Bus Controller - memory controller registers
- */
-#define BRx_V          0x00000001      /* Bank Valid                   */
-#define BRx_MS_GPCM    0x00000000      /* G.P.C.M. Machine Select      */
-#define BRx_MS_SDRAM   0x00000000      /* SDRAM Machine Select         */
-#define BRx_MS_UPMA    0x00000080      /* U.P.M.A Machine Select       */
-#define BRx_MS_UPMB    0x000000a0      /* U.P.M.B Machine Select       */
-#define BRx_MS_UPMC    0x000000c0      /* U.P.M.C Machine Select       */
-#define BRx_PS_8       0x00000800      /*  8 bit port size             */
-#define BRx_PS_32      0x00001800      /* 32 bit port size             */
-#define BRx_BA_MSK     0xffff8000      /* Base Address Mask            */
-
-#define ORxG_EAD       0x00000001      /* External addr latch delay    */
-#define ORxG_EHTR      0x00000002      /* Extended hold time on read   */
-#define ORxG_TRLX      0x00000004      /* Timing relaxed               */
-#define ORxG_SETA      0x00000008      /* External address termination */
-#define ORxG_SCY_10_CLK        0x000000a0      /* 10 clock cycles wait states  */
-#define ORxG_SCY_15_CLK        0x000000f0      /* 15 clock cycles wait states  */
-#define ORxG_XACS      0x00000100      /* Extra addr to CS setup       */
-#define ORxG_ACS_DIV2  0x00000600      /* CS is output 1/2 a clock later*/
-#define ORxG_CSNT      0x00000800      /* Chip Select Negation Time    */
-
-#define ORxU_BI                0x00000100      /* Burst Inhibit                */
-#define ORxU_AM_MSK    0xffff8000      /* Address Mask Mask            */
-
-#define MxMR_OP_NORM   0x00000000      /* Normal Operation             */
-#define MxMR_DSx_2_CYCL 0x00400000     /* 2 cycle Disable Period       */
-#define MxMR_OP_WARR   0x10000000      /* Write to Array               */
-#define MxMR_BSEL      0x80000000      /* Bus Select                   */
-
-/* helpers to convert values into an OR address mask (GPCM mode) */
-#define P2SZ_TO_AM(s)  ((~((s) - 1)) & 0xffff8000)     /* must be pow of 2 */
-#define MEG_TO_AM(m)   P2SZ_TO_AM((m) << 20)
-
 #endif /* __MPC85xx_H__ */
index 9fd349af986b2634e93eedb7c1fcc9df01e6120e..ce3d784da03f3f35b5401b1e5449b6f806ff8e78 100644 (file)
@@ -7,6 +7,8 @@
 #ifndef        __MPC86xx_H__
 #define __MPC86xx_H__
 
+#include <asm/fsl_lbc.h>
+
 #define EXC_OFF_SYS_RESET      0x0100  /* System reset offset */
 #define _START_OFFSET          EXC_OFF_SYS_RESET
 
index 61c22031e9c33aa06c758dafd5c274a5dd903cfc..d061017911598a0265727ba90542102b5ab0988c 100644 (file)
 #define PCI_DEVICE_ID_INTEL_82434      0x04a3
 #define PCI_DEVICE_ID_INTEL_I960       0x0960
 #define PCI_DEVICE_ID_INTEL_I960RM     0x0962
-#define PCI_DEVICE_ID_INTEL_82541ER 0x1078
+#define PCI_DEVICE_ID_INTEL_82541ER    0x1078
+#define PCI_DEVICE_ID_INTEL_82541GI_LF 0x107c
 #define PCI_DEVICE_ID_INTEL_82542      0x1000
 #define PCI_DEVICE_ID_INTEL_82543GC_FIBER      0x1001
 #define PCI_DEVICE_ID_INTEL_82543GC_COPPER     0x1004
index d953378c73b7bbbf7157bc49e1ef6f0cc9e7b485..2231a5fbb45a1cde90bfa4196d7f6f8082f7178a 100644 (file)
 #ifndef        __PPC405_H__
 #define __PPC405_H__
 
+/* Define bits and masks for real-mode storage attribute control registers */
+#define PPC_128MB_SACR_BIT(addr)       ((addr) >> 27)
+#define PPC_128MB_SACR_VALUE(addr)     PPC_REG_VAL(PPC_128MB_SACR_BIT(addr),1)
+
 #ifndef CONFIG_IOP480
 #define CFG_DCACHE_SIZE                (16 << 10)      /* For AMCC 405 CPUs    */
 #else
 #endif /* defined(CONFIG_405EZ) */
 
 /******************************************************************************
- * SDRAM Controller
- ******************************************************************************/
-  /* values for memcfga register - indirect addressing of these regs */
-#ifndef CONFIG_405EP
-  #define mem_besra   0x00    /* bus error syndrome reg a           */
-  #define mem_besrsa  0x04    /* bus error syndrome reg set a       */
-  #define mem_besrb   0x08    /* bus error syndrome reg b           */
-  #define mem_besrsb  0x0c    /* bus error syndrome reg set b       */
-  #define mem_bear    0x10    /* bus error address reg              */
-#endif
-  #define mem_mcopt1  0x20    /* memory controller options 1        */
-  #define mem_status  0x24    /* memory status                      */
-  #define mem_rtr     0x30    /* refresh timer reg                  */
-  #define mem_pmit    0x34    /* power management idle timer        */
-  #define mem_mb0cf   0x40    /* memory bank 0 configuration        */
-  #define mem_mb1cf   0x44    /* memory bank 1 configuration        */
-#ifndef CONFIG_405EP
-  #define mem_mb2cf   0x48    /* memory bank 2 configuration        */
-  #define mem_mb3cf   0x4c    /* memory bank 3 configuration        */
-#endif
-  #define mem_sdtr1   0x80    /* timing reg 1                       */
-#ifndef CONFIG_405EP
-  #define mem_ecccf   0x94    /* ECC configuration                  */
-  #define mem_eccerr  0x98    /* ECC error status                   */
-#endif
+ * External Bus Controller (EBC)
+ *****************************************************************************/
+
+/* Bank Configuration Register */
+#define        EBC_BXCR_BAS_MASK       PPC_REG_VAL(11, 0xFFF)
+#define EBC_BXCR_BAS_ENCODE(n) (((static_cast(unsigned long, n)) & \
+                                 EBC_BXCR_BAS_MASK) << 0)
+#define EBC_BXCR_BS_MASK       PPC_REG_VAL(14, 0x7)
+#define EBC_BXCR_BS_1MB                PPC_REG_VAL(14, 0x0)
+#define EBC_BXCR_BS_2MB                PPC_REG_VAL(14, 0x1)
+#define EBC_BXCR_BS_4MB                PPC_REG_VAL(14, 0x2)
+#define EBC_BXCR_BS_8MB                PPC_REG_VAL(14, 0x3)
+#define EBC_BXCR_BS_16MB       PPC_REG_VAL(14, 0x4)
+#define EBC_BXCR_BS_32MB       PPC_REG_VAL(14, 0x5)
+#define EBC_BXCR_BS_64MB       PPC_REG_VAL(14, 0x6)
+#define EBC_BXCR_BS_128MB      PPC_REG_VAL(14, 0x7)
+#define EBC_BXCR_BU_MASK       PPC_REG_VAL(16, 0x3)
+#define        EBC_BXCR_BU_NONE        PPC_REG_VAL(16, 0x0)
+#define EBC_BXCR_BU_R          PPC_REG_VAL(16, 0x1)
+#define EBC_BXCR_BU_W          PPC_REG_VAL(16, 0x2)
+#define EBC_BXCR_BU_RW         PPC_REG_VAL(16, 0x3)
+#define EBC_BXCR_BW_MASK       PPC_REG_VAL(18, 0x3)
+#define EBC_BXCR_BW_8BIT       PPC_REG_VAL(18, 0x0)
+#define EBC_BXCR_BW_16BIT      PPC_REG_VAL(18, 0x1)
+#define EBC_BXCR_BW_32BIT      PPC_REG_VAL(18, 0x3)
+
+/* Bank Access Parameter Register */
+#define EBC_BXAP_BME_ENABLED   PPC_REG_VAL(0, 0x1)
+#define EBC_BXAP_BME_DISABLED  PPC_REG_VAL(0, 0x0)
+#define EBC_BXAP_TWT_ENCODE(n) PPC_REG_VAL(8, \
+                                           (static_cast(unsigned long, n)) \
+                                           & 0xFF)
+#define        EBC_BXAP_FWT_ENCODE(n)  PPC_REG_VAL(5, \
+                                           (static_cast(unsigned long, n)) \
+                                           & 0x1F)
+#define        EBC_BXAP_BWT_ENCODE(n)  PPC_REG_VAL(8, \
+                                           (static_cast(unsigned long, n)) \
+                                           & 0x7)
+#define EBC_BXAP_BCE_DISABLE   PPC_REG_VAL(9, 0x0)
+#define EBC_BXAP_BCE_ENABLE    PPC_REG_VAL(9, 0x1)
+#define EBC_BXAP_BCT_MASK      PPC_REG_VAL(11, 0x3)
+#define EBC_BXAP_BCT_2TRANS    PPC_REG_VAL(11, 0x0)
+#define EBC_BXAP_BCT_4TRANS    PPC_REG_VAL(11, 0x1)
+#define EBC_BXAP_BCT_8TRANS    PPC_REG_VAL(11, 0x2)
+#define EBC_BXAP_BCT_16TRANS   PPC_REG_VAL(11, 0x3)
+#define EBC_BXAP_CSN_ENCODE(n) PPC_REG_VAL(13, \
+                                           (static_cast(unsigned long, n)) \
+                                           & 0x3)
+#define EBC_BXAP_OEN_ENCODE(n) PPC_REG_VAL(15, \
+                                           (static_cast(unsigned long, n)) \
+                                           & 0x3)
+#define EBC_BXAP_WBN_ENCODE(n) PPC_REG_VAL(17, \
+                                           (static_cast(unsigned long, n)) \
+                                           & 0x3)
+#define EBC_BXAP_WBF_ENCODE(n) PPC_REG_VAL(19, \
+                                           (static_cast(unsigned long, n)) \
+                                           & 0x3)
+#define EBC_BXAP_TH_ENCODE(n)  PPC_REG_VAL(22, \
+                                           (static_cast(unsigned long, n)) \
+                                           & 0x7)
+#define EBC_BXAP_RE_ENABLED    PPC_REG_VAL(23, 0x1)
+#define EBC_BXAP_RE_DISABLED   PPC_REG_VAL(23, 0x0)
+#define EBC_BXAP_SOR_DELAYED   PPC_REG_VAL(24, 0x0)
+#define EBC_BXAP_SOR_NONDELAYED        PPC_REG_VAL(24, 0x1)
+#define EBC_BXAP_BEM_WRITEONLY PPC_REG_VAL(25, 0x0)
+#define EBC_BXAP_BEM_RW                PPC_REG_VAL(25, 0x1)
+#define EBC_BXAP_PEN_DISABLED  PPC_REG_VAL(26, 0x0)
+#define EBC_BXAP_PEN_ENABLED   PPC_REG_VAL(26, 0x1)
+
+/* Configuration Register */
+#define EBC_CFG_LE_MASK                PPC_REG_VAL(0, 0x1)
+#define EBC_CFG_LE_UNLOCK      PPC_REG_VAL(0, 0x0)
+#define EBC_CFG_LE_LOCK                PPC_REG_VAL(0, 0x1)
+#define EBC_CFG_PTD_MASK       PPC_REG_VAL(1, 0x1)
+#define EBC_CFG_PTD_ENABLE     PPC_REG_VAL(1, 0x0)
+#define EBC_CFG_PTD_DISABLE    PPC_REG_VAL(1, 0x1)
+#define EBC_CFG_RTC_MASK       PPC_REG_VAL(4, 0x7)
+#define EBC_CFG_RTC_16PERCLK   PPC_REG_VAL(4, 0x0)
+#define EBC_CFG_RTC_32PERCLK   PPC_REG_VAL(4, 0x1)
+#define EBC_CFG_RTC_64PERCLK   PPC_REG_VAL(4, 0x2)
+#define EBC_CFG_RTC_128PERCLK  PPC_REG_VAL(4, 0x3)
+#define EBC_CFG_RTC_256PERCLK  PPC_REG_VAL(4, 0x4)
+#define EBC_CFG_RTC_512PERCLK  PPC_REG_VAL(4, 0x5)
+#define EBC_CFG_RTC_1024PERCLK PPC_REG_VAL(4, 0x6)
+#define EBC_CFG_RTC_2048PERCLK PPC_REG_VAL(4, 0x7)
+#define EBC_CFG_ATC_MASK       PPC_REG_VAL(5, 0x1)
+#define EBC_CFG_ATC_HI         PPC_REG_VAL(5, 0x0)
+#define EBC_CFG_ATC_PREVIOUS   PPC_REG_VAL(5, 0x1)
+#define EBC_CFG_DTC_MASK       PPC_REG_VAL(6, 0x1)
+#define EBC_CFG_DTC_HI         PPC_REG_VAL(6, 0x0)
+#define EBC_CFG_DTC_PREVIOUS   PPC_REG_VAL(6, 0x1)
+#define EBC_CFG_CTC_MASK       PPC_REG_VAL(7, 0x1)
+#define EBC_CFG_CTC_HI         PPC_REG_VAL(7, 0x0)
+#define EBC_CFG_CTC_PREVIOUS   PPC_REG_VAL(7, 0x1)
+#define EBC_CFG_OEO_MASK       PPC_REG_VAL(8, 0x1)
+#define EBC_CFG_OEO_DISABLE    PPC_REG_VAL(8, 0x0)
+#define EBC_CFG_OEO_ENABLE     PPC_REG_VAL(8, 0x1)
+#define EBC_CFG_EMC_MASK       PPC_REG_VAL(9, 0x1)
+#define EBC_CFG_EMC_NONDEFAULT PPC_REG_VAL(9, 0x0)
+#define EBC_CFG_EMC_DEFAULT    PPC_REG_VAL(9, 0x1)
+#define EBC_CFG_PME_MASK       PPC_REG_VAL(14, 0x1)
+#define EBC_CFG_PME_DISABLE    PPC_REG_VAL(14, 0x0)
+#define EBC_CFG_PME_ENABLE     PPC_REG_VAL(14, 0x1)
+#define EBC_CFG_PMT_MASK       PPC_REG_VAL(19, 0x1F)
+#define EBC_CFG_PMT_ENCODE(n)  PPC_REG_VAL(19, \
+                                           (static_cast(unsigned long, n)) \
+                                           & 0x1F)
+#define EBC_CFG_PR_MASK                PPC_REG_VAL(21, 0x3)
+#define EBC_CFG_PR_16          PPC_REG_VAL(21, 0x0)
+#define EBC_CFG_PR_32          PPC_REG_VAL(21, 0x1)
+#define EBC_CFG_PR_64          PPC_REG_VAL(21, 0x2)
+#define EBC_CFG_PR_128         PPC_REG_VAL(21, 0x3)
 
 #ifndef CONFIG_405EP
 /******************************************************************************
 #if defined(CONFIG_405EX)
 #define SDR0_SRST              0x0200
 
-#define SDRAM_BESR0    0x00
-#define SDRAM_BEARL    0x02
-#define SDRAM_BEARU    0x03
-#define SDRAM_WMIRQ    0x06    /**/
-#define SDRAM_PLBOPT   0x08    /**/
-#define SDRAM_PUABA    0x09    /**/
-#define SDRAM_MCSTAT   0x1F    /* memory controller status           */
-#define SDRAM_MCOPT1   0x20    /* memory controller options 1        */
-#define SDRAM_MCOPT2   0x21    /* memory controller options 2        */
-#define SDRAM_MODT0    0x22    /* on die termination for bank 0      */
-#define SDRAM_MODT1    0x23    /* on die termination for bank 1      */
-#define SDRAM_MODT2    0x24    /* on die termination for bank 2      */
-#define SDRAM_MODT3    0x25    /* on die termination for bank 3      */
-#define SDRAM_CODT     0x26    /* on die termination for controller  */
-#define SDRAM_VVPR     0x27    /* variable VRef programmming         */
-#define SDRAM_OPARS    0x28    /* on chip driver control setup       */
-#define SDRAM_OPART    0x29    /* on chip driver control trigger     */
-#define SDRAM_RTR      0x30    /* refresh timer                      */
-#define SDRAM_PMIT     0x34    /* power management idle timer        */
-#define SDRAM_MB0CF    0x40    /* memory bank 0 configuration        */
-#define SDRAM_MB1CF    0x44    /* memory bank 1 configuration        */
-#define SDRAM_MB2CF    0x48    /* memory bank 2 configuration        */
-#define SDRAM_MB3CF    0x4C    /* memory bank 3 configuration        */
-#define SDRAM_INITPLR0 0x50    /* manual initialization control      */
-#define SDRAM_INITPLR1 0x51    /* manual initialization control      */
-#define SDRAM_INITPLR2 0x52    /* manual initialization control      */
-#define SDRAM_INITPLR3 0x53    /* manual initialization control      */
-#define SDRAM_INITPLR4 0x54    /* manual initialization control      */
-#define SDRAM_INITPLR5 0x55    /* manual initialization control      */
-#define SDRAM_INITPLR6 0x56    /* manual initialization control      */
-#define SDRAM_INITPLR7 0x57    /* manual initialization control      */
-#define SDRAM_INITPLR8 0x58    /* manual initialization control      */
-#define SDRAM_INITPLR9 0x59    /* manual initialization control      */
-#define SDRAM_INITPLR10 0x5a   /* manual initialization control      */
-#define SDRAM_INITPLR11 0x5b   /* manual initialization control      */
-#define SDRAM_INITPLR12 0x5c   /* manual initialization control      */
-#define SDRAM_INITPLR13 0x5d   /* manual initialization control      */
-#define SDRAM_INITPLR14 0x5e   /* manual initialization control      */
-#define SDRAM_INITPLR15 0x5f   /* manual initialization control      */
-#define SDRAM_RQDC     0x70    /* read DQS delay control             */
-#define SDRAM_RFDC     0x74    /* read feedback delay control        */
-#define SDRAM_RDCC     0x78    /* read data capture control          */
-#define SDRAM_DLCR     0x7A    /* delay line calibration             */
-#define SDRAM_CLKTR    0x80    /* DDR clock timing                   */
-#define SDRAM_WRDTR    0x81    /* write data, DQS, DM clock, timing  */
-#define SDRAM_SDTR1    0x85    /* DDR SDRAM timing 1                 */
-#define SDRAM_SDTR2    0x86    /* DDR SDRAM timing 2                 */
-#define SDRAM_SDTR3    0x87    /* DDR SDRAM timing 3                 */
-#define SDRAM_MMODE    0x88    /* memory mode                        */
-#define SDRAM_MEMODE   0x89    /* memory extended mode               */
-#define SDRAM_ECCCR    0x98    /* ECC error status                   */
-#define SDRAM_RID      0xF8    /* revision ID                        */
-
-/*-----------------------------------------------------------------------------+
-|  Memory Bank 0-7 configuration
-+-----------------------------------------------------------------------------*/
-#define SDRAM_RXBAS_SDSZ_4        0x00000000      /*   4M                    */
-#define SDRAM_RXBAS_SDSZ_8        0x00001000      /*   8M                    */
-#define SDRAM_RXBAS_SDSZ_16       0x00002000      /*  16M                    */
-#define SDRAM_RXBAS_SDSZ_32       0x00003000      /*  32M                    */
-#define SDRAM_RXBAS_SDSZ_64       0x00004000      /*  64M                    */
-#define SDRAM_RXBAS_SDSZ_128      0x00005000      /* 128M                    */
-#define SDRAM_RXBAS_SDSZ_256      0x00006000      /* 256M                    */
-#define SDRAM_RXBAS_SDSZ_512      0x00007000      /* 512M                    */
-#define SDRAM_RXBAS_SDSZ_1024     0x00008000      /* 1024M                   */
-#define SDRAM_RXBAS_SDSZ_2048     0x00009000      /* 2048M                   */
-#define SDRAM_RXBAS_SDSZ_4096     0x0000a000      /* 4096M                   */
-#define SDRAM_RXBAS_SDSZ_8192     0x0000b000      /* 8192M                   */
-
-/*-----------------------------------------------------------------------------+
-|  Memory Controller Status
-+-----------------------------------------------------------------------------*/
-#define SDRAM_MCSTAT_MIC_MASK      0x80000000  /* Memory init status mask    */
-#define   SDRAM_MCSTAT_MIC_NOTCOMP  0x00000000 /* Mem init not complete      */
-#define   SDRAM_MCSTAT_MIC_COMP     0x80000000 /* Mem init complete          */
-#define SDRAM_MCSTAT_SRMS_MASK     0x80000000  /* Mem self refresh stat mask */
-#define   SDRAM_MCSTAT_SRMS_NOT_SF  0x00000000 /* Mem not in self refresh    */
-#define   SDRAM_MCSTAT_SRMS_SF     0x80000000  /* Mem in self refresh        */
-
-/*-----------------------------------------------------------------------------+
-|  Memory Controller Options 1
-+-----------------------------------------------------------------------------*/
-#define SDRAM_MCOPT1_MCHK_MASK      0x30000000 /* Memory data err check mask */
-#define   SDRAM_MCOPT1_MCHK_NON      0x00000000 /* No ECC generation         */
-#define   SDRAM_MCOPT1_MCHK_GEN      0x20000000 /* ECC generation            */
-#define   SDRAM_MCOPT1_MCHK_CHK      0x10000000 /* ECC generation and check   */
-#define   SDRAM_MCOPT1_MCHK_CHK_REP  0x30000000 /* ECC generation, chk, report*/
-#define   SDRAM_MCOPT1_MCHK_CHK_DECODE(n)  ((((unsigned long)(n))>>28)&0x3)
-#define SDRAM_MCOPT1_RDEN_MASK      0x08000000 /* Registered DIMM mask       */
-#define   SDRAM_MCOPT1_RDEN         0x08000000 /* Registered DIMM enable     */
-#define SDRAM_MCOPT1_PMU_MASK       0x06000000 /* Page management unit mask  */
-#define   SDRAM_MCOPT1_PMU_CLOSE     0x00000000 /* PMU Close                 */
-#define   SDRAM_MCOPT1_PMU_OPEN      0x04000000 /* PMU Open                  */
-#define   SDRAM_MCOPT1_PMU_AUTOCLOSE 0x02000000 /* PMU AutoClose             */
-#define SDRAM_MCOPT1_DMWD_MASK      0x01000000 /* DRAM width mask            */
-#define   SDRAM_MCOPT1_DMWD_32      0x00000000 /* 32 bits                    */
-#define   SDRAM_MCOPT1_DMWD_64      0x01000000 /* 64 bits                    */
-#define SDRAM_MCOPT1_UIOS_MASK      0x00C00000 /* Unused IO State            */
-#define SDRAM_MCOPT1_BCNT_MASK      0x00200000 /* Bank count                 */
-#define   SDRAM_MCOPT1_4_BANKS      0x00000000 /* 4 Banks                    */
-#define   SDRAM_MCOPT1_8_BANKS      0x00200000 /* 8 Banks                    */
-#define SDRAM_MCOPT1_DDR_TYPE_MASK   0x00100000 /* DDR Memory Type mask       */
-#define   SDRAM_MCOPT1_DDR1_TYPE     0x00000000 /* DDR1 Memory Type          */
-#define   SDRAM_MCOPT1_DDR2_TYPE     0x00100000 /* DDR2 Memory Type          */
-#define   SDRAM_MCOPT1_QDEP         0x00020000 /* 4 commands deep            */
-#define SDRAM_MCOPT1_RWOO_MASK      0x00008000 /* Out of Order Read mask     */
-#define   SDRAM_MCOPT1_RWOO_DISABLED 0x00000000 /* disabled                  */
-#define   SDRAM_MCOPT1_RWOO_ENABLED  0x00008000 /* enabled                   */
-#define SDRAM_MCOPT1_WOOO_MASK      0x00004000 /* Out of Order Write mask    */
-#define   SDRAM_MCOPT1_WOOO_DISABLED 0x00000000 /* disabled                  */
-#define   SDRAM_MCOPT1_WOOO_ENABLED  0x00004000 /* enabled                   */
-#define SDRAM_MCOPT1_DCOO_MASK      0x00002000 /* All Out of Order mask      */
-#define   SDRAM_MCOPT1_DCOO_DISABLED 0x00002000 /* disabled                  */
-#define   SDRAM_MCOPT1_DCOO_ENABLED  0x00000000 /* enabled                   */
-#define SDRAM_MCOPT1_DREF_MASK      0x00001000 /* Deferred refresh mask      */
-#define   SDRAM_MCOPT1_DREF_NORMAL   0x00000000 /* normal refresh            */
-#define   SDRAM_MCOPT1_DREF_DEFER_4  0x00001000 /* defer up to 4 refresh cmd  */
-
-/*-----------------------------------------------------------------------------+
-|  Memory Controller Options 2
-+-----------------------------------------------------------------------------*/
-#define SDRAM_MCOPT2_SREN_MASK       0x80000000 /* Self Test mask            */
-#define   SDRAM_MCOPT2_SREN_EXIT      0x00000000 /* Self Test exit           */
-#define   SDRAM_MCOPT2_SREN_ENTER     0x80000000 /* Self Test enter          */
-#define SDRAM_MCOPT2_PMEN_MASK       0x40000000 /* Power Management mask     */
-#define   SDRAM_MCOPT2_PMEN_DISABLE   0x00000000 /* disable                  */
-#define   SDRAM_MCOPT2_PMEN_ENABLE    0x40000000 /* enable                   */
-#define SDRAM_MCOPT2_IPTR_MASK       0x20000000 /* Init Trigger Reg mask     */
-#define   SDRAM_MCOPT2_IPTR_IDLE      0x00000000 /* idle                     */
-#define   SDRAM_MCOPT2_IPTR_EXECUTE   0x20000000 /* execute preloaded init    */
-#define SDRAM_MCOPT2_XSRP_MASK       0x10000000 /* Exit Self Refresh Prevent */
-#define   SDRAM_MCOPT2_XSRP_ALLOW     0x00000000 /* allow self refresh exit   */
-#define   SDRAM_MCOPT2_XSRP_PREVENT   0x10000000 /* prevent self refresh exit */
-#define SDRAM_MCOPT2_DCEN_MASK       0x08000000 /* SDRAM Controller Enable   */
-#define   SDRAM_MCOPT2_DCEN_DISABLE   0x00000000 /* SDRAM Controller Enable   */
-#define   SDRAM_MCOPT2_DCEN_ENABLE    0x08000000 /* SDRAM Controller Enable   */
-#define SDRAM_MCOPT2_ISIE_MASK       0x04000000 /* Init Seq Interruptable mas*/
-#define   SDRAM_MCOPT2_ISIE_DISABLE   0x00000000 /* disable                  */
-#define   SDRAM_MCOPT2_ISIE_ENABLE    0x04000000 /* enable                   */
-
-/*-----------------------------------------------------------------------------+
-|  SDRAM Refresh Timer Register
-+-----------------------------------------------------------------------------*/
-#define SDRAM_RTR_RINT_MASK            0xFFF80000
-#define   SDRAM_RTR_RINT_ENCODE(n)     ((((unsigned long)(n))&0xFFF8)<<16)
-#define   SDRAM_RTR_RINT_DECODE(n)     ((((unsigned long)(n))>>16)&0xFFF8)
-
-/*-----------------------------------------------------------------------------+
-|  SDRAM Read DQS Delay Control Register
-+-----------------------------------------------------------------------------*/
-#define SDRAM_RQDC_RQDE_MASK           0x80000000
-#define   SDRAM_RQDC_RQDE_DISABLE      0x00000000
-#define   SDRAM_RQDC_RQDE_ENABLE       0x80000000
-#define SDRAM_RQDC_RQFD_MASK           0x000001FF
-#define   SDRAM_RQDC_RQFD_ENCODE(n)    ((((unsigned long)(n))&0x1FF)<<0)
-
-#define SDRAM_RQDC_RQFD_MAX            0xFF
-
-/*-----------------------------------------------------------------------------+
-|  SDRAM Read Data Capture Control Register
-+-----------------------------------------------------------------------------*/
-#define SDRAM_RDCC_RDSS_MASK           0xC0000000
-#define   SDRAM_RDCC_RDSS_T1           0x00000000
-#define   SDRAM_RDCC_RDSS_T2           0x40000000
-#define   SDRAM_RDCC_RDSS_T3           0x80000000
-#define   SDRAM_RDCC_RDSS_T4           0xC0000000
-#define SDRAM_RDCC_RSAE_MASK           0x00000001
-#define   SDRAM_RDCC_RSAE_DISABLE      0x00000001
-#define   SDRAM_RDCC_RSAE_ENABLE       0x00000000
-
-/*-----------------------------------------------------------------------------+
-|  SDRAM Read Feedback Delay Control Register
-+-----------------------------------------------------------------------------*/
-#define SDRAM_RFDC_ARSE_MASK           0x80000000
-#define   SDRAM_RFDC_ARSE_DISABLE      0x80000000
-#define   SDRAM_RFDC_ARSE_ENABLE       0x00000000
-#define SDRAM_RFDC_RFOS_MASK           0x007F0000
-#define   SDRAM_RFDC_RFOS_ENCODE(n)    ((((unsigned long)(n))&0x7F)<<16)
-#define SDRAM_RFDC_RFFD_MASK           0x000003FF
-#define   SDRAM_RFDC_RFFD_ENCODE(n)    ((((unsigned long)(n))&0x3FF)<<0)
-
-#define SDRAM_RFDC_RFFD_MAX            0x4FF
-
-/*-----------------------------------------------------------------------------+
-|  SDRAM Delay Line Calibration Register
-+-----------------------------------------------------------------------------*/
-#define SDRAM_DLCR_DCLM_MASK           0x80000000
-#define   SDRAM_DLCR_DCLM_MANUEL       0x80000000
-#define   SDRAM_DLCR_DCLM_AUTO         0x00000000
-#define SDRAM_DLCR_DLCR_MASK           0x08000000
-#define   SDRAM_DLCR_DLCR_CALIBRATE    0x08000000
-#define   SDRAM_DLCR_DLCR_IDLE         0x00000000
-#define SDRAM_DLCR_DLCS_MASK           0x07000000
-#define   SDRAM_DLCR_DLCS_NOT_RUN      0x00000000
-#define   SDRAM_DLCR_DLCS_IN_PROGRESS  0x01000000
-#define   SDRAM_DLCR_DLCS_COMPLETE     0x02000000
-#define   SDRAM_DLCR_DLCS_CONT_DONE    0x03000000
-#define   SDRAM_DLCR_DLCS_ERROR        0x04000000
-#define SDRAM_DLCR_DLCV_MASK           0x000001FF
-#define   SDRAM_DLCR_DLCV_ENCODE(n)    ((((unsigned long)(n))&0x1FF)<<0)
-#define   SDRAM_DLCR_DLCV_DECODE(n)    ((((unsigned long)(n))>>0)&0x1FF)
-
-/*-----------------------------------------------------------------------------+
-|  SDRAM Controller On Die Termination Register
-+-----------------------------------------------------------------------------*/
-#define   SDRAM_CODT_ODT_ON                    0x80000000
-#define   SDRAM_CODT_ODT_OFF                   0x00000000
-#define SDRAM_CODT_DQS_VOLTAGE_DDR_MASK        0x00000020
-#define   SDRAM_CODT_DQS_2_5_V_DDR1            0x00000000
-#define   SDRAM_CODT_DQS_1_8_V_DDR2            0x00000020
-#define SDRAM_CODT_DQS_MASK                    0x00000010
-#define   SDRAM_CODT_DQS_DIFFERENTIAL          0x00000000
-#define   SDRAM_CODT_DQS_SINGLE_END            0x00000010
-#define   SDRAM_CODT_CKSE_DIFFERENTIAL         0x00000000
-#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
-
-/*-----------------------------------------------------------------------------+
-|  SDRAM Mode Register
-+-----------------------------------------------------------------------------*/
-#define SDRAM_MMODE_WR_MASK                    0x00000E00
-#define   SDRAM_MMODE_WR_DDR1                  0x00000000
-#define   SDRAM_MMODE_WR_DDR2_3_CYC            0x00000400
-#define   SDRAM_MMODE_WR_DDR2_4_CYC            0x00000600
-#define   SDRAM_MMODE_WR_DDR2_5_CYC            0x00000800
-#define   SDRAM_MMODE_WR_DDR2_6_CYC            0x00000A00
-#define SDRAM_MMODE_DCL_MASK                   0x00000070
-#define   SDRAM_MMODE_DCL_DDR1_2_0_CLK         0x00000020
-#define   SDRAM_MMODE_DCL_DDR1_2_5_CLK         0x00000060
-#define   SDRAM_MMODE_DCL_DDR1_3_0_CLK         0x00000030
-#define   SDRAM_MMODE_DCL_DDR2_2_0_CLK         0x00000020
-#define   SDRAM_MMODE_DCL_DDR2_3_0_CLK         0x00000030
-#define   SDRAM_MMODE_DCL_DDR2_4_0_CLK         0x00000040
-#define   SDRAM_MMODE_DCL_DDR2_5_0_CLK         0x00000050
-#define   SDRAM_MMODE_DCL_DDR2_6_0_CLK         0x00000060
-#define   SDRAM_MMODE_DCL_DDR2_7_0_CLK         0x00000070
-
-/*-----------------------------------------------------------------------------+
-|  SDRAM Extended Mode Register
-+-----------------------------------------------------------------------------*/
-#define SDRAM_MEMODE_DIC_MASK                  0x00000002
-#define   SDRAM_MEMODE_DIC_NORMAL              0x00000000
-#define   SDRAM_MEMODE_DIC_WEAK                        0x00000002
-#define SDRAM_MEMODE_DLL_MASK                  0x00000001
-#define   SDRAM_MEMODE_DLL_DISABLE             0x00000001
-#define   SDRAM_MEMODE_DLL_ENABLE              0x00000000
-#define SDRAM_MEMODE_RTT_MASK                  0x00000044
-#define   SDRAM_MEMODE_RTT_DISABLED            0x00000000
-#define   SDRAM_MEMODE_RTT_75OHM               0x00000004
-#define   SDRAM_MEMODE_RTT_150OHM              0x00000040
-#define SDRAM_MEMODE_DQS_MASK                  0x00000400
-#define   SDRAM_MEMODE_DQS_DISABLE             0x00000400
-#define   SDRAM_MEMODE_DQS_ENABLE              0x00000000
-
-/*-----------------------------------------------------------------------------+
-|  SDRAM Clock Timing Register
-+-----------------------------------------------------------------------------*/
-#define SDRAM_CLKTR_CLKP_MASK                  0xC0000000
-#define   SDRAM_CLKTR_CLKP_0_DEG               0x00000000
-#define   SDRAM_CLKTR_CLKP_180_DEG_ADV         0x80000000
-
-/*-----------------------------------------------------------------------------+
-|  SDRAM Write Timing Register
-+-----------------------------------------------------------------------------*/
-#define SDRAM_WRDTR_WDTP_1_CYC                 0x80000000
-#define SDRAM_WRDTR_LLWP_MASK                  0x10000000
-#define   SDRAM_WRDTR_LLWP_DIS                 0x10000000
-#define   SDRAM_WRDTR_LLWP_1_CYC               0x00000000
-#define SDRAM_WRDTR_WTR_MASK                   0x0E000000
-#define   SDRAM_WRDTR_WTR_0_DEG                        0x06000000
-#define   SDRAM_WRDTR_WTR_180_DEG_ADV          0x02000000
-#define   SDRAM_WRDTR_WTR_270_DEG_ADV          0x00000000
-
-/*-----------------------------------------------------------------------------+
-|  SDRAM SDTR1 Options
-+-----------------------------------------------------------------------------*/
-#define SDRAM_SDTR1_LDOF_MASK                  0x80000000
-#define   SDRAM_SDTR1_LDOF_1_CLK               0x00000000
-#define   SDRAM_SDTR1_LDOF_2_CLK               0x80000000
-#define SDRAM_SDTR1_RTW_MASK                   0x00F00000
-#define   SDRAM_SDTR1_RTW_2_CLK                0x00200000
-#define   SDRAM_SDTR1_RTW_3_CLK                0x00300000
-#define SDRAM_SDTR1_WTWO_MASK                  0x000F0000
-#define   SDRAM_SDTR1_WTWO_0_CLK               0x00000000
-#define   SDRAM_SDTR1_WTWO_1_CLK               0x00010000
-#define SDRAM_SDTR1_RTRO_MASK                  0x0000F000
-#define   SDRAM_SDTR1_RTRO_1_CLK               0x00000000
-#define   SDRAM_SDTR1_RTRO_2_CLK               0x00002000
-
-/*-----------------------------------------------------------------------------+
-|  SDRAM SDTR2 Options
-+-----------------------------------------------------------------------------*/
-#define SDRAM_SDTR2_RCD_MASK                   0xF0000000
-#define   SDRAM_SDTR2_RCD_1_CLK                0x10000000
-#define   SDRAM_SDTR2_RCD_2_CLK                0x20000000
-#define   SDRAM_SDTR2_RCD_3_CLK                0x30000000
-#define   SDRAM_SDTR2_RCD_4_CLK                0x40000000
-#define   SDRAM_SDTR2_RCD_5_CLK                0x50000000
-#define SDRAM_SDTR2_WTR_MASK           0x0F000000
-#define   SDRAM_SDTR2_WTR_1_CLK      0x01000000
-#define   SDRAM_SDTR2_WTR_2_CLK      0x02000000
-#define   SDRAM_SDTR2_WTR_3_CLK      0x03000000
-#define   SDRAM_SDTR2_WTR_4_CLK      0x04000000
-#define   SDRAM_SDTR3_WTR_ENCODE(n)  ((((unsigned long)(n))&0xF)<<24)
-#define SDRAM_SDTR2_XSNR_MASK       0x00FF0000
-#define   SDRAM_SDTR2_XSNR_8_CLK     0x00080000
-#define   SDRAM_SDTR2_XSNR_16_CLK    0x00100000
-#define   SDRAM_SDTR2_XSNR_32_CLK    0x00200000
-#define   SDRAM_SDTR2_XSNR_64_CLK    0x00400000
-#define SDRAM_SDTR2_WPC_MASK        0x0000F000
-#define   SDRAM_SDTR2_WPC_2_CLK      0x00002000
-#define   SDRAM_SDTR2_WPC_3_CLK      0x00003000
-#define   SDRAM_SDTR2_WPC_4_CLK      0x00004000
-#define   SDRAM_SDTR2_WPC_5_CLK      0x00005000
-#define   SDRAM_SDTR2_WPC_6_CLK      0x00006000
-#define   SDRAM_SDTR3_WPC_ENCODE(n)  ((((unsigned long)(n))&0xF)<<12)
-#define SDRAM_SDTR2_RPC_MASK        0x00000F00
-#define   SDRAM_SDTR2_RPC_2_CLK      0x00000200
-#define   SDRAM_SDTR2_RPC_3_CLK      0x00000300
-#define   SDRAM_SDTR2_RPC_4_CLK      0x00000400
-#define SDRAM_SDTR2_RP_MASK         0x000000F0
-#define   SDRAM_SDTR2_RP_3_CLK      0x00000030
-#define   SDRAM_SDTR2_RP_4_CLK      0x00000040
-#define   SDRAM_SDTR2_RP_5_CLK      0x00000050
-#define   SDRAM_SDTR2_RP_6_CLK      0x00000060
-#define   SDRAM_SDTR2_RP_7_CLK      0x00000070
-#define SDRAM_SDTR2_RRD_MASK        0x0000000F
-#define   SDRAM_SDTR2_RRD_2_CLK      0x00000002
-#define   SDRAM_SDTR2_RRD_3_CLK      0x00000003
-
-/*-----------------------------------------------------------------------------+
-|  SDRAM SDTR3 Options
-+-----------------------------------------------------------------------------*/
-#define SDRAM_SDTR3_RAS_MASK        0x1F000000
-#define   SDRAM_SDTR3_RAS_ENCODE(n)  ((((unsigned long)(n))&0x1F)<<24)
-#define SDRAM_SDTR3_RC_MASK         0x001F0000
-#define   SDRAM_SDTR3_RC_ENCODE(n)   ((((unsigned long)(n))&0x1F)<<16)
-#define SDRAM_SDTR3_XCS_MASK        0x00001F00
-#define SDRAM_SDTR3_XCS                     0x00000D00
-#define SDRAM_SDTR3_RFC_MASK        0x0000003F
-#define   SDRAM_SDTR3_RFC_ENCODE(n)  ((((unsigned long)(n))&0x3F)<<0)
-
-/*-----------------------------------------------------------------------------+
-|  Memory Bank 0-1 configuration
-+-----------------------------------------------------------------------------*/
-#define SDRAM_BXCF_M_AM_MASK     0x00000F00      /* Addressing mode          */
-#define   SDRAM_BXCF_M_AM_0      0x00000000      /*   Mode 0                 */
-#define   SDRAM_BXCF_M_AM_1      0x00000100      /*   Mode 1                 */
-#define   SDRAM_BXCF_M_AM_2      0x00000200      /*   Mode 2                 */
-#define   SDRAM_BXCF_M_AM_3      0x00000300      /*   Mode 3                 */
-#define   SDRAM_BXCF_M_AM_4      0x00000400      /*   Mode 4                 */
-#define   SDRAM_BXCF_M_AM_5      0x00000500      /*   Mode 5                 */
-#define   SDRAM_BXCF_M_AM_6      0x00000600      /*   Mode 6                 */
-#define   SDRAM_BXCF_M_AM_7      0x00000700      /*   Mode 7                 */
-#define   SDRAM_BXCF_M_AM_8      0x00000800      /*   Mode 8                 */
-#define   SDRAM_BXCF_M_AM_9      0x00000900      /*   Mode 9                 */
-#define SDRAM_BXCF_M_BE_MASK     0x00000001      /* Memory Bank Enable       */
-#define   SDRAM_BXCF_M_BE_DISABLE 0x00000000     /* Memory Bank Enable       */
-#define   SDRAM_BXCF_M_BE_ENABLE  0x00000001     /* Memory Bank Enable       */
-
 #define sdr_uart0      0x0120  /* UART0 Config */
 #define sdr_uart1      0x0121  /* UART1 Config */
 #define sdr_mfr                0x4300  /* SDR0_MFR reg */
 #define SDR0_PFC1_GPT_FREQ     0x0000000f
 #endif
 
+/* General Purpose Timer (GPT) Register Offsets */
+#define GPT0_TBC               0x00000000
+#define GPT0_IM                        0x00000018
+#define GPT0_ISS               0x0000001C
+#define GPT0_ISC               0x00000020
+#define GPT0_IE                        0x00000024
+#define GPT0_COMP0             0x00000080
+#define GPT0_COMP1             0x00000084
+#define GPT0_COMP2             0x00000088
+#define GPT0_COMP3             0x0000008C
+#define GPT0_COMP4             0x00000090
+#define GPT0_COMP5             0x00000094
+#define GPT0_COMP6             0x00000098
+#define GPT0_MASK0             0x000000C0
+#define GPT0_MASK1             0x000000C4
+#define GPT0_MASK2             0x000000C8
+#define GPT0_MASK3             0x000000CC
+#define GPT0_MASK4             0x000000D0
+#define GPT0_MASK5             0x000000D4
+#define GPT0_MASK6             0x000000D8
+#define GPT0_DCT0              0x00000110
+#define GPT0_DCIS              0x0000011C
+
 #endif /* __PPC405_H__ */
index 54b455313957d86eda48c4d75dea82dadf9d574e..62f1680441f1af41846c7b5942fff90884eba4f6 100644 (file)
 #define sdr_plbtr      0x4200
 #define sdr_mfr                0x4300  /* SDR0_MFR reg */
 
-/*-----------------------------------------------------------------------------
- | SDRAM Controller
- +----------------------------------------------------------------------------*/
-/* values for memcfga register - indirect addressing of these regs         */
-#define mem_besr0_clr  0x0000  /* bus error status reg 0 (clr)             */
-#define mem_besr0_set  0x0004  /* bus error status reg 0 (set)             */
-#define mem_besr1_clr  0x0008  /* bus error status reg 1 (clr)             */
-#define mem_besr1_set  0x000c  /* bus error status reg 1 (set)             */
-#define mem_bear       0x0010  /* bus error address reg                    */
-#define mem_mirq_clr   0x0011  /* bus master interrupt (clr)               */
-#define mem_mirq_set   0x0012  /* bus master interrupt (set)               */
-#define mem_slio       0x0018  /* ddr sdram slave interface options        */
-#define mem_cfg0       0x0020  /* ddr sdram options 0                      */
-#define mem_cfg1       0x0021  /* ddr sdram options 1                      */
-#define mem_devopt     0x0022  /* ddr sdram device options                 */
-#define mem_mcsts      0x0024  /* memory controller status                 */
-#define mem_rtr                0x0030  /* refresh timer register                   */
-#define mem_pmit       0x0034  /* power management idle timer              */
-#define mem_uabba      0x0038  /* plb UABus base address                   */
-#define mem_b0cr       0x0040  /* ddr sdram bank 0 configuration           */
-#define mem_b1cr       0x0044  /* ddr sdram bank 1 configuration           */
-#define mem_b2cr       0x0048  /* ddr sdram bank 2 configuration           */
-#define mem_b3cr       0x004c  /* ddr sdram bank 3 configuration           */
-#define mem_tr0                0x0080  /* sdram timing register 0                  */
-#define mem_tr1                0x0081  /* sdram timing register 1                  */
-#define mem_clktr      0x0082  /* ddr clock timing register                */
-#define mem_wddctr     0x0083  /* write data/dm/dqs clock timing reg       */
-#define mem_dlycal     0x0084  /* delay line calibration register          */
-#define mem_eccesr     0x0098  /* ECC error status                         */
-
 #ifdef CONFIG_440GX
 #define sdr_amp                0x0240
 #define sdr_xpllc      0x01c1
 #define SDR0_PEGPLLSTS         0x000003A2      /* PE Pll LC Tank Status */
 #endif /* CONFIG_440SPE */
 
-#if defined(CONFIG_440SP) || defined(CONFIG_440SPE) || \
-    defined(CONFIG_460EX) || defined(CONFIG_460GT)
-/*----------------------------------------------------------------------------+
-| SDRAM Controller
-+----------------------------------------------------------------------------*/
-/*-----------------------------------------------------------------------------+
-| SDRAM DLYCAL Options
-+-----------------------------------------------------------------------------*/
-#define SDRAM_DLYCAL_DLCV_MASK         0x000003FC
-#define SDRAM_DLYCAL_DLCV_ENCODE(x)    (((x)<<2) & SDRAM_DLYCAL_DLCV_MASK)
-#define SDRAM_DLYCAL_DLCV_DECODE(x)    (((x) & SDRAM_DLYCAL_DLCV_MASK)>>2)
-
-/*----------------------------------------------------------------------------+
-| Memory queue defines
-+----------------------------------------------------------------------------*/
-/* A REVOIR versus RWC  - SG*/
-#define SDRAMQ_DCR_BASE        0x040
-
-#define SDRAM_R0BAS    (SDRAMQ_DCR_BASE+0x0)   /* rank 0 base address & size  */
-#define SDRAM_R1BAS    (SDRAMQ_DCR_BASE+0x1)   /* rank 1 base address & size  */
-#define SDRAM_R2BAS    (SDRAMQ_DCR_BASE+0x2)   /* rank 2 base address & size  */
-#define SDRAM_R3BAS    (SDRAMQ_DCR_BASE+0x3)   /* rank 3 base address & size  */
-#define SDRAM_CONF1HB  (SDRAMQ_DCR_BASE+0x5)   /* configuration 1 HB          */
-#define SDRAM_ERRSTATHB        (SDRAMQ_DCR_BASE+0x7)   /* error status HB             */
-#define SDRAM_ERRADDUHB        (SDRAMQ_DCR_BASE+0x8)   /* error address upper 32 HB   */
-#define SDRAM_ERRADDLHB        (SDRAMQ_DCR_BASE+0x9)   /* error address lower 32 HB   */
-#define SDRAM_PLBADDULL        (SDRAMQ_DCR_BASE+0xA)   /* PLB base address upper 32 LL */
-#define SDRAM_CONF1LL  (SDRAMQ_DCR_BASE+0xB)   /* configuration 1 LL          */
-#define SDRAM_ERRSTATLL        (SDRAMQ_DCR_BASE+0xC)   /* error status LL             */
-#define SDRAM_ERRADDULL        (SDRAMQ_DCR_BASE+0xD)   /* error address upper 32 LL   */
-#define SDRAM_ERRADDLLL        (SDRAMQ_DCR_BASE+0xE)   /* error address lower 32 LL   */
-#define SDRAM_CONFPATHB        (SDRAMQ_DCR_BASE+0xF)   /* configuration between paths */
-#define SDRAM_PLBADDUHB        (SDRAMQ_DCR_BASE+0x10)  /* PLB base address upper 32 LL */
-
-/*-----------------------------------------------------------------------------+
-|  Memory Bank 0-7 configuration
-+-----------------------------------------------------------------------------*/
-#if defined(CONFIG_440SPE) || \
-    defined(CONFIG_460EX) || defined(CONFIG_460GT)
-#define SDRAM_RXBAS_SDBA_MASK          0xFFE00000      /* Base address */
-#define SDRAM_RXBAS_SDBA_ENCODE(n)     ((((unsigned long)(n))&0xFFE00000)>>2)
-#define SDRAM_RXBAS_SDBA_DECODE(n)     ((((unsigned long)(n))&0xFFE00000)<<2)
-#endif /* CONFIG_440SPE */
-#if defined(CONFIG_440SP)
-#define SDRAM_RXBAS_SDBA_MASK          0xFF800000      /* Base address */
-#define SDRAM_RXBAS_SDBA_ENCODE(n)     ((((unsigned long)(n))&0xFF800000))
-#define SDRAM_RXBAS_SDBA_DECODE(n)     ((((unsigned long)(n))&0xFF800000))
-#endif /* CONFIG_440SP */
-#define SDRAM_RXBAS_SDSZ_MASK          0x0000FFC0      /* Size         */
-#define SDRAM_RXBAS_SDSZ_ENCODE(n)     ((((unsigned long)(n))&0x3FF)<<6)
-#define SDRAM_RXBAS_SDSZ_DECODE(n)     ((((unsigned long)(n))>>6)&0x3FF)
-#define SDRAM_RXBAS_SDSZ_0             0x00000000      /*   0M         */
-#define SDRAM_RXBAS_SDSZ_8             0x0000FFC0      /*   8M         */
-#define SDRAM_RXBAS_SDSZ_16            0x0000FF80      /*  16M         */
-#define SDRAM_RXBAS_SDSZ_32            0x0000FF00      /*  32M         */
-#define SDRAM_RXBAS_SDSZ_64            0x0000FE00      /*  64M         */
-#define SDRAM_RXBAS_SDSZ_128           0x0000FC00      /* 128M         */
-#define SDRAM_RXBAS_SDSZ_256           0x0000F800      /* 256M         */
-#define SDRAM_RXBAS_SDSZ_512           0x0000F000      /* 512M         */
-#define SDRAM_RXBAS_SDSZ_1024          0x0000E000      /* 1024M        */
-#define SDRAM_RXBAS_SDSZ_2048          0x0000C000      /* 2048M        */
-#define SDRAM_RXBAS_SDSZ_4096          0x00008000      /* 4096M        */
-
-/*----------------------------------------------------------------------------+
-| Memory controller defines
-+----------------------------------------------------------------------------*/
-/* A REVOIR versus specs 4 bank  - SG*/
-#define SDRAM_MCSTAT   0x14    /* memory controller status                  */
-#define SDRAM_MCOPT1   0x20    /* memory controller options 1               */
-#define SDRAM_MCOPT2   0x21    /* memory controller options 2               */
-#define SDRAM_MODT0    0x22    /* on die termination for bank 0             */
-#define SDRAM_MODT1    0x23    /* on die termination for bank 1             */
-#define SDRAM_MODT2    0x24    /* on die termination for bank 2             */
-#define SDRAM_MODT3    0x25    /* on die termination for bank 3             */
-#define SDRAM_CODT     0x26    /* on die termination for controller         */
-#define SDRAM_VVPR     0x27    /* variable VRef programmming                */
-#define SDRAM_OPARS    0x28    /* on chip driver control setup              */
-#define SDRAM_OPART    0x29    /* on chip driver control trigger            */
-#define SDRAM_RTR      0x30    /* refresh timer                             */
-#define SDRAM_PMIT     0x34    /* power management idle timer               */
-#define SDRAM_MB0CF    0x40    /* memory bank 0 configuration               */
-#define SDRAM_MB1CF    0x44    /* memory bank 1 configuration               */
-#define SDRAM_MB2CF    0x48
-#define SDRAM_MB3CF    0x4C
-#define SDRAM_INITPLR0 0x50    /* manual initialization control             */
-#define SDRAM_INITPLR1 0x51    /* manual initialization control             */
-#define SDRAM_INITPLR2 0x52    /* manual initialization control             */
-#define SDRAM_INITPLR3 0x53    /* manual initialization control             */
-#define SDRAM_INITPLR4 0x54    /* manual initialization control             */
-#define SDRAM_INITPLR5 0x55    /* manual initialization control             */
-#define SDRAM_INITPLR6 0x56    /* manual initialization control             */
-#define SDRAM_INITPLR7 0x57    /* manual initialization control             */
-#define SDRAM_INITPLR8 0x58    /* manual initialization control             */
-#define SDRAM_INITPLR9 0x59    /* manual initialization control             */
-#define SDRAM_INITPLR10        0x5a    /* manual initialization control             */
-#define SDRAM_INITPLR11        0x5b    /* manual initialization control             */
-#define SDRAM_INITPLR12        0x5c    /* manual initialization control             */
-#define SDRAM_INITPLR13        0x5d    /* manual initialization control             */
-#define SDRAM_INITPLR14        0x5e    /* manual initialization control             */
-#define SDRAM_INITPLR15        0x5f    /* manual initialization control             */
-#define SDRAM_RQDC     0x70    /* read DQS delay control                    */
-#define SDRAM_RFDC     0x74    /* read feedback delay control               */
-#define SDRAM_RDCC     0x78    /* read data capture control                 */
-#define SDRAM_DLCR     0x7A    /* delay line calibration                    */
-#define SDRAM_CLKTR    0x80    /* DDR clock timing                          */
-#define SDRAM_WRDTR    0x81    /* write data, DQS, DM clock, timing         */
-#define SDRAM_SDTR1    0x85    /* DDR SDRAM timing 1                        */
-#define SDRAM_SDTR2    0x86    /* DDR SDRAM timing 2                        */
-#define SDRAM_SDTR3    0x87    /* DDR SDRAM timing 3                        */
-#define SDRAM_MMODE    0x88    /* memory mode                               */
-#define SDRAM_MEMODE   0x89    /* memory extended mode                      */
-#define SDRAM_ECCCR    0x98    /* ECC error status                          */
-#define SDRAM_CID      0xA4    /* core ID                                   */
-#define SDRAM_RID      0xA8    /* revision ID                               */
-#define SDRAM_RTSR     0xB1    /* run time status tracking                  */
-
-/*-----------------------------------------------------------------------------+
-|  Memory Controller Status
-+-----------------------------------------------------------------------------*/
-#define SDRAM_MCSTAT_MIC_MASK          0x80000000      /* Memory init status mask      */
-#define SDRAM_MCSTAT_MIC_NOTCOMP       0x00000000      /* Mem init not complete        */
-#define SDRAM_MCSTAT_MIC_COMP          0x80000000      /* Mem init complete            */
-#define SDRAM_MCSTAT_SRMS_MASK         0x40000000      /* Mem self refresh stat mask   */
-#define SDRAM_MCSTAT_SRMS_NOT_SF       0x00000000      /* Mem not in self refresh      */
-#define SDRAM_MCSTAT_SRMS_SF           0x40000000      /* Mem in self refresh          */
-#define SDRAM_MCSTAT_IDLE_MASK         0x20000000      /* Mem self refresh stat mask   */
-#define SDRAM_MCSTAT_IDLE_NOT          0x00000000      /* Mem contr not idle           */
-#define SDRAM_MCSTAT_IDLE              0x20000000      /* Mem contr idle               */
-
-/*-----------------------------------------------------------------------------+
-|  Memory Controller Options 1
-+-----------------------------------------------------------------------------*/
-#define SDRAM_MCOPT1_MCHK_MASK         0x30000000 /* Memory data err check mask*/
-#define SDRAM_MCOPT1_MCHK_NON          0x00000000 /* No ECC generation         */
-#define SDRAM_MCOPT1_MCHK_GEN          0x20000000 /* ECC generation            */
-#define SDRAM_MCOPT1_MCHK_CHK          0x10000000 /* ECC generation and check  */
-#define SDRAM_MCOPT1_MCHK_CHK_REP      0x30000000 /* ECC generation, chk, report*/
-#define SDRAM_MCOPT1_MCHK_CHK_DECODE(n)        ((((unsigned long)(n))>>28)&0x3)
-#define SDRAM_MCOPT1_RDEN_MASK         0x08000000 /* Registered DIMM mask      */
-#define SDRAM_MCOPT1_RDEN              0x08000000 /* Registered DIMM enable    */
-#define SDRAM_MCOPT1_PMU_MASK          0x06000000 /* Page management unit mask */
-#define SDRAM_MCOPT1_PMU_CLOSE         0x00000000 /* PMU Close                 */
-#define SDRAM_MCOPT1_PMU_OPEN          0x04000000 /* PMU Open                  */
-#define SDRAM_MCOPT1_PMU_AUTOCLOSE     0x02000000 /* PMU AutoClose             */
-#define SDRAM_MCOPT1_DMWD_MASK         0x01000000 /* DRAM width mask           */
-#define SDRAM_MCOPT1_DMWD_32           0x00000000 /* 32 bits                   */
-#define SDRAM_MCOPT1_DMWD_64           0x01000000 /* 64 bits                   */
-#define SDRAM_MCOPT1_UIOS_MASK         0x00C00000 /* Unused IO State           */
-#define SDRAM_MCOPT1_BCNT_MASK         0x00200000 /* Bank count                */
-#define SDRAM_MCOPT1_4_BANKS           0x00000000 /* 4 Banks                   */
-#define SDRAM_MCOPT1_8_BANKS           0x00200000 /* 8 Banks                   */
-#define SDRAM_MCOPT1_DDR_TYPE_MASK     0x00100000 /* DDR Memory Type mask      */
-#define SDRAM_MCOPT1_DDR1_TYPE         0x00000000 /* DDR1 Memory Type          */
-#define SDRAM_MCOPT1_DDR2_TYPE         0x00100000 /* DDR2 Memory Type          */
-#define SDRAM_MCOPT1_QDEP              0x00020000 /* 4 commands deep           */
-#define SDRAM_MCOPT1_RWOO_MASK         0x00008000 /* Out of Order Read mask    */
-#define SDRAM_MCOPT1_RWOO_DISABLED     0x00000000 /* disabled                  */
-#define SDRAM_MCOPT1_RWOO_ENABLED      0x00008000 /* enabled                   */
-#define SDRAM_MCOPT1_WOOO_MASK         0x00004000 /* Out of Order Write mask   */
-#define SDRAM_MCOPT1_WOOO_DISABLED     0x00000000 /* disabled                  */
-#define SDRAM_MCOPT1_WOOO_ENABLED      0x00004000 /* enabled                   */
-#define SDRAM_MCOPT1_DCOO_MASK         0x00002000 /* All Out of Order mask     */
-#define SDRAM_MCOPT1_DCOO_DISABLED     0x00002000 /* disabled                  */
-#define SDRAM_MCOPT1_DCOO_ENABLED      0x00000000 /* enabled                   */
-#define SDRAM_MCOPT1_DREF_MASK         0x00001000 /* Deferred refresh mask     */
-#define SDRAM_MCOPT1_DREF_NORMAL       0x00000000 /* normal refresh            */
-#define SDRAM_MCOPT1_DREF_DEFER_4      0x00001000 /* defer up to 4 refresh cmd */
-
-/*-----------------------------------------------------------------------------+
-|  Memory Controller Options 2
-+-----------------------------------------------------------------------------*/
-#define SDRAM_MCOPT2_SREN_MASK         0x80000000 /* Self Test mask            */
-#define SDRAM_MCOPT2_SREN_EXIT         0x00000000 /* Self Test exit            */
-#define SDRAM_MCOPT2_SREN_ENTER                0x80000000 /* Self Test enter           */
-#define SDRAM_MCOPT2_PMEN_MASK         0x40000000 /* Power Management mask     */
-#define SDRAM_MCOPT2_PMEN_DISABLE      0x00000000 /* disable                   */
-#define SDRAM_MCOPT2_PMEN_ENABLE       0x40000000 /* enable                    */
-#define SDRAM_MCOPT2_IPTR_MASK         0x20000000 /* Init Trigger Reg mask     */
-#define SDRAM_MCOPT2_IPTR_IDLE         0x00000000 /* idle                      */
-#define SDRAM_MCOPT2_IPTR_EXECUTE      0x20000000 /* execute preloaded init    */
-#define SDRAM_MCOPT2_XSRP_MASK         0x10000000 /* Exit Self Refresh Prevent */
-#define SDRAM_MCOPT2_XSRP_ALLOW                0x00000000 /* allow self refresh exit   */
-#define SDRAM_MCOPT2_XSRP_PREVENT      0x10000000 /* prevent self refresh exit */
-#define SDRAM_MCOPT2_DCEN_MASK         0x08000000 /* SDRAM Controller Enable   */
-#define SDRAM_MCOPT2_DCEN_DISABLE      0x00000000 /* SDRAM Controller Enable   */
-#define SDRAM_MCOPT2_DCEN_ENABLE       0x08000000 /* SDRAM Controller Enable   */
-#define SDRAM_MCOPT2_ISIE_MASK         0x04000000 /* Init Seq Interruptable mas*/
-#define SDRAM_MCOPT2_ISIE_DISABLE      0x00000000 /* disable                   */
-#define SDRAM_MCOPT2_ISIE_ENABLE       0x04000000 /* enable                    */
-
-/*-----------------------------------------------------------------------------+
-|  SDRAM Refresh Timer Register
-+-----------------------------------------------------------------------------*/
-#define SDRAM_RTR_RINT_MASK            0xFFF80000
-#define SDRAM_RTR_RINT_ENCODE(n)       ((((unsigned long)(n))&0xFFF8)<<16)
-#define SDRAM_RTR_RINT_DECODE(n)       ((((unsigned long)(n))>>16)&0xFFF8)
-
-/*-----------------------------------------------------------------------------+
-|  SDRAM Read DQS Delay Control Register
-+-----------------------------------------------------------------------------*/
-#define SDRAM_RQDC_RQDE_MASK           0x80000000
-#define SDRAM_RQDC_RQDE_DISABLE                0x00000000
-#define SDRAM_RQDC_RQDE_ENABLE         0x80000000
-#define SDRAM_RQDC_RQFD_MASK           0x000001FF
-#define SDRAM_RQDC_RQFD_ENCODE(n)      ((((unsigned long)(n))&0x1FF)<<0)
-
-#define SDRAM_RQDC_RQFD_MAX            0x1FF
-
-/*-----------------------------------------------------------------------------+
-|  SDRAM Read Data Capture Control Register
-+-----------------------------------------------------------------------------*/
-#define SDRAM_RDCC_RDSS_MASK           0xC0000000
-#define SDRAM_RDCC_RDSS_T1             0x00000000
-#define SDRAM_RDCC_RDSS_T2             0x40000000
-#define SDRAM_RDCC_RDSS_T3             0x80000000
-#define SDRAM_RDCC_RDSS_T4             0xC0000000
-#define SDRAM_RDCC_RSAE_MASK           0x00000001
-#define SDRAM_RDCC_RSAE_DISABLE                0x00000001
-#define SDRAM_RDCC_RSAE_ENABLE         0x00000000
-
-/*-----------------------------------------------------------------------------+
-|  SDRAM Read Feedback Delay Control Register
-+-----------------------------------------------------------------------------*/
-#define SDRAM_RFDC_ARSE_MASK           0x80000000
-#define SDRAM_RFDC_ARSE_DISABLE                0x80000000
-#define SDRAM_RFDC_ARSE_ENABLE         0x00000000
-#define SDRAM_RFDC_RFOS_MASK           0x007F0000
-#define SDRAM_RFDC_RFOS_ENCODE(n)      ((((unsigned long)(n))&0x7F)<<16)
-#define SDRAM_RFDC_RFFD_MASK           0x000007FF
-#define SDRAM_RFDC_RFFD_ENCODE(n)      ((((unsigned long)(n))&0x7FF)<<0)
-
-#define SDRAM_RFDC_RFFD_MAX            0x7FF
-
-/*-----------------------------------------------------------------------------+
-|  SDRAM Delay Line Calibration Register
-+-----------------------------------------------------------------------------*/
-#define SDRAM_DLCR_DCLM_MASK           0x80000000
-#define SDRAM_DLCR_DCLM_MANUEL         0x80000000
-#define SDRAM_DLCR_DCLM_AUTO           0x00000000
-#define SDRAM_DLCR_DLCR_MASK           0x08000000
-#define SDRAM_DLCR_DLCR_CALIBRATE      0x08000000
-#define SDRAM_DLCR_DLCR_IDLE           0x00000000
-#define SDRAM_DLCR_DLCS_MASK           0x07000000
-#define SDRAM_DLCR_DLCS_NOT_RUN                0x00000000
-#define SDRAM_DLCR_DLCS_IN_PROGRESS    0x01000000
-#define SDRAM_DLCR_DLCS_COMPLETE       0x02000000
-#define SDRAM_DLCR_DLCS_CONT_DONE      0x03000000
-#define SDRAM_DLCR_DLCS_ERROR          0x04000000
-#define SDRAM_DLCR_DLCV_MASK           0x000001FF
-#define SDRAM_DLCR_DLCV_ENCODE(n)      ((((unsigned long)(n))&0x1FF)<<0)
-#define SDRAM_DLCR_DLCV_DECODE(n)      ((((unsigned long)(n))>>0)&0x1FF)
-
-/*-----------------------------------------------------------------------------+
-|  SDRAM Controller On Die Termination Register
-+-----------------------------------------------------------------------------*/
-#define SDRAM_CODT_ODT_ON                      0x80000000
-#define SDRAM_CODT_ODT_OFF                     0x00000000
-#define SDRAM_CODT_DQS_VOLTAGE_DDR_MASK                0x00000020
-#define SDRAM_CODT_DQS_2_5_V_DDR1              0x00000000
-#define SDRAM_CODT_DQS_1_8_V_DDR2              0x00000020
-#define SDRAM_CODT_DQS_MASK                    0x00000010
-#define SDRAM_CODT_DQS_DIFFERENTIAL            0x00000000
-#define SDRAM_CODT_DQS_SINGLE_END              0x00000010
-#define SDRAM_CODT_CKSE_DIFFERENTIAL           0x00000000
-#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
-
-/*-----------------------------------------------------------------------------+
-|  SDRAM Mode Register
-+-----------------------------------------------------------------------------*/
-#define SDRAM_MMODE_WR_MASK            0x00000E00
-#define SDRAM_MMODE_WR_DDR1            0x00000000
-#define SDRAM_MMODE_WR_DDR2_3_CYC      0x00000400
-#define SDRAM_MMODE_WR_DDR2_4_CYC      0x00000600
-#define SDRAM_MMODE_WR_DDR2_5_CYC      0x00000800
-#define SDRAM_MMODE_WR_DDR2_6_CYC      0x00000A00
-#define SDRAM_MMODE_DCL_MASK           0x00000070
-#define SDRAM_MMODE_DCL_DDR1_2_0_CLK   0x00000020
-#define SDRAM_MMODE_DCL_DDR1_2_5_CLK   0x00000060
-#define SDRAM_MMODE_DCL_DDR1_3_0_CLK   0x00000030
-#define SDRAM_MMODE_DCL_DDR2_2_0_CLK   0x00000020
-#define SDRAM_MMODE_DCL_DDR2_3_0_CLK   0x00000030
-#define SDRAM_MMODE_DCL_DDR2_4_0_CLK   0x00000040
-#define SDRAM_MMODE_DCL_DDR2_5_0_CLK   0x00000050
-#define SDRAM_MMODE_DCL_DDR2_6_0_CLK   0x00000060
-#define SDRAM_MMODE_DCL_DDR2_7_0_CLK   0x00000070
-
-/*-----------------------------------------------------------------------------+
-|  SDRAM Extended Mode Register
-+-----------------------------------------------------------------------------*/
-#define SDRAM_MEMODE_DIC_MASK          0x00000002
-#define SDRAM_MEMODE_DIC_NORMAL                0x00000000
-#define SDRAM_MEMODE_DIC_WEAK          0x00000002
-#define SDRAM_MEMODE_DLL_MASK          0x00000001
-#define SDRAM_MEMODE_DLL_DISABLE       0x00000001
-#define SDRAM_MEMODE_DLL_ENABLE                0x00000000
-#define SDRAM_MEMODE_RTT_MASK          0x00000044
-#define SDRAM_MEMODE_RTT_DISABLED      0x00000000
-#define SDRAM_MEMODE_RTT_75OHM         0x00000004
-#define SDRAM_MEMODE_RTT_150OHM                0x00000040
-#define SDRAM_MEMODE_DQS_MASK          0x00000400
-#define SDRAM_MEMODE_DQS_DISABLE       0x00000400
-#define SDRAM_MEMODE_DQS_ENABLE                0x00000000
-
-/*-----------------------------------------------------------------------------+
-|  SDRAM Clock Timing Register
-+-----------------------------------------------------------------------------*/
-#define SDRAM_CLKTR_CLKP_MASK          0xC0000000
-#define SDRAM_CLKTR_CLKP_0_DEG         0x00000000
-#define SDRAM_CLKTR_CLKP_180_DEG_ADV   0x80000000
-#define SDRAM_CLKTR_CLKP_90_DEG_ADV    0x40000000
-#define SDRAM_CLKTR_CLKP_270_DEG_ADV   0xC0000000
-
-/*-----------------------------------------------------------------------------+
-|  SDRAM Write Timing Register
-+-----------------------------------------------------------------------------*/
-#define SDRAM_WRDTR_LLWP_MASK          0x10000000
-#define SDRAM_WRDTR_LLWP_DIS           0x10000000
-#define SDRAM_WRDTR_LLWP_1_CYC         0x00000000
-#define SDRAM_WRDTR_WTR_MASK           0x0E000000
-#define SDRAM_WRDTR_WTR_0_DEG          0x06000000
-#define SDRAM_WRDTR_WTR_90_DEG_ADV     0x04000000
-#define SDRAM_WRDTR_WTR_180_DEG_ADV    0x02000000
-#define SDRAM_WRDTR_WTR_270_DEG_ADV    0x00000000
-
-/*-----------------------------------------------------------------------------+
-|  SDRAM SDTR1 Options
-+-----------------------------------------------------------------------------*/
-#define SDRAM_SDTR1_LDOF_MASK          0x80000000
-#define SDRAM_SDTR1_LDOF_1_CLK         0x00000000
-#define SDRAM_SDTR1_LDOF_2_CLK         0x80000000
-#define SDRAM_SDTR1_RTW_MASK           0x00F00000
-#define SDRAM_SDTR1_RTW_2_CLK          0x00200000
-#define SDRAM_SDTR1_RTW_3_CLK          0x00300000
-#define SDRAM_SDTR1_WTWO_MASK          0x000F0000
-#define SDRAM_SDTR1_WTWO_0_CLK         0x00000000
-#define SDRAM_SDTR1_WTWO_1_CLK         0x00010000
-#define SDRAM_SDTR1_RTRO_MASK          0x0000F000
-#define SDRAM_SDTR1_RTRO_1_CLK         0x00001000
-#define SDRAM_SDTR1_RTRO_2_CLK         0x00002000
-
-/*-----------------------------------------------------------------------------+
-|  SDRAM SDTR2 Options
-+-----------------------------------------------------------------------------*/
-#define SDRAM_SDTR2_RCD_MASK           0xF0000000
-#define SDRAM_SDTR2_RCD_1_CLK          0x10000000
-#define SDRAM_SDTR2_RCD_2_CLK          0x20000000
-#define SDRAM_SDTR2_RCD_3_CLK          0x30000000
-#define SDRAM_SDTR2_RCD_4_CLK          0x40000000
-#define SDRAM_SDTR2_RCD_5_CLK          0x50000000
-#define SDRAM_SDTR2_WTR_MASK           0x0F000000
-#define SDRAM_SDTR2_WTR_1_CLK          0x01000000
-#define SDRAM_SDTR2_WTR_2_CLK          0x02000000
-#define SDRAM_SDTR2_WTR_3_CLK          0x03000000
-#define SDRAM_SDTR2_WTR_4_CLK          0x04000000
-#define SDRAM_SDTR3_WTR_ENCODE(n)      ((((unsigned long)(n))&0xF)<<24)
-#define SDRAM_SDTR2_XSNR_MASK          0x00FF0000
-#define SDRAM_SDTR2_XSNR_8_CLK         0x00080000
-#define SDRAM_SDTR2_XSNR_16_CLK                0x00100000
-#define SDRAM_SDTR2_XSNR_32_CLK                0x00200000
-#define SDRAM_SDTR2_XSNR_64_CLK                0x00400000
-#define SDRAM_SDTR2_WPC_MASK           0x0000F000
-#define SDRAM_SDTR2_WPC_2_CLK          0x00002000
-#define SDRAM_SDTR2_WPC_3_CLK          0x00003000
-#define SDRAM_SDTR2_WPC_4_CLK          0x00004000
-#define SDRAM_SDTR2_WPC_5_CLK          0x00005000
-#define SDRAM_SDTR2_WPC_6_CLK          0x00006000
-#define SDRAM_SDTR3_WPC_ENCODE(n)      ((((unsigned long)(n))&0xF)<<12)
-#define SDRAM_SDTR2_RPC_MASK           0x00000F00
-#define SDRAM_SDTR2_RPC_2_CLK          0x00000200
-#define SDRAM_SDTR2_RPC_3_CLK          0x00000300
-#define SDRAM_SDTR2_RPC_4_CLK          0x00000400
-#define SDRAM_SDTR2_RP_MASK            0x000000F0
-#define SDRAM_SDTR2_RP_3_CLK           0x00000030
-#define SDRAM_SDTR2_RP_4_CLK           0x00000040
-#define SDRAM_SDTR2_RP_5_CLK           0x00000050
-#define SDRAM_SDTR2_RP_6_CLK           0x00000060
-#define SDRAM_SDTR2_RP_7_CLK           0x00000070
-#define SDRAM_SDTR2_RRD_MASK           0x0000000F
-#define SDRAM_SDTR2_RRD_2_CLK          0x00000002
-#define SDRAM_SDTR2_RRD_3_CLK          0x00000003
-
-/*-----------------------------------------------------------------------------+
-|  SDRAM SDTR3 Options
-+-----------------------------------------------------------------------------*/
-#define SDRAM_SDTR3_RAS_MASK           0x1F000000
-#define SDRAM_SDTR3_RAS_ENCODE(n)      ((((unsigned long)(n))&0x1F)<<24)
-#define SDRAM_SDTR3_RC_MASK            0x001F0000
-#define SDRAM_SDTR3_RC_ENCODE(n)       ((((unsigned long)(n))&0x1F)<<16)
-#define SDRAM_SDTR3_XCS_MASK           0x00001F00
-#define SDRAM_SDTR3_XCS                        0x00000D00
-#define SDRAM_SDTR3_RFC_MASK           0x0000003F
-#define SDRAM_SDTR3_RFC_ENCODE(n)      ((((unsigned long)(n))&0x3F)<<0)
-
-/*-----------------------------------------------------------------------------+
-|  Memory Bank 0-1 configuration
-+-----------------------------------------------------------------------------*/
-#define SDRAM_BXCF_M_AM_MASK           0x00000F00      /* Addressing mode      */
-#define SDRAM_BXCF_M_AM_0              0x00000000      /*   Mode 0             */
-#define SDRAM_BXCF_M_AM_1              0x00000100      /*   Mode 1             */
-#define SDRAM_BXCF_M_AM_2              0x00000200      /*   Mode 2             */
-#define SDRAM_BXCF_M_AM_3              0x00000300      /*   Mode 3             */
-#define SDRAM_BXCF_M_AM_4              0x00000400      /*   Mode 4             */
-#define SDRAM_BXCF_M_AM_5              0x00000500      /*   Mode 5             */
-#define SDRAM_BXCF_M_AM_6              0x00000600      /*   Mode 6             */
-#define SDRAM_BXCF_M_AM_7              0x00000700      /*   Mode 7             */
-#define SDRAM_BXCF_M_AM_8              0x00000800      /*   Mode 8             */
-#define SDRAM_BXCF_M_AM_9              0x00000900      /*   Mode 9             */
-#define SDRAM_BXCF_M_BE_MASK           0x00000001      /* Memory Bank Enable   */
-#define SDRAM_BXCF_M_BE_DISABLE                0x00000000      /* Memory Bank Enable   */
-#define SDRAM_BXCF_M_BE_ENABLE         0x00000001      /* Memory Bank Enable   */
-
-#define SDRAM_RTSR_TRK1SM_MASK         0xC0000000      /* Tracking State Mach 1*/
-#define SDRAM_RTSR_TRK1SM_ATBASE       0x00000000      /* atbase state         */
-#define SDRAM_RTSR_TRK1SM_MISSED       0x40000000      /* missed state         */
-#define SDRAM_RTSR_TRK1SM_ATPLS1       0x80000000      /* atpls1 state         */
-#define SDRAM_RTSR_TRK1SM_RESET                0xC0000000      /* reset  state         */
-
-#define SDR0_MFR_FIXD                  0x10000000      /* Workaround for PCI/DMA */
-#endif /* CONFIG_440SPE */
-
-#if defined(CONFIG_440EPX) || defined(CONFIG_440GRX)
-/*-----------------------------------------------------------------------------
- | SDRAM Controller
- +----------------------------------------------------------------------------*/
-#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_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_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
-#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))&0x3FFF)<<0)
-#define DDR0_26_TREF_DECODE(n)              ((((unsigned long)(n))>>0)&0x3FFF)
-
-#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_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 /* CONFIG_440EPX */
-
 /*-----------------------------------------------------------------------------
  | External Bus Controller
  +----------------------------------------------------------------------------*/
index 76fe8727f5646e2879bc2f5341a345f62be81e58..0a8479f262309438085573b263a1e49114a6c1c0 100644 (file)
 #ifndef        __PPC4XX_H__
 #define __PPC4XX_H__
 
+/*
+ * Configure which SDRAM/DDR/DDR2 controller is equipped
+ */
+#if defined(CONFIG_405GP) || defined(CONFIG_405CR) || defined(CONFIG_405EP) || \
+       defined(CONFIG_AP1000) || defined(CONFIG_ML2)
+#define CONFIG_SDRAM_PPC4xx_IBM_SDRAM  /* IBM SDRAM controller */
+#endif
+
+#if defined(CONFIG_440GP) || defined(CONFIG_440GX) || \
+    defined(CONFIG_440EP) || defined(CONFIG_440GR)
+#define CONFIG_SDRAM_PPC4xx_IBM_DDR    /* IBM DDR controller */
+#endif
+
+#if defined(CONFIG_440EPX) || defined(CONFIG_440GRX)
+#define CONFIG_SDRAM_PPC4xx_DENALI_DDR2        /* Denali DDR(2) controller */
+#endif
+
+#if defined(CONFIG_405EX) || \
+    defined(CONFIG_440SP) || defined(CONFIG_440SPE) || \
+    defined(CONFIG_460EX) || defined(CONFIG_460GT)
+#define CONFIG_SDRAM_PPC4xx_IBM_DDR2   /* IBM DDR(2) controller */
+#endif
+
 #if defined(CONFIG_440)
 #include <ppc440.h>
 #else
 #include <ppc405.h>
 #endif
 
+#include <asm/ppc4xx-sdram.h>
+
+/*
+ * Macro for generating register field mnemonics
+ */
+#define        PPC_REG_BITS            32
+#define        PPC_REG_VAL(bit, value) ((value) << ((PPC_REG_BITS - 1) - (bit)))
+
+/*
+ * Elide casts when assembling register mnemonics
+ */
+#ifndef __ASSEMBLY__
+#define        static_cast(type, val)  (type)(val)
+#else
+#define        static_cast(type, val)  (val)
+#endif
+
 /*
  * Common stuff for 4xx (405 and 440)
  */
index 78ef47535e9a395cc0bd221d4fdd03844edcd6b8..a9aae4682f69d2ce07933e2a4018bc0c14c98102 100644 (file)
@@ -27,6 +27,8 @@
 
 #ifndef USE_HOSTCC
 #include <common.h>
+#else
+#include <string.h>
 #endif /* USE_HOSTCC */
 #include <watchdog.h>
 #include <linux/types.h>
index c8ef4d2827362af0a91953c0e2d06c0182e68c78..a192e5f3dd15308330ac40a8bef12a7346529eda 100644 (file)
@@ -31,6 +31,8 @@
 
 #ifndef USE_HOSTCC
 #include <common.h>
+#else
+#include <string.h>
 #endif /* USE_HOSTCC */
 #include <watchdog.h>
 #include <linux/string.h>
index a90883162c2f6752cf06178bf2d5c4ca50a4d85a..c42e08862fc87321c86261fcf8fb14f5d7f86b1b 100644 (file)
@@ -421,7 +421,8 @@ void board_init_f (ulong bootflag)
        /* compiler optimization barrier needed for GCC >= 3.4 */
        __asm__ __volatile__("": : :"memory");
 
-#if !defined(CONFIG_CPM2) && !defined(CONFIG_MPC83XX)
+#if !defined(CONFIG_CPM2) && !defined(CONFIG_MPC83XX) && \
+    !defined(CONFIG_MPC85xx) && !defined(CONFIG_MPC86xx)
        /* Clear initial global data */
        memset ((void *) gd, 0, sizeof (gd_t));
 #endif
index 4272108b510d40ffc32b0e39cbb5efb3b6e54a22..931f04b29ad39ba99abb7f39bb3e61e891f8949b 100644 (file)
@@ -51,7 +51,7 @@ $(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) \
+       cd $(LNDIR) && $(LD) $(LDFLAGS) $(__OBJS) \
                -Map $(nandobj)u-boot-spl.map \
                -o $(nandobj)u-boot-spl
 
index aed796070901884ad2ee949455484e4f6d385fad..e1c146750b721a85e4968890f2778f68bca355a2 100644 (file)
@@ -50,7 +50,7 @@ $(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) \
+       cd $(LNDIR) && $(LD) $(LDFLAGS) $(__OBJS) \
                -Map $(nandobj)u-boot-spl.map \
                -o $(nandobj)u-boot-spl
 
index ac77d066cb162f80559eafb4074785e6784bcd37..ca25252edfd8564c3e2edb3bf91a393fb564523b 100644 (file)
@@ -36,7 +36,7 @@ static void wait_init_complete(void)
 }
 
 /*
- * early_sdram_init()
+ * long int initdram(int board_type)
  *
  * As the name already indicates, this function is called very early
  * from start.S and configures the SDRAM with fixed values. This is needed,
@@ -51,7 +51,7 @@ static void wait_init_complete(void)
  * modules are still plugged in. So it is recommended to remove the DIMM
  * modules while using the NAND booting code with the fixed SDRAM setup!
  */
-void early_sdram_init(void)
+long int initdram(int board_type)
 {
        /*
         * Soft-reset SDRAM controller.
@@ -87,12 +87,6 @@ void early_sdram_init(void)
         */
        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;
 }
index 47c7d02c3c1f11dc2afb70b3be447f031caba382..fb86752002d0bea98442ce60e67eec09e27df317 100644 (file)
@@ -55,7 +55,7 @@ $(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) \
+       cd $(LNDIR) && $(LD) $(LDFLAGS) $(__OBJS) \
                -Map $(nandobj)u-boot-spl.map \
                -o $(nandobj)u-boot-spl
 
index 84bd29824d86627793b397f7987466624daab7ef..0667fc1a54c8586ba9dcb0aec1bb1b683400766b 100644 (file)
@@ -29,8 +29,8 @@ LDFLAGS       = -Bstatic -T $(LDSCRIPT) -Ttext $(TEXT_BASE) $(PLATFORM_LDFLAGS)
 AFLAGS += -DCONFIG_NAND_SPL
 CFLAGS += -DCONFIG_NAND_SPL
 
-SOBJS  = start.o init.o resetvec.o cache.o
-COBJS  = memory.o nand_boot.o nand_ecc.o ndfc.o
+SOBJS  = start.o resetvec.o cache.o
+COBJS  = 44x_spd_ddr2.o nand_boot.o nand_ecc.o ndfc.o
 
 SRCS   := $(addprefix $(obj),$(SOBJS:.o=.S) $(COBJS:.o=.c))
 OBJS   := $(addprefix $(obj),$(SOBJS) $(COBJS))
@@ -50,17 +50,25 @@ $(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) \
+       cd $(LNDIR) && $(LD) $(LDFLAGS) $(__OBJS) \
                -Map $(nandobj)u-boot-spl.map \
                -o $(nandobj)u-boot-spl
 
 # create symbolic links for common files
 
 # from cpu directory
+$(obj)44x_spd_ddr2.c: ecc.h
+       @rm -f $(obj)44x_spd_ddr2.c
+       ln -s $(SRCTREE)/cpu/ppc4xx/44x_spd_ddr2.c $(obj)44x_spd_ddr2.c
+
 $(obj)cache.S:
        @rm -f $(obj)cache.S
        ln -s $(SRCTREE)/cpu/ppc4xx/cache.S $(obj)cache.S
 
+$(obj)ecc.h:
+       @rm -f $(obj)ecc.h
+       ln -s $(SRCTREE)/cpu/ppc4xx/ecc.h $(obj)ecc.h
+
 $(obj)ndfc.c:
        @rm -f $(obj)ndfc.c
        ln -s $(SRCTREE)/cpu/ppc4xx/ndfc.c $(obj)ndfc.c
@@ -73,15 +81,6 @@ $(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/kilauea/init.S $(obj)init.S
-
-$(obj)memory.c:
-       @rm -f $(obj)memory.c
-       ln -s $(SRCTREE)/board/amcc/kilauea/memory.c $(obj)memory.c
-
 # from nand_spl directory
 $(obj)nand_boot.c:
        @rm -f $(obj)nand_boot.c
index 22490918d07d120b07e93c0815974822e3227dd2..d89ed3f0478d4b65cbcd73762579bddec558917f 100644 (file)
@@ -29,8 +29,9 @@
 #
 # 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 instruction-cache in start.S. So we set
-# TEXT_BASE to starting address in i-cache here.
+# We will copy this SPL into SDRAM since we can't access the NAND
+# controller at CS0 while running from this location. So we set
+# TEXT_BASE to starting address in SDRAM here.
 #
 TEXT_BASE = 0x00800000
 
index 084db08dd6aa65c0a73a537d3143b3e8c57555d7..03e0b798f936d80ed4f41abaa7f1dc9bfdf82840 100644 (file)
@@ -32,7 +32,6 @@ SECTIONS
   .text      :
   {
     start.o    (.text)
-    init.o     (.text)
     nand_boot.o        (.text)
     ndfc.o     (.text)
 
index 93150aad1bea92c6518fdc8547097f5955f9a6f5..fba0322a727307fa79e7779fe2ff498c40c1d84d 100644 (file)
@@ -50,7 +50,7 @@ $(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) \
+       cd $(LNDIR) && $(LD) $(LDFLAGS) $(__OBJS) \
                -Map $(nandobj)u-boot-spl.map \
                -o $(nandobj)u-boot-spl
 
index bc577252cf754fe695e5061ce51da6fd13104390..563a80b9537705e88019c582c0fdb4e2072490e1 100644 (file)
@@ -221,19 +221,18 @@ static int nand_load(struct mtd_info *mtd, int offs, int uboot_size, uchar *dst)
        return 0;
 }
 
+/*
+ * The main entry for NAND booting. It's necessary that SDRAM is already
+ * configured and available since this code loads the main U-Boot image
+ * from NAND into SDRAM and starts it from there.
+ */
 void nand_boot(void)
 {
-       ulong mem_size;
        struct nand_chip nand_chip;
        nand_info_t nand_info;
        int ret;
        void (*uboot)(void);
 
-       /*
-        * Init sdram, so we have access to memory
-        */
-       mem_size = initdram(0);
-
        /*
         * Init board specific nand support
         */
index 78128772fe5cda166ea74aa8ac95832d8d155b55..f55c7facf2783676ccd683e90fd45523e899e9f6 100644 (file)
--- a/net/net.c
+++ b/net/net.c
@@ -1407,6 +1407,10 @@ NetReceive(volatile uchar * inpkt, int len)
                if (ip->ip_off & htons(0x1fff)) { /* Can't deal w/ fragments */
                        return;
                }
+               /* can't deal with headers > 20 bytes */
+               if ((ip->ip_hl_v & 0x0f) > 0x05) {
+                       return;
+               }
                if (!NetCksumOk((uchar *)ip, IP_HDR_SIZE_NO_UDP / 2)) {
                        puts ("checksum bad\n");
                        return;
index 27cfb91594822ebb215e7d58b6e0370bdfc013a0..1a57c3dd1f22acb9414510935364c2715ac470ef 100644 (file)
 #define UDIV_SUBTRACT  0
 #define UART0_SDR      sdr_uart0
 #define UART1_SDR      sdr_uart1
-#if defined(CONFIG_440EP) || defined(CONFIG_440EPx) || \
-    defined(CONFIG_440GR) || defined(CONFIG_440GRx) || \
-    defined(CONFIG_440SP) || defined(CONFIG_440SPe)
+#if defined(CONFIG_440EP) || defined(CONFIG_440EPX) || \
+    defined(CONFIG_440GR) || defined(CONFIG_440GRX) || \
+    defined(CONFIG_440SP) || defined(CONFIG_440SPE)
 #define UART2_SDR      sdr_uart2
 #endif
-#if defined(CONFIG_440EP) || defined(CONFIG_440EPx) || \
-    defined(CONFIG_440GR) || defined(CONFIG_440GRx)
+#if defined(CONFIG_440EP) || defined(CONFIG_440EPX) || \
+    defined(CONFIG_440GR) || defined(CONFIG_440GRX)
 #define UART3_SDR      sdr_uart3
 #endif
 #define MFREG(a, d)    mfsdr(a, d)