]> git.sur5r.net Git - u-boot/commitdiff
Merge remote-tracking branch 'mpc83xx/next'
authorKim Phillips <kim.phillips@freescale.com>
Thu, 17 Jan 2013 00:34:09 +0000 (18:34 -0600)
committerKim Phillips <kim.phillips@freescale.com>
Thu, 17 Jan 2013 00:34:09 +0000 (18:34 -0600)
371 files changed:
MAINTAINERS
Makefile
README
arch/arm/cpu/arm1136/config.mk
arch/arm/cpu/arm1136/cpu.c
arch/arm/cpu/arm1136/mx31/timer.c
arch/arm/cpu/arm1136/mx35/Makefile
arch/arm/cpu/arm1136/mx35/generic.c
arch/arm/cpu/arm1136/mx35/mx35_sdram.c [new file with mode: 0644]
arch/arm/cpu/arm1136/start.S
arch/arm/cpu/arm1136/u-boot-spl.lds [new file with mode: 0644]
arch/arm/cpu/arm1176/s3c64xx/Makefile
arch/arm/cpu/arm1176/s3c64xx/init.c [new file with mode: 0644]
arch/arm/cpu/arm1176/start.S
arch/arm/cpu/arm720t/start.S
arch/arm/cpu/arm920t/start.S
arch/arm/cpu/arm925t/start.S
arch/arm/cpu/arm926ejs/at91/at91sam9x5_devices.c
arch/arm/cpu/arm926ejs/davinci/reset.c
arch/arm/cpu/arm926ejs/kirkwood/mpp.c
arch/arm/cpu/arm926ejs/mxs/spl_boot.c
arch/arm/cpu/arm926ejs/mxs/spl_mem_init.c
arch/arm/cpu/arm926ejs/mxs/spl_power_init.c
arch/arm/cpu/arm926ejs/start.S
arch/arm/cpu/arm946es/start.S
arch/arm/cpu/arm_intcm/start.S
arch/arm/cpu/armv7/am33xx/Makefile
arch/arm/cpu/armv7/am33xx/board.c
arch/arm/cpu/armv7/am33xx/clock.c
arch/arm/cpu/armv7/am33xx/elm.c [new file with mode: 0644]
arch/arm/cpu/armv7/am33xx/mem.c [new file with mode: 0644]
arch/arm/cpu/armv7/cache_v7.c
arch/arm/cpu/armv7/exynos/clock.c
arch/arm/cpu/armv7/exynos/pinmux.c
arch/arm/cpu/armv7/mx5/clock.c
arch/arm/cpu/armv7/mx5/lowlevel_init.S
arch/arm/cpu/armv7/mx6/clock.c
arch/arm/cpu/armv7/mx6/lowlevel_init.S
arch/arm/cpu/armv7/mx6/soc.c
arch/arm/cpu/armv7/omap-common/Makefile
arch/arm/cpu/armv7/omap-common/boot-common.c
arch/arm/cpu/armv7/omap-common/emif-common.c
arch/arm/cpu/armv7/omap3/board.c
arch/arm/cpu/armv7/omap3/mem.c
arch/arm/cpu/armv7/omap3/sdrc.c
arch/arm/cpu/armv7/omap4/clocks.c
arch/arm/cpu/armv7/omap4/hwinit.c
arch/arm/cpu/armv7/s5p-common/Makefile
arch/arm/cpu/armv7/s5p-common/wdt.c [deleted file]
arch/arm/cpu/armv7/start.S
arch/arm/cpu/armv7/tegra20/Makefile
arch/arm/cpu/armv7/tegra20/display.c [new file with mode: 0644]
arch/arm/cpu/armv7/tegra20/pwm.c [new file with mode: 0644]
arch/arm/cpu/ixp/start.S
arch/arm/cpu/pxa/start.S
arch/arm/cpu/s3c44b0/start.S
arch/arm/cpu/sa1100/start.S
arch/arm/cpu/tegra20-common/funcmux.c
arch/arm/cpu/tegra20-common/pinmux.c
arch/arm/dts/exynos5250.dtsi [new file with mode: 0644]
arch/arm/dts/tegra20.dtsi
arch/arm/imx-common/cpu.c
arch/arm/include/asm/arch-am33xx/cpu.h
arch/arm/include/asm/arch-am33xx/elm.h [new file with mode: 0644]
arch/arm/include/asm/arch-am33xx/hardware.h
arch/arm/include/asm/arch-am33xx/mem.h [new file with mode: 0644]
arch/arm/include/asm/arch-am33xx/omap_gpmc.h [new file with mode: 0644]
arch/arm/include/asm/arch-am33xx/sys_proto.h
arch/arm/include/asm/arch-at91/at91sam9x5.h
arch/arm/include/asm/arch-exynos/clk.h
arch/arm/include/asm/arch-exynos/clock.h
arch/arm/include/asm/arch-exynos/cpu.h
arch/arm/include/asm/arch-exynos/dp_info.h
arch/arm/include/asm/arch-exynos/gpio.h
arch/arm/include/asm/arch-exynos/i2s-regs.h [new file with mode: 0644]
arch/arm/include/asm/arch-exynos/mipi_dsim.h
arch/arm/include/asm/arch-exynos/periph.h
arch/arm/include/asm/arch-exynos/pinmux.h
arch/arm/include/asm/arch-exynos/sound.h [new file with mode: 0644]
arch/arm/include/asm/arch-exynos/spi.h [new file with mode: 0644]
arch/arm/include/asm/arch-exynos/sromc.h
arch/arm/include/asm/arch-kirkwood/cpu.h
arch/arm/include/asm/arch-kirkwood/mpp.h
arch/arm/include/asm/arch-mx25/imx-regs.h
arch/arm/include/asm/arch-mx25/sys_proto.h
arch/arm/include/asm/arch-mx31/clock.h
arch/arm/include/asm/arch-mx31/imx-regs.h
arch/arm/include/asm/arch-mx35/imx-regs.h
arch/arm/include/asm/arch-mx35/mmc_host_def.h [new file with mode: 0644]
arch/arm/include/asm/arch-mx35/spl.h [new file with mode: 0644]
arch/arm/include/asm/arch-mx35/sys_proto.h
arch/arm/include/asm/arch-mx5/imx-regs.h
arch/arm/include/asm/arch-mx5/mx5x_pins.h
arch/arm/include/asm/arch-mx5/sys_proto.h
arch/arm/include/asm/arch-mx6/imx-regs.h
arch/arm/include/asm/arch-mx6/mx6dl_pins.h [new file with mode: 0644]
arch/arm/include/asm/arch-mx6/sys_proto.h
arch/arm/include/asm/arch-mxs/imx-regs.h
arch/arm/include/asm/arch-mxs/regs-clkctrl-mx28.h
arch/arm/include/asm/arch-mxs/regs-power-mx28.h [new file with mode: 0644]
arch/arm/include/asm/arch-mxs/regs-power.h [deleted file]
arch/arm/include/asm/arch-omap3/sys_proto.h
arch/arm/include/asm/arch-s5pc1xx/gpio.h
arch/arm/include/asm/arch-tegra20/dc.h [new file with mode: 0644]
arch/arm/include/asm/arch-tegra20/display.h [new file with mode: 0644]
arch/arm/include/asm/arch-tegra20/pinmux.h
arch/arm/include/asm/arch-tegra20/pwm.h [new file with mode: 0644]
arch/arm/include/asm/global_data.h
arch/arm/include/asm/omap_gpio.h
arch/arm/include/asm/system.h
arch/arm/lib/Makefile
arch/arm/lib/board.c
arch/arm/lib/cache-cp15.c
arch/arm/lib/crt0.S [new file with mode: 0644]
arch/m68k/lib/board.c
arch/sh/include/asm/cpu_sh4.h
arch/sh/include/asm/cpu_sh7752.h [new file with mode: 0644]
board/LaCie/net2big_v2/net2big_v2.c
board/LaCie/netspace_v2/netspace_v2.c
board/LaCie/wireless_space/Makefile [new file with mode: 0644]
board/LaCie/wireless_space/kwbimage.cfg [new file with mode: 0644]
board/LaCie/wireless_space/wireless_space.c [new file with mode: 0644]
board/Marvell/dreamplug/dreamplug.c
board/Marvell/guruplug/guruplug.c
board/Marvell/mv88f6281gtw_ge/mv88f6281gtw_ge.c
board/Marvell/openrd/openrd.c
board/Marvell/rd6281a/rd6281a.c
board/Marvell/sheevaplug/sheevaplug.c
board/Seagate/dockstar/dockstar.c
board/atmel/at91sam9x5ek/at91sam9x5ek.c
board/buffalo/lsxl/lsxl.c
board/cloudengines/pogo_e02/pogo_e02.c
board/cm_t35/cm_t35.c
board/compal/paz00/paz00.c
board/compulab/dts/tegra20-trimslice.dts
board/compulab/trimslice/trimslice.c
board/corscience/tricorder/tricorder.c
board/d-link/dns325/dns325.c
board/davedenx/qong/qong.c
board/freescale/mx25pdk/mx25pdk.c
board/freescale/mx31ads/u-boot.lds
board/freescale/mx31pdk/mx31pdk.c
board/freescale/mx35pdk/lowlevel_init.S
board/freescale/mx35pdk/mx35pdk.c
board/freescale/mx51evk/mx51evk.c
board/freescale/mx51evk/mx51evk_video.c
board/freescale/mx53loco/mx53loco.c
board/freescale/mx53loco/mx53loco_video.c
board/freescale/mx6qsabresd/mx6qsabresd.c
board/h2200/h2200.c
board/hale/tt01/tt01.c
board/iomega/iconnect/iconnect.c
board/isee/igep0020/igep0020.c
board/isee/igep0030/igep0030.c
board/karo/tk71/tk71.c
board/keymile/common/common.c
board/keymile/km_arm/km_arm.c
board/keymile/km_arm/kwbimage-memphis.cfg
board/keymile/km_arm/kwbimage.cfg
board/keymile/km_arm/kwbimage_128M16_1.cfg
board/keymile/km_arm/kwbimage_256M8_1.cfg
board/nvidia/common/board.c
board/nvidia/dts/tegra20-seaboard.dts
board/nvidia/harmony/harmony.c
board/nvidia/seaboard/seaboard.c
board/overo/overo.c
board/raidsonic/ib62x0/ib62x0.c
board/renesas/sh7752evb/Makefile [new file with mode: 0644]
board/renesas/sh7752evb/lowlevel_init.S [new file with mode: 0644]
board/renesas/sh7752evb/sh7752evb.c [new file with mode: 0644]
board/renesas/sh7752evb/spi-boot.c [new file with mode: 0644]
board/renesas/sh7752evb/u-boot.lds [new file with mode: 0644]
board/samsung/dts/exynos5250-smdk5250.dts [new file with mode: 0644]
board/samsung/smdk5250/Makefile
board/samsung/smdk5250/mmc_boot.c [deleted file]
board/samsung/smdk5250/smdk5250.c
board/samsung/smdk5250/spl_boot.c [new file with mode: 0644]
board/samsung/trats/trats.c
board/samsung/universal_c210/Makefile
board/samsung/universal_c210/lowlevel_init.S [deleted file]
board/samsung/universal_c210/universal.c
board/syteco/zmx25/zmx25.c
board/technexion/twister/twister.c
board/teejet/mt_ventoux/mt_ventoux.c
board/ti/am335x/board.c
board/ti/am335x/mux.c
board/ti/beagle/beagle.c
board/ti/evm/evm.c
board/timll/devkit8000/devkit8000.c
board/woodburn/Makefile [new file with mode: 0644]
board/woodburn/imximage.cfg [new file with mode: 0644]
board/woodburn/lowlevel_init.S [new file with mode: 0644]
board/woodburn/woodburn.c [new file with mode: 0644]
boards.cfg
common/Makefile
common/cmd_bootm.c
common/cmd_mem.c
common/cmd_setexpr.c
common/cmd_sf.c
common/cmd_sound.c [new file with mode: 0644]
common/cmd_version.c
common/lcd.c
common/main.c
common/usb.c
common/usb_hub.c
common/usb_storage.c
doc/README.imx5
doc/README.sh7752evb [new file with mode: 0644]
doc/README.usb
doc/README.watchdog [new file with mode: 0644]
doc/device-tree-bindings/exynos/isp-spi.txt [new file with mode: 0644]
doc/device-tree-bindings/exynos/sound.txt [new file with mode: 0644]
doc/device-tree-bindings/pwm/tegra20-pwm.txt [new file with mode: 0644]
doc/device-tree-bindings/video/displaymode.txt [new file with mode: 0644]
doc/device-tree-bindings/video/tegra20-dc.txt [new file with mode: 0644]
drivers/gpio/mxc_gpio.c
drivers/gpio/omap_gpio.c
drivers/gpio/s5p_gpio.c
drivers/i2c/omap24xx_i2c.c
drivers/i2c/s3c24x0_i2c.c
drivers/i2c/s3c24x0_i2c.h
drivers/input/tegra-kbc.c
drivers/mmc/fsl_esdhc.c
drivers/mmc/tegra_mmc.c
drivers/mtd/cfi_flash.c
drivers/mtd/nand/Makefile
drivers/mtd/nand/am335x_spl_bch.c [new file with mode: 0644]
drivers/mtd/nand/fsl_ifc_nand.c
drivers/mtd/nand/mxs_nand.c
drivers/mtd/nand/omap_gpmc.c
drivers/net/cpsw.c
drivers/net/e1000.c
drivers/net/e1000.h
drivers/net/phy/marvell.c
drivers/net/phy/mv88e61xx.c
drivers/net/phy/mv88e61xx.h
drivers/net/sh_eth.c
drivers/net/sh_eth.h
drivers/power/pmic/Makefile
drivers/power/pmic/pmic_max77686.c [new file with mode: 0644]
drivers/power/power_fsl.c
drivers/power/twl4030.c
drivers/power/twl6035.c
drivers/serial/ns16550.c
drivers/serial/s3c64xx.c
drivers/serial/serial_sh.h
drivers/sound/Makefile [new file with mode: 0644]
drivers/sound/samsung-i2s.c [new file with mode: 0644]
drivers/sound/sound.c [new file with mode: 0644]
drivers/sound/wm8994.c [new file with mode: 0644]
drivers/sound/wm8994.h [new file with mode: 0644]
drivers/sound/wm8994_registers.h [new file with mode: 0644]
drivers/spi/Makefile
drivers/spi/atmel_spi.c
drivers/spi/exynos_spi.c [new file with mode: 0644]
drivers/spi/kirkwood_spi.c
drivers/spi/mxc_spi.c
drivers/spi/omap3_spi.c
drivers/spi/omap3_spi.h
drivers/usb/gadget/g_dnl.c
drivers/usb/gadget/pxa25x_udc.c
drivers/usb/host/ehci-exynos.c
drivers/usb/host/ehci-mx5.c
drivers/usb/host/ehci-mx6.c
drivers/usb/host/ehci-mxc.c
drivers/usb/host/ohci-at91.c
drivers/video/Makefile
drivers/video/exynos_dp.c
drivers/video/exynos_fb.c
drivers/video/exynos_fimd.c
drivers/video/ipu_regs.h
drivers/video/ld9040.c [new file with mode: 0644]
drivers/video/tegra.c [new file with mode: 0644]
drivers/watchdog/Makefile
drivers/watchdog/imx_watchdog.c [new file with mode: 0644]
drivers/watchdog/s5p_wdt.c [new file with mode: 0644]
include/common.h
include/config_cmd_all.h
include/configs/CRAYL1.h
include/configs/GEN860T.h
include/configs/TOP860.h
include/configs/am335x_evm.h
include/configs/at91sam9x5ek.h
include/configs/cm_t35.h
include/configs/coreboot.h
include/configs/dig297.h
include/configs/eb_cpu5282.h
include/configs/ep8260.h
include/configs/exynos5250-dt.h [new file with mode: 0644]
include/configs/h2200.h
include/configs/harmony.h
include/configs/igep00x0.h
include/configs/km/keymile-common.h
include/configs/lsxl.h
include/configs/m28evk.h
include/configs/mcx.h
include/configs/mv-common.h
include/configs/mx25pdk.h
include/configs/mx28evk.h
include/configs/mx31pdk.h
include/configs/mx35pdk.h
include/configs/mx51_efikamx.h
include/configs/mx51evk.h
include/configs/mx53evk.h
include/configs/mx53loco.h
include/configs/mx6qarm2.h
include/configs/mx6qsabre_common.h
include/configs/mx6qsabreauto.h
include/configs/mx6qsabrelite.h
include/configs/mx6qsabresd.h
include/configs/omap3_beagle.h
include/configs/omap3_mvblx.h
include/configs/omap3_pandora.h
include/configs/omap3_sdp3430.h
include/configs/omap3_zoom1.h
include/configs/omap3_zoom2.h
include/configs/palmld.h
include/configs/palmtc.h
include/configs/paz00.h
include/configs/qong.h
include/configs/s5pc210_universal.h
include/configs/seaboard.h
include/configs/sh7752evb.h [new file with mode: 0644]
include/configs/smdk5250.h
include/configs/socfpga_cyclone5.h
include/configs/tam3517-common.h
include/configs/tec.h
include/configs/tegra-common-post.h
include/configs/tegra20-common.h
include/configs/trats.h
include/configs/tricorder.h
include/configs/trimslice.h
include/configs/utx8245.h
include/configs/ventana.h
include/configs/vision2.h
include/configs/whistler.h
include/configs/wireless_space.h [new file with mode: 0644]
include/configs/woodburn.h [new file with mode: 0644]
include/configs/woodburn_common.h [new file with mode: 0644]
include/configs/woodburn_sd.h [new file with mode: 0644]
include/configs/zipitz2.h
include/configs/zmx25.h
include/env_callback.h
include/fdtdec.h
include/flash.h
include/i2c.h
include/i2s.h [new file with mode: 0644]
include/image.h
include/lcd.h
include/ld9040.h [new file with mode: 0644]
include/mc34704.h [new file with mode: 0644]
include/netdev.h
include/power/max77686_pmic.h [new file with mode: 0644]
include/power/max8998_pmic.h
include/sound.h [new file with mode: 0644]
include/twl4030.h
include/twl6035.h
include/usb.h
include/usb/ehci-fsl.h
include/watchdog.h
lib/asm-offsets.c
lib/fdtdec.c
nand_spl/board/freescale/mx31pdk/Makefile
nand_spl/board/freescale/mx31pdk/u-boot.lds
nand_spl/board/karo/tx25/Makefile
net/link_local.c
net/tftp.c
spl/Makefile
tools/env/fw_env.c
tools/env/fw_env_main.c
tools/imximage.c

index b24ba19b76490bb2a4e5e35f5b552d790fd9e49c..28c052d7a0e32500a400876c6af473f26c9eaa55 100644 (file)
@@ -586,6 +586,7 @@ Stefano Babic <sbabic@denx.de>
        trizepsiv       xscale/pxa
        twister         omap3
        vision2         i.MX51
+       woodburn        i.MX35
 
 Lukasz Dalek <luk0104@gmail.com>
 
@@ -1202,6 +1203,7 @@ Mark Jonas <mark.jonas@de.bosch.com>
 Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
 
        MS7720SE        SH7720
+       R0P77520000RZ   SH7752
        R0P77570030RL   SH7757
        R0P77850011RL   SH7785
 
index 7e16da94d9a3b4eeefaf0d6b40f1e32c25e91d34..51bd918475c513c29b282ef8a434946ebeacde70 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -24,7 +24,7 @@
 VERSION = 2013
 PATCHLEVEL = 01
 SUBLEVEL =
-EXTRAVERSION = -rc2
+EXTRAVERSION =
 ifneq "$(SUBLEVEL)" ""
 U_BOOT_VERSION = $(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)
 else
@@ -316,6 +316,7 @@ LIBS-y += arch/powerpc/cpu/mpc8xxx/lib8xxx.o
 endif
 LIBS-y += drivers/rtc/librtc.o
 LIBS-y += drivers/serial/libserial.o
+LIBS-y += drivers/sound/libsound.o
 LIBS-$(CONFIG_GENERIC_LPC_TPM) += drivers/tpm/libtpm.o
 LIBS-y += drivers/twserial/libtws.o
 LIBS-y += drivers/usb/eth/libusb_eth.o
@@ -514,7 +515,7 @@ $(obj)u-boot.ais:       $(obj)spl/u-boot-spl.bin $(obj)u-boot.img
 ELFTOSB_TARGET-$(CONFIG_MX28) = imx28
 
 $(obj)u-boot.sb:       $(obj)u-boot.bin $(obj)spl/u-boot-spl.bin
-               elftosb -zdf $(ELFTOSB_TARGET-y) -c $(TOPDIR)/$(CPUDIR)/$(SOC)/u-boot-$(ELFTOSB_TARGET-y).bd \
+               elftosb -zf $(ELFTOSB_TARGET-y) -c $(TOPDIR)/$(CPUDIR)/$(SOC)/u-boot-$(ELFTOSB_TARGET-y).bd \
                        -o $(obj)u-boot.sb
 
 # On x600 (SPEAr600) U-Boot is appended to U-Boot SPL.
@@ -872,7 +873,8 @@ clobber:    tidy
        @rm -f $(obj)nand_spl/{u-boot-nand_spl.lds,u-boot-spl,u-boot-spl.map}
        @rm -f $(obj)spl/{u-boot-spl,u-boot-spl.bin,u-boot-spl.map}
        @rm -f $(obj)spl/{u-boot-spl.lds,u-boot.lst}
-       @rm -f $(obj)MLO
+       @rm -f $(obj)MLO MLO.byteswap
+       @rm -f $(obj)SPL
        @rm -f $(obj)tools/xway-swap-bytes
        @rm -f $(obj)arch/powerpc/cpu/mpc824x/bedbug_603e.c
        @rm -f $(obj)arch/powerpc/cpu/mpc83xx/ddr-gen?.c
diff --git a/README b/README
index 264a27fe5ebf842aabb1acca205e128934e5dd82..2352e3862bfa81f4ad2bca262cc26529ac008fd7 100644 (file)
--- a/README
+++ b/README
@@ -616,6 +616,14 @@ The following options need to be configured:
                boot loader that has already initialized the UART.  Define this
                variable to flush the UART at init time.
 
+               CONFIG_SYS_NS16550_BROKEN_TEMT
+
+               16550 UART set the Transmitter Empty (TEMT) Bit when all output
+               has finished and the transmitter is totally empty. U-Boot waits
+               for this bit to be set to initialize the serial console. On some
+               broken platforms this bit is not set in SPL making U-Boot to
+               hang while waiting for TEMT. Define this option to avoid it.
+
 
 - Console Interface:
                Depending on board, define exactly one serial port
@@ -849,6 +857,7 @@ The following options need to be configured:
                CONFIG_CMD_LOADS          loads
                CONFIG_CMD_MD5SUM         print md5 message digest
                                          (requires CONFIG_CMD_MEMORY and CONFIG_MD5)
+               CONFIG_CMD_MEMINFO      * Display detailed memory information
                CONFIG_CMD_MEMORY         md, mm, nm, mw, cp, cmp, crc, base,
                                          loop, loopw, mtest
                CONFIG_CMD_MISC           Misc functions like sleep etc
@@ -1486,6 +1495,21 @@ CBFS (Coreboot Filesystem) support
                Normally display is black on white background; define
                CONFIG_SYS_WHITE_ON_BLACK to get it inverted.
 
+               CONFIG_LCD_ALIGNMENT
+
+               Normally the LCD is page-aligned (tyically 4KB). If this is
+               defined then the LCD will be aligned to this value instead.
+               For ARM it is sometimes useful to use MMU_SECTION_SIZE
+               here, since it is cheaper to change data cache settings on
+               a per-section basis.
+
+               CONFIG_CONSOLE_SCROLL_LINES
+
+               When the console need to be scrolled, this is the number of
+               lines to scroll by. It defaults to 1. Increasing this makes
+               the console jump but can help speed up operation when scrolling
+               is slow.
+
                CONFIG_LCD_BMP_RLE8
 
                Support drawing of RLE8-compressed bitmaps on the LCD.
@@ -1495,7 +1519,6 @@ CBFS (Coreboot Filesystem) support
                Enables an 'i2c edid' command which can read EDID
                information over I2C from an attached LCD display.
 
-
 - Splash Screen Support: CONFIG_SPLASH_SCREEN
 
                If this option is set, the environment is checked for
@@ -2364,6 +2387,15 @@ CBFS (Coreboot Filesystem) support
                run-time determined information about the hardware to the
                environment.  These will be named board_name, board_rev.
 
+               CONFIG_DELAY_ENVIRONMENT
+
+               Normally the environment is loaded when the board is
+               intialised so that it is available to U-Boot. This inhibits
+               that so that the environment is not available until
+               explicitly loaded later by U-Boot code. With CONFIG_OF_CONTROL
+               this is instead controlled by the value of
+               /config/load-environment.
+
 - DataFlash Support:
                CONFIG_HAS_DATAFLASH
 
@@ -2390,6 +2422,11 @@ CBFS (Coreboot Filesystem) support
                CONFIG_SF_DEFAULT_MODE          (see include/spi.h)
                CONFIG_SF_DEFAULT_SPEED         in Hz
 
+               CONFIG_CMD_SF_TEST
+
+               Define this option to include a destructive SPI flash
+               test ('sf test').
+
 - SystemACE Support:
                CONFIG_SYSTEMACE
 
@@ -2677,10 +2714,13 @@ FIT uImage format:
                CONFIG_FB_ADDR
 
                Define CONFIG_FB_ADDR if you want to use specific
-               address for frame buffer.
-               Then system will reserve the frame buffer address to
-               defined address instead of lcd_setmem (this function
-               grabs the memory for frame buffer by panel's size).
+               address for frame buffer.  This is typically the case
+               when using a graphics controller has separate video
+               memory.  U-Boot will then place the frame buffer at
+               the given address instead of dynamically reserving it
+               in system RAM by calling lcd_setmem(), which grabs
+               the memory for the frame buffer depending on the
+               configured panel size.
 
                Please see board_init_f function.
 
@@ -2985,9 +3025,6 @@ Configuration Settings:
                non page size aligned address and this could cause major
                problems.
 
-- CONFIG_SYS_TFTP_LOADADDR:
-               Default load address for network file downloads
-
 - CONFIG_SYS_LOADS_BAUD_CHANGE:
                Enable temporary baudrate change while serial download
 
@@ -3447,6 +3484,16 @@ use the "saveenv" command to store a valid environment.
                space for already greatly restricted images, including but not
                limited to NAND_SPL configurations.
 
+- CONFIG_DISPLAY_BOARDINFO
+               Display information about the board that U-Boot is running on
+               when U-Boot starts up. The board function checkboard() is called
+               to do this.
+
+- CONFIG_DISPLAY_BOARDINFO_LATE
+               Similar to the previous option, but display this information
+               later, once stdio is running and output goes to the LCD, if
+               present.
+
 Low Level (hardware related) configuration options:
 ---------------------------------------------------
 
index efee0d1dca6253f69839e1cb3be8f594a192236c..9092d914f6037283d49273688325380f902616c0 100644 (file)
@@ -31,3 +31,6 @@ PLATFORM_CPPFLAGS += -march=armv5
 # =========================================================================
 PF_RELFLAGS_SLB_AT := $(call cc-option,-mshort-load-bytes,$(call cc-option,-malignment-traps,))
 PLATFORM_RELFLAGS += $(PF_RELFLAGS_SLB_AT)
+ifdef CONFIG_SPL_BUILD
+ALL-y  += $(OBJTREE)/SPL
+endif
index b98e3d9face97006d5588901eecb152b2d799701..32a4c244c5748a231f0c33bb9509998aeba6ccb9 100644 (file)
@@ -141,16 +141,6 @@ void flush_cache(unsigned long start, unsigned long size)
        flush_dcache_range(start, start + size);
 }
 
-void enable_caches(void)
-{
-#ifndef CONFIG_SYS_ICACHE_OFF
-       icache_enable();
-#endif
-#ifndef CONFIG_SYS_DCACHE_OFF
-       dcache_enable();
-#endif
-}
-
 #else /* #ifndef CONFIG_SYS_DCACHE_OFF */
 void invalidate_dcache_all(void)
 {
@@ -172,3 +162,15 @@ void flush_cache(unsigned long start, unsigned long size)
 {
 }
 #endif /* #ifndef CONFIG_SYS_DCACHE_OFF */
+
+#if !defined(CONFIG_SYS_ICACHE_OFF) || !defined(CONFIG_SYS_DCACHE_OFF)
+void enable_caches(void)
+{
+#ifndef CONFIG_SYS_ICACHE_OFF
+       icache_enable();
+#endif
+#ifndef CONFIG_SYS_DCACHE_OFF
+       dcache_enable();
+#endif
+}
+#endif
index 36266da5aa8d68430f9a88313020055cc382d18a..86916d1edb1c603f40039b5ab3ae8da05ef0cbc1 100644 (file)
@@ -161,42 +161,3 @@ ulong get_tbclk(void)
 {
        return MXC_CLK32;
 }
-
-void reset_cpu(ulong addr)
-{
-       struct wdog_regs *wdog = (struct wdog_regs *)WDOG_BASE;
-       wdog->wcr = WDOG_ENABLE;
-       while (1)
-               ;
-}
-
-#ifdef CONFIG_HW_WATCHDOG
-void mxc_hw_watchdog_enable(void)
-{
-       struct wdog_regs *wdog = (struct wdog_regs *)WDOG_BASE;
-       u16 secs;
-
-       /*
-        * The timer watchdog can be set between
-        * 0.5 and 128 Seconds. If not defined
-        * in configuration file, sets 64 Seconds
-        */
-#ifdef CONFIG_SYS_WD_TIMER_SECS
-       secs = (CONFIG_SYS_WD_TIMER_SECS << 1) & 0xFF;
-       if (!secs) secs = 1;
-#else
-       secs = 64;
-#endif
-       setbits_le16(&wdog->wcr, (secs << WDOG_WT_SHIFT) | WDOG_ENABLE
-                                                        | WDOG_WDZST);
-}
-
-
-void mxc_hw_watchdog_reset(void)
-{
-       struct wdog_regs *wdog = (struct wdog_regs *)WDOG_BASE;
-
-       writew(0x5555, &wdog->wsr);
-       writew(0xAAAA, &wdog->wsr);
-}
-#endif
index 469397ca43058db2a2371393e92f70df9244e2dc..f4ababbe5b1f20d5a12703161bfe74a5c86ee1e5 100644 (file)
@@ -30,6 +30,7 @@ LIB   = $(obj)lib$(SOC).o
 COBJS  += generic.o
 COBJS  += timer.o
 COBJS  += iomux.o
+COBJS  += mx35_sdram.o
 
 SRCS   := $(SOBJS:.o=.S) $(COBJS:.o=.c)
 OBJS   := $(addprefix $(obj),$(SOBJS) $(COBJS))
index 41e9639d9c4cd92cfcaded97a12c5d448f75a7dd..295a98ea4b6d5fabf9de1c01fb03a4f40c668b94 100644 (file)
@@ -35,6 +35,7 @@
 #include <fsl_esdhc.h>
 #endif
 #include <netdev.h>
+#include <spl.h>
 
 #define CLK_CODE(arm, ahb, sel) (((arm) << 16) + ((ahb) << 8) + (sel))
 #define CLK_CODE_ARM(c)                (((c) >> 16) & 0xFF)
@@ -487,8 +488,76 @@ int get_clocks(void)
        return 0;
 }
 
-void reset_cpu(ulong addr)
+#define RCSR_MEM_CTL_WEIM      0
+#define RCSR_MEM_CTL_NAND      1
+#define RCSR_MEM_CTL_ATA       2
+#define RCSR_MEM_CTL_EXPANSION 3
+#define RCSR_MEM_TYPE_NOR      0
+#define RCSR_MEM_TYPE_ONENAND  2
+#define RCSR_MEM_TYPE_SD       0
+#define RCSR_MEM_TYPE_I2C      2
+#define RCSR_MEM_TYPE_SPI      3
+
+u32 spl_boot_device(void)
 {
-       struct wdog_regs *wdog = (struct wdog_regs *)WDOG_BASE_ADDR;
-       writew(4, &wdog->wcr);
+       struct ccm_regs *ccm =
+               (struct ccm_regs *)IMX_CCM_BASE;
+
+       u32 rcsr = readl(&ccm->rcsr);
+       u32 mem_type, mem_ctl;
+
+       /* In external mode, no boot device is returned */
+       if ((rcsr >> 10) & 0x03)
+               return BOOT_DEVICE_NONE;
+
+       mem_ctl = (rcsr >> 25) & 0x03;
+       mem_type = (rcsr >> 23) & 0x03;
+
+       switch (mem_ctl) {
+       case RCSR_MEM_CTL_WEIM:
+               switch (mem_type) {
+               case RCSR_MEM_TYPE_NOR:
+                       return BOOT_DEVICE_NOR;
+               case RCSR_MEM_TYPE_ONENAND:
+                       return BOOT_DEVICE_ONE_NAND;
+               default:
+                       return BOOT_DEVICE_NONE;
+               }
+       case RCSR_MEM_CTL_NAND:
+               return BOOT_DEVICE_NAND;
+       case RCSR_MEM_CTL_EXPANSION:
+               switch (mem_type) {
+               case RCSR_MEM_TYPE_SD:
+                       return BOOT_DEVICE_MMC1;
+               case RCSR_MEM_TYPE_I2C:
+                       return BOOT_DEVICE_I2C;
+               case RCSR_MEM_TYPE_SPI:
+                       return BOOT_DEVICE_SPI;
+               default:
+                       return BOOT_DEVICE_NONE;
+               }
+       }
+
+       return BOOT_DEVICE_NONE;
 }
+
+#ifdef CONFIG_SPL_BUILD
+u32 spl_boot_mode(void)
+{
+       switch (spl_boot_device()) {
+       case BOOT_DEVICE_MMC1:
+#ifdef CONFIG_SPL_FAT_SUPPORT
+               return MMCSD_MODE_FAT;
+#else
+               return MMCSD_MODE_RAW;
+#endif
+               break;
+       case BOOT_DEVICE_NAND:
+               return 0;
+               break;
+       default:
+               puts("spl: ERROR:  unsupported device\n");
+               hang();
+       }
+}
+#endif
diff --git a/arch/arm/cpu/arm1136/mx35/mx35_sdram.c b/arch/arm/cpu/arm1136/mx35/mx35_sdram.c
new file mode 100644 (file)
index 0000000..f7e682c
--- /dev/null
@@ -0,0 +1,137 @@
+/*
+ * Copyright (C) 2012, Stefano Babic <sbabic@denx.de>
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+#include <asm/io.h>
+#include <asm/errno.h>
+#include <asm/arch/imx-regs.h>
+#include <linux/types.h>
+#include <asm/arch/sys_proto.h>
+
+#define ESDCTL_DDR2_EMR2       0x04000000
+#define ESDCTL_DDR2_EMR3       0x06000000
+#define ESDCTL_PRECHARGE       0x00000400
+#define ESDCTL_DDR2_EN_DLL     0x02000400
+#define ESDCTL_DDR2_RESET_DLL  0x00000333
+#define ESDCTL_DDR2_MR         0x00000233
+#define ESDCTL_DDR2_OCD_DEFAULT 0x02000780
+
+enum {
+       SMODE_NORMAL =  0,
+       SMODE_PRECHARGE,
+       SMODE_AUTO_REFRESH,
+       SMODE_LOAD_REG,
+       SMODE_MANUAL_REFRESH
+};
+
+#define set_mode(x, en, m)     (x | (en << 31) | (m << 28))
+
+static inline void dram_wait(unsigned int count)
+{
+       volatile unsigned int wait = count;
+
+       while (wait--)
+               ;
+
+}
+
+void mx3_setup_sdram_bank(u32 start_address, u32 ddr2_config,
+       u32 row, u32 col, u32 dsize, u32 refresh)
+{
+       struct esdc_regs *esdc = (struct esdc_regs *)ESDCTL_BASE_ADDR;
+       u32 *cfg_reg, *ctl_reg;
+       u32 val;
+       u32 ctlval;
+
+       switch (start_address) {
+       case CSD0_BASE_ADDR:
+               cfg_reg = &esdc->esdcfg0;
+               ctl_reg = &esdc->esdctl0;
+               break;
+       case CSD1_BASE_ADDR:
+               cfg_reg = &esdc->esdcfg1;
+               ctl_reg = &esdc->esdctl1;
+               break;
+       default:
+               return;
+       }
+
+       /* The MX35 supports 11 up to 14 rows */
+       if (row < 11 || row > 14 || col < 8 || col > 10)
+               return;
+       ctlval = (row - 11) << 24 | (col - 8) << 20 | (dsize << 16);
+
+       /* Initialize MISC register for DDR2 */
+       val = ESDC_MISC_RST | ESDC_MISC_MDDR_EN | ESDC_MISC_MDDR_DL_RST |
+               ESDC_MISC_DDR_EN | ESDC_MISC_DDR2_EN;
+       writel(val, &esdc->esdmisc);
+       val &= ~(ESDC_MISC_RST | ESDC_MISC_MDDR_DL_RST);
+       writel(val, &esdc->esdmisc);
+
+       /*
+        * according to DDR2 specs, wait a while before
+        * the PRECHARGE_ALL command
+        */
+       dram_wait(0x20000);
+
+       /* Load DDR2 config and timing */
+       writel(ddr2_config, cfg_reg);
+
+       /* Precharge ALL */
+       writel(set_mode(ctlval, 1, SMODE_PRECHARGE),
+               ctl_reg);
+       writel(0xda, start_address + ESDCTL_PRECHARGE);
+
+       /* Load mode */
+       writel(set_mode(ctlval, 1, SMODE_LOAD_REG),
+               ctl_reg);
+       writeb(0xda, start_address + ESDCTL_DDR2_EMR2); /* EMRS2 */
+       writeb(0xda, start_address + ESDCTL_DDR2_EMR3); /* EMRS3 */
+       writeb(0xda, start_address + ESDCTL_DDR2_EN_DLL); /* Enable DLL */
+       writeb(0xda, start_address + ESDCTL_DDR2_RESET_DLL); /* Reset DLL */
+
+       /* Precharge ALL */
+       writel(set_mode(ctlval, 1, SMODE_PRECHARGE),
+               ctl_reg);
+       writel(0xda, start_address + ESDCTL_PRECHARGE);
+
+       /* Set mode auto refresh : at least two refresh are required */
+       writel(set_mode(ctlval, 1, SMODE_AUTO_REFRESH),
+               ctl_reg);
+       writel(0xda, start_address);
+       writel(0xda, start_address);
+
+       writel(set_mode(ctlval, 1, SMODE_LOAD_REG),
+               ctl_reg);
+       writeb(0xda, start_address + ESDCTL_DDR2_MR);
+       writeb(0xda, start_address + ESDCTL_DDR2_OCD_DEFAULT);
+
+       /* OCD mode exit */
+       writeb(0xda, start_address + ESDCTL_DDR2_EN_DLL); /* Enable DLL */
+
+       /* Set normal mode */
+       writel(set_mode(ctlval, 1, SMODE_NORMAL) | refresh,
+               ctl_reg);
+
+       dram_wait(0x20000);
+
+       /* Do not set delay lines, only for MDDR */
+}
index 3752af9ddd15bb91953f833a7c8698a082992de2..a067b8a1868182f33e6b9e11a980d19ae004186d 100644 (file)
@@ -100,6 +100,10 @@ _TEXT_BASE:
 _bss_start_ofs:
        .word __bss_start - _start
 
+.global        _image_copy_end_ofs
+_image_copy_end_ofs:
+       .word   __image_copy_end - _start
+
 .globl _bss_end_ofs
 _bss_end_ofs:
        .word __bss_end__ - _start
@@ -161,13 +165,7 @@ next:
        bl  cpu_init_crit
 #endif
 
-/* Set stackpointer in internal RAM to call board_init_f */
-call_board_init_f:
-       ldr     sp, =(CONFIG_SYS_INIT_SP_ADDR)
-       bic     sp, sp, #7 /* 8-byte alignment for ABI compliance */
-       ldr     r0,=0x00000000
-
-       bl      board_init_f
+       bl      _main
 
 /*------------------------------------------------------------------------------*/
 
@@ -184,16 +182,12 @@ relocate_code:
        mov     r5, r1  /* save addr of gd */
        mov     r6, r2  /* save addr of destination */
 
-       /* Set up the stack                                                 */
-stack_setup:
-       mov     sp, r4
-
        adr     r0, _start
        cmp     r0, r6
        moveq   r9, #0          /* no relocation. relocation offset(r9) = 0 */
-       beq     clear_bss               /* skip relocation */
+       beq     relocate_done           /* skip relocation */
        mov     r1, r6                  /* r1 <- scratch for copy_loop */
-       ldr     r3, _bss_start_ofs
+       ldr     r3, _image_copy_end_ofs
        add     r2, r0, r3              /* r2 <- source end address         */
 
 copy_loop:
@@ -241,50 +235,15 @@ fixnext:
        add     r2, r2, #8              /* each rel.dyn entry is 8 bytes */
        cmp     r2, r3
        blo     fixloop
+       bx      lr
+
 #endif
 
-clear_bss:
-#ifndef CONFIG_SPL_BUILD
-       ldr     r0, _bss_start_ofs
-       ldr     r1, _bss_end_ofs
-       mov     r4, r6                  /* reloc addr */
-       add     r0, r0, r4
-       add     r1, r1, r4
-       mov     r2, #0x00000000         /* clear                            */
-
-clbss_l:cmp    r0, r1                  /* clear loop... */
-       bhs     clbss_e                 /* if reached end of bss, exit */
-       str     r2, [r0]
-       add     r0, r0, #4
-       b       clbss_l
-clbss_e:
-#endif /* #ifndef CONFIG_SPL_BUILD */
+relocate_done:
 
-/*
- * We are done. Do not return, instead branch to second part of board
- * initialization, now running from RAM.
- */
-#ifdef CONFIG_NAND_SPL
-       ldr     r0, _nand_boot_ofs
-       mov     pc, r0
+       bx      lr
 
-_nand_boot_ofs:
-       .word nand_boot
-#else
-jump_2_ram:
-       ldr     r0, _board_init_r_ofs
-       ldr     r1, _TEXT_BASE
-       add     lr, r0, r1
-       add     lr, lr, r9
-       /* setup parameters for board_init_r */
-       mov     r0, r5          /* gd_t */
-       mov     r1, r6          /* dest_addr */
-       /* jump to it ... */
-       mov     pc, lr
-
-_board_init_r_ofs:
-       .word board_init_r - _start
-#endif
+#ifndef CONFIG_SPL_BUILD
 
 _rel_dyn_start_ofs:
        .word __rel_dyn_start - _start
@@ -293,6 +252,13 @@ _rel_dyn_end_ofs:
 _dynsym_start_ofs:
        .word __dynsym_start - _start
 
+#endif
+
+       .globl  c_runtime_cpu_setup
+c_runtime_cpu_setup:
+
+       bx      lr
+
 /*
  *************************************************************************
  *
diff --git a/arch/arm/cpu/arm1136/u-boot-spl.lds b/arch/arm/cpu/arm1136/u-boot-spl.lds
new file mode 100644 (file)
index 0000000..a0462ab
--- /dev/null
@@ -0,0 +1,62 @@
+/*
+ * (C) Copyright 2002
+ * Gary Jennejohn, DENX Software Engineering, <garyj@denx.de>
+ *
+ * (C) Copyright 2010
+ * Texas Instruments, <www.ti.com>
+ *     Aneesh V <aneesh@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
+ */
+
+MEMORY { .sram : ORIGIN = CONFIG_SPL_TEXT_BASE,\
+               LENGTH = CONFIG_SPL_MAX_SIZE }
+MEMORY { .sdram : ORIGIN = CONFIG_SPL_BSS_START_ADDR, \
+               LENGTH = CONFIG_SPL_BSS_MAX_SIZE }
+
+OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm")
+OUTPUT_ARCH(arm)
+ENTRY(_start)
+SECTIONS
+{
+       .text      :
+       {
+       __start = .;
+         arch/arm/cpu/arm1136/start.o  (.text)
+         *(.text*)
+       } >.sram
+
+       . = ALIGN(4);
+       .rodata : { *(SORT_BY_ALIGNMENT(.rodata*)) } >.sram
+
+       . = ALIGN(4);
+       .data : { *(SORT_BY_ALIGNMENT(.data*)) } >.sram
+       . = ALIGN(4);
+       __image_copy_end = .;
+       _end = .;
+
+       .bss :
+       {
+               . = ALIGN(4);
+               __bss_start = .;
+               *(.bss*)
+               . = ALIGN(4);
+               __bss_end__ = .;
+       } >.sdram
+}
index 0785b194c50cd4894f6031ba03d98a67af0f9870..266a0739ce8840afafa5f500e36c035f4d665abd 100644 (file)
@@ -31,7 +31,7 @@ LIB   = $(obj)lib$(SOC).o
 SOBJS  = reset.o
 
 COBJS-$(CONFIG_S3C6400)        += cpu_init.o speed.o
-COBJS-y        += timer.o
+COBJS-y        += timer.o init.o
 
 OBJS   := $(addprefix $(obj),$(SOBJS) $(COBJS-y))
 
diff --git a/arch/arm/cpu/arm1176/s3c64xx/init.c b/arch/arm/cpu/arm1176/s3c64xx/init.c
new file mode 100644 (file)
index 0000000..f113d8e
--- /dev/null
@@ -0,0 +1,26 @@
+/*
+ * (C) Copyright 2012 Ashok Kumar Reddy Kourla
+ * ashokkourla2000@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.
+ */
+
+#include<common.h>
+
+int arch_cpu_init(void)
+{
+       icache_enable();
+
+       return 0;
+}
index 667a0e0c48631b1f34c5fec04d1e994abae390ae..40df4b161428dd3343ba0eb8730908a98bdd1720 100644 (file)
@@ -224,12 +224,7 @@ skip_tcmdisable:
         */
        bl      lowlevel_init           /* go setup pll,mux,memory */
 
-/* Set stackpointer in internal RAM to call board_init_f */
-call_board_init_f:
-       ldr     sp, =(CONFIG_SYS_INIT_SP_ADDR)
-       bic     sp, sp, #7 /* 8-byte alignment for ABI compliance */
-       ldr     r0,=0x00000000
-       bl      board_init_f
+       bl      _main
 
 /*------------------------------------------------------------------------------*/
 
@@ -246,14 +241,10 @@ relocate_code:
        mov     r5, r1  /* save addr of gd */
        mov     r6, r2  /* save addr of destination */
 
-       /* Set up the stack                                                 */
-stack_setup:
-       mov     sp, r4
-
        adr     r0, _start
        cmp     r0, r6
        moveq   r9, #0          /* no relocation. relocation offset(r9) = 0 */
-       beq     clear_bss               /* skip relocation */
+       beq     relocate_done           /* skip relocation */
        mov     r1, r6                  /* r1 <- scratch for copy_loop */
        ldr     r3, _bss_start_ofs
        add     r2, r0, r3              /* r2 <- source end address         */
@@ -343,49 +334,9 @@ mmu_enable:
 skip_hw_init:
 #endif
 
-clear_bss:
-#ifndef CONFIG_SPL_BUILD
-       ldr     r0, _bss_start_ofs
-       ldr     r1, _bss_end_ofs
-       mov     r4, r6                  /* reloc addr */
-       add     r0, r0, r4
-       add     r1, r1, r4
-       mov     r2, #0x00000000         /* clear                            */
-
-clbss_l:cmp    r0, r1                  /* clear loop... */
-       bhs     clbss_e                 /* if reached end of bss, exit */
-       str     r2, [r0]
-       add     r0, r0, #4
-       b       clbss_l
-clbss_e:
-#ifndef CONFIG_NAND_SPL
-       bl coloured_LED_init
-       bl red_led_on
-#endif
-#endif
+relocate_done:
 
-/*
- * We are done. Do not return, instead branch to second part of board
- * initialization, now running from RAM.
- */
-#ifdef CONFIG_NAND_SPL
-       ldr     pc, _nand_boot
-
-_nand_boot: .word nand_boot
-#else
-       ldr     r0, _board_init_r_ofs
-       adr     r1, _start
-       add     lr, r0, r1
-       add     lr, lr, r9
-       /* setup parameters for board_init_r */
-       mov     r0, r5          /* gd_t */
-       mov     r1, r6          /* dest_addr */
-       /* jump to it ... */
-       mov     pc, lr
-
-_board_init_r_ofs:
-       .word board_init_r - _start
-#endif
+       bx      lr
 
 _rel_dyn_start_ofs:
        .word __rel_dyn_start - _start
@@ -399,6 +350,11 @@ _mmu_table_base:
        .word mmu_table
 #endif
 
+       .globl  c_runtime_cpu_setup
+c_runtime_cpu_setup:
+
+       mov     pc, lr
+
 #ifndef CONFIG_NAND_SPL
 /*
  * we assume that cache operation is done before. (eg. cleanup_before_linux())
index c2a7763fff00a2b4e974dacf7b31b144641c6e2c..771d3869c157969f4fdb2039d01bf176e7a79fe7 100644 (file)
@@ -147,12 +147,7 @@ reset:
        bl      cpu_init_crit
 #endif
 
-/* Set stackpointer in internal RAM to call board_init_f */
-call_board_init_f:
-       ldr     sp, =(CONFIG_SYS_INIT_SP_ADDR)
-       bic     sp, sp, #7 /* 8-byte alignment for ABI compliance */
-       ldr     r0,=0x00000000
-       bl      board_init_f
+       bl      _main
 
 /*------------------------------------------------------------------------------*/
 
@@ -169,14 +164,10 @@ relocate_code:
        mov     r5, r1  /* save addr of gd */
        mov     r6, r2  /* save addr of destination */
 
-       /* Set up the stack                                                 */
-stack_setup:
-       mov     sp, r4
-
        adr     r0, _start
        cmp     r0, r6
        moveq   r9, #0          /* no relocation. relocation offset(r9) = 0 */
-       beq     clear_bss               /* skip relocation */
+       beq     relocate_done           /* skip relocation */
        mov     r1, r6                  /* r1 <- scratch for copy_loop */
        ldr     r3, _bss_start_ofs
        add     r2, r0, r3              /* r2 <- source end address         */
@@ -228,43 +219,10 @@ fixnext:
        blo     fixloop
 #endif
 
-clear_bss:
-#ifndef CONFIG_SPL_BUILD
-       ldr     r0, _bss_start_ofs
-       ldr     r1, _bss_end_ofs
-       mov     r4, r6                  /* reloc addr */
-       add     r0, r0, r4
-       add     r1, r1, r4
-       mov     r2, #0x00000000         /* clear                            */
-
-clbss_l:cmp    r0, r1                  /* clear loop... */
-       bhs     clbss_e                 /* if reached end of bss, exit */
-       str     r2, [r0]
-       add     r0, r0, #4
-       b       clbss_l
-clbss_e:
-
-       bl coloured_LED_init
-       bl red_led_on
-#endif
+relocate_done:
 
-/*
- * We are done. Do not return, instead branch to second part of board
- * initialization, now running from RAM.
- */
-       ldr     r0, _board_init_r_ofs
-       adr     r1, _start
-       add     lr, r0, r1
-       add     lr, lr, r9
-       /* setup parameters for board_init_r */
-       mov     r0, r5          /* gd_t */
-       mov     r1, r6          /* dest_addr */
-       /* jump to it ... */
        mov     pc, lr
 
-_board_init_r_ofs:
-       .word board_init_r - _start
-
 _rel_dyn_start_ofs:
        .word __rel_dyn_start - _start
 _rel_dyn_end_ofs:
@@ -272,6 +230,11 @@ _rel_dyn_end_ofs:
 _dynsym_start_ofs:
        .word __dynsym_start - _start
 
+       .globl  c_runtime_cpu_setup
+c_runtime_cpu_setup:
+
+       mov     pc, lr
+
 /*
  *************************************************************************
  *
index 14c9156c084aebacdebb12ce0fa44e07cd940627..511d21d3344eec1f68b835b85a66584d6f261173 100644 (file)
@@ -182,12 +182,7 @@ copyex:
        bl      cpu_init_crit
 #endif
 
-/* Set stackpointer in internal RAM to call board_init_f */
-call_board_init_f:
-       ldr     sp, =(CONFIG_SYS_INIT_SP_ADDR)
-       bic     sp, sp, #7 /* 8-byte alignment for ABI compliance */
-       ldr     r0,=0x00000000
-       bl      board_init_f
+       bl      _main
 
 /*------------------------------------------------------------------------------*/
 
@@ -204,14 +199,10 @@ relocate_code:
        mov     r5, r1  /* save addr of gd */
        mov     r6, r2  /* save addr of destination */
 
-       /* Set up the stack                                                 */
-stack_setup:
-       mov     sp, r4
-
        adr     r0, _start
        cmp     r0, r6
        moveq   r9, #0          /* no relocation. relocation offset(r9) = 0 */
-       beq     clear_bss               /* skip relocation */
+       beq     relocate_done           /* skip relocation */
        mov     r1, r6                  /* r1 <- scratch for copy_loop */
        ldr     r3, _bss_start_ofs
        add     r2, r0, r3              /* r2 <- source end address         */
@@ -263,51 +254,10 @@ fixnext:
        blo     fixloop
 #endif
 
-clear_bss:
-#ifndef CONFIG_SPL_BUILD
-       ldr     r0, _bss_start_ofs
-       ldr     r1, _bss_end_ofs
-       mov     r4, r6                  /* reloc addr */
-       add     r0, r0, r4
-       add     r1, r1, r4
-       mov     r2, #0x00000000         /* clear                            */
-
-clbss_l:cmp    r0, r1                  /* clear loop... */
-       bhs     clbss_e                 /* if reached end of bss, exit */
-       str     r2, [r0]
-       add     r0, r0, #4
-       b       clbss_l
-clbss_e:
-
-       bl coloured_LED_init
-       bl red_led_on
-#endif
-
-/*
- * We are done. Do not return, instead branch to second part of board
- * initialization, now running from RAM.
- */
-#ifdef CONFIG_NAND_SPL
-       ldr     r0, _nand_boot_ofs
-       mov     pc, r0
+relocate_done:
 
-_nand_boot_ofs:
-       .word nand_boot
-#else
-       ldr     r0, _board_init_r_ofs
-       adr     r1, _start
-       add     lr, r0, r1
-       add     lr, lr, r9
-       /* setup parameters for board_init_r */
-       mov     r0, r5          /* gd_t */
-       mov     r1, r6          /* dest_addr */
-       /* jump to it ... */
        mov     pc, lr
 
-_board_init_r_ofs:
-       .word board_init_r - _start
-#endif
-
 _rel_dyn_start_ofs:
        .word __rel_dyn_start - _start
 _rel_dyn_end_ofs:
@@ -315,6 +265,11 @@ _rel_dyn_end_ofs:
 _dynsym_start_ofs:
        .word __dynsym_start - _start
 
+       .globl  c_runtime_cpu_setup
+c_runtime_cpu_setup:
+
+       mov     pc, lr
+
 /*
  *************************************************************************
  *
index 3a483f6caef858e76aa7b89ce1ad8accb5dc2db7..e8d6d71c1701613e7781846c6ecfe25d57ee0b1e 100644 (file)
 #include <config.h>
 #include <version.h>
 
-#if defined(CONFIG_OMAP1510)
-#include <./configs/omap1510.h>
-#endif
-
 /*
  *************************************************************************
  *
@@ -176,12 +172,7 @@ poll1:
        bl  cpu_init_crit
 #endif
 
-/* Set stackpointer in internal RAM to call board_init_f */
-call_board_init_f:
-       ldr     sp, =(CONFIG_SYS_INIT_SP_ADDR)
-       bic     sp, sp, #7 /* 8-byte alignment for ABI compliance */
-       ldr     r0,=0x00000000
-       bl      board_init_f
+       bl      _main
 
 /*------------------------------------------------------------------------------*/
 
@@ -198,14 +189,10 @@ relocate_code:
        mov     r5, r1  /* save addr of gd */
        mov     r6, r2  /* save addr of destination */
 
-       /* Set up the stack                                                 */
-stack_setup:
-       mov     sp, r4
-
        adr     r0, _start
        cmp     r0, r6
        moveq   r9, #0          /* no relocation. relocation offset(r9) = 0 */
-       beq     clear_bss               /* skip relocation */
+       beq     relocate_done           /* skip relocation */
        mov     r1, r6                  /* r1 <- scratch for copy_loop */
        ldr     r3, _bss_start_ofs
        add     r2, r0, r3              /* r2 <- source end address         */
@@ -257,51 +244,10 @@ fixnext:
        blo     fixloop
 #endif
 
-clear_bss:
-#ifndef CONFIG_SPL_BUILD
-       ldr     r0, _bss_start_ofs
-       ldr     r1, _bss_end_ofs
-       mov     r4, r6                  /* reloc addr */
-       add     r0, r0, r4
-       add     r1, r1, r4
-       mov     r2, #0x00000000         /* clear                            */
-
-clbss_l:cmp    r0, r1                  /* clear loop... */
-       bhs     clbss_e                 /* if reached end of bss, exit */
-       str     r2, [r0]
-       add     r0, r0, #4
-       b       clbss_l
-clbss_e:
-
-       bl coloured_LED_init
-       bl red_led_on
-#endif
-
-/*
- * We are done. Do not return, instead branch to second part of board
- * initialization, now running from RAM.
- */
-#ifdef CONFIG_NAND_SPL
-       ldr     r0, _nand_boot_ofs
-       mov     pc, r0
+relocate_done:
 
-_nand_boot_ofs:
-       .word nand_boot
-#else
-       ldr     r0, _board_init_r_ofs
-       adr     r1, _start
-       add     lr, r0, r1
-       add     lr, lr, r9
-       /* setup parameters for board_init_r */
-       mov     r0, r5          /* gd_t */
-       mov     r1, r6          /* dest_addr */
-       /* jump to it ... */
        mov     pc, lr
 
-_board_init_r_ofs:
-       .word board_init_r - _start
-#endif
-
 _rel_dyn_start_ofs:
        .word __rel_dyn_start - _start
 _rel_dyn_end_ofs:
@@ -309,6 +255,11 @@ _rel_dyn_end_ofs:
 _dynsym_start_ofs:
        .word __dynsym_start - _start
 
+       .globl  c_runtime_cpu_setup
+c_runtime_cpu_setup:
+
+       mov     pc, lr
+
 /*
  *************************************************************************
  *
index 93485523b585077e48a9ca03a6d163f80ed5f77e..0448c0b133b99e254d6c8a373ba731c19e933717 100644 (file)
@@ -193,6 +193,19 @@ void at91_spi1_hw_init(unsigned long cs_mask)
 }
 #endif
 
+#if defined(CONFIG_USB_OHCI_NEW) || defined(CONFIG_USB_EHCI)
+void at91_uhp_hw_init(void)
+{
+       /* Enable VBus on UHP ports */
+       at91_set_pio_output(AT91_PIO_PORTD, 18, 0); /* port A */
+       at91_set_pio_output(AT91_PIO_PORTD, 19, 0); /* port B */
+#if defined(CONFIG_USB_OHCI_NEW)
+       /* port C is OHCI only */
+       at91_set_pio_output(AT91_PIO_PORTD, 20, 0); /* port C */
+#endif
+}
+#endif
+
 #ifdef CONFIG_MACB
 void at91_macb_hw_init(void)
 {
index 968fb035c89f9cada737f6eaaed0eef26cb2561d..80f1ce9d31815e637e54214097f7749d2715a8b0 100644 (file)
@@ -16,7 +16,7 @@
 void reset_cpu(unsigned long a)
 {
        struct davinci_timer *const wdttimer =
-               (struct davinci_timer *)DAVINCI_TIMER1_BASE;
+               (struct davinci_timer *)DAVINCI_WDOG_BASE;
        writel(0x08, &wdttimer->tgcr);
        writel(readl(&wdttimer->tgcr) | 0x03, &wdttimer->tgcr);
        writel(0, &wdttimer->tim12);
index 03eb2de520f72bbf555d62fd643c6bc7151d061f..0ba6f098cb6b2c6486dc1a79375a6482634327f9 100644 (file)
@@ -31,7 +31,7 @@ static u32 kirkwood_variant(void)
 #define MPP_CTRL(i)    (KW_MPP_BASE + (i* 4))
 #define MPP_NR_REGS    (1 + MPP_MAX/8)
 
-void kirkwood_mpp_conf(u32 *mpp_list, u32 *mpp_save)
+void kirkwood_mpp_conf(const u32 *mpp_list, u32 *mpp_save)
 {
        u32 mpp_ctrl[MPP_NR_REGS];
        unsigned int variant_mask;
index 8ea7c36f46f8d94ed5b5953362fead3f431ba254..1b8502eb9dc03bf3e4edcc1914830db5dc2ed3ef 100644 (file)
@@ -50,7 +50,7 @@ void early_delay(int delay)
 }
 
 #define        MUX_CONFIG_BOOTMODE_PAD (MXS_PAD_3V3 | MXS_PAD_4MA | MXS_PAD_NOPULL)
-const iomux_cfg_t iomux_boot[] = {
+static const iomux_cfg_t iomux_boot[] = {
        MX28_PAD_LCD_D00__GPIO_1_0 | MUX_CONFIG_BOOTMODE_PAD,
        MX28_PAD_LCD_D01__GPIO_1_1 | MUX_CONFIG_BOOTMODE_PAD,
        MX28_PAD_LCD_D02__GPIO_1_2 | MUX_CONFIG_BOOTMODE_PAD,
@@ -59,7 +59,7 @@ const iomux_cfg_t iomux_boot[] = {
        MX28_PAD_LCD_D05__GPIO_1_5 | MUX_CONFIG_BOOTMODE_PAD,
 };
 
-uint8_t mxs_get_bootmode_index(void)
+static uint8_t mxs_get_bootmode_index(void)
 {
        uint8_t bootmode = 0;
        int i;
index e693145b90cf07ccc7afe007d9daaf5648d70c53..401c51362bfd6bf6c0c04a68dce15973adcfe20a 100644 (file)
 
 #include "mxs_init.h"
 
-static uint32_t mx28_dram_vals[] = {
+static uint32_t dram_vals[] = {
+/*
+ * i.MX28 DDR2 at 200MHz
+ */
+#if defined(CONFIG_MX28)
        0x00000000, 0x00000000, 0x00000000, 0x00000000,
        0x00000000, 0x00000000, 0x00000000, 0x00000000,
        0x00000000, 0x00000000, 0x00000000, 0x00000000,
@@ -79,6 +83,9 @@ static uint32_t mx28_dram_vals[] = {
        0x06120612, 0x04320432, 0x04320432, 0x00040004,
        0x00040004, 0x00000000, 0x00000000, 0x00000000,
        0x00000000, 0x00010001
+#else
+#error Unsupported memory initialization
+#endif
 };
 
 void __mxs_adjust_memory_params(uint32_t *dram_vals)
@@ -87,17 +94,17 @@ void __mxs_adjust_memory_params(uint32_t *dram_vals)
 void mxs_adjust_memory_params(uint32_t *dram_vals)
        __attribute__((weak, alias("__mxs_adjust_memory_params")));
 
-void init_mx28_200mhz_ddr2(void)
+static void initialize_dram_values(void)
 {
        int i;
 
-       mxs_adjust_memory_params(mx28_dram_vals);
+       mxs_adjust_memory_params(dram_vals);
 
-       for (i = 0; i < ARRAY_SIZE(mx28_dram_vals); i++)
-               writel(mx28_dram_vals[i], MXS_DRAM_BASE + (4 * i));
+       for (i = 0; i < ARRAY_SIZE(dram_vals); i++)
+               writel(dram_vals[i], MXS_DRAM_BASE + (4 * i));
 }
 
-void mxs_mem_init_clock(void)
+static void mxs_mem_init_clock(void)
 {
        struct mxs_clkctrl_regs *clkctrl_regs =
                (struct mxs_clkctrl_regs *)MXS_CLKCTRL_BASE;
@@ -128,7 +135,7 @@ void mxs_mem_init_clock(void)
        early_delay(10000);
 }
 
-void mxs_mem_setup_cpu_and_hbus(void)
+static void mxs_mem_setup_cpu_and_hbus(void)
 {
        struct mxs_clkctrl_regs *clkctrl_regs =
                (struct mxs_clkctrl_regs *)MXS_CLKCTRL_BASE;
@@ -160,7 +167,7 @@ void mxs_mem_setup_cpu_and_hbus(void)
        early_delay(15000);
 }
 
-void mxs_mem_setup_vdda(void)
+static void mxs_mem_setup_vdda(void)
 {
        struct mxs_power_regs *power_regs =
                (struct mxs_power_regs *)MXS_POWER_BASE;
@@ -171,17 +178,6 @@ void mxs_mem_setup_vdda(void)
                &power_regs->hw_power_vddactrl);
 }
 
-void mxs_mem_setup_vddd(void)
-{
-       struct mxs_power_regs *power_regs =
-               (struct mxs_power_regs *)MXS_POWER_BASE;
-
-       writel((0x1c << POWER_VDDDCTRL_TRG_OFFSET) |
-               (0x7 << POWER_VDDDCTRL_BO_OFFSET_OFFSET) |
-               POWER_VDDDCTRL_LINREG_OFFSET_1STEPS_BELOW,
-               &power_regs->hw_power_vdddctrl);
-}
-
 uint32_t mxs_mem_get_size(void)
 {
        uint32_t sz, da;
@@ -229,7 +225,7 @@ void mxs_mem_init(void)
        /* Clear START bit from DRAM_CTL16 */
        clrbits_le32(MXS_DRAM_BASE + 0x40, 1);
 
-       init_mx28_200mhz_ddr2();
+       initialize_dram_values();
 
        /* Clear SREFRESH bit from DRAM_CTL17 */
        clrbits_le32(MXS_DRAM_BASE + 0x44, 1);
@@ -241,8 +237,6 @@ void mxs_mem_init(void)
        while (!(readl(MXS_DRAM_BASE + 0xe8) & (1 << 20)))
                ;
 
-       mxs_mem_setup_vddd();
-
        early_delay(10000);
 
        mxs_mem_setup_cpu_and_hbus();
index 4b917bd186df4ea62651690c1a99c91ff2b0118a..be44c22976352fdfec2e193acd6d8402b12484c0 100644 (file)
@@ -30,7 +30,7 @@
 
 #include "mxs_init.h"
 
-void mxs_power_clock2xtal(void)
+static void mxs_power_clock2xtal(void)
 {
        struct mxs_clkctrl_regs *clkctrl_regs =
                (struct mxs_clkctrl_regs *)MXS_CLKCTRL_BASE;
@@ -40,7 +40,7 @@ void mxs_power_clock2xtal(void)
                &clkctrl_regs->hw_clkctrl_clkseq_set);
 }
 
-void mxs_power_clock2pll(void)
+static void mxs_power_clock2pll(void)
 {
        struct mxs_clkctrl_regs *clkctrl_regs =
                (struct mxs_clkctrl_regs *)MXS_CLKCTRL_BASE;
@@ -52,7 +52,7 @@ void mxs_power_clock2pll(void)
                        CLKCTRL_CLKSEQ_BYPASS_CPU);
 }
 
-void mxs_power_clear_auto_restart(void)
+static void mxs_power_clear_auto_restart(void)
 {
        struct mxs_rtc_regs *rtc_regs =
                (struct mxs_rtc_regs *)MXS_RTC_BASE;
@@ -85,7 +85,7 @@ void mxs_power_clear_auto_restart(void)
                ;
 }
 
-void mxs_power_set_linreg(void)
+static void mxs_power_set_linreg(void)
 {
        struct mxs_power_regs *power_regs =
                (struct mxs_power_regs *)MXS_POWER_BASE;
@@ -104,7 +104,7 @@ void mxs_power_set_linreg(void)
                        POWER_VDDIOCTRL_LINREG_OFFSET_1STEPS_BELOW);
 }
 
-int mxs_get_batt_volt(void)
+static int mxs_get_batt_volt(void)
 {
        struct mxs_power_regs *power_regs =
                (struct mxs_power_regs *)MXS_POWER_BASE;
@@ -115,12 +115,12 @@ int mxs_get_batt_volt(void)
        return volt;
 }
 
-int mxs_is_batt_ready(void)
+static int mxs_is_batt_ready(void)
 {
        return (mxs_get_batt_volt() >= 3600);
 }
 
-int mxs_is_batt_good(void)
+static int mxs_is_batt_good(void)
 {
        struct mxs_power_regs *power_regs =
                (struct mxs_power_regs *)MXS_POWER_BASE;
@@ -160,7 +160,7 @@ int mxs_is_batt_good(void)
        return 0;
 }
 
-void mxs_power_setup_5v_detect(void)
+static void mxs_power_setup_5v_detect(void)
 {
        struct mxs_power_regs *power_regs =
                (struct mxs_power_regs *)MXS_POWER_BASE;
@@ -172,7 +172,7 @@ void mxs_power_setup_5v_detect(void)
                        POWER_5VCTRL_PWRUP_VBUS_CMPS);
 }
 
-void mxs_src_power_init(void)
+static void mxs_src_power_init(void)
 {
        struct mxs_power_regs *power_regs =
                (struct mxs_power_regs *)MXS_POWER_BASE;
@@ -203,7 +203,7 @@ void mxs_src_power_init(void)
        clrbits_le32(&power_regs->hw_power_5vctrl, POWER_5VCTRL_DCDC_XFER);
 }
 
-void mxs_power_init_4p2_params(void)
+static void mxs_power_init_4p2_params(void)
 {
        struct mxs_power_regs *power_regs =
                (struct mxs_power_regs *)MXS_POWER_BASE;
@@ -227,7 +227,7 @@ void mxs_power_init_4p2_params(void)
                0x3f << POWER_5VCTRL_CHARGE_4P2_ILIMIT_OFFSET);
 }
 
-void mxs_enable_4p2_dcdc_input(int xfer)
+static void mxs_enable_4p2_dcdc_input(int xfer)
 {
        struct mxs_power_regs *power_regs =
                (struct mxs_power_regs *)MXS_POWER_BASE;
@@ -323,7 +323,7 @@ void mxs_enable_4p2_dcdc_input(int xfer)
                                POWER_CTRL_ENIRQ_VDD5V_DROOP);
 }
 
-void mxs_power_init_4p2_regulator(void)
+static void mxs_power_init_4p2_regulator(void)
 {
        struct mxs_power_regs *power_regs =
                (struct mxs_power_regs *)MXS_POWER_BASE;
@@ -407,7 +407,7 @@ void mxs_power_init_4p2_regulator(void)
        writel(POWER_CTRL_DCDC4P2_BO_IRQ, &power_regs->hw_power_ctrl_clr);
 }
 
-void mxs_power_init_dcdc_4p2_source(void)
+static void mxs_power_init_dcdc_4p2_source(void)
 {
        struct mxs_power_regs *power_regs =
                (struct mxs_power_regs *)MXS_POWER_BASE;
@@ -429,7 +429,7 @@ void mxs_power_init_dcdc_4p2_source(void)
        }
 }
 
-void mxs_power_enable_4p2(void)
+static void mxs_power_enable_4p2(void)
 {
        struct mxs_power_regs *power_regs =
                (struct mxs_power_regs *)MXS_POWER_BASE;
@@ -488,7 +488,7 @@ void mxs_power_enable_4p2(void)
                        &power_regs->hw_power_charge_clr);
 }
 
-void mxs_boot_valid_5v(void)
+static void mxs_boot_valid_5v(void)
 {
        struct mxs_power_regs *power_regs =
                (struct mxs_power_regs *)MXS_POWER_BASE;
@@ -511,7 +511,7 @@ void mxs_boot_valid_5v(void)
        mxs_power_enable_4p2();
 }
 
-void mxs_powerdown(void)
+static void mxs_powerdown(void)
 {
        struct mxs_power_regs *power_regs =
                (struct mxs_power_regs *)MXS_POWER_BASE;
@@ -520,7 +520,7 @@ void mxs_powerdown(void)
                &power_regs->hw_power_reset);
 }
 
-void mxs_batt_boot(void)
+static void mxs_batt_boot(void)
 {
        struct mxs_power_regs *power_regs =
                (struct mxs_power_regs *)MXS_POWER_BASE;
@@ -564,7 +564,7 @@ void mxs_batt_boot(void)
                0x8 << POWER_5VCTRL_CHARGE_4P2_ILIMIT_OFFSET);
 }
 
-void mxs_handle_5v_conflict(void)
+static void mxs_handle_5v_conflict(void)
 {
        struct mxs_power_regs *power_regs =
                (struct mxs_power_regs *)MXS_POWER_BASE;
@@ -600,7 +600,7 @@ void mxs_handle_5v_conflict(void)
        }
 }
 
-void mxs_5v_boot(void)
+static void mxs_5v_boot(void)
 {
        struct mxs_power_regs *power_regs =
                (struct mxs_power_regs *)MXS_POWER_BASE;
@@ -623,7 +623,7 @@ void mxs_5v_boot(void)
        mxs_handle_5v_conflict();
 }
 
-void mxs_init_batt_bo(void)
+static void mxs_init_batt_bo(void)
 {
        struct mxs_power_regs *power_regs =
                (struct mxs_power_regs *)MXS_POWER_BASE;
@@ -637,7 +637,7 @@ void mxs_init_batt_bo(void)
        writel(POWER_CTRL_ENIRQ_BATT_BO, &power_regs->hw_power_ctrl_clr);
 }
 
-void mxs_switch_vddd_to_dcdc_source(void)
+static void mxs_switch_vddd_to_dcdc_source(void)
 {
        struct mxs_power_regs *power_regs =
                (struct mxs_power_regs *)MXS_POWER_BASE;
@@ -651,7 +651,7 @@ void mxs_switch_vddd_to_dcdc_source(void)
                POWER_VDDDCTRL_DISABLE_STEPPING);
 }
 
-void mxs_power_configure_power_source(void)
+static void mxs_power_configure_power_source(void)
 {
        int batt_ready, batt_good;
        struct mxs_power_regs *power_regs =
@@ -689,7 +689,7 @@ void mxs_power_configure_power_source(void)
        mxs_switch_vddd_to_dcdc_source();
 }
 
-void mxs_enable_output_rail_protection(void)
+static void mxs_enable_output_rail_protection(void)
 {
        struct mxs_power_regs *power_regs =
                (struct mxs_power_regs *)MXS_POWER_BASE;
@@ -707,7 +707,7 @@ void mxs_enable_output_rail_protection(void)
                        POWER_VDDIOCTRL_PWDN_BRNOUT);
 }
 
-int mxs_get_vddio_power_source_off(void)
+static int mxs_get_vddio_power_source_off(void)
 {
        struct mxs_power_regs *power_regs =
                (struct mxs_power_regs *)MXS_POWER_BASE;
@@ -735,7 +735,7 @@ int mxs_get_vddio_power_source_off(void)
 
 }
 
-int mxs_get_vddd_power_source_off(void)
+static int mxs_get_vddd_power_source_off(void)
 {
        struct mxs_power_regs *power_regs =
                (struct mxs_power_regs *)MXS_POWER_BASE;
@@ -766,201 +766,115 @@ int mxs_get_vddd_power_source_off(void)
        return 0;
 }
 
-void mxs_power_set_vddio(uint32_t new_target, uint32_t new_brownout)
+struct mxs_vddx_cfg {
+       uint32_t                *reg;
+       uint8_t                 step_mV;
+       uint16_t                lowest_mV;
+       int                     (*powered_by_linreg)(void);
+       uint32_t                trg_mask;
+       uint32_t                bo_irq;
+       uint32_t                bo_enirq;
+       uint32_t                bo_offset_mask;
+       uint32_t                bo_offset_offset;
+};
+
+static const struct mxs_vddx_cfg mxs_vddio_cfg = {
+       .reg                    = &(((struct mxs_power_regs *)MXS_POWER_BASE)->
+                                       hw_power_vddioctrl),
+       .step_mV                = 50,
+       .lowest_mV              = 2800,
+       .powered_by_linreg      = mxs_get_vddio_power_source_off,
+       .trg_mask               = POWER_VDDIOCTRL_TRG_MASK,
+       .bo_irq                 = POWER_CTRL_VDDIO_BO_IRQ,
+       .bo_enirq               = POWER_CTRL_ENIRQ_VDDIO_BO,
+       .bo_offset_mask         = POWER_VDDIOCTRL_BO_OFFSET_MASK,
+       .bo_offset_offset       = POWER_VDDIOCTRL_BO_OFFSET_OFFSET,
+};
+
+static const struct mxs_vddx_cfg mxs_vddd_cfg = {
+       .reg                    = &(((struct mxs_power_regs *)MXS_POWER_BASE)->
+                                       hw_power_vdddctrl),
+       .step_mV                = 25,
+       .lowest_mV              = 800,
+       .powered_by_linreg      = mxs_get_vddd_power_source_off,
+       .trg_mask               = POWER_VDDDCTRL_TRG_MASK,
+       .bo_irq                 = POWER_CTRL_VDDD_BO_IRQ,
+       .bo_enirq               = POWER_CTRL_ENIRQ_VDDD_BO,
+       .bo_offset_mask         = POWER_VDDDCTRL_BO_OFFSET_MASK,
+       .bo_offset_offset       = POWER_VDDDCTRL_BO_OFFSET_OFFSET,
+};
+
+static void mxs_power_set_vddx(const struct mxs_vddx_cfg *cfg,
+                               uint32_t new_target, uint32_t new_brownout)
 {
        struct mxs_power_regs *power_regs =
                (struct mxs_power_regs *)MXS_POWER_BASE;
        uint32_t cur_target, diff, bo_int = 0;
        uint32_t powered_by_linreg = 0;
+       int adjust_up, tmp;
 
-       new_brownout = (new_target - new_brownout + 25) / 50;
+       new_brownout = DIV_ROUND(new_target - new_brownout, cfg->step_mV);
 
-       cur_target = readl(&power_regs->hw_power_vddioctrl);
-       cur_target &= POWER_VDDIOCTRL_TRG_MASK;
-       cur_target *= 50;       /* 50 mV step*/
-       cur_target += 2800;     /* 2800 mV lowest */
+       cur_target = readl(cfg->reg);
+       cur_target &= cfg->trg_mask;
+       cur_target *= cfg->step_mV;
+       cur_target += cfg->lowest_mV;
 
-       powered_by_linreg = mxs_get_vddio_power_source_off();
-       if (new_target > cur_target) {
+       adjust_up = new_target > cur_target;
+       powered_by_linreg = cfg->powered_by_linreg();
 
+       if (adjust_up) {
                if (powered_by_linreg) {
-                       bo_int = readl(&power_regs->hw_power_vddioctrl);
-                       clrbits_le32(&power_regs->hw_power_vddioctrl,
-                                       POWER_CTRL_ENIRQ_VDDIO_BO);
+                       bo_int = readl(cfg->reg);
+                       clrbits_le32(cfg->reg, cfg->bo_enirq);
                }
+               setbits_le32(cfg->reg, cfg->bo_offset_mask);
+       }
 
-               setbits_le32(&power_regs->hw_power_vddioctrl,
-                               POWER_VDDIOCTRL_BO_OFFSET_MASK);
-               do {
-                       if (new_target - cur_target > 100)
+       do {
+               if (abs(new_target - cur_target) > 100) {
+                       if (adjust_up)
                                diff = cur_target + 100;
                        else
-                               diff = new_target;
-
-                       diff -= 2800;
-                       diff /= 50;
-
-                       clrsetbits_le32(&power_regs->hw_power_vddioctrl,
-                               POWER_VDDIOCTRL_TRG_MASK, diff);
-
-                       if (powered_by_linreg ||
-                               (readl(&power_regs->hw_power_sts) &
-                                       POWER_STS_VDD5V_GT_VDDIO))
-                               early_delay(500);
-                       else {
-                               while (!(readl(&power_regs->hw_power_sts) &
-                                       POWER_STS_DC_OK))
-                                       ;
-
-                       }
-
-                       cur_target = readl(&power_regs->hw_power_vddioctrl);
-                       cur_target &= POWER_VDDIOCTRL_TRG_MASK;
-                       cur_target *= 50;       /* 50 mV step*/
-                       cur_target += 2800;     /* 2800 mV lowest */
-               } while (new_target > cur_target);
-
-               if (powered_by_linreg) {
-                       writel(POWER_CTRL_VDDIO_BO_IRQ,
-                               &power_regs->hw_power_ctrl_clr);
-                       if (bo_int & POWER_CTRL_ENIRQ_VDDIO_BO)
-                               setbits_le32(&power_regs->hw_power_vddioctrl,
-                                               POWER_CTRL_ENIRQ_VDDIO_BO);
-               }
-       } else {
-               do {
-                       if (cur_target - new_target > 100)
                                diff = cur_target - 100;
-                       else
-                               diff = new_target;
-
-                       diff -= 2800;
-                       diff /= 50;
-
-                       clrsetbits_le32(&power_regs->hw_power_vddioctrl,
-                               POWER_VDDIOCTRL_TRG_MASK, diff);
-
-                       if (powered_by_linreg ||
-                               (readl(&power_regs->hw_power_sts) &
-                                       POWER_STS_VDD5V_GT_VDDIO))
-                               early_delay(500);
-                       else {
-                               while (!(readl(&power_regs->hw_power_sts) &
-                                       POWER_STS_DC_OK))
-                                       ;
-
-                       }
-
-                       cur_target = readl(&power_regs->hw_power_vddioctrl);
-                       cur_target &= POWER_VDDIOCTRL_TRG_MASK;
-                       cur_target *= 50;       /* 50 mV step*/
-                       cur_target += 2800;     /* 2800 mV lowest */
-               } while (new_target < cur_target);
-       }
-
-       clrsetbits_le32(&power_regs->hw_power_vddioctrl,
-                       POWER_VDDIOCTRL_BO_OFFSET_MASK,
-                       new_brownout << POWER_VDDIOCTRL_BO_OFFSET_OFFSET);
-}
-
-void mxs_power_set_vddd(uint32_t new_target, uint32_t new_brownout)
-{
-       struct mxs_power_regs *power_regs =
-               (struct mxs_power_regs *)MXS_POWER_BASE;
-       uint32_t cur_target, diff, bo_int = 0;
-       uint32_t powered_by_linreg = 0;
-
-       new_brownout = (new_target - new_brownout + 12) / 25;
-
-       cur_target = readl(&power_regs->hw_power_vdddctrl);
-       cur_target &= POWER_VDDDCTRL_TRG_MASK;
-       cur_target *= 25;       /* 25 mV step*/
-       cur_target += 800;      /* 800 mV lowest */
-
-       powered_by_linreg = mxs_get_vddd_power_source_off();
-       if (new_target > cur_target) {
-               if (powered_by_linreg) {
-                       bo_int = readl(&power_regs->hw_power_vdddctrl);
-                       clrbits_le32(&power_regs->hw_power_vdddctrl,
-                                       POWER_CTRL_ENIRQ_VDDD_BO);
+               } else {
+                       diff = new_target;
                }
 
-               setbits_le32(&power_regs->hw_power_vdddctrl,
-                               POWER_VDDDCTRL_BO_OFFSET_MASK);
-
-               do {
-                       if (new_target - cur_target > 100)
-                               diff = cur_target + 100;
-                       else
-                               diff = new_target;
-
-                       diff -= 800;
-                       diff /= 25;
-
-                       clrsetbits_le32(&power_regs->hw_power_vdddctrl,
-                               POWER_VDDDCTRL_TRG_MASK, diff);
+               diff -= cfg->lowest_mV;
+               diff /= cfg->step_mV;
 
-                       if (powered_by_linreg ||
-                               (readl(&power_regs->hw_power_sts) &
-                                       POWER_STS_VDD5V_GT_VDDIO))
-                               early_delay(500);
-                       else {
-                               while (!(readl(&power_regs->hw_power_sts) &
-                                       POWER_STS_DC_OK))
-                                       ;
+               clrsetbits_le32(cfg->reg, cfg->trg_mask, diff);
 
+               if (powered_by_linreg ||
+                       (readl(&power_regs->hw_power_sts) &
+                               POWER_STS_VDD5V_GT_VDDIO))
+                       early_delay(500);
+               else {
+                       for (;;) {
+                               tmp = readl(&power_regs->hw_power_sts);
+                               if (tmp & POWER_STS_DC_OK)
+                                       break;
                        }
-
-                       cur_target = readl(&power_regs->hw_power_vdddctrl);
-                       cur_target &= POWER_VDDDCTRL_TRG_MASK;
-                       cur_target *= 25;       /* 25 mV step*/
-                       cur_target += 800;      /* 800 mV lowest */
-               } while (new_target > cur_target);
-
-               if (powered_by_linreg) {
-                       writel(POWER_CTRL_VDDD_BO_IRQ,
-                               &power_regs->hw_power_ctrl_clr);
-                       if (bo_int & POWER_CTRL_ENIRQ_VDDD_BO)
-                               setbits_le32(&power_regs->hw_power_vdddctrl,
-                                               POWER_CTRL_ENIRQ_VDDD_BO);
                }
-       } else {
-               do {
-                       if (cur_target - new_target > 100)
-                               diff = cur_target - 100;
-                       else
-                               diff = new_target;
 
-                       diff -= 800;
-                       diff /= 25;
+               cur_target = readl(cfg->reg);
+               cur_target &= cfg->trg_mask;
+               cur_target *= cfg->step_mV;
+               cur_target += cfg->lowest_mV;
+       } while (new_target > cur_target);
 
-                       clrsetbits_le32(&power_regs->hw_power_vdddctrl,
-                                       POWER_VDDDCTRL_TRG_MASK, diff);
-
-                       if (powered_by_linreg ||
-                               (readl(&power_regs->hw_power_sts) &
-                                       POWER_STS_VDD5V_GT_VDDIO))
-                               early_delay(500);
-                       else {
-                               while (!(readl(&power_regs->hw_power_sts) &
-                                       POWER_STS_DC_OK))
-                                       ;
-
-                       }
-
-                       cur_target = readl(&power_regs->hw_power_vdddctrl);
-                       cur_target &= POWER_VDDDCTRL_TRG_MASK;
-                       cur_target *= 25;       /* 25 mV step*/
-                       cur_target += 800;      /* 800 mV lowest */
-               } while (new_target < cur_target);
+       if (adjust_up && powered_by_linreg) {
+               writel(cfg->bo_irq, &power_regs->hw_power_ctrl_clr);
+               if (bo_int & cfg->bo_enirq)
+                       setbits_le32(cfg->reg, cfg->bo_enirq);
        }
 
-       clrsetbits_le32(&power_regs->hw_power_vdddctrl,
-                       POWER_VDDDCTRL_BO_OFFSET_MASK,
-                       new_brownout << POWER_VDDDCTRL_BO_OFFSET_OFFSET);
+       clrsetbits_le32(cfg->reg, cfg->bo_offset_mask,
+                       new_brownout << cfg->bo_offset_offset);
 }
 
-void mxs_setup_batt_detect(void)
+static void mxs_setup_batt_detect(void)
 {
        mxs_lradc_init();
        mxs_lradc_enable_batt_measurement();
@@ -982,9 +896,8 @@ void mxs_power_init(void)
        mxs_power_configure_power_source();
        mxs_enable_output_rail_protection();
 
-       mxs_power_set_vddio(3300, 3150);
-
-       mxs_power_set_vddd(1350, 1200);
+       mxs_power_set_vddx(&mxs_vddio_cfg, 3300, 3150);
+       mxs_power_set_vddx(&mxs_vddd_cfg, 1500, 1000);
 
        writel(POWER_CTRL_VDDD_BO_IRQ | POWER_CTRL_VDDA_BO_IRQ |
                POWER_CTRL_VDDIO_BO_IRQ | POWER_CTRL_VDD5V_DROOP_IRQ |
index 2188f7e35d1df8de3bce8d9ccadea6e60bc89b46..66a8b654bdf465d9fc1ad711de4925ca42006c8c 100644 (file)
 #include <common.h>
 #include <version.h>
 
-#if defined(CONFIG_OMAP1610)
-#include <./configs/omap1510.h>
-#elif defined(CONFIG_OMAP730)
-#include <./configs/omap730.h>
-#endif
-
 /*
  *************************************************************************
  *
@@ -198,20 +192,7 @@ reset:
        bl      cpu_init_crit
 #endif
 
-/* Set stackpointer in internal RAM to call board_init_f */
-call_board_init_f:
-#ifdef CONFIG_NAND_SPL /* deprecated, use instead CONFIG_SPL_BUILD */
-       ldr     sp, =(CONFIG_SYS_INIT_SP_ADDR)
-#else
-#ifdef CONFIG_SPL_BUILD
-       ldr     sp, =(CONFIG_SPL_STACK)
-#else
-       ldr     sp, =(CONFIG_SYS_INIT_SP_ADDR)
-#endif
-#endif
-       bic     sp, sp, #7 /* 8-byte alignment for ABI compliance */
-       ldr     r0,=0x00000000
-       bl      board_init_f
+       bl      _main
 
 /*------------------------------------------------------------------------------*/
 
@@ -229,15 +210,11 @@ relocate_code:
        mov     r5, r1  /* save addr of gd */
        mov     r6, r2  /* save addr of destination */
 
-       /* Set up the stack                                                 */
-stack_setup:
-       mov     sp, r4
-
        adr     r0, _start
        sub     r9, r6, r0              /* r9 <- relocation offset */
        cmp     r0, r6
-       moveq   r9, #0          /* no relocation. relocation offset(r9) = 0 */
-       beq     clear_bss               /* skip relocation */
+       moveq   r9, #0                  /* no relocation. offset(r9) = 0 */
+       beq     relocate_done           /* skip relocation */
        mov     r1, r6                  /* r1 <- scratch for copy loop */
        ldr     r3, _bss_start_ofs
        add     r2, r0, r3              /* r2 <- source end address         */
@@ -289,56 +266,9 @@ fixnext:
        blo     fixloop
 #endif
 
-clear_bss:
-#ifdef CONFIG_SPL_BUILD
-       /* No relocation for SPL */
-       ldr     r0, =__bss_start
-       ldr     r1, =__bss_end__
-#else
-       ldr     r0, _bss_start_ofs
-       ldr     r1, _bss_end_ofs
-       mov     r4, r6                  /* reloc addr */
-       add     r0, r0, r4
-       add     r1, r1, r4
-#endif
-       mov     r2, #0x00000000         /* clear                            */
-
-clbss_l:cmp    r0, r1                  /* clear loop... */
-       bhs     clbss_e                 /* if reached end of bss, exit */
-       str     r2, [r0]
-       add     r0, r0, #4
-       b       clbss_l
-clbss_e:
-
-#ifndef CONFIG_SPL_BUILD
-       bl coloured_LED_init
-       bl red_led_on
-#endif
-
-/*
- * We are done. Do not return, instead branch to second part of board
- * initialization, now running from RAM.
- */
-#ifdef CONFIG_NAND_SPL
-       ldr     r0, _nand_boot_ofs
-       mov     pc, r0
+relocate_done:
 
-_nand_boot_ofs:
-       .word nand_boot
-#else
-       ldr     r0, _board_init_r_ofs
-       ldr     r1, _TEXT_BASE
-       add     lr, r0, r1
-       add     lr, lr, r9
-       /* setup parameters for board_init_r */
-       mov     r0, r5          /* gd_t */
-       mov     r1, r6          /* dest_addr */
-       /* jump to it ... */
-       mov     pc, lr
-
-_board_init_r_ofs:
-       .word board_init_r - _start
-#endif
+       bx      lr
 
 _rel_dyn_start_ofs:
        .word __rel_dyn_start - _start
@@ -346,8 +276,14 @@ _rel_dyn_end_ofs:
        .word __rel_dyn_end - _start
 _dynsym_start_ofs:
        .word __dynsym_start - _start
+
 #endif
 
+       .globl  c_runtime_cpu_setup
+c_runtime_cpu_setup:
+
+       bx      lr
+
 /*
  *************************************************************************
  *
index 30e21835cc8759c6947ab1e46fc367f6a728e2f0..a7a98a4e58a94b0a5e4515f66119d13c0a0a39c6 100644 (file)
@@ -147,12 +147,7 @@ reset:
        bl      cpu_init_crit
 #endif
 
-/* Set stackpointer in internal RAM to call board_init_f */
-call_board_init_f:
-       ldr     sp, =(CONFIG_SYS_INIT_SP_ADDR)
-       bic     sp, sp, #7 /* 8-byte alignment for ABI compliance */
-       ldr     r0,=0x00000000
-       bl      board_init_f
+       bl      _main
 
 /*------------------------------------------------------------------------------*/
 
@@ -169,14 +164,10 @@ relocate_code:
        mov     r5, r1  /* save addr of gd */
        mov     r6, r2  /* save addr of destination */
 
-       /* Set up the stack                                                 */
-stack_setup:
-       mov     sp, r4
-
        adr     r0, _start
        cmp     r0, r6
        moveq   r9, #0          /* no relocation. relocation offset(r9) = 0 */
-       beq     clear_bss               /* skip relocation */
+       beq     relocate_done           /* skip relocation */
        mov     r1, r6                  /* r1 <- scratch for copy_loop */
        ldr     r3, _bss_start_ofs
        add     r2, r0, r3              /* r2 <- source end address         */
@@ -228,46 +219,10 @@ fixnext:
        blo     fixloop
 #endif
 
-clear_bss:
-#ifndef CONFIG_SPL_BUILD
-       ldr     r0, _bss_start_ofs
-       ldr     r1, _bss_end_ofs
-       mov     r4, r6                  /* reloc addr */
-       add     r0, r0, r4
-       add     r1, r1, r4
-       mov     r2, #0x00000000         /* clear                            */
-
-clbss_l:cmp    r0, r1                  /* clear loop... */
-       bhs     clbss_e                 /* if reached end of bss, exit */
-       str     r2, [r0]
-       add     r0, r0, #4
-       b       clbss_l
-clbss_e:
-#endif
-
-/*
- * We are done. Do not return, instead branch to second part of board
- * initialization, now running from RAM.
- */
-#ifdef CONFIG_NAND_SPL
-       ldr     pc, _nand_boot
+relocate_done:
 
-_nand_boot: .word nand_boot
-#else
-       ldr     r0, _board_init_r_ofs
-       adr     r1, _start
-       add     lr, r0, r1
-       add     lr, lr, r9
-       /* setup parameters for board_init_r */
-       mov     r0, r5          /* gd_t */
-       mov     r1, r6          /* dest_addr */
-       /* jump to it ... */
        mov     pc, lr
 
-_board_init_r_ofs:
-       .word board_init_r - _start
-#endif
-
 _rel_dyn_start_ofs:
        .word __rel_dyn_start - _start
 _rel_dyn_end_ofs:
@@ -275,6 +230,11 @@ _rel_dyn_end_ofs:
 _dynsym_start_ofs:
        .word __dynsym_start - _start
 
+       .globl  c_runtime_cpu_setup
+c_runtime_cpu_setup:
+
+       mov     pc, lr
+
 /*
  *************************************************************************
  *
index a133d19bc88f863c6b5c036133ff3eec7d548fba..c189849fa844775b4cfa9234291aca9ff39f53b6 100644 (file)
@@ -143,12 +143,7 @@ reset:
        bl      cpu_init_crit
 #endif
 
-/* Set stackpointer in internal RAM to call board_init_f */
-call_board_init_f:
-       ldr     sp, =(CONFIG_SYS_INIT_SP_ADDR)
-       bic     sp, sp, #7 /* 8-byte alignment for ABI compliance */
-       ldr     r0,=0x00000000
-       bl      board_init_f
+       bl      _main
 
 /*------------------------------------------------------------------------------*/
 
@@ -165,14 +160,10 @@ relocate_code:
        mov     r5, r1  /* save addr of gd */
        mov     r6, r2  /* save addr of destination */
 
-       /* Set up the stack                                                 */
-stack_setup:
-       mov     sp, r4
-
        adr     r0, _start
        cmp     r0, r6
        moveq   r9, #0          /* no relocation. relocation offset(r9) = 0 */
-       beq     clear_bss               /* skip relocation */
+       beq     relocate_done           /* skip relocation */
        mov     r1, r6                  /* r1 <- scratch for copy_loop */
        ldr     r3, _bss_start_ofs
        add     r2, r0, r3              /* r2 <- source end address         */
@@ -224,50 +215,9 @@ fixnext:
        blo     fixloop
 #endif
 
-clear_bss:
-#ifndef CONFIG_SPL_BUILD
-       ldr     r0, _bss_start_ofs
-       ldr     r1, _bss_end_ofs
-       mov     r4, r6                  /* reloc addr */
-       add     r0, r0, r4
-       add     r1, r1, r4
-       mov     r2, #0x00000000         /* clear                            */
-
-clbss_l:cmp    r0, r1                  /* clear loop... */
-       bhs     clbss_e                 /* if reached end of bss, exit */
-       str     r2, [r0]
-       add     r0, r0, #4
-       b       clbss_l
-clbss_e:
-
-       bl coloured_LED_init
-       bl red_led_on
-#endif
+relocate_done:
 
-/*
- * We are done. Do not return, instead branch to second part of board
- * initialization, now running from RAM.
- */
-#ifdef CONFIG_NAND_SPL
-       ldr     r0, _nand_boot_ofs
-       mov     pc, r0
-
-_nand_boot_ofs:
-       .word nand_boot
-#else
-       ldr     r0, _board_init_r_ofs
-       adr     r1, _start
-       add     lr, r0, r1
-       add     lr, lr, r9
-       /* setup parameters for board_init_r */
-       mov     r0, r5          /* gd_t */
-       mov     r1, r6          /* dest_addr */
-       /* jump to it ... */
-       mov     pc, lr
-
-_board_init_r_ofs:
-       .word board_init_r - _start
-#endif
+       bx      lr
 
 _rel_dyn_start_ofs:
        .word __rel_dyn_start - _start
@@ -276,6 +226,11 @@ _rel_dyn_end_ofs:
 _dynsym_start_ofs:
        .word __dynsym_start - _start
 
+       .globl  c_runtime_cpu_setup
+c_runtime_cpu_setup:
+
+       mov     pc, lr
+
 /*
  *************************************************************************
  *
index 74875b32558c2957415ee177320fcb1daa9dad77..70c443edbbb0a4ebd53f741cc0e53a3de15129e2 100644 (file)
@@ -18,10 +18,12 @@ LIB = $(obj)lib$(SOC).o
 
 COBJS  += clock.o
 COBJS  += sys_info.o
+COBJS  += mem.o
 COBJS  += ddr.o
 COBJS  += emif4.o
 COBJS  += board.o
 COBJS  += mux.o
+COBJS-$(CONFIG_NAND_OMAP_GPMC) += elm.o
 
 SRCS   := $(SOBJS:.o=.S) $(COBJS:.o=.c)
 OBJS   := $(addprefix $(obj),$(COBJS) $(COBJS-y) $(SOBJS))
index da5bc731852c428078fe76fa484240096f62c6a0..ab313265d0c43553cc89b507570b05e3c0acfadb 100644 (file)
@@ -25,6 +25,7 @@
 #include <asm/arch/ddr_defs.h>
 #include <asm/arch/clock.h>
 #include <asm/arch/gpio.h>
+#include <asm/arch/mem.h>
 #include <asm/arch/mmc_host_def.h>
 #include <asm/arch/sys_proto.h>
 #include <asm/io.h>
index 0b4cb4e529e6c5301c7809890355e41d68fd5ece..d7d98d1111e0ed5495caa98045bbc5ab8bb897fc 100644 (file)
@@ -151,6 +151,16 @@ static void enable_per_clocks(void)
                ;
 #endif /* CONFIG_SERIAL6 */
 
+       /* GPMC */
+       writel(PRCM_MOD_EN, &cmper->gpmcclkctrl);
+       while (readl(&cmper->gpmcclkctrl) != PRCM_MOD_EN)
+               ;
+
+       /* ELM */
+       writel(PRCM_MOD_EN, &cmper->elmclkctrl);
+       while (readl(&cmper->elmclkctrl) != PRCM_MOD_EN)
+               ;
+
        /* MMC0*/
        writel(PRCM_MOD_EN, &cmper->mmc0clkctrl);
        while (readl(&cmper->mmc0clkctrl) != PRCM_MOD_EN)
diff --git a/arch/arm/cpu/armv7/am33xx/elm.c b/arch/arm/cpu/armv7/am33xx/elm.c
new file mode 100644 (file)
index 0000000..9eed23d
--- /dev/null
@@ -0,0 +1,212 @@
+/*
+ * (C) Copyright 2010-2011 Texas Instruments, <www.ti.com>
+ * Mansoor Ahamed <mansoor.ahamed@ti.com>
+ *
+ * BCH Error Location Module (ELM) support.
+ *
+ * NOTE:
+ * 1. Supports only continuous mode. Dont see need for page mode in uboot
+ * 2. Supports only syndrome polynomial 0. i.e. poly local variable is
+ *    always set to ELM_DEFAULT_POLY. Dont see need for other polynomial
+ *    sets in uboot
+ *
+ * See file CREDITS for 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/errno.h>
+#include <asm/arch/cpu.h>
+#include <asm/arch/omap_gpmc.h>
+#include <asm/arch/elm.h>
+
+#define ELM_DEFAULT_POLY (0)
+
+struct elm *elm_cfg;
+
+/**
+ * elm_load_syndromes - Load BCH syndromes based on nibble selection
+ * @syndrome: BCH syndrome
+ * @nibbles:
+ * @poly: Syndrome Polynomial set to use
+ *
+ * Load BCH syndromes based on nibble selection
+ */
+static void elm_load_syndromes(u8 *syndrome, u32 nibbles, u8 poly)
+{
+       u32 *ptr;
+       u32 val;
+
+       /* reg 0 */
+       ptr = &elm_cfg->syndrome_fragments[poly].syndrome_fragment_x[0];
+       val = syndrome[0] | (syndrome[1] << 8) | (syndrome[2] << 16) |
+                               (syndrome[3] << 24);
+       writel(val, ptr);
+       /* reg 1 */
+       ptr = &elm_cfg->syndrome_fragments[poly].syndrome_fragment_x[1];
+       val = syndrome[4] | (syndrome[5] << 8) | (syndrome[6] << 16) |
+                               (syndrome[7] << 24);
+       writel(val, ptr);
+
+       /* BCH 8-bit with 26 nibbles (4*8=32) */
+       if (nibbles > 13) {
+               /* reg 2 */
+               ptr = &elm_cfg->syndrome_fragments[poly].syndrome_fragment_x[2];
+               val = syndrome[8] | (syndrome[9] << 8) | (syndrome[10] << 16) |
+                               (syndrome[11] << 24);
+               writel(val, ptr);
+               /* reg 3 */
+               ptr = &elm_cfg->syndrome_fragments[poly].syndrome_fragment_x[3];
+               val = syndrome[12] | (syndrome[13] << 8) |
+                       (syndrome[14] << 16) | (syndrome[15] << 24);
+               writel(val, ptr);
+       }
+
+       /* BCH 16-bit with 52 nibbles (7*8=56) */
+       if (nibbles > 26) {
+               /* reg 4 */
+               ptr = &elm_cfg->syndrome_fragments[poly].syndrome_fragment_x[4];
+               val = syndrome[16] | (syndrome[17] << 8) |
+                       (syndrome[18] << 16) | (syndrome[19] << 24);
+               writel(val, ptr);
+
+               /* reg 5 */
+               ptr = &elm_cfg->syndrome_fragments[poly].syndrome_fragment_x[5];
+               val = syndrome[20] | (syndrome[21] << 8) |
+                       (syndrome[22] << 16) | (syndrome[23] << 24);
+               writel(val, ptr);
+
+               /* reg 6 */
+               ptr = &elm_cfg->syndrome_fragments[poly].syndrome_fragment_x[6];
+               val = syndrome[24] | (syndrome[25] << 8) |
+                       (syndrome[26] << 16) | (syndrome[27] << 24);
+               writel(val, ptr);
+       }
+}
+
+/**
+ * elm_check_errors - Check for BCH errors and return error locations
+ * @syndrome: BCH syndrome
+ * @nibbles:
+ * @error_count: Returns number of errrors in the syndrome
+ * @error_locations: Returns error locations (in decimal) in this array
+ *
+ * Check the provided syndrome for BCH errors and return error count
+ * and locations in the array passed. Returns -1 if error is not correctable,
+ * else returns 0
+ */
+int elm_check_error(u8 *syndrome, u32 nibbles, u32 *error_count,
+               u32 *error_locations)
+{
+       u8 poly = ELM_DEFAULT_POLY;
+       s8 i;
+       u32 location_status;
+
+       elm_load_syndromes(syndrome, nibbles, poly);
+
+       /* start processing */
+       writel((readl(&elm_cfg->syndrome_fragments[poly].syndrome_fragment_x[6])
+                               | ELM_SYNDROME_FRAGMENT_6_SYNDROME_VALID),
+               &elm_cfg->syndrome_fragments[poly].syndrome_fragment_x[6]);
+
+       /* wait for processing to complete */
+       while ((readl(&elm_cfg->irqstatus) & (0x1 << poly)) != 0x1)
+               ;
+       /* clear status */
+       writel((readl(&elm_cfg->irqstatus) | (0x1 << poly)),
+                       &elm_cfg->irqstatus);
+
+       /* check if correctable */
+       location_status = readl(&elm_cfg->error_location[poly].location_status);
+       if (!(location_status & ELM_LOCATION_STATUS_ECC_CORRECTABLE_MASK))
+               return -1;
+
+       /* get error count */
+       *error_count = readl(&elm_cfg->error_location[poly].location_status) &
+                                       ELM_LOCATION_STATUS_ECC_NB_ERRORS_MASK;
+
+       for (i = 0; i < *error_count; i++) {
+               error_locations[i] =
+                       readl(&elm_cfg->error_location[poly].error_location_x[i]);
+       }
+
+       return 0;
+}
+
+
+/**
+ * elm_config - Configure ELM module
+ * @level: 4 / 8 / 16 bit BCH
+ *
+ * Configure ELM module based on BCH level.
+ * Set mode as continuous mode.
+ * Currently we are using only syndrome 0 and syndromes 1 to 6 are not used.
+ * Also, the mode is set only for syndrome 0
+ */
+int elm_config(enum bch_level level)
+{
+       u32 val;
+       u8 poly = ELM_DEFAULT_POLY;
+       u32 buffer_size = 0x7FF;
+
+       /* config size and level */
+       val = (u32)(level) & ELM_LOCATION_CONFIG_ECC_BCH_LEVEL_MASK;
+       val |= ((buffer_size << ELM_LOCATION_CONFIG_ECC_SIZE_POS) &
+                               ELM_LOCATION_CONFIG_ECC_SIZE_MASK);
+       writel(val, &elm_cfg->location_config);
+
+       /* config continous mode */
+       /* enable interrupt generation for syndrome polynomial set */
+       writel((readl(&elm_cfg->irqenable) | (0x1 << poly)),
+                       &elm_cfg->irqenable);
+       /* set continuous mode for the syndrome polynomial set */
+       writel((readl(&elm_cfg->page_ctrl) & ~(0x1 << poly)),
+                       &elm_cfg->page_ctrl);
+
+       return 0;
+}
+
+/**
+ * elm_reset - Do a soft reset of ELM
+ *
+ * Perform a soft reset of ELM and return after reset is done.
+ */
+void elm_reset(void)
+{
+       /* initiate reset */
+       writel((readl(&elm_cfg->sysconfig) | ELM_SYSCONFIG_SOFTRESET),
+                               &elm_cfg->sysconfig);
+
+       /* wait for reset complete and normal operation */
+       while ((readl(&elm_cfg->sysstatus) & ELM_SYSSTATUS_RESETDONE) !=
+               ELM_SYSSTATUS_RESETDONE)
+               ;
+}
+
+/**
+ * elm_init - Initialize ELM module
+ *
+ * Initialize ELM support. Currently it does only base address init
+ * and ELM reset.
+ */
+void elm_init(void)
+{
+       elm_cfg = (struct elm *)ELM_BASE;
+       elm_reset();
+}
diff --git a/arch/arm/cpu/armv7/am33xx/mem.c b/arch/arm/cpu/armv7/am33xx/mem.c
new file mode 100644 (file)
index 0000000..b8f54ab
--- /dev/null
@@ -0,0 +1,101 @@
+/*
+ * (C) Copyright 2010
+ * Texas Instruments, <www.ti.com>
+ *
+ * Author :
+ *     Mansoor Ahamed <mansoor.ahamed@ti.com>
+ *
+ * Initial Code from:
+ *     Manikandan Pillai <mani.pillai@ti.com>
+ *     Richard Woodruff <r-woodruff2@ti.com>
+ *     Syed Mohammed Khasim <khasim@ti.com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+#include <common.h>
+#include <asm/io.h>
+#include <asm/arch/cpu.h>
+#include <asm/arch/mem.h>
+#include <asm/arch/sys_proto.h>
+#include <command.h>
+
+struct gpmc *gpmc_cfg;
+
+#if defined(CONFIG_CMD_NAND)
+static const u32 gpmc_m_nand[GPMC_MAX_REG] = {
+       M_NAND_GPMC_CONFIG1,
+       M_NAND_GPMC_CONFIG2,
+       M_NAND_GPMC_CONFIG3,
+       M_NAND_GPMC_CONFIG4,
+       M_NAND_GPMC_CONFIG5,
+       M_NAND_GPMC_CONFIG6, 0
+};
+#endif
+
+
+void enable_gpmc_cs_config(const u32 *gpmc_config, struct gpmc_cs *cs, u32 base,
+                       u32 size)
+{
+       writel(0, &cs->config7);
+       sdelay(1000);
+       /* Delay for settling */
+       writel(gpmc_config[0], &cs->config1);
+       writel(gpmc_config[1], &cs->config2);
+       writel(gpmc_config[2], &cs->config3);
+       writel(gpmc_config[3], &cs->config4);
+       writel(gpmc_config[4], &cs->config5);
+       writel(gpmc_config[5], &cs->config6);
+       /* Enable the config */
+       writel((((size & 0xF) << 8) | ((base >> 24) & 0x3F) |
+               (1 << 6)), &cs->config7);
+       sdelay(2000);
+}
+
+/*****************************************************
+ * gpmc_init(): init gpmc bus
+ * Init GPMC for x16, MuxMode (SDRAM in x32).
+ * This code can only be executed from SRAM or SDRAM.
+ *****************************************************/
+void gpmc_init(void)
+{
+       /* putting a blanket check on GPMC based on ZeBu for now */
+       gpmc_cfg = (struct gpmc *)GPMC_BASE;
+
+#ifdef CONFIG_CMD_NAND
+       const u32 *gpmc_config = NULL;
+       u32 base = 0;
+       u32 size = 0;
+#endif
+       /* global settings */
+       writel(0x00000008, &gpmc_cfg->sysconfig);
+       writel(0x00000100, &gpmc_cfg->irqstatus);
+       writel(0x00000200, &gpmc_cfg->irqenable);
+       writel(0x00000012, &gpmc_cfg->config);
+       /*
+        * Disable the GPMC0 config set by ROM code
+        */
+       writel(0, &gpmc_cfg->cs[0].config7);
+       sdelay(1000);
+
+#ifdef CONFIG_CMD_NAND
+       gpmc_config = gpmc_m_nand;
+
+       base = PISMO1_NAND_BASE;
+       size = PISMO1_NAND_SIZE;
+       enable_gpmc_cs_config(gpmc_config, &gpmc_cfg->cs[0], base, size);
+#endif
+}
index 1b4e808a79c74ff91f955bf24ec2007e27250828..5f6d0396f3af877c5cbc7abf4eef9f16c28a9699 100644 (file)
@@ -297,6 +297,12 @@ void arm_init_before_mmu(void)
        v7_inval_tlb();
 }
 
+void mmu_page_table_flush(unsigned long start, unsigned long stop)
+{
+       flush_dcache_range(start, stop);
+       v7_inval_tlb();
+}
+
 /*
  * Flush range from all levels of d-cache/unified-cache used:
  * Affects the range [start, start + size - 1]
@@ -329,6 +335,11 @@ void arm_init_before_mmu(void)
 void  flush_cache(unsigned long start, unsigned long size)
 {
 }
+
+void mmu_page_table_flush(unsigned long start, unsigned long stop)
+{
+}
+
 #endif /* #ifndef CONFIG_SYS_DCACHE_OFF */
 
 #ifndef CONFIG_SYS_ICACHE_OFF
index 21e45d2e828cb2913666cd7ec0358ab2aee7471f..956427c9ebbfe9dd9a9ed8b763ecd25c7f75482e 100644 (file)
 #include <asm/io.h>
 #include <asm/arch/clock.h>
 #include <asm/arch/clk.h>
-
-/* exynos4: return pll clock frequency */
-static unsigned long exynos4_get_pll_clk(int pllreg)
+#include <asm/arch/periph.h>
+
+/* Epll Clock division values to achive different frequency output */
+static struct set_epll_con_val exynos5_epll_div[] = {
+       { 192000000, 0, 48, 3, 1, 0 },
+       { 180000000, 0, 45, 3, 1, 0 },
+       {  73728000, 1, 73, 3, 3, 47710 },
+       {  67737600, 1, 90, 4, 3, 20762 },
+       {  49152000, 0, 49, 3, 3, 9961 },
+       {  45158400, 0, 45, 3, 3, 10381 },
+       { 180633600, 0, 45, 3, 1, 10381 }
+};
+
+/* exynos: return pll clock frequency */
+static int exynos_get_pll_clk(int pllreg, unsigned int r, unsigned int k)
 {
-       struct exynos4_clock *clk =
-               (struct exynos4_clock *)samsung_get_base_clock();
-       unsigned long r, m, p, s, k = 0, mask, fout;
+       unsigned long m, p, s = 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]
+        * BPLL_CON: MIDV [25:16]: Exynos5
         */
-       if (pllreg == APLL || pllreg == MPLL)
+       if (pllreg == APLL || pllreg == MPLL || pllreg == BPLL)
                mask = 0x3ff;
        else
                mask = 0x1ff;
@@ -92,13 +82,73 @@ static unsigned long exynos4_get_pll_clk(int pllreg)
        return fout;
 }
 
+/* exynos4: return pll clock frequency */
+static unsigned long exynos4_get_pll_clk(int pllreg)
+{
+       struct exynos4_clock *clk =
+               (struct exynos4_clock *)samsung_get_base_clock();
+       unsigned long r, k = 0;
+
+       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;
+       }
+
+       return exynos_get_pll_clk(pllreg, r, k);
+}
+
+/* exynos4x12: return pll clock frequency */
+static unsigned long exynos4x12_get_pll_clk(int pllreg)
+{
+       struct exynos4x12_clock *clk =
+               (struct exynos4x12_clock *)samsung_get_base_clock();
+       unsigned long r, k = 0;
+
+       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;
+       }
+
+       return exynos_get_pll_clk(pllreg, r, k);
+}
+
 /* 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, pll_div2_sel, fout_sel;
+       unsigned long r, k = 0, fout;
+       unsigned int pll_div2_sel, fout_sel;
 
        switch (pllreg) {
        case APLL:
@@ -123,41 +173,7 @@ static unsigned long exynos5_get_pll_clk(int pllreg)
                return 0;
        }
 
-       /*
-        * APLL_CON: MIDV [25:16]
-        * MPLL_CON: MIDV [25:16]
-        * EPLL_CON: MIDV [24:16]
-        * VPLL_CON: MIDV [24:16]
-        * BPLL_CON: MIDV [25:16]
-        */
-       if (pllreg == APLL || pllreg == MPLL || pllreg == BPLL)
-               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;
-               /* 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))));
-       }
+       fout = exynos_get_pll_clk(pllreg, r, k);
 
        /* According to the user manual, in EVT1 MPLL and BPLL always gives
         * 1.6GHz clock, so divide by 2 to get 800MHz MPLL clock.*/
@@ -207,6 +223,28 @@ static unsigned long exynos4_get_arm_clk(void)
        return armclk;
 }
 
+/* exynos4x12: return ARM clock frequency */
+static unsigned long exynos4x12_get_arm_clk(void)
+{
+       struct exynos4x12_clock *clk =
+               (struct exynos4x12_clock *)samsung_get_base_clock();
+       unsigned long div;
+       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)
 {
@@ -272,6 +310,20 @@ static unsigned long exynos4_get_pwm_clk(void)
        return pclk;
 }
 
+/* exynos4x12: return pwm clock frequency */
+static unsigned long exynos4x12_get_pwm_clk(void)
+{
+       unsigned long pclk, sclk;
+       unsigned int ratio;
+
+       sclk = get_pll_clk(MPLL);
+       ratio = 8;
+
+       pclk = sclk / (ratio + 1);
+
+       return pclk;
+}
+
 /* exynos5: return pwm clock frequency */
 static unsigned long exynos5_get_pwm_clk(void)
 {
@@ -340,6 +392,51 @@ static unsigned long exynos4_get_uart_clk(int dev_index)
        return uclk;
 }
 
+/* exynos4x12: return uart clock frequency */
+static unsigned long exynos4x12_get_uart_clk(int dev_index)
+{
+       struct exynos4x12_clock *clk =
+               (struct exynos4x12_clock *)samsung_get_base_clock();
+       unsigned long uclk, sclk;
+       unsigned int sel;
+       unsigned int ratio;
+
+       /*
+        * CLK_SRC_PERIL0
+        * UART0_SEL [3:0]
+        * UART1_SEL [7:4]
+        * UART2_SEL [8:11]
+        * UART3_SEL [12:15]
+        * UART4_SEL [16:19]
+        */
+       sel = readl(&clk->src_peril0);
+       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_PERIL0
+        * UART0_RATIO [3:0]
+        * UART1_RATIO [7:4]
+        * UART2_RATIO [8:11]
+        * UART3_RATIO [12:15]
+        * UART4_RATIO [16:19]
+        */
+       ratio = readl(&clk->div_peril0);
+       ratio = (ratio >> (dev_index << 2)) & 0xf;
+
+       uclk = sclk / (ratio + 1);
+
+       return uclk;
+}
+
 /* exynos5: return uart clock frequency */
 static unsigned long exynos5_get_uart_clk(int dev_index)
 {
@@ -387,6 +484,100 @@ static unsigned long exynos5_get_uart_clk(int dev_index)
        return uclk;
 }
 
+static unsigned long exynos4_get_mmc_clk(int dev_index)
+{
+       struct exynos4_clock *clk =
+               (struct exynos4_clock *)samsung_get_base_clock();
+       unsigned long uclk, sclk;
+       unsigned int sel, ratio, pre_ratio;
+       int shift;
+
+       sel = readl(&clk->src_fsys);
+       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;
+
+       switch (dev_index) {
+       case 0:
+       case 1:
+               ratio = readl(&clk->div_fsys1);
+               pre_ratio = readl(&clk->div_fsys1);
+               break;
+       case 2:
+       case 3:
+               ratio = readl(&clk->div_fsys2);
+               pre_ratio = readl(&clk->div_fsys2);
+               break;
+       case 4:
+               ratio = readl(&clk->div_fsys3);
+               pre_ratio = readl(&clk->div_fsys3);
+               break;
+       default:
+               return 0;
+       }
+
+       if (dev_index == 1 || dev_index == 3)
+               shift = 16;
+
+       ratio = (ratio >> shift) & 0xf;
+       pre_ratio = (pre_ratio >> (shift + 8)) & 0xff;
+       uclk = (sclk / (ratio + 1)) / (pre_ratio + 1);
+
+       return uclk;
+}
+
+static unsigned long exynos5_get_mmc_clk(int dev_index)
+{
+       struct exynos5_clock *clk =
+               (struct exynos5_clock *)samsung_get_base_clock();
+       unsigned long uclk, sclk;
+       unsigned int sel, ratio, pre_ratio;
+       int shift;
+
+       sel = readl(&clk->src_fsys);
+       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;
+
+       switch (dev_index) {
+       case 0:
+       case 1:
+               ratio = readl(&clk->div_fsys1);
+               pre_ratio = readl(&clk->div_fsys1);
+               break;
+       case 2:
+       case 3:
+               ratio = readl(&clk->div_fsys2);
+               pre_ratio = readl(&clk->div_fsys2);
+               break;
+       default:
+               return 0;
+       }
+
+       if (dev_index == 1 || dev_index == 3)
+               shift = 16;
+
+       ratio = (ratio >> shift) & 0xf;
+       pre_ratio = (pre_ratio >> (shift + 8)) & 0xff;
+       uclk = (sclk / (ratio + 1)) / (pre_ratio + 1);
+
+       return uclk;
+}
+
 /* exynos4: set the mmc clock */
 static void exynos4_set_mmc_clk(int dev_index, unsigned int div)
 {
@@ -395,6 +586,38 @@ static void exynos4_set_mmc_clk(int dev_index, unsigned int div)
        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]
+        * CLK_DIV_FSYS3
+        * MMC4_PRE_RATIO [15:8]
+        */
+       if (dev_index < 2) {
+               addr = (unsigned int)&clk->div_fsys1;
+       }  else if (dev_index == 4) {
+               addr = (unsigned int)&clk->div_fsys3;
+               dev_index -= 4;
+       } 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);
+}
+
+/* exynos4x12: set the mmc clock */
+static void exynos4x12_set_mmc_clk(int dev_index, unsigned int div)
+{
+       struct exynos4x12_clock *clk =
+               (struct exynos4x12_clock *)samsung_get_base_clock();
+       unsigned int addr;
+       unsigned int val;
+
        /*
         * CLK_DIV_FSYS1
         * MMC0_PRE_RATIO [15:8], MMC1_PRE_RATIO [31:24]
@@ -617,7 +840,7 @@ void exynos5_set_lcd_clk(void)
         */
        cfg = readl(&clk->src_disp1_0);
        cfg &= ~(0xf);
-       cfg |= 0x8;
+       cfg |= 0x6;
        writel(cfg, &clk->src_disp1_0);
 
        /*
@@ -732,6 +955,209 @@ static unsigned long exynos5_get_i2c_clk(void)
        return aclk_66;
 }
 
+int exynos5_set_epll_clk(unsigned long rate)
+{
+       unsigned int epll_con, epll_con_k;
+       unsigned int i;
+       unsigned int lockcnt;
+       unsigned int start;
+       struct exynos5_clock *clk =
+               (struct exynos5_clock *)samsung_get_base_clock();
+
+       epll_con = readl(&clk->epll_con0);
+       epll_con &= ~((EPLL_CON0_LOCK_DET_EN_MASK <<
+                       EPLL_CON0_LOCK_DET_EN_SHIFT) |
+               EPLL_CON0_MDIV_MASK << EPLL_CON0_MDIV_SHIFT |
+               EPLL_CON0_PDIV_MASK << EPLL_CON0_PDIV_SHIFT |
+               EPLL_CON0_SDIV_MASK << EPLL_CON0_SDIV_SHIFT);
+
+       for (i = 0; i < ARRAY_SIZE(exynos5_epll_div); i++) {
+               if (exynos5_epll_div[i].freq_out == rate)
+                       break;
+       }
+
+       if (i == ARRAY_SIZE(exynos5_epll_div))
+               return -1;
+
+       epll_con_k = exynos5_epll_div[i].k_dsm << 0;
+       epll_con |= exynos5_epll_div[i].en_lock_det <<
+                               EPLL_CON0_LOCK_DET_EN_SHIFT;
+       epll_con |= exynos5_epll_div[i].m_div << EPLL_CON0_MDIV_SHIFT;
+       epll_con |= exynos5_epll_div[i].p_div << EPLL_CON0_PDIV_SHIFT;
+       epll_con |= exynos5_epll_div[i].s_div << EPLL_CON0_SDIV_SHIFT;
+
+       /*
+        * Required period ( in cycles) to genarate a stable clock output.
+        * The maximum clock time can be up to 3000 * PDIV cycles of PLLs
+        * frequency input (as per spec)
+        */
+       lockcnt = 3000 * exynos5_epll_div[i].p_div;
+
+       writel(lockcnt, &clk->epll_lock);
+       writel(epll_con, &clk->epll_con0);
+       writel(epll_con_k, &clk->epll_con1);
+
+       start = get_timer(0);
+
+        while (!(readl(&clk->epll_con0) &
+                       (0x1 << EXYNOS5_EPLLCON0_LOCKED_SHIFT))) {
+               if (get_timer(start) > TIMEOUT_EPLL_LOCK) {
+                       debug("%s: Timeout waiting for EPLL lock\n", __func__);
+                       return -1;
+               }
+       }
+       return 0;
+}
+
+void exynos5_set_i2s_clk_source(void)
+{
+       struct exynos5_clock *clk =
+               (struct exynos5_clock *)samsung_get_base_clock();
+
+       clrsetbits_le32(&clk->src_peric1, AUDIO1_SEL_MASK,
+                       (CLK_SRC_SCLK_EPLL));
+}
+
+int exynos5_set_i2s_clk_prescaler(unsigned int src_frq,
+                                       unsigned int dst_frq)
+{
+       struct exynos5_clock *clk =
+               (struct exynos5_clock *)samsung_get_base_clock();
+       unsigned int div;
+
+       if ((dst_frq == 0) || (src_frq == 0)) {
+               debug("%s: Invalid requency input for prescaler\n", __func__);
+               debug("src frq = %d des frq = %d ", src_frq, dst_frq);
+               return -1;
+       }
+
+       div = (src_frq / dst_frq);
+       if (div > AUDIO_1_RATIO_MASK) {
+               debug("%s: Frequency ratio is out of range\n", __func__);
+               debug("src frq = %d des frq = %d ", src_frq, dst_frq);
+               return -1;
+       }
+       clrsetbits_le32(&clk->div_peric4, AUDIO_1_RATIO_MASK,
+                               (div & AUDIO_1_RATIO_MASK));
+       return 0;
+}
+
+/**
+ * Linearly searches for the most accurate main and fine stage clock scalars
+ * (divisors) for a specified target frequency and scalar bit sizes by checking
+ * all multiples of main_scalar_bits values. Will always return scalars up to or
+ * slower than target.
+ *
+ * @param main_scalar_bits     Number of main scalar bits, must be > 0 and < 32
+ * @param fine_scalar_bits     Number of fine scalar bits, must be > 0 and < 32
+ * @param input_freq           Clock frequency to be scaled in Hz
+ * @param target_freq          Desired clock frequency in Hz
+ * @param best_fine_scalar     Pointer to store the fine stage divisor
+ *
+ * @return best_main_scalar    Main scalar for desired frequency or -1 if none
+ * found
+ */
+static int clock_calc_best_scalar(unsigned int main_scaler_bits,
+       unsigned int fine_scalar_bits, unsigned int input_rate,
+       unsigned int target_rate, unsigned int *best_fine_scalar)
+{
+       int i;
+       int best_main_scalar = -1;
+       unsigned int best_error = target_rate;
+       const unsigned int cap = (1 << fine_scalar_bits) - 1;
+       const unsigned int loops = 1 << main_scaler_bits;
+
+       debug("Input Rate is %u, Target is %u, Cap is %u\n", input_rate,
+                       target_rate, cap);
+
+       assert(best_fine_scalar != NULL);
+       assert(main_scaler_bits <= fine_scalar_bits);
+
+       *best_fine_scalar = 1;
+
+       if (input_rate == 0 || target_rate == 0)
+               return -1;
+
+       if (target_rate >= input_rate)
+               return 1;
+
+       for (i = 1; i <= loops; i++) {
+               const unsigned int effective_div = max(min(input_rate / i /
+                                                       target_rate, cap), 1);
+               const unsigned int effective_rate = input_rate / i /
+                                                       effective_div;
+               const int error = target_rate - effective_rate;
+
+               debug("%d|effdiv:%u, effrate:%u, error:%d\n", i, effective_div,
+                               effective_rate, error);
+
+               if (error >= 0 && error <= best_error) {
+                       best_error = error;
+                       best_main_scalar = i;
+                       *best_fine_scalar = effective_div;
+               }
+       }
+
+       return best_main_scalar;
+}
+
+static int exynos5_set_spi_clk(enum periph_id periph_id,
+                                       unsigned int rate)
+{
+       struct exynos5_clock *clk =
+               (struct exynos5_clock *)samsung_get_base_clock();
+       int main;
+       unsigned int fine;
+       unsigned shift, pre_shift;
+       unsigned mask = 0xff;
+       u32 *reg;
+
+       main = clock_calc_best_scalar(4, 8, 400000000, rate, &fine);
+       if (main < 0) {
+               debug("%s: Cannot set clock rate for periph %d",
+                               __func__, periph_id);
+               return -1;
+       }
+       main = main - 1;
+       fine = fine - 1;
+
+       switch (periph_id) {
+       case PERIPH_ID_SPI0:
+               reg = &clk->div_peric1;
+               shift = 0;
+               pre_shift = 8;
+               break;
+       case PERIPH_ID_SPI1:
+               reg = &clk->div_peric1;
+               shift = 16;
+               pre_shift = 24;
+               break;
+       case PERIPH_ID_SPI2:
+               reg = &clk->div_peric2;
+               shift = 0;
+               pre_shift = 8;
+               break;
+       case PERIPH_ID_SPI3:
+               reg = &clk->sclk_div_isp;
+               shift = 0;
+               pre_shift = 4;
+               break;
+       case PERIPH_ID_SPI4:
+               reg = &clk->sclk_div_isp;
+               shift = 12;
+               pre_shift = 16;
+               break;
+       default:
+               debug("%s: Unsupported peripheral ID %d\n", __func__,
+                     periph_id);
+               return -1;
+       }
+       clrsetbits_le32(reg, mask << shift, (main & mask) << shift);
+       clrsetbits_le32(reg, mask << pre_shift, (fine & mask) << pre_shift);
+
+       return 0;
+}
+
 static unsigned long exynos4_get_i2c_clk(void)
 {
        struct exynos4_clock *clk =
@@ -751,16 +1177,22 @@ unsigned long get_pll_clk(int pllreg)
 {
        if (cpu_is_exynos5())
                return exynos5_get_pll_clk(pllreg);
-       else
+       else {
+               if (proid_is_exynos4412())
+                       return exynos4x12_get_pll_clk(pllreg);
                return exynos4_get_pll_clk(pllreg);
+       }
 }
 
 unsigned long get_arm_clk(void)
 {
        if (cpu_is_exynos5())
                return exynos5_get_arm_clk();
-       else
+       else {
+               if (proid_is_exynos4412())
+                       return exynos4x12_get_arm_clk();
                return exynos4_get_arm_clk();
+       }
 }
 
 unsigned long get_i2c_clk(void)
@@ -779,24 +1211,41 @@ unsigned long get_pwm_clk(void)
 {
        if (cpu_is_exynos5())
                return exynos5_get_pwm_clk();
-       else
+       else {
+               if (proid_is_exynos4412())
+                       return exynos4x12_get_pwm_clk();
                return exynos4_get_pwm_clk();
+       }
 }
 
 unsigned long get_uart_clk(int dev_index)
 {
        if (cpu_is_exynos5())
                return exynos5_get_uart_clk(dev_index);
-       else
+       else {
+               if (proid_is_exynos4412())
+                       return exynos4x12_get_uart_clk(dev_index);
                return exynos4_get_uart_clk(dev_index);
+       }
+}
+
+unsigned long get_mmc_clk(int dev_index)
+{
+       if (cpu_is_exynos5())
+               return exynos5_get_mmc_clk(dev_index);
+       else
+               return exynos4_get_mmc_clk(dev_index);
 }
 
 void set_mmc_clk(int dev_index, unsigned int div)
 {
        if (cpu_is_exynos5())
                exynos5_set_mmc_clk(dev_index, div);
-       else
+       else {
+               if (proid_is_exynos4412())
+                       exynos4x12_set_mmc_clk(dev_index, div);
                exynos4_set_mmc_clk(dev_index, div);
+       }
 }
 
 unsigned long get_lcd_clk(void)
@@ -820,3 +1269,34 @@ void set_mipi_clk(void)
        if (cpu_is_exynos4())
                exynos4_set_mipi_clk();
 }
+
+int set_spi_clk(int periph_id, unsigned int rate)
+{
+       if (cpu_is_exynos5())
+               return exynos5_set_spi_clk(periph_id, rate);
+       else
+               return 0;
+}
+
+int set_i2s_clk_prescaler(unsigned int src_frq, unsigned int dst_frq)
+{
+
+       if (cpu_is_exynos5())
+               return exynos5_set_i2s_clk_prescaler(src_frq, dst_frq);
+       else
+               return 0;
+}
+
+void set_i2s_clk_source(void)
+{
+       if (cpu_is_exynos5())
+               exynos5_set_i2s_clk_source();
+}
+
+int set_epll_clk(unsigned long rate)
+{
+       if (cpu_is_exynos5())
+               return exynos5_set_epll_clk(rate);
+       else
+               return 0;
+}
index 44ce0726e992f7f08b6df8b8c3d1fdba234de9d9..bd499b47614ca2b1af126642931fa627d14f45ca 100644 (file)
@@ -22,6 +22,7 @@
  */
 
 #include <common.h>
+#include <fdtdec.h>
 #include <asm/arch/gpio.h>
 #include <asm/arch/pinmux.h>
 #include <asm/arch/sromc.h>
@@ -112,6 +113,7 @@ static int exynos5_mmc_config(int peripheral, int flags)
                s5p_gpio_set_pull(bank, i, GPIO_PULL_UP);
                s5p_gpio_set_drv(bank, i, GPIO_DRV_4X);
        }
+
        return 0;
 }
 
@@ -230,6 +232,59 @@ static void exynos5_i2c_config(int peripheral, int flags)
        }
 }
 
+static void exynos5_i2s_config(int peripheral)
+{
+       int i;
+       struct exynos5_gpio_part1 *gpio1 =
+               (struct exynos5_gpio_part1 *) samsung_get_base_gpio_part1();
+
+       for (i = 0; i < 5; i++)
+               s5p_gpio_cfg_pin(&gpio1->b0, i, GPIO_FUNC(0x02));
+}
+
+void exynos5_spi_config(int peripheral)
+{
+       int cfg = 0, pin = 0, i;
+       struct s5p_gpio_bank *bank = NULL;
+       struct exynos5_gpio_part1 *gpio1 =
+               (struct exynos5_gpio_part1 *) samsung_get_base_gpio_part1();
+       struct exynos5_gpio_part2 *gpio2 =
+               (struct exynos5_gpio_part2 *) samsung_get_base_gpio_part2();
+
+       switch (peripheral) {
+       case PERIPH_ID_SPI0:
+               bank = &gpio1->a2;
+               cfg = GPIO_FUNC(0x2);
+               pin = 0;
+               break;
+       case PERIPH_ID_SPI1:
+               bank = &gpio1->a2;
+               cfg = GPIO_FUNC(0x2);
+               pin = 4;
+               break;
+       case PERIPH_ID_SPI2:
+               bank = &gpio1->b1;
+               cfg = GPIO_FUNC(0x5);
+               pin = 1;
+               break;
+       case PERIPH_ID_SPI3:
+               bank = &gpio2->f1;
+               cfg = GPIO_FUNC(0x2);
+               pin = 0;
+               break;
+       case PERIPH_ID_SPI4:
+               for (i = 0; i < 2; i++) {
+                       s5p_gpio_cfg_pin(&gpio2->f0, i + 2, GPIO_FUNC(0x4));
+                       s5p_gpio_cfg_pin(&gpio2->e0, i + 4, GPIO_FUNC(0x4));
+               }
+               break;
+       }
+       if (peripheral != PERIPH_ID_SPI4) {
+               for (i = pin; i < pin + 4; i++)
+                       s5p_gpio_cfg_pin(bank, i, cfg);
+       }
+}
+
 static int exynos5_pinmux_config(int peripheral, int flags)
 {
        switch (peripheral) {
@@ -257,6 +312,16 @@ static int exynos5_pinmux_config(int peripheral, int flags)
        case PERIPH_ID_I2C7:
                exynos5_i2c_config(peripheral, flags);
                break;
+       case PERIPH_ID_I2S1:
+               exynos5_i2s_config(peripheral);
+               break;
+       case PERIPH_ID_SPI0:
+       case PERIPH_ID_SPI1:
+       case PERIPH_ID_SPI2:
+       case PERIPH_ID_SPI3:
+       case PERIPH_ID_SPI4:
+               exynos5_spi_config(peripheral);
+               break;
        default:
                debug("%s: invalid peripheral %d", __func__, peripheral);
                return -1;
@@ -306,6 +371,43 @@ static void exynos4_i2c_config(int peripheral, int flags)
        }
 }
 
+static int exynos4_mmc_config(int peripheral, int flags)
+{
+       struct exynos4_gpio_part2 *gpio2 =
+               (struct exynos4_gpio_part2 *)samsung_get_base_gpio_part2();
+       struct s5p_gpio_bank *bank, *bank_ext;
+       int i;
+
+       switch (peripheral) {
+       case PERIPH_ID_SDMMC0:
+               bank = &gpio2->k0;
+               bank_ext = &gpio2->k1;
+               break;
+       case PERIPH_ID_SDMMC2:
+               bank = &gpio2->k2;
+               bank_ext = &gpio2->k3;
+               break;
+       default:
+               return -1;
+       }
+       for (i = 0; i < 7; i++) {
+               if (i == 2)
+                       continue;
+               s5p_gpio_cfg_pin(bank, i,  GPIO_FUNC(0x2));
+               s5p_gpio_set_pull(bank, i, GPIO_PULL_NONE);
+               s5p_gpio_set_drv(bank, i, GPIO_DRV_4X);
+       }
+       if (flags & PINMUX_FLAG_8BIT_MODE) {
+               for (i = 3; i < 7; i++) {
+                       s5p_gpio_cfg_pin(bank_ext, i,  GPIO_FUNC(0x3));
+                       s5p_gpio_set_pull(bank_ext, i, GPIO_PULL_NONE);
+                       s5p_gpio_set_drv(bank_ext, i, GPIO_DRV_4X);
+               }
+       }
+
+       return 0;
+}
+
 static int exynos4_pinmux_config(int peripheral, int flags)
 {
        switch (peripheral) {
@@ -319,6 +421,14 @@ static int exynos4_pinmux_config(int peripheral, int flags)
        case PERIPH_ID_I2C7:
                exynos4_i2c_config(peripheral, flags);
                break;
+       case PERIPH_ID_SDMMC0:
+       case PERIPH_ID_SDMMC2:
+               return exynos4_mmc_config(peripheral, flags);
+       case PERIPH_ID_SDMMC1:
+       case PERIPH_ID_SDMMC3:
+       case PERIPH_ID_SDMMC4:
+               printf("SDMMC device %d not implemented\n", peripheral);
+               return -1;
        default:
                debug("%s: invalid peripheral %d", __func__, peripheral);
                return -1;
@@ -338,3 +448,31 @@ int exynos_pinmux_config(int peripheral, int flags)
                return -1;
        }
 }
+
+#ifdef CONFIG_OF_CONTROL
+static int exynos5_pinmux_decode_periph_id(const void *blob, int node)
+{
+       int err;
+       u32 cell[3];
+
+       err = fdtdec_get_int_array(blob, node, "interrupts", cell,
+                                       ARRAY_SIZE(cell));
+       if (err)
+               return PERIPH_ID_NONE;
+
+       /* check for invalid peripheral id */
+       if ((PERIPH_ID_SDMMC4 > cell[1]) || (cell[1] < PERIPH_ID_UART0))
+               return cell[1];
+
+       debug(" invalid peripheral id\n");
+       return PERIPH_ID_NONE;
+}
+
+int pinmux_decode_periph_id(const void *blob, int node)
+{
+       if (cpu_is_exynos5())
+               return  exynos5_pinmux_decode_periph_id(blob, node);
+       else
+               return PERIPH_ID_NONE;
+}
+#endif
index 1c9223fa0783072f77a4aabdb4db225c0ae49856..76c2c529a88fb72e7a5f96e9497725b48e1f6646 100644 (file)
@@ -928,7 +928,9 @@ int do_mx5_showclocks(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
        printf("IPG        %8d kHz\n", mxc_get_clock(MXC_IPG_CLK) / 1000);
        printf("IPG PERCLK %8d kHz\n", mxc_get_clock(MXC_IPG_PERCLK) / 1000);
        printf("DDR        %8d kHz\n", mxc_get_clock(MXC_DDR_CLK) / 1000);
-
+#ifdef CONFIG_MXC_SPI
+       printf("CSPI       %8d kHz\n", mxc_get_clock(MXC_CSPI_CLK) / 1000);
+#endif
        return 0;
 }
 
index 29ec95797baebacf4ea849da93291f624cf9abf5..6d9396a97670d87aad34358129b037fbceb40478 100644 (file)
@@ -396,7 +396,7 @@ ENTRY(lowlevel_init)
        mov r10, lr
        mov r4, #0      /* Fix R4 to 0 */
 
-#if defined(CONFIG_MX51)
+#if defined(CONFIG_SYS_MAIN_PWR_ON)
        ldr r0, =GPIO1_BASE_ADDR
        ldr r1, [r0, #0x0]
        orr r1, r1, #1 << 23
index a01d96f48e04377d705b7a587ec7b3ea59aee283..a50db70b19e45da1810cf82e2cb63496446e3eb9 100644 (file)
@@ -404,7 +404,9 @@ int do_mx6_showclocks(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
        printf("\n");
        printf("IPG        %8d kHz\n", mxc_get_clock(MXC_IPG_CLK) / 1000);
        printf("UART       %8d kHz\n", mxc_get_clock(MXC_UART_CLK) / 1000);
+#ifdef CONFIG_MXC_SPI
        printf("CSPI       %8d kHz\n", mxc_get_clock(MXC_CSPI_CLK) / 1000);
+#endif
        printf("AHB        %8d kHz\n", mxc_get_clock(MXC_AHB_CLK) / 1000);
        printf("AXI        %8d kHz\n", mxc_get_clock(MXC_AXI_CLK) / 1000);
        printf("DDR        %8d kHz\n", mxc_get_clock(MXC_DDR_CLK) / 1000);
index acadef221c8e845873c56563be1a20385aeda964..7b60ca7454b88319aaf832f573087ca0213d2b8b 100644 (file)
 
 #include <linux/linkage.h>
 
+.macro init_arm_errata
+       /* ARM erratum ID #743622 */
+       mrc     p15, 0, r10, c15, c0, 1         /* read diagnostic register */
+       orr     r10, r10, #1 << 6               /* set bit #6 */
+       /* ARM erratum ID #751472 */
+       orr     r10, r10, #1 << 11              /* set bit #11 */
+       mcr     p15, 0, r10, c15, c0, 1         /* write diagnostic register */
+.endm
+
 ENTRY(lowlevel_init)
+       init_arm_errata
        mov pc, lr
 ENDPROC(lowlevel_init)
index bc65767e7d8d934105dcfa6bb2f5c92a71341fe9..a8aad5dd0a6c8548277021ebe8f6e159dbf31b9b 100644 (file)
 #include <asm/arch/sys_proto.h>
 #include <asm/imx-common/boot_mode.h>
 
+struct scu_regs {
+       u32     ctrl;
+       u32     config;
+       u32     status;
+       u32     invalidate;
+       u32     fpga_rev;
+};
+
 u32 get_cpu_rev(void)
 {
        struct anatop_regs *anatop = (struct anatop_regs *)ANATOP_BASE_ADDR;
-       int reg = readl(&anatop->digprog);
-
-       /* Read mx6 variant: quad, dual or solo */
-       int system_rev = (reg >> 4) & 0xFF000;
-       /* Read mx6 silicon revision */
-       system_rev |= (reg & 0xFF) + 0x10;
-
-       return system_rev;
+       u32 reg = readl(&anatop->digprog_sololite);
+       u32 type = ((reg >> 16) & 0xff);
+
+       if (type != MXC_CPU_MX6SL) {
+               reg = readl(&anatop->digprog);
+               type = ((reg >> 16) & 0xff);
+               if (type == MXC_CPU_MX6DL) {
+                       struct scu_regs *scu = (struct scu_regs *)SCU_BASE_ADDR;
+                       u32 cfg = readl(&scu->config) & 3;
+
+                       if (!cfg)
+                               type = MXC_CPU_MX6SOLO;
+               }
+       }
+       reg &= 0xff;            /* mx6 silicon revision */
+       return (type << 12) | (reg + 0x10);
 }
 
 void init_aips(void)
index 1f2fa027c8f84198ab90e2afeb3ff9aa1e5d494b..0efc80ddeb486e5e154091304225ae042d3f1f16 100644 (file)
@@ -25,9 +25,8 @@ include $(TOPDIR)/config.mk
 
 LIB    = $(obj)libomap-common.o
 
-SOBJS  := reset.o
-
-COBJS  := timer.o
+COBJS  := reset.o
+COBJS  += timer.o
 COBJS  += utils.o
 
 ifneq ($(CONFIG_OMAP44XX)$(CONFIG_OMAP54XX),)
index 0f19141cc23ab362c5c66f5ff4d907cd2bb29067..2b584e0a53755ec0164a0412a9449a57760af13f 100644 (file)
@@ -21,6 +21,7 @@
 #include <asm/omap_common.h>
 #include <asm/arch/omap.h>
 #include <asm/arch/mmc_host_def.h>
+#include <asm/arch/sys_proto.h>
 
 /*
  * This is used to verify if the configuration header
index 30dcf1b0b04ec1112a8dead33762c289c8915001..88253cf8ce3e5bf1128d70f08d22bacdfddb09b4 100644 (file)
@@ -33,6 +33,8 @@
 #include <asm/utils.h>
 #include <linux/compiler.h>
 
+static int emif1_enabled = -1, emif2_enabled = -1;
+
 void set_lpmode_selfrefresh(u32 base)
 {
        struct emif_reg_struct *emif = (struct emif_reg_struct *)base;
@@ -1109,6 +1111,7 @@ void emif_post_init_config(u32 base)
 void dmm_init(u32 base)
 {
        const struct dmm_lisa_map_regs *lisa_map_regs;
+       u32 i, section, valid;
 
 #ifdef CONFIG_SYS_EMIF_PRECALCULATED_TIMING_REGS
        emif_get_dmm_regs(&lisa_map_regs);
@@ -1216,6 +1219,29 @@ void dmm_init(u32 base)
                writel(lisa_map_regs->dmm_lisa_map_0,
                        &hw_lisa_map_regs->dmm_lisa_map_0);
        }
+
+       /*
+        * EMIF should be configured only when
+        * memory is mapped on it. Using emif1_enabled
+        * and emif2_enabled variables for this.
+        */
+       emif1_enabled = 0;
+       emif2_enabled = 0;
+       for (i = 0; i < 4; i++) {
+               section = __raw_readl(DMM_BASE + i*4);
+               valid = (section & EMIF_SDRC_MAP_MASK) >>
+                       (EMIF_SDRC_MAP_SHIFT);
+               if (valid == 3) {
+                       emif1_enabled = 1;
+                       emif2_enabled = 1;
+                       break;
+               } else if (valid == 1) {
+                       emif1_enabled = 1;
+               } else if (valid == 2) {
+                       emif2_enabled = 1;
+               }
+       }
+
 }
 
 /*
@@ -1255,15 +1281,20 @@ void sdram_init(void)
                        writel(CM_DLL_CTRL_NO_OVERRIDE, &prcm->cm_dll_ctrl);
        }
 
-       do_sdram_init(EMIF1_BASE);
-       do_sdram_init(EMIF2_BASE);
-
        if (!in_sdram)
                dmm_init(DMM_BASE);
 
+       if (emif1_enabled)
+               do_sdram_init(EMIF1_BASE);
+
+       if (emif2_enabled)
+               do_sdram_init(EMIF2_BASE);
+
        if (!(in_sdram || warm_reset())) {
-               emif_post_init_config(EMIF1_BASE);
-               emif_post_init_config(EMIF2_BASE);
+               if (emif1_enabled)
+                       emif_post_init_config(EMIF1_BASE);
+               if (emif2_enabled)
+                       emif_post_init_config(EMIF2_BASE);
        }
 
        /* for the shadow registers to take effect */
index f3cd81ad98879b05b55bab3017b22f71b4bffe4b..89c587e3108aca523f71a3f3823a2e220fb43c6a 100644 (file)
@@ -478,7 +478,7 @@ void omap3_outer_cache_disable(void)
         */
        omap3_update_aux_cr(0, 0x2);
 }
-#endif
+#endif /* !CONFIG_SYS_L2CACHE_OFF */
 
 #ifndef CONFIG_SYS_DCACHE_OFF
 void enable_caches(void)
@@ -486,4 +486,4 @@ void enable_caches(void)
        /* Enable D-cache. I-cache is already enabled in start.S */
        dcache_enable();
 }
-#endif
+#endif /* !CONFIG_SYS_DCACHE_OFF */
index 2fe5ac7c3946d4a8f4b09d7dcc85ce441c47bfce..d04a5a10d75e887b2d19516ee6d7ed19de70aa57 100644 (file)
@@ -42,14 +42,7 @@ static const u32 gpmc_m_nand[GPMC_MAX_REG] = {
        M_NAND_GPMC_CONFIG5,
        M_NAND_GPMC_CONFIG6, 0
 };
-
-#if defined(CONFIG_ENV_IS_IN_NAND)
-#define GPMC_CS 0
-#else
-#define GPMC_CS 1
-#endif
-
-#endif
+#endif /* CONFIG_CMD_NAND */
 
 #if defined(CONFIG_CMD_ONENAND)
 static const u32 gpmc_onenand[GPMC_MAX_REG] = {
@@ -60,14 +53,7 @@ static const u32 gpmc_onenand[GPMC_MAX_REG] = {
        ONENAND_GPMC_CONFIG5,
        ONENAND_GPMC_CONFIG6, 0
 };
-
-#if defined(CONFIG_ENV_IS_IN_ONENAND)
-#define GPMC_CS 0
-#else
-#define GPMC_CS 1
-#endif
-
-#endif
+#endif /* CONFIG_CMD_ONENAND */
 
 /********************************************************
  *  mem_ok() - test used to see if timings are correct
index f6d9b97bb4dcb6df17380c675ecaf96d3afe08ae..e32bf118b182ca9b893dce64597c9d54d70b06ea 100644 (file)
@@ -113,18 +113,18 @@ u32 get_sdr_cs_offset(u32 cs)
  *  - Test CS to make sure it's OK for use
  */
 static void write_sdrc_timings(u32 cs, struct sdrc_actim *sdrc_actim_base,
-               u32 mcfg, u32 ctrla, u32 ctrlb, u32 rfr_ctrl, u32 mr)
+                       struct board_sdrc_timings *timings)
 {
        /* Setup timings we got from the board. */
-       writel(mcfg, &sdrc_base->cs[cs].mcfg);
-       writel(ctrla, &sdrc_actim_base->ctrla);
-       writel(ctrlb, &sdrc_actim_base->ctrlb);
-       writel(rfr_ctrl, &sdrc_base->cs[cs].rfr_ctrl);
+       writel(timings->mcfg, &sdrc_base->cs[cs].mcfg);
+       writel(timings->ctrla, &sdrc_actim_base->ctrla);
+       writel(timings->ctrlb, &sdrc_actim_base->ctrlb);
+       writel(timings->rfr_ctrl, &sdrc_base->cs[cs].rfr_ctrl);
        writel(CMD_NOP, &sdrc_base->cs[cs].manual);
        writel(CMD_PRECHARGE, &sdrc_base->cs[cs].manual);
        writel(CMD_AUTOREFRESH, &sdrc_base->cs[cs].manual);
        writel(CMD_AUTOREFRESH, &sdrc_base->cs[cs].manual);
-       writel(mr, &sdrc_base->cs[cs].mr);
+       writel(timings->mr, &sdrc_base->cs[cs].mr);
 
        /*
         * Test ram in this bank
@@ -143,7 +143,7 @@ static void write_sdrc_timings(u32 cs, struct sdrc_actim *sdrc_actim_base,
 void do_sdrc_init(u32 cs, u32 early)
 {
        struct sdrc_actim *sdrc_actim_base0, *sdrc_actim_base1;
-       u32 mcfg, ctrla, ctrlb, rfr_ctrl, mr;
+       struct board_sdrc_timings timings;
 
        sdrc_actim_base0 = (struct sdrc_actim *)SDRC_ACTIM_CTRL0_BASE;
        sdrc_actim_base1 = (struct sdrc_actim *)SDRC_ACTIM_CTRL1_BASE;
@@ -158,7 +158,7 @@ void do_sdrc_init(u32 cs, u32 early)
         * setup CS1.
         */
 #ifdef CONFIG_SPL_BUILD
-       get_board_mem_timings(&mcfg, &ctrla, &ctrlb, &rfr_ctrl, &mr);
+       get_board_mem_timings(&timings);
 #endif
        if (early) {
                /* reset sdrc controller */
@@ -177,11 +177,9 @@ void do_sdrc_init(u32 cs, u32 early)
                writel(ENADLL | DLLPHASE_90, &sdrc_base->dlla_ctrl);
                sdelay(0x20000);
 #ifdef CONFIG_SPL_BUILD
-               write_sdrc_timings(CS0, sdrc_actim_base0, mcfg, ctrla, ctrlb,
-                               rfr_ctrl, mr);
+               write_sdrc_timings(CS0, sdrc_actim_base0, &timings);
                make_cs1_contiguous();
-               write_sdrc_timings(CS1, sdrc_actim_base1, mcfg, ctrla, ctrlb,
-                               rfr_ctrl, mr);
+               write_sdrc_timings(CS1, sdrc_actim_base1, &timings);
 #endif
 
        }
@@ -193,14 +191,12 @@ void do_sdrc_init(u32 cs, u32 early)
         * so we may be asked now to setup CS1.
         */
        if (cs == CS1) {
-               mcfg = readl(&sdrc_base->cs[CS0].mcfg),
-               rfr_ctrl = readl(&sdrc_base->cs[CS0].rfr_ctrl);
-               ctrla = readl(&sdrc_actim_base0->ctrla),
-               ctrlb = readl(&sdrc_actim_base0->ctrlb);
-               mr = readl(&sdrc_base->cs[CS0].mr);
-               write_sdrc_timings(cs, sdrc_actim_base1, mcfg, ctrla, ctrlb,
-                               rfr_ctrl, mr);
-
+               timings.mcfg = readl(&sdrc_base->cs[CS0].mcfg),
+               timings.rfr_ctrl = readl(&sdrc_base->cs[CS0].rfr_ctrl);
+               timings.ctrla = readl(&sdrc_actim_base0->ctrla);
+               timings.ctrlb = readl(&sdrc_actim_base0->ctrlb);
+               timings.mr = readl(&sdrc_base->cs[CS0].mr);
+               write_sdrc_timings(cs, sdrc_actim_base1, &timings);
        }
 }
 
index 5bd0a88fdeb2b730a096602ca01702f63d7afe96..12c58033d2600371c78ab8ae8de40216c1e83c55 100644 (file)
@@ -44,7 +44,7 @@
  */
 #define printf(fmt, args...)
 #define puts(s)
-#endif
+#endif /* !CONFIG_SPL_BUILD */
 
 struct omap4_prcm_regs *const prcm = (struct omap4_prcm_regs *)0x4A004100;
 
index 2c34e48f42854ae8227b29adf2dc5f39459fd8c4..f4123aaffca6a8b0bc5564b904d60b8d998f901d 100644 (file)
@@ -116,7 +116,7 @@ void do_io_settings(void)
        if ((omap4_rev < OMAP4460_ES1_0) || !readl(&ctrl->control_efuse_2))
                writel(CONTROL_EFUSE_2_OVERRIDE, &ctrl->control_efuse_2);
 }
-#endif
+#endif /* CONFIG_SPL_BUILD */
 
 /* dummy fuction for omap4 */
 void config_data_eye_leveling_samples(u32 emif_base)
@@ -182,4 +182,4 @@ void v7_outer_cache_disable(void)
 {
        set_pl310_ctrl_reg(0);
 }
-#endif
+#endif /* !CONFIG_SYS_L2CACHE_OFF */
index f975f3f06c9fbca7f1fe904eae34d5f57f2dde4a..17053995bd61aa21e26ee20b8917528b09400c41 100644 (file)
@@ -28,7 +28,6 @@ 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
deleted file mode 100644 (file)
index 94acc1e..0000000
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * 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 7df97c5a3a663a88c01e68ffcfb7b91e4bbcc6b8..dcc1f831bc814a2b47fd034815091561859b7000 100644 (file)
@@ -155,12 +155,7 @@ reset:
        bl      cpu_init_crit
 #endif
 
-/* Set stackpointer in internal RAM to call board_init_f */
-call_board_init_f:
-       ldr     sp, =(CONFIG_SYS_INIT_SP_ADDR)
-       bic     sp, sp, #7 /* 8-byte alignment for ABI compliance */
-       ldr     r0,=0x00000000
-       bl      board_init_f
+       bl      _main
 
 /*------------------------------------------------------------------------------*/
 
@@ -177,14 +172,10 @@ ENTRY(relocate_code)
        mov     r5, r1  /* save addr of gd */
        mov     r6, r2  /* save addr of destination */
 
-       /* Set up the stack                                                 */
-stack_setup:
-       mov     sp, r4
-
        adr     r0, _start
        cmp     r0, r6
        moveq   r9, #0          /* no relocation. relocation offset(r9) = 0 */
-       beq     clear_bss               /* skip relocation */
+       beq     relocate_done           /* skip relocation */
        mov     r1, r6                  /* r1 <- scratch for copy_loop */
        ldr     r3, _image_copy_end_ofs
        add     r2, r0, r3              /* r2 <- source end address         */
@@ -233,34 +224,22 @@ fixnext:
        add     r2, r2, #8              /* each rel.dyn entry is 8 bytes */
        cmp     r2, r3
        blo     fixloop
-       b       clear_bss
+
+relocate_done:
+
+       bx      lr
+
 _rel_dyn_start_ofs:
        .word __rel_dyn_start - _start
 _rel_dyn_end_ofs:
        .word __rel_dyn_end - _start
 _dynsym_start_ofs:
        .word __dynsym_start - _start
+ENDPROC(relocate_code)
 
-clear_bss:
-       ldr     r0, _bss_start_ofs
-       ldr     r1, _bss_end_ofs
-       mov     r4, r6                  /* reloc addr */
-       add     r0, r0, r4
-       add     r1, r1, r4
-       mov     r2, #0x00000000         /* clear                            */
-
-clbss_l:cmp    r0, r1                  /* clear loop... */
-       bhs     clbss_e                 /* if reached end of bss, exit */
-       str     r2, [r0]
-       add     r0, r0, #4
-       b       clbss_l
-clbss_e:
+#endif
 
-/*
- * We are done. Do not return, instead branch to second part of board
- * initialization, now running from RAM.
- */
-jump_2_ram:
+ENTRY(c_runtime_cpu_setup)
 /*
  * If I-cache is enabled invalidate it
  */
@@ -279,20 +258,9 @@ jump_2_ram:
        mcr     p15, 0, r0, c12, c0, 0  @Set VBAR
 #endif /* !Tegra20 */
 
-       ldr     r0, _board_init_r_ofs
-       adr     r1, _start
-       add     lr, r0, r1
-       add     lr, lr, r9
-       /* setup parameters for board_init_r */
-       mov     r0, r5          /* gd_t */
-       mov     r1, r6          /* dest_addr */
-       /* jump to it ... */
-       mov     pc, lr
-
-_board_init_r_ofs:
-       .word board_init_r - _start
-ENDPROC(relocate_code)
-#endif
+       bx      lr
+
+ENDPROC(c_runtime_cpu_setup)
 
 /*************************************************************************
  *
index 09a0314d0d9e664b799e4d131871a49b83c3c72e..54ed8c48b40814a6436a7fb0918ea3e1504a02a1 100644 (file)
@@ -28,6 +28,8 @@ include $(TOPDIR)/config.mk
 LIB    =  $(obj)lib$(SOC).o
 
 COBJS-$(CONFIG_USB_EHCI_TEGRA) += usb.o
+COBJS-$(CONFIG_PWM_TEGRA) += pwm.o
+COBJS-$(CONFIG_VIDEO_TEGRA) += display.o
 
 COBJS  := $(COBJS-y)
 SRCS   := $(COBJS:.o=.c)
diff --git a/arch/arm/cpu/armv7/tegra20/display.c b/arch/arm/cpu/armv7/tegra20/display.c
new file mode 100644 (file)
index 0000000..031f9a8
--- /dev/null
@@ -0,0 +1,409 @@
+/*
+ *  (C) Copyright 2010
+ *  NVIDIA Corporation <www.nvidia.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/clock.h>
+#include <asm/arch/tegra.h>
+#include <asm/arch/display.h>
+#include <asm/arch/dc.h>
+#include <asm/arch-tegra/clk_rst.h>
+#include <asm/arch-tegra/timer.h>
+
+static struct fdt_disp_config config;
+
+static void update_window(struct dc_ctlr *dc, struct disp_ctl_win *win)
+{
+       unsigned h_dda, v_dda;
+       unsigned long val;
+
+       val = readl(&dc->cmd.disp_win_header);
+       val |= WINDOW_A_SELECT;
+       writel(val, &dc->cmd.disp_win_header);
+
+       writel(win->fmt, &dc->win.color_depth);
+
+       clrsetbits_le32(&dc->win.byte_swap, BYTE_SWAP_MASK,
+                       BYTE_SWAP_NOSWAP << BYTE_SWAP_SHIFT);
+
+       val = win->out_x << H_POSITION_SHIFT;
+       val |= win->out_y << V_POSITION_SHIFT;
+       writel(val, &dc->win.pos);
+
+       val = win->out_w << H_SIZE_SHIFT;
+       val |= win->out_h << V_SIZE_SHIFT;
+       writel(val, &dc->win.size);
+
+       val = (win->w * win->bpp / 8) << H_PRESCALED_SIZE_SHIFT;
+       val |= win->h << V_PRESCALED_SIZE_SHIFT;
+       writel(val, &dc->win.prescaled_size);
+
+       writel(0, &dc->win.h_initial_dda);
+       writel(0, &dc->win.v_initial_dda);
+
+       h_dda = (win->w * 0x1000) / max(win->out_w - 1, 1);
+       v_dda = (win->h * 0x1000) / max(win->out_h - 1, 1);
+
+       val = h_dda << H_DDA_INC_SHIFT;
+       val |= v_dda << V_DDA_INC_SHIFT;
+       writel(val, &dc->win.dda_increment);
+
+       writel(win->stride, &dc->win.line_stride);
+       writel(0, &dc->win.buf_stride);
+
+       val = WIN_ENABLE;
+       if (win->bpp < 24)
+               val |= COLOR_EXPAND;
+       writel(val, &dc->win.win_opt);
+
+       writel((unsigned long)win->phys_addr, &dc->winbuf.start_addr);
+       writel(win->x, &dc->winbuf.addr_h_offset);
+       writel(win->y, &dc->winbuf.addr_v_offset);
+
+       writel(0xff00, &dc->win.blend_nokey);
+       writel(0xff00, &dc->win.blend_1win);
+
+       val = GENERAL_ACT_REQ | WIN_A_ACT_REQ;
+       val |= GENERAL_UPDATE | WIN_A_UPDATE;
+       writel(val, &dc->cmd.state_ctrl);
+}
+
+static void write_pair(struct fdt_disp_config *config, int item, u32 *reg)
+{
+       writel(config->horiz_timing[item] |
+                       (config->vert_timing[item] << 16), reg);
+}
+
+static int update_display_mode(struct dc_disp_reg *disp,
+               struct fdt_disp_config *config)
+{
+       unsigned long val;
+       unsigned long rate;
+       unsigned long div;
+
+       writel(0x0, &disp->disp_timing_opt);
+       write_pair(config, FDT_LCD_TIMING_REF_TO_SYNC, &disp->ref_to_sync);
+       write_pair(config, FDT_LCD_TIMING_SYNC_WIDTH, &disp->sync_width);
+       write_pair(config, FDT_LCD_TIMING_BACK_PORCH, &disp->back_porch);
+       write_pair(config, FDT_LCD_TIMING_FRONT_PORCH, &disp->front_porch);
+
+       writel(config->width | (config->height << 16), &disp->disp_active);
+
+       val = DE_SELECT_ACTIVE << DE_SELECT_SHIFT;
+       val |= DE_CONTROL_NORMAL << DE_CONTROL_SHIFT;
+       writel(val, &disp->data_enable_opt);
+
+       val = DATA_FORMAT_DF1P1C << DATA_FORMAT_SHIFT;
+       val |= DATA_ALIGNMENT_MSB << DATA_ALIGNMENT_SHIFT;
+       val |= DATA_ORDER_RED_BLUE << DATA_ORDER_SHIFT;
+       writel(val, &disp->disp_interface_ctrl);
+
+       /*
+        * The pixel clock divider is in 7.1 format (where the bottom bit
+        * represents 0.5). Here we calculate the divider needed to get from
+        * the display clock (typically 600MHz) to the pixel clock. We round
+        * up or down as requried.
+        */
+       rate = clock_get_periph_rate(PERIPH_ID_DISP1, CLOCK_ID_CGENERAL);
+       div = ((rate * 2 + config->pixel_clock / 2) / config->pixel_clock) - 2;
+       debug("Display clock %lu, divider %lu\n", rate, div);
+
+       writel(0x00010001, &disp->shift_clk_opt);
+
+       val = PIXEL_CLK_DIVIDER_PCD1 << PIXEL_CLK_DIVIDER_SHIFT;
+       val |= div << SHIFT_CLK_DIVIDER_SHIFT;
+       writel(val, &disp->disp_clk_ctrl);
+
+       return 0;
+}
+
+/* Start up the display and turn on power to PWMs */
+static void basic_init(struct dc_cmd_reg *cmd)
+{
+       u32 val;
+
+       writel(0x00000100, &cmd->gen_incr_syncpt_ctrl);
+       writel(0x0000011a, &cmd->cont_syncpt_vsync);
+       writel(0x00000000, &cmd->int_type);
+       writel(0x00000000, &cmd->int_polarity);
+       writel(0x00000000, &cmd->int_mask);
+       writel(0x00000000, &cmd->int_enb);
+
+       val = PW0_ENABLE | PW1_ENABLE | PW2_ENABLE;
+       val |= PW3_ENABLE | PW4_ENABLE | PM0_ENABLE;
+       val |= PM1_ENABLE;
+       writel(val, &cmd->disp_pow_ctrl);
+
+       val = readl(&cmd->disp_cmd);
+       val |= CTRL_MODE_C_DISPLAY << CTRL_MODE_SHIFT;
+       writel(val, &cmd->disp_cmd);
+}
+
+static void basic_init_timer(struct dc_disp_reg *disp)
+{
+       writel(0x00000020, &disp->mem_high_pri);
+       writel(0x00000001, &disp->mem_high_pri_timer);
+}
+
+static const u32 rgb_enb_tab[PIN_REG_COUNT] = {
+       0x00000000,
+       0x00000000,
+       0x00000000,
+       0x00000000,
+};
+
+static const u32 rgb_polarity_tab[PIN_REG_COUNT] = {
+       0x00000000,
+       0x01000000,
+       0x00000000,
+       0x00000000,
+};
+
+static const u32 rgb_data_tab[PIN_REG_COUNT] = {
+       0x00000000,
+       0x00000000,
+       0x00000000,
+       0x00000000,
+};
+
+static const u32 rgb_sel_tab[PIN_OUTPUT_SEL_COUNT] = {
+       0x00000000,
+       0x00000000,
+       0x00000000,
+       0x00000000,
+       0x00210222,
+       0x00002200,
+       0x00020000,
+};
+
+static void rgb_enable(struct dc_com_reg *com)
+{
+       int i;
+
+       for (i = 0; i < PIN_REG_COUNT; i++) {
+               writel(rgb_enb_tab[i], &com->pin_output_enb[i]);
+               writel(rgb_polarity_tab[i], &com->pin_output_polarity[i]);
+               writel(rgb_data_tab[i], &com->pin_output_data[i]);
+       }
+
+       for (i = 0; i < PIN_OUTPUT_SEL_COUNT; i++)
+               writel(rgb_sel_tab[i], &com->pin_output_sel[i]);
+}
+
+int setup_window(struct disp_ctl_win *win, struct fdt_disp_config *config)
+{
+       win->x = 0;
+       win->y = 0;
+       win->w = config->width;
+       win->h = config->height;
+       win->out_x = 0;
+       win->out_y = 0;
+       win->out_w = config->width;
+       win->out_h = config->height;
+       win->phys_addr = config->frame_buffer;
+       win->stride = config->width * (1 << config->log2_bpp) / 8;
+       debug("%s: depth = %d\n", __func__, config->log2_bpp);
+       switch (config->log2_bpp) {
+       case 5:
+       case 24:
+               win->fmt = COLOR_DEPTH_R8G8B8A8;
+               win->bpp = 32;
+               break;
+       case 4:
+               win->fmt = COLOR_DEPTH_B5G6R5;
+               win->bpp = 16;
+               break;
+
+       default:
+               debug("Unsupported LCD bit depth");
+               return -1;
+       }
+
+       return 0;
+}
+
+struct fdt_disp_config *tegra_display_get_config(void)
+{
+       return config.valid ? &config : NULL;
+}
+
+static void debug_timing(const char *name, unsigned int timing[])
+{
+#ifdef DEBUG
+       int i;
+
+       debug("%s timing: ", name);
+       for (i = 0; i < FDT_LCD_TIMING_COUNT; i++)
+               debug("%d ", timing[i]);
+       debug("\n");
+#endif
+}
+
+/**
+ * Decode panel information from the fdt, according to a standard binding
+ *
+ * @param blob         fdt blob
+ * @param node         offset of fdt node to read from
+ * @param config       structure to store fdt config into
+ * @return 0 if ok, -ve on error
+ */
+static int tegra_decode_panel(const void *blob, int node,
+                             struct fdt_disp_config *config)
+{
+       int front, back, ref;
+
+       config->width = fdtdec_get_int(blob, node, "xres", -1);
+       config->height = fdtdec_get_int(blob, node, "yres", -1);
+       config->pixel_clock = fdtdec_get_int(blob, node, "clock", 0);
+       if (!config->pixel_clock || config->width == -1 ||
+                       config->height == -1) {
+               debug("%s: Pixel parameters missing\n", __func__);
+               return -FDT_ERR_NOTFOUND;
+       }
+
+       back = fdtdec_get_int(blob, node, "left-margin", -1);
+       front = fdtdec_get_int(blob, node, "right-margin", -1);
+       ref = fdtdec_get_int(blob, node, "hsync-len", -1);
+       if ((back | front | ref) == -1) {
+               debug("%s: Horizontal parameters missing\n", __func__);
+               return -FDT_ERR_NOTFOUND;
+       }
+
+       /* Use a ref-to-sync of 1 always, and take this from the front porch */
+       config->horiz_timing[FDT_LCD_TIMING_REF_TO_SYNC] = 1;
+       config->horiz_timing[FDT_LCD_TIMING_SYNC_WIDTH] = ref;
+       config->horiz_timing[FDT_LCD_TIMING_BACK_PORCH] = back;
+       config->horiz_timing[FDT_LCD_TIMING_FRONT_PORCH] = front -
+               config->horiz_timing[FDT_LCD_TIMING_REF_TO_SYNC];
+       debug_timing("horiz", config->horiz_timing);
+
+       back = fdtdec_get_int(blob, node, "upper-margin", -1);
+       front = fdtdec_get_int(blob, node, "lower-margin", -1);
+       ref = fdtdec_get_int(blob, node, "vsync-len", -1);
+       if ((back | front | ref) == -1) {
+               debug("%s: Vertical parameters missing\n", __func__);
+               return -FDT_ERR_NOTFOUND;
+       }
+
+       config->vert_timing[FDT_LCD_TIMING_REF_TO_SYNC] = 1;
+       config->vert_timing[FDT_LCD_TIMING_SYNC_WIDTH] = ref;
+       config->vert_timing[FDT_LCD_TIMING_BACK_PORCH] = back;
+       config->vert_timing[FDT_LCD_TIMING_FRONT_PORCH] = front -
+               config->vert_timing[FDT_LCD_TIMING_REF_TO_SYNC];
+       debug_timing("vert", config->vert_timing);
+
+       return 0;
+}
+
+/**
+ * Decode the display controller information from the fdt.
+ *
+ * @param blob         fdt blob
+ * @param config       structure to store fdt config into
+ * @return 0 if ok, -ve on error
+ */
+static int tegra_display_decode_config(const void *blob,
+                                      struct fdt_disp_config *config)
+{
+       int node, rgb;
+       int bpp, bit;
+
+       /* TODO: Support multiple controllers */
+       node = fdtdec_next_compatible(blob, 0, COMPAT_NVIDIA_TEGRA20_DC);
+       if (node < 0) {
+               debug("%s: Cannot find display controller node in fdt\n",
+                     __func__);
+               return node;
+       }
+       config->disp = (struct disp_ctlr *)fdtdec_get_addr(blob, node, "reg");
+       if (!config->disp) {
+               debug("%s: No display controller address\n", __func__);
+               return -1;
+       }
+
+       rgb = fdt_subnode_offset(blob, node, "rgb");
+
+       config->panel_node = fdtdec_lookup_phandle(blob, rgb, "nvidia,panel");
+       if (!config->panel_node < 0) {
+               debug("%s: Cannot find panel information\n", __func__);
+               return -1;
+       }
+
+       if (tegra_decode_panel(blob, config->panel_node, config)) {
+               debug("%s: Failed to decode panel information\n", __func__);
+               return -1;
+       }
+
+       bpp = fdtdec_get_int(blob, config->panel_node, "nvidia,bits-per-pixel",
+                            -1);
+       bit = ffs(bpp) - 1;
+       if (bpp == (1 << bit))
+               config->log2_bpp = bit;
+       else
+               config->log2_bpp = bpp;
+       if (bpp == -1) {
+               debug("%s: Pixel bpp parameters missing\n", __func__);
+               return -FDT_ERR_NOTFOUND;
+       }
+       config->bpp = bpp;
+
+       config->valid = 1;      /* we have a valid configuration */
+
+       return 0;
+}
+
+int tegra_display_probe(const void *blob, void *default_lcd_base)
+{
+       struct disp_ctl_win window;
+       struct dc_ctlr *dc;
+
+       if (tegra_display_decode_config(blob, &config))
+               return -1;
+
+       config.frame_buffer = (u32)default_lcd_base;
+
+       dc = (struct dc_ctlr *)config.disp;
+
+       /*
+        * A header file for clock constants was NAKed upstream.
+        * TODO: Put this into the FDT and fdt_lcd struct when we have clock
+        * support there
+        */
+       clock_start_periph_pll(PERIPH_ID_HOST1X, CLOCK_ID_PERIPH,
+                              144 * 1000000);
+       clock_start_periph_pll(PERIPH_ID_DISP1, CLOCK_ID_CGENERAL,
+                              600 * 1000000);
+       basic_init(&dc->cmd);
+       basic_init_timer(&dc->disp);
+       rgb_enable(&dc->com);
+
+       if (config.pixel_clock)
+               update_display_mode(&dc->disp, &config);
+
+       if (setup_window(&window, &config))
+               return -1;
+
+       update_window(dc, &window);
+
+       return 0;
+}
diff --git a/arch/arm/cpu/armv7/tegra20/pwm.c b/arch/arm/cpu/armv7/tegra20/pwm.c
new file mode 100644 (file)
index 0000000..b655c5c
--- /dev/null
@@ -0,0 +1,101 @@
+/*
+ * Tegra2 pulse width frequency modulator definitions
+ *
+ * Copyright (c) 2011 The Chromium OS Authors.
+ * See file CREDITS for 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 <fdtdec.h>
+#include <asm/io.h>
+#include <asm/arch/clock.h>
+#include <asm/arch/pwm.h>
+
+struct pwm_info {
+       struct pwm_ctlr *pwm;           /* Registers for our pwm controller */
+       int pwm_node;                   /* PWM device tree node */
+} local;
+
+void pwm_enable(unsigned channel, int rate, int pulse_width, int freq_divider)
+{
+       u32 reg;
+
+       assert(channel < PWM_NUM_CHANNELS);
+
+       /* TODO: Can we use clock_adjust_periph_pll_div() here? */
+       clock_start_periph_pll(PERIPH_ID_PWM, CLOCK_ID_SFROM32KHZ, rate);
+
+       reg = PWM_ENABLE_MASK;
+       reg |= pulse_width << PWM_WIDTH_SHIFT;
+       reg |= freq_divider << PWM_DIVIDER_SHIFT;
+       writel(reg, &local.pwm[channel].control);
+       debug("%s: channel=%d, rate=%d\n", __func__, channel, rate);
+}
+
+int pwm_request(const void *blob, int node, const char *prop_name)
+{
+       int pwm_node;
+       u32 data[3];
+
+       if (fdtdec_get_int_array(blob, node, prop_name, data,
+                       ARRAY_SIZE(data))) {
+               debug("%s: Cannot decode PWM property '%s'\n", __func__,
+                     prop_name);
+               return -1;
+       }
+
+       pwm_node = fdt_node_offset_by_phandle(blob, data[0]);
+       if (pwm_node != local.pwm_node) {
+               debug("%s: PWM property '%s' phandle %d not recognised"
+                     "- expecting %d\n", __func__, prop_name, data[0],
+                     local.pwm_node);
+               return -1;
+       }
+       if (data[1] >= PWM_NUM_CHANNELS) {
+               debug("%s: PWM property '%s': invalid channel %u\n", __func__,
+                     prop_name, data[1]);
+               return -1;
+       }
+
+       /*
+        * TODO: We could maintain a list of requests, but it might not be
+        * worth it for U-Boot.
+        */
+       return data[1];
+}
+
+int pwm_init(const void *blob)
+{
+       local.pwm_node = fdtdec_next_compatible(blob, 0,
+                                               COMPAT_NVIDIA_TEGRA20_PWM);
+       if (local.pwm_node < 0) {
+               debug("%s: Cannot find device tree node\n", __func__);
+               return -1;
+       }
+
+       local.pwm = (struct pwm_ctlr *)fdtdec_get_addr(blob, local.pwm_node,
+                                                      "reg");
+       if (local.pwm == (struct pwm_ctlr *)FDT_ADDR_T_NONE) {
+               debug("%s: Cannot find pwm reg address\n", __func__);
+               return -1;
+       }
+       debug("Tegra PWM at %p, node %d\n", local.pwm, local.pwm_node);
+
+       return 0;
+}
index c12f1a7db8a5bb99c78ccaaf7f7ef4bd53245704..efb5a400cf67cc9c2732af97714a751b4c2c5c07 100644 (file)
@@ -245,12 +245,7 @@ reset:
        orr     r0,r0,#0x13
        msr     cpsr,r0
 
-/* Set initial stackpointer in SDRAM to call board_init_f */
-call_board_init_f:
-       ldr     sp, =(CONFIG_SYS_INIT_SP_ADDR)
-       bic     sp, sp, #7 /* 8-byte alignment for ABI compliance */
-       ldr     r0,=0x00000000
-       bl      board_init_f
+       bl      _main
 
 /*------------------------------------------------------------------------------*/
 
@@ -267,14 +262,10 @@ relocate_code:
        mov     r5, r1  /* save addr of gd */
        mov     r6, r2  /* save addr of destination */
 
-       /* Set up the stack                                                 */
-stack_setup:
-       mov     sp, r4
-
        adr     r0, _start
        cmp     r0, r6
        moveq   r9, #0          /* no relocation. relocation offset(r9) = 0 */
-       beq     clear_bss               /* skip relocation */
+       beq     relocate_done           /* skip relocation */
        mov     r1, r6                  /* r1 <- scratch for copy_loop */
        ldr     r3, _bss_start_ofs
        add     r2, r0, r3              /* r2 <- source end address         */
@@ -326,42 +317,9 @@ fixnext:
        blo     fixloop
 #endif
 
-clear_bss:
-#ifndef CONFIG_SPL_BUILD
-       ldr     r0, _bss_start_ofs
-       ldr     r1, _bss_end_ofs
-       mov     r4, r6                  /* reloc addr */
-       add     r0, r0, r4
-       add     r1, r1, r4
-       mov     r2, #0x00000000         /* clear                            */
-
-clbss_l:cmp    r0, r1                  /* clear loop... */
-       bhs     clbss_e                 /* if reached end of bss, exit */
-       str     r2, [r0]
-       add     r0, r0, #4
-       b       clbss_l
-clbss_e:
-
-       bl coloured_LED_init
-       bl red_led_on
-#endif
+relocate_done:
 
-/*
- * We are done. Do not return, instead branch to second part of board
- * initialization, now running from RAM.
- */
-       ldr     r0, _board_init_r_ofs
-       adr     r1, _start
-       add     lr, r0, r1
-       add     lr, lr, r9
-       /* setup parameters for board_init_r */
-       mov     r0, r5          /* gd_t */
-       mov     r1, r6          /* dest_addr */
-       /* jump to it ... */
-       mov     pc, lr
-
-_board_init_r_ofs:
-       .word board_init_r - _start
+       bx      lr
 
 _rel_dyn_start_ofs:
        .word __rel_dyn_start - _start
@@ -370,6 +328,11 @@ _rel_dyn_end_ofs:
 _dynsym_start_ofs:
        .word __dynsym_start - _start
 
+       .globl  c_runtime_cpu_setup
+c_runtime_cpu_setup:
+
+       bx      lr
+
 /****************************************************************************/
 /*                                                                         */
 /* Interrupt handling                                                      */
index 536cf5c9748824aee06097f1304e92ab7f557305..e71803eb2e5777e4a029d8b39c24cac3954e3860 100644 (file)
@@ -164,12 +164,7 @@ reset:
        bl      lock_cache_for_stack
 #endif
 
-/* Set stackpointer in internal RAM to call board_init_f */
-call_board_init_f:
-       ldr     sp, =(CONFIG_SYS_INIT_SP_ADDR)
-       bic     sp, sp, #7 /* 8-byte alignment for ABI compliance */
-       ldr     r0, =0x00000000
-       bl      board_init_f
+       bl      _main
 
 /*------------------------------------------------------------------------------*/
 #ifndef CONFIG_SPL_BUILD
@@ -186,19 +181,17 @@ relocate_code:
        mov     r5, r1  /* save addr of gd */
        mov     r6, r2  /* save addr of destination */
 
-       /* Set up the stack                                                 */
-stack_setup:
-       mov     sp, r4
-
 /* Disable the Dcache RAM lock for stack now */
 #ifdef CONFIG_CPU_PXA25X
+       mov     r12, lr
        bl      cpu_init_crit
+       mov     lr, r12
 #endif
 
        adr     r0, _start
        cmp     r0, r6
        moveq   r9, #0          /* no relocation. relocation offset(r9) = 0 */
-       beq     clear_bss               /* skip relocation */
+       beq     relocate_done           /* skip relocation */
        mov     r1, r6                  /* r1 <- scratch for copy_loop */
        ldr     r3, _bss_start_ofs
        add     r2, r0, r3              /* r2 <- source end address         */
@@ -250,48 +243,9 @@ fixnext:
        blo     fixloop
 #endif
 
-clear_bss:
-#ifndef CONFIG_SPL_BUILD
-       ldr     r0, _bss_start_ofs
-       ldr     r1, _bss_end_ofs
-       mov     r4, r6                  /* reloc addr */
-       add     r0, r0, r4
-       add     r1, r1, r4
-       mov     r2, #0x00000000         /* clear                            */
-
-clbss_l:cmp    r0, r1                  /* clear loop... */
-       bhs     clbss_e                 /* if reached end of bss, exit */
-       str     r2, [r0]
-       add     r0, r0, #4
-       b       clbss_l
-clbss_e:
-#endif /* #ifndef CONFIG_SPL_BUILD */
+relocate_done:
 
-/*
- * We are done. Do not return, instead branch to second part of board
- * initialization, now running from RAM.
- */
-#ifdef CONFIG_ONENAND_SPL
-       ldr     r0, _onenand_boot_ofs
-       mov     pc, r0
-
-_onenand_boot_ofs:
-       .word onenand_boot
-#else
-jump_2_ram:
-       ldr     r0, _board_init_r_ofs
-       ldr     r1, _TEXT_BASE
-       add     lr, r0, r1
-       add     lr, lr, r9
-       /* setup parameters for board_init_r */
-       mov     r0, r5          /* gd_t */
-       mov     r1, r6          /* dest_addr */
-       /* jump to it ... */
-       mov     pc, lr
-
-_board_init_r_ofs:
-       .word board_init_r - _start
-#endif
+       bx      lr
 
 _rel_dyn_start_ofs:
        .word __rel_dyn_start - _start
@@ -299,7 +253,14 @@ _rel_dyn_end_ofs:
        .word __rel_dyn_end - _start
 _dynsym_start_ofs:
        .word __dynsym_start - _start
+
 #endif
+
+       .globl  c_runtime_cpu_setup
+c_runtime_cpu_setup:
+
+       bx      lr
+
 /*
  *************************************************************************
  *
index 323b923f13da6003785247ab9324205238c883fe..4528c91983837cea91bcb254fa9ee34104a46be1 100644 (file)
@@ -128,12 +128,7 @@ reset:
        bl      lowlevel_init
 #endif
 
-/* Set stackpointer in internal RAM to call board_init_f */
-call_board_init_f:
-       ldr     sp, =(CONFIG_SYS_INIT_SP_ADDR)
-       bic     sp, sp, #7 /* 8-byte alignment for ABI compliance */
-       ldr     r0,=0x00000000
-       bl      board_init_f
+       bl      _main
 
 /*------------------------------------------------------------------------------*/
 
@@ -150,14 +145,10 @@ relocate_code:
        mov     r5, r1  /* save addr of gd */
        mov     r6, r2  /* save addr of destination */
 
-       /* Set up the stack                                                 */
-stack_setup:
-       mov     sp, r4
-
        adr     r0, _start
        cmp     r0, r6
        moveq   r9, #0          /* no relocation. relocation offset(r9) = 0 */
-       beq     clear_bss               /* skip relocation */
+       beq     relocate_done           /* skip relocation */
        mov     r1, r6                  /* r1 <- scratch for copy_loop */
        ldr     r3, _bss_start_ofs
        add     r2, r0, r3              /* r2 <- source end address         */
@@ -209,42 +200,9 @@ fixnext:
        blo     fixloop
 #endif
 
-clear_bss:
-#ifndef CONFIG_SPL_BUILD
-       ldr     r0, _bss_start_ofs
-       ldr     r1, _bss_end_ofs
-       mov     r4, r6                  /* reloc addr */
-       add     r0, r0, r4
-       add     r1, r1, r4
-       mov     r2, #0x00000000         /* clear                            */
-
-clbss_l:cmp    r0, r1                  /* clear loop... */
-       bhs     clbss_e                 /* if reached end of bss, exit */
-       str     r2, [r0]
-       add     r0, r0, #4
-       b       clbss_l
-clbss_e:
-
-       bl coloured_LED_init
-       bl red_led_on
-#endif
+relocate_done:
 
-/*
- * We are done. Do not return, instead branch to second part of board
- * initialization, now running from RAM.
- */
-       ldr     r0, _board_init_r_ofs
-       adr     r1, _start
-       add     lr, r0, r1
-       add     lr, lr, r9
-       /* setup parameters for board_init_r */
-       mov     r0, r5          /* gd_t */
-       mov     r1, r6          /* dest_addr */
-       /* jump to it ... */
-       mov     pc, lr
-
-_board_init_r_ofs:
-       .word board_init_r - _start
+       bx      lr
 
 _rel_dyn_start_ofs:
        .word __rel_dyn_start - _start
@@ -253,6 +211,11 @@ _rel_dyn_end_ofs:
 _dynsym_start_ofs:
        .word __dynsym_start - _start
 
+       .globl  c_runtime_cpu_setup
+c_runtime_cpu_setup:
+
+       bx      lr
+
 /*
  *************************************************************************
  *
index 1ea92d14567a86ea728c3fc623816935a0455f88..3144299afef81c256223311259351998f27f9251 100644 (file)
@@ -132,12 +132,7 @@ reset:
        bl      cpu_init_crit
 #endif
 
-/* Set stackpointer in internal RAM to call board_init_f */
-call_board_init_f:
-       ldr     sp, =(CONFIG_SYS_INIT_SP_ADDR)
-       bic     sp, sp, #7 /* 8-byte alignment for ABI compliance */
-       ldr     r0,=0x00000000
-       bl      board_init_f
+       bl      _main
 
 /*------------------------------------------------------------------------------*/
 
@@ -154,14 +149,10 @@ relocate_code:
        mov     r5, r1  /* save addr of gd */
        mov     r6, r2  /* save addr of destination */
 
-       /* Set up the stack                                                 */
-stack_setup:
-       mov     sp, r4
-
        adr     r0, _start
        cmp     r0, r6
        moveq   r9, #0          /* no relocation. relocation offset(r9) = 0 */
-       beq     clear_bss               /* skip relocation */
+       beq     relocate_done           /* skip relocation */
        mov     r1, r6                  /* r1 <- scratch for copy_loop */
        ldr     r3, _bss_start_ofs
        add     r2, r0, r3              /* r2 <- source end address         */
@@ -213,40 +204,10 @@ fixnext:
        blo     fixloop
 #endif
 
-clear_bss:
-#ifndef CONFIG_SPL_BUILD
-       ldr     r0, _bss_start_ofs
-       ldr     r1, _bss_end_ofs
-       mov     r4, r6                  /* reloc addr */
-       add     r0, r0, r4
-       add     r1, r1, r4
-       mov     r2, #0x00000000         /* clear                            */
-
-clbss_l:cmp    r0, r1                  /* clear loop... */
-       bhs     clbss_e                 /* if reached end of bss, exit */
-       str     r2, [r0]
-       add     r0, r0, #4
-       b       clbss_l
-clbss_e:
-#endif
+relocate_done:
 
-/*
- * We are done. Do not return, instead branch to second part of board
- * initialization, now running from RAM.
- */
-       ldr     r0, _board_init_r_ofs
-       adr     r1, _start
-       add     lr, r0, r1
-       add     lr, lr, r9
-       /* setup parameters for board_init_r */
-       mov     r0, r5          /* gd_t */
-       mov     r1, r6          /* dest_addr */
-       /* jump to it ... */
        mov     pc, lr
 
-_board_init_r_ofs:
-       .word board_init_r - _start
-
 _rel_dyn_start_ofs:
        .word __rel_dyn_start - _start
 _rel_dyn_end_ofs:
@@ -254,6 +215,11 @@ _rel_dyn_end_ofs:
 _dynsym_start_ofs:
        .word __dynsym_start - _start
 
+       .globl  c_runtime_cpu_setup
+c_runtime_cpu_setup:
+
+       mov     pc, lr
+
 /*
  *************************************************************************
  *
index 00b8029ebad252be08d43916ba37592ac9f87897..ece7ad9ec954333a9bc9a85769adc97d82b2fe08 100644 (file)
 #include <asm/arch/funcmux.h>
 #include <asm/arch/pinmux.h>
 
+/*
+ * The PINMUX macro is used to set up pinmux tables.
+ */
+#define PINMUX(grp, mux, pupd, tri)                   \
+       {PINGRP_##grp, PMUX_FUNC_##mux, PMUX_PULL_##pupd, PMUX_TRI_##tri}
+
+static const struct pingroup_config disp1_default[] = {
+       PINMUX(LDI,   DISPA,      NORMAL,    NORMAL),
+       PINMUX(LHP0,  DISPA,      NORMAL,    NORMAL),
+       PINMUX(LHP1,  DISPA,      NORMAL,    NORMAL),
+       PINMUX(LHP2,  DISPA,      NORMAL,    NORMAL),
+       PINMUX(LHS,   DISPA,      NORMAL,    NORMAL),
+       PINMUX(LM0,   RSVD4,      NORMAL,    NORMAL),
+       PINMUX(LPP,   DISPA,      NORMAL,    NORMAL),
+       PINMUX(LPW0,  DISPA,      NORMAL,    NORMAL),
+       PINMUX(LPW2,  DISPA,      NORMAL,    NORMAL),
+       PINMUX(LSC0,  DISPA,      NORMAL,    NORMAL),
+       PINMUX(LSPI,  DISPA,      NORMAL,    NORMAL),
+       PINMUX(LVP1,  DISPA,      NORMAL,    NORMAL),
+       PINMUX(LVS,   DISPA,      NORMAL,    NORMAL),
+       PINMUX(SLXD,  SPDIF,      NORMAL,    NORMAL),
+};
+
+
 int funcmux_select(enum periph_id id, int config)
 {
        int bad_config = config != FUNCMUX_DEFAULT;
@@ -257,6 +281,19 @@ int funcmux_select(enum periph_id id, int config)
                        break;
                }
                break;
+       case PERIPH_ID_DISP1:
+               if (config == FUNCMUX_DEFAULT) {
+                       int i;
+
+                       for (i = PINGRP_LD0; i <= PINGRP_LD17; i++) {
+                               pinmux_set_func(i, PMUX_FUNC_DISPA);
+                               pinmux_tristate_disable(i);
+                               pinmux_set_pullupdown(i, PMUX_PULL_NORMAL);
+                       }
+                       pinmux_config_table(disp1_default,
+                                           ARRAY_SIZE(disp1_default));
+               }
+               break;
 
        default:
                debug("%s: invalid periph_id %d", __func__, id);
index 08b83055dbb74b4e660c3865e4930a04f41049c8..a2a09169e54bc46acbdc0b2bc5f89478a775b2be 100644 (file)
@@ -554,7 +554,7 @@ void pinmux_set_func(enum pmux_pingrp pin, enum pmux_func func)
        writel(reg, muxctl);
 }
 
-void pinmux_config_pingroup(struct pingroup_config *config)
+void pinmux_config_pingroup(const struct pingroup_config *config)
 {
        enum pmux_pingrp pin = config->pingroup;
 
@@ -563,7 +563,7 @@ void pinmux_config_pingroup(struct pingroup_config *config)
        pinmux_set_tristate(pin, config->tristate);
 }
 
-void pinmux_config_table(struct pingroup_config *config, int len)
+void pinmux_config_table(const struct pingroup_config *config, int len)
 {
        int i;
 
diff --git a/arch/arm/dts/exynos5250.dtsi b/arch/arm/dts/exynos5250.dtsi
new file mode 100644 (file)
index 0000000..ed8c8dd
--- /dev/null
@@ -0,0 +1,154 @@
+/*
+ * SAMSUNG EXYNOS5250 SoC device tree source
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd.
+ *             http://www.samsung.com
+ *
+ * SAMSUNG EXYNOS5250 SoC device nodes are listed in this file.
+ * EXYNOS5250 based board files can include this file and provide
+ * values for board specfic bindings.
+ *
+ * Note: This file does not include device nodes for all the controllers in
+ * EXYNOS5250 SoC. As device tree coverage for EXYNOS5250 increases,
+ * additional nodes can be added to this file.
+ *
+ * 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.
+*/
+
+/include/ "skeleton.dtsi"
+
+/ {
+       compatible = "samsung,exynos5250";
+
+       sromc@12250000 {
+               compatible = "samsung,exynos-sromc";
+               reg = <0x12250000 0x20>;
+               #address-cells = <1>;
+               #size-cells = <0>;
+       };
+
+       i2c@12c60000 {
+               #address-cells = <1>;
+               #size-cells = <0>;
+               compatible = "samsung,s3c2440-i2c";
+               reg = <0x12C60000 0x100>;
+               interrupts = <0 56 0>;
+       };
+
+       i2c@12c70000 {
+               #address-cells = <1>;
+               #size-cells = <0>;
+               compatible = "samsung,s3c2440-i2c";
+               reg = <0x12C70000 0x100>;
+               interrupts = <0 57 0>;
+       };
+
+       i2c@12c80000 {
+               #address-cells = <1>;
+               #size-cells = <0>;
+               compatible = "samsung,s3c2440-i2c";
+               reg = <0x12C80000 0x100>;
+               interrupts = <0 58 0>;
+       };
+
+       i2c@12c90000 {
+               #address-cells = <1>;
+               #size-cells = <0>;
+               compatible = "samsung,s3c2440-i2c";
+               reg = <0x12C90000 0x100>;
+               interrupts = <0 59 0>;
+       };
+
+       i2c@12ca0000 {
+               #address-cells = <1>;
+               #size-cells = <0>;
+               compatible = "samsung,s3c2440-i2c";
+               reg = <0x12CA0000 0x100>;
+               interrupts = <0 60 0>;
+       };
+
+       i2c@12cb0000 {
+               #address-cells = <1>;
+               #size-cells = <0>;
+               compatible = "samsung,s3c2440-i2c";
+               reg = <0x12CB0000 0x100>;
+               interrupts = <0 61 0>;
+       };
+
+       i2c@12cc0000 {
+               #address-cells = <1>;
+               #size-cells = <0>;
+               compatible = "samsung,s3c2440-i2c";
+               reg = <0x12CC0000 0x100>;
+               interrupts = <0 62 0>;
+       };
+
+       i2c@12cd0000 {
+               #address-cells = <1>;
+               #size-cells = <0>;
+               compatible = "samsung,s3c2440-i2c";
+               reg = <0x12CD0000 0x100>;
+               interrupts = <0 63 0>;
+       };
+
+       sound@12d60000 {
+               compatible = "samsung,exynos-sound";
+               reg = <0x12d60000 0x20>;
+       };
+
+       spi@12d20000 {
+               #address-cells = <1>;
+               #size-cells = <0>;
+               compatible = "samsung,exynos-spi";
+               reg = <0x12d20000 0x30>;
+               interrupts = <0 68 0>;
+       };
+
+       spi@12d30000 {
+               #address-cells = <1>;
+               #size-cells = <0>;
+               compatible = "samsung,exynos-spi";
+               reg = <0x12d30000 0x30>;
+               interrupts = <0 69 0>;
+       };
+
+       spi@12d40000 {
+               #address-cells = <1>;
+               #size-cells = <0>;
+               compatible = "samsung,exynos-spi";
+               reg = <0x12d40000 0x30>;
+               clock-frequency = <50000000>;
+               interrupts = <0 70 0>;
+        };
+
+       spi@131a0000 {
+               #address-cells = <1>;
+               #size-cells = <0>;
+               compatible = "samsung,exynos-spi";
+               reg = <0x131a0000 0x30>;
+               interrupts = <0 129 0>;
+       };
+
+       spi@131b0000 {
+               #address-cells = <1>;
+               #size-cells = <0>;
+               compatible = "samsung,exynos-spi";
+               reg = <0x131b0000 0x30>;
+               interrupts = <0 130 0>;
+       };
+
+       ehci@12110000 {
+               compatible = "samsung,exynos-ehci";
+               reg = <0x12110000 0x100>;
+               #address-cells = <1>;
+               #size-cells = <1>;
+
+               phy {
+                       compatible = "samsung,exynos-usb-phy";
+                       reg = <0x12130000 0x100>;
+               };
+       };
+
+};
index d936b1e7e6a1d32ff1aa8728cf550b6c44d69b5b..636ec2c1fe7da999c29542bee5b0089f5e6081ba 100644 (file)
                compatible = "nvidia,tegra20-nand";
                reg = <0x70008000 0x100>;
        };
+
+       pwm: pwm@7000a000 {
+               compatible = "nvidia,tegra20-pwm";
+               reg = <0x7000a000 0x100>;
+               #pwm-cells = <2>;
+       };
+
+       host1x {
+               compatible = "nvidia,tegra20-host1x", "simple-bus";
+               reg = <0x50000000 0x00024000>;
+               interrupts = <0 65 0x04   /* mpcore syncpt */
+                             0 67 0x04>; /* mpcore general */
+               status = "disabled";
+
+               #address-cells = <1>;
+               #size-cells = <1>;
+
+               ranges = <0x54000000 0x54000000 0x04000000>;
+
+               /* video-encoding/decoding */
+               mpe {
+                       reg = <0x54040000 0x00040000>;
+                       interrupts = <0 68 0x04>;
+                       status = "disabled";
+               };
+
+               /* video input */
+               vi {
+                       reg = <0x54080000 0x00040000>;
+                       interrupts = <0 69 0x04>;
+                       status = "disabled";
+               };
+
+               /* EPP */
+               epp {
+                       reg = <0x540c0000 0x00040000>;
+                       interrupts = <0 70 0x04>;
+                       status = "disabled";
+               };
+
+               /* ISP */
+               isp {
+                       reg = <0x54100000 0x00040000>;
+                       interrupts = <0 71 0x04>;
+                       status = "disabled";
+               };
+
+               /* 2D engine */
+               gr2d {
+                       reg = <0x54140000 0x00040000>;
+                       interrupts = <0 72 0x04>;
+                       status = "disabled";
+               };
+
+               /* 3D engine */
+               gr3d {
+                       reg = <0x54180000 0x00040000>;
+                       status = "disabled";
+               };
+
+               /* display controllers */
+               dc@54200000 {
+                       compatible = "nvidia,tegra20-dc";
+                       reg = <0x54200000 0x00040000>;
+                       interrupts = <0 73 0x04>;
+                       status = "disabled";
+
+                       rgb {
+                               status = "disabled";
+                       };
+               };
+
+               dc@54240000 {
+                       compatible = "nvidia,tegra20-dc";
+                       reg = <0x54240000 0x00040000>;
+                       interrupts = <0 74 0x04>;
+                       status = "disabled";
+
+                       rgb {
+                               status = "disabled";
+                       };
+               };
+
+               /* outputs */
+               hdmi {
+                       compatible = "nvidia,tegra20-hdmi";
+                       reg = <0x54280000 0x00040000>;
+                       interrupts = <0 75 0x04>;
+                       status = "disabled";
+               };
+
+               tvo {
+                       compatible = "nvidia,tegra20-tvo";
+                       reg = <0x542c0000 0x00040000>;
+                       interrupts = <0 76 0x04>;
+                       status = "disabled";
+               };
+
+               dsi {
+                       compatible = "nvidia,tegra20-dsi";
+                       reg = <0x54300000 0x00040000>;
+                       status = "disabled";
+               };
+       };
+
 };
index a10d12d97dcdc9739de53e66db9e15cfadbb54f2..a9b86c1173203a3bd8740a5e5b08fa299e8e8194 100644 (file)
@@ -65,20 +65,72 @@ char *get_reset_cause(void)
        }
 }
 
+#if defined(CONFIG_MX53) || defined(CONFIG_MX6)
+#if defined(CONFIG_MX53)
+#define MEMCTL_BASE    ESDCTL_BASE_ADDR;
+#else
+#define MEMCTL_BASE    MMDC_P0_BASE_ADDR;
+#endif
+static const unsigned char col_lookup[] = {9, 10, 11, 8, 12, 9, 9, 9};
+static const unsigned char bank_lookup[] = {3, 2};
+
+struct esd_mmdc_regs {
+       uint32_t        ctl;
+       uint32_t        pdc;
+       uint32_t        otc;
+       uint32_t        cfg0;
+       uint32_t        cfg1;
+       uint32_t        cfg2;
+       uint32_t        misc;
+       uint32_t        scr;
+       uint32_t        ref;
+       uint32_t        rsvd1;
+       uint32_t        rsvd2;
+       uint32_t        rwd;
+       uint32_t        or;
+       uint32_t        mrr;
+       uint32_t        cfg3lp;
+       uint32_t        mr4;
+};
+
+#define ESD_MMDC_CTL_GET_ROW(mdctl)    ((ctl >> 24) & 7)
+#define ESD_MMDC_CTL_GET_COLUMN(mdctl) ((ctl >> 20) & 7)
+#define ESD_MMDC_CTL_GET_WIDTH(mdctl)  ((ctl >> 16) & 3)
+#define ESD_MMDC_CTL_GET_CS1(mdctl)    ((ctl >> 30) & 1)
+#define ESD_MMDC_MISC_GET_BANK(mdmisc) ((misc >> 5) & 1)
+
+unsigned imx_ddr_size(void)
+{
+       struct esd_mmdc_regs *mem = (struct esd_mmdc_regs *)MEMCTL_BASE;
+       unsigned ctl = readl(&mem->ctl);
+       unsigned misc = readl(&mem->misc);
+       int bits = 11 + 0 + 0 + 1;      /* row + col + bank + width */
+
+       bits += ESD_MMDC_CTL_GET_ROW(ctl);
+       bits += col_lookup[ESD_MMDC_CTL_GET_COLUMN(ctl)];
+       bits += bank_lookup[ESD_MMDC_MISC_GET_BANK(misc)];
+       bits += ESD_MMDC_CTL_GET_WIDTH(ctl);
+       bits += ESD_MMDC_CTL_GET_CS1(ctl);
+       return 1 << bits;
+}
+#endif
+
 #if defined(CONFIG_DISPLAY_CPUINFO)
 
-static const char *get_imx_type(u32 imxtype)
+const char *get_imx_type(u32 imxtype)
 {
        switch (imxtype) {
-       case 0x63:
+       case MXC_CPU_MX6Q:
                return "6Q";    /* Quad-core version of the mx6 */
-       case 0x61:
-               return "6DS";   /* Dual/Solo version of the mx6 */
-       case 0x60:
+       case MXC_CPU_MX6DL:
+               return "6DL";   /* Dual Lite version of the mx6 */
+       case MXC_CPU_MX6SOLO:
+               return "6SOLO"; /* Solo version of the mx6 */
+       case MXC_CPU_MX6SL:
                return "6SL";   /* Solo-Lite version of the mx6 */
-       case 0x51:
+       case MXC_CPU_MX51:
                return "51";
-       case 0x53:
+       case MXC_CPU_MX53:
                return "53";
        default:
                return "??";
@@ -123,11 +175,6 @@ int cpu_mmc_init(bd_t *bis)
 }
 #endif
 
-void reset_cpu(ulong addr)
-{
-       __raw_writew(4, WDOG1_BASE_ADDR);
-}
-
 u32 get_ahb_clk(void)
 {
        struct mxc_ccm_reg *imx_ccm = (struct mxc_ccm_reg *)CCM_BASE_ADDR;
index d6c038e3aec225a46dd13af6ded8e59c1ed621e9..16e8a80700a497936f8c14cd4f023892b7a4c6b7 100644 (file)
 
 #ifndef __KERNEL_STRICT_NAMES
 #ifndef __ASSEMBLY__
+struct gpmc_cs {
+       u32 config1;            /* 0x00 */
+       u32 config2;            /* 0x04 */
+       u32 config3;            /* 0x08 */
+       u32 config4;            /* 0x0C */
+       u32 config5;            /* 0x10 */
+       u32 config6;            /* 0x14 */
+       u32 config7;            /* 0x18 */
+       u32 nand_cmd;           /* 0x1C */
+       u32 nand_adr;           /* 0x20 */
+       u32 nand_dat;           /* 0x24 */
+       u8 res[8];              /* blow up to 0x30 byte */
+};
+
+struct bch_res_0_3 {
+       u32 bch_result_x[4];
+};
+
+struct gpmc {
+       u8 res1[0x10];
+       u32 sysconfig;          /* 0x10 */
+       u8 res2[0x4];
+       u32 irqstatus;          /* 0x18 */
+       u32 irqenable;          /* 0x1C */
+       u8 res3[0x20];
+       u32 timeout_control;    /* 0x40 */
+       u8 res4[0xC];
+       u32 config;             /* 0x50 */
+       u32 status;             /* 0x54 */
+       u8 res5[0x8];           /* 0x58 */
+       struct gpmc_cs cs[8];   /* 0x60, 0x90, .. */
+       u8 res6[0x14];          /* 0x1E0 */
+       u32 ecc_config;         /* 0x1F4 */
+       u32 ecc_control;        /* 0x1F8 */
+       u32 ecc_size_config;    /* 0x1FC */
+       u32 ecc1_result;        /* 0x200 */
+       u32 ecc2_result;        /* 0x204 */
+       u32 ecc3_result;        /* 0x208 */
+       u32 ecc4_result;        /* 0x20C */
+       u32 ecc5_result;        /* 0x210 */
+       u32 ecc6_result;        /* 0x214 */
+       u32 ecc7_result;        /* 0x218 */
+       u32 ecc8_result;        /* 0x21C */
+       u32 ecc9_result;        /* 0x220 */
+       u8 res7[12];            /* 0x224 */
+       u32 testmomde_ctrl;     /* 0x230 */
+       u8 res8[12];            /* 0x234 */
+       struct bch_res_0_3 bch_result_0_3[2];   /* 0x240 */
+};
+
+/* Used for board specific gpmc initialization */
+extern struct gpmc *gpmc_cfg;
+
 /* Encapsulating core pll registers */
 struct cm_wkuppll {
        unsigned int wkclkstctrl;       /* offset 0x00 */
diff --git a/arch/arm/include/asm/arch-am33xx/elm.h b/arch/arm/include/asm/arch-am33xx/elm.h
new file mode 100644 (file)
index 0000000..e80f7d4
--- /dev/null
@@ -0,0 +1,93 @@
+/*
+ * (C) Copyright 2010-2011 Texas Instruments, <www.ti.com>
+ * Mansoor Ahamed <mansoor.ahamed@ti.com>
+ *
+ * Derived from work done by Rohit Choraria <rohitkc@ti.com> for omap3
+ *
+ * See file CREDITS for 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_ARCH_ELM_H
+#define __ASM_ARCH_ELM_H
+/*
+ * ELM Module Registers
+ */
+
+/* ELM registers bit fields */
+#define ELM_SYSCONFIG_SOFTRESET_MASK                   (0x2)
+#define ELM_SYSCONFIG_SOFTRESET                        (0x2)
+#define ELM_SYSSTATUS_RESETDONE_MASK                   (0x1)
+#define ELM_SYSSTATUS_RESETDONE                        (0x1)
+#define ELM_LOCATION_CONFIG_ECC_BCH_LEVEL_MASK         (0x3)
+#define ELM_LOCATION_CONFIG_ECC_SIZE_MASK              (0x7FF0000)
+#define ELM_LOCATION_CONFIG_ECC_SIZE_POS               (16)
+#define ELM_SYNDROME_FRAGMENT_6_SYNDROME_VALID         (0x00010000)
+#define ELM_LOCATION_STATUS_ECC_CORRECTABLE_MASK       (0x100)
+#define ELM_LOCATION_STATUS_ECC_NB_ERRORS_MASK         (0x1F)
+
+#ifndef __ASSEMBLY__
+
+enum bch_level {
+       BCH_4_BIT = 0,
+       BCH_8_BIT,
+       BCH_16_BIT
+};
+
+
+/* BCH syndrome registers */
+struct syndrome {
+       u32 syndrome_fragment_x[7];     /* 0x400, 0x404.... 0x418 */
+       u8 res1[36];                    /* 0x41c */
+};
+
+/* BCH error status & location register */
+struct location {
+       u32 location_status;            /* 0x800 */
+       u8 res1[124];                   /* 0x804 */
+       u32 error_location_x[16];       /* 0x880.... */
+       u8 res2[64];                    /* 0x8c0 */
+};
+
+/* BCH ELM register map - do not try to allocate memmory for this structure.
+ * We have used plenty of reserved variables to fill the slots in the ELM
+ * register memory map.
+ * Directly initialize the struct pointer to ELM base address.
+ */
+struct elm {
+       u32 rev;                                /* 0x000 */
+       u8 res1[12];                            /* 0x004 */
+       u32 sysconfig;                          /* 0x010 */
+       u32 sysstatus;                          /* 0x014 */
+       u32 irqstatus;                          /* 0x018 */
+       u32 irqenable;                          /* 0x01c */
+       u32 location_config;                    /* 0x020 */
+       u8 res2[92];                            /* 0x024 */
+       u32 page_ctrl;                          /* 0x080 */
+       u8 res3[892];                           /* 0x084 */
+       struct  syndrome syndrome_fragments[8]; /* 0x400 */
+       u8 res4[512];                           /* 0x600 */
+       struct location  error_location[8];     /* 0x800 */
+};
+
+int elm_check_error(u8 *syndrome, u32 nibbles, u32 *error_count,
+               u32 *error_locations);
+int elm_config(enum bch_level level);
+void elm_reset(void);
+void elm_init(void);
+#endif /* __ASSEMBLY__ */
+#endif /* __ASM_ARCH_ELM_H */
index 24ab365ea31ebdfa6faeb4a07defd197e59a40f9..6dd3296907acce5671364bc09b8b6b65824108f0 100644 (file)
@@ -80,6 +80,9 @@
 #define DDRPHY_0_CONFIG_BASE           (CTRL_BASE + 0x1400)
 #define DDRPHY_CONFIG_BASE             DDRPHY_0_CONFIG_BASE
 
+/* GPMC Base address */
+#define GPMC_BASE                      0x50000000
+
 /* CPSW Config space */
 #define AM335X_CPSW_BASE               0x4A100000
 #define AM335X_CPSW_MDIO_BASE          0x4A101000
diff --git a/arch/arm/include/asm/arch-am33xx/mem.h b/arch/arm/include/asm/arch-am33xx/mem.h
new file mode 100644 (file)
index 0000000..c3bf74e
--- /dev/null
@@ -0,0 +1,83 @@
+/*
+ * (C) Copyright 2006-2008
+ * Texas Instruments, <www.ti.com>
+ *
+ * Author
+ *             Mansoor Ahamed <mansoor.ahamed@ti.com>
+ *
+ * Initial Code from:
+ *             Richard Woodruff <r-woodruff2@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 _MEM_H_
+#define _MEM_H_
+
+/*
+ * GPMC settings -
+ * Definitions is as per the following format
+ * #define <PART>_GPMC_CONFIG<x> <value>
+ * Where:
+ * PART is the part name e.g. STNOR - Intel Strata Flash
+ * x is GPMC config registers from 1 to 6 (there will be 6 macros)
+ * Value is corresponding value
+ *
+ * For every valid PRCM configuration there should be only one definition of
+ * the same. if values are independent of the board, this definition will be
+ * present in this file if values are dependent on the board, then this should
+ * go into corresponding mem-boardName.h file
+ *
+ * Currently valid part Names are (PART):
+ * M_NAND - Micron NAND
+ */
+#define GPMC_SIZE_256M         0x0
+#define GPMC_SIZE_128M         0x8
+#define GPMC_SIZE_64M          0xC
+#define GPMC_SIZE_32M          0xE
+#define GPMC_SIZE_16M          0xF
+
+#define M_NAND_GPMC_CONFIG1    0x00000800
+#define M_NAND_GPMC_CONFIG2    0x001e1e00
+#define M_NAND_GPMC_CONFIG3    0x001e1e00
+#define M_NAND_GPMC_CONFIG4    0x16051807
+#define M_NAND_GPMC_CONFIG5    0x00151e1e
+#define M_NAND_GPMC_CONFIG6    0x16000f80
+#define M_NAND_GPMC_CONFIG7    0x00000008
+
+/* max number of GPMC Chip Selects */
+#define GPMC_MAX_CS            8
+/* max number of GPMC regs */
+#define GPMC_MAX_REG           7
+
+#define PISMO1_NOR             1
+#define PISMO1_NAND            2
+#define PISMO2_CS0             3
+#define PISMO2_CS1             4
+#define PISMO1_ONENAND         5
+#define DBG_MPDB               6
+#define PISMO2_NAND_CS0                7
+#define PISMO2_NAND_CS1                8
+
+/* make it readable for the gpmc_init */
+#define PISMO1_NOR_BASE        FLASH_BASE
+#define PISMO1_NAND_BASE       CONFIG_SYS_NAND_BASE
+#define PISMO1_NAND_SIZE       GPMC_SIZE_256M
+
+#endif /* endif _MEM_H_ */
diff --git a/arch/arm/include/asm/arch-am33xx/omap_gpmc.h b/arch/arm/include/asm/arch-am33xx/omap_gpmc.h
new file mode 100644 (file)
index 0000000..572f9d0
--- /dev/null
@@ -0,0 +1,120 @@
+/*
+ * (C) Copyright 2004-2008 Texas Instruments, <www.ti.com>
+ * Rohit Choraria <rohitkc@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 __ASM_ARCH_OMAP_GPMC_H
+#define __ASM_ARCH_OMAP_GPMC_H
+
+#define GPMC_BUF_EMPTY 0
+#define GPMC_BUF_FULL  1
+
+#define ECCCLEAR       (0x1 << 8)
+#define ECCRESULTREG1  (0x1 << 0)
+#define ECCSIZE512BYTE 0xFF
+#define ECCSIZE1       (ECCSIZE512BYTE << 22)
+#define ECCSIZE0       (ECCSIZE512BYTE << 12)
+#define ECCSIZE0SEL    (0x000 << 0)
+
+/* Generic ECC Layouts */
+/* Large Page x8 NAND device Layout */
+#ifdef GPMC_NAND_ECC_LP_x8_LAYOUT
+#define GPMC_NAND_HW_ECC_LAYOUT {\
+       .eccbytes = 12,\
+       .eccpos = {1, 2, 3, 4, 5, 6, 7, 8,\
+               9, 10, 11, 12},\
+       .oobfree = {\
+               {.offset = 13,\
+                .length = 51 } } \
+}
+#endif
+
+/* Large Page x16 NAND device Layout */
+#ifdef GPMC_NAND_ECC_LP_x16_LAYOUT
+#define GPMC_NAND_HW_ECC_LAYOUT {\
+       .eccbytes = 12,\
+       .eccpos = {2, 3, 4, 5, 6, 7, 8, 9,\
+               10, 11, 12, 13},\
+       .oobfree = {\
+               {.offset = 14,\
+                .length = 50 } } \
+}
+#endif
+
+/* Small Page x8 NAND device Layout */
+#ifdef GPMC_NAND_ECC_SP_x8_LAYOUT
+#define GPMC_NAND_HW_ECC_LAYOUT {\
+       .eccbytes = 3,\
+       .eccpos = {1, 2, 3},\
+       .oobfree = {\
+               {.offset = 4,\
+                .length = 12 } } \
+}
+#endif
+
+/* Small Page x16 NAND device Layout */
+#ifdef GPMC_NAND_ECC_SP_x16_LAYOUT
+#define GPMC_NAND_HW_ECC_LAYOUT {\
+       .eccbytes = 3,\
+       .eccpos = {2, 3, 4},\
+       .oobfree = {\
+               {.offset = 5,\
+                .length = 11 } } \
+}
+#endif
+
+#define GPMC_NAND_HW_BCH4_ECC_LAYOUT {\
+       .eccbytes = 32,\
+       .eccpos = {2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,\
+                               16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27,\
+                               28, 29, 30, 31, 32, 33},\
+       .oobfree = {\
+               {.offset = 34,\
+                .length = 30 } } \
+}
+
+#define GPMC_NAND_HW_BCH8_ECC_LAYOUT {\
+       .eccbytes = 56,\
+       .eccpos = {2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,\
+                               16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27,\
+                               28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39,\
+                               40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51,\
+                               52, 53, 54, 55, 56, 57},\
+       .oobfree = {\
+               {.offset = 58,\
+                .length = 6 } } \
+}
+
+#define GPMC_NAND_HW_BCH16_ECC_LAYOUT {\
+       .eccbytes = 104,\
+       .eccpos = {2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,\
+                               16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27,\
+                               28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39,\
+                               40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51,\
+                               52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63,\
+                               64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75,\
+                               76, 77, 78, 79, 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},\
+       .oobfree = {\
+               {.offset = 106,\
+                .length = 8 } } \
+}
+#endif /* __ASM_ARCH_OMAP_GPMC_H */
index 9cf35e0257838bb5cfca49cc885b86e25fed1cd8..588d8de82fbf2b0e75db5c6fa8bef29eb5486673 100644 (file)
@@ -33,4 +33,7 @@ u32 get_device_type(void);
 void setup_clocks_for_console(void);
 void ddr_pll_config(unsigned int ddrpll_M);
 
+void sdelay(unsigned long);
+void gpmc_init(void);
+void omap_nand_switch_ecc(int);
 #endif
index 0e728c96dcffca718b7bca409de2fa0f1ea8ff2e..de0f1b1923e60258c528724789365fd5c174acda 100644 (file)
 #define ATMEL_PIO_PORTS         4
 #define CPU_HAS_PIO3
 #define PIO_SCDR_DIV            (0x3fff <<  0)  /* Slow Clock Divider Mask */
+#define ATMEL_PMC_UHP          AT91SAM926x_PMC_UHP
+#define ATMEL_ID_UHP           ATMEL_ID_UHPHS
 
 /*
  * at91sam9x5 specific prototypes
index 552902573ff3536b895a6ad5b9e6a543a4395ee7..1935b0b5b899d86f96c218c90a44526cc71fcfb1 100644 (file)
@@ -34,9 +34,14 @@ unsigned long get_arm_clk(void);
 unsigned long get_i2c_clk(void);
 unsigned long get_pwm_clk(void);
 unsigned long get_uart_clk(int dev_index);
+unsigned long get_mmc_clk(int dev_index);
 void set_mmc_clk(int dev_index, unsigned int div);
 unsigned long get_lcd_clk(void);
 void set_lcd_clk(void);
 void set_mipi_clk(void);
+void set_i2s_clk_source(void);
+int set_i2s_clk_prescaler(unsigned int src_frq, unsigned int dst_frq);
+int set_epll_clk(unsigned long rate);
+int set_spi_clk(int periph_id, unsigned int rate);
 
 #endif
index fce38efbb259892d9511a12b893e41197061792c..9b56b4e51bf09d1b8c8783f8d4d201fc4650e682 100644 (file)
@@ -251,6 +251,282 @@ struct exynos4_clock {
        unsigned int    div_iem_l1;
 };
 
+struct exynos4x12_clock {
+       unsigned char   res1[0x4200];
+       unsigned int    src_leftbus;
+       unsigned char   res2[0x1fc];
+       unsigned int    mux_stat_leftbus;
+       unsigned char   res3[0xfc];
+       unsigned int    div_leftbus;
+       unsigned char   res4[0xfc];
+       unsigned int    div_stat_leftbus;
+       unsigned char   res5[0x1fc];
+       unsigned int    gate_ip_leftbus;
+       unsigned char   res6[0x12c];
+       unsigned int    gate_ip_image;
+       unsigned char   res7[0xcc];
+       unsigned int    clkout_leftbus;
+       unsigned int    clkout_leftbus_div_stat;
+       unsigned char   res8[0x37f8];
+       unsigned int    src_rightbus;
+       unsigned char   res9[0x1fc];
+       unsigned int    mux_stat_rightbus;
+       unsigned char   res10[0xfc];
+       unsigned int    div_rightbus;
+       unsigned char   res11[0xfc];
+       unsigned int    div_stat_rightbus;
+       unsigned char   res12[0x1fc];
+       unsigned int    gate_ip_rightbus;
+       unsigned char   res13[0x15c];
+       unsigned int    gate_ip_perir;
+       unsigned char   res14[0x9c];
+       unsigned int    clkout_rightbus;
+       unsigned int    clkout_rightbus_div_stat;
+       unsigned char   res15[0x3608];
+       unsigned int    epll_lock;
+       unsigned char   res16[0xc];
+       unsigned int    vpll_lock;
+       unsigned char   res17[0xec];
+       unsigned int    epll_con0;
+       unsigned int    epll_con1;
+       unsigned int    epll_con2;
+       unsigned char   res18[0x4];
+       unsigned int    vpll_con0;
+       unsigned int    vpll_con1;
+       unsigned int    vpll_con2;
+       unsigned char   res19[0xe4];
+       unsigned int    src_top0;
+       unsigned int    src_top1;
+       unsigned char   res20[0x8];
+       unsigned int    src_cam;
+       unsigned int    src_tv;
+       unsigned int    src_mfc;
+       unsigned int    src_g3d;
+       unsigned char   res21[0x4];
+       unsigned int    src_lcd;
+       unsigned int    src_isp;
+       unsigned int    src_maudio;
+       unsigned int    src_fsys;
+       unsigned char   res22[0xc];
+       unsigned int    src_peril0;
+       unsigned int    src_peril1;
+       unsigned int    src_cam1;
+       unsigned char   res23[0xb4];
+       unsigned int    src_mask_top;
+       unsigned char   res24[0xc];
+       unsigned int    src_mask_cam;
+       unsigned int    src_mask_tv;
+       unsigned char   res25[0xc];
+       unsigned int    src_mask_lcd;
+       unsigned int    src_mask_isp;
+       unsigned int    src_mask_maudio;
+       unsigned int    src_mask_fsys;
+       unsigned char   res26[0xc];
+       unsigned int    src_mask_peril0;
+       unsigned int    src_mask_peril1;
+       unsigned char   res27[0xb8];
+       unsigned int    mux_stat_top0;
+       unsigned int    mux_stat_top1;
+       unsigned char   res28[0x10];
+       unsigned int    mux_stat_mfc;
+       unsigned int    mux_stat_g3d;
+       unsigned char   res29[0x28];
+       unsigned int    mux_stat_cam1;
+       unsigned char   res30[0xb4];
+       unsigned int    div_top;
+       unsigned char   res31[0xc];
+       unsigned int    div_cam;
+       unsigned int    div_tv;
+       unsigned int    div_mfc;
+       unsigned int    div_g3d;
+       unsigned char   res32[0x4];
+       unsigned int    div_lcd;
+       unsigned int    div_isp;
+       unsigned int    div_maudio;
+       unsigned int    div_fsys0;
+       unsigned int    div_fsys1;
+       unsigned int    div_fsys2;
+       unsigned int    div_fsys3;
+       unsigned int    div_peril0;
+       unsigned int    div_peril1;
+       unsigned int    div_peril2;
+       unsigned int    div_peril3;
+       unsigned int    div_peril4;
+       unsigned int    div_peril5;
+       unsigned int    div_cam1;
+       unsigned char   res33[0x14];
+       unsigned int    div2_ratio;
+       unsigned char   res34[0x8c];
+       unsigned int    div_stat_top;
+       unsigned char   res35[0xc];
+       unsigned int    div_stat_cam;
+       unsigned int    div_stat_tv;
+       unsigned int    div_stat_mfc;
+       unsigned int    div_stat_g3d;
+       unsigned char   res36[0x4];
+       unsigned int    div_stat_lcd;
+       unsigned int    div_stat_isp;
+       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_peril0;
+       unsigned int    div_stat_peril1;
+       unsigned int    div_stat_peril2;
+       unsigned int    div_stat_peril3;
+       unsigned int    div_stat_peril4;
+       unsigned int    div_stat_peril5;
+       unsigned int    div_stat_cam1;
+       unsigned char   res37[0x14];
+       unsigned int    div2_stat;
+       unsigned char   res38[0x29c];
+       unsigned int    gate_ip_cam;
+       unsigned int    gate_ip_tv;
+       unsigned int    gate_ip_mfc;
+       unsigned int    gate_ip_g3d;
+       unsigned char   res39[0x4];
+       unsigned int    gate_ip_lcd;
+       unsigned int    gate_ip_isp;
+       unsigned char   res40[0x4];
+       unsigned int    gate_ip_fsys;
+       unsigned char   res41[0x8];
+       unsigned int    gate_ip_gps;
+       unsigned int    gate_ip_peril;
+       unsigned char   res42[0xc];
+       unsigned char   res43[0x4];
+       unsigned char   res44[0xc];
+       unsigned int    gate_block;
+       unsigned char   res45[0x8c];
+       unsigned int    clkout_cmu_top;
+       unsigned int    clkout_cmu_top_div_stat;
+       unsigned char   res46[0x3600];
+       unsigned int    mpll_lock;
+       unsigned char   res47[0xfc];
+       unsigned int    mpll_con0;
+       unsigned int    mpll_con1;
+       unsigned char   res48[0xf0];
+       unsigned int    src_dmc;
+       unsigned char   res49[0xfc];
+       unsigned int    src_mask_dmc;
+       unsigned char   res50[0xfc];
+       unsigned int    mux_stat_dmc;
+       unsigned char   res51[0xfc];
+       unsigned int    div_dmc0;
+       unsigned int    div_dmc1;
+       unsigned char   res52[0xf8];
+       unsigned int    div_stat_dmc0;
+       unsigned int    div_stat_dmc1;
+       unsigned char   res53[0xf8];
+       unsigned int    gate_bus_dmc0;
+       unsigned int    gate_bus_dmc1;
+       unsigned char   res54[0x1f8];
+       unsigned int    gate_ip_dmc0;
+       unsigned int    gate_ip_dmc1;
+       unsigned char   res55[0xf8];
+       unsigned int    clkout_cmu_dmc;
+       unsigned int    clkout_cmu_dmc_div_stat;
+       unsigned char   res56[0x5f8];
+       unsigned int    dcgidx_map0;
+       unsigned int    dcgidx_map1;
+       unsigned int    dcgidx_map2;
+       unsigned char   res57[0x14];
+       unsigned int    dcgperf_map0;
+       unsigned int    dcgperf_map1;
+       unsigned char   res58[0x18];
+       unsigned int    dvcidx_map;
+       unsigned char   res59[0x1c];
+       unsigned int    freq_cpu;
+       unsigned int    freq_dpm;
+       unsigned char   res60[0x18];
+       unsigned int    dvsemclk_en;
+       unsigned int    maxperf;
+       unsigned char   res61[0x8];
+       unsigned int    dmc_freq_ctrl;
+       unsigned int    dmc_pause_ctrl;
+       unsigned int    dddrphy_lock_ctrl;
+       unsigned int    c2c_state;
+       unsigned char   res62[0x2f60];
+       unsigned int    apll_lock;
+       unsigned char   res63[0x8];
+       unsigned char   res64[0xf4];
+       unsigned int    apll_con0;
+       unsigned int    apll_con1;
+       unsigned char   res65[0xf8];
+       unsigned int    src_cpu;
+       unsigned char   res66[0x1fc];
+       unsigned int    mux_stat_cpu;
+       unsigned char   res67[0xfc];
+       unsigned int    div_cpu0;
+       unsigned int    div_cpu1;
+       unsigned char   res68[0xf8];
+       unsigned int    div_stat_cpu0;
+       unsigned int    div_stat_cpu1;
+       unsigned char   res69[0x2f8];
+       unsigned int    clk_gate_ip_cpu;
+       unsigned char   res70[0xfc];
+       unsigned int    clkout_cmu_cpu;
+       unsigned int    clkout_cmu_cpu_div_stat;
+       unsigned char   res71[0x5f8];
+       unsigned int    armclk_stopctrl;
+       unsigned int    atclk_stopctrl;
+       unsigned char   res72[0x10];
+       unsigned char   res73[0x8];
+       unsigned int    pwr_ctrl;
+       unsigned int    pwr_ctrl2;
+       unsigned char   res74[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   res75[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   res76[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   res77[0xe0];
+       unsigned int    l2_status;
+       unsigned char   res78[0xc];
+       unsigned int    cpu_status;
+       unsigned char   res79[0xc];
+       unsigned int    ptm_status;
+       unsigned char   res80[0x2edc];
+       unsigned int    div_isp0;
+       unsigned int    div_isp1;
+       unsigned char   res81[0xf8];
+       unsigned int    div_stat_isp0;
+       unsigned int    div_stat_isp1;
+       unsigned char   res82[0x3f8];
+       unsigned int    gate_ip_isp0;
+       unsigned int    gate_ip_isp1;
+       unsigned char   res83[0x1f8];
+       unsigned int    clkout_cmu_isp;
+       unsigned int    clkout_cmu_ispd_div_stat;
+       unsigned char   res84[0xf8];
+       unsigned int    cmu_isp_spar0;
+       unsigned int    cmu_isp_spar1;
+       unsigned int    cmu_isp_spar2;
+       unsigned int    cmu_isp_spar3;
+};
+
 struct exynos5_clock {
        unsigned int    apll_lock;
        unsigned char   res1[0xfc];
@@ -595,9 +871,38 @@ struct exynos5_clock {
        unsigned int    pll_div2_sel;
        unsigned char   res123[0xf5d8];
 };
+
+/* structure for epll configuration used in audio clock configuration */
+struct set_epll_con_val {
+       unsigned int freq_out;          /* frequency out */
+       unsigned int en_lock_det;       /* enable lock detect */
+       unsigned int m_div;             /* m divider value */
+       unsigned int p_div;             /* p divider value */
+       unsigned int s_div;             /* s divider value */
+       unsigned int k_dsm;             /* k value of delta signal modulator */
+};
 #endif
 
 #define MPLL_FOUT_SEL_SHIFT    4
+#define EXYNOS5_EPLLCON0_LOCKED_SHIFT  29  /* EPLL Locked bit position*/
+#define TIMEOUT_EPLL_LOCK              1000
+
+#define AUDIO_0_RATIO_MASK             0x0f
+#define AUDIO_1_RATIO_MASK             0x0f
+
+#define AUDIO1_SEL_MASK                        0xf
+#define CLK_SRC_SCLK_EPLL              0x7
+
+/* CON0 bit-fields */
+#define EPLL_CON0_MDIV_MASK            0x1ff
+#define EPLL_CON0_PDIV_MASK            0x3f
+#define EPLL_CON0_SDIV_MASK            0x7
+#define EPLL_CON0_MDIV_SHIFT           16
+#define EPLL_CON0_PDIV_SHIFT           8
+#define EPLL_CON0_SDIV_SHIFT           0
+#define EPLL_CON0_LOCK_DET_EN_SHIFT    28
+#define EPLL_CON0_LOCK_DET_EN_MASK     1
+
 #define MPLL_FOUT_SEL_MASK     0x1
 #define BPLL_FOUT_SEL_SHIFT    0
 #define BPLL_FOUT_SEL_MASK     0x1
index 3073ca1a811549e5c1dc2212d7a0fad974d6b8a1..eb3442235378fd7e8b29d2ef84bfee1c35871d56 100644 (file)
@@ -27,7 +27,7 @@
 #define EXYNOS_CPU_NAME                        "Exynos"
 #define EXYNOS4_ADDR_BASE              0x10000000
 
-/* EXYNOS4 */
+/* EXYNOS4 Common*/
 #define EXYNOS4_I2C_SPACING            0x10000
 
 #define EXYNOS4_GPIO_PART3_BASE                0x03860000
 #define EXYNOS4_UART_BASE              0x13800000
 #define EXYNOS4_I2C_BASE               0x13860000
 #define EXYNOS4_ADC_BASE               0x13910000
+#define EXYNOS4_SPI_BASE               0x13920000
 #define EXYNOS4_PWMTIMER_BASE          0x139D0000
 #define EXYNOS4_MODEM_BASE             0x13A00000
 #define EXYNOS4_USBPHY_CONTROL         0x10020704
+#define EXYNOS4_I2S_BASE               0xE2100000
 
 #define EXYNOS4_GPIO_PART4_BASE                DEVICE_NOT_AVAILABLE
 #define EXYNOS4_DP_BASE                        DEVICE_NOT_AVAILABLE
-
-/* EXYNOS5 */
+#define EXYNOS4_SPI_ISP_BASE           DEVICE_NOT_AVAILABLE
+
+/* EXYNOS4X12 */
+#define EXYNOS4X12_GPIO_PART3_BASE     0x03860000
+#define EXYNOS4X12_PRO_ID              0x10000000
+#define EXYNOS4X12_SYSREG_BASE         0x10010000
+#define EXYNOS4X12_POWER_BASE          0x10020000
+#define EXYNOS4X12_SWRESET             0x10020400
+#define EXYNOS4X12_USBPHY_CONTROL      0x10020704
+#define EXYNOS4X12_CLOCK_BASE          0x10030000
+#define EXYNOS4X12_SYSTIMER_BASE       0x10050000
+#define EXYNOS4X12_WATCHDOG_BASE       0x10060000
+#define EXYNOS4X12_DMC0_BASE           0x10600000
+#define EXYNOS4X12_DMC1_BASE           0x10610000
+#define EXYNOS4X12_GPIO_PART4_BASE     0x106E0000
+#define EXYNOS4X12_GPIO_PART2_BASE     0x11000000
+#define EXYNOS4X12_GPIO_PART1_BASE     0x11400000
+#define EXYNOS4X12_FIMD_BASE           0x11C00000
+#define EXYNOS4X12_MIPI_DSIM_BASE      0x11C80000
+#define EXYNOS4X12_USBOTG_BASE         0x12480000
+#define EXYNOS4X12_MMC_BASE            0x12510000
+#define EXYNOS4X12_SROMC_BASE          0x12570000
+#define EXYNOS4X12_USB_HOST_EHCI_BASE  0x12580000
+#define EXYNOS4X12_USBPHY_BASE         0x125B0000
+#define EXYNOS4X12_UART_BASE           0x13800000
+#define EXYNOS4X12_I2C_BASE            0x13860000
+#define EXYNOS4X12_PWMTIMER_BASE       0x139D0000
+
+#define EXYNOS4X12_ADC_BASE            DEVICE_NOT_AVAILABLE
+#define EXYNOS4X12_DP_BASE             DEVICE_NOT_AVAILABLE
+#define EXYNOS4X12_MODEM_BASE          DEVICE_NOT_AVAILABLE
+#define EXYNOS4X12_I2S_BASE            DEVICE_NOT_AVAILABLE
+#define EXYNOS4X12_SPI_BASE            DEVICE_NOT_AVAILABLE
+#define EXYNOS4X12_SPI_ISP_BASE                DEVICE_NOT_AVAILABLE
+
+/* EXYNOS5 Common*/
 #define EXYNOS5_I2C_SPACING            0x10000
 
 #define EXYNOS5_GPIO_PART4_BASE                0x03860000
 #define EXYNOS5_SROMC_BASE             0x12250000
 #define EXYNOS5_UART_BASE              0x12C00000
 #define EXYNOS5_I2C_BASE               0x12C60000
+#define EXYNOS5_SPI_BASE               0x12D20000
+#define EXYNOS5_I2S_BASE               0x12D60000
 #define EXYNOS5_PWMTIMER_BASE          0x12DD0000
+#define EXYNOS5_SPI_ISP_BASE           0x131A0000
 #define EXYNOS5_GPIO_PART2_BASE                0x13400000
 #define EXYNOS5_FIMD_BASE              0x14400000
 #define EXYNOS5_DP_BASE                        0x145B0000
@@ -141,15 +180,27 @@ static inline int cpu_is_##type(void)                     \
 IS_SAMSUNG_TYPE(exynos4, 0x4)
 IS_SAMSUNG_TYPE(exynos5, 0x5)
 
+#define IS_EXYNOS_TYPE(type, id)                       \
+static inline int proid_is_##type(void)                        \
+{                                                      \
+       return s5p_cpu_id == id;                        \
+}
+
+IS_EXYNOS_TYPE(exynos4210, 0x4210)
+IS_EXYNOS_TYPE(exynos4412, 0x4412)
+IS_EXYNOS_TYPE(exynos5250, 0x5250)
+
 #define SAMSUNG_BASE(device, base)                             \
 static inline unsigned int samsung_get_base_##device(void)     \
 {                                                              \
-       if (cpu_is_exynos4())                                   \
+       if (cpu_is_exynos4()) {                                 \
+               if (proid_is_exynos4412())                      \
+                       return EXYNOS4X12_##base;               \
                return EXYNOS4_##base;                          \
-       else if (cpu_is_exynos5())                              \
+       } else if (cpu_is_exynos5()) {                          \
                return EXYNOS5_##base;                          \
-       else                                                    \
-               return 0;                                       \
+       }                                                       \
+       return 0;                                               \
 }
 
 SAMSUNG_BASE(adc, ADC_BASE)
@@ -158,6 +209,7 @@ SAMSUNG_BASE(dp, DP_BASE)
 SAMSUNG_BASE(sysreg, SYSREG_BASE)
 SAMSUNG_BASE(fimd, FIMD_BASE)
 SAMSUNG_BASE(i2c, I2C_BASE)
+SAMSUNG_BASE(i2s, I2S_BASE)
 SAMSUNG_BASE(mipi_dsim, MIPI_DSIM_BASE)
 SAMSUNG_BASE(gpio_part1, GPIO_PART1_BASE)
 SAMSUNG_BASE(gpio_part2, GPIO_PART2_BASE)
@@ -175,6 +227,8 @@ SAMSUNG_BASE(usb_ehci, USB_HOST_EHCI_BASE)
 SAMSUNG_BASE(usb_otg, USBOTG_BASE)
 SAMSUNG_BASE(watchdog, WATCHDOG_BASE)
 SAMSUNG_BASE(power, POWER_BASE)
+SAMSUNG_BASE(spi, SPI_BASE)
+SAMSUNG_BASE(spi_isp, SPI_ISP_BASE)
 #endif
 
 #endif /* _EXYNOS4_CPU_H */
index 35694980fad075504ca4c14ddf26260876578fae..102b709bd76315d779c5c337c84990e691888bac 100644 (file)
@@ -211,4 +211,6 @@ unsigned int exynos_init_dp(void)
 }
 #endif
 
+void exynos_set_dp_platform_data(struct exynos_dp_platform_data *pd);
+
 #endif /* _DP_INFO_H */
index 97be4eac052d122573bbd750e0081a2bda611420..cfe10246c53d6f0e1339de8fb1faf199e225d5b8 100644 (file)
@@ -79,6 +79,67 @@ struct exynos4_gpio_part3 {
        struct s5p_gpio_bank z;
 };
 
+struct exynos4x12_gpio_part1 {
+       struct s5p_gpio_bank a0;
+       struct s5p_gpio_bank a1;
+       struct s5p_gpio_bank b;
+       struct s5p_gpio_bank c0;
+       struct s5p_gpio_bank c1;
+       struct s5p_gpio_bank d0;
+       struct s5p_gpio_bank d1;
+       struct s5p_gpio_bank res1[0x5];
+       struct s5p_gpio_bank f0;
+       struct s5p_gpio_bank f1;
+       struct s5p_gpio_bank f2;
+       struct s5p_gpio_bank f3;
+       struct s5p_gpio_bank res2[0x2];
+       struct s5p_gpio_bank j0;
+       struct s5p_gpio_bank j1;
+};
+
+struct exynos4x12_gpio_part2 {
+       struct s5p_gpio_bank res1[0x2];
+       struct s5p_gpio_bank k0;
+       struct s5p_gpio_bank k1;
+       struct s5p_gpio_bank k2;
+       struct s5p_gpio_bank k3;
+       struct s5p_gpio_bank l0;
+       struct s5p_gpio_bank l1;
+       struct s5p_gpio_bank l2;
+       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 res2[0x3];
+       struct s5p_gpio_bank m0;
+       struct s5p_gpio_bank m1;
+       struct s5p_gpio_bank m2;
+       struct s5p_gpio_bank m3;
+       struct s5p_gpio_bank m4;
+       struct s5p_gpio_bank res3[0x48];
+       struct s5p_gpio_bank x0;
+       struct s5p_gpio_bank x1;
+       struct s5p_gpio_bank x2;
+       struct s5p_gpio_bank x3;
+};
+
+struct exynos4x12_gpio_part3 {
+       struct s5p_gpio_bank z;
+};
+
+struct exynos4x12_gpio_part4 {
+       struct s5p_gpio_bank v0;
+       struct s5p_gpio_bank v1;
+       struct s5p_gpio_bank res1[0x1];
+       struct s5p_gpio_bank v2;
+       struct s5p_gpio_bank v3;
+       struct s5p_gpio_bank res2[0x1];
+       struct s5p_gpio_bank v4;
+};
+
 struct exynos5_gpio_part1 {
        struct s5p_gpio_bank a0;
        struct s5p_gpio_bank a1;
@@ -163,6 +224,30 @@ void s5p_gpio_set_rate(struct s5p_gpio_bank *bank, int gpio, int mode);
            - EXYNOS4_GPIO_PART2_BASE) / sizeof(struct s5p_gpio_bank)) \
          * GPIO_PER_BANK) + pin) + EXYNOS4_GPIO_PART1_MAX)
 
+#define exynos4x12_gpio_part1_get_nr(bank, pin) \
+       ((((((unsigned int) &(((struct exynos4x12_gpio_part1 *) \
+                              EXYNOS4X12_GPIO_PART1_BASE)->bank)) \
+           - EXYNOS4X12_GPIO_PART1_BASE) / sizeof(struct s5p_gpio_bank)) \
+         * GPIO_PER_BANK) + pin)
+
+#define EXYNOS4X12_GPIO_PART1_MAX ((sizeof(struct exynos4x12_gpio_part1) \
+                           / sizeof(struct s5p_gpio_bank)) * GPIO_PER_BANK)
+
+#define exynos4x12_gpio_part2_get_nr(bank, pin) \
+       (((((((unsigned int) &(((struct exynos4x12_gpio_part2 *) \
+                               EXYNOS4X12_GPIO_PART2_BASE)->bank)) \
+           - EXYNOS4X12_GPIO_PART2_BASE) / sizeof(struct s5p_gpio_bank)) \
+         * GPIO_PER_BANK) + pin) + EXYNOS4X12_GPIO_PART1_MAX)
+
+#define EXYNOS4X12_GPIO_PART2_MAX ((sizeof(struct exynos4x12_gpio_part2) \
+                           / sizeof(struct s5p_gpio_bank)) * GPIO_PER_BANK)
+
+#define exynos4x12_gpio_part3_get_nr(bank, pin) \
+       (((((((unsigned int) &(((struct exynos4x12_gpio_part3 *) \
+                               EXYNOS4X12_GPIO_PART3_BASE)->bank)) \
+           - EXYNOS4X12_GPIO_PART3_BASE) / sizeof(struct s5p_gpio_bank)) \
+         * GPIO_PER_BANK) + pin) + EXYNOS4X12_GPIO_PART2_MAX)
+
 #define exynos5_gpio_part1_get_nr(bank, pin) \
        ((((((unsigned int) &(((struct exynos5_gpio_part1 *) \
                               EXYNOS5_GPIO_PART1_BASE)->bank)) \
@@ -207,6 +292,25 @@ static inline unsigned int s5p_gpio_base(int nr)
        return 0;
 }
 
+static inline unsigned int s5p_gpio_part_max(int nr)
+{
+       if (cpu_is_exynos5()) {
+               if (nr < EXYNOS5_GPIO_PART1_MAX)
+                       return 0;
+               else if (nr < EXYNOS5_GPIO_PART2_MAX)
+                       return EXYNOS5_GPIO_PART1_MAX;
+               else
+                       return EXYNOS5_GPIO_PART2_MAX;
+
+       } else if (cpu_is_exynos4()) {
+               if (nr < EXYNOS4_GPIO_PART1_MAX)
+                       return 0;
+               else
+                       return EXYNOS4_GPIO_PART1_MAX;
+       }
+
+       return 0;
+}
 #endif
 
 /* Pin configurations */
diff --git a/arch/arm/include/asm/arch-exynos/i2s-regs.h b/arch/arm/include/asm/arch-exynos/i2s-regs.h
new file mode 100644 (file)
index 0000000..2326ca0
--- /dev/null
@@ -0,0 +1,66 @@
+/*
+ * Copyright (C) 2012 Samsung Electronics
+ * R. Chandrasekar <rcsekar@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 __I2S_REGS_H__
+#define __I2S_REGS_H__
+
+#define CON_TXFIFO_FULL                (1 << 8)
+#define CON_TXCH_PAUSE         (1 << 4)
+#define CON_ACTIVE             (1 << 0)
+
+#define MOD_BLCP_SHIFT         24
+#define MOD_BLCP_16BIT         (0 << MOD_BLCP_SHIFT)
+#define MOD_BLCP_8BIT          (1 << MOD_BLCP_SHIFT)
+#define MOD_BLCP_24BIT         (2 << MOD_BLCP_SHIFT)
+#define MOD_BLCP_MASK          (3 << MOD_BLCP_SHIFT)
+
+#define MOD_BLC_16BIT          (0 << 13)
+#define MOD_BLC_8BIT           (1 << 13)
+#define MOD_BLC_24BIT          (2 << 13)
+#define MOD_BLC_MASK           (3 << 13)
+
+#define MOD_SLAVE              (1 << 11)
+#define MOD_MASK               (3 << 8)
+#define MOD_LR_LLOW            (0 << 7)
+#define MOD_LR_RLOW            (1 << 7)
+#define MOD_SDF_IIS            (0 << 5)
+#define MOD_SDF_MSB            (1 << 5)
+#define MOD_SDF_LSB            (2 << 5)
+#define MOD_SDF_MASK           (3 << 5)
+#define MOD_RCLK_256FS         (0 << 3)
+#define MOD_RCLK_512FS         (1 << 3)
+#define MOD_RCLK_384FS         (2 << 3)
+#define MOD_RCLK_768FS         (3 << 3)
+#define MOD_RCLK_MASK          (3 << 3)
+#define MOD_BCLK_32FS          (0 << 1)
+#define MOD_BCLK_48FS          (1 << 1)
+#define MOD_BCLK_16FS          (2 << 1)
+#define MOD_BCLK_24FS          (3 << 1)
+#define MOD_BCLK_MASK          (3 << 1)
+
+#define MOD_CDCLKCON           (1 << 12)
+
+#define FIC_TXFLUSH            (1 << 15)
+#define FIC_RXFLUSH            (1 << 7)
+
+#endif /* __I2S_REGS_H__ */
index 9a7cbeb599057b9285754489ac35d8c7ad472471..c1c9a3578ae40cfe62c9f1a180a4f5b561a20eab 100644 (file)
@@ -358,7 +358,14 @@ struct mipi_dsim_lcd_driver {
        void    (*mipi_display_on)(struct mipi_dsim_device *dsim_dev);
 };
 
+#ifdef CONFIG_EXYNOS_MIPI_DSIM
 int exynos_mipi_dsi_init(void);
+#else
+static inline int exynos_mipi_dsi_init(void)
+{
+       return 0;
+}
+#endif
 
 /*
  * register mipi_dsim_lcd_driver object defined by lcd panel driver
index b861d7d58425060a3a90d545e42efaa27f82177d..89bcdfc0cc3ffec97abd7edbc9e3382d65503443 100644 (file)
 #define __ASM_ARM_ARCH_PERIPH_H
 
 /*
- * Peripherals requiring clock/pinmux configuration. List will
+ * Peripherals required for pinmux configuration. List will
  * grow with support for more devices getting added.
+ * Numbering based on interrupt table.
  *
  */
 enum periph_id {
-       PERIPH_ID_I2C0,
+       PERIPH_ID_UART0 = 51,
+       PERIPH_ID_UART1,
+       PERIPH_ID_UART2,
+       PERIPH_ID_UART3,
+       PERIPH_ID_I2C0 = 56,
        PERIPH_ID_I2C1,
        PERIPH_ID_I2C2,
        PERIPH_ID_I2C3,
@@ -38,15 +43,24 @@ enum periph_id {
        PERIPH_ID_I2C5,
        PERIPH_ID_I2C6,
        PERIPH_ID_I2C7,
-       PERIPH_ID_SDMMC0,
+       PERIPH_ID_SPI0 = 68,
+       PERIPH_ID_SPI1,
+       PERIPH_ID_SPI2,
+       PERIPH_ID_SDMMC0 = 75,
        PERIPH_ID_SDMMC1,
        PERIPH_ID_SDMMC2,
        PERIPH_ID_SDMMC3,
-       PERIPH_ID_SROMC,
-       PERIPH_ID_UART0,
-       PERIPH_ID_UART1,
-       PERIPH_ID_UART2,
-       PERIPH_ID_UART3,
+       PERIPH_ID_I2S1 = 99,
+
+       /* Since following peripherals do
+        * not have shared peripheral interrupts (SPIs)
+        * they are numbered arbitiraly after the maximum
+        * SPIs Exynos has (128)
+        */
+       PERIPH_ID_SROMC = 128,
+       PERIPH_ID_SPI3,
+       PERIPH_ID_SPI4,
+       PERIPH_ID_SDMMC4,
 
        PERIPH_ID_COUNT,
        PERIPH_ID_NONE = -1,
index 10ea736c7dd3a2091515bd4a938195b5aaee7dd4..014eebc75d97919aa85b8eef593ceeb15a9e9e4f 100644 (file)
@@ -55,4 +55,12 @@ enum {
  */
 int exynos_pinmux_config(int peripheral, int flags);
 
+/**
+ * Decode the peripheral id using the interrpt numbers.
+ *
+ * @param blob  Device tree blob
+ * @param node  FDT I2C node to find
+ * @return peripheral id if ok, PERIPH_ID_NONE on error
+ */
+int pinmux_decode_periph_id(const void *blob, int node);
 #endif
diff --git a/arch/arm/include/asm/arch-exynos/sound.h b/arch/arm/include/asm/arch-exynos/sound.h
new file mode 100644 (file)
index 0000000..d1bd2f6
--- /dev/null
@@ -0,0 +1,44 @@
+/*
+ * Copyright (C) 2012 Samsung Electronics
+ * Rajeshwari Shinde <rajeshwari.s@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 __SOUND_ARCH_H__
+#define __SOUND_ARCH_H__
+
+/* I2S values */
+#define I2S_PLL_CLK            192000000
+#define I2S_SAMPLING_RATE      48000
+#define I2S_BITS_PER_SAMPLE    16
+#define I2S_CHANNELS           2
+#define I2S_RFS                        256
+#define I2S_BFS                        32
+
+/* I2C values */
+#define AUDIO_I2C_BUS          1
+#define AUDIO_I2C_REG          0x1a
+
+/* Audio Codec */
+#define AUDIO_CODEC            "wm8994"
+
+#define AUDIO_COMPAT           1
+#endif
diff --git a/arch/arm/include/asm/arch-exynos/spi.h b/arch/arm/include/asm/arch-exynos/spi.h
new file mode 100644 (file)
index 0000000..7cab1e9
--- /dev/null
@@ -0,0 +1,78 @@
+/*
+ * (C) Copyright 2012 SAMSUNG Electronics
+ * Padmavathi Venna <padma.v@samsung.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+#ifndef __ASM_ARCH_EXYNOS_COMMON_SPI_H_
+#define __ASM_ARCH_EXYNOS_COMMON_SPI_H_
+
+#ifndef __ASSEMBLY__
+
+/* SPI peripheral register map; padded to 64KB */
+struct exynos_spi {
+       unsigned int            ch_cfg;         /* 0x00 */
+       unsigned char           reserved0[4];
+       unsigned int            mode_cfg;       /* 0x08 */
+       unsigned int            cs_reg;         /* 0x0c */
+       unsigned char           reserved1[4];
+       unsigned int            spi_sts;        /* 0x14 */
+       unsigned int            tx_data;        /* 0x18 */
+       unsigned int            rx_data;        /* 0x1c */
+       unsigned int            pkt_cnt;        /* 0x20 */
+       unsigned char           reserved2[4];
+       unsigned char           reserved3[4];
+       unsigned int            fb_clk;         /* 0x2c */
+       unsigned char           padding[0xffd0];
+};
+
+#define EXYNOS_SPI_MAX_FREQ    50000000
+
+#define SPI_TIMEOUT_MS         10
+
+/* SPI_CHCFG */
+#define SPI_CH_HS_EN           (1 << 6)
+#define SPI_CH_RST             (1 << 5)
+#define SPI_SLAVE_MODE         (1 << 4)
+#define SPI_CH_CPOL_L          (1 << 3)
+#define SPI_CH_CPHA_B          (1 << 2)
+#define SPI_RX_CH_ON           (1 << 1)
+#define SPI_TX_CH_ON           (1 << 0)
+
+/* SPI_MODECFG */
+#define SPI_MODE_CH_WIDTH_WORD (0x2 << 29)
+#define SPI_MODE_BUS_WIDTH_WORD        (0x2 << 17)
+
+/* SPI_CSREG */
+#define SPI_SLAVE_SIG_INACT    (1 << 0)
+
+/* SPI_STS */
+#define SPI_ST_TX_DONE         (1 << 25)
+#define SPI_FIFO_LVL_MASK      0x1ff
+#define SPI_TX_LVL_OFFSET      6
+#define SPI_RX_LVL_OFFSET      15
+
+/* Feedback Delay */
+#define SPI_CLK_BYPASS         (0 << 0)
+#define SPI_FB_DELAY_90                (1 << 0)
+#define SPI_FB_DELAY_180       (2 << 0)
+#define SPI_FB_DELAY_270       (3 << 0)
+
+/* Packet Count */
+#define SPI_PACKET_CNT_EN      (1 << 16)
+
+#endif /* __ASSEMBLY__ */
+#endif
index f616bcb37bc0c1782e10d7255ac577a9983d9a77..dc6aae2c50c413f10b43061c8ec3b8f08559c8b1 100644 (file)
@@ -48,4 +48,22 @@ struct s5p_sromc {
 /* Configure the Band Width and Bank Control Regs for required SROMC Bank */
 void s5p_config_sromc(u32 srom_bank, u32 srom_bw_conf, u32 srom_bc_conf);
 
+enum {
+       FDT_SROM_PMC,
+       FDT_SROM_TACP,
+       FDT_SROM_TAH,
+       FDT_SROM_TCOH,
+       FDT_SROM_TACC,
+       FDT_SROM_TCOS,
+       FDT_SROM_TACS,
+
+       FDT_SROM_TIMING_COUNT,
+};
+
+struct fdt_sromc {
+       u8 bank;        /* srom bank number */
+       u8 width;       /* bus width in bytes */
+       unsigned int timing[FDT_SROM_TIMING_COUNT]; /* timing parameters */
+};
+
 #endif /* __ASM_ARCH_SROMC_H_ */
index 57bfe8e78b1081ed9e627335ad6e8619d9b93ebd..009a6bb8f3f2cd4af353ef56e2bf68938f9538ac 100644 (file)
@@ -33,7 +33,7 @@
                        | (attr << 8) | (kw_winctrl_calcsize(size) << 16))
 
 #define KWGBE_PORT_SERIAL_CONTROL1_REG(_x)     \
-               ((_x ? KW_EGIGA0_BASE : KW_EGIGA1_BASE) + 0x44c)
+               ((_x ? KW_EGIGA1_BASE : KW_EGIGA0_BASE) + 0x44c)
 
 #define KW_REG_PCIE_DEVID              (KW_REG_PCIE_BASE + 0x00)
 #define KW_REG_PCIE_REVID              (KW_REG_PCIE_BASE + 0x08)
index 8ceea7bb886ee127a5d803586205e4d07be8fc18..48d1477fff77069215458a91b3d1d0eacee39815 100644 (file)
 
 #define MPP_MAX                        49
 
-void kirkwood_mpp_conf(u32 *mpp_list, u32 *mpp_save);
+void kirkwood_mpp_conf(const u32 *mpp_list, u32 *mpp_save);
 
 #endif
index 53aafe3075f4af9fbbea20f6a8a1e5444a95595a..5f4b543823470e037b6828ca99ff3876382c3b6f 100644 (file)
 #if !(defined(__KERNEL_STRICT_NAMES) || defined(__ASSEMBLY__))
 #include <asm/types.h>
 
-#ifdef CONFIG_FEC_MXC
-extern void mx25_fec_init_pins(void);
-#endif
-
 /* Clock Control Module (CCM) registers */
 struct ccm_regs {
        u32 mpctl;      /* Core PLL Control */
@@ -245,6 +241,7 @@ struct aips_regs {
 #define IMX_RTIC_BASE          (0x53FEC000)
 #define IMX_IIM_BASE           (0x53FF0000)
 #define IMX_USB_BASE           (0x53FF4000)
+#define IMX_USB_PORT_OFFSET    0x200
 #define IMX_CSI_BASE           (0x53FF8000)
 #define IMX_DRYICE_BASE                (0x53FFC000)
 
index 6a01a7b04c864b0b4f38e893581eae2f3ff38381..46db341e8a330e7a9a218e7ee12e2ba4db54f624 100644 (file)
@@ -25,5 +25,8 @@
 #define _SYS_PROTO_H_
 
 void mx25_uart1_init_pins(void);
+#if defined CONFIG_FEC_MXC
+extern void mx25_fec_init_pins(void);
+#endif
 
 #endif
index 1dbb8dabe97f29eb67f92dbca255c6c449b89970..25c3f70f6c41fda096b6fdead6fd60a738887db1 100644 (file)
@@ -58,7 +58,5 @@ extern void mx31_set_gpr(enum iomux_gp_func gp, char en);
 void mx31_uart1_hw_init(void);
 void mx31_uart2_hw_init(void);
 void mx31_spi2_hw_init(void);
-void mxc_hw_watchdog_enable(void);
-void mxc_hw_watchdog_reset(void);
 
 #endif /* __ASM_ARCH_CLOCK_H */
index 8fd3d08069be2ce96bf708c3e14a05ab75185738..3f58318b023b3d85fe6778f0855235f7838f759b 100644 (file)
@@ -68,17 +68,6 @@ struct cspi_regs {
        u32 test;
 };
 
-/* Watchdog Timer (WDOG) registers */
-#define WDOG_ENABLE    (1 << 2)
-#define WDOG_WT_SHIFT  8
-#define WDOG_WDZST     (1 << 0)
-
-struct wdog_regs {
-       u16 wcr;        /* Control */
-       u16 wsr;        /* Service */
-       u16 wrsr;       /* Reset Status */
-};
-
 /* IIM Control Registers */
 struct iim_regs {
        u32 iim_stat;
@@ -687,7 +676,7 @@ struct esdc_regs {
 
 #define ARM_PPMRR              0x40000015
 
-#define WDOG_BASE              0x53FDC000
+#define WDOG1_BASE_ADDR                0x53FDC000
 
 /*
  * GPIO
@@ -895,32 +884,7 @@ struct esdc_regs {
 
 #define MX31_AIPS1_BASE_ADDR   0x43f00000
 #define IMX_USB_BASE           (MX31_AIPS1_BASE_ADDR + 0x88000)
-
-/* USB portsc */
-/* values for portsc field */
-#define MXC_EHCI_PHY_LOW_POWER_SUSPEND (1 << 23)
-#define MXC_EHCI_FORCE_FS              (1 << 24)
-#define MXC_EHCI_UTMI_8BIT             (0 << 28)
-#define MXC_EHCI_UTMI_16BIT            (1 << 28)
-#define MXC_EHCI_SERIAL                        (1 << 29)
-#define MXC_EHCI_MODE_UTMI             (0 << 30)
-#define MXC_EHCI_MODE_PHILIPS          (1 << 30)
-#define MXC_EHCI_MODE_ULPI             (2 << 30)
-#define MXC_EHCI_MODE_SERIAL           (3 << 30)
-
-/* values for flags field */
-#define MXC_EHCI_INTERFACE_DIFF_UNI    (0 << 0)
-#define MXC_EHCI_INTERFACE_DIFF_BI     (1 << 0)
-#define MXC_EHCI_INTERFACE_SINGLE_UNI  (2 << 0)
-#define MXC_EHCI_INTERFACE_SINGLE_BI   (3 << 0)
-#define MXC_EHCI_INTERFACE_MASK                (0xf)
-
-#define MXC_EHCI_POWER_PINS_ENABLED    (1 << 5)
-#define MXC_EHCI_TTL_ENABLED           (1 << 6)
-
-#define MXC_EHCI_INTERNAL_PHY          (1 << 7)
-#define MXC_EHCI_IPPUE_DOWN            (1 << 8)
-#define MXC_EHCI_IPPUE_UP              (1 << 9)
+#define IMX_USB_PORT_OFFSET    0x200
 
 /*
  * CSPI register definitions
index 7b098094fe6d389d883dc41177948a51050654a8..7f337be557fd75067c9c1c17f865b7ecc884d6be 100644 (file)
@@ -33,6 +33,8 @@
 #define IRAM_BASE_ADDR         0x10000000      /* internal ram */
 #define IRAM_SIZE              0x00020000      /* 128 KB */
 
+#define LOW_LEVEL_SRAM_STACK   0x1001E000
+
 /*
  * AIPS 1
  */
 #define GPIO2_BASE_ADDR                0x53FD0000
 #define SDMA_BASE_ADDR         0x53FD4000
 #define RTC_BASE_ADDR          0x53FD8000
-#define WDOG_BASE_ADDR         0x53FDC000
+#define WDOG1_BASE_ADDR                0x53FDC000
 #define PWM_BASE_ADDR          0x53FE0000
 #define RTIC_BASE_ADDR         0x53FEC000
 #define IIM_BASE_ADDR          0x53FF0000
+#define IMX_USB_BASE           0x53FF4000
+#define IMX_USB_PORT_OFFSET    0x400
 
 #define IMX_CCM_BASE           CCM_BASE_ADDR
 
@@ -288,15 +292,6 @@ struct cspi_regs {
        u32 test;
 };
 
-/* Watchdog Timer (WDOG) registers */
-struct wdog_regs {
-       u16 wcr;        /* Control */
-       u16 wsr;        /* Service */
-       u16 wrsr;       /* Reset Status */
-       u16 wicr;       /* Interrupt Control */
-       u16 wmcr;       /* Misc Control */
-};
-
 struct esdc_regs {
        u32     esdctl0;
        u32     esdcfg0;
diff --git a/arch/arm/include/asm/arch-mx35/mmc_host_def.h b/arch/arm/include/asm/arch-mx35/mmc_host_def.h
new file mode 100644 (file)
index 0000000..775b955
--- /dev/null
@@ -0,0 +1,31 @@
+/*
+ * (C) Copyright 2008
+ * Texas Instruments, <www.ti.com>
+ * Syed Mohammed Khasim <khasim@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's version 2 of
+ * the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public 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 MMC_HOST_DEF_H
+#define MMC_HOST_DEF_H
+
+/* Driver definitions */
+#define MMCSD_SECTOR_SIZE              512
+
+#endif /* MMC_HOST_DEF_H */
diff --git a/arch/arm/include/asm/arch-mx35/spl.h b/arch/arm/include/asm/arch-mx35/spl.h
new file mode 100644 (file)
index 0000000..91d11ae
--- /dev/null
@@ -0,0 +1,38 @@
+/*
+ * (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        _ASM_ARCH_SPL_H_
+#define        _ASM_SPL_H_
+
+#define BOOT_DEVICE_NONE       0
+#define BOOT_DEVICE_XIP                1
+#define BOOT_DEVICE_XIPWAIT    2
+#define BOOT_DEVICE_NAND       3
+#define BOOT_DEVICE_ONE_NAND   4
+#define BOOT_DEVICE_MMC1       5
+#define BOOT_DEVICE_MMC2       6
+#define BOOT_DEVICE_MMC2_2     7
+#define BOOT_DEVICE_NOR                8
+#define BOOT_DEVICE_I2C                9
+#define BOOT_DEVICE_SPI                10
+
+#endif
index 9c0d51321de00159de3c0c7101daf0d6596351c5..aa3549cb0dddfa90d999774774edd71c50d13ff0 100644 (file)
@@ -25,6 +25,8 @@
 #define _SYS_PROTO_H_
 
 u32 get_cpu_rev(void);
+void mx3_setup_sdram_bank(u32 start_address, u32 ddr2_config,
+       u32 row, u32 col, u32 dsize, u32 refresh);
 #define is_soc_rev(rev)        ((get_cpu_rev() & 0xFF) - rev)
 
 #endif
index 1d060fd23ed0b13c8780a299c287d1450b22c604..249d15a5053ad0cbd7b48033c2c5c7c5b4c0c44c 100644 (file)
  */
 #define WBED           1
 
-/*
- * WEIM WCR
- */
-#define BCM            1
-#define GBCD(x)                (((x) & 0x3) << 1)
-#define INTEN          (1 << 4)
-#define INTPOL         (1 << 5)
-#define WDOG_EN                (1 << 8)
-#define WDOG_LIMIT(x)  (((x) & 0x3) << 9)
-
 #define CS0_128                                        0
 #define CS0_64M_CS1_64M                                1
 #define CS0_64M_CS1_32M_CS2_32M                        2
index 122fbeef6ad884e7660bb4c8cad7c8eb6958c8fc..3457f6a63202a8e13ff3c397eae769529f231d34 100644 (file)
@@ -802,22 +802,22 @@ typedef enum iomux_input_select {
        MX53_CSPI_IPP_CSPI_CLK_IN_SELECT_INPUT,
        MX53_CSPI_IPP_IND_MISO_SELECT_INPUT,
        MX53_CSPI_IPP_IND_MOSI_SELECT_INPUT,
+       MX53_CSPI_IPP_IND_SS_B_0_SELECT_INPUT,
        MX53_CSPI_IPP_IND_SS_B_1_SELECT_INPUT,
        MX53_CSPI_IPP_IND_SS_B_2_SELECT_INPUT,
        MX53_CSPI_IPP_IND_SS_B_3_SELECT_INPUT,
-       MX53_CSPI_IPP_IND_SS_B_4_SELECT_INPUT,
        MX53_ECSPI1_IPP_CSPI_CLK_IN_SELECT_INPUT,
        MX53_ECSPI1_IPP_IND_MISO_SELECT_INPUT,
        MX53_ECSPI1_IPP_IND_MOSI_SELECT_INPUT,
+       MX53_ECSPI1_IPP_IND_SS_B_0_SELECT_INPUT,
        MX53_ECSPI1_IPP_IND_SS_B_1_SELECT_INPUT,
        MX53_ECSPI1_IPP_IND_SS_B_2_SELECT_INPUT,
        MX53_ECSPI1_IPP_IND_SS_B_3_SELECT_INPUT,
-       MX53_ECSPI1_IPP_IND_SS_B_4_SELECT_INPUT,
        MX53_ECSPI2_IPP_CSPI_CLK_IN_SELECT_INPUT,
        MX53_ECSPI2_IPP_IND_MISO_SELECT_INPUT,
        MX53_ECSPI2_IPP_IND_MOSI_SELECT_INPUT,
+       MX53_ECSPI2_IPP_IND_SS_B_0_SELECT_INPUT,
        MX53_ECSPI2_IPP_IND_SS_B_1_SELECT_INPUT,
-       MX53_ECSPI2_IPP_IND_SS_B_2_SELECT_INPUT,
        MX53_ESAI1_IPP_IND_FSR_SELECT_INPUT,
        MX53_ESAI1_IPP_IND_FST_SELECT_INPUT,
        MX53_ESAI1_IPP_IND_HCKR_SELECT_INPUT,
index 7b5246eea67fe61b4fc6db6aefe34f3f41b59b96..93ad1c6b336715acc80bf1477d69ea1707e25164 100644 (file)
 #ifndef _SYS_PROTO_H_
 #define _SYS_PROTO_H_
 
-u32 get_cpu_rev(void);
+#define MXC_CPU_MX51           0x51
+#define MXC_CPU_MX53           0x53
+#define MXC_CPU_MX6SL          0x60
+#define MXC_CPU_MX6DL          0x61
+#define MXC_CPU_MX6SOLO                0x62
+#define MXC_CPU_MX6Q           0x63
+
 #define is_soc_rev(rev)        ((get_cpu_rev() & 0xFF) - rev)
+u32 get_cpu_rev(void);
+unsigned imx_ddr_size(void);
 void sdelay(unsigned long);
 void set_chipselect_size(int const);
 
index 09ab010138b965950fb45679e84f5bad8ac36908..3eb0081ca8088ac913ba46d5f6cdb6e5d0d5b1c1 100644 (file)
@@ -564,6 +564,8 @@ struct anatop_regs {
        u32     usb2_misc_clr;          /* 0x258 */
        u32     usb2_misc_tog;          /* 0x25c */
        u32     digprog;                /* 0x260 */
+       u32     reserved1[7];
+       u32     digprog_sololite;       /* 0x280 */
 };
 
 #define ANATOP_PFD_480_PFD0_FRAC_SHIFT         0
diff --git a/arch/arm/include/asm/arch-mx6/mx6dl_pins.h b/arch/arm/include/asm/arch-mx6/mx6dl_pins.h
new file mode 100644 (file)
index 0000000..79e2c4f
--- /dev/null
@@ -0,0 +1,149 @@
+/*
+ * Copyright (C) 2012 Freescale Semiconductor, Inc. All Rights Reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+
+ * You 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 __ASM_ARCH_MX6_MX6DL_PINS_H__
+#define __ASM_ARCH_MX6_MX6DL_PINS_H__
+
+#include <asm/imx-common/iomux-v3.h>
+
+/* Use to set PAD control */
+#define PAD_CTL_HYS            (1 << 16)
+#define PAD_CTL_PUS_100K_DOWN  (0 << 14)
+#define PAD_CTL_PUS_47K_UP     (1 << 14)
+#define PAD_CTL_PUS_100K_UP    (2 << 14)
+#define PAD_CTL_PUS_22K_UP     (3 << 14)
+
+#define PAD_CTL_PUE            (1 << 13)
+#define PAD_CTL_PKE            (1 << 12)
+#define PAD_CTL_ODE            (1 << 11)
+#define PAD_CTL_SPEED_LOW      (1 << 6)
+#define PAD_CTL_SPEED_MED      (2 << 6)
+#define PAD_CTL_SPEED_HIGH     (3 << 6)
+#define PAD_CTL_DSE_DISABLE    (0 << 3)
+#define PAD_CTL_DSE_240ohm     (1 << 3)
+#define PAD_CTL_DSE_120ohm     (2 << 3)
+#define PAD_CTL_DSE_80ohm      (3 << 3)
+#define PAD_CTL_DSE_60ohm      (4 << 3)
+#define PAD_CTL_DSE_48ohm      (5 << 3)
+#define PAD_CTL_DSE_40ohm      (6 << 3)
+#define PAD_CTL_DSE_34ohm      (7 << 3)
+#define PAD_CTL_SRE_FAST       (1 << 0)
+#define PAD_CTL_SRE_SLOW       (0 << 0)
+
+#define IOMUX_CONFIG_SION 0x10
+#define NO_MUX_I                0
+#define NO_PAD_I                0
+enum {
+       MX6DL_PAD_DI0_DISP_CLK__IPU1_DI0_DISP_CLK = IOMUX_PAD(0x03B0, 0x009C, 0, 0x0000, 0, PAD_CTL_DSE_120ohm),
+       MX6DL_PAD_DI0_PIN15__IPU1_DI0_PIN15     = IOMUX_PAD(0x03B4, 0x00A0, 0, 0x0000, 0, PAD_CTL_DSE_120ohm),
+       MX6DL_PAD_DI0_PIN2__IPU1_DI0_PIN2       = IOMUX_PAD(0x03B8, 0x00A4, 0, 0x0000, 0, PAD_CTL_DSE_120ohm),
+       MX6DL_PAD_DI0_PIN3__IPU1_DI0_PIN3       = IOMUX_PAD(0x03BC, 0x00A8, 0, 0x0000, 0, PAD_CTL_DSE_120ohm),
+       MX6DL_PAD_DI0_PIN4__GPIO_4_20           = IOMUX_PAD(0x03C0, 0x00AC, 5, 0x0000, 0, PAD_CTL_DSE_120ohm),
+       MX6DL_PAD_DISP0_DAT0__IPU1_DISP0_DAT_0  = IOMUX_PAD(0x03C4, 0x00B0, 0, 0x0000, 0, PAD_CTL_DSE_120ohm),
+       MX6DL_PAD_DISP0_DAT1__IPU1_DISP0_DAT_1  = IOMUX_PAD(0x03C8, 0x00B4, 0, 0x0000, 0, PAD_CTL_DSE_120ohm),
+       MX6DL_PAD_DISP0_DAT10__IPU1_DISP0_DAT_10 = IOMUX_PAD(0x03CC, 0x00B8, 0, 0x0000, 0, PAD_CTL_DSE_120ohm),
+       MX6DL_PAD_DISP0_DAT11__IPU1_DISP0_DAT_11 = IOMUX_PAD(0x03D0, 0x00BC, 0, 0x0000, 0, PAD_CTL_DSE_120ohm),
+       MX6DL_PAD_DISP0_DAT12__IPU1_DISP0_DAT_12 = IOMUX_PAD(0x03D4, 0x00C0, 0, 0x0000, 0, PAD_CTL_DSE_120ohm),
+       MX6DL_PAD_DISP0_DAT13__IPU1_DISP0_DAT_13 = IOMUX_PAD(0x03D8, 0x00C4, 0, 0x0000, 0, PAD_CTL_DSE_120ohm),
+       MX6DL_PAD_DISP0_DAT14__IPU1_DISP0_DAT_14 = IOMUX_PAD(0x03DC, 0x00C8, 0, 0x0000, 0, PAD_CTL_DSE_120ohm),
+       MX6DL_PAD_DISP0_DAT15__IPU1_DISP0_DAT_15 = IOMUX_PAD(0x03E0, 0x00CC, 0, 0x0000, 0, PAD_CTL_DSE_120ohm),
+       MX6DL_PAD_DISP0_DAT16__IPU1_DISP0_DAT_16 = IOMUX_PAD(0x03E4, 0x00D0, 0, 0x0000, 0, PAD_CTL_DSE_120ohm),
+       MX6DL_PAD_DISP0_DAT17__IPU1_DISP0_DAT_17 = IOMUX_PAD(0x03E8, 0x00D4, 0, 0x0000, 0, PAD_CTL_DSE_120ohm),
+       MX6DL_PAD_DISP0_DAT18__IPU1_DISP0_DAT_18 = IOMUX_PAD(0x03EC, 0x00D8, 0, 0x0000, 0, PAD_CTL_DSE_120ohm),
+       MX6DL_PAD_DISP0_DAT19__IPU1_DISP0_DAT_19 = IOMUX_PAD(0x03F0, 0x00DC, 0, 0x0000, 0, PAD_CTL_DSE_120ohm),
+       MX6DL_PAD_DISP0_DAT2__IPU1_DISP0_DAT_2   = IOMUX_PAD(0x03F4, 0x00E0, 0, 0x0000, 0, PAD_CTL_DSE_120ohm),
+       MX6DL_PAD_DISP0_DAT20__IPU1_DISP0_DAT_20 = IOMUX_PAD(0x03F8, 0x00E4, 0, 0x0000, 0, PAD_CTL_DSE_120ohm),
+       MX6DL_PAD_DISP0_DAT21__IPU1_DISP0_DAT_21 = IOMUX_PAD(0x03FC, 0x00E8, 0, 0x0000, 0, PAD_CTL_DSE_120ohm),
+       MX6DL_PAD_DISP0_DAT22__IPU1_DISP0_DAT_22 = IOMUX_PAD(0x0400, 0x00EC, 0, 0x0000, 0, PAD_CTL_DSE_120ohm),
+       MX6DL_PAD_DISP0_DAT23__IPU1_DISP0_DAT_23 = IOMUX_PAD(0x0404, 0x00F0, 0, 0x0000, 0, PAD_CTL_DSE_120ohm),
+       MX6DL_PAD_DISP0_DAT3__IPU1_DISP0_DAT_3  = IOMUX_PAD(0x0408, 0x00F4, 0, 0x0000, 0, PAD_CTL_DSE_120ohm),
+       MX6DL_PAD_DISP0_DAT4__IPU1_DISP0_DAT_4  = IOMUX_PAD(0x040C, 0x00F8, 0, 0x0000, 0, PAD_CTL_DSE_120ohm),
+       MX6DL_PAD_DISP0_DAT5__IPU1_DISP0_DAT_5  = IOMUX_PAD(0x0410, 0x00FC, 0, 0x0000, 0, PAD_CTL_DSE_120ohm),
+       MX6DL_PAD_DISP0_DAT6__IPU1_DISP0_DAT_6  = IOMUX_PAD(0x0414, 0x0100, 0, 0x0000, 0, PAD_CTL_DSE_120ohm),
+       MX6DL_PAD_DISP0_DAT7__IPU1_DISP0_DAT_7  = IOMUX_PAD(0x0418, 0x0104, 0, 0x0000, 0, PAD_CTL_DSE_120ohm),
+       MX6DL_PAD_DISP0_DAT8__IPU1_DISP0_DAT_8  = IOMUX_PAD(0x041C, 0x0108, 0, 0x0000, 0, PAD_CTL_DSE_120ohm),
+       MX6DL_PAD_DISP0_DAT9__IPU1_DISP0_DAT_9  = IOMUX_PAD(0x0420, 0x010C, 0, 0x0000, 0, PAD_CTL_DSE_120ohm),
+       MX6DL_PAD_EIM_D16__ECSPI1_SCLK          = IOMUX_PAD(0x0514, 0x0144, 1, 0x07D8, 2, 0),
+       MX6DL_PAD_EIM_D17__ECSPI1_MISO          = IOMUX_PAD(0x0518, 0x0148, 1, 0x07DC, 2, 0),
+       MX6DL_PAD_EIM_D18__ECSPI1_MOSI          = IOMUX_PAD(0x051C, 0x014C, 1, 0x07E0, 2, 0),
+       MX6DL_PAD_EIM_D19__GPIO_3_19            = IOMUX_PAD(0x0520, 0x0150, 5, 0x0000, 0, 0),
+       MX6DL_PAD_EIM_D21__GPIO_3_21            = IOMUX_PAD(0x0528, 0x0158, 5, 0x0000, 0, 0),
+       MX6DL_PAD_EIM_D21__I2C1_SCL             = IOMUX_PAD(0x0528, 0x0158, 6 | IOMUX_CONFIG_SION, 0x0868, 1, 0),
+       MX6DL_PAD_EIM_D23__GPIO_3_23            = IOMUX_PAD(0x0530, 0x0160, 5, 0x0000, 0, 0),
+       MX6DL_PAD_EIM_D26__UART2_TXD            = IOMUX_PAD(0x053C, 0x016C, 4, 0x0000, 0, 0),
+       MX6DL_PAD_EIM_D27__UART2_RXD            = IOMUX_PAD(0x0540, 0x0170, 4, 0x0904, 1, 0),
+       MX6DL_PAD_EIM_D28__I2C1_SDA             = IOMUX_PAD(0x0544, 0x0174, 1 | IOMUX_CONFIG_SION, 0x086C, 1, 0),
+       MX6DL_PAD_EIM_D28__GPIO_3_28            = IOMUX_PAD(0x0544, 0x0174, 5, 0x0000, 0, 0),
+       MX6DL_PAD_ENET_MDC__ENET_MDC            = IOMUX_PAD(0x05B8, 0x01E8, 1, 0x0000, 0,  0),
+       MX6DL_PAD_ENET_MDIO__ENET_MDIO          = IOMUX_PAD(0x05BC, 0x01EC, 1, 0x0810, 0, 0),
+       MX6DL_PAD_ENET_REF_CLK__ENET_TX_CLK     = IOMUX_PAD(0x05C0, 0x01F0, 1, 0x0000, 0, 0),
+       MX6DL_PAD_ENET_RXD0__GPIO_1_27          = IOMUX_PAD(0x05C8, 0x01F8, 5, 0x0000, 0, 0),
+       MX6DL_PAD_GPIO_16__GPIO_7_11            = IOMUX_PAD(0x05E4, 0x0214, 5, 0x0000, 0, 0),
+       MX6DL_PAD_GPIO_16__I2C3_SDA             = IOMUX_PAD(0x05E4, 0x0214, 6 | IOMUX_CONFIG_SION, 0x087C, 1, 0),
+       MX6DL_PAD_GPIO_17__GPIO_7_12            = IOMUX_PAD(0x05E8, 0x0218, 5, 0x0000, 0, 0),
+       MX6DL_PAD_GPIO_18__GPIO_7_13            = IOMUX_PAD(0x05EC, 0x021C, 5, 0x0000, 0, 0),
+       MX6DL_PAD_GPIO_19__GPIO_4_5             = IOMUX_PAD(0x05F0, 0x0220, 5, 0x0000, 0, 0),
+       MX6DL_PAD_GPIO_5__GPIO_1_5              = IOMUX_PAD(0x0600, 0x0230, 5, 0x0000, 0, 0),
+       MX6DL_PAD_GPIO_5__I2C3_SCL              = IOMUX_PAD(0x0600, 0x0230, 6 | IOMUX_CONFIG_SION, 0x0878, 2, 0),
+       MX6DL_PAD_KEY_COL3__I2C2_SCL            = IOMUX_PAD(0x0638, 0x0250, 4 | IOMUX_CONFIG_SION, 0x0870, 1, 0),
+       MX6DL_PAD_KEY_COL3__GPIO_4_12           = IOMUX_PAD(0x0638, 0x0250, 5, 0x0000, 0, 0),
+       MX6DL_PAD_KEY_ROW3__I2C2_SDA            = IOMUX_PAD(0x064C, 0x0264, 4 | IOMUX_CONFIG_SION, 0x0874, 1, 0),
+       MX6DL_PAD_KEY_ROW3__GPIO_4_13           = IOMUX_PAD(0x064C, 0x0264, 5, 0x0000, 0, 0),
+       MX6DL_PAD_NANDF_D1__GPIO_2_1            = IOMUX_PAD(0x0670, 0x0288, 5, 0x0000, 0, 0),
+       MX6DL_PAD_NANDF_D2__GPIO_2_2            = IOMUX_PAD(0x0674, 0x028C, 5, 0x0000, 0, 0),
+       MX6DL_PAD_NANDF_D3__GPIO_2_3            = IOMUX_PAD(0x0678, 0x0290, 5, 0x0000, 0, 0),
+       MX6DL_PAD_NANDF_D4__GPIO_2_4            = IOMUX_PAD(0x067C, 0x0294, 5, 0x0000, 0, 0),
+       MX6DL_PAD_NANDF_D6__GPIO_2_6            = IOMUX_PAD(0x0684, 0x029C, 5, 0x0000, 0, 0),
+       MX6DL_PAD_RGMII_RD0__ENET_RGMII_RD0     = IOMUX_PAD(0x0694, 0x02AC, 1, 0x0818, 1, 0),
+       MX6DL_PAD_RGMII_RD0__GPIO_6_25          = IOMUX_PAD(0x0694, 0x02AC, 5, 0x0000, 0, 0),
+       MX6DL_PAD_RGMII_RD1__ENET_RGMII_RD1     = IOMUX_PAD(0x0698, 0x02B0, 1, 0x081C, 1, 0),
+       MX6DL_PAD_RGMII_RD1__GPIO_6_27          = IOMUX_PAD(0x0698, 0x02B0, 5, 0x0000, 0, 0),
+       MX6DL_PAD_RGMII_RD2__ENET_RGMII_RD2     = IOMUX_PAD(0x069C, 0x02B4, 1, 0x0820, 1, 0),
+       MX6DL_PAD_RGMII_RD2__GPIO_6_28          = IOMUX_PAD(0x069C, 0x02B4, 5, 0x0000, 0, 0),
+       MX6DL_PAD_RGMII_RD3__ENET_RGMII_RD3     = IOMUX_PAD(0x06A0, 0x02B8, 1, 0x0824, 1, 0),
+       MX6DL_PAD_RGMII_RD3__GPIO_6_29          = IOMUX_PAD(0x06A0, 0x02B8, 5, 0x0000, 0, 0),
+       MX6DL_PAD_RGMII_RX_CTL__RGMII_RX_CTL    = IOMUX_PAD(0x06A4, 0x02BC, 1, 0x0828, 1, 0),
+       MX6DL_PAD_RGMII_RX_CTL__GPIO_6_24       = IOMUX_PAD(0x06A4, 0x02BC, 5, 0x0000, 0, 0),
+       MX6DL_PAD_RGMII_RXC__ENET_RGMII_RXC     = IOMUX_PAD(0x06A8, 0x02C0, 1, 0x0814, 1, 0),
+       MX6DL_PAD_RGMII_RXC__GPIO_6_30          = IOMUX_PAD(0x06A8, 0x02C0, 5, 0x0000, 0, 0),
+       MX6DL_PAD_RGMII_TD0__ENET_RGMII_TD0     = IOMUX_PAD(0x06AC, 0x02C4, 1, 0x0000, 0, 0),
+       MX6DL_PAD_RGMII_TD1__ENET_RGMII_TD1     = IOMUX_PAD(0x06B0, 0x02C8, 1, 0x0000, 0, 0),
+       MX6DL_PAD_RGMII_TD2__ENET_RGMII_TD2     = IOMUX_PAD(0x06B4, 0x02CC, 1, 0x0000, 0, 0),
+       MX6DL_PAD_RGMII_TD3__ENET_RGMII_TD3     = IOMUX_PAD(0x06B8, 0x02D0, 1, 0x0000, 0, 0),
+       MX6DL_PAD_RGMII_TX_CTL__RGMII_TX_CTL    = IOMUX_PAD(0x06BC, 0x02D4, 1, 0x0000, 0, 0),
+       MX6DL_PAD_RGMII_TXC__ENET_RGMII_TXC     = IOMUX_PAD(0x06C0, 0x02D8, 1, 0x0000, 0, 0),
+       MX6DL_PAD_SD1_CMD__GPIO_1_18            = IOMUX_PAD(0x06C8, 0x02E0, 5, 0x0000, 0, 0),
+       MX6DL_PAD_SD1_DAT3__GPIO_1_21           = IOMUX_PAD(0x06D8, 0x02F0, 5, 0x0000, 0, 0),
+       MX6DL_PAD_SD3_CLK__USDHC3_CLK           = IOMUX_PAD(0x06F4, 0x030C, 0, 0x0934, 1, 0),
+       MX6DL_PAD_SD3_CMD__USDHC3_CMD           = IOMUX_PAD(0x06F8, 0x0310, 0 | IOMUX_CONFIG_SION, 0x0000, 0, 0),
+       MX6DL_PAD_SD3_DAT0__USDHC3_DAT0         = IOMUX_PAD(0x06FC, 0x0314, 0, 0x0000, 0, 0),
+       MX6DL_PAD_SD3_DAT1__USDHC3_DAT1         = IOMUX_PAD(0x0700, 0x0318, 0, 0x0000, 0, 0),
+       MX6DL_PAD_SD3_DAT2__USDHC3_DAT2         = IOMUX_PAD(0x0704, 0x031C, 0, 0x0000, 0, 0),
+       MX6DL_PAD_SD3_DAT3__USDHC3_DAT3         = IOMUX_PAD(0x0708, 0x0320, 0, 0x0000, 0, 0),
+       MX6DL_PAD_SD3_DAT5__GPIO_7_0            = IOMUX_PAD(0x0710, 0x0328, 5, 0x0000, 0, 0),
+       MX6DL_PAD_SD3_DAT6__UART1_RXD           = IOMUX_PAD(0x0714, 0x032C, 1, 0x08FC, 2, 0),
+       MX6DL_PAD_SD3_DAT7__UART1_TXD           = IOMUX_PAD(0x0718, 0x0330, 1, 0x0000, 0, 0),
+       MX6DL_PAD_SD4_CLK__USDHC4_CLK           = IOMUX_PAD(0x0720, 0x0338, 0, 0x0938, 1, 0),
+       MX6DL_PAD_SD4_CMD__USDHC4_CMD           = IOMUX_PAD(0x0724, 0x033C, 0 | IOMUX_CONFIG_SION, 0x0000, 0, 0),
+       MX6DL_PAD_SD4_DAT0__USDHC4_DAT0         = IOMUX_PAD(0x0728, 0x0340, 1, 0x0000, 0, 0),
+       MX6DL_PAD_SD4_DAT1__USDHC4_DAT1         = IOMUX_PAD(0x072C, 0x0344, 1, 0x0000, 0, 0),
+       MX6DL_PAD_SD4_DAT2__USDHC4_DAT2         = IOMUX_PAD(0x0730, 0x0348, 1, 0x0000, 0, 0),
+       MX6DL_PAD_SD4_DAT3__USDHC4_DAT3         = IOMUX_PAD(0x0734, 0x034C, 1, 0x0000, 0, 0),
+};
+#endif /* __ASM_ARCH_MX6_MX6DL_PINS_H__ */
index 711b30dfe2801b9186f8d752ed26cfef123448c9..319329761049a62516999fc30f0f0220a15ebca9 100644 (file)
 #ifndef _SYS_PROTO_H_
 #define _SYS_PROTO_H_
 
-#define is_soc_rev(rev)        ((get_cpu_rev() & 0xFF) - rev)
+#define MXC_CPU_MX51           0x51
+#define MXC_CPU_MX53           0x53
+#define MXC_CPU_MX6SL          0x60
+#define MXC_CPU_MX6DL          0x61
+#define MXC_CPU_MX6SOLO                0x62
+#define MXC_CPU_MX6Q           0x63
 
+#define is_soc_rev(rev)        ((get_cpu_rev() & 0xFF) - rev)
 u32 get_cpu_rev(void);
+const char *get_imx_type(u32 imxtype);
+unsigned imx_ddr_size(void);
 
 void set_vddsoc(u32 mv);
 
index 5e1901e6c48110279b15858e9b6c670cac57b4b0..9764041b48b12dea2cdd0948c30077f9f1623d24 100644 (file)
@@ -26,7 +26,6 @@
 #include <asm/arch/regs-apbh.h>
 #include <asm/arch/regs-base.h>
 #include <asm/arch/regs-bch.h>
-#include <asm/arch/regs-clkctrl-mx28.h>
 #include <asm/arch/regs-digctl.h>
 #include <asm/arch/regs-gpmi.h>
 #include <asm/arch/regs-i2c.h>
 #include <asm/arch/regs-lradc.h>
 #include <asm/arch/regs-ocotp.h>
 #include <asm/arch/regs-pinctrl.h>
-#include <asm/arch/regs-power.h>
 #include <asm/arch/regs-rtc.h>
 #include <asm/arch/regs-ssp.h>
 #include <asm/arch/regs-timrot.h>
 
+#ifdef CONFIG_MX28
+#include <asm/arch/regs-clkctrl-mx28.h>
+#include <asm/arch/regs-power-mx28.h>
+#endif
+
 #endif /* __IMX_REGS_H__ */
index b662fbe440049cbb2d9a7743d099c29f867d57b1..23e9adc25a28ee1cf8251b4b00ef70fe6bb67d46 100644 (file)
 #ifndef        __ASSEMBLY__
 struct mxs_clkctrl_regs {
        mxs_reg_32(hw_clkctrl_pll0ctrl0)        /* 0x00 */
-       mxs_reg_32(hw_clkctrl_pll0ctrl1)        /* 0x10 */
+       uint32_t        hw_clkctrl_pll0ctrl1;   /* 0x10 */
+       uint32_t        reserved_pll0ctrl1[3];  /* 0x14-0x1c */
        mxs_reg_32(hw_clkctrl_pll1ctrl0)        /* 0x20 */
-       mxs_reg_32(hw_clkctrl_pll1ctrl1)        /* 0x30 */
+       uint32_t        hw_clkctrl_pll1ctrl1;   /* 0x30 */
+       uint32_t        reserved_pll1ctrl1[3];  /* 0x34-0x3c */
        mxs_reg_32(hw_clkctrl_pll2ctrl0)        /* 0x40 */
        mxs_reg_32(hw_clkctrl_cpu)              /* 0x50 */
        mxs_reg_32(hw_clkctrl_hbus)             /* 0x60 */
diff --git a/arch/arm/include/asm/arch-mxs/regs-power-mx28.h b/arch/arm/include/asm/arch-mxs/regs-power-mx28.h
new file mode 100644 (file)
index 0000000..257ee88
--- /dev/null
@@ -0,0 +1,413 @@
+/*
+ * Freescale i.MX28 Power Controller Register Definitions
+ *
+ * Copyright (C) 2011 Marek Vasut <marek.vasut@gmail.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+ *
+ */
+
+#ifndef __MX28_REGS_POWER_H__
+#define __MX28_REGS_POWER_H__
+
+#include <asm/arch/regs-common.h>
+
+#ifndef        __ASSEMBLY__
+struct mxs_power_regs {
+       mxs_reg_32(hw_power_ctrl)
+       mxs_reg_32(hw_power_5vctrl)
+       mxs_reg_32(hw_power_minpwr)
+       mxs_reg_32(hw_power_charge)
+       uint32_t        hw_power_vdddctrl;
+       uint32_t        reserved_vddd[3];
+       uint32_t        hw_power_vddactrl;
+       uint32_t        reserved_vdda[3];
+       uint32_t        hw_power_vddioctrl;
+       uint32_t        reserved_vddio[3];
+       uint32_t        hw_power_vddmemctrl;
+       uint32_t        reserved_vddmem[3];
+       uint32_t        hw_power_dcdc4p2;
+       uint32_t        reserved_dcdc4p2[3];
+       uint32_t        hw_power_misc;
+       uint32_t        reserved_misc[3];
+       uint32_t        hw_power_dclimits;
+       uint32_t        reserved_dclimits[3];
+       mxs_reg_32(hw_power_loopctrl)
+       uint32_t        hw_power_sts;
+       uint32_t        reserved_sts[3];
+       mxs_reg_32(hw_power_speed)
+       uint32_t        hw_power_battmonitor;
+       uint32_t        reserved_battmonitor[3];
+
+       uint32_t        reserved[4];
+
+       mxs_reg_32(hw_power_reset)
+       mxs_reg_32(hw_power_debug)
+       mxs_reg_32(hw_power_thermal)
+       mxs_reg_32(hw_power_usb1ctrl)
+       mxs_reg_32(hw_power_special)
+       mxs_reg_32(hw_power_version)
+       mxs_reg_32(hw_power_anaclkctrl)
+       mxs_reg_32(hw_power_refctrl)
+};
+#endif
+
+#define        POWER_CTRL_PSWITCH_MID_TRAN                     (1 << 27)
+#define        POWER_CTRL_DCDC4P2_BO_IRQ                       (1 << 24)
+#define        POWER_CTRL_ENIRQ_DCDC4P2_BO                     (1 << 23)
+#define        POWER_CTRL_VDD5V_DROOP_IRQ                      (1 << 22)
+#define        POWER_CTRL_ENIRQ_VDD5V_DROOP                    (1 << 21)
+#define        POWER_CTRL_PSWITCH_IRQ                          (1 << 20)
+#define        POWER_CTRL_PSWITCH_IRQ_SRC                      (1 << 19)
+#define        POWER_CTRL_POLARITY_PSWITCH                     (1 << 18)
+#define        POWER_CTRL_ENIRQ_PSWITCH                        (1 << 17)
+#define        POWER_CTRL_POLARITY_DC_OK                       (1 << 16)
+#define        POWER_CTRL_DC_OK_IRQ                            (1 << 15)
+#define        POWER_CTRL_ENIRQ_DC_OK                          (1 << 14)
+#define        POWER_CTRL_BATT_BO_IRQ                          (1 << 13)
+#define        POWER_CTRL_ENIRQ_BATT_BO                        (1 << 12)
+#define        POWER_CTRL_VDDIO_BO_IRQ                         (1 << 11)
+#define        POWER_CTRL_ENIRQ_VDDIO_BO                       (1 << 10)
+#define        POWER_CTRL_VDDA_BO_IRQ                          (1 << 9)
+#define        POWER_CTRL_ENIRQ_VDDA_BO                        (1 << 8)
+#define        POWER_CTRL_VDDD_BO_IRQ                          (1 << 7)
+#define        POWER_CTRL_ENIRQ_VDDD_BO                        (1 << 6)
+#define        POWER_CTRL_POLARITY_VBUSVALID                   (1 << 5)
+#define        POWER_CTRL_VBUS_VALID_IRQ                       (1 << 4)
+#define        POWER_CTRL_ENIRQ_VBUS_VALID                     (1 << 3)
+#define        POWER_CTRL_POLARITY_VDD5V_GT_VDDIO              (1 << 2)
+#define        POWER_CTRL_VDD5V_GT_VDDIO_IRQ                   (1 << 1)
+#define        POWER_CTRL_ENIRQ_VDD5V_GT_VDDIO                 (1 << 0)
+
+#define        POWER_5VCTRL_VBUSDROOP_TRSH_MASK                (0x3 << 30)
+#define        POWER_5VCTRL_VBUSDROOP_TRSH_OFFSET              30
+#define        POWER_5VCTRL_VBUSDROOP_TRSH_4V3                 (0x0 << 30)
+#define        POWER_5VCTRL_VBUSDROOP_TRSH_4V4                 (0x1 << 30)
+#define        POWER_5VCTRL_VBUSDROOP_TRSH_4V5                 (0x2 << 30)
+#define        POWER_5VCTRL_VBUSDROOP_TRSH_4V7                 (0x3 << 30)
+#define        POWER_5VCTRL_HEADROOM_ADJ_MASK                  (0x7 << 24)
+#define        POWER_5VCTRL_HEADROOM_ADJ_OFFSET                24
+#define        POWER_5VCTRL_PWD_CHARGE_4P2_MASK                (0x3 << 20)
+#define        POWER_5VCTRL_PWD_CHARGE_4P2_OFFSET              20
+#define        POWER_5VCTRL_CHARGE_4P2_ILIMIT_MASK             (0x3f << 12)
+#define        POWER_5VCTRL_CHARGE_4P2_ILIMIT_OFFSET           12
+#define        POWER_5VCTRL_VBUSVALID_TRSH_MASK                (0x7 << 8)
+#define        POWER_5VCTRL_VBUSVALID_TRSH_OFFSET              8
+#define        POWER_5VCTRL_VBUSVALID_TRSH_2V9                 (0x0 << 8)
+#define        POWER_5VCTRL_VBUSVALID_TRSH_4V0                 (0x1 << 8)
+#define        POWER_5VCTRL_VBUSVALID_TRSH_4V1                 (0x2 << 8)
+#define        POWER_5VCTRL_VBUSVALID_TRSH_4V2                 (0x3 << 8)
+#define        POWER_5VCTRL_VBUSVALID_TRSH_4V3                 (0x4 << 8)
+#define        POWER_5VCTRL_VBUSVALID_TRSH_4V4                 (0x5 << 8)
+#define        POWER_5VCTRL_VBUSVALID_TRSH_4V5                 (0x6 << 8)
+#define        POWER_5VCTRL_VBUSVALID_TRSH_4V6                 (0x7 << 8)
+#define        POWER_5VCTRL_PWDN_5VBRNOUT                      (1 << 7)
+#define        POWER_5VCTRL_ENABLE_LINREG_ILIMIT               (1 << 6)
+#define        POWER_5VCTRL_DCDC_XFER                          (1 << 5)
+#define        POWER_5VCTRL_VBUSVALID_5VDETECT                 (1 << 4)
+#define        POWER_5VCTRL_VBUSVALID_TO_B                     (1 << 3)
+#define        POWER_5VCTRL_ILIMIT_EQ_ZERO                     (1 << 2)
+#define        POWER_5VCTRL_PWRUP_VBUS_CMPS                    (1 << 1)
+#define        POWER_5VCTRL_ENABLE_DCDC                        (1 << 0)
+
+#define        POWER_MINPWR_LOWPWR_4P2                         (1 << 14)
+#define        POWER_MINPWR_PWD_BO                             (1 << 12)
+#define        POWER_MINPWR_USE_VDDXTAL_VBG                    (1 << 11)
+#define        POWER_MINPWR_PWD_ANA_CMPS                       (1 << 10)
+#define        POWER_MINPWR_ENABLE_OSC                         (1 << 9)
+#define        POWER_MINPWR_SELECT_OSC                         (1 << 8)
+#define        POWER_MINPWR_VBG_OFF                            (1 << 7)
+#define        POWER_MINPWR_DOUBLE_FETS                        (1 << 6)
+#define        POWER_MINPWR_HALFFETS                           (1 << 5)
+#define        POWER_MINPWR_LESSANA_I                          (1 << 4)
+#define        POWER_MINPWR_PWD_XTAL24                         (1 << 3)
+#define        POWER_MINPWR_DC_STOPCLK                         (1 << 2)
+#define        POWER_MINPWR_EN_DC_PFM                          (1 << 1)
+#define        POWER_MINPWR_DC_HALFCLK                         (1 << 0)
+
+#define        POWER_CHARGE_ADJ_VOLT_MASK                      (0x7 << 24)
+#define        POWER_CHARGE_ADJ_VOLT_OFFSET                    24
+#define        POWER_CHARGE_ADJ_VOLT_M025P                     (0x1 << 24)
+#define        POWER_CHARGE_ADJ_VOLT_P050P                     (0x2 << 24)
+#define        POWER_CHARGE_ADJ_VOLT_M075P                     (0x3 << 24)
+#define        POWER_CHARGE_ADJ_VOLT_P025P                     (0x4 << 24)
+#define        POWER_CHARGE_ADJ_VOLT_M050P                     (0x5 << 24)
+#define        POWER_CHARGE_ADJ_VOLT_P075P                     (0x6 << 24)
+#define        POWER_CHARGE_ADJ_VOLT_M100P                     (0x7 << 24)
+#define        POWER_CHARGE_ENABLE_LOAD                        (1 << 22)
+#define        POWER_CHARGE_ENABLE_FAULT_DETECT                (1 << 20)
+#define        POWER_CHARGE_CHRG_STS_OFF                       (1 << 19)
+#define        POWER_CHARGE_LIION_4P1                          (1 << 18)
+#define        POWER_CHARGE_PWD_BATTCHRG                       (1 << 16)
+#define        POWER_CHARGE_ENABLE_CHARGER_USB1                (1 << 13)
+#define        POWER_CHARGE_ENABLE_CHARGER_USB0                (1 << 12)
+#define        POWER_CHARGE_STOP_ILIMIT_MASK                   (0xf << 8)
+#define        POWER_CHARGE_STOP_ILIMIT_OFFSET                 8
+#define        POWER_CHARGE_STOP_ILIMIT_10MA                   (0x1 << 8)
+#define        POWER_CHARGE_STOP_ILIMIT_20MA                   (0x2 << 8)
+#define        POWER_CHARGE_STOP_ILIMIT_50MA                   (0x4 << 8)
+#define        POWER_CHARGE_STOP_ILIMIT_100MA                  (0x8 << 8)
+#define        POWER_CHARGE_BATTCHRG_I_MASK                    0x3f
+#define        POWER_CHARGE_BATTCHRG_I_OFFSET                  0
+#define        POWER_CHARGE_BATTCHRG_I_10MA                    0x01
+#define        POWER_CHARGE_BATTCHRG_I_20MA                    0x02
+#define        POWER_CHARGE_BATTCHRG_I_50MA                    0x04
+#define        POWER_CHARGE_BATTCHRG_I_100MA                   0x08
+#define        POWER_CHARGE_BATTCHRG_I_200MA                   0x10
+#define        POWER_CHARGE_BATTCHRG_I_400MA                   0x20
+
+#define        POWER_VDDDCTRL_ADJTN_MASK                       (0xf << 28)
+#define        POWER_VDDDCTRL_ADJTN_OFFSET                     28
+#define        POWER_VDDDCTRL_PWDN_BRNOUT                      (1 << 23)
+#define        POWER_VDDDCTRL_DISABLE_STEPPING                 (1 << 22)
+#define        POWER_VDDDCTRL_ENABLE_LINREG                    (1 << 21)
+#define        POWER_VDDDCTRL_DISABLE_FET                      (1 << 20)
+#define        POWER_VDDDCTRL_LINREG_OFFSET_MASK               (0x3 << 16)
+#define        POWER_VDDDCTRL_LINREG_OFFSET_OFFSET             16
+#define        POWER_VDDDCTRL_LINREG_OFFSET_0STEPS             (0x0 << 16)
+#define        POWER_VDDDCTRL_LINREG_OFFSET_1STEPS_ABOVE       (0x1 << 16)
+#define        POWER_VDDDCTRL_LINREG_OFFSET_1STEPS_BELOW       (0x2 << 16)
+#define        POWER_VDDDCTRL_LINREG_OFFSET_2STEPS_BELOW       (0x3 << 16)
+#define        POWER_VDDDCTRL_BO_OFFSET_MASK                   (0x7 << 8)
+#define        POWER_VDDDCTRL_BO_OFFSET_OFFSET                 8
+#define        POWER_VDDDCTRL_TRG_MASK                         0x1f
+#define        POWER_VDDDCTRL_TRG_OFFSET                       0
+
+#define        POWER_VDDACTRL_PWDN_BRNOUT                      (1 << 19)
+#define        POWER_VDDACTRL_DISABLE_STEPPING                 (1 << 18)
+#define        POWER_VDDACTRL_ENABLE_LINREG                    (1 << 17)
+#define        POWER_VDDACTRL_DISABLE_FET                      (1 << 16)
+#define        POWER_VDDACTRL_LINREG_OFFSET_MASK               (0x3 << 12)
+#define        POWER_VDDACTRL_LINREG_OFFSET_OFFSET             12
+#define        POWER_VDDACTRL_LINREG_OFFSET_0STEPS             (0x0 << 12)
+#define        POWER_VDDACTRL_LINREG_OFFSET_1STEPS_ABOVE       (0x1 << 12)
+#define        POWER_VDDACTRL_LINREG_OFFSET_1STEPS_BELOW       (0x2 << 12)
+#define        POWER_VDDACTRL_LINREG_OFFSET_2STEPS_BELOW       (0x3 << 12)
+#define        POWER_VDDACTRL_BO_OFFSET_MASK                   (0x7 << 8)
+#define        POWER_VDDACTRL_BO_OFFSET_OFFSET                 8
+#define        POWER_VDDACTRL_TRG_MASK                         0x1f
+#define        POWER_VDDACTRL_TRG_OFFSET                       0
+
+#define        POWER_VDDIOCTRL_ADJTN_MASK                      (0xf << 20)
+#define        POWER_VDDIOCTRL_ADJTN_OFFSET                    20
+#define        POWER_VDDIOCTRL_PWDN_BRNOUT                     (1 << 18)
+#define        POWER_VDDIOCTRL_DISABLE_STEPPING                (1 << 17)
+#define        POWER_VDDIOCTRL_DISABLE_FET                     (1 << 16)
+#define        POWER_VDDIOCTRL_LINREG_OFFSET_MASK              (0x3 << 12)
+#define        POWER_VDDIOCTRL_LINREG_OFFSET_OFFSET            12
+#define        POWER_VDDIOCTRL_LINREG_OFFSET_0STEPS            (0x0 << 12)
+#define        POWER_VDDIOCTRL_LINREG_OFFSET_1STEPS_ABOVE      (0x1 << 12)
+#define        POWER_VDDIOCTRL_LINREG_OFFSET_1STEPS_BELOW      (0x2 << 12)
+#define        POWER_VDDIOCTRL_LINREG_OFFSET_2STEPS_BELOW      (0x3 << 12)
+#define        POWER_VDDIOCTRL_BO_OFFSET_MASK                  (0x7 << 8)
+#define        POWER_VDDIOCTRL_BO_OFFSET_OFFSET                8
+#define        POWER_VDDIOCTRL_TRG_MASK                        0x1f
+#define        POWER_VDDIOCTRL_TRG_OFFSET                      0
+
+#define        POWER_VDDMEMCTRL_PULLDOWN_ACTIVE                (1 << 10)
+#define        POWER_VDDMEMCTRL_ENABLE_ILIMIT                  (1 << 9)
+#define        POWER_VDDMEMCTRL_ENABLE_LINREG                  (1 << 8)
+#define        POWER_VDDMEMCTRL_BO_OFFSET_MASK                 (0x7 << 5)
+#define        POWER_VDDMEMCTRL_BO_OFFSET_OFFSET               5
+#define        POWER_VDDMEMCTRL_TRG_MASK                       0x1f
+#define        POWER_VDDMEMCTRL_TRG_OFFSET                     0
+
+#define        POWER_DCDC4P2_DROPOUT_CTRL_MASK                 (0xf << 28)
+#define        POWER_DCDC4P2_DROPOUT_CTRL_OFFSET               28
+#define        POWER_DCDC4P2_DROPOUT_CTRL_200MV                (0x3 << 30)
+#define        POWER_DCDC4P2_DROPOUT_CTRL_100MV                (0x2 << 30)
+#define        POWER_DCDC4P2_DROPOUT_CTRL_50MV                 (0x1 << 30)
+#define        POWER_DCDC4P2_DROPOUT_CTRL_25MV                 (0x0 << 30)
+#define        POWER_DCDC4P2_DROPOUT_CTRL_SRC_4P2              (0x0 << 28)
+#define        POWER_DCDC4P2_DROPOUT_CTRL_SRC_4P2_LT_BATT      (0x1 << 28)
+#define        POWER_DCDC4P2_DROPOUT_CTRL_SRC_SEL              (0x2 << 28)
+#define        POWER_DCDC4P2_ISTEAL_THRESH_MASK                (0x3 << 24)
+#define        POWER_DCDC4P2_ISTEAL_THRESH_OFFSET              24
+#define        POWER_DCDC4P2_ENABLE_4P2                        (1 << 23)
+#define        POWER_DCDC4P2_ENABLE_DCDC                       (1 << 22)
+#define        POWER_DCDC4P2_HYST_DIR                          (1 << 21)
+#define        POWER_DCDC4P2_HYST_THRESH                       (1 << 20)
+#define        POWER_DCDC4P2_TRG_MASK                          (0x7 << 16)
+#define        POWER_DCDC4P2_TRG_OFFSET                        16
+#define        POWER_DCDC4P2_TRG_4V2                           (0x0 << 16)
+#define        POWER_DCDC4P2_TRG_4V1                           (0x1 << 16)
+#define        POWER_DCDC4P2_TRG_4V0                           (0x2 << 16)
+#define        POWER_DCDC4P2_TRG_3V9                           (0x3 << 16)
+#define        POWER_DCDC4P2_TRG_BATT                          (0x4 << 16)
+#define        POWER_DCDC4P2_BO_MASK                           (0x1f << 8)
+#define        POWER_DCDC4P2_BO_OFFSET                         8
+#define        POWER_DCDC4P2_CMPTRIP_MASK                      0x1f
+#define        POWER_DCDC4P2_CMPTRIP_OFFSET                    0
+
+#define        POWER_MISC_FREQSEL_MASK                         (0x7 << 4)
+#define        POWER_MISC_FREQSEL_OFFSET                       4
+#define        POWER_MISC_FREQSEL_20MHZ                        (0x1 << 4)
+#define        POWER_MISC_FREQSEL_24MHZ                        (0x2 << 4)
+#define        POWER_MISC_FREQSEL_19MHZ                        (0x3 << 4)
+#define        POWER_MISC_FREQSEL_14MHZ                        (0x4 << 4)
+#define        POWER_MISC_FREQSEL_18MHZ                        (0x5 << 4)
+#define        POWER_MISC_FREQSEL_21MHZ                        (0x6 << 4)
+#define        POWER_MISC_FREQSEL_17MHZ                        (0x7 << 4)
+#define        POWER_MISC_DISABLE_FET_BO_LOGIC                 (1 << 3)
+#define        POWER_MISC_DELAY_TIMING                         (1 << 2)
+#define        POWER_MISC_TEST                                 (1 << 1)
+#define        POWER_MISC_SEL_PLLCLK                           (1 << 0)
+
+#define        POWER_DCLIMITS_POSLIMIT_BUCK_MASK               (0x7f << 8)
+#define        POWER_DCLIMITS_POSLIMIT_BUCK_OFFSET             8
+#define        POWER_DCLIMITS_NEGLIMIT_MASK                    0x7f
+#define        POWER_DCLIMITS_NEGLIMIT_OFFSET                  0
+
+#define        POWER_LOOPCTRL_TOGGLE_DIF                       (1 << 20)
+#define        POWER_LOOPCTRL_HYST_SIGN                        (1 << 19)
+#define        POWER_LOOPCTRL_EN_CM_HYST                       (1 << 18)
+#define        POWER_LOOPCTRL_EN_DF_HYST                       (1 << 17)
+#define        POWER_LOOPCTRL_CM_HYST_THRESH                   (1 << 16)
+#define        POWER_LOOPCTRL_DF_HYST_THRESH                   (1 << 15)
+#define        POWER_LOOPCTRL_RCSCALE_THRESH                   (1 << 14)
+#define        POWER_LOOPCTRL_EN_RCSCALE_MASK                  (0x3 << 12)
+#define        POWER_LOOPCTRL_EN_RCSCALE_OFFSET                12
+#define        POWER_LOOPCTRL_EN_RCSCALE_DIS                   (0x0 << 12)
+#define        POWER_LOOPCTRL_EN_RCSCALE_2X                    (0x1 << 12)
+#define        POWER_LOOPCTRL_EN_RCSCALE_4X                    (0x2 << 12)
+#define        POWER_LOOPCTRL_EN_RCSCALE_8X                    (0x3 << 12)
+#define        POWER_LOOPCTRL_DC_FF_MASK                       (0x7 << 8)
+#define        POWER_LOOPCTRL_DC_FF_OFFSET                     8
+#define        POWER_LOOPCTRL_DC_R_MASK                        (0xf << 4)
+#define        POWER_LOOPCTRL_DC_R_OFFSET                      4
+#define        POWER_LOOPCTRL_DC_C_MASK                        0x3
+#define        POWER_LOOPCTRL_DC_C_OFFSET                      0
+#define        POWER_LOOPCTRL_DC_C_MAX                         0x0
+#define        POWER_LOOPCTRL_DC_C_2X                          0x1
+#define        POWER_LOOPCTRL_DC_C_4X                          0x2
+#define        POWER_LOOPCTRL_DC_C_MIN                         0x3
+
+#define        POWER_STS_PWRUP_SOURCE_MASK                     (0x3f << 24)
+#define        POWER_STS_PWRUP_SOURCE_OFFSET                   24
+#define        POWER_STS_PWRUP_SOURCE_5V                       (0x20 << 24)
+#define        POWER_STS_PWRUP_SOURCE_RTC                      (0x10 << 24)
+#define        POWER_STS_PWRUP_SOURCE_PSWITCH_HIGH             (0x02 << 24)
+#define        POWER_STS_PWRUP_SOURCE_PSWITCH_MID              (0x01 << 24)
+#define        POWER_STS_PSWITCH_MASK                          (0x3 << 20)
+#define        POWER_STS_PSWITCH_OFFSET                        20
+#define        POWER_STS_THERMAL_WARNING                       (1 << 19)
+#define        POWER_STS_VDDMEM_BO                             (1 << 18)
+#define        POWER_STS_AVALID0_STATUS                        (1 << 17)
+#define        POWER_STS_BVALID0_STATUS                        (1 << 16)
+#define        POWER_STS_VBUSVALID0_STATUS                     (1 << 15)
+#define        POWER_STS_SESSEND0_STATUS                       (1 << 14)
+#define        POWER_STS_BATT_BO                               (1 << 13)
+#define        POWER_STS_VDD5V_FAULT                           (1 << 12)
+#define        POWER_STS_CHRGSTS                               (1 << 11)
+#define        POWER_STS_DCDC_4P2_BO                           (1 << 10)
+#define        POWER_STS_DC_OK                                 (1 << 9)
+#define        POWER_STS_VDDIO_BO                              (1 << 8)
+#define        POWER_STS_VDDA_BO                               (1 << 7)
+#define        POWER_STS_VDDD_BO                               (1 << 6)
+#define        POWER_STS_VDD5V_GT_VDDIO                        (1 << 5)
+#define        POWER_STS_VDD5V_DROOP                           (1 << 4)
+#define        POWER_STS_AVALID0                               (1 << 3)
+#define        POWER_STS_BVALID0                               (1 << 2)
+#define        POWER_STS_VBUSVALID0                            (1 << 1)
+#define        POWER_STS_SESSEND0                              (1 << 0)
+
+#define        POWER_SPEED_STATUS_MASK                         (0xffff << 8)
+#define        POWER_SPEED_STATUS_OFFSET                       8
+#define        POWER_SPEED_STATUS_SEL_MASK                     (0x3 << 6)
+#define        POWER_SPEED_STATUS_SEL_OFFSET                   6
+#define        POWER_SPEED_STATUS_SEL_DCDC_STAT                (0x0 << 6)
+#define        POWER_SPEED_STATUS_SEL_CORE_STAT                (0x1 << 6)
+#define        POWER_SPEED_STATUS_SEL_ARM_STAT                 (0x2 << 6)
+#define        POWER_SPEED_CTRL_MASK                           0x3
+#define        POWER_SPEED_CTRL_OFFSET                         0
+#define        POWER_SPEED_CTRL_SS_OFF                         0x0
+#define        POWER_SPEED_CTRL_SS_ON                          0x1
+#define        POWER_SPEED_CTRL_SS_ENABLE                      0x3
+
+#define        POWER_BATTMONITOR_BATT_VAL_MASK                 (0x3ff << 16)
+#define        POWER_BATTMONITOR_BATT_VAL_OFFSET               16
+#define        POWER_BATTMONITOR_PWDN_BATTBRNOUT_5VDETECT_EN   (1 << 11)
+#define        POWER_BATTMONITOR_EN_BATADJ                     (1 << 10)
+#define        POWER_BATTMONITOR_PWDN_BATTBRNOUT               (1 << 9)
+#define        POWER_BATTMONITOR_BRWNOUT_PWD                   (1 << 8)
+#define        POWER_BATTMONITOR_BRWNOUT_LVL_MASK              0x1f
+#define        POWER_BATTMONITOR_BRWNOUT_LVL_OFFSET            0
+
+#define        POWER_RESET_UNLOCK_MASK                         (0xffff << 16)
+#define        POWER_RESET_UNLOCK_OFFSET                       16
+#define        POWER_RESET_UNLOCK_KEY                          (0x3e77 << 16)
+#define        POWER_RESET_FASTFALL_PSWITCH_OFF                (1 << 2)
+#define        POWER_RESET_PWD_OFF                             (1 << 1)
+#define        POWER_RESET_PWD                                 (1 << 0)
+
+#define        POWER_DEBUG_VBUSVALIDPIOLOCK                    (1 << 3)
+#define        POWER_DEBUG_AVALIDPIOLOCK                       (1 << 2)
+#define        POWER_DEBUG_BVALIDPIOLOCK                       (1 << 1)
+#define        POWER_DEBUG_SESSENDPIOLOCK                      (1 << 0)
+
+#define        POWER_THERMAL_TEST                              (1 << 8)
+#define        POWER_THERMAL_PWD                               (1 << 7)
+#define        POWER_THERMAL_LOW_POWER                         (1 << 6)
+#define        POWER_THERMAL_OFFSET_ADJ_MASK                   (0x3 << 4)
+#define        POWER_THERMAL_OFFSET_ADJ_OFFSET                 4
+#define        POWER_THERMAL_OFFSET_ADJ_ENABLE                 (1 << 3)
+#define        POWER_THERMAL_TEMP_THRESHOLD_MASK               0x7
+#define        POWER_THERMAL_TEMP_THRESHOLD_OFFSET             0
+
+#define        POWER_USB1CTRL_AVALID1                          (1 << 3)
+#define        POWER_USB1CTRL_BVALID1                          (1 << 2)
+#define        POWER_USB1CTRL_VBUSVALID1                       (1 << 1)
+#define        POWER_USB1CTRL_SESSEND1                         (1 << 0)
+
+#define        POWER_SPECIAL_TEST_MASK                         0xffffffff
+#define        POWER_SPECIAL_TEST_OFFSET                       0
+
+#define        POWER_VERSION_MAJOR_MASK                        (0xff << 24)
+#define        POWER_VERSION_MAJOR_OFFSET                      24
+#define        POWER_VERSION_MINOR_MASK                        (0xff << 16)
+#define        POWER_VERSION_MINOR_OFFSET                      16
+#define        POWER_VERSION_STEP_MASK                         0xffff
+#define        POWER_VERSION_STEP_OFFSET                       0
+
+#define        POWER_ANACLKCTRL_CLKGATE_0                      (1 << 31)
+#define        POWER_ANACLKCTRL_OUTDIV_MASK                    (0x7 << 28)
+#define        POWER_ANACLKCTRL_OUTDIV_OFFSET                  28
+#define        POWER_ANACLKCTRL_INVERT_OUTCLK                  (1 << 27)
+#define        POWER_ANACLKCTRL_CLKGATE_I                      (1 << 26)
+#define        POWER_ANACLKCTRL_DITHER_OFF                     (1 << 10)
+#define        POWER_ANACLKCTRL_SLOW_DITHER                    (1 << 9)
+#define        POWER_ANACLKCTRL_INVERT_INCLK                   (1 << 8)
+#define        POWER_ANACLKCTRL_INCLK_SHIFT_MASK               (0x3 << 4)
+#define        POWER_ANACLKCTRL_INCLK_SHIFT_OFFSET             4
+#define        POWER_ANACLKCTRL_INDIV_MASK                     0x7
+#define        POWER_ANACLKCTRL_INDIV_OFFSET                   0
+
+#define        POWER_REFCTRL_FASTSETTLING                      (1 << 26)
+#define        POWER_REFCTRL_RAISE_REF                         (1 << 25)
+#define        POWER_REFCTRL_XTAL_BGR_BIAS                     (1 << 24)
+#define        POWER_REFCTRL_VBG_ADJ_MASK                      (0x7 << 20)
+#define        POWER_REFCTRL_VBG_ADJ_OFFSET                    20
+#define        POWER_REFCTRL_LOW_PWR                           (1 << 19)
+#define        POWER_REFCTRL_BIAS_CTRL_MASK                    (0x3 << 16)
+#define        POWER_REFCTRL_BIAS_CTRL_OFFSET                  16
+#define        POWER_REFCTRL_VDDXTAL_TO_VDDD                   (1 << 14)
+#define        POWER_REFCTRL_ADJ_ANA                           (1 << 13)
+#define        POWER_REFCTRL_ADJ_VAG                           (1 << 12)
+#define        POWER_REFCTRL_ANA_REFVAL_MASK                   (0xf << 8)
+#define        POWER_REFCTRL_ANA_REFVAL_OFFSET                 8
+#define        POWER_REFCTRL_VAG_VAL_MASK                      (0xf << 4)
+#define        POWER_REFCTRL_VAG_VAL_OFFSET                    4
+
+#endif /* __MX28_REGS_POWER_H__ */
diff --git a/arch/arm/include/asm/arch-mxs/regs-power.h b/arch/arm/include/asm/arch-mxs/regs-power.h
deleted file mode 100644 (file)
index a46a372..0000000
+++ /dev/null
@@ -1,413 +0,0 @@
-/*
- * Freescale i.MX28 Power Controller Register Definitions
- *
- * Copyright (C) 2011 Marek Vasut <marek.vasut@gmail.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
- *
- */
-
-#ifndef __MX28_REGS_POWER_H__
-#define __MX28_REGS_POWER_H__
-
-#include <asm/arch/regs-common.h>
-
-#ifndef        __ASSEMBLY__
-struct mxs_power_regs {
-       mxs_reg_32(hw_power_ctrl)
-       mxs_reg_32(hw_power_5vctrl)
-       mxs_reg_32(hw_power_minpwr)
-       mxs_reg_32(hw_power_charge)
-       uint32_t        hw_power_vdddctrl;
-       uint32_t        reserved_vddd[3];
-       uint32_t        hw_power_vddactrl;
-       uint32_t        reserved_vdda[3];
-       uint32_t        hw_power_vddioctrl;
-       uint32_t        reserved_vddio[3];
-       uint32_t        hw_power_vddmemctrl;
-       uint32_t        reserved_vddmem[3];
-       uint32_t        hw_power_dcdc4p2;
-       uint32_t        reserved_dcdc4p2[3];
-       uint32_t        hw_power_misc;
-       uint32_t        reserved_misc[3];
-       uint32_t        hw_power_dclimits;
-       uint32_t        reserved_dclimits[3];
-       mxs_reg_32(hw_power_loopctrl)
-       uint32_t        hw_power_sts;
-       uint32_t        reserved_sts[3];
-       mxs_reg_32(hw_power_speed)
-       uint32_t        hw_power_battmonitor;
-       uint32_t        reserved_battmonitor[3];
-
-       uint32_t        reserved[4];
-
-       mxs_reg_32(hw_power_reset)
-       mxs_reg_32(hw_power_debug)
-       mxs_reg_32(hw_power_thermal)
-       mxs_reg_32(hw_power_usb1ctrl)
-       mxs_reg_32(hw_power_special)
-       mxs_reg_32(hw_power_version)
-       mxs_reg_32(hw_power_anaclkctrl)
-       mxs_reg_32(hw_power_refctrl)
-};
-#endif
-
-#define        POWER_CTRL_PSWITCH_MID_TRAN                     (1 << 27)
-#define        POWER_CTRL_DCDC4P2_BO_IRQ                       (1 << 24)
-#define        POWER_CTRL_ENIRQ_DCDC4P2_BO                     (1 << 23)
-#define        POWER_CTRL_VDD5V_DROOP_IRQ                      (1 << 22)
-#define        POWER_CTRL_ENIRQ_VDD5V_DROOP                    (1 << 21)
-#define        POWER_CTRL_PSWITCH_IRQ                          (1 << 20)
-#define        POWER_CTRL_PSWITCH_IRQ_SRC                      (1 << 19)
-#define        POWER_CTRL_POLARITY_PSWITCH                     (1 << 18)
-#define        POWER_CTRL_ENIRQ_PSWITCH                        (1 << 17)
-#define        POWER_CTRL_POLARITY_DC_OK                       (1 << 16)
-#define        POWER_CTRL_DC_OK_IRQ                            (1 << 15)
-#define        POWER_CTRL_ENIRQ_DC_OK                          (1 << 14)
-#define        POWER_CTRL_BATT_BO_IRQ                          (1 << 13)
-#define        POWER_CTRL_ENIRQ_BATT_BO                        (1 << 12)
-#define        POWER_CTRL_VDDIO_BO_IRQ                         (1 << 11)
-#define        POWER_CTRL_ENIRQ_VDDIO_BO                       (1 << 10)
-#define        POWER_CTRL_VDDA_BO_IRQ                          (1 << 9)
-#define        POWER_CTRL_ENIRQ_VDDA_BO                        (1 << 8)
-#define        POWER_CTRL_VDDD_BO_IRQ                          (1 << 7)
-#define        POWER_CTRL_ENIRQ_VDDD_BO                        (1 << 6)
-#define        POWER_CTRL_POLARITY_VBUSVALID                   (1 << 5)
-#define        POWER_CTRL_VBUS_VALID_IRQ                       (1 << 4)
-#define        POWER_CTRL_ENIRQ_VBUS_VALID                     (1 << 3)
-#define        POWER_CTRL_POLARITY_VDD5V_GT_VDDIO              (1 << 2)
-#define        POWER_CTRL_VDD5V_GT_VDDIO_IRQ                   (1 << 1)
-#define        POWER_CTRL_ENIRQ_VDD5V_GT_VDDIO                 (1 << 0)
-
-#define        POWER_5VCTRL_VBUSDROOP_TRSH_MASK                (0x3 << 30)
-#define        POWER_5VCTRL_VBUSDROOP_TRSH_OFFSET              30
-#define        POWER_5VCTRL_VBUSDROOP_TRSH_4V3                 (0x0 << 30)
-#define        POWER_5VCTRL_VBUSDROOP_TRSH_4V4                 (0x1 << 30)
-#define        POWER_5VCTRL_VBUSDROOP_TRSH_4V5                 (0x2 << 30)
-#define        POWER_5VCTRL_VBUSDROOP_TRSH_4V7                 (0x3 << 30)
-#define        POWER_5VCTRL_HEADROOM_ADJ_MASK                  (0x7 << 24)
-#define        POWER_5VCTRL_HEADROOM_ADJ_OFFSET                24
-#define        POWER_5VCTRL_PWD_CHARGE_4P2_MASK                (0x3 << 20)
-#define        POWER_5VCTRL_PWD_CHARGE_4P2_OFFSET              20
-#define        POWER_5VCTRL_CHARGE_4P2_ILIMIT_MASK             (0x3f << 12)
-#define        POWER_5VCTRL_CHARGE_4P2_ILIMIT_OFFSET           12
-#define        POWER_5VCTRL_VBUSVALID_TRSH_MASK                (0x7 << 8)
-#define        POWER_5VCTRL_VBUSVALID_TRSH_OFFSET              8
-#define        POWER_5VCTRL_VBUSVALID_TRSH_2V9                 (0x0 << 8)
-#define        POWER_5VCTRL_VBUSVALID_TRSH_4V0                 (0x1 << 8)
-#define        POWER_5VCTRL_VBUSVALID_TRSH_4V1                 (0x2 << 8)
-#define        POWER_5VCTRL_VBUSVALID_TRSH_4V2                 (0x3 << 8)
-#define        POWER_5VCTRL_VBUSVALID_TRSH_4V3                 (0x4 << 8)
-#define        POWER_5VCTRL_VBUSVALID_TRSH_4V4                 (0x5 << 8)
-#define        POWER_5VCTRL_VBUSVALID_TRSH_4V5                 (0x6 << 8)
-#define        POWER_5VCTRL_VBUSVALID_TRSH_4V6                 (0x7 << 8)
-#define        POWER_5VCTRL_PWDN_5VBRNOUT                      (1 << 7)
-#define        POWER_5VCTRL_ENABLE_LINREG_ILIMIT               (1 << 6)
-#define        POWER_5VCTRL_DCDC_XFER                          (1 << 5)
-#define        POWER_5VCTRL_VBUSVALID_5VDETECT                 (1 << 4)
-#define        POWER_5VCTRL_VBUSVALID_TO_B                     (1 << 3)
-#define        POWER_5VCTRL_ILIMIT_EQ_ZERO                     (1 << 2)
-#define        POWER_5VCTRL_PWRUP_VBUS_CMPS                    (1 << 1)
-#define        POWER_5VCTRL_ENABLE_DCDC                        (1 << 0)
-
-#define        POWER_MINPWR_LOWPWR_4P2                         (1 << 14)
-#define        POWER_MINPWR_PWD_BO                             (1 << 12)
-#define        POWER_MINPWR_USE_VDDXTAL_VBG                    (1 << 11)
-#define        POWER_MINPWR_PWD_ANA_CMPS                       (1 << 10)
-#define        POWER_MINPWR_ENABLE_OSC                         (1 << 9)
-#define        POWER_MINPWR_SELECT_OSC                         (1 << 8)
-#define        POWER_MINPWR_FBG_OFF                            (1 << 7)
-#define        POWER_MINPWR_DOUBLE_FETS                        (1 << 6)
-#define        POWER_MINPWR_HALFFETS                           (1 << 5)
-#define        POWER_MINPWR_LESSANA_I                          (1 << 4)
-#define        POWER_MINPWR_PWD_XTAL24                         (1 << 3)
-#define        POWER_MINPWR_DC_STOPCLK                         (1 << 2)
-#define        POWER_MINPWR_EN_DC_PFM                          (1 << 1)
-#define        POWER_MINPWR_DC_HALFCLK                         (1 << 0)
-
-#define        POWER_CHARGE_ADJ_VOLT_MASK                      (0x7 << 24)
-#define        POWER_CHARGE_ADJ_VOLT_OFFSET                    24
-#define        POWER_CHARGE_ADJ_VOLT_M025P                     (0x1 << 24)
-#define        POWER_CHARGE_ADJ_VOLT_P050P                     (0x2 << 24)
-#define        POWER_CHARGE_ADJ_VOLT_M075P                     (0x3 << 24)
-#define        POWER_CHARGE_ADJ_VOLT_P025P                     (0x4 << 24)
-#define        POWER_CHARGE_ADJ_VOLT_M050P                     (0x5 << 24)
-#define        POWER_CHARGE_ADJ_VOLT_P075P                     (0x6 << 24)
-#define        POWER_CHARGE_ADJ_VOLT_M100P                     (0x7 << 24)
-#define        POWER_CHARGE_ENABLE_LOAD                        (1 << 22)
-#define        POWER_CHARGE_ENABLE_FAULT_DETECT                (1 << 20)
-#define        POWER_CHARGE_CHRG_STS_OFF                       (1 << 19)
-#define        POWER_CHARGE_LIION_4P1                          (1 << 18)
-#define        POWER_CHARGE_PWD_BATTCHRG                       (1 << 16)
-#define        POWER_CHARGE_ENABLE_CHARGER_USB1                (1 << 13)
-#define        POWER_CHARGE_ENABLE_CHARGER_USB0                (1 << 12)
-#define        POWER_CHARGE_STOP_ILIMIT_MASK                   (0xf << 8)
-#define        POWER_CHARGE_STOP_ILIMIT_OFFSET                 8
-#define        POWER_CHARGE_STOP_ILIMIT_10MA                   (0x1 << 8)
-#define        POWER_CHARGE_STOP_ILIMIT_20MA                   (0x2 << 8)
-#define        POWER_CHARGE_STOP_ILIMIT_50MA                   (0x4 << 8)
-#define        POWER_CHARGE_STOP_ILIMIT_100MA                  (0x8 << 8)
-#define        POWER_CHARGE_BATTCHRG_I_MASK                    0x3f
-#define        POWER_CHARGE_BATTCHRG_I_OFFSET                  0
-#define        POWER_CHARGE_BATTCHRG_I_10MA                    0x01
-#define        POWER_CHARGE_BATTCHRG_I_20MA                    0x02
-#define        POWER_CHARGE_BATTCHRG_I_50MA                    0x04
-#define        POWER_CHARGE_BATTCHRG_I_100MA                   0x08
-#define        POWER_CHARGE_BATTCHRG_I_200MA                   0x10
-#define        POWER_CHARGE_BATTCHRG_I_400MA                   0x20
-
-#define        POWER_VDDDCTRL_ADJTN_MASK                       (0xf << 28)
-#define        POWER_VDDDCTRL_ADJTN_OFFSET                     28
-#define        POWER_VDDDCTRL_PWDN_BRNOUT                      (1 << 23)
-#define        POWER_VDDDCTRL_DISABLE_STEPPING                 (1 << 22)
-#define        POWER_VDDDCTRL_ENABLE_LINREG                    (1 << 21)
-#define        POWER_VDDDCTRL_DISABLE_FET                      (1 << 20)
-#define        POWER_VDDDCTRL_LINREG_OFFSET_MASK               (0x3 << 16)
-#define        POWER_VDDDCTRL_LINREG_OFFSET_OFFSET             16
-#define        POWER_VDDDCTRL_LINREG_OFFSET_0STEPS             (0x0 << 16)
-#define        POWER_VDDDCTRL_LINREG_OFFSET_1STEPS_ABOVE       (0x1 << 16)
-#define        POWER_VDDDCTRL_LINREG_OFFSET_1STEPS_BELOW       (0x2 << 16)
-#define        POWER_VDDDCTRL_LINREG_OFFSET_2STEPS_BELOW       (0x3 << 16)
-#define        POWER_VDDDCTRL_BO_OFFSET_MASK                   (0x7 << 8)
-#define        POWER_VDDDCTRL_BO_OFFSET_OFFSET                 8
-#define        POWER_VDDDCTRL_TRG_MASK                         0x1f
-#define        POWER_VDDDCTRL_TRG_OFFSET                       0
-
-#define        POWER_VDDACTRL_PWDN_BRNOUT                      (1 << 19)
-#define        POWER_VDDACTRL_DISABLE_STEPPING                 (1 << 18)
-#define        POWER_VDDACTRL_ENABLE_LINREG                    (1 << 17)
-#define        POWER_VDDACTRL_DISABLE_FET                      (1 << 16)
-#define        POWER_VDDACTRL_LINREG_OFFSET_MASK               (0x3 << 12)
-#define        POWER_VDDACTRL_LINREG_OFFSET_OFFSET             12
-#define        POWER_VDDACTRL_LINREG_OFFSET_0STEPS             (0x0 << 12)
-#define        POWER_VDDACTRL_LINREG_OFFSET_1STEPS_ABOVE       (0x1 << 12)
-#define        POWER_VDDACTRL_LINREG_OFFSET_1STEPS_BELOW       (0x2 << 12)
-#define        POWER_VDDACTRL_LINREG_OFFSET_2STEPS_BELOW       (0x3 << 12)
-#define        POWER_VDDACTRL_BO_OFFSET_MASK                   (0x7 << 8)
-#define        POWER_VDDACTRL_BO_OFFSET_OFFSET                 8
-#define        POWER_VDDACTRL_TRG_MASK                         0x1f
-#define        POWER_VDDACTRL_TRG_OFFSET                       0
-
-#define        POWER_VDDIOCTRL_ADJTN_MASK                      (0xf << 20)
-#define        POWER_VDDIOCTRL_ADJTN_OFFSET                    20
-#define        POWER_VDDIOCTRL_PWDN_BRNOUT                     (1 << 18)
-#define        POWER_VDDIOCTRL_DISABLE_STEPPING                (1 << 17)
-#define        POWER_VDDIOCTRL_DISABLE_FET                     (1 << 16)
-#define        POWER_VDDIOCTRL_LINREG_OFFSET_MASK              (0x3 << 12)
-#define        POWER_VDDIOCTRL_LINREG_OFFSET_OFFSET            12
-#define        POWER_VDDIOCTRL_LINREG_OFFSET_0STEPS            (0x0 << 12)
-#define        POWER_VDDIOCTRL_LINREG_OFFSET_1STEPS_ABOVE      (0x1 << 12)
-#define        POWER_VDDIOCTRL_LINREG_OFFSET_1STEPS_BELOW      (0x2 << 12)
-#define        POWER_VDDIOCTRL_LINREG_OFFSET_2STEPS_BELOW      (0x3 << 12)
-#define        POWER_VDDIOCTRL_BO_OFFSET_MASK                  (0x7 << 8)
-#define        POWER_VDDIOCTRL_BO_OFFSET_OFFSET                8
-#define        POWER_VDDIOCTRL_TRG_MASK                        0x1f
-#define        POWER_VDDIOCTRL_TRG_OFFSET                      0
-
-#define        POWER_VDDMEMCTRL_PULLDOWN_ACTIVE                (1 << 10)
-#define        POWER_VDDMEMCTRL_ENABLE_ILIMIT                  (1 << 9)
-#define        POWER_VDDMEMCTRL_ENABLE_LINREG                  (1 << 8)
-#define        POWER_VDDMEMCTRL_BO_OFFSET_MASK                 (0x7 << 5)
-#define        POWER_VDDMEMCTRL_BO_OFFSET_OFFSET               5
-#define        POWER_VDDMEMCTRL_TRG_MASK                       0x1f
-#define        POWER_VDDMEMCTRL_TRG_OFFSET                     0
-
-#define        POWER_DCDC4P2_DROPOUT_CTRL_MASK                 (0xf << 28)
-#define        POWER_DCDC4P2_DROPOUT_CTRL_OFFSET               28
-#define        POWER_DCDC4P2_DROPOUT_CTRL_200MV                (0x3 << 30)
-#define        POWER_DCDC4P2_DROPOUT_CTRL_100MV                (0x2 << 30)
-#define        POWER_DCDC4P2_DROPOUT_CTRL_50MV                 (0x1 << 30)
-#define        POWER_DCDC4P2_DROPOUT_CTRL_25MV                 (0x0 << 30)
-#define        POWER_DCDC4P2_DROPOUT_CTRL_SRC_4P2              (0x0 << 28)
-#define        POWER_DCDC4P2_DROPOUT_CTRL_SRC_4P2_LT_BATT      (0x1 << 28)
-#define        POWER_DCDC4P2_DROPOUT_CTRL_SRC_SEL              (0x2 << 28)
-#define        POWER_DCDC4P2_ISTEAL_THRESH_MASK                (0x3 << 24)
-#define        POWER_DCDC4P2_ISTEAL_THRESH_OFFSET              24
-#define        POWER_DCDC4P2_ENABLE_4P2                        (1 << 23)
-#define        POWER_DCDC4P2_ENABLE_DCDC                       (1 << 22)
-#define        POWER_DCDC4P2_HYST_DIR                          (1 << 21)
-#define        POWER_DCDC4P2_HYST_THRESH                       (1 << 20)
-#define        POWER_DCDC4P2_TRG_MASK                          (0x7 << 16)
-#define        POWER_DCDC4P2_TRG_OFFSET                        16
-#define        POWER_DCDC4P2_TRG_4V2                           (0x0 << 16)
-#define        POWER_DCDC4P2_TRG_4V1                           (0x1 << 16)
-#define        POWER_DCDC4P2_TRG_4V0                           (0x2 << 16)
-#define        POWER_DCDC4P2_TRG_3V9                           (0x3 << 16)
-#define        POWER_DCDC4P2_TRG_BATT                          (0x4 << 16)
-#define        POWER_DCDC4P2_BO_MASK                           (0x1f << 8)
-#define        POWER_DCDC4P2_BO_OFFSET                         8
-#define        POWER_DCDC4P2_CMPTRIP_MASK                      0x1f
-#define        POWER_DCDC4P2_CMPTRIP_OFFSET                    0
-
-#define        POWER_MISC_FREQSEL_MASK                         (0x7 << 4)
-#define        POWER_MISC_FREQSEL_OFFSET                       4
-#define        POWER_MISC_FREQSEL_20MHZ                        (0x1 << 4)
-#define        POWER_MISC_FREQSEL_24MHZ                        (0x2 << 4)
-#define        POWER_MISC_FREQSEL_19MHZ                        (0x3 << 4)
-#define        POWER_MISC_FREQSEL_14MHZ                        (0x4 << 4)
-#define        POWER_MISC_FREQSEL_18MHZ                        (0x5 << 4)
-#define        POWER_MISC_FREQSEL_21MHZ                        (0x6 << 4)
-#define        POWER_MISC_FREQSEL_17MHZ                        (0x7 << 4)
-#define        POWER_MISC_DISABLE_FET_BO_LOGIC                 (1 << 3)
-#define        POWER_MISC_DELAY_TIMING                         (1 << 2)
-#define        POWER_MISC_TEST                                 (1 << 1)
-#define        POWER_MISC_SEL_PLLCLK                           (1 << 0)
-
-#define        POWER_DCLIMITS_POSLIMIT_BUCK_MASK               (0x7f << 8)
-#define        POWER_DCLIMITS_POSLIMIT_BUCK_OFFSET             8
-#define        POWER_DCLIMITS_NEGLIMIT_MASK                    0x7f
-#define        POWER_DCLIMITS_NETLIMIT_OFFSET                  0
-
-#define        POWER_LOOPCTRL_TOGGLE_DIF                       (1 << 20)
-#define        POWER_LOOPCTRL_HYST_SIGN                        (1 << 19)
-#define        POWER_LOOPCTRL_EN_CM_HYST                       (1 << 18)
-#define        POWER_LOOPCTRL_EN_DF_HYST                       (1 << 17)
-#define        POWER_LOOPCTRL_CM_HYST_THRESH                   (1 << 16)
-#define        POWER_LOOPCTRL_DF_HYST_THRESH                   (1 << 15)
-#define        POWER_LOOPCTRL_RCSCALE_THRESH                   (1 << 14)
-#define        POWER_LOOPCTRL_EN_RCSCALE_MASK                  (0x3 << 12)
-#define        POWER_LOOPCTRL_EN_RCSCALE_OFFSET                12
-#define        POWER_LOOPCTRL_EN_RCSCALE_DIS                   (0x0 << 12)
-#define        POWER_LOOPCTRL_EN_RCSCALE_2X                    (0x1 << 12)
-#define        POWER_LOOPCTRL_EN_RCSCALE_4X                    (0x2 << 12)
-#define        POWER_LOOPCTRL_EN_RCSCALE_8X                    (0x3 << 12)
-#define        POWER_LOOPCTRL_DC_FF_MASK                       (0x7 << 8)
-#define        POWER_LOOPCTRL_DC_FF_OFFSET                     8
-#define        POWER_LOOPCTRL_DC_R_MASK                        (0xf << 4)
-#define        POWER_LOOPCTRL_DC_R_OFFSET                      4
-#define        POWER_LOOPCTRL_DC_C_MASK                        0x3
-#define        POWER_LOOPCTRL_DC_C_OFFSET                      0
-#define        POWER_LOOPCTRL_DC_C_MAX                         0x0
-#define        POWER_LOOPCTRL_DC_C_2X                          0x1
-#define        POWER_LOOPCTRL_DC_C_4X                          0x2
-#define        POWER_LOOPCTRL_DC_C_MIN                         0x3
-
-#define        POWER_STS_PWRUP_SOURCE_MASK                     (0x3f << 24)
-#define        POWER_STS_PWRUP_SOURCE_OFFSET                   24
-#define        POWER_STS_PWRUP_SOURCE_5V                       (0x20 << 24)
-#define        POWER_STS_PWRUP_SOURCE_RTC                      (0x10 << 24)
-#define        POWER_STS_PWRUP_SOURCE_PSWITCH_HIGH             (0x02 << 24)
-#define        POWER_STS_PWRUP_SOURCE_PSWITCH_MID              (0x01 << 24)
-#define        POWER_STS_PSWITCH_MASK                          (0x3 << 20)
-#define        POWER_STS_PSWITCH_OFFSET                        20
-#define        POWER_STS_THERMAL_WARNING                       (1 << 19)
-#define        POWER_STS_VDDMEM_BO                             (1 << 18)
-#define        POWER_STS_AVALID0_STATUS                        (1 << 17)
-#define        POWER_STS_BVALID0_STATUS                        (1 << 16)
-#define        POWER_STS_VBUSVALID0_STATUS                     (1 << 15)
-#define        POWER_STS_SESSEND0_STATUS                       (1 << 14)
-#define        POWER_STS_BATT_BO                               (1 << 13)
-#define        POWER_STS_VDD5V_FAULT                           (1 << 12)
-#define        POWER_STS_CHRGSTS                               (1 << 11)
-#define        POWER_STS_DCDC_4P2_BO                           (1 << 10)
-#define        POWER_STS_DC_OK                                 (1 << 9)
-#define        POWER_STS_VDDIO_BO                              (1 << 8)
-#define        POWER_STS_VDDA_BO                               (1 << 7)
-#define        POWER_STS_VDDD_BO                               (1 << 6)
-#define        POWER_STS_VDD5V_GT_VDDIO                        (1 << 5)
-#define        POWER_STS_VDD5V_DROOP                           (1 << 4)
-#define        POWER_STS_AVALID0                               (1 << 3)
-#define        POWER_STS_BVALID0                               (1 << 2)
-#define        POWER_STS_VBUSVALID0                            (1 << 1)
-#define        POWER_STS_SESSEND0                              (1 << 0)
-
-#define        POWER_SPEED_STATUS_MASK                         (0xffff << 8)
-#define        POWER_SPEED_STATUS_OFFSET                       8
-#define        POWER_SPEED_STATUS_SEL_MASK                     (0x3 << 6)
-#define        POWER_SPEED_STATUS_SEL_OFFSET                   6
-#define        POWER_SPEED_STATUS_SEL_DCDC_STAT                (0x0 << 6)
-#define        POWER_SPEED_STATUS_SEL_CORE_STAT                (0x1 << 6)
-#define        POWER_SPEED_STATUS_SEL_ARM_STAT                 (0x2 << 6)
-#define        POWER_SPEED_CTRL_MASK                           0x3
-#define        POWER_SPEED_CTRL_OFFSET                         0
-#define        POWER_SPEED_CTRL_SS_OFF                         0x0
-#define        POWER_SPEED_CTRL_SS_ON                          0x1
-#define        POWER_SPEED_CTRL_SS_ENABLE                      0x3
-
-#define        POWER_BATTMONITOR_BATT_VAL_MASK                 (0x3ff << 16)
-#define        POWER_BATTMONITOR_BATT_VAL_OFFSET               16
-#define        POWER_BATTMONITOR_PWDN_BATTBRNOUT_5VDETECT_EN   (1 << 11)
-#define        POWER_BATTMONITOR_EN_BATADJ                     (1 << 10)
-#define        POWER_BATTMONITOR_PWDN_BATTBRNOUT               (1 << 9)
-#define        POWER_BATTMONITOR_BRWNOUT_PWD                   (1 << 8)
-#define        POWER_BATTMONITOR_BRWNOUT_LVL_MASK              0x1f
-#define        POWER_BATTMONITOR_BRWNOUT_LVL_OFFSET            0
-
-#define        POWER_RESET_UNLOCK_MASK                         (0xffff << 16)
-#define        POWER_RESET_UNLOCK_OFFSET                       16
-#define        POWER_RESET_UNLOCK_KEY                          (0x3e77 << 16)
-#define        POWER_RESET_FASTFALL_PSWITCH_OFF                (1 << 2)
-#define        POWER_RESET_PWD_OFF                             (1 << 1)
-#define        POWER_RESET_PWD                                 (1 << 0)
-
-#define        POWER_DEBUG_VBUSVALIDPIOLOCK                    (1 << 3)
-#define        POWER_DEBUG_AVALIDPIOLOCK                       (1 << 2)
-#define        POWER_DEBUG_BVALIDPIOLOCK                       (1 << 1)
-#define        POWER_DEBUG_SESSENDPIOLOCK                      (1 << 0)
-
-#define        POWER_THERMAL_TEST                              (1 << 8)
-#define        POWER_THERMAL_PWD                               (1 << 7)
-#define        POWER_THERMAL_LOW_POWER                         (1 << 6)
-#define        POWER_THERMAL_OFFSET_ADJ_MASK                   (0x3 << 4)
-#define        POWER_THERMAL_OFFSET_ADJ_OFFSET                 4
-#define        POWER_THERMAL_OFFSET_ADJ_ENABLE                 (1 << 3)
-#define        POWER_THERMAL_TEMP_THRESHOLD_MASK               0x7
-#define        POWER_THERMAL_TEMP_THRESHOLD_OFFSET             0
-
-#define        POWER_USB1CTRL_AVALID1                          (1 << 3)
-#define        POWER_USB1CTRL_BVALID1                          (1 << 2)
-#define        POWER_USB1CTRL_VBUSVALID1                       (1 << 1)
-#define        POWER_USB1CTRL_SESSEND1                         (1 << 0)
-
-#define        POWER_SPECIAL_TEST_MASK                         0xffffffff
-#define        POWER_SPECIAL_TEST_OFFSET                       0
-
-#define        POWER_VERSION_MAJOR_MASK                        (0xff << 24)
-#define        POWER_VERSION_MAJOR_OFFSET                      24
-#define        POWER_VERSION_MINOR_MASK                        (0xff << 16)
-#define        POWER_VERSION_MINOR_OFFSET                      16
-#define        POWER_VERSION_STEP_MASK                         0xffff
-#define        POWER_VERSION_STEP_OFFSET                       0
-
-#define        POWER_ANACLKCTRL_CLKGATE_0                      (1 << 31)
-#define        POWER_ANACLKCTRL_OUTDIV_MASK                    (0x7 << 28)
-#define        POWER_ANACLKCTRL_OUTDIV_OFFSET                  28
-#define        POWER_ANACLKCTRL_INVERT_OUTCLK                  (1 << 27)
-#define        POWER_ANACLKCTRL_CLKGATE_I                      (1 << 26)
-#define        POWER_ANACLKCTRL_DITHER_OFF                     (1 << 10)
-#define        POWER_ANACLKCTRL_SLOW_DITHER                    (1 << 9)
-#define        POWER_ANACLKCTRL_INVERT_INCLK                   (1 << 8)
-#define        POWER_ANACLKCTRL_INCLK_SHIFT_MASK               (0x3 << 4)
-#define        POWER_ANACLKCTRL_INCLK_SHIFT_OFFSET             4
-#define        POWER_ANACLKCTRL_INDIV_MASK                     0x7
-#define        POWER_ANACLKCTRL_INDIV_OFFSET                   0
-
-#define        POWER_REFCTRL_FASTSETTLING                      (1 << 26)
-#define        POWER_REFCTRL_RAISE_REF                         (1 << 25)
-#define        POWER_REFCTRL_XTAL_BGR_BIAS                     (1 << 24)
-#define        POWER_REFCTRL_VBG_ADJ_MASK                      (0x7 << 20)
-#define        POWER_REFCTRL_VBG_ADJ_OFFSET                    20
-#define        POWER_REFCTRL_LOW_PWR                           (1 << 19)
-#define        POWER_REFCTRL_BIAS_CTRL_MASK                    (0x3 << 16)
-#define        POWER_REFCTRL_BIAS_CTRL_OFFSET                  16
-#define        POWER_REFCTRL_VDDXTAL_TO_VDDD                   (1 << 14)
-#define        POWER_REFCTRL_ADJ_ANA                           (1 << 13)
-#define        POWER_REFCTRL_ADJ_VAG                           (1 << 12)
-#define        POWER_REFCTRL_ANA_REFVAL_MASK                   (0xf << 8)
-#define        POWER_REFCTRL_ANA_REFVAL_OFFSET                 8
-#define        POWER_REFCTRL_VAG_VAL_MASK                      (0xf << 4)
-#define        POWER_REFCTRL_VAG_VAL_OFFSET                    4
-
-#endif /* __MX28_REGS_POWER_H__ */
index 9e52b12aa291ac3145a0a779909642919f553f82..d60f2addb2aa166c52301e24fc4f1e469d0d653b 100644 (file)
@@ -32,6 +32,15 @@ struct emu_hal_params {
        u32 param1;
 };
 
+/* Board SDRC timing values */
+struct board_sdrc_timings {
+       u32 mcfg;
+       u32 ctrla;
+       u32 ctrlb;
+       u32 rfr_ctrl;
+       u32 mr;
+};
+
 void prcm_init(void);
 void per_clocks_enable(void);
 void ehci_clocks_enable(void);
@@ -39,8 +48,8 @@ void ehci_clocks_enable(void);
 void memif_init(void);
 void sdrc_init(void);
 void do_sdrc_init(u32, u32);
-void get_board_mem_timings(u32 *mcfg, u32 *ctrla, u32 *ctrlb, u32 *rfr_ctrl,
-               u32 *mr);
+
+void get_board_mem_timings(struct board_sdrc_timings *timings);
 void identify_nand_chip(int *mfr, int *id);
 void emif4_init(void);
 void gpmc_init(void);
index 76b901b3977bbc5110f45ad47546400e479775ed..00e498d834b3dea2164cbdfc0dcdec40999fa16f 100644 (file)
@@ -143,7 +143,12 @@ static inline unsigned int s5p_gpio_base(int nr)
        return S5PC110_GPIO_BASE;
 }
 
-#define s5pc110_gpio_get_nr(bank, pin) \
+static inline unsigned int s5p_gpio_part_max(int nr)
+{
+       return 0;
+}
+
+#define s5pc110_gpio_get_nr(bank, pin)   \
        ((((((unsigned int)&(((struct s5pc110_gpio *)S5PC110_GPIO_BASE)->bank))\
            - S5PC110_GPIO_BASE) / sizeof(struct s5p_gpio_bank)) \
          * GPIO_PER_BANK) + pin)
diff --git a/arch/arm/include/asm/arch-tegra20/dc.h b/arch/arm/include/asm/arch-tegra20/dc.h
new file mode 100644 (file)
index 0000000..37934e1
--- /dev/null
@@ -0,0 +1,545 @@
+/*
+ *  (C) Copyright 2010
+ *  NVIDIA Corporation <www.nvidia.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_ARCH_TEGRA_DC_H
+#define __ASM_ARCH_TEGRA_DC_H
+
+/* Register definitions for the Tegra display controller */
+
+/* CMD register 0x000 ~ 0x43 */
+struct dc_cmd_reg {
+       /* Address 0x000 ~ 0x002 */
+       uint gen_incr_syncpt;           /* _CMD_GENERAL_INCR_SYNCPT_0 */
+       uint gen_incr_syncpt_ctrl;      /* _CMD_GENERAL_INCR_SYNCPT_CNTRL_0 */
+       uint gen_incr_syncpt_err;       /* _CMD_GENERAL_INCR_SYNCPT_ERROR_0 */
+
+       uint reserved0[5];              /* reserved_0[5] */
+
+       /* Address 0x008 ~ 0x00a */
+       uint win_a_incr_syncpt;         /* _CMD_WIN_A_INCR_SYNCPT_0 */
+       uint win_a_incr_syncpt_ctrl;    /* _CMD_WIN_A_INCR_SYNCPT_CNTRL_0 */
+       uint win_a_incr_syncpt_err;     /* _CMD_WIN_A_INCR_SYNCPT_ERROR_0 */
+
+       uint reserved1[5];              /* reserved_1[5] */
+
+       /* Address 0x010 ~ 0x012 */
+       uint win_b_incr_syncpt;         /* _CMD_WIN_B_INCR_SYNCPT_0 */
+       uint win_b_incr_syncpt_ctrl;    /* _CMD_WIN_B_INCR_SYNCPT_CNTRL_0 */
+       uint win_b_incr_syncpt_err;     /* _CMD_WIN_B_INCR_SYNCPT_ERROR_0 */
+
+       uint reserved2[5];              /* reserved_2[5] */
+
+       /* Address 0x018 ~ 0x01a */
+       uint win_c_incr_syncpt;         /* _CMD_WIN_C_INCR_SYNCPT_0 */
+       uint win_c_incr_syncpt_ctrl;    /* _CMD_WIN_C_INCR_SYNCPT_CNTRL_0 */
+       uint win_c_incr_syncpt_err;     /* _CMD_WIN_C_INCR_SYNCPT_ERROR_0 */
+
+       uint reserved3[13];             /* reserved_3[13] */
+
+       /* Address 0x028 */
+       uint cont_syncpt_vsync;         /* _CMD_CONT_SYNCPT_VSYNC_0 */
+
+       uint reserved4[7];              /* reserved_4[7] */
+
+       /* Address 0x030 ~ 0x033 */
+       uint ctxsw;                     /* _CMD_CTXSW_0 */
+       uint disp_cmd_opt0;             /* _CMD_DISPLAY_COMMAND_OPTION0_0 */
+       uint disp_cmd;                  /* _CMD_DISPLAY_COMMAND_0 */
+       uint sig_raise;                 /* _CMD_SIGNAL_RAISE_0 */
+
+       uint reserved5[2];              /* reserved_0[2] */
+
+       /* Address 0x036 ~ 0x03e */
+       uint disp_pow_ctrl;             /* _CMD_DISPLAY_POWER_CONTROL_0 */
+       uint int_stat;                  /* _CMD_INT_STATUS_0 */
+       uint int_mask;                  /* _CMD_INT_MASK_0 */
+       uint int_enb;                   /* _CMD_INT_ENABLE_0 */
+       uint int_type;                  /* _CMD_INT_TYPE_0 */
+       uint int_polarity;              /* _CMD_INT_POLARITY_0 */
+       uint sig_raise1;                /* _CMD_SIGNAL_RAISE1_0 */
+       uint sig_raise2;                /* _CMD_SIGNAL_RAISE2_0 */
+       uint sig_raise3;                /* _CMD_SIGNAL_RAISE3_0 */
+
+       uint reserved6;                 /* reserved_6 */
+
+       /* Address 0x040 ~ 0x043 */
+       uint state_access;              /* _CMD_STATE_ACCESS_0 */
+       uint state_ctrl;                /* _CMD_STATE_CONTROL_0 */
+       uint disp_win_header;           /* _CMD_DISPLAY_WINDOW_HEADER_0 */
+       uint reg_act_ctrl;              /* _CMD_REG_ACT_CONTROL_0 */
+};
+
+enum {
+       PIN_REG_COUNT           = 4,
+       PIN_OUTPUT_SEL_COUNT    = 7,
+};
+
+/* COM register 0x300 ~ 0x329 */
+struct dc_com_reg {
+       /* Address 0x300 ~ 0x301 */
+       uint crc_ctrl;                  /* _COM_CRC_CONTROL_0 */
+       uint crc_checksum;              /* _COM_CRC_CHECKSUM_0 */
+
+       /* _COM_PIN_OUTPUT_ENABLE0/1/2/3_0: Address 0x302 ~ 0x305 */
+       uint pin_output_enb[PIN_REG_COUNT];
+
+       /* _COM_PIN_OUTPUT_POLARITY0/1/2/3_0: Address 0x306 ~ 0x309 */
+       uint pin_output_polarity[PIN_REG_COUNT];
+
+       /* _COM_PIN_OUTPUT_DATA0/1/2/3_0: Address 0x30a ~ 0x30d */
+       uint pin_output_data[PIN_REG_COUNT];
+
+       /* _COM_PIN_INPUT_ENABLE0_0: Address 0x30e ~ 0x311 */
+       uint pin_input_enb[PIN_REG_COUNT];
+
+       /* Address 0x312 ~ 0x313 */
+       uint pin_input_data0;           /* _COM_PIN_INPUT_DATA0_0 */
+       uint pin_input_data1;           /* _COM_PIN_INPUT_DATA1_0 */
+
+       /* _COM_PIN_OUTPUT_SELECT0/1/2/3/4/5/6_0: Address 0x314 ~ 0x31a */
+       uint pin_output_sel[PIN_OUTPUT_SEL_COUNT];
+
+       /* Address 0x31b ~ 0x329 */
+       uint pin_misc_ctrl;             /* _COM_PIN_MISC_CONTROL_0 */
+       uint pm0_ctrl;                  /* _COM_PM0_CONTROL_0 */
+       uint pm0_duty_cycle;            /* _COM_PM0_DUTY_CYCLE_0 */
+       uint pm1_ctrl;                  /* _COM_PM1_CONTROL_0 */
+       uint pm1_duty_cycle;            /* _COM_PM1_DUTY_CYCLE_0 */
+       uint spi_ctrl;                  /* _COM_SPI_CONTROL_0 */
+       uint spi_start_byte;            /* _COM_SPI_START_BYTE_0 */
+       uint hspi_wr_data_ab;           /* _COM_HSPI_WRITE_DATA_AB_0 */
+       uint hspi_wr_data_cd;           /* _COM_HSPI_WRITE_DATA_CD */
+       uint hspi_cs_dc;                /* _COM_HSPI_CS_DC_0 */
+       uint scratch_reg_a;             /* _COM_SCRATCH_REGISTER_A_0 */
+       uint scratch_reg_b;             /* _COM_SCRATCH_REGISTER_B_0 */
+       uint gpio_ctrl;                 /* _COM_GPIO_CTRL_0 */
+       uint gpio_debounce_cnt;         /* _COM_GPIO_DEBOUNCE_COUNTER_0 */
+       uint crc_checksum_latched;      /* _COM_CRC_CHECKSUM_LATCHED_0 */
+};
+
+enum dc_disp_h_pulse_pos {
+       H_PULSE0_POSITION_A,
+       H_PULSE0_POSITION_B,
+       H_PULSE0_POSITION_C,
+       H_PULSE0_POSITION_D,
+       H_PULSE0_POSITION_COUNT,
+};
+
+struct _disp_h_pulse {
+       /* _DISP_H_PULSE0/1/2_CONTROL_0 */
+       uint h_pulse_ctrl;
+       /* _DISP_H_PULSE0/1/2_POSITION_A/B/C/D_0 */
+       uint h_pulse_pos[H_PULSE0_POSITION_COUNT];
+};
+
+enum dc_disp_v_pulse_pos {
+       V_PULSE0_POSITION_A,
+       V_PULSE0_POSITION_B,
+       V_PULSE0_POSITION_C,
+       V_PULSE0_POSITION_COUNT,
+};
+
+struct _disp_v_pulse0 {
+       /* _DISP_H_PULSE0/1_CONTROL_0 */
+       uint v_pulse_ctrl;
+       /* _DISP_H_PULSE0/1_POSITION_A/B/C_0 */
+       uint v_pulse_pos[V_PULSE0_POSITION_COUNT];
+};
+
+struct _disp_v_pulse2 {
+       /* _DISP_H_PULSE2/3_CONTROL_0 */
+       uint v_pulse_ctrl;
+       /* _DISP_H_PULSE2/3_POSITION_A_0 */
+       uint v_pulse_pos_a;
+};
+
+enum dc_disp_h_pulse_reg {
+       H_PULSE0,
+       H_PULSE1,
+       H_PULSE2,
+       H_PULSE_COUNT,
+};
+
+enum dc_disp_pp_select {
+       PP_SELECT_A,
+       PP_SELECT_B,
+       PP_SELECT_C,
+       PP_SELECT_D,
+       PP_SELECT_COUNT,
+};
+
+/* DISP register 0x400 ~ 0x4c1 */
+struct dc_disp_reg {
+       /* Address 0x400 ~ 0x40a */
+       uint disp_signal_opt0;          /* _DISP_DISP_SIGNAL_OPTIONS0_0 */
+       uint disp_signal_opt1;          /* _DISP_DISP_SIGNAL_OPTIONS1_0 */
+       uint disp_win_opt;              /* _DISP_DISP_WIN_OPTIONS_0 */
+       uint mem_high_pri;              /* _DISP_MEM_HIGH_PRIORITY_0 */
+       uint mem_high_pri_timer;        /* _DISP_MEM_HIGH_PRIORITY_TIMER_0 */
+       uint disp_timing_opt;           /* _DISP_DISP_TIMING_OPTIONS_0 */
+       uint ref_to_sync;               /* _DISP_REF_TO_SYNC_0 */
+       uint sync_width;                /* _DISP_SYNC_WIDTH_0 */
+       uint back_porch;                /* _DISP_BACK_PORCH_0 */
+       uint disp_active;               /* _DISP_DISP_ACTIVE_0 */
+       uint front_porch;               /* _DISP_FRONT_PORCH_0 */
+
+       /* Address 0x40b ~ 0x419: _DISP_H_PULSE0/1/2_  */
+       struct _disp_h_pulse h_pulse[H_PULSE_COUNT];
+
+       /* Address 0x41a ~ 0x421 */
+       struct _disp_v_pulse0 v_pulse0; /* _DISP_V_PULSE0_ */
+       struct _disp_v_pulse0 v_pulse1; /* _DISP_V_PULSE1_ */
+
+       /* Address 0x422 ~ 0x425 */
+       struct _disp_v_pulse2 v_pulse3; /* _DISP_V_PULSE2_ */
+       struct _disp_v_pulse2 v_pulse4; /* _DISP_V_PULSE3_ */
+
+       /* Address 0x426 ~ 0x429 */
+       uint m0_ctrl;                   /* _DISP_M0_CONTROL_0 */
+       uint m1_ctrl;                   /* _DISP_M1_CONTROL_0 */
+       uint di_ctrl;                   /* _DISP_DI_CONTROL_0 */
+       uint pp_ctrl;                   /* _DISP_PP_CONTROL_0 */
+
+       /* Address 0x42a ~ 0x42d: _DISP_PP_SELECT_A/B/C/D_0 */
+       uint pp_select[PP_SELECT_COUNT];
+
+       /* Address 0x42e ~ 0x435 */
+       uint disp_clk_ctrl;             /* _DISP_DISP_CLOCK_CONTROL_0 */
+       uint disp_interface_ctrl;       /* _DISP_DISP_INTERFACE_CONTROL_0 */
+       uint disp_color_ctrl;           /* _DISP_DISP_COLOR_CONTROL_0 */
+       uint shift_clk_opt;             /* _DISP_SHIFT_CLOCK_OPTIONS_0 */
+       uint data_enable_opt;           /* _DISP_DATA_ENABLE_OPTIONS_0 */
+       uint serial_interface_opt;      /* _DISP_SERIAL_INTERFACE_OPTIONS_0 */
+       uint lcd_spi_opt;               /* _DISP_LCD_SPI_OPTIONS_0 */
+       uint border_color;              /* _DISP_BORDER_COLOR_0 */
+
+       /* Address 0x436 ~ 0x439 */
+       uint color_key0_lower;          /* _DISP_COLOR_KEY0_LOWER_0 */
+       uint color_key0_upper;          /* _DISP_COLOR_KEY0_UPPER_0 */
+       uint color_key1_lower;          /* _DISP_COLOR_KEY1_LOWER_0 */
+       uint color_key1_upper;          /* _DISP_COLOR_KEY1_UPPER_0 */
+
+       uint reserved0[2];              /* reserved_0[2] */
+
+       /* Address 0x43c ~ 0x442 */
+       uint cursor_foreground;         /* _DISP_CURSOR_FOREGROUND_0 */
+       uint cursor_background;         /* _DISP_CURSOR_BACKGROUND_0 */
+       uint cursor_start_addr;         /* _DISP_CURSOR_START_ADDR_0 */
+       uint cursor_start_addr_ns;      /* _DISP_CURSOR_START_ADDR_NS_0 */
+       uint cursor_pos;                /* _DISP_CURSOR_POSITION_0 */
+       uint cursor_pos_ns;             /* _DISP_CURSOR_POSITION_NS_0 */
+       uint seq_ctrl;                  /* _DISP_INIT_SEQ_CONTROL_0 */
+
+       /* Address 0x442 ~ 0x446 */
+       uint spi_init_seq_data_a;       /* _DISP_SPI_INIT_SEQ_DATA_A_0 */
+       uint spi_init_seq_data_b;       /* _DISP_SPI_INIT_SEQ_DATA_B_0 */
+       uint spi_init_seq_data_c;       /* _DISP_SPI_INIT_SEQ_DATA_C_0 */
+       uint spi_init_seq_data_d;       /* _DISP_SPI_INIT_SEQ_DATA_D_0 */
+
+       uint reserved1[0x39];           /* reserved1[0x39], */
+
+       /* Address 0x480 ~ 0x484 */
+       uint dc_mccif_fifoctrl;         /* _DISP_DC_MCCIF_FIFOCTRL_0 */
+       uint mccif_disp0a_hyst;         /* _DISP_MCCIF_DISPLAY0A_HYST_0 */
+       uint mccif_disp0b_hyst;         /* _DISP_MCCIF_DISPLAY0B_HYST_0 */
+       uint mccif_disp0c_hyst;         /* _DISP_MCCIF_DISPLAY0C_HYST_0 */
+       uint mccif_disp1b_hyst;         /* _DISP_MCCIF_DISPLAY1B_HYST_0 */
+
+       uint reserved2[0x3b];           /* reserved2[0x3b] */
+
+       /* Address 0x4c0 ~ 0x4c1 */
+       uint dac_crt_ctrl;              /* _DISP_DAC_CRT_CTRL_0 */
+       uint disp_misc_ctrl;            /* _DISP_DISP_MISC_CONTROL_0 */
+};
+
+enum dc_winc_filter_p {
+       WINC_FILTER_COUNT       = 0x10,
+};
+
+/* Window A/B/C register 0x500 ~ 0x628 */
+struct dc_winc_reg {
+
+       /* Address 0x500 */
+       uint color_palette;             /* _WINC_COLOR_PALETTE_0 */
+
+       uint reserved0[0xff];           /* reserved_0[0xff] */
+
+       /* Address 0x600 */
+       uint palette_color_ext;         /* _WINC_PALETTE_COLOR_EXT_0 */
+
+       /* _WINC_H_FILTER_P00~0F_0 */
+       /* Address 0x601 ~ 0x610 */
+       uint h_filter_p[WINC_FILTER_COUNT];
+
+       /* Address 0x611 ~ 0x618 */
+       uint csc_yof;                   /* _WINC_CSC_YOF_0 */
+       uint csc_kyrgb;                 /* _WINC_CSC_KYRGB_0 */
+       uint csc_kur;                   /* _WINC_CSC_KUR_0 */
+       uint csc_kvr;                   /* _WINC_CSC_KVR_0 */
+       uint csc_kug;                   /* _WINC_CSC_KUG_0 */
+       uint csc_kvg;                   /* _WINC_CSC_KVG_0 */
+       uint csc_kub;                   /* _WINC_CSC_KUB_0 */
+       uint csc_kvb;                   /* _WINC_CSC_KVB_0 */
+
+       /* Address 0x619 ~ 0x628: _WINC_V_FILTER_P00~0F_0 */
+       uint v_filter_p[WINC_FILTER_COUNT];
+};
+
+/* WIN A/B/C Register 0x700 ~ 0x714*/
+struct dc_win_reg {
+       /* Address 0x700 ~ 0x714 */
+       uint win_opt;                   /* _WIN_WIN_OPTIONS_0 */
+       uint byte_swap;                 /* _WIN_BYTE_SWAP_0 */
+       uint buffer_ctrl;               /* _WIN_BUFFER_CONTROL_0 */
+       uint color_depth;               /* _WIN_COLOR_DEPTH_0 */
+       uint pos;                       /* _WIN_POSITION_0 */
+       uint size;                      /* _WIN_SIZE_0 */
+       uint prescaled_size;            /* _WIN_PRESCALED_SIZE_0 */
+       uint h_initial_dda;             /* _WIN_H_INITIAL_DDA_0 */
+       uint v_initial_dda;             /* _WIN_V_INITIAL_DDA_0 */
+       uint dda_increment;             /* _WIN_DDA_INCREMENT_0 */
+       uint line_stride;               /* _WIN_LINE_STRIDE_0 */
+       uint buf_stride;                /* _WIN_BUF_STRIDE_0 */
+       uint uv_buf_stride;             /* _WIN_UV_BUF_STRIDE_0 */
+       uint buffer_addr_mode;          /* _WIN_BUFFER_ADDR_MODE_0 */
+       uint dv_ctrl;                   /* _WIN_DV_CONTROL_0 */
+       uint blend_nokey;               /* _WIN_BLEND_NOKEY_0 */
+       uint blend_1win;                /* _WIN_BLEND_1WIN_0 */
+       uint blend_2win_x;              /* _WIN_BLEND_2WIN_X_0 */
+       uint blend_2win_y;              /* _WIN_BLEND_2WIN_Y_0 */
+       uint blend_3win_xy;             /* _WIN_BLEND_3WIN_XY_0 */
+       uint hp_fetch_ctrl;             /* _WIN_HP_FETCH_CONTROL_0 */
+};
+
+/* WINBUF A/B/C Register 0x800 ~ 0x80a */
+struct dc_winbuf_reg {
+       /* Address 0x800 ~ 0x80a */
+       uint start_addr;                /* _WINBUF_START_ADDR_0 */
+       uint start_addr_ns;             /* _WINBUF_START_ADDR_NS_0 */
+       uint start_addr_u;              /* _WINBUF_START_ADDR_U_0 */
+       uint start_addr_u_ns;           /* _WINBUF_START_ADDR_U_NS_0 */
+       uint start_addr_v;              /* _WINBUF_START_ADDR_V_0 */
+       uint start_addr_v_ns;           /* _WINBUF_START_ADDR_V_NS_0 */
+       uint addr_h_offset;             /* _WINBUF_ADDR_H_OFFSET_0 */
+       uint addr_h_offset_ns;          /* _WINBUF_ADDR_H_OFFSET_NS_0 */
+       uint addr_v_offset;             /* _WINBUF_ADDR_V_OFFSET_0 */
+       uint addr_v_offset_ns;          /* _WINBUF_ADDR_V_OFFSET_NS_0 */
+       uint uflow_status;              /* _WINBUF_UFLOW_STATUS_0 */
+};
+
+/* Display Controller (DC_) regs */
+struct dc_ctlr {
+       struct dc_cmd_reg cmd;          /* CMD register 0x000 ~ 0x43 */
+       uint reserved0[0x2bc];
+
+       struct dc_com_reg com;          /* COM register 0x300 ~ 0x329 */
+       uint reserved1[0xd6];
+
+       struct dc_disp_reg disp;        /* DISP register 0x400 ~ 0x4c1 */
+       uint reserved2[0x3e];
+
+       struct dc_winc_reg winc;        /* Window A/B/C 0x500 ~ 0x628 */
+       uint reserved3[0xd7];
+
+       struct dc_win_reg win;          /* WIN A/B/C 0x700 ~ 0x714*/
+       uint reserved4[0xeb];
+
+       struct dc_winbuf_reg winbuf;    /* WINBUF A/B/C 0x800 ~ 0x80a */
+};
+
+#define BIT(pos)       (1U << pos)
+
+/* DC_CMD_DISPLAY_COMMAND 0x032 */
+#define CTRL_MODE_SHIFT                5
+#define CTRL_MODE_MASK         (0x3 << CTRL_MODE_SHIFT)
+enum {
+       CTRL_MODE_STOP,
+       CTRL_MODE_C_DISPLAY,
+       CTRL_MODE_NC_DISPLAY,
+};
+
+/* _WIN_COLOR_DEPTH_0 */
+enum win_color_depth_id {
+       COLOR_DEPTH_P1,
+       COLOR_DEPTH_P2,
+       COLOR_DEPTH_P4,
+       COLOR_DEPTH_P8,
+       COLOR_DEPTH_B4G4R4A4,
+       COLOR_DEPTH_B5G5R5A,
+       COLOR_DEPTH_B5G6R5,
+       COLOR_DEPTH_AB5G5R5,
+       COLOR_DEPTH_B8G8R8A8 = 12,
+       COLOR_DEPTH_R8G8B8A8,
+       COLOR_DEPTH_B6x2G6x2R6x2A8,
+       COLOR_DEPTH_R6x2G6x2B6x2A8,
+       COLOR_DEPTH_YCbCr422,
+       COLOR_DEPTH_YUV422,
+       COLOR_DEPTH_YCbCr420P,
+       COLOR_DEPTH_YUV420P,
+       COLOR_DEPTH_YCbCr422P,
+       COLOR_DEPTH_YUV422P,
+       COLOR_DEPTH_YCbCr422R,
+       COLOR_DEPTH_YUV422R,
+       COLOR_DEPTH_YCbCr422RA,
+       COLOR_DEPTH_YUV422RA,
+};
+
+/* DC_CMD_DISPLAY_POWER_CONTROL 0x036 */
+#define PW0_ENABLE             BIT(0)
+#define PW1_ENABLE             BIT(2)
+#define PW2_ENABLE             BIT(4)
+#define PW3_ENABLE             BIT(6)
+#define PW4_ENABLE             BIT(8)
+#define PM0_ENABLE             BIT(16)
+#define PM1_ENABLE             BIT(18)
+#define SPI_ENABLE             BIT(24)
+#define HSPI_ENABLE            BIT(25)
+
+/* DC_CMD_STATE_CONTROL 0x041 */
+#define GENERAL_ACT_REQ                BIT(0)
+#define WIN_A_ACT_REQ          BIT(1)
+#define WIN_B_ACT_REQ          BIT(2)
+#define WIN_C_ACT_REQ          BIT(3)
+#define GENERAL_UPDATE         BIT(8)
+#define WIN_A_UPDATE           BIT(9)
+#define WIN_B_UPDATE           BIT(10)
+#define WIN_C_UPDATE           BIT(11)
+
+/* DC_CMD_DISPLAY_WINDOW_HEADER 0x042 */
+#define WINDOW_A_SELECT                BIT(4)
+#define WINDOW_B_SELECT                BIT(5)
+#define WINDOW_C_SELECT                BIT(6)
+
+/* DC_DISP_DISP_CLOCK_CONTROL 0x42e */
+#define SHIFT_CLK_DIVIDER_SHIFT        0
+#define SHIFT_CLK_DIVIDER_MASK (0xff << SHIFT_CLK_DIVIDER_SHIFT)
+#define        PIXEL_CLK_DIVIDER_SHIFT 8
+#define        PIXEL_CLK_DIVIDER_MSK   (0xf << PIXEL_CLK_DIVIDER_SHIFT)
+enum {
+       PIXEL_CLK_DIVIDER_PCD1,
+       PIXEL_CLK_DIVIDER_PCD1H,
+       PIXEL_CLK_DIVIDER_PCD2,
+       PIXEL_CLK_DIVIDER_PCD3,
+       PIXEL_CLK_DIVIDER_PCD4,
+       PIXEL_CLK_DIVIDER_PCD6,
+       PIXEL_CLK_DIVIDER_PCD8,
+       PIXEL_CLK_DIVIDER_PCD9,
+       PIXEL_CLK_DIVIDER_PCD12,
+       PIXEL_CLK_DIVIDER_PCD16,
+       PIXEL_CLK_DIVIDER_PCD18,
+       PIXEL_CLK_DIVIDER_PCD24,
+       PIXEL_CLK_DIVIDER_PCD13,
+};
+
+/* DC_DISP_DISP_INTERFACE_CONTROL 0x42f */
+#define DATA_FORMAT_SHIFT      0
+#define DATA_FORMAT_MASK       (0xf << DATA_FORMAT_SHIFT)
+enum {
+       DATA_FORMAT_DF1P1C,
+       DATA_FORMAT_DF1P2C24B,
+       DATA_FORMAT_DF1P2C18B,
+       DATA_FORMAT_DF1P2C16B,
+       DATA_FORMAT_DF2S,
+       DATA_FORMAT_DF3S,
+       DATA_FORMAT_DFSPI,
+       DATA_FORMAT_DF1P3C24B,
+       DATA_FORMAT_DF1P3C18B,
+};
+#define DATA_ALIGNMENT_SHIFT   8
+enum {
+       DATA_ALIGNMENT_MSB,
+       DATA_ALIGNMENT_LSB,
+};
+#define DATA_ORDER_SHIFT       9
+enum {
+       DATA_ORDER_RED_BLUE,
+       DATA_ORDER_BLUE_RED,
+};
+
+/* DC_DISP_DATA_ENABLE_OPTIONS 0x432 */
+#define DE_SELECT_SHIFT                0
+#define DE_SELECT_MASK         (0x3 << DE_SELECT_SHIFT)
+#define DE_SELECT_ACTIVE_BLANK 0x0
+#define DE_SELECT_ACTIVE       0x1
+#define DE_SELECT_ACTIVE_IS    0x2
+#define DE_CONTROL_SHIFT       2
+#define DE_CONTROL_MASK                (0x7 << DE_CONTROL_SHIFT)
+enum {
+       DE_CONTROL_ONECLK,
+       DE_CONTROL_NORMAL,
+       DE_CONTROL_EARLY_EXT,
+       DE_CONTROL_EARLY,
+       DE_CONTROL_ACTIVE_BLANK,
+};
+
+/* DC_WIN_WIN_OPTIONS 0x700 */
+#define H_DIRECTION            BIT(0)
+enum {
+       H_DIRECTION_INCREMENT,
+       H_DIRECTION_DECREMENT,
+};
+#define V_DIRECTION            BIT(2)
+enum {
+       V_DIRECTION_INCREMENT,
+       V_DIRECTION_DECREMENT,
+};
+#define COLOR_EXPAND           BIT(6)
+#define CP_ENABLE              BIT(16)
+#define DV_ENABLE              BIT(20)
+#define WIN_ENABLE             BIT(30)
+
+/* DC_WIN_BYTE_SWAP 0x701 */
+#define BYTE_SWAP_SHIFT                0
+#define BYTE_SWAP_MASK         (3 << BYTE_SWAP_SHIFT)
+enum {
+       BYTE_SWAP_NOSWAP,
+       BYTE_SWAP_SWAP2,
+       BYTE_SWAP_SWAP4,
+       BYTE_SWAP_SWAP4HW
+};
+
+/* DC_WIN_POSITION 0x704 */
+#define H_POSITION_SHIFT       0
+#define H_POSITION_MASK                (0x1FFF << H_POSITION_SHIFT)
+#define V_POSITION_SHIFT       16
+#define V_POSITION_MASK                (0x1FFF << V_POSITION_SHIFT)
+
+/* DC_WIN_SIZE 0x705 */
+#define H_SIZE_SHIFT           0
+#define H_SIZE_MASK            (0x1FFF << H_SIZE_SHIFT)
+#define V_SIZE_SHIFT           16
+#define V_SIZE_MASK            (0x1FFF << V_SIZE_SHIFT)
+
+/* DC_WIN_PRESCALED_SIZE 0x706 */
+#define H_PRESCALED_SIZE_SHIFT 0
+#define H_PRESCALED_SIZE_MASK  (0x7FFF << H_PRESCALED_SIZE)
+#define V_PRESCALED_SIZE_SHIFT 16
+#define V_PRESCALED_SIZE_MASK  (0x1FFF << V_PRESCALED_SIZE)
+
+/* DC_WIN_DDA_INCREMENT 0x709 */
+#define H_DDA_INC_SHIFT                0
+#define H_DDA_INC_MASK         (0xFFFF << H_DDA_INC_SHIFT)
+#define V_DDA_INC_SHIFT                16
+#define V_DDA_INC_MASK         (0xFFFF << V_DDA_INC_SHIFT)
+
+#endif /* __ASM_ARCH_TEGRA_DC_H */
diff --git a/arch/arm/include/asm/arch-tegra20/display.h b/arch/arm/include/asm/arch-tegra20/display.h
new file mode 100644 (file)
index 0000000..c870959
--- /dev/null
@@ -0,0 +1,152 @@
+/*
+ *  (C) Copyright 2010
+ *  NVIDIA Corporation <www.nvidia.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_ARCH_TEGRA_DISPLAY_H
+#define __ASM_ARCH_TEGRA_DISPLAY_H
+
+#include <asm/arch/dc.h>
+#include <fdtdec.h>
+
+/* This holds information about a window which can be displayed */
+struct disp_ctl_win {
+       enum win_color_depth_id fmt;    /* Color depth/format */
+       unsigned        bpp;            /* Bits per pixel */
+       phys_addr_t     phys_addr;      /* Physical address in memory */
+       unsigned        x;              /* Horizontal address offset (bytes) */
+       unsigned        y;              /* Veritical address offset (bytes) */
+       unsigned        w;              /* Width of source window */
+       unsigned        h;              /* Height of source window */
+       unsigned        stride;         /* Number of bytes per line */
+       unsigned        out_x;          /* Left edge of output window (col) */
+       unsigned        out_y;          /* Top edge of output window (row) */
+       unsigned        out_w;          /* Width of output window in pixels */
+       unsigned        out_h;          /* Height of output window in pixels */
+};
+
+#define FDT_LCD_TIMINGS        4
+
+enum {
+       FDT_LCD_TIMING_REF_TO_SYNC,
+       FDT_LCD_TIMING_SYNC_WIDTH,
+       FDT_LCD_TIMING_BACK_PORCH,
+       FDT_LCD_TIMING_FRONT_PORCH,
+
+       FDT_LCD_TIMING_COUNT,
+};
+
+enum lcd_cache_t {
+       FDT_LCD_CACHE_OFF               = 0,
+       FDT_LCD_CACHE_WRITE_THROUGH     = 1 << 0,
+       FDT_LCD_CACHE_WRITE_BACK        = 1 << 1,
+       FDT_LCD_CACHE_FLUSH             = 1 << 2,
+       FDT_LCD_CACHE_WRITE_BACK_FLUSH  = FDT_LCD_CACHE_WRITE_BACK |
+                                               FDT_LCD_CACHE_FLUSH,
+};
+
+/* Information about the display controller */
+struct fdt_disp_config {
+       int valid;                      /* config is valid */
+       int width;                      /* width in pixels */
+       int height;                     /* height in pixels */
+       int bpp;                        /* number of bits per pixel */
+
+       /*
+        * log2 of number of bpp, in general, unless it bpp is 24 in which
+        * case this field holds 24 also! This is a U-Boot thing.
+        */
+       int log2_bpp;
+       struct disp_ctlr *disp;         /* Display controller to use */
+       fdt_addr_t frame_buffer;        /* Address of frame buffer */
+       unsigned pixel_clock;           /* Pixel clock in Hz */
+       uint horiz_timing[FDT_LCD_TIMING_COUNT];        /* Horizontal timing */
+       uint vert_timing[FDT_LCD_TIMING_COUNT];         /* Vertical timing */
+       int panel_node;                 /* node offset of panel information */
+};
+
+/* Information about the LCD panel */
+struct fdt_panel_config {
+       int pwm_channel;                /* PWM channel to use for backlight */
+       enum lcd_cache_t cache_type;
+
+       struct fdt_gpio_state backlight_en;     /* GPIO for backlight enable */
+       struct fdt_gpio_state lvds_shutdown;    /* GPIO for lvds shutdown */
+       struct fdt_gpio_state backlight_vdd;    /* GPIO for backlight vdd */
+       struct fdt_gpio_state panel_vdd;        /* GPIO for panel vdd */
+       /*
+        * Panel required timings
+        * Timing 1: delay between panel_vdd-rise and data-rise
+        * Timing 2: delay between data-rise and backlight_vdd-rise
+        * Timing 3: delay between backlight_vdd and pwm-rise
+        * Timing 4: delay between pwm-rise and backlight_en-rise
+        */
+       uint panel_timings[FDT_LCD_TIMINGS];
+};
+
+/**
+ * Register a new display based on device tree configuration.
+ *
+ * The frame buffer can be positioned by U-Boot or overriden by the fdt.
+ * You should pass in the U-Boot address here, and check the contents of
+ * struct fdt_disp_config to see what was actually chosen.
+ *
+ * @param blob                 Device tree blob
+ * @param default_lcd_base     Default address of LCD frame buffer
+ * @return 0 if ok, -1 on error (unsupported bits per pixel)
+ */
+int tegra_display_probe(const void *blob, void *default_lcd_base);
+
+/**
+ * Return the current display configuration
+ *
+ * @return pointer to display configuration, or NULL if there is no valid
+ * config
+ */
+struct fdt_disp_config *tegra_display_get_config(void);
+
+/**
+ * Perform the next stage of the LCD init if it is time to do so.
+ *
+ * LCD init can be time-consuming because of the number of delays we need
+ * while waiting for the backlight power supply, etc. This function can
+ * be called at various times during U-Boot operation to advance the
+ * initialization of the LCD to the next stage if sufficient time has
+ * passed since the last stage. It keeps track of what stage it is up to
+ * and the time that it is permitted to move to the next stage.
+ *
+ * The final call should have wait=1 to complete the init.
+ *
+ * @param blob fdt blob containing LCD information
+ * @param wait 1 to wait until all init is complete, and then return
+ *             0 to return immediately, potentially doing nothing if it is
+ *             not yet time for the next init.
+ */
+int tegra_lcd_check_next_stage(const void *blob, int wait);
+
+/**
+ * Set up the maximum LCD size so we can size the frame buffer.
+ *
+ * @param blob fdt blob containing LCD information
+ */
+void tegra_lcd_early_init(const void *blob);
+
+#endif /*__ASM_ARCH_TEGRA_DISPLAY_H*/
index 03fa7ca643b78af7d6e4dc11b1a6a15009391ee5..797e158e68ae49b14cf646a76add1d5098eff8da 100644 (file)
@@ -339,7 +339,7 @@ void pinmux_set_pullupdown(enum pmux_pingrp pin, enum pmux_pull pupd);
 void pinmux_set_func(enum pmux_pingrp pin, enum pmux_func func);
 
 /* Set the complete configuration for a pin group */
-void pinmux_config_pingroup(struct pingroup_config *config);
+void pinmux_config_pingroup(const struct pingroup_config *config);
 
 void pinmux_set_tristate(enum pmux_pingrp pin, int enable);
 
@@ -349,6 +349,6 @@ void pinmux_set_tristate(enum pmux_pingrp pin, int enable);
  * @param config       List of config items
  * @param len          Number of config items in list
  */
-void pinmux_config_table(struct pingroup_config *config, int len);
+void pinmux_config_table(const struct pingroup_config *config, int len);
 
 #endif /* PINMUX_H */
diff --git a/arch/arm/include/asm/arch-tegra20/pwm.h b/arch/arm/include/asm/arch-tegra20/pwm.h
new file mode 100644 (file)
index 0000000..9e03837
--- /dev/null
@@ -0,0 +1,75 @@
+/*
+ * Tegra pulse width frequency modulator definitions
+ *
+ * Copyright (c) 2011 The Chromium OS Authors.
+ * See file CREDITS for 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_ARCH_TEGRA_PWM_H
+#define __ASM_ARCH_TEGRA_PWM_H
+
+/* This is a single PWM channel */
+struct pwm_ctlr {
+       uint control;           /* Control register */
+       uint reserved[3];       /* Space space */
+};
+
+#define PWM_NUM_CHANNELS       4
+
+/* PWM_CONTROLLER_PWM_CSR_0/1/2/3_0 */
+#define PWM_ENABLE_SHIFT       31
+#define PWM_ENABLE_MASK        (0x1 << PWM_ENABLE_SHIFT)
+
+#define PWM_WIDTH_SHIFT        16
+#define PWM_WIDTH_MASK         (0x7FFF << PWM_WIDTH_SHIFT)
+
+#define PWM_DIVIDER_SHIFT      0
+#define PWM_DIVIDER_MASK       (0x1FFF << PWM_DIVIDER_SHIFT)
+
+/**
+ * Program the PWM with the given parameters.
+ *
+ * @param channel      PWM channel to update
+ * @param rate         Clock rate to use for PWM
+ * @param pulse_width  high pulse width: 0=always low, 1=1/256 pulse high,
+ *                     n = n/256 pulse high
+ * @param freq_divider frequency divider value (1 to use rate as is)
+ */
+void pwm_enable(unsigned channel, int rate, int pulse_width, int freq_divider);
+
+/**
+ * Request a pwm channel as referenced by a device tree node.
+ *
+ * This channel can then be passed to pwm_enable().
+ *
+ * @param blob         Device tree blob
+ * @param node         Node containing reference to pwm
+ * @param prop_name    Property name of pwm reference
+ * @return channel number, if ok, else -1
+ */
+int pwm_request(const void *blob, int node, const char *prop_name);
+
+/**
+ * Set up the pwm controller, by looking it up in the fdt.
+ *
+ * @return 0 if ok, -1 if the device tree node was not found or invalid.
+ */
+int pwm_init(const void *blob);
+
+#endif /* __ASM_ARCH_TEGRA_PWM_H */
index 2b9af938068ed1e30e264bf65510104859ff5d2f..41a26edfb54d597d905d591a565053f8b70b0966 100644 (file)
@@ -73,6 +73,7 @@ typedef       struct  global_data {
        unsigned long   reloc_off;
 #if !(defined(CONFIG_SYS_ICACHE_OFF) && defined(CONFIG_SYS_DCACHE_OFF))
        unsigned long   tlb_addr;
+       unsigned long   tlb_size;
 #endif
        const void      *fdt_blob;      /* Our device tree, NULL if none */
        void            **jt;           /* jump table */
index 516cc4260c13ffe7d61f8a75f63ffd5990543d7b..1ebfa8694f6a02644fff72e81df109c8de610d19 100644 (file)
@@ -49,4 +49,11 @@ extern const struct gpio_bank *const omap_gpio_bank;
 
 #define METHOD_GPIO_24XX       4
 
+/**
+ * Check if gpio is valid.
+ *
+ * @param gpio GPIO number
+ * @return 1 if ok, 0 on error
+ */
+int gpio_is_valid(int gpio);
 #endif /* _GPIO_H_ */
index 2b28a261ba0218692cf0a121807d44429ce026af..78ca8e0a6dc10741469753edff8d73cc96b61d29 100644 (file)
@@ -75,6 +75,37 @@ static inline void set_cr(unsigned int val)
        isb();
 }
 
+/* options available for data cache on each page */
+enum dcache_option {
+       DCACHE_OFF = 0x12,
+       DCACHE_WRITETHROUGH = 0x1a,
+       DCACHE_WRITEBACK = 0x1e,
+};
+
+/* Size of an MMU section */
+enum {
+       MMU_SECTION_SHIFT       = 20,
+       MMU_SECTION_SIZE        = 1 << MMU_SECTION_SHIFT,
+};
+
+/**
+ * Change the cache settings for a region.
+ *
+ * \param start                start address of memory region to change
+ * \param size         size of memory region to change
+ * \param option       dcache option to select
+ */
+void mmu_set_region_dcache_behaviour(u32 start, int size,
+                                    enum dcache_option option);
+
+/**
+ * Register an update to the page tables, and flush the TLB
+ *
+ * \param start                start address of update in page table
+ * \param stop         stop address of update in page table
+ */
+void mmu_page_table_flush(unsigned long start, unsigned long stop);
+
 #endif /* __ASSEMBLY__ */
 
 #define arch_align_stack(x) (x)
index 3422ac1c5fc3213d735ae9f69a9481c65dacb4e5..57111afd90c1427fd8a0b27b137c25857102ef1d 100644 (file)
@@ -36,18 +36,21 @@ GLSOBJS     += _umodsi3.o
 
 GLCOBJS        += div0.o
 
+SOBJS-y += crt0.o
+
 ifndef CONFIG_SPL_BUILD
 COBJS-y        += board.o
 COBJS-y        += bootm.o
 COBJS-$(CONFIG_SYS_L2_PL310) += cache-pl310.o
-COBJS-y        += interrupts.o
-COBJS-y        += reset.o
 SOBJS-$(CONFIG_USE_ARCH_MEMSET) += memset.o
 SOBJS-$(CONFIG_USE_ARCH_MEMCPY) += memcpy.o
 else
 COBJS-$(CONFIG_SPL_FRAMEWORK) += spl.o
 endif
 
+COBJS-y        += interrupts.o
+COBJS-y        += reset.o
+
 COBJS-y        += cache.o
 COBJS-y        += cache-cp15.o
 
index e0cb6353a3feb95fc35734875d53e16b633c3cd7..cfe32cc926d502e470d23ec092f827e29c91cf0f 100644 (file)
@@ -40,6 +40,7 @@
 
 #include <common.h>
 #include <command.h>
+#include <environment.h>
 #include <malloc.h>
 #include <stdio_dev.h>
 #include <version.h>
@@ -231,14 +232,22 @@ int __power_init_board(void)
 int power_init_board(void)
        __attribute__((weak, alias("__power_init_board")));
 
+       /* Record the board_init_f() bootstage (after arch_cpu_init()) */
+static int mark_bootstage(void)
+{
+       bootstage_mark_name(BOOTSTAGE_ID_START_UBOOT_F, "board_init_f");
+
+       return 0;
+}
+
 init_fnc_t *init_sequence[] = {
        arch_cpu_init,          /* basic arch cpu dependent setup */
-
-#if defined(CONFIG_BOARD_EARLY_INIT_F)
-       board_early_init_f,
-#endif
+       mark_bootstage,
 #ifdef CONFIG_OF_CONTROL
        fdtdec_check_fdt,
+#endif
+#if defined(CONFIG_BOARD_EARLY_INIT_F)
+       board_early_init_f,
 #endif
        timer_init,             /* initialize timer */
 #ifdef CONFIG_BOARD_POSTCLK_INIT
@@ -277,13 +286,6 @@ void board_init_f(ulong bootflag)
        void *new_fdt = NULL;
        size_t fdt_size = 0;
 
-       bootstage_mark_name(BOOTSTAGE_ID_START_UBOOT_F, "board_init_f");
-
-       /* Pointer is writable since we allocated a register for it */
-       gd = (gd_t *) ((CONFIG_SYS_INIT_SP_ADDR) & ~0x07);
-       /* compiler optimization barrier needed for GCC >= 3.4 */
-       __asm__ __volatile__("": : :"memory");
-
        memset((void *)gd, 0, sizeof(gd_t));
 
        gd->mon_len = _bss_end_ofs;
@@ -353,13 +355,14 @@ void board_init_f(ulong bootflag)
 
 #if !(defined(CONFIG_SYS_ICACHE_OFF) && defined(CONFIG_SYS_DCACHE_OFF))
        /* reserve TLB table */
-       addr -= (4096 * 4);
+       gd->tlb_size = 4096 * 4;
+       addr -= gd->tlb_size;
 
        /* round down to next 64 kB limit */
        addr &= ~(0x10000 - 1);
 
        gd->tlb_addr = addr;
-       debug("TLB table at: %08lx\n", addr);
+       debug("TLB table from %08lx to %08lx\n", addr, addr + gd->tlb_size);
 #endif
 
        /* round down to next 4 kB limit */
@@ -465,10 +468,6 @@ void board_init_f(ulong bootflag)
                gd->fdt_blob = new_fdt;
        }
        memcpy(id, (void *)gd, sizeof(gd_t));
-
-       relocate_code(addr_sp, id, addr);
-
-       /* NOTREACHED - relocate_code() does not return */
 }
 
 #if !defined(CONFIG_SYS_NO_FLASH)
@@ -476,7 +475,38 @@ static char *failed = "*** failed ***\n";
 #endif
 
 /*
- ************************************************************************
+ * Tell if it's OK to load the environment early in boot.
+ *
+ * If CONFIG_OF_CONFIG is defined, we'll check with the FDT to see
+ * if this is OK (defaulting to saying it's not OK).
+ *
+ * NOTE: Loading the environment early can be a bad idea if security is
+ *       important, since no verification is done on the environment.
+ *
+ * @return 0 if environment should not be loaded, !=0 if it is ok to load
+ */
+static int should_load_env(void)
+{
+#ifdef CONFIG_OF_CONTROL
+       return fdtdec_get_config_int(gd->fdt_blob, "load-environment", 0);
+#elif defined CONFIG_DELAY_ENVIRONMENT
+       return 0;
+#else
+       return 1;
+#endif
+}
+
+#if defined(CONFIG_DISPLAY_BOARDINFO_LATE) && defined(CONFIG_OF_CONTROL)
+static void display_fdt_model(const void *blob)
+{
+       const char *model;
+
+       model = (char *)fdt_getprop(blob, 0, "model", NULL);
+       printf("Model: %s\n", model ? model : "<unknown>");
+}
+#endif
+
+/************************************************************************
  *
  * This is the next part if the initialization sequence: we are now
  * running from RAM and have a "normal" C environment, i. e. global
@@ -493,8 +523,6 @@ void board_init_r(gd_t *id, ulong dest_addr)
        ulong flash_size;
 #endif
 
-       gd = id;
-
        gd->flags |= GD_FLG_RELOC;      /* tell others: relocation done */
        bootstage_mark_name(BOOTSTAGE_ID_START_UBOOT_R, "board_init_r");
 
@@ -571,8 +599,8 @@ void board_init_r(gd_t *id, ulong dest_addr)
 #endif
 
 #ifdef CONFIG_GENERIC_MMC
-       puts("MMC:   ");
-       mmc_initialize(gd->bd);
+       puts("MMC:   ");
+       mmc_initialize(gd->bd);
 #endif
 
 #ifdef CONFIG_HAS_DATAFLASH
@@ -581,7 +609,10 @@ void board_init_r(gd_t *id, ulong dest_addr)
 #endif
 
        /* initialize environment */
-       env_relocate();
+       if (should_load_env())
+               env_relocate();
+       else
+               set_default_env(NULL);
 
 #if defined(CONFIG_CMD_PCI) || defined(CONFIG_PCI)
        arm_pci_init();
@@ -598,6 +629,15 @@ void board_init_r(gd_t *id, ulong dest_addr)
 
        console_init_r();       /* fully init console as a device */
 
+#ifdef CONFIG_DISPLAY_BOARDINFO_LATE
+# ifdef CONFIG_OF_CONTROL
+       /* Put this here so it appears on the LCD, now it is ready */
+       display_fdt_model(gd->fdt_blob);
+# else
+       checkboard();
+# endif
+#endif
+
 #if defined(CONFIG_ARCH_MISC_INIT)
        /* miscellaneous arch dependent initialisations */
        arch_misc_init();
index 939de10e039153d0fd1ef29cb962366d5357a355..1cab27c22629fe5bd034d8278efa8d09e36f7378 100644 (file)
 
 #if !(defined(CONFIG_SYS_ICACHE_OFF) && defined(CONFIG_SYS_DCACHE_OFF))
 
-#if defined(CONFIG_SYS_ARM_CACHE_WRITETHROUGH)
-#define CACHE_SETUP    0x1a
-#else
-#define CACHE_SETUP    0x1e
-#endif
-
 DECLARE_GLOBAL_DATA_PTR;
 
 void __arm_init_before_mmu(void)
@@ -50,9 +44,41 @@ static void cp_delay (void)
        asm volatile("" : : : "memory");
 }
 
-static inline void dram_bank_mmu_setup(int bank)
+void set_section_dcache(int section, enum dcache_option option)
+{
+       u32 *page_table = (u32 *)gd->tlb_addr;
+       u32 value;
+
+       value = (section << MMU_SECTION_SHIFT) | (3 << 10);
+       value |= option;
+       page_table[section] = value;
+}
+
+void __mmu_page_table_flush(unsigned long start, unsigned long stop)
+{
+       debug("%s: Warning: not implemented\n", __func__);
+}
+
+void mmu_page_table_flush(unsigned long start, unsigned long stop)
+       __attribute__((weak, alias("__mmu_page_table_flush")));
+
+void mmu_set_region_dcache_behaviour(u32 start, int size,
+                                    enum dcache_option option)
 {
        u32 *page_table = (u32 *)gd->tlb_addr;
+       u32 upto, end;
+
+       end = ALIGN(start + size, MMU_SECTION_SIZE) >> MMU_SECTION_SHIFT;
+       start = start >> MMU_SECTION_SHIFT;
+       debug("%s: start=%x, size=%x, option=%d\n", __func__, start, size,
+             option);
+       for (upto = start; upto < end; upto++)
+               set_section_dcache(upto, option);
+       mmu_page_table_flush((u32)&page_table[start], (u32)&page_table[end]);
+}
+
+static inline void dram_bank_mmu_setup(int bank)
+{
        bd_t *bd = gd->bd;
        int     i;
 
@@ -60,21 +86,24 @@ static inline void dram_bank_mmu_setup(int bank)
        for (i = bd->bi_dram[bank].start >> 20;
             i < (bd->bi_dram[bank].start + bd->bi_dram[bank].size) >> 20;
             i++) {
-               page_table[i] = i << 20 | (3 << 10) | CACHE_SETUP;
+#if defined(CONFIG_SYS_ARM_CACHE_WRITETHROUGH)
+               set_section_dcache(i, DCACHE_WRITETHROUGH);
+#else
+               set_section_dcache(i, DCACHE_WRITEBACK);
+#endif
        }
 }
 
 /* to activate the MMU we need to set up virtual memory: use 1M areas */
 static inline void mmu_setup(void)
 {
-       u32 *page_table = (u32 *)gd->tlb_addr;
        int i;
        u32 reg;
 
        arm_init_before_mmu();
        /* Set up an identity-mapping for all 4GB, rw for everyone */
        for (i = 0; i < 4096; i++)
-               page_table[i] = i << 20 | (3 << 10) | 0x12;
+               set_section_dcache(i, DCACHE_OFF);
 
        for (i = 0; i < CONFIG_NR_DRAM_BANKS; i++) {
                dram_bank_mmu_setup(i);
@@ -82,7 +111,7 @@ static inline void mmu_setup(void)
 
        /* Copy the page table address to cp15 */
        asm volatile("mcr p15, 0, %0, c2, c0, 0"
-                    : : "r" (page_table) : "memory");
+                    : : "r" (gd->tlb_addr) : "memory");
        /* Set the access control to all-supervisor */
        asm volatile("mcr p15, 0, %0, c3, c0, 0"
                     : : "r" (~0));
@@ -124,8 +153,11 @@ static void cache_disable(uint32_t cache_bit)
                        return;
                /* if disabling data cache, disable mmu too */
                cache_bit |= CR_M;
-               flush_dcache_all();
        }
+       reg = get_cr();
+       cp_delay();
+       if (cache_bit == (CR_C | CR_M))
+               flush_dcache_all();
        set_cr(reg & ~cache_bit);
 }
 #endif
diff --git a/arch/arm/lib/crt0.S b/arch/arm/lib/crt0.S
new file mode 100644 (file)
index 0000000..4f60958
--- /dev/null
@@ -0,0 +1,173 @@
+/*
+ *  crt0 - C-runtime startup Code for ARM U-Boot
+ *
+ *  Copyright (c) 2012  Albert ARIBAUD <albert.u.boot@aribaud.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 <config.h>
+#include <asm-offsets.h>
+
+/*
+ * This file handles the target-independent stages of the U-Boot
+ * start-up where a C runtime environment is needed. Its entry point
+ * is _main and is branched into from the target's start.S file.
+ *
+ * _main execution sequence is:
+ *
+ * 1. Set up initial environment for calling board_init_f().
+ *    This environment only provides a stack and a place to store
+ *    the GD ('global data') structure, both located in some readily
+ *    available RAM (SRAM, locked cache...). In this context, VARIABLE
+ *    global data, initialized or not (BSS), are UNAVAILABLE; only
+ *    CONSTANT initialized data are available.
+ *
+ * 2. Call board_init_f(). This function prepares the hardware for
+ *    execution from system RAM (DRAM, DDR...) As system RAM may not
+ *    be available yet, , board_init_f() must use the current GD to
+ *    store any data which must be passed on to later stages. These
+ *    data include the relocation destination, the future stack, and
+ *    the future GD location.
+ *
+ * (the following applies only to non-SPL builds)
+ *
+ * 3. Set up intermediate environment where the stack and GD are the
+ *    ones allocated by board_init_f() in system RAM, but BSS and
+ *    initialized non-const data are still not available.
+ *
+ * 4. Call relocate_code(). This function relocates U-Boot from its
+ *    current location into the relocation destination computed by
+ *    board_init_f().
+ *
+ * 5. Set up final environment for calling board_init_r(). This
+ *    environment has BSS (initialized to 0), initialized non-const
+ *    data (initialized to their intended value), and stack in system
+ *    RAM. GD has retained values set by board_init_f(). Some CPUs
+ *    have some work left to do at this point regarding memory, so
+ *    call c_runtime_cpu_setup.
+ *
+ * 6. Branch to either nand_boot() or board_init_r().
+ */
+
+/*
+ * declare nand_boot() or board_init_r() to jump to at end of crt0
+ */
+
+#if defined(CONFIG_NAND_SPL)
+
+.globl nand_boot
+
+#elif ! defined(CONFIG_SPL_BUILD)
+
+.globl board_init_r
+
+#endif
+
+/*
+ * start and end of BSS
+ */
+
+.globl __bss_start
+.globl __bss_end__
+
+/*
+ * entry point of crt0 sequence
+ */
+
+.global _main
+
+_main:
+
+/*
+ * Set up initial C runtime environment and call board_init_f(0).
+ */
+
+#if defined(CONFIG_NAND_SPL)
+       /* deprecated, use instead CONFIG_SPL_BUILD */
+       ldr     sp, =(CONFIG_SYS_INIT_SP_ADDR)
+#elif defined(CONFIG_SPL_BUILD) && defined(CONFIG_SPL_STACK)
+       ldr     sp, =(CONFIG_SPL_STACK)
+#else
+       ldr     sp, =(CONFIG_SYS_INIT_SP_ADDR)
+#endif
+       bic     sp, sp, #7      /* 8-byte alignment for ABI compliance */
+       sub     sp, #GD_SIZE    /* allocate one GD above SP */
+       bic     sp, sp, #7      /* 8-byte alignment for ABI compliance */
+       mov     r8, sp          /* GD is above SP */
+       mov     r0, #0
+       bl      board_init_f
+
+#if ! defined(CONFIG_SPL_BUILD)
+
+/*
+ * Set up intermediate environment (new sp and gd) and call
+ * relocate_code(addr_sp, gd, addr_moni). Trick here is that
+ * we'll return 'here' but relocated.
+ */
+
+       ldr     sp, [r8, #GD_START_ADDR_SP]     /* r8 = gd->start_addr_sp */
+       bic     sp, sp, #7      /* 8-byte alignment for ABI compliance */
+       ldr     r8, [r8, #GD_BD]                /* r8 = gd->bd */
+       sub     r8, r8, #GD_SIZE                /* new GD is below bd */
+
+       adr     lr, here
+       ldr     r0, [r8, #GD_RELOC_OFF]         /* lr = gd->start_addr_sp */
+       add     lr, lr, r0
+       ldr     r0, [r8, #GD_START_ADDR_SP]     /* r0 = gd->start_addr_sp */
+       mov     r1, r8                          /* r1 = gd */
+       ldr     r2, [r8, #GD_RELOCADDR]         /* r2 = gd->relocaddr */
+       b       relocate_code
+here:
+
+/* Set up final (full) environment */
+
+       bl      c_runtime_cpu_setup     /* we still call old routine here */
+
+       ldr     r0, =__bss_start        /* this is auto-relocated! */
+       ldr     r1, =__bss_end__        /* this is auto-relocated! */
+
+       mov     r2, #0x00000000         /* prepare zero to clear BSS */
+
+clbss_l:cmp    r0, r1                  /* while not at end of BSS */
+       strlo   r2, [r0]                /* clear 32-bit BSS word */
+       addlo   r0, r0, #4              /* move to next */
+       blo     clbss_l
+
+       bl coloured_LED_init
+       bl red_led_on
+
+#if defined(CONFIG_NAND_SPL)
+
+       /* call _nand_boot() */
+       ldr     pc, =nand_boot
+
+#else
+
+       /* call board_init_r(gd_t *id, ulong dest_addr) */
+       mov     r0, r8                  /* gd_t */
+       ldr     r1, [r8, #GD_RELOCADDR] /* dest_addr */
+       /* call board_init_r */
+       ldr     pc, =board_init_r       /* this is auto-relocated! */
+
+#endif
+
+       /* we should not return here. */
+
+#endif
index 794b8679fefe2696bef4a8857f5b6d036b0c8882..e934cb6c25f5d49eebcb50b8535d1e74ae6f7e92 100644 (file)
@@ -402,14 +402,14 @@ void board_init_r (gd_t *id, ulong dest_addr)
 
        gd->flags |= GD_FLG_RELOC;      /* tell others: relocation done */
 
-       serial_initialize();
-
        debug ("Now running in RAM - U-Boot at: %08lx\n", dest_addr);
 
        WATCHDOG_RESET ();
 
        gd->reloc_off =  dest_addr - CONFIG_SYS_MONITOR_BASE;
 
+       serial_initialize();
+
        monitor_flash_len = (ulong)&__init_end - dest_addr;
 
 #if defined(CONFIG_NEEDS_MANUAL_RELOC)
index f1f49fe7fae69c9655c946cb01e43df5ee37f703..af5c56f21e6dc71ef51cf7ce7d2a5f100d4de31d 100644 (file)
@@ -48,6 +48,8 @@
 # include <asm/cpu_sh7724.h>
 #elif defined (CONFIG_CPU_SH7734)
 # include <asm/cpu_sh7734.h>
+#elif defined (CONFIG_CPU_SH7752)
+# include <asm/cpu_sh7752.h>
 #elif defined (CONFIG_CPU_SH7757)
 # include <asm/cpu_sh7757.h>
 #elif defined (CONFIG_CPU_SH7763)
diff --git a/arch/sh/include/asm/cpu_sh7752.h b/arch/sh/include/asm/cpu_sh7752.h
new file mode 100644 (file)
index 0000000..f0ad0e8
--- /dev/null
@@ -0,0 +1,211 @@
+/*
+ * Copyright (C) 2012  Renesas Solutions Corp.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public 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_CPU_SH7752_H_
+#define _ASM_CPU_SH7752_H_
+
+#define CCR            0xFF00001C
+#define WTCNT          0xFFCC0000
+#define CCR_CACHE_INIT 0x0000090b
+#define CACHE_OC_NUM_WAYS      1
+
+#ifndef __ASSEMBLY__           /* put C only stuff in this section */
+/* MMU */
+struct mmu_regs {
+       unsigned int    reserved[4];
+       unsigned int    mmucr;
+};
+#define MMU_BASE       ((struct mmu_regs *)0xff000000)
+
+/* Watchdog */
+#define WTCSR0         0xffcc0002
+#define WRSTCSR_R      0xffcc0003
+#define WRSTCSR_W      0xffcc0002
+#define WTCSR_PREFIX           0xa500
+#define WRSTCSR_PREFIX         0x6900
+#define WRSTCSR_WOVF_PREFIX    0x9600
+
+/* SCIF */
+#define SCIF0_BASE     0xfe4b0000      /* The real name is SCIF2 */
+#define SCIF1_BASE     0xfe4c0000      /* The real name is SCIF3 */
+#define SCIF2_BASE     0xfe4d0000      /* The real name is SCIF4 */
+
+/* TMU0 */
+#define TMU_BASE        0xFE430000
+
+/* ETHER, GETHER MAC address */
+struct ether_mac_regs {
+       unsigned int    reserved[114];
+       unsigned int    mahr;
+       unsigned int    reserved2;
+       unsigned int    malr;
+};
+#define GETHER0_MAC_BASE       ((struct ether_mac_regs *)0xfee0400)
+#define GETHER1_MAC_BASE       ((struct ether_mac_regs *)0xfee0c00)
+#define ETHER0_MAC_BASE                ((struct ether_mac_regs *)0xfef0000)
+#define ETHER1_MAC_BASE                ((struct ether_mac_regs *)0xfef0800)
+
+/* GETHER */
+struct gether_control_regs {
+       unsigned int    gbecont;
+};
+#define GETHER_CONTROL_BASE    ((struct gether_control_regs *)0xffc10100)
+#define GBECONT_RMII1          0x00020000
+#define GBECONT_RMII0          0x00010000
+
+/* SerMux */
+struct sermux_regs {
+       unsigned char   smr0;
+       unsigned char   smr1;
+       unsigned char   smr2;
+       unsigned char   smr3;
+       unsigned char   smr4;
+       unsigned char   smr5;
+};
+#define SERMUX_BASE    ((struct sermux_regs *)0xfe470000)
+
+
+/* USB0/1 */
+struct usb_common_regs {
+       unsigned short  reserved[129];
+       unsigned short  suspmode;
+};
+#define USB0_COMMON_BASE       ((struct usb_common_regs *)0xfe450000)
+#define USB1_COMMON_BASE       ((struct usb_common_regs *)0xfe4f0000)
+
+struct usb0_phy_regs {
+       unsigned short  reset;
+       unsigned short  reserved[4];
+       unsigned short  portsel;
+};
+#define USB0_PHY_BASE          ((struct usb0_phy_regs *)0xfe5f0000)
+
+struct usb1_port_regs {
+       unsigned int    port1sel;
+       unsigned int    reserved;
+       unsigned int    usb1intsts;
+};
+#define USB1_PORT_BASE         ((struct usb1_port_regs *)0xfe4f2000)
+
+struct usb1_alignment_regs {
+       unsigned int    ehcidatac;      /* 0xfe4fe018 */
+       unsigned int    reserved[63];
+       unsigned int    ohcidatac;
+};
+#define USB1_ALIGNMENT_BASE    ((struct usb1_alignment_regs *)0xfe4fe018)
+
+/* GPIO */
+struct gpio_regs {
+       unsigned short  pacr;
+       unsigned short  pbcr;
+       unsigned short  pccr;
+       unsigned short  pdcr;
+       unsigned short  pecr;
+       unsigned short  pfcr;
+       unsigned short  pgcr;
+       unsigned short  phcr;
+       unsigned short  picr;
+       unsigned short  pjcr;
+       unsigned short  pkcr;
+       unsigned short  plcr;
+       unsigned short  pmcr;
+       unsigned short  pncr;
+       unsigned short  pocr;
+       unsigned short  reserved;
+       unsigned short  pqcr;
+       unsigned short  prcr;
+       unsigned short  pscr;
+       unsigned short  ptcr;
+       unsigned short  pucr;
+       unsigned short  pvcr;
+       unsigned short  pwcr;
+       unsigned short  pxcr;
+       unsigned short  pycr;
+       unsigned short  pzcr;
+       unsigned char   padr;
+       unsigned char   reserved_a;
+       unsigned char   pbdr;
+       unsigned char   reserved_b;
+       unsigned char   pcdr;
+       unsigned char   reserved_c;
+       unsigned char   pddr;
+       unsigned char   reserved_d;
+       unsigned char   pedr;
+       unsigned char   reserved_e;
+       unsigned char   pfdr;
+       unsigned char   reserved_f;
+       unsigned char   pgdr;
+       unsigned char   reserved_g;
+       unsigned char   phdr;
+       unsigned char   reserved_h;
+       unsigned char   pidr;
+       unsigned char   reserved_i;
+       unsigned char   pjdr;
+       unsigned char   reserved_j;
+       unsigned char   pkdr;
+       unsigned char   reserved_k;
+       unsigned char   pldr;
+       unsigned char   reserved_l;
+       unsigned char   pmdr;
+       unsigned char   reserved_m;
+       unsigned char   pndr;
+       unsigned char   reserved_n;
+       unsigned char   podr;
+       unsigned char   reserved_o;
+       unsigned char   ppdr;
+       unsigned char   reserved_p;
+       unsigned char   pqdr;
+       unsigned char   reserved_q;
+       unsigned char   prdr;
+       unsigned char   reserved_r;
+       unsigned char   psdr;
+       unsigned char   reserved_s;
+       unsigned char   ptdr;
+       unsigned char   reserved_t;
+       unsigned char   pudr;
+       unsigned char   reserved_u;
+       unsigned char   pvdr;
+       unsigned char   reserved_v;
+       unsigned char   pwdr;
+       unsigned char   reserved_w;
+       unsigned char   pxdr;
+       unsigned char   reserved_x;
+       unsigned char   pydr;
+       unsigned char   reserved_y;
+       unsigned char   pzdr;
+       unsigned char   reserved_z;
+       unsigned short  ncer;
+       unsigned short  ncmcr;
+       unsigned short  nccsr;
+       unsigned char   reserved2[2];
+       unsigned short  psel0;          /* +0x70 */
+       unsigned short  psel1;
+       unsigned short  psel2;
+       unsigned short  psel3;
+       unsigned short  psel4;
+       unsigned short  psel5;
+       unsigned short  psel6;
+       unsigned short  reserved3[2];
+       unsigned short  psel7;
+};
+#define GPIO_BASE      ((struct gpio_regs *)0xffec0000)
+
+#endif /* ifndef __ASSEMBLY__ */
+#endif /* _ASM_CPU_SH7752_H_ */
index 0e06c29153dfefc89059845c1c054656963a81bd..e524f3511d2691b0ccaef26840c85b7885e01005 100644 (file)
@@ -39,7 +39,7 @@ int board_early_init_f(void)
                        NET2BIG_V2_OE_LOW, NET2BIG_V2_OE_HIGH);
 
        /* Multi-Purpose Pins Functionality configuration */
-       u32 kwmpp_config[] = {
+       static const u32 kwmpp_config[] = {
                MPP0_SPI_SCn,
                MPP1_SPI_MOSI,
                MPP2_SPI_SCK,
index 101a80a70ab9a0eed2c792dc9c2121674b115a1b..0aa5345ddcc8040ecff6e0948e0a2b3c93dc89a6 100644 (file)
@@ -39,7 +39,7 @@ int board_early_init_f(void)
                        NETSPACE_V2_OE_LOW, NETSPACE_V2_OE_HIGH);
 
        /* Multi-Purpose Pins Functionality configuration */
-       u32 kwmpp_config[] = {
+       static const u32 kwmpp_config[] = {
                MPP0_SPI_SCn,
                MPP1_SPI_MOSI,
                MPP2_SPI_SCK,
diff --git a/board/LaCie/wireless_space/Makefile b/board/LaCie/wireless_space/Makefile
new file mode 100644 (file)
index 0000000..b43c3d3
--- /dev/null
@@ -0,0 +1,46 @@
+#
+# Copyright (C) 2011 Simon Guinot <sguinot@lacie.com>
+#
+# 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.
+#
+
+include $(TOPDIR)/config.mk
+ifneq ($(OBJTREE),$(SRCTREE))
+$(shell mkdir -p $(obj)../common)
+endif
+
+LIB    = $(obj)lib$(BOARD).o
+
+COBJS  := $(BOARD).o ../common/common.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/LaCie/wireless_space/kwbimage.cfg b/board/LaCie/wireless_space/kwbimage.cfg
new file mode 100644 (file)
index 0000000..0daf5b5
--- /dev/null
@@ -0,0 +1,82 @@
+#
+# Copyright (C) 2012 Albert ARIBAUD <albert.u.boot@aribaud.net>
+#
+# Based on netspace_v2 kwbimage.cfg:
+# Copyright (C) 2011 Simon Guinot <sguinot@lacie.com>
+#
+# 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.
+#
+# Refer docs/README.kwimage for more details about how-to configure
+# and create kirkwood boot image
+#
+
+# Boot Media configurations
+BOOT_FROM      nand    # Boot from NAND flash
+NAND_PAGE_SIZE 800
+
+# SOC registers configuration using bootrom header extension
+# Maximum KWBIMAGE_MAX_CONFIG configurations allowed
+
+# Values taken from image original LaCie U-Boot header dump!
+
+# 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
+
+DATA 0xFFD01404 0x37743000     # DDR Controller Control Low
+
+DATA 0xFFD01408 0x11012228     # DDR Timing (Low) (active cycles value +1)
+
+DATA 0xFFD0140C 0x00000A19     #  DDR Timing (High)
+
+DATA 0xFFD01410 0x0000CCCC     #  DDR Address Control
+
+DATA 0xFFD01414 0x00000000     #  DDR Open Pages Control
+
+DATA 0xFFD01418 0x00000000     #  DDR Operation
+
+DATA 0xFFD0141C 0x00000662     #  DDR Mode
+
+DATA 0xFFD01420 0x00000004     #  DDR Extended Mode
+
+DATA 0xFFD01424 0x0000F07F     #  DDR Controller Control High
+
+DATA 0xFFD01428 0x00096630     # DDR2 ODT Read Timing (default values)
+
+DATA 0xFFD0147C 0x00009663     # DDR2 ODT Write Timing (default values)
+
+DATA 0xFFD01504 0x0FFFFFF1     # CS[0]n Size
+DATA 0xFFD01508 0x00000000     # CS[1]n Base address to 0x0
+DATA 0xFFD0150C 0x00000000     # CS[1]n Size, window disabled
+DATA 0xFFD01514 0x00000000     # CS[2]n Size, window disabled
+DATA 0xFFD0151C 0x00000000     # CS[3]n Size, window disabled
+DATA 0xFFD01494 0x00120012     #  DDR ODT Control (Low)
+DATA 0xFFD01498 0x00000000     #  DDR ODT Control (High)
+DATA 0xFFD0149C 0x0000E40F     # CPU ODT Control
+DATA 0xFFD01480 0x00000001     # DDR Initialization Control
+DATA 0xFFD20134 0x66666666
+DATA 0xFFD20138 0x66666666
+DATA 0xFFD10000 0x01112222
+DATA 0xFFD1000C 0x00000000
+DATA 0xFFD10104 0x00000000
+DATA 0xFFD10100 0x40000000
+# End of Header extension
+DATA 0x0 0x0
diff --git a/board/LaCie/wireless_space/wireless_space.c b/board/LaCie/wireless_space/wireless_space.c
new file mode 100644 (file)
index 0000000..2080658
--- /dev/null
@@ -0,0 +1,176 @@
+/*
+ * Copyright (C) 2011 Simon Guinot <sguinot@lacie.com>
+ *
+ * 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.
+ */
+
+#include <common.h>
+#include <command.h>
+#include <asm/arch/cpu.h>
+#include <asm/arch/kirkwood.h>
+#include <asm/arch/mpp.h>
+#include <asm/arch/gpio.h>
+
+#include "../common/common.h"
+#include "netdev.h"
+
+DECLARE_GLOBAL_DATA_PTR;
+
+/* GPIO configuration: start FAN at low speed, USB and HDD */
+
+#define WIRELESS_SPACE_OE_LOW          0xFF006808
+#define WIRELESS_SPACE_OE_HIGH         0x0000F989
+#define WIRELESS_SPACE_OE_VAL_LOW      0x00010080
+#define WIRELESS_SPACE_OE_VAL_HIGH     0x00000240
+
+#define WIRELESS_SPACE_REAR_BUTTON     13
+#define WIRELESS_SPACE_FRONT_BUTTON    43
+
+const 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,               /* Fan speed (bit 1) */
+       MPP8_TW_SDA,
+       MPP9_TW_SCK,
+       MPP10_UART0_TXD,
+       MPP11_UART0_RXD,
+       MPP13_GPIO,             /* Red led */
+       MPP14_GPIO,             /* USB fuse */
+       MPP15_SATA0_ACTn,
+       MPP16_GPIO,             /* SATA 0 power */
+       MPP17_GPIO,             /* SATA 1 power */
+       MPP18_NF_IO0,
+       MPP19_NF_IO1,
+       MPP20_GE1_0,            /* Gigabit Ethernet 1 */
+       MPP21_GE1_1,
+       MPP22_GE1_2,
+       MPP23_GE1_3,
+       MPP24_GE1_4,
+       MPP25_GE1_5,
+       MPP26_GE1_6,
+       MPP27_GE1_7,
+       MPP28_GE1_8,
+       MPP29_GE1_9,
+       MPP30_GE1_10,
+       MPP31_GE1_11,
+       MPP32_GE1_12,
+       MPP33_GE1_13,
+       MPP34_GE1_14,
+       MPP35_GE1_15,
+       MPP36_GPIO,             /* Fan speed (bit 2) */
+       MPP37_GPIO,             /* Fan speed (bit 0) */
+       MPP38_GPIO,             /* Fan power */
+       MPP39_GPIO,             /* Fan rotation fail */
+       MPP40_GPIO,             /* Ethernet switch link */
+       MPP41_GPIO,             /* USB enable host vbus */
+       MPP42_GPIO,             /* LED clock control */
+       MPP43_GPIO,             /* WPS button (0=Pushed, 1=Released) */
+       MPP44_GPIO,             /* Red LED on/off */
+       MPP45_GPIO,             /* Red LED timer blink (on=off=100ms) */
+       MPP46_GPIO,             /* Green LED on/off */
+       MPP47_GPIO,             /* LED (blue, green) SATA activity blink */
+       MPP48_GPIO,             /* Blue LED on/off */
+       0
+};
+
+struct mv88e61xx_config swcfg = {
+       .name = "egiga0",
+       .vlancfg = MV88E61XX_VLANCFG_ROUTER,
+       .rgmii_delay = MV88E61XX_RGMII_DELAY_EN,
+       .led_init = MV88E61XX_LED_INIT_EN,
+       .mdip = MV88E61XX_MDIP_NOCHANGE,
+       .portstate = MV88E61XX_PORTSTT_FORWARDING,
+       .cpuport = 0x20,
+       .ports_enabled = 0x3F,
+};
+
+int board_early_init_f(void)
+{
+       /* Gpio configuration */
+       kw_config_gpio(WIRELESS_SPACE_OE_VAL_LOW, WIRELESS_SPACE_OE_VAL_HIGH,
+                       WIRELESS_SPACE_OE_LOW, WIRELESS_SPACE_OE_HIGH);
+
+       /* Multi-Purpose Pins Functionality configuration */
+       kirkwood_mpp_conf(kwmpp_config, NULL);
+
+       return 0;
+}
+
+int board_init(void)
+{
+       /* Machine number */
+       gd->bd->bi_arch_number = CONFIG_MACH_TYPE;
+
+       /* Boot parameters address */
+       gd->bd->bi_boot_params = kw_sdram_bar(0) + 0x100;
+
+       return 0;
+}
+
+#if defined(CONFIG_MISC_INIT_R)
+int misc_init_r(void)
+{
+#if defined(CONFIG_CMD_I2C) && defined(CONFIG_SYS_I2C_EEPROM_ADDR)
+       if (!getenv("ethaddr")) {
+               uchar mac[6];
+               if (lacie_read_mac_address(mac) == 0)
+                       eth_setenv_enetaddr("ethaddr", mac);
+       }
+#endif
+       return 0;
+}
+#endif
+
+#if defined(CONFIG_CMD_NET) && defined(CONFIG_RESET_PHY_R)
+/* Configure and initialize PHY */
+void reset_phy(void)
+{
+       /* configure switch on egiga0 */
+       mv88e61xx_switch_initialize(&swcfg);
+}
+#endif
+
+#if defined(CONFIG_KIRKWOOD_GPIO) && defined(CONFIG_WIRELESS_SPACE_CMD)
+/* Return GPIO button status */
+static int
+do_ws(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+{
+       if (strcmp(argv[1], "button") == 0) {
+               if (strcmp(argv[2], "rear") == 0)
+                       /* invert GPIO result for intuitive while/until use */
+                       return !kw_gpio_get_value(WIRELESS_SPACE_REAR_BUTTON);
+               else if (strcmp(argv[2], "front") == 0)
+                       return kw_gpio_get_value(WIRELESS_SPACE_FRONT_BUTTON);
+               else
+                       return -1;
+       } else {
+               return -1;
+       }
+}
+
+U_BOOT_CMD(ws, 3, 0, do_ws,
+          "Return GPIO button status 0=off 1=on",
+          "- ws button rear|front: test buttons' states\n"
+);
+#endif
index d6497aaa07e6ff104dbaad34c85a6f5ae0171188..0caf34ff0a8f195f8a893ef93e07d566ccf97cf8 100644 (file)
@@ -46,7 +46,7 @@ int board_early_init_f(void)
                        DREAMPLUG_OE_LOW, DREAMPLUG_OE_HIGH);
 
        /* Multi-Purpose Pins Functionality configuration */
-       u32 kwmpp_config[] = {
+       static const u32 kwmpp_config[] = {
                MPP0_SPI_SCn,           /* SPI Flash */
                MPP1_SPI_MOSI,
                MPP2_SPI_SCK,
index f5c1c3cfd908318a4405c45cde90eeef3738a7c4..3a52ab2744472d365948b60d13ac0bb783f8b0f5 100644 (file)
@@ -43,7 +43,7 @@ int board_early_init_f(void)
                        GURUPLUG_OE_LOW, GURUPLUG_OE_HIGH);
 
        /* Multi-Purpose Pins Functionality configuration */
-       u32 kwmpp_config[] = {
+       static const u32 kwmpp_config[] = {
                MPP0_NF_IO2,
                MPP1_NF_IO3,
                MPP2_NF_IO4,
index 43852f6b24f1a04a5397c988f40578b30bf1f57b..fb57faa52bf3fe2e62c9d4d3fec85e331d422993 100644 (file)
@@ -45,7 +45,7 @@ int board_early_init_f(void)
                        MV88F6281GTW_GE_OE_LOW, MV88F6281GTW_GE_OE_HIGH);
 
        /* Multi-Purpose Pins Functionality configuration */
-       u32 kwmpp_config[] = {
+       static const u32 kwmpp_config[] = {
                MPP0_SPI_SCn,
                MPP1_SPI_MOSI,
                MPP2_SPI_SCK,
index d48f05a0488ade209a5df311b2175dfb2a3da7f0..c59a32611c6866999de713c46b20e45c1892ecb4 100644 (file)
@@ -48,7 +48,7 @@ int board_early_init_f(void)
                        OPENRD_OE_LOW, OPENRD_OE_HIGH);
 
        /* Multi-Purpose Pins Functionality configuration */
-       u32 kwmpp_config[] = {
+       static const u32 kwmpp_config[] = {
                MPP0_NF_IO2,
                MPP1_NF_IO3,
                MPP2_NF_IO4,
index 1fd7677dcb589cb26d60c11978b43936eb87b720..adaa6a1a696394a926133e056ab39eeb05f7d0d8 100644 (file)
@@ -44,7 +44,7 @@ int board_early_init_f(void)
                        RD6281A_OE_LOW, RD6281A_OE_HIGH);
 
        /* Multi-Purpose Pins Functionality configuration */
-       u32 kwmpp_config[] = {
+       static const u32 kwmpp_config[] = {
                MPP0_NF_IO2,
                MPP1_NF_IO3,
                MPP2_NF_IO4,
index 688d3086d4d3f3296b82e4e45a464788f2f92619..16efe645d1a69f7e938ddc6b8abde4fb99ccd747 100644 (file)
@@ -43,7 +43,7 @@ int board_early_init_f(void)
                        SHEEVAPLUG_OE_LOW, SHEEVAPLUG_OE_HIGH);
 
        /* Multi-Purpose Pins Functionality configuration */
-       u32 kwmpp_config[] = {
+       static const u32 kwmpp_config[] = {
                MPP0_NF_IO2,
                MPP1_NF_IO3,
                MPP2_NF_IO4,
index fc88520b2d15eea8d852a8db47392075c885d6f2..4f1f899b903e7607a92a9f018f6c25b491e0b2b8 100644 (file)
@@ -47,7 +47,7 @@ int board_early_init_f(void)
                        DOCKSTAR_OE_LOW, DOCKSTAR_OE_HIGH);
 
        /* Multi-Purpose Pins Functionality configuration */
-       u32 kwmpp_config[] = {
+       static const u32 kwmpp_config[] = {
                MPP0_NF_IO2,
                MPP1_NF_IO3,
                MPP2_NF_IO4,
index edb088680d000838288d84f9cff0bd48433cd9b8..8773e6fd3994c68e27aa968110ea363124fd9d2c 100644 (file)
@@ -295,6 +295,9 @@ int board_init(void)
        at91_macb_hw_init();
 #endif
 
+#if defined(CONFIG_USB_OHCI_NEW) || defined(CONFIG_USB_EHCI)
+       at91_uhp_hw_init();
+#endif
 #ifdef CONFIG_LCD
        at91sam9x5ek_lcd_hw_init();
 #endif
index 57776fb077400599fbc30333c58baede3b30bb35..83eea04cbcb90dcccc72ab587026b98cf727b7f3 100644 (file)
@@ -49,9 +49,8 @@
  * you can do this only with a working network connection. Therefore, a random
  * ethernet address is generated if none is set and a DHCP request is sent.
  * After a successful DHCP response is received, the network settings are
- * configured and the ncip parameter is set to the serverip. Eg. for a working
- * resuce mode, you should set 'next-server' to the host where the netconsole
- * client is started.
+ * configured and the ncip is unset. Therefore, all netconsole packets are
+ * broadcasted.
  * Additionally, the bootsource is set to 'rescue'.
  */
 
@@ -76,7 +75,7 @@ int board_early_init_f(void)
         * Multi-Purpose Pins Functionality configuration
         * These strappings are taken from the original vendor uboot port.
         */
-       u32 kwmpp_config[] = {
+       static const u32 kwmpp_config[] = {
                MPP0_SPI_SCn,
                MPP1_SPI_MOSI,
                MPP2_SPI_SCK,
index bac9ce55a88363352b1ed0dc088bd8f19deca8e3..3b1c8ec2adde3a3a45726ec7d8e326183fbbade3 100644 (file)
@@ -45,7 +45,7 @@ int board_early_init_f(void)
                        POGO_E02_OE_LOW, POGO_E02_OE_HIGH);
 
        /* Multi-Purpose Pins Functionality configuration */
-       u32 kwmpp_config[] = {
+       static const u32 kwmpp_config[] = {
                MPP0_NF_IO2,
                MPP1_NF_IO3,
                MPP2_NF_IO4,
index 6c2e95b1d4d5a7e1627d17208d449019f9a49ace..edbb941985c103e8d18ab2069471f7bd6ef95fa2 100644 (file)
@@ -32,6 +32,7 @@
 #include <netdev.h>
 #include <net.h>
 #include <i2c.h>
+#include <usb.h>
 #include <twl4030.h>
 #include <linux/compiler.h>
 
@@ -41,6 +42,8 @@
 #include <asm/arch/mmc_host_def.h>
 #include <asm/arch/sys_proto.h>
 #include <asm/mach-types.h>
+#include <asm/ehci-omap.h>
+#include <asm/gpio.h>
 
 #include "eeprom.h"
 
@@ -260,6 +263,36 @@ static void cm_t3x_set_common_muxconf(void)
        MUX_VAL(CP(HSUSB0_DATA6),       (IEN  | PTD | DIS | M0)); /*HSUSB0_DATA6*/
        MUX_VAL(CP(HSUSB0_DATA7),       (IEN  | PTD | DIS | M0)); /*HSUSB0_DATA7*/
 
+       /* USB EHCI */
+       MUX_VAL(CP(ETK_D0_ES2),         (IEN  | PTD | EN  | M3)); /*HSUSB1_DT0*/
+       MUX_VAL(CP(ETK_D1_ES2),         (IEN  | PTD | EN  | M3)); /*HSUSB1_DT1*/
+       MUX_VAL(CP(ETK_D2_ES2),         (IEN  | PTD | EN  | M3)); /*HSUSB1_DT2*/
+       MUX_VAL(CP(ETK_D7_ES2),         (IEN  | PTD | EN  | M3)); /*HSUSB1_DT3*/
+       MUX_VAL(CP(ETK_D4_ES2),         (IEN  | PTD | EN  | M3)); /*HSUSB1_DT4*/
+       MUX_VAL(CP(ETK_D5_ES2),         (IEN  | PTD | EN  | M3)); /*HSUSB1_DT5*/
+       MUX_VAL(CP(ETK_D6_ES2),         (IEN  | PTD | EN  | M3)); /*HSUSB1_DT6*/
+       MUX_VAL(CP(ETK_D3_ES2),         (IEN  | PTD | EN  | M3)); /*HSUSB1_DT7*/
+       MUX_VAL(CP(ETK_D8_ES2),         (IEN  | PTD | EN  | M3)); /*HSUSB1_DIR*/
+       MUX_VAL(CP(ETK_D9_ES2),         (IEN  | PTD | EN  | M3)); /*HSUSB1_NXT*/
+       MUX_VAL(CP(ETK_CTL_ES2),        (IDIS | PTD | DIS | M3)); /*HSUSB1_CLK*/
+       MUX_VAL(CP(ETK_CLK_ES2),        (IDIS | PTU | DIS | M3)); /*HSUSB1_STP*/
+
+       MUX_VAL(CP(ETK_D14_ES2),        (IEN  | PTD | EN  | M3)); /*HSUSB2_DT0*/
+       MUX_VAL(CP(ETK_D15_ES2),        (IEN  | PTD | EN  | M3)); /*HSUSB2_DT1*/
+       MUX_VAL(CP(MCSPI1_CS3),         (IEN  | PTD | EN  | M3)); /*HSUSB2_DT2*/
+       MUX_VAL(CP(MCSPI2_CS1),         (IEN  | PTD | EN  | M3)); /*HSUSB2_DT3*/
+       MUX_VAL(CP(MCSPI2_SIMO),        (IEN  | PTD | EN  | M3)); /*HSUSB2_DT4*/
+       MUX_VAL(CP(MCSPI2_SOMI),        (IEN  | PTD | EN  | M3)); /*HSUSB2_DT5*/
+       MUX_VAL(CP(MCSPI2_CS0),         (IEN  | PTD | EN  | M3)); /*HSUSB2_DT6*/
+       MUX_VAL(CP(MCSPI2_CLK),         (IEN  | PTD | EN  | M3)); /*HSUSB2_DT7*/
+       MUX_VAL(CP(ETK_D12_ES2),        (IEN  | PTD | EN  | M3)); /*HSUSB2_DIR*/
+       MUX_VAL(CP(ETK_D13_ES2),        (IEN  | PTD | EN  | M3)); /*HSUSB2_NXT*/
+       MUX_VAL(CP(ETK_D10_ES2),        (IDIS | PTD | DIS | M3)); /*HSUSB2_CLK*/
+       MUX_VAL(CP(ETK_D11_ES2),        (IDIS | PTU | DIS | M3)); /*HSUSB2_STP*/
+
+       /* SB_T35_USB_HUB_RESET_GPIO */
+       MUX_VAL(CP(CAM_WEN),            (IDIS | PTD | DIS | M4)); /*GPIO_167*/
+
        /* I2C1 */
        MUX_VAL(CP(I2C1_SCL),           (IEN  | PTU | EN  | M0)); /*I2C1_SCL*/
        MUX_VAL(CP(I2C1_SDA),           (IEN  | PTU | EN  | M0)); /*I2C1_SDA*/
@@ -461,3 +494,47 @@ void __weak get_board_serial(struct tag_serialnr *serialnr)
        serialnr->low = 0;
        serialnr->high = 0;
 };
+
+#ifdef CONFIG_USB_EHCI_OMAP
+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,
+};
+
+#define SB_T35_USB_HUB_RESET_GPIO      167
+int ehci_hcd_init(int index, struct ehci_hccr **hccr, struct ehci_hcor **hcor)
+{
+       u8 val;
+       int offset;
+
+       if (gpio_request(SB_T35_USB_HUB_RESET_GPIO, "SB-T35 usb hub reset")) {
+               printf("Error: can't obtain GPIO %d for SB-T35 usb hub reset",
+                               SB_T35_USB_HUB_RESET_GPIO);
+               return -1;
+       }
+
+       gpio_direction_output(SB_T35_USB_HUB_RESET_GPIO, 0);
+       udelay(10);
+       gpio_set_value(SB_T35_USB_HUB_RESET_GPIO, 1);
+       udelay(1000);
+
+       offset = TWL4030_BASEADD_GPIO + TWL4030_GPIO_GPIODATADIR1;
+       twl4030_i2c_read_u8(TWL4030_CHIP_GPIO, &val, offset);
+       /* Set GPIO6 and GPIO7 of TPS65930 as output */
+       val |= 0xC0;
+       twl4030_i2c_write_u8(TWL4030_CHIP_GPIO, val, offset);
+       offset = TWL4030_BASEADD_GPIO + TWL4030_GPIO_SETGPIODATAOUT1;
+       /* Take both PHYs out of reset */
+       twl4030_i2c_write_u8(TWL4030_CHIP_GPIO, 0xC0, offset);
+       udelay(1);
+
+       return omap_ehci_hcd_init(&usbhs_bdata, hccr, hcor);
+}
+
+int ehci_hcd_stop(void)
+{
+       return omap_ehci_hcd_stop();
+}
+
+#endif /* CONFIG_USB_EHCI_OMAP */
index 0725989de06938a4f259bb0630f450befd1dda25..6492d4168e1dacc08f13b4320b062c724d23906a 100644 (file)
@@ -61,9 +61,8 @@ int board_mmc_init(bd_t *bd)
        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 */
-       tegra_mmc_init(0, 4, -1, -1);
+       /* init dev 0, eMMC chip, with 8-bit bus */
+       tegra_mmc_init(0, 8, -1, -1);
 
        debug("board_mmc_init: init SD slot\n");
        /* init dev 3, SD slot, with 4-bit bus */
index db79e7796d09c0351d08207b6a38aef6641633fe..4450674a75989f8f87fe763acdf0535364b3492e 100644 (file)
@@ -8,6 +8,7 @@
 
        aliases {
                usb0 = "/usb@c5008000";
+               usb1 = "/usb@c5000000";
        };
 
        memory {
@@ -48,7 +49,7 @@
        };
 
        usb@c5000000 {
-               status = "disabled";
+               nvidia,vbus-gpio = <&gpio 170 0>; /* PV2 */
        };
 
        usb@c5004000 {
index 9ef66fd86535d45b113aed417b6557c3bcc43626..8f4dd09faa345c08088cbdd79612037bbdb0db33 100644 (file)
 #include <mmc.h>
 #endif
 
+void pin_mux_usb(void)
+{
+       /*
+        * USB1 internal/external mux GPIO, which masquerades as a VBUS GPIO
+        * in the current device tree.
+        */
+       pinmux_tristate_disable(PINGRP_UAC);
+}
 
 void pin_mux_spi(void)
 {
index aaff2e868ba2e99e90e55afad877a9111838b058..56fe495277ee7d6ad84df39ab4494de81f2f6784 100644 (file)
@@ -91,15 +91,14 @@ int board_mmc_init(bd_t *bis)
  * 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)
+void get_board_mem_timings(struct board_sdrc_timings *timings)
 {
        /* General SDRC config */
-       *mcfg = MICRON_V_MCFG_165(128 << 20);
-       *rfr_ctrl = SDP_3430_SDRC_RFR_CTRL_165MHz;
+       timings->mcfg = MICRON_V_MCFG_165(128 << 20);
+       timings->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;
+       timings->ctrla = MICRON_V_ACTIMA_165;
+       timings->ctrlb = MICRON_V_ACTIMB_165;
+       timings->mr = MICRON_V_MR_165;
 }
index 11260fe5f68ded64f248094fd69f4204ecf3d61c..41879017e82cdf10465d0f8fff24abced4705346 100644 (file)
@@ -44,7 +44,7 @@ int board_early_init_f(void)
                        DNS325_OE_LOW, DNS325_OE_HIGH);
 
        /* Multi-Purpose Pins Functionality configuration */
-       u32 kwmpp_config[] = {
+       static const u32 kwmpp_config[] = {
                MPP0_NF_IO2,
                MPP1_NF_IO3,
                MPP2_NF_IO4,
index a3079dbca367e2b7cb60b5c25a5c50ac8f22bc14..06ca17c3cdec4acdc93621f9a2dabaffe4f61bec 100644 (file)
 
 DECLARE_GLOBAL_DATA_PTR;
 
-#ifdef CONFIG_HW_WATCHDOG
-void hw_watchdog_reset(void)
-{
-       mxc_hw_watchdog_reset();
-}
-#endif
-
 int dram_init(void)
 {
        /* dram_init must store complete ramsize in gd->ram_size */
@@ -188,7 +181,7 @@ int board_late_init(void)
        pmic_reg_write(p, REG_INT_STATUS1, RTCRSTI);
 
 #ifdef CONFIG_HW_WATCHDOG
-       mxc_hw_watchdog_enable();
+       hw_watchdog_init();
 #endif
 
        return 0;
index 4a8352fb3d28c16e3371c3cc5879955e073fa3cf..d73e27e5405ba24b1522bc7e998df5a777b02a8a 100644 (file)
 
 #include <common.h>
 #include <asm/io.h>
+#include <asm/gpio.h>
 #include <asm/arch/imx-regs.h>
 #include <asm/arch/imx25-pinmux.h>
 #include <asm/arch/sys_proto.h>
+#include <asm/arch/clock.h>
+#include <mmc.h>
+#include <fsl_esdhc.h>
+#include <i2c.h>
+#include <power/pmic.h>
+#include <fsl_pmic.h>
+#include <mc34704.h>
+
+#define FEC_RESET_B            IMX_GPIO_NR(2, 3)
+#define FEC_ENABLE_B           IMX_GPIO_NR(4, 8)
+#define CARD_DETECT            IMX_GPIO_NR(2, 1)
 
 DECLARE_GLOBAL_DATA_PTR;
 
+#ifdef CONFIG_FSL_ESDHC
+struct fsl_esdhc_cfg esdhc_cfg[1] = {
+       {IMX_MMC_SDHC1_BASE},
+};
+#endif
+
+static void mx25pdk_fec_init(void)
+{
+       struct iomuxc_mux_ctl *muxctl;
+       struct iomuxc_pad_ctl *padctl;
+       u32 gpio_mux_mode = MX25_PIN_MUX_MODE(5);
+       u32 gpio_mux_mode0_sion = MX25_PIN_MUX_MODE(0) | MX25_PIN_MUX_SION;
+
+       /* FEC pin init is generic */
+       mx25_fec_init_pins();
+
+       muxctl = (struct iomuxc_mux_ctl *)IMX_IOPADMUX_BASE;
+       padctl = (struct iomuxc_pad_ctl *)IMX_IOPADCTL_BASE;
+       /*
+        * Set up FEC_RESET_B and FEC_ENABLE_B
+        *
+        * FEC_RESET_B: gpio2_3 is ALT 5 mode of pin D12
+        * FEC_ENABLE_B: gpio4_8 is ALT 5 mode of pin A17
+        */
+       writel(gpio_mux_mode, &muxctl->pad_d12);
+       writel(gpio_mux_mode, &muxctl->pad_a17);
+
+       writel(0x0, &padctl->pad_d12);
+       writel(0x0, &padctl->pad_a17);
+
+       /* Assert RESET and ENABLE low */
+       gpio_direction_output(FEC_RESET_B, 0);
+       gpio_direction_output(FEC_ENABLE_B, 0);
+
+       udelay(10);
+
+       /* Deassert RESET and ENABLE */
+       gpio_set_value(FEC_RESET_B, 1);
+       gpio_set_value(FEC_ENABLE_B, 1);
+
+       /* Setup I2C pins so that PMIC can turn on PHY supply */
+       writel(gpio_mux_mode0_sion, &muxctl->pad_i2c1_clk);
+       writel(gpio_mux_mode0_sion, &muxctl->pad_i2c1_dat);
+       writel(0x1E8, &padctl->pad_i2c1_clk);
+       writel(0x1E8, &padctl->pad_i2c1_dat);
+}
+
 int dram_init(void)
 {
        /* dram_init must store complete ramsize in gd->ram_size */
@@ -48,6 +107,68 @@ int board_init(void)
        return 0;
 }
 
+int board_late_init(void)
+{
+       struct pmic *p;
+       int ret;
+
+       mx25pdk_fec_init();
+
+       ret = pmic_init(I2C_PMIC);
+       if (ret)
+               return ret;
+
+       p = pmic_get("FSL_PMIC");
+       if (!p)
+               return -ENODEV;
+
+       /* Turn on Ethernet PHY supply */
+       pmic_reg_write(p, MC34704_GENERAL2_REG, ONOFFE);
+
+       return 0;
+}
+
+#ifdef CONFIG_FSL_ESDHC
+int board_mmc_getcd(struct mmc *mmc)
+{
+       struct iomuxc_mux_ctl *muxctl;
+       struct iomuxc_pad_ctl *padctl;
+       u32 gpio_mux_mode = MX25_PIN_MUX_MODE(5);
+
+       /*
+        * Set up the Card Detect pin.
+        *
+        * SD1_GPIO_CD: gpio2_1 is ALT 5 mode of pin A15
+        *
+        */
+       muxctl = (struct iomuxc_mux_ctl *)IMX_IOPADMUX_BASE;
+       padctl = (struct iomuxc_pad_ctl *)IMX_IOPADCTL_BASE;
+
+       writel(gpio_mux_mode, &muxctl->pad_a15);
+       writel(0x0, &padctl->pad_a15);
+
+       gpio_direction_input(CARD_DETECT);
+       return !gpio_get_value(CARD_DETECT);
+}
+
+int board_mmc_init(bd_t *bis)
+{
+       struct iomuxc_mux_ctl *muxctl;
+       u32 sdhc1_mux_mode = MX25_PIN_MUX_MODE(0) | MX25_PIN_MUX_SION;
+
+       muxctl = (struct iomuxc_mux_ctl *)IMX_IOPADMUX_BASE;
+       writel(sdhc1_mux_mode, &muxctl->pad_sd1_cmd);
+       writel(sdhc1_mux_mode, &muxctl->pad_sd1_clk);
+       writel(sdhc1_mux_mode, &muxctl->pad_sd1_data0);
+       writel(sdhc1_mux_mode, &muxctl->pad_sd1_data1);
+       writel(sdhc1_mux_mode, &muxctl->pad_sd1_data2);
+       writel(sdhc1_mux_mode, &muxctl->pad_sd1_data3);
+
+       esdhc_cfg[0].sdhc_clk = mxc_get_clock(MXC_ESDHC1_CLK);
+       return fsl_esdhc_initialize(bis, &esdhc_cfg[0]);
+}
+#endif
+
 int checkboard(void)
 {
        puts("Board: MX25PDK\n");
index 29ad0e6e79c94b856d669ebb3d24b44c0427ee34..52677299e889a384a32ecc0d1de1c77be6222473 100644 (file)
@@ -65,6 +65,8 @@ SECTIONS
 
        . = ALIGN(4);
 
+       __image_copy_end = .;
+
        .rel.dyn : {
                __rel_dyn_start = .;
                *(.rel*)
index bc60632aa0b34662a10243f30c9f6a42f856bbb0..895396cd6231ce037493629f8742c70598ba7ef0 100644 (file)
 
 DECLARE_GLOBAL_DATA_PTR;
 
-#ifdef CONFIG_HW_WATCHDOG
-void hw_watchdog_reset(void)
-{
-       mxc_hw_watchdog_reset();
-}
-#endif
-
 int dram_init(void)
 {
        /* dram_init must store complete ramsize in gd->ram_size */
@@ -98,7 +91,7 @@ int board_late_init(void)
        pmic_reg_write(p, REG_POWER_CTL0, val | COINCHEN);
        pmic_reg_write(p, REG_INT_STATUS1, RTCRSTI);
 #ifdef CONFIG_HW_WATCHDOG
-       mxc_hw_watchdog_enable();
+       hw_watchdog_init();
 #endif
        return 0;
 }
index 75bb95861968668fde102df20f6a9adfbd6c3716..da8b6f3a4e238b100d9a2418161e5ef18004d26e 100644 (file)
        orr r1, r1, #0x00000C00
        orr r1, r1, #0x00000003
        str r1, [r0, #CLKCTL_CGR1]
+
+       ldr r1, [r0, #CLKCTL_CGR2]
+       orr r1, r1, #0x00C00000
+       str r1, [r0, #CLKCTL_CGR2]
 .endm
 
 .macro setup_sdram
index c835b0edeb573aba1d5cffb39831157dce4bea5e..b7f474e5ef49a8c6a27e37e7323df0c2a8691b96 100644 (file)
@@ -98,6 +98,26 @@ static void setup_iomux_spi(void)
        mxc_request_iomux(MX35_PIN_CSPI1_SCLK, MUX_CONFIG_SION);
 }
 
+static void setup_iomux_usbotg(void)
+{
+       int in_pad, out_pad;
+
+       /* Set up pins for USBOTG. */
+       mxc_request_iomux(MX35_PIN_USBOTG_PWR,
+                         MUX_CONFIG_SION | MUX_CONFIG_FUNC);
+       mxc_request_iomux(MX35_PIN_USBOTG_OC,
+                         MUX_CONFIG_SION | MUX_CONFIG_FUNC);
+
+       in_pad = PAD_CTL_DRV_3_3V | PAD_CTL_HYS_SCHMITZ | PAD_CTL_PKE_ENABLE |
+               PAD_CTL_PUE_PUD | PAD_CTL_100K_PD | PAD_CTL_ODE_CMOS |
+               PAD_CTL_DRV_NORMAL | PAD_CTL_SRE_SLOW;
+       out_pad = PAD_CTL_DRV_3_3V | PAD_CTL_HYS_CMOS | PAD_CTL_PKE_NONE |
+               PAD_CTL_ODE_CMOS | PAD_CTL_DRV_NORMAL | PAD_CTL_SRE_SLOW;
+
+       mxc_iomux_set_pad(MX35_PIN_USBOTG_PWR, out_pad);
+       mxc_iomux_set_pad(MX35_PIN_USBOTG_OC, in_pad);
+}
+
 static void setup_iomux_fec(void)
 {
        int pad;
@@ -189,6 +209,7 @@ int board_early_init_f(void)
        __raw_writel(readl(&ccm->rcsr) | MXC_CCM_RCSR_NFC_FMS, &ccm->rcsr);
 
        setup_iomux_i2c();
+       setup_iomux_usbotg();
        setup_iomux_fec();
        setup_iomux_spi();
 
@@ -253,7 +274,7 @@ int board_late_init(void)
                mxc_request_iomux(MX35_PIN_COMPARE, MUX_CONFIG_GPIO);
                mxc_iomux_set_input(MUX_IN_GPIO1_IN_5, INPUT_CTL_PATH0);
 
-               gpio_direction_output(37, 1);
+               gpio_direction_output(IMX_GPIO_NR(2, 5), 1);
        }
 
        val = mc9sdz60_reg_read(MC9SDZ60_REG_GPIO_1) | 0x04;
index d1ef431895a0786f72eb4ae42413202ee9200e97..54c16b1f9d36eb1791a781fdaf91169dbbff0bf3 100644 (file)
@@ -489,8 +489,6 @@ int board_init(void)
        /* address of boot parameters */
        gd->bd->bi_boot_params = PHYS_SDRAM_1 + 0x100;
 
-       lcd_enable();
-
        return 0;
 }
 
index f036cf73b2e4bc5360a90a8b189ca0624d6fa2ac..7be5c9befc377095b25c6390361419231d235528 100644 (file)
@@ -48,6 +48,22 @@ static struct fb_videomode const claa_wvga = {
        .vmode          = FB_VMODE_NONINTERLACED
 };
 
+static struct fb_videomode const dvi = {
+       .name           = "DVI panel",
+       .refresh        = 60,
+       .xres           = 1024,
+       .yres           = 768,
+       .pixclock       = 15385,
+       .left_margin    = 220,
+       .right_margin   = 40,
+       .upper_margin   = 21,
+       .lower_margin   = 7,
+       .hsync_len      = 60,
+       .vsync_len      = 10,
+       .sync           = 0,
+       .vmode          = FB_VMODE_NONINTERLACED
+};
+
 void setup_iomux_lcd(void)
 {
        /* DI2_PIN15 */
@@ -73,9 +89,26 @@ void setup_iomux_lcd(void)
        gpio_direction_output(MX51EVK_LCD_BACKLIGHT, 1);
 }
 
-void lcd_enable(void)
+int board_video_skip(void)
 {
-       int ret = ipuv3_fb_init(&claa_wvga, 1, IPU_PIX_FMT_RGB565);
+       int ret;
+       char const *e = getenv("panel");
+
+       if (e) {
+               if (strcmp(e, "claa") == 0) {
+                       ret = ipuv3_fb_init(&claa_wvga, 1, IPU_PIX_FMT_RGB565);
+                       if (ret)
+                               printf("claa cannot be configured: %d\n", ret);
+                       return ret;
+               }
+       }
+
+       /*
+        * 'panel' env variable not found or has different value than 'claa'
+        *  Defaulting to dvi output.
+        */
+       ret = ipuv3_fb_init(&dvi, 0, IPU_PIX_FMT_RGB24);
        if (ret)
-               printf("LCD cannot be configured: %d\n", ret);
+               printf("dvi cannot be configured: %d\n", ret);
+       return ret;
 }
index 81c511cdc187fd22cd4887dd2e0a0e79a88d819d..8f39c383f111111f83d6935b410d2893d83aadaa 100644 (file)
@@ -343,14 +343,13 @@ static void setup_iomux_i2c(void)
 static int power_init(void)
 {
        unsigned int val;
-       int ret = -1;
+       int ret;
        struct pmic *p;
-       int retval;
 
        if (!i2c_probe(CONFIG_SYS_DIALOG_PMIC_I2C_ADDR)) {
-               retval = pmic_dialog_init(I2C_PMIC);
-               if (retval)
-                       return retval;
+               ret = pmic_dialog_init(I2C_PMIC);
+               if (ret)
+                       return ret;
 
                p = pmic_get("DIALOG_PMIC");
                if (!p)
@@ -359,22 +358,41 @@ static int power_init(void)
                /* Set VDDA to 1.25V */
                val = DA9052_BUCKCORE_BCOREEN | DA_BUCKCORE_VBCORE_1_250V;
                ret = pmic_reg_write(p, DA9053_BUCKCORE_REG, val);
+               if (ret) {
+                       printf("Writing to BUCKCORE_REG failed: %d\n", ret);
+                       return ret;
+               }
 
-               ret |= pmic_reg_read(p, DA9053_SUPPLY_REG, &val);
+               pmic_reg_read(p, DA9053_SUPPLY_REG, &val);
                val |= DA9052_SUPPLY_VBCOREGO;
-               ret |= pmic_reg_write(p, DA9053_SUPPLY_REG, val);
+               ret = pmic_reg_write(p, DA9053_SUPPLY_REG, val);
+               if (ret) {
+                       printf("Writing to SUPPLY_REG failed: %d\n", ret);
+                       return ret;
+               }
 
                /* Set Vcc peripheral to 1.30V */
-               ret |= pmic_reg_write(p, DA9053_BUCKPRO_REG, 0x62);
-               ret |= pmic_reg_write(p, DA9053_SUPPLY_REG, 0x62);
+               ret = pmic_reg_write(p, DA9053_BUCKPRO_REG, 0x62);
+               if (ret) {
+                       printf("Writing to BUCKPRO_REG failed: %d\n", ret);
+                       return ret;
+               }
+
+               ret = pmic_reg_write(p, DA9053_SUPPLY_REG, 0x62);
+               if (ret) {
+                       printf("Writing to SUPPLY_REG failed: %d\n", ret);
+                       return ret;
+               }
+
+               return ret;
        }
 
        if (!i2c_probe(CONFIG_SYS_FSL_PMIC_I2C_ADDR)) {
-               retval = pmic_init(I2C_PMIC);
-               if (retval)
-                       return retval;
+               ret = pmic_init(I2C_PMIC);
+               if (ret)
+                       return ret;
 
-               p = pmic_get("DIALOG_PMIC");
+               p = pmic_get("FSL_PMIC");
                if (!p)
                        return -ENODEV;
 
@@ -382,28 +400,50 @@ static int power_init(void)
                pmic_reg_read(p, REG_SW_0, &val);
                val = (val & ~SWx_VOLT_MASK_MC34708) | SWx_1_250V_MC34708;
                ret = pmic_reg_write(p, REG_SW_0, val);
+               if (ret) {
+                       printf("Writing to REG_SW_0 failed: %d\n", ret);
+                       return ret;
+               }
 
                /* Set VCC as 1.30V on SW2 */
                pmic_reg_read(p, REG_SW_1, &val);
                val = (val & ~SWx_VOLT_MASK_MC34708) | SWx_1_300V_MC34708;
-               ret |= pmic_reg_write(p, REG_SW_1, val);
+               ret = pmic_reg_write(p, REG_SW_1, val);
+               if (ret) {
+                       printf("Writing to REG_SW_1 failed: %d\n", ret);
+                       return ret;
+               }
 
                /* Set global reset timer to 4s */
                pmic_reg_read(p, REG_POWER_CTL2, &val);
                val = (val & ~TIMER_MASK_MC34708) | TIMER_4S_MC34708;
-               ret |= pmic_reg_write(p, REG_POWER_CTL2, val);
+               ret = pmic_reg_write(p, REG_POWER_CTL2, val);
+               if (ret) {
+                       printf("Writing to REG_POWER_CTL2 failed: %d\n", ret);
+                       return ret;
+               }
 
                /* Set VUSBSEL and VUSBEN for USB PHY supply*/
                pmic_reg_read(p, REG_MODE_0, &val);
                val |= (VUSBSEL_MC34708 | VUSBEN_MC34708);
-               ret |= pmic_reg_write(p, REG_MODE_0, val);
+               ret = pmic_reg_write(p, REG_MODE_0, val);
+               if (ret) {
+                       printf("Writing to REG_MODE_0 failed: %d\n", ret);
+                       return ret;
+               }
 
                /* Set SWBST to 5V in auto mode */
                val = SWBST_AUTO;
-               ret |= pmic_reg_write(p, SWBST_CTRL, val);
+               ret = pmic_reg_write(p, SWBST_CTRL, val);
+               if (ret) {
+                       printf("Writing to SWBST_CTRL failed: %d\n", ret);
+                       return ret;
+               }
+
+               return ret;
        }
 
-       return ret;
+       return -1;
 }
 
 static void clock_1GHz(void)
@@ -462,12 +502,16 @@ int board_init(void)
 
        mxc_set_sata_internal_clock();
        setup_iomux_i2c();
+
+       return 0;
+}
+
+int board_late_init(void)
+{
        if (!power_init())
                clock_1GHz();
        print_cpuinfo();
 
-       lcd_enable();
-
        return 0;
 }
 
index 69991e85116ad26db13ff4c927888ae7f023f0e3..a4d5a6a3650dca0561cc7a39ad6a25fa53a0ec28 100644 (file)
@@ -46,6 +46,21 @@ static struct fb_videomode const claa_wvga = {
        .vmode          = FB_VMODE_NONINTERLACED
 };
 
+static struct fb_videomode const seiko_wvga = {
+       .name           = "Seiko-43WVF1G",
+       .refresh        = 60,
+       .xres           = 800,
+       .yres           = 480,
+       .pixclock       = 29851, /* picosecond (33.5 MHz) */
+       .left_margin    = 89,
+       .right_margin   = 164,
+       .upper_margin   = 23,
+       .lower_margin   = 10,
+       .hsync_len      = 10,
+       .vsync_len      = 10,
+       .sync           = 0,
+};
+
 void setup_iomux_lcd(void)
 {
        mxc_request_iomux(MX53_PIN_DI0_DISP_CLK, IOMUX_CONFIG_ALT0);
@@ -86,9 +101,26 @@ void setup_iomux_lcd(void)
        gpio_direction_output(IOMUX_TO_GPIO(MX53_PIN_GPIO_1), 1);
 }
 
-void lcd_enable(void)
+int board_video_skip(void)
 {
-       int ret = ipuv3_fb_init(&claa_wvga, 0, IPU_PIX_FMT_RGB565);
+       int ret;
+       char const *e = getenv("panel");
+
+       if (e) {
+               if (strcmp(e, "seiko") == 0) {
+                       ret = ipuv3_fb_init(&seiko_wvga, 0, IPU_PIX_FMT_RGB24);
+                       if (ret)
+                               printf("Seiko cannot be configured: %d\n", ret);
+                       return ret;
+               }
+       }
+
+       /*
+        * 'panel' env variable not found or has different value than 'seiko'
+        *  Defaulting to claa lcd.
+        */
+       ret = ipuv3_fb_init(&claa_wvga, 0, IPU_PIX_FMT_RGB565);
        if (ret)
-               printf("LCD cannot be configured: %d\n", ret);
+               printf("CLAA cannot be configured: %d\n", ret);
+       return ret;
 }
index 0240fb54792bb259ad3bbc95aac6574f8dcd9e27..65c4a1a4f3cd4b67579a6cc2348a796a96bb0d51 100644 (file)
@@ -86,6 +86,20 @@ static void setup_iomux_enet(void)
        gpio_set_value(IMX_GPIO_NR(1, 25), 1);
 }
 
+iomux_v3_cfg_t const usdhc2_pads[] = {
+       MX6Q_PAD_SD2_CLK__USDHC2_CLK    | MUX_PAD_CTRL(USDHC_PAD_CTRL),
+       MX6Q_PAD_SD2_CMD__USDHC2_CMD    | MUX_PAD_CTRL(USDHC_PAD_CTRL),
+       MX6Q_PAD_SD2_DAT0__USDHC2_DAT0  | MUX_PAD_CTRL(USDHC_PAD_CTRL),
+       MX6Q_PAD_SD2_DAT1__USDHC2_DAT1  | MUX_PAD_CTRL(USDHC_PAD_CTRL),
+       MX6Q_PAD_SD2_DAT2__USDHC2_DAT2  | MUX_PAD_CTRL(USDHC_PAD_CTRL),
+       MX6Q_PAD_SD2_DAT3__USDHC2_DAT3  | MUX_PAD_CTRL(USDHC_PAD_CTRL),
+       MX6Q_PAD_NANDF_D4__USDHC2_DAT4  | MUX_PAD_CTRL(USDHC_PAD_CTRL),
+       MX6Q_PAD_NANDF_D5__USDHC2_DAT5  | MUX_PAD_CTRL(USDHC_PAD_CTRL),
+       MX6Q_PAD_NANDF_D6__USDHC2_DAT6  | MUX_PAD_CTRL(USDHC_PAD_CTRL),
+       MX6Q_PAD_NANDF_D7__USDHC2_DAT7  | MUX_PAD_CTRL(USDHC_PAD_CTRL),
+       MX6Q_PAD_NANDF_D2__GPIO_2_2     | MUX_PAD_CTRL(NO_PAD_CTRL), /* CD */
+};
+
 iomux_v3_cfg_t const usdhc3_pads[] = {
        MX6Q_PAD_SD3_CLK__USDHC3_CLK   | MUX_PAD_CTRL(USDHC_PAD_CTRL),
        MX6Q_PAD_SD3_CMD__USDHC3_CMD   | MUX_PAD_CTRL(USDHC_PAD_CTRL),
@@ -100,28 +114,82 @@ iomux_v3_cfg_t const usdhc3_pads[] = {
        MX6Q_PAD_NANDF_D0__GPIO_2_0    | MUX_PAD_CTRL(NO_PAD_CTRL), /* CD */
 };
 
+iomux_v3_cfg_t const usdhc4_pads[] = {
+       MX6Q_PAD_SD4_CLK__USDHC4_CLK   | MUX_PAD_CTRL(USDHC_PAD_CTRL),
+       MX6Q_PAD_SD4_CMD__USDHC4_CMD   | MUX_PAD_CTRL(USDHC_PAD_CTRL),
+       MX6Q_PAD_SD4_DAT0__USDHC4_DAT0 | MUX_PAD_CTRL(USDHC_PAD_CTRL),
+       MX6Q_PAD_SD4_DAT1__USDHC4_DAT1 | MUX_PAD_CTRL(USDHC_PAD_CTRL),
+       MX6Q_PAD_SD4_DAT2__USDHC4_DAT2 | MUX_PAD_CTRL(USDHC_PAD_CTRL),
+       MX6Q_PAD_SD4_DAT3__USDHC4_DAT3 | MUX_PAD_CTRL(USDHC_PAD_CTRL),
+       MX6Q_PAD_SD4_DAT4__USDHC4_DAT4 | MUX_PAD_CTRL(USDHC_PAD_CTRL),
+       MX6Q_PAD_SD4_DAT5__USDHC4_DAT5 | MUX_PAD_CTRL(USDHC_PAD_CTRL),
+       MX6Q_PAD_SD4_DAT6__USDHC4_DAT6 | MUX_PAD_CTRL(USDHC_PAD_CTRL),
+       MX6Q_PAD_SD4_DAT7__USDHC4_DAT7 | MUX_PAD_CTRL(USDHC_PAD_CTRL),
+};
+
 static void setup_iomux_uart(void)
 {
        imx_iomux_v3_setup_multiple_pads(uart1_pads, ARRAY_SIZE(uart1_pads));
 }
 
 #ifdef CONFIG_FSL_ESDHC
-struct fsl_esdhc_cfg usdhc_cfg[1] = {
+struct fsl_esdhc_cfg usdhc_cfg[3] = {
+       {USDHC2_BASE_ADDR},
        {USDHC3_BASE_ADDR},
+       {USDHC4_BASE_ADDR},
 };
 
+#define USDHC2_CD_GPIO IMX_GPIO_NR(2, 2)
+#define USDHC3_CD_GPIO IMX_GPIO_NR(2, 0)
+
 int board_mmc_getcd(struct mmc *mmc)
 {
-       gpio_direction_input(IMX_GPIO_NR(2, 0));
-       return !gpio_get_value(IMX_GPIO_NR(2, 0));
+       struct fsl_esdhc_cfg *cfg = (struct fsl_esdhc_cfg *)mmc->priv;
+
+       switch (cfg->esdhc_base) {
+       case USDHC2_BASE_ADDR:
+               return !gpio_get_value(USDHC2_CD_GPIO);
+       case USDHC3_BASE_ADDR:
+               return !gpio_get_value(USDHC3_CD_GPIO);
+       default:
+               return 1; /* eMMC/uSDHC4 is always present */
+       }
 }
 
 int board_mmc_init(bd_t *bis)
 {
-       imx_iomux_v3_setup_multiple_pads(usdhc3_pads, ARRAY_SIZE(usdhc3_pads));
+       int i;
+
+       for (i = 0; i < CONFIG_SYS_FSL_USDHC_NUM; i++) {
+               switch (i) {
+               case 0:
+                       imx_iomux_v3_setup_multiple_pads(
+                               usdhc2_pads, ARRAY_SIZE(usdhc2_pads));
+                       gpio_direction_input(USDHC2_CD_GPIO);
+                       usdhc_cfg[0].sdhc_clk = mxc_get_clock(MXC_ESDHC2_CLK);
+                       break;
+               case 1:
+                       imx_iomux_v3_setup_multiple_pads(
+                               usdhc3_pads, ARRAY_SIZE(usdhc3_pads));
+                       gpio_direction_input(USDHC3_CD_GPIO);
+                       usdhc_cfg[1].sdhc_clk = mxc_get_clock(MXC_ESDHC3_CLK);
+                       break;
+               case 2:
+                       imx_iomux_v3_setup_multiple_pads(
+                               usdhc4_pads, ARRAY_SIZE(usdhc4_pads));
+                       usdhc_cfg[2].sdhc_clk = mxc_get_clock(MXC_ESDHC4_CLK);
+                       break;
+               default:
+                       printf("Warning: you configured more USDHC controllers"
+                               "(%d) than supported by the board\n", i + 1);
+                       return 0;
+              }
+
+              if (fsl_esdhc_initialize(bis, &usdhc_cfg[i]))
+                       printf("Warning: failed to initialize mmc dev %d\n", i);
+       }
 
-       usdhc_cfg[0].sdhc_clk = mxc_get_clock(MXC_ESDHC3_CLK);
-       return fsl_esdhc_initialize(bis, &usdhc_cfg[0]);
+       return 0;
 }
 #endif
 
index 30763061c724bfa701add15fafee34419242b819..720b06e4ce8f91c4e820af304cdd1f04faecb384 100644 (file)
 #include <asm/arch/pxa.h>
 #include <asm/arch/pxa-regs.h>
 #include <asm/io.h>
+#include <usb.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
+int board_eth_init(bd_t *bis)
+{
+       usb_eth_initialize(bis);
+       return 0;
+}
+
 int board_init(void)
 {
        /* We have RAM, disable cache */
@@ -36,6 +43,10 @@ int board_init(void)
        /* adress of boot parameters */
        gd->bd->bi_boot_params = 0xa0000100;
 
+       /* Let host see that device is disconnected */
+       udc_disconnect();
+       mdelay(500);
+
        return 0;
 }
 
index 0c2cb795dd66448bb44e64fce3703609acaef16d..b4b8209317e4c056301e624d58a71c09c7a4545e 100644 (file)
@@ -179,7 +179,7 @@ int board_init(void)
 int board_late_init(void)
 {
 #ifdef CONFIG_HW_WATCHDOG
-       mxc_hw_watchdog_enable();
+       hw_watchdog_init();
 #endif
 
        return 0;
index 8cfb4e6620dade4577bca5c1e02d3944d3d3fc65..c54c95d28886bb702afca0419e33d7932dc0af79 100644 (file)
@@ -41,7 +41,7 @@ int board_early_init_f(void)
                        ICONNECT_OE_LOW, ICONNECT_OE_HIGH);
 
        /* Multi-Purpose Pins Functionality configuration */
-       u32 kwmpp_config[] = {
+       static const u32 kwmpp_config[] = {
                MPP0_NF_IO2,
                MPP1_NF_IO3,
                MPP2_NF_IO4,
index a8257a3005fab8d93d0b373afd15e64954d23ccb..a0f2aa3e4e2ad89e41de4cf52a0dca325662a708 100644 (file)
@@ -72,27 +72,26 @@ void omap_rev_string(void)
  * Description: If we use SPL then there is no x-loader nor config header
  * so we have to setup the DDR timings ourself on both banks.
  */
-void get_board_mem_timings(u32 *mcfg, u32 *ctrla, u32 *ctrlb, u32 *rfr_ctrl,
-               u32 *mr)
+void get_board_mem_timings(struct board_sdrc_timings *timings)
 {
-       *mr = MICRON_V_MR_165;
+       timings->mr = MICRON_V_MR_165;
 #ifdef CONFIG_BOOT_NAND
-       *mcfg = MICRON_V_MCFG_200(256 << 20);
-       *ctrla = MICRON_V_ACTIMA_200;
-       *ctrlb = MICRON_V_ACTIMB_200;
-       *rfr_ctrl = SDP_3430_SDRC_RFR_CTRL_200MHz;
+       timings->mcfg = MICRON_V_MCFG_200(256 << 20);
+       timings->ctrla = MICRON_V_ACTIMA_200;
+       timings->ctrlb = MICRON_V_ACTIMB_200;
+       timings->rfr_ctrl = SDP_3430_SDRC_RFR_CTRL_200MHz;
 #else
        if (get_cpu_family() == CPU_OMAP34XX) {
-               *mcfg = NUMONYX_V_MCFG_165(256 << 20);
-               *ctrla = NUMONYX_V_ACTIMA_165;
-               *ctrlb = NUMONYX_V_ACTIMB_165;
-               *rfr_ctrl = SDP_3430_SDRC_RFR_CTRL_165MHz;
+               timings->mcfg = NUMONYX_V_MCFG_165(256 << 20);
+               timings->ctrla = NUMONYX_V_ACTIMA_165;
+               timings->ctrlb = NUMONYX_V_ACTIMB_165;
+               timings->rfr_ctrl = SDP_3430_SDRC_RFR_CTRL_165MHz;
 
        } else {
-               *mcfg = NUMONYX_V_MCFG_200(256 << 20);
-               *ctrla = NUMONYX_V_ACTIMA_200;
-               *ctrlb = NUMONYX_V_ACTIMB_200;
-               *rfr_ctrl = SDP_3430_SDRC_RFR_CTRL_200MHz;
+               timings->mcfg = NUMONYX_V_MCFG_200(256 << 20);
+               timings->ctrla = NUMONYX_V_ACTIMA_200;
+               timings->ctrlb = NUMONYX_V_ACTIMB_200;
+               timings->rfr_ctrl = SDP_3430_SDRC_RFR_CTRL_200MHz;
        }
 #endif
 }
index 107cb7f8e0581d0f8c7c5487773e6873eec70cfe..a41e752b8206da9c38b1c3e879ca3d08d597bd3d 100644 (file)
@@ -59,27 +59,26 @@ void omap_rev_string(void)
  * Description: If we use SPL then there is no x-loader nor config header
  * so we have to setup the DDR timings ourself on both banks.
  */
-void get_board_mem_timings(u32 *mcfg, u32 *ctrla, u32 *ctrlb, u32 *rfr_ctrl,
-                          u32 *mr)
+void get_board_mem_timings(struct board_sdrc_timings *timings)
 {
-       *mr = MICRON_V_MR_165;
+       timings->mr = MICRON_V_MR_165;
 #ifdef CONFIG_BOOT_NAND
-       *mcfg = MICRON_V_MCFG_200(256 << 20);
-       *ctrla = MICRON_V_ACTIMA_200;
-       *ctrlb = MICRON_V_ACTIMB_200;
-       *rfr_ctrl = SDP_3430_SDRC_RFR_CTRL_200MHz;
+       timings->mcfg = MICRON_V_MCFG_200(256 << 20);
+       timings->ctrla = MICRON_V_ACTIMA_200;
+       timings->ctrlb = MICRON_V_ACTIMB_200;
+       timings->rfr_ctrl = SDP_3430_SDRC_RFR_CTRL_200MHz;
 #else
        if (get_cpu_family() == CPU_OMAP34XX) {
-               *mcfg = NUMONYX_V_MCFG_165(256 << 20);
-               *ctrla = NUMONYX_V_ACTIMA_165;
-               *ctrlb = NUMONYX_V_ACTIMB_165;
-               *rfr_ctrl = SDP_3430_SDRC_RFR_CTRL_165MHz;
+               timings->mcfg = NUMONYX_V_MCFG_165(256 << 20);
+               timings->ctrla = NUMONYX_V_ACTIMA_165;
+               timings->ctrlb = NUMONYX_V_ACTIMB_165;
+               timings->rfr_ctrl = SDP_3430_SDRC_RFR_CTRL_165MHz;
 
        } else {
-               *mcfg = NUMONYX_V_MCFG_200(256 << 20);
-               *ctrla = NUMONYX_V_ACTIMA_200;
-               *ctrlb = NUMONYX_V_ACTIMB_200;
-               *rfr_ctrl = SDP_3430_SDRC_RFR_CTRL_200MHz;
+               timings->mcfg = NUMONYX_V_MCFG_200(256 << 20);
+               timings->ctrla = NUMONYX_V_ACTIMA_200;
+               timings->ctrlb = NUMONYX_V_ACTIMB_200;
+               timings->rfr_ctrl = SDP_3430_SDRC_RFR_CTRL_200MHz;
        }
 #endif
 }
index 96410d77d60ae5c195752418f102ced0a5ec2f0f..7a4e7b3286a207aca0fa4339b6ea60a90a1c4461 100644 (file)
@@ -47,7 +47,7 @@ int board_early_init_f(void)
                        TK71_OE_LOW, TK71_OE_HIGH);
 
        /* Multi-Purpose Pins Functionality configuration */
-       u32 kwmpp_config[] = {
+       static const u32 kwmpp_config[] = {
                MPP0_NF_IO2,
                MPP1_NF_IO3,
                MPP2_NF_IO4,
index a90f1124fbee8444c0380658f6f1b08e4070f320..6f407b78f259f35805f6a78f1159550530483561 100644 (file)
@@ -121,7 +121,7 @@ int i2c_make_abort(void)
 {
 
 #if defined(CONFIG_HARD_I2C) && !defined(MACH_TYPE_KM_KIRKWOOD)
-       immap_t *immap = (immap_t *)CONFIG_SYS_IMMR ;
+       immap_t *immap = (immap_t *)CONFIG_SYS_IMMR;
        i2c8260_t *i2c  = (i2c8260_t *)&immap->im_i2c;
 
        /*
index 0c4dddc617328f7ba5a4999bd3828c2c1025129a..eda9199bbe9f499e9c49301709007fd68708cbc1 100644 (file)
@@ -54,7 +54,7 @@ DECLARE_GLOBAL_DATA_PTR;
 #define MASK_RBI_DEFECT_16     0x01
 
 /* Multi-Purpose Pins Functionality configuration */
-u32 kwmpp_config[] = {
+static const u32 kwmpp_config[] = {
        MPP0_NF_IO2,
        MPP1_NF_IO3,
        MPP2_NF_IO4,
@@ -193,15 +193,6 @@ void set_bootcount_addr(void)
 
 int misc_init_r(void)
 {
-       char *str;
-       int mach_type;
-
-       str = getenv("mach_type");
-       if (str != NULL) {
-               mach_type = simple_strtoul(str, NULL, 10);
-               printf("Overwriting MACH_TYPE with %d!!!\n", mach_type);
-               gd->bd->bi_arch_number = mach_type;
-       }
 #if defined(CONFIG_KM_MGCOGE3UN)
        char *wait_for_ne;
        wait_for_ne = getenv("waitforne");
@@ -258,11 +249,6 @@ int board_early_init_f(void)
 
 int board_init(void)
 {
-       /*
-        * arch number of board
-        */
-       gd->bd->bi_arch_number = MACH_TYPE_KM_KIRKWOOD;
-
        /* address of boot parameters */
        gd->bd->bi_boot_params = kw_sdram_bar(0) + 0x100;
 
index 6df2ad79029d8971cb9babae28448809e20d8f02..5aa0de2528d152db61b843669c8a4232e71a30b2 100644 (file)
@@ -55,9 +55,9 @@ DATA 0xFFD10008 0x00001100    # MPP Control 2 Register
 DATA 0xFFD100E0 0x1B1B1B1B     # IO Configuration 0 Register
 DATA 0xFFD20134 0x66666666     # L2 RAM Timing 0 Register
 DATA 0xFFD20138 0x66666666     # L2 RAM Timing 1 Register
-DATA 0xFFD20154 0x00000200     # CPU RAM Management Control3 Register
-DATA 0xFFD2014C 0x00001C00     # CPU RAM Management Control1 Register
-DATA 0xFFD20148 0x00000001     # CPU RAM Management Control0 Register
+
+# NOTE: Don't write on 0x20148 , 0x2014c and 0x20154, leave them untouched!
+# If not it could cause KW Exceptions during boot in Fast Corners/High Voltage
 
 #Dram initalization
 DATA 0xFFD01400 0x430004E0     # SDRAM Configuration Register
index b2f51936f4debff917a3c2c4f843c6b4a0fbb00f..e5e9942c1aa11ae76d8915fb8e5ac8fc88244885 100644 (file)
@@ -52,9 +52,9 @@ DATA 0xFFD10008 0x00001100    # MPP Control 2 Register
 DATA 0xFFD100E0 0x1B1B1B1B     # IO Configuration 0 Register
 DATA 0xFFD20134 0x66666666     # L2 RAM Timing 0 Register
 DATA 0xFFD20138 0x66666666     # L2 RAM Timing 1 Register
-DATA 0xFFD20154 0x00000200     # CPU RAM Management Control3 Register
-DATA 0xFFD2014C 0x00001C00     # CPU RAM Management Control1 Register
-DATA 0xFFD20148 0x00000001     # CPU RAM Management Control0 Register
+
+# NOTE: Don't write on 0x20148 , 0x2014c and 0x20154, leave them untouched!
+# If not it could cause KW Exceptions during boot in Fast Corners/High Voltage
 
 #Dram initalization
 DATA 0xFFD01400 0x43000400     # SDRAM Configuration Register
index bcce9073f6f8f8490287649ee1dd1dfda55d98a5..5de8df70fd6607403bd1c21512b9fe0815c98723 100644 (file)
@@ -98,29 +98,8 @@ DATA 0xFFD20138 0x66666666   # L2 RAM Timing 1 Register
 # bit 19-18: 1, ECC RAM WTC RAM0
 # bit 31-20: ???,Reserve
 
-DATA 0xFFD20154 0x00000200     # CPU RAM Management Control3 Register
-# bit 23-0:  0x000200, Addr Config tuning
-# bit 31-24: 0,        Reserved
-
-# ??? Missing register # CPU RAM Management Control2 Register
-
-DATA 0xFFD2014C 0x00001C00     # CPU RAM Management Control1 Register
-# bit 15-0:  0x1C00, Opmux Tuning
-# bit 31-16: 0,      Pc Dp Tuning
-
-DATA 0xFFD20148 0x00000001     # CPU RAM Management Control0 Register
-# bit 1-0:   1, addr clk tune
-# bit 3-2:   0, reserved
-# bit 5-4:   0, dtcmp clk tune
-# bit 7-6:   0, reserved
-# bit 9-8:   0, macdrv clk tune
-# bit 11-10: 0, opmuxgm2 clk tune
-# bit 15-14: 0, rf clk tune
-# bit 17-16: 0, rfbypass clk tune
-# bit 19-18: 0, pc dp clk tune
-# bit 23-20: 0, icache clk tune
-# bit 27:24: 0, dcache clk tune
-# bit 31:28: 0, regfile tunin
+# NOTE: Don't write on 0x20148 , 0x2014c and 0x20154, leave them untouched!
+# If not it could cause KW Exceptions during boot in Fast Corners/High Voltage
 
 # SDRAM initalization
 DATA 0xFFD01400 0x430004E0     # SDRAM Configuration Register
index 3e1237bbe31b1d2f7f67cbf5ff2c4cbce7c56393..d0a09f61d2d963df49e911c9cd69fa38b951c1d3 100644 (file)
@@ -100,29 +100,8 @@ DATA 0xFFD20138 0x66666666 # L2 RAM Timing 1 Register
 # bit 19-18: 1, ECC RAM WTC RAM0
 # bit 31-20: ?,Reserved
 
-DATA 0xFFD20154 0x00000200     # CPU RAM Management Control3 Register
-# bit 23-0:  0x000200, Addr Config tuning
-# bit 31-24: 0,        Reserved
-
-# ??? Missing register # CPU RAM Management Control2 Register
-
-DATA 0xFFD2014C 0x00001C00     # CPU RAM Management Control1 Register
-# bit 15-0:  0x1C00, Opmux Tuning
-# bit 31-16: 0,      Pc Dp Tuning
-
-DATA 0xFFD20148 0x00000001     # CPU RAM Management Control0 Register
-# bit 1-0:   1, addr clk tune
-# bit 3-2:   0, reserved
-# bit 5-4:   0, dtcmp clk tune
-# bit 7-6:   0, reserved
-# bit 9-8:   0, macdrv clk tune
-# bit 11-10: 0, opmuxgm2 clk tune
-# bit 15-14: 0, rf clk tune
-# bit 17-16: 0, rfbypass clk tune
-# bit 19-18: 0, pc dp clk tune
-# bit 23-20: 0, icache clk tune
-# bit 27:24: 0, dcache clk tune
-# bit 31:28: 0, regfile tunin
+# NOTE: Don't write on 0x20148 , 0x2014c and 0x20154, leave them untouched!
+# If not it could cause KW Exceptions during boot in Fast Corners/High Voltage
 
 # SDRAM initalization
 DATA 0xFFD01400 0x430004E0     # SDRAM Configuration Register
index 2c7cd0d401f790d0cba72ed32c89e37891e30ffd..76ec6876e21b51d4ea4da512109c2fc76215cfc1 100644 (file)
 #include <linux/compiler.h>
 #include <asm/io.h>
 #include <asm/arch/clock.h>
+#include <asm/arch/display.h>
 #include <asm/arch/emc.h>
 #include <asm/arch/funcmux.h>
 #include <asm/arch/pinmux.h>
 #include <asm/arch/pmu.h>
+#include <asm/arch/pwm.h>
 #include <asm/arch/tegra.h>
 #include <asm/arch/usb.h>
 #include <asm/arch-tegra/board.h>
@@ -118,6 +120,13 @@ int board_init(void)
 #ifdef CONFIG_TEGRA_SPI
        pin_mux_spi();
        spi_init();
+#endif
+#ifdef CONFIG_PWM_TEGRA
+       if (pwm_init(gd->fdt_blob))
+               debug("%s: Failed to init pwm\n", __func__);
+#endif
+#ifdef CONFIG_LCD
+       tegra_lcd_check_next_stage(gd->fdt_blob, 0);
 #endif
        /* boot param addr */
        gd->bd->bi_boot_params = (NV_PA_SDRAM_BASE + 0x100);
@@ -144,6 +153,9 @@ int board_init(void)
        pin_mux_usb();
        board_usb_init(gd->fdt_blob);
 #endif
+#ifdef CONFIG_LCD
+       tegra_lcd_check_next_stage(gd->fdt_blob, 0);
+#endif
 
 #ifdef CONFIG_TEGRA_NAND
        pin_mux_nand();
@@ -174,7 +186,19 @@ int board_early_init_f(void)
        /* Initialize periph GPIOs */
        gpio_early_init();
        gpio_early_init_uart();
+#ifdef CONFIG_LCD
+       tegra_lcd_early_init(gd->fdt_blob);
+#endif
 
        return 0;
 }
 #endif /* EARLY_INIT */
+
+int board_late_init(void)
+{
+#ifdef CONFIG_LCD
+       /* Make sure we finish initing the LCD */
+       tegra_lcd_check_next_stage(gd->fdt_blob, 1);
+#endif
+       return 0;
+}
index 25a63a05d0ca3439d505a616926da39973753942..dd98ca48e9f26bcb54e0ba49cf43f4544534745b 100644 (file)
                        compatible = "hynix,hy27uf4g2b", "nand-flash";
                };
        };
+
+       host1x {
+               status = "okay";
+               dc@54200000 {
+                       status = "okay";
+                       rgb {
+                               status = "okay";
+                               nvidia,panel = <&lcd_panel>;
+                       };
+               };
+       };
+
+       lcd_panel: panel {
+               /* Seaboard has 1366x768 */
+               clock = <70600000>;
+               xres = <1366>;
+               yres = <768>;
+               left-margin = <58>;
+               right-margin = <58>;
+               hsync-len = <58>;
+               lower-margin = <4>;
+               upper-margin = <4>;
+               vsync-len = <4>;
+               hsync-active-high;
+               nvidia,bits-per-pixel = <16>;
+               nvidia,pwm = <&pwm 2 0>;
+               nvidia,backlight-enable-gpios = <&gpio 28 0>;   /* PD4 */
+               nvidia,lvds-shutdown-gpios = <&gpio 10 0>;      /* PB2 */
+               nvidia,backlight-vdd-gpios = <&gpio 176 0>;     /* PW0 */
+               nvidia,panel-vdd-gpios = <&gpio 22 0>;          /* PC6 */
+               nvidia,panel-timings = <400 4 203 17 15>;
+       };
+
 };
index c7590ac6cff8292e814a412fe04a5a75dd8e91a9..93430edd3bdb489b75bc7f2ad4ba7ed0573655d8 100644 (file)
@@ -64,9 +64,8 @@ int board_mmc_init(bd_t *bd)
        pin_mux_mmc();
 
        debug("board_mmc_init: init SD slot J26\n");
-       /* init dev 0, SD slot J26, with 4-bit bus */
-       /* The board has an 8-bit bus, but 8-bit doesn't work yet */
-       tegra_mmc_init(0, 4, GPIO_PI6, GPIO_PH2);
+       /* init dev 0, SD slot J26, with 8-bit bus */
+       tegra_mmc_init(0, 8, GPIO_PI6, GPIO_PH2);
 
        debug("board_mmc_init: init SD slot J5\n");
        /* init dev 2, SD slot J5, with 4-bit bus */
index c412c077da02f26022d2b4381e3b306b3e5e1bfe..3e33da0afc37976fe8c04e170a78532c4b962e5a 100644 (file)
@@ -71,9 +71,8 @@ int board_mmc_init(bd_t *bd)
        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 */
-       tegra_mmc_init(0, 4, -1, -1);
+       /* init dev 0, eMMC chip, with 8-bit bus */
+       tegra_mmc_init(0, 8, -1, -1);
 
        debug("board_mmc_init: init SD slot\n");
        /* init dev 1, SD slot, with 4-bit bus */
index c6d50a07acabc18296474b5581c5c41026a86c99..fdf46a2aae92101bc2957eab45144f3a6c6571eb 100644 (file)
@@ -147,34 +147,33 @@ int get_board_revision(void)
  * Description: If we use SPL then there is no x-loader nor config header
  * so we have to setup the DDR timings ourself on both banks.
  */
-void get_board_mem_timings(u32 *mcfg, u32 *ctrla, u32 *ctrlb, u32 *rfr_ctrl,
-               u32 *mr)
+void get_board_mem_timings(struct board_sdrc_timings *timings)
 {
-       *mr = MICRON_V_MR_165;
+       timings->mr = MICRON_V_MR_165;
        switch (get_board_revision()) {
        case REVISION_0: /* Micron 1286MB/256MB, 1/2 banks of 128MB */
-               *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;
+               timings->mcfg = MICRON_V_MCFG_165(128 << 20);
+               timings->ctrla = MICRON_V_ACTIMA_165;
+               timings->ctrlb = MICRON_V_ACTIMB_165;
+               timings->rfr_ctrl = SDP_3430_SDRC_RFR_CTRL_165MHz;
                break;
        case REVISION_1: /* Micron 256MB/512MB, 1/2 banks of 256MB */
-               *mcfg = MICRON_V_MCFG_165(256 << 20);
-               *ctrla = MICRON_V_ACTIMA_165;
-               *ctrlb = MICRON_V_ACTIMB_165;
-               *rfr_ctrl = SDP_3430_SDRC_RFR_CTRL_165MHz;
+               timings->mcfg = MICRON_V_MCFG_165(256 << 20);
+               timings->ctrla = MICRON_V_ACTIMA_165;
+               timings->ctrlb = MICRON_V_ACTIMB_165;
+               timings->rfr_ctrl = SDP_3430_SDRC_RFR_CTRL_165MHz;
                break;
        case REVISION_2: /* Hynix 256MB/512MB, 1/2 banks of 256MB */
-               *mcfg = HYNIX_V_MCFG_165(256 << 20);
-               *ctrla = HYNIX_V_ACTIMA_165;
-               *ctrlb = HYNIX_V_ACTIMB_165;
-               *rfr_ctrl = SDP_3430_SDRC_RFR_CTRL_165MHz;
+               timings->mcfg = HYNIX_V_MCFG_165(256 << 20);
+               timings->ctrla = HYNIX_V_ACTIMA_165;
+               timings->ctrlb = HYNIX_V_ACTIMB_165;
+               timings->rfr_ctrl = SDP_3430_SDRC_RFR_CTRL_165MHz;
                break;
        default:
-               *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;
+               timings->mcfg = MICRON_V_MCFG_165(128 << 20);
+               timings->ctrla = MICRON_V_ACTIMA_165;
+               timings->ctrlb = MICRON_V_ACTIMB_165;
+               timings->rfr_ctrl = SDP_3430_SDRC_RFR_CTRL_165MHz;
        }
 }
 #endif
index 5f0f3961d319ad2ab037403e26b243f2debe43c3..cf4ca51fcb479405cff2996a7ab0b853498517d5 100644 (file)
@@ -45,7 +45,7 @@ int board_early_init_f(void)
        /* Set SATA activity LEDs to default off */
        writel(MVSATAHC_LED_POLARITY_CTRL, MVSATAHC_LED_CONF_REG);
        /* Multi-Purpose Pins Functionality configuration */
-       u32 kwmpp_config[] = {
+       static const u32 kwmpp_config[] = {
                MPP0_NF_IO2,
                MPP1_NF_IO3,
                MPP2_NF_IO4,
diff --git a/board/renesas/sh7752evb/Makefile b/board/renesas/sh7752evb/Makefile
new file mode 100644 (file)
index 0000000..196c992
--- /dev/null
@@ -0,0 +1,36 @@
+#
+# Copyright (C) 2012  Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 2 of
+# the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+# MA 02111-1307 USA
+
+include $(TOPDIR)/config.mk
+
+LIB    = $(obj)lib$(BOARD).o
+
+COBJS  := sh7752evb.o spi-boot.o
+SOBJS  := lowlevel_init.o
+
+$(LIB):        $(obj).depend $(COBJS) $(SOBJS)
+       $(call cmd_link_o_target, $(COBJS) $(SOBJS))
+
+#########################################################################
+
+# defines $(obj).depend target
+include $(SRCTREE)/rules.mk
+
+sinclude $(obj).depend
+
+#########################################################################
diff --git a/board/renesas/sh7752evb/lowlevel_init.S b/board/renesas/sh7752evb/lowlevel_init.S
new file mode 100644 (file)
index 0000000..73c8ac4
--- /dev/null
@@ -0,0 +1,460 @@
+/*
+ * Copyright (C) 2012  Renesas Solutions Corp.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public 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/processor.h>
+#include <asm/macro.h>
+
+.macro or32, addr, data
+       mov.l \addr, r1
+       mov.l \data, r0
+       mov.l @r1, r2
+       or    r2, r0
+       mov.l r0, @r1
+.endm
+
+.macro wait_DBCMD
+       mov.l   DBWAIT_A, r0
+       mov.l   @r0, r1
+.endm
+
+       .global lowlevel_init
+       .section        .spiboot1.text
+       .align  2
+
+lowlevel_init:
+       /*------- GPIO -------*/
+       write16 PDCR_A, PDCR_D          ! SPI0
+       write16 PGCR_A, PGCR_D          ! SPI0, GETHER MDIO gate(PTG1)
+       write16 PJCR_A, PJCR_D          ! SCIF4
+       write16 PTCR_A, PTCR_D          ! STATUS
+       write16 PSEL1_A, PSEL1_D        ! SPI0
+       write16 PSEL2_A, PSEL2_D        ! SPI0
+       write16 PSEL5_A, PSEL5_D        ! STATUS
+
+       bra     exit_gpio
+       nop
+
+       .align  2
+
+/*------- GPIO -------*/
+PDCR_A:                .long   0xffec0006
+PGCR_A:                .long   0xffec000c
+PJCR_A:                .long   0xffec0012
+PTCR_A:                .long   0xffec0026
+PSEL1_A:       .long   0xffec0072
+PSEL2_A:       .long   0xffec0074
+PSEL5_A:       .long   0xffec007a
+
+PDCR_D:                .long   0x0000
+PGCR_D:                .long   0x0004
+PJCR_D:                .long   0x0000
+PTCR_D:                .long   0x0000
+PSEL1_D:       .long   0x0000
+PSEL2_D:       .long   0x3000
+PSEL5_D:       .long   0x0ffc
+
+       .align  2
+
+exit_gpio:
+       mov     #0, r14
+       mova    2f, r0
+       mov.l   PC_MASK, r1
+       tst     r0, r1
+       bf      2f
+
+       bra     exit_pmb
+       nop
+
+       .align  2
+
+/* If CPU runs on SDRAM (PC=0x5???????) or not. */
+PC_MASK:       .long   0x20000000
+
+2:
+       mov     #1, r14
+
+       mov.l   EXPEVT_A, r0
+       mov.l   @r0, r0
+       mov.l   EXPEVT_POWER_ON_RESET, r1
+       cmp/eq  r0, r1
+       bt      1f
+
+       /*
+        * If EXPEVT value is manual reset or tlb multipul-hit,
+        * initialization of DDR3IF is not necessary.
+        */
+       bra     exit_ddr
+       nop
+
+1:
+       /*------- Reset -------*/
+       write32 MRSTCR0_A, MRSTCR0_D
+       write32 MRSTCR1_A, MRSTCR1_D
+
+       /* For Core Reset */
+       mov.l   DBACEN_A, r0
+       mov.l   @r0, r0
+       cmp/eq  #0, r0
+       bt      3f
+
+       /*
+        * If DBACEN == 1(DBSC was already enabled), we have to avoid the
+        * initialization of DDR3-SDRAM.
+        */
+       bra     exit_ddr
+       nop
+
+3:
+       /*------- DDR3IF -------*/
+       /* oscillation stabilization time */
+       wait_timer      WAIT_OSC_TIME
+
+       /* step 3 */
+       write32 DBCMD_A, DBCMD_RSTL_VAL
+       wait_timer      WAIT_30US
+
+       /* step 4 */
+       write32 DBCMD_A, DBCMD_PDEN_VAL
+
+       /* step 5 */
+       write32 DBKIND_A, DBKIND_D
+
+       /* step 6 */
+       write32 DBCONF_A, DBCONF_D
+       write32 DBTR0_A, DBTR0_D
+       write32 DBTR1_A, DBTR1_D
+       write32 DBTR2_A, DBTR2_D
+       write32 DBTR3_A, DBTR3_D
+       write32 DBTR4_A, DBTR4_D
+       write32 DBTR5_A, DBTR5_D
+       write32 DBTR6_A, DBTR6_D
+       write32 DBTR7_A, DBTR7_D
+       write32 DBTR8_A, DBTR8_D
+       write32 DBTR9_A, DBTR9_D
+       write32 DBTR10_A, DBTR10_D
+       write32 DBTR11_A, DBTR11_D
+       write32 DBTR12_A, DBTR12_D
+       write32 DBTR13_A, DBTR13_D
+       write32 DBTR14_A, DBTR14_D
+       write32 DBTR15_A, DBTR15_D
+       write32 DBTR16_A, DBTR16_D
+       write32 DBTR17_A, DBTR17_D
+       write32 DBTR18_A, DBTR18_D
+       write32 DBTR19_A, DBTR19_D
+       write32 DBRNK0_A, DBRNK0_D
+
+       /* step 7 */
+       write32 DBPDCNT3_A, DBPDCNT3_D
+
+       /* step 8 */
+       write32 DBPDCNT1_A, DBPDCNT1_D
+       write32 DBPDCNT2_A, DBPDCNT2_D
+       write32 DBPDLCK_A, DBPDLCK_D
+       write32 DBPDRGA_A, DBPDRGA_D
+       write32 DBPDRGD_A, DBPDRGD_D
+
+       /* step 9 */
+       wait_timer      WAIT_30US
+
+       /* step 10 */
+       write32 DBPDCNT0_A, DBPDCNT0_D
+
+       /* step 11 */
+       wait_timer      WAIT_30US
+       wait_timer      WAIT_30US
+
+       /* step 12 */
+       write32 DBCMD_A, DBCMD_WAIT_VAL
+       wait_DBCMD
+
+       /* step 13 */
+       write32 DBCMD_A, DBCMD_RSTH_VAL
+       wait_DBCMD
+
+       /* step 14 */
+       write32 DBCMD_A, DBCMD_WAIT_VAL
+       write32 DBCMD_A, DBCMD_WAIT_VAL
+       write32 DBCMD_A, DBCMD_WAIT_VAL
+       write32 DBCMD_A, DBCMD_WAIT_VAL
+
+       /* step 15 */
+       write32 DBCMD_A, DBCMD_PDXT_VAL
+
+       /* step 16 */
+       write32 DBCMD_A, DBCMD_MRS2_VAL
+
+       /* step 17 */
+       write32 DBCMD_A, DBCMD_MRS3_VAL
+
+       /* step 18 */
+       write32 DBCMD_A, DBCMD_MRS1_VAL
+
+       /* step 19 */
+       write32 DBCMD_A, DBCMD_MRS0_VAL
+
+       /* step 20 */
+       write32 DBCMD_A, DBCMD_ZQCL_VAL
+
+       write32 DBCMD_A, DBCMD_REF_VAL
+       write32 DBCMD_A, DBCMD_REF_VAL
+       wait_DBCMD
+
+       /* step 21 */
+       write32 DBADJ0_A, DBADJ0_D
+       write32 DBADJ1_A, DBADJ1_D
+       write32 DBADJ2_A, DBADJ2_D
+
+       /* step 22 */
+       write32 DBRFCNF0_A, DBRFCNF0_D
+       write32 DBRFCNF1_A, DBRFCNF1_D
+       write32 DBRFCNF2_A, DBRFCNF2_D
+
+       /* step 23 */
+       write32 DBCALCNF_A, DBCALCNF_D
+
+       /* step 24 */
+       write32 DBRFEN_A, DBRFEN_D
+       write32 DBCMD_A, DBCMD_SRXT_VAL
+
+       /* step 25 */
+       write32 DBACEN_A, DBACEN_D
+
+       /* step 26 */
+       wait_DBCMD
+
+       bra     exit_ddr
+       nop
+
+       .align 2
+
+EXPEVT_A:              .long   0xff000024
+EXPEVT_POWER_ON_RESET: .long   0x00000000
+
+/*------- Reset -------*/
+MRSTCR0_A:     .long   0xffd50030
+MRSTCR0_D:     .long   0xfe1ffe7f
+MRSTCR1_A:     .long   0xffd50034
+MRSTCR1_D:     .long   0xfff3ffff
+
+/*------- DDR3IF -------*/
+DBCMD_A:       .long   0xfe800018
+DBKIND_A:      .long   0xfe800020
+DBCONF_A:      .long   0xfe800024
+DBTR0_A:       .long   0xfe800040
+DBTR1_A:       .long   0xfe800044
+DBTR2_A:       .long   0xfe800048
+DBTR3_A:       .long   0xfe800050
+DBTR4_A:       .long   0xfe800054
+DBTR5_A:       .long   0xfe800058
+DBTR6_A:       .long   0xfe80005c
+DBTR7_A:       .long   0xfe800060
+DBTR8_A:       .long   0xfe800064
+DBTR9_A:       .long   0xfe800068
+DBTR10_A:      .long   0xfe80006c
+DBTR11_A:      .long   0xfe800070
+DBTR12_A:      .long   0xfe800074
+DBTR13_A:      .long   0xfe800078
+DBTR14_A:      .long   0xfe80007c
+DBTR15_A:      .long   0xfe800080
+DBTR16_A:      .long   0xfe800084
+DBTR17_A:      .long   0xfe800088
+DBTR18_A:      .long   0xfe80008c
+DBTR19_A:      .long   0xfe800090
+DBRNK0_A:      .long   0xfe800100
+DBPDCNT0_A:    .long   0xfe800200
+DBPDCNT1_A:    .long   0xfe800204
+DBPDCNT2_A:    .long   0xfe800208
+DBPDCNT3_A:    .long   0xfe80020c
+DBPDLCK_A:     .long   0xfe800280
+DBPDRGA_A:     .long   0xfe800290
+DBPDRGD_A:     .long   0xfe8002a0
+DBADJ0_A:      .long   0xfe8000c0
+DBADJ1_A:      .long   0xfe8000c4
+DBADJ2_A:      .long   0xfe8000c8
+DBRFCNF0_A:    .long   0xfe8000e0
+DBRFCNF1_A:    .long   0xfe8000e4
+DBRFCNF2_A:    .long   0xfe8000e8
+DBCALCNF_A:    .long   0xfe8000f4
+DBRFEN_A:      .long   0xfe800014
+DBACEN_A:      .long   0xfe800010
+DBWAIT_A:      .long   0xfe80001c
+
+WAIT_OSC_TIME: .long   6000
+WAIT_30US:     .long   13333
+
+DBCMD_RSTL_VAL:        .long   0x20000000
+DBCMD_PDEN_VAL:        .long   0x1000d73c
+DBCMD_WAIT_VAL:        .long   0x0000d73c
+DBCMD_RSTH_VAL:        .long   0x2100d73c
+DBCMD_PDXT_VAL:        .long   0x110000c8
+DBCMD_MRS0_VAL:        .long   0x28000930
+DBCMD_MRS1_VAL:        .long   0x29000004
+DBCMD_MRS2_VAL:        .long   0x2a000008
+DBCMD_MRS3_VAL:        .long   0x2b000000
+DBCMD_ZQCL_VAL:        .long   0x03000200
+DBCMD_REF_VAL: .long   0x0c000000
+DBCMD_SRXT_VAL:        .long   0x19000000
+DBKIND_D:      .long   0x00000007
+DBCONF_D:      .long   0x0f030a01
+DBTR0_D:       .long   0x00000007
+DBTR1_D:       .long   0x00000006
+DBTR2_D:       .long   0x00000000
+DBTR3_D:       .long   0x00000007
+DBTR4_D:       .long   0x00070007
+DBTR5_D:       .long   0x0000001b
+DBTR6_D:       .long   0x00000014
+DBTR7_D:       .long   0x00000005
+DBTR8_D:       .long   0x00000015
+DBTR9_D:       .long   0x00000006
+DBTR10_D:      .long   0x00000008
+DBTR11_D:      .long   0x00000007
+DBTR12_D:      .long   0x0000000e
+DBTR13_D:      .long   0x00000056
+DBTR14_D:      .long   0x00000006
+DBTR15_D:      .long   0x00000004
+DBTR16_D:      .long   0x00150002
+DBTR17_D:      .long   0x000c0017
+DBTR18_D:      .long   0x00000200
+DBTR19_D:      .long   0x00000040
+DBRNK0_D:      .long   0x00000001
+DBPDCNT0_D:    .long   0x00000001
+DBPDCNT1_D:    .long   0x00000001
+DBPDCNT2_D:    .long   0x00000000
+DBPDCNT3_D:    .long   0x00004010
+DBPDLCK_D:     .long   0x0000a55a
+DBPDRGA_D:     .long   0x00000028
+DBPDRGD_D:     .long   0x00017100
+
+DBADJ0_D:      .long   0x00000000
+DBADJ1_D:      .long   0x00000000
+DBADJ2_D:      .long   0x18061806
+DBRFCNF0_D:    .long   0x000001ff
+DBRFCNF1_D:    .long   0x08001000
+DBRFCNF2_D:    .long   0x00000000
+DBCALCNF_D:    .long   0x0000ffff
+DBRFEN_D:      .long   0x00000001
+DBACEN_D:      .long   0x00000001
+
+       .align 2
+exit_ddr:
+#if defined(CONFIG_SH_32BIT)
+       /*------- set PMB -------*/
+       write32 PASCR_A,        PASCR_29BIT_D
+       write32 MMUCR_A,        MMUCR_D
+
+       /*****************************************************************
+        * ent  virt            phys            v       sz      c       wt
+        * 0    0xa0000000      0x00000000      1       128M    0       1
+        * 1    0xa8000000      0x48000000      1       128M    0       1
+        * 5    0x88000000      0x48000000      1       128M    1       1
+        */
+       write32 PMB_ADDR_SPIBOOT_A,     PMB_ADDR_SPIBOOT_D
+       write32 PMB_DATA_SPIBOOT_A,     PMB_DATA_SPIBOOT_D
+       write32 PMB_ADDR_DDR_C1_A,      PMB_ADDR_DDR_C1_D
+       write32 PMB_DATA_DDR_C1_A,      PMB_DATA_DDR_C1_D
+       write32 PMB_ADDR_DDR_N1_A,      PMB_ADDR_DDR_N1_D
+       write32 PMB_DATA_DDR_N1_A,      PMB_DATA_DDR_N1_D
+
+       write32 PMB_ADDR_ENTRY2,        PMB_ADDR_NOT_USE_D
+       write32 PMB_ADDR_ENTRY3,        PMB_ADDR_NOT_USE_D
+       write32 PMB_ADDR_ENTRY4,        PMB_ADDR_NOT_USE_D
+       write32 PMB_ADDR_ENTRY6,        PMB_ADDR_NOT_USE_D
+       write32 PMB_ADDR_ENTRY7,        PMB_ADDR_NOT_USE_D
+       write32 PMB_ADDR_ENTRY8,        PMB_ADDR_NOT_USE_D
+       write32 PMB_ADDR_ENTRY9,        PMB_ADDR_NOT_USE_D
+       write32 PMB_ADDR_ENTRY10,       PMB_ADDR_NOT_USE_D
+       write32 PMB_ADDR_ENTRY11,       PMB_ADDR_NOT_USE_D
+       write32 PMB_ADDR_ENTRY12,       PMB_ADDR_NOT_USE_D
+       write32 PMB_ADDR_ENTRY13,       PMB_ADDR_NOT_USE_D
+       write32 PMB_ADDR_ENTRY14,       PMB_ADDR_NOT_USE_D
+       write32 PMB_ADDR_ENTRY15,       PMB_ADDR_NOT_USE_D
+
+       write32 PASCR_A,        PASCR_INIT
+       mov.l   DUMMY_ADDR, r0
+       icbi    @r0
+#endif /* if defined(CONFIG_SH_32BIT) */
+
+exit_pmb:
+       /* CPU is running on ILRAM? */
+       mov     r14, r0
+       tst     #1, r0
+       bt      1f
+
+       mov.l   _stack_ilram, r15
+       mov.l   _spiboot_main, r0
+100:   bsrf    r0
+       nop
+
+       .align  2
+_spiboot_main: .long   (spiboot_main - (100b + 4))
+_stack_ilram:  .long   0xe5204000
+
+1:
+       write32 CCR_A,  CCR_D
+
+       rts
+        nop
+
+       .align 2
+
+#if defined(CONFIG_SH_32BIT)
+/*------- set PMB -------*/
+PMB_ADDR_SPIBOOT_A:    .long   PMB_ADDR_BASE(0)
+PMB_ADDR_DDR_N1_A:     .long   PMB_ADDR_BASE(1)
+PMB_ADDR_DDR_C1_A:     .long   PMB_ADDR_BASE(5)
+PMB_ADDR_ENTRY2:       .long   PMB_ADDR_BASE(2)
+PMB_ADDR_ENTRY3:       .long   PMB_ADDR_BASE(3)
+PMB_ADDR_ENTRY4:       .long   PMB_ADDR_BASE(4)
+PMB_ADDR_ENTRY6:       .long   PMB_ADDR_BASE(6)
+PMB_ADDR_ENTRY7:       .long   PMB_ADDR_BASE(7)
+PMB_ADDR_ENTRY8:       .long   PMB_ADDR_BASE(8)
+PMB_ADDR_ENTRY9:       .long   PMB_ADDR_BASE(9)
+PMB_ADDR_ENTRY10:      .long   PMB_ADDR_BASE(10)
+PMB_ADDR_ENTRY11:      .long   PMB_ADDR_BASE(11)
+PMB_ADDR_ENTRY12:      .long   PMB_ADDR_BASE(12)
+PMB_ADDR_ENTRY13:      .long   PMB_ADDR_BASE(13)
+PMB_ADDR_ENTRY14:      .long   PMB_ADDR_BASE(14)
+PMB_ADDR_ENTRY15:      .long   PMB_ADDR_BASE(15)
+
+PMB_ADDR_SPIBOOT_D:    .long   mk_pmb_addr_val(0xa0)
+PMB_ADDR_DDR_C1_D:     .long   mk_pmb_addr_val(0x88)
+PMB_ADDR_DDR_N1_D:     .long   mk_pmb_addr_val(0xa8)
+PMB_ADDR_NOT_USE_D:    .long   0x00000000
+
+PMB_DATA_SPIBOOT_A:    .long   PMB_DATA_BASE(0)
+PMB_DATA_DDR_N1_A:     .long   PMB_DATA_BASE(1)
+PMB_DATA_DDR_C1_A:     .long   PMB_DATA_BASE(5)
+
+/*                                             ppn   ub v s1 s0  c  wt */
+PMB_DATA_SPIBOOT_D:    .long   mk_pmb_data_val(0x00, 0, 1, 1, 0, 0, 1)
+PMB_DATA_DDR_C1_D:     .long   mk_pmb_data_val(0x48, 0, 1, 1, 0, 1, 1)
+PMB_DATA_DDR_N1_D:     .long   mk_pmb_data_val(0x48, 1, 1, 1, 0, 0, 1)
+
+PASCR_A:               .long   0xff000070
+DUMMY_ADDR:            .long   0xa0000000
+PASCR_29BIT_D:         .long   0x00000000
+PASCR_INIT:            .long   0x80000080
+MMUCR_A:               .long   0xff000010
+MMUCR_D:               .long   0x00000004      /* clear ITLB */
+#endif /* CONFIG_SH_32BIT */
+
+CCR_A:         .long   CCR
+CCR_D:         .long   CCR_CACHE_INIT
diff --git a/board/renesas/sh7752evb/sh7752evb.c b/board/renesas/sh7752evb/sh7752evb.c
new file mode 100644 (file)
index 0000000..e996593
--- /dev/null
@@ -0,0 +1,330 @@
+/*
+ * Copyright (C) 2012  Renesas Solutions Corp.
+ *
+ * See file CREDITS for 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 <malloc.h>
+#include <asm/processor.h>
+#include <asm/io.h>
+#include <asm/mmc.h>
+#include <spi_flash.h>
+
+int checkboard(void)
+{
+       puts("BOARD: SH7752 evaluation board (R0P7752C00000RZ)\n");
+
+       return 0;
+}
+
+static void init_gpio(void)
+{
+       struct gpio_regs *gpio = GPIO_BASE;
+       struct sermux_regs *sermux = SERMUX_BASE;
+
+       /* GPIO */
+       writew(0x0000, &gpio->pacr);    /* GETHER */
+       writew(0x0001, &gpio->pbcr);    /* INTC */
+       writew(0x0000, &gpio->pccr);    /* PWMU, INTC */
+       writew(0xeaff, &gpio->pecr);    /* GPIO */
+       writew(0x0000, &gpio->pfcr);    /* WDT */
+       writew(0x0000, &gpio->phcr);    /* SPI1 */
+       writew(0x0000, &gpio->picr);    /* SDHI */
+       writew(0x0003, &gpio->pkcr);    /* SerMux */
+       writew(0x0000, &gpio->plcr);    /* SerMux */
+       writew(0x0000, &gpio->pmcr);    /* RIIC */
+       writew(0x0000, &gpio->pncr);    /* USB, SGPIO */
+       writew(0x0000, &gpio->pocr);    /* SGPIO */
+       writew(0xd555, &gpio->pqcr);    /* GPIO */
+       writew(0x0000, &gpio->prcr);    /* RIIC */
+       writew(0x0000, &gpio->pscr);    /* RIIC */
+       writeb(0x00, &gpio->pudr);
+       writew(0x5555, &gpio->pucr);    /* Debug LED */
+       writew(0x0000, &gpio->pvcr);    /* RSPI */
+       writew(0x0000, &gpio->pwcr);    /* EVC */
+       writew(0x0000, &gpio->pxcr);    /* LBSC */
+       writew(0x0000, &gpio->pycr);    /* LBSC */
+       writew(0x0000, &gpio->pzcr);    /* eMMC */
+       writew(0xfe00, &gpio->psel0);
+       writew(0xff00, &gpio->psel3);
+       writew(0x771f, &gpio->psel4);
+       writew(0x00ff, &gpio->psel6);
+       writew(0xfc00, &gpio->psel7);
+
+       writeb(0x10, &sermux->smr0);    /* SMR0: SerMux mode 0 */
+}
+
+static void init_usb_phy(void)
+{
+       struct usb_common_regs *common0 = USB0_COMMON_BASE;
+       struct usb_common_regs *common1 = USB1_COMMON_BASE;
+       struct usb0_phy_regs *phy = USB0_PHY_BASE;
+       struct usb1_port_regs *port = USB1_PORT_BASE;
+       struct usb1_alignment_regs *align = USB1_ALIGNMENT_BASE;
+
+       writew(0x0100, &phy->reset);            /* set reset */
+       /* port0 = USB0, port1 = USB1 */
+       writew(0x0002, &phy->portsel);
+       writel(0x0001, &port->port1sel);        /* port1 = Host */
+       writew(0x0111, &phy->reset);            /* clear reset */
+
+       writew(0x4000, &common0->suspmode);
+       writew(0x4000, &common1->suspmode);
+
+#if defined(__LITTLE_ENDIAN)
+       writel(0x00000000, &align->ehcidatac);
+       writel(0x00000000, &align->ohcidatac);
+#endif
+}
+
+static void init_gether_mdio(void)
+{
+       struct gpio_regs *gpio = GPIO_BASE;
+
+       writew(readw(&gpio->pgcr) | 0x0004, &gpio->pgcr);
+       writeb(readb(&gpio->pgdr) | 0x02, &gpio->pgdr); /* Use ET0-MDIO */
+}
+
+static void set_mac_to_sh_giga_eth_register(int channel, char *mac_string)
+{
+       struct ether_mac_regs *ether;
+       unsigned char mac[6];
+       unsigned long val;
+
+       eth_parse_enetaddr(mac_string, mac);
+
+       if (!channel)
+               ether = GETHER0_MAC_BASE;
+       else
+               ether = GETHER1_MAC_BASE;
+
+       val = (mac[0] << 24) | (mac[1] << 16) | (mac[2] << 8) | mac[3];
+       writel(val, &ether->mahr);
+       val = (mac[4] << 8) | mac[5];
+       writel(val, &ether->malr);
+}
+
+/*****************************************************************
+ * This PMB must be set on this timing. The lowlevel_init is run on
+ * Area 0(phys 0x00000000), so we have to map it.
+ *
+ * The new PMB table is following:
+ * ent virt            phys            v       sz      c       wt
+ * 0   0xa0000000      0x40000000      1       128M    0       1
+ * 1   0xa8000000      0x48000000      1       128M    0       1
+ * 2   0xb0000000      0x50000000      1       128M    0       1
+ * 3   0xb8000000      0x58000000      1       128M    0       1
+ * 4   0x80000000      0x40000000      1       128M    1       1
+ * 5   0x88000000      0x48000000      1       128M    1       1
+ * 6   0x90000000      0x50000000      1       128M    1       1
+ * 7   0x98000000      0x58000000      1       128M    1       1
+ */
+static void set_pmb_on_board_init(void)
+{
+       struct mmu_regs *mmu = MMU_BASE;
+
+       /* clear ITLB */
+       writel(0x00000004, &mmu->mmucr);
+
+       /* delete PMB for SPIBOOT */
+       writel(0, PMB_ADDR_BASE(0));
+       writel(0, PMB_DATA_BASE(0));
+
+       /* add PMB for SDRAM(0x40000000 - 0x47ffffff) */
+       /*                      ppn  ub v s1 s0  c  wt */
+       writel(mk_pmb_addr_val(0xa0), PMB_ADDR_BASE(0));
+       writel(mk_pmb_data_val(0x40, 1, 1, 1, 0, 0, 1), PMB_DATA_BASE(0));
+       writel(mk_pmb_addr_val(0xb0), PMB_ADDR_BASE(2));
+       writel(mk_pmb_data_val(0x50, 1, 1, 1, 0, 0, 1), PMB_DATA_BASE(2));
+       writel(mk_pmb_addr_val(0xb8), PMB_ADDR_BASE(3));
+       writel(mk_pmb_data_val(0x58, 1, 1, 1, 0, 0, 1), PMB_DATA_BASE(3));
+       writel(mk_pmb_addr_val(0x80), PMB_ADDR_BASE(4));
+       writel(mk_pmb_data_val(0x40, 0, 1, 1, 0, 1, 1), PMB_DATA_BASE(4));
+       writel(mk_pmb_addr_val(0x90), PMB_ADDR_BASE(6));
+       writel(mk_pmb_data_val(0x50, 0, 1, 1, 0, 1, 1), PMB_DATA_BASE(6));
+       writel(mk_pmb_addr_val(0x98), PMB_ADDR_BASE(7));
+       writel(mk_pmb_data_val(0x58, 0, 1, 1, 0, 1, 1), PMB_DATA_BASE(7));
+}
+
+int board_init(void)
+{
+       init_gpio();
+       set_pmb_on_board_init();
+
+       init_usb_phy();
+       init_gether_mdio();
+
+       return 0;
+}
+
+int dram_init(void)
+{
+       DECLARE_GLOBAL_DATA_PTR;
+
+       gd->bd->bi_memstart = CONFIG_SYS_SDRAM_BASE;
+       gd->bd->bi_memsize = CONFIG_SYS_SDRAM_SIZE;
+       printf("DRAM:  %dMB\n", CONFIG_SYS_SDRAM_SIZE / (1024 * 1024));
+
+       return 0;
+}
+
+int board_mmc_init(bd_t *bis)
+{
+       struct gpio_regs *gpio = GPIO_BASE;
+
+       writew(readw(&gpio->pgcr) | 0x0040, &gpio->pgcr);
+       writeb(readb(&gpio->pgdr) & ~0x08, &gpio->pgdr); /* Reset */
+       udelay(1);
+       writeb(readb(&gpio->pgdr) | 0x08, &gpio->pgdr); /* Release reset */
+       udelay(200);
+
+       return mmcif_mmc_init();
+}
+
+static int get_sh_eth_mac_raw(unsigned char *buf, int size)
+{
+       struct spi_flash *spi;
+       int ret;
+
+       spi = spi_flash_probe(0, 0, 1000000, SPI_MODE_3);
+       if (spi == NULL) {
+               printf("%s: spi_flash probe failed.\n", __func__);
+               return 1;
+       }
+
+       ret = spi_flash_read(spi, SH7752EVB_ETHERNET_MAC_BASE, size, buf);
+       if (ret) {
+               printf("%s: spi_flash read failed.\n", __func__);
+               spi_flash_free(spi);
+               return 1;
+       }
+       spi_flash_free(spi);
+
+       return 0;
+}
+
+static int get_sh_eth_mac(int channel, char *mac_string, unsigned char *buf)
+{
+       memcpy(mac_string, &buf[channel * (SH7752EVB_ETHERNET_MAC_SIZE + 1)],
+               SH7752EVB_ETHERNET_MAC_SIZE);
+       mac_string[SH7752EVB_ETHERNET_MAC_SIZE] = 0x00; /* terminate */
+
+       return 0;
+}
+
+static void init_ethernet_mac(void)
+{
+       char mac_string[64];
+       char env_string[64];
+       int i;
+       unsigned char *buf;
+
+       buf = malloc(256);
+       if (!buf) {
+               printf("%s: malloc failed.\n", __func__);
+               return;
+       }
+       get_sh_eth_mac_raw(buf, 256);
+
+       /* Gigabit Ethernet */
+       for (i = 0; i < SH7752EVB_ETHERNET_NUM_CH; i++) {
+               get_sh_eth_mac(i, mac_string, buf);
+               if (i == 0)
+                       setenv("ethaddr", mac_string);
+               else {
+                       sprintf(env_string, "eth%daddr", i);
+                       setenv(env_string, mac_string);
+               }
+               set_mac_to_sh_giga_eth_register(i, mac_string);
+       }
+
+       free(buf);
+}
+
+int board_late_init(void)
+{
+       init_ethernet_mac();
+
+       return 0;
+}
+
+int do_write_mac(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+{
+       int i, ret;
+       char mac_string[256];
+       struct spi_flash *spi;
+       unsigned char *buf;
+
+       if (argc != 3) {
+               buf = malloc(256);
+               if (!buf) {
+                       printf("%s: malloc failed.\n", __func__);
+                       return 1;
+               }
+
+               get_sh_eth_mac_raw(buf, 256);
+
+               /* print current MAC address */
+               for (i = 0; i < SH7752EVB_ETHERNET_NUM_CH; i++) {
+                       get_sh_eth_mac(i, mac_string, buf);
+                       printf("GETHERC ch%d = %s\n", i, mac_string);
+               }
+               free(buf);
+               return 0;
+       }
+
+       /* new setting */
+       memset(mac_string, 0xff, sizeof(mac_string));
+       sprintf(mac_string, "%s\t%s",
+               argv[1], argv[2]);
+
+       /* write MAC data to SPI rom */
+       spi = spi_flash_probe(0, 0, 1000000, SPI_MODE_3);
+       if (!spi) {
+               printf("%s: spi_flash probe failed.\n", __func__);
+               return 1;
+       }
+
+       ret = spi_flash_erase(spi, SH7752EVB_ETHERNET_MAC_BASE_SPI,
+                               SH7752EVB_SPI_SECTOR_SIZE);
+       if (ret) {
+               printf("%s: spi_flash erase failed.\n", __func__);
+               return 1;
+       }
+
+       ret = spi_flash_write(spi, SH7752EVB_ETHERNET_MAC_BASE_SPI,
+                               sizeof(mac_string), mac_string);
+       if (ret) {
+               printf("%s: spi_flash write failed.\n", __func__);
+               spi_flash_free(spi);
+               return 1;
+       }
+       spi_flash_free(spi);
+
+       puts("The writing of the MAC address to SPI ROM was completed.\n");
+
+       return 0;
+}
+
+U_BOOT_CMD(
+       write_mac,      3,      1,      do_write_mac,
+       "write MAC address for GETHERC",
+       "[GETHERC ch0] [GETHERC ch1]\n"
+);
diff --git a/board/renesas/sh7752evb/spi-boot.c b/board/renesas/sh7752evb/spi-boot.c
new file mode 100644 (file)
index 0000000..91565d4
--- /dev/null
@@ -0,0 +1,116 @@
+/*
+ * Copyright (C) 2012  Renesas Solutions Corp.
+ *
+ * This file is subject to the terms and conditions of the GNU Lesser
+ * General Public License.  See the file "COPYING.LIB" in the main
+ * directory of this archive for more details.
+ */
+
+#include <common.h>
+
+#define CONFIG_RAM_BOOT_PHYS   CONFIG_SYS_TEXT_BASE
+#define CONFIG_SPI_ADDR                0x00000000
+#define CONFIG_SPI_LENGTH      CONFIG_SYS_MONITOR_LEN
+#define CONFIG_RAM_BOOT                CONFIG_SYS_TEXT_BASE
+
+#define SPIWDMADR      0xFE001018
+#define SPIWDMCNTR     0xFE001020
+#define SPIDMCOR       0xFE001028
+#define SPIDMINTSR     0xFE001188
+#define SPIDMINTMR     0xFE001190
+
+#define SPIDMINTSR_DMEND       0x00000004
+
+#define TBR    0xFE002000
+#define RBR    0xFE002000
+
+#define CR1    0xFE002008
+#define CR2    0xFE002010
+#define CR3    0xFE002018
+#define CR4    0xFE002020
+
+/* CR1 */
+#define SPI_TBE                0x80
+#define SPI_TBF                0x40
+#define SPI_RBE                0x20
+#define SPI_RBF                0x10
+#define SPI_PFONRD     0x08
+#define SPI_SSDB       0x04
+#define SPI_SSD                0x02
+#define SPI_SSA                0x01
+
+/* CR2 */
+#define SPI_RSTF       0x80
+#define SPI_LOOPBK     0x40
+#define SPI_CPOL       0x20
+#define SPI_CPHA       0x10
+#define SPI_L1M0       0x08
+
+/* CR4 */
+#define SPI_TBEI       0x80
+#define SPI_TBFI       0x40
+#define SPI_RBEI       0x20
+#define SPI_RBFI       0x10
+#define SPI_SpiS0      0x02
+#define SPI_SSS                0x01
+
+#define spi_write(val, addr)   (*(volatile unsigned long *)(addr)) = val
+#define spi_read(addr)         (*(volatile unsigned long *)(addr))
+
+/* M25P80 */
+#define M25_READ       0x03
+
+#define __uses_spiboot2        __attribute__((section(".spiboot2.text")))
+static void __uses_spiboot2 spi_reset(void)
+{
+       int timeout = 0x00100000;
+
+       /* Make sure the last transaction is finalized */
+       spi_write(0x00, CR3);
+       spi_write(0x02, CR1);
+       while (!(spi_read(CR4) & SPI_SpiS0)) {
+               if (timeout-- < 0)
+                       break;
+       }
+       spi_write(0x00, CR1);
+
+       spi_write(spi_read(CR2) | SPI_RSTF, CR2);       /* fifo reset */
+       spi_write(spi_read(CR2) & ~SPI_RSTF, CR2);
+
+       spi_write(0, SPIDMCOR);
+}
+
+static void __uses_spiboot2 spi_read_flash(void *buf, unsigned long addr,
+                                          unsigned long len)
+{
+       spi_write(M25_READ, TBR);
+       spi_write((addr >> 16) & 0xFF, TBR);
+       spi_write((addr >> 8) & 0xFF, TBR);
+       spi_write(addr & 0xFF, TBR);
+
+       spi_write(SPIDMINTSR_DMEND, SPIDMINTSR);
+       spi_write((unsigned long)buf, SPIWDMADR);
+       spi_write(len & 0xFFFFFFE0, SPIWDMCNTR);
+       spi_write(1, SPIDMCOR);
+
+       spi_write(0xff, CR3);
+       spi_write(spi_read(CR1) | SPI_SSDB, CR1);
+       spi_write(spi_read(CR1) | SPI_SSA, CR1);
+
+       while (!(spi_read(SPIDMINTSR) & SPIDMINTSR_DMEND))
+               ;
+
+       /* Nagate SP0-SS0 */
+       spi_write(0, CR1);
+}
+
+void __uses_spiboot2 spiboot_main(void)
+{
+       void (*_start)(void) = (void *)CONFIG_SYS_TEXT_BASE;
+
+       spi_reset();
+       spi_read_flash((void *)CONFIG_RAM_BOOT_PHYS, CONFIG_SPI_ADDR,
+                       CONFIG_SPI_LENGTH);
+
+       _start();
+}
diff --git a/board/renesas/sh7752evb/u-boot.lds b/board/renesas/sh7752evb/u-boot.lds
new file mode 100644 (file)
index 0000000..28449b6
--- /dev/null
@@ -0,0 +1,97 @@
+/*
+ * Copyright (C) 2007
+ * Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
+ *
+ * Copyright (C) 2012
+ * Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+OUTPUT_FORMAT("elf32-sh-linux", "elf32-sh-linux", "elf32-sh-linux")
+OUTPUT_ARCH(sh)
+ENTRY(_start)
+
+SECTIONS
+{
+       /*
+        * entry and reloct_dst will be provided via ldflags
+        */
+       . = .;
+
+       PROVIDE (_ftext = .);
+       PROVIDE (_fcode = .);
+       PROVIDE (_start = .);
+
+       .text :
+       {
+               KEEP(arch/sh/cpu/sh4/start.o            (.text))
+               *(.spiboot1.text)
+               *(.spiboot2.text)
+               . = ALIGN(8192);
+               common/env_embedded.o   (.ppcenv)
+               . = ALIGN(8192);
+               common/env_embedded.o   (.ppcenvr)
+               . = ALIGN(8192);
+               *(.text)
+               . = ALIGN(4);
+       } =0xFF
+       PROVIDE (_ecode = .);
+       .rodata :
+       {
+               *(SORT_BY_ALIGNMENT(SORT_BY_NAME(.rodata*)))
+               . = ALIGN(4);
+       }
+       PROVIDE (_etext = .);
+
+
+       PROVIDE (_fdata = .);
+       .data :
+       {
+               *(.data)
+               . = ALIGN(4);
+       }
+       PROVIDE (_edata = .);
+
+       PROVIDE (_fgot = .);
+       .got :
+       {
+               *(.got)
+               . = ALIGN(4);
+       }
+       PROVIDE (_egot = .);
+
+       .u_boot_list : {
+               #include <u-boot.lst>
+       }
+
+       PROVIDE (reloc_dst_end = .);
+       /* _reloc_dst_end = .; */
+
+       PROVIDE (bss_start = .);
+       PROVIDE (__bss_start = .);
+       .bss (NOLOAD) :
+       {
+               *(.bss)
+               . = ALIGN(4);
+       }
+       PROVIDE (bss_end = .);
+
+       PROVIDE (__bss_end__ = .);
+}
diff --git a/board/samsung/dts/exynos5250-smdk5250.dts b/board/samsung/dts/exynos5250-smdk5250.dts
new file mode 100644 (file)
index 0000000..cbfab6f
--- /dev/null
@@ -0,0 +1,69 @@
+/*
+ * SAMSUNG SMDK5250 board device tree source
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd.
+ *             http://www.samsung.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.
+*/
+
+/dts-v1/;
+/include/ ARCH_CPU_DTS
+
+/ {
+       model = "SAMSUNG SMDK5250 board based on EXYNOS5250";
+       compatible = "samsung,smdk5250", "samsung,exynos5250";
+
+       aliases {
+               i2c0 = "/i2c@12c60000";
+               i2c1 = "/i2c@12c70000";
+               i2c2 = "/i2c@12c80000";
+               i2c3 = "/i2c@12c90000";
+               i2c4 = "/i2c@12ca0000";
+               i2c5 = "/i2c@12cb0000";
+               i2c6 = "/i2c@12cc0000";
+               i2c7 = "/i2c@12cd0000";
+               spi0 = "/spi@12d20000";
+               spi1 = "/spi@12d30000";
+               spi2 = "/spi@12d40000";
+               spi3 = "/spi@131a0000";
+               spi4 = "/spi@131b0000";
+       };
+
+       sromc@12250000 {
+               bank = <1>;
+               srom-timing = <1 9 12 1 6 1 1>;
+               width = <2>;
+               lan@5000000 {
+                       compatible = "smsc,lan9215", "smsc,lan";
+                       reg = <0x5000000 0x100>;
+                       phy-mode = "mii";
+               };
+       };
+
+       sound@12d60000 {
+               samsung,i2s-epll-clock-frequency = <192000000>;
+               samsung,i2s-sampling-rate = <48000>;
+               samsung,i2s-bits-per-sample = <16>;
+               samsung,i2s-channels = <2>;
+               samsung,i2s-lr-clk-framesize = <256>;
+               samsung,i2s-bit-clk-framesize = <32>;
+               samsung,codec-type = "wm8994";
+       };
+
+       i2c@12c70000 {
+               soundcodec@1a {
+                       reg = <0x1a>;
+                       compatible = "wolfson,wm8994-codec";
+               };
+       };
+
+       i2c@12c60000 {
+               pmic@9 {
+                       reg = <0x9>;
+                       compatible = "maxim,max77686_pmic";
+               };
+       };
+};
index 1474fa8a15a7b3825c356a843f5626a1851765e2..47c6a5a46b51b805bddedd5f06ff9de33bd61e47 100644 (file)
@@ -36,7 +36,7 @@ COBJS += smdk5250.o
 endif
 
 ifdef CONFIG_SPL_BUILD
-COBJS  += mmc_boot.o
+COBJS  += spl_boot.o
 endif
 
 SRCS   := $(SOBJS:.o=.S) $(COBJS:.o=.c)
diff --git a/board/samsung/smdk5250/mmc_boot.c b/board/samsung/smdk5250/mmc_boot.c
deleted file mode 100644 (file)
index 449a919..0000000
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * 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) {}
index a5816e445c80308f9843728c6ea64428088d03fb..7a5f132ebb753a8519834b1e995f9810d414daf9 100644 (file)
  */
 
 #include <common.h>
+#include <fdtdec.h>
 #include <asm/io.h>
 #include <i2c.h>
+#include <lcd.h>
 #include <netdev.h>
+#include <spi.h>
 #include <asm/arch/cpu.h>
 #include <asm/arch/gpio.h>
 #include <asm/arch/mmc.h>
 #include <asm/arch/pinmux.h>
+#include <asm/arch/power.h>
 #include <asm/arch/sromc.h>
+#include <asm/arch/dp_info.h>
+#include <power/pmic.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
-#ifdef CONFIG_SMC911X
-static int smc9115_pre_init(void)
+#ifdef CONFIG_USB_EHCI_EXYNOS
+int board_usb_vbus_init(void)
 {
-       u32 smc_bw_conf, smc_bc_conf;
-       int err;
-
-       /* 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);
+       struct exynos5_gpio_part1 *gpio1 = (struct exynos5_gpio_part1 *)
+                                               samsung_get_base_gpio_part1();
 
-       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);
+       /* Enable VBUS power switch */
+       s5p_gpio_direction_output(&gpio1->x2, 6, 1);
 
-       /* Select and configure the SROMC bank */
-       err = exynos_pinmux_config(PERIPH_ID_SROMC,
-                               CONFIG_ENV_SROM_BANK | PINMUX_FLAG_16BIT);
-       if (err) {
-               debug("SROMC not configured\n");
-               return err;
-       }
+       /* VBUS turn ON time */
+       mdelay(3);
 
-       s5p_config_sromc(CONFIG_ENV_SROM_BANK, smc_bw_conf, smc_bc_conf);
        return 0;
 }
 #endif
@@ -63,6 +57,12 @@ static int smc9115_pre_init(void)
 int board_init(void)
 {
        gd->bd->bi_boot_params = (PHYS_SDRAM_1 + 0x100UL);
+#ifdef CONFIG_EXYNOS_SPI
+       spi_init();
+#endif
+#ifdef CONFIG_USB_EHCI_EXYNOS
+       board_usb_vbus_init();
+#endif
        return 0;
 }
 
@@ -79,6 +79,16 @@ int dram_init(void)
        return 0;
 }
 
+#if defined(CONFIG_POWER)
+int power_init_board(void)
+{
+       if (pmic_init(I2C_PMIC))
+               return -1;
+       else
+               return 0;
+}
+#endif
+
 void dram_init_banksize(void)
 {
        gd->bd->bi_dram[0].start = PHYS_SDRAM_1;
@@ -107,12 +117,94 @@ void dram_init_banksize(void)
                                                        PHYS_SDRAM_8_SIZE);
 }
 
+#ifdef CONFIG_OF_CONTROL
+static int decode_sromc(const void *blob, struct fdt_sromc *config)
+{
+       int err;
+       int node;
+
+       node = fdtdec_next_compatible(blob, 0, COMPAT_SAMSUNG_EXYNOS5_SROMC);
+       if (node < 0) {
+               debug("Could not find SROMC node\n");
+               return node;
+       }
+
+       config->bank = fdtdec_get_int(blob, node, "bank", 0);
+       config->width = fdtdec_get_int(blob, node, "width", 2);
+
+       err = fdtdec_get_int_array(blob, node, "srom-timing", config->timing,
+                       FDT_SROM_TIMING_COUNT);
+       if (err < 0) {
+               debug("Could not decode SROMC configuration\n");
+               return -FDT_ERR_NOTFOUND;
+       }
+
+       return 0;
+}
+#endif
+
 int board_eth_init(bd_t *bis)
 {
 #ifdef CONFIG_SMC911X
-       if (smc9115_pre_init())
+       u32 smc_bw_conf, smc_bc_conf;
+       struct fdt_sromc config;
+       fdt_addr_t base_addr;
+       int node;
+
+#ifdef CONFIG_OF_CONTROL
+       node = decode_sromc(gd->fdt_blob, &config);
+       if (node < 0) {
+               debug("%s: Could not find sromc configuration\n", __func__);
+               return 0;
+       }
+       node = fdtdec_next_compatible(gd->fdt_blob, node, COMPAT_SMSC_LAN9215);
+       if (node < 0) {
+               debug("%s: Could not find lan9215 configuration\n", __func__);
+               return 0;
+       }
+
+       /* We now have a node, so any problems from now on are errors */
+       base_addr = fdtdec_get_addr(gd->fdt_blob, node, "reg");
+       if (base_addr == FDT_ADDR_T_NONE) {
+               debug("%s: Could not find lan9215 address\n", __func__);
+               return -1;
+       }
+#else
+       /* Non-FDT configuration - bank number and timing parameters*/
+       config.bank = CONFIG_ENV_SROM_BANK;
+       config.width = 2;
+
+       config.timing[FDT_SROM_TACS] = 0x01;
+       config.timing[FDT_SROM_TCOS] = 0x01;
+       config.timing[FDT_SROM_TACC] = 0x06;
+       config.timing[FDT_SROM_TCOH] = 0x01;
+       config.timing[FDT_SROM_TAH] = 0x0C;
+       config.timing[FDT_SROM_TACP] = 0x09;
+       config.timing[FDT_SROM_PMC] = 0x01;
+       base_addr = CONFIG_SMC911X_BASE;
+#endif
+
+       /* Ethernet needs data bus width of 16 bits */
+       if (config.width != 2) {
+               debug("%s: Unsupported bus width %d\n", __func__,
+                       config.width);
                return -1;
-       return smc911x_initialize(0, CONFIG_SMC911X_BASE);
+       }
+       smc_bw_conf = SROMC_DATA16_WIDTH(config.bank)
+                       | SROMC_BYTE_ENABLE(config.bank);
+
+       smc_bc_conf = SROMC_BC_TACS(config.timing[FDT_SROM_TACS])   |\
+                       SROMC_BC_TCOS(config.timing[FDT_SROM_TCOS]) |\
+                       SROMC_BC_TACC(config.timing[FDT_SROM_TACC]) |\
+                       SROMC_BC_TCOH(config.timing[FDT_SROM_TCOH]) |\
+                       SROMC_BC_TAH(config.timing[FDT_SROM_TAH])   |\
+                       SROMC_BC_TACP(config.timing[FDT_SROM_TACP]) |\
+                       SROMC_BC_PMC(config.timing[FDT_SROM_PMC]);
+
+       /* Select and configure the SROMC bank */
+       exynos_pinmux_config(PERIPH_ID_SROMC, config.bank);
+       s5p_config_sromc(config.bank, smc_bw_conf, smc_bc_conf);
+       return smc911x_initialize(0, base_addr);
 #endif
        return 0;
 }
@@ -173,24 +265,6 @@ static int board_uart_init(void)
        return 0;
 }
 
-#ifdef CONFIG_SYS_I2C_INIT_BOARD
-static int board_i2c_init(void)
-{
-       int i, err;
-
-       for (i = 0; i < CONFIG_MAX_I2C_NUM; i++) {
-               err = exynos_pinmux_config((PERIPH_ID_I2C0 + i),
-                                               PINMUX_FLAG_NONE);
-               if (err) {
-                       debug("I2C%d not configured\n", (PERIPH_ID_I2C0 + i));
-                       return err;
-               }
-       }
-       i2c_init(CONFIG_SYS_I2C_SPEED, CONFIG_SYS_I2C_SLAVE);
-       return 0;
-}
-#endif
-
 #ifdef CONFIG_BOARD_EARLY_INIT_F
 int board_early_init_f(void)
 {
@@ -201,8 +275,104 @@ int board_early_init_f(void)
                return err;
        }
 #ifdef CONFIG_SYS_I2C_INIT_BOARD
-       err = board_i2c_init();
+       board_i2c_init(gd->fdt_blob);
 #endif
        return err;
 }
 #endif
+
+#ifdef CONFIG_LCD
+void cfg_lcd_gpio(void)
+{
+       struct exynos5_gpio_part1 *gpio1 =
+               (struct exynos5_gpio_part1 *) samsung_get_base_gpio_part1();
+
+       /* For Backlight */
+       s5p_gpio_cfg_pin(&gpio1->b2, 0, GPIO_OUTPUT);
+       s5p_gpio_set_value(&gpio1->b2, 0, 1);
+
+       /* LCD power on */
+       s5p_gpio_cfg_pin(&gpio1->x1, 5, GPIO_OUTPUT);
+       s5p_gpio_set_value(&gpio1->x1, 5, 1);
+
+       /* Set Hotplug detect for DP */
+       s5p_gpio_cfg_pin(&gpio1->x0, 7, GPIO_FUNC(0x3));
+}
+
+vidinfo_t panel_info = {
+       .vl_freq        = 60,
+       .vl_col         = 2560,
+       .vl_row         = 1600,
+       .vl_width       = 2560,
+       .vl_height      = 1600,
+       .vl_clkp        = CONFIG_SYS_LOW,
+       .vl_hsp         = CONFIG_SYS_LOW,
+       .vl_vsp         = CONFIG_SYS_LOW,
+       .vl_dp          = CONFIG_SYS_LOW,
+       .vl_bpix        = 4,    /* LCD_BPP = 2^4, for output conosle on LCD */
+
+       /* wDP panel timing infomation */
+       .vl_hspw        = 32,
+       .vl_hbpd        = 80,
+       .vl_hfpd        = 48,
+
+       .vl_vspw        = 6,
+       .vl_vbpd        = 37,
+       .vl_vfpd        = 3,
+       .vl_cmd_allow_len = 0xf,
+
+       .win_id         = 3,
+       .cfg_gpio       = cfg_lcd_gpio,
+       .backlight_on   = NULL,
+       .lcd_power_on   = NULL,
+       .reset_lcd      = NULL,
+       .dual_lcd_enabled = 0,
+
+       .init_delay     = 0,
+       .power_on_delay = 0,
+       .reset_delay    = 0,
+       .interface_mode = FIMD_RGB_INTERFACE,
+       .dp_enabled     = 1,
+};
+
+static struct edp_device_info edp_info = {
+       .disp_info = {
+               .h_res = 2560,
+               .h_sync_width = 32,
+               .h_back_porch = 80,
+               .h_front_porch = 48,
+               .v_res = 1600,
+               .v_sync_width  = 6,
+               .v_back_porch = 37,
+               .v_front_porch = 3,
+               .v_sync_rate = 60,
+       },
+       .lt_info = {
+               .lt_status = DP_LT_NONE,
+       },
+       .video_info = {
+               .master_mode = 0,
+               .bist_mode = DP_DISABLE,
+               .bist_pattern = NO_PATTERN,
+               .h_sync_polarity = 0,
+               .v_sync_polarity = 0,
+               .interlaced = 0,
+               .color_space = COLOR_RGB,
+               .dynamic_range = VESA,
+               .ycbcr_coeff = COLOR_YCBCR601,
+               .color_depth = COLOR_8,
+       },
+};
+
+static struct exynos_dp_platform_data dp_platform_data = {
+       .phy_enable     = set_dp_phy_ctrl,
+       .edp_dev_info   = &edp_info,
+};
+
+void init_panel_info(vidinfo_t *vid)
+{
+       vid->rgb_mode   = MODE_RGB_P,
+
+       exynos_set_dp_platform_data(&dp_platform_data);
+}
+#endif
diff --git a/board/samsung/smdk5250/spl_boot.c b/board/samsung/smdk5250/spl_boot.c
new file mode 100644 (file)
index 0000000..d8f3c1e
--- /dev/null
@@ -0,0 +1,85 @@
+/*
+ * 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>
+
+enum boot_mode {
+       BOOT_MODE_MMC = 4,
+       BOOT_MODE_SERIAL = 20,
+       /* Boot based on Operating Mode pin settings */
+       BOOT_MODE_OM = 32,
+       BOOT_MODE_USB,  /* Boot using USB download */
+};
+
+       typedef u32 (*spi_copy_func_t)(u32 offset, u32 nblock, u32 dst);
+
+/*
+* 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)
+{
+       spi_copy_func_t spi_copy;
+       enum boot_mode bootmode;
+       u32 (*copy_bl2)(u32, u32, u32);
+
+       bootmode = readl(EXYNOS5_POWER_BASE) & OM_STAT;
+
+       switch (bootmode) {
+       case BOOT_MODE_SERIAL:
+               spi_copy = *(spi_copy_func_t *)EXYNOS_COPY_SPI_FNPTR_ADDR;
+               spi_copy(SPI_FLASH_UBOOT_POS, CONFIG_BL2_SIZE,
+                                               CONFIG_SYS_TEXT_BASE);
+               break;
+       case BOOT_MODE_MMC:
+               copy_bl2 = (void *) *(u32 *)COPY_BL2_FNPTR_ADDR;
+               copy_bl2(BL2_START_OFFSET, BL2_SIZE_BLOC_COUNT,
+                                               CONFIG_SYS_TEXT_BASE);
+               break;
+       default:
+               break;
+       }
+}
+
+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) {}
index e540190984740da822678724a71ffed0764b1cb2..88d193de280437a0f566a2e27be21e3a7c930109 100644 (file)
@@ -29,6 +29,7 @@
 #include <asm/arch/cpu.h>
 #include <asm/arch/gpio.h>
 #include <asm/arch/mmc.h>
+#include <asm/arch/pinmux.h>
 #include <asm/arch/clock.h>
 #include <asm/arch/clk.h>
 #include <asm/arch/mipi_dsim.h>
@@ -66,7 +67,7 @@ struct s3c_plat_otg_data s5pc210_otg_data;
 
 int board_init(void)
 {
-       gd->bd->bi_boot_params = PHYS_SDRAM_1 + 0x100;
+       gd->bd->bi_boot_params = CONFIG_SYS_SPL_ARGS_ADDR;
 
        check_hw_revision();
        printf("HW Revision:\t0x%x\n", board_rev);
@@ -361,7 +362,9 @@ int power_init_board(void)
 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_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);
 
        return 0;
 }
@@ -372,6 +375,10 @@ void dram_init_banksize(void)
        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;
+       gd->bd->bi_dram[2].start = PHYS_SDRAM_3;
+       gd->bd->bi_dram[2].size = PHYS_SDRAM_3_SIZE;
+       gd->bd->bi_dram[3].start = PHYS_SDRAM_4;
+       gd->bd->bi_dram[3].size = PHYS_SDRAM_4_SIZE;
 }
 
 static unsigned int get_hw_revision(void)
@@ -419,54 +426,22 @@ int board_mmc_init(bd_t *bis)
 {
        struct exynos4_gpio_part2 *gpio =
                (struct exynos4_gpio_part2 *)samsung_get_base_gpio_part2();
-       int i, err;
+       int 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);
+       err = exynos_pinmux_config(PERIPH_ID_SDMMC0, PINMUX_FLAG_8BIT_MODE);
+       if (err)
+               debug("SDMMC0 not configured\n");
+       else
+               err = s5p_mmc_init(0, 8);
 
        /* T-flash detect */
        s5p_gpio_cfg_pin(&gpio->x3, 4, 0xf);
@@ -477,24 +452,11 @@ int board_mmc_init(bd_t *bis)
         * 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);
+               err = exynos_pinmux_config(PERIPH_ID_SDMMC2, PINMUX_FLAG_NONE);
+               if (err)
+                       debug("SDMMC2 not configured\n");
+               else
+                       err = s5p_mmc_init(2, 4);
        }
 
        return err;
@@ -629,6 +591,10 @@ static void board_power_init(void)
        writel(0, (unsigned int)&pwr->lcd1_configuration);
        writel(0, (unsigned int)&pwr->gps_configuration);
        writel(0, (unsigned int)&pwr->gps_alive_configuration);
+
+       /* It is necessary to power down core 1 */
+       /* to successfully boot CPU1 in kernel */
+       writel(0, (unsigned int)&pwr->arm_core1_configuration);
 }
 
 static void board_uart_init(void)
index bfec08fa8ea6c2676a5e06e9c92c467ff4c540a2..587cc1b8c70dded76858e4151908e4f6e40c6627 100644 (file)
@@ -26,7 +26,6 @@ include $(TOPDIR)/config.mk
 LIB    = $(obj)lib$(BOARD).o
 
 COBJS-y        := universal.o onenand.o
-SOBJS  := lowlevel_init.o
 
 SRCS    := $(SOBJS:.o=.S) $(COBJS-y:.o=.c)
 OBJS   := $(addprefix $(obj),$(COBJS-y))
diff --git a/board/samsung/universal_c210/lowlevel_init.S b/board/samsung/universal_c210/lowlevel_init.S
deleted file mode 100644 (file)
index dc7f69e..0000000
+++ /dev/null
@@ -1,395 +0,0 @@
-/*
- * Lowlevel setup for universal board based on EXYNOS4210
- *
- * Copyright (C) 2010 Samsung Electronics
- * 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 <config.h>
-#include <version.h>
-#include <asm/arch/cpu.h>
-#include <asm/arch/clock.h>
-
-/*
- * Register usages:
- *
- * r5 has zero always
- * r7 has GPIO part1 base 0x11400000
- * r6 has GPIO part2 base 0x11000000
- */
-
-       .globl lowlevel_init
-lowlevel_init:
-       mov     r11, lr
-
-       /* r5 has always zero */
-       mov     r5, #0
-
-       ldr     r7, =EXYNOS4_GPIO_PART1_BASE
-       ldr     r6, =EXYNOS4_GPIO_PART2_BASE
-
-       /* System Timer */
-       ldr     r0, =EXYNOS4_SYSTIMER_BASE
-       ldr     r1, =0x5000
-       str     r1, [r0, #0x0]
-       ldr     r1, =0xffffffff
-       str     r1, [r0, #0x8]
-       ldr     r1, =0x49
-       str     r1, [r0, #0x4]
-
-       /* PMIC manual reset */
-       /* nPOWER: XEINT_23: GPX2[7] */
-       add     r0, r6, #0xC40                  @ EXYNOS4_GPIO_X2_OFFSET
-       ldr     r1, [r0, #0x0]
-       bic     r1, r1, #(0xf << 28)            @ 28 = 7 * 4-bit
-       orr     r1, r1, #(0x1 << 28)            @ Output
-       str     r1, [r0, #0x0]
-
-       ldr     r1, [r0, #0x4]
-       orr     r1, r1, #(1 << 7)               @ 7 = 7 * 1-bit
-       str     r1, [r0, #0x4]
-
-       /* init system clock */
-       bl      system_clock_init
-
-       /* Disable Watchdog */
-       ldr     r0, =EXYNOS4_WATCHDOG_BASE              @0x10060000
-       str     r5, [r0]
-
-       /* UART */
-       bl      uart_asm_init
-
-       /* PMU init */
-       bl      system_power_init
-
-       bl      tzpc_init
-
-       mov     lr, r11
-       mov     pc, lr
-       nop
-       nop
-       nop
-
-/*
- * uart_asm_init: Initialize UART's pins
- */
-uart_asm_init:
-       /*
-        * setup UART0-UART4 GPIOs (part1)
-        * GPA1CON[3] = I2C_3_SCL (3)
-        * GPA1CON[2] = I2C_3_SDA (3)
-        */
-       mov     r0, r7
-       ldr     r1, =0x22222222
-       str     r1, [r0, #0x00]                 @ EXYNOS4_GPIO_A0_OFFSET
-       ldr     r1, =0x00223322
-       str     r1, [r0, #0x20]                 @ EXYNOS4_GPIO_A1_OFFSET
-
-       /* UART_SEL GPY4[7] (part2) at EXYNOS4 */
-       add     r0, r6, #0x1A0                  @ EXYNOS4_GPIO_Y4_OFFSET
-       ldr     r1, [r0, #0x0]
-       bic     r1, r1, #(0xf << 28)            @ 28 = 7 * 4-bit
-       orr     r1, r1, #(0x1 << 28)
-       str     r1, [r0, #0x0]
-
-       ldr     r1, [r0, #0x8]
-       bic     r1, r1, #(0x3 << 14)            @ 14 = 7 * 2-bit
-       orr     r1, r1, #(0x3 << 14)            @ Pull-up enabled
-       str     r1, [r0, #0x8]
-
-       ldr     r1, [r0, #0x4]
-       orr     r1, r1, #(1 << 7)               @ 7 = 7 * 1-bit
-       str     r1, [r0, #0x4]
-
-       mov     pc, lr
-       nop
-       nop
-       nop
-
-system_clock_init:
-       ldr     r0, =EXYNOS4_CLOCK_BASE
-
-       /* APLL(1), MPLL(1), CORE(0), HPM(0) */
-       ldr     r1, =0x0101
-       ldr     r2, =0x14200                    @ CLK_SRC_CPU
-       str     r1, [r0, r2]
-
-       /* wait ?us */
-       mov     r1, #0x10000
-1:     subs    r1, r1, #1
-       bne     1b
-
-       /*
-        * CLK_SRC_TOP0
-        * MUX_ONENAND_SEL[28]  0: DOUT133, 1: DOUT166
-        * MUX_VPLL_SEL[8]      0: FINPLL,  1: FOUTVPLL
-        * MUX_EPLL_SEL[4]      0: FINPLL,  1: FOUTEPLL
-        */
-       ldr     r1, =0x10000110
-       ldr     r2, =0x0C210                    @ CLK_SRC_TOP
-       str     r1, [r0, r2]
-
-       /* SATA: SCLKMPLL(0), MMC[0:4]: SCLKMPLL(6) */
-       ldr     r1, =0x0066666
-       ldr     r2, =0x0C240                    @ CLK_SRC_FSYS
-       str     r1, [r0, r2]
-       /* UART[0:5], PWM: SCLKMPLL(6) */
-       ldr     r1, =0x6666666
-       ldr     r2, =0x0C250                    @ CLK_SRC_PERIL0_OFFSET
-       str     r1, [r0, r2]
-
-       /* CPU0: CORE, COREM0, COREM1, PERI, ATB, PCLK_DBG, APLL */
-       ldr     r1, =0x0133730
-       ldr     r2, =0x14500                    @ CLK_DIV_CPU0
-       str     r1, [r0, r2]
-       /* CPU1: COPY, HPM */
-       ldr     r1, =0x03
-       ldr     r2, =0x14504                    @ CLK_DIV_CPU1
-       str     r1, [r0, r2]
-       /* DMC0: ACP, ACP_PCLK, DPHY, DMC, DMCD, DMCP, COPY2 CORE_TIMER */
-       ldr     r1, =0x13111113
-       ldr     r2, =0x10500                    @ CLK_DIV_DMC0
-       str     r1, [r0, r2]
-       /* DMC1: PWI, DVSEM, DPM */
-       ldr     r1, =0x01010100
-       ldr     r2, =0x10504                    @ CLK_DIV_DMC1
-       str     r1, [r0, r2]
-       /* LEFTBUS: GDL, GPL */
-       ldr     r1, =0x13
-       ldr     r2, =0x04500                    @ CLK_DIV_LEFTBUS
-       str     r1, [r0, r2]
-       /* RIGHHTBUS: GDR, GPR */
-       ldr     r1, =0x13
-       ldr     r2, =0x08500                    @ CLK_DIV_RIGHTBUS
-       str     r1, [r0, r2]
-       /*
-        * CLK_DIV_TOP
-        * ONENAND_RATIOD[18:16]: 0 SCLK_ONENAND = MOUTONENAND / (n + 1)
-        * ACLK_200, ACLK_100, ACLK_160, ACLK_133,
-        */
-       ldr     r1, =0x00005473
-       ldr     r2, =0x0C510                    @ CLK_DIV_TOP
-       str     r1, [r0, r2]
-       /* MMC[0:1] */
-       ldr     r1, =0x000f000f                 /* 800(MPLL) / (15 + 1) */
-       ldr     r2, =0x0C544                    @ CLK_DIV_FSYS1
-       str     r1, [r0, r2]
-       /* MMC[2:3] */
-       ldr     r1, =0x000f000f                 /* 800(MPLL) / (15 + 1) */
-       ldr     r2, =0x0C548                    @ CLK_DIV_FSYS2
-       str     r1, [r0, r2]
-       /* MMC4 */
-       ldr     r1, =0x000f                     /* 800(MPLL) / (15 + 1) */
-       ldr     r2, =0x0C54C                    @ CLK_DIV_FSYS3
-       str     r1, [r0, r2]
-       /* UART[0:5] */
-       ldr     r1, =0x774777
-       ldr     r2, =0x0C550                    @ CLK_DIV_PERIL0
-       str     r1, [r0, r2]
-       /* SLIMBUS: ???, PWM */
-       ldr     r1, =0x8
-       ldr     r2, =0x0C55C                    @ CLK_DIV_PERIL3
-       str     r1, [r0, r2]
-
-       /* PLL Setting */
-       ldr     r1, =0x1C20
-       ldr     r2, =0x14000                    @ APLL_LOCK
-       str     r1, [r0, r2]
-       ldr     r2, =0x14008                    @ MPLL_LOCK
-       str     r1, [r0, r2]
-       ldr     r2, =0x0C010                    @ EPLL_LOCK
-       str     r1, [r0, r2]
-       ldr     r2, =0x0C020                    @ VPLL_LOCK
-       str     r1, [r0, r2]
-
-       /* APLL */
-       ldr     r1, =0x8000001c
-       ldr     r2, =0x14104                    @ APLL_CON1
-       str     r1, [r0, r2]
-       ldr     r1, =0x80c80601                 @ 800MHz
-       ldr     r2, =0x14100                    @ APLL_CON0
-       str     r1, [r0, r2]
-       /* MPLL */
-       ldr     r1, =0x8000001C
-       ldr     r2, =0x1410C                    @ MPLL_CON1
-       str     r1, [r0, r2]
-       ldr     r1, =0x80c80601                 @ 800MHz
-       ldr     r2, =0x14108                    @ MPLL_CON0
-       str     r1, [r0, r2]
-       /* EPLL */
-       ldr     r1, =0x0
-       ldr     r2, =0x0C114                    @ EPLL_CON1
-       str     r1, [r0, r2]
-       ldr     r1, =0x80300302                 @ 96MHz
-       ldr     r2, =0x0C110                    @ EPLL_CON0
-       str     r1, [r0, r2]
-       /* VPLL */
-       ldr     r1, =0x11000400
-       ldr     r2, =0x0C124                    @ VPLL_CON1
-       str     r1, [r0, r2]
-       ldr     r1, =0x80350302                 @ 108MHz
-       ldr     r2, =0x0C120                    @ VPLL_CON0
-       str     r1, [r0, r2]
-
-       /*
-        * SMMUJPEG[11], JPEG[6], CSIS1[5]              : 0111 1001
-        * Turn off all
-        */
-       ldr     r1, =0xFFF80000
-       ldr     r2, =0x0C920                    @ CLK_GATE_IP_CAM
-       str     r1, [r0, r2]
-
-       /* Turn off all */
-       ldr     r1, =0xFFFFFFC0
-       ldr     r2, =0x0C924                    @ CLK_GATE_IP_VP
-       str     r1, [r0, r2]
-
-       /* Turn off all */
-       ldr     r1, =0xFFFFFFE0
-       ldr     r2, =0x0C928                    @ CLK_GATE_IP_MFC
-       str     r1, [r0, r2]
-
-       /* Turn off all */
-       ldr     r1, =0xFFFFFFFC
-       ldr     r2, =0x0C92C                    @ CLK_GATE_IP_G3D
-       str     r1, [r0, r2]
-
-       /* Turn off all */
-       ldr     r1, =0xFFFFFC00
-       ldr     r2, =0x0C930                    @ CLK_GATE_IP_IMAGE
-       str     r1, [r0, r2]
-
-       /* DSIM0[3], MDNIE0[2], MIE0[1]                 : 0001 */
-       ldr     r1, =0xFFFFFFF1
-       ldr     r2, =0x0C934                    @ CLK_GATE_IP_LCD0
-       str     r1, [r0, r2]
-
-       /* Turn off all */
-       ldr     r1, =0xFFFFFFC0
-       ldr     r2, =0x0C938                    @ CLK_GATE_IP_LCD1
-       str     r1, [r0, r2]
-
-       /*
-        * SMMUPCIE[18], NFCON[16]                      : 1111 1010
-        * PCIE[14],  SATA[10], SDMMC43[9:8]            : 1011 1000
-        * SDMMC1[6], TSI[4], SATAPHY[3], PCIEPHY[2]    : 1010 0011
-        */
-       ldr     r1, =0xFFFAB8A3
-       ldr     r2, =0x0C940                    @ CLK_GATE_IP_FSYS
-       str     r1, [r0, r2]
-
-       /* Turn off all */
-       ldr     r1, =0xFFFFFFFC
-       ldr     r2, =0x0C94C                    @ CLK_GATE_IP_GPS
-       str     r1, [r0, r2]
-
-       /*
-        * AC97[27], SPDIF[26], SLIMBUS[25]             : 1111 0001
-        * I2C2[8]                                      : 1111 1110
-        */
-       ldr     r1, =0xF1FFFEFF
-       ldr     r2, =0x0C950                    @ CLK_GATE_IP_PERIL
-       str     r1, [r0, r2]
-
-       /*
-        * KEYIF[16]                                    : 1111 1110
-        */
-       ldr     r1, =0xFFFEFFFF
-       ldr     r2, =0x0C960                    @ CLK_GATE_IP_PERIR
-       str     r1, [r0, r2]
-
-       /* LCD1[5], G3D[3], MFC[2], TV[1]               : 1101 0001 */
-       ldr     r1, =0xFFFFFFD1
-       ldr     r2, =0x0C970                    @ CLK_GATE_BLOCK
-       str     r1, [r0, r2]
-       mov     pc, lr
-       nop
-       nop
-       nop
-
-system_power_init:
-       ldr     r0, =EXYNOS4_POWER_BASE         @ 0x10020000
-
-       ldr     r2, =0x330C                     @ PS_HOLD_CONTROL
-       ldr     r1, [r0, r2]
-       orr     r1, r1, #(0x3 << 8)             @ Data High, Output En
-       str     r1, [r0, r2]
-
-       /* Power Down */
-       add     r2, r0, #0x3000
-       str     r5, [r2, #0xC20]                @ TV_CONFIGURATION
-       str     r5, [r2, #0xC40]                @ MFC_CONFIGURATION
-       str     r5, [r2, #0xC60]                @ G3D_CONFIGURATION
-       str     r5, [r2, #0xCA0]                @ LCD1_CONFIGURATION
-       str     r5, [r2, #0xCE0]                @ GPS_CONFIGURATION
-
-       mov     pc, lr
-       nop
-       nop
-       nop
-
-tzpc_init:
-       ldr     r0, =0x10110000
-       mov     r1, #0x0
-       str     r1, [r0]
-       mov     r1, #0xff
-       str     r1, [r0, #0x0804]
-       str     r1, [r0, #0x0810]
-       str     r1, [r0, #0x081C]
-       str     r1, [r0, #0x0828]
-
-       ldr     r0, =0x10120000
-       mov     r1, #0x0
-       str     r1, [r0]
-       mov     r1, #0xff
-       str     r1, [r0, #0x0804]
-       str     r1, [r0, #0x0810]
-       str     r1, [r0, #0x081C]
-       str     r1, [r0, #0x0828]
-
-       ldr     r0, =0x10130000
-       mov     r1, #0x0
-       str     r1, [r0]
-       mov     r1, #0xff
-       str     r1, [r0, #0x0804]
-       str     r1, [r0, #0x0810]
-       str     r1, [r0, #0x081C]
-       str     r1, [r0, #0x0828]
-
-       ldr     r0, =0x10140000
-       mov     r1, #0x0
-       str     r1, [r0]
-       mov     r1, #0xff
-       str     r1, [r0, #0x0804]
-       str     r1, [r0, #0x0810]
-       str     r1, [r0, #0x081C]
-       str     r1, [r0, #0x0828]
-
-       ldr     r0, =0x10150000
-       mov     r1, #0x0
-       str     r1, [r0]
-       mov     r1, #0xff
-       str     r1, [r0, #0x0804]
-       str     r1, [r0, #0x0810]
-       str     r1, [r0, #0x081C]
-       str     r1, [r0, #0x0828]
-
-       mov     pc, lr
index 36a047217c57cbdac1b07196fbb137bf0eb7f2d1..e742707f79659dca95b19fb4b6b91f27f093e0e8 100644 (file)
  */
 
 #include <common.h>
+#include <spi.h>
+#include <lcd.h>
 #include <asm/io.h>
+#include <asm/gpio.h>
 #include <asm/arch/adc.h>
 #include <asm/arch/gpio.h>
 #include <asm/arch/mmc.h>
+#include <asm/arch/pinmux.h>
+#include <asm/arch/watchdog.h>
+#include <libtizen.h>
+#include <ld9040.h>
 #include <power/pmic.h>
 #include <usb/s3c_udc.h>
 #include <asm/arch/cpu.h>
@@ -48,21 +55,7 @@ static int get_hwrev(void)
        return board_rev & 0xFF;
 }
 
-static void check_hw_revision(void);
-
-int board_init(void)
-{
-       gpio1 = (struct exynos4_gpio_part1 *) EXYNOS4_GPIO_PART1_BASE;
-       gpio2 = (struct exynos4_gpio_part2 *) EXYNOS4_GPIO_PART2_BASE;
-
-       gd->bd->bi_arch_number = MACH_TYPE_UNIVERSAL_C210;
-       gd->bd->bi_boot_params = PHYS_SDRAM_1 + 0x100;
-
-       check_hw_revision();
-       printf("HW Revision:\t0x%x\n", board_rev);
-
-       return 0;
-}
+static void init_pmic_lcd(void);
 
 int power_init_board(void)
 {
@@ -72,6 +65,8 @@ int power_init_board(void)
        if (ret)
                return ret;
 
+       init_pmic_lcd();
+
        return 0;
 }
 
@@ -186,7 +181,7 @@ int checkboard(void)
 #ifdef CONFIG_GENERIC_MMC
 int board_mmc_init(bd_t *bis)
 {
-       int i, err;
+       int err;
 
        switch (get_hwrev()) {
        case 0:
@@ -209,75 +204,30 @@ int board_mmc_init(bd_t *bis)
        }
 
        /*
-        * 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)
+        * MMC device init
+        * mmc0  : eMMC (8-bit buswidth)
+        * mmc2  : SD card (4-bit buswidth)
         */
-       for (i = 0; i < 7; i++) {
-               if (i == 2)
-                       continue;
-               /* GPK0[0:6] special function 2 */
-               s5p_gpio_cfg_pin(&gpio2->k0, i, 0x2);
-               /* GPK0[0:6] pull disable */
-               s5p_gpio_set_pull(&gpio2->k0, i, GPIO_PULL_NONE);
-               /* GPK0[0:6] drv 4x */
-               s5p_gpio_set_drv(&gpio2->k0, i, GPIO_DRV_4X);
-       }
-
-       for (i = 3; i < 7; i++) {
-               /* GPK1[3:6] special function 3 */
-               s5p_gpio_cfg_pin(&gpio2->k1, i, 0x3);
-               /* GPK1[3:6] pull disable */
-               s5p_gpio_set_pull(&gpio2->k1, i, GPIO_PULL_NONE);
-               /* GPK1[3:6] drv 4x */
-               s5p_gpio_set_drv(&gpio2->k1, i, GPIO_DRV_4X);
-       }
+       err = exynos_pinmux_config(PERIPH_ID_SDMMC0, PINMUX_FLAG_8BIT_MODE);
+       if (err)
+               debug("SDMMC0 not configured\n");
+       else
+               err = s5p_mmc_init(0, 8);
 
        /* T-flash detect */
        s5p_gpio_cfg_pin(&gpio2->x3, 4, 0xf);
        s5p_gpio_set_pull(&gpio2->x3, 4, GPIO_PULL_UP);
 
-       /*
-        * MMC device init
-        * mmc0  : eMMC (8-bit buswidth)
-        * mmc2  : SD card (4-bit buswidth)
-        */
-       err = s5p_mmc_init(0, 8);
-
        /*
         * Check the T-flash  detect pin
         * GPX3[4] T-flash detect pin
         */
        if (!s5p_gpio_get_value(&gpio2->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(&gpio2->k2, i, 0x2);
-                       /* GPK2[0:6] pull disable */
-                       s5p_gpio_set_pull(&gpio2->k2, i, GPIO_PULL_NONE);
-                       /* GPK2[0:6] drv 4x */
-                       s5p_gpio_set_drv(&gpio2->k2, i, GPIO_DRV_4X);
-               }
-               err = s5p_mmc_init(2, 4);
+               err = exynos_pinmux_config(PERIPH_ID_SDMMC2, PINMUX_FLAG_NONE);
+               if (err)
+                       debug("SDMMC2 not configured\n");
+               else
+                       err = s5p_mmc_init(2, 4);
        }
 
        return err;
@@ -331,3 +281,242 @@ struct s3c_plat_otg_data s5pc210_otg_data = {
        .usb_flags = PHY0_SLEEP,
 };
 #endif
+
+int board_early_init_f(void)
+{
+       wdt_stop();
+
+       return 0;
+}
+
+#ifdef CONFIG_SOFT_SPI
+static void soft_spi_init(void)
+{
+       gpio_direction_output(CONFIG_SOFT_SPI_GPIO_SCLK,
+               CONFIG_SOFT_SPI_MODE & SPI_CPOL);
+       gpio_direction_output(CONFIG_SOFT_SPI_GPIO_MOSI, 1);
+       gpio_direction_input(CONFIG_SOFT_SPI_GPIO_MISO);
+       gpio_direction_output(CONFIG_SOFT_SPI_GPIO_CS,
+               !(CONFIG_SOFT_SPI_MODE & SPI_CS_HIGH));
+}
+
+void spi_cs_activate(struct spi_slave *slave)
+{
+       gpio_set_value(CONFIG_SOFT_SPI_GPIO_CS,
+               !(CONFIG_SOFT_SPI_MODE & SPI_CS_HIGH));
+       SPI_SCL(1);
+       gpio_set_value(CONFIG_SOFT_SPI_GPIO_CS,
+               CONFIG_SOFT_SPI_MODE & SPI_CS_HIGH);
+}
+
+void spi_cs_deactivate(struct spi_slave *slave)
+{
+       gpio_set_value(CONFIG_SOFT_SPI_GPIO_CS,
+               !(CONFIG_SOFT_SPI_MODE & SPI_CS_HIGH));
+}
+
+int  spi_cs_is_valid(unsigned int bus, unsigned int cs)
+{
+       return bus == 0 && cs == 0;
+}
+
+void universal_spi_scl(int bit)
+{
+       gpio_set_value(CONFIG_SOFT_SPI_GPIO_SCLK, bit);
+}
+
+void universal_spi_sda(int bit)
+{
+       gpio_set_value(CONFIG_SOFT_SPI_GPIO_MOSI, bit);
+}
+
+int universal_spi_read(void)
+{
+       return gpio_get_value(CONFIG_SOFT_SPI_GPIO_MISO);
+}
+#endif
+
+static void init_pmic_lcd(void)
+{
+       unsigned char val;
+       int ret = 0;
+
+       struct pmic *p = pmic_get("MAX8998_PMIC");
+
+       if (!p)
+               return;
+
+       if (pmic_probe(p))
+               return;
+
+       /* LDO7 1.8V */
+       val = 0x02; /* (1800 - 1600) / 100; */
+       ret |= pmic_reg_write(p,  MAX8998_REG_LDO7, val);
+
+       /* LDO17 3.0V */
+       val = 0xe; /* (3000 - 1600) / 100; */
+       ret |= pmic_reg_write(p,  MAX8998_REG_LDO17, val);
+
+       /* Disable unneeded regulators */
+       /*
+        * ONOFF1
+        * Buck1 ON, Buck2 OFF, Buck3 ON, Buck4 ON
+        * LDO2 ON, LDO3 OFF, LDO4 OFF, LDO5 ON
+        */
+       val = 0xB9;
+       ret |= pmic_reg_write(p,  MAX8998_REG_ONOFF1, val);
+
+       /* ONOFF2
+        * LDO6 OFF, LDO7 ON, LDO8 OFF, LDO9 ON,
+        * LDO10 OFF, LDO11 OFF, LDO12 OFF, LDO13 OFF
+        */
+       val = 0x50;
+       ret |= pmic_reg_write(p,  MAX8998_REG_ONOFF2, val);
+
+       /* ONOFF3
+        * LDO14 OFF, LDO15 OFF, LGO16 OFF, LDO17 OFF
+        * EPWRHOLD OFF, EBATTMON OFF, ELBCNFG2 OFF, ELBCNFG1 OFF
+        */
+       val = 0x00;
+       ret |= pmic_reg_write(p,  MAX8998_REG_ONOFF3, val);
+
+       if (ret)
+               puts("LCD pmic initialisation error!\n");
+}
+
+static void lcd_cfg_gpio(void)
+{
+       unsigned int i, f3_end = 4;
+
+       for (i = 0; i < 8; i++) {
+               /* set GPF0,1,2[0:7] for RGB Interface and Data lines (32bit) */
+               s5p_gpio_cfg_pin(&gpio1->f0, i, GPIO_FUNC(2));
+               s5p_gpio_cfg_pin(&gpio1->f1, i, GPIO_FUNC(2));
+               s5p_gpio_cfg_pin(&gpio1->f2, i, GPIO_FUNC(2));
+               /* pull-up/down disable */
+               s5p_gpio_set_pull(&gpio1->f0, i, GPIO_PULL_NONE);
+               s5p_gpio_set_pull(&gpio1->f1, i, GPIO_PULL_NONE);
+               s5p_gpio_set_pull(&gpio1->f2, i, GPIO_PULL_NONE);
+
+               /* drive strength to max (24bit) */
+               s5p_gpio_set_drv(&gpio1->f0, i, GPIO_DRV_4X);
+               s5p_gpio_set_rate(&gpio1->f0, i, GPIO_DRV_SLOW);
+               s5p_gpio_set_drv(&gpio1->f1, i, GPIO_DRV_4X);
+               s5p_gpio_set_rate(&gpio1->f1, i, GPIO_DRV_SLOW);
+               s5p_gpio_set_drv(&gpio1->f2, i, GPIO_DRV_4X);
+               s5p_gpio_set_rate(&gpio1->f0, i, GPIO_DRV_SLOW);
+       }
+
+       for (i = 0; i < f3_end; i++) {
+               /* set GPF3[0:3] for RGB Interface and Data lines (32bit) */
+               s5p_gpio_cfg_pin(&gpio1->f3, i, GPIO_FUNC(2));
+               /* pull-up/down disable */
+               s5p_gpio_set_pull(&gpio1->f3, i, GPIO_PULL_NONE);
+               /* drive strength to max (24bit) */
+               s5p_gpio_set_drv(&gpio1->f3, i, GPIO_DRV_4X);
+               s5p_gpio_set_rate(&gpio1->f3, i, GPIO_DRV_SLOW);
+       }
+
+       /* gpio pad configuration for LCD reset. */
+       s5p_gpio_cfg_pin(&gpio2->y4, 5, GPIO_OUTPUT);
+
+       spi_init();
+}
+
+static void reset_lcd(void)
+{
+       s5p_gpio_set_value(&gpio2->y4, 5, 1);
+       udelay(10000);
+       s5p_gpio_set_value(&gpio2->y4, 5, 0);
+       udelay(10000);
+       s5p_gpio_set_value(&gpio2->y4, 5, 1);
+       udelay(100);
+}
+
+static void lcd_power_on(void)
+{
+       struct pmic *p = pmic_get("MAX8998_PMIC");
+
+       if (!p)
+               return;
+
+       if (pmic_probe(p))
+               return;
+
+       pmic_set_output(p, MAX8998_REG_ONOFF3, MAX8998_LDO17, LDO_ON);
+       pmic_set_output(p, MAX8998_REG_ONOFF2, MAX8998_LDO7, LDO_ON);
+}
+
+vidinfo_t panel_info = {
+       .vl_freq        = 60,
+       .vl_col         = 480,
+       .vl_row         = 800,
+       .vl_width       = 480,
+       .vl_height      = 800,
+       .vl_clkp        = CONFIG_SYS_HIGH,
+       .vl_hsp         = CONFIG_SYS_HIGH,
+       .vl_vsp         = CONFIG_SYS_HIGH,
+       .vl_dp          = CONFIG_SYS_HIGH,
+
+       .vl_bpix        = 5,    /* Bits per pixel */
+
+       /* LD9040 LCD Panel */
+       .vl_hspw        = 2,
+       .vl_hbpd        = 16,
+       .vl_hfpd        = 16,
+
+       .vl_vspw        = 2,
+       .vl_vbpd        = 8,
+       .vl_vfpd        = 8,
+       .vl_cmd_allow_len = 0xf,
+
+       .win_id         = 0,
+       .cfg_gpio       = lcd_cfg_gpio,
+       .backlight_on   = NULL,
+       .lcd_power_on   = lcd_power_on,
+       .reset_lcd      = reset_lcd,
+       .dual_lcd_enabled = 0,
+
+       .init_delay     = 0,
+       .power_on_delay = 10000,
+       .reset_delay    = 10000,
+       .interface_mode = FIMD_RGB_INTERFACE,
+       .mipi_enabled   = 0,
+};
+
+void init_panel_info(vidinfo_t *vid)
+{
+       vid->logo_on    = 1;
+       vid->resolution = HD_RESOLUTION;
+       vid->rgb_mode   = MODE_RGB_P;
+
+#ifdef CONFIG_TIZEN
+       get_tizen_logo_info(vid);
+#endif
+
+       /* for LD9040. */
+       vid->pclk_name = 1;     /* MPLL */
+       vid->sclk_div = 1;
+
+       vid->cfg_ldo = ld9040_cfg_ldo;
+       vid->enable_ldo = ld9040_enable_ldo;
+
+       setenv("lcdinfo", "lcd=ld9040");
+}
+
+int board_init(void)
+{
+       gpio1 = (struct exynos4_gpio_part1 *) EXYNOS4_GPIO_PART1_BASE;
+       gpio2 = (struct exynos4_gpio_part2 *) EXYNOS4_GPIO_PART2_BASE;
+
+       gd->bd->bi_arch_number = MACH_TYPE_UNIVERSAL_C210;
+       gd->bd->bi_boot_params = PHYS_SDRAM_1 + 0x100;
+
+#ifdef CONFIG_SOFT_SPI
+       soft_spi_init();
+#endif
+       check_hw_revision();
+       printf("HW Revision:\t0x%x\n", board_rev);
+
+       return 0;
+}
index fe5589d9314e2d3fc462989ebd42f09fcbe9a9c3..4f37c59d807011a73177594df805e98eaf47a90d 100644 (file)
@@ -33,6 +33,7 @@
 #include <asm/io.h>
 #include <asm/arch/imx-regs.h>
 #include <asm/arch/imx25-pinmux.h>
+#include <asm/arch/sys_proto.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
index 1471559909d3ad378e97e3ca08235fba0f4f167b..c9eea9b3045d92ed18845184f839a6154f83a09a 100644 (file)
@@ -98,9 +98,12 @@ int board_init(void)
        return 0;
 }
 
+#ifndef CONFIG_SPL_BUILD
 int misc_init_r(void)
 {
        char *eth_addr;
+       struct tam3517_module_info info;
+       int ret;
 
        dieid_num_r();
 
@@ -108,12 +111,13 @@ int misc_init_r(void)
        if (eth_addr)
                return 0;
 
-#ifndef CONFIG_SPL_BUILD
-       TAM3517_READ_MAC_FROM_EEPROM;
-#endif
+       TAM3517_READ_EEPROM(&info, ret);
+       if (!ret)
+               TAM3517_READ_MAC_FROM_EEPROM(&info);
 
        return 0;
 }
+#endif
 
 /*
  * Routine: set_muxconf_regs
index 9622a81280c8f87218e62be4b3d71454a0cc7649..c516c75a0066d2341365057fdb7d27e61734253f 100644 (file)
@@ -73,10 +73,10 @@ static struct {
 
 static struct panel_config lcd_cfg[] = {
        {
-       .timing_h       = PANEL_TIMING_H(4, 8, 41),
-       .timing_v       = PANEL_TIMING_V(2, 4, 10),
-       .pol_freq       = 0x00000000, /* Pol Freq */
-       .divisor        = 0x0001000d, /* 33Mhz Pixel Clock */
+       .timing_h       = PANEL_TIMING_H(40, 5, 2),
+       .timing_v       = PANEL_TIMING_V(8, 8, 2),
+       .pol_freq       = 0x00003000, /* Pol Freq */
+       .divisor        = 0x00010033, /* 9 Mhz Pixel Clock */
        .panel_type     = 0x01, /* TFT */
        .data_lines     = 0x03, /* 24 Bit RGB */
        .load_mode      = 0x02, /* Frame Mode */
@@ -258,21 +258,26 @@ int board_init(void)
        return 0;
 }
 
+#ifndef CONFIG_SPL_BUILD
 int misc_init_r(void)
 {
        char *eth_addr;
+       struct tam3517_module_info info;
+       int ret;
 
+       TAM3517_READ_EEPROM(&info, ret);
        dieid_num_r();
 
-       eth_addr = getenv("ethaddr");
-       if (eth_addr)
+       if (ret)
                return 0;
+       eth_addr = getenv("ethaddr");
+       if (!eth_addr)
+               TAM3517_READ_MAC_FROM_EEPROM(&info);
 
-#ifndef CONFIG_SPL_BUILD
-       TAM3517_READ_MAC_FROM_EEPROM;
-#endif
+       TAM3517_PRINT_SOM_INFO(&info);
        return 0;
 }
+#endif
 
 /*
  * Routine: set_muxconf_regs
index f0eca54c9e9626bcdd187e60d6b8b03501831f34..ed4229e258d24e58584b059abbf720625ebffbc8 100644 (file)
@@ -44,7 +44,7 @@ static struct uart_sys *uart_base = (struct uart_sys *)DEFAULT_UART_BASE;
 
 /* MII mode defines */
 #define MII_MODE_ENABLE                0x0
-#define RGMII_MODE_ENABLE      0xA
+#define RGMII_MODE_ENABLE      0x3A
 
 /* GPIO that controls power to DDR on EVM-SK */
 #define GPIO_DDR_VTT_EN                7
@@ -318,6 +318,8 @@ int board_init(void)
 
        gd->bd->bi_boot_params = PHYS_DRAM_1 + 0x100;
 
+       gpmc_init();
+
        return 0;
 }
 
index 8437ef515afed9dc4fa27162f2a1407400ed0fd2..02837082cb807fad040f8c4007c7bb7d218cdbfc 100644 (file)
@@ -171,6 +171,25 @@ static struct module_pin_mux mii1_pin_mux[] = {
        {-1},
 };
 
+static struct module_pin_mux nand_pin_mux[] = {
+       {OFFSET(gpmc_ad0), (MODE(0) | PULLUP_EN | RXACTIVE)},   /* NAND AD0 */
+       {OFFSET(gpmc_ad1), (MODE(0) | PULLUP_EN | RXACTIVE)},   /* NAND AD1 */
+       {OFFSET(gpmc_ad2), (MODE(0) | PULLUP_EN | RXACTIVE)},   /* NAND AD2 */
+       {OFFSET(gpmc_ad3), (MODE(0) | PULLUP_EN | RXACTIVE)},   /* NAND AD3 */
+       {OFFSET(gpmc_ad4), (MODE(0) | PULLUP_EN | RXACTIVE)},   /* NAND AD4 */
+       {OFFSET(gpmc_ad5), (MODE(0) | PULLUP_EN | RXACTIVE)},   /* NAND AD5 */
+       {OFFSET(gpmc_ad6), (MODE(0) | PULLUP_EN | RXACTIVE)},   /* NAND AD6 */
+       {OFFSET(gpmc_ad7), (MODE(0) | PULLUP_EN | RXACTIVE)},   /* NAND AD7 */
+       {OFFSET(gpmc_wait0), (MODE(0) | RXACTIVE | PULLUP_EN)}, /* NAND WAIT */
+       {OFFSET(gpmc_wpn), (MODE(7) | PULLUP_EN | RXACTIVE)},   /* NAND_WPN */
+       {OFFSET(gpmc_csn0), (MODE(0) | PULLUDEN)},      /* NAND_CS0 */
+       {OFFSET(gpmc_advn_ale), (MODE(0) | PULLUDEN)}, /* NAND_ADV_ALE */
+       {OFFSET(gpmc_oen_ren), (MODE(0) | PULLUDEN)},   /* NAND_OE */
+       {OFFSET(gpmc_wen), (MODE(0) | PULLUDEN)},       /* NAND_WEN */
+       {OFFSET(gpmc_be0n_cle), (MODE(0) | PULLUDEN)},  /* NAND_BE_CLE */
+       {-1},
+};
+
 void enable_uart0_pin_mux(void)
 {
        configure_module_pin_mux(uart0_pin_mux);
@@ -257,6 +276,9 @@ void enable_board_pin_mux(struct am335x_baseboard_id *header)
                /* In profile #2 i2c1 and spi0 conflict. */
                if (profile & ~PROFILE_2)
                        configure_module_pin_mux(i2c1_pin_mux);
+               /* Profiles 2 & 3 don't have NAND */
+               if (profile & ~(PROFILE_2 | PROFILE_3))
+                       configure_module_pin_mux(nand_pin_mux);
                else if (profile == PROFILE_2) {
                        configure_module_pin_mux(mmc1_pin_mux);
                        configure_module_pin_mux(spi0_pin_mux);
index f20ebed4524298c4d5bb777dd732f7ae509d1b1c..b829a792b2c49b06e04508ce3b2bf9b4f3eb225a 100644 (file)
@@ -144,8 +144,7 @@ static int get_board_revision(void)
  * Description: If we use SPL then there is no x-loader nor config header
  * so we have to setup the DDR timings ourself on both banks.
  */
-void get_board_mem_timings(u32 *mcfg, u32 *ctrla, u32 *ctrlb, u32 *rfr_ctrl,
-               u32 *mr)
+void get_board_mem_timings(struct board_sdrc_timings *timings)
 {
        int pop_mfr, pop_id;
 
@@ -156,29 +155,29 @@ void get_board_mem_timings(u32 *mcfg, u32 *ctrla, u32 *ctrlb, u32 *rfr_ctrl,
         */
        identify_nand_chip(&pop_mfr, &pop_id);
 
-       *mr = MICRON_V_MR_165;
+       timings->mr = MICRON_V_MR_165;
        switch (get_board_revision()) {
        case REVISION_C4:
                if (pop_mfr == NAND_MFR_STMICRO && pop_id == 0xba) {
                        /* 512MB DDR */
-                       *mcfg = NUMONYX_V_MCFG_165(512 << 20);
-                       *ctrla = NUMONYX_V_ACTIMA_165;
-                       *ctrlb = NUMONYX_V_ACTIMB_165;
-                       *rfr_ctrl = SDP_3430_SDRC_RFR_CTRL_165MHz;
+                       timings->mcfg = NUMONYX_V_MCFG_165(512 << 20);
+                       timings->ctrla = NUMONYX_V_ACTIMA_165;
+                       timings->ctrlb = NUMONYX_V_ACTIMB_165;
+                       timings->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;
+                       timings->mcfg = MICRON_V_MCFG_165(128 << 20);
+                       timings->ctrla = MICRON_V_ACTIMA_165;
+                       timings->ctrlb = MICRON_V_ACTIMB_165;
+                       timings->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);
-                       *ctrla = MICRON_V_ACTIMA_200;
-                       *ctrlb = MICRON_V_ACTIMB_200;
-                       *rfr_ctrl = SDP_3430_SDRC_RFR_CTRL_200MHz;
+                       timings->mcfg = MICRON_V_MCFG_200(256 << 20);
+                       timings->ctrla = MICRON_V_ACTIMA_200;
+                       timings->ctrlb = MICRON_V_ACTIMB_200;
+                       timings->rfr_ctrl = SDP_3430_SDRC_RFR_CTRL_200MHz;
                        break;
                }
        case REVISION_XM_A:
@@ -186,24 +185,24 @@ void get_board_mem_timings(u32 *mcfg, u32 *ctrla, u32 *ctrlb, u32 *rfr_ctrl,
        case REVISION_XM_C:
                if (pop_mfr == 0) {
                        /* 256MB DDR */
-                       *mcfg = MICRON_V_MCFG_200(256 << 20);
-                       *ctrla = MICRON_V_ACTIMA_200;
-                       *ctrlb = MICRON_V_ACTIMB_200;
-                       *rfr_ctrl = SDP_3430_SDRC_RFR_CTRL_200MHz;
+                       timings->mcfg = MICRON_V_MCFG_200(256 << 20);
+                       timings->ctrla = MICRON_V_ACTIMA_200;
+                       timings->ctrlb = MICRON_V_ACTIMB_200;
+                       timings->rfr_ctrl = SDP_3430_SDRC_RFR_CTRL_200MHz;
                } else {
                        /* 512MB DDR */
-                       *mcfg = NUMONYX_V_MCFG_165(512 << 20);
-                       *ctrla = NUMONYX_V_ACTIMA_165;
-                       *ctrlb = NUMONYX_V_ACTIMB_165;
-                       *rfr_ctrl = SDP_3430_SDRC_RFR_CTRL_165MHz;
+                       timings->mcfg = NUMONYX_V_MCFG_165(512 << 20);
+                       timings->ctrla = NUMONYX_V_ACTIMA_165;
+                       timings->ctrlb = NUMONYX_V_ACTIMB_165;
+                       timings->rfr_ctrl = SDP_3430_SDRC_RFR_CTRL_165MHz;
                }
                break;
        default:
                /* Assume 128MB and Micron/165MHz timings to be safe */
-               *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;
+               timings->mcfg = MICRON_V_MCFG_165(128 << 20);
+               timings->ctrla = MICRON_V_ACTIMA_165;
+               timings->ctrlb = MICRON_V_ACTIMB_165;
+               timings->rfr_ctrl = SDP_3430_SDRC_RFR_CTRL_165MHz;
        }
 }
 #endif
index 61fc7b55310f7748770c06ce457e623f6816988e..8a3aa0c5bfdad3234d424f0b98e34e58ab3b3791 100644 (file)
@@ -128,8 +128,7 @@ int board_init(void)
  * provides the timing values back to the function that configures
  * the memory.
  */
-void get_board_mem_timings(u32 *mcfg, u32 *ctrla, u32 *ctrlb, u32 *rfr_ctrl,
-               u32 *mr)
+void get_board_mem_timings(struct board_sdrc_timings *timings)
 {
        int pop_mfr, pop_id;
 
@@ -142,17 +141,17 @@ void get_board_mem_timings(u32 *mcfg, u32 *ctrla, u32 *ctrlb, u32 *rfr_ctrl,
 
        if (pop_mfr == NAND_MFR_HYNIX && pop_id == 0xbc) {
                /* 256MB DDR */
-               *mcfg = HYNIX_V_MCFG_200(256 << 20);
-               *ctrla = HYNIX_V_ACTIMA_200;
-               *ctrlb = HYNIX_V_ACTIMB_200;
+               timings->mcfg = HYNIX_V_MCFG_200(256 << 20);
+               timings->ctrla = HYNIX_V_ACTIMA_200;
+               timings->ctrlb = HYNIX_V_ACTIMB_200;
        } else {
                /* 128MB DDR */
-               *mcfg = MICRON_V_MCFG_165(128 << 20);
-               *ctrla = MICRON_V_ACTIMA_165;
-               *ctrlb = MICRON_V_ACTIMB_165;
+               timings->mcfg = MICRON_V_MCFG_165(128 << 20);
+               timings->ctrla = MICRON_V_ACTIMA_165;
+               timings->ctrlb = MICRON_V_ACTIMB_165;
        }
-       *rfr_ctrl = SDP_3430_SDRC_RFR_CTRL_165MHz;
-       *mr = MICRON_V_MR_165;
+       timings->rfr_ctrl = SDP_3430_SDRC_RFR_CTRL_165MHz;
+       timings->mr = MICRON_V_MR_165;
 }
 #endif
 
index 35f5e15fc24b61e132cdb7b6947a2f0d61e576cd..85685ee7c05193ae8b353ef45ec6874ba88dbac4 100644 (file)
@@ -188,16 +188,15 @@ int spl_start_uboot(void)
  * 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)
+void get_board_mem_timings(struct board_sdrc_timings *timings)
 {
        /* General SDRC config */
-       *mcfg = MICRON_V_MCFG_165(128 << 20);
-       *rfr_ctrl = SDP_3430_SDRC_RFR_CTRL_165MHz;
+       timings->mcfg = MICRON_V_MCFG_165(128 << 20);
+       timings->rfr_ctrl = SDP_3430_SDRC_RFR_CTRL_165MHz;
 
        /* AC timings */
-       *ctrla = MICRON_V_ACTIMA_165;
-       *ctrlb = MICRON_V_ACTIMB_165;
+       timings->ctrla = MICRON_V_ACTIMA_165;
+       timings->ctrlb = MICRON_V_ACTIMB_165;
 
-       *mr = MICRON_V_MR_165;
+       timings->mr = MICRON_V_MR_165;
 }
diff --git a/board/woodburn/Makefile b/board/woodburn/Makefile
new file mode 100644 (file)
index 0000000..b60163f
--- /dev/null
@@ -0,0 +1,43 @@
+#
+# Copyright (C) 2007, Guennadi Liakhovetski <lg@denx.de>
+#
+# (C) Copyright 2008-2009 Freescale Semiconductor, Inc.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 2 of
+# the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public 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  := woodburn.o
+SOBJS  := lowlevel_init.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/woodburn/imximage.cfg b/board/woodburn/imximage.cfg
new file mode 100644 (file)
index 0000000..b4cc8ec
--- /dev/null
@@ -0,0 +1,4 @@
+BOOT_FROM      sd
+
+# DDR2 init
+DATA 4 0xB8001010 0x00000304
diff --git a/board/woodburn/lowlevel_init.S b/board/woodburn/lowlevel_init.S
new file mode 100644 (file)
index 0000000..57fb1b1
--- /dev/null
@@ -0,0 +1,38 @@
+/*
+ * Copyright (C) 2007, Guennadi Liakhovetski <lg@denx.de>
+ *
+ * (C) Copyright 2008-2010 Freescale Semiconductor, Inc.
+ *
+ * Copyright (C) 2011, Stefano Babic <sbabic@denx.de>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+#include <config.h>
+#include <asm/arch/lowlevel_macro.S>
+
+.globl lowlevel_init
+lowlevel_init:
+
+       core_init
+
+       init_aips
+
+       init_max
+
+       init_m3if
+
+       mov pc, lr
diff --git a/board/woodburn/woodburn.c b/board/woodburn/woodburn.c
new file mode 100644 (file)
index 0000000..d74f360
--- /dev/null
@@ -0,0 +1,264 @@
+/*
+ * Copyright (C) 2012, Stefano Babic <sbabic@denx.de>
+ *
+ * Based on flea3.c and mx35pdk.c
+ *
+ * See file CREDITS for 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/errno.h>
+#include <asm/arch/imx-regs.h>
+#include <asm/arch/crm_regs.h>
+#include <asm/arch/clock.h>
+#include <asm/arch/mx35_pins.h>
+#include <asm/arch/iomux.h>
+#include <i2c.h>
+#include <power/pmic.h>
+#include <fsl_pmic.h>
+#include <mc13892.h>
+#include <mmc.h>
+#include <fsl_esdhc.h>
+#include <linux/types.h>
+#include <asm/gpio.h>
+#include <asm/arch/sys_proto.h>
+#include <netdev.h>
+#include <spl.h>
+
+#define CCM_CCMR_CONFIG                0x003F4208
+
+#define ESDCTL_DDR2_CONFIG     0x007FFC3F
+
+/* For MMC */
+#define GPIO_MMC_CD    7
+#define GPIO_MMC_WP    8
+
+DECLARE_GLOBAL_DATA_PTR;
+
+int dram_init(void)
+{
+       gd->ram_size = get_ram_size((long *)PHYS_SDRAM_1,
+               PHYS_SDRAM_1_SIZE);
+
+       return 0;
+}
+
+static void board_setup_sdram(void)
+{
+       struct esdc_regs *esdc = (struct esdc_regs *)ESDCTL_BASE_ADDR;
+
+       /* Initialize with default values both CSD0/1 */
+       writel(0x2000, &esdc->esdctl0);
+       writel(0x2000, &esdc->esdctl1);
+
+       mx3_setup_sdram_bank(CSD0_BASE_ADDR, ESDCTL_DDR2_CONFIG,
+                13, 10, 2, 0x8080);
+}
+
+static void setup_iomux_fec(void)
+{
+       /* setup pins for FEC */
+       mxc_request_iomux(MX35_PIN_FEC_TX_CLK, MUX_CONFIG_FUNC);
+       mxc_request_iomux(MX35_PIN_FEC_RX_CLK, MUX_CONFIG_FUNC);
+       mxc_request_iomux(MX35_PIN_FEC_RX_DV, MUX_CONFIG_FUNC);
+       mxc_request_iomux(MX35_PIN_FEC_COL, MUX_CONFIG_FUNC);
+       mxc_request_iomux(MX35_PIN_FEC_RDATA0, MUX_CONFIG_FUNC);
+       mxc_request_iomux(MX35_PIN_FEC_TDATA0, MUX_CONFIG_FUNC);
+       mxc_request_iomux(MX35_PIN_FEC_TX_EN, MUX_CONFIG_FUNC);
+       mxc_request_iomux(MX35_PIN_FEC_MDC, MUX_CONFIG_FUNC);
+       mxc_request_iomux(MX35_PIN_FEC_MDIO, MUX_CONFIG_FUNC);
+       mxc_request_iomux(MX35_PIN_FEC_TX_ERR, MUX_CONFIG_FUNC);
+       mxc_request_iomux(MX35_PIN_FEC_RX_ERR, MUX_CONFIG_FUNC);
+       mxc_request_iomux(MX35_PIN_FEC_CRS, MUX_CONFIG_FUNC);
+       mxc_request_iomux(MX35_PIN_FEC_RDATA1, MUX_CONFIG_FUNC);
+       mxc_request_iomux(MX35_PIN_FEC_TDATA1, MUX_CONFIG_FUNC);
+       mxc_request_iomux(MX35_PIN_FEC_RDATA2, MUX_CONFIG_FUNC);
+       mxc_request_iomux(MX35_PIN_FEC_TDATA2, MUX_CONFIG_FUNC);
+       mxc_request_iomux(MX35_PIN_FEC_RDATA3, MUX_CONFIG_FUNC);
+       mxc_request_iomux(MX35_PIN_FEC_TDATA3, MUX_CONFIG_FUNC);
+}
+
+int woodburn_init(void)
+{
+       struct ccm_regs *ccm =
+               (struct ccm_regs *)IMX_CCM_BASE;
+
+       /* initialize PLL and clock configuration */
+       writel(CCM_CCMR_CONFIG, &ccm->ccmr);
+
+       /* Set-up RAM */
+       board_setup_sdram();
+
+       /* enable clocks */
+       writel(readl(&ccm->cgr0) |
+               MXC_CCM_CGR0_EMI_MASK |
+               MXC_CCM_CGR0_EDIO_MASK |
+               MXC_CCM_CGR0_EPIT1_MASK,
+               &ccm->cgr0);
+
+       writel(readl(&ccm->cgr1) |
+               MXC_CCM_CGR1_FEC_MASK |
+               MXC_CCM_CGR1_GPIO1_MASK |
+               MXC_CCM_CGR1_GPIO2_MASK |
+               MXC_CCM_CGR1_GPIO3_MASK |
+               MXC_CCM_CGR1_I2C1_MASK |
+               MXC_CCM_CGR1_I2C2_MASK |
+               MXC_CCM_CGR1_I2C3_MASK,
+               &ccm->cgr1);
+
+       /* Set-up NAND */
+       __raw_writel(readl(&ccm->rcsr) | MXC_CCM_RCSR_NFC_FMS, &ccm->rcsr);
+
+       /* Set pinmux for the required peripherals */
+       setup_iomux_fec();
+
+       /* setup GPIO1_4 FEC_ENABLE signal */
+       mxc_request_iomux(MX35_PIN_SCKR, MUX_CONFIG_ALT5);
+       gpio_direction_output(4, 1);
+       mxc_request_iomux(MX35_PIN_HCKT, MUX_CONFIG_ALT5);
+       gpio_direction_output(9, 1);
+
+       return 0;
+}
+
+#if defined(CONFIG_SPL_BUILD)
+void board_init_f(ulong dummy)
+{
+       /* Set the stack pointer. */
+       asm volatile("mov sp, %0\n" : : "r"(CONFIG_SPL_STACK));
+
+       /* Initialize MUX and SDRAM */
+       woodburn_init();
+
+       /* Clear the BSS. */
+       memset(__bss_start, 0, __bss_end__ - __bss_start);
+
+       /* Set global data pointer. */
+       gd = &gdata;
+
+       preloader_console_init();
+       timer_init();
+
+       board_init_r(NULL, 0);
+}
+
+void spl_board_init(void)
+{
+}
+
+#endif
+
+
+/* Booting from NOR in external mode */
+int board_early_init_f(void)
+{
+       return woodburn_init();
+}
+
+
+int board_init(void)
+{
+       struct pmic *p;
+       u32 val;
+       int ret;
+
+       /* address of boot parameters */
+       gd->bd->bi_boot_params = PHYS_SDRAM_1 + 0x100;
+
+       ret = pmic_init(I2C_PMIC);
+       if (ret)
+               return ret;
+
+       p = pmic_get("FSL_PMIC");
+
+       /*
+        * Set switchers in Auto in NORMAL mode & STANDBY mode
+        * Setup the switcher mode for SW1 & SW2
+        */
+       pmic_reg_read(p, REG_SW_4, &val);
+       val = (val & ~((SWMODE_MASK << SWMODE1_SHIFT) |
+               (SWMODE_MASK << SWMODE2_SHIFT)));
+       val |= (SWMODE_AUTO_AUTO << SWMODE1_SHIFT) |
+               (SWMODE_AUTO_AUTO << SWMODE2_SHIFT);
+       /* Set SWILIMB */
+       val |= (1 << 22);
+       pmic_reg_write(p, REG_SW_4, val);
+
+       /* Setup the switcher mode for SW3 & SW4 */
+       pmic_reg_read(p, REG_SW_5, &val);
+       val &= ~((SWMODE_MASK << SWMODE4_SHIFT) |
+               (SWMODE_MASK << SWMODE3_SHIFT));
+       val |= (SWMODE_AUTO_AUTO << SWMODE4_SHIFT) |
+               (SWMODE_AUTO_AUTO << SWMODE3_SHIFT);
+       pmic_reg_write(p, REG_SW_5, val);
+
+       /* Set VGEN1 to 3.15V */
+       pmic_reg_read(p, REG_SETTING_0, &val);
+       val &= ~(VGEN1_MASK);
+       val |= VGEN1_3_15;
+       pmic_reg_write(p, REG_SETTING_0, val);
+
+       pmic_reg_read(p, REG_MODE_0, &val);
+       val |= VGEN1EN;
+       pmic_reg_write(p, REG_MODE_0, val);
+       udelay(2000);
+
+       return 0;
+}
+
+#if defined(CONFIG_FSL_ESDHC)
+struct fsl_esdhc_cfg esdhc_cfg = {MMC_SDHC1_BASE_ADDR};
+
+int board_mmc_init(bd_t *bis)
+{
+       /* configure pins for SDHC1 only */
+       mxc_request_iomux(MX35_PIN_SD1_CMD, MUX_CONFIG_FUNC);
+       mxc_request_iomux(MX35_PIN_SD1_CLK, MUX_CONFIG_FUNC);
+       mxc_request_iomux(MX35_PIN_SD1_DATA0, MUX_CONFIG_FUNC);
+       mxc_request_iomux(MX35_PIN_SD1_DATA1, MUX_CONFIG_FUNC);
+       mxc_request_iomux(MX35_PIN_SD1_DATA2, MUX_CONFIG_FUNC);
+       mxc_request_iomux(MX35_PIN_SD1_DATA3, MUX_CONFIG_FUNC);
+
+       /* MMC Card Detect on GPIO1_7 */
+       mxc_request_iomux(MX35_PIN_SCKT, MUX_CONFIG_ALT5);
+       mxc_iomux_set_input(MUX_IN_GPIO1_IN_7, 0x1);
+       gpio_direction_input(GPIO_MMC_CD);
+
+       mxc_request_iomux(MX35_PIN_FST, MUX_CONFIG_ALT5);
+       mxc_iomux_set_input(MUX_IN_GPIO1_IN_8, 0x1);
+       gpio_direction_output(GPIO_MMC_WP, 0);
+
+       esdhc_cfg.sdhc_clk = mxc_get_clock(MXC_ESDHC1_CLK);
+
+       return fsl_esdhc_initialize(bis, &esdhc_cfg);
+}
+
+int board_mmc_getcd(struct mmc *mmc)
+{
+       return !gpio_get_value(GPIO_MMC_CD);
+}
+#endif
+
+u32 get_board_rev(void)
+{
+       int rev = 0;
+
+       return (get_cpu_rev() & ~(0xF << 8)) | (rev & 0xF) << 8;
+}
index 47baaa070769ae9fbdd52a0fccc79bda2f3d3b3d..6d71f18ffe5ea33ebcac3e8c91a6074c9d51e0a9 100644 (file)
@@ -50,6 +50,8 @@ tt01                         arm         arm1136     -                   hale
 imx31_litekit                arm         arm1136     -                   logicpd        mx31
 flea3                        arm         arm1136     -                   CarMediaLab    mx35
 mx35pdk                      arm         arm1136     -                   freescale      mx35
+woodburn                     arm         arm1136     -                   -              mx35
+woodburn_sd                  arm         arm1136     woodburn            -              mx35        woodburn_sd:IMX_CONFIG=board/woodburn/imximage.cfg
 omap2420h4                   arm         arm1136     -                   ti             omap24xx
 tnetv107x_evm                arm         arm1176     tnetv107xevm        ti             tnetv107x
 rpi_b                        arm         arm1176     rpi_b               raspberrypi    bcm2835
@@ -97,6 +99,7 @@ at91sam9m10g45ek_nandflash   arm         arm926ejs   at91sam9m10g45ek    atmel
 at91sam9rlek_dataflash       arm         arm926ejs   at91sam9rlek        atmel          at91        at91sam9rlek:AT91SAM9RL,SYS_USE_DATAFLASH
 at91sam9rlek_nandflash       arm         arm926ejs   at91sam9rlek        atmel          at91        at91sam9rlek:AT91SAM9RL,SYS_USE_NANDFLASH
 at91sam9x5ek_nandflash       arm         arm926ejs   at91sam9x5ek        atmel          at91        at91sam9x5ek:AT91SAM9X5,SYS_USE_NANDFLASH
+at91sam9x5ek_dataflash       arm         arm926ejs   at91sam9x5ek        atmel          at91        at91sam9x5ek:AT91SAM9X5,SYS_USE_DATAFLASH
 at91sam9x5ek_spiflash        arm         arm926ejs   at91sam9x5ek        atmel          at91        at91sam9x5ek:AT91SAM9X5,SYS_USE_SPIFLASH
 at91sam9x5ek_mmc             arm         arm926ejs   at91sam9x5ek        atmel          at91        at91sam9x5ek:AT91SAM9X5,SYS_USE_MMC
 at91sam9xeek_dataflash_cs0   arm         arm926ejs   at91sam9260ek       atmel          at91        at91sam9260ek:AT91SAM9XE,SYS_USE_DATAFLASH_CS0
@@ -169,6 +172,7 @@ netspace_lite_v2             arm         arm926ejs   netspace_v2         LaCie
 netspace_max_v2              arm         arm926ejs   netspace_v2         LaCie          kirkwood       lacie_kw:NETSPACE_MAX_V2
 netspace_mini_v2             arm         arm926ejs   netspace_v2         LaCie          kirkwood       lacie_kw:NETSPACE_MINI_V2
 netspace_v2                  arm         arm926ejs   netspace_v2         LaCie          kirkwood       lacie_kw:NETSPACE_V2
+wireless_space               arm         arm926ejs   wireless_space      LaCie          kirkwood
 dreamplug                    arm         arm926ejs   -                   Marvell        kirkwood
 guruplug                     arm         arm926ejs   -                   Marvell        kirkwood
 mv88f6281gtw_ge              arm         arm926ejs   -                   Marvell        kirkwood
@@ -373,8 +377,8 @@ M5235EVB                     m68k        mcf523x     m5235evb            freesca
 M5235EVB_Flash32             m68k        mcf523x     m5235evb            freescale      -           M5235EVB:NORFLASH_PS32BIT,SYS_TEXT_BASE=0xFFC00000
 cobra5272                    m68k        mcf52x2     cobra5272           -
 idmr                         m68k        mcf52x2
-eb_cpu5282                   m68k        mcf52x2     eb_cpu5282          BuS            -           eb_cpu5282:SYS_TEXT_BASE=0xFF000000
-eb_cpu5282_internal          m68k        mcf52x2     eb_cpu5282          BuS            -           eb_cpu5282:SYS_TEXT_BASE=0xF0000000
+eb_cpu5282                   m68k        mcf52x2     eb_cpu5282          BuS            -           eb_cpu5282:SYS_TEXT_BASE=0xFF000000,SYS_MONITOR_BASE=0xFF000400
+eb_cpu5282_internal          m68k        mcf52x2     eb_cpu5282          BuS            -           eb_cpu5282:SYS_TEXT_BASE=0xF0000000,SYS_MONITOR_BASE=0xF0000418
 TASREG                       m68k        mcf52x2     tasreg              esd
 M5208EVBE                    m68k        mcf52x2     m5208evbe           freescale
 M5249EVB                     m68k        mcf52x2     m5249evb            freescale
@@ -1089,6 +1093,7 @@ ecovec                       sh          sh4         ecovec              renesas
 MigoR                        sh          sh4         MigoR               renesas        -
 r2dplus                      sh          sh4         r2dplus             renesas        -
 r7780mp                      sh          sh4         r7780mp             renesas        -
+sh7752evb                    sh          sh4         sh7752evb           renesas        -
 sh7757lcr                    sh          sh4         sh7757lcr           renesas        -
 sh7763rdp                    sh          sh4         sh7763rdp           renesas        -
 sh7785lcr                    sh          sh4         sh7785lcr           renesas        -
index c77439556e2ba5e265a73c08e791e2bc3ee19372..54fcc815889c2165d900d89802c8650cea74c188 100644 (file)
@@ -79,6 +79,7 @@ COBJS-$(CONFIG_CMD_CONSOLE) += cmd_console.o
 COBJS-$(CONFIG_CMD_CPLBINFO) += cmd_cplbinfo.o
 COBJS-$(CONFIG_DATAFLASH_MMC_SELECT) += cmd_dataflash_mmc_mux.o
 COBJS-$(CONFIG_CMD_DATE) += cmd_date.o
+COBJS-$(CONFIG_CMD_SOUND) += cmd_sound.o
 ifdef CONFIG_4xx
 COBJS-$(CONFIG_CMD_SETGETDCR) += cmd_dcr.o
 endif
index f7595c0311955b58acffa6efd2b19a209576ec48..1b8a8c15610f68954643f967081d61ca8eee0e74 100644 (file)
@@ -592,12 +592,18 @@ int do_bootm(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 #ifdef CONFIG_NEEDS_MANUAL_RELOC
        static int relocated = 0;
 
-       /* relocate boot function table */
        if (!relocated) {
                int i;
+
+               /* relocate boot function table */
                for (i = 0; i < ARRAY_SIZE(boot_os); i++)
                        if (boot_os[i] != NULL)
                                boot_os[i] += gd->reloc_off;
+
+               /* relocate names of sub-command table */
+               for (i = 0; i < ARRAY_SIZE(cmd_bootm_sub); i++)
+                       cmd_bootm_sub[i].name += gd->reloc_off;
+
                relocated = 1;
        }
 #endif
index 4d64cfffde8040bb397f373d52b63fb927f27cee..0f3ffc84ff568f5f8f01c94fd75f316d4d5cc6ad 100644 (file)
@@ -33,6 +33,9 @@
 #include <dataflash.h>
 #endif
 #include <watchdog.h>
+#include <linux/compiler.h>
+
+DECLARE_GLOBAL_DATA_PTR;
 
 static int mod_mem(cmd_tbl_t *, int, int, int, char * const []);
 
@@ -1203,6 +1206,22 @@ U_BOOT_CMD(
 
 #endif
 
+#ifdef CONFIG_CMD_MEMINFO
+__weak void board_show_dram(ulong size)
+{
+       puts("DRAM:  ");
+       print_size(size, "\n");
+}
+
+static int do_mem_info(cmd_tbl_t *cmdtp, int flag, int argc,
+                      char * const argv[])
+{
+       board_show_dram(gd->ram_size);
+
+       return 0;
+}
+#endif
+
 U_BOOT_CMD(
        base,   2,      1,      do_mem_base,
        "print or set address offset",
@@ -1243,3 +1262,11 @@ U_BOOT_CMD(
        "[.b, .w, .l] address value delay(ms)"
 );
 #endif /* CONFIG_MX_CYCLIC */
+
+#ifdef CONFIG_CMD_MEMINFO
+U_BOOT_CMD(
+       meminfo,        3,      1,      do_mem_info,
+       "display memory information",
+       ""
+);
+#endif
index 7b140deea398b32e3a0be83b2349580be0ee8dcb..5a042951da568b49f45d56f7840eedc190e72402 100644 (file)
@@ -57,12 +57,22 @@ static int do_setexpr(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
        int w;
 
        /* Validate arguments */
-       if ((argc != 5) || (strlen(argv[3]) != 1))
+       if (argc != 5 && argc != 3)
+               return CMD_RET_USAGE;
+       if (argc == 5 && strlen(argv[3]) != 1)
                return CMD_RET_USAGE;
 
        w = cmd_get_data_size(argv[0], 4);
 
        a = get_arg(argv[2], w);
+
+       if (argc == 3) {
+               sprintf(buf, "%lx", a);
+               setenv(argv[1], buf);
+
+               return 0;
+       }
+
        b = get_arg(argv[4], w);
 
        switch (argv[3][0]) {
@@ -87,8 +97,11 @@ static int do_setexpr(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 U_BOOT_CMD(
        setexpr, 5, 0, do_setexpr,
        "set environment variable as the result of eval expression",
-       "[.b, .w, .l] name value1 <op> value2\n"
+       "[.b, .w, .l] name [*]value1 <op> [*]value2\n"
        "    - set environment variable 'name' to the result of the evaluated\n"
        "      express specified by <op>.  <op> can be &, |, ^, +, -, *, /, %\n"
-       "      size argument is only meaningful if value1 and/or value2 are memory addresses"
+       "      size argument is only meaningful if value1 and/or value2 are\n"
+       "      memory addresses (*)\n"
+       "setexpr[.b, .w, .l] name *value\n"
+       "    - load a memory address into a variable"
 );
index 5ac1d0c4c1ef4ef9cc34b30b3e056b2a76744beb..b1753587d3c92f1273e66acab040bad9efca5761 100644 (file)
@@ -5,6 +5,7 @@
  * Licensed under the GPL-2 or later.
  */
 
+#include <div64.h>
 #include <common.h>
 #include <malloc.h>
 #include <spi_flash.h>
@@ -67,6 +68,23 @@ static int sf_parse_len_arg(char *arg, ulong *len)
        return 1;
 }
 
+/**
+ * This function takes a byte length and a delta unit of time to compute the
+ * approximate bytes per second
+ *
+ * @param len          amount of bytes currently processed
+ * @param start_ms     start time of processing in ms
+ * @return bytes per second if OK, 0 on error
+ */
+static ulong bytes_per_second(unsigned int len, ulong start_ms)
+{
+       /* less accurate but avoids overflow */
+       if (len >= ((unsigned int) -1) / 1024)
+               return len / (max(get_timer(start_ms) / 1024, 1));
+       else
+               return 1024 * len / max(get_timer(start_ms), 1);
+}
+
 static int do_spi_flash_probe(int argc, char * const argv[])
 {
        unsigned int bus = CONFIG_SF_DEFAULT_BUS;
@@ -167,11 +185,26 @@ static int spi_flash_update(struct spi_flash *flash, u32 offset,
        const char *end = buf + len;
        size_t todo;            /* number of bytes to do in this pass */
        size_t skipped = 0;     /* statistics */
+       const ulong start_time = get_timer(0);
+       size_t scale = 1;
+       const char *start_buf = buf;
+       ulong delta;
 
+       if (end - buf >= 200)
+               scale = (end - buf) / 100;
        cmp_buf = malloc(flash->sector_size);
        if (cmp_buf) {
+               ulong last_update = get_timer(0);
+
                for (; buf < end && !err_oper; buf += todo, offset += todo) {
                        todo = min(end - buf, flash->sector_size);
+                       if (get_timer(last_update) > 100) {
+                               printf("   \rUpdating, %zu%% %lu B/s",
+                                       100 - (end - buf) / scale,
+                                       bytes_per_second(buf - start_buf,
+                                                        start_time));
+                               last_update = get_timer(0);
+                       }
                        err_oper = spi_flash_update_block(flash, offset, todo,
                                        buf, cmp_buf, &skipped);
                }
@@ -179,12 +212,17 @@ static int spi_flash_update(struct spi_flash *flash, u32 offset,
                err_oper = "malloc";
        }
        free(cmp_buf);
+       putc('\r');
        if (err_oper) {
                printf("SPI flash failed in %s step\n", err_oper);
                return 1;
        }
-       printf("%zu bytes written, %zu bytes skipped\n", len - skipped,
-              skipped);
+
+       delta = get_timer(start_time);
+       printf("%zu bytes written, %zu bytes skipped", len - skipped,
+               skipped);
+       printf(" in %ld.%lds, speed %ld B/s\n",
+               delta / 1000, delta % 1000, bytes_per_second(len, start_time));
 
        return 0;
 }
@@ -275,6 +313,161 @@ static int do_spi_flash_erase(int argc, char * const argv[])
        return 0;
 }
 
+#ifdef CONFIG_CMD_SF_TEST
+enum {
+       STAGE_ERASE,
+       STAGE_CHECK,
+       STAGE_WRITE,
+       STAGE_READ,
+
+       STAGE_COUNT,
+};
+
+static char *stage_name[STAGE_COUNT] = {
+       "erase",
+       "check",
+       "write",
+       "read",
+};
+
+struct test_info {
+       int stage;
+       int bytes;
+       unsigned base_ms;
+       unsigned time_ms[STAGE_COUNT];
+};
+
+static void show_time(struct test_info *test, int stage)
+{
+       uint64_t speed; /* KiB/s */
+       int bps;        /* Bits per second */
+
+       speed = (long long)test->bytes * 1000;
+       do_div(speed, test->time_ms[stage] * 1024);
+       bps = speed * 8;
+
+       printf("%d %s: %d ticks, %d KiB/s %d.%03d Mbps\n", stage,
+              stage_name[stage], test->time_ms[stage],
+              (int)speed, bps / 1000, bps % 1000);
+}
+
+static void spi_test_next_stage(struct test_info *test)
+{
+       test->time_ms[test->stage] = get_timer(test->base_ms);
+       show_time(test, test->stage);
+       test->base_ms = get_timer(0);
+       test->stage++;
+}
+
+/**
+ * Run a test on the SPI flash
+ *
+ * @param flash                SPI flash to use
+ * @param buf          Source buffer for data to write
+ * @param len          Size of data to read/write
+ * @param offset       Offset within flash to check
+ * @param vbuf         Verification buffer
+ * @return 0 if ok, -1 on error
+ */
+static int spi_flash_test(struct spi_flash *flash, char *buf, ulong len,
+                          ulong offset, char *vbuf)
+{
+       struct test_info test;
+       int i;
+
+       printf("SPI flash test:\n");
+       memset(&test, '\0', sizeof(test));
+       test.base_ms = get_timer(0);
+       test.bytes = len;
+       if (spi_flash_erase(flash, offset, len)) {
+               printf("Erase failed\n");
+               return -1;
+       }
+       spi_test_next_stage(&test);
+
+       if (spi_flash_read(flash, offset, len, vbuf)) {
+               printf("Check read failed\n");
+               return -1;
+       }
+       for (i = 0; i < len; i++) {
+               if (vbuf[i] != 0xff) {
+                       printf("Check failed at %d\n", i);
+                       print_buffer(i, vbuf + i, 1, min(len - i, 0x40), 0);
+                       return -1;
+               }
+       }
+       spi_test_next_stage(&test);
+
+       if (spi_flash_write(flash, offset, len, buf)) {
+               printf("Write failed\n");
+               return -1;
+       }
+       memset(vbuf, '\0', len);
+       spi_test_next_stage(&test);
+
+       if (spi_flash_read(flash, offset, len, vbuf)) {
+               printf("Read failed\n");
+               return -1;
+       }
+       spi_test_next_stage(&test);
+
+       for (i = 0; i < len; i++) {
+               if (buf[i] != vbuf[i]) {
+                       printf("Verify failed at %d, good data:\n", i);
+                       print_buffer(i, buf + i, 1, min(len - i, 0x40), 0);
+                       printf("Bad data:\n");
+                       print_buffer(i, vbuf + i, 1, min(len - i, 0x40), 0);
+                       return -1;
+               }
+       }
+       printf("Test passed\n");
+       for (i = 0; i < STAGE_COUNT; i++)
+               show_time(&test, i);
+
+       return 0;
+}
+
+static int do_spi_flash_test(int argc, char * const argv[])
+{
+       unsigned long offset;
+       unsigned long len;
+       char *buf = (char *)CONFIG_SYS_TEXT_BASE;
+       char *endp;
+       char *vbuf;
+       int ret;
+
+       offset = simple_strtoul(argv[1], &endp, 16);
+       if (*argv[1] == 0 || *endp != 0)
+               return -1;
+       len = simple_strtoul(argv[2], &endp, 16);
+       if (*argv[2] == 0 || *endp != 0)
+               return -1;
+
+       vbuf = malloc(len);
+       if (!vbuf) {
+               printf("Cannot allocate memory\n");
+               return 1;
+       }
+       buf = malloc(len);
+       if (!buf) {
+               free(vbuf);
+               printf("Cannot allocate memory\n");
+               return 1;
+       }
+
+       memcpy(buf, (char *)CONFIG_SYS_TEXT_BASE, len);
+       ret = spi_flash_test(flash, buf, len, offset, vbuf);
+       free(vbuf);
+       free(buf);
+       if (ret) {
+               printf("Test failed\n");
+               return 1;
+       }
+
+       return 0;
+}
+#endif /* CONFIG_CMD_SF_TEST */
+
 static int do_spi_flash(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 {
        const char *cmd;
@@ -304,6 +497,10 @@ static int do_spi_flash(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[
                ret = do_spi_flash_read_write(argc, argv);
        else if (strcmp(cmd, "erase") == 0)
                ret = do_spi_flash_erase(argc, argv);
+#ifdef CONFIG_CMD_SF_TEST
+       else if (!strcmp(cmd, "test"))
+               ret = do_spi_flash_test(argc, argv);
+#endif
        else
                ret = -1;
 
@@ -315,6 +512,13 @@ usage:
        return CMD_RET_USAGE;
 }
 
+#ifdef CONFIG_CMD_SF_TEST
+#define SF_TEST_HELP "\nsf test offset len             " \
+               "- run a very basic destructive test"
+#else
+#define SF_TEST_HELP
+#endif
+
 U_BOOT_CMD(
        sf,     5,      1,      do_spi_flash,
        "SPI flash sub-system",
@@ -328,4 +532,5 @@ U_BOOT_CMD(
        "                                 `+len' round up `len' to block size\n"
        "sf update addr offset len      - erase and write `len' bytes from memory\n"
        "                                 at `addr' to flash at `offset'"
+       SF_TEST_HELP
 );
diff --git a/common/cmd_sound.c b/common/cmd_sound.c
new file mode 100644 (file)
index 0000000..cfca9dd
--- /dev/null
@@ -0,0 +1,96 @@
+/*
+ * Copyright (C) 2012 Samsung Electronics
+ * Rajeshwari Shinde <rajeshwari.s@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 <command.h>
+#include <fdtdec.h>
+#include <sound.h>
+
+DECLARE_GLOBAL_DATA_PTR;
+
+/* Initilaise sound subsystem */
+static int do_init(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
+{
+       int ret;
+
+       ret = sound_init(gd->fdt_blob);
+       if (ret) {
+               printf("Initialise Audio driver failed\n");
+               return CMD_RET_FAILURE;
+       }
+
+       return 0;
+}
+
+/* play sound from buffer */
+static int do_play(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
+{
+       int ret = 0;
+       int msec = 1000;
+       int freq = 400;
+
+       if (argc > 1)
+               msec = simple_strtoul(argv[1], NULL, 10);
+       if (argc > 2)
+               freq = simple_strtoul(argv[2], NULL, 10);
+
+       ret = sound_play(msec, freq);
+       if (ret) {
+               printf("play failed");
+               return CMD_RET_FAILURE;
+       }
+
+       return 0;
+}
+
+static cmd_tbl_t cmd_sound_sub[] = {
+       U_BOOT_CMD_MKENT(init, 0, 1, do_init, "", ""),
+       U_BOOT_CMD_MKENT(play, 2, 1, do_play, "", ""),
+};
+
+/* process sound command */
+static int do_sound(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
+{
+       cmd_tbl_t *c;
+
+       if (argc < 1)
+               return CMD_RET_USAGE;
+
+       /* Strip off leading 'sound' command argument */
+       argc--;
+       argv++;
+
+       c = find_cmd_tbl(argv[0], &cmd_sound_sub[0], ARRAY_SIZE(cmd_sound_sub));
+
+       if (c)
+               return c->cmd(cmdtp, flag, argc, argv);
+       else
+               return CMD_RET_USAGE;
+}
+
+U_BOOT_CMD(
+       sound, 4, 1, do_sound,
+       "sound sub-system",
+       "init - initialise the sound driver\n"
+       "sound play [len] [freq] - play a sound for len ms at freq hz\n"
+);
index ab4c560ae094e1dffabe5c85404d5dd6fb90466c..e8f40d3ed189b3308c66a61e40f46f6a465aab2a 100644 (file)
@@ -25,6 +25,9 @@
 #include <command.h>
 #include <version.h>
 #include <linux/compiler.h>
+#ifdef CONFIG_SYS_COREBOOT
+#include <asm/arch/sysinfo.h>
+#endif
 
 const char __weak version_string[] = U_BOOT_VERSION_STRING;
 
@@ -37,7 +40,9 @@ static int do_version(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 #ifdef LD_VERSION_STRING
        puts(LD_VERSION_STRING "\n");
 #endif
-
+#ifdef CONFIG_SYS_COREBOOT
+       printf("coreboot-%s (%s)\n", lib_sysinfo.version, lib_sysinfo.build);
+#endif
        return 0;
 }
 
index 4c83a8bf0355d2912840e06046b7f0c2a4aaed80..66d4f94f9eae0dcf8e8d57f9327f29b84f67019f 100644 (file)
 # endif
 #endif
 
+#ifndef CONFIG_LCD_ALIGNMENT
+#define CONFIG_LCD_ALIGNMENT PAGE_SIZE
+#endif
+
+/* By default we scroll by a single line */
+#ifndef CONFIG_CONSOLE_SCROLL_LINES
+#define CONFIG_CONSOLE_SCROLL_LINES 1
+#endif
+
 DECLARE_GLOBAL_DATA_PTR;
 
 ulong lcd_setmem (ulong addr);
@@ -90,6 +99,9 @@ static void lcd_setbgcolor(int color);
 
 char lcd_is_enabled = 0;
 
+static char lcd_flush_dcache;  /* 1 to flush dcache after each lcd update */
+
+
 #ifdef NOT_USED_SO_FAR
 static void lcd_getcolreg(ushort regno,
                                ushort *red, ushort *green, ushort *blue);
@@ -98,15 +110,46 @@ static int lcd_getfgcolor(void);
 
 /************************************************************************/
 
+/* Flush LCD activity to the caches */
+void lcd_sync(void)
+{
+       /*
+        * flush_dcache_range() is declared in common.h but it seems that some
+        * architectures do not actually implement it. Is there a way to find
+        * out whether it exists? For now, ARM is safe.
+        */
+#if defined(CONFIG_ARM) && !defined(CONFIG_SYS_DCACHE_OFF)
+       int line_length;
+
+       if (lcd_flush_dcache)
+               flush_dcache_range((u32)lcd_base,
+                       (u32)(lcd_base + lcd_get_size(&line_length)));
+#endif
+}
+
+void lcd_set_flush_dcache(int flush)
+{
+       lcd_flush_dcache = (flush != 0);
+}
+
 /*----------------------------------------------------------------------*/
 
 static void console_scrollup(void)
 {
-       /* Copy up rows ignoring the first one */
-       memcpy(CONSOLE_ROW_FIRST, CONSOLE_ROW_SECOND, CONSOLE_SCROLL_SIZE);
+       const int rows = CONFIG_CONSOLE_SCROLL_LINES;
 
-       /* Clear the last one */
-       memset(CONSOLE_ROW_LAST, COLOR_MASK(lcd_color_bg), CONSOLE_ROW_SIZE);
+       /* Copy up rows ignoring those that will be overwritten */
+       memcpy(CONSOLE_ROW_FIRST,
+              lcd_console_address + CONSOLE_ROW_SIZE * rows,
+              CONSOLE_SIZE - CONSOLE_ROW_SIZE * rows);
+
+       /* Clear the last rows */
+       memset(lcd_console_address + CONSOLE_SIZE - CONSOLE_ROW_SIZE * rows,
+               COLOR_MASK(lcd_color_bg),
+              CONSOLE_ROW_SIZE * rows);
+
+       lcd_sync();
+       console_row -= rows;
 }
 
 /*----------------------------------------------------------------------*/
@@ -135,7 +178,8 @@ static inline void console_newline(void)
        if (console_row >= CONSOLE_ROWS) {
                /* Scroll everything up */
                console_scrollup();
-               --console_row;
+       } else {
+               lcd_sync();
        }
 }
 
@@ -191,6 +235,7 @@ void lcd_puts(const char *s)
        while (*s) {
                lcd_putc(*s++);
        }
+       lcd_sync();
 }
 
 /*----------------------------------------------------------------------*/
@@ -326,6 +371,12 @@ static void test_pattern(void)
 /* ** GENERIC Initialization Routines                                  */
 /************************************************************************/
 
+int lcd_get_size(int *line_length)
+{
+       *line_length = (panel_info.vl_col * NBITS(panel_info.vl_bpix)) / 8;
+       return *line_length * panel_info.vl_row;
+}
+
 int drv_lcd_init (void)
 {
        struct stdio_dev lcddev;
@@ -333,7 +384,7 @@ int drv_lcd_init (void)
 
        lcd_base = (void *)(gd->fb_base);
 
-       lcd_line_length = (panel_info.vl_col * NBITS (panel_info.vl_bpix)) / 8;
+       lcd_get_size(&lcd_line_length);
 
        lcd_init(lcd_base);             /* LCD initialization */
 
@@ -352,13 +403,6 @@ int drv_lcd_init (void)
 }
 
 /*----------------------------------------------------------------------*/
-static
-int do_lcd_clear(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
-{
-       lcd_clear();
-       return 0;
-}
-
 void lcd_clear(void)
 {
 #if LCD_BPP == LCD_MONOCHROME
@@ -400,6 +444,14 @@ void lcd_clear(void)
 
        console_col = 0;
        console_row = 0;
+       lcd_sync();
+}
+
+static int do_lcd_clear(cmd_tbl_t *cmdtp, int flag, int argc,
+                       char *const argv[])
+{
+       lcd_clear();
+       return 0;
 }
 
 U_BOOT_CMD(
@@ -445,15 +497,16 @@ static int lcd_init(void *lcdbase)
 ulong lcd_setmem(ulong addr)
 {
        ulong size;
-       int line_length = (panel_info.vl_col * NBITS(panel_info.vl_bpix)) / 8;
+       int line_length;
 
        debug("LCD panel info: %d x %d, %d bit/pix\n", panel_info.vl_col,
                panel_info.vl_row, NBITS(panel_info.vl_bpix));
 
-       size = line_length * panel_info.vl_row;
+       size = lcd_get_size(&line_length);
 
-       /* Round up to nearest full page */
-       size = (size + (PAGE_SIZE - 1)) & ~(PAGE_SIZE - 1);
+       /* Round up to nearest full page, or MMU section if defined */
+       size = ALIGN(size, CONFIG_LCD_ALIGNMENT);
+       addr = ALIGN(addr - CONFIG_LCD_ALIGNMENT + 1, CONFIG_LCD_ALIGNMENT);
 
        /* Allocate pages for the frame buffer. */
        addr -= size;
@@ -610,6 +663,7 @@ void bitmap_plot(int x, int y)
        }
 
        WATCHDOG_RESET();
+       lcd_sync();
 }
 #else
 static inline void bitmap_plot(int x, int y) {}
@@ -834,7 +888,7 @@ int lcd_display_bitmap(ulong bmp_image, int x, int y)
        }
 
        /* We support displaying 8bpp BMPs on 16bpp LCDs */
-       if (bpix != bmp_bpix && (bmp_bpix != 8 || bpix != 16 || bpix != 32)) {
+       if (bpix != bmp_bpix && !(bmp_bpix == 8 && bpix == 16)) {
                printf ("Error: %d bit/pixel mode, but BMP has %d bit/pixel\n",
                        bpix,
                        le16_to_cpu(bmp->header.bit_count));
@@ -975,6 +1029,7 @@ int lcd_display_bitmap(ulong bmp_image, int x, int y)
                break;
        };
 
+       lcd_sync();
        return 0;
 }
 #endif
index b145f8556586c27c4e150396d1bd5ddbc19f60e0..5d8454ea0e5a6407882e4b0e06a27426270036f2 100644 (file)
@@ -1141,8 +1141,16 @@ int readline_into_buffer(const char *const prompt, char *buffer, int timeout)
                                        puts (tab_seq+(col&07));
                                        col += 8 - (col&07);
                                } else {
-                                       ++col;          /* echo input           */
-                                       putc (c);
+                                       char buf[2];
+
+                                       /*
+                                        * Echo input using puts() to force am
+                                        * LCD flush if we are using an LCD
+                                        */
+                                       ++col;
+                                       buf[0] = c;
+                                       buf[1] = '\0';
+                                       puts(buf);
                                }
                                *p++ = c;
                                ++n;
index ac9b4ca8d58bfe8dd3cd941c7fb094a4b9d819e7..6fc0fc1c0ec75fe34f100cbfb03b207628b32885 100644 (file)
@@ -805,6 +805,18 @@ struct usb_device *usb_alloc_new_device(void *controller)
        return &usb_dev[dev_index - 1];
 }
 
+/*
+ * Free the newly created device node.
+ * Called in error cases where configuring a newly attached
+ * device fails for some reason.
+ */
+void usb_free_device(void)
+{
+       dev_index--;
+       USB_PRINTF("Freeing device node: %d\n", dev_index);
+       memset(&usb_dev[dev_index], 0, sizeof(struct usb_device));
+       usb_dev[dev_index].devnum = -1;
+}
 
 /*
  * By the time we get here, the device has gotten a new device ID
index e4a120120dc23d068686d0e69e6d8248f9b35308..b5eeb62fbe55ecab41fe74abd3dea5209695a01f 100644 (file)
@@ -259,6 +259,8 @@ void usb_hub_port_connect_change(struct usb_device *dev, int port)
        /* Run it through the hoops (find a driver, etc) */
        if (usb_new_device(usb)) {
                /* Woops, disable the port */
+               usb_free_device();
+               dev->children[port] = NULL;
                USB_HUB_PRINTF("hub: disabling port %d\n", port + 1);
                usb_clear_port_feature(dev, port + 1, USB_PORT_FEAT_ENABLE);
        }
@@ -396,14 +398,37 @@ static int usb_hub_configure(struct usb_device *dev)
        for (i = 0; i < dev->maxchild; i++) {
                ALLOC_CACHE_ALIGN_BUFFER(struct usb_port_status, portsts, 1);
                unsigned short portstatus, portchange;
+               int ret;
+               ulong start = get_timer(0);
+
+               /*
+                * Wait for (whichever finishes first)
+                *  - A maximum of 10 seconds
+                *    This is a purely observational value driven by connecting
+                *    a few broken pen drives and taking the max * 1.5 approach
+                *  - connection_change and connection state to report same
+                *    state
+                */
+               do {
+                       ret = usb_get_port_status(dev, i + 1, portsts);
+                       if (ret < 0) {
+                               USB_HUB_PRINTF("get_port_status failed\n");
+                               break;
+                       }
+
+                       portstatus = le16_to_cpu(portsts->wPortStatus);
+                       portchange = le16_to_cpu(portsts->wPortChange);
+
+                       if ((portchange & USB_PORT_STAT_C_CONNECTION) ==
+                               (portstatus & USB_PORT_STAT_CONNECTION))
+                               break;
+
+                       mdelay(100);
+               } while (get_timer(start) < CONFIG_SYS_HZ * 10);
 
-               if (usb_get_port_status(dev, i + 1, portsts) < 0) {
-                       USB_HUB_PRINTF("get_port_status failed\n");
+               if (ret < 0)
                        continue;
-               }
 
-               portstatus = le16_to_cpu(portsts->wPortStatus);
-               portchange = le16_to_cpu(portsts->wPortChange);
                USB_HUB_PRINTF("Port %d Status %X Change %X\n",
                                i + 1, portstatus, portchange);
 
index 2d92ee1bb3e95c5af8e6cc66ddcfa1c4aa61bac8..fb322b4015fe0ba2ea72d82a1f7171ae7bfee2e3 100644 (file)
@@ -970,6 +970,16 @@ static int usb_test_unit_ready(ccb *srb, struct us_data *ss)
                        return 0;
                }
                usb_request_sense(srb, ss);
+               /*
+                * Check the Key Code Qualifier, if it matches
+                * "Not Ready - medium not present"
+                * (the sense Key equals 0x2 and the ASC is 0x3a)
+                * return immediately as the medium being absent won't change
+                * unless there is a user action.
+                */
+               if ((srb->sense_buf[2] == 0x02) &&
+                   (srb->sense_buf[12] == 0x3a))
+                       return -1;
                mdelay(100);
        } while (retries--);
 
index f7eab7d4b2ea1d11eae0b1437c951661ec56f14c..e08941e2ae3c1282b4829399023bf9ddb3e5a3da 100644 (file)
@@ -15,3 +15,8 @@ i.MX5x SoCs.
     mode), which causes the effect of this failure to be much lower (in terms
     of frequency deviation), avoiding system failure, or at least decreasing
     the likelihood of system failure.
+
+1.2 CONFIG_SYS_MAIN_PWR_ON: Trigger MAIN_PWR_ON upon startup.
+    This option should be enabled for boards having a SYS_ON_OFF_CTL signal
+    connected to GPIO1[23] and triggering the MAIN_PWR_ON signal like in the
+    reference designs.
diff --git a/doc/README.sh7752evb b/doc/README.sh7752evb
new file mode 100644 (file)
index 0000000..c1fb54c
--- /dev/null
@@ -0,0 +1,67 @@
+========================================
+Renesas R0P7752C00000RZ board
+========================================
+
+This board specification:
+=========================
+
+The R0P7752C00000RZ(board config name:sh7752evb) has the following device:
+
+ - SH7752 (SH-4A)
+ - DDR3-SDRAM 512MB
+ - SPI ROM 8MB
+ - Gigabit Ethernet controllers
+ - eMMC 4GB
+
+
+Configuration for This board:
+=============================
+
+You can select the configuration as follows:
+
+ - make sh7752evb_config
+
+
+This board specific command:
+============================
+
+This board has the following its specific command:
+
+ - write_mac
+
+
+1. write_mac
+
+You can write MAC address to SPI ROM.
+
+ Usage 1) Write MAC address
+
+   write_mac [GETHERC ch0] [GETHERC ch1]
+
+       For example)
+        => write_mac 74:90:50:00:33:9e 74:90:50:00:33:9f
+               *) We have to input the command as a single line
+                  (without carriage return)
+               *) We have to reset after input the command.
+
+ Usage 2) Show current data
+
+   write_mac
+
+       For example)
+               => write_mac
+               GETHERC ch0 = 74:90:50:00:33:9e
+               GETHERC ch1 = 74:90:50:00:33:9f
+
+
+Update SPI ROM:
+============================
+
+1. Copy u-boot image to RAM area.
+2. Probe SPI device.
+   => sf probe 0
+   SF: Detected MX25L6405D with page size 64KiB, total 8 MiB
+3. Erase SPI ROM.
+   => sf erase 0 80000
+4. Write u-boot image to SPI ROM.
+   => sf write 0x48000000 0 80000
index ef1d6ba36608f596c3c4a0d7643331d7fa767687..b4c3ef52247fe6470f42d6ae204b59ea01fbabd1 100644 (file)
@@ -63,7 +63,7 @@ Common USB Commands:
 Storage USB Commands:
 - usb scan:        scans the USB for storage devices.The USB must be
                    running for this command (usb start)
-- usb device [dev]: show or set current USB staorage device
+- usb device [dev]: show or set current USB storage device
 - usb part [dev]:   print partition table of one or all USB storage
                    devices
 - usb read addr blk# cnt:
diff --git a/doc/README.watchdog b/doc/README.watchdog
new file mode 100644 (file)
index 0000000..ee65008
--- /dev/null
@@ -0,0 +1,29 @@
+Watchdog driver general info
+
+CONFIG_HW_WATCHDOG
+       This enables hw_watchdog_reset to be called during various loops,
+       including waiting for a character on a serial port. But it
+       does not also call hw_watchdog_init. Boards which want this
+       enabled must call this function in their board file. This split
+       is useful because some rom's enable the watchdog when downloading
+       new code, so it must be serviced, but the board would rather it
+       was off. And, it cannot always be turned off once on.
+
+CONFIG_WATCHDOG_TIMEOUT_MSECS
+       Can be used to change the timeout for i.mx31/35/5x/6x.
+       If not given, will default to maximum timeout. This would
+       be 128000 msec for i.mx31/35/5x/6x.
+
+CONFIG_AT91SAM9_WATCHDOG
+       Available for AT91SAM9 to service the watchdog.
+
+CONFIG_FTWDT010_WATCHDOG
+       Available for FTWDT010 to service the watchdog.
+
+CONFIG_FTWDT010_HW_TIMEOUT
+       Can be used to change the timeout for FTWDT010.
+
+CONFIG_IMX_WATCHDOG
+       Available for i.mx31/35/5x/6x to service the watchdog. This is not
+       automatically set because some boards (vision2) still need to define
+       their own hw_watchdog_reset routine.
diff --git a/doc/device-tree-bindings/exynos/isp-spi.txt b/doc/device-tree-bindings/exynos/isp-spi.txt
new file mode 100644 (file)
index 0000000..b8086e8
--- /dev/null
@@ -0,0 +1,22 @@
+Exynos ISP SPI Subsystem
+
+The device node for ISP SPI subsytem.
+Since Peripheral id in EXYNOS is decoded based on Interrupts, currently
+ISP SPI have no individual interrupts hence we add ad dummy interrupt node
+which will have a value beyond the maximum number of interrupts exynos5 can
+support.
+
+Required properties :
+ - compatible : Should be "samsung,exynos-spi" for spi.
+ - reg : Base adrress of the the subsystem.
+ - interrupts : A value which is beyond the maximum number of interrupts
+exynos5 can support.
+
+Example:
+spi@131a0000 {
+       #address-cells = <1>;
+       #size-cells = <0>;
+       compatible = "samsung,exynos-spi";
+       reg = <0x131a0000 0x30>;
+       interrupts = <0 129 0>;
+};
diff --git a/doc/device-tree-bindings/exynos/sound.txt b/doc/device-tree-bindings/exynos/sound.txt
new file mode 100644 (file)
index 0000000..98d1798
--- /dev/null
@@ -0,0 +1,27 @@
+Exynos Sound Subsystem
+
+The device node for sound subsytem which contains codec and i2s block
+that is a part of Exynos5250
+
+Required properties :
+ - compatible : Should be "samsung,exynos-sound" for sound
+ - samsung,i2s-epll-clock-frequency : epll clock output frequency in Hz
+ - samsung,i2s-sampling-rate : sampling rate, default is 48000
+ - samsung,i2s-bits-per-sample : sample width, defalut is 16 bit
+ - samsung,i2s-channels : nummber of channels, default is 2
+ - samsung,i2s-lr-clk-framesize : lr clock frame size
+ - samsung,i2s-bit-clk-framesize : bit clock frame size
+ - samsung,codec-type : sound codec type
+
+Example:
+
+sound@12d60000 {
+       compatible = "samsung,exynos-sound"
+       samsung,i2s-epll-clock-frequency = <192000000>;
+       samsung,i2s-sampling-rate = <48000>;
+       samsung,i2s-bits-per-sample = <16>;
+       samsung,i2s-channels = <2>;
+       samsung,i2s-lr-clk-framesize = <256>;
+       samsung,i2s-bit-clk-framesize = <32>;
+       samsung,codec-type = "wm8994";
+};
diff --git a/doc/device-tree-bindings/pwm/tegra20-pwm.txt b/doc/device-tree-bindings/pwm/tegra20-pwm.txt
new file mode 100644 (file)
index 0000000..01438ec
--- /dev/null
@@ -0,0 +1,18 @@
+Tegra SoC PWFM controller
+
+Required properties:
+- compatible: should be one of:
+  - "nvidia,tegra20-pwm"
+  - "nvidia,tegra30-pwm"
+- reg: physical base address and length of the controller's registers
+- #pwm-cells: On Tegra the number of cells used to specify a PWM is 2. The
+  first cell specifies the per-chip index of the PWM to use and the second
+  cell is the period in nanoseconds.
+
+Example:
+
+       pwm: pwm@7000a000 {
+               compatible = "nvidia,tegra20-pwm";
+               reg = <0x7000a000 0x100>;
+               #pwm-cells = <2>;
+       };
diff --git a/doc/device-tree-bindings/video/displaymode.txt b/doc/device-tree-bindings/video/displaymode.txt
new file mode 100644 (file)
index 0000000..45ca42d
--- /dev/null
@@ -0,0 +1,42 @@
+videomode bindings
+==================
+
+(from http://lists.freedesktop.org/archives/dri-devel/2012-July/024875.html)
+
+Required properties:
+ - xres, yres: Display resolution
+ - left-margin, right-margin, hsync-len: Horizontal Display timing
+   parameters in pixels
+ - upper-margin, lower-margin, vsync-len: Vertical display timing
+   parameters in lines
+ - clock: display clock in Hz
+
+Optional properties:
+ - width-mm, height-mm: Display dimensions in mm
+ - hsync-active-high (bool): Hsync pulse is active high
+ - vsync-active-high (bool): Vsync pulse is active high
+ - interlaced (bool): This is an interlaced mode
+ - doublescan (bool): This is a doublescan mode
+
+There are different ways of describing a display mode. The devicetree
+representation corresponds to the one used by the Linux Framebuffer
+framework described here in Documentation/fb/framebuffer.txt. This
+representation has been chosen because it's the only format which does
+not allow for inconsistent parameters. Unlike the Framebuffer framework
+the devicetree has the clock in Hz instead of ps.
+
+Example:
+
+       display@0 {
+               /* 1920x1080p24 */
+               clock = <52000000>;
+               xres = <1920>;
+               yres = <1080>;
+               left-margin = <25>;
+               right-margin = <25>;
+               hsync-len = <25>;
+               lower-margin = <2>;
+               upper-margin = <2>;
+               vsync-len = <2>;
+               hsync-active-high;
+       };
diff --git a/doc/device-tree-bindings/video/tegra20-dc.txt b/doc/device-tree-bindings/video/tegra20-dc.txt
new file mode 100644 (file)
index 0000000..4731c3f
--- /dev/null
@@ -0,0 +1,85 @@
+Display Controller
+------------------
+
+(there isn't yet a generic binding in Linux, so this describes what is in
+U-Boot, and may change based on Linux activity)
+
+The device node for a display device is as described in the document
+"Open Firmware Recommended Practice : Universal Serial Bus" with the
+following modifications and additions :
+
+Required properties :
+ - compatible : Should be "nvidia,tegra20-dc"
+
+Required subnode 'rgb' is as follows:
+
+Required properties (rgb) :
+ - nvidia,panel : phandle of LCD panel information
+
+
+The panel node describes the panel itself. This has the properties listed in
+displaymode.txt as well as:
+
+Required properties (panel) :
+ - nvidia,bits-per-pixel: number of bits per pixel (depth)
+ - nvidia,pwm : pwm to use to set display contrast (see tegra20-pwm.txt)
+ - nvidia,panel-timings: 4 cells containing required timings in ms:
+       * delay before asserting panel_vdd
+       * delay between panel_vdd-rise and data-rise
+       * delay between data-rise and backlight_vdd-rise
+       * delay between backlight_vdd and pwm-rise
+       * delay between pwm-rise and backlight_en-rise
+
+Optional GPIO properies all have (phandle, GPIO number, flags):
+ - nvidia,backlight-enable-gpios: backlight enable GPIO
+ - nvidia,lvds-shutdown-gpios: LVDS power shutdown GPIO
+ - nvidia,backlight-vdd-gpios: backlight power GPIO
+ - nvidia,panel-vdd-gpios: panel power GPIO
+
+Example:
+
+host1x {
+       compatible = "nvidia,tegra20-host1x", "simple-bus";
+       reg = <0x50000000 0x00024000>;
+       interrupts = <0 65 0x04   /* mpcore syncpt */
+                       0 67 0x04>; /* mpcore general */
+
+       #address-cells = <1>;
+       #size-cells = <1>;
+       status = "okay";
+
+       ranges = <0x54000000 0x54000000 0x04000000>;
+
+       dc@54200000 {
+               compatible = "nvidia,tegra20-dc";
+               reg = <0x54200000 0x00040000>;
+               interrupts = <0 73 0x04>;
+               status = "okay";
+
+               rgb {
+                       status = "okay";
+                       nvidia,panel = <&lcd_panel>;
+               };
+       };
+};
+
+lcd_panel: panel {
+       /* Seaboard has 1366x768 */
+       clock = <70600000>;
+       xres = <1366>;
+       yres = <768>;
+       left-margin = <58>;
+       right-margin = <58>;
+       hsync-len = <58>;
+       lower-margin = <4>;
+       upper-margin = <4>;
+       vsync-len = <4>;
+       hsync-active-high;
+       nvidia,bits-per-pixel = <16>;
+       nvidia,pwm = <&pwm 2 0>;
+       nvidia,backlight-enable-gpios = <&gpio 28 0>;   /* PD4 */
+       nvidia,lvds-shutdown-gpios = <&gpio 10 0>;      /* PB2 */
+       nvidia,backlight-vdd-gpios = <&gpio 176 0>;     /* PW0 */
+       nvidia,panel-vdd-gpios = <&gpio 22 0>;          /* PC6 */
+       nvidia,panel-timings = <400 4 203 17 15>;
+};
index 2c79bff62b6376c659e6da6afb03ae411deec465..a3880641f0a8c73e64896b5b3512dc9dfbbf4297 100644 (file)
@@ -42,14 +42,14 @@ static unsigned long gpio_ports[] = {
        [1] = GPIO2_BASE_ADDR,
        [2] = GPIO3_BASE_ADDR,
 #if defined(CONFIG_MX25) || defined(CONFIG_MX27) || defined(CONFIG_MX51) || \
-               defined(CONFIG_MX53) || defined(CONFIG_MX6Q)
+               defined(CONFIG_MX53) || defined(CONFIG_MX6)
        [3] = GPIO4_BASE_ADDR,
 #endif
-#if defined(CONFIG_MX27) || defined(CONFIG_MX53) || defined(CONFIG_MX6Q)
+#if defined(CONFIG_MX27) || defined(CONFIG_MX53) || defined(CONFIG_MX6)
        [4] = GPIO5_BASE_ADDR,
        [5] = GPIO6_BASE_ADDR,
 #endif
-#if defined(CONFIG_MX53) || defined(CONFIG_MX6Q)
+#if defined(CONFIG_MX53) || defined(CONFIG_MX6)
        [6] = GPIO7_BASE_ADDR,
 #endif
 };
index fc89f2a42b12b0c8690a80e52d5842b5902e9e0a..a30d7f0603e9b5da4c8280896ae00289e4874b57 100644 (file)
@@ -53,18 +53,14 @@ static inline int get_gpio_index(int gpio)
        return gpio & 0x1f;
 }
 
-static inline int gpio_valid(int gpio)
+int gpio_is_valid(int gpio)
 {
-       if (gpio < 0)
-               return -1;
-       if (gpio < 192)
-               return 0;
-       return -1;
+       return (gpio >= 0) && (gpio < 192);
 }
 
 static int check_gpio(int gpio)
 {
-       if (gpio_valid(gpio) < 0) {
+       if (!gpio_is_valid(gpio)) {
                printf("ERROR : check_gpio: invalid GPIO %d\n", gpio);
                return -1;
        }
index 47f321392791cfc093c6f6b14b8433c500f7e032..656bf4a06c22072f2c228cb69cf174ee7b089b3b 100644 (file)
@@ -144,9 +144,11 @@ void s5p_gpio_set_rate(struct s5p_gpio_bank *bank, int gpio, int mode)
 
 struct s5p_gpio_bank *s5p_gpio_get_bank(unsigned gpio)
 {
-       int bank = gpio / GPIO_PER_BANK;
-       bank *= sizeof(struct s5p_gpio_bank);
+       int bank;
+       unsigned g = gpio - s5p_gpio_part_max(gpio);
 
+       bank = g / GPIO_PER_BANK;
+       bank *= sizeof(struct s5p_gpio_bank);
        return (struct s5p_gpio_bank *) (s5p_gpio_base(gpio) + bank);
 }
 
index af454f901c7b05b6c770dbc6bf47508b3fc166e0..54e9b1586fb8ad17baec72d1910bb6ceca511a48 100644 (file)
@@ -31,7 +31,7 @@ DECLARE_GLOBAL_DATA_PTR;
 
 #define I2C_TIMEOUT    1000
 
-static void wait_for_bb(void);
+static int wait_for_bb(void);
 static u16 wait_for_pin(void);
 static void flush_fifo(void);
 
@@ -159,7 +159,8 @@ static int i2c_read_byte(u8 devaddr, u16 regoffset, u8 alen, u8 *value)
        u16 w;
 
        /* wait until bus not busy */
-       wait_for_bb();
+       if (wait_for_bb())
+               return 1;
 
        /* one byte only */
        writew(alen, &i2c_base->cnt);
@@ -263,7 +264,8 @@ int i2c_probe(uchar chip)
                return res;
 
        /* wait until bus not busy */
-       wait_for_bb();
+       if (wait_for_bb())
+               return res;
 
        /* try to read one byte */
        writew(1, &i2c_base->cnt);
@@ -282,7 +284,10 @@ int i2c_probe(uchar chip)
                        res = 1;
                        writew(0xff, &i2c_base->stat);
                        writew (readw (&i2c_base->con) | I2C_CON_STP, &i2c_base->con);
-                       wait_for_bb ();
+
+                       if (wait_for_bb())
+                               res = 1;
+
                        break;
                }
                if (status & I2C_STAT_ARDY) {
@@ -355,7 +360,8 @@ int i2c_write(uchar chip, uint addr, int alen, uchar *buffer, int len)
        }
 
        /* wait until bus not busy */
-       wait_for_bb();
+       if (wait_for_bb())
+               return 1;
 
        /* start address phase - will write regoffset + len bytes data */
        /* TODO consider case when !CONFIG_OMAP243X/34XX/44XX */
@@ -399,7 +405,7 @@ write_exit:
        return i2c_error;
 }
 
-static void wait_for_bb(void)
+static int wait_for_bb(void)
 {
        int timeout = I2C_TIMEOUT;
        u16 stat;
@@ -413,8 +419,10 @@ static void wait_for_bb(void)
        if (timeout <= 0) {
                printf("timed out in wait_for_bb: I2C_STAT=%x\n",
                        readw(&i2c_base->stat));
+               return 1;
        }
        writew(0xFFFF, &i2c_base->stat);         /* clear delayed stuff*/
+       return 0;
 }
 
 static u16 wait_for_pin(void)
index 90d297a28422ac9a4c7e568bfe1bd2edc2f26dff..769a2ba5ba32bd77a492647900bc86e5626f89d4 100644 (file)
  */
 
 #include <common.h>
+#include <fdtdec.h>
 #if (defined CONFIG_EXYNOS4 || defined CONFIG_EXYNOS5)
 #include <asm/arch/clk.h>
 #include <asm/arch/cpu.h>
+#include <asm/arch/pinmux.h>
 #else
 #include <asm/arch/s3c24x0_cpu.h>
 #endif
 #define I2C_TIMEOUT 1          /* 1 second */
 
 
-static unsigned int g_current_bus;     /* Stores Current I2C Bus */
+/*
+ * For SPL boot some boards need i2c before SDRAM is initialised so force
+ * variables to live in SRAM
+ */
+static unsigned int g_current_bus __attribute__((section(".data")));
+#ifdef CONFIG_OF_CONTROL
+static int i2c_busses __attribute__((section(".data")));
+static struct s3c24x0_i2c_bus i2c_bus[CONFIG_MAX_I2C_NUM]
+                       __attribute__((section(".data")));
+#endif
 
 #if !(defined CONFIG_EXYNOS4 || defined CONFIG_EXYNOS5)
 static int GetI2CSDA(void)
@@ -512,4 +523,76 @@ int i2c_write(uchar chip, uint addr, int alen, uchar *buffer, int len)
                (i2c, I2C_WRITE, chip << 1, &xaddr[4 - alen], alen, buffer,
                 len) != 0);
 }
+
+#ifdef CONFIG_OF_CONTROL
+void board_i2c_init(const void *blob)
+{
+       int node_list[CONFIG_MAX_I2C_NUM];
+       int count, i;
+
+       count = fdtdec_find_aliases_for_id(blob, "i2c",
+               COMPAT_SAMSUNG_S3C2440_I2C, node_list,
+               CONFIG_MAX_I2C_NUM);
+
+       for (i = 0; i < count; i++) {
+               struct s3c24x0_i2c_bus *bus;
+               int node = node_list[i];
+
+               if (node <= 0)
+                       continue;
+               bus = &i2c_bus[i];
+               bus->regs = (struct s3c24x0_i2c *)
+                       fdtdec_get_addr(blob, node, "reg");
+               bus->id = pinmux_decode_periph_id(blob, node);
+               bus->node = node;
+               bus->bus_num = i2c_busses++;
+               exynos_pinmux_config(bus->id, 0);
+       }
+}
+
+static struct s3c24x0_i2c_bus *get_bus(unsigned int bus_idx)
+{
+       if (bus_idx < i2c_busses)
+               return &i2c_bus[bus_idx];
+
+       debug("Undefined bus: %d\n", bus_idx);
+       return NULL;
+}
+
+int i2c_get_bus_num_fdt(int node)
+{
+       int i;
+
+       for (i = 0; i < i2c_busses; i++) {
+               if (node == i2c_bus[i].node)
+                       return i;
+       }
+
+       debug("%s: Can't find any matched I2C bus\n", __func__);
+       return -1;
+}
+
+int i2c_reset_port_fdt(const void *blob, int node)
+{
+       struct s3c24x0_i2c_bus *i2c;
+       int bus;
+
+       bus = i2c_get_bus_num_fdt(node);
+       if (bus < 0) {
+               debug("could not get bus for node %d\n", node);
+               return -1;
+       }
+
+       i2c = get_bus(bus);
+       if (!i2c) {
+               debug("get_bus() failed for node node %d\n", node);
+               return -1;
+       }
+
+       i2c_ch_init(i2c->regs, CONFIG_SYS_I2C_SPEED, CONFIG_SYS_I2C_SLAVE);
+
+       return 0;
+}
+#endif
+
 #endif /* CONFIG_HARD_I2C */
index 2dd4b06a23270ec27ec776f3a8bcef620bb8ed2e..a56d749dec0adcc3c767552a4d3487211e751dfb 100644 (file)
@@ -30,4 +30,11 @@ struct s3c24x0_i2c {
        u32     iicds;
        u32     iiclc;
 };
+
+struct s3c24x0_i2c_bus {
+       int node;       /* device tree node */
+       int bus_num;    /* i2c bus number */
+       struct s3c24x0_i2c *regs;
+       int id;
+};
 #endif /* _S3C24X0_I2C_H */
index ab7a9e33ee0bf86e1539bc8e90a2b250d13c8f36..88471d3edf253e432458a44fb0c8d5ed29317d47 100644 (file)
@@ -63,6 +63,7 @@ static struct keyb {
        struct kbc_tegra *kbc;          /* tegra keyboard controller */
        unsigned char inited;           /* 1 if keyboard has been inited */
        unsigned char first_scan;       /* 1 if this is our first key scan */
+       unsigned char created;          /* 1 if driver has been created */
 
        /*
         * After init we must wait a short time before polling the keyboard.
@@ -306,6 +307,10 @@ static void tegra_kbc_open(void)
  */
 static int init_tegra_keyboard(void)
 {
+       /* check if already created */
+       if (config.created)
+               return 0;
+
 #ifdef CONFIG_OF_CONTROL
        int     node;
 
@@ -349,6 +354,7 @@ static int init_tegra_keyboard(void)
        config_kbc_gpio(config.kbc);
 
        tegra_kbc_open();
+       config.created = 1;
        debug("%s: Tegra keyboard ready\n", __func__);
 
        return 0;
@@ -357,6 +363,8 @@ static int init_tegra_keyboard(void)
 int drv_keyboard_init(void)
 {
        struct stdio_dev dev;
+       char *stdinname = getenv("stdin");
+       int error;
 
        if (input_init(&config.input, 0)) {
                debug("%s: Cannot set up input\n", __func__);
@@ -372,5 +380,13 @@ int drv_keyboard_init(void)
        dev.start = init_tegra_keyboard;
 
        /* Register the device. init_tegra_keyboard() will be called soon */
-       return input_stdio_register(&dev);
+       error = input_stdio_register(&dev);
+       if (error)
+               return error;
+#ifdef CONFIG_CONSOLE_MUX
+       error = iomux_doenv(stdin, stdinname);
+       if (error)
+               return error;
+#endif
+       return 0;
 }
index e93e38ac4346fdebe203621aa5eac95e9355e660..3d5c9c0f77ef9f3910590c7a36212675d2b17b56 100644 (file)
@@ -577,7 +577,7 @@ int fsl_esdhc_initialize(bd_t *bis, struct fsl_esdhc_cfg *cfg)
                return -1;
        }
 
-       mmc->host_caps = MMC_MODE_4BIT | MMC_MODE_8BIT;
+       mmc->host_caps = MMC_MODE_4BIT | MMC_MODE_8BIT | MMC_MODE_HC;
 
        if (caps & ESDHC_HOSTCAPBLT_HSS)
                mmc->host_caps |= MMC_MODE_HS_52MHz | MMC_MODE_HS;
index b141eafc7bb16ae0cdeeb704068b92b1e15a4983..d749ab095e3eecfe1d4070f5b37eacf5a9d3933b 100644 (file)
@@ -565,10 +565,11 @@ int tegra_mmc_init(int dev_index, int bus_width, int pwr_gpio, int cd_gpio)
        mmc->getcd = tegra_mmc_getcd;
 
        mmc->voltages = MMC_VDD_32_33 | MMC_VDD_33_34 | MMC_VDD_165_195;
+       mmc->host_caps = 0;
        if (bus_width == 8)
-               mmc->host_caps = MMC_MODE_8BIT;
-       else
-               mmc->host_caps = MMC_MODE_4BIT;
+               mmc->host_caps |= MMC_MODE_8BIT;
+       if (bus_width >= 4)
+               mmc->host_caps |= MMC_MODE_4BIT;
        mmc->host_caps |= MMC_MODE_HS_52MHz | MMC_MODE_HS | MMC_MODE_HC;
 
        /*
index b2dfc5369dde405baf170756af6b0347e8904b1e..60dbb7864f2b40476e7dab9a03930aa89dc50158 100644 (file)
@@ -1128,7 +1128,7 @@ int flash_erase (flash_info_t * info, int s_first, int s_last)
                                                AMD_CMD_ERASE_START);
                                flash_unlock_seq (info, sect);
                                flash_write_cmd (info, sect, 0,
-                                                AMD_CMD_ERASE_SECTOR);
+                                                info->cmd_erase_sector);
                                break;
 #ifdef CONFIG_FLASH_CFI_LEGACY
                        case CFI_CMDSET_AMD_LEGACY:
@@ -1247,6 +1247,8 @@ void flash_print_info (flash_info_t * info)
                printf(info->chipwidth == FLASH_CFI_16BIT ? "%04X" : "%02X",
                info->device_id2);
        }
+       if ((info->vendor == CFI_CMDSET_AMD_STANDARD) && (info->legacy_unlock))
+               printf("\n  Advanced Sector Protection (PPB) enabled");
        printf ("\n  Erase timeout: %ld ms, write timeout: %ld ms\n",
                info->erase_blk_tout,
                info->write_tout);
@@ -1425,13 +1427,18 @@ int write_buff (flash_info_t * info, uchar * src, ulong addr, ulong cnt)
        return flash_write_cfiword (info, wp, cword);
 }
 
+static inline int manufact_match(flash_info_t *info, u32 manu)
+{
+       return info->manufacturer_id == ((manu & FLASH_VENDMASK) >> 16);
+}
+
 /*-----------------------------------------------------------------------
  */
 #ifdef CONFIG_SYS_FLASH_PROTECTION
 
 static int cfi_protect_bugfix(flash_info_t *info, long sector, int prot)
 {
-       if (info->manufacturer_id == ((INTEL_MANUFACT & FLASH_VENDMASK) >> 16)
+       if (manufact_match(info, INTEL_MANUFACT)
            && info->device_id == NUMONYX_256MBIT) {
                /*
                 * see errata called
@@ -1488,8 +1495,7 @@ int flash_real_protect (flash_info_t * info, long sector, int prot)
                case CFI_CMDSET_AMD_EXTENDED:
                case CFI_CMDSET_AMD_STANDARD:
                        /* U-Boot only checks the first byte */
-                       if (info->manufacturer_id ==
-                           ((ATM_MANUFACT & FLASH_VENDMASK) >> 16)) {
+                       if (manufact_match(info, ATM_MANUFACT)) {
                                if (prot) {
                                        flash_unlock_seq (info, 0);
                                        flash_write_cmd (info, 0,
@@ -1507,8 +1513,7 @@ int flash_real_protect (flash_info_t * info, long sector, int prot)
                                                        0, ATM_CMD_UNLOCK_SECT);
                                }
                        }
-                       if (info->manufacturer_id ==
-                           ((AMD_MANUFACT & FLASH_VENDMASK) >> 16)) {
+                       if (info->legacy_unlock) {
                                int flag = disable_interrupts();
                                int lock_flag;
 
@@ -1733,18 +1738,15 @@ static void cmdset_amd_read_jedec_ids(flash_info_t *info)
 static int cmdset_amd_init(flash_info_t *info, struct cfi_qry *qry)
 {
        info->cmd_reset = AMD_CMD_RESET;
+       info->cmd_erase_sector = AMD_CMD_ERASE_SECTOR;
 
        cmdset_amd_read_jedec_ids(info);
        flash_write_cmd(info, 0, info->cfi_offset, FLASH_CMD_CFI);
 
 #ifdef CONFIG_SYS_FLASH_PROTECTION
-       if (info->ext_addr && info->manufacturer_id ==
-           ((AMD_MANUFACT & FLASH_VENDMASK) >> 16)) {
-               ushort spus;
-
-               /* read sector protect/unprotect scheme */
-               spus = flash_read_uchar(info, info->ext_addr + 9);
-               if (spus == 0x8)
+       if (info->ext_addr) {
+               /* read sector protect/unprotect scheme (at 0x49) */
+               if (flash_read_uchar(info, info->ext_addr + 9) == 0x8)
                        info->legacy_unlock = 1;
        }
 #endif
@@ -2003,6 +2005,25 @@ static void flash_fixup_stm(flash_info_t *info, struct cfi_qry *qry)
        }
 }
 
+static void flash_fixup_sst(flash_info_t *info, struct cfi_qry *qry)
+{
+       /*
+        * SST, for many recent nor parallel flashes, says they are
+        * CFI-conformant. This is not true, since qry struct.
+        * reports a std. AMD command set (0x0002), while SST allows to
+        * erase two different sector sizes for the same memory.
+        * 64KB sector (SST call it block)  needs 0x30 to be erased.
+        * 4KB  sector (SST call it sector) needs 0x50 to be erased.
+        * Since CFI query detect the 4KB number of sectors, users expects
+        * a sector granularity of 4KB, and it is here set.
+        */
+       if (info->device_id == 0x5D23 || /* SST39VF3201B */
+           info->device_id == 0x5C23) { /* SST39VF3202B */
+               /* set sector granularity to 4KB */
+               info->cmd_erase_sector=0x50;
+       }
+}
+
 /*
  * The following code cannot be run from FLASH!
  *
@@ -2081,6 +2102,9 @@ ulong flash_get_size (phys_addr_t base, int banknum)
                case 0x0020:
                        flash_fixup_stm(info, &qry);
                        break;
+               case 0x00bf: /* SST */
+                       flash_fixup_sst(info, &qry);
+                       break;
                }
 
                debug ("manufacturer is %d\n", info->vendor);
@@ -2158,6 +2182,27 @@ ulong flash_get_size (phys_addr_t base, int banknum)
                                                             FLASH_OFFSET_PROTECT,
                                                             FLASH_STATUS_PROTECT);
                                        break;
+                               case CFI_CMDSET_AMD_EXTENDED:
+                               case CFI_CMDSET_AMD_STANDARD:
+                                       if (!info->legacy_unlock) {
+                                               /* default: not protected */
+                                               info->protect[sect_cnt] = 0;
+                                               break;
+                                       }
+
+                                       /* Read protection (PPB) from sector */
+                                       flash_write_cmd(info, 0, 0,
+                                                       info->cmd_reset);
+                                       flash_unlock_seq(info, 0);
+                                       flash_write_cmd(info, 0,
+                                                       info->addr_unlock1,
+                                                       FLASH_CMD_READ_ID);
+                                       info->protect[sect_cnt] =
+                                               flash_isset(
+                                                       info, sect_cnt,
+                                                       FLASH_OFFSET_PROTECT,
+                                                       FLASH_STATUS_PROTECT);
+                                       break;
                                default:
                                        /* default: not protected */
                                        info->protect[sect_cnt] = 0;
index 28e52bd08ea72153020584f63f4fa74497ed545d..c77c0c4f0f6eec10c34ce5e3b17d495b6531026f 100644 (file)
@@ -33,6 +33,7 @@ ifdef CONFIG_SPL_NAND_DRIVERS
 NORMAL_DRIVERS=y
 endif
 
+COBJS-$(CONFIG_SPL_NAND_AM33XX_BCH) += am335x_spl_bch.o
 COBJS-$(CONFIG_SPL_NAND_SIMPLE) += nand_spl_simple.o
 COBJS-$(CONFIG_SPL_NAND_LOAD) += nand_spl_load.o
 COBJS-$(CONFIG_SPL_NAND_ECC) += nand_ecc.o
diff --git a/drivers/mtd/nand/am335x_spl_bch.c b/drivers/mtd/nand/am335x_spl_bch.c
new file mode 100644 (file)
index 0000000..b84528b
--- /dev/null
@@ -0,0 +1,238 @@
+/*
+ * (C) Copyright 2012
+ * Konstantin Kozhevnikov, Cogent Embedded
+ *
+ * based on nand_spl_simple code
+ *
+ * (C) Copyright 2006-2008
+ * Stefan Roese, DENX Software Engineering, sr@denx.de.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc.
+ */
+
+#include <common.h>
+#include <nand.h>
+#include <asm/io.h>
+#include <linux/mtd/nand_ecc.h>
+
+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)
+
+
+/*
+ * NAND command for large page NAND devices (2k)
+ */
+static int nand_command(int block, int page, uint32_t offs,
+       u8 cmd)
+{
+       struct nand_chip *this = mtd.priv;
+       int page_addr = page + block * CONFIG_SYS_NAND_PAGE_COUNT;
+       void (*hwctrl)(struct mtd_info *mtd, int cmd,
+                       unsigned int ctrl) = this->cmd_ctrl;
+
+       while (!this->dev_ready(&mtd))
+               ;
+
+       /* Emulate NAND_CMD_READOOB */
+       if (cmd == NAND_CMD_READOOB) {
+               offs += CONFIG_SYS_NAND_PAGE_SIZE;
+               cmd = NAND_CMD_READ0;
+       }
+
+       /* Begin command latch cycle */
+       hwctrl(&mtd, cmd, NAND_CTRL_CLE | NAND_CTRL_CHANGE);
+
+       if (cmd == NAND_CMD_RESET) {
+               hwctrl(&mtd, NAND_CMD_NONE, NAND_NCE | NAND_CTRL_CHANGE);
+               while (!this->dev_ready(&mtd))
+                       ;
+               return 0;
+       }
+
+       /* Shift the offset from byte addressing to word addressing. */
+       if (this->options & NAND_BUSWIDTH_16)
+               offs >>= 1;
+
+       /* Set ALE and clear CLE to start address cycle */
+       /* Column address */
+       hwctrl(&mtd, offs & 0xff,
+                      NAND_CTRL_ALE | NAND_CTRL_CHANGE); /* A[7:0] */
+       hwctrl(&mtd, (offs >> 8) & 0xff, NAND_CTRL_ALE); /* A[11:9] */
+       /* Row address */
+       hwctrl(&mtd, (page_addr & 0xff), NAND_CTRL_ALE); /* A[19:12] */
+       hwctrl(&mtd, ((page_addr >> 8) & 0xff),
+                      NAND_CTRL_ALE); /* A[27:20] */
+#ifdef CONFIG_SYS_NAND_5_ADDR_CYCLE
+       /* One more address cycle for devices > 128MiB */
+       hwctrl(&mtd, (page_addr >> 16) & 0x0f,
+                      NAND_CTRL_ALE); /* A[31:28] */
+#endif
+       hwctrl(&mtd, NAND_CMD_NONE, NAND_NCE | NAND_CTRL_CHANGE);
+
+       if (cmd == NAND_CMD_READ0) {
+               /* Latch in address */
+               hwctrl(&mtd, NAND_CMD_READSTART,
+                          NAND_CTRL_CLE | NAND_CTRL_CHANGE);
+               hwctrl(&mtd, NAND_CMD_NONE, NAND_NCE | NAND_CTRL_CHANGE);
+
+               /*
+                * Wait a while for the data to be ready
+                */
+               while (!this->dev_ready(&mtd))
+                       ;
+       } else if (cmd == NAND_CMD_RNDOUT) {
+               hwctrl(&mtd, NAND_CMD_RNDOUTSTART, NAND_CTRL_CLE |
+                                       NAND_CTRL_CHANGE);
+               hwctrl(&mtd, NAND_CMD_NONE, NAND_NCE | NAND_CTRL_CHANGE);
+       }
+
+       return 0;
+}
+
+static int nand_is_bad_block(int block)
+{
+       struct nand_chip *this = mtd.priv;
+
+       nand_command(block, 0, CONFIG_SYS_NAND_BAD_BLOCK_POS,
+               NAND_CMD_READOOB);
+
+       /*
+        * Read one byte (or two if it's a 16 bit chip).
+        */
+       if (this->options & NAND_BUSWIDTH_16) {
+               if (readw(this->IO_ADDR_R) != 0xffff)
+                       return 1;
+       } else {
+               if (readb(this->IO_ADDR_R) != 0xff)
+                       return 1;
+       }
+
+       return 0;
+}
+
+static int nand_read_page(int block, int page, void *dst)
+{
+       struct nand_chip *this = mtd.priv;
+       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 = ECCSTEPS;
+       uint8_t *p = dst;
+       uint32_t data_pos = 0;
+       uint8_t *oob = &oob_data[0] + nand_ecc_pos[0];
+       uint32_t oob_pos = eccsize * eccsteps + nand_ecc_pos[0];
+
+       nand_command(block, page, 0, NAND_CMD_READ0);
+
+       for (i = 0; eccsteps; eccsteps--, i += eccbytes, p += eccsize) {
+               this->ecc.hwctl(&mtd, NAND_ECC_READ);
+               nand_command(block, page, data_pos, NAND_CMD_RNDOUT);
+
+               this->read_buf(&mtd, p, eccsize);
+
+               nand_command(block, page, oob_pos, NAND_CMD_RNDOUT);
+
+               this->read_buf(&mtd, oob, eccbytes);
+               this->ecc.calculate(&mtd, p, &ecc_calc[i]);
+
+               data_pos += eccsize;
+               oob_pos += eccbytes;
+               oob += eccbytes;
+       }
+
+       /* Pick the ECC bytes out of the oob data */
+       for (i = 0; i < ECCTOTAL; i++)
+               ecc_code[i] = oob_data[nand_ecc_pos[i]];
+
+       eccsteps = ECCSTEPS;
+       p = dst;
+
+       for (i = 0 ; eccsteps; eccsteps--, i += eccbytes, p += eccsize) {
+               /* No chance to do something with the possible error message
+                * from correct_data(). We just hope that all possible errors
+                * are corrected by this routine.
+                */
+               this->ecc.correct(&mtd, p, &ecc_code[i], &ecc_calc[i]);
+       }
+
+       return 0;
+}
+
+int nand_spl_load_image(uint32_t offs, unsigned int size, void *dst)
+{
+       unsigned int block, lastblock;
+       unsigned int page;
+
+       /*
+        * offs has to be aligned to a page address!
+        */
+       block = offs / CONFIG_SYS_NAND_BLOCK_SIZE;
+       lastblock = (offs + size - 1) / CONFIG_SYS_NAND_BLOCK_SIZE;
+       page = (offs % CONFIG_SYS_NAND_BLOCK_SIZE) / CONFIG_SYS_NAND_PAGE_SIZE;
+
+       while (block <= lastblock) {
+               if (!nand_is_bad_block(block)) {
+                       /*
+                        * Skip bad blocks
+                        */
+                       while (page < CONFIG_SYS_NAND_PAGE_COUNT) {
+                               nand_read_page(block, page, dst);
+                               dst += CONFIG_SYS_NAND_PAGE_SIZE;
+                               page++;
+                       }
+
+                       page = 0;
+               } else {
+                       lastblock++;
+               }
+
+               block++;
+       }
+
+       return 0;
+}
+
+/* nand_init() - initialize data to make nand usable by SPL */
+void nand_init(void)
+{
+       /*
+        * Init board specific nand support
+        */
+       mtd.priv = &nand_chip;
+       nand_chip.IO_ADDR_R = nand_chip.IO_ADDR_W =
+               (void  __iomem *)CONFIG_SYS_NAND_BASE;
+       board_nand_init(&nand_chip);
+
+       if (nand_chip.select_chip)
+               nand_chip.select_chip(&mtd, 0);
+
+       /* NAND chip may require reset after power-on */
+       nand_command(0, 0, 0, NAND_CMD_RESET);
+}
+
+/* Unselect after operation */
+void nand_deselect(void)
+{
+       if (nand_chip.select_chip)
+               nand_chip.select_chip(&mtd, -1);
+}
index 0878bece675bd3267d044919dbf0c870d966042b..b13d8a9303a9bea0410c0d9e039926366d5ab7c4 100644 (file)
@@ -391,7 +391,7 @@ static void fsl_ifc_cmdfunc(struct mtd_info *mtd, unsigned int command,
                        timing = IFC_FIR_OP_RBCD;
 
                out_be32(&ifc->ifc_nand.nand_fir0,
-                               (IFC_FIR_OP_CMD0 << IFC_NAND_FIR0_OP0_SHIFT) |
+                               (IFC_FIR_OP_CW0 << IFC_NAND_FIR0_OP0_SHIFT) |
                                (IFC_FIR_OP_UA  << IFC_NAND_FIR0_OP1_SHIFT) |
                                (timing << IFC_NAND_FIR0_OP2_SHIFT));
                out_be32(&ifc->ifc_nand.nand_fcr0,
@@ -758,7 +758,7 @@ static void fsl_ifc_sram_init(void)
 
        /* READID */
        out_be32(&ifc->ifc_nand.nand_fir0,
-                       (IFC_FIR_OP_CMD0 << IFC_NAND_FIR0_OP0_SHIFT) |
+                       (IFC_FIR_OP_CW0 << IFC_NAND_FIR0_OP0_SHIFT) |
                        (IFC_FIR_OP_UA  << IFC_NAND_FIR0_OP1_SHIFT) |
                        (IFC_FIR_OP_RB << IFC_NAND_FIR0_OP2_SHIFT));
        out_be32(&ifc->ifc_nand.nand_fcr0,
index 4701be846c6f2005d4358cb1e4e6b9c6fd051d3f..e38e15125407bb0f2361ac04e96edae893294c7d 100644 (file)
@@ -1058,6 +1058,8 @@ int mxs_nand_init(struct mxs_nand_info *info)
 {
        struct mxs_gpmi_regs *gpmi_regs =
                (struct mxs_gpmi_regs *)MXS_GPMI_BASE;
+       struct mxs_bch_regs *bch_regs =
+               (struct mxs_bch_regs *)MXS_BCH_BASE;
        int i = 0, j;
 
        info->desc = malloc(sizeof(struct mxs_dma_desc *) *
@@ -1081,6 +1083,7 @@ int mxs_nand_init(struct mxs_nand_info *info)
 
        /* Reset the GPMI block. */
        mxs_reset_block(&gpmi_regs->hw_gpmi_ctrl0_reg);
+       mxs_reset_block(&bch_regs->hw_bch_ctrl_reg);
 
        /*
         * Choose NAND mode, set IRQ polarity, disable write protection and
index f1469d11050a04705bc8fa89f91df153359f0bac..cee394ece4b7699bc3932c367f436aeb2debc885 100644 (file)
@@ -29,6 +29,9 @@
 #include <linux/mtd/nand_ecc.h>
 #include <linux/compiler.h>
 #include <nand.h>
+#ifdef CONFIG_AM33XX
+#include <asm/arch/elm.h>
+#endif
 
 static uint8_t cs;
 static __maybe_unused struct nand_ecclayout hw_nand_oob =
@@ -234,6 +237,370 @@ static void __maybe_unused omap_enable_hwecc(struct mtd_info *mtd, int32_t mode)
        }
 }
 
+/*
+ * BCH8 support (needs ELM and thus AM33xx-only)
+ */
+#ifdef CONFIG_AM33XX
+struct nand_bch_priv {
+       uint8_t mode;
+       uint8_t type;
+       uint8_t nibbles;
+};
+
+/* bch types */
+#define ECC_BCH4       0
+#define ECC_BCH8       1
+#define ECC_BCH16      2
+
+/* BCH nibbles for diff bch levels */
+#define NAND_ECC_HW_BCH ((uint8_t)(NAND_ECC_HW_OOB_FIRST) + 1)
+#define ECC_BCH4_NIBBLES       13
+#define ECC_BCH8_NIBBLES       26
+#define ECC_BCH16_NIBBLES      52
+
+static struct nand_ecclayout hw_bch8_nand_oob = GPMC_NAND_HW_BCH8_ECC_LAYOUT;
+
+static struct nand_bch_priv bch_priv = {
+       .mode = NAND_ECC_HW_BCH,
+       .type = ECC_BCH8,
+       .nibbles = ECC_BCH8_NIBBLES
+};
+
+/*
+ * omap_read_bch8_result - Read BCH result for BCH8 level
+ *
+ * @mtd:       MTD device structure
+ * @big_endian:        When set read register 3 first
+ * @ecc_code:  Read syndrome from BCH result registers
+ */
+static void omap_read_bch8_result(struct mtd_info *mtd, uint8_t big_endian,
+                               uint8_t *ecc_code)
+{
+       uint32_t *ptr;
+       int8_t i = 0, j;
+
+       if (big_endian) {
+               ptr = &gpmc_cfg->bch_result_0_3[0].bch_result_x[3];
+               ecc_code[i++] = readl(ptr) & 0xFF;
+               ptr--;
+               for (j = 0; j < 3; j++) {
+                       ecc_code[i++] = (readl(ptr) >> 24) & 0xFF;
+                       ecc_code[i++] = (readl(ptr) >> 16) & 0xFF;
+                       ecc_code[i++] = (readl(ptr) >>  8) & 0xFF;
+                       ecc_code[i++] = readl(ptr) & 0xFF;
+                       ptr--;
+               }
+       } else {
+               ptr = &gpmc_cfg->bch_result_0_3[0].bch_result_x[0];
+               for (j = 0; j < 3; j++) {
+                       ecc_code[i++] = readl(ptr) & 0xFF;
+                       ecc_code[i++] = (readl(ptr) >>  8) & 0xFF;
+                       ecc_code[i++] = (readl(ptr) >> 16) & 0xFF;
+                       ecc_code[i++] = (readl(ptr) >> 24) & 0xFF;
+                       ptr++;
+               }
+               ecc_code[i++] = readl(ptr) & 0xFF;
+               ecc_code[i++] = 0;      /* 14th byte is always zero */
+       }
+}
+
+/*
+ * omap_ecc_disable - Disable H/W ECC calculation
+ *
+ * @mtd:       MTD device structure
+ *
+ */
+static void omap_ecc_disable(struct mtd_info *mtd)
+{
+       writel((readl(&gpmc_cfg->ecc_config) & ~0x1),
+               &gpmc_cfg->ecc_config);
+}
+
+/*
+ * omap_rotate_ecc_bch - Rotate the syndrome bytes
+ *
+ * @mtd:       MTD device structure
+ * @calc_ecc:  ECC read from ECC registers
+ * @syndrome:  Rotated syndrome will be retuned in this array
+ *
+ */
+static void omap_rotate_ecc_bch(struct mtd_info *mtd, uint8_t *calc_ecc,
+               uint8_t *syndrome)
+{
+       struct nand_chip *chip = mtd->priv;
+       struct nand_bch_priv *bch = chip->priv;
+       uint8_t n_bytes = 0;
+       int8_t i, j;
+
+       switch (bch->type) {
+       case ECC_BCH4:
+               n_bytes = 8;
+               break;
+
+       case ECC_BCH16:
+               n_bytes = 28;
+               break;
+
+       case ECC_BCH8:
+       default:
+               n_bytes = 13;
+               break;
+       }
+
+       for (i = 0, j = (n_bytes-1); i < n_bytes; i++, j--)
+               syndrome[i] =  calc_ecc[j];
+}
+
+/*
+ *  omap_calculate_ecc_bch - Read BCH ECC result
+ *
+ *  @mtd:      MTD structure
+ *  @dat:      unused
+ *  @ecc_code: ecc_code buffer
+ */
+static int omap_calculate_ecc_bch(struct mtd_info *mtd, const uint8_t *dat,
+                               uint8_t *ecc_code)
+{
+       struct nand_chip *chip = mtd->priv;
+       struct nand_bch_priv *bch = chip->priv;
+       uint8_t big_endian = 1;
+       int8_t ret = 0;
+
+       if (bch->type == ECC_BCH8)
+               omap_read_bch8_result(mtd, big_endian, ecc_code);
+       else /* BCH4 and BCH16 currently not supported */
+               ret = -1;
+
+       /*
+        * Stop reading anymore ECC vals and clear old results
+        * enable will be called if more reads are required
+        */
+       omap_ecc_disable(mtd);
+
+       return ret;
+}
+
+/*
+ * omap_fix_errors_bch - Correct bch error in the data
+ *
+ * @mtd:       MTD device structure
+ * @data:      Data read from flash
+ * @error_count:Number of errors in data
+ * @error_loc: Locations of errors in the data
+ *
+ */
+static void omap_fix_errors_bch(struct mtd_info *mtd, uint8_t *data,
+               uint32_t error_count, uint32_t *error_loc)
+{
+       struct nand_chip *chip = mtd->priv;
+       struct nand_bch_priv *bch = chip->priv;
+       uint8_t count = 0;
+       uint32_t error_byte_pos;
+       uint32_t error_bit_mask;
+       uint32_t last_bit = (bch->nibbles * 4) - 1;
+
+       /* Flip all bits as specified by the error location array. */
+       /* FOR( each found error location flip the bit ) */
+       for (count = 0; count < error_count; count++) {
+               if (error_loc[count] > last_bit) {
+                       /* Remove the ECC spare bits from correction. */
+                       error_loc[count] -= (last_bit + 1);
+                       /* Offset bit in data region */
+                       error_byte_pos = ((512 * 8) -
+                                       (error_loc[count]) - 1) / 8;
+                       /* Error Bit mask */
+                       error_bit_mask = 0x1 << (error_loc[count] % 8);
+                       /* Toggle the error bit to make the correction. */
+                       data[error_byte_pos] ^= error_bit_mask;
+               }
+       }
+}
+
+/*
+ * omap_correct_data_bch - Compares the ecc read from nand spare area
+ * with ECC registers values and corrects one bit error if it has occured
+ *
+ * @mtd:       MTD device structure
+ * @dat:       page data
+ * @read_ecc:  ecc read from nand flash (ignored)
+ * @calc_ecc:  ecc read from ECC registers
+ *
+ * @return 0 if data is OK or corrected, else returns -1
+ */
+static int omap_correct_data_bch(struct mtd_info *mtd, uint8_t *dat,
+                               uint8_t *read_ecc, uint8_t *calc_ecc)
+{
+       struct nand_chip *chip = mtd->priv;
+       struct nand_bch_priv *bch = chip->priv;
+       uint8_t syndrome[28];
+       uint32_t error_count = 0;
+       uint32_t error_loc[8];
+       uint32_t i, ecc_flag;
+
+       ecc_flag = 0;
+       for (i = 0; i < chip->ecc.bytes; i++)
+               if (read_ecc[i] != 0xff)
+                       ecc_flag = 1;
+
+       if (!ecc_flag)
+               return 0;
+
+       elm_reset();
+       elm_config((enum bch_level)(bch->type));
+
+       /*
+        * while reading ECC result we read it in big endian.
+        * Hence while loading to ELM we have rotate to get the right endian.
+        */
+       omap_rotate_ecc_bch(mtd, calc_ecc, syndrome);
+
+       /* use elm module to check for errors */
+       if (elm_check_error(syndrome, bch->nibbles, &error_count,
+                               error_loc) != 0) {
+               printf("ECC: uncorrectable.\n");
+               return -1;
+       }
+
+       /* correct bch error */
+       if (error_count > 0)
+               omap_fix_errors_bch(mtd, dat, error_count, error_loc);
+
+       return 0;
+}
+/*
+ * omap_hwecc_init_bch - Initialize the BCH Hardware ECC for NAND flash in
+ *                             GPMC controller
+ * @mtd:       MTD device structure
+ * @mode:      Read/Write mode
+ */
+static void omap_hwecc_init_bch(struct nand_chip *chip, int32_t mode)
+{
+       uint32_t val, dev_width = (chip->options & NAND_BUSWIDTH_16) >> 1;
+       uint32_t unused_length = 0;
+       struct nand_bch_priv *bch = chip->priv;
+
+       switch (bch->nibbles) {
+       case ECC_BCH4_NIBBLES:
+               unused_length = 3;
+               break;
+       case ECC_BCH8_NIBBLES:
+               unused_length = 2;
+               break;
+       case ECC_BCH16_NIBBLES:
+               unused_length = 0;
+               break;
+       }
+
+       /* Clear the ecc result registers, select ecc reg as 1 */
+       writel(ECCCLEAR | ECCRESULTREG1, &gpmc_cfg->ecc_control);
+
+       switch (mode) {
+       case NAND_ECC_WRITE:
+               /* eccsize1 config */
+               val = ((unused_length + bch->nibbles) << 22);
+               break;
+
+       case NAND_ECC_READ:
+       default:
+               /* by default eccsize0 selected for ecc1resultsize */
+               /* eccsize0 config */
+               val  = (bch->nibbles << 12);
+               /* eccsize1 config */
+               val |= (unused_length << 22);
+               break;
+       }
+       /* ecc size configuration */
+       writel(val, &gpmc_cfg->ecc_size_config);
+       /* by default 512bytes sector page is selected */
+       /* set bch mode */
+       val  = (1 << 16);
+       /* bch4 / bch8 / bch16 */
+       val |= (bch->type << 12);
+       /* set wrap mode to 1 */
+       val |= (1 << 8);
+       val |= (dev_width << 7);
+       val |= (cs << 1);
+       writel(val, &gpmc_cfg->ecc_config);
+}
+
+/*
+ * omap_enable_ecc_bch- This function enables the bch h/w ecc functionality
+ * @mtd:        MTD device structure
+ * @mode:       Read/Write mode
+ *
+ */
+static void omap_enable_ecc_bch(struct mtd_info *mtd, int32_t mode)
+{
+       struct nand_chip *chip = mtd->priv;
+
+       omap_hwecc_init_bch(chip, mode);
+       /* enable ecc */
+       writel((readl(&gpmc_cfg->ecc_config) | 0x1), &gpmc_cfg->ecc_config);
+}
+
+/**
+ * omap_read_page_bch - hardware ecc based page read function
+ * @mtd:       mtd info structure
+ * @chip:      nand chip info structure
+ * @buf:       buffer to store read data
+ * @page:      page number to read
+ *
+ */
+static int omap_read_page_bch(struct mtd_info *mtd, struct nand_chip *chip,
+                               uint8_t *buf, int page)
+{
+       int i, eccsize = chip->ecc.size;
+       int eccbytes = chip->ecc.bytes;
+       int eccsteps = chip->ecc.steps;
+       uint8_t *p = buf;
+       uint8_t *ecc_calc = chip->buffers->ecccalc;
+       uint8_t *ecc_code = chip->buffers->ecccode;
+       uint32_t *eccpos = chip->ecc.layout->eccpos;
+       uint8_t *oob = chip->oob_poi;
+       uint32_t data_pos;
+       uint32_t oob_pos;
+
+       data_pos = 0;
+       /* oob area start */
+       oob_pos = (eccsize * eccsteps) + chip->ecc.layout->eccpos[0];
+       oob += chip->ecc.layout->eccpos[0];
+
+       for (i = 0; eccsteps; eccsteps--, i += eccbytes, p += eccsize,
+                               oob += eccbytes) {
+               chip->ecc.hwctl(mtd, NAND_ECC_READ);
+               /* read data */
+               chip->cmdfunc(mtd, NAND_CMD_RNDOUT, data_pos, page);
+               chip->read_buf(mtd, p, eccsize);
+
+               /* read respective ecc from oob area */
+               chip->cmdfunc(mtd, NAND_CMD_RNDOUT, oob_pos, page);
+               chip->read_buf(mtd, oob, eccbytes);
+               /* read syndrome */
+               chip->ecc.calculate(mtd, p, &ecc_calc[i]);
+
+               data_pos += eccsize;
+               oob_pos += eccbytes;
+       }
+
+       for (i = 0; i < chip->ecc.total; i++)
+               ecc_code[i] = chip->oob_poi[eccpos[i]];
+
+       eccsteps = chip->ecc.steps;
+       p = buf;
+
+       for (i = 0 ; eccsteps; eccsteps--, i += eccbytes, p += eccsize) {
+               int stat;
+
+               stat = chip->ecc.correct(mtd, p, &ecc_code[i], &ecc_calc[i]);
+               if (stat < 0)
+                       mtd->ecc_stats.failed++;
+               else
+                       mtd->ecc_stats.corrected += stat;
+       }
+       return 0;
+}
+#endif /* CONFIG_AM33XX */
+
 #ifndef CONFIG_SPL_BUILD
 /*
  * omap_nand_switch_ecc - switch the ECC operation b/w h/w ecc and s/w ecc.
@@ -269,7 +636,7 @@ void omap_nand_switch_ecc(int32_t hardware)
        nand->ecc.calculate = NULL;
 
        /* Setup the ecc configurations again */
-       if (hardware) {
+       if (hardware == 1) {
                nand->ecc.mode = NAND_ECC_HW;
                nand->ecc.layout = &hw_nand_oob;
                nand->ecc.size = 512;
@@ -279,6 +646,19 @@ void omap_nand_switch_ecc(int32_t hardware)
                nand->ecc.calculate = omap_calculate_ecc;
                omap_hwecc_init(nand);
                printf("HW ECC selected\n");
+#ifdef CONFIG_AM33XX
+       } else if (hardware == 2) {
+               nand->ecc.mode = NAND_ECC_HW;
+               nand->ecc.layout = &hw_bch8_nand_oob;
+               nand->ecc.size = 512;
+               nand->ecc.bytes = 14;
+               nand->ecc.read_page = omap_read_page_bch;
+               nand->ecc.hwctl = omap_enable_ecc_bch;
+               nand->ecc.correct = omap_correct_data_bch;
+               nand->ecc.calculate = omap_calculate_ecc_bch;
+               omap_hwecc_init_bch(nand, NAND_ECC_READ);
+               printf("HW BCH8 selected\n");
+#endif
        } else {
                nand->ecc.mode = NAND_ECC_SOFT;
                /* Use mtd default settings */
@@ -350,7 +730,27 @@ int board_nand_init(struct nand_chip *nand)
                nand->options |= NAND_BUSWIDTH_16;
 
        nand->chip_delay = 100;
+
+#ifdef CONFIG_AM33XX
+       /* required in case of BCH */
+       elm_init();
+
+       /* BCH info that will be correct for SPL or overridden otherwise. */
+       nand->priv = &bch_priv;
+#endif
+
        /* Default ECC mode */
+#ifdef CONFIG_AM33XX
+       nand->ecc.mode = NAND_ECC_HW;
+       nand->ecc.layout = &hw_bch8_nand_oob;
+       nand->ecc.size = CONFIG_SYS_NAND_ECCSIZE;
+       nand->ecc.bytes = CONFIG_SYS_NAND_ECCBYTES;
+       nand->ecc.hwctl = omap_enable_ecc_bch;
+       nand->ecc.correct = omap_correct_data_bch;
+       nand->ecc.calculate = omap_calculate_ecc_bch;
+       nand->ecc.read_page = omap_read_page_bch;
+       omap_hwecc_init_bch(nand, NAND_ECC_READ);
+#else
 #if !defined(CONFIG_SPL_BUILD) || defined(CONFIG_SPL_NAND_SOFTECC)
        nand->ecc.mode = NAND_ECC_SOFT;
 #else
@@ -363,6 +763,7 @@ int board_nand_init(struct nand_chip *nand)
        nand->ecc.calculate = omap_calculate_ecc;
        omap_hwecc_init(nand);
 #endif
+#endif
 
 #ifdef CONFIG_SPL_BUILD
        if (nand->options & NAND_BUSWIDTH_16)
index af3d8593eb6933e42207717913f6b27fc31ec8d8..db04795dfc97c55db137d5af2a92bd31364ce43b 100644 (file)
@@ -920,7 +920,10 @@ static int cpsw_phy_init(struct eth_device *dev, struct cpsw_slave *slave)
                        SUPPORTED_100baseT_Full |
                        SUPPORTED_1000baseT_Full);
 
-       phydev = phy_connect(priv->bus, 0, dev, slave->data->phy_if);
+       phydev = phy_connect(priv->bus,
+                       CONFIG_PHY_ADDR,
+                       dev,
+                       slave->data->phy_if);
 
        phydev->supported &= supported;
        phydev->advertising = phydev->supported;
index 2d4da4b386dd98caa822a3ecfa8417e396a0fc96..8ba98b27d52283be000f0896f838ca5e13eba591 100644 (file)
@@ -1688,6 +1688,16 @@ e1000_init_hw(struct eth_device *nic)
                E1000_WRITE_REG(hw, TXDCTL, ctrl);
        }
 
+       /* Set the receive descriptor write back policy */
+
+       if (hw->mac_type >= e1000_82571) {
+               ctrl = E1000_READ_REG(hw, RXDCTL);
+               ctrl =
+                   (ctrl & ~E1000_RXDCTL_WTHRESH) |
+                   E1000_RXDCTL_FULL_RX_DESC_WB;
+               E1000_WRITE_REG(hw, RXDCTL, ctrl);
+       }
+
        switch (hw->mac_type) {
        default:
                break;
index fd1d8f8717f2c90dc5b45cd869b52edfe6a224f9..1bbae5085ac9dac0fbf431c1c4bb8f231e50e9c1 100644 (file)
@@ -1551,6 +1551,7 @@ struct e1000_hw {
 #define E1000_RXDCTL_HTHRESH 0x00003F00        /* RXDCTL Host Threshold */
 #define E1000_RXDCTL_WTHRESH 0x003F0000        /* RXDCTL Writeback Threshold */
 #define E1000_RXDCTL_GRAN    0x01000000        /* RXDCTL Granularity */
+#define E1000_RXDCTL_FULL_RX_DESC_WB 0x01010000        /* GRAN=1, WTHRESH=1 */
 
 /* Transmit Descriptor Control */
 #define E1000_TXDCTL_PTHRESH 0x0000003F        /* TXDCTL Prefetch Threshold */
index e51e799e2933803ddc73401e6400b9db8a2d0b78..4b271989acbbaf5dbc8c4333e705f29ab0f9d642 100644 (file)
@@ -425,6 +425,16 @@ static struct phy_driver M88E1118_driver = {
        .shutdown = &genphy_shutdown,
 };
 
+static struct phy_driver M88E1118R_driver = {
+       .name = "Marvell 88E1118R",
+       .uid = 0x1410e40,
+       .mask = 0xffffff0,
+       .features = PHY_GBIT_FEATURES,
+       .config = &m88e1118_config,
+       .startup = &m88e1118_startup,
+       .shutdown = &genphy_shutdown,
+};
+
 static struct phy_driver M88E1121R_driver = {
        .name = "Marvell 88E1121R",
        .uid = 0x1410cb0,
@@ -461,6 +471,7 @@ int phy_marvell_init(void)
        phy_register(&M88E1145_driver);
        phy_register(&M88E1121R_driver);
        phy_register(&M88E1118_driver);
+       phy_register(&M88E1118R_driver);
        phy_register(&M88E1111S_driver);
        phy_register(&M88E1011S_driver);
 
index 483a920fcaeee1432263389390c850bd2a7c21f2..e8da66d63f6949ce168746590a5050c80d67ee98 100644 (file)
 #include <netdev.h>
 #include "mv88e61xx.h"
 
+/*
+ * Uncomment either of the following line for local debug control;
+ * otherwise global debug control will apply.
+ */
+
+/* #undef DEBUG */
+/* #define DEBUG */
+
 #ifdef CONFIG_MV88E61XX_MULTICHIP_ADRMODE
 /* Chip Address mode
  * The Switch support two modes of operation
@@ -52,7 +60,8 @@ static int mv88e61xx_busychk_multic(char *name, u32 devaddr)
        return 0;
 }
 
-static void mv88e61xx_wr_phy(char *name, u32 phy_adr, u32 reg_ofs, u16 data)
+static void mv88e61xx_switch_write(char *name, u32 phy_adr,
+       u32 reg_ofs, u16 data)
 {
        u16 mii_dev_addr;
 
@@ -70,7 +79,8 @@ static void mv88e61xx_wr_phy(char *name, u32 phy_adr, u32 reg_ofs, u16 data)
                                                                         15));
 }
 
-static void mv88e61xx_rd_phy(char *name, u32 phy_adr, u32 reg_ofs, u16 * data)
+static void mv88e61xx_switch_read(char *name, u32 phy_adr,
+       u32 reg_ofs, u16 *data)
 {
        u16 mii_dev_addr;
 
@@ -90,110 +100,51 @@ static void mv88e61xx_rd_phy(char *name, u32 phy_adr, u32 reg_ofs, u16 * data)
 }
 #endif /* CONFIG_MV88E61XX_MULTICHIP_ADRMODE */
 
-static void mv88e61xx_port_vlan_config(struct mv88e61xx_config *swconfig,
-                                      u32 max_prtnum, u32 ports_ofs)
-{
-       u32 prt;
-       u16 reg;
-       char *name = swconfig->name;
-       u32 cpu_port = swconfig->cpuport;
-       u32 port_mask = swconfig->ports_enabled;
-       enum mv88e61xx_cfg_vlan vlancfg = swconfig->vlancfg;
-
-       /* be sure all ports are disabled */
-       for (prt = 0; prt < max_prtnum; prt++) {
-               RD_PHY(name, ports_ofs + prt, MV88E61XX_PRT_CTRL_REG, &reg);
-               reg &= ~0x3;
-               WR_PHY(name, ports_ofs + prt, MV88E61XX_PRT_CTRL_REG, reg);
-
-               if (!(cpu_port & (1 << prt)))
-                       continue;
-               /* Set CPU port VID to 0x1 */
-               RD_PHY(name, (ports_ofs + prt), MV88E61XX_PRT_VID_REG, &reg);
-               reg &= ~0xfff;
-               reg |= 0x1;
-               WR_PHY(name, (ports_ofs + prt), MV88E61XX_PRT_VID_REG, reg);
-       }
-
-       /* Setting  Port default priority for all ports to zero */
-       for (prt = 0; prt < max_prtnum; prt++) {
-               RD_PHY(name, ports_ofs + prt, MV88E61XX_PRT_VID_REG, &reg);
-               reg &= ~0xc000;
-               WR_PHY(name, ports_ofs + prt, MV88E61XX_PRT_VID_REG, reg);
-       }
-       /* Setting VID and VID map for all ports except CPU port */
-       for (prt = 0; prt < max_prtnum; prt++) {
-               /* only for enabled ports */
-               if ((1 << prt) & port_mask) {
-                       /* skip CPU port */
-                       if ((1 << prt) & cpu_port) {
-                               /*
-                                * Set Vlan map table for cpu_port to see
-                                * all ports
-                                */
-                               RD_PHY(name, (ports_ofs + prt),
-                                      MV88E61XX_PRT_VMAP_REG, &reg);
-                               reg &= ~((1 << max_prtnum) - 1);
-                               reg |= port_mask & ~(1 << prt);
-                               WR_PHY(name, (ports_ofs + prt),
-                                      MV88E61XX_PRT_VMAP_REG, reg);
-                       } else {
-
-                               /*
-                                *  set Ports VLAN Mapping.
-                                *      port prt <--> cpu_port VLAN #prt+1.
-                                */
-                               RD_PHY(name, ports_ofs + prt,
-                                      MV88E61XX_PRT_VID_REG, &reg);
-                               reg &= ~0x0fff;
-                               reg |= (prt + 1);
-                               WR_PHY(name, ports_ofs + prt,
-                                      MV88E61XX_PRT_VID_REG, reg);
-
-                               RD_PHY(name, ports_ofs + prt,
-                                      MV88E61XX_PRT_VMAP_REG, &reg);
-                               if (vlancfg == MV88E61XX_VLANCFG_DEFAULT) {
-                                       /*
-                                        * all any port can send frames to all other ports
-                                        * ref: sec 3.2.1.1 of datasheet
-                                        */
-                                       reg |= 0x03f;
-                                       reg &= ~(1 << prt);
-                               } else if (vlancfg == MV88E61XX_VLANCFG_ROUTER) {
-                                       /*
-                                        * all other ports can send frames to CPU port only
-                                        * ref: sec 3.2.1.2 of datasheet
-                                        */
-                                       reg &= ~((1 << max_prtnum) - 1);
-                                       reg |= cpu_port;
-                               }
-                               WR_PHY(name, ports_ofs + prt,
-                                      MV88E61XX_PRT_VMAP_REG, reg);
-                       }
-               }
-       }
+/*
+ * Convenience macros for switch device/port reads/writes
+ * These macros output valid 'mv88e61xx' U_BOOT_CMDs
+ */
 
-       /*
-        * enable only appropriate ports to forwarding mode
-        * and disable the others
-        */
-       for (prt = 0; prt < max_prtnum; prt++) {
-               if ((1 << prt) & port_mask) {
-                       RD_PHY(name, ports_ofs + prt,
-                              MV88E61XX_PRT_CTRL_REG, &reg);
-                       reg |= 0x3;
-                       WR_PHY(name, ports_ofs + prt,
-                              MV88E61XX_PRT_CTRL_REG, reg);
-               } else {
-                       /* Disable port */
-                       RD_PHY(name, ports_ofs + prt,
-                              MV88E61XX_PRT_CTRL_REG, &reg);
-                       reg &= ~0x3;
-                       WR_PHY(name, ports_ofs + prt,
-                              MV88E61XX_PRT_CTRL_REG, reg);
-               }
-       }
+#ifndef DEBUG
+#define WR_SWITCH_REG wr_switch_reg
+#define RD_SWITCH_REG rd_switch_reg
+#define WR_SWITCH_PORT_REG(n, p, r, d) \
+       WR_SWITCH_REG(n, (MV88E61XX_PRT_OFST+p), r, d)
+#define RD_SWITCH_PORT_REG(n, p, r, d) \
+       RD_SWITCH_REG(n, (MV88E61XX_PRT_OFST+p), r, d)
+#else
+static void WR_SWITCH_REG(char *name, u32 dev_adr, u32 reg_ofs, u16 data)
+{
+       printf("mv88e61xx %s dev %02x reg %02x write %04x\n",
+               name, dev_adr, reg_ofs, data);
+       wr_switch_reg(name, dev_adr, reg_ofs, data);
 }
+static void RD_SWITCH_REG(char *name, u32 dev_adr, u32 reg_ofs, u16 *data)
+{
+       rd_switch_reg(name, dev_adr, reg_ofs, data);
+       printf("mv88e61xx %s dev %02x reg %02x read %04x\n",
+               name, dev_adr, reg_ofs, *data);
+}
+static void WR_SWITCH_PORT_REG(char *name, u32 prt_adr, u32 reg_ofs,
+       u16 data)
+{
+       printf("mv88e61xx %s port %02x reg %02x write %04x\n",
+               name, prt_adr, reg_ofs, data);
+       wr_switch_reg(name, (MV88E61XX_PRT_OFST+prt_adr), reg_ofs, data);
+}
+static void RD_SWITCH_PORT_REG(char *name, u32 prt_adr, u32 reg_ofs,
+       u16 *data)
+{
+       rd_switch_reg(name, (MV88E61XX_PRT_OFST+prt_adr), reg_ofs, data);
+       printf("mv88e61xx %s port %02x reg %02x read %04x\n",
+               name, prt_adr, reg_ofs, *data);
+}
+#endif
+
+/*
+ * Local functions to read/write registers on the switch PHYs.
+ * NOTE! This goes through switch, not direct miiphy, writes and reads!
+ */
 
 /*
  * Make sure SMIBusy bit cleared before another
@@ -204,7 +155,7 @@ static int mv88e61xx_busychk(char *name)
        u16 reg = 0;
        u32 timeout = MV88E61XX_PHY_TIMEOUT;
        do {
-               RD_PHY(name, MV88E61XX_GLB2REG_DEVADR,
+               rd_switch_reg(name, MV88E61XX_GLB2REG_DEVADR,
                       MV88E61XX_PHY_CMD, &reg);
                if (timeout-- == 0) {
                        printf("SMI busy timeout\n");
@@ -214,34 +165,110 @@ static int mv88e61xx_busychk(char *name)
        return 0;
 }
 
+static inline int mv88e61xx_switch_miiphy_write(char *name, u32 phy,
+       u32 reg, u16 data)
+{
+       /* write switch data reg then cmd reg then check completion */
+       wr_switch_reg(name, MV88E61XX_GLB2REG_DEVADR, MV88E61XX_PHY_DATA,
+               data);
+       wr_switch_reg(name, MV88E61XX_GLB2REG_DEVADR, MV88E61XX_PHY_CMD,
+               (MV88E61XX_PHY_WRITE_CMD | (phy << 5)  | reg));
+       return mv88e61xx_busychk(name);
+}
+
+static inline int mv88e61xx_switch_miiphy_read(char *name, u32 phy,
+       u32 reg, u16 *data)
+{
+       /* write switch cmd reg, check for completion */
+       wr_switch_reg(name, MV88E61XX_GLB2REG_DEVADR, MV88E61XX_PHY_CMD,
+               (MV88E61XX_PHY_READ_CMD | (phy << 5)  | reg));
+       if (mv88e61xx_busychk(name))
+               return -1;
+       /* read switch data reg and return success */
+       rd_switch_reg(name, MV88E61XX_GLB2REG_DEVADR, MV88E61XX_PHY_DATA, data);
+       return 0;
+}
+
+/*
+ * Convenience macros for switch PHY reads/writes
+ */
+
+#ifndef DEBUG
+#define WR_SWITCH_PHY_REG mv88e61xx_switch_miiphy_write
+#define RD_SWITCH_PHY_REG mv88e61xx_switch_miiphy_read
+#else
+static inline int WR_SWITCH_PHY_REG(char *name, u32 phy_adr,
+       u32 reg_ofs, u16 data)
+{
+       int r = mv88e61xx_switch_miiphy_write(name, phy_adr, reg_ofs, data);
+       if (r)
+               printf("** ERROR writing mv88e61xx %s phy %02x reg %02x\n",
+                       name, phy_adr, reg_ofs);
+       else
+               printf("mv88e61xx %s phy %02x reg %02x write %04x\n",
+                       name, phy_adr, reg_ofs, data);
+       return r;
+}
+static inline int RD_SWITCH_PHY_REG(char *name, u32 phy_adr,
+       u32 reg_ofs, u16 *data)
+{
+       int r = mv88e61xx_switch_miiphy_read(name, phy_adr, reg_ofs, data);
+       if (r)
+               printf("** ERROR reading mv88e61xx %s phy %02x reg %02x\n",
+                       name, phy_adr, reg_ofs);
+       else
+               printf("mv88e61xx %s phy %02x reg %02x read %04x\n",
+                       name, phy_adr, reg_ofs, *data);
+       return r;
+}
+#endif
+
+static void mv88e61xx_port_vlan_config(struct mv88e61xx_config *swconfig)
+{
+       u32 prt;
+       u16 reg;
+       char *name = swconfig->name;
+       u32 port_mask = swconfig->ports_enabled;
+
+       /* apply internal vlan config */
+       for (prt = 0; prt < MV88E61XX_MAX_PORTS_NUM; prt++) {
+               /* only for enabled ports */
+               if ((1 << prt) & port_mask) {
+                       /* take vlan map from swconfig */
+                       u8 vlanmap = swconfig->vlancfg[prt];
+                       /* remove disabled ports from vlan map */
+                       vlanmap &= swconfig->ports_enabled;
+                       /* apply vlan map to port */
+                       RD_SWITCH_PORT_REG(name, prt,
+                               MV88E61XX_PRT_VMAP_REG, &reg);
+                       reg &= ~((1 << MV88E61XX_MAX_PORTS_NUM) - 1);
+                       reg |= vlanmap;
+                       WR_SWITCH_PORT_REG(name, prt,
+                               MV88E61XX_PRT_VMAP_REG, reg);
+               }
+       }
+}
+
 /*
  * Power up the specified port and reset PHY
  */
-static int mv88361xx_powerup(struct mv88e61xx_config *swconfig, u32 prt)
+static int mv88361xx_powerup(struct mv88e61xx_config *swconfig, u32 phy)
 {
        char *name = swconfig->name;
 
-       /* Write Copper Specific control reg1 (0x14) for-
+       /* Write Copper Specific control reg1 (0x10) for-
         * Enable Phy power up
         * Energy Detect on (sense&Xmit NLP Periodically
         * reset other settings default
         */
-       WR_PHY(name, MV88E61XX_GLB2REG_DEVADR, MV88E61XX_PHY_DATA, 0x3360);
-       WR_PHY(name, MV88E61XX_GLB2REG_DEVADR,
-              MV88E61XX_PHY_CMD, (0x9410 | (prt << 5)));
-
-       if (mv88e61xx_busychk(name))
+       if (WR_SWITCH_PHY_REG(name, phy, 0x10, 0x3360))
                return -1;
 
        /* Write PHY ctrl reg (0x0) to apply
         * Phy reset (set bit 15 low)
         * reset other default values
         */
-       WR_PHY(name, MV88E61XX_GLB2REG_DEVADR, MV88E61XX_PHY_DATA, 0x1140);
-       WR_PHY(name, MV88E61XX_GLB2REG_DEVADR,
-              MV88E61XX_PHY_CMD, (0x9400 | (prt << 5)));
-
-       if (mv88e61xx_busychk(name))
+       if (WR_SWITCH_PHY_REG(name, phy, 0x00, 0x9140))
                return -1;
 
        return 0;
@@ -256,48 +283,26 @@ static int mv88361xx_powerup(struct mv88e61xx_config *swconfig, u32 prt)
  * to setup PHY LEDs default configuration to detect 10/100/1000Mb/s
  * Link status
  */
-static int mv88361xx_led_init(struct mv88e61xx_config *swconfig, u32 prt)
+static int mv88361xx_led_init(struct mv88e61xx_config *swconfig, u32 phy)
 {
        char *name = swconfig->name;
-       u16 reg;
 
        if (swconfig->led_init != MV88E61XX_LED_INIT_EN)
                return 0;
 
        /* set page address to 3 */
-       reg = 3;
-       WR_PHY(name, MV88E61XX_GLB2REG_DEVADR, MV88E61XX_PHY_DATA, reg);
-       WR_PHY(name, MV88E61XX_GLB2REG_DEVADR,
-              MV88E61XX_PHY_CMD, (1 << MV88E61XX_BUSY_OFST |
-                                  1 << MV88E61XX_MODE_OFST |
-                                  1 << MV88E61XX_OP_OFST |
-                                  prt << MV88E61XX_ADDR_OFST | 22));
-
-       if (mv88e61xx_busychk(name))
+       if (WR_SWITCH_PHY_REG(name, phy, 0x16, 0x0003))
                return -1;
 
-       /* set LED Func Ctrl reg */
-       reg = 1;        /* LED[0] On-Link, Blink-Activity, Off-NoLink */
-       WR_PHY(name, MV88E61XX_GLB2REG_DEVADR, MV88E61XX_PHY_DATA, reg);
-       WR_PHY(name, MV88E61XX_GLB2REG_DEVADR,
-              MV88E61XX_PHY_CMD, (1 << MV88E61XX_BUSY_OFST |
-                                  1 << MV88E61XX_MODE_OFST |
-                                  1 << MV88E61XX_OP_OFST |
-                                  prt << MV88E61XX_ADDR_OFST | 16));
-
-       if (mv88e61xx_busychk(name))
+       /*
+        * set LED Func Ctrl reg
+        * value 0x0001 = LED[0] On-Link, Blink-Activity, Off-NoLink
+        */
+       if (WR_SWITCH_PHY_REG(name, phy, 0x10, 0x0001))
                return -1;
 
        /* set page address to 0 */
-       reg = 0;
-       WR_PHY(name, MV88E61XX_GLB2REG_DEVADR, MV88E61XX_PHY_DATA, reg);
-       WR_PHY(name, MV88E61XX_GLB2REG_DEVADR,
-              MV88E61XX_PHY_CMD, (1 << MV88E61XX_BUSY_OFST |
-                                  1 << MV88E61XX_MODE_OFST |
-                                  1 << MV88E61XX_OP_OFST |
-                                  prt << MV88E61XX_ADDR_OFST | 22));
-
-       if (mv88e61xx_busychk(name))
+       if (WR_SWITCH_PHY_REG(name, phy, 0x16, 0x0000))
                return -1;
 
        return 0;
@@ -312,23 +317,15 @@ static int mv88361xx_led_init(struct mv88e61xx_config *swconfig, u32 prt)
  * This is optional settings may be needed on some boards
  * for PHY<->magnetics h/w tuning
  */
-static int mv88361xx_reverse_mdipn(struct mv88e61xx_config *swconfig, u32 prt)
+static int mv88361xx_reverse_mdipn(struct mv88e61xx_config *swconfig, u32 phy)
 {
        char *name = swconfig->name;
-       u16 reg;
 
        if (swconfig->mdip != MV88E61XX_MDIP_REVERSE)
                return 0;
 
-       reg = 0x0f;             /*Reverse MDIP/N[3:0] bits */
-       WR_PHY(name, MV88E61XX_GLB2REG_DEVADR, MV88E61XX_PHY_DATA, reg);
-       WR_PHY(name, MV88E61XX_GLB2REG_DEVADR,
-              MV88E61XX_PHY_CMD, (1 << MV88E61XX_BUSY_OFST |
-                                  1 << MV88E61XX_MODE_OFST |
-                                  1 << MV88E61XX_OP_OFST |
-                                  prt << MV88E61XX_ADDR_OFST | 20));
-
-       if (mv88e61xx_busychk(name))
+       /*Reverse MDIP/N[3:0] bits */
+       if (WR_SWITCH_PHY_REG(name, phy, 0x14, 0x000f))
                return -1;
 
        return 0;
@@ -343,6 +340,7 @@ int mv88e61xx_switch_initialize(struct mv88e61xx_config *swconfig)
        u16 reg;
        char *idstr;
        char *name = swconfig->name;
+       int time;
 
        if (miiphy_set_current_dev(name)) {
                printf("%s failed\n", __FUNCTION__);
@@ -354,7 +352,7 @@ int mv88e61xx_switch_initialize(struct mv88e61xx_config *swconfig)
                printf("Invalid cpu port config, using default port5\n");
        }
 
-       RD_PHY(name, MV88E61XX_PRT_OFST, MII_PHYSID2, &reg);
+       RD_SWITCH_PORT_REG(name, 0, MII_PHYSID2, &reg);
        switch (reg &= 0xfff0) {
        case 0x1610:
                idstr = "88E6161";
@@ -373,46 +371,183 @@ int mv88e61xx_switch_initialize(struct mv88e61xx_config *swconfig)
                break;
        }
 
-       /* Port based VLANs configuration */
-       if ((swconfig->vlancfg == MV88E61XX_VLANCFG_DEFAULT)
-           || (swconfig->vlancfg == MV88E61XX_VLANCFG_ROUTER))
-               mv88e61xx_port_vlan_config(swconfig, MV88E61XX_MAX_PORTS_NUM,
-                                          MV88E61XX_PRT_OFST);
-       else {
-               printf("Unsupported mode %s failed\n", __FUNCTION__);
-               return -1;
+       /* be sure all ports are disabled */
+       for (prt = 0; prt < MV88E61XX_MAX_PORTS_NUM; prt++) {
+               RD_SWITCH_PORT_REG(name, prt, MV88E61XX_PRT_CTRL_REG, &reg);
+               reg &= ~0x3;
+               WR_SWITCH_PORT_REG(name, prt, MV88E61XX_PRT_CTRL_REG, reg);
        }
 
+       /* wait 2 ms for queues to drain */
+       udelay(2000);
+
+       /* reset switch */
+       RD_SWITCH_REG(name, MV88E61XX_GLBREG_DEVADR, MV88E61XX_SGCR, &reg);
+       reg |= 0x8000;
+       WR_SWITCH_REG(name, MV88E61XX_GLBREG_DEVADR, MV88E61XX_SGCR, reg);
+
+       /* wait up to 1 second for switch reset complete */
+       for (time = 1000; time; time--) {
+               RD_SWITCH_REG(name, MV88E61XX_GLBREG_DEVADR, MV88E61XX_SGSR,
+                       &reg);
+               if ((reg & 0xc800) == 0xc800)
+                       break;
+               udelay(1000);
+       }
+       if (!time)
+               return -1;
+
+       /* Port based VLANs configuration */
+       mv88e61xx_port_vlan_config(swconfig);
+
        if (swconfig->rgmii_delay == MV88E61XX_RGMII_DELAY_EN) {
                /*
                 * Enable RGMII delay on Tx and Rx for CPU port
                 * Ref: sec 9.5 of chip datasheet-02
                 */
-               WR_PHY(name, MV88E61XX_PRT_OFST + 5,
-                      MV88E61XX_RGMII_TIMECTRL_REG, 0x18);
-               WR_PHY(name, MV88E61XX_PRT_OFST + 4,
-                      MV88E61XX_RGMII_TIMECTRL_REG, 0xc1e7);
+               /*Force port link down */
+               WR_SWITCH_PORT_REG(name, 5, MV88E61XX_PCS_CTRL_REG, 0x10);
+               /* configure port RGMII delay */
+               WR_SWITCH_PORT_REG(name, 4,
+                       MV88E61XX_RGMII_TIMECTRL_REG, 0x81e7);
+               RD_SWITCH_PORT_REG(name, 5,
+                       MV88E61XX_RGMII_TIMECTRL_REG, &reg);
+               WR_SWITCH_PORT_REG(name, 5,
+                       MV88E61XX_RGMII_TIMECTRL_REG, reg | 0x18);
+               WR_SWITCH_PORT_REG(name, 4,
+                       MV88E61XX_RGMII_TIMECTRL_REG, 0xc1e7);
+               /* Force port to RGMII FDX 1000Base then up */
+               WR_SWITCH_PORT_REG(name, 5, MV88E61XX_PCS_CTRL_REG, 0x1e);
+               WR_SWITCH_PORT_REG(name, 5, MV88E61XX_PCS_CTRL_REG, 0x3e);
        }
 
        for (prt = 0; prt < MV88E61XX_MAX_PORTS_NUM; prt++) {
-               if (!((1 << prt) & swconfig->cpuport)) {
 
-                       if (mv88361xx_led_init(swconfig, prt))
+               /* configure port's PHY */
+               if (!((1 << prt) & swconfig->cpuport)) {
+                       /* port 4 has phy 6, not 4 */
+                       int phy = (prt == 4) ? 6 : prt;
+                       if (mv88361xx_powerup(swconfig, phy))
                                return -1;
-                       if (mv88361xx_reverse_mdipn(swconfig, prt))
+                       if (mv88361xx_reverse_mdipn(swconfig, phy))
                                return -1;
-                       if (mv88361xx_powerup(swconfig, prt))
+                       if (mv88361xx_led_init(swconfig, phy))
                                return -1;
                }
 
+               /* set port VID to port+1 except for cpu port */
+               if (!((1 << prt) & swconfig->cpuport)) {
+                       RD_SWITCH_PORT_REG(name, prt,
+                               MV88E61XX_PRT_VID_REG, &reg);
+                       WR_SWITCH_PORT_REG(name, prt,
+                               MV88E61XX_PRT_VID_REG,
+                               (reg & ~1023) | (prt+1));
+               }
+
                /*Program port state */
-               RD_PHY(name, MV88E61XX_PRT_OFST + prt,
-                      MV88E61XX_PRT_CTRL_REG, &reg);
-               WR_PHY(name, MV88E61XX_PRT_OFST + prt,
-                      MV88E61XX_PRT_CTRL_REG,
-                      reg | (swconfig->portstate & 0x03));
+               RD_SWITCH_PORT_REG(name, prt,
+                       MV88E61XX_PRT_CTRL_REG, &reg);
+               WR_SWITCH_PORT_REG(name, prt,
+                       MV88E61XX_PRT_CTRL_REG,
+                       reg | (swconfig->portstate & 0x03));
+
        }
 
        printf("%s Initialized on %s\n", idstr, name);
        return 0;
 }
+
+#ifdef CONFIG_MV88E61XX_CMD
+static int
+do_switch(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+{
+       char *name, *endp;
+       int write = 0;
+       enum { dev, prt, phy } target = dev;
+       u32 addrlo, addrhi, addr;
+       u32 reglo, reghi, reg;
+       u16 data, rdata;
+
+       if (argc < 7)
+               return -1;
+
+       name = argv[1];
+
+       if (strcmp(argv[2], "phy") == 0)
+               target = phy;
+       else if (strcmp(argv[2], "port") == 0)
+               target = prt;
+       else if (strcmp(argv[2], "dev") != 0)
+               return 1;
+
+       addrlo = simple_strtoul(argv[3], &endp, 16);
+
+       if (!*endp) {
+               addrhi = addrlo;
+       } else {
+               while (*endp < '0' || *endp > '9')
+                       endp++;
+               addrhi = simple_strtoul(endp, NULL, 16);
+       }
+
+       reglo = simple_strtoul(argv[5], &endp, 16);
+       if (!*endp) {
+               reghi = reglo;
+       } else {
+               while (*endp < '0' || *endp > '9')
+                       endp++;
+               reghi = simple_strtoul(endp, NULL, 16);
+       }
+
+       if (strcmp(argv[6], "write") == 0)
+               write = 1;
+       else if (strcmp(argv[6], "read") != 0)
+               return 1;
+
+       data = simple_strtoul(argv[7], NULL, 16);
+
+       for (addr = addrlo; addr <= addrhi; addr++) {
+               for (reg = reglo; reg <= reghi; reg++) {
+                       if (write) {
+                               if (target == phy)
+                                       mv88e61xx_switch_miiphy_write(
+                                               name, addr, reg, data);
+                               else if (target == prt)
+                                       wr_switch_reg(name,
+                                               addr+MV88E61XX_PRT_OFST,
+                                               reg, data);
+                               else
+                                       wr_switch_reg(name, addr, reg, data);
+                       } else {
+                               if (target == phy)
+                                       mv88e61xx_switch_miiphy_read(
+                                               name, addr, reg, &rdata);
+                               else if (target == prt)
+                                       rd_switch_reg(name,
+                                               addr+MV88E61XX_PRT_OFST,
+                                               reg, &rdata);
+                               else
+                                       rd_switch_reg(name, addr, reg, &rdata);
+                               printf("%s %s %s %02x %s %02x %s %04x\n",
+                                       argv[0], argv[1], argv[2], addr,
+                                       argv[4], reg, argv[6], rdata);
+                               if (write && argc == 7 && rdata != data)
+                                       return 1;
+                       }
+               }
+       }
+       return 0;
+}
+
+U_BOOT_CMD(mv88e61xx, 8, 0, do_switch,
+       "Read or write mv88e61xx switch registers",
+       "<ethdevice> dev|port|phy <addr> reg <reg> write <data>\n"
+       "<ethdevice> dev|port|phy <addr> reg <reg> read [<data>]\n"
+       "    - read/write switch device, port or phy at (addr,reg)\n"
+       "      addr=0..0x1C for dev, 0..5 for port or phy.\n"
+       "      reg=0..0x1F.\n"
+       "      data=0..0xFFFF (tested if present against actual read).\n"
+       "      All numeric parameters are assumed to be hex.\n"
+       "      <addr> and <<reg> arguments can be ranges (x..y)"
+);
+#endif /* CONFIG_MV88E61XX_CMD */
index 57762b686175f1810184ee2dd2c8caf0591d4026..55ded7e03232b11df7f9f0901a71d07212c9de16 100644 (file)
 #include <miiphy.h>
 
 #define MV88E61XX_CPU_PORT             0x5
-#define MV88E61XX_MAX_PORTS_NUM                0x6
 
 #define MV88E61XX_PHY_TIMEOUT          100000
 
-#define MV88E61XX_PRT_STS_REG          0x1
+/* port dev-addr (= port + 0x10) */
+#define MV88E61XX_PRT_OFST             0x10
+/* port registers */
+#define MV88E61XX_PCS_CTRL_REG         0x1
 #define MV88E61XX_PRT_CTRL_REG         0x4
 #define MV88E61XX_PRT_VMAP_REG         0x6
 #define MV88E61XX_PRT_VID_REG          0x7
+#define MV88E61XX_RGMII_TIMECTRL_REG   0x1A
 
-#define MV88E61XX_PRT_OFST             0x10
+/* global registers dev-addr */
+#define MV88E61XX_GLBREG_DEVADR        0x1B
+/* global registers */
+#define MV88E61XX_SGSR                 0x00
+#define MV88E61XX_SGCR                 0x04
+
+/* global 2 registers dev-addr */
+#define MV88E61XX_GLB2REG_DEVADR       0x1C
+/* global 2 registers */
 #define MV88E61XX_PHY_CMD              0x18
 #define MV88E61XX_PHY_DATA             0x19
-#define MV88E61XX_RGMII_TIMECTRL_REG   0x1A
-#define MV88E61XX_GLB2REG_DEVADR       0x1C
+/* global 2 phy commands */
+#define MV88E61XX_PHY_WRITE_CMD                0x9400
+#define MV88E61XX_PHY_READ_CMD         0x9800
 
 #define MV88E61XX_BUSY_OFST            15
 #define MV88E61XX_MODE_OFST            12
-#define MV88E61XX_OP_OFST                      10
+#define MV88E61XX_OP_OFST              10
 #define MV88E61XX_ADDR_OFST            5
 
 #ifdef CONFIG_MV88E61XX_MULTICHIP_ADRMODE
 static int mv88e61xx_busychk_multic(char *name, u32 devaddr);
-static void mv88e61xx_wr_phy(char *name, u32 phy_adr, u32 reg_ofs, u16 data);
-static void mv88e61xx_rd_phy(char *name, u32 phy_adr, u32 reg_ofs, u16 * data);
-#define WR_PHY mv88e61xx_wr_phy
-#define RD_PHY mv88e61xx_rd_phy
+static void mv88e61xx_switch_write(char *name, u32 phy_adr,
+       u32 reg_ofs, u16 data);
+static void mv88e61xx_switch_read(char *name, u32 phy_adr,
+       u32 reg_ofs, u16 *data);
+#define wr_switch_reg mv88e61xx_switch_write
+#define rd_switch_reg mv88e61xx_switch_read
 #else
-#define WR_PHY miiphy_write
-#define RD_PHY miiphy_read
+/* switch appears a s simple PHY and can thus use miiphy */
+#define wr_switch_reg miiphy_write
+#define rd_switch_reg miiphy_read
 #endif /* CONFIG_MV88E61XX_MULTICHIP_ADRMODE */
 
 #endif /* _MV88E61XX_H */
index 2d9cc328b5919683481f6621533731a32afa5bd2..e6fc8c8bf6e44f5cb2e7cebf6b9866681aaac8ef 100644 (file)
@@ -417,7 +417,7 @@ static int sh_eth_config(struct sh_eth_dev *eth, bd_t *bd)
                printf(SHETHER_NAME ": 100Base/");
 #if defined(SH_ETH_TYPE_GETHER)
                sh_eth_write(eth, GECMR_100B, GECMR);
-#elif defined(CONFIG_CPU_SH7757)
+#elif defined(CONFIG_CPU_SH7757) || defined(CONFIG_CPU_SH7752)
                sh_eth_write(eth, 1, RTRATE);
 #elif defined(CONFIG_CPU_SH7724)
                val = ECMR_RTM;
@@ -426,7 +426,7 @@ static int sh_eth_config(struct sh_eth_dev *eth, bd_t *bd)
                printf(SHETHER_NAME ": 10Base/");
 #if defined(SH_ETH_TYPE_GETHER)
                sh_eth_write(eth, GECMR_10B, GECMR);
-#elif defined(CONFIG_CPU_SH7757)
+#elif defined(CONFIG_CPU_SH7757) || defined(CONFIG_CPU_SH7752)
                sh_eth_write(eth, 0, RTRATE);
 #endif
        }
index 61d2df9063f5b00e727b1b8594477020b6717483..568fafe5f51fc4318ce1a3c3976e3a72e54c34fe 100644 (file)
@@ -288,7 +288,7 @@ static const u16 sh_eth_offset_fast_sh4[SH_ETH_MAX_REGISTER_OFFSET] = {
 #if defined(CONFIG_CPU_SH7763) || defined(CONFIG_CPU_SH7734)
 #define SH_ETH_TYPE_GETHER
 #define BASE_IO_ADDR   0xfee00000
-#elif defined(CONFIG_CPU_SH7757)
+#elif defined(CONFIG_CPU_SH7757) || defined(CONFIG_CPU_SH7752)
 #if defined(CONFIG_SH_ETHER_USE_GETHER)
 #define SH_ETH_TYPE_GETHER
 #define BASE_IO_ADDR   0xfee00000
@@ -346,7 +346,7 @@ enum DMAC_T_BIT {
 
 /* GECMR */
 enum GECMR_BIT {
-#if defined(CONFIG_CPU_SH7757)
+#if defined(CONFIG_CPU_SH7757) || defined(CONFIG_CPU_SH7752)
        GECMR_1000B = 0x20, GECMR_100B = 0x01, GECMR_10B = 0x00,
 #else
        GECMR_1000B = 0x01, GECMR_100B = 0x04, GECMR_10B = 0x00,
index e19a9a81950cb7a9480f340e98724e6589e00976..14d426f560d8ec46e136a8c270d70c3a2514e75e 100644 (file)
@@ -28,6 +28,7 @@ LIB   := $(obj)libpmic.o
 COBJS-$(CONFIG_POWER_MAX8998) += pmic_max8998.o
 COBJS-$(CONFIG_POWER_MAX8997) += pmic_max8997.o
 COBJS-$(CONFIG_POWER_MUIC_MAX8997) += muic_max8997.o
+COBJS-$(CONFIG_POWER_MAX77686) += pmic_max77686.o
 
 COBJS  := $(COBJS-y)
 SRCS   := $(COBJS:.o=.c)
diff --git a/drivers/power/pmic/pmic_max77686.c b/drivers/power/pmic/pmic_max77686.c
new file mode 100644 (file)
index 0000000..7fcb4c0
--- /dev/null
@@ -0,0 +1,79 @@
+/*
+ *  Copyright (C) 2012 Samsung Electronics
+ *  Rajeshwari Shinde <rajeshwari.s@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 <fdtdec.h>
+#include <i2c.h>
+#include <power/pmic.h>
+#include <power/max77686_pmic.h>
+#include <errno.h>
+
+DECLARE_GLOBAL_DATA_PTR;
+
+int pmic_init(unsigned char bus)
+{
+       static const char name[] = "MAX77686_PMIC";
+       struct pmic *p = pmic_alloc();
+
+       if (!p) {
+               printf("%s: POWER allocation error!\n", __func__);
+               return -ENOMEM;
+       }
+
+#ifdef CONFIG_OF_CONTROL
+       const void *blob = gd->fdt_blob;
+       int node, parent;
+
+       node = fdtdec_next_compatible(blob, 0, COMPAT_MAXIM_MAX77686_PMIC);
+       if (node < 0) {
+               debug("PMIC: No node for PMIC Chip in device tree\n");
+               debug("node = %d\n", node);
+               return -1;
+       }
+
+       parent = fdt_parent_offset(blob, node);
+       if (parent < 0) {
+               debug("%s: Cannot find node parent\n", __func__);
+               return -1;
+       }
+
+       p->bus = i2c_get_bus_num_fdt(parent);
+       if (p->bus < 0) {
+               debug("%s: Cannot find I2C bus\n", __func__);
+               return -1;
+       }
+       p->hw.i2c.addr = fdtdec_get_int(blob, node, "reg", 9);
+#else
+       p->bus = bus;
+       p->hw.i2c.addr = MAX77686_I2C_ADDR;
+#endif
+
+       p->name = name;
+       p->interface = PMIC_I2C;
+       p->number_of_regs = PMIC_NUM_OF_REGS;
+       p->hw.i2c.tx_num = 1;
+
+       puts("Board PMIC init\n");
+
+       return 0;
+}
index 651f88f850a0690bc26f15693051ddfee31e16f2..a663831589fdfe05a5756c592cd4ae5fcfc0fd6e 100644 (file)
 #include <fsl_pmic.h>
 #include <errno.h>
 
+#if defined(CONFIG_PMIC_FSL_MC13892)
+#define FSL_PMIC_I2C_LENGTH    3
+#elif defined(CONFIG_PMIC_FSL_MC34704)
+#define FSL_PMIC_I2C_LENGTH    1
+#endif
+
 #if defined(CONFIG_POWER_SPI)
 static u32 pmic_spi_prepare_tx(u32 reg, u32 *val, u32 write)
 {
@@ -59,7 +65,7 @@ int pmic_init(unsigned char bus)
 #elif defined(CONFIG_POWER_I2C)
        p->interface = PMIC_I2C;
        p->hw.i2c.addr = CONFIG_SYS_FSL_PMIC_I2C_ADDR;
-       p->hw.i2c.tx_num = 3;
+       p->hw.i2c.tx_num = FSL_PMIC_I2C_LENGTH;
        p->bus = bus;
 #else
 #error "You must select CONFIG_POWER_SPI or CONFIG_PMIC_I2C"
index 36b2144947a2b93f23c21df7ea0cec0a7843c541..e7d5f132b2bccb037de256ec005260ddc026c2e5 100644 (file)
@@ -71,7 +71,7 @@ void twl4030_pmrecv_vsel_cfg(u8 vsel_reg, u8 vsel_val,
        ret = twl4030_i2c_write_u8(TWL4030_CHIP_PM_RECEIVER, vsel_val,
                                vsel_reg);
        if (ret != 0) {
-               printf("Could could not write vsel to reg %02x (%d)\n",
+               printf("Could not write vsel to reg %02x (%d)\n",
                        vsel_reg, ret);
                return;
        }
@@ -80,7 +80,7 @@ void twl4030_pmrecv_vsel_cfg(u8 vsel_reg, u8 vsel_val,
        ret = twl4030_i2c_write_u8(TWL4030_CHIP_PM_RECEIVER, dev_grp_sel,
                                dev_grp);
        if (ret != 0)
-               printf("Could could not write grp_sel to reg %02x (%d)\n",
+               printf("Could not write grp_sel to reg %02x (%d)\n",
                        dev_grp, ret);
 }
 
index 624c09e85dc122fc8be04b00674d1ba985b4a6b9..d3de698cde776e342bdf7b4270ebe4e37abee42a 100644 (file)
@@ -50,16 +50,25 @@ void twl6035_init_settings(void)
        return;
 }
 
-void twl6035_mmc1_poweron_ldo(void)
+int twl6035_mmc1_poweron_ldo(void)
 {
        u8 val = 0;
 
        /* set LDO9 TWL6035 to 3V */
        val = 0x2b; /* (3 -.9)*28 +1 */
-       palmas_write_u8(0x48, LDO9_VOLTAGE, val);
+
+       if (palmas_write_u8(0x48, LDO9_VOLTAGE, val)) {
+               printf("twl6035: could not set LDO9 voltage.\n");
+               return 1;
+       }
 
        /* TURN ON LDO9 */
        val = LDO_ON | LDO_MODE_SLEEP | LDO_MODE_ACTIVE;
-       palmas_write_u8(0x48, LDO9_CTRL, val);
-       return;
+
+       if (palmas_write_u8(0x48, LDO9_CTRL, val)) {
+               printf("twl6035: could not turn on LDO9.\n");
+               return 1;
+       }
+
+       return 0;
 }
index bbd91ca247df995d2b5d11e865ea7ba391574239..87a09170864242b262c338dc72670cc46b9e9d97 100644 (file)
 
 void NS16550_init(NS16550_t com_port, int baud_divisor)
 {
+#if (!defined(CONFIG_SYS_NS16550_BROKEN_TEMT))
        while (!(serial_in(&com_port->lsr) & UART_LSR_TEMT))
                ;
+#endif
 
        serial_out(CONFIG_SYS_NS16550_IER, &com_port->ier);
 #if (defined(CONFIG_OMAP) && !defined(CONFIG_OMAP3_ZOOM2)) || \
index f53c2bf003e32644cc384378693e463972b997c9..b590992dc81d6ea0c6004d0c85cd79a00751ec6a 100644 (file)
@@ -22,7 +22,8 @@
  */
 
 #include <common.h>
-
+#include <linux/compiler.h>
+#include <serial.h>
 #include <asm/arch/s3c6400.h>
 
 DECLARE_GLOBAL_DATA_PTR;
index a33334eac090460616dae2cb615db7cf84213205..7e38a3fd533c026fdcf2f72b33ed29e635a0c61b 100644 (file)
@@ -143,7 +143,7 @@ struct uart_port {
 #elif defined(CONFIG_H8S2678)
 # define SCSCR_INIT(port)          0x30 /* TIE=0,RIE=0,TE=1,RE=1 */
 # define H8300_SCI_DR(ch) (*(volatile char *)(P1DR + h8300_sci_pins[ch].port))
-#elif defined(CONFIG_CPU_SH7757)
+#elif defined(CONFIG_CPU_SH7757) || defined(CONFIG_CPU_SH7752)
 # define SCSPTR0 0xfe4b0020
 # define SCSPTR1 0xfe4b0020
 # define SCSPTR2 0xfe4b0020
diff --git a/drivers/sound/Makefile b/drivers/sound/Makefile
new file mode 100644 (file)
index 0000000..8fdffb1
--- /dev/null
@@ -0,0 +1,48 @@
+#
+# Copyright (C) 2012 Samsung Electronics
+# R. Chandrasekar <rcsekar@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)libsound.o
+
+COBJS-$(CONFIG_SOUND)  += sound.o
+COBJS-$(CONFIG_I2S)    += samsung-i2s.o
+COBJS-$(CONFIG_SOUND_WM8994)   += wm8994.o
+
+COBJS  := $(COBJS-y)
+SRCS   := $(COBJS:.o=.c)
+OBJS   := $(addprefix $(obj),$(COBJS))
+
+all:   $(LIB)
+
+$(LIB):        $(obj).depend $(OBJS)
+       $(call cmd_link_o_target, $(OBJS))
+
+#########################################################################
+
+# defines $(obj).depend target
+include $(SRCTREE)/rules.mk
+
+sinclude $(obj).depend
+
+#
diff --git a/drivers/sound/samsung-i2s.c b/drivers/sound/samsung-i2s.c
new file mode 100644 (file)
index 0000000..9f3117d
--- /dev/null
@@ -0,0 +1,358 @@
+/*
+ * Copyright (C) 2012 Samsung Electronics
+ * R. Chandrasekar <rcsekar@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 <asm/arch/clk.h>
+#include <asm/arch/pinmux.h>
+#include <asm/arch/i2s-regs.h>
+#include <asm/io.h>
+#include <common.h>
+#include <sound.h>
+#include <i2s.h>
+
+#define FIC_TX2COUNT(x)                (((x) >>  24) & 0xf)
+#define FIC_TX1COUNT(x)                (((x) >>  16) & 0xf)
+#define FIC_TXCOUNT(x)         (((x) >>  8) & 0xf)
+#define FIC_RXCOUNT(x)         (((x) >>  0) & 0xf)
+#define FICS_TXCOUNT(x)                (((x) >>  8) & 0x7f)
+
+#define TIMEOUT_I2S_TX         100     /* i2s transfer timeout */
+
+/*
+ * Sets the frame size for I2S LR clock
+ *
+ * @param i2s_reg      i2s regiter address
+ * @param rfs          Frame Size
+ */
+static void i2s_set_lr_framesize(struct i2s_reg *i2s_reg, unsigned int rfs)
+{
+       unsigned int mod = readl(&i2s_reg->mod);
+
+       mod &= ~MOD_RCLK_MASK;
+
+       switch (rfs) {
+       case 768:
+               mod |= MOD_RCLK_768FS;
+               break;
+       case 512:
+               mod |= MOD_RCLK_512FS;
+               break;
+       case 384:
+               mod |= MOD_RCLK_384FS;
+               break;
+       default:
+               mod |= MOD_RCLK_256FS;
+               break;
+       }
+
+       writel(mod, &i2s_reg->mod);
+}
+
+/*
+ * Sets the i2s transfer control
+ *
+ * @param i2s_reg      i2s regiter address
+ * @param on           1 enable tx , 0 disable tx transfer
+ */
+static void i2s_txctrl(struct i2s_reg *i2s_reg, int on)
+{
+       unsigned int con = readl(&i2s_reg->con);
+       unsigned int mod = readl(&i2s_reg->mod) & ~MOD_MASK;
+
+       if (on) {
+               con |= CON_ACTIVE;
+               con &= ~CON_TXCH_PAUSE;
+
+       } else {
+
+               con |=  CON_TXCH_PAUSE;
+               con &= ~CON_ACTIVE;
+       }
+
+       writel(mod, &i2s_reg->mod);
+       writel(con, &i2s_reg->con);
+}
+
+/*
+ * set the bit clock frame size (in multiples of LRCLK)
+ *
+ * @param i2s_reg      i2s regiter address
+ * @param bfs          bit Frame Size
+ */
+static void i2s_set_bitclk_framesize(struct i2s_reg *i2s_reg, unsigned bfs)
+{
+       unsigned int mod = readl(&i2s_reg->mod);
+
+       mod &= ~MOD_BCLK_MASK;
+
+       switch (bfs) {
+       case 48:
+               mod |= MOD_BCLK_48FS;
+               break;
+       case 32:
+               mod |= MOD_BCLK_32FS;
+               break;
+       case 24:
+               mod |= MOD_BCLK_24FS;
+               break;
+       case 16:
+               mod |= MOD_BCLK_16FS;
+               break;
+       default:
+               return;
+       }
+       writel(mod, &i2s_reg->mod);
+}
+
+/*
+ * flushes the i2stx fifo
+ *
+ * @param i2s_reg      i2s regiter address
+ * @param flush                Tx fifo flush command (0x00 - do not flush
+ *                             0x80 - flush tx fifo)
+ */
+void i2s_fifo(struct i2s_reg *i2s_reg, unsigned int flush)
+{
+       /* Flush the FIFO */
+       setbits_le32(&i2s_reg->fic, flush);
+       clrbits_le32(&i2s_reg->fic, flush);
+}
+
+/*
+ * Set System Clock direction
+ *
+ * @param i2s_reg      i2s regiter address
+ * @param dir          Clock direction
+ *
+ * @return             int value 0 for success, -1 in case of error
+ */
+int i2s_set_sysclk_dir(struct i2s_reg *i2s_reg, int dir)
+{
+       unsigned int mod = readl(&i2s_reg->mod);
+
+       if (dir == SND_SOC_CLOCK_IN)
+               mod |= MOD_CDCLKCON;
+       else
+               mod &= ~MOD_CDCLKCON;
+
+       writel(mod, &i2s_reg->mod);
+
+       return 0;
+}
+
+/*
+ * Sets I2S Clcok format
+ *
+ * @param fmt          i2s clock properties
+ * @param i2s_reg      i2s regiter address
+ *
+ * @return             int value 0 for success, -1 in case of error
+ */
+int i2s_set_fmt(struct i2s_reg *i2s_reg, unsigned int fmt)
+{
+       unsigned int mod = readl(&i2s_reg->mod);
+       unsigned int tmp = 0;
+       unsigned int ret = 0;
+
+       /* Format is priority */
+       switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) {
+       case SND_SOC_DAIFMT_RIGHT_J:
+               tmp |= MOD_LR_RLOW;
+               tmp |= MOD_SDF_MSB;
+               break;
+       case SND_SOC_DAIFMT_LEFT_J:
+               tmp |= MOD_LR_RLOW;
+               tmp |= MOD_SDF_LSB;
+               break;
+       case SND_SOC_DAIFMT_I2S:
+               tmp |= MOD_SDF_IIS;
+               break;
+       default:
+               debug("%s: Invalid format priority [0x%x]\n", __func__,
+                       (fmt & SND_SOC_DAIFMT_FORMAT_MASK));
+               return -1;
+       }
+
+       /*
+        * INV flag is relative to the FORMAT flag - if set it simply
+        * flips the polarity specified by the Standard
+        */
+       switch (fmt & SND_SOC_DAIFMT_INV_MASK) {
+       case SND_SOC_DAIFMT_NB_NF:
+               break;
+       case SND_SOC_DAIFMT_NB_IF:
+               if (tmp & MOD_LR_RLOW)
+                       tmp &= ~MOD_LR_RLOW;
+               else
+                       tmp |= MOD_LR_RLOW;
+               break;
+       default:
+               debug("%s: Invalid clock ploarity input [0x%x]\n", __func__,
+                       (fmt & SND_SOC_DAIFMT_INV_MASK));
+               return -1;
+       }
+
+       switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) {
+       case SND_SOC_DAIFMT_CBS_CFS:
+               tmp |= MOD_SLAVE;
+               break;
+       case SND_SOC_DAIFMT_CBM_CFM:
+               /* Set default source clock in Master mode */
+               ret = i2s_set_sysclk_dir(i2s_reg, SND_SOC_CLOCK_OUT);
+               if (ret != 0) {
+                       debug("%s:set i2s clock direction failed\n", __func__);
+                       return -1;
+               }
+               break;
+       default:
+               debug("%s: Invalid master selection [0x%x]\n", __func__,
+                       (fmt & SND_SOC_DAIFMT_MASTER_MASK));
+               return -1;
+       }
+
+       mod &= ~(MOD_SDF_MASK | MOD_LR_RLOW | MOD_SLAVE);
+       mod |= tmp;
+       writel(mod, &i2s_reg->mod);
+
+       return 0;
+}
+
+/*
+ * Sets the sample width in bits
+ *
+ * @param blc          samplewidth (size of sample in bits)
+ * @param i2s_reg      i2s regiter address
+ *
+ * @return             int value 0 for success, -1 in case of error
+ */
+int i2s_set_samplesize(struct i2s_reg *i2s_reg, unsigned int blc)
+{
+       unsigned int mod = readl(&i2s_reg->mod);
+
+       mod &= ~MOD_BLCP_MASK;
+       mod &= ~MOD_BLC_MASK;
+
+       switch (blc) {
+       case 8:
+               mod |= MOD_BLCP_8BIT;
+               mod |= MOD_BLC_8BIT;
+               break;
+       case 16:
+               mod |= MOD_BLCP_16BIT;
+               mod |= MOD_BLC_16BIT;
+               break;
+       case 24:
+               mod |= MOD_BLCP_24BIT;
+               mod |= MOD_BLC_24BIT;
+               break;
+       default:
+               debug("%s: Invalid sample size input [0x%x]\n",
+                       __func__, blc);
+               return -1;
+       }
+       writel(mod, &i2s_reg->mod);
+
+       return 0;
+}
+
+int i2s_transfer_tx_data(struct i2stx_info *pi2s_tx, unsigned int *data,
+                               unsigned long data_size)
+{
+       int i;
+       int start;
+       struct i2s_reg *i2s_reg =
+                               (struct i2s_reg *)pi2s_tx->base_address;
+
+       if (data_size < FIFO_LENGTH) {
+               debug("%s : Invalid data size\n", __func__);
+               return -1; /* invalid pcm data size */
+       }
+
+       /* fill the tx buffer before stating the tx transmit */
+       for (i = 0; i < FIFO_LENGTH; i++)
+               writel(*data++, &i2s_reg->txd);
+
+       data_size -= FIFO_LENGTH;
+       i2s_txctrl(i2s_reg, I2S_TX_ON);
+
+       while (data_size > 0) {
+               start = get_timer(0);
+               if (!(CON_TXFIFO_FULL & (readl(&i2s_reg->con)))) {
+                       writel(*data++, &i2s_reg->txd);
+                       data_size--;
+               } else {
+                       if (get_timer(start) > TIMEOUT_I2S_TX) {
+                               i2s_txctrl(i2s_reg, I2S_TX_OFF);
+                               debug("%s: I2S Transfer Timeout\n", __func__);
+                               return -1;
+                       }
+               }
+       }
+       i2s_txctrl(i2s_reg, I2S_TX_OFF);
+
+       return 0;
+}
+
+int i2s_tx_init(struct i2stx_info *pi2s_tx)
+{
+       int ret;
+       struct i2s_reg *i2s_reg =
+                               (struct i2s_reg *)pi2s_tx->base_address;
+
+       /* Initialize GPIO for I2s */
+       exynos_pinmux_config(PERIPH_ID_I2S1, 0);
+
+       /* Set EPLL Clock */
+       ret = set_epll_clk(pi2s_tx->audio_pll_clk);
+       if (ret != 0) {
+               debug("%s: epll clock set rate falied\n", __func__);
+               return -1;
+       }
+
+       /* Select Clk Source for Audio1 */
+       set_i2s_clk_source();
+
+       /* Set Prescaler to get MCLK */
+       set_i2s_clk_prescaler(pi2s_tx->audio_pll_clk,
+                               (pi2s_tx->samplingrate * (pi2s_tx->rfs)));
+
+       /* Configure I2s format */
+       ret = i2s_set_fmt(i2s_reg, (SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF |
+                               SND_SOC_DAIFMT_CBM_CFM));
+       if (ret == 0) {
+               i2s_set_lr_framesize(i2s_reg, pi2s_tx->rfs);
+               ret = i2s_set_samplesize(i2s_reg, pi2s_tx->bitspersample);
+               if (ret != 0) {
+                       debug("%s:set sample rate failed\n", __func__);
+                       return -1;
+               }
+
+               i2s_set_bitclk_framesize(i2s_reg, pi2s_tx->bfs);
+               /* disable i2s transfer flag and flush the fifo */
+               i2s_txctrl(i2s_reg, I2S_TX_OFF);
+               i2s_fifo(i2s_reg, FIC_TXFLUSH);
+       } else {
+               debug("%s: failed\n", __func__);
+       }
+
+       return ret;
+}
diff --git a/drivers/sound/sound.c b/drivers/sound/sound.c
new file mode 100644 (file)
index 0000000..fa8432d
--- /dev/null
@@ -0,0 +1,261 @@
+/*
+ * Copyright (C) 2012 Samsung Electronics
+ * R. Chandrasekar <rcsekar@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 <malloc.h>
+#include <common.h>
+#include <asm/io.h>
+#include <libfdt.h>
+#include <fdtdec.h>
+#include <i2c.h>
+#include <i2s.h>
+#include <sound.h>
+#include <asm/arch/sound.h>
+#include "wm8994.h"
+
+/* defines */
+#define SOUND_400_HZ 400
+#define SOUND_BITS_IN_BYTE 8
+
+static struct i2stx_info g_i2stx_pri;
+
+/*
+ * get_sound_i2s_values gets values for i2s parameters
+ *
+ * @param i2stx_info   i2s transmitter transfer param structure
+ * @param blob         FDT blob if enabled else NULL
+ */
+static int get_sound_i2s_values(struct i2stx_info *i2s, const void *blob)
+{
+#ifdef CONFIG_OF_CONTROL
+       int node;
+       int error = 0;
+       int base;
+
+       node = fdtdec_next_compatible(blob, 0,
+                                       COMPAT_SAMSUNG_EXYNOS5_SOUND);
+       if (node <= 0) {
+               debug("EXYNOS_SOUND: No node for sound in device tree\n");
+               return -1;
+       }
+
+       /*
+        * Get the pre-defined sound specific values from FDT.
+        * All of these are expected to be correct otherwise
+        * wrong register values in i2s setup parameters
+        * may result in no sound play.
+        */
+       base = fdtdec_get_addr(blob, node, "reg");
+       if (base == FDT_ADDR_T_NONE) {
+               debug("%s: Missing  i2s base\n", __func__);
+               return -1;
+       }
+       i2s->base_address = base;
+
+       i2s->audio_pll_clk = fdtdec_get_int(blob,
+                               node, "samsung,i2s-epll-clock-frequency", -1);
+       error |= i2s->audio_pll_clk;
+       debug("audio_pll_clk = %d\n", i2s->audio_pll_clk);
+       i2s->samplingrate = fdtdec_get_int(blob,
+                               node, "samsung,i2s-sampling-rate", -1);
+       error |= i2s->samplingrate;
+       debug("samplingrate = %d\n", i2s->samplingrate);
+       i2s->bitspersample = fdtdec_get_int(blob,
+                               node, "samsung,i2s-bits-per-sample", -1);
+       error |= i2s->bitspersample;
+       debug("bitspersample = %d\n", i2s->bitspersample);
+       i2s->channels = fdtdec_get_int(blob,
+                       node, "samsung,i2s-channels", -1);
+       error |= i2s->channels;
+       debug("channels = %d\n", i2s->channels);
+       i2s->rfs = fdtdec_get_int(blob,
+                               node, "samsung,i2s-lr-clk-framesize", -1);
+       error |= i2s->rfs;
+       debug("rfs = %d\n", i2s->rfs);
+       i2s->bfs = fdtdec_get_int(blob,
+                               node, "samsung,i2s-bit-clk-framesize", -1);
+       error |= i2s->bfs;
+       debug("bfs = %d\n", i2s->bfs);
+       if (error == -1) {
+               debug("fail to get sound i2s node properties\n");
+               return -1;
+       }
+#else
+       i2s->base_address = samsung_get_base_i2s();
+       i2s->audio_pll_clk = I2S_PLL_CLK;
+       i2s->samplingrate = I2S_SAMPLING_RATE;
+       i2s->bitspersample = I2S_BITS_PER_SAMPLE;
+       i2s->channels = I2S_CHANNELS;
+       i2s->rfs = I2S_RFS;
+       i2s->bfs = I2S_BFS;
+#endif
+       return 0;
+}
+
+/*
+ * Init codec
+ *
+ * @param blob          FDT blob
+ * @param pi2s_tx      i2s parameters required by codec
+ * @return              int value, 0 for success
+ */
+static int codec_init(const void *blob, struct i2stx_info *pi2s_tx)
+{
+       int ret;
+       const char *codectype;
+#ifdef CONFIG_OF_CONTROL
+       int node;
+
+       /* Get the node from FDT for sound */
+       node = fdtdec_next_compatible(blob, 0, COMPAT_SAMSUNG_EXYNOS5_SOUND);
+       if (node <= 0) {
+               debug("EXYNOS_SOUND: No node for sound in device tree\n");
+               debug("node = %d\n", node);
+               return -1;
+       }
+
+       /*
+        * Get the pre-defined sound codec specific values from FDT.
+        * All of these are expected to be correct otherwise sound
+        * can not be played
+        */
+       codectype = fdt_getprop(blob, node, "samsung,codec-type", NULL);
+       debug("device = %s\n", codectype);
+#else
+       codectype =  AUDIO_CODEC;
+#endif
+       if (!strcmp(codectype, "wm8994")) {
+               /* Check the codec type and initialise the same */
+               ret = wm8994_init(blob, WM8994_AIF2,
+                       pi2s_tx->samplingrate,
+                       (pi2s_tx->samplingrate * (pi2s_tx->rfs)),
+                       pi2s_tx->bitspersample, pi2s_tx->channels);
+       } else {
+               debug("%s: Unknown code type %s\n", __func__,
+                     codectype);
+               return -1;
+       }
+       if (ret) {
+               debug("%s: Codec init failed\n", __func__);
+               return -1;
+       }
+
+       return 0;
+}
+
+int sound_init(const void *blob)
+{
+       int ret;
+       struct i2stx_info *pi2s_tx = &g_i2stx_pri;
+
+       /* Get the I2S Values */
+       if (get_sound_i2s_values(pi2s_tx, blob) < 0) {
+               debug(" FDT I2S values failed\n");
+               return -1;
+       }
+
+       if (codec_init(blob, pi2s_tx) < 0) {
+               debug(" Codec init failed\n");
+               return -1;
+       }
+
+       ret = i2s_tx_init(pi2s_tx);
+       if (ret) {
+               debug("%s: Failed to init i2c transmit: ret=%d\n", __func__,
+                     ret);
+               return ret;
+       }
+
+
+       return ret;
+}
+
+/*
+ * Generates square wave sound data for 1 second
+ *
+ * @param data          data buffer pointer
+ * @param size          size of the buffer
+ * @param freq          frequency of the wave
+ */
+static void sound_prepare_buffer(unsigned short *data, int size, uint32_t freq)
+{
+       const int sample = 48000;
+       const unsigned short amplitude = 16000; /* between 1 and 32767 */
+       const int period = freq ? sample / freq : 0;
+       const int half = period / 2;
+
+       assert(freq);
+
+       /* Make sure we don't overflow our buffer */
+       if (size % 2)
+               size--;
+
+       while (size) {
+               int i;
+               for (i = 0; size && i < half; i++) {
+                       size -= 2;
+                       *data++ = amplitude;
+                       *data++ = amplitude;
+               }
+               for (i = 0; size && i < period - half; i++) {
+                       size -= 2;
+                       *data++ = -amplitude;
+                       *data++ = -amplitude;
+               }
+       }
+}
+
+int sound_play(uint32_t msec, uint32_t frequency)
+{
+       unsigned int *data;
+       unsigned long data_size;
+       unsigned int ret = 0;
+
+       /*Buffer length computation */
+       data_size = g_i2stx_pri.samplingrate * g_i2stx_pri.channels;
+       data_size *= (g_i2stx_pri.bitspersample / SOUND_BITS_IN_BYTE);
+       data = malloc(data_size);
+
+       if (data == NULL) {
+               debug("%s: malloc failed\n", __func__);
+               return -1;
+       }
+
+       sound_prepare_buffer((unsigned short *)data,
+                               data_size / sizeof(unsigned short), frequency);
+
+       while (msec >= 1000) {
+               ret = i2s_transfer_tx_data(&g_i2stx_pri, data,
+                                          (data_size / sizeof(int)));
+               msec -= 1000;
+       }
+       if (msec) {
+               unsigned long size =
+                       (data_size * msec) / (sizeof(int) * 1000);
+
+               ret = i2s_transfer_tx_data(&g_i2stx_pri, data, size);
+       }
+
+       free(data);
+
+       return ret;
+}
diff --git a/drivers/sound/wm8994.c b/drivers/sound/wm8994.c
new file mode 100644 (file)
index 0000000..3b673b4
--- /dev/null
@@ -0,0 +1,862 @@
+/*
+ * Copyright (C) 2012 Samsung Electronics
+ * R. Chandrasekar <rcsekar@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 <asm/arch/clk.h>
+#include <asm/arch/cpu.h>
+#include <asm/gpio.h>
+#include <asm/io.h>
+#include <common.h>
+#include <div64.h>
+#include <fdtdec.h>
+#include <i2c.h>
+#include <i2s.h>
+#include <sound.h>
+#include <asm/arch/sound.h>
+#include "wm8994.h"
+#include "wm8994_registers.h"
+
+/* defines for wm8994 system clock selection */
+#define SEL_MCLK1      0x00
+#define SEL_MCLK2      0x08
+#define SEL_FLL1       0x10
+#define SEL_FLL2       0x18
+
+/* fll config to configure fll */
+struct wm8994_fll_config {
+       int src;        /* Source */
+       int in;         /* Input frequency in Hz */
+       int out;        /* output frequency in Hz */
+};
+
+/* codec private data */
+struct wm8994_priv {
+       enum wm8994_type type;          /* codec type of wolfson */
+       int revision;                   /* Revision */
+       int sysclk[WM8994_MAX_AIF];     /* System clock frequency in Hz  */
+       int mclk[WM8994_MAX_AIF];       /* master clock frequency in Hz */
+       int aifclk[WM8994_MAX_AIF];     /* audio interface clock in Hz   */
+       struct wm8994_fll_config fll[2]; /* fll config to configure fll */
+};
+
+/* wm 8994 supported sampling rate values */
+static unsigned int src_rate[] = {
+                        8000, 11025, 12000, 16000, 22050, 24000,
+                        32000, 44100, 48000, 88200, 96000
+};
+
+/* op clock divisions */
+static int opclk_divs[] = { 10, 20, 30, 40, 55, 60, 80, 120, 160 };
+
+/* lr clock frame size ratio */
+static int fs_ratios[] = {
+       64, 128, 192, 256, 348, 512, 768, 1024, 1408, 1536
+};
+
+/* bit clock divisors */
+static int bclk_divs[] = {
+       10, 15, 20, 30, 40, 50, 60, 80, 110, 120, 160, 220, 240, 320, 440, 480,
+       640, 880, 960, 1280, 1760, 1920
+};
+
+static struct wm8994_priv g_wm8994_info;
+static unsigned char g_wm8994_i2c_dev_addr;
+static struct sound_codec_info g_codec_info;
+
+/*
+ * Initialise I2C for wm 8994
+ *
+ * @param bus no       i2c bus number in which wm8994 is connected
+ */
+static void wm8994_i2c_init(int bus_no)
+{
+       i2c_set_bus_num(bus_no);
+}
+
+/*
+ * Writes value to a device register through i2c
+ *
+ * @param reg  reg number to be write
+ * @param data data to be writen to the above registor
+ *
+ * @return     int value 1 for change, 0 for no change or negative error code.
+ */
+static int wm8994_i2c_write(unsigned int reg, unsigned short data)
+{
+       unsigned char val[2];
+
+       val[0] = (unsigned char)((data >> 8) & 0xff);
+       val[1] = (unsigned char)(data & 0xff);
+       debug("Write Addr : 0x%04X, Data :  0x%04X\n", reg, data);
+
+       return i2c_write(g_wm8994_i2c_dev_addr, reg, 2, val, 2);
+}
+
+/*
+ * Read a value from a device register through i2c
+ *
+ * @param reg  reg number to be read
+ * @param data address of read data to be stored
+ *
+ * @return     int value 0 for success, -1 in case of error.
+ */
+static unsigned int  wm8994_i2c_read(unsigned int reg , unsigned short *data)
+{
+       unsigned char val[2];
+       int ret;
+
+       ret = i2c_read(g_wm8994_i2c_dev_addr, reg, 2, val, 2);
+       if (ret != 0) {
+               debug("%s: Error while reading register %#04x\n",
+                     __func__, reg);
+               return -1;
+       }
+
+       *data = val[0];
+       *data <<= 8;
+       *data |= val[1];
+
+       return 0;
+}
+
+/*
+ * update device register bits through i2c
+ *
+ * @param reg  codec register
+ * @param mask register mask
+ * @param value        new value
+ *
+ * @return int value 1 if change in the register value,
+ * 0 for no change or negative error code.
+ */
+static int wm8994_update_bits(unsigned int reg, unsigned short mask,
+                                               unsigned short value)
+{
+       int change , ret = 0;
+       unsigned short old, new;
+
+       if (wm8994_i2c_read(reg, &old) != 0)
+               return -1;
+       new = (old & ~mask) | (value & mask);
+       change  = (old != new) ? 1 : 0;
+       if (change)
+               ret = wm8994_i2c_write(reg, new);
+       if (ret < 0)
+               return ret;
+
+       return change;
+}
+
+/*
+ * Sets i2s set format
+ *
+ * @param aif_id       Interface ID
+ * @param fmt          i2S format
+ *
+ * @return -1 for error and 0  Success.
+ */
+int wm8994_set_fmt(int aif_id, unsigned int fmt)
+{
+       int ms_reg;
+       int aif_reg;
+       int ms = 0;
+       int aif = 0;
+       int aif_clk = 0;
+       int error = 0;
+
+       switch (aif_id) {
+       case 1:
+               ms_reg = WM8994_AIF1_MASTER_SLAVE;
+               aif_reg = WM8994_AIF1_CONTROL_1;
+               aif_clk = WM8994_AIF1_CLOCKING_1;
+               break;
+       case 2:
+               ms_reg = WM8994_AIF2_MASTER_SLAVE;
+               aif_reg = WM8994_AIF2_CONTROL_1;
+               aif_clk = WM8994_AIF2_CLOCKING_1;
+               break;
+       default:
+               debug("%s: Invalid audio interface selection\n", __func__);
+               return -1;
+       }
+
+       switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) {
+       case SND_SOC_DAIFMT_CBS_CFS:
+               break;
+       case SND_SOC_DAIFMT_CBM_CFM:
+               ms = WM8994_AIF1_MSTR;
+               break;
+       default:
+               debug("%s: Invalid i2s master selection\n", __func__);
+               return -1;
+       }
+
+       switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) {
+       case SND_SOC_DAIFMT_DSP_B:
+               aif |= WM8994_AIF1_LRCLK_INV;
+       case SND_SOC_DAIFMT_DSP_A:
+               aif |= 0x18;
+               break;
+       case SND_SOC_DAIFMT_I2S:
+               aif |= 0x10;
+               break;
+       case SND_SOC_DAIFMT_RIGHT_J:
+               break;
+       case SND_SOC_DAIFMT_LEFT_J:
+               aif |= 0x8;
+               break;
+       default:
+               debug("%s: Invalid i2s format selection\n", __func__);
+               return -1;
+       }
+
+       switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) {
+       case SND_SOC_DAIFMT_DSP_A:
+       case SND_SOC_DAIFMT_DSP_B:
+               /* frame inversion not valid for DSP modes */
+               switch (fmt & SND_SOC_DAIFMT_INV_MASK) {
+               case SND_SOC_DAIFMT_NB_NF:
+                       break;
+               case SND_SOC_DAIFMT_IB_NF:
+                       aif |= WM8994_AIF1_BCLK_INV;
+                       break;
+               default:
+                       debug("%s: Invalid i2s frame inverse selection\n",
+                             __func__);
+                       return -1;
+               }
+               break;
+
+       case SND_SOC_DAIFMT_I2S:
+       case SND_SOC_DAIFMT_RIGHT_J:
+       case SND_SOC_DAIFMT_LEFT_J:
+               switch (fmt & SND_SOC_DAIFMT_INV_MASK) {
+               case SND_SOC_DAIFMT_NB_NF:
+                       break;
+               case SND_SOC_DAIFMT_IB_IF:
+                       aif |= WM8994_AIF1_BCLK_INV | WM8994_AIF1_LRCLK_INV;
+                       break;
+               case SND_SOC_DAIFMT_IB_NF:
+                       aif |= WM8994_AIF1_BCLK_INV;
+                       break;
+               case SND_SOC_DAIFMT_NB_IF:
+                       aif |= WM8994_AIF1_LRCLK_INV;
+                       break;
+               default:
+                       debug("%s: Invalid i2s clock polarity selection\n",
+                             __func__);
+                       return -1;
+               }
+               break;
+       default:
+               debug("%s: Invalid i2s format selection\n", __func__);
+               return -1;
+       }
+
+       error = wm8994_update_bits(aif_reg, WM8994_AIF1_BCLK_INV |
+                       WM8994_AIF1_LRCLK_INV_MASK | WM8994_AIF1_FMT_MASK, aif);
+
+       error |= wm8994_update_bits(ms_reg, WM8994_AIF1_MSTR_MASK, ms);
+       error |= wm8994_update_bits(aif_clk, WM8994_AIF1CLK_ENA_MASK,
+                                               WM8994_AIF1CLK_ENA);
+       if (error < 0) {
+               debug("%s: codec register access error\n", __func__);
+               return -1;
+       }
+
+       return 0;
+}
+
+/*
+ * Sets hw params FOR WM8994
+ *
+ * @param wm8994               wm8994 information pointer
+ * @param aif_id               Audio interface ID
+ * @param sampling_rate                Sampling rate
+ * @param bits_per_sample      Bits per sample
+ * @param Channels             Channels in the given audio input
+ *
+ * @return -1 for error  and 0  Success.
+ */
+static int wm8994_hw_params(struct wm8994_priv *wm8994, int aif_id,
+               unsigned int sampling_rate, unsigned int bits_per_sample,
+               unsigned int channels)
+{
+       int aif1_reg;
+       int aif2_reg;
+       int bclk_reg;
+       int bclk = 0;
+       int rate_reg;
+       int aif1 = 0;
+       int aif2 = 0;
+       int rate_val = 0;
+       int id = aif_id - 1;
+       int i, cur_val, best_val, bclk_rate, best;
+       unsigned short reg_data;
+       int ret = 0;
+
+       switch (aif_id) {
+       case 1:
+               aif1_reg = WM8994_AIF1_CONTROL_1;
+               aif2_reg = WM8994_AIF1_CONTROL_2;
+               bclk_reg = WM8994_AIF1_BCLK;
+               rate_reg = WM8994_AIF1_RATE;
+               break;
+       case 2:
+               aif1_reg = WM8994_AIF2_CONTROL_1;
+               aif2_reg = WM8994_AIF2_CONTROL_2;
+               bclk_reg = WM8994_AIF2_BCLK;
+               rate_reg = WM8994_AIF2_RATE;
+               break;
+       default:
+               return -1;
+       }
+
+       bclk_rate = sampling_rate * 32;
+       switch (bits_per_sample) {
+       case 16:
+               bclk_rate *= 16;
+               break;
+       case 20:
+               bclk_rate *= 20;
+               aif1 |= 0x20;
+               break;
+       case 24:
+               bclk_rate *= 24;
+               aif1 |= 0x40;
+               break;
+       case 32:
+               bclk_rate *= 32;
+               aif1 |= 0x60;
+               break;
+       default:
+               return -1;
+       }
+
+       /* Try to find an appropriate sample rate; look for an exact match. */
+       for (i = 0; i < ARRAY_SIZE(src_rate); i++)
+               if (src_rate[i] == sampling_rate)
+                       break;
+
+       if (i == ARRAY_SIZE(src_rate)) {
+               debug("%s: Could not get the best matching samplingrate\n",
+                     __func__);
+               return -1;
+       }
+
+       rate_val |= i << WM8994_AIF1_SR_SHIFT;
+
+       /* AIFCLK/fs ratio; look for a close match in either direction */
+       best = 0;
+       best_val = abs((fs_ratios[0] * sampling_rate)
+                                               - wm8994->aifclk[id]);
+
+       for (i = 1; i < ARRAY_SIZE(fs_ratios); i++) {
+               cur_val = abs((fs_ratios[i] * sampling_rate)
+                                       - wm8994->aifclk[id]);
+               if (cur_val >= best_val)
+                       continue;
+               best = i;
+               best_val = cur_val;
+       }
+
+       rate_val |= best;
+
+       /*
+        * We may not get quite the right frequency if using
+        * approximate clocks so look for the closest match that is
+        * higher than the target (we need to ensure that there enough
+        * BCLKs to clock out the samples).
+        */
+       best = 0;
+       for (i = 0; i < ARRAY_SIZE(bclk_divs); i++) {
+               cur_val = (wm8994->aifclk[id] * 10 / bclk_divs[i]) - bclk_rate;
+               if (cur_val < 0) /* BCLK table is sorted */
+                       break;
+               best = i;
+       }
+
+       if (i ==  ARRAY_SIZE(bclk_divs)) {
+               debug("%s: Could not get the best matching bclk division\n",
+                     __func__);
+               return -1;
+       }
+
+       bclk_rate = wm8994->aifclk[id] * 10 / bclk_divs[best];
+       bclk |= best << WM8994_AIF1_BCLK_DIV_SHIFT;
+
+       if (wm8994_i2c_read(aif1_reg, &reg_data) != 0) {
+               debug("%s: AIF1 register read Failed\n", __func__);
+               return -1;
+       }
+
+       if ((channels == 1) && ((reg_data & 0x18) == 0x18))
+               aif2 |= WM8994_AIF1_MONO;
+
+       if (wm8994->aifclk[id] == 0) {
+               debug("%s:Audio interface clock not set\n", __func__);
+               return -1;
+       }
+
+       ret = wm8994_update_bits(aif1_reg, WM8994_AIF1_WL_MASK, aif1);
+       ret |= wm8994_update_bits(aif2_reg, WM8994_AIF1_MONO, aif2);
+       ret |= wm8994_update_bits(bclk_reg, WM8994_AIF1_BCLK_DIV_MASK, bclk);
+       ret |= wm8994_update_bits(rate_reg, WM8994_AIF1_SR_MASK |
+                               WM8994_AIF1CLK_RATE_MASK, rate_val);
+
+       debug("rate vale = %x , bclk val= %x\n", rate_val, bclk);
+
+       if (ret < 0) {
+               debug("%s: codec register access error\n", __func__);
+               return -1;
+       }
+
+       return 0;
+}
+
+/*
+ * Configures Audio interface Clock
+ *
+ * @param wm8994       wm8994 information pointer
+ * @param aif          Audio Interface ID
+ *
+ * @return -1 for error  and 0  Success.
+ */
+static int configure_aif_clock(struct wm8994_priv *wm8994, int aif)
+{
+       int rate;
+       int reg1 = 0;
+       int offset;
+       int ret;
+
+       /* AIF(1/0) register adress offset calculated */
+       if (aif)
+               offset = 4;
+       else
+               offset = 0;
+
+       switch (wm8994->sysclk[aif]) {
+       case WM8994_SYSCLK_MCLK1:
+               reg1 |= SEL_MCLK1;
+               rate = wm8994->mclk[0];
+               break;
+
+       case WM8994_SYSCLK_MCLK2:
+               reg1 |= SEL_MCLK2;
+               rate = wm8994->mclk[1];
+               break;
+
+       case WM8994_SYSCLK_FLL1:
+               reg1 |= SEL_FLL1;
+               rate = wm8994->fll[0].out;
+               break;
+
+       case WM8994_SYSCLK_FLL2:
+               reg1 |= SEL_FLL2;
+               rate = wm8994->fll[1].out;
+               break;
+
+       default:
+               debug("%s: Invalid input clock selection [%d]\n",
+                     __func__, wm8994->sysclk[aif]);
+               return -1;
+       }
+
+       /* if input clock frequenct is more than 135Mhz then divide */
+       if (rate >= WM8994_MAX_INPUT_CLK_FREQ) {
+               rate /= 2;
+               reg1 |= WM8994_AIF1CLK_DIV;
+       }
+
+       wm8994->aifclk[aif] = rate;
+
+       ret = wm8994_update_bits(WM8994_AIF1_CLOCKING_1 + offset,
+                               WM8994_AIF1CLK_SRC_MASK | WM8994_AIF1CLK_DIV,
+                               reg1);
+
+       ret |= wm8994_update_bits(WM8994_CLOCKING_1,
+                       WM8994_SYSCLK_SRC | WM8994_AIF2DSPCLK_ENA_MASK |
+                       WM8994_SYSDSPCLK_ENA_MASK, WM8994_SYSCLK_SRC |
+                       WM8994_AIF2DSPCLK_ENA | WM8994_SYSDSPCLK_ENA);
+
+       if (ret < 0) {
+               debug("%s: codec register access error\n", __func__);
+               return -1;
+       }
+
+       return 0;
+}
+
+/*
+ * Configures Audio interface  for the given frequency
+ *
+ * @param wm8994       wm8994 information
+ * @param aif_id       Audio Interface
+ * @param clk_id       Input Clock ID
+ * @param freq         Sampling frequency in Hz
+ *
+ * @return -1 for error and 0 success.
+ */
+static int wm8994_set_sysclk(struct wm8994_priv *wm8994, int aif_id,
+                               int clk_id, unsigned int freq)
+{
+       int i;
+       int ret = 0;
+
+       wm8994->sysclk[aif_id - 1] = clk_id;
+
+       switch (clk_id) {
+       case WM8994_SYSCLK_MCLK1:
+               wm8994->mclk[0] = freq;
+               if (aif_id == 2) {
+                       ret = wm8994_update_bits(WM8994_AIF1_CLOCKING_2 ,
+                       WM8994_AIF2DAC_DIV_MASK , 0);
+               }
+               break;
+
+       case WM8994_SYSCLK_MCLK2:
+               /* TODO: Set GPIO AF */
+               wm8994->mclk[1] = freq;
+               break;
+
+       case WM8994_SYSCLK_FLL1:
+       case WM8994_SYSCLK_FLL2:
+               break;
+
+       case WM8994_SYSCLK_OPCLK:
+               /*
+                * Special case - a division (times 10) is given and
+                * no effect on main clocking.
+                */
+               if (freq) {
+                       for (i = 0; i < ARRAY_SIZE(opclk_divs); i++)
+                               if (opclk_divs[i] == freq)
+                                       break;
+                       if (i == ARRAY_SIZE(opclk_divs)) {
+                               debug("%s frequency divisor not found\n",
+                                       __func__);
+                               return -1;
+                       }
+                       ret = wm8994_update_bits(WM8994_CLOCKING_2,
+                                           WM8994_OPCLK_DIV_MASK, i);
+                       ret |= wm8994_update_bits(WM8994_POWER_MANAGEMENT_2,
+                                           WM8994_OPCLK_ENA, WM8994_OPCLK_ENA);
+               } else {
+                       ret |= wm8994_update_bits(WM8994_POWER_MANAGEMENT_2,
+                                           WM8994_OPCLK_ENA, 0);
+               }
+
+       default:
+               debug("%s Invalid input clock selection [%d]\n",
+                     __func__, clk_id);
+               return -1;
+       }
+
+       ret |= configure_aif_clock(wm8994, aif_id - 1);
+
+       if (ret < 0) {
+               debug("%s: codec register access error\n", __func__);
+               return -1;
+       }
+
+       return 0;
+}
+
+/*
+ * Initializes Volume for AIF2 to HP path
+ *
+ * @returns -1 for error  and 0 Success.
+ *
+ */
+static int wm8994_init_volume_aif2_dac1(void)
+{
+       int ret;
+
+       /* Unmute AIF2DAC */
+       ret = wm8994_update_bits(WM8994_AIF2_DAC_FILTERS_1,
+                       WM8994_AIF2DAC_MUTE_MASK, 0);
+
+
+       ret |= wm8994_update_bits(WM8994_AIF2_DAC_LEFT_VOLUME,
+                       WM8994_AIF2DAC_VU_MASK | WM8994_AIF2DACL_VOL_MASK,
+                       WM8994_AIF2DAC_VU | 0xff);
+
+       ret |= wm8994_update_bits(WM8994_AIF2_DAC_RIGHT_VOLUME,
+                       WM8994_AIF2DAC_VU_MASK | WM8994_AIF2DACR_VOL_MASK,
+                       WM8994_AIF2DAC_VU | 0xff);
+
+
+       ret |= wm8994_update_bits(WM8994_DAC1_LEFT_VOLUME,
+                       WM8994_DAC1_VU_MASK | WM8994_DAC1L_VOL_MASK |
+                       WM8994_DAC1L_MUTE_MASK, WM8994_DAC1_VU | 0xc0);
+
+       ret |= wm8994_update_bits(WM8994_DAC1_RIGHT_VOLUME,
+                       WM8994_DAC1_VU_MASK | WM8994_DAC1R_VOL_MASK |
+                       WM8994_DAC1R_MUTE_MASK, WM8994_DAC1_VU | 0xc0);
+       /* Head Phone Volume */
+       ret |= wm8994_i2c_write(WM8994_LEFT_OUTPUT_VOLUME, 0x12D);
+       ret |= wm8994_i2c_write(WM8994_RIGHT_OUTPUT_VOLUME, 0x12D);
+
+       if (ret < 0) {
+               debug("%s: codec register access error\n", __func__);
+               return -1;
+       }
+
+       return 0;
+}
+
+/*
+ * Intialise wm8994 codec device
+ *
+ * @param wm8994       wm8994 information
+ *
+ * @returns -1 for error  and 0 Success.
+ */
+static int wm8994_device_init(struct wm8994_priv *wm8994)
+{
+       const char *devname;
+       unsigned short reg_data;
+       int ret;
+
+       wm8994_i2c_write(WM8994_SOFTWARE_RESET, WM8994_SW_RESET);/* Reset */
+
+       ret = wm8994_i2c_read(WM8994_SOFTWARE_RESET, &reg_data);
+       if (ret < 0) {
+               debug("Failed to read ID register\n");
+               goto err;
+       }
+
+       if (reg_data == WM8994_ID) {
+               devname = "WM8994";
+               debug("Device registered as type %d\n", wm8994->type);
+               wm8994->type = WM8994;
+       } else {
+               debug("Device is not a WM8994, ID is %x\n", ret);
+               ret = -1;
+               goto err;
+       }
+
+       ret = wm8994_i2c_read(WM8994_CHIP_REVISION, &reg_data);
+       if (ret < 0) {
+               debug("Failed to read revision register: %d\n", ret);
+               goto err;
+       }
+       wm8994->revision = reg_data;
+       debug("%s revision %c\n", devname, 'A' + wm8994->revision);
+
+       /* VMID Selection */
+       ret |= wm8994_update_bits(WM8994_POWER_MANAGEMENT_1,
+                       WM8994_VMID_SEL_MASK | WM8994_BIAS_ENA_MASK, 0x3);
+
+       /* Charge Pump Enable */
+       ret |= wm8994_update_bits(WM8994_CHARGE_PUMP_1, WM8994_CP_ENA_MASK,
+                                       WM8994_CP_ENA);
+
+       /* Head Phone Power Enable */
+       ret |= wm8994_update_bits(WM8994_POWER_MANAGEMENT_1,
+                       WM8994_HPOUT1L_ENA_MASK, WM8994_HPOUT1L_ENA);
+
+       ret |= wm8994_update_bits(WM8994_POWER_MANAGEMENT_1,
+                               WM8994_HPOUT1R_ENA_MASK, WM8994_HPOUT1R_ENA);
+
+       /* Power enable for AIF2 and DAC1 */
+       ret |= wm8994_update_bits(WM8994_POWER_MANAGEMENT_5,
+               WM8994_AIF2DACL_ENA_MASK | WM8994_AIF2DACR_ENA_MASK |
+               WM8994_DAC1L_ENA_MASK | WM8994_DAC1R_ENA_MASK,
+               WM8994_AIF2DACL_ENA | WM8994_AIF2DACR_ENA | WM8994_DAC1L_ENA |
+               WM8994_DAC1R_ENA);
+
+       /* Head Phone Initialisation */
+       ret |= wm8994_update_bits(WM8994_ANALOGUE_HP_1,
+               WM8994_HPOUT1L_DLY_MASK | WM8994_HPOUT1R_DLY_MASK,
+               WM8994_HPOUT1L_DLY | WM8994_HPOUT1R_DLY);
+
+       ret |= wm8994_update_bits(WM8994_DC_SERVO_1,
+                       WM8994_DCS_ENA_CHAN_0_MASK |
+                       WM8994_DCS_ENA_CHAN_1_MASK , WM8994_DCS_ENA_CHAN_0 |
+                       WM8994_DCS_ENA_CHAN_1);
+
+       ret |= wm8994_update_bits(WM8994_ANALOGUE_HP_1,
+                       WM8994_HPOUT1L_DLY_MASK |
+                       WM8994_HPOUT1R_DLY_MASK | WM8994_HPOUT1L_OUTP_MASK |
+                       WM8994_HPOUT1R_OUTP_MASK |
+                       WM8994_HPOUT1L_RMV_SHORT_MASK |
+                       WM8994_HPOUT1R_RMV_SHORT_MASK, WM8994_HPOUT1L_DLY |
+                       WM8994_HPOUT1R_DLY | WM8994_HPOUT1L_OUTP |
+                       WM8994_HPOUT1R_OUTP | WM8994_HPOUT1L_RMV_SHORT |
+                       WM8994_HPOUT1R_RMV_SHORT);
+
+       /* MIXER Config DAC1 to HP */
+       ret |= wm8994_update_bits(WM8994_OUTPUT_MIXER_1,
+                       WM8994_DAC1L_TO_HPOUT1L_MASK, WM8994_DAC1L_TO_HPOUT1L);
+
+       ret |= wm8994_update_bits(WM8994_OUTPUT_MIXER_2,
+                       WM8994_DAC1R_TO_HPOUT1R_MASK, WM8994_DAC1R_TO_HPOUT1R);
+
+       /* Routing AIF2 to DAC1 */
+       ret |= wm8994_update_bits(WM8994_DAC1_LEFT_MIXER_ROUTING,
+                       WM8994_AIF2DACL_TO_DAC1L_MASK,
+                       WM8994_AIF2DACL_TO_DAC1L);
+
+       ret |= wm8994_update_bits(WM8994_DAC1_RIGHT_MIXER_ROUTING,
+                       WM8994_AIF2DACR_TO_DAC1R_MASK,
+                       WM8994_AIF2DACR_TO_DAC1R);
+
+        /* GPIO Settings for AIF2 */
+        /* B CLK */
+       ret |= wm8994_update_bits(WM8994_GPIO_3, WM8994_GPIO_DIR_MASK |
+                               WM8994_GPIO_FUNCTION_MASK ,
+                               WM8994_GPIO_DIR_OUTPUT |
+                               WM8994_GPIO_FUNCTION_I2S_CLK);
+
+       /* LR CLK */
+       ret |= wm8994_update_bits(WM8994_GPIO_4, WM8994_GPIO_DIR_MASK |
+                               WM8994_GPIO_FUNCTION_MASK,
+                               WM8994_GPIO_DIR_OUTPUT |
+                               WM8994_GPIO_FUNCTION_I2S_CLK);
+
+       /* DATA */
+       ret |= wm8994_update_bits(WM8994_GPIO_5, WM8994_GPIO_DIR_MASK |
+                               WM8994_GPIO_FUNCTION_MASK,
+                               WM8994_GPIO_DIR_OUTPUT |
+                               WM8994_GPIO_FUNCTION_I2S_CLK);
+
+       ret |= wm8994_init_volume_aif2_dac1();
+       if (ret < 0)
+               goto err;
+
+       debug("%s: Codec chip init ok\n", __func__);
+       return 0;
+err:
+       debug("%s: Codec chip init error\n", __func__);
+       return -1;
+}
+
+/*
+ * Gets fdt values for wm8994 config parameters
+ *
+ * @param pcodec_info  codec information structure
+ * @param blob         FDT blob
+ * @return             int value, 0 for success
+ */
+static int get_codec_values(struct sound_codec_info *pcodec_info,
+                       const void *blob)
+{
+       int error = 0;
+#ifdef CONFIG_OF_CONTROL
+       enum fdt_compat_id compat;
+       int node;
+       int parent;
+
+       /* Get the node from FDT for codec */
+       node = fdtdec_next_compatible(blob, 0, COMPAT_WOLFSON_WM8994_CODEC);
+       if (node <= 0) {
+               debug("EXYNOS_SOUND: No node for codec in device tree\n");
+               debug("node = %d\n", node);
+               return -1;
+       }
+
+       parent = fdt_parent_offset(blob, node);
+       if (parent < 0) {
+               debug("%s: Cannot find node parent\n", __func__);
+               return -1;
+       }
+
+       compat = fdtdec_lookup(blob, parent);
+       switch (compat) {
+       case COMPAT_SAMSUNG_S3C2440_I2C:
+               pcodec_info->i2c_bus = i2c_get_bus_num_fdt(parent);
+               error |= pcodec_info->i2c_bus;
+               debug("i2c bus = %d\n", pcodec_info->i2c_bus);
+               pcodec_info->i2c_dev_addr = fdtdec_get_int(blob, node,
+                                                       "reg", 0);
+               error |= pcodec_info->i2c_dev_addr;
+               debug("i2c dev addr = %d\n", pcodec_info->i2c_dev_addr);
+               break;
+       default:
+               debug("%s: Unknown compat id %d\n", __func__, compat);
+               return -1;
+       }
+#else
+       pcodec_info->i2c_bus = AUDIO_I2C_BUS;
+       pcodec_info->i2c_dev_addr = AUDIO_I2C_REG;
+       debug("i2c dev addr = %d\n", pcodec_info->i2c_dev_addr);
+#endif
+
+       pcodec_info->codec_type = CODEC_WM_8994;
+
+       if (error == -1) {
+               debug("fail to get wm8994 codec node properties\n");
+               return -1;
+       }
+
+       return 0;
+}
+
+/*wm8994 Device Initialisation */
+int wm8994_init(const void *blob, enum en_audio_interface aif_id,
+                       int sampling_rate, int mclk_freq,
+                       int bits_per_sample, unsigned int channels)
+{
+       int ret = 0;
+       struct sound_codec_info *pcodec_info = &g_codec_info;
+
+       /* Get the codec Values */
+       if (get_codec_values(pcodec_info, blob) < 0) {
+               debug("FDT Codec values failed\n");
+               return -1;
+       }
+
+       /* shift the device address by 1 for 7 bit addressing */
+       g_wm8994_i2c_dev_addr = pcodec_info->i2c_dev_addr;
+       wm8994_i2c_init(pcodec_info->i2c_bus);
+
+       if (pcodec_info->codec_type == CODEC_WM_8994)
+               g_wm8994_info.type = WM8994;
+       else {
+               debug("%s: Codec id [%d] not defined\n", __func__,
+                               pcodec_info->codec_type);
+               return -1;
+       }
+
+       ret = wm8994_device_init(&g_wm8994_info);
+       if (ret < 0) {
+               debug("%s: wm8994 codec chip init failed\n", __func__);
+               return ret;
+       }
+
+       ret =  wm8994_set_sysclk(&g_wm8994_info, aif_id, WM8994_SYSCLK_MCLK1,
+                                                       mclk_freq);
+       if (ret < 0) {
+               debug("%s: wm8994 codec set sys clock failed\n", __func__);
+               return ret;
+       }
+
+       ret = wm8994_hw_params(&g_wm8994_info, aif_id, sampling_rate,
+                                               bits_per_sample, channels);
+
+       if (ret == 0) {
+               ret = wm8994_set_fmt(aif_id, SND_SOC_DAIFMT_I2S |
+                                               SND_SOC_DAIFMT_NB_NF |
+                                               SND_SOC_DAIFMT_CBS_CFS);
+       }
+       return ret;
+}
diff --git a/drivers/sound/wm8994.h b/drivers/sound/wm8994.h
new file mode 100644 (file)
index 0000000..a1e8335
--- /dev/null
@@ -0,0 +1,85 @@
+/*
+ * Copyright (C) 2012 Samsung Electronics
+ * R. Chadrasekar <rcsekar@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 __WM8994_H__
+#define __WM8994_H__
+
+/* Sources for AIF1/2 SYSCLK - use with set_dai_sysclk() */
+#define WM8994_SYSCLK_MCLK1    1
+#define WM8994_SYSCLK_MCLK2    2
+#define WM8994_SYSCLK_FLL1     3
+#define WM8994_SYSCLK_FLL2     4
+
+/*  Avilable audi interface ports in wm8994 codec */
+enum en_audio_interface {
+        WM8994_AIF1 = 1,
+        WM8994_AIF2,
+        WM8994_AIF3
+};
+
+/* OPCLK is also configured with set_dai_sysclk, specify division*10 as rate. */
+#define WM8994_SYSCLK_OPCLK    5
+
+#define WM8994_FLL1    1
+#define WM8994_FLL2    2
+
+#define WM8994_FLL_SRC_MCLK1   1
+#define WM8994_FLL_SRC_MCLK2   2
+#define WM8994_FLL_SRC_LRCLK   3
+#define WM8994_FLL_SRC_BCLK    4
+
+/* maximum available digital interfac in the dac to configure */
+#define WM8994_MAX_AIF                 2
+
+#define WM8994_MAX_INPUT_CLK_FREQ      13500000
+#define WM8994_ID                      0x8994
+
+enum wm8994_vmid_mode {
+       WM8994_VMID_NORMAL,
+       WM8994_VMID_FORCE,
+};
+
+/* wm 8994 family devices */
+enum wm8994_type {
+       WM8994 = 0,
+       WM8958 = 1,
+       WM1811 = 2,
+};
+
+/*
+ * intialise wm8994 sound codec device for the given configuration
+ *
+ * @param blob                 FDT node for codec values
+ * @param aif_id               enum value of codec interface port in which
+ *                             soc i2s is connected
+ * @param sampling_rate                Sampling rate ranges between from 8khz to 96khz
+ * @param mclk_freq            Master clock frequency.
+ * @param bits_per_sample      bits per Sample can be 16 or 24
+ * @param channels             Number of channnels, maximum 2
+ *
+ * @returns -1 for error  and 0  Success.
+ */
+int wm8994_init(const void *blob, enum en_audio_interface aif_id,
+                       int sampling_rate, int mclk_freq,
+                       int bits_per_sample, unsigned int channels);
+#endif /*__WM8994_H__ */
diff --git a/drivers/sound/wm8994_registers.h b/drivers/sound/wm8994_registers.h
new file mode 100644 (file)
index 0000000..f455b11
--- /dev/null
@@ -0,0 +1,299 @@
+/*
+ * (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.
+ *
+ */
+
+#ifndef __WM8994_REGISTERS_H__
+#define __WM8994_REGISTERS_H__
+
+/*
+ * Register values.
+ */
+#define WM8994_SOFTWARE_RESET                   0x00
+#define WM8994_POWER_MANAGEMENT_1               0x01
+#define WM8994_POWER_MANAGEMENT_2               0x02
+#define WM8994_POWER_MANAGEMENT_5               0x05
+#define WM8994_LEFT_OUTPUT_VOLUME               0x1C
+#define WM8994_RIGHT_OUTPUT_VOLUME              0x1D
+#define WM8994_OUTPUT_MIXER_1                   0x2D
+#define WM8994_OUTPUT_MIXER_2                   0x2E
+#define WM8994_CHARGE_PUMP_1                    0x4C
+#define WM8994_DC_SERVO_1                       0x54
+#define WM8994_ANALOGUE_HP_1                    0x60
+#define WM8994_CHIP_REVISION                    0x100
+#define WM8994_AIF1_CLOCKING_1                  0x200
+#define WM8994_AIF1_CLOCKING_2                  0x201
+#define WM8994_AIF2_CLOCKING_1                  0x204
+#define WM8994_CLOCKING_1                       0x208
+#define WM8994_CLOCKING_2                       0x209
+#define WM8994_AIF1_RATE                        0x210
+#define WM8994_AIF2_RATE                        0x211
+#define WM8994_RATE_STATUS                      0x212
+#define WM8994_AIF1_CONTROL_1                   0x300
+#define WM8994_AIF1_CONTROL_2                   0x301
+#define WM8994_AIF1_MASTER_SLAVE                0x302
+#define WM8994_AIF1_BCLK                        0x303
+#define WM8994_AIF2_CONTROL_1                   0x310
+#define WM8994_AIF2_CONTROL_2                   0x311
+#define WM8994_AIF2_MASTER_SLAVE                0x312
+#define WM8994_AIF2_BCLK                        0x313
+#define WM8994_AIF2_DAC_LEFT_VOLUME             0x502
+#define WM8994_AIF2_DAC_RIGHT_VOLUME            0x503
+#define WM8994_AIF2_DAC_FILTERS_1               0x520
+#define WM8994_DAC1_LEFT_MIXER_ROUTING          0x601
+#define WM8994_DAC1_RIGHT_MIXER_ROUTING         0x602
+#define WM8994_DAC1_LEFT_VOLUME                 0x610
+#define WM8994_DAC1_RIGHT_VOLUME                0x611
+#define WM8994_GPIO_3                           0x702
+#define WM8994_GPIO_4                           0x703
+#define WM8994_GPIO_5                           0x704
+
+/*
+ * Field Definitions.
+ */
+
+/*
+ * R0 (0x00) - Software Reset
+ */
+/* SW_RESET */
+#define WM8994_SW_RESET                              1
+/*
+ * R1 (0x01) - Power Management (1)
+ */
+/* HPOUT1L_ENA */
+#define WM8994_HPOUT1L_ENA                      0x0200
+/* HPOUT1L_ENA */
+#define WM8994_HPOUT1L_ENA_MASK                 0x0200
+/* HPOUT1R_ENA */
+#define WM8994_HPOUT1R_ENA                      0x0100
+/* HPOUT1R_ENA */
+#define WM8994_HPOUT1R_ENA_MASK                 0x0100
+/* VMID_SEL - [2:1] */
+#define WM8994_VMID_SEL_MASK                    0x0006
+/* BIAS_ENA */
+#define WM8994_BIAS_ENA                         0x0001
+/* BIAS_ENA */
+#define WM8994_BIAS_ENA_MASK                    0x0001
+
+/*
+ * R2 (0x02) - Power Management (2)
+ */
+/* OPCLK_ENA */
+#define WM8994_OPCLK_ENA                        0x0800
+
+/*
+ * R5 (0x05) - Power Management (5)
+ */
+/* AIF2DACL_ENA */
+#define WM8994_AIF2DACL_ENA                     0x2000
+#define WM8994_AIF2DACL_ENA_MASK                0x2000
+/* AIF2DACR_ENA */
+#define WM8994_AIF2DACR_ENA                     0x1000
+#define WM8994_AIF2DACR_ENA_MASK                0x1000
+/* DAC1L_ENA */
+#define WM8994_DAC1L_ENA                        0x0002
+#define WM8994_DAC1L_ENA_MASK                   0x0002
+/* DAC1R_ENA */
+#define WM8994_DAC1R_ENA                        0x0001
+#define WM8994_DAC1R_ENA_MASK                   0x0001
+
+/*
+ * R45 (0x2D) - Output Mixer (1)
+ */
+/* DAC1L_TO_HPOUT1L */
+#define WM8994_DAC1L_TO_HPOUT1L                 0x0100
+#define WM8994_DAC1L_TO_HPOUT1L_MASK            0x0100
+
+/*
+ * R46 (0x2E) - Output Mixer (2)
+ */
+/* DAC1R_TO_HPOUT1R */
+#define WM8994_DAC1R_TO_HPOUT1R                 0x0100
+#define WM8994_DAC1R_TO_HPOUT1R_MASK            0x0100
+
+/*
+ * R76 (0x4C) - Charge Pump (1)
+ */
+/* CP_ENA */
+#define WM8994_CP_ENA                           0x8000
+#define WM8994_CP_ENA_MASK                      0x8000
+/*
+ * R84 (0x54) - DC Servo (1)
+ */
+/* DCS_ENA_CHAN_1 */
+#define WM8994_DCS_ENA_CHAN_1                   0x0002
+#define WM8994_DCS_ENA_CHAN_1_MASK              0x0002
+/* DCS_ENA_CHAN_0 */
+#define WM8994_DCS_ENA_CHAN_0                   0x0001
+#define WM8994_DCS_ENA_CHAN_0_MASK              0x0001
+
+/*
+ * R96 (0x60) - Analogue HP (1)
+ */
+/* HPOUT1L_RMV_SHORT */
+#define WM8994_HPOUT1L_RMV_SHORT                0x0080
+#define WM8994_HPOUT1L_RMV_SHORT_MASK           0x0080
+/* HPOUT1L_OUTP */
+#define WM8994_HPOUT1L_OUTP                     0x0040
+#define WM8994_HPOUT1L_OUTP_MASK                0x0040
+/* HPOUT1L_DLY */
+#define WM8994_HPOUT1L_DLY                      0x0020
+#define WM8994_HPOUT1L_DLY_MASK                 0x0020
+/* HPOUT1R_RMV_SHORT */
+#define WM8994_HPOUT1R_RMV_SHORT                0x0008
+#define WM8994_HPOUT1R_RMV_SHORT_MASK           0x0008
+/* HPOUT1R_OUTP */
+#define WM8994_HPOUT1R_OUTP                     0x0004
+#define WM8994_HPOUT1R_OUTP_MASK                0x0004
+/* HPOUT1R_DLY */
+#define WM8994_HPOUT1R_DLY                      0x0002
+#define WM8994_HPOUT1R_DLY_MASK                 0x0002
+
+/*
+ * R512 (0x200) - AIF1 Clocking (1)
+ */
+/* AIF1CLK_SRC - [4:3] */
+#define WM8994_AIF1CLK_SRC_MASK                 0x0018
+/* AIF1CLK_DIV */
+#define WM8994_AIF1CLK_DIV                      0x0002
+/* AIF1CLK_ENA */
+#define WM8994_AIF1CLK_ENA                      0x0001
+#define WM8994_AIF1CLK_ENA_MASK                 0x0001
+
+/*
+ * R517 (0x205) - AIF2 Clocking (2)
+ */
+/* AIF2DAC_DIV - [5:3] */
+#define WM8994_AIF2DAC_DIV_MASK                 0x0038
+
+/*
+ * R520 (0x208) - Clocking (1)
+ */
+/* AIF2DSPCLK_ENA */
+#define WM8994_AIF2DSPCLK_ENA                   0x0004
+#define WM8994_AIF2DSPCLK_ENA_MASK              0x0004
+/* SYSDSPCLK_ENA */
+#define WM8994_SYSDSPCLK_ENA                    0x0002
+#define WM8994_SYSDSPCLK_ENA_MASK               0x0002
+/* SYSCLK_SRC */
+#define WM8994_SYSCLK_SRC                       0x0001
+
+/*
+ * R521 (0x209) - Clocking (2)
+ */
+/* OPCLK_DIV - [2:0] */
+#define WM8994_OPCLK_DIV_MASK                   0x0007
+
+/*
+ * R528 (0x210) - AIF1 Rate
+ */
+/* AIF1_SR - [7:4] */
+#define WM8994_AIF1_SR_MASK                     0x00F0
+#define WM8994_AIF1_SR_SHIFT                         4
+/* AIF1CLK_RATE - [3:0] */
+#define WM8994_AIF1CLK_RATE_MASK                0x000F
+
+/*
+ * R768 (0x300) - AIF1 Control (1)
+ */
+/* AIF1_BCLK_INV */
+#define WM8994_AIF1_BCLK_INV                    0x0100
+/* AIF1_LRCLK_INV */
+#define WM8994_AIF1_LRCLK_INV                   0x0080
+#define WM8994_AIF1_LRCLK_INV_MASK              0x0080
+/* AIF1_WL - [6:5] */
+#define WM8994_AIF1_WL_MASK                     0x0060
+/* AIF1_FMT - [4:3] */
+#define WM8994_AIF1_FMT_MASK                    0x0018
+
+/*
+ * R769 (0x301) - AIF1 Control (2)
+ */
+/* AIF1_MONO */
+#define WM8994_AIF1_MONO                        0x0100
+
+/*
+ * R770 (0x302) - AIF1 Master/Slave
+ */
+/* AIF1_MSTR */
+#define WM8994_AIF1_MSTR                        0x4000
+#define WM8994_AIF1_MSTR_MASK                   0x4000
+
+/*
+ * R771 (0x303) - AIF1 BCLK
+ */
+/* AIF1_BCLK_DIV - [8:4] */
+#define WM8994_AIF1_BCLK_DIV_MASK               0x01F0
+#define WM8994_AIF1_BCLK_DIV_SHIFT                   4
+
+/*
+ * R1282 (0x502) - AIF2 DAC Left Volume
+ */
+/* AIF2DAC_VU */
+#define WM8994_AIF2DAC_VU                       0x0100
+#define WM8994_AIF2DAC_VU_MASK                  0x0100
+/* AIF2DACL_VOL - [7:0] */
+#define WM8994_AIF2DACL_VOL_MASK                0x00FF
+
+/*
+ * R1283 (0x503) - AIF2 DAC Right Volume
+ */
+/* AIF2DACR_VOL - [7:0] */
+#define WM8994_AIF2DACR_VOL_MASK                0x00FF
+
+/*
+ * R1312 (0x520) - AIF2 DAC Filters (1)
+ */
+/* AIF2DAC_MUTE */
+#define WM8994_AIF2DAC_MUTE_MASK                0x0200
+
+/*
+ * R1537 (0x601) - DAC1 Left Mixer Routing
+ */
+/* AIF2DACL_TO_DAC1L */
+#define WM8994_AIF2DACL_TO_DAC1L                0x0004
+#define WM8994_AIF2DACL_TO_DAC1L_MASK           0x0004
+
+/*
+ * R1538 (0x602) - DAC1 Right Mixer Routing
+ */
+/* AIF2DACR_TO_DAC1R */
+#define WM8994_AIF2DACR_TO_DAC1R                0x0004
+#define WM8994_AIF2DACR_TO_DAC1R_MASK           0x0004
+
+/*
+ * R1552 (0x610) - DAC1 Left Volume
+ */
+/* DAC1L_MUTE */
+#define WM8994_DAC1L_MUTE_MASK                  0x0200
+/* DAC1_VU */
+#define WM8994_DAC1_VU                          0x0100
+#define WM8994_DAC1_VU_MASK                     0x0100
+/* DAC1L_VOL - [7:0] */
+#define WM8994_DAC1L_VOL_MASK                   0x00FF
+
+/*
+ * R1553 (0x611) - DAC1 Right Volume
+ */
+/* DAC1R_MUTE */
+#define WM8994_DAC1R_MUTE_MASK                  0x0200
+/* DAC1R_VOL - [7:0] */
+#define WM8994_DAC1R_VOL_MASK                   0x00FF
+
+/*
+ *  GPIO
+ */
+/* OUTPUT PIN */
+#define WM8994_GPIO_DIR_OUTPUT                   0x8000
+/* GPIO PIN MASK */
+#define WM8994_GPIO_DIR_MASK                     0xFFE0
+/* I2S CLK */
+#define WM8994_GPIO_FUNCTION_I2S_CLK             0x0000
+/* GPn FN */
+#define WM8994_GPIO_FUNCTION_MASK                0x001F
+#endif
index f0b82c67f5babf48f1891d3e58e789ae29cce2d4..824d357d94818ea9c05fa5b0d437aff181b50195 100644 (file)
@@ -34,6 +34,7 @@ COBJS-$(CONFIG_BFIN_SPI) += bfin_spi.o
 COBJS-$(CONFIG_CF_SPI) += cf_spi.o
 COBJS-$(CONFIG_CF_QSPI) += cf_qspi.o
 COBJS-$(CONFIG_DAVINCI_SPI) += davinci_spi.o
+COBJS-$(CONFIG_EXYNOS_SPI) += exynos_spi.o
 COBJS-$(CONFIG_KIRKWOOD_SPI) += kirkwood_spi.o
 COBJS-$(CONFIG_MPC52XX_SPI) += mpc52xx_spi.o
 COBJS-$(CONFIG_MPC8XXX_SPI) += mpc8xxx_spi.o
index c7a51f7f39a368bdec2b368e470e6386d8228760..ce7d46085543330cf1721b7585557e5a797af2fe 100644 (file)
@@ -92,7 +92,7 @@ struct spi_slave *spi_setup_slave(unsigned int bus, unsigned int cs,
        as->slave.cs = cs;
        as->regs = regs;
        as->mr = ATMEL_SPI_MR_MSTR | ATMEL_SPI_MR_MODFDIS
-#if defined(CONFIG_AT91SAM9X5)
+#if defined(CONFIG_AT91SAM9X5) || defined(CONFIG_AT91SAM9M10G45)
                        | ATMEL_SPI_MR_WDRBT
 #endif
                        | ATMEL_SPI_MR_PCS(~(1 << cs) & 0xf);
diff --git a/drivers/spi/exynos_spi.c b/drivers/spi/exynos_spi.c
new file mode 100644 (file)
index 0000000..be60ada
--- /dev/null
@@ -0,0 +1,451 @@
+/*
+ * (C) Copyright 2012 SAMSUNG Electronics
+ * Padmavathi Venna <padma.v@samsung.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+#include <common.h>
+#include <malloc.h>
+#include <spi.h>
+#include <fdtdec.h>
+#include <asm/arch/clk.h>
+#include <asm/arch/clock.h>
+#include <asm/arch/cpu.h>
+#include <asm/arch/gpio.h>
+#include <asm/arch/pinmux.h>
+#include <asm/arch-exynos/spi.h>
+#include <asm/io.h>
+
+DECLARE_GLOBAL_DATA_PTR;
+
+/* Information about each SPI controller */
+struct spi_bus {
+       enum periph_id periph_id;
+       s32 frequency;          /* Default clock frequency, -1 for none */
+       struct exynos_spi *regs;
+       int inited;             /* 1 if this bus is ready for use */
+       int node;
+};
+
+/* A list of spi buses that we know about */
+static struct spi_bus spi_bus[EXYNOS5_SPI_NUM_CONTROLLERS];
+static unsigned int bus_count;
+
+struct exynos_spi_slave {
+       struct spi_slave slave;
+       struct exynos_spi *regs;
+       unsigned int freq;              /* Default frequency */
+       unsigned int mode;
+       enum periph_id periph_id;       /* Peripheral ID for this device */
+       unsigned int fifo_size;
+};
+
+static struct spi_bus *spi_get_bus(unsigned dev_index)
+{
+       if (dev_index < bus_count)
+               return &spi_bus[dev_index];
+       debug("%s: invalid bus %d", __func__, dev_index);
+
+       return NULL;
+}
+
+static inline struct exynos_spi_slave *to_exynos_spi(struct spi_slave *slave)
+{
+       return container_of(slave, struct exynos_spi_slave, slave);
+}
+
+/**
+ * Setup the driver private data
+ *
+ * @param bus          ID of the bus that the slave is attached to
+ * @param cs           ID of the chip select connected to the slave
+ * @param max_hz       Required spi frequency
+ * @param mode         Required spi mode (clk polarity, clk phase and
+ *                     master or slave)
+ * @return new device or NULL
+ */
+struct spi_slave *spi_setup_slave(unsigned int busnum, unsigned int cs,
+                       unsigned int max_hz, unsigned int mode)
+{
+       struct exynos_spi_slave *spi_slave;
+       struct spi_bus *bus;
+
+       if (!spi_cs_is_valid(busnum, cs)) {
+               debug("%s: Invalid bus/chip select %d, %d\n", __func__,
+                     busnum, cs);
+               return NULL;
+       }
+
+       spi_slave = malloc(sizeof(*spi_slave));
+       if (!spi_slave) {
+               debug("%s: Could not allocate spi_slave\n", __func__);
+               return NULL;
+       }
+
+       bus = &spi_bus[busnum];
+       spi_slave->slave.bus = busnum;
+       spi_slave->slave.cs = cs;
+       spi_slave->regs = bus->regs;
+       spi_slave->mode = mode;
+       spi_slave->periph_id = bus->periph_id;
+       if (bus->periph_id == PERIPH_ID_SPI1 ||
+           bus->periph_id == PERIPH_ID_SPI2)
+               spi_slave->fifo_size = 64;
+       else
+               spi_slave->fifo_size = 256;
+
+       spi_slave->freq = bus->frequency;
+       if (max_hz)
+               spi_slave->freq = min(max_hz, spi_slave->freq);
+
+       return &spi_slave->slave;
+}
+
+/**
+ * Free spi controller
+ *
+ * @param slave        Pointer to spi_slave to which controller has to
+ *             communicate with
+ */
+void spi_free_slave(struct spi_slave *slave)
+{
+       struct exynos_spi_slave *spi_slave = to_exynos_spi(slave);
+
+       free(spi_slave);
+}
+
+/**
+ * Flush spi tx, rx fifos and reset the SPI controller
+ *
+ * @param slave        Pointer to spi_slave to which controller has to
+ *             communicate with
+ */
+static void spi_flush_fifo(struct spi_slave *slave)
+{
+       struct exynos_spi_slave *spi_slave = to_exynos_spi(slave);
+       struct exynos_spi *regs = spi_slave->regs;
+
+       clrsetbits_le32(&regs->ch_cfg, SPI_CH_HS_EN, SPI_CH_RST);
+       clrbits_le32(&regs->ch_cfg, SPI_CH_RST);
+       setbits_le32(&regs->ch_cfg, SPI_TX_CH_ON | SPI_RX_CH_ON);
+}
+
+/**
+ * Initialize the spi base registers, set the required clock frequency and
+ * initialize the gpios
+ *
+ * @param slave        Pointer to spi_slave to which controller has to
+ *             communicate with
+ * @return zero on success else a negative value
+ */
+int spi_claim_bus(struct spi_slave *slave)
+{
+       struct exynos_spi_slave *spi_slave = to_exynos_spi(slave);
+       struct exynos_spi *regs = spi_slave->regs;
+       u32 reg = 0;
+       int ret;
+
+       ret = set_spi_clk(spi_slave->periph_id,
+                                       spi_slave->freq);
+       if (ret < 0) {
+               debug("%s: Failed to setup spi clock\n", __func__);
+               return ret;
+       }
+
+       exynos_pinmux_config(spi_slave->periph_id, PINMUX_FLAG_NONE);
+
+       spi_flush_fifo(slave);
+
+       reg = readl(&regs->ch_cfg);
+       reg &= ~(SPI_CH_CPHA_B | SPI_CH_CPOL_L);
+
+       if (spi_slave->mode & SPI_CPHA)
+               reg |= SPI_CH_CPHA_B;
+
+       if (spi_slave->mode & SPI_CPOL)
+               reg |= SPI_CH_CPOL_L;
+
+       writel(reg, &regs->ch_cfg);
+       writel(SPI_FB_DELAY_180, &regs->fb_clk);
+
+       return 0;
+}
+
+/**
+ * Reset the spi H/W and flush the tx and rx fifos
+ *
+ * @param slave        Pointer to spi_slave to which controller has to
+ *             communicate with
+ */
+void spi_release_bus(struct spi_slave *slave)
+{
+       spi_flush_fifo(slave);
+}
+
+static void spi_get_fifo_levels(struct exynos_spi *regs,
+       int *rx_lvl, int *tx_lvl)
+{
+       uint32_t spi_sts = readl(&regs->spi_sts);
+
+       *rx_lvl = (spi_sts >> SPI_RX_LVL_OFFSET) & SPI_FIFO_LVL_MASK;
+       *tx_lvl = (spi_sts >> SPI_TX_LVL_OFFSET) & SPI_FIFO_LVL_MASK;
+}
+
+/**
+ * If there's something to transfer, do a software reset and set a
+ * transaction size.
+ *
+ * @param regs SPI peripheral registers
+ * @param count        Number of bytes to transfer
+ */
+static void spi_request_bytes(struct exynos_spi *regs, int count)
+{
+       assert(count && count < (1 << 16));
+       setbits_le32(&regs->ch_cfg, SPI_CH_RST);
+       clrbits_le32(&regs->ch_cfg, SPI_CH_RST);
+       writel(count | SPI_PACKET_CNT_EN, &regs->pkt_cnt);
+}
+
+static void spi_rx_tx(struct exynos_spi_slave *spi_slave, int todo,
+                       void **dinp, void const **doutp)
+{
+       struct exynos_spi *regs = spi_slave->regs;
+       uchar *rxp = *dinp;
+       const uchar *txp = *doutp;
+       int rx_lvl, tx_lvl;
+       uint out_bytes, in_bytes;
+
+       out_bytes = in_bytes = todo;
+
+       /*
+        * If there's something to send, do a software reset and set a
+        * transaction size.
+        */
+       spi_request_bytes(regs, todo);
+
+       /*
+        * Bytes are transmitted/received in pairs. Wait to receive all the
+        * data because then transmission will be done as well.
+        */
+       while (in_bytes) {
+               int temp;
+
+               /* Keep the fifos full/empty. */
+               spi_get_fifo_levels(regs, &rx_lvl, &tx_lvl);
+               if (tx_lvl < spi_slave->fifo_size && out_bytes) {
+                       temp = txp ? *txp++ : 0xff;
+                       writel(temp, &regs->tx_data);
+                       out_bytes--;
+               }
+               if (rx_lvl > 0 && in_bytes) {
+                       temp = readl(&regs->rx_data);
+                       if (rxp)
+                               *rxp++ = temp;
+                       in_bytes--;
+               }
+       }
+       *dinp = rxp;
+       *doutp = txp;
+}
+
+/**
+ * Transfer and receive data
+ *
+ * @param slave                Pointer to spi_slave to which controller has to
+ *                     communicate with
+ * @param bitlen       No of bits to tranfer or receive
+ * @param dout         Pointer to transfer buffer
+ * @param din          Pointer to receive buffer
+ * @param flags                Flags for transfer begin and end
+ * @return zero on success else a negative value
+ */
+int spi_xfer(struct spi_slave *slave, unsigned int bitlen, const void *dout,
+            void *din, unsigned long flags)
+{
+       struct exynos_spi_slave *spi_slave = to_exynos_spi(slave);
+       int upto, todo;
+       int bytelen;
+
+       /* spi core configured to do 8 bit transfers */
+       if (bitlen % 8) {
+               debug("Non byte aligned SPI transfer.\n");
+               return -1;
+       }
+
+       /* Start the transaction, if necessary. */
+       if ((flags & SPI_XFER_BEGIN))
+               spi_cs_activate(slave);
+
+       /* Exynos SPI limits each transfer to 65535 bytes */
+       bytelen =  bitlen / 8;
+       for (upto = 0; upto < bytelen; upto += todo) {
+               todo = min(bytelen - upto, (1 << 16) - 1);
+               spi_rx_tx(spi_slave, todo, &din, &dout);
+       }
+
+       /* Stop the transaction, if necessary. */
+       if ((flags & SPI_XFER_END))
+               spi_cs_deactivate(slave);
+
+       return 0;
+}
+
+/**
+ * Validates the bus and chip select numbers
+ *
+ * @param bus  ID of the bus that the slave is attached to
+ * @param cs   ID of the chip select connected to the slave
+ * @return one on success else zero
+ */
+int spi_cs_is_valid(unsigned int bus, unsigned int cs)
+{
+       return spi_get_bus(bus) && cs == 0;
+}
+
+/**
+ * Activate the CS by driving it LOW
+ *
+ * @param slave        Pointer to spi_slave to which controller has to
+ *             communicate with
+ */
+void spi_cs_activate(struct spi_slave *slave)
+{
+       struct exynos_spi_slave *spi_slave = to_exynos_spi(slave);
+
+       clrbits_le32(&spi_slave->regs->cs_reg, SPI_SLAVE_SIG_INACT);
+       debug("Activate CS, bus %d\n", spi_slave->slave.bus);
+}
+
+/**
+ * Deactivate the CS by driving it HIGH
+ *
+ * @param slave        Pointer to spi_slave to which controller has to
+ *             communicate with
+ */
+void spi_cs_deactivate(struct spi_slave *slave)
+{
+       struct exynos_spi_slave *spi_slave = to_exynos_spi(slave);
+
+       setbits_le32(&spi_slave->regs->cs_reg, SPI_SLAVE_SIG_INACT);
+       debug("Deactivate CS, bus %d\n", spi_slave->slave.bus);
+}
+
+static inline struct exynos_spi *get_spi_base(int dev_index)
+{
+       if (dev_index < 3)
+               return (struct exynos_spi *)samsung_get_base_spi() + dev_index;
+       else
+               return (struct exynos_spi *)samsung_get_base_spi_isp() +
+                                       (dev_index - 3);
+}
+
+/*
+ * Read the SPI config from the device tree node.
+ *
+ * @param blob  FDT blob to read from
+ * @param node  Node offset to read from
+ * @param bus   SPI bus structure to fill with information
+ * @return 0 if ok, or -FDT_ERR_NOTFOUND if something was missing
+ */
+static int spi_get_config(const void *blob, int node, struct spi_bus *bus)
+{
+       bus->node = node;
+       bus->regs = (struct exynos_spi *)fdtdec_get_addr(blob, node, "reg");
+       bus->periph_id = pinmux_decode_periph_id(blob, node);
+
+       if (bus->periph_id == PERIPH_ID_NONE) {
+               debug("%s: Invalid peripheral ID %d\n", __func__,
+                       bus->periph_id);
+               return -FDT_ERR_NOTFOUND;
+       }
+
+       /* Use 500KHz as a suitable default */
+       bus->frequency = fdtdec_get_int(blob, node, "spi-max-frequency",
+                                       500000);
+
+       return 0;
+}
+
+/*
+ * Process a list of nodes, adding them to our list of SPI ports.
+ *
+ * @param blob          fdt blob
+ * @param node_list     list of nodes to process (any <=0 are ignored)
+ * @param count         number of nodes to process
+ * @param is_dvc        1 if these are DVC ports, 0 if standard I2C
+ * @return 0 if ok, -1 on error
+ */
+static int process_nodes(const void *blob, int node_list[], int count)
+{
+       int i;
+
+       /* build the i2c_controllers[] for each controller */
+       for (i = 0; i < count; i++) {
+               int node = node_list[i];
+               struct spi_bus *bus;
+
+               if (node <= 0)
+                       continue;
+
+               bus = &spi_bus[i];
+               if (spi_get_config(blob, node, bus)) {
+                       printf("exynos spi_init: failed to decode bus %d\n",
+                               i);
+                       return -1;
+               }
+
+               debug("spi: controller bus %d at %p, periph_id %d\n",
+                     i, bus->regs, bus->periph_id);
+               bus->inited = 1;
+               bus_count++;
+       }
+
+       return 0;
+}
+
+/* Sadly there is no error return from this function */
+void spi_init(void)
+{
+       int count;
+
+#ifdef CONFIG_OF_CONTROL
+       int node_list[EXYNOS5_SPI_NUM_CONTROLLERS];
+       const void *blob = gd->fdt_blob;
+
+       count = fdtdec_find_aliases_for_id(blob, "spi",
+                       COMPAT_SAMSUNG_EXYNOS_SPI, node_list,
+                       EXYNOS5_SPI_NUM_CONTROLLERS);
+       if (process_nodes(blob, node_list, count))
+               return;
+
+#else
+       struct spi_bus *bus;
+
+       for (count = 0; count < EXYNOS5_SPI_NUM_CONTROLLERS; count++) {
+               bus = &spi_bus[count];
+               bus->regs = get_spi_base(count);
+               bus->periph_id = PERIPH_ID_SPI0 + count;
+
+               /* Although Exynos5 supports upto 50Mhz speed,
+                * we are setting it to 10Mhz for safe side
+                */
+               bus->frequency = 10000000;
+               bus->inited = 1;
+               bus->node = 0;
+               bus_count = EXYNOS5_SPI_NUM_CONTROLLERS;
+       }
+#endif
+}
index a7cda751bd0a3eba5663331a7e16a724cd370b56..de81064b9defbff63f15b2975f5271d976e2a1ee 100644 (file)
@@ -41,7 +41,10 @@ struct spi_slave *spi_setup_slave(unsigned int bus, unsigned int cs,
 {
        struct spi_slave *slave;
        u32 data;
-       u32 kwspi_mpp_config[] = { 0, 0 };
+       static const u32 kwspi_mpp_config[2][2] = {
+               { MPP0_SPI_SCn, 0 }, /* if cs == 0 */
+               { MPP7_SPI_SCn, 0 } /* if cs != 0 */
+       };
 
        if (!spi_cs_is_valid(bus, cs))
                return NULL;
@@ -68,12 +71,7 @@ struct spi_slave *spi_setup_slave(unsigned int bus, unsigned int cs,
        writel(KWSPI_IRQMASK, &spireg->irq_mask);
 
        /* program mpp registers to select  SPI_CSn */
-       if (cs) {
-               kwspi_mpp_config[0] = MPP7_SPI_SCn;
-       } else {
-               kwspi_mpp_config[0] = MPP0_SPI_SCn;
-       }
-       kirkwood_mpp_conf(kwspi_mpp_config, cs_spi_mpp_back);
+       kirkwood_mpp_conf(kwspi_mpp_config[cs ? 1 : 0], cs_spi_mpp_back);
 
        return slave;
 }
index 13bebe8ac1f6b0de80cabb1718af0b0bb1da4d18..859c43fee2790de7c80335bb58a71b20934c49f9 100644 (file)
@@ -140,8 +140,8 @@ static s32 spi_cfg_mxc(struct mxc_spi_slave *mxcs, unsigned int cs,
        reg_ctrl = reg_read(&regs->ctrl);
 
        /* Reset spi */
-       reg_write(&regs->ctrl, 0);
-       reg_write(&regs->ctrl, (reg_ctrl | 0x1));
+       reg_write(&regs->ctrl, (reg_ctrl & ~MXC_CSPICTRL_EN));
+       reg_write(&regs->ctrl, (reg_ctrl | MXC_CSPICTRL_EN));
 
        /*
         * The following computation is taken directly from Freescale's code.
@@ -387,7 +387,7 @@ static int decode_cs(struct mxc_spi_slave *mxcs, unsigned int cs)
        if (cs > 3) {
                mxcs->gpio = cs >> 8;
                cs &= 3;
-               ret = gpio_direction_output(mxcs->gpio, 0);
+               ret = gpio_direction_output(mxcs->gpio, !(mxcs->ss_pol));
                if (ret) {
                        printf("mxc_spi: cannot setup gpio %d\n", mxcs->gpio);
                        return -EINVAL;
@@ -414,6 +414,8 @@ struct spi_slave *spi_setup_slave(unsigned int bus, unsigned int cs,
                return NULL;
        }
 
+       mxcs->ss_pol = (mode & SPI_CS_HIGH) ? 1 : 0;
+
        ret = decode_cs(mxcs, cs);
        if (ret < 0) {
                free(mxcs);
@@ -425,7 +427,6 @@ struct spi_slave *spi_setup_slave(unsigned int bus, unsigned int cs,
        mxcs->slave.bus = bus;
        mxcs->slave.cs = cs;
        mxcs->base = spi_bases[bus];
-       mxcs->ss_pol = (mode & SPI_CS_HIGH) ? 1 : 0;
 
        ret = spi_cfg_mxc(mxcs, cs, max_hz, mode);
        if (ret) {
index 6791a7e0ec79c495b6fd8ee5f57d257bcd4f1860..344d5b8a7e2dc5d9006793e00d40343dec18be44 100644 (file)
@@ -57,6 +57,20 @@ static void spi_reset(struct omap3_spi_slave *ds)
        writel(OMAP3_MCSPI_WAKEUPENABLE_WKEN, &ds->regs->wakeupenable);
 }
 
+static void omap3_spi_write_chconf(struct omap3_spi_slave *ds, int val)
+{
+       writel(val, &ds->regs->channel[ds->slave.cs].chconf);
+       /* Flash post writes to make immediate effect */
+       readl(&ds->regs->channel[ds->slave.cs].chconf);
+}
+
+static void omap3_spi_set_enable(struct omap3_spi_slave *ds, int enable)
+{
+       writel(enable, &ds->regs->channel[ds->slave.cs].chctrl);
+        /* Flash post writes to make immediate effect */
+       readl(&ds->regs->channel[ds->slave.cs].chctrl);
+}
+
 void spi_init()
 {
        /* do nothing */
@@ -212,7 +226,7 @@ int spi_claim_bus(struct spi_slave *slave)
        /* Transmit & receive mode */
        conf &= ~OMAP3_MCSPI_CHCONF_TRM_MASK;
 
-       writel(conf, &ds->regs->channel[ds->slave.cs].chconf);
+       omap3_spi_write_chconf(ds,conf);
 
        return 0;
 }
@@ -233,14 +247,13 @@ int omap3_spi_write(struct spi_slave *slave, unsigned int len, const u8 *txp,
        int timeout = SPI_WAIT_TIMEOUT;
        int chconf = readl(&ds->regs->channel[ds->slave.cs].chconf);
 
-       if (flags & SPI_XFER_BEGIN)
-               writel(OMAP3_MCSPI_CHCTRL_EN,
-                      &ds->regs->channel[ds->slave.cs].chctrl);
+       /* Enable the channel */
+       omap3_spi_set_enable(ds,OMAP3_MCSPI_CHCTRL_EN);
 
        chconf &= ~OMAP3_MCSPI_CHCONF_TRM_MASK;
        chconf |= OMAP3_MCSPI_CHCONF_TRM_TX_ONLY;
        chconf |= OMAP3_MCSPI_CHCONF_FORCE;
-       writel(chconf, &ds->regs->channel[ds->slave.cs].chconf);
+       omap3_spi_write_chconf(ds,chconf);
 
        for (i = 0; i < len; i++) {
                /* wait till TX register is empty (TXS == 1) */
@@ -256,15 +269,17 @@ int omap3_spi_write(struct spi_slave *slave, unsigned int len, const u8 *txp,
                writel(txp[i], &ds->regs->channel[ds->slave.cs].tx);
        }
 
+        /* wait to finish of transfer */
+        while (!(readl(&ds->regs->channel[ds->slave.cs].chstat) &
+                         OMAP3_MCSPI_CHSTAT_EOT));
+
+       /* Disable the channel otherwise the next immediate RX will get affected */
+       omap3_spi_set_enable(ds,OMAP3_MCSPI_CHCTRL_DIS);
+
        if (flags & SPI_XFER_END) {
-               /* wait to finish of transfer */
-               while (!(readl(&ds->regs->channel[ds->slave.cs].chstat) &
-                        OMAP3_MCSPI_CHSTAT_EOT));
 
                chconf &= ~OMAP3_MCSPI_CHCONF_FORCE;
-               writel(chconf, &ds->regs->channel[ds->slave.cs].chconf);
-
-               writel(0, &ds->regs->channel[ds->slave.cs].chctrl);
+               omap3_spi_write_chconf(ds,chconf);
        }
        return 0;
 }
@@ -277,14 +292,13 @@ int omap3_spi_read(struct spi_slave *slave, unsigned int len, u8 *rxp,
        int timeout = SPI_WAIT_TIMEOUT;
        int chconf = readl(&ds->regs->channel[ds->slave.cs].chconf);
 
-       if (flags & SPI_XFER_BEGIN)
-               writel(OMAP3_MCSPI_CHCTRL_EN,
-                      &ds->regs->channel[ds->slave.cs].chctrl);
+       /* Enable the channel */
+       omap3_spi_set_enable(ds,OMAP3_MCSPI_CHCTRL_EN);
 
        chconf &= ~OMAP3_MCSPI_CHCONF_TRM_MASK;
        chconf |= OMAP3_MCSPI_CHCONF_TRM_RX_ONLY;
        chconf |= OMAP3_MCSPI_CHCONF_FORCE;
-       writel(chconf, &ds->regs->channel[ds->slave.cs].chconf);
+       omap3_spi_write_chconf(ds,chconf);
 
        writel(0, &ds->regs->channel[ds->slave.cs].tx);
 
@@ -298,15 +312,18 @@ int omap3_spi_read(struct spi_slave *slave, unsigned int len, u8 *rxp,
                                return -1;
                        }
                }
+
+               /* Disable the channel to prevent furher receiving */
+               if(i == (len - 1))
+                       omap3_spi_set_enable(ds,OMAP3_MCSPI_CHCTRL_DIS);
+
                /* Read the data */
                rxp[i] = readl(&ds->regs->channel[ds->slave.cs].rx);
        }
 
        if (flags & SPI_XFER_END) {
                chconf &= ~OMAP3_MCSPI_CHCONF_FORCE;
-               writel(chconf, &ds->regs->channel[ds->slave.cs].chconf);
-
-               writel(0, &ds->regs->channel[ds->slave.cs].chctrl);
+               omap3_spi_write_chconf(ds,chconf);
        }
 
        return 0;
@@ -323,14 +340,12 @@ int omap3_spi_txrx(struct spi_slave *slave,
        int i=0;
 
        /*Enable SPI channel*/
-       if (flags & SPI_XFER_BEGIN)
-               writel(OMAP3_MCSPI_CHCTRL_EN,
-                      &ds->regs->channel[ds->slave.cs].chctrl);
+       omap3_spi_set_enable(ds,OMAP3_MCSPI_CHCTRL_EN);
 
        /*set TRANSMIT-RECEIVE Mode*/
        chconf &= ~OMAP3_MCSPI_CHCONF_TRM_MASK;
        chconf |= OMAP3_MCSPI_CHCONF_FORCE;
-       writel(chconf, &ds->regs->channel[ds->slave.cs].chconf);
+       omap3_spi_write_chconf(ds,chconf);
 
        /*Shift in and out 1 byte at time*/
        for (i=0; i < len; i++){
@@ -359,13 +374,13 @@ int omap3_spi_txrx(struct spi_slave *slave,
                /* Read the data */
                rxp[i] = readl(&ds->regs->channel[ds->slave.cs].rx);
        }
+       /* Disable the channel */
+        omap3_spi_set_enable(ds,OMAP3_MCSPI_CHCTRL_DIS);
 
        /*if transfer must be terminated disable the channel*/
        if (flags & SPI_XFER_END) {
                chconf &= ~OMAP3_MCSPI_CHCONF_FORCE;
-               writel(chconf, &ds->regs->channel[ds->slave.cs].chconf);
-
-               writel(0, &ds->regs->channel[ds->slave.cs].chctrl);
+               omap3_spi_write_chconf(ds,chconf);
        }
 
        return 0;
@@ -389,17 +404,14 @@ int spi_xfer(struct spi_slave *slave, unsigned int bitlen,
                int chconf = readl(&ds->regs->channel[ds->slave.cs].chconf);
 
                if (flags & SPI_XFER_BEGIN) {
-                       writel(OMAP3_MCSPI_CHCTRL_EN,
-                              &ds->regs->channel[ds->slave.cs].chctrl);
+                       omap3_spi_set_enable(ds,OMAP3_MCSPI_CHCTRL_EN);
                        chconf |= OMAP3_MCSPI_CHCONF_FORCE;
-                       writel(chconf,
-                              &ds->regs->channel[ds->slave.cs].chconf);
+                       omap3_spi_write_chconf(ds,chconf);
                }
                if (flags & SPI_XFER_END) {
                        chconf &= ~OMAP3_MCSPI_CHCONF_FORCE;
-                       writel(chconf,
-                              &ds->regs->channel[ds->slave.cs].chconf);
-                       writel(0, &ds->regs->channel[ds->slave.cs].chctrl);
+                       omap3_spi_write_chconf(ds,chconf);
+                       omap3_spi_set_enable(ds,OMAP3_MCSPI_CHCTRL_DIS);
                }
                ret = 0;
        } else {
index bffa43cb6c7b26a8fc28501e8efa037ca93d42aa..5e00208c5dc1a5892997eb578198af900551206f 100644 (file)
@@ -99,6 +99,7 @@ struct mcspi {
 #define OMAP3_MCSPI_CHSTAT_EOT         (1 << 2)
 
 #define OMAP3_MCSPI_CHCTRL_EN          (1 << 0)
+#define OMAP3_MCSPI_CHCTRL_DIS         (0 << 0)
 
 #define OMAP3_MCSPI_WAKEUPENABLE_WKEN  (1 << 0)
 
index 7d87050df3d0740674e3d9c99ce0846d7341f1f5..a5a4c1fe65f3cd0b79a008c0f3ed86a1a1548622 100644 (file)
@@ -69,6 +69,7 @@ static struct usb_device_descriptor device_desc = {
 static struct usb_string g_dnl_string_defs[] = {
        { 0, manufacturer, },
        { 1, product, },
+       {  }            /* end of list */
 };
 
 static struct usb_gadget_strings g_dnl_string_tab = {
@@ -83,7 +84,12 @@ static struct usb_gadget_strings *g_dnl_composite_strings[] = {
 
 static int g_dnl_unbind(struct usb_composite_dev *cdev)
 {
-       debug("%s\n", __func__);
+       struct usb_gadget *gadget = cdev->gadget;
+
+       debug("%s: calling usb_gadget_disconnect for "
+                       "controller '%s'\n", shortname, gadget->name);
+       usb_gadget_disconnect(gadget);
+
        return 0;
 }
 
@@ -153,6 +159,10 @@ static int g_dnl_bind(struct usb_composite_dev *cdev)
                device_desc.bcdDevice = __constant_cpu_to_le16(0x9999);
        }
 
+       debug("%s: calling usb_gadget_connect for "
+                       "controller '%s'\n", shortname, gadget->name);
+       usb_gadget_connect(gadget);
+
        return 0;
 
  error:
index dd741439aea9e91971c7f81710b81c2ba71f4eef..9ce98f07684af8873e221babb904d66f03160a72 100644 (file)
@@ -40,7 +40,6 @@
 #include <asm/io.h>
 #include <asm/arch/pxa.h>
 
-#include <usbdescriptors.h>
 #include <linux/usb/ch9.h>
 #include <linux/usb/gadget.h>
 #include <usb/lin_gadget_compat.h>
index 9f0ed06a85343e282ed43d44339b1d4078d35477..3ca4c5c3312680522ac1a32d017b7ac815256d84 100644 (file)
  */
 
 #include <common.h>
+#include <fdtdec.h>
+#include <libfdt.h>
+#include <malloc.h>
 #include <usb.h>
 #include <asm/arch/cpu.h>
 #include <asm/arch/ehci.h>
 #include <asm/arch/system.h>
 #include <asm/arch/power.h>
+#include <asm-generic/errno.h>
+#include <linux/compat.h>
 #include "ehci.h"
 
+/* Declare global data pointer */
+DECLARE_GLOBAL_DATA_PTR;
+
+/**
+ * Contains pointers to register base addresses
+ * for the usb controller.
+ */
+struct exynos_ehci {
+       struct exynos_usb_phy *usb;
+       unsigned int *hcd;
+};
+
+static int exynos_usb_parse_dt(const void *blob, struct exynos_ehci *exynos)
+{
+       unsigned int node;
+       int depth;
+
+       node = fdtdec_next_compatible(blob, 0, COMPAT_SAMSUNG_EXYNOS_EHCI);
+       if (node <= 0) {
+               debug("EHCI: Can't get device node for ehci\n");
+               return -ENODEV;
+       }
+
+       /*
+        * Get the base address for EHCI controller from the device node
+        */
+       exynos->hcd = (unsigned int *)fdtdec_get_addr(blob, node, "reg");
+       if (exynos->hcd == NULL) {
+               debug("Can't get the EHCI register address\n");
+               return -ENXIO;
+       }
+
+       depth = 0;
+       node = fdtdec_next_compatible_subnode(blob, node,
+                                       COMPAT_SAMSUNG_EXYNOS_USB_PHY, &depth);
+       if (node <= 0) {
+               debug("EHCI: Can't get device node for usb-phy controller\n");
+               return -ENODEV;
+       }
+
+       /*
+        * Get the base address for usbphy from the device node
+        */
+       exynos->usb = (struct exynos_usb_phy *)fdtdec_get_addr(blob, node,
+                                                               "reg");
+       if (exynos->usb == NULL) {
+               debug("Can't get the usbphy register address\n");
+               return -ENXIO;
+       }
+
+       return 0;
+}
+
 /* Setup the EHCI host controller. */
 static void setup_usb_phy(struct exynos_usb_phy *usb)
 {
@@ -86,12 +144,20 @@ static void reset_usb_phy(struct exynos_usb_phy *usb)
  */
 int ehci_hcd_init(int index, struct ehci_hccr **hccr, struct ehci_hcor **hcor)
 {
-       struct exynos_usb_phy *usb;
+       struct exynos_ehci *exynos = NULL;
+
+       exynos = (struct exynos_ehci *)
+                       kzalloc(sizeof(struct exynos_ehci), GFP_KERNEL);
+       if (!exynos) {
+               debug("failed to allocate exynos ehci context\n");
+               return -ENOMEM;
+       }
 
-       usb = (struct exynos_usb_phy *)samsung_get_base_usb_phy();
-       setup_usb_phy(usb);
+       exynos_usb_parse_dt(gd->fdt_blob, exynos);
 
-       *hccr = (struct ehci_hccr *)samsung_get_base_usb_ehci();
+       setup_usb_phy(exynos->usb);
+
+       *hccr = (struct ehci_hccr *)(exynos->hcd);
        *hcor = (struct ehci_hcor *)((uint32_t) *hccr
                                + HC_LENGTH(ehci_readl(&(*hccr)->cr_capbase)));
 
@@ -99,6 +165,8 @@ int ehci_hcd_init(int index, struct ehci_hccr **hccr, struct ehci_hcor **hcor)
                (uint32_t)*hccr, (uint32_t)*hcor,
                (uint32_t)HC_LENGTH(ehci_readl(&(*hccr)->cr_capbase)));
 
+       kfree(exynos);
+
        return 0;
 }
 
@@ -108,10 +176,20 @@ int ehci_hcd_init(int index, struct ehci_hccr **hccr, struct ehci_hcor **hcor)
  */
 int ehci_hcd_stop(int index)
 {
-       struct exynos_usb_phy *usb;
+       struct exynos_ehci *exynos = NULL;
+
+       exynos = (struct exynos_ehci *)
+                       kzalloc(sizeof(struct exynos_ehci), GFP_KERNEL);
+       if (!exynos) {
+               debug("failed to allocate exynos ehci context\n");
+               return -ENOMEM;
+       }
+
+       exynos_usb_parse_dt(gd->fdt_blob, exynos);
+
+       reset_usb_phy(exynos->usb);
 
-       usb = (struct exynos_usb_phy *)samsung_get_base_usb_phy();
-       reset_usb_phy(usb);
+       kfree(exynos);
 
        return 0;
 }
index 9a2c295ec560ea5085163ba62638c3a8aa9b29e6..adbed5c90ca54717baa7e42d42a41fdf3599716f 100644 (file)
 #define MX5_USBOTHER_REGS_OFFSET 0x800
 
 
-#define MXC_OTG_OFFSET         0
-#define MXC_H1_OFFSET          0x200
-#define MXC_H2_OFFSET          0x400
+#define MXC_OTG_OFFSET                 0
+#define MXC_H1_OFFSET                  0x200
+#define MXC_H2_OFFSET                  0x400
+#define MXC_H3_OFFSET                  0x600
 
 #define MXC_USBCTRL_OFFSET             0
 #define MXC_USB_PHY_CTR_FUNC_OFFSET    0x8
 #define MXC_USB_PHY_CTR_FUNC2_OFFSET   0xc
 #define MXC_USB_CTRL_1_OFFSET          0x10
 #define MXC_USBH2CTRL_OFFSET           0x14
+#define MXC_USBH3CTRL_OFFSET           0x18
 
 /* USB_CTRL */
-#define MXC_OTG_UCTRL_OWIE_BIT (1 << 27) /* OTG wakeup intr enable */
-#define MXC_OTG_UCTRL_OPM_BIT  (1 << 24) /* OTG power mask */
-#define MXC_H1_UCTRL_H1UIE_BIT (1 << 12) /* Host1 ULPI interrupt enable */
-#define MXC_H1_UCTRL_H1WIE_BIT (1 << 11) /* HOST1 wakeup intr enable */
-#define MXC_H1_UCTRL_H1PM_BIT  (1 << 8) /* HOST1 power mask */
+/* OTG wakeup intr enable */
+#define MXC_OTG_UCTRL_OWIE_BIT         (1 << 27)
+/* OTG power mask */
+#define MXC_OTG_UCTRL_OPM_BIT          (1 << 24)
+/* OTG power pin polarity */
+#define MXC_OTG_UCTRL_O_PWR_POL_BIT    (1 << 24)
+/* Host1 ULPI interrupt enable */
+#define MXC_H1_UCTRL_H1UIE_BIT         (1 << 12)
+/* HOST1 wakeup intr enable */
+#define MXC_H1_UCTRL_H1WIE_BIT         (1 << 11)
+/* HOST1 power mask */
+#define MXC_H1_UCTRL_H1PM_BIT          (1 << 8)
+/* HOST1 power pin polarity */
+#define MXC_H1_UCTRL_H1_PWR_POL_BIT    (1 << 8)
 
 /* USB_PHY_CTRL_FUNC */
-#define MXC_OTG_PHYCTRL_OC_DIS_BIT (1 << 8) /* OTG Disable Overcurrent Event */
-#define MXC_H1_OC_DIS_BIT      (1 << 5) /* UH1 Disable Overcurrent Event */
+/* OTG Polarity of Overcurrent */
+#define MXC_OTG_PHYCTRL_OC_POL_BIT     (1 << 9)
+/* OTG Disable Overcurrent Event */
+#define MXC_OTG_PHYCTRL_OC_DIS_BIT     (1 << 8)
+/* UH1 Polarity of Overcurrent */
+#define MXC_H1_OC_POL_BIT              (1 << 6)
+/* UH1 Disable Overcurrent Event */
+#define MXC_H1_OC_DIS_BIT              (1 << 5)
+/* OTG Power Pin Polarity */
+#define MXC_OTG_PHYCTRL_PWR_POL_BIT    (1 << 3)
 
 /* USBH2CTRL */
-#define MXC_H2_UCTRL_H2UIE_BIT (1 << 8)
-#define MXC_H2_UCTRL_H2WIE_BIT (1 << 7)
-#define MXC_H2_UCTRL_H2PM_BIT  (1 << 4)
+#define MXC_H2_UCTRL_H2_OC_POL_BIT     (1 << 31)
+#define MXC_H2_UCTRL_H2_OC_DIS_BIT     (1 << 30)
+#define MXC_H2_UCTRL_H2UIE_BIT         (1 << 8)
+#define MXC_H2_UCTRL_H2WIE_BIT         (1 << 7)
+#define MXC_H2_UCTRL_H2PM_BIT          (1 << 4)
+#define MXC_H2_UCTRL_H2_PWR_POL_BIT    (1 << 4)
+
+/* USBH3CTRL */
+#define MXC_H3_UCTRL_H3_OC_POL_BIT     (1 << 31)
+#define MXC_H3_UCTRL_H3_OC_DIS_BIT     (1 << 30)
+#define MXC_H3_UCTRL_H3UIE_BIT         (1 << 8)
+#define MXC_H3_UCTRL_H3WIE_BIT         (1 << 7)
+#define MXC_H3_UCTRL_H3_PWR_POL_BIT    (1 << 4)
 
 /* USB_CTRL_1 */
-#define MXC_USB_CTRL_UH1_EXT_CLK_EN            (1 << 25)
+#define MXC_USB_CTRL_UH1_EXT_CLK_EN    (1 << 25)
 
 /* USB pin configuration */
 #define USB_PAD_CONFIG (PAD_CTL_PKE_ENABLE | PAD_CTL_SRE_FAST | \
@@ -143,24 +172,42 @@ int mxc_set_usbcontrol(int port, unsigned int flags)
                if (flags & MXC_EHCI_INTERNAL_PHY) {
                        v = __raw_readl(usbother_base +
                                        MXC_USB_PHY_CTR_FUNC_OFFSET);
+                       if (flags & MXC_EHCI_OC_PIN_ACTIVE_LOW)
+                               v |= MXC_OTG_PHYCTRL_OC_POL_BIT;
+                       else
+                               v &= ~MXC_OTG_PHYCTRL_OC_POL_BIT;
                        if (flags & MXC_EHCI_POWER_PINS_ENABLED)
+                               /* OC/USBPWR is used */
+                               v &= ~MXC_OTG_PHYCTRL_OC_DIS_BIT;
+                       else
                                /* OC/USBPWR is not used */
                                v |= MXC_OTG_PHYCTRL_OC_DIS_BIT;
+#ifdef CONFIG_MX51
+                       if (flags & MXC_EHCI_PWR_PIN_ACTIVE_HIGH)
+                               v |= MXC_OTG_PHYCTRL_PWR_POL_BIT;
                        else
-                               /* OC/USBPWR is used */
-                               v &= ~MXC_OTG_PHYCTRL_OC_DIS_BIT;
+                               v &= ~MXC_OTG_PHYCTRL_PWR_POL_BIT;
+#endif
                        __raw_writel(v, usbother_base +
                                        MXC_USB_PHY_CTR_FUNC_OFFSET);
 
                        v = __raw_readl(usbother_base + MXC_USBCTRL_OFFSET);
+#ifdef CONFIG_MX51
                        if (flags & MXC_EHCI_POWER_PINS_ENABLED)
+                               v &= ~MXC_OTG_UCTRL_OPM_BIT;
+                       else
                                v |= MXC_OTG_UCTRL_OPM_BIT;
+#endif
+#ifdef CONFIG_MX53
+                       if (flags & MXC_EHCI_PWR_PIN_ACTIVE_HIGH)
+                               v |= MXC_OTG_UCTRL_O_PWR_POL_BIT;
                        else
-                               v &= ~MXC_OTG_UCTRL_OPM_BIT;
+                               v &= ~MXC_OTG_UCTRL_O_PWR_POL_BIT;
+#endif
                        __raw_writel(v, usbother_base + MXC_USBCTRL_OFFSET);
                }
                break;
-       case 1: /* Host 1 Host ULPI */
+       case 1: /* Host 1 ULPI */
 #ifdef CONFIG_MX51
                /* The clock for the USBH1 ULPI port will come externally
                   from the PHY. */
@@ -170,13 +217,25 @@ int mxc_set_usbcontrol(int port, unsigned int flags)
 #endif
 
                v = __raw_readl(usbother_base + MXC_USBCTRL_OFFSET);
+#ifdef CONFIG_MX51
                if (flags & MXC_EHCI_POWER_PINS_ENABLED)
-                       v &= ~MXC_H1_UCTRL_H1PM_BIT; /* HOST1 power mask used */
+                       v &= ~MXC_H1_UCTRL_H1PM_BIT; /* H1 power mask unused */
                else
-                       v |= MXC_H1_UCTRL_H1PM_BIT; /* HOST1 power mask used */
+                       v |= MXC_H1_UCTRL_H1PM_BIT; /* H1 power mask used */
+#endif
+#ifdef CONFIG_MX53
+               if (flags & MXC_EHCI_PWR_PIN_ACTIVE_HIGH)
+                       v |= MXC_H1_UCTRL_H1_PWR_POL_BIT;
+               else
+                       v &= ~MXC_H1_UCTRL_H1_PWR_POL_BIT;
+#endif
                __raw_writel(v, usbother_base + MXC_USBCTRL_OFFSET);
 
                v = __raw_readl(usbother_base + MXC_USB_PHY_CTR_FUNC_OFFSET);
+               if (flags & MXC_EHCI_OC_PIN_ACTIVE_LOW)
+                       v |= MXC_H1_OC_POL_BIT;
+               else
+                       v &= ~MXC_H1_OC_POL_BIT;
                if (flags & MXC_EHCI_POWER_PINS_ENABLED)
                        v &= ~MXC_H1_OC_DIS_BIT; /* OC is used */
                else
@@ -186,24 +245,59 @@ int mxc_set_usbcontrol(int port, unsigned int flags)
                break;
        case 2: /* Host 2 ULPI */
                v = __raw_readl(usbother_base + MXC_USBH2CTRL_OFFSET);
+#ifdef CONFIG_MX51
                if (flags & MXC_EHCI_POWER_PINS_ENABLED)
-                       v &= ~MXC_H2_UCTRL_H2PM_BIT; /* HOST2 power mask used */
+                       v &= ~MXC_H2_UCTRL_H2PM_BIT; /* H2 power mask unused */
                else
-                       v |= MXC_H2_UCTRL_H2PM_BIT; /* HOST2 power mask used */
-
+                       v |= MXC_H2_UCTRL_H2PM_BIT; /* H2 power mask used */
+#endif
+#ifdef CONFIG_MX53
+               if (flags & MXC_EHCI_OC_PIN_ACTIVE_LOW)
+                       v |= MXC_H2_UCTRL_H2_OC_POL_BIT;
+               else
+                       v &= ~MXC_H2_UCTRL_H2_OC_POL_BIT;
+               if (flags & MXC_EHCI_POWER_PINS_ENABLED)
+                       v &= ~MXC_H2_UCTRL_H2_OC_DIS_BIT; /* OC is used */
+               else
+                       v |= MXC_H2_UCTRL_H2_OC_DIS_BIT; /* OC is not used */
+               if (flags & MXC_EHCI_PWR_PIN_ACTIVE_HIGH)
+                       v |= MXC_H2_UCTRL_H2_PWR_POL_BIT;
+               else
+                       v &= ~MXC_H2_UCTRL_H2_PWR_POL_BIT;
+#endif
                __raw_writel(v, usbother_base + MXC_USBH2CTRL_OFFSET);
                break;
+#ifdef CONFIG_MX53
+       case 3: /* Host 3 ULPI */
+               v = __raw_readl(usbother_base + MXC_USBH3CTRL_OFFSET);
+               if (flags & MXC_EHCI_OC_PIN_ACTIVE_LOW)
+                       v |= MXC_H3_UCTRL_H3_OC_POL_BIT;
+               else
+                       v &= ~MXC_H3_UCTRL_H3_OC_POL_BIT;
+               if (flags & MXC_EHCI_POWER_PINS_ENABLED)
+                       v &= ~MXC_H3_UCTRL_H3_OC_DIS_BIT; /* OC is used */
+               else
+                       v |= MXC_H3_UCTRL_H3_OC_DIS_BIT; /* OC is not used */
+               if (flags & MXC_EHCI_PWR_PIN_ACTIVE_HIGH)
+                       v |= MXC_H3_UCTRL_H3_PWR_POL_BIT;
+               else
+                       v &= ~MXC_H3_UCTRL_H3_PWR_POL_BIT;
+               __raw_writel(v, usbother_base + MXC_USBH3CTRL_OFFSET);
+               break;
+#endif
        }
 
        return ret;
 }
 
-void __board_ehci_hcd_postinit(struct usb_ehci *ehci, int port)
+int __weak board_ehci_hcd_init(int port)
 {
+       return 0;
 }
 
-void board_ehci_hcd_postinit(struct usb_ehci *ehci, int port)
-       __attribute((weak, alias("__board_ehci_hcd_postinit")));
+void __weak board_ehci_hcd_postinit(struct usb_ehci *ehci, int port)
+{
+}
 
 int ehci_hcd_init(int index, struct ehci_hccr **hccr, struct ehci_hcor **hcor)
 {
index 9ce25da5980637ed9ebbd147da96af62497fc74a..1b20e4185cfc3cdb60d6a7f64bdf81462cbe48a6 100644 (file)
@@ -159,6 +159,11 @@ static void usbh1_oc_config(void)
        __raw_writel(val, usbother_base + USB_H1_CTRL_OFFSET);
 }
 
+int __weak board_ehci_hcd_init(int port)
+{
+       return 0;
+}
+
 int ehci_hcd_init(int index, struct ehci_hccr **hccr, struct ehci_hcor **hcor)
 {
        struct usb_ehci *ehci;
index a38bc9c1bb908c942fffc7e2cb556fcf488cd36d..8633cab940c630df13c63f17fe6e0a106219dda6 100644 (file)
 
 #define USBCTRL_OTGBASE_OFFSET 0x600
 
-#ifdef CONFIG_MX25
-#define MX25_USB_CTRL_IP_PUE_DOWN_BIT  (1<<6)
-#define MX25_USB_CTRL_HSTD_BIT         (1<<5)
-#define MX25_USB_CTRL_USBTE_BIT                (1<<4)
-#define MX25_USB_CTRL_OCPOL_OTG_BIT    (1<<3)
-#endif
+#define MX25_OTG_SIC_SHIFT     29
+#define MX25_OTG_SIC_MASK      (0x3 << MX25_OTG_SIC_SHIFT)
+#define MX25_OTG_PM_BIT                (1 << 24)
+#define MX25_OTG_PP_BIT                (1 << 11)
+#define MX25_OTG_OCPOL_BIT     (1 << 3)
+
+#define MX25_H1_SIC_SHIFT      21
+#define MX25_H1_SIC_MASK       (0x3 << MX25_H1_SIC_SHIFT)
+#define MX25_H1_PP_BIT         (1 << 18)
+#define MX25_H1_PM_BIT         (1 << 16)
+#define MX25_H1_IPPUE_UP_BIT   (1 << 7)
+#define MX25_H1_IPPUE_DOWN_BIT (1 << 6)
+#define MX25_H1_TLL_BIT                (1 << 5)
+#define MX25_H1_USBTE_BIT      (1 << 4)
+#define MX25_H1_OCPOL_BIT      (1 << 2)
 
-#ifdef CONFIG_MX31
 #define MX31_OTG_SIC_SHIFT     29
 #define MX31_OTG_SIC_MASK      (0x3 << MX31_OTG_SIC_SHIFT)
 #define MX31_OTG_PM_BIT                (1 << 24)
 #define MX31_H1_SIC_MASK       (0x3 << MX31_H1_SIC_SHIFT)
 #define MX31_H1_PM_BIT         (1 << 8)
 #define MX31_H1_DT_BIT         (1 << 4)
-#endif
+
+#define MX35_OTG_SIC_SHIFT     29
+#define MX35_OTG_SIC_MASK      (0x3 << MX35_OTG_SIC_SHIFT)
+#define MX35_OTG_PM_BIT                (1 << 24)
+#define MX35_OTG_PP_BIT                (1 << 11)
+#define MX35_OTG_OCPOL_BIT     (1 << 3)
+
+#define MX35_H1_SIC_SHIFT      21
+#define MX35_H1_SIC_MASK       (0x3 << MX35_H1_SIC_SHIFT)
+#define MX35_H1_PP_BIT         (1 << 18)
+#define MX35_H1_PM_BIT         (1 << 16)
+#define MX35_H1_IPPUE_UP_BIT   (1 << 7)
+#define MX35_H1_IPPUE_DOWN_BIT (1 << 6)
+#define MX35_H1_TLL_BIT                (1 << 5)
+#define MX35_H1_USBTE_BIT      (1 << 4)
+#define MX35_H1_OCPOL_BIT      (1 << 2)
 
 static int mxc_set_usbcontrol(int port, unsigned int flags)
 {
        unsigned int v;
 
-#ifdef CONFIG_MX25
-       v = MX25_USB_CTRL_IP_PUE_DOWN_BIT | MX25_USB_CTRL_HSTD_BIT |
-               MX25_USB_CTRL_USBTE_BIT | MX25_USB_CTRL_OCPOL_OTG_BIT;
-#endif
+       v = readl(IMX_USB_BASE + USBCTRL_OTGBASE_OFFSET);
+#if defined(CONFIG_MX25)
+       switch (port) {
+       case 0: /* OTG port */
+               v &= ~(MX25_OTG_SIC_MASK | MX25_OTG_PM_BIT | MX25_OTG_PP_BIT |
+                               MX25_OTG_OCPOL_BIT);
+               v |= (flags & MXC_EHCI_INTERFACE_MASK) << MX25_OTG_SIC_SHIFT;
 
-#ifdef CONFIG_MX31
-               v = readl(IMX_USB_BASE + USBCTRL_OTGBASE_OFFSET);
-
-               switch (port) {
-               case 0: /* OTG port */
-                       v &= ~(MX31_OTG_SIC_MASK | MX31_OTG_PM_BIT);
-                       v |= (flags & MXC_EHCI_INTERFACE_MASK)
-                                       << MX31_OTG_SIC_SHIFT;
-                       if (!(flags & MXC_EHCI_POWER_PINS_ENABLED))
-                               v |= MX31_OTG_PM_BIT;
-
-                       break;
-               case 1: /* H1 port */
-                       v &= ~(MX31_H1_SIC_MASK | MX31_H1_PM_BIT |
-                               MX31_H1_DT_BIT);
-                       v |= (flags & MXC_EHCI_INTERFACE_MASK)
-                                               << MX31_H1_SIC_SHIFT;
-                       if (!(flags & MXC_EHCI_POWER_PINS_ENABLED))
-                               v |= MX31_H1_PM_BIT;
-
-                       if (!(flags & MXC_EHCI_TTL_ENABLED))
-                               v |= MX31_H1_DT_BIT;
-
-                       break;
-               case 2: /* H2 port */
-                       v &= ~(MX31_H2_SIC_MASK | MX31_H2_PM_BIT |
-                               MX31_H2_DT_BIT);
-                       v |= (flags & MXC_EHCI_INTERFACE_MASK)
-                                               << MX31_H2_SIC_SHIFT;
-                       if (!(flags & MXC_EHCI_POWER_PINS_ENABLED))
-                               v |= MX31_H2_PM_BIT;
-
-                       if (!(flags & MXC_EHCI_TTL_ENABLED))
-                               v |= MX31_H2_DT_BIT;
-
-                       break;
-               default:
-                       return -EINVAL;
-               }
-#endif
+               if (!(flags & MXC_EHCI_POWER_PINS_ENABLED))
+                       v |= MX25_OTG_PM_BIT;
+
+               if (flags & MXC_EHCI_PWR_PIN_ACTIVE_HIGH)
+                       v |= MX25_OTG_PP_BIT;
+
+               if (!(flags & MXC_EHCI_OC_PIN_ACTIVE_LOW))
+                       v |= MX25_OTG_OCPOL_BIT;
+
+               break;
+       case 1: /* H1 port */
+               v &= ~(MX25_H1_SIC_MASK | MX25_H1_PM_BIT | MX25_H1_PP_BIT |
+                               MX25_H1_OCPOL_BIT | MX25_H1_TLL_BIT |
+                               MX25_H1_USBTE_BIT | MX25_H1_IPPUE_DOWN_BIT |
+                               MX25_H1_IPPUE_UP_BIT);
+               v |= (flags & MXC_EHCI_INTERFACE_MASK) << MX25_H1_SIC_SHIFT;
+
+               if (!(flags & MXC_EHCI_POWER_PINS_ENABLED))
+                       v |= MX25_H1_PM_BIT;
+
+               if (flags & MXC_EHCI_PWR_PIN_ACTIVE_HIGH)
+                       v |= MX25_H1_PP_BIT;
+
+               if (!(flags & MXC_EHCI_OC_PIN_ACTIVE_LOW))
+                       v |= MX25_H1_OCPOL_BIT;
+
+               if (!(flags & MXC_EHCI_TTL_ENABLED))
+                       v |= MX25_H1_TLL_BIT;
+
+               if (flags & MXC_EHCI_INTERNAL_PHY)
+                       v |= MX25_H1_USBTE_BIT;
+
+               if (flags & MXC_EHCI_IPPUE_DOWN)
+                       v |= MX25_H1_IPPUE_DOWN_BIT;
+
+               if (flags & MXC_EHCI_IPPUE_UP)
+                       v |= MX25_H1_IPPUE_UP_BIT;
+
+               break;
+       default:
+               return -EINVAL;
+       }
+#elif defined(CONFIG_MX31)
+       switch (port) {
+       case 0: /* OTG port */
+               v &= ~(MX31_OTG_SIC_MASK | MX31_OTG_PM_BIT);
+               v |= (flags & MXC_EHCI_INTERFACE_MASK) << MX31_OTG_SIC_SHIFT;
+
+               if (!(flags & MXC_EHCI_POWER_PINS_ENABLED))
+                       v |= MX31_OTG_PM_BIT;
 
+               break;
+       case 1: /* H1 port */
+               v &= ~(MX31_H1_SIC_MASK | MX31_H1_PM_BIT | MX31_H1_DT_BIT);
+               v |= (flags & MXC_EHCI_INTERFACE_MASK) << MX31_H1_SIC_SHIFT;
+
+               if (!(flags & MXC_EHCI_POWER_PINS_ENABLED))
+                       v |= MX31_H1_PM_BIT;
+
+               if (!(flags & MXC_EHCI_TTL_ENABLED))
+                       v |= MX31_H1_DT_BIT;
+
+               break;
+       case 2: /* H2 port */
+               v &= ~(MX31_H2_SIC_MASK | MX31_H2_PM_BIT | MX31_H2_DT_BIT);
+               v |= (flags & MXC_EHCI_INTERFACE_MASK) << MX31_H2_SIC_SHIFT;
+
+               if (!(flags & MXC_EHCI_POWER_PINS_ENABLED))
+                       v |= MX31_H2_PM_BIT;
+
+               if (!(flags & MXC_EHCI_TTL_ENABLED))
+                       v |= MX31_H2_DT_BIT;
+
+               break;
+       default:
+               return -EINVAL;
+       }
+#elif defined(CONFIG_MX35)
+       switch (port) {
+       case 0: /* OTG port */
+               v &= ~(MX35_OTG_SIC_MASK | MX35_OTG_PM_BIT | MX35_OTG_PP_BIT |
+                               MX35_OTG_OCPOL_BIT);
+               v |= (flags & MXC_EHCI_INTERFACE_MASK) << MX35_OTG_SIC_SHIFT;
+
+               if (!(flags & MXC_EHCI_POWER_PINS_ENABLED))
+                       v |= MX35_OTG_PM_BIT;
+
+               if (flags & MXC_EHCI_PWR_PIN_ACTIVE_HIGH)
+                       v |= MX35_OTG_PP_BIT;
+
+               if (!(flags & MXC_EHCI_OC_PIN_ACTIVE_LOW))
+                       v |= MX35_OTG_OCPOL_BIT;
+
+               break;
+       case 1: /* H1 port */
+               v &= ~(MX35_H1_SIC_MASK | MX35_H1_PM_BIT | MX35_H1_PP_BIT |
+                               MX35_H1_OCPOL_BIT | MX35_H1_TLL_BIT |
+                               MX35_H1_USBTE_BIT | MX35_H1_IPPUE_DOWN_BIT |
+                               MX35_H1_IPPUE_UP_BIT);
+               v |= (flags & MXC_EHCI_INTERFACE_MASK) << MX35_H1_SIC_SHIFT;
+
+               if (!(flags & MXC_EHCI_POWER_PINS_ENABLED))
+                       v |= MX35_H1_PM_BIT;
+
+               if (flags & MXC_EHCI_PWR_PIN_ACTIVE_HIGH)
+                       v |= MX35_H1_PP_BIT;
+
+               if (!(flags & MXC_EHCI_OC_PIN_ACTIVE_LOW))
+                       v |= MX35_H1_OCPOL_BIT;
+
+               if (!(flags & MXC_EHCI_TTL_ENABLED))
+                       v |= MX35_H1_TLL_BIT;
+
+               if (flags & MXC_EHCI_INTERNAL_PHY)
+                       v |= MX35_H1_USBTE_BIT;
+
+               if (flags & MXC_EHCI_IPPUE_DOWN)
+                       v |= MX35_H1_IPPUE_DOWN_BIT;
+
+               if (flags & MXC_EHCI_IPPUE_UP)
+                       v |= MX35_H1_IPPUE_UP_BIT;
+
+               break;
+       default:
+               return -EINVAL;
+       }
+#else
+#error MXC EHCI USB driver not supported on this platform
+#endif
        writel(v, IMX_USB_BASE + USBCTRL_OTGBASE_OFFSET);
+
        return 0;
 }
 
@@ -119,13 +234,17 @@ int ehci_hcd_init(int index, struct ehci_hccr **hccr, struct ehci_hcor **hcor)
        udelay(80);
 
        ehci = (struct usb_ehci *)(IMX_USB_BASE +
-               (0x200 * CONFIG_MXC_USB_PORT));
+                       IMX_USB_PORT_OFFSET * CONFIG_MXC_USB_PORT);
        *hccr = (struct ehci_hccr *)((uint32_t)&ehci->caplength);
        *hcor = (struct ehci_hcor *)((uint32_t) *hccr +
                        HC_LENGTH(ehci_readl(&(*hccr)->cr_capbase)));
        setbits_le32(&ehci->usbmode, CM_HOST);
        __raw_writel(CONFIG_MXC_USB_PORTSC, &ehci->portsc);
        mxc_set_usbcontrol(CONFIG_MXC_USB_PORT, CONFIG_MXC_USB_FLAGS);
+#ifdef CONFIG_MX35
+       /* Workaround for ENGcm11601 */
+       __raw_writel(0, &ehci->sbuscfg);
+#endif
 
        udelay(10000);
 
index 9532dd9ef6d23143a771ffb24e648e80c5ad10ad..efd711d489f4b36aa1a89345774b9fc6771aa4ee 100644 (file)
@@ -41,7 +41,8 @@ int usb_cpu_init(void)
        writel(get_pllb_init(), &pmc->pllbr);
        while ((readl(&pmc->sr) & AT91_PMC_LOCKB) != AT91_PMC_LOCKB)
                ;
-#elif defined(CONFIG_AT91SAM9G45) || defined(CONFIG_AT91SAM9M10G45)
+#elif defined(CONFIG_AT91SAM9G45) || defined(CONFIG_AT91SAM9M10G45) || \
+       defined(CONFIG_AT91SAM9X5)
        /* Enable UPLL */
        writel(readl(&pmc->uckr) | AT91_PMC_UPLLEN | AT91_PMC_BIASEN,
                &pmc->uckr);
@@ -81,7 +82,8 @@ int usb_cpu_stop(void)
        writel(0, &pmc->pllbr);
        while ((readl(&pmc->sr) & AT91_PMC_LOCKB) != 0)
                ;
-#elif defined(CONFIG_AT91SAM9G45) || defined(CONFIG_AT91SAM9M10G45)
+#elif defined(CONFIG_AT91SAM9G45) || defined(CONFIG_AT91SAM9M10G45) || \
+       defined(CONFIG_AT91SAM9X5)
        /* Disable UPLL */
        writel(readl(&pmc->uckr) & (~AT91_PMC_UPLLEN), &pmc->uckr);
        while ((readl(&pmc->sr) & AT91_PMC_LOCKU) == AT91_PMC_LOCKU)
index cc3022a2c73a9e8c6578b8ac99951ae50976633a..170a358b5283849207827f21d7eb49dc419d9acf 100644 (file)
@@ -37,6 +37,7 @@ COBJS-$(CONFIG_EXYNOS_PWM_BL) += exynos_pwm_bl.o
 COBJS-$(CONFIG_FSL_DIU_FB) += fsl_diu_fb.o videomodes.o
 COBJS-$(CONFIG_S6E8AX0) += s6e8ax0.o
 COBJS-$(CONFIG_S6E63D6) += s6e63d6.o
+COBJS-$(CONFIG_LD9040) += ld9040.o
 COBJS-$(CONFIG_SED156X) += sed156x.o
 COBJS-$(CONFIG_VIDEO_AMBA) += amba.o
 COBJS-$(CONFIG_VIDEO_COREBOOT) += coreboot_fb.o
@@ -50,6 +51,7 @@ COBJS-$(CONFIG_VIDEO_OMAP3) += omap3_dss.o
 COBJS-$(CONFIG_VIDEO_SED13806) += sed13806.o
 COBJS-$(CONFIG_VIDEO_SM501) += sm501.o
 COBJS-$(CONFIG_VIDEO_SMI_LYNXEM) += smiLynxEM.o videomodes.o
+COBJS-$(CONFIG_VIDEO_TEGRA) += tegra.o
 COBJS-$(CONFIG_VIDEO_VCXK) += bus_vcxk.o
 
 COBJS  := $(sort $(COBJS-y))
index 53e410120ac77cf3fb08d311d78f9ba1f3f58dc3..d72fa565a7d0d479d5d3dc176506e1f3c999e10e 100644 (file)
@@ -857,7 +857,6 @@ unsigned int exynos_init_dp(void)
 {
        unsigned int ret;
        struct edp_device_info *edp_info;
-       struct edp_disp_info disp_info;
 
        edp_info = kzalloc(sizeof(struct edp_device_info), GFP_KERNEL);
        if (!edp_info) {
@@ -870,7 +869,6 @@ unsigned int exynos_init_dp(void)
                debug("failed to get edp_info data.\n");
                return -EFAULT;
        }
-       disp_info = edp_info->disp_info;
 
        exynos_dp_disp_info(&edp_info->disp_info);
 
index e31a0fd500abef1bc46c9e0518e7bc2e8639db3d..ee0ed06d6fe60d711a420b8710e996cb487fa9e8 100644 (file)
@@ -63,19 +63,35 @@ static void exynos_lcd_init_mem(void *lcdbase, vidinfo_t *vid)
 static void exynos_lcd_init(vidinfo_t *vid)
 {
        exynos_fimd_lcd_init(vid);
+
+       /* Enable flushing after LCD writes if requested */
+       lcd_set_flush_dcache(1);
 }
 
+#ifdef CONFIG_CMD_BMP
 static void draw_logo(void)
 {
        int x, y;
        ulong addr;
 
-       x = ((panel_width - panel_info.logo_width) >> 1);
-       y = ((panel_height - panel_info.logo_height) >> 1) - 4;
+       if (panel_width >= panel_info.logo_width) {
+               x = ((panel_width - panel_info.logo_width) >> 1);
+       } else {
+               x = 0;
+               printf("Warning: image width is bigger than display width\n");
+       }
+
+       if (panel_height >= panel_info.logo_height) {
+               y = ((panel_height - panel_info.logo_height) >> 1) - 4;
+       } else {
+               y = 0;
+               printf("Warning: image height is bigger than display height\n");
+       }
 
        addr = panel_info.logo_addr;
        bmp_display(addr, x, y);
 }
+#endif
 
 static void lcd_panel_on(vidinfo_t *vid)
 {
@@ -134,7 +150,9 @@ void lcd_enable(void)
        if (panel_info.logo_on) {
                memset(lcd_base, 0, panel_width * panel_height *
                                (NBITS(panel_info.vl_bpix) >> 3));
+#ifdef CONFIG_CMD_BMP
                draw_logo();
+#endif
        }
 
        lcd_panel_on(&panel_info);
index 06eae2ed78825d3e7168c6da57b1a87ed39fb6e5..2efe6a61c266f5c3ed2e264e35e11ad0b4b39362 100644 (file)
@@ -88,14 +88,18 @@ static void exynos_fimd_set_par(unsigned int win_id)
        /* DATAPATH is DMA */
        cfg |= EXYNOS_WINCON_DATAPATH_DMA;
 
-       /* bpp is 32 */
-       cfg |= EXYNOS_WINCON_WSWP_ENABLE;
+       if (pvid->logo_on) /* To get proprietary LOGO */
+               cfg |= EXYNOS_WINCON_WSWP_ENABLE;
+       else /* To get output console on LCD */
+               cfg |= EXYNOS_WINCON_HAWSWP_ENABLE;
 
        /* dma burst is 16 */
        cfg |= EXYNOS_WINCON_BURSTLEN_16WORD;
 
-       /* pixel format is unpacked RGB888 */
-       cfg |= EXYNOS_WINCON_BPPMODE_24BPP_888;
+       if (pvid->logo_on) /* To get proprietary LOGO */
+               cfg |= EXYNOS_WINCON_BPPMODE_24BPP_888;
+       else /* To get output console on LCD */
+               cfg |= EXYNOS_WINCON_BPPMODE_16BPP_565;
 
        writel(cfg, (unsigned int)&fimd_ctrl->wincon0 +
                        EXYNOS_WINCON(win_id));
index a43aa03735b9e67b330450625a3fad6a74f9137e..982e25250970c45db57eeec2f82f55d70dc3e182 100644 (file)
@@ -55,7 +55,7 @@
 #define IPU_TPM_REG_BASE       0x01060000
 #define IPU_DC_TMPL_REG_BASE   0x01080000
 #define IPU_ISP_TBPR_REG_BASE  0x010C0000
-#elif defined(CONFIG_MX6Q)
+#elif defined(CONFIG_MX6)
 #define IPU_CPMEM_REG_BASE     0x00100000
 #define IPU_LUT_REG_BASE       0x00120000
 #define IPU_SRM_REG_BASE       0x00140000
diff --git a/drivers/video/ld9040.c b/drivers/video/ld9040.c
new file mode 100644 (file)
index 0000000..c01ae12
--- /dev/null
@@ -0,0 +1,144 @@
+/*
+ * ld9040 AMOLED LCD panel driver.
+ *
+ * Copyright (C) 2012 Samsung Electronics
+ * Donghwa Lee <dh09.lee@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 <spi.h>
+
+static const unsigned char SEQ_SWRESET[] = {
+       0x01,
+};
+
+static const unsigned char SEQ_USER_SETTING[] = {
+       0xF0, 0x5A, 0x5A
+};
+
+static const unsigned char SEQ_ELVSS_ON[] = {
+       0xB1, 0x0D, 0x00, 0x16,
+};
+
+static const unsigned char SEQ_TEMP_SWIRE[] = {
+       0xB2, 0x06, 0x06, 0x06, 0x06,
+};
+
+static const unsigned char SEQ_GTCON[] = {
+       0xF7, 0x09, 0x00, 0x00,
+};
+
+static const unsigned char SEQ_PANEL_CONDITION[] = {
+       0xF8, 0x05, 0x65, 0x96, 0x71, 0x7D, 0x19, 0x3B,
+       0x0D, 0x19, 0x7E, 0x0D, 0xE2, 0x00, 0x00, 0x7E,
+       0x7D, 0x07, 0x07, 0x20, 0x20, 0x20, 0x02, 0x02,
+};
+
+static const unsigned char SEQ_GAMMA_SET1[] = {
+       0xF9, 0x00, 0xA7, 0xB4, 0xAE, 0xBF, 0x00, 0x91,
+       0x00, 0xB2, 0xB4, 0xAA, 0xBB, 0x00, 0xAC, 0x00,
+       0xB3, 0xB1, 0xAA, 0xBC, 0x00, 0xB3,
+};
+
+static const unsigned char SEQ_GAMMA_CTRL[] = {
+       0xFB, 0x02, 0x5A,
+};
+
+static const unsigned char SEQ_APON[] = {
+       0xF3, 0x00, 0x00, 0x00, 0x0A, 0x02,
+};
+
+static const unsigned char SEQ_DISPCTL[] = {
+       0xF2, 0x02, 0x08, 0x08, 0x10, 0x10,
+};
+
+static const unsigned char SEQ_MANPWR[] = {
+       0xB0, 0x04,
+};
+
+static const unsigned char SEQ_PWR_CTRL[] = {
+       0xF4, 0x0A, 0x87, 0x25, 0x6A, 0x44, 0x02, 0x88,
+};
+
+static const unsigned char SEQ_SLPOUT[] = {
+       0x11,
+};
+
+static const unsigned char SEQ_SLPIN[] = {
+       0x10,
+};
+
+static const unsigned char SEQ_DISPON[] = {
+       0x29,
+};
+
+static const unsigned char SEQ_DISPOFF[] = {
+       0x28,
+};
+
+static void ld9040_spi_write(const unsigned char *wbuf, unsigned int size_cmd)
+{
+       int i = 0;
+
+       /*
+        * Data are transmitted in 9-bit words:
+        * the first bit is command/parameter, the other are the value.
+        * The value's LSB is shifted to MSB position, to be sent as 9th bit
+        */
+
+       unsigned int data_out = 0, data_in = 0;
+       for (i = 0; i < size_cmd; i++) {
+               data_out = wbuf[i] >> 1;
+               if (i != 0)
+                       data_out += 0x0080;
+               if (wbuf[i] & 0x01)
+                       data_out += 0x8000;
+               spi_xfer(NULL, 9, &data_out, &data_in, SPI_XFER_BEGIN);
+       }
+}
+
+void ld9040_cfg_ldo(void)
+{
+       udelay(10);
+
+       ld9040_spi_write(SEQ_USER_SETTING,
+                                       ARRAY_SIZE(SEQ_USER_SETTING));
+       ld9040_spi_write(SEQ_PANEL_CONDITION,
+                                       ARRAY_SIZE(SEQ_PANEL_CONDITION));
+       ld9040_spi_write(SEQ_DISPCTL, ARRAY_SIZE(SEQ_DISPCTL));
+       ld9040_spi_write(SEQ_MANPWR, ARRAY_SIZE(SEQ_MANPWR));
+       ld9040_spi_write(SEQ_PWR_CTRL, ARRAY_SIZE(SEQ_PWR_CTRL));
+       ld9040_spi_write(SEQ_ELVSS_ON, ARRAY_SIZE(SEQ_ELVSS_ON));
+       ld9040_spi_write(SEQ_GTCON, ARRAY_SIZE(SEQ_GTCON));
+       ld9040_spi_write(SEQ_GAMMA_SET1, ARRAY_SIZE(SEQ_GAMMA_SET1));
+       ld9040_spi_write(SEQ_GAMMA_CTRL, ARRAY_SIZE(SEQ_GAMMA_CTRL));
+       ld9040_spi_write(SEQ_SLPOUT, ARRAY_SIZE(SEQ_SLPOUT));
+
+       udelay(120);
+}
+
+void ld9040_enable_ldo(unsigned int onoff)
+{
+       if (onoff)
+               ld9040_spi_write(SEQ_DISPON, ARRAY_SIZE(SEQ_DISPON));
+       else
+               ld9040_spi_write(SEQ_DISPOFF, ARRAY_SIZE(SEQ_DISPOFF));
+}
diff --git a/drivers/video/tegra.c b/drivers/video/tegra.c
new file mode 100644 (file)
index 0000000..750a283
--- /dev/null
@@ -0,0 +1,379 @@
+/*
+ * Copyright (c) 2011 The Chromium OS Authors.
+ * See file CREDITS for 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 <fdtdec.h>
+#include <lcd.h>
+
+#include <asm/system.h>
+#include <asm/gpio.h>
+
+#include <asm/arch/clock.h>
+#include <asm/arch/funcmux.h>
+#include <asm/arch/pinmux.h>
+#include <asm/arch/pwm.h>
+#include <asm/arch/display.h>
+#include <asm/arch-tegra/timer.h>
+
+DECLARE_GLOBAL_DATA_PTR;
+
+/* These are the stages we go throuh in enabling the LCD */
+enum stage_t {
+       STAGE_START,
+       STAGE_PANEL_VDD,
+       STAGE_LVDS,
+       STAGE_BACKLIGHT_VDD,
+       STAGE_PWM,
+       STAGE_BACKLIGHT_EN,
+       STAGE_DONE,
+};
+
+static enum stage_t stage;     /* Current stage we are at */
+static unsigned long timer_next; /* Time we can move onto next stage */
+
+/* Our LCD config, set up in handle_stage() */
+static struct fdt_panel_config config;
+struct fdt_disp_config *disp_config;   /* Display controller config */
+
+enum {
+       /* Maximum LCD size we support */
+       LCD_MAX_WIDTH           = 1366,
+       LCD_MAX_HEIGHT          = 768,
+       LCD_MAX_LOG2_BPP        = 4,            /* 2^4 = 16 bpp */
+};
+
+int lcd_line_length;
+int lcd_color_fg;
+int lcd_color_bg;
+
+void *lcd_base;                        /* Start of framebuffer memory  */
+void *lcd_console_address;     /* Start of console buffer      */
+
+short console_col;
+short console_row;
+
+vidinfo_t panel_info = {
+       /* Insert a value here so that we don't end up in the BSS */
+       .vl_col = -1,
+};
+
+char lcd_cursor_enabled;
+
+ushort lcd_cursor_width;
+ushort lcd_cursor_height;
+
+#ifndef CONFIG_OF_CONTROL
+#error "You must enable CONFIG_OF_CONTROL to get Tegra LCD support"
+#endif
+
+void lcd_cursor_size(ushort width, ushort height)
+{
+       lcd_cursor_width = width;
+       lcd_cursor_height = height;
+}
+
+void lcd_toggle_cursor(void)
+{
+       ushort x, y;
+       uchar *dest;
+       ushort row;
+
+       x = console_col * lcd_cursor_width;
+       y = console_row * lcd_cursor_height;
+       dest = (uchar *)(lcd_base + y * lcd_line_length + x * (1 << LCD_BPP) /
+                       8);
+
+       for (row = 0; row < lcd_cursor_height; ++row, dest += lcd_line_length) {
+               ushort *d = (ushort *)dest;
+               ushort color;
+               int i;
+
+               for (i = 0; i < lcd_cursor_width; ++i) {
+                       color = *d;
+                       color ^= lcd_color_fg;
+                       *d = color;
+                       ++d;
+               }
+       }
+}
+
+void lcd_cursor_on(void)
+{
+       lcd_cursor_enabled = 1;
+       lcd_toggle_cursor();
+}
+void lcd_cursor_off(void)
+{
+       lcd_cursor_enabled = 0;
+       lcd_toggle_cursor();
+}
+
+char lcd_is_cursor_enabled(void)
+{
+       return lcd_cursor_enabled;
+}
+
+static void update_panel_size(struct fdt_disp_config *config)
+{
+       panel_info.vl_col = config->width;
+       panel_info.vl_row = config->height;
+       panel_info.vl_bpix = config->log2_bpp;
+}
+
+/*
+ *  Main init function called by lcd driver.
+ *  Inits and then prints test pattern if required.
+ */
+
+void lcd_ctrl_init(void *lcdbase)
+{
+       int line_length, size;
+       int type = DCACHE_OFF;
+
+       assert(disp_config);
+
+       lcd_base = (void *)disp_config->frame_buffer;
+
+       /* Make sure that we can acommodate the selected LCD */
+       assert(disp_config->width <= LCD_MAX_WIDTH);
+       assert(disp_config->height <= LCD_MAX_HEIGHT);
+       assert(disp_config->log2_bpp <= LCD_MAX_LOG2_BPP);
+       if (disp_config->width <= LCD_MAX_WIDTH
+                       && disp_config->height <= LCD_MAX_HEIGHT
+                       && disp_config->log2_bpp <= LCD_MAX_LOG2_BPP)
+               update_panel_size(disp_config);
+       size = lcd_get_size(&line_length);
+
+       /* Set up the LCD caching as requested */
+       if (config.cache_type & FDT_LCD_CACHE_WRITE_THROUGH)
+               type = DCACHE_WRITETHROUGH;
+       else if (config.cache_type & FDT_LCD_CACHE_WRITE_BACK)
+               type = DCACHE_WRITEBACK;
+       mmu_set_region_dcache_behaviour(disp_config->frame_buffer, size, type);
+
+       /* Enable flushing after LCD writes if requested */
+       lcd_set_flush_dcache(config.cache_type & FDT_LCD_CACHE_FLUSH);
+
+       debug("LCD frame buffer at %p\n", lcd_base);
+}
+
+ulong calc_fbsize(void)
+{
+       return (panel_info.vl_col * panel_info.vl_row *
+               NBITS(panel_info.vl_bpix)) / 8;
+}
+
+void lcd_setcolreg(ushort regno, ushort red, ushort green, ushort blue)
+{
+}
+
+void tegra_lcd_early_init(const void *blob)
+{
+       /*
+        * Go with the maximum size for now. We will fix this up after
+        * relocation. These values are only used for memory alocation.
+        */
+       panel_info.vl_col = LCD_MAX_WIDTH;
+       panel_info.vl_row = LCD_MAX_HEIGHT;
+       panel_info.vl_bpix = LCD_MAX_LOG2_BPP;
+}
+
+/**
+ * Decode the panel information from the fdt.
+ *
+ * @param blob         fdt blob
+ * @param config       structure to store fdt config into
+ * @return 0 if ok, -ve on error
+ */
+static int fdt_decode_lcd(const void *blob, struct fdt_panel_config *config)
+{
+       int display_node;
+
+       disp_config = tegra_display_get_config();
+       if (!disp_config) {
+               debug("%s: Display controller is not configured\n", __func__);
+               return -1;
+       }
+       display_node = disp_config->panel_node;
+       if (display_node < 0) {
+               debug("%s: No panel configuration available\n", __func__);
+               return -1;
+       }
+
+       config->pwm_channel = pwm_request(blob, display_node, "nvidia,pwm");
+       if (config->pwm_channel < 0) {
+               debug("%s: Unable to request PWM channel\n", __func__);
+               return -1;
+       }
+
+       config->cache_type = fdtdec_get_int(blob, display_node,
+                                           "nvidia,cache-type",
+                                           FDT_LCD_CACHE_WRITE_BACK_FLUSH);
+
+       /* These GPIOs are all optional */
+       fdtdec_decode_gpio(blob, display_node, "nvidia,backlight-enable-gpios",
+                           &config->backlight_en);
+       fdtdec_decode_gpio(blob, display_node, "nvidia,lvds-shutdown-gpios",
+                          &config->lvds_shutdown);
+       fdtdec_decode_gpio(blob, display_node, "nvidia,backlight-vdd-gpios",
+                          &config->backlight_vdd);
+       fdtdec_decode_gpio(blob, display_node, "nvidia,panel-vdd-gpios",
+                          &config->panel_vdd);
+
+       return fdtdec_get_int_array(blob, display_node, "nvidia,panel-timings",
+                       config->panel_timings, FDT_LCD_TIMINGS);
+}
+
+/**
+ * Handle the next stage of device init
+ */
+static int handle_stage(const void *blob)
+{
+       debug("%s: stage %d\n", __func__, stage);
+
+       /* do the things for this stage */
+       switch (stage) {
+       case STAGE_START:
+               /* Initialize the Tegra display controller */
+               if (tegra_display_probe(gd->fdt_blob, (void *)gd->fb_base)) {
+                       printf("%s: Failed to probe display driver\n",
+                       __func__);
+                       return -1;
+               }
+
+               /* get panel details */
+               if (fdt_decode_lcd(blob, &config)) {
+                       printf("No valid LCD information in device tree\n");
+                       return -1;
+               }
+
+               /*
+                * It is possible that the FDT has requested that the LCD be
+                * disabled. We currently don't support this. It would require
+                * changes to U-Boot LCD subsystem to have LCD support
+                * compiled in but not used. An easier option might be to
+                * still have a frame buffer, but leave the backlight off and
+                * remove all mention of lcd in the stdout environment
+                * variable.
+                */
+
+               funcmux_select(PERIPH_ID_DISP1, FUNCMUX_DEFAULT);
+
+               fdtdec_setup_gpio(&config.panel_vdd);
+               fdtdec_setup_gpio(&config.lvds_shutdown);
+               fdtdec_setup_gpio(&config.backlight_vdd);
+               fdtdec_setup_gpio(&config.backlight_en);
+
+               /*
+                * TODO: If fdt includes output flag we can omit this code
+                * since fdtdec_setup_gpio will do it for us.
+                */
+               if (fdt_gpio_isvalid(&config.panel_vdd))
+                       gpio_direction_output(config.panel_vdd.gpio, 0);
+               if (fdt_gpio_isvalid(&config.lvds_shutdown))
+                       gpio_direction_output(config.lvds_shutdown.gpio, 0);
+               if (fdt_gpio_isvalid(&config.backlight_vdd))
+                       gpio_direction_output(config.backlight_vdd.gpio, 0);
+               if (fdt_gpio_isvalid(&config.backlight_en))
+                       gpio_direction_output(config.backlight_en.gpio, 0);
+               break;
+       case STAGE_PANEL_VDD:
+               if (fdt_gpio_isvalid(&config.panel_vdd))
+                       gpio_direction_output(config.panel_vdd.gpio, 1);
+               break;
+       case STAGE_LVDS:
+               if (fdt_gpio_isvalid(&config.lvds_shutdown))
+                       gpio_set_value(config.lvds_shutdown.gpio, 1);
+               break;
+       case STAGE_BACKLIGHT_VDD:
+               if (fdt_gpio_isvalid(&config.backlight_vdd))
+                       gpio_set_value(config.backlight_vdd.gpio, 1);
+               break;
+       case STAGE_PWM:
+               /* Enable PWM at 15/16 high, 32768 Hz with divider 1 */
+               pinmux_set_func(PINGRP_GPU, PMUX_FUNC_PWM);
+               pinmux_tristate_disable(PINGRP_GPU);
+
+               pwm_enable(config.pwm_channel, 32768, 0xdf, 1);
+               break;
+       case STAGE_BACKLIGHT_EN:
+               if (fdt_gpio_isvalid(&config.backlight_en))
+                       gpio_set_value(config.backlight_en.gpio, 1);
+               break;
+       case STAGE_DONE:
+               break;
+       }
+
+       /* set up timer for next stage */
+       timer_next = timer_get_us();
+       if (stage < FDT_LCD_TIMINGS)
+               timer_next += config.panel_timings[stage] * 1000;
+
+       /* move to next stage */
+       stage++;
+       return 0;
+}
+
+int tegra_lcd_check_next_stage(const void *blob, int wait)
+{
+       if (stage == STAGE_DONE)
+               return 0;
+
+       do {
+               /* wait if we need to */
+               debug("%s: stage %d\n", __func__, stage);
+               if (stage != STAGE_START) {
+                       int delay = timer_next - timer_get_us();
+
+                       if (delay > 0) {
+                               if (wait)
+                                       udelay(delay);
+                               else
+                                       return 0;
+                       }
+               }
+
+               if (handle_stage(blob))
+                       return -1;
+       } while (wait && stage != STAGE_DONE);
+       if (stage == STAGE_DONE)
+               debug("%s: LCD init complete\n", __func__);
+
+       return 0;
+}
+
+void lcd_enable(void)
+{
+       /*
+        * Backlight and power init will be done separately in
+        * tegra_lcd_check_next_stage(), which should be called in
+        * board_late_init().
+        *
+        * U-Boot code supports only colour depth, selected at compile time.
+        * The device tree setting should match this. Otherwise the display
+        * will not look right, and U-Boot may crash.
+        */
+       if (disp_config->log2_bpp != LCD_BPP) {
+               printf("%s: Error: LCD depth configured in FDT (%d = %dbpp)"
+                       " must match setting of LCD_BPP (%d)\n", __func__,
+                      disp_config->log2_bpp, disp_config->bpp, LCD_BPP);
+       }
+}
index 923acb9f3af40b8eb8329fbf146979d290102844..b1f4e0f03f8b2b96222518bc6ea54d234995d743 100644 (file)
@@ -27,7 +27,11 @@ LIB  := $(obj)libwatchdog.o
 
 COBJS-$(CONFIG_AT91SAM9_WATCHDOG) += at91sam9_wdt.o
 COBJS-$(CONFIG_FTWDT010_WATCHDOG) += ftwdt010_wdt.o
+ifneq (,$(filter $(SOC), mx31 mx35 mx5 mx6))
+COBJS-y += imx_watchdog.o
+endif
 COBJS-$(CONFIG_TNETV107X_WATCHDOG) += tnetv107x_wdt.o
+COBJS-$(CONFIG_S5P)               += s5p_wdt.o
 
 COBJS  := $(COBJS-y)
 SRCS   := $(COBJS:.o=.c)
diff --git a/drivers/watchdog/imx_watchdog.c b/drivers/watchdog/imx_watchdog.c
new file mode 100644 (file)
index 0000000..50e602a
--- /dev/null
@@ -0,0 +1,66 @@
+/*
+ * watchdog.c - driver for i.mx on-chip watchdog
+ *
+ * Licensed under the GPL-2 or later.
+ */
+
+#include <common.h>
+#include <asm/io.h>
+#include <watchdog.h>
+#include <asm/arch/imx-regs.h>
+
+struct watchdog_regs {
+       u16     wcr;    /* Control */
+       u16     wsr;    /* Service */
+       u16     wrsr;   /* Reset Status */
+};
+
+#define WCR_WDZST      0x01
+#define WCR_WDBG       0x02
+#define WCR_WDE                0x04    /* WDOG enable */
+#define WCR_WDT                0x08
+#define WCR_WDW                0x80
+#define SET_WCR_WT(x)  (x << 8)
+
+#ifdef CONFIG_IMX_WATCHDOG
+void hw_watchdog_reset(void)
+{
+       struct watchdog_regs *wdog = (struct watchdog_regs *)WDOG1_BASE_ADDR;
+
+       writew(0x5555, &wdog->wsr);
+       writew(0xaaaa, &wdog->wsr);
+}
+
+void hw_watchdog_init(void)
+{
+       struct watchdog_regs *wdog = (struct watchdog_regs *)WDOG1_BASE_ADDR;
+       u16 timeout;
+
+       /*
+        * The timer watchdog can be set between
+        * 0.5 and 128 Seconds. If not defined
+        * in configuration file, sets 128 Seconds
+        */
+#ifndef CONFIG_WATCHDOG_TIMEOUT_MSECS
+#define CONFIG_WATCHDOG_TIMEOUT_MSECS 128000
+#endif
+       timeout = (CONFIG_WATCHDOG_TIMEOUT_MSECS / 500) - 1;
+       writew(WCR_WDZST | WCR_WDBG | WCR_WDE | WCR_WDT |
+               WCR_WDW | SET_WCR_WT(timeout), &wdog->wcr);
+       hw_watchdog_reset();
+}
+#endif
+
+void reset_cpu(ulong addr)
+{
+       struct watchdog_regs *wdog = (struct watchdog_regs *)WDOG1_BASE_ADDR;
+
+       writew(WCR_WDE, &wdog->wcr);
+       writew(0x5555, &wdog->wsr);
+       writew(0xaaaa, &wdog->wsr);     /* load minimum 1/2 second timeout */
+       while (1) {
+               /*
+                * spin for .5 seconds before reset
+                */
+       }
+}
diff --git a/drivers/watchdog/s5p_wdt.c b/drivers/watchdog/s5p_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 d0bf1e8ab234b8c66e017a6eef944c1dc3637ec2..4ad17eafb9b89a15975b0b8945a1b70c198d8d88 100644 (file)
@@ -300,7 +300,7 @@ int abortboot(int bootdelay);
 extern char console_buffer[];
 
 /* arch/$(ARCH)/lib/board.c */
-void   board_init_f  (ulong) __attribute__ ((noreturn));
+void   board_init_f(ulong);
 void   board_init_r  (gd_t *, ulong) __attribute__ ((noreturn));
 int    checkboard    (void);
 int    checkflash    (void);
@@ -311,6 +311,15 @@ int mac_read_from_eeprom(void);
 extern u8 _binary_dt_dtb_start[];      /* embedded device tree blob */
 int set_cpu_clk_info(void);
 
+/**
+ * Show the DRAM size in a board-specific way
+ *
+ * This is used by boards to display DRAM information in their own way.
+ *
+ * @param size Size of DRAM (which should be displayed along with other info)
+ */
+void board_show_dram(ulong size);
+
 /* common/flash.c */
 void flash_perror (int);
 
index e82f6421c0af6e2cd91eaf0c88e9fae371f620cf..2a82e19c78cab87fd6bc2bbb731ed72ceb14fa8a 100644 (file)
@@ -56,6 +56,7 @@
 #define CONFIG_CMD_LICENSE     /* console license display      */
 #define CONFIG_CMD_LOADB       /* loadb                        */
 #define CONFIG_CMD_LOADS       /* loads                        */
+#define CONFIG_CMD_MEMINFO     /* meminfo                      */
 #define CONFIG_CMD_MEMORY      /* md mm nm mw cp cmp crc base loop mtest */
 #define CONFIG_CMD_MFSL                /* FSL support for Microblaze   */
 #define CONFIG_CMD_MII         /* MII support                  */
index 1daec6967780ce4863b583b8cef832eb23603df3..6bceccbc14b355b009fc276181753e506fcaf298 100644 (file)
 
 
 #define CONFIG_SYS_LOAD_ADDR           0x100000        /* where to load what we get from TFTP */
-#define CONFIG_SYS_TFTP_LOADADDR       CONFIG_SYS_LOAD_ADDR
 #define CONFIG_SYS_EXTBDINFO           1               /* To use extended board_into (bd_t) */
 #define CONFIG_SYS_DRAM_TEST           1
 
index b98caccb817f22b65dad63b0cc06f97751d71ce5..9a649ca125fec2ca3682c93aa18ab1d35075ce00 100644 (file)
 #undef CONFIG_LOADS_ECHO
 #define        CONFIG_SYS_LOADS_BAUD_CHANGE
 
-/*
- * Set default load address for tftp network downloads
- */
-#define        CONFIG_SYS_TFTP_LOADADDR                                0x01000000
-
 /*
  * Turn off the watchdog timer
  */
index 36921ca8b9ce05980153a215aecceea4835de839..4849f94c99184e1b1c200baf220f3f9796950403 100644 (file)
 #define CONFIG_IPADDR                                  10.0.4.111
 
 #define CONFIG_SYS_LOAD_ADDR           0x00100000      /* default load address */
-#define        CONFIG_SYS_TFTP_LOADADDR        0x00100000
 
 /*
  * For booting Linux, the board info and command line data
index ab9549b93b8ffe3ce419844a730cfc5920c30dde..72459d859d18e5e1c8a7ecc7a9d71113e54607f0 100644 (file)
 #define CONFIG_SYS_SPI_U_BOOT_SIZE     0x40000
 #define CONFIG_SPL_LDSCRIPT            "$(CPUDIR)/omap-common/u-boot-spl.lds"
 
+#define CONFIG_SPL_BOARD_INIT
+#define CONFIG_SPL_NAND_AM33XX_BCH
+#define CONFIG_SPL_NAND_SUPPORT
+#define CONFIG_SPL_NAND_BASE
+#define CONFIG_SPL_NAND_DRIVERS
+#define CONFIG_SPL_NAND_ECC
+#define CONFIG_SYS_NAND_5_ADDR_CYCLE
+#define CONFIG_SYS_NAND_PAGE_COUNT     (CONFIG_SYS_NAND_BLOCK_SIZE / \
+                                        CONFIG_SYS_NAND_PAGE_SIZE)
+#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, 14, 15, 16, 17, \
+                                        18, 19, 20, 21, 22, 23, 24, 25, \
+                                        26, 27, 28, 29, 30, 31, 32, 33, \
+                                        34, 35, 36, 37, 38, 39, 40, 41, \
+                                        42, 43, 44, 45, 46, 47, 48, 49, \
+                                        50, 51, 52, 53, 54, 55, 56, 57, }
+
+#define CONFIG_SYS_NAND_ECCSIZE                512
+#define CONFIG_SYS_NAND_ECCBYTES       14
+
+#define CONFIG_SYS_NAND_ECCSTEPS       4
+#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
+
 /*
  * 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
 #define CONFIG_NET_MULTI
 #define CONFIG_PHY_GIGE
 #define CONFIG_PHYLIB
+#define CONFIG_PHY_ADDR                        0
 #define CONFIG_PHY_SMSC
 
+#define CONFIG_NAND
+/* NAND support */
+#ifdef CONFIG_NAND
+#define CONFIG_CMD_NAND
+#define CONFIG_NAND_OMAP_GPMC
+#define GPMC_NAND_ECC_LP_x16_LAYOUT    1
+#define CONFIG_SYS_NAND_BASE           (0x08000000)    /* physical address */
+                                                       /* to access nand at */
+                                                       /* CS0 */
+#define CONFIG_SYS_MAX_NAND_DEVICE     1               /* Max number of NAND
+                                                          devices */
+#undef CONFIG_ENV_IS_NOWHERE
+#define CONFIG_ENV_IS_IN_NAND
+#define CONFIG_ENV_OFFSET              0x260000 /* environment starts here */
+#define CONFIG_SYS_ENV_SECT_SIZE       (128 << 10)     /* 128 KiB */
+#endif
+
 #endif /* ! __CONFIG_AM335X_EVM_H */
index 131758279ca9b7547d91d2c4be1d9f3673e77eb0..6fac5ac4eb870f386e1f4434b55e78ee3892c51d 100644 (file)
 #define CONFIG_CMD_NAND
 #define CONFIG_CMD_SF
 #define CONFIG_CMD_MMC
+#define CONFIG_CMD_FAT
+#define CONFIG_CMD_USB
+
+/*
+ * define CONFIG_USB_EHCI to enable USB Hi-Speed (aka 2.0)
+ * NB: in this case, USB 1.1 devices won't be recognized.
+ */
+
 
 /* SDRAM */
 #define CONFIG_NR_DRAM_BANKS           1
 /* MMC */
 #ifdef CONFIG_CMD_MMC
 #define CONFIG_MMC
-#define CONFIG_CMD_FAT
 #define CONFIG_GENERIC_MMC
 #define CONFIG_GENERIC_ATMEL_MCI
+#endif
+
+/* FAT */
+#ifdef CONFIG_CMD_FAT
 #define CONFIG_DOS_PARTITION
 #endif
 
 #define CONFIG_NET_RETRY_COUNT         20
 #define CONFIG_MACB_SEARCH_PHY
 
+/* USB */
+#ifdef CONFIG_CMD_USB
+#ifdef CONFIG_USB_EHCI
+#define CONFIG_USB_EHCI_ATMEL
+#define CONFIG_SYS_USB_EHCI_MAX_ROOT_PORTS     2
+#else
+#define CONFIG_USB_OHCI_NEW
+#define CONFIG_SYS_USB_OHCI_CPU_INIT
+#define CONFIG_SYS_USB_OHCI_REGS_BASE          ATMEL_BASE_OHCI
+#define CONFIG_SYS_USB_OHCI_SLOT_NAME          "at91sam9x5"
+#define CONFIG_SYS_USB_OHCI_MAX_ROOT_PORTS     3
+#endif
+#define CONFIG_USB_ATMEL
+#define CONFIG_USB_STORAGE
+#endif
+
 #define CONFIG_SYS_LOAD_ADDR           0x22000000      /* load address */
 
 #define CONFIG_SYS_MEMTEST_START       CONFIG_SYS_SDRAM_BASE
 #define CONFIG_BOOTCOMMAND     "sf probe 0; " \
                                "sf read 0x22000000 0x100000 0x300000; " \
                                "bootm 0x22000000"
+#elif defined(CONFIG_SYS_USE_DATAFLASH)
+/* bootstrap + u-boot + env + linux in data flash */
+#define CONFIG_ENV_IS_IN_SPI_FLASH
+#define CONFIG_ENV_OFFSET      0x4200
+#define CONFIG_ENV_SIZE                0x4200
+#define CONFIG_ENV_SECT_SIZE   0x210
+#define CONFIG_ENV_SPI_MAX_HZ  30000000
+#define CONFIG_BOOTCOMMAND     "sf probe 0; " \
+                               "sf read 0x22000000 0x84000 0x294000; " \
+                               "bootm 0x22000000"
 #else /* CONFIG_SYS_USE_MMC */
 /* bootstrap + u-boot + env + linux in mmc */
 #define CONFIG_ENV_IS_IN_MMC
index 568ae8e0972d1c9efc8376de10d2be6a2c15bf8b..7d072153ee8295a4e1407152015c15c5d4d5031b 100644 (file)
 #define CONFIG_DOS_PARTITION
 
 /* USB */
-#define CONFIG_MUSB_UDC
 #define CONFIG_USB_OMAP3
+#define CONFIG_USB_EHCI
+#define CONFIG_USB_EHCI_OMAP
+#define CONFIG_USB_ULPI
+#define CONFIG_USB_ULPI_VIEWPORT_OMAP
+#define CONFIG_USB_STORAGE
+#define CONFIG_MUSB_UDC
 #define CONFIG_TWL4030_USB
+#define CONFIG_CMD_USB
 
 /* USB device configuration */
 #define CONFIG_USB_DEVICE
 
 /* Environment information */
 #define CONFIG_BOOTDELAY               10
+#define CONFIG_ZERO_BOOTDELAY_CHECK
 
 #define CONFIG_EXTRA_ENV_SETTINGS \
        "loadaddr=0x82000000\0" \
  */
 #define CONFIG_NR_DRAM_BANKS   1       /* CS1 is never populated */
 #define PHYS_SDRAM_1           OMAP34XX_SDRC_CS0
-#define PHYS_SDRAM_1_SIZE      (32 << 20)      /* at least 32 MiB */
 
 /*-----------------------------------------------------------------------
  * FLASH and environment organization
index adeace0cf2ef8211ab5bbae66d3e7adfd23d0b0a..d8aabd4cc8890166b931c569ca91fe8c71730b7c 100644 (file)
 #define CONFIG_CMD_GPIO
 #define CONFIG_CMD_IMI
 #undef CONFIG_CMD_IMLS
+#define CONFIG_CMD_IO
 #define CONFIG_CMD_IRQ
 #define CONFIG_CMD_ITEST
 #define CONFIG_CMD_LOADB
index dda758269a85041b70f2778180df329a43c19b22..721b91c4df91875470fa5e07b8e2465bf2e0cdb9 100644 (file)
  */
 #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
 
 /*-----------------------------------------------------------------------
index 5a0d321f739de147b862aa3586832a48d175ac7c..459f56878cf3078503b657439fea7aebb39fe505 100644 (file)
 #define CONFIG_SYS_SDRAM_BASE          CONFIG_SYS_SDRAM_BASE0
 #define        CONFIG_SYS_SDRAM_SIZE           CONFIG_SYS_SDRAM_SIZE0
 
-/* If M5282 port is fully implemented the monitor base will be behind
- * the vector table. */
-#if (CONFIG_SYS_TEXT_BASE !=  CONFIG_SYS_INT_FLASH_BASE)
-#define CONFIG_SYS_MONITOR_BASE        (CONFIG_SYS_TEXT_BASE + 0x400)
-#else
-#define CONFIG_SYS_MONITOR_BASE        (CONFIG_SYS_TEXT_BASE + 0x418) /* 24 Byte for CFM-Config */
-#endif
-
 #define CONFIG_SYS_MONITOR_LEN         0x20000
 #define CONFIG_SYS_MALLOC_LEN          (256 << 10)
 #define CONFIG_SYS_BOOTPARAMS_LEN      64*1024
index ccfe032ca731fe7e79a57bddd9f14ae0cd2b52f7..5a87cc5d3d6c627f26d9f8518122e125fa08531b 100644 (file)
 #define        CONFIG_CLOCKS_IN_MHZ    1      /* clocks passsed to Linux in MHz */
 
 #define CONFIG_SYS_LOAD_ADDR     0x00100000   /* default load address */
-#define CONFIG_SYS_TFTP_LOADADDR 0x00100000   /* default load address for network file downloads */
 
 #define CONFIG_SYS_HZ            1000         /* decrementer freq: 1 ms ticks */
 
diff --git a/include/configs/exynos5250-dt.h b/include/configs/exynos5250-dt.h
new file mode 100644 (file)
index 0000000..cabd2f2
--- /dev/null
@@ -0,0 +1,321 @@
+/*
+ * Copyright (C) 2012 Samsung Electronics
+ *
+ * Configuration settings for the SAMSUNG 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
+
+/* Enable fdt support for Exynos5250 */
+#define CONFIG_ARCH_DEVICE_TREE                exynos5250
+#define CONFIG_OF_CONTROL
+#define CONFIG_OF_SEPARATE
+
+/* 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 + (4 << 20))
+
+/* select serial console configuration */
+#define CONFIG_SERIAL3                 /* use SERIAL 3 */
+#define CONFIG_BAUDRATE                        115200
+#define EXYNOS5_DEFAULT_UART_OFFSET    0x010000
+
+/* Console configuration */
+#define CONFIG_CONSOLE_MUX
+#define CONFIG_SYS_CONSOLE_IS_IN_ENV
+#define EXYNOS_DEVICE_SETTINGS \
+               "stdin=serial\0" \
+               "stdout=serial,lcd\0" \
+               "stderr=serial,lcd\0"
+
+#define CONFIG_EXTRA_ENV_SETTINGS \
+       EXYNOS_DEVICE_SETTINGS
+
+#define TZPC_BASE_OFFSET               0x10000
+
+/* SD/MMC configuration */
+#define CONFIG_GENERIC_MMC
+#define CONFIG_MMC
+#define CONFIG_SDHCI
+#define CONFIG_S5P_SDHCI
+
+#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
+
+/* USB */
+#define CONFIG_CMD_USB
+#define CONFIG_USB_EHCI
+#define CONFIG_USB_EHCI_EXYNOS
+#define CONFIG_USB_STORAGE
+
+/* MMC SPL */
+#define CONFIG_SPL
+#define COPY_BL2_FNPTR_ADDR    0x02020030
+
+/* specific .lds file */
+#define CONFIG_SPL_LDSCRIPT    "board/samsung/smdk5250/smdk5250-uboot-spl.lds"
+#define CONFIG_SPL_TEXT_BASE   0x02023400
+#define CONFIG_SPL_MAX_SIZE    (14 * 1024)
+
+#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              "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
+
+#define CONFIG_RD_LVL
+
+#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_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 OM_STAT                                (0x1f << 1)
+#define EXYNOS_COPY_SPI_FNPTR_ADDR     0x02020058
+#define SPI_FLASH_UBOOT_POS            (CONFIG_SEC_FW_SIZE + CONFIG_BL1_SIZE)
+
+#define CONFIG_DOS_PARTITION
+
+#define CONFIG_IRAM_STACK      0x02050000
+
+#define CONFIG_SYS_INIT_SP_ADDR        (CONFIG_SYS_LOAD_ADDR - 0x1000000)
+
+/* I2C */
+#define CONFIG_SYS_I2C_INIT_BOARD
+#define CONFIG_HARD_I2C
+#define CONFIG_CMD_I2C
+#define CONFIG_SYS_I2C_SPEED   100000          /* 100 Kbps */
+#define CONFIG_DRIVER_S3C24X0_I2C
+#define CONFIG_I2C_MULTI_BUS
+#define CONFIG_MAX_I2C_NUM     8
+#define CONFIG_SYS_I2C_SLAVE    0x0
+#define CONFIG_I2C_EDID
+
+/* PMIC */
+#define CONFIG_PMIC
+#define CONFIG_PMIC_I2C
+#define CONFIG_PMIC_MAX77686
+
+/* SPI */
+#define CONFIG_ENV_IS_IN_SPI_FLASH
+#define CONFIG_SPI_FLASH
+
+#ifdef CONFIG_SPI_FLASH
+#define CONFIG_EXYNOS_SPI
+#define CONFIG_CMD_SF
+#define CONFIG_CMD_SPI
+#define CONFIG_SPI_FLASH_WINBOND
+#define CONFIG_SF_DEFAULT_MODE         SPI_MODE_0
+#define CONFIG_SF_DEFAULT_SPEED                50000000
+#define EXYNOS5_SPI_NUM_CONTROLLERS    5
+#endif
+
+#ifdef CONFIG_ENV_IS_IN_SPI_FLASH
+#define CONFIG_ENV_SPI_MODE    SPI_MODE_0
+#define CONFIG_ENV_SECT_SIZE   CONFIG_ENV_SIZE
+#define CONFIG_ENV_SPI_BUS     1
+#define CONFIG_ENV_SPI_MAX_HZ  50000000
+#endif
+
+/* PMIC */
+#define CONFIG_POWER
+#define CONFIG_POWER_I2C
+#define CONFIG_POWER_MAX77686
+
+/* SPI */
+#define CONFIG_ENV_IS_IN_SPI_FLASH
+#define CONFIG_SPI_FLASH
+
+#ifdef CONFIG_SPI_FLASH
+#define CONFIG_EXYNOS_SPI
+#define CONFIG_CMD_SF
+#define CONFIG_CMD_SPI
+#define CONFIG_SPI_FLASH_WINBOND
+#define CONFIG_SF_DEFAULT_MODE         SPI_MODE_0
+#define CONFIG_SF_DEFAULT_SPEED                50000000
+#define EXYNOS5_SPI_NUM_CONTROLLERS    5
+#endif
+
+#ifdef CONFIG_ENV_IS_IN_SPI_FLASH
+#define CONFIG_ENV_SPI_MODE    SPI_MODE_0
+#define CONFIG_ENV_SECT_SIZE   CONFIG_ENV_SIZE
+#define CONFIG_ENV_SPI_BUS     1
+#define CONFIG_ENV_SPI_MAX_HZ  50000000
+#endif
+
+/* 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 PXE Support */
+#ifdef CONFIG_CMD_NET
+#define CONFIG_CMD_PXE
+#define CONFIG_MENU
+#endif
+
+/* Sound */
+#define CONFIG_CMD_SOUND
+#ifdef CONFIG_CMD_SOUND
+#define CONFIG_SOUND
+#define CONFIG_I2S
+#define CONFIG_SOUND_WM8994
+#endif
+
+/* Enable devicetree support */
+#define CONFIG_OF_LIBFDT
+
+/* SHA hashing */
+#define CONFIG_CMD_HASH
+#define CONFIG_HASH_VERIFY
+#define CONFIG_SHA1
+#define CONFIG_SHA256
+
+/* Display */
+#define CONFIG_LCD
+#ifdef CONFIG_LCD
+#define CONFIG_EXYNOS_FB
+#define CONFIG_EXYNOS_DP
+#define LCD_XRES                       2560
+#define LCD_YRES                       1600
+#define LCD_BPP                        LCD_COLOR16
+#endif
+
+#endif /* __CONFIG_H */
index ef14dd38c5bb05db415feb839e40cce92c3e1089..516a26e9f1abeb69b9133f8e66ba977501195780 100644 (file)
 
 #define CONFIG_BOOTARGS "root=/dev/ram0 ro console=ttyS0,115200n8"
 
+#define CONFIG_SYS_CONSOLE_IS_IN_ENV
+#define CONFIG_USB_DEV_PULLUP_GPIO     33
+/* USB VBUS GPIO 3 */
+
+#define CONFIG_CMD_NET
+#define CONFIG_CMD_PING
+
+#define CONFIG_BOOTDELAY               2
+#define CONFIG_BOOTCOMMAND             \
+       "setenv downloaded 0 ; while test $downloaded -eq 0 ; do " \
+       "if bootp ; then setenv downloaded 1 ; fi ; done ; " \
+       "source :script ; " \
+       "bootm ; "
+
+#define CONFIG_USB_GADGET_PXA2XX
+#define CONFIG_USB_ETHER
+#define CONFIG_USB_ETH_SUBSET
+
+#define CONFIG_USBNET_DEV_ADDR         "de:ad:be:ef:00:01"
+#define CONFIG_USBNET_HOST_ADDR        "de:ad:be:ef:00:02"
+#define CONFIG_EXTRA_ENV_SETTINGS \
+       "stdin=serial\0" \
+       "stdout=serial\0" \
+       "stderr=serial\0"
+
 #endif /* __CONFIG_H */
index 040bfe48eb08e63693b12c24f103f3432b4e3f8a..8d1fd47afe7683f903e9bb137efa6b4b7e391b20 100644 (file)
 
 #define CONFIG_DOS_PARTITION
 #define CONFIG_EFI_PARTITION
+#define CONFIG_FS_EXT4
+#define CONFIG_FS_FAT
 #define CONFIG_CMD_EXT2
 #define CONFIG_CMD_FAT
+#define CONFIG_CMD_FS_GENERIC
 
 /* NAND support */
 #define CONFIG_CMD_NAND
 #define CONFIG_TEGRA_NAND
 #define CONFIG_SYS_MAX_NAND_DEVICE     1
-#define CONFIG_SYS_NAND_BASE   NV_PA_NAND_BASE
 
 /* Environment in NAND (which is 512M), aligned to start of last sector */
 #define CONFIG_ENV_IS_IN_NAND
index be7937d70ea718392942e02949f8b2a66fd0b939..f8131b1bafdc8fc8d1a23fa5fad4299a45ebe3ab 100644 (file)
@@ -67,6 +67,9 @@
 #define CONFIG_SYS_NS16550_REG_SIZE    (-4)
 #define CONFIG_SYS_NS16550_CLK         V_NS16550_CLK
 
+/* define to avoid U-Boot to hang while waiting for TEMT */
+#define CONFIG_SYS_NS16550_BROKEN_TEMT
+
 /* select serial console configuration */
 #define CONFIG_CONS_INDEX              3
 #define CONFIG_SYS_NS16550_COM3                OMAP34XX_UART3
  */
 #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 meg */
 #define PHYS_SDRAM_2           OMAP34XX_SDRC_CS1
 
 /*
 #define CONFIG_SYS_MMC_SD_FAT_BOOT_PARTITION   1
 #define CONFIG_SPL_FAT_LOAD_PAYLOAD_NAME       "u-boot.img"
 
+#define CONFIG_SPL_BOARD_INIT
 #define CONFIG_SPL_LIBCOMMON_SUPPORT
 #define CONFIG_SPL_LIBDISK_SUPPORT
 #define CONFIG_SPL_I2C_SUPPORT
index 05480d48aedf0b730992f77617e21b813bfa802f..f64748e349c0355c9d4a0147569ae72eeb5f863a 100644 (file)
        "load=tftpboot ${load_addr_r} ${u-boot}\0"                      \
        "mtdids=" MTDIDS_DEFAULT "\0"                                   \
        "mtdparts=" MTDPARTS_DEFAULT "\0"                               \
-       "stderr=serial\0"                                               \
-       "stdin=serial\0"                                                \
-       "stdout=serial\0"                                               \
        ""
 #endif /* CONFIG_KM_DEF_ENV */
 
index 8097f28ccc54bd136404d14f58a8f4af0c4397c2..59f151a37515a96a1be395bd2cd90b49d0672f4b 100644 (file)
        "config_nc_dhcp=setenv autoload_old ${autoload}; "              \
                "setenv autoload no "                                   \
                "&& bootp "                                             \
-               "&& setenv ncip ${serverip} "                           \
+               "&& setenv ncip "                                       \
                "&& setenv autoload ${autoload_old}; "                  \
                "setenv autoload_old\0"                                 \
        "standard_env=setenv ipaddr; setenv netmask; setenv serverip; " \
index b49ec8c7dd61fd4139a145bb62f2f730b23c025f..688717158b53cc0d209a994dfb80c2875a14973a 100644 (file)
                "512k(environment),"            \
                "512k(redundant-environment),"  \
                "4m(kernel),"                   \
+               "128k(fdt),"                    \
+               "8m(ramdisk),"                  \
                "-(filesystem)"
 #else
 #define        CONFIG_ENV_IS_NOWHERE
                "if tftp ${update_nand_full_filename} ; then "          \
                "run update_nand_get_fcb_size ; "                       \
                "nand scrub -y 0x0 ${filesize} ; "                      \
-               "nand write.raw ${loadaddr} 0x0 ${update_nand_fcb} ; "  \
+               "nand write.raw ${loadaddr} 0x0 ${fcb_sz} ; "   \
                "setexpr update_off ${loadaddr} + ${update_nand_fcb} ; " \
                "setexpr update_sz ${filesize} - ${update_nand_fcb} ; " \
                "nand write ${update_off} ${update_nand_fcb} ${update_sz} ; " \
index e304c994171697e8030196d9b8e2c0a622a6dce3..185faa7ef18c3d1bbb0711c71b48be211213bf64 100644 (file)
  */
 #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
 
 /*
index 7086d1d0e8d5b9d2d3383c0860b19614a7998a84..405a842f72dca6648edeb676d452fed5cfaf7ba0 100644 (file)
@@ -92,7 +92,7 @@
 /*
  * Size of malloc() pool
  */
-#define CONFIG_SYS_MALLOC_LEN  (1024 * 1024) /* 1MiB for malloc() */
+#define CONFIG_SYS_MALLOC_LEN  (1024 * 1024 * 4) /* 4MiB for malloc() */
 
 /*
  * Other required minimal configurations
index bd000a7f09d1027ba83c66f60346f50bfd6b01c9..c10e78b634bd1abe6db46715ebf87585ff98a142 100644 (file)
 
 /* High Level Configuration Options */
 
+#define CONFIG_MX25
 #define CONFIG_SYS_HZ                  1000
 #define CONFIG_SYS_TEXT_BASE           0x81200000
+#define CONFIG_MXC_GPIO
 
 #define CONFIG_DISPLAY_CPUINFO
 #define CONFIG_DISPLAY_BOARDINFO
@@ -41,6 +43,7 @@
 #define PHYS_SDRAM_1_SIZE      (64 * 1024 * 1024)
 
 #define CONFIG_BOARD_EARLY_INIT_F
+#define CONFIG_BOARD_LATE_INIT
 
 #define CONFIG_SYS_SDRAM_BASE          PHYS_SDRAM_1
 #define CONFIG_SYS_INIT_RAM_ADDR       IMX_RAM_BASE
 /* No NOR flash present */
 #define CONFIG_ENV_OFFSET      (6 * 64 * 1024)
 #define CONFIG_ENV_SIZE        (8 * 1024)
-#define CONFIG_ENV_IS_NOWHERE
 
 #define CONFIG_SYS_NO_FLASH
+#define CONFIG_ENV_IS_IN_MMC
+#define CONFIG_SYS_MMC_ENV_DEV 0
 
 /* U-Boot general configuration */
 #define CONFIG_SYS_PROMPT      "MX25PDK U-Boot > "
 
 /* U-Boot commands */
 #include <config_cmd_default.h>
+#define CONFIG_OF_LIBFDT
+#define CONFIG_CMD_BOOTZ
 #define CONFIG_CMD_CACHE
+#define CONFIG_CMD_MMC
+#define CONFIG_CMD_EXT2
+#define CONFIG_CMD_FAT
 
 /* Ethernet */
 #define CONFIG_FEC_MXC
 #define CONFIG_CMD_NET
 #define CONFIG_ENV_OVERWRITE
 
-#define CONFIG_BOOTDELAY       3
+/* ESDHC driver */
+#define CONFIG_MMC
+#define CONFIG_GENERIC_MMC
+#define CONFIG_FSL_ESDHC
+#define CONFIG_SYS_FSL_ESDHC_ADDR      0
+#define CONFIG_SYS_FSL_ESDHC_NUM       1
+
+/* PMIC Configs */
+#define CONFIG_POWER
+#define CONFIG_POWER_I2C
+#define CONFIG_POWER_FSL
+#define CONFIG_PMIC_FSL_MC34704
+#define CONFIG_SYS_FSL_PMIC_I2C_ADDR   0x54
+
+#define CONFIG_DOS_PARTITION
+
+/* I2C Configs */
+#define CONFIG_CMD_I2C
+#define CONFIG_HARD_I2C
+#define CONFIG_I2C_MXC
+#define CONFIG_SYS_I2C_BASE            IMX_I2C_BASE
+#define CONFIG_SYS_I2C_SPEED           100000
+
+/* Ethernet Configs */
+
+#define CONFIG_CMD_PING
+#define CONFIG_CMD_DHCP
+#define CONFIG_CMD_MII
+#define CONFIG_CMD_NET
+
+#define CONFIG_BOOTDELAY       1
 
 #define CONFIG_LOADADDR                0x81000000      /* loadaddr env var */
 #define CONFIG_SYS_LOAD_ADDR   CONFIG_LOADADDR
index 2916c710e412aae691a8aa6892c7c94251bbee77..dd0ef2134b529441335f70422afc5476ad9d7e75 100644 (file)
  */
 #define CONFIG_CMDLINE_TAG
 #define CONFIG_SETUP_MEMORY_TAGS
-#define CONFIG_BOOTDELAY       3
+#define CONFIG_BOOTDELAY       1
 #define CONFIG_BOOTFILE        "uImage"
 #define CONFIG_LOADADDR        0x42000000
 #define CONFIG_SYS_LOAD_ADDR   CONFIG_LOADADDR
                "if tftp ${update_nand_full_filename} ; then " \
                "run update_nand_get_fcb_size ; " \
                "nand scrub -y 0x0 ${filesize} ; " \
-               "nand write.raw ${loadaddr} 0x0 ${update_nand_fcb} ; " \
+               "nand write.raw ${loadaddr} 0x0 ${fcb_sz} ; " \
                "setexpr update_off ${loadaddr} + ${update_nand_fcb} ; " \
                "setexpr update_sz ${filesize} - ${update_nand_fcb} ; " \
                "nand write ${update_off} ${update_nand_fcb} ${update_sz} ; " \
        "uimage=uImage\0" \
        "console_fsl=ttyAM0\0" \
        "console_mainline=ttyAMA0\0" \
+       "fdt_file=imx28-evk.dtb\0" \
+       "fdt_addr=0x41000000\0" \
+       "boot_fdt=try\0" \
+       "ip_dyn=yes\0" \
        "mmcdev=0\0" \
        "mmcpart=2\0" \
-       "mmcroot=/dev/mmcblk0p3 rw\0" \
-       "mmcrootfstype=ext3 rootwait\0" \
+       "mmcroot=/dev/mmcblk0p3 rw rootwait\0" \
        "mmcargs=setenv bootargs console=${console_mainline},${baudrate} " \
-               "root=${mmcroot} " \
-               "rootfstype=${mmcrootfstype}\0" \
+               "root=${mmcroot}\0" \
        "loadbootscript="  \
                "fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${script};\0" \
        "bootscript=echo Running bootscript from mmc ...; "     \
                "source\0" \
        "loaduimage=fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${uimage}\0" \
+       "loadfdt=fatload mmc ${mmcdev}:${mmcpart} ${fdt_addr} ${fdt_file}\0" \
        "mmcboot=echo Booting from mmc ...; " \
-               "run mmcargs; " \
-               "bootm\0" \
+               "run mmcargs; " \
+               "if test ${boot_fdt} = yes || test ${boot_fdt} = try; then " \
+                       "if run loadfdt; then " \
+                               "bootm ${loadaddr} - ${fdt_addr}; " \
+                       "else " \
+                               "if test ${boot_fdt} = try; then " \
+                                       "bootm; " \
+                               "else " \
+                                       "echo WARN: Cannot load the DT; " \
+                               "fi; " \
+                       "fi; " \
+               "else " \
+                       "bootm; " \
+               "fi;\0" \
        "netargs=setenv bootargs console=${console_mainline},${baudrate} " \
                "root=/dev/nfs " \
                "ip=dhcp nfsroot=${serverip}:${nfsroot},v3,tcp\0" \
        "netboot=echo Booting from net ...; " \
                "run netargs; " \
-               "dhcp ${uimage}; bootm\0"
+               "if test ${ip_dyn} = yes; then " \
+                       "setenv get_cmd dhcp; " \
+               "else " \
+                       "setenv get_cmd tftp; " \
+               "fi; " \
+               "${get_cmd} ${uimage}; " \
+               "if test ${boot_fdt} = yes; then " \
+                       "if ${get_cmd} ${fdt_addr} ${fdt_file}; then " \
+                               "bootm ${loadaddr} - ${fdt_addr}; " \
+                       "else " \
+                               "if test ${boot_fdt} = try; then " \
+                                       "bootm; " \
+                               "else " \
+                                       "echo WARN: Cannot load the DT; " \
+                               "fi;" \
+                       "fi; " \
+               "else " \
+                       "bootm; " \
+               "fi;\0"
 
 #define CONFIG_BOOTCOMMAND \
        "mmc dev ${mmcdev}; if mmc rescan; then " \
index 3b86c9ebf356562f401c7c22efe38bc7fd850d5a..34e429577e0a80504dc386523f4bb26253179d25 100644 (file)
@@ -61,6 +61,7 @@
 #define CONFIG_MXC_UART
 #define CONFIG_MXC_UART_BASE   UART1_BASE
 #define CONFIG_HW_WATCHDOG
+#define CONFIG_IMX_WATCHDOG
 #define CONFIG_MXC_GPIO
 
 #define CONFIG_HARD_SPI
 
 #define CONFIG_BOARD_LATE_INIT
 
-#define CONFIG_BOOTDELAY       3
+#define CONFIG_BOOTDELAY       1
 
 #define        CONFIG_EXTRA_ENV_SETTINGS                                       \
        "bootargs_base=setenv bootargs console=ttymxc0,115200\0"        \
index 342d53fee0b9363901161353496669ded74aa30c..0db92a7803ee7458b46b8a4f20fac676b79e875f 100644 (file)
@@ -68,6 +68,7 @@
 #define CONFIG_POWER
 #define CONFIG_POWER_I2C
 #define CONFIG_POWER_FSL
+#define CONFIG_PMIC_FSL_MC13892
 #define CONFIG_SYS_FSL_PMIC_I2C_ADDR   0x08
 #define CONFIG_RTC_MC13XXX
 
@@ -94,6 +95,8 @@
 
 #include <config_cmd_default.h>
 
+#define CONFIG_OF_LIBFDT
+#define CONFIG_CMD_BOOTZ
 #define CONFIG_CMD_PING
 #define CONFIG_CMD_DHCP
 #define CONFIG_BOOTP_SUBNETMASK
 #define CONFIG_NET_RETRY_COUNT 100
 #define CONFIG_CMD_DATE
 
+#define CONFIG_CMD_USB
+#define CONFIG_USB_STORAGE
 #define CONFIG_CMD_MMC
 #define CONFIG_DOS_PARTITION
 #define CONFIG_EFI_PARTITION
 #define CONFIG_CMD_EXT2
 #define CONFIG_CMD_FAT
 
-#define CONFIG_BOOTDELAY       3
+#define CONFIG_BOOTDELAY       1
 
 #define CONFIG_LOADADDR                0x80800000      /* loadaddr env var */
 
 #define CONFIG_MXC_NAND_HWECC
 #define CONFIG_SYS_NAND_LARGEPAGE
 
+/* EHCI driver */
+#define CONFIG_USB_EHCI
+#define CONFIG_SYS_USB_EHCI_MAX_ROOT_PORTS     1
+#define CONFIG_EHCI_IS_TDI
+#define CONFIG_EHCI_HCD_INIT_AFTER_RESET
+#define CONFIG_USB_EHCI_MXC
+#define CONFIG_MXC_USB_PORT    0
+#define CONFIG_MXC_USB_FLAGS   (MXC_EHCI_INTERFACE_DIFF_UNI | \
+                                MXC_EHCI_POWER_PINS_ENABLED | \
+                                MXC_EHCI_OC_PIN_ACTIVE_LOW)
+#define CONFIG_MXC_USB_PORTSC  (MXC_EHCI_UTMI_16BIT | MXC_EHCI_MODE_UTMI)
+
 /* mmc driver */
 #define CONFIG_MMC
 #define CONFIG_GENERIC_MMC
index 3c1c056fe31887bbe7bad40259b81f6a54943842..a74a0a71f199ea61b0c859cedef8c9d5c41c5d54 100644 (file)
 
 #define CONFIG_SYS_DDR_CLKSEL          0
 #define CONFIG_SYS_CLKTL_CBCDR         0x59E35145
+#define CONFIG_SYS_MAIN_PWR_ON
 
 #endif
index f00cec2809612da064968ed893c9a7cf6aae7be7..cb3d93890c2e4a7535c4be7ce86eb33c30a50b97 100644 (file)
 #define CONFIG_SYS_TEXT_BASE   0x97800000
 
 #include <asm/arch/imx-regs.h>
-/*
- * Disabled for now due to build problems under Debian and a significant
- * increase in the final file size: 144260 vs. 109536 Bytes.
- */
 
 #define CONFIG_CMDLINE_TAG                     /* enable passing of ATAGs */
 #define CONFIG_SETUP_MEMORY_TAGS
  ***********************************************************/
 
 #include <config_cmd_default.h>
-
+#define CONFIG_CMD_BOOTZ
 #undef CONFIG_CMD_IMLS
 
 #define CONFIG_CMD_DATE
 
-#define CONFIG_BOOTDELAY       3
+#define CONFIG_BOOTDELAY       1
 
 #define CONFIG_ETHPRIME                "FEC0"
 
 
 #define CONFIG_SYS_DDR_CLKSEL  0
 #define CONFIG_SYS_CLKTL_CBCDR 0x59E35100
+#define CONFIG_SYS_MAIN_PWR_ON
 
 /*-----------------------------------------------------------------------
  * FLASH and environment organization
index 1916b85e2837f06760cf32cf03a310d549e54aed..a0af3eeb26f2783b64b6eca380e0c6894170be77 100644 (file)
@@ -59,6 +59,7 @@
 #define CONFIG_POWER_I2C
 #define CONFIG_POWER_FSL
 #define CONFIG_SYS_FSL_PMIC_I2C_ADDR    8
+#define CONFIG_PMIC_FSL_MC13892
 #define CONFIG_RTC_MC13XXX
 
 /* MMC Configs */
index a1101762e382624d9a73dcb283a93b25be8f2ea2..a4b610f9b7647997c4b11d5c09c93d457ec09164 100644 (file)
@@ -39,6 +39,7 @@
 #define CONFIG_SYS_MALLOC_LEN          (10 * 1024 * 1024)
 
 #define CONFIG_BOARD_EARLY_INIT_F
+#define CONFIG_BOARD_LATE_INIT
 #define CONFIG_MXC_GPIO
 #define CONFIG_REVISION_TAG
 
@@ -93,6 +94,7 @@
 #define CONFIG_POWER_I2C
 #define CONFIG_DIALOG_POWER
 #define CONFIG_POWER_FSL
+#define CONFIG_PMIC_FSL_MC13892
 #define CONFIG_SYS_DIALOG_PMIC_I2C_ADDR        0x48
 #define CONFIG_SYS_FSL_PMIC_I2C_ADDR   0x8
 
 
 /* Command definition */
 #include <config_cmd_default.h>
+#define CONFIG_CMD_BOOTZ
 
 #undef CONFIG_CMD_IMLS
 
-#define CONFIG_BOOTDELAY       3
+#define CONFIG_BOOTDELAY       1
 
 #define CONFIG_ETHPRIME                "FEC0"
 
-#define CONFIG_LOADADDR                0x70800000      /* loadaddr env var */
+#define CONFIG_LOADADDR                0x72000000      /* loadaddr env var */
 #define CONFIG_SYS_TEXT_BASE    0x77800000
 
 #define CONFIG_EXTRA_ENV_SETTINGS \
        "script=boot.scr\0" \
        "uimage=uImage\0" \
+       "fdt_file=imx53-qsb.dtb\0" \
+       "fdt_addr=0x71000000\0" \
+       "boot_fdt=try\0" \
+       "ip_dyn=yes\0" \
        "mmcdev=0\0" \
        "mmcpart=2\0" \
-       "mmcroot=/dev/mmcblk0p3 rw\0" \
-       "mmcrootfstype=ext3 rootwait\0" \
-       "mmcargs=setenv bootargs console=ttymxc0,${baudrate} " \
-               "root=${mmcroot} " \
-               "rootfstype=${mmcrootfstype}\0" \
+       "mmcroot=/dev/mmcblk0p3 rw rootwait\0" \
+       "mmcargs=setenv bootargs console=ttymxc0,${baudrate} root=${mmcroot}\0" \
        "loadbootscript=" \
                "fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${script};\0" \
        "bootscript=echo Running bootscript from mmc ...; " \
                "source\0" \
        "loaduimage=fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${uimage}\0" \
+       "loadfdt=fatload mmc ${mmcdev}:${mmcpart} ${fdt_addr} ${fdt_file}\0" \
        "mmcboot=echo Booting from mmc ...; " \
                "run mmcargs; " \
-               "bootm\0" \
+               "if test ${boot_fdt} = yes || test ${boot_fdt} = try; then " \
+                       "if run loadfdt; then " \
+                               "bootm ${loadaddr} - ${fdt_addr}; " \
+                       "else " \
+                               "if test ${boot_fdt} = try; then " \
+                                       "bootm; " \
+                               "else " \
+                                       "echo WARN: Cannot load the DT; " \
+                               "fi; " \
+                       "fi; " \
+               "else " \
+                       "bootm; " \
+               "fi;\0" \
        "netargs=setenv bootargs console=ttymxc0,${baudrate} " \
                "root=/dev/nfs " \
                "ip=dhcp nfsroot=${serverip}:${nfsroot},v3,tcp\0" \
        "netboot=echo Booting from net ...; " \
                "run netargs; " \
-               "dhcp ${uimage}; bootm\0" \
+               "if test ${ip_dyn} = yes; then " \
+                       "setenv get_cmd dhcp; " \
+               "else " \
+                       "setenv get_cmd tftp; " \
+               "fi; " \
+               "${get_cmd} ${uimage}; " \
+               "if test ${boot_fdt} = yes ||  test ${boot_fdt} = try; then " \
+                       "if ${get_cmd} ${fdt_addr} ${fdt_file}; then " \
+                               "bootm ${loadaddr} - ${fdt_addr}; " \
+                       "else " \
+                               "if test ${boot_fdt} = try; then " \
+                                       "bootm; " \
+                               "else " \
+                                       "echo ERROR: Cannot load the DT; " \
+                                       "exit; " \
+                               "fi; " \
+                       "fi; " \
+               "else " \
+                       "bootm; " \
+               "fi;\0"
 
 #define CONFIG_BOOTCOMMAND \
        "mmc dev ${mmcdev}; if mmc rescan; then " \
 #define CONFIG_SYS_HUSH_PARSER         /* use "hush" command parser */
 #define CONFIG_SYS_PROMPT              "MX53LOCO U-Boot > "
 #define CONFIG_AUTO_COMPLETE
-#define CONFIG_SYS_CBSIZE              256     /* Console I/O Buffer Size */
+#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)
index 28a3deb53e11688678d6428d6f57c7c9d591b672..138e4601807db08ec7231ca54c1b70c882ec678f 100644 (file)
@@ -22,6 +22,7 @@
 #ifndef __CONFIG_H
 #define __CONFIG_H
 
+#define CONFIG_MX6
 #define CONFIG_MX6Q
 #define CONFIG_DISPLAY_CPUINFO
 #define CONFIG_DISPLAY_BOARDINFO
index a5c93d0af56a57dac1ebc63305db8c158f1199ad..cda4512905cdb9baa6f6b6dc6d8109ec00721f8e 100644 (file)
@@ -17,6 +17,7 @@
 #ifndef __MX6QSABRE_COMMON_CONFIG_H
 #define __MX6QSABRE_COMMON_CONFIG_H
 
+#define CONFIG_MX6
 #define CONFIG_MX6Q
 #define CONFIG_DISPLAY_CPUINFO
 #define CONFIG_DISPLAY_BOARDINFO
@@ -40,7 +41,6 @@
 #define CONFIG_FSL_ESDHC
 #define CONFIG_FSL_USDHC
 #define CONFIG_SYS_FSL_ESDHC_ADDR      0
-#define CONFIG_SYS_FSL_USDHC_NUM       2
 
 #define CONFIG_MMC
 #define CONFIG_CMD_MMC
 /* Command definition */
 #include <config_cmd_default.h>
 
+#define CONFIG_CMD_BOOTZ
 #undef CONFIG_CMD_IMLS
 
-#define CONFIG_BOOTDELAY               3
+#define CONFIG_BOOTDELAY               1
 
-#define CONFIG_LOADADDR                        0x10800000
+#define CONFIG_LOADADDR                        0x12000000
 #define CONFIG_SYS_TEXT_BASE           0x17800000
 
 #define CONFIG_EXTRA_ENV_SETTINGS \
        "script=boot.scr\0" \
        "uimage=uImage\0" \
+       "fdt_file=" CONFIG_DEFAULT_FDT_FILE "\0" \
+       "fdt_addr=0x11000000\0" \
+       "boot_fdt=try\0" \
+       "ip_dyn=yes\0" \
        "console=" CONFIG_CONSOLE_DEV "\0" \
        "fdt_high=0xffffffff\0"   \
        "initrd_high=0xffffffff\0" \
-       "mmcdev=0\0" \
+       "mmcdev=" __stringify(CONFIG_SYS_MMC_ENV_DEV) "\0" \
        "mmcpart=1\0" \
        "mmcroot=" CONFIG_MMCROOT " rootwait rw\0" \
        "mmcargs=setenv bootargs console=${console},${baudrate} " \
        "bootscript=echo Running bootscript from mmc ...; " \
                "source\0" \
        "loaduimage=fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${uimage}\0" \
-               "mmcboot=echo Booting from mmc ...; " \
+       "loadfdt=fatload mmc ${mmcdev}:${mmcpart} ${fdt_addr} ${fdt_file}\0" \
+       "mmcboot=echo Booting from mmc ...; " \
                "run mmcargs; " \
-               "bootm\0" \
+               "if test ${boot_fdt} = yes || test ${boot_fdt} = try; then " \
+                       "if run loadfdt; then " \
+                               "bootm ${loadaddr} - ${fdt_addr}; " \
+                       "else " \
+                               "if test ${boot_fdt} = try; then " \
+                                       "bootm; " \
+                               "else " \
+                                       "echo WARN: Cannot load the DT; " \
+                               "fi; " \
+                       "fi; " \
+               "else " \
+                       "bootm; " \
+               "fi;\0" \
        "netargs=setenv bootargs console=${console},${baudrate} " \
                "root=/dev/nfs " \
                "ip=dhcp nfsroot=${serverip}:${nfsroot},v3,tcp\0" \
        "netboot=echo Booting from net ...; " \
                "run netargs; " \
-               "dhcp ${uimage}; bootm\0" \
+               "if test ${ip_dyn} = yes; then " \
+                       "setenv get_cmd dhcp; " \
+               "else " \
+                       "setenv get_cmd tftp; " \
+               "fi; " \
+               "${get_cmd} ${uimage}; " \
+               "if test ${boot_fdt} = yes || test ${boot_fdt} = try; then " \
+                       "if ${get_cmd} ${fdt_addr} ${fdt_file}; then " \
+                               "bootm ${loadaddr} - ${fdt_addr}; " \
+                       "else " \
+                               "if test ${boot_fdt} = try; then " \
+                                       "bootm; " \
+                               "else " \
+                                       "echo WARN: Cannot load the DT; " \
+                               "fi; " \
+                       "fi; " \
+               "else " \
+                       "bootm; " \
+               "fi;\0"
 
 #define CONFIG_BOOTCOMMAND \
        "mmc dev ${mmcdev};" \
 
 #if defined(CONFIG_ENV_IS_IN_MMC)
 #define CONFIG_ENV_OFFSET              (6 * 64 * 1024)
-#define CONFIG_SYS_MMC_ENV_DEV         0
 #endif
 
 #define CONFIG_OF_LIBFDT
index 760f3ce0c9a3810d790c541a4f647e5a7fb2d0cf..f4a082aeaaa3f773c5b6d6374dd90f02a05fa594 100644 (file)
 #define CONFIG_MACH_TYPE       3529
 #define CONFIG_MXC_UART_BASE   UART4_BASE
 #define CONFIG_CONSOLE_DEV             "ttymxc3"
+#define CONFIG_DEFAULT_FDT_FILE        "imx6q-sabreauto.dtb"
 #define CONFIG_MMCROOT                 "/dev/mmcblk0p2"
 #define PHYS_SDRAM_SIZE                (2u * 1024 * 1024 * 1024)
 
 #include "mx6qsabre_common.h"
 
+#define CONFIG_SYS_FSL_USDHC_NUM       2
+#if defined(CONFIG_ENV_IS_IN_MMC)
+#define CONFIG_SYS_MMC_ENV_DEV         0
+#endif
+
 #endif                         /* __MX6QSABREAUTO_CONFIG_H */
index a28d5a50c127a8067e0579a0435ce1567572c68e..752f0981d2c61f948790678d7941051ffd57f48b 100644 (file)
@@ -22,6 +22,7 @@
 #ifndef __CONFIG_H
 #define __CONFIG_H
 
+#define CONFIG_MX6
 #define CONFIG_MX6Q
 #define CONFIG_DISPLAY_CPUINFO
 #define CONFIG_DISPLAY_BOARDINFO
 
 #undef CONFIG_CMD_IMLS
 
-#define CONFIG_BOOTDELAY              3
+#define CONFIG_BOOTDELAY              1
 
 #define CONFIG_PREBOOT                 ""
 
-#define CONFIG_LOADADDR                               0x10800000
+#define CONFIG_LOADADDR                               0x12000000
 #define CONFIG_SYS_TEXT_BASE          0x17800000
 
 #define CONFIG_EXTRA_ENV_SETTINGS \
-       "script=boot.scr\0" \
-       "uimage=uImage\0" \
+       "script=boot.scr\0" \
+       "uimage=uImage\0" \
        "console=ttymxc1\0" \
-       "fdt_high=0xffffffff\0"   \
+       "fdt_high=0xffffffff\0" \
        "initrd_high=0xffffffff\0" \
-       "mmcdev=0\0" \
-       "mmcpart=2\0" \
-       "mmcroot=/dev/mmcblk0p3 rootwait rw\0" \
-       "mmcargs=setenv bootargs console=${console},${baudrate} " \
-              "root=${mmcroot}\0" \
-       "loadbootscript=" \
-              "fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${script};\0" \
-       "bootscript=echo Running bootscript from mmc ...; " \
-              "source\0" \
-       "loaduimage=fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${uimage}\0" \
-       "mmcboot=echo Booting from mmc ...; " \
-              "run mmcargs; " \
-              "bootm\0" \
-       "netargs=setenv bootargs console=${console},${baudrate} " \
-              "root=/dev/nfs " \
-              "ip=dhcp nfsroot=${serverip}:${nfsroot},v3,tcp\0" \
-       "netboot=echo Booting from net ...; " \
-              "run netargs; " \
-              "dhcp ${uimage}; bootm\0" \
+       "fdt_file=imx6q-sabrelite.dtb\0" \
+       "fdt_addr=0x11000000\0" \
+       "boot_fdt=try\0" \
+       "ip_dyn=yes\0" \
+       "mmcdev=0\0" \
+       "mmcpart=2\0" \
+       "mmcroot=/dev/mmcblk0p3 rootwait rw\0" \
+       "mmcargs=setenv bootargs console=${console},${baudrate} " \
+               "root=${mmcroot}\0" \
+       "loadbootscript=" \
+               "fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${script};\0" \
+       "bootscript=echo Running bootscript from mmc ...; " \
+               "source\0" \
+       "loaduimage=fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${uimage}\0" \
+       "loadfdt=fatload mmc ${mmcdev}:${mmcpart} ${fdt_addr} ${fdt_file}\0" \
+       "mmcboot=echo Booting from mmc ...; " \
+               "run mmcargs; " \
+               "if test ${boot_fdt} = yes || test ${boot_fdt} = try; then " \
+                       "if run loadfdt; then " \
+                               "bootm ${loadaddr} - ${fdt_addr}; " \
+                       "else " \
+                               "if test ${boot_fdt} = try; then " \
+                                       "bootm; " \
+                               "else " \
+                                       "echo WARN: Cannot load the DT; " \
+                               "fi; " \
+                       "fi; " \
+               "else " \
+                       "bootm; " \
+               "fi;\0" \
+       "netargs=setenv bootargs console=${console},${baudrate} " \
+               "root=/dev/nfs " \
+       "ip=dhcp nfsroot=${serverip}:${nfsroot},v3,tcp\0" \
+               "netboot=echo Booting from net ...; " \
+               "run netargs; " \
+               "if test ${ip_dyn} = yes; then " \
+                       "setenv get_cmd dhcp; " \
+               "else " \
+                       "setenv get_cmd tftp; " \
+               "fi; " \
+               "${get_cmd} ${uimage}; " \
+               "if test ${boot_fdt} = yes || test ${boot_fdt} = try; then " \
+                       "if ${get_cmd} ${fdt_addr} ${fdt_file}; then " \
+                               "bootm ${loadaddr} - ${fdt_addr}; " \
+                       "else " \
+                               "if test ${boot_fdt} = try; then " \
+                                       "bootm; " \
+                               "else " \
+                                       "echo WARN: Cannot load the DT; " \
+                               "fi; " \
+                       "fi; " \
+               "else " \
+                       "bootm; " \
+               "fi;\0"
 
 #define CONFIG_BOOTCOMMAND \
-       "mmc dev ${mmcdev};" \
-       "mmc dev ${mmcdev}; if mmc rescan; then " \
-              "if run loadbootscript; then " \
-                      "run bootscript; " \
-              "else " \
-                      "if run loaduimage; then " \
-                              "run mmcboot; " \
-                      "else run netboot; " \
-                      "fi; " \
-              "fi; " \
-       "else run netboot; fi"
+          "mmc dev ${mmcdev};" \
+          "mmc dev ${mmcdev}; if mmc rescan; then " \
+                  "if run loadbootscript; then " \
+                          "run bootscript; " \
+                  "else " \
+                          "if run loaduimage; then " \
+                                  "run mmcboot; " \
+                          "else run netboot; " \
+                          "fi; " \
+                  "fi; " \
+          "else run netboot; fi"
 
 #define CONFIG_ARP_TIMEOUT     200UL
 
index 771d1297f7a33863a57129861372d15ce000b49b..3b8d752eed86d20c04da31c82de36c812bc4498c 100644 (file)
 #define CONFIG_MXC_UART_BASE   UART1_BASE
 #define CONFIG_CONSOLE_DEV             "ttymxc0"
 #define CONFIG_MMCROOT                 "/dev/mmcblk1p2"
+#define CONFIG_DEFAULT_FDT_FILE        "imx6q-sabresd.dtb"
 #define PHYS_SDRAM_SIZE                (1u * 1024 * 1024 * 1024)
 
 #include "mx6qsabre_common.h"
 
+#define CONFIG_SYS_FSL_USDHC_NUM       3
+#if defined(CONFIG_ENV_IS_IN_MMC)
+#define CONFIG_SYS_MMC_ENV_DEV         1       /* SDHC3 */
+#define CONFIG_SYS_MMC_ENV_PART                1       /* Boot partition 1 */
+#endif
+
 #endif                         /* __MX6QSABRESD_CONFIG_H */
index 12d65f2c4e7d344c1ab6fe4387aed6a6903f846b..d0daa455e5243ccbf616c4352a12e414319fe2ca 100644 (file)
                "else run userbutton_nonxm; fi;\0" \
        "userbutton_xm=gpio input 4;\0" \
        "userbutton_nonxm=gpio input 7;\0"
-/* "run userbutton" will return 1 (false) if is pressed and 0 (false) if not */
+/* "run userbutton" will return 1 (false) if pressed and 0 (true) if not */
 #define CONFIG_BOOTCOMMAND \
        "mmc dev ${mmcdev}; if mmc rescan; then " \
                "if run userbutton; then " \
index 67af314652a7ef742f9a2d5a6baa3a9ed65b7f39..09a0b2f719203a372009d596edcdd4468a539b65 100644 (file)
  */
 #define CONFIG_NR_DRAM_BANKS   1
 #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
 
 #define CONFIG_ENV_IS_NOWHERE  1
index 8a8a5d1cc03dc2ce75a9fc7a7e5895958cf042cc..217f306c0198374d649e109c7d8d4f491e362130 100644 (file)
  */
 #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
 
 #define CONFIG_SYS_TEXT_BASE           0x80008000
index 2a890c9c7e8c81e24681974598cec1b8f554fbb2..b02ec850b7d3a23e772ce3cc7264d61eff0a9d7f 100644 (file)
  */
 #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 meg */
 #define PHYS_SDRAM_2           OMAP34XX_SDRC_CS1
 
 /*--------------------------------------------------------------------------*/
index e152055a64ed2fc2e63f1256a4719539f8285066..ee4cbd75c1bb77236babe59778c97015842ce4db 100644 (file)
  */
 #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
 
 /*-----------------------------------------------------------------------
index d6814248ed18e831d8e998910f9b0b21b439e2fe..a6b48a80ce42c58f8f2ffcd79bbcc7bf84c27f67 100644 (file)
  */
 #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
 
 /*-----------------------------------------------------------------------
index c5dd494059e2ff922b300cf4e07169b1bc782735..3f9802ca0f52eb9613bbc52ab1ab41a3bef423a8 100644 (file)
@@ -28,6 +28,9 @@
 #define        CONFIG_CPU_PXA27X               1       /* Marvell PXA270 CPU */
 #define        CONFIG_PALMLD           1       /* Palm LifeDrive board */
 
+/* we will never enable dcache, because we have to setup MMU first */
+#define CONFIG_SYS_DCACHE_OFF
+
 /*
  * Environment settings
  */
index 9c948c547355075935c56e64d4dc25dca130d4df..64771e7e8d8967fa22f893e4bc34077e53130f8d 100644 (file)
@@ -30,6 +30,9 @@
 #define        CONFIG_CPU_PXA25X                       1       /* Intel PXA255 CPU */
 #define        CONFIG_PALMTC                   1       /* Palm Tungsten|C board */
 
+/* we will never enable dcache, because we have to setup MMU first */
+#define CONFIG_SYS_DCACHE_OFF
+
 /*
  * Environment settings
  */
index 5603de9625330c1abbf73b1b21f4620c50597cfe..38c79cfc2b58a00383d4b19c9ba127492df969cf 100644 (file)
 
 #define CONFIG_DOS_PARTITION
 #define CONFIG_EFI_PARTITION
+#define CONFIG_FS_EXT4
+#define CONFIG_FS_FAT
 #define CONFIG_CMD_EXT2
 #define CONFIG_CMD_FAT
+#define CONFIG_CMD_FS_GENERIC
 
 /* Environment in eMMC, at the end of 2nd "boot sector" */
 #define CONFIG_ENV_IS_IN_MMC
index d9bf2010b833ec81c4011a541b9d50916a5981d5..685c618c346c89609e207ff4f3f1746a217098b7 100644 (file)
@@ -52,6 +52,7 @@
 
 #define CONFIG_MXC_GPIO
 #define CONFIG_HW_WATCHDOG
+#define CONFIG_IMX_WATCHDOG
 
 #define CONFIG_MXC_SPI
 #define CONFIG_DEFAULT_SPI_BUS 1
index 894f38bd7db05804f09c6edb046dbe5cb8234e63..eb13bb3a671c0461419880ca291e95191d18b64c 100644 (file)
@@ -34,6 +34,7 @@
 #define CONFIG_S5P             1       /* which is in a S5P Family */
 #define CONFIG_EXYNOS4210      1       /* which is in a EXYNOS4210 */
 #define CONFIG_UNIVERSAL       1       /* working with Universal */
+#define CONFIG_TIZEN           1       /* TIZEN lib */
 
 #include <asm/arch/cpu.h>              /* get chip and board defs */
 
@@ -56,6 +57,8 @@
 #define CONFIG_INITRD_TAG
 #define CONFIG_REVISION_TAG
 #define CONFIG_CMDLINE_EDITING
+#define CONFIG_SKIP_LOWLEVEL_INIT
+#define CONFIG_BOARD_EARLY_INIT_F
 
 /* Size of malloc() pool */
 #define CONFIG_SYS_MALLOC_LEN          (CONFIG_ENV_SIZE + (1 << 20))
 #define CONFIG_USB_GADGET_S3C_UDC_OTG
 #define CONFIG_USB_GADGET_DUALSPEED
 
+/*
+ * SPI Settings
+ */
+#define CONFIG_SOFT_SPI
+#define CONFIG_SOFT_SPI_MODE SPI_MODE_3
+#define CONFIG_SOFT_SPI_GPIO_SCLK exynos4_gpio_part2_get_nr(y3, 1)
+#define CONFIG_SOFT_SPI_GPIO_MOSI exynos4_gpio_part2_get_nr(y3, 3)
+#define CONFIG_SOFT_SPI_GPIO_MISO exynos4_gpio_part2_get_nr(y3, 0)
+#define CONFIG_SOFT_SPI_GPIO_CS exynos4_gpio_part2_get_nr(y4, 3)
+
+#define SPI_DELAY udelay(1)
+#undef SPI_INIT
+#define SPI_SCL(bit) universal_spi_scl(bit)
+#define SPI_SDA(bit) universal_spi_sda(bit)
+#define SPI_READ universal_spi_read()
+#ifndef        __ASSEMBLY__
+void universal_spi_scl(int bit);
+void universal_spi_sda(int bit);
+int universal_spi_read(void);
+#endif
+
+/*
+ * LCD Settings
+ */
+#define CONFIG_EXYNOS_FB
+#define CONFIG_LCD
+#define CONFIG_CMD_BMP
+#define CONFIG_BMP_32BPP
+#define CONFIG_LD9040
+#define CONFIG_EXYNOS_MIPI_DSIM
+#define CONFIG_VIDEO_BMP_GZIP
+#define CONFIG_SYS_VIDEO_LOGO_MAX_SIZE ((520 * 120 * 4) + (1 << 12))
+
 #endif /* __CONFIG_H */
index ab10bd0abc7e57a24e2115eb3fd3698899016dd6..de0c777819b2b4a41d18dbd3188a611df2390306 100644 (file)
@@ -54,6 +54,7 @@
 #define CONFIG_MACH_TYPE               MACH_TYPE_SEABOARD
 
 #define CONFIG_BOARD_EARLY_INIT_F
+#define CONFIG_BOARD_LATE_INIT         /* Make sure LCD init is complete */
 
 /* I2C */
 #define CONFIG_TEGRA_I2C
 
 #define CONFIG_DOS_PARTITION
 #define CONFIG_EFI_PARTITION
+#define CONFIG_FS_EXT4
+#define CONFIG_FS_FAT
 #define CONFIG_CMD_EXT2
 #define CONFIG_CMD_FAT
+#define CONFIG_CMD_FS_GENERIC
 
 /* Environment in eMMC, at the end of 2nd "boot sector" */
 #define CONFIG_ENV_IS_IN_MMC
 /* USB keyboard */
 #define CONFIG_USB_KEYBOARD
 
-#include "tegra-common-post.h"
+/* LCD support */
+#define CONFIG_LCD
+#define CONFIG_PWM_TEGRA
+#define CONFIG_VIDEO_TEGRA
+#define LCD_BPP                                LCD_COLOR16
+#define CONFIG_SYS_WHITE_ON_BLACK
+#define CONFIG_CONSOLE_SCROLL_LINES    10
 
 /* NAND support */
 #define CONFIG_CMD_NAND
 /* Max number of NAND devices */
 #define CONFIG_SYS_MAX_NAND_DEVICE     1
 
-/* Somewhat oddly, the NAND base address must be a config option */
-#define CONFIG_SYS_NAND_BASE   NV_PA_NAND_BASE
+#include "tegra-common-post.h"
+
 #endif /* __CONFIG_H */
diff --git a/include/configs/sh7752evb.h b/include/configs/sh7752evb.h
new file mode 100644 (file)
index 0000000..bf6bd4d
--- /dev/null
@@ -0,0 +1,153 @@
+/*
+ * Configuation settings for the sh7752evb board
+ *
+ * Copyright (C) 2012 Renesas Solutions Corp.
+ *
+ * See file CREDITS for 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 __SH7752EVB_H
+#define __SH7752EVB_H
+
+#undef DEBUG
+#define CONFIG_SH              1
+#define CONFIG_SH4A            1
+#define CONFIG_SH_32BIT                1
+#define CONFIG_CPU_SH7752      1
+#define CONFIG_SH7752EVB       1
+
+#define CONFIG_SYS_TEXT_BASE   0x5ff80000
+#define CONFIG_SYS_LDSCRIPT    "board/renesas/sh7752evb/u-boot.lds"
+
+#define CONFIG_CMD_MEMORY
+#define CONFIG_CMD_NET
+#define CONFIG_CMD_MII
+#define CONFIG_CMD_PING
+#define CONFIG_CMD_NFS
+#define CONFIG_CMD_DFL
+#define CONFIG_CMD_SDRAM
+#define CONFIG_CMD_SF
+#define CONFIG_CMD_RUN
+#define CONFIG_CMD_SAVEENV
+#define CONFIG_CMD_MD5SUM
+#define CONFIG_MD5
+#define CONFIG_CMD_LOADS
+#define CONFIG_CMD_MMC
+#define CONFIG_CMD_EXT2
+#define CONFIG_DOS_PARTITION
+#define CONFIG_MAC_PARTITION
+
+#define CONFIG_BAUDRATE                115200
+#define CONFIG_BOOTDELAY       3
+#define CONFIG_BOOTARGS                "console=ttySC2,115200 root=/dev/nfs ip=dhcp"
+
+#define CONFIG_VERSION_VARIABLE
+#undef CONFIG_SHOW_BOOT_PROGRESS
+#define CONFIG_CMDLINE_EDITING
+#define CONFIG_AUTO_COMPLETE
+
+/* MEMORY */
+#define SH7752EVB_SDRAM_BASE           (0x40000000)
+#define SH7752EVB_SDRAM_SIZE           (512 * 1024 * 1024)
+
+#define CONFIG_SYS_LONGHELP
+#define CONFIG_SYS_PROMPT              "=> "
+#define CONFIG_SYS_CBSIZE              256
+#define CONFIG_SYS_PBSIZE              256
+#define CONFIG_SYS_MAXARGS             16
+#define CONFIG_SYS_BARGSIZE            512
+#define CONFIG_SYS_BAUDRATE_TABLE      { 115200 }
+
+/* SCIF */
+#define CONFIG_SCIF_CONSOLE    1
+#define CONFIG_CONS_SCIF2      1
+#undef CONFIG_SYS_CONSOLE_INFO_QUIET
+#undef CONFIG_SYS_CONSOLE_OVERWRITE_ROUTINE
+#undef CONFIG_SYS_CONSOLE_ENV_OVERWRITE
+
+#define CONFIG_SYS_MEMTEST_START       (SH7752EVB_SDRAM_BASE)
+#define CONFIG_SYS_MEMTEST_END         (CONFIG_SYS_MEMTEST_START + \
+                                        480 * 1024 * 1024)
+#undef CONFIG_SYS_ALT_MEMTEST
+#undef CONFIG_SYS_MEMTEST_SCRATCH
+#undef CONFIG_SYS_LOADS_BAUD_CHANGE
+
+#define CONFIG_SYS_SDRAM_BASE          (SH7752EVB_SDRAM_BASE)
+#define CONFIG_SYS_SDRAM_SIZE          (SH7752EVB_SDRAM_SIZE)
+#define CONFIG_SYS_LOAD_ADDR           (CONFIG_SYS_SDRAM_BASE + \
+                                        128 * 1024 * 1024)
+
+#define CONFIG_SYS_MONITOR_BASE                0x00000000
+#define CONFIG_SYS_MONITOR_LEN         (512 * 1024)
+#define CONFIG_SYS_MALLOC_LEN          (4 * 1024 * 1024)
+#define CONFIG_SYS_BOOTMAPSZ           (8 * 1024 * 1024)
+
+/* FLASH */
+#define CONFIG_SYS_NO_FLASH
+
+/* Ether */
+#define CONFIG_SH_ETHER                        1
+#define CONFIG_SH_ETHER_USE_PORT       0
+#define CONFIG_SH_ETHER_PHY_ADDR       18
+#define CONFIG_SH_ETHER_CACHE_WRITEBACK        1
+#define CONFIG_SH_ETHER_USE_GETHER     1
+#define CONFIG_PHYLIB
+#define CONFIG_BITBANGMII
+#define CONFIG_BITBANGMII_MULTI
+#define CONFIG_SH_ETHER_PHY_MODE PHY_INTERFACE_MODE_RGMII
+#define CONFIG_PHY_VITESSE
+
+#define SH7752EVB_ETHERNET_MAC_BASE_SPI        0x00090000
+#define SH7752EVB_SPI_SECTOR_SIZE      (64 * 1024)
+#define SH7752EVB_ETHERNET_MAC_BASE    SH7752EVB_ETHERNET_MAC_BASE_SPI
+#define SH7752EVB_ETHERNET_MAC_SIZE    17
+#define SH7752EVB_ETHERNET_NUM_CH      2
+#define CONFIG_BOARD_LATE_INIT
+
+/* SPI */
+#define CONFIG_SH_SPI                  1
+#define CONFIG_SH_SPI_BASE             0xfe002000
+#define CONFIG_SPI_FLASH
+#define CONFIG_SPI_FLASH_STMICRO       1
+#define CONFIG_SPI_FLASH_MACRONIX      1
+
+/* MMCIF */
+#define CONFIG_MMC                     1
+#define CONFIG_GENERIC_MMC             1
+#define CONFIG_SH_MMCIF                        1
+#define CONFIG_SH_MMCIF_ADDR           0xffcb0000
+#define CONFIG_SH_MMCIF_CLK            48000000
+
+/* ENV setting */
+#define CONFIG_ENV_IS_EMBEDDED
+#define CONFIG_ENV_IS_IN_SPI_FLASH
+#define CONFIG_ENV_SECT_SIZE   (64 * 1024)
+#define CONFIG_ENV_ADDR                (0x00080000)
+#define CONFIG_ENV_OFFSET      (CONFIG_ENV_ADDR)
+#define CONFIG_ENV_OVERWRITE   1
+#define CONFIG_ENV_SIZE                (CONFIG_ENV_SECT_SIZE)
+#define CONFIG_ENV_SIZE_REDUND (CONFIG_ENV_SECT_SIZE)
+#define CONFIG_EXTRA_ENV_SETTINGS                              \
+               "netboot=bootp; bootm\0"
+
+/* Board Clock */
+#define CONFIG_SYS_CLK_FREQ    48000000
+#define CONFIG_SYS_TMU_CLK_DIV 4
+#define CONFIG_SYS_HZ          1000
+#endif /* __SH7752EVB_H */
index 39a347af84afce85cffc03f0b5fe2f558079c318..81f83a8022bf8cec47ee3e8b2f7dc9c3eeef8c2e 100644 (file)
@@ -1,7 +1,7 @@
 /*
- * Copyright (C) 2011 Samsung Electronics
+ * Copyright (C) 2012 Samsung Electronics
  *
- * Configuration settings for the SAMSUNG SMDK5250 (EXYNOS5250) board.
+ * Configuration settings for the SAMSUNG SMDK5250 board.
  *
  * See file CREDITS for list of people who contributed to this
  * project.
  * MA 02111-1307 USA
  */
 
-#ifndef __CONFIG_H
-#define __CONFIG_H
+#ifndef __CONFIG_SMDK_H
+#define __CONFIG_SMDK_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 <configs/exynos5250-dt.h>
 
-#include <asm/arch/cpu.h>              /* get chip and board defs */
+#undef CONFIG_DEFAULT_DEVICE_TREE
+#define CONFIG_DEFAULT_DEVICE_TREE     exynos5250-smdk5250
 
-#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_SERIAL3                 /* use SERIAL 3 */
-#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_SDHCI
-#define CONFIG_S5P_SDHCI
-
-#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
-
-/* USB */
-#define CONFIG_CMD_USB
-#define CONFIG_USB_EHCI
-#define CONFIG_USB_EHCI_EXYNOS
-#define CONFIG_USB_STORAGE
-
-/* MMC SPL */
-#define CONFIG_SPL
-#define COPY_BL2_FNPTR_ADDR    0x02020030
-
-/* specific .lds file */
-#define CONFIG_SPL_LDSCRIPT    "board/samsung/smdk5250/smdk5250-uboot-spl.lds"
-#define CONFIG_SPL_TEXT_BASE   0x02023400
-#define CONFIG_SPL_MAX_SIZE    (14 * 1024)
-
-#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              "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
-
-#define CONFIG_RD_LVL
-
-#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)
-
-/* I2C */
-#define CONFIG_SYS_I2C_INIT_BOARD
-#define CONFIG_HARD_I2C
-#define CONFIG_CMD_I2C
-#define CONFIG_SYS_I2C_SPEED   100000          /* 100 Kbps */
-#define CONFIG_DRIVER_S3C24X0_I2C
-#define CONFIG_I2C_MULTI_BUS
-#define CONFIG_MAX_I2C_NUM     8
-#define CONFIG_SYS_I2C_SLAVE    0x0
-#define CONFIG_I2C_EDID
-
-/* 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
-
-/* SHA hashing */
-#define CONFIG_CMD_HASH
-#define CONFIG_HASH_VERIFY
-#define CONFIG_SHA1
-#define CONFIG_SHA256
-
-#endif /* __CONFIG_H */
+#endif /* __CONFIG_SMDK_H */
index 42077bd6fd4619a788369819062e377ff8cd3708..5633d2a4291a44a8c635e1da125e9d0c19fa17c5 100644 (file)
@@ -65,7 +65,7 @@
 #define CONFIG_SYS_BOOTMAPSZ           ((256*1024*1024) - (4*1024))
 
 #define CONFIG_SPL_RAM_DEVICE
-#define CONFIG_SPL_STACK (&__stack_start)
+#define CONFIG_SPL_STACK CONFIG_SYS_INIT_SP_ADDR
 #define CONFIG_SYS_SPL_MALLOC_START ((unsigned long) (&__malloc_start))
 #define CONFIG_SYS_SPL_MALLOC_SIZE (&__malloc_end - &__malloc_start)
 
index ee73c277b95ad955ea68abef4013cefdf9449b4a..9f1fb9feef8f9df717d3d130b32d0e866b86d729 100644 (file)
  */
 #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
 
 /*
  * I2C EEPROM
  */
 #if !(defined(__KERNEL_STRICT_NAMES) || defined(__ASSEMBLY__))
-
 /*
  * The I2C EEPROM on the TAM3517 contains
  * mac address and production data
@@ -384,24 +382,29 @@ struct tam3517_module_info {
        unsigned char _rev[100];
 };
 
-#define TAM3517_READ_MAC_FROM_EEPROM   \
-do {                                   \
-       struct tam3517_module_info info;\
-       char buf[80], ethname[20];      \
-       int i;                          \
+#define TAM3517_READ_EEPROM(info, ret) \
+do {                                                           \
        i2c_init(CONFIG_SYS_I2C_SPEED, CONFIG_SYS_I2C_SLAVE);   \
        if (eeprom_read(CONFIG_SYS_I2C_EEPROM_ADDR, 0,          \
-                       (void *)&info, sizeof(info)))           \
-               break;                                          \
+               (void *)info, sizeof(*info)))                   \
+               ret = 1;                                        \
+       else                                                    \
+               ret = 0;                                        \
+} while (0)
+
+#define TAM3517_READ_MAC_FROM_EEPROM(info)                     \
+do {                                                           \
+       char buf[80], ethname[20];                              \
+       int i;                                                  \
        memset(buf, 0, sizeof(buf));                            \
-       for (i = 0 ; i < ARRAY_SIZE(info.eth_addr); i++) {      \
+       for (i = 0 ; i < ARRAY_SIZE((info)->eth_addr); i++) {   \
                sprintf(buf, "%02X:%02X:%02X:%02X:%02X:%02X",   \
-                       info.eth_addr[i][5],                    \
-                       info.eth_addr[i][4],                    \
-                       info.eth_addr[i][3],                    \
-                       info.eth_addr[i][2],                    \
-                       info.eth_addr[i][1],                    \
-                       info.eth_addr[i][0]);                   \
+                       (info)->eth_addr[i][5],                 \
+                       (info)->eth_addr[i][4],                 \
+                       (info)->eth_addr[i][3],                 \
+                       (info)->eth_addr[i][2],                 \
+                       (info)->eth_addr[i][1],                 \
+                       (info)->eth_addr[i][0]);                        \
                                                                \
                if (i)                                          \
                        sprintf(ethname, "eth%daddr", i);       \
@@ -411,6 +414,30 @@ do {                                       \
                setenv(ethname, buf);                           \
        }                                                       \
 } while (0)
+
+/* The following macros are taken from Technexion's documentation */
+#define TAM3517_sequence_number(info) \
+       ((info)->sequence_number % 0x1000000000000LL)
+#define TAM3517_week_of_year(info) (((info)->sequence_number >> 48) % 0x100)
+#define TAM3517_year(info) ((info)->sequence_number >> 56)
+#define TAM3517_revision_fixed(info) ((info)->revision % 0x100)
+#define TAM3517_revision_major(info) (((info)->revision >> 8) % 0x100)
+#define TAM3517_revision_tn(info) ((info)->revision >> 16)
+
+#define TAM3517_PRINT_SOM_INFO(info)                           \
+do {                                                           \
+       printf("Vendor:%s\n", (info)->customer);                \
+       printf("SOM:   %s\n", (info)->product);                 \
+       printf("SeqNr: %02llu%02llu%012llu\n",                  \
+               TAM3517_year(info),                             \
+               TAM3517_week_of_year(info),                     \
+               TAM3517_sequence_number(info));                 \
+       printf("Rev:   TN%u %u.%u\n",                           \
+               TAM3517_revision_tn(info),                      \
+               TAM3517_revision_major(info),                   \
+               TAM3517_revision_fixed(info));                  \
+} while (0)
+
 #endif
 
 #endif /* __TAM3517_H */
index 140d2e66327c7c880d42356415c7b40c7620fbd7..200cf66647c02dcbdc331d28d2a838d197ea4721 100644 (file)
@@ -54,7 +54,6 @@
 #define CONFIG_CMD_NAND
 #define CONFIG_TEGRA_NAND
 #define CONFIG_SYS_MAX_NAND_DEVICE     1
-#define CONFIG_SYS_NAND_BASE           NV_PA_NAND_BASE
 
 /* Environment in NAND, aligned to start of last sector */
 #define CONFIG_ENV_IS_IN_NAND
index 6f310bee601328b3eab4e492e1c9cbe5b1a6ca80..ee40cc2a3e0e26a38d3ddf58bf5f74c01db5c190 100644 (file)
 
 #else
 
-#ifdef CONFIG_CMD_EXT2
-#define BOOT_FSTYPE_EXT2 "ext2 "
-#else
-#define BOOT_FSTYPE_EXT2 ""
-#endif
-
-#ifdef CONFIG_CMD_FAT
-#define BOOT_FSTYPE_FAT "fat"
-#else
-#define BOOT_FSTYPE_FAT ""
-#endif
-
 #ifdef CONFIG_CMD_MMC
 #define BOOTCMDS_MMC \
        "mmc_boot=" \
@@ -98,7 +86,7 @@
        "rootpart=1\0" \
        \
        "script_boot="                                                    \
-               "if ${fs}load ${devtype} ${devnum}:${rootpart} "          \
+               "if load ${devtype} ${devnum}:${rootpart} "               \
                                "${scriptaddr} ${prefix}${script}; then " \
                        "echo ${script} found! Executing ...;"            \
                        "source ${scriptaddr};"                           \
        \
        "scan_boot="                                                      \
                "echo Scanning ${devtype} ${devnum}...; "                 \
-               "for fs in ${boot_fstypes}; do "                          \
-                       "for prefix in ${boot_prefixes}; do "             \
-                               "for script in ${boot_scripts}; do "      \
-                                       "run script_boot; "               \
-                               "done; "                                  \
+               "for prefix in ${boot_prefixes}; do "                     \
+                       "for script in ${boot_scripts}; do "              \
+                               "run script_boot; "                       \
                        "done; "                                          \
                "done;\0"                                                 \
        \
                BOOT_TARGETS_DHCP " " \
                "\0" \
        \
-       "boot_fstypes=" \
-               BOOT_FSTYPE_EXT2 " " \
-               BOOT_FSTYPE_FAT " " \
-               "\0" \
-       \
        "boot_prefixes=/ /boot/\0" \
        \
        "boot_scripts=boot.scr.uimg boot.scr\0" \
 
 #define TEGRA_DEVICE_SETTINGS \
        "stdin=serial" STDIN_KBD_KBC STDIN_KBD_USB "\0" \
-       "stdout=serial\0" \
-       "stderr=serial\0" \
+       "stdout=serial,lcd\0" \
+       "stderr=serial,lcd\0" \
 
 #define CONFIG_EXTRA_ENV_SETTINGS \
        TEGRA_DEVICE_SETTINGS \
 #ifdef CONFIG_EFI_PARTITION
 #undef CONFIG_EFI_PARTITION
 #endif
+#ifdef CONFIG_CMD_FS_GENERIC
+#undef CONFIG_CMD_FS_GENERIC
+#endif
+#ifdef CONFIG_CMD_EXT4
+#undef CONFIG_CMD_EXT4
+#endif
 #ifdef CONFIG_CMD_EXT2
 #undef CONFIG_CMD_EXT2
 #endif
 #ifdef CONFIG_CMD_FAT
 #undef CONFIG_CMD_FAT
 #endif
+#ifdef CONFIG_FS_EXT4
+#undef CONFIG_FS_EXT4
+#endif
+#ifdef CONFIG_FS_FAT
+#undef CONFIG_FS_FAT
+#endif
 
 /* remove USB */
 #ifdef CONFIG_USB_EHCI
index 5c0833a4d8ccfa32e4a893d5d05d337e426e6557..fe07f72260de43ef37cd982fab60fa9ccb9ff0bc 100644 (file)
@@ -38,6 +38,9 @@
 
 #include <asm/arch/tegra.h>            /* get chip and board defs */
 
+/* Align LCD to 1MB boundary */
+#define CONFIG_LCD_ALIGNMENT   MMU_SECTION_SIZE
+
 /*
  * Display CPU and Board information
  */
index 94ba55e277a3f1102ae660ca4439eafe541bce97..63745ac8f1c9fdbc6e25eee47352a66307d805b3 100644 (file)
@@ -99,6 +99,7 @@
 #define CONFIG_CMD_MMC
 #define CONFIG_CMD_DFU
 #define CONFIG_CMD_GPT
+#define CONFIG_CMD_SETEXPR
 
 /* FAT */
 #define CONFIG_CMD_FAT
        "name="PARTS_UMS",size=-,uuid=${uuid_gpt_"PARTS_UMS"}\0" \
 
 #define CONFIG_DFU_ALT \
-       "dfu_alt_info=" \
        "u-boot mmc 80 400;" \
-       "uImage fat 0 2\0" \
+       "uImage ext4 0 2\0" \
 
 #define CONFIG_ENV_OVERWRITE
 #define CONFIG_SYS_CONSOLE_INFO_QUIET
                "mmc read 0 0x42100000 0x80 0x200; run updatebackup\0" \
        "lpj=lpj=3981312\0" \
        "nfsboot=" \
-               "set bootargs root=/dev/nfs rw " \
+               "setenv 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 " \
+               "setenv bootargs root=/dev/ram0 rw rootfstype=ext2 " \
                "${console} ${meminfo} " \
                "initrd=0x43000000,8M ramdisk=8192\0" \
        "mmcboot=" \
-               "set bootargs root=/dev/mmcblk${mmcdev}p${mmcrootpart} " \
+               "setenv 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" \
+       "bootchart=setenv 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" \
        "meminfo=crashkernel=32M@0x50000000\0" \
        "nfsroot=/nfsroot/arm\0" \
        "bootblock=" CONFIG_BOOTBLOCK "\0" \
-       "loaduimage=fatload mmc ${mmcdev}:${mmcbootpart} 0x40007FC0 uImage\0" \
+       "loaduimage=ext4load mmc ${mmcdev}:${mmcbootpart} 0x40007FC0 uImage\0" \
        "mmcdev=0\0" \
        "mmcbootpart=2\0" \
-       "mmcrootpart=3\0" \
+       "mmcrootpart=5\0" \
        "opts=always_resume=1\0" \
        "partitions=" PARTS_DEFAULT \
-       CONFIG_DFU_ALT \
+       "dfu_alt_info=" CONFIG_DFU_ALT \
+       "spladdr=0x40000100\0" \
+       "splsize=0x200\0" \
+       "splfile=falcon.bin\0" \
+       "spl_export=" \
+                  "setexpr spl_imgsize ${splsize} + 8 ;" \
+                  "setexpr spl_imgaddr ${spladdr} - 8 ;" \
+                  "setexpr spl_addr_tmp ${spladdr} - 4 ;" \
+                  "mw.b ${spl_imgaddr} 0x00 ${spl_imgsize};run loaduimage;" \
+                  "setenv bootargs root=/dev/mmcblk${mmcdev}p${mmcrootpart} " \
+                  "${lpj} rootwait ${console} ${meminfo} ${opts} ${lcdinfo};" \
+                  "spl export atags 0x40007FC0;" \
+                  "crc32 ${spladdr} ${splsize} ${spl_imgaddr};" \
+                  "mw.l ${spl_addr_tmp} ${splsize};" \
+                  "ext4write mmc ${mmcdev}:${mmcbootpart}" \
+                  " /${splfile} ${spl_imgaddr} ${spl_imgsize};" \
+                  "setenv spl_imgsize;" \
+                  "setenv spl_imgaddr;" \
+                  "setenv spl_addr_tmp;\0"
 
 /* Miscellaneous configurable options */
 #define CONFIG_SYS_LONGHELP            /* undef to save memory */
 
 #define CONFIG_SYS_HZ                  1000
 
-/* 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      (512 << 20)             /* 512 MB in CS 0 */
-#define PHYS_SDRAM_2           0x50000000              /* LPDDR2 DMC 1 */
-#define PHYS_SDRAM_2_SIZE      (512 << 20)             /* 512 MB in CS 0 */
+/* TRATS has 4 banks of DRAM */
+#define CONFIG_NR_DRAM_BANKS   4
+#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 CONFIG_SYS_MEM_TOP_HIDE                (1 << 20)       /* ram console */
 
 #define CONFIG_ENV_OFFSET              ((32 - 4) << 10) /* 32KiB - 4KiB */
 
 #define CONFIG_DOS_PARTITION
+#define CONFIG_EFI_PARTITION
+
+/* EXT4 */
+#define CONFIG_CMD_EXT4
+#define CONFIG_CMD_EXT4_WRITE
+/* Falcon mode definitions */
+#define CONFIG_CMD_SPL
+#define CONFIG_SYS_SPL_ARGS_ADDR        PHYS_SDRAM_1 + 0x100
 
 /* GPT */
 #define CONFIG_EFI_PARTITION
 #define CONFIG_SYS_INIT_SP_ADDR        (CONFIG_SYS_LOAD_ADDR - GENERATED_GBL_DATA_SIZE)
 #define CONFIG_SYS_CACHELINE_SIZE       32
 
-
 #define CONFIG_SOFT_I2C
 #define CONFIG_SOFT_I2C_READ_REPEATED_START
 #define CONFIG_SYS_I2C_INIT_BOARD
index be0d2ec3c7c09ff86249f4b054ada87c02a8c216..bcb0350b8c740b747606c5d07ab800fc2b1e414e 100644 (file)
 /*  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  */
index eeb0dbe237b2bea407d9a0f8ca25e24f7ce102cc..334d3a3b8b8eee353ee5be23d678ed3fb56067ef 100644 (file)
 
 #define CONFIG_DOS_PARTITION
 #define CONFIG_EFI_PARTITION
+#define CONFIG_FS_EXT4
+#define CONFIG_FS_FAT
 #define CONFIG_CMD_EXT2
 #define CONFIG_CMD_FAT
+#define CONFIG_CMD_FS_GENERIC
 
 /* Environment in SPI */
 #define CONFIG_ENV_IS_IN_SPI_FLASH
@@ -80,6 +83,7 @@
 #define CONFIG_ENV_OFFSET              (512 * 1024)
 
 /* USB Host support */
+#define CONFIG_USB_MAX_CONTROLLER_COUNT 3
 #define CONFIG_USB_EHCI
 #define CONFIG_USB_EHCI_TEGRA
 #define CONFIG_USB_STORAGE
index d203bb4dd7fc3fa35eabeea467412534692c4da6..66568c8d004b63bc52d4df7dadae752184585238 100644 (file)
@@ -65,7 +65,6 @@
 #define CONFIG_BOOTARGS                "root=/dev/ram console=ttyS0,57600" /* RAMdisk */
 #define CONFIG_ETHADDR         00:AA:00:14:00:05       /* UTX5 */
 #define CONFIG_SERVERIP                10.8.17.105     /* Spree */
-#define CONFIG_SYS_TFTP_LOADADDR       10000
 
 #define CONFIG_EXTRA_ENV_SETTINGS \
        "kernel_addr=FFA00000\0" \
index 4c9b31cce30d497864828ba23dcf0d7fee37f440..b55ebc9bfc00a890496dcac8a17d813f14b7a5f5 100644 (file)
 
 #define CONFIG_DOS_PARTITION
 #define CONFIG_EFI_PARTITION
+#define CONFIG_FS_EXT4
+#define CONFIG_FS_FAT
 #define CONFIG_CMD_EXT2
 #define CONFIG_CMD_FAT
+#define CONFIG_CMD_FS_GENERIC
 
 /* Environment in eMMC, at the end of 2nd "boot sector" */
 #define CONFIG_ENV_IS_IN_MMC
index a72010ff212dd2d4f491b0b86cfeae8b59bf22b8..226d04901f5fd58a6a395770efb02d6d713a04df 100644 (file)
 /* 166 MHz DDR RAM */
 #define CONFIG_SYS_DDR_CLKSEL          0
 #define CONFIG_SYS_CLKTL_CBCDR         0x19239100
+#define CONFIG_SYS_MAIN_PWR_ON
 
 #define CONFIG_SYS_NO_FLASH
 
index 1c7803b2660f47e073fa29242499bca0c1233e54..1e554d81647b52aa91a9715d5c0bbdd5eebb575e 100644 (file)
 
 #define CONFIG_DOS_PARTITION
 #define CONFIG_EFI_PARTITION
+#define CONFIG_FS_EXT4
+#define CONFIG_FS_FAT
 #define CONFIG_CMD_EXT2
 #define CONFIG_CMD_FAT
+#define CONFIG_CMD_FS_GENERIC
 
 /*
  * Environment in eMMC, at the end of 2nd "boot sector". Note: This assumes
diff --git a/include/configs/wireless_space.h b/include/configs/wireless_space.h
new file mode 100644 (file)
index 0000000..eb20492
--- /dev/null
@@ -0,0 +1,194 @@
+/*
+ * Copyright (C) 2011 Albert ARIBAUD <albert.u.boot@aribaud.net>
+ *
+ * Based on the netspace_v2 code which is
+ * Copyright (C) 2011 Simon Guinot <sguinot@lacie.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.
+ */
+
+#ifndef _CONFIG_WIRELESS_SPACE_H
+#define _CONFIG_WIRELESS_SPACE_H
+
+/*
+ * Machine number definition
+ */
+#define MACH_TYPE_WIRELESS_SPACE       2500 /* is missing in mach-types.h */
+#define CONFIG_MACH_TYPE               MACH_TYPE_WIRELESS_SPACE
+#define CONFIG_IDENT_STRING            " Wireless Space"
+
+/*
+ * High Level Configuration Options (easy to change)
+ */
+#define CONFIG_FEROCEON_88FR131                /* CPU Core subversion */
+#define CONFIG_KIRKWOOD                        /* SoC Family Name */
+/* SoC name */
+#define CONFIG_KW88F6281
+#define CONFIG_SKIP_LOWLEVEL_INIT      /* disable board lowlevel_init */
+
+/*
+ * Commands configuration
+ */
+#define CONFIG_SYS_NO_FLASH            /* no NOR or SPI flash */
+#include <config_cmd_default.h>
+#define CONFIG_CMD_ENV
+#define CONFIG_CMD_DHCP
+#define CONFIG_CMD_PING
+#define CONFIG_CMD_NAND
+#define CONFIG_CMD_I2C
+#define CONFIG_CMD_IDE
+#define CONFIG_CMD_USB
+
+/*
+ * Core clock definition
+ */
+#define CONFIG_SYS_TCLK                        166000000 /* 166MHz */
+
+/*
+ * SDRAM configuration
+ */
+#define CONFIG_NR_DRAM_BANKS           1
+
+/*
+ * Different SDRAM configuration and size for some of the boards derived
+ * from the Network Space v2
+ */
+
+/*
+ * 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_RBTREE
+#undef CONFIG_SYS_IDE_MAXBUS
+#undef CONFIG_SYS_IDE_MAXDEVICE
+#define CONFIG_SYS_IDE_MAXBUS           1
+#define CONFIG_SYS_IDE_MAXDEVICE        1
+#undef CONFIG_SYS_PROMPT
+#define CONFIG_SYS_PROMPT              "ws> "
+
+/*
+ * Ethernet Driver configuration
+ */
+#ifdef CONFIG_CMD_NET
+#define CONFIG_MISC_INIT_R /* misc_init_r() initializes MAC address */
+#define CONFIG_MVGBE_PORTS     {1, 0}  /* enable only egiga0... */
+#define PORT_SERIAL_CONTROL_VALUE 0x00A4260E /* ... tied to the switch... */
+#define CONFIG_PHY_BASE_ADR 0xa                /* ... through a 'fake' PHY */
+#define CONFIG_MII
+#undef CONFIG_SYS_FAULT_ECHO_LINK_DOWN
+#define CONFIG_NETCONSOLE
+#define CONFIG_MV88E61XX_SWITCH
+#define CONFIG_MV88E61XX_MULTICHIP_ADRMODE
+#define CONFIG_MV88E61XX_CMD
+#define CONFIG_CMD_TFTPPUT
+#endif /* CONFIG_CMD_NET */
+
+/*
+ * SATA Driver configuration
+ */
+#ifdef CONFIG_MVSATA_IDE
+#define CONFIG_SYS_ATA_IDE0_OFFSET      MV_SATA_PORT0_OFFSET
+#endif /* CONFIG_MVSATA_IDE */
+
+/*
+ * Enable GPI0 support
+ */
+#define CONFIG_KIRKWOOD_GPIO
+
+/*
+ * Enable I2C support
+ */
+#ifdef CONFIG_CMD_I2C
+/* I2C EEPROM HT24LC04 (512B - 32 pages of 16 Bytes) */
+#define CONFIG_CMD_EEPROM
+#define CONFIG_SYS_I2C_EEPROM_ADDR             0x50
+#define CONFIG_SYS_EEPROM_PAGE_WRITE_BITS      4 /* 16-byte page size */
+#define CONFIG_SYS_I2C_EEPROM_ADDR_LEN         1 /* 8-bit device address */
+#endif /* CONFIG_CMD_I2C */
+
+/*
+ * Partition support
+ */
+#define CONFIG_DOS_PARTITION
+#define CONFIG_EFI_PARTITION
+
+/*
+ * File systems support
+ */
+#define CONFIG_CMD_EXT2
+#define CONFIG_CMD_FAT
+
+/*
+ * Use the HUSH parser
+ */
+#define CONFIG_SYS_HUSH_PARSER
+
+/*
+ * Console configuration
+ */
+#define CONFIG_CONSOLE_MUX
+#define CONFIG_SYS_CONSOLE_IS_IN_ENV
+
+/*
+ * Enable device tree support
+ */
+#define CONFIG_OF_LIBFDT
+
+/*
+ * Environment variables configurations
+ */
+
+#define CONFIG_ENV_IS_IN_NAND
+#define CONFIG_ENV_SECT_SIZE           0x20000 /* 128KB */
+#define CONFIG_ENV_SIZE                        0x20000 /* 128KB */
+#define CONFIG_ENV_OFFSET              0x80000 /* env starts here */
+
+/*
+ * Board-specific command to make using buttons etc easier
+ */
+
+#define CONFIG_WIRELESS_SPACE_CMD
+
+/*
+ * Default environment variables
+ */
+#define CONFIG_PREBOOT
+
+#define CONFIG_BOOTARGS "console=ttyS0,115200"
+
+#define CONFIG_BOOTCOMMAND                                     \
+       "if run usbload || run diskload; then bootm; fi"
+
+#define CONFIG_EXTRA_ENV_SETTINGS                              \
+       "stdin=serial\0"                                        \
+       "stdout=serial\0"                                       \
+       "stderr=serial\0"                                       \
+       "bootfile=uImage\0"                                     \
+       "loadaddr=0x800000\0"                                   \
+       "autoload=no\0"                                         \
+       "netconsole="                                           \
+               "set stdin $stdin,nc; "                         \
+               "set stdout $stdout,nc; "                       \
+               "set stderr $stderr,nc;\0"                      \
+       "diskload=ide reset && "                                \
+               "ext2load ide 0:1 $loadaddr /boot/$bootfile\0"  \
+       "usbload=usb start && "                                 \
+               "fatload usb 0:1 $loadaddr /boot/$bootfile\0"   \
+       "preboot="                                              \
+               "dhcp && run netconsole\0"
+
+#endif /* _CONFIG_WIRELESS_SPACE_H */
diff --git a/include/configs/woodburn.h b/include/configs/woodburn.h
new file mode 100644 (file)
index 0000000..95a71c4
--- /dev/null
@@ -0,0 +1,34 @@
+/*
+ * (C) Copyright 2011, Stefano Babic <sbabic@denx.de>
+ *
+ * (C) Copyright 2008-2010 Freescale Semiconductor, Inc.
+ *
+ * Configuration for the woodburn board.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.         See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+#ifndef __CONFIG_H
+#define __CONFIG_H
+
+#include <asm/arch/imx-regs.h>
+#include "woodburn_common.h"
+
+/* Set TEXT at the beginning of the NOR flash */
+#define CONFIG_SYS_TEXT_BASE   0xA0000000
+#define CONFIG_BOARD_EARLY_INIT_F
+
+#endif                         /* __CONFIG_H */
diff --git a/include/configs/woodburn_common.h b/include/configs/woodburn_common.h
new file mode 100644 (file)
index 0000000..a1452b9
--- /dev/null
@@ -0,0 +1,313 @@
+/*
+ * (C) Copyright 2011, Stefano Babic <sbabic@denx.de>
+ *
+ * (C) Copyright 2008-2010 Freescale Semiconductor, Inc.
+ *
+ * Configuration for the woodburn board.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.         See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public 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 __WOODBURN_COMMON_CONFIG_H
+#define __WOODBURN_COMMON_CONFIG_H
+
+#include <asm/arch/imx-regs.h>
+
+ /* High Level Configuration Options */
+#define CONFIG_ARM1136 /* This is an arm1136 CPU core */
+#define CONFIG_MX35
+#define CONFIG_MX35_HCLK_FREQ  24000000
+
+#define CONFIG_SYS_DCACHE_OFF
+#define CONFIG_SYS_CACHELINE_SIZE      32
+
+#define CONFIG_DISPLAY_CPUINFO
+
+/* Only in case the value is not present in mach-types.h */
+#ifndef MACH_TYPE_FLEA3
+#define MACH_TYPE_FLEA3                3668
+#endif
+
+#define CONFIG_MACH_TYPE               MACH_TYPE_FLEA3
+
+/* This is required to setup the ESDC controller */
+
+#define CONFIG_CMDLINE_TAG             /* enable passing of ATAGs */
+#define CONFIG_REVISION_TAG
+#define CONFIG_SETUP_MEMORY_TAGS
+#define CONFIG_INITRD_TAG
+
+/*
+ * Size of malloc() pool
+ */
+#define CONFIG_SYS_MALLOC_LEN          (CONFIG_ENV_SIZE + 1024 * 1024)
+
+/*
+ * Hardware drivers
+ */
+#define CONFIG_HARD_I2C
+#define CONFIG_I2C_MXC
+#define CONFIG_SYS_I2C_BASE            I2C1_BASE_ADDR
+#define CONFIG_SYS_I2C_SPEED           100000
+#define CONFIG_MXC_SPI
+#define CONFIG_MXC_GPIO
+
+/* PMIC Controller */
+#define CONFIG_POWER
+#define CONFIG_POWER_I2C
+#define CONFIG_POWER_FSL
+#define CONFIG_PMIC_FSL_MC13892
+#define CONFIG_SYS_FSL_PMIC_I2C_ADDR   0x8
+#define CONFIG_RTC_MC13XXX
+
+
+/* mmc driver */
+#define CONFIG_MMC
+#define CONFIG_GENERIC_MMC
+#define CONFIG_FSL_ESDHC
+#define CONFIG_SYS_FSL_ESDHC_ADDR      0
+#define CONFIG_SYS_FSL_ESDHC_NUM       1
+
+/*
+ * UART (console)
+ */
+#define CONFIG_MXC_UART
+#define CONFIG_MXC_UART_BASE   UART1_BASE
+
+/* allow to overwrite serial and ethaddr */
+#define CONFIG_ENV_OVERWRITE
+#define CONFIG_CONS_INDEX      1
+#define CONFIG_BAUDRATE                115200
+
+/*
+ * Command definition
+ */
+
+#include <config_cmd_default.h>
+
+#define CONFIG_CMD_PING
+#define CONFIG_CMD_DATE
+#define CONFIG_CMD_DHCP
+#define CONFIG_BOOTP_SUBNETMASK
+#define CONFIG_BOOTP_GATEWAY
+#define CONFIG_BOOTP_DNS
+
+#define CONFIG_CMD_NAND
+#define CONFIG_CMD_CACHE
+
+#define CONFIG_CMD_I2C
+#define CONFIG_CMD_SPI
+#define CONFIG_CMD_MII
+#define CONFIG_CMD_NET
+
+#define CONFIG_CMD_MMC
+#define CONFIG_DOS_PARTITION
+#define CONFIG_EFI_PARTITION
+#define CONFIG_CMD_EXT2
+#define CONFIG_CMD_FAT
+
+#define CONFIG_CMD_GPIO
+#define CONFIG_MXC_GPIO
+
+#define CONFIG_NET_RETRY_COUNT 100
+
+#define CONFIG_BOOTDELAY       3
+
+#define CONFIG_LOADADDR                0x80800000      /* loadaddr env var */
+
+
+/*
+ * Ethernet on SOC (FEC)
+ */
+#define CONFIG_FEC_MXC
+#define IMX_FEC_BASE   FEC_BASE_ADDR
+#define CONFIG_PHYLIB
+#define CONFIG_PHY_MICREL
+#define CONFIG_FEC_MXC_PHYADDR 0x1
+
+#define CONFIG_MII
+#define CONFIG_DISCOVER_PHY
+
+#define CONFIG_ARP_TIMEOUT     200UL
+
+/*
+ * Miscellaneous configurable options
+ */
+#define CONFIG_SYS_LONGHELP    /* undef to save memory */
+#define CONFIG_SYS_PROMPT      "woodburn U-Boot > "
+#define CONFIG_CMDLINE_EDITING
+#define CONFIG_SYS_HUSH_PARSER /* Use the HUSH parser */
+
+#define CONFIG_AUTO_COMPLETE
+#define CONFIG_SYS_CBSIZE      256     /* 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 */
+#define CONFIG_SYS_BARGSIZE CONFIG_SYS_CBSIZE /* Boot Argument Buffer Size */
+
+#define CONFIG_SYS_MEMTEST_START       0       /* memtest works on */
+#define CONFIG_SYS_MEMTEST_END         0x10000
+
+#undef CONFIG_SYS_CLKS_IN_HZ   /* everything, incl board info, in Hz */
+
+#define CONFIG_SYS_LOAD_ADDR           CONFIG_LOADADDR
+
+#define CONFIG_SYS_HZ                          1000
+
+
+/*
+ * Stack sizes
+ *
+ * The stack sizes are set up in start.S using the settings below
+ */
+#define CONFIG_STACKSIZE       (128 * 1024)    /* regular stack */
+
+/*
+ * Physical Memory Map
+ */
+#define CONFIG_NR_DRAM_BANKS   1
+#define PHYS_SDRAM_1           CSD0_BASE_ADDR
+#define PHYS_SDRAM_1_SIZE      (256 * 1024 * 1024)
+
+#define CONFIG_SYS_SDRAM_BASE          CSD0_BASE_ADDR
+
+#define CONFIG_SYS_GBL_DATA_OFFSET     (LOW_LEVEL_SRAM_STACK - \
+                                               IRAM_BASE_ADDR - \
+                                               GENERATED_GBL_DATA_SIZE)
+#define CONFIG_SYS_INIT_SP_ADDR                (IRAM_BASE_ADDR + \
+                                       CONFIG_SYS_GBL_DATA_OFFSET)
+
+/*
+ * MTD Command for mtdparts
+ */
+#define CONFIG_CMD_MTDPARTS
+#define CONFIG_MTD_DEVICE
+#define CONFIG_FLASH_CFI_MTD
+#define CONFIG_MTD_PARTITIONS
+#define MTDIDS_DEFAULT         "nand0=mxc_nand,nor0=physmap-flash.0"
+#define MTDPARTS_DEFAULT       "mtdparts=mxc_nand:50m(root1)," \
+                               "32m(rootfb)," \
+                               "64m(pcache)," \
+                               "64m(app1)," \
+                               "10m(app2),-(spool);" \
+                               "physmap-flash.0:512k(u-boot),64k(env1)," \
+                               "64k(env2),3776k(kernel1),3776k(kernel2)"
+
+/*
+ * FLASH and environment organization
+ */
+#define CONFIG_SYS_FLASH_BASE          CS0_BASE_ADDR
+#define CONFIG_SYS_MAX_FLASH_BANKS 1   /* max number of memory banks */
+#define CONFIG_SYS_MAX_FLASH_SECT 512  /* max number of sectors on one chip */
+/* Monitor at beginning of flash */
+#define CONFIG_SYS_MONITOR_BASE        CONFIG_SYS_FLASH_BASE
+#define CONFIG_SYS_MONITOR_LEN         (512 * 1024)
+
+#define CONFIG_ENV_SECT_SIZE   (128 * 1024)
+#define CONFIG_ENV_SIZE                CONFIG_ENV_SECT_SIZE
+
+/* Address and size of Redundant Environment Sector    */
+#define CONFIG_ENV_OFFSET_REDUND       (CONFIG_ENV_OFFSET + CONFIG_ENV_SIZE)
+#define CONFIG_ENV_SIZE_REDUND CONFIG_ENV_SIZE
+
+#define CONFIG_ENV_ADDR                (CONFIG_SYS_MONITOR_BASE + \
+                               CONFIG_SYS_MONITOR_LEN)
+
+#define CONFIG_ENV_IS_IN_FLASH
+
+/*
+ * CFI FLASH driver setup
+ */
+#define CONFIG_SYS_FLASH_CFI           /* Flash memory is CFI compliant */
+#define CONFIG_FLASH_CFI_DRIVER
+
+/* A non-standard buffered write algorithm */
+#define CONFIG_SYS_FLASH_USE_BUFFER_WRITE      /* faster */
+#define CONFIG_SYS_FLASH_PROTECTION    /* Use hardware sector protection */
+
+/*
+ * NAND FLASH driver setup
+ */
+#define CONFIG_NAND_MXC
+#define CONFIG_NAND_MXC_V1_1
+#define CONFIG_MXC_NAND_REGS_BASE      (NFC_BASE_ADDR)
+#define CONFIG_SYS_MAX_NAND_DEVICE     1
+#define CONFIG_SYS_NAND_BASE           (NFC_BASE_ADDR)
+#define CONFIG_MXC_NAND_HWECC
+#define CONFIG_SYS_NAND_LARGEPAGE
+
+#if 0
+#define CONFIG_MTD_DEBUG
+#define CONFIG_MTD_DEBUG_VERBOSE       7
+#endif
+#define CONFIG_SYS_NAND_ONFI_DETECTION
+
+/*
+ * Default environment and default scripts
+ * to update uboot and load kernel
+ */
+#define xstr(s)        str(s)
+#define str(s) #s
+
+#define CONFIG_HOSTNAME woodburn
+#define        CONFIG_EXTRA_ENV_SETTINGS                                       \
+       "netdev=eth0\0"                                                 \
+       "nfsargs=setenv bootargs root=/dev/nfs rw "                     \
+               "nfsroot=${serverip}:${rootpath}\0"                     \
+       "ramargs=setenv bootargs root=/dev/ram rw\0"                    \
+       "addip_sta=setenv bootargs ${bootargs} "                        \
+               "ip=${ipaddr}:${serverip}:${gatewayip}:${netmask}"      \
+               ":${hostname}:${netdev}:off panic=1\0"                  \
+       "addip_dyn=setenv bootargs ${bootargs} ip=dhcp\0"               \
+       "addip=if test -n ${ipdyn};then run addip_dyn;"                 \
+               "else run addip_sta;fi\0"       \
+       "addmtd=setenv bootargs ${bootargs} ${mtdparts}\0"              \
+       "addtty=setenv bootargs ${bootargs}"                            \
+               " console=ttymxc0,${baudrate}\0"                        \
+       "addmisc=setenv bootargs ${bootargs} ${misc}\0"                 \
+       "loadaddr=80800000\0"                                           \
+       "kernel_addr_r=80800000\0"                                      \
+       "hostname=" xstr(CONFIG_HOSTNAME) "\0"                          \
+       "bootfile=" xstr(CONFIG_HOSTNAME) "/uImage\0"                   \
+       "ramdisk_file=" xstr(CONFIG_HOSTNAME) "/uRamdisk\0"             \
+       "flash_self=run ramargs addip addtty addmtd addmisc;"           \
+               "bootm ${kernel_addr} ${ramdisk_addr}\0"                \
+       "flash_nfs=run nfsargs addip addtty addmtd addmisc;"            \
+               "bootm ${kernel_addr}\0"                                \
+       "net_nfs=tftp ${kernel_addr_r} ${bootfile}; "                   \
+               "run nfsargs addip addtty addmtd addmisc;"              \
+               "bootm ${kernel_addr_r}\0"                              \
+       "net_self_load=tftp ${kernel_addr_r} ${bootfile};"              \
+               "tftp ${ramdisk_addr_r} ${ramdisk_file};\0"             \
+       "net_self=if run net_self_load;then "                           \
+               "run ramargs addip addtty addmtd addmisc;"              \
+               "bootm ${kernel_addr_r} ${ramdisk_addr_r};"             \
+               "else echo Images not loades;fi\0"                      \
+       "u-boot=" xstr(CONFIG_HOSTNAME) "/u-boot.bin\0"                 \
+       "load=tftp ${loadaddr} ${u-boot}\0"                             \
+       "uboot_addr=" xstr(CONFIG_SYS_MONITOR_BASE) "\0"                \
+       "update=protect off ${uboot_addr} +80000;"                      \
+               "erase ${uboot_addr} +80000;"                           \
+               "cp.b ${loadaddr} ${uboot_addr} ${filesize}\0"          \
+       "upd=if run load;then echo Updating u-boot;if run update;"      \
+               "then echo U-Boot updated;"                             \
+                       "else echo Error updating u-boot !;"            \
+                       "echo Board without bootloader !!;"             \
+               "fi;"                                                   \
+               "else echo U-Boot not downloaded..exiting;fi\0"         \
+       "bootcmd=run net_nfs\0"
+
+#endif                         /* __CONFIG_H */
diff --git a/include/configs/woodburn_sd.h b/include/configs/woodburn_sd.h
new file mode 100644 (file)
index 0000000..63185c5
--- /dev/null
@@ -0,0 +1,60 @@
+/*
+ * (C) Copyright 2011, Stefano Babic <sbabic@denx.de>
+ *
+ * (C) Copyright 2008-2010 Freescale Semiconductor, Inc.
+ *
+ * Configuration for the woodburn board.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.         See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+#ifndef __CONFIG_H
+#define __CONFIG_H
+
+#include <asm/arch/imx-regs.h>
+#include "woodburn_common.h"
+
+/* Set TEXT in RAM */
+#define CONFIG_SYS_TEXT_BASE   0x82000000
+
+#define CONFIG_BOOT_INTERNAL
+
+/*
+ * SPL
+ */
+#define        CONFIG_SPL
+#define CONFIG_SPL_FRAMEWORK
+#define        CONFIG_SPL_LDSCRIPT     "arch/arm/cpu/arm1136/u-boot-spl.lds"
+#define        CONFIG_SPL_LIBCOMMON_SUPPORT
+#define        CONFIG_SPL_LIBGENERIC_SUPPORT
+#define CONFIG_SPL_LIBDISK_SUPPORT
+#define CONFIG_SPL_SERIAL_SUPPORT
+#define CONFIG_SPL_MMC_SUPPORT
+#define CONFIG_SPL_BOARD_INIT
+#define CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR        0x100 /* address 0x60000 */
+#define CONFIG_SYS_U_BOOT_MAX_SIZE_SECTORS     0x400 /* 512 KB */
+#define        CONFIG_SPL_GPIO_SUPPORT
+
+#define CONFIG_SPL_TEXT_BASE           0x10002300
+#define CONFIG_SPL_MAX_SIZE            (64 * 1024)     /* 8 KB for stack */
+#define CONFIG_SPL_STACK               LOW_LEVEL_SRAM_STACK
+
+#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
+
+#endif                         /* __CONFIG_H */
index bf6394a90ae90d6cff7bcb8c53008dc71ca50847..b92f70b538d72552572e038e697206ad6b7d9858 100644 (file)
@@ -41,6 +41,9 @@
 #define CONFIG_ENV_ADDR                        0x40000
 #define CONFIG_ENV_SIZE                        0x20000
 
+/* we will never enable dcache, because we have to setup MMU first */
+#define CONFIG_SYS_DCACHE_OFF
+
 #define        CONFIG_SYS_MALLOC_LEN           (128*1024)
 #define        CONFIG_ARCH_CPU_INIT
 
index 447683a490530db2c85677a7ad7fa8f264ab6c89..e9216d9b64b75c4197c5263ecf0e7e809f0fbb14 100644 (file)
 #define CONFIG_USB_EHCI                        /* Enable EHCI USB support */
 #define CONFIG_USB_EHCI_MXC
 #define CONFIG_EHCI_HCD_INIT_AFTER_RESET
-#define CONFIG_MXC_USB_PORT    2
-#define CONFIG_MXC_USB_PORTSC  0xC0000000
-#define CONFIG_MXC_USB_FLAGS   0
+#define CONFIG_MXC_USB_PORT    1
+#define CONFIG_MXC_USB_PORTSC  MXC_EHCI_MODE_SERIAL
+#define CONFIG_MXC_USB_FLAGS   (MXC_EHCI_INTERNAL_PHY | MXC_EHCI_IPPUE_DOWN)
 #define CONFIG_EHCI_IS_TDI
 #define CONFIG_USB_STORAGE
 #define CONFIG_DOS_PARTITION
index 47fdc6fa9103e3dec208dc3311f45dde08ad8d8e..c583120c1c4aea220389cbd3eedfb515a2fabdea 100644 (file)
@@ -68,8 +68,16 @@ void env_callback_init(ENTRY *var_entry);
  * when associated through the ".callbacks" environment variable, the callback
  * will be executed any time the variable is inserted, overwritten, or deleted.
  */
+#ifdef CONFIG_SPL_BUILD
+#define U_BOOT_ENV_CALLBACK(name, callback) \
+       static inline void _u_boot_env_noop_##name(void) \
+       { \
+               (void)callback; \
+       }
+#else
 #define U_BOOT_ENV_CALLBACK(name, callback) \
        ll_entry_declare(struct env_clbk_tbl, name, env_clbk, env_clbk) = \
        {#name, callback}
+#endif
 
 #endif /* __ENV_CALLBACK_H__ */
index 5164ce24e61e2686ae6fb664862dfc8363a4238f..f77d195630bc088a6d2c82d62f2ee6e3ebb24162 100644 (file)
@@ -68,6 +68,17 @@ enum fdt_compat_id {
        COMPAT_NVIDIA_TEGRA20_EMC_TABLE, /* Tegra20 memory timing table */
        COMPAT_NVIDIA_TEGRA20_KBC,      /* Tegra20 Keyboard */
        COMPAT_NVIDIA_TEGRA20_NAND,     /* Tegra2 NAND controller */
+       COMPAT_NVIDIA_TEGRA20_PWM,      /* Tegra 2 PWM controller */
+       COMPAT_NVIDIA_TEGRA20_DC,       /* Tegra 2 Display controller */
+       COMPAT_SMSC_LAN9215,            /* SMSC 10/100 Ethernet LAN9215 */
+       COMPAT_SAMSUNG_EXYNOS5_SROMC,   /* Exynos5 SROMC */
+       COMPAT_SAMSUNG_S3C2440_I2C,     /* Exynos I2C Controller */
+       COMPAT_SAMSUNG_EXYNOS5_SOUND,   /* Exynos Sound */
+       COMPAT_WOLFSON_WM8994_CODEC,    /* Wolfson WM8994 Sound Codec */
+       COMPAT_SAMSUNG_EXYNOS_SPI,      /* Exynos SPI */
+       COMPAT_SAMSUNG_EXYNOS_EHCI,     /* Exynos EHCI controller */
+       COMPAT_SAMSUNG_EXYNOS_USB_PHY,  /* Exynos phy controller for usb2.0 */
+       COMPAT_MAXIM_MAX77686_PMIC,     /* MAX77686 PMIC */
 
        COMPAT_COUNT,
 };
index 7db599e783a0d77a2ea4e3f2a22f9549b440a1d9..c7acc977ee49f35174fa3f4cea57242d080bb500 100644 (file)
@@ -44,6 +44,7 @@ typedef struct {
        ulong   buffer_write_tout;      /* maximum buffer write timeout         */
        ushort  vendor;                 /* the primary vendor id                */
        ushort  cmd_reset;              /* vendor specific reset command        */
+       uchar   cmd_erase_sector;       /* vendor specific erase sect. command  */
        ushort  interface;              /* used for x8/x16 adjustments          */
        ushort  legacy_unlock;          /* support Intel legacy (un)locking     */
        ushort  manufacturer_id;        /* manufacturer id                      */
index 16f099d2eeb906588a0f9233a42fb8b9a9847ef4..c60d07583bf68cbcc3b1dc6bf67f41a44585c920 100644 (file)
@@ -262,4 +262,30 @@ extern int get_multi_scl_pin(void);
 extern int get_multi_sda_pin(void);
 extern int multi_i2c_init(void);
 #endif
+
+/**
+ * Get FDT values for i2c bus.
+ *
+ * @param blob  Device tree blbo
+ * @return the number of I2C bus
+ */
+void board_i2c_init(const void *blob);
+
+/**
+ * Find the I2C bus number by given a FDT I2C node.
+ *
+ * @param blob  Device tree blbo
+ * @param node  FDT I2C node to find
+ * @return the number of I2C bus (zero based), or -1 on error
+ */
+int i2c_get_bus_num_fdt(int node);
+
+/**
+ * Reset the I2C bus represented by the given a FDT I2C node.
+ *
+ * @param blob  Device tree blbo
+ * @param node  FDT I2C node to find
+ * @return 0 if port was reset, -1 if not found
+ */
+int i2c_reset_port_fdt(const void *blob, int node);
 #endif /* _I2C_H_ */
diff --git a/include/i2s.h b/include/i2s.h
new file mode 100644 (file)
index 0000000..75ae75c
--- /dev/null
@@ -0,0 +1,127 @@
+/*
+ * Copyright (C) 2012 Samsung Electronics
+ * R. Chandrasekar <rcsekar@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 __I2S_H__
+#define __I2S_H__
+
+/*
+ * DAI hardware audio formats.
+ *
+ * Describes the physical PCM data formating and clocking. Add new formats
+ * to the end.
+ */
+#define SND_SOC_DAIFMT_I2S             1 /* I2S mode */
+#define SND_SOC_DAIFMT_RIGHT_J         2 /* Right Justified mode */
+#define SND_SOC_DAIFMT_LEFT_J          3 /* Left Justified mode */
+#define SND_SOC_DAIFMT_DSP_A           4 /* L data MSB after FRM LRC */
+#define SND_SOC_DAIFMT_DSP_B           5 /* L data MSB during FRM LRC */
+#define SND_SOC_DAIFMT_AC97            6 /* AC97 */
+#define SND_SOC_DAIFMT_PDM             7 /* Pulse density modulation */
+
+/* left and right justified also known as MSB and LSB respectively */
+#define SND_SOC_DAIFMT_MSB             SND_SOC_DAIFMT_LEFT_J
+#define SND_SOC_DAIFMT_LSB             SND_SOC_DAIFMT_RIGHT_J
+
+/*
+ * DAI hardware signal inversions.
+ *
+ * Specifies whether the DAI can also support inverted clocks for the specified
+ * format.
+ */
+#define SND_SOC_DAIFMT_NB_NF   (1 << 8) /* normal bit clock + frame */
+#define SND_SOC_DAIFMT_NB_IF   (2 << 8) /* normal BCLK + inv FRM */
+#define SND_SOC_DAIFMT_IB_NF   (3 << 8) /* invert BCLK + nor FRM */
+#define SND_SOC_DAIFMT_IB_IF   (4 << 8) /* invert BCLK + FRM */
+
+/*
+ * DAI hardware clock masters.
+ *
+ * This is wrt the codec, the inverse is true for the interface
+ * i.e. if the codec is clk and FRM master then the interface is
+ * clk and frame slave.
+ */
+#define SND_SOC_DAIFMT_CBM_CFM (1 << 12) /* codec clk & FRM master */
+#define SND_SOC_DAIFMT_CBS_CFM (2 << 12) /* codec clk slave & FRM master */
+#define SND_SOC_DAIFMT_CBM_CFS (3 << 12) /* codec clk master & frame slave */
+#define SND_SOC_DAIFMT_CBS_CFS (4 << 12) /* codec clk & FRM slave */
+
+#define SND_SOC_DAIFMT_FORMAT_MASK     0x000f
+#define SND_SOC_DAIFMT_CLOCK_MASK      0x00f0
+#define SND_SOC_DAIFMT_INV_MASK                0x0f00
+#define SND_SOC_DAIFMT_MASTER_MASK     0xf000
+
+/*
+ * Master Clock Directions
+ */
+#define SND_SOC_CLOCK_IN               0
+#define SND_SOC_CLOCK_OUT              1
+
+/* I2S Tx Control */
+#define I2S_TX_ON      1
+#define I2S_TX_OFF     0
+
+#define FIFO_LENGTH    64
+
+/* I2s Registers */
+struct i2s_reg {
+       unsigned int con;       /* base + 0 , Control register */
+       unsigned int mod;       /* Mode register */
+       unsigned int fic;       /* FIFO control register */
+       unsigned int psr;       /* Reserved */
+       unsigned int txd;       /* Transmit data register */
+       unsigned int rxd;       /* Receive Data Register */
+};
+
+/* This structure stores the i2s related information */
+struct i2stx_info {
+       unsigned int rfs;               /* LR clock frame size */
+       unsigned int bfs;               /* Bit slock frame size */
+       unsigned int audio_pll_clk;     /* Audio pll frequency in Hz */
+       unsigned int samplingrate;      /* sampling rate */
+       unsigned int bitspersample;     /* bits per sample */
+       unsigned int channels;          /* audio channels */
+       unsigned int base_address;      /* I2S Register Base */
+};
+
+/*
+ * Sends the given data through i2s tx
+ *
+ * @param pi2s_tx      pointer of i2s transmitter parameter structure.
+ * @param data         address of the data buffer
+ * @param data_size    array size of the int buffer (total size / size of int)
+ *
+ * @return             int value 0 for success, -1 in case of error
+ */
+int i2s_transfer_tx_data(struct i2stx_info *pi2s_tx, unsigned *data,
+                               unsigned long data_size);
+
+/*
+ * Initialise i2s transmiter
+ *
+ * @param pi2s_tx      pointer of i2s transmitter parameter structure.
+ *
+ * @return             int value 0 for success, -1 in case of error
+ */
+int i2s_tx_init(struct i2stx_info *pi2s_tx);
+
+#endif /* __I2S_H__ */
index b958b18a4de2fd8fc6e8638c90149f74ced088ad..f5adc5035360633024de1b67cfee73f8811f17c8 100644 (file)
 #define IH_MAGIC       0x27051956      /* Image Magic Number           */
 #define IH_NMLEN               32      /* Image Name Length            */
 
+/* Reused from common.h */
+#define ROUND(a, b)            (((a) + (b) - 1) & ~((b) - 1))
+
 /*
  * Legacy format image header,
  * all data in network byte order (aka natural aka bigendian).
index 2517d39d4144a5f3d760c9bcb53029b3460c4316..c24164a9de0c74cf4cfb910ed695b1c6aa71f42d 100644 (file)
@@ -57,6 +57,14 @@ extern void lcd_initcolregs (void);
 extern struct bmp_image *gunzip_bmp(unsigned long addr, unsigned long *lenp);
 extern int bmp_display(ulong addr, int x, int y);
 
+/**
+ * Set whether we need to flush the dcache when changing the LCD image. This
+ * defaults to off.
+ *
+ * @param flush                non-zero to flush cache after update, 0 to skip
+ */
+void lcd_set_flush_dcache(int flush);
+
 #if defined CONFIG_MPC823
 /*
  * LCD controller stucture for MPC823 CPU
@@ -333,6 +341,9 @@ void lcd_position_cursor(unsigned col, unsigned row);
 /* Allow boards to customize the information displayed */
 void lcd_show_board_info(void);
 
+/* Return the size of the LCD frame buffer, and the line length */
+int lcd_get_size(int *line_length);
+
 /************************************************************************/
 /* ** BITMAP DISPLAY SUPPORT                                           */
 /************************************************************************/
diff --git a/include/ld9040.h b/include/ld9040.h
new file mode 100644 (file)
index 0000000..fe99390
--- /dev/null
@@ -0,0 +1,32 @@
+/*
+ * ld9040 AMOLED LCD panel driver.
+ *
+ * Copyright (C) 2012 Samsung Electronics
+ * Donghwa Lee <dh09.lee@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 __LD9040_H_
+#define __LD9040_H_
+
+void ld9040_cfg_ldo(void);
+void ld9040_enable_ldo(unsigned int onoff);
+
+#endif /* __LD9040_H_ */
diff --git a/include/mc34704.h b/include/mc34704.h
new file mode 100644 (file)
index 0000000..6611d54
--- /dev/null
@@ -0,0 +1,49 @@
+/*
+ * (C) Copyright 2012 Freescale Semiconductor, Inc.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ */
+
+#ifndef __MC34704_H__
+#define __MC34704_H__
+
+enum {
+       MC34704_RESERVED0_REG = 0,      /* 0x00 */
+       MC34704_GENERAL1_REG,           /* 0x01 */
+       MC34704_GENERAL2_REG,           /* 0x02 */
+       MC34704_GENERAL3_REG,           /* 0x03 */
+       MC34704_RESERVED4_REG,          /* 0x04 */
+       MC34704_VGSET2_REG,             /* 0x05 */
+       MC34704_REG2SET1_REG,           /* 0x06 */
+       MC34704_REG2SET2_REG,           /* 0x07 */
+       MC34704_REG3SET1_REG,           /* 0x08 */
+       MC34704_REG3SET2_REG,           /* 0x09 */
+       MC34704_REG4SET1_REG,           /* 0x0a */
+       MC34704_REG4SET2_REG,           /* 0x0b */
+       MC34704_REG5SET1_REG,           /* 0x0c */
+       MC34704_REG5SET2_REG,           /* 0x0d */
+       MC34704_REG5SET3_REG,           /* 0x0e */
+       MC34704_RESERVEDF_REG,          /* 0x0f */
+       MC34704_RESERVED10_REG,         /* 0x10 */
+       MC34704_RESERVED11_REG,         /* 0x11 */
+       MC34704_RESERVED12_REG,         /* 0x12 */
+       MC34704_FSW2SET_REG,            /* 0x13 */
+       MC34704_RESERVED14_REG,         /* 0x14 */
+       MC34704_REG8SET1_REG,           /* 0x15 */
+       MC34704_REG8SET2_REG,           /* 0x16 */
+       MC34704_REG8SET3_REG,           /* 0x17 */
+       MC34704_FAULTS_REG,             /* 0x18 */
+       MC34704_I2CSET1,                /* 0x19 */
+       MC34704_NUM_OF_REGS,
+};
+
+/* GENERAL2 register fields */
+#define ONOFFE         (1 << 0)
+#define ONOFFD         (1 << 1)
+#define ALLOFF         (1 << 4)
+
+#endif /* __MC34704_H__ */
index b8d303d0895b24dd90607baced372568159282c0..7f158d433ba30aeb5615d541d4c0ef3fda73d2c2 100644 (file)
@@ -163,10 +163,9 @@ static inline int pci_eth_init(bd_t *bis)
  * the stuct and enums here are used to specify switch configuration params
  */
 #if defined(CONFIG_MV88E61XX_SWITCH)
-enum mv88e61xx_cfg_vlan {
-       MV88E61XX_VLANCFG_DEFAULT,
-       MV88E61XX_VLANCFG_ROUTER
-};
+
+/* constants for any 88E61xx switch */
+#define MV88E61XX_MAX_PORTS_NUM        6
 
 enum mv88e61xx_cfg_mdip {
        MV88E61XX_MDIP_NOCHANGE,
@@ -192,7 +191,7 @@ enum mv88e61xx_cfg_prtstt {
 
 struct mv88e61xx_config {
        char *name;
-       enum mv88e61xx_cfg_vlan vlancfg;
+       u8 vlancfg[MV88E61XX_MAX_PORTS_NUM];
        enum mv88e61xx_cfg_rgmiid rgmii_delay;
        enum mv88e61xx_cfg_prtstt portstate;
        enum mv88e61xx_cfg_ledinit led_init;
@@ -201,6 +200,18 @@ struct mv88e61xx_config {
        u8 cpuport;
 };
 
+/*
+ * Common mappings for Internal VLANs
+ * These mappings consider that all ports are useable; the driver
+ * will mask inexistent/unused ports.
+ */
+
+/* Switch mode : routes any port to any port */
+#define MV88E61XX_VLANCFG_SWITCH { 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F }
+
+/* Router mode: routes only CPU port 5 to/from non-CPU ports 0-4 */
+#define MV88E61XX_VLANCFG_ROUTER { 0x20, 0x20, 0x20, 0x20, 0x20, 0x1F }
+
 int mv88e61xx_switch_initialize(struct mv88e61xx_config *swconfig);
 #endif /* CONFIG_MV88E61XX_SWITCH */
 
diff --git a/include/power/max77686_pmic.h b/include/power/max77686_pmic.h
new file mode 100644 (file)
index 0000000..d949ace
--- /dev/null
@@ -0,0 +1,158 @@
+/*
+ *  Copyright (C) 2012 Samsung Electronics
+ *  Rajeshwari Shinde <rajeshwari.s@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 __MAX77686_H_
+#define __MAX77686_H_
+
+enum {
+       MAX77686_REG_PMIC_ID            = 0x0,
+       MAX77686_REG_PMIC_INTSRC,
+       MAX77686_REG_PMIC_INT1,
+       MAX77686_REG_PMIC_INT2,
+       MAX77686_REG_PMIC_INT1MSK,
+       MAX77686_REG_PMIC_INT2MSK,
+
+       MAX77686_REG_PMIC_STATUS1,
+       MAX77686_REG_PMIC_STATUS2,
+
+       MAX77686_REG_PMIC_PWRON,
+       MAX77686_REG_PMIC_ONOFFDELAY,
+       MAX77686_REG_PMIC_MRSTB,
+
+       MAX77686_REG_PMIC_BUCK1CRTL     = 0x10,
+       MAX77686_REG_PMIC_BUCK1OUT,
+       MAX77686_REG_PMIC_BUCK2CTRL1,
+       MAX77686_REG_PMIC_BUCK234FREQ,
+       MAX77686_REG_PMIC_BUCK2DVS1,
+       MAX77686_REG_PMIC_BUCK2DVS2,
+       MAX77686_REG_PMIC_BUCK2DVS3,
+       MAX77686_REG_PMIC_BUCK2DVS4,
+       MAX77686_REG_PMIC_BUCK2DVS5,
+       MAX77686_REG_PMIC_BUCK2DVS6,
+       MAX77686_REG_PMIC_BUCK2DVS7,
+       MAX77686_REG_PMIC_BUCK2DVS8,
+       MAX77686_REG_PMIC_BUCK3CTRL,
+       MAX77686_REG_PMIC_BUCK3DVS1,
+       MAX77686_REG_PMIC_BUCK3DVS2,
+       MAX77686_REG_PMIC_BUCK3DVS3,
+       MAX77686_REG_PMIC_BUCK3DVS4,
+       MAX77686_REG_PMIC_BUCK3DVS5,
+       MAX77686_REG_PMIC_BUCK3DVS6,
+       MAX77686_REG_PMIC_BUCK3DVS7,
+       MAX77686_REG_PMIC_BUCK3DVS8,
+       MAX77686_REG_PMIC_BUCK4CTRL1,
+       MAX77686_REG_PMIC_BUCK4DVS1     = 0x28,
+       MAX77686_REG_PMIC_BUCK4DVS2,
+       MAX77686_REG_PMIC_BUCK4DVS3,
+       MAX77686_REG_PMIC_BUCK4DVS4,
+       MAX77686_REG_PMIC_BUCK4DVS5,
+       MAX77686_REG_PMIC_BUCK4DVS6,
+       MAX77686_REG_PMIC_BUCK4DVS7,
+       MAX77686_REG_PMIC_BUCK4DVS8,
+       MAX77686_REG_PMIC_BUCK5CTRL,
+       MAX77686_REG_PMIC_BUCK5OUT,
+       MAX77686_REG_PMIC_BUCK6CRTL,
+       MAX77686_REG_PMIC_BUCK6OUT,
+       MAX77686_REG_PMIC_BUCK7CRTL,
+       MAX77686_REG_PMIC_BUCK7OUT,
+       MAX77686_REG_PMIC_BUCK8CRTL,
+       MAX77686_REG_PMIC_BUCK8OUT,
+       MAX77686_REG_PMIC_BUCK9CRTL,
+       MAX77686_REG_PMIC_BUCK9OUT,
+
+       MAX77686_REG_PMIC_LDO1CTRL1     = 0x40,
+       MAX77686_REG_PMIC_LDO2CTRL1,
+       MAX77686_REG_PMIC_LDO3CTRL1,
+       MAX77686_REG_PMIC_LDO4CTRL1,
+       MAX77686_REG_PMIC_LDO5CTRL1,
+       MAX77686_REG_PMIC_LDO6CTRL1,
+       MAX77686_REG_PMIC_LDO7CTRL1,
+       MAX77686_REG_PMIC_LDO8CTRL1,
+       MAX77686_REG_PMIC_LDO9CTRL1,
+       MAX77686_REG_PMIC_LDO10CTRL1,
+       MAX77686_REG_PMIC_LDO11CTRL1,
+       MAX77686_REG_PMIC_LDO12CTRL1,
+       MAX77686_REG_PMIC_LDO13CTRL1,
+       MAX77686_REG_PMIC_LDO14CTRL1,
+       MAX77686_REG_PMIC_LDO15CTRL1,
+       MAX77686_REG_PMIC_LDO16CTRL1,
+       MAX77686_REG_PMIC_LDO17CTRL1,
+       MAX77686_REG_PMIC_LDO18CTRL1,
+       MAX77686_REG_PMIC_LDO19CTRL1,
+       MAX77686_REG_PMIC_LDO20CTRL1,
+       MAX77686_REG_PMIC_LDO21CTRL1,
+       MAX77686_REG_PMIC_LDO22CTRL1,
+       MAX77686_REG_PMIC_LDO23CTRL1,
+       MAX77686_REG_PMIC_LDO24CTRL1,
+       MAX77686_REG_PMIC_LDO25CTRL1,
+       MAX77686_REG_PMIC_LDO26CTRL1,
+       MAX77686_REG_PMIC_LDO1CTRL2,
+       MAX77686_REG_PMIC_LDO2CTRL2,
+       MAX77686_REG_PMIC_LDO3CTRL2,
+       MAX77686_REG_PMIC_LDO4CTRL2,
+       MAX77686_REG_PMIC_LDO5CTRL2,
+       MAX77686_REG_PMIC_LDO6CTRL2,
+       MAX77686_REG_PMIC_LDO7CTRL2,
+       MAX77686_REG_PMIC_LDO8CTRL2,
+       MAX77686_REG_PMIC_LDO9CTRL2,
+       MAX77686_REG_PMIC_LDO10CTRL2,
+       MAX77686_REG_PMIC_LDO11CTRL2,
+       MAX77686_REG_PMIC_LDO12CTRL2,
+       MAX77686_REG_PMIC_LDO13CTRL2,
+       MAX77686_REG_PMIC_LDO14CTRL2,
+       MAX77686_REG_PMIC_LDO15CTRL2,
+       MAX77686_REG_PMIC_LDO16CTRL2,
+       MAX77686_REG_PMIC_LDO17CTRL2,
+       MAX77686_REG_PMIC_LDO18CTRL2,
+       MAX77686_REG_PMIC_LDO19CTRL2,
+       MAX77686_REG_PMIC_LDO20CTRL2,
+       MAX77686_REG_PMIC_LDO21CTRL2,
+       MAX77686_REG_PMIC_LDO22CTRL2,
+       MAX77686_REG_PMIC_LDO23CTRL2,
+       MAX77686_REG_PMIC_LDO24CTRL2,
+       MAX77686_REG_PMIC_LDO25CTRL2,
+       MAX77686_REG_PMIC_LDO26CTRL2,
+
+       MAX77686_REG_PMIC_BBAT          = 0x7e,
+       MAX77686_REG_PMIC_32KHZ,
+
+       PMIC_NUM_OF_REGS,
+};
+
+/* I2C device address for pmic max77686 */
+#define MAX77686_I2C_ADDR (0x12 >> 1)
+
+enum {
+       REG_DISABLE = 0,
+       REG_ENABLE
+};
+
+enum {
+       LDO_OFF = 0,
+       LDO_ON,
+
+       DIS_LDO = (0x00 << 6),
+       EN_LDO = (0x3 << 6),
+};
+
+#endif /* __MAX77686_PMIC_H_ */
index ca21f882c29344aae475cc967fc55255619ad3fe..0e559f986aa92257e4aea2392c357c36c4e023cc 100644 (file)
@@ -76,7 +76,9 @@ enum {
 
 #define MAX8998_LDO3           (1 << 2)
 #define MAX8998_LDO4           (1 << 1)
+#define MAX8998_LDO7           (1 << 6)
 #define MAX8998_LDO8           (1 << 5)
+#define MAX8998_LDO17          (1 << 4)
 #define MAX8998_SAFEOUT1       (1 << 4)
 
 #define MAX8998_I2C_ADDR        (0xCC >> 1)
diff --git a/include/sound.h b/include/sound.h
new file mode 100644 (file)
index 0000000..d73839d
--- /dev/null
@@ -0,0 +1,62 @@
+/*
+ * Copyright (C) 2012 Samsung Electronics
+ * R. Chandrasekar < rcsekar@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 __SOUND_H__
+#define __SOUND_H__
+
+/* sound codec enum */
+enum en_sound_codec {
+       CODEC_WM_8994,
+       CODEC_WM_8995,
+       CODEC_MAX
+};
+
+/* sound codec enum */
+enum sound_compat {
+       AUDIO_COMPAT_SPI,
+       AUDIO_COMPAT_I2C,
+};
+
+/* Codec information structure to store the info from device tree */
+struct sound_codec_info {
+       int i2c_bus;
+       int i2c_dev_addr;
+       enum en_sound_codec codec_type;
+};
+
+/*
+ * Initialises audio sub system
+ * @param blob Pointer of device tree node or NULL if none.
+ * @return     int value 0 for success, -1 for error
+ */
+int sound_init(const void *blob);
+
+/*
+ * plays the pcm data buffer in pcm_data.h through i2s1 to make the
+ * sine wave sound
+ *
+ * @return     int 0 for success, -1 for error
+ */
+int sound_play(uint32_t msec, uint32_t frequency);
+
+#endif  /* __SOUND__H__ */
index 0c17f5929b193969e57208a2063b9b60a1fbf7a7..5aa184183e7cffef60942464290c73c9ecd7d41b 100644 (file)
 #define TWL4030_USB_PHY_CLK_CTRL                       0xFE
 #define TWL4030_USB_PHY_CLK_CTRL_STS                   0xFF
 
+/* GPIO */
+#define TWL4030_GPIO_GPIODATAIN1                       0x00
+#define TWL4030_GPIO_GPIODATAIN2                       0x01
+#define TWL4030_GPIO_GPIODATAIN3                       0x02
+#define TWL4030_GPIO_GPIODATADIR1                      0x03
+#define TWL4030_GPIO_GPIODATADIR2                      0x04
+#define TWL4030_GPIO_GPIODATADIR3                      0x05
+#define TWL4030_GPIO_GPIODATAOUT1                      0x06
+#define TWL4030_GPIO_GPIODATAOUT2                      0x07
+#define TWL4030_GPIO_GPIODATAOUT3                      0x08
+#define TWL4030_GPIO_CLEARGPIODATAOUT1                 0x09
+#define TWL4030_GPIO_CLEARGPIODATAOUT2                 0x0A
+#define TWL4030_GPIO_CLEARGPIODATAOUT3                 0x0B
+#define TWL4030_GPIO_SETGPIODATAOUT1                   0x0C
+#define TWL4030_GPIO_SETGPIODATAOUT2                   0x0D
+#define TWL4030_GPIO_SETGPIODATAOUT3                   0x0E
+#define TWL4030_GPIO_GPIO_DEBEN1                       0x0F
+#define TWL4030_GPIO_GPIO_DEBEN2                       0x10
+#define TWL4030_GPIO_GPIO_DEBEN3                       0x11
+#define TWL4030_GPIO_GPIO_CTRL                         0x12
+#define TWL4030_GPIO_GPIOPUPDCTR1                      0x13
+#define TWL4030_GPIO_GPIOPUPDCTR2                      0x14
+#define TWL4030_GPIO_GPIOPUPDCTR3                      0x15
+#define TWL4030_GPIO_GPIOPUPDCTR4                      0x16
+#define TWL4030_GPIO_GPIOPUPDCTR5                      0x17
+#define TWL4030_GPIO_GPIO_ISR1A                                0x19
+#define TWL4030_GPIO_GPIO_ISR2A                                0x1A
+#define TWL4030_GPIO_GPIO_ISR3A                                0x1B
+#define TWL4030_GPIO_GPIO_IMR1A                                0x1C
+#define TWL4030_GPIO_GPIO_IMR2A                                0x1D
+#define TWL4030_GPIO_GPIO_IMR3A                                0x1E
+#define TWL4030_GPIO_GPIO_ISR1B                                0x1F
+#define TWL4030_GPIO_GPIO_ISR2B                                0x20
+#define TWL4030_GPIO_GPIO_ISR3B                                0x21
+#define TWL4030_GPIO_GPIO_IMR1B                                0x22
+#define TWL4030_GPIO_GPIO_IMR2B                                0x23
+#define TWL4030_GPIO_GPIO_IMR3B                                0x24
+#define TWL4030_GPIO_GPIO_EDR1                         0x28
+#define TWL4030_GPIO_GPIO_EDR2                         0x29
+#define TWL4030_GPIO_GPIO_EDR3                         0x2A
+#define TWL4030_GPIO_GPIO_EDR4                         0x2B
+#define TWL4030_GPIO_GPIO_EDR5                         0x2C
+#define TWL4030_GPIO_GPIO_SIH_CTRL                     0x2D
+
 /*
  * Convience functions to read and write from TWL4030
  *
index e21ddbaf22fcbd6a5e220f7eb28353a60b4af5de..ce74348d443727159d81617d59d7a1b3f994e3e6 100644 (file)
@@ -39,4 +39,4 @@
 int twl6035_i2c_write_u8(u8 chip_no, u8 val, u8 reg);
 int twl6035_i2c_read_u8(u8 chip_no, u8 *val, u8 reg);
 void twl6035_init_settings(void);
-void twl6035_mmc1_poweron_ldo(void);
+int twl6035_mmc1_poweron_ldo(void);
index 8d8a2c9b9da63421b59a7eeb9e02c6a2be285c76..d79c865884031d33d7549bcddc322a9b937dbfcc 100644 (file)
@@ -392,5 +392,6 @@ int hub_port_reset(struct usb_device *dev, int port,
 struct usb_device *usb_alloc_new_device(void *controller);
 
 int usb_new_device(struct usb_device *dev);
+void usb_free_device(void);
 
 #endif /*_USB_H_ */
index 28693020ece477934a03eb5caa1c63ac80dfddf4..a1438d6f94f2b5a074de26bfb1b1c3011e3b33a7 100644 (file)
@@ -246,9 +246,33 @@ struct usb_ehci {
 /*
  * For MXC SOCs
  */
+
+/* values for portsc field */
+#define MXC_EHCI_PHY_LOW_POWER_SUSPEND (1 << 23)
+#define MXC_EHCI_FORCE_FS              (1 << 24)
+#define MXC_EHCI_UTMI_8BIT             (0 << 28)
+#define MXC_EHCI_UTMI_16BIT            (1 << 28)
+#define MXC_EHCI_SERIAL                        (1 << 29)
+#define MXC_EHCI_MODE_UTMI             (0 << 30)
+#define MXC_EHCI_MODE_PHILIPS          (1 << 30)
+#define MXC_EHCI_MODE_ULPI             (2 << 30)
+#define MXC_EHCI_MODE_SERIAL           (3 << 30)
+
+/* values for flags field */
+#define MXC_EHCI_INTERFACE_DIFF_UNI    (0 << 0)
+#define MXC_EHCI_INTERFACE_DIFF_BI     (1 << 0)
+#define MXC_EHCI_INTERFACE_SINGLE_UNI  (2 << 0)
+#define MXC_EHCI_INTERFACE_SINGLE_BI   (3 << 0)
+#define MXC_EHCI_INTERFACE_MASK                (0xf)
+
 #define MXC_EHCI_POWER_PINS_ENABLED    (1 << 5)
-#define MXC_EHCI_TTL_ENABLED           (1 << 6)
-#define MXC_EHCI_INTERNAL_PHY          (1 << 7)
+#define MXC_EHCI_PWR_PIN_ACTIVE_HIGH   (1 << 6)
+#define MXC_EHCI_OC_PIN_ACTIVE_LOW     (1 << 7)
+#define MXC_EHCI_TTL_ENABLED           (1 << 8)
+
+#define MXC_EHCI_INTERNAL_PHY          (1 << 9)
+#define MXC_EHCI_IPPUE_DOWN            (1 << 10)
+#define MXC_EHCI_IPPUE_UP              (1 << 11)
 
 /* Board-specific initialization */
 int board_ehci_hcd_init(int port);
index b9599143afdb4cb701eb98d3f57d3971d9129f30..8c92a0b31beaa2fe52210d7a2dbf2ed22cb28168 100644 (file)
@@ -90,4 +90,8 @@
        void reset_4xx_watchdog(void);
 #endif
 
+/* Freescale i.MX */
+#if defined(CONFIG_IMX_WATCHDOG) && !defined(__ASSEMBLY__)
+       void hw_watchdog_init(void);
+#endif
 #endif /* _WATCHDOG_H_ */
index c88f5d445137066f1322ca2704633625c0e7540b..8546a52f45f991f9357a908632aa794dbcd4d60d 100644 (file)
@@ -28,5 +28,19 @@ int main(void)
        DEFINE(GENERATED_BD_INFO_SIZE,
                (sizeof(struct bd_info) + 15) & ~15);
 
+       DEFINE(GD_SIZE, sizeof(struct global_data));
+
+       DEFINE(GD_BD, offsetof(struct global_data, bd));
+
+#if defined(CONFIG_ARM)
+
+       DEFINE(GD_RELOCADDR, offsetof(struct global_data, relocaddr));
+
+       DEFINE(GD_RELOC_OFF, offsetof(struct global_data, reloc_off));
+
+       DEFINE(GD_START_ADDR_SP, offsetof(struct global_data, start_addr_sp));
+
+#endif
+
        return 0;
 }
index 348144aa705836f3f9ca2a6eb4e0ff7bd63f0d6e..16921e14c9c3ce31b2510cb1f66a16c755d886ef 100644 (file)
@@ -43,6 +43,17 @@ static const char * const compat_names[COMPAT_COUNT] = {
        COMPAT(NVIDIA_TEGRA20_EMC_TABLE, "nvidia,tegra20-emc-table"),
        COMPAT(NVIDIA_TEGRA20_KBC, "nvidia,tegra20-kbc"),
        COMPAT(NVIDIA_TEGRA20_NAND, "nvidia,tegra20-nand"),
+       COMPAT(NVIDIA_TEGRA20_PWM, "nvidia,tegra20-pwm"),
+       COMPAT(NVIDIA_TEGRA20_DC, "nvidia,tegra20-dc"),
+       COMPAT(SMSC_LAN9215, "smsc,lan9215"),
+       COMPAT(SAMSUNG_EXYNOS5_SROMC, "samsung,exynos-sromc"),
+       COMPAT(SAMSUNG_S3C2440_I2C, "samsung,s3c2440-i2c"),
+       COMPAT(SAMSUNG_EXYNOS5_SOUND, "samsung,exynos-sound"),
+       COMPAT(WOLFSON_WM8994_CODEC, "wolfson,wm8994-codec"),
+       COMPAT(SAMSUNG_EXYNOS_SPI, "samsung,exynos-spi"),
+       COMPAT(SAMSUNG_EXYNOS_EHCI, "samsung,exynos-ehci"),
+       COMPAT(SAMSUNG_EXYNOS_USB_PHY, "samsung,exynos-usb-phy"),
+       COMPAT(MAXIM_MAX77686_PMIC, "maxim,max77686_pmic"),
 };
 
 const char *fdtdec_get_compatible(enum fdt_compat_id id)
index f67ed09d039ad8407d0065ccd632504225ea2c85..fd0dfc19d86ea8d949c80f4790fa57576371f90c 100644 (file)
@@ -12,11 +12,12 @@ LDFLAGS := -T $(nandobj)u-boot.lds -Ttext $(CONFIG_SYS_TEXT_BASE) $(LDFLAGS) \
 AFLAGS += -DCONFIG_SPL_BUILD -DCONFIG_NAND_SPL
 CFLAGS += -DCONFIG_SPL_BUILD -DCONFIG_NAND_SPL
 
-SOBJS  = start.o lowlevel_init.o
+SOBJS  = start.o crt0.o lowlevel_init.o
 COBJS  = nand_boot_fsl_nfc.o
 
 SRCS   := $(SRCTREE)/nand_spl/nand_boot_fsl_nfc.c
 SRCS   += $(SRCTREE)/arch/arm/cpu/arm1136/start.S
+SRCS   += $(SRCTREE)/arch/arm/lib/crt0.S
 SRCS   += $(SRCTREE)/board/freescale/mx31pdk/lowlevel_init.S
 OBJS   := $(addprefix $(obj),$(SOBJS) $(COBJS))
 __OBJS := $(SOBJS) $(COBJS)
@@ -50,6 +51,9 @@ $(nandobj)u-boot.lds: $(LDSCRIPT) $(LSTSCRIPT)
 $(obj)%.o:     $(SRCTREE)/arch/arm/cpu/arm1136/%.S
        $(CC) $(AFLAGS) -c -o $@ $<
 
+$(obj)%.o:     $(SRCTREE)/arch/arm/lib/%.S
+       $(CC) $(AFLAGS) -c -o $@ $<
+
 $(obj)%.o:     $(SRCTREE)/board/freescale/mx31pdk/%.S
        $(CC) $(AFLAGS) -c -o $@ $<
 
index da49c100c5c13845fa17c110f110b18fcfad8c95..a26110f393d8c452c3746eed59b28c5c621fdb38 100644 (file)
@@ -54,6 +54,8 @@ SECTIONS
 
        . = ALIGN(4);
 
+       __image_copy_end = .;
+
        .rel.dyn : {
                __rel_dyn_start = .;
                *(.rel*)
index b27189d9b50edc9247eabb353ca3d34c9e5569f0..82489d2405ef370df9282a517685966e32c48b50 100644 (file)
@@ -33,11 +33,12 @@ LDFLAGS := -T $(nandobj)u-boot.lds -Ttext $(CONFIG_SYS_TEXT_BASE) $(LDFLAGS) \
 AFLAGS += -DCONFIG_SPL_BUILD -DCONFIG_NAND_SPL
 CFLAGS += -DCONFIG_SPL_BUILD -DCONFIG_NAND_SPL
 
-SOBJS  = start.o lowlevel_init.o
+SOBJS  = start.o crt0.o lowlevel_init.o
 COBJS  = nand_boot_fsl_nfc.o
 
 SRCS   := $(SRCTREE)/nand_spl/nand_boot_fsl_nfc.c
 SRCS   += $(SRCTREE)/arch/arm/cpu/arm926ejs/start.S
+SRCS   += $(SRCTREE)/arch/arm/lib/crt0.S
 SRCS   += $(SRCTREE)/board/karo/tx25/lowlevel_init.S
 OBJS   := $(addprefix $(obj),$(SOBJS) $(COBJS))
 __OBJS := $(SOBJS) $(COBJS)
@@ -71,6 +72,9 @@ $(nandobj)u-boot.lds: $(LDSCRIPT) $(LSTSCRIPT)
 $(obj)%.o:     $(SRCTREE)/arch/arm/cpu/arm926ejs/%.S
        $(CC) $(AFLAGS) -c -o $@ $<
 
+$(obj)%.o:     $(SRCTREE)/arch/arm/lib/%.S
+       $(CC) $(AFLAGS) -c -o $@ $<
+
 $(obj)%.o:     $(SRCTREE)/board/karo/tx25/%.S
        $(CC) $(AFLAGS) -c -o $@ $<
 
index d52f13adb45deca75d52cabaaecc592963b2ca5f..1ba796ebdf949999f8663ff30049c1c085d43f56 100644 (file)
@@ -103,7 +103,7 @@ static void configure_wait(void)
 void link_local_start(void)
 {
        ip = getenv_IPaddr("llipaddr");
-       if (ip != 0 && (ip & IN_CLASSB_NET) != LINKLOCAL_ADDR) {
+       if (ip != 0 && (ntohl(ip) & IN_CLASSB_NET) != LINKLOCAL_ADDR) {
                puts("invalid link address");
                net_set_state(NETLOOP_FAIL);
                return;
index 59a8ebb3cf339b3c40ff24846c13406e5dc0b9a4..09790eb7cf8202c051d594b5243aa3f843746691 100644 (file)
@@ -40,6 +40,7 @@
 
 static ulong TftpTimeoutMSecs = TIMEOUT;
 static int TftpTimeoutCountMax = TIMEOUT_COUNT;
+static ulong time_start;   /* Record time we started tftp */
 
 /*
  * These globals govern the timeout behavior when attempting a connection to a
@@ -299,6 +300,12 @@ static void tftp_complete(void)
                TftpNumchars++;
        }
 #endif
+       time_start = get_timer(time_start);
+       if (time_start > 0) {
+               puts("\n\t ");  /* Line up with "Loading: " */
+               print_size(NetBootFileXferSize /
+                       time_start * 1000, "/s");
+       }
        puts("\ndone\n");
        net_set_state(NETLOOP_SUCCESS);
 }
@@ -775,6 +782,7 @@ void TftpStart(enum proto_t protocol)
                TftpState = STATE_SEND_RRQ;
        }
 
+       time_start = get_timer(0);
        TftpTimeoutCountMax = TftpRRQTimeoutCountMax;
 
        NetSetTimeout(TftpTimeoutMSecs, TftpTimeout);
index eacf4a2e10b7b3cbcc0b5e506f28ba28f111966e..6dbb1055b6dfc7bf6a58cc0f1a5c93b395c610e2 100644 (file)
@@ -141,6 +141,12 @@ $(OBJTREE)/MLO.byteswap: $(obj)u-boot-spl.bin
        $(OBJTREE)/tools/mkimage -T omapimage -n byteswap \
                -a $(CONFIG_SPL_TEXT_BASE) -d $< $@
 
+ifneq ($(CONFIG_IMX_CONFIG),)
+$(OBJTREE)/SPL:        $(obj)u-boot-spl.bin
+       $(OBJTREE)/tools/mkimage -n  $(SRCTREE)/$(CONFIG_IMX_CONFIG) -T imximage \
+               -e $(CONFIG_SPL_TEXT_BASE) -d $< $@
+endif
+
 ALL-y  += $(obj)u-boot-spl.bin
 
 ifdef CONFIG_SAMSUNG
index 90c7a5d3f39fa37f76005f354976e8f9c8c1270e..37b60b80a7624566d9ecefdd04c0658134bd654d 100644 (file)
@@ -429,7 +429,8 @@ int fw_env_write(char *name, char *value)
  */
 int fw_setenv(int argc, char *argv[])
 {
-       int i, len;
+       int i;
+       size_t len;
        char *name;
        char *value = NULL;
 
index c855f4c17eb82767a67719ec4314e261bede3a6a..40ea3f62a28a54aa683cb15da571a94cc396e224 100644 (file)
@@ -94,7 +94,7 @@ int main(int argc, char *argv[])
        int lockfd = -1;
        int retval = EXIT_SUCCESS;
 
-       lockfd = open(lockname, O_WRONLY | O_CREAT | O_TRUNC);
+       lockfd = open(lockname, O_WRONLY | O_CREAT | O_TRUNC, 0666);
        if (-1 == lockfd) {
                fprintf(stderr, "Error opening lock file %s\n", lockname);
                return EXIT_FAILURE;
index 63f88b6c422390fa27b47b781f051776cc7978ff..a93d7eb543a22df27a187e023c2eba030a670ea5 100644 (file)
@@ -515,7 +515,14 @@ static void imximage_set_header(void *ptr, struct stat *sbuf, int ifd,
 
        /* Set the imx header */
        (*set_imx_hdr)(imxhdr, dcd_len, params->ep, imxhdr->flash_offset);
-       *header_size_ptr = sbuf->st_size + imxhdr->flash_offset;
+
+       /*
+        * ROM bug alert
+        * mx53 only loads 512 byte multiples.
+        * The remaining fraction of a block bytes would
+        * not be loaded.
+        */
+       *header_size_ptr = ROUND(sbuf->st_size + imxhdr->flash_offset, 512);
 }
 
 int imximage_check_params(struct mkimage_params *params)