]> git.ipfire.org Git - people/ms/u-boot.git/commitdiff
Merge branch 'master' of git://www.denx.de/git/u-boot-ppc4xx
authorWolfgang Denk <wd@denx.de>
Wed, 11 Jun 2008 20:13:07 +0000 (22:13 +0200)
committerWolfgang Denk <wd@denx.de>
Wed, 11 Jun 2008 20:13:07 +0000 (22:13 +0200)
319 files changed:
CHANGELOG
CREDITS
MAINTAINERS
MAKEALL
Makefile
README
board/amcc/taihu/taihu.c
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/dbau1x00/dbau1x00.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/gth2/gth2.c
board/mpc8540eval/law.c
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/pb1x00/pb1x00.c
board/pm854/law.c
board/pm856/law.c
board/qemu-mips/qemu-mips.c
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]
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
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/dm9000x.c
drivers/net/macb.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/processor.h
include/atmel_lcdc.h [new file with mode: 0644]
include/common.h
include/configs/Alaska8220.h
include/configs/BC3450.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/ads5121.h
include/configs/aev.h
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/canmb.h
include/configs/cm5200.h
include/configs/cpci5200.h
include/configs/hmi1001.h
include/configs/imx31_litekit.h
include/configs/inka4x0.h
include/configs/jupiter.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/p3mx.h
include/configs/pf5200.h
include/configs/sbc8349.h
include/configs/sbc8560.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/uc101.h
include/configs/v38b.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/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
net/eth.c
post/board/lwmon5/fpga.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 cc887627438090b8a40c09e669cd4843b2240fa8..357cab3e857d93b662a2adaa17fa1d2ce8b12767 100644 (file)
@@ -371,6 +371,10 @@ Peter De Schrijver <p2@mind.be>
 
        ML2                     PPC4xx
 
+Andre Schwarz <andre.schwarz@matrix-vision.de>
+
+       mvblm7                  MPC8343
+
 Timur Tabi <timur@freescale.com>
 
        MPC8349E-mITX           MPC8349
@@ -542,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>
 
@@ -699,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 4bf6d4dcd5f53ae4373cf6eeae270ff7b8ea714c..8a0233cca22b5d9e3bb7173e3a7d95b8069d8c26 100755 (executable)
--- a/MAKEALL
+++ b/MAKEALL
@@ -331,6 +331,7 @@ LIST_83xx="         \
        MPC8360ERDK_66  \
        MPC837XEMDS     \
        MPC837XERDB     \
+       MVBLM7          \
        sbc8349         \
        TQM834x         \
 "
@@ -360,6 +361,7 @@ LIST_85xx="         \
        stxssa          \
        TQM8540         \
        TQM8541         \
+       TQM8548         \
        TQM8555         \
        TQM8560         \
 "
@@ -462,6 +464,9 @@ LIST_ARM9="                 \
        at91cap9adk             \
        at91rm9200dk            \
        at91sam9260ek           \
+       at91sam9261ek           \
+       at91sam9263ek           \
+       at91sam9rlek            \
        cmc_pu2                 \
        ap920t                  \
        ap922_XA10              \
@@ -521,6 +526,24 @@ LIST_ARM11="               \
        mx31ads         \
 "
 
+#########################################################################
+## AT91 Systems
+#########################################################################
+
+LIST_at91="            \
+       at91cap9adk     \
+       at91rm9200dk    \
+       at91sam9260ek   \
+       at91sam9261ek   \
+       at91sam9263ek   \
+       at91sam9rlek    \
+       cmc_pu2         \
+       csb637          \
+       kb9202          \
+       mp2usb          \
+       m501sk          \
+"
+
 #########################################################################
 ## Xscale Systems
 #########################################################################
@@ -698,6 +721,7 @@ LIST_avr32="                \
        atstk1002       \
        atstk1003       \
        atstk1004       \
+       atstk1006       \
        atngw100        \
 "
 
@@ -766,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 04cebacbb9fd4de9786301ca198fbc278976e88e..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
@@ -1782,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
@@ -2105,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
 
 
 #########################################################################
@@ -2228,6 +2233,7 @@ stxssa_4M_config: unconfig
 
 TQM8540_config         \
 TQM8541_config         \
+TQM8548_config         \
 TQM8555_config         \
 TQM8560_config:                unconfig
        @mkdir -p $(obj)include
@@ -2236,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
@@ -2338,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
 
@@ -2882,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..78344f8b57a7e7a4d3c78361bec4f57310c50541 100644 (file)
--- a/README
+++ b/README
@@ -961,6 +961,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 9bd30f96a73d1ac7ff2af3dd049649303d9453e7..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] = {
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 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 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 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 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
 };
 
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 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 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 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
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 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..3a98d2b944b17b8853766cbb6bfcd6f4b136f58d 100644 (file)
@@ -57,9 +57,6 @@ 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;
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 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 68ab55f8a5fdf97aa6b3332337d8375d598750cf..d84f0fc55e23106129a066878a7ce9d428556687 100644 (file)
@@ -1720,6 +1720,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 01e2f14a9d47e177bce9e4ef2e642176844fa566..68901cd818e004d5f6132b965cafa11f34d20c12 100644 (file)
@@ -300,8 +300,10 @@ eth_init(bd_t * bd)
        DM9000_iow(DM9000_ISR, 0x0f);   /* Clear interrupt status */
 
        /* 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)) {
index 703784ee0dc26d2164431f00e052978d48e690b8..e5733f6e5b23c6ad7a05dfbda0b5a3d783f701f7 100644 (file)
@@ -417,13 +417,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));
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__ */
 
index cfd84402379f68b5135b0e2603537cd9a72665fb..139e6869df767f1ae0ca39508a76a74914f28624 100644 (file)
@@ -962,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 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 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 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 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 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 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 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 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
  */
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 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 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 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 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 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 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 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