Merge branch 'master' of git://git.denx.de/u-boot-x86
authorWolfgang Denk <wd@denx.de>
Fri, 17 Feb 2012 22:47:29 +0000 (23:47 +0100)
committerWolfgang Denk <wd@denx.de>
Fri, 17 Feb 2012 22:47:29 +0000 (23:47 +0100)
* 'master' of git://git.denx.de/u-boot-x86:
  x86: Convert board_init_f_r to a processing loop
  x86: Split init functions out of board.c
  x86: Move relocation code out of board.c
  x86: Move setup_pcat_compatibility() out of board.c
  x86: Move do_go_exec() out of board.c
  CHECKPATCH: arch/x86/lib/*
  x86: Tweak IDT and GDT for alignment and readability
  x86: Allow cache before copy to RAM
  x86: Create weak init_cache() and default enable_caches() functions
  x86: Set GD_FLG_RELOC after entering in-RAM copy of U-Boot
  x86: Use fs for global data
  x86: Rework relocation calculations
  x86: Simplify Flash-to-RAM code execution transition
  x86: Rework Global Descriptor Table loading
  x86: Remove GDR related magic numbers
  x86: Speed up copy-to-RAM and clear BSS operations
  x86: Import glibc memcpy implementation

290 files changed:
MAINTAINERS
Makefile
README
arch/arm/cpu/arm1136/mx31/generic.c
arch/arm/cpu/arm926ejs/armada100/timer.c
arch/arm/cpu/arm926ejs/cache.c
arch/arm/cpu/arm926ejs/cpu.c
arch/arm/cpu/arm926ejs/davinci/cpu.c
arch/arm/cpu/arm926ejs/davinci/da850_lowlevel.c
arch/arm/cpu/arm926ejs/davinci/dm365_lowlevel.c
arch/arm/cpu/arm926ejs/davinci/lowlevel_init.S
arch/arm/cpu/arm926ejs/davinci/spl.c
arch/arm/cpu/arm926ejs/kirkwood/Makefile
arch/arm/cpu/arm926ejs/kirkwood/cache.c [new file with mode: 0644]
arch/arm/cpu/arm926ejs/kirkwood/timer.c
arch/arm/cpu/arm926ejs/mx27/generic.c
arch/arm/cpu/arm926ejs/mx28/mx28.c
arch/arm/cpu/arm926ejs/orion5x/timer.c
arch/arm/cpu/arm926ejs/pantheon/timer.c
arch/arm/cpu/arm926ejs/start.S
arch/arm/cpu/armv7/am33xx/clock.c
arch/arm/cpu/armv7/exynos/clock.c
arch/arm/cpu/armv7/mx5/soc.c
arch/arm/cpu/armv7/omap-common/clocks-common.c
arch/arm/cpu/armv7/omap-common/hwinit-common.c
arch/arm/cpu/armv7/omap3/board.c
arch/arm/cpu/armv7/omap3/clock.c
arch/arm/cpu/armv7/omap3/lowlevel_init.S
arch/arm/cpu/armv7/omap3/sdrc.c
arch/arm/cpu/armv7/omap4/clocks.c
arch/arm/cpu/armv7/s5p-common/Makefile
arch/arm/cpu/armv7/s5p-common/wdt.c [new file with mode: 0644]
arch/arm/cpu/armv7/tegra2/board.c
arch/arm/cpu/armv7/tegra2/funcmux.c
arch/arm/include/asm/arch-am33xx/common_def.h
arch/arm/include/asm/arch-am33xx/cpu.h
arch/arm/include/asm/arch-am33xx/i2c.h [new file with mode: 0644]
arch/arm/include/asm/arch-davinci/da850_lowlevel.h
arch/arm/include/asm/arch-davinci/dm365_lowlevel.h
arch/arm/include/asm/arch-davinci/hardware.h
arch/arm/include/asm/arch-davinci/pll_defs.h
arch/arm/include/asm/arch-davinci/timer_defs.h
arch/arm/include/asm/arch-exynos/clock.h
arch/arm/include/asm/arch-exynos/cpu.h
arch/arm/include/asm/arch-exynos/dmc.h [new file with mode: 0644]
arch/arm/include/asm/arch-exynos/gpio.h
arch/arm/include/asm/arch-exynos/power.h [new file with mode: 0644]
arch/arm/include/asm/arch-exynos/pwm.h
arch/arm/include/asm/arch-exynos/tzpc.h [new file with mode: 0644]
arch/arm/include/asm/arch-exynos/watchdog.h [new file with mode: 0644]
arch/arm/include/asm/arch-kirkwood/config.h
arch/arm/include/asm/arch-kirkwood/kirkwood.h
arch/arm/include/asm/arch-mx27/clock.h
arch/arm/include/asm/arch-mx31/clock.h
arch/arm/include/asm/arch-mx31/imx-regs.h
arch/arm/include/asm/arch-mx31/sys_proto.h
arch/arm/include/asm/arch-mx6/mx6x_pins.h
arch/arm/include/asm/arch-omap3/clocks_omap3.h
arch/arm/include/asm/arch-omap3/ehci.h [new file with mode: 0644]
arch/arm/include/asm/arch-omap3/ehci_omap3.h [deleted file]
arch/arm/include/asm/arch-omap3/mem.h
arch/arm/include/asm/arch-omap3/sys_proto.h
arch/arm/include/asm/arch-omap4/ehci.h [new file with mode: 0644]
arch/arm/include/asm/arch-orion5x/orion5x.h
arch/arm/include/asm/arch-s5pc1xx/cpu.h
arch/arm/include/asm/arch-s5pc1xx/watchdog.h [new file with mode: 0644]
arch/arm/include/asm/arch-tegra2/funcmux.h
arch/arm/include/asm/ehci-omap.h [new file with mode: 0644]
arch/arm/include/asm/u-boot.h
arch/arm/lib/board.c
arch/blackfin/cpu/cache.S
arch/blackfin/include/asm/blackfin_local.h
arch/blackfin/include/asm/cache.h
arch/blackfin/include/asm/io.h
arch/blackfin/include/asm/linkage.h
arch/blackfin/lib/__kgdb.S
arch/blackfin/lib/outs.S
board/ait/cam_enc_4xx/cam_enc_4xx.c
board/ait/cam_enc_4xx/ublimage.cfg
board/avionic-design/common/tamonten.c
board/bf537-stamp/bf537-stamp.c
board/br4/Makefile [new file with mode: 0644]
board/br4/br4.c [new file with mode: 0644]
board/br4/config.mk [new file with mode: 0644]
board/compal/paz00/Makefile [new file with mode: 0644]
board/compal/paz00/paz00.c [new file with mode: 0644]
board/corscience/tricorder/Makefile [new file with mode: 0644]
board/corscience/tricorder/tricorder.c [new file with mode: 0644]
board/corscience/tricorder/tricorder.h [new file with mode: 0644]
board/d-link/dns325/Makefile [new file with mode: 0644]
board/d-link/dns325/dns325.c [new file with mode: 0644]
board/d-link/dns325/dns325.h [new file with mode: 0644]
board/d-link/dns325/kwbimage.cfg [new file with mode: 0644]
board/davinci/da8xxevm/da850evm.c
board/davinci/da8xxevm/hawkboard.c
board/davinci/da8xxevm/hawkboard_nand_spl.c [deleted file]
board/davinci/da8xxevm/u-boot-spl-da850evm.lds [new file with mode: 0644]
board/davinci/da8xxevm/u-boot-spl-hawk.lds [new file with mode: 0644]
board/davinci/da8xxevm/u-boot-spl.lds [deleted file]
board/efikamx/efikamx-usb.c
board/enbw/enbw_cmc/enbw_cmc.c
board/freescale/common/Makefile
board/freescale/mx6qarm2/mx6qarm2.c
board/freescale/mx6qsabrelite/mx6qsabrelite.c
board/hale/tt01/tt01.c
board/htkw/mcx/Makefile [new file with mode: 0644]
board/htkw/mcx/mcx.c [new file with mode: 0644]
board/htkw/mcx/mcx.h [new file with mode: 0644]
board/keymile/km_arm/km_arm.c
board/logicpd/omap3som/omap3logic.c
board/nvidia/harmony/harmony.c
board/nvidia/seaboard/seaboard.c
board/omicron/calimain/Makefile [new file with mode: 0644]
board/omicron/calimain/calimain.c [new file with mode: 0644]
board/pr1/Makefile [new file with mode: 0644]
board/pr1/config.mk [new file with mode: 0644]
board/pr1/pr1.c [new file with mode: 0644]
board/samsung/origen/lowlevel_init.S
board/samsung/origen/origen_setup.h
board/samsung/smdk5250/Makefile [new file with mode: 0644]
board/samsung/smdk5250/clock_init.c [new file with mode: 0644]
board/samsung/smdk5250/dmc_init.c [new file with mode: 0644]
board/samsung/smdk5250/lowlevel_init.S [new file with mode: 0644]
board/samsung/smdk5250/mmc_boot.c [new file with mode: 0644]
board/samsung/smdk5250/setup.h [new file with mode: 0644]
board/samsung/smdk5250/smdk5250.c [new file with mode: 0644]
board/samsung/smdk5250/tzpc_init.c [new file with mode: 0644]
board/samsung/trats/Makefile [new file with mode: 0644]
board/samsung/trats/setup.h [new file with mode: 0644]
board/samsung/trats/trats.c [new file with mode: 0644]
board/technexion/twister/twister.c
board/teejet/mt_ventoux/Makefile [new file with mode: 0644]
board/teejet/mt_ventoux/mt_ventoux.c [new file with mode: 0644]
board/teejet/mt_ventoux/mt_ventoux.h [new file with mode: 0644]
board/ti/am335x/evm.c
board/ti/am335x/mux.c
board/ti/beagle/beagle.c
board/ti/beagle/beagle.h
board/ti/panda/panda.c
board/ti/panda/panda_mux_data.h
boards.cfg
common/cmd_bdinfo.c
common/cmd_nvedit.c
common/cmd_sf.c
common/main.c
common/menu.c
doc/README.SPL
doc/README.hawkboard
doc/README.imximage
doc/README.menu
doc/README.nand
doc/README.omap-ulpi-viewport [new file with mode: 0644]
drivers/block/pata_bfin.c
drivers/i2c/omap24xx_i2c.c
drivers/i2c/omap24xx_i2c.h
drivers/mmc/mxcmmc.c
drivers/mmc/tegra2_mmc.c
drivers/mtd/cfi_flash.c
drivers/mtd/jedec_flash.c
drivers/mtd/nand/Makefile
drivers/mtd/nand/bfin_nand.c
drivers/mtd/nand/fsl_elbc_nand.c
drivers/mtd/nand/nand.c
drivers/mtd/nand/nand_base.c
drivers/mtd/nand/nand_bbt.c
drivers/mtd/nand/nand_bch.c [new file with mode: 0644]
drivers/mtd/nand/nand_ids.c
drivers/mtd/nand/nand_spl_simple.c
drivers/mtd/spi/eeprom_m95xxx.c
drivers/spi/kirkwood_spi.c
drivers/spi/mxs_spi.c
drivers/usb/host/Makefile
drivers/usb/host/ehci-kirkwood.c [deleted file]
drivers/usb/host/ehci-marvell.c [new file with mode: 0644]
drivers/usb/host/ehci-omap.c [new file with mode: 0644]
drivers/usb/ulpi/Makefile
drivers/usb/ulpi/omap-ulpi-viewport.c [new file with mode: 0644]
drivers/usb/ulpi/ulpi-viewport.c
drivers/usb/ulpi/ulpi.c
include/common.h
include/configs/MPC8536DS.h
include/configs/P1010RDB.h
include/configs/P1_P2_RDB.h
include/configs/P2020COME.h
include/configs/P2020DS.h
include/configs/P2041RDB.h
include/configs/PM826.h
include/configs/PM828.h
include/configs/PMC440.h
include/configs/SIMPC8313.h
include/configs/VCMA9.h
include/configs/acadia.h
include/configs/am335x_evm.h
include/configs/am3517_crane.h
include/configs/am3517_evm.h
include/configs/aria.h
include/configs/at91sam9m10g45ek.h
include/configs/bamboo.h
include/configs/bf526-ezbrd.h
include/configs/bf527-ad7160-eval.h
include/configs/bf527-ezkit.h
include/configs/bf548-ezkit.h
include/configs/br4.h [new file with mode: 0644]
include/configs/calimain.h [new file with mode: 0644]
include/configs/cam_enc_4xx.h
include/configs/canyonlands.h
include/configs/cm-bf527.h
include/configs/coreboot.h
include/configs/corenet_ds.h
include/configs/cpu9260.h
include/configs/da830evm.h
include/configs/da850evm.h
include/configs/davinci_dm355evm.h
include/configs/davinci_dm355leopard.h
include/configs/davinci_dm365evm.h
include/configs/davinci_dm6467Tevm.h
include/configs/davinci_dm6467evm.h
include/configs/davinci_dvevm.h
include/configs/davinci_schmoogie.h
include/configs/davinci_sffsdr.h
include/configs/davinci_sonata.h
include/configs/devkit8000.h
include/configs/dns325.h [new file with mode: 0644]
include/configs/ea20.h
include/configs/eb_cpux9k2.h
include/configs/ecovec.h
include/configs/edminiv2.h
include/configs/efikamx.h
include/configs/enbw_cmc.h
include/configs/ethernut5.h
include/configs/flea3.h
include/configs/hawkboard.h
include/configs/kilauea.h
include/configs/km/km_arm.h
include/configs/m28evk.h
include/configs/mcx.h [new file with mode: 0644]
include/configs/mecp5123.h
include/configs/mpc5121ads.h
include/configs/mt_ventoux.h [new file with mode: 0644]
include/configs/mv-common.h
include/configs/mx6qarm2.h
include/configs/mx6qsabrelite.h
include/configs/omap3_beagle.h
include/configs/omap3_evm.h
include/configs/omap3_evm_common.h
include/configs/omap3_evm_quick_nand.h
include/configs/omap3_mvblx.h
include/configs/omap4_panda.h
include/configs/origen.h
include/configs/p1_p2_rdb_pc.h
include/configs/paz00.h [new file with mode: 0644]
include/configs/pdm360ng.h
include/configs/pm9261.h
include/configs/pm9263.h
include/configs/pm9g45.h
include/configs/pr1.h [new file with mode: 0644]
include/configs/qi_lb60.h
include/configs/s5pc210_universal.h
include/configs/sequoia.h
include/configs/smdk2410.h
include/configs/smdk5250.h [new file with mode: 0644]
include/configs/smdk6400.h
include/configs/tam3517-common.h
include/configs/tnetv107x_evm.h
include/configs/trats.h [new file with mode: 0644]
include/configs/tricorder.h [new file with mode: 0644]
include/configs/tt01.h
include/linux/bch.h [new file with mode: 0644]
include/linux/linkage.h [new file with mode: 0644]
include/linux/mtd/bbm.h
include/linux/mtd/nand.h
include/linux/mtd/nand_bch.h [new file with mode: 0644]
include/linux/mtd/nand_ecc.h
include/linux/string.h
include/mc13783.h [new file with mode: 0644]
include/menu.h
include/nand.h
include/usb/ulpi.h
lib/Makefile
lib/bch.c [new file with mode: 0644]
lib/string.c
nand_spl/board/davinci/da8xxevm/Makefile [deleted file]
nand_spl/board/davinci/da8xxevm/u-boot.lds [deleted file]
nand_spl/nand_boot.c
post/post.c
tools/Makefile
tools/env/fw_env.h
tools/imximage.c
tools/imximage.h
tools/mkexynosspl.c [new file with mode: 0644]

index 8c4fe2df8de531e36d09d9e428ca9376572590df..1e40af2c8c5e2d850cdbce33ee2c3ba0340b405e 100644 (file)
@@ -574,6 +574,7 @@ Stefano Babic <sbabic@denx.de>
 
        ea20            davinci
        flea3           i.MX35
+       mt_ventoux      omap3
        mx35pdk         i.MX35
        mx51evk         i.MX51
        polaris         xscale/pxa
@@ -677,6 +678,10 @@ Kshitij Gupta <kshitij@ti.com>
        omap1510inn     ARM925T
        omap1610inn     ARM926EJS
 
+Stefan Herbrechtsmeier <stefan@code.herbrechtsmeier.net>
+
+       dns325          ARM926EJS (Kirkwood SoC)
+
 Vaibhav Hiremath <hvaibhav@ti.com>
 
        am3517_evm      ARM ARMV7 (AM35x SoC)
@@ -713,6 +718,11 @@ Chander Kashyap <k.chander@samsung.com>
 
        origen                  ARM ARMV7 (EXYNOS4210 SoC)
        SMDKV310                ARM ARMV7 (EXYNOS4210 SoC)
+       SMDK5250                ARM ARMV7 (EXYNOS5250 SoC)
+
+Heungjun Kim <riverful.kim@samsung.com>
+
+       trats                   ARM ARMV7 (EXYNOS4210 SoC)
 
 Torsten Koschorrek <koschorrek@synertronixx.de>
        scb9328         ARM920T (i.MXL)
@@ -796,6 +806,11 @@ Thierry Reding <thierry.reding@avionic-design.de>
        plutux          Tegra2 (ARM7 & A9 Dual Core)
        medcom          Tegra2 (ARM7 & A9 Dual Core)
 
+Christian Riesch <christian.riesch@omicron.at>
+Manfred Rudigier <manfred.rudigier@omicron.at>
+
+       calimain        ARM926EJS (AM1808 SoC)
+
 Tom Rini <trini@ti.com>
 
        omap3_evm       ARM ARMV7 (OMAP3xx SoC)
@@ -899,10 +914,12 @@ Tom Warren <twarren@nvidia.com>
 Stephen Warren <swarren@nvidia.com>
 
        ventana         Tegra2 (ARM7 & A9 Dual Core)
+       paz00           Tegra2 (ARM7 & A9 Dual Core)
 
 Thomas Weber <weber@corscience.de>
 
        devkit8000      ARM ARMV7 (OMAP3530 SoC)
+       tricorder       ARM ARMV7 (OMAP3503 SoC)
 
 Lei Wen <leiwen@marvell.com>
 
@@ -917,6 +934,10 @@ Richard Woodruff <r-woodruff2@ti.com>
 
        omap2420h4      ARM1136EJS
 
+Ilya Yanok <yanok@emcraft.com>
+
+       mcx             ARM ARMV7 (AM35x SoC)
+
 Syed Mohammed Khasim <sm.khasim@gmail.com>
 Sughosh Ganu <urwithsughosh@gmail.com>
 
@@ -1162,6 +1183,11 @@ Chong Huang <chuang@ucrobotics.com>
 
        bf525-ucr2      BF525
 
+Dimitar Penev <dpn@switchfin.org>
+
+       BR4 Appliance   BF537
+       PR1 Appliance   BF537
+
 #########################################################################
 # NDS32 Systems:                                                       #
 #                                                                      #
index 36246b653e2336a84fd64ad9b210dc4037154a88..11aac21ea9b722b6d03273e9e1853d90689c7263 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -667,14 +667,6 @@ ucname     = $(shell echo $(1) | sed -e 's/\(.*\)_config/\U\1/')
 # ARM
 #========================================================================
 
-spear300_config \
-spear310_config \
-spear320_config :      unconfig
-       @$(MKCONFIG) -n $@ -t $@ spear3xx arm arm926ejs $(@:_config=) spear spear
-
-spear600_config :      unconfig
-       @$(MKCONFIG) -n $@ -t $@ spear6xx arm arm926ejs $(@:_config=) spear spear
-
 SX1_stdout_serial_config \
 SX1_config:            unconfig
        @mkdir -p $(obj)include
@@ -735,6 +727,7 @@ clean:
               $(obj)tools/gdb/{astest,gdbcont,gdbsend}                   \
               $(obj)tools/gen_eth_addr    $(obj)tools/img2srec           \
               $(obj)tools/mk{env,}image   $(obj)tools/mpc86x_clk         \
+              $(obj)tools/mk{smdk5250,}spl                               \
               $(obj)tools/ncb             $(obj)tools/ubsha1
        @rm -f $(obj)board/cray/L1/{bootscript.c,bootscript.image}        \
               $(obj)board/matrix_vision/*/bootscript.img                 \
diff --git a/README b/README
index 9d713e8f4398b9af70844ab7910c67e400817bf6..eba6378536858da57d307e6f7d9721930b00f782 100644 (file)
--- a/README
+++ b/README
@@ -1,5 +1,5 @@
 #
-# (C) Copyright 2000 - 2011
+# (C) Copyright 2000 - 2012
 # Wolfgang Denk, DENX Software Engineering, wd@denx.de.
 #
 # See file CREDITS for list of people who contributed to this
@@ -420,6 +420,12 @@ The following options need to be configured:
                XWAY SoCs for booting from NOR flash. The U-Boot image needs to
                be swapped if a flash programmer is used.
 
+- ARM options:
+               CONFIG_SYS_EXCEPTION_VECTORS_HIGH
+
+               Select high exception vectors of the ARM core, e.g., do not
+               clear the V bit of the c1 register of CP15.
+
 - Linux Kernel Interface:
                CONFIG_CLOCKS_IN_MHZ
 
@@ -809,6 +815,7 @@ The following options need to be configured:
                                          (requires CONFIG_CMD_I2C)
                CONFIG_CMD_SETGETDCR      Support for DCR Register access
                                          (4xx only)
+               CONFIG_CMD_SF           * Read/write/erase SPI NOR flash
                CONFIG_CMD_SHA1SUM        print sha1 memory digest
                                          (requires CONFIG_CMD_MEMORY)
                CONFIG_CMD_SOURCE         "source" command Support
@@ -2191,6 +2198,25 @@ The following options need to be configured:
                allows to read/write in Dataflash via the standard
                commands cp, md...
 
+- Serial Flash support
+               CONFIG_CMD_SF
+
+               Defining this option enables SPI flash commands
+               'sf probe/read/write/erase/update'.
+
+               Usage requires an initial 'probe' to define the serial
+               flash parameters, followed by read/write/erase/update
+               commands.
+
+               The following defaults may be provided by the platform
+               to handle the common case when only a single serial
+               flash is present on the system.
+
+               CONFIG_SF_DEFAULT_BUS           Bus identifier
+               CONFIG_SF_DEFAULT_CS            Chip-select
+               CONFIG_SF_DEFAULT_MODE          (see include/spi.h)
+               CONFIG_SF_DEFAULT_SPEED         in Hz
+
 - SystemACE Support:
                CONFIG_SYSTEMACE
 
index f45828141e6013ecdcc67de2382ebb54716dcd0d..d60afc9a33f57bee8efc17b16782ea1cf388bbd9 100644 (file)
@@ -101,6 +101,7 @@ unsigned int mxc_get_clock(enum mxc_clock clk)
        case MXC_IPG_PERCLK:
        case MXC_CSPI_CLK:
        case MXC_UART_CLK:
+       case MXC_ESDHC_CLK:
                return mx31_get_ipg_clk();
        case MXC_IPU_CLK:
                return mx31_get_hsp_clk();
index fbade4b45961515c1fdc1ef06629016d1b80dfae..355cd6d1d8200e055b639698273b7fc70a12f9b2 100644 (file)
@@ -190,3 +190,21 @@ void reset_cpu (unsigned long ignored)
 
        while(1);
 }
+
+/*
+ * This function is derived from PowerPC code (read timebase as long long).
+ * On ARM it just returns the timer value.
+ */
+unsigned long long get_ticks(void)
+{
+       return get_timer(0);
+}
+
+/*
+ * This function is derived from PowerPC code (timebase clock frequency).
+ * On ARM it returns the number of timer ticks per second.
+ */
+ulong get_tbclk (void)
+{
+       return (ulong)CONFIG_SYS_HZ;
+}
index ee90ab71958792f5257a304d6db5be589f21d510..504f604684d5098b8048338a63ab5dae7d573b55 100644 (file)
@@ -68,3 +68,12 @@ void  flush_cache(unsigned long start, unsigned long size)
 {
 }
 #endif /* #ifndef CONFIG_SYS_DCACHE_OFF */
+
+/*
+ * Stub implementations for l2 cache operations
+ */
+void __l2_cache_disable(void)
+{
+}
+void l2_cache_disable(void)
+        __attribute__((weak, alias("__l2_cache_disable")));
index 5c902dfc133dea358d1e81a4a37e552d7603ee6b..626384c3fc1e3d4156dded9141b55d95987c1216 100644 (file)
@@ -50,6 +50,8 @@ int cleanup_before_linux (void)
        /* turn off I/D-cache */
        icache_disable();
        dcache_disable();
+       l2_cache_disable();
+
        /* flush I/D-cache */
        cache_flush();
 
index 9ea97853c7652ff6178b404326ac81b041843a33..b3c9fb7b6991da12818f0aa6e8311b6684d2fb1a 100644 (file)
@@ -25,6 +25,8 @@
 #include <asm/arch/hardware.h>
 #include <asm/io.h>
 
+DECLARE_GLOBAL_DATA_PTR;
+
 /* offsets from PLL controller base */
 #define PLLC_PLLCTL    0x100
 #define PLLC_PLLM      0x110
@@ -115,21 +117,8 @@ int clk_get(enum davinci_clk_ids id)
 out:
        return pll_out;
 }
-#ifdef CONFIG_DISPLAY_CPUINFO
-int print_cpuinfo(void)
-{
-       printf("Cores: ARM %d MHz",
-                       clk_get(DAVINCI_ARM_CLKID) / 1000000);
-       printf("\nDDR:   %d MHz\n",
-                       /* DDR PHY uses an x2 input clock */
-                       clk_get(0x10001) / 1000000);
-       return 0;
-}
-#endif
 #else /* CONFIG_SOC_DA8XX */
 
-#ifdef CONFIG_DISPLAY_CPUINFO
-
 static unsigned pll_div(volatile void *pllbase, unsigned offset)
 {
        u32     div;
@@ -185,36 +174,6 @@ static unsigned pll_sysclk_mhz(unsigned pll_addr, unsigned div)
        return DIV_ROUND_UP(base, 1000 * pll_div(pllbase, div));
 }
 
-int print_cpuinfo(void)
-{
-       /* REVISIT fetch and display CPU ID and revision information
-        * too ... that will matter as more revisions appear.
-        */
-#if defined(CONFIG_SOC_DM365)
-       printf("Cores: ARM %d MHz",
-                       pll_sysclk_mhz(DAVINCI_PLL_CNTRL1_BASE, ARM_PLLDIV));
-#else
-       printf("Cores: ARM %d MHz",
-                       pll_sysclk_mhz(DAVINCI_PLL_CNTRL0_BASE, ARM_PLLDIV));
-#endif
-
-#ifdef DSP_PLLDIV
-       printf(", DSP %d MHz",
-                       pll_sysclk_mhz(DAVINCI_PLL_CNTRL0_BASE, DSP_PLLDIV));
-#endif
-
-       printf("\nDDR:   %d MHz\n",
-                       /* DDR PHY uses an x2 input clock */
-#if defined(CONFIG_SOC_DM365)
-                       pll_sysclk_mhz(DAVINCI_PLL_CNTRL0_BASE, DDR_PLLDIV)
-                               / 2);
-#else
-                       pll_sysclk_mhz(DAVINCI_PLL_CNTRL1_BASE, DDR_PLLDIV)
-                               / 2);
-#endif
-       return 0;
-}
-
 #ifdef DAVINCI_DM6467EVM
 unsigned int davinci_arm_clk_get()
 {
@@ -228,9 +187,38 @@ unsigned int davinci_clk_get(unsigned int div)
        return pll_sysclk_mhz(DAVINCI_PLL_CNTRL0_BASE, div) * 1000000;
 }
 #endif
-#endif /* CONFIG_DISPLAY_CPUINFO */
 #endif /* !CONFIG_SOC_DA8XX */
 
+int set_cpu_clk_info(void)
+{
+#ifdef CONFIG_SOC_DA8XX
+       gd->bd->bi_arm_freq = clk_get(DAVINCI_ARM_CLKID) / 1000000;
+       /* DDR PHY uses an x2 input clock */
+       gd->bd->bi_ddr_freq = clk_get(0x10001) / 1000000;
+#else
+
+       unsigned int pllbase = DAVINCI_PLL_CNTRL0_BASE;
+#if defined(CONFIG_SOC_DM365)
+       pllbase = DAVINCI_PLL_CNTRL1_BASE;
+#endif
+       gd->bd->bi_arm_freq = pll_sysclk_mhz(pllbase, ARM_PLLDIV);
+
+#ifdef DSP_PLLDIV
+       gd->bd->bi_dsp_freq =
+               pll_sysclk_mhz(DAVINCI_PLL_CNTRL0_BASE, DSP_PLLDIV);
+#else
+       gd->bd->bi_dsp_freq = 0;
+#endif
+
+       pllbase = DAVINCI_PLL_CNTRL1_BASE;
+#if defined(CONFIG_SOC_DM365)
+       pllbase = DAVINCI_PLL_CNTRL0_BASE;
+#endif
+       gd->bd->bi_ddr_freq = pll_sysclk_mhz(pllbase, DDR_PLLDIV) / 2;
+#endif
+       return 0;
+}
+
 /*
  * Initializes on-chip ethernet controllers.
  * to override, implement board_eth_init()
index a532f8ab6063270c16aed1504b14fc5c94319159..df7d6a24ba2b2fc68e34ee74c5d5a0ba88d55e42 100644 (file)
@@ -32,6 +32,7 @@
 #include <asm/arch/emif_defs.h>
 #include <asm/arch/pll_defs.h>
 
+#if defined(CONFIG_SYS_DA850_PLL_INIT)
 void da850_waitloop(unsigned long loopcnt)
 {
        unsigned long   i;
@@ -85,6 +86,13 @@ int da850_pll_init(struct davinci_pllc_regs *reg, unsigned long pllmult)
        /* Enable the PLL from Disable Mode PLLDIS bit to 0 */
        clrbits_le32(&reg->pllctl, PLLCTL_PLLDIS);
 
+#if defined(CONFIG_SYS_DA850_PLL0_PREDIV)
+       /* program the prediv */
+       if (reg == davinci_pllc0_regs && CONFIG_SYS_DA850_PLL0_PREDIV)
+               writel((PLL_DIVEN | CONFIG_SYS_DA850_PLL0_PREDIV),
+                       &reg->prediv);
+#endif
+
        /* Program the required multiplier value in PLLM */
        writel(pllmult, &reg->pllm);
 
@@ -156,7 +164,9 @@ int da850_pll_init(struct davinci_pllc_regs *reg, unsigned long pllmult)
 
        return 0;
 }
+#endif /* CONFIG_SYS_DA850_PLL_INIT */
 
+#if defined(CONFIG_SYS_DA850_DDR_INIT)
 int da850_ddr_setup(void)
 {
        unsigned long   tmp;
@@ -235,6 +245,7 @@ int da850_ddr_setup(void)
 
        return 0;
 }
+#endif /* CONFIG_SYS_DA850_DDR_INIT */
 
 __attribute__((weak))
 void board_gpio_init(void)
@@ -242,10 +253,6 @@ void board_gpio_init(void)
        return;
 }
 
-/* pinmux_resource[] vector is defined in the board specific file */
-extern const struct pinmux_resource pinmuxes[];
-extern const int pinmuxes_size;
-
 int arch_cpu_init(void)
 {
        /* Unlock kick registers */
@@ -259,13 +266,11 @@ int arch_cpu_init(void)
        if (davinci_configure_pin_mux_items(pinmuxes, pinmuxes_size))
                return 1;
 
+#if defined(CONFIG_SYS_DA850_PLL_INIT)
        /* PLL setup */
        da850_pll_init(davinci_pllc0_regs, CONFIG_SYS_DA850_PLL0_PLLM);
        da850_pll_init(davinci_pllc1_regs, CONFIG_SYS_DA850_PLL1_PLLM);
-
-       /* GPIO setup */
-       board_gpio_init();
-
+#endif
        /* setup CSn config */
 #if defined(CONFIG_SYS_DA850_CS2CFG)
        writel(CONFIG_SYS_DA850_CS2CFG, &davinci_emif_regs->ab1cr);
@@ -274,7 +279,12 @@ int arch_cpu_init(void)
        writel(CONFIG_SYS_DA850_CS3CFG, &davinci_emif_regs->ab2cr);
 #endif
 
-       lpsc_on(CONFIG_SYS_DA850_LPSC_UART);
+       da8xx_configure_lpsc_items(lpsc, lpsc_size);
+
+       /* GPIO setup */
+       board_gpio_init();
+
+
        NS16550_init((NS16550_t)(CONFIG_SYS_NS16550_COM1),
                        CONFIG_SYS_NS16550_CLK / 16 / CONFIG_BAUDRATE);
 
@@ -286,6 +296,9 @@ int arch_cpu_init(void)
                DAVINCI_UART_PWREMU_MGMT_UTRST),
               &davinci_uart2_ctrl_regs->pwremu_mgmt);
 
+#if defined(CONFIG_SYS_DA850_DDR_INIT)
        da850_ddr_setup();
+#endif
+
        return 0;
 }
index 6e998ded99e7cf7609d2a841f178b81d4cf723a4..c9936fd0de9e92c94ac545c6e6b69c8cc0bd9591 100644 (file)
@@ -254,7 +254,7 @@ int dm365_ddr_setup(void)
        return 0;
 }
 
-void dm365_vpss_sync_reset(void)
+static void dm365_vpss_sync_reset(void)
 {
        unsigned int PdNum = 0;
 
@@ -276,11 +276,52 @@ void dm365_vpss_sync_reset(void)
                ;
 }
 
-void dm365_por_reset(void)
+static void dm365_por_reset(void)
 {
+       struct davinci_timer *wdog =
+               (struct davinci_timer *)DAVINCI_WDOG_BASE;
+
        if (readl(&dv_pll0_regs->rstype) &
-               (PLL_RSTYPE_POR | PLL_RSTYPE_XWRST))
+               (PLL_RSTYPE_POR | PLL_RSTYPE_XWRST)) {
+               dm365_vpss_sync_reset();
+
+               writel(DV_TMPBUF_VAL, TMPBUF);
+               setbits_le32(TMPSTATUS, FLAG_PORRST);
+               writel(DV_WDT_ENABLE_SYS_RESET, &wdog->na1);
+               writel(DV_WDT_TRIGGER_SYS_RESET, &wdog->na2);
+
+               while (1);
+       }
+}
+
+static void dm365_wdt_reset(void)
+{
+       struct davinci_timer *wdog =
+               (struct davinci_timer *)DAVINCI_WDOG_BASE;
+
+       if (readl(TMPBUF) != DV_TMPBUF_VAL) {
+               writel(DV_TMPBUF_VAL, TMPBUF);
+               setbits_le32(TMPSTATUS, FLAG_PORRST);
+               setbits_le32(TMPSTATUS, FLAG_FLGOFF);
+
+               dm365_waitloop(100);
+
                dm365_vpss_sync_reset();
+
+               writel(DV_WDT_ENABLE_SYS_RESET, &wdog->na1);
+               writel(DV_WDT_TRIGGER_SYS_RESET, &wdog->na2);
+
+               while (1);
+       }
+}
+
+static void dm365_wdt_flag_on(void)
+{
+       /* VPSS_CLKMD 1:2 */
+       clrbits_le32(&dv_sys_module_regs->vpss_clkctl,
+               VPSS_CLK_CTL_VPSS_CLKMD);
+       writel(0, TMPBUF);
+       setbits_le32(TMPSTATUS, FLAG_FLGON);
 }
 
 void dm365_psc_init(void)
@@ -382,6 +423,9 @@ void dm36x_lowlevel_init(ulong bootflag)
        writel(0xffffffff, &dv_aintc_regs->irq0);
        writel(0xffffffff, &dv_aintc_regs->irq1);
 
+       dm365_por_reset();
+       dm365_wdt_reset();
+
        /* System PSC setup - enable all */
        dm365_psc_init();
 
@@ -418,6 +462,8 @@ void dm36x_lowlevel_init(ulong bootflag)
        puts("emif init\n");
        dm365_emif_init();
 
+       dm365_wdt_flag_on();
+
 #if defined(CONFIG_POST)
        /*
         * Do memory tests, calls arch_memory_failure_handle()
index 7a169b107677e58edc59fc2f4ef81ea3417ab7a8..5b39484501c1d8805931c42c1fa9f93bda40e7f6 100644 (file)
@@ -49,6 +49,7 @@
 
 .globl lowlevel_init
 lowlevel_init:
+#ifdef CONFIG_SOC_DM644X
 
        /*-------------------------------------------------------*
         * Mask all IRQs by setting all bits in the EINT default *
@@ -707,3 +708,6 @@ DDR2_START_ADDR:
        .word   0x80000000
 DUMMY_VAL:
        .word   0xa55aa55a
+#else /* CONFIG_SOC_DM644X */
+       mov pc, lr
+#endif
index f475f9ba75fa72c3988e44b88f8bfc73163e7c33..74632e516192e2ddcbf9956d4b76ce49ed7f3ac3 100644 (file)
@@ -74,12 +74,12 @@ void board_init_f(ulong dummy)
 
 void board_init_r(gd_t *id, ulong dummy)
 {
-#ifdef CONFIG_SOC_DM365
+#ifdef CONFIG_SPL_NAND_LOAD
        nand_init();
        puts("Nand boot...\n");
        nand_boot();
 #endif
-#ifdef CONFIG_SOC_DA8XX
+#ifdef CONFIG_SPL_SPI_LOAD
        mem_malloc_init(CONFIG_SYS_TEXT_BASE - CONFIG_SYS_MALLOC_LEN,
                        CONFIG_SYS_MALLOC_LEN);
 
index 07542975e68b8a259a8caef81a575eef81f4fdaf..777006c4fd905e296fcbbafe51eb14ff13b780a0 100644 (file)
@@ -30,6 +30,7 @@ COBJS-y       = cpu.o
 COBJS-y        += dram.o
 COBJS-y        += mpp.o
 COBJS-y        += timer.o
+COBJS-y        += cache.o
 
 SRCS   := $(SOBJS:.o=.S) $(COBJS-y:.o=.c)
 OBJS   := $(addprefix $(obj),$(SOBJS) $(COBJS-y))
diff --git a/arch/arm/cpu/arm926ejs/kirkwood/cache.c b/arch/arm/cpu/arm926ejs/kirkwood/cache.c
new file mode 100644 (file)
index 0000000..645d962
--- /dev/null
@@ -0,0 +1,34 @@
+/*
+ * Copyright (c) 2012 Michael Walle
+ * Michael Walle <michael@walle.cc>
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc.
+ */
+#include <common.h>
+#include <asm/arch/cpu.h>
+
+#define FEROCEON_EXTRA_FEATURE_L2C_EN (1<<22)
+
+void l2_cache_disable()
+{
+       u32 ctrl;
+
+       ctrl = readfr_extra_feature_reg();
+       ctrl &= ~FEROCEON_EXTRA_FEATURE_L2C_EN;
+       writefr_extra_feature_reg(ctrl);
+}
index a98f54c05bff1e0bc7430e1a1655a4962b479a89..f5d01603977a01affebaacfc87dd67da986d3109 100644 (file)
@@ -153,3 +153,21 @@ int timer_init(void)
 
        return 0;
 }
+
+/*
+ * This function is derived from PowerPC code (read timebase as long long).
+ * On ARM it just returns the timer value.
+ */
+unsigned long long get_ticks(void)
+{
+       return get_timer(0);
+}
+
+/*
+ * This function is derived from PowerPC code (timebase clock frequency).
+ * On ARM it returns the number of timer ticks per second.
+ */
+ulong get_tbclk (void)
+{
+       return (ulong)CONFIG_SYS_HZ;
+}
index 34c20e1bae5a1d2e97132e4489d304f7ee5fe5b6..65c481378418eca6341d350ef176a5583ea01f81 100644 (file)
@@ -23,6 +23,7 @@
 #include <netdev.h>
 #include <asm/io.h>
 #include <asm/arch/imx-regs.h>
+#include <asm/arch/clock.h>
 #ifdef CONFIG_MXC_MMC
 #include <asm/arch/mxcmmc.h>
 #endif
@@ -34,7 +35,7 @@
  *  f = 2 * f_ref * --------------------
  *                        pd + 1
  */
-unsigned int imx_decode_pll(unsigned int pll, unsigned int f_ref)
+static unsigned int imx_decode_pll(unsigned int pll, unsigned int f_ref)
 {
        unsigned int mfi = (pll >> 10) & 0xf;
        unsigned int mfn = pll & 0x3ff;
@@ -64,7 +65,7 @@ static ulong clk_in_26m(void)
        }
 }
 
-ulong imx_get_mpllclk(void)
+static ulong imx_get_mpllclk(void)
 {
        struct pll_regs *pll = (struct pll_regs *)IMX_PLL_BASE;
        ulong cscr = readl(&pll->cscr);
@@ -78,7 +79,7 @@ ulong imx_get_mpllclk(void)
        return imx_decode_pll(readl(&pll->mpctl0), fref);
 }
 
-ulong imx_get_armclk(void)
+static ulong imx_get_armclk(void)
 {
        struct pll_regs *pll = (struct pll_regs *)IMX_PLL_BASE;
        ulong cscr = readl(&pll->cscr);
@@ -93,7 +94,7 @@ ulong imx_get_armclk(void)
        return lldiv(fref, div);
 }
 
-ulong imx_get_ahbclk(void)
+static ulong imx_get_ahbclk(void)
 {
        struct pll_regs *pll = (struct pll_regs *)IMX_PLL_BASE;
        ulong cscr = readl(&pll->cscr);
@@ -105,7 +106,7 @@ ulong imx_get_ahbclk(void)
        return lldiv(fref * 2, 3 * div);
 }
 
-ulong imx_get_spllclk(void)
+static __attribute__((unused)) ulong imx_get_spllclk(void)
 {
        struct pll_regs *pll = (struct pll_regs *)IMX_PLL_BASE;
        ulong cscr = readl(&pll->cscr);
@@ -124,34 +125,50 @@ static ulong imx_decode_perclk(ulong div)
        return lldiv((imx_get_mpllclk() * 2), (div * 3));
 }
 
-ulong imx_get_perclk1(void)
+static ulong imx_get_perclk1(void)
 {
        struct pll_regs *pll = (struct pll_regs *)IMX_PLL_BASE;
 
        return imx_decode_perclk((readl(&pll->pcdr1) & 0x3f) + 1);
 }
 
-ulong imx_get_perclk2(void)
+static ulong imx_get_perclk2(void)
 {
        struct pll_regs *pll = (struct pll_regs *)IMX_PLL_BASE;
 
        return imx_decode_perclk(((readl(&pll->pcdr1) >> 8) & 0x3f) + 1);
 }
 
-ulong imx_get_perclk3(void)
+static __attribute__((unused)) ulong imx_get_perclk3(void)
 {
        struct pll_regs *pll = (struct pll_regs *)IMX_PLL_BASE;
 
        return imx_decode_perclk(((readl(&pll->pcdr1) >> 16) & 0x3f) + 1);
 }
 
-ulong imx_get_perclk4(void)
+static __attribute__((unused)) ulong imx_get_perclk4(void)
 {
        struct pll_regs *pll = (struct pll_regs *)IMX_PLL_BASE;
 
        return imx_decode_perclk(((readl(&pll->pcdr1) >> 24) & 0x3f) + 1);
 }
 
+unsigned int mxc_get_clock(enum mxc_clock clk)
+{
+       switch (clk) {
+       case MXC_ARM_CLK:
+               return imx_get_armclk();
+       case MXC_UART_CLK:
+               return imx_get_perclk1();
+       case MXC_FEC_CLK:
+               return imx_get_ahbclk();
+       case MXC_ESDHC_CLK:
+               return imx_get_perclk2();
+       }
+       return -1;
+}
+
+
 #if defined(CONFIG_DISPLAY_CPUINFO)
 int print_cpuinfo (void)
 {
index da903605a2ba5ca5e49d5955ce7de8526535e748..683777f50cf6e4612cf24da532469063494f52ac 100644 (file)
@@ -169,7 +169,8 @@ int arch_cpu_init(void)
 #if defined(CONFIG_DISPLAY_CPUINFO)
 int print_cpuinfo(void)
 {
-       printf("Freescale i.MX28 family\n");
+       printf("Freescale i.MX28 family at %d MHz\n",
+                       mxc_get_clock(MXC_ARM_CLK) / 1000000);
        return 0;
 }
 #endif
index e39ecc245b476fd25ea4a030e9580af179570b43..8a8aaf15d901b440f4437afa56efb68233586866 100644 (file)
@@ -167,3 +167,21 @@ void timer_init_r(void)
        lastdec = read_timer();
        timestamp = 0;
 }
+
+/*
+ * This function is derived from PowerPC code (read timebase as long long).
+ * On ARM it just returns the timer value.
+ */
+unsigned long long get_ticks(void)
+{
+       return get_timer(0);
+}
+
+/*
+ * This function is derived from PowerPC code (timebase clock frequency).
+ * On ARM it returns the number of timer ticks per second.
+ */
+ulong get_tbclk (void)
+{
+       return (ulong)CONFIG_SYS_HZ;
+}
index 17045b1c2f688e423e39254125a4032e89f652fa..28aadada7033bad0e82a9a4b7a2e2e34198b4935 100644 (file)
@@ -197,3 +197,21 @@ void reset_cpu (unsigned long ignored)
        /*enable functional WDT clock */
        writel(APBC_APBCLK | APBC_FNCLK, &mpmu->wdtpcr);
 }
+
+/*
+ * This function is derived from PowerPC code (read timebase as long long).
+ * On ARM it just returns the timer value.
+ */
+unsigned long long get_ticks(void)
+{
+       return get_timer(0);
+}
+
+/*
+ * This function is derived from PowerPC code (timebase clock frequency).
+ * On ARM it returns the number of timer ticks per second.
+ */
+ulong get_tbclk (void)
+{
+       return (ulong)CONFIG_SYS_HZ;
+}
index 6a09c028e45357f68cbac3aa3502c3a5af9a737a..6f05f1ac49c0e2c1d19a1eafb4bfdc418b214c35 100644 (file)
@@ -194,7 +194,9 @@ reset:
         * we do sys-critical inits only at reboot,
         * not when booting from ram!
         */
+#ifndef CONFIG_SKIP_LOWLEVEL_INIT
        bl      cpu_init_crit
+#endif
 
 /* Set stackpointer in internal RAM to call board_init_f */
 call_board_init_f:
@@ -353,33 +355,45 @@ _dynsym_start_ofs:
  *
  *************************************************************************
  */
+#ifndef CONFIG_SKIP_LOWLEVEL_INIT
 cpu_init_crit:
        /*
-        * flush v4 I/D caches
+        * flush D cache before disabling it
         */
        mov     r0, #0
-       mcr     p15, 0, r0, c7, c7, 0   /* flush v3/v4 cache */
-       mcr     p15, 0, r0, c8, c7, 0   /* flush v4 TLB */
+flush_dcache:
+       mrc     p15, 0, r15, c7, c10, 3
+       bne     flush_dcache
+
+       mcr     p15, 0, r0, c8, c7, 0   /* invalidate TLB */
+       mcr     p15, 0, r0, c7, c5, 0   /* invalidate I Cache */
 
        /*
-        * disable MMU stuff and caches
+        * disable MMU and D cache
+        * enable I cache if CONFIG_SYS_ICACHE_OFF is not defined
         */
        mrc     p15, 0, r0, c1, c0, 0
-       bic     r0, r0, #0x00002300     /* clear bits 13, 9:8 (--V- --RS) */
+       bic     r0, r0, #0x00000300     /* clear bits 9:8 (---- --RS) */
        bic     r0, r0, #0x00000087     /* clear bits 7, 2:0 (B--- -CAM) */
+#ifdef CONFIG_SYS_EXCEPTION_VECTORS_HIGH
+       orr     r0, r0, #0x00002000     /* set bit 13 (--V- ----) */
+#else
+       bic     r0, r0, #0x00002000     /* clear bit 13 (--V- ----) */
+#endif
        orr     r0, r0, #0x00000002     /* set bit 2 (A) Align */
+#ifndef CONFIG_SYS_ICACHE_OFF
        orr     r0, r0, #0x00001000     /* set bit 12 (I) I-Cache */
+#endif
        mcr     p15, 0, r0, c1, c0, 0
 
-#ifndef CONFIG_SKIP_LOWLEVEL_INIT
        /*
         * Go setup Memory and board specific bits prior to relocation.
         */
        mov     ip, lr          /* perserve link reg across call */
        bl      lowlevel_init   /* go setup pll,mux,memory */
        mov     lr, ip          /* restore link */
-#endif /* CONFIG_SKIP_LOWLEVEL_INIT */
        mov     pc, lr          /* back to my caller */
+#endif /* CONFIG_SKIP_LOWLEVEL_INIT */
 
 #ifndef CONFIG_SPL_BUILD
 /*
index 98cfd938140d219c3e098d7267f46a5f62900024..bbb9c1353f211fd563c8bf1807c087f8662a60cc 100644 (file)
@@ -113,6 +113,11 @@ static void enable_per_clocks(void)
        writel(PRCM_MOD_EN, &cmper->mmc0clkctrl);
        while (readl(&cmper->mmc0clkctrl) != PRCM_MOD_EN)
                ;
+
+       /* i2c0 */
+       writel(PRCM_MOD_EN, &cmwkup->wkup_i2c0ctrl);
+       while (readl(&cmwkup->wkup_i2c0ctrl) != PRCM_MOD_EN)
+               ;
 }
 
 static void mpu_pll_config(void)
index 64de262737e06531081e536727938bf13b1d7830..2f7048b6a33e39540d4a68e38e99522854f981de 100644 (file)
 #include <asm/arch/clock.h>
 #include <asm/arch/clk.h>
 
-#ifndef CONFIG_SYS_CLK_FREQ_C210
-#define CONFIG_SYS_CLK_FREQ_C210       24000000
-#endif
-
 /* exynos4: return pll clock frequency */
 static unsigned long exynos4_get_pll_clk(int pllreg)
 {
@@ -76,7 +72,73 @@ static unsigned long exynos4_get_pll_clk(int pllreg)
        /* SDIV [2:0] */
        s = r & 0x7;
 
-       freq = CONFIG_SYS_CLK_FREQ_C210;
+       freq = CONFIG_SYS_CLK_FREQ;
+
+       if (pllreg == EPLL) {
+               k = k & 0xffff;
+               /* FOUT = (MDIV + K / 65536) * FIN / (PDIV * 2^SDIV) */
+               fout = (m + k / 65536) * (freq / (p * (1 << s)));
+       } else if (pllreg == VPLL) {
+               k = k & 0xfff;
+               /* FOUT = (MDIV + K / 1024) * FIN / (PDIV * 2^SDIV) */
+               fout = (m + k / 1024) * (freq / (p * (1 << s)));
+       } else {
+               if (s < 1)
+                       s = 1;
+               /* FOUT = MDIV * FIN / (PDIV * 2^(SDIV - 1)) */
+               fout = m * (freq / (p * (1 << (s - 1))));
+       }
+
+       return fout;
+}
+
+/* exynos5: return pll clock frequency */
+static unsigned long exynos5_get_pll_clk(int pllreg)
+{
+       struct exynos5_clock *clk =
+               (struct exynos5_clock *)samsung_get_base_clock();
+       unsigned long r, m, p, s, k = 0, mask, fout;
+       unsigned int freq;
+
+       switch (pllreg) {
+       case APLL:
+               r = readl(&clk->apll_con0);
+               break;
+       case MPLL:
+               r = readl(&clk->mpll_con0);
+               break;
+       case EPLL:
+               r = readl(&clk->epll_con0);
+               k = readl(&clk->epll_con1);
+               break;
+       case VPLL:
+               r = readl(&clk->vpll_con0);
+               k = readl(&clk->vpll_con1);
+               break;
+       default:
+               printf("Unsupported PLL (%d)\n", pllreg);
+               return 0;
+       }
+
+       /*
+        * APLL_CON: MIDV [25:16]
+        * MPLL_CON: MIDV [25:16]
+        * EPLL_CON: MIDV [24:16]
+        * VPLL_CON: MIDV [24:16]
+        */
+       if (pllreg == APLL || pllreg == MPLL)
+               mask = 0x3ff;
+       else
+               mask = 0x1ff;
+
+       m = (r >> 16) & mask;
+
+       /* PDIV [13:8] */
+       p = (r >> 8) & 0x3f;
+       /* SDIV [2:0] */
+       s = r & 0x7;
+
+       freq = CONFIG_SYS_CLK_FREQ;
 
        if (pllreg == EPLL) {
                k = k & 0xffff;
@@ -102,17 +164,42 @@ static unsigned long exynos4_get_arm_clk(void)
        struct exynos4_clock *clk =
                (struct exynos4_clock *)samsung_get_base_clock();
        unsigned long div;
-       unsigned long dout_apll;
-       unsigned int apll_ratio;
+       unsigned long armclk;
+       unsigned int core_ratio;
+       unsigned int core2_ratio;
+
+       div = readl(&clk->div_cpu0);
+
+       /* CORE_RATIO: [2:0], CORE2_RATIO: [30:28] */
+       core_ratio = (div >> 0) & 0x7;
+       core2_ratio = (div >> 28) & 0x7;
+
+       armclk = get_pll_clk(APLL) / (core_ratio + 1);
+       armclk /= (core2_ratio + 1);
+
+       return armclk;
+}
+
+/* exynos5: return ARM clock frequency */
+static unsigned long exynos5_get_arm_clk(void)
+{
+       struct exynos5_clock *clk =
+               (struct exynos5_clock *)samsung_get_base_clock();
+       unsigned long div;
+       unsigned long armclk;
+       unsigned int arm_ratio;
+       unsigned int arm2_ratio;
 
        div = readl(&clk->div_cpu0);
 
-       /* APLL_RATIO: [26:24] */
-       apll_ratio = (div >> 24) & 0x7;
+       /* ARM_RATIO: [2:0], ARM2_RATIO: [30:28] */
+       arm_ratio = (div >> 0) & 0x7;
+       arm2_ratio = (div >> 28) & 0x7;
 
-       dout_apll = get_pll_clk(APLL) / (apll_ratio + 1);
+       armclk = get_pll_clk(APLL) / (arm_ratio + 1);
+       armclk /= (arm2_ratio + 1);
 
-       return dout_apll;
+       return armclk;
 }
 
 /* exynos4: return pwm clock frequency */
@@ -158,6 +245,27 @@ static unsigned long exynos4_get_pwm_clk(void)
        return pclk;
 }
 
+/* exynos5: return pwm clock frequency */
+static unsigned long exynos5_get_pwm_clk(void)
+{
+       struct exynos5_clock *clk =
+               (struct exynos5_clock *)samsung_get_base_clock();
+       unsigned long pclk, sclk;
+       unsigned int ratio;
+
+       /*
+        * CLK_DIV_PERIC3
+        * PWM_RATIO [3:0]
+        */
+       ratio = readl(&clk->div_peric3);
+       ratio = ratio & 0xf;
+       sclk = get_pll_clk(MPLL);
+
+       pclk = sclk / (ratio + 1);
+
+       return pclk;
+}
+
 /* exynos4: return uart clock frequency */
 static unsigned long exynos4_get_uart_clk(int dev_index)
 {
@@ -205,6 +313,53 @@ static unsigned long exynos4_get_uart_clk(int dev_index)
        return uclk;
 }
 
+/* exynos5: return uart clock frequency */
+static unsigned long exynos5_get_uart_clk(int dev_index)
+{
+       struct exynos5_clock *clk =
+               (struct exynos5_clock *)samsung_get_base_clock();
+       unsigned long uclk, sclk;
+       unsigned int sel;
+       unsigned int ratio;
+
+       /*
+        * CLK_SRC_PERIC0
+        * UART0_SEL [3:0]
+        * UART1_SEL [7:4]
+        * UART2_SEL [8:11]
+        * UART3_SEL [12:15]
+        * UART4_SEL [16:19]
+        * UART5_SEL [23:20]
+        */
+       sel = readl(&clk->src_peric0);
+       sel = (sel >> (dev_index << 2)) & 0xf;
+
+       if (sel == 0x6)
+               sclk = get_pll_clk(MPLL);
+       else if (sel == 0x7)
+               sclk = get_pll_clk(EPLL);
+       else if (sel == 0x8)
+               sclk = get_pll_clk(VPLL);
+       else
+               return 0;
+
+       /*
+        * CLK_DIV_PERIC0
+        * UART0_RATIO [3:0]
+        * UART1_RATIO [7:4]
+        * UART2_RATIO [8:11]
+        * UART3_RATIO [12:15]
+        * UART4_RATIO [16:19]
+        * UART5_RATIO [23:20]
+        */
+       ratio = readl(&clk->div_peric0);
+       ratio = (ratio >> (dev_index << 2)) & 0xf;
+
+       uclk = sclk / (ratio + 1);
+
+       return uclk;
+}
+
 /* exynos4: set the mmc clock */
 static void exynos4_set_mmc_clk(int dev_index, unsigned int div)
 {
@@ -232,27 +387,69 @@ static void exynos4_set_mmc_clk(int dev_index, unsigned int div)
        writel(val, addr);
 }
 
+/* exynos5: set the mmc clock */
+static void exynos5_set_mmc_clk(int dev_index, unsigned int div)
+{
+       struct exynos5_clock *clk =
+               (struct exynos5_clock *)samsung_get_base_clock();
+       unsigned int addr;
+       unsigned int val;
+
+       /*
+        * CLK_DIV_FSYS1
+        * MMC0_PRE_RATIO [15:8], MMC1_PRE_RATIO [31:24]
+        * CLK_DIV_FSYS2
+        * MMC2_PRE_RATIO [15:8], MMC3_PRE_RATIO [31:24]
+        */
+       if (dev_index < 2) {
+               addr = (unsigned int)&clk->div_fsys1;
+       } else {
+               addr = (unsigned int)&clk->div_fsys2;
+               dev_index -= 2;
+       }
+
+       val = readl(addr);
+       val &= ~(0xff << ((dev_index << 4) + 8));
+       val |= (div & 0xff) << ((dev_index << 4) + 8);
+       writel(val, addr);
+}
+
 unsigned long get_pll_clk(int pllreg)
 {
-       return exynos4_get_pll_clk(pllreg);
+       if (cpu_is_exynos5())
+               return exynos5_get_pll_clk(pllreg);
+       else
+               return exynos4_get_pll_clk(pllreg);
 }
 
 unsigned long get_arm_clk(void)
 {
-       return exynos4_get_arm_clk();
+       if (cpu_is_exynos5())
+               return exynos5_get_arm_clk();
+       else
+               return exynos4_get_arm_clk();
 }
 
 unsigned long get_pwm_clk(void)
 {
-       return exynos4_get_pwm_clk();
+       if (cpu_is_exynos5())
+               return exynos5_get_pwm_clk();
+       else
+               return exynos4_get_pwm_clk();
 }
 
 unsigned long get_uart_clk(int dev_index)
 {
-       return exynos4_get_uart_clk(dev_index);
+       if (cpu_is_exynos5())
+               return exynos5_get_uart_clk(dev_index);
+       else
+               return exynos4_get_uart_clk(dev_index);
 }
 
 void set_mmc_clk(int dev_index, unsigned int div)
 {
-       exynos4_set_mmc_clk(dev_index, div);
+       if (cpu_is_exynos5())
+               exynos5_set_mmc_clk(dev_index, div);
+       else
+               exynos4_set_mmc_clk(dev_index, div);
 }
index 1533dd872258380fe04f193d84ff186e8f7b23c4..3f5a4f726c70910bcbda382f8c34bed6c1f6d358 100644 (file)
@@ -72,7 +72,7 @@ u32 get_cpu_rev(void)
 }
 
 #if defined(CONFIG_FEC_MXC)
-void imx_get_mac_from_fuse(unsigned char *mac)
+void imx_get_mac_from_fuse(int dev_id, unsigned char *mac)
 {
        int i;
        struct iim_regs *iim = (struct iim_regs *)IMX_IIM_BASE;
index 1da90a4d9333b4286384b4a7ae8689585fdc5665..4cfe11991ab84afdcc48125c2c19d8cdc28ff09f 100644 (file)
@@ -251,6 +251,35 @@ void configure_mpu_dpll(void)
        debug("MPU DPLL locked\n");
 }
 
+#ifdef CONFIG_USB_EHCI_OMAP
+static void setup_usb_dpll(void)
+{
+       const struct dpll_params *params;
+       u32 sys_clk_khz, sd_div, num, den;
+
+       sys_clk_khz = get_sys_clk_freq() / 1000;
+       /*
+        * USB:
+        * USB dpll is J-type. Need to set DPLL_SD_DIV for jitter correction
+        * DPLL_SD_DIV = CEILING ([DPLL_MULT/(DPLL_DIV+1)]* CLKINP / 250)
+        *      - where CLKINP is sys_clk in MHz
+        * Use CLKINP in KHz and adjust the denominator accordingly so
+        * that we have enough accuracy and at the same time no overflow
+        */
+       params = get_usb_dpll_params();
+       num = params->m * sys_clk_khz;
+       den = (params->n + 1) * 250 * 1000;
+       num += den - 1;
+       sd_div = num / den;
+       clrsetbits_le32(&prcm->cm_clksel_dpll_usb,
+                       CM_CLKSEL_DPLL_DPLL_SD_DIV_MASK,
+                       sd_div << CM_CLKSEL_DPLL_DPLL_SD_DIV_SHIFT);
+
+       /* Now setup the dpll with the regular function */
+       do_setup_dpll(&prcm->cm_clkmode_dpll_usb, params, DPLL_LOCK, "usb");
+}
+#endif
+
 static void setup_dplls(void)
 {
        u32 temp;
@@ -282,13 +311,16 @@ static void setup_dplls(void)
 
        /* MPU dpll */
        configure_mpu_dpll();
+
+#ifdef CONFIG_USB_EHCI_OMAP
+       setup_usb_dpll();
+#endif
 }
 
 #ifdef CONFIG_SYS_CLOCKS_ENABLE_ALL
 static void setup_non_essential_dplls(void)
 {
        u32 sys_clk_khz, abe_ref_clk;
-       u32 sd_div, num, den;
        const struct dpll_params *params;
 
        sys_clk_khz = get_sys_clk_freq() / 1000;
@@ -300,26 +332,6 @@ static void setup_non_essential_dplls(void)
        params = get_iva_dpll_params();
        do_setup_dpll(&prcm->cm_clkmode_dpll_iva, params, DPLL_LOCK, "iva");
 
-       /*
-        * USB:
-        * USB dpll is J-type. Need to set DPLL_SD_DIV for jitter correction
-        * DPLL_SD_DIV = CEILING ([DPLL_MULT/(DPLL_DIV+1)]* CLKINP / 250)
-        *      - where CLKINP is sys_clk in MHz
-        * Use CLKINP in KHz and adjust the denominator accordingly so
-        * that we have enough accuracy and at the same time no overflow
-        */
-       params = get_usb_dpll_params();
-       num = params->m * sys_clk_khz;
-       den = (params->n + 1) * 250 * 1000;
-       num += den - 1;
-       sd_div = num / den;
-       clrsetbits_le32(&prcm->cm_clksel_dpll_usb,
-                       CM_CLKSEL_DPLL_DPLL_SD_DIV_MASK,
-                       sd_div << CM_CLKSEL_DPLL_DPLL_SD_DIV_SHIFT);
-
-       /* Now setup the dpll with the regular function */
-       do_setup_dpll(&prcm->cm_clkmode_dpll_usb, params, DPLL_LOCK, "usb");
-
        /* Configure ABE dpll */
        params = get_abe_dpll_params();
 #ifdef CONFIG_SYS_OMAP_ABE_SYSCK
index 49cdc3936e6829a91b98d2c081b0a3bc1387fa85..ab46bff5af7ab32b62e9fbb243e0896737c2a1aa 100644 (file)
@@ -120,6 +120,8 @@ void s_init(void)
 #endif
        prcm_init();
 #ifdef CONFIG_SPL_BUILD
+       timer_init();
+
        /* For regular u-boot sdram_init() is called from dram_init() */
        sdram_init();
        init_boot_params();
index 871aa37df8d4d6de7d935d42cc02135b10dc4775..637ab7b6bf07334a1b5e5c8afc45ae1c38da0a18 100644 (file)
@@ -144,7 +144,7 @@ void secureworld_exit()
 {
        unsigned long i;
 
-       /* configrue non-secure access control register */
+       /* configure non-secure access control register */
        __asm__ __volatile__("mrc p15, 0, %0, c1, c1, 2":"=r"(i));
        /* enabling co-processor CP10 and CP11 accesses in NS world */
        __asm__ __volatile__("orr %0, %0, #0xC00":"=r"(i));
@@ -228,6 +228,10 @@ void s_init(void)
 
        per_clocks_enable();
 
+#ifdef CONFIG_USB_EHCI_OMAP
+       ehci_clocks_enable();
+#endif
+
 #ifdef CONFIG_SPL_BUILD
        preloader_console_init();
 
@@ -389,7 +393,7 @@ static void omap3_setup_aux_cr(void)
 {
        /* Workaround for Cortex-A8 errata: #454179 #430973
         *      Set "IBE" bit
-        *      Set "Disable Brach Size Mispredicts" bit
+        *      Set "Disable Branch Size Mispredicts" bit
         * Workaround for erratum #621766
         *      Enable L1NEON bit
         * ACR |= (IBE | DBSM | L1NEON) => ACR |= 0xE0
index e0d65c7a4abca53006f58ca679fa6e657f82579e..567817e0ec3b062c3ee2a66c901b14ab1b44a8b2 100644 (file)
@@ -626,6 +626,26 @@ void prcm_init(void)
        sdelay(5000);
 }
 
+/*
+ * Enable usb ehci uhh, tll clocks
+ */
+void ehci_clocks_enable(void)
+{
+       struct prcm *prcm_base = (struct prcm *)PRCM_BASE;
+
+       /* Enable USBHOST_L3_ICLK (USBHOST_MICLK) */
+       sr32(&prcm_base->iclken_usbhost, 0, 1, 1);
+       /*
+        * Enable USBHOST_48M_FCLK (USBHOST_FCLK1)
+        * and USBHOST_120M_FCLK (USBHOST_FCLK2)
+        */
+       sr32(&prcm_base->fclken_usbhost, 0, 2, 3);
+       /* Enable USBTTL_ICLK */
+       sr32(&prcm_base->iclken3_core, 2, 1, 1);
+       /* Enable USBTTL_FCLK */
+       sr32(&prcm_base->fclken3_core, 2, 1, 1);
+}
+
 /******************************************************************************
  * peripheral_enable() - Enable the clks & power for perifs (GPT2, UART1,...)
  *****************************************************************************/
index 2f6930b22d1bed85e40bed1407a07952c2b631b3..c42c5ddcc9ffac518e4bf064e0934cd57ad82448 100644 (file)
 _TEXT_BASE:
        .word   CONFIG_SYS_TEXT_BASE    /* sdram load addr from config.mk */
 
+#ifdef CONFIG_SPL_BUILD
 .global save_boot_params
 save_boot_params:
-#ifdef CONFIG_SPL_BUILD
        ldr     r4, =omap3_boot_device
        ldr     r5, [r0, #0x4]
        and     r5, r5, #0xff
        str     r5, [r4]
-#endif
        bx      lr
+#endif
 
 .global omap3_gp_romcode_call
 omap3_gp_romcode_call:
index a27b4b124e7c4c1726d28c3eca3e051921e9e9da..91f42c0e2cd1dc9df1d7a30633f30e6137ef6cdf 100644 (file)
@@ -102,7 +102,7 @@ u32 get_sdr_cs_offset(u32 cs)
                return 0;
 
        offset = readl(&sdrc_base->cs_cfg);
-       offset = (offset & 15) << 27 | (offset & 0x30) << 17;
+       offset = (offset & 15) << 27 | (offset & 0x300) << 17;
 
        return offset;
 }
index 0886f92431ad87ace2cd2823196580b8cd3693e7..e2189f729f9e446bb56ed142e1dc884ee6b743c7 100644 (file)
@@ -67,15 +67,15 @@ const u32 sys_clk_array[8] = {
  * Please use this tool for creating the table for any new frequency.
  */
 
-/* dpll locked at 1840 MHz MPU clk at 920 MHz(OPP Turbo 4460) - DCC OFF */
-static const struct dpll_params mpu_dpll_params_1840mhz[NUM_SYS_CLKS] = {
-       {230, 2, 1, -1, -1, -1, -1, -1},        /* 12 MHz   */
-       {920, 12, 1, -1, -1, -1, -1, -1},       /* 13 MHz   */
-       {219, 3, 1, -1, -1, -1, -1, -1},        /* 16.8 MHz */
-       {575, 11, 1, -1, -1, -1, -1, -1},       /* 19.2 MHz */
-       {460, 12, 1, -1, -1, -1, -1, -1},       /* 26 MHz   */
-       {920, 26, 1, -1, -1, -1, -1, -1},       /* 27 MHz   */
-       {575, 23, 1, -1, -1, -1, -1, -1}        /* 38.4 MHz */
+/* dpll locked at 1400 MHz MPU clk at 700 MHz(OPP100) - DCC OFF */
+static const struct dpll_params mpu_dpll_params_1400mhz[NUM_SYS_CLKS] = {
+       {175, 2, 1, -1, -1, -1, -1, -1},        /* 12 MHz   */
+       {700, 12, 1, -1, -1, -1, -1, -1},       /* 13 MHz   */
+       {125, 2, 1, -1, -1, -1, -1, -1},        /* 16.8 MHz */
+       {401, 10, 1, -1, -1, -1, -1, -1},       /* 19.2 MHz */
+       {350, 12, 1, -1, -1, -1, -1, -1},       /* 26 MHz   */
+       {700, 26, 1, -1, -1, -1, -1, -1},       /* 27 MHz   */
+       {638, 34, 1, -1, -1, -1, -1, -1}        /* 38.4 MHz */
 };
 
 /* dpll locked at 1584 MHz - MPU clk at 792 MHz(OPP Turbo 4430) */
@@ -217,7 +217,7 @@ const struct dpll_params *get_mpu_dpll_params(void)
        else if (omap_rev < OMAP4460_ES1_0)
                return &mpu_dpll_params_1600mhz[sysclk_ind];
        else
-               return &mpu_dpll_params_1840mhz[sysclk_ind];
+               return &mpu_dpll_params_1400mhz[sysclk_ind];
 }
 
 const struct dpll_params *get_core_dpll_params(void)
@@ -280,7 +280,7 @@ void scale_vcores(void)
        omap_rev = omap_revision();
        /* TPS - supplies vdd_mpu on 4460 */
        if (omap_rev >= OMAP4460_ES1_0) {
-               volt = 1313;
+               volt = 1203;
                do_scale_tps62361(TPS62361_REG_ADDR_SET1, volt);
        }
 
@@ -342,6 +342,9 @@ void enable_basic_clocks(void)
                &prcm->cm_l4per_gpio4_clkctrl,
                &prcm->cm_l4per_gpio5_clkctrl,
                &prcm->cm_l4per_gpio6_clkctrl,
+               &prcm->cm_l3init_usbphy_clkctrl,
+               &prcm->cm_clksel_usb_60mhz,
+               &prcm->cm_l3init_hsusbtll_clkctrl,
                0
        };
 
@@ -352,6 +355,8 @@ void enable_basic_clocks(void)
                &prcm->cm_l4per_gptimer2_clkctrl,
                &prcm->cm_wkup_wdtimer2_clkctrl,
                &prcm->cm_l4per_uart3_clkctrl,
+               &prcm->cm_l3init_fsusb_clkctrl,
+               &prcm->cm_l3init_hsusbhost_clkctrl,
                0
        };
 
index 17053995bd61aa21e26ee20b8917528b09400c41..f975f3f06c9fbca7f1fe904eae34d5f57f2dde4a 100644 (file)
@@ -28,6 +28,7 @@ LIB   = $(obj)libs5p-common.o
 COBJS-y                += cpu_info.o
 COBJS-y                += timer.o
 COBJS-y                += sromc.o
+COBJS-y                += wdt.o
 COBJS-$(CONFIG_PWM)    += pwm.o
 
 SRCS   := $(SOBJS:.o=.S) $(COBJS:.o=.c)
diff --git a/arch/arm/cpu/armv7/s5p-common/wdt.c b/arch/arm/cpu/armv7/s5p-common/wdt.c
new file mode 100644 (file)
index 0000000..94acc1e
--- /dev/null
@@ -0,0 +1,59 @@
+/*
+ * Copyright (C) 2012 Samsung Electronics
+ * Minkyu Kang <mk7.kang@samsung.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/io.h>
+#include <asm/arch/watchdog.h>
+
+#define PRESCALER_VAL 255
+
+void wdt_stop(void)
+{
+       struct s5p_watchdog *wdt =
+               (struct s5p_watchdog *)samsung_get_base_watchdog();
+       unsigned int wtcon;
+
+       wtcon = readl(&wdt->wtcon);
+       wtcon &= ~(WTCON_EN | WTCON_INT | WTCON_RESET);
+
+       writel(wtcon, &wdt->wtcon);
+}
+
+void wdt_start(unsigned int timeout)
+{
+       struct s5p_watchdog *wdt =
+               (struct s5p_watchdog *)samsung_get_base_watchdog();
+       unsigned int wtcon;
+
+       wdt_stop();
+
+       wtcon = readl(&wdt->wtcon);
+       wtcon |= (WTCON_EN | WTCON_CLK(WTCON_CLK_128));
+       wtcon &= ~WTCON_INT;
+       wtcon |= WTCON_RESET;
+       wtcon |= WTCON_PRESCALER(PRESCALER_VAL);
+
+       writel(timeout, &wdt->wtdat);
+       writel(timeout, &wdt->wtcnt);
+       writel(wtcon, &wdt->wtcon);
+}
index ea06570bfaf71ed0f4d2cb5ef950b8cd2259d4fe..349d50e1ac4adbc1b509d0d5a7302d384a42c663 100644 (file)
@@ -58,9 +58,9 @@ unsigned int query_sdram_size(void)
        case 1:
                return 0x10000000;      /* 256 MB */
        case 2:
+       default:
                return 0x20000000;      /* 512 MB */
        case 3:
-       default:
                return 0x40000000;      /* 1GB */
        }
 }
@@ -120,7 +120,7 @@ static void setup_uarts(int uart_ids)
                if (uart_ids & (1 << i)) {
                        enum periph_id id = id_for_uart[i];
 
-                       funcmux_select(id, 0);
+                       funcmux_select(id, FUNCMUX_DEFAULT);
                        clock_ll_start_uart(id);
                }
        }
@@ -141,3 +141,11 @@ void board_init_uart_f(void)
 #endif
        setup_uarts(uart_ids);
 }
+
+#ifndef CONFIG_SYS_DCACHE_OFF
+void enable_caches(void)
+{
+       /* Enable D-cache. I-cache is already enabled in start.S */
+       dcache_enable();
+}
+#endif
index 0878f511104f0dedfde820a76ea663d5823c75f6..c1d2dfec5f02dea5c8631ca9222c3d7be13cb486 100644 (file)
 /* Tegra2 high-level function multiplexing */
 #include <common.h>
 #include <asm/arch/clock.h>
+#include <asm/arch/funcmux.h>
 #include <asm/arch/pinmux.h>
 
 int funcmux_select(enum periph_id id, int config)
 {
-       if (config != 0) {
-               debug("%s: invalid config %d for periph_id %d", __func__,
-                     config, id);
-               return -1;
-       }
+       int bad_config = config != FUNCMUX_DEFAULT;
+
        switch (id) {
        case PERIPH_ID_UART1:
-               pinmux_set_func(PINGRP_IRRX, PMUX_FUNC_UARTA);
-               pinmux_set_func(PINGRP_IRTX, PMUX_FUNC_UARTA);
-               pinmux_tristate_disable(PINGRP_IRRX);
-               pinmux_tristate_disable(PINGRP_IRTX);
+               if (config == FUNCMUX_UART1_IRRX_IRTX) {
+                       pinmux_set_func(PINGRP_IRRX, PMUX_FUNC_UARTA);
+                       pinmux_set_func(PINGRP_IRTX, PMUX_FUNC_UARTA);
+                       pinmux_tristate_disable(PINGRP_IRRX);
+                       pinmux_tristate_disable(PINGRP_IRTX);
+                       /*
+                        * Tegra appears to boot with function UARTA pre-
+                        * selected on mux group SDB. If two mux groups are
+                        * both set to the same function, it's unclear which
+                        * group's pins drive the RX signals into the HW.
+                        * For UARTA, SDB certainly overrides group IRTX in
+                        * practice. To solve this, configure some alternative
+                        * function on SDB to avoid the conflict. Also, tri-
+                        * state the group to avoid driving any signal onto it
+                        * until we know what's connected.
+                        */
+                       pinmux_tristate_enable(PINGRP_SDB);
+                       pinmux_set_func(PINGRP_SDB,  PMUX_FUNC_SDIO3);
+               }
                break;
 
        case PERIPH_ID_UART2:
-               pinmux_set_func(PINGRP_UAD, PMUX_FUNC_IRDA);
-               pinmux_tristate_disable(PINGRP_UAD);
+               if (config == FUNCMUX_UART2_IRDA) {
+                       pinmux_set_func(PINGRP_UAD, PMUX_FUNC_IRDA);
+                       pinmux_tristate_disable(PINGRP_UAD);
+               }
                break;
 
        case PERIPH_ID_UART4:
-               pinmux_set_func(PINGRP_GMC, PMUX_FUNC_UARTD);
-               pinmux_tristate_disable(PINGRP_GMC);
+               if (config == FUNCMUX_UART4_GMC) {
+                       pinmux_set_func(PINGRP_GMC, PMUX_FUNC_UARTD);
+                       pinmux_tristate_disable(PINGRP_GMC);
+               }
+               break;
+
+       case PERIPH_ID_DVC_I2C:
+               /* there is only one selection, pinmux_config is ignored */
+               if (config == FUNCMUX_DVC_I2CP) {
+                       pinmux_set_func(PINGRP_I2CP, PMUX_FUNC_I2C);
+                       pinmux_tristate_disable(PINGRP_I2CP);
+               }
+               break;
+
+       case PERIPH_ID_I2C1:
+               /* support pinmux_config of 0 for now, */
+               if (config == FUNCMUX_I2C1_RM) {
+                       pinmux_set_func(PINGRP_RM, PMUX_FUNC_I2C);
+                       pinmux_tristate_disable(PINGRP_RM);
+               }
+               break;
+       case PERIPH_ID_I2C2: /* I2C2 */
+               switch (config) {
+               case FUNCMUX_I2C2_DDC:  /* DDC pin group, select I2C2 */
+                       pinmux_set_func(PINGRP_DDC, PMUX_FUNC_I2C2);
+                       /* PTA to HDMI */
+                       pinmux_set_func(PINGRP_PTA, PMUX_FUNC_HDMI);
+                       pinmux_tristate_disable(PINGRP_DDC);
+                       break;
+               case FUNCMUX_I2C2_PTA:  /* PTA pin group, select I2C2 */
+                       pinmux_set_func(PINGRP_PTA, PMUX_FUNC_I2C2);
+                       /* set DDC_SEL to RSVDx (RSVD2 works for now) */
+                       pinmux_set_func(PINGRP_DDC, PMUX_FUNC_RSVD2);
+                       pinmux_tristate_disable(PINGRP_PTA);
+                       bad_config = 0;
+                       break;
+               }
+               break;
+       case PERIPH_ID_I2C3: /* I2C3 */
+               /* support pinmux_config of 0 for now */
+               if (config == FUNCMUX_I2C3_DTF) {
+                       pinmux_set_func(PINGRP_DTF, PMUX_FUNC_I2C3);
+                       pinmux_tristate_disable(PINGRP_DTF);
+               }
+               break;
+
+       case PERIPH_ID_SDMMC2:
+               if (config == FUNCMUX_SDMMC2_DTA_DTD_8BIT) {
+                       pinmux_set_func(PINGRP_DTA, PMUX_FUNC_SDIO2);
+                       pinmux_set_func(PINGRP_DTD, PMUX_FUNC_SDIO2);
+
+                       pinmux_tristate_disable(PINGRP_DTA);
+                       pinmux_tristate_disable(PINGRP_DTD);
+               }
+               break;
+
+       case PERIPH_ID_SDMMC3:
+               switch (config) {
+               case FUNCMUX_SDMMC3_SDB_SLXA_8BIT:
+                       pinmux_set_func(PINGRP_SLXA, PMUX_FUNC_SDIO3);
+                       pinmux_set_func(PINGRP_SLXC, PMUX_FUNC_SDIO3);
+                       pinmux_set_func(PINGRP_SLXD, PMUX_FUNC_SDIO3);
+                       pinmux_set_func(PINGRP_SLXK, PMUX_FUNC_SDIO3);
+
+                       pinmux_tristate_disable(PINGRP_SLXA);
+                       pinmux_tristate_disable(PINGRP_SLXC);
+                       pinmux_tristate_disable(PINGRP_SLXD);
+                       pinmux_tristate_disable(PINGRP_SLXK);
+                       /* fall through */
+
+               case FUNCMUX_SDMMC3_SDB_4BIT:
+                       pinmux_set_func(PINGRP_SDB, PMUX_FUNC_SDIO3);
+                       pinmux_set_func(PINGRP_SDC, PMUX_FUNC_SDIO3);
+                       pinmux_set_func(PINGRP_SDD, PMUX_FUNC_SDIO3);
+
+                       pinmux_tristate_disable(PINGRP_SDB);
+                       pinmux_tristate_disable(PINGRP_SDC);
+                       pinmux_tristate_disable(PINGRP_SDD);
+                       bad_config = 0;
+                       break;
+               }
+               break;
+
+       case PERIPH_ID_SDMMC4:
+               switch (config) {
+               case FUNCMUX_SDMMC4_ATC_ATD_8BIT:
+                       pinmux_set_func(PINGRP_ATC, PMUX_FUNC_SDIO4);
+                       pinmux_set_func(PINGRP_ATD, PMUX_FUNC_SDIO4);
+
+                       pinmux_tristate_disable(PINGRP_ATC);
+                       pinmux_tristate_disable(PINGRP_ATD);
+                       break;
+
+               case FUNCMUX_SDMMC4_ATB_GMA_GME_8_BIT:
+                       pinmux_set_func(PINGRP_GME, PMUX_FUNC_SDIO4);
+                       pinmux_tristate_disable(PINGRP_GME);
+                       /* fall through */
+
+               case FUNCMUX_SDMMC4_ATB_GMA_4_BIT:
+                       pinmux_set_func(PINGRP_ATB, PMUX_FUNC_SDIO4);
+                       pinmux_set_func(PINGRP_GMA, PMUX_FUNC_SDIO4);
+
+                       pinmux_tristate_disable(PINGRP_ATB);
+                       pinmux_tristate_disable(PINGRP_GMA);
+                       bad_config = 0;
+                       break;
+               }
                break;
 
        default:
@@ -54,5 +174,11 @@ int funcmux_select(enum periph_id id, int config)
                return -1;
        }
 
+       if (bad_config) {
+               debug("%s: invalid config %d for periph_id %d", __func__,
+                     config, id);
+               return -1;
+       }
+
        return 0;
 }
index 767932daea8eba292a021eec527c3d68b4728bb5..aa3b554536889ec10e10be64034600970f64e8b2 100644 (file)
@@ -18,5 +18,6 @@
 
 extern void enable_uart0_pin_mux(void);
 extern void enable_mmc0_pin_mux(void);
+extern void enable_i2c0_pin_mux(void);
 
 #endif/*__COMMON_DEF_H__ */
index 25558a2b2c8aa93be773d9108d118f312a04f369..cd002e632d22383ee9b96f2d6e9ac26fa41f1a6e 100644 (file)
@@ -95,7 +95,8 @@ struct cm_wkuppll {
        unsigned int divm2dpllper;      /* offset 0xAC */
        unsigned int resv11[1];
        unsigned int wkup_uart0ctrl;    /* offset 0xB4 */
-       unsigned int resv12[8];
+       unsigned int wkup_i2c0ctrl;     /* offset 0xB8 */
+       unsigned int resv12[7];
        unsigned int divm6dpllcore;     /* offset 0xD8 */
 };
 
diff --git a/arch/arm/include/asm/arch-am33xx/i2c.h b/arch/arm/include/asm/arch-am33xx/i2c.h
new file mode 100644 (file)
index 0000000..366e2bb
--- /dev/null
@@ -0,0 +1,81 @@
+/*
+ * (C) Copyright 2012
+ * Texas Instruments, <www.ti.com>
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+#ifndef _I2C_H_
+#define _I2C_H_
+
+#define  I2C_BASE1             0x44E0B000
+#define  I2C_BASE2             0x4802A000
+#define  I2C_BASE3             0x4819C000
+#define         I2C_BUS_MAX            3
+
+#define I2C_DEFAULT_BASE               I2C_BASE1
+
+struct i2c {
+       unsigned short revnb_lo;        /* 0x00 */
+       unsigned short res1;
+       unsigned short revnb_hi;        /* 0x04 */
+       unsigned short res2[13];
+       unsigned short sysc;            /* 0x20 */
+       unsigned short res3;
+       unsigned short irqstatus_raw;   /* 0x24 */
+       unsigned short res4;
+       unsigned short stat;            /* 0x28 */
+       unsigned short res5;
+       unsigned short ie;              /* 0x2C */
+       unsigned short res6;
+       unsigned short irqenable_clr;   /* 0x30 */
+       unsigned short res7;
+       unsigned short iv;              /* 0x34 */
+       unsigned short res8[45];
+       unsigned short syss;            /* 0x90 */
+       unsigned short res9;
+       unsigned short buf;             /* 0x94 */
+       unsigned short res10;
+       unsigned short cnt;             /* 0x98 */
+       unsigned short res11;
+       unsigned short data;            /* 0x9C */
+       unsigned short res13;
+       unsigned short res14;           /* 0xA0 */
+       unsigned short res15;
+       unsigned short con;             /* 0xA4 */
+       unsigned short res16;
+       unsigned short oa;              /* 0xA8 */
+       unsigned short res17;
+       unsigned short sa;              /* 0xAC */
+       unsigned short res18;
+       unsigned short psc;             /* 0xB0 */
+       unsigned short res19;
+       unsigned short scll;            /* 0xB4 */
+       unsigned short res20;
+       unsigned short sclh;            /* 0xB8 */
+       unsigned short res21;
+       unsigned short systest;         /* 0xBC */
+       unsigned short res22;
+       unsigned short bufstat;         /* 0xC0 */
+       unsigned short res23;
+};
+
+#define I2C_IP_CLK                     48000000
+#define I2C_INTERNAL_SAMLPING_CLK      12000000
+
+#endif /* _I2C_H_ */
index e489c474754cd581c65921b4f1aaa26f7669fc8c..11ed91d0595ca17d15128028b72aaf11b9d2caed 100644 (file)
 #ifndef __DA850_LOWLEVEL_H
 #define __DA850_LOWLEVEL_H
 
+#include <asm/arch/pinmux_defs.h>
+
+/* pinmux_resource[] vector is defined in the board specific file */
+extern const struct pinmux_resource pinmuxes[];
+extern const int pinmuxes_size;
+
+extern const struct lpsc_resource lpsc[];
+extern const int lpsc_size;
+
 /* NOR Boot Configuration Word Field Descriptions */
 #define DA850_NORBOOT_COPY_XK(X)       ((X - 1) << 8)
 #define DA850_NORBOOT_METHOD_DIRECT    (1 << 4)
index 4986e829833cc048a088109c88fff90058ef246e..c70930d8d3ab9c417a3295a23efea5beb820255b 100644 (file)
@@ -32,7 +32,6 @@ void dm365_waitloop(unsigned long loopcnt);
 int dm365_pll1_init(unsigned long pllmult, unsigned long prediv);
 int dm365_pll2_init(unsigned long pllm, unsigned long prediv);
 int dm365_ddr_setup(void);
-void dm365_por_reset(void);
 void dm365_psc_init(void);
 void dm365_pinmux_ctl(unsigned long offset, unsigned long mask,
        unsigned long value);
index 1c71540e481fb249879ab0d1c455e673d17cb9d3..b145c6e7f163b1e9992839b058d5425349320ea3 100644 (file)
@@ -587,6 +587,15 @@ static inline int get_async3_src(void)
 #include <asm/arch/psc_defs.h>
 #include <asm/arch/syscfg_defs.h>
 #include <asm/arch/timer_defs.h>
+
+#define TMPBUF                 0x00017ff8
+#define TMPSTATUS              0x00017ff0
+#define DV_TMPBUF_VAL          0x591b3ed7
+#define FLAG_PORRST            0x00000001
+#define FLAG_WDTRST            0x00000002
+#define FLAG_FLGON             0x00000004
+#define FLAG_FLGOFF            0x00000010
+
 #endif
 
 struct davinci_rtc {
index f1396e31942430e8cf9348620993d8d69b5a1bdb..1c8d83fb5b5a1d06d91750ed1740429dbf65b699 100644 (file)
@@ -68,7 +68,8 @@ struct dv_pll_regs {
 #define PLLCTL_RES_9   (1 << 8)
 #define PLLCTL_EXTCLKSRC       (1 << 9)
 
-#define PLL_POSTDEN    (1 << 15)
+#define PLL_DIVEN      (1 << 15)
+#define PLL_POSTDEN    PLL_DIVEN
 
 #define PLL_SCSCFG3_DIV45PENA  (1 << 2)
 #define PLL_SCSCFG3_EMA_CLKSRC (1 << 1)
index 53c961e8da1573f7068dce2a19bcef5b284abd12..914ae07dca30dd30d9c8b8d0c4da54800eac10d9 100644 (file)
@@ -37,6 +37,22 @@ struct davinci_timer {
        u_int32_t       wdtcr;
 };
 
+#define DV_TIMER_TCR_ENAMODE_MASK              3
+
+#define DV_TIMER_TCR_ENAMODE12_SHIFT           6
+#define DV_TIMER_TCR_CLKSRC12_SHIFT            8
+#define DV_TIMER_TCR_READRSTMODE12_SHIFT       10
+#define DV_TIMER_TCR_CAPMODE12_SHIFT           11
+#define DV_TIMER_TCR_CAPVTMODE12_SHIFT         12
+#define DV_TIMER_TCR_ENAMODE34_SHIFT           22
+#define DV_TIMER_TCR_CLKSRC34_SHIFT            24
+#define DV_TIMER_TCR_READRSTMODE34_SHIFT       26
+#define DV_TIMER_TCR_CAPMODE34_SHIFT           27
+#define DV_TIMER_TCR_CAPEVTMODE12_SHIFT                28
+
+#define DV_WDT_ENABLE_SYS_RESET                0x00020000
+#define DV_WDT_TRIGGER_SYS_RESET       0x00020002
+
 #ifdef CONFIG_HW_WATCHDOG
 void davinci_hw_watchdog_enable(void);
 void davinci_hw_watchdog_reset(void);
index 483c91154b4533b9195ccf7c48da88757d1f4dda..50da958034229b84e30fc390f635735b618d33cc 100644 (file)
@@ -250,6 +250,332 @@ struct exynos4_clock {
        unsigned int    div_iem_l2;
        unsigned int    div_iem_l1;
 };
+
+struct exynos5_clock {
+       unsigned int    apll_lock;
+       unsigned char   res1[0xfc];
+       unsigned int    apll_con0;
+       unsigned int    apll_con1;
+       unsigned char   res2[0xf8];
+       unsigned int    src_cpu;
+       unsigned char   res3[0x1fc];
+       unsigned int    mux_stat_cpu;
+       unsigned char   res4[0xfc];
+       unsigned int    div_cpu0;
+       unsigned int    div_cpu1;
+       unsigned char   res5[0xf8];
+       unsigned int    div_stat_cpu0;
+       unsigned int    div_stat_cpu1;
+       unsigned char   res6[0x1f8];
+       unsigned int    gate_sclk_cpu;
+       unsigned char   res7[0x1fc];
+       unsigned int    clkout_cmu_cpu;
+       unsigned int    clkout_cmu_cpu_div_stat;
+       unsigned char   res8[0x5f8];
+       unsigned int    armclk_stopctrl;
+       unsigned int    atclk_stopctrl;
+       unsigned char   res9[0x8];
+       unsigned int    parityfail_status;
+       unsigned int    parityfail_clear;
+       unsigned char   res10[0x8];
+       unsigned int    pwr_ctrl;
+       unsigned int    pwr_ctr2;
+       unsigned char   res11[0xd8];
+       unsigned int    apll_con0_l8;
+       unsigned int    apll_con0_l7;
+       unsigned int    apll_con0_l6;
+       unsigned int    apll_con0_l5;
+       unsigned int    apll_con0_l4;
+       unsigned int    apll_con0_l3;
+       unsigned int    apll_con0_l2;
+       unsigned int    apll_con0_l1;
+       unsigned int    iem_control;
+       unsigned char   res12[0xdc];
+       unsigned int    apll_con1_l8;
+       unsigned int    apll_con1_l7;
+       unsigned int    apll_con1_l6;
+       unsigned int    apll_con1_l5;
+       unsigned int    apll_con1_l4;
+       unsigned int    apll_con1_l3;
+       unsigned int    apll_con1_l2;
+       unsigned int    apll_con1_l1;
+       unsigned char   res13[0xe0];
+       unsigned int    div_iem_l8;
+       unsigned int    div_iem_l7;
+       unsigned int    div_iem_l6;
+       unsigned int    div_iem_l5;
+       unsigned int    div_iem_l4;
+       unsigned int    div_iem_l3;
+       unsigned int    div_iem_l2;
+       unsigned int    div_iem_l1;
+       unsigned char   res14[0x2ce0];
+       unsigned int    mpll_lock;
+       unsigned char   res15[0xfc];
+       unsigned int    mpll_con0;
+       unsigned int    mpll_con1;
+       unsigned char   res16[0xf8];
+       unsigned int    src_core0;
+       unsigned int    src_core1;
+       unsigned char   res17[0xf8];
+       unsigned int    src_mask_core;
+       unsigned char   res18[0x100];
+       unsigned int    mux_stat_core1;
+       unsigned char   res19[0xf8];
+       unsigned int    div_core0;
+       unsigned int    div_core1;
+       unsigned char   res20[0xf8];
+       unsigned int    div_stat_core0;
+       unsigned int    div_stat_core1;
+       unsigned char   res21[0x2f8];
+       unsigned int    gate_ip_core;
+       unsigned char   res22[0xfc];
+       unsigned int    clkout_cmu_core;
+       unsigned int    clkout_cmu_core_div_stat;
+       unsigned char   res23[0x5f8];
+       unsigned int    dcgidx_map0;
+       unsigned int    dcgidx_map1;
+       unsigned int    dcgidx_map2;
+       unsigned char   res24[0x14];
+       unsigned int    dcgperf_map0;
+       unsigned int    dcgperf_map1;
+       unsigned char   res25[0x18];
+       unsigned int    dvcidx_map;
+       unsigned char   res26[0x1c];
+       unsigned int    freq_cpu;
+       unsigned int    freq_dpm;
+       unsigned char   res27[0x18];
+       unsigned int    dvsemclk_en;
+       unsigned int    maxperf;
+       unsigned char   res28[0x3478];
+       unsigned int    div_acp;
+       unsigned char   res29[0xfc];
+       unsigned int    div_stat_acp;
+       unsigned char   res30[0x1fc];
+       unsigned int    gate_ip_acp;
+       unsigned char   res31[0x1fc];
+       unsigned int    clkout_cmu_acp;
+       unsigned int    clkout_cmu_acp_div_stat;
+       unsigned char   res32[0x38f8];
+       unsigned int    div_isp0;
+       unsigned int    div_isp1;
+       unsigned int    div_isp2;
+       unsigned char   res33[0xf4];
+       unsigned int    div_stat_isp0;
+       unsigned int    div_stat_isp1;
+       unsigned int    div_stat_isp2;
+       unsigned char   res34[0x3f4];
+       unsigned int    gate_ip_isp0;
+       unsigned int    gate_ip_isp1;
+       unsigned char   res35[0xf8];
+       unsigned int    gate_sclk_isp;
+       unsigned char   res36[0xc];
+       unsigned int    mcuisp_pwr_ctrl;
+       unsigned char   res37[0xec];
+       unsigned int    clkout_cmu_isp;
+       unsigned int    clkout_cmu_isp_div_stat;
+       unsigned char   res38[0x3618];
+       unsigned int    cpll_lock;
+       unsigned char   res39[0xc];
+       unsigned int    epll_lock;
+       unsigned char   res40[0xc];
+       unsigned int    vpll_lock;
+       unsigned char   res41[0xdc];
+       unsigned int    cpll_con0;
+       unsigned int    cpll_con1;
+       unsigned char   res42[0x8];
+       unsigned int    epll_con0;
+       unsigned int    epll_con1;
+       unsigned int    epll_con2;
+       unsigned char   res43[0x4];
+       unsigned int    vpll_con0;
+       unsigned int    vpll_con1;
+       unsigned int    vpll_con2;
+       unsigned char   res44[0xc4];
+       unsigned int    src_top0;
+       unsigned int    src_top1;
+       unsigned int    src_top2;
+       unsigned int    src_top3;
+       unsigned int    src_gscl;
+       unsigned int    src_disp0_0;
+       unsigned int    src_disp0_1;
+       unsigned int    src_disp1_0;
+       unsigned int    src_disp1_1;
+       unsigned char   res46[0xc];
+       unsigned int    src_mau;
+       unsigned int    src_fsys;
+       unsigned char   res47[0x8];
+       unsigned int    src_peric0;
+       unsigned int    src_peric1;
+       unsigned char   res48[0x18];
+       unsigned int    sclk_src_isp;
+       unsigned char   res49[0x9c];
+       unsigned int    src_mask_top;
+       unsigned char   res50[0xc];
+       unsigned int    src_mask_gscl;
+       unsigned int    src_mask_disp0_0;
+       unsigned int    src_mask_disp0_1;
+       unsigned int    src_mask_disp1_0;
+       unsigned int    src_mask_disp1_1;
+       unsigned int    src_mask_maudio;
+       unsigned char   res52[0x8];
+       unsigned int    src_mask_fsys;
+       unsigned char   res53[0xc];
+       unsigned int    src_mask_peric0;
+       unsigned int    src_mask_peric1;
+       unsigned char   res54[0x18];
+       unsigned int    src_mask_isp;
+       unsigned char   res55[0x9c];
+       unsigned int    mux_stat_top0;
+       unsigned int    mux_stat_top1;
+       unsigned int    mux_stat_top2;
+       unsigned int    mux_stat_top3;
+       unsigned char   res56[0xf0];
+       unsigned int    div_top0;
+       unsigned int    div_top1;
+       unsigned char   res57[0x8];
+       unsigned int    div_gscl;
+       unsigned int    div_disp0_0;
+       unsigned int    div_disp0_1;
+       unsigned int    div_disp1_0;
+       unsigned int    div_disp1_1;
+       unsigned char   res59[0x8];
+       unsigned int    div_gen;
+       unsigned char   res60[0x4];
+       unsigned int    div_mau;
+       unsigned int    div_fsys0;
+       unsigned int    div_fsys1;
+       unsigned int    div_fsys2;
+       unsigned int    div_fsys3;
+       unsigned int    div_peric0;
+       unsigned int    div_peric1;
+       unsigned int    div_peric2;
+       unsigned int    div_peric3;
+       unsigned int    div_peric4;
+       unsigned int    div_peric5;
+       unsigned char   res61[0x10];
+       unsigned int    sclk_div_isp;
+       unsigned char   res62[0xc];
+       unsigned int    div2_ratio0;
+       unsigned int    div2_ratio1;
+       unsigned char   res63[0x8];
+       unsigned int    div4_ratio;
+       unsigned char   res64[0x6c];
+       unsigned int    div_stat_top0;
+       unsigned int    div_stat_top1;
+       unsigned char   res65[0x8];
+       unsigned int    div_stat_gscl;
+       unsigned int    div_stat_disp0_0;
+       unsigned int    div_stat_disp0_1;
+       unsigned int    div_stat_disp1_0;
+       unsigned int    div_stat_disp1_1;
+       unsigned char   res67[0x8];
+       unsigned int    div_stat_gen;
+       unsigned char   res68[0x4];
+       unsigned int    div_stat_maudio;
+       unsigned int    div_stat_fsys0;
+       unsigned int    div_stat_fsys1;
+       unsigned int    div_stat_fsys2;
+       unsigned int    div_stat_fsys3;
+       unsigned int    div_stat_peric0;
+       unsigned int    div_stat_peric1;
+       unsigned int    div_stat_peric2;
+       unsigned int    div_stat_peric3;
+       unsigned int    div_stat_peric4;
+       unsigned int    div_stat_peric5;
+       unsigned char   res69[0x10];
+       unsigned int    sclk_div_stat_isp;
+       unsigned char   res70[0xc];
+       unsigned int    div2_stat0;
+       unsigned int    div2_stat1;
+       unsigned char   res71[0x8];
+       unsigned int    div4_stat;
+       unsigned char   res72[0x180];
+       unsigned int    gate_top_sclk_disp0;
+       unsigned int    gate_top_sclk_disp1;
+       unsigned int    gate_top_sclk_gen;
+       unsigned char   res74[0xc];
+       unsigned int    gate_top_sclk_mau;
+       unsigned int    gate_top_sclk_fsys;
+       unsigned char   res75[0xc];
+       unsigned int    gate_top_sclk_peric;
+       unsigned char   res76[0x1c];
+       unsigned int    gate_top_sclk_isp;
+       unsigned char   res77[0xac];
+       unsigned int    gate_ip_gscl;
+       unsigned int    gate_ip_disp0;
+       unsigned int    gate_ip_disp1;
+       unsigned int    gate_ip_mfc;
+       unsigned int    gate_ip_g3d;
+       unsigned int    gate_ip_gen;
+       unsigned char   res79[0xc];
+       unsigned int    gate_ip_fsys;
+       unsigned char   res80[0x4];
+       unsigned int    gate_ip_gps;
+       unsigned int    gate_ip_peric;
+       unsigned char   res81[0xc];
+       unsigned int    gate_ip_peris;
+       unsigned char   res82[0x1c];
+       unsigned int    gate_block;
+       unsigned char   res83[0x7c];
+       unsigned int    clkout_cmu_top;
+       unsigned int    clkout_cmu_top_div_stat;
+       unsigned char   res84[0x37f8];
+       unsigned int    src_lex;
+       unsigned char   res85[0x2fc];
+       unsigned int    div_lex;
+       unsigned char   res86[0xfc];
+       unsigned int    div_stat_lex;
+       unsigned char   res87[0x1fc];
+       unsigned int    gate_ip_lex;
+       unsigned char   res88[0x1fc];
+       unsigned int    clkout_cmu_lex;
+       unsigned int    clkout_cmu_lex_div_stat;
+       unsigned char   res89[0x3af8];
+       unsigned int    div_r0x;
+       unsigned char   res90[0xfc];
+       unsigned int    div_stat_r0x;
+       unsigned char   res91[0x1fc];
+       unsigned int    gate_ip_r0x;
+       unsigned char   res92[0x1fc];
+       unsigned int    clkout_cmu_r0x;
+       unsigned int    clkout_cmu_r0x_div_stat;
+       unsigned char   res94[0x3af8];
+       unsigned int    div_r1x;
+       unsigned char   res95[0xfc];
+       unsigned int    div_stat_r1x;
+       unsigned char   res96[0x1fc];
+       unsigned int    gate_ip_r1x;
+       unsigned char   res97[0x1fc];
+       unsigned int    clkout_cmu_r1x;
+       unsigned int    clkout_cmu_r1x_div_stat;
+       unsigned char   res98[0x3608];
+       unsigned int    bpll_lock;
+       unsigned char   res99[0xfc];
+       unsigned int    bpll_con0;
+       unsigned int    bpll_con1;
+       unsigned char   res100[0xe8];
+       unsigned int    src_cdrex;
+       unsigned char   res101[0x1fc];
+       unsigned int    mux_stat_cdrex;
+       unsigned char   res102[0xfc];
+       unsigned int    div_cdrex;
+       unsigned int    div_cdrex2;
+       unsigned char   res103[0xf8];
+       unsigned int    div_stat_cdrex;
+       unsigned char   res104[0x2fc];
+       unsigned int    gate_ip_cdrex;
+       unsigned char   res105[0xc];
+       unsigned int    c2c_monitor;
+       unsigned int    dmc_pwr_ctrl;
+       unsigned char   res106[0x4];
+       unsigned int    drex2_pause;
+       unsigned char   res107[0xe0];
+       unsigned int    clkout_cmu_cdrex;
+       unsigned int    clkout_cmu_cdrex_div_stat;
+       unsigned char   res108[0x8];
+       unsigned int    lpddr3phy_ctrl;
+       unsigned char   res109[0xf5f8];
+};
 #endif
 
 #endif
index 6d97b99548b50ae0c8f41a4dcfc29494b33964bb..89f2c2e3e904380b508b44e25d6fa7744a008b12 100644 (file)
@@ -22,6 +22,8 @@
 #ifndef _EXYNOS4_CPU_H
 #define _EXYNOS4_CPU_H
 
+#define DEVICE_NOT_AVAILABLE           0
+
 #define EXYNOS4_ADDR_BASE              0x10000000
 
 /* EXYNOS4 */
 #define EXYNOS4_ADC_BASE               0x13910000
 #define EXYNOS4_PWMTIMER_BASE          0x139D0000
 #define EXYNOS4_MODEM_BASE             0x13A00000
-#define EXYNOS4_USBPHY_CONTROL          0x10020704
+#define EXYNOS4_USBPHY_CONTROL         0x10020704
+
+#define EXYNOS4_GPIO_PART4_BASE                DEVICE_NOT_AVAILABLE
+
+/* EXYNOS5 */
+#define EXYNOS5_GPIO_PART4_BASE                0x03860000
+#define EXYNOS5_PRO_ID                 0x10000000
+#define EXYNOS5_CLOCK_BASE             0x10010000
+#define EXYNOS5_POWER_BASE             0x10040000
+#define EXYNOS5_SWRESET                        0x10040400
+#define EXYNOS5_SYSREG_BASE            0x10050000
+#define EXYNOS5_WATCHDOG_BASE          0x101D0000
+#define EXYNOS5_DMC_PHY0_BASE          0x10C00000
+#define EXYNOS5_DMC_PHY1_BASE          0x10C10000
+#define EXYNOS5_GPIO_PART3_BASE                0x10D10000
+#define EXYNOS5_DMC_CTRL_BASE          0x10DD0000
+#define EXYNOS5_GPIO_PART1_BASE                0x11400000
+#define EXYNOS5_MMC_BASE               0x12200000
+#define EXYNOS5_SROMC_BASE             0x12250000
+#define EXYNOS5_USBOTG_BASE            0x12480000
+#define EXYNOS5_USBPHY_BASE            0x12480000
+#define EXYNOS5_UART_BASE              0x12C00000
+#define EXYNOS5_PWMTIMER_BASE          0x12DD0000
+#define EXYNOS5_GPIO_PART2_BASE                0x13400000
+#define EXYNOS5_FIMD_BASE              0x14400000
+
+#define EXYNOS5_ADC_BASE               DEVICE_NOT_AVAILABLE
+#define EXYNOS5_MODEM_BASE             DEVICE_NOT_AVAILABLE
 
 #ifndef __ASSEMBLY__
 #include <asm/io.h>
@@ -83,12 +112,15 @@ static inline int cpu_is_##type(void)                      \
 }
 
 IS_SAMSUNG_TYPE(exynos4, 0xc210)
+IS_SAMSUNG_TYPE(exynos5, 0xc520)
 
 #define SAMSUNG_BASE(device, base)                             \
 static inline unsigned int samsung_get_base_##device(void)     \
 {                                                              \
        if (cpu_is_exynos4())                                   \
                return EXYNOS4_##base;                          \
+       else if (cpu_is_exynos5())                              \
+               return EXYNOS5_##base;                          \
        else                                                    \
                return 0;                                       \
 }
@@ -99,6 +131,7 @@ SAMSUNG_BASE(fimd, FIMD_BASE)
 SAMSUNG_BASE(gpio_part1, GPIO_PART1_BASE)
 SAMSUNG_BASE(gpio_part2, GPIO_PART2_BASE)
 SAMSUNG_BASE(gpio_part3, GPIO_PART3_BASE)
+SAMSUNG_BASE(gpio_part4, GPIO_PART4_BASE)
 SAMSUNG_BASE(pro_id, PRO_ID)
 SAMSUNG_BASE(mmc, MMC_BASE)
 SAMSUNG_BASE(modem, MODEM_BASE)
@@ -109,6 +142,7 @@ SAMSUNG_BASE(uart, UART_BASE)
 SAMSUNG_BASE(usb_phy, USBPHY_BASE)
 SAMSUNG_BASE(usb_otg, USBOTG_BASE)
 SAMSUNG_BASE(watchdog, WATCHDOG_BASE)
+SAMSUNG_BASE(power, POWER_BASE)
 #endif
 
 #endif /* _EXYNOS4_CPU_H */
diff --git a/arch/arm/include/asm/arch-exynos/dmc.h b/arch/arm/include/asm/arch-exynos/dmc.h
new file mode 100644 (file)
index 0000000..debbe50
--- /dev/null
@@ -0,0 +1,146 @@
+#ifndef __DMC_H__
+#define __DMC_H__
+
+#ifndef __ASSEMBLY__
+struct exynos5_dmc {
+       unsigned int concontrol;
+       unsigned int memcontrol;
+       unsigned int memconfig0;
+       unsigned int memconfig1;
+       unsigned int directcmd;
+       unsigned int prechconfig;
+       unsigned int phycontrol0;
+       unsigned char res1[0xc];
+       unsigned int pwrdnconfig;
+       unsigned int timingpzq;
+       unsigned int timingref;
+       unsigned int timingrow;
+       unsigned int timingdata;
+       unsigned int timingpower;
+       unsigned int phystatus;
+       unsigned char res2[0x4];
+       unsigned int chipstatus_ch0;
+       unsigned int chipstatus_ch1;
+       unsigned char res3[0x4];
+       unsigned int mrstatus;
+       unsigned char res4[0x8];
+       unsigned int qoscontrol0;
+       unsigned char resr5[0x4];
+       unsigned int qoscontrol1;
+       unsigned char res6[0x4];
+       unsigned int qoscontrol2;
+       unsigned char res7[0x4];
+       unsigned int qoscontrol3;
+       unsigned char res8[0x4];
+       unsigned int qoscontrol4;
+       unsigned char res9[0x4];
+       unsigned int qoscontrol5;
+       unsigned char res10[0x4];
+       unsigned int qoscontrol6;
+       unsigned char res11[0x4];
+       unsigned int qoscontrol7;
+       unsigned char res12[0x4];
+       unsigned int qoscontrol8;
+       unsigned char res13[0x4];
+       unsigned int qoscontrol9;
+       unsigned char res14[0x4];
+       unsigned int qoscontrol10;
+       unsigned char res15[0x4];
+       unsigned int qoscontrol11;
+       unsigned char res16[0x4];
+       unsigned int qoscontrol12;
+       unsigned char res17[0x4];
+       unsigned int qoscontrol13;
+       unsigned char res18[0x4];
+       unsigned int qoscontrol14;
+       unsigned char res19[0x4];
+       unsigned int qoscontrol15;
+       unsigned char res20[0x14];
+       unsigned int ivcontrol;
+       unsigned int wrtra_config;
+       unsigned int rdlvl_config;
+       unsigned char res21[0x8];
+       unsigned int brbrsvconfig;
+       unsigned int brbqosconfig;
+       unsigned int membaseconfig0;
+       unsigned int membaseconfig1;
+       unsigned char res22[0xc];
+       unsigned int wrlvl_config;
+       unsigned char res23[0xc];
+       unsigned int perevcontrol;
+       unsigned int perev0config;
+       unsigned int perev1config;
+       unsigned int perev2config;
+       unsigned int perev3config;
+       unsigned char res24[0xdebc];
+       unsigned int pmnc_ppc_a;
+       unsigned char res25[0xc];
+       unsigned int cntens_ppc_a;
+       unsigned char res26[0xc];
+       unsigned int cntenc_ppc_a;
+       unsigned char res27[0xc];
+       unsigned int intens_ppc_a;
+       unsigned char res28[0xc];
+       unsigned int intenc_ppc_a;
+       unsigned char res29[0xc];
+       unsigned int flag_ppc_a;
+       unsigned char res30[0xac];
+       unsigned int ccnt_ppc_a;
+       unsigned char res31[0xc];
+       unsigned int pmcnt0_ppc_a;
+       unsigned char res32[0xc];
+       unsigned int pmcnt1_ppc_a;
+       unsigned char res33[0xc];
+       unsigned int pmcnt2_ppc_a;
+       unsigned char res34[0xc];
+       unsigned int pmcnt3_ppc_a;
+};
+
+struct exynos5_phy_control {
+       unsigned int phy_con0;
+       unsigned int phy_con1;
+       unsigned int phy_con2;
+       unsigned int phy_con3;
+       unsigned int phy_con4;
+       unsigned char res1[4];
+       unsigned int phy_con6;
+       unsigned char res2[4];
+       unsigned int phy_con8;
+       unsigned int phy_con9;
+       unsigned int phy_con10;
+       unsigned char res3[4];
+       unsigned int phy_con12;
+       unsigned int phy_con13;
+       unsigned int phy_con14;
+       unsigned int phy_con15;
+       unsigned int phy_con16;
+       unsigned char res4[4];
+       unsigned int phy_con17;
+       unsigned int phy_con18;
+       unsigned int phy_con19;
+       unsigned int phy_con20;
+       unsigned int phy_con21;
+       unsigned int phy_con22;
+       unsigned int phy_con23;
+       unsigned int phy_con24;
+       unsigned int phy_con25;
+       unsigned int phy_con26;
+       unsigned int phy_con27;
+       unsigned int phy_con28;
+       unsigned int phy_con29;
+       unsigned int phy_con30;
+       unsigned int phy_con31;
+       unsigned int phy_con32;
+       unsigned int phy_con33;
+       unsigned int phy_con34;
+       unsigned int phy_con35;
+       unsigned int phy_con36;
+       unsigned int phy_con37;
+       unsigned int phy_con38;
+       unsigned int phy_con39;
+       unsigned int phy_con40;
+       unsigned int phy_con41;
+       unsigned int phy_con42;
+};
+#endif
+#endif
index 9863a122459ef5074b0665fde3fbf9d6322ebf40..7a9bb90a0ca715e151c06438e58f087208adde23 100644 (file)
@@ -79,6 +79,59 @@ struct exynos4_gpio_part3 {
        struct s5p_gpio_bank z;
 };
 
+struct exynos5_gpio_part1 {
+       struct s5p_gpio_bank a0;
+       struct s5p_gpio_bank a1;
+       struct s5p_gpio_bank a2;
+       struct s5p_gpio_bank b0;
+       struct s5p_gpio_bank b1;
+       struct s5p_gpio_bank b2;
+       struct s5p_gpio_bank b3;
+       struct s5p_gpio_bank c0;
+       struct s5p_gpio_bank c1;
+       struct s5p_gpio_bank c2;
+       struct s5p_gpio_bank c3;
+       struct s5p_gpio_bank d0;
+       struct s5p_gpio_bank d1;
+       struct s5p_gpio_bank y0;
+       struct s5p_gpio_bank y1;
+       struct s5p_gpio_bank y2;
+       struct s5p_gpio_bank y3;
+       struct s5p_gpio_bank y4;
+       struct s5p_gpio_bank y5;
+       struct s5p_gpio_bank y6;
+       struct s5p_gpio_bank res1[0x980];
+       struct s5p_gpio_bank x0;
+       struct s5p_gpio_bank x1;
+       struct s5p_gpio_bank x2;
+       struct s5p_gpio_bank x3;
+};
+
+struct exynos5_gpio_part2 {
+       struct s5p_gpio_bank e0;
+       struct s5p_gpio_bank e1;
+       struct s5p_gpio_bank f0;
+       struct s5p_gpio_bank f1;
+       struct s5p_gpio_bank g0;
+       struct s5p_gpio_bank g1;
+       struct s5p_gpio_bank g2;
+       struct s5p_gpio_bank h0;
+       struct s5p_gpio_bank h1;
+};
+
+struct exynos5_gpio_part3 {
+       struct s5p_gpio_bank v0;
+       struct s5p_gpio_bank v1;
+       struct s5p_gpio_bank v2;
+       struct s5p_gpio_bank v3;
+       struct s5p_gpio_bank res1[0x20];
+       struct s5p_gpio_bank v4;
+};
+
+struct exynos5_gpio_part4 {
+       struct s5p_gpio_bank z;
+};
+
 /* functions */
 void s5p_gpio_cfg_pin(struct s5p_gpio_bank *bank, int gpio, int cfg);
 void s5p_gpio_direction_output(struct s5p_gpio_bank *bank, int gpio, int en);
@@ -98,21 +151,55 @@ void s5p_gpio_set_rate(struct s5p_gpio_bank *bank, int gpio, int mode);
            - EXYNOS4_GPIO_PART1_BASE) / sizeof(struct s5p_gpio_bank)) \
          * GPIO_PER_BANK) + pin)
 
-#define GPIO_PART1_MAX ((sizeof(struct exynos4_gpio_part1) \
+#define EXYNOS4_GPIO_PART1_MAX ((sizeof(struct exynos4_gpio_part1) \
                            / sizeof(struct s5p_gpio_bank)) * GPIO_PER_BANK)
 
 #define exynos4_gpio_part2_get_nr(bank, pin) \
        (((((((unsigned int) &(((struct exynos4_gpio_part2 *) \
                                EXYNOS4_GPIO_PART2_BASE)->bank)) \
            - EXYNOS4_GPIO_PART2_BASE) / sizeof(struct s5p_gpio_bank)) \
-         * GPIO_PER_BANK) + pin) + GPIO_PART1_MAX)
+         * GPIO_PER_BANK) + pin) + EXYNOS4_GPIO_PART1_MAX)
+
+#define exynos5_gpio_part1_get_nr(bank, pin) \
+       ((((((unsigned int) &(((struct exynos5_gpio_part1 *) \
+                              EXYNOS5_GPIO_PART1_BASE)->bank)) \
+           - EXYNOS5_GPIO_PART1_BASE) / sizeof(struct s5p_gpio_bank)) \
+         * GPIO_PER_BANK) + pin)
+
+#define EXYNOS5_GPIO_PART1_MAX ((sizeof(struct exynos5_gpio_part1) \
+                           / sizeof(struct s5p_gpio_bank)) * GPIO_PER_BANK)
+
+#define exynos5_gpio_part2_get_nr(bank, pin) \
+       (((((((unsigned int) &(((struct exynos5_gpio_part2 *) \
+                               EXYNOS5_GPIO_PART2_BASE)->bank)) \
+           - EXYNOS5_GPIO_PART2_BASE) / sizeof(struct s5p_gpio_bank)) \
+         * GPIO_PER_BANK) + pin) + EXYNOS5_GPIO_PART1_MAX)
+
+#define EXYNOS5_GPIO_PART2_MAX ((sizeof(struct exynos5_gpio_part2) \
+                           / sizeof(struct s5p_gpio_bank)) * GPIO_PER_BANK)
+
+#define exynos5_gpio_part3_get_nr(bank, pin) \
+       (((((((unsigned int) &(((struct exynos5_gpio_part3 *) \
+                               EXYNOS5_GPIO_PART3_BASE)->bank)) \
+           - EXYNOS5_GPIO_PART3_BASE) / sizeof(struct s5p_gpio_bank)) \
+         * GPIO_PER_BANK) + pin) + EXYNOS5_GPIO_PART2_MAX)
 
 static inline unsigned int s5p_gpio_base(int nr)
 {
-       if (nr < GPIO_PART1_MAX)
-               return EXYNOS4_GPIO_PART1_BASE;
-       else
-               return EXYNOS4_GPIO_PART2_BASE;
+       if (cpu_is_exynos5()) {
+               if (nr < EXYNOS5_GPIO_PART1_MAX)
+                       return EXYNOS5_GPIO_PART1_BASE;
+               else if (nr < EXYNOS5_GPIO_PART2_MAX)
+                       return EXYNOS5_GPIO_PART2_BASE;
+               else
+                       return EXYNOS5_GPIO_PART3_BASE;
+
+       } else if (cpu_is_exynos4()) {
+               if (nr < EXYNOS4_GPIO_PART1_MAX)
+                       return EXYNOS4_GPIO_PART1_BASE;
+               else
+                       return EXYNOS4_GPIO_PART2_BASE;
+       }
 
        return 0;
 }
diff --git a/arch/arm/include/asm/arch-exynos/power.h b/arch/arm/include/asm/arch-exynos/power.h
new file mode 100644 (file)
index 0000000..fb442f7
--- /dev/null
@@ -0,0 +1,230 @@
+/*
+ * Copyright (C) 2011 Samsung Electronics
+ * Heungjun Kim <riverful.kim@samsung.com>
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+#ifndef __ASM_ARM_ARCH_POWER_H_
+#define __ASM_ARM_ARCH_POWER_H_
+
+#ifndef __ASSEMBLY__
+struct exynos4_power {
+       unsigned int    om_stat;
+       unsigned char   res1[0x8];
+       unsigned int    rtc_clko_sel;
+       unsigned int    gnss_rtc_out_ctrl;
+       unsigned char   res2[0x1ec];
+       unsigned int    system_power_down_ctrl;
+       unsigned char   res3[0x1];
+       unsigned int    system_power_down_option;
+       unsigned char   res4[0x1f4];
+       unsigned int    swreset;
+       unsigned int    rst_stat;
+       unsigned char   res5[0x1f8];
+       unsigned int    wakeup_stat;
+       unsigned int    eint_wakeup_mask;
+       unsigned int    wakeup_mask;
+       unsigned char   res6[0xf4];
+       unsigned int    hdmi_phy_control;
+       unsigned int    usbdevice_phy_control;
+       unsigned int    usbhost_phy_control;
+       unsigned int    dac_phy_control;
+       unsigned int    mipi_phy0_control;
+       unsigned int    mipi_phy1_control;
+       unsigned int    adc_phy_control;
+       unsigned int    pcie_phy_control;
+       unsigned int    sata_phy_control;
+       unsigned char   res7[0xdc];
+       unsigned int    inform0;
+       unsigned int    inform1;
+       unsigned int    inform2;
+       unsigned int    inform3;
+       unsigned int    inform4;
+       unsigned int    inform5;
+       unsigned int    inform6;
+       unsigned int    inform7;
+       unsigned char   res8[0x1e0];
+       unsigned int    pmu_debug;
+       unsigned char   res9[0x5fc];
+       unsigned int    arm_core0_sys_pwr_reg;
+       unsigned char   res10[0xc];
+       unsigned int    arm_core1_sys_pwr_reg;
+       unsigned char   res11[0x6c];
+       unsigned int    arm_common_sys_pwr_reg;
+       unsigned char   res12[0x3c];
+       unsigned int    arm_cpu_l2_0_sys_pwr_reg;
+       unsigned int    arm_cpu_l2_1_sys_pwr_reg;
+       unsigned char   res13[0x38];
+       unsigned int    cmu_aclkstop_sys_pwr_reg;
+       unsigned int    cmu_sclkstop_sys_pwr_reg;
+       unsigned char   res14[0x4];
+       unsigned int    cmu_reset_sys_pwr_reg;
+       unsigned char   res15[0x10];
+       unsigned int    apll_sysclk_sys_pwr_reg;
+       unsigned int    mpll_sysclk_sys_pwr_reg;
+       unsigned int    vpll_sysclk_sys_pwr_reg;
+       unsigned int    epll_sysclk_sys_pwr_reg;
+       unsigned char   res16[0x8];
+       unsigned int    cmu_clkstop_gps_alive_sys_pwr_reg;
+       unsigned int    cmu_reset_gps_alive_sys_pwr_reg;
+       unsigned int    cmu_clkstop_cam_sys_pwr_reg;
+       unsigned int    cmu_clkstop_tv_sys_pwr_reg;
+       unsigned int    cmu_clkstop_mfc_sys_pwr_reg;
+       unsigned int    cmu_clkstop_g3d_sys_pwr_reg;
+       unsigned int    cmu_clkstop_lcd0_sys_pwr_reg;
+       unsigned int    cmu_clkstop_lcd1_sys_pwr_reg;
+       unsigned int    cmu_clkstop_maudio_sys_pwr_reg;
+       unsigned int    cmu_clkstop_gps_sys_pwr_reg;
+       unsigned int    cmu_reset_cam_sys_pwr_reg;
+       unsigned int    cmu_reset_tv_sys_pwr_reg;
+       unsigned int    cmu_reset_mfc_sys_pwr_reg;
+       unsigned int    cmu_reset_g3d_sys_pwr_reg;
+       unsigned int    cmu_reset_lcd0_sys_pwr_reg;
+       unsigned int    cmu_reset_lcd1_sys_pwr_reg;
+       unsigned int    cmu_reset_maudio_sys_pwr_reg;
+       unsigned int    cmu_reset_gps_sys_pwr_reg;
+       unsigned int    top_bus_sys_pwr_reg;
+       unsigned int    top_retention_sys_pwr_reg;
+       unsigned int    top_pwr_sys_pwr_reg;
+       unsigned char   res17[0x1c];
+       unsigned int    logic_reset_sys_pwr_reg;
+       unsigned char   res18[0x14];
+       unsigned int    onenandxl_mem_sys_pwr_reg;
+       unsigned int    modemif_mem_sys_pwr_reg;
+       unsigned char   res19[0x4];
+       unsigned int    usbdevice_mem_sys_pwr_reg;
+       unsigned int    sdmmc_mem_sys_pwr_reg;
+       unsigned int    cssys_mem_sys_pwr_reg;
+       unsigned int    secss_mem_sys_pwr_reg;
+       unsigned char   res20[0x4];
+       unsigned int    pcie_mem_sys_pwr_reg;
+       unsigned int    sata_mem_sys_pwr_reg;
+       unsigned char   res21[0x18];
+       unsigned int    pad_retention_dram_sys_pwr_reg;
+       unsigned int    pad_retention_maudio_sys_pwr_reg;
+       unsigned char   res22[0x18];
+       unsigned int    pad_retention_gpio_sys_pwr_reg;
+       unsigned int    pad_retention_uart_sys_pwr_reg;
+       unsigned int    pad_retention_mmca_sys_pwr_reg;
+       unsigned int    pad_retention_mmcb_sys_pwr_reg;
+       unsigned int    pad_retention_ebia_sys_pwr_reg;
+       unsigned int    pad_retention_ebib_sys_pwr_reg;
+       unsigned char   res23[0x8];
+       unsigned int    pad_isolation_sys_pwr_reg;
+       unsigned char   res24[0x1c];
+       unsigned int    pad_alv_sel_sys_pwr_reg;
+       unsigned char   res25[0x1c];
+       unsigned int    xusbxti_sys_pwr_reg;
+       unsigned int    xxti_sys_pwr_reg;
+       unsigned char   res26[0x38];
+       unsigned int    ext_regulator_sys_pwr_reg;
+       unsigned char   res27[0x3c];
+       unsigned int    gpio_mode_sys_pwr_reg;
+       unsigned char   res28[0x3c];
+       unsigned int    gpio_mode_maudio_sys_pwr_reg;
+       unsigned char   res29[0x3c];
+       unsigned int    cam_sys_pwr_reg;
+       unsigned int    tv_sys_pwr_reg;
+       unsigned int    mfc_sys_pwr_reg;
+       unsigned int    g3d_sys_pwr_reg;
+       unsigned int    lcd0_sys_pwr_reg;
+       unsigned int    lcd1_sys_pwr_reg;
+       unsigned int    maudio_sys_pwr_reg;
+       unsigned int    gps_sys_pwr_reg;
+       unsigned int    gps_alive_sys_pwr_reg;
+       unsigned char   res30[0xc5c];
+       unsigned int    arm_core0_configuration;
+       unsigned int    arm_core0_status;
+       unsigned int    arm_core0_option;
+       unsigned char   res31[0x74];
+       unsigned int    arm_core1_configuration;
+       unsigned int    arm_core1_status;
+       unsigned int    arm_core1_option;
+       unsigned char   res32[0x37c];
+       unsigned int    arm_common_option;
+       unsigned char   res33[0x1f4];
+       unsigned int    arm_cpu_l2_0_configuration;
+       unsigned int    arm_cpu_l2_0_status;
+       unsigned char   res34[0x18];
+       unsigned int    arm_cpu_l2_1_configuration;
+       unsigned int    arm_cpu_l2_1_status;
+       unsigned char   res35[0xa00];
+       unsigned int    pad_retention_maudio_option;
+       unsigned char   res36[0xdc];
+       unsigned int    pad_retention_gpio_option;
+       unsigned char   res37[0x1c];
+       unsigned int    pad_retention_uart_option;
+       unsigned char   res38[0x1c];
+       unsigned int    pad_retention_mmca_option;
+       unsigned char   res39[0x1c];
+       unsigned int    pad_retention_mmcb_option;
+       unsigned char   res40[0x1c];
+       unsigned int    pad_retention_ebia_option;
+       unsigned char   res41[0x1c];
+       unsigned int    pad_retention_ebib_option;
+       unsigned char   res42[0x160];
+       unsigned int    ps_hold_control;
+       unsigned char   res43[0xf0];
+       unsigned int    xusbxti_configuration;
+       unsigned int    xusbxti_status;
+       unsigned char   res44[0x14];
+       unsigned int    xusbxti_duration;
+       unsigned int    xxti_configuration;
+       unsigned int    xxti_status;
+       unsigned char   res45[0x14];
+       unsigned int    xxti_duration;
+       unsigned char   res46[0x1dc];
+       unsigned int    ext_regulator_duration;
+       unsigned char   res47[0x5e0];
+       unsigned int    cam_configuration;
+       unsigned int    cam_status;
+       unsigned int    cam_option;
+       unsigned char   res48[0x14];
+       unsigned int    tv_configuration;
+       unsigned int    tv_status;
+       unsigned int    tv_option;
+       unsigned char   res49[0x14];
+       unsigned int    mfc_configuration;
+       unsigned int    mfc_status;
+       unsigned int    mfc_option;
+       unsigned char   res50[0x14];
+       unsigned int    g3d_configuration;
+       unsigned int    g3d_status;
+       unsigned int    g3d_option;
+       unsigned char   res51[0x14];
+       unsigned int    lcd0_configuration;
+       unsigned int    lcd0_status;
+       unsigned int    lcd0_option;
+       unsigned char   res52[0x14];
+       unsigned int    lcd1_configuration;
+       unsigned int    lcd1_status;
+       unsigned int    lcd1_option;
+       unsigned char   res53[0x34];
+       unsigned int    gps_configuration;
+       unsigned int    gps_status;
+       unsigned int    gps_option;
+       unsigned char   res54[0x14];
+       unsigned int    gps_alive_configuration;
+       unsigned int    gps_alive_status;
+       unsigned int    gps_alive_option;
+};
+#endif /* __ASSEMBLY__ */
+
+#endif
index d0cf3cb853b84b4fab122752fad43ac8c53f2605..3e951601cdcbcd7e6083c4add83497ab79c53fe0 100644 (file)
@@ -57,7 +57,7 @@ struct s5p_timer {
        unsigned int    tcmpb2;
        unsigned int    tcnto2;
        unsigned int    tcntb3;
-       unsigned int    res1;
+       unsigned int    tcmpb3;
        unsigned int    tcnto3;
        unsigned int    tcntb4;
        unsigned int    tcnto4;
diff --git a/arch/arm/include/asm/arch-exynos/tzpc.h b/arch/arm/include/asm/arch-exynos/tzpc.h
new file mode 100644 (file)
index 0000000..2c9a07b
--- /dev/null
@@ -0,0 +1,52 @@
+/*
+ * (C) Copyright 2012 Samsung Electronics
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public 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 __TZPC_H_
+#define __TZPC_H_
+
+#ifndef __ASSEMBLY__
+struct exynos5_tzpc {
+       unsigned int r0size;
+       char res1[0x7FC];
+       unsigned int decprot0stat;
+       unsigned int decprot0set;
+       unsigned int decprot0clr;
+       unsigned int decprot1stat;
+       unsigned int decprot1set;
+       unsigned int decprot1clr;
+       unsigned int decprot2stat;
+       unsigned int decprot2set;
+       unsigned int decprot2clr;
+       unsigned int decprot3stat;
+       unsigned int decprot3set;
+       unsigned int decprot3clr;
+       char res2[0x7B0];
+       unsigned int periphid0;
+       unsigned int periphid1;
+       unsigned int periphid2;
+       unsigned int periphid3;
+       unsigned int pcellid0;
+       unsigned int pcellid1;
+       unsigned int pcellid2;
+       unsigned int pcellid3;
+};
+#endif
+
+#endif
diff --git a/arch/arm/include/asm/arch-exynos/watchdog.h b/arch/arm/include/asm/arch-exynos/watchdog.h
new file mode 100644 (file)
index 0000000..ee0c9c9
--- /dev/null
@@ -0,0 +1,57 @@
+/*
+ * Copyright (C) 2011 Samsung Electronics
+ * Heungjun Kim <riverful.kim@samsung.com>
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+#ifndef __ASM_ARM_ARCH_WATCHDOG_H_
+#define __ASM_ARM_ARCH_WATCHDOG_H_
+
+#define WTCON_RESET_OFFSET     0
+#define WTCON_INTEN_OFFSET     2
+#define WTCON_CLKSEL_OFFSET    3
+#define WTCON_EN_OFFSET                5
+#define WTCON_PRE_OFFSET       8
+
+#define WTCON_CLK_16           0x0
+#define WTCON_CLK_32           0x1
+#define WTCON_CLK_64           0x2
+#define WTCON_CLK_128          0x3
+
+#define WTCON_CLK(x)           ((x & 0x3) << WTCON_CLKSEL_OFFSET)
+#define WTCON_PRESCALER(x)     ((x) << WTCON_PRE_OFFSET)
+#define WTCON_EN               (0x1 << WTCON_EN_OFFSET)
+#define WTCON_RESET            (0x1 << WTCON_RESET_OFFSET)
+#define WTCON_INT              (0x1 << WTCON_INTEN_OFFSET)
+
+#ifndef __ASSEMBLY__
+struct s5p_watchdog {
+       unsigned int wtcon;
+       unsigned int wtdat;
+       unsigned int wtcnt;
+       unsigned int wtclrint;
+};
+
+/* functions */
+void wdt_stop(void);
+void wdt_start(unsigned int timeout);
+#endif /* __ASSEMBLY__ */
+
+#endif
index d1c199825fd36a6415168b32d00a314a7482c2be..91164eb4021a10f9f77a0e97c8de8b0e3c2bbaf0 100644 (file)
  * USB/EHCI
  */
 #ifdef CONFIG_CMD_USB
-#define CONFIG_USB_EHCI_KIRKWOOD
+#define CONFIG_USB_EHCI_MARVELL
 #define CONFIG_EHCI_IS_TDI
 #endif /* CONFIG_CMD_USB */
 
index 0035ed50a25902985c6b9bdd96343d31df9bdc4f..47771d5d70777f183533a0087835f9b166e3bfce 100644 (file)
 #define MVGBE0_BASE    KW_EGIGA0_BASE
 #define MVGBE1_BASE    KW_EGIGA1_BASE
 
+/* Kirkwood USB Host controller */
+#define MVUSB0_BASE                    KW_USB20_BASE
+#define MVUSB0_CPU_ATTR_DRAM_CS0       KWCPU_ATTR_DRAM_CS0
+#define MVUSB0_CPU_ATTR_DRAM_CS1       KWCPU_ATTR_DRAM_CS1
+#define MVUSB0_CPU_ATTR_DRAM_CS2       KWCPU_ATTR_DRAM_CS2
+#define MVUSB0_CPU_ATTR_DRAM_CS3       KWCPU_ATTR_DRAM_CS3
+
+/* Kirkwood CPU memory windows */
+#define MVCPU_WIN_CTRL_DATA    KWCPU_WIN_CTRL_DATA
+#define MVCPU_WIN_ENABLE       KWCPU_WIN_ENABLE
+#define MVCPU_WIN_DISABLE      KWCPU_WIN_DISABLE
+
 #if defined (CONFIG_KW88F6281)
 #include <asm/arch/kw88f6281.h>
 #elif defined (CONFIG_KW88F6192)
index 7e9c7aabb00cc71554eeb40a91e068d058886b21..fd062d3e896ac687798b5c8418bf383e6dc1dc93 100644 (file)
 
 #ifndef __ASM_ARCH_CLOCK_H
 #define __ASM_ARCH_CLOCK_H
-unsigned int imx_decode_pll(unsigned int pll, unsigned int f_ref);
 
-ulong imx_get_mpllclk(void);
-ulong imx_get_armclk(void);
-ulong imx_get_spllclk(void);
-ulong imx_get_fclk(void);
-ulong imx_get_hclk(void);
-ulong imx_get_bclk(void);
-ulong imx_get_perclk1(void);
-ulong imx_get_perclk2(void);
-ulong imx_get_perclk3(void);
-ulong imx_get_ahbclk(void);
+enum mxc_clock {
+       MXC_ARM_CLK,
+       MXC_UART_CLK,
+       MXC_ESDHC_CLK,
+       MXC_FEC_CLK,
+};
 
-#define imx_get_uartclk imx_get_perclk1
-#define imx_get_fecclk imx_get_ahbclk
+unsigned int mxc_get_clock(enum mxc_clock clk);
+#define imx_get_uartclk() mxc_get_clock(MXC_UART_CLK)
+#define imx_get_fecclk() mxc_get_clock(MXC_FEC_CLK)
 
 #endif /* __ASM_ARCH_CLOCK_H */
index 253a0e158481ef6338aa4c3d8472e0ce19b28959..852c19c1a74c45acd296001aa5749cc0f0351c45 100644 (file)
@@ -30,7 +30,8 @@ enum mxc_clock {
        MXC_IPG_PERCLK,
        MXC_CSPI_CLK,
        MXC_UART_CLK,
-       MXC_IPU_CLK
+       MXC_IPU_CLK,
+       MXC_ESDHC_CLK,
 };
 
 unsigned int mxc_get_clock(enum mxc_clock clk);
index 6a517ddd931ca0d1e598bd7456c4c611741602eb..798cc746722a0eec31f4b74d2554bb0d00a8c122 100644 (file)
@@ -709,6 +709,13 @@ struct esdc_regs {
 #define MUX_CTL_CSPI3_SPI_RDY  0x0e
 #define MUX_CTL_CSPI3_MOSI             0x13
 
+#define MUX_CTL_SD1_DATA1      0x18
+#define MUX_CTL_SD1_DATA2      0x19
+#define MUX_CTL_SD1_DATA3      0x1a
+#define MUX_CTL_SD1_CMD                0x1d
+#define MUX_CTL_SD1_CLK                0x1e
+#define MUX_CTL_SD1_DATA0      0x1f
+
 #define MUX_CTL_USBH2_DATA1    0x40
 #define MUX_CTL_USBH2_DIR      0x44
 #define MUX_CTL_USBH2_STP      0x45
@@ -855,6 +862,10 @@ struct esdc_regs {
  */
 #define NFC_BASE_ADDR  0xB8000000
 
+/* SD card controller */
+#define SDHC1_BASE_ADDR        0x50004000
+#define SDHC2_BASE_ADDR        0x50008000
+
 /*
  * Internal RAM (16KB)
  */
index 76003030d77815849956bf00f402151f684c485e..ded481c4339e77d3aafd69cf84ae5f915104e492 100644 (file)
@@ -31,5 +31,5 @@ struct mxc_weimcs {
 };
 
 void mxc_setup_weimcs(int cs, const struct mxc_weimcs *weimcs);
-
+int mxc_mmc_init(bd_t *bis);
 #endif
index b3f613c52aa29ddb9a82bbb6538d541df34f25e9..afaa068bb93ba3c4278bb255235ce3f60768ad07 100644 (file)
@@ -220,7 +220,7 @@ enum {
        MX6Q_PAD_EIM_D24__WEIM_WEIM_D_24        = IOMUX_PAD(0x03C8, 0x00B4, 0, 0x0000, 0, 0),
        MX6Q_PAD_EIM_D24__ECSPI4_SS2            = IOMUX_PAD(0x03C8, 0x00B4, 1, 0x0000, 0, 0),
        MX6Q_PAD_EIM_D24__UART3_TXD             = IOMUX_PAD(0x03C8, 0x00B4, 2, 0x0000, 0, 0),
-       MX6Q_PAD_EIM_D24__UART3_RXD             = IOMUX_PAD(0x03C8, 0x00B4, 2, 0x0930, 0, 0),
+       MX6Q_PAD_EIM_D24__UART3_TXD_RXD         = IOMUX_PAD(0x03C8, 0x00B4, 2, 0x0930, 0, 0),
        MX6Q_PAD_EIM_D24__ECSPI1_SS2            = IOMUX_PAD(0x03C8, 0x00B4, 3, 0x0808, 0, 0),
        MX6Q_PAD_EIM_D24__ECSPI2_SS2            = IOMUX_PAD(0x03C8, 0x00B4, 4, 0x0000, 0, 0),
        MX6Q_PAD_EIM_D24__GPIO_3_24             = IOMUX_PAD(0x03C8, 0x00B4, 5, 0x0000, 0, 0),
@@ -228,7 +228,6 @@ enum {
        MX6Q_PAD_EIM_D24__UART1_DTR             = IOMUX_PAD(0x03C8, 0x00B4, 7, 0x0000, 0, 0),
        MX6Q_PAD_EIM_D25__WEIM_WEIM_D_25        = IOMUX_PAD(0x03CC, 0x00B8, 0, 0x0000, 0, 0),
        MX6Q_PAD_EIM_D25__ECSPI4_SS3            = IOMUX_PAD(0x03CC, 0x00B8, 1, 0x0000, 0, 0),
-       MX6Q_PAD_EIM_D25__UART3_TXD             = IOMUX_PAD(0x03CC, 0x00B8, 2, 0x0000, 0, 0),
        MX6Q_PAD_EIM_D25__UART3_RXD             = IOMUX_PAD(0x03CC, 0x00B8, 2, 0x0930, 1, 0),
        MX6Q_PAD_EIM_D25__ECSPI1_SS3            = IOMUX_PAD(0x03CC, 0x00B8, 3, 0x080C, 0, 0),
        MX6Q_PAD_EIM_D25__ECSPI2_SS3            = IOMUX_PAD(0x03CC, 0x00B8, 4, 0x0000, 0, 0),
@@ -240,7 +239,7 @@ enum {
        MX6Q_PAD_EIM_D26__IPU1_CSI0_D_1         = IOMUX_PAD(0x03D0, 0x00BC, 2, 0x0000, 0, 0),
        MX6Q_PAD_EIM_D26__IPU2_CSI1_D_14        = IOMUX_PAD(0x03D0, 0x00BC, 3, 0x08C0, 0, 0),
        MX6Q_PAD_EIM_D26__UART2_TXD             = IOMUX_PAD(0x03D0, 0x00BC, 4, 0x0000, 0, 0),
-       MX6Q_PAD_EIM_D26__UART2_RXD             = IOMUX_PAD(0x03D0, 0x00BC, 4, 0x0928, 0, 0),
+       MX6Q_PAD_EIM_D26__UART2_TXD_RXD         = IOMUX_PAD(0x03D0, 0x00BC, 4, 0x0928, 0, 0),
        MX6Q_PAD_EIM_D26__GPIO_3_26             = IOMUX_PAD(0x03D0, 0x00BC, 5, 0x0000, 0, 0),
        MX6Q_PAD_EIM_D26__IPU1_SISG_2           = IOMUX_PAD(0x03D0, 0x00BC, 6, 0x0000, 0, 0),
        MX6Q_PAD_EIM_D26__IPU1_DISP1_DAT_22     = IOMUX_PAD(0x03D0, 0x00BC, 7, 0x0000, 0, 0),
@@ -248,7 +247,6 @@ enum {
        MX6Q_PAD_EIM_D27__IPU1_DI1_PIN13        = IOMUX_PAD(0x03D4, 0x00C0, 1, 0x0000, 0, 0),
        MX6Q_PAD_EIM_D27__IPU1_CSI0_D_0         = IOMUX_PAD(0x03D4, 0x00C0, 2, 0x0000, 0, 0),
        MX6Q_PAD_EIM_D27__IPU2_CSI1_D_13        = IOMUX_PAD(0x03D4, 0x00C0, 3, 0x08BC, 0, 0),
-       MX6Q_PAD_EIM_D27__UART2_TXD             = IOMUX_PAD(0x03D4, 0x00C0, 4, 0x0000, 0, 0),
        MX6Q_PAD_EIM_D27__UART2_RXD             = IOMUX_PAD(0x03D4, 0x00C0, 4, 0x0928, 1, 0),
        MX6Q_PAD_EIM_D27__GPIO_3_27             = IOMUX_PAD(0x03D4, 0x00C0, 5, 0x0000, 0, 0),
        MX6Q_PAD_EIM_D27__IPU1_SISG_3           = IOMUX_PAD(0x03D4, 0x00C0, 6, 0x0000, 0, 0),
@@ -938,7 +936,7 @@ enum {
        MX6Q_PAD_KEY_COL0__AUDMUX_AUD5_TXC      = IOMUX_PAD(0x05C8, 0x01F8, 2, 0x07DC, 1, 0),
        MX6Q_PAD_KEY_COL0__KPP_COL_0            = IOMUX_PAD(0x05C8, 0x01F8, 3, 0x0000, 0, 0),
        MX6Q_PAD_KEY_COL0__UART4_TXD            = IOMUX_PAD(0x05C8, 0x01F8, 4, 0x0000, 0, 0),
-       MX6Q_PAD_KEY_COL0__UART4_RXD            = IOMUX_PAD(0x05C8, 0x01F8, 4, 0x0938, 0, 0),
+       MX6Q_PAD_KEY_COL0__UART4_TXD_RXD        = IOMUX_PAD(0x05C8, 0x01F8, 4, 0x0938, 0, 0),
        MX6Q_PAD_KEY_COL0__GPIO_4_6             = IOMUX_PAD(0x05C8, 0x01F8, 5, 0x0000, 0, 0),
        MX6Q_PAD_KEY_COL0__DCIC1_DCIC_OUT       = IOMUX_PAD(0x05C8, 0x01F8, 6, 0x0000, 0, 0),
        MX6Q_PAD_KEY_COL0__SRC_ANY_PU_RST       = IOMUX_PAD(0x05C8, 0x01F8, 7, 0x0000, 0, 0),
@@ -946,7 +944,6 @@ enum {
        MX6Q_PAD_KEY_ROW0__ENET_TDATA_3         = IOMUX_PAD(0x05CC, 0x01FC, 1, 0x0000, 0, 0),
        MX6Q_PAD_KEY_ROW0__AUDMUX_AUD5_TXD      = IOMUX_PAD(0x05CC, 0x01FC, 2, 0x07D0, 1, 0),
        MX6Q_PAD_KEY_ROW0__KPP_ROW_0            = IOMUX_PAD(0x05CC, 0x01FC, 3, 0x0000, 0, 0),
-       MX6Q_PAD_KEY_ROW0__UART4_TXD            = IOMUX_PAD(0x05CC, 0x01FC, 4, 0x0000, 0, 0),
        MX6Q_PAD_KEY_ROW0__UART4_RXD            = IOMUX_PAD(0x05CC, 0x01FC, 4, 0x0938, 1, 0),
        MX6Q_PAD_KEY_ROW0__GPIO_4_7             = IOMUX_PAD(0x05CC, 0x01FC, 5, 0x0000, 0, 0),
        MX6Q_PAD_KEY_ROW0__DCIC2_DCIC_OUT       = IOMUX_PAD(0x05CC, 0x01FC, 6, 0x0000, 0, 0),
@@ -956,7 +953,7 @@ enum {
        MX6Q_PAD_KEY_COL1__AUDMUX_AUD5_TXFS     = IOMUX_PAD(0x05D0, 0x0200, 2, 0x07E0, 1, 0),
        MX6Q_PAD_KEY_COL1__KPP_COL_1            = IOMUX_PAD(0x05D0, 0x0200, 3, 0x0000, 0, 0),
        MX6Q_PAD_KEY_COL1__UART5_TXD            = IOMUX_PAD(0x05D0, 0x0200, 4, 0x0000, 0, 0),
-       MX6Q_PAD_KEY_COL1__UART5_RXD            = IOMUX_PAD(0x05D0, 0x0200, 4, 0x0940, 0, 0),
+       MX6Q_PAD_KEY_COL1__UART5_TXD_RXD        = IOMUX_PAD(0x05D0, 0x0200, 4, 0x0940, 0, 0),
        MX6Q_PAD_KEY_COL1__GPIO_4_8             = IOMUX_PAD(0x05D0, 0x0200, 5, 0x0000, 0, 0),
        MX6Q_PAD_KEY_COL1__USDHC1_VSELECT       = IOMUX_PAD(0x05D0, 0x0200, 6, 0x0000, 0, 0),
        MX6Q_PAD_KEY_COL1__PL301MX_PER1_HADR_1  = IOMUX_PAD(0x05D0, 0x0200, 7, 0x0000, 0, 0),
@@ -964,7 +961,6 @@ enum {
        MX6Q_PAD_KEY_ROW1__ENET_COL             = IOMUX_PAD(0x05D4, 0x0204, 1, 0x0000, 0, 0),
        MX6Q_PAD_KEY_ROW1__AUDMUX_AUD5_RXD      = IOMUX_PAD(0x05D4, 0x0204, 2, 0x07CC, 1, 0),
        MX6Q_PAD_KEY_ROW1__KPP_ROW_1            = IOMUX_PAD(0x05D4, 0x0204, 3, 0x0000, 0, 0),
-       MX6Q_PAD_KEY_ROW1__UART5_TXD            = IOMUX_PAD(0x05D4, 0x0204, 4, 0x0000, 0, 0),
        MX6Q_PAD_KEY_ROW1__UART5_RXD            = IOMUX_PAD(0x05D4, 0x0204, 4, 0x0940, 1, 0),
        MX6Q_PAD_KEY_ROW1__GPIO_4_9             = IOMUX_PAD(0x05D4, 0x0204, 5, 0x0000, 0, 0),
        MX6Q_PAD_KEY_ROW1__USDHC2_VSELECT       = IOMUX_PAD(0x05D4, 0x0204, 6, 0x0000, 0, 0),
@@ -1085,7 +1081,7 @@ enum {
        MX6Q_PAD_GPIO_7__EPIT1_EPITO            = IOMUX_PAD(0x0610, 0x0240, 2, 0x0000, 0, 0),
        MX6Q_PAD_GPIO_7__CAN1_TXCAN             = IOMUX_PAD(0x0610, 0x0240, 3, 0x0000, 0, 0),
        MX6Q_PAD_GPIO_7__UART2_TXD              = IOMUX_PAD(0x0610, 0x0240, 4, 0x0000, 0, 0),
-       MX6Q_PAD_GPIO_7__UART2_RXD              = IOMUX_PAD(0x0610, 0x0240, 4, 0x0928, 2, 0),
+       MX6Q_PAD_GPIO_7__UART2_TXD_RXD          = IOMUX_PAD(0x0610, 0x0240, 4, 0x0928, 2, 0),
        MX6Q_PAD_GPIO_7__GPIO_1_7               = IOMUX_PAD(0x0610, 0x0240, 5, 0x0000, 0, 0),
        MX6Q_PAD_GPIO_7__SPDIF_PLOCK            = IOMUX_PAD(0x0610, 0x0240, 6, 0x0000, 0, 0),
        MX6Q_PAD_GPIO_7__USBOH3_OTGUSB_HST_MODE = IOMUX_PAD(0x0610, 0x0240, 7, 0x0000, 0, 0),
@@ -1093,7 +1089,6 @@ enum {
        MX6Q_PAD_GPIO_8__ANATOP_ANATOP_32K_OUT  = IOMUX_PAD(0x0614, 0x0244, 1, 0x0000, 0, 0),
        MX6Q_PAD_GPIO_8__EPIT2_EPITO            = IOMUX_PAD(0x0614, 0x0244, 2, 0x0000, 0, 0),
        MX6Q_PAD_GPIO_8__CAN1_RXCAN             = IOMUX_PAD(0x0614, 0x0244, 3, 0x07E4, 1, 0),
-       MX6Q_PAD_GPIO_8__UART2_TXD              = IOMUX_PAD(0x0614, 0x0244, 4, 0x0000, 0, 0),
        MX6Q_PAD_GPIO_8__UART2_RXD              = IOMUX_PAD(0x0614, 0x0244, 4, 0x0928, 3, 0),
        MX6Q_PAD_GPIO_8__GPIO_1_8               = IOMUX_PAD(0x0614, 0x0244, 5, 0x0000, 0, 0),
        MX6Q_PAD_GPIO_8__SPDIF_SRCLK            = IOMUX_PAD(0x0614, 0x0244, 6, 0x0000, 0, 0),
@@ -1208,7 +1203,7 @@ enum {
        MX6Q_PAD_CSI0_DAT10__AUDMUX_AUD3_RXC    = IOMUX_PAD(0x0650, 0x0280, 1, 0x0000, 0, 0),
        MX6Q_PAD_CSI0_DAT10__ECSPI2_MISO        = IOMUX_PAD(0x0650, 0x0280, 2, 0x0814, 2, 0),
        MX6Q_PAD_CSI0_DAT10__UART1_TXD          = IOMUX_PAD(0x0650, 0x0280, 3, 0x0000, 0, 0),
-       MX6Q_PAD_CSI0_DAT10__UART1_RXD          = IOMUX_PAD(0x0650, 0x0280, 3, 0x0920, 0, 0),
+       MX6Q_PAD_CSI0_DAT10__UART1_TXD_RXD      = IOMUX_PAD(0x0650, 0x0280, 3, 0x0920, 0, 0),
        MX6Q_PAD_CSI0_DAT10__SDMA_DEBUG_PC_4    = IOMUX_PAD(0x0650, 0x0280, 4, 0x0000, 0, 0),
        MX6Q_PAD_CSI0_DAT10__GPIO_5_28          = IOMUX_PAD(0x0650, 0x0280, 5, 0x0000, 0, 0),
        MX6Q_PAD_CSI0_DAT10__MMDC_MMDC_DEBUG_33 = IOMUX_PAD(0x0650, 0x0280, 6, 0x0000, 0, 0),
@@ -1216,7 +1211,6 @@ enum {
        MX6Q_PAD_CSI0_DAT11__IPU1_CSI0_D_11     = IOMUX_PAD(0x0654, 0x0284, 0, 0x0000, 0, 0),
        MX6Q_PAD_CSI0_DAT11__AUDMUX_AUD3_RXFS   = IOMUX_PAD(0x0654, 0x0284, 1, 0x0000, 0, 0),
        MX6Q_PAD_CSI0_DAT11__ECSPI2_SS0         = IOMUX_PAD(0x0654, 0x0284, 2, 0x081C, 2, 0),
-       MX6Q_PAD_CSI0_DAT11__UART1_TXD          = IOMUX_PAD(0x0654, 0x0284, 3, 0x0000, 0, 0),
        MX6Q_PAD_CSI0_DAT11__UART1_RXD          = IOMUX_PAD(0x0654, 0x0284, 3, 0x0920, 1, 0),
        MX6Q_PAD_CSI0_DAT11__SDMA_DEBUG_PC_5    = IOMUX_PAD(0x0654, 0x0284, 4, 0x0000, 0, 0),
        MX6Q_PAD_CSI0_DAT11__GPIO_5_29          = IOMUX_PAD(0x0654, 0x0284, 5, 0x0000, 0, 0),
@@ -1226,7 +1220,7 @@ enum {
        MX6Q_PAD_CSI0_DAT12__WEIM_WEIM_D_8      = IOMUX_PAD(0x0658, 0x0288, 1, 0x0000, 0, 0),
        MX6Q_PAD_CSI0_DAT12__PCIE_CTRL_MUX_16   = IOMUX_PAD(0x0658, 0x0288, 2, 0x0000, 0, 0),
        MX6Q_PAD_CSI0_DAT12__UART4_TXD          = IOMUX_PAD(0x0658, 0x0288, 3, 0x0000, 0, 0),
-       MX6Q_PAD_CSI0_DAT12__UART4_RXD          = IOMUX_PAD(0x0658, 0x0288, 3, 0x0938, 2, 0),
+       MX6Q_PAD_CSI0_DAT12__UART4_TXD_RXD      = IOMUX_PAD(0x0658, 0x0288, 3, 0x0938, 2, 0),
        MX6Q_PAD_CSI0_DAT12__SDMA_DEBUG_PC_6    = IOMUX_PAD(0x0658, 0x0288, 4, 0x0000, 0, 0),
        MX6Q_PAD_CSI0_DAT12__GPIO_5_30          = IOMUX_PAD(0x0658, 0x0288, 5, 0x0000, 0, 0),
        MX6Q_PAD_CSI0_DAT12__MMDC_MMDC_DEBUG_35 = IOMUX_PAD(0x0658, 0x0288, 6, 0x0000, 0, 0),
@@ -1234,7 +1228,6 @@ enum {
        MX6Q_PAD_CSI0_DAT13__IPU1_CSI0_D_13     = IOMUX_PAD(0x065C, 0x028C, 0, 0x0000, 0, 0),
        MX6Q_PAD_CSI0_DAT13__WEIM_WEIM_D_9      = IOMUX_PAD(0x065C, 0x028C, 1, 0x0000, 0, 0),
        MX6Q_PAD_CSI0_DAT13__PCIE_CTRL_MUX_17   = IOMUX_PAD(0x065C, 0x028C, 2, 0x0000, 0, 0),
-       MX6Q_PAD_CSI0_DAT13__UART4_TXD          = IOMUX_PAD(0x065C, 0x028C, 3, 0x0000, 0, 0),
        MX6Q_PAD_CSI0_DAT13__UART4_RXD          = IOMUX_PAD(0x065C, 0x028C, 3, 0x0938, 3, 0),
        MX6Q_PAD_CSI0_DAT13__SDMA_DEBUG_PC_7    = IOMUX_PAD(0x065C, 0x028C, 4, 0x0000, 0, 0),
        MX6Q_PAD_CSI0_DAT13__GPIO_5_31          = IOMUX_PAD(0x065C, 0x028C, 5, 0x0000, 0, 0),
@@ -1244,7 +1237,7 @@ enum {
        MX6Q_PAD_CSI0_DAT14__WEIM_WEIM_D_10     = IOMUX_PAD(0x0660, 0x0290, 1, 0x0000, 0, 0),
        MX6Q_PAD_CSI0_DAT14__PCIE_CTRL_MUX_18   = IOMUX_PAD(0x0660, 0x0290, 2, 0x0000, 0, 0),
        MX6Q_PAD_CSI0_DAT14__UART5_TXD          = IOMUX_PAD(0x0660, 0x0290, 3, 0x0000, 0, 0),
-       MX6Q_PAD_CSI0_DAT14__UART5_RXD          = IOMUX_PAD(0x0660, 0x0290, 3, 0x0940, 2, 0),
+       MX6Q_PAD_CSI0_DAT14__UART5_TXD_RXD      = IOMUX_PAD(0x0660, 0x0290, 3, 0x0940, 2, 0),
        MX6Q_PAD_CSI0_DAT14__SDMA_DEBUG_PC_8    = IOMUX_PAD(0x0660, 0x0290, 4, 0x0000, 0, 0),
        MX6Q_PAD_CSI0_DAT14__GPIO_6_0           = IOMUX_PAD(0x0660, 0x0290, 5, 0x0000, 0, 0),
        MX6Q_PAD_CSI0_DAT14__MMDC_MMDC_DEBUG_37 = IOMUX_PAD(0x0660, 0x0290, 6, 0x0000, 0, 0),
@@ -1252,7 +1245,6 @@ enum {
        MX6Q_PAD_CSI0_DAT15__IPU1_CSI0_D_15     = IOMUX_PAD(0x0664, 0x0294, 0, 0x0000, 0, 0),
        MX6Q_PAD_CSI0_DAT15__WEIM_WEIM_D_11     = IOMUX_PAD(0x0664, 0x0294, 1, 0x0000, 0, 0),
        MX6Q_PAD_CSI0_DAT15__PCIE_CTRL_MUX_19   = IOMUX_PAD(0x0664, 0x0294, 2, 0x0000, 0, 0),
-       MX6Q_PAD_CSI0_DAT15__UART5_TXD          = IOMUX_PAD(0x0664, 0x0294, 3, 0x0000, 0, 0),
        MX6Q_PAD_CSI0_DAT15__UART5_RXD          = IOMUX_PAD(0x0664, 0x0294, 3, 0x0940, 3, 0),
        MX6Q_PAD_CSI0_DAT15__SDMA_DEBUG_PC_9    = IOMUX_PAD(0x0664, 0x0294, 4, 0x0000, 0, 0),
        MX6Q_PAD_CSI0_DAT15__GPIO_6_1           = IOMUX_PAD(0x0664, 0x0294, 5, 0x0000, 0, 0),
@@ -1318,7 +1310,7 @@ enum {
        MX6Q_PAD_TEST_MODE__TCU_TEST_MODE       = IOMUX_PAD(NO_PAD_I, NO_MUX_I, 0, 0x0000, 0, 0),
        MX6Q_PAD_SD3_DAT7__USDHC3_DAT7          = IOMUX_PAD(0x0690, 0x02A8, 0, 0x0000, 0, 0),
        MX6Q_PAD_SD3_DAT7__UART1_TXD            = IOMUX_PAD(0x0690, 0x02A8, 1, 0x0000, 0, 0),
-       MX6Q_PAD_SD3_DAT7__UART1_RXD            = IOMUX_PAD(0x0690, 0x02A8, 1, 0x0920, 2, 0),
+       MX6Q_PAD_SD3_DAT7__UART1_TXD_RXD        = IOMUX_PAD(0x0690, 0x02A8, 1, 0x0920, 2, 0),
        MX6Q_PAD_SD3_DAT7__PCIE_CTRL_MUX_24     = IOMUX_PAD(0x0690, 0x02A8, 2, 0x0000, 0, 0),
        MX6Q_PAD_SD3_DAT7__USBOH3_UH3_DFD_OUT_0 = IOMUX_PAD(0x0690, 0x02A8, 3, 0x0000, 0, 0),
        MX6Q_PAD_SD3_DAT7__USBOH3_UH2_DFD_OUT_0 = IOMUX_PAD(0x0690, 0x02A8, 4, 0x0000, 0, 0),
@@ -1326,7 +1318,6 @@ enum {
        MX6Q_PAD_SD3_DAT7__MIPI_CORE_DPHY_IN_12 = IOMUX_PAD(0x0690, 0x02A8, 6, 0x0000, 0, 0),
        MX6Q_PAD_SD3_DAT7__USBPHY2_CLK20DIV     = IOMUX_PAD(0x0690, 0x02A8, 7, 0x0000, 0, 0),
        MX6Q_PAD_SD3_DAT6__USDHC3_DAT6          = IOMUX_PAD(0x0694, 0x02AC, 0, 0x0000, 0, 0),
-       MX6Q_PAD_SD3_DAT6__UART1_TXD            = IOMUX_PAD(0x0694, 0x02AC, 1, 0x0000, 0, 0),
        MX6Q_PAD_SD3_DAT6__UART1_RXD            = IOMUX_PAD(0x0694, 0x02AC, 1, 0x0920, 3, 0),
        MX6Q_PAD_SD3_DAT6__PCIE_CTRL_MUX_25     = IOMUX_PAD(0x0694, 0x02AC, 2, 0x0000, 0, 0),
        MX6Q_PAD_SD3_DAT6__USBOH3_UH3_DFD_OUT_1 = IOMUX_PAD(0x0694, 0x02AC, 3, 0x0000, 0, 0),
@@ -1336,7 +1327,7 @@ enum {
        MX6Q_PAD_SD3_DAT6__ANATOP_TESTO_10      = IOMUX_PAD(0x0694, 0x02AC, 7, 0x0000, 0, 0),
        MX6Q_PAD_SD3_DAT5__USDHC3_DAT5          = IOMUX_PAD(0x0698, 0x02B0, 0, 0x0000, 0, 0),
        MX6Q_PAD_SD3_DAT5__UART2_TXD            = IOMUX_PAD(0x0698, 0x02B0, 1, 0x0000, 0, 0),
-       MX6Q_PAD_SD3_DAT5__UART2_RXD            = IOMUX_PAD(0x0698, 0x02B0, 1, 0x0928, 4, 0),
+       MX6Q_PAD_SD3_DAT5__UART2_TXD_RXD        = IOMUX_PAD(0x0698, 0x02B0, 1, 0x0928, 4, 0),
        MX6Q_PAD_SD3_DAT5__PCIE_CTRL_MUX_26     = IOMUX_PAD(0x0698, 0x02B0, 2, 0x0000, 0, 0),
        MX6Q_PAD_SD3_DAT5__USBOH3_UH3_DFD_OUT_2 = IOMUX_PAD(0x0698, 0x02B0, 3, 0x0000, 0, 0),
        MX6Q_PAD_SD3_DAT5__USBOH3_UH2_DFD_OUT_2 = IOMUX_PAD(0x0698, 0x02B0, 4, 0x0000, 0, 0),
@@ -1344,7 +1335,6 @@ enum {
        MX6Q_PAD_SD3_DAT5__MIPI_CORE_DPHY_IN_14 = IOMUX_PAD(0x0698, 0x02B0, 6, 0x0000, 0, 0),
        MX6Q_PAD_SD3_DAT5__ANATOP_TESTO_11      = IOMUX_PAD(0x0698, 0x02B0, 7, 0x0000, 0, 0),
        MX6Q_PAD_SD3_DAT4__USDHC3_DAT4          = IOMUX_PAD(0x069C, 0x02B4, 0, 0x0000, 0, 0),
-       MX6Q_PAD_SD3_DAT4__UART2_TXD            = IOMUX_PAD(0x069C, 0x02B4, 1, 0x0000, 0, 0),
        MX6Q_PAD_SD3_DAT4__UART2_RXD            = IOMUX_PAD(0x069C, 0x02B4, 1, 0x0928, 5, 0),
        MX6Q_PAD_SD3_DAT4__PCIE_CTRL_MUX_27     = IOMUX_PAD(0x069C, 0x02B4, 2, 0x0000, 0, 0),
        MX6Q_PAD_SD3_DAT4__USBOH3_UH3_DFD_OUT_3 = IOMUX_PAD(0x069C, 0x02B4, 3, 0x0000, 0, 0),
@@ -1471,13 +1461,12 @@ enum {
        MX6Q_PAD_SD4_CMD__USDHC4_CMD            = IOMUX_PAD(0x06DC, 0x02F4, 16, 0x0000, 0, 0),
        MX6Q_PAD_SD4_CMD__RAWNAND_RDN           = IOMUX_PAD(0x06DC, 0x02F4, 1, 0x0000, 0, 0),
        MX6Q_PAD_SD4_CMD__UART3_TXD             = IOMUX_PAD(0x06DC, 0x02F4, 2, 0x0000, 0, 0),
-       MX6Q_PAD_SD4_CMD__UART3_RXD             = IOMUX_PAD(0x06DC, 0x02F4, 2, 0x0930, 2, 0),
+       MX6Q_PAD_SD4_CMD__UART3_TXD_RXD         = IOMUX_PAD(0x06DC, 0x02F4, 2, 0x0930, 2, 0),
        MX6Q_PAD_SD4_CMD__PCIE_CTRL_MUX_5       = IOMUX_PAD(0x06DC, 0x02F4, 4, 0x0000, 0, 0),
        MX6Q_PAD_SD4_CMD__GPIO_7_9              = IOMUX_PAD(0x06DC, 0x02F4, 5, 0x0000, 0, 0),
        MX6Q_PAD_SD4_CMD__TPSMP_HDATA_DIR       = IOMUX_PAD(0x06DC, 0x02F4, 7, 0x0000, 0, 0),
        MX6Q_PAD_SD4_CLK__USDHC4_CLK            = IOMUX_PAD(0x06E0, 0x02F8, 0, 0x0000, 0, 0),
        MX6Q_PAD_SD4_CLK__RAWNAND_WRN           = IOMUX_PAD(0x06E0, 0x02F8, 1, 0x0000, 0, 0),
-       MX6Q_PAD_SD4_CLK__UART3_TXD             = IOMUX_PAD(0x06E0, 0x02F8, 2, 0x0000, 0, 0),
        MX6Q_PAD_SD4_CLK__UART3_RXD             = IOMUX_PAD(0x06E0, 0x02F8, 2, 0x0930, 3, 0),
        MX6Q_PAD_SD4_CLK__PCIE_CTRL_MUX_6       = IOMUX_PAD(0x06E0, 0x02F8, 4, 0x0000, 0, 0),
        MX6Q_PAD_SD4_CLK__GPIO_7_10             = IOMUX_PAD(0x06E0, 0x02F8, 5, 0x0000, 0, 0),
@@ -1578,7 +1567,6 @@ enum {
        MX6Q_PAD_SD4_DAT3__IPU2_IPU_DIAG_BUS_11 = IOMUX_PAD(0x0710, 0x0328, 7, 0x0000, 0, 0),
        MX6Q_PAD_SD4_DAT4__RAWNAND_D12          = IOMUX_PAD(0x0714, 0x032C, 0, 0x0000, 0, 0),
        MX6Q_PAD_SD4_DAT4__USDHC4_DAT4          = IOMUX_PAD(0x0714, 0x032C, 1, 0x0000, 0, 0),
-       MX6Q_PAD_SD4_DAT4__UART2_TXD            = IOMUX_PAD(0x0714, 0x032C, 2, 0x0000, 0, 0),
        MX6Q_PAD_SD4_DAT4__UART2_RXD            = IOMUX_PAD(0x0714, 0x032C, 2, 0x0928, 6, 0),
        MX6Q_PAD_SD4_DAT4__USBOH3_UH2_DFD_OUT28 = IOMUX_PAD(0x0714, 0x032C, 3, 0x0000, 0, 0),
        MX6Q_PAD_SD4_DAT4__USBOH3_UH3_DFD_OUT28 = IOMUX_PAD(0x0714, 0x032C, 4, 0x0000, 0, 0),
@@ -1605,7 +1593,7 @@ enum {
        MX6Q_PAD_SD4_DAT7__RAWNAND_D15          = IOMUX_PAD(0x0720, 0x0338, 0, 0x0000, 0, 0),
        MX6Q_PAD_SD4_DAT7__USDHC4_DAT7          = IOMUX_PAD(0x0720, 0x0338, 1, 0x0000, 0, 0),
        MX6Q_PAD_SD4_DAT7__UART2_TXD            = IOMUX_PAD(0x0720, 0x0338, 2, 0x0000, 0, 0),
-       MX6Q_PAD_SD4_DAT7__UART2_RXD            = IOMUX_PAD(0x0720, 0x0338, 2, 0x0928, 7, 0),
+       MX6Q_PAD_SD4_DAT7__UART2_TXD_RXD        = IOMUX_PAD(0x0720, 0x0338, 2, 0x0928, 7, 0),
        MX6Q_PAD_SD4_DAT7__USBOH3_UH2_DFD_OUT31 = IOMUX_PAD(0x0720, 0x0338, 3, 0x0000, 0, 0),
        MX6Q_PAD_SD4_DAT7__USBOH3_UH3_DFD_OUT31 = IOMUX_PAD(0x0720, 0x0338, 4, 0x0000, 0, 0),
        MX6Q_PAD_SD4_DAT7__GPIO_2_15            = IOMUX_PAD(0x0720, 0x0338, 5, 0x0000, 0, 0),
index db29b7c6df55e9cb9b901cae185f0be87a166cad..5925ac4e1eb76021741fc908c5a9b1baf0f7be8e 100644 (file)
@@ -72,7 +72,7 @@
 #define MPU_FSEL_13_ES1                0x03
 #define MPU_M2_13_ES1          0x01
 
-#define MPU_M_13_ES2           0x1F4
+#define MPU_M_13_ES2           0x258
 #define MPU_N_13_ES2           0x0C
 #define MPU_FSEL_13_ES2                0x03
 #define MPU_M2_13_ES2          0x01
diff --git a/arch/arm/include/asm/arch-omap3/ehci.h b/arch/arm/include/asm/arch-omap3/ehci.h
new file mode 100644 (file)
index 0000000..0f73d20
--- /dev/null
@@ -0,0 +1,55 @@
+/*
+ * (C) Copyright 2011
+ * Alexander Holler <holler@ahsoftware.de>
+ *
+ * Based on "drivers/usb/host/ehci-omap.c" from Linux 2.6.37
+ *
+ * See there for additional Copyrights.
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301 USA
+ */
+#ifndef _OMAP3_EHCI_H_
+#define _OMAP3_EHCI_H_
+
+/* USB/EHCI registers */
+#define OMAP_USBTLL_BASE                               0x48062000UL
+#define OMAP_UHH_BASE                                  0x48064000UL
+#define OMAP_EHCI_BASE                                 0x48064800UL
+
+/* TLL Register Set */
+#define OMAP_USBTLL_SYSCONFIG_SOFTRESET                        (1 << 1)
+#define OMAP_USBTLL_SYSCONFIG_ENAWAKEUP                        (1 << 2)
+#define OMAP_USBTLL_SYSCONFIG_SIDLEMODE                        (1 << 3)
+#define OMAP_USBTLL_SYSCONFIG_CACTIVITY                        (1 << 8)
+#define OMAP_USBTLL_SYSSTATUS_RESETDONE                        1
+
+/* UHH Register Set */
+#define OMAP_UHH_SYSCONFIG_SOFTRESET                   (1 << 1)
+#define OMAP_UHH_SYSCONFIG_CACTIVITY                   (1 << 8)
+#define OMAP_UHH_SYSCONFIG_SIDLEMODE                   (1 << 3)
+#define OMAP_UHH_SYSCONFIG_ENAWAKEUP                   (1 << 2)
+#define OMAP_UHH_SYSCONFIG_MIDLEMODE                   (1 << 12)
+#define OMAP_UHH_SYSSTATUS_EHCI_RESETDONE              (1 << 2)
+
+#define OMAP_UHH_SYSCONFIG_VAL         (OMAP_UHH_SYSCONFIG_CACTIVITY | \
+                                       OMAP_UHH_SYSCONFIG_SIDLEMODE | \
+                                       OMAP_UHH_SYSCONFIG_ENAWAKEUP | \
+                                       OMAP_UHH_SYSCONFIG_MIDLEMODE)
+
+#endif /* _OMAP3_EHCI_H_ */
diff --git a/arch/arm/include/asm/arch-omap3/ehci_omap3.h b/arch/arm/include/asm/arch-omap3/ehci_omap3.h
deleted file mode 100644 (file)
index cd01f50..0000000
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * (C) Copyright 2011
- * Alexander Holler <holler@ahsoftware.de>
- *
- * Based on "drivers/usb/host/ehci-omap.c" from Linux 2.6.37
- *
- * See there for additional Copyrights.
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301 USA
- */
-#ifndef _EHCI_OMAP3_H_
-#define _EHCI_OMAP3_H_
-
-/* USB/EHCI registers */
-#define OMAP3_USBTLL_BASE                              0x48062000UL
-#define OMAP3_UHH_BASE                                 0x48064000UL
-#define OMAP3_EHCI_BASE                                        0x48064800UL
-
-/* TLL Register Set */
-#define        OMAP_USBTLL_SYSCONFIG                           (0x10)
-#define        OMAP_USBTLL_SYSCONFIG_SOFTRESET                 (1 << 1)
-#define        OMAP_USBTLL_SYSCONFIG_ENAWAKEUP                 (1 << 2)
-#define        OMAP_USBTLL_SYSCONFIG_SIDLEMODE                 (1 << 3)
-#define        OMAP_USBTLL_SYSCONFIG_CACTIVITY                 (1 << 8)
-
-#define        OMAP_USBTLL_SYSSTATUS                           (0x14)
-#define        OMAP_USBTLL_SYSSTATUS_RESETDONE                 (1 << 0)
-
-/* UHH Register Set */
-#define        OMAP_UHH_SYSCONFIG                              (0x10)
-#define        OMAP_UHH_SYSCONFIG_SOFTRESET                    (1 << 1)
-#define        OMAP_UHH_SYSCONFIG_CACTIVITY                    (1 << 8)
-#define        OMAP_UHH_SYSCONFIG_SIDLEMODE                    (1 << 3)
-#define        OMAP_UHH_SYSCONFIG_ENAWAKEUP                    (1 << 2)
-#define        OMAP_UHH_SYSCONFIG_MIDLEMODE                    (1 << 12)
-
-#define        OMAP_UHH_HOSTCONFIG                             (0x40)
-#define OMAP_UHH_HOSTCONFIG_INCR4_BURST_EN             (1 << 2)
-#define OMAP_UHH_HOSTCONFIG_INCR8_BURST_EN             (1 << 3)
-#define OMAP_UHH_HOSTCONFIG_INCR16_BURST_EN            (1 << 4)
-
-#endif /* _EHCI_OMAP3_H_ */
index 4ca929edeafa422b11cca8808ae4e485c8571cbf..9f6992a12101803ed0fe6816d99d9754aa5aa45c 100644 (file)
@@ -80,15 +80,15 @@ enum {
 #define ACTIM_CTRLA_TDPL(v)    (((v) & 0x07) << 6)     /*  8:6  */
 #define ACTIM_CTRLA_TDAL(v)    (v & 0x1F)              /*  4:0  */
 
-#define ACTIM_CTRLA(a,b,c,d,e,f,g,h)           \
-               ACTIM_CTRLA_TRFC(a)     |       \
-               ACTIM_CTRLA_TRC(b)      |       \
-               ACTIM_CTRLA_TRAS(b)     |       \
-               ACTIM_CTRLA_TRP(d)      |       \
-               ACTIM_CTRLA_TRCD(e)     |       \
-               ACTIM_CTRLA_TRRD(f)     |       \
-               ACTIM_CTRLA_TDPL(g)     |       \
-               ACTIM_CTRLA_TDAL(h)
+#define ACTIM_CTRLA(trfc, trc, tras, trp, trcd, trrd, tdpl, tdal)      \
+               ACTIM_CTRLA_TRFC(trfc)  |       \
+               ACTIM_CTRLA_TRC(trc)    |       \
+               ACTIM_CTRLA_TRAS(tras)  |       \
+               ACTIM_CTRLA_TRP(trp)    |       \
+               ACTIM_CTRLA_TRCD(trcd)  |       \
+               ACTIM_CTRLA_TRRD(trrd)  |       \
+               ACTIM_CTRLA_TDPL(tdpl)  |       \
+               ACTIM_CTRLA_TDAL(tdal)
 
 /* Helper macros to arrive at value of the SDRC_ACTIM_CTRLB register. */
 #define ACTIM_CTRLB_TWTR(v)    (((v) & 0x03) << 16)    /* 17:16 */
@@ -96,11 +96,11 @@ enum {
 #define ACTIM_CTRLB_TXP(v)     (((v) & 0x07) << 8)     /* 10:8  */
 #define ACTIM_CTRLB_TXSR(v)    (v & 0xFF)              /*  7:0  */
 
-#define ACTIM_CTRLB(a,b,c,d)                   \
-               ACTIM_CTRLB_TWTR(a)     |       \
-               ACTIM_CTRLB_TCKE(b)     |       \
-               ACTIM_CTRLB_TXP(b)      |       \
-               ACTIM_CTRLB_TXSR(d)
+#define ACTIM_CTRLB(twtr, tcke, txp, txsr)             \
+               ACTIM_CTRLB_TWTR(twtr)  |       \
+               ACTIM_CTRLB_TCKE(tcke)  |       \
+               ACTIM_CTRLB_TXP(txp)    |       \
+               ACTIM_CTRLB_TXSR(txsr)
 
 /*
  * Values used in the MCFG register.  Only values we use today
@@ -110,18 +110,19 @@ enum {
 #define V_MCFG_RAMTYPE_DDR             (0x1)
 #define V_MCFG_DEEPPD_EN               (0x1 << 3)
 #define V_MCFG_B32NOT16_32             (0x1 << 4)
-#define V_MCFG_BANKALLOCATION_RBC      (0x2 << 6)      /* 6:7 */
-#define V_MCFG_RAMSIZE(a)              ((((a)/(1024*1024))/2) << 8) /* 8:17 */
+#define V_MCFG_BANKALLOCATION_RBC      (0x2 << 6)              /* 6:7 */
+#define V_MCFG_RAMSIZE(ramsize)                ((((ramsize) >> 20)/2) << 8) /* 8:17 */
 #define V_MCFG_ADDRMUXLEGACY_FLEX      (0x1 << 19)
-#define V_MCFG_CASWIDTH_10B            (0x5 << 20)     /* 20:22 */
-#define V_MCFG_RASWIDTH(a)             ((a) << 24)     /* 24:26 */
+#define V_MCFG_CASWIDTH(caswidth)      (((caswidth)-5) << 20)  /* 20:22 */
+#define V_MCFG_CASWIDTH_10B            V_MCFG_CASWIDTH(10)
+#define V_MCFG_RASWIDTH(raswidth)      (((raswidth)-11) << 24) /* 24:26 */
 
 /* Macro to construct MCFG */
-#define MCFG(a, b)                                             \
-               V_MCFG_RASWIDTH(b) | V_MCFG_CASWIDTH_10B |      \
-               V_MCFG_ADDRMUXLEGACY_FLEX | V_MCFG_RAMSIZE(a) | \
-               V_MCFG_BANKALLOCATION_RBC |                     \
-               V_MCFG_B32NOT16_32 | V_MCFG_DEEPPD_EN | V_MCFG_RAMTYPE_DDR
+#define MCFG(ramsize, raswidth)                                                \
+               V_MCFG_RASWIDTH(raswidth) | V_MCFG_CASWIDTH_10B |       \
+               V_MCFG_ADDRMUXLEGACY_FLEX | V_MCFG_RAMSIZE(ramsize) |   \
+               V_MCFG_BANKALLOCATION_RBC | V_MCFG_B32NOT16_32 |        \
+               V_MCFG_DEEPPD_EN | V_MCFG_RAMTYPE_DDR
 
 /* Hynix part of Overo (165MHz optimized) 6.06ns */
 #define HYNIX_TDAL_165   6
@@ -146,7 +147,7 @@ enum {
                ACTIM_CTRLB(HYNIX_TWTR_165, HYNIX_TCKE_165,     \
                                HYNIX_TXP_165, HYNIX_XSR_165)
 
-#define HYNIX_RASWIDTH_165     0x2
+#define HYNIX_RASWIDTH_165     13
 #define HYNIX_V_MCFG_165(size) MCFG((size), HYNIX_RASWIDTH_165)
 
 /* Hynix part of AM/DM37xEVM (200MHz optimized) */
@@ -172,7 +173,7 @@ enum {
                ACTIM_CTRLB(HYNIX_TWTR_200, HYNIX_TCKE_200,     \
                                HYNIX_TXP_200, HYNIX_XSR_200)
 
-#define HYNIX_RASWIDTH_200     0x3
+#define HYNIX_RASWIDTH_200     14
 #define HYNIX_V_MCFG_200(size) MCFG((size), HYNIX_RASWIDTH_200)
 
 /* Infineon part of 3430SDP (165MHz optimized) 6.06ns */
@@ -227,7 +228,7 @@ enum {
                ACTIM_CTRLB(MICRON_TWTR_165, MICRON_TCKE_165,   \
                                MICRON_TXP_165, MICRON_XSR_165)
 
-#define MICRON_RASWIDTH_165    0x2
+#define MICRON_RASWIDTH_165    13
 #define MICRON_V_MCFG_165(size)        MCFG((size), MICRON_RASWIDTH_165)
 
 #define MICRON_BL_165                  0x2
@@ -261,7 +262,7 @@ enum {
                ACTIM_CTRLB(MICRON_TWTR_200, MICRON_TCKE_200,   \
                                MICRON_TXP_200, MICRON_XSR_200)
 
-#define MICRON_RASWIDTH_200    0x3
+#define MICRON_RASWIDTH_200    14
 #define MICRON_V_MCFG_200(size)        MCFG((size), MICRON_RASWIDTH_200)
 
 /* NUMONYX part of IGEP v2 (165MHz optimized) 6.06ns */
@@ -290,7 +291,7 @@ enum {
                ACTIM_CTRLB(NUMONYX_TWTR_165, NUMONYX_TCKE_165, \
                                NUMONYX_TXP_165, NUMONYX_XSR_165)
 
-#define NUMONYX_RASWIDTH_165           0x4
+#define NUMONYX_RASWIDTH_165           15
 #define NUMONYX_V_MCFG_165(size)       MCFG((size), NUMONYX_RASWIDTH_165)
 
 /*
index e5031d5022ba3f07d919278c68166bf7e9f31ec1..2a89e56534073ff7d65a63e9d89e4e866e88266f 100644 (file)
@@ -34,6 +34,7 @@ struct emu_hal_params {
 
 void prcm_init(void);
 void per_clocks_enable(void);
+void ehci_clocks_enable(void);
 
 void memif_init(void);
 void sdrc_init(void);
diff --git a/arch/arm/include/asm/arch-omap4/ehci.h b/arch/arm/include/asm/arch-omap4/ehci.h
new file mode 100644 (file)
index 0000000..984c8b9
--- /dev/null
@@ -0,0 +1,49 @@
+/*
+ * OMAP EHCI port support
+ * Based on LINUX KERNEL
+ * drivers/usb/host/ehci-omap.c and drivers/mfd/omap-usb-host.c
+ *
+ * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com
+ * Author: Govindraj R <govindraj.raja@ti.com>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2  of
+ * the License 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, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef _OMAP4_EHCI_H_
+#define _OMAP4_EHCI_H_
+
+#define OMAP_EHCI_BASE                         (OMAP44XX_L4_CORE_BASE + 0x64C00)
+#define OMAP_UHH_BASE                          (OMAP44XX_L4_CORE_BASE + 0x64000)
+#define OMAP_USBTLL_BASE                       (OMAP44XX_L4_CORE_BASE + 0x62000)
+
+/* UHH, TLL and opt clocks */
+#define CM_L3INIT_HSUSBHOST_CLKCTRL            0x4A009358UL
+
+#define HSUSBHOST_CLKCTRL_CLKSEL_UTMI_P1_MASK  (1 << 24)
+
+/* TLL Register Set */
+#define OMAP_USBTLL_SYSCONFIG_SIDLEMODE                (1 << 3)
+#define OMAP_USBTLL_SYSCONFIG_ENAWAKEUP                (1 << 2)
+#define OMAP_USBTLL_SYSCONFIG_SOFTRESET                (1 << 1)
+#define OMAP_USBTLL_SYSCONFIG_CACTIVITY                (1 << 8)
+#define OMAP_USBTLL_SYSSTATUS_RESETDONE                1
+
+#define OMAP_UHH_SYSCONFIG_SOFTRESET           1
+#define OMAP_UHH_SYSSTATUS_EHCI_RESETDONE      (1 << 2)
+#define OMAP_UHH_SYSCONFIG_NOIDLE              (1 << 2)
+#define OMAP_UHH_SYSCONFIG_NOSTDBY             (1 << 4)
+
+#define OMAP_UHH_SYSCONFIG_VAL (OMAP_UHH_SYSCONFIG_NOIDLE | \
+                                       OMAP_UHH_SYSCONFIG_NOSTDBY)
+
+#endif /* _OMAP4_EHCI_H_ */
index 18225b9b49624fa144cfd15f81858fab8720dd2d..b0d3368b6e6732d1c794b49d5585d7e62d6c04fb 100644 (file)
 #define MAX_MVGBE_DEVS 1
 #define MVGBE0_BASE    ORION5X_EGIGA_BASE
 
+/* Orion5x USB Host controller is port 1 */
+#define MVUSB0_BASE                    ORION5X_USB20_HOST_PORT_BASE
+#define MVUSB0_CPU_ATTR_DRAM_CS0       ORION5X_ATTR_DRAM_CS0
+#define MVUSB0_CPU_ATTR_DRAM_CS1       ORION5X_ATTR_DRAM_CS1
+#define MVUSB0_CPU_ATTR_DRAM_CS2       ORION5X_ATTR_DRAM_CS2
+#define MVUSB0_CPU_ATTR_DRAM_CS3       ORION5X_ATTR_DRAM_CS3
+
+/* Kirkwood CPU memory windows */
+#define MVCPU_WIN_CTRL_DATA    ORION5X_CPU_WIN_CTRL_DATA
+#define MVCPU_WIN_ENABLE       ORION5X_WIN_ENABLE
+#define MVCPU_WIN_DISABLE      ORION5X_WIN_DISABLE
+
 #define CONFIG_MAX_RAM_BANK_SIZE               (64*1024*1024)
 
 /* include here SoC variants. 5181, 5281, 6183 should go here when
index e699fc47c04391de5f0df1255b4581bbe9627d5b..510ead4d993c6b14523f4ffd975cf6596a7ad19f 100644 (file)
@@ -98,6 +98,7 @@ SAMSUNG_BASE(mmc, MMC_BASE)
 SAMSUNG_BASE(sromc, SROMC_BASE)
 SAMSUNG_BASE(timer, PWMTIMER_BASE)
 SAMSUNG_BASE(uart, UART_BASE)
+SAMSUNG_BASE(watchdog, WATCHDOG_BASE)
 #endif
 
 #endif /* _S5PC1XX_CPU_H */
diff --git a/arch/arm/include/asm/arch-s5pc1xx/watchdog.h b/arch/arm/include/asm/arch-s5pc1xx/watchdog.h
new file mode 100644 (file)
index 0000000..0f80ca5
--- /dev/null
@@ -0,0 +1,58 @@
+/*
+ * Copyright (C) 2011 Samsung Electronics
+ * Heungjun Kim <riverful.kim@samsung.com>
+ * Minkyu Kang <mk7.kang@samsung.com>
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+#ifndef __ASM_ARM_ARCH_WATCHDOG_H_
+#define __ASM_ARM_ARCH_WATCHDOG_H_
+
+#define WTCON_RESET_OFFSET     0
+#define WTCON_INTEN_OFFSET     2
+#define WTCON_CLKSEL_OFFSET    3
+#define WTCON_EN_OFFSET                5
+#define WTCON_PRE_OFFSET       8
+
+#define WTCON_CLK_16           0x0
+#define WTCON_CLK_32           0x1
+#define WTCON_CLK_64           0x2
+#define WTCON_CLK_128          0x3
+
+#define WTCON_CLK(x)           ((x & 0x3) << WTCON_CLKSEL_OFFSET)
+#define WTCON_PRESCALER(x)     ((x) << WTCON_PRE_OFFSET)
+#define WTCON_EN               (0x1 << WTCON_EN_OFFSET)
+#define WTCON_RESET            (0x1 << WTCON_RESET_OFFSET)
+#define WTCON_INT              (0x1 << WTCON_INTEN_OFFSET)
+
+#ifndef __ASSEMBLY__
+struct s5p_watchdog {
+       unsigned int wtcon;
+       unsigned int wtdat;
+       unsigned int wtcnt;
+       unsigned int wtclrint;
+};
+
+/* functions */
+void wdt_stop(void);
+void wdt_start(unsigned int timeout);
+#endif /* __ASSEMBLY__ */
+
+#endif
index 2d724a2872f8073302c4af07ebe3550d9d83b690..ae73c72ebe20c317f2951f740c5d621f54af492e 100644 (file)
 #ifndef __FUNCMUX_H
 #define __FUNCMUX_H
 
+/* Configs supported by the func mux */
+enum {
+       FUNCMUX_DEFAULT = 0,    /* default config */
+
+       /* UART configs */
+       FUNCMUX_UART1_IRRX_IRTX = 0,
+       FUNCMUX_UART2_IRDA = 0,
+       FUNCMUX_UART4_GMC = 0,
+
+       /* I2C configs */
+       FUNCMUX_DVC_I2CP = 0,
+       FUNCMUX_I2C1_RM = 0,
+       FUNCMUX_I2C2_DDC = 0,
+       FUNCMUX_I2C2_PTA,
+       FUNCMUX_I2C3_DTF = 0,
+
+       /* SDMMC configs */
+       FUNCMUX_SDMMC2_DTA_DTD_8BIT = 0,
+       FUNCMUX_SDMMC3_SDB_4BIT = 0,
+       FUNCMUX_SDMMC3_SDB_SLXA_8BIT,
+       FUNCMUX_SDMMC4_ATC_ATD_8BIT = 0,
+       FUNCMUX_SDMMC4_ATB_GMA_4_BIT,
+       FUNCMUX_SDMMC4_ATB_GMA_GME_8_BIT,
+};
+
 /**
  * Select a config for a particular peripheral.
  *
  * The basic config is 0, and higher numbers indicate different
  * pinmux settings to bring the peripheral out on other pins,
  *
+ * This function also disables tristate for the function's pins,
+ * so that they operate in normal mode.
+ *
  * @param id           Peripheral id
- * @param config       Configuration to use (generally 0)
+ * @param config       Configuration to use (FUNCMUX_...), 0 for default
  * @return 0 if ok, -1 on error (e.g. incorrect id or config)
  */
 int funcmux_select(enum periph_id id, int config);
diff --git a/arch/arm/include/asm/ehci-omap.h b/arch/arm/include/asm/ehci-omap.h
new file mode 100644 (file)
index 0000000..e72c5df
--- /dev/null
@@ -0,0 +1,142 @@
+/*
+ * OMAP EHCI port support
+ * Based on LINUX KERNEL
+ * drivers/usb/host/ehci-omap.c and drivers/mfd/omap-usb-host.c
+ *
+ * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com*
+ * Author: Govindraj R <govindraj.raja@ti.com>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2  of
+ * the License 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, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef _OMAP_COMMON_EHCI_H_
+#define _OMAP_COMMON_EHCI_H_
+
+enum usbhs_omap_port_mode {
+       OMAP_USBHS_PORT_MODE_UNUSED,
+       OMAP_EHCI_PORT_MODE_PHY,
+       OMAP_EHCI_PORT_MODE_TLL,
+       OMAP_EHCI_PORT_MODE_HSIC,
+};
+
+#ifdef CONFIG_SYS_USB_EHCI_MAX_ROOT_PORTS
+#define OMAP_HS_USB_PORTS      CONFIG_SYS_USB_EHCI_MAX_ROOT_PORTS
+#else
+#define OMAP_HS_USB_PORTS      3
+#endif
+
+#define is_ehci_phy_mode(x)    ((x) == OMAP_EHCI_PORT_MODE_PHY)
+#define is_ehci_tll_mode(x)    ((x) == OMAP_EHCI_PORT_MODE_TLL)
+#define is_ehci_hsic_mode(x)   ((x) == OMAP_EHCI_PORT_MODE_HSIC)
+
+/* Values of UHH_REVISION - Note: these are not given in the TRM */
+#define OMAP_USBHS_REV1                                        0x00000010 /* OMAP3 */
+#define OMAP_USBHS_REV2                                        0x50700100 /* OMAP4 */
+
+/* UHH Register Set */
+#define OMAP_UHH_HOSTCONFIG_INCR4_BURST_EN             (1 << 2)
+#define OMAP_UHH_HOSTCONFIG_INCR8_BURST_EN             (1 << 3)
+#define OMAP_UHH_HOSTCONFIG_INCR16_BURST_EN            (1 << 4)
+#define OMAP_UHH_HOSTCONFIG_INCRX_ALIGN_EN             (1 << 5)
+
+#define OMAP_UHH_HOSTCONFIG_ULPI_P1_BYPASS             1
+#define OMAP_UHH_HOSTCONFIG_ULPI_P2_BYPASS             (1 << 11)
+#define OMAP_UHH_HOSTCONFIG_ULPI_P3_BYPASS             (1 << 12)
+#define OMAP4_UHH_HOSTCONFIG_APP_START_CLK             (1 << 31)
+
+#define OMAP_P1_MODE_CLEAR                             (3 << 16)
+#define OMAP_P1_MODE_TLL                               (1 << 16)
+#define OMAP_P1_MODE_HSIC                              (3 << 16)
+#define OMAP_P2_MODE_CLEAR                             (3 << 18)
+#define OMAP_P2_MODE_TLL                               (1 << 18)
+#define OMAP_P2_MODE_HSIC                              (3 << 18)
+#define OMAP_P3_MODE_HSIC                              (3 << 20)
+
+/* EHCI Register Set */
+#define EHCI_INSNREG04_DISABLE_UNSUSPEND               (1 << 5)
+#define EHCI_INSNREG05_ULPI_CONTROL_SHIFT              31
+#define EHCI_INSNREG05_ULPI_PORTSEL_SHIFT              24
+#define EHCI_INSNREG05_ULPI_OPSEL_SHIFT                        22
+#define EHCI_INSNREG05_ULPI_REGADD_SHIFT               16
+
+#define OMAP_REV1_TLL_CHANNEL_COUNT                    3
+#define OMAP_REV2_TLL_CHANNEL_COUNT                    2
+
+/* TLL Register Set */
+#define OMAP_TLL_CHANNEL_CONF(num)                     (0x004 * num)
+#define OMAP_TLL_CHANNEL_CONF_DRVVBUS                  (1 << 16)
+#define OMAP_TLL_CHANNEL_CONF_CHRGVBUS                 (1 << 15)
+#define OMAP_TLL_CHANNEL_CONF_ULPINOBITSTUFF           (1 << 11)
+#define OMAP_TLL_CHANNEL_CONF_CHANMODE_TRANSPARENT_UTMI        (2 << 1)
+#define OMAP_TLL_CHANNEL_CONF_CHANEN                   1
+
+struct omap_usbhs_board_data {
+       enum usbhs_omap_port_mode port_mode[OMAP_HS_USB_PORTS];
+};
+
+struct omap_usbtll {
+       u32 rev;                /* 0x00 */
+       u32 hwinfo;             /* 0x04 */
+       u8 reserved1[0x8];
+       u32 sysc;               /* 0x10 */
+       u32 syss;               /* 0x14 */
+       u32 irqst;              /* 0x18 */
+       u32 irqen;              /* 0x1c */
+       u8 reserved2[0x10];
+       u32 shared_conf;        /* 0x30 */
+       u8 reserved3[0xc];
+       u32 channel_conf;       /* 0x40 */
+};
+
+struct omap_uhh {
+       u32 rev;        /* 0x00 */
+       u32 hwinfo;     /* 0x04 */
+       u8 reserved1[0x8];
+       u32 sysc;       /* 0x10 */
+       u32 syss;       /* 0x14 */
+       u8 reserved2[0x28];
+       u32 hostconfig; /* 0x40 */
+       u32 debugcsr;   /* 0x44 */
+};
+
+struct omap_ehci {
+       u32 hccapbase;          /* 0x00 */
+       u32 hcsparams;          /* 0x04 */
+       u32 hccparams;          /* 0x08 */
+       u8 reserved1[0x04];
+       u32 usbcmd;             /* 0x10 */
+       u32 usbsts;             /* 0x14 */
+       u32 usbintr;            /* 0x18 */
+       u32 frindex;            /* 0x1c */
+       u32 ctrldssegment;      /* 0x20 */
+       u32 periodiclistbase;   /* 0x24 */
+       u32 asysnclistaddr;     /* 0x28 */
+       u8 reserved2[0x24];
+       u32 configflag;         /* 0x50 */
+       u32 portsc_i;           /* 0x54 */
+       u8 reserved3[0x38];
+       u32 insreg00;           /* 0x90 */
+       u32 insreg01;           /* 0x94 */
+       u32 insreg02;           /* 0x98 */
+       u32 insreg03;           /* 0x9c */
+       u32 insreg04;           /* 0xa0 */
+       u32 insreg05_utmi_ulpi; /* 0xa4 */
+       u32 insreg06;           /* 0xa8 */
+       u32 insreg07;           /* 0xac */
+       u32 insreg08;           /* 0xb0 */
+};
+
+int omap_ehci_hcd_init(struct omap_usbhs_board_data *usbhs_pdata);
+int omap_ehci_hcd_stop(void);
+
+#endif /* _OMAP_COMMON_EHCI_H_ */
index f30b9fc96f0be9a1d6328bd6206cc3cf988b4c84..20e165393020e91625168638fbea8c005bebf698 100644 (file)
@@ -41,6 +41,9 @@ typedef struct bd_info {
     unsigned long      bi_ip_addr;     /* IP Address */
     ulong              bi_arch_number; /* unique id for this board */
     ulong              bi_boot_params; /* where this board expects params */
+       unsigned long   bi_arm_freq; /* arm frequency */
+       unsigned long   bi_dsp_freq; /* dsp core frequency */
+       unsigned long   bi_ddr_freq; /* ddr frequency */
     struct                             /* RAM configuration */
     {
        ulong start;
index 3d7827407206b86b02542b72d076737abf66869d..500e2164ce4b85d2606b26a596c195ab7216fed4 100644 (file)
@@ -463,7 +463,15 @@ void board_init_r(gd_t *id, ulong dest_addr)
 
        debug("monitor flash len: %08lX\n", monitor_flash_len);
        board_init();   /* Setup chipselects */
-
+       /*
+        * TODO: printing of the clock inforamtion of the board is now
+        * implemented as part of bdinfo command. Currently only support for
+        * davinci SOC's is added. Remove this check once all the board
+        * implement this.
+        */
+#ifdef CONFIG_CLOCKS
+       set_cpu_clk_info(); /* Setup clock information */
+#endif
 #ifdef CONFIG_SERIAL_MULTI
        serial_initialize();
 #endif
index 6ed655a674f52c8c3297c9cbb7db21c02c3d3f9c..5ca9e91d3f12ed015ca2cd12a5ce87b34c9d2b3f 100644 (file)
@@ -8,8 +8,8 @@
  * Licensed under the GPL-2 or later.
  */
 
-#include <asm/linkage.h>
 #include <config.h>
+#include <linux/linkage.h>
 #include <asm/blackfin.h>
 
 .text
index 71207b697ac62e8bca3026a8f9aa66c3ea409a32..49d0c9ec3aabc2a2ccc480da356a37c000ae061d 100644 (file)
@@ -48,7 +48,7 @@
 #define L1_CACHE_SHIFT 5
 #define L1_CACHE_BYTES (1 << L1_CACHE_SHIFT)
 
-#include <asm/linkage.h>
+#include <linux/linkage.h>
 #include <asm/cache.h>
 
 #ifndef __ASSEMBLY__
index 482e4b52b63cebf3904fe41d59166c6bf83e5d86..568885a2c2862bc12699207515650d5342ddb6fd 100644 (file)
@@ -7,7 +7,7 @@
 #ifndef __ARCH_BLACKFIN_CACHE_H
 #define __ARCH_BLACKFIN_CACHE_H
 
-#include <asm/linkage.h>       /* for asmlinkage */
+#include <linux/linkage.h>     /* for asmlinkage */
 
 /*
  * Bytes per L1 cache line
index 75244a0731d9b741aab9528e19d9fc9b32a8d5d3..69f08bc7efb526a85f3edeab3a184944d178cb72 100644 (file)
@@ -134,9 +134,11 @@ static inline unsigned int readl(const volatile void __iomem *addr)
 #define inb(port)    readb(__io(port))
 #define inw(port)    readw(__io(port))
 #define inl(port)    readl(__io(port))
+#define in_le32(port) inl(port)
 #define outb(x, port) writeb(x, __io(port))
 #define outw(x, port) writew(x, __io(port))
 #define outl(x, port) writel(x, __io(port))
+#define out_le32(x, port) outl(x, port)
 
 #define inb_p(port)    inb(__io(port))
 #define inw_p(port)    inw(__io(port))
index fbb497c7bdcf60031af1c861418289547ba92560..6d4493a6c529a14fc7a4e084662e51018d868151 100644 (file)
  * MA 02110-1301 USA
  */
 
-#ifndef _LINUX_LINKAGE_H
-#define _LINUX_LINKAGE_H
-
-#include <linux/config.h>
-
-#ifdef __cplusplus
-#define CPP_ASMLINKAGE         extern "C"
-#else
-#define CPP_ASMLINKAGE
-#endif
-
-#define asmlinkage CPP_ASMLINKAGE
-
-#define SYMBOL_NAME_STR(X)     #X
-#define SYMBOL_NAME(X)         X
-#ifdef __STDC__
-#define SYMBOL_NAME_LABEL(X)   X##:
-#else
-#define SYMBOL_NAME_LABEL(X)   X:
-#endif
-
-#define __ALIGN .align         4
-#define __ALIGN_STR            ".align 4"
-
-#ifdef __ASSEMBLY__
-
-#define ALIGN                  __ALIGN
-#define ALIGN_STR              __ALIGN_STR
-
-#define LENTRY(name) \
-       ALIGN; \
-       SYMBOL_NAME_LABEL(name)
-
-#define ENTRY(name) \
-       .globl SYMBOL_NAME(name); \
-       LENTRY(name)
-#endif
-
-#ifndef END
-#define END(name) \
-       .size name, .-name
-#endif
-
-#ifndef ENDPROC
-#define ENDPROC(name) \
-       .type name, @function; \
-       END(name)
-#endif
+#ifndef __ASM_LINKAGE_H
+#define __ASM_LINKAGE_H
 
 #endif
index cba4179d3efbf350661c4033f7be4063506dee38..4ccde8f104e1118cfab413a0c5f6f5bb5a2ce205 100644 (file)
@@ -1,5 +1,5 @@
 
-#include <asm/linkage.h>
+#include <linux/linkage.h>
 
 /* save stack context for non-local goto
  * int kgdb_setjmp(long *buf)
index 253d4c3e417b47a2a92e503bec896b0d4a9d9457..39d5332615ab333b35a61c3c2f6c5e45d6d96959 100644 (file)
@@ -8,7 +8,7 @@
  * Licensed under the GPL-2.
  */
 
-#include <asm/linkage.h>
+#include <linux/linkage.h>
 
 .align 2
 
index f438c150a38d2f352d3a1dfb2fddb6d69851e567..55865760173558e928a44d4dedb14c75e96ad46f 100644 (file)
@@ -20,6 +20,7 @@
  */
 
 #include <common.h>
+#include <errno.h>
 #include <linux/mtd/nand.h>
 #include <nand.h>
 #include <miiphy.h>
@@ -46,6 +47,12 @@ static unsigned long get_timer_val(void)
        return now;
 }
 
+static int timer_running(void)
+{
+       return readl(&timer->tcr) &
+               (DV_TIMER_TCR_ENAMODE_MASK << DV_TIMER_TCR_ENAMODE34_SHIFT);
+}
+
 static void stop_timer(void)
 {
        writel(0x0, &timer->tcr);
@@ -66,8 +73,43 @@ int board_init(void)
 }
 
 #ifdef CONFIG_DRIVER_TI_EMAC
+static int cam_enc_4xx_check_network(void)
+{
+       char *s;
+
+       s = getenv("ethaddr");
+       if (!s)
+               return -EINVAL;
+
+       if (!is_valid_ether_addr((const u8 *)s))
+               return -EINVAL;
+
+       s = getenv("ipaddr");
+       if (!s)
+               return -EINVAL;
+
+       s = getenv("netmask");
+       if (!s)
+               return -EINVAL;
+
+       s = getenv("serverip");
+       if (!s)
+               return -EINVAL;
+
+       s = getenv("gatewayip");
+       if (!s)
+               return -EINVAL;
+
+       return 0;
+}
 int board_eth_init(bd_t *bis)
 {
+       int ret;
+
+       ret = cam_enc_4xx_check_network();
+       if (ret)
+               return ret;
+
        davinci_emac_initialize();
 
        return 0;
@@ -254,8 +296,11 @@ static int nand_switch_hw_func(int mode)
        nand = mtd->priv;
 
        if (mode == 0) {
-               printf("switching to uboot hw functions.\n");
-               memcpy(&nand->ecc, &org_ecc, sizeof(struct nand_ecc_ctrl));
+               if (notsaved == 0) {
+                       printf("switching to uboot hw functions.\n");
+                       memcpy(&nand->ecc, &org_ecc,
+                               sizeof(struct nand_ecc_ctrl));
+               }
        } else {
                /* RBL */
                printf("switching to RBL hw functions.\n");
@@ -329,7 +374,8 @@ int board_late_init(void)
        struct davinci_gpio *gpio = davinci_gpio_bank45;
 
        /* 24MHz InputClock / 15 prediv -> 1.6 MHz timer running */
-       while (get_timer_val() < 0x186a00)
+       while ((get_timer_val() < CONFIG_AIT_TIMER_TIMEOUT) &&
+               timer_running())
                ;
 
        /* 1 sec reached -> stop timer, clear all LED */
@@ -429,3 +475,618 @@ void arch_memory_failure_handle(void)
                ;
 }
 #endif
+#if defined(CONFIG_MENU)
+#include "menu.h"
+
+#define MENU_EXIT              -1
+#define MENU_EXIT_BOOTCMD      -2
+#define MENU_STAY              0
+#define MENU_MAIN              1
+#define MENU_UPDATE            2
+#define MENU_NETWORK           3
+#define MENU_LOAD              4
+
+static int menu_start;
+
+#define FIT_SUBTYPE_UNKNOWN            0
+#define FIT_SUBTYPE_UBL_HEADER         1
+#define FIT_SUBTYPE_SPL_IMAGE          2
+#define FIT_SUBTYPE_UBOOT_IMAGE                3
+#define FIT_SUBTYPE_DF_ENV_IMAGE       4
+#define FIT_SUBTYPE_RAMDISK_IMAGE      5
+
+struct fit_images_info {
+       u_int8_t type;
+       int subtype;
+       char desc[200];
+       const void *data;
+       size_t size;
+};
+
+static struct fit_images_info images[10];
+
+struct menu_display {
+       char    title[50];
+       int     timeout; /* in sec */
+       int     id; /* MENU_* */
+       char    **menulist;
+       int (*menu_evaluate)(char *choice);
+};
+
+char *menu_main[] = {
+       "(1) Boot",
+       "(2) Update Software",
+       "(3) Reset to default setting and boot",
+       "(4) Enter U-Boot console",
+       NULL
+};
+
+char *menu_update[] = {
+       "(1) Network settings",
+       "(2) load image",
+       "(3) back to main",
+       NULL
+};
+
+char *menu_load[] = {
+       "(1) install image",
+       "(2) cancel",
+       NULL
+};
+
+char *menu_network[] = {
+       "(1) ipaddr   ",
+       "(2) netmask  ",
+       "(3) serverip ",
+       "(4) gatewayip",
+       "(5) tftp image name",
+       "(6) back to update software",
+       NULL
+};
+
+static void ait_menu_print(void *data)
+{
+       printf("%s\n", (char *)data);
+       return;
+}
+
+static char *menu_handle(struct menu_display *display)
+{
+       struct menu *m;
+       int i;
+       char *choice = NULL;
+       char key[2];
+       int ret;
+       char *s;
+       char temp[6][200];
+
+       m = menu_create(display->title, display->timeout, 1, ait_menu_print);
+
+       for (i = 0; display->menulist[i]; i++) {
+               sprintf(key, "%d", i + 1);
+               if (display->id == MENU_NETWORK) {
+                       switch (i) {
+                       case 0:
+                               s = getenv("ipaddr");
+                               break;
+                       case 1:
+                               s = getenv("netmask");
+                               break;
+                       case 2:
+                               s = getenv("serverip");
+                               break;
+                       case 3:
+                               s = getenv("gatewayip");
+                               break;
+                       case 4:
+                               s = getenv("img_file");
+                               break;
+                       default:
+                               s = NULL;
+                               break;
+                       }
+                       if (s) {
+                               sprintf(temp[i], "%s: %s",
+                                       display->menulist[i], s);
+                               ret = menu_item_add(m, key, temp[i]);
+                       } else {
+                               ret = menu_item_add(m, key,
+                                       display->menulist[i]);
+                       }
+               } else {
+                       ret = menu_item_add(m, key, display->menulist[i]);
+               }
+
+               if (ret != 1) {
+                       printf("failed to add item!");
+                       menu_destroy(m);
+                       return NULL;
+               }
+       }
+       sprintf(key, "%d", 1);
+       menu_default_set(m, key);
+
+       if (menu_get_choice(m, (void **)&choice) != 1)
+               debug("Problem picking a choice!\n");
+
+       menu_destroy(m);
+
+       return choice;
+}
+
+static int ait_menu_show(struct menu_display *display, int bootdelay)
+{
+       int end = MENU_STAY;
+       char *choice;
+
+       if ((menu_start == 0) && (display->id == MENU_MAIN))
+               display->timeout = bootdelay;
+       else
+               display->timeout = 0;
+
+       while (end == MENU_STAY) {
+               choice = menu_handle(display);
+               if (choice)
+                       end = display->menu_evaluate(choice);
+
+               if (end == display->id)
+                       end = MENU_STAY;
+               if (display->id == MENU_MAIN) {
+                       if (menu_start == 0)
+                               end = MENU_EXIT_BOOTCMD;
+                       else
+                               display->timeout = 0;
+               }
+       }
+       return end;
+}
+
+static int ait_writeublheader(void)
+{
+       char s[20];
+       unsigned long i;
+       int ret;
+
+       for (i = CONFIG_SYS_NAND_BLOCK_SIZE;
+               i < CONFIG_SYS_NAND_U_BOOT_OFFS;
+               i += CONFIG_SYS_NAND_BLOCK_SIZE) {
+               sprintf(s, "%lx", i);
+               ret = setenv("header_addr", s);
+               if (ret == 0)
+                       ret = run_command2("run img_writeheader", 0);
+               if (ret != 0)
+                       break;
+       }
+       return ret;
+}
+
+static int ait_menu_install_images(void)
+{
+       int ret = 0;
+       int count = 0;
+       char s[100];
+       char *t;
+
+       /*
+        * possible image types:
+        * FIT_SUBTYPE_UNKNOWN
+        * FIT_SUBTYPE_UBL_HEADER
+        * FIT_SUBTYPE_SPL_IMAGE
+        * FIT_SUBTYPE_UBOOT_IMAGE
+        * FIT_SUBTYPE_DF_ENV_IMAGE
+        * FIT_SUBTYPE_RAMDISK_IMAGE
+        *
+        * use Envvariables:
+        * img_addr_r: image start addr
+        * header_addr: addr where to write to UBL header
+        * img_writeheader: write ubl header to nand
+        * img_writespl: write spl to nand
+        * img_writeuboot: write uboot to nand
+        * img_writedfenv: write default environment to ubi volume
+        * img_volume: which ubi volume should be updated with img_writeramdisk
+        * filesize: size of data for updating ubi volume
+        * img_writeramdisk: write ramdisk to ubi volume
+        */
+
+       while (images[count].type != IH_TYPE_INVALID) {
+               printf("Installing %s\n",
+                       genimg_get_type_name(images[count].type));
+               sprintf(s, "%p", images[count].data);
+               setenv("img_addr_r", s);
+               sprintf(s, "%lx", (unsigned long)images[count].size);
+               setenv("filesize", s);
+               switch (images[count].subtype) {
+               case FIT_SUBTYPE_DF_ENV_IMAGE:
+                       ret = run_command2("run img_writedfenv", 0);
+                       break;
+               case FIT_SUBTYPE_RAMDISK_IMAGE:
+                       t = getenv("img_volume");
+                       if (!t) {
+                               ret = setenv("img_volume", "rootfs1");
+                       } else {
+                               /* switch to other volume */
+                               if (strncmp(t, "rootfs1", 7) == 0)
+                                       ret = setenv("img_volume", "rootfs2");
+                               else
+                                       ret = setenv("img_volume", "rootfs1");
+                       }
+                       if (ret != 0)
+                               break;
+
+                       ret = run_command2("run img_writeramdisk", 0);
+                       break;
+               case FIT_SUBTYPE_SPL_IMAGE:
+                       ret = run_command2("run img_writespl", 0);
+                       break;
+               case FIT_SUBTYPE_UBL_HEADER:
+                       ret = ait_writeublheader();
+                       break;
+               case FIT_SUBTYPE_UBOOT_IMAGE:
+                       ret = run_command2("run img_writeuboot", 0);
+                       break;
+               default:
+                       /* not supported type */
+                       break;
+               }
+               count++;
+       }
+       /* now save dvn_* and img_volume env vars to new values */
+       if (ret == 0)
+               ret = run_command2("run savenewvers", 0);
+
+       return ret;
+}
+
+static int ait_menu_evaluate_load(char *choice)
+{
+       if (!choice)
+               return -1;
+
+       switch (choice[1]) {
+       case '1':
+               /* install image */
+               ait_menu_install_images();
+               break;
+       case '2':
+               /* cancel, back to main */
+               break;
+       }
+
+       return MENU_MAIN;
+}
+
+struct menu_display ait_load = {
+       .title = "AIT load image",
+       .timeout = 0,
+       .id = MENU_LOAD,
+       .menulist = menu_load,
+       .menu_evaluate = ait_menu_evaluate_load,
+};
+
+static void ait_menu_read_env(char *name)
+{
+       char output[CONFIG_SYS_CBSIZE];
+       char cbuf[CONFIG_SYS_CBSIZE];
+       int readret;
+       int ret;
+
+       sprintf(output, "%s old: %s value: ", name, getenv(name));
+       memset(cbuf, 0, CONFIG_SYS_CBSIZE);
+       readret = readline_into_buffer(output, cbuf, 0);
+
+       if (readret >= 0) {
+               ret = setenv(name, cbuf);
+               if (ret) {
+                       printf("Error setting %s\n", name);
+                       return;
+               }
+       }
+       return;
+}
+
+static int ait_menu_evaluate_network(char *choice)
+{
+       if (!choice)
+               return MENU_MAIN;
+
+       switch (choice[1]) {
+       case '1':
+               ait_menu_read_env("ipaddr");
+               break;
+       case '2':
+               ait_menu_read_env("netmask");
+               break;
+       case '3':
+               ait_menu_read_env("serverip");
+               break;
+       case '4':
+               ait_menu_read_env("gatewayip");
+               break;
+       case '5':
+               ait_menu_read_env("img_file");
+               break;
+       case '6':
+               return MENU_UPDATE;
+               break;
+       }
+
+       return MENU_STAY;
+}
+
+struct menu_display ait_network = {
+       .title = "AIT network settings",
+       .timeout = 0,
+       .id = MENU_NETWORK,
+       .menulist = menu_network,
+       .menu_evaluate = ait_menu_evaluate_network,
+};
+
+static int fit_get_subtype(const void *fit, int noffset, char **subtype)
+{
+       int len;
+
+       *subtype = (char *)fdt_getprop(fit, noffset, "subtype", &len);
+       if (*subtype == NULL)
+               return -1;
+
+       return 0;
+}
+
+static int ait_subtype_nr(char *subtype)
+{
+       int ret = FIT_SUBTYPE_UNKNOWN;
+
+       if (!strncmp("ublheader", subtype, strlen("ublheader")))
+               return FIT_SUBTYPE_UBL_HEADER;
+       if (!strncmp("splimage", subtype, strlen("splimage")))
+               return FIT_SUBTYPE_SPL_IMAGE;
+       if (!strncmp("ubootimage", subtype, strlen("ubootimage")))
+               return FIT_SUBTYPE_UBOOT_IMAGE;
+       if (!strncmp("dfenvimage", subtype, strlen("dfenvimage")))
+               return FIT_SUBTYPE_DF_ENV_IMAGE;
+
+       return ret;
+}
+
+static int ait_menu_check_image(void)
+{
+       char *s;
+       unsigned long fit_addr;
+       void *addr;
+       int format;
+       char *desc;
+       char *subtype;
+       int images_noffset;
+       int noffset;
+       int ndepth;
+       int count = 0;
+       int ret;
+       int i;
+       int found_uboot = -1;
+       int found_ramdisk = -1;
+
+       memset(images, 0, sizeof(images));
+       s = getenv("fit_addr_r");
+       fit_addr = s ? (unsigned long)simple_strtol(s, NULL, 16) : \
+                       CONFIG_BOARD_IMG_ADDR_R;
+
+       addr = (void *)fit_addr;
+       /* check if it is a FIT image */
+       format = genimg_get_format(addr);
+       if (format != IMAGE_FORMAT_FIT)
+               return -EINVAL;
+
+       if (!fit_check_format(addr))
+               return -EINVAL;
+
+       /* print the FIT description */
+       ret = fit_get_desc(addr, 0, &desc);
+       printf("FIT description: ");
+       if (ret)
+               printf("unavailable\n");
+       else
+               printf("%s\n", desc);
+
+       /* find images */
+       images_noffset = fdt_path_offset(addr, FIT_IMAGES_PATH);
+       if (images_noffset < 0) {
+               printf("Can't find images parent node '%s' (%s)\n",
+                       FIT_IMAGES_PATH, fdt_strerror(images_noffset));
+               return -EINVAL;
+       }
+
+       /* Process its subnodes, print out component images details */
+       for (ndepth = 0, count = 0,
+               noffset = fdt_next_node(addr, images_noffset, &ndepth);
+               (noffset >= 0) && (ndepth > 0);
+               noffset = fdt_next_node(addr, noffset, &ndepth)) {
+               if (ndepth == 1) {
+                       /*
+                        * Direct child node of the images parent node,
+                        * i.e. component image node.
+                        */
+                       printf("Image %u (%s)\n", count,
+                                       fit_get_name(addr, noffset, NULL));
+
+                       fit_image_print(addr, noffset, "");
+
+                       fit_image_get_type(addr, noffset,
+                               &images[count].type);
+                       /* Mandatory properties */
+                       ret = fit_get_desc(addr, noffset, &desc);
+                       printf("Description:  ");
+                       if (ret)
+                               printf("unavailable\n");
+                       else
+                               printf("%s\n", desc);
+
+                       ret = fit_get_subtype(addr, noffset, &subtype);
+                       printf("Subtype:  ");
+                       if (ret) {
+                               printf("unavailable\n");
+                       } else {
+                               images[count].subtype = ait_subtype_nr(subtype);
+                               printf("%s %d\n", subtype,
+                                       images[count].subtype);
+                       }
+
+                       sprintf(images[count].desc, "%s", desc);
+
+                       ret = fit_image_get_data(addr, noffset,
+                               &images[count].data,
+                               &images[count].size);
+
+                       printf("Data Size:    ");
+                       if (ret)
+                               printf("unavailable\n");
+                       else
+                               genimg_print_size(images[count].size);
+                       printf("Data @ %p\n", images[count].data);
+                       count++;
+               }
+       }
+
+       for (i = 0; i < count; i++) {
+               if (images[i].subtype == FIT_SUBTYPE_UBOOT_IMAGE)
+                       found_uboot = i;
+               if (images[i].type == IH_TYPE_RAMDISK) {
+                       found_ramdisk = i;
+                       images[i].subtype = FIT_SUBTYPE_RAMDISK_IMAGE;
+               }
+       }
+
+       /* dvn_* env var update, if the FIT descriptors are different */
+       if (found_uboot >= 0) {
+               s = getenv("dvn_boot_vers");
+               if (s) {
+                       ret = strcmp(s, images[found_uboot].desc);
+                       if (ret != 0) {
+                               setenv("dvn_boot_vers",
+                                       images[found_uboot].desc);
+                       } else {
+                               found_uboot = -1;
+                               printf("no new uboot version\n");
+                       }
+               } else {
+                       setenv("dvn_boot_vers", images[found_uboot].desc);
+               }
+       }
+       if (found_ramdisk >= 0) {
+               s = getenv("dvn_app_vers");
+               if (s) {
+                       ret = strcmp(s, images[found_ramdisk].desc);
+                       if (ret != 0) {
+                               setenv("dvn_app_vers",
+                                       images[found_ramdisk].desc);
+                       } else {
+                               found_ramdisk = -1;
+                               printf("no new ramdisk version\n");
+                       }
+               } else {
+                       setenv("dvn_app_vers", images[found_ramdisk].desc);
+               }
+       }
+       if ((found_uboot == -1) && (found_ramdisk == -1))
+               return -EINVAL;
+
+       return 0;
+}
+
+static int ait_menu_evaluate_update(char *choice)
+{
+       int ret;
+
+       if (!choice)
+               return MENU_MAIN;
+
+       switch (choice[1]) {
+       case '1':
+               return ait_menu_show(&ait_network, 0);
+               break;
+       case '2':
+               /* load image */
+               ret = run_command2("run load_img", 0);
+               printf("ret: %d\n", ret);
+               if (ret)
+                       return MENU_UPDATE;
+
+               ret = ait_menu_check_image();
+               if (ret)
+                       return MENU_UPDATE;
+
+               return ait_menu_show(&ait_load, 0);
+               break;
+       case '3':
+               return MENU_MAIN;
+               break;
+
+       }
+
+       return MENU_MAIN;
+}
+
+struct menu_display ait_update = {
+       .title = "AIT Update Software",
+       .timeout = 0,
+       .id = MENU_UPDATE,
+       .menulist = menu_update,
+       .menu_evaluate = ait_menu_evaluate_update,
+};
+
+static int ait_menu_evaluate_main(char *choice)
+{
+       if (!choice)
+               return MENU_STAY;
+
+       menu_start = 1;
+       switch (choice[1]) {
+       case '1':
+               /* run bootcmd */
+               return MENU_EXIT_BOOTCMD;
+               break;
+       case '2':
+               return ait_menu_show(&ait_update, 0);
+               break;
+       case '3':
+               /* reset to default settings */
+               setenv("app_reset", "yes");
+               return MENU_EXIT_BOOTCMD;
+               break;
+       case '4':
+               /* u-boot shell */
+               return MENU_EXIT;
+               break;
+       }
+
+       return MENU_EXIT;
+}
+
+struct menu_display ait_main = {
+       .title = "AIT Main",
+       .timeout = CONFIG_BOOTDELAY,
+       .id = MENU_MAIN,
+       .menulist = menu_main,
+       .menu_evaluate = ait_menu_evaluate_main,
+};
+
+int menu_show(int bootdelay)
+{
+       int ret;
+
+       run_command2("run saveparms", 0);
+       ret = ait_menu_show(&ait_main, bootdelay);
+       run_command2("run restoreparms", 0);
+
+       if (ret == MENU_EXIT_BOOTCMD)
+               return 0;
+
+       return MENU_EXIT;
+}
+
+void menu_display_statusline(struct menu *m)
+{
+       printf("State: dvn_boot_vers: %s dvn_app_vers: %s\n",
+               getenv("dvn_boot_vers"), getenv("dvn_app_vers"));
+       return;
+}
+#endif
index 95182cab00eb16bcd288a6968aee9ecfae8cb796..deef7576e1bf5461b55a5f383f356c4b843bd433 100644 (file)
@@ -38,8 +38,7 @@ ENTRY 0x00000020
 PAGES  6
 
 # Block number where user bootloader is present
-# RBL starts always with block 1
-START_BLOCK    5
+START_BLOCK    0
 
 # Page number where user bootloader is present
 # Page 0 is always UBL header
index 97e59fb324a15aa044a37da611f106ac3c836c5a..f23b657041c5dffe44f0e359fb8e37b4c74ddde3 100644 (file)
@@ -32,6 +32,7 @@
 #include <asm/arch/sys_proto.h>
 #include <asm/arch/clk_rst.h>
 #include <asm/arch/clock.h>
+#include <asm/arch/funcmux.h>
 #include <asm/arch/pinmux.h>
 #include <asm/arch/uart.h>
 #include <asm/arch/mmc.h>
@@ -63,14 +64,7 @@ int timer_init(void)
  */
 static void pin_mux_mmc(void)
 {
-       /* SDMMC4: config 3, x8 on 2nd set of pins */
-       pinmux_set_func(PINGRP_ATB, PMUX_FUNC_SDIO4);
-       pinmux_set_func(PINGRP_GMA, PMUX_FUNC_SDIO4);
-       pinmux_set_func(PINGRP_GME, PMUX_FUNC_SDIO4);
-
-       pinmux_tristate_disable(PINGRP_ATB);
-       pinmux_tristate_disable(PINGRP_GMA);
-       pinmux_tristate_disable(PINGRP_GME);
+       funcmux_select(PERIPH_ID_SDMMC4, FUNCMUX_SDMMC4_ATB_GMA_GME_8_BIT);
 }
 #endif
 
index ec888d44d9a4a80994fbaa0d843abb8d1c582b72..92dfffa8ca12a6be6a1c447d6b5ebee7027c9bce 100644 (file)
@@ -43,13 +43,6 @@ int checkboard(void)
        return 0;
 }
 
-void board_reset(void)
-{
-       /* workaround for weak pull ups on ssel */
-       if (CONFIG_BFIN_BOOT_MODE == BFIN_BOOT_SPI_MASTER)
-               bfin_reset_boot_spi_cs(GPIO_PF10);
-}
-
 #ifdef CONFIG_BFIN_MAC
 static void board_init_enetaddr(uchar *mac_addr)
 {
diff --git a/board/br4/Makefile b/board/br4/Makefile
new file mode 100644 (file)
index 0000000..6ae998f
--- /dev/null
@@ -0,0 +1,50 @@
+#
+# U-boot - Makefile
+#
+# Copyright (c) Switchfin Org. <dpn@switchfin.org>
+#
+# Copyright (c) 2005-2007 Analog Device Inc.
+#
+# (C) Copyright 2000-2006
+# Wolfgang Denk, DENX Software Engineering, wd@denx.de.
+#
+# See file CREDITS for list of people who contributed to this
+# project.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 2 of
+# the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+# MA 02111-1307 USA
+#
+
+include $(TOPDIR)/config.mk
+
+LIB    = $(obj)lib$(BOARD).o
+
+COBJS-y        := $(BOARD).o
+
+SRCS   := $(SOBJS-y:.o=.S) $(COBJS-y:.o=.c)
+OBJS   := $(addprefix $(obj),$(COBJS-y))
+SOBJS  := $(addprefix $(obj),$(SOBJS-y))
+
+$(LIB):        $(obj).depend $(OBJS) $(SOBJS)
+       $(call cmd_link_o_target, $(OBJS) $(SOBJS))
+
+#########################################################################
+
+# defines $(obj).depend target
+include $(SRCTREE)/rules.mk
+
+sinclude $(obj).depend
+
+#########################################################################
diff --git a/board/br4/br4.c b/board/br4/br4.c
new file mode 100644 (file)
index 0000000..bc034e3
--- /dev/null
@@ -0,0 +1,30 @@
+/*
+ * U-boot - main board file
+ *
+ * Copyright (c) Switchfin Org. <dpn@switchfin.org>
+ *
+ * Copyright (c) 2005-2008 Analog Devices Inc.
+ *
+ * (C) Copyright 2000-2004
+ * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
+ *
+ * Licensed under the GPL-2 or later.
+ */
+
+#include <common.h>
+#include <net.h>
+#include <netdev.h>
+
+int checkboard(void)
+{
+       printf("Board: Switchvoice BR4 Appliance\n");
+       printf("       Support: http://www.switchvoice.com/\n");
+       return 0;
+}
+
+#ifdef CONFIG_BFIN_MAC
+int board_eth_init(bd_t *bis)
+{
+       return bfin_EMAC_initialize(bis);
+}
+#endif
diff --git a/board/br4/config.mk b/board/br4/config.mk
new file mode 100644 (file)
index 0000000..fac20c5
--- /dev/null
@@ -0,0 +1,30 @@
+#
+# Copyright (c) Switchfin Org. <dpn@switchfin.org>
+#
+# Copyright (c) 2005-2008 Analog Device Inc.
+#
+# (C) Copyright 2001
+# Wolfgang Denk, DENX Software Engineering, wd@denx.de.
+#
+# See file CREDITS for list of people who contributed to this
+# project.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 2 of
+# the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+# MA 02111-1307 USA
+#
+
+CFLAGS_lib += -O2
+CFLAGS_lib/lzma += -O2
+CFLAGS_lib/zlib += -O2
diff --git a/board/compal/paz00/Makefile b/board/compal/paz00/Makefile
new file mode 100644 (file)
index 0000000..488e381
--- /dev/null
@@ -0,0 +1,41 @@
+#
+# Copyright (c) 2010-2012, NVIDIA CORPORATION.  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 and conditions of the GNU General Public License,
+# version 2, as published by the Free Software Foundation.
+#
+# This program is distributed in the hope it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
+# more details.
+#
+
+include $(TOPDIR)/config.mk
+
+ifneq ($(OBJTREE),$(SRCTREE))
+$(shell mkdir -p $(obj)../../nvidia/common)
+endif
+
+LIB    = $(obj)lib$(BOARD).o
+
+COBJS  := $(BOARD).o
+COBJS  += ../../nvidia/common/board.o
+
+SRCS   := $(COBJS:.o=.c)
+OBJS   := $(addprefix $(obj),$(COBJS))
+
+$(LIB):        $(obj).depend $(OBJS)
+       $(call cmd_link_o_target, $(OBJS))
+
+#########################################################################
+
+# defines $(obj).depend target
+include $(SRCTREE)/rules.mk
+
+sinclude $(obj).depend
+
+#########################################################################
diff --git a/board/compal/paz00/paz00.c b/board/compal/paz00/paz00.c
new file mode 100644 (file)
index 0000000..3b48917
--- /dev/null
@@ -0,0 +1,81 @@
+/*
+ * Copyright (c) 2010-2012, NVIDIA CORPORATION.  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 and conditions of the GNU General Public License,
+ * version 2, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
+ * more details.
+ */
+
+#include <common.h>
+#include <asm/io.h>
+#include <asm/arch/tegra2.h>
+#include <asm/arch/pinmux.h>
+#include <asm/arch/mmc.h>
+#include <asm/gpio.h>
+#ifdef CONFIG_TEGRA2_MMC
+#include <mmc.h>
+#endif
+
+/*
+ * Routine: gpio_config_uart
+ * Description: Does nothing on Paz00 - no conflict w/SPI.
+ */
+void gpio_config_uart(void)
+{
+}
+
+#ifdef CONFIG_TEGRA2_MMC
+/*
+ * Routine: pin_mux_mmc
+ * Description: setup the pin muxes/tristate values for the SDMMC(s)
+ */
+static void pin_mux_mmc(void)
+{
+       /* SDMMC4: config 3, x8 on 2nd set of pins */
+       pinmux_set_func(PINGRP_ATB, PMUX_FUNC_SDIO4);
+       pinmux_set_func(PINGRP_GMA, PMUX_FUNC_SDIO4);
+       pinmux_set_func(PINGRP_GME, PMUX_FUNC_SDIO4);
+
+       pinmux_tristate_disable(PINGRP_ATB);
+       pinmux_tristate_disable(PINGRP_GMA);
+       pinmux_tristate_disable(PINGRP_GME);
+
+       /* SDMMC1: SDIO1_CLK, SDIO1_CMD, SDIO1_DAT[3:0] */
+       pinmux_set_func(PINGRP_SDMMC1, PMUX_FUNC_SDIO1);
+
+       pinmux_tristate_disable(PINGRP_SDMMC1);
+
+       /* For power GPIO PV1 */
+       pinmux_tristate_disable(PINGRP_UAC);
+       /* For CD GPIO PI5 */
+       pinmux_tristate_disable(PINGRP_ATC);
+}
+
+/* this is a weak define that we are overriding */
+int board_mmc_init(bd_t *bd)
+{
+       debug("board_mmc_init called\n");
+
+       /* Enable muxes, etc. for SDMMC controllers */
+       pin_mux_mmc();
+
+       debug("board_mmc_init: init eMMC\n");
+       /* init dev 0, eMMC chip, with 4-bit bus */
+       /* The board has an 8-bit bus, but 8-bit doesn't work yet */
+       tegra2_mmc_init(0, 4, -1, -1);
+
+       debug("board_mmc_init: init SD slot\n");
+       /* init dev 3, SD slot, with 4-bit bus */
+       tegra2_mmc_init(3, 4, GPIO_PV1, GPIO_PI5);
+
+       return 0;
+}
+#endif
diff --git a/board/corscience/tricorder/Makefile b/board/corscience/tricorder/Makefile
new file mode 100644 (file)
index 0000000..16ef3a3
--- /dev/null
@@ -0,0 +1,46 @@
+#
+# (C) Copyright 2000, 2001, 2002
+# Wolfgang Denk, DENX Software Engineering, wd@denx.de.
+#
+# (C) Copyright 2012
+# Thomas Weber <weber@corscience.de>
+#
+# See file CREDITS for list of people who contributed to this
+# project.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 2 of
+# the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+# MA 02111-1307 USA
+#
+
+include $(TOPDIR)/config.mk
+
+LIB    = $(obj)lib$(BOARD).o
+
+COBJS  := tricorder.o
+
+SRCS   := $(COBJS:.o=.c)
+OBJS   := $(addprefix $(obj),$(COBJS))
+
+$(LIB):        $(obj).depend $(OBJS)
+       $(call cmd_link_o_target, $(OBJS))
+
+#########################################################################
+
+# defines $(obj).depend target
+include $(SRCTREE)/rules.mk
+
+sinclude $(obj).depend
+
+#########################################################################
diff --git a/board/corscience/tricorder/tricorder.c b/board/corscience/tricorder/tricorder.c
new file mode 100644 (file)
index 0000000..435711a
--- /dev/null
@@ -0,0 +1,105 @@
+/*
+ * (C) Copyright 2012
+ * Corscience GmbH & Co. KG, <www.corscience.de>
+ * Thomas Weber <weber@corscience.de>
+ * Sunil Kumar <sunilsaini05@gmail.com>
+ * Shashi Ranjan <shashiranjanmca05@gmail.com>
+ *
+ * Derived from Devkit8000 code by
+ * Frederik Kriewitz <frederik@kriewitz.eu>
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public 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 <twl4030.h>
+#include <asm/io.h>
+#include <asm/arch/mmc_host_def.h>
+#include <asm/arch/mux.h>
+#include <asm/arch/sys_proto.h>
+#include <asm/arch/mem.h>
+#include "tricorder.h"
+
+DECLARE_GLOBAL_DATA_PTR;
+
+/*
+ * Routine: board_init
+ * Description: Early hardware init.
+ */
+int board_init(void)
+{
+       gpmc_init(); /* in SRAM or SDRAM, finish GPMC */
+       /* boot param addr */
+       gd->bd->bi_boot_params = (OMAP34XX_SDRC_CS0 + 0x100);
+
+       return 0;
+}
+
+/*
+ * Routine: misc_init_r
+ * Description: Configure board specific parts
+ */
+int misc_init_r(void)
+{
+       twl4030_power_init();
+#ifdef CONFIG_TWL4030_LED
+       twl4030_led_init(TWL4030_LED_LEDEN_LEDAON | TWL4030_LED_LEDEN_LEDBON);
+#endif
+
+       dieid_num_r();
+
+       return 0;
+}
+
+/*
+ * Routine: set_muxconf_regs
+ * Description: Setting up the configuration Mux registers specific to the
+ *             hardware. Many pins need to be moved from protect to primary
+ *             mode.
+ */
+void set_muxconf_regs(void)
+{
+       MUX_TRICORDER();
+}
+
+#if defined(CONFIG_GENERIC_MMC) && !(defined(CONFIG_SPL_BUILD))
+int board_mmc_init(bd_t *bis)
+{
+       return omap_mmc_init(0);
+}
+#endif
+
+/*
+ * Routine: get_board_mem_timings
+ * Description: If we use SPL then there is no x-loader nor config header
+ * so we have to setup the DDR timings ourself on the first bank.  This
+ * provides the timing values back to the function that configures
+ * the memory.  We have either one or two banks of 128MB DDR.
+ */
+void get_board_mem_timings(u32 *mcfg, u32 *ctrla, u32 *ctrlb, u32 *rfr_ctrl,
+                               u32 *mr)
+{
+       /* General SDRC config */
+       *mcfg = MICRON_V_MCFG_165(128 << 20);
+       *rfr_ctrl = SDP_3430_SDRC_RFR_CTRL_165MHz;
+
+       /* AC timings */
+       *ctrla = MICRON_V_ACTIMA_165;
+       *ctrlb = MICRON_V_ACTIMB_165;
+       *mr = MICRON_V_MR_165;
+}
diff --git a/board/corscience/tricorder/tricorder.h b/board/corscience/tricorder/tricorder.h
new file mode 100644 (file)
index 0000000..cae8c75
--- /dev/null
@@ -0,0 +1,375 @@
+/*
+ * (C) Copyright 2008
+ * Dirk Behme <dirk.behme@gmail.com>
+ *
+ * (C) Copyright 2012
+ * Corscience GmbH & Co. KG, <www.corscience.de>
+ * Thomas Weber <weber@corscience.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 _TRICORDER_H_
+#define _TRICORDER_H_
+
+const omap3_sysinfo sysinfo = {
+       DDR_STACKED,
+       "OMAP3 Tricorder",
+       "NAND",
+};
+
+/*
+ * IEN  - Input Enable
+ * IDIS - Input Disable
+ * PTD  - Pull type Down
+ * PTU  - Pull type Up
+ * DIS  - Pull type selection is inactive
+ * EN   - Pull type selection is active
+ * M0   - Mode 0
+ * The commented string gives the final mux configuration for that pin
+ */
+#define MUX_TRICORDER() \
+       /* SDRC */\
+       MUX_VAL(CP(SDRC_D0),            (IEN  | PTD | DIS | M0)) /*SDRC_D0*/\
+       MUX_VAL(CP(SDRC_D1),            (IEN  | PTD | DIS | M0)) /*SDRC_D1*/\
+       MUX_VAL(CP(SDRC_D2),            (IEN  | PTD | DIS | M0)) /*SDRC_D2*/\
+       MUX_VAL(CP(SDRC_D3),            (IEN  | PTD | DIS | M0)) /*SDRC_D3*/\
+       MUX_VAL(CP(SDRC_D4),            (IEN  | PTD | DIS | M0)) /*SDRC_D4*/\
+       MUX_VAL(CP(SDRC_D5),            (IEN  | PTD | DIS | M0)) /*SDRC_D5*/\
+       MUX_VAL(CP(SDRC_D6),            (IEN  | PTD | DIS | M0)) /*SDRC_D6*/\
+       MUX_VAL(CP(SDRC_D7),            (IEN  | PTD | DIS | M0)) /*SDRC_D7*/\
+       MUX_VAL(CP(SDRC_D8),            (IEN  | PTD | DIS | M0)) /*SDRC_D8*/\
+       MUX_VAL(CP(SDRC_D9),            (IEN  | PTD | DIS | M0)) /*SDRC_D9*/\
+       MUX_VAL(CP(SDRC_D10),           (IEN  | PTD | DIS | M0)) /*SDRC_D10*/\
+       MUX_VAL(CP(SDRC_D11),           (IEN  | PTD | DIS | M0)) /*SDRC_D11*/\
+       MUX_VAL(CP(SDRC_D12),           (IEN  | PTD | DIS | M0)) /*SDRC_D12*/\
+       MUX_VAL(CP(SDRC_D13),           (IEN  | PTD | DIS | M0)) /*SDRC_D13*/\
+       MUX_VAL(CP(SDRC_D14),           (IEN  | PTD | DIS | M0)) /*SDRC_D14*/\
+       MUX_VAL(CP(SDRC_D15),           (IEN  | PTD | DIS | M0)) /*SDRC_D15*/\
+       MUX_VAL(CP(SDRC_D16),           (IEN  | PTD | DIS | M0)) /*SDRC_D16*/\
+       MUX_VAL(CP(SDRC_D17),           (IEN  | PTD | DIS | M0)) /*SDRC_D17*/\
+       MUX_VAL(CP(SDRC_D18),           (IEN  | PTD | DIS | M0)) /*SDRC_D18*/\
+       MUX_VAL(CP(SDRC_D19),           (IEN  | PTD | DIS | M0)) /*SDRC_D19*/\
+       MUX_VAL(CP(SDRC_D20),           (IEN  | PTD | DIS | M0)) /*SDRC_D20*/\
+       MUX_VAL(CP(SDRC_D21),           (IEN  | PTD | DIS | M0)) /*SDRC_D21*/\
+       MUX_VAL(CP(SDRC_D22),           (IEN  | PTD | DIS | M0)) /*SDRC_D22*/\
+       MUX_VAL(CP(SDRC_D23),           (IEN  | PTD | DIS | M0)) /*SDRC_D23*/\
+       MUX_VAL(CP(SDRC_D24),           (IEN  | PTD | DIS | M0)) /*SDRC_D24*/\
+       MUX_VAL(CP(SDRC_D25),           (IEN  | PTD | DIS | M0)) /*SDRC_D25*/\
+       MUX_VAL(CP(SDRC_D26),           (IEN  | PTD | DIS | M0)) /*SDRC_D26*/\
+       MUX_VAL(CP(SDRC_D27),           (IEN  | PTD | DIS | M0)) /*SDRC_D27*/\
+       MUX_VAL(CP(SDRC_D28),           (IEN  | PTD | DIS | M0)) /*SDRC_D28*/\
+       MUX_VAL(CP(SDRC_D29),           (IEN  | PTD | DIS | M0)) /*SDRC_D29*/\
+       MUX_VAL(CP(SDRC_D30),           (IEN  | PTD | DIS | M0)) /*SDRC_D30*/\
+       MUX_VAL(CP(SDRC_D31),           (IEN  | PTD | DIS | M0)) /*SDRC_D31*/\
+       MUX_VAL(CP(SDRC_CLK),           (IEN  | PTD | DIS | M0)) /*SDRC_CLK*/\
+       MUX_VAL(CP(SDRC_DQS0),          (IEN  | PTD | DIS | M0)) /*SDRC_DQS0*/\
+       MUX_VAL(CP(SDRC_DQS1),          (IEN  | PTD | DIS | M0)) /*SDRC_DQS1*/\
+       MUX_VAL(CP(SDRC_DQS2),          (IEN  | PTD | DIS | M0)) /*SDRC_DQS2*/\
+       MUX_VAL(CP(SDRC_DQS3),          (IEN  | PTD | DIS | M0)) /*SDRC_DQS3*/\
+       /* GPMC */\
+       MUX_VAL(CP(GPMC_A1),            (IDIS | PTD | DIS | M0)) /*GPMC_A1*/\
+       MUX_VAL(CP(GPMC_A2),            (IDIS | PTD | DIS | M0)) /*GPMC_A2*/\
+       MUX_VAL(CP(GPMC_A3),            (IDIS | PTD | DIS | M0)) /*GPMC_A3*/\
+       MUX_VAL(CP(GPMC_A4),            (IDIS | PTD | DIS | M0)) /*GPMC_A4*/\
+       MUX_VAL(CP(GPMC_A5),            (IDIS | PTD | DIS | M0)) /*GPMC_A5*/\
+       MUX_VAL(CP(GPMC_A6),            (IDIS | PTD | DIS | M0)) /*GPMC_A6*/\
+       MUX_VAL(CP(GPMC_A7),            (IDIS | PTD | DIS | M0)) /*GPMC_A7*/\
+       MUX_VAL(CP(GPMC_A8),            (IDIS | PTD | DIS | M0)) /*GPMC_A8*/\
+       MUX_VAL(CP(GPMC_A9),            (IDIS | PTD | DIS | M0)) /*GPMC_A9*/\
+       MUX_VAL(CP(GPMC_A10),           (IDIS | PTD | DIS | M0)) /*GPMC_A10*/\
+       MUX_VAL(CP(GPMC_D0),            (IEN  | PTD | DIS | M0)) /*GPMC_D0*/\
+       MUX_VAL(CP(GPMC_D1),            (IEN  | PTD | DIS | M0)) /*GPMC_D1*/\
+       MUX_VAL(CP(GPMC_D2),            (IEN  | PTD | DIS | M0)) /*GPMC_D2*/\
+       MUX_VAL(CP(GPMC_D3),            (IEN  | PTD | DIS | M0)) /*GPMC_D3*/\
+       MUX_VAL(CP(GPMC_D4),            (IEN  | PTD | DIS | M0)) /*GPMC_D4*/\
+       MUX_VAL(CP(GPMC_D5),            (IEN  | PTD | DIS | M0)) /*GPMC_D5*/\
+       MUX_VAL(CP(GPMC_D6),            (IEN  | PTD | DIS | M0)) /*GPMC_D6*/\
+       MUX_VAL(CP(GPMC_D7),            (IEN  | PTD | DIS | M0)) /*GPMC_D7*/\
+       MUX_VAL(CP(GPMC_D8),            (IEN  | PTD | DIS | M0)) /*GPMC_D8*/\
+       MUX_VAL(CP(GPMC_D9),            (IEN  | PTD | DIS | M0)) /*GPMC_D9*/\
+       MUX_VAL(CP(GPMC_D10),           (IEN  | PTD | DIS | M0)) /*GPMC_D10*/\
+       MUX_VAL(CP(GPMC_D11),           (IEN  | PTD | DIS | M0)) /*GPMC_D11*/\
+       MUX_VAL(CP(GPMC_D12),           (IEN  | PTD | DIS | M0)) /*GPMC_D12*/\
+       MUX_VAL(CP(GPMC_D13),           (IEN  | PTD | DIS | M0)) /*GPMC_D13*/\
+       MUX_VAL(CP(GPMC_D14),           (IEN  | PTD | DIS | M0)) /*GPMC_D14*/\
+       MUX_VAL(CP(GPMC_D15),           (IEN  | PTD | DIS | M0)) /*GPMC_D15*/\
+       MUX_VAL(CP(GPMC_NCS0),          (IDIS | PTU | EN  | M0)) /*GPMC_nCS0 NAND*/\
+       MUX_VAL(CP(GPMC_NCS1),          (IDIS | PTU | EN  | M0)) /*GPMC_nCS1*/\
+       MUX_VAL(CP(GPMC_NCS2),          (IDIS | PTU | EN  | M0)) /*GPMC_nCS2*/\
+       MUX_VAL(CP(GPMC_NCS3),          (IDIS | PTU | EN  | M0)) /*GPMC_nCS3*/\
+       MUX_VAL(CP(GPMC_NCS4),          (IDIS | PTU | EN  | M0)) /*GPMC_nCS4*/\
+       MUX_VAL(CP(GPMC_NCS5),          (IDIS | PTU | EN  | M0)) /*GPMC_nCS5*/\
+       MUX_VAL(CP(GPMC_NCS6),          (IDIS | PTU | EN  | M0)) /*GPMC_nCS6*/\
+       MUX_VAL(CP(GPMC_NCS7),          (IDIS | PTU | EN  | M0)) /*GPMC_nCS7*/\
+       MUX_VAL(CP(GPMC_NBE1),          (IEN  | PTD | DIS | M0)) /*GPMC_nBE1*/\
+       MUX_VAL(CP(GPMC_WAIT2),         (IEN  | PTU | EN  | M0)) /*GPMC_WAIT2*/\
+       MUX_VAL(CP(GPMC_WAIT3),         (IEN  | PTU | EN  | M0)) /*GPMC_WAIT3*/\
+       MUX_VAL(CP(GPMC_CLK),           (IDIS | PTD | DIS | M0)) /*GPMC_CLK*/\
+       MUX_VAL(CP(GPMC_NADV_ALE),      (IDIS | PTD | DIS | M0)) /*GPMC_nADV_ALE*/\
+       MUX_VAL(CP(GPMC_NOE),           (IDIS | PTD | DIS | M0)) /*GPMC_nOE*/\
+       MUX_VAL(CP(GPMC_NWE),           (IDIS | PTD | DIS | M0)) /*GPMC_nWE*/\
+       MUX_VAL(CP(GPMC_NBE0_CLE),      (IDIS | PTD | DIS | M0)) /*GPMC_nBE0_CLE*/\
+       MUX_VAL(CP(GPMC_NWP),           (IEN  | PTD | DIS | M0)) /*GPMC_nWP*/\
+       MUX_VAL(CP(GPMC_WAIT0),         (IEN  | PTU | EN  | M0)) /*GPMC_WAIT0*/\
+       MUX_VAL(CP(GPMC_WAIT1),         (IEN  | PTU | EN  | M0)) /*GPMC_WAIT1*/\
+       /* DSS */\
+       MUX_VAL(CP(DSS_PCLK),           (IDIS | PTD | DIS | M0)) /*DSS_PCLK*/\
+       MUX_VAL(CP(DSS_HSYNC),          (IDIS | PTD | DIS | M0)) /*DSS_HSYNC*/\
+       MUX_VAL(CP(DSS_VSYNC),          (IDIS | PTD | DIS | M0)) /*DSS_VSYNC*/\
+       MUX_VAL(CP(DSS_ACBIAS),         (IDIS | PTD | DIS | M0)) /*DSS_ACBIAS*/\
+       MUX_VAL(CP(DSS_DATA0),          (IDIS | PTD | DIS | M0)) /*DSS_DATA0*/\
+       MUX_VAL(CP(DSS_DATA1),          (IDIS | PTD | DIS | M0)) /*DSS_DATA1*/\
+       MUX_VAL(CP(DSS_DATA2),          (IDIS | PTD | DIS | M0)) /*DSS_DATA2*/\
+       MUX_VAL(CP(DSS_DATA3),          (IDIS | PTD | DIS | M0)) /*DSS_DATA3*/\
+       MUX_VAL(CP(DSS_DATA4),          (IDIS | PTD | DIS | M0)) /*DSS_DATA4*/\
+       MUX_VAL(CP(DSS_DATA5),          (IDIS | PTD | DIS | M0)) /*DSS_DATA5*/\
+       MUX_VAL(CP(DSS_DATA6),          (IDIS | PTD | DIS | M0)) /*DSS_DATA6*/\
+       MUX_VAL(CP(DSS_DATA7),          (IDIS | PTD | DIS | M0)) /*DSS_DATA7*/\
+       MUX_VAL(CP(DSS_DATA8),          (IDIS | PTD | DIS | M0)) /*DSS_DATA8*/\
+       MUX_VAL(CP(DSS_DATA9),          (IDIS | PTD | DIS | M0)) /*DSS_DATA9*/\
+       MUX_VAL(CP(DSS_DATA10),         (IDIS | PTD | DIS | M0)) /*DSS_DATA10*/\
+       MUX_VAL(CP(DSS_DATA11),         (IDIS | PTD | DIS | M0)) /*DSS_DATA11*/\
+       MUX_VAL(CP(DSS_DATA12),         (IDIS | PTD | DIS | M0)) /*DSS_DATA12*/\
+       MUX_VAL(CP(DSS_DATA13),         (IDIS | PTD | DIS | M0)) /*DSS_DATA13*/\
+       MUX_VAL(CP(DSS_DATA14),         (IDIS | PTD | DIS | M0)) /*DSS_DATA14*/\
+       MUX_VAL(CP(DSS_DATA15),         (IDIS | PTD | DIS | M0)) /*DSS_DATA15*/\
+       MUX_VAL(CP(DSS_DATA16),         (IDIS | PTD | DIS | M0)) /*DSS_DATA16*/\
+       MUX_VAL(CP(DSS_DATA17),         (IDIS | PTD | DIS | M0)) /*DSS_DATA17*/\
+       MUX_VAL(CP(DSS_DATA18),         (IDIS | PTD | DIS | M0)) /*DSS_DATA18*/\
+       MUX_VAL(CP(DSS_DATA19),         (IDIS | PTD | DIS | M0)) /*DSS_DATA19*/\
+       MUX_VAL(CP(DSS_DATA20),         (IDIS | PTD | DIS | M0)) /*DSS_DATA20*/\
+       MUX_VAL(CP(DSS_DATA21),         (IDIS | PTD | DIS | M0)) /*DSS_DATA21*/\
+       MUX_VAL(CP(DSS_DATA22),         (IDIS | PTD | DIS | M0)) /*DSS_DATA22*/\
+       MUX_VAL(CP(DSS_DATA23),         (IDIS | PTD | DIS | M0)) /*DSS_DATA23*/\
+       /* CAMERA */\
+       MUX_VAL(CP(CAM_HS),             (IEN  | PTU | EN  | M0)) /*CAM_HS */\
+       MUX_VAL(CP(CAM_VS),             (IEN  | PTU | EN  | M0)) /*CAM_VS */\
+       MUX_VAL(CP(CAM_XCLKA),          (IDIS | PTD | DIS | M0)) /*CAM_XCLKA*/\
+       MUX_VAL(CP(CAM_PCLK),           (IEN  | PTU | EN  | M0)) /*CAM_PCLK*/\
+       MUX_VAL(CP(CAM_FLD),            (IDIS | PTD | DIS | M4)) /*GPIO_98*/\
+       MUX_VAL(CP(CAM_D0),             (IEN  | PTD | DIS | M0)) /*CAM_D0*/\
+       MUX_VAL(CP(CAM_D1),             (IEN  | PTD | DIS | M0)) /*CAM_D1*/\
+       MUX_VAL(CP(CAM_D2),             (IEN  | PTD | DIS | M0)) /*CAM_D2*/\
+       MUX_VAL(CP(CAM_D3),             (IEN  | PTD | DIS | M0)) /*CAM_D3*/\
+       MUX_VAL(CP(CAM_D4),             (IEN  | PTD | DIS | M0)) /*CAM_D4*/\
+       MUX_VAL(CP(CAM_D5),             (IEN  | PTD | DIS | M0)) /*CAM_D5*/\
+       MUX_VAL(CP(CAM_D6),             (IEN  | PTD | DIS | M0)) /*CAM_D6*/\
+       MUX_VAL(CP(CAM_D7),             (IEN  | PTD | DIS | M0)) /*CAM_D7*/\
+       MUX_VAL(CP(CAM_D8),             (IEN  | PTD | DIS | M0)) /*CAM_D8*/\
+       MUX_VAL(CP(CAM_D9),             (IEN  | PTD | DIS | M0)) /*CAM_D9*/\
+       MUX_VAL(CP(CAM_D10),            (IEN  | PTD | DIS | M0)) /*CAM_D10*/\
+       MUX_VAL(CP(CAM_D11),            (IEN  | PTD | DIS | M0)) /*CAM_D11*/\
+       MUX_VAL(CP(CAM_XCLKB),          (IDIS | PTD | DIS | M0)) /*CAM_XCLKB*/\
+       MUX_VAL(CP(CAM_WEN),            (IEN  | PTD | DIS | M4)) /*GPIO_167*/\
+       MUX_VAL(CP(CAM_STROBE),         (IDIS | PTD | DIS | M0)) /*CAM_STROBE*/\
+       MUX_VAL(CP(CSI2_DX0),           (IEN  | PTD | DIS | M0)) /*CSI2_DX0*/\
+       MUX_VAL(CP(CSI2_DY0),           (IEN  | PTD | DIS | M0)) /*CSI2_DY0*/\
+       MUX_VAL(CP(CSI2_DX1),           (IEN  | PTD | DIS | M0)) /*CSI2_DX1*/\
+       MUX_VAL(CP(CSI2_DY1),           (IEN  | PTD | DIS | M0)) /*CSI2_DY1*/\
+       /* Audio Interface */\
+       MUX_VAL(CP(MCBSP2_FSX),         (IEN  | PTD | DIS | M0)) /*McBSP2_FSX*/\
+       MUX_VAL(CP(MCBSP2_CLKX),        (IEN  | PTD | DIS | M0)) /*McBSP2_CLKX*/\
+       MUX_VAL(CP(MCBSP2_DR),          (IEN  | PTD | DIS | M0)) /*McBSP2_DR*/\
+       MUX_VAL(CP(MCBSP2_DX),          (IDIS | PTD | DIS | M0)) /*McBSP2_DX*/\
+       /* MMC Slot */\
+       MUX_VAL(CP(MMC1_CLK),           (IDIS | PTU | EN  | M0)) /*MMC1_CLK*/\
+       MUX_VAL(CP(MMC1_CMD),           (IEN  | PTU | EN  | M0)) /*MMC1_CMD*/\
+       MUX_VAL(CP(MMC1_DAT0),          (IEN  | PTU | EN  | M0)) /*MMC1_DAT0*/\
+       MUX_VAL(CP(MMC1_DAT1),          (IEN  | PTU | EN  | M0)) /*MMC1_DAT1*/\
+       MUX_VAL(CP(MMC1_DAT2),          (IEN  | PTU | EN  | M0)) /*MMC1_DAT2*/\
+       MUX_VAL(CP(MMC1_DAT3),          (IEN  | PTU | EN  | M0)) /*MMC1_DAT3*/\
+       MUX_VAL(CP(MMC1_DAT4),          (IEN  | PTU | EN  | M0)) /*MMC1_DAT4*/\
+       MUX_VAL(CP(MMC1_DAT5),          (IEN  | PTU | EN  | M0)) /*MMC1_DAT5*/\
+       MUX_VAL(CP(MMC1_DAT6),          (IEN  | PTU | EN  | M0)) /*MMC1_DAT6*/\
+       MUX_VAL(CP(MMC1_DAT7),          (IEN  | PTU | EN  | M0)) /*MMC1_DAT7*/\
+       /* Expansion Header */\
+       MUX_VAL(CP(MMC2_CLK),           (IEN  | PTU | EN  | M4)) /*GPIO_130*/\
+       MUX_VAL(CP(MMC2_CMD),           (IEN  | PTU | EN  | M4)) /*GPIO_131*/\
+       MUX_VAL(CP(MMC2_DAT0),          (IEN  | PTU | EN  | M4)) /*GPIO_132*/\
+       MUX_VAL(CP(MMC2_DAT1),          (IEN  | PTU | EN  | M4)) /*GPIO_133*/\
+       MUX_VAL(CP(MMC2_DAT2),          (IEN  | PTU | EN  | M4)) /*GPIO_134*/\
+       MUX_VAL(CP(MMC2_DAT3),          (IEN  | PTU | EN  | M4)) /*GPIO_135*/\
+       MUX_VAL(CP(MMC2_DAT4),          (IEN  | PTU | EN  | M4)) /*GPIO_136*/\
+       MUX_VAL(CP(MMC2_DAT5),          (IEN  | PTU | EN  | M4)) /*GPIO_137*/\
+       MUX_VAL(CP(MMC2_DAT6),          (IEN  | PTU | EN  | M4)) /*GPIO_138*/\
+       MUX_VAL(CP(MMC2_DAT7),          (IEN  | PTU | EN  | M4)) /*GPIO_139*/\
+       MUX_VAL(CP(MCBSP3_DX),          (IDIS | PTD | DIS | M4)) /*GPIO_140*/\
+       MUX_VAL(CP(MCBSP3_DR),          (IDIS | PTD | DIS | M4)) /*GPIO_141*/\
+       MUX_VAL(CP(MCBSP3_CLKX),        (IDIS | PTD | DIS | M4)) /*GPIO_142*/\
+       MUX_VAL(CP(MCBSP3_FSX),         (IDIS | PTD | DIS | M4)) /*GPIO_143*/\
+       MUX_VAL(CP(UART2_CTS),          (IDIS | PTD | DIS | M4)) /*GPIO_144*/\
+       MUX_VAL(CP(UART2_RTS),          (IDIS | PTD | DIS | M4)) /*GPIO_145*/\
+       MUX_VAL(CP(UART2_TX),           (IDIS | PTD | DIS | M4)) /*GPIO_146*/\
+       MUX_VAL(CP(UART2_RX),           (IDIS | PTD | DIS | M4)) /*GPIO_147*/\
+       MUX_VAL(CP(UART1_TX),           (IDIS | PTD | DIS | M0)) /*GPIO_148*/\
+       MUX_VAL(CP(UART1_RTS),          (IDIS | PTD | DIS | M4)) /*GPIO_149*/ \
+       MUX_VAL(CP(UART1_CTS),          (IDIS | PTD | DIS | M4)) /*GPIO_150*/ \
+       MUX_VAL(CP(UART1_RX),           (IEN  | PTD | DIS | M0)) /*GPIO_151*/\
+       MUX_VAL(CP(MCBSP4_CLKX),        (IEN  | PTD | DIS | M1)) /*GPIO_152*/\
+       MUX_VAL(CP(MCBSP4_DR),          (IEN  | PTD | DIS | M1)) /*GPIO_153*/\
+       MUX_VAL(CP(MCBSP4_DX),          (IEN  | PTD | DIS | M1)) /*GPIO_154*/\
+       MUX_VAL(CP(MCBSP4_FSX),         (IEN  | PTD | DIS | M1)) /*GPIO_155*/\
+       MUX_VAL(CP(MCBSP1_CLKR),        (IDIS | PTD | DIS | M4)) /*GPIO_156*/\
+       MUX_VAL(CP(MCBSP1_FSR),         (IDIS | PTU | EN  | M4)) /*GPIO_157*/\
+       MUX_VAL(CP(MCBSP1_DX),          (IDIS | PTD | DIS | M4)) /*GPIO_158*/\
+       MUX_VAL(CP(MCBSP1_DR),          (IDIS | PTD | DIS | M4)) /*GPIO_159*/\
+       MUX_VAL(CP(MCBSP_CLKS),         (IEN  | PTU | DIS | M0)) /*GPIO_160*/\
+       MUX_VAL(CP(MCBSP1_FSX),         (IDIS | PTD | DIS | M4)) /*GPIO_161*/\
+       MUX_VAL(CP(MCBSP1_CLKX),        (IDIS | PTD | DIS | M4)) /*GPIO_162*/\
+       /* Serial Interface */\
+       MUX_VAL(CP(UART3_CTS_RCTX),     (IDIS | PTD | EN  | M4)) /*GPIO_163 - LED2*/\
+       MUX_VAL(CP(UART3_RTS_SD),       (IDIS | PTU | EN  | M4)) /*GPIO_164 - LED3*/\
+       MUX_VAL(CP(UART3_RX_IRRX),      (IEN  | PTD | DIS | M0)) /*UART3_RX_IRRX*/\
+       MUX_VAL(CP(UART3_TX_IRTX),      (IDIS | PTD | DIS | M0)) /*UART3_TX_IRTX*/\
+       /* Host USB0 */\
+       MUX_VAL(CP(HSUSB0_CLK),         (IEN  | PTD | DIS | M0)) /*HSUSB0_CLK*/\
+       MUX_VAL(CP(HSUSB0_STP),         (IDIS | PTU | EN  | M0)) /*HSUSB0_STP*/\
+       MUX_VAL(CP(HSUSB0_DIR),         (IEN  | PTD | DIS | M0)) /*HSUSB0_DIR*/\
+       MUX_VAL(CP(HSUSB0_NXT),         (IEN  | PTD | DIS | M0)) /*HSUSB0_NXT*/\
+       MUX_VAL(CP(HSUSB0_DATA0),       (IEN  | PTD | DIS | M0)) /*HSUSB0_DATA0*/\
+       MUX_VAL(CP(HSUSB0_DATA1),       (IEN  | PTD | DIS | M0)) /*HSUSB0_DATA1*/\
+       MUX_VAL(CP(HSUSB0_DATA2),       (IEN  | PTD | DIS | M0)) /*HSUSB0_DATA2*/\
+       MUX_VAL(CP(HSUSB0_DATA3),       (IEN  | PTD | DIS | M0)) /*HSUSB0_DATA3*/\
+       MUX_VAL(CP(HSUSB0_DATA4),       (IEN  | PTD | DIS | M0)) /*HSUSB0_DATA4*/\
+       MUX_VAL(CP(HSUSB0_DATA5),       (IEN  | PTD | DIS | M0)) /*HSUSB0_DATA5*/\
+       MUX_VAL(CP(HSUSB0_DATA6),       (IEN  | PTD | DIS | M0)) /*HSUSB0_DATA6*/\
+       MUX_VAL(CP(HSUSB0_DATA7),       (IEN  | PTD | DIS | M0)) /*HSUSB0_DATA7*/\
+       MUX_VAL(CP(I2C1_SCL),           (IEN  | PTU | EN  | M0)) /*I2C1_SCL*/\
+       MUX_VAL(CP(I2C1_SDA),           (IEN  | PTU | EN  | M0)) /*I2C1_SDA*/\
+       MUX_VAL(CP(I2C2_SCL),           (IEN  | PTU | EN  | M0)) /*I2C2_SCL*/\
+       MUX_VAL(CP(I2C2_SDA),           (IEN  | PTU | EN  | M0)) /*I2C2_SDA*/\
+       MUX_VAL(CP(I2C3_SCL),           (IEN  | PTU | EN  | M0)) /*I2C3_SCL*/\
+       MUX_VAL(CP(I2C3_SDA),           (IEN  | PTU | EN  | M0)) /*I2C3_SDA*/\
+       MUX_VAL(CP(I2C4_SCL),           (IEN  | PTU | EN  | M0)) /*I2C4_SCL*/\
+       MUX_VAL(CP(I2C4_SDA),           (IEN  | PTU | EN  | M0)) /*I2C4_SDA*/\
+       MUX_VAL(CP(HDQ_SIO),            (IEN  | PTU | EN  | M0)) /*HDQ_SIO*/\
+       MUX_VAL(CP(MCSPI1_CLK),         (IEN  | PTD | DIS | M4)) /*GPIO_171*/\
+       MUX_VAL(CP(MCSPI1_SIMO),        (IEN  | PTD | DIS | M4)) /*GPIO_172*/\
+       MUX_VAL(CP(MCSPI1_SOMI),        (IEN  | PTD | DIS | M0)) /*MCSPI1_SOMI*/\
+       MUX_VAL(CP(MCSPI1_CS0),         (IEN  | PTD | DIS | M0)) /*MCSPI1_CS0*/\
+       MUX_VAL(CP(MCSPI1_CS1),         (IDIS | PTD | DIS | M0)) /*MCSPI1_CS1*/\
+       MUX_VAL(CP(MCSPI1_CS2),         (IDIS | PTD | DIS | M4)) /*GPIO_176*/\
+       /* USB EHCI (port 2) */\
+       MUX_VAL(CP(MCSPI1_CS3),         (IEN  | PTD | EN  | M0)) /*HSUSB2_DATA2*/\
+       MUX_VAL(CP(MCSPI2_CLK),         (IEN  | PTD | DIS | M0)) /*HSUSB2_DATA7*/\
+       MUX_VAL(CP(MCSPI2_SIMO),        (IEN  | PTD | DIS | M0)) /*HSUSB2_DATA4*/\
+       MUX_VAL(CP(MCSPI2_SOMI),        (IEN  | PTD | DIS | M0)) /*HSUSB2_DATA5*/\
+       MUX_VAL(CP(MCSPI2_CS0),         (IEN  | PTD | EN  | M0)) /*HSUSB2_DATA6*/\
+       MUX_VAL(CP(MCSPI2_CS1),         (IEN  | PTD | EN  | M0)) /*HSUSB2_DATA3*/\
+       /*Control and debug */\
+       MUX_VAL(CP(SYS_32K),            (IEN  | PTD | DIS | M0)) /*SYS_32K*/\
+       MUX_VAL(CP(SYS_CLKREQ),         (IEN  | PTD | DIS | M0)) /*SYS_CLKREQ*/\
+       MUX_VAL(CP(SYS_NIRQ),           (IEN  | PTU | EN  | M0)) /*SYS_nIRQ*/\
+       MUX_VAL(CP(SYS_BOOT0),          (IEN  | PTD | DIS | M4)) /*GPIO_2*/\
+       MUX_VAL(CP(SYS_BOOT1),          (IEN  | PTD | DIS | M4)) /*GPIO_3*/\
+       MUX_VAL(CP(SYS_BOOT2),          (IEN  | PTD | DIS | M4)) /*GPIO_4*/\
+       MUX_VAL(CP(SYS_BOOT3),          (IEN  | PTD | DIS | M4)) /*GPIO_5*/\
+       MUX_VAL(CP(SYS_BOOT4),          (IEN  | PTD | DIS | M4)) /*GPIO_6*/\
+       MUX_VAL(CP(SYS_BOOT5),          (IEN  | PTD | DIS | M4)) /*GPIO_7 - BOOTMODE*/\
+       MUX_VAL(CP(SYS_BOOT6),          (IDIS | PTD | DIS | M4)) /*GPIO_8*/ \
+       MUX_VAL(CP(SYS_OFF_MODE),       (IEN  | PTD | DIS | M0)) /*SYS_OFF_MODE*/\
+       MUX_VAL(CP(SYS_CLKOUT1),        (IDIS | PTD | EN  | M0)) /*SYS_CLKOUT1*/\
+       MUX_VAL(CP(SYS_CLKOUT2),        (IDIS | PTU | EN  | M4)) /*GPIO_186 - LED1*/\
+       MUX_VAL(CP(ETK_CLK_ES2),        (IDIS | PTD | DIS | M4)) /*GPIO_12*/\
+       MUX_VAL(CP(ETK_CTL_ES2),        (IDIS | PTD | EN  | M4)) /*GPIO_13*/\
+       MUX_VAL(CP(ETK_D0_ES2),         (IDIS | PTU | EN  | M1)) /*SPI3_SIMO*/\
+       MUX_VAL(CP(ETK_D1_ES2),         (IDIS | PTU | EN  | M1)) /*SPI3_SOMI*/\
+       MUX_VAL(CP(ETK_D2_ES2),         (IDIS | PTU | EN  | M1)) /*SPI3_CS0*/\
+       MUX_VAL(CP(ETK_D3_ES2),         (IDIS | PTU | EN  | M1)) /*SPI3_CLK*/\
+       MUX_VAL(CP(ETK_D4_ES2),         (IDIS | PTU | EN  | M4)) /*GPIO_18*/\
+       MUX_VAL(CP(ETK_D5_ES2),         (IDIS | PTU | EN  | M4)) /*GPIO_19*/\
+       MUX_VAL(CP(ETK_D6_ES2),         (IDIS | PTU | EN  | M4)) /*GPIO_20*/\
+       MUX_VAL(CP(ETK_D7_ES2),         (IDIS | PTU | EN  | M1)) /*SPI3_CS1*/\
+       MUX_VAL(CP(ETK_D8_ES2),         (IEN  | PTU | DIS | M4)) /*MSECURE*/\
+       MUX_VAL(CP(ETK_D9_ES2),         (IEN  | PTU | EN  | M4)) /*GPIO_23*/\
+       /*HSUSB2 */\
+       MUX_VAL(CP(ETK_D10_ES2),        (IDIS | PTU | EN  | M4)) /*GPIO_24*/\
+       MUX_VAL(CP(ETK_D11_ES2),        (IEN  | PTU | EN  | M4)) /*GPIO_25*/\
+       MUX_VAL(CP(ETK_D12_ES2),        (IEN  | PTU | EN  | M4)) /*GPIO_26*/\
+       MUX_VAL(CP(ETK_D13_ES2),        (IEN  | PTU | EN  | M4)) /*GPIO_27*/\
+       MUX_VAL(CP(ETK_D14_ES2),        (IEN  | PTU | EN  | M4)) /*GPIO_28*/\
+       MUX_VAL(CP(ETK_D15_ES2),        (IEN  | PTU | EN  | M4)) /*GPIO_29*/\
+       /* */\
+       MUX_VAL(CP(D2D_MCAD1),          (IEN  | PTD | EN  | M0)) /*D2D_MCAD1*/\
+       MUX_VAL(CP(D2D_MCAD2),          (IEN  | PTD | EN  | M0)) /*D2D_MCAD2*/\
+       MUX_VAL(CP(D2D_MCAD3),          (IEN  | PTD | EN  | M0)) /*D2D_MCAD3*/\
+       MUX_VAL(CP(D2D_MCAD4),          (IEN  | PTD | EN  | M0)) /*D2D_MCAD4*/\
+       MUX_VAL(CP(D2D_MCAD5),          (IEN  | PTD | EN  | M0)) /*D2D_MCAD5*/\
+       MUX_VAL(CP(D2D_MCAD6),          (IEN  | PTD | EN  | M0)) /*D2D_MCAD6*/\
+       MUX_VAL(CP(D2D_MCAD7),          (IEN  | PTD | EN  | M0)) /*D2D_MCAD7*/\
+       MUX_VAL(CP(D2D_MCAD8),          (IEN  | PTD | EN  | M0)) /*D2D_MCAD8*/\
+       MUX_VAL(CP(D2D_MCAD9),          (IEN  | PTD | EN  | M0)) /*D2D_MCAD9*/\
+       MUX_VAL(CP(D2D_MCAD10),         (IEN  | PTD | EN  | M0)) /*D2D_MCAD10*/\
+       MUX_VAL(CP(D2D_MCAD11),         (IEN  | PTD | EN  | M0)) /*D2D_MCAD11*/\
+       MUX_VAL(CP(D2D_MCAD12),         (IEN  | PTD | EN  | M0)) /*D2D_MCAD12*/\
+       MUX_VAL(CP(D2D_MCAD13),         (IEN  | PTD | EN  | M0)) /*D2D_MCAD13*/\
+       MUX_VAL(CP(D2D_MCAD14),         (IEN  | PTD | EN  | M0)) /*D2D_MCAD14*/\
+       MUX_VAL(CP(D2D_MCAD15),         (IEN  | PTD | EN  | M0)) /*D2D_MCAD15*/\
+       MUX_VAL(CP(D2D_MCAD16),         (IEN  | PTD | EN  | M0)) /*D2D_MCAD16*/\
+       MUX_VAL(CP(D2D_MCAD17),         (IEN  | PTD | EN  | M0)) /*D2D_MCAD17*/\
+       MUX_VAL(CP(D2D_MCAD18),         (IEN  | PTD | EN  | M0)) /*D2D_MCAD18*/\
+       MUX_VAL(CP(D2D_MCAD19),         (IEN  | PTD | EN  | M0)) /*D2D_MCAD19*/\
+       MUX_VAL(CP(D2D_MCAD20),         (IEN  | PTD | EN  | M0)) /*D2D_MCAD20*/\
+       MUX_VAL(CP(D2D_MCAD21),         (IEN  | PTD | EN  | M0)) /*D2D_MCAD21*/\
+       MUX_VAL(CP(D2D_MCAD22),         (IEN  | PTD | EN  | M0)) /*D2D_MCAD22*/\
+       MUX_VAL(CP(D2D_MCAD23),         (IEN  | PTD | EN  | M0)) /*D2D_MCAD23*/\
+       MUX_VAL(CP(D2D_MCAD24),         (IEN  | PTD | EN  | M0)) /*D2D_MCAD24*/\
+       MUX_VAL(CP(D2D_MCAD25),         (IEN  | PTD | EN  | M0)) /*D2D_MCAD25*/\
+       MUX_VAL(CP(D2D_MCAD26),         (IEN  | PTD | EN  | M0)) /*D2D_MCAD26*/\
+       MUX_VAL(CP(D2D_MCAD27),         (IEN  | PTD | EN  | M0)) /*D2D_MCAD27*/\
+       MUX_VAL(CP(D2D_MCAD28),         (IEN  | PTD | EN  | M0)) /*D2D_MCAD28*/\
+       MUX_VAL(CP(D2D_MCAD29),         (IEN  | PTD | EN  | M0)) /*D2D_MCAD29*/\
+       MUX_VAL(CP(D2D_MCAD30),         (IEN  | PTD | EN  | M0)) /*D2D_MCAD30*/\
+       MUX_VAL(CP(D2D_MCAD31),         (IEN  | PTD | EN  | M0)) /*D2D_MCAD31*/\
+       MUX_VAL(CP(D2D_MCAD32),         (IEN  | PTD | EN  | M0)) /*D2D_MCAD32*/\
+       MUX_VAL(CP(D2D_MCAD33),         (IEN  | PTD | EN  | M0)) /*D2D_MCAD33*/\
+       MUX_VAL(CP(D2D_MCAD34),         (IEN  | PTD | EN  | M0)) /*D2D_MCAD34*/\
+       MUX_VAL(CP(D2D_MCAD35),         (IEN  | PTD | EN  | M0)) /*D2D_MCAD35*/\
+       MUX_VAL(CP(D2D_MCAD36),         (IEN  | PTD | EN  | M0)) /*D2D_MCAD36*/\
+       MUX_VAL(CP(D2D_CLK26MI),        (IEN  | PTD | DIS | M0)) /*D2D_clk26mi*/\
+       MUX_VAL(CP(D2D_NRESPWRON),      (IEN  | PTD | EN  | M0)) /*D2D_nrespwron*/\
+       MUX_VAL(CP(D2D_NRESWARM),       (IEN  | PTU | EN  | M0)) /*D2D_nreswarm */\
+       MUX_VAL(CP(D2D_ARM9NIRQ),       (IEN  | PTD | DIS | M0)) /*D2D_arm9nirq */\
+       MUX_VAL(CP(D2D_UMA2P6FIQ),      (IEN  | PTD | DIS | M0)) /*D2D_uma2p6fiq*/\
+       MUX_VAL(CP(D2D_SPINT),          (IEN  | PTD | EN  | M0)) /*D2D_spint*/\
+       MUX_VAL(CP(D2D_FRINT),          (IEN  | PTD | EN  | M0)) /*D2D_frint*/\
+       MUX_VAL(CP(D2D_DMAREQ0),        (IEN  | PTD | DIS | M0)) /*D2D_dmareq0*/\
+       MUX_VAL(CP(D2D_DMAREQ1),        (IEN  | PTD | DIS | M0)) /*D2D_dmareq1*/\
+       MUX_VAL(CP(D2D_DMAREQ2),        (IEN  | PTD | DIS | M0)) /*D2D_dmareq2*/\
+       MUX_VAL(CP(D2D_DMAREQ3),        (IEN  | PTD | DIS | M0)) /*D2D_dmareq3*/\
+       MUX_VAL(CP(D2D_N3GTRST),        (IEN  | PTD | DIS | M0)) /*D2D_n3gtrst*/\
+       MUX_VAL(CP(D2D_N3GTDI),         (IEN  | PTD | DIS | M0)) /*D2D_n3gtdi*/\
+       MUX_VAL(CP(D2D_N3GTDO),         (IEN  | PTD | DIS | M0)) /*D2D_n3gtdo*/\
+       MUX_VAL(CP(D2D_N3GTMS),         (IEN  | PTD | DIS | M0)) /*D2D_n3gtms*/\
+       MUX_VAL(CP(D2D_N3GTCK),         (IEN  | PTD | DIS | M0)) /*D2D_n3gtck*/\
+       MUX_VAL(CP(D2D_N3GRTCK),        (IEN  | PTD | DIS | M0)) /*D2D_n3grtck*/\
+       MUX_VAL(CP(D2D_MSTDBY),         (IEN  | PTU | EN  | M0)) /*D2D_mstdby*/\
+       MUX_VAL(CP(D2D_SWAKEUP),        (IEN  | PTD | EN  | M0)) /*D2D_swakeup*/\
+       MUX_VAL(CP(D2D_IDLEREQ),        (IEN  | PTD | DIS | M0)) /*D2D_idlereq*/\
+       MUX_VAL(CP(D2D_IDLEACK),        (IEN  | PTU | EN  | M0)) /*D2D_idleack*/\
+       MUX_VAL(CP(D2D_MWRITE),         (IEN  | PTD | DIS | M0)) /*D2D_mwrite*/\
+       MUX_VAL(CP(D2D_SWRITE),         (IEN  | PTD | DIS | M0)) /*D2D_swrite*/\
+       MUX_VAL(CP(D2D_MREAD),          (IEN  | PTD | DIS | M0)) /*D2D_mread*/\
+       MUX_VAL(CP(D2D_SREAD),          (IEN  | PTD | DIS | M0)) /*D2D_sread*/\
+       MUX_VAL(CP(D2D_MBUSFLAG),       (IEN  | PTD | DIS | M0)) /*D2D_mbusflag*/\
+       MUX_VAL(CP(D2D_SBUSFLAG),       (IEN  | PTD | DIS | M0)) /*D2D_sbusflag*/\
+       MUX_VAL(CP(SDRC_CKE0),          (IDIS | PTU | EN  | M0)) /*sdrc_cke0*/\
+       MUX_VAL(CP(SDRC_CKE1),          (IDIS | PTD | DIS | M7)) /*sdrc_cke1*/
+
+#endif
diff --git a/board/d-link/dns325/Makefile b/board/d-link/dns325/Makefile
new file mode 100644 (file)
index 0000000..35da21a
--- /dev/null
@@ -0,0 +1,49 @@
+#
+# Copyright (C) 2011
+# Stefan Herbrechtsmeier <stefan@code.herbrechtsmeier.net>
+#
+# Based on Kirkwood support:
+# (C) Copyright 2009
+# Marvell Semiconductor <www.marvell.com>
+# Written-by: Prafulla Wadaskar <prafulla@marvell.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., 51 Franklin Street, Fifth Floor, Boston,
+# MA 02110-1301 USA
+#
+
+include $(TOPDIR)/config.mk
+
+LIB    = $(obj)lib$(BOARD).o
+
+COBJS  := dns325.o
+
+SRCS   := $(SOBJS:.o=.S) $(COBJS:.o=.c)
+OBJS   := $(addprefix $(obj),$(COBJS))
+SOBJS  := $(addprefix $(obj),$(SOBJS))
+
+$(LIB):        $(obj).depend $(OBJS) $(SOBJS)
+       $(call cmd_link_o_target, $(OBJS) $(SOBJS))
+
+#########################################################################
+
+# defines $(obj).depend target
+include $(SRCTREE)/rules.mk
+
+sinclude $(obj).depend
+
+#########################################################################
diff --git a/board/d-link/dns325/dns325.c b/board/d-link/dns325/dns325.c
new file mode 100644 (file)
index 0000000..990d79f
--- /dev/null
@@ -0,0 +1,148 @@
+/*
+ * Copyright (C) 2011
+ * Stefan Herbrechtsmeier <stefan@code.herbrechtsmeier.net>
+ *
+ * Based on Kirkwood support:
+ * (C) Copyright 2009
+ * Marvell Semiconductor <www.marvell.com>
+ * Written-by: Prafulla Wadaskar <prafulla@marvell.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., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301 USA
+ */
+
+#include <common.h>
+#include <miiphy.h>
+#include <netdev.h>
+#include <asm/arch/cpu.h>
+#include <asm/arch/kirkwood.h>
+#include <asm/arch/mpp.h>
+#include <asm/arch/gpio.h>
+#include "dns325.h"
+
+DECLARE_GLOBAL_DATA_PTR;
+
+int board_early_init_f(void)
+{
+       /* Gpio configuration */
+       kw_config_gpio(DNS325_OE_VAL_LOW, DNS325_OE_VAL_HIGH,
+                       DNS325_OE_LOW, DNS325_OE_HIGH);
+
+       /* Multi-Purpose Pins Functionality configuration */
+       u32 kwmpp_config[] = {
+               MPP0_NF_IO2,
+               MPP1_NF_IO3,
+               MPP2_NF_IO4,
+               MPP3_NF_IO5,
+               MPP4_NF_IO6,
+               MPP5_NF_IO7,
+               MPP6_SYSRST_OUTn,
+               MPP7_GPO,
+               MPP8_TW_SDA,
+               MPP9_TW_SCK,
+               MPP10_UART0_TXD,
+               MPP11_UART0_RXD,
+               MPP12_SD_CLK,
+               MPP13_SD_CMD,
+               MPP14_SD_D0,
+               MPP15_SD_D1,
+               MPP16_SD_D2,
+               MPP17_SD_D3,
+               MPP18_NF_IO0,
+               MPP19_NF_IO1,
+               MPP20_SATA1_ACTn,       /* sata1(left) status led */
+               MPP21_SATA0_ACTn,       /* sata0(right) status led */
+               MPP22_GPIO,
+               MPP23_GPIO,
+               MPP24_GPIO,             /* power off out */
+               MPP25_GPIO,
+               MPP26_GPIO,             /* power led */
+               MPP27_GPIO,             /* sata0(right) error led */
+               MPP28_GPIO,             /* sata1(left) error led */
+               MPP29_GPIO,             /* usb error led */
+               MPP30_GPIO,
+               MPP31_GPIO,
+               MPP32_GPIO,
+               MPP33_GPIO,
+               MPP34_GPIO,             /* power key */
+               MPP35_GPIO,
+               MPP36_GPIO,
+               MPP37_GPIO,
+               MPP38_GPIO,
+               MPP39_GPIO,             /* enable sata 0 */
+               MPP40_GPIO,             /* enable sata 1 */
+               MPP41_GPIO,             /* hdd0 present */
+               MPP42_GPIO,             /* hdd1 present */
+               MPP43_GPIO,             /* usb status led */
+               MPP44_GPIO,             /* fan status */
+               MPP45_GPIO,             /* fan high speed */
+               MPP46_GPIO,             /* fan low speed */
+               MPP47_GPIO,             /* usb umount */
+               MPP48_GPIO,             /* factory reset */
+               MPP49_GPIO,             /* thermal sensor */
+               0
+       };
+       kirkwood_mpp_conf(kwmpp_config);
+
+       kw_gpio_set_blink(DNS325_GPIO_LED_POWER , 1);
+
+       kw_gpio_set_value(DNS325_GPIO_SATA0_EN , 1);
+       return 0;
+}
+
+int board_init(void)
+{
+       /* Boot parameters address */
+       gd->bd->bi_boot_params = kw_sdram_bar(0) + 0x100;
+
+       return 0;
+}
+
+#ifdef CONFIG_RESET_PHY_R
+/* Configure and initialize PHY */
+void reset_phy(void)
+{
+       u16 reg;
+       u16 devadr;
+       char *name = "egiga0";
+
+       if (miiphy_set_current_dev(name))
+               return;
+
+       /* command to read PHY dev address */
+       if (miiphy_read(name, 0xEE, 0xEE, (u16 *) &devadr)) {
+               printf("Err..(%s) could not read PHY dev address\n", __func__);
+               return;
+       }
+
+       /*
+        * Enable RGMII delay on Tx and Rx for CPU port
+        * Ref: sec 4.7.2 of chip datasheet
+        */
+       miiphy_write(name, devadr, MV88E1116_PGADR_REG, 2);
+       miiphy_read(name, devadr, MV88E1116_MAC_CTRL_REG, &reg);
+       reg |= (MV88E1116_RGMII_RXTM_CTRL | MV88E1116_RGMII_TXTM_CTRL);
+       miiphy_write(name, devadr, MV88E1116_MAC_CTRL_REG, reg);
+       miiphy_write(name, devadr, MV88E1116_PGADR_REG, 0);
+
+       /* reset the phy */
+       miiphy_reset(name, devadr);
+
+       debug("88E1116 Initialized on %s\n", name);
+}
+#endif /* CONFIG_RESET_PHY_R */
diff --git a/board/d-link/dns325/dns325.h b/board/d-link/dns325/dns325.h
new file mode 100644 (file)
index 0000000..7859cea
--- /dev/null
@@ -0,0 +1,48 @@
+/*
+ * Copyright (C) 2011
+ * Stefan Herbrechtsmeier <stefan@code.herbrechtsmeier.net>
+ *
+ * Based on Kirkwood support:
+ * (C) Copyright 2009
+ * Marvell Semiconductor <www.marvell.com>
+ * Written-by: Prafulla Wadaskar <prafulla@marvell.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., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301 USA
+ */
+
+#ifndef __DNS325_H
+#define __DNS325_H
+
+/* GPIO configuration */
+#define DNS325_OE_LOW                  0x00000000
+#define DNS325_OE_HIGH                 0x00039604
+#define DNS325_OE_VAL_LOW              0x38000000      /* disable leds */
+#define DNS325_OE_VAL_HIGH             0x00000800      /* disable leds */
+
+#define DNS325_GPIO_LED_POWER          26
+#define DNS325_GPIO_SATA0_EN           39
+#define DNS325_GPIO_SATA1_EN           40
+
+/* PHY related */
+#define MV88E1116_MAC_CTRL_REG         21
+#define MV88E1116_PGADR_REG            22
+#define MV88E1116_RGMII_TXTM_CTRL      (1 << 4)
+#define MV88E1116_RGMII_RXTM_CTRL      (1 << 5)
+
+#endif /* __DNS325_H */
diff --git a/board/d-link/dns325/kwbimage.cfg b/board/d-link/dns325/kwbimage.cfg
new file mode 100644 (file)
index 0000000..97cb090
--- /dev/null
@@ -0,0 +1,208 @@
+#
+# Copyright (C) 2011
+# Stefan Herbrechtsmeier <stefan@code.herbrechtsmeier.net>
+#
+# Based on Kirkwood support:
+# (C) Copyright 2009
+# Marvell Semiconductor <www.marvell.com>
+# Written-by: Prafulla Wadaskar <prafulla@marvell.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., 51 Franklin Street, Fifth Floor, Boston,
+# MA 02110-1301 USA
+#
+# Refer docs/README.kwimage for more details about how-to configure
+# and create kirkwood boot image
+#
+
+# Boot Media configurations
+BOOT_FROM      nand
+NAND_ECC_MODE  default
+NAND_PAGE_SIZE 0x0800
+
+# SOC registers configuration using bootrom header extension
+# Maximum KWBIMAGE_MAX_CONFIG configurations allowed
+
+# Configure RGMII-0 interface pad voltage to 1.8V
+DATA 0xFFD100e0 0x1b1b1b9b
+
+#Dram initalization for SINGLE x16 CL=5 @ 400MHz
+DATA 0xFFD01400 0x43000c30     # DDR Configuration register
+# bit13-0:  0xc30, 3120 DDR2 clks refresh rate
+# bit23-14: 0 required
+# bit24:    1, enable exit self refresh mode on DDR access
+# bit25:    1 required
+# bit29-26: 0 required
+# bit31-30: 0b01 required
+
+DATA 0xFFD01404 0x39543000     # DDR Controller Control Low
+# bit3-0:   0 required
+# bit4:     0, addr/cmd in smame cycle
+# bit5:     0, clk is driven during self refresh, we don't care for APX
+# bit6:     0, use recommended falling edge of clk for addr/cmd
+# bit11-7:  0 required
+# bit12:    1 required
+# bit13:    1 required
+# bit14:    0, input buffer always powered up
+# bit17-15: 0 required
+# bit18:    1, cpu lock transaction enabled
+# bit19:    0 required
+# bit23-20: 5, recommended value for CL=5 and STARTBURST_DEL disabled bit31=0
+# bit27-24: 9, CL+4, STARTBURST sample stages, for freqs 400MHz, unbuffered DIMM
+# bit30-28: 3 required
+# bit31:    0, no additional STARTBURST delay
+
+DATA 0xFFD01408 0x22125451     # DDR Timing (Low)
+# bit3-0:   1, 18 cycle tRAS (tRAS[3-0])
+# bit7-4:   5, 6 cycle tRCD
+# bit11-8:  4, 5 cyle tRP
+# bit15-12: 5, 6 cyle tWR
+# bit19-16: 2, 3 cyle tWTR
+# bit20:    1, 18 cycle tRAS (tRAS[4])
+# bit23-21: 0 required
+# bit27-24: 2, 3 cycle tRRD
+# bit31-28: 2, 3 cyle tRTP
+
+DATA 0xFFD0140C 0x00000833     #  DDR Timing (High)
+# bit6-0:   0x33, 33 cycle tRFC
+# bit8-7:   0, 1 cycle tR2R
+# bit10-9:  0, 1 cyle tR2W
+# bit12-11: 1, 2 cylce tW2W
+# bit31-13: 0 required
+
+DATA 0xFFD01410 0x0000000c     #  DDR Address Control
+# bit1-0:   0, Cs0width=x8
+# bit3-2:   3, Cs0size=1Gb
+# bit5-4:   0, Cs1width=nonexistent
+# bit7-6:   0, Cs1size=nonexistent
+# bit9-8:   0, Cs2width=nonexistent
+# bit11-10: 0, Cs2size=nonexistent
+# bit13-12: 0, Cs3width=nonexistent
+# bit15-14: 0, Cs3size=nonexistent
+# bit16:    0, Cs0AddrSel
+# bit17:    0, Cs1AddrSel
+# bit18:    0, Cs2AddrSel
+# bit19:    0, Cs3AddrSel
+# bit31-20: 0 required
+
+DATA 0xFFD01414 0x00000000     #  DDR Open Pages Control
+# bit0:    0, OPEn=OpenPage enabled
+# bit31-1: 0 required
+
+DATA 0xFFD01418 0x00000000     #  DDR Operation
+# bit3-0:   0, Cmd=Normal SDRAM Mode
+# bit31-4:  0 required
+
+DATA 0xFFD0141C 0x00000C52     #  DDR Mode
+# bit2-0:   2, Burst Length (2 required)
+# bit3:     0, Burst Type (0 required)
+# bit6-4:   5, CAS Latency (CL) 5
+# bit7:     0, (Test Mode) Normal operation
+# bit8:     0, (Reset DLL) Normal operation
+# bit11-9:  0, Write recovery for auto-precharge (3 required ??)
+# bit12:    0, Fast Active power down exit time (0 required)
+# bit31-13: 0 required
+
+DATA 0xFFD01420 0x00000040     #  DDR Extended Mode
+# bit0:     0, DRAM DLL enabled
+# bit1:     0, DRAM drive strength normal
+# bit2:     0, ODT control Rtt[0] (Rtt=2, 150 ohm termination)
+# bit5-3:   0 required
+# bit6:     1, ODT control Rtt[1] (Rtt=2, 150 ohm termination)
+# bit9-7:   0 required
+# bit10:    0, differential DQS enabled
+# bit11:    0 required
+# bit12:    0, DRAM output buffer enabled
+# bit31-13: 0 required
+
+DATA 0xFFD01424 0x0000F17F     #  DDR Controller Control High
+# bit2-0:   0x7 required
+# bit3:     1, MBUS Burst Chop disabled
+# bit6-4:   0x7 required
+# bit7:     0 required
+# bit8:     1, add writepath sample stage, must be 1 for DDR freq >= 300MHz
+# bit9:     0, no half clock cycle addition to dataout
+# bit10:    0, 1/4 clock cycle skew enabled for addr/ctl signals
+# bit11:    0, 1/4 clock cycle skew disabled for write mesh
+# bit15-12: 0xf required
+# bit31-16: 0 required
+
+DATA 0xFFD01428 0x00085520     # DDR2 ODT Read Timing
+# bit3-0:   0 required
+# bit7-4:   2, 2 cycles from read command to assertion of M_ODT signal
+# bit11-8:  5, 5 cycles from read command to de-assertion of M_ODT signal
+# bit15-12: 5, 5 cycles from read command to assertion of internal ODT signal
+# bit19-16: 8, 8 cycles from read command to de-assertion of internal ODT signal
+# bit31-20: 0 required
+
+DATA 0xFFD0147C 0x00008552     # DDR2 ODT Write Timing
+# bit3-0:   2, 2 cycles from write comand to assertion of M_ODT signal
+# bit7-4:   5, 5 cycles from write command to de-assertion of M_ODT signal
+# bit15-12: 5, 5 cycles from write command to assertion of internal ODT signal
+# bit19-16: 8, 8 cycles from write command to de-assertion of internal ODT signal
+# bit31-16: 0 required
+
+DATA 0xFFD01500 0x00000000     # CS[0]n Base address to 0x0
+DATA 0xFFD01504 0x0FFFFFF1     # CS[0]n Size
+# bit0:     1, Window enabled
+# bit1:     0, Write Protect disabled
+# bit3-2:   0x0, CS0 hit selected
+# bit23-4:  0xfffff required
+# bit31-24: 0x0f, Size (i.e. 256MB)
+
+DATA 0xFFD01508 0x10000000     # CS[1]n Base address to 256Mb
+DATA 0xFFD0150C 0x0FFFFFF5     # CS[1]n Size 256Mb Window enabled for CS1
+# bit0:     1, Window enabled
+# bit1:     0, Write Protect disabled
+# bit3-2:   1, CS1 hit selected
+# bit23-4:  0xfffff required
+# bit31-24: 0x0f, Size (i.e. 256MB)
+
+DATA 0xFFD01514 0x00000000     # CS[2]n Size, window disabled
+DATA 0xFFD0151C 0x00000000     # CS[3]n Size, window disabled
+
+DATA 0xFFD01494 0x00030000     #  DDR ODT Control (Low)
+# bit3-0:   0b0000, (read) M_ODT[0] is not asserted during read from DRAM
+# bit7-4:   0b0000, (read) M_ODT[1] is not asserted during read from DRAM
+# bit15-8:  0 required
+# bit19-16: 0b0011, (write) M_ODT[0] is asserted during write to DRAM CS0 and CS1
+# bit23-20: 0b0000, (write) M_ODT[1] is not asserted during write to DRAM
+# bit31-24: 0 required
+
+DATA 0xFFD01498 0x00000000     #  DDR ODT Control (High)
+# bit1-0:   0, M_ODT[0] assertion is controlled by ODT Control Low register
+# bit3-2:   0, M_ODT[1] assertion is controlled by ODT Control Low register
+# bit31-4   0 required
+
+DATA 0xFFD0149C 0x0000E803     # CPU ODT Control
+# bit3-0:   0b0011, internal ODT is asserted during read from DRAM bank 0-1
+# bit7-4:   0b0000, internal ODT is not asserted during write to DRAM bank 0-4
+# bit9-8:   0, Internal ODT assertion is controlled by fiels
+# bit11-10: 2, M_DQ, M_DM, and M_DQS I/O buffer ODT 75 ohm
+# bit13-12: 2, M_STARTBURST_IN I/O buffer ODT 75 ohm
+# bit14:    1, M_STARTBURST_IN ODT enabled
+# bit15:    1, DDR IO ODT Unit: Drive ODT calibration values
+# bit20-16: 0, Pad N channel driving strength for ODT
+# bit25-21: 0, Pad P channel driving strength for ODT
+# bit31-26: 0 required
+
+DATA 0xFFD01480 0x00000001     # DDR Initialization Control
+# bit0:     1, enable DDR init upon this register write
+# bit31-1:  0, required
+
+# End of Header extension
+DATA 0x0 0x0
index 9bd3e7146c435e884ed7ce4ed4f26cd50cb3506f..34ef53df2bca699c375852d0504bbd5750ad0322 100644 (file)
@@ -137,7 +137,7 @@ const struct pinmux_resource pinmuxes[] = {
 
 const int pinmuxes_size = ARRAY_SIZE(pinmuxes);
 
-static const struct lpsc_resource lpsc[] = {
+const struct lpsc_resource lpsc[] = {
        { DAVINCI_LPSC_AEMIF }, /* NAND, NOR */
        { DAVINCI_LPSC_SPI1 },  /* Serial Flash */
        { DAVINCI_LPSC_EMAC },  /* image download */
@@ -145,6 +145,8 @@ static const struct lpsc_resource lpsc[] = {
        { DAVINCI_LPSC_GPIO },
 };
 
+const int lpsc_size = ARRAY_SIZE(lpsc);
+
 #ifndef CONFIG_DA850_EVM_MAX_CPU_CLK
 #define CONFIG_DA850_EVM_MAX_CPU_CLK   300000000
 #endif
index 9d4e238bfc9ae288dbc47c81e37c19ab8ba17897..b6942589f474a3925ef40f32e6031004ee06ea49 100644 (file)
 #include <asm/arch/hardware.h>
 #include <asm/io.h>
 #include <asm/arch/davinci_misc.h>
+#include <asm/arch/pinmux_defs.h>
 #include <ns16550.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
+const struct pinmux_resource pinmuxes[] = {
+       PINMUX_ITEM(emac_pins_mii),
+       PINMUX_ITEM(emac_pins_mdio),
+       PINMUX_ITEM(emifa_pins_cs3),
+       PINMUX_ITEM(emifa_pins_cs4),
+       PINMUX_ITEM(emifa_pins_nand),
+       PINMUX_ITEM(uart2_pins_txrx),
+       PINMUX_ITEM(uart2_pins_rtscts),
+};
+
+const int pinmuxes_size = ARRAY_SIZE(pinmuxes);
+
+const struct lpsc_resource lpsc[] = {
+       { DAVINCI_LPSC_AEMIF }, /* NAND, NOR */
+       { DAVINCI_LPSC_SPI1 },  /* Serial Flash */
+       { DAVINCI_LPSC_EMAC },  /* image download */
+       { DAVINCI_LPSC_UART2 }, /* console */
+       { DAVINCI_LPSC_GPIO },
+};
+
+const int lpsc_size = ARRAY_SIZE(lpsc);
+
 int board_init(void)
 {
        /* arch number of the board */
diff --git a/board/davinci/da8xxevm/hawkboard_nand_spl.c b/board/davinci/da8xxevm/hawkboard_nand_spl.c
deleted file mode 100644 (file)
index df97963..0000000
+++ /dev/null
@@ -1,115 +0,0 @@
-/*
- * Modified for Hawkboard - Syed Mohammed Khasim <khasim@beagleboard.org>
- *
- * Copyright (C) 2008 Sekhar Nori, Texas Instruments, Inc.  <nsekhar@ti.com>
- * Copyright (C) 2007 Sergey Kubushyn <ksi@koi8.net>
- * Copyright (C) 2004 Texas Instruments.
- *
- * ----------------------------------------------------------------------------
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- * ----------------------------------------------------------------------------
- */
-
-#include <common.h>
-#include <asm/errno.h>
-#include <asm/arch/hardware.h>
-#include <asm/io.h>
-#include <asm/arch/davinci_misc.h>
-#include <asm/arch/pinmux_defs.h>
-#include <ns16550.h>
-#include <nand.h>
-
-DECLARE_GLOBAL_DATA_PTR;
-
-static const struct pinmux_resource pinmuxes[] = {
-       PINMUX_ITEM(emac_pins_mii),
-       PINMUX_ITEM(emac_pins_mdio),
-       PINMUX_ITEM(emifa_pins_cs3),
-       PINMUX_ITEM(emifa_pins_cs4),
-       PINMUX_ITEM(emifa_pins_nand),
-       PINMUX_ITEM(uart2_pins_txrx),
-       PINMUX_ITEM(uart2_pins_rtscts),
-};
-
-static const struct lpsc_resource lpsc[] = {
-       { DAVINCI_LPSC_AEMIF }, /* NAND, NOR */
-       { DAVINCI_LPSC_SPI1 },  /* Serial Flash */
-       { DAVINCI_LPSC_EMAC },  /* image download */
-       { DAVINCI_LPSC_UART2 }, /* console */
-       { DAVINCI_LPSC_GPIO },
-};
-
-void board_init_f(ulong bootflag)
-{
-       /*
-        * Kick Registers need to be set to allow access to Pin Mux registers
-        */
-       writel(DV_SYSCFG_KICK0_UNLOCK, &davinci_syscfg_regs->kick0);
-       writel(DV_SYSCFG_KICK1_UNLOCK, &davinci_syscfg_regs->kick1);
-
-       /* setup the SUSPSRC for ARM to control emulation suspend */
-       writel(readl(&davinci_syscfg_regs->suspsrc) &
-              ~(DAVINCI_SYSCFG_SUSPSRC_EMAC | DAVINCI_SYSCFG_SUSPSRC_I2C |
-                DAVINCI_SYSCFG_SUSPSRC_SPI1 | DAVINCI_SYSCFG_SUSPSRC_TIMER0 |
-                DAVINCI_SYSCFG_SUSPSRC_UART2), &davinci_syscfg_regs->suspsrc);
-
-       /* Power on required peripherals
-        * ARM does not have acess by default to PSC0 and PSC1
-        * assuming here that the DSP bootloader has set the IOPU
-        * such that PSC access is available to ARM
-        */
-       da8xx_configure_lpsc_items(lpsc, ARRAY_SIZE(lpsc));
-
-       /* configure pinmux settings */
-       davinci_configure_pin_mux_items(pinmuxes,
-                                       ARRAY_SIZE(pinmuxes));
-
-       writel(readl(&davinci_uart2_ctrl_regs->pwremu_mgmt) |
-              (DAVINCI_UART_PWREMU_MGMT_FREE) |
-              (DAVINCI_UART_PWREMU_MGMT_URRST) |
-              (DAVINCI_UART_PWREMU_MGMT_UTRST),
-              &davinci_uart2_ctrl_regs->pwremu_mgmt);
-
-       NS16550_init((NS16550_t)(DAVINCI_UART2_BASE),
-                       CONFIG_SYS_NS16550_CLK / 16 / CONFIG_BAUDRATE);
-
-       puts("Nand boot...\n");
-
-       nand_boot();
-}
-
-void puts(const char *str)
-{
-       while (*str)
-               putc(*str++);
-}
-
-void putc(char c)
-{
-       if (gd->flags & GD_FLG_SILENT)
-               return;
-
-       if (c == '\n')
-               NS16550_putc((NS16550_t)(DAVINCI_UART2_BASE), '\r');
-
-       NS16550_putc((NS16550_t)(DAVINCI_UART2_BASE), c);
-}
-
-void hang(void)
-{
-       puts("### ERROR ### Please RESET the board ###\n");
-       for (;;)
-               ;
-}
diff --git a/board/davinci/da8xxevm/u-boot-spl-da850evm.lds b/board/davinci/da8xxevm/u-boot-spl-da850evm.lds
new file mode 100644 (file)
index 0000000..6f6e065
--- /dev/null
@@ -0,0 +1,73 @@
+/*
+ * (C) Copyright 2002
+ * Gary Jennejohn, DENX Software Engineering, <garyj@denx.de>
+ *
+ * (C) Copyright 2008
+ * Guennadi Liakhovetki, DENX Software Engineering, <lg@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
+ */
+
+MEMORY { .sram : ORIGIN = CONFIG_SPL_TEXT_BASE,\
+               LENGTH = CONFIG_SPL_MAX_SIZE }
+
+OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm")
+OUTPUT_ARCH(arm)
+ENTRY(_start)
+SECTIONS
+{
+       . = 0x00000000;
+
+       . = ALIGN(4);
+       .text      :
+       {
+       __start = .;
+         arch/arm/cpu/arm926ejs/start.o        (.text)
+         *(.text*)
+       } >.sram
+
+       . = ALIGN(4);
+       .rodata : { *(SORT_BY_ALIGNMENT(.rodata*)) } >.sram
+
+       . = ALIGN(4);
+       .data : { *(SORT_BY_ALIGNMENT(.data*)) } >.sram
+       . = ALIGN(4);
+       .rel.dyn : {
+               __rel_dyn_start = .;
+               *(.rel*)
+               __rel_dyn_end = .;
+       } >.sram
+
+       .dynsym : {
+               __dynsym_start = .;
+               *(.dynsym)
+       } >.sram
+
+       .bss :
+       {
+               . = ALIGN(4);
+               __bss_start = .;
+               *(.bss*)
+               . = ALIGN(4);
+               __bss_end__ = .;
+       } >.sram
+
+       __image_copy_end = .;
+       _end = .;
+}
diff --git a/board/davinci/da8xxevm/u-boot-spl-hawk.lds b/board/davinci/da8xxevm/u-boot-spl-hawk.lds
new file mode 100644 (file)
index 0000000..b3a41af
--- /dev/null
@@ -0,0 +1,81 @@
+/*
+ * (C) Copyright 2002
+ * Gary Jennejohn, DENX Software Engineering, <garyj@denx.de>
+ *
+ * (C) Copyright 2008
+ * Guennadi Liakhovetki, DENX Software Engineering, <lg@denx.de>
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm")
+OUTPUT_ARCH(arm)
+ENTRY(_start)
+SECTIONS
+{
+       . = 0xc1080000;
+
+       . = ALIGN(4);
+       .text      :
+       {
+         arch/arm/cpu/arm926ejs/start.o                (.text)
+         arch/arm/cpu/arm926ejs/davinci/libdavinci.o   (.text)
+         drivers/mtd/nand/libnand.o                    (.text)
+
+         *(.text*)
+       }
+
+       . = ALIGN(4);
+       .rodata : { *(.rodata) }
+
+       . = ALIGN(4);
+       .data : {
+               *(.data)
+       __datarel_start = .;
+               *(.data.rel)
+       __datarelrolocal_start = .;
+               *(.data.rel.ro.local)
+       __datarellocal_start = .;
+               *(.data.rel.local)
+       __datarelro_start = .;
+               *(.data.rel.ro)
+       }
+
+       . = ALIGN(4);
+       __rel_dyn_start = .;
+       __rel_dyn_end = .;
+       __dynsym_start = .;
+
+       __got_start = .;
+       . = ALIGN(4);
+       .got : { *(.got) }
+
+       __got_end = .;
+
+       .bss :
+       {
+               . = ALIGN(4);
+               __bss_start = .;
+               *(.bss*)
+               . = ALIGN(4);
+               __bss_end__ = .;
+       }
+
+       _end = .;
+}
diff --git a/board/davinci/da8xxevm/u-boot-spl.lds b/board/davinci/da8xxevm/u-boot-spl.lds
deleted file mode 100644 (file)
index 6f6e065..0000000
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * (C) Copyright 2002
- * Gary Jennejohn, DENX Software Engineering, <garyj@denx.de>
- *
- * (C) Copyright 2008
- * Guennadi Liakhovetki, DENX Software Engineering, <lg@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
- */
-
-MEMORY { .sram : ORIGIN = CONFIG_SPL_TEXT_BASE,\
-               LENGTH = CONFIG_SPL_MAX_SIZE }
-
-OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm")
-OUTPUT_ARCH(arm)
-ENTRY(_start)
-SECTIONS
-{
-       . = 0x00000000;
-
-       . = ALIGN(4);
-       .text      :
-       {
-       __start = .;
-         arch/arm/cpu/arm926ejs/start.o        (.text)
-         *(.text*)
-       } >.sram
-
-       . = ALIGN(4);
-       .rodata : { *(SORT_BY_ALIGNMENT(.rodata*)) } >.sram
-
-       . = ALIGN(4);
-       .data : { *(SORT_BY_ALIGNMENT(.data*)) } >.sram
-       . = ALIGN(4);
-       .rel.dyn : {
-               __rel_dyn_start = .;
-               *(.rel*)
-               __rel_dyn_end = .;
-       } >.sram
-
-       .dynsym : {
-               __dynsym_start = .;
-               *(.dynsym)
-       } >.sram
-
-       .bss :
-       {
-               . = ALIGN(4);
-               __bss_start = .;
-               *(.bss*)
-               . = ALIGN(4);
-               __bss_end__ = .;
-       } >.sram
-
-       __image_copy_end = .;
-       _end = .;
-}
index 840bd9aaa38b372f7b6003c7a4d12d7d5977fe25..ac2d2e966f41d40d7cba4eec67943f63510d76e4 100644 (file)
@@ -120,6 +120,7 @@ static void efika_ehci_init(struct usb_ehci *ehci, uint32_t stp_gpio,
 {
        int ret;
        struct ulpi_regs *ulpi = (struct ulpi_regs *)0;
+       struct ulpi_viewport ulpi_vp;
 
        mxc_request_iomux(stp_gpio, alt0);
        mxc_iomux_set_pad(stp_gpio, PAD_CTL_DRV_HIGH |
@@ -133,23 +134,26 @@ static void efika_ehci_init(struct usb_ehci *ehci, uint32_t stp_gpio,
        mxc_iomux_set_pad(stp_gpio, USB_PAD_CONFIG);
        udelay(10000);
 
-       ret = ulpi_init((u32)&ehci->ulpi_viewpoint);
+       ulpi_vp.viewport_addr = (u32)&ehci->ulpi_viewpoint;
+       ulpi_vp.port_num = 0;
+
+       ret = ulpi_init(&ulpi_vp);
        if (ret) {
                printf("Efika USB ULPI initialization failed\n");
                return;
        }
 
        /* ULPI set flags */
-       ulpi_write((u32)&ehci->ulpi_viewpoint, &ulpi->otg_ctrl,
+       ulpi_write(&ulpi_vp, &ulpi->otg_ctrl,
                        ULPI_OTG_DP_PULLDOWN | ULPI_OTG_DM_PULLDOWN |
                        ULPI_OTG_EXTVBUSIND);
-       ulpi_write((u32)&ehci->ulpi_viewpoint, &ulpi->function_ctrl,
+       ulpi_write(&ulpi_vp, &ulpi->function_ctrl,
                        ULPI_FC_FULL_SPEED | ULPI_FC_OPMODE_NORMAL |
                        ULPI_FC_SUSPENDM);
-       ulpi_write((u32)&ehci->ulpi_viewpoint, &ulpi->iface_ctrl, 0);
+       ulpi_write(&ulpi_vp, &ulpi->iface_ctrl, 0);
 
        /* Set VBus */
-       ulpi_write((u32)&ehci->ulpi_viewpoint, &ulpi->otg_ctrl_set,
+       ulpi_write(&ulpi_vp, &ulpi->otg_ctrl_set,
                        ULPI_OTG_DRVVBUS | ULPI_OTG_DRVVBUS_EXT);
 
        /*
@@ -158,8 +162,7 @@ static void efika_ehci_init(struct usb_ehci *ehci, uint32_t stp_gpio,
         * NOTE: This violates USB specification, but otherwise, USB on Efika
         * doesn't work.
         */
-       ulpi_write((u32)&ehci->ulpi_viewpoint, &ulpi->otg_ctrl_set,
-                       ULPI_OTG_CHRGVBUS);
+       ulpi_write(&ulpi_vp, &ulpi->otg_ctrl_set, ULPI_OTG_CHRGVBUS);
 }
 
 int board_ehci_hcd_init(int port)
@@ -177,9 +180,12 @@ void ehci_powerup_fixup(uint32_t *status_reg, uint32_t *reg)
        uint32_t port = OTG_BASE_ADDR + (0x200 * CONFIG_MXC_USB_PORT);
        struct usb_ehci *ehci = (struct usb_ehci *)port;
        struct ulpi_regs *ulpi = (struct ulpi_regs *)0;
+       struct ulpi_viewport ulpi_vp;
+
+       ulpi_vp.viewport_addr = (u32)&ehci->ulpi_viewpoint;
+       ulpi_vp.port_num = 0;
 
-       ulpi_write((u32)&ehci->ulpi_viewpoint, &ulpi->otg_ctrl_set,
-                       ULPI_OTG_CHRGVBUS);
+       ulpi_write(&ulpi_vp, &ulpi->otg_ctrl_set, ULPI_OTG_CHRGVBUS);
 
        wait_ms(50);
 
index 98dda1eada77d70f5131aaec7e16e085774079a9..16d1b08675a2da662b581325d371ed31ce493398 100644 (file)
@@ -49,7 +49,7 @@
 
 DECLARE_GLOBAL_DATA_PTR;
 
-static const struct lpsc_resource lpsc[] = {
+const struct lpsc_resource lpsc[] = {
        { DAVINCI_LPSC_AEMIF },
        { DAVINCI_LPSC_SPI1 },
        { DAVINCI_LPSC_ARM_RAM_ROM },
@@ -65,6 +65,8 @@ static const struct lpsc_resource lpsc[] = {
        { DAVINCI_LPSC_USB11 },
 };
 
+const int lpsc_size = ARRAY_SIZE(lpsc);
+
 static const struct pinmux_config enbw_pins[] = {
        { pinmux(0), 8, 0 },
        { pinmux(0), 8, 1 },
@@ -548,15 +550,6 @@ void board_gpio_init(void)
 {
        struct davinci_gpio *gpio = davinci_gpio_bank01;
 
-       /*
-        * Power on required peripherals
-        * ARM does not have access by default to PSC0 and PSC1
-        * assuming here that the DSP bootloader has set the IOPU
-        * such that PSC access is available to ARM
-        */
-       if (da8xx_configure_lpsc_items(lpsc, ARRAY_SIZE(lpsc)))
-               return;
-
        /*
         * set LED (gpio Interface not usable here)
         * set LED pins to output and state 0
index 9077aaf106cd4c8c59b96443b6dc5635636f7bb6..0b40dc7bf72d008f86ba89e7790d11f269e048b4 100644 (file)
@@ -39,7 +39,7 @@ COBJS-$(CONFIG_PQ_MDS_PIB)    += pq-mds-pib.o
 COBJS-$(CONFIG_ID_EEPROM)      += sys_eeprom.o
 COBJS-$(CONFIG_FSL_SGMII_RISER)        += sgmii_riser.o
 ifndef CONFIG_RAMBOOT_PBL
-COBJS-$(CONFIG_ENV_IS_IN_MMC)  += sdhc_boot.o
+COBJS-$(CONFIG_FSL_FIXED_MMC_LOCATION) += sdhc_boot.o
 endif
 
 COBJS-$(CONFIG_MPC8541CDS)     += cds_pci_ft.o
index 98942454a0671846d3d69c58fab0bd5edd32ac9c..1367b8802850156b226a6ec520f4826d1f07a4d1 100644 (file)
@@ -120,17 +120,18 @@ struct fsl_esdhc_cfg usdhc_cfg[2] = {
        {USDHC4_BASE_ADDR, 1},
 };
 
-int board_mmc_getcd(u8 *cd, struct mmc *mmc)
+int board_mmc_getcd(struct mmc *mmc)
 {
        struct fsl_esdhc_cfg *cfg = (struct fsl_esdhc_cfg *)mmc->priv;
+       int ret;
 
        if (cfg->esdhc_base == USDHC3_BASE_ADDR) {
                gpio_direction_input(171); /*GPIO6_11*/
-               *cd = gpio_get_value(171);
+               ret = !gpio_get_value(171);
        } else /* Don't have the CD GPIO pin on board */
-               *cd = 0;
+               ret = 1;
 
-       return 0;
+       return ret;
 }
 
 int board_mmc_init(bd_t *bis)
index 4028789f4e1fd02676d4a1fc64832a04288cb215..a53b01f35c63156f6e73100751c24f4116fe74ec 100644 (file)
@@ -29,6 +29,8 @@
 #include <asm/gpio.h>
 #include <mmc.h>
 #include <fsl_esdhc.h>
+#include <miiphy.h>
+#include <netdev.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -40,6 +42,10 @@ DECLARE_GLOBAL_DATA_PTR;
        PAD_CTL_PUS_47K_UP  | PAD_CTL_SPEED_LOW |               \
        PAD_CTL_DSE_80ohm   | PAD_CTL_SRE_FAST  | PAD_CTL_HYS)
 
+#define ENET_PAD_CTRL  (PAD_CTL_PKE | PAD_CTL_PUE |            \
+       PAD_CTL_PUS_100K_UP | PAD_CTL_SPEED_MED   |             \
+       PAD_CTL_DSE_40ohm   | PAD_CTL_HYS)
+
 int dram_init(void)
 {
        gd->ram_size = get_ram_size((void *)PHYS_SDRAM, PHYS_SDRAM_SIZE);
@@ -47,6 +53,11 @@ int dram_init(void)
        return 0;
 }
 
+iomux_v3_cfg_t uart1_pads[] = {
+       MX6Q_PAD_SD3_DAT6__UART1_RXD | MUX_PAD_CTRL(UART_PAD_CTRL),
+       MX6Q_PAD_SD3_DAT7__UART1_TXD | MUX_PAD_CTRL(UART_PAD_CTRL),
+};
+
 iomux_v3_cfg_t uart2_pads[] = {
        MX6Q_PAD_EIM_D26__UART2_TXD | MUX_PAD_CTRL(UART_PAD_CTRL),
        MX6Q_PAD_EIM_D27__UART2_RXD | MUX_PAD_CTRL(UART_PAD_CTRL),
@@ -72,8 +83,62 @@ iomux_v3_cfg_t usdhc4_pads[] = {
        MX6Q_PAD_NANDF_D6__GPIO_2_6    | MUX_PAD_CTRL(NO_PAD_CTRL), /* CD */
 };
 
+iomux_v3_cfg_t enet_pads1[] = {
+       MX6Q_PAD_ENET_MDIO__ENET_MDIO           | MUX_PAD_CTRL(ENET_PAD_CTRL),
+       MX6Q_PAD_ENET_MDC__ENET_MDC             | MUX_PAD_CTRL(ENET_PAD_CTRL),
+       MX6Q_PAD_RGMII_TXC__ENET_RGMII_TXC      | MUX_PAD_CTRL(ENET_PAD_CTRL),
+       MX6Q_PAD_RGMII_TD0__ENET_RGMII_TD0      | MUX_PAD_CTRL(ENET_PAD_CTRL),
+       MX6Q_PAD_RGMII_TD1__ENET_RGMII_TD1      | MUX_PAD_CTRL(ENET_PAD_CTRL),
+       MX6Q_PAD_RGMII_TD2__ENET_RGMII_TD2      | MUX_PAD_CTRL(ENET_PAD_CTRL),
+       MX6Q_PAD_RGMII_TD3__ENET_RGMII_TD3      | MUX_PAD_CTRL(ENET_PAD_CTRL),
+       MX6Q_PAD_RGMII_TX_CTL__RGMII_TX_CTL     | MUX_PAD_CTRL(ENET_PAD_CTRL),
+       MX6Q_PAD_ENET_REF_CLK__ENET_TX_CLK      | MUX_PAD_CTRL(ENET_PAD_CTRL),
+       /* pin 35 - 1 (PHY_AD2) on reset */
+       MX6Q_PAD_RGMII_RXC__GPIO_6_30           | MUX_PAD_CTRL(NO_PAD_CTRL),
+       /* pin 32 - 1 - (MODE0) all */
+       MX6Q_PAD_RGMII_RD0__GPIO_6_25           | MUX_PAD_CTRL(NO_PAD_CTRL),
+       /* pin 31 - 1 - (MODE1) all */
+       MX6Q_PAD_RGMII_RD1__GPIO_6_27           | MUX_PAD_CTRL(NO_PAD_CTRL),
+       /* pin 28 - 1 - (MODE2) all */
+       MX6Q_PAD_RGMII_RD2__GPIO_6_28           | MUX_PAD_CTRL(NO_PAD_CTRL),
+       /* pin 27 - 1 - (MODE3) all */
+       MX6Q_PAD_RGMII_RD3__GPIO_6_29           | MUX_PAD_CTRL(NO_PAD_CTRL),
+       /* pin 33 - 1 - (CLK125_EN) 125Mhz clockout enabled */
+       MX6Q_PAD_RGMII_RX_CTL__GPIO_6_24        | MUX_PAD_CTRL(NO_PAD_CTRL),
+       /* pin 42 PHY nRST */
+       MX6Q_PAD_EIM_D23__GPIO_3_23             | MUX_PAD_CTRL(NO_PAD_CTRL),
+};
+
+iomux_v3_cfg_t enet_pads2[] = {
+       MX6Q_PAD_RGMII_RXC__ENET_RGMII_RXC      | MUX_PAD_CTRL(ENET_PAD_CTRL),
+       MX6Q_PAD_RGMII_RD0__ENET_RGMII_RD0      | MUX_PAD_CTRL(ENET_PAD_CTRL),
+       MX6Q_PAD_RGMII_RD1__ENET_RGMII_RD1      | MUX_PAD_CTRL(ENET_PAD_CTRL),
+       MX6Q_PAD_RGMII_RD2__ENET_RGMII_RD2      | MUX_PAD_CTRL(ENET_PAD_CTRL),
+       MX6Q_PAD_RGMII_RD3__ENET_RGMII_RD3      | MUX_PAD_CTRL(ENET_PAD_CTRL),
+       MX6Q_PAD_RGMII_RX_CTL__RGMII_RX_CTL     | MUX_PAD_CTRL(ENET_PAD_CTRL),
+};
+
+static void setup_iomux_enet(void)
+{
+       gpio_direction_output(87, 0);  /* GPIO 3-23 */
+       gpio_direction_output(190, 1); /* GPIO 6-30 */
+       gpio_direction_output(185, 1); /* GPIO 6-25 */
+       gpio_direction_output(187, 1); /* GPIO 6-27 */
+       gpio_direction_output(188, 1); /* GPIO 6-28*/
+       gpio_direction_output(189, 1); /* GPIO 6-29 */
+       imx_iomux_v3_setup_multiple_pads(enet_pads1, ARRAY_SIZE(enet_pads1));
+       gpio_direction_output(184, 1); /* GPIO 6-24 */
+
+       /* Need delay 10ms according to KSZ9021 spec */
+       udelay(1000 * 10);
+       gpio_direction_output(87, 1);  /* GPIO 3-23 */
+
+       imx_iomux_v3_setup_multiple_pads(enet_pads2, ARRAY_SIZE(enet_pads2));
+}
+
 static void setup_iomux_uart(void)
 {
+       imx_iomux_v3_setup_multiple_pads(uart1_pads, ARRAY_SIZE(uart1_pads));
        imx_iomux_v3_setup_multiple_pads(uart2_pads, ARRAY_SIZE(uart2_pads));
 }
 
@@ -128,6 +193,55 @@ int board_mmc_init(bd_t *bis)
 }
 #endif
 
+#define MII_1000BASET_CTRL             0x9
+#define MII_EXTENDED_CTRL              0xb
+#define MII_EXTENDED_DATAW             0xc
+
+int fecmxc_mii_postcall(int phy)
+{
+       /* prefer master mode */
+       miiphy_write("FEC", phy, MII_1000BASET_CTRL, 0x0f00);
+
+       /* min rx data delay */
+       miiphy_write("FEC", phy, MII_EXTENDED_CTRL, 0x8105);
+       miiphy_write("FEC", phy, MII_EXTENDED_DATAW, 0x0000);
+
+       /* max rx/tx clock delay, min rx/tx control delay */
+       miiphy_write("FEC", phy, MII_EXTENDED_CTRL, 0x8104);
+       miiphy_write("FEC", phy, MII_EXTENDED_DATAW, 0xf0f0);
+       miiphy_write("FEC", phy, MII_EXTENDED_CTRL, 0x104);
+
+       return 0;
+}
+
+int board_eth_init(bd_t *bis)
+{
+       struct eth_device *dev;
+       int ret;
+
+       setup_iomux_enet();
+
+       ret = cpu_eth_init(bis);
+       if (ret) {
+               printf("FEC MXC: %s:failed\n", __func__);
+               return ret;
+       }
+
+       dev = eth_get_dev_by_name("FEC");
+       if (!dev) {
+               printf("FEC MXC: Unable to get FEC device entry\n");
+               return -EINVAL;
+       }
+
+       ret = fecmxc_register_mii_postcall(dev, fecmxc_mii_postcall);
+       if (ret) {
+               printf("FEC MXC: Unable to register FEC mii postcall\n");
+               return ret;
+       }
+
+       return 0;
+}
+
 int board_early_init_f(void)
 {
        setup_iomux_uart();
index 2995c8f105054edae5ed822e026bf029b61ef1bb..ed3fa6ef9a760fda700bb5b68d3e067ad0a5fc86 100644 (file)
@@ -26,6 +26,8 @@
 #include <netdev.h>
 #include <command.h>
 #include <pmic.h>
+#include <fsl_pmic.h>
+#include <mc13783.h>
 #include <asm/arch/clock.h>
 #include <asm/arch/sys_proto.h>
 #include <asm/io.h>
@@ -175,8 +177,6 @@ int board_init(void)
 
 int board_late_init(void)
 {
-       pmic_init();
-
 #ifdef CONFIG_HW_WATCHDOG
        mxc_hw_watchdog_enable();
 #endif
@@ -190,6 +190,36 @@ int checkboard(void)
        return 0;
 }
 
+#ifdef CONFIG_MXC_MMC
+int board_mmc_init(bd_t *bis)
+{
+       u32 val;
+       struct pmic *p;
+
+       /*
+       * this is the first driver to use the pmic, so call
+       * pmic_init() here. board_late_init() is too late for
+       * the MMC driver.
+       */
+       pmic_init();
+       p = get_pmic();
+
+       /* configure pins for SDHC1 only */
+       mx31_gpio_mux(IOMUX_MODE(MUX_CTL_SD1_CLK, MUX_CTL_FUNC));
+       mx31_gpio_mux(IOMUX_MODE(MUX_CTL_SD1_CMD, MUX_CTL_FUNC));
+       mx31_gpio_mux(IOMUX_MODE(MUX_CTL_SD1_DATA0, MUX_CTL_FUNC));
+       mx31_gpio_mux(IOMUX_MODE(MUX_CTL_SD1_DATA1, MUX_CTL_FUNC));
+       mx31_gpio_mux(IOMUX_MODE(MUX_CTL_SD1_DATA2, MUX_CTL_FUNC));
+       mx31_gpio_mux(IOMUX_MODE(MUX_CTL_SD1_DATA3, MUX_CTL_FUNC));
+
+       /* turn on power V_MMC1 */
+       if (pmic_reg_read(p, REG_MODE_1, &val) < 0)
+               pmic_reg_write(p, REG_MODE_1, val | VMMC1EN);
+
+       return mxc_mmc_init(bis);
+}
+#endif
+
 int board_eth_init(bd_t *bis)
 {
        int rc = 0;
diff --git a/board/htkw/mcx/Makefile b/board/htkw/mcx/Makefile
new file mode 100644 (file)
index 0000000..4c8db10
--- /dev/null
@@ -0,0 +1,38 @@
+#
+# Copyright (C) 2011 Ilya Yanok, Emcraft Systems
+#
+# Based on ti/evm/Makefile
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc.
+#
+
+include $(TOPDIR)/config.mk
+
+LIB    = $(obj)lib$(BOARD).o
+
+COBJS  := $(BOARD).o
+
+SRCS   := $(COBJS:.o=.c)
+OBJS   := $(addprefix $(obj),$(COBJS))
+
+$(LIB):        $(obj).depend $(OBJS)
+       $(call cmd_link_o_target, $(OBJS))
+
+#########################################################################
+
+# defines $(obj).depend target
+include $(SRCTREE)/rules.mk
+
+sinclude $(obj).depend
diff --git a/board/htkw/mcx/mcx.c b/board/htkw/mcx/mcx.c
new file mode 100644 (file)
index 0000000..e593b43
--- /dev/null
@@ -0,0 +1,112 @@
+/*
+ * Copyright (C) 2011 Ilya Yanok, Emcraft Systems
+ *
+ * Based on ti/evm/evm.c
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc.
+ */
+
+#include <common.h>
+#include <asm/io.h>
+#include <asm/arch/mem.h>
+#include <asm/arch/mmc_host_def.h>
+#include <asm/arch/mux.h>
+#include <asm/arch/sys_proto.h>
+#include <asm/mach-types.h>
+#include <asm/gpio.h>
+#include <asm/omap_gpio.h>
+#include "errno.h"
+#include <i2c.h>
+#ifdef CONFIG_USB_EHCI
+#include <usb.h>
+#include <asm/ehci-omap.h>
+#endif
+#include "mcx.h"
+
+DECLARE_GLOBAL_DATA_PTR;
+
+#ifdef CONFIG_USB_EHCI
+static struct omap_usbhs_board_data usbhs_bdata = {
+       .port_mode[0] = OMAP_EHCI_PORT_MODE_PHY,
+       .port_mode[1] = OMAP_EHCI_PORT_MODE_PHY,
+       .port_mode[2] = OMAP_USBHS_PORT_MODE_UNUSED,
+};
+
+int ehci_hcd_init(void)
+{
+       return omap_ehci_hcd_init(&usbhs_bdata);
+}
+
+int ehci_hcd_stop(void)
+{
+       return omap_ehci_hcd_stop();
+}
+#endif
+
+/*
+ * Routine: board_init
+ * Description: Early hardware init.
+ */
+int board_init(void)
+{
+       gpmc_init(); /* in SRAM or SDRAM, finish GPMC */
+       /* boot param addr */
+       gd->bd->bi_boot_params = (OMAP34XX_SDRC_CS0 + 0x100);
+
+       return 0;
+}
+
+/*
+ * Routine: misc_init_r
+ * Description: late init.
+ */
+int misc_init_r(void)
+{
+       dieid_num_r();
+
+       return 0;
+}
+
+/*
+ * Routine: set_muxconf_regs
+ * Description: Setting up the configuration Mux registers specific to the
+ *             hardware. Many pins need to be moved from protect to primary
+ *             mode.
+ */
+void set_muxconf_regs(void)
+{
+       MUX_MCX();
+}
+
+#if defined(CONFIG_OMAP_HSMMC) && !defined(CONFIG_SPL_BUILD)
+int board_mmc_init(bd_t *bis)
+{
+       return omap_mmc_init(0);
+}
+#endif
+
+#ifdef CONFIG_USB_EHCI_OMAP
+#define USB_HOST_PWR_EN                132
+int board_usb_init(void)
+{
+       if (gpio_request(USB_HOST_PWR_EN, "USB_HOST_PWR_EN") < 0) {
+               puts("Failed to get USB_HOST_PWR_EN pin\n");
+               return -ENODEV;
+       }
+       gpio_direction_output(USB_HOST_PWR_EN, 1);
+
+       return 0;
+}
+#endif
diff --git a/board/htkw/mcx/mcx.h b/board/htkw/mcx/mcx.h
new file mode 100644 (file)
index 0000000..d675a48
--- /dev/null
@@ -0,0 +1,408 @@
+/*
+ * Copyright (C) 2011 Ilya Yanok, Emcraft Systems
+ *
+ * Based on ti/evm/evm.h
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc.
+ */
+
+#ifndef _AM3517EVM_H_
+#define _AM3517EVM_H_
+
+const omap3_sysinfo sysinfo = {
+       DDR_DISCRETE,
+       "HTKW mcx Board",
+       "NAND",
+};
+
+/*
+ * IEN  - Input Enable
+ * IDIS - Input Disable
+ * PTD  - Pull type Down
+ * PTU  - Pull type Up
+ * DIS  - Pull type selection is inactive
+ * EN   - Pull type selection is active
+ * M0   - Mode 0
+ * The commented string gives the final mux configuration for that pin
+ */
+#define MUX_MCX() \
+       /* SDRC */\
+       MUX_VAL(CP(SDRC_D0),            (IEN  | PTD | DIS | M0)) \
+       MUX_VAL(CP(SDRC_D1),            (IEN  | PTD | DIS | M0)) \
+       MUX_VAL(CP(SDRC_D2),            (IEN  | PTD | DIS | M0)) \
+       MUX_VAL(CP(SDRC_D3),            (IEN  | PTD | DIS | M0)) \
+       MUX_VAL(CP(SDRC_D4),            (IEN  | PTD | DIS | M0)) \
+       MUX_VAL(CP(SDRC_D5),            (IEN  | PTD | DIS | M0)) \
+       MUX_VAL(CP(SDRC_D6),            (IEN  | PTD | DIS | M0)) \
+       MUX_VAL(CP(SDRC_D7),            (IEN  | PTD | DIS | M0)) \
+       MUX_VAL(CP(SDRC_D8),            (IEN  | PTD | DIS | M0)) \
+       MUX_VAL(CP(SDRC_D9),            (IEN  | PTD | DIS | M0)) \
+       MUX_VAL(CP(SDRC_D10),           (IEN  | PTD | DIS | M0)) \
+       MUX_VAL(CP(SDRC_D11),           (IEN  | PTD | DIS | M0)) \
+       MUX_VAL(CP(SDRC_D12),           (IEN  | PTD | DIS | M0)) \
+       MUX_VAL(CP(SDRC_D13),           (IEN  | PTD | DIS | M0)) \
+       MUX_VAL(CP(SDRC_D14),           (IEN  | PTD | DIS | M0)) \
+       MUX_VAL(CP(SDRC_D15),           (IEN  | PTD | DIS | M0)) \
+       MUX_VAL(CP(SDRC_D16),           (IEN  | PTD | DIS | M0)) \
+       MUX_VAL(CP(SDRC_D17),           (IEN  | PTD | DIS | M0)) \
+       MUX_VAL(CP(SDRC_D18),           (IEN  | PTD | DIS | M0)) \
+       MUX_VAL(CP(SDRC_D19),           (IEN  | PTD | DIS | M0)) \
+       MUX_VAL(CP(SDRC_D20),           (IEN  | PTD | DIS | M0)) \
+       MUX_VAL(CP(SDRC_D21),           (IEN  | PTD | DIS | M0)) \
+       MUX_VAL(CP(SDRC_D22),           (IEN  | PTD | DIS | M0)) \
+       MUX_VAL(CP(SDRC_D23),           (IEN  | PTD | DIS | M0)) \
+       MUX_VAL(CP(SDRC_D24),           (IEN  | PTD | DIS | M0)) \
+       MUX_VAL(CP(SDRC_D25),           (IEN  | PTD | DIS | M0)) \
+       MUX_VAL(CP(SDRC_D26),           (IEN  | PTD | DIS | M0)) \
+       MUX_VAL(CP(SDRC_D27),           (IEN  | PTD | DIS | M0)) \
+       MUX_VAL(CP(SDRC_D28),           (IEN  | PTD | DIS | M0)) \
+       MUX_VAL(CP(SDRC_D29),           (IEN  | PTD | DIS | M0)) \
+       MUX_VAL(CP(SDRC_D30),           (IEN  | PTD | DIS | M0)) \
+       MUX_VAL(CP(SDRC_D31),           (IEN  | PTD | DIS | M0)) \
+       MUX_VAL(CP(SDRC_CLK),           (IEN  | PTD | DIS | M0)) \
+       MUX_VAL(CP(SDRC_DQS0),          (IEN  | PTD | DIS | M0)) \
+       MUX_VAL(CP(SDRC_DQS1),          (IEN  | PTD | DIS | M0)) \
+       MUX_VAL(CP(SDRC_DQS2),          (IEN  | PTD | DIS | M0)) \
+       MUX_VAL(CP(SDRC_DQS3),          (IEN  | PTD | DIS | M0)) \
+       MUX_VAL(CP(SDRC_DQS0N),         (IEN  | PTD | EN  | M0)) \
+       MUX_VAL(CP(SDRC_DQS1N),         (IEN  | PTD | EN  | M0)) \
+       MUX_VAL(CP(SDRC_DQS2N),         (IEN  | PTD | EN  | M0)) \
+       MUX_VAL(CP(SDRC_DQS3N),         (IEN  | PTD | EN  | M0)) \
+       MUX_VAL(CP(SDRC_CKE0),          (M0)) \
+       MUX_VAL(CP(SDRC_CKE1),          (M0)) \
+       MUX_VAL(CP(STRBEN_DLY0),        (IEN  | PTD | EN  | M0)) \
+                                       /*sdrc_strben_dly0*/\
+       MUX_VAL(CP(STRBEN_DLY1),        (IEN  | PTD | EN  | M0)) \
+                                       /*sdrc_strben_dly1*/\
+       /* GPMC */\
+       MUX_VAL(CP(GPMC_A1),            (IEN | PTU | EN  | M4)) \
+       MUX_VAL(CP(GPMC_A2),            (IEN | PTU | EN  | M4)) \
+       MUX_VAL(CP(GPMC_A3),            (IEN | PTU | EN  | M4)) \
+       MUX_VAL(CP(GPMC_A4),            (IEN | PTU | EN  | M4)) \
+       MUX_VAL(CP(GPMC_A5),            (IEN | PTU | EN  | M4)) \
+       MUX_VAL(CP(GPMC_A6),            (IEN | PTU | EN  | M4)) \
+       MUX_VAL(CP(GPMC_A7),            (IEN | PTU | EN  | M4)) \
+       MUX_VAL(CP(GPMC_A8),            (IEN | PTU | EN  | M4)) \
+       MUX_VAL(CP(GPMC_A9),            (IEN | PTU | EN  | M4)) \
+       MUX_VAL(CP(GPMC_A10),           (IDIS | PTU | DIS | M4)) \
+                                       /* GPIO_43 LCD buffer enable */ \
+       MUX_VAL(CP(GPMC_D0),            (IEN  | PTU | EN  | M0)) \
+       MUX_VAL(CP(GPMC_D1),            (IEN  | PTU | EN  | M0)) \
+       MUX_VAL(CP(GPMC_D2),            (IEN  | PTU | EN  | M0)) \
+       MUX_VAL(CP(GPMC_D3),            (IEN  | PTU | EN  | M0)) \
+       MUX_VAL(CP(GPMC_D4),            (IEN  | PTU | EN  | M0)) \
+       MUX_VAL(CP(GPMC_D5),            (IEN  | PTU | EN  | M0)) \
+       MUX_VAL(CP(GPMC_D6),            (IEN  | PTU | EN  | M0)) \
+       MUX_VAL(CP(GPMC_D7),            (IEN  | PTU | EN  | M0)) \
+       MUX_VAL(CP(GPMC_D8),            (IEN  | PTU | EN  | M0)) \
+       MUX_VAL(CP(GPMC_D9),            (IEN  | PTU | EN  | M0)) \
+       MUX_VAL(CP(GPMC_D10),           (IEN  | PTU | EN  | M0)) \
+       MUX_VAL(CP(GPMC_D11),           (IEN  | PTU | EN  | M0)) \
+       MUX_VAL(CP(GPMC_D12),           (IEN  | PTU | EN  | M0)) \
+       MUX_VAL(CP(GPMC_D13),           (IEN  | PTU | EN  | M0)) \
+       MUX_VAL(CP(GPMC_D14),           (IEN  | PTU | EN  | M0)) \
+       MUX_VAL(CP(GPMC_D15),           (IEN  | PTU | EN  | M0)) \
+       MUX_VAL(CP(GPMC_NCS0),          (IDIS | PTU | EN  | M0)) \
+       MUX_VAL(CP(GPMC_NCS1),          (IEN | PTU | EN  | M4)) \
+       MUX_VAL(CP(GPMC_NCS2),          (IEN | PTU | EN  | M4)) \
+       MUX_VAL(CP(GPMC_NCS3),          (IEN | PTU | EN  | M4)) \
+       MUX_VAL(CP(GPMC_NCS4),          (IEN | PTU | EN  | M4))\
+       MUX_VAL(CP(GPMC_NCS5),          (IEN | PTU | EN  | M4)) \
+       MUX_VAL(CP(GPMC_NCS6),          (IEN | PTU | EN  | M4)) \
+                                       /* GPIO_57 TS_PenIRQn */\
+       MUX_VAL(CP(GPMC_NCS7),          (IEN | PTU | EN  | M4)) \
+                                       /* GPIO_58 ETHERNET RESET */\
+       MUX_VAL(CP(GPMC_CLK),           (IEN | PTU | EN  | M4)) \
+       MUX_VAL(CP(GPMC_NADV_ALE),      (IDIS | PTD | DIS | M0)) \
+       MUX_VAL(CP(GPMC_NOE),           (IDIS | PTD | DIS | M0)) \
+       MUX_VAL(CP(GPMC_NWE),           (IDIS | PTD | DIS | M0)) \
+       MUX_VAL(CP(GPMC_NBE0_CLE),      (IDIS | PTU | EN  | M0)) \
+       MUX_VAL(CP(GPMC_NBE1),          (IEN  | PTU | DIS  | M4)) \
+                                       /* GPIO_61 SD-CARD CD */ \
+       MUX_VAL(CP(GPMC_NWP),           (IDIS  | PTU | EN | M4)) \
+                       /* GPIO_62 Nand write protect, keep enabled */ \
+       MUX_VAL(CP(GPMC_WAIT0),         (IEN  | PTU | EN  | M0)) \
+       MUX_VAL(CP(GPMC_WAIT1),         (IEN | PTU | EN  | M4))\
+       MUX_VAL(CP(GPMC_WAIT2),         (IEN  | PTU | EN  | M4))\
+       MUX_VAL(CP(GPMC_WAIT3),         (IEN | PTU | EN  | M4)) \
+                                       /* GPIO_65 SD-CARD WP */\
+       /* DSS */\
+       MUX_VAL(CP(DSS_PCLK),           (IDIS | PTD | DIS | M0)) \
+       MUX_VAL(CP(DSS_HSYNC),          (IDIS | PTD | DIS | M0)) \
+       MUX_VAL(CP(DSS_VSYNC),          (IDIS | PTD | DIS | M0)) \
+       MUX_VAL(CP(DSS_ACBIAS),         (IDIS | PTD | DIS | M0)) \
+       MUX_VAL(CP(DSS_DATA0),          (IEN | PTU | EN  | M4))\
+       MUX_VAL(CP(DSS_DATA1),          (IEN | PTU | EN  | M4)) \
+       MUX_VAL(CP(DSS_DATA2),          (IEN | PTU | EN  | M4)) \
+       MUX_VAL(CP(DSS_DATA3),          (IDIS | PTD | DIS | M0)) \
+       MUX_VAL(CP(DSS_DATA4),          (IDIS | PTD | DIS | M0)) \
+       MUX_VAL(CP(DSS_DATA5),          (IDIS | PTD | DIS | M0)) \
+       MUX_VAL(CP(DSS_DATA6),          (IDIS | PTD | DIS | M0)) \
+       MUX_VAL(CP(DSS_DATA7),          (IDIS | PTD | DIS | M0)) \
+       MUX_VAL(CP(DSS_DATA8),          (IEN | PTU | EN  | M4)) \
+       MUX_VAL(CP(DSS_DATA9),          (IEN | PTU | EN  | M4)) \
+       MUX_VAL(CP(DSS_DATA10),         (IDIS | PTD | DIS | M0)) \
+       MUX_VAL(CP(DSS_DATA11),         (IDIS | PTD | DIS | M0)) \
+       MUX_VAL(CP(DSS_DATA12),         (IDIS | PTD | DIS | M0)) \
+       MUX_VAL(CP(DSS_DATA13),         (IDIS | PTD | DIS | M0)) \
+       MUX_VAL(CP(DSS_DATA14),         (IDIS | PTD | DIS | M0)) \
+       MUX_VAL(CP(DSS_DATA15),         (IDIS | PTD | DIS | M0))\
+       MUX_VAL(CP(DSS_DATA16),         (IEN | PTU | EN  | M4)) \
+       MUX_VAL(CP(DSS_DATA17),         (IEN | PTU | EN  | M4)) \
+       MUX_VAL(CP(DSS_DATA18),         (IEN | PTU | EN  | M4)) \
+       MUX_VAL(CP(DSS_DATA19),         (IDIS | PTD | DIS | M0)) \
+       MUX_VAL(CP(DSS_DATA20),         (IDIS | PTD | DIS | M0)) \
+       MUX_VAL(CP(DSS_DATA21),         (IDIS | PTD | DIS | M0))  \
+       MUX_VAL(CP(DSS_DATA22),         (IDIS | PTD | DIS | M0)) \
+       MUX_VAL(CP(DSS_DATA23),         (IDIS | PTD | DIS | M0)) \
+       /* CAMERA */\
+       MUX_VAL(CP(CAM_HS),             (IEN  | PTU | EN  | M4)) \
+       MUX_VAL(CP(CAM_VS),             (IEN  | PTU | EN  | M4)) \
+       MUX_VAL(CP(CAM_XCLKA),          (IEN  | PTD | EN  | M4)) \
+       MUX_VAL(CP(CAM_PCLK),           (IEN  | PTU | EN  | M4)) \
+       MUX_VAL(CP(CAM_FLD),            (IEN  | PTD | EN  | M4)) \
+       MUX_VAL(CP(CAM_D0),             (IEN  | PTD | EN  | M4)) \
+       MUX_VAL(CP(CAM_D1),             (IEN  | PTD | EN  | M4)) \
+       MUX_VAL(CP(CAM_D2),             (IEN  | PTD | EN  | M4)) \
+       MUX_VAL(CP(CAM_D3),             (IEN  | PTD | EN  | M4)) \
+       MUX_VAL(CP(CAM_D4),             (IEN  | PTD | EN  | M4)) \
+       MUX_VAL(CP(CAM_D5),             (IEN  | PTD | EN  | M4)) \
+       MUX_VAL(CP(CAM_D6),             (IEN  | PTD | EN  | M4)) \
+       MUX_VAL(CP(CAM_D7),             (IEN  | PTD | EN  | M4)) \
+       MUX_VAL(CP(CAM_D8),             (IEN  | PTD | EN  | M4)) \
+       MUX_VAL(CP(CAM_D9),             (IEN  | PTD | EN  | M4)) \
+       MUX_VAL(CP(CAM_D10),            (IEN  | PTD | EN  | M4)) \
+       MUX_VAL(CP(CAM_D11),            (IEN  | PTD | EN  | M4)) \
+       MUX_VAL(CP(CAM_XCLKB),          (IEN  | PTD | EN  | M4)) \
+       MUX_VAL(CP(CAM_WEN),            (IEN  | PTD | EN  | M4)) \
+       MUX_VAL(CP(CAM_STROBE),         (IEN  | PTD | EN  | M4)) \
+       MUX_VAL(CP(CSI2_DX0),           (IEN  | PTD | EN  | M4)) \
+       MUX_VAL(CP(CSI2_DY0),           (IEN  | PTD | EN  | M4)) \
+       MUX_VAL(CP(CSI2_DX1),           (IEN  | PTD | EN  | M4)) \
+       MUX_VAL(CP(CSI2_DY1),           (IEN  | PTD | EN  | M4)) \
+       /* MMC */\
+       MUX_VAL(CP(MMC1_CLK),           (IEN  | PTU | EN  | M0)) \
+       MUX_VAL(CP(MMC1_CMD),           (IEN  | PTU | DIS | M0)) \
+       MUX_VAL(CP(MMC1_DAT0),          (IEN  | PTU | DIS | M0)) \
+       MUX_VAL(CP(MMC1_DAT1),          (IEN  | PTU | DIS | M0)) \
+       MUX_VAL(CP(MMC1_DAT2),          (IEN  | PTU | DIS | M0)) \
+       MUX_VAL(CP(MMC1_DAT3),          (IEN  | PTU | DIS | M0)) \
+       MUX_VAL(CP(MMC1_DAT4),          (IEN  | PTU | EN  | M4)) \
+       MUX_VAL(CP(MMC1_DAT5),          (IEN  | PTU | EN  | M4)) \
+       MUX_VAL(CP(MMC1_DAT6),          (IEN  | PTU | EN  | M4)) \
+       MUX_VAL(CP(MMC1_DAT7),          (IEN  | PTU | EN  | M4)) \
+       \
+       MUX_VAL(CP(MMC2_CLK),           (IEN  | PTD | EN  | M4)) \
+       MUX_VAL(CP(MMC2_CMD),           (IDIS | PTD | DIS | M4)) \
+                                       /* GPIO_131 LCD Enable */ \
+       MUX_VAL(CP(MMC2_DAT0),          (IDIS | PTD | DIS  | M4)) \
+                                       /* GPIO_132 USB host Enable */\
+       MUX_VAL(CP(MMC2_DAT1),          (IDIS  | PTD | DIS  | M4)) \
+                                       /* GPIO_133 HDMI PD */\
+       MUX_VAL(CP(MMC2_DAT2),          (IEN  | PTU | EN  | M4)) \
+       MUX_VAL(CP(MMC2_DAT3),          (IEN  | PTU | EN  | M4))\
+       /* McBSP */\
+       MUX_VAL(CP(MCBSP_CLKS),         (IEN  | PTU | DIS | M0)) \
+       MUX_VAL(CP(MCBSP1_CLKR),        (IEN  | PTD | DIS | M0)) \
+       MUX_VAL(CP(MCBSP1_FSR),         (IDIS | PTU | EN  | M0)) \
+       MUX_VAL(CP(MCBSP1_DX),          (IDIS | PTD | DIS | M0)) \
+       MUX_VAL(CP(MCBSP1_DR),          (IEN  | PTD | DIS | M0)) \
+       MUX_VAL(CP(MCBSP1_FSX),         (IEN  | PTD | DIS | M0)) \
+       MUX_VAL(CP(MCBSP1_CLKX),        (IEN  | PTD | DIS | M0)) \
+       \
+       MUX_VAL(CP(MCBSP2_FSX),         (IEN  | PTU | EN  | M4))\
+       MUX_VAL(CP(MCBSP2_CLKX),        (IEN  | PTU | EN  | M4)) \
+       MUX_VAL(CP(MCBSP2_DR),          (IEN  | PTU | EN  | M4)) \
+       MUX_VAL(CP(MCBSP2_DX),          (IEN  | PTU | EN  | M4))\
+       \
+       MUX_VAL(CP(MCBSP3_DX),          (IEN  | PTU | EN  | M4)) \
+       MUX_VAL(CP(MCBSP3_DR),          (IEN  | PTU | EN  | M4)) \
+       MUX_VAL(CP(MCBSP3_CLKX),        (IEN  | PTU | EN  | M4)) \
+       MUX_VAL(CP(MCBSP3_FSX),         (IEN  | PTU | EN  | M4))\
+       \
+       MUX_VAL(CP(MCBSP4_CLKX),        (IDIS | PTD | DIS | M4)) \
+                                       /* GPIO_152 USB phy2 reset */\
+       MUX_VAL(CP(MCBSP4_DR),          (IEN | PTU | EN | M4)) \
+                                       /* GPIO_153 */\
+       MUX_VAL(CP(MCBSP4_DX),          (IDIS | PTD | DIS | M4)) \
+                                       /* GPIO_154 USB phy1 reset */\
+       MUX_VAL(CP(MCBSP4_FSX),         (IEN | PTU | EN | M4)) \
+                                       /* GPIO_155 TS_BUSY */\
+       /* UART */\
+       MUX_VAL(CP(UART1_TX),           (IDIS | PTD | DIS | M0)) \
+       MUX_VAL(CP(UART1_RTS),          (IDIS | PTD | DIS | M0)) \
+       MUX_VAL(CP(UART1_CTS),          (IEN  | PTU | DIS | M0)) \
+       MUX_VAL(CP(UART1_RX),           (IEN  | PTD | DIS | M0)) \
+       \
+       MUX_VAL(CP(UART2_CTS),          (IEN  | PTU | EN  | M0)) \
+       MUX_VAL(CP(UART2_RTS),          (IDIS | PTD | DIS | M0)) \
+       MUX_VAL(CP(UART2_TX),           (IDIS | PTD | DIS | M0)) \
+       MUX_VAL(CP(UART2_RX),           (IEN  | PTD | DIS | M0)) \
+       \
+       MUX_VAL(CP(UART3_CTS_RCTX),     (IEN  | PTU | DIS | M0)) \
+       MUX_VAL(CP(UART3_RTS_SD),       (IDIS | PTD | DIS | M0)) \
+       MUX_VAL(CP(UART3_RX_IRRX),      (IEN  | PTD | DIS | M0)) \
+       MUX_VAL(CP(UART3_TX_IRTX),      (IDIS | PTD | DIS | M0)) \
+       /* I2C */\
+       MUX_VAL(CP(I2C1_SCL),           (IEN  | PTU | EN  | M0)) \
+       MUX_VAL(CP(I2C1_SDA),           (IEN  | PTU | EN  | M0)) \
+       MUX_VAL(CP(I2C2_SCL),           (IEN  | PTU | EN  | M0)) \
+       MUX_VAL(CP(I2C2_SDA),           (IEN  | PTU | EN  | M0)) \
+       MUX_VAL(CP(I2C3_SCL),           (IEN  | PTU | EN  | M0)) \
+       MUX_VAL(CP(I2C3_SDA),           (IEN  | PTU | EN  | M0)) \
+       MUX_VAL(CP(I2C4_SCL),           (IEN  | PTU | EN  | M0)) \
+       MUX_VAL(CP(I2C4_SDA),           (IEN  | PTU | EN  | M0)) \
+       /* McSPI */\
+       MUX_VAL(CP(MCSPI1_CLK),         (IEN  | PTD | DIS | M0)) \
+       MUX_VAL(CP(MCSPI1_SIMO),        (IEN  | PTD | DIS | M0)) \
+       MUX_VAL(CP(MCSPI1_SOMI),        (IEN  | PTD | DIS | M0)) \
+       MUX_VAL(CP(MCSPI1_CS0),         (IEN  | PTD | EN  | M0)) \
+       MUX_VAL(CP(MCSPI1_CS1),         (IEN  | PTU | EN  | M4)) \
+       MUX_VAL(CP(MCSPI1_CS2),         (IEN  | PTU | EN  | M4)) \
+       MUX_VAL(CP(MCSPI1_CS3),         (IEN  | PTU | EN  | M4)) \
+       MUX_VAL(CP(MCSPI2_CLK),         (IEN  | PTD | DIS | M3)) \
+                                       /* HSUSB2_dat7 */\
+       MUX_VAL(CP(MCSPI2_SIMO),        (IEN  | PTD | DIS | M3)) \
+                                       /* HSUSB2_dat4 */\
+       MUX_VAL(CP(MCSPI2_SOMI),        (IEN  | PTD | DIS | M3)) \
+                                       /* HSUSB2_dat5 */\
+       MUX_VAL(CP(MCSPI2_CS0),         (IEN  | PTD | DIS | M3)) \
+                                       /* HSUSB2_dat6 */\
+       MUX_VAL(CP(MCSPI2_CS1),         (IEN  | PTD | DIS | M3)) \
+                                       /* HSUSB2_dat3 */\
+       /* CCDC */\
+       MUX_VAL(CP(CCDC_PCLK),          (IEN  | PTD | EN  | M4)) \
+       MUX_VAL(CP(CCDC_FIELD),         (IEN  | PTD | EN  | M4)) \
+       MUX_VAL(CP(CCDC_HD),            (IEN  | PTD | EN  | M4)) \
+       MUX_VAL(CP(CCDC_VD),            (IEN  | PTD | EN  | M4)) \
+       MUX_VAL(CP(CCDC_WEN),           (IEN  | PTD | EN  | M4)) \
+       MUX_VAL(CP(CCDC_DATA0),         (IEN  | PTD | EN  | M4)) \
+       MUX_VAL(CP(CCDC_DATA1),         (IEN  | PTD | EN  | M4)) \
+       MUX_VAL(CP(CCDC_DATA2),         (IEN  | PTD | EN  | M4)) \
+       MUX_VAL(CP(CCDC_DATA3),         (IEN  | PTD | EN  | M4)) \
+       MUX_VAL(CP(CCDC_DATA4),         (IEN  | PTD | EN  | M4)) \
+       MUX_VAL(CP(CCDC_DATA5),         (IEN  | PTD | EN  | M4)) \
+       MUX_VAL(CP(CCDC_DATA6),         (IEN  | PTD | EN  | M4)) \
+       MUX_VAL(CP(CCDC_DATA7),         (IEN  | PTD | EN  | M4)) \
+       /* RMII */\
+       MUX_VAL(CP(RMII_MDIO_DATA),     (IEN  |  M0)) \
+       MUX_VAL(CP(RMII_MDIO_CLK),      (M0)) \
+       MUX_VAL(CP(RMII_RXD0),          (IEN  | PTD | M0)) \
+       MUX_VAL(CP(RMII_RXD1),          (IEN  | PTD | M0)) \
+       MUX_VAL(CP(RMII_CRS_DV),        (IEN  | PTD | M0)) \
+       MUX_VAL(CP(RMII_RXER),          (PTD | M0)) \
+       MUX_VAL(CP(RMII_TXD0),          (PTD | M0)) \
+       MUX_VAL(CP(RMII_TXD1),          (PTD | M0)) \
+       MUX_VAL(CP(RMII_TXEN),          (PTD | M0)) \
+       MUX_VAL(CP(RMII_50MHZ_CLK),     (IEN  | PTD | EN  | M0)) \
+       /* HECC */\
+       MUX_VAL(CP(HECC1_TXD),          (IEN  | PTD | EN  | M4)) \
+       MUX_VAL(CP(HECC1_RXD),          (IEN  | PTD | EN  | M4)) \
+       /* HSUSB */\
+       MUX_VAL(CP(HSUSB0_CLK),         (IEN  | PTD | DIS | M0)) \
+       MUX_VAL(CP(HSUSB0_STP),         (IDIS | PTU | EN  | M0)) \
+       MUX_VAL(CP(HSUSB0_DIR),         (IEN  | PTD | DIS | M0)) \
+       MUX_VAL(CP(HSUSB0_NXT),         (IEN  | PTD | DIS | M0)) \
+       MUX_VAL(CP(HSUSB0_DATA0),       (IEN  | PTD | DIS | M0)) \
+       MUX_VAL(CP(HSUSB0_DATA1),       (IEN  | PTD | DIS | M0)) \
+       MUX_VAL(CP(HSUSB0_DATA2),       (IEN  | PTD | DIS | M0)) \
+       MUX_VAL(CP(HSUSB0_DATA3),       (IEN  | PTD | DIS | M0)) \
+       MUX_VAL(CP(HSUSB0_DATA4),       (IEN  | PTD | DIS | M0)) \
+       MUX_VAL(CP(HSUSB0_DATA5),       (IEN  | PTD | DIS | M0)) \
+       MUX_VAL(CP(HSUSB0_DATA6),       (IEN  | PTD | DIS | M0)) \
+       MUX_VAL(CP(HSUSB0_DATA7),       (IEN  | PTD | DIS | M0)) \
+       MUX_VAL(CP(USB0_DRVBUS),        (IEN  | PTD | EN  | M0)) \
+       /* HDQ */\
+       MUX_VAL(CP(HDQ_SIO),            (IEN  | PTD | EN  | M4)) \
+       /* Control and debug */\
+       MUX_VAL(CP(SYS_32K),            (IEN  | PTD | EN  | M4)) \
+       MUX_VAL(CP(SYS_CLKREQ),         (IEN  | PTD | DIS | M0)) \
+       MUX_VAL(CP(SYS_NIRQ),           (IEN  | PTD | EN  | M4)) \
+       MUX_VAL(CP(SYS_NRESWARM),       (IEN | PTU | DIS | M4)) \
+                                       /* SYS_nRESWARM */\
+       MUX_VAL(CP(SYS_BOOT0),          (IEN  | PTD | DIS | M4)) \
+       MUX_VAL(CP(SYS_BOOT1),          (IEN  | PTD | DIS | M4)) \
+       MUX_VAL(CP(SYS_BOOT2),          (IEN  | PTD | DIS | M4)) \
+       MUX_VAL(CP(SYS_BOOT3),          (IEN  | PTD | DIS | M4)) \
+       MUX_VAL(CP(SYS_BOOT4),          (IEN  | PTD | DIS | M4)) \
+       MUX_VAL(CP(SYS_BOOT5),          (IEN  | PTD | DIS | M4))\
+       MUX_VAL(CP(SYS_BOOT6),          (IEN  | PTD | DIS | M4))\
+       MUX_VAL(CP(SYS_BOOT7),          (IEN  | PTD | DIS | M4)) \
+       MUX_VAL(CP(SYS_BOOT8),          (IEN  | PTD | DIS | M4)) \
+       \
+       MUX_VAL(CP(SYS_OFF_MODE),       (IEN  | PTD | DIS | M0)) \
+       MUX_VAL(CP(SYS_CLKOUT1),        (IEN  | PTD | DIS | M4))\
+       MUX_VAL(CP(SYS_CLKOUT2),        (IDIS | PTU | DIS | M4))\
+       /* JTAG */\
+       MUX_VAL(CP(JTAG_nTRST),         (IEN | PTU | EN  | M4)) \
+       MUX_VAL(CP(JTAG_TCK),           (IEN | PTU | EN  | M4)) \
+       MUX_VAL(CP(JTAG_TMS),           (IEN | PTU | EN  | M4)) \
+       MUX_VAL(CP(JTAG_TDI),           (IEN | PTU | EN  | M4)) \
+       MUX_VAL(CP(JTAG_EMU0),          (IEN | PTU | EN  | M4)) \
+       MUX_VAL(CP(JTAG_EMU1),          (IEN | PTU | EN  | M4))\
+       /* ETK (ES2 onwards) */\
+       MUX_VAL(CP(ETK_CLK_ES2),        (IDIS  | PTD | DIS | M3)) \
+                                       /* hsusb1_stp */ \
+       MUX_VAL(CP(ETK_CTL_ES2),        (IDIS  | PTD | DIS | M3)) \
+                                       /* hsusb1_clk */\
+       MUX_VAL(CP(ETK_D0_ES2),         (IEN  | PTD | EN | M3)) \
+       MUX_VAL(CP(ETK_D1_ES2),         (IEN  | PTD | EN | M3)) \
+       MUX_VAL(CP(ETK_D2_ES2),         (IEN  | PTD | EN | M3)) \
+       MUX_VAL(CP(ETK_D3_ES2),         (IEN  | PTD | EN | M3)) \
+       MUX_VAL(CP(ETK_D4_ES2),         (IEN  | PTD | EN | M3)) \
+       MUX_VAL(CP(ETK_D5_ES2),         (IEN  | PTD | EN | M3)) \
+       MUX_VAL(CP(ETK_D6_ES2),         (IEN  | PTD | EN | M3)) \
+       MUX_VAL(CP(ETK_D7_ES2),         (IEN  | PTD | EN | M3)) \
+       MUX_VAL(CP(ETK_D8_ES2),         (IEN  | PTD | EN | M3)) \
+       MUX_VAL(CP(ETK_D9_ES2),         (IEN  | PTD | EN | M3)) \
+       MUX_VAL(CP(ETK_D10_ES2),        (IEN  | PTD | DIS | M4)) \
+       MUX_VAL(CP(ETK_D11_ES2),        (IEN  | PTD | DIS | M4)) \
+       MUX_VAL(CP(ETK_D12_ES2),        (IEN  | PTD | DIS | M4)) \
+       MUX_VAL(CP(ETK_D13_ES2),        (IEN  | PTD | DIS | M4)) \
+       MUX_VAL(CP(ETK_D14_ES2),        (IEN  | PTD | DIS | M4)) \
+       MUX_VAL(CP(ETK_D15_ES2),        (IEN  | PTD | DIS | M4)) \
+       /* Die to Die */\
+       MUX_VAL(CP(D2D_MCAD34),         (IEN  | PTD | EN  | M0)) \
+       MUX_VAL(CP(D2D_MCAD35),         (IEN  | PTD | EN  | M0)) \
+       MUX_VAL(CP(D2D_MCAD36),         (IEN  | PTD | EN  | M0)) \
+       MUX_VAL(CP(D2D_CLK26MI),        (IEN  | PTD | DIS | M0)) \
+       MUX_VAL(CP(D2D_NRESPWRON),      (IEN  | PTD | EN  | M0)) \
+       MUX_VAL(CP(D2D_NRESWARM),       (IEN  | PTU | EN  | M0)) \
+       MUX_VAL(CP(D2D_ARM9NIRQ),       (IEN  | PTD | DIS | M0)) \
+       MUX_VAL(CP(D2D_UMA2P6FIQ),      (IEN  | PTD | DIS | M0)) \
+       MUX_VAL(CP(D2D_SPINT),          (IEN  | PTD | EN  | M0)) \
+       MUX_VAL(CP(D2D_FRINT),          (IEN  | PTD | EN  | M0)) \
+       MUX_VAL(CP(D2D_DMAREQ0),        (IEN  | PTD | DIS | M0)) \
+       MUX_VAL(CP(D2D_DMAREQ1),        (IEN  | PTD | DIS | M0)) \
+       MUX_VAL(CP(D2D_DMAREQ2),        (IEN  | PTD | DIS | M0)) \
+       MUX_VAL(CP(D2D_DMAREQ3),        (IEN  | PTD | DIS | M0)) \
+       MUX_VAL(CP(D2D_N3GTRST),        (IEN  | PTD | DIS | M0)) \
+       MUX_VAL(CP(D2D_N3GTDI),         (IEN  | PTD | DIS | M0)) \
+       MUX_VAL(CP(D2D_N3GTDO),         (IEN  | PTD | DIS | M0)) \
+       MUX_VAL(CP(D2D_N3GTMS),         (IEN  | PTD | DIS | M0)) \
+       MUX_VAL(CP(D2D_N3GTCK),         (IEN  | PTD | DIS | M0)) \
+       MUX_VAL(CP(D2D_N3GRTCK),        (IEN  | PTD | DIS | M0)) \
+       MUX_VAL(CP(D2D_MSTDBY),         (IEN  | PTU | EN  | M0)) \
+       MUX_VAL(CP(D2D_SWAKEUP),        (IEN  | PTD | EN  | M0)) \
+       MUX_VAL(CP(D2D_IDLEREQ),        (IEN  | PTD | DIS | M0)) \
+       MUX_VAL(CP(D2D_IDLEACK),        (IEN  | PTU | EN  | M0)) \
+       MUX_VAL(CP(D2D_MWRITE),         (IEN  | PTD | DIS | M0)) \
+       MUX_VAL(CP(D2D_SWRITE),         (IEN  | PTD | DIS | M0)) \
+       MUX_VAL(CP(D2D_MREAD),          (IEN  | PTD | DIS | M0)) \
+       MUX_VAL(CP(D2D_SREAD),          (IEN  | PTD | DIS | M0)) \
+       MUX_VAL(CP(D2D_MBUSFLAG),       (IEN  | PTD | DIS | M0)) \
+       MUX_VAL(CP(D2D_SBUSFLAG),       (IEN  | PTD | DIS | M0)) \
+
+#endif
index ca33aaec534935bc2357652816a8532a73210055..9e9940c51f0bbd584780ec8376fec13481680045 100644 (file)
@@ -416,13 +416,13 @@ const ulong REPEAT_PATTERN  = 1000;
 
 void bootcount_store(ulong a)
 {
-       volatile ulong *save_addr;
-       volatile ulong size = 0;
+       ulong *save_addr;
+       ulong size = 0;
        int i;
-       for (i = 0; i < CONFIG_NR_DRAM_BANKS; i++) {
+
+       for (i = 0; i < CONFIG_NR_DRAM_BANKS; i++)
                size += gd->bd->bi_dram[i].size;
-       }
-       save_addr = (ulong*)(size - BOOTCOUNT_ADDR);
+       save_addr = (ulong *)(size - BOOTCOUNT_ADDR);
        writel(a, save_addr);
        writel(BOOTCOUNT_MAGIC, &save_addr[1]);
 
@@ -434,15 +434,14 @@ void bootcount_store(ulong a)
 
 ulong bootcount_load(void)
 {
-       volatile ulong *save_addr;
-       volatile ulong size = 0;
+       ulong *save_addr;
+       ulong size = 0;
        ulong counter = 0;
        int i, tmp;
 
-       for (i = 0; i < CONFIG_NR_DRAM_BANKS; i++) {
+       for (i = 0; i < CONFIG_NR_DRAM_BANKS; i++)
                size += gd->bd->bi_dram[i].size;
-       }
-       save_addr = (ulong*)(size - BOOTCOUNT_ADDR);
+       save_addr = (ulong *)(size - BOOTCOUNT_ADDR);
 
        counter = readl(&save_addr[0]);
 
@@ -492,13 +491,13 @@ int post_hotkeys_pressed(void)
 
 ulong post_word_load(void)
 {
-       volatile void* addr = (void *) (gd->ram_size - BOOTCOUNT_ADDR + POST_WORD_OFF);
+       void* addr = (void *) (gd->ram_size - BOOTCOUNT_ADDR + POST_WORD_OFF);
        return in_le32(addr);
 
 }
 void post_word_store(ulong value)
 {
-       volatile void* addr = (void *) (gd->ram_size - BOOTCOUNT_ADDR + POST_WORD_OFF);
+       void* addr = (void *) (gd->ram_size - BOOTCOUNT_ADDR + POST_WORD_OFF);
        out_le32(addr, value);
 }
 
index 4f5fa8d25f4dae07c45eae5c8b437c196a527d1a..bc7ec68f141f994b4a52663b86585f38e7cfa7e1 100644 (file)
@@ -200,6 +200,19 @@ void set_muxconf_regs(void)
        MUX_VAL(CP(GPMC_A3),            (IDIS | PTU | EN  | M0));
        MUX_VAL(CP(GPMC_A4),            (IDIS | PTU | EN  | M0));
        MUX_VAL(CP(GPMC_A5),            (IDIS | PTU | EN  | M0));
+       MUX_VAL(CP(GPMC_A6),            (IDIS | PTU | EN  | M0));
+       MUX_VAL(CP(GPMC_A7),            (IDIS | PTU | EN  | M0));
+       MUX_VAL(CP(GPMC_A8),            (IDIS | PTU | EN  | M0));
+       MUX_VAL(CP(GPMC_A9),            (IDIS | PTU | EN  | M0));
+       MUX_VAL(CP(GPMC_A10),           (IDIS | PTU | EN  | M0));
+       MUX_VAL(CP(GPMC_D0),            (IEN  | PTU | EN  | M0));
+       MUX_VAL(CP(GPMC_D1),            (IEN  | PTU | EN  | M0));
+       MUX_VAL(CP(GPMC_D2),            (IEN  | PTU | EN  | M0));
+       MUX_VAL(CP(GPMC_D3),            (IEN  | PTU | EN  | M0));
+       MUX_VAL(CP(GPMC_D4),            (IEN  | PTU | EN  | M0));
+       MUX_VAL(CP(GPMC_D5),            (IEN  | PTU | EN  | M0));
+       MUX_VAL(CP(GPMC_D6),            (IEN  | PTU | EN  | M0));
+       MUX_VAL(CP(GPMC_D7),            (IEN  | PTU | EN  | M0));
        MUX_VAL(CP(GPMC_D8),            (IEN  | PTU | EN  | M0));
        MUX_VAL(CP(GPMC_D9),            (IEN  | PTU | EN  | M0));
        MUX_VAL(CP(GPMC_D10),           (IEN  | PTU | EN  | M0));
@@ -209,6 +222,8 @@ void set_muxconf_regs(void)
        MUX_VAL(CP(GPMC_D14),           (IEN  | PTU | EN  | M0));
        MUX_VAL(CP(GPMC_D15),           (IEN  | PTU | EN  | M0));
        MUX_VAL(CP(GPMC_NCS0),          (IDIS | PTU | EN  | M0));
+       MUX_VAL(CP(GPMC_NCS1),          (IDIS | PTU | EN  | M0));
+       MUX_VAL(CP(GPMC_NCS2),          (IDIS | PTU | EN  | M0));
        MUX_VAL(CP(GPMC_NCS3),          (IDIS | PTD | DIS | M0));
        MUX_VAL(CP(GPMC_NCS5),          (IDIS | PTU | DIS | M4));
        MUX_VAL(CP(GPMC_NCS7),          (IDIS | PTD | DIS | M1)); /*GPMC_IO_DIR*/
index d5e147d269450af7307cf19f9c6540af767ea871..8f8e7bf3fe54310151d3e24468f0bc3dc483e193 100644 (file)
@@ -24,6 +24,8 @@
 #include <common.h>
 #include <asm/io.h>
 #include <asm/arch/tegra2.h>
+#include <asm/arch/clock.h>
+#include <asm/arch/funcmux.h>
 #include <asm/arch/pinmux.h>
 #include <asm/arch/mmc.h>
 #include <asm/gpio.h>
@@ -46,27 +48,14 @@ void gpio_config_uart(void)
  */
 static void pin_mux_mmc(void)
 {
-       /* SDMMC4: config 3, x8 on 2nd set of pins */
-       pinmux_set_func(PINGRP_ATB, PMUX_FUNC_SDIO4);
-       pinmux_set_func(PINGRP_GMA, PMUX_FUNC_SDIO4);
-       pinmux_set_func(PINGRP_GME, PMUX_FUNC_SDIO4);
-
-       pinmux_tristate_disable(PINGRP_ATB);
-       pinmux_tristate_disable(PINGRP_GMA);
-       pinmux_tristate_disable(PINGRP_GME);
+       funcmux_select(PERIPH_ID_SDMMC4, FUNCMUX_SDMMC4_ATB_GMA_GME_8_BIT);
+       funcmux_select(PERIPH_ID_SDMMC2, FUNCMUX_SDMMC2_DTA_DTD_8BIT);
 
        /* For power GPIO PI6 */
        pinmux_tristate_disable(PINGRP_ATA);
        /* For CD GPIO PH2 */
        pinmux_tristate_disable(PINGRP_ATD);
 
-       /* SDMMC2: SDIO2_CLK, SDIO2_CMD, SDIO2_DAT[7:0] */
-       pinmux_set_func(PINGRP_DTA, PMUX_FUNC_SDIO2);
-       pinmux_set_func(PINGRP_DTD, PMUX_FUNC_SDIO2);
-
-       pinmux_tristate_disable(PINGRP_DTA);
-       pinmux_tristate_disable(PINGRP_DTD);
-
        /* For power GPIO PT3 */
        pinmux_tristate_disable(PINGRP_DTB);
        /* For CD GPIO PI5 */
index 56acd6156f9818dc4ff5b05b920fb6dd3ca19a88..9ab6825bb8fed3f5978c09ae9fd7a22231372944 100644 (file)
@@ -24,6 +24,8 @@
 #include <common.h>
 #include <asm/io.h>
 #include <asm/arch/tegra2.h>
+#include <asm/arch/clock.h>
+#include <asm/arch/funcmux.h>
 #include <asm/arch/pinmux.h>
 #include <asm/arch/mmc.h>
 #include <asm/gpio.h>
@@ -59,23 +61,8 @@ void gpio_config_uart(void)
  */
 static void pin_mux_mmc(void)
 {
-       /* SDMMC4: config 3, x8 on 2nd set of pins */
-       pinmux_set_func(PINGRP_ATB, PMUX_FUNC_SDIO4);
-       pinmux_set_func(PINGRP_GMA, PMUX_FUNC_SDIO4);
-       pinmux_set_func(PINGRP_GME, PMUX_FUNC_SDIO4);
-
-       pinmux_tristate_disable(PINGRP_ATB);
-       pinmux_tristate_disable(PINGRP_GMA);
-       pinmux_tristate_disable(PINGRP_GME);
-
-       /* SDMMC3: SDIO3_CLK, SDIO3_CMD, SDIO3_DAT[3:0] */
-       pinmux_set_func(PINGRP_SDB, PMUX_FUNC_SDIO3);
-       pinmux_set_func(PINGRP_SDC, PMUX_FUNC_SDIO3);
-       pinmux_set_func(PINGRP_SDD, PMUX_FUNC_SDIO3);
-
-       pinmux_tristate_disable(PINGRP_SDC);
-       pinmux_tristate_disable(PINGRP_SDD);
-       pinmux_tristate_disable(PINGRP_SDB);
+       funcmux_select(PERIPH_ID_SDMMC4, FUNCMUX_SDMMC4_ATB_GMA_GME_8_BIT);
+       funcmux_select(PERIPH_ID_SDMMC3, FUNCMUX_SDMMC3_SDB_4BIT);
 
        /* For power GPIO PI6 */
        pinmux_tristate_disable(PINGRP_ATA);
diff --git a/board/omicron/calimain/Makefile b/board/omicron/calimain/Makefile
new file mode 100644 (file)
index 0000000..cd1f0d4
--- /dev/null
@@ -0,0 +1,45 @@
+#
+# (C) Copyright 2000, 2001, 2002
+# Wolfgang Denk, DENX Software Engineering, wd@denx.de.
+#
+# Copyright (C) 2007 Sergey Kubushyn <ksi@koi8.net>
+#
+# See file CREDITS for list of people who contributed to this
+# project.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 2 of
+# the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public 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).o
+
+COBJS   := $(BOARD).o
+
+SRCS   := $(SOBJS:.o=.S) $(COBJS:.o=.c)
+OBJS   := $(addprefix $(obj),$(COBJS))
+SOBJS  := $(addprefix $(obj),$(SOBJS))
+
+$(LIB):        $(obj).depend $(OBJS) $(SOBJS)
+       $(call cmd_link_o_target, $(OBJS) $(SOBJS))
+
+#########################################################################
+# This is for $(obj).depend target
+include $(SRCTREE)/rules.mk
+
+sinclude $(obj).depend
+
+#########################################################################
diff --git a/board/omicron/calimain/calimain.c b/board/omicron/calimain/calimain.c
new file mode 100644 (file)
index 0000000..97ba74a
--- /dev/null
@@ -0,0 +1,188 @@
+/*
+ * Copyright (C) 2011 OMICRON electronics GmbH
+ *
+ * Based on da850evm.c. Original Copyrights follow:
+ *
+ * Copyright (C) 2010 Texas Instruments Incorporated - http://www.ti.com/
+ * Copyright (C) 2009 Nick Thompson, GE Fanuc, Ltd. <nick.thompson@gefanuc.com>
+ * Copyright (C) 2007 Sergey Kubushyn <ksi@koi8.net>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#include <common.h>
+#include <i2c.h>
+#include <net.h>
+#include <netdev.h>
+#include <watchdog.h>
+#include <asm/io.h>
+#include <asm/arch/hardware.h>
+#include <asm/arch/gpio.h>
+#include <asm/arch/emif_defs.h>
+#include <asm/arch/emac_defs.h>
+#include <asm/arch/pinmux_defs.h>
+#include <asm/arch/davinci_misc.h>
+#include <asm/arch/timer_defs.h>
+
+DECLARE_GLOBAL_DATA_PTR;
+
+#define CALIMAIN_HWVERSION_MASK    0x7f000000
+#define CALIMAIN_HWVERSION_SHIFT   24
+
+/* Hardware version pinmux settings */
+const struct pinmux_config hwversion_pins[] = {
+       { pinmux(16), 8, 2 }, /* GP7[15] */
+       { pinmux(16), 8, 3 }, /* GP7[14] */
+       { pinmux(16), 8, 4 }, /* GP7[13] */
+       { pinmux(16), 8, 5 }, /* GP7[12] */
+       { pinmux(16), 8, 6 }, /* GP7[11] */
+       { pinmux(16), 8, 7 }, /* GP7[10] */
+       { pinmux(17), 8, 0 }, /* GP7[9] */
+       { pinmux(17), 8, 1 }  /* GP7[8] */
+};
+
+const struct pinmux_resource pinmuxes[] = {
+       PINMUX_ITEM(uart2_pins_txrx),
+       PINMUX_ITEM(emac_pins_mii),
+       PINMUX_ITEM(emac_pins_mdio),
+       PINMUX_ITEM(emifa_pins_nor),
+       PINMUX_ITEM(emifa_pins_cs2),
+       PINMUX_ITEM(emifa_pins_cs3),
+};
+
+const int pinmuxes_size = ARRAY_SIZE(pinmuxes);
+
+const struct lpsc_resource lpsc[] = {
+       { DAVINCI_LPSC_AEMIF }, /* NAND, NOR */
+       { DAVINCI_LPSC_EMAC },  /* image download */
+       { DAVINCI_LPSC_UART2 }, /* console */
+       { DAVINCI_LPSC_GPIO },
+};
+
+const int lpsc_size = ARRAY_SIZE(lpsc);
+
+/* read board revision from GPIO7[8..14] */
+u32 get_board_rev(void)
+{
+       lpsc_on(DAVINCI_LPSC_GPIO);
+       if (davinci_configure_pin_mux(hwversion_pins,
+                                     ARRAY_SIZE(hwversion_pins)) != 0)
+               return 0xffffffff;
+
+       return (davinci_gpio_bank67->in_data & CALIMAIN_HWVERSION_MASK)
+               >> CALIMAIN_HWVERSION_SHIFT;
+}
+
+/*
+ * determine the oscillator frequency depending on the board revision
+ *
+ * rev 0x00  ... 25 MHz oscillator
+ * rev 0x01  ... 24 MHz oscillator
+ */
+int calimain_get_osc_freq(void)
+{
+       u32 rev;
+       int freq;
+
+       rev = get_board_rev();
+       switch (rev) {
+       case 0x00:
+               freq = 25000000;
+               break;
+       default:
+               freq = 24000000;
+               break;
+       }
+       return freq;
+}
+
+int board_init(void)
+{
+       int val;
+
+#ifndef CONFIG_USE_IRQ
+       irq_init();
+#endif
+
+       /* address of boot parameters */
+       gd->bd->bi_boot_params = LINUX_BOOT_PARAM_ADDR;
+
+#ifdef CONFIG_DRIVER_TI_EMAC
+       /* select emac MII mode */
+       val = readl(&davinci_syscfg_regs->cfgchip3);
+       val &= ~(1 << 8);
+       writel(val, &davinci_syscfg_regs->cfgchip3);
+#endif /* CONFIG_DRIVER_TI_EMAC */
+
+#ifdef CONFIG_HW_WATCHDOG
+       davinci_hw_watchdog_enable();
+#endif
+
+       printf("Input clock frequency: %d Hz\n", calimain_get_osc_freq());
+       printf("Board revision:        %d\n", get_board_rev());
+
+       return 0;
+}
+
+#ifdef CONFIG_DRIVER_TI_EMAC
+/*
+ * Initializes on-board ethernet controllers.
+ */
+int board_eth_init(bd_t *bis)
+{
+       if (!davinci_emac_initialize()) {
+               printf("Error: Ethernet init failed!\n");
+               return -1;
+       }
+
+       return 0;
+}
+#endif /* CONFIG_DRIVER_TI_EMAC */
+
+#ifdef CONFIG_HW_WATCHDOG
+void hw_watchdog_reset(void)
+{
+       davinci_hw_watchdog_reset();
+}
+#endif
+
+#if defined(CONFIG_BOOTCOUNT_LIMIT)
+void bootcount_store(ulong a)
+{
+       struct davinci_rtc *reg =
+               (struct davinci_rtc *)CONFIG_SYS_BOOTCOUNT_ADDR;
+
+       /*
+        * write RTC kick register to enable write
+        * for RTC Scratch registers. Cratch0 and 1 are
+        * used for bootcount values.
+        */
+       writel(RTC_KICK0R_WE, &reg->kick0r);
+       writel(RTC_KICK1R_WE, &reg->kick1r);
+       writel(a, &reg->scratch0);
+       writel(BOOTCOUNT_MAGIC, &reg->scratch1);
+}
+
+ulong bootcount_load(void)
+{
+       struct davinci_rtc *reg =
+               (struct davinci_rtc *)CONFIG_SYS_BOOTCOUNT_ADDR;
+
+       if (readl(&reg->scratch1) != BOOTCOUNT_MAGIC)
+               return 0;
+       else
+               return readl(&reg->scratch0);
+}
+#endif
diff --git a/board/pr1/Makefile b/board/pr1/Makefile
new file mode 100644 (file)
index 0000000..6ae998f
--- /dev/null
@@ -0,0 +1,50 @@
+#
+# U-boot - Makefile
+#
+# Copyright (c) Switchfin Org. <dpn@switchfin.org>
+#
+# Copyright (c) 2005-2007 Analog Device Inc.
+#
+# (C) Copyright 2000-2006
+# Wolfgang Denk, DENX Software Engineering, wd@denx.de.
+#
+# See file CREDITS for list of people who contributed to this
+# project.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 2 of
+# the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+# MA 02111-1307 USA
+#
+
+include $(TOPDIR)/config.mk
+
+LIB    = $(obj)lib$(BOARD).o
+
+COBJS-y        := $(BOARD).o
+
+SRCS   := $(SOBJS-y:.o=.S) $(COBJS-y:.o=.c)
+OBJS   := $(addprefix $(obj),$(COBJS-y))
+SOBJS  := $(addprefix $(obj),$(SOBJS-y))
+
+$(LIB):        $(obj).depend $(OBJS) $(SOBJS)
+       $(call cmd_link_o_target, $(OBJS) $(SOBJS))
+
+#########################################################################
+
+# defines $(obj).depend target
+include $(SRCTREE)/rules.mk
+
+sinclude $(obj).depend
+
+#########################################################################
diff --git a/board/pr1/config.mk b/board/pr1/config.mk
new file mode 100644 (file)
index 0000000..fac20c5
--- /dev/null
@@ -0,0 +1,30 @@
+#
+# Copyright (c) Switchfin Org. <dpn@switchfin.org>
+#
+# Copyright (c) 2005-2008 Analog Device Inc.
+#
+# (C) Copyright 2001
+# Wolfgang Denk, DENX Software Engineering, wd@denx.de.
+#
+# See file CREDITS for list of people who contributed to this
+# project.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 2 of
+# the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+# MA 02111-1307 USA
+#
+
+CFLAGS_lib += -O2
+CFLAGS_lib/lzma += -O2
+CFLAGS_lib/zlib += -O2
diff --git a/board/pr1/pr1.c b/board/pr1/pr1.c
new file mode 100644 (file)
index 0000000..bb907f3
--- /dev/null
@@ -0,0 +1,30 @@
+/*
+ * U-boot - main board file
+ *
+ * Copyright (c) Switchfin Org. <dpn@switchfin.org>
+ *
+ * Copyright (c) 2005-2008 Analog Devices Inc.
+ *
+ * (C) Copyright 2000-2004
+ * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
+ *
+ * Licensed under the GPL-2 or later.
+ */
+
+#include <common.h>
+#include <net.h>
+#include <netdev.h>
+
+int checkboard(void)
+{
+       printf("Board: Switchvoice PR1 Appliance\n");
+       printf("       Support: http://www.switchvoice.com/\n");
+       return 0;
+}
+
+#ifdef CONFIG_BFIN_MAC
+int board_eth_init(bd_t *bis)
+{
+       return bfin_EMAC_initialize(bis);
+}
+#endif
index 0eebbfc24487e349e22a035aa8fe9b3ff6adf914..928320120160a63fc1e18e7cdf0888ad000a1e48 100644 (file)
@@ -158,6 +158,11 @@ system_clock_init:
        ldr     r2, =CLK_SRC_PERIL0_OFFSET
        str     r1, [r0, r2]
 
+       /* FIMD0 */
+       ldr     r1, =CLK_SRC_LCD0_VAL
+       ldr     r2, =CLK_SRC_LCD0_OFFSET
+       str     r1, [r0, r2]
+
        /* wait ?us */
        mov     r1, #0x10000
 3:     subs    r1, r1, #1
index d949ad27b848220b341f3c39430eaf7a189e967f..94cccca52c1b0e855f8fe08ea9d14e77b4f14b33 100644 (file)
@@ -56,6 +56,8 @@
 #define CLK_SRC_PERIL0_OFFSET  0xC250
 #define CLK_DIV_PERIL0_OFFSET  0xC550
 
+#define CLK_SRC_LCD0_OFFSET    0xC234
+
 #define APLL_LOCK_OFFSET       0x14000
 #define MPLL_LOCK_OFFSET       0x14008
 #define APLL_CON0_OFFSET       0x14100
                                | (UART1_RATIO << 4) \
                                | (UART0_RATIO << 0))
 
+/* CLK_SRC_LCD0 */
+#define FIMD_SEL_SCLKMPLL      6
+#define MDNIE0_SEL_XUSBXTI     1
+#define MDNIE_PWM0_SEL_XUSBXTI 1
+#define MIPI0_SEL_XUSBXTI      1
+#define CLK_SRC_LCD0_VAL       ((MIPI0_SEL_XUSBXTI << 12) \
+                               | (MDNIE_PWM0_SEL_XUSBXTI << 8) \
+                               | (MDNIE0_SEL_XUSBXTI << 4) \
+                               | (FIMD_SEL_SCLKMPLL << 0))
+
 /* Required period to generate a stable clock output */
 /* PLL_LOCK_TIME */
 #define PLL_LOCKTIME           0x1C20
diff --git a/board/samsung/smdk5250/Makefile b/board/samsung/smdk5250/Makefile
new file mode 100644 (file)
index 0000000..226db1f
--- /dev/null
@@ -0,0 +1,58 @@
+#
+# Copyright (C) 2012 Samsung Electronics
+#
+# See file CREDITS for list of people who contributed to this
+# project.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 2 of
+# the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public 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).o
+
+SOBJS  := lowlevel_init.o
+
+COBJS  := clock_init.o
+COBJS  += dmc_init.o
+COBJS  += tzpc_init.o
+
+ifndef CONFIG_SPL_BUILD
+COBJS  += smdk5250.o
+endif
+
+ifdef CONFIG_SPL_BUILD
+COBJS  += mmc_boot.o
+endif
+
+SRCS   := $(SOBJS:.o=.S) $(COBJS:.o=.c)
+OBJS   := $(addprefix $(obj),$(COBJS) $(SOBJS))
+
+ALL    :=       $(obj).depend $(LIB)
+
+all:   $(ALL)
+
+$(LIB):        $(OBJS)
+       $(call cmd_link_o_target, $(OBJS))
+
+#########################################################################
+
+# defines $(obj).depend target
+include $(SRCTREE)/rules.mk
+
+sinclude $(obj).depend
+
+#########################################################################
diff --git a/board/samsung/smdk5250/clock_init.c b/board/samsung/smdk5250/clock_init.c
new file mode 100644 (file)
index 0000000..305842d
--- /dev/null
@@ -0,0 +1,202 @@
+/*
+ * Clock setup for SMDK5250 board based on EXYNOS5
+ *
+ * Copyright (C) 2012 Samsung Electronics
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+#include <config.h>
+#include <version.h>
+#include <asm/io.h>
+#include <asm/arch/clock.h>
+#include <asm/arch/cpu.h>
+#include <asm/arch/gpio.h>
+#include "setup.h"
+
+void system_clock_init()
+{
+       struct exynos5_clock *clk = (struct exynos5_clock *)EXYNOS5_CLOCK_BASE;
+
+       /*
+        * MUX_APLL_SEL[0]: FINPLL = 0
+        * MUX_CPU_SEL[6]: MOUTAPLL = 0
+        * MUX_HPM_SEL[20]: MOUTAPLL = 0
+        */
+       writel(0x0, &clk->src_cpu);
+
+       /* MUX_MPLL_SEL[8]: FINPLL = 0 */
+       writel(0x0, &clk->src_core1);
+
+       /*
+        * VPLLSRC_SEL[0]: FINPLL = 0
+        * MUX_{CPLL[8]}|{EPLL[12]}|{VPLL[16]}_SEL: FINPLL = 0
+        */
+       writel(0x0, &clk->src_top2);
+
+       /* MUX_BPLL_SEL[0]: FINPLL = 0 */
+       writel(0x0, &clk->src_cdrex);
+
+       /* MUX_ACLK_* Clock Selection */
+       writel(CLK_SRC_TOP0_VAL, &clk->src_top0);
+
+       /* MUX_ACLK_* Clock Selection */
+       writel(CLK_SRC_TOP1_VAL, &clk->src_top1);
+
+       /* MUX_ACLK_* Clock Selection */
+       writel(CLK_SRC_TOP3_VAL, &clk->src_top3);
+
+       /* MUX_PWI_SEL[19:16]: SCLKMPLL = 6 */
+       writel(CLK_SRC_CORE0_VAL, &clk->src_core0);
+
+       /* MUX_ATCLK_LEX[0]: ACLK_200 = 0 */
+       writel(CLK_SRC_LEX_VAL, &clk->src_lex);
+
+       /* UART [0-5]: SCLKMPLL = 6 */
+       writel(CLK_SRC_PERIC0_VAL, &clk->src_peric0);
+
+       /* Set Clock Ratios */
+       writel(CLK_DIV_CPU0_VAL, &clk->div_cpu0);
+
+       /* Set COPY and HPM Ratio */
+       writel(CLK_DIV_CPU1_VAL, &clk->div_cpu1);
+
+       /* CORED_RATIO, COREP_RATIO */
+       writel(CLK_DIV_CORE0_VAL, &clk->div_core0);
+
+       /* PWI_RATIO[11:8], DVSEM_RATIO[22:16], DPM_RATIO[24:20] */
+       writel(CLK_DIV_CORE1_VAL, &clk->div_core1);
+
+       /* ACLK_*_RATIO */
+       writel(CLK_DIV_TOP0_VAL, &clk->div_top0);
+
+       /* ACLK_*_RATIO */
+       writel(CLK_DIV_TOP1_VAL, &clk->div_top1);
+
+       /* CDREX Ratio */
+       writel(CLK_DIV_CDREX_INIT_VAL, &clk->div_cdrex);
+
+       /* MCLK_EFPHY_RATIO[3:0] */
+       writel(CLK_DIV_CDREX2_VAL, &clk->div_cdrex2);
+
+       /* {PCLK[4:6]|ATCLK[10:8]}_RATIO */
+       writel(CLK_DIV_LEX_VAL, &clk->div_lex);
+
+       /* PCLK_R0X_RATIO[3:0] */
+       writel(CLK_DIV_R0X_VAL, &clk->div_r0x);
+
+       /* PCLK_R1X_RATIO[3:0] */
+       writel(CLK_DIV_R1X_VAL, &clk->div_r1x);
+
+       /* SATA[24]: SCLKMPLL=0, MMC[0-4]: SCLKMPLL = 6 */
+       writel(CLK_SRC_FSYS_VAL, &clk->src_fsys);
+
+       /* UART[0-4] */
+       writel(CLK_DIV_PERIC0_VAL, &clk->div_peric0);
+
+       /* PWM_RATIO[3:0] */
+       writel(CLK_DIV_PERIC3_VAL, &clk->div_peric3);
+
+       /* SATA_RATIO, USB_DRD_RATIO */
+       writel(CLK_DIV_FSYS0_VAL, &clk->div_fsys0);
+
+       /* MMC[0-1] */
+       writel(CLK_DIV_FSYS1_VAL, &clk->div_fsys1);
+
+       /* MMC[2-3] */
+       writel(CLK_DIV_FSYS2_VAL, &clk->div_fsys2);
+
+       /* MMC[4] */
+       writel(CLK_DIV_FSYS3_VAL, &clk->div_fsys3);
+
+       /* ACLK|PLCK_ACP_RATIO */
+       writel(CLK_DIV_ACP_VAL, &clk->div_acp);
+
+       /* ISPDIV0_RATIO, ISPDIV1_RATIO */
+       writel(CLK_DIV_ISP0_VAL, &clk->div_isp0);
+
+       /* MCUISPDIV0_RATIO, MCUISPDIV1_RATIO */
+       writel(CLK_DIV_ISP1_VAL, &clk->div_isp1);
+
+       /* MPWMDIV_RATIO */
+       writel(CLK_DIV_ISP2_VAL, &clk->div_isp2);
+
+       /* PLL locktime */
+       writel(APLL_LOCK_VAL, &clk->apll_lock);
+
+       writel(MPLL_LOCK_VAL, &clk->mpll_lock);
+
+       writel(BPLL_LOCK_VAL, &clk->bpll_lock);
+
+       writel(CPLL_LOCK_VAL, &clk->cpll_lock);
+
+       writel(EPLL_LOCK_VAL, &clk->epll_lock);
+
+       writel(VPLL_LOCK_VAL, &clk->vpll_lock);
+
+       sdelay(0x10000);
+
+       /* Set APLL */
+       writel(APLL_CON1_VAL, &clk->apll_con1);
+       writel(APLL_CON0_VAL, &clk->apll_con0);
+       sdelay(0x30000);
+
+       /* Set MPLL */
+       writel(MPLL_CON1_VAL, &clk->mpll_con1);
+       writel(MPLL_CON0_VAL, &clk->mpll_con0);
+       sdelay(0x30000);
+       writel(BPLL_CON1_VAL, &clk->bpll_con1);
+       writel(BPLL_CON0_VAL, &clk->bpll_con0);
+       sdelay(0x30000);
+
+       /* Set CPLL */
+       writel(CPLL_CON1_VAL, &clk->cpll_con1);
+       writel(CPLL_CON0_VAL, &clk->cpll_con0);
+       sdelay(0x30000);
+
+       /* Set EPLL */
+       writel(EPLL_CON2_VAL, &clk->epll_con2);
+       writel(EPLL_CON1_VAL, &clk->epll_con1);
+       writel(EPLL_CON0_VAL, &clk->epll_con0);
+       sdelay(0x30000);
+
+       /* Set VPLL */
+       writel(VPLL_CON2_VAL, &clk->vpll_con2);
+       writel(VPLL_CON1_VAL, &clk->vpll_con1);
+       writel(VPLL_CON0_VAL, &clk->vpll_con0);
+       sdelay(0x30000);
+
+       /* Set MPLL */
+       /* After Initiallising th PLL select the sources accordingly */
+       /* MUX_APLL_SEL[0]: MOUTAPLLFOUT = 1 */
+       writel(CLK_SRC_CPU_VAL, &clk->src_cpu);
+
+       /* MUX_MPLL_SEL[8]: MOUTMPLLFOUT = 1 */
+       writel(CLK_SRC_CORE1_VAL, &clk->src_core1);
+
+       /* MUX_BPLL_SEL[0]: FOUTBPLL = 1*/
+       writel(CLK_SRC_CDREX_INIT_VAL, &clk->src_cdrex);
+
+       /*
+        * VPLLSRC_SEL[0]: FINPLL = 0
+        * MUX_{CPLL[8]}|{EPLL[12]}|{VPLL[16]}_SEL: MOUT{CPLL|EPLL|VPLL} = 1
+        * MUX_{MPLL[20]}|{BPLL[24]}_USER_SEL: FOUT{MPLL|BPLL} = 1
+        */
+       writel(CLK_SRC_TOP2_VAL, &clk->src_top2);
+}
diff --git a/board/samsung/smdk5250/dmc_init.c b/board/samsung/smdk5250/dmc_init.c
new file mode 100644 (file)
index 0000000..7881074
--- /dev/null
@@ -0,0 +1,462 @@
+/*
+ * Memory setup for SMDK5250 board based on EXYNOS5
+ *
+ * Copyright (C) 2012 Samsung Electronics
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+#include <config.h>
+#include <asm/io.h>
+#include <asm/arch/dmc.h>
+#include <asm/arch/clock.h>
+#include <asm/arch/cpu.h>
+#include "setup.h"
+
+/* APLL : 1GHz */
+/* MCLK_CDREX: MCLK_CDREX_533*/
+/* LPDDR support: LPDDR2 */
+static void reset_phy_ctrl(void);
+static void config_zq(struct exynos5_phy_control *,
+                       struct exynos5_phy_control *);
+static void update_reset_dll(struct exynos5_dmc *);
+static void config_cdrex(void);
+static void config_mrs(struct exynos5_dmc *);
+static void sec_sdram_phy_init(struct exynos5_dmc *);
+static void config_prech(struct exynos5_dmc *);
+static void config_rdlvl(struct exynos5_dmc *,
+                       struct exynos5_phy_control *,
+                       struct exynos5_phy_control *);
+static void config_memory(struct exynos5_dmc *);
+
+static void config_offsets(unsigned int,
+                               struct exynos5_phy_control *,
+                               struct exynos5_phy_control *);
+
+static void reset_phy_ctrl(void)
+{
+       struct exynos5_clock *clk = (struct exynos5_clock *)EXYNOS5_CLOCK_BASE;
+
+       writel(PHY_RESET_VAL, &clk->lpddr3phy_ctrl);
+       sdelay(0x10000);
+}
+
+static void config_zq(struct exynos5_phy_control *phy0_ctrl,
+                       struct exynos5_phy_control *phy1_ctrl)
+{
+       unsigned long val = 0;
+       /*
+        * ZQ Calibration:
+        * Select Driver Strength,
+        * long calibration for manual calibration
+        */
+       val = PHY_CON16_RESET_VAL;
+       SET_ZQ_MODE_DDS_VAL(val);
+       SET_ZQ_MODE_TERM_VAL(val);
+       val |= ZQ_CLK_DIV_EN;
+       writel(val, &phy0_ctrl->phy_con16);
+       writel(val, &phy1_ctrl->phy_con16);
+
+       /* Disable termination */
+       val |= ZQ_MODE_NOTERM;
+       writel(val, &phy0_ctrl->phy_con16);
+       writel(val, &phy1_ctrl->phy_con16);
+
+       /* ZQ_MANUAL_START: Enable */
+       val |= ZQ_MANUAL_STR;
+       writel(val, &phy0_ctrl->phy_con16);
+       writel(val, &phy1_ctrl->phy_con16);
+       sdelay(0x10000);
+
+       /* ZQ_MANUAL_START: Disable */
+       val &= ~ZQ_MANUAL_STR;
+       writel(val, &phy0_ctrl->phy_con16);
+       writel(val, &phy1_ctrl->phy_con16);
+}
+
+static void update_reset_dll(struct exynos5_dmc *dmc)
+{
+       unsigned long val;
+       /*
+        * Update DLL Information:
+        * Force DLL Resyncronization
+        */
+       val = readl(&dmc->phycontrol0);
+       val |= FP_RSYNC;
+       writel(val, &dmc->phycontrol0);
+
+       /* Reset Force DLL Resyncronization */
+       val = readl(&dmc->phycontrol0);
+       val &= ~FP_RSYNC;
+       writel(val, &dmc->phycontrol0);
+}
+
+static void config_mrs(struct exynos5_dmc *dmc)
+{
+       unsigned long channel, chip, mask = 0, val;
+
+       for (channel = 0; channel < CONFIG_DMC_CHANNELS; channel++) {
+               SET_CMD_CHANNEL(mask, channel);
+               for (chip = 0; chip < CONFIG_CHIPS_PER_CHANNEL; chip++) {
+                       /*
+                        * NOP CMD:
+                        * Assert and hold CKE to logic high level
+                        */
+                       SET_CMD_CHIP(mask, chip);
+                       val = DIRECT_CMD_NOP | mask;
+                       writel(val, &dmc->directcmd);
+                       sdelay(0x10000);
+
+                       /* EMRS, MRS Cmds(Mode Reg Settings) Using Direct Cmd */
+                       val = DIRECT_CMD_MRS1 | mask;
+                       writel(val, &dmc->directcmd);
+                       sdelay(0x10000);
+
+                       val = DIRECT_CMD_MRS2 | mask;
+                       writel(val, &dmc->directcmd);
+                       sdelay(0x10000);
+
+                       /* MCLK_CDREX_533 */
+                       val = DIRECT_CMD_MRS3 | mask;
+                       writel(val, &dmc->directcmd);
+                       sdelay(0x10000);
+
+                       val = DIRECT_CMD_MRS4 | mask;
+                       writel(val, &dmc->directcmd);
+                       sdelay(0x10000);
+               }
+       }
+}
+
+static void config_prech(struct exynos5_dmc *dmc)
+{
+       unsigned long channel, chip, mask = 0, val;
+
+       for (channel = 0; channel < CONFIG_DMC_CHANNELS; channel++) {
+               SET_CMD_CHANNEL(mask, channel);
+               for (chip = 0; chip < CONFIG_CHIPS_PER_CHANNEL; chip++) {
+                       SET_CMD_CHIP(mask, chip);
+                       /* PALL (all banks precharge) CMD */
+                       val = DIRECT_CMD_PALL | mask;
+                       writel(val, &dmc->directcmd);
+                       sdelay(0x10000);
+               }
+       }
+}
+
+static void sec_sdram_phy_init(struct exynos5_dmc *dmc)
+{
+       unsigned long val;
+       val = readl(&dmc->concontrol);
+       val |= DFI_INIT_START;
+       writel(val, &dmc->concontrol);
+       sdelay(0x10000);
+
+       val = readl(&dmc->concontrol);
+       val &= ~DFI_INIT_START;
+       writel(val, &dmc->concontrol);
+}
+
+static void config_offsets(unsigned int state,
+                               struct exynos5_phy_control *phy0_ctrl,
+                               struct exynos5_phy_control *phy1_ctrl)
+{
+       unsigned long val;
+       /* Set Offsets to read DQS */
+       val = (state == SET) ? SET_DQS_OFFSET_VAL : RESET_DQS_OFFSET_VAL;
+       writel(val, &phy0_ctrl->phy_con4);
+       writel(val, &phy1_ctrl->phy_con4);
+
+       /* Set Offsets to read DQ */
+       val = (state == SET) ? SET_DQ_OFFSET_VAL : RESET_DQ_OFFSET_VAL;
+       writel(val, &phy0_ctrl->phy_con6);
+       writel(val, &phy1_ctrl->phy_con6);
+
+       /* Debug Offset */
+       val = (state == SET) ? SET_DEBUG_OFFSET_VAL : RESET_DEBUG_OFFSET_VAL;
+       writel(val, &phy0_ctrl->phy_con10);
+       writel(val, &phy1_ctrl->phy_con10);
+}
+
+static void config_cdrex(void)
+{
+       struct exynos5_clock *clk = (struct exynos5_clock *)EXYNOS5_CLOCK_BASE;
+       writel(CLK_DIV_CDREX_VAL, &clk->div_cdrex);
+       writel(CLK_SRC_CDREX_VAL, &clk->src_cdrex);
+       sdelay(0x30000);
+}
+
+static void config_ctrl_dll_on(unsigned int state,
+                       unsigned int ctrl_force_val,
+                       struct exynos5_phy_control *phy0_ctrl,
+                       struct exynos5_phy_control *phy1_ctrl)
+{
+       unsigned long val;
+       val = readl(&phy0_ctrl->phy_con12);
+       CONFIG_CTRL_DLL_ON(val, state);
+       SET_CTRL_FORCE_VAL(val, ctrl_force_val);
+       writel(val, &phy0_ctrl->phy_con12);
+
+       val = readl(&phy1_ctrl->phy_con12);
+       CONFIG_CTRL_DLL_ON(val, state);
+       SET_CTRL_FORCE_VAL(val, ctrl_force_val);
+       writel(val, &phy1_ctrl->phy_con12);
+}
+
+static void config_ctrl_start(unsigned int state,
+                       struct exynos5_phy_control *phy0_ctrl,
+                       struct exynos5_phy_control *phy1_ctrl)
+{
+       unsigned long val;
+       val = readl(&phy0_ctrl->phy_con12);
+       CONFIG_CTRL_START(val, state);
+       writel(val, &phy0_ctrl->phy_con12);
+
+       val = readl(&phy1_ctrl->phy_con12);
+       CONFIG_CTRL_START(val, state);
+       writel(val, &phy1_ctrl->phy_con12);
+}
+
+#if defined(CONFIG_RD_LVL)
+static void config_rdlvl(struct exynos5_dmc *dmc,
+                       struct exynos5_phy_control *phy0_ctrl,
+                       struct exynos5_phy_control *phy1_ctrl)
+{
+       unsigned long val;
+
+       /* Disable CTRL_DLL_ON and set ctrl_force */
+       config_ctrl_dll_on(RESET, 0x2D, phy0_ctrl, phy1_ctrl);
+
+       /*
+        * Set ctrl_gateadj, ctrl_readadj
+        * ctrl_gateduradj, rdlvl_pass_adj
+        * rdlvl_rddataPadj
+        */
+       val = SET_RDLVL_RDDATAPADJ;
+       writel(val, &phy0_ctrl->phy_con1);
+       writel(val, &phy1_ctrl->phy_con1);
+
+       /* LPDDR2 Address */
+       writel(LPDDR2_ADDR, &phy0_ctrl->phy_con22);
+       writel(LPDDR2_ADDR, &phy1_ctrl->phy_con22);
+
+       /* Enable Byte Read Leveling set ctrl_ddr_mode */
+       val = readl(&phy0_ctrl->phy_con0);
+       val |= BYTE_RDLVL_EN;
+       writel(val, &phy0_ctrl->phy_con0);
+       val = readl(&phy1_ctrl->phy_con0);
+       val |= BYTE_RDLVL_EN;
+       writel(val, &phy1_ctrl->phy_con0);
+
+       /* rdlvl_en: Use levelling offset instead ctrl_shiftc */
+       val = PHY_CON2_RESET_VAL | RDLVL_EN;
+       writel(val, &phy0_ctrl->phy_con2);
+       writel(val, &phy1_ctrl->phy_con2);
+       sdelay(0x10000);
+
+       /* Enable Data Eye Training */
+       val = readl(&dmc->rdlvl_config);
+       val |= CTRL_RDLVL_DATA_EN;
+       writel(val, &dmc->rdlvl_config);
+       sdelay(0x10000);
+
+       /* Disable Data Eye Training */
+       val = readl(&dmc->rdlvl_config);
+       val &= ~CTRL_RDLVL_DATA_EN;
+       writel(val, &dmc->rdlvl_config);
+
+       /* RdDeSkew_clear: Clear */
+       val = readl(&phy0_ctrl->phy_con2);
+       val |= RDDSKEW_CLEAR;
+       writel(val, &phy0_ctrl->phy_con2);
+       val = readl(&phy1_ctrl->phy_con2);
+       val |= RDDSKEW_CLEAR;
+       writel(val, &phy1_ctrl->phy_con2);
+
+       /* Enable CTRL_DLL_ON */
+       config_ctrl_dll_on(SET, 0x0, phy0_ctrl, phy1_ctrl);
+
+       update_reset_dll(dmc);
+       sdelay(0x10000);
+
+       /* ctrl_atgte: ctrl_gate_p*, ctrl_read_p* generated by PHY */
+       val = readl(&phy0_ctrl->phy_con0);
+       val &= ~CTRL_ATGATE;
+       writel(val, &phy0_ctrl->phy_con0);
+       val = readl(&phy1_ctrl->phy_con0);
+       val &= ~CTRL_ATGATE;
+       writel(val, &phy1_ctrl->phy_con0);
+}
+#endif
+
+static void config_memory(struct exynos5_dmc *dmc)
+{
+       /*
+        * Memory Configuration Chip 0
+        * Address Mapping: Interleaved
+        * Number of Column address Bits: 10 bits
+        * Number of Rows Address Bits: 14
+        * Number of Banks: 8
+        */
+       writel(DMC_MEMCONFIG0_VAL, &dmc->memconfig0);
+
+       /*
+        * Memory Configuration Chip 1
+        * Address Mapping: Interleaved
+        * Number of Column address Bits: 10 bits
+        * Number of Rows Address Bits: 14
+        * Number of Banks: 8
+        */
+       writel(DMC_MEMCONFIG1_VAL, &dmc->memconfig1);
+
+       /*
+        * Chip0: AXI
+        * AXI Base Address: 0x40000000
+        * AXI Base Address Mask: 0x780
+        */
+       writel(DMC_MEMBASECONFIG0_VAL, &dmc->membaseconfig0);
+
+       /*
+        * Chip1: AXI
+        * AXI Base Address: 0x80000000
+        * AXI Base Address Mask: 0x780
+        */
+       writel(DMC_MEMBASECONFIG1_VAL, &dmc->membaseconfig1);
+}
+
+void mem_ctrl_init()
+{
+       struct exynos5_phy_control *phy0_ctrl, *phy1_ctrl;
+       struct exynos5_dmc *dmc;
+       unsigned long val;
+
+       phy0_ctrl = (struct exynos5_phy_control *)EXYNOS5_DMC_PHY0_BASE;
+       phy1_ctrl = (struct exynos5_phy_control *)EXYNOS5_DMC_PHY1_BASE;
+       dmc = (struct exynos5_dmc *)EXYNOS5_DMC_CTRL_BASE;
+
+       /* Reset PHY Controllor: PHY_RESET[0] */
+       reset_phy_ctrl();
+
+       /*set Read Latancy and Burst Length for PHY0 and PHY1 */
+       writel(PHY_CON42_VAL, &phy0_ctrl->phy_con42);
+       writel(PHY_CON42_VAL, &phy1_ctrl->phy_con42);
+
+       /* ZQ Cofiguration */
+       config_zq(phy0_ctrl, phy1_ctrl);
+
+       /* Operation Mode : LPDDR2 */
+       val = PHY_CON0_RESET_VAL;
+       SET_CTRL_DDR_MODE(val, DDR_MODE_LPDDR2);
+       writel(val, &phy0_ctrl->phy_con0);
+       writel(val, &phy1_ctrl->phy_con0);
+
+       /* DQS, DQ: Signal, for LPDDR2: Always Set */
+       val = CTRL_PULLD_DQ | CTRL_PULLD_DQS;
+       writel(val, &phy0_ctrl->phy_con14);
+       writel(val, &phy1_ctrl->phy_con14);
+
+       /* Init SEC SDRAM PHY */
+       sec_sdram_phy_init(dmc);
+       sdelay(0x10000);
+
+       update_reset_dll(dmc);
+
+       /*
+        * Dynamic Clock: Always Running
+        * Memory Burst length: 4
+        * Number of chips: 2
+        * Memory Bus width: 32 bit
+        * Memory Type: LPDDR2-S4
+        * Additional Latancy for PLL: 1 Cycle
+        */
+       writel(DMC_MEMCONTROL_VAL, &dmc->memcontrol);
+
+       config_memory(dmc);
+
+       /* Precharge Configuration */
+       writel(DMC_PRECHCONFIG_VAL, &dmc->prechconfig);
+
+       /* Power Down mode Configuration */
+       writel(DMC_PWRDNCONFIG_VAL, &dmc->pwrdnconfig);
+
+       /* Periodic Refrese Interval */
+       writel(DMC_TIMINGREF_VAL, &dmc->timingref);
+
+       /*
+        * TimingRow, TimingData, TimingPower Setting:
+        * Values as per Memory AC Parameters
+        */
+       writel(DMC_TIMINGROW_VAL, &dmc->timingrow);
+
+       writel(DMC_TIMINGDATA_VAL, &dmc->timingdata);
+
+       writel(DMC_TIMINGPOWER_VAL, &dmc->timingpower);
+
+       /* Memory Channel Inteleaving Size: 128 Bytes */
+       writel(CONFIG_IV_SIZE, &dmc->ivcontrol);
+
+       /* Set DQS, DQ and DEBUG offsets */
+       config_offsets(SET, phy0_ctrl, phy1_ctrl);
+
+       /* Disable CTRL_DLL_ON and set ctrl_force */
+       config_ctrl_dll_on(RESET, 0x7F, phy0_ctrl, phy1_ctrl);
+       sdelay(0x10000);
+
+       update_reset_dll(dmc);
+
+       /* Config MRS(Mode Register Settingg) */
+       config_mrs(dmc);
+
+       config_cdrex();
+
+       /* Reset DQS DQ and DEBUG offsets */
+       config_offsets(RESET, phy0_ctrl, phy1_ctrl);
+
+       /* Enable CTRL_DLL_ON */
+       config_ctrl_dll_on(SET, 0x0, phy0_ctrl, phy1_ctrl);
+
+       /* Stop DLL Locking */
+       config_ctrl_start(RESET, phy0_ctrl, phy1_ctrl);
+       sdelay(0x10000);
+
+       /* Start DLL Locking */
+       config_ctrl_start(SET, phy0_ctrl, phy1_ctrl);
+       sdelay(0x10000);
+
+       update_reset_dll(dmc);
+
+#if defined(CONFIG_RD_LVL)
+       config_rdlvl(dmc, phy0_ctrl, phy1_ctrl);
+#endif
+       config_prech(dmc);
+
+       /*
+        * Dynamic Clock: Stops During Idle Period
+        * Dynamic Power Down: Enable
+        * Dynamic Self refresh: Enable
+        */
+       val = readl(&dmc->memcontrol);
+       val |= CLK_STOP_EN | DPWRDN_EN | DSREF_EN;
+       writel(val, &dmc->memcontrol);
+
+       /* Start Auto refresh */
+       val = readl(&dmc->concontrol);
+       val |= AREF_EN;
+       writel(val, &dmc->concontrol);
+}
diff --git a/board/samsung/smdk5250/lowlevel_init.S b/board/samsung/smdk5250/lowlevel_init.S
new file mode 100644 (file)
index 0000000..bc6cb6f
--- /dev/null
@@ -0,0 +1,96 @@
+/*
+ * Lowlevel setup for SMDK5250 board based on S5PC520
+ *
+ * Copyright (C) 2012 Samsung Electronics
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+#include <config.h>
+#include <version.h>
+#include <asm/arch/cpu.h>
+
+_TEXT_BASE:
+       .word   CONFIG_SYS_TEXT_BASE
+
+       .globl lowlevel_init
+lowlevel_init:
+
+       /* use iRAM stack in bl2 */
+       ldr     sp, =CONFIG_IRAM_STACK
+       stmdb   r13!, {ip,lr}
+
+       /* check reset status */
+       ldr     r0, =(EXYNOS5_POWER_BASE + INFORM1_OFFSET)
+       ldr     r1, [r0]
+
+       /* AFTR wakeup reset */
+       ldr     r2, =S5P_CHECK_DIDLE
+       cmp     r1, r2
+       beq     exit_wakeup
+
+       /* LPA wakeup reset */
+       ldr     r2, =S5P_CHECK_LPA
+       cmp     r1, r2
+       beq     exit_wakeup
+
+       /* Sleep wakeup reset */
+       ldr     r2, =S5P_CHECK_SLEEP
+       cmp     r1, r2
+       beq     wakeup_reset
+
+       /*
+        * If U-boot is already running in RAM, no need to relocate U-Boot.
+        * Memory controller must be configured before relocating U-Boot
+        * in ram.
+        */
+       ldr     r0, =0x0ffffff          /* r0 <- Mask Bits*/
+       bic     r1, pc, r0              /* pc <- current addr of code */
+                                       /* r1 <- unmasked bits of pc */
+       ldr     r2, _TEXT_BASE          /* r2 <- original base addr in ram */
+       bic     r2, r2, r0              /* r2 <- unmasked bits of r2*/
+       cmp     r1, r2                  /* compare r1, r2 */
+       beq     1f                      /* r0 == r1 then skip sdram init */
+
+       /* init system clock */
+       bl      system_clock_init
+
+       /* Memory initialize */
+       bl      mem_ctrl_init
+
+1:
+       bl      tzpc_init
+       ldmia   r13!, {ip,pc}
+
+wakeup_reset:
+       bl      system_clock_init
+       bl      mem_ctrl_init
+       bl      tzpc_init
+
+exit_wakeup:
+       /* Load return address and jump to kernel */
+       ldr     r0, =(EXYNOS5_POWER_BASE + INFORM0_OFFSET)
+
+       /* r1 = physical address of exynos5_cpu_resume function*/
+       ldr     r1, [r0]
+
+       /* Jump to kernel */
+       mov     pc, r1
+       nop
+       nop
diff --git a/board/samsung/smdk5250/mmc_boot.c b/board/samsung/smdk5250/mmc_boot.c
new file mode 100644 (file)
index 0000000..449a919
--- /dev/null
@@ -0,0 +1,58 @@
+/*
+ * Copyright (C) 2012 Samsung Electronics
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public 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>
+
+/*
+* Copy U-boot from mmc to RAM:
+* COPY_BL2_FNPTR_ADDR: Address in iRAM, which Contains
+* Pointer to API (Data transfer from mmc to ram)
+*/
+void copy_uboot_to_ram(void)
+{
+       u32 (*copy_bl2)(u32, u32, u32) = (void *) *(u32 *)COPY_BL2_FNPTR_ADDR;
+
+       copy_bl2(BL2_START_OFFSET, BL2_SIZE_BLOC_COUNT, CONFIG_SYS_TEXT_BASE);
+}
+
+void board_init_f(unsigned long bootflag)
+{
+       __attribute__((noreturn)) void (*uboot)(void);
+       copy_uboot_to_ram();
+
+       /* Jump to U-Boot image */
+       uboot = (void *)CONFIG_SYS_TEXT_BASE;
+       (*uboot)();
+       /* Never returns Here */
+}
+
+/* Place Holders */
+void board_init_r(gd_t *id, ulong dest_addr)
+{
+       /* Function attribute is no-return */
+       /* This Function never executes */
+       while (1)
+               ;
+}
+
+void save_boot_params(u32 r0, u32 r1, u32 r2, u32 r3) {}
diff --git a/board/samsung/smdk5250/setup.h b/board/samsung/smdk5250/setup.h
new file mode 100644 (file)
index 0000000..1276fd3
--- /dev/null
@@ -0,0 +1,451 @@
+/*
+ * Machine Specific Values for SMDK5250 board based on S5PC520
+ *
+ * Copyright (C) 2012 Samsung Electronics
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public 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 _SMDK5250_SETUP_H
+#define _SMDK5250_SETUP_H
+
+#include <config.h>
+#include <version.h>
+#include <asm/arch/cpu.h>
+
+/* GPIO Offsets for UART: GPIO Contol Register */
+#define EXYNOS5_GPIO_A0_CON_OFFSET     0x0
+#define EXYNOS5_GPIO_A1_CON_OFFSET     0x20
+
+/* TZPC : Register Offsets */
+#define TZPC0_BASE             0x10100000
+#define TZPC1_BASE             0x10110000
+#define TZPC2_BASE             0x10120000
+#define TZPC3_BASE             0x10130000
+#define TZPC4_BASE             0x10140000
+#define TZPC5_BASE             0x10150000
+#define TZPC6_BASE             0x10160000
+#define TZPC7_BASE             0x10170000
+#define TZPC8_BASE             0x10180000
+#define TZPC9_BASE             0x10190000
+
+/* CLK_SRC_CPU */
+/* 0 = MOUTAPLL, 1 = SCLKMPLL */
+#define MUX_HPM_SEL            0
+#define MUX_CPU_SEL            0
+#define MUX_APLL_SEL           1
+#define CLK_SRC_CPU_VAL                ((MUX_HPM_SEL << 20) \
+                               | (MUX_CPU_SEL << 16) \
+                               | (MUX_APLL_SEL))
+
+/* CLK_DIV_CPU0 */
+#define ARM2_RATIO             0x0
+#define APLL_RATIO             0x1
+#define PCLK_DBG_RATIO         0x1
+#define ATB_RATIO              0x4
+#define PERIPH_RATIO           0x7
+#define ACP_RATIO              0x7
+#define CPUD_RATIO             0x2
+#define ARM_RATIO              0x0
+#define CLK_DIV_CPU0_VAL       ((ARM2_RATIO << 28) \
+                               | (APLL_RATIO << 24) \
+                               | (PCLK_DBG_RATIO << 20) \
+                               | (ATB_RATIO << 16) \
+                               | (PERIPH_RATIO << 12) \
+                               | (ACP_RATIO << 8) \
+                               | (CPUD_RATIO << 4) \
+                               | (ARM_RATIO))
+
+/* CLK_DIV_CPU1 */
+#define HPM_RATIO              0x4
+#define COPY_RATIO             0x0
+#define CLK_DIV_CPU1_VAL       ((HPM_RATIO << 4) \
+                               | (COPY_RATIO))
+
+#define APLL_MDIV              0x7D
+#define APLL_PDIV              0x3
+#define APLL_SDIV              0x0
+
+#define MPLL_MDIV              0x64
+#define MPLL_PDIV              0x3
+#define MPLL_SDIV              0x0
+
+#define CPLL_MDIV              0x96
+#define CPLL_PDIV              0x4
+#define CPLL_SDIV              0x0
+
+/* APLL_CON1 */
+#define APLL_CON1_VAL  (0x00203800)
+
+/* MPLL_CON1 */
+#define MPLL_CON1_VAL  (0x00203800)
+
+/* CPLL_CON1 */
+#define CPLL_CON1_VAL  (0x00203800)
+
+#define EPLL_MDIV      0x60
+#define EPLL_PDIV      0x3
+#define EPLL_SDIV      0x3
+
+#define EPLL_CON1_VAL  0x00000000
+#define EPLL_CON2_VAL  0x00000080
+
+#define VPLL_MDIV      0x96
+#define VPLL_PDIV      0x3
+#define VPLL_SDIV      0x2
+
+#define VPLL_CON1_VAL  0x00000000
+#define VPLL_CON2_VAL  0x00000080
+
+#define BPLL_MDIV      0x215
+#define BPLL_PDIV      0xC
+#define BPLL_SDIV      0x1
+
+#define BPLL_CON1_VAL  0x00203800
+
+/* Set PLL */
+#define set_pll(mdiv, pdiv, sdiv)      (1<<31 | mdiv<<16 | pdiv<<8 | sdiv)
+
+#define APLL_CON0_VAL  set_pll(APLL_MDIV, APLL_PDIV, APLL_SDIV)
+#define MPLL_CON0_VAL  set_pll(MPLL_MDIV, MPLL_PDIV, MPLL_SDIV)
+#define CPLL_CON0_VAL  set_pll(CPLL_MDIV, CPLL_PDIV, CPLL_SDIV)
+#define EPLL_CON0_VAL  set_pll(EPLL_MDIV, EPLL_PDIV, EPLL_SDIV)
+#define VPLL_CON0_VAL  set_pll(VPLL_MDIV, VPLL_PDIV, VPLL_SDIV)
+#define BPLL_CON0_VAL  set_pll(BPLL_MDIV, BPLL_PDIV, BPLL_SDIV)
+
+/* CLK_SRC_CORE0 */
+#define CLK_SRC_CORE0_VAL      0x00060000
+
+/* CLK_SRC_CORE1 */
+#define CLK_SRC_CORE1_VAL      0x100
+
+/* CLK_DIV_CORE0 */
+#define CLK_DIV_CORE0_VAL      0x120000
+
+/* CLK_DIV_CORE1 */
+#define CLK_DIV_CORE1_VAL      0x07070700
+
+/* CLK_SRC_CDREX */
+#define CLK_SRC_CDREX_INIT_VAL 0x1
+#define CLK_SRC_CDREX_VAL      0x111
+
+/* CLK_DIV_CDREX */
+#define CLK_DIV_CDREX_INIT_VAL 0x71771111
+
+#define MCLK_CDREX2_RATIO      0x0
+#define ACLK_EFCON_RATIO       0x1
+#define MCLK_DPHY_RATIO                0x0
+#define MCLK_CDREX_RATIO       0x0
+#define ACLK_C2C_200_RATIO     0x1
+#define C2C_CLK_400_RATIO      0x1
+#define PCLK_CDREX_RATIO       0x3
+#define ACLK_CDREX_RATIO       0x1
+#define CLK_DIV_CDREX_VAL      ((MCLK_DPHY_RATIO << 20) \
+                               | (MCLK_CDREX_RATIO << 16) \
+                               | (ACLK_C2C_200_RATIO << 12) \
+                               | (C2C_CLK_400_RATIO << 8) \
+                               | (PCLK_CDREX_RATIO << 4) \
+                               | (ACLK_CDREX_RATIO))
+
+#define MCLK_EFPHY_RATIO       0x4
+#define CLK_DIV_CDREX2_VAL     MCLK_EFPHY_RATIO
+
+/* CLK_DIV_ACP */
+#define CLK_DIV_ACP_VAL        0x12
+
+/* CLK_SRC_TOP0 */
+#define MUX_ACLK_300_GSCL_SEL          0x1
+#define MUX_ACLK_300_GSCL_MID_SEL      0x0
+#define MUX_ACLK_400_SEL               0x0
+#define MUX_ACLK_333_SEL               0x0
+#define MUX_ACLK_300_DISP1_SEL         0x1
+#define MUX_ACLK_300_DISP1_MID_SEL     0x0
+#define MUX_ACLK_200_SEL               0x0
+#define MUX_ACLK_166_SEL               0x0
+#define CLK_SRC_TOP0_VAL       ((MUX_ACLK_300_GSCL_SEL << 25) \
+                               | (MUX_ACLK_300_GSCL_MID_SEL << 24) \
+                               | (MUX_ACLK_400_SEL << 20) \
+                               | (MUX_ACLK_333_SEL << 16) \
+                               | (MUX_ACLK_300_DISP1_SEL << 15) \
+                               | (MUX_ACLK_300_DISP1_MID_SEL << 14)    \
+                               | (MUX_ACLK_200_SEL << 12) \
+                               | (MUX_ACLK_166_SEL << 8))
+
+/* CLK_SRC_TOP1 */
+#define MUX_ACLK_400_ISP_SEL           0x0
+#define MUX_ACLK_400_IOP_SEL           0x0
+#define MUX_ACLK_MIPI_HSI_TXBASE_SEL   0x0
+#define CLK_SRC_TOP1_VAL               ((MUX_ACLK_400_ISP_SEL << 24) \
+                                       |(MUX_ACLK_400_IOP_SEL << 20) \
+                                       |(MUX_ACLK_MIPI_HSI_TXBASE_SEL << 16))
+
+/* CLK_SRC_TOP2 */
+#define MUX_BPLL_USER_SEL      0x1
+#define MUX_MPLL_USER_SEL      0x1
+#define MUX_VPLL_SEL           0x0
+#define MUX_EPLL_SEL           0x0
+#define MUX_CPLL_SEL           0x0
+#define VPLLSRC_SEL            0x0
+#define CLK_SRC_TOP2_VAL       ((MUX_BPLL_USER_SEL << 24) \
+                               | (MUX_MPLL_USER_SEL << 20) \
+                               | (MUX_VPLL_SEL << 16) \
+                               | (MUX_EPLL_SEL << 12) \
+                               | (MUX_CPLL_SEL << 8) \
+                               | (VPLLSRC_SEL))
+/* CLK_SRC_TOP3 */
+#define MUX_ACLK_333_SUB_SEL           0x1
+#define MUX_ACLK_400_SUB_SEL           0x1
+#define MUX_ACLK_266_ISP_SUB_SEL       0x1
+#define MUX_ACLK_266_GPS_SUB_SEL       0x1
+#define MUX_ACLK_300_GSCL_SUB_SEL      0x1
+#define MUX_ACLK_266_GSCL_SUB_SEL      0x1
+#define MUX_ACLK_300_DISP1_SUB_SEL     0x1
+#define MUX_ACLK_200_DISP1_SUB_SEL     0x1
+#define CLK_SRC_TOP3_VAL               ((MUX_ACLK_333_SUB_SEL << 24) \
+                                       | (MUX_ACLK_400_SUB_SEL << 20) \
+                                       | (MUX_ACLK_266_ISP_SUB_SEL << 16) \
+                                       | (MUX_ACLK_266_GPS_SUB_SEL << 12) \
+                                       | (MUX_ACLK_300_GSCL_SUB_SEL << 10) \
+                                       | (MUX_ACLK_266_GSCL_SUB_SEL << 8) \
+                                       | (MUX_ACLK_300_DISP1_SUB_SEL << 6) \
+                                       | (MUX_ACLK_200_DISP1_SUB_SEL << 4))
+
+/* CLK_DIV_TOP0 */
+#define ACLK_300_RATIO         0x0
+#define ACLK_400_RATIO         0x3
+#define ACLK_333_RATIO         0x2
+#define ACLK_266_RATIO         0x2
+#define ACLK_200_RATIO         0x3
+#define ACLK_166_RATIO         0x5
+#define ACLK_133_RATIO         0x1
+#define ACLK_66_RATIO          0x5
+#define CLK_DIV_TOP0_VAL       ((ACLK_300_RATIO << 28) \
+                               | (ACLK_400_RATIO << 24) \
+                               | (ACLK_333_RATIO << 20) \
+                               | (ACLK_266_RATIO << 16) \
+                               | (ACLK_200_RATIO << 12) \
+                               | (ACLK_166_RATIO << 8) \
+                               | (ACLK_133_RATIO << 4) \
+                               | (ACLK_66_RATIO))
+
+/* CLK_DIV_TOP1 */
+#define ACLK_MIPI_HSI_TX_BASE_RATIO    0x3
+#define ACLK_66_PRE_RATIO      0x1
+#define ACLK_400_ISP_RATIO     0x1
+#define ACLK_400_IOP_RATIO     0x1
+#define ACLK_300_GSCL_RATIO    0x0
+#define ACLK_266_GPS_RATIO     0x7
+
+#define CLK_DIV_TOP1_VAL       ((ACLK_MIPI_HSI_TX_BASE_RATIO << 28) \
+                               | (ACLK_66_PRE_RATIO << 24) \
+                               | (ACLK_400_ISP_RATIO << 20) \
+                               | (ACLK_400_IOP_RATIO << 16) \
+                               | (ACLK_300_GSCL_RATIO << 12) \
+                               | (ACLK_266_GPS_RATIO << 8))
+
+/* APLL_LOCK */
+#define APLL_LOCK_VAL          (0x3E8)
+/* MPLL_LOCK */
+#define MPLL_LOCK_VAL          (0x2F1)
+/* CPLL_LOCK */
+#define CPLL_LOCK_VAL          (0x3E8)
+/* EPLL_LOCK */
+#define EPLL_LOCK_VAL          (0x2321)
+/* VPLL_LOCK */
+#define VPLL_LOCK_VAL          (0x2321)
+/* BPLL_LOCK */
+#define BPLL_LOCK_VAL          (0x3E8)
+
+/* CLK_SRC_PERIC0 */
+/* SRC_CLOCK = SCLK_MPLL */
+#define PWM_SEL                        0
+#define UART4_SEL              6
+#define UART3_SEL              6
+#define UART2_SEL              6
+#define UART1_SEL              6
+#define UART0_SEL              6
+#define CLK_SRC_PERIC0_VAL     ((PWM_SEL << 24) \
+                               | (UART4_SEL << 16) \
+                               | (UART3_SEL << 12) \
+                               | (UART2_SEL << 8) \
+                               | (UART1_SEL << 4) \
+                               | (UART0_SEL << 0))
+
+#define CLK_SRC_FSYS_VAL       0x66666
+#define CLK_DIV_FSYS0_VAL      0x0BB00000
+#define CLK_DIV_FSYS1_VAL      0x000f000f
+#define CLK_DIV_FSYS2_VAL      0x020f020f
+#define CLK_DIV_FSYS3_VAL      0x000f
+
+/* CLK_DIV_PERIC0 */
+#define UART5_RATIO            8
+#define UART4_RATIO            8
+#define UART3_RATIO            8
+#define UART2_RATIO            8
+#define UART1_RATIO            8
+#define UART0_RATIO            8
+#define CLK_DIV_PERIC0_VAL     ((UART4_RATIO << 16) \
+                               | (UART3_RATIO << 12) \
+                               | (UART2_RATIO << 8) \
+                               | (UART1_RATIO << 4) \
+                               | (UART0_RATIO << 0))
+
+/* CLK_DIV_PERIC3 */
+#define PWM_RATIO              8
+#define CLK_DIV_PERIC3_VAL     (PWM_RATIO << 0)
+
+/* CLK_SRC_LEX */
+#define CLK_SRC_LEX_VAL                0x0
+
+/* CLK_DIV_LEX */
+#define CLK_DIV_LEX_VAL                0x10
+
+/* CLK_DIV_R0X */
+#define CLK_DIV_R0X_VAL                0x10
+
+/* CLK_DIV_L0X */
+#define CLK_DIV_R1X_VAL                0x10
+
+/* SCLK_SRC_ISP */
+#define SCLK_SRC_ISP_VAL       0x600
+/* CLK_DIV_ISP0 */
+#define CLK_DIV_ISP0_VAL       0x31
+
+/* CLK_DIV_ISP1 */
+#define CLK_DIV_ISP1_VAL       0x0
+
+/* CLK_DIV_ISP2 */
+#define CLK_DIV_ISP2_VAL       0x1
+
+#define MPLL_DEC       (MPLL_MDIV * MPLL_MDIV / (MPLL_PDIV * 2^(MPLL_SDIV-1)))
+
+/*
+ * TZPC Register Value :
+ * R0SIZE: 0x0 : Size of secured ram
+ */
+#define R0SIZE                 0x0
+
+/*
+ * TZPC Decode Protection Register Value :
+ * DECPROTXSET: 0xFF : Set Decode region to non-secure
+ */
+#define DECPROTXSET            0xFF
+
+/* DMC Init */
+#define SET                    1
+#define RESET                  0
+/* (Memory Interleaving Size = 1 << IV_SIZE) */
+#define CONFIG_IV_SIZE         0x07
+
+#define PHY_RESET_VAL  (0 << 0)
+
+/*ZQ Configurations */
+#define PHY_CON16_RESET_VAL    0x08000304
+
+#define ZQ_MODE_DDS_VAL                (0x5 << 24)
+#define ZQ_MODE_TERM_VAL       (0x5 << 21)
+#define SET_ZQ_MODE_DDS_VAL(x) (x = (x & ~(0x7 << 24)) | ZQ_MODE_DDS_VAL)
+#define SET_ZQ_MODE_TERM_VAL(x)        (x = (x & ~(0x7 << 21)) | ZQ_MODE_TERM_VAL)
+
+#define ZQ_MODE_NOTERM         (1 << 19)
+#define ZQ_CLK_DIV_EN          (1 << 18)
+#define ZQ_MANUAL_STR          (1 << 1)
+
+/* Channel and Chip Selection */
+#define CONFIG_DMC_CHANNELS            2
+#define CONFIG_CHIPS_PER_CHANNEL       2
+
+#define SET_CMD_CHANNEL(x, y)  (x = (x & ~(1 << 28)) | y << 28)
+#define SET_CMD_CHIP(x, y)     (x = (x & ~(1 << 20)) | y << 20)
+
+/* Diret Command */
+#define        DIRECT_CMD_NOP          0x07000000
+#define DIRECT_CMD_MRS1                0x00071C00
+#define DIRECT_CMD_MRS2                0x00010BFC
+#define DIRECT_CMD_MRS3                0x00000708
+#define DIRECT_CMD_MRS4                0x00000818
+#define        DIRECT_CMD_PALL         0x01000000
+
+/* DLL Resync */
+#define FP_RSYNC               (1 << 3)
+
+#define CONFIG_CTRL_DLL_ON(x, y)       (x = (x & ~(1 << 5)) | y << 5)
+#define CONFIG_CTRL_START(x, y)                (x = (x & ~(1 << 6)) | y << 6)
+#define SET_CTRL_FORCE_VAL(x, y)       (x = (x & ~(0x7F << 8)) | y << 8)
+
+/* RDLVL */
+#define PHY_CON0_RESET_VAL     0x17023240
+#define DDR_MODE_LPDDR2                0x2
+#define BYTE_RDLVL_EN          (1 << 13)
+#define CTRL_ATGATE            (1 << 6)
+#define SET_CTRL_DDR_MODE(x, y)        (x = (x & ~(0x3 << 11)) | y << 11)
+
+#define PHY_CON1_RESET_VAL     0x9210100
+#define RDLVL_RDDATAPADJ       0x1
+#define SET_RDLVL_RDDATAPADJ   ((PHY_CON1_RESET_VAL & ~(0xFFFF << 0))\
+                                       | RDLVL_RDDATAPADJ << 0)
+
+#define PHY_CON2_RESET_VAL     0x00010004
+#define RDLVL_EN               (1 << 25)
+#define RDDSKEW_CLEAR          (1 << 13)
+
+#define CTRL_RDLVL_DATA_EN     (1 << 1)
+#define LPDDR2_ADDR            0x00000208
+
+#define DMC_MEMCONFIG0_VAL     0x00001323
+#define DMC_MEMCONFIG1_VAL     0x00001323
+#define DMC_MEMBASECONFIG0_VAL 0x00400780
+#define DMC_MEMBASECONFIG1_VAL 0x00800780
+#define DMC_MEMCONTROL_VAL     0x00212500
+#define DMC_PRECHCONFIG_VAL            0xFF000000
+#define DMC_PWRDNCONFIG_VAL            0xFFFF00FF
+#define DMC_TIMINGREF_VAL              0x0000005D
+#define DMC_TIMINGROW_VAL              0x2336544C
+#define DMC_TIMINGDATA_VAL             0x24202408
+#define DMC_TIMINGPOWER_VAL            0x38260235
+
+#define CTRL_BSTLEN            0x04
+#define CTRL_RDLAT             0x08
+#define PHY_CON42_VAL          (CTRL_BSTLEN << 8 | CTRL_RDLAT << 0)
+
+/* DQS, DQ, DEBUG offsets */
+#define        SET_DQS_OFFSET_VAL      0x7F7F7F7F
+#define        SET_DQ_OFFSET_VAL       0x7F7F7F7F
+#define        SET_DEBUG_OFFSET_VAL    0x7F
+
+#define        RESET_DQS_OFFSET_VAL    0x08080808
+#define        RESET_DQ_OFFSET_VAL     0x08080808
+#define        RESET_DEBUG_OFFSET_VAL  0x8
+
+#define CTRL_PULLD_DQ          (0x0F << 8)
+#define CTRL_PULLD_DQS         (0x0F << 0)
+
+#define DFI_INIT_START         (1 << 28)
+
+#define CLK_STOP_EN    (1 << 0)
+#define DPWRDN_EN      (1 << 1)
+#define DSREF_EN       (1 << 5)
+
+#define AREF_EN                        (1 << 5)
+void sdelay(unsigned long);
+void mem_ctrl_init(void);
+void system_clock_init(void);
+void tzpc_init(void);
+
+#endif
diff --git a/board/samsung/smdk5250/smdk5250.c b/board/samsung/smdk5250/smdk5250.c
new file mode 100644 (file)
index 0000000..928c08f
--- /dev/null
@@ -0,0 +1,240 @@
+/*
+ * Copyright (C) 2012 Samsung Electronics
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public 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 <netdev.h>
+#include <asm/arch/cpu.h>
+#include <asm/arch/gpio.h>
+#include <asm/arch/mmc.h>
+#include <asm/arch/sromc.h>
+
+DECLARE_GLOBAL_DATA_PTR;
+struct exynos5_gpio_part1 *gpio1;
+
+#ifdef CONFIG_SMC911X
+static void smc9115_pre_init(void)
+{
+       u32 smc_bw_conf, smc_bc_conf;
+       int i;
+
+       /*
+        * SROM:CS1 and EBI
+        *
+        * GPY0[0]      SROM_CSn[0]
+        * GPY0[1]      SROM_CSn[1](2)
+        * GPY0[2]      SROM_CSn[2]
+        * GPY0[3]      SROM_CSn[3]
+        * GPY0[4]      EBI_OEn(2)
+        * GPY0[5]      EBI_EEn(2)
+        *
+        * GPY1[0]      EBI_BEn[0](2)
+        * GPY1[1]      EBI_BEn[1](2)
+        * GPY1[2]      SROM_WAIT(2)
+        * GPY1[3]      EBI_DATA_RDn(2)
+        */
+       s5p_gpio_cfg_pin(&gpio1->y0, CONFIG_ENV_SROM_BANK, GPIO_FUNC(2));
+       s5p_gpio_cfg_pin(&gpio1->y0, 4, GPIO_FUNC(2));
+       s5p_gpio_cfg_pin(&gpio1->y0, 5, GPIO_FUNC(2));
+
+       for (i = 0; i < 4; i++)
+               s5p_gpio_cfg_pin(&gpio1->y1, i, GPIO_FUNC(2));
+
+       /*
+        * EBI: 8 Addrss Lines
+        *
+        * GPY3[0]      EBI_ADDR[0](2)
+        * GPY3[1]      EBI_ADDR[1](2)
+        * GPY3[2]      EBI_ADDR[2](2)
+        * GPY3[3]      EBI_ADDR[3](2)
+        * GPY3[4]      EBI_ADDR[4](2)
+        * GPY3[5]      EBI_ADDR[5](2)
+        * GPY3[6]      EBI_ADDR[6](2)
+        * GPY3[7]      EBI_ADDR[7](2)
+        *
+        * EBI: 16 Data Lines
+        *
+        * GPY5[0]      EBI_DATA[0](2)
+        * GPY5[1]      EBI_DATA[1](2)
+        * GPY5[2]      EBI_DATA[2](2)
+        * GPY5[3]      EBI_DATA[3](2)
+        * GPY5[4]      EBI_DATA[4](2)
+        * GPY5[5]      EBI_DATA[5](2)
+        * GPY5[6]      EBI_DATA[6](2)
+        * GPY5[7]      EBI_DATA[7](2)
+        *
+        * GPY6[0]      EBI_DATA[8](2)
+        * GPY6[1]      EBI_DATA[9](2)
+        * GPY6[2]      EBI_DATA[10](2)
+        * GPY6[3]      EBI_DATA[11](2)
+        * GPY6[4]      EBI_DATA[12](2)
+        * GPY6[5]      EBI_DATA[13](2)
+        * GPY6[6]      EBI_DATA[14](2)
+        * GPY6[7]      EBI_DATA[15](2)
+        */
+       for (i = 0; i < 8; i++) {
+               s5p_gpio_cfg_pin(&gpio1->y3, i, GPIO_FUNC(2));
+               s5p_gpio_set_pull(&gpio1->y3, i, GPIO_PULL_UP);
+
+               s5p_gpio_cfg_pin(&gpio1->y5, i, GPIO_FUNC(2));
+               s5p_gpio_set_pull(&gpio1->y5, i, GPIO_PULL_UP);
+
+               s5p_gpio_cfg_pin(&gpio1->y6, i, GPIO_FUNC(2));
+               s5p_gpio_set_pull(&gpio1->y6, i, GPIO_PULL_UP);
+       }
+
+       /* Ethernet needs data bus width of 16 bits */
+       smc_bw_conf = SROMC_DATA16_WIDTH(CONFIG_ENV_SROM_BANK)
+                       | SROMC_BYTE_ENABLE(CONFIG_ENV_SROM_BANK);
+
+       smc_bc_conf = SROMC_BC_TACS(0x01) | SROMC_BC_TCOS(0x01)
+                       | SROMC_BC_TACC(0x06) | SROMC_BC_TCOH(0x01)
+                       | SROMC_BC_TAH(0x0C)  | SROMC_BC_TACP(0x09)
+                       | SROMC_BC_PMC(0x01);
+
+       /* Select and configure the SROMC bank */
+       s5p_config_sromc(CONFIG_ENV_SROM_BANK, smc_bw_conf, smc_bc_conf);
+}
+#endif
+
+int board_init(void)
+{
+       gpio1 = (struct exynos5_gpio_part1 *) samsung_get_base_gpio_part1();
+
+       gd->bd->bi_boot_params = (PHYS_SDRAM_1 + 0x100UL);
+       return 0;
+}
+
+int dram_init(void)
+{
+       gd->ram_size    = get_ram_size((long *)PHYS_SDRAM_1, PHYS_SDRAM_1_SIZE)
+                       + get_ram_size((long *)PHYS_SDRAM_2, PHYS_SDRAM_2_SIZE)
+                       + get_ram_size((long *)PHYS_SDRAM_3, PHYS_SDRAM_3_SIZE)
+                       + get_ram_size((long *)PHYS_SDRAM_4, PHYS_SDRAM_4_SIZE)
+                       + get_ram_size((long *)PHYS_SDRAM_5, PHYS_SDRAM_7_SIZE)
+                       + get_ram_size((long *)PHYS_SDRAM_6, PHYS_SDRAM_7_SIZE)
+                       + get_ram_size((long *)PHYS_SDRAM_7, PHYS_SDRAM_7_SIZE)
+                       + get_ram_size((long *)PHYS_SDRAM_8, PHYS_SDRAM_8_SIZE);
+       return 0;
+}
+
+void dram_init_banksize(void)
+{
+       gd->bd->bi_dram[0].start = PHYS_SDRAM_1;
+       gd->bd->bi_dram[0].size = get_ram_size((long *)PHYS_SDRAM_1,
+                                                       PHYS_SDRAM_1_SIZE);
+       gd->bd->bi_dram[1].start = PHYS_SDRAM_2;
+       gd->bd->bi_dram[1].size = get_ram_size((long *)PHYS_SDRAM_2,
+                                                       PHYS_SDRAM_2_SIZE);
+       gd->bd->bi_dram[2].start = PHYS_SDRAM_3;
+       gd->bd->bi_dram[2].size = get_ram_size((long *)PHYS_SDRAM_3,
+                                                       PHYS_SDRAM_3_SIZE);
+       gd->bd->bi_dram[3].start = PHYS_SDRAM_4;
+       gd->bd->bi_dram[3].size = get_ram_size((long *)PHYS_SDRAM_4,
+                                                       PHYS_SDRAM_4_SIZE);
+       gd->bd->bi_dram[4].start = PHYS_SDRAM_5;
+       gd->bd->bi_dram[4].size = get_ram_size((long *)PHYS_SDRAM_5,
+                                                       PHYS_SDRAM_5_SIZE);
+       gd->bd->bi_dram[5].start = PHYS_SDRAM_6;
+       gd->bd->bi_dram[5].size = get_ram_size((long *)PHYS_SDRAM_6,
+                                                       PHYS_SDRAM_6_SIZE);
+       gd->bd->bi_dram[6].start = PHYS_SDRAM_7;
+       gd->bd->bi_dram[6].size = get_ram_size((long *)PHYS_SDRAM_7,
+                                                       PHYS_SDRAM_7_SIZE);
+       gd->bd->bi_dram[7].start = PHYS_SDRAM_8;
+       gd->bd->bi_dram[7].size = get_ram_size((long *)PHYS_SDRAM_8,
+                                                       PHYS_SDRAM_8_SIZE);
+}
+
+int board_eth_init(bd_t *bis)
+{
+#ifdef CONFIG_SMC911X
+       smc9115_pre_init();
+       return smc911x_initialize(0, CONFIG_SMC911X_BASE);
+#endif
+       return 0;
+}
+
+#ifdef CONFIG_DISPLAY_BOARDINFO
+int checkboard(void)
+{
+       printf("\nBoard: SMDK5250\n");
+
+       return 0;
+}
+#endif
+
+#ifdef CONFIG_GENERIC_MMC
+int board_mmc_init(bd_t *bis)
+{
+       int i, err;
+
+       /*
+        * MMC2 SD card GPIO:
+        *
+        * GPC2[0]      SD_2_CLK(2)
+        * GPC2[1]      SD_2_CMD(2)
+        * GPC2[2]      SD_2_CDn
+        * GPC2[3:6]    SD_2_DATA[0:3](2)
+        */
+       for (i = 0; i < 7; i++) {
+               /* GPC2[0:6] special function 2 */
+               s5p_gpio_cfg_pin(&gpio1->c2, i, GPIO_FUNC(0x2));
+
+               /* GPK2[0:6] drv 4x */
+               s5p_gpio_set_drv(&gpio1->c2, i, GPIO_DRV_4X);
+
+               /* GPK2[0:1] pull disable */
+               if (i == 0 || i == 1) {
+                       s5p_gpio_set_pull(&gpio1->c2, i, GPIO_PULL_NONE);
+                       continue;
+               }
+
+               /* GPK2[2:6] pull up */
+               s5p_gpio_set_pull(&gpio1->c2, i, GPIO_PULL_UP);
+       }
+
+       err = s5p_mmc_init(2, 4);
+       return err;
+}
+#endif
+
+static void board_uart_init(void)
+{
+       struct exynos5_gpio_part1 *gpio1 =
+               (struct exynos5_gpio_part1 *) samsung_get_base_gpio_part1();
+       int i;
+
+       /* UART1 GPIOs (part1) : GPA0CON[7:4] 0x2222 */
+       for (i = 4; i < 8; i++) {
+               s5p_gpio_set_pull(&gpio1->a0, i, GPIO_PULL_NONE);
+               s5p_gpio_cfg_pin(&gpio1->a0, i, GPIO_FUNC(0x2));
+       }
+}
+
+#ifdef CONFIG_BOARD_EARLY_INIT_F
+int board_early_init_f(void)
+{
+       board_uart_init();
+       return 0;
+}
+#endif
diff --git a/board/samsung/smdk5250/tzpc_init.c b/board/samsung/smdk5250/tzpc_init.c
new file mode 100644 (file)
index 0000000..c2ccef3
--- /dev/null
@@ -0,0 +1,48 @@
+/*
+ * Lowlevel setup for SMDK5250 board based on S5PC520
+ *
+ * Copyright (C) 2012 Samsung Electronics
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+#include <asm/arch/tzpc.h>
+#include"setup.h"
+
+/* Setting TZPC[TrustZone Protection Controller] */
+void tzpc_init(void)
+{
+       struct exynos5_tzpc *tzpc;
+       unsigned int addr;
+
+       for (addr = TZPC0_BASE; addr <= TZPC9_BASE; addr += TZPC_BASE_OFFSET) {
+               tzpc = (struct exynos5_tzpc *)addr;
+
+               if (addr == TZPC0_BASE)
+                       writel(R0SIZE, &tzpc->r0size);
+
+               writel(DECPROTXSET, &tzpc->decprot0set);
+               writel(DECPROTXSET, &tzpc->decprot1set);
+
+               if (addr != TZPC9_BASE) {
+                       writel(DECPROTXSET, &tzpc->decprot2set);
+                       writel(DECPROTXSET, &tzpc->decprot3set);
+               }
+       }
+}
diff --git a/board/samsung/trats/Makefile b/board/samsung/trats/Makefile
new file mode 100644 (file)
index 0000000..d21883f
--- /dev/null
@@ -0,0 +1,43 @@
+#
+# Copyright (C) 2011 Samsung Electronics
+# Heungjun Kim <riverful.kim@samsung.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).o
+
+COBJS-y        += trats.o
+
+SRCS    := $(COBJS-y:.o=.c)
+OBJS   := $(addprefix $(obj),$(COBJS-y))
+
+$(LIB):        $(obj).depend $(OBJS)
+       $(call cmd_link_o_target, $(OBJS))
+
+#########################################################################
+
+# defines $(obj).depend target
+include $(SRCTREE)/rules.mk
+
+sinclude $(obj).depend
+
+#########################################################################
diff --git a/board/samsung/trats/setup.h b/board/samsung/trats/setup.h
new file mode 100644 (file)
index 0000000..a479b5c
--- /dev/null
@@ -0,0 +1,637 @@
+/*
+ * Machine Specific Values for TRATS board based on EXYNOS4210
+ *
+ * Copyright (C) 2011 Samsung Electronics
+ * Heungjun Kim <riverful.kim@samsung.com>
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+#ifndef _TRATS_SETUP_H
+#define _TRATS_SETUP_H
+
+#include <config.h>
+#include <version.h>
+#include <asm/arch/cpu.h>
+
+/* CLK_SRC_CPU: APLL(1), MPLL(1), CORE(0), HPM(0) */
+#define MUX_HPM_SEL_MOUTAPLL           0x0
+#define MUX_HPM_SEL_SCLKMPLL           0x1
+#define MUX_CORE_SEL_MOUTAPLL          0x0
+#define MUX_CORE_SEL_SCLKMPLL          0x1
+#define MUX_MPLL_SEL_FILPLL            0x0
+#define MUX_MPLL_SEL_MOUTMPLLFOUT      0x1
+#define MUX_APLL_SEL_FILPLL            0x0
+#define MUX_APLL_SEL_MOUTMPLLFOUT      0x1
+#define CLK_SRC_CPU_VAL                        ((MUX_HPM_SEL_MOUTAPLL << 20) \
+                                       | (MUX_CORE_SEL_MOUTAPLL << 16) \
+                                       | (MUX_MPLL_SEL_MOUTMPLLFOUT << 8)\
+                                       | (MUX_APLL_SEL_MOUTMPLLFOUT << 0))
+
+/* CLK_DIV_CPU0 */
+#define APLL_RATIO                     0x0
+#define PCLK_DBG_RATIO                 0x1
+#define ATB_RATIO                      0x3
+#define PERIPH_RATIO                   0x3
+#define COREM1_RATIO                   0x7
+#define COREM0_RATIO                   0x3
+#define CORE_RATIO                     0x0
+#define CLK_DIV_CPU0_VAL               ((APLL_RATIO << 24) \
+                                       | (PCLK_DBG_RATIO << 20) \
+                                       | (ATB_RATIO << 16) \
+                                       | (PERIPH_RATIO << 12) \
+                                       | (COREM1_RATIO << 8) \
+                                       | (COREM0_RATIO << 4) \
+                                       | (CORE_RATIO << 0))
+
+/* CLK_DIV_CPU1 */
+#define HPM_RATIO                      0x0
+#define COPY_RATIO                     0x3
+#define CLK_DIV_CPU1_VAL               ((HPM_RATIO << 4) | (COPY_RATIO))
+
+/* CLK_DIV_DMC0 */
+#define CORE_TIMERS_RATIO              0x1
+#define COPY2_RATIO                    0x3
+#define DMCP_RATIO                     0x1
+#define DMCD_RATIO                     0x1
+#define DMC_RATIO                      0x1
+#define DPHY_RATIO                     0x1
+#define ACP_PCLK_RATIO                 0x1
+#define ACP_RATIO                      0x3
+#define CLK_DIV_DMC0_VAL               ((CORE_TIMERS_RATIO << 28) \
+                                       | (COPY2_RATIO << 24) \
+                                       | (DMCP_RATIO << 20) \
+                                       | (DMCD_RATIO << 16) \
+                                       | (DMC_RATIO << 12) \
+                                       | (DPHY_RATIO << 8) \
+                                       | (ACP_PCLK_RATIO << 4) \
+                                       | (ACP_RATIO << 0))
+
+/* CLK_DIV_DMC1 */
+#define DPM_RATIO                      0x1
+#define DVSEM_RATIO                    0x1
+#define PWI_RATIO                      0x1
+#define CLK_DIV_DMC1_VAL               ((DPM_RATIO << 24) \
+                                       | (DVSEM_RATIO << 16) \
+                                       | (PWI_RATIO << 8))
+
+/* CLK_SRC_TOP0 */
+#define MUX_ONENAND_SEL_ACLK_133       0x0
+#define MUX_ONENAND_SEL_ACLK_160       0x1
+#define MUX_ACLK_133_SEL_SCLKMPLL      0x0
+#define MUX_ACLK_133_SEL_SCLKAPLL      0x1
+#define MUX_ACLK_160_SEL_SCLKMPLL      0x0
+#define MUX_ACLK_160_SEL_SCLKAPLL      0x1
+#define MUX_ACLK_100_SEL_SCLKMPLL      0x0
+#define MUX_ACLK_100_SEL_SCLKAPLL      0x1
+#define MUX_ACLK_200_SEL_SCLKMPLL      0x0
+#define MUX_ACLK_200_SEL_SCLKAPLL      0x1
+#define MUX_VPLL_SEL_FINPLL            0x0
+#define MUX_VPLL_SEL_FOUTVPLL          0x1
+#define MUX_EPLL_SEL_FINPLL            0x0
+#define MUX_EPLL_SEL_FOUTEPLL          0x1
+#define MUX_ONENAND_1_SEL_MOUTONENAND  0x0
+#define MUX_ONENAND_1_SEL_SCLKVPLL     0x1
+#define CLK_SRC_TOP0_VAL               ((MUX_ONENAND_SEL_ACLK_160 << 28) \
+                                       | (MUX_ACLK_133_SEL_SCLKMPLL << 24) \
+                                       | (MUX_ACLK_160_SEL_SCLKMPLL << 20) \
+                                       | (MUX_ACLK_100_SEL_SCLKMPLL << 16) \
+                                       | (MUX_ACLK_200_SEL_SCLKMPLL << 12) \
+                                       | (MUX_VPLL_SEL_FOUTVPLL << 8) \
+                                       | (MUX_EPLL_SEL_FOUTEPLL << 4) \
+                                       | (MUX_ONENAND_1_SEL_MOUTONENAND << 0))
+
+/* CLK_DIV_TOP */
+#define ONENAND_RATIO                  0x0
+#define ACLK_133_RATIO                 0x5
+#define ACLK_160_RATIO                 0x4
+#define ACLK_100_RATIO                 0x7
+#define ACLK_200_RATIO                 0x3
+#define CLK_DIV_TOP_VAL                        ((ONENAND_RATIO << 16)  \
+                                       | (ACLK_133_RATIO << 12)\
+                                       | (ACLK_160_RATIO << 8) \
+                                       | (ACLK_100_RATIO << 4) \
+                                       | (ACLK_200_RATIO << 0))
+
+/* CLK_DIV_LEFTBUS */
+#define GPL_RATIO                      0x1
+#define GDL_RATIO                      0x3
+#define CLK_DIV_LEFTBUS_VAL            ((GPL_RATIO << 4) | (GDL_RATIO))
+
+/* CLK_DIV_RIGHTBUS */
+#define GPR_RATIO                      0x1
+#define GDR_RATIO                      0x3
+#define CLK_DIV_RIGHTBUS_VAL           ((GPR_RATIO << 4) | (GDR_RATIO))
+
+/* CLK_SRS_FSYS: 6 = SCLKMPLL */
+#define SATA_SEL_SCLKMPLL              0
+#define SATA_SEL_SCLKAPLL              1
+
+#define MMC_SEL_XXTI                   0
+#define MMC_SEL_XUSBXTI                        1
+#define MMC_SEL_SCLK_HDMI24M           2
+#define MMC_SEL_SCLK_USBPHY0           3
+#define MMC_SEL_SCLK_USBPHY1           4
+#define MMC_SEL_SCLK_HDMIPHY           5
+#define MMC_SEL_SCLKMPLL               6
+#define MMC_SEL_SCLKEPLL               7
+#define MMC_SEL_SCLKVPLL               8
+
+#define MMCC0_SEL                      MMC_SEL_SCLKMPLL
+#define MMCC1_SEL                      MMC_SEL_SCLKMPLL
+#define MMCC2_SEL                      MMC_SEL_SCLKMPLL
+#define MMCC3_SEL                      MMC_SEL_SCLKMPLL
+#define MMCC4_SEL                      MMC_SEL_SCLKMPLL
+#define CLK_SRC_FSYS_VAL               ((SATA_SEL_SCLKMPLL << 24) \
+                                       | (MMCC4_SEL << 16) \
+                                       | (MMCC3_SEL << 12) \
+                                       | (MMCC2_SEL << 8) \
+                                       | (MMCC1_SEL << 4) \
+                                       | (MMCC0_SEL << 0))
+
+/* SCLK_MMC[0-4] = MOUTMMC[0-4]/(MMC[0-4]_RATIO + 1)/(MMC[0-4]_PRE_RATIO +1) */
+/* CLK_DIV_FSYS1: 800(MPLL) / (15 + 1) */
+#define MMC0_RATIO                     0xF
+#define MMC0_PRE_RATIO                 0x0
+#define MMC1_RATIO                     0xF
+#define MMC1_PRE_RATIO                 0x0
+#define CLK_DIV_FSYS1_VAL              ((MMC1_PRE_RATIO << 24) \
+                                       | (MMC1_RATIO << 16) \
+                                       | (MMC0_PRE_RATIO << 8) \
+                                       | (MMC0_RATIO << 0))
+
+/* CLK_DIV_FSYS2: 800(MPLL) / (15 + 1) */
+#define MMC2_RATIO                     0xF
+#define MMC2_PRE_RATIO                 0x0
+#define MMC3_RATIO                     0xF
+#define MMC3_PRE_RATIO                 0x0
+#define CLK_DIV_FSYS2_VAL              ((MMC3_PRE_RATIO << 24) \
+                                       | (MMC3_RATIO << 16) \
+                                       | (MMC2_PRE_RATIO << 8) \
+                                       | (MMC2_RATIO << 0))
+
+/* CLK_DIV_FSYS3: 800(MPLL) / (15 + 1) */
+#define MMC4_RATIO                     0xF
+#define MMC4_PRE_RATIO                 0x0
+#define CLK_DIV_FSYS3_VAL              ((MMC4_PRE_RATIO << 8) \
+                                       | (MMC4_RATIO << 0))
+
+/* CLK_SRC_PERIL0 */
+#define UART_SEL_XXTI                  0
+#define UART_SEL_XUSBXTI               1
+#define UART_SEL_SCLK_HDMI24M          2
+#define UART_SEL_SCLK_USBPHY0          3
+#define UART_SEL_SCLK_USBPHY1          4
+#define UART_SEL_SCLK_HDMIPHY          5
+#define UART_SEL_SCLKMPLL              6
+#define UART_SEL_SCLKEPLL              7
+#define UART_SEL_SCLKVPLL              8
+
+#define UART0_SEL                      UART_SEL_SCLKMPLL
+#define UART1_SEL                      UART_SEL_SCLKMPLL
+#define UART2_SEL                      UART_SEL_SCLKMPLL
+#define UART3_SEL                      UART_SEL_SCLKMPLL
+#define UART4_SEL                      UART_SEL_SCLKMPLL
+#define UART5_SEL                      UART_SEL_SCLKMPLL
+#define CLK_SRC_PERIL0_VAL             ((UART5_SEL << 16) \
+                                       | (UART4_SEL << 12) \
+                                       | (UART3_SEL << 12) \
+                                       | (UART2_SEL << 8) \
+                                       | (UART1_SEL << 4) \
+                                       | (UART0_SEL << 0))
+
+/* SCLK_UART[0-4] = MOUTUART[0-4] / (UART[0-4]_RATIO + 1) */
+/* CLK_DIV_PERIL0 */
+#define UART0_RATIO                    7
+#define UART1_RATIO                    7
+#define UART2_RATIO                    7
+#define UART3_RATIO                    4
+#define UART4_RATIO                    7
+#define UART5_RATIO                    7
+#define CLK_DIV_PERIL0_VAL             ((UART5_RATIO << 16) \
+                                       | (UART4_RATIO << 12) \
+                                       | (UART3_RATIO << 12) \
+                                       | (UART2_RATIO << 8) \
+                                       | (UART1_RATIO << 4) \
+                                       | (UART0_RATIO << 0))
+
+/* CLK_DIV_PERIL3 */
+#define SLIMBUS_RATIO                  0x0
+#define PWM_RATIO                      0x8
+#define CLK_DIV_PERIL3_VAL             ((SLIMBUS_RATIO << 4) \
+                                       | (PWM_RATIO << 0))
+
+/* Required period to generate a stable clock output */
+/* PLL_LOCK_TIME */
+#define PLL_LOCKTIME                   0x1C20
+
+/* PLL Values */
+#define DISABLE                                0
+#define ENABLE                         1
+#define SET_PLL(mdiv, pdiv, sdiv)      ((ENABLE << 31)\
+                                       | (mdiv << 16) \
+                                       | (pdiv << 8) \
+                                       | (sdiv << 0))
+
+/* APLL_CON0: 800MHz */
+#define APLL_MDIV                      0xC8
+#define APLL_PDIV                      0x6
+#define APLL_SDIV                      0x1
+#define APLL_CON0_VAL                  SET_PLL(APLL_MDIV, APLL_PDIV, APLL_SDIV)
+
+/* APLL_CON1 */
+#define APLL_AFC_ENB                   0x1
+#define APLL_AFC                       0x1C
+#define APLL_CON1_VAL                  ((APLL_AFC_ENB << 31) | (APLL_AFC << 0))
+
+/* MPLL_CON0: 800MHz */
+#define MPLL_MDIV                      0xC8
+#define MPLL_PDIV                      0x6
+#define MPLL_SDIV                      0x1
+#define MPLL_CON0_VAL                  SET_PLL(MPLL_MDIV, MPLL_PDIV, MPLL_SDIV)
+
+/* MPLL_CON1 */
+#define MPLL_AFC_ENB                   0x1
+#define MPLL_AFC                       0x1C
+#define MPLL_CON1_VAL                  ((MPLL_AFC_ENB << 31) | (MPLL_AFC << 0))
+
+/* EPLL_CON0: 96MHz */
+#define EPLL_MDIV                      0x30
+#define EPLL_PDIV                      0x3
+#define EPLL_SDIV                      0x2
+#define EPLL_CON0_VAL                  SET_PLL(EPLL_MDIV, EPLL_PDIV, EPLL_SDIV)
+
+/* EPLL_CON1 */
+#define EPLL_K                         0x0
+#define EPLL_CON1_VAL                  (EPLL_K >> 0)
+
+/* VPLL_CON0: 108MHz */
+#define VPLL_MDIV                      0x35
+#define VPLL_PDIV                      0x3
+#define VPLL_SDIV                      0x2
+#define VPLL_CON0_VAL                  SET_PLL(VPLL_MDIV, VPLL_PDIV, VPLL_SDIV)
+
+/* VPLL_CON1 */
+#define VPLL_SSCG_EN                   DISABLE
+#define VPLL_SEL_PF_DN_SPREAD          0x0
+#define VPLL_MRR                       0x11
+#define VPLL_MFR                       0x0
+#define VPLL_K                         0x400
+#define VPLL_CON1_VAL                  ((VPLL_SSCG_EN << 31)\
+                                       | (VPLL_SEL_PF_DN_SPREAD << 29) \
+                                       | (VPLL_MRR << 24) \
+                                       | (VPLL_MFR << 16) \
+                                       | (VPLL_K << 0))
+
+/* CLOCK GATE */
+#define CLK_DIS                                0x0
+#define CLK_EN                         0x1
+
+#define BIT_CAM_CLK_PIXELASYNCM1       18
+#define BIT_CAM_CLK_PIXELASYNCM0       17
+#define BIT_CAM_CLK_PPMUCAMIF          16
+#define BIT_CAM_CLK_QEFIMC3            15
+#define BIT_CAM_CLK_QEFIMC2            14
+#define BIT_CAM_CLK_QEFIMC1            13
+#define BIT_CAM_CLK_QEFIMC0            12
+#define BIT_CAM_CLK_SMMUJPEG           11
+#define BIT_CAM_CLK_SMMUFIMC3          10
+#define BIT_CAM_CLK_SMMUFIMC2          9
+#define BIT_CAM_CLK_SMMUFIMC1          8
+#define BIT_CAM_CLK_SMMUFIMC0          7
+#define BIT_CAM_CLK_JPEG               6
+#define BIT_CAM_CLK_CSIS1              5
+#define BIT_CAM_CLK_CSIS0              4
+#define BIT_CAM_CLK_FIMC3              3
+#define BIT_CAM_CLK_FIMC2              2
+#define BIT_CAM_CLK_FIMC1              1
+#define BIT_CAM_CLK_FIMC0              0
+#define CLK_GATE_IP_CAM_ALL_EN         ((CLK_EN << BIT_CAM_CLK_PIXELASYNCM1)\
+                                       | (CLK_EN << BIT_CAM_CLK_PIXELASYNCM0)\
+                                       | (CLK_EN << BIT_CAM_CLK_PPMUCAMIF)\
+                                       | (CLK_EN << BIT_CAM_CLK_QEFIMC3)\
+                                       | (CLK_EN << BIT_CAM_CLK_QEFIMC2)\
+                                       | (CLK_EN << BIT_CAM_CLK_QEFIMC1)\
+                                       | (CLK_EN << BIT_CAM_CLK_QEFIMC0)\
+                                       | (CLK_EN << BIT_CAM_CLK_SMMUJPEG)\
+                                       | (CLK_EN << BIT_CAM_CLK_SMMUFIMC3)\
+                                       | (CLK_EN << BIT_CAM_CLK_SMMUFIMC2)\
+                                       | (CLK_EN << BIT_CAM_CLK_SMMUFIMC1)\
+                                       | (CLK_EN << BIT_CAM_CLK_SMMUFIMC0)\
+                                       | (CLK_EN << BIT_CAM_CLK_JPEG)\
+                                       | (CLK_EN << BIT_CAM_CLK_CSIS1)\
+                                       | (CLK_EN << BIT_CAM_CLK_CSIS0)\
+                                       | (CLK_EN << BIT_CAM_CLK_FIMC3)\
+                                       | (CLK_EN << BIT_CAM_CLK_FIMC2)\
+                                       | (CLK_EN << BIT_CAM_CLK_FIMC1)\
+                                       | (CLK_EN << BIT_CAM_CLK_FIMC0))
+#define CLK_GATE_IP_CAM_ALL_DIS                ~CLK_GATE_IP_CAM_ALL_EN
+
+#define BIT_VP_CLK_PPMUTV              5
+#define BIT_VP_CLK_SMMUTV              4
+#define BIT_VP_CLK_HDMI                        3
+#define BIT_VP_CLK_TVENC               2
+#define BIT_VP_CLK_MIXER               1
+#define BIT_VP_CLK_VP                  0
+#define CLK_GATE_IP_VP_ALL_EN          ((CLK_EN << BIT_VP_CLK_PPMUTV)\
+                                       | (CLK_EN << BIT_VP_CLK_SMMUTV)\
+                                       | (CLK_EN << BIT_VP_CLK_HDMI)\
+                                       | (CLK_EN << BIT_VP_CLK_TVENC)\
+                                       | (CLK_EN << BIT_VP_CLK_MIXER)\
+                                       | (CLK_EN << BIT_VP_CLK_VP))
+#define CLK_GATE_IP_VP_ALL_DIS         ~CLK_GATE_IP_VP_ALL_EN
+
+#define BIT_MFC_CLK_PPMUMFC_R          4
+#define BIT_MFC_CLK_PPMUMFC_L          3
+#define BIT_MFC_CLK_SMMUMFC_R          2
+#define BIT_MFC_CLK_SMMUMFC_L          1
+#define BIT_MFC_CLK_MFC                        0
+#define CLK_GATE_IP_MFC_ALL_EN         ((CLK_EN << BIT_MFC_CLK_PPMUMFC_R)\
+                                       | (CLK_EN << BIT_MFC_CLK_PPMUMFC_L)\
+                                       | (CLK_EN << BIT_MFC_CLK_SMMUMFC_R)\
+                                       | (CLK_EN << BIT_MFC_CLK_SMMUMFC_L)\
+                                       | (CLK_EN << BIT_MFC_CLK_MFC))
+#define CLK_GATE_IP_MFC_ALL_DIS                ~CLK_GATE_IP_MFC_ALL_EN
+
+#define BIT_G3D_CLK_QEG3D              2
+#define BIT_G3D_CLK_PPMUG3D            1
+#define BIT_G3D_CLK_G3D                        0
+#define CLK_GATE_IP_G3D_ALL_EN         ((CLK_EN << BIT_G3D_CLK_QEG3D)\
+                                       | (CLK_EN << BIT_G3D_CLK_PPMUG3D)\
+                                       | (CLK_EN << BIT_G3D_CLK_G3D))
+#define CLK_GATE_IP_G3D_ALL_DIS                ~CLK_GATE_IP_G3D_ALL_EN
+
+#define BIT_IMAGE_CLK_PPMUIMAGE                9
+#define BIT_IMAGE_CLK_QEMDMA           8
+#define BIT_IMAGE_CLK_QEROTATOR                7
+#define BIT_IMAGE_CLK_QEG2D            6
+#define BIT_IMAGE_CLK_SMMUMDMA         5
+#define BIT_IMAGE_CLK_SMMUROTATOR      4
+#define BIT_IMAGE_CLK_SMMUG2D          3
+#define BIT_IMAGE_CLK_MDMA             2
+#define BIT_IMAGE_CLK_ROTATOR          1
+#define BIT_IMAGE_CLK_G2D              0
+#define CLK_GATE_IP_IMAGE_ALL_EN       ((CLK_EN << BIT_IMAGE_CLK_PPMUIMAGE)\
+                                       | (CLK_EN << BIT_IMAGE_CLK_QEMDMA)\
+                                       | (CLK_EN << BIT_IMAGE_CLK_QEROTATOR)\
+                                       | (CLK_EN << BIT_IMAGE_CLK_QEG2D)\
+                                       | (CLK_EN << BIT_IMAGE_CLK_SMMUMDMA)\
+                                       | (CLK_EN << BIT_IMAGE_CLK_SMMUROTATOR)\
+                                       | (CLK_EN << BIT_IMAGE_CLK_SMMUG2D)\
+                                       | (CLK_EN << BIT_IMAGE_CLK_MDMA)\
+                                       | (CLK_EN << BIT_IMAGE_CLK_ROTATOR)\
+                                       | (CLK_EN << BIT_IMAGE_CLK_G2D))
+#define CLK_GATE_IP_IMAGE_ALL_DIS      ~CLK_GATE_IP_IMAGE_ALL_EN
+
+#define BIT_LCD0_CLK_PPMULCD0          5
+#define BIT_LCD0_CLK_SMMUFIMD0         4
+#define BIT_LCD0_CLK_DSIM0             3
+#define BIT_LCD0_CLK_MDNIE0            2
+#define BIT_LCD0_CLK_MIE0              1
+#define BIT_LCD0_CLK_FIMD0             0
+#define CLK_GATE_IP_LCD0_ALL_EN                ((CLK_EN << BIT_LCD0_CLK_PPMULCD0)\
+                                       | (CLK_EN << BIT_LCD0_CLK_SMMUFIMD0)\
+                                       | (CLK_EN << BIT_LCD0_CLK_DSIM0)\
+                                       | (CLK_EN << BIT_LCD0_CLK_MDNIE0)\
+                                       | (CLK_EN << BIT_LCD0_CLK_MIE0)\
+                                       | (CLK_EN << BIT_LCD0_CLK_FIMD0))
+#define CLK_GATE_IP_LCD0_ALL_DIS       ~CLK_GATE_IP_LCD0_ALL_EN
+
+#define BIT_LCD1_CLK_PPMULCD1          5
+#define BIT_LCD1_CLK_SMMUFIMD1         4
+#define BIT_LCD1_CLK_DSIM1             3
+#define BIT_LCD1_CLK_MDNIE1            2
+#define BIT_LCD1_CLK_MIE1              1
+#define BIT_LCD1_CLK_FIMD1             0
+#define CLK_GATE_IP_LCD1_ALL_EN                ((CLK_EN << BIT_LCD1_CLK_PPMULCD1)\
+                                       | (CLK_EN << BIT_LCD1_CLK_SMMUFIMD1)\
+                                       | (CLK_EN << BIT_LCD1_CLK_DSIM1)\
+                                       | (CLK_EN << BIT_LCD1_CLK_MDNIE1)\
+                                       | (CLK_EN << BIT_LCD1_CLK_MIE1)\
+                                       | (CLK_EN << BIT_LCD1_CLK_FIMD1))
+#define CLK_GATE_IP_LCD1_ALL_DIS       ~CLK_GATE_IP_LCD1_ALL_EN
+
+#define BIT_FSYS_CLK_SMMUPCIE          18
+#define BIT_FSYS_CLK_PPMUFILE          17
+#define BIT_FSYS_CLK_NFCON             16
+#define BIT_FSYS_CLK_ONENAND           15
+#define BIT_FSYS_CLK_PCIE              14
+#define BIT_FSYS_CLK_USBDEVICE         13
+#define BIT_FSYS_CLK_USBHOST           12
+#define BIT_FSYS_CLK_SROMC             11
+#define BIT_FSYS_CLK_SATA              10
+#define BIT_FSYS_CLK_SDMMC4            9
+#define BIT_FSYS_CLK_SDMMC3            8
+#define BIT_FSYS_CLK_SDMMC2            7
+#define BIT_FSYS_CLK_SDMMC1            6
+#define BIT_FSYS_CLK_SDMMC0            5
+#define BIT_FSYS_CLK_TSI               4
+#define BIT_FSYS_CLK_SATAPHY           3
+#define BIT_FSYS_CLK_PCIEPHY           2
+#define BIT_FSYS_CLK_PDMA1             1
+#define BIT_FSYS_CLK_PDMA0             0
+#define CLK_GATE_IP_FSYS_ALL_EN                ((CLK_EN << BIT_FSYS_CLK_SMMUPCIE)\
+                                       | (CLK_EN << BIT_FSYS_CLK_PPMUFILE)\
+                                       | (CLK_EN << BIT_FSYS_CLK_NFCON)\
+                                       | (CLK_EN << BIT_FSYS_CLK_ONENAND)\
+                                       | (CLK_EN << BIT_FSYS_CLK_PCIE)\
+                                       | (CLK_EN << BIT_FSYS_CLK_USBDEVICE)\
+                                       | (CLK_EN << BIT_FSYS_CLK_USBHOST)\
+                                       | (CLK_EN << BIT_FSYS_CLK_SROMC)\
+                                       | (CLK_EN << BIT_FSYS_CLK_SATA)\
+                                       | (CLK_EN << BIT_FSYS_CLK_SDMMC4)\
+                                       | (CLK_EN << BIT_FSYS_CLK_SDMMC3)\
+                                       | (CLK_EN << BIT_FSYS_CLK_SDMMC2)\
+                                       | (CLK_EN << BIT_FSYS_CLK_SDMMC1)\
+                                       | (CLK_EN << BIT_FSYS_CLK_SDMMC0)\
+                                       | (CLK_EN << BIT_FSYS_CLK_TSI)\
+                                       | (CLK_EN << BIT_FSYS_CLK_SATAPHY)\
+                                       | (CLK_EN << BIT_FSYS_CLK_PCIEPHY)\
+                                       | (CLK_EN << BIT_FSYS_CLK_PDMA1)\
+                                       | (CLK_EN << BIT_FSYS_CLK_PDMA0))
+#define CLK_GATE_IP_FSYS_ALL_DIS       ~CLK_GATE_IP_FSYS_ALL_EN
+
+#define BIT_GPS_CLK_SMMUGPS            1
+#define BIT_GPS_CLK_GPS                        0
+#define CLK_GATE_IP_GPS_ALL_EN         ((CLK_EN << BIT_GPS_CLK_SMMUGPS)\
+                                       | (CLK_EN << BIT_GPS_CLK_GPS))
+#define CLK_GATE_IP_GPS_ALL_DIS                ~CLK_GATE_IP_GPS_ALL_EN
+
+#define BIT_PERIL_CLK_MODEMIF          28
+#define BIT_PERIL_CLK_AC97             27
+#define BIT_PERIL_CLK_SPDIF            26
+#define BIT_PERIL_CLK_SLIMBUS          25
+#define BIT_PERIL_CLK_PWM              24
+#define BIT_PERIL_CLK_PCM2             23
+#define BIT_PERIL_CLK_PCM1             22
+#define BIT_PERIL_CLK_I2S2             21
+#define BIT_PERIL_CLK_I2S1             20
+#define BIT_PERIL_CLK_RESERVED0                19
+#define BIT_PERIL_CLK_SPI2             18
+#define BIT_PERIL_CLK_SPI1             17
+#define BIT_PERIL_CLK_SPI0             16
+#define BIT_PERIL_CLK_TSADC            15
+#define BIT_PERIL_CLK_I2CHDMI          14
+#define BIT_PERIL_CLK_I2C7             13
+#define BIT_PERIL_CLK_I2C6             12
+#define BIT_PERIL_CLK_I2C5             11
+#define BIT_PERIL_CLK_I2C4             10
+#define BIT_PERIL_CLK_I2C3             9
+#define BIT_PERIL_CLK_I2C2             8
+#define BIT_PERIL_CLK_I2C1             7
+#define BIT_PERIL_CLK_I2C0             6
+#define BIT_PERIL_CLK_RESERVED1                5
+#define BIT_PERIL_CLK_UART4            4
+#define BIT_PERIL_CLK_UART3            3
+#define BIT_PERIL_CLK_UART2            2
+#define BIT_PERIL_CLK_UART1            1
+#define BIT_PERIL_CLK_UART0            0
+#define CLK_GATE_IP_PERIL_ALL_EN       ((CLK_EN << BIT_PERIL_CLK_MODEMIF)\
+                                       | (CLK_EN << BIT_PERIL_CLK_AC97)\
+                                       | (CLK_EN << BIT_PERIL_CLK_SPDIF)\
+                                       | (CLK_EN << BIT_PERIL_CLK_SLIMBUS)\
+                                       | (CLK_EN << BIT_PERIL_CLK_PWM)\
+                                       | (CLK_EN << BIT_PERIL_CLK_PCM2)\
+                                       | (CLK_EN << BIT_PERIL_CLK_PCM1)\
+                                       | (CLK_EN << BIT_PERIL_CLK_I2S2)\
+                                       | (CLK_EN << BIT_PERIL_CLK_I2S1)\
+                                       | (CLK_EN << BIT_PERIL_CLK_RESERVED0)\
+                                       | (CLK_EN << BIT_PERIL_CLK_SPI2)\
+                                       | (CLK_EN << BIT_PERIL_CLK_SPI1)\
+                                       | (CLK_EN << BIT_PERIL_CLK_SPI0)\
+                                       | (CLK_EN << BIT_PERIL_CLK_TSADC)\
+                                       | (CLK_EN << BIT_PERIL_CLK_I2CHDMI)\
+                                       | (CLK_EN << BIT_PERIL_CLK_I2C7)\
+                                       | (CLK_EN << BIT_PERIL_CLK_I2C6)\
+                                       | (CLK_EN << BIT_PERIL_CLK_I2C5)\
+                                       | (CLK_EN << BIT_PERIL_CLK_I2C4)\
+                                       | (CLK_EN << BIT_PERIL_CLK_I2C3)\
+                                       | (CLK_EN << BIT_PERIL_CLK_I2C2)\
+                                       | (CLK_EN << BIT_PERIL_CLK_I2C1)\
+                                       | (CLK_EN << BIT_PERIL_CLK_I2C0)\
+                                       | (CLK_EN << BIT_PERIL_CLK_RESERVED1)\
+                                       | (CLK_EN << BIT_PERIL_CLK_UART4)\
+                                       | (CLK_EN << BIT_PERIL_CLK_UART3)\
+                                       | (CLK_EN << BIT_PERIL_CLK_UART2)\
+                                       | (CLK_EN << BIT_PERIL_CLK_UART1)\
+                                       | (CLK_EN << BIT_PERIL_CLK_UART0))
+#define CLK_GATE_IP_PERIL_ALL_DIS      ~CLK_GATE_IP_PERIL_ALL_EN
+
+#define BIT_PERIR_CLK_TMU_APBIF                17
+#define BIT_PERIR_CLK_KEYIF            16
+#define BIT_PERIR_CLK_RTC              15
+#define BIT_PERIR_CLK_WDT              14
+#define BIT_PERIR_CLK_MCT              13
+#define BIT_PERIR_CLK_SECKEY           12
+#define BIT_PERIR_CLK_HDMI_CEC         11
+#define BIT_PERIR_CLK_TZPC5            10
+#define BIT_PERIR_CLK_TZPC4            9
+#define BIT_PERIR_CLK_TZPC3            8
+#define BIT_PERIR_CLK_TZPC2            7
+#define BIT_PERIR_CLK_TZPC1            6
+#define BIT_PERIR_CLK_TZPC0            5
+#define BIT_PERIR_CLK_CMU_DMCPART      4
+#define BIT_PERIR_CLK_RESERVED         3
+#define BIT_PERIR_CLK_CMU_APBIF                2
+#define BIT_PERIR_CLK_SYSREG           1
+#define BIT_PERIR_CLK_CHIP_ID          0
+#define CLK_GATE_IP_PERIR_ALL_EN       ((CLK_EN << BIT_PERIR_CLK_TMU_APBIF)\
+                                       | (CLK_EN << BIT_PERIR_CLK_KEYIF)\
+                                       | (CLK_EN << BIT_PERIR_CLK_RTC)\
+                                       | (CLK_EN << BIT_PERIR_CLK_WDT)\
+                                       | (CLK_EN << BIT_PERIR_CLK_MCT)\
+                                       | (CLK_EN << BIT_PERIR_CLK_SECKEY)\
+                                       | (CLK_EN << BIT_PERIR_CLK_HDMI_CEC)\
+                                       | (CLK_EN << BIT_PERIR_CLK_TZPC5)\
+                                       | (CLK_EN << BIT_PERIR_CLK_TZPC4)\
+                                       | (CLK_EN << BIT_PERIR_CLK_TZPC3)\
+                                       | (CLK_EN << BIT_PERIR_CLK_TZPC2)\
+                                       | (CLK_EN << BIT_PERIR_CLK_TZPC1)\
+                                       | (CLK_EN << BIT_PERIR_CLK_TZPC0)\
+                                       | (CLK_EN << BIT_PERIR_CLK_CMU_DMCPART)\
+                                       | (CLK_EN << BIT_PERIR_CLK_RESERVED)\
+                                       | (CLK_EN << BIT_PERIR_CLK_CMU_APBIF)\
+                                       | (CLK_EN << BIT_PERIR_CLK_SYSREG)\
+                                       | (CLK_EN << BIT_PERIR_CLK_CHIP_ID))
+#define CLK_GATE_IP_PERIR_ALL_DIS      ~CLK_GATE_IP_PERIR_ALL_EN
+
+#define BIT_BLOCK_CLK_GPS              7
+#define BIT_BLOCK_CLK_RESERVED         6
+#define BIT_BLOCK_CLK_LCD1             5
+#define BIT_BLOCK_CLK_LCD0             4
+#define BIT_BLOCK_CLK_G3D              3
+#define BIT_BLOCK_CLK_MFC              2
+#define BIT_BLOCK_CLK_TV               1
+#define BIT_BLOCK_CLK_CAM              0
+#define CLK_GATE_BLOCK_ALL_EN          ((CLK_EN << BIT_BLOCK_CLK_GPS)\
+                                       | (CLK_EN << BIT_BLOCK_CLK_RESERVED)\
+                                       | (CLK_EN << BIT_BLOCK_CLK_LCD1)\
+                                       | (CLK_EN << BIT_BLOCK_CLK_LCD0)\
+                                       | (CLK_EN << BIT_BLOCK_CLK_G3D)\
+                                       | (CLK_EN << BIT_BLOCK_CLK_MFC)\
+                                       | (CLK_EN << BIT_BLOCK_CLK_TV)\
+                                       | (CLK_EN << BIT_BLOCK_CLK_CAM))
+#define CLK_GATE_BLOCK_ALL_DIS         ~CLK_GATE_BLOCK_ALL_EN
+
+/*
+ * GATE CAM    : All block
+ * GATE VP     : All block
+ * GATE MFC    : All block
+ * GATE G3D    : All block
+ * GATE IMAGE  : All block
+ * GATE LCD0   : All block
+ * GATE LCD1   : All block
+ * GATE FSYS   : Enable - PDMA0,1, SDMMC0,2, USBHOST, USBDEVICE, PPMUFILE
+ * GATE GPS    : All block
+ * GATE PERI Left      : All Enable, Block - SLIMBUS, SPDIF, AC97
+ * GATE PERI Right     : All Enable, Block - KEYIF
+ * GATE Block  : All block
+ */
+#define CLK_GATE_IP_CAM_VAL            CLK_GATE_IP_CAM_ALL_DIS
+#define CLK_GATE_IP_VP_VAL             CLK_GATE_IP_VP_ALL_DIS
+#define CLK_GATE_IP_MFC_VAL            CLK_GATE_IP_MFC_ALL_DIS
+#define CLK_GATE_IP_G3D_VAL            CLK_GATE_IP_G3D_ALL_DIS
+#define CLK_GATE_IP_IMAGE_VAL          CLK_GATE_IP_IMAGE_ALL_DIS
+#define CLK_GATE_IP_LCD0_VAL           CLK_GATE_IP_LCD0_ALL_DIS
+#define CLK_GATE_IP_LCD1_VAL           CLK_GATE_IP_LCD1_ALL_DIS
+#define CLK_GATE_IP_FSYS_VAL           (CLK_GATE_IP_FSYS_ALL_DIS \
+                                       | (CLK_EN << BIT_FSYS_CLK_PPMUFILE)\
+                                       | (CLK_EN << BIT_FSYS_CLK_USBDEVICE)\
+                                       | (CLK_EN << BIT_FSYS_CLK_USBHOST)\
+                                       | (CLK_EN << BIT_FSYS_CLK_SROMC)\
+                                       | (CLK_EN << BIT_FSYS_CLK_SDMMC2)\
+                                       | (CLK_EN << BIT_FSYS_CLK_SDMMC0)\
+                                       | (CLK_EN << BIT_FSYS_CLK_PDMA1)\
+                                       | (CLK_EN << BIT_FSYS_CLK_PDMA0))
+#define CLK_GATE_IP_GPS_VAL            CLK_GATE_IP_GPS_ALL_DIS
+#define CLK_GATE_IP_PERIL_VAL          (CLK_GATE_IP_PERIL_ALL_DIS \
+                                       | ~((CLK_EN << BIT_PERIL_CLK_AC97)\
+                                         | (CLK_EN << BIT_PERIL_CLK_SPDIF)\
+                                         | (CLK_EN << BIT_PERIL_CLK_I2C2)\
+                                         | (CLK_EN << BIT_PERIL_CLK_SLIMBUS)))
+#define CLK_GATE_IP_PERIR_VAL          (CLK_GATE_IP_PERIR_ALL_DIS \
+                                       | ~((CLK_EN << BIT_PERIR_CLK_KEYIF)))
+#define CLK_GATE_BLOCK_VAL             CLK_GATE_BLOCK_ALL_DIS
+
+/* PS_HOLD: Data Hight, Output En */
+#define BIT_DAT                                8
+#define BIT_EN                         9
+#define EXYNOS4_PS_HOLD_CON_VAL                (0x1 << BIT_DAT | 0x1 << BIT_EN)
+
+#endif
diff --git a/board/samsung/trats/trats.c b/board/samsung/trats/trats.c
new file mode 100644 (file)
index 0000000..aa4291d
--- /dev/null
@@ -0,0 +1,366 @@
+/*
+ * Copyright (C) 2011 Samsung Electronics
+ * Heungjun Kim <riverful.kim@samsung.com>
+ * Kyungmin Park <kyungmin.park@samsung.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/io.h>
+#include <asm/arch/cpu.h>
+#include <asm/arch/gpio.h>
+#include <asm/arch/mmc.h>
+#include <asm/arch/clock.h>
+#include <asm/arch/watchdog.h>
+#include <asm/arch/power.h>
+#include <pmic.h>
+#include <usb/s3c_udc.h>
+#include <max8998_pmic.h>
+
+#include "setup.h"
+
+DECLARE_GLOBAL_DATA_PTR;
+
+unsigned int board_rev;
+
+#ifdef CONFIG_REVISION_TAG
+u32 get_board_rev(void)
+{
+       return board_rev;
+}
+#endif
+
+static void check_hw_revision(void);
+
+int board_init(void)
+{
+       gd->bd->bi_boot_params = PHYS_SDRAM_1 + 0x100;
+
+       check_hw_revision();
+       printf("HW Revision:\t0x%x\n", board_rev);
+
+#if defined(CONFIG_PMIC)
+       pmic_init();
+#endif
+
+       return 0;
+}
+
+int dram_init(void)
+{
+       gd->ram_size = get_ram_size((long *)PHYS_SDRAM_1, PHYS_SDRAM_1_SIZE) +
+               get_ram_size((long *)PHYS_SDRAM_2, PHYS_SDRAM_2_SIZE);
+
+       return 0;
+}
+
+void dram_init_banksize(void)
+{
+       gd->bd->bi_dram[0].start = PHYS_SDRAM_1;
+       gd->bd->bi_dram[0].size = PHYS_SDRAM_1_SIZE;
+       gd->bd->bi_dram[1].start = PHYS_SDRAM_2;
+       gd->bd->bi_dram[1].size = PHYS_SDRAM_2_SIZE;
+}
+
+static unsigned int get_hw_revision(void)
+{
+       struct exynos4_gpio_part1 *gpio =
+               (struct exynos4_gpio_part1 *)samsung_get_base_gpio_part1();
+       int hwrev = 0;
+       int i;
+
+       /* hw_rev[3:0] == GPE1[3:0] */
+       for (i = 0; i < 4; i++) {
+               s5p_gpio_cfg_pin(&gpio->e1, i, GPIO_INPUT);
+               s5p_gpio_set_pull(&gpio->e1, i, GPIO_PULL_NONE);
+       }
+
+       udelay(1);
+
+       for (i = 0; i < 4; i++)
+               hwrev |= (s5p_gpio_get_value(&gpio->e1, i) << i);
+
+       debug("hwrev 0x%x\n", hwrev);
+
+       return hwrev;
+}
+
+static void check_hw_revision(void)
+{
+       int hwrev;
+
+       hwrev = get_hw_revision();
+
+       board_rev |= hwrev;
+}
+
+#ifdef CONFIG_DISPLAY_BOARDINFO
+int checkboard(void)
+{
+       puts("Board:\tTRATS\n");
+       return 0;
+}
+#endif
+
+#ifdef CONFIG_GENERIC_MMC
+int board_mmc_init(bd_t *bis)
+{
+       struct exynos4_gpio_part2 *gpio =
+               (struct exynos4_gpio_part2 *)samsung_get_base_gpio_part2();
+       int i, err;
+
+       /* eMMC_EN: SD_0_CDn: GPK0[2] Output High */
+       s5p_gpio_direction_output(&gpio->k0, 2, 1);
+       s5p_gpio_set_pull(&gpio->k0, 2, GPIO_PULL_NONE);
+
+       /*
+        * eMMC GPIO:
+        * SDR 8-bit@48MHz at MMC0
+        * GPK0[0]      SD_0_CLK(2)
+        * GPK0[1]      SD_0_CMD(2)
+        * GPK0[2]      SD_0_CDn        -> Not used
+        * GPK0[3:6]    SD_0_DATA[0:3](2)
+        * GPK1[3:6]    SD_0_DATA[0:3](3)
+        *
+        * DDR 4-bit@26MHz at MMC4
+        * GPK0[0]      SD_4_CLK(3)
+        * GPK0[1]      SD_4_CMD(3)
+        * GPK0[2]      SD_4_CDn        -> Not used
+        * GPK0[3:6]    SD_4_DATA[0:3](3)
+        * GPK1[3:6]    SD_4_DATA[4:7](4)
+        */
+       for (i = 0; i < 7; i++) {
+               if (i == 2)
+                       continue;
+               /* GPK0[0:6] special function 2 */
+               s5p_gpio_cfg_pin(&gpio->k0, i, 0x2);
+               /* GPK0[0:6] pull disable */
+               s5p_gpio_set_pull(&gpio->k0, i, GPIO_PULL_NONE);
+               /* GPK0[0:6] drv 4x */
+               s5p_gpio_set_drv(&gpio->k0, i, GPIO_DRV_4X);
+       }
+
+       for (i = 3; i < 7; i++) {
+               /* GPK1[3:6] special function 3 */
+               s5p_gpio_cfg_pin(&gpio->k1, i, 0x3);
+               /* GPK1[3:6] pull disable */
+               s5p_gpio_set_pull(&gpio->k1, i, GPIO_PULL_NONE);
+               /* GPK1[3:6] drv 4x */
+               s5p_gpio_set_drv(&gpio->k1, i, GPIO_DRV_4X);
+       }
+
+       /*
+        * MMC device init
+        * mmc0  : eMMC (8-bit buswidth)
+        * mmc2  : SD card (4-bit buswidth)
+        */
+       err = s5p_mmc_init(0, 8);
+
+       /* T-flash detect */
+       s5p_gpio_cfg_pin(&gpio->x3, 4, 0xf);
+       s5p_gpio_set_pull(&gpio->x3, 4, GPIO_PULL_UP);
+
+       /*
+        * Check the T-flash  detect pin
+        * GPX3[4] T-flash detect pin
+        */
+       if (!s5p_gpio_get_value(&gpio->x3, 4)) {
+               /*
+                * SD card GPIO:
+                * GPK2[0]      SD_2_CLK(2)
+                * GPK2[1]      SD_2_CMD(2)
+                * GPK2[2]      SD_2_CDn        -> Not used
+                * GPK2[3:6]    SD_2_DATA[0:3](2)
+                */
+               for (i = 0; i < 7; i++) {
+                       if (i == 2)
+                               continue;
+                       /* GPK2[0:6] special function 2 */
+                       s5p_gpio_cfg_pin(&gpio->k2, i, 0x2);
+                       /* GPK2[0:6] pull disable */
+                       s5p_gpio_set_pull(&gpio->k2, i, GPIO_PULL_NONE);
+                       /* GPK2[0:6] drv 4x */
+                       s5p_gpio_set_drv(&gpio->k2, i, GPIO_DRV_4X);
+               }
+               err = s5p_mmc_init(2, 4);
+       }
+
+       return err;
+}
+#endif
+
+#ifdef CONFIG_USB_GADGET
+static int s5pc210_phy_control(int on)
+{
+       int ret = 0;
+       struct pmic *p = get_pmic();
+
+       if (pmic_probe(p))
+               return -1;
+
+       if (on) {
+               ret |= pmic_set_output(p,
+                                      MAX8998_REG_BUCK_ACTIVE_DISCHARGE3,
+                                      MAX8998_SAFEOUT1, LDO_ON);
+               ret |= pmic_set_output(p, MAX8998_REG_ONOFF1,
+                                     MAX8998_LDO3, LDO_ON);
+               ret |= pmic_set_output(p, MAX8998_REG_ONOFF2,
+                                     MAX8998_LDO8, LDO_ON);
+
+       } else {
+               ret |= pmic_set_output(p, MAX8998_REG_ONOFF2,
+                                     MAX8998_LDO8, LDO_OFF);
+               ret |= pmic_set_output(p, MAX8998_REG_ONOFF1,
+                                     MAX8998_LDO3, LDO_OFF);
+               ret |= pmic_set_output(p,
+                                      MAX8998_REG_BUCK_ACTIVE_DISCHARGE3,
+                                      MAX8998_SAFEOUT1, LDO_OFF);
+       }
+
+       if (ret) {
+               puts("MAX8998 LDO setting error!\n");
+               return -1;
+       }
+
+       return 0;
+}
+
+struct s3c_plat_otg_data s5pc210_otg_data = {
+       .phy_control    = s5pc210_phy_control,
+       .regs_phy       = EXYNOS4_USBPHY_BASE,
+       .regs_otg       = EXYNOS4_USBOTG_BASE,
+       .usb_phy_ctrl   = EXYNOS4_USBPHY_CONTROL,
+       .usb_flags      = PHY0_SLEEP,
+};
+#endif
+
+static void pmic_reset(void)
+{
+       struct exynos4_gpio_part2 *gpio =
+               (struct exynos4_gpio_part2 *)samsung_get_base_gpio_part2();
+
+       s5p_gpio_direction_output(&gpio->x0, 7, 1);
+       s5p_gpio_set_pull(&gpio->x2, 7, GPIO_PULL_NONE);
+}
+
+static void board_clock_init(void)
+{
+       struct exynos4_clock *clk =
+               (struct exynos4_clock *)samsung_get_base_clock();
+
+       writel(CLK_SRC_CPU_VAL, (unsigned int)&clk->src_cpu);
+       writel(CLK_SRC_TOP0_VAL, (unsigned int)&clk->src_top0);
+       writel(CLK_SRC_FSYS_VAL, (unsigned int)&clk->src_fsys);
+       writel(CLK_SRC_PERIL0_VAL, (unsigned int)&clk->src_peril0);
+
+       writel(CLK_DIV_CPU0_VAL, (unsigned int)&clk->div_cpu0);
+       writel(CLK_DIV_CPU1_VAL, (unsigned int)&clk->div_cpu1);
+       writel(CLK_DIV_DMC0_VAL, (unsigned int)&clk->div_dmc0);
+       writel(CLK_DIV_DMC1_VAL, (unsigned int)&clk->div_dmc1);
+       writel(CLK_DIV_LEFTBUS_VAL, (unsigned int)&clk->div_leftbus);
+       writel(CLK_DIV_RIGHTBUS_VAL, (unsigned int)&clk->div_rightbus);
+       writel(CLK_DIV_TOP_VAL, (unsigned int)&clk->div_top);
+       writel(CLK_DIV_FSYS1_VAL, (unsigned int)&clk->div_fsys1);
+       writel(CLK_DIV_FSYS2_VAL, (unsigned int)&clk->div_fsys2);
+       writel(CLK_DIV_FSYS3_VAL, (unsigned int)&clk->div_fsys3);
+       writel(CLK_DIV_PERIL0_VAL, (unsigned int)&clk->div_peril0);
+       writel(CLK_DIV_PERIL3_VAL, (unsigned int)&clk->div_peril3);
+
+       writel(PLL_LOCKTIME, (unsigned int)&clk->apll_lock);
+       writel(PLL_LOCKTIME, (unsigned int)&clk->mpll_lock);
+       writel(PLL_LOCKTIME, (unsigned int)&clk->epll_lock);
+       writel(PLL_LOCKTIME, (unsigned int)&clk->vpll_lock);
+       writel(APLL_CON1_VAL, (unsigned int)&clk->apll_con1);
+       writel(APLL_CON0_VAL, (unsigned int)&clk->apll_con0);
+       writel(MPLL_CON1_VAL, (unsigned int)&clk->mpll_con1);
+       writel(MPLL_CON0_VAL, (unsigned int)&clk->mpll_con0);
+       writel(EPLL_CON1_VAL, (unsigned int)&clk->epll_con1);
+       writel(EPLL_CON0_VAL, (unsigned int)&clk->epll_con0);
+       writel(VPLL_CON1_VAL, (unsigned int)&clk->vpll_con1);
+       writel(VPLL_CON0_VAL, (unsigned int)&clk->vpll_con0);
+
+       writel(CLK_GATE_IP_CAM_VAL, (unsigned int)&clk->gate_ip_cam);
+       writel(CLK_GATE_IP_VP_VAL, (unsigned int)&clk->gate_ip_tv);
+       writel(CLK_GATE_IP_MFC_VAL, (unsigned int)&clk->gate_ip_mfc);
+       writel(CLK_GATE_IP_G3D_VAL, (unsigned int)&clk->gate_ip_g3d);
+       writel(CLK_GATE_IP_IMAGE_VAL, (unsigned int)&clk->gate_ip_image);
+       writel(CLK_GATE_IP_LCD0_VAL, (unsigned int)&clk->gate_ip_lcd0);
+       writel(CLK_GATE_IP_LCD1_VAL, (unsigned int)&clk->gate_ip_lcd1);
+       writel(CLK_GATE_IP_FSYS_VAL, (unsigned int)&clk->gate_ip_fsys);
+       writel(CLK_GATE_IP_GPS_VAL, (unsigned int)&clk->gate_ip_gps);
+       writel(CLK_GATE_IP_PERIL_VAL, (unsigned int)&clk->gate_ip_peril);
+       writel(CLK_GATE_IP_PERIR_VAL, (unsigned int)&clk->gate_ip_perir);
+       writel(CLK_GATE_BLOCK_VAL, (unsigned int)&clk->gate_block);
+}
+
+static void board_power_init(void)
+{
+       struct exynos4_power *pwr =
+               (struct exynos4_power *)samsung_get_base_power();
+
+       /* PS HOLD */
+       writel(EXYNOS4_PS_HOLD_CON_VAL, (unsigned int)&pwr->ps_hold_control);
+
+       /* Set power down */
+       writel(0, (unsigned int)&pwr->cam_configuration);
+       writel(0, (unsigned int)&pwr->tv_configuration);
+       writel(0, (unsigned int)&pwr->mfc_configuration);
+       writel(0, (unsigned int)&pwr->g3d_configuration);
+       writel(0, (unsigned int)&pwr->lcd1_configuration);
+       writel(0, (unsigned int)&pwr->gps_configuration);
+       writel(0, (unsigned int)&pwr->gps_alive_configuration);
+}
+
+static void board_uart_init(void)
+{
+       struct exynos4_gpio_part1 *gpio1 =
+               (struct exynos4_gpio_part1 *)samsung_get_base_gpio_part1();
+       struct exynos4_gpio_part2 *gpio2 =
+               (struct exynos4_gpio_part2 *)samsung_get_base_gpio_part2();
+       int i;
+
+       /*
+        * UART2 GPIOs
+        * GPA1CON[0] = UART_2_RXD(2)
+        * GPA1CON[1] = UART_2_TXD(2)
+        * GPA1CON[2] = I2C_3_SDA (3)
+        * GPA1CON[3] = I2C_3_SCL (3)
+        */
+
+       for (i = 0; i < 4; i++) {
+               s5p_gpio_set_pull(&gpio1->a1, i, GPIO_PULL_NONE);
+               s5p_gpio_cfg_pin(&gpio1->a1, i, GPIO_FUNC((i > 1) ? 0x3 : 0x2));
+       }
+
+       /* UART_SEL GPY4[7] (part2) at EXYNOS4 */
+       s5p_gpio_set_pull(&gpio2->y4, 7, GPIO_PULL_UP);
+       s5p_gpio_direction_output(&gpio2->y4, 7, 1);
+}
+
+int board_early_init_f(void)
+{
+       wdt_stop();
+       pmic_reset();
+       board_clock_init();
+       board_uart_init();
+       board_power_init();
+
+       return 0;
+}
index 06fac7b583625e13d5e36599870fb82977f607b8..50c70ab60312c50cb614858dee392d22b26f2f20 100644 (file)
 #include <asm/arch/mmc_host_def.h>
 #include <i2c.h>
 #include <asm/gpio.h>
+#ifdef CONFIG_USB_EHCI
+#include <usb.h>
+#include <asm/ehci-omap.h>
+#endif
 #include "twister.h"
 
 DECLARE_GLOBAL_DATA_PTR;
@@ -56,6 +60,24 @@ static const u32 gpmc_XR16L2751[] = {
        XR16L2751_GPMC_CONFIG6,
 };
 
+#ifdef CONFIG_USB_EHCI
+static struct omap_usbhs_board_data usbhs_bdata = {
+       .port_mode[0] = OMAP_EHCI_PORT_MODE_PHY,
+       .port_mode[1] = OMAP_EHCI_PORT_MODE_PHY,
+       .port_mode[2] = OMAP_USBHS_PORT_MODE_UNUSED,
+};
+
+int ehci_hcd_init(void)
+{
+       return omap_ehci_hcd_init(&usbhs_bdata);
+}
+
+int ehci_hcd_stop(void)
+{
+       return omap_ehci_hcd_stop();
+}
+#endif
+
 int board_init(void)
 {
        gpmc_init(); /* in SRAM or SDRAM, finish GPMC */
diff --git a/board/teejet/mt_ventoux/Makefile b/board/teejet/mt_ventoux/Makefile
new file mode 100644 (file)
index 0000000..4c8db10
--- /dev/null
@@ -0,0 +1,38 @@
+#
+# Copyright (C) 2011 Ilya Yanok, Emcraft Systems
+#
+# Based on ti/evm/Makefile
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc.
+#
+
+include $(TOPDIR)/config.mk
+
+LIB    = $(obj)lib$(BOARD).o
+
+COBJS  := $(BOARD).o
+
+SRCS   := $(COBJS:.o=.c)
+OBJS   := $(addprefix $(obj),$(COBJS))
+
+$(LIB):        $(obj).depend $(OBJS)
+       $(call cmd_link_o_target, $(OBJS))
+
+#########################################################################
+
+# defines $(obj).depend target
+include $(SRCTREE)/rules.mk
+
+sinclude $(obj).depend
diff --git a/board/teejet/mt_ventoux/mt_ventoux.c b/board/teejet/mt_ventoux/mt_ventoux.c
new file mode 100644 (file)
index 0000000..c5eb42c
--- /dev/null
@@ -0,0 +1,233 @@
+/*
+ * Copyright (C) 2011
+ * Stefano Babic, DENX Software Engineering, sbabic@denx.de.
+ *
+ * Copyright (C) 2009 TechNexion Ltd.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc.
+ */
+
+#include <common.h>
+#include <netdev.h>
+#include <fpga.h>
+#include <asm/io.h>
+#include <asm/arch/mem.h>
+#include <asm/arch/mux.h>
+#include <asm/arch/sys_proto.h>
+#include <asm/omap_gpio.h>
+#include <asm/arch/mmc_host_def.h>
+#include <i2c.h>
+#include <spartan3.h>
+#include <asm/gpio.h>
+#ifdef CONFIG_USB_EHCI
+#include <usb.h>
+#include <asm/ehci-omap.h>
+#endif
+#include "mt_ventoux.h"
+
+DECLARE_GLOBAL_DATA_PTR;
+
+#ifndef CONFIG_FPGA
+#error "The Teejet mt_ventoux must have CONFIG_FPGA enabled"
+#endif
+
+#define FPGA_RESET     62
+#define FPGA_PROG      116
+#define FPGA_CCLK      117
+#define FPGA_DIN       118
+#define FPGA_INIT      119
+#define FPGA_DONE      154
+
+/* Timing definitions for FPGA */
+static const u32 gpmc_fpga[] = {
+       FPGA_GPMC_CONFIG1,
+       FPGA_GPMC_CONFIG2,
+       FPGA_GPMC_CONFIG3,
+       FPGA_GPMC_CONFIG4,
+       FPGA_GPMC_CONFIG5,
+       FPGA_GPMC_CONFIG6,
+};
+
+#ifdef CONFIG_USB_EHCI
+static struct omap_usbhs_board_data usbhs_bdata = {
+       .port_mode[0] = OMAP_EHCI_PORT_MODE_PHY,
+       .port_mode[1] = OMAP_EHCI_PORT_MODE_PHY,
+       .port_mode[2] = OMAP_USBHS_PORT_MODE_UNUSED,
+};
+
+int ehci_hcd_init(void)
+{
+       return omap_ehci_hcd_init(&usbhs_bdata);
+}
+
+int ehci_hcd_stop(void)
+{
+       return omap_ehci_hcd_stop();
+}
+#endif
+
+
+static inline void fpga_reset(int nassert)
+{
+       gpio_set_value(FPGA_RESET, !nassert);
+}
+
+int fpga_pgm_fn(int nassert, int nflush, int cookie)
+{
+       debug("%s:%d: FPGA PROGRAM ", __func__, __LINE__);
+
+       gpio_set_value(FPGA_PROG, !nassert);
+
+       return nassert;
+}
+
+int fpga_init_fn(int cookie)
+{
+       return !gpio_get_value(FPGA_INIT);
+}
+
+int fpga_done_fn(int cookie)
+{
+       return gpio_get_value(FPGA_DONE);
+}
+
+int fpga_pre_config_fn(int cookie)
+{
+       debug("%s:%d: FPGA pre-configuration\n", __func__, __LINE__);
+
+       /* Setting GPIOs for programming Mode */
+       gpio_request(FPGA_RESET, "FPGA_RESET");
+       gpio_direction_output(FPGA_RESET, 1);
+       gpio_request(FPGA_PROG, "FPGA_PROG");
+       gpio_direction_output(FPGA_PROG, 1);
+       gpio_request(FPGA_CCLK, "FPGA_CCLK");
+       gpio_direction_output(FPGA_CCLK, 1);
+       gpio_request(FPGA_DIN, "FPGA_DIN");
+       gpio_direction_output(FPGA_DIN, 0);
+       gpio_request(FPGA_INIT, "FPGA_INIT");
+       gpio_direction_input(FPGA_INIT);
+       gpio_request(FPGA_DONE, "FPGA_DONE");
+       gpio_direction_input(FPGA_DONE);
+
+       /* Be sure that signal are deasserted */
+       gpio_set_value(FPGA_RESET, 1);
+       gpio_set_value(FPGA_PROG, 1);
+
+       return 0;
+}
+
+int fpga_post_config_fn(int cookie)
+{
+       debug("%s:%d: FPGA post-configuration\n", __func__, __LINE__);
+
+       fpga_reset(TRUE);
+       udelay(100);
+       fpga_reset(FALSE);
+
+       return 0;
+}
+
+/* Write program to the FPGA */
+int fpga_wr_fn(int nassert_write, int flush, int cookie)
+{
+       gpio_set_value(FPGA_DIN, nassert_write);
+
+       return nassert_write;
+}
+
+int fpga_clk_fn(int assert_clk, int flush, int cookie)
+{
+       gpio_set_value(FPGA_CCLK, assert_clk);
+
+       return assert_clk;
+}
+
+Xilinx_Spartan3_Slave_Serial_fns mt_ventoux_fpga_fns = {
+       fpga_pre_config_fn,
+       fpga_pgm_fn,
+       fpga_clk_fn,
+       fpga_init_fn,
+       fpga_done_fn,
+       fpga_wr_fn,
+       fpga_post_config_fn,
+};
+
+Xilinx_desc fpga = XILINX_XC6SLX4_DESC(slave_serial,
+                       (void *)&mt_ventoux_fpga_fns, 0);
+
+/* Initialize the FPGA */
+static void mt_ventoux_init_fpga(void)
+{
+       fpga_pre_config_fn(0);
+
+       /* Setting CS1 for FPGA access */
+       enable_gpmc_cs_config(gpmc_fpga, &gpmc_cfg->cs[1],
+               FPGA_BASE_ADDR, GPMC_SIZE_128M);
+
+       fpga_init();
+       fpga_add(fpga_xilinx, &fpga);
+}
+
+/*
+ * Routine: board_init
+ * Description: Early hardware init.
+ */
+int board_init(void)
+{
+       gpmc_init(); /* in SRAM or SDRAM, finish GPMC */
+
+       /* boot param addr */
+       gd->bd->bi_boot_params = (OMAP34XX_SDRC_CS0 + 0x100);
+
+       mt_ventoux_init_fpga();
+
+       return 0;
+}
+
+int misc_init_r(void)
+{
+       dieid_num_r();
+
+       return 0;
+}
+
+/*
+ * Routine: set_muxconf_regs
+ * Description: Setting up the configuration Mux registers specific to the
+ *             hardware. Many pins need to be moved from protect to primary
+ *             mode.
+ */
+void set_muxconf_regs(void)
+{
+       MUX_MT_VENTOUX();
+}
+
+/*
+ * Initializes on-chip ethernet controllers.
+ * to override, implement board_eth_init()
+ */
+int board_eth_init(bd_t *bis)
+{
+       davinci_emac_initialize();
+       return 0;
+}
+
+#if defined(CONFIG_OMAP_HSMMC) && \
+       !defined(CONFIG_SPL_BUILD)
+int board_mmc_init(bd_t *bis)
+{
+       return omap_mmc_init(0);
+}
+#endif
diff --git a/board/teejet/mt_ventoux/mt_ventoux.h b/board/teejet/mt_ventoux/mt_ventoux.h
new file mode 100644 (file)
index 0000000..34c1ec5
--- /dev/null
@@ -0,0 +1,429 @@
+/*
+ * Copyright (C) 2011 Stefano Babic <sbabic@denx.de>
+ *
+ * Author: Hardy Weng <hardy.weng@technexion.com>
+ *
+ * Copyright (C) 2010 TechNexion Ltd.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc.
+ */
+
+#ifndef _MT_VENTOUX_H_
+#define _MT_VENTOUX_H_
+
+const omap3_sysinfo sysinfo = {
+       DDR_DISCRETE,
+       "Teejet MT_VENTOUX Board",
+       "NAND",
+};
+
+/* FPGA CS1 configuration */
+#define FPGA_GPMC_CONFIG1      0x00001200
+#define FPGA_GPMC_CONFIG2      0x00111a00
+#define FPGA_GPMC_CONFIG3      0x00010100
+#define FPGA_GPMC_CONFIG4      0x06041a04
+#define FPGA_GPMC_CONFIG5      0x0019101a
+#define FPGA_GPMC_CONFIG6      0x890503c0
+#define FPGA_GPMC_CONFIG7      0x00000860
+
+#define FPGA_BASE_ADDR         0x20000000
+
+/*
+ * IEN  - Input Enable
+ * IDIS - Input Disable
+ * PTD  - Pull type Down
+ * PTU  - Pull type Up
+ * DIS  - Pull type selection is inactive
+ * EN  - Pull type selection is active
+ * M0  - Mode 0
+ * The commented string gives the final mux configuration for that pin
+ */
+#define MUX_MT_VENTOUX() \
+       /* SDRC */\
+       MUX_VAL(CP(SDRC_D0),            (IEN  | PTD | DIS | M0)) \
+       MUX_VAL(CP(SDRC_D1),            (IEN  | PTD | DIS | M0)) \
+       MUX_VAL(CP(SDRC_D2),            (IEN  | PTD | DIS | M0)) \
+       MUX_VAL(CP(SDRC_D3),            (IEN  | PTD | DIS | M0)) \
+       MUX_VAL(CP(SDRC_D4),            (IEN  | PTD | DIS | M0)) \
+       MUX_VAL(CP(SDRC_D5),            (IEN  | PTD | DIS | M0)) \
+       MUX_VAL(CP(SDRC_D6),            (IEN  | PTD | DIS | M0)) \
+       MUX_VAL(CP(SDRC_D7),            (IEN  | PTD | DIS | M0)) \
+       MUX_VAL(CP(SDRC_D8),            (IEN  | PTD | DIS | M0)) \
+       MUX_VAL(CP(SDRC_D9),            (IEN  | PTD | DIS | M0)) \
+       MUX_VAL(CP(SDRC_D10),           (IEN  | PTD | DIS | M0)) \
+       MUX_VAL(CP(SDRC_D11),           (IEN  | PTD | DIS | M0)) \
+       MUX_VAL(CP(SDRC_D12),           (IEN  | PTD | DIS | M0)) \
+       MUX_VAL(CP(SDRC_D13),           (IEN  | PTD | DIS | M0)) \
+       MUX_VAL(CP(SDRC_D14),           (IEN  | PTD | DIS | M0)) \
+       MUX_VAL(CP(SDRC_D15),           (IEN  | PTD | DIS | M0)) \
+       MUX_VAL(CP(SDRC_D16),           (IEN  | PTD | DIS | M0)) \
+       MUX_VAL(CP(SDRC_D17),           (IEN  | PTD | DIS | M0)) \
+       MUX_VAL(CP(SDRC_D18),           (IEN  | PTD | DIS | M0)) \
+       MUX_VAL(CP(SDRC_D19),           (IEN  | PTD | DIS | M0)) \
+       MUX_VAL(CP(SDRC_D20),           (IEN  | PTD | DIS | M0)) \
+       MUX_VAL(CP(SDRC_D21),           (IEN  | PTD | DIS | M0)) \
+       MUX_VAL(CP(SDRC_D22),           (IEN  | PTD | DIS | M0)) \
+       MUX_VAL(CP(SDRC_D23),           (IEN  | PTD | DIS | M0)) \
+       MUX_VAL(CP(SDRC_D24),           (IEN  | PTD | DIS | M0)) \
+       MUX_VAL(CP(SDRC_D25),           (IEN  | PTD | DIS | M0)) \
+       MUX_VAL(CP(SDRC_D26),           (IEN  | PTD | DIS | M0)) \
+       MUX_VAL(CP(SDRC_D27),           (IEN  | PTD | DIS | M0)) \
+       MUX_VAL(CP(SDRC_D28),           (IEN  | PTD | DIS | M0)) \
+       MUX_VAL(CP(SDRC_D29),           (IEN  | PTD | DIS | M0)) \
+       MUX_VAL(CP(SDRC_D30),           (IEN  | PTD | DIS | M0)) \
+       MUX_VAL(CP(SDRC_D31),           (IEN  | PTD | DIS | M0)) \
+       MUX_VAL(CP(SDRC_CLK),           (IEN  | PTD | DIS | M0)) \
+       MUX_VAL(CP(SDRC_DQS0),          (IEN  | PTD | DIS | M0)) \
+       MUX_VAL(CP(SDRC_DQS1),          (IEN  | PTD | DIS | M0)) \
+       MUX_VAL(CP(SDRC_DQS2),          (IEN  | PTD | DIS | M0)) \
+       MUX_VAL(CP(SDRC_DQS3),          (IEN  | PTD | DIS | M0)) \
+       MUX_VAL(CP(SDRC_DQS0N),         (IEN  | PTD | EN  | M0)) \
+       MUX_VAL(CP(SDRC_DQS1N),         (IEN  | PTD | EN  | M0)) \
+       MUX_VAL(CP(SDRC_DQS2N),         (IEN  | PTD | EN  | M0)) \
+       MUX_VAL(CP(SDRC_DQS3N),         (IEN  | PTD | EN  | M0)) \
+       MUX_VAL(CP(SDRC_CKE0),          (M0)) \
+       MUX_VAL(CP(SDRC_CKE1),          (M0)) \
+       MUX_VAL(CP(STRBEN_DLY0),        (IEN  | PTD | EN  | M0)) \
+       MUX_VAL(CP(STRBEN_DLY1),        (IEN  | PTD | EN  | M0)) \
+       /* GPMC */\
+       MUX_VAL(CP(GPMC_A1),            (IDIS | PTU | EN  | M0)) \
+       MUX_VAL(CP(GPMC_A2),            (IDIS | PTU | EN  | M0)) \
+       MUX_VAL(CP(GPMC_A3),            (IDIS | PTU | EN  | M0)) \
+       MUX_VAL(CP(GPMC_A4),            (IDIS | PTU | EN  | M0)) \
+       MUX_VAL(CP(GPMC_A5),            (IDIS | PTU | EN  | M0)) \
+       MUX_VAL(CP(GPMC_A6),            (IDIS | PTU | EN  | M0)) \
+       MUX_VAL(CP(GPMC_A7),            (IDIS | PTU | EN  | M0)) \
+       MUX_VAL(CP(GPMC_A8),            (IDIS | PTU | EN  | M0)) \
+       MUX_VAL(CP(GPMC_A9),            (IDIS | PTU | EN  | M0)) \
+       MUX_VAL(CP(GPMC_A10),           (IDIS | PTU | EN  | M0)) \
+       MUX_VAL(CP(GPMC_D0),            (IEN  | PTU | EN  | M0)) \
+       MUX_VAL(CP(GPMC_D1),            (IEN  | PTU | EN  | M0)) \
+       MUX_VAL(CP(GPMC_D2),            (IEN  | PTU | EN  | M0)) \
+       MUX_VAL(CP(GPMC_D3),            (IEN  | PTU | EN  | M0)) \
+       MUX_VAL(CP(GPMC_D4),            (IEN  | PTU | EN  | M0)) \
+       MUX_VAL(CP(GPMC_D5),            (IEN  | PTU | EN  | M0)) \
+       MUX_VAL(CP(GPMC_D6),            (IEN  | PTU | EN  | M0)) \
+       MUX_VAL(CP(GPMC_D7),            (IEN  | PTU | EN  | M0)) \
+       MUX_VAL(CP(GPMC_D8),            (IEN  | PTU | EN  | M0)) \
+       MUX_VAL(CP(GPMC_D9),            (IEN  | PTU | EN  | M0)) \
+       MUX_VAL(CP(GPMC_D10),           (IEN  | PTU | EN  | M0)) \
+       MUX_VAL(CP(GPMC_D11),           (IEN  | PTU | EN  | M0)) \
+       MUX_VAL(CP(GPMC_D12),           (IEN  | PTU | EN  | M0)) \
+       MUX_VAL(CP(GPMC_D13),           (IEN  | PTU | EN  | M0)) \
+       MUX_VAL(CP(GPMC_D14),           (IEN  | PTU | EN  | M0)) \
+       MUX_VAL(CP(GPMC_D15),           (IEN  | PTU | EN  | M0)) \
+       MUX_VAL(CP(GPMC_NCS0),          (IDIS | PTU | EN  | M0)) \
+       MUX_VAL(CP(GPMC_NCS1),          (IEN | PTU | EN  | M0)) \
+       MUX_VAL(CP(GPMC_NCS2),          (IDIS | PTD | EN  | M4))/* GPIO 53 */\
+       MUX_VAL(CP(GPMC_NCS3),          (IEN | PTU | EN | M4))  /* GPIO 54 */\
+       MUX_VAL(CP(GPMC_NCS4),          (IEN | PTD | EN | M4)) \
+                       /* GPIO 55 : NFS */\
+       MUX_VAL(CP(GPMC_NCS5),          (IDIS | PTU | EN  | M4)) \
+       MUX_VAL(CP(GPMC_NCS6),          (IDIS  | PTD | EN | M3)) /*PWM11*/ \
+       MUX_VAL(CP(GPMC_NCS7),          (IDIS  | PTD | EN | M4)) /*GPIO_58*/ \
+       MUX_VAL(CP(GPMC_CLK),           (IDIS | PTU | EN  | M0)) \
+       MUX_VAL(CP(GPMC_NADV_ALE),      (IDIS | PTD | DIS | M0)) \
+       MUX_VAL(CP(GPMC_NOE),           (IDIS | PTD | DIS | M0)) \
+       MUX_VAL(CP(GPMC_NWE),           (IDIS | PTD | DIS | M0)) \
+       MUX_VAL(CP(GPMC_NBE0_CLE),      (IDIS | PTU | EN  | M0)) \
+       MUX_VAL(CP(GPMC_NBE1),          (IEN  | PTU | EN  | M0)) \
+       MUX_VAL(CP(GPMC_NWP),           (IEN  | PTD | DIS | M4)) \
+                       /*GPIO_62: FPGA_RESET */ \
+       MUX_VAL(CP(GPMC_WAIT0),         (IEN  | PTU | EN  | M4)) \
+       MUX_VAL(CP(GPMC_WAIT1),         (IEN  | PTU | EN  | M4)) \
+       MUX_VAL(CP(GPMC_WAIT2),         (IEN  | PTU | EN  | M4)) /*GPIO_64*/ \
+       MUX_VAL(CP(GPMC_WAIT3),         (IEN  | PTU | EN  | M4)) \
+       /* DSS */\
+       MUX_VAL(CP(DSS_PCLK),           (IDIS | PTD | DIS | M0)) \
+       MUX_VAL(CP(DSS_HSYNC),          (IDIS | PTD | DIS | M0)) \
+       MUX_VAL(CP(DSS_VSYNC),          (IDIS | PTD | DIS | M0)) \
+       MUX_VAL(CP(DSS_ACBIAS),         (IDIS | PTD | DIS | M0)) \
+       MUX_VAL(CP(DSS_DATA0),          (IDIS | PTD | DIS | M0)) \
+       MUX_VAL(CP(DSS_DATA1),          (IDIS | PTD | DIS | M0)) \
+       MUX_VAL(CP(DSS_DATA2),          (IDIS | PTD | DIS | M0)) \
+       MUX_VAL(CP(DSS_DATA3),          (IDIS | PTD | DIS | M0)) \
+       MUX_VAL(CP(DSS_DATA4),          (IDIS | PTD | DIS | M0)) \
+       MUX_VAL(CP(DSS_DATA5),          (IDIS | PTD | DIS | M0)) \
+       MUX_VAL(CP(DSS_DATA6),          (IDIS | PTD | DIS | M0)) \
+       MUX_VAL(CP(DSS_DATA7),          (IDIS | PTD | DIS | M0)) \
+       MUX_VAL(CP(DSS_DATA8),          (IDIS | PTD | DIS | M0)) \
+       MUX_VAL(CP(DSS_DATA9),          (IDIS | PTD | DIS | M0)) \
+       MUX_VAL(CP(DSS_DATA10),         (IDIS | PTD | DIS | M0)) \
+       MUX_VAL(CP(DSS_DATA11),         (IDIS | PTD | DIS | M0)) \
+       MUX_VAL(CP(DSS_DATA12),         (IDIS | PTD | DIS | M0)) \
+       MUX_VAL(CP(DSS_DATA13),         (IDIS | PTD | DIS | M0)) \
+       MUX_VAL(CP(DSS_DATA14),         (IDIS | PTD | DIS | M0)) \
+       MUX_VAL(CP(DSS_DATA15),         (IDIS | PTD | DIS | M0)) \
+       MUX_VAL(CP(DSS_DATA16),         (IDIS | PTD | DIS | M0)) \
+       MUX_VAL(CP(DSS_DATA17),         (IDIS | PTD | DIS | M0)) \
+       MUX_VAL(CP(DSS_DATA18),         (IDIS | PTD | DIS | M0)) \
+       MUX_VAL(CP(DSS_DATA19),         (IDIS | PTD | DIS | M0)) \
+       MUX_VAL(CP(DSS_DATA20),         (IDIS | PTD | DIS | M0)) \
+       MUX_VAL(CP(DSS_DATA21),         (IDIS | PTD | DIS | M0)) \
+       MUX_VAL(CP(DSS_DATA22),         (IDIS | PTD | DIS | M0)) \
+       MUX_VAL(CP(DSS_DATA23),         (IDIS | PTD | DIS | M0)) \
+       /* CAMERA */\
+       MUX_VAL(CP(CAM_HS),             (IEN  | PTU | EN  | M0)) \
+       MUX_VAL(CP(CAM_VS),             (IEN  | PTU | EN  | M0)) \
+       MUX_VAL(CP(CAM_XCLKA),          (IDIS | PTD | DIS | M0)) \
+       MUX_VAL(CP(CAM_PCLK),           (IEN  | PTU | EN  | M0)) \
+       MUX_VAL(CP(CAM_FLD),            (IDIS | PTD | DIS | M4)) /*GPIO_98*/\
+       MUX_VAL(CP(CAM_D0),             (IEN  | PTD | DIS | M0)) \
+       MUX_VAL(CP(CAM_D1),             (IEN  | PTD | DIS | M0)) \
+       MUX_VAL(CP(CAM_D2),             (IEN  | PTD | DIS | M0)) \
+       MUX_VAL(CP(CAM_D3),             (IEN  | PTD | DIS | M0)) \
+       MUX_VAL(CP(CAM_D4),             (IEN  | PTD | DIS | M0)) \
+       MUX_VAL(CP(CAM_D5),             (IEN  | PTD | DIS | M0)) \
+       MUX_VAL(CP(CAM_D6),             (IEN  | PTD | DIS | M0)) \
+       MUX_VAL(CP(CAM_D7),             (IEN  | PTD | DIS | M0)) \
+       MUX_VAL(CP(CAM_D8),             (IEN  | PTD | DIS | M0)) \
+       MUX_VAL(CP(CAM_D9),             (IEN  | PTD | DIS | M0)) \
+       MUX_VAL(CP(CAM_D10),            (IEN  | PTD | DIS | M0)) \
+       MUX_VAL(CP(CAM_D11),            (IEN  | PTD | DIS | M0)) \
+       MUX_VAL(CP(CAM_XCLKB),          (IDIS | PTD | DIS | M0)) \
+       MUX_VAL(CP(CAM_WEN),            (IEN  | PTD | DIS | M4)) /*GPIO_167*/\
+       MUX_VAL(CP(CAM_STROBE),         (IDIS | PTD | DIS | M0)) \
+       MUX_VAL(CP(CSI2_DX0),           (IEN  | PTD | DIS | M0)) \
+       MUX_VAL(CP(CSI2_DY0),           (IEN  | PTD | DIS | M0)) \
+       MUX_VAL(CP(CSI2_DX1),           (IEN  | PTD | DIS | M0)) \
+       MUX_VAL(CP(CSI2_DY1),           (IEN  | PTD | DIS | M0)) \
+       /* MMC */\
+       MUX_VAL(CP(MMC1_CLK),           (IEN  | PTU | EN  | M0)) \
+       MUX_VAL(CP(MMC1_CMD),           (IEN  | PTU | DIS | M0)) \
+       MUX_VAL(CP(MMC1_DAT0),          (IEN  | PTU | DIS | M0)) \
+       MUX_VAL(CP(MMC1_DAT1),          (IEN  | PTU | DIS | M0)) \
+       MUX_VAL(CP(MMC1_DAT2),          (IEN  | PTU | DIS | M0)) \
+       MUX_VAL(CP(MMC1_DAT3),          (IEN  | PTU | DIS | M0)) \
+       MUX_VAL(CP(MMC1_DAT4),          (IEN  | PTU | EN  | M4)) \
+                       /* GPIO_126: CardDetect */\
+       MUX_VAL(CP(MMC1_DAT5),          (IEN  | PTU | EN  | M4)) \
+       MUX_VAL(CP(MMC1_DAT6),          (IEN  | PTU | EN  | M4)) \
+       MUX_VAL(CP(MMC1_DAT7),          (IEN  | PTU | EN  | M4)) \
+       \
+       MUX_VAL(CP(MMC2_CLK),           (IEN  | PTU | EN | M0)) /*MMC2_CLK*/\
+       MUX_VAL(CP(MMC2_CMD),           (IEN  | PTU | DIS  | M0)) /*MMC2_CMD*/\
+       MUX_VAL(CP(MMC2_DAT0),          (IEN  | PTU | DIS  | M0)) /*MMC2_DAT0*/\
+       MUX_VAL(CP(MMC2_DAT1),          (IEN  | PTU | DIS  | M0)) /*MMC2_DAT1*/\
+       MUX_VAL(CP(MMC2_DAT2),          (IEN  | PTU | DIS  | M0)) /*MMC2_DAT2*/\
+       MUX_VAL(CP(MMC2_DAT3),          (IEN  | PTU | DIS  | M0)) /*MMC2_DAT3*/\
+       MUX_VAL(CP(MMC2_DAT4),          (IDIS  | PTU | EN  | M4)) \
+       MUX_VAL(CP(MMC2_DAT5),          (IDIS  | PTU | EN  | M4)) \
+       MUX_VAL(CP(MMC2_DAT6),          (IDIS  | PTU | EN  | M4)) \
+                       /* GPIO_138: LCD_ENVD */\
+       MUX_VAL(CP(MMC2_DAT7),          (IDIS  | PTU | EN  | M4)) \
+                       /* GPIO_139: LCD_PON */\
+       /* McBSP */\
+       MUX_VAL(CP(MCBSP_CLKS),         (IEN  | PTU | DIS | M0)) \
+       MUX_VAL(CP(MCBSP1_CLKR),        (IEN  | PTD | DIS | M0)) \
+       MUX_VAL(CP(MCBSP1_FSR),         (IDIS | PTU | EN  | M0)) \
+       MUX_VAL(CP(MCBSP1_DX),          (IDIS | PTD | DIS | M0)) \
+       MUX_VAL(CP(MCBSP1_DR),          (IEN  | PTD | DIS | M0)) \
+       MUX_VAL(CP(MCBSP1_FSX),         (IEN  | PTD | DIS | M0)) \
+       MUX_VAL(CP(MCBSP1_CLKX),        (IEN  | PTD | DIS | M0)) \
+       \
+       MUX_VAL(CP(MCBSP2_FSX),         (IEN | PTD | EN | M4)) \
+                       /* GPIO_116: FPGA_PROG */ \
+       MUX_VAL(CP(MCBSP2_CLKX),        (IEN | PTD | EN | M4)) \
+                       /* GPIO_117: FPGA_CCLK */ \
+       MUX_VAL(CP(MCBSP2_DR),          (IEN | PTD | EN | M4)) \
+                       /* GPIO_118: FPGA_DIN */ \
+       MUX_VAL(CP(MCBSP2_DX),          (IEN | PTD | EN | M4)) \
+                       /* GPIO_119: FPGA_INIT */ \
+       \
+       MUX_VAL(CP(MCBSP3_DX),          (IEN | PTU | EN | M4)) \
+                       /* GPIO_140: speaker #mute */\
+       MUX_VAL(CP(MCBSP3_DR),          (IEN  | PTU | EN | M4)) \
+                       /* GPIO_141: Buzz Hi */\
+       MUX_VAL(CP(MCBSP3_CLKX),        (IEN  | PTU | EN | M4)) \
+       MUX_VAL(CP(MCBSP3_FSX),         (IEN  | PTU | EN | M4)) \
+       \
+       MUX_VAL(CP(MCBSP4_CLKX),        (IEN | PTD | DIS | M4)) \
+                       /*GPIO_152: Ignition Sense */ \
+       MUX_VAL(CP(MCBSP4_DR),          (IDIS | PTD | DIS | M4)) \
+                       /*GPIO_153: Power Button Sense */ \
+       MUX_VAL(CP(MCBSP4_DX),          (IEN | PTU | DIS | M4)) \
+                       /* GPIO_154: FPGA_DONE */ \
+       MUX_VAL(CP(MCBSP4_FSX),         (IEN | PTD | DIS | M4)) \
+                       /* GPIO_155: CA8_irq */ \
+       /* UART */\
+       MUX_VAL(CP(UART1_TX),           (IDIS | PTD | DIS | M0)) \
+       MUX_VAL(CP(UART1_RTS),          (IEN | PTU | EN | M4)) \
+                       /* GPIO_149: USB status 2 */\
+       MUX_VAL(CP(UART1_CTS),          (IEN | PTU | EN | M4)) \
+                       /* GPIO_150: USB status 1 */\
+       \
+       MUX_VAL(CP(UART1_RX),           (IEN  | PTD | DIS | M0)) \
+       MUX_VAL(CP(UART2_CTS),          (IEN  | PTU | EN  | M0)) \
+       MUX_VAL(CP(UART2_RTS),          (IDIS | PTD | DIS | M0)) \
+       MUX_VAL(CP(UART2_TX),           (IDIS | PTD | DIS | M0)) \
+       MUX_VAL(CP(UART2_RX),           (IEN  | PTD | DIS | M0)) \
+       \
+       MUX_VAL(CP(UART3_CTS_RCTX),     (IDIS  | PTD | DIS | M4)) \
+                       /*GPIO_163 : TS_PENIRQ*/ \
+       MUX_VAL(CP(UART3_RTS_SD),       (IEN | PTD | DIS | M4)) \
+                       /*GPIO_164 : MMC */\
+       MUX_VAL(CP(UART3_RX_IRRX),      (IEN  | PTD | DIS | M0)) \
+       MUX_VAL(CP(UART3_TX_IRTX),      (IDIS | PTD | DIS | M0)) \
+       /* I2C */\
+       MUX_VAL(CP(I2C1_SCL),           (IEN  | PTU | EN  | M0)) \
+       MUX_VAL(CP(I2C1_SDA),           (IEN  | PTU | EN  | M0)) \
+       MUX_VAL(CP(I2C2_SCL),           (IEN  | PTU | EN  | M0)) \
+       MUX_VAL(CP(I2C2_SDA),           (IEN  | PTU | EN  | M0)) \
+       MUX_VAL(CP(I2C3_SCL),           (IEN  | PTU | EN  | M0)) \
+       MUX_VAL(CP(I2C3_SDA),           (IEN  | PTU | EN  | M0)) \
+       MUX_VAL(CP(I2C4_SCL),           (IEN  | PTU | EN  | M0)) \
+       MUX_VAL(CP(I2C4_SDA),           (IEN  | PTU | EN  | M0)) \
+       /* McSPI */\
+       MUX_VAL(CP(MCSPI1_CLK),         (IEN  | PTD | DIS | M0)) \
+       MUX_VAL(CP(MCSPI1_SIMO),        (IEN  | PTD | DIS | M0)) \
+       MUX_VAL(CP(MCSPI1_SOMI),        (IEN  | PTD | DIS | M0)) \
+       MUX_VAL(CP(MCSPI1_CS0),         (IEN  | PTD | EN  | M0)) \
+       MUX_VAL(CP(MCSPI1_CS1),         (IEN | PTD | EN | M4)) /*GPIO_175*/\
+       MUX_VAL(CP(MCSPI1_CS2),         (IEN | PTD | EN | M4)) /*GPIO_176*/\
+       MUX_VAL(CP(MCSPI1_CS3),         (IEN | PTD | EN | M4)) \
+       \
+       MUX_VAL(CP(MCSPI2_CLK),         (IEN  | PTD | DIS | M0)) \
+       MUX_VAL(CP(MCSPI2_SIMO),        (IEN  | PTD | DIS | M0)) \
+       MUX_VAL(CP(MCSPI2_SOMI),        (IEN  | PTD | DIS | M0)) \
+       MUX_VAL(CP(MCSPI2_CS0),         (IEN  | PTD | EN  | M4)) \
+       MUX_VAL(CP(MCSPI2_CS1),         (IEN  | PTD | EN  | M0)) \
+       /* CCDC */\
+       MUX_VAL(CP(CCDC_PCLK),          (IEN  | PTU | EN  | M0)) \
+       MUX_VAL(CP(CCDC_FIELD),         (IEN  | PTD | DIS | M4)) \
+                       /* GPIO95: #Enable Output */\
+       MUX_VAL(CP(CCDC_HD),            (IEN  | PTU | EN  | M0)) \
+       MUX_VAL(CP(CCDC_VD),            (IEN  | PTU | EN  | M0)) \
+       MUX_VAL(CP(CCDC_WEN),           (IEN  | PTD | DIS | M4)) \
+                       /* GPIO 99: #SOM_PWR_OFF */\
+       MUX_VAL(CP(CCDC_DATA0),         (IEN  | PTD | DIS | M0)) \
+       MUX_VAL(CP(CCDC_DATA1),         (IEN  | PTD | DIS | M4)) \
+                       /* GPIO_100: #power out */\
+       MUX_VAL(CP(CCDC_DATA2),         (IEN  | PTD | DIS | M0)) \
+       MUX_VAL(CP(CCDC_DATA3),         (IEN  | PTD | DIS | M0)) \
+       MUX_VAL(CP(CCDC_DATA4),         (IEN  | PTD | DIS | M0)) \
+       MUX_VAL(CP(CCDC_DATA5),         (IEN  | PTD | DIS | M0)) \
+       MUX_VAL(CP(CCDC_DATA6),         (IEN  | PTD | DIS | M0)) \
+       MUX_VAL(CP(CCDC_DATA7),         (IEN  | PTD | DIS | M0)) \
+       /* RMII */\
+       MUX_VAL(CP(RMII_MDIO_DATA),     (IEN  |  M0)) \
+       MUX_VAL(CP(RMII_MDIO_CLK),      (M0)) \
+       MUX_VAL(CP(RMII_RXD0)   ,       (IEN  | PTD | M0)) \
+       MUX_VAL(CP(RMII_RXD1),          (IEN  | PTD | M0)) \
+       MUX_VAL(CP(RMII_CRS_DV),        (IEN  | PTD | M0)) \
+       MUX_VAL(CP(RMII_RXER),          (PTD | M0)) \
+       MUX_VAL(CP(RMII_TXD0),          (PTD | M0)) \
+       MUX_VAL(CP(RMII_TXD1),          (PTD | M0)) \
+       MUX_VAL(CP(RMII_TXEN),          (PTD | M0)) \
+       MUX_VAL(CP(RMII_50MHZ_CLK),     (IEN  | PTD | EN  | M0)) \
+       /* HECC */\
+       MUX_VAL(CP(HECC1_TXD),          (IEN  | PTU | EN  | M0)) \
+       MUX_VAL(CP(HECC1_RXD),          (IEN  | PTU | EN  | M0)) \
+       /* HSUSB */\
+       MUX_VAL(CP(HSUSB0_CLK),         (IEN  | PTD | DIS | M0)) \
+       MUX_VAL(CP(HSUSB0_STP),         (IEN  | PTU | DIS  | M0)) \
+       MUX_VAL(CP(HSUSB0_DIR),         (IEN  | PTD | DIS | M0)) \
+       MUX_VAL(CP(HSUSB0_NXT),         (IEN  | PTU | DIS | M0)) \
+       MUX_VAL(CP(HSUSB0_DATA0),       (IEN  | PTD | DIS | M0)) \
+       MUX_VAL(CP(HSUSB0_DATA1),       (IEN  | PTD | DIS | M0)) \
+       MUX_VAL(CP(HSUSB0_DATA2),       (IEN  | PTD | DIS | M0)) \
+       MUX_VAL(CP(HSUSB0_DATA3),       (IEN  | PTD | DIS | M0)) \
+       MUX_VAL(CP(HSUSB0_DATA4),       (IEN  | PTD | DIS | M0)) \
+       MUX_VAL(CP(HSUSB0_DATA5),       (IEN  | PTD | DIS | M0)) \
+       MUX_VAL(CP(HSUSB0_DATA6),       (IEN  | PTD | DIS | M0)) \
+       MUX_VAL(CP(HSUSB0_DATA7),       (IEN  | PTD | DIS | M0)) \
+       MUX_VAL(CP(USB0_DRVBUS),        (IEN  | PTD | EN  | M0)) \
+       /* HDQ */\
+       MUX_VAL(CP(HDQ_SIO),            (IEN | PTD | EN | M4)) \
+                       /* GPIO_170: auto update */\
+       /* Control and debug */\
+       MUX_VAL(CP(SYS_32K),            (IEN  | PTD | DIS | M0)) \
+       MUX_VAL(CP(SYS_CLKREQ),         (IEN  | PTD | DIS | M0)) \
+       MUX_VAL(CP(SYS_NIRQ),           (IEN  | PTU | EN  | M0)) \
+       MUX_VAL(CP(SYS_NRESWARM),       (IDIS | PTU | DIS | M4)) \
+                       /* - GPIO30 */\
+       MUX_VAL(CP(SYS_BOOT0),          (IEN  | PTD | DIS | M4)) /*GPIO_2*/\
+       MUX_VAL(CP(SYS_BOOT1),          (IEN  | PTD | DIS | M4)) /*GPIO_3 */\
+       MUX_VAL(CP(SYS_BOOT2),          (IEN  | PTD | DIS | M4)) /*GPIO_4*/\
+       MUX_VAL(CP(SYS_BOOT3),          (IEN  | PTD | DIS | M4)) /*GPIO_5*/\
+       MUX_VAL(CP(SYS_BOOT4),          (IEN  | PTD | DIS | M4)) /*GPIO_6*/\
+       MUX_VAL(CP(SYS_BOOT5),          (IEN  | PTD | DIS | M4)) /*GPIO_7*/\
+       MUX_VAL(CP(SYS_BOOT6),          (IDIS | PTD | DIS | M4)) /*GPIO_8*/\
+       MUX_VAL(CP(SYS_BOOT7),          (IEN  | PTD | EN  | M0)) \
+       MUX_VAL(CP(SYS_BOOT8),          (IEN  | PTD | EN  | M0)) \
+       \
+       MUX_VAL(CP(SYS_OFF_MODE),       (IEN  | PTD | DIS | M0)) \
+       MUX_VAL(CP(SYS_CLKOUT1),        (IEN  | PTD | DIS | M0)) \
+       MUX_VAL(CP(SYS_CLKOUT2),        (IEN  | PTU | EN  | M0)) \
+       /* JTAG */\
+       MUX_VAL(CP(JTAG_nTRST),         (IEN  | PTD | DIS | M0)) \
+       MUX_VAL(CP(JTAG_TCK),           (IEN  | PTD | DIS | M0)) \
+       MUX_VAL(CP(JTAG_TMS),           (IEN  | PTD | DIS | M0)) \
+       MUX_VAL(CP(JTAG_TDI),           (IEN  | PTD | DIS | M0)) \
+       MUX_VAL(CP(JTAG_EMU0),          (IDIS  | PTD | EN | M4)) /*GPIO_11*/ \
+       MUX_VAL(CP(JTAG_EMU1),          (IDIS  | PTD | EN | M4)) /*GPIO_31*/ \
+       /* ETK (ES2 onwards) */\
+       MUX_VAL(CP(ETK_CLK_ES2),        (IDIS | PTD | DIS  | M3)) \
+                                       /* hsusb1_stp */ \
+       MUX_VAL(CP(ETK_CTL_ES2),        (IDIS | PTD | DIS | M3)) \
+                                       /* hsusb1_clk */\
+       MUX_VAL(CP(ETK_D0_ES2),         (IEN  | PTU | EN  | M3)) \
+       MUX_VAL(CP(ETK_D1_ES2),         (IEN  | PTU | EN  | M3)) \
+       MUX_VAL(CP(ETK_D2_ES2),         (IEN  | PTU | EN  | M3)) \
+       MUX_VAL(CP(ETK_D3_ES2),         (IEN  | PTU | EN  | M3)) \
+       MUX_VAL(CP(ETK_D4_ES2),         (IEN  | PTU | EN  | M3)) \
+       MUX_VAL(CP(ETK_D5_ES2),         (IEN  | PTU | EN  | M3)) \
+       MUX_VAL(CP(ETK_D6_ES2),         (IEN  | PTU | EN  | M3)) \
+       MUX_VAL(CP(ETK_D7_ES2),         (IEN  | PTU | EN  | M3)) \
+       MUX_VAL(CP(ETK_D8_ES2),         (IEN  | PTD | EN  | M3)) \
+       MUX_VAL(CP(ETK_D9_ES2),         (IEN  | PTD | EN  | M3)) \
+       MUX_VAL(CP(ETK_D10_ES2),        (IEN  | PTU | EN  | M4)) \
+       MUX_VAL(CP(ETK_D11_ES2),        (IDIS | PTD | DIS | M4)) \
+       MUX_VAL(CP(ETK_D12_ES2),        (IEN  | PTD | DIS | M3)) \
+       MUX_VAL(CP(ETK_D13_ES2),        (IEN  | PTD | DIS | M3)) \
+       MUX_VAL(CP(ETK_D14_ES2),        (IEN  | PTD | DIS | M3)) \
+       MUX_VAL(CP(ETK_D15_ES2),        (IEN  | PTD | DIS | M3)) \
+       /* Die to Die */\
+       MUX_VAL(CP(D2D_MCAD34),         (IEN  | PTD | EN  | M0)) \
+       MUX_VAL(CP(D2D_MCAD35),         (IEN  | PTD | EN  | M0)) \
+       MUX_VAL(CP(D2D_MCAD36),         (IEN  | PTD | EN  | M0)) \
+       MUX_VAL(CP(D2D_CLK26MI),        (IEN  | PTD | DIS | M0)) \
+       MUX_VAL(CP(D2D_NRESPWRON),      (IEN  | PTD | EN  | M0)) \
+       MUX_VAL(CP(D2D_NRESWARM),       (IEN  | PTU | EN  | M0)) \
+       MUX_VAL(CP(D2D_ARM9NIRQ),       (IEN  | PTD | DIS | M0)) \
+       MUX_VAL(CP(D2D_UMA2P6FIQ),      (IEN  | PTD | DIS | M0)) \
+       MUX_VAL(CP(D2D_SPINT),          (IEN  | PTD | EN  | M0)) \
+       MUX_VAL(CP(D2D_FRINT),          (IEN  | PTD | EN  | M0)) \
+       MUX_VAL(CP(D2D_DMAREQ0),        (IEN  | PTD | DIS | M0)) \
+       MUX_VAL(CP(D2D_DMAREQ1),        (IEN  | PTD | DIS | M0)) \
+       MUX_VAL(CP(D2D_DMAREQ2),        (IEN  | PTD | DIS | M0)) \
+       MUX_VAL(CP(D2D_DMAREQ3),        (IEN  | PTD | DIS | M0)) \
+       MUX_VAL(CP(D2D_N3GTRST),        (IEN  | PTD | DIS | M0)) \
+       MUX_VAL(CP(D2D_N3GTDI),         (IEN  | PTD | DIS | M0)) \
+       MUX_VAL(CP(D2D_N3GTDO),         (IEN  | PTD | DIS | M0)) \
+       MUX_VAL(CP(D2D_N3GTMS),         (IEN  | PTD | DIS | M0)) \
+       MUX_VAL(CP(D2D_N3GTCK),         (IEN  | PTD | DIS | M0)) \
+       MUX_VAL(CP(D2D_N3GRTCK),        (IEN  | PTD | DIS | M0)) \
+       MUX_VAL(CP(D2D_MSTDBY),         (IEN  | PTU | EN  | M0)) \
+       MUX_VAL(CP(D2D_SWAKEUP),        (IEN  | PTD | EN  | M0)) \
+       MUX_VAL(CP(D2D_IDLEREQ),        (IEN  | PTD | DIS | M0)) \
+       MUX_VAL(CP(D2D_IDLEACK),        (IEN  | PTU | EN  | M0)) \
+       MUX_VAL(CP(D2D_MWRITE),         (IEN  | PTD | DIS | M0)) \
+       MUX_VAL(CP(D2D_SWRITE),         (IEN  | PTD | DIS | M0)) \
+       MUX_VAL(CP(D2D_MREAD),          (IEN  | PTD | DIS | M0)) \
+       MUX_VAL(CP(D2D_SREAD),          (IEN  | PTD | DIS | M0)) \
+       MUX_VAL(CP(D2D_MBUSFLAG),       (IEN  | PTD | DIS | M0)) \
+       MUX_VAL(CP(D2D_SBUSFLAG),       (IEN  | PTD | DIS | M0)) \
+
+#endif
index 6a9f788299f818cefde1f99107cb0f7e584d53d8..13dc60361a272281439be39c85795f7e54a77a3e 100644 (file)
@@ -18,6 +18,7 @@
 #include <asm/arch/hardware.h>
 #include <asm/arch/common_def.h>
 #include <serial.h>
+#include <i2c.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -42,6 +43,12 @@ int init_basic_setup(void)
 int board_init(void)
 {
        enable_uart0_pin_mux();
+
+#ifdef CONFIG_I2C
+       enable_i2c0_pin_mux();
+       i2c_init(CONFIG_SYS_I2C_SPEED, CONFIG_SYS_I2C_SLAVE);
+#endif
+
        init_basic_setup();
 
        return 0;
index 4cb0cdf361a8a8782e77930ab48bdc483e214cc2..9ccb43642b38cc44960a7893f7af8de161f52539 100644 (file)
@@ -272,6 +272,14 @@ static struct module_pin_mux mmc0_pin_mux[] = {
 };
 #endif
 
+static struct module_pin_mux i2c0_pin_mux[] = {
+       {OFFSET(i2c0_sda), (MODE(0) | RXACTIVE |
+                       PULLUDEN | SLEWCTRL)}, /* I2C_DATA */
+       {OFFSET(i2c0_scl), (MODE(0) | RXACTIVE |
+                       PULLUDEN | SLEWCTRL)}, /* I2C_SCLK */
+       {-1},
+};
+
 /*
  * Configure the pin mux for the module
  */
@@ -297,3 +305,8 @@ void enable_mmc0_pin_mux(void)
        configure_module_pin_mux(mmc0_pin_mux);
 }
 #endif
+
+void enable_i2c0_pin_mux(void)
+{
+       configure_module_pin_mux(i2c0_pin_mux);
+}
index 5c04b34e1ab0140aca93e7752c8672ce7aebc0b9..87578763bb737eaf656370fd3dfa18a7eace9146 100644 (file)
 #include <asm/arch/sys_proto.h>
 #include <asm/gpio.h>
 #include <asm/mach-types.h>
+#include "beagle.h"
+#include <command.h>
+
 #ifdef CONFIG_USB_EHCI
 #include <usb.h>
-#include <asm/arch/clocks.h>
-#include <asm/arch/clocks_omap3.h>
-#include <asm/arch/ehci_omap3.h>
-/* from drivers/usb/host/ehci-core.h */
-extern struct ehci_hccr *hccr;
-extern volatile struct ehci_hcor *hcor;
+#include <asm/ehci-omap.h>
 #endif
-#include "beagle.h"
-#include <command.h>
 
 #define pr_debug(fmt, args...) debug(fmt, ##args)
 
@@ -166,6 +162,13 @@ void get_board_mem_timings(u32 *mcfg, u32 *ctrla, u32 *ctrlb, u32 *rfr_ctrl,
                        *ctrlb = NUMONYX_V_ACTIMB_165;
                        *rfr_ctrl = SDP_3430_SDRC_RFR_CTRL_165MHz;
                        break;
+               } else if (pop_mfr == NAND_MFR_MICRON && pop_id == 0xba) {
+                       /* Beagleboard Rev C4, 512MB Nand/256MB DDR*/
+                       *mcfg = MICRON_V_MCFG_165(128 << 20);
+                       *ctrla = MICRON_V_ACTIMA_165;
+                       *ctrlb = MICRON_V_ACTIMB_165;
+                       *rfr_ctrl = SDP_3430_SDRC_RFR_CTRL_165MHz;
+                       break;
                } else if (pop_mfr == NAND_MFR_MICRON && pop_id == 0xbc) {
                        /* Beagleboard Rev C5, 256MB DDR */
                        *mcfg = MICRON_V_MCFG_200(256 << 20);
@@ -445,24 +448,6 @@ int board_mmc_init(bd_t *bis)
 #endif
 
 #ifdef CONFIG_USB_EHCI
-
-#define GPIO_PHY_RESET 147
-
-/* Reset is needed otherwise the kernel-driver will throw an error. */
-int ehci_hcd_stop(void)
-{
-       pr_debug("Resetting OMAP3 EHCI\n");
-       gpio_set_value(GPIO_PHY_RESET, 0);
-       writel(OMAP_UHH_SYSCONFIG_SOFTRESET, OMAP3_UHH_BASE + OMAP_UHH_SYSCONFIG);
-       /* disable USB clocks */
-       struct prcm *prcm_base = (struct prcm *)PRCM_BASE;
-       sr32(&prcm_base->iclken_usbhost, 0, 1, 0);
-       sr32(&prcm_base->fclken_usbhost, 0, 2, 0);
-       sr32(&prcm_base->iclken3_core, 2, 1, 0);
-       sr32(&prcm_base->fclken3_core, 2, 1, 0);
-       return 0;
-}
-
 /* Call usb_stop() before starting the kernel */
 void show_boot_progress(int val)
 {
@@ -470,77 +455,20 @@ void show_boot_progress(int val)
                usb_stop();
 }
 
-/*
- * Initialize the OMAP3 EHCI controller and PHY on the BeagleBoard.
- * Based on "drivers/usb/host/ehci-omap.c" from Linux 2.6.37.
- * See there for additional Copyrights.
- */
+static struct omap_usbhs_board_data usbhs_bdata = {
+       .port_mode[0] = OMAP_EHCI_PORT_MODE_PHY,
+       .port_mode[1] = OMAP_EHCI_PORT_MODE_PHY,
+       .port_mode[2] = OMAP_USBHS_PORT_MODE_UNUSED
+};
+
 int ehci_hcd_init(void)
 {
-       pr_debug("Initializing OMAP3 ECHI\n");
-
-       /* Put the PHY in RESET */
-       gpio_request(GPIO_PHY_RESET, "");
-       gpio_direction_output(GPIO_PHY_RESET, 0);
-       gpio_set_value(GPIO_PHY_RESET, 0);
-
-       /* Hold the PHY in RESET for enough time till DIR is high */
-       /* Refer: ISSUE1 */
-       udelay(10);
-
-       struct prcm *prcm_base = (struct prcm *)PRCM_BASE;
-       /* Enable USBHOST_L3_ICLK (USBHOST_MICLK) */
-       sr32(&prcm_base->iclken_usbhost, 0, 1, 1);
-       /*
-        * Enable USBHOST_48M_FCLK (USBHOST_FCLK1)
-        * and USBHOST_120M_FCLK (USBHOST_FCLK2)
-        */
-       sr32(&prcm_base->fclken_usbhost, 0, 2, 3);
-       /* Enable USBTTL_ICLK */
-       sr32(&prcm_base->iclken3_core, 2, 1, 1);
-       /* Enable USBTTL_FCLK */
-       sr32(&prcm_base->fclken3_core, 2, 1, 1);
-       pr_debug("USB clocks enabled\n");
-
-       /* perform TLL soft reset, and wait until reset is complete */
-       writel(OMAP_USBTLL_SYSCONFIG_SOFTRESET,
-               OMAP3_USBTLL_BASE + OMAP_USBTLL_SYSCONFIG);
-       /* Wait for TLL reset to complete */
-       while (!(readl(OMAP3_USBTLL_BASE + OMAP_USBTLL_SYSSTATUS)
-                       & OMAP_USBTLL_SYSSTATUS_RESETDONE));
-       pr_debug("TLL reset done\n");
-
-       writel(OMAP_USBTLL_SYSCONFIG_ENAWAKEUP |
-               OMAP_USBTLL_SYSCONFIG_SIDLEMODE |
-               OMAP_USBTLL_SYSCONFIG_CACTIVITY,
-               OMAP3_USBTLL_BASE + OMAP_USBTLL_SYSCONFIG);
-
-       /* Put UHH in NoIdle/NoStandby mode */
-       writel(OMAP_UHH_SYSCONFIG_ENAWAKEUP
-               | OMAP_UHH_SYSCONFIG_SIDLEMODE
-               | OMAP_UHH_SYSCONFIG_CACTIVITY
-               | OMAP_UHH_SYSCONFIG_MIDLEMODE,
-               OMAP3_UHH_BASE + OMAP_UHH_SYSCONFIG);
-
-       /* setup burst configurations */
-       writel(OMAP_UHH_HOSTCONFIG_INCR4_BURST_EN
-               | OMAP_UHH_HOSTCONFIG_INCR8_BURST_EN
-               | OMAP_UHH_HOSTCONFIG_INCR16_BURST_EN,
-               OMAP3_UHH_BASE + OMAP_UHH_HOSTCONFIG);
-
-       /*
-        * Refer ISSUE1:
-        * Hold the PHY in RESET for enough time till
-        * PHY is settled and ready
-        */
-       udelay(10);
-       gpio_set_value(GPIO_PHY_RESET, 1);
-
-       hccr = (struct ehci_hccr *)(OMAP3_EHCI_BASE);
-       hcor = (struct ehci_hcor *)(OMAP3_EHCI_BASE + 0x10);
+       return omap_ehci_hcd_init(&usbhs_bdata);
+}
 
-       pr_debug("OMAP3 EHCI init done\n");
-       return 0;
+int ehci_hcd_stop(void)
+{
+       return omap_ehci_hcd_stop();
 }
 
 #endif /* CONFIG_USB_EHCI */
index 18bfaa8deccecaa39d9ec104786772c87bbf31a1..c0a94a92c168ad72195dbd3fbffa7aac738f4b8c 100644 (file)
@@ -536,7 +536,7 @@ static const struct venc_regs venc_config_std_tv = {
  * Configure Timings for DVI D
  */
 static const struct panel_config dvid_cfg = {
-       .timing_h       = 0x0ff03f31, /* Horizantal timing */
+       .timing_h       = 0x0ff03f31, /* Horizontal timing */
        .timing_v       = 0x01400504, /* Vertical timing */
        .pol_freq       = 0x00007028, /* Pol Freq */
        .divisor        = 0x00010006, /* 72Mhz Pixel Clock */
@@ -548,7 +548,7 @@ static const struct panel_config dvid_cfg = {
 };
 
 static const struct panel_config dvid_cfg_xm = {
-       .timing_h       = 0x1a4024c9, /* Horizantal timing */
+       .timing_h       = 0x1a4024c9, /* Horizontal timing */
        .timing_v       = 0x02c00509, /* Vertical timing */
        .pol_freq       = 0x00007028, /* Pol Freq */
        .divisor        = 0x00010001, /* 96MHz Pixel Clock */
index fc8c0b4bc603f23e6ab9bf9bfd3eba717e713691..ca4b8b35ebdb51ab1d630a8c719046ef9693f0d2 100644 (file)
 #include <asm/arch/mmc_host_def.h>
 #include <asm/arch/clocks.h>
 #include <asm/arch/gpio.h>
+#include <asm/gpio.h>
 
 #include "panda_mux_data.h"
 
+#ifdef CONFIG_USB_EHCI
+#include <usb.h>
+#include <asm/arch/ehci.h>
+#include <asm/ehci-omap.h>
+#endif
+
 #define PANDA_ULPI_PHY_TYPE_GPIO       182
 
 DECLARE_GLOBAL_DATA_PTR;
@@ -177,6 +184,37 @@ int board_mmc_init(bd_t *bis)
 }
 #endif
 
+#ifdef CONFIG_USB_EHCI
+
+static struct omap_usbhs_board_data usbhs_bdata = {
+       .port_mode[0] = OMAP_EHCI_PORT_MODE_PHY,
+       .port_mode[1] = OMAP_USBHS_PORT_MODE_UNUSED,
+       .port_mode[2] = OMAP_USBHS_PORT_MODE_UNUSED,
+};
+
+int ehci_hcd_init(void)
+{
+       int ret;
+       unsigned int utmi_clk;
+
+       /* Now we can enable our port clocks */
+       utmi_clk = readl((void *)CM_L3INIT_HSUSBHOST_CLKCTRL);
+       utmi_clk |= HSUSBHOST_CLKCTRL_CLKSEL_UTMI_P1_MASK;
+       sr32((void *)CM_L3INIT_HSUSBHOST_CLKCTRL, 0, 32, utmi_clk);
+
+       ret = omap_ehci_hcd_init(&usbhs_bdata);
+       if (ret < 0)
+               return ret;
+
+       return 0;
+}
+
+int ehci_hcd_stop(void)
+{
+       return omap_ehci_hcd_stop();
+}
+#endif
+
 /*
  * get_board_rev() - get board revision
  */
index 2970ccd60922b6b7d093643cc42291994a9edf65..5b66a14242cde701e1694664b9f2ac7b383ff293 100644 (file)
@@ -136,14 +136,14 @@ const struct pad_conf_entry core_padconf_array_non_essential[] = {
        {CAM_SHUTTER, (OFF_EN | OFF_PD | OFF_OUT_PTD | M0)},            /* cam_shutter */
        {CAM_STROBE, (OFF_EN | OFF_PD | OFF_OUT_PTD | M0)},             /* cam_strobe */
        {CAM_GLOBALRESET, (PTD | OFF_EN | OFF_PD | OFF_OUT_PTD | M3)},  /* gpio_83 */
-       {USBB1_ULPITLL_CLK, (IEN | OFF_EN | OFF_IN | M1)},              /* hsi1_cawake */
-       {USBB1_ULPITLL_STP, (IEN | OFF_EN | OFF_IN | M1)},              /* hsi1_cadata */
-       {USBB1_ULPITLL_DIR, (IEN | OFF_EN | OFF_IN | M1)},              /* hsi1_caflag */
-       {USBB1_ULPITLL_NXT, (OFF_EN | M1)},                             /* hsi1_acready */
-       {USBB1_ULPITLL_DAT0, (OFF_EN | M1)},                            /* hsi1_acwake */
-       {USBB1_ULPITLL_DAT1, (OFF_EN | M1)},                            /* hsi1_acdata */
-       {USBB1_ULPITLL_DAT2, (OFF_EN | M1)},                            /* hsi1_acflag */
-       {USBB1_ULPITLL_DAT3, (IEN | OFF_EN | OFF_IN | M1)},             /* hsi1_caready */
+       {USBB1_ULPITLL_CLK, (PTD | IEN | OFF_EN | OFF_PD | OFF_IN | M4)},/* usbb1_ulpiphy_clk */
+       {USBB1_ULPITLL_STP, (OFF_EN | OFF_OUT_PTD | M4)},               /* usbb1_ulpiphy_stp */
+       {USBB1_ULPITLL_DIR, (IEN | OFF_EN | OFF_PD | OFF_IN | M4)},     /* usbb1_ulpiphy_dir */
+       {USBB1_ULPITLL_NXT, (IEN | OFF_EN | OFF_PD | OFF_IN | M4)},     /* usbb1_ulpiphy_nxt */
+       {USBB1_ULPITLL_DAT0, (IEN | OFF_EN | OFF_PD | OFF_IN | M4)},    /* usbb1_ulpiphy_dat0 */
+       {USBB1_ULPITLL_DAT1, (IEN | OFF_EN | OFF_PD | OFF_IN | M4)},    /* usbb1_ulpiphy_dat1 */
+       {USBB1_ULPITLL_DAT2, (IEN | OFF_EN | OFF_PD | OFF_IN | M4)},    /* usbb1_ulpiphy_dat2 */
+       {USBB1_ULPITLL_DAT3, (IEN | OFF_EN | OFF_PD | OFF_IN | M4)},    /* usbb1_ulpiphy_dat3 */
        {USBB1_ULPITLL_DAT4, (IEN | OFF_EN | OFF_PD | OFF_IN | M4)},    /* usbb1_ulpiphy_dat4 */
        {USBB1_ULPITLL_DAT5, (IEN | OFF_EN | OFF_PD | OFF_IN | M4)},    /* usbb1_ulpiphy_dat5 */
        {USBB1_ULPITLL_DAT6, (IEN | OFF_EN | OFF_PD | OFF_IN | M4)},    /* usbb1_ulpiphy_dat6 */
index 2f90dbf928fbc4b8237085401125f5bce9daa09b..05ce1ae06fa37caf1832f13f9d0c9069b12bff05 100644 (file)
@@ -133,9 +133,10 @@ davinci_sffsdr               arm         arm926ejs   sffsdr              davinci
 davinci_sonata               arm         arm926ejs   sonata              davinci        davinci
 ea20                        arm         arm926ejs   ea20                davinci        davinci
 hawkboard                    arm         arm926ejs   da8xxevm            davinci        davinci
-hawkboard_nand               arm         arm926ejs   da8xxevm            davinci        davinci     hawkboard:NAND_U_BOOT
 hawkboard_uart               arm         arm926ejs   da8xxevm            davinci        davinci     hawkboard:UART_U_BOOT
 enbw_cmc                     arm         arm926ejs   enbw_cmc            enbw           davinci
+calimain                     arm         arm926ejs   calimain            omicron        davinci
+dns325                       arm         arm926ejs   -                   d-link         kirkwood
 km_kirkwood                  arm         arm926ejs   km_arm              keymile        kirkwood       km_kirkwood:KM_DISABLE_PCI
 km_kirkwood_pci              arm         arm926ejs   km_arm              keymile        kirkwood       km_kirkwood:KM_RECONFIG_XLX
 mgcoge3un                    arm         arm926ejs   km_arm              keymile        kirkwood
@@ -177,6 +178,10 @@ omap730p2_cs0boot       arm         arm926ejs   omap730p2           ti             omap
 omap730p2_cs3boot           arm         arm926ejs   omap730p2           ti             omap        omap730p2:CS3_BOOT
 edminiv2                     arm         arm926ejs   -                   LaCie          orion5x
 dkb                         arm         arm926ejs   -                   Marvell        pantheon
+spear300                     arm         arm926ejs   spear300            spear          spear       spear3xx:spear300
+spear310                     arm         arm926ejs   spear310            spear          spear       spear3xx:spear310
+spear320                     arm         arm926ejs   spear320            spear          spear       spear3xx:spear320
+spear600                     arm         arm926ejs   spear600            spear          spear       spear6xx:spear600
 versatileab                  arm         arm926ejs   versatile           armltd         versatile   versatile:ARCH_VERSATILE_AB
 versatilepb                  arm         arm926ejs   versatile           armltd         versatile   versatile:ARCH_VERSATILE_PB
 versatileqemu                arm         arm926ejs   versatile           armltd         versatile   versatile:ARCH_VERSATILE_QEMU,ARCH_VERSATILE_PB
@@ -202,6 +207,7 @@ dig297                       arm         armv7       dig297              comelit
 igep0020                     arm         armv7       igep0020            isee           omap3
 igep0030                     arm         armv7       igep0030            isee           omap3
 am3517_evm                   arm         armv7       am3517evm           logicpd        omap3
+mt_ventoux                   arm         armv7       mt_ventoux          teejet         omap3
 omap3_zoom1                  arm         armv7       zoom1               logicpd        omap3
 omap3_zoom2                  arm         armv7       zoom2               logicpd        omap3
 omap3_logic                  arm         armv7       omap3som            logicpd        omap3
@@ -213,6 +219,8 @@ omap3_evm_quick_mmc          arm         armv7       evm                 ti
 omap3_evm_quick_nand         arm         armv7       evm                 ti             omap3
 omap3_sdp3430                arm         armv7       sdp3430             ti             omap3
 devkit8000                   arm         armv7       devkit8000          timll          omap3
+mcx                          arm         armv7       mcx                 htkw           omap3
+tricorder                    arm         armv7       tricorder           corscience     omap3
 twister                      arm         armv7       twister             technexion     omap3
 omap4_panda                  arm         armv7       panda               ti             omap4
 omap4_sdp4430                arm         armv7       sdp4430             ti             omap4
@@ -221,7 +229,9 @@ s5p_goni                     arm         armv7       goni                samsung
 smdkc100                     arm         armv7       smdkc100            samsung        s5pc1xx
 origen                      arm         armv7       origen              samsung        exynos
 s5pc210_universal            arm         armv7       universal_c210      samsung        exynos
+smdk5250                    arm         armv7       smdk5250            samsung        exynos
 smdkv310                    arm         armv7       smdkv310            samsung        exynos
+trats                        arm         armv7       trats               samsung        exynos
 harmony                      arm         armv7       harmony             nvidia         tegra2
 seaboard                     arm         armv7       seaboard            nvidia         tegra2
 ventana                      arm         armv7       ventana             nvidia         tegra2
@@ -250,6 +260,7 @@ colibri_pxa270               arm         pxa         -                   toradex
 jornada                      arm         sa1100
 plutux                       arm         armv7       plutux              avionic-design tegra2
 medcom                       arm         armv7       medcom              avionic-design tegra2
+paz00                        arm         armv7       paz00               compal         tegra2
 atngw100                     avr32       at32ap      -                   atmel          at32ap700x
 atstk1002                    avr32       at32ap      atstk1000           atmel          at32ap700x
 atstk1003                    avr32       at32ap      atstk1000           atmel          at32ap700x
@@ -280,6 +291,7 @@ bf561-acvilon                blackfin    blackfin
 bf561-ezkit                  blackfin    blackfin
 blackstamp                   blackfin    blackfin
 blackvme                     blackfin    blackfin
+br4                          blackfin    blackfin
 cm-bf527                     blackfin    blackfin
 cm-bf533                     blackfin    blackfin
 cm-bf537e                    blackfin    blackfin
@@ -289,6 +301,7 @@ cm-bf561                     blackfin    blackfin
 dnp5370                      blackfin    blackfin
 ibf-dsp561                   blackfin    blackfin
 ip04                         blackfin    blackfin
+pr1                          blackfin    blackfin
 tcm-bf518                    blackfin    blackfin
 tcm-bf537                    blackfin    blackfin
 M52277EVB                    m68k        mcf5227x    m52277evb           freescale      -           M52277EVB:SYS_SPANSION_BOOT,SYS_TEXT_BASE=0x00000000
index 97f29456f97e7454813e88e84096d5ee4cd3dd32..5359a47859b98fb431e3d99a9a3c36a6f10ff404 100644 (file)
@@ -370,6 +370,15 @@ int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
        print_num("irq_sp", gd->irq_sp);        /* irq stack pointer */
        print_num("sp start ", gd->start_addr_sp);
        print_num("FB base  ", gd->fb_base);
+       /*
+        * TODO: Currently only support for davinci SOC's is added.
+        * Remove this check once all the board implement this.
+        */
+#ifdef CONFIG_CLOCKS
+       printf("ARM frequency = %ld MHz\n", gd->bd->bi_arm_freq);
+       printf("DSP frequency = %ld MHz\n", gd->bd->bi_dsp_freq);
+       printf("DDR frequency = %ld MHz\n", gd->bd->bi_ddr_freq);
+#endif
        return 0;
 }
 
index 63afc82fe2078b56809cbdc8156044d95f7aefc9..20080dc0011c4035804ab4c93d4360490ded11ca 100644 (file)
@@ -502,7 +502,7 @@ int do_env_edit(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
        else
                buffer[0] = '\0';
 
-       readline_into_buffer("edit: ", buffer);
+       readline_into_buffer("edit: ", buffer, 0);
 
        return setenv(argv[1], buffer);
 }
index 612fd18617acbed68b099c177c53c0287b5ff056..98e4162114d689dacb903cd4943f39b6e1bee4a7 100644 (file)
 #ifndef CONFIG_SF_DEFAULT_MODE
 # define CONFIG_SF_DEFAULT_MODE                SPI_MODE_3
 #endif
+#ifndef CONFIG_SF_DEFAULT_CS
+# define CONFIG_SF_DEFAULT_CS          0
+#endif
+#ifndef CONFIG_SF_DEFAULT_BUS
+# define CONFIG_SF_DEFAULT_BUS         0
+#endif
 
 static struct spi_flash *flash;
 
@@ -63,27 +69,26 @@ static int sf_parse_len_arg(char *arg, ulong *len)
 
 static int do_spi_flash_probe(int argc, char * const argv[])
 {
-       unsigned int bus = 0;
-       unsigned int cs;
+       unsigned int bus = CONFIG_SF_DEFAULT_BUS;
+       unsigned int cs = CONFIG_SF_DEFAULT_CS;
        unsigned int speed = CONFIG_SF_DEFAULT_SPEED;
        unsigned int mode = CONFIG_SF_DEFAULT_MODE;
        char *endp;
        struct spi_flash *new;
 
-       if (argc < 2)
-               return -1;
-
-       cs = simple_strtoul(argv[1], &endp, 0);
-       if (*argv[1] == 0 || (*endp != 0 && *endp != ':'))
-               return -1;
-       if (*endp == ':') {
-               if (endp[1] == 0)
-                       return -1;
-
-               bus = cs;
-               cs = simple_strtoul(endp + 1, &endp, 0);
-               if (*endp != 0)
+       if (argc >= 2) {
+               cs = simple_strtoul(argv[1], &endp, 0);
+               if (*argv[1] == 0 || (*endp != 0 && *endp != ':'))
                        return -1;
+               if (*endp == ':') {
+                       if (endp[1] == 0)
+                               return -1;
+
+                       bus = cs;
+                       cs = simple_strtoul(endp + 1, &endp, 0);
+                       if (*endp != 0)
+                               return -1;
+               }
        }
 
        if (argc >= 3) {
@@ -299,7 +304,7 @@ usage:
 U_BOOT_CMD(
        sf,     5,      1,      do_spi_flash,
        "SPI flash sub-system",
-       "probe [bus:]cs [hz] [mode]     - init flash device on given SPI bus\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"
index e96c95a038c29be5f7aa5dfa57fa6c9209710e7b..91e888fd3ce0a3ef54c1996d153538e76e78707c 100644 (file)
@@ -41,6 +41,7 @@
 
 #include <post.h>
 #include <linux/ctype.h>
+#include <menu.h>
 
 #if defined(CONFIG_SILENT_CONSOLE) || defined(CONFIG_POST) || defined(CONFIG_CMDLINE_EDITING)
 DECLARE_GLOBAL_DATA_PTR;
@@ -372,6 +373,9 @@ void main_loop (void)
 
        debug ("### main_loop entered: bootdelay=%d\n\n", bootdelay);
 
+#if defined(CONFIG_MENU_SHOW)
+       bootdelay = menu_show(bootdelay);
+#endif
 # ifdef CONFIG_BOOT_RETRY_TIME
        init_cmd_timeout ();
 # endif        /* CONFIG_BOOT_RETRY_TIME */
@@ -685,7 +689,8 @@ static void cread_add_str(char *str, int strsize, int insert, unsigned long *num
        }
 }
 
-static int cread_line(const char *const prompt, char *buf, unsigned int *len)
+static int cread_line(const char *const prompt, char *buf, unsigned int *len,
+               int timeout)
 {
        unsigned long num = 0;
        unsigned long eol_num = 0;
@@ -695,6 +700,7 @@ static int cread_line(const char *const prompt, char *buf, unsigned int *len)
        int esc_len = 0;
        char esc_save[8];
        int init_len = strlen(buf);
+       int first = 1;
 
        if (init_len)
                cread_add_str(buf, init_len, 1, &num, &eol_num, buf, *len);
@@ -707,6 +713,16 @@ static int cread_line(const char *const prompt, char *buf, unsigned int *len)
                        WATCHDOG_RESET();
                }
 #endif
+               if (first && timeout) {
+                       uint64_t etime = endtick(timeout);
+
+                       while (!tstc()) {       /* while no incoming data */
+                               if (get_ticks() >= etime)
+                                       return -2;      /* timed out */
+                               WATCHDOG_RESET();
+                       }
+                       first = 0;
+               }
 
                ichar = getcmd_getch();
 
@@ -922,11 +938,11 @@ int readline (const char *const prompt)
         */
        console_buffer[0] = '\0';
 
-       return readline_into_buffer(prompt, console_buffer);
+       return readline_into_buffer(prompt, console_buffer, 0);
 }
 
 
-int readline_into_buffer (const char *const prompt, char * buffer)
+int readline_into_buffer(const char *const prompt, char *buffer, int timeout)
 {
        char *p = buffer;
 #ifdef CONFIG_CMDLINE_EDITING
@@ -949,7 +965,7 @@ int readline_into_buffer (const char *const prompt, char * buffer)
                if (prompt)
                        puts (prompt);
 
-               rc = cread_line(prompt, p, &len);
+               rc = cread_line(prompt, p, &len, timeout);
                return rc < 0 ? rc : len;
 
        } else {
index 5e0817c454bdd128390114dacf315066cba43140..aa16c9a199d772f7bd9971e401efdb883bf06895 100644 (file)
@@ -113,6 +113,13 @@ static inline void *menu_item_destroy(struct menu *m,
        return NULL;
 }
 
+void __menu_display_statusline(struct menu *m)
+{
+       return;
+}
+void menu_display_statusline(struct menu *m)
+       __attribute__ ((weak, alias("__menu_display_statusline")));
+
 /*
  * Display a menu so the user can make a choice of an item. First display its
  * title, if any, and then each item in the menu.
@@ -123,6 +130,7 @@ static inline void menu_display(struct menu *m)
                puts(m->title);
                putc('\n');
        }
+       menu_display_statusline(m);
 
        menu_items_iter(m, menu_item_print, NULL);
 }
@@ -222,13 +230,16 @@ static inline int menu_interactive_choice(struct menu *m, void **choice)
 
                menu_display(m);
 
-               readret = readline_into_buffer("Enter choice: ", cbuf);
+               readret = readline_into_buffer("Enter choice: ", cbuf,
+                               m->timeout);
 
                if (readret >= 0) {
                        choice_item = menu_item_by_key(m, cbuf);
 
-                       if (!choice_item)
+                       if (!choice_item) {
                                printf("%s not found\n", cbuf);
+                               m->timeout = 0;
+                       }
                } else {
                        puts("^C\n");
                        return -EINTR;
index f01a8bd91187547e1b0ded577b414e951ae2c6d5..0276953db634159e417c55e93b17b1738886f30c 100644 (file)
@@ -42,8 +42,8 @@ The building of SPL images can be with:
 
 #define CONFIG_SPL
 
-Because SPL images normally have a different text base, one have to be
-configured by defining CONFIG_SPL_TEXT_BASE. The linker script have to be
+Because SPL images normally have a different text base, one has to be
+configured by defining CONFIG_SPL_TEXT_BASE. The linker script has to be
 defined with CONFIG_SPL_LDSCRIPT.
 
 To support generic U-Boot libraries and drivers in the SPL binary one can
index b7afec444c751d7e358512711e41fa9e2e552b81..d6ae02ec0281f08b2bc6b4e4c5a0f0b8ad324cb0 100644 (file)
@@ -9,8 +9,8 @@ executes upon reset is the Rom Boot Loader(RBL) which sits in the
 internal ROM of the omap. The RBL initialises the memory and the nand
 controller, and copies the image stored at a predefined location(block
 1) of the nand flash. The image loaded by the RBL to the memory is the
-AIS signed nand_spl image. This, in turns copies the u-boot binary
-from the nand flash to the memory and jumps to the u-boot entry point.
+AIS signed spl image. This, in turns copies the u-boot binary from the
+nand flash to the memory and jumps to the u-boot entry point.
 
 AIS is an image format defined by TI for the images that are to be
 loaded to memory by the RBL. The image is divided into a series of
@@ -20,14 +20,14 @@ and the size of the section, which is used by the RBL to load the
 image. At the end of the image the RBL jumps to the image entry
 point.
 
-The secondary stage bootloader(nand_spl) which is loaded by the RBL
-then loads the u-boot from a predefined location in the nand to the
-memory and jumps to the u-boot entry point.
+The secondary stage bootloader(spl) which is loaded by the RBL then
+loads the u-boot from a predefined location in the nand to the memory
+and jumps to the u-boot entry point.
 
 The reason a secondary stage bootloader is used is because the ECC
 layout expected by the RBL is not the same as that used by
-u-boot/linux. This also implies that for flashing the nand_spl image,
-we need to use the u-boot which uses the ECC layout expected by the
+u-boot/linux. This also implies that for flashing the spl image,we
+need to use the u-boot which uses the ECC layout expected by the
 RBL[1]. Booting u-boot over UART(UART boot) is explained here[2].
 
 
@@ -35,20 +35,19 @@ Compilation
 ===========
 Three images might be needed
 
-* nand_spl - This is the secondary bootloader which boots the u-boot
+* spl - This is the secondary bootloader which boots the u-boot
   binary.
 
-  hawkboard_nand_config
-
-  The nand_spl ELF gets generated under nand_spl/u-boot-spl. This
-  needs to be processed with the AISGen tool for generating the AIS
-  signed image to be flashed. Steps for generating the AIS image are
-  explained here[3].
-
 * u-boot binary - This is the image flashed to the nand and copied to
-  the memory by the nand_spl.
+  the memory by the spl.
+
+  Both the images get compiled with hawkboard_config, with the TOPDIR
+  containing the u-boot images, and the spl image under the spl
+  directory.
 
-  hawkboard_config
+  The spl image needs to be processed with the AISGen tool for
+  generating the AIS signed image to be flashed. Steps for generating
+  the AIS image are explained here[3].
 
 * u-boot for uart boot - This is same as the u-boot binary generated
   above, with the sole difference of the CONFIG_SYS_TEXT_BASE being
@@ -59,17 +58,17 @@ Three images might be needed
 
 Flashing the images to Nand
 ===========================
-The nand_spl AIS image needs to be flashed to the block 1 of the
-Nand flash, as that is the location the RBL expects the image[4]. For
-flashing the nand_spl, boot over the u-boot specified in [1], and
-flash the image
+The spl AIS image needs to be flashed to the block 1 of the Nand
+flash, as that is the location the RBL expects the image[4]. For
+flashing the spl, boot over the u-boot specified in [1], and flash the
+image
 
 => tftpboot 0xc0700000 <nand_spl_ais.bin>
 => nand erase 0x20000 0x20000
 => nand write.e 0xc0700000 0x20000 <nand_spl_size>
 
 The u-boot binary is flashed at location 0xe0000(block 6) of the nand
-flash. The nand_spl loader expects the u-boot at this location. For
+flash. The spl loader expects the u-boot at this location. For
 flashing the u-boot binary
 
 => tftpboot 0xc0700000 u-boot.bin
index c74239d2ade911b76269b386caeac849a2c878d5..073e3fcb3c6ecc9a7dfa8af468c76f96b16bd4d5 100644 (file)
@@ -2,12 +2,13 @@
 Imximage Boot Image generation using mkimage
 ---------------------------------------------
 
-This document describes how to set up a U-Boot image
-that can be booted by Freescale MX25, MX35 and MX51
-processors via internal boot mode.
+This document describes how to set up a U-Boot image that can be booted
+by Freescale MX25, MX35, MX51, MX53 and MX6 processors via internal boot
+mode.
 
 These processors can boot directly from NAND, SPI flash and SD card flash
-using its internal boot ROM support. They can boot from an internal
+using its internal boot ROM support. MX6 processors additionally support
+boot from NOR flash and SATA disks. All processors can boot from an internal
 UART, if booting from device media fails.
 Booting from NOR flash does not require to use this image type.
 
@@ -59,12 +60,12 @@ Configuration command line syntax:
        --------------          -----------
        IMXIMAGE_VERSION        1/2
                                1 is for mx25/mx35/mx51 compatible,
-                               2 is for mx53 compatible,
+                               2 is for mx53/mx6 compatible,
                                others is invalid and error is generated.
                                This command need appear the fist before
                                other valid commands in configuration file.
 
-       BOOT_FROM               nand/spi/sd/onenand
+       BOOT_FROM               nand/spi/sd/onenand/nor/sata
                                Example:
                                BOOT_FROM spi
        DATA                    type address value
index 0dad6a2cb8968b4035c86ff8dabbe6e45d45f354..6ce6bbab80728db810d75196e0c5615b4e9efb0a 100644 (file)
@@ -25,6 +25,11 @@ the interfaces should be available.
 Menus are composed of items. Each item has a key used to identify it in
 the menu, and an opaque pointer to data controlled by the consumer.
 
+If you want to show a menu, instead starting the shell, define
+CONFIG_MENU_SHOW. You have to code the int menu_show(int bootdelay)
+function, which handle your menu. This function returns the remaining
+bootdelay.
+
 Interfaces
 ----------
 #include "menu.h"
@@ -69,6 +74,11 @@ int menu_get_choice(struct menu *m, void **choice);
  */
 int menu_destroy(struct menu *m);
 
+/*
+ * menu_display_statusline(struct menu *m);
+ * shows a statusline for every menu_display call.
+ */
+void menu_display_statusline(struct menu *m);
 
 Example Code
 ------------
index 023740e1d364452f77316cf97968be48faf9cd40..04a87c99184be6e229cfbe3d5a8d035adfd6894d 100644 (file)
@@ -120,6 +120,68 @@ Configuration Options:
    CONFIG_SYS_NAND_MAX_CHIPS
       The maximum number of NAND chips per device to be supported.
 
+   CONFIG_SYS_NAND_SELF_INIT
+      Traditionally, glue code in drivers/mtd/nand/nand.c has driven
+      the initialization process -- it provides the mtd and nand
+      structs, calls a board init function for a specific device,
+      calls nand_scan(), and registers with mtd.
+
+      This arrangement does not provide drivers with the flexibility to
+      run code between nand_scan_ident() and nand_scan_tail(), or other
+      deviations from the "normal" flow.
+
+      If a board defines CONFIG_SYS_NAND_SELF_INIT, drivers/mtd/nand/nand.c
+      will make one call to board_nand_init(), with no arguments.  That
+      function is responsible for calling a driver init function for
+      each NAND device on the board, that performs all initialization
+      tasks except setting mtd->name, and registering with the rest of
+      U-Boot.  Those last tasks are accomplished by calling  nand_register()
+      on the new mtd device.
+
+      Example of new init to be added to the end of an existing driver
+      init:
+
+       /*
+        * devnum is the device number to be used in nand commands
+        * and in mtd->name.  Must be less than
+        * CONFIG_SYS_NAND_MAX_DEVICE.
+        */
+       mtd = &nand_info[devnum];
+
+       /* chip is struct nand_chip, and is now provided by the driver. */
+       mtd->priv = &chip;
+
+       /*
+        * Fill in appropriate values if this driver uses these fields,
+        * or uses the standard read_byte/write_buf/etc. functions from
+        * nand_base.c that use these fields.
+        */
+       chip.IO_ADDR_R = ...;
+       chip.IO_ADDR_W = ...;
+
+       if (nand_scan_ident(mtd, CONFIG_SYS_MAX_NAND_CHIPS, NULL))
+               error out
+
+       /*
+        * Insert here any code you wish to run after the chip has been
+        * identified, but before any other I/O is done.
+        */
+
+       if (nand_scan_tail(mtd))
+               error out
+
+       if (nand_register(devnum))
+               error out
+
+      In addition to providing more flexibility to the driver, it reduces
+      the difference between a U-Boot driver and its Linux counterpart.
+      nand_init() is now reduced to calling board_nand_init() once, and
+      printing a size summary.  This should also make it easier to
+      transition to delayed NAND initialization.
+
+      Please convert your driver even if you don't need the extra
+      flexibility, so that one day we can eliminate the old mechanism.
+
 NOTE:
 =====
 
diff --git a/doc/README.omap-ulpi-viewport b/doc/README.omap-ulpi-viewport
new file mode 100644 (file)
index 0000000..a5240b9
--- /dev/null
@@ -0,0 +1,27 @@
+Reference code ""drivers/usb/ulpi/omap-ulpi-viewport.c"
+
+Contains the ulpi read write api's to perform
+any ulpi phy port access on omap platform.
+
+On omap ehci reg map contains INSNREG05_ULPI
+register which offers the ulpi phy access so
+any ulpi phy commands should be passsed using this
+register.
+
+omap-ulpi-viewport.c is a low level function
+implementation of "drivers/usb/ulpi/ulpi.c"
+
+To enable and use omap-ulpi-viewport.c
+we require CONFIG_USB_ULPI_VIEWPORT_OMAP and
+CONFIG_USB_ULPI be enabled in config file.
+
+Any ulpi ops request can be done with ulpi.c
+and soc specific binding and usage is done with
+omap-ulpi-viewport implementation.
+
+Ex: scenario:
+omap-ehci driver code requests for ulpi phy reset if
+ehci is used in phy mode, which will call ulpi phy reset
+the ulpi phy reset does ulpi_read/write from viewport
+implementation which will do ulpi reset using the
+INSNREG05_ULPI register.
index 847c03226a6d161556084c2de9fff9397da6e6bf..cce21fbc5409bc9b0f206c3bb2b72e0f282c52c9 100644 (file)
@@ -884,7 +884,7 @@ static void bfin_ata_identify(struct ata_port *ap, int dev)
                sata_dev_desc[ap->port_no].removable = 0;
 
        sata_dev_desc[ap->port_no].lba = (u32) n_sectors;
-       debug("lba=0x%x\n", sata_dev_desc[ap->port_no].lba);
+       debug("lba=0x%lx\n", sata_dev_desc[ap->port_no].lba);
 
 #ifdef CONFIG_LBA48
        if (iop->command_set_2 & 0x0400)
index a7ffd95d5d7f4d19d82a5041d88774e66f21ce1a..f06af02ba31336954ace8cd312a0da07b93c000e 100644 (file)
 
 DECLARE_GLOBAL_DATA_PTR;
 
-#define I2C_TIMEOUT    1000
+#define I2C_STAT_TIMEO (1 << 31)
+#define I2C_TIMEOUT    10
 
-static void wait_for_bb(void);
-static u16 wait_for_pin(void);
+static u32 wait_for_bb(void);
+static u32 wait_for_status_mask(u16 mask);
 static void flush_fifo(void);
 
 /*
@@ -50,7 +51,6 @@ void i2c_init(int speed, int slaveadd)
        int psc, fsscll, fssclh;
        int hsscll = 0, hssclh = 0;
        u32 scll, sclh;
-       int timeout = I2C_TIMEOUT;
 
        /* Only handle standard, fast and high speeds */
        if ((speed != OMAP_I2C_STANDARD) &&
@@ -112,24 +112,14 @@ void i2c_init(int speed, int slaveadd)
                sclh = (unsigned int)fssclh;
        }
 
+       if (gd->flags & GD_FLG_RELOC)
+               bus_initialized[current_bus] = 1;
+
        if (readw(&i2c_base->con) & I2C_CON_EN) {
                writew(0, &i2c_base->con);
                udelay(50000);
        }
 
-       writew(0x2, &i2c_base->sysc); /* for ES2 after soft reset */
-       udelay(1000);
-
-       writew(I2C_CON_EN, &i2c_base->con);
-       while (!(readw(&i2c_base->syss) & I2C_SYSS_RDONE) && timeout--) {
-               if (timeout <= 0) {
-                       puts("ERROR: Timeout in soft-reset\n");
-                       return;
-               }
-               udelay(1000);
-       }
-
-       writew(0, &i2c_base->con);
        writew(psc, &i2c_base->psc);
        writew(scll, &i2c_base->scll);
        writew(sclh, &i2c_base->sclh);
@@ -145,81 +135,6 @@ void i2c_init(int speed, int slaveadd)
        flush_fifo();
        writew(0xFFFF, &i2c_base->stat);
        writew(0, &i2c_base->cnt);
-
-       if (gd->flags & GD_FLG_RELOC)
-               bus_initialized[current_bus] = 1;
-}
-
-static int i2c_read_byte(u8 devaddr, u8 regoffset, u8 *value)
-{
-       int i2c_error = 0;
-       u16 status;
-
-       /* wait until bus not busy */
-       wait_for_bb();
-
-       /* one byte only */
-       writew(1, &i2c_base->cnt);
-       /* set slave address */
-       writew(devaddr, &i2c_base->sa);
-       /* no stop bit needed here */
-       writew(I2C_CON_EN | I2C_CON_MST | I2C_CON_STT |
-             I2C_CON_TRX, &i2c_base->con);
-
-       /* send register offset */
-       while (1) {
-               status = wait_for_pin();
-               if (status == 0 || status & I2C_STAT_NACK) {
-                       i2c_error = 1;
-                       goto read_exit;
-               }
-               if (status & I2C_STAT_XRDY) {
-                       /* Important: have to use byte access */
-                       writeb(regoffset, &i2c_base->data);
-                       writew(I2C_STAT_XRDY, &i2c_base->stat);
-               }
-               if (status & I2C_STAT_ARDY) {
-                       writew(I2C_STAT_ARDY, &i2c_base->stat);
-                       break;
-               }
-       }
-
-       /* set slave address */
-       writew(devaddr, &i2c_base->sa);
-       /* read one byte from slave */
-       writew(1, &i2c_base->cnt);
-       /* need stop bit here */
-       writew(I2C_CON_EN | I2C_CON_MST |
-               I2C_CON_STT | I2C_CON_STP,
-               &i2c_base->con);
-
-       /* receive data */
-       while (1) {
-               status = wait_for_pin();
-               if (status == 0 || status & I2C_STAT_NACK) {
-                       i2c_error = 1;
-                       goto read_exit;
-               }
-               if (status & I2C_STAT_RRDY) {
-#if defined(CONFIG_OMAP243X) || defined(CONFIG_OMAP34XX) || \
-       defined(CONFIG_OMAP44XX)
-                       *value = readb(&i2c_base->data);
-#else
-                       *value = readw(&i2c_base->data);
-#endif
-                       writew(I2C_STAT_RRDY, &i2c_base->stat);
-               }
-               if (status & I2C_STAT_ARDY) {
-                       writew(I2C_STAT_ARDY, &i2c_base->stat);
-                       break;
-               }
-       }
-
-read_exit:
-       flush_fifo();
-       writew(0xFFFF, &i2c_base->stat);
-       writew(0, &i2c_base->cnt);
-       return i2c_error;
 }
 
 static void flush_fifo(void)
@@ -232,7 +147,7 @@ static void flush_fifo(void)
                stat = readw(&i2c_base->stat);
                if (stat == I2C_STAT_RRDY) {
 #if defined(CONFIG_OMAP243X) || defined(CONFIG_OMAP34XX) || \
-       defined(CONFIG_OMAP44XX)
+       defined(CONFIG_OMAP44XX) || defined(CONFIG_AM33XX)
                        readb(&i2c_base->data);
 #else
                        readw(&i2c_base->data);
@@ -246,32 +161,42 @@ static void flush_fifo(void)
 
 int i2c_probe(uchar chip)
 {
-       u16 status;
+       u32 status;
        int res = 1; /* default = fail */
 
        if (chip == readw(&i2c_base->oa))
                return res;
 
        /* wait until bus not busy */
-       wait_for_bb();
+       status = wait_for_bb();
+       /* exit on BUS busy */
+       if (status & I2C_STAT_TIMEO)
+               return res;
 
        /* try to write one byte */
        writew(1, &i2c_base->cnt);
        /* set slave address */
        writew(chip, &i2c_base->sa);
        /* stop bit needed here */
-       writew(I2C_CON_EN | I2C_CON_MST | I2C_CON_STT | I2C_CON_TRX |
-              I2C_CON_STP, &i2c_base->con);
-
-       status = wait_for_pin();
-
-       /* check for ACK (!NAK) */
-       if (!(status & I2C_STAT_NACK))
-               res = 0;
-
-       /* abort transfer (force idle state) */
-       writew(0, &i2c_base->con);
-
+       writew(I2C_CON_EN | I2C_CON_MST | I2C_CON_STT
+                       | I2C_CON_STP, &i2c_base->con);
+       /* enough delay for the NACK bit set */
+       udelay(9000);
+
+       if (!(readw(&i2c_base->stat) & I2C_STAT_NACK)) {
+               res = 0;      /* success case */
+               flush_fifo();
+               writew(0xFFFF, &i2c_base->stat);
+       } else {
+               /* failure, clear sources*/
+               writew(0xFFFF, &i2c_base->stat);
+               /* finish up xfer */
+               writew(readw(&i2c_base->con) | I2C_CON_STP, &i2c_base->con);
+               status = wait_for_bb();
+               /* exit on BUS busy */
+               if (status & I2C_STAT_TIMEO)
+                       return res;
+       }
        flush_fifo();
        /* don't allow any more data in... we don't want it. */
        writew(0, &i2c_base->cnt);
@@ -281,111 +206,315 @@ int i2c_probe(uchar chip)
 
 int i2c_read(uchar chip, uint addr, int alen, uchar *buffer, int len)
 {
-       int i;
+       int i2c_error = 0, i;
+       u32 status;
 
-       if (alen > 1) {
-               printf("I2C read: addr len %d not supported\n", alen);
+       if ((alen > 2) || (alen < 0))
+               return 1;
+
+       if (alen < 2) {
+               if (addr + len > 256)
+                       return 1;
+       } else if (addr + len > 0xFFFF) {
                return 1;
        }
 
-       if (addr + len > 256) {
-               puts("I2C read: address out of range\n");
+       /* wait until bus not busy */
+       status = wait_for_bb();
+
+       /* exit on BUS busy */
+       if (status & I2C_STAT_TIMEO)
                return 1;
+
+       writew((alen & 0xFF), &i2c_base->cnt);
+       /* set slave address */
+       writew(chip, &i2c_base->sa);
+       /* Clear the Tx & Rx FIFOs */
+       writew((readw(&i2c_base->buf) | I2C_RXFIFO_CLEAR |
+               I2C_TXFIFO_CLEAR), &i2c_base->buf);
+       /* no stop bit needed here */
+       writew(I2C_CON_EN | I2C_CON_MST | I2C_CON_TRX |
+               I2C_CON_STT, &i2c_base->con);
+
+       /* wait for Transmit ready condition */
+       status = wait_for_status_mask(I2C_STAT_XRDY | I2C_STAT_NACK);
+
+       if (status & (I2C_STAT_NACK | I2C_STAT_TIMEO))
+               i2c_error = 1;
+
+       if (!i2c_error) {
+               if (status & I2C_STAT_XRDY) {
+                       switch (alen) {
+                       case 2:
+                               /* Send address MSByte */
+#if defined(CONFIG_OMAP243X) || defined(CONFIG_OMAP34XX) || \
+                       defined(CONFIG_AM33XX)
+                               writew(((addr >> 8) & 0xFF), &i2c_base->data);
+
+                               /* Clearing XRDY event */
+                               writew((status & I2C_STAT_XRDY),
+                                               &i2c_base->stat);
+                               /* wait for Transmit ready condition */
+                               status = wait_for_status_mask(I2C_STAT_XRDY |
+                                               I2C_STAT_NACK);
+
+                               if (status & (I2C_STAT_NACK |
+                                               I2C_STAT_TIMEO)) {
+                                       i2c_error = 1;
+                                       break;
+                               }
+#endif
+                       case 1:
+#if defined(CONFIG_OMAP243X) || defined(CONFIG_OMAP34XX) || \
+                       defined(CONFIG_AM33XX)
+                               /* Send address LSByte */
+                               writew((addr & 0xFF), &i2c_base->data);
+#else
+                               /* Send address Short word */
+                               writew((addr & 0xFFFF), &i2c_base->data);
+#endif
+                               /* Clearing XRDY event */
+                               writew((status & I2C_STAT_XRDY),
+                                       &i2c_base->stat);
+                               /*wait for Transmit ready condition */
+                               status = wait_for_status_mask(I2C_STAT_ARDY |
+                                               I2C_STAT_NACK);
+
+                               if (status & (I2C_STAT_NACK |
+                                       I2C_STAT_TIMEO)) {
+                                       i2c_error = 1;
+                                       break;
+                               }
+                       }
+               } else
+                       i2c_error = 1;
        }
 
-       for (i = 0; i < len; i++) {
-               if (i2c_read_byte(chip, addr + i, &buffer[i])) {
-                       puts("I2C read: I/O error\n");
-                       i2c_init(CONFIG_SYS_I2C_SPEED, CONFIG_SYS_I2C_SLAVE);
-                       return 1;
+       /* Wait for ARDY to set */
+       status = wait_for_status_mask(I2C_STAT_ARDY | I2C_STAT_NACK
+                       | I2C_STAT_AL);
+
+       if (!i2c_error) {
+               /* set slave address */
+               writew(chip, &i2c_base->sa);
+               writew((len & 0xFF), &i2c_base->cnt);
+               /* Clear the Tx & Rx FIFOs */
+               writew((readw(&i2c_base->buf) | I2C_RXFIFO_CLEAR |
+                       I2C_TXFIFO_CLEAR), &i2c_base->buf);
+               /* need stop bit here */
+               writew(I2C_CON_EN | I2C_CON_MST | I2C_CON_STT | I2C_CON_STP,
+                       &i2c_base->con);
+
+               for (i = 0; i < len; i++) {
+                       /* wait for Receive condition */
+                       status = wait_for_status_mask(I2C_STAT_RRDY |
+                               I2C_STAT_NACK);
+                       if (status & (I2C_STAT_NACK | I2C_STAT_TIMEO)) {
+                               i2c_error = 1;
+                               break;
+                       }
+
+                       if (status & I2C_STAT_RRDY) {
+#if defined(CONFIG_OMAP243X) || defined(CONFIG_OMAP34XX) || \
+                       defined(CONFIG_AM33XX)
+                               buffer[i] = readb(&i2c_base->data);
+#else
+                               *((u16 *)&buffer[i]) =
+                                       readw(&i2c_base->data) & 0xFFFF;
+                               i++;
+#endif
+                               writew((status & I2C_STAT_RRDY),
+                                       &i2c_base->stat);
+                               udelay(1000);
+                       } else {
+                               i2c_error = 1;
+                       }
                }
        }
 
+       /* Wait for ARDY to set */
+       status = wait_for_status_mask(I2C_STAT_ARDY | I2C_STAT_NACK
+                       | I2C_STAT_AL);
+
+       if (i2c_error) {
+               writew(0, &i2c_base->con);
+               return 1;
+       }
+
+       writew(I2C_CON_EN, &i2c_base->con);
+
+       while (readw(&i2c_base->stat)
+               || (readw(&i2c_base->con) & I2C_CON_MST)) {
+               udelay(10000);
+               writew(0xFFFF, &i2c_base->stat);
+       }
+
+       writew(I2C_CON_EN, &i2c_base->con);
+       flush_fifo();
+       writew(0xFFFF, &i2c_base->stat);
+       writew(0, &i2c_base->cnt);
+
        return 0;
 }
 
 int i2c_write(uchar chip, uint addr, int alen, uchar *buffer, int len)
 {
-       int i;
-       u16 status;
-       int i2c_error = 0;
 
-       if (alen > 1) {
-               printf("I2C write: addr len %d not supported\n", alen);
+       int i, i2c_error = 0;
+       u32 status;
+       u16 writelen;
+
+       if (alen > 2)
                return 1;
-       }
 
-       if (addr + len > 256) {
-               printf("I2C write: address 0x%x + 0x%x out of range\n",
-                               addr, len);
+       if (alen < 2) {
+               if (addr + len > 256)
+                       return 1;
+       } else if (addr + len > 0xFFFF) {
                return 1;
        }
 
        /* wait until bus not busy */
-       wait_for_bb();
+       status = wait_for_bb();
 
-       /* start address phase - will write regoffset + len bytes data */
-       /* TODO consider case when !CONFIG_OMAP243X/34XX/44XX */
-       writew(alen + len, &i2c_base->cnt);
+       /* exiting on BUS busy */
+       if (status & I2C_STAT_TIMEO)
+               return 1;
+
+       writelen = (len & 0xFFFF) + alen;
+
+       /* two bytes */
+       writew((writelen & 0xFFFF), &i2c_base->cnt);
+       /* Clear the Tx & Rx FIFOs */
+       writew((readw(&i2c_base->buf) | I2C_RXFIFO_CLEAR |
+                       I2C_TXFIFO_CLEAR), &i2c_base->buf);
        /* set slave address */
        writew(chip, &i2c_base->sa);
        /* stop bit needed here */
        writew(I2C_CON_EN | I2C_CON_MST | I2C_CON_STT | I2C_CON_TRX |
                I2C_CON_STP, &i2c_base->con);
 
-       /* Send address byte */
-       status = wait_for_pin();
+       /* wait for Transmit ready condition */
+       status = wait_for_status_mask(I2C_STAT_XRDY | I2C_STAT_NACK);
 
-       if (status == 0 || status & I2C_STAT_NACK) {
+       if (status & (I2C_STAT_NACK | I2C_STAT_TIMEO))
                i2c_error = 1;
-               printf("error waiting for i2c address ACK (status=0x%x)\n",
-                     status);
-               goto write_exit;
-       }
 
-       if (status & I2C_STAT_XRDY) {
-               writeb(addr & 0xFF, &i2c_base->data);
-               writew(I2C_STAT_XRDY, &i2c_base->stat);
-       } else {
-               i2c_error = 1;
-               printf("i2c bus not ready for transmit (status=0x%x)\n",
-                     status);
-               goto write_exit;
-       }
+       if (!i2c_error) {
+               if (status & I2C_STAT_XRDY) {
+                       switch (alen) {
+#if defined(CONFIG_OMAP243X) || defined(CONFIG_OMAP34XX) || \
+                       defined(CONFIG_AM33XX)
+                       case 2:
+                               /* send out MSB byte */
+                               writeb(((addr >> 8) & 0xFF), &i2c_base->data);
+#else
+                               writeb((addr  & 0xFFFF), &i2c_base->data);
+                               break;
+#endif
+                               /* Clearing XRDY event */
+                               writew((status & I2C_STAT_XRDY),
+                                       &i2c_base->stat);
+                               /*waiting for Transmit ready * condition */
+                               status = wait_for_status_mask(I2C_STAT_XRDY |
+                                               I2C_STAT_NACK);
+
+                               if (status & (I2C_STAT_NACK | I2C_STAT_TIMEO)) {
+                                       i2c_error = 1;
+                                       break;
+                               }
+                       case 1:
+#if defined(CONFIG_OMAP243X) || defined(CONFIG_OMAP34XX) || \
+                       defined(CONFIG_AM33XX)
+                               /* send out MSB byte */
+                               writeb((addr  & 0xFF), &i2c_base->data);
+#else
+                               writew(((buffer[0] << 8) | (addr & 0xFF)),
+                                       &i2c_base->data);
+#endif
+                       }
 
-       /* address phase is over, now write data */
-       for (i = 0; i < len; i++) {
-               status = wait_for_pin();
+                       /* Clearing XRDY event */
+                       writew((status & I2C_STAT_XRDY), &i2c_base->stat);
+               }
+
+               /* waiting for Transmit ready condition */
+               status = wait_for_status_mask(I2C_STAT_XRDY | I2C_STAT_NACK);
 
-               if (status == 0 || status & I2C_STAT_NACK) {
+               if (status & (I2C_STAT_NACK | I2C_STAT_TIMEO))
                        i2c_error = 1;
-                       printf("i2c error waiting for data ACK (status=0x%x)\n",
-                                       status);
-                       goto write_exit;
+
+               if (!i2c_error) {
+                       for (i = ((alen > 1) ? 0 : 1); i < len; i++) {
+                               if (status & I2C_STAT_XRDY) {
+#if defined(CONFIG_OMAP243X) || defined(CONFIG_OMAP34XX) || \
+                               defined(CONFIG_AM33XX)
+                                       writeb((buffer[i] & 0xFF),
+                                               &i2c_base->data);
+#else
+                                       writew((((buffer[i] << 8) |
+                                       buffer[i + 1]) & 0xFFFF),
+                                               &i2c_base->data);
+                                       i++;
+#endif
+                               } else
+                                       i2c_error = 1;
+                                       /* Clearing XRDY event */
+                                       writew((status & I2C_STAT_XRDY),
+                                               &i2c_base->stat);
+                                       /* waiting for XRDY condition */
+                                       status = wait_for_status_mask(
+                                               I2C_STAT_XRDY |
+                                               I2C_STAT_ARDY |
+                                               I2C_STAT_NACK);
+                                       if (status & (I2C_STAT_NACK |
+                                               I2C_STAT_TIMEO)) {
+                                               i2c_error = 1;
+                                               break;
+                                       }
+                                       if (status & I2C_STAT_ARDY)
+                                               break;
+                       }
                }
+       }
 
-               if (status & I2C_STAT_XRDY) {
-                       writeb(buffer[i], &i2c_base->data);
-                       writew(I2C_STAT_XRDY, &i2c_base->stat);
-               } else {
-                       i2c_error = 1;
-                       printf("i2c bus not ready for Tx (i=%d)\n", i);
-                       goto write_exit;
+       status = wait_for_status_mask(I2C_STAT_ARDY | I2C_STAT_NACK |
+                               I2C_STAT_AL);
+
+       if (status & (I2C_STAT_NACK | I2C_STAT_TIMEO))
+               i2c_error = 1;
+
+       if (i2c_error) {
+               writew(0, &i2c_base->con);
+               return 1;
+       }
+
+       if (!i2c_error) {
+               int eout = 200;
+
+               writew(I2C_CON_EN, &i2c_base->con);
+               while ((status = readw(&i2c_base->stat)) ||
+                               (readw(&i2c_base->con) & I2C_CON_MST)) {
+                       udelay(1000);
+                       /* have to read to clear intrrupt */
+                       writew(0xFFFF, &i2c_base->stat);
+                       if (--eout == 0)
+                               /* better leave with error than hang */
+                               break;
                }
        }
 
-write_exit:
        flush_fifo();
        writew(0xFFFF, &i2c_base->stat);
-       return i2c_error;
+       writew(0, &i2c_base->cnt);
+       return 0;
 }
 
-static void wait_for_bb(void)
+static u32 wait_for_bb(void)
 {
        int timeout = I2C_TIMEOUT;
-       u16 stat;
+       u32 stat;
 
-       writew(0xFFFF, &i2c_base->stat);        /* clear current interrupts...*/
        while ((stat = readw(&i2c_base->stat) & I2C_STAT_BB) && timeout--) {
                writew(stat, &i2c_base->stat);
                udelay(1000);
@@ -394,30 +523,28 @@ static void wait_for_bb(void)
        if (timeout <= 0) {
                printf("timed out in wait_for_bb: I2C_STAT=%x\n",
                        readw(&i2c_base->stat));
+               stat |= I2C_STAT_TIMEO;
        }
        writew(0xFFFF, &i2c_base->stat);         /* clear delayed stuff*/
+       return stat;
 }
 
-static u16 wait_for_pin(void)
+static u32 wait_for_status_mask(u16 mask)
 {
-       u16 status;
+       u32 status;
        int timeout = I2C_TIMEOUT;
 
        do {
                udelay(1000);
                status = readw(&i2c_base->stat);
-       } while (!(status &
-                  (I2C_STAT_ROVR | I2C_STAT_XUDF | I2C_STAT_XRDY |
-                   I2C_STAT_RRDY | I2C_STAT_ARDY | I2C_STAT_NACK |
-                   I2C_STAT_AL)) && timeout--);
+       } while (!(status & mask) && timeout--);
 
        if (timeout <= 0) {
-               printf("timed out in wait_for_pin: I2C_STAT=%x\n",
+               printf("timed out in wait_for_status_mask: I2C_STAT=%x\n",
                        readw(&i2c_base->stat));
                writew(0xFFFF, &i2c_base->stat);
-               status = 0;
+               status |= I2C_STAT_TIMEO;
        }
-
        return status;
 }
 
index 1f38c232d16461c8f077c40573f637a8957ab2b3..9a0b126b387825c9f7d8d20f2dcacc79a07ab0b9 100644 (file)
@@ -60,7 +60,9 @@
 /* I2C Buffer Configuration Register (I2C_BUF): */
 
 #define I2C_BUF_RDMA_EN                (1 << 15) /* Receive DMA channel enable */
+#define I2C_RXFIFO_CLEAR       (1 << 14) /* RX FIFO Clear */
 #define I2C_BUF_XDMA_EN                (1 << 7)  /* Transmit DMA channel enable */
+#define I2C_TXFIFO_CLEAR       (1 << 6)  /* TX FIFO clear */
 
 /* I2C Configuration Register (I2C_CON): */
 
index 8afb22159ab518e5ea3ed9acbba769220523c943..d58c18bc2a5b9ff05671172cab1d261efd15b781 100644 (file)
@@ -25,9 +25,7 @@
 #include <mmc.h>
 #include <asm/errno.h>
 #include <asm/io.h>
-#ifdef CONFIG_MX27
 #include <asm/arch/clock.h>
-#endif
 
 #define DRIVER_NAME "mxc-mmc"
 
@@ -422,7 +420,7 @@ static void mxcmci_set_clk_rate(struct mxcmci_host *host, unsigned int clk_ios)
 {
        unsigned int divider;
        int prescaler = 0;
-       unsigned long clk_in = imx_get_perclk2();
+       unsigned long clk_in = mxc_get_clock(MXC_ESDHC_CLK);
 
        while (prescaler <= 0x800) {
                for (divider = 1; divider <= 0xF; divider++) {
@@ -509,8 +507,8 @@ static int mxcmci_initialize(bd_t *bis)
 
        mmc->voltages = MMC_VDD_32_33 | MMC_VDD_33_34;
 
-       mmc->f_min = imx_get_perclk2() >> 7;
-       mmc->f_max = imx_get_perclk2() >> 1;
+       mmc->f_min = mxc_get_clock(MXC_ESDHC_CLK) >> 7;
+       mmc->f_max = mxc_get_clock(MXC_ESDHC_CLK) >> 1;
 
        mmc->b_max = 0;
 
index 5b4c9f69a18fe34b7f0033ce8799225e60045ad4..3191557c5be62e08304444149ea0983884516abe 100644 (file)
@@ -114,6 +114,14 @@ static void mmc_set_transfer_mode(struct mmc_host *host, struct mmc_data *data)
        if (data->flags & MMC_DATA_READ)
                mode |= TEGRA_MMC_TRNMOD_DATA_XFER_DIR_SEL_READ;
 
+       if (data->flags & MMC_DATA_WRITE) {
+               if ((uintptr_t)data->src & (ARCH_DMA_MINALIGN - 1))
+                       printf("Warning: unaligned write to %p may fail\n",
+                              data->src);
+               flush_dcache_range((ulong)data->src, (ulong)data->src +
+                       data->blocks * data->blocksize);
+       }
+
        writew(mode, &host->reg->trnmod);
 }
 
@@ -310,6 +318,14 @@ static int mmc_send_cmd(struct mmc *mmc, struct mmc_cmd *cmd,
                        }
                }
                writel(mask, &host->reg->norintsts);
+               if (data->flags & MMC_DATA_READ) {
+                       if ((uintptr_t)data->dest & (ARCH_DMA_MINALIGN - 1))
+                               printf("Warning: unaligned read from %p "
+                                       "may fail\n", data->dest);
+                       invalidate_dcache_range((ulong)data->dest,
+                               (ulong)data->dest +
+                                       data->blocks * data->blocksize);
+               }
        }
 
        udelay(1000);
index 5494bcffa7c4b247992f8a7e0e997a4b02cda2bf..722c3fc7bdd17a2ef0e1eb3db30678979046f048 100644 (file)
@@ -40,6 +40,7 @@
 #include <asm/byteorder.h>
 #include <environment.h>
 #include <mtd/cfi_flash.h>
+#include <watchdog.h>
 
 /*
  * This file implements a Common Flash Interface (CFI) driver for
@@ -577,6 +578,7 @@ static int flash_status_check (flash_info_t * info, flash_sect_t sector,
        reset_timer();
 #endif
        start = get_timer (0);
+       WATCHDOG_RESET();
        while (flash_is_busy (info, sector)) {
                if (get_timer (start) > tout) {
                        printf ("Flash %s timeout at address %lx data %lx\n",
@@ -668,6 +670,7 @@ static int flash_status_poll(flash_info_t *info, void *src, void *dst,
        reset_timer();
 #endif
        start = get_timer(0);
+       WATCHDOG_RESET();
        while (1) {
                switch (info->portwidth) {
                case FLASH_CFI_8BIT:
index 36d30c3b6873d9318aed3de969709048676ba4e5..2350f361f1bdf2d080ac1384947b043ec0bcd3ad 100644 (file)
@@ -69,6 +69,9 @@
 #define SST39SF010A    0x00B5
 #define SST39SF020A    0x00B6
 
+/* STM */
+#define STM29F400BB    0x00D6
+
 /* MXIC */
 #define MX29LV040      0x004F
 
@@ -346,6 +349,23 @@ static const struct amd_flash_info jedec_table[] = {
                        ERASEINFO(0x10000, 15),
                }
        },
+       {
+               .mfr_id         = (u16)STM_MANUFACT,
+               .dev_id         = STM29F400BB,
+               .name           = "ST Micro M29F400BB",
+               .uaddr          = {
+                       [1] = MTD_UADDR_0x0555_0x02AA /* x16 */
+               },
+               .DevSize                = SIZE_512KiB,
+               .CmdSet                 = CFI_CMDSET_AMD_LEGACY,
+               .NumEraseRegions        = 4,
+               .regions                = {
+                       ERASEINFO(0x04000, 1),
+                       ERASEINFO(0x02000, 2),
+                       ERASEINFO(0x08000, 1),
+                       ERASEINFO(0x10000, 7),
+               }
+       },
 #endif
 };
 
index 36ee454304351358dcddd36b756f4d87654c3dc1..998fc73497caf4ca33e125ffafbb7b1d08b7d615 100644 (file)
@@ -39,8 +39,9 @@ COBJS-y += nand_bbt.o
 COBJS-y += nand_ids.o
 COBJS-y += nand_util.o
 endif
-COBJS-y += nand_ecc.o
+COBJS-$(CONFIG_MTD_ECC_SOFT) += nand_ecc.o
 COBJS-y += nand_base.o
+COBJS-$(CONFIG_NAND_ECC_BCH) += nand_bch.o
 
 COBJS-$(CONFIG_NAND_ATMEL) += atmel_nand.o
 COBJS-$(CONFIG_DRIVER_NAND_BFIN) += bfin_nand.o
index 3ee060f859fc9646d27a61e271a2bc08253a8541..c7ddbb21d8ed95edd8463cbe69349df3e0d03b1a 100644 (file)
@@ -73,7 +73,7 @@ static void bfin_nfc_cmd_ctrl(struct mtd_info *mtd, int cmd, unsigned int ctrl)
        SSYNC();
 }
 
-int bfin_nfc_devready(struct mtd_info *mtd)
+static int bfin_nfc_devready(struct mtd_info *mtd)
 {
        pr_stamp();
        return (bfin_read_NFC_STAT() & NBUSY) ? 1 : 0;
index 4d1e527db103f54359f6744fa9df601007ca5ce6..9076ad4cdc36ac517ef1658f91a0955c2223ab16 100644 (file)
@@ -22,6 +22,7 @@
 
 #include <common.h>
 #include <malloc.h>
+#include <nand.h>
 
 #include <linux/mtd/mtd.h>
 #include <linux/mtd/nand.h>
@@ -57,7 +58,6 @@ struct fsl_elbc_ctrl;
 /* mtd information per set */
 
 struct fsl_elbc_mtd {
-       struct mtd_info mtd;
        struct nand_chip chip;
        struct fsl_elbc_ctrl *ctrl;
 
@@ -340,18 +340,21 @@ static void fsl_elbc_cmdfunc(struct mtd_info *mtd, unsigned int command,
 
        /* READID must read all 5 possible bytes while CEB is active */
        case NAND_CMD_READID:
-               vdbg("fsl_elbc_cmdfunc: NAND_CMD_READID.\n");
+       case NAND_CMD_PARAM:
+               vdbg("fsl_elbc_cmdfunc: NAND_CMD 0x%x.\n", command);
 
                out_be32(&lbc->fir, (FIR_OP_CW0 << FIR_OP0_SHIFT) |
                                    (FIR_OP_UA  << FIR_OP1_SHIFT) |
                                    (FIR_OP_RBW << FIR_OP2_SHIFT));
-               out_be32(&lbc->fcr, NAND_CMD_READID << FCR_CMD0_SHIFT);
-               /* 5 bytes for manuf, device and exts */
-               out_be32(&lbc->fbcr, 5);
-               ctrl->read_bytes = 5;
+               out_be32(&lbc->fcr, command << FCR_CMD0_SHIFT);
+               /*
+                * although currently it's 8 bytes for READID, we always read
+                * the maximum 256 bytes(for PARAM)
+                */
+               out_be32(&lbc->fbcr, 256);
+               ctrl->read_bytes = 256;
                ctrl->use_mdr = 1;
-               ctrl->mdr = 0;
-
+               ctrl->mdr = column;
                set_addr(mtd, 0, 0, 0);
                fsl_elbc_run_command(mtd);
                return;
@@ -683,10 +686,13 @@ static void fsl_elbc_ctrl_init(void)
        elbc_ctrl->addr = NULL;
 }
 
-int board_nand_init(struct nand_chip *nand)
+static int fsl_elbc_chip_init(int devnum, u8 *addr)
 {
+       struct mtd_info *mtd = &nand_info[devnum];
+       struct nand_chip *nand;
        struct fsl_elbc_mtd *priv;
        uint32_t br = 0, or = 0;
+       int ret;
 
        if (!elbc_ctrl) {
                fsl_elbc_ctrl_init();
@@ -699,19 +705,19 @@ int board_nand_init(struct nand_chip *nand)
                return -ENOMEM;
 
        priv->ctrl = elbc_ctrl;
-       priv->vbase = nand->IO_ADDR_R;
+       priv->vbase = addr;
 
        /* Find which chip select it is connected to.  It'd be nice
         * if we could pass more than one datum to the NAND driver...
         */
        for (priv->bank = 0; priv->bank < MAX_BANKS; priv->bank++) {
-               phys_addr_t base_addr = virt_to_phys(nand->IO_ADDR_R);
+               phys_addr_t phys_addr = virt_to_phys(addr);
 
                br = in_be32(&elbc_ctrl->regs->bank[priv->bank].br);
                or = in_be32(&elbc_ctrl->regs->bank[priv->bank].or);
 
                if ((br & BR_V) && (br & BR_MSEL) == BR_MS_FCM &&
-                   (br & or & BR_BA) == BR_PHYS_ADDR(base_addr))
+                   (br & or & BR_BA) == BR_PHYS_ADDR(phys_addr))
                        break;
        }
 
@@ -721,6 +727,9 @@ int board_nand_init(struct nand_chip *nand)
                return -ENODEV;
        }
 
+       nand = &priv->chip;
+       mtd->priv = nand;
+
        elbc_ctrl->chips[priv->bank] = priv;
 
        /* fill in nand_chip structure */
@@ -791,5 +800,32 @@ int board_nand_init(struct nand_chip *nand)
                }
        }
 
+       ret = nand_scan_ident(mtd, 1, NULL);
+       if (ret)
+               return ret;
+
+       ret = nand_scan_tail(mtd);
+       if (ret)
+               return ret;
+
+       ret = nand_register(devnum);
+       if (ret)
+               return ret;
+
        return 0;
 }
+
+#ifndef CONFIG_SYS_NAND_BASE_LIST
+#define CONFIG_SYS_NAND_BASE_LIST { CONFIG_SYS_NAND_BASE }
+#endif
+
+static unsigned long base_address[CONFIG_SYS_MAX_NAND_DEVICE] =
+       CONFIG_SYS_NAND_BASE_LIST;
+
+void board_nand_init(void)
+{
+       int i;
+
+       for (i = 0; i < CONFIG_SYS_MAX_NAND_DEVICE; i++)
+               fsl_elbc_chip_init(i, (u8 *)base_address[i]);
+}
index d987f4c85c83539fe47ecf82b23650c1f8dbfab9..4cf4c1c7076c1f933bb77086f68fd3894e98a6f3 100644 (file)
@@ -23,6 +23,7 @@
 
 #include <common.h>
 #include <nand.h>
+#include <errno.h>
 
 #ifndef CONFIG_SYS_NAND_BASE_LIST
 #define CONFIG_SYS_NAND_BASE_LIST { CONFIG_SYS_NAND_BASE }
 DECLARE_GLOBAL_DATA_PTR;
 
 int nand_curr_device = -1;
+
+
 nand_info_t nand_info[CONFIG_SYS_MAX_NAND_DEVICE];
 
+#ifndef CONFIG_SYS_NAND_SELF_INIT
 static struct nand_chip nand_chip[CONFIG_SYS_MAX_NAND_DEVICE];
 static ulong base_address[CONFIG_SYS_MAX_NAND_DEVICE] = CONFIG_SYS_NAND_BASE_LIST;
+#endif
+
+static char dev_name[CONFIG_SYS_MAX_NAND_DEVICE][8];
+
+static unsigned long total_nand_size; /* in kiB */
+
+/* Register an initialized NAND mtd device with the U-Boot NAND command. */
+int nand_register(int devnum)
+{
+       struct mtd_info *mtd;
+
+       if (devnum >= CONFIG_SYS_MAX_NAND_DEVICE)
+               return -EINVAL;
+
+       mtd = &nand_info[devnum];
+
+       sprintf(dev_name[devnum], "nand%d", devnum);
+       mtd->name = dev_name[devnum];
+
+#ifdef CONFIG_MTD_DEVICE
+       /*
+        * Add MTD device so that we can reference it later
+        * via the mtdcore infrastructure (e.g. ubi).
+        */
+       add_mtd_device(mtd);
+#endif
+
+       total_nand_size += mtd->size / 1024;
 
-static const char default_nand_name[] = "nand";
-static __attribute__((unused)) char dev_name[CONFIG_SYS_MAX_NAND_DEVICE][8];
+       if (nand_curr_device == -1)
+               nand_curr_device = devnum;
+
+       return 0;
+}
 
-static void nand_init_chip(struct mtd_info *mtd, struct nand_chip *nand,
-                          ulong base_addr)
+#ifndef CONFIG_SYS_NAND_SELF_INIT
+static void nand_init_chip(int i)
 {
+       struct mtd_info *mtd = &nand_info[i];
+       struct nand_chip *nand = &nand_chip[i];
+       ulong base_addr = base_address[i];
        int maxchips = CONFIG_SYS_NAND_MAX_CHIPS;
-       static int __attribute__((unused)) i = 0;
 
        if (maxchips < 1)
                maxchips = 1;
-       mtd->priv = nand;
 
+       mtd->priv = nand;
        nand->IO_ADDR_R = nand->IO_ADDR_W = (void  __iomem *)base_addr;
-       if (board_nand_init(nand) == 0) {
-               if (nand_scan(mtd, maxchips) == 0) {
-                       if (!mtd->name)
-                               mtd->name = (char *)default_nand_name;
-#ifdef CONFIG_NEEDS_MANUAL_RELOC
-                       else
-                               mtd->name += gd->reloc_off;
-#endif
 
-#ifdef CONFIG_MTD_DEVICE
-                       /*
-                        * Add MTD device so that we can reference it later
-                        * via the mtdcore infrastructure (e.g. ubi).
-                        */
-                       sprintf(dev_name[i], "nand%d", i);
-                       mtd->name = dev_name[i++];
-                       add_mtd_device(mtd);
-#endif
-               } else
-                       mtd->name = NULL;
-       } else {
-               mtd->name = NULL;
-               mtd->size = 0;
-       }
+       if (board_nand_init(nand))
+               return;
 
+       if (nand_scan(mtd, maxchips))
+               return;
+
+       nand_register(i);
 }
+#endif
 
 void nand_init(void)
 {
+#ifdef CONFIG_SYS_NAND_SELF_INIT
+       board_nand_init();
+#else
        int i;
-       unsigned int size = 0;
-       for (i = 0; i < CONFIG_SYS_MAX_NAND_DEVICE; i++) {
-               nand_init_chip(&nand_info[i], &nand_chip[i], base_address[i]);
-               size += nand_info[i].size / 1024;
-               if (nand_curr_device == -1)
-                       nand_curr_device = i;
-       }
-       printf("%u MiB\n", size / 1024);
+
+       for (i = 0; i < CONFIG_SYS_MAX_NAND_DEVICE; i++)
+               nand_init_chip(i);
+#endif
+
+       printf("%lu MiB\n", total_nand_size / 1024);
 
 #ifdef CONFIG_SYS_NAND_SELECT_DEVICE
        /*
index 27f6c776b04d6649992cef0ec79e6552db14c59f..12b960fdb907ba44e3957b02a7b0e7a5f817dbf9 100644 (file)
@@ -43,6 +43,7 @@
 #include <linux/mtd/mtd.h>
 #include <linux/mtd/nand.h>
 #include <linux/mtd/nand_ecc.h>
+#include <linux/mtd/nand_bch.h>
 
 #ifdef CONFIG_MTD_PARTITIONS
 #include <linux/mtd/partitions.h>
@@ -70,7 +71,7 @@ static struct nand_ecclayout nand_oob_8 = {
                {.offset = 3,
                 .length = 2},
                {.offset = 6,
-                .length = 2}}
+                .length = 2} }
 };
 
 static struct nand_ecclayout nand_oob_16 = {
@@ -78,7 +79,7 @@ static struct nand_ecclayout nand_oob_16 = {
        .eccpos = {0, 1, 2, 3, 6, 7},
        .oobfree = {
                {.offset = 8,
-                . length = 8}}
+                . length = 8} }
 };
 
 static struct nand_ecclayout nand_oob_64 = {
@@ -89,24 +90,23 @@ static struct nand_ecclayout nand_oob_64 = {
                   56, 57, 58, 59, 60, 61, 62, 63},
        .oobfree = {
                {.offset = 2,
-                .length = 38}}
+                .length = 38} }
 };
 
 static struct nand_ecclayout nand_oob_128 = {
        .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,
+                  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 = {
                {.offset = 2,
-                .length = 78}}
+                .length = 78} }
 };
 
-
 static int nand_get_device(struct nand_chip *chip, struct mtd_info *mtd,
                           int new_state);
 
@@ -115,16 +115,47 @@ static int nand_do_write_oob(struct mtd_info *mtd, loff_t to,
 
 static int nand_wait(struct mtd_info *mtd, struct nand_chip *this);
 
+static int check_offs_len(struct mtd_info *mtd,
+                                       loff_t ofs, uint64_t len)
+{
+       struct nand_chip *chip = mtd->priv;
+       int ret = 0;
+
+       /* Start address must align on block boundary */
+       if (ofs & ((1 << chip->phys_erase_shift) - 1)) {
+               MTDDEBUG(MTD_DEBUG_LEVEL0, "%s: Unaligned address\n", __func__);
+               ret = -EINVAL;
+       }
+
+       /* Length must align on block boundary */
+       if (len & ((1 << chip->phys_erase_shift) - 1)) {
+               MTDDEBUG(MTD_DEBUG_LEVEL0, "%s: Length not block aligned\n",
+                                       __func__);
+               ret = -EINVAL;
+       }
+
+       /* Do not allow past end of device */
+       if (ofs + len > mtd->size) {
+               MTDDEBUG(MTD_DEBUG_LEVEL0, "%s: Past end of device\n",
+                                       __func__);
+               ret = -EINVAL;
+       }
+
+       return ret;
+}
+
 /**
  * nand_release_device - [GENERIC] release chip
  * @mtd:       MTD device structure
  *
  * Deselect, release chip lock and wake up anyone waiting on the device
  */
-static void nand_release_device (struct mtd_info *mtd)
+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 */
+       struct nand_chip *chip = mtd->priv;
+
+       /* De-select the NAND device */
+       chip->select_chip(mtd, -1);
 }
 
 /**
@@ -316,6 +347,9 @@ static int nand_block_bad(struct mtd_info *mtd, loff_t ofs, int getchip)
        struct nand_chip *chip = mtd->priv;
        u16 bad;
 
+       if (chip->options & NAND_BBT_SCANLASTPAGE)
+               ofs += mtd->erasesize - mtd->writesize;
+
        page = (int)(ofs >> chip->page_shift) & chip->pagemask;
 
        if (getchip) {
@@ -333,14 +367,18 @@ static int nand_block_bad(struct mtd_info *mtd, loff_t ofs, int getchip)
                bad = cpu_to_le16(chip->read_word(mtd));
                if (chip->badblockpos & 0x1)
                        bad >>= 8;
-               if ((bad & 0xFF) != 0xff)
-                       res = 1;
+               else
+                       bad &= 0xFF;
        } else {
                chip->cmdfunc(mtd, NAND_CMD_READOOB, chip->badblockpos, page);
-               if (chip->read_byte(mtd) != 0xff)
-                       res = 1;
+               bad = chip->read_byte(mtd);
        }
 
+       if (likely(chip->badblockbits == 8))
+               res = bad != 0xFF;
+       else
+               res = hweight8(bad) < chip->badblockbits;
+
        if (getchip)
                nand_release_device(mtd);
 
@@ -359,7 +397,10 @@ static int nand_default_block_markbad(struct mtd_info *mtd, loff_t ofs)
 {
        struct nand_chip *chip = mtd->priv;
        uint8_t buf[2] = { 0, 0 };
-       int block, ret;
+       int block, ret, i = 0;
+
+       if (chip->options & NAND_BBT_SCANLASTPAGE)
+               ofs += mtd->erasesize - mtd->writesize;
 
        /* Get block number */
        block = (int)(ofs >> chip->bbt_erase_shift);
@@ -370,17 +411,31 @@ static int nand_default_block_markbad(struct mtd_info *mtd, loff_t ofs)
        if (chip->options & NAND_USE_FLASH_BBT)
                ret = nand_update_bbt(mtd, ofs);
        else {
-               /* We write two bytes, so we dont have to mess with 16 bit
-                * access
-                */
                nand_get_device(chip, mtd, FL_WRITING);
-               ofs += mtd->oobsize;
-               chip->ops.len = chip->ops.ooblen = 2;
-               chip->ops.datbuf = NULL;
-               chip->ops.oobbuf = buf;
-               chip->ops.ooboffs = chip->badblockpos & ~0x01;
 
-               ret = nand_do_write_oob(mtd, ofs, &chip->ops);
+               /* Write to first two pages and to byte 1 and 6 if necessary.
+                * If we write to more than one location, the first error
+                * encountered quits the procedure. We write two bytes per
+                * location, so we dont have to mess with 16 bit access.
+                */
+               do {
+                       chip->ops.len = chip->ops.ooblen = 2;
+                       chip->ops.datbuf = NULL;
+                       chip->ops.oobbuf = buf;
+                       chip->ops.ooboffs = chip->badblockpos & ~0x01;
+
+                       ret = nand_do_write_oob(mtd, ofs, &chip->ops);
+
+                       if (!ret && (chip->options & NAND_BBT_SCANBYTE1AND6)) {
+                               chip->ops.ooboffs = NAND_SMALL_BADBLOCK_POS
+                                       & ~0x01;
+                               ret = nand_do_write_oob(mtd, ofs, &chip->ops);
+                       }
+                       i++;
+                       ofs += mtd->writesize;
+               } while (!ret && (chip->options & NAND_BBT_SCAN2NDPAGE) &&
+                               i < 2);
+
                nand_release_device(mtd);
        }
        if (!ret)
@@ -399,6 +454,11 @@ static int nand_default_block_markbad(struct mtd_info *mtd, loff_t ofs)
 static int nand_check_wp(struct mtd_info *mtd)
 {
        struct nand_chip *chip = mtd->priv;
+
+       /* broken xD cards report WP despite being writable */
+       if (chip->options & NAND_BROKEN_XD)
+               return 0;
+
        /* Check the WP bit */
        chip->cmdfunc(mtd, NAND_CMD_STATUS, -1, -1);
        return (chip->read_byte(mtd) & NAND_STATUS_WP) ? 0 : 1;
@@ -419,11 +479,6 @@ static int nand_block_checkbad(struct mtd_info *mtd, loff_t ofs, int getchip,
 {
        struct nand_chip *chip = mtd->priv;
 
-       if (!(chip->options & NAND_BBT_SCANNED)) {
-               chip->options |= NAND_BBT_SCANNED;
-               chip->scan_bbt(mtd);
-       }
-
        if (!chip->bbt)
                return chip->block_bad(mtd, ofs, getchip);
 
@@ -686,9 +741,10 @@ static void nand_command_lp(struct mtd_info *mtd, unsigned int command,
  *
  * Get the device and lock it for exclusive access
  */
-static int nand_get_device (struct nand_chip *this, struct mtd_info *mtd, int new_state)
+static int
+nand_get_device(struct nand_chip *chip, struct mtd_info *mtd, int new_state)
 {
-       this->state = new_state;
+       chip->state = new_state;
        return 0;
 }
 
@@ -701,10 +757,10 @@ static int nand_get_device (struct nand_chip *this, struct mtd_info *mtd, int ne
  * Erase can take up to 400ms and program up to 20ms according to
  * general NAND and SmartMedia specs
  */
-static int nand_wait(struct mtd_info *mtd, struct nand_chip *this)
+static int nand_wait(struct mtd_info *mtd, struct nand_chip *chip)
 {
        unsigned long   timeo;
-       int state = this->state;
+       int state = chip->state;
        u32 time_start;
 
        if (state == FL_ERASING)
@@ -712,10 +768,10 @@ static int nand_wait(struct mtd_info *mtd, struct nand_chip *this)
        else
                timeo = (CONFIG_SYS_HZ * 20) / 1000;
 
-       if ((state == FL_ERASING) && (this->options & NAND_IS_AND))
-               this->cmdfunc(mtd, NAND_CMD_STATUS_MULTI, -1, -1);
+       if ((state == FL_ERASING) && (chip->options & NAND_IS_AND))
+               chip->cmdfunc(mtd, NAND_CMD_STATUS_MULTI, -1, -1);
        else
-               this->cmdfunc(mtd, NAND_CMD_STATUS, -1, -1);
+               chip->cmdfunc(mtd, NAND_CMD_STATUS, -1, -1);
 
        time_start = get_timer(0);
 
@@ -725,11 +781,11 @@ static int nand_wait(struct mtd_info *mtd, struct nand_chip *this)
                        return 0x01;
                }
 
-               if (this->dev_ready) {
-                       if (this->dev_ready(mtd))
+               if (chip->dev_ready) {
+                       if (chip->dev_ready(mtd))
                                break;
                } else {
-                       if (this->read_byte(mtd) & NAND_STATUS_READY)
+                       if (chip->read_byte(mtd) & NAND_STATUS_READY)
                                break;
                }
        }
@@ -739,7 +795,7 @@ static int nand_wait(struct mtd_info *mtd, struct nand_chip *this)
                ;
 #endif /*  PPCHAMELON_NAND_TIMER_HACK */
 
-       return this->read_byte(mtd);
+       return (int)chip->read_byte(mtd);
 }
 
 /**
@@ -768,8 +824,9 @@ static int nand_read_page_raw(struct mtd_info *mtd, struct nand_chip *chip,
  *
  * We need a special oob layout and handling even when OOB isn't used.
  */
-static int nand_read_page_raw_syndrome(struct mtd_info *mtd, struct nand_chip *chip,
-                             uint8_t *buf, int page)
+static int nand_read_page_raw_syndrome(struct mtd_info *mtd,
+                                       struct nand_chip *chip,
+                                       uint8_t *buf, int page)
 {
        int eccsize = chip->ecc.size;
        int eccbytes = chip->ecc.bytes;
@@ -850,7 +907,8 @@ static int nand_read_page_swecc(struct mtd_info *mtd, struct nand_chip *chip,
  * @readlen:   data length
  * @bufpoi:    buffer to store read data
  */
-static int nand_read_subpage(struct mtd_info *mtd, struct nand_chip *chip, uint32_t data_offs, uint32_t readlen, uint8_t *bufpoi)
+static int nand_read_subpage(struct mtd_info *mtd, struct nand_chip *chip,
+                       uint32_t data_offs, uint32_t readlen, uint8_t *bufpoi)
 {
        int start_step, end_step, num_steps;
        uint32_t *eccpos = chip->ecc.layout->eccpos;
@@ -858,6 +916,7 @@ static int nand_read_subpage(struct mtd_info *mtd, struct nand_chip *chip, uint3
        int data_col_addr, i, gaps = 0;
        int datafrag_len, eccfrag_len, aligned_len, aligned_pos;
        int busw = (chip->options & NAND_BUSWIDTH_16) ? 2 : 1;
+       int index = 0;
 
        /* Column address wihin the page aligned to ECC size (256bytes). */
        start_step = data_offs / chip->ecc.size;
@@ -896,26 +955,30 @@ static int nand_read_subpage(struct mtd_info *mtd, struct nand_chip *chip, uint3
        } else {
                /* send the command to read the particular ecc bytes */
                /* take care about buswidth alignment in read_buf */
-               aligned_pos = eccpos[start_step * chip->ecc.bytes] & ~(busw - 1);
+               index = start_step * chip->ecc.bytes;
+
+               aligned_pos = eccpos[index] & ~(busw - 1);
                aligned_len = eccfrag_len;
-               if (eccpos[start_step * chip->ecc.bytes] & (busw - 1))
+               if (eccpos[index] & (busw - 1))
                        aligned_len++;
-               if (eccpos[(start_step + num_steps) * chip->ecc.bytes] & (busw - 1))
+               if (eccpos[index + (num_steps * chip->ecc.bytes)] & (busw - 1))
                        aligned_len++;
 
-               chip->cmdfunc(mtd, NAND_CMD_RNDOUT, mtd->writesize + aligned_pos, -1);
+               chip->cmdfunc(mtd, NAND_CMD_RNDOUT,
+                                       mtd->writesize + aligned_pos, -1);
                chip->read_buf(mtd, &chip->oob_poi[aligned_pos], aligned_len);
        }
 
        for (i = 0; i < eccfrag_len; i++)
-               chip->buffers->ecccode[i] = chip->oob_poi[eccpos[i + start_step * chip->ecc.bytes]];
+               chip->buffers->ecccode[i] = chip->oob_poi[eccpos[i + index]];
 
        p = bufpoi + data_col_addr;
        for (i = 0; i < eccfrag_len ; i += chip->ecc.bytes, p += chip->ecc.size) {
                int stat;
 
-               stat = chip->ecc.correct(mtd, p, &chip->buffers->ecccode[i], &chip->buffers->ecccalc[i]);
-               if (stat == -1)
+               stat = chip->ecc.correct(mtd, p,
+                       &chip->buffers->ecccode[i], &chip->buffers->ecccalc[i]);
+               if (stat < 0)
                        mtd->ecc_stats.failed++;
                else
                        mtd->ecc_stats.corrected += stat;
@@ -1082,7 +1145,7 @@ static int nand_read_page_syndrome(struct mtd_info *mtd, struct nand_chip *chip,
 static uint8_t *nand_transfer_oob(struct nand_chip *chip, uint8_t *oob,
                                  struct mtd_oob_ops *ops, size_t len)
 {
-       switch(ops->mode) {
+       switch (ops->mode) {
 
        case MTD_OOB_PLACE:
        case MTD_OOB_RAW:
@@ -1094,7 +1157,7 @@ static uint8_t *nand_transfer_oob(struct nand_chip *chip, uint8_t *oob,
                uint32_t boffs = 0, roffs = ops->ooboffs;
                size_t bytes = 0;
 
-               for(; free->length && len; free++, len -= bytes) {
+               for (; free->length && len; free++, len -= bytes) {
                        /* Read request not from offset 0 ? */
                        if (unlikely(roffs)) {
                                if (roffs >= free->length) {
@@ -1140,6 +1203,9 @@ static int nand_do_read_ops(struct mtd_info *mtd, loff_t from,
        int ret = 0;
        uint32_t readlen = ops->len;
        uint32_t oobreadlen = ops->ooblen;
+       uint32_t max_oobsize = ops->mode == MTD_OOB_AUTO ?
+               mtd->oobavail : mtd->oobsize;
+
        uint8_t *bufpoi, *oob, *buf;
 
        stats = mtd->ecc_stats;
@@ -1155,7 +1221,7 @@ static int nand_do_read_ops(struct mtd_info *mtd, loff_t from,
        buf = ops->datbuf;
        oob = ops->oobbuf;
 
-       while(1) {
+       while (1) {
                WATCHDOG_RESET();
 
                bytes = min(mtd->writesize - col, readlen);
@@ -1173,18 +1239,20 @@ static int nand_do_read_ops(struct mtd_info *mtd, loff_t from,
                        /* Now read the page into the buffer */
                        if (unlikely(ops->mode == MTD_OOB_RAW))
                                ret = chip->ecc.read_page_raw(mtd, chip,
-                                               bufpoi, page);
+                                                             bufpoi, page);
                        else if (!aligned && NAND_SUBPAGE_READ(chip) && !oob)
-                               ret = chip->ecc.read_subpage(mtd, chip, col, bytes, bufpoi);
+                               ret = chip->ecc.read_subpage(mtd, chip,
+                                                       col, bytes, bufpoi);
                        else
                                ret = chip->ecc.read_page(mtd, chip, bufpoi,
-                                               page);
+                                                         page);
                        if (ret < 0)
                                break;
 
                        /* Transfer not aligned data */
                        if (!aligned) {
-                               if (!NAND_SUBPAGE_READ(chip) && !oob)
+                               if (!NAND_SUBPAGE_READ(chip) && !oob &&
+                                   !(mtd->ecc_stats.failed - stats.failed))
                                        chip->pagebuf = realpage;
                                memcpy(buf, chip->buffers->databuf + col, bytes);
                        }
@@ -1192,18 +1260,14 @@ static int nand_do_read_ops(struct mtd_info *mtd, loff_t from,
                        buf += bytes;
 
                        if (unlikely(oob)) {
-                               /* Raw mode does data:oob:data:oob */
-                               if (ops->mode != MTD_OOB_RAW) {
-                                       int toread = min(oobreadlen,
-                                               chip->ecc.layout->oobavail);
-                                       if (toread) {
-                                               oob = nand_transfer_oob(chip,
-                                                       oob, ops, toread);
-                                               oobreadlen -= toread;
-                                       }
-                               } else
-                                       buf = nand_transfer_oob(chip,
-                                               buf, ops, mtd->oobsize);
+
+                               int toread = min(oobreadlen, max_oobsize);
+
+                               if (toread) {
+                                       oob = nand_transfer_oob(chip,
+                                               oob, ops, toread);
+                                       oobreadlen -= toread;
+                               }
                        }
 
                        if (!(chip->options & NAND_NO_READRDY)) {
@@ -1259,11 +1323,11 @@ static int nand_do_read_ops(struct mtd_info *mtd, loff_t from,
        if (mtd->ecc_stats.failed - stats.failed)
                return -EBADMSG;
 
-       return  mtd->ecc_stats.corrected - stats.corrected ? -EUCLEAN : 0;
+       return  mtd->ecc_stats.corrected - stats.corrected ? -EUCLEAN : 0;
 }
 
 /**
- * nand_read - [MTD Interface] MTD compability function for nand_do_read_ecc
+ * nand_read - [MTD Interface] MTD compatibility function for nand_do_read_ecc
  * @mtd:       MTD device structure
  * @from:      offset to read from
  * @len:       number of bytes to read
@@ -1456,8 +1520,8 @@ static int nand_do_read_oob(struct mtd_info *mtd, loff_t from,
        int len;
        uint8_t *buf = ops->oobbuf;
 
-       MTDDEBUG (MTD_DEBUG_LEVEL3, "nand_read_oob: from = 0x%08Lx, len = %i\n",
-                 (unsigned long long)from, readlen);
+       MTDDEBUG(MTD_DEBUG_LEVEL3, "%s: from = 0x%08Lx, len = %i\n",
+                       __func__, (unsigned long long)from, readlen);
 
        if (ops->mode == MTD_OOB_AUTO)
                len = chip->ecc.layout->oobavail;
@@ -1465,8 +1529,8 @@ static int nand_do_read_oob(struct mtd_info *mtd, loff_t from,
                len = mtd->oobsize;
 
        if (unlikely(ops->ooboffs >= len)) {
-               MTDDEBUG (MTD_DEBUG_LEVEL0, "nand_read_oob: "
-                         "Attempt to start read outside oob\n");
+               MTDDEBUG(MTD_DEBUG_LEVEL0, "%s: Attempt to start read "
+                                       "outside oob\n", __func__);
                return -EINVAL;
        }
 
@@ -1474,8 +1538,8 @@ static int nand_do_read_oob(struct mtd_info *mtd, loff_t from,
        if (unlikely(from >= mtd->size ||
                     ops->ooboffs + readlen > ((mtd->size >> chip->page_shift) -
                                        (from >> chip->page_shift)) * len)) {
-               MTDDEBUG (MTD_DEBUG_LEVEL0, "nand_read_oob: "
-                         "Attempt read beyond end of device\n");
+               MTDDEBUG(MTD_DEBUG_LEVEL0, "%s: Attempt read beyond end "
+                                       "of device\n", __func__);
                return -EINVAL;
        }
 
@@ -1486,7 +1550,7 @@ static int nand_do_read_oob(struct mtd_info *mtd, loff_t from,
        realpage = (int)(from >> chip->page_shift);
        page = realpage & chip->pagemask;
 
-       while(1) {
+       while (1) {
                WATCHDOG_RESET();
                sndcmd = chip->ecc.read_oob(mtd, chip, page, sndcmd);
 
@@ -1550,14 +1614,14 @@ static int nand_read_oob(struct mtd_info *mtd, loff_t from,
 
        /* Do not allow reads past end of device */
        if (ops->datbuf && (from + ops->len) > mtd->size) {
-               MTDDEBUG (MTD_DEBUG_LEVEL0, "nand_read_oob: "
-                         "Attempt read beyond end of device\n");
+               MTDDEBUG(MTD_DEBUG_LEVEL0, "%s: Attempt read "
+                               "beyond end of device\n", __func__);
                return -EINVAL;
        }
 
        nand_get_device(chip, mtd, FL_READING);
 
-       switch(ops->mode) {
+       switch (ops->mode) {
        case MTD_OOB_PLACE:
        case MTD_OOB_AUTO:
        case MTD_OOB_RAW:
@@ -1572,7 +1636,7 @@ static int nand_read_oob(struct mtd_info *mtd, loff_t from,
        else
                ret = nand_do_read_ops(mtd, from, ops);
 
- out:
+out:
        nand_release_device(mtd);
        return ret;
 }
@@ -1601,8 +1665,9 @@ static void nand_write_page_raw(struct mtd_info *mtd, struct nand_chip *chip,
  *
  * We need a special oob layout and handling even when ECC isn't checked.
  */
-static void nand_write_page_raw_syndrome(struct mtd_info *mtd, struct nand_chip *chip,
-                               const uint8_t *buf)
+static void nand_write_page_raw_syndrome(struct mtd_info *mtd,
+                                       struct nand_chip *chip,
+                                       const uint8_t *buf)
 {
        int eccsize = chip->ecc.size;
        int eccbytes = chip->ecc.bytes;
@@ -1789,14 +1854,13 @@ static int nand_write_page(struct mtd_info *mtd, struct nand_chip *chip,
  * nand_fill_oob - [Internal] Transfer client buffer to oob
  * @chip:      nand chip structure
  * @oob:       oob data buffer
+ * @len:       oob data write length
  * @ops:       oob ops structure
  */
-static uint8_t *nand_fill_oob(struct nand_chip *chip, uint8_t *oob,
-                                 struct mtd_oob_ops *ops)
+static uint8_t *nand_fill_oob(struct nand_chip *chip, uint8_t *oob, size_t len,
+                                               struct mtd_oob_ops *ops)
 {
-       size_t len = ops->ooblen;
-
-       switch(ops->mode) {
+       switch (ops->mode) {
 
        case MTD_OOB_PLACE:
        case MTD_OOB_RAW:
@@ -1808,7 +1872,7 @@ static uint8_t *nand_fill_oob(struct nand_chip *chip, uint8_t *oob,
                uint32_t boffs = 0, woffs = ops->ooboffs;
                size_t bytes = 0;
 
-               for(; free->length && len; free++, len -= bytes) {
+               for (; free->length && len; free++, len -= bytes) {
                        /* Write request not from offset 0 ? */
                        if (unlikely(woffs)) {
                                if (woffs >= free->length) {
@@ -1834,7 +1898,7 @@ static uint8_t *nand_fill_oob(struct nand_chip *chip, uint8_t *oob,
        return NULL;
 }
 
-#define NOTALIGNED(x)  (x & (chip->subpagesize - 1)) != 0
+#define NOTALIGNED(x)  ((x & (chip->subpagesize - 1)) != 0)
 
 /**
  * nand_do_write_ops - [Internal] NAND write with ECC
@@ -1850,6 +1914,11 @@ static int nand_do_write_ops(struct mtd_info *mtd, loff_t to,
        int chipnr, realpage, page, blockmask, column;
        struct nand_chip *chip = mtd->priv;
        uint32_t writelen = ops->len;
+
+       uint32_t oobwritelen = ops->ooblen;
+       uint32_t oobmaxlen = ops->mode == MTD_OOB_AUTO ?
+                               mtd->oobavail : mtd->oobsize;
+
        uint8_t *oob = ops->oobbuf;
        uint8_t *buf = ops->datbuf;
        int ret, subpage;
@@ -1886,7 +1955,11 @@ static int nand_do_write_ops(struct mtd_info *mtd, loff_t to,
        if (likely(!oob))
                memset(chip->oob_poi, 0xff, mtd->oobsize);
 
-       while(1) {
+       /* Don't allow multipage oob writes with offset */
+       if (oob && ops->ooboffs && (ops->ooboffs + ops->ooblen > oobmaxlen))
+               return -EINVAL;
+
+       while (1) {
                WATCHDOG_RESET();
 
                int bytes = mtd->writesize;
@@ -1903,8 +1976,11 @@ static int nand_do_write_ops(struct mtd_info *mtd, loff_t to,
                        wbuf = chip->buffers->databuf;
                }
 
-               if (unlikely(oob))
-                       oob = nand_fill_oob(chip, oob, ops);
+               if (unlikely(oob)) {
+                       size_t len = min(oobwritelen, oobmaxlen);
+                       oob = nand_fill_oob(chip, oob, len, ops);
+                       oobwritelen -= len;
+               }
 
                ret = chip->write_page(mtd, chip, wbuf, page, cached,
                                       (ops->mode == MTD_OOB_RAW));
@@ -1985,8 +2061,8 @@ static int nand_do_write_oob(struct mtd_info *mtd, loff_t to,
        int chipnr, page, status, len;
        struct nand_chip *chip = mtd->priv;
 
-       MTDDEBUG (MTD_DEBUG_LEVEL3, "nand_write_oob: to = 0x%08x, len = %i\n",
-                 (unsigned int)to, (int)ops->ooblen);
+       MTDDEBUG(MTD_DEBUG_LEVEL3, "%s: to = 0x%08x, len = %i\n",
+                        __func__, (unsigned int)to, (int)ops->ooblen);
 
        if (ops->mode == MTD_OOB_AUTO)
                len = chip->ecc.layout->oobavail;
@@ -1995,24 +2071,24 @@ static int nand_do_write_oob(struct mtd_info *mtd, loff_t to,
 
        /* Do not allow write past end of page */
        if ((ops->ooboffs + ops->ooblen) > len) {
-               MTDDEBUG (MTD_DEBUG_LEVEL0, "nand_write_oob: "
-                         "Attempt to write past end of page\n");
+               MTDDEBUG(MTD_DEBUG_LEVEL0, "%s: Attempt to write "
+                               "past end of page\n", __func__);
                return -EINVAL;
        }
 
        if (unlikely(ops->ooboffs >= len)) {
-               MTDDEBUG (MTD_DEBUG_LEVEL0, "nand_read_oob: "
-                         "Attempt to start write outside oob\n");
+               MTDDEBUG(MTD_DEBUG_LEVEL0, "%s: Attempt to start "
+                               "write outside oob\n", __func__);
                return -EINVAL;
        }
 
-       /* Do not allow reads past end of device */
+       /* Do not allow write past end of device */
        if (unlikely(to >= mtd->size ||
                     ops->ooboffs + ops->ooblen >
                        ((mtd->size >> chip->page_shift) -
                         (to >> chip->page_shift)) * len)) {
-               MTDDEBUG (MTD_DEBUG_LEVEL0, "nand_read_oob: "
-                         "Attempt write beyond end of device\n");
+               MTDDEBUG(MTD_DEBUG_LEVEL0, "%s: Attempt write beyond "
+                               "end of device\n", __func__);
                return -EINVAL;
        }
 
@@ -2039,7 +2115,7 @@ static int nand_do_write_oob(struct mtd_info *mtd, loff_t to,
                chip->pagebuf = -1;
 
        memset(chip->oob_poi, 0xff, mtd->oobsize);
-       nand_fill_oob(chip, ops->oobbuf, ops);
+       nand_fill_oob(chip, ops->oobbuf, ops->ooblen, ops);
        status = chip->ecc.write_oob(mtd, chip, page & chip->pagemask);
        memset(chip->oob_poi, 0xff, mtd->oobsize);
 
@@ -2067,14 +2143,14 @@ static int nand_write_oob(struct mtd_info *mtd, loff_t to,
 
        /* Do not allow writes past end of device */
        if (ops->datbuf && (to + ops->len) > mtd->size) {
-               MTDDEBUG (MTD_DEBUG_LEVEL0, "nand_read_oob: "
-                         "Attempt read beyond end of device\n");
+               MTDDEBUG(MTD_DEBUG_LEVEL0, "%s: Attempt write beyond "
+                               "end of device\n", __func__);
                return -EINVAL;
        }
 
        nand_get_device(chip, mtd, FL_WRITING);
 
-       switch(ops->mode) {
+       switch (ops->mode) {
        case MTD_OOB_PLACE:
        case MTD_OOB_AUTO:
        case MTD_OOB_RAW:
@@ -2089,7 +2165,7 @@ static int nand_write_oob(struct mtd_info *mtd, loff_t to,
        else
                ret = nand_do_write_ops(mtd, to, ops);
 
- out:
+out:
        nand_release_device(mtd);
        return ret;
 }
@@ -2158,31 +2234,14 @@ int nand_erase_nand(struct mtd_info *mtd, struct erase_info *instr,
        unsigned int bbt_masked_page = 0xffffffff;
        loff_t len;
 
-       MTDDEBUG(MTD_DEBUG_LEVEL3, "nand_erase: start = 0x%012llx, "
-                "len = %llu\n", (unsigned long long) instr->addr,
-                (unsigned long long) instr->len);
-
-       /* Start address must align on block boundary */
-       if (instr->addr & ((1 << chip->phys_erase_shift) - 1)) {
-               MTDDEBUG (MTD_DEBUG_LEVEL0, "nand_erase: Unaligned address\n");
-               return -EINVAL;
-       }
+       MTDDEBUG(MTD_DEBUG_LEVEL3, "%s: start = 0x%012llx, len = %llu\n",
+                               __func__, (unsigned long long)instr->addr,
+                               (unsigned long long)instr->len);
 
-       /* Length must align on block boundary */
-       if (instr->len & ((1 << chip->phys_erase_shift) - 1)) {
-               MTDDEBUG (MTD_DEBUG_LEVEL0,
-                         "nand_erase: Length not block aligned\n");
+       if (check_offs_len(mtd, instr->addr, instr->len))
                return -EINVAL;
-       }
 
-       /* Do not allow erase past end of device */
-       if ((instr->len + instr->addr) > mtd->size) {
-               MTDDEBUG (MTD_DEBUG_LEVEL0,
-                         "nand_erase: Erase past end of device\n");
-               return -EINVAL;
-       }
-
-       instr->fail_addr = 0xffffffff;
+       instr->fail_addr = MTD_FAIL_ADDR_UNKNOWN;
 
        /* Grab the lock and see if the device is available */
        nand_get_device(chip, mtd, FL_ERASING);
@@ -2199,8 +2258,8 @@ int nand_erase_nand(struct mtd_info *mtd, struct erase_info *instr,
 
        /* Check, if it is write protected */
        if (nand_check_wp(mtd)) {
-               MTDDEBUG (MTD_DEBUG_LEVEL0,
-                         "nand_erase: Device is write protected!!!\n");
+               MTDDEBUG(MTD_DEBUG_LEVEL0, "%s: Device is write protected!!!\n",
+                                       __func__);
                instr->state = MTD_ERASE_FAILED;
                goto erase_exit;
        }
@@ -2226,8 +2285,8 @@ int nand_erase_nand(struct mtd_info *mtd, struct erase_info *instr,
                 */
                if (!instr->scrub && nand_block_checkbad(mtd, ((loff_t) page) <<
                                        chip->page_shift, 0, allowbbt)) {
-                       printk(KERN_WARNING "nand_erase: attempt to erase a "
-                              "bad block at page 0x%08x\n", page);
+                       printk(KERN_WARNING "%s: attempt to erase a bad block "
+                                       "at page 0x%08x\n", __func__, page);
                        instr->state = MTD_ERASE_FAILED;
                        goto erase_exit;
                }
@@ -2254,10 +2313,11 @@ int nand_erase_nand(struct mtd_info *mtd, struct erase_info *instr,
 
                /* See if block erase succeeded */
                if (status & NAND_STATUS_FAIL) {
-                       MTDDEBUG (MTD_DEBUG_LEVEL0, "nand_erase: "
-                                 "Failed erase, page 0x%08x\n", page);
+                       MTDDEBUG(MTD_DEBUG_LEVEL0, "%s: Failed erase, "
+                                       "page 0x%08x\n", __func__, page);
                        instr->state = MTD_ERASE_FAILED;
-                       instr->fail_addr = ((loff_t)page << chip->page_shift);
+                       instr->fail_addr =
+                               ((loff_t)page << chip->page_shift);
                        goto erase_exit;
                }
 
@@ -2292,7 +2352,7 @@ int nand_erase_nand(struct mtd_info *mtd, struct erase_info *instr,
        }
        instr->state = MTD_ERASE_DONE;
 
- erase_exit:
+erase_exit:
 
        ret = instr->state == MTD_ERASE_DONE ? 0 : -EIO;
 
@@ -2314,9 +2374,9 @@ int nand_erase_nand(struct mtd_info *mtd, struct erase_info *instr,
                if (!rewrite_bbt[chipnr])
                        continue;
                /* update the BBT for chip */
-               MTDDEBUG (MTD_DEBUG_LEVEL0, "nand_erase_nand: nand_update_bbt "
-                         "(%d:0x%0llx 0x%0x)\n", chipnr, rewrite_bbt[chipnr],
-                         chip->bbt_td->pages[chipnr]);
+               MTDDEBUG(MTD_DEBUG_LEVEL0, "%s: nand_update_bbt "
+                       "(%d:0x%0llx 0x%0x)\n", __func__, chipnr,
+                       rewrite_bbt[chipnr], chip->bbt_td->pages[chipnr]);
                nand_update_bbt(mtd, rewrite_bbt[chipnr]);
        }
 
@@ -2334,7 +2394,7 @@ static void nand_sync(struct mtd_info *mtd)
 {
        struct nand_chip *chip = mtd->priv;
 
-       MTDDEBUG (MTD_DEBUG_LEVEL3, "nand_sync: called\n");
+       MTDDEBUG(MTD_DEBUG_LEVEL3, "%s: called\n", __func__);
 
        /* Grab the lock and see if the device is available */
        nand_get_device(chip, mtd, FL_SYNCING);
@@ -2366,7 +2426,8 @@ static int nand_block_markbad(struct mtd_info *mtd, loff_t ofs)
        struct nand_chip *chip = mtd->priv;
        int ret;
 
-       if ((ret = nand_block_isbad(mtd, ofs))) {
+       ret = nand_block_isbad(mtd, ofs);
+       if (ret) {
                /* If it was bad already, return success and do nothing. */
                if (ret > 0)
                        return 0;
@@ -2416,10 +2477,29 @@ static void nand_set_defaults(struct nand_chip *chip, int busw)
 }
 
 #ifdef CONFIG_SYS_NAND_ONFI_DETECTION
+/*
+ * sanitize ONFI strings so we can safely print them
+ */
+static void sanitize_string(char *s, size_t len)
+{
+       ssize_t i;
+
+       /* null terminate */
+       s[len - 1] = 0;
+
+       /* remove non printable chars */
+       for (i = 0; i < len - 1; i++) {
+               if (s[i] < ' ' || s[i] > 127)
+                       s[i] = '?';
+       }
+
+       /* remove trailing spaces */
+       strim(s);
+}
+
 static u16 onfi_crc16(u16 crc, u8 const *p, size_t len)
 {
        int i;
-
        while (len--) {
                crc ^= *p++ << 8;
                for (i = 0; i < 8; i++)
@@ -2432,14 +2512,14 @@ static u16 onfi_crc16(u16 crc, u8 const *p, size_t len)
 /*
  * Check if the NAND chip is ONFI compliant, returns 1 if it is, 0 otherwise
  */
-static int nand_flash_detect_onfi(struct mtd_info *mtd,
-                                       struct nand_chip *chip,
+static int nand_flash_detect_onfi(struct mtd_info *mtd, struct nand_chip *chip,
                                        int *busw)
 {
        struct nand_onfi_params *p = &chip->onfi_params;
        int i;
        int val;
 
+       /* try ONFI for unknow chip or LP */
        chip->cmdfunc(mtd, NAND_CMD_READID, 0x20, -1);
        if (chip->read_byte(mtd) != 'O' || chip->read_byte(mtd) != 'N' ||
                chip->read_byte(mtd) != 'F' || chip->read_byte(mtd) != 'I')
@@ -2450,7 +2530,7 @@ static int nand_flash_detect_onfi(struct mtd_info *mtd,
        for (i = 0; i < 3; i++) {
                chip->read_buf(mtd, (uint8_t *)p, sizeof(*p));
                if (onfi_crc16(ONFI_CRC_BASE, (uint8_t *)p, 254) ==
-                                               le16_to_cpu(p->crc)) {
+                               le16_to_cpu(p->crc)) {
                        printk(KERN_INFO "ONFI param page %d valid\n", i);
                        break;
                }
@@ -2475,14 +2555,15 @@ static int nand_flash_detect_onfi(struct mtd_info *mtd,
                chip->onfi_version = 0;
 
        if (!chip->onfi_version) {
-               printk(KERN_INFO "%s: unsupported ONFI "
-                                       "version: %d\n", __func__, val);
+               printk(KERN_INFO "%s: unsupported ONFI version: %d\n",
+                                                               __func__, val);
                return 0;
        }
 
+       sanitize_string(p->manufacturer, sizeof(p->manufacturer));
+       sanitize_string(p->model, sizeof(p->model));
        if (!mtd->name)
                mtd->name = p->model;
-
        mtd->writesize = le32_to_cpu(p->byte_per_page);
        mtd->erasesize = le32_to_cpu(p->pages_per_block) * mtd->writesize;
        mtd->oobsize = le16_to_cpu(p->spare_bytes_per_page);
@@ -2491,6 +2572,10 @@ static int nand_flash_detect_onfi(struct mtd_info *mtd,
        if (le16_to_cpu(p->features) & 1)
                *busw = NAND_BUSWIDTH_16;
 
+       chip->options &= ~NAND_CHIPOPTIONS_MSK;
+       chip->options |= (NAND_NO_READRDY |
+                       NAND_NO_AUTOINCR) & NAND_CHIPOPTIONS_MSK;
+
        return 1;
 }
 #else
@@ -2502,41 +2587,6 @@ static inline int nand_flash_detect_onfi(struct mtd_info *mtd,
 }
 #endif
 
-static void nand_flash_detect_non_onfi(struct mtd_info *mtd,
-                                       struct nand_chip *chip,
-                                       const struct nand_flash_dev *type,
-                                       int *busw)
-{
-       /* Newer devices have all the information in additional id bytes */
-       if (!type->pagesize) {
-               int extid;
-               /* The 3rd id byte holds MLC / multichip data */
-               chip->cellinfo = chip->read_byte(mtd);
-               /* The 4th id byte is the important one */
-               extid = chip->read_byte(mtd);
-               /* Calc pagesize */
-               mtd->writesize = 1024 << (extid & 0x3);
-               extid >>= 2;
-               /* Calc oobsize */
-               mtd->oobsize = (8 << (extid & 0x01)) * (mtd->writesize >> 9);
-               extid >>= 2;
-               /* Calc blocksize. Blocksize is multiples of 64KiB */
-               mtd->erasesize = (64 * 1024) << (extid & 0x03);
-               extid >>= 2;
-               /* Get buswidth information */
-               *busw = (extid & 0x01) ? NAND_BUSWIDTH_16 : 0;
-
-       } else {
-               /*
-                * Old devices have chip data hardcoded in the device id table
-                */
-               mtd->erasesize = type->erasesize;
-               mtd->writesize = type->pagesize;
-               mtd->oobsize = mtd->writesize / 32;
-               *busw = type->options & NAND_BUSWIDTH_16;
-       }
-}
-
 /*
  * Get the flash and manufacturer id and lookup if the type is supported
  */
@@ -2546,8 +2596,9 @@ static const struct nand_flash_dev *nand_get_flash_type(struct mtd_info *mtd,
                                                  int *maf_id, int *dev_id,
                                                  const struct nand_flash_dev *type)
 {
-       int ret, maf_idx;
-       int tmp_id, tmp_manf;
+       int i, maf_idx;
+       u8 id_data[8];
+       int ret;
 
        /* Select the device */
        chip->select_chip(mtd, 0);
@@ -2573,15 +2624,13 @@ static const struct nand_flash_dev *nand_get_flash_type(struct mtd_info *mtd,
 
        chip->cmdfunc(mtd, NAND_CMD_READID, 0x00, -1);
 
-       /* Read manufacturer and device IDs */
+       for (i = 0; i < 2; i++)
+               id_data[i] = chip->read_byte(mtd);
 
-       tmp_manf = chip->read_byte(mtd);
-       tmp_id = chip->read_byte(mtd);
-
-       if (tmp_manf != *maf_id || tmp_id != *dev_id) {
+       if (id_data[0] != *maf_id || id_data[1] != *dev_id) {
                printk(KERN_INFO "%s: second ID read did not match "
                       "%02x,%02x against %02x,%02x\n", __func__,
-                      *maf_id, *dev_id, tmp_manf, tmp_id);
+                      *maf_id, *dev_id, id_data[0], id_data[1]);
                return ERR_PTR(-ENODEV);
        }
 
@@ -2592,30 +2641,121 @@ static const struct nand_flash_dev *nand_get_flash_type(struct mtd_info *mtd,
                if (*dev_id == type->id)
                        break;
 
-       if (!type->name) {
-               /* supress warning if there is no nand */
-               if (*maf_id != 0x00 && *maf_id != 0xff &&
-                   *dev_id  != 0x00 && *dev_id  != 0xff)
-                       printk(KERN_INFO "%s: unknown NAND device: "
-                               "Manufacturer ID: 0x%02x, Chip ID: 0x%02x\n",
-                               __func__, *maf_id, *dev_id);
-               return ERR_PTR(-ENODEV);
+       chip->onfi_version = 0;
+       if (!type->name || !type->pagesize) {
+               /* Check is chip is ONFI compliant */
+               ret = nand_flash_detect_onfi(mtd, chip, &busw);
+               if (ret)
+                       goto ident_done;
        }
 
+       chip->cmdfunc(mtd, NAND_CMD_READID, 0x00, -1);
+
+       /* Read entire ID string */
+
+       for (i = 0; i < 8; i++)
+               id_data[i] = chip->read_byte(mtd);
+
+       if (!type->name)
+               return ERR_PTR(-ENODEV);
+
        if (!mtd->name)
                mtd->name = type->name;
 
        chip->chipsize = (uint64_t)type->chipsize << 20;
-       chip->onfi_version = 0;
 
-       ret = nand_flash_detect_onfi(mtd, chip, &busw);
-       if (!ret)
-               nand_flash_detect_non_onfi(mtd, chip, type, &busw);
+       if (!type->pagesize && chip->init_size) {
+               /* set the pagesize, oobsize, erasesize by the driver*/
+               busw = chip->init_size(mtd, chip, id_data);
+       } else if (!type->pagesize) {
+               int extid;
+               /* The 3rd id byte holds MLC / multichip data */
+               chip->cellinfo = id_data[2];
+               /* The 4th id byte is the important one */
+               extid = id_data[3];
+
+               /*
+                * Field definitions are in the following datasheets:
+                * Old style (4,5 byte ID): Samsung K9GAG08U0M (p.32)
+                * New style   (6 byte ID): Samsung K9GBG08U0M (p.40)
+                *
+                * Check for wraparound + Samsung ID + nonzero 6th byte
+                * to decide what to do.
+                */
+               if (id_data[0] == id_data[6] && id_data[1] == id_data[7] &&
+                               id_data[0] == NAND_MFR_SAMSUNG &&
+                               (chip->cellinfo & NAND_CI_CELLTYPE_MSK) &&
+                               id_data[5] != 0x00) {
+                       /* Calc pagesize */
+                       mtd->writesize = 2048 << (extid & 0x03);
+                       extid >>= 2;
+                       /* Calc oobsize */
+                       switch (extid & 0x03) {
+                       case 1:
+                               mtd->oobsize = 128;
+                               break;
+                       case 2:
+                               mtd->oobsize = 218;
+                               break;
+                       case 3:
+                               mtd->oobsize = 400;
+                               break;
+                       default:
+                               mtd->oobsize = 436;
+                               break;
+                       }
+                       extid >>= 2;
+                       /* Calc blocksize */
+                       mtd->erasesize = (128 * 1024) <<
+                               (((extid >> 1) & 0x04) | (extid & 0x03));
+                       busw = 0;
+               } else {
+                       /* Calc pagesize */
+                       mtd->writesize = 1024 << (extid & 0x03);
+                       extid >>= 2;
+                       /* Calc oobsize */
+                       mtd->oobsize = (8 << (extid & 0x01)) *
+                               (mtd->writesize >> 9);
+                       extid >>= 2;
+                       /* Calc blocksize. Blocksize is multiples of 64KiB */
+                       mtd->erasesize = (64 * 1024) << (extid & 0x03);
+                       extid >>= 2;
+                       /* Get buswidth information */
+                       busw = (extid & 0x01) ? NAND_BUSWIDTH_16 : 0;
+               }
+       } else {
+               /*
+                * Old devices have chip data hardcoded in the device id table
+                */
+               mtd->erasesize = type->erasesize;
+               mtd->writesize = type->pagesize;
+               mtd->oobsize = mtd->writesize / 32;
+               busw = type->options & NAND_BUSWIDTH_16;
 
+               /*
+                * Check for Spansion/AMD ID + repeating 5th, 6th byte since
+                * some Spansion chips have erasesize that conflicts with size
+                * listed in nand_ids table
+                * Data sheet (5 byte ID): Spansion S30ML-P ORNAND (p.39)
+                */
+               if (*maf_id == NAND_MFR_AMD && id_data[4] != 0x00 &&
+                               id_data[5] == 0x00 && id_data[6] == 0x00 &&
+                               id_data[7] == 0x00 && mtd->writesize == 512) {
+                       mtd->erasesize = 128 * 1024;
+                       mtd->erasesize <<= ((id_data[3] & 0x03) << 1);
+               }
+       }
        /* Get chip options, preserve non chip based options */
        chip->options &= ~NAND_CHIPOPTIONS_MSK;
        chip->options |= type->options & NAND_CHIPOPTIONS_MSK;
 
+       /* Check if chip is a not a samsung device. Do not clear the
+        * options for chips which are not having an extended id.
+        */
+       if (*maf_id != NAND_MFR_SAMSUNG && !type->pagesize)
+               chip->options &= ~NAND_SAMSUNG_LP_OPTIONS;
+ident_done:
+
        /*
         * Set chip as a default. Board drivers can override it, if necessary
         */
@@ -2650,18 +2790,48 @@ static const struct nand_flash_dev *nand_get_flash_type(struct mtd_info *mtd,
                ffs(mtd->erasesize) - 1;
        if (chip->chipsize & 0xffffffff)
                chip->chip_shift = ffs((unsigned)chip->chipsize) - 1;
-       else
-               chip->chip_shift = ffs((unsigned)(chip->chipsize >> 32)) + 31;
+       else {
+               chip->chip_shift = ffs((unsigned)(chip->chipsize >> 32));
+               chip->chip_shift += 32 - 1;
+       }
+
+       chip->badblockbits = 8;
 
        /* Set the bad block position */
-       chip->badblockpos = mtd->writesize > 512 ?
-               NAND_LARGE_BADBLOCK_POS : NAND_SMALL_BADBLOCK_POS;
+       if (mtd->writesize > 512 || (busw & NAND_BUSWIDTH_16))
+               chip->badblockpos = NAND_LARGE_BADBLOCK_POS;
+       else
+               chip->badblockpos = NAND_SMALL_BADBLOCK_POS;
 
-       /* Check if chip is a not a samsung device. Do not clear the
-        * options for chips which are not having an extended id.
+       /*
+        * Bad block marker is stored in the last page of each block
+        * on Samsung and Hynix MLC devices; stored in first two pages
+        * of each block on Micron devices with 2KiB pages and on
+        * SLC Samsung, Hynix, Toshiba and AMD/Spansion. All others scan
+        * only the first page.
         */
-       if (*maf_id != NAND_MFR_SAMSUNG && !type->pagesize)
-               chip->options &= ~NAND_SAMSUNG_LP_OPTIONS;
+       if ((chip->cellinfo & NAND_CI_CELLTYPE_MSK) &&
+                       (*maf_id == NAND_MFR_SAMSUNG ||
+                        *maf_id == NAND_MFR_HYNIX))
+               chip->options |= NAND_BBT_SCANLASTPAGE;
+       else if ((!(chip->cellinfo & NAND_CI_CELLTYPE_MSK) &&
+                               (*maf_id == NAND_MFR_SAMSUNG ||
+                                *maf_id == NAND_MFR_HYNIX ||
+                                *maf_id == NAND_MFR_TOSHIBA ||
+                                *maf_id == NAND_MFR_AMD)) ||
+                       (mtd->writesize == 2048 &&
+                        *maf_id == NAND_MFR_MICRON))
+               chip->options |= NAND_BBT_SCAN2NDPAGE;
+
+       /*
+        * Numonyx/ST 2K pages, x8 bus use BOTH byte 1 and 6
+        */
+       if (!(busw & NAND_BUSWIDTH_16) &&
+                       *maf_id == NAND_MFR_STMICRO &&
+                       mtd->writesize == 2048) {
+               chip->options |= NAND_BBT_SCANBYTE1AND6;
+               chip->badblockpos = 0;
+       }
 
        /* Check for AND chips with 4 page planes */
        if (chip->options & NAND_4PAGE_ARRAY)
@@ -2673,9 +2843,15 @@ static const struct nand_flash_dev *nand_get_flash_type(struct mtd_info *mtd,
        if (mtd->writesize > 512 && chip->cmdfunc == nand_command)
                chip->cmdfunc = nand_command_lp;
 
+       /* TODO onfi flash name */
        MTDDEBUG (MTD_DEBUG_LEVEL0, "NAND device: Manufacturer ID:"
-                 " 0x%02x, Chip ID: 0x%02x (%s %s)\n", *maf_id, *dev_id,
-                 nand_manuf_ids[maf_idx].name, type->name);
+               " 0x%02x, Chip ID: 0x%02x (%s %s)\n", *maf_id, *dev_id,
+               nand_manuf_ids[maf_idx].name,
+#ifdef CONFIG_SYS_NAND_ONFI_DETECTION
+               chip->onfi_version ? chip->onfi_params.model : type->name);
+#else
+               type->name);
+#endif
 
        return type;
 }
@@ -2704,7 +2880,8 @@ int nand_scan_ident(struct mtd_info *mtd, int maxchips,
        nand_set_defaults(chip, busw);
 
        /* Read the flash type */
-       type = nand_get_flash_type(mtd, chip, busw, &nand_maf_id, &nand_dev_id, table);
+       type = nand_get_flash_type(mtd, chip, busw,
+                               &nand_maf_id, &nand_dev_id, table);
 
        if (IS_ERR(type)) {
 #ifndef CONFIG_SYS_NAND_QUIET_TEST
@@ -2763,7 +2940,7 @@ int nand_scan_tail(struct mtd_info *mtd)
        /*
         * If no default placement scheme is given, select an appropriate one
         */
-       if (!chip->ecc.layout) {
+       if (!chip->ecc.layout && (chip->ecc.mode != NAND_ECC_SOFT_BCH)) {
                switch (mtd->oobsize) {
                case 8:
                        chip->ecc.layout = &nand_oob_8;
@@ -2796,7 +2973,7 @@ int nand_scan_tail(struct mtd_info *mtd)
                /* Similar to NAND_ECC_HW, but a separate read_page handle */
                if (!chip->ecc.calculate || !chip->ecc.correct ||
                     !chip->ecc.hwctl) {
-                       printk(KERN_WARNING "No ECC functions supplied, "
+                       printk(KERN_WARNING "No ECC functions supplied; "
                               "Hardware ECC not possible\n");
                        BUG();
                }
@@ -2825,7 +3002,7 @@ int nand_scan_tail(struct mtd_info *mtd)
                     chip->ecc.read_page == nand_read_page_hwecc ||
                     !chip->ecc.write_page ||
                     chip->ecc.write_page == nand_write_page_hwecc)) {
-                       printk(KERN_WARNING "No ECC functions supplied, "
+                       printk(KERN_WARNING "No ECC functions supplied; "
                               "Hardware ECC not possible\n");
                        BUG();
                }
@@ -2851,6 +3028,10 @@ int nand_scan_tail(struct mtd_info *mtd)
                chip->ecc.mode = NAND_ECC_SOFT;
 
        case NAND_ECC_SOFT:
+               if (!mtd_nand_has_ecc_soft()) {
+                       printk(KERN_WARNING "CONFIG_MTD_ECC_SOFT not enabled\n");
+                       return -EINVAL;
+               }
                chip->ecc.calculate = nand_calculate_ecc;
                chip->ecc.correct = nand_correct_data;
                chip->ecc.read_page = nand_read_page_swecc;
@@ -2860,10 +3041,44 @@ int nand_scan_tail(struct mtd_info *mtd)
                chip->ecc.write_page_raw = nand_write_page_raw;
                chip->ecc.read_oob = nand_read_oob_std;
                chip->ecc.write_oob = nand_write_oob_std;
-               chip->ecc.size = 256;
+               if (!chip->ecc.size)
+                       chip->ecc.size = 256;
                chip->ecc.bytes = 3;
                break;
 
+       case NAND_ECC_SOFT_BCH:
+               if (!mtd_nand_has_bch()) {
+                       printk(KERN_WARNING "CONFIG_MTD_ECC_BCH not enabled\n");
+                       return -EINVAL;
+               }
+               chip->ecc.calculate = nand_bch_calculate_ecc;
+               chip->ecc.correct = nand_bch_correct_data;
+               chip->ecc.read_page = nand_read_page_swecc;
+               chip->ecc.read_subpage = nand_read_subpage;
+               chip->ecc.write_page = nand_write_page_swecc;
+               chip->ecc.read_page_raw = nand_read_page_raw;
+               chip->ecc.write_page_raw = nand_write_page_raw;
+               chip->ecc.read_oob = nand_read_oob_std;
+               chip->ecc.write_oob = nand_write_oob_std;
+               /*
+                * Board driver should supply ecc.size and ecc.bytes values to
+                * select how many bits are correctable; see nand_bch_init()
+                * for details.
+                * Otherwise, default to 4 bits for large page devices
+                */
+               if (!chip->ecc.size && (mtd->oobsize >= 64)) {
+                       chip->ecc.size = 512;
+                       chip->ecc.bytes = 7;
+               }
+               chip->ecc.priv = nand_bch_init(mtd,
+                                              chip->ecc.size,
+                                              chip->ecc.bytes,
+                                              &chip->ecc.layout);
+               if (!chip->ecc.priv)
+                       printk(KERN_WARNING "BCH ECC initialization failed!\n");
+
+               break;
+
        case NAND_ECC_NONE:
                printk(KERN_WARNING "NAND_ECC_NONE selected by board driver. "
                       "This is not recommended !!\n");
@@ -2899,7 +3114,7 @@ int nand_scan_tail(struct mtd_info *mtd)
         * mode
         */
        chip->ecc.steps = mtd->writesize / chip->ecc.size;
-       if(chip->ecc.steps * chip->ecc.size != mtd->writesize) {
+       if (chip->ecc.steps * chip->ecc.size != mtd->writesize) {
                printk(KERN_WARNING "Invalid ecc parameters\n");
                BUG();
        }
@@ -2911,7 +3126,7 @@ int nand_scan_tail(struct mtd_info *mtd)
         */
        if (!(chip->options & NAND_NO_SUBPAGE_WRITE) &&
            !(chip->cellinfo & NAND_CI_CELLTYPE_MSK)) {
-               switch(chip->ecc.steps) {
+               switch (chip->ecc.steps) {
                case 2:
                        mtd->subpage_sft = 1;
                        break;
@@ -2935,7 +3150,8 @@ int nand_scan_tail(struct mtd_info *mtd)
 
        /* Fill in remaining MTD driver data */
        mtd->type = MTD_NANDFLASH;
-       mtd->flags = MTD_CAP_NANDFLASH;
+       mtd->flags = (chip->options & NAND_ROM) ? MTD_CAP_ROM :
+                                               MTD_CAP_NANDFLASH;
        mtd->erase = nand_erase;
        mtd->point = NULL;
        mtd->unpoint = NULL;
@@ -2954,9 +3170,10 @@ int nand_scan_tail(struct mtd_info *mtd)
 
        /* Check, if we should skip the bad block table scan */
        if (chip->options & NAND_SKIP_BBTSCAN)
-               chip->options |= NAND_BBT_SCANNED;
+               return 0;
 
-       return 0;
+       /* Build bad block table */
+       return chip->scan_bbt(mtd);
 }
 
 /**
@@ -2989,6 +3206,9 @@ void nand_release(struct mtd_info *mtd)
 {
        struct nand_chip *chip = mtd->priv;
 
+       if (chip->ecc.mode == NAND_ECC_SOFT_BCH)
+               nand_bch_free((struct nand_bch_control *)chip->ecc.priv);
+
 #ifdef CONFIG_MTD_PARTITIONS
        /* Deregister partitions */
        del_mtd_partitions(mtd);
@@ -2998,4 +3218,9 @@ void nand_release(struct mtd_info *mtd)
        kfree(chip->bbt);
        if (!(chip->options & NAND_OWN_BUFFERS))
                kfree(chip->buffers);
+
+       /* Free bad block descriptor memory */
+       if (chip->badblock_pattern && chip->badblock_pattern->options
+                       & NAND_BBT_DYNAMICSTRUCT)
+               kfree(chip->badblock_pattern);
 }
index ded652be345d8059bfbc7c2edaf28a2dc4809bfe..2b730e09c97ade4de292c4c0bc9e3b30f026cc7a 100644 (file)
  * Description:
  *
  * When nand_scan_bbt is called, then it tries to find the bad block table
- * depending on the options in the bbt descriptor(s). If a bbt is found
- * then the contents are read and the memory based bbt is created. If a
- * mirrored bbt is selected then the mirror is searched too and the
- * versions are compared. If the mirror has a greater version number
- * than the mirror bbt is used to build the memory based bbt.
+ * depending on the options in the BBT descriptor(s). If no flash based BBT
+ * (NAND_USE_FLASH_BBT) is specified then the device is scanned for factory
+ * marked good / bad blocks. This information is used to create a memory BBT.
+ * Once a new bad block is discovered then the "factory" information is updated
+ * on the device.
+ * If a flash based BBT is specified then the function first tries to find the
+ * BBT on flash. If a BBT is found then the contents are read and the memory
+ * based BBT is created. If a mirrored BBT is selected then the mirror is
+ * searched too and the versions are compared. If the mirror has a greater
+ * version number than the mirror BBT is used to build the memory based BBT.
  * If the tables are not versioned, then we "or" the bad block information.
- * If one of the bbt's is out of date or does not exist it is (re)created.
- * If no bbt exists at all then the device is scanned for factory marked
+ * If one of the BBTs is out of date or does not exist it is (re)created.
+ * If no BBT exists at all then the device is scanned for factory marked
  * good / bad blocks and the bad block tables are created.
  *
- * For manufacturer created bbts like the one found on M-SYS DOC devices
- * the bbt is searched and read but never created
+ * For manufacturer created BBTs like the one found on M-SYS DOC devices
+ * the BBT is searched and read but never created
  *
- * The autogenerated bad block table is located in the last good blocks
+ * The auto generated bad block table is located in the last good blocks
  * of the device. The table is mirrored, so it can be updated eventually.
- * The table is marked in the oob area with an ident pattern and a version
- * number which indicates which of both tables is more up to date.
+ * The table is marked in the OOB area with an ident pattern and a version
+ * number which indicates which of both tables is more up to date. If the NAND
+ * controller needs the complete OOB area for the ECC information then the
+ * option NAND_USE_FLASH_BBT_NO_OOB should be used: it moves the ident pattern
+ * and the version byte into the data area and the OOB area will remain
+ * untouched.
  *
  * The table uses 2 bits per block
- * 11b:        block is good
- * 00b:        block is factory marked bad
+ * 11b:                block is good
+ * 00b:                block is factory marked bad
  * 01b, 10b:   block is marked bad due to wear
  *
  * The memory bad block table uses the following scheme:
 #include <linux/mtd/compat.h>
 #include <linux/mtd/mtd.h>
 #include <linux/mtd/nand.h>
+#include <linux/mtd/nand_ecc.h>
+#include <linux/bitops.h>
 
 #include <asm/errno.h>
 
+static int check_pattern_no_oob(uint8_t *buf, struct nand_bbt_descr *td)
+{
+       int ret;
+
+       ret = memcmp(buf, td->pattern, td->len);
+       if (!ret)
+               return ret;
+       return -1;
+}
+
 /**
  * check_pattern - [GENERIC] check if a pattern is in the buffer
  * @buf:       the buffer to search
@@ -76,6 +97,9 @@ static int check_pattern(uint8_t *buf, int len, int paglen, struct nand_bbt_desc
        int i, end = 0;
        uint8_t *p = buf;
 
+       if (td->options & NAND_BBT_NO_OOB)
+               return check_pattern_no_oob(buf, td);
+
        end = paglen + td->offs;
        if (td->options & NAND_BBT_SCANEMPTY) {
                for (i = 0; i < end; i++) {
@@ -91,6 +115,28 @@ static int check_pattern(uint8_t *buf, int len, int paglen, struct nand_bbt_desc
                        return -1;
        }
 
+       /* Check both positions 1 and 6 for pattern? */
+       if (td->options & NAND_BBT_SCANBYTE1AND6) {
+               if (td->options & NAND_BBT_SCANEMPTY) {
+                       p += td->len;
+                       end += NAND_SMALL_BADBLOCK_POS - td->offs;
+                       /* Check region between positions 1 and 6 */
+                       for (i = 0; i < NAND_SMALL_BADBLOCK_POS - td->offs - td->len;
+                                       i++) {
+                               if (*p++ != 0xff)
+                                       return -1;
+                       }
+               }
+               else {
+                       p += NAND_SMALL_BADBLOCK_POS - td->offs;
+               }
+               /* Compare the pattern */
+               for (i = 0; i < td->len; i++) {
+                       if (p[i] != td->pattern[i])
+                               return -1;
+               }
+       }
+
        if (td->options & NAND_BBT_SCANEMPTY) {
                p += td->len;
                end += td->len;
@@ -122,36 +168,74 @@ static int check_short_pattern(uint8_t *buf, struct nand_bbt_descr *td)
                if (p[td->offs + i] != td->pattern[i])
                        return -1;
        }
+       /* Need to check location 1 AND 6? */
+       if (td->options & NAND_BBT_SCANBYTE1AND6) {
+               for (i = 0; i < td->len; i++) {
+                       if (p[NAND_SMALL_BADBLOCK_POS + i] != td->pattern[i])
+                               return -1;
+               }
+       }
        return 0;
 }
 
+/**
+ * add_marker_len - compute the length of the marker in data area
+ * @td:                BBT descriptor used for computation
+ *
+ * The length will be 0 if the markeris located in OOB area.
+ */
+static u32 add_marker_len(struct nand_bbt_descr *td)
+{
+       u32 len;
+
+       if (!(td->options & NAND_BBT_NO_OOB))
+               return 0;
+
+       len = td->len;
+       if (td->options & NAND_BBT_VERSION)
+               len++;
+       return len;
+}
+
 /**
  * read_bbt - [GENERIC] Read the bad block table starting from page
  * @mtd:       MTD device structure
  * @buf:       temporary buffer
  * @page:      the starting page
  * @num:       the number of bbt descriptors to read
- * @bits:      number of bits per block
+ * @td:                the bbt describtion table
  * @offs:      offset in the memory table
- * @reserved_block_code:       Pattern to identify reserved blocks
  *
  * Read the bad block table starting from page.
  *
  */
 static int read_bbt(struct mtd_info *mtd, uint8_t *buf, int page, int num,
-                   int bits, int offs, int reserved_block_code)
+               struct nand_bbt_descr *td, int offs)
 {
        int res, i, j, act = 0;
        struct nand_chip *this = mtd->priv;
        size_t retlen, len, totlen;
        loff_t from;
+       int bits = td->options & NAND_BBT_NRBITS_MSK;
        uint8_t msk = (uint8_t) ((1 << bits) - 1);
+       u32 marker_len;
+       int reserved_block_code = td->reserved_block_code;
 
        totlen = (num * bits) >> 3;
+       marker_len = add_marker_len(td);
        from = ((loff_t) page) << this->page_shift;
 
        while (totlen) {
                len = min(totlen, (size_t) (1 << this->bbt_erase_shift));
+               if (marker_len) {
+                       /*
+                        * In case the BBT marker is not in the OOB area it
+                        * will be just in the first page.
+                        */
+                       len -= marker_len;
+                       from += marker_len;
+                       marker_len = 0;
+               }
                res = mtd->read(mtd, from, len, &retlen, buf);
                if (res < 0) {
                        if (retlen != len) {
@@ -170,9 +254,7 @@ static int read_bbt(struct mtd_info *mtd, uint8_t *buf, int page, int num,
                                        continue;
                                if (reserved_block_code && (tmp == reserved_block_code)) {
                                        printk(KERN_DEBUG "nand_read_bbt: Reserved block at 0x%012llx\n",
-                                               (loff_t)((offs << 2) +
-                                               (act >> 1)) <<
-                                               this->bbt_erase_shift);
+                                              (loff_t)((offs << 2) + (act >> 1)) << this->bbt_erase_shift);
                                        this->bbt[offs + (act >> 3)] |= 0x2 << (act & 0x06);
                                        mtd->ecc_stats.bbtblocks++;
                                        continue;
@@ -180,8 +262,7 @@ static int read_bbt(struct mtd_info *mtd, uint8_t *buf, int page, int num,
                                /* Leave it for now, if its matured we can move this
                                 * message to MTD_DEBUG_LEVEL0 */
                                printk(KERN_DEBUG "nand_read_bbt: Bad block at 0x%012llx\n",
-                                       (loff_t)((offs << 2) + (act >> 1)) <<
-                                       this->bbt_erase_shift);
+                                      (loff_t)((offs << 2) + (act >> 1)) << this->bbt_erase_shift);
                                /* Factory marked bad or worn out ? */
                                if (tmp == 0)
                                        this->bbt[offs + (act >> 3)] |= 0x3 << (act & 0x06);
@@ -211,42 +292,86 @@ static int read_abs_bbt(struct mtd_info *mtd, uint8_t *buf, struct nand_bbt_desc
 {
        struct nand_chip *this = mtd->priv;
        int res = 0, i;
-       int bits;
 
-       bits = td->options & NAND_BBT_NRBITS_MSK;
        if (td->options & NAND_BBT_PERCHIP) {
                int offs = 0;
                for (i = 0; i < this->numchips; i++) {
                        if (chip == -1 || chip == i)
-                               res = read_bbt (mtd, buf, td->pages[i], this->chipsize >> this->bbt_erase_shift, bits, offs, td->reserved_block_code);
+                               res = read_bbt(mtd, buf, td->pages[i],
+                                       this->chipsize >> this->bbt_erase_shift,
+                                       td, offs);
                        if (res)
                                return res;
                        offs += this->chipsize >> (this->bbt_erase_shift + 2);
                }
        } else {
-               res = read_bbt (mtd, buf, td->pages[0], mtd->size >> this->bbt_erase_shift, bits, 0, td->reserved_block_code);
+               res = read_bbt(mtd, buf, td->pages[0],
+                               mtd->size >> this->bbt_erase_shift, td, 0);
                if (res)
                        return res;
        }
        return 0;
 }
 
+/*
+ * BBT marker is in the first page, no OOB.
+ */
+static int scan_read_raw_data(struct mtd_info *mtd, uint8_t *buf, loff_t offs,
+                        struct nand_bbt_descr *td)
+{
+       size_t retlen;
+       size_t len;
+
+       len = td->len;
+       if (td->options & NAND_BBT_VERSION)
+               len++;
+
+       return mtd->read(mtd, offs, len, &retlen, buf);
+}
+
 /*
  * Scan read raw data from flash
  */
-static int scan_read_raw(struct mtd_info *mtd, uint8_t *buf, loff_t offs,
+static int scan_read_raw_oob(struct mtd_info *mtd, uint8_t *buf, loff_t offs,
                         size_t len)
 {
        struct mtd_oob_ops ops;
+       int res;
 
        ops.mode = MTD_OOB_RAW;
        ops.ooboffs = 0;
        ops.ooblen = mtd->oobsize;
-       ops.oobbuf = buf;
-       ops.datbuf = buf;
-       ops.len = len;
 
-       return mtd->read_oob(mtd, offs, &ops);
+
+       while (len > 0) {
+               if (len <= mtd->writesize) {
+                       ops.oobbuf = buf + len;
+                       ops.datbuf = buf;
+                       ops.len = len;
+                       return mtd->read_oob(mtd, offs, &ops);
+               } else {
+                       ops.oobbuf = buf + mtd->writesize;
+                       ops.datbuf = buf;
+                       ops.len = mtd->writesize;
+                       res = mtd->read_oob(mtd, offs, &ops);
+
+                       if (res)
+                               return res;
+               }
+
+               buf += mtd->oobsize + mtd->writesize;
+               len -= mtd->writesize;
+       }
+       return 0;
+}
+
+static int scan_read_raw(struct mtd_info *mtd, uint8_t *buf, loff_t offs,
+                        size_t len, struct nand_bbt_descr *td)
+{
+       if (td->options & NAND_BBT_NO_OOB)
+               return scan_read_raw_data(mtd, buf, offs, td);
+       else
+               return scan_read_raw_oob(mtd, buf, offs, len);
 }
 
 /*
@@ -267,6 +392,15 @@ static int scan_write_bbt(struct mtd_info *mtd, loff_t offs, size_t len,
        return mtd->write_oob(mtd, offs, &ops);
 }
 
+static u32 bbt_get_ver_offs(struct mtd_info *mtd, struct nand_bbt_descr *td)
+{
+       u32 ver_offs = td->veroffs;
+
+       if (!(td->options & NAND_BBT_NO_OOB))
+               ver_offs += mtd->writesize;
+       return ver_offs;
+}
+
 /**
  * read_abs_bbts - [GENERIC] Read the bad block table(s) for all chips starting at a given page
  * @mtd:       MTD device structure
@@ -285,18 +419,18 @@ static int read_abs_bbts(struct mtd_info *mtd, uint8_t *buf,
 
        /* Read the primary version, if available */
        if (td->options & NAND_BBT_VERSION) {
-               scan_read_raw(mtd, buf, (loff_t)td->pages[0] <<
-                               this->page_shift, mtd->writesize);
-               td->version[0] = buf[mtd->writesize + td->veroffs];
+               scan_read_raw(mtd, buf, (loff_t)td->pages[0] << this->page_shift,
+                             mtd->writesize, td);
+               td->version[0] = buf[bbt_get_ver_offs(mtd, td)];
                printk(KERN_DEBUG "Bad block table at page %d, version 0x%02X\n",
                       td->pages[0], td->version[0]);
        }
 
        /* Read the mirror version, if available */
        if (md && (md->options & NAND_BBT_VERSION)) {
-               scan_read_raw(mtd, buf, (loff_t)md->pages[0] <<
-                               this->page_shift, mtd->writesize);
-               md->version[0] = buf[mtd->writesize + md->veroffs];
+               scan_read_raw(mtd, buf, (loff_t)md->pages[0] << this->page_shift,
+                             mtd->writesize, td);
+               md->version[0] = buf[bbt_get_ver_offs(mtd, md)];
                printk(KERN_DEBUG "Bad block table at page %d, version 0x%02X\n",
                       md->pages[0], md->version[0]);
        }
@@ -312,7 +446,7 @@ static int scan_block_full(struct mtd_info *mtd, struct nand_bbt_descr *bd,
 {
        int ret, j;
 
-       ret = scan_read_raw(mtd, buf, offs, readlen);
+       ret = scan_read_raw_oob(mtd, buf, offs, readlen);
        if (ret)
                return ret;
 
@@ -376,16 +510,14 @@ static int create_bbt(struct mtd_info *mtd, uint8_t *buf,
        loff_t from;
        size_t readlen;
 
-       MTDDEBUG (MTD_DEBUG_LEVEL0, "Scanning device for bad blocks\n");
+       MTDDEBUG(MTD_DEBUG_LEVEL0, "Scanning device for bad blocks\n");
 
        if (bd->options & NAND_BBT_SCANALLPAGES)
                len = 1 << (this->bbt_erase_shift - this->page_shift);
-       else {
-               if (bd->options & NAND_BBT_SCAN2NDPAGE)
-                       len = 2;
-               else
-                       len = 1;
-       }
+       else if (bd->options & NAND_BBT_SCAN2NDPAGE)
+               len = 2;
+       else
+               len = 1;
 
        if (!(bd->options & NAND_BBT_SCANEMPTY)) {
                /* We need only read few bytes from the OOB area */
@@ -415,9 +547,14 @@ static int create_bbt(struct mtd_info *mtd, uint8_t *buf,
                from = (loff_t)startblock << (this->bbt_erase_shift - 1);
        }
 
+       if (this->options & NAND_BBT_SCANLASTPAGE)
+               from += mtd->erasesize - (mtd->writesize * len);
+
        for (i = startblock; i < numblocks;) {
                int ret;
 
+               BUG_ON(bd->options & NAND_BBT_NO_OOB);
+
                if (bd->options & NAND_BBT_SCANALLPAGES)
                        ret = scan_block_full(mtd, bd, from, buf, readlen,
                                              scanlen, len);
@@ -429,7 +566,7 @@ static int create_bbt(struct mtd_info *mtd, uint8_t *buf,
 
                if (ret) {
                        this->bbt[i >> 3] |= 0x03 << (i & 0x6);
-                       MTDDEBUG (MTD_DEBUG_LEVEL0,
+                       MTDDEBUG(MTD_DEBUG_LEVEL0,
                                  "Bad eraseblock %d at 0x%012llx\n",
                                  i >> 1, (unsigned long long)from);
                        mtd->ecc_stats.badblocks++;
@@ -497,11 +634,12 @@ static int search_bbt(struct mtd_info *mtd, uint8_t *buf, struct nand_bbt_descr
                        loff_t offs = (loff_t)actblock << this->bbt_erase_shift;
 
                        /* Read first page */
-                       scan_read_raw(mtd, buf, offs, mtd->writesize);
+                       scan_read_raw(mtd, buf, offs, mtd->writesize, td);
                        if (!check_pattern(buf, scanlen, mtd->writesize, td)) {
                                td->pages[i] = actblock << blocktopage;
                                if (td->options & NAND_BBT_VERSION) {
-                                       td->version[i] = buf[mtd->writesize + td->veroffs];
+                                       offs = bbt_get_ver_offs(mtd, td);
+                                       td->version[i] = buf[offs];
                                }
                                break;
                        }
@@ -685,12 +823,26 @@ static int write_bbt(struct mtd_info *mtd, uint8_t *buf,
                        memset(&buf[offs], 0xff, (size_t) (numblocks >> sft));
                        ooboffs = len + (pageoffs * mtd->oobsize);
 
+               } else if (td->options & NAND_BBT_NO_OOB) {
+                       ooboffs = 0;
+                       offs = td->len;
+                       /* the version byte */
+                       if (td->options & NAND_BBT_VERSION)
+                               offs++;
+                       /* Calc length */
+                       len = (size_t) (numblocks >> sft);
+                       len += offs;
+                       /* Make it page aligned ! */
+                       len = ALIGN(len, mtd->writesize);
+                       /* Preset the buffer with 0xff */
+                       memset(buf, 0xff, len);
+                       /* Pattern is located at the begin of first page */
+                       memcpy(buf, td->pattern, td->len);
                } else {
                        /* Calc length */
                        len = (size_t) (numblocks >> sft);
                        /* Make it page aligned ! */
-                       len = (len + (mtd->writesize - 1)) &
-                               ~(mtd->writesize - 1);
+                       len = ALIGN(len, mtd->writesize);
                        /* Preset the buffer with 0xff */
                        memset(buf, 0xff, len +
                               (len >> this->page_shift)* mtd->oobsize);
@@ -724,13 +876,14 @@ static int write_bbt(struct mtd_info *mtd, uint8_t *buf,
                if (res < 0)
                        goto outerr;
 
-               res = scan_write_bbt(mtd, to, len, buf, &buf[len]);
+               res = scan_write_bbt(mtd, to, len, buf,
+                               td->options & NAND_BBT_NO_OOB ? NULL :
+                               &buf[len]);
                if (res < 0)
                        goto outerr;
 
-               printk(KERN_DEBUG "Bad block table written to 0x%012llx, "
-                      "version 0x%02X\n", (unsigned long long)to,
-                      td->version[chip]);
+               printk(KERN_DEBUG "Bad block table written to 0x%012llx, version "
+                      "0x%02X\n", (unsigned long long)to, td->version[chip]);
 
                /* Mark it as used */
                td->pages[chip] = page;
@@ -791,7 +944,7 @@ static int check_create(struct mtd_info *mtd, uint8_t *buf, struct nand_bbt_desc
                rd2 = NULL;
                /* Per chip or per device ? */
                chipsel = (td->options & NAND_BBT_PERCHIP) ? i : -1;
-               /* Mirrored table avilable ? */
+               /* Mirrored table available ? */
                if (md) {
                        if (td->pages[i] == -1 && md->pages[i] == -1) {
                                writeops = 0x03;
@@ -845,7 +998,8 @@ static int check_create(struct mtd_info *mtd, uint8_t *buf, struct nand_bbt_desc
                        continue;
 
                /* Create the table in memory by scanning the chip(s) */
-               create_bbt(mtd, buf, bd, chipsel);
+               if (!(this->options & NAND_CREATE_EMPTY_BBT))
+                       create_bbt(mtd, buf, bd, chipsel);
 
                td->version[i] = 1;
                if (md)
@@ -910,8 +1064,7 @@ static void mark_bbt_region(struct mtd_info *mtd, struct nand_bbt_descr *td)
                        newval = oldval | (0x2 << (block & 0x06));
                        this->bbt[(block >> 3)] = newval;
                        if ((oldval != newval) && td->reserved_block_code)
-                               nand_update_bbt(mtd, (loff_t)block <<
-                                       (this->bbt_erase_shift - 1));
+                               nand_update_bbt(mtd, (loff_t)block << (this->bbt_erase_shift - 1));
                        continue;
                }
                update = 0;
@@ -932,11 +1085,58 @@ static void mark_bbt_region(struct mtd_info *mtd, struct nand_bbt_descr *td)
                   new ones have been marked, then we need to update the stored
                   bbts.  This should only happen once. */
                if (update && td->reserved_block_code)
-                       nand_update_bbt(mtd, (loff_t)(block - 2) <<
-                               (this->bbt_erase_shift - 1));
+                       nand_update_bbt(mtd, (loff_t)(block - 2) << (this->bbt_erase_shift - 1));
        }
 }
 
+/**
+ * verify_bbt_descr - verify the bad block description
+ * @mtd:       MTD device structure
+ * @bd:                the table to verify
+ *
+ * This functions performs a few sanity checks on the bad block description
+ * table.
+ */
+static void verify_bbt_descr(struct mtd_info *mtd, struct nand_bbt_descr *bd)
+{
+       struct nand_chip *this = mtd->priv;
+       u32 pattern_len;
+       u32 bits;
+       u32 table_size;
+
+       if (!bd)
+               return;
+
+       pattern_len = bd->len;
+       bits = bd->options & NAND_BBT_NRBITS_MSK;
+
+       BUG_ON((this->options & NAND_USE_FLASH_BBT_NO_OOB) &&
+                       !(this->options & NAND_USE_FLASH_BBT));
+       BUG_ON(!bits);
+
+       if (bd->options & NAND_BBT_VERSION)
+               pattern_len++;
+
+       if (bd->options & NAND_BBT_NO_OOB) {
+               BUG_ON(!(this->options & NAND_USE_FLASH_BBT));
+               BUG_ON(!(this->options & NAND_USE_FLASH_BBT_NO_OOB));
+               BUG_ON(bd->offs);
+               if (bd->options & NAND_BBT_VERSION)
+                       BUG_ON(bd->veroffs != bd->len);
+               BUG_ON(bd->options & NAND_BBT_SAVECONTENT);
+       }
+
+       if (bd->options & NAND_BBT_PERCHIP)
+               table_size = this->chipsize >> this->bbt_erase_shift;
+       else
+               table_size = mtd->size >> this->bbt_erase_shift;
+       table_size >>= 3;
+       table_size *= bits;
+       if (bd->options & NAND_BBT_NO_OOB)
+               table_size += pattern_len;
+       BUG_ON(table_size > (1 << this->bbt_erase_shift));
+}
+
 /**
  * nand_scan_bbt - [NAND Interface] scan, find, read and maybe create bad block table(s)
  * @mtd:       MTD device structure
@@ -978,6 +1178,8 @@ int nand_scan_bbt(struct mtd_info *mtd, struct nand_bbt_descr *bd)
                }
                return res;
        }
+       verify_bbt_descr(mtd, td);
+       verify_bbt_descr(mtd, md);
 
        /* Allocate a temporary buffer for one eraseblock incl. oob */
        len = (1 << this->bbt_erase_shift);
@@ -1073,34 +1275,6 @@ int nand_update_bbt(struct mtd_info *mtd, loff_t offs)
  * while scanning a device for factory marked good / bad blocks. */
 static uint8_t scan_ff_pattern[] = { 0xff, 0xff };
 
-static struct nand_bbt_descr smallpage_memorybased = {
-       .options = NAND_BBT_SCAN2NDPAGE,
-       .offs = 5,
-       .len = 1,
-       .pattern = scan_ff_pattern
-};
-
-static struct nand_bbt_descr largepage_memorybased = {
-       .options = 0,
-       .offs = 0,
-       .len = 2,
-       .pattern = scan_ff_pattern
-};
-
-static struct nand_bbt_descr smallpage_flashbased = {
-       .options = NAND_BBT_SCAN2NDPAGE,
-       .offs = 5,
-       .len = 1,
-       .pattern = scan_ff_pattern
-};
-
-static struct nand_bbt_descr largepage_flashbased = {
-       .options = NAND_BBT_SCAN2NDPAGE,
-       .offs = 0,
-       .len = 2,
-       .pattern = scan_ff_pattern
-};
-
 static uint8_t scan_agand_pattern[] = { 0x1C, 0x71, 0xC7, 0x1C, 0x71, 0xC7 };
 
 static struct nand_bbt_descr agand_flashbased = {
@@ -1135,6 +1309,59 @@ static struct nand_bbt_descr bbt_mirror_descr = {
        .pattern = mirror_pattern
 };
 
+static struct nand_bbt_descr bbt_main_no_bbt_descr = {
+       .options = NAND_BBT_LASTBLOCK | NAND_BBT_CREATE | NAND_BBT_WRITE
+               | NAND_BBT_2BIT | NAND_BBT_VERSION | NAND_BBT_PERCHIP
+               | NAND_BBT_NO_OOB,
+       .len = 4,
+       .veroffs = 4,
+       .maxblocks = 4,
+       .pattern = bbt_pattern
+};
+
+static struct nand_bbt_descr bbt_mirror_no_bbt_descr = {
+       .options = NAND_BBT_LASTBLOCK | NAND_BBT_CREATE | NAND_BBT_WRITE
+               | NAND_BBT_2BIT | NAND_BBT_VERSION | NAND_BBT_PERCHIP
+               | NAND_BBT_NO_OOB,
+       .len = 4,
+       .veroffs = 4,
+       .maxblocks = 4,
+       .pattern = mirror_pattern
+};
+
+#define BBT_SCAN_OPTIONS (NAND_BBT_SCANLASTPAGE | NAND_BBT_SCAN2NDPAGE | \
+               NAND_BBT_SCANBYTE1AND6)
+/**
+ * nand_create_default_bbt_descr - [Internal] Creates a BBT descriptor structure
+ * @this:      NAND chip to create descriptor for
+ *
+ * This function allocates and initializes a nand_bbt_descr for BBM detection
+ * based on the properties of "this". The new descriptor is stored in
+ * this->badblock_pattern. Thus, this->badblock_pattern should be NULL when
+ * passed to this function.
+ *
+ */
+static int nand_create_default_bbt_descr(struct nand_chip *this)
+{
+       struct nand_bbt_descr *bd;
+       if (this->badblock_pattern) {
+               printk(KERN_WARNING "BBT descr already allocated; not replacing.\n");
+               return -EINVAL;
+       }
+       bd = kzalloc(sizeof(*bd), GFP_KERNEL);
+       if (!bd) {
+               printk(KERN_ERR "nand_create_default_bbt_descr: Out of memory\n");
+               return -ENOMEM;
+       }
+       bd->options = this->options & BBT_SCAN_OPTIONS;
+       bd->offs = this->badblockpos;
+       bd->len = (this->options & NAND_BUSWIDTH_16) ? 2 : 1;
+       bd->pattern = scan_ff_pattern;
+       bd->options |= NAND_BBT_DYNAMICSTRUCT;
+       this->badblock_pattern = bd;
+       return 0;
+}
+
 /**
  * nand_default_bbt - [NAND Interface] Select a default bad block table for the device
  * @mtd:       MTD device structure
@@ -1168,20 +1395,22 @@ int nand_default_bbt(struct mtd_info *mtd)
        if (this->options & NAND_USE_FLASH_BBT) {
                /* Use the default pattern descriptors */
                if (!this->bbt_td) {
-                       this->bbt_td = &bbt_main_descr;
-                       this->bbt_md = &bbt_mirror_descr;
-               }
-               if (!this->badblock_pattern) {
-                       this->badblock_pattern = (mtd->writesize > 512) ? &largepage_flashbased : &smallpage_flashbased;
+                       if (this->options & NAND_USE_FLASH_BBT_NO_OOB) {
+                               this->bbt_td = &bbt_main_no_bbt_descr;
+                               this->bbt_md = &bbt_mirror_no_bbt_descr;
+                       } else {
+                               this->bbt_td = &bbt_main_descr;
+                               this->bbt_md = &bbt_mirror_descr;
+                       }
                }
        } else {
                this->bbt_td = NULL;
                this->bbt_md = NULL;
-               if (!this->badblock_pattern) {
-                       this->badblock_pattern = (mtd->writesize > 512) ?
-                           &largepage_memorybased : &smallpage_memorybased;
-               }
        }
+
+       if (!this->badblock_pattern)
+               nand_create_default_bbt_descr(this);
+
        return nand_scan_bbt(mtd, this->badblock_pattern);
 }
 
@@ -1202,8 +1431,8 @@ int nand_isbad_bbt(struct mtd_info *mtd, loff_t offs, int allowbbt)
        block = (int)(offs >> (this->bbt_erase_shift - 1));
        res = (this->bbt[block >> 3] >> (block & 0x06)) & 0x03;
 
-       MTDDEBUG (MTD_DEBUG_LEVEL2, "nand_isbad_bbt(): bbt info for offs 0x%08x: "
-                 "(block %d) 0x%02x\n", (unsigned int)offs, res, block >> 1);
+       MTDDEBUG(MTD_DEBUG_LEVEL2, "nand_isbad_bbt(): bbt info for offs 0x%08x: (block %d) 0x%02x\n",
+             (unsigned int)offs, block >> 1, res);
 
        switch ((int)res) {
        case 0x00:
diff --git a/drivers/mtd/nand/nand_bch.c b/drivers/mtd/nand/nand_bch.c
new file mode 100644 (file)
index 0000000..7835fce
--- /dev/null
@@ -0,0 +1,236 @@
+/*
+ * This file provides ECC correction for more than 1 bit per block of data,
+ * using binary BCH codes. It relies on the generic BCH library lib/bch.c.
+ *
+ * Copyright Â© 2011 Ivan Djelic <ivan.djelic@parrot.com>
+ *
+ * This file is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 or (at your option) any
+ * later version.
+ *
+ * This file is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this file; 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 <linux/types.h>
+
+#include <linux/bitops.h>
+#include <linux/mtd/mtd.h>
+#include <linux/mtd/nand.h>
+#include <linux/mtd/nand_bch.h>
+#include <linux/bch.h>
+#include <malloc.h>
+
+/**
+ * struct nand_bch_control - private NAND BCH control structure
+ * @bch:       BCH control structure
+ * @ecclayout: private ecc layout for this BCH configuration
+ * @errloc:    error location array
+ * @eccmask:   XOR ecc mask, allows erased pages to be decoded as valid
+ */
+struct nand_bch_control {
+       struct bch_control   *bch;
+       struct nand_ecclayout ecclayout;
+       unsigned int         *errloc;
+       unsigned char        *eccmask;
+};
+
+/**
+ * nand_bch_calculate_ecc - [NAND Interface] Calculate ECC for data block
+ * @mtd:       MTD block structure
+ * @buf:       input buffer with raw data
+ * @code:      output buffer with ECC
+ */
+int nand_bch_calculate_ecc(struct mtd_info *mtd, const unsigned char *buf,
+                          unsigned char *code)
+{
+       const struct nand_chip *chip = mtd->priv;
+       struct nand_bch_control *nbc = chip->ecc.priv;
+       unsigned int i;
+
+       memset(code, 0, chip->ecc.bytes);
+       encode_bch(nbc->bch, buf, chip->ecc.size, code);
+
+       /* apply mask so that an erased page is a valid codeword */
+       for (i = 0; i < chip->ecc.bytes; i++)
+               code[i] ^= nbc->eccmask[i];
+
+       return 0;
+}
+
+/**
+ * nand_bch_correct_data - [NAND Interface] Detect and correct bit error(s)
+ * @mtd:       MTD block structure
+ * @buf:       raw data read from the chip
+ * @read_ecc:  ECC from the chip
+ * @calc_ecc:  the ECC calculated from raw data
+ *
+ * Detect and correct bit errors for a data byte block
+ */
+int nand_bch_correct_data(struct mtd_info *mtd, unsigned char *buf,
+                         unsigned char *read_ecc, unsigned char *calc_ecc)
+{
+       const struct nand_chip *chip = mtd->priv;
+       struct nand_bch_control *nbc = chip->ecc.priv;
+       unsigned int *errloc = nbc->errloc;
+       int i, count;
+
+       count = decode_bch(nbc->bch, NULL, chip->ecc.size, read_ecc, calc_ecc,
+                          NULL, errloc);
+       if (count > 0) {
+               for (i = 0; i < count; i++) {
+                       if (errloc[i] < (chip->ecc.size*8))
+                               /* error is located in data, correct it */
+                               buf[errloc[i] >> 3] ^= (1 << (errloc[i] & 7));
+                       /* else error in ecc, no action needed */
+
+                       MTDDEBUG(MTD_DEBUG_LEVEL0, "%s: corrected bitflip %u\n",
+                             __func__, errloc[i]);
+               }
+       } else if (count < 0) {
+               printk(KERN_ERR "ecc unrecoverable error\n");
+               count = -1;
+       }
+       return count;
+}
+
+/**
+ * nand_bch_init - [NAND Interface] Initialize NAND BCH error correction
+ * @mtd:       MTD block structure
+ * @eccsize:   ecc block size in bytes
+ * @eccbytes:  ecc length in bytes
+ * @ecclayout: output default layout
+ *
+ * Returns:
+ *  a pointer to a new NAND BCH control structure, or NULL upon failure
+ *
+ * Initialize NAND BCH error correction. Parameters @eccsize and @eccbytes
+ * are used to compute BCH parameters m (Galois field order) and t (error
+ * correction capability). @eccbytes should be equal to the number of bytes
+ * required to store m*t bits, where m is such that 2^m-1 > @eccsize*8.
+ *
+ * Example: to configure 4 bit correction per 512 bytes, you should pass
+ * @eccsize = 512  (thus, m=13 is the smallest integer such that 2^m-1 > 512*8)
+ * @eccbytes = 7   (7 bytes are required to store m*t = 13*4 = 52 bits)
+ */
+struct nand_bch_control *
+nand_bch_init(struct mtd_info *mtd, unsigned int eccsize, unsigned int eccbytes,
+             struct nand_ecclayout **ecclayout)
+{
+       unsigned int m, t, eccsteps, i;
+       struct nand_ecclayout *layout;
+       struct nand_bch_control *nbc = NULL;
+       unsigned char *erased_page;
+
+       if (!eccsize || !eccbytes) {
+               printk(KERN_WARNING "ecc parameters not supplied\n");
+               goto fail;
+       }
+
+       m = fls(1+8*eccsize);
+       t = (eccbytes*8)/m;
+
+       nbc = kzalloc(sizeof(*nbc), GFP_KERNEL);
+       if (!nbc)
+               goto fail;
+
+       nbc->bch = init_bch(m, t, 0);
+       if (!nbc->bch)
+               goto fail;
+
+       /* verify that eccbytes has the expected value */
+       if (nbc->bch->ecc_bytes != eccbytes) {
+               printk(KERN_WARNING "invalid eccbytes %u, should be %u\n",
+                      eccbytes, nbc->bch->ecc_bytes);
+               goto fail;
+       }
+
+       eccsteps = mtd->writesize/eccsize;
+
+       /* if no ecc placement scheme was provided, build one */
+       if (!*ecclayout) {
+
+               /* handle large page devices only */
+               if (mtd->oobsize < 64) {
+                       printk(KERN_WARNING "must provide an oob scheme for "
+                              "oobsize %d\n", mtd->oobsize);
+                       goto fail;
+               }
+
+               layout = &nbc->ecclayout;
+               layout->eccbytes = eccsteps*eccbytes;
+
+               /* reserve 2 bytes for bad block marker */
+               if (layout->eccbytes+2 > mtd->oobsize) {
+                       printk(KERN_WARNING "no suitable oob scheme available "
+                              "for oobsize %d eccbytes %u\n", mtd->oobsize,
+                              eccbytes);
+                       goto fail;
+               }
+               /* put ecc bytes at oob tail */
+               for (i = 0; i < layout->eccbytes; i++)
+                       layout->eccpos[i] = mtd->oobsize-layout->eccbytes+i;
+
+               layout->oobfree[0].offset = 2;
+               layout->oobfree[0].length = mtd->oobsize-2-layout->eccbytes;
+
+               *ecclayout = layout;
+       }
+
+       /* sanity checks */
+       if (8*(eccsize+eccbytes) >= (1 << m)) {
+               printk(KERN_WARNING "eccsize %u is too large\n", eccsize);
+               goto fail;
+       }
+       if ((*ecclayout)->eccbytes != (eccsteps*eccbytes)) {
+               printk(KERN_WARNING "invalid ecc layout\n");
+               goto fail;
+       }
+
+       nbc->eccmask = kmalloc(eccbytes, GFP_KERNEL);
+       nbc->errloc = kmalloc(t*sizeof(*nbc->errloc), GFP_KERNEL);
+       if (!nbc->eccmask || !nbc->errloc)
+               goto fail;
+       /*
+        * compute and store the inverted ecc of an erased ecc block
+        */
+       erased_page = kmalloc(eccsize, GFP_KERNEL);
+       if (!erased_page)
+               goto fail;
+
+       memset(erased_page, 0xff, eccsize);
+       memset(nbc->eccmask, 0, eccbytes);
+       encode_bch(nbc->bch, erased_page, eccsize, nbc->eccmask);
+       kfree(erased_page);
+
+       for (i = 0; i < eccbytes; i++)
+               nbc->eccmask[i] ^= 0xff;
+
+       return nbc;
+fail:
+       nand_bch_free(nbc);
+       return NULL;
+}
+
+/**
+ * nand_bch_free - [NAND Interface] Release NAND BCH ECC resources
+ * @nbc:       NAND BCH control structure
+ */
+void nand_bch_free(struct nand_bch_control *nbc)
+{
+       if (nbc) {
+               free_bch(nbc->bch);
+               kfree(nbc->errloc);
+               kfree(nbc->eccmask);
+               kfree(nbc);
+       }
+}
index 8d7ea767dd5aa47537a8571dd7c1f59aeaa1daab..39535497f8dfede06d6ca0e7ee009178fc7b8569 100644 (file)
@@ -76,9 +76,13 @@ const struct nand_flash_dev nand_flash_ids[] = {
 
        /*512 Megabit */
        {"NAND 64MiB 1,8V 8-bit",       0xA2, 0,  64, 0, LP_OPTIONS},
+       {"NAND 64MiB 1,8V 8-bit",       0xA0, 0,  64, 0, LP_OPTIONS},
        {"NAND 64MiB 3,3V 8-bit",       0xF2, 0,  64, 0, LP_OPTIONS},
+       {"NAND 64MiB 3,3V 8-bit",       0xD0, 0,  64, 0, LP_OPTIONS},
        {"NAND 64MiB 1,8V 16-bit",      0xB2, 0,  64, 0, LP_OPTIONS16},
+       {"NAND 64MiB 1,8V 16-bit",      0xB0, 0,  64, 0, LP_OPTIONS16},
        {"NAND 64MiB 3,3V 16-bit",      0xC2, 0,  64, 0, LP_OPTIONS16},
+       {"NAND 64MiB 3,3V 16-bit",      0xC0, 0,  64, 0, LP_OPTIONS16},
 
        /* 1 Gigabit */
        {"NAND 128MiB 1,8V 8-bit",      0xA1, 0, 128, 0, LP_OPTIONS},
@@ -86,6 +90,7 @@ const struct nand_flash_dev nand_flash_ids[] = {
        {"NAND 128MiB 3,3V 8-bit",      0xD1, 0, 128, 0, LP_OPTIONS},
        {"NAND 128MiB 1,8V 16-bit",     0xB1, 0, 128, 0, LP_OPTIONS16},
        {"NAND 128MiB 3,3V 16-bit",     0xC1, 0, 128, 0, LP_OPTIONS16},
+       {"NAND 128MiB 1,8V 16-bit",     0xAD, 0, 128, 0, LP_OPTIONS16},
 
        /* 2 Gigabit */
        {"NAND 256MiB 1,8V 8-bit",      0xAA, 0, 256, 0, LP_OPTIONS},
@@ -111,6 +116,36 @@ const struct nand_flash_dev nand_flash_ids[] = {
        {"NAND 2GiB 1,8V 16-bit",       0xB5, 0, 2048, 0, LP_OPTIONS16},
        {"NAND 2GiB 3,3V 16-bit",       0xC5, 0, 2048, 0, LP_OPTIONS16},
 
+       /* 32 Gigabit */
+       {"NAND 4GiB 1,8V 8-bit",        0xA7, 0, 4096, 0, LP_OPTIONS},
+       {"NAND 4GiB 3,3V 8-bit",        0xD7, 0, 4096, 0, LP_OPTIONS},
+       {"NAND 4GiB 1,8V 16-bit",       0xB7, 0, 4096, 0, LP_OPTIONS16},
+       {"NAND 4GiB 3,3V 16-bit",       0xC7, 0, 4096, 0, LP_OPTIONS16},
+
+       /* 64 Gigabit */
+       {"NAND 8GiB 1,8V 8-bit",        0xAE, 0, 8192, 0, LP_OPTIONS},
+       {"NAND 8GiB 3,3V 8-bit",        0xDE, 0, 8192, 0, LP_OPTIONS},
+       {"NAND 8GiB 1,8V 16-bit",       0xBE, 0, 8192, 0, LP_OPTIONS16},
+       {"NAND 8GiB 3,3V 16-bit",       0xCE, 0, 8192, 0, LP_OPTIONS16},
+
+       /* 128 Gigabit */
+       {"NAND 16GiB 1,8V 8-bit",       0x1A, 0, 16384, 0, LP_OPTIONS},
+       {"NAND 16GiB 3,3V 8-bit",       0x3A, 0, 16384, 0, LP_OPTIONS},
+       {"NAND 16GiB 1,8V 16-bit",      0x2A, 0, 16384, 0, LP_OPTIONS16},
+       {"NAND 16GiB 3,3V 16-bit",      0x4A, 0, 16384, 0, LP_OPTIONS16},
+
+       /* 256 Gigabit */
+       {"NAND 32GiB 1,8V 8-bit",       0x1C, 0, 32768, 0, LP_OPTIONS},
+       {"NAND 32GiB 3,3V 8-bit",       0x3C, 0, 32768, 0, LP_OPTIONS},
+       {"NAND 32GiB 1,8V 16-bit",      0x2C, 0, 32768, 0, LP_OPTIONS16},
+       {"NAND 32GiB 3,3V 16-bit",      0x4C, 0, 32768, 0, LP_OPTIONS16},
+
+       /* 512 Gigabit */
+       {"NAND 64GiB 1,8V 8-bit",       0x1E, 0, 65536, 0, LP_OPTIONS},
+       {"NAND 64GiB 3,3V 8-bit",       0x3E, 0, 65536, 0, LP_OPTIONS},
+       {"NAND 64GiB 1,8V 16-bit",      0x2E, 0, 65536, 0, LP_OPTIONS16},
+       {"NAND 64GiB 3,3V 16-bit",      0x4E, 0, 65536, 0, LP_OPTIONS16},
+
        /*
         * Renesas AND 1 Gigabit. Those chips do not support extended id and
         * have a strange page/block layout !  The chosen minimum erasesize is
index 7eb08a3b089dfdfb9d031caba651fe62967fc540..4a4d02f4c8b5c1c4d95c8735a52862ab4c7fd4fe 100644 (file)
@@ -27,6 +27,11 @@ static int nand_ecc_pos[] = CONFIG_SYS_NAND_ECCPOS;
 static nand_info_t mtd;
 static struct nand_chip nand_chip;
 
+#define ECCSTEPS       (CONFIG_SYS_NAND_PAGE_SIZE / \
+                                       CONFIG_SYS_NAND_ECCSIZE)
+#define ECCTOTAL       (ECCSTEPS * CONFIG_SYS_NAND_ECCBYTES)
+
+
 #if (CONFIG_SYS_NAND_PAGE_SIZE <= 512)
 /*
  * NAND command for small page NAND devices (512)
@@ -145,29 +150,21 @@ static int nand_is_bad_block(int block)
 static int nand_read_page(int block, int page, uchar *dst)
 {
        struct nand_chip *this = mtd.priv;
-       u_char *ecc_calc;
-       u_char *ecc_code;
-       u_char *oob_data;
+       u_char ecc_calc[ECCTOTAL];
+       u_char ecc_code[ECCTOTAL];
+       u_char oob_data[CONFIG_SYS_NAND_OOBSIZE];
        int i;
        int eccsize = CONFIG_SYS_NAND_ECCSIZE;
        int eccbytes = CONFIG_SYS_NAND_ECCBYTES;
-       int eccsteps = CONFIG_SYS_NAND_ECCSTEPS;
+       int eccsteps = ECCSTEPS;
        uint8_t *p = dst;
 
-       /*
-        * No malloc available for now, just use some temporary locations
-        * in SDRAM
-        */
-       ecc_calc = (u_char *)(CONFIG_SYS_SDRAM_BASE + 0x10000);
-       ecc_code = ecc_calc + 0x100;
-       oob_data = ecc_calc + 0x200;
-
        nand_command(block, page, 0, NAND_CMD_READOOB);
        this->read_buf(&mtd, oob_data, CONFIG_SYS_NAND_OOBSIZE);
        nand_command(block, page, 0, NAND_CMD_READ0);
 
        /* Pick the ECC bytes out of the oob data */
-       for (i = 0; i < CONFIG_SYS_NAND_ECCTOTAL; i++)
+       for (i = 0; i < ECCTOTAL; i++)
                ecc_code[i] = oob_data[nand_ecc_pos[i]];
 
 
@@ -184,24 +181,17 @@ static int nand_read_page(int block, int page, uchar *dst)
 static int nand_read_page(int block, int page, void *dst)
 {
        struct nand_chip *this = mtd.priv;
-       u_char *ecc_calc;
-       u_char *ecc_code;
-       u_char *oob_data;
+       u_char ecc_calc[ECCTOTAL];
+       u_char ecc_code[ECCTOTAL];
+       u_char oob_data[CONFIG_SYS_NAND_OOBSIZE];
        int i;
        int eccsize = CONFIG_SYS_NAND_ECCSIZE;
        int eccbytes = CONFIG_SYS_NAND_ECCBYTES;
-       int eccsteps = CONFIG_SYS_NAND_ECCSTEPS;
+       int eccsteps = ECCSTEPS;
        uint8_t *p = dst;
 
        nand_command(block, page, 0, NAND_CMD_READ0);
 
-       /* No malloc available for now, just use some temporary locations
-        * in SDRAM
-        */
-       ecc_calc = (u_char *)(CONFIG_SYS_SDRAM_BASE + 0x10000);
-       ecc_code = ecc_calc + 0x100;
-       oob_data = ecc_calc + 0x200;
-
        for (i = 0; eccsteps; eccsteps--, i += eccbytes, p += eccsize) {
                if (this->ecc.mode != NAND_ECC_SOFT)
                        this->ecc.hwctl(&mtd, NAND_ECC_READ);
@@ -211,10 +201,10 @@ static int nand_read_page(int block, int page, void *dst)
        this->read_buf(&mtd, oob_data, CONFIG_SYS_NAND_OOBSIZE);
 
        /* Pick the ECC bytes out of the oob data */
-       for (i = 0; i < CONFIG_SYS_NAND_ECCTOTAL; i++)
+       for (i = 0; i < ECCTOTAL; i++)
                ecc_code[i] = oob_data[nand_ecc_pos[i]];
 
-       eccsteps = CONFIG_SYS_NAND_ECCSTEPS;
+       eccsteps = ECCSTEPS;
        p = dst;
 
        for (i = 0 ; eccsteps; eccsteps--, i += eccbytes, p += eccsize) {
index ef8ed6f4c5d814ad57742fdf4470e6cc53399892..88b6c343498375a2e9a28cb3864c41bc76c87c95 100644 (file)
 #define CONFIG_DEFAULT_SPI_MODE SPI_MODE_0
 #endif
 
-ssize_t spi_read (uchar *addr, int alen, uchar *buffer, int len)
+#ifndef CONFIG_SYS_SPI_WRITE_TOUT
+#define CONFIG_SYS_SPI_WRITE_TOUT (5 * CONFIG_SYS_HZ)
+#endif
+
+ssize_t spi_read(uchar *addr, int alen, uchar *buffer, int len)
 {
        struct spi_slave *slave;
        u8 cmd = SPI_EEPROM_READ;
 
        slave = spi_setup_slave(CONFIG_DEFAULT_SPI_BUS, 1, 1000000,
                        CONFIG_DEFAULT_SPI_MODE);
-       if(!slave)
+       if (!slave)
                return 0;
 
        spi_claim_bus(slave);
 
        /* command */
-       if(spi_xfer(slave, 8, &cmd, NULL, SPI_XFER_BEGIN))
+       if (spi_xfer(slave, 8, &cmd, NULL, SPI_XFER_BEGIN))
                return -1;
 
        /*
-        * if alen == 3, addr[0] is the block number, we never use it here. All we
-        * need are the lower 16 bits
+        * if alen == 3, addr[0] is the block number, we never use it here.
+        * All we need are the lower 16 bits.
         */
        if (alen == 3)
                addr++;
 
        /* address, and data */
-       if(spi_xfer(slave, 16, addr, NULL, 0))
+       if (spi_xfer(slave, 16, addr, NULL, 0))
                return -1;
-       if(spi_xfer(slave, 8 * len, NULL, buffer, SPI_XFER_END))
+       if (spi_xfer(slave, 8 * len, NULL, buffer, SPI_XFER_END))
                return -1;
 
        spi_release_bus(slave);
@@ -71,7 +75,7 @@ ssize_t spi_read (uchar *addr, int alen, uchar *buffer, int len)
        return len;
 }
 
-ssize_t spi_write (uchar *addr, int alen, uchar *buffer, int len)
+ssize_t spi_write(uchar *addr, int alen, uchar *buffer, int len)
 {
        struct spi_slave *slave;
        char buf[3];
@@ -85,7 +89,7 @@ ssize_t spi_write (uchar *addr, int alen, uchar *buffer, int len)
        spi_claim_bus(slave);
 
        buf[0] = SPI_EEPROM_WREN;
-       if(spi_xfer(slave, 8, buf, NULL, SPI_XFER_BEGIN | SPI_XFER_END))
+       if (spi_xfer(slave, 8, buf, NULL, SPI_XFER_BEGIN | SPI_XFER_END))
                return -1;
 
        buf[0] = SPI_EEPROM_WRITE;
@@ -98,9 +102,9 @@ ssize_t spi_write (uchar *addr, int alen, uchar *buffer, int len)
 
        memcpy(buf + 1, addr, alen);
        /* command + addr, then data */
-       if(spi_xfer(slave, 24, buf, NULL, SPI_XFER_BEGIN))
+       if (spi_xfer(slave, 24, buf, NULL, SPI_XFER_BEGIN))
                return -1;
-       if(spi_xfer(slave, len * 8, buffer, NULL, SPI_XFER_END))
+       if (spi_xfer(slave, len * 8, buffer, NULL, SPI_XFER_END))
                return -1;
 
        start = get_timer(0);
@@ -115,7 +119,7 @@ ssize_t spi_write (uchar *addr, int alen, uchar *buffer, int len)
        } while (get_timer(start) < CONFIG_SYS_SPI_WRITE_TOUT);
 
        if (buf[1] & 1)
-               printf ("*** spi_write: Time out while writing!\n");
+               printf("*** spi_write: Timeout while writing!\n");
 
        spi_release_bus(slave);
        spi_free_slave(slave);
index dfe542db64ef8371532af52029e4770dd9d04172..db8ba8bdacbe746129237a74f0488554530e019a 100644 (file)
@@ -66,7 +66,7 @@ struct spi_slave *spi_setup_slave(unsigned int bus, unsigned int cs,
        debug("data = 0x%08x \n", data);
 
        writel(KWSPI_SMEMRDIRQ, &spireg->irq_cause);
-       writel(KWSPI_IRQMASK, spireg->irq_mask);
+       writel(KWSPI_IRQMASK, &spireg->irq_mask);
 
        /* program mpp registers to select  SPI_CSn */
        if (cs) {
index 4c27fef3d183bc9a34ca0dc995cc6d662681bbee..adb9ca8ec8f92e7adc7c924aa8e5bba7bc2e4dad 100644 (file)
@@ -129,9 +129,15 @@ int spi_xfer(struct spi_slave *slave, unsigned int bitlen,
        int len = bitlen / 8;
        const char *tx = dout;
        char *rx = din;
-
-       if (bitlen == 0)
-               return 0;
+       char dummy;
+
+       if (bitlen == 0) {
+               if (flags & SPI_XFER_END) {
+                       rx = &dummy;
+                       len = 1;
+               } else
+                       return 0;
+       }
 
        if (!rx && !tx)
                return 0;
index 77e217f34fa3712b80c74f0a3941bb72a426cb7c..7c4df534bf2bfd4c1ab69c70d265ce2297a42db8 100644 (file)
@@ -43,9 +43,10 @@ endif
 COBJS-$(CONFIG_USB_EHCI_MXC) += ehci-mxc.o
 COBJS-$(CONFIG_USB_EHCI_MXS) += ehci-mxs.o
 COBJS-$(CONFIG_USB_EHCI_MX5) += ehci-mx5.o
+COBJS-$(CONFIG_USB_EHCI_OMAP) += ehci-omap.o
 COBJS-$(CONFIG_USB_EHCI_PPC4XX) += ehci-ppc4xx.o
 COBJS-$(CONFIG_USB_EHCI_IXP4XX) += ehci-ixp.o
-COBJS-$(CONFIG_USB_EHCI_KIRKWOOD) += ehci-kirkwood.o
+COBJS-$(CONFIG_USB_EHCI_MARVELL) += ehci-marvell.o
 COBJS-$(CONFIG_USB_EHCI_PCI) += ehci-pci.o
 COBJS-$(CONFIG_USB_EHCI_VCT) += ehci-vct.o
 
diff --git a/drivers/usb/host/ehci-kirkwood.c b/drivers/usb/host/ehci-kirkwood.c
deleted file mode 100644 (file)
index 6300587..0000000
+++ /dev/null
@@ -1,108 +0,0 @@
-/*
- * (C) Copyright 2009
- * Marvell Semiconductor <www.marvell.com>
- * Written-by: Prafulla Wadaskar <prafulla@marvell.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., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301 USA
- */
-
-#include <common.h>
-#include <asm/io.h>
-#include <usb.h>
-#include "ehci.h"
-#include "ehci-core.h"
-#include <asm/arch/cpu.h>
-#include <asm/arch/kirkwood.h>
-
-#define rdl(off)       readl(KW_USB20_BASE + (off))
-#define wrl(off, val)  writel((val), KW_USB20_BASE + (off))
-
-#define USB_WINDOW_CTRL(i)     (0x320 + ((i) << 4))
-#define USB_WINDOW_BASE(i)     (0x324 + ((i) << 4))
-#define USB_TARGET_DRAM                0x0
-
-/*
- * USB 2.0 Bridge Address Decoding registers setup
- */
-static void usb_brg_adrdec_setup(void)
-{
-       int i;
-       u32 size, attrib;
-
-       for (i = 0; i < CONFIG_NR_DRAM_BANKS; i++) {
-
-               /* Enable DRAM bank */
-               switch (i) {
-               case 0:
-                       attrib = KWCPU_ATTR_DRAM_CS0;
-                       break;
-               case 1:
-                       attrib = KWCPU_ATTR_DRAM_CS1;
-                       break;
-               case 2:
-                       attrib = KWCPU_ATTR_DRAM_CS2;
-                       break;
-               case 3:
-                       attrib = KWCPU_ATTR_DRAM_CS3;
-                       break;
-               default:
-                       /* invalide bank, disable access */
-                       attrib = 0;
-                       break;
-               }
-
-               size = kw_sdram_bs(i);
-               if ((size) && (attrib))
-                       wrl(USB_WINDOW_CTRL(i),
-                               KWCPU_WIN_CTRL_DATA(size, USB_TARGET_DRAM,
-                                       attrib, KWCPU_WIN_ENABLE));
-               else
-                       wrl(USB_WINDOW_CTRL(i), KWCPU_WIN_DISABLE);
-
-               wrl(USB_WINDOW_BASE(i), kw_sdram_bar(i));
-       }
-}
-
-/*
- * Create the appropriate control structures to manage
- * a new EHCI host controller.
- */
-int ehci_hcd_init(void)
-{
-       usb_brg_adrdec_setup();
-
-       hccr = (struct ehci_hccr *)(KW_USB20_BASE + 0x100);
-       hcor = (struct ehci_hcor *)((uint32_t) hccr
-                       + HC_LENGTH(ehci_readl(&hccr->cr_capbase)));
-
-       debug("Kirkwood-ehci: init hccr %x and hcor %x hc_length %d\n",
-               (uint32_t)hccr, (uint32_t)hcor,
-               (uint32_t)HC_LENGTH(ehci_readl(&hccr->cr_capbase)));
-
-       return 0;
-}
-
-/*
- * Destroy the appropriate control structures corresponding
- * the the EHCI host controller.
- */
-int ehci_hcd_stop(void)
-{
-       return 0;
-}
diff --git a/drivers/usb/host/ehci-marvell.c b/drivers/usb/host/ehci-marvell.c
new file mode 100644 (file)
index 0000000..89c8af7
--- /dev/null
@@ -0,0 +1,116 @@
+/*
+ * (C) Copyright 2009
+ * Marvell Semiconductor <www.marvell.com>
+ * Written-by: Prafulla Wadaskar <prafulla@marvell.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., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301 USA
+ */
+
+#include <common.h>
+#include <asm/io.h>
+#include <usb.h>
+#include "ehci.h"
+#include "ehci-core.h"
+#include <asm/arch/cpu.h>
+
+#if defined(CONFIG_KIRKWOOD)
+#include <asm/arch/kirkwood.h>
+#elif defined(CONFIG_ORION5X)
+#include <asm/arch/orion5x.h>
+#endif
+
+DECLARE_GLOBAL_DATA_PTR;
+
+#define rdl(off)       readl(MVUSB0_BASE + (off))
+#define wrl(off, val)  writel((val), MVUSB0_BASE + (off))
+
+#define USB_WINDOW_CTRL(i)     (0x320 + ((i) << 4))
+#define USB_WINDOW_BASE(i)     (0x324 + ((i) << 4))
+#define USB_TARGET_DRAM                0x0
+
+/*
+ * USB 2.0 Bridge Address Decoding registers setup
+ */
+static void usb_brg_adrdec_setup(void)
+{
+       int i;
+       u32 size, base, attrib;
+
+       for (i = 0; i < CONFIG_NR_DRAM_BANKS; i++) {
+
+               /* Enable DRAM bank */
+               switch (i) {
+               case 0:
+                       attrib = MVUSB0_CPU_ATTR_DRAM_CS0;
+                       break;
+               case 1:
+                       attrib = MVUSB0_CPU_ATTR_DRAM_CS1;
+                       break;
+               case 2:
+                       attrib = MVUSB0_CPU_ATTR_DRAM_CS2;
+                       break;
+               case 3:
+                       attrib = MVUSB0_CPU_ATTR_DRAM_CS3;
+                       break;
+               default:
+                       /* invalide bank, disable access */
+                       attrib = 0;
+                       break;
+               }
+
+               size = gd->bd->bi_dram[i].size;
+               base = gd->bd->bi_dram[i].start;
+               if ((size) && (attrib))
+                       wrl(USB_WINDOW_CTRL(i),
+                               MVCPU_WIN_CTRL_DATA(size, USB_TARGET_DRAM,
+                                       attrib, MVCPU_WIN_ENABLE));
+               else
+                       wrl(USB_WINDOW_CTRL(i), MVCPU_WIN_DISABLE);
+
+               wrl(USB_WINDOW_BASE(i), base);
+       }
+}
+
+/*
+ * Create the appropriate control structures to manage
+ * a new EHCI host controller.
+ */
+int ehci_hcd_init(void)
+{
+       usb_brg_adrdec_setup();
+
+       hccr = (struct ehci_hccr *)(MVUSB0_BASE + 0x100);
+       hcor = (struct ehci_hcor *)((uint32_t) hccr
+                       + HC_LENGTH(ehci_readl(&hccr->cr_capbase)));
+
+       debug("ehci-marvell: init hccr %x and hcor %x hc_length %d\n",
+               (uint32_t)hccr, (uint32_t)hcor,
+               (uint32_t)HC_LENGTH(ehci_readl(&hccr->cr_capbase)));
+
+       return 0;
+}
+
+/*
+ * Destroy the appropriate control structures corresponding
+ * the the EHCI host controller.
+ */
+int ehci_hcd_stop(void)
+{
+       return 0;
+}
diff --git a/drivers/usb/host/ehci-omap.c b/drivers/usb/host/ehci-omap.c
new file mode 100644 (file)
index 0000000..00f787f
--- /dev/null
@@ -0,0 +1,255 @@
+/*
+ * (C) Copyright 2011 Ilya Yanok, Emcraft Systems
+ * (C) Copyright 2004-2008
+ * Texas Instruments, <www.ti.com>
+ *
+ * Derived from Beagle Board code by
+ *     Sunil Kumar <sunilsaini05@gmail.com>
+ *     Shashi Ranjan <shashiranjanmca05@gmail.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.
+ */
+#include <common.h>
+#include <usb.h>
+#include <usb/ulpi.h>
+#include <errno.h>
+#include <asm/io.h>
+#include <asm/gpio.h>
+#include <asm/arch/ehci.h>
+#include <asm/ehci-omap.h>
+#include "ehci-core.h"
+
+static struct omap_uhh *const uhh = (struct omap_uhh *)OMAP_UHH_BASE;
+static struct omap_usbtll *const usbtll = (struct omap_usbtll *)OMAP_USBTLL_BASE;
+static struct omap_ehci *const ehci = (struct omap_ehci *)OMAP_EHCI_BASE;
+
+static int omap_uhh_reset(void)
+{
+       unsigned long init = get_timer(0);
+
+       /* perform UHH soft reset, and wait until reset is complete */
+       writel(OMAP_UHH_SYSCONFIG_SOFTRESET, &uhh->sysc);
+
+       /* Wait for UHH reset to complete */
+       while (!(readl(&uhh->syss) & OMAP_UHH_SYSSTATUS_EHCI_RESETDONE))
+               if (get_timer(init) > CONFIG_SYS_HZ) {
+                       debug("OMAP UHH error: timeout resetting ehci\n");
+                       return -EL3RST;
+               }
+
+       return 0;
+}
+
+static int omap_ehci_tll_reset(void)
+{
+       unsigned long init = get_timer(0);
+
+       /* perform TLL soft reset, and wait until reset is complete */
+       writel(OMAP_USBTLL_SYSCONFIG_SOFTRESET, &usbtll->sysc);
+
+       /* Wait for TLL reset to complete */
+       while (!(readl(&usbtll->syss) & OMAP_USBTLL_SYSSTATUS_RESETDONE))
+               if (get_timer(init) > CONFIG_SYS_HZ) {
+                       debug("OMAP EHCI error: timeout resetting TLL\n");
+                       return -EL3RST;
+       }
+
+       return 0;
+}
+
+static void omap_usbhs_hsic_init(int port)
+{
+       unsigned int reg;
+
+       /* Enable channels now */
+       reg = readl(&usbtll->channel_conf + port);
+
+       setbits_le32(&reg, (OMAP_TLL_CHANNEL_CONF_CHANMODE_TRANSPARENT_UTMI
+               | OMAP_TLL_CHANNEL_CONF_ULPINOBITSTUFF
+               | OMAP_TLL_CHANNEL_CONF_DRVVBUS
+               | OMAP_TLL_CHANNEL_CONF_CHRGVBUS
+               | OMAP_TLL_CHANNEL_CONF_CHANEN));
+
+       writel(reg, &usbtll->channel_conf + port);
+}
+
+static void omap_ehci_soft_phy_reset(int port)
+{
+       struct ulpi_viewport ulpi_vp;
+
+       ulpi_vp.viewport_addr = (u32)&ehci->insreg05_utmi_ulpi;
+       ulpi_vp.port_num = port;
+
+       ulpi_reset(&ulpi_vp);
+}
+
+inline int __board_usb_init(void)
+{
+       return 0;
+}
+int board_usb_init(void) __attribute__((weak, alias("__board_usb_init")));
+
+#if defined(CONFIG_OMAP_EHCI_PHY1_RESET_GPIO) || \
+       defined(CONFIG_OMAP_EHCI_PHY2_RESET_GPIO)
+/* controls PHY(s) reset signal(s) */
+static inline void omap_ehci_phy_reset(int on, int delay)
+{
+       /*
+        * Refer ISSUE1:
+        * Hold the PHY in RESET for enough time till
+        * PHY is settled and ready
+        */
+       if (delay && !on)
+               udelay(delay);
+#ifdef CONFIG_OMAP_EHCI_PHY1_RESET_GPIO
+       gpio_request(CONFIG_OMAP_EHCI_PHY1_RESET_GPIO, "USB PHY1 reset");
+       gpio_direction_output(CONFIG_OMAP_EHCI_PHY1_RESET_GPIO, !on);
+#endif
+#ifdef CONFIG_OMAP_EHCI_PHY2_RESET_GPIO
+       gpio_request(CONFIG_OMAP_EHCI_PHY2_RESET_GPIO, "USB PHY2 reset");
+       gpio_direction_output(CONFIG_OMAP_EHCI_PHY2_RESET_GPIO, !on);
+#endif
+
+       /* Hold the PHY in RESET for enough time till DIR is high */
+       /* Refer: ISSUE1 */
+       if (delay && on)
+               udelay(delay);
+}
+#else
+#define omap_ehci_phy_reset(on, delay) do {} while (0)
+#endif
+
+/* Reset is needed otherwise the kernel-driver will throw an error. */
+int omap_ehci_hcd_stop(void)
+{
+       debug("Resetting OMAP EHCI\n");
+       omap_ehci_phy_reset(1, 0);
+
+       if (omap_uhh_reset() < 0)
+               return -1;
+
+       if (omap_ehci_tll_reset() < 0)
+               return -1;
+
+       return 0;
+}
+
+/*
+ * Initialize the OMAP EHCI controller and PHY.
+ * Based on "drivers/usb/host/ehci-omap.c" from Linux 3.1
+ * See there for additional Copyrights.
+ */
+int omap_ehci_hcd_init(struct omap_usbhs_board_data *usbhs_pdata)
+{
+       int ret;
+       unsigned int i, reg = 0, rev = 0;
+
+       debug("Initializing OMAP EHCI\n");
+
+       ret = board_usb_init();
+       if (ret < 0)
+               return ret;
+
+       /* Put the PHY in RESET */
+       omap_ehci_phy_reset(1, 10);
+
+       ret = omap_uhh_reset();
+       if (ret < 0)
+               return ret;
+
+       ret = omap_ehci_tll_reset();
+       if (ret)
+               return ret;
+
+       writel(OMAP_USBTLL_SYSCONFIG_ENAWAKEUP |
+               OMAP_USBTLL_SYSCONFIG_SIDLEMODE |
+               OMAP_USBTLL_SYSCONFIG_CACTIVITY, &usbtll->sysc);
+
+       /* Put UHH in NoIdle/NoStandby mode */
+       writel(OMAP_UHH_SYSCONFIG_VAL, &uhh->sysc);
+
+       /* setup ULPI bypass and burst configurations */
+       clrsetbits_le32(&reg, OMAP_UHH_HOSTCONFIG_INCRX_ALIGN_EN,
+               (OMAP_UHH_HOSTCONFIG_INCR4_BURST_EN |
+               OMAP_UHH_HOSTCONFIG_INCR8_BURST_EN |
+               OMAP_UHH_HOSTCONFIG_INCR16_BURST_EN));
+
+       rev = readl(&uhh->rev);
+       if (rev == OMAP_USBHS_REV1) {
+               if (is_ehci_phy_mode(usbhs_pdata->port_mode[0]))
+                       clrbits_le32(&reg, OMAP_UHH_HOSTCONFIG_ULPI_P1_BYPASS);
+               else
+                       setbits_le32(&reg, OMAP_UHH_HOSTCONFIG_ULPI_P1_BYPASS);
+
+               if (is_ehci_phy_mode(usbhs_pdata->port_mode[1]))
+                       clrbits_le32(&reg, OMAP_UHH_HOSTCONFIG_ULPI_P2_BYPASS);
+               else
+                       setbits_le32(&reg, OMAP_UHH_HOSTCONFIG_ULPI_P1_BYPASS);
+
+               if (is_ehci_phy_mode(usbhs_pdata->port_mode[2]))
+                       clrbits_le32(&reg, OMAP_UHH_HOSTCONFIG_ULPI_P3_BYPASS);
+               else
+                       setbits_le32(&reg, OMAP_UHH_HOSTCONFIG_ULPI_P1_BYPASS);
+       } else if (rev == OMAP_USBHS_REV2) {
+               clrsetbits_le32(&reg, (OMAP_P1_MODE_CLEAR | OMAP_P2_MODE_CLEAR),
+                                       OMAP4_UHH_HOSTCONFIG_APP_START_CLK);
+
+               /* Clear port mode fields for PHY mode*/
+
+               if (is_ehci_hsic_mode(usbhs_pdata->port_mode[0]))
+                       setbits_le32(&reg, OMAP_P1_MODE_HSIC);
+
+               if (is_ehci_hsic_mode(usbhs_pdata->port_mode[1]))
+                       setbits_le32(&reg, OMAP_P2_MODE_HSIC);
+
+               if (is_ehci_hsic_mode(usbhs_pdata->port_mode[2]))
+                       setbits_le32(&reg, OMAP_P3_MODE_HSIC);
+       }
+
+       debug("OMAP UHH_REVISION 0x%x\n", rev);
+       writel(reg, &uhh->hostconfig);
+
+       for (i = 0; i < OMAP_HS_USB_PORTS; i++)
+               if (is_ehci_hsic_mode(usbhs_pdata->port_mode[i]))
+                       omap_usbhs_hsic_init(i);
+
+       omap_ehci_phy_reset(0, 10);
+
+       /*
+        * An undocumented "feature" in the OMAP3 EHCI controller,
+        * causes suspended ports to be taken out of suspend when
+        * the USBCMD.Run/Stop bit is cleared (for example when
+        * we do ehci_bus_suspend).
+        * This breaks suspend-resume if the root-hub is allowed
+        * to suspend. Writing 1 to this undocumented register bit
+        * disables this feature and restores normal behavior.
+        */
+       writel(EHCI_INSNREG04_DISABLE_UNSUSPEND, &ehci->insreg04);
+
+       for (i = 0; i < OMAP_HS_USB_PORTS; i++)
+               if (is_ehci_phy_mode(usbhs_pdata->port_mode[i]))
+                       omap_ehci_soft_phy_reset(i);
+
+       dcache_disable();
+       hccr = (struct ehci_hccr *)(OMAP_EHCI_BASE);
+       hcor = (struct ehci_hcor *)(OMAP_EHCI_BASE + 0x10);
+
+       debug("OMAP EHCI init done\n");
+       return 0;
+}
index d43b2293e1f0badb0db008a25017b53df253b823..281eb1c5c12cb8876935e31e28c2e1c7d5ee673e 100644 (file)
@@ -24,6 +24,7 @@ LIB   := $(obj)libusb_ulpi.o
 
 COBJS-$(CONFIG_USB_ULPI)               += ulpi.o
 COBJS-$(CONFIG_USB_ULPI_VIEWPORT)      += ulpi-viewport.o
+COBJS-$(CONFIG_USB_ULPI_VIEWPORT_OMAP) += omap-ulpi-viewport.o
 
 COBJS  := $(COBJS-y)
 SRCS   := $(COBJS:.o=.c)
diff --git a/drivers/usb/ulpi/omap-ulpi-viewport.c b/drivers/usb/ulpi/omap-ulpi-viewport.c
new file mode 100644 (file)
index 0000000..3c1ea1a
--- /dev/null
@@ -0,0 +1,105 @@
+/*
+ * OMAP ulpi viewport support
+ * Based on drivers/usb/ulpi/ulpi-viewport.c
+ *
+ * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com
+ * Author: Govindraj R <govindraj.raja@ti.com>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2  of
+ * the License 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, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <common.h>
+#include <asm/io.h>
+#include <usb/ulpi.h>
+
+#define OMAP_ULPI_WR_OPSEL     (3 << 21)
+#define OMAP_ULPI_ACCESS       (1 << 31)
+
+/*
+ * Wait for the ULPI Access to complete
+ */
+static int ulpi_wait(struct ulpi_viewport *ulpi_vp, u32 mask)
+{
+       int timeout = CONFIG_USB_ULPI_TIMEOUT;
+
+       while (--timeout) {
+               if ((readl(ulpi_vp->viewport_addr) & mask))
+                       return 0;
+
+               udelay(1);
+       }
+
+       return ULPI_ERROR;
+}
+
+/*
+ * Wake the ULPI PHY up for communication
+ *
+ * returns 0 on success.
+ */
+static int ulpi_wakeup(struct ulpi_viewport *ulpi_vp)
+{
+       int err;
+
+       if (readl(ulpi_vp->viewport_addr) & OMAP_ULPI_ACCESS)
+               return 0; /* already awake */
+
+       writel(OMAP_ULPI_ACCESS, ulpi_vp->viewport_addr);
+
+       err = ulpi_wait(ulpi_vp, OMAP_ULPI_ACCESS);
+       if (err)
+               debug("ULPI wakeup timed out\n");
+
+       return err;
+}
+
+/*
+ * Issue a ULPI read/write request
+ */
+static int ulpi_request(struct ulpi_viewport *ulpi_vp, u32 value)
+{
+       int err;
+
+       err = ulpi_wakeup(ulpi_vp);
+       if (err)
+               return err;
+
+       writel(value, ulpi_vp->viewport_addr);
+
+       err = ulpi_wait(ulpi_vp, OMAP_ULPI_ACCESS);
+       if (err)
+               debug("ULPI request timed out\n");
+
+       return err;
+}
+
+int ulpi_write(struct ulpi_viewport *ulpi_vp, u8 *reg, u32 value)
+{
+       u32 val = ((ulpi_vp->port_num & 0xf) << 24) |
+                       OMAP_ULPI_WR_OPSEL | ((u32)reg << 16) | (value & 0xff);
+
+       return ulpi_request(ulpi_vp, val);
+}
+
+u32 ulpi_read(struct ulpi_viewport *ulpi_vp, u8 *reg)
+{
+       int err;
+       u32 val = ((ulpi_vp->port_num & 0xf) << 24) |
+                        OMAP_ULPI_WR_OPSEL | ((u32)reg << 16);
+
+       err = ulpi_request(ulpi_vp, val);
+       if (err)
+               return err;
+
+       return readl(ulpi_vp->viewport_addr) & 0xff;
+}
index 490fb0e25d8ca4c5c80ff5fd40ba3e0cd9d6247e..b4974ed2a6cd8e418235bf37e1cdc5bed3d77351 100644 (file)
  *
  * returns 0 on mask match, ULPI_ERROR on time out.
  */
-static int ulpi_wait(u32 ulpi_viewport, u32 mask)
+static int ulpi_wait(struct ulpi_viewport *ulpi_vp, u32 mask)
 {
        int timeout = CONFIG_USB_ULPI_TIMEOUT;
 
        /* Wait for the bits in mask to become zero. */
        while (--timeout) {
-               if ((readl(ulpi_viewport) & mask) == 0)
+               if ((readl(ulpi_vp->viewport_addr) & mask) == 0)
                        return 0;
 
                udelay(1);
@@ -60,16 +60,16 @@ static int ulpi_wait(u32 ulpi_viewport, u32 mask)
  *
  * returns 0 on success.
  */
-static int ulpi_wakeup(u32 ulpi_viewport)
+static int ulpi_wakeup(struct ulpi_viewport *ulpi_vp)
 {
        int err;
 
-       if (readl(ulpi_viewport) & ULPI_SS)
+       if (readl(ulpi_vp->viewport_addr) & ULPI_SS)
                return 0; /* already awake */
 
-       writel(ULPI_WU, ulpi_viewport);
+       writel(ULPI_WU, ulpi_vp->viewport_addr);
 
-       err = ulpi_wait(ulpi_viewport, ULPI_WU);
+       err = ulpi_wait(ulpi_vp, ULPI_WU);
        if (err)
                printf("ULPI wakeup timed out\n");
 
@@ -81,38 +81,40 @@ static int ulpi_wakeup(u32 ulpi_viewport)
  *
  * @value - the ULPI request
  */
-static int ulpi_request(u32 ulpi_viewport, u32 value)
+static int ulpi_request(struct ulpi_viewport *ulpi_vp, u32 value)
 {
        int err;
 
-       err = ulpi_wakeup(ulpi_viewport);
+       err = ulpi_wakeup(ulpi_vp);
        if (err)
                return err;
 
-       writel(value, ulpi_viewport);
+       writel(value, ulpi_vp->viewport_addr);
 
-       err = ulpi_wait(ulpi_viewport, ULPI_RWRUN);
+       err = ulpi_wait(ulpi_vp, ULPI_RWRUN);
        if (err)
                printf("ULPI request timed out\n");
 
        return err;
 }
 
-int ulpi_write(u32 ulpi_viewport, u8 *reg, u32 value)
+int ulpi_write(struct ulpi_viewport *ulpi_vp, u8 *reg, u32 value)
 {
        u32 val = ULPI_RWRUN | ULPI_RWCTRL | ((u32)reg << 16) | (value & 0xff);
 
-       return ulpi_request(ulpi_viewport, val);
+       val |= (ulpi_vp->port_num & 0x7) << 24;
+       return ulpi_request(ulpi_vp, val);
 }
 
-u32 ulpi_read(u32 ulpi_viewport, u8 *reg)
+u32 ulpi_read(struct ulpi_viewport *ulpi_vp, u8 *reg)
 {
        int err;
        u32 val = ULPI_RWRUN | ((u32)reg << 16);
 
-       err = ulpi_request(ulpi_viewport, val);
+       val |= (ulpi_vp->port_num & 0x7) << 24;
+       err = ulpi_request(ulpi_vp, val);
        if (err)
                return err;
 
-       return (readl(ulpi_viewport) >> 8) & 0xff;
+       return (readl(ulpi_vp->viewport_addr) >> 8) & 0xff;
 }
index 6202227992233fdda2cd2f40a6301d1671e9049e..dde2585c58b8419465278701b925de8858a9430b 100644 (file)
 
 static struct ulpi_regs *ulpi = (struct ulpi_regs *)0;
 
-static int ulpi_integrity_check(u32 ulpi_viewport)
+static int ulpi_integrity_check(struct ulpi_viewport *ulpi_vp)
 {
        u32 val, tval = ULPI_TEST_VALUE;
        int err, i;
 
        /* Use the 'special' test value to check all bits */
        for (i = 0; i < 2; i++, tval <<= 1) {
-               err = ulpi_write(ulpi_viewport, &ulpi->scratch, tval);
+               err = ulpi_write(ulpi_vp, &ulpi->scratch, tval);
                if (err)
                        return err;
 
-               val = ulpi_read(ulpi_viewport, &ulpi->scratch);
+               val = ulpi_read(ulpi_vp, &ulpi->scratch);
                if (val != tval) {
                        printf("ULPI integrity check failed\n");
                        return val;
@@ -58,7 +58,7 @@ static int ulpi_integrity_check(u32 ulpi_viewport)
        return 0;
 }
 
-int ulpi_init(u32 ulpi_viewport)
+int ulpi_init(struct ulpi_viewport *ulpi_vp)
 {
        u32 val, id = 0;
        u8 *reg = &ulpi->product_id_high;
@@ -66,7 +66,7 @@ int ulpi_init(u32 ulpi_viewport)
 
        /* Assemble ID from four ULPI ID registers (8 bits each). */
        for (i = 0; i < ULPI_ID_REGS_COUNT; i++) {
-               val = ulpi_read(ulpi_viewport, reg - i);
+               val = ulpi_read(ulpi_vp, reg - i);
                if (val == ULPI_ERROR)
                        return val;
 
@@ -76,10 +76,10 @@ int ulpi_init(u32 ulpi_viewport)
        /* Split ID into vendor and product ID. */
        debug("ULPI transceiver ID 0x%04x:0x%04x\n", id >> 16, id & 0xffff);
 
-       return ulpi_integrity_check(ulpi_viewport);
+       return ulpi_integrity_check(ulpi_vp);
 }
 
-int ulpi_select_transceiver(u32 ulpi_viewport, unsigned speed)
+int ulpi_select_transceiver(struct ulpi_viewport *ulpi_vp, unsigned speed)
 {
        u32 tspeed = ULPI_FC_FULL_SPEED;
        u32 val;
@@ -96,17 +96,18 @@ int ulpi_select_transceiver(u32 ulpi_viewport, unsigned speed)
                        "falling back to full speed\n", __func__, speed);
        }
 
-       val = ulpi_read(ulpi_viewport, &ulpi->function_ctrl);
+       val = ulpi_read(ulpi_vp, &ulpi->function_ctrl);
        if (val == ULPI_ERROR)
                return val;
 
        /* clear the previous speed setting */
        val = (val & ~ULPI_FC_XCVRSEL_MASK) | tspeed;
 
-       return ulpi_write(ulpi_viewport, &ulpi->function_ctrl, val);
+       return ulpi_write(ulpi_vp, &ulpi->function_ctrl, val);
 }
 
-int ulpi_set_vbus(u32 ulpi_viewport, int on, int ext_power, int ext_ind)
+int ulpi_set_vbus(struct ulpi_viewport *ulpi_vp, int on, int ext_power,
+                       int ext_ind)
 {
        u32 flags = ULPI_OTG_DRVVBUS;
        u8 *reg = on ? &ulpi->otg_ctrl_set : &ulpi->otg_ctrl_clear;
@@ -116,18 +117,18 @@ int ulpi_set_vbus(u32 ulpi_viewport, int on, int ext_power, int ext_ind)
        if (ext_ind)
                flags |= ULPI_OTG_EXTVBUSIND;
 
-       return ulpi_write(ulpi_viewport, reg, flags);
+       return ulpi_write(ulpi_vp, reg, flags);
 }
 
-int ulpi_set_pd(u32 ulpi_viewport, int enable)
+int ulpi_set_pd(struct ulpi_viewport *ulpi_vp, int enable)
 {
        u32 val = ULPI_OTG_DP_PULLDOWN | ULPI_OTG_DM_PULLDOWN;
        u8 *reg = enable ? &ulpi->otg_ctrl_set : &ulpi->otg_ctrl_clear;
 
-       return ulpi_write(ulpi_viewport, reg, val);
+       return ulpi_write(ulpi_vp, reg, val);
 }
 
-int ulpi_opmode_sel(u32 ulpi_viewport, unsigned opmode)
+int ulpi_opmode_sel(struct ulpi_viewport *ulpi_vp, unsigned opmode)
 {
        u32 topmode = ULPI_FC_OPMODE_NORMAL;
        u32 val;
@@ -144,17 +145,17 @@ int ulpi_opmode_sel(u32 ulpi_viewport, unsigned opmode)
                        "falling back to OpMode Normal\n", __func__, opmode);
        }
 
-       val = ulpi_read(ulpi_viewport, &ulpi->function_ctrl);
+       val = ulpi_read(ulpi_vp, &ulpi->function_ctrl);
        if (val == ULPI_ERROR)
                return val;
 
        /* clear the previous opmode setting */
        val = (val & ~ULPI_FC_OPMODE_MASK) | topmode;
 
-       return ulpi_write(ulpi_viewport, &ulpi->function_ctrl, val);
+       return ulpi_write(ulpi_vp, &ulpi->function_ctrl, val);
 }
 
-int ulpi_serial_mode_enable(u32 ulpi_viewport, unsigned smode)
+int ulpi_serial_mode_enable(struct ulpi_viewport *ulpi_vp, unsigned smode)
 {
        switch (smode) {
        case ULPI_IFACE_6_PIN_SERIAL_MODE:
@@ -166,14 +167,14 @@ int ulpi_serial_mode_enable(u32 ulpi_viewport, unsigned smode)
                return ULPI_ERROR;
        }
 
-       return ulpi_write(ulpi_viewport, &ulpi->iface_ctrl_set, smode);
+       return ulpi_write(ulpi_vp, &ulpi->iface_ctrl_set, smode);
 }
 
-int ulpi_suspend(u32 ulpi_viewport)
+int ulpi_suspend(struct ulpi_viewport *ulpi_vp)
 {
        int err;
 
-       err = ulpi_write(ulpi_viewport, &ulpi->function_ctrl_clear,
+       err = ulpi_write(ulpi_vp, &ulpi->function_ctrl_clear,
                        ULPI_FC_SUSPENDM);
        if (err)
                printf("ULPI: %s: failed writing the suspend bit\n", __func__);
@@ -186,7 +187,7 @@ int ulpi_suspend(u32 ulpi_viewport)
  * Actual wait for reset must be done in a view port specific way,
  * because it involves checking the DIR line.
  */
-static int __ulpi_reset_wait(u32 ulpi_viewport)
+static int __ulpi_reset_wait(struct ulpi_viewport *ulpi_vp)
 {
        u32 val;
        int timeout = CONFIG_USB_ULPI_TIMEOUT;
@@ -199,7 +200,7 @@ static int __ulpi_reset_wait(u32 ulpi_viewport)
                 * for the error of ulpi_read(), if there is one, then
                 * there will be a timeout.
                 */
-               val = ulpi_read(ulpi_viewport, &ulpi->function_ctrl);
+               val = ulpi_read(ulpi_vp, &ulpi->function_ctrl);
                if (!(val & ULPI_FC_RESET))
                        return 0;
 
@@ -210,18 +211,19 @@ static int __ulpi_reset_wait(u32 ulpi_viewport)
 
        return ULPI_ERROR;
 }
-int ulpi_reset_wait(u32) __attribute__((weak, alias("__ulpi_reset_wait")));
+int ulpi_reset_wait(struct ulpi_viewport *ulpi_vp)
+       __attribute__((weak, alias("__ulpi_reset_wait")));
 
-int ulpi_reset(u32 ulpi_viewport)
+int ulpi_reset(struct ulpi_viewport *ulpi_vp)
 {
        int err;
 
-       err = ulpi_write(ulpi_viewport,
+       err = ulpi_write(ulpi_vp,
                        &ulpi->function_ctrl_set, ULPI_FC_RESET);
        if (err) {
                printf("ULPI: %s: failed writing reset bit\n", __func__);
                return err;
        }
 
-       return ulpi_reset_wait(ulpi_viewport);
+       return ulpi_reset_wait(ulpi_vp);
 }
index 3df1defab16f3f690b7d6880b96046e48f46ed95..a2c6b27d43cce33d1a00a033e4b33c895c4e1d8d 100644 (file)
@@ -265,7 +265,8 @@ int run_command     (const char *cmd, int flag);
 int run_command2(const char *cmd, int flag);
 #endif
 int    readline        (const char *const prompt);
-int    readline_into_buffer    (const char *const prompt, char * buffer);
+int    readline_into_buffer(const char *const prompt, char *buffer,
+                       int timeout);
 int    parse_line (char *, char *[]);
 void   init_cmd_timeout(void);
 void   reset_cmd_timeout(void);
@@ -284,6 +285,7 @@ int last_stage_init(void);
 extern ulong monitor_flash_len;
 int mac_read_from_eeprom(void);
 extern u8 _binary_dt_dtb_start[];      /* embedded device tree blob */
+int set_cpu_clk_info(void);
 
 /*
  * Called when console output is requested before the console is available.
index 16db98fe57cc09ade05355328ed085d32922d0f6..c26cb639b3ec2aac4b1c36ad96f9801e7c3338d6 100644 (file)
 #define CONFIG_ENV_SECT_SIZE   0x10000
 #elif defined(CONFIG_RAMBOOT_SDCARD)
 #define CONFIG_ENV_IS_IN_MMC
+#define CONFIG_FSL_FIXED_MMC_LOCATION
 #define CONFIG_ENV_SIZE                0x2000
 #define CONFIG_SYS_MMC_ENV_DEV  0
 #else
index af4609f841393a407287885232811108f239e24e..f2d33668d8d363497312ca6203e63f03ce36d7be 100644 (file)
@@ -519,10 +519,6 @@ extern unsigned long get_sdram_size(void);
 #endif
 
 #if defined(CONFIG_TSEC_ENET)
-#ifndef CONFIG_NET_MULTI
-#define CONFIG_NET_MULTI
-#endif
-
 #define CONFIG_MII                     /* MII PHY management */
 #define CONFIG_MII_DEFAULT_TSEC        1       /* Allow unregistered phys */
 #define CONFIG_TSEC1   1
@@ -609,6 +605,7 @@ extern unsigned long get_sdram_size(void);
 #if defined(CONFIG_SYS_RAMBOOT)
 #if defined(CONFIG_RAMBOOT_SDCARD)
 #define CONFIG_ENV_IS_IN_MMC
+#define CONFIG_FSL_FIXED_MMC_LOCATION
 #define CONFIG_SYS_MMC_ENV_DEV         0
 #define CONFIG_ENV_SIZE                        0x2000
 #elif defined(CONFIG_RAMBOOT_SPIFLASH)
index 00fa74d6f7b6261ae6548fe411474d9ffb8ca0da..2ac93be4ec59c277dfa3bdf62dd1dde01eb42cc3 100644 (file)
@@ -273,11 +273,10 @@ extern unsigned long get_board_sys_clk(unsigned long dummy);
 #endif
 #endif
 
+#define CONFIG_CMD_NAND
 #define CONFIG_SYS_NAND_BASE_LIST      {CONFIG_SYS_NAND_BASE}
 #define CONFIG_SYS_MAX_NAND_DEVICE     1
-#define NAND_MAX_CHIPS                 1
 #define CONFIG_MTD_NAND_VERIFY_WRITE
-#define CONFIG_CMD_NAND                        1
 #define CONFIG_NAND_FSL_ELBC           1
 #define CONFIG_SYS_NAND_BLOCK_SIZE     (16 * 1024)
 
@@ -519,6 +518,7 @@ extern unsigned long get_board_sys_clk(unsigned long dummy);
        #define CONFIG_ENV_OFFSET       ((512 * 1024) + CONFIG_SYS_NAND_BLOCK_SIZE)
 #elif defined(CONFIG_RAMBOOT_SDCARD)
 #define CONFIG_ENV_IS_IN_MMC
+#define CONFIG_FSL_FIXED_MMC_LOCATION
 #define CONFIG_ENV_SIZE                        0x2000
 #define CONFIG_SYS_MMC_ENV_DEV         0
 #elif defined(CONFIG_RAMBOOT_SPIFLASH)
index cf20d2b2eee2bf5444da0b9ea1db3ba50b8e4d4c..365322c6a59788bffaa4cfc3e3a8cdeae74057f8 100644 (file)
@@ -350,6 +350,7 @@ extern unsigned long get_board_sys_clk(unsigned long dummy);
  */
 #if defined(CONFIG_RAMBOOT_SDCARD)
        #define CONFIG_ENV_IS_IN_MMC    1
+       #define CONFIG_FSL_FIXED_MMC_LOCATION
        #define CONFIG_ENV_SIZE         0x2000
        #define CONFIG_SYS_MMC_ENV_DEV  0
 #elif defined(CONFIG_RAMBOOT_SPIFLASH)
index 2d9657a15347d5c038bc38ebf80a8cea2ead245b..f0eb0294aa72568740ce4bd5180a351c41b79ef6 100644 (file)
  */
 #if defined(CONFIG_SDCARD)
 #define CONFIG_ENV_IS_IN_MMC
+#define CONFIG_FSL_FIXED_MMC_LOCATION
 #define CONFIG_ENV_SIZE                        0x2000
 #define CONFIG_SYS_MMC_ENV_DEV         0
 #elif defined(CONFIG_SPIFLASH)
index a48055e2c5e9d19b1bd4d242775a54be8f18831f..da98f8f027481cda6336239580031c2df693ff31 100644 (file)
@@ -92,6 +92,7 @@
 #elif defined(CONFIG_SDCARD)
        #define CONFIG_SYS_EXTRA_ENV_RELOC
        #define CONFIG_ENV_IS_IN_MMC
+       #define CONFIG_FSL_FIXED_MMC_LOCATION
        #define CONFIG_SYS_MMC_ENV_DEV          0
        #define CONFIG_ENV_SIZE                 0x2000
        #define CONFIG_ENV_OFFSET               (512 * 1097)
index f4f93059fac24c6cb9047c77c97aa1506b173433..cde0fd67abff2e783611bfbefb1f18a84d9f914e 100644 (file)
  *
  * if CONFIG_ETHER_ON_SCC is selected, then
  *   - CONFIG_ETHER_INDEX must be set to the channel number (1-4)
- *   - CONFIG_NET_MULTI must not be defined
  *
  * if CONFIG_ETHER_ON_FCC is selected, then
  *   - one or more CONFIG_ETHER_ON_FCCx (x=1,2,3) must also be selected
- *   - CONFIG_NET_MULTI must be defined
  *
  * if CONFIG_ETHER_NONE is defined, then either the ethernet routines must be
  * defined elsewhere (as for the console), or CONFIG_CMD_NET must be unset.
index 28666d646b32e8c8e5fa8d60855b0b4413ee65d5..74ced5ae22f06505520530cd6bb1d17b347afe44 100644 (file)
  *
  * if CONFIG_ETHER_ON_SCC is selected, then
  *   - CONFIG_ETHER_INDEX must be set to the channel number (1-4)
- *   - CONFIG_NET_MULTI must not be defined
  *
  * if CONFIG_ETHER_ON_FCC is selected, then
  *   - one or more CONFIG_ETHER_ON_FCCx (x=1,2,3) must also be selected
- *   - CONFIG_NET_MULTI must be defined
  *
  * if CONFIG_ETHER_NONE is defined, then either the ethernet routines must be
  * defined elsewhere (as for the console), or CONFIG_CMD_NET must be unset.
index ed47a87820f0a461b84a334547ffac95dd449f69..b82095454ca74a93c6d2da190ba34ec9c2408d24 100644 (file)
 
 #define CONFIG_SYS_NAND_ECCSIZE        256
 #define CONFIG_SYS_NAND_ECCBYTES       3
-#define CONFIG_SYS_NAND_ECCSTEPS       (CONFIG_SYS_NAND_PAGE_SIZE / CONFIG_SYS_NAND_ECCSIZE)
 #define CONFIG_SYS_NAND_OOBSIZE        16
-#define CONFIG_SYS_NAND_ECCTOTAL       (CONFIG_SYS_NAND_ECCBYTES * CONFIG_SYS_NAND_ECCSTEPS)
 #define CONFIG_SYS_NAND_ECCPOS         {0, 1, 2, 3, 6, 7}
 #endif
 
index 77be3600f27b17db6eee8ad53b0aa3398186face..09760774fb59fef15b94a52fa4437061504b5de6 100644 (file)
 #endif
 #define CONFIG_SYS_FPGA_BASE           0xFF000000
 
+#define CONFIG_CMD_NAND
 #define CONFIG_SYS_MAX_NAND_DEVICE     1
-#define NAND_MAX_CHIPS                 1
 #define CONFIG_MTD_NAND_VERIFY_WRITE
-#define CONFIG_CMD_NAND                        1
 #define CONFIG_NAND_FSL_ELBC           1
 
 #define CONFIG_SYS_NAND_BR_PRELIM      (CONFIG_SYS_NAND_BASE \
index a370c150b23f072a85d4225a68131c40d9eb6598..76cd394db220b002fe15153aa6f1389f2b3cc362 100644 (file)
 /* Boot Argument Buffer Size */
 #define CONFIG_SYS_BARGSIZE            CONFIG_SYS_CBSIZE
 
-/* to be activated as soon as s3c24x0 has print_cpuinfo support */
-/*#define CONFIG_DISPLAY_CPUINFO*/                     /* Display cpu info */
+#define CONFIG_DISPLAY_CPUINFO                         /* Display cpu info */
 #define CONFIG_DISPLAY_BOARDINFO                       /* Display board info */
 
 #define CONFIG_SYS_MEMTEST_START       0x30000000      /* memtest works on */
 #define CONFIG_NAND_S3C2410
 #define CONFIG_SYS_S3C2410_NAND_HWECC
 #define CONFIG_SYS_MAX_NAND_DEVICE     1
-#define NAND_MAX_CHIPS                 1
 #define CONFIG_SYS_NAND_BASE           0x4E000000
 #define CONFIG_S3C24XX_CUSTOM_NAND_TIMING
 #define CONFIG_S3C24XX_TACLS           1
index 5573dc7a32f73a9397efac5e97e927a2b9837988..8c447ca951a00ac5c47c94adcedeb311c476a88a 100644 (file)
 
 #define CONFIG_SYS_NAND_ECCSIZE        256
 #define CONFIG_SYS_NAND_ECCBYTES       3
-#define CONFIG_SYS_NAND_ECCSTEPS       (CONFIG_SYS_NAND_PAGE_SIZE / CONFIG_SYS_NAND_ECCSIZE)
 #define CONFIG_SYS_NAND_OOBSIZE        16
-#define CONFIG_SYS_NAND_ECCTOTAL       (CONFIG_SYS_NAND_ECCBYTES * CONFIG_SYS_NAND_ECCSTEPS)
 #define CONFIG_SYS_NAND_ECCPOS         {0, 1, 2, 3, 6, 7}
 
 #ifdef CONFIG_ENV_IS_IN_NAND
index 2cea1f461278c8fb5b277efacf36a510fef3987f..6683b3ec29a281e182d82722e61130fd47e0e632 100644 (file)
 #define CONFIG_SYS_NS16550_CLK         (48000000)
 #define CONFIG_SYS_NS16550_COM1                0x44e09000      /* Base EVM has UART0 */
 
+/* I2C Configuration */
+#define CONFIG_I2C
+#define CONFIG_CMD_I2C
+#define CONFIG_HARD_I2C
+#define CONFIG_SYS_I2C_SPEED           100000
+#define CONFIG_SYS_I2C_SLAVE           1
+#define CONFIG_DRIVER_OMAP24XX_I2C
+
 #define CONFIG_BAUDRATE                115200
 #define CONFIG_SYS_BAUDRATE_TABLE      { 110, 300, 600, 1200, 2400, \
 4800, 9600, 14400, 19200, 28800, 38400, 56000, 57600, 115200 }
 #define CONFIG_SPL_FAT_LOAD_PAYLOAD_NAME       "u-boot.img"
 #define CONFIG_SPL_MMC_SUPPORT
 #define CONFIG_SPL_FAT_SUPPORT
+#define CONFIG_SPL_I2C_SUPPORT
 
 #define CONFIG_SPL_LIBCOMMON_SUPPORT
 #define CONFIG_SPL_LIBDISK_SUPPORT
index 0a0c261bf9507c1e9b5a2a200f8f1c355d2b2f44..b0dd2f0af61ff1f2ceb9ad8386909791e1b9b67a 100644 (file)
                                                10, 11, 12, 13}
 #define CONFIG_SYS_NAND_ECCSIZE                512
 #define CONFIG_SYS_NAND_ECCBYTES       3
-#define CONFIG_SYS_NAND_ECCSTEPS       (CONFIG_SYS_NAND_PAGE_SIZE / \
-                                               CONFIG_SYS_NAND_ECCSIZE)
-#define CONFIG_SYS_NAND_ECCTOTAL       (CONFIG_SYS_NAND_ECCBYTES * \
-                                               CONFIG_SYS_NAND_ECCSTEPS)
 #define CONFIG_SYS_NAND_U_BOOT_START   CONFIG_SYS_TEXT_BASE
 #define CONFIG_SYS_NAND_U_BOOT_OFFS    0x80000
 
index d44eeec5b68b98956ac946cb162c5e1919fbd8b1..b5f75d1e8da7a39704ebef21409479792f28633c 100644 (file)
        "console=ttyO2,115200n8\0" \
        "mmcdev=0\0" \
        "mmcargs=setenv bootargs console=${console} " \
-               "root=/dev/mmcblk0p2 rw " \
-               "rootfstype=ext3 rootwait\0" \
+               "root=/dev/mmcblk0p2 rw rootwait\0" \
        "nandargs=setenv bootargs console=${console} " \
                "root=/dev/mtdblock4 rw " \
                "rootfstype=jffs2\0" \
                                                10, 11, 12, 13}
 #define CONFIG_SYS_NAND_ECCSIZE                512
 #define CONFIG_SYS_NAND_ECCBYTES       3
-#define CONFIG_SYS_NAND_ECCSTEPS       (CONFIG_SYS_NAND_PAGE_SIZE / \
-                                               CONFIG_SYS_NAND_ECCSIZE)
-#define CONFIG_SYS_NAND_ECCTOTAL       (CONFIG_SYS_NAND_ECCBYTES * \
-                                               CONFIG_SYS_NAND_ECCSTEPS)
 #define CONFIG_SYS_NAND_U_BOOT_START   CONFIG_SYS_TEXT_BASE
 #define CONFIG_SYS_NAND_U_BOOT_OFFS    0x80000
 
index cf2e7d4323f2003131146fd34ad66e7449059989..c9f0076ee6a177f67f9e10ce0d5e64c7ac249ebe 100644 (file)
  */
 #define CONFIG_CMD_NAND                                        /* enable NAND support */
 #define CONFIG_JFFS2_NAND                              /* with JFFS2 on it */
-
-
 #define CONFIG_NAND_MPC5121_NFC
 #define CONFIG_SYS_NAND_BASE           0x40000000
-
 #define CONFIG_SYS_MAX_NAND_DEVICE     1
-#define NAND_MAX_CHIPS                 CONFIG_SYS_MAX_NAND_DEVICE
 
 /*
  * Configuration parameters for MPC5121 NAND driver
index 5ef6bd230770ab3055929c2679f8d0fe7bcdbdd2..6a02188108f0c4a2a3135457b3d2793e2ce01306 100644 (file)
 
 /* NAND flash */
 #ifdef CONFIG_CMD_NAND
-#define CONFIG_NAND_MAX_CHIPS                  1
 #define CONFIG_NAND_ATMEL
 #define CONFIG_SYS_MAX_NAND_DEVICE             1
 #define CONFIG_SYS_NAND_BASE                   ATMEL_BASE_CS3
index 7b66fc092a73a316539ace3e3aa6720766074c0f..506a558f14e5bf0262bb50818837072304d00799 100644 (file)
 
 #define CONFIG_SYS_NAND_ECCSIZE        256
 #define CONFIG_SYS_NAND_ECCBYTES       3
-#define CONFIG_SYS_NAND_ECCSTEPS       (CONFIG_SYS_NAND_PAGE_SIZE / CONFIG_SYS_NAND_ECCSIZE)
 #define CONFIG_SYS_NAND_OOBSIZE        16
-#define CONFIG_SYS_NAND_ECCTOTAL       (CONFIG_SYS_NAND_ECCBYTES * CONFIG_SYS_NAND_ECCSTEPS)
 #define CONFIG_SYS_NAND_ECCPOS         {0, 1, 2, 3, 6, 7}
 
 #ifdef CONFIG_ENV_IS_IN_NAND
index 1945c032ab5d78931b59088c8cd44bdc50c4ff35..003109329a2bb0dc67efb4273130ee4eba65e477 100644 (file)
@@ -70,7 +70,6 @@
 #define CONFIG_DRIVER_NAND_BFIN
 #define CONFIG_SYS_NAND_BASE           0 /* not actually used */
 #define CONFIG_SYS_MAX_NAND_DEVICE     1
-#define NAND_MAX_CHIPS         1
 #define CONFIG_CMD_NAND
 #endif
 
index 9c35f2d0b7808ba50debcbc52eef77b0897eac9a..fa05103e5aae3075c15fd3a8ff61bb4ce256b881 100644 (file)
@@ -69,7 +69,6 @@
 #define CONFIG_DRIVER_NAND_BFIN
 #define CONFIG_SYS_NAND_BASE           0 /* not actually used */
 #define CONFIG_SYS_MAX_NAND_DEVICE     1
-#define NAND_MAX_CHIPS         1
 #endif
 
 
index 1256e815d50825e4ccc065c6d04c135eca5d6eba..d80eac22db65e562050615d861c7fa3bdefb512c 100644 (file)
@@ -69,7 +69,6 @@
 #define CONFIG_DRIVER_NAND_BFIN
 #define CONFIG_SYS_NAND_BASE           0 /* not actually used */
 #define CONFIG_SYS_MAX_NAND_DEVICE     1
-#define NAND_MAX_CHIPS         1
 #endif
 
 
index 3eadcefb83e3dd28d20d1d3619796f67812fceab..89adfefee3797b8c129e8733d3ba9224cdfc35db 100644 (file)
 #define CONFIG_DRIVER_NAND_BFIN
 #define CONFIG_SYS_NAND_BASE           0 /* not actually used */
 #define CONFIG_SYS_MAX_NAND_DEVICE     1
-#define NAND_MAX_CHIPS         1
 
 
 /*
diff --git a/include/configs/br4.h b/include/configs/br4.h
new file mode 100644 (file)
index 0000000..ef3752d
--- /dev/null
@@ -0,0 +1,157 @@
+/*
+ * U-boot - Configuration file for BR4 Appliance
+ *
+ * based on bf537-stamp.h
+ * Copyright (c) Switchfin Org. <dpn@switchfin.org>
+ */
+
+#ifndef __CONFIG_BR4_H__
+#define __CONFIG_BR4_H__
+
+#include <asm/config-pre.h>
+
+
+/*
+ * Processor Settings
+ */
+#define CONFIG_BFIN_CPU             bf537-0.3
+#define CONFIG_BFIN_BOOT_MODE       BFIN_BOOT_SPI_MASTER
+
+
+/*
+ * Clock Settings
+ *     CCLK = (CLKIN * VCO_MULT) / CCLK_DIV
+ *     SCLK = (CLKIN * VCO_MULT) / SCLK_DIV
+ */
+/* CONFIG_CLKIN_HZ is any value in Hz                                  */
+#define CONFIG_CLKIN_HZ                        25000000
+/* CLKIN_HALF controls the DF bit in PLL_CTL      0 = CLKIN            */
+/*                                                1 = CLKIN / 2                */
+#define CONFIG_CLKIN_HALF              0
+/* PLL_BYPASS controls the BYPASS bit in PLL_CTL  0 = do not bypass    */
+/*                                                1 = bypass PLL       */
+#define CONFIG_PLL_BYPASS              0
+/* VCO_MULT controls the MSEL (multiplier) bits in PLL_CTL             */
+/* Values can range from 0-63 (where 0 means 64)                       */
+#define CONFIG_VCO_MULT                        24
+/* CCLK_DIV controls the core clock divider                            */
+/* Values can be 1, 2, 4, or 8 ONLY                                    */
+#define CONFIG_CCLK_DIV                        1
+/* SCLK_DIV controls the system clock divider                          */
+/* Values can range from 1-15                                          */
+#define CONFIG_SCLK_DIV                        5
+
+
+/*
+ * Memory Settings
+ */
+#define CONFIG_MEM_ADD_WDTH    10
+#define CONFIG_MEM_SIZE                64
+
+#define CONFIG_EBIU_SDRRC_VAL  0x306
+#define CONFIG_EBIU_SDGCTL_VAL 0x8091998d
+
+#define CONFIG_EBIU_AMGCTL_VAL 0xFF
+#define CONFIG_EBIU_AMBCTL0_VAL        0x7BB07BB0
+#define CONFIG_EBIU_AMBCTL1_VAL        0xFFC27BB0
+
+#define CONFIG_SYS_MONITOR_LEN         (512 * 1024)
+#define CONFIG_SYS_MALLOC_LEN          (384 * 1024)
+
+
+/*
+ * Network Settings
+ */
+#ifndef __ADSPBF534__
+#define ADI_CMDS_NETWORK       1
+#define CONFIG_BFIN_MAC
+#define CONFIG_NETCONSOLE
+#endif
+#define CONFIG_HOSTNAME                br4
+#define CONFIG_TFTP_BLOCKSIZE  4404
+/* Uncomment next line to use fixed MAC address */
+/* #define CONFIG_ETHADDR      5c:38:1a:80:a7:00 */
+
+
+/*
+ * Flash Settings
+ */
+#define CONFIG_SYS_NO_FLASH    /* We have no parallel FLASH */
+
+
+/*
+ * SPI Settings
+ */
+#define CONFIG_BFIN_SPI
+#define CONFIG_ENV_SPI_MAX_HZ  30000000
+#define CONFIG_SF_DEFAULT_SPEED        30000000
+#define CONFIG_SPI_FLASH
+#define CONFIG_SPI_FLASH_STMICRO
+
+
+/*
+ * Env Storage Settings
+ */
+#define CONFIG_ENV_IS_IN_SPI_FLASH
+#define CONFIG_ENV_OFFSET      0x10000
+#define CONFIG_ENV_SIZE                0x2000
+#define CONFIG_ENV_SECT_SIZE   0x10000
+#define CONFIG_ENV_IS_EMBEDDED_IN_LDR
+
+
+/*
+ * I2C Settings
+ */
+#define CONFIG_BFIN_TWI_I2C
+#define CONFIG_HARD_I2C
+
+
+/*
+ * NAND Settings
+ */
+#define CONFIG_NAND_PLAT
+#define CONFIG_SYS_NAND_BASE           0x20000000
+#define CONFIG_SYS_MAX_NAND_DEVICE     1
+
+#define BFIN_NAND_CLE(chip) ((unsigned long)(chip)->IO_ADDR_W | (1 << 2))
+#define BFIN_NAND_ALE(chip) ((unsigned long)(chip)->IO_ADDR_W | (1 << 1))
+#define BFIN_NAND_WRITE(addr, cmd) \
+       do { \
+               bfin_write8(addr, cmd); \
+               SSYNC(); \
+       } while (0)
+
+#define NAND_PLAT_WRITE_CMD(chip, cmd) BFIN_NAND_WRITE(BFIN_NAND_CLE(chip), cmd)
+#define NAND_PLAT_WRITE_ADR(chip, cmd) BFIN_NAND_WRITE(BFIN_NAND_ALE(chip), cmd)
+#define NAND_PLAT_GPIO_DEV_READY       GPIO_PF9
+
+/*
+ * Misc Settings
+ */
+#define CONFIG_BAUDRATE                115200
+#define CONFIG_RTC_BFIN
+#define CONFIG_UART_CONSOLE    0
+#define CONFIG_SYS_PROMPT      "br4>"
+#define CONFIG_BOOTCOMMAND     "run nandboot"
+#define CONFIG_BOOTDELAY       2
+#define CONFIG_LOADADDR                0x2000000
+
+
+/*
+ * Pull in common ADI header for remaining command/environment setup
+ */
+#include <configs/bfin_adi_common.h>
+
+/*
+ * Overwrite some settings defined in bfin_adi_common.h
+ */
+#undef NAND_ENV_SETTINGS
+#define NAND_ENV_SETTINGS \
+       "nandargs=set bootargs " CONFIG_BOOTARGS "\0" \
+       "nandboot=" \
+               "nand read $(loadaddr) 0x0 0x900000;" \
+               "run nandargs;" \
+               "bootm" \
+               "\0"
+
+#endif
diff --git a/include/configs/calimain.h b/include/configs/calimain.h
new file mode 100644 (file)
index 0000000..6b68f10
--- /dev/null
@@ -0,0 +1,363 @@
+/*
+ * Copyright (C) 2011 OMICRON electronics GmbH
+ *
+ * Based on da850evm.h. Original Copyrights follow:
+ *
+ * Copyright (C) 2010 Texas Instruments Incorporated - http://www.ti.com/
+ * Copyright (C) 2007 Sergey Kubushyn <ksi@koi8.net>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#ifndef __CONFIG_H
+#define __CONFIG_H
+
+/*
+ * Board
+ */
+#define CONFIG_DRIVER_TI_EMAC
+#define MACH_TYPE_CALIMAIN     3528
+#define CONFIG_MACH_TYPE       MACH_TYPE_CALIMAIN
+
+/*
+ * SoC Configuration
+ */
+#define CONFIG_MACH_DAVINCI_CALIMAIN
+#define CONFIG_ARM926EJS               /* arm926ejs CPU core */
+#define CONFIG_SOC_DA8XX               /* TI DA8xx SoC */
+#define CONFIG_SOC_DA850               /* TI DA850 SoC */
+#define CONFIG_SYS_EXCEPTION_VECTORS_HIGH
+#define CONFIG_SYS_CLK_FREQ            clk_get(DAVINCI_ARM_CLKID)
+#define CONFIG_SYS_OSCIN_FREQ          calimain_get_osc_freq()
+#define CONFIG_SYS_TIMERBASE           DAVINCI_TIMER0_BASE
+#define CONFIG_SYS_HZ_CLOCK            clk_get(DAVINCI_AUXCLK_CLKID)
+#define CONFIG_SYS_HZ                  1000
+#define CONFIG_SYS_TEXT_BASE           0x60000000
+#define CONFIG_DA850_LOWLEVEL
+#define CONFIG_SYS_DA850_PLL_INIT
+#define CONFIG_SYS_DA850_DDR_INIT
+#define CONFIG_ARCH_CPU_INIT
+#define CONFIG_DA8XX_GPIO
+#define CONFIG_HW_WATCHDOG
+#define CONFIG_SYS_WDTTIMERBASE        DAVINCI_TIMER1_BASE
+#define CONFIG_SYS_WDT_PERIOD_LOW \
+       (60 * CONFIG_SYS_OSCIN_FREQ) /* 60 s heartbeat */
+#define CONFIG_SYS_WDT_PERIOD_HIGH     0x0
+#define CONFIG_SYS_DV_NOR_BOOT_CFG     (0x11)
+
+/*
+ * PLL configuration
+ */
+#define CONFIG_SYS_DV_CLKMODE          0
+#define CONFIG_SYS_DA850_PLL0_POSTDIV  1
+#define CONFIG_SYS_DA850_PLL0_PLLDIV1  0x8000
+#define CONFIG_SYS_DA850_PLL0_PLLDIV2  0x8001
+#define CONFIG_SYS_DA850_PLL0_PLLDIV3  0x8002
+#define CONFIG_SYS_DA850_PLL0_PLLDIV4  0x8003
+#define CONFIG_SYS_DA850_PLL0_PLLDIV5  0x8002
+#define CONFIG_SYS_DA850_PLL0_PLLDIV6  CONFIG_SYS_DA850_PLL0_PLLDIV1
+#define CONFIG_SYS_DA850_PLL0_PLLDIV7  0x8005
+
+#define CONFIG_SYS_DA850_PLL1_POSTDIV  1
+#define CONFIG_SYS_DA850_PLL1_PLLDIV1  0x8000
+#define CONFIG_SYS_DA850_PLL1_PLLDIV2  0x8001
+#define CONFIG_SYS_DA850_PLL1_PLLDIV3  0x8002
+
+#define CONFIG_SYS_DA850_PLL0_PLLM \
+       ((calimain_get_osc_freq() == 25000000) ? 23 : 24)
+#define CONFIG_SYS_DA850_PLL1_PLLM \
+       ((calimain_get_osc_freq() == 25000000) ? 20 : 21)
+
+/*
+ * DDR2 memory configuration
+ */
+#define CONFIG_SYS_DA850_DDR2_DDRPHYCR (DV_DDR_PHY_PWRDNEN | \
+                                       DV_DDR_PHY_EXT_STRBEN | \
+                                       (0x4 << DV_DDR_PHY_RD_LATENCY_SHIFT))
+
+#define CONFIG_SYS_DA850_DDR2_SDBCR (          \
+       (1 << DV_DDR_SDCR_DDR2EN_SHIFT) |       \
+       (1 << DV_DDR_SDCR_DDRDRIVE0_SHIFT) |    \
+       (1 << DV_DDR_SDCR_DDREN_SHIFT) |        \
+       (1 << DV_DDR_SDCR_SDRAMEN_SHIFT) |      \
+       (1 << DV_DDR_SDCR_BUS_WIDTH_SHIFT) |    \
+       (0x3 << DV_DDR_SDCR_CL_SHIFT) |         \
+       (0x3 << DV_DDR_SDCR_IBANK_SHIFT) |      \
+       (0x2 << DV_DDR_SDCR_PAGESIZE_SHIFT))
+
+/* SDBCR2 is only used if IBANK_POS bit in SDBCR is set */
+#define CONFIG_SYS_DA850_DDR2_SDBCR2   0
+
+#define CONFIG_SYS_DA850_DDR2_SDTIMR (         \
+       (16 << DV_DDR_SDTMR1_RFC_SHIFT) |       \
+       (1 << DV_DDR_SDTMR1_RP_SHIFT) |         \
+       (1 << DV_DDR_SDTMR1_RCD_SHIFT) |        \
+       (1 << DV_DDR_SDTMR1_WR_SHIFT) |         \
+       (5 << DV_DDR_SDTMR1_RAS_SHIFT) |        \
+       (7 << DV_DDR_SDTMR1_RC_SHIFT) |         \
+       (1 << DV_DDR_SDTMR1_RRD_SHIFT) |        \
+       (1 << DV_DDR_SDTMR1_WTR_SHIFT))
+
+#define CONFIG_SYS_DA850_DDR2_SDTIMR2 (                \
+       (7 << DV_DDR_SDTMR2_RASMAX_SHIFT) |     \
+       (2 << DV_DDR_SDTMR2_XP_SHIFT) |         \
+       (0 << DV_DDR_SDTMR2_ODT_SHIFT) |        \
+       (18 << DV_DDR_SDTMR2_XSNR_SHIFT) |      \
+       (199 << DV_DDR_SDTMR2_XSRD_SHIFT) |     \
+       (0 << DV_DDR_SDTMR2_RTP_SHIFT) |        \
+       (2 << DV_DDR_SDTMR2_CKE_SHIFT))
+
+#define CONFIG_SYS_DA850_DDR2_SDRCR    0x000003FF
+#define CONFIG_SYS_DA850_DDR2_PBBPR    0x30
+
+/*
+ * Flash memory timing
+ */
+
+#define CONFIG_SYS_DA850_CS2CFG        (       \
+       DAVINCI_ABCR_WSETUP(2) |        \
+       DAVINCI_ABCR_WSTROBE(5) |       \
+       DAVINCI_ABCR_WHOLD(3) |         \
+       DAVINCI_ABCR_RSETUP(1) |        \
+       DAVINCI_ABCR_RSTROBE(14) |      \
+       DAVINCI_ABCR_RHOLD(0) |         \
+       DAVINCI_ABCR_TA(3) |            \
+       DAVINCI_ABCR_ASIZE_16BIT)
+
+/* single 64 MB NOR flash device connected to CS2 and CS3 */
+#define CONFIG_SYS_DA850_CS3CFG CONFIG_SYS_DA850_CS2CFG
+
+/*
+ * Memory Info
+ */
+#define CONFIG_SYS_MALLOC_LEN  (0x10000 + 1*1024*1024) /* malloc() len */
+#define PHYS_SDRAM_1           DAVINCI_DDR_EMIF_DATA_BASE /* DDR Start */
+#define PHYS_SDRAM_1_SIZE      (128 << 20) /* SDRAM size 128MB */
+#define CONFIG_MAX_RAM_BANK_SIZE (512 << 20) /* max size from SPRS586*/
+
+#define CONFIG_SYS_DA850_SYSCFG_SUSPSRC (      \
+       DAVINCI_SYSCFG_SUSPSRC_TIMER0 |         \
+       DAVINCI_SYSCFG_SUSPSRC_SPI1 |           \
+       DAVINCI_SYSCFG_SUSPSRC_UART2 |          \
+       DAVINCI_SYSCFG_SUSPSRC_EMAC |           \
+       DAVINCI_SYSCFG_SUSPSRC_I2C)
+
+/* memtest start addr */
+#define CONFIG_SYS_MEMTEST_START       (PHYS_SDRAM_1 + 0x2000000)
+
+/* memtest will be run on 16MB */
+#define CONFIG_SYS_MEMTEST_END         (CONFIG_SYS_MEMTEST_START + (16 << 20))
+
+#define CONFIG_NR_DRAM_BANKS   1 /* we have 1 bank of DRAM */
+#define CONFIG_STACKSIZE       (256*1024) /* regular stack */
+
+/*
+ * Serial Driver info
+ */
+#define CONFIG_SYS_NS16550
+#define CONFIG_SYS_NS16550_SERIAL
+#define CONFIG_SYS_NS16550_REG_SIZE    -4      /* NS16550 register size */
+#define CONFIG_SYS_NS16550_COM1        DAVINCI_UART2_BASE /* Base address of UART2 */
+#define CONFIG_SYS_NS16550_CLK clk_get(DAVINCI_UART2_CLKID)
+#define CONFIG_CONS_INDEX      1               /* use UART0 for console */
+#define CONFIG_BAUDRATE                115200          /* Default baud rate */
+#define CONFIG_SYS_BAUDRATE_TABLE      { 9600, 19200, 38400, 57600, 115200 }
+
+#define CONFIG_ENV_IS_IN_FLASH
+#define CONFIG_FLASH_CFI_DRIVER
+#define CONFIG_SYS_FLASH_CFI
+#define CONFIG_SYS_FLASH_PROTECTION
+#define CONFIG_SYS_FLASH_USE_BUFFER_WRITE
+#define CONFIG_SYS_MAX_FLASH_BANKS  1 /* max number of flash banks */
+#define CONFIG_SYS_FLASH_SECT_SZ    (128 << 10) /* 128KB */
+#define CONFIG_SYS_FLASH_BASE       DAVINCI_ASYNC_EMIF_DATA_CE2_BASE
+#define CONFIG_ENV_SECT_SIZE        CONFIG_SYS_FLASH_SECT_SZ
+#define CONFIG_ENV_ADDR \
+       (CONFIG_SYS_FLASH_BASE + CONFIG_SYS_FLASH_SECT_SZ * 2)
+#define CONFIG_ENV_SIZE             (128 << 10)
+#define CONFIG_ENV_ADDR_REDUND      (CONFIG_ENV_ADDR + CONFIG_ENV_SECT_SIZE)
+#define CONFIG_ENV_SIZE_REDUND      CONFIG_ENV_SIZE
+#define PHYS_FLASH_SIZE             (64 << 20) /* Flash size 64MB */
+#define CONFIG_SYS_MAX_FLASH_SECT \
+       ((PHYS_FLASH_SIZE/CONFIG_SYS_FLASH_SECT_SZ) + 3)
+
+/*
+ * Network & Ethernet Configuration
+ */
+#ifdef CONFIG_DRIVER_TI_EMAC
+#define CONFIG_EMAC_MDIO_PHY_NUM       1
+#define CONFIG_MII
+#define CONFIG_BOOTP_DEFAULT
+#define CONFIG_BOOTP_DNS
+#define CONFIG_BOOTP_DNS2
+#define CONFIG_BOOTP_SEND_HOSTNAME
+#define CONFIG_NET_RETRY_COUNT 10
+#endif
+
+/*
+ * U-Boot general configuration
+ */
+#define CONFIG_BOOTFILE        "uImage" /* Boot file name */
+#define CONFIG_SYS_PROMPT      "Calimain > " /* Command Prompt */
+#define CONFIG_SYS_CBSIZE      1024 /* Console I/O Buffer Size */
+#define CONFIG_SYS_PBSIZE      (CONFIG_SYS_CBSIZE+sizeof(CONFIG_SYS_PROMPT)+16)
+#define CONFIG_SYS_MAXARGS     16 /* max number of command args */
+#define CONFIG_SYS_BARGSIZE    CONFIG_SYS_CBSIZE /* Boot Args Buffer Size */
+#define CONFIG_SYS_LOAD_ADDR   (PHYS_SDRAM_1 + 0x700000)
+#define CONFIG_LOADADDR        0xc0700000
+#define CONFIG_VERSION_VARIABLE
+#define CONFIG_AUTO_COMPLETE
+#define CONFIG_SYS_HUSH_PARSER
+#define CONFIG_SYS_PROMPT_HUSH_PS2     "> "
+#define CONFIG_CMDLINE_EDITING
+#define CONFIG_SYS_LONGHELP
+#define CONFIG_CRC32_VERIFY
+#define CONFIG_MX_CYCLIC
+
+/*
+ * Linux Information
+ */
+#define LINUX_BOOT_PARAM_ADDR     (PHYS_SDRAM_1 + 0x100)
+#define CONFIG_CMDLINE_TAG
+#define CONFIG_REVISION_TAG
+#define CONFIG_SETUP_MEMORY_TAGS
+#define CONFIG_BOOTARGS           ""
+#define CONFIG_BOOTCOMMAND        "run checkupdate; run checkbutton;"
+#define CONFIG_BOOTDELAY          0
+#define CONFIG_ZERO_BOOTDELAY_CHECK   /* check for keypress on bootdelay==0 */
+#define CONFIG_BOOT_RETRY_TIME    60  /* continue boot after 60 s inactivity */
+#define CONFIG_AUTOBOOT_KEYED
+#define CONFIG_AUTOBOOT_DELAY_STR "\x0d" /* press ENTER to interrupt BOOT */
+#define CONFIG_RESET_TO_RETRY
+
+/*
+ * Default environment settings
+ * gpio0 = button, gpio1 = led green, gpio2 = led red
+ * verify = n ... disable kernel checksum verification for faster booting
+ */
+#define CONFIG_EXTRA_ENV_SETTINGS                                      \
+       "tftpdir=calimero\0"                                            \
+       "flashkernel=tftpboot $loadaddr $tftpdir/uImage; "              \
+               "erase 0x60800000 +0x400000; "                          \
+               "cp.b $loadaddr 0x60800000 $filesize\0"                 \
+       "flashrootfs="                                                  \
+               "tftpboot $loadaddr $tftpdir/rootfs.jffs2; "            \
+               "erase 0x60c00000 +0x2e00000; "                         \
+               "cp.b $loadaddr 0x60c00000 $filesize\0"                 \
+       "flashuboot=tftpboot $loadaddr $tftpdir/u-boot.bin; "           \
+               "protect off all; "                                     \
+               "erase 0x60000000 +0x80000; "                           \
+               "cp.b $loadaddr 0x60000000 $filesize\0"                 \
+       "flashrlk=tftpboot $loadaddr $tftpdir/uImage-rlk; "             \
+               "erase 0x60080000 +0x780000; "                          \
+               "cp.b $loadaddr 0x60080000 $filesize\0"                 \
+       "erase_persistent=erase 0x63a00000 +0x600000;\0"                \
+       "bootnor=setenv bootargs console=ttyS2,115200n8 "               \
+               "root=/dev/mtdblock3 rw rootfstype=jffs2 "              \
+               "rootwait ethaddr=$ethaddr; "                           \
+               "gpio c 1; gpio s 2; bootm 0x60800000\0"                \
+       "bootrlk=gpio s 1; gpio s 2;"                                   \
+               "setenv bootargs console=ttyS2,115200n8 "               \
+               "ethaddr=$ethaddr; bootm 0x60080000\0"                  \
+       "boottftp=setenv bootargs console=ttyS2,115200n8 "              \
+               "root=/dev/mtdblock3 rw rootfstype=jffs2 "              \
+               "rootwait ethaddr=$ethaddr; "                           \
+               "tftpboot $loadaddr $tftpdir/uImage;"                   \
+               "gpio c 1; gpio s 2; bootm $loadaddr\0"                 \
+       "checkupdate=if test -n $update_flag; then "                    \
+               "echo Previous update failed - starting RLK; "          \
+               "run bootrlk; fi; "                                     \
+               "if test -n $initial_setup; then "                      \
+               "echo Running initial setup procedure; "                \
+               "sleep 1; run flashall; fi\0"                           \
+       "product=accessory\0"                                           \
+       "serial=XX12345\0"                                              \
+       "checknor="                                                     \
+               "if gpio i 0; then run bootnor; fi;\0"                  \
+       "checkrlk="                                                     \
+               "if gpio i 0; then run bootrlk; fi;\0"                  \
+       "checkbutton="                                                  \
+               "run checknor; sleep 1;"                                \
+               "run checknor; sleep 1;"                                \
+               "run checknor; sleep 1;"                                \
+               "run checknor; sleep 1;"                                \
+               "run checknor;"                                         \
+               "gpio s 1; gpio s 2;"                                   \
+               "echo ---- Release button to boot RLK ----;"            \
+               "run checkrlk; sleep 1;"                                \
+               "run checkrlk; sleep 1;"                                \
+               "run checkrlk; sleep 1;"                                \
+               "run checkrlk; sleep 1;"                                \
+               "run checkrlk; sleep 1;"                                \
+               "run checkrlk;"                                         \
+               "echo ---- Factory reset requested ----;"               \
+               "gpio c 1;"                                             \
+               "setenv factory_reset true;"                            \
+               "saveenv;"                                              \
+               "run bootnor;\0"                                        \
+       "flashall=run flashrlk;"                                        \
+               "run flashkernel;"                                      \
+               "run flashrootfs;"                                      \
+               "setenv erase_datafs true;"                             \
+               "setenv initial_setup;"                                 \
+               "saveenv;"                                              \
+               "run bootnor;\0"                                        \
+       "verify=n\0"                                                    \
+       "clearenv=protect off all;"                                     \
+               "erase 0x60040000 +0x40000;\0"                          \
+       "bootlimit=3\0"                                                 \
+       "altbootcmd=run bootrlk\0"
+
+#define CONFIG_PREBOOT                 \
+       "echo Version: $ver; "          \
+       "echo Serial: $serial; "        \
+       "echo MAC: $ethaddr; "          \
+       "echo Product: $product; "      \
+       "gpio c 1; gpio c 2;"
+
+/*
+ * U-Boot commands
+ */
+#include <config_cmd_default.h>
+#define CONFIG_CMD_ENV
+#define CONFIG_CMD_ASKENV
+#define CONFIG_CMD_DHCP
+#define CONFIG_CMD_DIAG
+#define CONFIG_CMD_MII
+#define CONFIG_CMD_PING
+#define CONFIG_CMD_SAVES
+#define CONFIG_CMD_MEMORY
+#define CONFIG_CMD_GPIO
+
+#ifndef CONFIG_DRIVER_TI_EMAC
+#undef CONFIG_CMD_NET
+#undef CONFIG_CMD_DHCP
+#undef CONFIG_CMD_MII
+#undef CONFIG_CMD_PING
+#endif
+
+/* additions for new relocation code, must added to all boards */
+#define CONFIG_SYS_SDRAM_BASE          0xc0000000
+/* initial stack pointer in internal SRAM */
+#define CONFIG_SYS_INIT_SP_ADDR                (0x8001ff00)
+
+#define CONFIG_BOOTCOUNT_LIMIT
+#define CONFIG_SYS_BOOTCOUNT_ADDR      DAVINCI_RTC_BASE
+
+#ifndef __ASSEMBLY__
+int calimain_get_osc_freq(void);
+#endif
+
+#endif /* __CONFIG_H */
index a21d4482af498beac0280bd6fcd0c112037a4449..0fee53f750c58c84279830431fde3c412660e7ad 100644 (file)
@@ -68,7 +68,6 @@
 #define CONFIG_BOOTP_DNS2
 #define CONFIG_BOOTP_SEND_HOSTNAME
 #define CONFIG_NET_RETRY_COUNT 10
-#define CONFIG_NET_MULTI
 #define CONFIG_CMD_MII
 #define CONFIG_SYS_DCACHE_OFF
 #define CONFIG_RESET_PHY_R
@@ -90,7 +89,6 @@
 #define CONFIG_SYS_NAND_BASE_LIST      { 0x02000000, }
 /* socket has two chipselects, nCE0 gated by address BIT(14) */
 #define CONFIG_SYS_MAX_NAND_DEVICE     1
-#define CONFIG_SYS_NAND_MAX_CHIPS      1
 
 /* SPI support */
 #define CONFIG_SPI
 #define CONFIG_CMD_PING
 #define CONFIG_CMD_SAVES
 
+#ifdef CONFIG_CMD_BDI
+#define CONFIG_CLOCKS
+#endif
+
 #ifdef CONFIG_MMC
 #define CONFIG_DOS_PARTITION
 #define CONFIG_CMD_EXT2
 #define CONFIG_MTD_DEVICE
 #define CONFIG_CMD_NAND
 #define CONFIG_CMD_UBI
+#define CONFIG_CMD_UBIFS
 #define CONFIG_RBTREE
+#define CONFIG_LZO
 #endif
 
 #define CONFIG_CRC32_VERIFY
 #define CONFIG_SYS_PROMPT_HUSH_PS2     "> "
 #define CONFIG_SYS_LONGHELP
 
+#define CONFIG_MENU
+#define CONFIG_MENU_SHOW
+#define CONFIG_FIT
+#define CONFIG_CMD_PXE
+#define CONFIG_BOARD_IMG_ADDR_R 0x80000000
+
 #ifdef CONFIG_NAND_DAVINCI
-#define CONFIG_ENV_SIZE                (256 << 10)     /* 256 KiB */
+#define CONFIG_ENV_SIZE                        (16 << 10)
 #define CONFIG_ENV_IS_IN_NAND
-#define CONFIG_ENV_OFFSET      0x0
+#define CONFIG_ENV_OFFSET              0x180000
+#define CONFIG_ENV_OFFSET_REDUND       0x1c0000
+#define CONFIG_ENV_RANGE               0x020000
 #undef CONFIG_ENV_IS_IN_FLASH
 #endif
 
 #if defined(CONFIG_MMC) && !defined(CONFIG_ENV_IS_IN_NAND)
 #define CONFIG_CMD_ENV
+#define CONFIG_SYS_MMC_ENV_DEV 0
 #define CONFIG_ENV_SIZE                (16 << 10)      /* 16 KiB */
 #define CONFIG_ENV_OFFSET      (51 << 9)       /* Sector 51 */
 #define CONFIG_ENV_IS_IN_MMC
 #endif
 
 #define CONFIG_BOOTDELAY       3
+/*
+ * 24MHz InputClock / 15 prediv -> 1.6 MHz timer running
+ * Timeout 1 second.
+ */
+#define CONFIG_AIT_TIMER_TIMEOUT       0x186a00
 
 #define CONFIG_CMDLINE_EDITING
 #define CONFIG_VERSION_VARIABLE
 #define CONFIG_SYS_LOAD_ADDR   0x80700000              /* kernel address */
 
 #define MTDIDS_DEFAULT         "nand0=davinci_nand.0"
-
-#ifdef CONFIG_SYS_NAND_LARGEPAGE
-/*  Use same layout for 128K/256K blocks; allow some bad blocks */
-#define PART_BOOT              "2m(bootloader)ro,"
-#endif
-
-#define PART_KERNEL            "4m(kernel),"   /* kernel + initramfs */
-#define PART_REST              "-(filesystem)"
-
-#define MTDPARTS_DEFAULT       \
-       "mtdparts=davinci_nand.0:" PART_BOOT PART_KERNEL PART_REST
-
-#define CONFIG_SYS_NAND_PAGE_SIZE      (0x800)
-#define CONFIG_SYS_NAND_BLOCK_SIZE     (0x20000)
+#define MTDPARTS_DEFAULT                       \
+       "mtdparts="                             \
+               "davinci_nand.0:"               \
+                       "128k(spl),"            \
+                       "384k(UBLheader),"      \
+                       "1m(u-boot),"           \
+                       "512k(env),"            \
+                       "-(ubi)"
+
+#define CONFIG_SYS_NAND_PAGE_SIZE      0x800
+#define CONFIG_SYS_NAND_BLOCK_SIZE     0x20000
 
 /* Defines for SPL */
 #define CONFIG_SPL
 #define CONFIG_SYS_NAND_ECCBYTES       10
 #define CONFIG_SYS_NAND_OOBSIZE                64
 #define CONFIG_SYS_NAND_5_ADDR_CYCLE
-#define CONFIG_SYS_NAND_ECCSTEPS       (CONFIG_SYS_NAND_PAGE_SIZE /     \
-                                        CONFIG_SYS_NAND_ECCSIZE)
-#define CONFIG_SYS_NAND_ECCTOTAL       (40)
 
 /*
  * RBL searches from Block n (n = 1..24)
  * so we can define, how many UBL Headers
  * we can write before the real spl code
  */
-#define CONFIG_SYS_NROF_UBL_HEADER     5
 #define CONFIG_SYS_NROF_PAGES_NAND_SPL 6
 
 #define CONFIG_SYS_NAND_U_BOOT_DST     0x81080000 /* u-boot TEXT_BASE */
 #define CONFIG_POST    CONFIG_SYS_POST_MEMORY
 #define _POST_WORD_ADDR        0x0
 
-#define CONFIG_DISPLAY_CPUINFO
 #define CONFIG_DISPLAY_BOARDINFO
 
 #define CONFIG_SYS_INIT_SP_ADDR                CONFIG_SPL_STACK
 
-#define CONFIG_SYS_NAND_U_BOOT_OFFS    0xc0000
-#define CONFIG_SYS_NAND_U_BOOT_SIZE    0x60000
-
-/*
- * U-Boot is a 3rd stage loader and if booting with spl, cpu setup is
- * done in board_init_f from c code.
- */
-#define CONFIG_SKIP_LOWLEVEL_INIT
+#define CONFIG_SYS_NAND_U_BOOT_OFFS    0x80000
+#define CONFIG_SYS_NAND_U_BOOT_SIZE    0xa0000
 
 /* for UBL header */
 #define CONFIG_SYS_UBL_BLOCK           (CONFIG_SYS_NAND_PAGE_SIZE)
 #define        CONFIG_EXTRA_ENV_SETTINGS                                       \
        "u_boot_addr_r=" xstr(DVN4XX_UBOOT_ADDR_R_RAM) "\0"             \
        "u-boot=" xstr(CONFIG_HOSTNAME) "/u-boot.ubl\0"                 \
-       "load=tftp ${u_boot_addr_r} ${uboot}\0"                         \
+       "load=tftp ${u_boot_addr_r} ${u-boot}\0"                        \
        "pagesz=" xstr(CONFIG_SYS_NAND_PAGE_SIZE) "\0"                  \
-       "writeheader=nandrbl rbl;nand erase 80000 ${pagesz};"           \
-               "nand write ${u_boot_addr_r} 80000 ${pagesz};"          \
+       "writeheader=nandrbl rbl;nand erase 20000 ${pagesz};"           \
+               "nand write ${u_boot_addr_r} 20000 ${pagesz};"          \
                "nandrbl uboot\0"                                       \
-       "writenand_spl=nandrbl rbl;nand erase a0000 3000;"              \
+       "writenand_spl=nandrbl rbl;nand erase 0 3000;"                  \
                "nand write " xstr(DVN4XX_UBOOT_ADDR_R_NAND_SPL)        \
-               " a0000 3000;nandrbl uboot\0"                           \
+               " 0 3000;nandrbl uboot\0"                               \
        "writeuboot=nandrbl uboot;"                                     \
                "nand erase " xstr(CONFIG_SYS_NAND_U_BOOT_OFFS) " "     \
                 xstr(CONFIG_SYS_NAND_U_BOOT_SIZE)                      \
                " " xstr(CONFIG_SYS_NAND_U_BOOT_OFFS) " "               \
                xstr(CONFIG_SYS_NAND_U_BOOT_SIZE) "\0"                  \
        "update=run load writenand_spl writeuboot\0"                    \
-       "bootcmd=run bootcmd\0"                                         \
+       "bootcmd=run net_nfs\0"                                         \
+       "rootpath=/opt/eldk-arm/arm\0"                                  \
+       "mtdids=" MTDIDS_DEFAULT "\0"                                   \
+       "mtdparts=" MTDPARTS_DEFAULT "\0"                               \
+       "netdev=eth0\0"                                                 \
+       "addmtd=setenv bootargs ${bootargs} ${mtdparts}\0"              \
+       "addmisc=setenv bootargs ${bootargs} app_reset=${app_reset}\0"  \
+       "addcon=setenv bootargs ${bootargs} console=ttyS0,"             \
+               "${baudrate}n8\0"                                       \
+       "addip=setenv bootargs ${bootargs} "                            \
+               "ip=${ipaddr}:${serverip}:${gatewayip}:${netmask}"      \
+               ":${hostname}:${netdev}:off eth=${ethaddr} panic=1\0"   \
        "rootpath=/opt/eldk-arm/arm\0"                                  \
+       "nfsargs=setenv bootargs root=/dev/nfs rw "                     \
+               "nfsroot=${serverip}:${rootpath}\0"                     \
+       "bootfile=" xstr(CONFIG_HOSTNAME) "/uImage \0"                  \
+       "kernel_addr_r=80600000\0"                                      \
+       "load_kernel=tftp ${kernel_addr_r} ${bootfile}\0"               \
+       "ubi_load_kernel=ubi part ubi 2048;ubifsmount ${img_volume};"   \
+               "ubifsload ${kernel_addr_r} boot/uImage\0"              \
+       "fit_addr_r=" xstr(CONFIG_BOARD_IMG_ADDR_R) "\0"                \
+       "img_addr_r=" xstr(CONFIG_BOARD_IMG_ADDR_R) "\0"                \
+       "img_file=" xstr(CONFIG_HOSTNAME) "/ait.itb\0"                  \
+       "header_addr=20000\0"                                           \
+       "img_writeheader=nandrbl rbl;"                                  \
+               "nand erase ${header_addr} ${pagesz};"                  \
+               "nand write ${img_addr_r} ${header_addr} ${pagesz};"    \
+               "nandrbl uboot\0"                                       \
+       "img_writespl=nandrbl rbl;nand erase 0 3000;"                   \
+               "nand write ${img_addr_r} 0 3000;nandrbl uboot\0"       \
+       "img_writeuboot=nandrbl uboot;"                                 \
+               "nand erase " xstr(CONFIG_SYS_NAND_U_BOOT_OFFS) " "     \
+                xstr(CONFIG_SYS_NAND_U_BOOT_SIZE)                      \
+               ";nand write ${img_addr_r} "                            \
+               xstr(CONFIG_SYS_NAND_U_BOOT_OFFS) " "                   \
+               xstr(CONFIG_SYS_NAND_U_BOOT_SIZE) "\0"                  \
+       "img_writedfenv=ubi part ubi 2048;"                             \
+               "ubi write ${img_addr_r} default ${filesize}\0"         \
+       "img_volume=rootfs1\0"                                          \
+       "img_writeramdisk=ubi part ubi 2048;ubifsmount ${img_volume};"  \
+               "ubi write ${img_addr_r} ${img_volume} ${filesize}\0"   \
+       "load_img=tftp ${fit_addr_r} ${img_file}\0"                     \
+       "net_nfs=run load_kernel; "                                     \
+               "run nfsargs addip addcon addmtd addmisc;"              \
+               "bootm ${kernel_addr_r}\0"                              \
+       "ubi_ubi=run ubi_load_kernel; "                                 \
+               "run ubiargs addip addcon addmtd addmisc;"              \
+               "bootm ${kernel_addr_r}\0"                              \
+       "ubiargs=setenv bootargs ubi.mtd=4,2048"                        \
+               " root=ubi0:${img_volume} rw rootfstype=ubifs\0"        \
+       "app_reset=no\0"                                                \
+       "dvn_app_vers=void\0"                                           \
+       "dvn_boot_vers=void\0"                                          \
+       "savenewvers=run savetmpparms restoreparms; saveenv;"           \
+               "run restoretmpparms\0"                                 \
+       "savetmpparms=setenv y_ipaddr ${ipaddr};"                       \
+               "setenv y_netmask ${netmask};"                          \
+               "setenv y_serverip ${serverip};"                        \
+               "setenv y_gatewayip ${gatewayip}\0"                     \
+       "saveparms=setenv x_ipaddr ${ipaddr};"                          \
+               "setenv x_netmask ${netmask};"                          \
+               "setenv x_serverip ${serverip};"                        \
+               "setenv x_gatewayip ${gatewayip}\0"                     \
+       "restoreparms=setenv ipaddr ${x_ipaddr};"                       \
+               "setenv netmask ${x_netmask};"                          \
+               "setenv serverip ${x_serverip};"                        \
+               "setenv gatewayip ${x_gatewayip}\0"                     \
+       "restoretmpparms=setenv ipaddr ${y_ipaddr};"                    \
+               "setenv netmask ${y_netmask};"                          \
+               "setenv serverip ${y_serverip};"                        \
+               "setenv gatewayip ${y_gatewayip}\0"                     \
        "\0"
 
 /* USB Configuration */
index 8c03582c8ddc149249eb3e67a6827b3ad62c5f82..acb127c1d1227a166da8a01d0d45d922ec7ceabe 100644 (file)
 
 #define CONFIG_SYS_NAND_ECCSIZE        256
 #define CONFIG_SYS_NAND_ECCBYTES       3
-#define CONFIG_SYS_NAND_ECCSTEPS       (CONFIG_SYS_NAND_PAGE_SIZE / CONFIG_SYS_NAND_ECCSIZE)
 #define CONFIG_SYS_NAND_OOBSIZE        64
-#define CONFIG_SYS_NAND_ECCTOTAL       (CONFIG_SYS_NAND_ECCBYTES * CONFIG_SYS_NAND_ECCSTEPS)
 #define CONFIG_SYS_NAND_ECCPOS         {40, 41, 42, 43, 44, 45, 46, 47, \
                                 48, 49, 50, 51, 52, 53, 54, 55, \
                                 56, 57, 58, 59, 60, 61, 62, 63}
index 4f2b904d54ef6ffd0e7ea50d6f76f3254ccd7d74..b15a1eb7a2ee82333382d23a6bf3425811a10651 100644 (file)
@@ -68,7 +68,6 @@
 #define CONFIG_BFIN_NFC_CTL_VAL        0x0033
 #define CONFIG_SYS_NAND_BASE           0 /* not actually used */
 #define CONFIG_SYS_MAX_NAND_DEVICE     1
-#define NAND_MAX_CHIPS         1
 #define CONFIG_CMD_NAND
 #endif
 
index 348a25bd1f245e74ab45d8039ff9489874408ac4..2c65d74496d7b782e75053b34bcd9c043b1ffffd 100644 (file)
  */
 #define CONFIG_PCI
 
-/*-----------------------------------------------------------------------
- * Network device support
- */
-#define CONFIG_NET_MULTI
-
-
 #endif /* __CONFIG_H */
index 7925b9583890e865a7ee5039739570ca4c1a7691..77dd0a2d1e199a9b0a561a99071fcec89a898189 100644 (file)
@@ -88,6 +88,7 @@
 #elif defined(CONFIG_SDCARD)
 #define CONFIG_SYS_EXTRA_ENV_RELOC
 #define CONFIG_ENV_IS_IN_MMC
+#define CONFIG_FSL_FIXED_MMC_LOCATION
 #define CONFIG_SYS_MMC_ENV_DEV          0
 #define CONFIG_ENV_SIZE                        0x2000
 #define CONFIG_ENV_OFFSET              (512 * 1097)
index 8674a35d2238b1bf79e35df2601cbb47b4086b0c..8b6a6879892aff6a2ddae9e8b3ebfe0a35e3925c 100644 (file)
 
 /* NAND flash */
 #define CONFIG_NAND_ATMEL
-#define NAND_MAX_CHIPS                         1
 #define CONFIG_SYS_MAX_NAND_DEVICE             1
 #define CONFIG_SYS_NAND_BASE                   0x40000000
 #define CONFIG_SYS_NAND_DBW_8                  1
index 6ac25d2b9c11e7781da0f819ce73d31855b0dfdd..4532e4f4fdd18fe6b2322654a65cb3a87ddb295a 100644 (file)
 #define CONFIG_SYS_CLE_MASK            0x10
 #define CONFIG_SYS_ALE_MASK            0x8
 #define CONFIG_SYS_MAX_NAND_DEVICE     1 /* Max number of NAND devices */
-#define NAND_MAX_CHIPS                 1
 #endif
 
 #ifdef CONFIG_USE_NOR
 #undef CONFIG_CMD_FPGA
 #undef CONFIG_CMD_SETGETDCR
 
+#ifdef CONFIG_CMD_BDI
+#define CONFIG_CLOCKS
+#endif
+
 #ifndef CONFIG_DRIVER_TI_EMAC
 #undef CONFIG_CMD_NET
 #undef CONFIG_CMD_DHCP
index fcbbace1cae347e28addeaff6d0c09088ce4e0fb..989472b1813756fd05e8151a034b37cca23f6b7f 100644 (file)
 #define CONFIG_ARM926EJS               /* arm926ejs CPU core */
 #define CONFIG_SOC_DA8XX               /* TI DA8xx SoC */
 #define CONFIG_SOC_DA850               /* TI DA850 SoC */
+#define CONFIG_SYS_EXCEPTION_VECTORS_HIGH
 #define CONFIG_SYS_CLK_FREQ            clk_get(DAVINCI_ARM_CLKID)
 #define CONFIG_SYS_OSCIN_FREQ          24000000
 #define CONFIG_SYS_TIMERBASE           DAVINCI_TIMER0_BASE
 #define CONFIG_SYS_HZ_CLOCK            clk_get(DAVINCI_AUXCLK_CLKID)
 #define CONFIG_SYS_HZ                  1000
-#define CONFIG_SKIP_LOWLEVEL_INIT
 #define CONFIG_SYS_TEXT_BASE           0xc1080000
+#define CONFIG_SYS_DA850_PLL_INIT
+#define CONFIG_SYS_DA850_DDR_INIT
 
 /*
  * Memory Info
 #define CONFIG_CONS_INDEX      1               /* use UART0 for console */
 #define CONFIG_BAUDRATE                115200          /* Default baud rate */
 #define CONFIG_SYS_BAUDRATE_TABLE      { 9600, 19200, 38400, 57600, 115200 }
-#define CONFIG_SYS_DA850_LPSC_UART DAVINCI_LPSC_UART2
 
 #define CONFIG_SPI
 #define CONFIG_SPI_FLASH
 #define CONFIG_SYS_ALE_MASK            0x8
 #undef CONFIG_SYS_NAND_HW_ECC
 #define CONFIG_SYS_MAX_NAND_DEVICE     1 /* Max number of NAND devices */
-#define NAND_MAX_CHIPS                 1
 #endif
 
 /*
 #define CONFIG_CMD_SAVES
 #define CONFIG_CMD_MEMORY
 
+#ifdef CONFIG_CMD_BDI
+#define CONFIG_CLOCKS
+#endif
+
 #ifndef CONFIG_DRIVER_TI_EMAC
 #undef CONFIG_CMD_NET
 #undef CONFIG_CMD_DHCP
 #define CONFIG_SPL_SERIAL_SUPPORT
 #define CONFIG_SPL_LIBCOMMON_SUPPORT
 #define CONFIG_SPL_LIBGENERIC_SUPPORT
-#define CONFIG_SPL_LDSCRIPT    "$(BOARDDIR)/u-boot-spl.lds"
+#define CONFIG_SPL_LDSCRIPT    "board/$(BOARDDIR)/u-boot-spl-da850evm.lds"
 #define CONFIG_SPL_STACK       0x8001ff00
 #define CONFIG_SPL_TEXT_BASE   0x80000000
 #define CONFIG_SPL_MAX_SIZE    32768
index ddf673c846d9e108235d562c227c2e7cffbe964d..42caf1e42a467d32e7358a32b8036036ea4a6350 100644 (file)
@@ -26,7 +26,6 @@
 #define CONFIG_SKIP_LOWLEVEL_INIT      /* U-Boot is a 3rd stage loader */
 #define CONFIG_SYS_NO_FLASH            /* that is, no *NOR* flash */
 #define CONFIG_SYS_CONSOLE_INFO_QUIET
-#define CONFIG_DISPLAY_CPUINFO
 
 /* SoC Configuration */
 #define CONFIG_ARM926EJS                               /* arm926ejs CPU */
 #define CONFIG_CMD_PING
 #define CONFIG_CMD_SAVES
 
+#ifdef CONFIG_CMD_BDI
+#define CONFIG_CLOCKS
+#endif
+
 #ifdef CONFIG_MMC
 #define CONFIG_DOS_PARTITION
 #define CONFIG_CMD_EXT2
index dfa0a00475d8baa36298321044cc28cf159cc3db..b05cfbaa8e8b122b3e0380ea42d2f7d45cea5344 100644 (file)
@@ -25,7 +25,6 @@
 #define CONFIG_SKIP_LOWLEVEL_INIT      /* U-Boot is a 3rd stage loader */
 #define CONFIG_SYS_NO_FLASH            /* that is, no *NOR* flash */
 #define CONFIG_SYS_CONSOLE_INFO_QUIET
-#define CONFIG_DISPLAY_CPUINFO
 
 /* SoC Configuration */
 #define CONFIG_ARM926EJS                               /* arm926ejs CPU */
@@ -69,7 +68,6 @@
 
 #define CONFIG_SYS_NAND_BASE_LIST      { 0x02000000, }
 #define CONFIG_SYS_MAX_NAND_DEVICE     1
-#define CONFIG_SYS_NAND_MAX_CHIPS      1
 
 /* U-Boot command configuration */
 #include <config_cmd_default.h>
 #define CONFIG_CMD_PING
 #define CONFIG_CMD_SAVES
 
+#ifdef CONFIG_CMD_BDI
+#define CONFIG_CLOCKS
+#endif
+
 #ifdef CONFIG_NAND_DAVINCI
 #define CONFIG_CMD_MTDPARTS
 #define CONFIG_MTD_PARTITIONS
index cb6ed24a80015dc5d6d4962cc0cbd78d5d613ba8..a75bce675b48a3924027f79119f28073f445b1cc 100644 (file)
 #define CONFIG_CMD_PING
 #define CONFIG_CMD_SAVES
 
+#ifdef CONFIG_CMD_BDI
+#define CONFIG_CLOCKS
+#endif
+
 #ifdef CONFIG_MMC
 #define CONFIG_DOS_PARTITION
 #define CONFIG_CMD_EXT2
index b3a4e4434420e177516de39ce55f68c91176f278..0cbdec86813ecceede0545af8e1c970faf180156 100644 (file)
@@ -23,7 +23,6 @@
 /* Spectrum Digital TMS320DM6467T EVM board */
 #define DAVINCI_DM6467EVM
 #define DAVINCI_DM6467TEVM
-#define CONFIG_DISPLAY_CPUINFO
 #define CONFIG_SYS_USE_NAND
 #define CONFIG_SYS_NAND_SMALLPAGE
 
@@ -153,6 +152,10 @@ extern unsigned int davinci_arm_clk_get(void);
 #define CONFIG_CMD_NAND
 #endif
 
+#ifdef CONFIG_CMD_BDI
+#define CONFIG_CLOCKS
+#endif
+
 #define CONFIG_MAX_RAM_BANK_SIZE       (256 << 20)     /* 256 MB */
 
 #define CONFIG_SYS_SDRAM_BASE          PHYS_SDRAM_1
index c9a0cd1daa3234ed916fe3bcb7274a0130e45287..e0fe6b5c248ec618744744dd62b9b40dde5c280c 100644 (file)
@@ -22,7 +22,6 @@
 
 /* Spectrum Digital TMS320DM6467 EVM board */
 #define DAVINCI_DM6467EVM
-#define CONFIG_DISPLAY_CPUINFO
 #define CONFIG_SYS_USE_NAND
 #define CONFIG_SYS_NAND_SMALLPAGE
 
@@ -151,6 +150,10 @@ extern unsigned int davinci_arm_clk_get(void);
 #define CONFIG_CMD_NAND
 #endif
 
+#ifdef CONFIG_CMD_BDI
+#define CONFIG_CLOCKS
+#endif
+
 #define CONFIG_MAX_RAM_BANK_SIZE       (256 << 20)     /* 256 MB */
 
 #define CONFIG_SYS_SDRAM_BASE          PHYS_SDRAM_1
index c0525173e6806841e91108eab4fb526eaa33b2f5..310d5770dec4889c81389e4765ae21312e109e9c 100644 (file)
@@ -51,7 +51,6 @@
 #define DV_EVM
 #define CONFIG_SYS_NAND_SMALLPAGE
 #define CONFIG_SYS_USE_NAND
-#define CONFIG_DISPLAY_CPUINFO
 /*===================*/
 /* SoC Configuration */
 /*===================*/
 #define CONFIG_CMD_SAVES
 #define CONFIG_CMD_EEPROM
 #undef CONFIG_CMD_BDI
+
+#ifdef CONFIG_CMD_BDI
+#define CONFIG_CLOCKS
+#endif
+
 #undef CONFIG_CMD_FPGA
 #undef CONFIG_CMD_SETGETDCR
 #ifdef CONFIG_SYS_USE_NAND
index f4ddbeacc3b00038807707f699c6492e15e69aff..949174a1637193504bd36607395b4a7d0c4afdbe 100644 (file)
@@ -26,7 +26,6 @@
 #define SCHMOOGIE
 #define CONFIG_SYS_NAND_LARGEPAGE
 #define CONFIG_SYS_USE_NAND
-#define CONFIG_DISPLAY_CPUINFO
 #define MACH_TYPE_SCHMOOGIE 1255
 #define CONFIG_MACH_TYPE MACH_TYPE_SCHMOOGIE
 
 #undef CONFIG_CMD_FLASH
 #undef CONFIG_CMD_IMLS
 
+#ifdef CONFIG_CMD_BDI
+#define CONFIG_CLOCKS
+#endif
+
 #define CONFIG_MAX_RAM_BANK_SIZE       (256 << 20)     /* 256 MB */
 
 #define CONFIG_SYS_SDRAM_BASE          PHYS_SDRAM_1
index 0c653915bdf83d95e76fff1a4c2c1a1441603720..c931ede85cfd7d79851fc6f0b03248ac421f526d 100644 (file)
@@ -28,7 +28,6 @@
 #define CONFIG_SYS_NAND_LARGEPAGE
 #define CONFIG_SYS_USE_NAND
 #define CONFIG_SYS_USE_DSPLINK         /* don't power up the DSP. */
-#define CONFIG_DISPLAY_CPUINFO
 /* SoC Configuration */
 #define CONFIG_ARM926EJS                       /* arm926ejs CPU core */
 #define CONFIG_SYS_TIMERBASE           0x01c21400      /* use timer 0 */
 #undef CONFIG_CMD_FLASH
 #undef CONFIG_CMD_IMLS
 
+#ifdef CONFIG_CMD_BDI
+#define CONFIG_CLOCKS
+#endif
+
 #define CONFIG_MAX_RAM_BANK_SIZE       (256 << 20)     /* 256 MB */
 
 #define CONFIG_SYS_SDRAM_BASE          PHYS_SDRAM_1
index fc4d8eceac388eaa8ded2a1595bdf35360fc4642..854099b2a26f500b353eb4fac961e0a96a1b564c 100644 (file)
@@ -51,7 +51,6 @@
 #define SONATA_BOARD
 #define CONFIG_SYS_NAND_SMALLPAGE
 #define CONFIG_SYS_USE_NOR
-#define CONFIG_DISPLAY_CPUINFO
 #define MACH_TYPE_SONATA 1254
 #define CONFIG_MACH_TYPE MACH_TYPE_SONATA
 /*===================*/
 #error "Either CONFIG_SYS_USE_NAND or CONFIG_SYS_USE_NOR _MUST_ be defined !!!"
 #endif
 
+#ifdef CONFIG_CMD_BDI
+#define CONFIG_CLOCKS
+#endif
+
 #define CONFIG_MAX_RAM_BANK_SIZE       (256 << 20)     /* 256 MB */
 
 #define CONFIG_SYS_SDRAM_BASE          PHYS_SDRAM_1
index 758326bb9dddbd5099dfee5007b56618721cad4b..2b6a6ee091815a36162f7d601d0a71aaa28b8ff4 100644 (file)
 #define CONFIG_SYS_NAND_ECCSIZE                512
 #define CONFIG_SYS_NAND_ECCBYTES       3
 
-#define CONFIG_SYS_NAND_ECCSTEPS       (CONFIG_SYS_NAND_PAGE_SIZE / \
-                                               CONFIG_SYS_NAND_ECCSIZE)
-#define CONFIG_SYS_NAND_ECCTOTAL       (CONFIG_SYS_NAND_ECCBYTES * \
-                                               CONFIG_SYS_NAND_ECCSTEPS)
-
 #define CONFIG_SYS_NAND_U_BOOT_START   CONFIG_SYS_TEXT_BASE
 
 #define CONFIG_SYS_NAND_U_BOOT_OFFS    0x80000
diff --git a/include/configs/dns325.h b/include/configs/dns325.h
new file mode 100644 (file)
index 0000000..b7a89d3
--- /dev/null
@@ -0,0 +1,188 @@
+/*
+ * Copyright (C) 2011
+ * Stefan Herbrechtsmeier <stefan@code.herbrechtsmeier.net>
+ *
+ * Based on Kirkwood support:
+ * (C) Copyright 2009
+ * Marvell Semiconductor <www.marvell.com>
+ * Written-by: Prafulla Wadaskar <prafulla@marvell.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., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301 USA
+ */
+
+#ifndef _CONFIG_DNS325_H
+#define _CONFIG_DNS325_H
+
+/*
+ * Machine number definition
+ */
+#define MACH_TYPE_DNS325               3800
+#define CONFIG_MACH_TYPE               MACH_TYPE_DNS325
+#define CONFIG_IDENT_STRING            "\nD-Link DNS-325"
+
+/*
+ * High Level Configuration Options (easy to change)
+ */
+#define CONFIG_FEROCEON_88FR131                /* CPU Core subversion */
+#define CONFIG_KIRKWOOD                        /* SOC Family Name */
+#define CONFIG_KW88F6281               /* SOC Name */
+#define CONFIG_SKIP_LOWLEVEL_INIT      /* disable board lowlevel_init */
+
+/*
+ * Commands configuration
+ */
+#define CONFIG_SYS_NO_FLASH            /* Declare no flash (NOR/SPI) */
+#include <config_cmd_default.h>
+#define CONFIG_CMD_DHCP
+#define CONFIG_CMD_ENV
+#define CONFIG_CMD_NAND
+#define CONFIG_CMD_PING
+#define CONFIG_CMD_USB
+#define CONFIG_CMD_IDE
+#define CONFIG_CMD_DATE
+#define CONFIG_SYS_MVFS
+
+#define CONFIG_NR_DRAM_BANKS           1
+
+/*
+ * mv-common.h should be defined after CMD configs since it used them
+ * to enable certain macros
+ */
+#include "mv-common.h"
+
+/* Remove or override few declarations from mv-common.h */
+#undef CONFIG_SYS_PROMPT
+#define CONFIG_SYS_PROMPT              "=> "
+
+/*
+ * Ethernet Driver configuration
+ */
+#ifdef CONFIG_CMD_NET
+#define CONFIG_MVGBE_PORTS             {1, 0} /* enable port 0 only */
+#define CONFIG_NETCONSOLE
+#endif
+
+/*
+ * SATA Driver configuration
+ */
+#ifdef CONFIG_MVSATA_IDE
+#define CONFIG_SYS_ATA_IDE0_OFFSET      MV_SATA_PORT0_OFFSET
+#define CONFIG_SYS_ATA_IDE1_OFFSET      MV_SATA_PORT1_OFFSET
+#endif
+
+/*
+ * RTC driver configuration
+ */
+#ifdef CONFIG_CMD_DATE
+#define CONFIG_RTC_MV
+#endif
+
+/*
+ * Enable GPI0 support
+ */
+#define CONFIG_KIRKWOOD_GPIO
+
+/*
+ * Use the HUSH parser
+ */
+#define CONFIG_SYS_HUSH_PARSER
+#define CONFIG_SYS_PROMPT_HUSH_PS2     "> "
+
+/*
+ * Console configuration
+ */
+#define CONFIG_CONSOLE_MUX
+#define CONFIG_SYS_CONSOLE_IS_IN_ENV
+
+/*
+ * Enable device tree support
+ */
+#define CONFIG_OF_LIBFDT
+
+/*
+ * Display cpu info at boot
+ */
+#define CONFIG_DISPLAY_CPUINFO
+
+/*
+ * Environment variables configurations
+ */
+#ifdef CONFIG_CMD_NAND
+#define CONFIG_ENV_IS_IN_NAND
+#define CONFIG_ENV_SECT_SIZE           0x20000 /* 128KB */
+#else
+#define CONFIG_ENV_IS_NOWHERE
+#endif
+
+#define CONFIG_ENV_SIZE                        0x20000 /* 128KB */
+#define CONFIG_ENV_ADDR                        0xe0000
+#define CONFIG_ENV_OFFSET              0xe0000 /* env starts here */
+
+/*
+ * Default environment variables
+ */
+#define MTDIDS_DEFAULT                 "nand0=orion_nand"
+
+#define MTDPARTS_DEFAULT               "mtdparts=orion_nand:" \
+       "896k(u-boot),128k(u-boot-env),5m(kernel),-(rootfs)\0"
+
+#define CONFIG_EXTRA_ENV_SETTINGS \
+       "stdin=serial\0" \
+       "stdout=serial\0" \
+       "stderr=serial\0" \
+       "loadaddr=0x800000\0" \
+       "autoload=no\0" \
+       "console=ttyS0,115200\0" \
+       "mtdparts="MTDPARTS_DEFAULT \
+       "optargs=\0" \
+       "bootenv=uEnv.txt\0" \
+       "importbootenv=echo Importing environment ...; " \
+               "env import -t ${loadaddr} ${filesize}\0" \
+       "loadbootenv=fatload usb 0 ${loadaddr} ${bootenv}\0" \
+       "setbootargs=setenv bootargs console=${console} " \
+               "${optargs} " \
+               "${mtdparts} " \
+               "root=${bootenvroot} " \
+               "rootfstype=${bootenvrootfstype}\0" \
+       "subbootcmd=run setbootargs; " \
+               "if run bootenvloadimage; then " \
+                       "bootm ${loadaddr};" \
+               "fi;\0" \
+       "nandroot=ubi0:rootfs ubi.mtd=rootfs\0" \
+       "nandrootfstype=ubifs\0" \
+       "nandloadimage=nand read ${loadaddr} kernel\0" \
+       "setnandbootenv=echo Booting from nand ...; " \
+               "setenv bootenvroot ${nandroot}; " \
+               "setenv bootenvrootfstype ${nandrootfstype}; " \
+               "setenv bootenvloadimage ${nandloadimage}\0"
+
+#define CONFIG_BOOTCOMMAND \
+       "if test -n ${bootenv} && usb start; then " \
+               "if run loadbootenv; then " \
+                       "echo Loaded environment ${bootenv} from usb;" \
+                       "run importbootenv;" \
+               "fi;" \
+               "if test -n ${bootenvcmd}; then " \
+                       "echo Running bootenvcmd ...;" \
+                       "run bootenvcmd;" \
+               "fi;" \
+       "fi;" \
+       "run setnandbootenv subbootcmd;"
+
+#endif /* _CONFIG_DNS325_H */
index 74fec3f8b5d8e040655c39d84d4b7e8ae7f7f2b0..b4610d9474faf2d6c2eb5a3806f24eff9c6df464 100644 (file)
 #define CONFIG_CMD_MEMORY
 #define CONFIG_CMD_I2C
 
+#ifdef CONFIG_CMD_BDI
+#define CONFIG_CLOCKS
+#endif
+
 #ifndef CONFIG_DRIVER_TI_EMAC
 #undef CONFIG_CMD_NET
 #undef CONFIG_CMD_DHCP
 #define CONFIG_SYS_NAND_4BIT_HW_ECC_OOBFIRST
 #define        CONFIG_SYS_NAND_USE_FLASH_BBT
 #define CONFIG_SYS_MAX_NAND_DEVICE     1 /* Max number of NAND devices */
-#define NAND_MAX_CHIPS                 1
 #define CONFIG_SYS_64BIT_VSPRINTF      /* needed for nand_util.c */
 #endif
 
index b08de4a72efaf376bfa4c940083420e5d031d515..9046cf0c01f712e11820992b27eec0beb5ddcf32 100644 (file)
 
 /* NAND */
 
-#define CONFIG_SYS_NAND_MAX_CHIPS      1
 #define CONFIG_SYS_MAX_NAND_DEVICE     1
 #define CONFIG_SYS_NAND_BASE           0x40000000
 #define CONFIG_SYS_NAND_DBW_8          1
index 2e2a9a7a99a32b3e4dd33cbc7462517d81438913..4549a4c15ea949b82feaa21d43fa3bd3f856bc7f 100644 (file)
@@ -88,7 +88,6 @@
 #define CONFIG_SH_I2C_BASE1            0xA4750000
 
 /* Ether */
-#define CONFIG_NET_MULTI 1
 #define CONFIG_SH_ETHER 1
 #define CONFIG_SH_ETHER_USE_PORT (0)
 #define CONFIG_SH_ETHER_PHY_ADDR (0x1f)
index 88d32b27d6aa84e492b64763a0e5f328337117aa..9b7cc66c658a07ca776c64eaa26c0544359f10e4 100644 (file)
 #include <config_cmd_default.h>
 #define CONFIG_CMD_IDE
 #define CONFIG_CMD_I2C
+#define CONFIG_CMD_USB
 
 /*
  * Network
 /* end of IDE defines */
 #endif /* CMD_IDE */
 
+/*
+ * Common USB/EHCI configuration
+ */
+#ifdef CONFIG_CMD_USB
+#define CONFIG_USB_EHCI                /* Enable EHCI USB support */
+#define CONFIG_USB_EHCI_MARVELL
+#define ORION5X_USB20_HOST_PORT_BASE ORION5X_USB20_PORT0_BASE
+#define CONFIG_USB_STORAGE
+#define CONFIG_DOS_PARTITION
+#define CONFIG_ISO_PARTITION
+#define CONFIG_SUPPORT_VFAT
+#endif /* CONFIG_CMD_USB */
+
 /*
  * I2C related stuff
  */
 #define CONFIG_SYS_RESET_ADDRESS       0xffff0000
 #define CONFIG_SYS_MAXARGS             16
 
+/* Use the HUSH parser */
+#define CONFIG_SYS_HUSH_PARSER
+#define CONFIG_SYS_PROMPT_HUSH_PS2     "> "
+
+/* Enable command line editing */
+#define CONFIG_CMDLINE_EDITING
+
+/* provide extensive help */
+#define CONFIG_SYS_LONGHELP
+
 /* additions for new relocation code, must be added to all boards */
 #define CONFIG_SYS_SDRAM_BASE          0
 #define CONFIG_SYS_INIT_SP_ADDR        \
index 522487b3955ca236c47aee9723d2e2edac124fe6..e2f0f7465d80f882ee68842b8a754265e2424ea0 100644 (file)
 /* USB NET */
 #ifdef CONFIG_CMD_NET
 #define        CONFIG_USB_ETHER_ASIX
-#define        CONFIG_NET_MULTI
 #define        CONFIG_CMD_PING
 #define        CONFIG_CMD_DHCP
 #endif
index c427dc7c692be5de02e4d81c2c6f92d6686a0d6b..29b0d339912718109dc6f7f3f64874f6d14a2073 100644 (file)
 #define CONFIG_ARM926EJS               /* arm926ejs CPU core */
 #define CONFIG_SOC_DA8XX               /* TI DA8xx SoC */
 #define CONFIG_SOC_DA850               /* TI DA850 SoC */
+#define CONFIG_SYS_EXCEPTION_VECTORS_HIGH
 #define CONFIG_SYS_CLK_FREQ            clk_get(DAVINCI_ARM_CLKID)
 #define CONFIG_SYS_OSCIN_FREQ          24000000
 #define CONFIG_SYS_TIMERBASE           DAVINCI_TIMER0_BASE
 #define CONFIG_SYS_HZ_CLOCK            clk_get(DAVINCI_AUXCLK_CLKID)
 #define CONFIG_SYS_HZ                  1000
-#define CONFIG_SKIP_LOWLEVEL_INIT
 #define CONFIG_DA850_LOWLEVEL
 #define CONFIG_ARCH_CPU_INIT
+#define CONFIG_SYS_DA850_PLL_INIT
+#define CONFIG_SYS_DA850_DDR_INIT
 #define CONFIG_DA8XX_GPIO
 #define CONFIG_HOSTNAME                enbw_cmc
-#define CONFIG_DISPLAY_CPUINFO
 
 #define MACH_TYPE_ENBW_CMC     3585
 #define CONFIG_MACH_TYPE       MACH_TYPE_ENBW_CMC
@@ -83,7 +84,7 @@
 #define CONFIG_CONS_INDEX      1               /* use UART0 for console */
 #define CONFIG_BAUDRATE                115200          /* Default baud rate */
 #define CONFIG_SYS_BAUDRATE_TABLE      { 9600, 19200, 38400, 57600, 115200 }
-#define CONFIG_SYS_DA850_LPSC_UART     DAVINCI_LPSC_UART2
+
 /*
  * I2C Configuration
  */
 #define CONFIG_SYS_ALE_MASK            0x8
 #undef CONFIG_SYS_NAND_HW_ECC
 #define CONFIG_SYS_MAX_NAND_DEVICE     1 /* Max number of NAND devices */
-#define NAND_MAX_CHIPS                 1
 
 #define MTDIDS_DEFAULT         "nor0=physmap-flash.0,nand0=davinci_nand.1"
 #define MTDPARTS_DEFAULT                       \
 #define CONFIG_BOOTP_DNS2
 #define CONFIG_BOOTP_SEND_HOSTNAME
 #define CONFIG_NET_RETRY_COUNT 10
-#define CONFIG_NET_MULTI
 #endif
 
 /*
 #define CONFIG_CMD_MEMORY
 #define CONFIG_CMD_CACHE
 
+#ifdef CONFIG_CMD_BDI
+#define CONFIG_CLOCKS
+#endif
+
 #ifndef CONFIG_DRIVER_TI_EMAC
 #undef CONFIG_CMD_NET
 #undef CONFIG_CMD_DHCP
index f878665b296d7c006ad612b5708d577bcd115d8a..604d2dd5f53ceddcb22f1003278607c93ed7c4a5 100644 (file)
 #endif
 
 /* Ethernet */
-#define CONFIG_NET_MULTI
 #define CONFIG_NET_RETRY_COUNT         20
 #define CONFIG_MACB
 #define CONFIG_RMII
index aac3930f0a9af5435ab28b2f7d1ae07a08a96137..649e27214c7030b9c6091695e31b938fa88c962a 100644 (file)
 /*
  * Ethernet on SOC (FEC)
  */
-#define CONFIG_NET_MULTI
 #define CONFIG_FEC_MXC
 #define IMX_FEC_BASE   FEC_BASE_ADDR
 #define CONFIG_PHYLIB
index 12acb27aef7e4e68d8d8b3374bd469b99e1fb177..50a1c171b66e2289546ae47b25baba533b57eeb7 100644 (file)
@@ -35,6 +35,7 @@
 #define CONFIG_ARM926EJS               /* arm926ejs CPU core */
 #define CONFIG_SOC_DA8XX               /* TI DA8xx SoC */
 #define CONFIG_SOC_DA850               /* TI DA850 SoC */
+#define CONFIG_SYS_EXCEPTION_VECTORS_HIGH
 #define CONFIG_SYS_CLK_FREQ            clk_get(DAVINCI_ARM_CLKID)
 #define CONFIG_SYS_OSCIN_FREQ          24000000
 #define CONFIG_SYS_TIMERBASE           DAVINCI_TIMER0_BASE
 #define CONFIG_SKIP_LOWLEVEL_INIT
 #define CONFIG_BOARD_EARLY_INIT_F
 
-#if defined(CONFIG_NAND_U_BOOT) || defined(CONFIG_UART_U_BOOT)
+#define CONFIG_SYS_DA850_SYSCFG_SUSPSRC (      \
+       DAVINCI_SYSCFG_SUSPSRC_EMAC |           \
+       DAVINCI_SYSCFG_SUSPSRC_I2C  |           \
+       DAVINCI_SYSCFG_SUSPSRC_SPI1 |           \
+       DAVINCI_SYSCFG_SUSPSRC_TIMER0 |         \
+       DAVINCI_SYSCFG_SUSPSRC_UART2)
+
+#if defined(CONFIG_UART_U_BOOT)
 #define CONFIG_SYS_TEXT_BASE           0xc1080000
-#else
+#elif !defined(CONFIG_SPL_BUILD)
 #define CONFIG_SYS_TEXT_BASE           0xc1180000
 #endif
 
+/* Spl */
+#define CONFIG_SPL
+#define CONFIG_SPL_NAND_SUPPORT
+#define CONFIG_SPL_NAND_SIMPLE
+#define CONFIG_SPL_NAND_LOAD
+#define CONFIG_SPL_SERIAL_SUPPORT
+#define CONFIG_SPL_LDSCRIPT            "board/$(BOARDDIR)/u-boot-spl-hawk.lds"
+#define CONFIG_SPL_TEXT_BASE           0xc1080000
+#define CONFIG_SPL_STACK               CONFIG_SYS_INIT_SP_ADDR
+
 /*
  * Memory Info
  */
 /*
  * Network & Ethernet Configuration
  */
-#if !defined(CONFIG_NAND_SPL)
 #define CONFIG_DRIVER_TI_EMAC
-#endif
 #define CONFIG_MII
 #define CONFIG_BOOTP_DEFAULT
 #define CONFIG_BOOTP_DNS
 /* Max number of NAND devices */
 #define CONFIG_SYS_MAX_NAND_DEVICE     1
 #define CONFIG_SYS_NAND_BASE_LIST      { 0x62000000, }
-#define NAND_MAX_CHIPS                 1
 /* Block 0--not used by bootcode */
 #define CONFIG_ENV_OFFSET              0x0
 
 #define CONFIG_SYS_NAND_BAD_BLOCK_POS  0
 #define CONFIG_SYS_NAND_ECCSIZE                512
 #define CONFIG_SYS_NAND_ECCBYTES       10
-#define CONFIG_SYS_NAND_ECCSTEPS       (CONFIG_SYS_NAND_PAGE_SIZE /     \
-                                        CONFIG_SYS_NAND_ECCSIZE)
 #define CONFIG_SYS_NAND_OOBSIZE                64
-#define CONFIG_SYS_NAND_ECCTOTAL       (CONFIG_SYS_NAND_ECCBYTES *     \
-                                       CONFIG_SYS_NAND_ECCSTEPS)
+
 #endif /* CONFIG_SYS_USE_NAND */
 
 /*
 #define CONFIG_CMD_SAVES
 #define CONFIG_CMD_MEMORY
 
+#ifdef CONFIG_CMD_BDI
+#define CONFIG_CLOCKS
+#endif
+
 #ifdef CONFIG_SYS_USE_NAND
 #undef CONFIG_CMD_FLASH
 #undef CONFIG_CMD_IMLS
index e66aadf97e0c9c41908689937c0ab64fd6837579..621dbb8fa67fe74c7e06d4db187d2bd3f0aaec17 100644 (file)
 
 #define CONFIG_SYS_NAND_ECCSIZE        256
 #define CONFIG_SYS_NAND_ECCBYTES       3
-#define CONFIG_SYS_NAND_ECCSTEPS       (CONFIG_SYS_NAND_PAGE_SIZE / CONFIG_SYS_NAND_ECCSIZE)
 #define CONFIG_SYS_NAND_OOBSIZE        16
-#define CONFIG_SYS_NAND_ECCTOTAL       (CONFIG_SYS_NAND_ECCBYTES * CONFIG_SYS_NAND_ECCSTEPS)
 #define CONFIG_SYS_NAND_ECCPOS         {0, 1, 2, 3, 6, 7}
 
 #ifdef CONFIG_ENV_IS_IN_NAND
index 700124c0c43281881210e665579d607608de0ad9..c73a10c667d0cbd95c47db4d9dfc1c803bd36aa8 100644 (file)
  * NAND Flash configuration
  */
 #define CONFIG_SYS_MAX_NAND_DEVICE     1
-#define NAND_MAX_CHIPS                 1
 
 #define BOOTFLASH_START                0x0
 
@@ -195,7 +194,7 @@ int get_scl(void);
 #define I2C_SCL(bit)   kw_gpio_set_value(KM_KIRKWOOD_SCL_PIN, bit)
 #endif
 
-#define I2C_DELAY      udelay(3)       /* 1/4 I2C clock duration */
+#define I2C_DELAY      udelay(1)
 #define I2C_SOFT_DECLARATIONS
 
 #endif
index b891b12fef81f38ce19122606efa67dc1fac667f..4d59153706eafb45ff9d652f226b7ce093cbf229 100644 (file)
 #define        CONFIG_SYS_MAX_NAND_DEVICE      1
 #define        CONFIG_SYS_NAND_BASE            0x60000000
 #define        CONFIG_SYS_NAND_5_ADDR_CYCLE
-#define        NAND_MAX_CHIPS                  8
 
 /* Environment is in NAND */
 #define        CONFIG_ENV_IS_IN_NAND
  * Ethernet on SOC (FEC)
  */
 #ifdef CONFIG_CMD_NET
-#define        CONFIG_NET_MULTI
 #define        CONFIG_ETHPRIME                 "FEC0"
 #define        CONFIG_FEC_MXC
 #define        CONFIG_FEC_MXC_MULTI
diff --git a/include/configs/mcx.h b/include/configs/mcx.h
new file mode 100644 (file)
index 0000000..0940e86
--- /dev/null
@@ -0,0 +1,378 @@
+/*
+ * Copyright (C) 2011 Ilya Yanok, Emcraft Systems
+ *
+ * Based on omap3_evm_config.h
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc.
+ */
+
+#ifndef __CONFIG_H
+#define __CONFIG_H
+
+/*
+ * High Level Configuration Options
+ */
+#define CONFIG_OMAP                    /* in a TI OMAP core */
+#define CONFIG_OMAP34XX                        /* which is a 34XX */
+#define CONFIG_OMAP3_MCX               /* working with mcx */
+
+#define MACH_TYPE_MCX                  3656
+#define CONFIG_MACH_TYPE       MACH_TYPE_MCX
+
+#define CONFIG_SYS_CACHELINE_SIZE      64
+
+#define CONFIG_EMIF4   /* The chip has EMIF4 controller */
+
+#include <asm/arch/cpu.h>              /* get chip and board defs */
+#include <asm/arch/omap3.h>
+
+#define CONFIG_OF_LIBFDT
+#define CONFIG_FIT
+
+/*
+ * Leave it at 0x80008000 to allow booting new u-boot.bin with X-loader
+ * and older u-boot.bin with the new U-Boot SPL.
+ */
+#define CONFIG_SYS_TEXT_BASE           0x80008000
+
+/*
+ * Display CPU and Board information
+ */
+#define CONFIG_DISPLAY_CPUINFO
+#define CONFIG_DISPLAY_BOARDINFO
+
+/* Clock Defines */
+#define V_OSCK                 26000000        /* Clock output from T2 */
+#define V_SCLK                 (V_OSCK >> 1)
+
+#define CONFIG_MISC_INIT_R
+
+#define CONFIG_CMDLINE_TAG                     /* enable passing of ATAGs */
+#define CONFIG_SETUP_MEMORY_TAGS
+#define CONFIG_INITRD_TAG
+#define CONFIG_REVISION_TAG
+
+/*
+ * Size of malloc() pool
+ */
+#define CONFIG_ENV_SIZE                        (128 << 10)     /* 128 KiB sector */
+#define CONFIG_SYS_MALLOC_LEN          (1024 << 10)
+/*
+ * DDR related
+ */
+#define CONFIG_SYS_CS0_SIZE            (256 * 1024 * 1024)
+
+/*
+ * Hardware drivers
+ */
+
+/*
+ * NS16550 Configuration
+ */
+#define V_NS16550_CLK                  48000000        /* 48MHz (APLL96/2) */
+
+#define CONFIG_SYS_NS16550
+#define CONFIG_SYS_NS16550_SERIAL
+#define CONFIG_SYS_NS16550_REG_SIZE    (-4)
+#define CONFIG_SYS_NS16550_CLK         V_NS16550_CLK
+
+/*
+ * select serial console configuration
+ */
+#define CONFIG_CONS_INDEX              3
+#define CONFIG_SYS_NS16550_COM3                OMAP34XX_UART3
+#define CONFIG_SERIAL3                 3       /* UART3 */
+
+/* allow to overwrite serial and ethaddr */
+#define CONFIG_ENV_OVERWRITE
+#define CONFIG_BAUDRATE                        115200
+#define CONFIG_SYS_BAUDRATE_TABLE      {4800, 9600, 19200, 38400, 57600,\
+                                       115200}
+#define CONFIG_MMC
+#define CONFIG_OMAP_HSMMC
+#define CONFIG_GENERIC_MMC
+#define CONFIG_DOS_PARTITION
+
+/* EHCI */
+#define CONFIG_USB_STORAGE
+#define CONFIG_OMAP3_GPIO_5
+#define CONFIG_USB_EHCI
+#define CONFIG_USB_EHCI_OMAP
+#define CONFIG_USB_ULPI
+#define CONFIG_USB_ULPI_VIEWPORT_OMAP
+/*#define CONFIG_EHCI_DCACHE*/ /* leave it disabled for now */
+#define CONFIG_OMAP_EHCI_PHY1_RESET_GPIO       154
+#define CONFIG_OMAP_EHCI_PHY2_RESET_GPIO       152
+#define CONFIG_SYS_USB_EHCI_MAX_ROOT_PORTS 3
+
+/* commands to include */
+#include <config_cmd_default.h>
+
+#define CONFIG_CMD_EXT2                /* EXT2 Support                 */
+#define CONFIG_CMD_FAT         /* FAT support                  */
+#define CONFIG_CMD_JFFS2       /* JFFS2 Support                */
+
+#define CONFIG_CMD_DATE
+#define CONFIG_CMD_I2C         /* I2C serial bus support       */
+#define CONFIG_CMD_MMC         /* MMC support                  */
+#define CONFIG_CMD_FAT         /* FAT support                  */
+#define CONFIG_CMD_USB
+#define CONFIG_CMD_NAND                /* NAND support                 */
+#define CONFIG_CMD_DHCP
+#define CONFIG_CMD_PING
+#define CONFIG_CMD_CACHE
+#define CONFIG_CMD_UBI
+#define CONFIG_CMD_UBIFS
+#define CONFIG_RBTREE
+#define CONFIG_LZO
+#define CONFIG_MTD_PARTITIONS
+#define CONFIG_MTD_DEVICE
+#define CONFIG_CMD_MTDPARTS
+
+#undef CONFIG_CMD_FLASH                /* flinfo, erase, protect       */
+#undef CONFIG_CMD_FPGA         /* FPGA configuration Support   */
+#undef CONFIG_CMD_IMI          /* iminfo                       */
+#undef CONFIG_CMD_IMLS         /* List all found images        */
+
+#define CONFIG_SYS_NO_FLASH
+#define CONFIG_HARD_I2C
+#define CONFIG_SYS_I2C_SPEED           100000
+#define CONFIG_SYS_I2C_SLAVE           1
+#define CONFIG_SYS_I2C_BUS             0
+#define CONFIG_DRIVER_OMAP34XX_I2C
+
+/* RTC */
+#define CONFIG_RTC_DS1337
+#define CONFIG_SYS_I2C_RTC_ADDR                0x68
+
+#define CONFIG_CMD_NET
+#define CONFIG_CMD_MII
+#define CONFIG_CMD_NFS
+/*
+ * Board NAND Info.
+ */
+#define CONFIG_SYS_NAND_ADDR           NAND_BASE       /* physical address */
+                                                       /* to access nand */
+#define CONFIG_SYS_NAND_BASE           NAND_BASE       /* physical address */
+                                                       /* to access */
+                                                       /* nand at CS0 */
+
+#define CONFIG_SYS_MAX_NAND_DEVICE     1               /* Max number of */
+                                                       /* NAND devices */
+#define CONFIG_SYS_64BIT_VSPRINTF              /* needed for nand_util.c */
+
+#define CONFIG_JFFS2_NAND
+/* nand device jffs2 lives on */
+#define CONFIG_JFFS2_DEV               "nand0"
+/* start of jffs2 partition */
+#define CONFIG_JFFS2_PART_OFFSET       0x680000
+#define CONFIG_JFFS2_PART_SIZE         0xf980000       /* sz of jffs2 part */
+
+/* Environment information */
+#define CONFIG_BOOTDELAY       10
+
+#define CONFIG_BOOTFILE                "uImage"
+
+#define CONFIG_EXTRA_ENV_SETTINGS \
+       "loadaddr=0x82000000\0" \
+       "console=ttyO2,115200n8\0" \
+       "mmcargs=setenv bootargs console=${console} " \
+               "root=/dev/mmcblk0p2 rw " \
+               "rootfstype=ext3 rootwait\0" \
+       "nandargs=setenv bootargs console=${console} " \
+               "root=/dev/mtdblock4 rw " \
+               "rootfstype=jffs2\0" \
+       "loadbootscript=fatload mmc 0 ${loadaddr} boot.scr\0" \
+       "bootscript=echo Running bootscript from mmc ...; " \
+               "source ${loadaddr}\0" \
+       "loaduimage=fatload mmc 0 ${loadaddr} uImage\0" \
+       "mmcboot=echo Booting from mmc ...; " \
+               "run mmcargs; " \
+               "bootm ${loadaddr}\0" \
+       "nandboot=echo Booting from nand ...; " \
+               "run nandargs; " \
+               "nand read ${loadaddr} 280000 400000; " \
+               "bootm ${loadaddr}\0" \
+
+#define CONFIG_BOOTCOMMAND \
+       "if mmc init; then " \
+               "if run loadbootscript; then " \
+                       "run bootscript; " \
+               "else " \
+                       "if run loaduimage; then " \
+                               "run mmcboot; " \
+                       "else run nandboot; " \
+                       "fi; " \
+               "fi; " \
+       "else run nandboot; fi"
+
+#define CONFIG_AUTO_COMPLETE
+/*
+ * Miscellaneous configurable options
+ */
+#define V_PROMPT                       "mcx # "
+
+#define CONFIG_SYS_LONGHELP            /* undef to save memory */
+#define CONFIG_SYS_HUSH_PARSER         /* use "hush" command parser */
+#define CONFIG_SYS_PROMPT_HUSH_PS2     "> "
+#define CONFIG_SYS_PROMPT              V_PROMPT
+#define CONFIG_SYS_CBSIZE              512     /* Console I/O Buffer Size */
+/* Print Buffer Size */
+#define CONFIG_SYS_PBSIZE              (CONFIG_SYS_CBSIZE + \
+                                       sizeof(CONFIG_SYS_PROMPT) + 16)
+#define CONFIG_SYS_MAXARGS             16      /* max number of command */
+                                               /* args */
+/* Boot Argument Buffer Size */
+#define CONFIG_SYS_BARGSIZE            (CONFIG_SYS_CBSIZE)
+/* memtest works on */
+#define CONFIG_SYS_MEMTEST_START       (OMAP34XX_SDRC_CS0)
+#define CONFIG_SYS_MEMTEST_END         (OMAP34XX_SDRC_CS0 + \
+                                       0x01F00000) /* 31MB */
+
+#define CONFIG_SYS_LOAD_ADDR           (OMAP34XX_SDRC_CS0) /* default load */
+                                                               /* address */
+
+/*
+ * AM3517 has 12 GP timers, they can be driven by the system clock
+ * (12/13/16.8/19.2/38.4MHz) or by 32KHz clock. We use 13MHz (V_SCLK).
+ * This rate is divided by a local divisor.
+ */
+#define CONFIG_SYS_TIMERBASE           OMAP34XX_GPT2
+#define CONFIG_SYS_PTV                 2       /* Divisor: 2^(PTV+1) => 8 */
+#define CONFIG_SYS_HZ                  1000
+
+/*
+ * Stack sizes
+ *
+ * The stack sizes are set up in start.S using the settings below
+ */
+#define CONFIG_STACKSIZE       (128 << 10)     /* regular stack 128 KiB */
+
+/*
+ * Physical Memory Map
+ */
+#define CONFIG_NR_DRAM_BANKS   2       /* CS1 may or may not be populated */
+#define PHYS_SDRAM_1           OMAP34XX_SDRC_CS0
+#define PHYS_SDRAM_1_SIZE      (32 << 20)      /* at least 32 MiB */
+#define PHYS_SDRAM_2           OMAP34XX_SDRC_CS1
+
+/*
+ * FLASH and environment organization
+ */
+
+/* **** PISMO SUPPORT *** */
+
+/* Configure the PISMO */
+#define PISMO1_NAND_SIZE               GPMC_SIZE_128M
+
+#define CONFIG_NAND_OMAP_GPMC
+#define GPMC_NAND_ECC_LP_x16_LAYOUT
+#define CONFIG_ENV_IS_IN_NAND
+#define SMNAND_ENV_OFFSET              0x260000 /* environment starts here */
+
+#define CONFIG_SYS_ENV_SECT_SIZE       (128 << 10)     /* 128 KiB */
+#define CONFIG_ENV_OFFSET              SMNAND_ENV_OFFSET
+#define CONFIG_ENV_ADDR                        SMNAND_ENV_OFFSET
+
+/*
+ * CFI FLASH driver setup
+ */
+/* timeout values are in ticks */
+#define CONFIG_SYS_FLASH_ERASE_TOUT    (100 * CONFIG_SYS_HZ)
+#define CONFIG_SYS_FLASH_WRITE_TOUT    (100 * CONFIG_SYS_HZ)
+
+/* Flash banks JFFS2 should use */
+#define CONFIG_SYS_MAX_MTD_BANKS       (CONFIG_SYS_MAX_FLASH_BANKS + \
+                                       CONFIG_SYS_MAX_NAND_DEVICE)
+#define CONFIG_SYS_JFFS2_MEM_NAND
+/* use flash_info[2] */
+#define CONFIG_SYS_JFFS2_FIRST_BANK    CONFIG_SYS_MAX_FLASH_BANKS
+#define CONFIG_SYS_JFFS2_NUM_BANKS     1
+
+#define CONFIG_SYS_SDRAM_BASE          PHYS_SDRAM_1
+#define CONFIG_SYS_INIT_RAM_ADDR       0x4020f800
+#define CONFIG_SYS_INIT_RAM_SIZE       0x800
+#define CONFIG_SYS_INIT_SP_ADDR                (CONFIG_SYS_INIT_RAM_ADDR + \
+                                        CONFIG_SYS_INIT_RAM_SIZE - \
+                                        GENERATED_GBL_DATA_SIZE)
+
+/* Defines for SPL */
+#define CONFIG_SPL
+#define CONFIG_SPL_NAND_SIMPLE
+#define CONFIG_SPL_NAND_SOFTECC
+
+#define CONFIG_SPL_LIBCOMMON_SUPPORT
+#define CONFIG_SPL_LIBDISK_SUPPORT
+#define CONFIG_SPL_I2C_SUPPORT
+#define CONFIG_SPL_MMC_SUPPORT
+#define CONFIG_SPL_FAT_SUPPORT
+#define CONFIG_SPL_LIBGENERIC_SUPPORT
+#define CONFIG_SPL_SERIAL_SUPPORT
+#define CONFIG_SPL_POWER_SUPPORT
+#define CONFIG_SPL_NAND_SUPPORT
+#define CONFIG_SPL_LDSCRIPT            "$(CPUDIR)/omap-common/u-boot-spl.lds"
+
+#define CONFIG_SPL_TEXT_BASE           0x40200000 /*CONFIG_SYS_SRAM_START*/
+#define CONFIG_SPL_MAX_SIZE            (45 << 10)
+#define CONFIG_SPL_STACK               LOW_LEVEL_SRAM_STACK
+
+/* move malloc and bss high to prevent clashing with the main image */
+#define CONFIG_SYS_SPL_MALLOC_START    0x8f000000
+#define CONFIG_SYS_SPL_MALLOC_SIZE     0x80000
+#define CONFIG_SPL_BSS_START_ADDR      0x8f080000 /* end of RAM */
+#define CONFIG_SPL_BSS_MAX_SIZE                0x80000
+
+#define CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR        0x300 /* address 0x60000 */
+#define CONFIG_SYS_MMC_SD_FAT_BOOT_PARTITION   1
+#define CONFIG_SPL_FAT_LOAD_PAYLOAD_NAME       "u-boot.img"
+
+/* NAND boot config */
+#define CONFIG_SYS_NAND_PAGE_COUNT     64
+#define CONFIG_SYS_NAND_PAGE_SIZE      2048
+#define CONFIG_SYS_NAND_OOBSIZE                64
+#define CONFIG_SYS_NAND_BLOCK_SIZE     (128*1024)
+#define CONFIG_SYS_NAND_5_ADDR_CYCLE
+#define CONFIG_SYS_NAND_BAD_BLOCK_POS  0
+#define CONFIG_SYS_NAND_ECCPOS         {40, 41, 42, 43, 44, 45, 46, 47,\
+                                        48, 49, 50, 51, 52, 53, 54, 55,\
+                                        56, 57, 58, 59, 60, 61, 62, 63}
+#define CONFIG_SYS_NAND_ECCSIZE                256
+#define CONFIG_SYS_NAND_ECCBYTES       3
+
+#define CONFIG_SYS_NAND_ECCSTEPS       (CONFIG_SYS_NAND_PAGE_SIZE / \
+                                               CONFIG_SYS_NAND_ECCSIZE)
+#define CONFIG_SYS_NAND_ECCTOTAL       (CONFIG_SYS_NAND_ECCBYTES * \
+                                               CONFIG_SYS_NAND_ECCSTEPS)
+
+#define CONFIG_SYS_NAND_U_BOOT_START   CONFIG_SYS_TEXT_BASE
+
+#define CONFIG_SYS_NAND_U_BOOT_OFFS    0x80000
+
+/*
+ * ethernet support
+ *
+ */
+#if defined(CONFIG_CMD_NET)
+#define CONFIG_DRIVER_TI_EMAC
+#define CONFIG_DRIVER_TI_EMAC_USE_RMII
+#define CONFIG_MII
+#define CONFIG_BOOTP_DEFAULT
+#define CONFIG_BOOTP_DNS
+#define CONFIG_BOOTP_DNS2
+#define CONFIG_BOOTP_SEND_HOSTNAME
+#define CONFIG_NET_RETRY_COUNT 10
+#endif
+
+#endif /* __CONFIG_H */
index ed9282b998a2b64796495dcfac5a20938cf6503f..f5765b0d4e18997137b6e96afb3c37ef80c84f18 100644 (file)
 #define CONFIG_CMD_NAND
 #define CONFIG_NAND_MPC5121_NFC
 #define CONFIG_SYS_NAND_BASE            0x40000000
-
 #define CONFIG_SYS_MAX_NAND_DEVICE      1
-#define NAND_MAX_CHIPS                  CONFIG_SYS_MAX_NAND_DEVICE
 
 /*
  * Configuration parameters for MPC5121 NAND driver
index c3d3afde0e0f94328dead73fa93fb7e25741d252..01df8b1273268d17e77397f7484e70e9414ad01b 100644 (file)
 #define CONFIG_SYS_NAND_BASE            0x40000000
 
 #define CONFIG_SYS_MAX_NAND_DEVICE      2
-#define NAND_MAX_CHIPS                  CONFIG_SYS_MAX_NAND_DEVICE
 #define CONFIG_SYS_NAND_SELECT_DEVICE  /* driver supports mutipl. chips */
 
 /*
diff --git a/include/configs/mt_ventoux.h b/include/configs/mt_ventoux.h
new file mode 100644 (file)
index 0000000..2034b59
--- /dev/null
@@ -0,0 +1,58 @@
+/*
+ * Copyright (C) 2011
+ * Stefano Babic, DENX Software Engineering, sbabic@denx.de.
+ *
+ * Copyright (C) 2009 TechNexion Ltd.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#ifndef __CONFIG_H
+#define __CONFIG_H
+
+#include "tam3517-common.h"
+
+#define MACH_TYPE_AM3517_MT_VENTOUX    3832
+#define CONFIG_MACH_TYPE       MACH_TYPE_AM3517_MT_VENTOUX
+
+#define CONFIG_BOOTDELAY       10
+#define CONFIG_BOOTFILE                "uImage"
+#define CONFIG_AUTO_COMPLETE
+
+#define CONFIG_HOSTNAME mt_ventoux
+
+/*
+ * Miscellaneous configurable options
+ */
+#define V_PROMPT                       "mt_ventoux => "
+#define CONFIG_SYS_PROMPT              V_PROMPT
+
+/*
+ * FPGA
+ */
+#define CONFIG_CMD_FPGA
+#define CONFIG_FPGA
+#define CONFIG_FPGA_XILINX
+#define CONFIG_FPGA_SPARTAN3
+#define CONFIG_SYS_FPGA_PROG_FEEDBACK
+#define CONFIG_SYS_FPGA_WAIT   10000
+#define CONFIG_MAX_FPGA_DEVICES        1
+#define CONFIG_FPGA_DELAY() udelay(1)
+#define CONFIG_SYS_FPGA_PROG_FEEDBACK
+
+#define        CONFIG_EXTRA_ENV_SETTINGS       CONFIG_TAM3517_SETTINGS \
+       "bootcmd=run net_nfs\0"
+
+#endif /* __CONFIG_H */
index 3f5fcc69a2d2b4d460d4142ab29a4f82a85d12a2..1a6379176b3b4c3590326abe6f0aa43b16bb420b 100644 (file)
  */
 #ifdef CONFIG_CMD_NAND
 #define CONFIG_SYS_MAX_NAND_DEVICE     1
-#define NAND_MAX_CHIPS                 1
 #define CONFIG_SYS_64BIT_VSPRINTF      /* needed for nand_util.c */
 #endif
 
index 124a7a63ae807a07d01208ec47389a5520adaade..0962d3c8c46d3af4f076962ac75aa8f04f2d41e9 100644 (file)
@@ -86,6 +86,8 @@
        "script=boot.scr\0" \
        "uimage=uImage\0" \
        "console=ttymxc3\0" \
+       "fdt_high=0xffffffff\0" \
+       "initrd_high=0xffffffff\0" \
        "mmcdev=1\0" \
        "mmcpart=2\0" \
        "mmcroot=/dev/mmcblk0p3 rootwait rw\0" \
index 464f0ec65042ffb13373ed58d448c96d1f88c97d..d650ee340ab25c629b5808d0e770c11b47a1ad82 100644 (file)
 #define CONFIG_CMD_FAT
 #define CONFIG_DOS_PARTITION
 
+#define CONFIG_CMD_PING
+#define CONFIG_CMD_DHCP
+#define CONFIG_CMD_MII
+#define CONFIG_CMD_NET
+#define        CONFIG_FEC_MXC
+#define        CONFIG_MII
+#define IMX_FEC_BASE                   ENET_BASE_ADDR
+#define        CONFIG_FEC_XCV_TYPE             RGMII
+#define CONFIG_ETHPRIME                        "FEC"
+#define CONFIG_FEC_MXC_PHYADDR         6
+
 /* allow to overwrite serial and ethaddr */
 #define CONFIG_ENV_OVERWRITE
 #define CONFIG_CONS_INDEX              1
@@ -66,8 +77,6 @@
 #include <config_cmd_default.h>
 
 #undef CONFIG_CMD_IMLS
-#undef CONFIG_CMD_NET
-#undef CONFIG_CMD_NFS
 
 #define CONFIG_BOOTDELAY               3
 
@@ -78,6 +87,8 @@
        "script=boot.scr\0" \
        "uimage=uImage\0" \
        "console=ttymxc3\0" \
+       "fdt_high=0xffffffff\0"   \
+       "initrd_high=0xffffffff\0" \
        "mmcdev=0\0" \
        "mmcpart=2\0" \
        "mmcroot=/dev/mmcblk0p3 rootwait rw\0" \
index 91af8a025697b0055b87d135db0034b3e6b3e117..d3a0122a09a6a613604434a4f137a21e44d0621a 100644 (file)
 /* USB EHCI */
 #define CONFIG_CMD_USB
 #define CONFIG_USB_EHCI
+
+#define CONFIG_USB_EHCI_OMAP
+/*#define CONFIG_EHCI_DCACHE*/ /* leave it disabled for now */
+#define CONFIG_OMAP_EHCI_PHY1_RESET_GPIO       147
+
+#define CONFIG_USB_ULPI
+#define CONFIG_USB_ULPI_VIEWPORT_OMAP
+
 #define CONFIG_SYS_USB_EHCI_MAX_ROOT_PORTS 3
 #define CONFIG_USB_HOST_ETHER
 #define CONFIG_USB_ETHER_SMSC95XX
                                                10, 11, 12, 13}
 #define CONFIG_SYS_NAND_ECCSIZE                512
 #define CONFIG_SYS_NAND_ECCBYTES       3
-#define CONFIG_SYS_NAND_ECCSTEPS       (CONFIG_SYS_NAND_PAGE_SIZE / \
-                                               CONFIG_SYS_NAND_ECCSIZE)
-#define CONFIG_SYS_NAND_ECCTOTAL       (CONFIG_SYS_NAND_ECCBYTES * \
-                                               CONFIG_SYS_NAND_ECCSTEPS)
 #define CONFIG_SYS_NAND_U_BOOT_START   CONFIG_SYS_TEXT_BASE
 #define CONFIG_SYS_NAND_U_BOOT_OFFS    0x80000
 
index 2ce3959fdaf5f8963a0edce96f90791c3702f81c..1fcb7af9fe2128969ebee408323c8411c72a44d0 100644 (file)
                                                10, 11, 12, 13}
 #define CONFIG_SYS_NAND_ECCSIZE                512
 #define CONFIG_SYS_NAND_ECCBYTES       3
-#define CONFIG_SYS_NAND_ECCSTEPS       (CONFIG_SYS_NAND_PAGE_SIZE / \
-                                               CONFIG_SYS_NAND_ECCSIZE)
-#define CONFIG_SYS_NAND_ECCTOTAL       (CONFIG_SYS_NAND_ECCBYTES * \
-                                               CONFIG_SYS_NAND_ECCSTEPS)
 #define CONFIG_SYS_NAND_U_BOOT_START   CONFIG_SYS_TEXT_BASE
 #define CONFIG_SYS_NAND_U_BOOT_OFFS    0x80000
 
index b25631790551941864dcb0454c3c19c7bea69545..4910ddaa83b14c9e966aa78d8323440137f779b0 100644 (file)
 #if defined(CONFIG_CMD_NET)
 
 /* Ethernet (SMSC9115 from SMSC9118 family) */
-#define CONFIG_NET_MULTI
 #define CONFIG_SMC911X
 #define CONFIG_SMC911X_32_BIT
 #define CONFIG_SMC911X_BASE            0x2C000000
index 2f879c0bf12ffd5b9799dc9aff1015ff4e11ce83..362fa1d720a06d7940f5f603e75205018d7893aa 100644 (file)
                                                10, 11, 12, 13}
 #define CONFIG_SYS_NAND_ECCSIZE                512
 #define CONFIG_SYS_NAND_ECCBYTES       3
-#define CONFIG_SYS_NAND_ECCSTEPS       (CONFIG_SYS_NAND_PAGE_SIZE / \
-                                               CONFIG_SYS_NAND_ECCSIZE)
-#define CONFIG_SYS_NAND_ECCTOTAL       (CONFIG_SYS_NAND_ECCBYTES * \
-                                               CONFIG_SYS_NAND_ECCSTEPS)
 #define CONFIG_SYS_NAND_U_BOOT_START   CONFIG_SYS_TEXT_BASE
 #define CONFIG_SYS_NAND_U_BOOT_OFFS    0x80000
 
index a5746d160c423c41ad57b2bbb044bd5464df8d7d..b819d213408e7ac1ca1f14a937d707cebb359bfe 100644 (file)
  *----------------------------------------------------------------------------
  */
 #if defined(CONFIG_CMD_NET)
-  #define CONFIG_NET_MULTI
   #define CONFIG_SMC911X               1
   #define CONFIG_SMC911X_32_BIT
   #define CONFIG_SMC911X_BASE     0x2C000000
index e9ef2a3782b159b30bdf7f77e93b7dcbefc1ef84..b4756be5287accabf3fe30e47832bc7b7d20c65d 100644 (file)
 /*
  * High Level Configuration Options
  */
-#define CONFIG_PANDA           1       /* working with Panda */
+#define CONFIG_PANDA   /* working with Panda */
+
+/* USB UHH support options */
+#define CONFIG_CMD_USB
+#define CONFIG_USB_HOST
+#define CONFIG_USB_EHCI
+#define CONFIG_USB_EHCI_OMAP
+#define CONFIG_USB_STORAGE
+#define CONFIG_SYS_USB_EHCI_MAX_ROOT_PORTS 3
+
+#define CONFIG_OMAP_EHCI_PHY1_RESET_GPIO 1
+#define CONFIG_OMAP_EHCI_PHY2_RESET_GPIO 62
+
+/* USB Networking options */
+#define CONFIG_USB_HOST_ETHER
+#define CONFIG_USB_ETHER_SMSC95XX
+
+#define CONFIG_UBOOT_ENABLE_PADS_ALL
+
+#define CONFIG_CMD_PING
+#define CONFIG_CMD_DHCP
+
+#define CONFIG_USB_ULPI
+#define CONFIG_USB_ULPI_VIEWPORT_OMAP
 
 #include <configs/omap4_common.h>
+#define CONFIG_CMD_NET
 
 /* GPIO */
 #define CONFIG_CMD_GPIO
index cd502d10d8331b4042e546fc8c09643fe89078f2..8ede82575c74136ccbb54f1b254135d04c24eb82 100644 (file)
@@ -52,8 +52,6 @@
 #define CONFIG_INITRD_TAG
 #define CONFIG_CMDLINE_EDITING
 
-/* MACH_TYPE_ORIGEN macro will be removed once added to mach-types */
-#define MACH_TYPE_ORIGEN               3455
 #define CONFIG_MACH_TYPE               MACH_TYPE_ORIGEN
 
 /* Power Down Modes */
index 8e8fa163b8acd84e2bc7f3b5f7a6aa4ec9902406..3098c5acfe59c71b9afb7262b3d1295aaba8cbc6 100644 (file)
 #endif
 #define CONFIG_SYS_PCIE1_IO_SIZE       0x00010000      /* 64k */
 
-#define CONFIG_NET_MULTI
 #define CONFIG_PCI_PNP /* do pci plug-and-play */
 #define CONFIG_E1000   /* Defind e1000 pci Ethernet card*/
 #define CONFIG_CMD_PCI
 #endif /* CONFIG_PCI */
 
 #if defined(CONFIG_TSEC_ENET)
-
-#ifndef CONFIG_NET_MULTI
-#define CONFIG_NET_MULTI
-#endif
-
 #define CONFIG_MII             /* MII PHY management */
 #define CONFIG_TSEC1
 #define CONFIG_TSEC1_NAME      "eTSEC1"
 #define CONFIG_ENV_SECT_SIZE   0x10000
 #elif defined(CONFIG_RAMBOOT_SDCARD)
 #define CONFIG_ENV_IS_IN_MMC
+#define CONFIG_FSL_FIXED_MMC_LOCATION
 #define CONFIG_ENV_SIZE                0x2000
 #define CONFIG_SYS_MMC_ENV_DEV 0
 #elif defined(CONFIG_NAND_U_BOOT)
diff --git a/include/configs/paz00.h b/include/configs/paz00.h
new file mode 100644 (file)
index 0000000..f53f20e
--- /dev/null
@@ -0,0 +1,51 @@
+/*
+ * Copyright (c) 2010,2011, NVIDIA CORPORATION.  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 and conditions of the GNU General Public License,
+ * version 2, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
+ * more details.
+ */
+
+#ifndef __CONFIG_H
+#define __CONFIG_H
+
+#include <asm/sizes.h>
+#include "tegra2-common.h"
+
+/* High-level configuration options */
+#define TEGRA2_SYSMEM          "mem=512M@0M"
+#define V_PROMPT               "Tegra2 (Paz00) MOD # "
+#define CONFIG_TEGRA2_BOARD_STRING     "Compal Paz00"
+
+/* Board-specific serial config */
+#define CONFIG_SERIAL_MULTI
+#define CONFIG_TEGRA2_ENABLE_UARTA
+#define CONFIG_SYS_NS16550_COM1                NV_PA_APB_UARTA_BASE
+
+#define CONFIG_MACH_TYPE               MACH_TYPE_PAZ00
+#define CONFIG_SYS_BOARD_ODMDATA       0x800c0085 /* lp1, 512MB */
+
+#define CONFIG_BOARD_EARLY_INIT_F
+
+/* SD/MMC */
+#define CONFIG_MMC
+#define CONFIG_GENERIC_MMC
+#define CONFIG_TEGRA2_MMC
+#define CONFIG_CMD_MMC
+
+#define CONFIG_DOS_PARTITION
+#define CONFIG_EFI_PARTITION
+#define CONFIG_CMD_EXT2
+#define CONFIG_CMD_FAT
+
+/* Environment not stored */
+#define CONFIG_ENV_IS_NOWHERE
+#endif /* __CONFIG_H */
index f0154e091e5883d8ed462f1622b03b70ffa49220..8afc3c03dbfaa9c437966832a0b70c50df4f758d 100644 (file)
 #define CONFIG_CMD_NAND                        /* enable NAND support */
 #define CONFIG_NAND_MPC5121_NFC
 #define CONFIG_SYS_NAND_BASE            0x40000000
-
 #define CONFIG_SYS_MAX_NAND_DEVICE      1
-#define NAND_MAX_CHIPS                  CONFIG_SYS_MAX_NAND_DEVICE
 #define CONFIG_SYS_NAND_SELECT_DEVICE  /* driver supports mutipl. chips */
 
 /*
index 1e803169e6a28e47a74aeb30a558b9e081d8bfde..eba5616ddf9df6446692d7aad57b424da3ff46de 100644 (file)
 
 /* NAND flash */
 #define CONFIG_NAND_ATMEL
-#define NAND_MAX_CHIPS                         1
 #define CONFIG_SYS_MAX_NAND_DEVICE             1
 #define CONFIG_SYS_NAND_BASE                   0x40000000
 #define CONFIG_SYS_NAND_DBW_8                  1
index 32c596241a48101082ba55a329b59087f6c72316..bf31c13bdcfdbcc4e71625c97d6c90e2ca02983c 100644 (file)
 /* NAND flash */
 #ifdef CONFIG_CMD_NAND
 #define CONFIG_NAND_ATMEL
-#define CONFIG_SYS_NAND_MAX_CHIPS      1
 #define CONFIG_SYS_MAX_NAND_DEVICE     1
 #define CONFIG_SYS_NAND_BASE           0x40000000
 #define CONFIG_SYS_NAND_DBW_8          1
index eec915330038e3b02f088f232a053dbdebc1875a..47798787de3f39071bf06863e920f57de67c2eb4 100644 (file)
 
 /* NAND flash */
 #ifdef CONFIG_CMD_NAND
-#define CONFIG_NAND_MAX_CHIPS          1
 #define CONFIG_NAND_ATMEL
 #define CONFIG_SYS_MAX_NAND_DEVICE     1
 #define CONFIG_SYS_NAND_BASE           0x40000000
diff --git a/include/configs/pr1.h b/include/configs/pr1.h
new file mode 100644 (file)
index 0000000..03d4269
--- /dev/null
@@ -0,0 +1,157 @@
+/*
+ * U-boot - Configuration file for PR1 Appliance
+ *
+ * based on bf537-stamp.h
+ * Copyright (c) Switchfin Org. <dpn@switchfin.org>
+ */
+
+#ifndef __CONFIG_PR1_H__
+#define __CONFIG_PR1_H__
+
+#include <asm/config-pre.h>
+
+
+/*
+ * Processor Settings
+ */
+#define CONFIG_BFIN_CPU             bf537-0.3
+#define CONFIG_BFIN_BOOT_MODE       BFIN_BOOT_SPI_MASTER
+
+
+/*
+ * Clock Settings
+ *     CCLK = (CLKIN * VCO_MULT) / CCLK_DIV
+ *     SCLK = (CLKIN * VCO_MULT) / SCLK_DIV
+ */
+/* CONFIG_CLKIN_HZ is any value in Hz                                  */
+#define CONFIG_CLKIN_HZ                        25000000
+/* CLKIN_HALF controls the DF bit in PLL_CTL      0 = CLKIN            */
+/*                                                1 = CLKIN / 2                */
+#define CONFIG_CLKIN_HALF              0
+/* PLL_BYPASS controls the BYPASS bit in PLL_CTL  0 = do not bypass    */
+/*                                                1 = bypass PLL       */
+#define CONFIG_PLL_BYPASS              0
+/* VCO_MULT controls the MSEL (multiplier) bits in PLL_CTL             */
+/* Values can range from 0-63 (where 0 means 64)                       */
+#define CONFIG_VCO_MULT                        24
+/* CCLK_DIV controls the core clock divider                            */
+/* Values can be 1, 2, 4, or 8 ONLY                                    */
+#define CONFIG_CCLK_DIV                        1
+/* SCLK_DIV controls the system clock divider                          */
+/* Values can range from 1-15                                          */
+#define CONFIG_SCLK_DIV                        5
+
+
+/*
+ * Memory Settings
+ */
+#define CONFIG_MEM_ADD_WDTH    11
+#define CONFIG_MEM_SIZE                128
+
+#define CONFIG_EBIU_SDRRC_VAL  0x306
+#define CONFIG_EBIU_SDGCTL_VAL 0x8091998d
+
+#define CONFIG_EBIU_AMGCTL_VAL 0xFF
+#define CONFIG_EBIU_AMBCTL0_VAL        0x7BB07BB0
+#define CONFIG_EBIU_AMBCTL1_VAL        0xFFC27BB0
+
+#define CONFIG_SYS_MONITOR_LEN         (512 * 1024)
+#define CONFIG_SYS_MALLOC_LEN          (384 * 1024)
+
+
+/*
+ * Network Settings
+ */
+#ifndef __ADSPBF534__
+#define ADI_CMDS_NETWORK       1
+#define CONFIG_BFIN_MAC
+#define CONFIG_NETCONSOLE
+#endif
+#define CONFIG_HOSTNAME                pr1
+#define CONFIG_TFTP_BLOCKSIZE  4404
+/* Uncomment next line to use fixed MAC address */
+/* #define CONFIG_ETHADDR      02:80:ad:20:31:e8 */
+
+
+/*
+ * Flash Settings
+ */
+#define CONFIG_SYS_NO_FLASH    /* We have no parallel FLASH */
+
+
+/*
+ * SPI Settings
+ */
+#define CONFIG_BFIN_SPI
+#define CONFIG_ENV_SPI_MAX_HZ  30000000
+#define CONFIG_SF_DEFAULT_SPEED        30000000
+#define CONFIG_SPI_FLASH
+#define CONFIG_SPI_FLASH_STMICRO
+
+
+/*
+ * Env Storage Settings
+ */
+#define CONFIG_ENV_IS_IN_SPI_FLASH
+#define CONFIG_ENV_OFFSET      0x10000
+#define CONFIG_ENV_SIZE                0x2000
+#define CONFIG_ENV_SECT_SIZE   0x10000
+#define CONFIG_ENV_IS_EMBEDDED_IN_LDR
+
+
+/*
+ * I2C Settings
+ */
+#define CONFIG_BFIN_TWI_I2C
+#define CONFIG_HARD_I2C
+
+
+/*
+ * NAND Settings
+ */
+#define CONFIG_NAND_PLAT
+#define CONFIG_SYS_NAND_BASE           0x20000000
+#define CONFIG_SYS_MAX_NAND_DEVICE     1
+
+#define BFIN_NAND_CLE(chip) ((unsigned long)(chip)->IO_ADDR_W | (1 << 2))
+#define BFIN_NAND_ALE(chip) ((unsigned long)(chip)->IO_ADDR_W | (1 << 1))
+#define BFIN_NAND_WRITE(addr, cmd) \
+       do { \
+               bfin_write8(addr, cmd); \
+               SSYNC(); \
+       } while (0)
+
+#define NAND_PLAT_WRITE_CMD(chip, cmd) BFIN_NAND_WRITE(BFIN_NAND_CLE(chip), cmd)
+#define NAND_PLAT_WRITE_ADR(chip, cmd) BFIN_NAND_WRITE(BFIN_NAND_ALE(chip), cmd)
+#define NAND_PLAT_GPIO_DEV_READY       GPIO_PF9
+
+/*
+ * Misc Settings
+ */
+#define CONFIG_BAUDRATE                115200
+#define CONFIG_RTC_BFIN
+#define CONFIG_UART_CONSOLE    0
+#define CONFIG_SYS_PROMPT      "pr1>"
+#define CONFIG_BOOTCOMMAND     "run nandboot"
+#define CONFIG_BOOTDELAY       2
+#define CONFIG_LOADADDR                0x2000000
+
+
+/*
+ * Pull in common ADI header for remaining command/environment setup
+ */
+#include <configs/bfin_adi_common.h>
+
+/*
+ * Overwrite some settings defined in bfin_adi_common.h
+ */
+#undef NAND_ENV_SETTINGS
+#define NAND_ENV_SETTINGS \
+       "nandargs=set bootargs " CONFIG_BOOTARGS "\0" \
+       "nandboot=" \
+               "nand read $(loadaddr) 0x0 0x900000;" \
+               "run nandargs;" \
+               "bootm" \
+               "\0"
+
+#endif
index f989595d0e10d85713128c83d7f0cc5a849f5d51..ebd8223d6f4de77152e1e29a5436e8200172689e 100644 (file)
 #define CONFIG_SYS_NAND_ECC_POS                (6 * NANONOTE_NAND_SIZE)
 #define CONFIG_SYS_NAND_ECCSIZE                512
 #define CONFIG_SYS_NAND_ECCBYTES       9
-#define CONFIG_SYS_NAND_ECCSTEPS       \
-       (CONFIG_SYS_NAND_PAGE_SIZE / CONFIG_SYS_NAND_ECCSIZE)
-#define CONFIG_SYS_NAND_ECCTOTAL       \
-       (CONFIG_SYS_NAND_ECCBYTES * CONFIG_SYS_NAND_ECCSTEPS)
 #define CONFIG_SYS_NAND_ECCPOS         \
                {12, 13, 14, 15, 16, 17, 18, 19,\
                20, 21, 22, 23, 24, 25, 26, 27, \
 #define CONFIG_SYS_NAND_OOBSIZE                128
 #define CONFIG_SYS_NAND_BASE           0xB8000000
 #define CONFIG_SYS_ONENAND_BASE                CONFIG_SYS_NAND_BASE
-#define NAND_MAX_CHIPS                 1
 #define CONFIG_SYS_MAX_NAND_DEVICE     1
 #define CONFIG_SYS_NAND_SELECT_DEVICE  1 /* nand driver supports mutipl.*/
 #define CONFIG_NAND_SPL_TEXT_BASE      0x80000000
index be000cbafe5c7e36f29d2525478fdcb648429e7d..8286680f26c14446bc42d7ab84bad78cf9931457 100644 (file)
@@ -49,6 +49,7 @@
 
 /* input clock of PLL: Universal has 24MHz input clock at EXYNOS4210 */
 #define CONFIG_SYS_CLK_FREQ_C210       24000000
+#define CONFIG_SYS_CLK_FREQ            CONFIG_SYS_CLK_FREQ_C210
 
 #define CONFIG_SETUP_MEMORY_TAGS
 #define CONFIG_CMDLINE_TAG
index a406ca032ce9153d023a3199083ce255a8cf3b0d..8e6954e3aa774d036a08d5053a20e2563b2d43fb 100644 (file)
 
 #define CONFIG_SYS_NAND_ECCSIZE        256
 #define CONFIG_SYS_NAND_ECCBYTES       3
-#define CONFIG_SYS_NAND_ECCSTEPS       (CONFIG_SYS_NAND_PAGE_SIZE / CONFIG_SYS_NAND_ECCSIZE)
 #define CONFIG_SYS_NAND_OOBSIZE        16
-#define CONFIG_SYS_NAND_ECCTOTAL       (CONFIG_SYS_NAND_ECCBYTES * CONFIG_SYS_NAND_ECCSTEPS)
 #define CONFIG_SYS_NAND_ECCPOS         {0, 1, 2, 3, 6, 7}
 
 #ifdef CONFIG_ENV_IS_IN_NAND
index 77c0a08d4cc327aea9de9ed9cbfe21ea0328eec1..7d163201e32b3e677b9da95df5f7862e41d44a2c 100644 (file)
 #define CONFIG_SYS_MAXARGS     16
 #define CONFIG_SYS_BARGSIZE    CONFIG_SYS_CBSIZE
 
-/* may be activated as soon as s3c24x0 has print_cpuinfo support */
-/*#define CONFIG_DISPLAY_CPUINFO*/             /* Display cpu info */
+#define CONFIG_DISPLAY_CPUINFO                         /* Display cpu info */
 
 #define CONFIG_SYS_MEMTEST_START       0x30000000      /* memtest works on */
 #define CONFIG_SYS_MEMTEST_END         0x33F00000      /* 63 MB in DRAM */
 #define CONFIG_NAND_S3C2410
 #define CONFIG_SYS_S3C2410_NAND_HWECC
 #define CONFIG_SYS_MAX_NAND_DEVICE     1
-#define NAND_MAX_CHIPS                 1
 #define CONFIG_SYS_NAND_BASE           0x4E000000
 #endif
 
diff --git a/include/configs/smdk5250.h b/include/configs/smdk5250.h
new file mode 100644 (file)
index 0000000..9659f9e
--- /dev/null
@@ -0,0 +1,204 @@
+/*
+ * Copyright (C) 2011 Samsung Electronics
+ *
+ * Configuration settings for the SAMSUNG SMDK5250 (EXYNOS5250) 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
+
+/* High Level Configuration Options */
+#define CONFIG_SAMSUNG                 /* in a SAMSUNG core */
+#define CONFIG_S5P                     /* S5P Family */
+#define CONFIG_EXYNOS5                 /* which is in a Exynos5 Family */
+#define CONFIG_SMDK5250                        /* which is in a SMDK5250 */
+
+#include <asm/arch/cpu.h>              /* get chip and board defs */
+
+#define CONFIG_ARCH_CPU_INIT
+#define CONFIG_DISPLAY_CPUINFO
+#define CONFIG_DISPLAY_BOARDINFO
+
+/* Keep L2 Cache Disabled */
+#define CONFIG_SYS_DCACHE_OFF
+
+#define CONFIG_SYS_SDRAM_BASE          0x40000000
+#define CONFIG_SYS_TEXT_BASE           0x43E00000
+
+/* input clock of PLL: SMDK5250 has 24MHz input clock */
+#define CONFIG_SYS_CLK_FREQ            24000000
+
+#define CONFIG_SETUP_MEMORY_TAGS
+#define CONFIG_CMDLINE_TAG
+#define CONFIG_INITRD_TAG
+#define CONFIG_CMDLINE_EDITING
+
+/* MACH_TYPE_SMDK5250 macro will be removed once added to mach-types */
+#define MACH_TYPE_SMDK5250             3774
+#define CONFIG_MACH_TYPE               MACH_TYPE_SMDK5250
+
+/* Power Down Modes */
+#define S5P_CHECK_SLEEP                        0x00000BAD
+#define S5P_CHECK_DIDLE                        0xBAD00000
+#define S5P_CHECK_LPA                  0xABAD0000
+
+/* Offset for inform registers */
+#define INFORM0_OFFSET                 0x800
+#define INFORM1_OFFSET                 0x804
+
+/* Size of malloc() pool */
+#define CONFIG_SYS_MALLOC_LEN          (CONFIG_ENV_SIZE + (1 << 20))
+
+/* select serial console configuration */
+#define CONFIG_SERIAL_MULTI
+#define CONFIG_SERIAL1                 /* use SERIAL 1 */
+#define CONFIG_BAUDRATE                        115200
+#define EXYNOS5_DEFAULT_UART_OFFSET    0x010000
+
+#define TZPC_BASE_OFFSET               0x10000
+
+/* SD/MMC configuration */
+#define CONFIG_GENERIC_MMC
+#define CONFIG_MMC
+#define CONFIG_S5P_MMC
+
+#define CONFIG_BOARD_EARLY_INIT_F
+
+/* PWM */
+#define CONFIG_PWM
+
+/* allow to overwrite serial and ethaddr */
+#define CONFIG_ENV_OVERWRITE
+
+/* Command definition*/
+#include <config_cmd_default.h>
+
+#define CONFIG_CMD_PING
+#define CONFIG_CMD_ELF
+#define CONFIG_CMD_MMC
+#define CONFIG_CMD_EXT2
+#define CONFIG_CMD_FAT
+#define CONFIG_CMD_NET
+
+#define CONFIG_BOOTDELAY               3
+#define CONFIG_ZERO_BOOTDELAY_CHECK
+
+/* MMC SPL */
+#define CONFIG_SPL
+#define COPY_BL2_FNPTR_ADDR    0x02020030
+
+#define CONFIG_BOOTCOMMAND     "mmc read 40007000 451 2000; bootm 40007000"
+
+/* Miscellaneous configurable options */
+#define CONFIG_SYS_LONGHELP            /* undef to save memory */
+#define CONFIG_SYS_HUSH_PARSER         /* use "hush" command parser    */
+#define CONFIG_SYS_PROMPT_HUSH_PS2     "> "
+#define CONFIG_SYS_PROMPT              "SMDK5250 # "
+#define CONFIG_SYS_CBSIZE              256     /* Console I/O Buffer Size */
+#define CONFIG_SYS_PBSIZE              384     /* Print Buffer Size */
+#define CONFIG_SYS_MAXARGS             16      /* max number of command args */
+#define CONFIG_DEFAULT_CONSOLE         "console=ttySAC1,115200n8\0"
+/* Boot Argument Buffer Size */
+#define CONFIG_SYS_BARGSIZE            CONFIG_SYS_CBSIZE
+/* memtest works on */
+#define CONFIG_SYS_MEMTEST_START       CONFIG_SYS_SDRAM_BASE
+#define CONFIG_SYS_MEMTEST_END         (CONFIG_SYS_SDRAM_BASE + 0x5E00000)
+#define CONFIG_SYS_LOAD_ADDR           (CONFIG_SYS_SDRAM_BASE + 0x3E00000)
+
+#define CONFIG_SYS_HZ                  1000
+
+/* valid baudrates */
+#define CONFIG_SYS_BAUDRATE_TABLE      { 9600, 19200, 38400, 57600, 115200 }
+
+#define CONFIG_RD_LVL
+
+/* Stack sizes */
+#define CONFIG_STACKSIZE               (256 << 10)     /* 256KB */
+
+#define CONFIG_NR_DRAM_BANKS   8
+#define SDRAM_BANK_SIZE                (256UL << 20UL) /* 256 MB */
+#define PHYS_SDRAM_1           CONFIG_SYS_SDRAM_BASE
+#define PHYS_SDRAM_1_SIZE      SDRAM_BANK_SIZE
+#define PHYS_SDRAM_2           (CONFIG_SYS_SDRAM_BASE + SDRAM_BANK_SIZE)
+#define PHYS_SDRAM_2_SIZE      SDRAM_BANK_SIZE
+#define PHYS_SDRAM_3           (CONFIG_SYS_SDRAM_BASE + (2 * SDRAM_BANK_SIZE))
+#define PHYS_SDRAM_3_SIZE      SDRAM_BANK_SIZE
+#define PHYS_SDRAM_4           (CONFIG_SYS_SDRAM_BASE + (3 * SDRAM_BANK_SIZE))
+#define PHYS_SDRAM_4_SIZE      SDRAM_BANK_SIZE
+#define PHYS_SDRAM_5           (CONFIG_SYS_SDRAM_BASE + (4 * SDRAM_BANK_SIZE))
+#define PHYS_SDRAM_5_SIZE      SDRAM_BANK_SIZE
+#define PHYS_SDRAM_6           (CONFIG_SYS_SDRAM_BASE + (5 * SDRAM_BANK_SIZE))
+#define PHYS_SDRAM_6_SIZE      SDRAM_BANK_SIZE
+#define PHYS_SDRAM_7           (CONFIG_SYS_SDRAM_BASE + (6 * SDRAM_BANK_SIZE))
+#define PHYS_SDRAM_7_SIZE      SDRAM_BANK_SIZE
+#define PHYS_SDRAM_8           (CONFIG_SYS_SDRAM_BASE + (7 * SDRAM_BANK_SIZE))
+#define PHYS_SDRAM_8_SIZE      SDRAM_BANK_SIZE
+
+#define CONFIG_SYS_MONITOR_BASE        0x00000000
+
+/* FLASH and environment organization */
+#define CONFIG_SYS_NO_FLASH
+#undef CONFIG_CMD_IMLS
+#define CONFIG_IDENT_STRING            " for SMDK5250"
+
+#define CONFIG_ENV_IS_IN_MMC
+#define CONFIG_SYS_MMC_ENV_DEV         0
+
+#define CONFIG_SECURE_BL1_ONLY
+
+/* Secure FW size configuration */
+#ifdef CONFIG_SECURE_BL1_ONLY
+#define        CONFIG_SEC_FW_SIZE              (8 << 10)       /* 8KB */
+#else
+#define        CONFIG_SEC_FW_SIZE              0
+#endif
+
+/* Configuration of BL1, BL2, ENV Blocks on mmc */
+#define CONFIG_RES_BLOCK_SIZE  (512)
+#define CONFIG_BL1_SIZE                (16 << 10) /*16 K reserved for BL1*/
+#define        CONFIG_BL2_SIZE         (512UL << 10UL) /* 512 KB */
+#define CONFIG_ENV_SIZE                (16 << 10)      /* 16 KB */
+
+#define CONFIG_BL1_OFFSET      (CONFIG_RES_BLOCK_SIZE + CONFIG_SEC_FW_SIZE)
+#define CONFIG_BL2_OFFSET      (CONFIG_BL1_OFFSET + CONFIG_BL1_SIZE)
+#define CONFIG_ENV_OFFSET      (CONFIG_BL2_OFFSET + CONFIG_BL2_SIZE)
+
+/* U-boot copy size from boot Media to DRAM.*/
+#define BL2_START_OFFSET       (CONFIG_BL2_OFFSET/512)
+#define BL2_SIZE_BLOC_COUNT    (CONFIG_BL2_SIZE/512)
+#define CONFIG_DOS_PARTITION
+
+#define CONFIG_IRAM_STACK      0x02050000
+
+#define CONFIG_SYS_INIT_SP_ADDR        (CONFIG_SYS_LOAD_ADDR - 0x1000000)
+
+/* Ethernet Controllor Driver */
+#ifdef CONFIG_CMD_NET
+#define CONFIG_SMC911X
+#define CONFIG_SMC911X_BASE            0x5000000
+#define CONFIG_SMC911X_16_BIT
+#define CONFIG_ENV_SROM_BANK           1
+#endif /*CONFIG_CMD_NET*/
+
+/* Enable devicetree support */
+#define CONFIG_OF_LIBFDT
+
+#endif /* __CONFIG_H */
index 4d0b7b2d4d282687a692646669c880e5194e72d5..a2b9441050f4592771ad747319224590b27e9877 100644 (file)
 #define CONFIG_SYS_NAND_ECCSIZE        CONFIG_SYS_NAND_PAGE_SIZE
 /* Number of ECC bytes per OOB - S3C6400 calculates 4 bytes ECC in 1-bit mode */
 #define CONFIG_SYS_NAND_ECCBYTES       4
-/* Number of ECC-blocks per NAND page */
-#define CONFIG_SYS_NAND_ECCSTEPS       (CONFIG_SYS_NAND_PAGE_SIZE / CONFIG_SYS_NAND_ECCSIZE)
 /* Size of a single OOB region */
 #define CONFIG_SYS_NAND_OOBSIZE        64
-/* Number of ECC bytes per page */
-#define CONFIG_SYS_NAND_ECCTOTAL       (CONFIG_SYS_NAND_ECCBYTES * CONFIG_SYS_NAND_ECCSTEPS)
 /* ECC byte positions */
 #define CONFIG_SYS_NAND_ECCPOS         {40, 41, 42, 43, 44, 45, 46, 47, \
                                 48, 49, 50, 51, 52, 53, 54, 55, \
index 817d468a72c279e07d15b06892a0a09641f5776c..4c4321d2ff3606d700445648eed2dbe9d67a33ff 100644 (file)
 #define CONFIG_OMAP3_GPIO_5
 #define CONFIG_USB_EHCI
 #define CONFIG_USB_EHCI_OMAP
+#define CONFIG_USB_ULPI
+#define CONFIG_USB_ULPI_VIEWPORT_OMAP
 #define CONFIG_OMAP_EHCI_PHY1_RESET_GPIO       25
 #define CONFIG_SYS_USB_EHCI_MAX_ROOT_PORTS 3
 #define CONFIG_USB_STORAGE
 #define CONFIG_BOOTP_DNS2
 #define CONFIG_BOOTP_SEND_HOSTNAME
 #define CONFIG_NET_RETRY_COUNT 10
-#define CONFIG_NET_MULTI
 
 /* Defines for SPL */
 #define CONFIG_SPL
 #define CONFIG_SYS_NAND_ECCSIZE                256
 #define CONFIG_SYS_NAND_ECCBYTES       3
 
-#define CONFIG_SYS_NAND_ECCSTEPS       (CONFIG_SYS_NAND_PAGE_SIZE / \
-                                               CONFIG_SYS_NAND_ECCSIZE)
-#define CONFIG_SYS_NAND_ECCTOTAL       (CONFIG_SYS_NAND_ECCBYTES * \
-                                               CONFIG_SYS_NAND_ECCSTEPS)
-
 #define CONFIG_SYS_NAND_U_BOOT_START   CONFIG_SYS_TEXT_BASE
 
 #define CONFIG_SYS_NAND_U_BOOT_OFFS    0x80000
 /* Setup MTD for NAND on the SOM */
 #define MTDIDS_DEFAULT         "nand0=omap2-nand.0"
 #define MTDPARTS_DEFAULT       "mtdparts=omap2-nand.0:512k(MLO)," \
-                               "512k(u-boot),128k(env1)," \
-                               "128k(env2),6m(kernel),-(rootfs)"
+                               "1m(u-boot),256k(env1)," \
+                               "256k(env2),6m(kernel),-(rootfs)"
 
 #define xstr(s)        str(s)
 #define str(s) #s
index 4bced0c9994edfebf6cbeb38eb64b924db29f2c2..7c3f33427c4ca0b47dced4297fd7c444fd80ea90 100644 (file)
@@ -90,7 +90,6 @@
 #define CONFIG_CMD_MTDPARTS
 #define CONFIG_MTD_DEVICE
 #define CONFIG_JFFS2_NAND
-#define NAND_MAX_CHIPS                 1
 #define CONFIG_ENV_OFFSET              0x180000
 
 /*
diff --git a/include/configs/trats.h b/include/configs/trats.h
new file mode 100644 (file)
index 0000000..10f11d9
--- /dev/null
@@ -0,0 +1,217 @@
+/*
+ * Copyright (C) 2011 Samsung Electronics
+ * Heungjun Kim <riverful.kim@samsung.com>
+ *
+ * Configuation settings for the SAMSUNG TRATS (EXYNOS4210) 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
+
+/*
+ * High Level Configuration Options
+ * (easy to change)
+ */
+#define CONFIG_SAMSUNG         /* in a SAMSUNG core */
+#define CONFIG_S5P             /* which is in a S5P Family */
+#define CONFIG_EXYNOS4210      /* which is in a EXYNOS4210 */
+#define CONFIG_TRATS           /* working with TRATS */
+
+#include <asm/arch/cpu.h>      /* get chip and board defs */
+
+#define CONFIG_ARCH_CPU_INIT
+#define CONFIG_DISPLAY_CPUINFO
+#define CONFIG_DISPLAY_BOARDINFO
+
+/* Keep L2 Cache Disabled */
+#define CONFIG_SYS_L2CACHE_OFF
+
+#define CONFIG_SYS_SDRAM_BASE          0x40000000
+#define CONFIG_SYS_TEXT_BASE           0x63300000
+
+/* input clock of PLL: TRATS has 24MHz input clock at EXYNOS4210 */
+#define CONFIG_SYS_CLK_FREQ_C210       24000000
+#define CONFIG_SYS_CLK_FREQ            CONFIG_SYS_CLK_FREQ_C210
+
+#define CONFIG_SETUP_MEMORY_TAGS
+#define CONFIG_CMDLINE_TAG
+#define CONFIG_INITRD_TAG
+#define CONFIG_REVISION_TAG
+#define CONFIG_CMDLINE_EDITING
+#define CONFIG_SKIP_LOWLEVEL_INIT
+#define CONFIG_BOARD_EARLY_INIT_F
+
+/* MACH_TYPE_TRATS macro will be removed once added to mach-types */
+#define MACH_TYPE_TRATS                        3928
+#define CONFIG_MACH_TYPE               MACH_TYPE_TRATS
+
+/* Size of malloc() pool */
+#define CONFIG_SYS_MALLOC_LEN          (CONFIG_ENV_SIZE + (1 << 20))
+
+/* select serial console configuration */
+#define CONFIG_SERIAL_MULTI
+#define CONFIG_SERIAL2                 /* use SERIAL 2 */
+#define CONFIG_BAUDRATE                        115200
+
+/* MMC */
+#define CONFIG_GENERIC_MMC
+#define CONFIG_MMC
+#define CONFIG_S5P_MMC
+
+/* PWM */
+#define CONFIG_PWM
+
+/* It should define before config_cmd_default.h */
+#define CONFIG_SYS_NO_FLASH
+
+/* Command definition */
+#include <config_cmd_default.h>
+
+#undef CONFIG_CMD_FPGA
+#undef CONFIG_CMD_MISC
+#undef CONFIG_CMD_NET
+#undef CONFIG_CMD_NFS
+#undef CONFIG_CMD_XIMG
+#undef CONFIG_CMD_CACHE
+#undef CONFIG_CMD_ONENAND
+#undef CONFIG_CMD_MTDPARTS
+#define CONFIG_CMD_MMC
+
+#define CONFIG_BOOTDELAY               1
+#define CONFIG_ZERO_BOOTDELAY_CHECK
+#define CONFIG_BOOTARGS                        "Please use defined boot"
+#define CONFIG_BOOTCOMMAND             "run mmcboot"
+
+#define CONFIG_DEFAULT_CONSOLE         "console=ttySAC2,115200n8\0"
+#define CONFIG_BOOTBLOCK               "10"
+#define CONFIG_ENV_COMMON_BOOT         "${console} ${meminfo}"
+
+#define CONFIG_ENV_OVERWRITE
+#define CONFIG_SYS_CONSOLE_INFO_QUIET
+#define CONFIG_SYS_CONSOLE_IS_IN_ENV
+
+#define CONFIG_EXTRA_ENV_SETTINGS \
+       "bootk=" \
+               "run loaduimage; bootm 0x40007FC0\0" \
+       "updatemmc=" \
+               "mmc boot 0 1 1 1; mmc write 0 0x42008000 0 0x200;" \
+               "mmc boot 0 1 1 0\0" \
+       "updatebackup=" \
+               "mmc boot 0 1 1 2; mmc write 0 0x42100000 0 0x200;" \
+               "mmc boot 0 1 1 0\0" \
+       "updatebootb=" \
+               "mmc read 0 0x42100000 0x80 0x200; run updatebackup\0" \
+       "lpj=lpj=3981312\0" \
+       "nfsboot=" \
+               "set bootargs root=/dev/nfs rw " \
+               "nfsroot=${nfsroot},nolock,tcp " \
+               "ip=${ipaddr}:${serverip}:${gatewayip}:" \
+               "${netmask}:generic:usb0:off " CONFIG_ENV_COMMON_BOOT \
+               "; run bootk\0" \
+       "ramfsboot=" \
+               "set bootargs root=/dev/ram0 rw rootfstype=ext2 " \
+               "${console} ${meminfo} " \
+               "initrd=0x43000000,8M ramdisk=8192\0" \
+       "mmcboot=" \
+               "set bootargs root=/dev/mmcblk${mmcdev}p${mmcrootpart} " \
+               "${lpj} rootwait ${console} ${meminfo} ${opts} ${lcdinfo}; " \
+               "run loaduimage; bootm 0x40007FC0\0" \
+       "bootchart=set opts init=/sbin/bootchartd; run bootcmd\0" \
+       "boottrace=setenv opts initcall_debug; run bootcmd\0" \
+       "mmcoops=mmc read 0 0x40000000 0x40 8; md 0x40000000 0x400\0" \
+       "verify=n\0" \
+       "rootfstype=ext4\0" \
+       "console=" CONFIG_DEFAULT_CONSOLE \
+       "meminfo=crashkernel=32M@0x50000000\0" \
+       "nfsroot=/nfsroot/arm\0" \
+       "bootblock=" CONFIG_BOOTBLOCK "\0" \
+       "mmcdev=0\0" \
+       "mmcbootpart=2\0" \
+       "mmcrootpart=3\0" \
+       "opts=always_resume=1"
+
+/* Miscellaneous configurable options */
+#define CONFIG_SYS_LONGHELP            /* undef to save memory */
+#define CONFIG_SYS_HUSH_PARSER         /* use "hush" command parser */
+#define CONFIG_SYS_PROMPT_HUSH_PS2     "> "
+#define CONFIG_SYS_PROMPT              "TRATS # "
+#define CONFIG_SYS_CBSIZE              256     /* Console I/O Buffer Size */
+#define CONFIG_SYS_PBSIZE              384     /* Print Buffer Size */
+#define CONFIG_SYS_MAXARGS             16      /* max number of command args */
+/* Boot Argument Buffer Size */
+#define CONFIG_SYS_BARGSIZE            CONFIG_SYS_CBSIZE
+/* memtest works on */
+#define CONFIG_SYS_MEMTEST_START       CONFIG_SYS_SDRAM_BASE
+#define CONFIG_SYS_MEMTEST_END         (CONFIG_SYS_SDRAM_BASE + 0x5000000)
+#define CONFIG_SYS_LOAD_ADDR           (CONFIG_SYS_SDRAM_BASE + 0x4800000)
+
+#define CONFIG_SYS_HZ                  1000
+
+/* valid baudrates */
+#define CONFIG_SYS_BAUDRATE_TABLE      { 9600, 19200, 38400, 57600, 115200 }
+
+/* Stack sizes */
+#define CONFIG_STACKSIZE               (256 << 10) /* regular stack 256KB */
+
+/* TRATS has 2 banks of DRAM */
+#define CONFIG_NR_DRAM_BANKS   2
+#define PHYS_SDRAM_1           CONFIG_SYS_SDRAM_BASE   /* LDDDR2 DMC 0 */
+#define PHYS_SDRAM_1_SIZE      (256 << 20)             /* 256 MB in CS 0 */
+#define PHYS_SDRAM_2           0x50000000              /* LPDDR2 DMC 1 */
+#define PHYS_SDRAM_2_SIZE      (256 << 20)             /* 256 MB in CS 0 */
+
+#define CONFIG_SYS_MEM_TOP_HIDE                (1 << 20)       /* ram console */
+
+#define CONFIG_SYS_MONITOR_BASE                0x00000000
+#define CONFIG_SYS_MONITOR_LEN         (256 << 10)     /* Reserve 2 sectors */
+
+#define CONFIG_ENV_IS_IN_MMC
+#define CONFIG_SYS_MMC_ENV_DEV         0
+#define CONFIG_ENV_SIZE                        4096
+#define CONFIG_ENV_OFFSET              ((32 - 4) << 10) /* 32KiB - 4KiB */
+
+#define CONFIG_DOS_PARTITION
+
+#define CONFIG_SYS_INIT_SP_ADDR        (CONFIG_SYS_LOAD_ADDR - GENERATED_GBL_DATA_SIZE)
+#define CONFIG_SYS_CACHELINE_SIZE       32
+
+#include <asm/arch/gpio.h>
+/*
+ * I2C Settings
+ */
+#define CONFIG_SOFT_I2C_GPIO_SCL exynos4_gpio_part1_get_nr(b, 7)
+#define CONFIG_SOFT_I2C_GPIO_SDA exynos4_gpio_part1_get_nr(b, 6)
+
+#define CONFIG_SOFT_I2C
+#define CONFIG_SOFT_I2C_READ_REPEATED_START
+#define CONFIG_SYS_I2C_SPEED   50000
+#define CONFIG_I2C_MULTI_BUS
+#define CONFIG_SYS_MAX_I2C_BUS 7
+
+#define CONFIG_PMIC
+#define CONFIG_PMIC_I2C
+#define CONFIG_PMIC_MAX8998
+
+#define CONFIG_USB_GADGET
+#define CONFIG_USB_GADGET_S3C_UDC_OTG
+#define CONFIG_USB_GADGET_DUALSPEED
+
+#endif /* __CONFIG_H */
diff --git a/include/configs/tricorder.h b/include/configs/tricorder.h
new file mode 100644 (file)
index 0000000..f87696b
--- /dev/null
@@ -0,0 +1,320 @@
+/*
+ * (C) Copyright 2006-2008
+ * Texas Instruments.
+ * Richard Woodruff <r-woodruff2@ti.com>
+ * Syed Mohammed Khasim <x0khasim@ti.com>
+ *
+ * (C) Copyright 2012
+ * Corscience GmbH & Co. KG
+ * Thomas Weber <weber@corscience.de>
+ *
+ * Configuration settings for the Tricorder 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
+
+/* High Level Configuration Options */
+#define CONFIG_OMAP                    /* in a TI OMAP core */
+#define CONFIG_OMAP34XX                        /* which is a 34XX */
+
+#define CONFIG_MACH_TYPE               MACH_TYPE_TRICORDER
+/*
+ * 1MB into the SDRAM to allow for SPL's bss at the beginning of SDRAM
+ * 64 bytes before this address should be set aside for u-boot.img's
+ * header. That is 0x800FFFC0--0x80100000 should not be used for any
+ * other needs.
+ */
+#define CONFIG_SYS_TEXT_BASE           0x80100000
+
+#define CONFIG_SDRC                    /* The chip has SDRC controller */
+
+#include <asm/arch/cpu.h>              /* get chip and board defs */
+#include <asm/arch/omap3.h>
+
+/* Display CPU and Board information */
+#define CONFIG_DISPLAY_CPUINFO
+#define CONFIG_DISPLAY_BOARDINFO
+
+/* Clock Defines */
+#define V_OSCK                         26000000 /* Clock output from T2 */
+#define V_SCLK                         (V_OSCK >> 1)
+
+#undef CONFIG_USE_IRQ                  /* no support for IRQs */
+#define CONFIG_MISC_INIT_R
+
+#define CONFIG_CMDLINE_TAG             /* enable passing of ATAGs */
+#define CONFIG_SETUP_MEMORY_TAGS
+#define CONFIG_INITRD_TAG
+#define CONFIG_REVISION_TAG
+
+#define CONFIG_OF_LIBFDT
+
+/* Size of malloc() pool */
+#define CONFIG_ENV_SIZE                        (128 << 10)     /* 128 KiB */
+                                               /* Sector */
+#define CONFIG_SYS_MALLOC_LEN          (CONFIG_ENV_SIZE + (512 << 10))
+
+/* Hardware drivers */
+
+/* NS16550 Configuration */
+#define CONFIG_SYS_NS16550
+#define CONFIG_SYS_NS16550_SERIAL
+#define CONFIG_SYS_NS16550_REG_SIZE    (-4)
+#define CONFIG_SYS_NS16550_CLK         48000000 /* 48MHz (APLL96/2) */
+
+/* select serial console configuration */
+#define CONFIG_CONS_INDEX              3
+#define CONFIG_SYS_NS16550_COM3                OMAP34XX_UART3
+#define CONFIG_SERIAL3                 3
+#define CONFIG_BAUDRATE                        115200
+#define CONFIG_SYS_BAUDRATE_TABLE      {4800, 9600, 19200, 38400, 57600,\
+                                       115200}
+
+/* MMC */
+#define CONFIG_GENERIC_MMC
+#define CONFIG_MMC
+#define CONFIG_OMAP_HSMMC
+#define CONFIG_DOS_PARTITION
+
+/* I2C */
+#define CONFIG_HARD_I2C
+#define CONFIG_SYS_I2C_SPEED           100000
+#define CONFIG_SYS_I2C_SLAVE           1
+#define CONFIG_SYS_I2C_BUS             0
+#define CONFIG_SYS_I2C_BUS_SELECT      1
+#define CONFIG_DRIVER_OMAP34XX_I2C     1
+
+/* TWL4030 */
+#define CONFIG_TWL4030_POWER
+#define CONFIG_TWL4030_LED
+
+/* Board NAND Info */
+#define CONFIG_SYS_NO_FLASH            /* no NOR flash */
+#define CONFIG_MTD_DEVICE              /* needed for mtdparts commands */
+#define MTDIDS_DEFAULT                 "nand0=nand"
+#define MTDPARTS_DEFAULT               "mtdparts=nand:" \
+                                               "512k(u-boot-spl)," \
+                                               "1920k(u-boot)," \
+                                               "128k(u-boot-env)," \
+                                               "4m(kernel)," \
+                                               "-(fs)"
+
+#define CONFIG_NAND_OMAP_GPMC
+#define CONFIG_SYS_NAND_ADDR           NAND_BASE       /* physical address */
+                                                       /* to access nand */
+#define CONFIG_SYS_NAND_BASE           NAND_BASE       /* physical address */
+                                                       /* to access nand at */
+                                                       /* CS0 */
+#define GPMC_NAND_ECC_LP_x16_LAYOUT    1
+
+#define CONFIG_SYS_MAX_NAND_DEVICE     1               /* Max number of NAND */
+                                                       /* devices */
+
+/* commands to include */
+#include <config_cmd_default.h>
+
+#define CONFIG_CMD_EXT2                        /* EXT2 Support */
+#define CONFIG_CMD_FAT                 /* FAT support */
+#define CONFIG_CMD_I2C                 /* I2C serial bus support */
+#define CONFIG_CMD_MMC                 /* MMC support */
+#define CONFIG_CMD_MTDPARTS            /* Enable MTD parts commands */
+#define CONFIG_CMD_NAND                        /* NAND support */
+#define CONFIG_CMD_NAND_LOCK_UNLOCK    /* nand (un)lock commands */
+#define CONFIG_CMD_UBI                 /* UBIFS commands */
+
+#undef CONFIG_CMD_NET
+#undef CONFIG_CMD_NFS
+#undef CONFIG_CMD_FPGA                 /* FPGA configuration Support */
+#undef CONFIG_CMD_IMI                  /* iminfo */
+#undef CONFIG_CMD_JFFS2                        /* JFFS2 Support */
+
+/* needed for ubi */
+#define CONFIG_RBTREE
+#define CONFIG_MTD_DEVICE       /* needed for mtdparts commands */
+#define CONFIG_MTD_PARTITIONS
+
+/* Environment information */
+#define CONFIG_ENV_OVERWRITE /* allow to overwrite serial and ethaddr */
+
+#define CONFIG_BOOTDELAY               3
+
+#define CONFIG_EXTRA_ENV_SETTINGS \
+       "loadaddr=0x82000000\0" \
+       "console=ttyO2,115200n8\0" \
+       "vram=12M\0" \
+       "lcdmode=800x600\0" \
+       "defaultdisplay=lcd\0" \
+       "kernelopts=rw rootwait\0" \
+       "commonargs=" \
+               "setenv bootargs console=${console} " \
+               "vram=${vram} " \
+               "omapfb.mode=lcd:${lcdmode} " \
+               "omapdss.def_disp=${defaultdisplay}\0" \
+       "mmcargs=" \
+               "run commonargs; " \
+               "setenv bootargs ${bootargs} " \
+               "root=/dev/mmcblk0p2 " \
+               "${kernelopts}\0" \
+       "nandargs=" \
+               "run commonargs; " \
+               "setenv bootargs ${bootargs} " \
+               "omapfb.mode=lcd:${lcdmode} " \
+               "omapdss.def_disp=${defaultdisplay} " \
+               "root=ubi0:rootfs " \
+               "rootfstype=ubifs " \
+               "${kernelopts}\0" \
+       "loadbootscript=fatload mmc 0 ${loadaddr} boot.scr\0" \
+       "bootscript=echo Running bootscript from mmc ...; " \
+               "source ${loadaddr}\0" \
+       "loaduimage=fatload mmc 0 ${loadaddr} uImage\0" \
+       "eraseenv=nand unlock 0x260000 0x20000; nand erase 0x260000 0x20000\0" \
+       "mmcboot=echo Booting from mmc ...; " \
+               "run mmcargs; " \
+               "bootm ${loadaddr}\0" \
+       "nandboot=echo Booting from nand ...; " \
+               "run nandargs; " \
+               "nand read ${loadaddr} 280000 400000; " \
+               "bootm ${loadaddr}\0" \
+       "autoboot=if mmc init 0; then " \
+                       "if run loadbootscript; then " \
+                               "run bootscript; " \
+                       "else " \
+                               "if run loaduimage; then " \
+                                       "run mmcboot; " \
+                               "else run nandboot; " \
+                               "fi; " \
+                       "fi; " \
+               "else run nandboot; fi\0"
+
+
+#define CONFIG_BOOTCOMMAND "run autoboot"
+
+/* Miscellaneous configurable options */
+#define CONFIG_SYS_LONGHELP            /* undef to save memory */
+#define CONFIG_SYS_HUSH_PARSER         /* use "hush" command parser */
+#define CONFIG_AUTO_COMPLETE
+#define CONFIG_SYS_PROMPT_HUSH_PS2     "> "
+#define CONFIG_SYS_PROMPT              "OMAP3 Tricorder # "
+#define CONFIG_SYS_CBSIZE              512     /* Console I/O Buffer Size */
+/* Print Buffer Size */
+#define CONFIG_SYS_PBSIZE              (CONFIG_SYS_CBSIZE + \
+                                       sizeof(CONFIG_SYS_PROMPT) + 16)
+#define CONFIG_SYS_MAXARGS             16      /* max number of command args */
+
+/* Boot Argument Buffer Size */
+#define CONFIG_SYS_BARGSIZE            (CONFIG_SYS_CBSIZE)
+
+#define CONFIG_SYS_MEMTEST_START       (OMAP34XX_SDRC_CS0 + 0x07000000)
+#define CONFIG_SYS_MEMTEST_END         (CONFIG_SYS_MEMTEST_START + \
+                                       0x01000000) /* 16MB */
+
+#define CONFIG_SYS_LOAD_ADDR           (OMAP34XX_SDRC_CS0 + 0x02000000)
+
+/*
+ * OMAP3 has 12 GP timers, they can be driven by the system clock
+ * (12/13/16.8/19.2/38.4MHz) or by 32KHz clock. We use 13MHz (V_SCLK).
+ * This rate is divided by a local divisor.
+ */
+#define CONFIG_SYS_TIMERBASE           (OMAP34XX_GPT2)
+#define CONFIG_SYS_PTV                 2 /* Divisor: 2^(PTV+1) => 8 */
+#define CONFIG_SYS_HZ                  1000
+
+/* The stack sizes are set up in start.S using the settings below */
+#define CONFIG_STACKSIZE               (128 << 10) /* regular stack 128 KiB */
+
+/*  Physical Memory Map  */
+#define CONFIG_NR_DRAM_BANKS           2 /* CS1 may or may not be populated */
+#define PHYS_SDRAM_1                   OMAP34XX_SDRC_CS0
+#define PHYS_SDRAM_1_SIZE              (128 << 20)     /* at least 128 MiB */
+#define PHYS_SDRAM_2                   OMAP34XX_SDRC_CS1
+
+/* NAND and environment organization  */
+#define PISMO1_NAND_SIZE               GPMC_SIZE_128M
+
+#define CONFIG_SYS_MONITOR_LEN         (256 << 10)     /* Reserve 2 sectors */
+
+#define CONFIG_ENV_IS_IN_NAND          1
+#define CONFIG_ENV_OFFSET              0x260000 /* environment starts here */
+
+#define CONFIG_SYS_SDRAM_BASE          PHYS_SDRAM_1
+#define CONFIG_SYS_INIT_RAM_ADDR       0x4020f800
+#define CONFIG_SYS_INIT_RAM_SIZE       0x800
+#define CONFIG_SYS_INIT_SP_ADDR        (CONFIG_SYS_INIT_RAM_ADDR + \
+                                               CONFIG_SYS_INIT_RAM_SIZE - \
+                                               GENERATED_GBL_DATA_SIZE)
+
+/* SRAM config */
+#define CONFIG_SYS_SRAM_START          0x40200000
+#define CONFIG_SYS_SRAM_SIZE           0x10000
+
+/* Defines for SPL */
+#define CONFIG_SPL
+#define CONFIG_SPL_NAND_SIMPLE
+
+#define CONFIG_SPL_LIBCOMMON_SUPPORT
+#define CONFIG_SPL_LIBDISK_SUPPORT
+#define CONFIG_SPL_I2C_SUPPORT
+#define CONFIG_SPL_LIBGENERIC_SUPPORT
+#define CONFIG_SPL_SERIAL_SUPPORT
+#define CONFIG_SPL_POWER_SUPPORT
+#define CONFIG_SPL_NAND_SUPPORT
+#define CONFIG_SPL_MMC_SUPPORT
+#define CONFIG_SPL_FAT_SUPPORT
+#define CONFIG_SPL_LDSCRIPT            "$(CPUDIR)/omap-common/u-boot-spl.lds"
+#define CONFIG_SPL_FAT_LOAD_PAYLOAD_NAME        "u-boot.img"
+#define CONFIG_SYS_MMC_SD_FAT_BOOT_PARTITION    1
+#define CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR 0x300 /* address 0x60000 */
+
+#define CONFIG_SPL_TEXT_BASE           0x40200000 /*CONFIG_SYS_SRAM_START*/
+#define CONFIG_SPL_MAX_SIZE            0xB400  /* 45 K */
+#define CONFIG_SPL_STACK               LOW_LEVEL_SRAM_STACK
+
+#define CONFIG_SPL_BSS_START_ADDR      0x80000000 /*CONFIG_SYS_SDRAM_BASE*/
+#define CONFIG_SPL_BSS_MAX_SIZE                0x80000
+
+/* NAND boot config */
+#define CONFIG_SYS_NAND_5_ADDR_CYCLE
+#define CONFIG_SYS_NAND_PAGE_COUNT     64
+#define CONFIG_SYS_NAND_PAGE_SIZE      2048
+#define CONFIG_SYS_NAND_OOBSIZE                64
+#define CONFIG_SYS_NAND_BLOCK_SIZE     (128*1024)
+#define CONFIG_SYS_NAND_BAD_BLOCK_POS  NAND_LARGE_BADBLOCK_POS
+#define CONFIG_SYS_NAND_ECCPOS         {2, 3, 4, 5, 6, 7, 8, 9,\
+                                               10, 11, 12, 13}
+
+#define CONFIG_SYS_NAND_ECCSIZE                512
+#define CONFIG_SYS_NAND_ECCBYTES       3
+
+#define CONFIG_SYS_NAND_ECCSTEPS       (CONFIG_SYS_NAND_PAGE_SIZE / \
+                                               CONFIG_SYS_NAND_ECCSIZE)
+#define CONFIG_SYS_NAND_ECCTOTAL       (CONFIG_SYS_NAND_ECCBYTES * \
+                                               CONFIG_SYS_NAND_ECCSTEPS)
+
+#define CONFIG_SYS_NAND_U_BOOT_START   CONFIG_SYS_TEXT_BASE
+
+#define CONFIG_SYS_NAND_U_BOOT_OFFS    0x80000
+#define CONFIG_SYS_NAND_U_BOOT_SIZE    0x200000
+
+#define CONFIG_SYS_SPL_MALLOC_START    0x80208000
+#define CONFIG_SYS_SPL_MALLOC_SIZE     0x100000        /* 1 MB */
+
+#endif /* __CONFIG_H */
index a553712699b6b2a4b6be02c10036785e54cde359..35d2bd820f6fd46e927bb65a647bd8ecb960dda9 100644 (file)
 #define CONFIG_SMC911X_BASE            (CS4_BASE+0x200000)
 #define CONFIG_SMC911X_16_BIT
 
+/* mmc driver */
+#define CONFIG_MMC
+#define CONFIG_GENERIC_MMC
+#define CONFIG_MXC_MMC
+#define CONFIG_MXC_MCI_REGS_BASE       SDHC1_BASE_ADDR
 /*
  * Command definition
  */
 
 #define CONFIG_CMDLINE_EDITING
 
+/* MMC boot support */
+#define CONFIG_CMD_MMC
+#define CONFIG_DOS_PARTITION
+#define CONFIG_EFI_PARTITION
+#define CONFIG_CMD_EXT2
+#define CONFIG_CMD_FAT
+
 #define CONFIG_NAND_MXC
 #define CONFIG_SYS_MAX_NAND_DEVICE             1
-#define CONFIG_SYS_NAND_MAX_CHIPS              1
 
 /*
  * actually this is nothing someone wants to configure!
diff --git a/include/linux/bch.h b/include/linux/bch.h
new file mode 100644 (file)
index 0000000..295b4ef
--- /dev/null
@@ -0,0 +1,79 @@
+/*
+ * Generic binary BCH encoding/decoding library
+ *
+ * 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., 51
+ * Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Copyright Â© 2011 Parrot S.A.
+ *
+ * Author: Ivan Djelic <ivan.djelic@parrot.com>
+ *
+ * Description:
+ *
+ * This library provides runtime configurable encoding/decoding of binary
+ * Bose-Chaudhuri-Hocquenghem (BCH) codes.
+*/
+#ifndef _BCH_H
+#define _BCH_H
+
+#include <linux/types.h>
+
+/**
+ * struct bch_control - BCH control structure
+ * @m:          Galois field order
+ * @n:          maximum codeword size in bits (= 2^m-1)
+ * @t:          error correction capability in bits
+ * @ecc_bits:   ecc exact size in bits, i.e. generator polynomial degree (<=m*t)
+ * @ecc_bytes:  ecc max size (m*t bits) in bytes
+ * @a_pow_tab:  Galois field GF(2^m) exponentiation lookup table
+ * @a_log_tab:  Galois field GF(2^m) log lookup table
+ * @mod8_tab:   remainder generator polynomial lookup tables
+ * @ecc_buf:    ecc parity words buffer
+ * @ecc_buf2:   ecc parity words buffer
+ * @xi_tab:     GF(2^m) base for solving degree 2 polynomial roots
+ * @syn:        syndrome buffer
+ * @cache:      log-based polynomial representation buffer
+ * @elp:        error locator polynomial
+ * @poly_2t:    temporary polynomials of degree 2t
+ */
+struct bch_control {
+       unsigned int    m;
+       unsigned int    n;
+       unsigned int    t;
+       unsigned int    ecc_bits;
+       unsigned int    ecc_bytes;
+/* private: */
+       uint16_t       *a_pow_tab;
+       uint16_t       *a_log_tab;
+       uint32_t       *mod8_tab;
+       uint32_t       *ecc_buf;
+       uint32_t       *ecc_buf2;
+       unsigned int   *xi_tab;
+       unsigned int   *syn;
+       int            *cache;
+       struct gf_poly *elp;
+       struct gf_poly *poly_2t[4];
+};
+
+struct bch_control *init_bch(int m, int t, unsigned int prim_poly);
+
+void free_bch(struct bch_control *bch);
+
+void encode_bch(struct bch_control *bch, const uint8_t *data,
+               unsigned int len, uint8_t *ecc);
+
+int decode_bch(struct bch_control *bch, const uint8_t *data, unsigned int len,
+              const uint8_t *recv_ecc, const uint8_t *calc_ecc,
+              const unsigned int *syn, unsigned int *errloc);
+
+#endif /* _BCH_H */
diff --git a/include/linux/linkage.h b/include/linux/linkage.h
new file mode 100644 (file)
index 0000000..ed4cf6c
--- /dev/null
@@ -0,0 +1,76 @@
+/*
+ * U-boot - linkage.h
+ *
+ * Copyright (c) 2005-2007 Analog Devices Inc.
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
+ * MA 02110-1301 USA
+ */
+
+#ifndef _LINUX_LINKAGE_H
+#define _LINUX_LINKAGE_H
+
+#include <asm/linkage.h>
+#include <linux/config.h>
+
+#ifdef __cplusplus
+#define CPP_ASMLINKAGE         extern "C"
+#else
+#define CPP_ASMLINKAGE
+#endif
+
+#define asmlinkage CPP_ASMLINKAGE
+
+#define SYMBOL_NAME_STR(X)     #X
+#define SYMBOL_NAME(X)         X
+#ifdef __STDC__
+#define SYMBOL_NAME_LABEL(X)   X##:
+#else
+#define SYMBOL_NAME_LABEL(X)   X:
+#endif
+
+#define __ALIGN .align         4
+#define __ALIGN_STR            ".align 4"
+
+#ifdef __ASSEMBLY__
+
+#define ALIGN                  __ALIGN
+#define ALIGN_STR              __ALIGN_STR
+
+#define LENTRY(name) \
+       ALIGN; \
+       SYMBOL_NAME_LABEL(name)
+
+#define ENTRY(name) \
+       .globl SYMBOL_NAME(name); \
+       LENTRY(name)
+
+#ifndef END
+#define END(name) \
+       .size name, .-name
+#endif
+
+#ifndef ENDPROC
+#define ENDPROC(name) \
+       .type name, @function; \
+       END(name)
+#endif
+
+#endif
+
+#endif
index 7db25465df1a4a5c06b2ef0ead78d778cfbaad85..8cbcdae1143fa28ef406ce7dc795c8c0b6f8f7b8 100644 (file)
  *  Thomas Gleixner <tglx@linuxtronix.de>
  *
  * 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.
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ *
  */
 #ifndef __LINUX_MTD_BBM_H
 #define __LINUX_MTD_BBM_H
@@ -76,7 +87,7 @@ struct nand_bbt_descr {
 #define NAND_BBT_PERCHIP       0x00000080
 /* bbt has a version counter at offset veroffs */
 #define NAND_BBT_VERSION       0x00000100
-/* Create a bbt if none axists */
+/* Create a bbt if none exists */
 #define NAND_BBT_CREATE                0x00000200
 /* Search good / bad pattern through all pages of a block */
 #define NAND_BBT_SCANALLPAGES  0x00000400
@@ -88,6 +99,14 @@ struct nand_bbt_descr {
 #define NAND_BBT_SAVECONTENT   0x00002000
 /* Search good / bad pattern on the first and the second page */
 #define NAND_BBT_SCAN2NDPAGE   0x00004000
+/* Search good / bad pattern on the last page of the eraseblock */
+#define NAND_BBT_SCANLASTPAGE  0x00008000
+/* Chip stores bad block marker on BOTH 1st and 6th bytes of OOB */
+#define NAND_BBT_SCANBYTE1AND6 0x00100000
+/* The nand_bbt_descr was created dynamicaly and must be freed */
+#define NAND_BBT_DYNAMICSTRUCT 0x00200000
+/* The bad block table does not OOB for marker */
+#define NAND_BBT_NO_OOB                0x00400000
 
 /* The maximum number of blocks to scan for a bbt */
 #define NAND_BBT_SCAN_MAXBLOCKS        4
index 1cdc7ae279352b982127566987497e9eb12bba4e..99668d552e22ac37e8af6c124ec2bfe25fdd6e25 100644 (file)
@@ -1,9 +1,9 @@
 /*
  *  linux/include/linux/mtd/nand.h
  *
- *  Copyright (c) 2000 David Woodhouse <dwmw2@infradead.org>
- *                     Steven J. Hill <sjhill@realitydiluted.com>
- *                    Thomas Gleixner <tglx@linutronix.de>
+ *  Copyright Â© 2000-2010 David Woodhouse <dwmw2@infradead.org>
+ *                        Steven J. Hill <sjhill@realitydiluted.com>
+ *                       Thomas Gleixner <tglx@linutronix.de>
  *
  * 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
 #ifndef __LINUX_MTD_NAND_H
 #define __LINUX_MTD_NAND_H
 
-/* XXX U-BOOT XXX */
-#if 0
-#include <linux/wait.h>
-#include <linux/spinlock.h>
-#include <linux/mtd/mtd.h>
-#endif
-
 #include "config.h"
 
 #include "linux/mtd/compat.h"
@@ -43,17 +36,18 @@ extern int nand_scan_ident(struct mtd_info *mtd, int max_chips,
 extern int nand_scan_tail(struct mtd_info *mtd);
 
 /* Free resources held by the NAND device */
-extern void nand_release (struct mtd_info *mtd);
+extern void nand_release(struct mtd_info *mtd);
 
 /* Internal helper for board drivers which need to override command function */
 extern void nand_wait_ready(struct mtd_info *mtd);
 
-/* This constant declares the max. oobsize / page, which
+/*
+ * This constant declares the max. oobsize / page, which
  * is supported now. If you add a chip with bigger oobsize/page
  * adjust this accordingly.
  */
-#define NAND_MAX_OOBSIZE       218
-#define NAND_MAX_PAGESIZE      4096
+#define NAND_MAX_OOBSIZE       576
+#define NAND_MAX_PAGESIZE      8192
 
 /*
  * Constants for hardware specific CLE/ALE/NCE function
@@ -86,10 +80,14 @@ extern void nand_wait_ready(struct mtd_info *mtd);
 #define NAND_CMD_SEQIN         0x80
 #define NAND_CMD_RNDIN         0x85
 #define NAND_CMD_READID                0x90
-#define NAND_CMD_PARAM         0xec
 #define NAND_CMD_ERASE2                0xd0
+#define NAND_CMD_PARAM         0xec
 #define NAND_CMD_RESET         0xff
 
+#define NAND_CMD_LOCK          0x2a
+#define NAND_CMD_UNLOCK1       0x23
+#define NAND_CMD_UNLOCK2       0x24
+
 /* Extended commands for large page devices */
 #define NAND_CMD_READSTART     0x30
 #define NAND_CMD_RNDOUTSTART   0xE0
@@ -132,6 +130,7 @@ typedef enum {
        NAND_ECC_HW,
        NAND_ECC_HW_SYNDROME,
        NAND_ECC_HW_OOB_FIRST,
+       NAND_ECC_SOFT_BCH,
 } nand_ecc_modes_t;
 
 /*
@@ -148,9 +147,10 @@ typedef enum {
 #define NAND_GET_DEVICE                0x80
 
 
-/* Option constants for bizarre disfunctionality and real
-*  features
-*/
+/*
+ * Option constants for bizarre disfunctionality and real
+ * features.
+ */
 /* Chip can not auto increment pages */
 #define NAND_NO_AUTOINCR       0x00000001
 /* Buswitdh is 16 bit */
@@ -161,23 +161,36 @@ typedef enum {
 #define NAND_CACHEPRG          0x00000008
 /* Chip has copy back function */
 #define NAND_COPYBACK          0x00000010
-/* AND Chip which has 4 banks and a confusing page / block
- * assignment. See Renesas datasheet for further information */
+/*
+ * AND Chip which has 4 banks and a confusing page / block
+ * assignment. See Renesas datasheet for further information.
+ */
 #define NAND_IS_AND            0x00000020
-/* Chip has a array of 4 pages which can be read without
- * additional ready /busy waits */
+/*
+ * Chip has a array of 4 pages which can be read without
+ * additional ready /busy waits.
+ */
 #define NAND_4PAGE_ARRAY       0x00000040
-/* Chip requires that BBT is periodically rewritten to prevent
+/*
+ * Chip requires that BBT is periodically rewritten to prevent
  * bits from adjacent blocks from 'leaking' in altering data.
- * This happens with the Renesas AG-AND chips, possibly others.  */
+ * This happens with the Renesas AG-AND chips, possibly others.
+ */
 #define BBT_AUTO_REFRESH       0x00000080
-/* Chip does not require ready check on read. True
+/*
+ * Chip does not require ready check on read. True
  * for all large page devices, as they do not support
- * autoincrement.*/
+ * autoincrement.
+ */
 #define NAND_NO_READRDY                0x00000100
 /* Chip does not allow subpage writes */
 #define NAND_NO_SUBPAGE_WRITE  0x00000200
 
+/* Device is one of 'new' xD cards that expose fake nand command set */
+#define NAND_BROKEN_XD         0x00000400
+
+/* Device behaves just like nand, but is readonly */
+#define NAND_ROM               0x00000800
 
 /* Options valid for Samsung large page devices */
 #define NAND_SAMSUNG_LP_OPTIONS \
@@ -196,17 +209,29 @@ typedef enum {
 #define NAND_CHIPOPTIONS_MSK   (0x0000ffff & ~NAND_NO_AUTOINCR)
 
 /* Non chip related options */
-/* Use a flash based bad block table. This option is passed to the
- * default bad block table function. */
+/*
+ * Use a flash based bad block table. OOB identifier is saved in OOB area.
+ * This option is passed to the default bad block table function.
+ */
 #define NAND_USE_FLASH_BBT     0x00010000
 /* This option skips the bbt scan during initialization. */
 #define NAND_SKIP_BBTSCAN      0x00020000
-/* This option is defined if the board driver allocates its own buffers
-   (e.g. because it needs them DMA-coherent */
+/*
+ * This option is defined if the board driver allocates its own buffers
+ * (e.g. because it needs them DMA-coherent).
+ */
 #define NAND_OWN_BUFFERS       0x00040000
+/* Chip may not exist, so silence any errors in scan */
+#define NAND_SCAN_SILENT_NODEV 0x00080000
+/*
+ * If passed additionally to NAND_USE_FLASH_BBT then BBT code will not touch
+ * the OOB area.
+ */
+#define NAND_USE_FLASH_BBT_NO_OOB      0x00800000
+/* Create an empty BBT with no vendor information if the BBT is available */
+#define NAND_CREATE_EMPTY_BBT          0x01000000
+
 /* Options set by nand scan */
-/* bbt has already been read */
-#define NAND_BBT_SCANNED       0x40000000
 /* Nand scan has allocated controller struct */
 #define NAND_CONTROLLER_ALLOC  0x80000000
 
@@ -281,13 +306,13 @@ struct nand_onfi_params {
 
 #define ONFI_CRC_BASE  0x4F4E
 
-
 /**
  * struct nand_hw_control - Control structure for hardware controller (e.g ECC generator) shared among independent devices
  * @lock:               protection lock
  * @active:            the mtd device which holds the controller currently
- * @wq:                        wait queue to sleep on if a NAND operation is in progress
- *                      used instead of the per chip wait queue when a hw controller is available
+ * @wq:                        wait queue to sleep on if a NAND operation is in
+ *                     progress used instead of the per chip wait queue
+ *                     when a hw controller is available.
  */
 struct nand_hw_control {
 /* XXX U-BOOT XXX */
@@ -308,56 +333,50 @@ struct nand_hw_control {
  * @prepad:    padding information for syndrome based ecc generators
  * @postpad:   padding information for syndrome based ecc generators
  * @layout:    ECC layout control struct pointer
+ * @priv:      pointer to private ecc control data
  * @hwctl:     function to control hardware ecc generator. Must only
  *             be provided if an hardware ECC is available
  * @calculate: function for ecc calculation or readback from ecc hardware
  * @correct:   function for ecc correction, matching to ecc generator (sw/hw)
  * @read_page_raw:     function to read a raw page without ECC
  * @write_page_raw:    function to write a raw page without ECC
- * @read_page: function to read a page according to the ecc generator requirements
- * @write_page:        function to write a page according to the ecc generator requirements
+ * @read_page: function to read a page according to the ecc generator
+ *             requirements.
+ * @read_subpage:      function to read parts of the page covered by ECC.
+ * @write_page:        function to write a page according to the ecc generator
+ *             requirements.
  * @read_oob:  function to read chip OOB data
  * @write_oob: function to write chip OOB data
  */
 struct nand_ecc_ctrl {
-       nand_ecc_modes_t        mode;
-       int                     steps;
-       int                     size;
-       int                     bytes;
-       int                     total;
-       int                     prepad;
-       int                     postpad;
+       nand_ecc_modes_t mode;
+       int steps;
+       int size;
+       int bytes;
+       int total;
+       int prepad;
+       int postpad;
        struct nand_ecclayout   *layout;
-       void                    (*hwctl)(struct mtd_info *mtd, int mode);
-       int                     (*calculate)(struct mtd_info *mtd,
-                                            const uint8_t *dat,
-                                            uint8_t *ecc_code);
-       int                     (*correct)(struct mtd_info *mtd, uint8_t *dat,
-                                          uint8_t *read_ecc,
-                                          uint8_t *calc_ecc);
-       int                     (*read_page_raw)(struct mtd_info *mtd,
-                                                struct nand_chip *chip,
-                                                uint8_t *buf, int page);
-       void                    (*write_page_raw)(struct mtd_info *mtd,
-                                                 struct nand_chip *chip,
-                                                 const uint8_t *buf);
-       int                     (*read_page)(struct mtd_info *mtd,
-                                            struct nand_chip *chip,
-                                            uint8_t *buf, int page);
-       int                     (*read_subpage)(struct mtd_info *mtd,
-                                            struct nand_chip *chip,
-                                            uint32_t offs, uint32_t len,
-                                            uint8_t *buf);
-       void                    (*write_page)(struct mtd_info *mtd,
-                                             struct nand_chip *chip,
-                                             const uint8_t *buf);
-       int                     (*read_oob)(struct mtd_info *mtd,
-                                           struct nand_chip *chip,
-                                           int page,
-                                           int sndcmd);
-       int                     (*write_oob)(struct mtd_info *mtd,
-                                            struct nand_chip *chip,
-                                            int page);
+       void *priv;
+       void (*hwctl)(struct mtd_info *mtd, int mode);
+       int (*calculate)(struct mtd_info *mtd, const uint8_t *dat,
+                       uint8_t *ecc_code);
+       int (*correct)(struct mtd_info *mtd, uint8_t *dat, uint8_t *read_ecc,
+                       uint8_t *calc_ecc);
+       int (*read_page_raw)(struct mtd_info *mtd, struct nand_chip *chip,
+                       uint8_t *buf, int page);
+       void (*write_page_raw)(struct mtd_info *mtd, struct nand_chip *chip,
+                       const uint8_t *buf);
+       int (*read_page)(struct mtd_info *mtd, struct nand_chip *chip,
+                       uint8_t *buf, int page);
+       int (*read_subpage)(struct mtd_info *mtd, struct nand_chip *chip,
+                       uint32_t offs, uint32_t len, uint8_t *buf);
+       void (*write_page)(struct mtd_info *mtd, struct nand_chip *chip,
+                       const uint8_t *buf);
+       int (*read_oob)(struct mtd_info *mtd, struct nand_chip *chip, int page,
+                       int sndcmd);
+       int (*write_oob)(struct mtd_info *mtd, struct nand_chip *chip,
+                       int page);
 };
 
 /**
@@ -377,125 +396,150 @@ struct nand_buffers {
 
 /**
  * struct nand_chip - NAND Private Flash Chip Data
- * @IO_ADDR_R:         [BOARDSPECIFIC] address to read the 8 I/O lines of the flash device
- * @IO_ADDR_W:         [BOARDSPECIFIC] address to write the 8 I/O lines of the flash device
+ * @IO_ADDR_R:         [BOARDSPECIFIC] address to read the 8 I/O lines of the
+ *                     flash device
+ * @IO_ADDR_W:         [BOARDSPECIFIC] address to write the 8 I/O lines of the
+ *                     flash device.
  * @read_byte:         [REPLACEABLE] read one byte from the chip
  * @read_word:         [REPLACEABLE] read one word from the chip
  * @write_buf:         [REPLACEABLE] write data from the buffer to the chip
  * @read_buf:          [REPLACEABLE] read data from the chip into the buffer
- * @verify_buf:                [REPLACEABLE] verify buffer contents against the chip data
+ * @verify_buf:                [REPLACEABLE] verify buffer contents against the chip
+ *                     data.
  * @select_chip:       [REPLACEABLE] select chip nr
  * @block_bad:         [REPLACEABLE] check, if the block is bad
  * @block_markbad:     [REPLACEABLE] mark the block bad
- * @cmd_ctrl:          [BOARDSPECIFIC] hardwarespecific funtion for controlling
+ * @cmd_ctrl:          [BOARDSPECIFIC] hardwarespecific function for controlling
  *                     ALE/CLE/nCE. Also used to write command and address
- * @dev_ready:         [BOARDSPECIFIC] hardwarespecific function for accesing device ready/busy line
- *                     If set to NULL no access to ready/busy is available and the ready/busy information
- *                     is read from the chip status register
- * @cmdfunc:           [REPLACEABLE] hardwarespecific function for writing commands to the chip
- * @waitfunc:          [REPLACEABLE] hardwarespecific function for wait on ready
+ * @init_size:         [BOARDSPECIFIC] hardwarespecific function for setting
+ *                     mtd->oobsize, mtd->writesize and so on.
+ *                     @id_data contains the 8 bytes values of NAND_CMD_READID.
+ *                     Return with the bus width.
+ * @dev_ready:         [BOARDSPECIFIC] hardwarespecific function for accesing
+ *                     device ready/busy line. If set to NULL no access to
+ *                     ready/busy is available and the ready/busy information
+ *                     is read from the chip status register.
+ * @cmdfunc:           [REPLACEABLE] hardwarespecific function for writing
+ *                     commands to the chip.
+ * @waitfunc:          [REPLACEABLE] hardwarespecific function for wait on
+ *                     ready.
  * @ecc:               [BOARDSPECIFIC] ecc control ctructure
  * @buffers:           buffer structure for read/write
  * @hwcontrol:         platform-specific hardware control structure
  * @ops:               oob operation operands
- * @erase_cmd:         [INTERN] erase command write function, selectable due to AND support
+ * @erase_cmd:         [INTERN] erase command write function, selectable due
+ *                     to AND support.
  * @scan_bbt:          [REPLACEABLE] function to scan bad block table
- * @chip_delay:                [BOARDSPECIFIC] chip dependent delay for transfering data from array to read regs (tR)
- * @wq:                        [INTERN] wait queue to sleep on if a NAND operation is in progress
+ * @chip_delay:                [BOARDSPECIFIC] chip dependent delay for transferring
+ *                     data from array to read regs (tR).
  * @state:             [INTERN] the current state of the NAND device
  * @oob_poi:           poison value buffer
- * @page_shift:                [INTERN] number of address bits in a page (column address bits)
+ * @page_shift:                [INTERN] number of address bits in a page (column
+ *                     address bits).
  * @phys_erase_shift:  [INTERN] number of address bits in a physical eraseblock
  * @bbt_erase_shift:   [INTERN] number of address bits in a bbt entry
  * @chip_shift:                [INTERN] number of address bits in one chip
- * @datbuf:            [INTERN] internal buffer for one page + oob
- * @oobbuf:            [INTERN] oob buffer for one eraseblock
- * @oobdirty:          [INTERN] indicates that oob_buf must be reinitialized
- * @data_poi:          [INTERN] pointer to a data buffer
- * @options:           [BOARDSPECIFIC] various chip options. They can partly be set to inform nand_scan about
- *                     special functionality. See the defines for further explanation
- * @badblockpos:       [INTERN] position of the bad block marker in the oob area
+ * @options:           [BOARDSPECIFIC] various chip options. They can partly
+ *                     be set to inform nand_scan about special functionality.
+ *                     See the defines for further explanation.
+ * @badblockpos:       [INTERN] position of the bad block marker in the oob
+ *                     area.
+ * @badblockbits:      [INTERN] number of bits to left-shift the bad block
+ *                     number
  * @cellinfo:          [INTERN] MLC/multichip data from chip ident
  * @numchips:          [INTERN] number of physical chips
  * @chipsize:          [INTERN] the size of one chip for multichip arrays
  * @pagemask:          [INTERN] page number mask = number of (pages / chip) - 1
- * @pagebuf:           [INTERN] holds the pagenumber which is currently in data_buf
+ * @pagebuf:           [INTERN] holds the pagenumber which is currently in
+ *                     data_buf.
  * @subpagesize:       [INTERN] holds the subpagesize
+ * @onfi_version:      [INTERN] holds the chip ONFI version (BCD encoded),
+ *                     non 0 if ONFI supported.
+ * @onfi_params:       [INTERN] holds the ONFI page parameter when ONFI is
+ *                     supported, 0 otherwise.
  * @ecclayout:         [REPLACEABLE] the default ecc placement scheme
  * @bbt:               [INTERN] bad block table pointer
- * @bbt_td:            [REPLACEABLE] bad block table descriptor for flash lookup
+ * @bbt_td:            [REPLACEABLE] bad block table descriptor for flash
+ *                     lookup.
  * @bbt_md:            [REPLACEABLE] bad block table mirror descriptor
- * @badblock_pattern:  [REPLACEABLE] bad block scan pattern used for initial bad block scan
- * @controller:                [REPLACEABLE] a pointer to a hardware controller structure
- *                     which is shared among multiple independend devices
+ * @badblock_pattern:  [REPLACEABLE] bad block scan pattern used for initial
+ *                     bad block scan.
+ * @controller:                [REPLACEABLE] a pointer to a hardware controller
+ *                     structure which is shared among multiple independend
+ *                     devices.
  * @priv:              [OPTIONAL] pointer to private chip date
- * @errstat:           [OPTIONAL] hardware specific function to perform additional error status checks
- *                     (determine if errors are correctable)
+ * @errstat:           [OPTIONAL] hardware specific function to perform
+ *                     additional error status checks (determine if errors are
+ *                     correctable).
  * @write_page:                [REPLACEABLE] High-level page write function
  */
 
 struct nand_chip {
-       void  __iomem   *IO_ADDR_R;
-       void  __iomem   *IO_ADDR_W;
-
-       uint8_t         (*read_byte)(struct mtd_info *mtd);
-       u16             (*read_word)(struct mtd_info *mtd);
-       void            (*write_buf)(struct mtd_info *mtd, const uint8_t *buf, int len);
-       void            (*read_buf)(struct mtd_info *mtd, uint8_t *buf, int len);
-       int             (*verify_buf)(struct mtd_info *mtd, const uint8_t *buf, int len);
-       void            (*select_chip)(struct mtd_info *mtd, int chip);
-       int             (*block_bad)(struct mtd_info *mtd, loff_t ofs, int getchip);
-       int             (*block_markbad)(struct mtd_info *mtd, loff_t ofs);
-       void            (*cmd_ctrl)(struct mtd_info *mtd, int dat,
-                                   unsigned int ctrl);
-       int             (*dev_ready)(struct mtd_info *mtd);
-       void            (*cmdfunc)(struct mtd_info *mtd, unsigned command, int column, int page_addr);
-       int             (*waitfunc)(struct mtd_info *mtd, struct nand_chip *this);
-       void            (*erase_cmd)(struct mtd_info *mtd, int page);
-       int             (*scan_bbt)(struct mtd_info *mtd);
-       int             (*errstat)(struct mtd_info *mtd, struct nand_chip *this, int state, int status, int page);
-       int             (*write_page)(struct mtd_info *mtd, struct nand_chip *chip,
-                                     const uint8_t *buf, int page, int cached, int raw);
-
-       int             chip_delay;
-       unsigned int    options;
-
-       int             page_shift;
-       int             phys_erase_shift;
-       int             bbt_erase_shift;
-       int             chip_shift;
-       int             numchips;
-       uint64_t        chipsize;
-       int             pagemask;
-       int             pagebuf;
-       int             subpagesize;
-       uint8_t         cellinfo;
-       int             badblockpos;
-       int             onfi_version;
+       void __iomem *IO_ADDR_R;
+       void __iomem *IO_ADDR_W;
+
+       uint8_t (*read_byte)(struct mtd_info *mtd);
+       u16 (*read_word)(struct mtd_info *mtd);
+       void (*write_buf)(struct mtd_info *mtd, const uint8_t *buf, int len);
+       void (*read_buf)(struct mtd_info *mtd, uint8_t *buf, int len);
+       int (*verify_buf)(struct mtd_info *mtd, const uint8_t *buf, int len);
+       void (*select_chip)(struct mtd_info *mtd, int chip);
+       int (*block_bad)(struct mtd_info *mtd, loff_t ofs, int getchip);
+       int (*block_markbad)(struct mtd_info *mtd, loff_t ofs);
+       void (*cmd_ctrl)(struct mtd_info *mtd, int dat, unsigned int ctrl);
+       int (*init_size)(struct mtd_info *mtd, struct nand_chip *this,
+                       u8 *id_data);
+       int (*dev_ready)(struct mtd_info *mtd);
+       void (*cmdfunc)(struct mtd_info *mtd, unsigned command, int column,
+                       int page_addr);
+       int(*waitfunc)(struct mtd_info *mtd, struct nand_chip *this);
+       void (*erase_cmd)(struct mtd_info *mtd, int page);
+       int (*scan_bbt)(struct mtd_info *mtd);
+       int (*errstat)(struct mtd_info *mtd, struct nand_chip *this, int state,
+                       int status, int page);
+       int (*write_page)(struct mtd_info *mtd, struct nand_chip *chip,
+                       const uint8_t *buf, int page, int cached, int raw);
+
+       int chip_delay;
+       unsigned int options;
+
+       int page_shift;
+       int phys_erase_shift;
+       int bbt_erase_shift;
+       int chip_shift;
+       int numchips;
+       uint64_t chipsize;
+       int pagemask;
+       int pagebuf;
+       int subpagesize;
+       uint8_t cellinfo;
+       int badblockpos;
+       int badblockbits;
+
+       int onfi_version;
 #ifdef CONFIG_SYS_NAND_ONFI_DETECTION
        struct nand_onfi_params onfi_params;
 #endif
 
-       int             state;
+       int state;
 
-       uint8_t         *oob_poi;
-       struct nand_hw_control  *controller;
-       struct nand_ecclayout   *ecclayout;
+       uint8_t *oob_poi;
+       struct nand_hw_control *controller;
+       struct nand_ecclayout *ecclayout;
 
        struct nand_ecc_ctrl ecc;
        struct nand_buffers *buffers;
-
        struct nand_hw_control hwcontrol;
 
        struct mtd_oob_ops ops;
 
-       uint8_t         *bbt;
-       struct nand_bbt_descr   *bbt_td;
-       struct nand_bbt_descr   *bbt_md;
+       uint8_t *bbt;
+       struct nand_bbt_descr *bbt_td;
+       struct nand_bbt_descr *bbt_md;
 
-       struct nand_bbt_descr   *badblock_pattern;
+       struct nand_bbt_descr *badblock_pattern;
 
-       void            *priv;
+       void *priv;
 };
 
 /*
@@ -539,7 +583,7 @@ struct nand_flash_dev {
 */
 struct nand_manufacturers {
        int id;
-       char * name;
+       char *name;
 };
 
 extern const struct nand_flash_dev nand_flash_ids[];
@@ -552,7 +596,7 @@ extern int nand_isbad_bbt(struct mtd_info *mtd, loff_t offs, int allowbbt);
 extern int nand_erase_nand(struct mtd_info *mtd, struct erase_info *instr,
                           int allowbbt);
 extern int nand_do_read(struct mtd_info *mtd, loff_t from, size_t len,
-                       size_t * retlen, uint8_t * buf);
+                       size_t *retlen, uint8_t *buf);
 
 /*
 * Constants for oob configuration
@@ -573,17 +617,20 @@ extern int nand_do_read(struct mtd_info *mtd, loff_t from, size_t len,
  * @priv:              hardware controller specific settings
  */
 struct platform_nand_chip {
-       int                     nr_chips;
-       int                     chip_offset;
-       int                     nr_partitions;
-       struct mtd_partition    *partitions;
-       struct nand_ecclayout   *ecclayout;
-       int                     chip_delay;
-       unsigned int            options;
-       const char              **part_probe_types;
-       void                    *priv;
+       int nr_chips;
+       int chip_offset;
+       int nr_partitions;
+       struct mtd_partition *partitions;
+       struct nand_ecclayout *ecclayout;
+       int chip_delay;
+       unsigned int options;
+       const char **part_probe_types;
+       void *priv;
 };
 
+/* Keep gcc happy */
+struct platform_device;
+
 /**
  * struct platform_nand_ctrl - controller level device structure
  * @hwcontrol:         platform specific hardware control structure
@@ -596,12 +643,11 @@ struct platform_nand_chip {
  * All fields are optional and depend on the hardware driver requirements
  */
 struct platform_nand_ctrl {
-       void            (*hwcontrol)(struct mtd_info *mtd, int cmd);
-       int             (*dev_ready)(struct mtd_info *mtd);
-       void            (*select_chip)(struct mtd_info *mtd, int chip);
-       void            (*cmd_ctrl)(struct mtd_info *mtd, int dat,
-                                   unsigned int ctrl);
-       void            *priv;
+       void (*hwcontrol)(struct mtd_info *mtd, int cmd);
+       int (*dev_ready)(struct mtd_info *mtd);
+       void (*select_chip)(struct mtd_info *mtd, int chip);
+       void (*cmd_ctrl)(struct mtd_info *mtd, int dat, unsigned int ctrl);
+       void *priv;
 };
 
 /**
@@ -610,8 +656,8 @@ struct platform_nand_ctrl {
  * @ctrl:              controller level device structure
  */
 struct platform_nand_data {
-       struct platform_nand_chip       chip;
-       struct platform_nand_ctrl       ctrl;
+       struct platform_nand_chip chip;
+       struct platform_nand_ctrl ctrl;
 };
 
 /* Some helpers to access the data structures */
diff --git a/include/linux/mtd/nand_bch.h b/include/linux/mtd/nand_bch.h
new file mode 100644 (file)
index 0000000..d8754dd
--- /dev/null
@@ -0,0 +1,72 @@
+/*
+ * Copyright Â© 2011 Ivan Djelic <ivan.djelic@parrot.com>
+ *
+ * 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 file is the header for the NAND BCH ECC implementation.
+ */
+
+#ifndef __MTD_NAND_BCH_H__
+#define __MTD_NAND_BCH_H__
+
+struct mtd_info;
+struct nand_bch_control;
+
+#if defined(CONFIG_NAND_ECC_BCH)
+
+static inline int mtd_nand_has_bch(void) { return 1; }
+
+/*
+ * Calculate BCH ecc code
+ */
+int nand_bch_calculate_ecc(struct mtd_info *mtd, const u_char *dat,
+                          u_char *ecc_code);
+
+/*
+ * Detect and correct bit errors
+ */
+int nand_bch_correct_data(struct mtd_info *mtd, u_char *dat, u_char *read_ecc,
+                         u_char *calc_ecc);
+/*
+ * Initialize BCH encoder/decoder
+ */
+struct nand_bch_control *
+nand_bch_init(struct mtd_info *mtd, unsigned int eccsize,
+             unsigned int eccbytes, struct nand_ecclayout **ecclayout);
+/*
+ * Release BCH encoder/decoder resources
+ */
+void nand_bch_free(struct nand_bch_control *nbc);
+
+#else /* !CONFIG_NAND_ECC_BCH */
+
+static inline int mtd_nand_has_bch(void) { return 0; }
+
+static inline int
+nand_bch_calculate_ecc(struct mtd_info *mtd, const u_char *dat,
+                      u_char *ecc_code)
+{
+       return -1;
+}
+
+static inline int
+nand_bch_correct_data(struct mtd_info *mtd, unsigned char *buf,
+                     unsigned char *read_ecc, unsigned char *calc_ecc)
+{
+       return -1;
+}
+
+static inline struct nand_bch_control *
+nand_bch_init(struct mtd_info *mtd, unsigned int eccsize,
+             unsigned int eccbytes, struct nand_ecclayout **ecclayout)
+{
+       return NULL;
+}
+
+static inline void nand_bch_free(struct nand_bch_control *nbc) {}
+
+#endif /* CONFIG_NAND_ECC_BCH */
+
+#endif /* __MTD_NAND_BCH_H__ */
index 090da505425d77d105acb6133d63dfaaa7c95b7b..9715a53d86d4ec3716b167a646dd3732da556d13 100644 (file)
 
 struct mtd_info;
 
+#if defined(CONFIG_MTD_ECC_SOFT)
+
+static inline int mtd_nand_has_ecc_soft(void) { return 1; }
+
 /*
  * Calculate 3 byte ECC code for 256 byte block
  */
@@ -25,4 +29,25 @@ int nand_calculate_ecc(struct mtd_info *mtd, const u_char *dat, u_char *ecc_code
  */
 int nand_correct_data(struct mtd_info *mtd, u_char *dat, u_char *read_ecc, u_char *calc_ecc);
 
+#else
+
+static inline int mtd_nand_has_ecc_soft(void) { return 0; }
+
+static inline int
+nand_calculate_ecc(struct mtd_info *mtd, const u_char *dat, u_char *ecc_code)
+{
+       return -1;
+}
+
+static inline int
+nand_correct_data(struct mtd_info *mtd,
+                       u_char *dat,
+                       u_char *read_ecc,
+                       u_char *calc_ecc)
+{
+       return -1;
+}
+
+#endif
+
 #endif /* __MTD_NAND_ECC_H__ */
index 62390399b0b1b7e160001abd437fd2020bfee808..9a8cbc24cdceeef5612dcdeca82fe788b3d33f56 100644 (file)
@@ -47,6 +47,10 @@ extern char * strchr(const char *,int);
 #ifndef __HAVE_ARCH_STRRCHR
 extern char * strrchr(const char *,int);
 #endif
+extern char * skip_spaces(const char *);
+
+extern char *strim(char *);
+
 #ifndef __HAVE_ARCH_STRSTR
 extern char * strstr(const char *,const char *);
 #endif
diff --git a/include/mc13783.h b/include/mc13783.h
new file mode 100644 (file)
index 0000000..5e41c3e
--- /dev/null
@@ -0,0 +1,80 @@
+/*
+ * (C) Copyright 2011
+ * Helmut Raiger, HALE electronic GmbH, helmut.raiger@hale.at
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public 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 __MC13783_H__
+#define __MC13783_H__
+
+/* REG_MODE_0 */
+#define VAUDIOEN       (1 << 0)
+#define VAUDIOSTBY     (1 << 1)
+#define VAUDIOMODE     (1 << 2)
+#define VIOHIEN                (1 << 3)
+#define VIOHISTBY      (1 << 4)
+#define VIOHIMODE      (1 << 5)
+#define VIOLOEN                (1 << 6)
+#define VIOLOSTBY      (1 << 7)
+#define VIOLOMODE      (1 << 8)
+#define VDIGEN                 (1 << 9)
+#define VDIGSTBY       (1 << 10)
+#define VDIGMODE       (1 << 11)
+#define VGENEN         (1 << 12)
+#define VGENSTBY       (1 << 13)
+#define VGENMODE       (1 << 14)
+#define VRFDIGEN       (1 << 15)
+#define VRFDIGSTBY     (1 << 16)
+#define VRFDIGMODE     (1 << 17)
+#define VRFREFEN       (1 << 18)
+#define VRFREFSTBY     (1 << 19)
+#define VRFREFMODE     (1 << 20)
+#define VRFCPEN                (1 << 21)
+#define VRFCPSTBY      (1 << 22)
+#define VRFCPMODE      (1 << 23)
+
+/* REG_MODE_1 */
+#define VSIMEN         (1 << 0)
+#define VSIMSTBY       (1 << 1)
+#define VSIMMODE       (1 << 2)
+#define VESIMEN                (1 << 3)
+#define VESIMSTBY      (1 << 4)
+#define VESIMMODE      (1 << 5)
+#define VCAMEN         (1 << 6)
+#define VCAMSTBY       (1 << 7)
+#define VCAMMODE       (1 << 8)
+#define VRFBGEN                (1 << 9)
+#define VRFBGSTBY      (1 << 10)
+#define VVIBEN         (1 << 11)
+#define VRF1EN         (1 << 12)
+#define VRF1STBY       (1 << 13)
+#define VRF1MODE       (1 << 14)
+#define VRF2EN         (1 << 15)
+#define VRF2STBY       (1 << 16)
+#define VRF2MODE       (1 << 17)
+#define VMMC1EN                (1 << 18)
+#define VMMC1STBY      (1 << 19)
+#define VMMC1MODE      (1 << 20)
+#define VMMC2EN                (1 << 21)
+#define VMMC2STBY      (1 << 22)
+#define VMMC2MODE      (1 << 23)
+
+#endif
index cf14a9cca356c4279f40854d4c25a311e562edb2..7af5fdb0edfa4302b3162f75518d02c63921ddb3 100644 (file)
@@ -26,5 +26,9 @@ int menu_default_set(struct menu *m, char *item_key);
 int menu_get_choice(struct menu *m, void **choice);
 int menu_item_add(struct menu *m, char *item_key, void *item_data);
 int menu_destroy(struct menu *m);
+void menu_display_statusline(struct menu *m);
 
+#if defined(CONFIG_MENU_SHOW)
+int menu_show(int bootdelay);
+#endif
 #endif /* __MENU_H__ */
index d444ddcefea7c37a9dbb96aa97f10109b39cd0ce..8b3a1a77a399552b9eb8e10cc9a2746e24989711 100644 (file)
 #ifndef _NAND_H_
 #define _NAND_H_
 
+#include <config.h>
+
+/*
+ * All boards using a given driver must convert to self-init
+ * at the same time, so do it here.  When all drivers are
+ * converted, this will go away.
+ */
+#if defined(CONFIG_NAND_FSL_ELBC)
+#define CONFIG_SYS_NAND_SELF_INIT
+#endif
+
 extern void nand_init(void);
 
 #include <linux/mtd/compat.h>
 #include <linux/mtd/mtd.h>
 #include <linux/mtd/nand.h>
 
+#ifdef CONFIG_SYS_NAND_SELF_INIT
+void board_nand_init(void);
+int nand_register(int devnum);
+#else
 extern int board_nand_init(struct nand_chip *nand);
+#endif
 
 typedef struct mtd_info nand_info_t;
 
index 802f077be4d76add59fc0c85404c0962902ada00..4a23fd2af23cf0439b92f0c7f00e5d609c7ac676 100644 (file)
 #define CONFIG_USB_ULPI_TIMEOUT 1000   /* timeout in us */
 #endif
 
+/*
+ * ulpi view port address and
+ * Port_number that can be passed.
+ * Any additional data to be passed can
+ * be extended from this structure
+ */
+struct ulpi_viewport {
+       u32 viewport_addr;
+       u32 port_num;
+};
+
 /*
  * Initialize the ULPI transciever and check the interface integrity.
- * @ulpi_viewport -  the address of the ULPI viewport register.
+ * @ulpi_vp -  structure containing ULPI viewport data
  *
  * returns 0 on success, ULPI_ERROR on failure.
  */
-int ulpi_init(u32 ulpi_viewport);
+int ulpi_init(struct ulpi_viewport *ulpi_vp);
 
 /*
  * Select transceiver speed.
@@ -41,7 +52,7 @@ int ulpi_init(u32 ulpi_viewport);
  *                ULPI_FC_LOW_SPEED,  ULPI_FC_FS4LS
  * returns 0 on success, ULPI_ERROR on failure.
  */
-int ulpi_select_transceiver(u32 ulpi_viewport, unsigned speed);
+int ulpi_select_transceiver(struct ulpi_viewport *ulpi_vp, unsigned speed);
 
 /*
  * Enable/disable VBUS.
@@ -50,14 +61,15 @@ int ulpi_select_transceiver(u32 ulpi_viewport, unsigned speed);
  *
  * returns 0 on success, ULPI_ERROR on failure.
  */
-int ulpi_enable_vbus(u32 ulpi_viewport, int on, int ext_power, int ext_ind);
+int ulpi_enable_vbus(struct ulpi_viewport *ulpi_vp,
+                       int on, int ext_power, int ext_ind);
 
 /*
  * Enable/disable pull-down resistors on D+ and D- USB lines.
  *
  * returns 0 on success, ULPI_ERROR on failure.
  */
-int ulpi_set_pd(u32 ulpi_viewport, int enable);
+int ulpi_set_pd(struct ulpi_viewport *ulpi_vp, int enable);
 
 /*
  * Select OpMode.
@@ -66,7 +78,7 @@ int ulpi_set_pd(u32 ulpi_viewport, int enable);
  *
  * returns 0 on success, ULPI_ERROR on failure.
  */
-int ulpi_opmode_sel(u32 ulpi_viewport, unsigned opmode);
+int ulpi_opmode_sel(struct ulpi_viewport *ulpi_vp, unsigned opmode);
 
 /*
  * Switch to Serial Mode.
@@ -78,7 +90,7 @@ int ulpi_opmode_sel(u32 ulpi_viewport, unsigned opmode);
  * Switches immediately to Serial Mode.
  * To return from Serial Mode, STP line needs to be asserted.
  */
-int ulpi_serial_mode_enable(u32 ulpi_viewport, unsigned smode);
+int ulpi_serial_mode_enable(struct ulpi_viewport *ulpi_vp, unsigned smode);
 
 /*
  * Put PHY into low power mode.
@@ -89,14 +101,14 @@ int ulpi_serial_mode_enable(u32 ulpi_viewport, unsigned smode);
  * STP line must be driven low to keep the PHY in suspend.
  * To resume the PHY, STP line needs to be asserted.
  */
-int ulpi_suspend(u32 ulpi_viewport);
+int ulpi_suspend(struct ulpi_viewport *ulpi_vp);
 
 /*
  * Reset the transceiver. ULPI interface and registers are not affected.
  *
  * returns 0 on success, ULPI_ERROR on failure.
  */
-int ulpi_reset(u32 ulpi_viewport);
+int ulpi_reset(struct ulpi_viewport *ulpi_vp);
 
 
 /* ULPI access methods below must be implemented for each ULPI viewport. */
@@ -108,7 +120,7 @@ int ulpi_reset(u32 ulpi_viewport);
  *
  * returns 0 on success, ULPI_ERROR on failure.
  */
-int ulpi_write(u32 ulpi_viewport, u8 *reg, u32 value);
+int ulpi_write(struct ulpi_viewport *ulpi_vp, u8 *reg, u32 value);
 
 /*
  * Read the ULPI PHY register content via the viewport.
@@ -116,14 +128,14 @@ int ulpi_write(u32 ulpi_viewport, u8 *reg, u32 value);
  *
  * returns register content on success, ULPI_ERROR on failure.
  */
-u32 ulpi_read(u32 ulpi_viewport, u8 *reg);
+u32 ulpi_read(struct ulpi_viewport *ulpi_vp, u8 *reg);
 
 /*
  * Wait for the reset to complete.
  * The Link must not attempt to access the PHY until the reset has
  * completed and DIR line is de-asserted.
  */
-int ulpi_reset_wait(u32 ulpi_viewport);
+int ulpi_reset_wait(struct ulpi_viewport *ulpi_vp);
 
 /* Access Extended Register Set (indicator) */
 #define ACCESS_EXT_REGS_OFFSET 0x2f    /* read-write */
index 35ba7ffe47f9852e90eb027c51d20e4267783bfb..e6e6ec63779be056942565c0bc515e35e8528285 100644 (file)
@@ -27,6 +27,7 @@ LIB   = $(obj)libgeneric.o
 
 ifndef CONFIG_SPL_BUILD
 COBJS-$(CONFIG_ADDR_MAP) += addr_map.o
+COBJS-$(CONFIG_BCH) += bch.o
 COBJS-$(CONFIG_BZIP2) += bzlib.o
 COBJS-$(CONFIG_BZIP2) += bzlib_crctable.o
 COBJS-$(CONFIG_BZIP2) += bzlib_decompress.o
diff --git a/lib/bch.c b/lib/bch.c
new file mode 100644 (file)
index 0000000..7f4ca92
--- /dev/null
+++ b/lib/bch.c
@@ -0,0 +1,1358 @@
+/*
+ * Generic binary BCH encoding/decoding library
+ *
+ * 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., 51
+ * Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Copyright Â© 2011 Parrot S.A.
+ *
+ * Author: Ivan Djelic <ivan.djelic@parrot.com>
+ *
+ * Description:
+ *
+ * This library provides runtime configurable encoding/decoding of binary
+ * Bose-Chaudhuri-Hocquenghem (BCH) codes.
+ *
+ * Call init_bch to get a pointer to a newly allocated bch_control structure for
+ * the given m (Galois field order), t (error correction capability) and
+ * (optional) primitive polynomial parameters.
+ *
+ * Call encode_bch to compute and store ecc parity bytes to a given buffer.
+ * Call decode_bch to detect and locate errors in received data.
+ *
+ * On systems supporting hw BCH features, intermediate results may be provided
+ * to decode_bch in order to skip certain steps. See decode_bch() documentation
+ * for details.
+ *
+ * Option CONFIG_BCH_CONST_PARAMS can be used to force fixed values of
+ * parameters m and t; thus allowing extra compiler optimizations and providing
+ * better (up to 2x) encoding performance. Using this option makes sense when
+ * (m,t) are fixed and known in advance, e.g. when using BCH error correction
+ * on a particular NAND flash device.
+ *
+ * Algorithmic details:
+ *
+ * Encoding is performed by processing 32 input bits in parallel, using 4
+ * remainder lookup tables.
+ *
+ * The final stage of decoding involves the following internal steps:
+ * a. Syndrome computation
+ * b. Error locator polynomial computation using Berlekamp-Massey algorithm
+ * c. Error locator root finding (by far the most expensive step)
+ *
+ * In this implementation, step c is not performed using the usual Chien search.
+ * Instead, an alternative approach described in [1] is used. It consists in
+ * factoring the error locator polynomial using the Berlekamp Trace algorithm
+ * (BTA) down to a certain degree (4), after which ad hoc low-degree polynomial
+ * solving techniques [2] are used. The resulting algorithm, called BTZ, yields
+ * much better performance than Chien search for usual (m,t) values (typically
+ * m >= 13, t < 32, see [1]).
+ *
+ * [1] B. Biswas, V. Herbert. Efficient root finding of polynomials over fields
+ * of characteristic 2, in: Western European Workshop on Research in Cryptology
+ * - WEWoRC 2009, Graz, Austria, LNCS, Springer, July 2009, to appear.
+ * [2] [Zin96] V.A. Zinoviev. On the solution of equations of degree 10 over
+ * finite fields GF(2^q). In Rapport de recherche INRIA no 2829, 1996.
+ */
+
+#include <common.h>
+#include <ubi_uboot.h>
+
+#include <linux/bitops.h>
+#include <asm/byteorder.h>
+#include <linux/bch.h>
+
+#if defined(CONFIG_BCH_CONST_PARAMS)
+#define GF_M(_p)               (CONFIG_BCH_CONST_M)
+#define GF_T(_p)               (CONFIG_BCH_CONST_T)
+#define GF_N(_p)               ((1 << (CONFIG_BCH_CONST_M))-1)
+#else
+#define GF_M(_p)               ((_p)->m)
+#define GF_T(_p)               ((_p)->t)
+#define GF_N(_p)               ((_p)->n)
+#endif
+
+#define BCH_ECC_WORDS(_p)      DIV_ROUND_UP(GF_M(_p)*GF_T(_p), 32)
+#define BCH_ECC_BYTES(_p)      DIV_ROUND_UP(GF_M(_p)*GF_T(_p), 8)
+
+#ifndef dbg
+#define dbg(_fmt, args...)     do {} while (0)
+#endif
+
+/*
+ * represent a polynomial over GF(2^m)
+ */
+struct gf_poly {
+       unsigned int deg;    /* polynomial degree */
+       unsigned int c[0];   /* polynomial terms */
+};
+
+/* given its degree, compute a polynomial size in bytes */
+#define GF_POLY_SZ(_d) (sizeof(struct gf_poly)+((_d)+1)*sizeof(unsigned int))
+
+/* polynomial of degree 1 */
+struct gf_poly_deg1 {
+       struct gf_poly poly;
+       unsigned int   c[2];
+};
+
+/*
+ * same as encode_bch(), but process input data one byte at a time
+ */
+static void encode_bch_unaligned(struct bch_control *bch,
+                                const unsigned char *data, unsigned int len,
+                                uint32_t *ecc)
+{
+       int i;
+       const uint32_t *p;
+       const int l = BCH_ECC_WORDS(bch)-1;
+
+       while (len--) {
+               p = bch->mod8_tab + (l+1)*(((ecc[0] >> 24)^(*data++)) & 0xff);
+
+               for (i = 0; i < l; i++)
+                       ecc[i] = ((ecc[i] << 8)|(ecc[i+1] >> 24))^(*p++);
+
+               ecc[l] = (ecc[l] << 8)^(*p);
+       }
+}
+
+/*
+ * convert ecc bytes to aligned, zero-padded 32-bit ecc words
+ */
+static void load_ecc8(struct bch_control *bch, uint32_t *dst,
+                     const uint8_t *src)
+{
+       uint8_t pad[4] = {0, 0, 0, 0};
+       unsigned int i, nwords = BCH_ECC_WORDS(bch)-1;
+
+       for (i = 0; i < nwords; i++, src += 4)
+               dst[i] = (src[0] << 24)|(src[1] << 16)|(src[2] << 8)|src[3];
+
+       memcpy(pad, src, BCH_ECC_BYTES(bch)-4*nwords);
+       dst[nwords] = (pad[0] << 24)|(pad[1] << 16)|(pad[2] << 8)|pad[3];
+}
+
+/*
+ * convert 32-bit ecc words to ecc bytes
+ */
+static void store_ecc8(struct bch_control *bch, uint8_t *dst,
+                      const uint32_t *src)
+{
+       uint8_t pad[4];
+       unsigned int i, nwords = BCH_ECC_WORDS(bch)-1;
+
+       for (i = 0; i < nwords; i++) {
+               *dst++ = (src[i] >> 24);
+               *dst++ = (src[i] >> 16) & 0xff;
+               *dst++ = (src[i] >>  8) & 0xff;
+               *dst++ = (src[i] >>  0) & 0xff;
+       }
+       pad[0] = (src[nwords] >> 24);
+       pad[1] = (src[nwords] >> 16) & 0xff;
+       pad[2] = (src[nwords] >>  8) & 0xff;
+       pad[3] = (src[nwords] >>  0) & 0xff;
+       memcpy(dst, pad, BCH_ECC_BYTES(bch)-4*nwords);
+}
+
+/**
+ * encode_bch - calculate BCH ecc parity of data
+ * @bch:   BCH control structure
+ * @data:  data to encode
+ * @len:   data length in bytes
+ * @ecc:   ecc parity data, must be initialized by caller
+ *
+ * The @ecc parity array is used both as input and output parameter, in order to
+ * allow incremental computations. It should be of the size indicated by member
+ * @ecc_bytes of @bch, and should be initialized to 0 before the first call.
+ *
+ * The exact number of computed ecc parity bits is given by member @ecc_bits of
+ * @bch; it may be less than m*t for large values of t.
+ */
+void encode_bch(struct bch_control *bch, const uint8_t *data,
+               unsigned int len, uint8_t *ecc)
+{
+       const unsigned int l = BCH_ECC_WORDS(bch)-1;
+       unsigned int i, mlen;
+       unsigned long m;
+       uint32_t w, r[l+1];
+       const uint32_t * const tab0 = bch->mod8_tab;
+       const uint32_t * const tab1 = tab0 + 256*(l+1);
+       const uint32_t * const tab2 = tab1 + 256*(l+1);
+       const uint32_t * const tab3 = tab2 + 256*(l+1);
+       const uint32_t *pdata, *p0, *p1, *p2, *p3;
+
+       if (ecc) {
+               /* load ecc parity bytes into internal 32-bit buffer */
+               load_ecc8(bch, bch->ecc_buf, ecc);
+       } else {
+               memset(bch->ecc_buf, 0, sizeof(r));
+       }
+
+       /* process first unaligned data bytes */
+       m = ((unsigned long)data) & 3;
+       if (m) {
+               mlen = (len < (4-m)) ? len : 4-m;
+               encode_bch_unaligned(bch, data, mlen, bch->ecc_buf);
+               data += mlen;
+               len  -= mlen;
+       }
+
+       /* process 32-bit aligned data words */
+       pdata = (uint32_t *)data;
+       mlen  = len/4;
+       data += 4*mlen;
+       len  -= 4*mlen;
+       memcpy(r, bch->ecc_buf, sizeof(r));
+
+       /*
+        * split each 32-bit word into 4 polynomials of weight 8 as follows:
+        *
+        * 31 ...24  23 ...16  15 ... 8  7 ... 0
+        * xxxxxxxx  yyyyyyyy  zzzzzzzz  tttttttt
+        *                               tttttttt  mod g = r0 (precomputed)
+        *                     zzzzzzzz  00000000  mod g = r1 (precomputed)
+        *           yyyyyyyy  00000000  00000000  mod g = r2 (precomputed)
+        * xxxxxxxx  00000000  00000000  00000000  mod g = r3 (precomputed)
+        * xxxxxxxx  yyyyyyyy  zzzzzzzz  tttttttt  mod g = r0^r1^r2^r3
+        */
+       while (mlen--) {
+               /* input data is read in big-endian format */
+               w = r[0]^cpu_to_be32(*pdata++);
+               p0 = tab0 + (l+1)*((w >>  0) & 0xff);
+               p1 = tab1 + (l+1)*((w >>  8) & 0xff);
+               p2 = tab2 + (l+1)*((w >> 16) & 0xff);
+               p3 = tab3 + (l+1)*((w >> 24) & 0xff);
+
+               for (i = 0; i < l; i++)
+                       r[i] = r[i+1]^p0[i]^p1[i]^p2[i]^p3[i];
+
+               r[l] = p0[l]^p1[l]^p2[l]^p3[l];
+       }
+       memcpy(bch->ecc_buf, r, sizeof(r));
+
+       /* process last unaligned bytes */
+       if (len)
+               encode_bch_unaligned(bch, data, len, bch->ecc_buf);
+
+       /* store ecc parity bytes into original parity buffer */
+       if (ecc)
+               store_ecc8(bch, ecc, bch->ecc_buf);
+}
+
+static inline int modulo(struct bch_control *bch, unsigned int v)
+{
+       const unsigned int n = GF_N(bch);
+       while (v >= n) {
+               v -= n;
+               v = (v & n) + (v >> GF_M(bch));
+       }
+       return v;
+}
+
+/*
+ * shorter and faster modulo function, only works when v < 2N.
+ */
+static inline int mod_s(struct bch_control *bch, unsigned int v)
+{
+       const unsigned int n = GF_N(bch);
+       return (v < n) ? v : v-n;
+}
+
+static inline int deg(unsigned int poly)
+{
+       /* polynomial degree is the most-significant bit index */
+       return fls(poly)-1;
+}
+
+static inline int parity(unsigned int x)
+{
+       /*
+        * public domain code snippet, lifted from
+        * http://www-graphics.stanford.edu/~seander/bithacks.html
+        */
+       x ^= x >> 1;
+       x ^= x >> 2;
+       x = (x & 0x11111111U) * 0x11111111U;
+       return (x >> 28) & 1;
+}
+
+/* Galois field basic operations: multiply, divide, inverse, etc. */
+
+static inline unsigned int gf_mul(struct bch_control *bch, unsigned int a,
+                                 unsigned int b)
+{
+       return (a && b) ? bch->a_pow_tab[mod_s(bch, bch->a_log_tab[a]+
+                                              bch->a_log_tab[b])] : 0;
+}
+
+static inline unsigned int gf_sqr(struct bch_control *bch, unsigned int a)
+{
+       return a ? bch->a_pow_tab[mod_s(bch, 2*bch->a_log_tab[a])] : 0;
+}
+
+static inline unsigned int gf_div(struct bch_control *bch, unsigned int a,
+                                 unsigned int b)
+{
+       return a ? bch->a_pow_tab[mod_s(bch, bch->a_log_tab[a]+
+                                       GF_N(bch)-bch->a_log_tab[b])] : 0;
+}
+
+static inline unsigned int gf_inv(struct bch_control *bch, unsigned int a)
+{
+       return bch->a_pow_tab[GF_N(bch)-bch->a_log_tab[a]];
+}
+
+static inline unsigned int a_pow(struct bch_control *bch, int i)
+{
+       return bch->a_pow_tab[modulo(bch, i)];
+}
+
+static inline int a_log(struct bch_control *bch, unsigned int x)
+{
+       return bch->a_log_tab[x];
+}
+
+static inline int a_ilog(struct bch_control *bch, unsigned int x)
+{
+       return mod_s(bch, GF_N(bch)-bch->a_log_tab[x]);
+}
+
+/*
+ * compute 2t syndromes of ecc polynomial, i.e. ecc(a^j) for j=1..2t
+ */
+static void compute_syndromes(struct bch_control *bch, uint32_t *ecc,
+                             unsigned int *syn)
+{
+       int i, j, s;
+       unsigned int m;
+       uint32_t poly;
+       const int t = GF_T(bch);
+
+       s = bch->ecc_bits;
+
+       /* make sure extra bits in last ecc word are cleared */
+       m = ((unsigned int)s) & 31;
+       if (m)
+               ecc[s/32] &= ~((1u << (32-m))-1);
+       memset(syn, 0, 2*t*sizeof(*syn));
+
+       /* compute v(a^j) for j=1 .. 2t-1 */
+       do {
+               poly = *ecc++;
+               s -= 32;
+               while (poly) {
+                       i = deg(poly);
+                       for (j = 0; j < 2*t; j += 2)
+                               syn[j] ^= a_pow(bch, (j+1)*(i+s));
+
+                       poly ^= (1 << i);
+               }
+       } while (s > 0);
+
+       /* v(a^(2j)) = v(a^j)^2 */
+       for (j = 0; j < t; j++)
+               syn[2*j+1] = gf_sqr(bch, syn[j]);
+}
+
+static void gf_poly_copy(struct gf_poly *dst, struct gf_poly *src)
+{
+       memcpy(dst, src, GF_POLY_SZ(src->deg));
+}
+
+static int compute_error_locator_polynomial(struct bch_control *bch,
+                                           const unsigned int *syn)
+{
+       const unsigned int t = GF_T(bch);
+       const unsigned int n = GF_N(bch);
+       unsigned int i, j, tmp, l, pd = 1, d = syn[0];
+       struct gf_poly *elp = bch->elp;
+       struct gf_poly *pelp = bch->poly_2t[0];
+       struct gf_poly *elp_copy = bch->poly_2t[1];
+       int k, pp = -1;
+
+       memset(pelp, 0, GF_POLY_SZ(2*t));
+       memset(elp, 0, GF_POLY_SZ(2*t));
+
+       pelp->deg = 0;
+       pelp->c[0] = 1;
+       elp->deg = 0;
+       elp->c[0] = 1;
+
+       /* use simplified binary Berlekamp-Massey algorithm */
+       for (i = 0; (i < t) && (elp->deg <= t); i++) {
+               if (d) {
+                       k = 2*i-pp;
+                       gf_poly_copy(elp_copy, elp);
+                       /* e[i+1](X) = e[i](X)+di*dp^-1*X^2(i-p)*e[p](X) */
+                       tmp = a_log(bch, d)+n-a_log(bch, pd);
+                       for (j = 0; j <= pelp->deg; j++) {
+                               if (pelp->c[j]) {
+                                       l = a_log(bch, pelp->c[j]);
+                                       elp->c[j+k] ^= a_pow(bch, tmp+l);
+                               }
+                       }
+                       /* compute l[i+1] = max(l[i]->c[l[p]+2*(i-p]) */
+                       tmp = pelp->deg+k;
+                       if (tmp > elp->deg) {
+                               elp->deg = tmp;
+                               gf_poly_copy(pelp, elp_copy);
+                               pd = d;
+                               pp = 2*i;
+                       }
+               }
+               /* di+1 = S(2i+3)+elp[i+1].1*S(2i+2)+...+elp[i+1].lS(2i+3-l) */
+               if (i < t-1) {
+                       d = syn[2*i+2];
+                       for (j = 1; j <= elp->deg; j++)
+                               d ^= gf_mul(bch, elp->c[j], syn[2*i+2-j]);
+               }
+       }
+       dbg("elp=%s\n", gf_poly_str(elp));
+       return (elp->deg > t) ? -1 : (int)elp->deg;
+}
+
+/*
+ * solve a m x m linear system in GF(2) with an expected number of solutions,
+ * and return the number of found solutions
+ */
+static int solve_linear_system(struct bch_control *bch, unsigned int *rows,
+                              unsigned int *sol, int nsol)
+{
+       const int m = GF_M(bch);
+       unsigned int tmp, mask;
+       int rem, c, r, p, k, param[m];
+
+       k = 0;
+       mask = 1 << m;
+
+       /* Gaussian elimination */
+       for (c = 0; c < m; c++) {
+               rem = 0;
+               p = c-k;
+               /* find suitable row for elimination */
+               for (r = p; r < m; r++) {
+                       if (rows[r] & mask) {
+                               if (r != p) {
+                                       tmp = rows[r];
+                                       rows[r] = rows[p];
+                                       rows[p] = tmp;
+                               }
+                               rem = r+1;
+                               break;
+                       }
+               }
+               if (rem) {
+                       /* perform elimination on remaining rows */
+                       tmp = rows[p];
+                       for (r = rem; r < m; r++) {
+                               if (rows[r] & mask)
+                                       rows[r] ^= tmp;
+                       }
+               } else {
+                       /* elimination not needed, store defective row index */
+                       param[k++] = c;
+               }
+               mask >>= 1;
+       }
+       /* rewrite system, inserting fake parameter rows */
+       if (k > 0) {
+               p = k;
+               for (r = m-1; r >= 0; r--) {
+                       if ((r > m-1-k) && rows[r])
+                               /* system has no solution */
+                               return 0;
+
+                       rows[r] = (p && (r == param[p-1])) ?
+                               p--, 1u << (m-r) : rows[r-p];
+               }
+       }
+
+       if (nsol != (1 << k))
+               /* unexpected number of solutions */
+               return 0;
+
+       for (p = 0; p < nsol; p++) {
+               /* set parameters for p-th solution */
+               for (c = 0; c < k; c++)
+                       rows[param[c]] = (rows[param[c]] & ~1)|((p >> c) & 1);
+
+               /* compute unique solution */
+               tmp = 0;
+               for (r = m-1; r >= 0; r--) {
+                       mask = rows[r] & (tmp|1);
+                       tmp |= parity(mask) << (m-r);
+               }
+               sol[p] = tmp >> 1;
+       }
+       return nsol;
+}
+
+/*
+ * this function builds and solves a linear system for finding roots of a degree
+ * 4 affine monic polynomial X^4+aX^2+bX+c over GF(2^m).
+ */
+static int find_affine4_roots(struct bch_control *bch, unsigned int a,
+                             unsigned int b, unsigned int c,
+                             unsigned int *roots)
+{
+       int i, j, k;
+       const int m = GF_M(bch);
+       unsigned int mask = 0xff, t, rows[16] = {0,};
+
+       j = a_log(bch, b);
+       k = a_log(bch, a);
+       rows[0] = c;
+
+       /* buid linear system to solve X^4+aX^2+bX+c = 0 */
+       for (i = 0; i < m; i++) {
+               rows[i+1] = bch->a_pow_tab[4*i]^
+                       (a ? bch->a_pow_tab[mod_s(bch, k)] : 0)^
+                       (b ? bch->a_pow_tab[mod_s(bch, j)] : 0);
+               j++;
+               k += 2;
+       }
+       /*
+        * transpose 16x16 matrix before passing it to linear solver
+        * warning: this code assumes m < 16
+        */
+       for (j = 8; j != 0; j >>= 1, mask ^= (mask << j)) {
+               for (k = 0; k < 16; k = (k+j+1) & ~j) {
+                       t = ((rows[k] >> j)^rows[k+j]) & mask;
+                       rows[k] ^= (t << j);
+                       rows[k+j] ^= t;
+               }
+       }
+       return solve_linear_system(bch, rows, roots, 4);
+}
+
+/*
+ * compute root r of a degree 1 polynomial over GF(2^m) (returned as log(1/r))
+ */
+static int find_poly_deg1_roots(struct bch_control *bch, struct gf_poly *poly,
+                               unsigned int *roots)
+{
+       int n = 0;
+
+       if (poly->c[0])
+               /* poly[X] = bX+c with c!=0, root=c/b */
+               roots[n++] = mod_s(bch, GF_N(bch)-bch->a_log_tab[poly->c[0]]+
+                                  bch->a_log_tab[poly->c[1]]);
+       return n;
+}
+
+/*
+ * compute roots of a degree 2 polynomial over GF(2^m)
+ */
+static int find_poly_deg2_roots(struct bch_control *bch, struct gf_poly *poly,
+                               unsigned int *roots)
+{
+       int n = 0, i, l0, l1, l2;
+       unsigned int u, v, r;
+
+       if (poly->c[0] && poly->c[1]) {
+
+               l0 = bch->a_log_tab[poly->c[0]];
+               l1 = bch->a_log_tab[poly->c[1]];
+               l2 = bch->a_log_tab[poly->c[2]];
+
+               /* using z=a/bX, transform aX^2+bX+c into z^2+z+u (u=ac/b^2) */
+               u = a_pow(bch, l0+l2+2*(GF_N(bch)-l1));
+               /*
+                * let u = sum(li.a^i) i=0..m-1; then compute r = sum(li.xi):
+                * r^2+r = sum(li.(xi^2+xi)) = sum(li.(a^i+Tr(a^i).a^k)) =
+                * u + sum(li.Tr(a^i).a^k) = u+a^k.Tr(sum(li.a^i)) = u+a^k.Tr(u)
+                * i.e. r and r+1 are roots iff Tr(u)=0
+                */
+               r = 0;
+               v = u;
+               while (v) {
+                       i = deg(v);
+                       r ^= bch->xi_tab[i];
+                       v ^= (1 << i);
+               }
+               /* verify root */
+               if ((gf_sqr(bch, r)^r) == u) {
+                       /* reverse z=a/bX transformation and compute log(1/r) */
+                       roots[n++] = modulo(bch, 2*GF_N(bch)-l1-
+                                           bch->a_log_tab[r]+l2);
+                       roots[n++] = modulo(bch, 2*GF_N(bch)-l1-
+                                           bch->a_log_tab[r^1]+l2);
+               }
+       }
+       return n;
+}
+
+/*
+ * compute roots of a degree 3 polynomial over GF(2^m)
+ */
+static int find_poly_deg3_roots(struct bch_control *bch, struct gf_poly *poly,
+                               unsigned int *roots)
+{
+       int i, n = 0;
+       unsigned int a, b, c, a2, b2, c2, e3, tmp[4];
+
+       if (poly->c[0]) {
+               /* transform polynomial into monic X^3 + a2X^2 + b2X + c2 */
+               e3 = poly->c[3];
+               c2 = gf_div(bch, poly->c[0], e3);
+               b2 = gf_div(bch, poly->c[1], e3);
+               a2 = gf_div(bch, poly->c[2], e3);
+
+               /* (X+a2)(X^3+a2X^2+b2X+c2) = X^4+aX^2+bX+c (affine) */
+               c = gf_mul(bch, a2, c2);           /* c = a2c2      */
+               b = gf_mul(bch, a2, b2)^c2;        /* b = a2b2 + c2 */
+               a = gf_sqr(bch, a2)^b2;            /* a = a2^2 + b2 */
+
+               /* find the 4 roots of this affine polynomial */
+               if (find_affine4_roots(bch, a, b, c, tmp) == 4) {
+                       /* remove a2 from final list of roots */
+                       for (i = 0; i < 4; i++) {
+                               if (tmp[i] != a2)
+                                       roots[n++] = a_ilog(bch, tmp[i]);
+                       }
+               }
+       }
+       return n;
+}
+
+/*
+ * compute roots of a degree 4 polynomial over GF(2^m)
+ */
+static int find_poly_deg4_roots(struct bch_control *bch, struct gf_poly *poly,
+                               unsigned int *roots)
+{
+       int i, l, n = 0;
+       unsigned int a, b, c, d, e = 0, f, a2, b2, c2, e4;
+
+       if (poly->c[0] == 0)
+               return 0;
+
+       /* transform polynomial into monic X^4 + aX^3 + bX^2 + cX + d */
+       e4 = poly->c[4];
+       d = gf_div(bch, poly->c[0], e4);
+       c = gf_div(bch, poly->c[1], e4);
+       b = gf_div(bch, poly->c[2], e4);
+       a = gf_div(bch, poly->c[3], e4);
+
+       /* use Y=1/X transformation to get an affine polynomial */
+       if (a) {
+               /* first, eliminate cX by using z=X+e with ae^2+c=0 */
+               if (c) {
+                       /* compute e such that e^2 = c/a */
+                       f = gf_div(bch, c, a);
+                       l = a_log(bch, f);
+                       l += (l & 1) ? GF_N(bch) : 0;
+                       e = a_pow(bch, l/2);
+                       /*
+                        * use transformation z=X+e:
+                        * z^4+e^4 + a(z^3+ez^2+e^2z+e^3) + b(z^2+e^2) +cz+ce+d
+                        * z^4 + az^3 + (ae+b)z^2 + (ae^2+c)z+e^4+be^2+ae^3+ce+d
+                        * z^4 + az^3 + (ae+b)z^2 + e^4+be^2+d
+                        * z^4 + az^3 +     b'z^2 + d'
+                        */
+                       d = a_pow(bch, 2*l)^gf_mul(bch, b, f)^d;
+                       b = gf_mul(bch, a, e)^b;
+               }
+               /* now, use Y=1/X to get Y^4 + b/dY^2 + a/dY + 1/d */
+               if (d == 0)
+                       /* assume all roots have multiplicity 1 */
+                       return 0;
+
+               c2 = gf_inv(bch, d);
+               b2 = gf_div(bch, a, d);
+               a2 = gf_div(bch, b, d);
+       } else {
+               /* polynomial is already affine */
+               c2 = d;
+               b2 = c;
+               a2 = b;
+       }
+       /* find the 4 roots of this affine polynomial */
+       if (find_affine4_roots(bch, a2, b2, c2, roots) == 4) {
+               for (i = 0; i < 4; i++) {
+                       /* post-process roots (reverse transformations) */
+                       f = a ? gf_inv(bch, roots[i]) : roots[i];
+                       roots[i] = a_ilog(bch, f^e);
+               }
+               n = 4;
+       }
+       return n;
+}
+
+/*
+ * build monic, log-based representation of a polynomial
+ */
+static void gf_poly_logrep(struct bch_control *bch,
+                          const struct gf_poly *a, int *rep)
+{
+       int i, d = a->deg, l = GF_N(bch)-a_log(bch, a->c[a->deg]);
+
+       /* represent 0 values with -1; warning, rep[d] is not set to 1 */
+       for (i = 0; i < d; i++)
+               rep[i] = a->c[i] ? mod_s(bch, a_log(bch, a->c[i])+l) : -1;
+}
+
+/*
+ * compute polynomial Euclidean division remainder in GF(2^m)[X]
+ */
+static void gf_poly_mod(struct bch_control *bch, struct gf_poly *a,
+                       const struct gf_poly *b, int *rep)
+{
+       int la, p, m;
+       unsigned int i, j, *c = a->c;
+       const unsigned int d = b->deg;
+
+       if (a->deg < d)
+               return;
+
+       /* reuse or compute log representation of denominator */
+       if (!rep) {
+               rep = bch->cache;
+               gf_poly_logrep(bch, b, rep);
+       }
+
+       for (j = a->deg; j >= d; j--) {
+               if (c[j]) {
+                       la = a_log(bch, c[j]);
+                       p = j-d;
+                       for (i = 0; i < d; i++, p++) {
+                               m = rep[i];
+                               if (m >= 0)
+                                       c[p] ^= bch->a_pow_tab[mod_s(bch,
+                                                                    m+la)];
+                       }
+               }
+       }
+       a->deg = d-1;
+       while (!c[a->deg] && a->deg)
+               a->deg--;
+}
+
+/*
+ * compute polynomial Euclidean division quotient in GF(2^m)[X]
+ */
+static void gf_poly_div(struct bch_control *bch, struct gf_poly *a,
+                       const struct gf_poly *b, struct gf_poly *q)
+{
+       if (a->deg >= b->deg) {
+               q->deg = a->deg-b->deg;
+               /* compute a mod b (modifies a) */
+               gf_poly_mod(bch, a, b, NULL);
+               /* quotient is stored in upper part of polynomial a */
+               memcpy(q->c, &a->c[b->deg], (1+q->deg)*sizeof(unsigned int));
+       } else {
+               q->deg = 0;
+               q->c[0] = 0;
+       }
+}
+
+/*
+ * compute polynomial GCD (Greatest Common Divisor) in GF(2^m)[X]
+ */
+static struct gf_poly *gf_poly_gcd(struct bch_control *bch, struct gf_poly *a,
+                                  struct gf_poly *b)
+{
+       struct gf_poly *tmp;
+
+       dbg("gcd(%s,%s)=", gf_poly_str(a), gf_poly_str(b));
+
+       if (a->deg < b->deg) {
+               tmp = b;
+               b = a;
+               a = tmp;
+       }
+
+       while (b->deg > 0) {
+               gf_poly_mod(bch, a, b, NULL);
+               tmp = b;
+               b = a;
+               a = tmp;
+       }
+
+       dbg("%s\n", gf_poly_str(a));
+
+       return a;
+}
+
+/*
+ * Given a polynomial f and an integer k, compute Tr(a^kX) mod f
+ * This is used in Berlekamp Trace algorithm for splitting polynomials
+ */
+static void compute_trace_bk_mod(struct bch_control *bch, int k,
+                                const struct gf_poly *f, struct gf_poly *z,
+                                struct gf_poly *out)
+{
+       const int m = GF_M(bch);
+       int i, j;
+
+       /* z contains z^2j mod f */
+       z->deg = 1;
+       z->c[0] = 0;
+       z->c[1] = bch->a_pow_tab[k];
+
+       out->deg = 0;
+       memset(out, 0, GF_POLY_SZ(f->deg));
+
+       /* compute f log representation only once */
+       gf_poly_logrep(bch, f, bch->cache);
+
+       for (i = 0; i < m; i++) {
+               /* add a^(k*2^i)(z^(2^i) mod f) and compute (z^(2^i) mod f)^2 */
+               for (j = z->deg; j >= 0; j--) {
+                       out->c[j] ^= z->c[j];
+                       z->c[2*j] = gf_sqr(bch, z->c[j]);
+                       z->c[2*j+1] = 0;
+               }
+               if (z->deg > out->deg)
+                       out->deg = z->deg;
+
+               if (i < m-1) {
+                       z->deg *= 2;
+                       /* z^(2(i+1)) mod f = (z^(2^i) mod f)^2 mod f */
+                       gf_poly_mod(bch, z, f, bch->cache);
+               }
+       }
+       while (!out->c[out->deg] && out->deg)
+               out->deg--;
+
+       dbg("Tr(a^%d.X) mod f = %s\n", k, gf_poly_str(out));
+}
+
+/*
+ * factor a polynomial using Berlekamp Trace algorithm (BTA)
+ */
+static void factor_polynomial(struct bch_control *bch, int k, struct gf_poly *f,
+                             struct gf_poly **g, struct gf_poly **h)
+{
+       struct gf_poly *f2 = bch->poly_2t[0];
+       struct gf_poly *q  = bch->poly_2t[1];
+       struct gf_poly *tk = bch->poly_2t[2];
+       struct gf_poly *z  = bch->poly_2t[3];
+       struct gf_poly *gcd;
+
+       dbg("factoring %s...\n", gf_poly_str(f));
+
+       *g = f;
+       *h = NULL;
+
+       /* tk = Tr(a^k.X) mod f */
+       compute_trace_bk_mod(bch, k, f, z, tk);
+
+       if (tk->deg > 0) {
+               /* compute g = gcd(f, tk) (destructive operation) */
+               gf_poly_copy(f2, f);
+               gcd = gf_poly_gcd(bch, f2, tk);
+               if (gcd->deg < f->deg) {
+                       /* compute h=f/gcd(f,tk); this will modify f and q */
+                       gf_poly_div(bch, f, gcd, q);
+                       /* store g and h in-place (clobbering f) */
+                       *h = &((struct gf_poly_deg1 *)f)[gcd->deg].poly;
+                       gf_poly_copy(*g, gcd);
+                       gf_poly_copy(*h, q);
+               }
+       }
+}
+
+/*
+ * find roots of a polynomial, using BTZ algorithm; see the beginning of this
+ * file for details
+ */
+static int find_poly_roots(struct bch_control *bch, unsigned int k,
+                          struct gf_poly *poly, unsigned int *roots)
+{
+       int cnt;
+       struct gf_poly *f1, *f2;
+
+       switch (poly->deg) {
+               /* handle low degree polynomials with ad hoc techniques */
+       case 1:
+               cnt = find_poly_deg1_roots(bch, poly, roots);
+               break;
+       case 2:
+               cnt = find_poly_deg2_roots(bch, poly, roots);
+               break;
+       case 3:
+               cnt = find_poly_deg3_roots(bch, poly, roots);
+               break;
+       case 4:
+               cnt = find_poly_deg4_roots(bch, poly, roots);
+               break;
+       default:
+               /* factor polynomial using Berlekamp Trace Algorithm (BTA) */
+               cnt = 0;
+               if (poly->deg && (k <= GF_M(bch))) {
+                       factor_polynomial(bch, k, poly, &f1, &f2);
+                       if (f1)
+                               cnt += find_poly_roots(bch, k+1, f1, roots);
+                       if (f2)
+                               cnt += find_poly_roots(bch, k+1, f2, roots+cnt);
+               }
+               break;
+       }
+       return cnt;
+}
+
+#if defined(USE_CHIEN_SEARCH)
+/*
+ * exhaustive root search (Chien) implementation - not used, included only for
+ * reference/comparison tests
+ */
+static int chien_search(struct bch_control *bch, unsigned int len,
+                       struct gf_poly *p, unsigned int *roots)
+{
+       int m;
+       unsigned int i, j, syn, syn0, count = 0;
+       const unsigned int k = 8*len+bch->ecc_bits;
+
+       /* use a log-based representation of polynomial */
+       gf_poly_logrep(bch, p, bch->cache);
+       bch->cache[p->deg] = 0;
+       syn0 = gf_div(bch, p->c[0], p->c[p->deg]);
+
+       for (i = GF_N(bch)-k+1; i <= GF_N(bch); i++) {
+               /* compute elp(a^i) */
+               for (j = 1, syn = syn0; j <= p->deg; j++) {
+                       m = bch->cache[j];
+                       if (m >= 0)
+                               syn ^= a_pow(bch, m+j*i);
+               }
+               if (syn == 0) {
+                       roots[count++] = GF_N(bch)-i;
+                       if (count == p->deg)
+                               break;
+               }
+       }
+       return (count == p->deg) ? count : 0;
+}
+#define find_poly_roots(_p, _k, _elp, _loc) chien_search(_p, len, _elp, _loc)
+#endif /* USE_CHIEN_SEARCH */
+
+/**
+ * decode_bch - decode received codeword and find bit error locations
+ * @bch:      BCH control structure
+ * @data:     received data, ignored if @calc_ecc is provided
+ * @len:      data length in bytes, must always be provided
+ * @recv_ecc: received ecc, if NULL then assume it was XORed in @calc_ecc
+ * @calc_ecc: calculated ecc, if NULL then calc_ecc is computed from @data
+ * @syn:      hw computed syndrome data (if NULL, syndrome is calculated)
+ * @errloc:   output array of error locations
+ *
+ * Returns:
+ *  The number of errors found, or -EBADMSG if decoding failed, or -EINVAL if
+ *  invalid parameters were provided
+ *
+ * Depending on the available hw BCH support and the need to compute @calc_ecc
+ * separately (using encode_bch()), this function should be called with one of
+ * the following parameter configurations -
+ *
+ * by providing @data and @recv_ecc only:
+ *   decode_bch(@bch, @data, @len, @recv_ecc, NULL, NULL, @errloc)
+ *
+ * by providing @recv_ecc and @calc_ecc:
+ *   decode_bch(@bch, NULL, @len, @recv_ecc, @calc_ecc, NULL, @errloc)
+ *
+ * by providing ecc = recv_ecc XOR calc_ecc:
+ *   decode_bch(@bch, NULL, @len, NULL, ecc, NULL, @errloc)
+ *
+ * by providing syndrome results @syn:
+ *   decode_bch(@bch, NULL, @len, NULL, NULL, @syn, @errloc)
+ *
+ * Once decode_bch() has successfully returned with a positive value, error
+ * locations returned in array @errloc should be interpreted as follows -
+ *
+ * if (errloc[n] >= 8*len), then n-th error is located in ecc (no need for
+ * data correction)
+ *
+ * if (errloc[n] < 8*len), then n-th error is located in data and can be
+ * corrected with statement data[errloc[n]/8] ^= 1 << (errloc[n] % 8);
+ *
+ * Note that this function does not perform any data correction by itself, it
+ * merely indicates error locations.
+ */
+int decode_bch(struct bch_control *bch, const uint8_t *data, unsigned int len,
+              const uint8_t *recv_ecc, const uint8_t *calc_ecc,
+              const unsigned int *syn, unsigned int *errloc)
+{
+       const unsigned int ecc_words = BCH_ECC_WORDS(bch);
+       unsigned int nbits;
+       int i, err, nroots;
+       uint32_t sum;
+
+       /* sanity check: make sure data length can be handled */
+       if (8*len > (bch->n-bch->ecc_bits))
+               return -EINVAL;
+
+       /* if caller does not provide syndromes, compute them */
+       if (!syn) {
+               if (!calc_ecc) {
+                       /* compute received data ecc into an internal buffer */
+                       if (!data || !recv_ecc)
+                               return -EINVAL;
+                       encode_bch(bch, data, len, NULL);
+               } else {
+                       /* load provided calculated ecc */
+                       load_ecc8(bch, bch->ecc_buf, calc_ecc);
+               }
+               /* load received ecc or assume it was XORed in calc_ecc */
+               if (recv_ecc) {
+                       load_ecc8(bch, bch->ecc_buf2, recv_ecc);
+                       /* XOR received and calculated ecc */
+                       for (i = 0, sum = 0; i < (int)ecc_words; i++) {
+                               bch->ecc_buf[i] ^= bch->ecc_buf2[i];
+                               sum |= bch->ecc_buf[i];
+                       }
+                       if (!sum)
+                               /* no error found */
+                               return 0;
+               }
+               compute_syndromes(bch, bch->ecc_buf, bch->syn);
+               syn = bch->syn;
+       }
+
+       err = compute_error_locator_polynomial(bch, syn);
+       if (err > 0) {
+               nroots = find_poly_roots(bch, 1, bch->elp, errloc);
+               if (err != nroots)
+                       err = -1;
+       }
+       if (err > 0) {
+               /* post-process raw error locations for easier correction */
+               nbits = (len*8)+bch->ecc_bits;
+               for (i = 0; i < err; i++) {
+                       if (errloc[i] >= nbits) {
+                               err = -1;
+                               break;
+                       }
+                       errloc[i] = nbits-1-errloc[i];
+                       errloc[i] = (errloc[i] & ~7)|(7-(errloc[i] & 7));
+               }
+       }
+       return (err >= 0) ? err : -EBADMSG;
+}
+
+/*
+ * generate Galois field lookup tables
+ */
+static int build_gf_tables(struct bch_control *bch, unsigned int poly)
+{
+       unsigned int i, x = 1;
+       const unsigned int k = 1 << deg(poly);
+
+       /* primitive polynomial must be of degree m */
+       if (k != (1u << GF_M(bch)))
+               return -1;
+
+       for (i = 0; i < GF_N(bch); i++) {
+               bch->a_pow_tab[i] = x;
+               bch->a_log_tab[x] = i;
+               if (i && (x == 1))
+                       /* polynomial is not primitive (a^i=1 with 0<i<2^m-1) */
+                       return -1;
+               x <<= 1;
+               if (x & k)
+                       x ^= poly;
+       }
+       bch->a_pow_tab[GF_N(bch)] = 1;
+       bch->a_log_tab[0] = 0;
+
+       return 0;
+}
+
+/*
+ * compute generator polynomial remainder tables for fast encoding
+ */
+static void build_mod8_tables(struct bch_control *bch, const uint32_t *g)
+{
+       int i, j, b, d;
+       uint32_t data, hi, lo, *tab;
+       const int l = BCH_ECC_WORDS(bch);
+       const int plen = DIV_ROUND_UP(bch->ecc_bits+1, 32);
+       const int ecclen = DIV_ROUND_UP(bch->ecc_bits, 32);
+
+       memset(bch->mod8_tab, 0, 4*256*l*sizeof(*bch->mod8_tab));
+
+       for (i = 0; i < 256; i++) {
+               /* p(X)=i is a small polynomial of weight <= 8 */
+               for (b = 0; b < 4; b++) {
+                       /* we want to compute (p(X).X^(8*b+deg(g))) mod g(X) */
+                       tab = bch->mod8_tab + (b*256+i)*l;
+                       data = i << (8*b);
+                       while (data) {
+                               d = deg(data);
+                               /* subtract X^d.g(X) from p(X).X^(8*b+deg(g)) */
+                               data ^= g[0] >> (31-d);
+                               for (j = 0; j < ecclen; j++) {
+                                       hi = (d < 31) ? g[j] << (d+1) : 0;
+                                       lo = (j+1 < plen) ?
+                                               g[j+1] >> (31-d) : 0;
+                                       tab[j] ^= hi|lo;
+                               }
+                       }
+               }
+       }
+}
+
+/*
+ * build a base for factoring degree 2 polynomials
+ */
+static int build_deg2_base(struct bch_control *bch)
+{
+       const int m = GF_M(bch);
+       int i, j, r;
+       unsigned int sum, x, y, remaining, ak = 0, xi[m];
+
+       /* find k s.t. Tr(a^k) = 1 and 0 <= k < m */
+       for (i = 0; i < m; i++) {
+               for (j = 0, sum = 0; j < m; j++)
+                       sum ^= a_pow(bch, i*(1 << j));
+
+               if (sum) {
+                       ak = bch->a_pow_tab[i];
+                       break;
+               }
+       }
+       /* find xi, i=0..m-1 such that xi^2+xi = a^i+Tr(a^i).a^k */
+       remaining = m;
+       memset(xi, 0, sizeof(xi));
+
+       for (x = 0; (x <= GF_N(bch)) && remaining; x++) {
+               y = gf_sqr(bch, x)^x;
+               for (i = 0; i < 2; i++) {
+                       r = a_log(bch, y);
+                       if (y && (r < m) && !xi[r]) {
+                               bch->xi_tab[r] = x;
+                               xi[r] = 1;
+                               remaining--;
+                               dbg("x%d = %x\n", r, x);
+                               break;
+                       }
+                       y ^= ak;
+               }
+       }
+       /* should not happen but check anyway */
+       return remaining ? -1 : 0;
+}
+
+static void *bch_alloc(size_t size, int *err)
+{
+       void *ptr;
+
+       ptr = kmalloc(size, GFP_KERNEL);
+       if (ptr == NULL)
+               *err = 1;
+       return ptr;
+}
+
+/*
+ * compute generator polynomial for given (m,t) parameters.
+ */
+static uint32_t *compute_generator_polynomial(struct bch_control *bch)
+{
+       const unsigned int m = GF_M(bch);
+       const unsigned int t = GF_T(bch);
+       int n, err = 0;
+       unsigned int i, j, nbits, r, word, *roots;
+       struct gf_poly *g;
+       uint32_t *genpoly;
+
+       g = bch_alloc(GF_POLY_SZ(m*t), &err);
+       roots = bch_alloc((bch->n+1)*sizeof(*roots), &err);
+       genpoly = bch_alloc(DIV_ROUND_UP(m*t+1, 32)*sizeof(*genpoly), &err);
+
+       if (err) {
+               kfree(genpoly);
+               genpoly = NULL;
+               goto finish;
+       }
+
+       /* enumerate all roots of g(X) */
+       memset(roots , 0, (bch->n+1)*sizeof(*roots));
+       for (i = 0; i < t; i++) {
+               for (j = 0, r = 2*i+1; j < m; j++) {
+                       roots[r] = 1;
+                       r = mod_s(bch, 2*r);
+               }
+       }
+       /* build generator polynomial g(X) */
+       g->deg = 0;
+       g->c[0] = 1;
+       for (i = 0; i < GF_N(bch); i++) {
+               if (roots[i]) {
+                       /* multiply g(X) by (X+root) */
+                       r = bch->a_pow_tab[i];
+                       g->c[g->deg+1] = 1;
+                       for (j = g->deg; j > 0; j--)
+                               g->c[j] = gf_mul(bch, g->c[j], r)^g->c[j-1];
+
+                       g->c[0] = gf_mul(bch, g->c[0], r);
+                       g->deg++;
+               }
+       }
+       /* store left-justified binary representation of g(X) */
+       n = g->deg+1;
+       i = 0;
+
+       while (n > 0) {
+               nbits = (n > 32) ? 32 : n;
+               for (j = 0, word = 0; j < nbits; j++) {
+                       if (g->c[n-1-j])
+                               word |= 1u << (31-j);
+               }
+               genpoly[i++] = word;
+               n -= nbits;
+       }
+       bch->ecc_bits = g->deg;
+
+finish:
+       kfree(g);
+       kfree(roots);
+
+       return genpoly;
+}
+
+/**
+ * init_bch - initialize a BCH encoder/decoder
+ * @m:          Galois field order, should be in the range 5-15
+ * @t:          maximum error correction capability, in bits
+ * @prim_poly:  user-provided primitive polynomial (or 0 to use default)
+ *
+ * Returns:
+ *  a newly allocated BCH control structure if successful, NULL otherwise
+ *
+ * This initialization can take some time, as lookup tables are built for fast
+ * encoding/decoding; make sure not to call this function from a time critical
+ * path. Usually, init_bch() should be called on module/driver init and
+ * free_bch() should be called to release memory on exit.
+ *
+ * You may provide your own primitive polynomial of degree @m in argument
+ * @prim_poly, or let init_bch() use its default polynomial.
+ *
+ * Once init_bch() has successfully returned a pointer to a newly allocated
+ * BCH control structure, ecc length in bytes is given by member @ecc_bytes of
+ * the structure.
+ */
+struct bch_control *init_bch(int m, int t, unsigned int prim_poly)
+{
+       int err = 0;
+       unsigned int i, words;
+       uint32_t *genpoly;
+       struct bch_control *bch = NULL;
+
+       const int min_m = 5;
+       const int max_m = 15;
+
+       /* default primitive polynomials */
+       static const unsigned int prim_poly_tab[] = {
+               0x25, 0x43, 0x83, 0x11d, 0x211, 0x409, 0x805, 0x1053, 0x201b,
+               0x402b, 0x8003,
+       };
+
+#if defined(CONFIG_BCH_CONST_PARAMS)
+       if ((m != (CONFIG_BCH_CONST_M)) || (t != (CONFIG_BCH_CONST_T))) {
+               printk(KERN_ERR "bch encoder/decoder was configured to support "
+                      "parameters m=%d, t=%d only!\n",
+                      CONFIG_BCH_CONST_M, CONFIG_BCH_CONST_T);
+               goto fail;
+       }
+#endif
+       if ((m < min_m) || (m > max_m))
+               /*
+                * values of m greater than 15 are not currently supported;
+                * supporting m > 15 would require changing table base type
+                * (uint16_t) and a small patch in matrix transposition
+                */
+               goto fail;
+
+       /* sanity checks */
+       if ((t < 1) || (m*t >= ((1 << m)-1)))
+               /* invalid t value */
+               goto fail;
+
+       /* select a primitive polynomial for generating GF(2^m) */
+       if (prim_poly == 0)
+               prim_poly = prim_poly_tab[m-min_m];
+
+       bch = kzalloc(sizeof(*bch), GFP_KERNEL);
+       if (bch == NULL)
+               goto fail;
+
+       bch->m = m;
+       bch->t = t;
+       bch->n = (1 << m)-1;
+       words  = DIV_ROUND_UP(m*t, 32);
+       bch->ecc_bytes = DIV_ROUND_UP(m*t, 8);
+       bch->a_pow_tab = bch_alloc((1+bch->n)*sizeof(*bch->a_pow_tab), &err);
+       bch->a_log_tab = bch_alloc((1+bch->n)*sizeof(*bch->a_log_tab), &err);
+       bch->mod8_tab  = bch_alloc(words*1024*sizeof(*bch->mod8_tab), &err);
+       bch->ecc_buf   = bch_alloc(words*sizeof(*bch->ecc_buf), &err);
+       bch->ecc_buf2  = bch_alloc(words*sizeof(*bch->ecc_buf2), &err);
+       bch->xi_tab    = bch_alloc(m*sizeof(*bch->xi_tab), &err);
+       bch->syn       = bch_alloc(2*t*sizeof(*bch->syn), &err);
+       bch->cache     = bch_alloc(2*t*sizeof(*bch->cache), &err);
+       bch->elp       = bch_alloc((t+1)*sizeof(struct gf_poly_deg1), &err);
+
+       for (i = 0; i < ARRAY_SIZE(bch->poly_2t); i++)
+               bch->poly_2t[i] = bch_alloc(GF_POLY_SZ(2*t), &err);
+
+       if (err)
+               goto fail;
+
+       err = build_gf_tables(bch, prim_poly);
+       if (err)
+               goto fail;
+
+       /* use generator polynomial for computing encoding tables */
+       genpoly = compute_generator_polynomial(bch);
+       if (genpoly == NULL)
+               goto fail;
+
+       build_mod8_tables(bch, genpoly);
+       kfree(genpoly);
+
+       err = build_deg2_base(bch);
+       if (err)
+               goto fail;
+
+       return bch;
+
+fail:
+       free_bch(bch);
+       return NULL;
+}
+
+/**
+ *  free_bch - free the BCH control structure
+ *  @bch:    BCH control structure to release
+ */
+void free_bch(struct bch_control *bch)
+{
+       unsigned int i;
+
+       if (bch) {
+               kfree(bch->a_pow_tab);
+               kfree(bch->a_log_tab);
+               kfree(bch->mod8_tab);
+               kfree(bch->ecc_buf);
+               kfree(bch->ecc_buf2);
+               kfree(bch->xi_tab);
+               kfree(bch->syn);
+               kfree(bch->cache);
+               kfree(bch->elp);
+
+               for (i = 0; i < ARRAY_SIZE(bch->poly_2t); i++)
+                       kfree(bch->poly_2t[i]);
+
+               kfree(bch);
+       }
+}
index 2c4f0ec9a11f8e7219b9c5d40659616bf4bc6aaf..c3ad055e2caeca752ba4238f65578edb0abfb814 100644 (file)
@@ -214,6 +214,45 @@ char * strrchr(const char * s, int c)
 }
 #endif
 
+
+/**
+ * skip_spaces - Removes leading whitespace from @str.
+ * @str: The string to be stripped.
+ *
+ * Returns a pointer to the first non-whitespace character in @str.
+ */
+char *skip_spaces(const char *str)
+{
+       while (isspace(*str))
+               ++str;
+       return (char *)str;
+}
+
+/**
+ * strim - Removes leading and trailing whitespace from @s.
+ * @s: The string to be stripped.
+ *
+ * Note that the first trailing whitespace is replaced with a %NUL-terminator
+ * in the given string @s. Returns a pointer to the first non-whitespace
+ * character in @s.
+ */
+char *strim(char *s)
+{
+       size_t size;
+       char *end;
+
+       s = skip_spaces(s);
+       size = strlen(s);
+       if (!size)
+               return s;
+
+       end = s + size - 1;
+       while (end >= s && isspace(*end))
+               end--;
+       *(end + 1) = '\0';
+
+       return s;
+}
 #ifndef __HAVE_ARCH_STRLEN
 /**
  * strlen - Find the length of a string
diff --git a/nand_spl/board/davinci/da8xxevm/Makefile b/nand_spl/board/davinci/da8xxevm/Makefile
deleted file mode 100644 (file)
index 7746e41..0000000
+++ /dev/null
@@ -1,155 +0,0 @@
-#
-# (C) Copyright 2006-2007
-# Stefan Roese, DENX Software Engineering, sr@denx.de.
-#
-# (C) Copyright 2008
-# Guennadi Liakhovetki, DENX Software Engineering, <lg@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
-#
-
-CONFIG_NAND_SPL        = y
-
-include $(TOPDIR)/config.mk
-
-nandobj        := $(OBJTREE)/nand_spl/
-
-LDSCRIPT= $(TOPDIR)/nand_spl/board/$(BOARDDIR)/u-boot.lds
-LDFLAGS := -T $(nandobj)u-boot.lds -Ttext $(CONFIG_SYS_TEXT_BASE) $(LDFLAGS) \
-          $(LDFLAGS_FINAL)
-AFLAGS += -DCONFIG_SPL_BUILD -DCONFIG_NAND_SPL
-CFLAGS += -DCONFIG_SPL_BUILD -DCONFIG_NAND_SPL
-
-SOBJS  = _divsi3.o \
-       _udivsi3.o \
-       start.o
-
-COBJS  = cpu.o \
-       davinci_nand.o \
-       pinmux.o \
-       da850_pinmux.o \
-       div0.o \
-       hawkboard_nand_spl.o \
-       misc.o \
-       nand_boot.o \
-       ns16550.o \
-       psc.o
-
-SRCS   := $(addprefix $(obj),$(SOBJS:.o=.S) $(COBJS:.o=.c))
-OBJS   := $(addprefix $(obj),$(SOBJS) $(COBJS))
-__OBJS := $(SOBJS) $(COBJS)
-LNDIR  := $(nandobj)board/$(BOARDDIR)
-
-ALL    = $(nandobj)u-boot-spl $(nandobj)u-boot-spl.bin \
-       $(nandobj)u-boot-spl-16k.bin
-
-all:   $(ALL)
-
-$(nandobj)u-boot-spl-16k.bin: $(nandobj)u-boot-spl
-       $(OBJCOPY) ${OBJCFLAGS} --pad-to=$(PAD_TO) -O binary $< $@
-
-$(nandobj)u-boot-spl.bin:      $(nandobj)u-boot-spl
-       $(OBJCOPY) ${OBJCFLAGS} -O binary $< $@
-
-$(nandobj)u-boot-spl:  $(OBJS) $(nandobj)u-boot.lds
-       cd $(LNDIR) && $(LD) $(LDFLAGS) $(__OBJS) \
-               -Map $(nandobj)u-boot-spl.map \
-               -o $(nandobj)u-boot-spl
-
-$(nandobj)u-boot.lds: $(LDSCRIPT)
-       $(CPP) $(CPPFLAGS) $(LDPPFLAGS) -ansi -D__ASSEMBLY__ -P - <$^ >$@
-
-# create symbolic links for common files
-
-# from board directory
-$(obj)pinmux.c:
-       @rm -f $@
-       @ln -s $(TOPDIR)/arch/arm/cpu/arm926ejs/davinci/pinmux.c $@
-
-$(obj)da850_pinmux.c:
-       @rm -f $@
-       @ln -s $(TOPDIR)/arch/arm/cpu/arm926ejs/davinci/da850_pinmux.c $@
-
-# from drivers/mtd/nand directory
-$(obj)davinci_nand.c:
-       @rm -f $@
-       @ln -s $(TOPDIR)/drivers/mtd/nand/davinci_nand.c $@
-
-# from nand_spl directory
-$(obj)nand_boot.c:
-       @rm -f $@
-       @ln -s $(TOPDIR)/nand_spl/nand_boot.c $@
-
-# from drivers/serial directory
-$(obj)ns16550.c:
-       @rm -f $@
-       @ln -sf $(TOPDIR)/drivers/serial/ns16550.c $@
-
-# from cpu directory
-$(obj)start.S:
-       @rm -f $@
-       ln -s $(TOPDIR)/arch/arm/cpu/arm926ejs/start.S $@
-
-# from lib directory
-$(obj)_udivsi3.S:
-       @rm -f $@
-       ln -s $(TOPDIR)/arch/arm/lib/_udivsi3.S $@
-
-# from lib directory
-$(obj)_divsi3.S:
-       @rm -f $@
-       ln -s $(TOPDIR)/arch/arm/lib/_divsi3.S $@
-
-# from lib directory
-$(obj)div0.c:
-       @rm -f $@
-       ln -s $(TOPDIR)/arch/arm/lib/div0.c $@
-
-# from SoC directory
-$(obj)cpu.c:
-       @rm -f $@
-       @ln -s $(TOPDIR)/arch/arm/cpu/arm926ejs/davinci/cpu.c $@
-
-$(obj)misc.c:
-       @rm -f $@
-       ln -s $(TOPDIR)/arch/arm/cpu/arm926ejs/davinci/misc.c $@
-
-# from board directory
-$(obj)hawkboard_nand_spl.c:
-       @rm -f $@
-       ln -s $(TOPDIR)/board/davinci/da8xxevm/hawkboard_nand_spl.c $@
-
-$(obj)psc.c:
-       @rm -f $@
-       ln -s $(TOPDIR)/arch/arm/cpu/arm926ejs/davinci/psc.c $@
-
-#########################################################################
-
-$(obj)%.o:     $(obj)%.S
-       $(CC) $(AFLAGS) -c -o $@ $<
-
-$(obj)%.o:     $(obj)%.c
-       $(CC) $(CFLAGS) -c -o $@ $<
-
-# defines $(obj).depend target
-include $(SRCTREE)/rules.mk
-
-sinclude $(obj).depend
-
-#########################################################################
diff --git a/nand_spl/board/davinci/da8xxevm/u-boot.lds b/nand_spl/board/davinci/da8xxevm/u-boot.lds
deleted file mode 100644 (file)
index 638ffd9..0000000
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * (C) Copyright 2002
- * Gary Jennejohn, DENX Software Engineering, <garyj@denx.de>
- *
- * (C) Copyright 2008
- * Guennadi Liakhovetki, DENX Software Engineering, <lg@denx.de>
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-
-OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm")
-OUTPUT_ARCH(arm)
-ENTRY(_start)
-SECTIONS
-{
-       . = 0xc1080000;
-
-       . = ALIGN(4);
-       .text      :
-       {
-         start.o       (.text)
-         cpu.o         (.text)
-         nand_boot.o   (.text)
-
-         *(.text)
-       }
-
-       . = ALIGN(4);
-       .rodata : { *(.rodata) }
-
-       . = ALIGN(4);
-       .data : {
-               *(.data)
-       __datarel_start = .;
-               *(.data.rel)
-       __datarelrolocal_start = .;
-               *(.data.rel.ro.local)
-       __datarellocal_start = .;
-               *(.data.rel.local)
-       __datarelro_start = .;
-               *(.data.rel.ro)
-       }
-
-       . = ALIGN(4);
-       __rel_dyn_start = .;
-       __rel_dyn_end = .;
-       __dynsym_start = .;
-
-       __got_start = .;
-       . = ALIGN(4);
-       .got : { *(.got) }
-
-       __got_end = .;
-
-       _end = .;
-
-       . = ALIGN(4);
-       __bss_start = .;
-       .bss : { *(.bss) }
-       __bss_end__ = .;
-}
index 2326962b20fca42c8f432a683ae01a7b2ed3772e..bfaabd3199c68321b05994c32feacbc0c6f6ee1c 100644 (file)
 
 static int nand_ecc_pos[] = CONFIG_SYS_NAND_ECCPOS;
 
+#define ECCSTEPS       (CONFIG_SYS_NAND_PAGE_SIZE / \
+                                       CONFIG_SYS_NAND_ECCSIZE)
+#define ECCTOTAL       (ECCSTEPS * CONFIG_SYS_NAND_ECCBYTES)
+
+
 #if (CONFIG_SYS_NAND_PAGE_SIZE <= 512)
 /*
  * NAND command for small page NAND devices (512)
@@ -139,29 +144,21 @@ static int nand_is_bad_block(struct mtd_info *mtd, int block)
 static int nand_read_page(struct mtd_info *mtd, int block, int page, uchar *dst)
 {
        struct nand_chip *this = mtd->priv;
-       u_char *ecc_calc;
-       u_char *ecc_code;
-       u_char *oob_data;
+       u_char ecc_calc[ECCTOTAL];
+       u_char ecc_code[ECCTOTAL];
+       u_char oob_data[CONFIG_SYS_NAND_OOBSIZE];
        int i;
        int eccsize = CONFIG_SYS_NAND_ECCSIZE;
        int eccbytes = CONFIG_SYS_NAND_ECCBYTES;
-       int eccsteps = CONFIG_SYS_NAND_ECCSTEPS;
+       int eccsteps = ECCSTEPS;
        uint8_t *p = dst;
 
-       /*
-        * No malloc available for now, just use some temporary locations
-        * in SDRAM
-        */
-       ecc_calc = (u_char *)(CONFIG_SYS_SDRAM_BASE + 0x10000);
-       ecc_code = ecc_calc + 0x100;
-       oob_data = ecc_calc + 0x200;
-
        nand_command(mtd, block, page, 0, NAND_CMD_READOOB);
        this->read_buf(mtd, oob_data, CONFIG_SYS_NAND_OOBSIZE);
        nand_command(mtd, block, page, 0, NAND_CMD_READ0);
 
        /* Pick the ECC bytes out of the oob data */
-       for (i = 0; i < CONFIG_SYS_NAND_ECCTOTAL; i++)
+       for (i = 0; i < ECCTOTAL; i++)
                ecc_code[i] = oob_data[nand_ecc_pos[i]];
 
 
@@ -178,24 +175,17 @@ static int nand_read_page(struct mtd_info *mtd, int block, int page, uchar *dst)
 static int nand_read_page(struct mtd_info *mtd, int block, int page, uchar *dst)
 {
        struct nand_chip *this = mtd->priv;
-       u_char *ecc_calc;
-       u_char *ecc_code;
-       u_char *oob_data;
+       u_char ecc_calc[ECCTOTAL];
+       u_char ecc_code[ECCTOTAL];
+       u_char oob_data[CONFIG_SYS_NAND_OOBSIZE];
        int i;
        int eccsize = CONFIG_SYS_NAND_ECCSIZE;
        int eccbytes = CONFIG_SYS_NAND_ECCBYTES;
-       int eccsteps = CONFIG_SYS_NAND_ECCSTEPS;
+       int eccsteps = ECCSTEPS;
        uint8_t *p = dst;
 
        nand_command(mtd, block, page, 0, NAND_CMD_READ0);
 
-       /* No malloc available for now, just use some temporary locations
-        * in SDRAM
-        */
-       ecc_calc = (u_char *)(CONFIG_SYS_SDRAM_BASE + 0x10000);
-       ecc_code = ecc_calc + 0x100;
-       oob_data = ecc_calc + 0x200;
-
        for (i = 0; eccsteps; eccsteps--, i += eccbytes, p += eccsize) {
                this->ecc.hwctl(mtd, NAND_ECC_READ);
                this->read_buf(mtd, p, eccsize);
@@ -204,10 +194,10 @@ static int nand_read_page(struct mtd_info *mtd, int block, int page, uchar *dst)
        this->read_buf(mtd, oob_data, CONFIG_SYS_NAND_OOBSIZE);
 
        /* Pick the ECC bytes out of the oob data */
-       for (i = 0; i < CONFIG_SYS_NAND_ECCTOTAL; i++)
+       for (i = 0; i < ECCTOTAL; i++)
                ecc_code[i] = oob_data[nand_ecc_pos[i]];
 
-       eccsteps = CONFIG_SYS_NAND_ECCSTEPS;
+       eccsteps = ECCSTEPS;
        p = dst;
 
        for (i = 0 ; eccsteps; eccsteps--, i += eccbytes, p += eccsize) {
index d62f10aa539eb0f3ce49b207aa0059f076892fc3..8705b12f03833405643d72d70e6ee4204627c1b8 100644 (file)
@@ -495,7 +495,8 @@ void post_reloc(void)
  */
 unsigned long post_time_ms(unsigned long base)
 {
-#if defined(CONFIG_PPC) || defined(CONFIG_ARM) && !defined(CONFIG_KIRKWOOD)
+#if defined(CONFIG_PPC) || defined(CONFIG_BLACKFIN) || \
+    (defined(CONFIG_ARM) && !defined(CONFIG_KIRKWOOD))
        return (unsigned long)lldiv(get_ticks(), get_tbclk() / CONFIG_SYS_HZ)
                - base;
 #else
index 64bcc4db4727c17471c39769f2de967d5da9f751..8993fdd7b2d40363ecffffb53316605dc688a669 100644 (file)
@@ -68,6 +68,7 @@ BIN_FILES-$(CONFIG_CMD_LOADS) += img2srec$(SFX)
 BIN_FILES-$(CONFIG_XWAY_SWAP_BYTES) += xway-swap-bytes$(SFX)
 BIN_FILES-y += mkenvimage$(SFX)
 BIN_FILES-y += mkimage$(SFX)
+BIN_FILES-$(CONFIG_SMDK5250) += mksmdk5250spl$(SFX)
 BIN_FILES-$(CONFIG_MX28) += mxsboot$(SFX)
 BIN_FILES-$(CONFIG_NETCONSOLE) += ncb$(SFX)
 BIN_FILES-$(CONFIG_SHA1_CHECK_UB_IMG) += ubsha1$(SFX)
@@ -94,6 +95,7 @@ NOPED_OBJ_FILES-y += imximage.o
 NOPED_OBJ_FILES-y += omapimage.o
 NOPED_OBJ_FILES-y += mkenvimage.o
 NOPED_OBJ_FILES-y += mkimage.o
+OBJ_FILES-$(CONFIG_SMDK5250) += mkexynosspl.o
 OBJ_FILES-$(CONFIG_MX28) += mxsboot.o
 OBJ_FILES-$(CONFIG_NETCONSOLE) += ncb.o
 NOPED_OBJ_FILES-y += os_support.o
@@ -213,6 +215,10 @@ $(obj)mkimage$(SFX):       $(obj)aisimage.o \
        $(HOSTCC) $(HOSTCFLAGS) $(HOSTLDFLAGS) -o $@ $^
        $(HOSTSTRIP) $@
 
+$(obj)mk$(BOARD)spl$(SFX):     $(obj)mkexynosspl.o
+       $(HOSTCC) $(HOSTCFLAGS) $(HOSTLDFLAGS) -o $@ $^
+       $(HOSTSTRIP) $@
+
 $(obj)mpc86x_clk$(SFX):        $(obj)mpc86x_clk.o
        $(HOSTCC) $(HOSTCFLAGS) $(HOSTLDFLAGS) -o $@ $^
        $(HOSTSTRIP) $@
index 2dcb373b62f95be3b49238b5fe98b030b92819c5..ad3244664a0d94d179dcc6e8c9f36a282aba3d0f 100644 (file)
@@ -22,8 +22,8 @@
  */
 
 /*
- * To build the utility with the run-time configuration
- * uncomment the next line.
+ * To build the utility with the static configuration
+ * comment out the next line.
  * See included "fw_env.config" sample file
  * for notes on configuration.
  */
index 8e81bdb9c4624ef4028367967e533a9c33c70199..1e0f5d4e55eb10f78acbcf9fa4ef177851b7a2a8 100644 (file)
@@ -47,10 +47,12 @@ static table_entry_t imximage_cmds[] = {
  * this is needed to set the correct flash offset
  */
 static table_entry_t imximage_bootops[] = {
-       {FLASH_OFFSET_SPI,      "spi",          "SPI Flash",    },
+       {FLASH_OFFSET_ONENAND,  "onenand",      "OneNAND Flash",},
        {FLASH_OFFSET_NAND,     "nand",         "NAND Flash",   },
+       {FLASH_OFFSET_NOR,      "nor",          "NOR Flash",    },
+       {FLASH_OFFSET_SATA,     "sata",         "SATA Disk",    },
        {FLASH_OFFSET_SD,       "sd",           "SD Card",      },
-       {FLASH_OFFSET_ONENAND,  "onenand",      "OneNAND Flash",},
+       {FLASH_OFFSET_SPI,      "spi",          "SPI Flash",    },
        {-1,                    "",             "Invalid",      },
 };
 
@@ -59,7 +61,7 @@ static table_entry_t imximage_bootops[] = {
  */
 static table_entry_t imximage_versions[] = {
        {IMXIMAGE_V1,   "",     " (i.MX25/35/51 compatible)", },
-       {IMXIMAGE_V2,   "",     " (i.MX53 compatible)",       },
+       {IMXIMAGE_V2,   "",     " (i.MX53/6 compatible)",     },
        {-1,            "",     " (Invalid)",                 },
 };
 
index d126a46a73c032766e53d24f787db64118e72921..d784a8d2ec1e5a30ec6600e87d7716ec0d3373ea 100644 (file)
@@ -37,6 +37,8 @@
 #define FLASH_OFFSET_SD                FLASH_OFFSET_STANDARD
 #define FLASH_OFFSET_SPI       FLASH_OFFSET_STANDARD
 #define FLASH_OFFSET_ONENAND   0x100
+#define FLASH_OFFSET_NOR       0x1000
+#define FLASH_OFFSET_SATA      FLASH_OFFSET_STANDARD
 
 #define IVT_HEADER_TAG 0xD1
 #define IVT_VERSION 0x40
diff --git a/tools/mkexynosspl.c b/tools/mkexynosspl.c
new file mode 100644 (file)
index 0000000..6a8dd93
--- /dev/null
@@ -0,0 +1,122 @@
+/*
+ * Copyright (C) 2012 Samsung Electronics
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public 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 <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <errno.h>
+#include <string.h>
+#include <sys/stat.h>
+#include <compiler.h>
+
+#define CHECKSUM_OFFSET                (14*1024-4)
+#define BUFSIZE                        (14*1024)
+#define FILE_PERM              (S_IRUSR | S_IWUSR | S_IRGRP \
+                               | S_IWGRP | S_IROTH | S_IWOTH)
+/*
+* Requirement:
+* IROM code reads first 14K bytes from boot device.
+* It then calculates the checksum of 14K-4 bytes and compare with data at
+* 14K-4 offset.
+*
+* This function takes two filenames:
+* IN  "u-boot-spl.bin" and
+* OUT "$(BOARD)-spl.bin as filenames.
+* It reads the "u-boot-spl.bin" in 16K buffer.
+* It calculates checksum of 14K-4 Bytes and stores at 14K-4 offset in buffer.
+* It writes the buffer to "$(BOARD)-spl.bin" file.
+*/
+
+int main(int argc, char **argv)
+{
+       unsigned char buffer[BUFSIZE];
+       int i, ifd, ofd;
+       uint32_t checksum = 0;
+       off_t   len;
+       ssize_t count;
+       struct stat stat;
+
+       if (argc != 3) {
+               fprintf(stderr, "Usage: %s <infile> <outfile>\n", argv[0]);
+               exit(EXIT_FAILURE);
+       }
+
+       ifd = open(argv[1], O_RDONLY);
+       if (ifd < 0) {
+               fprintf(stderr, "%s: Can't open %s: %s\n",
+                       argv[0], argv[1], strerror(errno));
+               exit(EXIT_FAILURE);
+       }
+
+       ofd = open(argv[2], O_WRONLY | O_CREAT | O_TRUNC, FILE_PERM);
+       if (ifd < 0) {
+               fprintf(stderr, "%s: Can't open %s: %s\n",
+                       argv[0], argv[2], strerror(errno));
+               close(ifd);
+               exit(EXIT_FAILURE);
+       }
+
+       if (fstat(ifd, &stat)) {
+               fprintf(stderr, "%s: Unable to get size of %s: %s\n",
+                       argv[0], argv[1], strerror(errno));
+               close(ifd);
+               close(ofd);
+               exit(EXIT_FAILURE);
+       }
+
+       len = stat.st_size;
+
+       count = (len < CHECKSUM_OFFSET) ? len : CHECKSUM_OFFSET;
+
+       if (read(ifd, buffer, count) != count) {
+               fprintf(stderr, "%s: Can't read %s: %s\n",
+                       argv[0], argv[1], strerror(errno));
+
+               close(ifd);
+               close(ofd);
+
+               exit(EXIT_FAILURE);
+       }
+
+       for (i = 0, checksum = 0; i < CHECKSUM_OFFSET; i++)
+               checksum += buffer[i];
+
+       checksum = cpu_to_le32(checksum);
+
+       memcpy(&buffer[CHECKSUM_OFFSET], &checksum, sizeof(checksum));
+
+       if (write(ofd, buffer, BUFSIZE) != BUFSIZE) {
+               fprintf(stderr, "%s: Can't write %s: %s\n",
+                       argv[0], argv[2], strerror(errno));
+
+               close(ifd);
+               close(ofd);
+
+               exit(EXIT_FAILURE);
+       }
+
+       close(ifd);
+       close(ofd);
+
+       return EXIT_SUCCESS;
+}