]> git.kernelconcepts.de Git - karo-tx-uboot.git/commitdiff
Merge branch 'master' of git://www.denx.de/git/u-boot-cfi-flash
authorWolfgang Denk <wd@denx.de>
Wed, 11 Jun 2008 20:24:46 +0000 (22:24 +0200)
committerWolfgang Denk <wd@denx.de>
Wed, 11 Jun 2008 20:24:46 +0000 (22:24 +0200)
450 files changed:
CHANGELOG
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/atmel/at91cap9adk/Makefile
board/atmel/at91cap9adk/at91cap9adk.c
board/atmel/at91cap9adk/nand.c
board/atmel/at91sam9260ek/Makefile
board/atmel/at91sam9260ek/at91sam9260ek.c
board/atmel/at91sam9260ek/nand.c
board/atmel/at91sam9260ek/u-boot.lds [deleted file]
board/atmel/at91sam9261ek/Makefile [new file with mode: 0644]
board/atmel/at91sam9261ek/at91sam9261ek.c [new file with mode: 0644]
board/atmel/at91sam9261ek/config.mk [new file with mode: 0644]
board/atmel/at91sam9261ek/led.c [new file with mode: 0644]
board/atmel/at91sam9261ek/nand.c [new file with mode: 0644]
board/atmel/at91sam9261ek/partition.c [new file with mode: 0644]
board/atmel/at91sam9263ek/Makefile [new file with mode: 0644]
board/atmel/at91sam9263ek/at91sam9263ek.c [new file with mode: 0644]
board/atmel/at91sam9263ek/config.mk [new file with mode: 0644]
board/atmel/at91sam9263ek/led.c [new file with mode: 0644]
board/atmel/at91sam9263ek/nand.c [new file with mode: 0644]
board/atmel/at91sam9263ek/partition.c [new file with mode: 0644]
board/atmel/at91sam9rlek/Makefile [new file with mode: 0644]
board/atmel/at91sam9rlek/at91sam9rlek.c [new file with mode: 0644]
board/atmel/at91sam9rlek/config.mk [new file with mode: 0644]
board/atmel/at91sam9rlek/led.c [new file with mode: 0644]
board/atmel/at91sam9rlek/nand.c [new file with mode: 0644]
board/atmel/at91sam9rlek/partition.c [new file with mode: 0644]
board/atmel/atngw100/atngw100.c
board/atmel/atngw100/u-boot.lds
board/atmel/atstk1000/atstk1000.c
board/atmel/atstk1000/flash.c
board/atmel/atstk1000/u-boot.lds
board/atum8548/law.c
board/cray/L1/init.S
board/csb272/csb272.c
board/csb472/csb472.c
board/dbau1x00/dbau1x00.c
board/eric/eric.c
board/esd/ar405/ar405.c
board/esd/canbt/canbt.c
board/exbitgen/exbitgen.c
board/freescale/mpc8349emds/mpc8349emds.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/gth2/gth2.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 [moved from cpu/at32ap/pm.c with 60% similarity]
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/pb1x00/pb1x00.c
board/pcs440ep/pcs440ep.c
board/pm854/law.c
board/pm856/law.c
board/prodrive/alpr/alpr.c
board/qemu-mips/qemu-mips.c
board/quad100hd/Makefile [new file with mode: 0644]
board/quad100hd/config.mk [new file with mode: 0644]
board/quad100hd/nand.c [new file with mode: 0644]
board/quad100hd/quad100hd.c [new file with mode: 0644]
board/quad100hd/u-boot.lds [new file with mode: 0644]
board/sacsng/sacsng.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/ssv/adnpesc1/adnpesc1.c
board/stxgp3/law.c
board/stxssa/law.c
board/tqc/tqm5200/Makefile [moved from board/tqm5200/Makefile with 100% similarity]
board/tqc/tqm5200/cam5200_flash.c [moved from board/tqm5200/cam5200_flash.c with 100% similarity]
board/tqc/tqm5200/cmd_stk52xx.c [moved from board/tqm5200/cmd_stk52xx.c with 100% similarity]
board/tqc/tqm5200/cmd_tb5200.c [moved from board/tqm5200/cmd_tb5200.c with 100% similarity]
board/tqc/tqm5200/config.mk [moved from board/tqm5200/config.mk with 100% similarity]
board/tqc/tqm5200/mt48lc16m16a2-75.h [moved from board/tqm5200/mt48lc16m16a2-75.h with 100% similarity]
board/tqc/tqm5200/tqm5200.c [moved from board/tqm5200/tqm5200.c with 100% similarity]
board/tqc/tqm8260/Makefile [moved from board/tqm8260/Makefile with 100% similarity]
board/tqc/tqm8260/config.mk [moved from board/tqm8260/config.mk with 100% similarity]
board/tqc/tqm8260/flash.c [moved from board/tqm8260/flash.c with 100% similarity]
board/tqc/tqm8260/tqm8260.c [moved from board/tqm8260/tqm8260.c with 100% similarity]
board/tqc/tqm8272/Makefile [moved from board/tqm8272/Makefile with 100% similarity]
board/tqc/tqm8272/config.mk [moved from board/tqm8272/config.mk with 100% similarity]
board/tqc/tqm8272/tqm8272.c [moved from board/tqm8272/tqm8272.c with 100% similarity]
board/tqc/tqm834x/Makefile [moved from board/tqm834x/Makefile with 100% similarity]
board/tqc/tqm834x/config.mk [moved from board/tqm834x/config.mk with 100% similarity]
board/tqc/tqm834x/pci.c [moved from board/tqm834x/pci.c with 100% similarity]
board/tqc/tqm834x/tqm834x.c [moved from board/tqm834x/tqm834x.c with 100% similarity]
board/tqc/tqm85xx/Makefile [moved from board/tqm85xx/Makefile with 91% similarity]
board/tqc/tqm85xx/config.mk [moved from board/tqm85xx/config.mk with 100% similarity]
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 [moved from board/tqm85xx/u-boot.lds with 100% similarity]
board/tqc/tqm8xx/Makefile [moved from board/tqm8xx/Makefile with 100% similarity]
board/tqc/tqm8xx/config.mk [moved from board/tqm8xx/config.mk with 100% similarity]
board/tqc/tqm8xx/flash.c [moved from board/tqm8xx/flash.c with 100% similarity]
board/tqc/tqm8xx/load_sernum_ethaddr.c [moved from board/tqm8xx/load_sernum_ethaddr.c with 100% similarity]
board/tqc/tqm8xx/tqm8xx.c [moved from board/tqm8xx/tqm8xx.c with 100% similarity]
board/tqc/tqm8xx/u-boot.lds [moved from board/tqm8xx/u-boot.lds with 100% similarity]
board/tqc/tqm8xx/u-boot.lds.debug [moved from board/tqm8xx/u-boot.lds.debug with 100% similarity]
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/w7o/w7o.c
board/xilinx/ml300/init.S
board/zeus/zeus.c
common/Makefile
common/cmd_df.c [new file with mode: 0644]
common/cmd_log.c
common/cmd_nand.c
common/cmd_nvedit.c
common/cmd_sf.c [new file with mode: 0644]
common/cmd_spi.c
common/dlmalloc.c
common/env_common.c
common/env_nand.c
common/env_sf.c [new file with mode: 0644]
common/image.c
common/lcd.c
common/main.c
common/soft_i2c.c
common/soft_spi.c
cpu/74xx_7xx/start.S
cpu/arm926ejs/at91sam9/config.mk
cpu/arm926ejs/at91sam9/u-boot.lds [moved from board/atmel/at91cap9adk/u-boot.lds with 100% similarity]
cpu/arm926ejs/at91sam9/usb.c
cpu/at32ap/Makefile
cpu/at32ap/at32ap700x/Makefile
cpu/at32ap/at32ap700x/clk.c [new file with mode: 0644]
cpu/at32ap/at32ap700x/gpio.c
cpu/at32ap/at32ap700x/sm.h [moved from cpu/at32ap/sm.h with 100% similarity]
cpu/at32ap/atmel_mci.c
cpu/at32ap/cpu.c
cpu/at32ap/entry.S [deleted file]
cpu/at32ap/exception.c
cpu/at32ap/hsdramc.c
cpu/at32ap/interrupts.c
cpu/at32ap/start.S
cpu/mips/cpu.c
cpu/mpc512x/traps.c
cpu/mpc83xx/start.S
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.c
cpu/mpc86xx/cpu_init.c
cpu/mpc86xx/spd_sdram.c
cpu/mpc86xx/traps.c
cpu/nios/spi.c
cpu/ppc4xx/44x_spd_ddr.c
cpu/ppc4xx/44x_spd_ddr2.c
cpu/ppc4xx/4xx_uart.c
cpu/ppc4xx/Makefile
cpu/ppc4xx/commproc.c
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
disk/part.c
doc/README.mvblm7 [new file with mode: 0644]
drivers/hwmon/lm75.c
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/mtd/nand/nand_util.c
drivers/mtd/spi/Makefile [new file with mode: 0644]
drivers/mtd/spi/atmel.c [new file with mode: 0644]
drivers/mtd/spi/spi_flash.c [new file with mode: 0644]
drivers/mtd/spi/spi_flash_internal.h [new file with mode: 0644]
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
drivers/rtc/ds1306.c
drivers/rtc/mc13783-rtc.c
drivers/spi/Makefile
drivers/spi/atmel_spi.c [new file with mode: 0644]
drivers/spi/atmel_spi.h [new file with mode: 0644]
drivers/spi/mpc8xxx_spi.c
drivers/spi/mxc_spi.c
drivers/video/Makefile
drivers/video/atmel_lcdfb.c [new file with mode: 0644]
fs/jffs2/jffs2_1pass.c
include/ACEX1K.h
include/asm-arm/arch-at91sam9/at91_pmc.h
include/asm-arm/arch-at91sam9/at91cap9.h
include/asm-arm/arch-at91sam9/at91sam9261.h [new file with mode: 0644]
include/asm-arm/arch-at91sam9/at91sam9261_matrix.h [new file with mode: 0644]
include/asm-arm/arch-at91sam9/at91sam9263.h [new file with mode: 0644]
include/asm-arm/arch-at91sam9/at91sam9263_matrix.h [new file with mode: 0644]
include/asm-arm/arch-at91sam9/at91sam9rl.h [new file with mode: 0644]
include/asm-arm/arch-at91sam9/at91sam9rl_matrix.h [new file with mode: 0644]
include/asm-arm/arch-at91sam9/clk.h
include/asm-arm/arch-at91sam9/hardware.h
include/asm-avr32/arch-at32ap700x/chip-features.h
include/asm-avr32/arch-at32ap700x/clk.h
include/asm-avr32/arch-at32ap700x/gpio.h
include/asm-avr32/arch-at32ap700x/hmatrix.h [new file with mode: 0644]
include/asm-avr32/arch-at32ap700x/hmatrix2.h [deleted file]
include/asm-avr32/arch-at32ap700x/memory-map.h
include/asm-avr32/hmatrix-common.h [new file with mode: 0644]
include/asm-avr32/sdram.h
include/asm-avr32/sections.h
include/asm-avr32/u-boot.h
include/asm-mips/errno.h [new file with mode: 0644]
include/asm-mips/mipsregs.h
include/asm-ppc/bitops.h
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/mmu.h
include/asm-ppc/ppc4xx-sdram.h [new file with mode: 0644]
include/asm-ppc/processor.h
include/atmel_lcdc.h [new file with mode: 0644]
include/common.h
include/configs/Alaska8220.h
include/configs/BC3450.h
include/configs/CPCI4052.h
include/configs/CPCI405AB.h
include/configs/CPCI405DT.h
include/configs/CPCI750.h
include/configs/IceCube.h
include/configs/MPC8313ERDB.h
include/configs/MPC8315ERDB.h
include/configs/MPC8323ERDB.h
include/configs/MPC832XEMDS.h
include/configs/MPC8349EMDS.h
include/configs/MPC8349ITX.h
include/configs/MPC8360EMDS.h
include/configs/MPC8360ERDK.h
include/configs/MPC837XEMDS.h
include/configs/MPC837XERDB.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/PM520.h
include/configs/SBC8540.h
include/configs/TB5200.h
include/configs/TOP5200.h
include/configs/TQM5200.h
include/configs/TQM834x.h
include/configs/TQM85xx.h
include/configs/Total5200.h
include/configs/Yukon8220.h
include/configs/acadia.h
include/configs/ads5121.h
include/configs/aev.h
include/configs/alpr.h
include/configs/amcc-common.h [new file with mode: 0644]
include/configs/at91cap9adk.h
include/configs/at91sam9260ek.h
include/configs/at91sam9261ek.h [new file with mode: 0644]
include/configs/at91sam9263ek.h [new file with mode: 0644]
include/configs/at91sam9rlek.h [new file with mode: 0644]
include/configs/atngw100.h
include/configs/atstk1002.h
include/configs/atstk1003.h
include/configs/atstk1004.h
include/configs/atstk1006.h [new file with mode: 0644]
include/configs/bamboo.h
include/configs/bubinga.h
include/configs/canmb.h
include/configs/canyonlands.h
include/configs/cm5200.h
include/configs/cpci5200.h
include/configs/ebony.h
include/configs/hmi1001.h
include/configs/imx31_litekit.h
include/configs/inka4x0.h
include/configs/jupiter.h
include/configs/katmai.h
include/configs/kilauea.h
include/configs/luan.h
include/configs/makalu.h
include/configs/mcc200.h
include/configs/mecp5200.h
include/configs/motionpro.h
include/configs/mpc7448hpc2.h
include/configs/munices.h
include/configs/mx31ads.h
include/configs/o2dnt.h
include/configs/ocotea.h
include/configs/p3mx.h
include/configs/pf5200.h
include/configs/quad100hd.h [new file with mode: 0644]
include/configs/sbc8349.h
include/configs/sbc8560.h
include/configs/scb9328.h
include/configs/sequoia.h
include/configs/smmaco4.h
include/configs/socrates.h
include/configs/sorcery.h
include/configs/spieval.h
include/configs/stxgp3.h
include/configs/stxssa.h
include/configs/taihu.h
include/configs/taishan.h
include/configs/trizepsiv.h
include/configs/uc101.h
include/configs/v38b.h
include/configs/walnut.h
include/configs/yosemite.h
include/configs/yucca.h
include/lcd.h
include/linux/mtd/fsl_upm.h
include/linux/mtd/mtd-abi.h
include/linux/mtd/nand.h
include/logbuff.h
include/mpc83xx.h
include/mpc85xx.h
include/mpc86xx.h
include/onenand_uboot.h
include/pci_ids.h
include/ppc405.h
include/ppc440.h
include/ppc4xx.h
include/spi.h
include/spi_flash.h [new file with mode: 0644]
lib_arm/board.c
lib_avr32/memset.S
lib_generic/md5.c
lib_generic/sha1.c
lib_mips/board.c
lib_ppc/bat_rw.c
lib_ppc/board.c
lib_sh/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/eth.c
net/net.c
post/board/lwmon5/fpga.c
post/cpu/ppc4xx/uart.c
tools/Makefile
tools/logos/atmel.bmp [new file with mode: 0644]

index ce36c37c122e7a18a0ed0c5a9f9cd514083b9891..ccebd4ef58ee2c41907773eca7245a9e611da473 100644 (file)
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -7221,7 +7221,7 @@ Date:     Mon Mar 3 11:57:23 2008 +0000
     Originally pointed out by Laurent Pinchart <laurent.pinchart@tbox.biz>,
     see http://thread.gmane.org/gmane.comp.boot-loaders.u-boot/22846
 
-    Signed-off-by: Bernhard Nemec <bnemec <at> ganssloser.com>
+    Signed-off-by: Bernhard Nemec <bnemec@ganssloser.com>
 
 commit 84d0c2f1e39caff58bf765a7ab7c72da23c25ec8
 Author: Kim B. Heino <Kim.Heino@bluegiga.com>
@@ -8451,7 +8451,7 @@ Date:     Mon Feb 18 14:01:56 2008 -0600
     86xx: Convert sbc8641d to use libfdt.
 
     This is the proper fix for a missing closing brace in the function
-    ft_cpu_setup() noticed by joe.hamman <at> embeddedspecialties.com.
+    ft_cpu_setup() noticed by joe.hamman@embeddedspecialties.com.
     The ft_cpu_setup() function in mpc8641hpcn.c should have been
     removed earlier as it was under the obsolete CONFIG_OF_FLAT_TREE,
     but was missed.  Only, the sbc8641d was nominally still using it.
@@ -8846,7 +8846,7 @@ Date:     Fri Feb 22 11:40:50 2008 +0000
 
     We already have a vendor subdir for Atmel, so we should use it.
 
-    Signed-off-by: Haavard Skinnemoen <hskinnemoen <at> atmel.com>
+    Signed-off-by: Haavard Skinnemoen <hskinnemoen@atmel.com>
 
 commit 6d0943a6be99977d6d853d51749e9963d68eb192
 Author: Andreas Engel <andreas.engel@ericsson.com>
@@ -8896,8 +8896,8 @@ Date:     Thu Jan 3 21:15:56 2008 +0000
 
     AT91CAP9 support : MACB changes
 
-    Signed-off-by: Stelian Pop <stelian <at> popies.net>
-    Acked-by: Haavard Skinnemoen <hskinnemoen <at> atmel.com>
+    Signed-off-by: Stelian Pop <stelian@popies.net>
+    Acked-by: Haavard Skinnemoen <hskinnemoen@atmel.com>
 
 commit 6afcabf11d7321850f4feaadfee841488ace54c5
 Author: Stelian Pop <stelian@popies.net>
@@ -8913,7 +8913,7 @@ Date:     Wed Jan 30 21:15:54 2008 +0000
 
     AT91CAP9 support : cpu/ files
 
-    Signed-off-by: Stelian Pop <stelian <at> popies.net>
+    Signed-off-by: Stelian Pop <stelian@popies.net>
 
 commit fa506a926cec348805143576c941f8e61b333cc0
 Author: Stelian Pop <stelian@popies.net>
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 ac7572cfc17eca3b007b73f12df681209e07bffa..357cab3e857d93b662a2adaa17fa1d2ce8b12767 100644 (file)
@@ -204,6 +204,10 @@ Klaus Heydeck <heydeck@kieback-peter.de>
        KUP4K                   MPC855
        KUP4X                   MPC859
 
+Gary Jennejohn <garyj@denx.de>
+
+       quad100hd               PPC405EP
+
 Murray Jensen <Murray.Jensen@csiro.au>
 
        cogent_mpc8xx           MPC8xx
@@ -367,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
@@ -538,6 +546,9 @@ Stelian Pop <stelian.pop@leadtechdesign.com>
 
        at91cap9adk             ARM926EJS (AT91CAP9 SoC)
        at91sam9260ek           ARM926EJS (AT91SAM9260 SoC)
+       at91sam9261ek           ARM926EJS (AT91SAM9261 SoC)
+       at91sam9263ek           ARM926EJS (AT91SAM9263 SoC)
+       at91sam9rlek            ARM926EJS (AT91SAM9RL SoC)
 
 Stefan Roese <sr@denx.de>
 
@@ -695,6 +706,7 @@ Haavard Skinnemoen <hskinnemoen@atmel.com>
        ATSTK1002               AT32AP7000
        ATSTK1003               AT32AP7001
        ATSTK1004               AT32AP7002
+       ATSTK1006               AT32AP7000
        ATNGW100                AT32AP7000
 
 #########################################################################
diff --git a/MAKEALL b/MAKEALL
index 067406909a277aa6737034ef72cfdfdf5fb81e1c..8a0233cca22b5d9e3bb7173e3a7d95b8069d8c26 100755 (executable)
--- a/MAKEALL
+++ b/MAKEALL
@@ -219,6 +219,7 @@ LIST_4xx="          \
        PMC405          \
        PMC440          \
        PPChameleonEVB  \
+       quad100hd       \
        rainier         \
        sbc405          \
        sc3             \
@@ -330,6 +331,7 @@ LIST_83xx="         \
        MPC8360ERDK_66  \
        MPC837XEMDS     \
        MPC837XERDB     \
+       MVBLM7          \
        sbc8349         \
        TQM834x         \
 "
@@ -359,6 +361,7 @@ LIST_85xx="         \
        stxssa          \
        TQM8540         \
        TQM8541         \
+       TQM8548         \
        TQM8555         \
        TQM8560         \
 "
@@ -461,6 +464,9 @@ LIST_ARM9="                 \
        at91cap9adk             \
        at91rm9200dk            \
        at91sam9260ek           \
+       at91sam9261ek           \
+       at91sam9263ek           \
+       at91sam9rlek            \
        cmc_pu2                 \
        ap920t                  \
        ap922_XA10              \
@@ -520,6 +526,24 @@ LIST_ARM11="               \
        mx31ads         \
 "
 
+#########################################################################
+## AT91 Systems
+#########################################################################
+
+LIST_at91="            \
+       at91cap9adk     \
+       at91rm9200dk    \
+       at91sam9260ek   \
+       at91sam9261ek   \
+       at91sam9263ek   \
+       at91sam9rlek    \
+       cmc_pu2         \
+       csb637          \
+       kb9202          \
+       mp2usb          \
+       m501sk          \
+"
+
 #########################################################################
 ## Xscale Systems
 #########################################################################
@@ -697,6 +721,7 @@ LIST_avr32="                \
        atstk1002       \
        atstk1003       \
        atstk1004       \
+       atstk1006       \
        atngw100        \
 "
 
@@ -765,7 +790,7 @@ build_target() {
 for arg in $@
 do
        case "$arg" in
-       arm|SA|ARM7|ARM9|ARM10|ARM11|ixp|pxa \
+       arm|SA|ARM7|ARM9|ARM10|ARM11|at91|ixp|pxa \
        |avr32 \
        |blackfin \
        |coldfire \
index 3401203bad5c3b94e2cd33a2711729a2588ac6e6..ac129e46c263d4bb73d836775d47603d23609004 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -224,6 +224,7 @@ LIBS += drivers/mtd/libmtd.a
 LIBS += drivers/mtd/nand/libnand.a
 LIBS += drivers/mtd/nand_legacy/libnand_legacy.a
 LIBS += drivers/mtd/onenand/libonenand.a
+LIBS += drivers/mtd/spi/libspi_flash.a
 LIBS += drivers/net/libnet.a
 LIBS += drivers/net/sk98lin/libsk98lin.a
 LIBS += drivers/pci/libpci.a
@@ -390,6 +391,7 @@ TAG_SUBDIRS += drivers/mtd
 TAG_SUBDIRS += drivers/mtd/nand
 TAG_SUBDIRS += drivers/mtd/nand_legacy
 TAG_SUBDIRS += drivers/mtd/onenand
+TAG_SUBDIRS += drivers/mtd/spi
 TAG_SUBDIRS += drivers/net
 TAG_SUBDIRS += drivers/net/sk98lin
 TAG_SUBDIRS += drivers/pci
@@ -484,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
@@ -638,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
@@ -653,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        \
@@ -702,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 ; \
@@ -735,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
@@ -828,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
@@ -1057,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
@@ -1107,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
@@ -1128,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
@@ -1391,6 +1393,9 @@ PPChameleonEVB_HI_33_config:      unconfig
                }
        @$(MKCONFIG) -a $(call xtract_4xx,$@) ppc ppc4xx PPChameleonEVB dave
 
+quad100hd_config:      unconfig
+       @$(MKCONFIG) $(@:_config=) ppc ppc4xx quad100hd
+
 sbc405_config: unconfig
        @$(MKCONFIG) $(@:_config=) ppc ppc4xx sbc405
 
@@ -1779,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
@@ -2102,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
 
 
 #########################################################################
@@ -2225,6 +2233,7 @@ stxssa_4M_config: unconfig
 
 TQM8540_config         \
 TQM8541_config         \
+TQM8548_config         \
 TQM8555_config         \
 TQM8560_config:                unconfig
        @mkdir -p $(obj)include
@@ -2233,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
@@ -2335,6 +2343,15 @@ shannon_config   :       unconfig
 at91rm9200dk_config    :       unconfig
        @$(MKCONFIG) $(@:_config=) arm arm920t at91rm9200dk atmel at91rm9200
 
+at91sam9261ek_config   :       unconfig
+       @$(MKCONFIG) $(@:_config=) arm arm926ejs at91sam9261ek atmel at91sam9
+
+at91sam9263ek_config   :       unconfig
+       @$(MKCONFIG) $(@:_config=) arm arm926ejs at91sam9263ek atmel at91sam9
+
+at91sam9rlek_config    :       unconfig
+       @$(MKCONFIG) $(@:_config=) arm arm926ejs at91sam9rlek atmel at91sam9
+
 cmc_pu2_config :       unconfig
        @$(MKCONFIG) $(@:_config=) arm arm920t cmc_pu2 NULL at91rm9200
 
@@ -2879,6 +2896,9 @@ atstk1003_config  :       unconfig
 atstk1004_config       :       unconfig
        @$(MKCONFIG) $(@:_config=) avr32 at32ap atstk1000 atmel at32ap700x
 
+atstk1006_config       :       unconfig
+       @$(MKCONFIG) $(@:_config=) avr32 at32ap atstk1000 atmel at32ap700x
+
 atngw100_config        :       unconfig
        @$(MKCONFIG) $(@:_config=) avr32 at32ap atngw100 atmel at32ap700x
 
diff --git a/README b/README
index f14fb7bad2a6a0427da196528a6d17e0d642d389..40ce961c7d5fd7aa1ba47a08e7b44e7007283961 100644 (file)
--- a/README
+++ b/README
@@ -786,6 +786,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
@@ -961,6 +976,10 @@ The following options need to be configured:
                display); also select one of the supported displays
                by defining one of these:
 
+               CONFIG_ATMEL_LCD:
+
+                       HITACHI TX09D70VM1CCA, 3.5", 240x320.
+
                CONFIG_NEC_NL6448AC33:
 
                        NEC NL6448AC33-18. Active, color, single scan.
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 eedde597b81cc1e7024b7f67314a7d39afa0ce66..e4fdf4ae74ab9463ef4f6bcdfc9308cd9d661606 100644 (file)
@@ -165,16 +165,20 @@ unsigned char spi_read(void)
        return (unsigned char)gpio_read_in_bit(SPI_DIN_GPIO15);
 }
 
-void taihu_spi_chipsel(int cs)
+int spi_cs_is_valid(unsigned int bus, unsigned int cs)
 {
-       gpio_write_bit(SPI_CS_GPIO0, cs);
+       return bus == 0 && cs == 0;
 }
 
-spi_chipsel_type spi_chipsel[]= {
-       taihu_spi_chipsel
-};
+void spi_cs_activate(struct spi_slave *slave)
+{
+       gpio_write_bit(SPI_CS_GPIO0, 1);
+}
 
-int spi_chipsel_cnt = sizeof(spi_chipsel) / sizeof(spi_chipsel[0]);
+void spi_cs_deactivate(struct spi_slave *slave)
+{
+       gpio_write_bit(SPI_CS_GPIO0, 0);
+}
 
 #ifdef CONFIG_PCI
 static unsigned char int_lines[32] = {
@@ -196,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 e33af76c0250173004561be780a0a03c4f1081c6..f2b9c12ada6185294b2f88ea9a22bfd8c0996e80 100644 (file)
@@ -2,6 +2,10 @@
 # (C) Copyright 2003-2008
 # Wolfgang Denk, DENX Software Engineering, wd@denx.de.
 #
+# (C) Copyright 2008
+# Stelian Pop <stelian.pop@leadtechdesign.com>
+# Lead Tech Design <www.leadtechdesign.com>
+#
 # See file CREDITS for list of people who contributed to this
 # project.
 #
index 5de52b9197e6939a3eb3626606fda1fafdac9d86..a3eaf1922412a7e603b852417257367c615fe2d8 100644 (file)
@@ -30,6 +30,8 @@
 #include <asm/arch/at91_rstc.h>
 #include <asm/arch/gpio.h>
 #include <asm/arch/io.h>
+#include <lcd.h>
+#include <atmel_lcdc.h>
 #if defined(CONFIG_RESET_PHY_R) && defined(CONFIG_MACB)
 #include <net.h>
 #endif
@@ -70,6 +72,33 @@ static void at91cap9_serial_hw_init(void)
 #endif
 }
 
+static void at91cap9_slowclock_hw_init(void)
+{
+       /*
+        * On AT91CAP9 revC CPUs, the slow clock can be based on an
+        * internal impreciseRC oscillator or an external 32kHz oscillator.
+        * Switch to the latter.
+        */
+#define ARCH_ID_AT91CAP9_REVB  0x399
+#define ARCH_ID_AT91CAP9_REVC  0x601
+       if (at91_sys_read(AT91_PMC_VER) == ARCH_ID_AT91CAP9_REVC) {
+               unsigned i, tmp = at91_sys_read(AT91_SCKCR);
+               if ((tmp & AT91CAP9_SCKCR_OSCSEL) == AT91CAP9_SCKCR_OSCSEL_RC) {
+                       extern void timer_init(void);
+                       timer_init();
+                       tmp |= AT91CAP9_SCKCR_OSC32EN;
+                       at91_sys_write(AT91_SCKCR, tmp);
+                       for (i = 0; i < 1200; i++)
+                               udelay(1000);
+                       tmp |= AT91CAP9_SCKCR_OSCSEL_32;
+                       at91_sys_write(AT91_SCKCR, tmp);
+                       udelay(200);
+                       tmp &= ~AT91CAP9_SCKCR_RCEN;
+                       at91_sys_write(AT91_SCKCR, tmp);
+               }
+       }
+}
+
 static void at91cap9_nor_hw_init(void)
 {
        unsigned long csa;
@@ -116,7 +145,12 @@ static void at91cap9_nand_hw_init(void)
        at91_sys_write(AT91_SMC_MODE(3),
                       AT91_SMC_READMODE | AT91_SMC_WRITEMODE |
                       AT91_SMC_EXNWMODE_DISABLE |
-                      AT91_SMC_DBW_8 | AT91_SMC_TDF_(1));
+#ifdef CFG_NAND_DBW_16
+                      AT91_SMC_DBW_16 |
+#else /* CFG_NAND_DBW_8 */
+                      AT91_SMC_DBW_8 |
+#endif
+                      AT91_SMC_TDF_(1));
 
        at91_sys_write(AT91_PMC_PCER, 1 << AT91CAP9_ID_PIOABCD);
 
@@ -228,6 +262,65 @@ static void at91cap9_uhp_hw_init(void)
 }
 #endif
 
+#ifdef CONFIG_LCD
+vidinfo_t panel_info = {
+       vl_col:         240,
+       vl_row:         320,
+       vl_clk:         4965000,
+       vl_sync:        ATMEL_LCDC_INVLINE_INVERTED |
+                       ATMEL_LCDC_INVFRAME_INVERTED,
+       vl_bpix:        3,
+       vl_tft:         1,
+       vl_hsync_len:   5,
+       vl_left_margin: 1,
+       vl_right_margin:33,
+       vl_vsync_len:   1,
+       vl_upper_margin:1,
+       vl_lower_margin:0,
+       mmio:           AT91CAP9_LCDC_BASE,
+};
+
+void lcd_enable(void)
+{
+       at91_set_gpio_value(AT91_PIN_PC0, 0);  /* power up */
+}
+
+void lcd_disable(void)
+{
+       at91_set_gpio_value(AT91_PIN_PC0, 1);  /* power down */
+}
+
+static void at91cap9_lcd_hw_init(void)
+{
+       at91_set_A_periph(AT91_PIN_PC1, 0);     /* LCDHSYNC */
+       at91_set_A_periph(AT91_PIN_PC2, 0);     /* LCDDOTCK */
+       at91_set_A_periph(AT91_PIN_PC3, 0);     /* LCDDEN */
+       at91_set_B_periph(AT91_PIN_PB9, 0);     /* LCDCC */
+       at91_set_A_periph(AT91_PIN_PC6, 0);     /* LCDD2 */
+       at91_set_A_periph(AT91_PIN_PC7, 0);     /* LCDD3 */
+       at91_set_A_periph(AT91_PIN_PC8, 0);     /* LCDD4 */
+       at91_set_A_periph(AT91_PIN_PC9, 0);     /* LCDD5 */
+       at91_set_A_periph(AT91_PIN_PC10, 0);    /* LCDD6 */
+       at91_set_A_periph(AT91_PIN_PC11, 0);    /* LCDD7 */
+       at91_set_A_periph(AT91_PIN_PC14, 0);    /* LCDD10 */
+       at91_set_A_periph(AT91_PIN_PC15, 0);    /* LCDD11 */
+       at91_set_A_periph(AT91_PIN_PC16, 0);    /* LCDD12 */
+       at91_set_A_periph(AT91_PIN_PC17, 0);    /* LCDD13 */
+       at91_set_A_periph(AT91_PIN_PC18, 0);    /* LCDD14 */
+       at91_set_A_periph(AT91_PIN_PC19, 0);    /* LCDD15 */
+       at91_set_A_periph(AT91_PIN_PC22, 0);    /* LCDD18 */
+       at91_set_A_periph(AT91_PIN_PC23, 0);    /* LCDD19 */
+       at91_set_A_periph(AT91_PIN_PC24, 0);    /* LCDD20 */
+       at91_set_A_periph(AT91_PIN_PC25, 0);    /* LCDD21 */
+       at91_set_A_periph(AT91_PIN_PC26, 0);    /* LCDD22 */
+       at91_set_A_periph(AT91_PIN_PC27, 0);    /* LCDD23 */
+
+       at91_sys_write(AT91_PMC_PCER, 1 << AT91CAP9_ID_LCDC);
+
+       gd->fb_base = 0;
+}
+#endif
+
 int board_init(void)
 {
        /* Enable Ctrlc */
@@ -239,6 +332,7 @@ int board_init(void)
        gd->bd->bi_boot_params = PHYS_SDRAM + 0x100;
 
        at91cap9_serial_hw_init();
+       at91cap9_slowclock_hw_init();
        at91cap9_nor_hw_init();
 #ifdef CONFIG_CMD_NAND
        at91cap9_nand_hw_init();
@@ -252,7 +346,9 @@ int board_init(void)
 #ifdef CONFIG_USB_OHCI_NEW
        at91cap9_uhp_hw_init();
 #endif
-
+#ifdef CONFIG_LCD
+       at91cap9_lcd_hw_init();
+#endif
        return 0;
 }
 
index 28091a4226f5a970aa7d0f2b0ab696480ba445f2..0432ef13d8525253d382c277b103ccc0862a2937 100644 (file)
@@ -63,6 +63,9 @@ static void at91cap9adk_nand_hwcontrol(struct mtd_info *mtd, int cmd)
 int board_nand_init(struct nand_chip *nand)
 {
        nand->eccmode = NAND_ECC_SOFT;
+#ifdef CFG_NAND_DBW_16
+       nand->options = NAND_BUSWIDTH_16;
+#endif
        nand->hwcontrol = at91cap9adk_nand_hwcontrol;
        nand->chip_delay = 20;
 
index e6e4082c73beaba61a3d599d5de30731f52e22e7..f93540a02e1686a27d96de9fd60459f3107027e4 100644 (file)
@@ -2,6 +2,10 @@
 # (C) Copyright 2003-2008
 # Wolfgang Denk, DENX Software Engineering, wd@denx.de.
 #
+# (C) Copyright 2008
+# Stelian Pop <stelian.pop@leadtechdesign.com>
+# Lead Tech Design <www.leadtechdesign.com>
+#
 # See file CREDITS for list of people who contributed to this
 # project.
 #
index b30aad8373e7d65597f696313faeec2c0630c1e1..ef4d486be57309dcb77ed168e59cf6a5b04cff41 100644 (file)
@@ -90,7 +90,12 @@ static void at91sam9260ek_nand_hw_init(void)
        at91_sys_write(AT91_SMC_MODE(3),
                       AT91_SMC_READMODE | AT91_SMC_WRITEMODE |
                       AT91_SMC_EXNWMODE_DISABLE |
-                      AT91_SMC_DBW_8 | AT91_SMC_TDF_(2));
+#ifdef CFG_NAND_DBW_16
+                      AT91_SMC_DBW_16 |
+#else /* CFG_NAND_DBW_8 */
+                      AT91_SMC_DBW_8 |
+#endif
+                      AT91_SMC_TDF_(2));
 
        at91_sys_write(AT91_PMC_PCER, 1 << AT91SAM9260_ID_PIOC);
 
index 7c1e6abd9a3c70eb60aee8958cf632ed351207ec..9738f0fd48a8576b5e0b06db212fc59ab29c5a2e 100644 (file)
@@ -68,6 +68,9 @@ static int at91sam9260ek_nand_ready(struct mtd_info *mtd)
 int board_nand_init(struct nand_chip *nand)
 {
        nand->eccmode = NAND_ECC_SOFT;
+#ifdef CFG_NAND_DBW_16
+       nand->options = NAND_BUSWIDTH_16;
+#endif
        nand->hwcontrol = at91sam9260ek_nand_hwcontrol;
        nand->dev_ready = at91sam9260ek_nand_ready;
        nand->chip_delay = 20;
diff --git a/board/atmel/at91sam9260ek/u-boot.lds b/board/atmel/at91sam9260ek/u-boot.lds
deleted file mode 100644 (file)
index 996f401..0000000
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * (C) Copyright 2002
- * Gary Jennejohn, DENX Software Engineering, <gj@denx.de>
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-
-OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm")
-/*OUTPUT_FORMAT("elf32-arm", "elf32-arm", "elf32-arm")*/
-OUTPUT_ARCH(arm)
-ENTRY(_start)
-SECTIONS
-{
-       . = 0x00000000;
-
-       . = ALIGN(4);
-       .text :
-       {
-         cpu/arm926ejs/start.o (.text)
-         *(.text)
-       }
-
-       . = ALIGN(4);
-       .rodata : { *(.rodata) }
-
-       . = ALIGN(4);
-       .data : { *(.data) }
-
-       . = ALIGN(4);
-       .got : { *(.got) }
-
-       . = .;
-       __u_boot_cmd_start = .;
-       .u_boot_cmd : { *(.u_boot_cmd) }
-       __u_boot_cmd_end = .;
-
-       . = ALIGN(4);
-       __bss_start = .;
-       .bss : { *(.bss) }
-       _end = .;
-}
diff --git a/board/atmel/at91sam9261ek/Makefile b/board/atmel/at91sam9261ek/Makefile
new file mode 100644 (file)
index 0000000..7702a9c
--- /dev/null
@@ -0,0 +1,57 @@
+#
+# (C) Copyright 2003-2008
+# Wolfgang Denk, DENX Software Engineering, wd@denx.de.
+#
+# (C) Copyright 2008
+# Stelian Pop <stelian.pop@leadtechdesign.com>
+# Lead Tech Design <www.leadtechdesign.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 $(TOPDIR)/config.mk
+
+LIB    = $(obj)lib$(BOARD).a
+
+COBJS-y += at91sam9261ek.o
+COBJS-y += led.o
+COBJS-y        += partition.o
+COBJS-$(CONFIG_CMD_NAND) += nand.o
+
+SRCS   := $(SOBJS:.o=.S) $(COBJS-y:.o=.c)
+OBJS   := $(addprefix $(obj),$(COBJS-y))
+SOBJS  := $(addprefix $(obj),$(SOBJS))
+
+$(LIB):        $(obj).depend $(OBJS) $(SOBJS)
+       $(AR) $(ARFLAGS) $@ $(OBJS) $(SOBJS)
+
+clean:
+       rm -f $(SOBJS) $(OBJS)
+
+distclean:     clean
+       rm -f $(LIB) core *.bak .depend
+
+#########################################################################
+
+# defines $(obj).depend target
+include $(SRCTREE)/rules.mk
+
+sinclude $(obj).depend
+
+#########################################################################
diff --git a/board/atmel/at91sam9261ek/at91sam9261ek.c b/board/atmel/at91sam9261ek/at91sam9261ek.c
new file mode 100644 (file)
index 0000000..3de234c
--- /dev/null
@@ -0,0 +1,258 @@
+/*
+ * (C) Copyright 2007-2008
+ * Stelian Pop <stelian.pop@leadtechdesign.com>
+ * Lead Tech Design <www.leadtechdesign.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 <asm/arch/at91sam9261.h>
+#include <asm/arch/at91sam9261_matrix.h>
+#include <asm/arch/at91sam9_smc.h>
+#include <asm/arch/at91_pmc.h>
+#include <asm/arch/at91_rstc.h>
+#include <asm/arch/gpio.h>
+#include <asm/arch/io.h>
+#include <lcd.h>
+#include <atmel_lcdc.h>
+#if defined(CONFIG_RESET_PHY_R) && defined(CONFIG_DRIVER_DM9000)
+#include <net.h>
+#endif
+
+DECLARE_GLOBAL_DATA_PTR;
+
+/* ------------------------------------------------------------------------- */
+/*
+ * Miscelaneous platform dependent initialisations
+ */
+
+static void at91sam9261ek_serial_hw_init(void)
+{
+#ifdef CONFIG_USART0
+       at91_set_A_periph(AT91_PIN_PC8, 1);             /* TXD0 */
+       at91_set_A_periph(AT91_PIN_PC9, 0);             /* RXD0 */
+       at91_sys_write(AT91_PMC_PCER, 1 << AT91_ID_US0);
+#endif
+
+#ifdef CONFIG_USART1
+       at91_set_A_periph(AT91_PIN_PC12, 1);            /* TXD1 */
+       at91_set_A_periph(AT91_PIN_PC13, 0);            /* RXD1 */
+       at91_sys_write(AT91_PMC_PCER, 1 << AT91_ID_US1);
+#endif
+
+#ifdef CONFIG_USART2
+       at91_set_A_periph(AT91_PIN_PC14, 1);            /* TXD2 */
+       at91_set_A_periph(AT91_PIN_PC15, 0);            /* RXD2 */
+       at91_sys_write(AT91_PMC_PCER, 1 << AT91_ID_US2);
+#endif
+
+#ifdef CONFIG_USART3   /* DBGU */
+       at91_set_A_periph(AT91_PIN_PA9, 0);             /* DRXD */
+       at91_set_A_periph(AT91_PIN_PA10, 1);            /* DTXD */
+       at91_sys_write(AT91_PMC_PCER, 1 << AT91_ID_SYS);
+#endif
+}
+
+#ifdef CONFIG_CMD_NAND
+static void at91sam9261ek_nand_hw_init(void)
+{
+       unsigned long csa;
+
+       /* Enable CS3 */
+       csa = at91_sys_read(AT91_MATRIX_EBICSA);
+       at91_sys_write(AT91_MATRIX_EBICSA,
+                      csa | AT91_MATRIX_CS3A_SMC_SMARTMEDIA);
+
+       /* Configure SMC CS3 for NAND/SmartMedia */
+       at91_sys_write(AT91_SMC_SETUP(3),
+                      AT91_SMC_NWESETUP_(0) | AT91_SMC_NCS_WRSETUP_(0) |
+                      AT91_SMC_NRDSETUP_(0) | AT91_SMC_NCS_RDSETUP_(0));
+       at91_sys_write(AT91_SMC_PULSE(3),
+                      AT91_SMC_NWEPULSE_(2) | AT91_SMC_NCS_WRPULSE_(5) |
+                      AT91_SMC_NRDPULSE_(2) | AT91_SMC_NCS_RDPULSE_(5));
+       at91_sys_write(AT91_SMC_CYCLE(3),
+                      AT91_SMC_NWECYCLE_(7) | AT91_SMC_NRDCYCLE_(7));
+       at91_sys_write(AT91_SMC_MODE(3),
+                      AT91_SMC_READMODE | AT91_SMC_WRITEMODE |
+                      AT91_SMC_EXNWMODE_DISABLE |
+#ifdef CFG_NAND_DBW_16
+                      AT91_SMC_DBW_16 |
+#else /* CFG_NAND_DBW_8 */
+                      AT91_SMC_DBW_8 |
+#endif
+                      AT91_SMC_TDF_(1));
+
+       at91_sys_write(AT91_PMC_PCER, 1 << AT91SAM9261_ID_PIOC);
+
+       /* Configure RDY/BSY */
+       at91_set_gpio_input(AT91_PIN_PC15, 1);
+
+       /* Enable NandFlash */
+       at91_set_gpio_output(AT91_PIN_PC14, 1);
+
+       at91_set_A_periph(AT91_PIN_PC0, 0);     /* NANDOE */
+       at91_set_A_periph(AT91_PIN_PC1, 0);     /* NANDWE */
+}
+#endif
+
+#ifdef CONFIG_HAS_DATAFLASH
+static void at91sam9261ek_spi_hw_init(void)
+{
+       at91_set_A_periph(AT91_PIN_PA3, 0);     /* SPI0_NPCS0 */
+
+       at91_set_A_periph(AT91_PIN_PA0, 0);     /* SPI0_MISO */
+       at91_set_A_periph(AT91_PIN_PA1, 0);     /* SPI0_MOSI */
+       at91_set_A_periph(AT91_PIN_PA2, 0);     /* SPI0_SPCK */
+
+       /* Enable clock */
+       at91_sys_write(AT91_PMC_PCER, 1 << AT91SAM9261_ID_SPI0);
+}
+#endif
+
+#ifdef CONFIG_DRIVER_DM9000
+static void at91sam9261ek_dm9000_hw_init(void)
+{
+       /* Configure SMC CS2 for DM9000 */
+       at91_sys_write(AT91_SMC_SETUP(2),
+                      AT91_SMC_NWESETUP_(2) | AT91_SMC_NCS_WRSETUP_(0) |
+                      AT91_SMC_NRDSETUP_(2) | AT91_SMC_NCS_RDSETUP_(0));
+       at91_sys_write(AT91_SMC_PULSE(2),
+                      AT91_SMC_NWEPULSE_(4) | AT91_SMC_NCS_WRPULSE_(8) |
+                      AT91_SMC_NRDPULSE_(4) | AT91_SMC_NCS_RDPULSE_(8));
+       at91_sys_write(AT91_SMC_CYCLE(2),
+                      AT91_SMC_NWECYCLE_(16) | AT91_SMC_NRDCYCLE_(16));
+       at91_sys_write(AT91_SMC_MODE(2),
+                      AT91_SMC_READMODE | AT91_SMC_WRITEMODE |
+                      AT91_SMC_EXNWMODE_DISABLE |
+                      AT91_SMC_BAT_WRITE | AT91_SMC_DBW_16 |
+                      AT91_SMC_TDF_(1));
+
+       /* Configure Reset signal as output */
+       at91_set_gpio_output(AT91_PIN_PC10, 0);
+
+       /* Configure Interrupt pin as input, no pull-up */
+       at91_set_gpio_input(AT91_PIN_PC11, 0);
+}
+#endif
+
+#ifdef CONFIG_LCD
+vidinfo_t panel_info = {
+       vl_col:         240,
+       vl_row:         320,
+       vl_clk:         4965000,
+       vl_sync:        ATMEL_LCDC_INVLINE_INVERTED |
+                       ATMEL_LCDC_INVFRAME_INVERTED,
+       vl_bpix:        3,
+       vl_tft:         1,
+       vl_hsync_len:   5,
+       vl_left_margin: 1,
+       vl_right_margin:33,
+       vl_vsync_len:   1,
+       vl_upper_margin:1,
+       vl_lower_margin:0,
+       mmio:           AT91SAM9261_LCDC_BASE,
+};
+
+void lcd_enable(void)
+{
+       at91_set_gpio_value(AT91_PIN_PA12, 0);  /* power up */
+}
+
+void lcd_disable(void)
+{
+       at91_set_gpio_value(AT91_PIN_PA12, 1);  /* power down */
+}
+
+static void at91sam9261ek_lcd_hw_init(void)
+{
+       at91_set_A_periph(AT91_PIN_PB1, 0);     /* LCDHSYNC */
+       at91_set_A_periph(AT91_PIN_PB2, 0);     /* LCDDOTCK */
+       at91_set_A_periph(AT91_PIN_PB3, 0);     /* LCDDEN */
+       at91_set_A_periph(AT91_PIN_PB4, 0);     /* LCDCC */
+       at91_set_A_periph(AT91_PIN_PB7, 0);     /* LCDD2 */
+       at91_set_A_periph(AT91_PIN_PB8, 0);     /* LCDD3 */
+       at91_set_A_periph(AT91_PIN_PB9, 0);     /* LCDD4 */
+       at91_set_A_periph(AT91_PIN_PB10, 0);    /* LCDD5 */
+       at91_set_A_periph(AT91_PIN_PB11, 0);    /* LCDD6 */
+       at91_set_A_periph(AT91_PIN_PB12, 0);    /* LCDD7 */
+       at91_set_A_periph(AT91_PIN_PB15, 0);    /* LCDD10 */
+       at91_set_A_periph(AT91_PIN_PB16, 0);    /* LCDD11 */
+       at91_set_A_periph(AT91_PIN_PB17, 0);    /* LCDD12 */
+       at91_set_A_periph(AT91_PIN_PB18, 0);    /* LCDD13 */
+       at91_set_A_periph(AT91_PIN_PB19, 0);    /* LCDD14 */
+       at91_set_A_periph(AT91_PIN_PB20, 0);    /* LCDD15 */
+       at91_set_B_periph(AT91_PIN_PB23, 0);    /* LCDD18 */
+       at91_set_B_periph(AT91_PIN_PB24, 0);    /* LCDD19 */
+       at91_set_B_periph(AT91_PIN_PB25, 0);    /* LCDD20 */
+       at91_set_B_periph(AT91_PIN_PB26, 0);    /* LCDD21 */
+       at91_set_B_periph(AT91_PIN_PB27, 0);    /* LCDD22 */
+       at91_set_B_periph(AT91_PIN_PB28, 0);    /* LCDD23 */
+
+       at91_sys_write(AT91_PMC_SCER, AT91_PMC_HCK1);
+
+       gd->fb_base = AT91SAM9261_SRAM_BASE;
+}
+#endif
+
+int board_init(void)
+{
+       /* Enable Ctrlc */
+       console_init_f();
+
+       /* arch number of AT91SAM9261EK-Board */
+       gd->bd->bi_arch_number = MACH_TYPE_AT91SAM9261EK;
+       /* adress of boot parameters */
+       gd->bd->bi_boot_params = PHYS_SDRAM + 0x100;
+
+       at91sam9261ek_serial_hw_init();
+#ifdef CONFIG_CMD_NAND
+       at91sam9261ek_nand_hw_init();
+#endif
+#ifdef CONFIG_HAS_DATAFLASH
+       at91sam9261ek_spi_hw_init();
+#endif
+#ifdef CONFIG_DRIVER_DM9000
+       at91sam9261ek_dm9000_hw_init();
+#endif
+#ifdef CONFIG_LCD
+       at91sam9261ek_lcd_hw_init();
+#endif
+       return 0;
+}
+
+int dram_init(void)
+{
+       gd->bd->bi_dram[0].start = PHYS_SDRAM;
+       gd->bd->bi_dram[0].size = PHYS_SDRAM_SIZE;
+       return 0;
+}
+
+#ifdef CONFIG_RESET_PHY_R
+void reset_phy(void)
+{
+#ifdef CONFIG_DRIVER_DM9000
+       /*
+        * Initialize ethernet HW addr prior to starting Linux,
+        * needed for nfsroot
+        */
+       eth_init(gd->bd);
+#endif
+}
+#endif
diff --git a/board/atmel/at91sam9261ek/config.mk b/board/atmel/at91sam9261ek/config.mk
new file mode 100644 (file)
index 0000000..ff2cfd1
--- /dev/null
@@ -0,0 +1 @@
+TEXT_BASE = 0x23f00000
diff --git a/board/atmel/at91sam9261ek/led.c b/board/atmel/at91sam9261ek/led.c
new file mode 100644 (file)
index 0000000..eb2bb23
--- /dev/null
@@ -0,0 +1,78 @@
+/*
+ * (C) Copyright 2007-2008
+ * Stelian Pop <stelian.pop@leadtechdesign.com>
+ * Lead Tech Design <www.leadtechdesign.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 <asm/arch/at91sam9261.h>
+#include <asm/arch/at91_pmc.h>
+#include <asm/arch/gpio.h>
+#include <asm/arch/io.h>
+
+#define        RED_LED         AT91_PIN_PA23   /* this is the power led */
+#define        GREEN_LED       AT91_PIN_PA13   /* this is the user1 led */
+#define        YELLOW_LED      AT91_PIN_PA14   /* this is the user2 led */
+
+void red_LED_on(void)
+{
+       at91_set_gpio_value(RED_LED, 1);
+}
+
+void red_LED_off(void)
+{
+       at91_set_gpio_value(RED_LED, 0);
+}
+
+void green_LED_on(void)
+{
+       at91_set_gpio_value(GREEN_LED, 0);
+}
+
+void green_LED_off(void)
+{
+       at91_set_gpio_value(GREEN_LED, 1);
+}
+
+void yellow_LED_on(void)
+{
+       at91_set_gpio_value(YELLOW_LED, 0);
+}
+
+void yellow_LED_off(void)
+{
+       at91_set_gpio_value(YELLOW_LED, 1);
+}
+
+
+void coloured_LED_init(void)
+{
+       /* Enable clock */
+       at91_sys_write(AT91_PMC_PCER, 1 << AT91SAM9261_ID_PIOA);
+
+       at91_set_gpio_output(RED_LED, 1);
+       at91_set_gpio_output(GREEN_LED, 1);
+       at91_set_gpio_output(YELLOW_LED, 1);
+
+       at91_set_gpio_value(RED_LED, 0);
+       at91_set_gpio_value(GREEN_LED, 1);
+       at91_set_gpio_value(YELLOW_LED, 1);
+}
diff --git a/board/atmel/at91sam9261ek/nand.c b/board/atmel/at91sam9261ek/nand.c
new file mode 100644 (file)
index 0000000..35b26db
--- /dev/null
@@ -0,0 +1,79 @@
+/*
+ * (C) Copyright 2007-2008
+ * Stelian Pop <stelian.pop@leadtechdesign.com>
+ * Lead Tech Design <www.leadtechdesign.com>
+ *
+ * (C) Copyright 2006 ATMEL Rousset, Lacressonniere Nicolas
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+#include <common.h>
+#include <asm/arch/at91sam9261.h>
+#include <asm/arch/gpio.h>
+#include <asm/arch/at91_pio.h>
+
+#include <nand.h>
+
+/*
+ *     hardware specific access to control-lines
+ */
+#define        MASK_ALE        (1 << 22)       /* our ALE is AD22 */
+#define        MASK_CLE        (1 << 21)       /* our CLE is AD21 */
+
+static void at91sam9261ek_nand_hwcontrol(struct mtd_info *mtd, int cmd)
+{
+       struct nand_chip *this = mtd->priv;
+       ulong IO_ADDR_W = (ulong) this->IO_ADDR_W;
+
+       IO_ADDR_W &= ~(MASK_ALE|MASK_CLE);
+       switch (cmd) {
+       case NAND_CTL_SETCLE:
+               IO_ADDR_W |= MASK_CLE;
+               break;
+       case NAND_CTL_SETALE:
+               IO_ADDR_W |= MASK_ALE;
+               break;
+       case NAND_CTL_CLRNCE:
+               at91_set_gpio_value(AT91_PIN_PC14, 1);
+               break;
+       case NAND_CTL_SETNCE:
+               at91_set_gpio_value(AT91_PIN_PC14, 0);
+               break;
+       }
+       this->IO_ADDR_W = (void *) IO_ADDR_W;
+}
+
+static int at91sam9261ek_nand_ready(struct mtd_info *mtd)
+{
+       return at91_get_gpio_value(AT91_PIN_PC15);
+}
+
+int board_nand_init(struct nand_chip *nand)
+{
+       nand->eccmode = NAND_ECC_SOFT;
+#ifdef CFG_NAND_DBW_16
+       nand->options = NAND_BUSWIDTH_16;
+#endif
+       nand->hwcontrol = at91sam9261ek_nand_hwcontrol;
+       nand->dev_ready = at91sam9261ek_nand_ready;
+       nand->chip_delay = 20;
+
+       return 0;
+}
diff --git a/board/atmel/at91sam9261ek/partition.c b/board/atmel/at91sam9261ek/partition.c
new file mode 100644 (file)
index 0000000..975be17
--- /dev/null
@@ -0,0 +1,40 @@
+/*
+ * (C) Copyright 2008
+ * Ulf Samuelsson <ulf@atmel.com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ */
+#include <common.h>
+#include <config.h>
+#include <asm/hardware.h>
+#include <dataflash.h>
+
+AT91S_DATAFLASH_INFO dataflash_info[CFG_MAX_DATAFLASH_BANKS];
+
+struct dataflash_addr cs[CFG_MAX_DATAFLASH_BANKS] = {
+       {CFG_DATAFLASH_LOGIC_ADDR_CS0, 0},      /* Logical adress, CS */
+       {CFG_DATAFLASH_LOGIC_ADDR_CS3, 3}
+};
+
+/*define the area offsets*/
+dataflash_protect_t area_list[NB_DATAFLASH_AREA] = {
+       {0x00000000, 0x000041FF, FLAG_PROTECT_SET,   0, "Bootstrap"},
+       {0x00004200, 0x000083FF, FLAG_PROTECT_CLEAR, 0, "Environment"},
+       {0x00008400, 0x00041FFF, FLAG_PROTECT_SET,   0, "U-Boot"},
+       {0x00042000, 0x00251FFF, FLAG_PROTECT_CLEAR, 0, "Kernel"},
+       {0x00252000, 0xFFFFFFFF, FLAG_PROTECT_CLEAR, 0, "FS"},
+};
diff --git a/board/atmel/at91sam9263ek/Makefile b/board/atmel/at91sam9263ek/Makefile
new file mode 100644 (file)
index 0000000..5adb0bc
--- /dev/null
@@ -0,0 +1,57 @@
+#
+# (C) Copyright 2003-2008
+# Wolfgang Denk, DENX Software Engineering, wd@denx.de.
+#
+# (C) Copyright 2008
+# Stelian Pop <stelian.pop@leadtechdesign.com>
+# Lead Tech Design <www.leadtechdesign.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 $(TOPDIR)/config.mk
+
+LIB    = $(obj)lib$(BOARD).a
+
+COBJS-y += at91sam9263ek.o
+COBJS-y += led.o
+COBJS-y        += partition.o
+COBJS-$(CONFIG_CMD_NAND) += nand.o
+
+SRCS   := $(SOBJS:.o=.S) $(COBJS-y:.o=.c)
+OBJS   := $(addprefix $(obj),$(COBJS-y))
+SOBJS  := $(addprefix $(obj),$(SOBJS))
+
+$(LIB):        $(obj).depend $(OBJS) $(SOBJS)
+       $(AR) $(ARFLAGS) $@ $(OBJS) $(SOBJS)
+
+clean:
+       rm -f $(SOBJS) $(OBJS)
+
+distclean:     clean
+       rm -f $(LIB) core *.bak .depend
+
+#########################################################################
+
+# defines $(obj).depend target
+include $(SRCTREE)/rules.mk
+
+sinclude $(obj).depend
+
+#########################################################################
diff --git a/board/atmel/at91sam9263ek/at91sam9263ek.c b/board/atmel/at91sam9263ek/at91sam9263ek.c
new file mode 100644 (file)
index 0000000..ba7fc71
--- /dev/null
@@ -0,0 +1,305 @@
+/*
+ * (C) Copyright 2007-2008
+ * Stelian Pop <stelian.pop@leadtechdesign.com>
+ * Lead Tech Design <www.leadtechdesign.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 <asm/sizes.h>
+#include <asm/arch/at91sam9263.h>
+#include <asm/arch/at91sam9263_matrix.h>
+#include <asm/arch/at91sam9_smc.h>
+#include <asm/arch/at91_pmc.h>
+#include <asm/arch/at91_rstc.h>
+#include <asm/arch/gpio.h>
+#include <asm/arch/io.h>
+#include <lcd.h>
+#include <atmel_lcdc.h>
+#if defined(CONFIG_RESET_PHY_R) && defined(CONFIG_MACB)
+#include <net.h>
+#endif
+
+DECLARE_GLOBAL_DATA_PTR;
+
+/* ------------------------------------------------------------------------- */
+/*
+ * Miscelaneous platform dependent initialisations
+ */
+
+static void at91sam9263ek_serial_hw_init(void)
+{
+#ifdef CONFIG_USART0
+       at91_set_A_periph(AT91_PIN_PA26, 1);            /* TXD0 */
+       at91_set_A_periph(AT91_PIN_PA27, 0);            /* RXD0 */
+       at91_sys_write(AT91_PMC_PCER, 1 << AT91_ID_US0);
+#endif
+
+#ifdef CONFIG_USART1
+       at91_set_A_periph(AT91_PIN_PD0, 1);             /* TXD1 */
+       at91_set_A_periph(AT91_PIN_PD1, 0);             /* RXD1 */
+       at91_sys_write(AT91_PMC_PCER, 1 << AT91_ID_US1);
+#endif
+
+#ifdef CONFIG_USART2
+       at91_set_A_periph(AT91_PIN_PD2, 1);             /* TXD2 */
+       at91_set_A_periph(AT91_PIN_PD3, 0);             /* RXD2 */
+       at91_sys_write(AT91_PMC_PCER, 1 << AT91_ID_US2);
+#endif
+
+#ifdef CONFIG_USART3   /* DBGU */
+       at91_set_A_periph(AT91_PIN_PC30, 0);            /* DRXD */
+       at91_set_A_periph(AT91_PIN_PC31, 1);            /* DTXD */
+       at91_sys_write(AT91_PMC_PCER, 1 << AT91_ID_SYS);
+#endif
+}
+
+#ifdef CONFIG_CMD_NAND
+static void at91sam9263ek_nand_hw_init(void)
+{
+       unsigned long csa;
+
+       /* Enable CS3 */
+       csa = at91_sys_read(AT91_MATRIX_EBI0CSA);
+       at91_sys_write(AT91_MATRIX_EBI0CSA,
+                      csa | AT91_MATRIX_EBI0_CS3A_SMC_SMARTMEDIA);
+
+       /* Configure SMC CS3 for NAND/SmartMedia */
+       at91_sys_write(AT91_SMC_SETUP(3),
+                      AT91_SMC_NWESETUP_(0) | AT91_SMC_NCS_WRSETUP_(0) |
+                      AT91_SMC_NRDSETUP_(0) | AT91_SMC_NCS_RDSETUP_(0));
+       at91_sys_write(AT91_SMC_PULSE(3),
+                      AT91_SMC_NWEPULSE_(3) | AT91_SMC_NCS_WRPULSE_(3) |
+                      AT91_SMC_NRDPULSE_(3) | AT91_SMC_NCS_RDPULSE_(3));
+       at91_sys_write(AT91_SMC_CYCLE(3),
+                      AT91_SMC_NWECYCLE_(5) | AT91_SMC_NRDCYCLE_(5));
+       at91_sys_write(AT91_SMC_MODE(3),
+                      AT91_SMC_READMODE | AT91_SMC_WRITEMODE |
+                      AT91_SMC_EXNWMODE_DISABLE |
+#ifdef CFG_NAND_DBW_16
+                      AT91_SMC_DBW_16 |
+#else /* CFG_NAND_DBW_8 */
+                      AT91_SMC_DBW_8 |
+#endif
+                      AT91_SMC_TDF_(2));
+
+       at91_sys_write(AT91_PMC_PCER, 1 << AT91SAM9263_ID_PIOA |
+                                     1 << AT91SAM9263_ID_PIOCDE);
+
+       /* Configure RDY/BSY */
+       at91_set_gpio_input(AT91_PIN_PA22, 1);
+
+       /* Enable NandFlash */
+       at91_set_gpio_output(AT91_PIN_PD15, 1);
+}
+#endif
+
+#ifdef CONFIG_HAS_DATAFLASH
+static void at91sam9263ek_spi_hw_init(void)
+{
+       at91_set_B_periph(AT91_PIN_PA5, 0);     /* SPI0_NPCS0 */
+
+       at91_set_B_periph(AT91_PIN_PA0, 0);     /* SPI0_MISO */
+       at91_set_B_periph(AT91_PIN_PA1, 0);     /* SPI0_MOSI */
+       at91_set_B_periph(AT91_PIN_PA2, 0);     /* SPI0_SPCK */
+
+       /* Enable clock */
+       at91_sys_write(AT91_PMC_PCER, 1 << AT91SAM9263_ID_SPI0);
+}
+#endif
+
+#ifdef CONFIG_MACB
+static void at91sam9263ek_macb_hw_init(void)
+{
+       /* Enable clock */
+       at91_sys_write(AT91_PMC_PCER, 1 << AT91SAM9263_ID_EMAC);
+
+       /*
+        * Disable pull-up on:
+        *      RXDV (PC25) => PHY normal mode (not Test mode)
+        *      ERX0 (PE25) => PHY ADDR0
+        *      ERX1 (PE26) => PHY ADDR1 => PHYADDR = 0x0
+        *
+        * PHY has internal pull-down
+        */
+       writel(pin_to_mask(AT91_PIN_PC25),
+              pin_to_controller(AT91_PIN_PC0) + PIO_PUDR);
+       writel(pin_to_mask(AT91_PIN_PE25) |
+              pin_to_mask(AT91_PIN_PE26),
+              pin_to_controller(AT91_PIN_PE0) + PIO_PUDR);
+
+       /* Need to reset PHY -> 500ms reset */
+       at91_sys_write(AT91_RSTC_MR, AT91_RSTC_KEY |
+                                    AT91_RSTC_ERSTL | (0x0D << 8) |
+                                    AT91_RSTC_URSTEN);
+
+       at91_sys_write(AT91_RSTC_CR, AT91_RSTC_KEY | AT91_RSTC_EXTRST);
+
+       /* Wait for end hardware reset */
+       while (!(at91_sys_read(AT91_RSTC_SR) & AT91_RSTC_NRSTL));
+
+       /* Re-enable pull-up */
+       writel(pin_to_mask(AT91_PIN_PC25),
+              pin_to_controller(AT91_PIN_PC0) + PIO_PUER);
+       writel(pin_to_mask(AT91_PIN_PE25) |
+              pin_to_mask(AT91_PIN_PE26),
+              pin_to_controller(AT91_PIN_PE0) + PIO_PUER);
+
+       at91_set_A_periph(AT91_PIN_PE21, 0);    /* ETXCK_EREFCK */
+       at91_set_B_periph(AT91_PIN_PC25, 0);    /* ERXDV */
+       at91_set_A_periph(AT91_PIN_PE25, 0);    /* ERX0 */
+       at91_set_A_periph(AT91_PIN_PE26, 0);    /* ERX1 */
+       at91_set_A_periph(AT91_PIN_PE27, 0);    /* ERXER */
+       at91_set_A_periph(AT91_PIN_PE28, 0);    /* ETXEN */
+       at91_set_A_periph(AT91_PIN_PE23, 0);    /* ETX0 */
+       at91_set_A_periph(AT91_PIN_PE24, 0);    /* ETX1 */
+       at91_set_A_periph(AT91_PIN_PE30, 0);    /* EMDIO */
+       at91_set_A_periph(AT91_PIN_PE29, 0);    /* EMDC */
+
+#ifndef CONFIG_RMII
+       at91_set_A_periph(AT91_PIN_PE22, 0);    /* ECRS */
+       at91_set_B_periph(AT91_PIN_PC26, 0);    /* ECOL */
+       at91_set_B_periph(AT91_PIN_PC22, 0);    /* ERX2 */
+       at91_set_B_periph(AT91_PIN_PC23, 0);    /* ERX3 */
+       at91_set_B_periph(AT91_PIN_PC27, 0);    /* ERXCK */
+       at91_set_B_periph(AT91_PIN_PC20, 0);    /* ETX2 */
+       at91_set_B_periph(AT91_PIN_PC21, 0);    /* ETX3 */
+       at91_set_B_periph(AT91_PIN_PC24, 0);    /* ETXER */
+#endif
+
+}
+#endif
+
+#ifdef CONFIG_USB_OHCI_NEW
+static void at91sam9263ek_uhp_hw_init(void)
+{
+       /* Enable VBus on UHP ports */
+       at91_set_gpio_output(AT91_PIN_PA21, 0);
+       at91_set_gpio_output(AT91_PIN_PA24, 0);
+}
+#endif
+
+#ifdef CONFIG_LCD
+vidinfo_t panel_info = {
+       vl_col:         240,
+       vl_row:         320,
+       vl_clk:         4965000,
+       vl_sync:        ATMEL_LCDC_INVLINE_INVERTED |
+                       ATMEL_LCDC_INVFRAME_INVERTED,
+       vl_bpix:        3,
+       vl_tft:         1,
+       vl_hsync_len:   5,
+       vl_left_margin: 1,
+       vl_right_margin:33,
+       vl_vsync_len:   1,
+       vl_upper_margin:1,
+       vl_lower_margin:0,
+       mmio:           AT91SAM9263_LCDC_BASE,
+};
+
+void lcd_enable(void)
+{
+       at91_set_gpio_value(AT91_PIN_PA30, 1);  /* power up */
+}
+
+void lcd_disable(void)
+{
+       at91_set_gpio_value(AT91_PIN_PA30, 0);  /* power down */
+}
+
+static void at91sam9263ek_lcd_hw_init(void)
+{
+       at91_set_A_periph(AT91_PIN_PC1, 0);     /* LCDHSYNC */
+       at91_set_A_periph(AT91_PIN_PC2, 0);     /* LCDDOTCK */
+       at91_set_A_periph(AT91_PIN_PC3, 0);     /* LCDDEN */
+       at91_set_B_periph(AT91_PIN_PB9, 0);     /* LCDCC */
+       at91_set_A_periph(AT91_PIN_PC6, 0);     /* LCDD2 */
+       at91_set_A_periph(AT91_PIN_PC7, 0);     /* LCDD3 */
+       at91_set_A_periph(AT91_PIN_PC8, 0);     /* LCDD4 */
+       at91_set_A_periph(AT91_PIN_PC9, 0);     /* LCDD5 */
+       at91_set_A_periph(AT91_PIN_PC10, 0);    /* LCDD6 */
+       at91_set_A_periph(AT91_PIN_PC11, 0);    /* LCDD7 */
+       at91_set_A_periph(AT91_PIN_PC14, 0);    /* LCDD10 */
+       at91_set_A_periph(AT91_PIN_PC15, 0);    /* LCDD11 */
+       at91_set_A_periph(AT91_PIN_PC16, 0);    /* LCDD12 */
+       at91_set_B_periph(AT91_PIN_PC12, 0);    /* LCDD13 */
+       at91_set_A_periph(AT91_PIN_PC18, 0);    /* LCDD14 */
+       at91_set_A_periph(AT91_PIN_PC19, 0);    /* LCDD15 */
+       at91_set_A_periph(AT91_PIN_PC22, 0);    /* LCDD18 */
+       at91_set_A_periph(AT91_PIN_PC23, 0);    /* LCDD19 */
+       at91_set_A_periph(AT91_PIN_PC24, 0);    /* LCDD20 */
+       at91_set_B_periph(AT91_PIN_PC17, 0);    /* LCDD21 */
+       at91_set_A_periph(AT91_PIN_PC26, 0);    /* LCDD22 */
+       at91_set_A_periph(AT91_PIN_PC27, 0);    /* LCDD23 */
+
+       at91_sys_write(AT91_PMC_PCER, 1 << AT91SAM9263_ID_LCDC);
+
+       gd->fb_base = AT91SAM9263_SRAM0_BASE;
+}
+#endif
+
+int board_init(void)
+{
+       /* Enable Ctrlc */
+       console_init_f();
+
+       /* arch number of AT91SAM9263EK-Board */
+       gd->bd->bi_arch_number = MACH_TYPE_AT91SAM9263EK;
+       /* adress of boot parameters */
+       gd->bd->bi_boot_params = PHYS_SDRAM + 0x100;
+
+       at91sam9263ek_serial_hw_init();
+#ifdef CONFIG_CMD_NAND
+       at91sam9263ek_nand_hw_init();
+#endif
+#ifdef CONFIG_HAS_DATAFLASH
+       at91sam9263ek_spi_hw_init();
+#endif
+#ifdef CONFIG_MACB
+       at91sam9263ek_macb_hw_init();
+#endif
+#ifdef CONFIG_USB_OHCI_NEW
+       at91sam9263ek_uhp_hw_init();
+#endif
+#ifdef CONFIG_LCD
+       at91sam9263ek_lcd_hw_init();
+#endif
+       return 0;
+}
+
+int dram_init(void)
+{
+       gd->bd->bi_dram[0].start = PHYS_SDRAM;
+       gd->bd->bi_dram[0].size = PHYS_SDRAM_SIZE;
+       return 0;
+}
+
+#ifdef CONFIG_RESET_PHY_R
+void reset_phy(void)
+{
+#ifdef CONFIG_MACB
+       /*
+        * Initialize ethernet HW addr prior to starting Linux,
+        * needed for nfsroot
+        */
+       eth_init(gd->bd);
+#endif
+}
+#endif
diff --git a/board/atmel/at91sam9263ek/config.mk b/board/atmel/at91sam9263ek/config.mk
new file mode 100644 (file)
index 0000000..ff2cfd1
--- /dev/null
@@ -0,0 +1 @@
+TEXT_BASE = 0x23f00000
diff --git a/board/atmel/at91sam9263ek/led.c b/board/atmel/at91sam9263ek/led.c
new file mode 100644 (file)
index 0000000..eb8d6ca
--- /dev/null
@@ -0,0 +1,78 @@
+/*
+ * (C) Copyright 2007-2008
+ * Stelian Pop <stelian.pop@leadtechdesign.com>
+ * Lead Tech Design <www.leadtechdesign.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 <asm/arch/at91sam9263.h>
+#include <asm/arch/at91_pmc.h>
+#include <asm/arch/gpio.h>
+#include <asm/arch/io.h>
+
+#define        RED_LED         AT91_PIN_PB7    /* this is the power led */
+#define        GREEN_LED       AT91_PIN_PB8    /* this is the user1 led */
+#define        YELLOW_LED      AT91_PIN_PC29   /* this is the user2 led */
+
+void red_LED_on(void)
+{
+       at91_set_gpio_value(RED_LED, 1);
+}
+
+void red_LED_off(void)
+{
+       at91_set_gpio_value(RED_LED, 0);
+}
+
+void green_LED_on(void)
+{
+       at91_set_gpio_value(GREEN_LED, 0);
+}
+
+void green_LED_off(void)
+{
+       at91_set_gpio_value(GREEN_LED, 1);
+}
+
+void yellow_LED_on(void)
+{
+       at91_set_gpio_value(YELLOW_LED, 0);
+}
+
+void yellow_LED_off(void)
+{
+       at91_set_gpio_value(YELLOW_LED, 1);
+}
+
+void coloured_LED_init(void)
+{
+       /* Enable clock */
+       at91_sys_write(AT91_PMC_PCER, 1 << AT91SAM9263_ID_PIOB |
+                                     1 << AT91SAM9263_ID_PIOCDE);
+
+       at91_set_gpio_output(RED_LED, 1);
+       at91_set_gpio_output(GREEN_LED, 1);
+       at91_set_gpio_output(YELLOW_LED, 1);
+
+       at91_set_gpio_value(RED_LED, 0);
+       at91_set_gpio_value(GREEN_LED, 1);
+       at91_set_gpio_value(YELLOW_LED, 1);
+}
diff --git a/board/atmel/at91sam9263ek/nand.c b/board/atmel/at91sam9263ek/nand.c
new file mode 100644 (file)
index 0000000..5079972
--- /dev/null
@@ -0,0 +1,79 @@
+/*
+ * (C) Copyright 2007-2008
+ * Stelian Pop <stelian.pop@leadtechdesign.com>
+ * Lead Tech Design <www.leadtechdesign.com>
+ *
+ * (C) Copyright 2006 ATMEL Rousset, Lacressonniere Nicolas
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+#include <common.h>
+#include <asm/arch/at91sam9263.h>
+#include <asm/arch/gpio.h>
+#include <asm/arch/at91_pio.h>
+
+#include <nand.h>
+
+/*
+ *     hardware specific access to control-lines
+ */
+#define        MASK_ALE        (1 << 21)       /* our ALE is AD21 */
+#define        MASK_CLE        (1 << 22)       /* our CLE is AD22 */
+
+static void at91sam9263ek_nand_hwcontrol(struct mtd_info *mtd, int cmd)
+{
+       struct nand_chip *this = mtd->priv;
+       ulong IO_ADDR_W = (ulong) this->IO_ADDR_W;
+
+       IO_ADDR_W &= ~(MASK_ALE|MASK_CLE);
+       switch (cmd) {
+       case NAND_CTL_SETCLE:
+               IO_ADDR_W |= MASK_CLE;
+               break;
+       case NAND_CTL_SETALE:
+               IO_ADDR_W |= MASK_ALE;
+               break;
+       case NAND_CTL_CLRNCE:
+               at91_set_gpio_value(AT91_PIN_PD15, 1);
+               break;
+       case NAND_CTL_SETNCE:
+               at91_set_gpio_value(AT91_PIN_PD15, 0);
+               break;
+       }
+       this->IO_ADDR_W = (void *) IO_ADDR_W;
+}
+
+static int at91sam9263ek_nand_ready(struct mtd_info *mtd)
+{
+       return at91_get_gpio_value(AT91_PIN_PA22);
+}
+
+int board_nand_init(struct nand_chip *nand)
+{
+       nand->eccmode = NAND_ECC_SOFT;
+#ifdef CFG_NAND_DBW_16
+       nand->options = NAND_BUSWIDTH_16;
+#endif
+       nand->hwcontrol = at91sam9263ek_nand_hwcontrol;
+       nand->dev_ready = at91sam9263ek_nand_ready;
+       nand->chip_delay = 20;
+
+       return 0;
+}
diff --git a/board/atmel/at91sam9263ek/partition.c b/board/atmel/at91sam9263ek/partition.c
new file mode 100644 (file)
index 0000000..eb1a724
--- /dev/null
@@ -0,0 +1,39 @@
+/*
+ * (C) Copyright 2008
+ * Ulf Samuelsson <ulf@atmel.com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ */
+#include <common.h>
+#include <config.h>
+#include <asm/hardware.h>
+#include <dataflash.h>
+
+AT91S_DATAFLASH_INFO dataflash_info[CFG_MAX_DATAFLASH_BANKS];
+
+struct dataflash_addr cs[CFG_MAX_DATAFLASH_BANKS] = {
+       {CFG_DATAFLASH_LOGIC_ADDR_CS0, 0},      /* Logical adress, CS */
+};
+
+/*define the area offsets*/
+dataflash_protect_t area_list[NB_DATAFLASH_AREA] = {
+       {0x00000000, 0x000041FF, FLAG_PROTECT_SET,   0, "Bootstrap"},
+       {0x00004200, 0x000083FF, FLAG_PROTECT_CLEAR, 0, "Environment"},
+       {0x00008400, 0x00041FFF, FLAG_PROTECT_SET,   0, "U-Boot"},
+       {0x00042000, 0x00251FFF, FLAG_PROTECT_CLEAR, 0, "Kernel"},
+       {0x00252000, 0xFFFFFFFF, FLAG_PROTECT_CLEAR, 0, "FS"},
+};
diff --git a/board/atmel/at91sam9rlek/Makefile b/board/atmel/at91sam9rlek/Makefile
new file mode 100644 (file)
index 0000000..a86a926
--- /dev/null
@@ -0,0 +1,57 @@
+#
+# (C) Copyright 2003-2008
+# Wolfgang Denk, DENX Software Engineering, wd@denx.de.
+#
+# (C) Copyright 2008
+# Stelian Pop <stelian.pop@leadtechdesign.com>
+# Lead Tech Design <www.leadtechdesign.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 $(TOPDIR)/config.mk
+
+LIB    = $(obj)lib$(BOARD).a
+
+COBJS-y += at91sam9rlek.o
+COBJS-y += led.o
+COBJS-y        += partition.o
+COBJS-$(CONFIG_CMD_NAND) += nand.o
+
+SRCS   := $(SOBJS:.o=.S) $(COBJS-y:.o=.c)
+OBJS   := $(addprefix $(obj),$(COBJS-y))
+SOBJS  := $(addprefix $(obj),$(SOBJS))
+
+$(LIB):        $(obj).depend $(OBJS) $(SOBJS)
+       $(AR) $(ARFLAGS) $@ $(OBJS) $(SOBJS)
+
+clean:
+       rm -f $(SOBJS) $(OBJS)
+
+distclean:     clean
+       rm -f $(LIB) core *.bak .depend
+
+#########################################################################
+
+# defines $(obj).depend target
+include $(SRCTREE)/rules.mk
+
+sinclude $(obj).depend
+
+#########################################################################
diff --git a/board/atmel/at91sam9rlek/at91sam9rlek.c b/board/atmel/at91sam9rlek/at91sam9rlek.c
new file mode 100644 (file)
index 0000000..10423d2
--- /dev/null
@@ -0,0 +1,215 @@
+/*
+ * (C) Copyright 2007-2008
+ * Stelian Pop <stelian.pop@leadtechdesign.com>
+ * Lead Tech Design <www.leadtechdesign.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 <asm/arch/at91sam9rl.h>
+#include <asm/arch/at91sam9rl_matrix.h>
+#include <asm/arch/at91sam9_smc.h>
+#include <asm/arch/at91_pmc.h>
+#include <asm/arch/at91_rstc.h>
+#include <asm/arch/gpio.h>
+#include <asm/arch/io.h>
+#include <lcd.h>
+#include <atmel_lcdc.h>
+#if defined(CONFIG_RESET_PHY_R) && defined(CONFIG_MACB)
+#include <net.h>
+#endif
+
+DECLARE_GLOBAL_DATA_PTR;
+
+/* ------------------------------------------------------------------------- */
+/*
+ * Miscelaneous platform dependent initialisations
+ */
+
+static void at91sam9rlek_serial_hw_init(void)
+{
+#ifdef CONFIG_USART0
+       at91_set_A_periph(AT91_PIN_PA6, 1);             /* TXD0 */
+       at91_set_A_periph(AT91_PIN_PA7, 0);             /* RXD0 */
+       at91_sys_write(AT91_PMC_PCER, 1 << AT91_ID_US0);
+#endif
+
+#ifdef CONFIG_USART1
+       at91_set_A_periph(AT91_PIN_PA11, 1);            /* TXD1 */
+       at91_set_A_periph(AT91_PIN_PA12, 0);            /* RXD1 */
+       at91_sys_write(AT91_PMC_PCER, 1 << AT91_ID_US1);
+#endif
+
+#ifdef CONFIG_USART2
+       at91_set_A_periph(AT91_PIN_PA13, 1);            /* TXD2 */
+       at91_set_A_periph(AT91_PIN_PA14, 0);            /* RXD2 */
+       at91_sys_write(AT91_PMC_PCER, 1 << AT91_ID_US2);
+#endif
+
+#ifdef CONFIG_USART3   /* DBGU */
+       at91_set_A_periph(AT91_PIN_PA21, 0);            /* DRXD */
+       at91_set_A_periph(AT91_PIN_PA22, 1);            /* DTXD */
+       at91_sys_write(AT91_PMC_PCER, 1 << AT91_ID_SYS);
+#endif
+}
+
+#ifdef CONFIG_CMD_NAND
+static void at91sam9rlek_nand_hw_init(void)
+{
+       unsigned long csa;
+
+       /* Enable CS3 */
+       csa = at91_sys_read(AT91_MATRIX_EBICSA);
+       at91_sys_write(AT91_MATRIX_EBICSA,
+                      csa | AT91_MATRIX_CS3A_SMC_SMARTMEDIA);
+
+       /* Configure SMC CS3 for NAND/SmartMedia */
+       at91_sys_write(AT91_SMC_SETUP(3),
+                      AT91_SMC_NWESETUP_(0) | AT91_SMC_NCS_WRSETUP_(0) |
+                      AT91_SMC_NRDSETUP_(0) | AT91_SMC_NCS_RDSETUP_(0));
+       at91_sys_write(AT91_SMC_PULSE(3),
+                      AT91_SMC_NWEPULSE_(2) | AT91_SMC_NCS_WRPULSE_(5) |
+                      AT91_SMC_NRDPULSE_(2) | AT91_SMC_NCS_RDPULSE_(5));
+       at91_sys_write(AT91_SMC_CYCLE(3),
+                      AT91_SMC_NWECYCLE_(7) | AT91_SMC_NRDCYCLE_(7));
+       at91_sys_write(AT91_SMC_MODE(3),
+                      AT91_SMC_READMODE | AT91_SMC_WRITEMODE |
+                      AT91_SMC_EXNWMODE_DISABLE |
+#ifdef CFG_NAND_DBW_16
+                      AT91_SMC_DBW_16 |
+#else /* CFG_NAND_DBW_8 */
+                      AT91_SMC_DBW_8 |
+#endif
+                      AT91_SMC_TDF_(1));
+
+       at91_sys_write(AT91_PMC_PCER, 1 << AT91SAM9RL_ID_PIOD);
+
+       /* Configure RDY/BSY */
+       at91_set_gpio_input(AT91_PIN_PD17, 1);
+
+       /* Enable NandFlash */
+       at91_set_gpio_output(AT91_PIN_PB6, 1);
+
+       at91_set_A_periph(AT91_PIN_PB4, 0);             /* NANDOE */
+       at91_set_A_periph(AT91_PIN_PB5, 0);             /* NANDWE */
+}
+#endif
+
+#ifdef CONFIG_HAS_DATAFLASH
+static void at91sam9rlek_spi_hw_init(void)
+{
+       at91_set_A_periph(AT91_PIN_PA28, 0);    /* SPI0_NPCS0 */
+
+       at91_set_A_periph(AT91_PIN_PA25, 0);    /* SPI0_MISO */
+       at91_set_A_periph(AT91_PIN_PA26, 0);    /* SPI0_MOSI */
+       at91_set_A_periph(AT91_PIN_PA27, 0);    /* SPI0_SPCK */
+
+       /* Enable clock */
+       at91_sys_write(AT91_PMC_PCER, 1 << AT91SAM9RL_ID_SPI);
+}
+#endif
+
+#ifdef CONFIG_LCD
+vidinfo_t panel_info = {
+       vl_col:         240,
+       vl_row:         320,
+       vl_clk:         4965000,
+       vl_sync:        ATMEL_LCDC_INVLINE_INVERTED |
+                       ATMEL_LCDC_INVFRAME_INVERTED,
+       vl_bpix:        3,
+       vl_tft:         1,
+       vl_hsync_len:   5,
+       vl_left_margin: 1,
+       vl_right_margin:33,
+       vl_vsync_len:   1,
+       vl_upper_margin:1,
+       vl_lower_margin:0,
+       mmio:           AT91SAM9RL_LCDC_BASE,
+};
+
+void lcd_enable(void)
+{
+       at91_set_gpio_value(AT91_PIN_PA30, 0);  /* power up */
+}
+
+void lcd_disable(void)
+{
+       at91_set_gpio_value(AT91_PIN_PA30, 1);  /* power down */
+}
+static void at91sam9rlek_lcd_hw_init(void)
+{
+       at91_set_B_periph(AT91_PIN_PC1, 0);     /* LCDPWR */
+       at91_set_A_periph(AT91_PIN_PC5, 0);     /* LCDHSYNC */
+       at91_set_A_periph(AT91_PIN_PC6, 0);     /* LCDDOTCK */
+       at91_set_A_periph(AT91_PIN_PC7, 0);     /* LCDDEN */
+       at91_set_A_periph(AT91_PIN_PC3, 0);     /* LCDCC */
+       at91_set_B_periph(AT91_PIN_PC9, 0);     /* LCDD3 */
+       at91_set_B_periph(AT91_PIN_PC10, 0);    /* LCDD4 */
+       at91_set_B_periph(AT91_PIN_PC11, 0);    /* LCDD5 */
+       at91_set_B_periph(AT91_PIN_PC12, 0);    /* LCDD6 */
+       at91_set_B_periph(AT91_PIN_PC13, 0);    /* LCDD7 */
+       at91_set_B_periph(AT91_PIN_PC15, 0);    /* LCDD11 */
+       at91_set_B_periph(AT91_PIN_PC16, 0);    /* LCDD12 */
+       at91_set_B_periph(AT91_PIN_PC17, 0);    /* LCDD13 */
+       at91_set_B_periph(AT91_PIN_PC18, 0);    /* LCDD14 */
+       at91_set_B_periph(AT91_PIN_PC19, 0);    /* LCDD15 */
+       at91_set_B_periph(AT91_PIN_PC20, 0);    /* LCDD18 */
+       at91_set_B_periph(AT91_PIN_PC21, 0);    /* LCDD19 */
+       at91_set_B_periph(AT91_PIN_PC22, 0);    /* LCDD20 */
+       at91_set_B_periph(AT91_PIN_PC23, 0);    /* LCDD21 */
+       at91_set_B_periph(AT91_PIN_PC24, 0);    /* LCDD22 */
+       at91_set_B_periph(AT91_PIN_PC25, 0);    /* LCDD23 */
+
+       at91_sys_write(AT91_PMC_PCER, 1 << AT91SAM9RL_ID_LCDC);
+
+       gd->fb_base = 0;
+}
+#endif
+
+
+int board_init(void)
+{
+       /* Enable Ctrlc */
+       console_init_f();
+
+       /* arch number of AT91SAM9RLEK-Board */
+       gd->bd->bi_arch_number = MACH_TYPE_AT91SAM9RLEK;
+       /* adress of boot parameters */
+       gd->bd->bi_boot_params = PHYS_SDRAM + 0x100;
+
+       at91sam9rlek_serial_hw_init();
+#ifdef CONFIG_CMD_NAND
+       at91sam9rlek_nand_hw_init();
+#endif
+#ifdef CONFIG_HAS_DATAFLASH
+       at91sam9rlek_spi_hw_init();
+#endif
+#ifdef CONFIG_LCD
+       at91sam9rlek_lcd_hw_init();
+#endif
+       return 0;
+}
+
+int dram_init(void)
+{
+       gd->bd->bi_dram[0].start = PHYS_SDRAM;
+       gd->bd->bi_dram[0].size = PHYS_SDRAM_SIZE;
+       return 0;
+}
diff --git a/board/atmel/at91sam9rlek/config.mk b/board/atmel/at91sam9rlek/config.mk
new file mode 100644 (file)
index 0000000..ff2cfd1
--- /dev/null
@@ -0,0 +1 @@
+TEXT_BASE = 0x23f00000
diff --git a/board/atmel/at91sam9rlek/led.c b/board/atmel/at91sam9rlek/led.c
new file mode 100644 (file)
index 0000000..8a7d8e0
--- /dev/null
@@ -0,0 +1,77 @@
+/*
+ * (C) Copyright 2007-2008
+ * Stelian Pop <stelian.pop@leadtechdesign.com>
+ * Lead Tech Design <www.leadtechdesign.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 <asm/arch/at91sam9rl.h>
+#include <asm/arch/at91_pmc.h>
+#include <asm/arch/gpio.h>
+#include <asm/arch/io.h>
+
+#define        RED_LED         AT91_PIN_PD14   /* this is the power led */
+#define        GREEN_LED       AT91_PIN_PD15   /* this is the user1 led */
+#define        YELLOW_LED      AT91_PIN_PD16   /* this is the user2 led */
+
+void red_LED_on(void)
+{
+       at91_set_gpio_value(RED_LED, 1);
+}
+
+void red_LED_off(void)
+{
+       at91_set_gpio_value(RED_LED, 0);
+}
+
+void green_LED_on(void)
+{
+       at91_set_gpio_value(GREEN_LED, 0);
+}
+
+void green_LED_off(void)
+{
+       at91_set_gpio_value(GREEN_LED, 1);
+}
+
+void yellow_LED_on(void)
+{
+       at91_set_gpio_value(YELLOW_LED, 0);
+}
+
+void yellow_LED_off(void)
+{
+       at91_set_gpio_value(YELLOW_LED, 1);
+}
+
+void coloured_LED_init(void)
+{
+       /* Enable clock */
+       at91_sys_write(AT91_PMC_PCER, 1 << AT91SAM9RL_ID_PIOD);
+
+       at91_set_gpio_output(RED_LED, 1);
+       at91_set_gpio_output(GREEN_LED, 1);
+       at91_set_gpio_output(YELLOW_LED, 1);
+
+       at91_set_gpio_value(RED_LED, 0);
+       at91_set_gpio_value(GREEN_LED, 1);
+       at91_set_gpio_value(YELLOW_LED, 1);
+}
diff --git a/board/atmel/at91sam9rlek/nand.c b/board/atmel/at91sam9rlek/nand.c
new file mode 100644 (file)
index 0000000..5af1a31
--- /dev/null
@@ -0,0 +1,79 @@
+/*
+ * (C) Copyright 2007-2008
+ * Stelian Pop <stelian.pop@leadtechdesign.com>
+ * Lead Tech Design <www.leadtechdesign.com>
+ *
+ * (C) Copyright 2006 ATMEL Rousset, Lacressonniere Nicolas
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+#include <common.h>
+#include <asm/arch/at91sam9rl.h>
+#include <asm/arch/gpio.h>
+#include <asm/arch/at91_pio.h>
+
+#include <nand.h>
+
+/*
+ *     hardware specific access to control-lines
+ */
+#define        MASK_ALE        (1 << 21)       /* our ALE is AD21 */
+#define        MASK_CLE        (1 << 22)       /* our CLE is AD22 */
+
+static void at91sam9rlek_nand_hwcontrol(struct mtd_info *mtd, int cmd)
+{
+       struct nand_chip *this = mtd->priv;
+       ulong IO_ADDR_W = (ulong) this->IO_ADDR_W;
+
+       IO_ADDR_W &= ~(MASK_ALE|MASK_CLE);
+       switch (cmd) {
+       case NAND_CTL_SETCLE:
+               IO_ADDR_W |= MASK_CLE;
+               break;
+       case NAND_CTL_SETALE:
+               IO_ADDR_W |= MASK_ALE;
+               break;
+       case NAND_CTL_CLRNCE:
+               at91_set_gpio_value(AT91_PIN_PB6, 1);
+               break;
+       case NAND_CTL_SETNCE:
+               at91_set_gpio_value(AT91_PIN_PB6, 0);
+               break;
+       }
+       this->IO_ADDR_W = (void *) IO_ADDR_W;
+}
+
+static int at91sam9rlek_nand_ready(struct mtd_info *mtd)
+{
+       return at91_get_gpio_value(AT91_PIN_PD17);
+}
+
+int board_nand_init(struct nand_chip *nand)
+{
+       nand->eccmode = NAND_ECC_SOFT;
+#ifdef CFG_NAND_DBW_16
+       nand->options = NAND_BUSWIDTH_16;
+#endif
+       nand->hwcontrol = at91sam9rlek_nand_hwcontrol;
+       nand->dev_ready = at91sam9rlek_nand_ready;
+       nand->chip_delay = 20;
+
+       return 0;
+}
diff --git a/board/atmel/at91sam9rlek/partition.c b/board/atmel/at91sam9rlek/partition.c
new file mode 100644 (file)
index 0000000..eb1a724
--- /dev/null
@@ -0,0 +1,39 @@
+/*
+ * (C) Copyright 2008
+ * Ulf Samuelsson <ulf@atmel.com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ */
+#include <common.h>
+#include <config.h>
+#include <asm/hardware.h>
+#include <dataflash.h>
+
+AT91S_DATAFLASH_INFO dataflash_info[CFG_MAX_DATAFLASH_BANKS];
+
+struct dataflash_addr cs[CFG_MAX_DATAFLASH_BANKS] = {
+       {CFG_DATAFLASH_LOGIC_ADDR_CS0, 0},      /* Logical adress, CS */
+};
+
+/*define the area offsets*/
+dataflash_protect_t area_list[NB_DATAFLASH_AREA] = {
+       {0x00000000, 0x000041FF, FLAG_PROTECT_SET,   0, "Bootstrap"},
+       {0x00004200, 0x000083FF, FLAG_PROTECT_CLEAR, 0, "Environment"},
+       {0x00008400, 0x00041FFF, FLAG_PROTECT_SET,   0, "U-Boot"},
+       {0x00042000, 0x00251FFF, FLAG_PROTECT_CLEAR, 0, "Kernel"},
+       {0x00252000, 0xFFFFFFFF, FLAG_PROTECT_CLEAR, 0, "FS"},
+};
index 1ccbe2c181752c08e5cb02d671e6b3a5dad72916..c649855d63988e937e5f1a5d3bba446fe72bab1a 100644 (file)
 #include <asm/sdram.h>
 #include <asm/arch/clk.h>
 #include <asm/arch/gpio.h>
-#include <asm/arch/hmatrix2.h>
+#include <asm/arch/hmatrix.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
-static const struct sdram_info sdram = {
-       .phys_addr      = CFG_SDRAM_BASE,
+static const struct sdram_config sdram_config = {
+       .data_bits      = SDRAM_DATA_16BIT,
        .row_bits       = 13,
        .col_bits       = 9,
        .bank_bits      = 2,
@@ -47,8 +47,8 @@ static const struct sdram_info sdram = {
 
 int board_early_init_f(void)
 {
-       /* Set the SDRAM_ENABLE bit in the HEBI SFR */
-       hmatrix2_writel(SFR4, 1 << 1);
+       /* Enable SDRAM in the EBI mux */
+       hmatrix_slave_write(EBI, SFR, HMATRIX_BIT(EBI_SDRAM_ENABLE));
 
        gpio_enable_ebi();
        gpio_enable_usart1();
@@ -66,7 +66,22 @@ int board_early_init_f(void)
 
 long int initdram(int board_type)
 {
-       return sdram_init(&sdram);
+       unsigned long expected_size;
+       unsigned long actual_size;
+       void *sdram_base;
+
+       sdram_base = map_physmem(EBI_SDRAM_BASE, EBI_SDRAM_SIZE, MAP_NOCACHE);
+
+       expected_size = sdram_init(sdram_base, &sdram_config);
+       actual_size = get_ram_size(sdram_base, expected_size);
+
+       unmap_physmem(sdram_base, EBI_SDRAM_SIZE);
+
+       if (expected_size != actual_size)
+               printf("Warning: Only %u of %u MiB SDRAM is working\n",
+                               actual_size >> 20, expected_size >> 20);
+
+       return actual_size;
 }
 
 void board_init_info(void)
index 34e347aecd5e6b7abd2ace5dd293f840838d427a..e736adf0fcdf2c592c215e6e746c3120ce7d75cb 100644 (file)
@@ -29,17 +29,10 @@ SECTIONS
        . = 0;
        _text = .;
        .text : {
+               *(.exception.text)
                *(.text)
                *(.text.*)
        }
-
-       . = ALIGN(32);
-       __flashprog_start = .;
-       .flashprog : {
-               *(.flashprog)
-       }
-       . = ALIGN(32);
-       __flashprog_end = .;
        _etext = .;
 
        .rodata : {
index 28f64c4a6f240d0c1a5392264828da9d94295301..33bdba6f5df46dda66d20773e0f96d6f0a6997cb 100644 (file)
 #include <asm/sdram.h>
 #include <asm/arch/clk.h>
 #include <asm/arch/gpio.h>
-#include <asm/arch/hmatrix2.h>
+#include <asm/arch/hmatrix.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
-static const struct sdram_info sdram = {
-       .phys_addr      = CFG_SDRAM_BASE,
+static const struct sdram_config sdram_config = {
+#if defined(CONFIG_ATSTK1006)
+       /* Dual MT48LC16M16A2-7E (64 MB) on daughterboard */
+       .data_bits      = SDRAM_DATA_32BIT,
+       .row_bits       = 13,
+       .col_bits       = 9,
+       .bank_bits      = 2,
+       .cas            = 2,
+       .twr            = 2,
+       .trc            = 7,
+       .trp            = 2,
+       .trcd           = 2,
+       .tras           = 4,
+       .txsr           = 7,
+       /* 7.81 us */
+       .refresh_period = (781 * (SDRAMC_BUS_HZ / 1000)) / 100000,
+#else
+       /* MT48LC2M32B2P-5 (8 MB) on motherboard */
+#ifdef CONFIG_ATSTK1004
+       .data_bits      = SDRAM_DATA_16BIT,
+#else
+       .data_bits      = SDRAM_DATA_32BIT,
+#endif
+#ifdef CONFIG_ATSTK1000_16MB_SDRAM
+       /* MT48LC4M32B2P-6 (16 MB) on mod'ed motherboard */
+       .row_bits       = 12,
+#else
        .row_bits       = 11,
+#endif
        .col_bits       = 8,
        .bank_bits      = 2,
        .cas            = 3,
@@ -43,12 +69,13 @@ static const struct sdram_info sdram = {
        .txsr           = 5,
        /* 15.6 us */
        .refresh_period = (156 * (SDRAMC_BUS_HZ / 1000)) / 10000,
+#endif
 };
 
 int board_early_init_f(void)
 {
-       /* Set the SDRAM_ENABLE bit in the HEBI SFR */
-       hmatrix2_writel(SFR4, 1 << 1);
+       /* Enable SDRAM in the EBI mux */
+       hmatrix_slave_write(EBI, SFR, HMATRIX_BIT(EBI_SDRAM_ENABLE));
 
        gpio_enable_ebi();
        gpio_enable_usart1();
@@ -65,7 +92,22 @@ int board_early_init_f(void)
 
 long int initdram(int board_type)
 {
-       return sdram_init(&sdram);
+       unsigned long expected_size;
+       unsigned long actual_size;
+       void *sdram_base;
+
+       sdram_base = map_physmem(EBI_SDRAM_BASE, EBI_SDRAM_SIZE, MAP_NOCACHE);
+
+       expected_size = sdram_init(sdram_base, &sdram_config);
+       actual_size = get_ram_size(sdram_base, expected_size);
+
+       unmap_physmem(sdram_base, EBI_SDRAM_SIZE);
+
+       if (expected_size != actual_size)
+               printf("Warning: Only %u of %u MiB SDRAM is working\n",
+                               actual_size >> 20, expected_size >> 20);
+
+       return actual_size;
 }
 
 void board_init_info(void)
index 40478258e7c1e1191bfca9be664bc48b3618ea4e..12537f3142ec4e1d655401c838fb5d8331cd9a52 100644 (file)
@@ -30,7 +30,7 @@ DECLARE_GLOBAL_DATA_PTR;
 
 flash_info_t flash_info[1];
 
-static void __flashprog flash_identify(uint16_t *flash, flash_info_t *info)
+static void flash_identify(uint16_t *flash, flash_info_t *info)
 {
        unsigned long flags;
 
@@ -76,7 +76,7 @@ void flash_print_info(flash_info_t *info)
               info->size >> 10, info->sector_count);
 }
 
-int __flashprog flash_erase(flash_info_t *info, int s_first, int s_last)
+int flash_erase(flash_info_t *info, int s_first, int s_last)
 {
        unsigned long flags;
        unsigned long start_time;
@@ -154,7 +154,7 @@ int __flashprog flash_erase(flash_info_t *info, int s_first, int s_last)
        return ERR_OK;
 }
 
-int __flashprog write_buff(flash_info_t *info, uchar *src,
+int write_buff(flash_info_t *info, uchar *src,
                           ulong addr, ulong count)
 {
        unsigned long flags;
index 247812e10366bceebdb88a7d932401c699896ba9..0d3b19c6402cb4ecff494b00c4a4424bc806ad99 100644 (file)
@@ -29,17 +29,10 @@ SECTIONS
        . = 0;
        _text = .;
        .text : {
+               *(.exception.text)
                *(.text)
                *(.text.*)
        }
-
-       . = ALIGN(32);
-       __flashprog_start = .;
-       .flashprog : {
-               *(.flashprog)
-       }
-       . = ALIGN(32);
-       __flashprog_end = .;
        _etext = .;
 
        .rodata : {
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 a13eeeb1232306ed84b219493d4367a50d071f4c..1be72a2dd3e7731795c583688a7ccc58a38ec679 100644 (file)
@@ -52,7 +52,7 @@ int checkboard (void)
 
        *sys_counter = 0x100; /* Enable 32 kHz oscillator for RTC/TOY */
 
-       proc_id = read_32bit_cp0_register(CP0_PRID);
+       proc_id = read_c0_prid();
 
        switch (proc_id >> 24) {
        case 0:
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 6c825969d38c796b97a01e95615cbab638c6b6f6..e18e68e8cec3f17622a005530bb3ebdbe2bf405c 100644 (file)
@@ -257,25 +257,24 @@ void sdram_init(void)
 
 #define SPI_CS_MASK    0x80000000
 
-void spi_eeprom_chipsel(int cs)
+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];
 
-       if (cs)
-               iopd->dat &= ~SPI_CS_MASK;
-       else
-               iopd->dat |=  SPI_CS_MASK;
+       iopd->dat &= ~SPI_CS_MASK;
 }
 
-/*
- * The SPI command uses this table of functions for controlling the SPI
- * chip selects.
- */
-spi_chipsel_type spi_chipsel[] = {
-       spi_eeprom_chipsel,
-};
-int spi_chipsel_cnt = sizeof(spi_chipsel) / sizeof(spi_chipsel[0]);
+void spi_cs_deactivate(struct spi_slave *slave)
+{
+       volatile gpio83xx_t *iopd = &((immap_t *)CFG_IMMR)->gpio[0];
 
+       iopd->dat |=  SPI_CS_MASK;
+}
 #endif /* CONFIG_HARD_SPI */
 
 #if defined(CONFIG_OF_BOARD_SETUP)
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 6da80dc758dc851e6cd13497a11b0ef266ae6688..9bc4d3fe5e84b630e70a7a65888fc72e827e1665 100644 (file)
@@ -135,7 +135,7 @@ int checkboard (void)
 
        *sys_counter = 0x100; /* Enable 32 kHz oscillator for RTC/TOY */
 
-       proc_id = read_32bit_cp0_register(CP0_PRID);
+       proc_id = read_c0_prid();
 
        switch (proc_id >> 24) {
        case 0:
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;
+}
similarity index 60%
rename from cpu/at32ap/pm.c
rename to board/mvblm7/fpga.h
index c78d547f85e00d06758dbdd7a5a819f141bf66b5..19277eb05f5c88741bc12827659985d3596a8dc0 100644 (file)
@@ -1,5 +1,7 @@
 /*
- * Copyright (C) 2006 Atmel Corporation
+ * (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.
  * 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>
-
-#ifdef CFG_POWER_MANAGER
-#include <asm/errno.h>
-#include <asm/io.h>
-
-#include <asm/arch/memory-map.h>
-
-#include "sm.h"
-
-
-#ifdef CONFIG_PLL
-#define MAIN_CLK_RATE ((CFG_OSC0_HZ / CFG_PLL0_DIV) * CFG_PLL0_MUL)
-#else
-#define MAIN_CLK_RATE (CFG_OSC0_HZ)
-#endif
-
-DECLARE_GLOBAL_DATA_PTR;
 
+extern int mvblm7_init_fpga(void);
 
-#endif /* CFG_POWER_MANAGER */
+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 536c9544f53e407e9682c6a19ceb824d30ac8e0c..82b7235209ddea479714f5add85f29e8d597765e 100644 (file)
@@ -51,7 +51,7 @@ int checkboard (void)
 
        *sys_counter = 0x100; /* Enable 32 kHz oscillator for RTC/TOY */
 
-       proc_id = read_32bit_cp0_register(CP0_PRID);
+       proc_id = read_c0_prid();
 
        switch (proc_id >> 24) {
        case 0:
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 68690743d686434c7702819aa0bb43a62a04f5b5..6e6eab27779b9018fc77edb732c008bcd6712b8a 100644 (file)
@@ -38,7 +38,7 @@ int checkboard(void)
        u32 proc_id;
        u32 config1;
 
-       proc_id = read_32bit_cp0_register(CP0_PRID);
+       proc_id = read_c0_prid();
        printf("Board: Qemu -M mips CPU: ");
        switch (proc_id) {
        case 0x00018000:
@@ -51,7 +51,7 @@ int checkboard(void)
                printf("4KEc");
                break;
        case 0x00019300:
-               config1 = read_mips32_cp0_config1();
+               config1 = read_c0_config1();
                if (config1 & 1)
                        printf("24Kf");
                else
@@ -64,7 +64,7 @@ int checkboard(void)
                printf("R4000");
                break;
        case 0x00018100:
-               config1 = read_mips32_cp0_config1();
+               config1 = read_c0_config1();
                if (config1 & 1)
                        printf("5Kf");
                else
diff --git a/board/quad100hd/Makefile b/board/quad100hd/Makefile
new file mode 100644 (file)
index 0000000..252ad5a
--- /dev/null
@@ -0,0 +1,51 @@
+#
+# (C) Copyright 2007
+# Stefan Roese, DENX Software Engineering, sr@denx.de.
+#
+# See file CREDITS for list of people who contributed to this
+# project.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 2 of
+# the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+# MA 02111-1307 USA
+#
+
+include $(TOPDIR)/config.mk
+
+LIB    = $(obj)lib$(BOARD).a
+
+COBJS  = $(BOARD).o nand.o
+SOBJS   =
+
+SRCS   := $(SOBJS:.o=.S) $(COBJS:.o=.c)
+OBJS   := $(addprefix $(obj),$(COBJS))
+SOBJS  := $(addprefix $(obj),$(SOBJS))
+
+$(LIB):        $(OBJS) $(SOBJS)
+       $(AR) $(ARFLAGS) $@ $(OBJS) $(SOBJS)
+
+clean:
+       rm -f $(SOBJS) $(OBJS)
+
+distclean:     clean
+       rm -f $(LIB) core *.bak .depend
+
+#########################################################################
+
+# defines $(obj).depend target
+include $(SRCTREE)/rules.mk
+
+sinclude $(obj).depend
+
+#########################################################################
diff --git a/board/quad100hd/config.mk b/board/quad100hd/config.mk
new file mode 100644 (file)
index 0000000..1bdf5e4
--- /dev/null
@@ -0,0 +1,24 @@
+#
+# (C) Copyright 2000
+# Wolfgang Denk, DENX Software Engineering, wd@denx.de.
+#
+# See file CREDITS for list of people who contributed to this
+# project.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 2 of
+# the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+# MA 02111-1307 USA
+#
+
+TEXT_BASE = 0xFFFC0000
diff --git a/board/quad100hd/nand.c b/board/quad100hd/nand.c
new file mode 100644 (file)
index 0000000..a36b89d
--- /dev/null
@@ -0,0 +1,79 @@
+/*
+ * (C) Copyright 2008
+ * Gary Jennejohn, DENX Software Engineering GmbH, garyj@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 <config.h>
+#if defined(CONFIG_CMD_NAND)
+#include <asm/gpio.h>
+#include <nand.h>
+
+/*
+ *     hardware specific access to control-lines
+ */
+static void quad100hd_hwcontrol(struct mtd_info *mtd, int cmd)
+{
+       switch(cmd) {
+       case NAND_CTL_SETCLE:
+               gpio_write_bit(CFG_NAND_CLE, 1);
+               break;
+       case NAND_CTL_CLRCLE:
+               gpio_write_bit(CFG_NAND_CLE, 0);
+               break;
+
+       case NAND_CTL_SETALE:
+               gpio_write_bit(CFG_NAND_ALE, 1);
+               break;
+       case NAND_CTL_CLRALE:
+               gpio_write_bit(CFG_NAND_ALE, 0);
+               break;
+
+       case NAND_CTL_SETNCE:
+               gpio_write_bit(CFG_NAND_CE, 0);
+               break;
+       case NAND_CTL_CLRNCE:
+               gpio_write_bit(CFG_NAND_CE, 1);
+               break;
+       }
+}
+
+static int quad100hd_nand_ready(struct mtd_info *mtd)
+{
+       return gpio_read_in_bit(CFG_NAND_RDY);
+}
+
+/*
+ * Main initialization routine
+ */
+int board_nand_init(struct nand_chip *nand)
+{
+       /* Set address of hardware control function */
+       nand->hwcontrol = quad100hd_hwcontrol;
+       nand->dev_ready = quad100hd_nand_ready;
+       nand->eccmode = NAND_ECC_SOFT;
+       /* 15 us command delay time */
+       nand->chip_delay =  20;
+
+       /* Return happy */
+       return 0;
+}
+#endif /* CONFIG_CMD_NAND */
diff --git a/board/quad100hd/quad100hd.c b/board/quad100hd/quad100hd.c
new file mode 100644 (file)
index 0000000..638bd6c
--- /dev/null
@@ -0,0 +1,93 @@
+/*
+ * (C) Copyright 2008
+ * Gary Jennejohn, DENX Software Engineering GmbH, garyj@denx.de.
+ *
+ * Based in part on board/icecube/icecube.c from PPCBoot
+ * (C) Copyright 2003 Intrinsyc Software
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+#include <common.h>
+#include <command.h>
+#include <malloc.h>
+#include <environment.h>
+#include <logbuff.h>
+#include <post.h>
+
+#include <asm/processor.h>
+#include <asm/io.h>
+#include <asm/gpio.h>
+
+DECLARE_GLOBAL_DATA_PTR;
+
+int board_early_init_f(void)
+{
+       /* taken from PPCBoot */
+       mtdcr(uicsr, 0xFFFFFFFF);       /* clear all ints */
+       mtdcr(uicer, 0x00000000);       /* disable all ints */
+       mtdcr(uiccr, 0x00000000);
+       mtdcr(uicpr, 0xFFFF7FFE);       /* set int polarities */
+       mtdcr(uictr, 0x00000000);       /* set int trigger levels */
+       mtdcr(uicsr, 0xFFFFFFFF);       /* clear all ints */
+       mtdcr(uicvcr, 0x00000001);      /* set vect base=0,INT0 highest priority */
+
+       mtdcr(CPC0_SRR, 0x00040000);   /* Hold PCI bridge in reset */
+
+       return 0;
+}
+
+/*
+ * Check Board Identity:
+ */
+int checkboard(void)
+{
+       char *s = getenv("serial#");
+#ifdef DISPLAY_BOARD_INFO
+       sys_info_t sysinfo;
+#endif
+
+       puts("Board: Quad100hd");
+
+       if (s != NULL) {
+               puts(", serial# ");
+               puts(s);
+       }
+       putc('\n');
+
+#ifdef DISPLAY_BOARD_INFO
+       /* taken from ppcboot */
+       get_sys_info(&sysinfo);
+
+       printf("\tVCO: %lu MHz\n", sysinfo.freqVCOMhz);
+       printf("\tCPU: %lu MHz\n", sysinfo.freqProcessor / 1000000);
+       printf("\tPLB: %lu MHz\n", sysinfo.freqPLB / 1000000);
+       printf("\tOPB: %lu MHz\n", sysinfo.freqOPB / 1000000);
+       printf("\tEPB: %lu MHz\n", sysinfo.freqPLB / (sysinfo.pllExtBusDiv *
+               1000000));
+       printf("\tPCI: %lu MHz\n", sysinfo.freqPCI / 1000000);
+#endif
+
+       return 0;
+}
+
+long int initdram(int board_type)
+{
+       return CFG_SDRAM_SIZE;
+}
diff --git a/board/quad100hd/u-boot.lds b/board/quad100hd/u-boot.lds
new file mode 100644 (file)
index 0000000..195d91b
--- /dev/null
@@ -0,0 +1,133 @@
+/*
+ * (C) Copyright 2000
+ * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+OUTPUT_ARCH(powerpc)
+SEARCH_DIR(/lib); SEARCH_DIR(/usr/lib); SEARCH_DIR(/usr/local/lib); SEARCH_DIR(/usr/local/powerpc-any-elf/lib);
+/* Do we need any of these for elf?
+   __DYNAMIC = 0;    */
+SECTIONS
+{
+  .resetvec 0xFFFFFFFC :
+  {
+    *(.resetvec)
+  } = 0xffff
+
+  /* Read-only sections, merged into text segment: */
+  . = + SIZEOF_HEADERS;
+  .interp : { *(.interp) }
+  .hash          : { *(.hash)          }
+  .dynsym        : { *(.dynsym)                }
+  .dynstr        : { *(.dynstr)                }
+  .rel.text      : { *(.rel.text)              }
+  .rela.text     : { *(.rela.text)     }
+  .rel.data      : { *(.rel.data)              }
+  .rela.data     : { *(.rela.data)     }
+  .rel.rodata    : { *(.rel.rodata)    }
+  .rela.rodata   : { *(.rela.rodata)   }
+  .rel.got       : { *(.rel.got)               }
+  .rela.got      : { *(.rela.got)              }
+  .rel.ctors     : { *(.rel.ctors)     }
+  .rela.ctors    : { *(.rela.ctors)    }
+  .rel.dtors     : { *(.rel.dtors)     }
+  .rela.dtors    : { *(.rela.dtors)    }
+  .rel.bss       : { *(.rel.bss)               }
+  .rela.bss      : { *(.rela.bss)              }
+  .rel.plt       : { *(.rel.plt)               }
+  .rela.plt      : { *(.rela.plt)              }
+  .init          : { *(.init)  }
+  .plt : { *(.plt) }
+  .text      :
+  {
+    cpu/ppc4xx/start.o (.text)
+
+    *(.text)
+    *(.fixup)
+    *(.got1)
+  }
+  _etext = .;
+  PROVIDE (etext = .);
+  .rodata    :
+  {
+    *(.rodata)
+    *(.rodata1)
+    *(.rodata.str1.4)
+  }
+  .fini      : { *(.fini)    } =0
+  .ctors     : { *(.ctors)   }
+  .dtors     : { *(.dtors)   }
+
+  /* Read-write section, merged into data segment: */
+  . = (. + 0x00FF) & 0xFFFFFF00;
+  _erotext = .;
+  PROVIDE (erotext = .);
+  .reloc   :
+  {
+    *(.got)
+    _GOT2_TABLE_ = .;
+    *(.got2)
+    _FIXUP_TABLE_ = .;
+    *(.fixup)
+  }
+  __got2_entries = (_FIXUP_TABLE_ - _GOT2_TABLE_) >>2;
+  __fixup_entries = (. - _FIXUP_TABLE_)>>2;
+
+  .data    :
+  {
+    *(.data)
+    *(.data1)
+    *(.sdata)
+    *(.sdata2)
+    *(.dynamic)
+    CONSTRUCTORS
+  }
+  _edata  =  .;
+  PROVIDE (edata = .);
+
+  . = .;
+  __u_boot_cmd_start = .;
+  .u_boot_cmd : { *(.u_boot_cmd) }
+  __u_boot_cmd_end = .;
+
+  . = .;
+  __start___ex_table = .;
+  __ex_table : { *(__ex_table) }
+  __stop___ex_table = .;
+
+  . = ALIGN(256);
+  __init_begin = .;
+  .text.init : { *(.text.init) }
+  .data.init : { *(.data.init) }
+  . = ALIGN(256);
+  __init_end = .;
+
+  __bss_start = .;
+  .bss (NOLOAD)       :
+  {
+   *(.sbss) *(.scommon)
+   *(.dynbss)
+   *(.bss)
+   *(COMMON)
+  }
+  _end = . ;
+  PROVIDE (end = .);
+}
index 25209e0546404c6a097691db9fbb52dbf31bcec9..e85a0fc4dbe9404af8f2d89a58a65be281d7394e 100644 (file)
@@ -842,37 +842,30 @@ void show_boot_progress (int status)
 #define SPI_ADC_CS_MASK        0x00000800
 #define SPI_DAC_CS_MASK        0x00001000
 
-void spi_adc_chipsel(int cs)
+static const u32 cs_mask[] = {
+    SPI_ADC_CS_MASK,
+    SPI_DAC_CS_MASK,
+};
+
+int spi_cs_is_valid(unsigned int bus, unsigned int cs)
+{
+    return bus == 0 && cs < sizeof(cs_mask) / sizeof(cs_mask[0]);
+}
+
+void spi_cs_activate(struct spi_slave *slave)
 {
     volatile ioport_t *iopd = ioport_addr((immap_t *)CFG_IMMR, 3 /* port D */);
 
-    if(cs)
-       iopd->pdat &= ~SPI_ADC_CS_MASK; /* activate the chip select */
-    else
-       iopd->pdat |=  SPI_ADC_CS_MASK; /* deactivate the chip select */
+    iopd->pdat &= ~cs_mask[slave->cs];
 }
 
-void spi_dac_chipsel(int cs)
+void spi_cs_deactivate(struct spi_slave *slave)
 {
     volatile ioport_t *iopd = ioport_addr((immap_t *)CFG_IMMR, 3 /* port D */);
 
-    if(cs)
-       iopd->pdat &= ~SPI_DAC_CS_MASK; /* activate the chip select */
-    else
-       iopd->pdat |=  SPI_DAC_CS_MASK; /* deactivate the chip select */
+    iopd->pdat |= cs_mask[slave->cs];
 }
 
-/*
- * The SPI command uses this table of functions for controlling the SPI
- * chip selects: it calls the appropriate function to control the SPI
- * chip selects.
- */
-spi_chipsel_type spi_chipsel[] = {
-       spi_adc_chipsel,
-       spi_dac_chipsel
-};
-int spi_chipsel_cnt = sizeof(spi_chipsel) / sizeof(spi_chipsel[0]);
-
 #endif
 
 #endif /* CONFIG_MISC_INIT_R */
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 cb5899485a57da66b66d56a8c2e6675261031b2c..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 */
@@ -45,6 +49,9 @@ ulong flash_get_size (ulong base, int banknum);
 
 int checkboard (void)
 {
+       volatile ccsr_gur_t *gur = (void *)(CFG_MPC85xx_GUTS_ADDR);
+       char *src;
+       int f;
        char *s = getenv("serial#");
 
        puts("Board: Socrates");
@@ -55,8 +62,15 @@ int checkboard (void)
        putc('\n');
 
 #ifdef CONFIG_PCI
-       printf ("PCI1:  32 bit, %d MHz (compiled)\n",
-               CONFIG_SYS_CLK_FREQ / 1000000);
+       /* Check the PCI_clk sel bit */
+       if (in_be32(&gur->porpllsr) & (1<<15)) {
+               src = "SYSCLK";
+               f = CONFIG_SYS_CLK_FREQ;
+       } else {
+               src = "PCI_CLK";
+               f = CONFIG_PCI_CLK_FREQ;
+       }
+       printf ("PCI1:  32 bit, %d MHz (%s)\n", f/1000000, src);
 #else
        printf ("PCI1:  disabled\n");
 #endif
@@ -65,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;
 }
 
@@ -207,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 2ec3a728d74ea5cb0a5ce9c43e60ecf57d48bd53..3ee8ba588dc20a8597c7642c2731ed024fa7e5ab 100644 (file)
@@ -69,25 +69,24 @@ long int initdram (int board_type)
 
 #define        SPI_RTC_CS_MASK 0x00000001
 
-void spi_rtc_chipsel(int cs)
+int spi_cs_is_valid(unsigned int bus, unsigned int cs)
+{
+       return bus == 0 && cs == 0;
+}
+
+void spi_cs_activate(struct spi_slave *slave)
 {
        nios_spi_t *spi = (nios_spi_t *)CFG_NIOS_SPIBASE;
 
-       if (cs)
-               spi->slaveselect = SPI_RTC_CS_MASK;     /* activate (1) */
-       else
-               spi->slaveselect = 0;                   /* deactivate (0) */
+       spi->slaveselect = SPI_RTC_CS_MASK;     /* activate (1) */
 }
 
-/*
- * The SPI command uses this table of functions for controlling the SPI
- * chip selects: it calls the appropriate function to control the SPI
- * chip selects.
- */
-spi_chipsel_type spi_chipsel[] = {
-       spi_rtc_chipsel
-};
-int spi_chipsel_cnt = sizeof(spi_chipsel) / sizeof(spi_chipsel[0]);
+void spi_cs_deactivate(struct spi_slave *slave)
+{
+       nios_spi_t *spi = (nios_spi_t *)CFG_NIOS_SPIBASE;
+
+       spi->slaveselect = 0;                   /* deactivate (0) */
+}
 
 #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);
similarity index 100%
rename from board/tqm834x/pci.c
rename to board/tqc/tqm834x/pci.c
similarity index 91%
rename from board/tqm85xx/Makefile
rename to board/tqc/tqm85xx/Makefile
index 52f5ef9454a4e3e8155574fa08bc017d633a25a2..8ea07f246863f12d75b668de186c48c4f23bf759 100644 (file)
@@ -25,8 +25,14 @@ include $(TOPDIR)/config.mk
 
 LIB    = $(obj)lib$(BOARD).a
 
-COBJS  := $(BOARD).o sdram.o law.o tlb.o
+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))
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/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 */
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 967879922722397337c7d0256bc6cfdd19056474..b425795e928a0c94581be39fbd540adf67069cfa 100644 (file)
@@ -113,6 +113,7 @@ COBJS-y += env_dataflash.o
 COBJS-y += env_flash.o
 COBJS-y += env_eeprom.o
 COBJS-y += env_onenand.o
+COBJS-y += env_sf.o
 COBJS-y += env_nvram.o
 COBJS-y += env_nowhere.o
 COBJS-y += exports.o
@@ -143,6 +144,7 @@ COBJS-y += xyzModem.o
 COBJS-y += cmd_mac.o
 COBJS-$(CONFIG_CMD_MFSL) += cmd_mfsl.o
 COBJS-$(CONFIG_MP) += cmd_mp.o
+COBJS-$(CONFIG_CMD_SF) += cmd_sf.o
 
 COBJS  := $(COBJS-y)
 SRCS   := $(AOBJS:.o=.S) $(COBJS:.o=.c)
diff --git a/common/cmd_df.c b/common/cmd_df.c
new file mode 100644 (file)
index 0000000..5f65044
--- /dev/null
@@ -0,0 +1,37 @@
+/*
+ * Command for accessing DataFlash.
+ *
+ * Copyright (C) 2008 Atmel Corporation
+ */
+#include <common.h>
+#include <df.h>
+
+static int do_df(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
+{
+       const char *cmd;
+
+       /* need at least two arguments */
+       if (argc < 2)
+               goto usage;
+
+       cmd = argv[1];
+
+       if (strcmp(cmd, "init") == 0) {
+               df_init(0, 0, 1000000);
+               return 0;
+       }
+
+       if (strcmp(cmd, "info") == 0) {
+               df_show_info();
+               return 0;
+       }
+
+usage:
+       printf("Usage:\n%s\n", cmdtp->usage);
+       return 1;
+}
+
+U_BOOT_CMD(
+       sf,     2,      1,      do_serial_flash,
+       "sf     - Serial flash sub-system\n",
+       "probe [bus:]cs         - init flash device on given SPI bus and CS\n")
index c6e72ac3c0ca3a84485e5b0b3ae924da13b13916..fdcc57571aa9d43a3a0ce849aa03ae453bf09c56 100644 (file)
@@ -66,6 +66,12 @@ static logbuff_t *log;
 #endif
 static char *lbuf;
 
+unsigned long __logbuffer_base(void)
+{
+       return CFG_SDRAM_BASE + gd->bd->bi_memsize - LOGBUFF_LEN;
+}
+unsigned long logbuffer_base (void) __attribute__((weak, alias("__logbuffer_base")));
+
 void logbuff_init_ptrs (void)
 {
        unsigned long tag, post_word;
@@ -75,7 +81,7 @@ void logbuff_init_ptrs (void)
        log = (logbuff_t *)CONFIG_ALT_LH_ADDR;
        lbuf = (char *)CONFIG_ALT_LB_ADDR;
 #else
-       log = (logbuff_t *)(gd->bd->bi_memsize-LOGBUFF_LEN) - 1;
+       log = (logbuff_t *)(logbuffer_base ()) - 1;
        lbuf = (char *)log->buf;
 #endif
 
index 37eb41b20e642363b0035dcbe7c18eb3787fa230..37198d21e8c6e1638f112a63205884317fba5af4 100644 (file)
@@ -37,8 +37,6 @@ int find_dev_and_part(const char *id, struct mtd_device **dev,
                u8 *part_num, struct part_info **part);
 #endif
 
-extern nand_info_t nand_info[];       /* info for NAND chips */
-
 static int nand_dump_oob(nand_info_t *nand, ulong off)
 {
        return 0;
index 9c5d1fcb9059e40b0f01ed29e88d2824e9fa8b3a..49f134a92e51eb797be0eada8429870905fe59e0 100644 (file)
@@ -58,8 +58,9 @@ DECLARE_GLOBAL_DATA_PTR;
     !defined(CFG_ENV_IS_IN_DATAFLASH)  && \
     !defined(CFG_ENV_IS_IN_NAND)       && \
     !defined(CFG_ENV_IS_IN_ONENAND)    && \
+    !defined(CFG_ENV_IS_IN_SPI_FLASH)  && \
     !defined(CFG_ENV_IS_NOWHERE)
-# error Define one of CFG_ENV_IS_IN_{NVRAM|EEPROM|FLASH|DATAFLASH|ONENAND|NOWHERE}
+# error Define one of CFG_ENV_IS_IN_{NVRAM|EEPROM|FLASH|DATAFLASH|ONENAND|SPI_FLASH|NOWHERE}
 #endif
 
 #define XMK_STR(x)     #x
diff --git a/common/cmd_sf.c b/common/cmd_sf.c
new file mode 100644 (file)
index 0000000..8c0a751
--- /dev/null
@@ -0,0 +1,191 @@
+/*
+ * Command for accessing SPI flash.
+ *
+ * Copyright (C) 2008 Atmel Corporation
+ */
+#include <common.h>
+#include <spi_flash.h>
+
+#include <asm/io.h>
+
+#ifndef CONFIG_SF_DEFAULT_SPEED
+# define CONFIG_SF_DEFAULT_SPEED       1000000
+#endif
+#ifndef CONFIG_SF_DEFAULT_MODE
+# define CONFIG_SF_DEFAULT_MODE                SPI_MODE_3
+#endif
+
+static struct spi_flash *flash;
+
+static int do_spi_flash_probe(int argc, char *argv[])
+{
+       unsigned int bus = 0;
+       unsigned int cs;
+       unsigned int speed = CONFIG_SF_DEFAULT_SPEED;
+       unsigned int mode = CONFIG_SF_DEFAULT_MODE;
+       char *endp;
+       struct spi_flash *new;
+
+       if (argc < 2)
+               goto usage;
+
+       cs = simple_strtoul(argv[1], &endp, 0);
+       if (*argv[1] == 0 || (*endp != 0 && *endp != ':'))
+               goto usage;
+       if (*endp == ':') {
+               if (endp[1] == 0)
+                       goto usage;
+
+               bus = cs;
+               cs = simple_strtoul(endp + 1, &endp, 0);
+               if (*endp != 0)
+                       goto usage;
+       }
+
+       if (argc >= 3) {
+               speed = simple_strtoul(argv[2], &endp, 0);
+               if (*argv[2] == 0 || *endp != 0)
+                       goto usage;
+       }
+       if (argc >= 4) {
+               mode = simple_strtoul(argv[3], &endp, 0);
+               if (*argv[3] == 0 || *endp != 0)
+                       goto usage;
+       }
+
+       new = spi_flash_probe(bus, cs, speed, mode);
+       if (!new) {
+               printf("Failed to initialize SPI flash at %u:%u\n", bus, cs);
+               return 1;
+       }
+
+       if (flash)
+               spi_flash_free(flash);
+       flash = new;
+
+       printf("%u KiB %s at %u:%u is now current device\n",
+                       flash->size >> 10, flash->name, bus, cs);
+
+       return 0;
+
+usage:
+       puts("Usage: sf probe [bus:]cs [hz] [mode]\n");
+       return 1;
+}
+
+static int do_spi_flash_read_write(int argc, char *argv[])
+{
+       unsigned long addr;
+       unsigned long offset;
+       unsigned long len;
+       void *buf;
+       char *endp;
+       int ret;
+
+       if (argc < 4)
+               goto usage;
+
+       addr = simple_strtoul(argv[1], &endp, 16);
+       if (*argv[1] == 0 || *endp != 0)
+               goto usage;
+       offset = simple_strtoul(argv[2], &endp, 16);
+       if (*argv[2] == 0 || *endp != 0)
+               goto usage;
+       len = simple_strtoul(argv[3], &endp, 16);
+       if (*argv[3] == 0 || *endp != 0)
+               goto usage;
+
+       buf = map_physmem(addr, len, MAP_WRBACK);
+       if (!buf) {
+               puts("Failed to map physical memory\n");
+               return 1;
+       }
+
+       if (strcmp(argv[0], "read") == 0)
+               ret = spi_flash_read(flash, offset, len, buf);
+       else
+               ret = spi_flash_write(flash, offset, len, buf);
+
+       unmap_physmem(buf, len);
+
+       if (ret) {
+               printf("SPI flash %s failed\n", argv[0]);
+               return 1;
+       }
+
+       return 0;
+
+usage:
+       printf("Usage: sf %s addr offset len\n", argv[0]);
+       return 1;
+}
+
+static int do_spi_flash_erase(int argc, char *argv[])
+{
+       unsigned long offset;
+       unsigned long len;
+       char *endp;
+       int ret;
+
+       if (argc < 3)
+               goto usage;
+
+       offset = simple_strtoul(argv[1], &endp, 16);
+       if (*argv[1] == 0 || *endp != 0)
+               goto usage;
+       len = simple_strtoul(argv[2], &endp, 16);
+       if (*argv[2] == 0 || *endp != 0)
+               goto usage;
+
+       ret = spi_flash_erase(flash, offset, len);
+       if (ret) {
+               printf("SPI flash %s failed\n", argv[0]);
+               return 1;
+       }
+
+       return 0;
+
+usage:
+       puts("Usage: sf erase offset len\n");
+       return 1;
+}
+
+static int do_spi_flash(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
+{
+       const char *cmd;
+
+       /* need at least two arguments */
+       if (argc < 2)
+               goto usage;
+
+       cmd = argv[1];
+
+       if (strcmp(cmd, "probe") == 0)
+               return do_spi_flash_probe(argc - 1, argv + 1);
+
+       /* The remaining commands require a selected device */
+       if (!flash) {
+               puts("No SPI flash selected. Please run `sf probe'\n");
+               return 1;
+       }
+
+       if (strcmp(cmd, "read") == 0 || strcmp(cmd, "write") == 0)
+               return do_spi_flash_read_write(argc - 1, argv + 1);
+       if (strcmp(cmd, "erase") == 0)
+               return do_spi_flash_erase(argc - 1, argv + 1);
+
+usage:
+       printf("Usage:\n%s\n", cmdtp->usage);
+       return 1;
+}
+
+U_BOOT_CMD(
+       sf,     5,      1,      do_spi_flash,
+       "sf     - SPI flash sub-system\n",
+       "probe [bus:]cs [hz] [mode]     - init flash device on given SPI bus\n"
+       "                                 and chip select\n"
+       "sf read addr offset len        - read `len' bytes starting at\n"
+       "                                 `offset' to memory at `addr'\n"
+       "sf write addr offset len       - write `len' bytes from memory\n"
+       "                                 at `addr' to flash at `offset'\n"
+       "sf erase offset len            - erase `len' bytes from `offset'\n");
index 76044221416c9fbd194828b6f4c6bd35fdd461fd..40ee7e7dd3c7daa08270fbfc72d0d7967d92077c 100644 (file)
 #   define MAX_SPI_BYTES 32    /* Maximum number of bytes we can handle */
 #endif
 
-/*
- * External table of chip select functions (see the appropriate board
- * support for the actual definition of the table).
- */
-extern spi_chipsel_type spi_chipsel[];
-extern int spi_chipsel_cnt;
+#ifndef CONFIG_DEFAULT_SPI_BUS
+#   define CONFIG_DEFAULT_SPI_BUS      0
+#endif
+#ifndef CONFIG_DEFAULT_SPI_MODE
+#   define CONFIG_DEFAULT_SPI_MODE     SPI_MODE_0
+#endif
 
 /*
  * Values from last command.
  */
-static int   device;
-static int   bitlen;
-static uchar dout[MAX_SPI_BYTES];
-static uchar din[MAX_SPI_BYTES];
+static unsigned int    device;
+static int             bitlen;
+static uchar           dout[MAX_SPI_BYTES];
+static uchar           din[MAX_SPI_BYTES];
 
 /*
  * SPI read/write
@@ -65,6 +65,7 @@ static uchar din[MAX_SPI_BYTES];
 
 int do_spi (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
 {
+       struct spi_slave *slave;
        char  *cp = 0;
        uchar tmp;
        int   j;
@@ -101,19 +102,24 @@ int do_spi (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
                }
        }
 
-       if ((device < 0) || (device >=  spi_chipsel_cnt)) {
-               printf("Invalid device %d, giving up.\n", device);
-               return 1;
-       }
        if ((bitlen < 0) || (bitlen >  (MAX_SPI_BYTES * 8))) {
                printf("Invalid bitlen %d, giving up.\n", bitlen);
                return 1;
        }
 
-       debug ("spi_chipsel[%d] = %08X\n",
-               device, (uint)spi_chipsel[device]);
+       /* FIXME: Make these parameters run-time configurable */
+       slave = spi_setup_slave(CONFIG_DEFAULT_SPI_BUS, device, 1000000,
+                       CONFIG_DEFAULT_SPI_MODE);
+       if (!slave) {
+               printf("Invalid device %d, giving up.\n", device);
+               return 1;
+       }
+
+       debug ("spi chipsel = %08X\n", device);
 
-       if(spi_xfer(spi_chipsel[device], bitlen, dout, din) != 0) {
+       spi_claim_bus(slave);
+       if(spi_xfer(slave, bitlen, dout, din,
+                               SPI_XFER_BEGIN | SPI_XFER_END) != 0) {
                printf("Error with the SPI transaction.\n");
                rcode = 1;
        } else {
@@ -123,6 +129,8 @@ int do_spi (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
                }
                printf("\n");
        }
+       spi_release_bus(slave);
+       spi_free_slave(slave);
 
        return rcode;
 }
index 20c206913c63d2fcd1588fc0f0ae3baaae10940a..c51351e9618ec92ce81ca93f6d6303b39a8ceadb 100644 (file)
@@ -1,3 +1,5 @@
+#include <common.h>
+
 #if 0  /* Moved to malloc.h */
 /* ---------- To make a malloc.h, start cutting here ------------ */
 
@@ -947,7 +949,6 @@ void malloc_stats();
 #endif /* 0 */
 
 #endif /* 0 */                 /* Moved to malloc.h */
-#include <common.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
index a49481244e2f7ae3c64c1829201161edee3436a1..e6df9a5883db38e45f909ad9500a7f6253c4cd12 100644 (file)
@@ -134,7 +134,8 @@ uchar default_environment[] = {
        "\0"
 };
 
-#if defined(CFG_ENV_IS_IN_NAND)                /* Environment is in Nand Flash */
+#if defined(CFG_ENV_IS_IN_NAND)                /* Environment is in Nand Flash */ \
+       || defined(CFG_ENV_IS_IN_SPI_FLASH)
 int default_environment_size = sizeof(default_environment);
 #endif
 
index 70d05ad15a2086ec53f071d8ff43196f3506306e..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);
 
-/* info for NAND chips, defined in drivers/mtd/nand/nand.c */
-extern nand_info_t nand_info[];
-
 /* references to names in env_common.c */
 extern uchar default_environment[];
 extern int default_environment_size;
@@ -151,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);
@@ -191,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;
@@ -207,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)
 {
@@ -220,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);
@@ -272,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();
 
diff --git a/common/env_sf.c b/common/env_sf.c
new file mode 100644 (file)
index 0000000..d641a9a
--- /dev/null
@@ -0,0 +1,131 @@
+/*
+ * (C) Copyright 2000-2002
+ * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
+ *
+ * (C) Copyright 2001 Sysgo Real-Time Solutions, GmbH <www.elinos.com>
+ * Andreas Heppel <aheppel@sysgo.de>
+ *
+ * (C) Copyright 2008 Atmel Corporation
+ *
+ * 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>
+
+#ifdef CFG_ENV_IS_IN_SPI_FLASH
+
+#include <environment.h>
+#include <spi_flash.h>
+
+#ifndef CFG_ENV_SPI_BUS
+# define CFG_ENV_SPI_BUS       0
+#endif
+#ifndef CFG_ENV_SPI_CS
+# define CFG_ENV_SPI_CS                0
+#endif
+#ifndef CFG_ENV_SPI_MAX_HZ
+# define CFG_ENV_SPI_MAX_HZ    1000000
+#endif
+#ifndef CFG_ENV_SPI_MODE
+# define CFG_ENV_SPI_MODE      SPI_MODE_3
+#endif
+
+DECLARE_GLOBAL_DATA_PTR;
+
+/* references to names in env_common.c */
+extern uchar default_environment[];
+extern int default_environment_size;
+
+char * env_name_spec = "SPI Flash";
+env_t *env_ptr;
+
+static struct spi_flash *env_flash;
+
+uchar env_get_char_spec(int index)
+{
+       return *((uchar *)(gd->env_addr + index));
+}
+
+int saveenv(void)
+{
+       if (!env_flash) {
+               puts("Environment SPI flash not initialized\n");
+               return 1;
+       }
+
+       puts("Erasing SPI flash...");
+       if (spi_flash_erase(env_flash, CFG_ENV_OFFSET, CFG_ENV_SIZE))
+               return 1;
+
+       puts("Writing to SPI flash...");
+       if (spi_flash_write(env_flash, CFG_ENV_OFFSET, CFG_ENV_SIZE, env_ptr))
+               return 1;
+
+       puts("done\n");
+       return 0;
+}
+
+void env_relocate_spec(void)
+{
+       int ret;
+
+       env_flash = spi_flash_probe(CFG_ENV_SPI_BUS, CFG_ENV_SPI_CS,
+                       CFG_ENV_SPI_MAX_HZ, CFG_ENV_SPI_MODE);
+       if (!env_flash)
+               goto err_probe;
+
+       ret = spi_flash_read(env_flash, CFG_ENV_OFFSET, CFG_ENV_SIZE, env_ptr);
+       if (ret)
+               goto err_read;
+
+       if (crc32(0, env_ptr->data, ENV_SIZE) != env_ptr->crc)
+               goto err_crc;
+
+       gd->env_valid = 1;
+
+       return;
+
+err_read:
+       spi_flash_free(env_flash);
+       env_flash = NULL;
+err_probe:
+err_crc:
+       puts("*** Warning - bad CRC, using default environment\n\n");
+
+       if (default_environment_size > CFG_ENV_SIZE) {
+               gd->env_valid = 0;
+               puts("*** Error - default environment is too large\n\n");
+               return;
+       }
+
+       memset(env_ptr, 0, sizeof(env_t));
+       memcpy(env_ptr->data, default_environment, default_environment_size);
+       env_ptr->crc = crc32(0, env_ptr->data, ENV_SIZE);
+       gd->env_valid = 1;
+}
+
+int env_init(void)
+{
+       /* SPI flash isn't usable before relocation */
+       gd->env_addr = (ulong)&default_environment[0];
+       gd->env_valid = 1;
+
+       return 0;
+}
+
+#endif /* CFG_ENV_IS_IN_SPI_FLASH */
index 67e594df6939056801e2003d710f87c044277eda..9188024802d7b9f0cd87e08c048047c55e3c08b6 100644 (file)
 #include <dataflash.h>
 #endif
 
+#ifdef CONFIG_LOGBUFFER
+#include <logbuff.h>
+#endif
+
 #if defined(CONFIG_TIMESTAMP) || defined(CONFIG_CMD_DATE)
 #include <rtc.h>
 #endif
@@ -1013,6 +1017,12 @@ int boot_ramdisk_high (struct lmb *lmb, ulong rd_data, ulong rd_len,
                initrd_high = ~0;
        }
 
+
+#ifdef CONFIG_LOGBUFFER
+       /* Prevent initrd from overwriting logbuffer */
+       lmb_reserve(lmb, logbuffer_base() - LOGBUFF_OVERHEAD, LOGBUFF_RESERVE);
+#endif
+
        debug ("## initrd_high = 0x%08lx, copy_to_ram = %d\n",
                        initrd_high, initrd_copy_to_ram);
 
index 914dc2ef7ca5b1f30d1238317213e32650c9018d..ebf377aa89d4e3202917268728629925ab44f051 100644 (file)
 #include <lcdvideo.h>
 #endif
 
+#if defined(CONFIG_ATMEL_LCD)
+#include <atmel_lcdc.h>
+#include <nand.h>
+#endif
+
 #ifdef CONFIG_LCD
 
 /************************************************************************/
@@ -474,14 +479,22 @@ ulong lcd_setmem (ulong addr)
 
 static void lcd_setfgcolor (int color)
 {
+#ifdef CONFIG_ATMEL_LCD
+       lcd_color_fg = color;
+#else
        lcd_color_fg = color & 0x0F;
+#endif
 }
 
 /*----------------------------------------------------------------------*/
 
 static void lcd_setbgcolor (int color)
 {
+#ifdef CONFIG_ATMEL_LCD
+       lcd_color_bg = color;
+#else
        lcd_color_bg = color & 0x0F;
+#endif
 }
 
 /*----------------------------------------------------------------------*/
@@ -508,7 +521,11 @@ static int lcd_getbgcolor (void)
 #ifdef CONFIG_LCD_LOGO
 void bitmap_plot (int x, int y)
 {
+#ifdef CONFIG_ATMEL_LCD
+       uint *cmap;
+#else
        ushort *cmap;
+#endif
        ushort i, j;
        uchar *bmap;
        uchar *fb;
@@ -533,6 +550,8 @@ void bitmap_plot (int x, int y)
                cmap = (ushort *)fbi->palette;
 #elif defined(CONFIG_MPC823)
                cmap = (ushort *)&(cp->lcd_cmap[BMP_LOGO_OFFSET*sizeof(ushort)]);
+#elif defined(CONFIG_ATMEL_LCD)
+               cmap = (uint *) (panel_info.mmio + ATMEL_LCDC_LUT(0));
 #endif
 
                WATCHDOG_RESET();
@@ -540,11 +559,26 @@ void bitmap_plot (int x, int y)
                /* Set color map */
                for (i=0; i<(sizeof(bmp_logo_palette)/(sizeof(ushort))); ++i) {
                        ushort colreg = bmp_logo_palette[i];
+#ifdef CONFIG_ATMEL_LCD
+                       uint lut_entry;
+#ifdef CONFIG_ATMEL_LCD_BGR555
+                       lut_entry = ((colreg & 0x000F) << 11) |
+                                   ((colreg & 0x00F0) <<  2) |
+                                   ((colreg & 0x0F00) >>  7);
+#else /* CONFIG_ATMEL_LCD_RGB565 */
+                       lut_entry = ((colreg & 0x000F) << 1) |
+                                   ((colreg & 0x00F0) << 3) |
+                                   ((colreg & 0x0F00) << 4);
+#endif
+                       *(cmap + BMP_LOGO_OFFSET) = lut_entry;
+                       cmap++;
+#else /* !CONFIG_ATMEL_LCD */
 #ifdef  CFG_INVERT_COLORS
                        *cmap++ = 0xffff - colreg;
 #else
                        *cmap++ = colreg;
 #endif
+#endif /* CONFIG_ATMEL_LCD */
                }
 
                WATCHDOG_RESET();
@@ -578,7 +612,9 @@ void bitmap_plot (int x, int y)
  */
 int lcd_display_bitmap(ulong bmp_image, int x, int y)
 {
-#if !defined(CONFIG_MCC200)
+#ifdef CONFIG_ATMEL_LCD
+       uint *cmap;
+#elif !defined(CONFIG_MCC200)
        ushort *cmap;
 #endif
        ushort i, j;
@@ -633,6 +669,8 @@ int lcd_display_bitmap(ulong bmp_image, int x, int y)
                cmap = (ushort *)fbi->palette;
 #elif defined(CONFIG_MPC823)
                cmap = (ushort *)&(cp->lcd_cmap[255*sizeof(ushort)]);
+#elif defined(CONFIG_ATMEL_LCD)
+               cmap = (uint *) (panel_info.mmio + ATMEL_LCDC_LUT(0));
 #else
 # error "Don't know location of color map"
 #endif
@@ -708,6 +746,10 @@ static void *lcd_logo (void)
 #ifdef CONFIG_LCD_INFO
        char info[80];
        char temp[32];
+#ifdef CONFIG_ATMEL_LCD
+       int i;
+       ulong dram_size, nand_size;
+#endif
 #endif /* CONFIG_LCD_INFO */
 
 #ifdef CONFIG_SPLASH_SCREEN
@@ -765,6 +807,40 @@ static void *lcd_logo (void)
 # endif /* CONFIG_LCD_INFO */
 #endif /* CONFIG_MPC823 */
 
+#ifdef CONFIG_ATMEL_LCD
+# ifdef CONFIG_LCD_INFO
+       sprintf (info, "%s", U_BOOT_VERSION);
+       lcd_drawchars (LCD_INFO_X, LCD_INFO_Y, (uchar *)info, strlen(info));
+
+       sprintf (info, "(C) 2008 ATMEL Corp");
+       lcd_drawchars (LCD_INFO_X, LCD_INFO_Y + VIDEO_FONT_HEIGHT,
+                                       (uchar *)info, strlen(info));
+
+       sprintf (info, "at91support@atmel.com");
+       lcd_drawchars (LCD_INFO_X, LCD_INFO_Y + VIDEO_FONT_HEIGHT * 2,
+                                       (uchar *)info, strlen(info));
+
+       sprintf (info, "%s CPU at %s MHz",
+               AT91_CPU_NAME,
+               strmhz(temp, AT91_MAIN_CLOCK));
+       lcd_drawchars (LCD_INFO_X, LCD_INFO_Y + VIDEO_FONT_HEIGHT * 3,
+                                       (uchar *)info, strlen(info));
+
+       dram_size = 0;
+       for (i = 0; i < CONFIG_NR_DRAM_BANKS; i++)
+               dram_size += gd->bd->bi_dram[i].size;
+       nand_size = 0;
+       for (i = 0; i < CFG_MAX_NAND_DEVICE; i++)
+               nand_size += nand_info[i].size;
+       sprintf (info, "  %ld MB SDRAM, %ld MB NAND",
+               dram_size >> 20,
+               nand_size >> 20 );
+       lcd_drawchars (LCD_INFO_X, LCD_INFO_Y + VIDEO_FONT_HEIGHT * 4,
+                                       (uchar *)info, strlen(info));
+# endif /* CONFIG_LCD_INFO */
+#endif /* CONFIG_ATMEL_LCD */
+
+
 #if defined(CONFIG_LCD_LOGO) && !defined(CONFIG_LCD_INFO_BELOW_LOGO)
        return ((void *)((ulong)lcd_base + BMP_LOGO_HEIGHT * lcd_line_length));
 #else
index a17b60b3aa92cecc9b4bbcaf78c83a84af8d7a8f..046da6f23ca488d02f3fb900c48fc2b96caafb9e 100644 (file)
@@ -940,12 +940,6 @@ int readline_into_buffer (const char *const prompt, char * buffer)
        int rc;
        static int initted = 0;
 
-       if (!initted) {
-               hist_init();
-               initted = 1;
-       }
-
-
        /*
         * History uses a global array which is not
         * writable until after relocation to RAM.
index c5d7e205e5442d87cec9530b212bf873e7fc9bf3..5ef7f303b8435d52a5ccb8151d316b8e79141ada 100644 (file)
@@ -252,6 +252,7 @@ static uchar read_byte(int ack)
         * Read 8 bits, MSB first.
         */
        I2C_TRISTATE;
+       I2C_SDA(1);
        data = 0;
        for(j = 0; j < 8; j++) {
                I2C_SCL(0);
index e4250616c2858943110fcabefa56513a32eee634..c13165030db6e5edb71ef78491039977d3ef0ae0 100644 (file)
@@ -29,6 +29,8 @@
 
 #if defined(CONFIG_SOFT_SPI)
 
+#include <malloc.h>
+
 /*-----------------------------------------------------------------------
  * Definitions
  */
 #define PRINTD(fmt,args...)
 #endif
 
+struct soft_spi_slave {
+       struct spi_slave slave;
+       unsigned int mode;
+};
+
+static inline struct soft_spi_slave *to_soft_spi(struct spi_slave *slave)
+{
+       return container_of(slave, struct soft_spi_slave, slave);
+}
 
 /*=====================================================================*/
 /*                         Public Functions                            */
@@ -56,6 +67,57 @@ void spi_init (void)
 #endif
 }
 
+struct spi_slave *spi_setup_slave(unsigned int bus, unsigned int cs,
+               unsigned int max_hz, unsigned int mode)
+{
+       struct soft_spi_slave *ss;
+
+       if (!spi_cs_is_valid(bus, cs))
+               return NULL;
+
+       ss = malloc(sizeof(struct soft_spi_slave));
+       if (!ss)
+               return NULL;
+
+       ss->slave.bus = bus;
+       ss->slave.cs = cs;
+       ss->mode = mode;
+
+       /* TODO: Use max_hz to limit the SCK rate */
+
+       return &ss->slave;
+}
+
+void spi_free_slave(struct spi_slave *slave)
+{
+       struct soft_spi_slave *ss = to_soft_spi(slave);
+
+       free(ss);
+}
+
+int spi_claim_bus(struct spi_slave *slave)
+{
+#ifdef CFG_IMMR
+       volatile immap_t *immr = (immap_t *)CFG_IMMR;
+#endif
+       struct soft_spi_slave *ss = to_soft_spi(slave);
+
+       /*
+        * Make sure the SPI clock is in idle state as defined for
+        * this slave.
+        */
+       if (ss->mode & SPI_CPOL)
+               SPI_SCL(1);
+       else
+               SPI_SCL(0);
+
+       return 0;
+}
+
+void spi_release_bus(struct spi_slave *slave)
+{
+       /* Nothing to do */
+}
 
 /*-----------------------------------------------------------------------
  * SPI transfer
@@ -68,50 +130,54 @@ void spi_init (void)
  * and "din" can point to the same memory location, in which case the
  * input data overwrites the output data (since both are buffered by
  * temporary variables, this is OK).
- *
- * If the chipsel() function is not NULL, it is called with a parameter
- * of '1' (chip select active) at the start of the transfer and again with
- * a parameter of '0' at the end of the transfer.
- *
- * If the chipsel() function _is_ NULL, it the responsibility of the
- * caller to make the appropriate chip select active before calling
- * spi_xfer() and making it inactive after spi_xfer() returns.
  */
-int  spi_xfer(spi_chipsel_type chipsel, int bitlen, uchar *dout, uchar *din)
+int  spi_xfer(struct spi_slave *slave, unsigned int bitlen,
+               const void *dout, void *din, unsigned long flags)
 {
 #ifdef CFG_IMMR
        volatile immap_t *immr = (immap_t *)CFG_IMMR;
 #endif
-       uchar tmpdin  = 0;
-       uchar tmpdout = 0;
-       int   j;
+       struct soft_spi_slave *ss = to_soft_spi(slave);
+       uchar           tmpdin  = 0;
+       uchar           tmpdout = 0;
+       const u8        *txd = dout;
+       u8              *rxd = din;
+       int             cpol = ss->mode & SPI_CPOL;
+       int             cpha = ss->mode & SPI_CPHA;
+       unsigned int    j;
 
-       PRINTD("spi_xfer: chipsel %08X dout %08X din %08X bitlen %d\n",
-               (int)chipsel, *(uint *)dout, *(uint *)din, bitlen);
+       PRINTD("spi_xfer: slave %u:%u dout %08X din %08X bitlen %u\n",
+               slave->bus, slave->cs, *(uint *)txd, *(uint *)rxd, bitlen);
 
-       if(chipsel != NULL) {
-               (*chipsel)(1);  /* select the target chip */
-       }
+       if (flags & SPI_XFER_BEGIN)
+               spi_cs_activate(slave);
 
        for(j = 0; j < bitlen; j++) {
                /*
                 * Check if it is time to work on a new byte.
                 */
                if((j % 8) == 0) {
-                       tmpdout = *dout++;
+                       tmpdout = *txd++;
                        if(j != 0) {
-                               *din++ = tmpdin;
+                               *rxd++ = tmpdin;
                        }
                        tmpdin  = 0;
                }
-               SPI_SCL(0);
+
+               if (!cpha)
+                       SPI_SCL(!cpol);
                SPI_SDA(tmpdout & 0x80);
                SPI_DELAY;
-               SPI_SCL(1);
+               if (cpha)
+                       SPI_SCL(!cpol);
+               else
+                       SPI_SCL(cpol);
+               tmpdin  <<= 1;
+               tmpdin  |= SPI_READ;
+               tmpdout <<= 1;
                SPI_DELAY;
-               tmpdin  <<= 1;
-               tmpdin   |= SPI_READ;
-               tmpdout <<= 1;
+               if (cpha)
+                       SPI_SCL(cpol);
        }
        /*
         * If the number of bits isn't a multiple of 8, shift the last
@@ -120,14 +186,10 @@ int  spi_xfer(spi_chipsel_type chipsel, int bitlen, uchar *dout, uchar *din)
         */
        if((bitlen % 8) != 0)
                tmpdin <<= 8 - (bitlen % 8);
-       *din++ = tmpdin;
-
-       SPI_SCL(0);             /* SPI wants the clock left low for idle */
+       *rxd++ = tmpdin;
 
-       if(chipsel != NULL) {
-               (*chipsel)(0);  /* deselect the target chip */
-
-       }
+       if (flags & SPI_XFER_END)
+               spi_cs_deactivate(slave);
 
        return(0);
 }
index b5834b91e3e054ef4506777b9b8f1fa2e536a27d..42b0f72ac048db8fae7e3824d975d32faa23d52e 100644 (file)
@@ -316,7 +316,7 @@ invalidate_bats:
        mtspr   IBAT1U, r0
        mtspr   IBAT2U, r0
        mtspr   IBAT3U, r0
-#ifdef CONFIG_750FX
+#ifdef CONFIG_HIGH_BATS
        mtspr   IBAT4U, r0
        mtspr   IBAT5U, r0
        mtspr   IBAT6U, r0
@@ -327,7 +327,7 @@ invalidate_bats:
        mtspr   DBAT1U, r0
        mtspr   DBAT2U, r0
        mtspr   DBAT3U, r0
-#ifdef CONFIG_750FX
+#ifdef CONFIG_HIGH_BATS
        mtspr   DBAT4U, r0
        mtspr   DBAT5U, r0
        mtspr   DBAT6U, r0
@@ -414,7 +414,7 @@ setup_bats:
        mtspr   DBAT3U, r3
        isync
 
-#ifdef CONFIG_750FX
+#ifdef CONFIG_HIGH_BATS
        /* IBAT 4 */
        addis   r4, r0, CFG_IBAT4L@h
        ori     r4, r4, CFG_IBAT4L@l
index ca2cae181bce4f63cc14566f2408a11f62fd30c8..83040ebe737e05698e02c67f191e7cd44cd065c9 100644 (file)
@@ -1,2 +1,3 @@
 PLATFORM_CPPFLAGS += -march=armv5te
 PLATFORM_CPPFLAGS += $(call cc-option,-mtune=arm926ejs,)
+LDSCRIPT := $(SRCTREE)/cpu/arm926ejs/at91sam9/u-boot.lds
index 441349df3af29f2b3cca0adb4c04843699107e66..2a92f734ddc7579463c687d3adaf4eb5f0d7f762 100644 (file)
@@ -33,7 +33,11 @@ int usb_cpu_init(void)
 {
        /* Enable USB host clock. */
        at91_sys_write(AT91_PMC_PCER, 1 << AT91_ID_UHP);
+#ifdef CONFIG_AT91SAM9261
+       at91_sys_write(AT91_PMC_SCER, AT91_PMC_UHP | AT91_PMC_HCK0);
+#else
        at91_sys_write(AT91_PMC_SCER, AT91_PMC_UHP);
+#endif
 
        return 0;
 }
@@ -42,7 +46,11 @@ int usb_cpu_stop(void)
 {
        /* Disable USB host clock. */
        at91_sys_write(AT91_PMC_PCDR, 1 << AT91_ID_UHP);
+#ifdef CONFIG_AT91SAM9261
+       at91_sys_write(AT91_PMC_SCDR, AT91_PMC_UHP | AT91_PMC_HCK0);
+#else
        at91_sys_write(AT91_PMC_SCDR, AT91_PMC_UHP);
+#endif
        return 0;
 }
 
index f69b1f3854665226d669a8b2a4aabcc98e73c78b..d16c58b77388f368a4d680f2480fa8d30e3f1f33 100644 (file)
@@ -27,13 +27,19 @@ include $(TOPDIR)/config.mk
 
 LIB    := $(obj)lib$(CPU).a
 
-START  := start.o
-SOBJS  := entry.o
-COBJS  := cpu.o hsdramc.o exception.o cache.o
-COBJS  += interrupts.o pio.o atmel_mci.o
-SRCS   := $(START:.o=.S) $(SOBJS:.o=.S) $(COBJS:.o=.c)
-OBJS   := $(addprefix $(obj),$(SOBJS) $(COBJS))
-START  := $(addprefix $(obj),$(START))
+START-y                        += start.o
+
+COBJS-y                        += cpu.o
+COBJS-y                        += hsdramc.o
+COBJS-y                        += exception.o
+COBJS-y                        += cache.o
+COBJS-y                        += interrupts.o
+COBJS-y                        += pio.o
+COBJS-$(CONFIG_MMC)    += atmel_mci.o
+
+SRCS   := $(START-y:.o=.S) $(SOBJS-y:.o=.S) $(COBJS-y:.o=.c)
+OBJS   := $(addprefix $(obj),$(SOBJS-y) $(COBJS-y))
+START  := $(addprefix $(obj),$(START-y))
 
 all: $(obj).depend $(START) $(LIB)
 
index d2767121184acbe3b48127452e20695299065a40..740423563ed9d2411fde722946eb157714e83111 100644 (file)
@@ -24,7 +24,7 @@ include $(TOPDIR)/config.mk
 
 LIB    := $(obj)lib$(SOC).a
 
-COBJS  := gpio.o
+COBJS  := gpio.o clk.o
 SRCS   := $(SOBJS:.o=.S) $(COBJS:.o=.c)
 OBJS   := $(addprefix $(obj),$(SOBJS) $(COBJS))
 
diff --git a/cpu/at32ap/at32ap700x/clk.c b/cpu/at32ap/at32ap700x/clk.c
new file mode 100644 (file)
index 0000000..b3aa034
--- /dev/null
@@ -0,0 +1,68 @@
+/*
+ * Copyright (C) 2005-2008 Atmel Corporation
+ *
+ * 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/io.h>
+
+#include <asm/arch/clk.h>
+#include <asm/arch/memory-map.h>
+
+#include "sm.h"
+
+void clk_init(void)
+{
+       uint32_t cksel;
+
+       /* in case of soft resets, disable watchdog */
+       sm_writel(WDT_CTRL, SM_BF(KEY, 0x55));
+       sm_writel(WDT_CTRL, SM_BF(KEY, 0xaa));
+
+#ifdef CONFIG_PLL
+       /* Initialize the PLL */
+       sm_writel(PM_PLL0, (SM_BF(PLLCOUNT, CFG_PLL0_SUPPRESS_CYCLES)
+                           | SM_BF(PLLMUL, CFG_PLL0_MUL - 1)
+                           | SM_BF(PLLDIV, CFG_PLL0_DIV - 1)
+                           | SM_BF(PLLOPT, CFG_PLL0_OPT)
+                           | SM_BF(PLLOSC, 0)
+                           | SM_BIT(PLLEN)));
+
+       /* Wait for lock */
+       while (!(sm_readl(PM_ISR) & SM_BIT(LOCK0))) ;
+#endif
+
+       /* Set up clocks for the CPU and all peripheral buses */
+       cksel = 0;
+       if (CFG_CLKDIV_CPU)
+               cksel |= SM_BIT(CPUDIV) | SM_BF(CPUSEL, CFG_CLKDIV_CPU - 1);
+       if (CFG_CLKDIV_HSB)
+               cksel |= SM_BIT(HSBDIV) | SM_BF(HSBSEL, CFG_CLKDIV_HSB - 1);
+       if (CFG_CLKDIV_PBA)
+               cksel |= SM_BIT(PBADIV) | SM_BF(PBASEL, CFG_CLKDIV_PBA - 1);
+       if (CFG_CLKDIV_PBB)
+               cksel |= SM_BIT(PBBDIV) | SM_BF(PBBSEL, CFG_CLKDIV_PBB - 1);
+       sm_writel(PM_CKSEL, cksel);
+
+#ifdef CONFIG_PLL
+       /* Use PLL0 as main clock */
+       sm_writel(PM_MCCTRL, SM_BIT(PLLSEL));
+#endif
+}
index 859124a91f6b8b4e1c7c80094bb3245750beaa3f..3da35d4fe231c4c882c0551113a9b2e8dbcd3d0d 100644 (file)
  */
 #include <common.h>
 
+#include <asm/io.h>
+
 #include <asm/arch/chip-features.h>
 #include <asm/arch/gpio.h>
+#include <asm/arch/memory-map.h>
 
 /*
  * Lots of small functions here. We depend on --gc-sections getting
@@ -142,3 +145,43 @@ void gpio_enable_mmci(void)
        gpio_select_periph_A(GPIO_PIN_PA15, 0); /* DATA3 */
 }
 #endif
+
+#ifdef AT32AP700x_CHIP_HAS_SPI
+void gpio_enable_spi0(unsigned long cs_mask)
+{
+       u32 pa_mask = 0;
+
+       gpio_select_periph_A(GPIO_PIN_PA0,  0); /* MISO */
+       gpio_select_periph_A(GPIO_PIN_PA1,  0); /* MOSI */
+       gpio_select_periph_A(GPIO_PIN_PA2,  0); /* SCK  */
+
+       if (cs_mask & (1 << 0))
+               pa_mask |= 1 << 3;      /* NPCS0 */
+       if (cs_mask & (1 << 1))
+               pa_mask |= 1 << 4;      /* NPCS1 */
+       if (cs_mask & (1 << 2))
+               pa_mask |= 1 << 5;      /* NPCS2 */
+       if (cs_mask & (1 << 3))
+               pa_mask |= 1 << 20;     /* NPCS3 */
+
+       __raw_writel(pa_mask, PIOA_BASE + 0x00);
+       __raw_writel(pa_mask, PIOA_BASE + 0x30);
+       __raw_writel(pa_mask, PIOA_BASE + 0x10);
+}
+
+void gpio_enable_spi1(unsigned long cs_mask)
+{
+       gpio_select_periph_B(GPIO_PIN_PA0,  0); /* MISO */
+       gpio_select_periph_B(GPIO_PIN_PB1,  0); /* MOSI */
+       gpio_select_periph_B(GPIO_PIN_PB5,  0); /* SCK  */
+
+       if (cs_mask & (1 << 0))
+               gpio_select_periph_B(GPIO_PIN_PB2,  0); /* NPCS0 */
+       if (cs_mask & (1 << 1))
+               gpio_select_periph_B(GPIO_PIN_PB3,  0); /* NPCS1 */
+       if (cs_mask & (1 << 2))
+               gpio_select_periph_B(GPIO_PIN_PB4,  0); /* NPCS2 */
+       if (cs_mask & (1 << 3))
+               gpio_select_periph_A(GPIO_PIN_PA27, 0); /* NPCS3 */
+}
+#endif
similarity index 100%
rename from cpu/at32ap/sm.h
rename to cpu/at32ap/at32ap700x/sm.h
index f59dfb5995e1c7d3dfc6b987d586b93fb0aeba90..3795addf05af60ca10e69d6e6d8e7bf086e7f3b1 100644 (file)
@@ -21,8 +21,6 @@
  */
 #include <common.h>
 
-#ifdef CONFIG_MMC
-
 #include <part.h>
 #include <mmc.h>
 
@@ -139,7 +137,7 @@ mmc_cmd(unsigned long cmd, unsigned long arg,
 
        pr_debug("mmc: status 0x%08lx\n", status);
 
-       if (status & ERROR_FLAGS) {
+       if (status & error_flags) {
                printf("mmc: command %lu failed (status: 0x%08lx)\n",
                       cmd, status);
                return -EIO;
@@ -182,12 +180,13 @@ static int mmc_acmd(unsigned long cmd, unsigned long arg,
 
 static unsigned long
 mmc_bread(int dev, unsigned long start, lbaint_t blkcnt,
-         unsigned long *buffer)
+         void *buffer)
 {
        int ret, i = 0;
        unsigned long resp[4];
        unsigned long card_status, data;
        unsigned long wordcount;
+       u32 *p = buffer;
        u32 status;
 
        if (blkcnt == 0)
@@ -225,7 +224,7 @@ mmc_bread(int dev, unsigned long start, lbaint_t blkcnt,
                        if (status & MMCI_BIT(RXRDY)) {
                                data = mmci_readl(RDR);
                                /* pr_debug("%x\n", data); */
-                               *buffer++ = data;
+                               *p++ = data;
                                wordcount++;
                        }
                } while(wordcount < (mmc_blkdev.blksz / 4));
@@ -443,6 +442,7 @@ static void mci_set_data_timeout(struct mmc_csd *csd)
 
        dtocyc = timeout_clks;
        dtomul = 0;
+       shift = 0;
        while (dtocyc > 15 && dtomul < 8) {
                dtomul++;
                shift = dtomul_to_shift[dtomul];
@@ -546,5 +546,3 @@ int mmc2info(ulong addr)
 {
        return 0;
 }
-
-#endif /* CONFIG_MMC */
index 311466b781465ac45347bc5abb22f72a5b260c6c..0ba836180e4396f61891f76f7dda42ac64717edf 100644 (file)
@@ -30,7 +30,6 @@
 #include <asm/arch/memory-map.h>
 
 #include "hsmc3.h"
-#include "sm.h"
 
 /* Sanity checks */
 #if (CFG_CLKDIV_CPU > CFG_CLKDIV_HSB)          \
 
 DECLARE_GLOBAL_DATA_PTR;
 
-static void pm_init(void)
-{
-       uint32_t cksel;
-
-#ifdef CONFIG_PLL
-       /* Initialize the PLL */
-       sm_writel(PM_PLL0, (SM_BF(PLLCOUNT, CFG_PLL0_SUPPRESS_CYCLES)
-                           | SM_BF(PLLMUL, CFG_PLL0_MUL - 1)
-                           | SM_BF(PLLDIV, CFG_PLL0_DIV - 1)
-                           | SM_BF(PLLOPT, CFG_PLL0_OPT)
-                           | SM_BF(PLLOSC, 0)
-                           | SM_BIT(PLLEN)));
-
-       /* Wait for lock */
-       while (!(sm_readl(PM_ISR) & SM_BIT(LOCK0))) ;
-#endif
-
-       /* Set up clocks for the CPU and all peripheral buses */
-       cksel = 0;
-       if (CFG_CLKDIV_CPU)
-               cksel |= SM_BIT(CPUDIV) | SM_BF(CPUSEL, CFG_CLKDIV_CPU - 1);
-       if (CFG_CLKDIV_HSB)
-               cksel |= SM_BIT(HSBDIV) | SM_BF(HSBSEL, CFG_CLKDIV_HSB - 1);
-       if (CFG_CLKDIV_PBA)
-               cksel |= SM_BIT(PBADIV) | SM_BF(PBASEL, CFG_CLKDIV_PBA - 1);
-       if (CFG_CLKDIV_PBB)
-               cksel |= SM_BIT(PBBDIV) | SM_BF(PBBSEL, CFG_CLKDIV_PBB - 1);
-       sm_writel(PM_CKSEL, cksel);
-
-       gd->cpu_hz = get_cpu_clk_rate();
-
-#ifdef CONFIG_PLL
-       /* Use PLL0 as main clock */
-       sm_writel(PM_MCCTRL, SM_BIT(PLLSEL));
-#endif
-}
-
 int cpu_init(void)
 {
        extern void _evba(void);
-       char *p;
 
        gd->cpu_hz = CFG_OSC0_HZ;
 
@@ -95,16 +56,15 @@ int cpu_init(void)
        hsmc3_writel(PULSE0, 0x0b0a0906);
        hsmc3_writel(SETUP0, 0x00010002);
 
-       pm_init();
+       clk_init();
 
+       /* Update the CPU speed according to the PLL configuration */
+       gd->cpu_hz = get_cpu_clk_rate();
+
+       /* Set up the exception handler table and enable exceptions */
        sysreg_write(EVBA, (unsigned long)&_evba);
        asm volatile("csrf      %0" : : "i"(SYSREG_EM_OFFSET));
 
-       /* Lock everything that mess with the flash in the icache */
-       for (p = __flashprog_start; p <= (__flashprog_end + CFG_ICACHE_LINESZ);
-            p += CFG_ICACHE_LINESZ)
-               asm volatile("cache %0, 0x02" : "=m"(*p) :: "memory");
-
        return 0;
 }
 
diff --git a/cpu/at32ap/entry.S b/cpu/at32ap/entry.S
deleted file mode 100644 (file)
index a6fc688..0000000
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Copyright (C) 2004-2006 Atmel Corporation
- *
- * 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/sysreg.h>
-#include <asm/ptrace.h>
-
-       .section .text.exception,"ax"
-       .global _evba
-       .type   _evba,@function
-       .align  10
-_evba:
-       .irp    x,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16
-       .align  2
-       rjmp    unknown_exception
-       .endr
-
-       .global timer_interrupt_handler
-       .type   timer_interrupt_handler,@function
-       .align  2
-timer_interrupt_handler:
-       /*
-        * Increment timer_overflow and re-write COMPARE with 0xffffffff.
-        *
-        * We're running at interrupt level 3, so we don't need to save
-        * r8-r12 or lr to the stack.
-        */
-       lda.w   r8, timer_overflow
-       ld.w    r9, r8[0]
-       mov     r10, -1
-       mtsr    SYSREG_COMPARE, r10
-       sub     r9, -1
-       st.w    r8[0], r9
-       rete
-
-       .type   unknown_exception, @function
-unknown_exception:
-       pushm   r0-r12
-       sub     r8, sp, REG_R12 - REG_R0 - 4
-       mov     r9, lr
-       mfsr    r10, SYSREG_RAR_EX
-       mfsr    r11, SYSREG_RSR_EX
-       pushm   r8-r11
-       mfsr    r12, SYSREG_ECR
-       mov     r11, sp
-       rcall   do_unknown_exception
-1:     rjmp    1b
index 0672685cd024ba80e470dcd930b85b0d6f56e54f..dc9c3002a49631522d01ec8a7a66b3ab13c1cf12 100644 (file)
@@ -111,7 +111,8 @@ void do_unknown_exception(unsigned int ecr, struct pt_regs *regs)
        printf("CPU Mode: %s\n", cpu_modes[mode]);
 
        /* Avoid exception loops */
-       if (regs->sp < CFG_SDRAM_BASE || regs->sp >= gd->stack_end)
+       if (regs->sp < (gd->stack_end - CONFIG_STACKSIZE)
+                       || regs->sp >= gd->stack_end)
                printf("\nStack pointer seems bogus, won't do stack dump\n");
        else
                dump_mem("\nStack: ", regs->sp, gd->stack_end);
index 1fcfe75d745768a881d1e3220a98542a2de6e000..992612b46275bca1bce2e59676db739f1544bd4a 100644 (file)
 
 #include "hsdramc1.h"
 
-unsigned long sdram_init(const struct sdram_info *info)
+unsigned long sdram_init(void *sdram_base, const struct sdram_config *config)
 {
-       unsigned long *sdram = (unsigned long *)uncached(info->phys_addr);
        unsigned long sdram_size;
-       unsigned long tmp;
-       unsigned long bus_hz;
+       uint32_t cfgreg;
        unsigned int i;
 
-       if (!info->refresh_period)
-               panic("ERROR: SDRAM refresh period == 0. "
-                               "Please update the board code\n");
-
-       tmp = (HSDRAMC1_BF(NC, info->col_bits - 8)
-              | HSDRAMC1_BF(NR, info->row_bits - 11)
-              | HSDRAMC1_BF(NB, info->bank_bits - 1)
-              | HSDRAMC1_BF(CAS, info->cas)
-              | HSDRAMC1_BF(TWR, info->twr)
-              | HSDRAMC1_BF(TRC, info->trc)
-              | HSDRAMC1_BF(TRP, info->trp)
-              | HSDRAMC1_BF(TRCD, info->trcd)
-              | HSDRAMC1_BF(TRAS, info->tras)
-              | HSDRAMC1_BF(TXSR, info->txsr));
-
-#ifdef CFG_SDRAM_16BIT
-       tmp |= HSDRAMC1_BIT(DBW);
-       sdram_size = 1 << (info->row_bits + info->col_bits
-                          + info->bank_bits + 1);
-#else
-       sdram_size = 1 << (info->row_bits + info->col_bits
-                          + info->bank_bits + 2);
-#endif
-
-       hsdramc1_writel(CR, tmp);
+       cfgreg = (HSDRAMC1_BF(NC, config->col_bits - 8)
+                      | HSDRAMC1_BF(NR, config->row_bits - 11)
+                      | HSDRAMC1_BF(NB, config->bank_bits - 1)
+                      | HSDRAMC1_BF(CAS, config->cas)
+                      | HSDRAMC1_BF(TWR, config->twr)
+                      | HSDRAMC1_BF(TRC, config->trc)
+                      | HSDRAMC1_BF(TRP, config->trp)
+                      | HSDRAMC1_BF(TRCD, config->trcd)
+                      | HSDRAMC1_BF(TRAS, config->tras)
+                      | HSDRAMC1_BF(TXSR, config->txsr));
+
+       if (config->data_bits == SDRAM_DATA_16BIT)
+               cfgreg |= HSDRAMC1_BIT(DBW);
+
+       hsdramc1_writel(CR, cfgreg);
+
+       /* Send a NOP to turn on the clock (necessary on some chips) */
+       hsdramc1_writel(MR, HSDRAMC1_MODE_NOP);
+       hsdramc1_readl(MR);
+       writel(0, sdram_base);
 
        /*
         * Initialization sequence for SDRAM, from the data sheet:
@@ -77,7 +70,7 @@ unsigned long sdram_init(const struct sdram_info *info)
         */
        hsdramc1_writel(MR, HSDRAMC1_MODE_BANKS_PRECHARGE);
        hsdramc1_readl(MR);
-       writel(0, sdram);
+       writel(0, sdram_base);
 
        /*
         * 3. Eight auto-refresh (CBR) cycles are provided
@@ -85,58 +78,41 @@ unsigned long sdram_init(const struct sdram_info *info)
        hsdramc1_writel(MR, HSDRAMC1_MODE_AUTO_REFRESH);
        hsdramc1_readl(MR);
        for (i = 0; i < 8; i++)
-               writel(0, sdram);
+               writel(0, sdram_base);
 
        /*
         * 4. A mode register set (MRS) cycle is issued to program
         *    SDRAM parameters, in particular CAS latency and burst
         *    length.
         *
-        * CAS from info struct, burst length 1, serial burst type
+        * The address will be chosen by the SDRAMC automatically; we
+        * just have to make sure BA[1:0] are set to 0.
         */
        hsdramc1_writel(MR, HSDRAMC1_MODE_LOAD_MODE);
        hsdramc1_readl(MR);
-       writel(0, sdram + (info->cas << 4));
+       writel(0, sdram_base);
 
        /*
-        * 5. A Normal Mode command is provided, 3 clocks after tMRD
-        *    is met.
-        *
-        * From the timing diagram, it looks like tMRD is 3
-        * cycles...try a dummy read from the peripheral bus.
+        * 5. The application must go into Normal Mode, setting Mode
+        *    to 0 in the Mode Register and performing a write access
+        *    at any location in the SDRAM.
         */
-       hsdramc1_readl(MR);
        hsdramc1_writel(MR, HSDRAMC1_MODE_NORMAL);
        hsdramc1_readl(MR);
-       writel(0, sdram);
+       writel(0, sdram_base);
 
        /*
         * 6. Write refresh rate into SDRAMC refresh timer count
         *    register (refresh rate = timing between refresh cycles).
-        *
-        * 15.6 us is a typical value for a burst of length one
         */
-       bus_hz = get_sdram_clk_rate();
-       hsdramc1_writel(TR, info->refresh_period);
-
-       printf("SDRAM: %u MB at address 0x%08lx\n",
-              sdram_size >> 20, info->phys_addr);
-
-       printf("Testing SDRAM...");
-       for (i = 0; i < sdram_size / 4; i++)
-               sdram[i] = i;
-
-       for (i = 0; i < sdram_size / 4; i++) {
-               tmp = sdram[i];
-               if (tmp != i) {
-                       printf("FAILED at address 0x%08lx\n",
-                              info->phys_addr + i * 4);
-                       printf("SDRAM: read 0x%lx, expected 0x%lx\n", tmp, i);
-                       return 0;
-               }
-       }
-
-       puts("OK\n");
+       hsdramc1_writel(TR, config->refresh_period);
+
+       if (config->data_bits == SDRAM_DATA_16BIT)
+               sdram_size = 1 << (config->row_bits + config->col_bits
+                                  + config->bank_bits + 1);
+       else
+               sdram_size = 1 << (config->row_bits + config->col_bits
+                                  + config->bank_bits + 2);
 
        return sdram_size;
 }
index bef1f30d79d3414cd7e53b8f8e126ff57d80ec43..160838eeeb3b1d3d12e36fb67f911b3ae1b95547 100644 (file)
@@ -98,18 +98,16 @@ void set_timer(unsigned long t)
  */
 void udelay(unsigned long usec)
 {
-       unsigned long now, end;
+       unsigned long cycles;
+       unsigned long base;
+       unsigned long now;
 
-       now = sysreg_read(COUNT);
+       base = sysreg_read(COUNT);
+       cycles = ((usec * (get_tbclk() / 10000)) + 50) / 100;
 
-       end = ((usec * (get_tbclk() / 10000)) + 50) / 100;
-       end += now;
-
-       while (now > end)
-               now = sysreg_read(COUNT);
-
-       while (now < end)
+       do {
                now = sysreg_read(COUNT);
+       } while ((now - base) < cycles);
 }
 
 static int set_interrupt_handler(unsigned int nr, void (*handler)(void),
index ab8c2b73d8933737f67000119ee4f3412aa5a346..907e9b1534decb37bde51a695c5e0c436e8ee588 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2005-2006 Atmel Corporation
+ * Copyright (C) 2005-2008 Atmel Corporation
  *
  * See file CREDITS for list of people who contributed to this
  * project.
  * MA 02111-1307 USA
  */
 #include <config.h>
+#include <asm/ptrace.h>
 #include <asm/sysreg.h>
 
-#ifndef PART_SPECIFIC_BOOTSTRAP
-# define PART_SPECIFIC_BOOTSTRAP
-#endif
-
 #define SYSREG_MMUCR_I_OFFSET  2
 #define SYSREG_MMUCR_S_OFFSET  4
 
                    | SYSREG_BIT(FE) | SYSREG_BIT(RE)           \
                    | SYSREG_BIT(IBE) | SYSREG_BIT(IEE))
 
-       .text
+       /*
+        * To save some space, we use the same entry point for
+        * exceptions and reset. This avoids lots of alignment padding
+        * since the reset vector is always suitably aligned.
+        */
+       .section .exception.text, "ax", @progbits
        .global _start
+       .global _evba
+       .type   _start, @function
+       .type   _evba, @function
 _start:
-       PART_SPECIFIC_BOOTSTRAP
+       .size   _start, 0
+_evba:
+       .org    0x00
+       rjmp    unknown_exception       /* Unrecoverable exception */
+       .org    0x04
+       rjmp    unknown_exception       /* TLB multiple hit */
+       .org    0x08
+       rjmp    unknown_exception       /* Bus error data fetch */
+       .org    0x0c
+       rjmp    unknown_exception       /* Bus error instruction fetch */
+       .org    0x10
+       rjmp    unknown_exception       /* NMI */
+       .org    0x14
+       rjmp    unknown_exception       /* Instruction address */
+       .org    0x18
+       rjmp    unknown_exception       /* ITLB protection */
+       .org    0x1c
+       rjmp    unknown_exception       /* Breakpoint */
+       .org    0x20
+       rjmp    unknown_exception       /* Illegal opcode */
+       .org    0x24
+       rjmp    unknown_exception       /* Unimplemented instruction */
+       .org    0x28
+       rjmp    unknown_exception       /* Privilege violation */
+       .org    0x2c
+       rjmp    unknown_exception       /* Floating-point */
+       .org    0x30
+       rjmp    unknown_exception       /* Coprocessor absent */
+       .org    0x34
+       rjmp    unknown_exception       /* Data Address (read) */
+       .org    0x38
+       rjmp    unknown_exception       /* Data Address (write) */
+       .org    0x3c
+       rjmp    unknown_exception       /* DTLB Protection (read) */
+       .org    0x40
+       rjmp    unknown_exception       /* DTLB Protection (write) */
+       .org    0x44
+       rjmp    unknown_exception       /* DTLB Modified */
+
+       .org    0x50
+       rjmp    unknown_exception       /* ITLB Miss */
+       .org    0x60
+       rjmp    unknown_exception       /* DTLB Miss (read) */
+       .org    0x70
+       rjmp    unknown_exception       /* DTLB Miss (write) */
+
+       .size   _evba, . - _evba
+
+       .align  2
+       .type   unknown_exception, @function
+unknown_exception:
+       /* Figure out whether we're handling an exception (Exception
+        * mode) or just booting (Supervisor mode). */
+       csrfcz  SYSREG_M1_OFFSET
+       brcc    at32ap_cpu_bootstrap
+
+       /* This is an exception. Complain. */
+       pushm   r0-r12
+       sub     r8, sp, REG_R12 - REG_R0 - 4
+       mov     r9, lr
+       mfsr    r10, SYSREG_RAR_EX
+       mfsr    r11, SYSREG_RSR_EX
+       pushm   r8-r11
+       mfsr    r12, SYSREG_ECR
+       mov     r11, sp
+       rcall   do_unknown_exception
+1:     rjmp    1b
+
+       /* The COUNT/COMPARE timer interrupt handler */
+       .global timer_interrupt_handler
+       .type   timer_interrupt_handler,@function
+       .align  2
+timer_interrupt_handler:
+       /*
+        * Increment timer_overflow and re-write COMPARE with 0xffffffff.
+        *
+        * We're running at interrupt level 3, so we don't need to save
+        * r8-r12 or lr to the stack.
+        */
+       lda.w   r8, timer_overflow
+       ld.w    r9, r8[0]
+       mov     r10, -1
+       mtsr    SYSREG_COMPARE, r10
+       sub     r9, -1
+       st.w    r8[0], r9
+       rete
 
+       /*
+        * CPU bootstrap after reset is handled here. SoC code may
+        * override this in case they need to initialize oscillators,
+        * etc.
+        */
+       .section .text.at32ap_cpu_bootstrap, "ax", @progbits
+       .global at32ap_cpu_bootstrap
+       .weak   at32ap_cpu_bootstrap
+       .type   at32ap_cpu_bootstrap, @function
+       .align  2
+at32ap_cpu_bootstrap:
        /* Reset the Status Register */
        mov     r0, lo(SR_INIT)
        orh     r0, hi(SR_INIT)
@@ -66,9 +167,16 @@ _start:
        lddpc   pc, 1f
 
        .align  2
-1:     .long   2f
+1:     .long   at32ap_low_level_init
+       .size   _start, . - _start
 
-2:     lddpc   sp, sp_init
+       /* Common CPU bootstrap code after oscillator/cache/etc. init */
+       .section .text.avr32ap_low_level_init, "ax", @progbits
+       .global at32ap_low_level_init
+       .type   at32ap_low_level_init, @function
+       .align  2
+at32ap_low_level_init:
+       lddpc   sp, sp_init
 
        /* Initialize the GOT pointer */
        lddpc   r6, got_init
@@ -90,6 +198,7 @@ got_init:
         * Relocate the u-boot image into RAM and continue from there.
         * Does not return.
         */
+       .section .text.relocate_code,"ax",@progbits
        .global relocate_code
        .type   relocate_code,@function
 relocate_code:
@@ -162,3 +271,5 @@ in_ram:
        .align  2
 got_init_reloc:
        .long   3b - _GLOBAL_OFFSET_TABLE_
+
+       .size   relocate_code, . - relocate_code
index e267bba4691e281faf45e307594149c97a4ae05b..0f58d25b892bbcc77ee3436c232d7ecdbadcc89a 100644 (file)
@@ -66,10 +66,10 @@ void flush_cache(ulong start_addr, ulong size)
 
 void write_one_tlb(int index, u32 pagemask, u32 hi, u32 low0, u32 low1)
 {
-       write_32bit_cp0_register(CP0_ENTRYLO0, low0);
-       write_32bit_cp0_register(CP0_PAGEMASK, pagemask);
-       write_32bit_cp0_register(CP0_ENTRYLO1, low1);
-       write_32bit_cp0_register(CP0_ENTRYHI, hi);
-       write_32bit_cp0_register(CP0_INDEX, index);
+       write_c0_entrylo0(low0);
+       write_c0_pagemask(pagemask);
+       write_c0_entrylo1(low1);
+       write_c0_entryhi(hi);
+       write_c0_index(index);
        tlb_write_indexed();
 }
index 8455c92761b109b9d9130dddc5510c753e14c9e6..8000fabd4ade826f19401cfc71942e56384c8535 100644 (file)
@@ -34,7 +34,13 @@ DECLARE_GLOBAL_DATA_PTR;
 
 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 309eb30e8e97b423218d5f5f761461c5fedf1e3b..c1821747917f1d003e0ffb103ba094fedc816f65 100644 (file)
@@ -557,7 +557,7 @@ invalidate_bats:
        mtspr   IBAT1U, r0
        mtspr   IBAT2U, r0
        mtspr   IBAT3U, r0
-#if (CFG_HID2 & HID2_HBE)
+#ifdef CONFIG_HIGH_BATS
        mtspr   IBAT4U, r0
        mtspr   IBAT5U, r0
        mtspr   IBAT6U, r0
@@ -568,7 +568,7 @@ invalidate_bats:
        mtspr   DBAT1U, r0
        mtspr   DBAT2U, r0
        mtspr   DBAT3U, r0
-#if (CFG_HID2 & HID2_HBE)
+#ifdef CONFIG_HIGH_BATS
        mtspr   DBAT4U, r0
        mtspr   DBAT5U, r0
        mtspr   DBAT6U, r0
@@ -655,7 +655,7 @@ setup_bats:
        mtspr   DBAT3U, r3
        isync
 
-#if (CFG_HID2 & HID2_HBE)
+#ifdef CONFIG_HIGH_BATS
        /* IBAT 4 */
        addis   r4, r0, CFG_IBAT4L@h
        ori     r4, r4, CFG_IBAT4L@l
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 3c7476445d01e1093a2484b83628167ac9bd836f..e26bf3671deac69bf253f6f86c23fb27e77e2f91 100644 (file)
@@ -26,6 +26,7 @@
 #include <watchdog.h>
 #include <command.h>
 #include <asm/cache.h>
+#include <asm/mmu.h>
 #include <mpc86xx.h>
 #include <asm/fsl_law.h>
 
@@ -268,13 +269,14 @@ dma_xfer(void *dest, uint count, void *src)
 
 /*
  * Print out the state of various machine registers.
- * Currently prints out LAWs and BR0/OR0
+ * Currently prints out LAWs, BR0/OR0, and BATs
  */
 void mpc86xx_reginfo(void)
 {
        immap_t *immap = (immap_t *)CFG_IMMR;
        ccsr_lbc_t *lbc = &immap->im_lbc;
 
+       print_bats();
        print_laws();
 
        printf ("Local Bus Controller Registers\n"
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 f37146b7939b75093376f8f86755015cd3a53d1a..6408180147a9fd39ca87d0136d1cbf6bbd14e3e7 100644 (file)
@@ -63,10 +63,10 @@ static char quickhex (int i)
        return hex_digit[i];
 }
 
-static void memdump (void *pv, int num)
+static void memdump (const void *pv, int num)
 {
        int i;
-       unsigned char *pc = (unsigned char *) pv;
+       const unsigned char *pc = (const unsigned char *) pv;
 
        for (i = 0; i < num; i++)
                printf ("%c%c ", quickhex (pc[i] >> 4), quickhex (pc[i] & 0x0f));
@@ -83,26 +83,64 @@ static void memdump (void *pv, int num)
 #endif  /* DEBUG */
 
 
+struct spi_slave *spi_setup_slave(unsigned int bus, unsigned int cs,
+               unsigned int max_hz, unsigned int mode)
+{
+       struct spi_slave *slave;
+
+       if (!spi_cs_is_valid(bus, cs))
+               return NULL;
+
+       slave = malloc(sizeof(struct spi_slave));
+       if (!slave)
+               return NULL;
+
+       slave->bus = bus;
+       slave->cs = cs;
+
+       /* TODO: Add support for different modes and speeds */
+
+       return slave;
+}
+
+void spi_free_slave(struct spi_slave *slave)
+{
+       free(slave);
+}
+
+int spi_claim_bus(struct spi_slave *slave)
+{
+       return 0;
+}
+
+void spi_release_bus(struct spi_slave *slave)
+{
+
+}
+
 /*
  * SPI transfer:
  *
  * See include/spi.h and http://www.altera.com/literature/ds/ds_nios_spi.pdf
  * for more informations.
  */
-int spi_xfer(spi_chipsel_type chipsel, int bitlen, uchar *dout, uchar *din)
+int spi_xfer(struct spi_slave *slave, int bitlen, const void *dout,
+               void *din, unsigned long flags)
 {
+       const u8 *txd = dout;
+       u8 *rxd = din;
        int j;
 
-       DPRINT(("spi_xfer: chipsel %08X dout %08X din %08X bitlen %d\n",
-               (int)chipsel, *(uint *)dout, *(uint *)din, bitlen));
+       DPRINT(("spi_xfer: slave %u:%u dout %08X din %08X bitlen %d\n",
+               slave->bus, slave->cs, *(uint *)dout, *(uint *)din, bitlen));
 
-       memdump((void*)dout, (bitlen + 7) / 8);
+       memdump(dout, (bitlen + 7) / 8);
 
-       if(chipsel != NULL) {
-               chipsel(1);     /* select the target chip */
-       }
+       if (flags & SPI_XFER_BEGIN)
+               spi_cs_activate(slave);
 
-       if (bitlen > CFG_NIOS_SPIBITS) {        /* leave chip select active */
+       if (!(flags & SPI_XFER_END) || bitlen > CFG_NIOS_SPIBITS) {
+               /* leave chip select active */
                spi->control |= NIOS_SPI_SSO;
        }
 
@@ -114,11 +152,11 @@ int spi_xfer(spi_chipsel_type chipsel, int bitlen, uchar *dout, uchar *din)
 
                while ((spi->status & NIOS_SPI_TRDY) == 0)
                        ;
-               spi->txdata = (unsigned)(dout[j]);
+               spi->txdata = (unsigned)(txd[j]);
 
                while ((spi->status & NIOS_SPI_RRDY) == 0)
                        ;
-               din[j] = (unsigned char)(spi->rxdata & 0xff);
+               rxd[j] = (unsigned char)(spi->rxdata & 0xff);
 
 #elif  (CFG_NIOS_SPIBITS == 16)
                j++, j++) {
@@ -126,15 +164,15 @@ int spi_xfer(spi_chipsel_type chipsel, int bitlen, uchar *dout, uchar *din)
                while ((spi->status & NIOS_SPI_TRDY) == 0)
                        ;
                if ((j+1) < ((bitlen + 7) / 8))
-                       spi->txdata = (unsigned)((dout[j] << 8) | dout[j+1]);
+                       spi->txdata = (unsigned)((txd[j] << 8) | txd[j+1]);
                else
-                       spi->txdata = (unsigned)(dout[j] << 8);
+                       spi->txdata = (unsigned)(txd[j] << 8);
 
                while ((spi->status & NIOS_SPI_RRDY) == 0)
                        ;
-               din[j] = (unsigned char)((spi->rxdata >> 8) & 0xff);
+               rxd[j] = (unsigned char)((spi->rxdata >> 8) & 0xff);
                if ((j+1) < ((bitlen + 7) / 8))
-                       din[j+1] = (unsigned char)(spi->rxdata & 0xff);
+                       rxd[j+1] = (unsigned char)(spi->rxdata & 0xff);
 
 #else
 #error "*** unsupported value of CFG_NIOS_SPIBITS ***"
@@ -142,15 +180,14 @@ int spi_xfer(spi_chipsel_type chipsel, int bitlen, uchar *dout, uchar *din)
 
        }
 
-       if (bitlen > CFG_NIOS_SPIBITS) {
+       if (bitlen > CFG_NIOS_SPIBITS && (flags & SPI_XFER_END)) {
                spi->control &= ~NIOS_SPI_SSO;
        }
 
-       if(chipsel != NULL) {
-               chipsel(0);     /* deselect the target chip */
-       }
+       if (flags & SPI_XFER_END)
+               spi_cs_deactivate(slave);
 
-       memdump((void*)din, (bitlen + 7) / 8);
+       memdump(din, (bitlen + 7) / 8);
 
        return 0;
 }
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 22156dd9ded363c8ae9b467314326a69f211cc6f..8b2954c16cc9c22fb510f09a4f74d961f15765ef 100644 (file)
 
 #if defined(CONFIG_POST) || defined(CONFIG_LOGBUFFER)
 
-#if defined(CFG_POST_ALT_WORD_ADDR)
-void post_word_store (ulong a)
-{
-       out_be32((void *)CFG_POST_ALT_WORD_ADDR, a);
-}
+#if defined(CFG_POST_WORD_ADDR)
+# define _POST_ADDR    ((CFG_OCM_DATA_ADDR) + (CFG_POST_WORD_ADDR))
+#elif defined(CFG_POST_ALT_WORD_ADDR)
+# define _POST_ADDR    (CFG_POST_ALT_WORD_ADDR)
+#endif
 
-ulong post_word_load (void)
-{
-       return in_be32((void *)CFG_POST_ALT_WORD_ADDR);
-}
-#else /* CFG_POST_ALT_WORD_ADDR */
 void post_word_store (ulong a)
 {
-       volatile void *save_addr = (volatile void *)(CFG_OCM_DATA_ADDR + CFG_POST_WORD_ADDR);
-       *(volatile ulong *) save_addr = a;
+       volatile void *save_addr = (volatile void *)(_POST_ADDR);
+
+       out_be32(save_addr, a);
 }
 
 ulong post_word_load (void)
 {
-       volatile void *save_addr = (volatile void *)(CFG_OCM_DATA_ADDR + CFG_POST_WORD_ADDR);
-       return *(volatile ulong *) save_addr;
+       volatile void *save_addr = (volatile void *)(_POST_ADDR);
+
+       return in_be32(save_addr);
 }
-#endif /* CFG_POST_ALT_WORD_ADDR */
 
 #endif /* CONFIG_POST || CONFIG_LOGBUFFER*/
 
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){
index 316e2547399c002c2bdc0c765ee5ae53d3f2fea6..5c4bf6b6142bb68cc190e1a549d9a054742d7606 100644 (file)
@@ -109,7 +109,7 @@ void dev_print (block_dev_desc_t *dev_desc)
        lbaint_t lba512;
 #endif
 
-       switch (dev_desc->type) {
+       switch (dev_desc->if_type) {
        case IF_TYPE_SCSI:
                printf ("(%d:%d) Vendor: %s Prod.: %s Rev: %s\n",
                        dev_desc->target,dev_desc->lun,
@@ -124,7 +124,7 @@ void dev_print (block_dev_desc_t *dev_desc)
                        dev_desc->revision,
                        dev_desc->product);
                break;
-       case DEV_TYPE_UNKNOWN:
+       case IF_TYPE_UNKNOWN:
        default:
                puts ("not available\n");
                return;
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 e29b29440f237aa537321bc388abce9c86014822..c34851725ef75095bee305298124c3ecaf5f5eb3 100644 (file)
@@ -47,6 +47,19 @@ int dtt_read(int sensor, int reg)
     int dlen;
     uchar data[2];
 
+#ifdef CONFIG_DTT_AD7414
+    /*
+     * On AD7414 the first value upon bootup is not read correctly.
+     * This is most likely because of the 800ms update time of the
+     * temp register in normal update mode. To get current values
+     * each time we issue the "dtt" command including upon powerup
+     * we switch into one-short mode.
+     *
+     * Issue one-shot mode command
+     */
+    dtt_write(sensor, DTT_CONFIG, 0x64);
+#endif
+
     /*
      * Validate 'reg' param
      */
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 a2d88ea5c64075defb4425eca5e2e8d9e80764f0..d505bc8e87b2d8475941c8e908b3ec92bc1af77f 100644 (file)
@@ -1745,6 +1745,8 @@ ulong flash_get_size (ulong base, int banknum)
        int erase_region_count;
        struct cfi_qry qry;
 
+       memset(&qry, 0, sizeof(qry));
+
        info->ext_addr = 0;
        info->cfi_version = 0;
 #ifdef CFG_FLASH_PROTECTION
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 6c5624a49a4b5b7c8e7ad4f63f3f17feccbc1cdf..c82f77b55587ef601472e0e027f51f852e81c168 100644 (file)
@@ -153,6 +153,13 @@ int nand_erase_opts(nand_info_t *meminfo, const nand_erase_options_t *opts)
                priv_nand->bbt = NULL;
        }
 
+       if (erase_length < meminfo->erasesize) {
+               printf("Warning: Erase size 0x%08x smaller than one "   \
+                      "erase block 0x%08x\n",erase_length, meminfo->erasesize);
+               printf("         Erasing 0x%08x instead\n", meminfo->erasesize);
+               erase_length = meminfo->erasesize;
+       }
+
        for (;
             erase.addr < opts->offset + erase_length;
             erase.addr += meminfo->erasesize) {
diff --git a/drivers/mtd/spi/Makefile b/drivers/mtd/spi/Makefile
new file mode 100644 (file)
index 0000000..af6af97
--- /dev/null
@@ -0,0 +1,47 @@
+#
+# (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 $(TOPDIR)/config.mk
+
+LIB    := $(obj)libspi_flash.a
+
+COBJS-$(CONFIG_SPI_FLASH)      += spi_flash.o
+COBJS-$(CONFIG_SPI_FLASH_ATMEL)        += atmel.o
+
+COBJS  := $(COBJS-y)
+SRCS   := $(COBJS:.o=.c)
+OBJS   := $(addprefix $(obj),$(COBJS))
+
+all:   $(LIB)
+
+$(LIB): $(obj).depend $(OBJS)
+       $(AR) $(ARFLAGS) $@ $(OBJS)
+
+#########################################################################
+
+# defines $(obj).depend target
+include $(SRCTREE)/rules.mk
+
+sinclude $(obj).depend
+
+#########################################################################
diff --git a/drivers/mtd/spi/atmel.c b/drivers/mtd/spi/atmel.c
new file mode 100644 (file)
index 0000000..fb7a4a9
--- /dev/null
@@ -0,0 +1,362 @@
+/*
+ * Atmel SPI DataFlash support
+ *
+ * Copyright (C) 2008 Atmel Corporation
+ */
+#define DEBUG
+#include <common.h>
+#include <malloc.h>
+#include <spi_flash.h>
+
+#include "spi_flash_internal.h"
+
+/* AT45-specific commands */
+#define CMD_AT45_READ_STATUS           0xd7
+#define CMD_AT45_ERASE_PAGE            0x81
+#define CMD_AT45_LOAD_PROG_BUF1                0x82
+#define CMD_AT45_LOAD_BUF1             0x84
+#define CMD_AT45_LOAD_PROG_BUF2                0x85
+#define CMD_AT45_LOAD_BUF2             0x87
+#define CMD_AT45_PROG_BUF1             0x88
+#define CMD_AT45_PROG_BUF2             0x89
+
+/* AT45 status register bits */
+#define AT45_STATUS_P2_PAGE_SIZE       (1 << 0)
+#define AT45_STATUS_READY              (1 << 7)
+
+/* DataFlash family IDs, as obtained from the second idcode byte */
+#define DF_FAMILY_AT26F                        0
+#define DF_FAMILY_AT45                 1
+#define DF_FAMILY_AT26DF               2       /* AT25DF and AT26DF */
+
+struct atmel_spi_flash_params {
+       u8              idcode1;
+       /* Log2 of page size in power-of-two mode */
+       u8              l2_page_size;
+       u8              pages_per_block;
+       u8              blocks_per_sector;
+       u8              nr_sectors;
+       const char      *name;
+};
+
+struct atmel_spi_flash {
+       const struct atmel_spi_flash_params *params;
+       struct spi_flash flash;
+};
+
+static inline struct atmel_spi_flash *
+to_atmel_spi_flash(struct spi_flash *flash)
+{
+       return container_of(flash, struct atmel_spi_flash, flash);
+}
+
+static const struct atmel_spi_flash_params atmel_spi_flash_table[] = {
+       {
+               .idcode1                = 0x28,
+               .l2_page_size           = 10,
+               .pages_per_block        = 8,
+               .blocks_per_sector      = 32,
+               .nr_sectors             = 32,
+               .name                   = "AT45DB642D",
+       },
+};
+
+static int at45_wait_ready(struct spi_flash *flash, unsigned long timeout)
+{
+       struct spi_slave *spi = flash->spi;
+       unsigned long timebase;
+       int ret;
+       u8 cmd = CMD_AT45_READ_STATUS;
+       u8 status;
+
+       timebase = get_timer(0);
+
+       ret = spi_xfer(spi, 8, &cmd, NULL, SPI_XFER_BEGIN);
+       if (ret)
+               return -1;
+
+       do {
+               ret = spi_xfer(spi, 8, NULL, &status, 0);
+               if (ret)
+                       return -1;
+
+               if (status & AT45_STATUS_READY)
+                       break;
+       } while (get_timer(timebase) < timeout);
+
+       /* Deactivate CS */
+       spi_xfer(spi, 0, NULL, NULL, SPI_XFER_END);
+
+       if (status & AT45_STATUS_READY)
+               return 0;
+
+       /* Timed out */
+       return -1;
+}
+
+/*
+ * Assemble the address part of a command for AT45 devices in
+ * non-power-of-two page size mode.
+ */
+static void at45_build_address(struct atmel_spi_flash *asf, u8 *cmd, u32 offset)
+{
+       unsigned long page_addr;
+       unsigned long byte_addr;
+       unsigned long page_size;
+       unsigned int page_shift;
+
+       /*
+        * The "extra" space per page is the power-of-two page size
+        * divided by 32.
+        */
+       page_shift = asf->params->l2_page_size;
+       page_size = (1 << page_shift) + (1 << (page_shift - 5));
+       page_shift++;
+       page_addr = offset / page_size;
+       byte_addr = offset % page_size;
+
+       cmd[0] = page_addr >> (16 - page_shift);
+       cmd[1] = page_addr << (page_shift - 8) | (byte_addr >> 8);
+       cmd[2] = byte_addr;
+}
+
+static int dataflash_read_fast_p2(struct spi_flash *flash,
+               u32 offset, size_t len, void *buf)
+{
+       u8 cmd[5];
+
+       cmd[0] = CMD_READ_ARRAY_FAST;
+       cmd[1] = offset >> 16;
+       cmd[2] = offset >> 8;
+       cmd[3] = offset;
+       cmd[4] = 0x00;
+
+       return spi_flash_read_common(flash, cmd, sizeof(cmd), buf, len);
+}
+
+static int dataflash_read_fast_at45(struct spi_flash *flash,
+               u32 offset, size_t len, void *buf)
+{
+       struct atmel_spi_flash *asf = to_atmel_spi_flash(flash);
+       u8 cmd[5];
+
+       cmd[0] = CMD_READ_ARRAY_FAST;
+       at45_build_address(asf, cmd + 1, offset);
+       cmd[4] = 0x00;
+
+       return spi_flash_read_common(flash, cmd, sizeof(cmd), buf, len);
+}
+
+static int dataflash_write_at45(struct spi_flash *flash,
+               u32 offset, size_t len, const void *buf)
+{
+       struct atmel_spi_flash *asf = to_atmel_spi_flash(flash);
+       unsigned long page_addr;
+       unsigned long byte_addr;
+       unsigned long page_size;
+       unsigned int page_shift;
+       size_t chunk_len;
+       size_t actual;
+       int ret;
+       u8 cmd[4];
+
+       page_shift = asf->params->l2_page_size;
+       page_size = (1 << page_shift) + (1 << (page_shift - 5));
+       page_shift++;
+       page_addr = offset / page_size;
+       byte_addr = offset % page_size;
+
+       ret = spi_claim_bus(flash->spi);
+       if (ret) {
+               debug("SF: Unable to claim SPI bus\n");
+               return ret;
+       }
+
+       for (actual = 0; actual < len; actual += chunk_len) {
+               chunk_len = min(len - actual, page_size - byte_addr);
+
+               /* Use the same address bits for both commands */
+               cmd[0] = CMD_AT45_LOAD_BUF1;
+               cmd[1] = page_addr >> (16 - page_shift);
+               cmd[2] = page_addr << (page_shift - 8) | (byte_addr >> 8);
+               cmd[3] = byte_addr;
+
+               ret = spi_flash_cmd_write(flash->spi, cmd, 4,
+                               buf + actual, chunk_len);
+               if (ret < 0) {
+                       debug("SF: Loading AT45 buffer failed\n");
+                       goto out;
+               }
+
+               cmd[0] = CMD_AT45_PROG_BUF1;
+               ret = spi_flash_cmd_write(flash->spi, cmd, 4, NULL, 0);
+               if (ret < 0) {
+                       debug("SF: AT45 page programming failed\n");
+                       goto out;
+               }
+
+               ret = at45_wait_ready(flash, SPI_FLASH_PROG_TIMEOUT);
+               if (ret < 0) {
+                       debug("SF: AT45 page programming timed out\n");
+                       goto out;
+               }
+
+               page_addr++;
+               byte_addr = 0;
+       }
+
+       debug("SF: AT45: Successfully programmed %u bytes @ 0x%x\n",
+                       len, offset);
+       ret = 0;
+
+out:
+       spi_release_bus(flash->spi);
+       return ret;
+}
+
+int dataflash_erase_at45(struct spi_flash *flash, u32 offset, size_t len)
+{
+       struct atmel_spi_flash *asf = to_atmel_spi_flash(flash);
+       unsigned long page_addr;
+       unsigned long page_size;
+       unsigned int page_shift;
+       size_t actual;
+       int ret;
+       u8 cmd[4];
+
+       /*
+        * TODO: This function currently uses page erase only. We can
+        * probably speed things up by using block and/or sector erase
+        * when possible.
+        */
+
+       page_shift = asf->params->l2_page_size;
+       page_size = (1 << page_shift) + (1 << (page_shift - 5));
+       page_shift++;
+       page_addr = offset / page_size;
+
+       if (offset % page_size || len % page_size) {
+               debug("SF: Erase offset/length not multiple of page size\n");
+               return -1;
+       }
+
+       cmd[0] = CMD_AT45_ERASE_PAGE;
+       cmd[3] = 0x00;
+
+       ret = spi_claim_bus(flash->spi);
+       if (ret) {
+               debug("SF: Unable to claim SPI bus\n");
+               return ret;
+       }
+
+       for (actual = 0; actual < len; actual += page_size) {
+               cmd[1] = page_addr >> (16 - page_shift);
+               cmd[2] = page_addr << (page_shift - 8);
+
+               ret = spi_flash_cmd_write(flash->spi, cmd, 4, NULL, 0);
+               if (ret < 0) {
+                       debug("SF: AT45 page erase failed\n");
+                       goto out;
+               }
+
+               ret = at45_wait_ready(flash, SPI_FLASH_PAGE_ERASE_TIMEOUT);
+               if (ret < 0) {
+                       debug("SF: AT45 page erase timed out\n");
+                       goto out;
+               }
+
+               page_addr++;
+       }
+
+       debug("SF: AT45: Successfully erased %u bytes @ 0x%x\n",
+                       len, offset);
+       ret = 0;
+
+out:
+       spi_release_bus(flash->spi);
+       return ret;
+}
+
+struct spi_flash *spi_flash_probe_atmel(struct spi_slave *spi, u8 *idcode)
+{
+       const struct atmel_spi_flash_params *params;
+       unsigned long page_size;
+       unsigned int family;
+       struct atmel_spi_flash *asf;
+       unsigned int i;
+       int ret;
+       u8 status;
+
+       for (i = 0; i < ARRAY_SIZE(atmel_spi_flash_table); i++) {
+               params = &atmel_spi_flash_table[i];
+               if (params->idcode1 == idcode[1])
+                       break;
+       }
+
+       if (i == ARRAY_SIZE(atmel_spi_flash_table)) {
+               debug("SF: Unsupported DataFlash ID %02x\n",
+                               idcode[1]);
+               return NULL;
+       }
+
+       asf = malloc(sizeof(struct atmel_spi_flash));
+       if (!asf) {
+               debug("SF: Failed to allocate memory\n");
+               return NULL;
+       }
+
+       asf->params = params;
+       asf->flash.spi = spi;
+       asf->flash.name = params->name;
+
+       /* Assuming power-of-two page size initially. */
+       page_size = 1 << params->l2_page_size;
+
+       family = idcode[1] >> 5;
+
+       switch (family) {
+       case DF_FAMILY_AT45:
+               /*
+                * AT45 chips have configurable page size. The status
+                * register indicates which configuration is active.
+                */
+               ret = spi_flash_cmd(spi, CMD_AT45_READ_STATUS, &status, 1);
+               if (ret)
+                       goto err;
+
+               debug("SF: AT45 status register: %02x\n", status);
+
+               if (!(status & AT45_STATUS_P2_PAGE_SIZE)) {
+                       asf->flash.read = dataflash_read_fast_at45;
+                       asf->flash.write = dataflash_write_at45;
+                       asf->flash.erase = dataflash_erase_at45;
+                       page_size += 1 << (params->l2_page_size - 5);
+               } else {
+                       asf->flash.read = dataflash_read_fast_p2;
+               }
+
+               break;
+
+       case DF_FAMILY_AT26F:
+       case DF_FAMILY_AT26DF:
+               asf->flash.read = dataflash_read_fast_p2;
+               break;
+
+       default:
+               debug("SF: Unsupported DataFlash family %u\n", family);
+               goto err;
+       }
+
+       asf->flash.size = page_size * params->pages_per_block
+                               * params->blocks_per_sector
+                               * params->nr_sectors;
+
+       debug("SF: Detected %s with page size %u, total %u bytes\n",
+                       params->name, page_size, asf->flash.size);
+
+       return &asf->flash;
+
+err:
+       free(asf);
+       return NULL;
+}
diff --git a/drivers/mtd/spi/spi_flash.c b/drivers/mtd/spi/spi_flash.c
new file mode 100644 (file)
index 0000000..d581cb3
--- /dev/null
@@ -0,0 +1,162 @@
+/*
+ * SPI flash interface
+ *
+ * Copyright (C) 2008 Atmel Corporation
+ */
+#define DEBUG
+#include <common.h>
+#include <malloc.h>
+#include <spi.h>
+#include <spi_flash.h>
+
+#include "spi_flash_internal.h"
+
+int spi_flash_cmd(struct spi_slave *spi, u8 cmd, void *response, size_t len)
+{
+       unsigned long flags = SPI_XFER_BEGIN;
+       int ret;
+
+       if (len == 0)
+               flags |= SPI_XFER_END;
+
+       ret = spi_xfer(spi, 8, &cmd, NULL, flags);
+       if (ret) {
+               debug("SF: Failed to send command %02x: %d\n", cmd, ret);
+               return ret;
+       }
+
+       if (len) {
+               ret = spi_xfer(spi, len * 8, NULL, response, SPI_XFER_END);
+               if (ret)
+                       debug("SF: Failed to read response (%zu bytes): %d\n",
+                                       len, ret);
+       }
+
+       return ret;
+}
+
+int spi_flash_cmd_read(struct spi_slave *spi, const u8 *cmd,
+               size_t cmd_len, void *data, size_t data_len)
+{
+       unsigned long flags = SPI_XFER_BEGIN;
+       int ret;
+
+       if (data_len == 0)
+               flags |= SPI_XFER_END;
+
+       ret = spi_xfer(spi, cmd_len * 8, cmd, NULL, flags);
+       if (ret) {
+               debug("SF: Failed to send read command (%zu bytes): %d\n",
+                               cmd_len, ret);
+       } else if (data_len != 0) {
+               ret = spi_xfer(spi, data_len * 8, NULL, data, SPI_XFER_END);
+               if (ret)
+                       debug("SF: Failed to read %zu bytes of data: %d\n",
+                                       data_len, ret);
+       }
+
+       return ret;
+}
+
+int spi_flash_cmd_write(struct spi_slave *spi, const u8 *cmd, size_t cmd_len,
+               const void *data, size_t data_len)
+{
+       unsigned long flags = SPI_XFER_BEGIN;
+       int ret;
+
+       if (data_len == 0)
+               flags |= SPI_XFER_END;
+
+       ret = spi_xfer(spi, cmd_len * 8, cmd, NULL, flags);
+       if (ret) {
+               debug("SF: Failed to send read command (%zu bytes): %d\n",
+                               cmd_len, ret);
+       } else if (data_len != 0) {
+               ret = spi_xfer(spi, data_len * 8, data, NULL, SPI_XFER_END);
+               if (ret)
+                       debug("SF: Failed to read %zu bytes of data: %d\n",
+                                       data_len, ret);
+       }
+
+       return ret;
+}
+
+
+int spi_flash_read_common(struct spi_flash *flash, const u8 *cmd,
+               size_t cmd_len, void *data, size_t data_len)
+{
+       struct spi_slave *spi = flash->spi;
+       int ret;
+
+       spi_claim_bus(spi);
+       ret = spi_flash_cmd_read(spi, cmd, cmd_len, data, data_len);
+       spi_release_bus(spi);
+
+       return ret;
+}
+
+struct spi_flash *spi_flash_probe(unsigned int bus, unsigned int cs,
+               unsigned int max_hz, unsigned int spi_mode)
+{
+       struct spi_slave *spi;
+       struct spi_flash *flash;
+       int ret;
+       u8 idcode[3];
+
+       spi = spi_setup_slave(bus, cs, max_hz, spi_mode);
+       if (!spi) {
+               debug("SF: Failed to set up slave\n");
+               return NULL;
+       }
+
+       ret = spi_claim_bus(spi);
+       if (ret) {
+               debug("SF: Failed to claim SPI bus: %d\n", ret);
+               goto err_claim_bus;
+       }
+
+       /* Read the ID codes */
+       ret = spi_flash_cmd(spi, CMD_READ_ID, &idcode, sizeof(idcode));
+       if (ret)
+               goto err_read_id;
+
+       debug("SF: Got idcode %02x %02x %02x\n", idcode[0],
+                       idcode[1], idcode[2]);
+
+       switch (idcode[0]) {
+#ifdef CONFIG_SPI_FLASH_SPANSION
+       case 0x01:
+               flash = spi_flash_probe_spansion(spi, idcode);
+               break;
+#endif
+#ifdef CONFIG_SPI_FLASH_ATMEL
+       case 0x1F:
+               flash = spi_flash_probe_atmel(spi, idcode);
+               break;
+#endif
+       default:
+               debug("SF: Unsupported manufacturer %02X\n", idcode[0]);
+               flash = NULL;
+               break;
+       }
+
+       if (!flash)
+               goto err_manufacturer_probe;
+
+       spi_release_bus(spi);
+
+       return flash;
+
+err_manufacturer_probe:
+err_read_id:
+       spi_release_bus(spi);
+err_claim_bus:
+       spi_free_slave(spi);
+       return NULL;
+}
+
+void spi_flash_free(struct spi_flash *flash)
+{
+       spi_free_slave(flash->spi);
+       free(flash);
+}
diff --git a/drivers/mtd/spi/spi_flash_internal.h b/drivers/mtd/spi/spi_flash_internal.h
new file mode 100644 (file)
index 0000000..1438050
--- /dev/null
@@ -0,0 +1,45 @@
+/*
+ * SPI flash internal definitions
+ *
+ * Copyright (C) 2008 Atmel Corporation
+ */
+
+/* Common parameters */
+#define SPI_FLASH_PROG_TIMEOUT         ((10 * CFG_HZ) / 1000)
+#define SPI_FLASH_PAGE_ERASE_TIMEOUT   ((50 * CFG_HZ) / 1000)
+#define SPI_FLASH_SECTOR_ERASE_TIMEOUT (10 * CFG_HZ)
+
+/* Common commands */
+#define CMD_READ_ID                    0x9f
+
+#define CMD_READ_ARRAY_SLOW            0x03
+#define CMD_READ_ARRAY_FAST            0x0b
+#define CMD_READ_ARRAY_LEGACY          0xe8
+
+/* Send a single-byte command to the device and read the response */
+int spi_flash_cmd(struct spi_slave *spi, u8 cmd, void *response, size_t len);
+
+/*
+ * Send a multi-byte command to the device and read the response. Used
+ * for flash array reads, etc.
+ */
+int spi_flash_cmd_read(struct spi_slave *spi, const u8 *cmd,
+               size_t cmd_len, void *data, size_t data_len);
+
+/*
+ * Send a multi-byte command to the device followed by (optional)
+ * data. Used for programming the flash array, etc.
+ */
+int spi_flash_cmd_write(struct spi_slave *spi, const u8 *cmd, size_t cmd_len,
+               const void *data, size_t data_len);
+
+/*
+ * Same as spi_flash_cmd_read() except it also claims/releases the SPI
+ * bus. Used as common part of the ->read() operation.
+ */
+int spi_flash_read_common(struct spi_flash *flash, const u8 *cmd,
+               size_t cmd_len, void *data, size_t data_len);
+
+/* Manufacturer-specific probe functions */
+struct spi_flash *spi_flash_probe_spansion(struct spi_slave *spi, u8 *idcode);
+struct spi_flash *spi_flash_probe_atmel(struct spi_slave *spi, u8 *idcode);
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 01e2f14a9d47e177bce9e4ef2e642176844fa566..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,19 +454,28 @@ 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
        for (i = 0; i < 6; i++)
                ((u16 *) bd->bi_enetaddr)[i] = read_srom_word(i);
+#endif
 
        if (is_zero_ether_addr(bd->bi_enetaddr) ||
            is_multicast_ether_addr(bd->bi_enetaddr)) {
@@ -331,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);
@@ -374,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;
 }
@@ -450,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;
 }
@@ -590,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;
 }
 
@@ -613,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 703784ee0dc26d2164431f00e052978d48e690b8..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
@@ -417,13 +414,15 @@ static int macb_init(struct eth_device *netdev, bd_t *bd)
 
        /* choose RMII or MII mode. This depends on the board */
 #ifdef CONFIG_RMII
-#if defined(CONFIG_AT91CAP9) || defined(CONFIG_AT91SAM9260)
+#if defined(CONFIG_AT91CAP9) || defined(CONFIG_AT91SAM9260) || \
+    defined(CONFIG_AT91SAM9263)
        macb_writel(macb, USRIO, MACB_BIT(RMII) | MACB_BIT(CLKEN));
 #else
        macb_writel(macb, USRIO, 0);
 #endif
 #else
-#if defined(CONFIG_AT91CAP9) || defined(CONFIG_AT91SAM9260)
+#if defined(CONFIG_AT91CAP9) || defined(CONFIG_AT91SAM9260) || \
+    defined(CONFIG_AT91SAM9263)
        macb_writel(macb, USRIO, MACB_BIT(CLKEN));
 #else
        macb_writel(macb, USRIO, MACB_BIT(MII));
@@ -591,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 1c8ac7f2927997989bf4a1738e7616e9e5d70290..29854fc7c4cf6f4e67b645b5333e11a45beeec62 100644 (file)
 
 #define        RTC_USER_RAM_BASE       0x20
 
-/*
- * External table of chip select functions (see the appropriate board
- * support for the actual definition of the table).
- */
-extern spi_chipsel_type spi_chipsel[];
-extern int spi_chipsel_cnt;
-
 static unsigned int bin2bcd (unsigned int n);
 static unsigned char bcd2bin (unsigned char c);
 
@@ -305,11 +298,29 @@ void rtc_reset (void)
 static unsigned char rtc_read (unsigned char reg);
 static void rtc_write (unsigned char reg, unsigned char val);
 
+static struct spi_slave *slave;
+
 /* read clock time from DS1306 and return it in *tmp */
 int rtc_get (struct rtc_time *tmp)
 {
        unsigned char sec, min, hour, mday, wday, mon, year;
 
+       /*
+        * Assuming Vcc = 2.0V (lowest speed)
+        *
+        * REVISIT: If we add an rtc_init() function we can do this
+        * step just once.
+        */
+       if (!slave) {
+               slave = spi_setup_slave(0, CFG_SPI_RTC_DEVID, 600000,
+                               SPI_MODE_3 | SPI_CS_HIGH);
+               if (!slave)
+                       return;
+       }
+
+       if (spi_claim_bus(slave))
+               return;
+
        sec = rtc_read (RTC_SECONDS);
        min = rtc_read (RTC_MINUTES);
        hour = rtc_read (RTC_HOURS);
@@ -318,6 +329,8 @@ int rtc_get (struct rtc_time *tmp)
        mon = rtc_read (RTC_MONTH);
        year = rtc_read (RTC_YEAR);
 
+       spi_release_bus(slave);
+
        debug ("Get RTC year: %02x mon: %02x mday: %02x wday: %02x "
               "hr: %02x min: %02x sec: %02x\n",
               year, mon, mday, wday, hour, min, sec);
@@ -360,6 +373,17 @@ int rtc_get (struct rtc_time *tmp)
 /* set clock time from *tmp in DS1306 RTC */
 void rtc_set (struct rtc_time *tmp)
 {
+       /* Assuming Vcc = 2.0V (lowest speed) */
+       if (!slave) {
+               slave = spi_setup_slave(0, CFG_SPI_RTC_DEVID, 600000,
+                               SPI_MODE_3 | SPI_CS_HIGH);
+               if (!slave)
+                       return;
+       }
+
+       if (spi_claim_bus(slave))
+               return;
+
        debug ("Set DATE: %4d-%02d-%02d (wday=%d)  TIME: %2d:%02d:%02d\n",
               tmp->tm_year, tmp->tm_mon, tmp->tm_mday, tmp->tm_wday,
               tmp->tm_hour, tmp->tm_min, tmp->tm_sec);
@@ -371,6 +395,8 @@ void rtc_set (struct rtc_time *tmp)
        rtc_write (RTC_DATE_OF_MONTH, bin2bcd (tmp->tm_mday));
        rtc_write (RTC_MONTH, bin2bcd (tmp->tm_mon));
        rtc_write (RTC_YEAR, bin2bcd (tmp->tm_year - 2000));
+
+       spi_release_bus(slave);
 }
 
 /* ------------------------------------------------------------------------- */
@@ -378,6 +404,17 @@ void rtc_set (struct rtc_time *tmp)
 /* reset the DS1306 */
 void rtc_reset (void)
 {
+       /* Assuming Vcc = 2.0V (lowest speed) */
+       if (!slave) {
+               slave = spi_setup_slave(0, CFG_SPI_RTC_DEVID, 600000,
+                               SPI_MODE_3 | SPI_CS_HIGH);
+               if (!slave)
+                       return;
+       }
+
+       if (spi_claim_bus(slave))
+               return;
+
        /* clear the control register */
        rtc_write (RTC_CONTROL, 0x00);  /* 1st step: reset WP */
        rtc_write (RTC_CONTROL, 0x00);  /* 2nd step: reset 1Hz, AIE1, AIE0 */
@@ -391,22 +428,18 @@ void rtc_reset (void)
        rtc_write (RTC_HOURS_ALARM1, 0x00);
        rtc_write (RTC_DAY_OF_WEEK_ALARM0, 0x00);
        rtc_write (RTC_DAY_OF_WEEK_ALARM1, 0x00);
+
+       spi_release_bus(slave);
 }
 
 /* ------------------------------------------------------------------------- */
 
 static unsigned char rtc_read (unsigned char reg)
 {
-       unsigned char dout[2];  /* SPI Output Data Bytes */
-       unsigned char din[2];   /* SPI Input Data Bytes */
-
-       dout[0] = reg;
+       int ret;
 
-       if (spi_xfer (spi_chipsel[CFG_SPI_RTC_DEVID], 16, dout, din) != 0) {
-               return 0;
-       } else {
-               return din[1];
-       }
+       ret = spi_w8r8(slave, reg);
+       return ret < 0 ? 0 : ret;
 }
 
 /* ------------------------------------------------------------------------- */
@@ -419,7 +452,7 @@ static void rtc_write (unsigned char reg, unsigned char val)
        dout[0] = 0x80 | reg;
        dout[1] = val;
 
-       spi_xfer (spi_chipsel[CFG_SPI_RTC_DEVID], 16, dout, din);
+       spi_xfer (slave, 16, dout, din, SPI_XFER_BEGIN | SPI_XFER_END);
 }
 
 #endif /* end of code exclusion (see #ifdef CONFIG_SXNI855T above) */
index 35b1b8b254dd218ab6c7b93abe71ace1b12cc242..b6e15014bb68e67f22c2e1b3340a7a23f5ed5ed6 100644 (file)
 #include <rtc.h>
 #include <spi.h>
 
+static struct spi_slave *slave;
+
 int rtc_get(struct rtc_time *rtc)
 {
        u32 day1, day2, time;
        u32 reg;
        int err, tim, i = 0;
 
-       spi_select(1, 0, SPI_MODE_2 | SPI_CS_HIGH);
+       if (!slave) {
+               /* FIXME: Verify the max SCK rate */
+               slave = spi_setup_slave(1, 0, 1000000,
+                               SPI_MODE_2 | SPI_CS_HIGH);
+               if (!slave)
+                       return -1;
+       }
+
+       if (spi_claim_bus(slave))
+               return -1;
 
        do {
                reg = 0x2c000000;
-               err = spi_xfer(0, 32, (uchar *)&reg, (uchar *)&day1);
+               err = spi_xfer(slave, 32, (uchar *)&reg, (uchar *)&day1,
+                               SPI_XFER_BEGIN | SPI_XFER_END);
 
                if (err)
                        return err;
 
                reg = 0x28000000;
-               err = spi_xfer(0, 32, (uchar *)&reg, (uchar *)&time);
+               err = spi_xfer(slave, 32, (uchar *)&reg, (uchar *)&time,
+                               SPI_XFER_BEGIN | SPI_XFER_END);
 
                if (err)
                        return err;
 
                reg = 0x2c000000;
-               err = spi_xfer(0, 32, (uchar *)&reg, (uchar *)&day2);
+               err = spi_xfer(slave, 32, (uchar *)&reg, (uchar *)&day2,
+                               SPI_XFER_BEGIN | SPI_XFER_END);
 
                if (err)
                        return err;
        } while (day1 != day2 && i++ < 3);
 
+       spi_release_bus(slave);
+
        tim = day1 * 86400 + time;
        to_tm(tim, rtc);
 
@@ -65,16 +81,31 @@ void rtc_set(struct rtc_time *rtc)
 {
        u32 time, day, reg;
 
+       if (!slave) {
+               /* FIXME: Verify the max SCK rate */
+               slave = spi_setup_slave(1, 0, 1000000,
+                               SPI_MODE_2 | SPI_CS_HIGH);
+               if (!slave)
+                       return;
+       }
+
        time = mktime(rtc->tm_year, rtc->tm_mon, rtc->tm_mday,
                      rtc->tm_hour, rtc->tm_min, rtc->tm_sec);
        day = time / 86400;
        time %= 86400;
 
+       if (spi_claim_bus(slave))
+               return;
+
        reg = 0x2c000000 | day | 0x80000000;
-       spi_xfer(0, 32, (uchar *)&reg, (uchar *)&day);
+       spi_xfer(slave, 32, (uchar *)&reg, (uchar *)&day,
+                       SPI_XFER_BEGIN | SPI_XFER_END);
 
        reg = 0x28000000 | time | 0x80000000;
-       spi_xfer(0, 32, (uchar *)&reg, (uchar *)&time);
+       spi_xfer(slave, 32, (uchar *)&reg, (uchar *)&time,
+                       SPI_XFER_BEGIN | SPI_XFER_END);
+
+       spi_release_bus(slave);
 }
 
 void rtc_reset(void)
index bc8a1041210ddce8d33174e42b85f893652752a2..e66e0ee092f341fc87af6d2dafbfc417e079cf54 100644 (file)
@@ -26,6 +26,7 @@ include $(TOPDIR)/config.mk
 LIB    := $(obj)libspi.a
 
 COBJS-y += mpc8xxx_spi.o
+COBJS-$(CONFIG_ATMEL_SPI) += atmel_spi.o
 COBJS-$(CONFIG_MXC_SPI) += mxc_spi.o
 
 COBJS  := $(COBJS-y)
diff --git a/drivers/spi/atmel_spi.c b/drivers/spi/atmel_spi.c
new file mode 100644 (file)
index 0000000..317c0b4
--- /dev/null
@@ -0,0 +1,210 @@
+/*
+ * Copyright (C) 2007 Atmel Corporation
+ *
+ * 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 <spi.h>
+#include <malloc.h>
+
+#include <asm/io.h>
+
+#include <asm/arch/clk.h>
+#include <asm/arch/memory-map.h>
+
+#include "atmel_spi.h"
+
+void spi_init()
+{
+
+}
+
+struct spi_slave *spi_setup_slave(unsigned int bus, unsigned int cs,
+                       unsigned int max_hz, unsigned int mode)
+{
+       struct atmel_spi_slave  *as;
+       unsigned int            scbr;
+       u32                     csrx;
+       void                    *regs;
+
+       if (cs > 3 || !spi_cs_is_valid(bus, cs))
+               return NULL;
+
+       switch (bus) {
+       case 0:
+               regs = (void *)SPI0_BASE;
+               break;
+#ifdef SPI1_BASE
+       case 1:
+               regs = (void *)SPI1_BASE;
+               break;
+#endif
+#ifdef SPI2_BASE
+       case 2:
+               regs = (void *)SPI2_BASE;
+               break;
+#endif
+#ifdef SPI3_BASE
+       case 3:
+               regs = (void *)SPI3_BASE;
+               break;
+#endif
+       default:
+               return NULL;
+       }
+
+
+       scbr = (get_spi_clk_rate(bus) + max_hz - 1) / max_hz;
+       if (scbr > ATMEL_SPI_CSRx_SCBR_MAX)
+               /* Too low max SCK rate */
+               return NULL;
+       if (scbr < 1)
+               scbr = 1;
+
+       csrx = ATMEL_SPI_CSRx_SCBR(scbr);
+       csrx |= ATMEL_SPI_CSRx_BITS(ATMEL_SPI_BITS_8);
+       if (!(mode & SPI_CPHA))
+               csrx |= ATMEL_SPI_CSRx_NCPHA;
+       if (mode & SPI_CPOL)
+               csrx |= ATMEL_SPI_CSRx_CPOL;
+
+       as = malloc(sizeof(struct atmel_spi_slave));
+       if (!as)
+               return NULL;
+
+       as->slave.bus = bus;
+       as->slave.cs = cs;
+       as->regs = regs;
+       as->mr = ATMEL_SPI_MR_MSTR | ATMEL_SPI_MR_MODFDIS
+                       | ATMEL_SPI_MR_PCS(~(1 << cs) & 0xf);
+       spi_writel(as, CSR(cs), csrx);
+
+       return &as->slave;
+}
+
+void spi_free_slave(struct spi_slave *slave)
+{
+       struct atmel_spi_slave *as = to_atmel_spi(slave);
+
+       free(as);
+}
+
+int spi_claim_bus(struct spi_slave *slave)
+{
+       struct atmel_spi_slave *as = to_atmel_spi(slave);
+
+       /* Enable the SPI hardware */
+       spi_writel(as, CR, ATMEL_SPI_CR_SPIEN);
+
+       /*
+        * Select the slave. This should set SCK to the correct
+        * initial state, etc.
+        */
+       spi_writel(as, MR, as->mr);
+
+       return 0;
+}
+
+void spi_release_bus(struct spi_slave *slave)
+{
+       struct atmel_spi_slave *as = to_atmel_spi(slave);
+
+       /* Disable the SPI hardware */
+       spi_writel(as, CR, ATMEL_SPI_CR_SPIDIS);
+}
+
+int spi_xfer(struct spi_slave *slave, unsigned int bitlen,
+               const void *dout, void *din, unsigned long flags)
+{
+       struct atmel_spi_slave *as = to_atmel_spi(slave);
+       unsigned int    len_tx;
+       unsigned int    len_rx;
+       unsigned int    len;
+       int             ret;
+       u32             status;
+       const u8        *txp = dout;
+       u8              *rxp = din;
+       u8              value;
+
+       ret = 0;
+       if (bitlen == 0)
+               /* Finish any previously submitted transfers */
+               goto out;
+
+       /*
+        * TODO: The controller can do non-multiple-of-8 bit
+        * transfers, but this driver currently doesn't support it.
+        *
+        * It's also not clear how such transfers are supposed to be
+        * represented as a stream of bytes...this is a limitation of
+        * the current SPI interface.
+        */
+       if (bitlen % 8) {
+               /* Errors always terminate an ongoing transfer */
+               flags |= SPI_XFER_END;
+               goto out;
+       }
+
+       len = bitlen / 8;
+
+       /*
+        * The controller can do automatic CS control, but it is
+        * somewhat quirky, and it doesn't really buy us much anyway
+        * in the context of U-Boot.
+        */
+       if (flags & SPI_XFER_BEGIN)
+               spi_cs_activate(slave);
+
+       for (len_tx = 0, len_rx = 0; len_rx < len; ) {
+               status = spi_readl(as, SR);
+
+               if (status & ATMEL_SPI_SR_OVRES)
+                       return -1;
+
+               if (len_tx < len && (status & ATMEL_SPI_SR_TDRE)) {
+                       if (txp)
+                               value = *txp++;
+                       else
+                               value = 0;
+                       spi_writel(as, TDR, value);
+                       len_tx++;
+               }
+               if (status & ATMEL_SPI_SR_RDRF) {
+                       value = spi_readl(as, RDR);
+                       if (rxp)
+                               *rxp++ = value;
+                       len_rx++;
+               }
+       }
+
+out:
+       if (flags & SPI_XFER_END) {
+               /*
+                * Wait until the transfer is completely done before
+                * we deactivate CS.
+                */
+               do {
+                       status = spi_readl(as, SR);
+               } while (!(status & ATMEL_SPI_SR_TXEMPTY));
+
+               spi_cs_deactivate(slave);
+       }
+
+       return 0;
+}
diff --git a/drivers/spi/atmel_spi.h b/drivers/spi/atmel_spi.h
new file mode 100644 (file)
index 0000000..8b69a6d
--- /dev/null
@@ -0,0 +1,95 @@
+/*
+ * Register definitions for the Atmel AT32/AT91 SPI Controller
+ */
+
+/* Register offsets */
+#define ATMEL_SPI_CR                   0x0000
+#define ATMEL_SPI_MR                   0x0004
+#define ATMEL_SPI_RDR                  0x0008
+#define ATMEL_SPI_TDR                  0x000c
+#define ATMEL_SPI_SR                   0x0010
+#define ATMEL_SPI_IER                  0x0014
+#define ATMEL_SPI_IDR                  0x0018
+#define ATMEL_SPI_IMR                  0x001c
+#define ATMEL_SPI_CSR(x)               (0x0030 + 4 * (x))
+#define ATMEL_SPI_VERSION              0x00fc
+
+/* Bits in CR */
+#define ATMEL_SPI_CR_SPIEN             (1 << 0)
+#define ATMEL_SPI_CR_SPIDIS            (1 << 1)
+#define ATMEL_SPI_CR_SWRST             (1 << 7)
+#define ATMEL_SPI_CR_LASTXFER          (1 << 24)
+
+/* Bits in MR */
+#define ATMEL_SPI_MR_MSTR              (1 << 0)
+#define ATMEL_SPI_MR_PS                        (1 << 1)
+#define ATMEL_SPI_MR_PCSDEC            (1 << 2)
+#define ATMEL_SPI_MR_FDIV              (1 << 3)
+#define ATMEL_SPI_MR_MODFDIS           (1 << 4)
+#define ATMEL_SPI_MR_LLB               (1 << 7)
+#define ATMEL_SPI_MR_PCS(x)            (((x) & 15) << 16)
+#define ATMEL_SPI_MR_DLYBCS(x)         ((x) << 24)
+
+/* Bits in RDR */
+#define ATMEL_SPI_RDR_RD(x)            (x)
+#define ATMEL_SPI_RDR_PCS(x)           ((x) << 16)
+
+/* Bits in TDR */
+#define ATMEL_SPI_TDR_TD(x)            (x)
+#define ATMEL_SPI_TDR_PCS(x)           ((x) << 16)
+#define ATMEL_SPI_TDR_LASTXFER         (1 << 24)
+
+/* Bits in SR/IER/IDR/IMR */
+#define ATMEL_SPI_SR_RDRF              (1 << 0)
+#define ATMEL_SPI_SR_TDRE              (1 << 1)
+#define ATMEL_SPI_SR_MODF              (1 << 2)
+#define ATMEL_SPI_SR_OVRES             (1 << 3)
+#define ATMEL_SPI_SR_ENDRX             (1 << 4)
+#define ATMEL_SPI_SR_ENDTX             (1 << 5)
+#define ATMEL_SPI_SR_RXBUFF            (1 << 6)
+#define ATMEL_SPI_SR_TXBUFE            (1 << 7)
+#define ATMEL_SPI_SR_NSSR              (1 << 8)
+#define ATMEL_SPI_SR_TXEMPTY           (1 << 9)
+#define ATMEL_SPI_SR_SPIENS            (1 << 16)
+
+/* Bits in CSRx */
+#define ATMEL_SPI_CSRx_CPOL            (1 << 0)
+#define ATMEL_SPI_CSRx_NCPHA           (1 << 1)
+#define ATMEL_SPI_CSRx_CSAAT           (1 << 3)
+#define ATMEL_SPI_CSRx_BITS(x)         ((x) << 4)
+#define ATMEL_SPI_CSRx_SCBR(x)         ((x) << 8)
+#define ATMEL_SPI_CSRx_SCBR_MAX                0xff
+#define ATMEL_SPI_CSRx_DLYBS(x)                ((x) << 16)
+#define ATMEL_SPI_CSRx_DLYBCT(x)       ((x) << 24)
+
+/* Bits in VERSION */
+#define ATMEL_SPI_VERSION_REV(x)       ((x) << 0)
+#define ATMEL_SPI_VERSION_MFN(x)       ((x) << 16)
+
+/* Constants for CSRx:BITS */
+#define ATMEL_SPI_BITS_8               0
+#define ATMEL_SPI_BITS_9               1
+#define ATMEL_SPI_BITS_10              2
+#define ATMEL_SPI_BITS_11              3
+#define ATMEL_SPI_BITS_12              4
+#define ATMEL_SPI_BITS_13              5
+#define ATMEL_SPI_BITS_14              6
+#define ATMEL_SPI_BITS_15              7
+#define ATMEL_SPI_BITS_16              8
+
+struct atmel_spi_slave {
+       struct spi_slave slave;
+       void            *regs;
+       u32             mr;
+};
+
+static inline struct atmel_spi_slave *to_atmel_spi(struct spi_slave *slave)
+{
+       return container_of(slave, struct atmel_spi_slave, slave);
+}
+
+/* Register access macros */
+#define spi_readl(as, reg)                                     \
+       readl(as->regs + ATMEL_SPI_##reg)
+#define spi_writel(as, reg, value)                             \
+       writel(value, as->regs + ATMEL_SPI_##reg)
index 2fe838c45d59f441b355ed10eb4ff5a357c89aff..136fb50052f1902c1cc285f0dfe46b880a3cbe8e 100644 (file)
@@ -24,6 +24,7 @@
 #include <common.h>
 #if defined(CONFIG_MPC8XXX_SPI) && defined(CONFIG_HARD_SPI)
 
+#include <malloc.h>
 #include <spi.h>
 #include <asm/mpc8xxx_spi.h>
 
 
 #define SPI_TIMEOUT    1000
 
+struct spi_slave *spi_setup_slave(unsigned int bus, unsigned int cs,
+               unsigned int max_hz, unsigned int mode)
+{
+       struct spi_slave *slave;
+
+       if (!spi_cs_is_valid(bus, cs))
+               return NULL;
+
+       slave = malloc(sizeof(struct spi_slave));
+       if (!slave)
+               return NULL;
+
+       slave->bus = bus;
+       slave->cs = cs;
+
+       /*
+        * TODO: Some of the code in spi_init() should probably move
+        * here, or into spi_claim_bus() below.
+        */
+
+       return slave;
+}
+
+void spi_free_slave(struct spi_slave *slave)
+{
+       free(slave);
+}
+
 void spi_init(void)
 {
        volatile spi8xxx_t *spi = &((immap_t *) (CFG_IMMR))->spi;
@@ -53,7 +82,18 @@ void spi_init(void)
        spi->com = 0;           /* LST bit doesn't do anything, so disregard */
 }
 
-int spi_xfer(spi_chipsel_type chipsel, int bitlen, uchar *dout, uchar *din)
+int spi_claim_bus(struct spi_slave *slave)
+{
+       return 0;
+}
+
+void spi_release_bus(struct spi_slave *slave)
+{
+
+}
+
+int spi_xfer(struct spi_slave *slave, unsigned int bitlen, const void *dout,
+               void *din, unsigned long flags)
 {
        volatile spi8xxx_t *spi = &((immap_t *) (CFG_IMMR))->spi;
        unsigned int tmpdout, tmpdin, event;
@@ -61,11 +101,11 @@ int spi_xfer(spi_chipsel_type chipsel, int bitlen, uchar *dout, uchar *din)
        int tm, isRead = 0;
        unsigned char charSize = 32;
 
-       debug("spi_xfer: chipsel %08X dout %08X din %08X bitlen %d\n",
-             (int)chipsel, *(uint *) dout, *(uint *) din, bitlen);
+       debug("spi_xfer: slave %u:%u dout %08X din %08X bitlen %u\n",
+             slave->bus, slave->cs, *(uint *) dout, *(uint *) din, bitlen);
 
-       if (chipsel != NULL)
-               (*chipsel) (1); /* select the target chip */
+       if (flags & SPI_XFER_BEGIN)
+               spi_cs_activate(slave);
 
        spi->event = 0xffffffff;        /* Clear all SPI events */
 
@@ -135,8 +175,8 @@ int spi_xfer(spi_chipsel_type chipsel, int bitlen, uchar *dout, uchar *din)
                debug("*** spi_xfer: transfer ended. Value=%08x\n", tmpdin);
        }
 
-       if (chipsel != NULL)
-               (*chipsel) (0); /* deselect the target chip */
+       if (flags & SPI_XFER_END)
+               spi_cs_deactivate(slave);
 
        return 0;
 }
index c166ec5023953eec7635ce5c7c7e0dc55f082b33..5957ada3a4a626aba3584093d2018ae0e88a3946 100644 (file)
@@ -19,6 +19,7 @@
  */
 
 #include <common.h>
+#include <malloc.h>
 #include <spi.h>
 #include <asm/io.h>
 
@@ -61,17 +62,18 @@ static unsigned long spi_bases[] = {
        0x53f84000,
 };
 
-static unsigned long spi_base;
-
 #endif
 
-spi_chipsel_type spi_chipsel[] = {
-       (spi_chipsel_type)0,
-       (spi_chipsel_type)1,
-       (spi_chipsel_type)2,
-       (spi_chipsel_type)3,
+struct mxc_spi_slave {
+       struct spi_slave slave;
+       unsigned long   base;
+       u32             ctrl_reg;
 };
-int spi_chipsel_cnt = sizeof(spi_chipsel) / sizeof(spi_chipsel[0]);
+
+static inline struct mxc_spi_slave *to_mxc_spi_slave(struct spi_slave *slave)
+{
+       return container_of(slave, struct mxc_spi_slave, slave);
+}
 
 static inline u32 reg_read(unsigned long addr)
 {
@@ -83,30 +85,31 @@ static inline void reg_write(unsigned long addr, u32 val)
        *(volatile unsigned long*)addr = val;
 }
 
-static u32 spi_xchg_single(u32 data, int bitlen)
+static u32 spi_xchg_single(struct spi_slave *slave, u32 data, int bitlen)
 {
-
-       unsigned int cfg_reg = reg_read(spi_base + MXC_CSPICTRL);
+       struct mxc_spi_slave *mxcs = to_mxc_spi_slave(slave);
+       unsigned int cfg_reg = reg_read(mxcs->base + MXC_CSPICTRL);
 
        if (MXC_CSPICTRL_BITCOUNT(bitlen - 1) != (cfg_reg & MXC_CSPICTRL_BITCOUNT(31))) {
                cfg_reg = (cfg_reg & ~MXC_CSPICTRL_BITCOUNT(31)) |
                        MXC_CSPICTRL_BITCOUNT(bitlen - 1);
-               reg_write(spi_base + MXC_CSPICTRL, cfg_reg);
+               reg_write(mxcs->base + MXC_CSPICTRL, cfg_reg);
        }
 
-       reg_write(spi_base + MXC_CSPITXDATA, data);
+       reg_write(mxcs->base + MXC_CSPITXDATA, data);
 
        cfg_reg |= MXC_CSPICTRL_XCH;
 
-       reg_write(spi_base + MXC_CSPICTRL, cfg_reg);
+       reg_write(mxcs->base + MXC_CSPICTRL, cfg_reg);
 
-       while (reg_read(spi_base + MXC_CSPICTRL) & MXC_CSPICTRL_XCH)
+       while (reg_read(mxcs->base + MXC_CSPICTRL) & MXC_CSPICTRL_XCH)
                ;
 
-       return reg_read(spi_base + MXC_CSPIRXDATA);
+       return reg_read(mxcs->base + MXC_CSPIRXDATA);
 }
 
-int spi_xfer(spi_chipsel_type chipsel, int bitlen, uchar *dout, uchar *din)
+int spi_xfer(struct spi_slave *slave, unsigned int bitlen, const void *dout,
+               void *din, unsigned long flags)
 {
        int n_blks = (bitlen + 31) / 32;
        u32 *out_l, *in_l;
@@ -117,13 +120,10 @@ int spi_xfer(spi_chipsel_type chipsel, int bitlen, uchar *dout, uchar *din)
                return 1;
        }
 
-       if (!spi_base)
-               spi_select(CONFIG_MXC_SPI_IFACE, (int)chipsel, SPI_MODE_2 | SPI_CS_HIGH);
-
        for (i = 0, in_l = (u32 *)din, out_l = (u32 *)dout;
             i < n_blks;
             i++, in_l++, out_l++, bitlen -= 32)
-               *in_l = spi_xchg_single(*out_l, bitlen);
+               *in_l = spi_xchg_single(slave, *out_l, bitlen);
 
        return 0;
 }
@@ -132,17 +132,17 @@ void spi_init(void)
 {
 }
 
-int spi_select(unsigned int bus, unsigned int dev, unsigned long mode)
+struct spi_slave *spi_setup_slave(unsigned int bus, unsigned int cs,
+                       unsigned int max_hz, unsigned int mode)
 {
        unsigned int ctrl_reg;
+       struct mxc_spi_slave *mxcs;
 
        if (bus >= sizeof(spi_bases) / sizeof(spi_bases[0]) ||
-           dev > 3)
-               return 1;
-
-       spi_base = spi_bases[bus];
+           cs > 3)
+               return NULL;
 
-       ctrl_reg = MXC_CSPICTRL_CHIPSELECT(dev) |
+       ctrl_reg = MXC_CSPICTRL_CHIPSELECT(cs) |
                MXC_CSPICTRL_BITCOUNT(31) |
                MXC_CSPICTRL_DATARATE(7) | /* FIXME: calculate data rate */
                MXC_CSPICTRL_EN |
@@ -155,12 +155,38 @@ int spi_select(unsigned int bus, unsigned int dev, unsigned long mode)
        if (mode & SPI_CS_HIGH)
                ctrl_reg |= MXC_CSPICTRL_SSPOL;
 
-       reg_write(spi_base + MXC_CSPIRESET, 1);
+       mxcs = malloc(sizeof(struct mxc_spi_slave));
+       if (!mxcs)
+               return NULL;
+
+       mxcs->slave.bus = bus;
+       mxcs->slave.cs = cs;
+       mxcs->base = spi_bases[bus];
+       mxcs->ctrl_reg = ctrl_reg;
+
+       return &mxcs->slave;
+}
+
+void spi_free_slave(struct spi_slave *slave)
+{
+       free(slave);
+}
+
+int spi_claim_bus(struct spi_slave *slave)
+{
+       struct mxc_spi_slave *mxcs = to_mxc_spi_slave(slave);
+
+       reg_write(mxcs->base + MXC_CSPIRESET, 1);
        udelay(1);
-       reg_write(spi_base + MXC_CSPICTRL, ctrl_reg);
-       reg_write(spi_base + MXC_CSPIPERIOD,
+       reg_write(mxcs->base + MXC_CSPICTRL, mxcs->ctrl_reg);
+       reg_write(mxcs->base + MXC_CSPIPERIOD,
                  MXC_CSPIPERIOD_32KHZ);
-       reg_write(spi_base + MXC_CSPIINT, 0);
+       reg_write(mxcs->base + MXC_CSPIINT, 0);
 
        return 0;
 }
+
+void spi_release_bus(struct spi_slave *slave)
+{
+       /* TODO: Shut the controller down */
+}
index 9d2f65b7f8d937a5ce530f36c47c0b36c0542fcc..20a54c54dfa62bebc220bfccbedf04224f031ba1 100644 (file)
@@ -26,6 +26,7 @@ include $(TOPDIR)/config.mk
 LIB    := $(obj)libvideo.a
 
 COBJS-y += ati_radeon_fb.o
+COBJS-$(CONFIG_ATMEL_LCD) += atmel_lcdfb.o
 COBJS-y += cfb_console.o
 COBJS-y += ct69000.o
 COBJS-y += mb862xx.o
diff --git a/drivers/video/atmel_lcdfb.c b/drivers/video/atmel_lcdfb.c
new file mode 100644 (file)
index 0000000..27df449
--- /dev/null
@@ -0,0 +1,160 @@
+/*
+ * Driver for AT91/AT32 LCD Controller
+ *
+ * Copyright (C) 2007 Atmel Corporation
+ *
+ * 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/io.h>
+#include <asm/arch/hardware.h>
+#include <asm/arch/gpio.h>
+#include <asm/arch/clk.h>
+#include <lcd.h>
+#include <atmel_lcdc.h>
+
+int lcd_line_length;
+int lcd_color_fg;
+int lcd_color_bg;
+
+void *lcd_base;                                /* Start of framebuffer memory  */
+void *lcd_console_address;             /* Start of console buffer      */
+
+short console_col;
+short console_row;
+
+/* configurable parameters */
+#define ATMEL_LCDC_CVAL_DEFAULT                0xc8
+#define ATMEL_LCDC_DMA_BURST_LEN       8
+
+#if defined(CONFIG_AT91SAM9263) || defined(CONFIG_AT91CAP9)
+#define ATMEL_LCDC_FIFO_SIZE           2048
+#else
+#define ATMEL_LCDC_FIFO_SIZE           512
+#endif
+
+#define lcdc_readl(mmio, reg)          __raw_readl((mmio)+(reg))
+#define lcdc_writel(mmio, reg, val)    __raw_writel((val), (mmio)+(reg))
+
+void lcd_setcolreg(ushort regno, ushort red, ushort green, ushort blue)
+{
+#if defined(CONFIG_ATMEL_LCD_BGR555)
+       lcdc_writel(panel_info.mmio, ATMEL_LCDC_LUT(regno),
+                   (red >> 3) | ((green & 0xf8) << 2) | ((blue & 0xf8) << 7));
+#else
+       lcdc_writel(panel_info.mmio, ATMEL_LCDC_LUT(regno),
+                   (blue >> 3) | ((green & 0xfc) << 3) | ((red & 0xf8) << 8));
+#endif
+}
+
+void lcd_ctrl_init(void *lcdbase)
+{
+       unsigned long value;
+
+       /* Turn off the LCD controller and the DMA controller */
+       lcdc_writel(panel_info.mmio, ATMEL_LCDC_PWRCON,
+                   1 << ATMEL_LCDC_GUARDT_OFFSET);
+
+       /* Wait for the LCDC core to become idle */
+       while (lcdc_readl(panel_info.mmio, ATMEL_LCDC_PWRCON) & ATMEL_LCDC_BUSY)
+               udelay(10);
+
+       lcdc_writel(panel_info.mmio, ATMEL_LCDC_DMACON, 0);
+
+       /* Reset LCDC DMA */
+       lcdc_writel(panel_info.mmio, ATMEL_LCDC_DMACON, ATMEL_LCDC_DMARST);
+
+       /* ...set frame size and burst length = 8 words (?) */
+       value = (panel_info.vl_col * panel_info.vl_row *
+                NBITS(panel_info.vl_bpix)) / 32;
+       value |= ((ATMEL_LCDC_DMA_BURST_LEN - 1) << ATMEL_LCDC_BLENGTH_OFFSET);
+       lcdc_writel(panel_info.mmio, ATMEL_LCDC_DMAFRMCFG, value);
+
+       /* Set pixel clock */
+       value = get_lcdc_clk_rate(0) / panel_info.vl_clk;
+       if (get_lcdc_clk_rate(0) % panel_info.vl_clk)
+               value++;
+       value = (value / 2) - 1;
+
+       if (!value) {
+               lcdc_writel(panel_info.mmio, ATMEL_LCDC_LCDCON1, ATMEL_LCDC_BYPASS);
+       } else
+               lcdc_writel(panel_info.mmio, ATMEL_LCDC_LCDCON1,
+                           value << ATMEL_LCDC_CLKVAL_OFFSET);
+
+       /* Initialize control register 2 */
+       value = ATMEL_LCDC_MEMOR_LITTLE | ATMEL_LCDC_CLKMOD_ALWAYSACTIVE;
+       if (panel_info.vl_tft)
+               value |= ATMEL_LCDC_DISTYPE_TFT;
+
+       if (!(panel_info.vl_sync & ATMEL_LCDC_INVLINE_INVERTED))
+               value |= ATMEL_LCDC_INVLINE_INVERTED;
+       if (!(panel_info.vl_sync & ATMEL_LCDC_INVFRAME_INVERTED))
+               value |= ATMEL_LCDC_INVFRAME_INVERTED;
+       value |= (panel_info.vl_bpix << 5);
+       lcdc_writel(panel_info.mmio, ATMEL_LCDC_LCDCON2, value);
+
+       /* Vertical timing */
+       value = (panel_info.vl_vsync_len - 1) << ATMEL_LCDC_VPW_OFFSET;
+       value |= panel_info.vl_upper_margin << ATMEL_LCDC_VBP_OFFSET;
+       value |= panel_info.vl_lower_margin;
+       lcdc_writel(panel_info.mmio, ATMEL_LCDC_TIM1, value);
+
+       /* Horizontal timing */
+       value = (panel_info.vl_right_margin - 1) << ATMEL_LCDC_HFP_OFFSET;
+       value |= (panel_info.vl_hsync_len - 1) << ATMEL_LCDC_HPW_OFFSET;
+       value |= (panel_info.vl_left_margin - 1);
+       lcdc_writel(panel_info.mmio, ATMEL_LCDC_TIM2, value);
+
+       /* Display size */
+       value = (panel_info.vl_col - 1) << ATMEL_LCDC_HOZVAL_OFFSET;
+       value |= panel_info.vl_row - 1;
+       lcdc_writel(panel_info.mmio, ATMEL_LCDC_LCDFRMCFG, value);
+
+       /* FIFO Threshold: Use formula from data sheet */
+       value = ATMEL_LCDC_FIFO_SIZE - (2 * ATMEL_LCDC_DMA_BURST_LEN + 3);
+       lcdc_writel(panel_info.mmio, ATMEL_LCDC_FIFO, value);
+
+       /* Toggle LCD_MODE every frame */
+       lcdc_writel(panel_info.mmio, ATMEL_LCDC_MVAL, 0);
+
+       /* Disable all interrupts */
+       lcdc_writel(panel_info.mmio, ATMEL_LCDC_IDR, ~0UL);
+
+       /* Set contrast */
+       value = ATMEL_LCDC_PS_DIV8 |
+               ATMEL_LCDC_POL_POSITIVE |
+               ATMEL_LCDC_ENA_PWMENABLE;
+       lcdc_writel(panel_info.mmio, ATMEL_LCDC_CONTRAST_CTR, value);
+       lcdc_writel(panel_info.mmio, ATMEL_LCDC_CONTRAST_VAL, ATMEL_LCDC_CVAL_DEFAULT);
+
+       /* Set framebuffer DMA base address and pixel offset */
+       lcdc_writel(panel_info.mmio, ATMEL_LCDC_DMABADDR1, (u_long)lcdbase);
+
+       lcdc_writel(panel_info.mmio, ATMEL_LCDC_DMACON, ATMEL_LCDC_DMAEN);
+       lcdc_writel(panel_info.mmio, ATMEL_LCDC_PWRCON,
+                   (1 << ATMEL_LCDC_GUARDT_OFFSET) | ATMEL_LCDC_PWR);
+}
+
+ulong calc_fbsize(void)
+{
+       return ((panel_info.vl_col * panel_info.vl_row *
+               NBITS(panel_info.vl_bpix)) / 8) + PAGE_SIZE;
+}
index 1993dc2359083fcded1c18338bd1a4c5ac738c3c..7e27ee18a2a4fcb6b9b83703f7829eff973f0387 100644 (file)
@@ -164,9 +164,6 @@ static struct part_info *current_part;
 /* this one defined in nand_legacy.c */
 int read_jffs2_nand(size_t start, size_t len,
                size_t * retlen, u_char * buf, int nanddev);
-#else
-/* info for NAND chips, defined in drivers/mtd/nand/nand.c */
-extern nand_info_t nand_info[];
 #endif
 
 #define NAND_PAGE_SIZE 512
index 6ea0eed95233951e719a4a59542fd19f694f3276..354e0f0e47c21532c24bf07d09e52e6967cb695c 100644 (file)
@@ -77,6 +77,8 @@ typedef struct {
 #endif
 #define Altera_EP1K100_SIZE    (166965*8)
 
+#define Altera_EP2C8_SIZE      247942
+#define Altera_EP2C20_SIZE     586562
 #define Altera_EP2C35_SIZE     883905
 
 /* Descriptor Macros
index 103be8699983fc4720f0bf9513f194e929446f62..b57875d798eab91b1b7991c5e6e249a377decb24 100644 (file)
@@ -96,4 +96,9 @@
 #define                AT91_PMC_PCK3RDY        (1 << 11)               /* Programmable Clock 3 */
 #define        AT91_PMC_IMR            (AT91_PMC + 0x6c)       /* Interrupt Mask Register */
 
+#define AT91_PMC_PROT          (AT91_PMC + 0xe4)       /* Protect Register [AT91CAP9 revC only] */
+#define                AT91_PMC_PROTKEY        0x504d4301              /* Activation Code */
+
+#define AT91_PMC_VER   (AT91_PMC + 0xfc)       /* PMC Module Version [AT91CAP9 only] */
+
 #endif
index d1b33a069a9c33de4ad4e053eb2811ffc3ef673a..0b5222813867cb795402fed1078aaa52ef6488da 100644 (file)
 #define AT91_RTT       (0xfffffd20 - AT91_BASE_SYS)
 #define AT91_PIT       (0xfffffd30 - AT91_BASE_SYS)
 #define AT91_WDT       (0xfffffd40 - AT91_BASE_SYS)
-#define AT91_GPBR      (0xfffffd50 - AT91_BASE_SYS)
+#define AT91_SCKCR     (0xfffffd50 - AT91_BASE_SYS)
+#define AT91_GPBR_REVB (0xfffffd50 - AT91_BASE_SYS)
+#define AT91_GPBR_REVC (0xfffffd60 - AT91_BASE_SYS)
 
 #define AT91_USART0    AT91CAP9_BASE_US0
 #define AT91_USART1    AT91CAP9_BASE_US1
 #define AT91_USART2    AT91CAP9_BASE_US2
 
+/*
+ * SCKCR flags
+ */
+#define AT91CAP9_SCKCR_RCEN    (1 << 0)        /* RC Oscillator Enable */
+#define AT91CAP9_SCKCR_OSC32EN (1 << 1)        /* 32kHz Oscillator Enable */
+#define AT91CAP9_SCKCR_OSC32BYP        (1 << 2)        /* 32kHz Oscillator Bypass */
+#define AT91CAP9_SCKCR_OSCSEL  (1 << 3)        /* Slow Clock Selector */
+#define                AT91CAP9_SCKCR_OSCSEL_RC        (0 << 3)
+#define                AT91CAP9_SCKCR_OSCSEL_32        (1 << 3)
+
 /*
  * Internal Memory.
  */
diff --git a/include/asm-arm/arch-at91sam9/at91sam9261.h b/include/asm-arm/arch-at91sam9/at91sam9261.h
new file mode 100644 (file)
index 0000000..752d81d
--- /dev/null
@@ -0,0 +1,105 @@
+/*
+ * [origin: Linux kernel include/asm-arm/arch-at91/at91sam9261.h]
+ *
+ * Copyright (C) SAN People
+ *
+ * Common definitions.
+ * Based on AT91SAM9261 datasheet revision E. (Preliminary)
+ *
+ * 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 AT91SAM9261_H
+#define AT91SAM9261_H
+
+/*
+ * Peripheral identifiers/interrupts.
+ */
+#define AT91_ID_FIQ            0       /* Advanced Interrupt Controller (FIQ) */
+#define AT91_ID_SYS            1       /* System Peripherals */
+#define AT91SAM9261_ID_PIOA    2       /* Parallel IO Controller A */
+#define AT91SAM9261_ID_PIOB    3       /* Parallel IO Controller B */
+#define AT91SAM9261_ID_PIOC    4       /* Parallel IO Controller C */
+#define AT91SAM9261_ID_US0     6       /* USART 0 */
+#define AT91SAM9261_ID_US1     7       /* USART 1 */
+#define AT91SAM9261_ID_US2     8       /* USART 2 */
+#define AT91SAM9261_ID_MCI     9       /* Multimedia Card Interface */
+#define AT91SAM9261_ID_UDP     10      /* USB Device Port */
+#define AT91SAM9261_ID_TWI     11      /* Two-Wire Interface */
+#define AT91SAM9261_ID_SPI0    12      /* Serial Peripheral Interface 0 */
+#define AT91SAM9261_ID_SPI1    13      /* Serial Peripheral Interface 1 */
+#define AT91SAM9261_ID_SSC0    14      /* Serial Synchronous Controller 0 */
+#define AT91SAM9261_ID_SSC1    15      /* Serial Synchronous Controller 1 */
+#define AT91SAM9261_ID_SSC2    16      /* Serial Synchronous Controller 2 */
+#define AT91SAM9261_ID_TC0     17      /* Timer Counter 0 */
+#define AT91SAM9261_ID_TC1     18      /* Timer Counter 1 */
+#define AT91SAM9261_ID_TC2     19      /* Timer Counter 2 */
+#define AT91SAM9261_ID_UHP     20      /* USB Host port */
+#define AT91SAM9261_ID_LCDC    21      /* LDC Controller */
+#define AT91SAM9261_ID_IRQ0    29      /* Advanced Interrupt Controller (IRQ0) */
+#define AT91SAM9261_ID_IRQ1    30      /* Advanced Interrupt Controller (IRQ1) */
+#define AT91SAM9261_ID_IRQ2    31      /* Advanced Interrupt Controller (IRQ2) */
+
+
+/*
+ * User Peripheral physical base addresses.
+ */
+#define AT91SAM9261_BASE_TCB0          0xfffa0000
+#define AT91SAM9261_BASE_TC0           0xfffa0000
+#define AT91SAM9261_BASE_TC1           0xfffa0040
+#define AT91SAM9261_BASE_TC2           0xfffa0080
+#define AT91SAM9261_BASE_UDP           0xfffa4000
+#define AT91SAM9261_BASE_MCI           0xfffa8000
+#define AT91SAM9261_BASE_TWI           0xfffac000
+#define AT91SAM9261_BASE_US0           0xfffb0000
+#define AT91SAM9261_BASE_US1           0xfffb4000
+#define AT91SAM9261_BASE_US2           0xfffb8000
+#define AT91SAM9261_BASE_SSC0          0xfffbc000
+#define AT91SAM9261_BASE_SSC1          0xfffc0000
+#define AT91SAM9261_BASE_SSC2          0xfffc4000
+#define AT91SAM9261_BASE_SPI0          0xfffc8000
+#define AT91SAM9261_BASE_SPI1          0xfffcc000
+#define AT91_BASE_SYS                  0xffffea00
+
+
+/*
+ * System Peripherals (offset from AT91_BASE_SYS)
+ */
+#define AT91_SDRAMC    (0xffffea00 - AT91_BASE_SYS)
+#define AT91_SMC       (0xffffec00 - AT91_BASE_SYS)
+#define AT91_MATRIX    (0xffffee00 - AT91_BASE_SYS)
+#define AT91_AIC       (0xfffff000 - AT91_BASE_SYS)
+#define AT91_DBGU      (0xfffff200 - AT91_BASE_SYS)
+#define AT91_PIOA      (0xfffff400 - AT91_BASE_SYS)
+#define AT91_PIOB      (0xfffff600 - AT91_BASE_SYS)
+#define AT91_PIOC      (0xfffff800 - AT91_BASE_SYS)
+#define AT91_PMC       (0xfffffc00 - AT91_BASE_SYS)
+#define AT91_RSTC      (0xfffffd00 - AT91_BASE_SYS)
+#define AT91_SHDWC     (0xfffffd10 - AT91_BASE_SYS)
+#define AT91_RTT       (0xfffffd20 - AT91_BASE_SYS)
+#define AT91_PIT       (0xfffffd30 - AT91_BASE_SYS)
+#define AT91_WDT       (0xfffffd40 - AT91_BASE_SYS)
+#define AT91_GPBR      (0xfffffd50 - AT91_BASE_SYS)
+
+#define AT91_USART0    AT91SAM9261_BASE_US0
+#define AT91_USART1    AT91SAM9261_BASE_US1
+#define AT91_USART2    AT91SAM9261_BASE_US2
+
+
+/*
+ * Internal Memory.
+ */
+#define AT91SAM9261_SRAM_BASE  0x00300000      /* Internal SRAM base address */
+#define AT91SAM9261_SRAM_SIZE  0x00028000      /* Internal SRAM size (160Kb) */
+
+#define AT91SAM9261_ROM_BASE   0x00400000      /* Internal ROM base address */
+#define AT91SAM9261_ROM_SIZE   SZ_32K          /* Internal ROM size (32Kb) */
+
+#define AT91SAM9261_UHP_BASE   0x00500000      /* USB Host controller */
+#define AT91SAM9261_LCDC_BASE  0x00600000      /* LDC controller */
+
+
+#endif
diff --git a/include/asm-arm/arch-at91sam9/at91sam9261_matrix.h b/include/asm-arm/arch-at91sam9/at91sam9261_matrix.h
new file mode 100644 (file)
index 0000000..e2bfc4b
--- /dev/null
@@ -0,0 +1,64 @@
+/*
+ * [origin: Linux kernel include/asm-arm/arch-at91/at91sam9261_matrix.h]
+ *
+ * Copyright (C) 2007 Atmel Corporation.
+ *
+ * Memory Controllers (MATRIX, EBI) - System peripherals registers.
+ * Based on AT91SAM9261 datasheet revision D.
+ *
+ * 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 AT91SAM9261_MATRIX_H
+#define AT91SAM9261_MATRIX_H
+
+#define AT91_MATRIX_MCFG       (AT91_MATRIX + 0x00)    /* Master Configuration Register */
+#define                AT91_MATRIX_RCB0        (1 << 0)                /* Remap Command for AHB Master 0 (ARM926EJ-S Instruction Master) */
+#define                AT91_MATRIX_RCB1        (1 << 1)                /* Remap Command for AHB Master 1 (ARM926EJ-S Data Master) */
+
+#define AT91_MATRIX_SCFG0      (AT91_MATRIX + 0x04)    /* Slave Configuration Register 0 */
+#define AT91_MATRIX_SCFG1      (AT91_MATRIX + 0x08)    /* Slave Configuration Register 1 */
+#define AT91_MATRIX_SCFG2      (AT91_MATRIX + 0x0C)    /* Slave Configuration Register 2 */
+#define AT91_MATRIX_SCFG3      (AT91_MATRIX + 0x10)    /* Slave Configuration Register 3 */
+#define AT91_MATRIX_SCFG4      (AT91_MATRIX + 0x14)    /* Slave Configuration Register 4 */
+#define                AT91_MATRIX_SLOT_CYCLE          (0xff << 0)     /* Maximum Number of Allowed Cycles for a Burst */
+#define                AT91_MATRIX_DEFMSTR_TYPE        (3    << 16)    /* Default Master Type */
+#define                        AT91_MATRIX_DEFMSTR_TYPE_NONE   (0 << 16)
+#define                        AT91_MATRIX_DEFMSTR_TYPE_LAST   (1 << 16)
+#define                        AT91_MATRIX_DEFMSTR_TYPE_FIXED  (2 << 16)
+#define                AT91_MATRIX_FIXED_DEFMSTR       (7    << 18)    /* Fixed Index of Default Master */
+
+#define AT91_MATRIX_TCR                (AT91_MATRIX + 0x24)    /* TCM Configuration Register */
+#define                AT91_MATRIX_ITCM_SIZE           (0xf << 0)      /* Size of ITCM enabled memory block */
+#define                        AT91_MATRIX_ITCM_0              (0 << 0)
+#define                        AT91_MATRIX_ITCM_16             (5 << 0)
+#define                        AT91_MATRIX_ITCM_32             (6 << 0)
+#define                        AT91_MATRIX_ITCM_64             (7 << 0)
+#define                AT91_MATRIX_DTCM_SIZE           (0xf << 4)      /* Size of DTCM enabled memory block */
+#define                        AT91_MATRIX_DTCM_0              (0 << 4)
+#define                        AT91_MATRIX_DTCM_16             (5 << 4)
+#define                        AT91_MATRIX_DTCM_32             (6 << 4)
+#define                        AT91_MATRIX_DTCM_64             (7 << 4)
+
+#define AT91_MATRIX_EBICSA     (AT91_MATRIX + 0x30)    /* EBI Chip Select Assignment Register */
+#define                AT91_MATRIX_CS1A                (1 << 1)        /* Chip Select 1 Assignment */
+#define                        AT91_MATRIX_CS1A_SMC            (0 << 1)
+#define                        AT91_MATRIX_CS1A_SDRAMC         (1 << 1)
+#define                AT91_MATRIX_CS3A                (1 << 3)        /* Chip Select 3 Assignment */
+#define                        AT91_MATRIX_CS3A_SMC            (0 << 3)
+#define                        AT91_MATRIX_CS3A_SMC_SMARTMEDIA (1 << 3)
+#define                AT91_MATRIX_CS4A                (1 << 4)        /* Chip Select 4 Assignment */
+#define                        AT91_MATRIX_CS4A_SMC            (0 << 4)
+#define                        AT91_MATRIX_CS4A_SMC_CF1        (1 << 4)
+#define                AT91_MATRIX_CS5A                (1 << 5)        /* Chip Select 5 Assignment */
+#define                        AT91_MATRIX_CS5A_SMC            (0 << 5)
+#define                        AT91_MATRIX_CS5A_SMC_CF2        (1 << 5)
+#define                AT91_MATRIX_DBPUC               (1 << 8)        /* Data Bus Pull-up Configuration */
+
+#define AT91_MATRIX_USBPUCR    (AT91_MATRIX + 0x34)    /* USB Pad Pull-Up Control Register */
+#define                AT91_MATRIX_USBPUCR_PUON        (1 << 30)       /* USB Device PAD Pull-up Enable */
+
+#endif
diff --git a/include/asm-arm/arch-at91sam9/at91sam9263.h b/include/asm-arm/arch-at91sam9/at91sam9263.h
new file mode 100644 (file)
index 0000000..98251cb
--- /dev/null
@@ -0,0 +1,127 @@
+/*
+ * [origin: Linux kernel include/asm-arm/arch-at91/at91sam9263.h]
+ *
+ * (C) 2007 Atmel Corporation.
+ *
+ * Common definitions.
+ * Based on AT91SAM9263 datasheet revision B (Preliminary).
+ *
+ * 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 AT91SAM9263_H
+#define AT91SAM9263_H
+
+/*
+ * Peripheral identifiers/interrupts.
+ */
+#define AT91_ID_FIQ            0       /* Advanced Interrupt Controller (FIQ) */
+#define AT91_ID_SYS            1       /* System Peripherals */
+#define AT91SAM9263_ID_PIOA    2       /* Parallel IO Controller A */
+#define AT91SAM9263_ID_PIOB    3       /* Parallel IO Controller B */
+#define AT91SAM9263_ID_PIOCDE  4       /* Parallel IO Controller C, D and E */
+#define AT91SAM9263_ID_US0     7       /* USART 0 */
+#define AT91SAM9263_ID_US1     8       /* USART 1 */
+#define AT91SAM9263_ID_US2     9       /* USART 2 */
+#define AT91SAM9263_ID_MCI0    10      /* Multimedia Card Interface 0 */
+#define AT91SAM9263_ID_MCI1    11      /* Multimedia Card Interface 1 */
+#define AT91SAM9263_ID_CAN     12      /* CAN */
+#define AT91SAM9263_ID_TWI     13      /* Two-Wire Interface */
+#define AT91SAM9263_ID_SPI0    14      /* Serial Peripheral Interface 0 */
+#define AT91SAM9263_ID_SPI1    15      /* Serial Peripheral Interface 1 */
+#define AT91SAM9263_ID_SSC0    16      /* Serial Synchronous Controller 0 */
+#define AT91SAM9263_ID_SSC1    17      /* Serial Synchronous Controller 1 */
+#define AT91SAM9263_ID_AC97C   18      /* AC97 Controller */
+#define AT91SAM9263_ID_TCB     19      /* Timer Counter 0, 1 and 2 */
+#define AT91SAM9263_ID_PWMC    20      /* Pulse Width Modulation Controller */
+#define AT91SAM9263_ID_EMAC    21      /* Ethernet */
+#define AT91SAM9263_ID_2DGE    23      /* 2D Graphic Engine */
+#define AT91SAM9263_ID_UDP     24      /* USB Device Port */
+#define AT91SAM9263_ID_ISI     25      /* Image Sensor Interface */
+#define AT91SAM9263_ID_LCDC    26      /* LCD Controller */
+#define AT91SAM9263_ID_DMA     27      /* DMA Controller */
+#define AT91SAM9263_ID_UHP     29      /* USB Host port */
+#define AT91SAM9263_ID_IRQ0    30      /* Advanced Interrupt Controller (IRQ0) */
+#define AT91SAM9263_ID_IRQ1    31      /* Advanced Interrupt Controller (IRQ1) */
+
+
+/*
+ * User Peripheral physical base addresses.
+ */
+#define AT91SAM9263_BASE_UDP           0xfff78000
+#define AT91SAM9263_BASE_TCB0          0xfff7c000
+#define AT91SAM9263_BASE_TC0           0xfff7c000
+#define AT91SAM9263_BASE_TC1           0xfff7c040
+#define AT91SAM9263_BASE_TC2           0xfff7c080
+#define AT91SAM9263_BASE_MCI0          0xfff80000
+#define AT91SAM9263_BASE_MCI1          0xfff84000
+#define AT91SAM9263_BASE_TWI           0xfff88000
+#define AT91SAM9263_BASE_US0           0xfff8c000
+#define AT91SAM9263_BASE_US1           0xfff90000
+#define AT91SAM9263_BASE_US2           0xfff94000
+#define AT91SAM9263_BASE_SSC0          0xfff98000
+#define AT91SAM9263_BASE_SSC1          0xfff9c000
+#define AT91SAM9263_BASE_AC97C         0xfffa0000
+#define AT91SAM9263_BASE_SPI0          0xfffa4000
+#define AT91SAM9263_BASE_SPI1          0xfffa8000
+#define AT91SAM9263_BASE_CAN           0xfffac000
+#define AT91SAM9263_BASE_PWMC          0xfffb8000
+#define AT91SAM9263_BASE_EMAC          0xfffbc000
+#define AT91SAM9263_BASE_ISI           0xfffc4000
+#define AT91SAM9263_BASE_2DGE          0xfffc8000
+#define AT91_BASE_SYS                  0xffffe000
+
+/*
+ * System Peripherals (offset from AT91_BASE_SYS)
+ */
+#define AT91_ECC0      (0xffffe000 - AT91_BASE_SYS)
+#define AT91_SDRAMC0   (0xffffe200 - AT91_BASE_SYS)
+#define AT91_SMC0      (0xffffe400 - AT91_BASE_SYS)
+#define AT91_ECC1      (0xffffe600 - AT91_BASE_SYS)
+#define AT91_SDRAMC1   (0xffffe800 - AT91_BASE_SYS)
+#define AT91_SMC1      (0xffffea00 - AT91_BASE_SYS)
+#define AT91_MATRIX    (0xffffec00 - AT91_BASE_SYS)
+#define AT91_CCFG      (0xffffed10 - AT91_BASE_SYS)
+#define AT91_DBGU      (0xffffee00 - AT91_BASE_SYS)
+#define AT91_AIC       (0xfffff000 - AT91_BASE_SYS)
+#define AT91_PIOA      (0xfffff200 - AT91_BASE_SYS)
+#define AT91_PIOB      (0xfffff400 - AT91_BASE_SYS)
+#define AT91_PIOC      (0xfffff600 - AT91_BASE_SYS)
+#define AT91_PIOD      (0xfffff800 - AT91_BASE_SYS)
+#define AT91_PIOE      (0xfffffa00 - AT91_BASE_SYS)
+#define AT91_PMC       (0xfffffc00 - AT91_BASE_SYS)
+#define AT91_RSTC      (0xfffffd00 - AT91_BASE_SYS)
+#define AT91_SHDWC     (0xfffffd10 - AT91_BASE_SYS)
+#define AT91_RTT0      (0xfffffd20 - AT91_BASE_SYS)
+#define AT91_PIT       (0xfffffd30 - AT91_BASE_SYS)
+#define AT91_WDT       (0xfffffd40 - AT91_BASE_SYS)
+#define AT91_RTT1      (0xfffffd50 - AT91_BASE_SYS)
+#define AT91_GPBR      (0xfffffd60 - AT91_BASE_SYS)
+
+#define AT91_USART0    AT91SAM9263_BASE_US0
+#define AT91_USART1    AT91SAM9263_BASE_US1
+#define AT91_USART2    AT91SAM9263_BASE_US2
+
+#define AT91_SMC       AT91_SMC0
+
+/*
+ * Internal Memory.
+ */
+#define AT91SAM9263_SRAM0_BASE 0x00300000      /* Internal SRAM 0 base address */
+#define AT91SAM9263_SRAM0_SIZE (80 * SZ_1K)    /* Internal SRAM 0 size (80Kb) */
+
+#define AT91SAM9263_ROM_BASE   0x00400000      /* Internal ROM base address */
+#define AT91SAM9263_ROM_SIZE   SZ_128K         /* Internal ROM size (128Kb) */
+
+#define AT91SAM9263_SRAM1_BASE 0x00500000      /* Internal SRAM 1 base address */
+#define AT91SAM9263_SRAM1_SIZE SZ_16K          /* Internal SRAM 1 size (16Kb) */
+
+#define AT91SAM9263_LCDC_BASE  0x00700000      /* LCD Controller */
+#define AT91SAM9263_DMAC_BASE  0x00800000      /* DMA Controller */
+#define AT91SAM9263_UHP_BASE   0x00a00000      /* USB Host controller */
+
+
+#endif
diff --git a/include/asm-arm/arch-at91sam9/at91sam9263_matrix.h b/include/asm-arm/arch-at91sam9/at91sam9263_matrix.h
new file mode 100644 (file)
index 0000000..83aaaab
--- /dev/null
@@ -0,0 +1,129 @@
+/*
+ * [origin: Linux kernel include/asm-arm/arch-at91/at91sam9263_matrix.h]
+ *
+ *  Copyright (C) 2006 Atmel Corporation.
+ *
+ * Memory Controllers (MATRIX, EBI) - System peripherals registers.
+ * Based on AT91SAM9263 datasheet revision B (Preliminary).
+ *
+ * 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 AT91SAM9263_MATRIX_H
+#define AT91SAM9263_MATRIX_H
+
+#define AT91_MATRIX_MCFG0      (AT91_MATRIX + 0x00)    /* Master Configuration Register 0 */
+#define AT91_MATRIX_MCFG1      (AT91_MATRIX + 0x04)    /* Master Configuration Register 1 */
+#define AT91_MATRIX_MCFG2      (AT91_MATRIX + 0x08)    /* Master Configuration Register 2 */
+#define AT91_MATRIX_MCFG3      (AT91_MATRIX + 0x0C)    /* Master Configuration Register 3 */
+#define AT91_MATRIX_MCFG4      (AT91_MATRIX + 0x10)    /* Master Configuration Register 4 */
+#define AT91_MATRIX_MCFG5      (AT91_MATRIX + 0x14)    /* Master Configuration Register 5 */
+#define AT91_MATRIX_MCFG6      (AT91_MATRIX + 0x18)    /* Master Configuration Register 6 */
+#define AT91_MATRIX_MCFG7      (AT91_MATRIX + 0x1C)    /* Master Configuration Register 7 */
+#define AT91_MATRIX_MCFG8      (AT91_MATRIX + 0x20)    /* Master Configuration Register 8 */
+#define                AT91_MATRIX_ULBT        (7 << 0)        /* Undefined Length Burst Type */
+#define                        AT91_MATRIX_ULBT_INFINITE       (0 << 0)
+#define                        AT91_MATRIX_ULBT_SINGLE         (1 << 0)
+#define                        AT91_MATRIX_ULBT_FOUR           (2 << 0)
+#define                        AT91_MATRIX_ULBT_EIGHT          (3 << 0)
+#define                        AT91_MATRIX_ULBT_SIXTEEN        (4 << 0)
+
+#define AT91_MATRIX_SCFG0      (AT91_MATRIX + 0x40)    /* Slave Configuration Register 0 */
+#define AT91_MATRIX_SCFG1      (AT91_MATRIX + 0x44)    /* Slave Configuration Register 1 */
+#define AT91_MATRIX_SCFG2      (AT91_MATRIX + 0x48)    /* Slave Configuration Register 2 */
+#define AT91_MATRIX_SCFG3      (AT91_MATRIX + 0x4C)    /* Slave Configuration Register 3 */
+#define AT91_MATRIX_SCFG4      (AT91_MATRIX + 0x50)    /* Slave Configuration Register 4 */
+#define AT91_MATRIX_SCFG5      (AT91_MATRIX + 0x54)    /* Slave Configuration Register 5 */
+#define AT91_MATRIX_SCFG6      (AT91_MATRIX + 0x58)    /* Slave Configuration Register 6 */
+#define AT91_MATRIX_SCFG7      (AT91_MATRIX + 0x5C)    /* Slave Configuration Register 7 */
+#define                AT91_MATRIX_SLOT_CYCLE          (0xff << 0)     /* Maximum Number of Allowed Cycles for a Burst */
+#define                AT91_MATRIX_DEFMSTR_TYPE        (3    << 16)    /* Default Master Type */
+#define                        AT91_MATRIX_DEFMSTR_TYPE_NONE   (0 << 16)
+#define                        AT91_MATRIX_DEFMSTR_TYPE_LAST   (1 << 16)
+#define                        AT91_MATRIX_DEFMSTR_TYPE_FIXED  (2 << 16)
+#define                AT91_MATRIX_FIXED_DEFMSTR       (0xf  << 18)    /* Fixed Index of Default Master */
+#define                AT91_MATRIX_ARBT                (3    << 24)    /* Arbitration Type */
+#define                        AT91_MATRIX_ARBT_ROUND_ROBIN    (0 << 24)
+#define                        AT91_MATRIX_ARBT_FIXED_PRIORITY (1 << 24)
+
+#define AT91_MATRIX_PRAS0      (AT91_MATRIX + 0x80)    /* Priority Register A for Slave 0 */
+#define AT91_MATRIX_PRBS0      (AT91_MATRIX + 0x84)    /* Priority Register B for Slave 0 */
+#define AT91_MATRIX_PRAS1      (AT91_MATRIX + 0x88)    /* Priority Register A for Slave 1 */
+#define AT91_MATRIX_PRBS1      (AT91_MATRIX + 0x8C)    /* Priority Register B for Slave 1 */
+#define AT91_MATRIX_PRAS2      (AT91_MATRIX + 0x90)    /* Priority Register A for Slave 2 */
+#define AT91_MATRIX_PRBS2      (AT91_MATRIX + 0x94)    /* Priority Register B for Slave 2 */
+#define AT91_MATRIX_PRAS3      (AT91_MATRIX + 0x98)    /* Priority Register A for Slave 3 */
+#define AT91_MATRIX_PRBS3      (AT91_MATRIX + 0x9C)    /* Priority Register B for Slave 3 */
+#define AT91_MATRIX_PRAS4      (AT91_MATRIX + 0xA0)    /* Priority Register A for Slave 4 */
+#define AT91_MATRIX_PRBS4      (AT91_MATRIX + 0xA4)    /* Priority Register B for Slave 4 */
+#define AT91_MATRIX_PRAS5      (AT91_MATRIX + 0xA8)    /* Priority Register A for Slave 5 */
+#define AT91_MATRIX_PRBS5      (AT91_MATRIX + 0xAC)    /* Priority Register B for Slave 5 */
+#define AT91_MATRIX_PRAS6      (AT91_MATRIX + 0xB0)    /* Priority Register A for Slave 6 */
+#define AT91_MATRIX_PRBS6      (AT91_MATRIX + 0xB4)    /* Priority Register B for Slave 6 */
+#define AT91_MATRIX_PRAS7      (AT91_MATRIX + 0xB8)    /* Priority Register A for Slave 7 */
+#define AT91_MATRIX_PRBS7      (AT91_MATRIX + 0xBC)    /* Priority Register B for Slave 7 */
+#define                AT91_MATRIX_M0PR                (3 << 0)        /* Master 0 Priority */
+#define                AT91_MATRIX_M1PR                (3 << 4)        /* Master 1 Priority */
+#define                AT91_MATRIX_M2PR                (3 << 8)        /* Master 2 Priority */
+#define                AT91_MATRIX_M3PR                (3 << 12)       /* Master 3 Priority */
+#define                AT91_MATRIX_M4PR                (3 << 16)       /* Master 4 Priority */
+#define                AT91_MATRIX_M5PR                (3 << 20)       /* Master 5 Priority */
+#define                AT91_MATRIX_M6PR                (3 << 24)       /* Master 6 Priority */
+#define                AT91_MATRIX_M7PR                (3 << 28)       /* Master 7 Priority */
+#define                AT91_MATRIX_M8PR                (3 << 0)        /* Master 8 Priority (in Register B) */
+
+#define AT91_MATRIX_MRCR       (AT91_MATRIX + 0x100)   /* Master Remap Control Register */
+#define                AT91_MATRIX_RCB0                (1 << 0)        /* Remap Command for AHB Master 0 (ARM926EJ-S Instruction Master) */
+#define                AT91_MATRIX_RCB1                (1 << 1)        /* Remap Command for AHB Master 1 (ARM926EJ-S Data Master) */
+#define                AT91_MATRIX_RCB2                (1 << 2)
+#define                AT91_MATRIX_RCB3                (1 << 3)
+#define                AT91_MATRIX_RCB4                (1 << 4)
+#define                AT91_MATRIX_RCB5                (1 << 5)
+#define                AT91_MATRIX_RCB6                (1 << 6)
+#define                AT91_MATRIX_RCB7                (1 << 7)
+#define                AT91_MATRIX_RCB8                (1 << 8)
+
+#define AT91_MATRIX_TCMR       (AT91_MATRIX + 0x114)   /* TCM Configuration Register */
+#define                AT91_MATRIX_ITCM_SIZE           (0xf << 0)      /* Size of ITCM enabled memory block */
+#define                        AT91_MATRIX_ITCM_0              (0 << 0)
+#define                        AT91_MATRIX_ITCM_16             (5 << 0)
+#define                        AT91_MATRIX_ITCM_32             (6 << 0)
+#define                AT91_MATRIX_DTCM_SIZE           (0xf << 4)      /* Size of DTCM enabled memory block */
+#define                        AT91_MATRIX_DTCM_0              (0 << 4)
+#define                        AT91_MATRIX_DTCM_16             (5 << 4)
+#define                        AT91_MATRIX_DTCM_32             (6 << 4)
+
+#define AT91_MATRIX_EBI0CSA    (AT91_MATRIX + 0x120)   /* EBI0 Chip Select Assignment Register */
+#define                AT91_MATRIX_EBI0_CS1A           (1 << 1)        /* Chip Select 1 Assignment */
+#define                        AT91_MATRIX_EBI0_CS1A_SMC               (0 << 1)
+#define                        AT91_MATRIX_EBI0_CS1A_SDRAMC            (1 << 1)
+#define                AT91_MATRIX_EBI0_CS3A           (1 << 3)        /* Chip Select 3 Assignment */
+#define                        AT91_MATRIX_EBI0_CS3A_SMC               (0 << 3)
+#define                        AT91_MATRIX_EBI0_CS3A_SMC_SMARTMEDIA    (1 << 3)
+#define                AT91_MATRIX_EBI0_CS4A           (1 << 4)        /* Chip Select 4 Assignment */
+#define                        AT91_MATRIX_EBI0_CS4A_SMC               (0 << 4)
+#define                        AT91_MATRIX_EBI0_CS4A_SMC_CF1           (1 << 4)
+#define                AT91_MATRIX_EBI0_CS5A           (1 << 5)        /* Chip Select 5 Assignment */
+#define                        AT91_MATRIX_EBI0_CS5A_SMC               (0 << 5)
+#define                        AT91_MATRIX_EBI0_CS5A_SMC_CF2           (1 << 5)
+#define                AT91_MATRIX_EBI0_DBPUC          (1 << 8)        /* Data Bus Pull-up Configuration */
+#define                AT91_MATRIX_EBI0_VDDIOMSEL      (1 << 16)       /* Memory voltage selection */
+#define                        AT91_MATRIX_EBI0_VDDIOMSEL_1_8V         (0 << 16)
+#define                        AT91_MATRIX_EBI0_VDDIOMSEL_3_3V         (1 << 16)
+
+#define AT91_MATRIX_EBI1CSA    (AT91_MATRIX + 0x124)   /* EBI1 Chip Select Assignment Register */
+#define                AT91_MATRIX_EBI1_CS1A           (1 << 1)        /* Chip Select 1 Assignment */
+#define                        AT91_MATRIX_EBI1_CS1A_SMC               (0 << 1)
+#define                        AT91_MATRIX_EBI1_CS1A_SDRAMC            (1 << 1)
+#define                AT91_MATRIX_EBI1_CS2A           (1 << 3)        /* Chip Select 3 Assignment */
+#define                        AT91_MATRIX_EBI1_CS2A_SMC               (0 << 3)
+#define                        AT91_MATRIX_EBI1_CS2A_SMC_SMARTMEDIA    (1 << 3)
+#define                AT91_MATRIX_EBI1_DBPUC          (1 << 8)        /* Data Bus Pull-up Configuration */
+#define                AT91_MATRIX_EBI1_VDDIOMSEL      (1 << 16)       /* Memory voltage selection */
+#define                        AT91_MATRIX_EBI1_VDDIOMSEL_1_8V         (0 << 16)
+#define                        AT91_MATRIX_EBI1_VDDIOMSEL_3_3V         (1 << 16)
+
+#endif
diff --git a/include/asm-arm/arch-at91sam9/at91sam9rl.h b/include/asm-arm/arch-at91sam9/at91sam9rl.h
new file mode 100644 (file)
index 0000000..215bbc8
--- /dev/null
@@ -0,0 +1,115 @@
+/*
+ * [origin: Linux kernel include/asm-arm/arch-at91/at91sam9rl.h]
+ *
+ *  Copyright (C) 2007 Atmel Corporation
+ *
+ * Common definitions.
+ * Based on AT91SAM9RL datasheet revision A. (Preliminary)
+ *
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License.  See the file COPYING in the main directory of this archive for
+ * more details.
+ */
+
+#ifndef AT91SAM9RL_H
+#define AT91SAM9RL_H
+
+/*
+ * Peripheral identifiers/interrupts.
+ */
+#define AT91_ID_FIQ            0       /* Advanced Interrupt Controller (FIQ) */
+#define AT91_ID_SYS            1       /* System Controller */
+#define AT91SAM9RL_ID_PIOA     2       /* Parallel IO Controller A */
+#define AT91SAM9RL_ID_PIOB     3       /* Parallel IO Controller B */
+#define AT91SAM9RL_ID_PIOC     4       /* Parallel IO Controller C */
+#define AT91SAM9RL_ID_PIOD     5       /* Parallel IO Controller D */
+#define AT91SAM9RL_ID_US0      6       /* USART 0 */
+#define AT91SAM9RL_ID_US1      7       /* USART 1 */
+#define AT91SAM9RL_ID_US2      8       /* USART 2 */
+#define AT91SAM9RL_ID_US3      9       /* USART 3 */
+#define AT91SAM9RL_ID_MCI      10      /* Multimedia Card Interface */
+#define AT91SAM9RL_ID_TWI0     11      /* TWI 0 */
+#define AT91SAM9RL_ID_TWI1     12      /* TWI 1 */
+#define AT91SAM9RL_ID_SPI      13      /* Serial Peripheral Interface */
+#define AT91SAM9RL_ID_SSC0     14      /* Serial Synchronous Controller 0 */
+#define AT91SAM9RL_ID_SSC1     15      /* Serial Synchronous Controller 1 */
+#define AT91SAM9RL_ID_TC0      16      /* Timer Counter 0 */
+#define AT91SAM9RL_ID_TC1      17      /* Timer Counter 1 */
+#define AT91SAM9RL_ID_TC2      18      /* Timer Counter 2 */
+#define AT91SAM9RL_ID_PWMC     19      /* Pulse Width Modulation Controller */
+#define AT91SAM9RL_ID_TSC      20      /* Touch Screen Controller */
+#define AT91SAM9RL_ID_DMA      21      /* DMA Controller */
+#define AT91SAM9RL_ID_UDPHS    22      /* USB Device HS */
+#define AT91SAM9RL_ID_LCDC     23      /* LCD Controller */
+#define AT91SAM9RL_ID_AC97C    24      /* AC97 Controller */
+#define AT91SAM9RL_ID_IRQ0     31      /* Advanced Interrupt Controller (IRQ0) */
+
+
+/*
+ * User Peripheral physical base addresses.
+ */
+#define AT91SAM9RL_BASE_TCB0   0xfffa0000
+#define AT91SAM9RL_BASE_TC0    0xfffa0000
+#define AT91SAM9RL_BASE_TC1    0xfffa0040
+#define AT91SAM9RL_BASE_TC2    0xfffa0080
+#define AT91SAM9RL_BASE_MCI    0xfffa4000
+#define AT91SAM9RL_BASE_TWI0   0xfffa8000
+#define AT91SAM9RL_BASE_TWI1   0xfffac000
+#define AT91SAM9RL_BASE_US0    0xfffb0000
+#define AT91SAM9RL_BASE_US1    0xfffb4000
+#define AT91SAM9RL_BASE_US2    0xfffb8000
+#define AT91SAM9RL_BASE_US3    0xfffbc000
+#define AT91SAM9RL_BASE_SSC0   0xfffc0000
+#define AT91SAM9RL_BASE_SSC1   0xfffc4000
+#define AT91SAM9RL_BASE_PWMC   0xfffc8000
+#define AT91SAM9RL_BASE_SPI    0xfffcc000
+#define AT91SAM9RL_BASE_TSC    0xfffd0000
+#define AT91SAM9RL_BASE_UDPHS  0xfffd4000
+#define AT91SAM9RL_BASE_AC97C  0xfffd8000
+#define AT91_BASE_SYS          0xffffc000
+
+
+/*
+ * System Peripherals (offset from AT91_BASE_SYS)
+ */
+#define AT91_DMA       (0xffffe600 - AT91_BASE_SYS)
+#define AT91_ECC       (0xffffe800 - AT91_BASE_SYS)
+#define AT91_SDRAMC    (0xffffea00 - AT91_BASE_SYS)
+#define AT91_SMC       (0xffffec00 - AT91_BASE_SYS)
+#define AT91_MATRIX    (0xffffee00 - AT91_BASE_SYS)
+#define AT91_CCFG      (0xffffef10 - AT91_BASE_SYS)
+#define AT91_AIC       (0xfffff000 - AT91_BASE_SYS)
+#define AT91_DBGU      (0xfffff200 - AT91_BASE_SYS)
+#define AT91_PIOA      (0xfffff400 - AT91_BASE_SYS)
+#define AT91_PIOB      (0xfffff600 - AT91_BASE_SYS)
+#define AT91_PIOC      (0xfffff800 - AT91_BASE_SYS)
+#define AT91_PIOD      (0xfffffa00 - AT91_BASE_SYS)
+#define AT91_PMC       (0xfffffc00 - AT91_BASE_SYS)
+#define AT91_RSTC      (0xfffffd00 - AT91_BASE_SYS)
+#define AT91_SHDWC     (0xfffffd10 - AT91_BASE_SYS)
+#define AT91_RTT       (0xfffffd20 - AT91_BASE_SYS)
+#define AT91_PIT       (0xfffffd30 - AT91_BASE_SYS)
+#define AT91_WDT       (0xfffffd40 - AT91_BASE_SYS)
+#define AT91_SCKCR     (0xfffffd50 - AT91_BASE_SYS)
+#define AT91_GPBR      (0xfffffd60 - AT91_BASE_SYS)
+#define AT91_RTC       (0xfffffe00 - AT91_BASE_SYS)
+
+#define AT91_USART0    AT91SAM9RL_BASE_US0
+#define AT91_USART1    AT91SAM9RL_BASE_US1
+#define AT91_USART2    AT91SAM9RL_BASE_US2
+#define AT91_USART3    AT91SAM9RL_BASE_US3
+
+
+/*
+ * Internal Memory.
+ */
+#define AT91SAM9RL_SRAM_BASE   0x00300000      /* Internal SRAM base address */
+#define AT91SAM9RL_SRAM_SIZE   SZ_16K          /* Internal SRAM size (16Kb) */
+
+#define AT91SAM9RL_ROM_BASE    0x00400000      /* Internal ROM base address */
+#define AT91SAM9RL_ROM_SIZE    (2 * SZ_16K)    /* Internal ROM size (32Kb) */
+
+#define AT91SAM9RL_LCDC_BASE   0x00500000      /* LCD Controller */
+#define AT91SAM9RL_UDPHS_BASE  0x00600000      /* USB Device HS controller */
+
+#endif
diff --git a/include/asm-arm/arch-at91sam9/at91sam9rl_matrix.h b/include/asm-arm/arch-at91sam9/at91sam9rl_matrix.h
new file mode 100644 (file)
index 0000000..af8d914
--- /dev/null
@@ -0,0 +1,96 @@
+/*
+ * [origin: Linux kernel include/asm-arm/arch-at91/at91sam9rl_matrix.h]
+ *
+ *  Copyright (C) 2007 Atmel Corporation
+ *
+ * Memory Controllers (MATRIX, EBI) - System peripherals registers.
+ * Based on AT91SAM9RL datasheet revision A. (Preliminary)
+ *
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License.  See the file COPYING in the main directory of this archive for
+ * more details.
+ */
+
+#ifndef AT91SAM9RL_MATRIX_H
+#define AT91SAM9RL_MATRIX_H
+
+#define AT91_MATRIX_MCFG0      (AT91_MATRIX + 0x00)    /* Master Configuration Register 0 */
+#define AT91_MATRIX_MCFG1      (AT91_MATRIX + 0x04)    /* Master Configuration Register 1 */
+#define AT91_MATRIX_MCFG2      (AT91_MATRIX + 0x08)    /* Master Configuration Register 2 */
+#define AT91_MATRIX_MCFG3      (AT91_MATRIX + 0x0C)    /* Master Configuration Register 3 */
+#define AT91_MATRIX_MCFG4      (AT91_MATRIX + 0x10)    /* Master Configuration Register 4 */
+#define AT91_MATRIX_MCFG5      (AT91_MATRIX + 0x14)    /* Master Configuration Register 5 */
+#define                AT91_MATRIX_ULBT        (7 << 0)        /* Undefined Length Burst Type */
+#define                        AT91_MATRIX_ULBT_INFINITE       (0 << 0)
+#define                        AT91_MATRIX_ULBT_SINGLE         (1 << 0)
+#define                        AT91_MATRIX_ULBT_FOUR           (2 << 0)
+#define                        AT91_MATRIX_ULBT_EIGHT          (3 << 0)
+#define                        AT91_MATRIX_ULBT_SIXTEEN        (4 << 0)
+
+#define AT91_MATRIX_SCFG0      (AT91_MATRIX + 0x40)    /* Slave Configuration Register 0 */
+#define AT91_MATRIX_SCFG1      (AT91_MATRIX + 0x44)    /* Slave Configuration Register 1 */
+#define AT91_MATRIX_SCFG2      (AT91_MATRIX + 0x48)    /* Slave Configuration Register 2 */
+#define AT91_MATRIX_SCFG3      (AT91_MATRIX + 0x4C)    /* Slave Configuration Register 3 */
+#define AT91_MATRIX_SCFG4      (AT91_MATRIX + 0x50)    /* Slave Configuration Register 4 */
+#define AT91_MATRIX_SCFG5      (AT91_MATRIX + 0x54)    /* Slave Configuration Register 5 */
+#define                AT91_MATRIX_SLOT_CYCLE          (0xff << 0)     /* Maximum Number of Allowed Cycles for a Burst */
+#define                AT91_MATRIX_DEFMSTR_TYPE        (3    << 16)    /* Default Master Type */
+#define                        AT91_MATRIX_DEFMSTR_TYPE_NONE   (0 << 16)
+#define                        AT91_MATRIX_DEFMSTR_TYPE_LAST   (1 << 16)
+#define                        AT91_MATRIX_DEFMSTR_TYPE_FIXED  (2 << 16)
+#define                AT91_MATRIX_FIXED_DEFMSTR       (0xf  << 18)    /* Fixed Index of Default Master */
+#define                AT91_MATRIX_ARBT                (3    << 24)    /* Arbitration Type */
+#define                        AT91_MATRIX_ARBT_ROUND_ROBIN    (0 << 24)
+#define                        AT91_MATRIX_ARBT_FIXED_PRIORITY (1 << 24)
+
+#define AT91_MATRIX_PRAS0      (AT91_MATRIX + 0x80)    /* Priority Register A for Slave 0 */
+#define AT91_MATRIX_PRAS1      (AT91_MATRIX + 0x88)    /* Priority Register A for Slave 1 */
+#define AT91_MATRIX_PRAS2      (AT91_MATRIX + 0x90)    /* Priority Register A for Slave 2 */
+#define AT91_MATRIX_PRAS3      (AT91_MATRIX + 0x98)    /* Priority Register A for Slave 3 */
+#define AT91_MATRIX_PRAS4      (AT91_MATRIX + 0xA0)    /* Priority Register A for Slave 4 */
+#define AT91_MATRIX_PRAS5      (AT91_MATRIX + 0xA8)    /* Priority Register A for Slave 5 */
+#define                AT91_MATRIX_M0PR                (3 << 0)        /* Master 0 Priority */
+#define                AT91_MATRIX_M1PR                (3 << 4)        /* Master 1 Priority */
+#define                AT91_MATRIX_M2PR                (3 << 8)        /* Master 2 Priority */
+#define                AT91_MATRIX_M3PR                (3 << 12)       /* Master 3 Priority */
+#define                AT91_MATRIX_M4PR                (3 << 16)       /* Master 4 Priority */
+#define                AT91_MATRIX_M5PR                (3 << 20)       /* Master 5 Priority */
+
+#define AT91_MATRIX_MRCR       (AT91_MATRIX + 0x100)   /* Master Remap Control Register */
+#define                AT91_MATRIX_RCB0                (1 << 0)        /* Remap Command for AHB Master 0 (ARM926EJ-S Instruction Master) */
+#define                AT91_MATRIX_RCB1                (1 << 1)        /* Remap Command for AHB Master 1 (ARM926EJ-S Data Master) */
+#define                AT91_MATRIX_RCB2                (1 << 2)
+#define                AT91_MATRIX_RCB3                (1 << 3)
+#define                AT91_MATRIX_RCB4                (1 << 4)
+#define                AT91_MATRIX_RCB5                (1 << 5)
+
+#define AT91_MATRIX_TCMR       (AT91_MATRIX + 0x114)   /* TCM Configuration Register */
+#define                AT91_MATRIX_ITCM_SIZE           (0xf << 0)      /* Size of ITCM enabled memory block */
+#define                        AT91_MATRIX_ITCM_0              (0 << 0)
+#define                        AT91_MATRIX_ITCM_16             (5 << 0)
+#define                        AT91_MATRIX_ITCM_32             (6 << 0)
+#define                AT91_MATRIX_DTCM_SIZE           (0xf << 4)      /* Size of DTCM enabled memory block */
+#define                        AT91_MATRIX_DTCM_0              (0 << 4)
+#define                        AT91_MATRIX_DTCM_16             (5 << 4)
+#define                        AT91_MATRIX_DTCM_32             (6 << 4)
+
+#define AT91_MATRIX_EBICSA     (AT91_MATRIX + 0x120)   /* EBI0 Chip Select Assignment Register */
+#define                AT91_MATRIX_CS1A                (1 << 1)        /* Chip Select 1 Assignment */
+#define                        AT91_MATRIX_CS1A_SMC            (0 << 1)
+#define                        AT91_MATRIX_CS1A_SDRAMC         (1 << 1)
+#define                AT91_MATRIX_CS3A                (1 << 3)        /* Chip Select 3 Assignment */
+#define                        AT91_MATRIX_CS3A_SMC            (0 << 3)
+#define                        AT91_MATRIX_CS3A_SMC_SMARTMEDIA (1 << 3)
+#define                AT91_MATRIX_CS4A                (1 << 4)        /* Chip Select 4 Assignment */
+#define                        AT91_MATRIX_CS4A_SMC            (0 << 4)
+#define                        AT91_MATRIX_CS4A_SMC_CF1        (1 << 4)
+#define                AT91_MATRIX_CS5A                (1 << 5)        /* Chip Select 5 Assignment */
+#define                        AT91_MATRIX_CS5A_SMC            (0 << 5)
+#define                        AT91_MATRIX_CS5A_SMC_CF2        (1 << 5)
+#define                AT91_MATRIX_DBPUC               (1 << 8)        /* Data Bus Pull-up Configuration */
+#define                AT91_MATRIX_VDDIOMSEL           (1 << 16)       /* Memory voltage selection */
+#define                        AT91_MATRIX_VDDIOMSEL_1_8V      (0 << 16)
+#define                        AT91_MATRIX_VDDIOMSEL_3_3V      (1 << 16)
+
+
+#endif
index f67b4356d9b70cc623a6da278c29fe152ba61bfb..1b502c822cd7d10d16b0a1a689c4f9aa41b61a93 100644 (file)
@@ -36,4 +36,10 @@ static inline unsigned long get_usart_clk_rate(unsigned int dev_id)
        return AT91_MASTER_CLOCK;
 }
 
+static inline unsigned long get_lcdc_clk_rate(unsigned int dev_id)
+{
+       return AT91_MASTER_CLOCK;
+}
+
+
 #endif /* __ASM_ARM_ARCH_CLK_H__ */
index d2fe45388b3908b5b97334cd1531599437ff01ec..f31241901a3224c88dd24a57efa2c2a9809b86b2 100644 (file)
 #define AT91_PMC_UHP   AT91SAM926x_PMC_UHP
 #elif defined(CONFIG_AT91SAM9261)
 #include <asm/arch/at91sam9261.h>
+#define AT91_BASE_SPI  AT91SAM9261_BASE_SPI0
+#define AT91_ID_UHP    AT91SAM9261_ID_UHP
+#define AT91_PMC_UHP   AT91SAM926x_PMC_UHP
 #elif defined(CONFIG_AT91SAM9263)
 #include <asm/arch/at91sam9263.h>
+#define AT91_BASE_EMAC AT91SAM9263_BASE_EMAC
+#define AT91_BASE_SPI  AT91SAM9263_BASE_SPI0
+#define AT91_ID_UHP    AT91SAM9263_ID_UHP
+#define AT91_PMC_UHP   AT91SAM926x_PMC_UHP
 #elif defined(CONFIG_AT91SAM9RL)
 #include <asm/arch/at91sam9rl.h>
+#define AT91_BASE_SPI  AT91SAM9RL_BASE_SPI
+#define AT91_ID_UHP    AT91SAM9RL_ID_UHP
 #elif defined(CONFIG_AT91CAP9)
 #include <asm/arch/at91cap9.h>
 #define AT91_BASE_EMAC AT91CAP9_BASE_EMAC
 #error "Unsupported AT91 processor"
 #endif
 
-/*
- * container_of - cast a member of a structure out to the containing structure
- *
- * @ptr:       the pointer to the member.
- * @type:      the type of the container struct this is embedded in.
- * @member:    the name of the member within the struct.
- */
-#define container_of(ptr, type, member) ({                     \
-       const typeof(((type *)0)->member) *__mptr = (ptr);      \
-       (type *)((char *)__mptr - offsetof(type, member)); })
-
 #endif
index 29b1fd663d0e125a4c502500b280c9ec960ac0f6..c47107e2a641bf6e11c6d66a64611ce2b7b52817 100644 (file)
@@ -25,6 +25,7 @@
 /* Currently, all the AP700x chips have these */
 #define AT32AP700x_CHIP_HAS_USART
 #define AT32AP700x_CHIP_HAS_MMCI
+#define AT32AP700x_CHIP_HAS_SPI
 
 /* Only AP7000 has ethernet interface */
 #ifdef CONFIG_AT32AP7000
index 385319aac758d1cce268c6e5d4cc5724cf8e6f41..a9d8431a66c84d3ce326ccf7717356c56c9f4898 100644 (file)
@@ -58,7 +58,7 @@ static inline unsigned long get_usart_clk_rate(unsigned int dev_id)
        return get_pba_clk_rate();
 }
 #endif
-#ifdef AT32AP700x_CHIP_HAS_USART
+#ifdef AT32AP700x_CHIP_HAS_MACB
 static inline unsigned long get_macb_pclk_rate(unsigned int dev_id)
 {
        return get_pbb_clk_rate();
@@ -74,6 +74,14 @@ static inline unsigned long get_mci_clk_rate(void)
        return get_pbb_clk_rate();
 }
 #endif
+#ifdef AT32AP700x_CHIP_HAS_SPI
+static inline unsigned long get_spi_clk_rate(unsigned int dev_id)
+{
+       return get_pba_clk_rate();
+}
+#endif
+
+extern void clk_init(void);
 
 /* Board code may need the SDRAM base clock as a compile-time constant */
 #define SDRAMC_BUS_HZ  (MAIN_CLK_RATE >> CFG_CLKDIV_HSB)
index b10a3e4f868494a87c5ca6674da2292ce8cd8a5b..ef20ceaab7cfc85d5e2807b2cad8061f56ffbc2d 100644 (file)
@@ -216,5 +216,9 @@ void gpio_enable_macb1(void);
 #ifdef AT32AP700x_CHIP_HAS_MMCI
 void gpio_enable_mmci(void);
 #endif
+#ifdef AT32AP700x_CHIP_HAS_SPI
+void gpio_enable_spi0(unsigned long cs_mask);
+void gpio_enable_spi1(unsigned long cs_mask);
+#endif
 
 #endif /* __ASM_AVR32_ARCH_GPIO_H__ */
diff --git a/include/asm-avr32/arch-at32ap700x/hmatrix.h b/include/asm-avr32/arch-at32ap700x/hmatrix.h
new file mode 100644 (file)
index 0000000..d6b6263
--- /dev/null
@@ -0,0 +1,61 @@
+/*
+ * Copyright (C) 2008 Atmel Corporation
+ *
+ * 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 __ASM_AVR32_ARCH_HMATRIX_H__
+#define __ASM_AVR32_ARCH_HMATRIX_H__
+
+#include <asm/hmatrix-common.h>
+
+/* Bitfields in SFR4 (EBI) */
+#define HMATRIX_EBI_SDRAM_ENABLE_OFFSET                1
+#define HMATRIX_EBI_SDRAM_ENABLE_SIZE          1
+#define HMATRIX_EBI_NAND_ENABLE_OFFSET         3
+#define HMATRIX_EBI_NAND_ENABLE_SIZE           1
+#define HMATRIX_EBI_CF0_ENABLE_OFFSET          4
+#define HMATRIX_EBI_CF0_ENABLE_SIZE            1
+#define HMATRIX_EBI_CF1_ENABLE_OFFSET          5
+#define HMATRIX_EBI_CF1_ENABLE_SIZE            1
+#define HMATRIX_EBI_PULLUP_DISABLE_OFFSET      8
+#define HMATRIX_EBI_PULLUP_DISABLE_SIZE                1
+
+/* HSB masters */
+#define HMATRIX_MASTER_CPU_DCACHE              0
+#define HMATRIX_MASTER_CPU_ICACHE              1
+#define HMATRIX_MASTER_PDC                     2
+#define HMATRIX_MASTER_ISI                     3
+#define HMATRIX_MASTER_USBA                    4
+#define HMATRIX_MASTER_LCDC                    5
+#define HMATRIX_MASTER_MACB0                   6
+#define HMATRIX_MASTER_MACB1                   7
+#define HMATRIX_MASTER_DMACA_M0                        8
+#define HMATRIX_MASTER_DMACA_M1                        9
+
+/* HSB slaves */
+#define HMATRIX_SLAVE_SRAM0                    0
+#define HMATRIX_SLAVE_SRAM1                    1
+#define HMATRIX_SLAVE_PBA                      2
+#define HMATRIX_SLAVE_PBB                      3
+#define HMATRIX_SLAVE_EBI                      4
+#define HMATRIX_SLAVE_USBA                     5
+#define HMATRIX_SLAVE_LCDC                     6
+#define HMATRIX_SLAVE_DMACA                    7
+
+#endif /* __ASM_AVR32_ARCH_HMATRIX_H__ */
diff --git a/include/asm-avr32/arch-at32ap700x/hmatrix2.h b/include/asm-avr32/arch-at32ap700x/hmatrix2.h
deleted file mode 100644 (file)
index b0e787a..0000000
+++ /dev/null
@@ -1,232 +0,0 @@
-/*
- * Register definition for the High-speed Bus Matrix
- */
-#ifndef __ASM_AVR32_HMATRIX2_H__
-#define __ASM_AVR32_HMATRIX2_H__
-
-/* HMATRIX2 register offsets */
-#define HMATRIX2_MCFG0                         0x0000
-#define HMATRIX2_MCFG1                         0x0004
-#define HMATRIX2_MCFG2                         0x0008
-#define HMATRIX2_MCFG3                         0x000c
-#define HMATRIX2_MCFG4                         0x0010
-#define HMATRIX2_MCFG5                         0x0014
-#define HMATRIX2_MCFG6                         0x0018
-#define HMATRIX2_MCFG7                         0x001c
-#define HMATRIX2_MCFG8                         0x0020
-#define HMATRIX2_MCFG9                         0x0024
-#define HMATRIX2_MCFG10                                0x0028
-#define HMATRIX2_MCFG11                                0x002c
-#define HMATRIX2_MCFG12                                0x0030
-#define HMATRIX2_MCFG13                                0x0034
-#define HMATRIX2_MCFG14                                0x0038
-#define HMATRIX2_MCFG15                                0x003c
-#define HMATRIX2_SCFG0                         0x0040
-#define HMATRIX2_SCFG1                         0x0044
-#define HMATRIX2_SCFG2                         0x0048
-#define HMATRIX2_SCFG3                         0x004c
-#define HMATRIX2_SCFG4                         0x0050
-#define HMATRIX2_SCFG5                         0x0054
-#define HMATRIX2_SCFG6                         0x0058
-#define HMATRIX2_SCFG7                         0x005c
-#define HMATRIX2_SCFG8                         0x0060
-#define HMATRIX2_SCFG9                         0x0064
-#define HMATRIX2_SCFG10                                0x0068
-#define HMATRIX2_SCFG11                                0x006c
-#define HMATRIX2_SCFG12                                0x0070
-#define HMATRIX2_SCFG13                                0x0074
-#define HMATRIX2_SCFG14                                0x0078
-#define HMATRIX2_SCFG15                                0x007c
-#define HMATRIX2_PRAS0                         0x0080
-#define HMATRIX2_PRBS0                         0x0084
-#define HMATRIX2_PRAS1                         0x0088
-#define HMATRIX2_PRBS1                         0x008c
-#define HMATRIX2_PRAS2                         0x0090
-#define HMATRIX2_PRBS2                         0x0094
-#define HMATRIX2_PRAS3                         0x0098
-#define HMATRIX2_PRBS3                         0x009c
-#define HMATRIX2_PRAS4                         0x00a0
-#define HMATRIX2_PRBS4                         0x00a4
-#define HMATRIX2_PRAS5                         0x00a8
-#define HMATRIX2_PRBS5                         0x00ac
-#define HMATRIX2_PRAS6                         0x00b0
-#define HMATRIX2_PRBS6                         0x00b4
-#define HMATRIX2_PRAS7                         0x00b8
-#define HMATRIX2_PRBS7                         0x00bc
-#define HMATRIX2_PRAS8                         0x00c0
-#define HMATRIX2_PRBS8                         0x00c4
-#define HMATRIX2_PRAS9                         0x00c8
-#define HMATRIX2_PRBS9                         0x00cc
-#define HMATRIX2_PRAS10                                0x00d0
-#define HMATRIX2_PRBS10                                0x00d4
-#define HMATRIX2_PRAS11                                0x00d8
-#define HMATRIX2_PRBS11                                0x00dc
-#define HMATRIX2_PRAS12                                0x00e0
-#define HMATRIX2_PRBS12                                0x00e4
-#define HMATRIX2_PRAS13                                0x00e8
-#define HMATRIX2_PRBS13                                0x00ec
-#define HMATRIX2_PRAS14                                0x00f0
-#define HMATRIX2_PRBS14                                0x00f4
-#define HMATRIX2_PRAS15                                0x00f8
-#define HMATRIX2_PRBS15                                0x00fc
-#define HMATRIX2_MRCR                          0x0100
-#define HMATRIX2_SFR0                          0x0110
-#define HMATRIX2_SFR1                          0x0114
-#define HMATRIX2_SFR2                          0x0118
-#define HMATRIX2_SFR3                          0x011c
-#define HMATRIX2_SFR4                          0x0120
-#define HMATRIX2_SFR5                          0x0124
-#define HMATRIX2_SFR6                          0x0128
-#define HMATRIX2_SFR7                          0x012c
-#define HMATRIX2_SFR8                          0x0130
-#define HMATRIX2_SFR9                          0x0134
-#define HMATRIX2_SFR10                         0x0138
-#define HMATRIX2_SFR11                         0x013c
-#define HMATRIX2_SFR12                         0x0140
-#define HMATRIX2_SFR13                         0x0144
-#define HMATRIX2_SFR14                         0x0148
-#define HMATRIX2_SFR15                         0x014c
-#define HMATRIX2_VERSION                       0x01fc
-
-/* Bitfields in MCFG0 */
-#define HMATRIX2_ULBT_OFFSET                   0
-#define HMATRIX2_ULBT_SIZE                     3
-
-/* Bitfields in SCFG0 */
-#define HMATRIX2_SLOT_CYCLE_OFFSET             0
-#define HMATRIX2_SLOT_CYCLE_SIZE               8
-#define HMATRIX2_DEFMSTR_TYPE_OFFSET           16
-#define HMATRIX2_DEFMSTR_TYPE_SIZE             2
-#define HMATRIX2_FIXED_DEFMSTR_OFFSET          18
-#define HMATRIX2_FIXED_DEFMSTR_SIZE            4
-#define HMATRIX2_ARBT_OFFSET                   24
-#define HMATRIX2_ARBT_SIZE                     2
-
-/* Bitfields in PRAS0 */
-#define HMATRIX2_M0PR_OFFSET                   0
-#define HMATRIX2_M0PR_SIZE                     4
-#define HMATRIX2_M1PR_OFFSET                   4
-#define HMATRIX2_M1PR_SIZE                     4
-#define HMATRIX2_M2PR_OFFSET                   8
-#define HMATRIX2_M2PR_SIZE                     4
-#define HMATRIX2_M3PR_OFFSET                   12
-#define HMATRIX2_M3PR_SIZE                     4
-#define HMATRIX2_M4PR_OFFSET                   16
-#define HMATRIX2_M4PR_SIZE                     4
-#define HMATRIX2_M5PR_OFFSET                   20
-#define HMATRIX2_M5PR_SIZE                     4
-#define HMATRIX2_M6PR_OFFSET                   24
-#define HMATRIX2_M6PR_SIZE                     4
-#define HMATRIX2_M7PR_OFFSET                   28
-#define HMATRIX2_M7PR_SIZE                     4
-
-/* Bitfields in PRBS0 */
-#define HMATRIX2_M8PR_OFFSET                   0
-#define HMATRIX2_M8PR_SIZE                     4
-#define HMATRIX2_M9PR_OFFSET                   4
-#define HMATRIX2_M9PR_SIZE                     4
-#define HMATRIX2_M10PR_OFFSET                  8
-#define HMATRIX2_M10PR_SIZE                    4
-#define HMATRIX2_M11PR_OFFSET                  12
-#define HMATRIX2_M11PR_SIZE                    4
-#define HMATRIX2_M12PR_OFFSET                  16
-#define HMATRIX2_M12PR_SIZE                    4
-#define HMATRIX2_M13PR_OFFSET                  20
-#define HMATRIX2_M13PR_SIZE                    4
-#define HMATRIX2_M14PR_OFFSET                  24
-#define HMATRIX2_M14PR_SIZE                    4
-#define HMATRIX2_M15PR_OFFSET                  28
-#define HMATRIX2_M15PR_SIZE                    4
-
-/* Bitfields in MRCR */
-#define HMATRIX2_RBC0_OFFSET                   0
-#define HMATRIX2_RBC0_SIZE                     1
-#define HMATRIX2_RBC1_OFFSET                   1
-#define HMATRIX2_RBC1_SIZE                     1
-#define HMATRIX2_RBC2_OFFSET                   2
-#define HMATRIX2_RBC2_SIZE                     1
-#define HMATRIX2_RBC3_OFFSET                   3
-#define HMATRIX2_RBC3_SIZE                     1
-#define HMATRIX2_RBC4_OFFSET                   4
-#define HMATRIX2_RBC4_SIZE                     1
-#define HMATRIX2_RBC5_OFFSET                   5
-#define HMATRIX2_RBC5_SIZE                     1
-#define HMATRIX2_RBC6_OFFSET                   6
-#define HMATRIX2_RBC6_SIZE                     1
-#define HMATRIX2_RBC7_OFFSET                   7
-#define HMATRIX2_RBC7_SIZE                     1
-#define HMATRIX2_RBC8_OFFSET                   8
-#define HMATRIX2_RBC8_SIZE                     1
-#define HMATRIX2_RBC9_OFFSET                   9
-#define HMATRIX2_RBC9_SIZE                     1
-#define HMATRIX2_RBC10_OFFSET                  10
-#define HMATRIX2_RBC10_SIZE                    1
-#define HMATRIX2_RBC11_OFFSET                  11
-#define HMATRIX2_RBC11_SIZE                    1
-#define HMATRIX2_RBC12_OFFSET                  12
-#define HMATRIX2_RBC12_SIZE                    1
-#define HMATRIX2_RBC13_OFFSET                  13
-#define HMATRIX2_RBC13_SIZE                    1
-#define HMATRIX2_RBC14_OFFSET                  14
-#define HMATRIX2_RBC14_SIZE                    1
-#define HMATRIX2_RBC15_OFFSET                  15
-#define HMATRIX2_RBC15_SIZE                    1
-
-/* Bitfields in SFR0 */
-#define HMATRIX2_SFR_OFFSET                    0
-#define HMATRIX2_SFR_SIZE                      32
-
-/* Bitfields in SFR4 */
-#define HMATRIX2_CS1A_OFFSET                   1
-#define HMATRIX2_CS1A_SIZE                     1
-#define HMATRIX2_CS3A_OFFSET                   3
-#define HMATRIX2_CS3A_SIZE                     1
-#define HMATRIX2_CS4A_OFFSET                   4
-#define HMATRIX2_CS4A_SIZE                     1
-#define HMATRIX2_CS5A_OFFSET                   5
-#define HMATRIX2_CS5A_SIZE                     1
-#define HMATRIX2_DBPUC_OFFSET                  8
-#define HMATRIX2_DBPUC_SIZE                    1
-
-/* Bitfields in VERSION */
-#define HMATRIX2_VERSION_OFFSET                        0
-#define HMATRIX2_VERSION_SIZE                  12
-#define HMATRIX2_MFN_OFFSET                    16
-#define HMATRIX2_MFN_SIZE                      3
-
-/* Constants for ULBT */
-#define HMATRIX2_ULBT_INFINITE                 0
-#define HMATRIX2_ULBT_SINGLE                   1
-#define HMATRIX2_ULBT_FOUR_BEAT                        2
-#define HMATRIX2_ULBT_SIXTEEN_BEAT             4
-
-/* Constants for DEFMSTR_TYPE */
-#define HMATRIX2_DEFMSTR_TYPE_NO_DEFAULT       0
-#define HMATRIX2_DEFMSTR_TYPE_LAST_DEFAULT     1
-#define HMATRIX2_DEFMSTR_TYPE_FIXED_DEFAULT    2
-
-/* Constants for ARBT */
-#define HMATRIX2_ARBT_ROUND_ROBIN              0
-#define HMATRIX2_ARBT_FIXED_PRIORITY           1
-
-/* Bit manipulation macros */
-#define HMATRIX2_BIT(name)                                     \
-       (1 << HMATRIX2_##name##_OFFSET)
-#define HMATRIX2_BF(name,value)                                        \
-       (((value) & ((1 << HMATRIX2_##name##_SIZE) - 1))        \
-        << HMATRIX2_##name##_OFFSET)
-#define HMATRIX2_BFEXT(name,value)                             \
-       (((value) >> HMATRIX2_##name##_OFFSET)                  \
-        & ((1 << HMATRIX2_##name##_SIZE) - 1))
-#define HMATRIX2_BFINS(name,value,old)                         \
-       (((old) & ~(((1 << HMATRIX2_##name##_SIZE) - 1)         \
-                   << HMATRIX2_##name##_OFFSET))               \
-        | HMATRIX2_BF(name,value))
-
-/* Register access macros */
-#define hmatrix2_readl(reg)                                    \
-       readl((void *)HMATRIX_BASE + HMATRIX2_##reg)
-#define hmatrix2_writel(reg,value)                             \
-       writel((value), (void *)HMATRIX_BASE + HMATRIX2_##reg)
-
-#endif /* __ASM_AVR32_HMATRIX2_H__ */
index 5513e88e7b030001ca7eea9fddab14cda779c8bf..6592c039fae52b7d8a751b6facdcbc24fc289054 100644 (file)
 #ifndef __AT32AP7000_MEMORY_MAP_H__
 #define __AT32AP7000_MEMORY_MAP_H__
 
+/* Internal and external memories */
+#define EBI_SRAM_CS0_BASE                      0x00000000
+#define EBI_SRAM_CS0_SIZE                      0x04000000
+#define EBI_SRAM_CS4_BASE                      0x04000000
+#define EBI_SRAM_CS4_SIZE                      0x04000000
+#define EBI_SRAM_CS2_BASE                      0x08000000
+#define EBI_SRAM_CS2_SIZE                      0x04000000
+#define EBI_SRAM_CS3_BASE                      0x0c000000
+#define EBI_SRAM_CS3_SIZE                      0x04000000
+#define EBI_SRAM_CS1_BASE                      0x10000000
+#define EBI_SRAM_CS1_SIZE                      0x10000000
+#define EBI_SRAM_CS5_BASE                      0x20000000
+#define EBI_SRAM_CS5_SIZE                      0x04000000
+
+#define EBI_SDRAM_BASE                         EBI_SRAM_CS1_BASE
+#define EBI_SDRAM_SIZE                         EBI_SRAM_CS1_SIZE
+
+#define INTERNAL_SRAM_BASE                     0x24000000
+#define INTERNAL_SRAM_SIZE                     0x00008000
+
 /* Devices on the High Speed Bus (HSB) */
 #define LCDC_BASE                              0xFF000000
 #define DMAC_BASE                              0xFF200000
diff --git a/include/asm-avr32/hmatrix-common.h b/include/asm-avr32/hmatrix-common.h
new file mode 100644 (file)
index 0000000..4b7e610
--- /dev/null
@@ -0,0 +1,131 @@
+/*
+ * Copyright (C) 2008 Atmel Corporation
+ *
+ * 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 __ASM_AVR32_HMATRIX_COMMON_H__
+#define __ASM_AVR32_HMATRIX_COMMON_H__
+
+/* HMATRIX register offsets */
+struct hmatrix_regs {
+       u32     MCFG[16];
+       u32     SCFG[16];
+       struct {
+               u32     A;
+               u32     B;
+       } PRS[16];
+       u32     MRCR;
+       u32     __reserved[3];
+       u32     SFR[16];
+};
+
+/* Bitfields in MCFG */
+#define HMATRIX_ULBT_OFFSET                    0
+#define HMATRIX_ULBT_SIZE                      3
+
+/* Bitfields in SCFG */
+#define HMATRIX_SLOT_CYCLE_OFFSET              0
+#define HMATRIX_SLOT_CYCLE_SIZE                        8
+#define HMATRIX_DEFMSTR_TYPE_OFFSET            16
+#define HMATRIX_DEFMSTR_TYPE_SIZE              2
+#define HMATRIX_FIXED_DEFMSTR_OFFSET           18
+#define HMATRIX_FIXED_DEFMSTR_SIZE             4
+#define HMATRIX_ARBT_OFFSET                    24
+#define HMATRIX_ARBT_SIZE                      1
+
+/* Bitfields in PRS.A */
+#define HMATRIX_M0PR_OFFSET                    0
+#define HMATRIX_M0PR_SIZE                      4
+#define HMATRIX_M1PR_OFFSET                    4
+#define HMATRIX_M1PR_SIZE                      4
+#define HMATRIX_M2PR_OFFSET                    8
+#define HMATRIX_M2PR_SIZE                      4
+#define HMATRIX_M3PR_OFFSET                    12
+#define HMATRIX_M3PR_SIZE                      4
+#define HMATRIX_M4PR_OFFSET                    16
+#define HMATRIX_M4PR_SIZE                      4
+#define HMATRIX_M5PR_OFFSET                    20
+#define HMATRIX_M5PR_SIZE                      4
+#define HMATRIX_M6PR_OFFSET                    24
+#define HMATRIX_M6PR_SIZE                      4
+#define HMATRIX_M7PR_OFFSET                    28
+#define HMATRIX_M7PR_SIZE                      4
+
+/* Bitfields in PRS.B */
+#define HMATRIX_M8PR_OFFSET                    0
+#define HMATRIX_M8PR_SIZE                      4
+#define HMATRIX_M9PR_OFFSET                    4
+#define HMATRIX_M9PR_SIZE                      4
+#define HMATRIX_M10PR_OFFSET                   8
+#define HMATRIX_M10PR_SIZE                     4
+#define HMATRIX_M11PR_OFFSET                   12
+#define HMATRIX_M11PR_SIZE                     4
+#define HMATRIX_M12PR_OFFSET                   16
+#define HMATRIX_M12PR_SIZE                     4
+#define HMATRIX_M13PR_OFFSET                   20
+#define HMATRIX_M13PR_SIZE                     4
+#define HMATRIX_M14PR_OFFSET                   24
+#define HMATRIX_M14PR_SIZE                     4
+#define HMATRIX_M15PR_OFFSET                   28
+#define HMATRIX_M15PR_SIZE                     4
+
+/* Constants for ULBT */
+#define HMATRIX_ULBT_INFINITE                  0
+#define HMATRIX_ULBT_SINGLE                    1
+#define HMATRIX_ULBT_FOUR_BEAT                 2
+#define HMATRIX_ULBT_EIGHT_BEAT                        3
+#define HMATRIX_ULBT_SIXTEEN_BEAT              4
+
+/* Constants for DEFMSTR_TYPE */
+#define HMATRIX_DEFMSTR_TYPE_NO_DEFAULT                0
+#define HMATRIX_DEFMSTR_TYPE_LAST_DEFAULT      1
+#define HMATRIX_DEFMSTR_TYPE_FIXED_DEFAULT     2
+
+/* Constants for ARBT */
+#define HMATRIX_ARBT_ROUND_ROBIN               0
+#define HMATRIX_ARBT_FIXED_PRIORITY            1
+
+/* Bit manipulation macros */
+#define HMATRIX_BIT(name)                                      \
+       (1 << HMATRIX_##name##_OFFSET)
+#define HMATRIX_BF(name,value)                                 \
+       (((value) & ((1 << HMATRIX_##name##_SIZE) - 1))         \
+        << HMATRIX_##name##_OFFSET)
+#define HMATRIX_BFEXT(name,value)                              \
+       (((value) >> HMATRIX_##name##_OFFSET)                   \
+        & ((1 << HMATRIX_##name##_SIZE) - 1))
+#define HMATRIX_BFINS(name,value,old)                          \
+       (((old) & ~(((1 << HMATRIX_##name##_SIZE) - 1)          \
+                   << HMATRIX_##name##_OFFSET))                \
+        | HMATRIX_BF(name,value))
+
+/* Register access macros */
+#define __hmatrix_reg(reg)                                     \
+       (((volatile struct hmatrix_regs *)HMATRIX_BASE)->reg)
+#define hmatrix_read(reg)                                      \
+       (__hmatrix_reg(reg))
+#define hmatrix_write(reg, value)                              \
+       do { __hmatrix_reg(reg) = (value); } while (0)
+
+#define hmatrix_slave_read(slave, reg)                         \
+       hmatrix_read(reg[HMATRIX_SLAVE_##slave])
+#define hmatrix_slave_write(slave, reg, value)                 \
+       hmatrix_write(reg[HMATRIX_SLAVE_##slave], value)
+
+#endif /* __ASM_AVR32_HMATRIX_COMMON_H__ */
index 833af6e6ad160c1bbf05e1dd7c905d57972114d2..7bdefc1fd247b1e619d6615fb95fed54eea9f18a 100644 (file)
 #ifndef __ASM_AVR32_SDRAM_H
 #define __ASM_AVR32_SDRAM_H
 
-struct sdram_info {
-       unsigned long phys_addr;
-       unsigned int row_bits, col_bits, bank_bits;
-       unsigned int cas, twr, trc, trp, trcd, tras, txsr;
+struct sdram_config {
+       /* Number of data bits. */
+       enum {
+               SDRAM_DATA_16BIT,
+               SDRAM_DATA_32BIT,
+       } data_bits;
+
+       /* Number of address bits */
+       uint8_t row_bits, col_bits, bank_bits;
+
+       /* SDRAM timings in cycles */
+       uint8_t cas, twr, trc, trp, trcd, tras, txsr;
 
        /* SDRAM refresh period in cycles */
        unsigned long refresh_period;
 };
 
-extern unsigned long sdram_init(const struct sdram_info *info);
+/*
+ * Attempt to initialize the SDRAM controller using the specified
+ * parameters. Return the expected size of the memory area based on
+ * the number of address and data bits.
+ *
+ * The caller should verify that the configuration is correct by
+ * running a memory test, e.g. get_ram_size().
+ */
+extern unsigned long sdram_init(void *sdram_base,
+                       const struct sdram_config *config);
 
 #endif /* __ASM_AVR32_SDRAM_H */
index 75373abde73be0c493451121f5c86d0a23fd7507..fe819b2db6ece7aaf0fad7d642dfeb414ed18722 100644 (file)
 /* References to section boundaries */
 
 extern char _text[], _etext[];
-extern char __flashprog_start[], __flashprog_end[];
 extern char _data[], __data_lma[], _edata[], __edata_lma[];
 extern char __got_start[], __got_lma[], __got_end[];
 extern char _end[];
 
-/*
- * Everything in .flashprog will be locked in the icache so it doesn't
- * get disturbed when executing flash commands.
- */
-#define __flashprog __attribute__((section(".flashprog"), __noinline__))
-
 #endif /* __ASM_AVR32_SECTIONS_H */
index 71dfcaf284076e99cf18592fb27d2bdf89399745..85ef008b7272b3d756ddbba0e64d8649327b6da7 100644 (file)
@@ -42,15 +42,4 @@ typedef struct bd_info {
 #define bi_memstart bi_dram[0].start
 #define bi_memsize bi_dram[0].size
 
-/**
- *  container_of - cast a member of a structure out to the containing structure
- *
- *    @ptr:        the pointer to the member.
- *    @type:       the type of the container struct this is embedded in.
- *    @member:     the name of the member within the struct.
- */
-#define container_of(ptr, type, member) ({                      \
-       const typeof( ((type *)0)->member ) *__mptr = (ptr);    \
-       (type *)( (char *)__mptr - offsetof(type,member) );})
-
 #endif /* __ASM_U_BOOT_H__ */
diff --git a/include/asm-mips/errno.h b/include/asm-mips/errno.h
new file mode 100644 (file)
index 0000000..1665a63
--- /dev/null
@@ -0,0 +1,143 @@
+/*
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License.  See the file "COPYING" in the main directory of this archive
+ * for more details.
+ *
+ * Copyright (C) 1995, 1999, 2001, 2002 by Ralf Baechle
+ */
+#ifndef _ASM_MIPS_ERRNO_H
+#define _ASM_MIPS_ERRNO_H
+
+/*
+ * These first 34 error codes are from Linux 2.6, <asm-generic/errno-base.h>
+ */
+#define        EPERM            1      /* Operation not permitted */
+#define        ENOENT           2      /* No such file or directory */
+#define        ESRCH            3      /* No such process */
+#define        EINTR            4      /* Interrupted system call */
+#define        EIO              5      /* I/O error */
+#define        ENXIO            6      /* No such device or address */
+#define        E2BIG            7      /* Argument list too long */
+#define        ENOEXEC          8      /* Exec format error */
+#define        EBADF            9      /* Bad file number */
+#define        ECHILD          10      /* No child processes */
+#define        EAGAIN          11      /* Try again */
+#define        ENOMEM          12      /* Out of memory */
+#define        EACCES          13      /* Permission denied */
+#define        EFAULT          14      /* Bad address */
+#define        ENOTBLK         15      /* Block device required */
+#define        EBUSY           16      /* Device or resource busy */
+#define        EEXIST          17      /* File exists */
+#define        EXDEV           18      /* Cross-device link */
+#define        ENODEV          19      /* No such device */
+#define        ENOTDIR         20      /* Not a directory */
+#define        EISDIR          21      /* Is a directory */
+#define        EINVAL          22      /* Invalid argument */
+#define        ENFILE          23      /* File table overflow */
+#define        EMFILE          24      /* Too many open files */
+#define        ENOTTY          25      /* Not a typewriter */
+#define        ETXTBSY         26      /* Text file busy */
+#define        EFBIG           27      /* File too large */
+#define        ENOSPC          28      /* No space left on device */
+#define        ESPIPE          29      /* Illegal seek */
+#define        EROFS           30      /* Read-only file system */
+#define        EMLINK          31      /* Too many links */
+#define        EPIPE           32      /* Broken pipe */
+#define        EDOM            33      /* Math argument out of domain of func */
+#define        ERANGE          34      /* Math result not representable */
+
+/*
+ * These error numbers are intended to be MIPS ABI compatible
+ */
+#define        ENOMSG          35      /* No message of desired type */
+#define        EIDRM           36      /* Identifier removed */
+#define        ECHRNG          37      /* Channel number out of range */
+#define        EL2NSYNC        38      /* Level 2 not synchronized */
+#define        EL3HLT          39      /* Level 3 halted */
+#define        EL3RST          40      /* Level 3 reset */
+#define        ELNRNG          41      /* Link number out of range */
+#define        EUNATCH         42      /* Protocol driver not attached */
+#define        ENOCSI          43      /* No CSI structure available */
+#define        EL2HLT          44      /* Level 2 halted */
+#define        EDEADLK         45      /* Resource deadlock would occur */
+#define        ENOLCK          46      /* No record locks available */
+#define        EBADE           50      /* Invalid exchange */
+#define        EBADR           51      /* Invalid request descriptor */
+#define        EXFULL          52      /* Exchange full */
+#define        ENOANO          53      /* No anode */
+#define        EBADRQC         54      /* Invalid request code */
+#define        EBADSLT         55      /* Invalid slot */
+#define        EDEADLOCK       56      /* File locking deadlock error */
+#define        EBFONT          59      /* Bad font file format */
+#define        ENOSTR          60      /* Device not a stream */
+#define        ENODATA         61      /* No data available */
+#define        ETIME           62      /* Timer expired */
+#define        ENOSR           63      /* Out of streams resources */
+#define        ENONET          64      /* Machine is not on the network */
+#define        ENOPKG          65      /* Package not installed */
+#define        EREMOTE         66      /* Object is remote */
+#define        ENOLINK         67      /* Link has been severed */
+#define        EADV            68      /* Advertise error */
+#define        ESRMNT          69      /* Srmount error */
+#define        ECOMM           70      /* Communication error on send */
+#define        EPROTO          71      /* Protocol error */
+#define        EDOTDOT         73      /* RFS specific error */
+#define        EMULTIHOP       74      /* Multihop attempted */
+#define        EBADMSG         77      /* Not a data message */
+#define        ENAMETOOLONG    78      /* File name too long */
+#define        EOVERFLOW       79      /* Value too large for defined data type */
+#define        ENOTUNIQ        80      /* Name not unique on network */
+#define        EBADFD          81      /* File descriptor in bad state */
+#define        EREMCHG         82      /* Remote address changed */
+#define        ELIBACC         83      /* Can not access a needed shared library */
+#define        ELIBBAD         84      /* Accessing a corrupted shared library */
+#define        ELIBSCN         85      /* .lib section in a.out corrupted */
+#define        ELIBMAX         86      /* Attempting to link in too many shared libraries */
+#define        ELIBEXEC        87      /* Cannot exec a shared library directly */
+#define        EILSEQ          88      /* Illegal byte sequence */
+#define        ENOSYS          89      /* Function not implemented */
+#define        ELOOP           90      /* Too many symbolic links encountered */
+#define        ERESTART        91      /* Interrupted system call should be restarted */
+#define        ESTRPIPE        92      /* Streams pipe error */
+#define        ENOTEMPTY       93      /* Directory not empty */
+#define        EUSERS          94      /* Too many users */
+#define        ENOTSOCK        95      /* Socket operation on non-socket */
+#define        EDESTADDRREQ    96      /* Destination address required */
+#define        EMSGSIZE        97      /* Message too long */
+#define        EPROTOTYPE      98      /* Protocol wrong type for socket */
+#define        ENOPROTOOPT     99      /* Protocol not available */
+#define        EPROTONOSUPPORT 120     /* Protocol not supported */
+#define        ESOCKTNOSUPPORT 121     /* Socket type not supported */
+#define        EOPNOTSUPP      122     /* Operation not supported on transport endpoint */
+#define        EPFNOSUPPORT    123     /* Protocol family not supported */
+#define        EAFNOSUPPORT    124     /* Address family not supported by protocol */
+#define        EADDRINUSE      125     /* Address already in use */
+#define        EADDRNOTAVAIL   126     /* Cannot assign requested address */
+#define        ENETDOWN        127     /* Network is down */
+#define        ENETUNREACH     128     /* Network is unreachable */
+#define        ENETRESET       129     /* Network dropped connection because of reset */
+#define        ECONNABORTED    130     /* Software caused connection abort */
+#define        ECONNRESET      131     /* Connection reset by peer */
+#define        ENOBUFS         132     /* No buffer space available */
+#define        EISCONN         133     /* Transport endpoint is already connected */
+#define        ENOTCONN        134     /* Transport endpoint is not connected */
+#define        EUCLEAN         135     /* Structure needs cleaning */
+#define        ENOTNAM         137     /* Not a XENIX named type file */
+#define        ENAVAIL         138     /* No XENIX semaphores available */
+#define        EISNAM          139     /* Is a named type file */
+#define        EREMOTEIO       140     /* Remote I/O error */
+#define EINIT          141     /* Reserved */
+#define EREMDEV                142     /* Error 142 */
+#define        ESHUTDOWN       143     /* Cannot send after transport endpoint shutdown */
+#define        ETOOMANYREFS    144     /* Too many references: cannot splice */
+#define        ETIMEDOUT       145     /* Connection timed out */
+#define        ECONNREFUSED    146     /* Connection refused */
+#define        EHOSTDOWN       147     /* Host is down */
+#define        EHOSTUNREACH    148     /* No route to host */
+#define        EWOULDBLOCK     EAGAIN  /* Operation would block */
+#define        EALREADY        149     /* Operation already in progress */
+#define        EINPROGRESS     150     /* Operation now in progress */
+#define        ESTALE          151     /* Stale NFS file handle */
+#define ECANCELED      158     /* AIO operation canceled */
+
+#endif /* _ASM_MIPS_ERRNO_H */
index 61a0dac1cee54d90a3e568b5e1b8a62ffbbc2d7d..be7e5c65ec1f38e91435844192af5a9637c2b337 100644 (file)
@@ -7,8 +7,8 @@
  * Copyright (C) 2000 Silicon Graphics, Inc.
  * Modified for further R[236]000 support by Paul M. Antoine, 1996.
  * Kevin D. Kissell, kevink@mips.com and Carsten Langgaard, carstenl@mips.com
- * Copyright (C) 2000 MIPS Technologies, Inc.  All rights reserved.
- * Copyright (C) 2003  Maciej W. Rozycki
+ * Copyright (C) 2000, 07 MIPS Technologies, Inc.
+ * Copyright (C) 2003, 2004  Maciej W. Rozycki
  */
 #ifndef _ASM_MIPSREGS_H
 #define _ASM_MIPSREGS_H
 #define STR(x) __STR(x)
 #endif
 
+/*
+ *  Configure language
+ */
+#ifdef __ASSEMBLY__
+#define _ULCAST_
+#else
+#define _ULCAST_ (unsigned long)
+#endif
+
 /*
  * Coprocessor 0 register names
  */
 #define CP0_XCONTEXT $20
 #define CP0_FRAMEMASK $21
 #define CP0_DIAGNOSTIC $22
+#define CP0_DEBUG $23
+#define CP0_DEPC $24
 #define CP0_PERFORMANCE $25
 #define CP0_ECC $26
 #define CP0_CACHEERR $27
 #define CP0_TAGLO $28
 #define CP0_TAGHI $29
 #define CP0_ERROREPC $30
+#define CP0_DESAVE $31
 
 /*
  * R4640/R4650 cp0 register names.  These registers are listed
 #define CP0_S1_DERRADDR0  $26
 #define CP0_S1_DERRADDR1  $27
 #define CP0_S1_INTCONTROL $20
+
+/*
+ * Coprocessor 0 Set 2 register names
+ */
+#define CP0_S2_SRSCTL  $12     /* MIPSR2 */
+
+/*
+ * Coprocessor 0 Set 3 register names
+ */
+#define CP0_S3_SRSMAP  $12     /* MIPSR2 */
+
+/*
+ *  TX39 Series
+ */
+#define CP0_TX39_CACHE $7
+
 /*
  * Coprocessor 1 (FPU) register names
  */
-#define CP1_REVISION   $0
-#define CP1_STATUS     $31
+#define CP1_REVISION   $0
+#define CP1_STATUS     $31
 
 /*
  * FPU Status Register Values
  * Status Register Values
  */
 
-#define FPU_CSR_FLUSH   0x01000000      /* flush denormalised results to 0 */
-#define FPU_CSR_COND    0x00800000      /* $fcc0 */
-#define FPU_CSR_COND0   0x00800000      /* $fcc0 */
-#define FPU_CSR_COND1   0x02000000      /* $fcc1 */
-#define FPU_CSR_COND2   0x04000000      /* $fcc2 */
-#define FPU_CSR_COND3   0x08000000      /* $fcc3 */
-#define FPU_CSR_COND4   0x10000000      /* $fcc4 */
-#define FPU_CSR_COND5   0x20000000      /* $fcc5 */
-#define FPU_CSR_COND6   0x40000000      /* $fcc6 */
-#define FPU_CSR_COND7   0x80000000      /* $fcc7 */
+#define FPU_CSR_FLUSH  0x01000000      /* flush denormalised results to 0 */
+#define FPU_CSR_COND   0x00800000      /* $fcc0 */
+#define FPU_CSR_COND0  0x00800000      /* $fcc0 */
+#define FPU_CSR_COND1  0x02000000      /* $fcc1 */
+#define FPU_CSR_COND2  0x04000000      /* $fcc2 */
+#define FPU_CSR_COND3  0x08000000      /* $fcc3 */
+#define FPU_CSR_COND4  0x10000000      /* $fcc4 */
+#define FPU_CSR_COND5  0x20000000      /* $fcc5 */
+#define FPU_CSR_COND6  0x40000000      /* $fcc6 */
+#define FPU_CSR_COND7  0x80000000      /* $fcc7 */
 
 /*
  * X the exception cause indicator
  * E the exception enable
  * S the sticky/flag bit
-*/
-#define FPU_CSR_ALL_X 0x0003f000
-#define FPU_CSR_UNI_X   0x00020000
-#define FPU_CSR_INV_X   0x00010000
-#define FPU_CSR_DIV_X   0x00008000
-#define FPU_CSR_OVF_X   0x00004000
-#define FPU_CSR_UDF_X   0x00002000
-#define FPU_CSR_INE_X   0x00001000
-
-#define FPU_CSR_ALL_E   0x00000f80
-#define FPU_CSR_INV_E   0x00000800
-#define FPU_CSR_DIV_E   0x00000400
-#define FPU_CSR_OVF_E   0x00000200
-#define FPU_CSR_UDF_E   0x00000100
-#define FPU_CSR_INE_E   0x00000080
-
-#define FPU_CSR_ALL_S   0x0000007c
-#define FPU_CSR_INV_S   0x00000040
-#define FPU_CSR_DIV_S   0x00000020
-#define FPU_CSR_OVF_S   0x00000010
-#define FPU_CSR_UDF_S   0x00000008
-#define FPU_CSR_INE_S   0x00000004
+ */
+#define FPU_CSR_ALL_X  0x0003f000
+#define FPU_CSR_UNI_X  0x00020000
+#define FPU_CSR_INV_X  0x00010000
+#define FPU_CSR_DIV_X  0x00008000
+#define FPU_CSR_OVF_X  0x00004000
+#define FPU_CSR_UDF_X  0x00002000
+#define FPU_CSR_INE_X  0x00001000
 
-/* rounding mode */
-#define FPU_CSR_RN      0x0     /* nearest */
-#define FPU_CSR_RZ      0x1     /* towards zero */
-#define FPU_CSR_RU      0x2     /* towards +Infinity */
-#define FPU_CSR_RD      0x3     /* towards -Infinity */
+#define FPU_CSR_ALL_E  0x00000f80
+#define FPU_CSR_INV_E  0x00000800
+#define FPU_CSR_DIV_E  0x00000400
+#define FPU_CSR_OVF_E  0x00000200
+#define FPU_CSR_UDF_E  0x00000100
+#define FPU_CSR_INE_E  0x00000080
 
+#define FPU_CSR_ALL_S  0x0000007c
+#define FPU_CSR_INV_S  0x00000040
+#define FPU_CSR_DIV_S  0x00000020
+#define FPU_CSR_OVF_S  0x00000010
+#define FPU_CSR_UDF_S  0x00000008
+#define FPU_CSR_INE_S  0x00000004
+
+/* rounding mode */
+#define FPU_CSR_RN     0x0     /* nearest */
+#define FPU_CSR_RZ     0x1     /* towards zero */
+#define FPU_CSR_RU     0x2     /* towards +Infinity */
+#define FPU_CSR_RD     0x3     /* towards -Infinity */
 
 /*
  * Values for PageMask register
  */
-#include <linux/config.h>
 #ifdef CONFIG_CPU_VR41XX
-#define PM_1K   0x00000000
-#define PM_4K   0x00001800
-#define PM_16K  0x00007800
-#define PM_64K  0x0001f800
-#define PM_256K 0x0007f800
-#else
-#define PM_4K   0x00000000
-#define PM_16K  0x00006000
-#define PM_64K  0x0001e000
-#define PM_256K 0x0007e000
-#define PM_1M   0x001fe000
-#define PM_4M   0x007fe000
-#define PM_16M  0x01ffe000
-#endif
 
-/*
- * Values used for computation of new tlb entries
- */
-#define PL_4K   12
-#define PL_16K  14
-#define PL_64K  16
-#define PL_256K 18
-#define PL_1M   20
-#define PL_4M   22
-#define PL_16M  24
+/* Why doesn't stupidity hurt ... */
 
-/*
- * Macros to access the system control coprocessor
- */
-#define read_32bit_cp0_register(source)                         \
-({ int __res;                                                   \
-       __asm__ __volatile__(                                   \
-       ".set\tpush\n\t"                                        \
-       ".set\treorder\n\t"                                     \
-       "mfc0\t%0,"STR(source)"\n\t"                            \
-       ".set\tpop"                                             \
-       : "=r" (__res));                                        \
-       __res;})
+#define PM_1K          0x00000000
+#define PM_4K          0x00001800
+#define PM_16K         0x00007800
+#define PM_64K         0x0001f800
+#define PM_256K                0x0007f800
 
-#define read_32bit_cp0_set1_register(source)                    \
-({ int __res;                                                   \
-       __asm__ __volatile__(                                   \
-       ".set\tpush\n\t"                                        \
-       ".set\treorder\n\t"                                     \
-       "cfc0\t%0,"STR(source)"\n\t"                            \
-       ".set\tpop"                                             \
-       : "=r" (__res));                                        \
-       __res;})
+#else
 
-/*
- * For now use this only with interrupts disabled!
- */
-#define read_64bit_cp0_register(source)                         \
-({ int __res;                                                   \
-       __asm__ __volatile__(                                   \
-       ".set\tmips3\n\t"                                       \
-       "dmfc0\t%0,"STR(source)"\n\t"                           \
-       ".set\tmips0"                                           \
-       : "=r" (__res));                                        \
-       __res;})
+#define PM_4K          0x00000000
+#define PM_16K         0x00006000
+#define PM_64K         0x0001e000
+#define PM_256K                0x0007e000
+#define PM_1M          0x001fe000
+#define PM_4M          0x007fe000
+#define PM_16M         0x01ffe000
+#define PM_64M         0x07ffe000
+#define PM_256M                0x1fffe000
 
-#define write_32bit_cp0_register(register,value)                \
-       __asm__ __volatile__(                                   \
-       "mtc0\t%0,"STR(register)"\n\t"                          \
-       "nop"                                                   \
-       : : "r" (value));
-
-#define write_32bit_cp0_set1_register(register,value)           \
-       __asm__ __volatile__(                                   \
-       "ctc0\t%0,"STR(register)"\n\t"                          \
-       "nop"                                                   \
-       : : "r" (value));
-
-#define write_64bit_cp0_register(register,value)                \
-       __asm__ __volatile__(                                   \
-       ".set\tmips3\n\t"                                       \
-       "dmtc0\t%0,"STR(register)"\n\t"                         \
-       ".set\tmips0"                                           \
-       : : "r" (value))
-
-/*
- * This should be changed when we get a compiler that support the MIPS32 ISA.
- */
-#define read_mips32_cp0_config1()                               \
-({ int __res;                                                   \
-       __asm__ __volatile__(                                   \
-       ".set\tnoreorder\n\t"                                   \
-       ".set\tnoat\n\t"                                        \
-       ".word\t0x40018001\n\t"                                 \
-       "move\t%0,$1\n\t"                                       \
-       ".set\tat\n\t"                                          \
-       ".set\treorder"                                         \
-       :"=r" (__res));                                         \
-       __res;})
+#endif
 
-#define tlb_write_indexed()                                     \
-       __asm__ __volatile__(                                   \
-               ".set noreorder\n\t"                            \
-               "tlbwi\n\t"                                     \
-".set reorder")
+/*
+ * Values used for computation of new tlb entries
+ */
+#define PL_4K          12
+#define PL_16K         14
+#define PL_64K         16
+#define PL_256K                18
+#define PL_1M          20
+#define PL_4M          22
+#define PL_16M         24
+#define PL_64M         26
+#define PL_256M                28
 
 /*
  * R4x00 interrupt enable / cause bits
  */
-#define IE_SW0          (1<< 8)
-#define IE_SW1          (1<< 9)
-#define IE_IRQ0         (1<<10)
-#define IE_IRQ1         (1<<11)
-#define IE_IRQ2         (1<<12)
-#define IE_IRQ3         (1<<13)
-#define IE_IRQ4         (1<<14)
-#define IE_IRQ5         (1<<15)
+#define IE_SW0         (_ULCAST_(1) <<  8)
+#define IE_SW1         (_ULCAST_(1) <<  9)
+#define IE_IRQ0                (_ULCAST_(1) << 10)
+#define IE_IRQ1                (_ULCAST_(1) << 11)
+#define IE_IRQ2                (_ULCAST_(1) << 12)
+#define IE_IRQ3                (_ULCAST_(1) << 13)
+#define IE_IRQ4                (_ULCAST_(1) << 14)
+#define IE_IRQ5                (_ULCAST_(1) << 15)
 
 /*
  * R4x00 interrupt cause bits
  */
-#define C_SW0           (1<< 8)
-#define C_SW1           (1<< 9)
-#define C_IRQ0          (1<<10)
-#define C_IRQ1          (1<<11)
-#define C_IRQ2          (1<<12)
-#define C_IRQ3          (1<<13)
-#define C_IRQ4          (1<<14)
-#define C_IRQ5          (1<<15)
-
-#ifndef _LANGUAGE_ASSEMBLY
-/*
- * Manipulate the status register.
- * Mostly used to access the interrupt bits.
- */
-#define __BUILD_SET_CP0(name,register)                          \
-extern __inline__ unsigned int                                  \
-set_cp0_##name(unsigned int set)                               \
-{                                                               \
-       unsigned int res;                                       \
-                                                               \
-       res = read_32bit_cp0_register(register);                \
-       res |= set;                                             \
-       write_32bit_cp0_register(register, res);                \
-                                                               \
-       return res;                                             \
-}                                                              \
-                                                               \
-extern __inline__ unsigned int                                  \
-clear_cp0_##name(unsigned int clear)                           \
-{                                                               \
-       unsigned int res;                                       \
-                                                               \
-       res = read_32bit_cp0_register(register);                \
-       res &= ~clear;                                          \
-       write_32bit_cp0_register(register, res);                \
-                                                               \
-       return res;                                             \
-}                                                              \
-                                                               \
-extern __inline__ unsigned int                                  \
-change_cp0_##name(unsigned int change, unsigned int new)       \
-{                                                               \
-       unsigned int res;                                       \
-                                                               \
-       res = read_32bit_cp0_register(register);                \
-       res &= ~change;                                         \
-       res |= (new & change);                                  \
-       if(change)                                              \
-               write_32bit_cp0_register(register, res);        \
-                                                               \
-       return res;                                             \
-}
-
-__BUILD_SET_CP0(status,CP0_STATUS)
-__BUILD_SET_CP0(cause,CP0_CAUSE)
-__BUILD_SET_CP0(config,CP0_CONFIG)
-
-#endif /* defined (_LANGUAGE_ASSEMBLY) */
+#define C_SW0          (_ULCAST_(1) <<  8)
+#define C_SW1          (_ULCAST_(1) <<  9)
+#define C_IRQ0         (_ULCAST_(1) << 10)
+#define C_IRQ1         (_ULCAST_(1) << 11)
+#define C_IRQ2         (_ULCAST_(1) << 12)
+#define C_IRQ3         (_ULCAST_(1) << 13)
+#define C_IRQ4         (_ULCAST_(1) << 14)
+#define C_IRQ5         (_ULCAST_(1) << 15)
 
 /*
  * Bitfields in the R4xx0 cp0 status register
@@ -336,10 +247,17 @@ __BUILD_SET_CP0(config,CP0_CONFIG)
 #define ST0_DE                 0x00010000
 #define ST0_CE                 0x00020000
 
+/*
+ * Setting c0_status.co enables Hit_Writeback and Hit_Writeback_Invalidate
+ * cacheops in userspace.  This bit exists only on RM7000 and RM9000
+ * processors.
+ */
+#define ST0_CO                 0x08000000
+
 /*
  * Bitfields in the R[23]000 cp0 status register.
  */
-#define ST0_IEC                 0x00000001
+#define ST0_IEC                        0x00000001
 #define ST0_KUC                        0x00000002
 #define ST0_IEP                        0x00000004
 #define ST0_KUP                        0x00000008
@@ -353,9 +271,14 @@ __BUILD_SET_CP0(config,CP0_CONFIG)
 /*
  * Bits specific to the R4640/R4650
  */
-#define ST0_UM                 (1   <<  4)
-#define ST0_IL                 (1   << 23)
-#define ST0_DL                 (1   << 24)
+#define ST0_UM                 (_ULCAST_(1) <<  4)
+#define ST0_IL                 (_ULCAST_(1) << 23)
+#define ST0_DL                 (_ULCAST_(1) << 24)
+
+/*
+ * Enable the MIPS MDMX and DSP ASEs
+ */
+#define ST0_MX                 0x01000000
 
 /*
  * Bitfields in the TX39 family CP0 Configuration Register 3
@@ -395,39 +318,40 @@ __BUILD_SET_CP0(config,CP0_CONFIG)
  */
 #define ST0_IM                 0x0000ff00
 #define  STATUSB_IP0           8
-#define  STATUSF_IP0           (1   <<  8)
+#define  STATUSF_IP0           (_ULCAST_(1) <<  8)
 #define  STATUSB_IP1           9
-#define  STATUSF_IP1           (1   <<  9)
+#define  STATUSF_IP1           (_ULCAST_(1) <<  9)
 #define  STATUSB_IP2           10
-#define  STATUSF_IP2           (1   << 10)
+#define  STATUSF_IP2           (_ULCAST_(1) << 10)
 #define  STATUSB_IP3           11
-#define  STATUSF_IP3           (1   << 11)
+#define  STATUSF_IP3           (_ULCAST_(1) << 11)
 #define  STATUSB_IP4           12
-#define  STATUSF_IP4           (1   << 12)
+#define  STATUSF_IP4           (_ULCAST_(1) << 12)
 #define  STATUSB_IP5           13
-#define  STATUSF_IP5           (1   << 13)
+#define  STATUSF_IP5           (_ULCAST_(1) << 13)
 #define  STATUSB_IP6           14
-#define  STATUSF_IP6           (1   << 14)
+#define  STATUSF_IP6           (_ULCAST_(1) << 14)
 #define  STATUSB_IP7           15
-#define  STATUSF_IP7           (1   << 15)
+#define  STATUSF_IP7           (_ULCAST_(1) << 15)
 #define  STATUSB_IP8           0
-#define  STATUSF_IP8           (1   << 0)
+#define  STATUSF_IP8           (_ULCAST_(1) <<  0)
 #define  STATUSB_IP9           1
-#define  STATUSF_IP9           (1   << 1)
+#define  STATUSF_IP9           (_ULCAST_(1) <<  1)
 #define  STATUSB_IP10          2
-#define  STATUSF_IP10          (1   << 2)
+#define  STATUSF_IP10          (_ULCAST_(1) <<  2)
 #define  STATUSB_IP11          3
-#define  STATUSF_IP11          (1   << 3)
+#define  STATUSF_IP11          (_ULCAST_(1) <<  3)
 #define  STATUSB_IP12          4
-#define  STATUSF_IP12          (1   << 4)
+#define  STATUSF_IP12          (_ULCAST_(1) <<  4)
 #define  STATUSB_IP13          5
-#define  STATUSF_IP13          (1   << 5)
+#define  STATUSF_IP13          (_ULCAST_(1) <<  5)
 #define  STATUSB_IP14          6
-#define  STATUSF_IP14          (1   << 6)
+#define  STATUSF_IP14          (_ULCAST_(1) <<  6)
 #define  STATUSB_IP15          7
-#define  STATUSF_IP15          (1   << 7)
+#define  STATUSF_IP15          (_ULCAST_(1) <<  7)
 #define ST0_CH                 0x00040000
 #define ST0_SR                 0x00100000
+#define ST0_TS                 0x00200000
 #define ST0_BEV                        0x00400000
 #define ST0_RE                 0x02000000
 #define ST0_FR                 0x04000000
@@ -444,35 +368,36 @@ __BUILD_SET_CP0(config,CP0_CONFIG)
  * Refer to your MIPS R4xx0 manual, chapter 5 for explanation.
  */
 #define  CAUSEB_EXCCODE                2
-#define  CAUSEF_EXCCODE                (31  <<  2)
+#define  CAUSEF_EXCCODE                (_ULCAST_(31)  <<  2)
 #define  CAUSEB_IP             8
-#define  CAUSEF_IP             (255 <<  8)
+#define  CAUSEF_IP             (_ULCAST_(255) <<  8)
 #define  CAUSEB_IP0            8
-#define  CAUSEF_IP0            (1   <<  8)
+#define  CAUSEF_IP0            (_ULCAST_(1)   <<  8)
 #define  CAUSEB_IP1            9
-#define  CAUSEF_IP1            (1   <<  9)
+#define  CAUSEF_IP1            (_ULCAST_(1)   <<  9)
 #define  CAUSEB_IP2            10
-#define  CAUSEF_IP2            (1   << 10)
+#define  CAUSEF_IP2            (_ULCAST_(1)   << 10)
 #define  CAUSEB_IP3            11
-#define  CAUSEF_IP3            (1   << 11)
+#define  CAUSEF_IP3            (_ULCAST_(1)   << 11)
 #define  CAUSEB_IP4            12
-#define  CAUSEF_IP4            (1   << 12)
+#define  CAUSEF_IP4            (_ULCAST_(1)   << 12)
 #define  CAUSEB_IP5            13
-#define  CAUSEF_IP5            (1   << 13)
+#define  CAUSEF_IP5            (_ULCAST_(1)   << 13)
 #define  CAUSEB_IP6            14
-#define  CAUSEF_IP6            (1   << 14)
+#define  CAUSEF_IP6            (_ULCAST_(1)   << 14)
 #define  CAUSEB_IP7            15
-#define  CAUSEF_IP7            (1   << 15)
+#define  CAUSEF_IP7            (_ULCAST_(1)   << 15)
 #define  CAUSEB_IV             23
-#define  CAUSEF_IV             (1   << 23)
+#define  CAUSEF_IV             (_ULCAST_(1)   << 23)
 #define  CAUSEB_CE             28
-#define  CAUSEF_CE             (3   << 28)
+#define  CAUSEF_CE             (_ULCAST_(3)   << 28)
 #define  CAUSEB_BD             31
-#define  CAUSEF_BD             (1   << 31)
+#define  CAUSEF_BD             (_ULCAST_(1)   << 31)
 
 /*
- * Bits in the coprozessor 0 config register.
+ * Bits in the coprocessor 0 config register.
  */
+/* Generic bits.  */
 #define CONF_CM_CACHABLE_NO_WA         0
 #define CONF_CM_CACHABLE_WA            1
 #define CONF_CM_UNCACHED               2
@@ -482,66 +407,958 @@ __BUILD_SET_CP0(config,CP0_CONFIG)
 #define CONF_CM_CACHABLE_CUW           6
 #define CONF_CM_CACHABLE_ACCELERATED   7
 #define CONF_CM_CMASK                  7
-#define CONF_DB                                (1 <<  4)
-#define CONF_IB                                (1 <<  5)
-#define CONF_SC                                (1 << 17)
-#define CONF_AC                         (1 << 23)
-#define CONF_HALT                       (1 << 25)
+#define CONF_BE                        (_ULCAST_(1) << 15)
+
+/* Bits common to various processors.  */
+#define CONF_CU                        (_ULCAST_(1) <<  3)
+#define CONF_DB                        (_ULCAST_(1) <<  4)
+#define CONF_IB                        (_ULCAST_(1) <<  5)
+#define CONF_DC                        (_ULCAST_(7) <<  6)
+#define CONF_IC                        (_ULCAST_(7) <<  9)
+#define CONF_EB                        (_ULCAST_(1) << 13)
+#define CONF_EM                        (_ULCAST_(1) << 14)
+#define CONF_SM                        (_ULCAST_(1) << 16)
+#define CONF_SC                        (_ULCAST_(1) << 17)
+#define CONF_EW                        (_ULCAST_(3) << 18)
+#define CONF_EP                        (_ULCAST_(15)<< 24)
+#define CONF_EC                        (_ULCAST_(7) << 28)
+#define CONF_CM                        (_ULCAST_(1) << 31)
+
+/* Bits specific to the R4xx0.  */
+#define R4K_CONF_SW            (_ULCAST_(1) << 20)
+#define R4K_CONF_SS            (_ULCAST_(1) << 21)
+#define R4K_CONF_SB            (_ULCAST_(3) << 22)
+
+/* Bits specific to the R5000.  */
+#define R5K_CONF_SE            (_ULCAST_(1) << 12)
+#define R5K_CONF_SS            (_ULCAST_(3) << 20)
+
+/* Bits specific to the RM7000.  */
+#define RM7K_CONF_SE           (_ULCAST_(1) <<  3)
+#define RM7K_CONF_TE           (_ULCAST_(1) << 12)
+#define RM7K_CONF_CLK          (_ULCAST_(1) << 16)
+#define RM7K_CONF_TC           (_ULCAST_(1) << 17)
+#define RM7K_CONF_SI           (_ULCAST_(3) << 20)
+#define RM7K_CONF_SC           (_ULCAST_(1) << 31)
+
+/* Bits specific to the R10000.  */
+#define R10K_CONF_DN           (_ULCAST_(3) <<  3)
+#define R10K_CONF_CT           (_ULCAST_(1) <<  5)
+#define R10K_CONF_PE           (_ULCAST_(1) <<  6)
+#define R10K_CONF_PM           (_ULCAST_(3) <<  7)
+#define R10K_CONF_EC           (_ULCAST_(15)<<  9)
+#define R10K_CONF_SB           (_ULCAST_(1) << 13)
+#define R10K_CONF_SK           (_ULCAST_(1) << 14)
+#define R10K_CONF_SS           (_ULCAST_(7) << 16)
+#define R10K_CONF_SC           (_ULCAST_(7) << 19)
+#define R10K_CONF_DC           (_ULCAST_(7) << 26)
+#define R10K_CONF_IC           (_ULCAST_(7) << 29)
+
+/* Bits specific to the VR41xx.  */
+#define VR41_CONF_CS           (_ULCAST_(1) << 12)
+#define VR41_CONF_P4K          (_ULCAST_(1) << 13)
+#define VR41_CONF_BP           (_ULCAST_(1) << 16)
+#define VR41_CONF_M16          (_ULCAST_(1) << 20)
+#define VR41_CONF_AD           (_ULCAST_(1) << 23)
+
+/* Bits specific to the R30xx.  */
+#define R30XX_CONF_FDM         (_ULCAST_(1) << 19)
+#define R30XX_CONF_REV         (_ULCAST_(1) << 22)
+#define R30XX_CONF_AC          (_ULCAST_(1) << 23)
+#define R30XX_CONF_RF          (_ULCAST_(1) << 24)
+#define R30XX_CONF_HALT                (_ULCAST_(1) << 25)
+#define R30XX_CONF_FPINT       (_ULCAST_(7) << 26)
+#define R30XX_CONF_DBR         (_ULCAST_(1) << 29)
+#define R30XX_CONF_SB          (_ULCAST_(1) << 30)
+#define R30XX_CONF_LOCK                (_ULCAST_(1) << 31)
+
+/* Bits specific to the TX49.  */
+#define TX49_CONF_DC           (_ULCAST_(1) << 16)
+#define TX49_CONF_IC           (_ULCAST_(1) << 17)  /* conflict with CONF_SC */
+#define TX49_CONF_HALT         (_ULCAST_(1) << 18)
+#define TX49_CONF_CWFON                (_ULCAST_(1) << 27)
+
+/* Bits specific to the MIPS32/64 PRA.  */
+#define MIPS_CONF_MT           (_ULCAST_(7) <<  7)
+#define MIPS_CONF_AR           (_ULCAST_(7) << 10)
+#define MIPS_CONF_AT           (_ULCAST_(3) << 13)
+#define MIPS_CONF_M            (_ULCAST_(1) << 31)
+
+/*
+ * Bits in the MIPS32/64 PRA coprocessor 0 config registers 1 and above.
+ */
+#define MIPS_CONF1_FP          (_ULCAST_(1) <<  0)
+#define MIPS_CONF1_EP          (_ULCAST_(1) <<  1)
+#define MIPS_CONF1_CA          (_ULCAST_(1) <<  2)
+#define MIPS_CONF1_WR          (_ULCAST_(1) <<  3)
+#define MIPS_CONF1_PC          (_ULCAST_(1) <<  4)
+#define MIPS_CONF1_MD          (_ULCAST_(1) <<  5)
+#define MIPS_CONF1_C2          (_ULCAST_(1) <<  6)
+#define MIPS_CONF1_DA          (_ULCAST_(7) <<  7)
+#define MIPS_CONF1_DL          (_ULCAST_(7) << 10)
+#define MIPS_CONF1_DS          (_ULCAST_(7) << 13)
+#define MIPS_CONF1_IA          (_ULCAST_(7) << 16)
+#define MIPS_CONF1_IL          (_ULCAST_(7) << 19)
+#define MIPS_CONF1_IS          (_ULCAST_(7) << 22)
+#define MIPS_CONF1_TLBS                (_ULCAST_(63)<< 25)
+
+#define MIPS_CONF2_SA          (_ULCAST_(15)<<  0)
+#define MIPS_CONF2_SL          (_ULCAST_(15)<<  4)
+#define MIPS_CONF2_SS          (_ULCAST_(15)<<  8)
+#define MIPS_CONF2_SU          (_ULCAST_(15)<< 12)
+#define MIPS_CONF2_TA          (_ULCAST_(15)<< 16)
+#define MIPS_CONF2_TL          (_ULCAST_(15)<< 20)
+#define MIPS_CONF2_TS          (_ULCAST_(15)<< 24)
+#define MIPS_CONF2_TU          (_ULCAST_(7) << 28)
+
+#define MIPS_CONF3_TL          (_ULCAST_(1) <<  0)
+#define MIPS_CONF3_SM          (_ULCAST_(1) <<  1)
+#define MIPS_CONF3_MT          (_ULCAST_(1) <<  2)
+#define MIPS_CONF3_SP          (_ULCAST_(1) <<  4)
+#define MIPS_CONF3_VINT                (_ULCAST_(1) <<  5)
+#define MIPS_CONF3_VEIC                (_ULCAST_(1) <<  6)
+#define MIPS_CONF3_LPA         (_ULCAST_(1) <<  7)
+#define MIPS_CONF3_DSP         (_ULCAST_(1) << 10)
+#define MIPS_CONF3_ULRI                (_ULCAST_(1) << 13)
+
+#define MIPS_CONF7_WII         (_ULCAST_(1) << 31)
+
+#define MIPS_CONF7_RPS         (_ULCAST_(1) << 2)
+
+/*
+ * Bits in the MIPS32/64 coprocessor 1 (FPU) revision register.
+ */
+#define MIPS_FPIR_S            (_ULCAST_(1) << 16)
+#define MIPS_FPIR_D            (_ULCAST_(1) << 17)
+#define MIPS_FPIR_PS           (_ULCAST_(1) << 18)
+#define MIPS_FPIR_3D           (_ULCAST_(1) << 19)
+#define MIPS_FPIR_W            (_ULCAST_(1) << 20)
+#define MIPS_FPIR_L            (_ULCAST_(1) << 21)
+#define MIPS_FPIR_F64          (_ULCAST_(1) << 22)
+
+#ifndef __ASSEMBLY__
+
+/*
+ * Functions to access the R10000 performance counters.  These are basically
+ * mfc0 and mtc0 instructions from and to coprocessor register with a 5-bit
+ * performance counter number encoded into bits 1 ... 5 of the instruction.
+ * Only performance counters 0 to 1 actually exist, so for a non-R10000 aware
+ * disassembler these will look like an access to sel 0 or 1.
+ */
+#define read_r10k_perf_cntr(counter)                           \
+({                                                             \
+       unsigned int __res;                                     \
+       __asm__ __volatile__(                                   \
+       "mfpc\t%0, %1"                                          \
+       : "=r" (__res)                                          \
+       : "i" (counter));                                       \
+                                                               \
+       __res;                                                  \
+})
+
+#define write_r10k_perf_cntr(counter,val)                      \
+do {                                                           \
+       __asm__ __volatile__(                                   \
+       "mtpc\t%0, %1"                                          \
+       :                                                       \
+       : "r" (val), "i" (counter));                            \
+} while (0)
+
+#define read_r10k_perf_event(counter)                          \
+({                                                             \
+       unsigned int __res;                                     \
+       __asm__ __volatile__(                                   \
+       "mfps\t%0, %1"                                          \
+       : "=r" (__res)                                          \
+       : "i" (counter));                                       \
+                                                               \
+       __res;                                                  \
+})
+
+#define write_r10k_perf_cntl(counter,val)                      \
+do {                                                           \
+       __asm__ __volatile__(                                   \
+       "mtps\t%0, %1"                                          \
+       :                                                       \
+       : "r" (val), "i" (counter));                            \
+} while (0)
+
+/*
+ * Macros to access the system control coprocessor
+ */
+
+#define __read_32bit_c0_register(source, sel)                          \
+({ int __res;                                                          \
+       if (sel == 0)                                                   \
+               __asm__ __volatile__(                                   \
+                       "mfc0\t%0, " #source "\n\t"                     \
+                       : "=r" (__res));                                \
+       else                                                            \
+               __asm__ __volatile__(                                   \
+                       ".set\tmips32\n\t"                              \
+                       "mfc0\t%0, " #source ", " #sel "\n\t"           \
+                       ".set\tmips0\n\t"                               \
+                       : "=r" (__res));                                \
+       __res;                                                          \
+})
+
+#define __read_64bit_c0_register(source, sel)                          \
+({ unsigned long long __res;                                           \
+       if (sizeof(unsigned long) == 4)                                 \
+               __res = __read_64bit_c0_split(source, sel);             \
+       else if (sel == 0)                                              \
+               __asm__ __volatile__(                                   \
+                       ".set\tmips3\n\t"                               \
+                       "dmfc0\t%0, " #source "\n\t"                    \
+                       ".set\tmips0"                                   \
+                       : "=r" (__res));                                \
+       else                                                            \
+               __asm__ __volatile__(                                   \
+                       ".set\tmips64\n\t"                              \
+                       "dmfc0\t%0, " #source ", " #sel "\n\t"          \
+                       ".set\tmips0"                                   \
+                       : "=r" (__res));                                \
+       __res;                                                          \
+})
+
+#define __write_32bit_c0_register(register, sel, value)                        \
+do {                                                                   \
+       if (sel == 0)                                                   \
+               __asm__ __volatile__(                                   \
+                       "mtc0\t%z0, " #register "\n\t"                  \
+                       : : "Jr" ((unsigned int)(value)));              \
+       else                                                            \
+               __asm__ __volatile__(                                   \
+                       ".set\tmips32\n\t"                              \
+                       "mtc0\t%z0, " #register ", " #sel "\n\t"        \
+                       ".set\tmips0"                                   \
+                       : : "Jr" ((unsigned int)(value)));              \
+} while (0)
+
+#define __write_64bit_c0_register(register, sel, value)                        \
+do {                                                                   \
+       if (sizeof(unsigned long) == 4)                                 \
+               __write_64bit_c0_split(register, sel, value);           \
+       else if (sel == 0)                                              \
+               __asm__ __volatile__(                                   \
+                       ".set\tmips3\n\t"                               \
+                       "dmtc0\t%z0, " #register "\n\t"                 \
+                       ".set\tmips0"                                   \
+                       : : "Jr" (value));                              \
+       else                                                            \
+               __asm__ __volatile__(                                   \
+                       ".set\tmips64\n\t"                              \
+                       "dmtc0\t%z0, " #register ", " #sel "\n\t"       \
+                       ".set\tmips0"                                   \
+                       : : "Jr" (value));                              \
+} while (0)
+
+#define __read_ulong_c0_register(reg, sel)                             \
+       ((sizeof(unsigned long) == 4) ?                                 \
+       (unsigned long) __read_32bit_c0_register(reg, sel) :            \
+       (unsigned long) __read_64bit_c0_register(reg, sel))
+
+#define __write_ulong_c0_register(reg, sel, val)                       \
+do {                                                                   \
+       if (sizeof(unsigned long) == 4)                                 \
+               __write_32bit_c0_register(reg, sel, val);               \
+       else                                                            \
+               __write_64bit_c0_register(reg, sel, val);               \
+} while (0)
+
+/*
+ * On RM7000/RM9000 these are uses to access cop0 set 1 registers
+ */
+#define __read_32bit_c0_ctrl_register(source)                          \
+({ int __res;                                                          \
+       __asm__ __volatile__(                                           \
+               "cfc0\t%0, " #source "\n\t"                             \
+               : "=r" (__res));                                        \
+       __res;                                                          \
+})
+
+#define __write_32bit_c0_ctrl_register(register, value)                        \
+do {                                                                   \
+       __asm__ __volatile__(                                           \
+               "ctc0\t%z0, " #register "\n\t"                          \
+               : : "Jr" ((unsigned int)(value)));                      \
+} while (0)
+
+/*
+ * These versions are only needed for systems with more than 38 bits of
+ * physical address space running the 32-bit kernel.  That's none atm :-)
+ */
+#define __read_64bit_c0_split(source, sel)                             \
+({                                                                     \
+       unsigned long long __val;                                       \
+       unsigned long __flags;                                          \
+                                                                       \
+       local_irq_save(__flags);                                        \
+       if (sel == 0)                                                   \
+               __asm__ __volatile__(                                   \
+                       ".set\tmips64\n\t"                              \
+                       "dmfc0\t%M0, " #source "\n\t"                   \
+                       "dsll\t%L0, %M0, 32\n\t"                        \
+                       "dsrl\t%M0, %M0, 32\n\t"                        \
+                       "dsrl\t%L0, %L0, 32\n\t"                        \
+                       ".set\tmips0"                                   \
+                       : "=r" (__val));                                \
+       else                                                            \
+               __asm__ __volatile__(                                   \
+                       ".set\tmips64\n\t"                              \
+                       "dmfc0\t%M0, " #source ", " #sel "\n\t"         \
+                       "dsll\t%L0, %M0, 32\n\t"                        \
+                       "dsrl\t%M0, %M0, 32\n\t"                        \
+                       "dsrl\t%L0, %L0, 32\n\t"                        \
+                       ".set\tmips0"                                   \
+                       : "=r" (__val));                                \
+       local_irq_restore(__flags);                                     \
+                                                                       \
+       __val;                                                          \
+})
+
+#define __write_64bit_c0_split(source, sel, val)                       \
+do {                                                                   \
+       unsigned long __flags;                                          \
+                                                                       \
+       local_irq_save(__flags);                                        \
+       if (sel == 0)                                                   \
+               __asm__ __volatile__(                                   \
+                       ".set\tmips64\n\t"                              \
+                       "dsll\t%L0, %L0, 32\n\t"                        \
+                       "dsrl\t%L0, %L0, 32\n\t"                        \
+                       "dsll\t%M0, %M0, 32\n\t"                        \
+                       "or\t%L0, %L0, %M0\n\t"                         \
+                       "dmtc0\t%L0, " #source "\n\t"                   \
+                       ".set\tmips0"                                   \
+                       : : "r" (val));                                 \
+       else                                                            \
+               __asm__ __volatile__(                                   \
+                       ".set\tmips64\n\t"                              \
+                       "dsll\t%L0, %L0, 32\n\t"                        \
+                       "dsrl\t%L0, %L0, 32\n\t"                        \
+                       "dsll\t%M0, %M0, 32\n\t"                        \
+                       "or\t%L0, %L0, %M0\n\t"                         \
+                       "dmtc0\t%L0, " #source ", " #sel "\n\t"         \
+                       ".set\tmips0"                                   \
+                       : : "r" (val));                                 \
+       local_irq_restore(__flags);                                     \
+} while (0)
+
+#define read_c0_index()                __read_32bit_c0_register($0, 0)
+#define write_c0_index(val)    __write_32bit_c0_register($0, 0, val)
+
+#define read_c0_entrylo0()     __read_ulong_c0_register($2, 0)
+#define write_c0_entrylo0(val) __write_ulong_c0_register($2, 0, val)
+
+#define read_c0_entrylo1()     __read_ulong_c0_register($3, 0)
+#define write_c0_entrylo1(val) __write_ulong_c0_register($3, 0, val)
+
+#define read_c0_conf()         __read_32bit_c0_register($3, 0)
+#define write_c0_conf(val)     __write_32bit_c0_register($3, 0, val)
+
+#define read_c0_context()      __read_ulong_c0_register($4, 0)
+#define write_c0_context(val)  __write_ulong_c0_register($4, 0, val)
+
+#define read_c0_userlocal()    __read_ulong_c0_register($4, 2)
+#define write_c0_userlocal(val)        __write_ulong_c0_register($4, 2, val)
+
+#define read_c0_pagemask()     __read_32bit_c0_register($5, 0)
+#define write_c0_pagemask(val) __write_32bit_c0_register($5, 0, val)
+
+#define read_c0_wired()                __read_32bit_c0_register($6, 0)
+#define write_c0_wired(val)    __write_32bit_c0_register($6, 0, val)
+
+#define read_c0_info()         __read_32bit_c0_register($7, 0)
+
+#define read_c0_cache()                __read_32bit_c0_register($7, 0) /* TX39xx */
+#define write_c0_cache(val)    __write_32bit_c0_register($7, 0, val)
+
+#define read_c0_badvaddr()     __read_ulong_c0_register($8, 0)
+#define write_c0_badvaddr(val) __write_ulong_c0_register($8, 0, val)
+
+#define read_c0_count()                __read_32bit_c0_register($9, 0)
+#define write_c0_count(val)    __write_32bit_c0_register($9, 0, val)
+
+#define read_c0_count2()       __read_32bit_c0_register($9, 6) /* pnx8550 */
+#define write_c0_count2(val)   __write_32bit_c0_register($9, 6, val)
+
+#define read_c0_count3()       __read_32bit_c0_register($9, 7) /* pnx8550 */
+#define write_c0_count3(val)   __write_32bit_c0_register($9, 7, val)
+
+#define read_c0_entryhi()      __read_ulong_c0_register($10, 0)
+#define write_c0_entryhi(val)  __write_ulong_c0_register($10, 0, val)
+
+#define read_c0_compare()      __read_32bit_c0_register($11, 0)
+#define write_c0_compare(val)  __write_32bit_c0_register($11, 0, val)
+
+#define read_c0_compare2()     __read_32bit_c0_register($11, 6) /* pnx8550 */
+#define write_c0_compare2(val) __write_32bit_c0_register($11, 6, val)
+
+#define read_c0_compare3()     __read_32bit_c0_register($11, 7) /* pnx8550 */
+#define write_c0_compare3(val) __write_32bit_c0_register($11, 7, val)
+
+#define read_c0_status()       __read_32bit_c0_register($12, 0)
+#ifdef CONFIG_MIPS_MT_SMTC
+#define write_c0_status(val)                                           \
+do {                                                                   \
+       __write_32bit_c0_register($12, 0, val);                         \
+       __ehb();                                                        \
+} while (0)
+#else
+/*
+ * Legacy non-SMTC code, which may be hazardous
+ * but which might not support EHB
+ */
+#define write_c0_status(val)   __write_32bit_c0_register($12, 0, val)
+#endif /* CONFIG_MIPS_MT_SMTC */
+
+#define read_c0_cause()                __read_32bit_c0_register($13, 0)
+#define write_c0_cause(val)    __write_32bit_c0_register($13, 0, val)
+
+#define read_c0_epc()          __read_ulong_c0_register($14, 0)
+#define write_c0_epc(val)      __write_ulong_c0_register($14, 0, val)
+
+#define read_c0_prid()         __read_32bit_c0_register($15, 0)
+
+#define read_c0_config()       __read_32bit_c0_register($16, 0)
+#define read_c0_config1()      __read_32bit_c0_register($16, 1)
+#define read_c0_config2()      __read_32bit_c0_register($16, 2)
+#define read_c0_config3()      __read_32bit_c0_register($16, 3)
+#define read_c0_config4()      __read_32bit_c0_register($16, 4)
+#define read_c0_config5()      __read_32bit_c0_register($16, 5)
+#define read_c0_config6()      __read_32bit_c0_register($16, 6)
+#define read_c0_config7()      __read_32bit_c0_register($16, 7)
+#define write_c0_config(val)   __write_32bit_c0_register($16, 0, val)
+#define write_c0_config1(val)  __write_32bit_c0_register($16, 1, val)
+#define write_c0_config2(val)  __write_32bit_c0_register($16, 2, val)
+#define write_c0_config3(val)  __write_32bit_c0_register($16, 3, val)
+#define write_c0_config4(val)  __write_32bit_c0_register($16, 4, val)
+#define write_c0_config5(val)  __write_32bit_c0_register($16, 5, val)
+#define write_c0_config6(val)  __write_32bit_c0_register($16, 6, val)
+#define write_c0_config7(val)  __write_32bit_c0_register($16, 7, val)
+
+/*
+ * The WatchLo register.  There may be upto 8 of them.
+ */
+#define read_c0_watchlo0()     __read_ulong_c0_register($18, 0)
+#define read_c0_watchlo1()     __read_ulong_c0_register($18, 1)
+#define read_c0_watchlo2()     __read_ulong_c0_register($18, 2)
+#define read_c0_watchlo3()     __read_ulong_c0_register($18, 3)
+#define read_c0_watchlo4()     __read_ulong_c0_register($18, 4)
+#define read_c0_watchlo5()     __read_ulong_c0_register($18, 5)
+#define read_c0_watchlo6()     __read_ulong_c0_register($18, 6)
+#define read_c0_watchlo7()     __read_ulong_c0_register($18, 7)
+#define write_c0_watchlo0(val) __write_ulong_c0_register($18, 0, val)
+#define write_c0_watchlo1(val) __write_ulong_c0_register($18, 1, val)
+#define write_c0_watchlo2(val) __write_ulong_c0_register($18, 2, val)
+#define write_c0_watchlo3(val) __write_ulong_c0_register($18, 3, val)
+#define write_c0_watchlo4(val) __write_ulong_c0_register($18, 4, val)
+#define write_c0_watchlo5(val) __write_ulong_c0_register($18, 5, val)
+#define write_c0_watchlo6(val) __write_ulong_c0_register($18, 6, val)
+#define write_c0_watchlo7(val) __write_ulong_c0_register($18, 7, val)
+
+/*
+ * The WatchHi register.  There may be upto 8 of them.
+ */
+#define read_c0_watchhi0()     __read_32bit_c0_register($19, 0)
+#define read_c0_watchhi1()     __read_32bit_c0_register($19, 1)
+#define read_c0_watchhi2()     __read_32bit_c0_register($19, 2)
+#define read_c0_watchhi3()     __read_32bit_c0_register($19, 3)
+#define read_c0_watchhi4()     __read_32bit_c0_register($19, 4)
+#define read_c0_watchhi5()     __read_32bit_c0_register($19, 5)
+#define read_c0_watchhi6()     __read_32bit_c0_register($19, 6)
+#define read_c0_watchhi7()     __read_32bit_c0_register($19, 7)
+
+#define write_c0_watchhi0(val) __write_32bit_c0_register($19, 0, val)
+#define write_c0_watchhi1(val) __write_32bit_c0_register($19, 1, val)
+#define write_c0_watchhi2(val) __write_32bit_c0_register($19, 2, val)
+#define write_c0_watchhi3(val) __write_32bit_c0_register($19, 3, val)
+#define write_c0_watchhi4(val) __write_32bit_c0_register($19, 4, val)
+#define write_c0_watchhi5(val) __write_32bit_c0_register($19, 5, val)
+#define write_c0_watchhi6(val) __write_32bit_c0_register($19, 6, val)
+#define write_c0_watchhi7(val) __write_32bit_c0_register($19, 7, val)
+
+#define read_c0_xcontext()     __read_ulong_c0_register($20, 0)
+#define write_c0_xcontext(val) __write_ulong_c0_register($20, 0, val)
+
+#define read_c0_intcontrol()   __read_32bit_c0_ctrl_register($20)
+#define write_c0_intcontrol(val) __write_32bit_c0_ctrl_register($20, val)
+
+#define read_c0_framemask()    __read_32bit_c0_register($21, 0)
+#define write_c0_framemask(val)        __write_32bit_c0_register($21, 0, val)
+
+/* RM9000 PerfControl performance counter control register */
+#define read_c0_perfcontrol()  __read_32bit_c0_register($22, 0)
+#define write_c0_perfcontrol(val) __write_32bit_c0_register($22, 0, val)
+
+#define read_c0_diag()         __read_32bit_c0_register($22, 0)
+#define write_c0_diag(val)     __write_32bit_c0_register($22, 0, val)
+
+#define read_c0_diag1()                __read_32bit_c0_register($22, 1)
+#define write_c0_diag1(val)    __write_32bit_c0_register($22, 1, val)
+
+#define read_c0_diag2()                __read_32bit_c0_register($22, 2)
+#define write_c0_diag2(val)    __write_32bit_c0_register($22, 2, val)
+
+#define read_c0_diag3()                __read_32bit_c0_register($22, 3)
+#define write_c0_diag3(val)    __write_32bit_c0_register($22, 3, val)
+
+#define read_c0_diag4()                __read_32bit_c0_register($22, 4)
+#define write_c0_diag4(val)    __write_32bit_c0_register($22, 4, val)
+
+#define read_c0_diag5()                __read_32bit_c0_register($22, 5)
+#define write_c0_diag5(val)    __write_32bit_c0_register($22, 5, val)
+
+#define read_c0_debug()                __read_32bit_c0_register($23, 0)
+#define write_c0_debug(val)    __write_32bit_c0_register($23, 0, val)
+
+#define read_c0_depc()         __read_ulong_c0_register($24, 0)
+#define write_c0_depc(val)     __write_ulong_c0_register($24, 0, val)
+
+/*
+ * MIPS32 / MIPS64 performance counters
+ */
+#define read_c0_perfctrl0()    __read_32bit_c0_register($25, 0)
+#define write_c0_perfctrl0(val)        __write_32bit_c0_register($25, 0, val)
+#define read_c0_perfcntr0()    __read_32bit_c0_register($25, 1)
+#define write_c0_perfcntr0(val)        __write_32bit_c0_register($25, 1, val)
+#define read_c0_perfctrl1()    __read_32bit_c0_register($25, 2)
+#define write_c0_perfctrl1(val)        __write_32bit_c0_register($25, 2, val)
+#define read_c0_perfcntr1()    __read_32bit_c0_register($25, 3)
+#define write_c0_perfcntr1(val)        __write_32bit_c0_register($25, 3, val)
+#define read_c0_perfctrl2()    __read_32bit_c0_register($25, 4)
+#define write_c0_perfctrl2(val)        __write_32bit_c0_register($25, 4, val)
+#define read_c0_perfcntr2()    __read_32bit_c0_register($25, 5)
+#define write_c0_perfcntr2(val)        __write_32bit_c0_register($25, 5, val)
+#define read_c0_perfctrl3()    __read_32bit_c0_register($25, 6)
+#define write_c0_perfctrl3(val)        __write_32bit_c0_register($25, 6, val)
+#define read_c0_perfcntr3()    __read_32bit_c0_register($25, 7)
+#define write_c0_perfcntr3(val)        __write_32bit_c0_register($25, 7, val)
+
+/* RM9000 PerfCount performance counter register */
+#define read_c0_perfcount()    __read_64bit_c0_register($25, 0)
+#define write_c0_perfcount(val)        __write_64bit_c0_register($25, 0, val)
+
+#define read_c0_ecc()          __read_32bit_c0_register($26, 0)
+#define write_c0_ecc(val)      __write_32bit_c0_register($26, 0, val)
+
+#define read_c0_derraddr0()    __read_ulong_c0_register($26, 1)
+#define write_c0_derraddr0(val)        __write_ulong_c0_register($26, 1, val)
+
+#define read_c0_cacheerr()     __read_32bit_c0_register($27, 0)
+
+#define read_c0_derraddr1()    __read_ulong_c0_register($27, 1)
+#define write_c0_derraddr1(val)        __write_ulong_c0_register($27, 1, val)
+
+#define read_c0_taglo()                __read_32bit_c0_register($28, 0)
+#define write_c0_taglo(val)    __write_32bit_c0_register($28, 0, val)
+
+#define read_c0_dtaglo()       __read_32bit_c0_register($28, 2)
+#define write_c0_dtaglo(val)   __write_32bit_c0_register($28, 2, val)
+
+#define read_c0_taghi()                __read_32bit_c0_register($29, 0)
+#define write_c0_taghi(val)    __write_32bit_c0_register($29, 0, val)
+
+#define read_c0_errorepc()     __read_ulong_c0_register($30, 0)
+#define write_c0_errorepc(val) __write_ulong_c0_register($30, 0, val)
+
+/* MIPSR2 */
+#define read_c0_hwrena()       __read_32bit_c0_register($7, 0)
+#define write_c0_hwrena(val)   __write_32bit_c0_register($7, 0, val)
+
+#define read_c0_intctl()       __read_32bit_c0_register($12, 1)
+#define write_c0_intctl(val)   __write_32bit_c0_register($12, 1, val)
+
+#define read_c0_srsctl()       __read_32bit_c0_register($12, 2)
+#define write_c0_srsctl(val)   __write_32bit_c0_register($12, 2, val)
+
+#define read_c0_srsmap()       __read_32bit_c0_register($12, 3)
+#define write_c0_srsmap(val)   __write_32bit_c0_register($12, 3, val)
+
+#define read_c0_ebase()                __read_32bit_c0_register($15, 1)
+#define write_c0_ebase(val)    __write_32bit_c0_register($15, 1, val)
 
 /*
- * R10000 performance counter definitions.
+ * Macros to access the floating point coprocessor control registers
+ */
+#define read_32bit_cp1_register(source)                                \
+({ int __res;                                                  \
+       __asm__ __volatile__(                                   \
+       ".set\tpush\n\t"                                        \
+       ".set\treorder\n\t"                                     \
+       "cfc1\t%0,"STR(source)"\n\t"                            \
+       ".set\tpop"                                             \
+       : "=r" (__res));                                        \
+       __res;})
+
+#define rddsp(mask)                                                    \
+({                                                                     \
+       unsigned int __res;                                             \
+                                                                       \
+       __asm__ __volatile__(                                           \
+       "       .set    push                            \n"             \
+       "       .set    noat                            \n"             \
+       "       # rddsp $1, %x1                         \n"             \
+       "       .word   0x7c000cb8 | (%x1 << 16)        \n"             \
+       "       move    %0, $1                          \n"             \
+       "       .set    pop                             \n"             \
+       : "=r" (__res)                                                  \
+       : "i" (mask));                                                  \
+       __res;                                                          \
+})
+
+#define wrdsp(val, mask)                                               \
+do {                                                                   \
+       __asm__ __volatile__(                                           \
+       "       .set    push                                    \n"     \
+       "       .set    noat                                    \n"     \
+       "       move    $1, %0                                  \n"     \
+       "       # wrdsp $1, %x1                                 \n"     \
+       "       .word   0x7c2004f8 | (%x1 << 11)                \n"     \
+       "       .set    pop                                     \n"     \
+       :                                                               \
+       : "r" (val), "i" (mask));                                       \
+} while (0)
+
+#define mfhi0()                                                                \
+({                                                                     \
+       unsigned long __treg;                                           \
+                                                                       \
+       __asm__ __volatile__(                                           \
+       "       .set    push                    \n"                     \
+       "       .set    noat                    \n"                     \
+       "       # mfhi  %0, $ac0                \n"                     \
+       "       .word   0x00000810              \n"                     \
+       "       move    %0, $1                  \n"                     \
+       "       .set    pop                     \n"                     \
+       : "=r" (__treg));                                               \
+       __treg;                                                         \
+})
+
+#define mfhi1()                                                                \
+({                                                                     \
+       unsigned long __treg;                                           \
+                                                                       \
+       __asm__ __volatile__(                                           \
+       "       .set    push                    \n"                     \
+       "       .set    noat                    \n"                     \
+       "       # mfhi  %0, $ac1                \n"                     \
+       "       .word   0x00200810              \n"                     \
+       "       move    %0, $1                  \n"                     \
+       "       .set    pop                     \n"                     \
+       : "=r" (__treg));                                               \
+       __treg;                                                         \
+})
+
+#define mfhi2()                                                                \
+({                                                                     \
+       unsigned long __treg;                                           \
+                                                                       \
+       __asm__ __volatile__(                                           \
+       "       .set    push                    \n"                     \
+       "       .set    noat                    \n"                     \
+       "       # mfhi  %0, $ac2                \n"                     \
+       "       .word   0x00400810              \n"                     \
+       "       move    %0, $1                  \n"                     \
+       "       .set    pop                     \n"                     \
+       : "=r" (__treg));                                               \
+       __treg;                                                         \
+})
+
+#define mfhi3()                                                                \
+({                                                                     \
+       unsigned long __treg;                                           \
+                                                                       \
+       __asm__ __volatile__(                                           \
+       "       .set    push                    \n"                     \
+       "       .set    noat                    \n"                     \
+       "       # mfhi  %0, $ac3                \n"                     \
+       "       .word   0x00600810              \n"                     \
+       "       move    %0, $1                  \n"                     \
+       "       .set    pop                     \n"                     \
+       : "=r" (__treg));                                               \
+       __treg;                                                         \
+})
+
+#define mflo0()                                                                \
+({                                                                     \
+       unsigned long __treg;                                           \
+                                                                       \
+       __asm__ __volatile__(                                           \
+       "       .set    push                    \n"                     \
+       "       .set    noat                    \n"                     \
+       "       # mflo  %0, $ac0                \n"                     \
+       "       .word   0x00000812              \n"                     \
+       "       move    %0, $1                  \n"                     \
+       "       .set    pop                     \n"                     \
+       : "=r" (__treg));                                               \
+       __treg;                                                         \
+})
+
+#define mflo1()                                                                \
+({                                                                     \
+       unsigned long __treg;                                           \
+                                                                       \
+       __asm__ __volatile__(                                           \
+       "       .set    push                    \n"                     \
+       "       .set    noat                    \n"                     \
+       "       # mflo  %0, $ac1                \n"                     \
+       "       .word   0x00200812              \n"                     \
+       "       move    %0, $1                  \n"                     \
+       "       .set    pop                     \n"                     \
+       : "=r" (__treg));                                               \
+       __treg;                                                         \
+})
+
+#define mflo2()                                                                \
+({                                                                     \
+       unsigned long __treg;                                           \
+                                                                       \
+       __asm__ __volatile__(                                           \
+       "       .set    push                    \n"                     \
+       "       .set    noat                    \n"                     \
+       "       # mflo  %0, $ac2                \n"                     \
+       "       .word   0x00400812              \n"                     \
+       "       move    %0, $1                  \n"                     \
+       "       .set    pop                     \n"                     \
+       : "=r" (__treg));                                               \
+       __treg;                                                         \
+})
+
+#define mflo3()                                                                \
+({                                                                     \
+       unsigned long __treg;                                           \
+                                                                       \
+       __asm__ __volatile__(                                           \
+       "       .set    push                    \n"                     \
+       "       .set    noat                    \n"                     \
+       "       # mflo  %0, $ac3                \n"                     \
+       "       .word   0x00600812              \n"                     \
+       "       move    %0, $1                  \n"                     \
+       "       .set    pop                     \n"                     \
+       : "=r" (__treg));                                               \
+       __treg;                                                         \
+})
+
+#define mthi0(x)                                                       \
+do {                                                                   \
+       __asm__ __volatile__(                                           \
+       "       .set    push                                    \n"     \
+       "       .set    noat                                    \n"     \
+       "       move    $1, %0                                  \n"     \
+       "       # mthi  $1, $ac0                                \n"     \
+       "       .word   0x00200011                              \n"     \
+       "       .set    pop                                     \n"     \
+       :                                                               \
+       : "r" (x));                                                     \
+} while (0)
+
+#define mthi1(x)                                                       \
+do {                                                                   \
+       __asm__ __volatile__(                                           \
+       "       .set    push                                    \n"     \
+       "       .set    noat                                    \n"     \
+       "       move    $1, %0                                  \n"     \
+       "       # mthi  $1, $ac1                                \n"     \
+       "       .word   0x00200811                              \n"     \
+       "       .set    pop                                     \n"     \
+       :                                                               \
+       : "r" (x));                                                     \
+} while (0)
+
+#define mthi2(x)                                                       \
+do {                                                                   \
+       __asm__ __volatile__(                                           \
+       "       .set    push                                    \n"     \
+       "       .set    noat                                    \n"     \
+       "       move    $1, %0                                  \n"     \
+       "       # mthi  $1, $ac2                                \n"     \
+       "       .word   0x00201011                              \n"     \
+       "       .set    pop                                     \n"     \
+       :                                                               \
+       : "r" (x));                                                     \
+} while (0)
+
+#define mthi3(x)                                                       \
+do {                                                                   \
+       __asm__ __volatile__(                                           \
+       "       .set    push                                    \n"     \
+       "       .set    noat                                    \n"     \
+       "       move    $1, %0                                  \n"     \
+       "       # mthi  $1, $ac3                                \n"     \
+       "       .word   0x00201811                              \n"     \
+       "       .set    pop                                     \n"     \
+       :                                                               \
+       : "r" (x));                                                     \
+} while (0)
+
+#define mtlo0(x)                                                       \
+do {                                                                   \
+       __asm__ __volatile__(                                           \
+       "       .set    push                                    \n"     \
+       "       .set    noat                                    \n"     \
+       "       move    $1, %0                                  \n"     \
+       "       # mtlo  $1, $ac0                                \n"     \
+       "       .word   0x00200013                              \n"     \
+       "       .set    pop                                     \n"     \
+       :                                                               \
+       : "r" (x));                                                     \
+} while (0)
+
+#define mtlo1(x)                                                       \
+do {                                                                   \
+       __asm__ __volatile__(                                           \
+       "       .set    push                                    \n"     \
+       "       .set    noat                                    \n"     \
+       "       move    $1, %0                                  \n"     \
+       "       # mtlo  $1, $ac1                                \n"     \
+       "       .word   0x00200813                              \n"     \
+       "       .set    pop                                     \n"     \
+       :                                                               \
+       : "r" (x));                                                     \
+} while (0)
+
+#define mtlo2(x)                                                       \
+do {                                                                   \
+       __asm__ __volatile__(                                           \
+       "       .set    push                                    \n"     \
+       "       .set    noat                                    \n"     \
+       "       move    $1, %0                                  \n"     \
+       "       # mtlo  $1, $ac2                                \n"     \
+       "       .word   0x00201013                              \n"     \
+       "       .set    pop                                     \n"     \
+       :                                                               \
+       : "r" (x));                                                     \
+} while (0)
+
+#define mtlo3(x)                                                       \
+do {                                                                   \
+       __asm__ __volatile__(                                           \
+       "       .set    push                                    \n"     \
+       "       .set    noat                                    \n"     \
+       "       move    $1, %0                                  \n"     \
+       "       # mtlo  $1, $ac3                                \n"     \
+       "       .word   0x00201813                              \n"     \
+       "       .set    pop                                     \n"     \
+       :                                                               \
+       : "r" (x));                                                     \
+} while (0)
+
+/*
+ * TLB operations.
  *
- * FIXME: The R10000 performance counter opens a nice way to implement CPU
- *        time accounting with a precission of one cycle.  I don't have
- *        R10000 silicon but just a manual, so ...
- */
-
-/*
- * Events counted by counter #0
- */
-#define CE0_CYCLES                     0
-#define CE0_INSN_ISSUED                        1
-#define CE0_LPSC_ISSUED                        2
-#define CE0_S_ISSUED                   3
-#define CE0_SC_ISSUED                  4
-#define CE0_SC_FAILED                  5
-#define CE0_BRANCH_DECODED             6
-#define CE0_QW_WB_SECONDARY            7
-#define CE0_CORRECTED_ECC_ERRORS       8
-#define CE0_ICACHE_MISSES              9
-#define CE0_SCACHE_I_MISSES            10
-#define CE0_SCACHE_I_WAY_MISSPREDICTED 11
-#define CE0_EXT_INTERVENTIONS_REQ      12
-#define CE0_EXT_INVALIDATE_REQ         13
-#define CE0_VIRTUAL_COHERENCY_COND     14
-#define CE0_INSN_GRADUATED             15
-
-/*
- * Events counted by counter #1
- */
-#define CE1_CYCLES                     0
-#define CE1_INSN_GRADUATED             1
-#define CE1_LPSC_GRADUATED             2
-#define CE1_S_GRADUATED                        3
-#define CE1_SC_GRADUATED               4
-#define CE1_FP_INSN_GRADUATED          5
-#define CE1_QW_WB_PRIMARY              6
-#define CE1_TLB_REFILL                 7
-#define CE1_BRANCH_MISSPREDICTED       8
-#define CE1_DCACHE_MISS                        9
-#define CE1_SCACHE_D_MISSES            10
-#define CE1_SCACHE_D_WAY_MISSPREDICTED 11
-#define CE1_EXT_INTERVENTION_HITS      12
-#define CE1_EXT_INVALIDATE_REQ         13
-#define CE1_SP_HINT_TO_CEXCL_SC_BLOCKS 14
-#define CE1_SP_HINT_TO_SHARED_SC_BLOCKS        15
-
-/*
- * These flags define in which priviledge mode the counters count events
- */
-#define CEB_USER       8       /* Count events in user mode, EXL = ERL = 0 */
-#define CEB_SUPERVISOR 4       /* Count events in supvervisor mode EXL = ERL = 0 */
-#define CEB_KERNEL     2       /* Count events in kernel mode EXL = ERL = 0 */
-#define CEB_EXL                1       /* Count events with EXL = 1, ERL = 0 */
+ * It is responsibility of the caller to take care of any TLB hazards.
+ */
+static inline void tlb_probe(void)
+{
+       __asm__ __volatile__(
+               ".set noreorder\n\t"
+               "tlbp\n\t"
+               ".set reorder");
+}
+
+static inline void tlb_read(void)
+{
+#if MIPS34K_MISSED_ITLB_WAR
+       int res = 0;
+
+       __asm__ __volatile__(
+       "       .set    push                                    \n"
+       "       .set    noreorder                               \n"
+       "       .set    noat                                    \n"
+       "       .set    mips32r2                                \n"
+       "       .word   0x41610001              # dvpe $1       \n"
+       "       move    %0, $1                                  \n"
+       "       ehb                                             \n"
+       "       .set    pop                                     \n"
+       : "=r" (res));
+
+       instruction_hazard();
+#endif
+
+       __asm__ __volatile__(
+               ".set noreorder\n\t"
+               "tlbr\n\t"
+               ".set reorder");
+
+#if MIPS34K_MISSED_ITLB_WAR
+       if ((res & _ULCAST_(1)))
+               __asm__ __volatile__(
+               "       .set    push                            \n"
+               "       .set    noreorder                       \n"
+               "       .set    noat                            \n"
+               "       .set    mips32r2                        \n"
+               "       .word   0x41600021      # evpe          \n"
+               "       ehb                                     \n"
+               "       .set    pop                             \n");
+#endif
+}
+
+static inline void tlb_write_indexed(void)
+{
+       __asm__ __volatile__(
+               ".set noreorder\n\t"
+               "tlbwi\n\t"
+               ".set reorder");
+}
+
+static inline void tlb_write_random(void)
+{
+       __asm__ __volatile__(
+               ".set noreorder\n\t"
+               "tlbwr\n\t"
+               ".set reorder");
+}
+
+/*
+ * Manipulate bits in a c0 register.
+ */
+#define __BUILD_SET_C0(name)                                   \
+static inline unsigned int                                     \
+set_c0_##name(unsigned int set)                                        \
+{                                                              \
+       unsigned int res;                                       \
+                                                               \
+       res = read_c0_##name();                                 \
+       res |= set;                                             \
+       write_c0_##name(res);                                   \
+                                                               \
+       return res;                                             \
+}                                                              \
+                                                               \
+static inline unsigned int                                     \
+clear_c0_##name(unsigned int clear)                            \
+{                                                              \
+       unsigned int res;                                       \
+                                                               \
+       res = read_c0_##name();                                 \
+       res &= ~clear;                                          \
+       write_c0_##name(res);                                   \
+                                                               \
+       return res;                                             \
+}                                                              \
+                                                               \
+static inline unsigned int                                     \
+change_c0_##name(unsigned int change, unsigned int new)                \
+{                                                              \
+       unsigned int res;                                       \
+                                                               \
+       res = read_c0_##name();                                 \
+       res &= ~change;                                         \
+       res |= (new & change);                                  \
+       write_c0_##name(res);                                   \
+                                                               \
+       return res;                                             \
+}
+
+__BUILD_SET_C0(status)
+__BUILD_SET_C0(cause)
+__BUILD_SET_C0(config)
+__BUILD_SET_C0(intcontrol)
+__BUILD_SET_C0(intctl)
+__BUILD_SET_C0(srsmap)
+
+#endif /* !__ASSEMBLY__ */
 
 #endif /* _ASM_MIPSREGS_H */
index 3264915d89674160c5c9f008af86b3749c1c80c3..4e9c608341eb11a12a6a9ff268e34173855e4910 100644 (file)
@@ -287,7 +287,7 @@ extern __inline__ int ext2_test_bit(int nr, __const__ void * addr)
 #define ext2_find_first_zero_bit(addr, size) \
        ext2_find_next_zero_bit((addr), (size), 0)
 
-extern __inline__ unsigned long ext2_find_next_zero_bit(void *addr,
+static __inline__ unsigned long ext2_find_next_zero_bit(void *addr,
        unsigned long size, unsigned long offset)
 {
        unsigned int *p = ((unsigned int *) addr) + (offset >> 5);
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
index 4f78ca7a94054dff5e16432cf3078fcb6c19f14b..050a7b6472789c9ddae318d610bd6bde169b808a 100644 (file)
@@ -140,11 +140,16 @@ extern void _tlbia(void);         /* invalidate all TLB entries */
 
 typedef enum {
        IBAT0 = 0, IBAT1, IBAT2, IBAT3,
-       DBAT0, DBAT1, DBAT2, DBAT3
+       DBAT0, DBAT1, DBAT2, DBAT3,
+#ifdef CONFIG_HIGH_BATS
+       IBAT4, IBAT5, IBAT6, IBAT7,
+       DBAT4, DBAT5, DBAT6, DBAT7
+#endif
 } ppc_bat_t;
 
 extern int read_bat(ppc_bat_t bat, unsigned long *upper, unsigned long *lower);
 extern int write_bat(ppc_bat_t bat, unsigned long upper, unsigned long lower);
+extern void print_bats(void);
 
 #endif /* __ASSEMBLY__ */
 
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;
diff --git a/include/atmel_lcdc.h b/include/atmel_lcdc.h
new file mode 100644 (file)
index 0000000..73dd8f7
--- /dev/null
@@ -0,0 +1,177 @@
+/*
+ *  Header file for AT91/AT32 LCD Controller
+ *
+ *  Data structure and register user interface
+ *
+ *  Copyright (C) 2007 Atmel Corporation
+ *
+ * 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 __ATMEL_LCDC_H__
+#define __ATMEL_LCDC_H__
+
+#define ATMEL_LCDC_DMABADDR1   0x00
+#define ATMEL_LCDC_DMABADDR2   0x04
+#define ATMEL_LCDC_DMAFRMPT1   0x08
+#define ATMEL_LCDC_DMAFRMPT2   0x0c
+#define ATMEL_LCDC_DMAFRMADD1  0x10
+#define ATMEL_LCDC_DMAFRMADD2  0x14
+
+#define ATMEL_LCDC_DMAFRMCFG   0x18
+#define        ATMEL_LCDC_FRSIZE       (0x7fffff <<  0)
+#define        ATMEL_LCDC_BLENGTH_OFFSET       24
+#define        ATMEL_LCDC_BLENGTH      (0x7f     << ATMEL_LCDC_BLENGTH_OFFSET)
+
+#define ATMEL_LCDC_DMACON      0x1c
+#define        ATMEL_LCDC_DMAEN        (0x1 << 0)
+#define        ATMEL_LCDC_DMARST       (0x1 << 1)
+#define        ATMEL_LCDC_DMABUSY      (0x1 << 2)
+#define                ATMEL_LCDC_DMAUPDT      (0x1 << 3)
+#define                ATMEL_LCDC_DMA2DEN      (0x1 << 4)
+
+#define ATMEL_LCDC_DMA2DCFG    0x20
+#define                ATMEL_LCDC_ADDRINC_OFFSET       0
+#define                ATMEL_LCDC_ADDRINC              (0xffff)
+#define                ATMEL_LCDC_PIXELOFF_OFFSET      24
+#define                ATMEL_LCDC_PIXELOFF             (0x1f << 24)
+
+#define ATMEL_LCDC_LCDCON1     0x0800
+#define        ATMEL_LCDC_BYPASS       (1     <<  0)
+#define        ATMEL_LCDC_CLKVAL_OFFSET        12
+#define        ATMEL_LCDC_CLKVAL       (0x1ff << ATMEL_LCDC_CLKVAL_OFFSET)
+#define        ATMEL_LCDC_LINCNT       (0x7ff << 21)
+
+#define ATMEL_LCDC_LCDCON2     0x0804
+#define        ATMEL_LCDC_DISTYPE      (3 << 0)
+#define                ATMEL_LCDC_DISTYPE_STNMONO      (0 << 0)
+#define                ATMEL_LCDC_DISTYPE_STNCOLOR     (1 << 0)
+#define                ATMEL_LCDC_DISTYPE_TFT          (2 << 0)
+#define        ATMEL_LCDC_SCANMOD      (1 << 2)
+#define                ATMEL_LCDC_SCANMOD_SINGLE       (0 << 2)
+#define                ATMEL_LCDC_SCANMOD_DUAL         (1 << 2)
+#define        ATMEL_LCDC_IFWIDTH      (3 << 3)
+#define                ATMEL_LCDC_IFWIDTH_4            (0 << 3)
+#define                ATMEL_LCDC_IFWIDTH_8            (1 << 3)
+#define                ATMEL_LCDC_IFWIDTH_16           (2 << 3)
+#define        ATMEL_LCDC_PIXELSIZE    (7 << 5)
+#define                ATMEL_LCDC_PIXELSIZE_1          (0 << 5)
+#define                ATMEL_LCDC_PIXELSIZE_2          (1 << 5)
+#define                ATMEL_LCDC_PIXELSIZE_4          (2 << 5)
+#define                ATMEL_LCDC_PIXELSIZE_8          (3 << 5)
+#define                ATMEL_LCDC_PIXELSIZE_16         (4 << 5)
+#define                ATMEL_LCDC_PIXELSIZE_24         (5 << 5)
+#define                ATMEL_LCDC_PIXELSIZE_32         (6 << 5)
+#define        ATMEL_LCDC_INVVD        (1 << 8)
+#define                ATMEL_LCDC_INVVD_NORMAL         (0 << 8)
+#define                ATMEL_LCDC_INVVD_INVERTED       (1 << 8)
+#define        ATMEL_LCDC_INVFRAME     (1 << 9 )
+#define                ATMEL_LCDC_INVFRAME_NORMAL      (0 << 9)
+#define                ATMEL_LCDC_INVFRAME_INVERTED    (1 << 9)
+#define        ATMEL_LCDC_INVLINE      (1 << 10)
+#define                ATMEL_LCDC_INVLINE_NORMAL       (0 << 10)
+#define                ATMEL_LCDC_INVLINE_INVERTED     (1 << 10)
+#define        ATMEL_LCDC_INVCLK       (1 << 11)
+#define                ATMEL_LCDC_INVCLK_NORMAL        (0 << 11)
+#define                ATMEL_LCDC_INVCLK_INVERTED      (1 << 11)
+#define        ATMEL_LCDC_INVDVAL      (1 << 12)
+#define                ATMEL_LCDC_INVDVAL_NORMAL       (0 << 12)
+#define                ATMEL_LCDC_INVDVAL_INVERTED     (1 << 12)
+#define        ATMEL_LCDC_CLKMOD       (1 << 15)
+#define                ATMEL_LCDC_CLKMOD_ACTIVEDISPLAY (0 << 15)
+#define                ATMEL_LCDC_CLKMOD_ALWAYSACTIVE  (1 << 15)
+#define        ATMEL_LCDC_MEMOR        (1 << 31)
+#define                ATMEL_LCDC_MEMOR_BIG            (0 << 31)
+#define                ATMEL_LCDC_MEMOR_LITTLE         (1 << 31)
+
+#define ATMEL_LCDC_TIM1                0x0808
+#define        ATMEL_LCDC_VFP          (0xffU <<  0)
+#define        ATMEL_LCDC_VBP_OFFSET           8
+#define        ATMEL_LCDC_VBP          (0xffU <<  ATMEL_LCDC_VBP_OFFSET)
+#define        ATMEL_LCDC_VPW_OFFSET           16
+#define        ATMEL_LCDC_VPW          (0x3fU << ATMEL_LCDC_VPW_OFFSET)
+#define        ATMEL_LCDC_VHDLY_OFFSET         24
+#define        ATMEL_LCDC_VHDLY        (0xfU  << ATMEL_LCDC_VHDLY_OFFSET)
+
+#define ATMEL_LCDC_TIM2                0x080c
+#define        ATMEL_LCDC_HBP          (0xffU  <<  0)
+#define        ATMEL_LCDC_HPW_OFFSET           8
+#define        ATMEL_LCDC_HPW          (0x3fU  <<  ATMEL_LCDC_HPW_OFFSET)
+#define        ATMEL_LCDC_HFP_OFFSET           21
+#define        ATMEL_LCDC_HFP          (0x7ffU << ATMEL_LCDC_HFP_OFFSET)
+
+#define ATMEL_LCDC_LCDFRMCFG   0x0810
+#define        ATMEL_LCDC_LINEVAL      (0x7ff <<  0)
+#define        ATMEL_LCDC_HOZVAL_OFFSET        21
+#define        ATMEL_LCDC_HOZVAL       (0x7ff << ATMEL_LCDC_HOZVAL_OFFSET)
+
+#define ATMEL_LCDC_FIFO                0x0814
+#define        ATMEL_LCDC_FIFOTH       (0xffff)
+
+#define ATMEL_LCDC_MVAL                0x0818
+
+#define ATMEL_LCDC_DP1_2       0x081c
+#define ATMEL_LCDC_DP4_7       0x0820
+#define ATMEL_LCDC_DP3_5       0x0824
+#define ATMEL_LCDC_DP2_3       0x0828
+#define ATMEL_LCDC_DP5_7       0x082c
+#define ATMEL_LCDC_DP3_4       0x0830
+#define ATMEL_LCDC_DP4_5       0x0834
+#define ATMEL_LCDC_DP6_7       0x0838
+#define        ATMEL_LCDC_DP1_2_VAL    (0xff)
+#define        ATMEL_LCDC_DP4_7_VAL    (0xfffffff)
+#define        ATMEL_LCDC_DP3_5_VAL    (0xfffff)
+#define        ATMEL_LCDC_DP2_3_VAL    (0xfff)
+#define        ATMEL_LCDC_DP5_7_VAL    (0xfffffff)
+#define        ATMEL_LCDC_DP3_4_VAL    (0xffff)
+#define        ATMEL_LCDC_DP4_5_VAL    (0xfffff)
+#define        ATMEL_LCDC_DP6_7_VAL    (0xfffffff)
+
+#define ATMEL_LCDC_PWRCON      0x083c
+#define        ATMEL_LCDC_PWR          (1    <<  0)
+#define        ATMEL_LCDC_GUARDT_OFFSET        1
+#define        ATMEL_LCDC_GUARDT       (0x7f <<  ATMEL_LCDC_GUARDT_OFFSET)
+#define        ATMEL_LCDC_BUSY         (1    << 31)
+
+#define ATMEL_LCDC_CONTRAST_CTR        0x0840
+#define        ATMEL_LCDC_PS           (3 << 0)
+#define                ATMEL_LCDC_PS_DIV1              (0 << 0)
+#define                ATMEL_LCDC_PS_DIV2              (1 << 0)
+#define                ATMEL_LCDC_PS_DIV4              (2 << 0)
+#define                ATMEL_LCDC_PS_DIV8              (3 << 0)
+#define        ATMEL_LCDC_POL          (1 << 2)
+#define                ATMEL_LCDC_POL_NEGATIVE         (0 << 2)
+#define                ATMEL_LCDC_POL_POSITIVE         (1 << 2)
+#define        ATMEL_LCDC_ENA          (1 << 3)
+#define                ATMEL_LCDC_ENA_PWMDISABLE       (0 << 3)
+#define                ATMEL_LCDC_ENA_PWMENABLE        (1 << 3)
+
+#define ATMEL_LCDC_CONTRAST_VAL        0x0844
+#define        ATMEL_LCDC_CVAL (0xff)
+
+#define ATMEL_LCDC_IER         0x0848
+#define ATMEL_LCDC_IDR         0x084c
+#define ATMEL_LCDC_IMR         0x0850
+#define ATMEL_LCDC_ISR         0x0854
+#define ATMEL_LCDC_ICR         0x0858
+#define        ATMEL_LCDC_LNI          (1 << 0)
+#define        ATMEL_LCDC_LSTLNI       (1 << 1)
+#define        ATMEL_LCDC_EOFI         (1 << 2)
+#define        ATMEL_LCDC_UFLWI        (1 << 4)
+#define        ATMEL_LCDC_OWRI         (1 << 5)
+#define        ATMEL_LCDC_MERI         (1 << 6)
+
+#define ATMEL_LCDC_LUT(n)      (0x0c00 + ((n)*4))
+
+#endif /* __ATMEL_LCDC_H__ */
index d0f57040ee435c627457711d264fa34682a0816e..26e1b469a12e048da358580131c52e7d110ad83f 100644 (file)
@@ -176,6 +176,17 @@ typedef void (interrupt_handler_t)(void *);
                (__x > __y) ? __x : __y; })
 
 
+/**
+ * container_of - cast a member of a structure out to the containing structure
+ * @ptr:       the pointer to the member.
+ * @type:      the type of the container struct this is embedded in.
+ * @member:    the name of the member within the struct.
+ *
+ */
+#define container_of(ptr, type, member) ({                     \
+       const typeof( ((type *)0)->member ) *__mptr = (ptr);    \
+       (type *)( (char *)__mptr - offsetof(type,member) );})
+
 /*
  * Function Prototypes
  */
index 3f2f6140f634da7fda0895ae8136a7957bf1ff14..38b962f8232c8c6d61aa5175a84af8e5572103c1 100644 (file)
@@ -31,6 +31,8 @@
 #define CONFIG_MPC8220         1
 #define CONFIG_ALASKA8220      1       /* ... on Alaska board  */
 
+#define CONFIG_HIGH_BATS       1       /* High BATs supported */
+
 /* Input clock running at 30Mhz, read Hid1 for the CPU multiplier to
    determine the CPU speed. */
 #define CFG_MPC8220_CLKIN      30000000/* ... running at 30MHz */
index 706c13efad4047ed18afae786adc11ced0ff298f..b7574bf1494b80f8eab7f12b03bc8f84a2f9f29c 100644 (file)
@@ -61,6 +61,8 @@
 #define BOOTFLAG_COLD          0x01    /* Normal Power-On: Boot from FLASH */
 #define BOOTFLAG_WARM          0x02    /* Software reboot                  */
 
+#define CONFIG_HIGH_BATS       1       /* High BATs supported              */
+
 /*
  * Serial console configuration
  */
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 48e29a20876cd2330ec4c8fa68c2564372aed573..89edbde1de64baa44e469f6de0f84bffcef3dd63 100644 (file)
@@ -61,6 +61,8 @@
 
 #undef CONFIG_ECC                      /* enable ECC support */
 
+#define CONFIG_HIGH_BATS       1       /* High BATs supported */
+
 /* which initialization functions to call for this board */
 #define CONFIG_MISC_INIT_R
 #define CONFIG_BOARD_PRE_INIT
index f85cff7abffcf4bcec0b3c8376979771ce398b28..3a347eac55e51c08f46fd9bdfe49065472873993 100644 (file)
@@ -37,6 +37,8 @@
 #define BOOTFLAG_COLD          0x01    /* Normal Power-On: Boot from FLASH  */
 #define BOOTFLAG_WARM          0x02    /* Software reboot           */
 
+#define CONFIG_HIGH_BATS       1       /* High BATs supported */
+
 /*
  * Serial console configuration
  */
index 610151f5860e2c790f6fdfd7ca23ed823ca44961..d547681c3d0deb3b67011252673fd03269f636d7 100644 (file)
 
 #define CFG_HID2 HID2_HBE
 
+#define CONFIG_HIGH_BATS       1       /* High BATs supported */
+
 /* DDR @ 0x00000000 */
 #define CFG_IBAT0L     (CFG_SDRAM_BASE | BATL_PP_10)
 #define CFG_IBAT0U     (CFG_SDRAM_BASE | BATU_BL_256M | BATU_VS | BATU_VP)
index e0a887c7e6526f2de96b7b805aef01a6e1b90704..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 \
 /*
  * MMU Setup
  */
+#define CONFIG_HIGH_BATS       1       /* High BATs supported */
 
 /* DDR: cache cacheable */
 #define CFG_IBAT0L     (CFG_SDRAM_BASE | BATL_PP_10 | BATL_MEMCOHERENCE)
index 32f57ac7dad8f1435406e2f3e92e47793dc88189..977c041dca6e31f18f639e9f99534000e0bf2469 100644 (file)
 /*
  * MMU Setup
  */
+#define CONFIG_HIGH_BATS       1       /* High BATs supported */
 
 /* DDR: cache cacheable */
 #define CFG_IBAT0L     (CFG_SDRAM_BASE | BATL_PP_10 | BATL_MEMCOHERENCE)
index 1276a124c936de2b4db060d3cfd7ebeda33476a2..9ca2a2be04ed67c51519611b16463f14f75fcf73 100644 (file)
  * MMU Setup
  */
 
+#define CONFIG_HIGH_BATS       1       /* High BATs supported */
+
 /* DDR: cache cacheable */
 #define CFG_IBAT0L     (CFG_SDRAM_BASE | BATL_PP_10 | BATL_MEMCOHERENCE)
 #define CFG_IBAT0U     (CFG_SDRAM_BASE | BATU_BL_256M | BATU_VS | BATU_VP)
index 119e7ac7c617bd83525164ec58bc1f15cd5c4a9b..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 */
 
 
 #define CFG_HID2 HID2_HBE
+#define CONFIG_HIGH_BATS       1       /* High BATs supported */
 
 /* DDR @ 0x00000000 */
 #define CFG_IBAT0L     (CFG_SDRAM_BASE | BATL_PP_10 | BATL_MEMCOHERENCE)
index c72de03c013051ab36acba579b2a49ac0505c3c8..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)
 
@@ -555,6 +555,7 @@ boards, we say we have two, but don't display a message if we find only one. */
 #define CFG_HID0_FINAL CFG_HID0_INIT
 
 #define CFG_HID2       HID2_HBE
+#define CONFIG_HIGH_BATS       1       /* High BATs supported */
 
 /* DDR  */
 #define CFG_IBAT0L     (CFG_SDRAM_BASE | BATL_PP_10 | BATL_MEMCOHERENCE)
index 983575eb0c16a7629d27b501547c2794e37b7b05..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 */
  * MMU Setup
  */
 
+#define CONFIG_HIGH_BATS       1       /* High BATs supported */
+
 /* DDR: cache cacheable */
 #define CFG_IBAT0L     (CFG_SDRAM_BASE | BATL_PP_10 | BATL_MEMCOHERENCE)
 #define CFG_IBAT0U     (CFG_SDRAM_BASE | BATU_BL_256M | BATU_VS | BATU_VP)
index 7b7d6f50c00b59b8ec3abbf437989bd2db52f5ba..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)
 
  * MMU Setup
  */
 
+#define CONFIG_HIGH_BATS       1       /* High BATs supported */
+
 /* DDR: cache cacheable */
 #define CFG_IBAT0L     (CFG_SDRAM_BASE | BATL_PP_10 | BATL_MEMCOHERENCE)
 #define CFG_IBAT0U     (CFG_SDRAM_BASE | BATU_BL_256M | BATU_VS | BATU_VP)
index e92493ae4db029f8e2129baa064cff3276281250..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 \
 /*
  * MMU Setup
  */
+#define CONFIG_HIGH_BATS       1       /* High BATs supported */
 
 /* DDR: cache cacheable */
 #define CFG_SDRAM_LOWER                CFG_SDRAM_BASE
index f7e6fd2c52bec95b0d05c15adc56b29d22f29f18..29c2490e6b1915eddd1d77823a3f00c686842493 100644 (file)
  * MMU Setup
  */
 
+#define CONFIG_HIGH_BATS       1       /* High BATs supported */
+
 /* DDR: cache cacheable */
 #define CFG_SDRAM_LOWER                CFG_SDRAM_BASE
 #define CFG_SDRAM_UPPER                (CFG_SDRAM_BASE + 0x10000000)
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 15ff0eacf2571989b2c3516d1f09a53fa31762d7..fc168909e717c8d4cf65580207650c474a5ff262 100644 (file)
@@ -55,6 +55,7 @@
 #define CONFIG_NUM_DDR_CONTROLLERS     1
 #define CONFIG_INTERRUPTS              /* enable pci, srio, ddr interrupts */
 
+#define CONFIG_HIGH_BATS       1       /* High BATs supported & enabled */
 #define CONFIG_ALTIVEC         1
 
 /*
 #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 9acc3da54a2933116ab61c9400aff41b4ae37456..455e154222be31eacce44f511eeab8aa2294cd0b 100644 (file)
@@ -67,6 +67,7 @@
 #define BANK_INTERLEAVING              0x22000000
 #define SUPER_BANK_INTERLEAVING                0x23000000
 
+#define CONFIG_HIGH_BATS       1       /* High BATs supported and enabled */
 
 #define CONFIG_ALTIVEC         1
 
@@ -86,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 6eb644492553fa1585d15f396df2594f4c9a3ec2..259178f857bb7af800948b84cb329bdc3ddb6695 100644 (file)
@@ -40,6 +40,8 @@
 #define BOOTFLAG_COLD          0x01    /* Normal Power-On: Boot from FLASH  */
 #define BOOTFLAG_WARM          0x02    /* Software reboot           */
 
+#define CONFIG_HIGH_BATS       1       /* High BATs supported */
+
 /*
  * Serial console configuration
  */
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 6cb3022b93f021b8639445d414da9b9aa62378a6..d21783b838f897360bf90fc19c98431de4b7fc7a 100644 (file)
@@ -42,6 +42,8 @@
 #define BOOTFLAG_COLD          0x01    /* Normal Power-On: Boot from FLASH  */
 #define BOOTFLAG_WARM          0x02    /* Software reboot           */
 
+#define CONFIG_HIGH_BATS       1       /* High BATs supported */
+
 /*
  * Serial console configuration
  */
index 71fa36baae9ceab90d64dafbd1ac28c96c298b46..4c447356a442d7946784e690794229089a48744c 100644 (file)
@@ -50,6 +50,8 @@
 #define BOOTFLAG_COLD          0x01    /* Normal Power-On: Boot from FLASH  */
 #define BOOTFLAG_WARM          0x02    /* Software reboot           */
 
+#define CONFIG_HIGH_BATS       1       /* High BATs supported */
+
 /*
  * Serial console configuration
  */
index bff2edf76963194ae1a0cfa54310a474cc64b2d9..bfb478a86888f618857cb517cbe6d50368d6c4bb 100644 (file)
@@ -47,6 +47,8 @@
 #define BOOTFLAG_COLD          0x01    /* Normal Power-On: Boot from FLASH     */
 #define BOOTFLAG_WARM          0x02    /* Software reboot                      */
 
+#define CONFIG_HIGH_BATS       1       /* High BATs supported                  */
+
 /*
  * Serial console configuration
  */
index a86939e0978278b74062a051dc004a6d6e0ba0f4..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 */
@@ -423,6 +423,8 @@ extern int tqm834x_num_flash_banks;
 #define CFG_HID0_FINAL CFG_HID0_INIT
 #define CFG_HID2       HID2_HBE
 
+#define CONFIG_HIGH_BATS       1       /* High BATs supported */
+
 /* DDR 0 - 512M */
 #define CFG_IBAT0L     (CFG_SDRAM_BASE | BATL_PP_10 | BATL_MEMCOHERENCE)
 #define CFG_IBAT0U     (CFG_SDRAM_BASE | BATU_BL_256M | BATU_VS | BATU_VP)
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 31f10dd87c09256e508406fc42388e45e8ca1c32..598fe7bf27823fd100ed8ccf362a467863acfdb8 100644 (file)
@@ -48,6 +48,8 @@
 #define BOOTFLAG_COLD          0x01    /* Normal Power-On: Boot from FLASH  */
 #define BOOTFLAG_WARM          0x02    /* Software reboot           */
 
+#define CONFIG_HIGH_BATS       1       /* High BATs supported */
+
 /*
  * Serial console configuration
  */
index 00c4ff093a6ce78f995e673d3a15291598894d19..1b4195a08fd0e2bb90f5c13308c75973d84ab44f 100644 (file)
@@ -31,6 +31,8 @@
 #define CONFIG_MPC8220         1
 #define CONFIG_YUKON8220       1       /* ... on Yukon board   */
 
+#define CONFIG_HIGH_BATS       1       /* High BATs supported */
+
 /* Input clock running at 30Mhz, read Hid1 for the CPU multiplier to
    determine the CPU speed. */
 #define CFG_MPC8220_CLKIN      30000000/* ... running at 30MHz */
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 c975a249c74fe5654dbf46226a4588728fa671ca..4226529eb7ddee16bd78ce66f9919da72c0b1a6f 100644 (file)
 #define CFG_HID0_FINAL HID0_ENABLE_MACHINE_CHECK
 #define CFG_HID2       HID2_HBE
 
+#define CONFIG_HIGH_BATS       1       /* High BATs supported */
+
 /*
  * Internal Definitions
  *
index e3f810c5c89508f38a054d5ef7738725f1887d29..c5e475921c430bc5ed60b1b287fc015a78d1156e 100644 (file)
@@ -41,6 +41,8 @@
 #define CONFIG_AEVFIFO         1
 #define CFG_MPC5XXX_CLKIN      33000000 /* ... running at 33.000000MHz */
 
+#define CONFIG_HIGH_BATS       1       /* High BATs supported */
+
 #define BOOTFLAG_COLD          0x01    /* Normal Power-On: Boot from FLASH  */
 #define BOOTFLAG_WARM          0x02    /* Software reboot           */
 
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 c891fa80ed4721473840766dd1f1b1be5e8602bf..342ce2a649d67640876a548246cefefaba2f3e53 100644 (file)
@@ -28,6 +28,7 @@
 #define __CONFIG_H
 
 /* ARM asynchronous clock */
+#define AT91_CPU_NAME          "AT91CAP9"
 #define AT91_MAIN_CLOCK                200000000       /* from 12 MHz crystal */
 #define AT91_MASTER_CLOCK      100000000       /* peripheral = main / 2 */
 #define CFG_HZ                 1000000         /* 1us resolution */
 #undef CONFIG_USART2
 #define CONFIG_USART3          1       /* USART 3 is DBGU */
 
-#define CONFIG_BOOTDELAY       3
-#define CONFIG_BOOTARGS                "console=ttyS0,115200 " \
-                               "root=/dev/mtdblock1 rw rootfstype=jffs2"
+/* LCD */
+#define CONFIG_LCD                     1
+#define LCD_BPP                                LCD_COLOR8
+#define CONFIG_LCD_LOGO                        1
+#undef LCD_TEST_PATTERN
+#define CONFIG_LCD_INFO                        1
+#define CONFIG_LCD_INFO_BELOW_LOGO     1
+#define CFG_WHITE_ON_BLACK             1
+#define CONFIG_ATMEL_LCD               1
+#define CONFIG_ATMEL_LCD_BGR555                1
+#define CFG_CONSOLE_IS_IN_ENV          1
 
-/* #define CONFIG_ENV_OVERWRITE        1 */
+#define CONFIG_BOOTDELAY       3
 
 /*
  * BOOTP options
 #define CFG_SPI_WRITE_TOUT             (5*CFG_HZ)
 #define CFG_MAX_DATAFLASH_BANKS                1
 #define CFG_DATAFLASH_LOGIC_ADDR_CS0   0xC0000000      /* CS0 */
-#define AT91_SPI_CLK                   20000000
-#define DATAFLASH_TCSS                 (0xFA << 16)
-#define DATAFLASH_TCHS                 (0x8 << 24)
+#define AT91_SPI_CLK                   15000000
+#define DATAFLASH_TCSS                 (0x1a << 16)
+#define DATAFLASH_TCHS                 (0x1 << 24)
 
 /* NOR flash */
 #define CFG_FLASH_CFI                  1
 #define NAND_MAX_CHIPS                 1
 #define CFG_MAX_NAND_DEVICE            1
 #define CFG_NAND_BASE                  0x40000000
+#define CFG_NAND_DBW_8                 1
 
 /* Ethernet */
 #define CONFIG_MACB                    1
 #define CFG_ENV_OFFSET         0x4200
 #define CFG_ENV_ADDR           (CFG_DATAFLASH_LOGIC_ADDR_CS0 + CFG_ENV_OFFSET)
 #define CFG_ENV_SIZE           0x4200
-#define CONFIG_BOOTCOMMAND     "cp.b 0xC003DE00 0x72000000 0x200040; bootm"
+#define CONFIG_BOOTCOMMAND     "cp.b 0xC0042000 0x72000000 0x210000; bootm"
+#define CONFIG_BOOTARGS                "console=ttyS0,115200 "                 \
+                               "root=/dev/mtdblock1 "                  \
+                               "mtdparts=physmap-flash.0:-(nor);"      \
+                               "at91_nand:-(root) "                    \
+                               "rw rootfstype=jffs2"
 
 #else
 
 #define CFG_ENV_ADDR           (PHYS_FLASH_1 + CFG_ENV_OFFSET)
 #define CFG_ENV_SIZE           0x4000
 #define CONFIG_BOOTCOMMAND     "cp.b 0x10040000 0x72000000 0x200000; bootm"
+#define CONFIG_BOOTARGS                "console=ttyS0,115200 "                 \
+                               "root=/dev/mtdblock4 "                  \
+                               "mtdparts=physmap-flash.0:16k(bootstrap)ro,"\
+                               "16k(env),224k(uboot)ro,-(linux);"      \
+                               "at91_nand:-(root) "                    \
+                               "rw rootfstype=jffs2"
 
 #endif
 
index 41c418f9aba331413c0a9e7314351ac5ca561917..675224e0ba6bc7c55e71602e4e6bbd4556a266a5 100644 (file)
 #define CONFIG_USART3          1       /* USART 3 is DBGU */
 
 #define CONFIG_BOOTDELAY       3
-#define CONFIG_BOOTARGS                "console=ttyS0,115200 " \
-                               "root=/dev/mtdblock0 rw rootfstype=jffs2"
-
-/* #define CONFIG_ENV_OVERWRITE        1 */
 
 /*
  * BOOTP options
@@ -96,7 +92,7 @@
 #define CFG_MAX_DATAFLASH_BANKS                2
 #define CFG_DATAFLASH_LOGIC_ADDR_CS0   0xC0000000      /* CS0 */
 #define CFG_DATAFLASH_LOGIC_ADDR_CS1   0xD0000000      /* CS1 */
-#define AT91_SPI_CLK                   33000000
+#define AT91_SPI_CLK                   15000000
 #define DATAFLASH_TCSS                 (0x1a << 16)
 #define DATAFLASH_TCHS                 (0x1 << 24)
 
 #define NAND_MAX_CHIPS                 1
 #define CFG_MAX_NAND_DEVICE            1
 #define CFG_NAND_BASE                  0x40000000
+#define CFG_NAND_DBW_8                 1
 
 /* NOR flash - no real flash on this board */
 #define CFG_NO_FLASH                   1
 #define CFG_ENV_OFFSET         0x4200
 #define CFG_ENV_ADDR           (CFG_DATAFLASH_LOGIC_ADDR_CS0 + CFG_ENV_OFFSET)
 #define CFG_ENV_SIZE           0x4200
-#define CONFIG_BOOTCOMMAND     "cp.b 0xC003DE00 0x22000000 0x200040; bootm"
+#define CONFIG_BOOTCOMMAND     "cp.b 0xC0042000 0x22000000 0x210000; bootm"
+#define CONFIG_BOOTARGS                "console=ttyS0,115200 "                 \
+                               "root=/dev/mtdblock0 "                  \
+                               "mtdparts=at91_nand:-(root) "           \
+                               "rw rootfstype=jffs2"
 
 #elif CFG_USE_DATAFLASH_CS1
 
 #define CFG_ENV_OFFSET         0x4200
 #define CFG_ENV_ADDR           (CFG_DATAFLASH_LOGIC_ADDR_CS1 + CFG_ENV_OFFSET)
 #define CFG_ENV_SIZE           0x4200
-#define CONFIG_BOOTCOMMAND     "cp.b 0xD003DE00 0x22000000 0x200040; bootm"
+#define CONFIG_BOOTCOMMAND     "cp.b 0xD0042000 0x22000000 0x210000; bootm"
+#define CONFIG_BOOTARGS                "console=ttyS0,115200 "                 \
+                               "root=/dev/mtdblock0 "                  \
+                               "mtdparts=at91_nand:-(root) "           \
+                               "rw rootfstype=jffs2"
 
 #else /* CFG_USE_NANDFLASH */
 
 #define CFG_ENV_OFFSET_REDUND  0x80000
 #define CFG_ENV_SIZE           0x20000         /* 1 sector = 128 kB */
 #define CONFIG_BOOTCOMMAND     "nand read 0x22000000 0xA0000 0x200000; bootm"
+#define CONFIG_BOOTARGS                "console=ttyS0,115200 "                 \
+                               "root=/dev/mtdblock5 "                  \
+                               "mtdparts=at91_nand:128k(bootstrap)ro," \
+                               "256k(uboot)ro,128k(env1)ro,"           \
+                               "128k(env2)ro,2M(linux),-(root) "       \
+                               "rw rootfstype=jffs2"
 
 #endif
 
diff --git a/include/configs/at91sam9261ek.h b/include/configs/at91sam9261ek.h
new file mode 100644 (file)
index 0000000..e53a23f
--- /dev/null
@@ -0,0 +1,202 @@
+/*
+ * (C) Copyright 2007-2008
+ * Stelian Pop <stelian.pop@leadtechdesign.com>
+ * Lead Tech Design <www.leadtechdesign.com>
+ *
+ * Configuation settings for the AT91SAM9261EK 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
+ */
+
+#ifndef __CONFIG_H
+#define __CONFIG_H
+
+/* ARM asynchronous clock */
+#define AT91_CPU_NAME          "AT91SAM9261"
+#define AT91_MAIN_CLOCK                198656000       /* from 18.432 MHz crystal */
+#define AT91_MASTER_CLOCK      99328000        /* peripheral = main / 2 */
+#define CFG_HZ                 1000000         /* 1us resolution */
+
+#define AT91_SLOW_CLOCK                32768   /* slow clock */
+
+#define CONFIG_ARM926EJS       1       /* This is an ARM926EJS Core    */
+#define CONFIG_AT91SAM9261     1       /* It's an Atmel AT91SAM9261 SoC*/
+#define CONFIG_AT91SAM9261EK   1       /* on an AT91SAM9261EK Board    */
+#undef CONFIG_USE_IRQ                  /* we don't need IRQ/FIQ stuff  */
+
+#define CONFIG_CMDLINE_TAG     1       /* enable passing of ATAGs      */
+#define CONFIG_SETUP_MEMORY_TAGS 1
+#define CONFIG_INITRD_TAG      1
+
+#define CONFIG_SKIP_LOWLEVEL_INIT
+#define CONFIG_SKIP_RELOCATE_UBOOT
+
+/*
+ * Hardware drivers
+ */
+#define CONFIG_ATMEL_USART     1
+#undef CONFIG_USART0
+#undef CONFIG_USART1
+#undef CONFIG_USART2
+#define CONFIG_USART3          1       /* USART 3 is DBGU */
+
+/* LCD */
+#define CONFIG_LCD                     1
+#define LCD_BPP                                LCD_COLOR8
+#define CONFIG_LCD_LOGO                        1
+#undef LCD_TEST_PATTERN
+#define CONFIG_LCD_INFO                        1
+#define CONFIG_LCD_INFO_BELOW_LOGO     1
+#define CFG_WHITE_ON_BLACK             1
+#define CONFIG_ATMEL_LCD               1
+#define CONFIG_ATMEL_LCD_BGR555                1
+#define CFG_CONSOLE_IS_IN_ENV          1
+
+#define CONFIG_BOOTDELAY       3
+
+/*
+ * BOOTP options
+ */
+#define CONFIG_BOOTP_BOOTFILESIZE      1
+#define CONFIG_BOOTP_BOOTPATH          1
+#define CONFIG_BOOTP_GATEWAY           1
+#define CONFIG_BOOTP_HOSTNAME          1
+
+/*
+ * Command line configuration.
+ */
+#include <config_cmd_default.h>
+#undef CONFIG_CMD_BDI
+#undef CONFIG_CMD_IMI
+#undef CONFIG_CMD_AUTOSCRIPT
+#undef CONFIG_CMD_FPGA
+#undef CONFIG_CMD_LOADS
+#undef CONFIG_CMD_IMLS
+
+#define CONFIG_CMD_PING                1
+#define CONFIG_CMD_DHCP                1
+#define CONFIG_CMD_NAND                1
+#define CONFIG_CMD_USB         1
+
+/* SDRAM */
+#define CONFIG_NR_DRAM_BANKS           1
+#define PHYS_SDRAM                     0x20000000
+#define PHYS_SDRAM_SIZE                        0x04000000      /* 64 megs */
+
+/* DataFlash */
+#define CONFIG_HAS_DATAFLASH           1
+#define CFG_SPI_WRITE_TOUT             (5*CFG_HZ)
+#define CFG_MAX_DATAFLASH_BANKS                2
+#define CFG_DATAFLASH_LOGIC_ADDR_CS0   0xC0000000      /* CS0 */
+#define CFG_DATAFLASH_LOGIC_ADDR_CS3   0xD0000000      /* CS3 */
+#define AT91_SPI_CLK                   15000000
+#define DATAFLASH_TCSS                 (0x1a << 16)
+#define DATAFLASH_TCHS                 (0x1 << 24)
+
+/* NAND flash */
+#define NAND_MAX_CHIPS                 1
+#define CFG_MAX_NAND_DEVICE            1
+#define CFG_NAND_BASE                  0x40000000
+#define CFG_NAND_DBW_8                 1
+
+/* NOR flash - no real flash on this board */
+#define CFG_NO_FLASH                   1
+
+/* Ethernet */
+#define CONFIG_DRIVER_DM9000           1
+#define CONFIG_DM9000_BASE             0x30000000
+#define DM9000_IO                      CONFIG_DM9000_BASE
+#define DM9000_DATA                    (CONFIG_DM9000_BASE + 4)
+#define CONFIG_DM9000_USE_16BIT                1
+#define CONFIG_NET_RETRY_COUNT         20
+#define CONFIG_RESET_PHY_R             1
+
+/* USB */
+#define CONFIG_USB_OHCI_NEW            1
+#define LITTLEENDIAN                   1
+#define CONFIG_DOS_PARTITION           1
+#define CFG_USB_OHCI_CPU_INIT          1
+#define CFG_USB_OHCI_REGS_BASE         0x00500000      /* AT91SAM9261_UHP_BASE */
+#define CFG_USB_OHCI_SLOT_NAME         "at91sam9261"
+#define CFG_USB_OHCI_MAX_ROOT_PORTS    2
+#define CONFIG_USB_STORAGE             1
+
+#define CFG_LOAD_ADDR                  0x22000000      /* load address */
+
+#define CFG_MEMTEST_START              PHYS_SDRAM
+#define CFG_MEMTEST_END                        0x23e00000
+
+#define CFG_USE_DATAFLASH_CS0          1
+#undef CFG_USE_NANDFLASH
+
+#ifdef CFG_USE_DATAFLASH_CS0
+
+/* bootstrap + u-boot + env + linux in dataflash on CS0 */
+#define CFG_ENV_IS_IN_DATAFLASH        1
+#define CFG_MONITOR_BASE       (CFG_DATAFLASH_LOGIC_ADDR_CS0 + 0x8400)
+#define CFG_ENV_OFFSET         0x4200
+#define CFG_ENV_ADDR           (CFG_DATAFLASH_LOGIC_ADDR_CS0 + CFG_ENV_OFFSET)
+#define CFG_ENV_SIZE           0x4200
+#define CONFIG_BOOTCOMMAND     "cp.b 0xC0042000 0x22000000 0x210000; bootm"
+#define CONFIG_BOOTARGS                "console=ttyS0,115200 "                 \
+                               "root=/dev/mtdblock0 "                  \
+                               "mtdparts=at91_nand:-(root) "           \
+                               "rw rootfstype=jffs2"
+
+#else /* CFG_USE_NANDFLASH */
+
+/* bootstrap + u-boot + env + linux in nandflash */
+#define CFG_ENV_IS_IN_NAND     1
+#define CFG_ENV_OFFSET         0x60000
+#define CFG_ENV_OFFSET_REDUND  0x80000
+#define CFG_ENV_SIZE           0x20000         /* 1 sector = 128 kB */
+#define CONFIG_BOOTCOMMAND     "nand read 0x22000000 0xA0000 0x200000; bootm"
+#define CONFIG_BOOTARGS                "console=ttyS0,115200 "                 \
+                               "root=/dev/mtdblock5 "                  \
+                               "mtdparts=at91_nand:128k(bootstrap)ro," \
+                               "256k(uboot)ro,128k(env1)ro,"           \
+                               "128k(env2)ro,2M(linux),-(root) "       \
+                               "rw rootfstype=jffs2"
+
+#endif
+
+#define CONFIG_BAUDRATE                115200
+#define CFG_BAUDRATE_TABLE     {115200 , 19200, 38400, 57600, 9600 }
+
+#define CFG_PROMPT             "U-Boot> "
+#define CFG_CBSIZE             256
+#define CFG_MAXARGS            16
+#define CFG_PBSIZE             (CFG_CBSIZE + sizeof(CFG_PROMPT) + 16)
+#define CFG_LONGHELP           1
+#define CONFIG_CMDLINE_EDITING 1
+
+#define ROUND(A, B)            (((A) + (B)) & ~((B) - 1))
+/*
+ * Size of malloc() pool
+ */
+#define CFG_MALLOC_LEN         ROUND(3 * CFG_ENV_SIZE + 128*1024, 0x1000)
+#define CFG_GBL_DATA_SIZE      128     /* 128 bytes for initial data */
+
+#define CONFIG_STACKSIZE       (32*1024)       /* regular stack */
+
+#ifdef CONFIG_USE_IRQ
+#error CONFIG_USE_IRQ not supported
+#endif
+
+#endif
diff --git a/include/configs/at91sam9263ek.h b/include/configs/at91sam9263ek.h
new file mode 100644 (file)
index 0000000..a8194b5
--- /dev/null
@@ -0,0 +1,206 @@
+/*
+ * (C) Copyright 2007-2008
+ * Stelian Pop <stelian.pop@leadtechdesign.com>
+ * Lead Tech Design <www.leadtechdesign.com>
+ *
+ * Configuation settings for the AT91SAM9263EK 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
+ */
+
+#ifndef __CONFIG_H
+#define __CONFIG_H
+
+/* ARM asynchronous clock */
+#define AT91_CPU_NAME          "AT91SAM9263"
+#define AT91_MAIN_CLOCK                199919000       /* from 16.367 MHz crystal */
+#define AT91_MASTER_CLOCK      99959500        /* peripheral = main / 2 */
+#define CFG_HZ                 1000000         /* 1us resolution */
+
+#define AT91_SLOW_CLOCK                32768   /* slow clock */
+
+#define CONFIG_ARM926EJS       1       /* This is an ARM926EJS Core    */
+#define CONFIG_AT91SAM9263     1       /* It's an Atmel AT91SAM9263 SoC*/
+#define CONFIG_AT91SAM9263EK   1       /* on an AT91SAM9263EK Board    */
+#undef CONFIG_USE_IRQ                  /* we don't need IRQ/FIQ stuff  */
+
+#define CONFIG_CMDLINE_TAG     1       /* enable passing of ATAGs      */
+#define CONFIG_SETUP_MEMORY_TAGS 1
+#define CONFIG_INITRD_TAG      1
+
+#define CONFIG_SKIP_LOWLEVEL_INIT
+#define CONFIG_SKIP_RELOCATE_UBOOT
+
+/*
+ * Hardware drivers
+ */
+#define CONFIG_ATMEL_USART     1
+#undef CONFIG_USART0
+#undef CONFIG_USART1
+#undef CONFIG_USART2
+#define CONFIG_USART3          1       /* USART 3 is DBGU */
+
+/* LCD */
+#define CONFIG_LCD                     1
+#define LCD_BPP                                LCD_COLOR8
+#define CONFIG_LCD_LOGO                        1
+#undef LCD_TEST_PATTERN
+#define CONFIG_LCD_INFO                        1
+#define CONFIG_LCD_INFO_BELOW_LOGO     1
+#define CFG_WHITE_ON_BLACK             1
+#define CONFIG_ATMEL_LCD               1
+#define CONFIG_ATMEL_LCD_BGR555                1
+#define CFG_CONSOLE_IS_IN_ENV          1
+
+#define CONFIG_BOOTDELAY       3
+
+/*
+ * BOOTP options
+ */
+#define CONFIG_BOOTP_BOOTFILESIZE      1
+#define CONFIG_BOOTP_BOOTPATH          1
+#define CONFIG_BOOTP_GATEWAY           1
+#define CONFIG_BOOTP_HOSTNAME          1
+
+/*
+ * Command line configuration.
+ */
+#include <config_cmd_default.h>
+#undef CONFIG_CMD_BDI
+#undef CONFIG_CMD_IMI
+#undef CONFIG_CMD_AUTOSCRIPT
+#undef CONFIG_CMD_FPGA
+#undef CONFIG_CMD_LOADS
+#undef CONFIG_CMD_IMLS
+
+#define CONFIG_CMD_PING                1
+#define CONFIG_CMD_DHCP                1
+#define CONFIG_CMD_NAND                1
+#define CONFIG_CMD_USB         1
+
+/* SDRAM */
+#define CONFIG_NR_DRAM_BANKS           1
+#define PHYS_SDRAM                     0x20000000
+#define PHYS_SDRAM_SIZE                        0x04000000      /* 64 megs */
+
+/* DataFlash */
+#define CONFIG_HAS_DATAFLASH           1
+#define CFG_SPI_WRITE_TOUT             (5*CFG_HZ)
+#define CFG_MAX_DATAFLASH_BANKS                1
+#define CFG_DATAFLASH_LOGIC_ADDR_CS0   0xC0000000      /* CS0 */
+#define AT91_SPI_CLK                   15000000
+#define DATAFLASH_TCSS                 (0x1a << 16)
+#define DATAFLASH_TCHS                 (0x1 << 24)
+
+/* NOR flash, if populated */
+#if 1
+#define CFG_NO_FLASH                   1
+#else
+#define CFG_FLASH_CFI                  1
+#define CFG_FLASH_CFI_DRIVER           1
+#define PHYS_FLASH_1                   0x10000000
+#define CFG_FLASH_BASE                 PHYS_FLASH_1
+#define CFG_MAX_FLASH_SECT             256
+#define CFG_MAX_FLASH_BANKS            1
+#endif
+
+/* NAND flash */
+#define NAND_MAX_CHIPS                 1
+#define CFG_MAX_NAND_DEVICE            1
+#define CFG_NAND_BASE                  0x40000000
+#define CFG_NAND_DBW_8                 1
+
+/* Ethernet */
+#define CONFIG_MACB                    1
+#define CONFIG_RMII                    1
+#define CONFIG_NET_MULTI               1
+#define CONFIG_NET_RETRY_COUNT         20
+#define CONFIG_RESET_PHY_R             1
+
+/* USB */
+#define CONFIG_USB_OHCI_NEW            1
+#define LITTLEENDIAN                   1
+#define CONFIG_DOS_PARTITION           1
+#define CFG_USB_OHCI_CPU_INIT          1
+#define CFG_USB_OHCI_REGS_BASE         0x00a00000      /* AT91SAM9263_UHP_BASE */
+#define CFG_USB_OHCI_SLOT_NAME         "at91sam9263"
+#define CFG_USB_OHCI_MAX_ROOT_PORTS    2
+#define CONFIG_USB_STORAGE             1
+
+#define CFG_LOAD_ADDR                  0x22000000      /* load address */
+
+#define CFG_MEMTEST_START              PHYS_SDRAM
+#define CFG_MEMTEST_END                        0x23e00000
+
+#define CFG_USE_DATAFLASH              1
+#undef CFG_USE_NANDFLASH
+
+#ifdef CFG_USE_DATAFLASH
+
+/* bootstrap + u-boot + env + linux in dataflash on CS0 */
+#define CFG_ENV_IS_IN_DATAFLASH        1
+#define CFG_MONITOR_BASE       (CFG_DATAFLASH_LOGIC_ADDR_CS0 + 0x8400)
+#define CFG_ENV_OFFSET         0x4200
+#define CFG_ENV_ADDR           (CFG_DATAFLASH_LOGIC_ADDR_CS0 + CFG_ENV_OFFSET)
+#define CFG_ENV_SIZE           0x4200
+#define CONFIG_BOOTCOMMAND     "cp.b 0xC0042000 0x22000000 0x210000; bootm"
+#define CONFIG_BOOTARGS                "console=ttyS0,115200 " \
+                               "root=/dev/mtdblock0 " \
+                               "mtdparts=at91_nand:-(root) "\
+                               "rw rootfstype=jffs2"
+
+#else /* CFG_USE_NANDFLASH */
+
+/* bootstrap + u-boot + env + linux in nandflash */
+#define CFG_ENV_IS_IN_NAND     1
+#define CFG_ENV_OFFSET         0x60000
+#define CFG_ENV_OFFSET_REDUND  0x80000
+#define CFG_ENV_SIZE           0x20000         /* 1 sector = 128 kB */
+#define CONFIG_BOOTCOMMAND     "nand read 0x22000000 0xA0000 0x200000; bootm"
+#define CONFIG_BOOTARGS                "console=ttyS0,115200 " \
+                               "root=/dev/mtdblock5 " \
+                               "mtdparts=at91_nand:128k(bootstrap)ro,256k(uboot)ro,128k(env1)ro,128k(env2)ro,2M(linux),-(root) " \
+                               "rw rootfstype=jffs2"
+
+#endif
+
+#define CONFIG_BAUDRATE                115200
+#define CFG_BAUDRATE_TABLE     {115200 , 19200, 38400, 57600, 9600 }
+
+#define CFG_PROMPT             "U-Boot> "
+#define CFG_CBSIZE             256
+#define CFG_MAXARGS            16
+#define CFG_PBSIZE             (CFG_CBSIZE + sizeof(CFG_PROMPT) + 16)
+#define CFG_LONGHELP           1
+#define CONFIG_CMDLINE_EDITING 1
+
+#define ROUND(A, B)            (((A) + (B)) & ~((B) - 1))
+/*
+ * Size of malloc() pool
+ */
+#define CFG_MALLOC_LEN         ROUND(3 * CFG_ENV_SIZE + 128*1024, 0x1000)
+#define CFG_GBL_DATA_SIZE      128     /* 128 bytes for initial data */
+
+#define CONFIG_STACKSIZE       (32*1024)       /* regular stack */
+
+#ifdef CONFIG_USE_IRQ
+#error CONFIG_USE_IRQ not supported
+#endif
+
+#endif
diff --git a/include/configs/at91sam9rlek.h b/include/configs/at91sam9rlek.h
new file mode 100644 (file)
index 0000000..2ad8d05
--- /dev/null
@@ -0,0 +1,175 @@
+/*
+ * (C) Copyright 2007-2008
+ * Stelian Pop <stelian.pop@leadtechdesign.com>
+ * Lead Tech Design <www.leadtechdesign.com>
+ *
+ * Configuation settings for the AT91SAM9RLEK 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
+ */
+
+#ifndef __CONFIG_H
+#define __CONFIG_H
+
+/* ARM asynchronous clock */
+#define AT91_CPU_NAME          "AT91SAM9RL"
+#define AT91_MAIN_CLOCK                200000000       /* from 12.000 MHz crystal */
+#define AT91_MASTER_CLOCK      100000000       /* peripheral = main / 2 */
+#define CFG_HZ                 1000000         /* 1us resolution */
+
+#define AT91_SLOW_CLOCK                32768   /* slow clock */
+
+#define CONFIG_ARM926EJS       1       /* This is an ARM926EJS Core    */
+#define CONFIG_AT91SAM9RL      1       /* It's an Atmel AT91SAM9RL SoC*/
+#define CONFIG_AT91SAM9RLEK    1       /* on an AT91SAM9RLEK Board     */
+#undef CONFIG_USE_IRQ                  /* we don't need IRQ/FIQ stuff  */
+
+#define CONFIG_CMDLINE_TAG     1       /* enable passing of ATAGs      */
+#define CONFIG_SETUP_MEMORY_TAGS 1
+#define CONFIG_INITRD_TAG      1
+
+#define CONFIG_SKIP_LOWLEVEL_INIT
+#define CONFIG_SKIP_RELOCATE_UBOOT
+
+/*
+ * Hardware drivers
+ */
+#define CONFIG_ATMEL_USART     1
+#undef CONFIG_USART0
+#undef CONFIG_USART1
+#undef CONFIG_USART2
+#define CONFIG_USART3          1       /* USART 3 is DBGU */
+
+/* LCD */
+#define CONFIG_LCD                     1
+#define LCD_BPP                                LCD_COLOR8
+#define CONFIG_LCD_LOGO                        1
+#undef LCD_TEST_PATTERN
+#define CONFIG_LCD_INFO                        1
+#define CONFIG_LCD_INFO_BELOW_LOGO     1
+#define CFG_WHITE_ON_BLACK             1
+#define CONFIG_ATMEL_LCD               1
+#define CONFIG_ATMEL_LCD_RGB565                1
+#define CFG_CONSOLE_IS_IN_ENV          1
+
+#define CONFIG_BOOTDELAY       3
+
+/*
+ * Command line configuration.
+ */
+#include <config_cmd_default.h>
+#undef CONFIG_CMD_BDI
+#undef CONFIG_CMD_IMI
+#undef CONFIG_CMD_AUTOSCRIPT
+#undef CONFIG_CMD_FPGA
+#undef CONFIG_CMD_LOADS
+#undef CONFIG_CMD_IMLS
+#undef CONFIG_CMD_NET
+#undef CONFIG_CMD_USB
+
+#define CONFIG_CMD_NAND                1
+
+/* SDRAM */
+#define CONFIG_NR_DRAM_BANKS           1
+#define PHYS_SDRAM                     0x20000000
+#define PHYS_SDRAM_SIZE                        0x04000000      /* 64 megs */
+
+/* DataFlash */
+#define CONFIG_HAS_DATAFLASH           1
+#define CFG_SPI_WRITE_TOUT             (5*CFG_HZ)
+#define CFG_MAX_DATAFLASH_BANKS                1
+#define CFG_DATAFLASH_LOGIC_ADDR_CS0   0xC0000000      /* CS0 */
+#define AT91_SPI_CLK                   15000000
+#define DATAFLASH_TCSS                 (0x1a << 16)
+#define DATAFLASH_TCHS                 (0x1 << 24)
+
+/* NOR flash - not present */
+#define CFG_NO_FLASH                   1
+
+/* NAND flash */
+#define NAND_MAX_CHIPS                 1
+#define CFG_MAX_NAND_DEVICE            1
+#define CFG_NAND_BASE                  0x40000000
+#define CFG_NAND_DBW_8                 1
+
+/* Ethernet - not present */
+
+/* USB - not supported */
+
+#define CFG_LOAD_ADDR                  0x22000000      /* load address */
+
+#define CFG_MEMTEST_START              PHYS_SDRAM
+#define CFG_MEMTEST_END                        0x23e00000
+
+#define CFG_USE_DATAFLASH              1
+#undef CFG_USE_NANDFLASH
+
+#ifdef CFG_USE_DATAFLASH
+
+/* bootstrap + u-boot + env + linux in dataflash on CS0 */
+#define CFG_ENV_IS_IN_DATAFLASH        1
+#define CFG_MONITOR_BASE       (CFG_DATAFLASH_LOGIC_ADDR_CS0 + 0x8400)
+#define CFG_ENV_OFFSET         0x4200
+#define CFG_ENV_ADDR           (CFG_DATAFLASH_LOGIC_ADDR_CS0 + CFG_ENV_OFFSET)
+#define CFG_ENV_SIZE           0x4200
+#define CONFIG_BOOTCOMMAND     "cp.b 0xC0042000 0x22000000 0x210000; bootm"
+#define CONFIG_BOOTARGS                "console=ttyS0,115200 " \
+                               "root=/dev/mtdblock0 " \
+                               "mtdparts=at91_nand:-(root) "\
+                               "rw rootfstype=jffs2"
+
+#else /* CFG_USE_NANDFLASH */
+
+/* bootstrap + u-boot + env + linux in nandflash */
+#define CFG_ENV_IS_IN_NAND     1
+#define CFG_ENV_OFFSET         0x60000
+#define CFG_ENV_OFFSET_REDUND  0x80000
+#define CFG_ENV_SIZE           0x20000         /* 1 sector = 128 kB */
+#define CONFIG_BOOTCOMMAND     "nand read 0x22000000 0xA0000 0x200000; bootm"
+#define CONFIG_BOOTARGS                "console=ttyS0,115200 " \
+                               "root=/dev/mtdblock5 " \
+                               "mtdparts=at91_nand:128k(bootstrap)ro,256k(uboot)ro,128k(env1)ro,128k(env2)ro,2M(linux),-(root) " \
+                               "rw rootfstype=jffs2"
+
+#endif
+
+#define CONFIG_BAUDRATE                115200
+#define CFG_BAUDRATE_TABLE     {115200 , 19200, 38400, 57600, 9600 }
+
+#define CFG_PROMPT             "U-Boot> "
+#define CFG_CBSIZE             256
+#define CFG_MAXARGS            16
+#define CFG_PBSIZE             (CFG_CBSIZE + sizeof(CFG_PROMPT) + 16)
+#define CFG_LONGHELP           1
+#define CONFIG_CMDLINE_EDITING 1
+
+#define ROUND(A, B)            (((A) + (B)) & ~((B) - 1))
+/*
+ * Size of malloc() pool
+ */
+#define CFG_MALLOC_LEN         ROUND(3 * CFG_ENV_SIZE + 128*1024, 0x1000)
+#define CFG_GBL_DATA_SIZE      128     /* 128 bytes for initial data */
+
+#define CONFIG_STACKSIZE       (32*1024)       /* regular stack */
+
+#ifdef CONFIG_USE_IRQ
+#error CONFIG_USE_IRQ not supported
+#endif
+
+#endif
index 5aad043d89e1815b6c17271463086b9ad4154c19..3fc9975637152f11b6c204e1151245c95cdc7e9d 100644 (file)
@@ -24,6 +24,8 @@
 #ifndef __CONFIG_H
 #define __CONFIG_H
 
+#include <asm/arch/memory-map.h>
+
 #define CONFIG_AVR32                   1
 #define CONFIG_AT32AP                  1
 #define CONFIG_AT32AP7000              1
 #define CONFIG_CMD_FAT
 #define CONFIG_CMD_JFFS2
 #define CONFIG_CMD_MMC
+
+#undef CONFIG_CMD_AUTOSCRIPT
 #undef CONFIG_CMD_FPGA
 #undef CONFIG_CMD_SETGETDCR
+#undef CONFIG_CMD_XIMG
 
 #define CONFIG_ATMEL_USART             1
 #define CONFIG_MACB                    1
 
 #define CFG_MONITOR_BASE               CFG_FLASH_BASE
 
-#define CFG_INTRAM_BASE                        0x24000000
-#define CFG_INTRAM_SIZE                        0x8000
-
-#define CFG_SDRAM_BASE                 0x10000000
-#define CFG_SDRAM_16BIT                        1
+#define CFG_INTRAM_BASE                        INTERNAL_SRAM_BASE
+#define CFG_INTRAM_SIZE                        INTERNAL_SRAM_SIZE
+#define CFG_SDRAM_BASE                 EBI_SDRAM_BASE
 
 #define CFG_ENV_IS_IN_FLASH            1
 #define CFG_ENV_SIZE                   65536
 #define CFG_INIT_SP_ADDR               (CFG_INTRAM_BASE + CFG_INTRAM_SIZE)
 
 #define CFG_MALLOC_LEN                 (256*1024)
-#define CFG_MALLOC_END                                                 \
-       ({                                                              \
-               DECLARE_GLOBAL_DATA_PTR;                                \
-               CFG_SDRAM_BASE + gd->sdram_size;                        \
-       })
-#define CFG_MALLOC_START               (CFG_MALLOC_END - CFG_MALLOC_LEN)
-
 #define CFG_DMA_ALLOC_LEN              (16384)
 
 /* Allow 4MB for the kernel run-time image */
-#define CFG_LOAD_ADDR                  (CFG_SDRAM_BASE + 0x00400000)
+#define CFG_LOAD_ADDR                  (EBI_SDRAM_BASE + 0x00400000)
 #define CFG_BOOTPARAMS_LEN             (16 * 1024)
 
 /* Other configuration settings that shouldn't have to change all that often */
-#define CFG_PROMPT                     "Uboot> "
+#define CFG_PROMPT                     "U-Boot> "
 #define CFG_CBSIZE                     256
 #define CFG_MAXARGS                    16
 #define CFG_PBSIZE                     (CFG_CBSIZE + sizeof(CFG_PROMPT) + 16)
 #define CFG_LONGHELP                   1
 
-#define CFG_MEMTEST_START              CFG_SDRAM_BASE
+#define CFG_MEMTEST_START              EBI_SDRAM_BASE
 #define CFG_MEMTEST_END                        (CFG_MEMTEST_START + 0x1f00000)
 
 #define CFG_BAUDRATE_TABLE { 115200, 38400, 19200, 9600, 2400 }
index 95aeab6d4ee7eafd6af3ca5037eeb8f6014150a2..ba18eb63c7f4da584de708f563d3f1ae1e05e6af 100644 (file)
@@ -24,6 +24,8 @@
 #ifndef __CONFIG_H
 #define __CONFIG_H
 
+#include <asm/arch/memory-map.h>
+
 #define CONFIG_AVR32                   1
 #define CONFIG_AT32AP                  1
 #define CONFIG_AT32AP7000              1
 #define CONFIG_CMD_FAT
 #define CONFIG_CMD_JFFS2
 #define CONFIG_CMD_MMC
-#define CONFIG_CMD_REGINFO
 
 #undef CONFIG_CMD_AUTOSCRIPT
+#undef CONFIG_CMD_FPGA
 #undef CONFIG_CMD_SETGETDCR
 #undef CONFIG_CMD_XIMG
 
 
 #define CFG_MONITOR_BASE               CFG_FLASH_BASE
 
-#define CFG_INTRAM_BASE                        0x24000000
-#define CFG_INTRAM_SIZE                        0x8000
-
-#define CFG_SDRAM_BASE                 0x10000000
+#define CFG_INTRAM_BASE                        INTERNAL_SRAM_BASE
+#define CFG_INTRAM_SIZE                        INTERNAL_SRAM_SIZE
+#define CFG_SDRAM_BASE                 EBI_SDRAM_BASE
 
 #define CFG_ENV_IS_IN_FLASH            1
 #define CFG_ENV_SIZE                   65536
 #define CFG_DMA_ALLOC_LEN              (16384)
 
 /* Allow 4MB for the kernel run-time image */
-#define CFG_LOAD_ADDR                  (CFG_SDRAM_BASE + 0x00400000)
+#define CFG_LOAD_ADDR                  (EBI_SDRAM_BASE + 0x00400000)
 #define CFG_BOOTPARAMS_LEN             (16 * 1024)
 
 /* Other configuration settings that shouldn't have to change all that often */
-#define CFG_PROMPT                     "Uboot> "
+#define CFG_PROMPT                     "U-Boot> "
 #define CFG_CBSIZE                     256
-#define CFG_MAXARGS                    8
+#define CFG_MAXARGS                    16
 #define CFG_PBSIZE                     (CFG_CBSIZE + sizeof(CFG_PROMPT) + 16)
 #define CFG_LONGHELP                   1
 
-#define CFG_MEMTEST_START              CFG_SDRAM_BASE
+#define CFG_MEMTEST_START              EBI_SDRAM_BASE
 #define CFG_MEMTEST_END                        (CFG_MEMTEST_START + 0x700000)
 #define CFG_BAUDRATE_TABLE { 115200, 38400, 19200, 9600, 2400 }
 
index 194788b18da675ff3bfaab3aa28638d085cfb3fe..a528ddfb0e92f178f013d912e6deced06d8b66e6 100644 (file)
@@ -24,6 +24,8 @@
 #ifndef __CONFIG_H
 #define __CONFIG_H
 
+#include <asm/arch/memory-map.h>
+
 #define CONFIG_AVR32                   1
 #define CONFIG_AT32AP                  1
 #define CONFIG_AT32AP7001              1
 
 #define CFG_MONITOR_BASE               CFG_FLASH_BASE
 
-#define CFG_INTRAM_BASE                        0x24000000
-#define CFG_INTRAM_SIZE                        0x8000
-
-#define CFG_SDRAM_BASE                 0x10000000
+#define CFG_INTRAM_BASE                        INTERNAL_SRAM_BASE
+#define CFG_INTRAM_SIZE                        INTERNAL_SRAM_SIZE
+#define CFG_SDRAM_BASE                 EBI_SDRAM_BASE
 
 #define CFG_ENV_IS_IN_FLASH            1
 #define CFG_ENV_SIZE                   65536
 #define CFG_MALLOC_LEN                 (256*1024)
 
 /* Allow 4MB for the kernel run-time image */
-#define CFG_LOAD_ADDR                  (CFG_SDRAM_BASE + 0x00400000)
+#define CFG_LOAD_ADDR                  (EBI_SDRAM_BASE + 0x00400000)
 #define CFG_BOOTPARAMS_LEN             (16 * 1024)
 
 /* Other configuration settings that shouldn't have to change all that often */
-#define CFG_PROMPT                     "Uboot> "
+#define CFG_PROMPT                     "U-Boot> "
 #define CFG_CBSIZE                     256
 #define CFG_MAXARGS                    16
 #define CFG_PBSIZE                     (CFG_CBSIZE + sizeof(CFG_PROMPT) + 16)
 #define CFG_LONGHELP                   1
 
-#define CFG_MEMTEST_START              CFG_SDRAM_BASE
+#define CFG_MEMTEST_START              EBI_SDRAM_BASE
 #define CFG_MEMTEST_END                        (CFG_MEMTEST_START + 0x700000)
 #define CFG_BAUDRATE_TABLE { 115200, 38400, 19200, 9600, 2400 }
 
index b81fc212701965ff64fbe576c746296c884ade4f..fc9585e84d2d21eeca8d0e23ca88d6a672e35529 100644 (file)
@@ -24,6 +24,8 @@
 #ifndef __CONFIG_H
 #define __CONFIG_H
 
+#include <asm/arch/memory-map.h>
+
 #define CONFIG_AVR32                   1
 #define CONFIG_AT32AP                  1
 #define CONFIG_AT32AP7002              1
 
 #define CFG_MONITOR_BASE               CFG_FLASH_BASE
 
-#define CFG_INTRAM_BASE                        0x24000000
-#define CFG_INTRAM_SIZE                        0x8000
-
-#define CFG_SDRAM_BASE                 0x10000000
-#define CFG_SDRAM_16BIT                        1
+#define CFG_INTRAM_BASE                        INTERNAL_SRAM_BASE
+#define CFG_INTRAM_SIZE                        INTERNAL_SRAM_SIZE
+#define CFG_SDRAM_BASE                 EBI_SDRAM_BASE
 
 #define CFG_ENV_IS_IN_FLASH            1
 #define CFG_ENV_SIZE                   65536
 #define CFG_MALLOC_LEN                 (256*1024)
 
 /* Allow 2MB for the kernel run-time image */
-#define CFG_LOAD_ADDR                  (CFG_SDRAM_BASE + 0x00200000)
+#define CFG_LOAD_ADDR                  (EBI_SDRAM_BASE + 0x00200000)
 #define CFG_BOOTPARAMS_LEN             (16 * 1024)
 
 /* Other configuration settings that shouldn't have to change all that often */
-#define CFG_PROMPT                     "Uboot> "
+#define CFG_PROMPT                     "U-Boot> "
 #define CFG_CBSIZE                     256
 #define CFG_MAXARGS                    16
 #define CFG_PBSIZE                     (CFG_CBSIZE + sizeof(CFG_PROMPT) + 16)
 #define CFG_LONGHELP                   1
 
-#define CFG_MEMTEST_START              CFG_SDRAM_BASE
+#define CFG_MEMTEST_START              EBI_SDRAM_BASE
 #define CFG_MEMTEST_END                        (CFG_MEMTEST_START + 0x700000)
 #define CFG_BAUDRATE_TABLE { 115200, 38400, 19200, 9600, 2400 }
 
diff --git a/include/configs/atstk1006.h b/include/configs/atstk1006.h
new file mode 100644 (file)
index 0000000..9fd49a5
--- /dev/null
@@ -0,0 +1,203 @@
+/*
+ * Copyright (C) 2005-2006 Atmel Corporation
+ *
+ * Configuration settings for the ATSTK1002 CPU daughterboard
+ *
+ * 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
+
+#include <asm/arch/memory-map.h>
+
+#define CONFIG_AVR32                   1
+#define CONFIG_AT32AP                  1
+#define CONFIG_AT32AP7000              1
+#define CONFIG_ATSTK1006               1
+#define CONFIG_ATSTK1000               1
+
+#define CONFIG_ATSTK1000_EXT_FLASH     1
+
+/*
+ * Timer clock frequency. We're using the CPU-internal COUNT register
+ * for this, so this is equivalent to the CPU core clock frequency
+ */
+#define CFG_HZ                         1000
+
+/*
+ * Set up the PLL to run at 140 MHz, the CPU to run at the PLL
+ * frequency, the HSB and PBB at 1/2, and the PBA to run at 1/4 the
+ * PLL frequency.
+ * (CFG_OSC0_HZ * CFG_PLL0_MUL) / CFG_PLL0_DIV = PLL MHz
+ */
+#define CONFIG_PLL                     1
+#define CFG_POWER_MANAGER              1
+#define CFG_OSC0_HZ                    20000000
+#define CFG_PLL0_DIV                   1
+#define CFG_PLL0_MUL                   7
+#define CFG_PLL0_SUPPRESS_CYCLES       16
+/*
+ * Set the CPU running at:
+ * PLL / (2^CFG_CLKDIV_CPU) = CPU MHz
+ */
+#define CFG_CLKDIV_CPU                 0
+/*
+ * Set the HSB running at:
+ * PLL / (2^CFG_CLKDIV_HSB) = HSB MHz
+ */
+#define CFG_CLKDIV_HSB                 1
+/*
+ * Set the PBA running at:
+ * PLL / (2^CFG_CLKDIV_PBA) = PBA MHz
+ */
+#define CFG_CLKDIV_PBA                 2
+/*
+ * Set the PBB running at:
+ * PLL / (2^CFG_CLKDIV_PBB) = PBB MHz
+ */
+#define CFG_CLKDIV_PBB                 1
+
+/*
+ * The PLLOPT register controls the PLL like this:
+ *   icp = PLLOPT<2>
+ *   ivco = PLLOPT<1:0>
+ *
+ * We want icp=1 (default) and ivco=0 (80-160 MHz) or ivco=2 (150-240MHz).
+ */
+#define CFG_PLL0_OPT                   0x04
+
+#undef CONFIG_USART0
+#define CONFIG_USART1                  1
+#undef CONFIG_USART2
+#undef CONFIG_USART3
+
+/* User serviceable stuff */
+#define CONFIG_DOS_PARTITION           1
+
+#define CONFIG_CMDLINE_TAG             1
+#define CONFIG_SETUP_MEMORY_TAGS       1
+#define CONFIG_INITRD_TAG              1
+
+#define CONFIG_STACKSIZE               (2048)
+
+#define CONFIG_BAUDRATE                        115200
+#define CONFIG_BOOTARGS                                                        \
+       "console=ttyS0 root=mtd3 fbmem=2400k"
+
+#define CONFIG_BOOTCOMMAND                                             \
+       "fsload; bootm $(fileaddr)"
+
+/*
+ * Only interrupt autoboot if <space> is pressed. Otherwise, garbage
+ * data on the serial line may interrupt the boot sequence.
+ */
+#define CONFIG_BOOTDELAY               1
+#define CONFIG_AUTOBOOT                        1
+#define CONFIG_AUTOBOOT_KEYED          1
+#define CONFIG_AUTOBOOT_PROMPT                         \
+       "Press SPACE to abort autoboot in %d seconds\n"
+#define CONFIG_AUTOBOOT_DELAY_STR      "d"
+#define CONFIG_AUTOBOOT_STOP_STR       " "
+
+/*
+ * After booting the board for the first time, new ethernet addresses
+ * should be generated and assigned to the environment variables
+ * "ethaddr" and "eth1addr". This is normally done during production.
+ */
+#define CONFIG_OVERWRITE_ETHADDR_ONCE  1
+#define CONFIG_NET_MULTI               1
+
+/*
+ * BOOTP options
+ */
+#define CONFIG_BOOTP_SUBNETMASK
+#define CONFIG_BOOTP_GATEWAY
+
+
+/*
+ * Command line configuration.
+ */
+#include <config_cmd_default.h>
+
+#define CONFIG_CMD_ASKENV
+#define CONFIG_CMD_DHCP
+#define CONFIG_CMD_EXT2
+#define CONFIG_CMD_FAT
+#define CONFIG_CMD_JFFS2
+#define CONFIG_CMD_MMC
+
+#undef CONFIG_CMD_AUTOSCRIPT
+#undef CONFIG_CMD_FPGA
+#undef CONFIG_CMD_SETGETDCR
+#undef CONFIG_CMD_XIMG
+
+#define CONFIG_ATMEL_USART             1
+#define CONFIG_MACB                    1
+#define CONFIG_PIO2                    1
+#define CFG_NR_PIOS                    5
+#define CFG_HSDRAMC                    1
+#define CONFIG_MMC                     1
+
+#define CFG_DCACHE_LINESZ              32
+#define CFG_ICACHE_LINESZ              32
+
+#define CONFIG_NR_DRAM_BANKS           1
+
+/* External flash on STK1000 */
+#if 0
+#define CFG_FLASH_CFI                  1
+#define CFG_FLASH_CFI_DRIVER           1
+#endif
+
+#define CFG_FLASH_BASE                 0x00000000
+#define CFG_FLASH_SIZE                 0x800000
+#define CFG_MAX_FLASH_BANKS            1
+#define CFG_MAX_FLASH_SECT             135
+
+#define CFG_MONITOR_BASE               CFG_FLASH_BASE
+
+#define CFG_INTRAM_BASE                        INTERNAL_SRAM_BASE
+#define CFG_INTRAM_SIZE                        INTERNAL_SRAM_SIZE
+#define CFG_SDRAM_BASE                 EBI_SDRAM_BASE
+
+#define CFG_ENV_IS_IN_FLASH            1
+#define CFG_ENV_SIZE                   65536
+#define CFG_ENV_ADDR                   (CFG_FLASH_BASE + CFG_FLASH_SIZE - CFG_ENV_SIZE)
+
+#define CFG_INIT_SP_ADDR               (CFG_INTRAM_BASE + CFG_INTRAM_SIZE)
+
+#define CFG_MALLOC_LEN                 (256*1024)
+#define CFG_DMA_ALLOC_LEN              (16384)
+
+/* Allow 4MB for the kernel run-time image */
+#define CFG_LOAD_ADDR                  (EBI_SDRAM_BASE + 0x00400000)
+#define CFG_BOOTPARAMS_LEN             (16 * 1024)
+
+/* Other configuration settings that shouldn't have to change all that often */
+#define CFG_PROMPT                     "U-Boot> "
+#define CFG_CBSIZE                     256
+#define CFG_MAXARGS                    16
+#define CFG_PBSIZE                     (CFG_CBSIZE + sizeof(CFG_PROMPT) + 16)
+#define CFG_LONGHELP                   1
+
+#define CFG_MEMTEST_START              EBI_SDRAM_BASE
+#define CFG_MEMTEST_END                        (CFG_MEMTEST_START + 0x3f00000)
+#define CFG_BAUDRATE_TABLE { 115200, 38400, 19200, 9600, 2400 }
+
+#endif /* __CONFIG_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 0f7bb619ceba2c28467bc186245079379ee60b99..f097e2c2f09042b7a085273b096ef030140bedbc 100644 (file)
@@ -40,6 +40,8 @@
 
 #define CONFIG_BOARD_EARLY_INIT_R
 
+#define CONFIG_HIGH_BATS       1       /* High BATs supported */
+
 /*
  * Serial console configuration
  */
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 d554348021fcfc0ff6be22dd8e04a424ab4689d5..ef50c7cabb7c2b2400b6779c785abb1ce2b6d662 100644 (file)
@@ -31,6 +31,8 @@
 #define CONFIG_MPC5200         1       /* (more precisely an MPC5200 CPU) */
 #define CONFIG_CM5200          1       /* ... on CM5200 platform */
 
+#define CONFIG_HIGH_BATS       1       /* High BATs supported */
+
 /*
  * Supported commands
  */
index 1b30e51a3feac90f81aa29cacd291ed896e86a5c..fffd1fe1fa7866c0896651ce307786f288ef4309 100644 (file)
@@ -50,6 +50,8 @@
 #define BOOTFLAG_COLD          0x01    /* Normal Power-On: Boot from FLASH  */
 #define BOOTFLAG_WARM          0x02    /* Software reboot           */
 
+#define CONFIG_HIGH_BATS       1       /* High BATs supported    */
+
 /*
  * Serial console configuration
  */
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 e5a88977445bd768d3f42d6f8c4d25642d59725b..ad7cf76869a8c8e35e1939f5c833edf0481f4170 100644 (file)
@@ -40,6 +40,8 @@
 
 #define CONFIG_BOARD_EARLY_INIT_R
 
+#define CONFIG_HIGH_BATS       1       /* High BATs supported                  */
+
 /*
  * Serial console configuration
  */
index 4281d73c90b47e370ba103aa44fee04cd559fc52..ec4ed1eeb674191b01effb27aa21c9b98b444e64 100644 (file)
@@ -65,7 +65,8 @@
 
 #define CONFIG_HARD_SPI                1
 #define CONFIG_MXC_SPI         1
-#define CONFIG_MXC_SPI_IFACE   1
+#define CONFIG_DEFAULT_SPI_BUS 1
+#define CONFIG_DEFAULT_SPI_MODE        (SPI_MODE_2 | SPI_CS_HIGH)
 
 #define CONFIG_RTC_MC13783     1
 
index c89f041ee470bf0107cdb341c0d36f4d90b4beb5..6ec92c38c578580c8c001a1c5306c583e8ac48b8 100644 (file)
@@ -40,6 +40,8 @@
 
 #define CONFIG_MISC_INIT_F     1       /* Use misc_init_f()                    */
 
+#define CONFIG_HIGH_BATS       1       /* High BATs supported                  */
+
 /*
  * Serial console configuration
  */
index 980e9fe9cea1e050ad65935d7009c7c3af807cee..c9859270c00ed0de5666f63a9e06dd88dc559b8e 100644 (file)
@@ -41,6 +41,8 @@
 #define BOOTFLAG_COLD          0x01    /* Normal Power-On: Boot from FLASH  */
 #define BOOTFLAG_WARM          0x02    /* Software reboot           */
 
+#define CONFIG_HIGH_BATS       1       /* High BATs supported */
+
 /*
  * Serial console configuration
  */
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 a9c86f9e3f76c3728c84eafef7c0939ac98dfb9d..e4c3f7239be4fbd6bae717a027e49143e4219bfb 100644 (file)
@@ -40,6 +40,8 @@
 #define BOOTFLAG_COLD          0x01    /* Normal Power-On: Boot from FLASH     */
 #define BOOTFLAG_WARM          0x02    /* Software reboot                      */
 
+#define CONFIG_HIGH_BATS       1       /* High BATs supported                  */
+
 /*
  * Serial console configuration
  *
index 5218d9ca97593b7a7a237315b616d284c6882ed0..8dfb9aa8a96f859fc8e61ee2e120188c2220ee6c 100644 (file)
@@ -50,6 +50,8 @@
 #define BOOTFLAG_COLD          0x01    /* Normal Power-On: Boot from FLASH  */
 #define BOOTFLAG_WARM          0x02    /* Software reboot           */
 
+#define CONFIG_HIGH_BATS       1       /* High BATs supported */
+
 /*
  * Serial console configuration
  */
index 1503598166c1be56424ff58db544df138477822f..b6843af3dc6c9f93131e91ce3cc4116045614942 100644 (file)
@@ -35,6 +35,7 @@
 #define CONFIG_MPC5200         1       /* More exactly a MPC5200 */
 #define CONFIG_MOTIONPRO       1       /* ... on Promess Motion-PRO board */
 
+#define CONFIG_HIGH_BATS       1       /* High BATs supported */
 
 /*
  * BOOTP options
index f614e679f9e91c5842215cc2d331d930c3d4497b..a218f7576c7254a3eedfdca926c7e93e745a8a70 100644 (file)
@@ -39,7 +39,7 @@
 #define CONFIG_MPC7448HPC2
 
 #define CONFIG_74xx
-#define CONFIG_750FX           /* this option to enable init of extended BATs */
+#define CONFIG_HIGH_BATS       /* High BATs supported */
 #define CONFIG_ALTIVEC         /* undef to disable */
 
 #define CFG_BOARD_NAME         "MPC7448 HPC II"
index 38b27bb3a776eb24625989ab437b98553ce9ba0d..e0046ec2d38efb8e2066d50a846d0a5270a92e0e 100644 (file)
@@ -35,6 +35,7 @@
 #define BOOTFLAG_COLD          0x01    /* Normal Power-On: Boot from FLASH  */
 #define BOOTFLAG_WARM          0x02    /* Software reboot           */
 #define CFG_CACHELINE_SIZE     32      /* For MPC5xxx CPUs */
+#define CONFIG_HIGH_BATS       1       /* High BATs supported */
 
 /*
  * Command line configuration.
index 2ea48a6da9ace3d03cbf40f78c3c705a386aecf7..37ba872a43923249c8149aeb3236fd639187286d 100644 (file)
@@ -62,7 +62,8 @@
 
 #define CONFIG_HARD_SPI                1
 #define CONFIG_MXC_SPI         1
-#define CONFIG_MXC_SPI_IFACE   1       /* Default SPI interface number */
+#define CONFIG_DEFAULT_SPI_BUS 1
+#define CONFIG_DEFAULT_SPI_MODE        (SPI_MODE_2 | SPI_CS_HIGH)
 
 #define CONFIG_RTC_MC13783     1
 
index 8dde1ef3916e7cba3d7e5c1207e8449b1c192532..88bdb03e67af93694e92dec1bb897cda75aa244d 100644 (file)
@@ -37,6 +37,8 @@
 #define BOOTFLAG_COLD          0x01    /* Normal Power-On: Boot from FLASH  */
 #define BOOTFLAG_WARM          0x02    /* Software reboot           */
 
+#define CONFIG_HIGH_BATS       1       /* High BATs supported */
+
 /*
  * Serial console configuration
  */
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 0dac5161ba74bc6214f6dfd88814d27e85a67f6b..0913b14a4ca9f22adef465244d4b4ca9abe8b03c 100644 (file)
@@ -42,6 +42,7 @@
 
 #if defined (CONFIG_P3M750)
 #define CONFIG_750FX                   /* 750GL/GX/FX                  */
+#define CONFIG_HIGH_BATS               /* High BATs supported          */
 #define CFG_BOARD_NAME         "P3M750"
 #define CFG_BUS_HZ             100000000
 #define CFG_BUS_CLK            CFG_BUS_HZ
index 2ce39c913c831a2e873ca04ddef34a4b07b727ed..c065d3328c97be28156e6d2e38ef6e9114a03cde 100644 (file)
@@ -49,6 +49,7 @@
 #define BOOTFLAG_COLD          0x01    /* Normal Power-On: Boot from FLASH  */
 #define BOOTFLAG_WARM          0x02    /* Software reboot           */
 
+#define CONFIG_HIGH_BATS       1       /* High BATs supported */
 /*
  * Serial console configuration
  */
diff --git a/include/configs/quad100hd.h b/include/configs/quad100hd.h
new file mode 100644 (file)
index 0000000..622a5d4
--- /dev/null
@@ -0,0 +1,298 @@
+/*
+ * (C) Copyright 2008
+ * Gary Jennejohn, DENX Software Engineering GmbH, garyj@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
+ */
+
+/************************************************************************
+ * quad100hd.h - configuration for Quad100hd board
+ ***********************************************************************/
+#ifndef __CONFIG_H
+#define __CONFIG_H
+
+/*-----------------------------------------------------------------------
+ * High Level Configuration Options
+ *----------------------------------------------------------------------*/
+#define CONFIG_QUAD100HD       1               /* Board is Quad100hd   */
+#define CONFIG_4xx             1               /* ... PPC4xx family    */
+#define CONFIG_405EP           1               /* Specifc 405EP support*/
+
+#define CONFIG_SYS_CLK_FREQ     33333333 /* external frequency to pll   */
+
+#define CONFIG_BOARD_EARLY_INIT_F 1            /* Call board_early_init_f */
+
+#define PLLMR0_DEFAULT         PLLMR0_266_133_66 /* no PCI */
+#define PLLMR1_DEFAULT         PLLMR1_266_133_66 /* no PCI */
+
+/* the environment is in the EEPROM by default */
+#define CFG_ENV_IS_IN_EEPROM
+#undef CFG_ENV_IS_IN_FLASH
+
+#define CONFIG_NET_MULTI       1
+#define CONFIG_HAS_ETH1                1
+#define CONFIG_MII             1       /* MII PHY management           */
+#define CONFIG_PHY_ADDR                0x01    /* PHY address                  */
+#define CFG_RX_ETH_BUFFER      16      /* Number of ethernet rx buffers & descriptors */
+#define CONFIG_PHY_RESET       1
+#define CONFIG_PHY_RESET_DELAY 300     /* PHY RESET recovery delay     */
+
+/*
+ * Command line configuration.
+ */
+#include <config_cmd_default.h>
+
+#undef CONFIG_CMD_ASKENV
+#undef CONFIG_CMD_CACHE
+#define CONFIG_CMD_DHCP
+#undef CONFIG_CMD_DIAG
+#define CONFIG_CMD_EEPROM
+#undef CONFIG_CMD_ELF
+#define CONFIG_CMD_I2C
+#undef CONFIG_CMD_IRQ
+#define CONFIG_CMD_JFFS2
+#undef CONFIG_CMD_LOG
+#undef CONFIG_CMD_MII
+#define CONFIG_CMD_NAND
+#undef CONFIG_CMD_PING
+#define CONFIG_CMD_REGINFO
+
+#undef CONFIG_WATCHDOG                 /* watchdog disabled            */
+
+/*-----------------------------------------------------------------------
+ * SDRAM
+ *----------------------------------------------------------------------*/
+/*
+ * SDRAM configuration (please see cpu/ppc/sdram.[ch])
+ */
+#define CONFIG_SDRAM_BANK0  1
+#define CFG_SDRAM_SIZE      0x02000000      /* 32 MB */
+
+/* FIX! SDRAM timings used in datasheet */
+#define CFG_SDRAM_CL            3       /* CAS latency */
+#define CFG_SDRAM_tRP           20      /* PRECHARGE command period */
+#define CFG_SDRAM_tRC           66      /* ACTIVE-to-ACTIVE command period */
+#define CFG_SDRAM_tRCD          20      /* ACTIVE-to-READ delay */
+#define CFG_SDRAM_tRFC          66      /* Auto refresh period */
+
+/*
+ * JFFS2
+ */
+#define CFG_JFFS2_FIRST_BANK    0
+#ifdef  CFG_KERNEL_IN_JFFS2
+#define CFG_JFFS2_FIRST_SECTOR  0   /* JFFS starts at block 0 */
+#else /* kernel not in JFFS */
+#define CFG_JFFS2_FIRST_SECTOR  8   /* block 0-7 is kernel (1MB = 8 sectors) */
+#endif
+#define CFG_JFFS2_NUM_BANKS     1
+
+/*-----------------------------------------------------------------------
+ * Serial Port
+ *----------------------------------------------------------------------*/
+#undef CFG_EXT_SERIAL_CLOCK                    /* external serial clock */
+#define CFG_BASE_BAUD          691200
+#define CONFIG_BAUDRATE                115200
+#define CONFIG_SERIAL_MULTI
+
+/* The following table includes the supported baudrates */
+#define CFG_BAUDRATE_TABLE     \
+       {300, 600, 1200, 2400, 4800, 9600, 19200, 38400, 57600, 115200, 230400}
+
+/*-----------------------------------------------------------------------
+ * 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_info (bd_t) */
+
+#define CFG_HZ                 1000    /* decrementer freq: 1 ms ticks */
+
+#define CONFIG_LOADS_ECHO      1       /* echo on for serial download  */
+#define CFG_LOADS_BAUD_CHANGE  1       /* allow baudrate change        */
+
+#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
+ *----------------------------------------------------------------------*/
+#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_EEPROM_ADDR    0x50            /* base address */
+#define CFG_I2C_EEPROM_ADDR_LEN        2               /* bytes of address */
+
+#define CFG_EEPROM_PAGE_WRITE_BITS     5       /* 8 byte write page size */
+#define CFG_EEPROM_PAGE_WRITE_DELAY_MS 10      /* and takes up to 10 msec */
+#define CFG_EEPROM_SIZE                        0x2000
+
+/*-----------------------------------------------------------------------
+ * 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         0xFFC00000
+#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       (TEXT_BASE)
+
+/*
+ * 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_FLASH_CFI                  /* The flash is CFI compatible  */
+#define        CFG_FLASH_CFI_DRIVER
+
+#define CFG_FLASH_BANKS_LIST   { CFG_FLASH_BASE }
+
+#define CFG_MAX_FLASH_BANKS    1       /* max number of memory banks   */
+#define CFG_MAX_FLASH_SECT     128     /* max number of sectors on one chip */
+
+#define CFG_FLASH_ERASE_TOUT   120000  /* Timeout for Flash Erase (in ms) */
+#define CFG_FLASH_WRITE_TOUT   500     /* Timeout for Flash Write (in ms) */
+
+#define CFG_FLASH_USE_BUFFER_WRITE 1   /* use buffered writes (20x faster) */
+#define CFG_FLASH_INCREMENT      0       /* there is only one bank         */
+
+#define CFG_FLASH_EMPTY_INFO           /* print 'E' for empty sector on flinfo */
+#define CFG_FLASH_QUIET_TEST   1       /* don't warn upon unknown flash */
+
+#ifdef CFG_ENV_IS_IN_FLASH
+#define CFG_ENV_SECT_SIZE      0x10000 /* size of one complete sector  */
+/* the environment is located before u-boot */
+#define CFG_ENV_ADDR           (TEXT_BASE - CFG_ENV_SECT_SIZE)
+
+/* Address and size of Redundant Environment Sector    */
+#define CFG_ENV_ADDR_REDUND    (CFG_ENV_ADDR - CFG_ENV_SECT_SIZE)
+#define CFG_ENV_SIZE_REDUND    (CFG_ENV_SECT_SIZE)
+#endif
+
+#ifdef CFG_ENV_IS_IN_EEPROM
+#define CFG_ENV_SIZE           0x400           /* Size of Environment vars */
+#define CFG_ENV_OFFSET         0x00000000
+#define CFG_ENABLE_CRC_16      1       /* Intrinsyc formatting used crc16 */
+#endif
+
+/* partly from PPCBoot */
+/* NAND */
+#define CONFIG_NAND
+#ifdef CONFIG_NAND
+#define CFG_NAND_BASE   0x60000000
+#define CFG_NAND_CS    10   /* our CS is GPIO10 */
+#define CFG_NAND_RDY   23   /* our RDY is GPIO23 */
+#define CFG_NAND_CE    24   /* our CE is GPIO24  */
+#define CFG_NAND_CLE   31   /* our CLE is GPIO31 */
+#define CFG_NAND_ALE   30   /* our ALE is GPIO30 */
+#define NAND_MAX_CHIPS 1
+#define CFG_MAX_NAND_DEVICE    1
+#endif
+
+/*-----------------------------------------------------------------------
+ * Definitions for initial stack pointer and data area (in data cache)
+ */
+/* use on chip memory (OCM) for temperary stack until sdram is tested */
+/* see ./cpu/ppc4xx/start.S */
+#define CFG_TEMP_STACK_OCM     1
+
+/* On Chip Memory location */
+#define CFG_OCM_DATA_ADDR      0xF8000000
+#define CFG_OCM_DATA_SIZE      0x1000
+#define CFG_INIT_RAM_ADDR      CFG_OCM_DATA_ADDR /* inside of OCM              */
+#define CFG_INIT_RAM_END       CFG_OCM_DATA_SIZE /* End of used area in RAM    */
+
+#define CFG_GBL_DATA_SIZE      128  /* size in bytes reserved for initial data */
+#define CFG_GBL_DATA_OFFSET    (CFG_INIT_RAM_END - CFG_GBL_DATA_SIZE)
+#define CFG_INIT_SP_OFFSET      CFG_GBL_DATA_OFFSET
+
+/*-----------------------------------------------------------------------
+ * External Bus Controller (EBC) Setup
+ * Taken from PPCBoot board/icecube/icecube.h
+ */
+
+/* see ./cpu/ppc4xx/cpu_init.c ./cpu/ppc4xx/ndfc.c */
+#define CFG_EBC_PB0AP          0x04002480
+/* AMD NOR flash - this corresponds to FLASH_BASE so may be correct */
+#define CFG_EBC_PB0CR          0xFFC5A000
+#define CFG_EBC_PB1AP           0x04005480
+#define CFG_EBC_PB1CR           0x60018000
+#define CFG_EBC_PB2AP           0x00000000
+#define CFG_EBC_PB2CR           0x00000000
+#define CFG_EBC_PB3AP           0x00000000
+#define CFG_EBC_PB3CR           0x00000000
+#define CFG_EBC_PB4AP           0x00000000
+#define CFG_EBC_PB4CR           0x00000000
+
+/*-----------------------------------------------------------------------
+ * Definitions for GPIO setup (PPC405EP specific)
+ *
+ * Taken in part from PPCBoot board/icecube/icecube.h
+ */
+/* see ./cpu/ppc4xx/cpu_init.c ./cpu/ppc4xx/start.S */
+#define CFG_GPIO0_OSRH         0x55555550
+#define CFG_GPIO0_OSRL         0x00000110
+#define CFG_GPIO0_ISR1H                0x00000000
+#define CFG_GPIO0_ISR1L                0x15555445
+#define CFG_GPIO0_TSRH         0x00000000
+#define CFG_GPIO0_TSRL         0x00000000
+#define CFG_GPIO0_TCR          0xFFFF8097
+#define CFG_GPIO0_ODR          0x00000000
+
+#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
+
+/* ENVIRONMENT VARS */
+
+#define CONFIG_IPADDR          192.168.1.67
+#define CONFIG_SERVERIP                192.168.1.50
+#define CONFIG_GATEWAYIP       192.168.1.1
+#define CONFIG_NETMASK         255.255.255.0
+#define CONFIG_LOADADDR                300000
+#define CONFIG_BOOTDELAY       5       /* autoboot after 5 seconds */
+
+/* pass open firmware flat tree */
+#define CONFIG_OF_LIBFDT       1
+
+#endif /* __CONFIG_H */
index 0ebc674a69a6d2adeba6e88a1472dcd01cd96163..74815567ff922a4daf7422c48b9e716ac611cb9f 100644 (file)
 
 #define CFG_HID2 HID2_HBE
 
+#define CONFIG_HIGH_BATS       1       /* High BATs supported */
+
 /* DDR @ 0x00000000 */
 #define CFG_IBAT0L     (CFG_SDRAM_BASE | BATL_PP_10 | BATL_MEMCOHERENCE)
 #define CFG_IBAT0U     (CFG_SDRAM_BASE | BATU_BL_256M | BATU_VS | BATU_VP)
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 4578cae7d666c2fae3c6445ff435c54628334882..3e47eb88a7cba31331ab87eacda42d18197f271c 100644 (file)
@@ -42,6 +42,8 @@
 #define BOOTFLAG_COLD          0x01    /* Normal Power-On: Boot from FLASH  */
 #define BOOTFLAG_WARM          0x02    /* Software reboot           */
 
+#define CONFIG_HIGH_BATS       1       /* High BATs supported */
+
 /*
  * Serial console configuration
  */
index 23ed87f33828bc0d6fd423eb50c9a5059c80cc4a..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.
  */
 #define CFG_PCI_PHYS           0x80000000      /* 1G PCI TLB */
 
-
+/* PCI is clocked by the external source at 33 MHz */
+#define CONFIG_PCI_CLK_FREQ    33000000
 #define CFG_PCI1_MEM_BASE      0x80000000
 #define CFG_PCI1_MEM_PHYS      CFG_PCI1_MEM_BASE
 #define CFG_PCI1_MEM_SIZE      0x20000000      /* 512M                 */
 
 #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 c62b9775c697f57e611234373c0ea6d8ddd3ee8a..18f553373709cc448c1c6cfdba8cc97d67cfe80b 100644 (file)
@@ -31,6 +31,8 @@
 #define CONFIG_MPC8220         1
 #define CONFIG_SORCERY         1       /* Sorcery board */
 
+#define CONFIG_HIGH_BATS       1       /* High BATs supported */
+
 /* Input clock running at 60Mhz, read Hid1 for the CPU multiplier to
    determine the CPU speed. */
 #define CFG_MPC8220_CLKIN      60000000 /* ... running at 60MHz */
index 49213dc67ade3c71ee6c46724b87706fdc89d7dc..69d2d67ab1cdbfe4b45b66d682e48cfb7bc01e39 100644 (file)
@@ -44,6 +44,8 @@
 #define BOOTFLAG_COLD          0x01    /* Normal Power-On: Boot from FLASH  */
 #define BOOTFLAG_WARM          0x02    /* Software reboot           */
 
+#define CONFIG_HIGH_BATS       1       /* High BATs supported */
+
 /*
  * Serial console configuration
  */
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 dc1d7e1b3d421813c3cc7205a8cbb99db108ebb6..042750e2fe9a98f5623b0e833d9e501b912e45a2 100644 (file)
@@ -40,6 +40,8 @@
 
 #define CONFIG_BOARD_EARLY_INIT_R
 
+#define CONFIG_HIGH_BATS       1       /* High BATs supported                  */
+
 /*
  * Serial console configuration
  */
index e24d6f77ae6c004f13c6548c01b3babd0ead344f..c2035225526092a941654ba85579acee301006b9 100644 (file)
@@ -46,6 +46,8 @@
 #define BOOTFLAG_COLD          0x01    /* Normal Power-On: Boot from FLASH  */
 #define BOOTFLAG_WARM          0x02    /* Software reboot */
 
+#define CONFIG_HIGH_BATS       1       /* High BATs supported */
+
 /*
  * Serial console configuration
  */
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 8a4273cce15d040af62b9221c741807104c2c7d0..44ac8ef8c7049c602907091b01d8e9620932ccf5 100644 (file)
@@ -155,7 +155,35 @@ typedef struct vidinfo {
 
        u_char  vl_bpix;        /* Bits per pixel, 0 = 1 */
 } vidinfo_t;
-#endif /* CONFIG_MPC823, CONFIG_PXA250 or CONFIG_MCC200 */
+
+#elif defined(CONFIG_ATMEL_LCD)
+
+typedef struct vidinfo {
+       u_long vl_col;          /* Number of columns (i.e. 640) */
+       u_long vl_row;          /* Number of rows (i.e. 480) */
+       u_long vl_clk;  /* pixel clock in ps    */
+
+       /* LCD configuration register */
+       u_long vl_sync;         /* Horizontal / vertical sync */
+       u_long vl_bpix;         /* Bits per pixel, 0 = 1, 1 = 2, 2 = 4, 3 = 8, 4 = 16 */
+       u_long vl_tft;          /* 0 = passive, 1 = TFT */
+
+       /* Horizontal control register. */
+       u_long vl_hsync_len;    /* Length of horizontal sync */
+       u_long vl_left_margin;  /* Time from sync to picture */
+       u_long vl_right_margin; /* Time from picture to sync */
+
+       /* Vertical control register. */
+       u_long vl_vsync_len;    /* Length of vertical sync */
+       u_long vl_upper_margin; /* Time from sync to picture */
+       u_long vl_lower_margin; /* Time from picture to sync */
+
+       u_long  mmio;           /* Memory mapped registers */
+} vidinfo_t;
+
+extern vidinfo_t panel_info;
+
+#endif /* CONFIG_MPC823, CONFIG_PXA250 or CONFIG_MCC200 or CONFIG_ATMEL_LCD */
 
 /* Video functions */
 
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 4cc4a7d1bb444c800d4422bb7ac1cbba76b40a45..e2a25a60d849736478cbd92af60d8c67c708b072 100644 (file)
@@ -385,6 +385,10 @@ struct nand_manufacturers {
 extern struct nand_flash_dev nand_flash_ids[];
 extern struct nand_manufacturers nand_manuf_ids[];
 
+#ifndef NAND_MAX_CHIPS
+#define NAND_MAX_CHIPS 8
+#endif
+
 /**
  * struct nand_bbt_descr - bad block table descriptor
  * @options:   options for this descriptor
index d06d208844264e7b29e22f5a5ebc7b088c9e37ac..ae7908ca3d20ca34e83200b51560c19fd03fc69a 100644 (file)
@@ -58,6 +58,7 @@ int drv_logbuff_init (void);
 void logbuff_init_ptrs (void);
 void logbuff_log(char *msg);
 void logbuff_reset (void);
+unsigned long logbuffer_base (void);
 
 #endif /* CONFIG_LOGBUFFER */
 
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 bd1831ea6d651a3a2c58f9314b84fa1e44cddeec..4449f987bf7ffb22adf79208b2b9b31866a3041e 100644 (file)
@@ -14,6 +14,8 @@
 #ifndef __UBOOT_ONENAND_H
 #define __UBOOT_ONENAND_H
 
+#include <linux/types.h>
+
 struct kvec {
        void *iov_base;
        size_t iov_len;
@@ -22,6 +24,9 @@ struct kvec {
 typedef int spinlock_t;
 typedef int wait_queue_head_t;
 
+struct mtd_info;
+struct erase_info;
+
 /* Functions */
 extern void onenand_init(void);
 extern int onenand_read(struct mtd_info *mtd, loff_t from, size_t len,
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 3a55a68c4d1c25a0b8f2aed23e5b442440128c3c..7744c2e36b057c02e9d22be42be6a6dd6a1f330d 100644 (file)
 #define        SPI_MODE_1      (0|SPI_CPHA)
 #define        SPI_MODE_2      (SPI_CPOL|0)
 #define        SPI_MODE_3      (SPI_CPOL|SPI_CPHA)
-#define        SPI_CS_HIGH     0x04                    /* chipselect active high? */
+#define        SPI_CS_HIGH     0x04                    /* CS active high */
 #define        SPI_LSB_FIRST   0x08                    /* per-word bits-on-wire */
 #define        SPI_3WIRE       0x10                    /* SI/SO signals shared */
 #define        SPI_LOOP        0x20                    /* loopback mode */
 
-/*
- * The function call pointer type used to drive the chip select.
- */
-typedef void (*spi_chipsel_type)(int cs);
+/* SPI transfer flags */
+#define SPI_XFER_BEGIN 0x01                    /* Assert CS before transfer */
+#define SPI_XFER_END   0x02                    /* Deassert CS after transfer */
 
+/*-----------------------------------------------------------------------
+ * Representation of a SPI slave, i.e. what we're communicating with.
+ *
+ * Drivers are expected to extend this with controller-specific data.
+ *
+ *   bus:      ID of the bus that the slave is attached to.
+ *   cs:       ID of the chip select connected to the slave.
+ */
+struct spi_slave {
+       unsigned int    bus;
+       unsigned int    cs;
+};
 
 /*-----------------------------------------------------------------------
  * Initialization, must be called once on start up.
+ *
+ * TODO: I don't think we really need this.
  */
 void spi_init(void);
 
+/*-----------------------------------------------------------------------
+ * Set up communications parameters for a SPI slave.
+ *
+ * This must be called once for each slave. Note that this function
+ * usually doesn't touch any actual hardware, it only initializes the
+ * contents of spi_slave so that the hardware can be easily
+ * initialized later.
+ *
+ *   bus:     Bus ID of the slave chip.
+ *   cs:      Chip select ID of the slave chip on the specified bus.
+ *   max_hz:  Maximum SCK rate in Hz.
+ *   mode:    Clock polarity, clock phase and other parameters.
+ *
+ * Returns: A spi_slave reference that can be used in subsequent SPI
+ * calls, or NULL if one or more of the parameters are not supported.
+ */
+struct spi_slave *spi_setup_slave(unsigned int bus, unsigned int cs,
+               unsigned int max_hz, unsigned int mode);
+
+/*-----------------------------------------------------------------------
+ * Free any memory associated with a SPI slave.
+ *
+ *   slave:    The SPI slave
+ */
+void spi_free_slave(struct spi_slave *slave);
+
+/*-----------------------------------------------------------------------
+ * Claim the bus and prepare it for communication with a given slave.
+ *
+ * This must be called before doing any transfers with a SPI slave. It
+ * will enable and initialize any SPI hardware as necessary, and make
+ * sure that the SCK line is in the correct idle state. It is not
+ * allowed to claim the same bus for several slaves without releasing
+ * the bus in between.
+ *
+ *   slave:    The SPI slave
+ *
+ * Returns: 0 if the bus was claimed successfully, or a negative value
+ * if it wasn't.
+ */
+int spi_claim_bus(struct spi_slave *slave);
+
+/*-----------------------------------------------------------------------
+ * Release the SPI bus
+ *
+ * This must be called once for every call to spi_claim_bus() after
+ * all transfers have finished. It may disable any SPI hardware as
+ * appropriate.
+ *
+ *   slave:    The SPI slave
+ */
+void spi_release_bus(struct spi_slave *slave);
 
 /*-----------------------------------------------------------------------
  * SPI transfer
@@ -60,28 +125,67 @@ void spi_init(void);
  * input data overwrites the output data (since both are buffered by
  * temporary variables, this is OK).
  *
- * If the chipsel() function is not NULL, it is called with a parameter
- * of '1' (chip select active) at the start of the transfer and again with
- * a parameter of '0' at the end of the transfer.
- *
- * If the chipsel() function _is_ NULL, it the responsibility of the
- * caller to make the appropriate chip select active before calling
- * spi_xfer() and making it inactive after spi_xfer() returns.
- *
  * spi_xfer() interface:
- *   chipsel: Routine to call to set/clear the chip select:
- *              if chipsel is NULL, it is not used.
- *              if(cs),  make the chip select active (typically '0').
- *              if(!cs), make the chip select inactive (typically '1').
- *   dout:    Pointer to a string of bits to send out.  The bits are
- *              held in a byte array and are sent MSB first.
- *   din:     Pointer to a string of bits that will be filled in.
- *   bitlen:  How many bits to write and read.
+ *   slave:    The SPI slave which will be sending/receiving the data.
+ *   bitlen:   How many bits to write and read.
+ *   dout:     Pointer to a string of bits to send out.  The bits are
+ *             held in a byte array and are sent MSB first.
+ *   din:      Pointer to a string of bits that will be filled in.
+ *   flags:    A bitwise combination of SPI_XFER_* flags.
  *
  *   Returns: 0 on success, not 0 on failure
  */
-int spi_xfer(spi_chipsel_type chipsel, int bitlen, uchar *dout, uchar *din);
+int  spi_xfer(struct spi_slave *slave, unsigned int bitlen, const void *dout,
+               void *din, unsigned long flags);
+
+/*-----------------------------------------------------------------------
+ * Determine if a SPI chipselect is valid.
+ * This function is provided by the board if the low-level SPI driver
+ * needs it to determine if a given chipselect is actually valid.
+ *
+ * Returns: 1 if bus:cs identifies a valid chip on this board, 0
+ * otherwise.
+ */
+int  spi_cs_is_valid(unsigned int bus, unsigned int cs);
+
+/*-----------------------------------------------------------------------
+ * Activate a SPI chipselect.
+ * This function is provided by the board code when using a driver
+ * that can't control its chipselects automatically (e.g.
+ * common/soft_spi.c). When called, it should activate the chip select
+ * to the device identified by "slave".
+ */
+void spi_cs_activate(struct spi_slave *slave);
+
+/*-----------------------------------------------------------------------
+ * Deactivate a SPI chipselect.
+ * This function is provided by the board code when using a driver
+ * that can't control its chipselects automatically (e.g.
+ * common/soft_spi.c). When called, it should deactivate the chip
+ * select to the device identified by "slave".
+ */
+void spi_cs_deactivate(struct spi_slave *slave);
+
+/*-----------------------------------------------------------------------
+ * Write 8 bits, then read 8 bits.
+ *   slave:    The SPI slave we're communicating with
+ *   byte:     Byte to be written
+ *
+ * Returns: The value that was read, or a negative value on error.
+ *
+ * TODO: This function probably shouldn't be inlined.
+ */
+static inline int spi_w8r8(struct spi_slave *slave, unsigned char byte)
+{
+       unsigned char dout[2];
+       unsigned char din[2];
+       int ret;
+
+       dout[0] = byte;
+       dout[1] = 0;
 
-int spi_select(unsigned int bus, unsigned int dev, unsigned long mode);
+       ret = spi_xfer(slave, 16, dout, din, SPI_XFER_BEGIN | SPI_XFER_END);
+       return ret < 0 ? ret : din[1];
+}
 
 #endif /* _SPI_H_ */
diff --git a/include/spi_flash.h b/include/spi_flash.h
new file mode 100644 (file)
index 0000000..de4f174
--- /dev/null
@@ -0,0 +1,70 @@
+/*
+ * Interface to SPI flash
+ *
+ * Copyright (C) 2008 Atmel Corporation
+ *
+ * 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
+ * version 2 as published by the Free Software Foundation.
+ *
+ * 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 _SPI_FLASH_H_
+#define _SPI_FLASH_H_
+
+#include <spi.h>
+
+struct spi_flash_region {
+       unsigned int    count;
+       unsigned int    size;
+};
+
+struct spi_flash {
+       struct spi_slave *spi;
+
+       const char      *name;
+
+       u32             size;
+
+       int             (*read)(struct spi_flash *flash, u32 offset,
+                               size_t len, void *buf);
+       int             (*write)(struct spi_flash *flash, u32 offset,
+                               size_t len, const void *buf);
+       int             (*erase)(struct spi_flash *flash, u32 offset,
+                               size_t len);
+};
+
+struct spi_flash *spi_flash_probe(unsigned int bus, unsigned int cs,
+               unsigned int max_hz, unsigned int spi_mode);
+void spi_flash_free(struct spi_flash *flash);
+
+static inline int spi_flash_read(struct spi_flash *flash, u32 offset,
+               size_t len, void *buf)
+{
+       return flash->read(flash, offset, len, buf);
+}
+
+static inline int spi_flash_write(struct spi_flash *flash, u32 offset,
+               size_t len, const void *buf)
+{
+       return flash->write(flash, offset, len, buf);
+}
+
+static inline int spi_flash_erase(struct spi_flash *flash, u32 offset,
+               size_t len)
+{
+       return flash->erase(flash, offset, len);
+}
+
+#endif /* _SPI_FLASH_H_ */
index 67506b35e1ec6fbac0d00ee000341dc97c345414..80b149b534aac8b40931acad416bd3cac0acd509 100644 (file)
@@ -45,6 +45,8 @@
 #include <version.h>
 #include <net.h>
 #include <serial.h>
+#include <nand.h>
+#include <onenand_uboot.h>
 
 #ifdef CONFIG_DRIVER_SMC91111
 #include "../drivers/net/smc91111.h"
 
 DECLARE_GLOBAL_DATA_PTR;
 
-#if defined(CONFIG_CMD_NAND)
-void nand_init (void);
-#endif
-
-#if defined(CONFIG_CMD_ONENAND)
-void onenand_init(void);
-#endif
-
 ulong monitor_flash_len;
 
 #ifdef CONFIG_HAS_DATAFLASH
@@ -121,6 +115,20 @@ void *sbrk (ptrdiff_t increment)
        return ((void *) old);
 }
 
+char *strmhz(char *buf, long hz)
+{
+       long l, n;
+       long m;
+
+       n = hz / 1000000L;
+       l = sprintf (buf, "%ld", n);
+       m = (hz % 1000000L) / 1000L;
+       if (m != 0)
+               sprintf (buf + l, ".%03ld", m);
+       return (buf);
+}
+
+
 /************************************************************************
  * Coloured LED functionality
  ************************************************************************
@@ -279,7 +287,7 @@ void start_armboot (void)
 {
        init_fnc_t **init_fnc_ptr;
        char *s;
-#ifndef CFG_NO_FLASH
+#if !defined(CFG_NO_FLASH) || defined (CONFIG_VFD) || defined(CONFIG_LCD)
        ulong size;
 #endif
 #if defined(CONFIG_VFD) || defined(CONFIG_LCD)
@@ -323,16 +331,19 @@ void start_armboot (void)
 #endif /* CONFIG_VFD */
 
 #ifdef CONFIG_LCD
-#      ifndef PAGE_SIZE
-#        define PAGE_SIZE 4096
-#      endif
-       /*
-        * reserve memory for LCD display (always full pages)
-        */
-       /* bss_end is defined in the board-specific linker script */
-       addr = (_bss_end + (PAGE_SIZE - 1)) & ~(PAGE_SIZE - 1);
-       size = lcd_setmem (addr);
-       gd->fb_base = addr;
+       /* board init may have inited fb_base */
+       if (!gd->fb_base) {
+#              ifndef PAGE_SIZE
+#                define PAGE_SIZE 4096
+#              endif
+               /*
+                * reserve memory for LCD display (always full pages)
+                */
+               /* bss_end is defined in the board-specific linker script */
+               addr = (_bss_end + (PAGE_SIZE - 1)) & ~(PAGE_SIZE - 1);
+               size = lcd_setmem (addr);
+               gd->fb_base = addr;
+       }
 #endif /* CONFIG_LCD */
 
        /* armboot_start is defined in the board-specific linker script */
index dc3b09b42f95cf0b3dde2eaac8c55fc2f5532846..79e3c675a92333ef35f0ac51340cd13af6d3ba76 100644 (file)
@@ -27,7 +27,7 @@
         *
         * Returns b in r12
         */
-       .text
+       .section .text.memset, "ax", @progbits
 
        .global memset
        .type   memset, @function
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 1645f2c7e0c5cb55eed90d7d418ec72139a39ab3..532550b603b1d1a8c99be23934c006f2681c83d6 100644 (file)
@@ -28,6 +28,8 @@
 #include <version.h>
 #include <net.h>
 #include <environment.h>
+#include <nand.h>
+#include <spi.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -416,6 +418,17 @@ void board_init_r (gd_t *id, ulong dest_addr)
        }
 #endif
 
+#ifdef CONFIG_CMD_NAND
+       puts ("NAND:  ");
+       nand_init ();           /* go init the NAND */
+#endif
+
+#ifdef CONFIG_CMD_SPI
+       puts ("SPI:   ");
+       spi_init ();            /* go init the SPI */
+       puts ("ready\n");
+#endif
+
 #if defined(CONFIG_MISC_INIT_R)
        /* miscellaneous platform dependent initialisations */
        misc_init_r ();
index 912efa72b4bda811973fa85849dae3d0b2ef884b..8546333868de00792ae91296ed235a593b0372bc 100644 (file)
 int write_bat (ppc_bat_t bat, unsigned long upper, unsigned long lower)
 {
        switch (bat) {
+       case DBAT0:
+               mtspr (DBAT0L, lower);
+               mtspr (DBAT0U, upper);
+               break;
        case IBAT0:
                mtspr (IBAT0L, lower);
                mtspr (IBAT0U, upper);
                break;
-
+       case DBAT1:
+               mtspr (DBAT1L, lower);
+               mtspr (DBAT1U, upper);
+               break;
        case IBAT1:
                mtspr (IBAT1L, lower);
                mtspr (IBAT1U, upper);
                break;
-
+       case DBAT2:
+               mtspr (DBAT2L, lower);
+               mtspr (DBAT2U, upper);
+               break;
        case IBAT2:
                mtspr (IBAT2L, lower);
                mtspr (IBAT2U, upper);
                break;
-
+       case DBAT3:
+               mtspr (DBAT3L, lower);
+               mtspr (DBAT3U, upper);
+               break;
        case IBAT3:
                mtspr (IBAT3L, lower);
                mtspr (IBAT3U, upper);
                break;
-
-       case DBAT0:
-               mtspr (DBAT0L, lower);
-               mtspr (DBAT0U, upper);
+#ifdef CONFIG_HIGH_BATS
+       case DBAT4:
+               mtspr (DBAT4L, lower);
+               mtspr (DBAT4U, upper);
                break;
-
-       case DBAT1:
-               mtspr (DBAT1L, lower);
-               mtspr (DBAT1U, upper);
+       case IBAT4:
+               mtspr (IBAT4L, lower);
+               mtspr (IBAT4U, upper);
                break;
-
-       case DBAT2:
-               mtspr (DBAT2L, lower);
-               mtspr (DBAT2U, upper);
+       case DBAT5:
+               mtspr (DBAT5L, lower);
+               mtspr (DBAT5U, upper);
                break;
-
-       case DBAT3:
-               mtspr (DBAT3L, lower);
-               mtspr (DBAT3U, upper);
+       case IBAT5:
+               mtspr (IBAT5L, lower);
+               mtspr (IBAT5U, upper);
                break;
-
+       case DBAT6:
+               mtspr (DBAT6L, lower);
+               mtspr (DBAT6U, upper);
+               break;
+       case IBAT6:
+               mtspr (IBAT6L, lower);
+               mtspr (IBAT6U, upper);
+               break;
+       case DBAT7:
+               mtspr (DBAT7L, lower);
+               mtspr (DBAT7U, upper);
+               break;
+       case IBAT7:
+               mtspr (IBAT7L, lower);
+               mtspr (IBAT7U, upper);
+               break;
+#endif
        default:
                return (-1);
        }
@@ -82,46 +108,72 @@ int read_bat (ppc_bat_t bat, unsigned long *upper, unsigned long *lower)
        unsigned long register l;
 
        switch (bat) {
+       case DBAT0:
+               l = mfspr (DBAT0L);
+               u = mfspr (DBAT0U);
+               break;
        case IBAT0:
                l = mfspr (IBAT0L);
                u = mfspr (IBAT0U);
                break;
-
+       case DBAT1:
+               l = mfspr (DBAT1L);
+               u = mfspr (DBAT1U);
+               break;
        case IBAT1:
                l = mfspr (IBAT1L);
                u = mfspr (IBAT1U);
                break;
-
+       case DBAT2:
+               l = mfspr (DBAT2L);
+               u = mfspr (DBAT2U);
+               break;
        case IBAT2:
                l = mfspr (IBAT2L);
                u = mfspr (IBAT2U);
                break;
-
+       case DBAT3:
+               l = mfspr (DBAT3L);
+               u = mfspr (DBAT3U);
+               break;
        case IBAT3:
                l = mfspr (IBAT3L);
                u = mfspr (IBAT3U);
                break;
-
-       case DBAT0:
-               l = mfspr (DBAT0L);
-               u = mfspr (DBAT0U);
+#ifdef CONFIG_HIGH_BATS
+       case DBAT4:
+               l = mfspr (DBAT4L);
+               u = mfspr (DBAT4U);
                break;
-
-       case DBAT1:
-               l = mfspr (DBAT1L);
-               u = mfspr (DBAT1U);
+       case IBAT4:
+               l = mfspr (IBAT4L);
+               u = mfspr (IBAT4U);
                break;
-
-       case DBAT2:
-               l = mfspr (DBAT2L);
-               u = mfspr (DBAT2U);
+       case DBAT5:
+               l = mfspr (DBAT5L);
+               u = mfspr (DBAT5U);
                break;
-
-       case DBAT3:
-               l = mfspr (DBAT3L);
-               u = mfspr (DBAT3U);
+       case IBAT5:
+               l = mfspr (IBAT5L);
+               u = mfspr (IBAT5U);
                break;
-
+       case DBAT6:
+               l = mfspr (DBAT6L);
+               u = mfspr (DBAT6U);
+               break;
+       case IBAT6:
+               l = mfspr (IBAT6L);
+               u = mfspr (IBAT6U);
+               break;
+       case DBAT7:
+               l = mfspr (DBAT7L);
+               u = mfspr (DBAT7U);
+               break;
+       case IBAT7:
+               l = mfspr (IBAT7L);
+               u = mfspr (IBAT7U);
+               break;
+#endif
        default:
                return (-1);
        }
@@ -131,3 +183,44 @@ int read_bat (ppc_bat_t bat, unsigned long *upper, unsigned long *lower)
 
        return (0);
 }
+
+void print_bats(void)
+{
+       printf("BAT registers:\n");
+
+       printf ("\tIBAT0L = 0x%08X ", mfspr (IBAT0L));
+       printf ("\tIBAT0U = 0x%08X\n", mfspr (IBAT0U));
+       printf ("\tDBAT0L = 0x%08X ", mfspr (DBAT0L));
+       printf ("\tDBAT0U = 0x%08X\n", mfspr (DBAT0U));
+       printf ("\tIBAT1L = 0x%08X ", mfspr (IBAT1L));
+       printf ("\tIBAT1U = 0x%08X\n", mfspr (IBAT1U));
+       printf ("\tDBAT1L = 0x%08X ", mfspr (DBAT1L));
+       printf ("\tDBAT1U = 0x%08X\n", mfspr (DBAT1U));
+       printf ("\tIBAT2L = 0x%08X ", mfspr (IBAT2L));
+       printf ("\tIBAT2U = 0x%08X\n", mfspr (IBAT2U));
+       printf ("\tDBAT2L = 0x%08X ", mfspr (DBAT2L));
+       printf ("\tDBAT2U = 0x%08X\n", mfspr (DBAT2U));
+       printf ("\tIBAT3L = 0x%08X ", mfspr (IBAT3L));
+       printf ("\tIBAT3U = 0x%08X\n", mfspr (IBAT3U));
+       printf ("\tDBAT3L = 0x%08X ", mfspr (DBAT3L));
+       printf ("\tDBAT3U = 0x%08X\n", mfspr (DBAT3U));
+
+#ifdef CONFIG_HIGH_BATS
+       printf ("\tIBAT4L = 0x%08X ", mfspr (IBAT4L));
+       printf ("\tIBAT4U = 0x%08X\n", mfspr (IBAT4U));
+       printf ("\tDBAT4L = 0x%08X ", mfspr (DBAT4L));
+       printf ("\tDBAT4U = 0x%08X\n", mfspr (DBAT4U));
+       printf ("\tIBAT5L = 0x%08X ", mfspr (IBAT5L));
+       printf ("\tIBAT5U = 0x%08X\n", mfspr (IBAT5U));
+       printf ("\tDBAT5L = 0x%08X ", mfspr (DBAT5L));
+       printf ("\tDBAT5U = 0x%08X\n", mfspr (DBAT5U));
+       printf ("\tIBAT6L = 0x%08X ", mfspr (IBAT6L));
+       printf ("\tIBAT6U = 0x%08X\n", mfspr (IBAT6U));
+       printf ("\tDBAT6L = 0x%08X ", mfspr (DBAT6L));
+       printf ("\tDBAT6U = 0x%08X\n", mfspr (DBAT6U));
+       printf ("\tIBAT7L = 0x%08X ", mfspr (IBAT7L));
+       printf ("\tIBAT7U = 0x%08X\n", mfspr (IBAT7U));
+       printf ("\tDBAT7L = 0x%08X ", mfspr (DBAT7L));
+       printf ("\tDBAT7U = 0x%08X\n", mfspr (DBAT7U));
+#endif
+}
index 4956403cce8d1439dbd5f41fd10fede6021a107a..c42e08862fc87321c86261fcf8fb14f5d7f86b1b 100644 (file)
@@ -93,9 +93,7 @@ void doc_init (void);
 #if defined(CONFIG_HARD_SPI)
 #include <spi.h>
 #endif
-#if defined(CONFIG_CMD_NAND)
-void nand_init (void);
-#endif
+#include <nand.h>
 
 static char *failed = "*** failed ***\n";
 
@@ -398,6 +396,13 @@ ulong get_effective_memsize(void)
  ************************************************************************
  */
 
+#ifdef CONFIG_LOGBUFFER
+unsigned long logbuffer_base(void)
+{
+       return CFG_SDRAM_BASE + get_effective_memsize() - LOGBUFF_LEN;
+}
+#endif
+
 void board_init_f (ulong bootflag)
 {
        bd_t *bd;
@@ -416,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 883c381e641ba47d3c7b8c5c42dabdc786aeb689..807415c548fe27672c7835b96a3ae7fba16ef881 100644 (file)
@@ -76,7 +76,7 @@ static int sh_flash_init(void)
 }
 
 #if defined(CONFIG_CMD_NAND)
-void nand_init (void);
+#include <nand.h>
 static int sh_nand_init(void)
 {
        printf("NAND: ");
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 c4f24c64b63db4754aa1ea93fcd85ffbc7c1db5a..21d14961cb20e04b95ccb739184ae39a43db41fd 100644 (file)
--- a/net/eth.c
+++ b/net/eth.c
@@ -288,7 +288,8 @@ int eth_initialize(bd_t *bis)
 #if defined(CONFIG_FSLDMAFEC)
        mcdmafec_initialize(bis);
 #endif
-#if defined(CONFIG_AT91CAP9) || defined(CONFIG_AT91SAM9260)
+#if defined(CONFIG_AT91CAP9) || defined(CONFIG_AT91SAM9260) || \
+    defined(CONFIG_AT91SAM9263)
        at91sam9_eth_initialize(bis);
 #endif
 
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 b48390ba98ad5e22d2bb55685ac2271f28bfb546..ef641d7899060c33c503191033bc7399343f32f3 100644 (file)
@@ -41,6 +41,15 @@ DECLARE_GLOBAL_DATA_PTR;
 
 #if CONFIG_POST & CFG_POST_BSPEC3
 
+/* Testpattern for fpga memorytest */
+static uint pattern[] = {
+       0x55555555,
+       0xAAAAAAAA,
+       0xAA5555AA,
+       0x55AAAA55,
+       0x0
+};
+
 static int one_scratch_test(uint value)
 {
        uint read_value;
@@ -60,9 +69,42 @@ static int one_scratch_test(uint value)
        return ret;
 }
 
+/* FPGA Memory-pattern-test */
+static int fpga_mem_test(void * address)
+{
+       int ret = 1;
+       uint read_value;
+       uint old_value;
+       uint i = 0;
+       /* save content */
+       old_value = in_be32(address);
+
+       while (pattern[i] != 0) {
+               out_be32(address, pattern[i]);
+               /* read other location (protect against data lines capacity) */
+               ret = in_be16((void *)FPGA_VERSION_REG);
+               /* verify test pattern */
+               read_value = in_be32(address);
+
+               if (read_value != pattern[i]) {
+                       post_log("FPGA Memory test failed.");
+                       post_log(" write %08X, read %08X at address %08X\n",
+                               pattern[i], read_value, address);
+                       ret = 1;
+                       goto out;
+               }
+               i++;
+       }
+
+       ret = 0;
+out:
+       out_be32(address, old_value);
+       return ret;
+}
 /* Verify FPGA, get version & memory size */
 int fpga_post_test(int flags)
 {
+       uint   address;
        uint   old_value;
        ushort version;
        uint   read_value;
@@ -88,6 +130,14 @@ int fpga_post_test(int flags)
        read_value = get_ram_size((void *)CFG_FPGA_BASE_1, 0x4000);
        post_log("FPGA RAM size: %d bytes\n", read_value);
 
+       for (address = 0; address < 0x1000; address++) {
+               if (fpga_mem_test((void *)(FPGA_RAM_START + 4*address)) == 1) {
+                       ret = 1;
+                       goto out;
+               }
+       }
+
+out:
        return ret;
 }
 
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)
index 5285055dc84ec8583bbf4b737e0e4eb8c2d29b38..8533a8e5ced63f717dd1700cd502dbc8d66e6f85 100644 (file)
@@ -44,6 +44,10 @@ LOGO_H       = $(OBJTREE)/include/bmp_logo.h
 ifeq ($(LOGO_BMP),)
 LOGO_BMP= logos/denx.bmp
 endif
+ifeq ($(VENDOR),atmel)
+LOGO_BMP= logos/atmel.bmp
+endif
+
 
 #-------------------------------------------------------------------------
 
diff --git a/tools/logos/atmel.bmp b/tools/logos/atmel.bmp
new file mode 100644 (file)
index 0000000..3c445c9
Binary files /dev/null and b/tools/logos/atmel.bmp differ