]> git.kernelconcepts.de Git - karo-tx-uboot.git/commitdiff
Unified codebase for TX28, TX48, TX51, TX53
authorLothar Waßmann <LW@KARO-electronics.de>
Wed, 24 Oct 2012 15:28:44 +0000 (17:28 +0200)
committerLothar Waßmann <LW@KARO-electronics.de>
Wed, 24 Oct 2012 15:28:44 +0000 (17:28 +0200)
544 files changed:
.gitignore
MAINTAINERS
Makefile
README
arch/arm/config.mk
arch/arm/cpu/arm926ejs/config.mk
arch/arm/cpu/arm926ejs/cpu.c
arch/arm/cpu/arm926ejs/mx25/generic.c
arch/arm/cpu/arm926ejs/mx28/Makefile
arch/arm/cpu/arm926ejs/mx28/debug.c [new file with mode: 0644]
arch/arm/cpu/arm926ejs/mx28/debug.h [new file with mode: 0644]
arch/arm/cpu/arm926ejs/mx28/mx28.c
arch/arm/cpu/arm926ejs/mx28/mx28_init.h
arch/arm/cpu/arm926ejs/mx28/spl_boot.c
arch/arm/cpu/arm926ejs/mx28/spl_lradc_init.c [new file with mode: 0644]
arch/arm/cpu/arm926ejs/mx28/spl_mem_init.c
arch/arm/cpu/arm926ejs/mx28/spl_power_init.c
arch/arm/cpu/arm926ejs/mx28/timer.c
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/ddr.c [deleted file]
arch/arm/cpu/armv7/am33xx/ddr2.c [new file with mode: 0644]
arch/arm/cpu/armv7/am33xx/ddr3.c [new file with mode: 0644]
arch/arm/cpu/armv7/am33xx/elm.c [new file with mode: 0644]
arch/arm/cpu/armv7/am33xx/emif4.c
arch/arm/cpu/armv7/am33xx/mem.c [new file with mode: 0644]
arch/arm/cpu/armv7/am33xx/sys_info.c
arch/arm/cpu/armv7/cache_v7.c
arch/arm/cpu/armv7/config.mk
arch/arm/cpu/armv7/cpu.c
arch/arm/cpu/armv7/exynos/Makefile
arch/arm/cpu/armv7/exynos/clock.c
arch/arm/cpu/armv7/exynos/power.c [new file with mode: 0644]
arch/arm/cpu/armv7/exynos/system.c [new file with mode: 0644]
arch/arm/cpu/armv7/imx-common/cpu.c
arch/arm/cpu/armv7/imx-common/timer.c
arch/arm/cpu/armv7/mx5/Makefile
arch/arm/cpu/armv7/mx5/clock.c
arch/arm/cpu/armv7/mx5/iomux-v3.c [new file with mode: 0644]
arch/arm/cpu/armv7/mx5/lowlevel_init.S
arch/arm/cpu/armv7/mx5/soc.c
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/boot-common.c
arch/arm/cpu/armv7/omap-common/emif-common.c
arch/arm/cpu/armv7/omap-common/hwinit-common.c
arch/arm/cpu/armv7/omap-common/lowlevel_init.S
arch/arm/cpu/armv7/omap-common/reset.c [moved from arch/arm/cpu/armv7/omap-common/reset.S with 70% similarity]
arch/arm/cpu/armv7/omap-common/spl_ymodem.c
arch/arm/cpu/armv7/omap-common/timer.c
arch/arm/cpu/armv7/omap3/board.c
arch/arm/cpu/armv7/omap3/clock.c
arch/arm/cpu/armv7/omap3/lowlevel_init.S
arch/arm/cpu/armv7/omap4/clocks.c
arch/arm/cpu/armv7/omap5/hwinit.c
arch/arm/cpu/armv7/s5pc1xx/cache.S
arch/arm/cpu/armv7/s5pc1xx/reset.S
arch/arm/cpu/armv7/start.S
arch/arm/cpu/armv7/tegra2/Makefile
arch/arm/cpu/armv7/tegra2/ap20.c
arch/arm/cpu/armv7/tegra2/board.c
arch/arm/cpu/armv7/tegra2/clock.c
arch/arm/cpu/armv7/tegra2/crypto.c [new file with mode: 0644]
arch/arm/cpu/armv7/tegra2/crypto.h [new file with mode: 0644]
arch/arm/cpu/armv7/tegra2/emc.c [new file with mode: 0644]
arch/arm/cpu/armv7/tegra2/funcmux.c
arch/arm/cpu/armv7/tegra2/lowlevel_init.S
arch/arm/cpu/armv7/tegra2/pmu.c [new file with mode: 0644]
arch/arm/cpu/armv7/tegra2/warmboot.c [new file with mode: 0644]
arch/arm/cpu/armv7/tegra2/warmboot_avp.c [new file with mode: 0644]
arch/arm/cpu/armv7/tegra2/warmboot_avp.h [new file with mode: 0644]
arch/arm/cpu/armv7/u8500/lowlevel.S
arch/arm/dts/am33xx.dtsi [new file with mode: 0644]
arch/arm/dts/mx28.dtsi [new file with mode: 0644]
arch/arm/dts/mx51.dtsi [new file with mode: 0644]
arch/arm/dts/mx53.dtsi [new file with mode: 0644]
arch/arm/dts/tegra20.dtsi
arch/arm/include/asm/arch-am33xx/clocks_am33xx.h
arch/arm/include/asm/arch-am33xx/cpu.h
arch/arm/include/asm/arch-am33xx/da8xx-fb.h [new file with mode: 0644]
arch/arm/include/asm/arch-am33xx/ddr3_defs.h [new file with mode: 0644]
arch/arm/include/asm/arch-am33xx/ddr_defs.h
arch/arm/include/asm/arch-am33xx/gpio.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/mmc_host_def.h
arch/arm/include/asm/arch-am33xx/nand.h [new file with mode: 0644]
arch/arm/include/asm/arch-am33xx/sys_proto.h
arch/arm/include/asm/arch-exynos/clk.h
arch/arm/include/asm/arch-exynos/cpu.h
arch/arm/include/asm/arch-exynos/dsim.h [new file with mode: 0644]
arch/arm/include/asm/arch-exynos/fb.h [new file with mode: 0644]
arch/arm/include/asm/arch-exynos/mipi_dsim.h [new file with mode: 0644]
arch/arm/include/asm/arch-exynos/power.h
arch/arm/include/asm/arch-exynos/system.h [new file with mode: 0644]
arch/arm/include/asm/arch-exynos/tzpc.h
arch/arm/include/asm/arch-mx25/clock.h
arch/arm/include/asm/arch-mx25/imx-regs.h
arch/arm/include/asm/arch-mx28/imx-regs.h
arch/arm/include/asm/arch-mx28/mxsfb.h [new file with mode: 0644]
arch/arm/include/asm/arch-mx28/regs-lcdif.h [new file with mode: 0644]
arch/arm/include/asm/arch-mx28/regs-lradc.h [new file with mode: 0644]
arch/arm/include/asm/arch-mx28/sys_proto.h
arch/arm/include/asm/arch-mx5/clock.h
arch/arm/include/asm/arch-mx5/crm_regs.h
arch/arm/include/asm/arch-mx5/imx-regs.h
arch/arm/include/asm/arch-mx5/imx_iim.h [new file with mode: 0644]
arch/arm/include/asm/arch-mx5/iomux-mx51.h [new file with mode: 0644]
arch/arm/include/asm/arch-mx5/iomux-mx53.h [new file with mode: 0644]
arch/arm/include/asm/arch-mx5/iomux-v3.h [new file with mode: 0644]
arch/arm/include/asm/arch-mx5/iomux.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/clock.h
arch/arm/include/asm/arch-mx6/crm_regs.h [moved from arch/arm/include/asm/arch-mx6/ccm_regs.h with 99% similarity]
arch/arm/include/asm/arch-mx6/imx-regs.h
arch/arm/include/asm/arch-mx6/iomux-v3.h
arch/arm/include/asm/arch-mx6/sys_proto.h
arch/arm/include/asm/arch-omap3/cpu.h
arch/arm/include/asm/arch-omap3/mux.h
arch/arm/include/asm/arch-omap4/cpu.h
arch/arm/include/asm/arch-omap4/mux_omap4.h
arch/arm/include/asm/arch-omap4/omap.h
arch/arm/include/asm/arch-omap5/cpu.h
arch/arm/include/asm/arch-omap5/mux_omap5.h
arch/arm/include/asm/arch-omap5/omap.h
arch/arm/include/asm/arch-tegra2/ap20.h [moved from arch/arm/cpu/armv7/tegra2/ap20.h with 96% similarity]
arch/arm/include/asm/arch-tegra2/apb_misc.h [new file with mode: 0644]
arch/arm/include/asm/arch-tegra2/clk_rst.h
arch/arm/include/asm/arch-tegra2/clock.h
arch/arm/include/asm/arch-tegra2/emc.h [new file with mode: 0644]
arch/arm/include/asm/arch-tegra2/flow.h [new file with mode: 0644]
arch/arm/include/asm/arch-tegra2/fuse.h [new file with mode: 0644]
arch/arm/include/asm/arch-tegra2/gp_padctrl.h [new file with mode: 0644]
arch/arm/include/asm/arch-tegra2/pmu.h [new file with mode: 0644]
arch/arm/include/asm/arch-tegra2/sdram_param.h [new file with mode: 0644]
arch/arm/include/asm/arch-tegra2/tegra2.h
arch/arm/include/asm/arch-tegra2/tegra_i2c.h
arch/arm/include/asm/arch-tegra2/warmboot.h [new file with mode: 0644]
arch/arm/include/asm/linkage.h [new file with mode: 0644]
arch/arm/include/asm/system.h
arch/arm/lib/cache-cp15.c
arch/arm/lib/cache.c
board/cm_t35/cm_t35.c
board/davinci/ea20/ea20.c
board/denx/m28evk/m28evk.c
board/denx/m28evk/spl_boot.c
board/esg/ima3-mx53/Makefile [new file with mode: 0644]
board/esg/ima3-mx53/ima3-mx53.c [new file with mode: 0644]
board/esg/ima3-mx53/imximage.cfg [new file with mode: 0644]
board/freescale/mx28evk/iomux.c
board/freescale/mx53loco/mx53loco.c
board/freescale/mx6qsabrelite/mx6qsabrelite.c
board/htkw/mcx/mcx.c
board/karo/common/Makefile [new file with mode: 0644]
board/karo/common/fdt.c [new file with mode: 0644]
board/karo/common/karo.h [new file with mode: 0644]
board/karo/common/splashimage.c [new file with mode: 0644]
board/karo/dts/tx28.dts [new file with mode: 0644]
board/karo/dts/tx48.dts [new file with mode: 0644]
board/karo/dts/tx51.dts [new file with mode: 0644]
board/karo/dts/tx53.dts [new file with mode: 0644]
board/karo/tx28/Makefile [new file with mode: 0644]
board/karo/tx28/config.mk [new file with mode: 0644]
board/karo/tx28/flash.c [new file with mode: 0644]
board/karo/tx28/spl_boot.c [new file with mode: 0644]
board/karo/tx28/tx28.c [new file with mode: 0644]
board/karo/tx28/u-boot.bd [new file with mode: 0644]
board/karo/tx48/Makefile [new file with mode: 0644]
board/karo/tx48/config.mk [new file with mode: 0644]
board/karo/tx48/spl.c [new file with mode: 0644]
board/karo/tx48/tx48.c [new file with mode: 0644]
board/karo/tx48/u-boot.lds [new file with mode: 0644]
board/karo/tx51/Makefile [new file with mode: 0644]
board/karo/tx51/config.mk [new file with mode: 0644]
board/karo/tx51/lowlevel_init.S [new file with mode: 0644]
board/karo/tx51/tx51.c [new file with mode: 0644]
board/karo/tx51/u-boot.lds [new file with mode: 0644]
board/karo/tx53/Makefile [new file with mode: 0644]
board/karo/tx53/config.mk [new file with mode: 0644]
board/karo/tx53/lowlevel_init.S [new file with mode: 0644]
board/karo/tx53/tx53.c [new file with mode: 0644]
board/karo/tx53/u-boot.lds [new file with mode: 0644]
board/logicpd/omap3som/omap3logic.c
board/nvidia/common/Makefile
board/nvidia/common/board.c
board/nvidia/common/emc.c [new file with mode: 0644]
board/nvidia/common/emc.h [new file with mode: 0644]
board/nvidia/dts/tegra2-seaboard.dts
board/pandora/pandora.c
board/pandora/pandora.h
board/samsung/smdk5250/tzpc_init.c
board/samsung/trats/trats.c
board/samsung/universal_c210/universal.c
board/teejet/mt_ventoux/mt_ventoux.c
board/ti/am335x/evm.c
board/ti/omap5912osk/omap5912osk.c
board/ti/omap5_evm/evm.c
board/ti/omap730p2/omap730p2.c
board/ti/panda/panda_mux_data.h
board/ttcontrol/vision2/vision2.c
boards.cfg
common/Makefile
common/cmd_bootce.c [new file with mode: 0644]
common/cmd_fdt.c
common/cmd_iim.c [new file with mode: 0644]
common/cmd_nand.c
common/cmd_pata.c [new file with mode: 0644]
common/cmd_sata.c
common/cmd_time.c
common/env_nand.c
common/lcd.c
common/main.c
common/xyzModem.c
config.mk
disk/part.c
doc/README.KARO [new file with mode: 0755]
doc/README.KARO-FDT [new file with mode: 0644]
doc/README.KARO-TX28 [new file with mode: 0644]
doc/README.KARO-TX48 [new file with mode: 0644]
doc/README.KARO-TX51 [new file with mode: 0644]
doc/README.KARO-TX53 [new file with mode: 0644]
doc/SPL/README.omap3
drivers/bios_emulator/x86emu/prim_ops.c
drivers/block/Makefile
drivers/block/dwc_ahsata.c [new file with mode: 0644]
drivers/block/dwc_ahsata.h [new file with mode: 0644]
drivers/block/mxc_ata.h [new file with mode: 0644]
drivers/gpio/Makefile
drivers/gpio/am33xx_gpio.c [new file with mode: 0644]
drivers/gpio/gpiolib.c [new file with mode: 0644]
drivers/gpio/mxc_gpio.c
drivers/i2c/tegra_i2c.c
drivers/input/Makefile
drivers/input/input.c [new file with mode: 0644]
drivers/input/key_matrix.c [new file with mode: 0644]
drivers/input/mxc_keyb.c [new file with mode: 0644]
drivers/input/tegra-kbc.c [new file with mode: 0644]
drivers/misc/Makefile
drivers/misc/imx_iim.c [new file with mode: 0644]
drivers/misc/pmic_dialog.c [new file with mode: 0644]
drivers/misc/pmic_max8997.c [new file with mode: 0644]
drivers/mmc/fsl_esdhc.c
drivers/mmc/imx_ssp_mmc.c [new file with mode: 0644]
drivers/mmc/mxsmmc.c
drivers/mmc/omap_hsmmc.c
drivers/mtd/nand/Makefile
drivers/mtd/nand/am33xx_nand.c [new file with mode: 0644]
drivers/mtd/nand/mxc_nand.c
drivers/mtd/nand/mxs_nand.c
drivers/mtd/nand/nand_base.c
drivers/mtd/nand/nand_bbt.c
drivers/mtd/nand/nand_spl_simple.c
drivers/mtd/spi/Makefile
drivers/mtd/spi/imx_spi_nor_atmel.c [new file with mode: 0644]
drivers/mtd/spi/imx_spi_nor_sst.c [new file with mode: 0644]
drivers/net/Makefile
drivers/net/cpsw.c [new file with mode: 0644]
drivers/net/fec_mxc.c
drivers/net/fec_mxc.h
drivers/net/phy/phy.c
drivers/net/smc911x.h
drivers/power/Makefile
drivers/power/tps6586x.c [new file with mode: 0644]
drivers/power/twl6035.c [new file with mode: 0644]
drivers/serial/serial.c
drivers/serial/stmp3xxx_dbguart.c [new file with mode: 0644]
drivers/serial/stmp3xxx_dbguart.h [new file with mode: 0644]
drivers/spi/imx_cspi.c [new file with mode: 0644]
drivers/spi/imx_ecspi.c [new file with mode: 0644]
drivers/spi/imx_spi_cpld.c [new file with mode: 0644]
drivers/spi/imx_spi_pmic.c [new file with mode: 0644]
drivers/spi/mxs_spi.c
drivers/usb/host/ehci-mx6.c
drivers/usb/host/ehci-mxc.c
drivers/video/Makefile
drivers/video/da8xx-fb.c
drivers/video/exynos_fb.c [new file with mode: 0644]
drivers/video/exynos_fb.h [new file with mode: 0644]
drivers/video/exynos_fimd.c [new file with mode: 0644]
drivers/video/exynos_mipi_dsi.c [new file with mode: 0644]
drivers/video/exynos_mipi_dsi_common.c [new file with mode: 0644]
drivers/video/exynos_mipi_dsi_common.h [new file with mode: 0644]
drivers/video/exynos_mipi_dsi_lowlevel.c [new file with mode: 0644]
drivers/video/exynos_mipi_dsi_lowlevel.h [new file with mode: 0644]
drivers/video/ipu_common.c
drivers/video/ipu_disp.c
drivers/video/ipu_regs.h
drivers/video/mx2fb.c [new file with mode: 0644]
drivers/video/mxc_epdc_fb.c [new file with mode: 0644]
drivers/video/mxc_epdc_fb.h [new file with mode: 0644]
drivers/video/mxc_ipuv3_fb.c
drivers/video/mxsfb.c [new file with mode: 0644]
drivers/video/s6e8ax0.c [new file with mode: 0644]
dts/Makefile
include/aes.h [new file with mode: 0644]
include/ahci.h
include/asm-arm/fec.h [new file with mode: 0644]
include/asm-arm/mmu.h [new file with mode: 0644]
include/asm-generic/gpio.h
include/common.h
include/configs/P1023RDS.h
include/configs/P2020COME.h
include/configs/am3517_crane.h
include/configs/am3517_evm.h
include/configs/at91sam9263ek.h
include/configs/cam_enc_4xx.h
include/configs/cm_t35.h
include/configs/da830evm.h
include/configs/devkit8000.h
include/configs/ea20.h
include/configs/eb_cpux9k2.h
include/configs/flea3.h
include/configs/hawkboard.h
include/configs/igep00x0.h
include/configs/ima3-mx53.h [new file with mode: 0644]
include/configs/imx27lite-common.h
include/configs/m28evk.h
include/configs/mcx.h
include/configs/meesc.h
include/configs/mv-common.h
include/configs/mx23_evk.h [new file with mode: 0644]
include/configs/mx25_3stack.h [new file with mode: 0644]
include/configs/mx25_3stack_mfg.h [new file with mode: 0644]
include/configs/mx25pdk.h
include/configs/mx28_evk.h [new file with mode: 0644]
include/configs/mx28evk.h
include/configs/mx31_3stack.h [new file with mode: 0644]
include/configs/mx31pdk.h
include/configs/mx35_3stack.h [new file with mode: 0644]
include/configs/mx35_3stack_mfg.h [new file with mode: 0644]
include/configs/mx35_3stack_mmc.h [new file with mode: 0644]
include/configs/mx35pdk.h
include/configs/mx50_arm2.h [new file with mode: 0644]
include/configs/mx50_arm2_iram.h [new file with mode: 0644]
include/configs/mx50_arm2_lpddr2.h [new file with mode: 0644]
include/configs/mx50_arm2_mfg.h [new file with mode: 0644]
include/configs/mx51_3stack.h [new file with mode: 0644]
include/configs/mx51_3stack_android.h [new file with mode: 0644]
include/configs/mx51_bbg.h [new file with mode: 0644]
include/configs/mx51_bbg_android.h [new file with mode: 0644]
include/configs/mx51_bbg_mfg.h [new file with mode: 0644]
include/configs/mx53_arm2.h [new file with mode: 0644]
include/configs/mx53_arm2_ddr3.h [new file with mode: 0644]
include/configs/mx53_evk.h [new file with mode: 0644]
include/configs/mx53_evk_mfg.h [new file with mode: 0644]
include/configs/mx53loco.h
include/configs/mx6qarm2.h
include/configs/mx6qsabrelite.h
include/configs/omap3_beagle.h
include/configs/omap3_evm_common.h
include/configs/omap3_overo.h
include/configs/omap3_pandora.h
include/configs/omap4_common.h
include/configs/omap5912osk.h
include/configs/omap5_evm.h
include/configs/omap730p2.h
include/configs/otc570.h
include/configs/p1_p2_rdb_pc.h
include/configs/seaboard.h
include/configs/spear-common.h
include/configs/tam3517-common.h
include/configs/tegra2-common.h
include/configs/trats.h
include/configs/tricorder.h
include/configs/triton320.h [new file with mode: 0644]
include/configs/tx25.h
include/configs/tx28.h [new file with mode: 0644]
include/configs/tx48.h [new file with mode: 0644]
include/configs/tx51.h [new file with mode: 0644]
include/configs/tx53.h [new file with mode: 0644]
include/configs/zmx25.h
include/dialog_pmic.h [new file with mode: 0644]
include/environment.h
include/fdtdec.h
include/fsl_esdhc.h
include/fsl_pmic.h
include/imx_spi.h [new file with mode: 0644]
include/imx_spi_nor.h [new file with mode: 0644]
include/imx_ssp_mmc.h [new file with mode: 0644]
include/input.h [new file with mode: 0644]
include/ipu_pixfmt.h
include/key_matrix.h [new file with mode: 0644]
include/lcd.h
include/linux/input.h [new file with mode: 0644]
include/linux/linkage.h
include/linux/mtd/bbm.h
include/max8997_pmic.h [new file with mode: 0644]
include/max8998_pmic.h
include/mx2fb.h [new file with mode: 0644]
include/mxc_keyb.h [new file with mode: 0644]
include/nand.h
include/netdev.h
include/pata.h [new file with mode: 0644]
include/pmic.h
include/tegra-kbc.h [new file with mode: 0644]
include/tps6586x.h [new file with mode: 0644]
include/twl6035.h [new file with mode: 0644]
include/wince.h [new file with mode: 0644]
lib/Makefile
lib/aes.c [new file with mode: 0644]
lib/fdtdec.c
net/bootp.c
net/bootp.h
tools/elftosb/COPYING [new file with mode: 0644]
tools/elftosb/ReadMe.txt [new file with mode: 0644]
tools/elftosb/bdfiles/basic_test_cmd.e [new file with mode: 0644]
tools/elftosb/bdfiles/complex.bd [new file with mode: 0644]
tools/elftosb/bdfiles/habtest.bd [new file with mode: 0644]
tools/elftosb/bdfiles/simple.e [new file with mode: 0644]
tools/elftosb/bdfiles/test_cmd.e [new file with mode: 0644]
tools/elftosb/common/AESKey.cpp [new file with mode: 0644]
tools/elftosb/common/AESKey.h [new file with mode: 0644]
tools/elftosb/common/Blob.cpp [new file with mode: 0644]
tools/elftosb/common/Blob.h [new file with mode: 0644]
tools/elftosb/common/BootImage.h [new file with mode: 0644]
tools/elftosb/common/DataSource.cpp [new file with mode: 0644]
tools/elftosb/common/DataSource.h [new file with mode: 0644]
tools/elftosb/common/DataSourceImager.cpp [new file with mode: 0644]
tools/elftosb/common/DataSourceImager.h [new file with mode: 0644]
tools/elftosb/common/DataTarget.cpp [new file with mode: 0644]
tools/elftosb/common/DataTarget.h [new file with mode: 0644]
tools/elftosb/common/ELF.h [new file with mode: 0644]
tools/elftosb/common/ELFSourceFile.cpp [new file with mode: 0644]
tools/elftosb/common/ELFSourceFile.h [new file with mode: 0644]
tools/elftosb/common/EncoreBootImage.cpp [new file with mode: 0644]
tools/elftosb/common/EncoreBootImage.h [new file with mode: 0644]
tools/elftosb/common/EndianUtilities.h [new file with mode: 0644]
tools/elftosb/common/EvalContext.cpp [new file with mode: 0644]
tools/elftosb/common/EvalContext.h [new file with mode: 0644]
tools/elftosb/common/ExcludesListMatcher.cpp [new file with mode: 0644]
tools/elftosb/common/ExcludesListMatcher.h [new file with mode: 0644]
tools/elftosb/common/GHSSecInfo.cpp [new file with mode: 0644]
tools/elftosb/common/GHSSecInfo.h [new file with mode: 0644]
tools/elftosb/common/GlobMatcher.cpp [new file with mode: 0644]
tools/elftosb/common/GlobMatcher.h [new file with mode: 0644]
tools/elftosb/common/HexValues.cpp [new file with mode: 0644]
tools/elftosb/common/HexValues.h [new file with mode: 0644]
tools/elftosb/common/IVTDataSource.cpp [new file with mode: 0644]
tools/elftosb/common/IVTDataSource.h [new file with mode: 0644]
tools/elftosb/common/Logging.cpp [new file with mode: 0644]
tools/elftosb/common/Logging.h [new file with mode: 0644]
tools/elftosb/common/Operation.cpp [new file with mode: 0644]
tools/elftosb/common/Operation.h [new file with mode: 0644]
tools/elftosb/common/OptionContext.h [new file with mode: 0644]
tools/elftosb/common/OptionDictionary.cpp [new file with mode: 0644]
tools/elftosb/common/OptionDictionary.h [new file with mode: 0644]
tools/elftosb/common/OutputSection.cpp [new file with mode: 0644]
tools/elftosb/common/OutputSection.h [new file with mode: 0644]
tools/elftosb/common/Random.cpp [new file with mode: 0644]
tools/elftosb/common/Random.h [new file with mode: 0644]
tools/elftosb/common/RijndaelCBCMAC.cpp [new file with mode: 0644]
tools/elftosb/common/RijndaelCBCMAC.h [new file with mode: 0644]
tools/elftosb/common/SHA1.cpp [new file with mode: 0644]
tools/elftosb/common/SHA1.h [new file with mode: 0644]
tools/elftosb/common/SRecordSourceFile.cpp [new file with mode: 0644]
tools/elftosb/common/SRecordSourceFile.h [new file with mode: 0644]
tools/elftosb/common/SearchPath.cpp [new file with mode: 0644]
tools/elftosb/common/SearchPath.h [new file with mode: 0644]
tools/elftosb/common/SourceFile.cpp [new file with mode: 0644]
tools/elftosb/common/SourceFile.h [new file with mode: 0644]
tools/elftosb/common/StELFFile.cpp [new file with mode: 0644]
tools/elftosb/common/StELFFile.h [new file with mode: 0644]
tools/elftosb/common/StExecutableImage.cpp [new file with mode: 0644]
tools/elftosb/common/StExecutableImage.h [new file with mode: 0644]
tools/elftosb/common/StSRecordFile.cpp [new file with mode: 0644]
tools/elftosb/common/StSRecordFile.h [new file with mode: 0644]
tools/elftosb/common/StringMatcher.h [new file with mode: 0644]
tools/elftosb/common/Value.cpp [new file with mode: 0644]
tools/elftosb/common/Value.h [new file with mode: 0644]
tools/elftosb/common/Version.cpp [new file with mode: 0644]
tools/elftosb/common/Version.h [new file with mode: 0644]
tools/elftosb/common/crc.cpp [new file with mode: 0644]
tools/elftosb/common/crc.h [new file with mode: 0644]
tools/elftosb/common/format_string.cpp [new file with mode: 0644]
tools/elftosb/common/format_string.h [new file with mode: 0644]
tools/elftosb/common/int_size.h [new file with mode: 0644]
tools/elftosb/common/options.cpp [new file with mode: 0644]
tools/elftosb/common/options.h [new file with mode: 0644]
tools/elftosb/common/rijndael.cpp [new file with mode: 0644]
tools/elftosb/common/rijndael.h [new file with mode: 0644]
tools/elftosb/common/smart_ptr.h [new file with mode: 0644]
tools/elftosb/common/stdafx.cpp [new file with mode: 0644]
tools/elftosb/common/stdafx.h [new file with mode: 0644]
tools/elftosb/elftosb.ccscc [new file with mode: 0644]
tools/elftosb/elftosb.xcodeproj/creed.mode1 [new file with mode: 0644]
tools/elftosb/elftosb.xcodeproj/creed.mode1v3 [new file with mode: 0644]
tools/elftosb/elftosb.xcodeproj/creed.pbxuser [new file with mode: 0644]
tools/elftosb/elftosb.xcodeproj/project.pbxproj [new file with mode: 0644]
tools/elftosb/elftosb2/BootImageGenerator.cpp [new file with mode: 0644]
tools/elftosb/elftosb2/BootImageGenerator.h [new file with mode: 0644]
tools/elftosb/elftosb2/ConversionController.cpp [new file with mode: 0644]
tools/elftosb/elftosb2/ConversionController.h [new file with mode: 0644]
tools/elftosb/elftosb2/Doxyfile [new file with mode: 0644]
tools/elftosb/elftosb2/ElftosbAST.cpp [new file with mode: 0644]
tools/elftosb/elftosb2/ElftosbAST.h [new file with mode: 0644]
tools/elftosb/elftosb2/ElftosbErrors.h [new file with mode: 0644]
tools/elftosb/elftosb2/ElftosbLexer.cpp [new file with mode: 0644]
tools/elftosb/elftosb2/ElftosbLexer.h [new file with mode: 0644]
tools/elftosb/elftosb2/EncoreBootImageGenerator.cpp [new file with mode: 0644]
tools/elftosb/elftosb2/EncoreBootImageGenerator.h [new file with mode: 0644]
tools/elftosb/elftosb2/FlexLexer.h [new file with mode: 0644]
tools/elftosb/elftosb2/elftosb.cpp [new file with mode: 0644]
tools/elftosb/elftosb2/elftosb2.vcproj [new file with mode: 0644]
tools/elftosb/elftosb2/elftosb_lexer.cpp [new file with mode: 0644]
tools/elftosb/elftosb2/elftosb_lexer.l [new file with mode: 0644]
tools/elftosb/elftosb2/elftosb_parser.tab.cpp [new file with mode: 0644]
tools/elftosb/elftosb2/elftosb_parser.tab.hpp [new file with mode: 0644]
tools/elftosb/elftosb2/elftosb_parser.y [new file with mode: 0644]
tools/elftosb/encryptgpk/encryptgpk.cpp [new file with mode: 0644]
tools/elftosb/encryptgpk/encryptgpk.vcproj [new file with mode: 0644]
tools/elftosb/keygen/Doxyfile [new file with mode: 0644]
tools/elftosb/keygen/keygen.cpp [new file with mode: 0644]
tools/elftosb/keygen/keygen.vcproj [new file with mode: 0644]
tools/elftosb/makefile [new file with mode: 0644]
tools/elftosb/makefile.rules [new file with mode: 0644]
tools/elftosb/sbtool/Doxyfile [new file with mode: 0644]
tools/elftosb/sbtool/EncoreBootImageReader.cpp [new file with mode: 0644]
tools/elftosb/sbtool/EncoreBootImageReader.h [new file with mode: 0644]
tools/elftosb/sbtool/sbtool.cpp [new file with mode: 0644]
tools/elftosb/sbtool/sbtool.vcproj [new file with mode: 0644]
tools/elftosb/stdafx.h [new file with mode: 0644]
tools/elftosb/test_elftosb.bat [new file with mode: 0644]
tools/elftosb/test_elftosb.sh [new file with mode: 0755]
tools/elftosb/test_files/hello_NOR_arm [new file with mode: 0644]
tools/elftosb/test_files/hello_NOR_arm.map [new file with mode: 0644]
tools/elftosb/test_files/hello_NOR_mixed [new file with mode: 0644]
tools/elftosb/test_files/hello_NOR_mixed.map [new file with mode: 0644]
tools/elftosb/test_files/hello_NOR_thumb [new file with mode: 0644]
tools/elftosb/test_files/hello_NOR_thumb.map [new file with mode: 0644]
tools/elftosb/test_files/hostlink [new file with mode: 0644]
tools/elftosb/test_files/player_linfix.elf [new file with mode: 0644]
tools/elftosb/test_files/plugin_complex [new file with mode: 0644]
tools/elftosb/test_files/plugin_hello [new file with mode: 0644]
tools/elftosb/test_files/redboot_gcc.srec [new file with mode: 0644]
tools/elftosb/test_files/rom_nand_ldr_profile [new file with mode: 0644]
tools/elftosb/test_files/sd_player_gcc [new file with mode: 0644]
tools/elftosb/test_files/sd_player_gcc.srec [new file with mode: 0644]
tools/elftosb/test_files/test0.key [new file with mode: 0644]
tools/elftosb/winsupport/unistd.h [new file with mode: 0644]
tools/gcc-version.sh [new file with mode: 0755]
tools/logos/karo.bmp [new file with mode: 0644]

index 0f32fd8954337645d4cb0373f1435f3b0e48034e..e8ba8513abd66867f0386ac1397a45c614c98306 100644 (file)
@@ -59,6 +59,7 @@ patches-*
 # quilt's files
 patches
 series
+.pc
 
 # gdb files
 .gdb_history
index a28967fe7dbcf9b40335d66d18dad2a66d60e3d7..f796872dca27405d801f95b77d33a10fcc008c5f 100644 (file)
@@ -796,6 +796,12 @@ Dave Purdy <david.c.purdy@gmail.com>
 
        pogo_e02        ARM926EJS (Kirkwood SoC)
 
+Sricharan R <r.sricharan@ti.com>
+
+       omap4_panda     ARM ARMV7 (OMAP4xx SoC)
+       omap4_sdp4430   ARM ARMV7 (OMAP4xx SoC)
+       omap5_evm       ARM ARMV7 (OMAP5xx Soc)
+
 Thierry Reding <thierry.reding@avionic-design.de>
 
        plutux          Tegra2 (ARM7 & A9 Dual Core)
@@ -868,12 +874,6 @@ Greg Ungerer <greg.ungerer@opengear.com>
        cm4116          ks8695p
        cm4148          ks8695p
 
-Aneesh V <aneesh@ti.com>
-
-       omap4_panda     ARM ARMV7 (OMAP4xx SoC)
-       omap4_sdp4430   ARM ARMV7 (OMAP4xx SoC)
-       omap5_evm       ARM ARMV7 (OMAP5xx Soc)
-
 Marek Vasut <marek.vasut@gmail.com>
 
        balloon3        xscale/pxa
index 023ea23a38bdb3d187eaf2950999b989820bfa92..be62a69e40f16664bb6ba2b1d57841b41f8badaa 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -30,8 +30,6 @@ U_BOOT_VERSION = $(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)
 else
 U_BOOT_VERSION = $(VERSION).$(PATCHLEVEL)$(EXTRAVERSION)
 endif
-TIMESTAMP_FILE = $(obj)include/generated/timestamp_autogenerated.h
-VERSION_FILE = $(obj)include/generated/version_autogenerated.h
 
 HOSTARCH := $(shell uname -m | \
        sed -e s/i.86/x86/ \
@@ -130,6 +128,9 @@ src :=
 endif
 export obj src
 
+TIMESTAMP_FILE = $(obj)include/generated/timestamp_autogenerated.h
+VERSION_FILE = $(obj)include/generated/version_autogenerated.h
+
 # Make sure CDPATH settings don't interfere
 unexport CDPATH
 
@@ -449,9 +450,11 @@ $(obj)u-boot.ais:       $(obj)spl/u-boot-spl.bin $(obj)u-boot.bin
                        $(obj)u-boot.ais
                rm $(obj)spl/u-boot-spl{,-pad}.ais
 
-$(obj)u-boot.sb:       $(obj)u-boot.bin $(obj)spl/u-boot-spl.bin
-               elftosb -zdf imx28 -c $(TOPDIR)/board/$(BOARDDIR)/u-boot.bd \
-                       -o $(obj)u-boot.sb
+$(obj)u-boot.bd:       $(TOPDIR)/board/$(BOARDDIR)/u-boot.bd
+               sed "s:@@BUILD_DIR@@:$(obj):g" $< > $@
+
+$(obj)u-boot.sb:       $(obj)u-boot.bd elftosb $(obj)u-boot.bin $(obj)spl/u-boot-spl.bin
+               $(TOPDIR)/tools/elftosb/bld/linux/elftosb -zdf imx28 -c $< -o $@
 
 ifeq ($(CONFIG_SANDBOX),y)
 GEN_UBOOT = \
@@ -515,6 +518,8 @@ $(obj)spl/u-boot-spl.bin:   $(SUBDIR_TOOLS) depend
 
 updater:
                $(MAKE) -C tools/updater all
+elftosb:
+               $(MAKE) -C $(SUBDIR_TOOLS)/elftosb all
 
 # Explicitly make _depend in subdirs containing multiple targets to prevent
 # parallel sub-makes creating .depend files simultaneously.
@@ -556,6 +561,13 @@ SYSTEM_MAP = \
 $(obj)System.map:      $(obj)u-boot
                @$(call SYSTEM_MAP,$<) > $(obj)System.map
 
+checkthumb:
+       @if test $(call cc-version) -lt 0404; then \
+               echo -n '*** Your GCC does not produce working '; \
+               echo 'binaries in THUMB mode.'; \
+               echo '*** Your board is configured for THUMB mode.'; \
+               false; \
+       fi
 #
 # Auto-generate the autoconf.mk file (which is included by all makefiles)
 #
diff --git a/README b/README
index 79016e690ace8899488e54ee7a35e1715018e9a2..6919392dca82c142ea00d9281393ddcde33ae981 100644 (file)
--- a/README
+++ b/README
@@ -432,6 +432,14 @@ The following options need to be configured:
                Select high exception vectors of the ARM core, e.g., do not
                clear the V bit of the c1 register of CP15.
 
+               CONFIG_SYS_THUMB_BUILD
+
+               Use this flag to build U-Boot using the Thumb instruction
+               set for ARM architectures. Thumb instruction set provides
+               better code density. For ARM architectures that support
+               Thumb2 this flag will result in Thumb2 code generated by
+               GCC.
+
 - Linux Kernel Interface:
                CONFIG_CLOCKS_IN_MHZ
 
index 3c5f9871671641f6dead045cd9238090cb215c0e..6d6109e62e59eab0b7f7668f5ff0527dac439728 100644 (file)
@@ -33,25 +33,38 @@ endif
 
 PLATFORM_CPPFLAGS += -DCONFIG_ARM -D__ARM__
 
-# Explicitly specifiy 32-bit ARM ISA since toolchain default can be -mthumb:
-PF_CPPFLAGS_ARM := $(call cc-option,-marm,)
+# Choose between ARM/Thumb instruction sets
+ifeq ($(CONFIG_SYS_THUMB_BUILD),y)
+PF_CPPFLAGS_ARM := $(call cc-option, -mthumb -mthumb-interwork,\
+                       $(call cc-option,-marm,)\
+                       $(call cc-option,-mno-thumb-interwork,)\
+               )
+else
+PF_CPPFLAGS_ARM := $(call cc-option,-marm,) \
+               $(call cc-option,-mno-thumb-interwork,)
+endif
+
+# Only test once
+ifneq ($(CONFIG_SPL_BUILD),y)
+ALL-$(CONFIG_SYS_THUMB_BUILD)  += checkthumb
+endif
 
-# Try if EABI is supported, else fall back to old API,
+# Try if EABI is supported, else fall back to old ABI,
 # i. e. for example:
 # - with ELDK 4.2 (EABI supported), use:
-#      -mabi=aapcs-linux -mno-thumb-interwork
+#      -mabi=aapcs-linux
 # - with ELDK 4.1 (gcc 4.x, no EABI), use:
-#      -mabi=apcs-gnu -mno-thumb-interwork
+#      -mabi=apcs-gnu
 # - with ELDK 3.1 (gcc 3.x), use:
-#      -mapcs-32 -mno-thumb-interwork
+#      -mapcs-32
 PF_CPPFLAGS_ABI := $(call cc-option,\
-                       -mabi=aapcs-linux -mno-thumb-interwork,\
+                       -mabi=aapcs-linux,\
                        $(call cc-option,\
                                -mapcs-32,\
                                $(call cc-option,\
                                        -mabi=apcs-gnu,\
                                )\
-                       ) $(call cc-option,-mno-thumb-interwork,)\
+                       )\
                )
 PLATFORM_CPPFLAGS += $(PF_CPPFLAGS_ARM) $(PF_CPPFLAGS_ABI)
 
index ffb2e6c3ea76bfa7b0cd7873546995a34ce47fd8..6a3a1bb354102f967718ef96061e9cfb59c9469a 100644 (file)
@@ -31,3 +31,9 @@ PLATFORM_CPPFLAGS += -march=armv5te
 # =========================================================================
 PF_RELFLAGS_SLB_AT := $(call cc-option,-mshort-load-bytes,$(call cc-option,-malignment-traps,))
 PLATFORM_RELFLAGS += $(PF_RELFLAGS_SLB_AT)
+
+ifneq ($(CONFIG_IMX_CONFIG),)
+
+ALL-y  += $(obj)u-boot.imx
+
+endif
index 626384c3fc1e3d4156dded9141b55d95987c1216..a56432e1b756a740ca44a9b0454003c7f0fb9392 100644 (file)
@@ -31,6 +31,7 @@
 
 #include <common.h>
 #include <command.h>
+#include <lcd.h>
 #include <asm/system.h>
 
 static void cache_flush(void);
@@ -46,6 +47,14 @@ int cleanup_before_linux (void)
 
        disable_interrupts ();
 
+#ifdef CONFIG_LCD
+       {
+               /* switch off LCD panel */
+               lcd_panel_disable();
+               /* disable LCD controller */
+               lcd_disable();
+       }
+#endif
 
        /* turn off I/D-cache */
        icache_disable();
index 9cadb7c34c0c6adffe68044055b4ff99c44001cf..8b07dae2b938a6cbc8021291c22f27f70e0bd4c1 100644 (file)
 #include <asm/io.h>
 #include <asm/arch/imx-regs.h>
 #include <asm/arch/imx25-pinmux.h>
+#include <asm/arch/clock.h>
 #ifdef CONFIG_MXC_MMC
 #include <asm/arch/mxcmmc.h>
 #endif
 
+#ifdef CONFIG_FSL_ESDHC
+DECLARE_GLOBAL_DATA_PTR;
+#endif
+
 /*
  *  get the system pll clock in Hz
  *
@@ -105,6 +110,20 @@ ulong imx_get_perclk(int clk)
        return lldiv(fref, div);
 }
 
+unsigned int mxc_get_clock(enum mxc_clock clk)
+{
+       if (clk >= MXC_CLK_NUM)
+               return -1;
+       switch (clk) {
+       case MXC_ARM_CLK:
+               return imx_get_armclk();
+       case MXC_FEC_CLK:
+               return imx_get_ahbclk();
+       default:
+               return imx_get_perclk(clk);
+       }
+}
+
 u32 get_cpu_rev(void)
 {
        u32 srev;
@@ -182,6 +201,14 @@ int cpu_eth_init(bd_t *bis)
 #endif
 }
 
+int get_clocks(void)
+{
+#ifdef CONFIG_FSL_ESDHC
+       gd->sdhc_clk = mxc_get_clock(MXC_ESDHC_CLK);
+#endif
+       return 0;
+}
+
 /*
  * Initializes on-chip MMC controllers.
  * to override, implement board_mmc_init()
index a2e3f771c26aa9835d4455c4975cf72e191b81a8..674a3af1be81aa7b63dadb1d465d15340ba16670 100644 (file)
@@ -28,7 +28,7 @@ LIB   = $(obj)lib$(SOC).o
 COBJS  = clock.o mx28.o iomux.o timer.o
 
 ifdef  CONFIG_SPL_BUILD
-COBJS  += spl_boot.o spl_mem_init.o spl_power_init.o
+COBJS  += spl_boot.o spl_lradc_init.o spl_mem_init.o spl_power_init.o
 endif
 
 SRCS   := $(START:.o=.S) $(COBJS:.o=.c)
diff --git a/arch/arm/cpu/arm926ejs/mx28/debug.c b/arch/arm/cpu/arm926ejs/mx28/debug.c
new file mode 100644 (file)
index 0000000..8444ba7
--- /dev/null
@@ -0,0 +1,114 @@
+/*
+ * Boot Prep common file
+ *
+ * Copyright 2008-2009 Freescale Semiconductor
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public 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 <stdarg.h>
+//#include <stdlib.h>
+
+#include <common.h>
+
+void printhex(int data)
+{
+       int i;
+       char c;
+
+       for (i = sizeof(int) * 2 - 1; i >= 0; i--) {
+               c = data >> (i * 4);
+               c &= 0xf;
+               if (c > 9)
+                       serial_putc(c - 10 + 'a');
+               else
+                       serial_putc(c + '0');
+       }
+}
+
+void printdec(int data)
+{
+       unsigned int m;
+       char str[10] = { 0, };
+       int i;
+
+       if (data == 0) {
+               serial_putc('0');
+               return;
+       } else if (data < 0) {
+               serial_putc('-');
+               data = -data;
+       }
+       m = data;
+       for (i = 0; m > 0; i++) {
+               str[i] = m % 10 + '0';
+               m /= 10;
+       }
+       for (i--; i >= 0; i--) {
+               serial_putc(str[i]);
+       }
+}
+
+void dprintf(const char *fmt, ...)
+{
+       va_list args;
+       const char *fp = fmt;
+
+       if (!fmt)
+               return;
+
+       va_start(args, fmt);
+       while (*fp) {
+               if (*fp == '%') {
+                       fp++;
+                       switch (*fp) {
+                       case 'c':
+                               serial_putc(va_arg(args, int));
+                               break;
+
+                       case 's':
+                               serial_puts(va_arg(args, const char *));
+                               break;
+
+                       case 'd':
+                       case 'u':
+                       case 'i':
+                               printdec(va_arg(args, int));
+                               break;
+
+                       case 'p':
+                               serial_puts("0x");
+                       case 'x':
+                       case 'X':
+                               printhex(va_arg(args, int));
+                               break;
+
+                       case '%':
+                               serial_putc('%');
+                               break;
+
+                       default:
+                               dprintf("\nUnsupported format string token '%c'(%x) in '%s'\n",
+                                       *fp, *fp, fmt);
+                       }
+               } else {
+                       if (*fp == '\n')
+                               serial_putc('\r');
+                       serial_putc(*fp);
+               }
+               fp++;
+       }
+       va_end(args);
+}
diff --git a/arch/arm/cpu/arm926ejs/mx28/debug.h b/arch/arm/cpu/arm926ejs/mx28/debug.h
new file mode 100644 (file)
index 0000000..0a7588f
--- /dev/null
@@ -0,0 +1,14 @@
+#ifdef DEBUG
+extern void printhex(int data);
+extern void printdec(int data);
+extern void dprintf(const char *fmt, ...);
+static int debug = 1;
+#define dbg_lvl(lvl)           (debug > (lvl))
+#else
+#define dbg_lvl(lvl)           0
+#define printhex(d)            do { } while (0)
+#define printdec(d)            do { } while (0)
+#define dprintf(lvl, fmt...)   do { } while (0)
+#endif
+
+#define dbg(lvl, fmt...)       do { if (dbg_lvl(lvl)) dprintf(fmt); } while (0)
index dc0338dfb585699bcc0850f28c19c77fdf9a8f1a..887ab7129a23cd37dc73c644a339959769b0e962 100644 (file)
@@ -51,9 +51,16 @@ void reset_cpu(ulong ignored) __attribute__((noreturn));
 
 void reset_cpu(ulong ignored)
 {
-
        struct mx28_rtc_regs *rtc_regs =
                (struct mx28_rtc_regs *)MXS_RTC_BASE;
+       struct mx28_lcdif_regs *lcdif_regs =
+               (struct mx28_lcdif_regs *)MXS_LCDIF_BASE;
+
+       /*
+        * Shut down the LCD controller as it interferes with BootROM boot mode
+        * pads sampling.
+        */
+       writel(LCDIF_CTRL_RUN, &lcdif_regs->hw_lcdif_ctrl_clr);
 
        /* Wait 1 uS before doing the actual watchdog reset */
        writel(1, &rtc_regs->hw_rtc_watchdog);
@@ -74,11 +81,19 @@ void enable_caches(void)
 #endif
 }
 
+#define        MX28_HW_DIGCTL_MICROSECONDS     (void *)0x8001c0c0
+
 int mx28_wait_mask_set(struct mx28_register_32 *reg, uint32_t mask, int timeout)
 {
-       while (--timeout) {
-               if ((readl(&reg->reg) & mask) == mask)
-                       break;
+       uint32_t start = readl(MX28_HW_DIGCTL_MICROSECONDS);
+
+       /* Wait for at least one microsecond for the bit mask to be set */
+       while (readl(MX28_HW_DIGCTL_MICROSECONDS) - start <= 1 || --timeout) {
+               if ((readl(&reg->reg) & mask) == mask) {
+                       while (readl(MX28_HW_DIGCTL_MICROSECONDS) - start <= 1)
+                               ;
+                       return 0;
+               }
                udelay(1);
        }
 
@@ -87,9 +102,15 @@ int mx28_wait_mask_set(struct mx28_register_32 *reg, uint32_t mask, int timeout)
 
 int mx28_wait_mask_clr(struct mx28_register_32 *reg, uint32_t mask, int timeout)
 {
-       while (--timeout) {
-               if ((readl(&reg->reg) & mask) == 0)
-                       break;
+       uint32_t start = readl(MX28_HW_DIGCTL_MICROSECONDS);
+
+       /* Wait for at least one microsecond for the bit mask to be cleared */
+       while (readl(MX28_HW_DIGCTL_MICROSECONDS) - start <= 1 || --timeout) {
+               if ((readl(&reg->reg) & mask) == 0) {
+                       while (readl(MX28_HW_DIGCTL_MICROSECONDS) - start <= 1)
+                               ;
+                       return 0;
+               }
                udelay(1);
        }
 
@@ -101,8 +122,11 @@ int mx28_reset_block(struct mx28_register_32 *reg)
        /* Clear SFTRST */
        writel(MX28_BLOCK_SFTRST, &reg->reg_clr);
 
-       if (mx28_wait_mask_clr(reg, MX28_BLOCK_SFTRST, RESET_MAX_TIMEOUT))
+       if (mx28_wait_mask_clr(reg, MX28_BLOCK_SFTRST, RESET_MAX_TIMEOUT)) {
+               printf("TIMEOUT waiting for SFTRST[%p] to clear: %08x\n",
+                       reg, readl(&reg->reg));
                return 1;
+       }
 
        /* Clear CLKGATE */
        writel(MX28_BLOCK_CLKGATE, &reg->reg_clr);
@@ -111,20 +135,29 @@ int mx28_reset_block(struct mx28_register_32 *reg)
        writel(MX28_BLOCK_SFTRST, &reg->reg_set);
 
        /* Wait for CLKGATE being set */
-       if (mx28_wait_mask_set(reg, MX28_BLOCK_CLKGATE, RESET_MAX_TIMEOUT))
+       if (mx28_wait_mask_set(reg, MX28_BLOCK_CLKGATE, RESET_MAX_TIMEOUT)) {
+               printf("TIMEOUT waiting for CLKGATE[%p] to set: %08x\n",
+                       reg, readl(&reg->reg));
                return 1;
+       }
 
        /* Clear SFTRST */
        writel(MX28_BLOCK_SFTRST, &reg->reg_clr);
 
-       if (mx28_wait_mask_clr(reg, MX28_BLOCK_SFTRST, RESET_MAX_TIMEOUT))
+       if (mx28_wait_mask_clr(reg, MX28_BLOCK_SFTRST, RESET_MAX_TIMEOUT)) {
+               printf("TIMEOUT waiting for SFTRST[%p] to clear: %08x\n",
+                       reg, readl(&reg->reg));
                return 1;
+       }
 
        /* Clear CLKGATE */
        writel(MX28_BLOCK_CLKGATE, &reg->reg_clr);
 
-       if (mx28_wait_mask_clr(reg, MX28_BLOCK_CLKGATE, RESET_MAX_TIMEOUT))
+       if (mx28_wait_mask_clr(reg, MX28_BLOCK_CLKGATE, RESET_MAX_TIMEOUT)) {
+               printf("TIMEOUT waiting for CLKGATE[%p] to clear: %08x\n",
+                       reg, readl(&reg->reg));
                return 1;
+       }
 
        return 0;
 }
@@ -185,8 +218,12 @@ int arch_cpu_init(void)
 #if defined(CONFIG_DISPLAY_CPUINFO)
 int print_cpuinfo(void)
 {
+       struct mx28_spl_data *data = (struct mx28_spl_data *)
+               ((CONFIG_SYS_TEXT_BASE - sizeof(struct mx28_spl_data)) & ~0xf);
+
        printf("Freescale i.MX28 family at %d MHz\n",
                        mxc_get_clock(MXC_ARM_CLK) / 1000000);
+       printf("BOOT:  %s\n", mx28_boot_modes[data->boot_mode_idx].mode);
        return 0;
 }
 #endif
@@ -220,13 +257,16 @@ int cpu_eth_init(bd_t *bis)
 
        udelay(10);
 
+       /*
+        * Enable pad output; must be done BEFORE enabling PLL
+        * according to i.MX28 Ref. Manual Rev. 1, 2010 p. 883
+        */
+       setbits_le32(&clkctrl_regs->hw_clkctrl_enet, CLKCTRL_ENET_CLK_OUT_EN);
+
        /* Gate on ENET PLL */
        writel(CLKCTRL_PLL2CTRL0_CLKGATE,
                &clkctrl_regs->hw_clkctrl_pll2ctrl0_clr);
 
-       /* Enable pad output */
-       setbits_le32(&clkctrl_regs->hw_clkctrl_enet, CLKCTRL_ENET_CLK_OUT_EN);
-
        return 0;
 }
 #endif
@@ -279,22 +319,16 @@ void imx_get_mac_from_fuse(int dev_id, unsigned char *mac)
 
 int mx28_dram_init(void)
 {
-       struct mx28_digctl_regs *digctl_regs =
-               (struct mx28_digctl_regs *)MXS_DIGCTL_BASE;
-       uint32_t sz[2];
-
-       sz[0] = readl(&digctl_regs->hw_digctl_scratch0);
-       sz[1] = readl(&digctl_regs->hw_digctl_scratch1);
+       struct mx28_spl_data *data = (struct mx28_spl_data *)
+               ((CONFIG_SYS_TEXT_BASE - sizeof(struct mx28_spl_data)) & ~0xf);
 
-       if (sz[0] != sz[1]) {
+       if (data->mem_dram_size == 0) {
                printf("MX28:\n"
-                       "Error, the RAM size in HW_DIGCTRL_SCRATCH0 and\n"
-                       "HW_DIGCTRL_SCRATCH1 is not the same. Please\n"
-                       "verify these two registers contain valid RAM size!\n");
+                       "Error, the RAM size passed up from SPL is 0!\n");
                hang();
        }
 
-       gd->ram_size = sz[0];
+       gd->ram_size = data->mem_dram_size;
        return 0;
 }
 
index 98d363199dc242be5a78cbec25d992ab01694396..e3a4493fbdfa9518c433e882f13ba66447c1abec 100644 (file)
@@ -37,5 +37,9 @@ static inline void mx28_power_wait_pswitch(void) { }
 #endif
 
 void mx28_mem_init(void);
+uint32_t mx28_mem_get_size(void);
+
+void mx28_lradc_init(void);
+void mx28_lradc_enable_batt_measurement(void);
 
 #endif /* __M28_INIT_H__ */
index dfb8309e7006457975890a48cb13d657c417f6c9..f0d012d2aac92c589c6fce62cdcbb0ccc8e659d5 100644 (file)
@@ -28,6 +28,8 @@
 #include <asm/io.h>
 #include <asm/arch/iomux-mx28.h>
 #include <asm/arch/imx-regs.h>
+#include <asm/arch/sys_proto.h>
+#include <asm/gpio.h>
 
 #include "mx28_init.h"
 
  * takes a few seconds to roll. The boot doesn't take that long, so to keep the
  * code simple, it doesn't take rolling into consideration.
  */
+/*
+ * There's nothing to be taken into consideration for the rollover.
+ * Two's complement arithmetic used correctly does all the magic automagically.
+ */
 #define        HW_DIGCTRL_MICROSECONDS 0x8001c0c0
 void early_delay(int delay)
 {
        uint32_t st = readl(HW_DIGCTRL_MICROSECONDS);
-       st += delay;
-       while (st > readl(HW_DIGCTRL_MICROSECONDS))
-               ;
+
+       while (readl(HW_DIGCTRL_MICROSECONDS) - st < delay);
+}
+
+#define        MUX_CONFIG_BOOTMODE_PAD (MXS_PAD_3V3 | MXS_PAD_4MA | MXS_PAD_NOPULL)
+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,
+       MX28_PAD_LCD_D03__GPIO_1_3 | MUX_CONFIG_BOOTMODE_PAD,
+       MX28_PAD_LCD_D04__GPIO_1_4 | MUX_CONFIG_BOOTMODE_PAD,
+       MX28_PAD_LCD_D05__GPIO_1_5 | MUX_CONFIG_BOOTMODE_PAD,
+};
+
+uint8_t mx28_get_bootmode_index(void)
+{
+       uint8_t bootmode = 0;
+       int i;
+       uint8_t masked;
+
+       /* Setup IOMUX of bootmode pads to GPIO */
+       mxs_iomux_setup_multiple_pads(iomux_boot, ARRAY_SIZE(iomux_boot));
+
+       /* Setup bootmode pins as GPIO input */
+       gpio_direction_input(MX28_PAD_LCD_D00__GPIO_1_0);
+       gpio_direction_input(MX28_PAD_LCD_D01__GPIO_1_1);
+       gpio_direction_input(MX28_PAD_LCD_D02__GPIO_1_2);
+       gpio_direction_input(MX28_PAD_LCD_D03__GPIO_1_3);
+       gpio_direction_input(MX28_PAD_LCD_D04__GPIO_1_4);
+       gpio_direction_input(MX28_PAD_LCD_D05__GPIO_1_5);
+
+       /* Read bootmode pads */
+       bootmode |= (gpio_get_value(MX28_PAD_LCD_D00__GPIO_1_0) ? 1 : 0) << 0;
+       bootmode |= (gpio_get_value(MX28_PAD_LCD_D01__GPIO_1_1) ? 1 : 0) << 1;
+       bootmode |= (gpio_get_value(MX28_PAD_LCD_D02__GPIO_1_2) ? 1 : 0) << 2;
+       bootmode |= (gpio_get_value(MX28_PAD_LCD_D03__GPIO_1_3) ? 1 : 0) << 3;
+       bootmode |= (gpio_get_value(MX28_PAD_LCD_D04__GPIO_1_4) ? 1 : 0) << 4;
+       bootmode |= (gpio_get_value(MX28_PAD_LCD_D05__GPIO_1_5) ? 1 : 0) << 5;
+
+       for (i = 0; i < ARRAY_SIZE(mx28_boot_modes); i++) {
+               masked = bootmode & mx28_boot_modes[i].boot_mask;
+               if (masked == mx28_boot_modes[i].boot_pads)
+                       break;
+       }
+
+       return i;
 }
 
 void mx28_common_spl_init(const iomux_cfg_t *iomux_setup,
                        const unsigned int iomux_size)
 {
+       struct mx28_spl_data *data = (struct mx28_spl_data *)
+               ((CONFIG_SYS_TEXT_BASE - sizeof(struct mx28_spl_data)) & ~0xf);
+       uint8_t bootmode = mx28_get_bootmode_index();
+
        mxs_iomux_setup_multiple_pads(iomux_setup, iomux_size);
        mx28_power_init();
+
        mx28_mem_init();
+       data->mem_dram_size = mx28_mem_get_size();
+
+       data->boot_mode_idx = bootmode;
+
        mx28_power_wait_pswitch();
 }
 
-/* Support aparatus */
+/* Support apparatus */
 inline void board_init_f(unsigned long bootflag)
 {
        for (;;)
@@ -68,11 +126,14 @@ inline void board_init_r(gd_t *id, ulong dest_addr)
                ;
 }
 
+#ifndef CONFIG_SPL_SERIAL_SUPPORT
 void serial_putc(const char c) {}
 void serial_puts(const char *s) {}
+#endif
 void hang(void) __attribute__ ((noreturn));
 void hang(void)
 {
+       serial_puts("ERROR: please reset the target\n");
        for (;;)
                ;
 }
diff --git a/arch/arm/cpu/arm926ejs/mx28/spl_lradc_init.c b/arch/arm/cpu/arm926ejs/mx28/spl_lradc_init.c
new file mode 100644 (file)
index 0000000..88a603c
--- /dev/null
@@ -0,0 +1,86 @@
+/*
+ * Freescale i.MX28 Battery measurement init
+ *
+ * Copyright (C) 2011 Marek Vasut <marek.vasut@gmail.com>
+ * on behalf of DENX Software Engineering GmbH
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+#include <common.h>
+#include <config.h>
+#include <asm/io.h>
+#include <asm/arch/imx-regs.h>
+
+#include "mx28_init.h"
+
+void mx28_lradc_init(void)
+{
+       struct mx28_lradc_regs *regs = (struct mx28_lradc_regs *)MXS_LRADC_BASE;
+
+       writel(LRADC_CTRL0_SFTRST, &regs->hw_lradc_ctrl0_clr);
+       writel(LRADC_CTRL0_CLKGATE, &regs->hw_lradc_ctrl0_clr);
+       writel(LRADC_CTRL0_ONCHIP_GROUNDREF, &regs->hw_lradc_ctrl0_clr);
+
+       clrsetbits_le32(&regs->hw_lradc_ctrl3,
+                       LRADC_CTRL3_CYCLE_TIME_MASK,
+                       LRADC_CTRL3_CYCLE_TIME_6MHZ);
+
+       clrsetbits_le32(&regs->hw_lradc_ctrl4,
+                       LRADC_CTRL4_LRADC7SELECT_MASK |
+                       LRADC_CTRL4_LRADC6SELECT_MASK,
+                       LRADC_CTRL4_LRADC7SELECT_CHANNEL7 |
+                       LRADC_CTRL4_LRADC6SELECT_CHANNEL10);
+}
+
+void mx28_lradc_enable_batt_measurement(void)
+{
+       struct mx28_lradc_regs *regs = (struct mx28_lradc_regs *)MXS_LRADC_BASE;
+
+       /* Check if the channel is present at all. */
+       if (!(readl(&regs->hw_lradc_status) & LRADC_STATUS_CHANNEL7_PRESENT))
+               return;
+
+       writel(LRADC_CTRL1_LRADC7_IRQ_EN, &regs->hw_lradc_ctrl1_clr);
+       writel(LRADC_CTRL1_LRADC7_IRQ, &regs->hw_lradc_ctrl1_clr);
+
+       clrsetbits_le32(&regs->hw_lradc_conversion,
+                       LRADC_CONVERSION_SCALE_FACTOR_MASK,
+                       LRADC_CONVERSION_SCALE_FACTOR_LI_ION);
+       writel(LRADC_CONVERSION_AUTOMATIC, &regs->hw_lradc_conversion_set);
+
+       /* Configure the channel. */
+       writel((1 << 7) << LRADC_CTRL2_DIVIDE_BY_TWO_OFFSET,
+               &regs->hw_lradc_ctrl2_clr);
+       writel(0xffffffff, &regs->hw_lradc_ch7_clr);
+       clrbits_le32(&regs->hw_lradc_ch7, LRADC_CH_NUM_SAMPLES_MASK);
+       writel(LRADC_CH_ACCUMULATE, &regs->hw_lradc_ch7_clr);
+
+       /* Schedule the channel. */
+       writel(1 << 7, &regs->hw_lradc_ctrl0_set);
+
+       /* Start the channel sampling. */
+       writel(((1 << 7) << LRADC_DELAY_TRIGGER_LRADCS_OFFSET) |
+               ((1 << 3) << LRADC_DELAY_TRIGGER_DELAYS_OFFSET) |
+               100, &regs->hw_lradc_delay3);
+
+       writel(0xffffffff, &regs->hw_lradc_ch7_clr);
+
+       writel(LRADC_DELAY_KICK, &regs->hw_lradc_delay3_set);
+}
index 911bbefc060f482d79c29b1b2c21b9bdbc0a6dc5..88a1259afb240ec45606baa0b71a8ff28d6a0bc2 100644 (file)
 
 #include "mx28_init.h"
 
-uint32_t dram_vals[] = {
-       0x00000000, 0x00000000, 0x00000000, 0x00000000,
-       0x00000000, 0x00000000, 0x00000000, 0x00000000,
-       0x00000000, 0x00000000, 0x00000000, 0x00000000,
-       0x00000000, 0x00000000, 0x00000000, 0x00000000,
-       0x00000000, 0x00000100, 0x00000000, 0x00000000,
-       0x00000000, 0x00000000, 0x00000000, 0x00000000,
-       0x00000000, 0x00000000, 0x00010101, 0x01010101,
-       0x000f0f01, 0x0f02010a, 0x00000000, 0x00010101,
-       0x00000100, 0x00000100, 0x00000000, 0x00000002,
-       0x01010000, 0x05060302, 0x06005003, 0x0a0000c8,
-       0x02009c40, 0x0000030c, 0x0036a609, 0x031a0612,
-       0x02030202, 0x00c8001c, 0x00000000, 0x00000000,
-       0x00012100, 0xffff0303, 0x00012100, 0xffff0303,
-       0x00012100, 0xffff0303, 0x00012100, 0xffff0303,
-       0x00000003, 0x00000000, 0x00000000, 0x00000000,
-       0x00000000, 0x00000000, 0x00000000, 0x00000000,
-       0x00000000, 0x00000000, 0x00000612, 0x01000F02,
-       0x06120612, 0x00000200, 0x00020007, 0xf5014b27,
-       0xf5014b27, 0xf5014b27, 0xf5014b27, 0x07000300,
-       0x07000300, 0x07000300, 0x07000300, 0x00000006,
-       0x00000000, 0x00000000, 0x01000000, 0x01020408,
-       0x08040201, 0x000f1133, 0x00000000, 0x00001f04,
-       0x00001f04, 0x00001f04, 0x00001f04, 0x00001f04,
-       0x00001f04, 0x00001f04, 0x00001f04, 0x00000000,
-       0x00000000, 0x00000000, 0x00000000, 0x00000000,
-       0x00000000, 0x00000000, 0x00000000, 0x00000000,
-       0x00000000, 0x00000000, 0x00000000, 0x00000000,
-       0x00000000, 0x00000000, 0x00000000, 0x00000000,
-       0x00000000, 0x00000000, 0x00000000, 0x00000000,
-       0x00000000, 0x00000000, 0x00000000, 0x00000000,
-       0x00000000, 0x00000000, 0x00000000, 0x00000000,
-       0x00000000, 0x00000000, 0x00000000, 0x00000000,
-       0x00000000, 0x00000000, 0x00000000, 0x00000000,
-       0x00000000, 0x00000000, 0x00000000, 0x00000000,
-       0x00000000, 0x00000000, 0x00000000, 0x00000000,
-       0x00000000, 0x00000000, 0x00000000, 0x00000000,
-       0x00000000, 0x00000000, 0x00000000, 0x00000000,
-       0x00000000, 0x00000000, 0x00000000, 0x00000000,
-       0x00000000, 0x00000000, 0x00000000, 0x00000000,
-       0x00000000, 0x00000000, 0x00000000, 0x00000000,
-       0x00000000, 0x00000000, 0x00010000, 0x00020304,
-       0x00000004, 0x00000000, 0x00000000, 0x00000000,
-       0x00000000, 0x00000000, 0x00000000, 0x01010000,
-       0x01000000, 0x03030000, 0x00010303, 0x01020202,
-       0x00000000, 0x02040303, 0x21002103, 0x00061200,
-       0x06120612, 0x04320432, 0x04320432, 0x00040004,
-       0x00040004, 0x00000000, 0x00000000, 0x00000000,
-       0x00000000, 0x00010001
-};
-
-void init_m28_200mhz_ddr2(void)
-{
-       int i;
+extern void mx28_ddr2_setup(void) __attribute__((weak,
+               alias("mx28_ddr2_setup_missing")));
 
-       for (i = 0; i < ARRAY_SIZE(dram_vals); i++)
-               writel(dram_vals[i], MXS_DRAM_BASE + (4 * i));
+static void mx28_ddr2_setup_missing(void)
+{
+       serial_puts("platform specific mx28_ddr_setup() is missing\n");
 }
 
-void mx28_mem_init_clock(void)
+static void mx28_mem_init_clock(void)
 {
        struct mx28_clkctrl_regs *clkctrl_regs =
                (struct mx28_clkctrl_regs *)MXS_CLKCTRL_BASE;
@@ -107,21 +56,20 @@ void mx28_mem_init_clock(void)
        writeb(CLKCTRL_FRAC_CLKGATE,
                &clkctrl_regs->hw_clkctrl_frac0_clr[CLKCTRL_FRAC0_EMI]);
 
-       early_delay(11000);
 
        /* Set EMI clock divider for EMI clock to 411 / 2 = 205MHz */
        writel((2 << CLKCTRL_EMI_DIV_EMI_OFFSET) |
                (1 << CLKCTRL_EMI_DIV_XTAL_OFFSET),
                &clkctrl_regs->hw_clkctrl_emi);
+       while (readl(&clkctrl_regs->hw_clkctrl_emi) & CLKCTRL_EMI_BUSY_REF_EMI)
+               ;
 
        /* Unbypass EMI */
        writel(CLKCTRL_CLKSEQ_BYPASS_EMI,
                &clkctrl_regs->hw_clkctrl_clkseq_clr);
-
-       early_delay(10000);
 }
 
-void mx28_mem_setup_cpu_and_hbus(void)
+static void mx28_mem_setup_cpu_and_hbus(void)
 {
        struct mx28_clkctrl_regs *clkctrl_regs =
                (struct mx28_clkctrl_regs *)MXS_CLKCTRL_BASE;
@@ -136,62 +84,49 @@ void mx28_mem_setup_cpu_and_hbus(void)
                &clkctrl_regs->hw_clkctrl_clkseq_set);
 
        /* HBUS = 151MHz */
-       writel(CLKCTRL_HBUS_DIV_MASK, &clkctrl_regs->hw_clkctrl_hbus_set);
-       writel(((~3) << CLKCTRL_HBUS_DIV_OFFSET) & CLKCTRL_HBUS_DIV_MASK,
-               &clkctrl_regs->hw_clkctrl_hbus_clr);
-
-       early_delay(10000);
+       clrsetbits_le32(&clkctrl_regs->hw_clkctrl_hbus,
+                       CLKCTRL_HBUS_DIV_MASK,
+                       3 << CLKCTRL_HBUS_DIV_OFFSET);
+       while (readl(&clkctrl_regs->hw_clkctrl_hbus) & CLKCTRL_HBUS_ASM_BUSY)
+               ;
 
        /* CPU clock divider = 1 */
        clrsetbits_le32(&clkctrl_regs->hw_clkctrl_cpu,
-                       CLKCTRL_CPU_DIV_CPU_MASK, 1);
+                       CLKCTRL_CPU_DIV_CPU_MASK,
+                       1 << CLKCTRL_CPU_DIV_CPU_OFFSET);
+       while (readl(&clkctrl_regs->hw_clkctrl_cpu) & CLKCTRL_CPU_BUSY_REF_CPU)
+               ;
 
        /* Disable CPU bypass */
        writel(CLKCTRL_CLKSEQ_BYPASS_CPU,
                &clkctrl_regs->hw_clkctrl_clkseq_clr);
-}
 
-void mx28_mem_setup_vdda(void)
-{
-       struct mx28_power_regs *power_regs =
-               (struct mx28_power_regs *)MXS_POWER_BASE;
-
-       writel((0xc << POWER_VDDACTRL_TRG_OFFSET) |
-               (0x7 << POWER_VDDACTRL_BO_OFFSET_OFFSET) |
-               POWER_VDDACTRL_LINREG_OFFSET_1STEPS_BELOW,
-               &power_regs->hw_power_vddactrl);
+       early_delay(15000);
 }
 
-void mx28_mem_setup_vddd(void)
+#define        HW_DIGCTRL_SCRATCH0     0x8001c280
+#define        HW_DIGCTRL_SCRATCH1     0x8001c290
+static void data_abort_memdetect_handler(void) __attribute__((naked));
+static void data_abort_memdetect_handler(void)
 {
-       struct mx28_power_regs *power_regs =
-               (struct mx28_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);
+       asm volatile("subs pc, r14, #4");
 }
 
-void mx28_mem_get_size(void)
+uint32_t mx28_mem_get_size(void)
 {
-       struct mx28_digctl_regs *digctl_regs =
-               (struct mx28_digctl_regs *)MXS_DIGCTL_BASE;
        uint32_t sz, da;
        uint32_t *vt = (uint32_t *)0x20;
-       /* The following is "subs pc, r14, #4", used as return from DABT. */
-       const uint32_t data_abort_memdetect_handler = 0xe25ef004;
 
        /* Replace the DABT handler. */
        da = vt[4];
-       vt[4] = data_abort_memdetect_handler;
+       vt[4] = (uint32_t)data_abort_memdetect_handler;
 
        sz = get_ram_size((long *)PHYS_SDRAM_1, PHYS_SDRAM_1_SIZE);
-       writel(sz, &digctl_regs->hw_digctl_scratch0);
-       writel(sz, &digctl_regs->hw_digctl_scratch1);
 
        /* Restore the old DABT handler. */
        vt[4] = da;
+
+       return sz;
 }
 
 void mx28_mem_init(void)
@@ -209,12 +144,11 @@ void mx28_mem_init(void)
        writel(CLKCTRL_PLL0CTRL0_POWER,
                &clkctrl_regs->hw_clkctrl_pll0ctrl0_set);
 
-       early_delay(11000);
+       /* enabling the PLL requires a 10µs delay before use as clk source */
+       early_delay(11);
 
        mx28_mem_init_clock();
 
-       mx28_mem_setup_vdda();
-
        /*
         * Configure the DRAM registers
         */
@@ -222,7 +156,7 @@ void mx28_mem_init(void)
        /* Clear START bit from DRAM_CTL16 */
        clrbits_le32(MXS_DRAM_BASE + 0x40, 1);
 
-       init_m28_200mhz_ddr2();
+       mx28_ddr2_setup();
 
        /* Clear SREFRESH bit from DRAM_CTL17 */
        clrbits_le32(MXS_DRAM_BASE + 0x44, 1);
@@ -234,11 +168,5 @@ void mx28_mem_init(void)
        while (!(readl(MXS_DRAM_BASE + 0xe8) & (1 << 20)))
                ;
 
-       mx28_mem_setup_vddd();
-
-       early_delay(10000);
-
        mx28_mem_setup_cpu_and_hbus();
-
-       mx28_mem_get_size();
 }
index aa4117d3a23abbb3225ffa976cc91f7162b00539..6b74e2e557118b8374ff49ce6abcb2b40a28ceb0 100644 (file)
 
 #include "mx28_init.h"
 
-void mx28_power_clock2xtal(void)
+#ifdef CONFIG_SYS_SPL_VDDD_VAL
+#define VDDD_VAL       CONFIG_SYS_SPL_VDDD_VAL
+#else
+#define VDDD_VAL       1350
+#endif
+#ifdef CONFIG_SYS_SPL_VDDIO_VAL
+#define VDDIO_VAL      CONFIG_SYS_SPL_VDDIO_VAL
+#else
+#define VDDIO_VAL      3300
+#endif
+#ifdef CONFIG_SYS_SPL_VDDA_VAL
+#define VDDA_VAL       CONFIG_SYS_SPL_VDDA_VAL
+#else
+#define VDDA_VAL       1800
+#endif
+#ifdef CONFIG_SYS_SPL_VDDMEM_VAL
+#define VDDMEM_VAL     CONFIG_SYS_SPL_VDDMEM_VAL
+#else
+#define VDDMEM_VAL     1500
+#endif
+
+#ifdef CONFIG_SYS_SPL_VDDD_BO_VAL
+#define VDDD_BO_VAL    CONFIG_SYS_SPL_VDDD_BO_VAL
+#else
+#define VDDD_BO_VAL    150
+#endif
+#ifdef CONFIG_SYS_SPL_VDDIO_BO_VAL
+#define VDDIO_BO_VAL   CONFIG_SYS_SPL_VDDIO_BO_VAL
+#else
+#define VDDIO_BO_VAL   150
+#endif
+#ifdef CONFIG_SYS_SPL_VDDA_BO_VAL
+#define VDDA_BO_VAL    CONFIG_SYS_SPL_VDDA_BO_VAL
+#else
+#define VDDA_BO_VAL    175
+#endif
+#ifdef CONFIG_SYS_SPL_VDDMEM_BO_VAL
+#define VDDMEM_BO_VAL  CONFIG_SYS_SPL_VDDMEM_BO_VAL
+#else
+#define VDDMEM_BO_VAL  25
+#endif
+
+#ifdef CONFIG_SYS_SPL_BATT_BO_LEVEL
+#if CONFIG_SYS_SPL_BATT_BO_LEVEL < 2400 || CONFIG_SYS_SPL_BATT_BO_LEVEL > 3640
+#error CONFIG_SYS_SPL_BATT_BO_LEVEL out of range
+#endif
+#define BATT_BO_VAL    (((CONFIG_SYS_SPL_BATT_BO_LEVEL) - 2400) / 40)
+#else
+/* Brownout default at 3V */
+#define BATT_BO_VAL    ((3000 - 2400) / 40)
+#endif
+
+#ifdef CONFIG_SYS_SPL_FIXED_BATT_SUPPLY
+static const int fixed_batt_supply = 1;
+#else
+static const int fixed_batt_supply;
+#endif
+
+static struct mx28_power_regs *power_regs = (void *)MXS_POWER_BASE;
+
+static void mx28_power_clock2xtal(void)
 {
        struct mx28_clkctrl_regs *clkctrl_regs =
                (struct mx28_clkctrl_regs *)MXS_CLKCTRL_BASE;
@@ -40,19 +100,19 @@ void mx28_power_clock2xtal(void)
                &clkctrl_regs->hw_clkctrl_clkseq_set);
 }
 
-void mx28_power_clock2pll(void)
+static void mx28_power_clock2pll(void)
 {
        struct mx28_clkctrl_regs *clkctrl_regs =
                (struct mx28_clkctrl_regs *)MXS_CLKCTRL_BASE;
 
-       writel(CLKCTRL_PLL0CTRL0_POWER,
-               &clkctrl_regs->hw_clkctrl_pll0ctrl0_set);
+       setbits_le32(&clkctrl_regs->hw_clkctrl_pll0ctrl0,
+                       CLKCTRL_PLL0CTRL0_POWER);
        early_delay(100);
-       writel(CLKCTRL_CLKSEQ_BYPASS_CPU,
-               &clkctrl_regs->hw_clkctrl_clkseq_clr);
+       setbits_le32(&clkctrl_regs->hw_clkctrl_clkseq,
+                       CLKCTRL_CLKSEQ_BYPASS_CPU);
 }
 
-void mx28_power_clear_auto_restart(void)
+static void mx28_power_clear_auto_restart(void)
 {
        struct mx28_rtc_regs *rtc_regs =
                (struct mx28_rtc_regs *)MXS_RTC_BASE;
@@ -85,11 +145,8 @@ void mx28_power_clear_auto_restart(void)
                ;
 }
 
-void mx28_power_set_linreg(void)
+static void mx28_power_set_linreg(void)
 {
-       struct mx28_power_regs *power_regs =
-               (struct mx28_power_regs *)MXS_POWER_BASE;
-
        /* Set linear regulator 25mV below switching converter */
        clrsetbits_le32(&power_regs->hw_power_vdddctrl,
                        POWER_VDDDCTRL_LINREG_OFFSET_MASK,
@@ -104,11 +161,64 @@ void mx28_power_set_linreg(void)
                        POWER_VDDIOCTRL_LINREG_OFFSET_1STEPS_BELOW);
 }
 
-void mx28_power_setup_5v_detect(void)
+int mx28_get_batt_volt(void)
 {
        struct mx28_power_regs *power_regs =
                (struct mx28_power_regs *)MXS_POWER_BASE;
+       uint32_t volt = readl(&power_regs->hw_power_battmonitor);
+       volt &= POWER_BATTMONITOR_BATT_VAL_MASK;
+       volt >>= POWER_BATTMONITOR_BATT_VAL_OFFSET;
+       volt *= 8;
+       return volt;
+}
+
+int mx28_is_batt_ready(void)
+{
+       return (mx28_get_batt_volt() >= 3600);
+}
+
+int mx28_is_batt_good(void)
+{
+       struct mx28_power_regs *power_regs =
+               (struct mx28_power_regs *)MXS_POWER_BASE;
+       uint32_t volt = mx28_get_batt_volt();
+
+       if ((volt >= 2400) && (volt <= 4300))
+               return 1;
+
+       clrsetbits_le32(&power_regs->hw_power_5vctrl,
+               POWER_5VCTRL_CHARGE_4P2_ILIMIT_MASK,
+               0x3 << POWER_5VCTRL_CHARGE_4P2_ILIMIT_OFFSET);
+       writel(POWER_5VCTRL_PWD_CHARGE_4P2_MASK,
+               &power_regs->hw_power_5vctrl_clr);
 
+       clrsetbits_le32(&power_regs->hw_power_charge,
+               POWER_CHARGE_STOP_ILIMIT_MASK | POWER_CHARGE_BATTCHRG_I_MASK,
+               POWER_CHARGE_STOP_ILIMIT_10MA | 0x3);
+
+       writel(POWER_CHARGE_PWD_BATTCHRG, &power_regs->hw_power_charge_clr);
+       writel(POWER_5VCTRL_PWD_CHARGE_4P2_MASK,
+               &power_regs->hw_power_5vctrl_clr);
+
+       early_delay(500000);
+
+       volt = mx28_get_batt_volt();
+
+       if (volt >= 3500)
+               return 0;
+
+       if (volt >= 2400)
+               return 1;
+
+       writel(POWER_CHARGE_STOP_ILIMIT_MASK | POWER_CHARGE_BATTCHRG_I_MASK,
+               &power_regs->hw_power_charge_clr);
+       writel(POWER_CHARGE_PWD_BATTCHRG, &power_regs->hw_power_charge_set);
+
+       return 0;
+}
+
+static void mx28_power_setup_5v_detect(void)
+{
        /* Start 5V detection */
        clrsetbits_le32(&power_regs->hw_power_5vctrl,
                        POWER_5VCTRL_VBUSVALID_TRSH_MASK,
@@ -116,11 +226,8 @@ void mx28_power_setup_5v_detect(void)
                        POWER_5VCTRL_PWRUP_VBUS_CMPS);
 }
 
-void mx28_src_power_init(void)
+static void mx28_src_power_init(void)
 {
-       struct mx28_power_regs *power_regs =
-               (struct mx28_power_regs *)MXS_POWER_BASE;
-
        /* Improve efficieny and reduce transient ripple */
        writel(POWER_LOOPCTRL_TOGGLE_DIF | POWER_LOOPCTRL_EN_CM_HYST |
                POWER_LOOPCTRL_EN_DF_HYST, &power_regs->hw_power_loopctrl_set);
@@ -129,8 +236,14 @@ void mx28_src_power_init(void)
                        POWER_DCLIMITS_POSLIMIT_BUCK_MASK,
                        0x30 << POWER_DCLIMITS_POSLIMIT_BUCK_OFFSET);
 
-       setbits_le32(&power_regs->hw_power_battmonitor,
+       if (!fixed_batt_supply) {
+               /* FIXME: This requires the LRADC to be set up! */
+               setbits_le32(&power_regs->hw_power_battmonitor,
                        POWER_BATTMONITOR_EN_BATADJ);
+       } else {
+               clrbits_le32(&power_regs->hw_power_battmonitor,
+                       POWER_BATTMONITOR_EN_BATADJ);
+       }
 
        /* Increase the RCSCALE level for quick DCDC response to dynamic load */
        clrsetbits_le32(&power_regs->hw_power_loopctrl,
@@ -141,17 +254,16 @@ void mx28_src_power_init(void)
        clrsetbits_le32(&power_regs->hw_power_minpwr,
                        POWER_MINPWR_HALFFETS, POWER_MINPWR_DOUBLE_FETS);
 
-       /* 5V to battery handoff ... FIXME */
-       setbits_le32(&power_regs->hw_power_5vctrl, POWER_5VCTRL_DCDC_XFER);
-       early_delay(30);
-       clrbits_le32(&power_regs->hw_power_5vctrl, POWER_5VCTRL_DCDC_XFER);
+       if (!fixed_batt_supply) {
+               /* 5V to battery handoff ... FIXME */
+               setbits_le32(&power_regs->hw_power_5vctrl, POWER_5VCTRL_DCDC_XFER);
+               early_delay(30);
+               clrbits_le32(&power_regs->hw_power_5vctrl, POWER_5VCTRL_DCDC_XFER);
+       }
 }
 
-void mx28_power_init_4p2_params(void)
+static void mx28_power_init_4p2_params(void)
 {
-       struct mx28_power_regs *power_regs =
-               (struct mx28_power_regs *)MXS_POWER_BASE;
-
        /* Setup 4P2 parameters */
        clrsetbits_le32(&power_regs->hw_power_dcdc4p2,
                POWER_DCDC4P2_CMPTRIP_MASK | POWER_DCDC4P2_TRG_MASK,
@@ -171,10 +283,8 @@ void mx28_power_init_4p2_params(void)
                0x3f << POWER_5VCTRL_CHARGE_4P2_ILIMIT_OFFSET);
 }
 
-void mx28_enable_4p2_dcdc_input(int xfer)
+static void mx28_enable_4p2_dcdc_input(int xfer)
 {
-       struct mx28_power_regs *power_regs =
-               (struct mx28_power_regs *)MXS_POWER_BASE;
        uint32_t tmp, vbus_thresh, vbus_5vdetect, pwd_bo;
        uint32_t prev_5v_brnout, prev_5v_droop;
 
@@ -267,10 +377,8 @@ void mx28_enable_4p2_dcdc_input(int xfer)
                                POWER_CTRL_ENIRQ_VDD5V_DROOP);
 }
 
-void mx28_power_init_4p2_regulator(void)
+static void mx28_power_init_4p2_regulator(void)
 {
-       struct mx28_power_regs *power_regs =
-               (struct mx28_power_regs *)MXS_POWER_BASE;
        uint32_t tmp, tmp2;
 
        setbits_le32(&power_regs->hw_power_dcdc4p2, POWER_DCDC4P2_ENABLE_4P2);
@@ -351,11 +459,8 @@ void mx28_power_init_4p2_regulator(void)
        writel(POWER_CTRL_DCDC4P2_BO_IRQ, &power_regs->hw_power_ctrl_clr);
 }
 
-void mx28_power_init_dcdc_4p2_source(void)
+static void mx28_power_init_dcdc_4p2_source(void)
 {
-       struct mx28_power_regs *power_regs =
-               (struct mx28_power_regs *)MXS_POWER_BASE;
-
        if (!(readl(&power_regs->hw_power_dcdc4p2) &
                POWER_DCDC4P2_ENABLE_DCDC)) {
                hang();
@@ -373,10 +478,8 @@ void mx28_power_init_dcdc_4p2_source(void)
        }
 }
 
-void mx28_power_enable_4p2(void)
+static void mx28_power_enable_4p2(void)
 {
-       struct mx28_power_regs *power_regs =
-               (struct mx28_power_regs *)MXS_POWER_BASE;
        uint32_t vdddctrl, vddactrl, vddioctrl;
        uint32_t tmp;
 
@@ -399,9 +502,14 @@ void mx28_power_enable_4p2(void)
        mx28_power_init_4p2_regulator();
 
        /* Shutdown battery (none present) */
-       clrbits_le32(&power_regs->hw_power_dcdc4p2, POWER_DCDC4P2_BO_MASK);
-       writel(POWER_CTRL_DCDC4P2_BO_IRQ, &power_regs->hw_power_ctrl_clr);
-       writel(POWER_CTRL_ENIRQ_DCDC4P2_BO, &power_regs->hw_power_ctrl_clr);
+       if (!mx28_is_batt_ready()) {
+               clrbits_le32(&power_regs->hw_power_dcdc4p2,
+                               POWER_DCDC4P2_BO_MASK);
+               writel(POWER_CTRL_DCDC4P2_BO_IRQ,
+                               &power_regs->hw_power_ctrl_clr);
+               writel(POWER_CTRL_ENIRQ_DCDC4P2_BO,
+                               &power_regs->hw_power_ctrl_clr);
+       }
 
        mx28_power_init_dcdc_4p2_source();
 
@@ -427,11 +535,8 @@ void mx28_power_enable_4p2(void)
                        &power_regs->hw_power_charge_clr);
 }
 
-void mx28_boot_valid_5v(void)
+static void mx28_boot_valid_5v(void)
 {
-       struct mx28_power_regs *power_regs =
-               (struct mx28_power_regs *)MXS_POWER_BASE;
-
        /*
         * Use VBUSVALID level instead of VDD5V_GT_VDDIO level to trigger a 5V
         * disconnect event. FIXME
@@ -450,19 +555,59 @@ void mx28_boot_valid_5v(void)
        mx28_power_enable_4p2();
 }
 
-void mx28_powerdown(void)
+static void mx28_powerdown(void)
 {
-       struct mx28_power_regs *power_regs =
-               (struct mx28_power_regs *)MXS_POWER_BASE;
        writel(POWER_RESET_UNLOCK_KEY, &power_regs->hw_power_reset);
        writel(POWER_RESET_UNLOCK_KEY | POWER_RESET_PWD_OFF,
                &power_regs->hw_power_reset);
 }
 
-void mx28_handle_5v_conflict(void)
+void mx28_batt_boot(void)
 {
        struct mx28_power_regs *power_regs =
                (struct mx28_power_regs *)MXS_POWER_BASE;
+
+       clrbits_le32(&power_regs->hw_power_5vctrl, POWER_5VCTRL_PWDN_5VBRNOUT);
+       clrbits_le32(&power_regs->hw_power_5vctrl, POWER_5VCTRL_ENABLE_DCDC);
+
+       clrbits_le32(&power_regs->hw_power_dcdc4p2,
+                       POWER_DCDC4P2_ENABLE_DCDC | POWER_DCDC4P2_ENABLE_4P2);
+       writel(POWER_CHARGE_ENABLE_LOAD, &power_regs->hw_power_charge_clr);
+
+       /* 5V to battery handoff. */
+       setbits_le32(&power_regs->hw_power_5vctrl, POWER_5VCTRL_DCDC_XFER);
+       early_delay(30);
+       clrbits_le32(&power_regs->hw_power_5vctrl, POWER_5VCTRL_DCDC_XFER);
+
+       writel(POWER_CTRL_ENIRQ_DCDC4P2_BO, &power_regs->hw_power_ctrl_clr);
+
+       clrsetbits_le32(&power_regs->hw_power_minpwr,
+                       POWER_MINPWR_HALFFETS, POWER_MINPWR_DOUBLE_FETS);
+
+       mx28_power_set_linreg();
+
+       clrbits_le32(&power_regs->hw_power_vdddctrl,
+               POWER_VDDDCTRL_DISABLE_FET | POWER_VDDDCTRL_ENABLE_LINREG);
+
+       clrbits_le32(&power_regs->hw_power_vddactrl,
+               POWER_VDDACTRL_DISABLE_FET | POWER_VDDACTRL_ENABLE_LINREG);
+
+       clrbits_le32(&power_regs->hw_power_vddioctrl,
+               POWER_VDDIOCTRL_DISABLE_FET);
+
+       setbits_le32(&power_regs->hw_power_5vctrl,
+               POWER_5VCTRL_PWD_CHARGE_4P2_MASK);
+
+       setbits_le32(&power_regs->hw_power_5vctrl,
+               POWER_5VCTRL_ENABLE_DCDC);
+
+       clrsetbits_le32(&power_regs->hw_power_5vctrl,
+               POWER_5VCTRL_CHARGE_4P2_ILIMIT_MASK,
+               0x8 << POWER_5VCTRL_CHARGE_4P2_ILIMIT_OFFSET);
+}
+
+void mx28_handle_5v_conflict(void)
+{
        uint32_t tmp;
 
        setbits_le32(&power_regs->hw_power_vddioctrl,
@@ -483,30 +628,16 @@ void mx28_handle_5v_conflict(void)
                        mx28_powerdown();
                        break;
                }
-       }
-}
 
-int mx28_get_batt_volt(void)
-{
-       struct mx28_power_regs *power_regs =
-               (struct mx28_power_regs *)MXS_POWER_BASE;
-       uint32_t volt = readl(&power_regs->hw_power_battmonitor);
-       volt &= POWER_BATTMONITOR_BATT_VAL_MASK;
-       volt >>= POWER_BATTMONITOR_BATT_VAL_OFFSET;
-       volt *= 8;
-       return volt;
-}
-
-int mx28_is_batt_ready(void)
-{
-       return (mx28_get_batt_volt() >= 3600);
+               if (tmp & POWER_STS_PSWITCH_MASK) {
+                       mx28_batt_boot();
+                       break;
+               }
+       }
 }
 
-void mx28_5v_boot(void)
+static void mx28_5v_boot(void)
 {
-       struct mx28_power_regs *power_regs =
-               (struct mx28_power_regs *)MXS_POWER_BASE;
-
        /*
         * NOTE: In original IMX-Bootlets, this also checks for VBUSVALID,
         * but their implementation always returns 1 so we omit it here.
@@ -525,25 +656,49 @@ void mx28_5v_boot(void)
        mx28_handle_5v_conflict();
 }
 
-void mx28_init_batt_bo(void)
+static void mx28_fixed_batt_boot(void)
 {
-       struct mx28_power_regs *power_regs =
-               (struct mx28_power_regs *)MXS_POWER_BASE;
+       writel(POWER_CTRL_ENIRQ_BATT_BO, &power_regs->hw_power_ctrl_clr);
+
+       setbits_le32(&power_regs->hw_power_5vctrl,
+               POWER_5VCTRL_PWDN_5VBRNOUT |
+               POWER_5VCTRL_ENABLE_DCDC |
+               POWER_5VCTRL_ILIMIT_EQ_ZERO |
+               POWER_5VCTRL_PWDN_5VBRNOUT |
+               POWER_5VCTRL_PWD_CHARGE_4P2_MASK);
+
+       writel(POWER_CHARGE_PWD_BATTCHRG, &power_regs->hw_power_charge_set);
+
+       clrbits_le32(&power_regs->hw_power_vdddctrl,
+               POWER_VDDDCTRL_DISABLE_FET |
+               POWER_VDDDCTRL_ENABLE_LINREG |
+               POWER_VDDDCTRL_DISABLE_STEPPING);
 
-       /* Brownout at 3V */
+       clrbits_le32(&power_regs->hw_power_vddactrl,
+               POWER_VDDACTRL_DISABLE_FET | POWER_VDDACTRL_ENABLE_LINREG |
+               POWER_VDDACTRL_DISABLE_STEPPING);
+
+       clrbits_le32(&power_regs->hw_power_vddioctrl,
+               POWER_VDDIOCTRL_DISABLE_FET |
+               POWER_VDDIOCTRL_DISABLE_STEPPING);
+
+       /* Stop 5V detection */
+       writel(POWER_5VCTRL_PWRUP_VBUS_CMPS,
+               &power_regs->hw_power_5vctrl_clr);
+}
+
+static void mx28_init_batt_bo(void)
+{
        clrsetbits_le32(&power_regs->hw_power_battmonitor,
                POWER_BATTMONITOR_BRWNOUT_LVL_MASK,
-               15 << POWER_BATTMONITOR_BRWNOUT_LVL_OFFSET);
+               BATT_BO_VAL << POWER_BATTMONITOR_BRWNOUT_LVL_OFFSET);
 
        writel(POWER_CTRL_BATT_BO_IRQ, &power_regs->hw_power_ctrl_clr);
        writel(POWER_CTRL_ENIRQ_BATT_BO, &power_regs->hw_power_ctrl_clr);
 }
 
-void mx28_switch_vddd_to_dcdc_source(void)
+static void mx28_switch_vddd_to_dcdc_source(void)
 {
-       struct mx28_power_regs *power_regs =
-               (struct mx28_power_regs *)MXS_POWER_BASE;
-
        clrsetbits_le32(&power_regs->hw_power_vdddctrl,
                POWER_VDDDCTRL_LINREG_OFFSET_MASK,
                POWER_VDDDCTRL_LINREG_OFFSET_1STEPS_BELOW);
@@ -553,70 +708,24 @@ void mx28_switch_vddd_to_dcdc_source(void)
                POWER_VDDDCTRL_DISABLE_STEPPING);
 }
 
-int mx28_is_batt_good(void)
-{
-       struct mx28_power_regs *power_regs =
-               (struct mx28_power_regs *)MXS_POWER_BASE;
-       uint32_t volt;
-
-       volt = readl(&power_regs->hw_power_battmonitor);
-       volt &= POWER_BATTMONITOR_BATT_VAL_MASK;
-       volt >>= POWER_BATTMONITOR_BATT_VAL_OFFSET;
-       volt *= 8;
-
-       if ((volt >= 2400) && (volt <= 4300))
-               return 1;
-
-       clrsetbits_le32(&power_regs->hw_power_5vctrl,
-               POWER_5VCTRL_CHARGE_4P2_ILIMIT_MASK,
-               0x3 << POWER_5VCTRL_CHARGE_4P2_ILIMIT_OFFSET);
-       writel(POWER_5VCTRL_PWD_CHARGE_4P2_MASK,
-               &power_regs->hw_power_5vctrl_clr);
-
-       clrsetbits_le32(&power_regs->hw_power_charge,
-               POWER_CHARGE_STOP_ILIMIT_MASK | POWER_CHARGE_BATTCHRG_I_MASK,
-               POWER_CHARGE_STOP_ILIMIT_10MA | 0x3);
-
-       writel(POWER_CHARGE_PWD_BATTCHRG, &power_regs->hw_power_charge_clr);
-       writel(POWER_5VCTRL_PWD_CHARGE_4P2_MASK,
-               &power_regs->hw_power_5vctrl_clr);
-
-       early_delay(500000);
-
-       volt = readl(&power_regs->hw_power_battmonitor);
-       volt &= POWER_BATTMONITOR_BATT_VAL_MASK;
-       volt >>= POWER_BATTMONITOR_BATT_VAL_OFFSET;
-       volt *= 8;
-
-       if (volt >= 3500)
-               return 0;
-
-       if (volt >= 2400)
-               return 1;
-
-       writel(POWER_CHARGE_STOP_ILIMIT_MASK | POWER_CHARGE_BATTCHRG_I_MASK,
-               &power_regs->hw_power_charge_clr);
-       writel(POWER_CHARGE_PWD_BATTCHRG, &power_regs->hw_power_charge_set);
-
-       return 0;
-}
-
-void mx28_power_configure_power_source(void)
+static void mx28_power_configure_power_source(void)
 {
        mx28_src_power_init();
 
-       mx28_5v_boot();
+       if (!fixed_batt_supply)
+               mx28_5v_boot();
+       else
+               mx28_fixed_batt_boot();
+
        mx28_power_clock2pll();
 
        mx28_init_batt_bo();
+
        mx28_switch_vddd_to_dcdc_source();
 }
 
-void mx28_enable_output_rail_protection(void)
+static void mx28_enable_output_rail_protection(void)
 {
-       struct mx28_power_regs *power_regs =
-               (struct mx28_power_regs *)MXS_POWER_BASE;
-
        writel(POWER_CTRL_VDDD_BO_IRQ | POWER_CTRL_VDDA_BO_IRQ |
                POWER_CTRL_VDDIO_BO_IRQ, &power_regs->hw_power_ctrl_clr);
 
@@ -630,13 +739,14 @@ void mx28_enable_output_rail_protection(void)
                        POWER_VDDIOCTRL_PWDN_BRNOUT);
 }
 
-int mx28_get_vddio_power_source_off(void)
+static inline int mx28_get_vddio_power_source_off(void)
 {
-       struct mx28_power_regs *power_regs =
-               (struct mx28_power_regs *)MXS_POWER_BASE;
        uint32_t tmp;
 
-       if (readl(&power_regs->hw_power_sts) & POWER_STS_VDD5V_GT_VDDIO) {
+       if ((readl(&power_regs->hw_power_sts) & POWER_STS_VDD5V_GT_VDDIO) &&
+               !(readl(&power_regs->hw_power_5vctrl) &
+                       POWER_5VCTRL_ILIMIT_EQ_ZERO)) {
+
                tmp = readl(&power_regs->hw_power_vddioctrl);
                if (tmp & POWER_VDDIOCTRL_DISABLE_FET) {
                        if ((tmp & POWER_VDDIOCTRL_LINREG_OFFSET_MASK) ==
@@ -655,13 +765,10 @@ int mx28_get_vddio_power_source_off(void)
        }
 
        return 0;
-
 }
 
-int mx28_get_vddd_power_source_off(void)
+static inline int mx28_get_vddd_power_source_off(void)
 {
-       struct mx28_power_regs *power_regs =
-               (struct mx28_power_regs *)MXS_POWER_BASE;
        uint32_t tmp;
 
        tmp = readl(&power_regs->hw_power_vdddctrl);
@@ -689,67 +796,89 @@ int mx28_get_vddd_power_source_off(void)
        return 0;
 }
 
-void mx28_power_set_vddio(uint32_t new_target, uint32_t new_brownout)
+static inline int mx28_get_vdda_power_source_off(void)
 {
-       struct mx28_power_regs *power_regs =
-               (struct mx28_power_regs *)MXS_POWER_BASE;
-       uint32_t cur_target, diff, bo_int = 0;
-       uint32_t powered_by_linreg = 0;
+       uint32_t tmp;
 
-       new_brownout = new_target - new_brownout;
+       tmp = readl(&power_regs->hw_power_vddactrl);
+       if (tmp & POWER_VDDACTRL_DISABLE_FET) {
+               if ((tmp & POWER_VDDACTRL_LINREG_OFFSET_MASK) ==
+                       POWER_VDDACTRL_LINREG_OFFSET_0STEPS)
+                       return 1;
+       }
 
-       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 */
+       if (readl(&power_regs->hw_power_sts) & POWER_STS_VDD5V_GT_VDDIO) {
+               if (!(readl(&power_regs->hw_power_5vctrl) &
+                       POWER_5VCTRL_ENABLE_DCDC))
+                       return 1;
+       }
 
-       powered_by_linreg = mx28_get_vddio_power_source_off();
-       if (new_target > cur_target) {
+       if (!(tmp & POWER_VDDACTRL_ENABLE_LINREG)) {
+               if ((tmp & POWER_VDDACTRL_LINREG_OFFSET_MASK) ==
+                       POWER_VDDACTRL_LINREG_OFFSET_1STEPS_BELOW)
+                       return 1;
+       }
+       return 0;
+}
 
-               if (powered_by_linreg) {
-                       bo_int = readl(&power_regs->hw_power_vddioctrl);
-                       clrbits_le32(&power_regs->hw_power_vddioctrl,
-                                       POWER_CTRL_ENIRQ_VDDIO_BO);
-               }
+static inline void mx28_power_set_vddx(
+       uint32_t new_target, uint32_t new_brownout,
+       uint32_t *reg, const char *name,
+       uint32_t min_trg, uint32_t max_trg,
+       uint8_t step_size,
+       uint32_t trg_mask, uint32_t trg_shift,
+       uint32_t bo_mask, uint32_t bo_shift,
+       int powered_by_linreg)
+{
+       uint32_t cur_target, cur_brownout;
+       uint32_t diff;
+
+       if (new_target < min_trg || new_target > max_trg)
+               new_target = (new_target > max_trg) ? max_trg : min_trg;
+
+       if (new_brownout / step_size > 7)
+               new_brownout = 7 * step_size;
+
+       cur_target = readl(reg);
+
+       cur_brownout = (cur_target & bo_mask) >> bo_shift;
+       cur_brownout *= step_size;
 
-               setbits_le32(&power_regs->hw_power_vddioctrl,
-                               POWER_VDDIOCTRL_BO_OFFSET_MASK);
+       cur_target = (cur_target & trg_mask) >> trg_shift;
+       cur_target *= step_size;
+       cur_target += min_trg;
+       if (cur_target > max_trg)
+               cur_target = max_trg;
+
+       if (new_target == cur_target && new_brownout == cur_brownout)
+               return;
+
+       if (new_target > cur_target) {
+               setbits_le32(reg, bo_mask);
                do {
                        if (new_target - cur_target > 100)
                                diff = cur_target + 100;
                        else
                                diff = new_target;
 
-                       diff -= 2800;
-                       diff /= 50;
+                       diff -= min_trg;
+                       diff /= step_size;
 
-                       clrsetbits_le32(&power_regs->hw_power_vddioctrl,
-                               POWER_VDDIOCTRL_TRG_MASK, diff);
+                       clrsetbits_le32(reg, trg_mask, diff);
 
-                       if (powered_by_linreg ||
-                               (readl(&power_regs->hw_power_sts) &
-                                       POWER_STS_VDD5V_GT_VDDIO))
-                               early_delay(500);
-                       else {
+                       if (powered_by_linreg) {
+                               early_delay(1500);
+                       } else {
                                while (!(readl(&power_regs->hw_power_sts) &
-                                       POWER_STS_DC_OK))
-                                       ;
-
+                                       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 */
+                       cur_target = readl(reg);
+                       cur_target &= trg_mask;
+                       cur_target *= step_size;
+                       cur_target += min_trg;
                } 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)
@@ -757,164 +886,151 @@ void mx28_power_set_vddio(uint32_t new_target, uint32_t new_brownout)
                        else
                                diff = new_target;
 
-                       diff -= 2800;
-                       diff /= 50;
+                       diff -= min_trg;
+                       diff /= step_size;
 
-                       clrsetbits_le32(&power_regs->hw_power_vddioctrl,
-                               POWER_VDDIOCTRL_TRG_MASK, diff);
+                       clrsetbits_le32(reg, trg_mask, diff);
 
-                       if (powered_by_linreg ||
-                               (readl(&power_regs->hw_power_sts) &
-                                       POWER_STS_VDD5V_GT_VDDIO))
-                               early_delay(500);
-                       else {
+                       if (powered_by_linreg) {
+                               early_delay(1500);
+                       } else {
                                while (!(readl(&power_regs->hw_power_sts) &
-                                       POWER_STS_DC_OK))
-                                       ;
-
+                                       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 */
+                       cur_target = readl(reg);
+                       cur_target &= trg_mask;
+                       cur_target *= step_size;
+                       cur_target += min_trg;
                } while (new_target < cur_target);
        }
 
-       clrsetbits_le32(&power_regs->hw_power_vddioctrl,
-                       POWER_VDDDCTRL_BO_OFFSET_MASK,
-                       new_brownout << POWER_VDDDCTRL_BO_OFFSET_OFFSET);
+       clrsetbits_le32(reg, bo_mask, (new_brownout / step_size) << bo_shift);
 }
 
-void mx28_power_set_vddd(uint32_t new_target, uint32_t new_brownout)
-{
-       struct mx28_power_regs *power_regs =
-               (struct mx28_power_regs *)MXS_POWER_BASE;
-       uint32_t cur_target, diff, bo_int = 0;
-       uint32_t powered_by_linreg = 0;
+#define __mx28_power_set_vddx(trg, bo, min, max, step, reg, name, lr)  \
+       mx28_power_set_vddx(trg, bo,                                    \
+                       &power_regs->hw_power_##reg##ctrl, #name,       \
+                       min, max, step,                                 \
+                       POWER_##name##CTRL_TRG_MASK,                    \
+                       POWER_##name##CTRL_TRG_OFFSET,                  \
+                       POWER_##name##CTRL_BO_OFFSET_MASK,              \
+                       POWER_##name##CTRL_BO_OFFSET_OFFSET, lr)
 
-       new_brownout = new_target - new_brownout;
-
-       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 = mx28_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);
-               }
-
-               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);
+static inline void mx28_power_set_vddd(uint32_t target, uint32_t brownout)
+{
+       int powered_by_linreg = mx28_get_vddd_power_source_off();
+       uint32_t bo_int = 0;
 
-                       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))
-                                       ;
+       if (powered_by_linreg) {
+               bo_int = readl(&power_regs->hw_power_vdddctrl);
+               clrbits_le32(&power_regs->hw_power_vdddctrl,
+                       POWER_CTRL_ENIRQ_VDDD_BO);
+       }
 
-                       }
+       __mx28_power_set_vddx(target, brownout, 800, 1575, 25, vddd, VDDD,
+                       powered_by_linreg);
 
-                       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);
+       }
+}
 
-               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;
+static inline void mx28_power_set_vddio(uint32_t target, uint32_t brownout)
+{
+       int powered_by_linreg = mx28_get_vddio_power_source_off();
+       uint32_t bo_int = 0;
 
-                       diff -= 800;
-                       diff /= 25;
+       if (powered_by_linreg) {
+               bo_int = readl(&power_regs->hw_power_vddioctrl);
+               clrbits_le32(&power_regs->hw_power_vddioctrl,
+                       POWER_CTRL_ENIRQ_VDDIO_BO);
+       }
+       __mx28_power_set_vddx(target, brownout, 2800, 3600, 50, vddio, VDDIO,
+                       powered_by_linreg);
+       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);
+       }
+}
 
-                       clrsetbits_le32(&power_regs->hw_power_vdddctrl,
-                                       POWER_VDDDCTRL_TRG_MASK, diff);
+static inline void mx28_power_set_vdda(uint32_t target, uint32_t brownout)
+{
+       int powered_by_linreg = mx28_get_vdda_power_source_off();
+       uint32_t bo_int = 0;
 
-                       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))
-                                       ;
+       if (powered_by_linreg) {
+               bo_int = readl(&power_regs->hw_power_vddioctrl);
+               clrbits_le32(&power_regs->hw_power_vddioctrl,
+                       POWER_CTRL_ENIRQ_VDDIO_BO);
+       }
+       __mx28_power_set_vddx(target, brownout, 1500, 2275, 25, vdda, VDDA,
+               powered_by_linreg);
+       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);
+       }
+}
 
-                       }
+static inline void mx28_power_set_vddmem(uint32_t target, uint32_t brownout)
+{
+       __mx28_power_set_vddx(target, brownout, 1100, 1750, 25, vddmem, VDDMEM,
+                       0);
 
-                       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);
-       }
+       clrbits_le32(&power_regs->hw_power_vddmemctrl,
+               POWER_VDDMEMCTRL_ENABLE_LINREG |
+               POWER_VDDMEMCTRL_ENABLE_ILIMIT);
+}
 
-       clrsetbits_le32(&power_regs->hw_power_vdddctrl,
-                       POWER_VDDDCTRL_BO_OFFSET_MASK,
-                       new_brownout << POWER_VDDDCTRL_BO_OFFSET_OFFSET);
+void mx28_setup_batt_detect(void)
+{
+       mx28_lradc_init();
+       mx28_lradc_enable_batt_measurement();
+       early_delay(10);
 }
 
 void mx28_power_init(void)
 {
-       struct mx28_power_regs *power_regs =
-               (struct mx28_power_regs *)MXS_POWER_BASE;
-
        mx28_power_clock2xtal();
        mx28_power_clear_auto_restart();
        mx28_power_set_linreg();
-       mx28_power_setup_5v_detect();
+       if (!fixed_batt_supply)
+               mx28_power_setup_5v_detect();
+
        mx28_power_configure_power_source();
        mx28_enable_output_rail_protection();
 
-       mx28_power_set_vddio(3300, 3150);
+       mx28_power_set_vddio(VDDIO_VAL, VDDIO_BO_VAL);
 
-       mx28_power_set_vddd(1350, 1200);
+       mx28_power_set_vddd(VDDD_VAL, VDDD_BO_VAL);
+
+       mx28_power_set_vdda(VDDA_VAL, VDDA_BO_VAL);
+
+       mx28_power_set_vddmem(VDDMEM_VAL, VDDMEM_BO_VAL);
 
        writel(POWER_CTRL_VDDD_BO_IRQ | POWER_CTRL_VDDA_BO_IRQ |
                POWER_CTRL_VDDIO_BO_IRQ | POWER_CTRL_VDD5V_DROOP_IRQ |
                POWER_CTRL_VBUS_VALID_IRQ | POWER_CTRL_BATT_BO_IRQ |
                POWER_CTRL_DCDC4P2_BO_IRQ, &power_regs->hw_power_ctrl_clr);
-
-       writel(POWER_5VCTRL_PWDN_5VBRNOUT, &power_regs->hw_power_5vctrl_set);
-
-       early_delay(1000);
+       if (!fixed_batt_supply)
+               writel(POWER_5VCTRL_PWDN_5VBRNOUT,
+                       &power_regs->hw_power_5vctrl_set);
 }
 
 #ifdef CONFIG_SPL_MX28_PSWITCH_WAIT
 void mx28_power_wait_pswitch(void)
 {
-       struct mx28_power_regs *power_regs =
-               (struct mx28_power_regs *)MXS_POWER_BASE;
-
        while (!(readl(&power_regs->hw_power_sts) & POWER_STS_PSWITCH_MASK))
                ;
 }
index 5b73f4a2b3e1a4a297f131b0fd67bef610585018..116932cb56d843219248221e06a193cda9cedbf9 100644 (file)
 
 DECLARE_GLOBAL_DATA_PTR;
 
-#define timestamp (gd->tbl)
-#define lastdec (gd->lastinc)
+/* Enable this to verify that the code can correctly
+ * handle the timer rollover
+ */
+/* #define DEBUG_TIMER_WRAP */
+
+#ifdef DEBUG_TIMER_WRAP
+/*
+ * Let the timer wrap 15 seconds after start to catch misbehaving
+ * timer related code early
+ */
+#define TIMER_START            (-time_to_tick(15 * CONFIG_SYS_HZ))
+#else
+#define TIMER_START            0UL
+#endif
 
 /*
  * This driver uses 1kHz clock source.
@@ -54,12 +66,6 @@ static inline unsigned long time_to_tick(unsigned long time)
        return time * (MX28_INCREMENTER_HZ / CONFIG_SYS_HZ);
 }
 
-/* Calculate how many ticks happen in "us" microseconds */
-static inline unsigned long us_to_tick(unsigned long us)
-{
-       return (us * MX28_INCREMENTER_HZ) / 1000000;
-}
-
 int timer_init(void)
 {
        struct mx28_timrot_regs *timrot_regs =
@@ -76,34 +82,70 @@ int timer_init(void)
                TIMROT_TIMCTRLn_SELECT_1KHZ_XTAL,
                &timrot_regs->hw_timrot_timctrl0);
 
-       /* Set fixed_count to maximal value */
+#ifndef DEBUG_TIMER_WRAP
+       /* Set fixed_count to maximum value */
        writel(TIMER_LOAD_VAL, &timrot_regs->hw_timrot_fixed_count0);
-
+#else
+       /* Set fixed_count so that the counter will wrap after 20 seconds */
+       writel(20 * MX28_INCREMENTER_HZ,
+               &timrot_regs->hw_timrot_fixed_count0);
+       gd->lastinc = TIMER_LOAD_VAL - 20 * MX28_INCREMENTER_HZ;
+#endif
+#ifdef DEBUG_TIMER_WRAP
+       /* Make the usec counter roll over 30 seconds after startup */
+       writel(-30000000, MX28_HW_DIGCTL_MICROSECONDS);
+#endif
+       writel(TIMROT_TIMCTRLn_UPDATE,
+               &timrot_regs->hw_timrot_timctrl0_clr);
+#ifdef DEBUG_TIMER_WRAP
+       /* Set fixed_count to maximal value for subsequent loads */
+       writel(TIMER_LOAD_VAL, &timrot_regs->hw_timrot_fixed_count0);
+#endif
+       gd->timer_rate_hz = MX28_INCREMENTER_HZ;
+       gd->tbl = TIMER_START;
+       gd->tbu = 0;
        return 0;
 }
 
+/* We use the HW_DIGCTL_MICROSECONDS register for sub-millisecond timer. */
+#define        MX28_HW_DIGCTL_MICROSECONDS     0x8001c0c0
+
+void __udelay(unsigned long usec)
+{
+       uint32_t start = readl(MX28_HW_DIGCTL_MICROSECONDS);
+
+       while (readl(MX28_HW_DIGCTL_MICROSECONDS) - start <= usec)
+               /* use '<=' to guarantee a delay of _at least_
+                * the given number of microseconds.
+                * No need for fancy rollover checks
+                * Two's complement arithmetic applied correctly
+                * does everything that's needed  automagically!
+                */
+               ;
+}
+
+/* Note: This function works correctly for TIMER_LOAD_VAL == 0xffffffff!
+ * The rollover is handled automagically due to the properties of
+ * two's complement arithmetic.
+ * For any other value of TIMER_LOAD_VAL the calculations would have
+ * to be done modulus(TIMER_LOAD_VAL + 1).
+ */
 unsigned long long get_ticks(void)
 {
        struct mx28_timrot_regs *timrot_regs =
                (struct mx28_timrot_regs *)MXS_TIMROT_BASE;
-
-       /* Current tick value */
-       uint32_t now = readl(&timrot_regs->hw_timrot_running_count0);
-
-       if (lastdec >= now) {
-               /*
-                * normal mode (non roll)
-                * move stamp forward with absolut diff ticks
-                */
-               timestamp += (lastdec - now);
-       } else {
-               /* we have rollover of decrementer */
-               timestamp += (TIMER_LOAD_VAL - now) + lastdec;
-
-       }
-       lastdec = now;
-
-       return timestamp;
+       /* The timer is counting down, so subtract the register value from
+        * the counter period length to get an incrementing timestamp
+        */
+       unsigned long now = -readl(&timrot_regs->hw_timrot_running_count0);
+       ulong inc = now - gd->lastinc;
+
+       gd->tbl += inc;
+       gd->lastinc = now;
+       /* Since the get_timer() function only uses a 32bit value
+        * it doesn't make sense to return a real 64 bit value here.
+        */
+       return gd->tbl;
 }
 
 ulong get_timer_masked(void)
@@ -113,44 +155,15 @@ ulong get_timer_masked(void)
 
 ulong get_timer(ulong base)
 {
-       return get_timer_masked() - base;
-}
-
-/* We use the HW_DIGCTL_MICROSECONDS register for sub-millisecond timer. */
-#define        MX28_HW_DIGCTL_MICROSECONDS     0x8001c0c0
-
-void __udelay(unsigned long usec)
-{
-       uint32_t old, new, incr;
-       uint32_t counter = 0;
-
-       old = readl(MX28_HW_DIGCTL_MICROSECONDS);
-
-       while (counter < usec) {
-               new = readl(MX28_HW_DIGCTL_MICROSECONDS);
-
-               /* Check if the timer wrapped. */
-               if (new < old) {
-                       incr = 0xffffffff - old;
-                       incr += new;
-               } else {
-                       incr = new - old;
-               }
-
-               /*
-                * Check if we are close to the maximum time and the counter
-                * would wrap if incremented. If that's the case, break out
-                * from the loop as the requested delay time passed.
-                */
-               if (counter + incr < counter)
-                       break;
-
-               counter += incr;
-               old = new;
-       }
+       /* NOTE: time_to_tick(base) is required to correctly handle rollover! */
+       return tick_to_time(get_ticks() - time_to_tick(base));
 }
 
+/*
+ * This function is derived from PowerPC code (timebase clock frequency).
+ * On ARM it returns the number of timer ticks per second.
+ */
 ulong get_tbclk(void)
 {
-       return MX28_INCREMENTER_HZ;
+       return gd->timer_rate_hz;
 }
index 7768912603b2cdb7cb151b4c25f0381fcd53aa44..0ad202d7afd8b6f975760ad8d85819ff7f998b69 100644 (file)
@@ -18,9 +18,12 @@ LIB  = $(obj)lib$(SOC).o
 
 COBJS  += clock.o
 COBJS  += sys_info.o
-COBJS  += ddr.o
+COBJS-$(CONFIG_SYS_SDRAM_DDR3) += ddr3.o
+COBJS-$(CONFIG_SYS_SDRAM_DDR2) += ddr2.o
+COBJS  += mem.o
 COBJS  += emif4.o
 COBJS  += board.o
+COBJS-$(CONFIG_NAND_AM33XX) += elm.o
 
 SRCS   := $(SOBJS:.o=.S) $(COBJS:.o=.c)
 OBJS   := $(addprefix $(obj),$(COBJS) $(COBJS-y) $(SOBJS))
index 6b7a494d7ccd44068a3cdb04e4bdebc8abf7129e..46134899e4886612404b1e2c4d7438de5f34798d 100644 (file)
 
 DECLARE_GLOBAL_DATA_PTR;
 
-struct wd_timer *wdtimer = (struct wd_timer *)WDT_BASE;
-struct gptimer *timer_base = (struct gptimer *)CONFIG_SYS_TIMERBASE;
-struct uart_sys *uart_base = (struct uart_sys *)DEFAULT_UART_BASE;
-
 /* UART Defines */
 #ifdef CONFIG_SPL_BUILD
 #define UART_RESET             (0x1 << 1)
@@ -40,11 +36,68 @@ struct uart_sys *uart_base = (struct uart_sys *)DEFAULT_UART_BASE;
 #define UART_SMART_IDLE_EN     (0x1 << 0x3)
 #endif
 
+void reset_cpu(unsigned long ignored)
+{
+       /* clear RESET flags */
+       writel(~0, PRM_RSTST);
+       writel(PRM_RSTCTRL_RESET, PRM_RSTCTRL);
+}
+
+#ifdef CONFIG_HW_WATCHDOG
+void hw_watchdog_reset(void)
+{
+       struct wd_timer *wdtimer = (struct wd_timer *)WDT_BASE;
+       static int trg __attribute__((section(".data")));
+
+       switch (trg) {
+       case 0:
+       case 1:
+               if (readl(&wdtimer->wdtwwps) & (1 << 4))
+                       return;
+               writel(trg ? 0x5555 : 0xaaaa, &wdtimer->wdtwspr);
+               break;
+       case 2:
+               if (readl(&wdtimer->wdtwwps) & (1 << 2))
+                       return;
+               /* 10 sec timeout */
+               writel(-32768 * 10, &wdtimer->wdtwldr);
+
+               if (readl(&wdtimer->wdtwwps) & (1 << 0))
+                       return;
+               /* prescaler = 1 */
+               writel(0, &wdtimer->wdtwclr);
+               break;
+
+       case 3:
+       case 4:
+               /* enable watchdog */
+               if (readl(&wdtimer->wdtwwps) & (1 << 4))
+                       return;
+               writel((trg & 1) ? 0xBBBB : 0x4444, &wdtimer->wdtwspr);
+               break;
+
+       default:
+               /* retrigger watchdog */
+               if (readl(&wdtimer->wdtwwps) & (1 << 3))
+                       return;
+
+               writel(trg, &wdtimer->wdtwtgr);
+               trg ^= 0x2;
+               return;
+       }
+       trg++;
+}
+#endif
+
 /*
  * early system init of muxing and clocks.
  */
 void s_init(void)
 {
+#ifdef CONFIG_SPL_BUILD
+#ifndef CONFIG_HW_WATCHDOG
+       struct wd_timer *wdtimer = (struct wd_timer *)WDT_BASE;
+
        /* WDT1 is already running when the bootloader gets control
         * Disable it to avoid "random" resets
         */
@@ -54,13 +107,13 @@ void s_init(void)
        writel(0x5555, &wdtimer->wdtwspr);
        while (readl(&wdtimer->wdtwwps) != 0x0)
                ;
-
-#ifdef CONFIG_SPL_BUILD
+#endif
        /* Setup the PLLs and the clocks for the peripherals */
        pll_init();
 
        /* UART softreset */
        u32 regVal;
+       struct uart_sys *uart_base = (struct uart_sys *)DEFAULT_UART_BASE;
 
        enable_uart0_pin_mux();
 
@@ -77,40 +130,61 @@ void s_init(void)
        writel(regVal, &uart_base->uartsyscfg);
 
        /* Initialize the Timer */
-       init_timer();
+       timer_init();
 
        preloader_console_init();
 
        config_ddr();
-#endif
 
        /* Enable MMC0 */
        enable_mmc0_pin_mux();
+#endif
 }
 
-/* Initialize timer */
-void init_timer(void)
+#if defined(CONFIG_OMAP_HSMMC) && !defined(CONFIG_SPL_BUILD)
+int board_mmc_init(bd_t *bis)
 {
-       /* Reset the Timer */
-       writel(0x2, (&timer_base->tscir));
-
-       /* Wait until the reset is done */
-       while (readl(&timer_base->tiocp_cfg) & 1)
-               ;
-
-       /* Start the Timer */
-       writel(0x1, (&timer_base->tclr));
+       int ret = 0;
+#ifdef CONFIG_OMAP_MMC_DEV_0
+       ret = omap_mmc_init(0, 0, 0);
+       if (ret)
+               printf("Error %d while initializing MMC dev 0\n", ret);
+#endif
+#ifdef CONFIG_OMAP_MMC_DEV_1
+       ret = omap_mmc_init(1, 0, 0);
+       if (ret)
+               printf("Error %d while initializing MMC dev 1\n", ret);
+#endif
+       return ret;
 }
+#endif
 
-#if defined(CONFIG_OMAP_HSMMC) && !defined(CONFIG_SPL_BUILD)
-int board_mmc_init(bd_t *bis)
+#ifndef CONFIG_SYS_DCACHE_OFF
+void enable_caches(void)
 {
-       return omap_mmc_init(0, 0, 0);
+       /* Enable D-cache. I-cache is already enabled in start.S */
+       dcache_enable();
 }
 #endif
 
-void setup_clocks_for_console(void)
+static u32 cortex_rev(void)
+{
+
+       unsigned int rev;
+
+       /* Read Main ID Register (MIDR) */
+       asm ("mrc p15, 0, %0, c0, c0, 0" : "=r" (rev));
+
+       return rev;
+}
+
+void omap_rev_string(void)
 {
-       /* Not yet implemented */
-       return;
+       u32 omap_rev = cortex_rev();
+       u32 omap_variant = (omap_rev & 0xFFFF0000) >> 16;
+       u32 major_rev = (omap_rev & 0x00000F00) >> 8;
+       u32 minor_rev = (omap_rev & 0x000000F0) >> 4;
+
+       printf("OMAP%x ES%x.%x\n", omap_variant, major_rev,
+               minor_rev);
 }
index bbb9c1353f211fd563c8bf1807c087f8662a60cc..b489da084e234fa90dc447f3421ff0ea8cf78b1b 100644 (file)
 #define CLK_DIV_MASK           0x1f
 #define CLK_DIV2_MASK          0x7f
 #define CLK_SEL_SHIFT          0x8
+#define CLK_MODE_MASK          0x7
 #define CLK_MODE_SEL           0x7
-#define CLK_MODE_MASK          0xfffffff8
-#define CLK_DIV_SEL            0xFFFFFFE0
 
 
 const struct cm_perpll *cmper = (struct cm_perpll *)CM_PER;
 const struct cm_wkuppll *cmwkup = (struct cm_wkuppll *)CM_WKUP;
 const struct cm_dpll *cmdpll = (struct cm_dpll *)CM_DPLL;
 
+#ifdef CONFIG_SPL_BUILD
+#define enable_clk(reg, val) __enable_clk(#reg, &reg, val)
+
+static void __enable_clk(const char *name, const void *reg, u32 mask)
+{
+       unsigned long timeout = 10000000;
+
+       writel(mask, reg);
+       while (readl(reg) != mask)
+               /* poor man's timeout, since timers not initialized */
+               if (timeout-- == 0)
+                       /* no error message, since console not yet available */
+                       break;
+}
+
 static void enable_interface_clocks(void)
 {
        /* Enable all the Interconnect Modules */
-       writel(PRCM_MOD_EN, &cmper->l3clkctrl);
-       while (readl(&cmper->l3clkctrl) != PRCM_MOD_EN)
-               ;
-
-       writel(PRCM_MOD_EN, &cmper->l4lsclkctrl);
-       while (readl(&cmper->l4lsclkctrl) != PRCM_MOD_EN)
-               ;
-
-       writel(PRCM_MOD_EN, &cmper->l4fwclkctrl);
-       while (readl(&cmper->l4fwclkctrl) != PRCM_MOD_EN)
-               ;
-
-       writel(PRCM_MOD_EN, &cmwkup->wkl4wkclkctrl);
-       while (readl(&cmwkup->wkl4wkclkctrl) != PRCM_MOD_EN)
-               ;
-
-       writel(PRCM_MOD_EN, &cmper->l3instrclkctrl);
-       while (readl(&cmper->l3instrclkctrl) != PRCM_MOD_EN)
-               ;
-
-       writel(PRCM_MOD_EN, &cmper->l4hsclkctrl);
-       while (readl(&cmper->l4hsclkctrl) != PRCM_MOD_EN)
-               ;
+       enable_clk(cmper->l3clkctrl, PRCM_MOD_EN);
+       enable_clk(cmper->l4lsclkctrl, PRCM_MOD_EN);
+       enable_clk(cmper->l4fwclkctrl, PRCM_MOD_EN);
+       enable_clk(cmwkup->wkl4wkclkctrl, PRCM_MOD_EN);
+       enable_clk(cmper->l3instrclkctrl, PRCM_MOD_EN);
+       enable_clk(cmper->l4hsclkctrl, PRCM_MOD_EN);
+#ifdef CONFIG_HW_WATCHDOG
+       enable_clk(cmwkup->wdtimer1ctrl, PRCM_MOD_EN);
+#endif
+       /* GPIO0 */
+       enable_clk(cmwkup->gpio0clkctrl, PRCM_MOD_EN);
 }
 
 /*
@@ -92,32 +94,58 @@ static void power_domain_wkup_transition(void)
 static void enable_per_clocks(void)
 {
        /* Enable the control module though RBL would have done it*/
-       writel(PRCM_MOD_EN, &cmwkup->wkctrlclkctrl);
-       while (readl(&cmwkup->wkctrlclkctrl) != PRCM_MOD_EN)
-               ;
-
-       /* Enable the module clock */
-       writel(PRCM_MOD_EN, &cmper->timer2clkctrl);
-       while (readl(&cmper->timer2clkctrl) != PRCM_MOD_EN)
-               ;
-
+       enable_clk(cmwkup->wkctrlclkctrl, PRCM_MOD_EN);
+       /* Enable the timer2 clock */
+       enable_clk(cmper->timer2clkctrl, PRCM_MOD_EN);
        /* Select the Master osc 24 MHZ as Timer2 clock source */
        writel(0x1, &cmdpll->clktimer2clk);
 
+#ifdef CONFIG_SYS_NS16550_COM1
        /* UART0 */
-       writel(PRCM_MOD_EN, &cmwkup->wkup_uart0ctrl);
-       while (readl(&cmwkup->wkup_uart0ctrl) != PRCM_MOD_EN)
-               ;
-
-       /* MMC0*/
-       writel(PRCM_MOD_EN, &cmper->mmc0clkctrl);
-       while (readl(&cmper->mmc0clkctrl) != PRCM_MOD_EN)
-               ;
-
+       enable_clk(cmwkup->wkup_uart0ctrl, PRCM_MOD_EN);
+#endif
+#ifdef CONFIG_SYS_NS16550_COM2
+       enable_clk(cmper->uart1clkctrl, PRCM_MOD_EN);
+#endif
+#ifdef CONFIG_SYS_NS16550_COM3
+       enable_clk(cmper->uart2clkctrl, PRCM_MOD_EN);
+#endif
+#ifdef CONFIG_SYS_NS16550_COM4
+       enable_clk(cmper->uart3clkctrl, PRCM_MOD_EN);
+#endif
+#ifdef CONFIG_SYS_NS16550_COM5
+       enable_clk(cmper->uart4clkctrl, PRCM_MOD_EN);
+#endif
+#ifdef CONFIG_SYS_NS16550_COM6
+       enable_clk(cmper->uart5clkctrl, PRCM_MOD_EN);
+#endif
+       /* GPMC */
+       enable_clk(cmper->gpmcclkctrl, PRCM_MOD_EN);
+
+       /* ELM */
+       enable_clk(cmper->elmclkctrl, PRCM_MOD_EN);
+
+       /* Ethernet */
+       enable_clk(cmper->cpswclkctrl, PRCM_MOD_EN);
+       enable_clk(cmper->cpgmac0clkctrl, PRCM_MOD_EN);
+
+       /* MMC */
+#ifndef CONFIG_OMAP_MMC_DEV_0
+       enable_clk(cmper->mmc0clkctrl, PRCM_MOD_EN);
+#endif
+#ifdef CONFIG_OMAP_MMC_DEV_1
+       enable_clk(cmper->mmc1clkctrl, PRCM_MOD_EN);
+#endif
+#ifdef CONFIG_LCD
+       enable_clk(cmper->lcdcclkctrl, PRCM_MOD_EN);
+#endif
        /* i2c0 */
-       writel(PRCM_MOD_EN, &cmwkup->wkup_i2c0ctrl);
-       while (readl(&cmwkup->wkup_i2c0ctrl) != PRCM_MOD_EN)
-               ;
+       enable_clk(cmwkup->wkup_i2c0ctrl, PRCM_MOD_EN);
+
+       /* GPIO1-3 */
+       enable_clk(cmper->gpio1clkctrl, PRCM_MOD_EN);
+       enable_clk(cmper->gpio2clkctrl, PRCM_MOD_EN);
+       enable_clk(cmper->gpio3clkctrl, PRCM_MOD_EN);
 }
 
 static void mpu_pll_config(void)
@@ -133,15 +161,16 @@ static void mpu_pll_config(void)
        while (readl(&cmwkup->idlestdpllmpu) != ST_MN_BYPASS)
                ;
 
-       clksel = clksel & (~CLK_SEL_MASK);
-       clksel = clksel | ((MPUPLL_M << CLK_SEL_SHIFT) | MPUPLL_N);
+       clksel &= ~CLK_SEL_MASK;
+       clksel |= (MPUPLL_M << CLK_SEL_SHIFT) | MPUPLL_N;
        writel(clksel, &cmwkup->clkseldpllmpu);
 
-       div_m2 = div_m2 & ~CLK_DIV_MASK;
-       div_m2 = div_m2 | MPUPLL_M2;
+       div_m2 &= ~CLK_DIV_MASK;
+       div_m2 |= MPUPLL_M2;
        writel(div_m2, &cmwkup->divm2dpllmpu);
 
-       clkmode = clkmode | CLK_MODE_SEL;
+       clkmode &= ~CLK_MODE_MASK;
+       clkmode |= CLK_MODE_SEL;
        writel(clkmode, &cmwkup->clkmoddpllmpu);
 
        while (readl(&cmwkup->idlestdpllmpu) != ST_DPLL_CLK)
@@ -164,23 +193,24 @@ static void core_pll_config(void)
        while (readl(&cmwkup->idlestdpllcore) != ST_MN_BYPASS)
                ;
 
-       clksel = clksel & (~CLK_SEL_MASK);
-       clksel = clksel | ((COREPLL_M << CLK_SEL_SHIFT) | COREPLL_N);
+       clksel &= ~CLK_SEL_MASK;
+       clksel |= ((COREPLL_M << CLK_SEL_SHIFT) | COREPLL_N);
        writel(clksel, &cmwkup->clkseldpllcore);
 
-       div_m4 = div_m4 & ~CLK_DIV_MASK;
-       div_m4 = div_m4 | COREPLL_M4;
+       div_m4 &= ~CLK_DIV_MASK;
+       div_m4 |= COREPLL_M4;
        writel(div_m4, &cmwkup->divm4dpllcore);
 
-       div_m5 = div_m5 & ~CLK_DIV_MASK;
-       div_m5 = div_m5 | COREPLL_M5;
+       div_m5 &= ~CLK_DIV_MASK;
+       div_m5 |= COREPLL_M5;
        writel(div_m5, &cmwkup->divm5dpllcore);
 
-       div_m6 = div_m6 & ~CLK_DIV_MASK;
-       div_m6 = div_m6 | COREPLL_M6;
+       div_m6 &= ~CLK_DIV_MASK;
+       div_m6 |= COREPLL_M6;
        writel(div_m6, &cmwkup->divm6dpllcore);
 
-       clkmode = clkmode | CLK_MODE_SEL;
+       clkmode &= ~CLK_MODE_MASK;
+       clkmode |= CLK_MODE_SEL;
        writel(clkmode, &cmwkup->clkmoddpllcore);
 
        while (readl(&cmwkup->idlestdpllcore) != ST_DPLL_CLK)
@@ -201,21 +231,54 @@ static void per_pll_config(void)
        while (readl(&cmwkup->idlestdpllper) != ST_MN_BYPASS)
                ;
 
-       clksel = clksel & (~CLK_SEL_MASK);
-       clksel = clksel | ((PERPLL_M << CLK_SEL_SHIFT) | PERPLL_N);
+       clksel &= ~CLK_SEL_MASK;
+       clksel |= (PERPLL_M << CLK_SEL_SHIFT) | PERPLL_N;
        writel(clksel, &cmwkup->clkseldpllper);
 
-       div_m2 = div_m2 & ~CLK_DIV2_MASK;
-       div_m2 = div_m2 | PERPLL_M2;
+       div_m2 &= ~CLK_DIV2_MASK;
+       div_m2 |= PERPLL_M2;
        writel(div_m2, &cmwkup->divm2dpllper);
 
-       clkmode = clkmode | CLK_MODE_SEL;
+       clkmode &= ~CLK_MODE_MASK;
+       clkmode |= CLK_MODE_SEL;
        writel(clkmode, &cmwkup->clkmoddpllper);
 
        while (readl(&cmwkup->idlestdpllper) != ST_DPLL_CLK)
                ;
 }
 
+static void disp_pll_config(void)
+{
+#ifdef CONFIG_LCD
+       u32 clkmode, clksel, div_m2;
+
+       clkmode = readl(&cmwkup->clkmoddplldisp);
+       clksel = readl(&cmwkup->clkseldplldisp);
+       div_m2 = readl(&cmwkup->divm2dplldisp);
+
+       /* Set the PLL to bypass Mode */
+       writel(PLL_BYPASS_MODE, &cmwkup->clkmoddplldisp);
+
+       while (!(readl(&cmwkup->idlestdplldisp) & ST_MN_BYPASS))
+               ;
+
+       clksel &= ~CLK_SEL_MASK;
+       clksel |= (DISPPLL_M << CLK_SEL_SHIFT) | DISPPLL_N;
+       writel(clksel, &cmwkup->clkseldplldisp);
+
+       div_m2 &= ~CLK_DIV2_MASK;
+       div_m2 |= DISPPLL_M2;
+       writel(div_m2, &cmwkup->divm2dplldisp);
+
+       clkmode &= ~CLK_MODE_MASK;
+       clkmode |= CLK_MODE_SEL;
+       writel(clkmode, &cmwkup->clkmoddplldisp);
+
+       while (!(readl(&cmwkup->idlestdplldisp) & ST_DPLL_CLK))
+               ;
+#endif
+}
+
 static void ddr_pll_config(void)
 {
        u32 clkmode, clksel, div_m2;
@@ -225,23 +288,24 @@ static void ddr_pll_config(void)
        div_m2 = readl(&cmwkup->divm2dpllddr);
 
        /* Set the PLL to bypass Mode */
-       clkmode = (clkmode & CLK_MODE_MASK) | PLL_BYPASS_MODE;
+       clkmode &= ~CLK_MODE_MASK;
+       clkmode |= PLL_BYPASS_MODE;
        writel(clkmode, &cmwkup->clkmoddpllddr);
 
        /* Wait till bypass mode is enabled */
-       while ((readl(&cmwkup->idlestdpllddr) & ST_MN_BYPASS)
-                               != ST_MN_BYPASS)
+       while (!(readl(&cmwkup->idlestdpllddr) & ST_MN_BYPASS))
                ;
 
-       clksel = clksel & (~CLK_SEL_MASK);
-       clksel = clksel | ((DDRPLL_M << CLK_SEL_SHIFT) | DDRPLL_N);
+       clksel &= ~CLK_SEL_MASK;
+       clksel |= (DDRPLL_M << CLK_SEL_SHIFT) | DDRPLL_N;
        writel(clksel, &cmwkup->clkseldpllddr);
 
-       div_m2 = div_m2 & CLK_DIV_SEL;
-       div_m2 = div_m2 | DDRPLL_M2;
+       div_m2 &= ~CLK_DIV_MASK;
+       div_m2 |= DDRPLL_M2;
        writel(div_m2, &cmwkup->divm2dpllddr);
 
-       clkmode = (clkmode & CLK_MODE_MASK) | CLK_MODE_SEL;
+       clkmode &= ~CLK_MODE_MASK;
+       clkmode |= CLK_MODE_SEL;
        writel(clkmode, &cmwkup->clkmoddpllddr);
 
        /* Wait till dpll is locked */
@@ -274,6 +338,7 @@ void pll_init()
        core_pll_config();
        per_pll_config();
        ddr_pll_config();
+       disp_pll_config();
 
        /* Enable the required interconnect clocks */
        enable_interface_clocks();
@@ -284,3 +349,23 @@ void pll_init()
        /* Enable the required peripherals */
        enable_per_clocks();
 }
+#endif
+
+#define M(mn) (((mn) & CLK_SEL_MASK) >> CLK_SEL_SHIFT)
+#define N(mn) ((mn) & CLK_DIV2_MASK)
+
+unsigned long __clk_get_rate(u32 m_n, u32 div_m2)
+{
+       unsigned long rate;
+
+       div_m2 &= CLK_DIV_MASK;
+       debug("M=%u N=%u M2=%u\n", M(m_n), N(m_n), div_m2);
+       rate = V_OSCK / 1000 * M(m_n) / (N(m_n) + 1) / div_m2;
+       debug("CLK = %lu.%03luMHz\n", rate / 1000, rate % 1000);
+       return rate * 1000;
+}
+
+unsigned long lcdc_clk_rate(void)
+{
+       return clk_get_rate(cmwkup, disp);
+}
diff --git a/arch/arm/cpu/armv7/am33xx/ddr.c b/arch/arm/cpu/armv7/am33xx/ddr.c
deleted file mode 100644 (file)
index ed982c1..0000000
+++ /dev/null
@@ -1,147 +0,0 @@
-/*
- * DDR Configuration for AM33xx devices.
- *
- * Copyright (C) 2011 Texas Instruments Incorporated -
-http://www.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 .as is. WITHOUT ANY WARRANTY of any
- * kind, whether express or implied; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- */
-
-#include <asm/arch/cpu.h>
-#include <asm/arch/ddr_defs.h>
-#include <asm/io.h>
-
-/**
- * Base address for EMIF instances
- */
-static struct emif_regs *emif_reg = {
-                               (struct emif_regs *)EMIF4_0_CFG_BASE};
-
-/**
- * Base address for DDR instance
- */
-static struct ddr_regs *ddr_reg[2] = {
-                               (struct ddr_regs *)DDR_PHY_BASE_ADDR,
-                               (struct ddr_regs *)DDR_PHY_BASE_ADDR2};
-
-/**
- * Base address for ddr io control instances
- */
-static struct ddr_cmdtctrl *ioctrl_reg = {
-                       (struct ddr_cmdtctrl *)DDR_CONTROL_BASE_ADDR};
-
-/**
- * As a convention, all functions here return 0 on success
- * -1 on failure.
- */
-
-/**
- * Configure SDRAM
- */
-int config_sdram(struct sdram_config *cfg)
-{
-       writel(cfg->sdrcr, &emif_reg->sdrcr);
-       writel(cfg->sdrcr2, &emif_reg->sdrcr2);
-       writel(cfg->refresh, &emif_reg->sdrrcr);
-       writel(cfg->refresh_sh, &emif_reg->sdrrcsr);
-
-       return 0;
-}
-
-/**
- * Set SDRAM timings
- */
-int set_sdram_timings(struct sdram_timing *t)
-{
-       writel(t->time1, &emif_reg->sdrtim1);
-       writel(t->time1_sh, &emif_reg->sdrtim1sr);
-       writel(t->time2, &emif_reg->sdrtim2);
-       writel(t->time2_sh, &emif_reg->sdrtim2sr);
-       writel(t->time3, &emif_reg->sdrtim3);
-       writel(t->time3_sh, &emif_reg->sdrtim3sr);
-
-       return 0;
-}
-
-/**
- * Configure DDR PHY
- */
-int config_ddr_phy(struct ddr_phy_control *p)
-{
-       writel(p->reg, &emif_reg->ddrphycr);
-       writel(p->reg_sh, &emif_reg->ddrphycsr);
-
-       return 0;
-}
-
-/**
- * Configure DDR CMD control registers
- */
-int config_cmd_ctrl(struct cmd_control *cmd)
-{
-       writel(cmd->cmd0csratio, &ddr_reg[0]->cm0csratio);
-       writel(cmd->cmd0csforce, &ddr_reg[0]->cm0csforce);
-       writel(cmd->cmd0csdelay, &ddr_reg[0]->cm0csdelay);
-       writel(cmd->cmd0dldiff, &ddr_reg[0]->cm0dldiff);
-       writel(cmd->cmd0iclkout, &ddr_reg[0]->cm0iclkout);
-
-       writel(cmd->cmd1csratio, &ddr_reg[0]->cm1csratio);
-       writel(cmd->cmd1csforce, &ddr_reg[0]->cm1csforce);
-       writel(cmd->cmd1csdelay, &ddr_reg[0]->cm1csdelay);
-       writel(cmd->cmd1dldiff, &ddr_reg[0]->cm1dldiff);
-       writel(cmd->cmd1iclkout, &ddr_reg[0]->cm1iclkout);
-
-       writel(cmd->cmd2csratio, &ddr_reg[0]->cm2csratio);
-       writel(cmd->cmd2csforce, &ddr_reg[0]->cm2csforce);
-       writel(cmd->cmd2csdelay, &ddr_reg[0]->cm2csdelay);
-       writel(cmd->cmd2dldiff, &ddr_reg[0]->cm2dldiff);
-       writel(cmd->cmd2iclkout, &ddr_reg[0]->cm2iclkout);
-
-       return 0;
-}
-
-/**
- * Configure DDR DATA registers
- */
-int config_ddr_data(int macrono, struct ddr_data *data)
-{
-       writel(data->datardsratio0, &ddr_reg[macrono]->dt0rdsratio0);
-       writel(data->datardsratio1, &ddr_reg[macrono]->dt0rdsratio1);
-
-       writel(data->datawdsratio0, &ddr_reg[macrono]->dt0wdsratio0);
-       writel(data->datawdsratio1, &ddr_reg[macrono]->dt0wdsratio1);
-
-       writel(data->datawiratio0, &ddr_reg[macrono]->dt0wiratio0);
-       writel(data->datawiratio1, &ddr_reg[macrono]->dt0wiratio1);
-       writel(data->datagiratio0, &ddr_reg[macrono]->dt0giratio0);
-       writel(data->datagiratio1, &ddr_reg[macrono]->dt0giratio1);
-
-       writel(data->datafwsratio0, &ddr_reg[macrono]->dt0fwsratio0);
-       writel(data->datafwsratio1, &ddr_reg[macrono]->dt0fwsratio1);
-
-       writel(data->datawrsratio0, &ddr_reg[macrono]->dt0wrsratio0);
-       writel(data->datawrsratio1, &ddr_reg[macrono]->dt0wrsratio1);
-
-       writel(data->datadldiff0, &ddr_reg[macrono]->dt0dldiff0);
-
-       return 0;
-}
-
-int config_io_ctrl(struct ddr_ioctrl *ioctrl)
-{
-       writel(ioctrl->cmd1ctl, &ioctrl_reg->cm0ioctl);
-       writel(ioctrl->cmd2ctl, &ioctrl_reg->cm1ioctl);
-       writel(ioctrl->cmd3ctl, &ioctrl_reg->cm2ioctl);
-       writel(ioctrl->data1ctl, &ioctrl_reg->dt0ioctl);
-       writel(ioctrl->data2ctl, &ioctrl_reg->dt1ioctl);
-
-       return 0;
-}
diff --git a/arch/arm/cpu/armv7/am33xx/ddr2.c b/arch/arm/cpu/armv7/am33xx/ddr2.c
new file mode 100644 (file)
index 0000000..0d2d9f9
--- /dev/null
@@ -0,0 +1,229 @@
+/*
+ * ddr2.c
+ * renamed from emif4.c Lothar Waßmann <LW@KARO-electronics.de>
+ *
+ * AM33XX emif4 configuration file
+ *
+ * Copyright (C) 2011, Texas Instruments, Incorporated - http://www.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.
+ */
+
+#include <common.h>
+#include <asm/sizes.h>
+#include <asm/arch/cpu.h>
+#include <asm/arch/ddr_defs.h>
+#include <asm/arch/hardware.h>
+#include <asm/arch/clock.h>
+#include <asm/io.h>
+
+DECLARE_GLOBAL_DATA_PTR;
+
+struct ddr_regs *ddrregs = (struct ddr_regs *)DDR_PHY_BASE_ADDR;
+struct vtp_reg *vtpreg = (struct vtp_reg *)VTP0_CTRL_ADDR;
+struct ddr_ctrl *ddrctrl = (struct ddr_ctrl *)DDR_CTRL_ADDR;
+
+#define EMIF_PHYCFG            0x2
+#define EMIF_SDMGT             0x80000000
+#define EMIF_SDRAM             0x00004650
+#define DDR2_RATIO             0x80
+#define CMD_FORCE              0x00
+#define CMD_DELAY              0x00
+
+#define EMIF_READ_LATENCY      0x05
+#define EMIF_TIM1              0x0666B3D6
+#define EMIF_TIM2              0x143731DA
+#define EMIF_TIM3              0x00000347
+#define EMIF_SDCFG             0x43805332
+#define EMIF_SDREF             0x0000081a
+#define DDR2_DLL_LOCK_DIFF     0x0f
+#define DDR2_RD_DQS            0x12
+#define DDR2_PHY_FIFO_WE       0x80
+
+#define DDR2_INVERT_CLKOUT     0x00
+#define DDR2_WR_DQS            0x00
+#define DDR2_PHY_WRLVL         0x00
+#define DDR2_PHY_GATELVL       0x00
+#define DDR2_PHY_WR_DATA       0x40
+#define PHY_RANK0_DELAY                0x01
+#define PHY_DLL_LOCK_DIFF      0x0
+#define DDR_IOCTRL_VALUE       0x18B
+
+int dram_init(void)
+{
+       /* dram_init must store complete ramsize in gd->ram_size */
+       gd->ram_size = get_ram_size((void *)CONFIG_SYS_SDRAM_BASE,
+                               CONFIG_MAX_RAM_BANK_SIZE);
+       debug("SDRAM size: 0x%08x\n", gd->ram_size);
+       return 0;
+}
+
+void dram_init_banksize(void)
+{
+       gd->bd->bi_dram[0].start = CONFIG_SYS_SDRAM_BASE;
+       gd->bd->bi_dram[0].size = gd->ram_size;
+}
+
+
+#ifdef CONFIG_SPL_BUILD
+static void data_macro_config(void)
+{
+       struct ddr_data data;
+
+       data.datardsratio0 = ((DDR2_RD_DQS << 30) | (DDR2_RD_DQS << 20) |
+                       (DDR2_RD_DQS << 10) | (DDR2_RD_DQS << 0));
+       data.datardsratio1 = DDR2_RD_DQS >> 2;
+       data.datawdsratio0 = ((DDR2_WR_DQS << 30) | (DDR2_WR_DQS << 20) |
+                       (DDR2_WR_DQS << 10) | (DDR2_WR_DQS << 0));
+       data.datawdsratio1 = DDR2_WR_DQS >> 2;
+       data.datawiratio0 = ((DDR2_PHY_WRLVL << 30) | (DDR2_PHY_WRLVL << 20) |
+                       (DDR2_PHY_WRLVL << 10) | (DDR2_PHY_WRLVL << 0));
+       data.datawiratio1 = DDR2_PHY_WRLVL >> 2;
+       data.datagiratio0 = ((DDR2_PHY_GATELVL << 30) | (DDR2_PHY_GATELVL << 20) |
+                       (DDR2_PHY_GATELVL << 10) | (DDR2_PHY_GATELVL << 0));
+       data.datagiratio1 = DDR2_PHY_GATELVL >> 2;
+       data.datafwsratio0 = ((DDR2_PHY_FIFO_WE << 30) | (DDR2_PHY_FIFO_WE << 20) |
+                       (DDR2_PHY_FIFO_WE << 10) | (DDR2_PHY_FIFO_WE << 0));
+       data.datafwsratio1 = DDR2_PHY_FIFO_WE >> 2;
+       data.datawrsratio0 = ((DDR2_PHY_WR_DATA << 30) | (DDR2_PHY_WR_DATA << 20) |
+                       (DDR2_PHY_WR_DATA << 10) | (DDR2_PHY_WR_DATA << 0));
+       data.datawrsratio1 = DDR2_PHY_WR_DATA >> 2;
+       data.datadldiff0 = PHY_DLL_LOCK_DIFF;
+
+       config_ddr_data(0, &data);
+       config_ddr_data(1, &data);
+}
+
+static void cmd_macro_config(void)
+{
+       struct cmd_control cmd;
+
+       cmd.cmd0csratio = DDR2_RATIO;
+       cmd.cmd0csforce = CMD_FORCE;
+       cmd.cmd0csdelay = CMD_DELAY;
+       cmd.cmd0dldiff = DDR2_DLL_LOCK_DIFF;
+       cmd.cmd0iclkout = DDR2_INVERT_CLKOUT;
+
+       cmd.cmd1csratio = DDR2_RATIO;
+       cmd.cmd1csforce = CMD_FORCE;
+       cmd.cmd1csdelay = CMD_DELAY;
+       cmd.cmd1dldiff = DDR2_DLL_LOCK_DIFF;
+       cmd.cmd1iclkout = DDR2_INVERT_CLKOUT;
+
+       cmd.cmd2csratio = DDR2_RATIO;
+       cmd.cmd2csforce = CMD_FORCE;
+       cmd.cmd2csdelay = CMD_DELAY;
+       cmd.cmd2dldiff = DDR2_DLL_LOCK_DIFF;
+       cmd.cmd2iclkout = DDR2_INVERT_CLKOUT;
+
+       config_cmd_ctrl(&cmd);
+}
+
+static void config_vtp(void)
+{
+       writel(readl(&vtpreg->vtp0ctrlreg) | VTP_CTRL_ENABLE,
+                       &vtpreg->vtp0ctrlreg);
+       writel(readl(&vtpreg->vtp0ctrlreg) & ~VTP_CTRL_START_EN,
+                       &vtpreg->vtp0ctrlreg);
+       writel(readl(&vtpreg->vtp0ctrlreg) | VTP_CTRL_START_EN,
+                       &vtpreg->vtp0ctrlreg);
+
+       /* Poll for READY */
+       while ((readl(&vtpreg->vtp0ctrlreg) & VTP_CTRL_READY) !=
+                       VTP_CTRL_READY)
+               ;
+}
+
+static void config_emif_ddr2(void)
+{
+       int i;
+       int ret;
+       struct sdram_config cfg;
+       struct sdram_timing tmg;
+       struct ddr_phy_control phyc;
+
+debug("%s\n", __func__);
+
+       /* Program EMIF0 CFG Registers */
+       phyc.reg = EMIF_READ_LATENCY;
+       phyc.reg_sh = EMIF_READ_LATENCY;
+       phyc.reg2 = EMIF_READ_LATENCY;
+
+       tmg.time1 = EMIF_TIM1;
+       tmg.time1_sh = EMIF_TIM1;
+       tmg.time2 = EMIF_TIM2;
+       tmg.time2_sh = EMIF_TIM2;
+       tmg.time3 = EMIF_TIM3;
+       tmg.time3_sh = EMIF_TIM3;
+
+       cfg.sdrcr = EMIF_SDCFG;
+       cfg.sdrcr2 = EMIF_SDCFG;
+       cfg.refresh = 0x00004650;
+       cfg.refresh_sh = 0x00004650;
+
+       /* Program EMIF instance */
+       ret = config_ddr_phy(&phyc);
+       if (ret < 0)
+               printf("Couldn't configure phyc\n");
+
+       ret = config_sdram(&cfg);
+       if (ret < 0)
+               printf("Couldn't configure SDRAM\n");
+
+       ret = set_sdram_timings(&tmg);
+       if (ret < 0)
+               printf("Couldn't configure timings\n");
+
+       /* Delay */
+       for (i = 0; i < 5000; i++)
+               ;
+
+       cfg.refresh = EMIF_SDREF;
+       cfg.refresh_sh = EMIF_SDREF;
+       cfg.sdrcr = EMIF_SDCFG;
+       cfg.sdrcr2 = EMIF_SDCFG;
+
+       ret = config_sdram(&cfg);
+       if (ret < 0)
+               printf("Couldn't configure SDRAM\n");
+}
+
+void config_ddr(void)
+{
+       struct ddr_ioctrl ioctrl;
+
+debug("%s\n", __func__);
+
+       enable_emif_clocks();
+
+       config_vtp();
+
+       cmd_macro_config();
+
+       data_macro_config();
+
+       writel(PHY_RANK0_DELAY, &ddrregs->dt0rdelays0);
+       writel(PHY_RANK0_DELAY, &ddrregs->dt1rdelays0);
+
+       ioctrl.cmd1ctl = DDR_IOCTRL_VALUE;
+       ioctrl.cmd2ctl = DDR_IOCTRL_VALUE;
+       ioctrl.cmd3ctl = DDR_IOCTRL_VALUE;
+       ioctrl.data1ctl = DDR_IOCTRL_VALUE;
+       ioctrl.data2ctl = DDR_IOCTRL_VALUE;
+
+       config_io_ctrl(&ioctrl);
+
+       writel(readl(&ddrctrl->ddrioctrl) & 0xefffffff, &ddrctrl->ddrioctrl);
+       writel(readl(&ddrctrl->ddrckectrl) | 0x00000001, &ddrctrl->ddrckectrl);
+
+       config_emif_ddr2();
+}
+#endif
diff --git a/arch/arm/cpu/armv7/am33xx/ddr3.c b/arch/arm/cpu/armv7/am33xx/ddr3.c
new file mode 100644 (file)
index 0000000..c58453b
--- /dev/null
@@ -0,0 +1,297 @@
+/*
+ * ddr3.c
+ *
+ * AM33XX emif4 configuration file
+ *
+ * Copyright (C) 2012 Lothar Waßmann <LW@KARO-electronics.de>
+ *
+ * based on emif4.c
+ * Copyright (C) 2011, Texas Instruments, Incorporated - http://www.ti.com/
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR /PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ */
+
+#include <common.h>
+#include <asm/sizes.h>
+#include <asm/arch/cpu.h>
+#include <asm/arch/ddr_defs.h>
+#include <asm/arch/ddr3_defs.h>
+#include <asm/arch/hardware.h>
+#include <asm/arch/clock.h>
+#include <asm/io.h>
+
+/* AM335X EMIF Register values */
+#define        VTP_CTRL_READY          (0x1 << 5)
+#define VTP_CTRL_ENABLE                (0x1 << 6)
+#define VTP_CTRL_LOCK_EN       (0x1 << 4)
+#define VTP_CTRL_START_EN      (0x1 << 0)
+
+/*
+ * DDR3 force values.  These are board dependent
+ */
+/*
+ * Invert clock adds an additional half cycle delay on the command
+ * interface.  The additional half cycle, is usually meant to enable
+ * leveling in the situation that DQS is later than CK on the board.  It
+ * also helps provide some additional margin for leveling.
+ *
+ * For the EVM this is helping us with additional room for the write
+ * leveling.  Since the dqs delays are very small.
+ */
+#define INVERT_CLOCK           0
+
+/*
+ * This represents the initial value for the leveling process.  The
+ * value is a ratio - so 0x100 represents one cycle.  The real delay
+ * is determined through the leveling process.
+ *
+ * During the leveling process, 0x20 is subtracted from the value, so
+ * we have added that to the value we want to set.  We also set the
+ * values such that byte3 completes leveling after byte2 and byte1
+ * after byte0.
+ */
+#define WR_DQS_RATIO_0         0x20
+#define WR_DQS_RATIO_1         0x20
+
+/*
+ * This represents the initial value for the leveling process.  The
+ * value is a ratio - so 0x100 represents one cycle.  The real delay
+ * is determined through the leveling process.
+ *
+ * During the leveling process, 0x20 is subtracted from the value, so
+ * we have added that to the value we want to set.  We also set the
+ * values such that byte3 completes leveling after byte2 and byte1
+ * after byte0.
+ */
+#define RD_GATE_RATIO_0                0x20
+#define RD_GATE_RATIO_1                0x20
+
+/*
+ * CMD_SLAVE_RATIO determines where is the command placed with respect
+ * to the clock edge.  This is a ratio, implying 0x100 is one cycle.
+ * Ideally the command is centered so - this should be half cycle
+ * delay (0x80).  But if invert clock is in use, an additional half
+ * cycle must be added
+ */
+#define CMD_SLAVE_FROM_INV_CLOCK(i) (((i) == 0) ? 0x80 : 0x100)
+#define CMD_SLAVE_RATIO                CMD_SLAVE_FROM_INV_CLOCK(INVERT_CLOCK)
+
+/*
+ * EMIF Paramters.  Refer the EMIF register documentation and the
+ * memory datasheet for details
+ */
+/* For 303 MHz m_clk 3.3ns */
+#define EMIF_TIM1    0x0668A3DB
+/*
+ * 000 0011 0011 0100 01010 001111 011 011
+ *
+ *28-25   reg_t_rp      3 - 13ns
+ *24-21   reg_t_rcd     3 - 13ns
+ *20-17   reg_t_wr      4 - 16ns
+ *16-12   reg_t_ras    10 - 36ns
+ *11-6    reg_t_rc     15 - 52ns
+ *5-3     reg_t_rrd     3
+ *2-0     reg_t_wtr     3
+ */
+
+#define EMIF_TIM2    0x2A04011A
+/*
+ * 0 010 101 000000100 0000000100 011 010
+ *
+ *30-28   reg_t_xp     2 - 3nCK
+ *27-25   reg_t_odt    5 - 6nCK
+ *24-16   reg_t_xsnr   4 - 5nCK
+ *15-6    reg_t_xsrd   4 - 5nCK
+ *5-3     reg_t_rtp    3 - 4nCK
+ *2-0     reg_t_cke    2 - 3nCK
+ */
+
+#define EMIF_TIM3    0x001F8309
+/*
+ * 00000000 000 111111 00 000110000 1001
+ *
+ *23-21   reg_t_ckesr      0  - LPDDR2
+ *20-15   reg_zq_zqcs      63 - 64nCK
+ *14-13   reg_t_tdqsckmax  0  - LPDDR2
+ *12-4    reg_t_rfc        48 - 161ns
+ *3-0     reg_t_ras_max    9
+ */
+
+#define EMIF_SDREF   0x20000C1A
+/*
+ * 0 0 1 0 0 000 00000000 C1A
+ *
+ *31    reg_initref_dis   0 Initialization
+ *30    Reserved          0
+ *29    reg_srt           1 extended temp.
+ *28    reg_asr           0 manual Self Refresh
+ *27    Reserved          0
+ *26-24 reg_pasr          0
+ *23-16 Reserved          0
+ *15-0  reg_refresh_rate  C1A
+ */
+
+#define EMIF_SDCFG   0x62A44AB2 /* 0x62A45032 */
+/*
+ * 011 00 010 1 01 0 01 00 01 0010 101 011 0 010
+ *
+ *31-29 reg_sdram_type      3 - DDR3
+ *28-27 reg_ibank_pos       0
+ *26-24 reg_ddr_term        2 - RZQ/2
+ *23    reg_ddr2_ddqs       1 - differential DQS
+ *22-21 reg_dyn_odt         1 - Dynamic ODT RZQ/4
+ *20    reg_ddr_disable_dll 0 - enable DLL
+ *19-18 reg_sdram_drive     1 - drive strength RZQ/7
+ *17-16 reg_cwl             0 - CAS write latency 5
+ *15-14 reg_narrow_mode     1 - 16-bit data bus width
+ *13-10 reg_cl              2 - CAS latency of 5
+ *9-7   reg_rowsize         5 - 14 row bits
+ *6-4   reg_ibank           3 - 8 banks
+ *3     reg_ebank           0 - 1 chip select
+ *2-0   reg_pagesize        2 - 10 column bits
+ */
+
+#define EMIF_PHYCFG            0x0000010B
+
+#define        PHY_RANK_DELAY          0x01
+#define DDR_IOCTRL_VALUE       0x18B
+
+DECLARE_GLOBAL_DATA_PTR;
+
+#define PHY_DLL_LOCK_DIFF 0x0f
+
+struct ddr_regs *ddrregs = (struct ddr_regs *)DDR_PHY_BASE_ADDR;
+struct vtp_reg *vtpreg = (struct vtp_reg *)VTP0_CTRL_ADDR;
+struct ddr_ctrl *ddrctrl = (struct ddr_ctrl *)DDR_CTRL_ADDR;
+
+int dram_init(void)
+{
+       /* dram_init must store complete ramsize in gd->ram_size */
+       gd->ram_size = get_ram_size((void *)CONFIG_SYS_SDRAM_BASE,
+                               CONFIG_MAX_RAM_BANK_SIZE);
+       return 0;
+}
+
+void dram_init_banksize(void)
+{
+       gd->bd->bi_dram[0].start = CONFIG_SYS_SDRAM_BASE;
+       gd->bd->bi_dram[0].size = gd->ram_size;
+}
+
+#ifdef CONFIG_SPL_BUILD
+/**
+ * Base address for EMIF instances
+ */
+static struct emif_regs *emif_reg = {
+                               (struct emif_regs *)EMIF4_0_CFG_BASE};
+
+/**
+ * Base address for DDR instance
+ */
+static struct ddr_regs *ddr_reg = (struct ddr_regs *)DDR_PHY_BASE_ADDR;
+
+/**
+ * Base address for ddr io control instances
+ */
+static struct ddr_cmdtctrl *ioctrl_reg = {
+                       (struct ddr_cmdtctrl *)DDR_CONTROL_BASE_ADDR};
+
+static void data_macro_config(void)
+{
+       writel((WR_DQS_RATIO_0 << 10) | (WR_DQS_RATIO_0 << 0),
+               &ddr_reg->dt0.wiratio0);
+       writel((WR_DQS_RATIO_1 << 10) | (WR_DQS_RATIO_1 << 0),
+               &ddr_reg->dt1.wiratio0);
+       writel((RD_GATE_RATIO_0 << 10) | (RD_GATE_RATIO_0 << 0),
+               &ddr_reg->dt0.giratio0);
+       writel((RD_GATE_RATIO_1 << 10) | (RD_GATE_RATIO_1 << 0),
+               &ddr_reg->dt1.giratio0);
+
+       writel(PHY_DLL_LOCK_DIFF, &ddr_reg->dt0.dldiff0);
+       writel(PHY_DLL_LOCK_DIFF, &ddr_reg->dt1.dldiff0);
+}
+
+static void cmd_macro_config(void)
+{
+       writel(PHY_DLL_LOCK_DIFF, &ddr_reg->cm0dldiff);
+       writel(PHY_DLL_LOCK_DIFF, &ddr_reg->cm1dldiff);
+       writel(PHY_DLL_LOCK_DIFF, &ddr_reg->cm2dldiff);
+
+       writel(INVERT_CLOCK, &ddr_reg->cm0iclkout);
+       writel(INVERT_CLOCK, &ddr_reg->cm1iclkout);
+       writel(INVERT_CLOCK, &ddr_reg->cm2iclkout);
+}
+
+static void config_vtp(void)
+{
+       writel(readl(&vtpreg->vtp0ctrlreg) | VTP_CTRL_ENABLE,
+                       &vtpreg->vtp0ctrlreg);
+       writel(readl(&vtpreg->vtp0ctrlreg) & ~VTP_CTRL_START_EN,
+                       &vtpreg->vtp0ctrlreg);
+       writel(readl(&vtpreg->vtp0ctrlreg) | VTP_CTRL_START_EN,
+                       &vtpreg->vtp0ctrlreg);
+
+       /* Poll for READY */
+       while ((readl(&vtpreg->vtp0ctrlreg) & VTP_CTRL_READY) !=
+                       VTP_CTRL_READY)
+               ;
+}
+
+static void config_emif_ddr3(void)
+{
+       /* Program EMIF0 CFG Registers */
+       writel(EMIF_PHYCFG, &emif_reg->ddrphycr);
+       writel(EMIF_PHYCFG, &emif_reg->ddrphycsr);
+
+       writel(EMIF_TIM1, &emif_reg->sdrtim1);
+       writel(EMIF_TIM1, &emif_reg->sdrtim1sr);
+       writel(EMIF_TIM2, &emif_reg->sdrtim2);
+       writel(EMIF_TIM2, &emif_reg->sdrtim2sr);
+       writel(EMIF_TIM3, &emif_reg->sdrtim3);
+       writel(EMIF_TIM3, &emif_reg->sdrtim3sr);
+
+       writel(EMIF_SDCFG, &emif_reg->sdrcr);
+       writel(EMIF_SDCFG, &emif_reg->sdrcr2);
+       writel(0x00004650, &emif_reg->sdrrcr);
+       writel(0x00004650, &emif_reg->sdrrcsr);
+
+       udelay(50);
+
+       writel(EMIF_SDREF, &emif_reg->sdrrcr);
+       writel(EMIF_SDREF, &emif_reg->sdrrcsr);
+}
+
+void config_ddr(void)
+{
+       enable_emif_clocks();
+
+       config_vtp();
+
+       cmd_macro_config();
+
+       data_macro_config();
+
+       writel(PHY_RANK_DELAY, &ddrregs->dt0.rdelays0);
+       writel(PHY_RANK_DELAY, &ddrregs->dt1.rdelays0);
+
+       writel(DDR_IOCTRL_VALUE, &ioctrl_reg->cm0ioctl);
+       writel(DDR_IOCTRL_VALUE, &ioctrl_reg->cm1ioctl);
+       writel(DDR_IOCTRL_VALUE, &ioctrl_reg->cm2ioctl);
+
+       writel(DDR_IOCTRL_VALUE, &ioctrl_reg->dt0ioctl);
+       writel(DDR_IOCTRL_VALUE, &ioctrl_reg->dt1ioctl);
+
+       writel(readl(&ddrctrl->ddrioctrl) & 0xefffffff, &ddrctrl->ddrioctrl);
+       writel(readl(&ddrctrl->ddrckectrl) | 0x00000001, &ddrctrl->ddrckectrl);
+
+       config_emif_ddr3();
+}
+#endif
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..91d6336
--- /dev/null
@@ -0,0 +1,208 @@
+/*
+ * (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/nand.h>
+
+#define ELM_DEFAULT_POLY 0
+
+/* make sure this variable does not end up in bss
+ * because that would corrupt the relocation section
+ * that is overlayed with the bss section
+ */
+static struct elm *elm_cfg __attribute__((section(".data")));
+
+/**
+ * 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 val;
+       struct  syndrome *sf = &elm_cfg->syndrome_fragments[poly];
+
+       /* reg 0 */
+       val = syndrome[0] | (syndrome[1] << 8) | (syndrome[2] << 16) |
+                               (syndrome[3] << 24);
+       writel(val, &sf->syndrome_fragment_x[0]);
+
+       /* reg 1 */
+       val = syndrome[4] | (syndrome[5] << 8) | (syndrome[6] << 16) |
+                               (syndrome[7] << 24);
+       writel(val, &sf->syndrome_fragment_x[1]);
+
+       /* BCH 8-bit with 26 nibbles (4*8=32) */
+       if (nibbles > 13) {
+               /* reg 2 */
+               val = syndrome[8] | (syndrome[9] << 8) | (syndrome[10] << 16) |
+                               (syndrome[11] << 24);
+               writel(val, &sf->syndrome_fragment_x[2]);
+
+               /* reg 3 */
+               val = syndrome[12] | (syndrome[13] << 8) | (syndrome[14] << 16) |
+                               (syndrome[15] << 24);
+               writel(val, &sf->syndrome_fragment_x[3]);
+       }
+
+       /* BCH 16-bit with 52 nibbles (7*8=56) */
+       if (nibbles > 26) {
+               /* reg 4 */
+               val = syndrome[16] | (syndrome[17] << 8) | (syndrome[18] << 16) |
+                               (syndrome[19] << 24);
+               writel(val, &sf->syndrome_fragment_x[4]);
+
+               /* reg 5 */
+               val = syndrome[20] | (syndrome[21] << 8) | (syndrome[22] << 16) |
+                               (syndrome[23] << 24);
+               writel(val, &sf->syndrome_fragment_x[5]);
+
+               /* reg 6 */
+               val = syndrome[24] | (syndrome[25] << 8) | (syndrome[26] << 16) |
+                               (syndrome[27] << 24);
+               writel(val, &sf->syndrome_fragment_x[6]);
+       }
+}
+
+/**
+ * elm_check_error - 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)));
+       /* 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
+ * @buffer_size: Buffer size in bytes
+ *
+ * Configure ELM module based on BCH level and buffer size passed.
+ * 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 buffer_size) */
+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 continuous 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();
+}
+
index 2f4164df8218a348bd82c0fd6439a529e6ddd06b..fe917c1ddb9b77c665be63c93c9fbd3914f8e5c7 100644 (file)
 /*
- * emif4.c
+ * DDR Configuration for AM33xx devices.
  *
- * AM33XX emif4 configuration file
- *
- * Copyright (C) 2011, Texas Instruments, Incorporated - http://www.ti.com/
+ * Copyright (C) 2011 Texas Instruments Incorporated - http://www.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
+ * This program is distributed .as is. WITHOUT ANY WARRANTY of any
+ * kind, whether express or implied; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
  */
 
 #include <common.h>
 #include <asm/arch/cpu.h>
 #include <asm/arch/ddr_defs.h>
-#include <asm/arch/hardware.h>
-#include <asm/arch/clock.h>
 #include <asm/io.h>
 
-DECLARE_GLOBAL_DATA_PTR;
+/**
+ * Base address for EMIF instances
+ */
+static struct emif_regs *emif_reg = {
+                               (struct emif_regs *)EMIF4_0_CFG_BASE};
 
-struct ddr_regs *ddrregs = (struct ddr_regs *)DDR_PHY_BASE_ADDR;
-struct vtp_reg *vtpreg = (struct vtp_reg *)VTP0_CTRL_ADDR;
-struct ddr_ctrl *ddrctrl = (struct ddr_ctrl *)DDR_CTRL_ADDR;
+/**
+ * Base address for DDR instance
+ */
+static struct ddr_regs *ddr_reg[2] = {
+                               (struct ddr_regs *)DDR_PHY_BASE_ADDR,
+                               (struct ddr_regs *)DDR_PHY_BASE_ADDR2};
 
+/**
+ * Base address for ddr io control instances
+ */
+static struct ddr_cmdtctrl *ioctrl_reg = {
+                       (struct ddr_cmdtctrl *)DDR_CONTROL_BASE_ADDR};
 
-int dram_init(void)
+/**
+ * As a convention, all functions here return 0 on success
+ * -1 on failure.
+ */
+
+/**
+ * Configure SDRAM
+ */
+int config_sdram(struct sdram_config *cfg)
 {
-       /* dram_init must store complete ramsize in gd->ram_size */
-       gd->ram_size = get_ram_size(
-                       (void *)CONFIG_SYS_SDRAM_BASE,
-                       CONFIG_MAX_RAM_BANK_SIZE);
+       writel(cfg->sdrcr, &emif_reg->sdrcr);
+       writel(cfg->sdrcr2, &emif_reg->sdrcr2);
+       writel(cfg->refresh, &emif_reg->sdrrcr);
+       writel(cfg->refresh_sh, &emif_reg->sdrrcsr);
+
        return 0;
 }
 
-void dram_init_banksize(void)
+/**
+ * Set SDRAM timings
+ */
+int set_sdram_timings(struct sdram_timing *t)
 {
-       gd->bd->bi_dram[0].start = CONFIG_SYS_SDRAM_BASE;
-       gd->bd->bi_dram[0].size = gd->ram_size;
-}
-
+       writel(t->time1, &emif_reg->sdrtim1);
+       writel(t->time1_sh, &emif_reg->sdrtim1sr);
+       writel(t->time2, &emif_reg->sdrtim2);
+       writel(t->time2_sh, &emif_reg->sdrtim2sr);
+       writel(t->time3, &emif_reg->sdrtim3);
+       writel(t->time3_sh, &emif_reg->sdrtim3sr);
 
-#ifdef CONFIG_SPL_BUILD
-static void data_macro_config(int dataMacroNum)
-{
-       struct ddr_data data;
-
-       data.datardsratio0 = ((DDR2_RD_DQS<<30)|(DDR2_RD_DQS<<20)
-                               |(DDR2_RD_DQS<<10)|(DDR2_RD_DQS<<0));
-       data.datardsratio1 = DDR2_RD_DQS>>2;
-       data.datawdsratio0 = ((DDR2_WR_DQS<<30)|(DDR2_WR_DQS<<20)
-                               |(DDR2_WR_DQS<<10)|(DDR2_WR_DQS<<0));
-       data.datawdsratio1 = DDR2_WR_DQS>>2;
-       data.datawiratio0 = ((DDR2_PHY_WRLVL<<30)|(DDR2_PHY_WRLVL<<20)
-                               |(DDR2_PHY_WRLVL<<10)|(DDR2_PHY_WRLVL<<0));
-       data.datawiratio1 = DDR2_PHY_WRLVL>>2;
-       data.datagiratio0 = ((DDR2_PHY_GATELVL<<30)|(DDR2_PHY_GATELVL<<20)
-                               |(DDR2_PHY_GATELVL<<10)|(DDR2_PHY_GATELVL<<0));
-       data.datagiratio1 = DDR2_PHY_GATELVL>>2;
-       data.datafwsratio0 = ((DDR2_PHY_FIFO_WE<<30)|(DDR2_PHY_FIFO_WE<<20)
-                               |(DDR2_PHY_FIFO_WE<<10)|(DDR2_PHY_FIFO_WE<<0));
-       data.datafwsratio1 = DDR2_PHY_FIFO_WE>>2;
-       data.datawrsratio0 = ((DDR2_PHY_WR_DATA<<30)|(DDR2_PHY_WR_DATA<<20)
-                               |(DDR2_PHY_WR_DATA<<10)|(DDR2_PHY_WR_DATA<<0));
-       data.datawrsratio1 = DDR2_PHY_WR_DATA>>2;
-       data.datadldiff0 = PHY_DLL_LOCK_DIFF;
-
-       config_ddr_data(dataMacroNum, &data);
+       return 0;
 }
 
-static void cmd_macro_config(void)
+/**
+ * Configure DDR PHY
+ */
+int config_ddr_phy(struct ddr_phy_control *p)
 {
-       struct cmd_control cmd;
-
-       cmd.cmd0csratio = DDR2_RATIO;
-       cmd.cmd0csforce = CMD_FORCE;
-       cmd.cmd0csdelay = CMD_DELAY;
-       cmd.cmd0dldiff = DDR2_DLL_LOCK_DIFF;
-       cmd.cmd0iclkout = DDR2_INVERT_CLKOUT;
-
-       cmd.cmd1csratio = DDR2_RATIO;
-       cmd.cmd1csforce = CMD_FORCE;
-       cmd.cmd1csdelay = CMD_DELAY;
-       cmd.cmd1dldiff = DDR2_DLL_LOCK_DIFF;
-       cmd.cmd1iclkout = DDR2_INVERT_CLKOUT;
-
-       cmd.cmd2csratio = DDR2_RATIO;
-       cmd.cmd2csforce = CMD_FORCE;
-       cmd.cmd2csdelay = CMD_DELAY;
-       cmd.cmd2dldiff = DDR2_DLL_LOCK_DIFF;
-       cmd.cmd2iclkout = DDR2_INVERT_CLKOUT;
-
-       config_cmd_ctrl(&cmd);
+       writel(p->reg, &emif_reg->ddrphycr);
+       writel(p->reg_sh, &emif_reg->ddrphycsr);
 
+       return 0;
 }
 
-static void config_vtp(void)
+/**
+ * Configure DDR CMD control registers
+ */
+int config_cmd_ctrl(struct cmd_control *cmd)
 {
-       writel(readl(&vtpreg->vtp0ctrlreg) | VTP_CTRL_ENABLE,
-                       &vtpreg->vtp0ctrlreg);
-       writel(readl(&vtpreg->vtp0ctrlreg) & (~VTP_CTRL_START_EN),
-                       &vtpreg->vtp0ctrlreg);
-       writel(readl(&vtpreg->vtp0ctrlreg) | VTP_CTRL_START_EN,
-                       &vtpreg->vtp0ctrlreg);
-
-       /* Poll for READY */
-       while ((readl(&vtpreg->vtp0ctrlreg) & VTP_CTRL_READY) !=
-                       VTP_CTRL_READY)
-               ;
-}
+       writel(cmd->cmd0csratio, &ddr_reg[0]->cm0csratio);
+       writel(cmd->cmd0csforce, &ddr_reg[0]->cm0csforce);
+       writel(cmd->cmd0csdelay, &ddr_reg[0]->cm0csdelay);
+       writel(cmd->cmd0dldiff, &ddr_reg[0]->cm0dldiff);
+       writel(cmd->cmd0iclkout, &ddr_reg[0]->cm0iclkout);
+
+       writel(cmd->cmd1csratio, &ddr_reg[0]->cm1csratio);
+       writel(cmd->cmd1csforce, &ddr_reg[0]->cm1csforce);
+       writel(cmd->cmd1csdelay, &ddr_reg[0]->cm1csdelay);
+       writel(cmd->cmd1dldiff, &ddr_reg[0]->cm1dldiff);
+       writel(cmd->cmd1iclkout, &ddr_reg[0]->cm1iclkout);
+
+       writel(cmd->cmd2csratio, &ddr_reg[0]->cm2csratio);
+       writel(cmd->cmd2csforce, &ddr_reg[0]->cm2csforce);
+       writel(cmd->cmd2csdelay, &ddr_reg[0]->cm2csdelay);
+       writel(cmd->cmd2dldiff, &ddr_reg[0]->cm2dldiff);
+       writel(cmd->cmd2iclkout, &ddr_reg[0]->cm2iclkout);
 
-static void config_emif_ddr2(void)
-{
-       int i;
-       int ret;
-       struct sdram_config cfg;
-       struct sdram_timing tmg;
-       struct ddr_phy_control phyc;
-
-       /*Program EMIF0 CFG Registers*/
-       phyc.reg = EMIF_READ_LATENCY;
-       phyc.reg_sh = EMIF_READ_LATENCY;
-       phyc.reg2 = EMIF_READ_LATENCY;
-
-       tmg.time1 = EMIF_TIM1;
-       tmg.time1_sh = EMIF_TIM1;
-       tmg.time2 = EMIF_TIM2;
-       tmg.time2_sh = EMIF_TIM2;
-       tmg.time3 = EMIF_TIM3;
-       tmg.time3_sh = EMIF_TIM3;
-
-       cfg.sdrcr = EMIF_SDCFG;
-       cfg.sdrcr2 = EMIF_SDCFG;
-       cfg.refresh = 0x00004650;
-       cfg.refresh_sh = 0x00004650;
-
-       /* Program EMIF instance */
-       ret = config_ddr_phy(&phyc);
-       if (ret < 0)
-               printf("Couldn't configure phyc\n");
-
-       ret = config_sdram(&cfg);
-       if (ret < 0)
-               printf("Couldn't configure SDRAM\n");
-
-       ret = set_sdram_timings(&tmg);
-       if (ret < 0)
-               printf("Couldn't configure timings\n");
-
-       /* Delay */
-       for (i = 0; i < 5000; i++)
-               ;
-
-       cfg.refresh = EMIF_SDREF;
-       cfg.refresh_sh = EMIF_SDREF;
-       cfg.sdrcr = EMIF_SDCFG;
-       cfg.sdrcr2 = EMIF_SDCFG;
-
-       ret = config_sdram(&cfg);
-       if (ret < 0)
-               printf("Couldn't configure SDRAM\n");
+       return 0;
 }
 
-void config_ddr(void)
+/**
+ * Configure DDR DATA registers
+ */
+int config_ddr_data(int macrono, struct ddr_data *data)
 {
-       int data_macro_0 = 0;
-       int data_macro_1 = 1;
-       struct ddr_ioctrl ioctrl;
+       writel(data->datardsratio0, &ddr_reg[macrono]->dt0.rdsratio0);
+       writel(data->datardsratio1, &ddr_reg[macrono]->dt0.rdsratio1);
 
-       enable_emif_clocks();
+       writel(data->datawdsratio0, &ddr_reg[macrono]->dt0.wdsratio0);
+       writel(data->datawdsratio1, &ddr_reg[macrono]->dt0.wdsratio1);
 
-       config_vtp();
+       writel(data->datawiratio0, &ddr_reg[macrono]->dt0.wiratio0);
+       writel(data->datawiratio1, &ddr_reg[macrono]->dt0.wiratio1);
 
-       cmd_macro_config();
+       writel(data->datagiratio0, &ddr_reg[macrono]->dt0.giratio0);
+       writel(data->datagiratio1, &ddr_reg[macrono]->dt0.giratio1);
 
-       data_macro_config(data_macro_0);
-       data_macro_config(data_macro_1);
+       writel(data->datafwsratio0, &ddr_reg[macrono]->dt0.fwsratio0);
+       writel(data->datafwsratio1, &ddr_reg[macrono]->dt0.fwsratio1);
 
-       writel(PHY_RANK0_DELAY, &ddrregs->dt0rdelays0);
-       writel(PHY_RANK0_DELAY, &ddrregs->dt1rdelays0);
+       writel(data->datawrsratio0, &ddr_reg[macrono]->dt0.wrsratio0);
+       writel(data->datawrsratio1, &ddr_reg[macrono]->dt0.wrsratio1);
 
-       ioctrl.cmd1ctl = DDR_IOCTRL_VALUE;
-       ioctrl.cmd2ctl = DDR_IOCTRL_VALUE;
-       ioctrl.cmd3ctl = DDR_IOCTRL_VALUE;
-       ioctrl.data1ctl = DDR_IOCTRL_VALUE;
-       ioctrl.data2ctl = DDR_IOCTRL_VALUE;
+       writel(data->datadldiff0, &ddr_reg[macrono]->dt0.dldiff0);
 
-       config_io_ctrl(&ioctrl);
+       return 0;
+}
 
-       writel(readl(&ddrctrl->ddrioctrl) & 0xefffffff, &ddrctrl->ddrioctrl);
-       writel(readl(&ddrctrl->ddrckectrl) | 0x00000001, &ddrctrl->ddrckectrl);
+int config_io_ctrl(struct ddr_ioctrl *ioctrl)
+{
+       writel(ioctrl->cmd1ctl, &ioctrl_reg->cm0ioctl);
+       writel(ioctrl->cmd2ctl, &ioctrl_reg->cm1ioctl);
+       writel(ioctrl->cmd3ctl, &ioctrl_reg->cm2ioctl);
+       writel(ioctrl->data1ctl, &ioctrl_reg->dt0ioctl);
+       writel(ioctrl->data2ctl, &ioctrl_reg->dt1ioctl);
 
-       config_emif_ddr2();
+       return 0;
 }
-#endif
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..e7f1cf7
--- /dev/null
@@ -0,0 +1,104 @@
+/*
+ * (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
+};
+
+#define GPMC_CS 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;
+
+#if defined(CONFIG_CMD_NAND) || defined(CONFIG_CMD_ONENAND)
+       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);
+
+#if defined(CONFIG_CMD_NAND)   /* CS 0 */
+       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 507b6180e62f1afc500bd11e1dd10c5730097414..5eb7de7452c5672c0db917eb8345747b25ed968d 100644 (file)
@@ -26,7 +26,7 @@
 #include <asm/arch/cpu.h>
 #include <asm/arch/clock.h>
 
-struct ctrl_stat *cstat = (struct ctrl_stat *)CTRL_BASE;
+static struct ctrl_stat *cstat = (struct ctrl_stat *)CTRL_BASE;
 
 /**
  * get_cpu_rev(void) - extract rev info
@@ -71,7 +71,7 @@ u32 get_board_rev(void)
 u32 get_device_type(void)
 {
        int mode;
-       mode = readl(&cstat->statusreg) & (DEVICE_MASK);
+       mode = readl(&cstat->statusreg) & DEVICE_MASK;
        return mode >>= 8;
 }
 
@@ -81,10 +81,27 @@ u32 get_device_type(void)
 u32 get_sysboot_value(void)
 {
        int mode;
-       mode = readl(&cstat->statusreg) & (SYSBOOT_MASK);
+       mode = readl(&cstat->statusreg) & SYSBOOT_MASK;
        return mode;
 }
 
+#define SYSBOOT_FREQ_SHIFT     22
+#define SYSBOOT_FREQ_MASK      (3 << SYSBOOT_FREQ_SHIFT)
+
+static unsigned long bootfreqs[] = {
+       19200000,
+       24000000,
+       25000000,
+       26000000,
+};
+
+u32 get_sysboot_freq(void)
+{
+       int mode;
+       mode = readl(&cstat->statusreg) & SYSBOOT_FREQ_MASK;
+       return bootfreqs[mode >> SYSBOOT_FREQ_SHIFT];
+}
+
 #ifdef CONFIG_DISPLAY_CPUINFO
 /**
  * Print CPU information
@@ -92,15 +109,15 @@ u32 get_sysboot_value(void)
 int print_cpuinfo(void)
 {
        char *cpu_s, *sec_s;
-       int arm_freq, ddr_freq;
+       unsigned long clk;
+       const struct cm_wkuppll *cmwkup = (struct cm_wkuppll *)CM_WKUP;
 
        switch (get_cpu_type()) {
-       case AM335X:
+       case AM335X_ID:
                cpu_s = "AM335X";
                break;
        default:
                cpu_s = "Unknown cpu type";
-               break;
        }
 
        switch (get_device_type()) {
@@ -120,10 +137,26 @@ int print_cpuinfo(void)
                sec_s = "?";
        }
 
-       printf("AM%s-%s rev %d\n",
+       printf("%s-%s rev %d\n",
                        cpu_s, sec_s, get_cpu_rev());
 
-       /* TODO: Print ARM and DDR frequencies  */
+       clk = get_sysboot_freq();
+       printf("OSC clk: %4lu.%03lu MHz\n",
+               clk / 1000000, clk / 1000 % 1000);
+       clk = clk_get_rate(cmwkup, mpu);
+       printf("MPU clk: %4lu.%03lu MHz\n",
+               clk / 1000000, clk / 1000 % 1000);
+       clk = clk_get_rate(cmwkup, ddr);
+       printf("DDR clk: %4lu.%03lu MHz\n",
+               clk / 1000000, clk / 1000 % 1000);
+       clk = clk_get_rate(cmwkup, per);
+       printf("PER clk: %4lu.%03lu MHz\n",
+               clk / 1000000, clk / 1000 % 1000);
+#ifdef CONFIG_LCD
+       clk = clk_get_rate(cmwkup, disp);
+       printf("LCD clk: %4lu.%03lu MHz\n",
+               clk / 1000000, clk / 1000 % 1000);
+#endif
 
        return 0;
 }
index 1b4e808a79c74ff91f955bf24ec2007e27250828..0923a6f09d6e0b2983fb485d5029b255a755202c 100644 (file)
@@ -236,16 +236,18 @@ static void v7_dcache_maint_range(u32 start, u32 stop, u32 range_op)
 /* Invalidate TLB */
 static void v7_inval_tlb(void)
 {
-       /* Invalidate entire unified TLB */
-       asm volatile ("mcr p15, 0, %0, c8, c7, 0" : : "r" (0));
-       /* Invalidate entire data TLB */
-       asm volatile ("mcr p15, 0, %0, c8, c6, 0" : : "r" (0));
-       /* Invalidate entire instruction TLB */
-       asm volatile ("mcr p15, 0, %0, c8, c5, 0" : : "r" (0));
-       /* Full system DSB - make sure that the invalidation is complete */
-       CP15DSB;
-       /* Full system ISB - make sure the instruction stream sees it */
-       CP15ISB;
+       asm volatile (
+               /* Invalidate entire unified TLB */
+               "mcr p15, 0, %0, c8, c7, 0\n"
+               /* Invalidate entire data TLB */
+               "mcr p15, 0, %0, c8, c6, 0\n"
+               /* Invalidate entire instruction TLB */
+               "mcr p15, 0, %0, c8, c5, 0\n"
+               /* Full system DSB - make sure that the invalidation is complete */
+               "mcr     p15, 0, %0, c7, c10, 4\n"
+               /* Full system ISB - make sure the instruction stream sees it */
+               "mcr     p15, 0, %0, c7, c5, 4\n"
+               : : "r" (0));
 }
 
 void invalidate_dcache_all(void)
@@ -339,16 +341,15 @@ void invalidate_icache_all(void)
         * Invalidate all instruction caches to PoU.
         * Also flushes branch target cache.
         */
-       asm volatile ("mcr p15, 0, %0, c7, c5, 0" : : "r" (0));
-
-       /* Invalidate entire branch predictor array */
-       asm volatile ("mcr p15, 0, %0, c7, c5, 6" : : "r" (0));
-
-       /* Full system DSB - make sure that the invalidation is complete */
-       CP15DSB;
-
-       /* ISB - make sure the instruction stream sees it */
-       CP15ISB;
+       asm volatile (
+               "mcr p15, 0, %0, c7, c5, 0\n"
+               /* Invalidate entire branch predictor array */
+               "mcr p15, 0, %0, c7, c5, 6\n"
+               /* Full system DSB - make sure that the invalidation is complete */
+               "mcr     p15, 0, %0, c7, c10, 4\n"
+               /* ISB - make sure the instruction stream sees it */
+               "mcr     p15, 0, %0, c7, c5, 4\n"
+               : : "r" (0));
 }
 #else
 void invalidate_icache_all(void)
index f532d62e573fc6b09f1691aadd2cf3343634b769..5407cb68a89c29f001ac58e51ee024cbde128dcf 100644 (file)
 #
 PLATFORM_RELFLAGS += -fno-common -ffixed-r8 -msoft-float
 
-# Make ARMv5 to allow more compilers to work, even though its v7a.
-PLATFORM_CPPFLAGS += -march=armv5
+# If armv7-a is not supported by GCC fall-back to armv5, which is
+# supported by more tool-chains
+PF_CPPFLAGS_ARMV7 := $(call cc-option, -march=armv7-a, -march=armv5)
+PLATFORM_CPPFLAGS += $(PF_CPPFLAGS_ARMV7)
+
 # =========================================================================
 #
 # Supply options according to compiler version
index c6fa8ef13617636a8c879cccbae626bf6ee8c2e1..b44d92c6ed707bb135cb6d69ee07a63e1bb00532 100644 (file)
@@ -33,6 +33,7 @@
 
 #include <common.h>
 #include <command.h>
+#include <lcd.h>
 #include <asm/system.h>
 #include <asm/cache.h>
 #include <asm/armv7.h>
@@ -54,7 +55,15 @@ int cleanup_before_linux(void)
         */
 #ifndef CONFIG_SPL_BUILD
        disable_interrupts();
-#endif
+#ifdef CONFIG_LCD
+       {
+               /* switch off LCD panel */
+               lcd_panel_disable();
+               /* disable LCD controller */
+               lcd_disable();
+       }
+#endif /* CONFIG_LCD */
+#endif /* CONFIG_SPL_BUILD */
 
        /*
         * Turn off I-cache and invalidate it
index 124c38018c85b9b9806c5d7830a75e349bba6ecf..90ec2bd40486f8abd7dfba0a466fcf3bb28a08a8 100644 (file)
@@ -22,7 +22,7 @@ include $(TOPDIR)/config.mk
 
 LIB    = $(obj)lib$(SOC).o
 
-COBJS  += clock.o soc.o
+COBJS  += clock.o power.o soc.o system.o
 
 SRCS   := $(SOBJS:.o=.S) $(COBJS:.o=.c)
 OBJS   := $(addprefix $(obj),$(COBJS) $(SOBJS))
index 2f7048b6a33e39540d4a68e38e99522854f981de..330bd75da9a87260dfdece6587f9f3669133a57d 100644 (file)
@@ -414,6 +414,170 @@ static void exynos5_set_mmc_clk(int dev_index, unsigned int div)
        writel(val, addr);
 }
 
+/* get_lcd_clk: return lcd clock frequency */
+static unsigned long exynos4_get_lcd_clk(void)
+{
+       struct exynos4_clock *clk =
+               (struct exynos4_clock *)samsung_get_base_clock();
+       unsigned long pclk, sclk;
+       unsigned int sel;
+       unsigned int ratio;
+
+       /*
+        * CLK_SRC_LCD0
+        * FIMD0_SEL [3:0]
+        */
+       sel = readl(&clk->src_lcd0);
+       sel = sel & 0xf;
+
+       /*
+        * 0x6: SCLK_MPLL
+        * 0x7: SCLK_EPLL
+        * 0x8: SCLK_VPLL
+        */
+       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_LCD0
+        * FIMD0_RATIO [3:0]
+        */
+       ratio = readl(&clk->div_lcd0);
+       ratio = ratio & 0xf;
+
+       pclk = sclk / (ratio + 1);
+
+       return pclk;
+}
+
+void exynos4_set_lcd_clk(void)
+{
+       struct exynos4_clock *clk =
+           (struct exynos4_clock *)samsung_get_base_clock();
+       unsigned int cfg = 0;
+
+       /*
+        * CLK_GATE_BLOCK
+        * CLK_CAM      [0]
+        * CLK_TV       [1]
+        * CLK_MFC      [2]
+        * CLK_G3D      [3]
+        * CLK_LCD0     [4]
+        * CLK_LCD1     [5]
+        * CLK_GPS      [7]
+        */
+       cfg = readl(&clk->gate_block);
+       cfg |= 1 << 4;
+       writel(cfg, &clk->gate_block);
+
+       /*
+        * CLK_SRC_LCD0
+        * FIMD0_SEL            [3:0]
+        * MDNIE0_SEL           [7:4]
+        * MDNIE_PWM0_SEL       [8:11]
+        * MIPI0_SEL            [12:15]
+        * set lcd0 src clock 0x6: SCLK_MPLL
+        */
+       cfg = readl(&clk->src_lcd0);
+       cfg &= ~(0xf);
+       cfg |= 0x6;
+       writel(cfg, &clk->src_lcd0);
+
+       /*
+        * CLK_GATE_IP_LCD0
+        * CLK_FIMD0            [0]
+        * CLK_MIE0             [1]
+        * CLK_MDNIE0           [2]
+        * CLK_DSIM0            [3]
+        * CLK_SMMUFIMD0        [4]
+        * CLK_PPMULCD0         [5]
+        * Gating all clocks for FIMD0
+        */
+       cfg = readl(&clk->gate_ip_lcd0);
+       cfg |= 1 << 0;
+       writel(cfg, &clk->gate_ip_lcd0);
+
+       /*
+        * CLK_DIV_LCD0
+        * FIMD0_RATIO          [3:0]
+        * MDNIE0_RATIO         [7:4]
+        * MDNIE_PWM0_RATIO     [11:8]
+        * MDNIE_PWM_PRE_RATIO  [15:12]
+        * MIPI0_RATIO          [19:16]
+        * MIPI0_PRE_RATIO      [23:20]
+        * set fimd ratio
+        */
+       cfg &= ~(0xf);
+       cfg |= 0x1;
+       writel(cfg, &clk->div_lcd0);
+}
+
+void exynos4_set_mipi_clk(void)
+{
+       struct exynos4_clock *clk =
+           (struct exynos4_clock *)samsung_get_base_clock();
+       unsigned int cfg = 0;
+
+       /*
+        * CLK_SRC_LCD0
+        * FIMD0_SEL            [3:0]
+        * MDNIE0_SEL           [7:4]
+        * MDNIE_PWM0_SEL       [8:11]
+        * MIPI0_SEL            [12:15]
+        * set mipi0 src clock 0x6: SCLK_MPLL
+        */
+       cfg = readl(&clk->src_lcd0);
+       cfg &= ~(0xf << 12);
+       cfg |= (0x6 << 12);
+       writel(cfg, &clk->src_lcd0);
+
+       /*
+        * CLK_SRC_MASK_LCD0
+        * FIMD0_MASK           [0]
+        * MDNIE0_MASK          [4]
+        * MDNIE_PWM0_MASK      [8]
+        * MIPI0_MASK           [12]
+        * set src mask mipi0 0x1: Unmask
+        */
+       cfg = readl(&clk->src_mask_lcd0);
+       cfg |= (0x1 << 12);
+       writel(cfg, &clk->src_mask_lcd0);
+
+       /*
+        * CLK_GATE_IP_LCD0
+        * CLK_FIMD0            [0]
+        * CLK_MIE0             [1]
+        * CLK_MDNIE0           [2]
+        * CLK_DSIM0            [3]
+        * CLK_SMMUFIMD0        [4]
+        * CLK_PPMULCD0         [5]
+        * Gating all clocks for MIPI0
+        */
+       cfg = readl(&clk->gate_ip_lcd0);
+       cfg |= 1 << 3;
+       writel(cfg, &clk->gate_ip_lcd0);
+
+       /*
+        * CLK_DIV_LCD0
+        * FIMD0_RATIO          [3:0]
+        * MDNIE0_RATIO         [7:4]
+        * MDNIE_PWM0_RATIO     [11:8]
+        * MDNIE_PWM_PRE_RATIO  [15:12]
+        * MIPI0_RATIO          [19:16]
+        * MIPI0_PRE_RATIO      [23:20]
+        * set mipi ratio
+        */
+       cfg &= ~(0xf << 16);
+       cfg |= (0x1 << 16);
+       writel(cfg, &clk->div_lcd0);
+}
+
 unsigned long get_pll_clk(int pllreg)
 {
        if (cpu_is_exynos5())
@@ -453,3 +617,23 @@ void set_mmc_clk(int dev_index, unsigned int div)
        else
                exynos4_set_mmc_clk(dev_index, div);
 }
+
+unsigned long get_lcd_clk(void)
+{
+       if (cpu_is_exynos4())
+               return exynos4_get_lcd_clk();
+       else
+               return 0;
+}
+
+void set_lcd_clk(void)
+{
+       if (cpu_is_exynos4())
+               exynos4_set_lcd_clk();
+}
+
+void set_mipi_clk(void)
+{
+       if (cpu_is_exynos4())
+               exynos4_set_mipi_clk();
+}
diff --git a/arch/arm/cpu/armv7/exynos/power.c b/arch/arm/cpu/armv7/exynos/power.c
new file mode 100644 (file)
index 0000000..c765304
--- /dev/null
@@ -0,0 +1,54 @@
+/*
+ * 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 <asm/io.h>
+#include <asm/arch/power.h>
+
+static void exynos4_mipi_phy_control(unsigned int dev_index,
+                                       unsigned int enable)
+{
+       struct exynos4_power *pmu =
+           (struct exynos4_power *)samsung_get_base_power();
+       unsigned int addr, cfg = 0;
+
+       if (dev_index == 0)
+               addr = (unsigned int)&pmu->mipi_phy0_control;
+       else
+               addr = (unsigned int)&pmu->mipi_phy1_control;
+
+
+       cfg = readl(addr);
+       if (enable)
+               cfg |= (EXYNOS_MIPI_PHY_MRESETN | EXYNOS_MIPI_PHY_ENABLE);
+       else
+               cfg &= ~(EXYNOS_MIPI_PHY_MRESETN | EXYNOS_MIPI_PHY_ENABLE);
+
+       writel(cfg, addr);
+}
+
+void set_mipi_phy_ctrl(unsigned int dev_index, unsigned int enable)
+{
+       if (cpu_is_exynos4())
+               exynos4_mipi_phy_control(dev_index, enable);
+}
diff --git a/arch/arm/cpu/armv7/exynos/system.c b/arch/arm/cpu/armv7/exynos/system.c
new file mode 100644 (file)
index 0000000..6c34730
--- /dev/null
@@ -0,0 +1,48 @@
+/*
+ * 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 <asm/io.h>
+#include <asm/arch/system.h>
+
+static void exynos4_set_system_display(void)
+{
+       struct exynos4_sysreg *sysreg =
+           (struct exynos4_sysreg *)samsung_get_base_sysreg();
+       unsigned int cfg = 0;
+
+       /*
+        * system register path set
+        * 0: MIE/MDNIE
+        * 1: FIMD Bypass
+        */
+       cfg = readl(&sysreg->display_ctrl);
+       cfg |= (1 << 1);
+       writel(cfg, &sysreg->display_ctrl);
+}
+
+void set_system_display_ctrl(void)
+{
+       if (cpu_is_exynos4())
+               exynos4_set_system_display();
+}
index 3d58d8ae9160c7f0ff2e0fceeb03d7a80aeab537..9aad798c1e2e7140fd59f211d2c544b73ad57fb7 100644 (file)
 #include <asm/arch/imx-regs.h>
 #include <asm/arch/clock.h>
 #include <asm/arch/sys_proto.h>
+#include <asm/arch/crm_regs.h>
 
 #ifdef CONFIG_FSL_ESDHC
 #include <fsl_esdhc.h>
 #endif
 
-static char *get_reset_cause(void)
+char *get_reset_cause(void)
 {
        u32 cause;
        struct src *src_regs = (struct src *)SRC_BASE_ADDR;
@@ -125,5 +126,22 @@ int cpu_mmc_init(bd_t *bis)
 
 void reset_cpu(ulong addr)
 {
+       struct src *src_regs = (struct src *)SRC_BASE_ADDR;
+
+       /* Clear the reset status flags */
+       writel(readl(&src_regs->srsr), &src_regs->srsr);
+
        __raw_writew(4, WDOG1_BASE_ADDR);
 }
+
+u32 get_ahb_clk(void)
+{
+       struct mxc_ccm_reg *imx_ccm = (struct mxc_ccm_reg *)CCM_BASE_ADDR;
+       u32 reg, ahb_podf;
+
+       reg = __raw_readl(&imx_ccm->cbcdr);
+       reg &= MXC_CCM_CBCDR_AHB_PODF_MASK;
+       ahb_podf = reg >> MXC_CCM_CBCDR_AHB_PODF_OFFSET;
+
+       return get_periph_clk() / (ahb_podf + 1);
+}
index 1645ff83f47be8548e4bf713222e3766d7a42e99..39d2862a01dcf74da3bc149cc0be1963902042c5 100644 (file)
@@ -42,29 +42,53 @@ static struct mxc_gpt *cur_gpt = (struct mxc_gpt *)GPT1_BASE_ADDR;
 /* General purpose timers bitfields */
 #define GPTCR_SWR              (1 << 15)       /* Software reset */
 #define GPTCR_FRR              (1 << 9)        /* Freerun / restart */
-#define GPTCR_CLKSOURCE_32     (4 << 6)        /* Clock source */
+#define GPTCR_CLKSOURCE_IPG    (1 << 6)        /* Clock source */
+#define GPTCR_CLKSOURCE_CKIH   (2 << 6)
+#define GPTCR_CLKSOURCE_32kHz  (4 << 6)
+#define GPTCR_CLKSOURCE_OSC    (5 << 6)
+#define GPTCR_CLKSOURCE_MASK   (7 << 6)
 #define GPTCR_TEN              1               /* Timer enable */
-#define CLK_32KHZ              32768           /* 32Khz input */
+
+#define GPT_CLKSOURCE          GPTCR_CLKSOURCE_32kHz
+#define GPT_REFCLK             32768
+#define GPT_PRESCALER          1
+#define GPT_CLK                        (GPT_REFCLK / GPT_PRESCALER)
+
+#ifdef DEBUG_TIMER_WRAP
+/*
+ * Let the timer wrap 30 seconds after start to catch misbehaving
+ * timer related code early
+ */
+#define TIMER_START            (-time_to_tick(30 * CONFIG_SYS_HZ))
+#else
+#define TIMER_START            0UL
+#endif
 
 DECLARE_GLOBAL_DATA_PTR;
 
-#define timestamp (gd->tbl)
-#define lastinc (gd->lastinc)
+static inline unsigned long tick_to_time(unsigned long tick)
+{
+       unsigned long long t = (unsigned long long)tick * CONFIG_SYS_HZ;
+       do_div(t, GPT_CLK);
+       return t;
+}
 
-static inline unsigned long long tick_to_time(unsigned long long tick)
+static inline unsigned long time_to_tick(unsigned long time)
 {
-       tick *= CONFIG_SYS_HZ;
-       do_div(tick, CLK_32KHZ);
+       unsigned long long ticks = (unsigned long long)time;
 
-       return tick;
+       ticks *= GPT_CLK;
+       do_div(ticks, CONFIG_SYS_HZ);
+       return ticks;
 }
 
-static inline unsigned long long us_to_tick(unsigned long long usec)
+static inline unsigned long us_to_tick(unsigned long usec)
 {
-       usec *= CLK_32KHZ;
-       do_div(usec, 1000000);
+       unsigned long long ticks = (unsigned long long)usec;
 
-       return usec;
+       ticks *= GPT_CLK;
+       do_div(ticks, 1000 * CONFIG_SYS_HZ);
+       return ticks;
 }
 
 int timer_init(void)
@@ -79,15 +103,18 @@ int timer_init(void)
        for (i = 0; i < 100; i++)
                __raw_writel(0, &cur_gpt->control);
 
-       __raw_writel(0, &cur_gpt->prescaler); /* 32Khz */
+       __raw_writel(0, &cur_gpt->prescaler);
 
        /* Freerun Mode, PERCLK1 input */
        i = __raw_readl(&cur_gpt->control);
-       __raw_writel(i | GPTCR_CLKSOURCE_32 | GPTCR_TEN, &cur_gpt->control);
+       i &= ~GPTCR_CLKSOURCE_MASK;
+       __raw_writel(i | GPT_CLKSOURCE | GPTCR_TEN, &cur_gpt->control);
 
        val = __raw_readl(&cur_gpt->counter);
-       lastinc = val / (CLK_32KHZ / CONFIG_SYS_HZ);
-       timestamp = 0;
+       gd->lastinc = val;
+       gd->tbu = 0;
+       gd->tbl = TIMER_START;
+       gd->timer_rate_hz = GPT_CLK;
 
        return 0;
 }
@@ -95,19 +122,11 @@ int timer_init(void)
 unsigned long long get_ticks(void)
 {
        ulong now = __raw_readl(&cur_gpt->counter); /* current tick value */
+       ulong inc = now - gd->lastinc;
 
-       if (now >= lastinc) {
-               /*
-                * normal mode (non roll)
-                * move stamp forward with absolut diff ticks
-                */
-               timestamp += (now - lastinc);
-       } else {
-               /* we have rollover of incrementer */
-               timestamp += (0xFFFFFFFF - lastinc) + now;
-       }
-       lastinc = now;
-       return timestamp;
+       gd->tbl += inc;
+       gd->lastinc = now;
+       return gd->tbl;
 }
 
 ulong get_timer_masked(void)
@@ -118,25 +137,36 @@ ulong get_timer_masked(void)
         * 5 * 10^9 days... and get_ticks() * CONFIG_SYS_HZ wraps in
         * 5 * 10^6 days - long enough.
         */
+       /*
+        * LW: get_ticks() returns a long long with the top 32 bits always ZERO!
+        * Thus the calculation above is not true.
+        * A 64bit timer value would only make sense if it was
+        * consistently used throughout the code. Thus also the parameter
+        * to get_timer() and its return value would need to be 64bit wide!
+        */
        return tick_to_time(get_ticks());
 }
 
 ulong get_timer(ulong base)
 {
-       return get_timer_masked() - base;
+       return tick_to_time(get_ticks() - time_to_tick(base));
 }
 
 /* delay x useconds AND preserve advance timstamp value */
 void __udelay(unsigned long usec)
 {
-       unsigned long long tmp;
-       ulong tmo;
+       unsigned long start = __raw_readl(&cur_gpt->counter);
+       unsigned long ticks;
+
+       if (usec == 0)
+               return;
 
-       tmo = us_to_tick(usec);
-       tmp = get_ticks() + tmo;        /* get current timestamp */
+       ticks = us_to_tick(usec);
+       if (ticks == 0)
+               ticks++;
 
-       while (get_ticks() < tmp)       /* loop till event */
-                /*NOP*/;
+       while (__raw_readl(&cur_gpt->counter) - start < ticks)
+               /* loop till event */;
 }
 
 /*
@@ -145,5 +175,5 @@ void __udelay(unsigned long usec)
  */
 ulong get_tbclk(void)
 {
-       return CLK_32KHZ;
+       return gd->timer_rate_hz;
 }
index ecd1184213328fe974af724cc54ae72edd2332aa..c84ea05de2a4f3401fda378dc050f38bed96a1b3 100644 (file)
@@ -27,7 +27,12 @@ include $(TOPDIR)/config.mk
 
 LIB    = $(obj)lib$(SOC).o
 
-COBJS  = soc.o clock.o iomux.o
+COBJS  = soc.o clock.o
+ifneq ($(CONFIG_SYS_MX5_IOMUX_V3),)
+       COBJS +=  iomux-v3.o
+else
+       COBJS +=  iomux.o
+endif
 SOBJS = lowlevel_init.o
 
 SRCS   := $(SOBJS:.o=.S) $(COBJS:.o=.c)
index e92f10623a92bb6e72c2d4c3e947f58dffcce78b..c4c8fbeb6a1f11c21be2575b2e3f15d564c3224e 100644 (file)
@@ -30,6 +30,7 @@
 #include <asm/arch/crm_regs.h>
 #include <asm/arch/clock.h>
 #include <div64.h>
+#include <asm/arch/sys_proto.h>
 
 enum pll_clocks {
        PLL1_CLOCK = 0,
@@ -48,6 +49,39 @@ struct mxc_pll_reg *mxc_plls[PLL_CLOCKS] = {
 #endif
 };
 
+#define AHB_CLK_ROOT    133333333
+#define SZ_DEC_1M       1000000
+#define PLL_PD_MAX      16      /* Actual pd+1 */
+#define PLL_MFI_MAX     15
+#define PLL_MFI_MIN     5
+#define ARM_DIV_MAX     8
+#define IPG_DIV_MAX     4
+#define AHB_DIV_MAX     8
+#define EMI_DIV_MAX     8
+#define NFC_DIV_MAX     8
+
+struct fixed_pll_mfd {
+       u32 ref_clk_hz;
+       u32 mfd;
+};
+
+const struct fixed_pll_mfd fixed_mfd[] = {
+       {CONFIG_SYS_MX5_HCLK, 24 * 16},
+};
+
+struct pll_param {
+       u32 pd;
+       u32 mfi;
+       u32 mfn;
+       u32 mfd;
+};
+
+#define PLL_FREQ_MAX(ref_clk)  (4 * (ref_clk) * PLL_MFI_MAX)
+#define PLL_FREQ_MIN(ref_clk) \
+               ((2 * (ref_clk) * (PLL_MFI_MIN - 1)) / PLL_PD_MAX)
+#define MAX_DDR_CLK     420000000
+#define NFC_CLK_MAX     34000000
+
 struct mxc_ccm_reg *mxc_ccm = (struct mxc_ccm_reg *)MXC_CCM_BASE;
 
 void set_usboh3_clk(void)
@@ -192,7 +226,7 @@ u32 get_mcu_main_clk(void)
 /*
  * Get the rate of peripheral's root clock.
  */
-static u32 get_periph_clk(void)
+u32 get_periph_clk(void)
 {
        u32 reg;
 
@@ -212,22 +246,6 @@ static u32 get_periph_clk(void)
        /* NOTREACHED */
 }
 
-/*
- * Get the rate of ahb clock.
- */
-static u32 get_ahb_clk(void)
-{
-       uint32_t freq, div, reg;
-
-       freq = get_periph_clk();
-
-       reg = __raw_readl(&mxc_ccm->cbcdr);
-       div = ((reg & MXC_CCM_CBCDR_AHB_PODF_MASK) >>
-                       MXC_CCM_CBCDR_AHB_PODF_OFFSET) + 1;
-
-       return freq / div;
-}
-
 /*
  * Get the rate of ipg clock.
  */
@@ -306,7 +324,7 @@ static u32 get_uart_clk(void)
 /*
  * This function returns the low power audio clock.
  */
-u32 get_lp_apm(void)
+static u32 get_lp_apm(void)
 {
        u32 ret_val = 0;
        u32 ccsr = __raw_readl(&mxc_ccm->ccsr);
@@ -322,7 +340,7 @@ u32 get_lp_apm(void)
 /*
  * get cspi clock rate.
  */
-u32 imx_get_cspiclk(void)
+static u32 imx_get_cspiclk(void)
 {
        u32 ret_val = 0, pdf, pre_pdf, clk_sel;
        u32 cscmr1 = __raw_readl(&mxc_ccm->cscmr1);
@@ -359,8 +377,77 @@ u32 imx_get_cspiclk(void)
        return ret_val;
 }
 
+static u32 get_axi_a_clk(void)
+{
+       u32 cbcdr =  __raw_readl(&mxc_ccm->cbcdr);
+       u32 pdf = (cbcdr & MXC_CCM_CBCDR_AXI_A_PODF_MASK) \
+                       >> MXC_CCM_CBCDR_AXI_A_PODF_OFFSET;
+
+       return  get_periph_clk() / (pdf + 1);
+}
+
+static u32 get_axi_b_clk(void)
+{
+       u32 cbcdr =  __raw_readl(&mxc_ccm->cbcdr);
+       u32 pdf = (cbcdr & MXC_CCM_CBCDR_AXI_B_PODF_MASK) \
+                       >> MXC_CCM_CBCDR_AXI_B_PODF_OFFSET;
+
+       return  get_periph_clk() / (pdf + 1);
+}
+
+static u32 get_emi_slow_clk(void)
+{
+       u32 cbcdr = __raw_readl(&mxc_ccm->cbcdr);
+       u32 emi_clk_sel = cbcdr & MXC_CCM_CBCDR_EMI_CLK_SEL;
+       u32 pdf = (cbcdr & MXC_CCM_CBCDR_EMI_PODF_MASK) \
+                       >> MXC_CCM_CBCDR_EMI_PODF_OFFSET;
+
+       if (emi_clk_sel)
+               return  get_ahb_clk() / (pdf + 1);
+
+       return  get_periph_clk() / (pdf + 1);
+}
+
+static u32 get_ddr_clk(void)
+{
+       u32 ret_val = 0;
+       u32 cbcmr = __raw_readl(&mxc_ccm->cbcmr);
+       u32 ddr_clk_sel = (cbcmr & MXC_CCM_CBCMR_DDR_CLK_SEL_MASK) \
+                               >> MXC_CCM_CBCMR_DDR_CLK_SEL_OFFSET;
+#ifdef CONFIG_MX51
+       u32 cbcdr = __raw_readl(&mxc_ccm->cbcdr);
+       if (cbcdr & MXC_CCM_CBCDR_DDR_HIFREQ_SEL) {
+               u32 ddr_clk_podf = (cbcdr & MXC_CCM_CBCDR_DDR_PODF_MASK) >> \
+                                       MXC_CCM_CBCDR_DDR_PODF_OFFSET;
+
+               ret_val = decode_pll(mxc_plls[PLL1_CLOCK], CONFIG_SYS_MX5_HCLK);
+               ret_val /= ddr_clk_podf + 1;
+
+               return ret_val;
+       }
+#endif
+       switch (ddr_clk_sel) {
+       case 0:
+               ret_val = get_axi_a_clk();
+               break;
+       case 1:
+               ret_val = get_axi_b_clk();
+               break;
+       case 2:
+               ret_val = get_emi_slow_clk();
+               break;
+       case 3:
+               ret_val = get_ahb_clk();
+               break;
+       default:
+               break;
+       }
+
+       return ret_val;
+}
+
 /*
- * The API of get mxc clockes.
+ * The API of get mxc clocks.
  */
 unsigned int mxc_get_clock(enum mxc_clock clk)
 {
@@ -380,10 +467,14 @@ unsigned int mxc_get_clock(enum mxc_clock clk)
        case MXC_FEC_CLK:
                return decode_pll(mxc_plls[PLL1_CLOCK],
                                    CONFIG_SYS_MX5_HCLK);
+       case MXC_SATA_CLK:
+               return get_ahb_clk();
+       case MXC_DDR_CLK:
+               return get_ddr_clk();
        default:
                break;
        }
-       return -1;
+       return -EINVAL;
 }
 
 u32 imx_get_uartclk(void)
@@ -397,6 +488,375 @@ u32 imx_get_fecclk(void)
        return mxc_get_clock(MXC_IPG_CLK);
 }
 
+static int gcd(int m, int n)
+{
+       int t;
+       while (m > 0) {
+               if (n > m) {
+                       t = m;
+                       m = n;
+                       n = t;
+               } /* swap */
+               m -= n;
+       }
+       return n;
+}
+
+/*
+ * This is to calculate various parameters based on reference clock and
+ * targeted clock based on the equation:
+ *      t_clk = 2*ref_freq*(mfi + mfn/(mfd+1))/(pd+1)
+ * This calculation is based on a fixed MFD value for simplicity.
+ */
+static int calc_pll_params(u32 ref, u32 target, struct pll_param *pll)
+{
+       u64 pd, mfi = 1, mfn, mfd, t1;
+       u32 n_target = target;
+       u32 n_ref = ref, i;
+
+       /*
+        * Make sure targeted freq is in the valid range.
+        * Otherwise the following calculation might be wrong!!!
+        */
+       if (n_target < PLL_FREQ_MIN(ref) ||
+               n_target > PLL_FREQ_MAX(ref)) {
+               printf("Targeted peripheral clock should be"
+                       "within [%d - %d]\n",
+                       PLL_FREQ_MIN(ref) / SZ_DEC_1M,
+                       PLL_FREQ_MAX(ref) / SZ_DEC_1M);
+               return -EINVAL;
+       }
+
+       for (i = 0; i < ARRAY_SIZE(fixed_mfd); i++) {
+               if (fixed_mfd[i].ref_clk_hz == ref) {
+                       mfd = fixed_mfd[i].mfd;
+                       break;
+               }
+       }
+
+       if (i == ARRAY_SIZE(fixed_mfd))
+               return -EINVAL;
+
+       /* Use n_target and n_ref to avoid overflow */
+       for (pd = 1; pd <= PLL_PD_MAX; pd++) {
+               t1 = n_target * pd;
+               do_div(t1, (4 * n_ref));
+               mfi = t1;
+               if (mfi > PLL_MFI_MAX)
+                       return -EINVAL;
+               else if (mfi < 5)
+                       continue;
+               break;
+       }
+       /*
+        * Now got pd and mfi already
+        *
+        * mfn = (((n_target * pd) / 4 - n_ref * mfi) * mfd) / n_ref;
+        */
+       t1 = n_target * pd;
+       do_div(t1, 4);
+       t1 -= n_ref * mfi;
+       t1 *= mfd;
+       do_div(t1, n_ref);
+       mfn = t1;
+       debug("ref=%d, target=%d, pd=%d," "mfi=%d,mfn=%d, mfd=%d\n",
+               ref, n_target, (u32)pd, (u32)mfi, (u32)mfn, (u32)mfd);
+       i = 1;
+       if (mfn != 0)
+               i = gcd(mfd, mfn);
+       pll->pd = (u32)pd;
+       pll->mfi = (u32)mfi;
+       do_div(mfn, i);
+       pll->mfn = (u32)mfn;
+       do_div(mfd, i);
+       pll->mfd = (u32)mfd;
+
+       return 0;
+}
+
+#define calc_div(tgt_clk, src_clk, limit) ({           \
+               u32 v = 0;                              \
+               if (((src_clk) % (tgt_clk)) <= 100)     \
+                       v = (src_clk) / (tgt_clk);      \
+               else                                    \
+                       v = ((src_clk) / (tgt_clk)) + 1;\
+               if (v > limit)                          \
+                       v = limit;                      \
+               (v - 1);                                \
+       })
+
+#define CHANGE_PLL_SETTINGS(pll, pd, fi, fn, fd) \
+       {       \
+               __raw_writel(0x1232, &pll->ctrl);               \
+               __raw_writel(0x2, &pll->config);                \
+               __raw_writel((((pd) - 1) << 0) | ((fi) << 4),   \
+                       &pll->op);                              \
+               __raw_writel(fn, &(pll->mfn));                  \
+               __raw_writel((fd) - 1, &pll->mfd);              \
+               __raw_writel((((pd) - 1) << 0) | ((fi) << 4),   \
+                       &pll->hfs_op);                          \
+               __raw_writel(fn, &pll->hfs_mfn);                \
+               __raw_writel((fd) - 1, &pll->hfs_mfd);          \
+               __raw_writel(0x1232, &pll->ctrl);               \
+               while (!__raw_readl(&pll->ctrl) & 0x1)          \
+                       ;\
+       }
+
+static int config_pll_clk(enum pll_clocks index, struct pll_param *pll_param)
+{
+       u32 ccsr = __raw_readl(&mxc_ccm->ccsr);
+       struct mxc_pll_reg *pll = mxc_plls[index];
+
+       switch (index) {
+       case PLL1_CLOCK:
+               /* Switch ARM to PLL2 clock */
+               __raw_writel(ccsr | 0x4, &mxc_ccm->ccsr);
+               CHANGE_PLL_SETTINGS(pll, pll_param->pd,
+                                       pll_param->mfi, pll_param->mfn,
+                                       pll_param->mfd);
+               /* Switch back */
+               __raw_writel(ccsr & ~0x4, &mxc_ccm->ccsr);
+               break;
+       case PLL2_CLOCK:
+               /* Switch to pll2 bypass clock */
+               __raw_writel(ccsr | 0x2, &mxc_ccm->ccsr);
+               CHANGE_PLL_SETTINGS(pll, pll_param->pd,
+                                       pll_param->mfi, pll_param->mfn,
+                                       pll_param->mfd);
+               /* Switch back */
+               __raw_writel(ccsr & ~0x2, &mxc_ccm->ccsr);
+               break;
+       case PLL3_CLOCK:
+               /* Switch to pll3 bypass clock */
+               __raw_writel(ccsr | 0x1, &mxc_ccm->ccsr);
+               CHANGE_PLL_SETTINGS(pll, pll_param->pd,
+                                       pll_param->mfi, pll_param->mfn,
+                                       pll_param->mfd);
+               /* Switch back */
+               __raw_writel(ccsr & ~0x1, &mxc_ccm->ccsr);
+               break;
+       case PLL4_CLOCK:
+               /* Switch to pll4 bypass clock */
+               __raw_writel(ccsr | 0x20, &mxc_ccm->ccsr);
+               CHANGE_PLL_SETTINGS(pll, pll_param->pd,
+                                       pll_param->mfi, pll_param->mfn,
+                                       pll_param->mfd);
+               /* Switch back */
+               __raw_writel(ccsr & ~0x20, &mxc_ccm->ccsr);
+               break;
+       default:
+               return -EINVAL;
+       }
+
+       return 0;
+}
+
+/* Config CPU clock */
+static int config_core_clk(u32 ref, u32 freq)
+{
+       int ret = 0;
+       struct pll_param pll_param;
+
+       memset(&pll_param, 0, sizeof(struct pll_param));
+
+       /* The case that periph uses PLL1 is not considered here */
+       ret = calc_pll_params(ref, freq, &pll_param);
+       if (ret != 0) {
+               printf("Error: Can't find pll parameters for %u.%03uMHz ref %u.%03uMHz\n",
+                       freq / 1000000, freq / 1000 % 1000,
+                       ref / 1000000, ref / 1000 % 1000);
+               return ret;
+       }
+
+       return config_pll_clk(PLL1_CLOCK, &pll_param);
+}
+
+static int config_nfc_clk(u32 nfc_clk)
+{
+       u32 reg;
+       u32 parent_rate = get_emi_slow_clk();
+       u32 div = parent_rate / nfc_clk;
+
+       if (nfc_clk <= 0)
+               return -EINVAL;
+       if (div == 0)
+               div++;
+       if (parent_rate / div > NFC_CLK_MAX)
+               div++;
+       reg = __raw_readl(&mxc_ccm->cbcdr);
+       reg &= ~MXC_CCM_CBCDR_NFC_PODF_MASK;
+       reg |= (div - 1) << MXC_CCM_CBCDR_NFC_PODF_OFFSET;
+       __raw_writel(reg, &mxc_ccm->cbcdr);
+       while (__raw_readl(&mxc_ccm->cdhipr) != 0)
+               ;
+       return 0;
+}
+
+/* Config main_bus_clock for periphs */
+static int config_periph_clk(u32 ref, u32 freq)
+{
+       int ret = 0;
+       struct pll_param pll_param;
+
+       memset(&pll_param, 0, sizeof(struct pll_param));
+
+       if (__raw_readl(&mxc_ccm->cbcdr) & MXC_CCM_CBCDR_PERIPH_CLK_SEL) {
+               ret = calc_pll_params(ref, freq, &pll_param);
+               if (ret != 0) {
+                       printf("Error: Can't find pll parameters for %u.%03uMHz ref %u.%03uMHz\n",
+                               freq / 1000000, freq / 1000 % 1000,
+                               ref / 1000000, ref / 1000 % 1000);
+                       return ret;
+               }
+               switch ((__raw_readl(&mxc_ccm->cbcmr) & \
+                       MXC_CCM_CBCMR_PERIPH_CLK_SEL_MASK) >> \
+                       MXC_CCM_CBCMR_PERIPH_CLK_SEL_OFFSET) {
+               case 0:
+                       return config_pll_clk(PLL1_CLOCK, &pll_param);
+
+               case 1:
+                       return config_pll_clk(PLL3_CLOCK, &pll_param);
+
+               default:
+                       return -EINVAL;
+               }
+       }
+
+       return 0;
+}
+
+static int config_ddr_clk(u32 emi_clk)
+{
+       u32 clk_src;
+       s32 shift = 0, clk_sel, div = 1;
+       u32 cbcmr = __raw_readl(&mxc_ccm->cbcmr);
+       u32 cbcdr = __raw_readl(&mxc_ccm->cbcdr);
+
+       if (emi_clk > MAX_DDR_CLK) {
+               printf("Warning: DDR clock should not exceed %d MHz\n",
+                       MAX_DDR_CLK / SZ_DEC_1M);
+               emi_clk = MAX_DDR_CLK;
+       }
+
+       clk_src = get_periph_clk();
+       /* Find DDR clock input */
+       clk_sel = (cbcmr >> 10) & 0x3;
+#ifdef CONFIG_MX51
+       if (cbcdr & MXC_CCM_CBCDR_DDR_HIFREQ_SEL) {
+               clk_src = decode_pll(mxc_plls[PLL1_CLOCK], CONFIG_SYS_MX5_HCLK);
+               clk_sel = 4;
+       }
+#endif
+       switch (clk_sel) {
+       case 0:
+               shift = 16;
+               break;
+       case 1:
+               shift = 19;
+               break;
+       case 2:
+               shift = 22;
+               break;
+       case 3:
+               shift = 10;
+               break;
+       case 4:
+               shift = 27;
+               break;
+       default:
+               return -EINVAL;
+       }
+
+       if ((clk_src % emi_clk) < 10000000)
+               div = clk_src / emi_clk;
+       else
+               div = (clk_src / emi_clk) + 1;
+       if (--div > 7)
+               div = 7;
+
+       cbcdr &= ~(0x7 << shift);
+       cbcdr |= div << shift;
+       __raw_writel(cbcdr, &mxc_ccm->cbcdr);
+       while (__raw_readl(&mxc_ccm->cdhipr) != 0)
+               ;
+       __raw_writel(0x0, &mxc_ccm->ccdr);
+
+       return 0;
+}
+
+/*
+ * This function assumes the expected core clock has to be changed by
+ * modifying the PLL. This is NOT true always but for most of the times,
+ * it is. So it assumes the PLL output freq is the same as the expected
+ * core clock (presc=1) unless the core clock is less than PLL_FREQ_MIN.
+ * In the latter case, it will try to increase the presc value until
+ * (presc*core_clk) is greater than PLL_FREQ_MIN. It then makes call to
+ * calc_pll_params() and obtains the values of PD, MFI,MFN, MFD based
+ * on the targeted PLL and reference input clock to the PLL. Lastly,
+ * it sets the register based on these values along with the dividers.
+ * Note 1) There is no value checking for the passed-in divider values
+ *         so the caller has to make sure those values are sensible.
+ *      2) Also adjust the NFC divider such that the NFC clock doesn't
+ *         exceed NFC_CLK_MAX.
+ *      3) IPU HSP clock is independent of AHB clock. Even it can go up to
+ *         177MHz for higher voltage, this function fixes the max to 133MHz.
+ *      4) This function should not have allowed diag_printf() calls since
+ *         the serial driver has been stoped. But leave then here to allow
+ *         easy debugging by NOT calling the cyg_hal_plf_serial_stop().
+ */
+int mxc_set_clock(u32 ref, u32 freq, enum mxc_clock clk)
+{
+       freq *= SZ_DEC_1M;
+
+       switch (clk) {
+       case MXC_ARM_CLK:
+               if (config_core_clk(ref, freq))
+                       return -EINVAL;
+               break;
+       case MXC_PERIPH_CLK:
+               if (config_periph_clk(ref, freq))
+                       return -EINVAL;
+               break;
+       case MXC_DDR_CLK:
+               if (config_ddr_clk(freq))
+                       return -EINVAL;
+               break;
+       case MXC_NFC_CLK:
+               if (config_nfc_clk(freq))
+                       return -EINVAL;
+               break;
+       default:
+               printf("Warning: Unsupported or invalid clock type: %d\n",
+                       clk);
+               return -EINVAL;
+       }
+
+       return 0;
+}
+
+#ifdef CONFIG_MX53
+/*
+ * The clock for the external interface can be set to use internal clock
+ * if fuse bank 4, row 3, bit 2 is set.
+ * This is an undocumented feature and it was confirmed by Freescale's support:
+ * Fuses (but not pins) may be used to configure SATA clocks.
+ * Particularly the i.MX53 Fuse_Map contains the next information
+ * about configuring SATA clocks :  SATA_ALT_REF_CLK[1:0] (offset 0x180C)
+ * '00' - 100MHz (External)
+ * '01' - 50MHz (External)
+ * '10' - 120MHz, internal (USB PHY)
+ * '11' - Reserved
+*/
+void mxc_set_sata_internal_clock(void)
+{
+       u32 *tmp_base = (u32 *)(IIM_BASE_ADDR + 0x180c);
+
+       set_usb_phy1_clk();
+
+       writel((readl(tmp_base) & ~0x7) | 0x4, tmp_base);
+}
+#endif
+
 /*
  * Dump some core clockes.
  */
@@ -419,6 +879,7 @@ int do_mx5_showclocks(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
        printf("AHB        %8d kHz\n", mxc_get_clock(MXC_AHB_CLK) / 1000);
        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);
 
        return 0;
 }
diff --git a/arch/arm/cpu/armv7/mx5/iomux-v3.c b/arch/arm/cpu/armv7/mx5/iomux-v3.c
new file mode 100644 (file)
index 0000000..d61fa99
--- /dev/null
@@ -0,0 +1,67 @@
+/*
+ * Copyright 2004-2006 Freescale Semiconductor, Inc. All Rights Reserved.
+ * Copyright (C) 2008 by Sascha Hauer <kernel@pengutronix.de>
+ * Copyright (C) 2009 by Jan Weitzel Phytec Messtechnik GmbH,
+ *                       <armlinux@phytec.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., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ */
+
+#include <common.h>
+#include <asm/io.h>
+#include <asm/arch/imx-regs.h>
+#include <asm/arch/iomux-v3.h>
+#include <asm/arch/sys_proto.h>
+
+static void __iomem *base = (void __iomem *)IOMUXC_BASE_ADDR;
+
+/*
+ * configures a single pad in the iomuxer
+ */
+int mxc_iomux_v3_setup_pad(iomux_v3_cfg_t pad)
+{
+       u32 mux_ctrl_ofs = (pad & MUX_CTRL_OFS_MASK) >> MUX_CTRL_OFS_SHIFT;
+       u32 mux_mode = (pad & MUX_MODE_MASK) >> MUX_MODE_SHIFT;
+       u32 sel_input_ofs = (pad & MUX_SEL_INPUT_OFS_MASK) >> MUX_SEL_INPUT_OFS_SHIFT;
+       u32 sel_input = (pad & MUX_SEL_INPUT_MASK) >> MUX_SEL_INPUT_SHIFT;
+       u32 pad_ctrl_ofs = (pad & MUX_PAD_CTRL_OFS_MASK) >> MUX_PAD_CTRL_OFS_SHIFT;
+       u32 pad_ctrl = (pad & MUX_PAD_CTRL_MASK) >> MUX_PAD_CTRL_SHIFT;
+
+       if (mux_ctrl_ofs)
+               __raw_writel(mux_mode, base + mux_ctrl_ofs);
+
+       if (sel_input_ofs)
+               __raw_writel(sel_input, base + sel_input_ofs);
+
+       if (!(pad_ctrl & NO_PAD_CTRL) && pad_ctrl_ofs)
+               __raw_writel(pad_ctrl, base + pad_ctrl_ofs);
+
+       return 0;
+}
+
+int mxc_iomux_v3_setup_multiple_pads(const iomux_v3_cfg_t *pad_list, unsigned count)
+{
+       const iomux_v3_cfg_t *p = pad_list;
+       int i;
+       int ret;
+
+       for (i = 0; i < count; i++) {
+               ret = mxc_iomux_v3_setup_pad(*p);
+               if (ret)
+                       return ret;
+               p++;
+       }
+       return 0;
+}
index 74ab753a4af24915ded55df1c5ea4e34282de58b..f3a15f64b8b278333f7d04f608b1612cd016ef10 100644 (file)
@@ -22,6 +22,7 @@
 #include <config.h>
 #include <asm/arch/imx-regs.h>
 #include <generated/asm-offsets.h>
+#include <linux/linkage.h>
 
 /*
  * L2CC Cache setup/invalidation/disable
 .endm /* init_m4if */
 
 .macro setup_pll pll, freq
-       ldr r0, =\pll
+       ldr r2, =\pll
        ldr r1, =0x00001232
-       str r1, [r0, #PLL_DP_CTL] /* Set DPLL ON (set UPEN bit): BRMO=1 */
+       str r1, [r2, #PLL_DP_CTL] /* Set DPLL ON (set UPEN bit): BRMO=1 */
        mov r1, #0x2
-       str r1, [r0, #PLL_DP_CONFIG] /* Enable auto-restart AREN bit */
+       str r1, [r2, #PLL_DP_CONFIG] /* Enable auto-restart AREN bit */
 
        ldr r1, W_DP_OP_\freq
-       str r1, [r0, #PLL_DP_OP]
-       str r1, [r0, #PLL_DP_HFS_OP]
+       str r1, [r2, #PLL_DP_OP]
+       str r1, [r2, #PLL_DP_HFS_OP]
 
        ldr r1, W_DP_MFD_\freq
-       str r1, [r0, #PLL_DP_MFD]
-       str r1, [r0, #PLL_DP_HFS_MFD]
+       str r1, [r2, #PLL_DP_MFD]
+       str r1, [r2, #PLL_DP_HFS_MFD]
 
        ldr r1,  W_DP_MFN_\freq
-       str r1, [r0, #PLL_DP_MFN]
-       str r1, [r0, #PLL_DP_HFS_MFN]
+       str r1, [r2, #PLL_DP_MFN]
+       str r1, [r2, #PLL_DP_HFS_MFN]
 
        ldr r1, =0x00001232
-       str r1, [r0, #PLL_DP_CTL]
-1:     ldr r1, [r0, #PLL_DP_CTL]
+       str r1, [r2, #PLL_DP_CTL]
+101:
+       ldr r1, [r2, #PLL_DP_CTL]
        ands r1, r1, #0x1
-       beq 1b
+       beq 101b
 .endm
 
 .macro setup_pll_errata pll, freq
 1:     ldr r1, [r0, #CLKCTL_CDHIPR]
        cmp r1, #0x0
        bne 1b
+#elif defined(CONFIG_TX53)
+       @ CCGR registers have been setup via DCD
 #else
        ldr r1, =0x3FFFFFFF
        str r1, [r0, #CLKCTL_CCGR0]
        setup_pll PLL1_BASE_ADDR, 864
        setup_pll_errata PLL1_BASE_ADDR, W_DP_MFN_800_DIT
 #else
+#if !defined(CONFIG_SYS_CPU_CLK) || CONFIG_SYS_CPU_CLK == 800
        setup_pll PLL1_BASE_ADDR, 800
+#elif CONFIG_SYS_CPU_CLK == 600
+       setup_pll PLL1_BASE_ADDR, 600
+#else
+#error Unsupported CONFIG_SYS_CPU_CLK value
+#endif
 #endif
 
 #if defined(CONFIG_MX51)
        setup_pll PLL3_BASE_ADDR, 665
 
        /* Switch peripheral to PLL 3 */
-       ldr r0, =CCM_BASE_ADDR
        ldr r1, =0x000010C0
-       orr r1,r1,#CONFIG_SYS_DDR_CLKSEL
+       orr r1, r1, #CONFIG_SYS_DDR_CLKSEL
        str r1, [r0, #CLKCTL_CBCMR]
        ldr r1, =0x13239145
        str r1, [r0, #CLKCTL_CBCDR]
        setup_pll PLL2_BASE_ADDR, 665
 
        /* Switch peripheral to PLL2 */
-       ldr r0, =CCM_BASE_ADDR
        ldr r1, =0x19239145
        str r1, [r0, #CLKCTL_CBCDR]
        ldr r1, =0x000020C0
        orr r1,r1,#CONFIG_SYS_DDR_CLKSEL
        str r1, [r0, #CLKCTL_CBCMR]
+#elif defined(CONFIG_TX53)
+       setup_pll PLL3_BASE_ADDR, 400
+
+       /* Switch peripheral to PLL 3 */
+       ldr r1, [r0, #CLKCTL_CBCMR]
+       bic r1, #(0x3 << 12)
+       orr r1, r1, #(1 << 12)
+       str r1, [r0, #CLKCTL_CBCMR]
+
+       ldr r1, [r0, #CLKCTL_CBCDR]
+       orr r1, r1, #(1 << 25)
+       str r1, [r0, #CLKCTL_CBCDR]
+1:
+       /* make sure change is effective */
+       ldr     r1, [r0, #CLKCTL_CDHIPR]
+       tst     r1, #0x7f
+       bne     1b
+#if CONFIG_SYS_SDRAM_CLK == 400
+       setup_pll PLL2_BASE_ADDR, 400
+#elif CONFIG_SYS_SDRAM_CLK == 333
+       setup_pll PLL2_BASE_ADDR, 333
+#else
+#error Unsupported CONFIG_SYS_SDRAM_CLK
+#endif
+       /* Switch peripheral to PLL2 */
+       ldr r0, =CCM_BASE_ADDR
+       ldr r1, [r0, #CLKCTL_CBCDR]
+       bic r1, #(1 << 25)
+       str r1, [r0, #CLKCTL_CBCDR]
+
+       ldr r1, [r0, #CLKCTL_CBCMR]
+       bic r1, #(3 << 12)
+       orr r1, #(2 << 12)
+       str r1, [r0, #CLKCTL_CBCMR]
+
+       /* make sure change is effective */
+1:
+       ldr     r1, [r0, #CLKCTL_CDHIPR]
+       cmp     r1, #0x0
+       bne     1b
 #endif
        setup_pll PLL3_BASE_ADDR, 216
 
        movhi r1, #0
 #else
        mov r1, #0
-
 #endif
        str r1, [r0, #CLKCTL_CACRR]
        /* Switch ARM back to PLL 1 */
        ldr r1, =CONFIG_SYS_CLKTL_CBCDR
        str r1, [r0, #CLKCTL_CBCDR]
 #endif
-
+#ifndef CONFIG_TX53
        /* Restore the default values in the Gate registers */
        ldr r1, =0xFFFFFFFF
        str r1, [r0, #CLKCTL_CCGR0]
 #if defined(CONFIG_MX53)
        str r1, [r0, #CLKCTL_CCGR7]
 #endif
+#endif
 
+#if !defined(CONFIG_TX53)
 #if defined(CONFIG_MX51)
        /* Use PLL 2 for UART's, get 66.5MHz from it */
        ldr r1, =0xA5A2A020
        str r1, [r0, #CLKCTL_CSCDR1]
 #elif defined(CONFIG_MX53)
        /* Switch peripheral to PLL2 */
-       ldr r0, =CCM_BASE_ADDR
        ldr r1, =0x00808145
        orr r1, r1, #(2 << 10)
        orr r1, r1, #(0 << 16)
        str r1, [r0, #CLKCTL_CBCMR]
        /* Change uart clk parent to pll2*/
        ldr r1, [r0, #CLKCTL_CSCMR1]
-       and r1, r1, #0xfcffffff
-       orr r1, r1, #0x01000000
+       bic r1, #(0x3 << 24)
+       orr r1, r1, #(0x1 << 24)
        str r1, [r0, #CLKCTL_CSCMR1]
        ldr r1, [r0, #CLKCTL_CSCDR1]
-       and r1, r1, #0xffffffc0
+       bic r1, #(0x3f << 0)
        orr r1, r1, #0x0a
        str r1, [r0, #CLKCTL_CSCDR1]
 #endif
 1:     ldr r1, [r0, #CLKCTL_CDHIPR]
        cmp r1, #0x0
        bne 1b
-
+#endif
        mov r1, #0x0
        str r1, [r0, #CLKCTL_CCDR]
 
 
 .section ".text.init", "x"
 
-.globl lowlevel_init
-lowlevel_init:
+ENTRY(lowlevel_init)
 #if defined(CONFIG_MX51)
        ldr r0, =GPIO1_BASE_ADDR
        ldr r1, [r0, #0x0]
@@ -348,6 +395,7 @@ lowlevel_init:
 
        /* r12 saved upper lr*/
        mov pc,lr
+ENDPROC(lowlevel_init)
 
 /* Board level setting value */
 W_DP_OP_864:              .word DP_OP_864
@@ -360,6 +408,15 @@ W_DP_MFN_800:             .word DP_MFN_800
 W_DP_OP_665:              .word DP_OP_665
 W_DP_MFD_665:             .word DP_MFD_665
 W_DP_MFN_665:             .word DP_MFN_665
+W_DP_OP_600:              .word DP_OP_600
+W_DP_MFD_600:             .word DP_MFD_600
+W_DP_MFN_600:             .word DP_MFN_600
+W_DP_OP_400:              .word DP_OP_400
+W_DP_MFD_400:             .word DP_MFD_400
+W_DP_MFN_400:             .word DP_MFN_400
+W_DP_OP_333:              .word DP_OP_333
+W_DP_MFD_333:             .word DP_MFD_333
+W_DP_MFN_333:             .word DP_MFN_333
 W_DP_OP_216:              .word DP_OP_216
 W_DP_MFD_216:             .word DP_MFD_216
 W_DP_MFN_216:             .word DP_MFN_216
index 3f5a4f726c70910bcbda382f8c34bed6c1f6d358..d104a66a7f93134eb54993372b5639ebdfa736aa 100644 (file)
 #error "CPU_TYPE not defined"
 #endif
 
+#ifdef CONFIG_HW_WATCHDOG
+#define wdog_base      ((void *)WDOG1_BASE_ADDR)
+#define WDOG_WCR       0x00
+#define WCR_WDE                (1 << 2)
+#define WDOG_WSR       0x02
+
+void hw_watchdog_reset(void)
+{
+       if (readw(wdog_base + WDOG_WCR) & WCR_WDE) {
+               static u16 toggle = 0xaaaa;
+
+               writew(toggle, wdog_base + WDOG_WSR);
+               toggle ^= 0xffff;
+       }
+}
+#endif
+
 u32 get_cpu_rev(void)
 {
 #ifdef CONFIG_MX51
@@ -72,7 +89,7 @@ u32 get_cpu_rev(void)
 }
 
 #if defined(CONFIG_FEC_MXC)
-void imx_get_mac_from_fuse(int dev_id, unsigned char *mac)
+static void __imx_get_mac_from_fuse(int dev_id, unsigned char *mac)
 {
        int i;
        struct iim_regs *iim = (struct iim_regs *)IMX_IIM_BASE;
@@ -83,6 +100,10 @@ void imx_get_mac_from_fuse(int dev_id, unsigned char *mac)
        for (i = 0; i < 6; i++)
                mac[i] = readl(&fuse->mac_addr[i]) & 0xff;
 }
+
+void imx_get_mac_from_fuse(int dev_id, unsigned char *mac)
+       __attribute__((weak, alias("__imx_get_mac_from_fuse")));
+
 #endif
 
 void set_chipselect_size(int const cs_size)
@@ -115,3 +136,11 @@ void set_chipselect_size(int const cs_size)
 
        writel(reg, &iomuxc_regs->gpr1);
 }
+
+void enable_caches(void)
+{
+#ifndef CONFIG_SYS_DCACHE_OFF
+       /* Enable D-cache. I-cache is already enabled in start.S */
+       dcache_enable();
+#endif
+}
index ef98563ff7639a3895e5dc00acd9cc30bb3c6772..52d5dc4d90b9614a3156dd822a28b4c15c05cdb2 100644 (file)
@@ -24,8 +24,9 @@
 #include <asm/io.h>
 #include <asm/errno.h>
 #include <asm/arch/imx-regs.h>
-#include <asm/arch/ccm_regs.h>
+#include <asm/arch/crm_regs.h>
 #include <asm/arch/clock.h>
+#include <asm/arch/sys_proto.h>
 
 enum pll_clocks {
        PLL_SYS,        /* System PLL */
@@ -34,7 +35,7 @@ enum pll_clocks {
        PLL_ENET,       /* ENET PLL */
 };
 
-struct imx_ccm_reg *imx_ccm = (struct imx_ccm_reg *)CCM_BASE_ADDR;
+struct mxc_ccm_reg *imx_ccm = (struct mxc_ccm_reg *)CCM_BASE_ADDR;
 
 void enable_usboh3_clk(unsigned char enable)
 {
@@ -92,7 +93,7 @@ static u32 get_mcu_main_clk(void)
        return freq / (reg + 1);
 }
 
-static u32 get_periph_clk(void)
+u32 get_periph_clk(void)
 {
        u32 reg, freq = 0;
 
@@ -139,18 +140,6 @@ static u32 get_periph_clk(void)
        return freq;
 }
 
-
-static u32 get_ahb_clk(void)
-{
-       u32 reg, ahb_podf;
-
-       reg = __raw_readl(&imx_ccm->cbcdr);
-       reg &= MXC_CCM_CBCDR_AHB_PODF_MASK;
-       ahb_podf = reg >> MXC_CCM_CBCDR_AHB_PODF_OFFSET;
-
-       return get_periph_clk() / (ahb_podf + 1);
-}
-
 static u32 get_ipg_clk(void)
 {
        u32 reg, ipg_podf;
@@ -303,6 +292,37 @@ u32 imx_get_fecclk(void)
        return decode_pll(PLL_ENET, CONFIG_SYS_MX6_HCLK);
 }
 
+int enable_sata_clock(void)
+{
+       u32 reg = 0;
+       s32 timeout = 100000;
+       struct mxc_ccm_reg *const imx_ccm
+               = (struct mxc_ccm_reg *) CCM_BASE_ADDR;
+
+       /* Enable sata clock */
+       reg = readl(&imx_ccm->CCGR5); /* CCGR5 */
+       reg |= MXC_CCM_CCGR5_CG2_MASK;
+       writel(reg, &imx_ccm->CCGR5);
+
+       /* Enable PLLs */
+       reg = readl(&imx_ccm->analog_pll_enet);
+       reg &= ~BM_ANADIG_PLL_SYS_POWERDOWN;
+       writel(reg, &imx_ccm->analog_pll_enet);
+       reg |= BM_ANADIG_PLL_SYS_ENABLE;
+       while (timeout--) {
+               if (readl(&imx_ccm->analog_pll_enet) & BM_ANADIG_PLL_SYS_LOCK)
+                       break;
+       }
+       if (timeout <= 0)
+               return -EIO;
+       reg &= ~BM_ANADIG_PLL_SYS_BYPASS;
+       writel(reg, &imx_ccm->analog_pll_enet);
+       reg |= BM_ANADIG_PLL_ENET_ENABLE_SATA;
+       writel(reg, &imx_ccm->analog_pll_enet);
+
+       return 0 ;
+}
+
 unsigned int mxc_get_clock(enum mxc_clock clk)
 {
        switch (clk) {
index 1864356d0bf7b54265a42442f74a3baf756028f2..acadef221c8e845873c56563be1a20385aeda964 100644 (file)
@@ -18,7 +18,8 @@
  */
 .section ".text.init", "x"
 
-.globl lowlevel_init
-lowlevel_init:
+#include <linux/linkage.h>
 
+ENTRY(lowlevel_init)
        mov pc, lr
+ENDPROC(lowlevel_init)
index 543b2cc6d8a7bbdfea138e13144463eeb11269e6..90f208809ba62a1ccd4db22f86d26791311c553a 100644 (file)
@@ -77,10 +77,40 @@ void init_aips(void)
        writel(0x00000000, &aips2->opacr4);
 }
 
+/*
+ * Set the VDDSOC
+ *
+ * Mask out the REG_CORE[22:18] bits (REG2_TRIG) and set
+ * them to the specified millivolt level.
+ * Possible values are from 0.725V to 1.450V in steps of
+ * 0.025V (25mV).
+ */
+void set_vddsoc(u32 mv)
+{
+       struct anatop_regs *anatop = (struct anatop_regs *)ANATOP_BASE_ADDR;
+       u32 val, reg = readl(&anatop->reg_core);
+
+       if (mv < 725)
+               val = 0x00;     /* Power gated off */
+       else if (mv > 1450)
+               val = 0x1F;     /* Power FET switched full on. No regulation */
+       else
+               val = (mv - 700) / 25;
+
+       /*
+        * Mask out the REG_CORE[22:18] bits (REG2_TRIG)
+        * and set them to the calculated value (0.7V + val * 0.25V)
+        */
+       reg = (reg & ~(0x1F << 18)) | (val << 18);
+       writel(reg, &anatop->reg_core);
+}
+
 int arch_cpu_init(void)
 {
        init_aips();
 
+       set_vddsoc(1200);       /* Set VDDSOC to 1.2V */
+
        return 0;
 }
 #endif
index f211f7670c6ab936fb72264f647b80c0254b8df1..44ca6829a8a1fea01e071011de01b2bcb43005e1 100644 (file)
@@ -35,11 +35,11 @@ struct omap_boot_parameters boot_params __attribute__ ((section(".data")));
  * We would not typically need to save these parameters in regular
  * U-Boot. This is needed only in SPL at the moment.
  */
-u32 omap_bootmode = MMCSD_MODE_FAT;
+u32 omap_bootmode __attribute__ ((section(".data"))) = MMCSD_MODE_UNDEFINED;
 
 u32 omap_boot_device(void)
 {
-       return (u32) (boot_params.omap_bootdevice);
+       return boot_params.omap_bootdevice;
 }
 
 u32 omap_boot_mode(void)
index db509c92951cd2ca3dcdd659e54949e135e02d63..63a6da9d5b07c3e896dcc65d42964da0dd93fa21 100644 (file)
@@ -114,9 +114,9 @@ static void do_lpddr2_init(u32 base, u32 cs)
 static void lpddr2_init(u32 base, const struct emif_regs *regs)
 {
        struct emif_reg_struct *emif = (struct emif_reg_struct *)base;
-       u32 *ext_phy_ctrl_base = 0;
-       u32 *emif_ext_phy_ctrl_base = 0;
-       u32 i = 0;
+       u32 *ext_phy_ctrl_base;
+       u32 *emif_ext_phy_ctrl_base;
+       u32 i;
 
        /* Not NVM */
        clrbits_le32(&emif->emif_lpddr2_nvm_config, EMIF_REG_CS1NVMEN_MASK);
@@ -134,8 +134,8 @@ static void lpddr2_init(u32 base, const struct emif_regs *regs)
        writel(regs->sdram_config_init, &emif->emif_sdram_config);
        writel(regs->emif_ddr_phy_ctlr_1, &emif->emif_ddr_phy_ctrl_1);
 
-       ext_phy_ctrl_base = (u32 *) &(regs->emif_ddr_ext_phy_ctrl_1);
-       emif_ext_phy_ctrl_base = (u32 *) &(emif->emif_ddr_ext_phy_ctrl_1);
+       ext_phy_ctrl_base = &regs->emif_ddr_ext_phy_ctrl_1;
+       emif_ext_phy_ctrl_base = &emif->emif_ddr_ext_phy_ctrl_1;
 
        if (omap_revision() >= OMAP5430_ES1_0) {
                /* Configure external phy control timing registers */
index 10e766980554a568f46665c6eea32090c1272ce1..cf71ab444382c7179982eb02a44ab798c6a397a0 100644 (file)
@@ -202,16 +202,6 @@ int checkboard(void)
        return 0;
 }
 
-/*
-* This function is called by start_armboot. You can reliably use static
-* data. Any boot-time function that require static data should be
-* called from here
-*/
-int arch_cpu_init(void)
-{
-       return 0;
-}
-
 /*
  *  get_device_type(): tell if GP/HS/EMU/TST
  */
index 35f38acf5d09c83cba4b0bc04f62124950584055..087aebb84b6b5aa69364041951305e81dcb6c4a1 100644 (file)
@@ -27,9 +27,9 @@
  */
 
 #include <asm/arch/omap.h>
+#include <linux/linkage.h>
 
-.global save_boot_params
-save_boot_params:
+ENTRY(save_boot_params)
        /*
         * See if the rom code passed pointer is valid:
         * It is not valid if it is not in non-secure SRAM
@@ -38,7 +38,7 @@ save_boot_params:
         */
        ldr     r2, =NON_SECURE_SRAM_START
        cmp     r2, r0
-       bgt     1f
+       bge     1f
        ldr     r2, =NON_SECURE_SRAM_END
        cmp     r2, r0
        blt     1f
@@ -53,12 +53,11 @@ save_boot_params:
        str     r0, [r1]
 #ifdef CONFIG_SPL_BUILD
        /* Store the boot device in omap_boot_device */
-       ldrb    r2, [r0, #BOOT_DEVICE_OFFSET]   @ r1 <- value of boot device
+       ldrb    r2, [r0, #BOOT_DEVICE_OFFSET]   @ r2 <- value of boot device
        and     r2, #BOOT_DEVICE_MASK
-       ldr     r3, =boot_params
-       strb    r2, [r3, #BOOT_DEVICE_OFFSET]   @ omap_boot_device <- r1
+       strb    r2, [r1, #BOOT_DEVICE_OFFSET]   @ omap_boot_device <- r2
 
-       /* boot mode is passed only for devices that can raw/fat mode */
+       /* boot mode is passed only for devices that can do raw/fat mode */
        cmp     r2, #2
        blt     2f
        cmp     r2, #7
@@ -69,17 +68,15 @@ save_boot_params:
        ldr     r2, [r2, #BOOT_MODE_OFFSET]     @ get the boot mode
        ldr     r3, =omap_bootmode
        str     r2, [r3]
-#endif
 2:
+#endif
        ldrb    r2, [r0, #CH_FLAGS_OFFSET]
-       ldr     r3, =boot_params
-       strb    r2, [r3, #CH_FLAGS_OFFSET]
+       strb    r2, [r1, #CH_FLAGS_OFFSET]
 1:
        bx      lr
+ENDPROC(save_boot_params)
 
-
-.globl lowlevel_init
-lowlevel_init:
+ENTRY(lowlevel_init)
        /*
         * Setup a temporary stack
         */
@@ -95,12 +92,13 @@ lowlevel_init:
         */
        bl      s_init
        pop     {ip, pc}
+ENDPROC(lowlevel_init)
 
-.globl set_pl310_ctrl_reg
-set_pl310_ctrl_reg:
+ENTRY(set_pl310_ctrl_reg)
        PUSH    {r4-r11, lr}    @ save registers - ROM code may pollute
                                @ our registers
        LDR     r12, =0x102     @ Set PL310 control register - value in R0
        .word   0xe1600070      @ SMC #0 - hand assembled because -march=armv5
                                @ call ROM Code API to set control register
        POP     {r4-r11, pc}
+ENDPROC(set_pl310_ctrl_reg)
similarity index 70%
rename from arch/arm/cpu/armv7/omap-common/reset.S
rename to arch/arm/cpu/armv7/omap-common/reset.c
index 838b1221ee274761b0bca7c8c9af8a999c46e1c3..234e90a86831445d2dfb7e297cfd3c25d3cdca8e 100644 (file)
@@ -1,6 +1,11 @@
 /*
- * Copyright (c) 2009 Samsung Electronics.
- * Minkyu Kang <mk7.kang@samsung.com>
+ *
+ * Common layer for reset related functionality of OMAP based socs.
+ *
+ * (C) Copyright 2012
+ * Texas Instruments, <www.ti.com>
+ *
+ * Sricharan R <r.sricharan@ti.com>
  *
  * See file CREDITS for list of people who contributed to this
  * project.
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  * MA 02111-1307 USA
  */
-
 #include <config.h>
+#include <asm/io.h>
+#include <asm/arch/cpu.h>
+#include <linux/compiler.h>
 
-.global reset_cpu
-reset_cpu:
-       ldr     r1, rstctl                      @ get addr for global reset
-                                               @ reg
-       ldr     r3, rstbit                      @ sw reset bit
-       str     r3, [r1]                        @ force reset
-       mov     r0, r0
-_loop_forever:
-       b       _loop_forever
-rstctl:
-       .word   PRM_RSTCTRL
-rstbit:
-       .word   PRM_RSTCTRL_RESET
+void __weak reset_cpu(unsigned long ignored)
+{
+       writel(PRM_RSTCTRL_RESET, PRM_RSTCTRL);
+}
index 47663f7edf443d352530bee94e1690399057f938..1c3ca93eeae6d02874a62c5d0cc67f852338c691 100644 (file)
@@ -31,6 +31,7 @@
 #include <asm/utils.h>
 #include <asm/arch/sys_proto.h>
 #include <asm/omap_common.h>
+#include <watchdog.h>
 
 #define BUF_SIZE 1024
 
@@ -51,22 +52,23 @@ void spl_ymodem_load_image(void)
        ulong store_addr = ~0;
        ulong addr = 0;
 
+loop:
        info.mode = xyzModem_ymodem;
        ret = xyzModem_stream_open(&info, &err);
-
-       if (!ret) {
-               while ((res =
-                       xyzModem_stream_read(buf, BUF_SIZE, &err)) > 0) {
+       if (ret == 0) {
+               while ((res = xyzModem_stream_read(buf, BUF_SIZE, &err)) > 0) {
+                       WATCHDOG_RESET();
                        if (addr == 0)
                                spl_parse_image_header((struct image_header *)buf);
                        store_addr = addr + spl_image.load_addr;
                        size += res;
                        addr += res;
-                       memcpy((char *)(store_addr), buf, res);
+                       memcpy((char *)store_addr, buf, res);
                }
        } else {
-               printf("spl: ymodem err - %s\n", xyzModem_error(err));
-               hang();
+               WATCHDOG_RESET();
+               printf("Retrying...\n");
+               goto loop;
        }
 
        xyzModem_stream_close(&err);
index 9f8bc934470bf2129459e1d6934997f98ca93218..c4c0e6e59ff1c5f079c597b7f4a2dca95fe7f002 100644 (file)
@@ -33,7 +33,9 @@
  */
 
 #include <common.h>
+#include <div64.h>
 #include <asm/io.h>
+#include <asm/arch/cpu.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -43,22 +45,66 @@ static struct gptimer *timer_base = (struct gptimer *)CONFIG_SYS_TIMERBASE;
  * Nothing really to do with interrupts, just starts up a counter.
  */
 
+#if CONFIG_SYS_PTV > 7
+#error Invalid CONFIG_SYS_PTV value
+#elif CONFIG_SYS_PTV >= 0
 #define TIMER_CLOCK            (V_SCLK / (2 << CONFIG_SYS_PTV))
-#define TIMER_OVERFLOW_VAL     0xffffffff
+#define TCLR_VAL               ((CONFIG_SYS_PTV << 2) | TCLR_PRE | TCLR_AR | TCLR_ST)
+#else
+#define TIMER_CLOCK            V_SCLK
+#define TCLR_VAL               (TCLR_AR | TCLR_ST)
+#endif
 #define TIMER_LOAD_VAL         0
 
+#if TIMER_CLOCK < CONFIG_SYS_HZ
+#error TIMER_CLOCK must be > CONFIG_SYS_HZ
+#endif
+
+/*
+ * Start timer so that it will overflow 15 sec after boot,
+ * to catch misbehaving timer code early on!
+*/
+#define TIMER_START            (-time_to_tick(15 * CONFIG_SYS_HZ))
+
+static inline unsigned long tick_to_time(unsigned long tick)
+{
+       return tick / (TIMER_CLOCK / CONFIG_SYS_HZ);
+}
+
+static inline unsigned long time_to_tick(unsigned long time)
+{
+       return time * (TIMER_CLOCK / CONFIG_SYS_HZ);
+}
+
+static inline unsigned long us_to_ticks(unsigned long usec)
+{
+       return usec * (TIMER_CLOCK / CONFIG_SYS_HZ / 1000);
+}
+
 int timer_init(void)
 {
+#if !defined(CONFIG_SPL) || defined(CONFIG_SPL_BUILD)
+       /* Reset the Timer */
+       writel(0x2, &timer_base->tscir);
+
+       /* Wait until the reset is done */
+       while (readl(&timer_base->tiocp_cfg) & 1)
+               ;
+
+       /* preload the counter to make overflow occur early */
+       writel(TIMER_START, &timer_base->tldr);
+       writel(~0, &timer_base->ttgr);
+
        /* start the counter ticking up, reload value on overflow */
        writel(TIMER_LOAD_VAL, &timer_base->tldr);
        /* enable timer */
-       writel((CONFIG_SYS_PTV << 2) | TCLR_PRE | TCLR_AR | TCLR_ST,
-               &timer_base->tclr);
-
-       /* reset time, capture current incrementer value time */
-       gd->lastinc = readl(&timer_base->tcrr) / (TIMER_CLOCK / CONFIG_SYS_HZ);
-       gd->tbl = 0;            /* start "advancing" time stamp from 0 */
-
+       writel(TCLR_VAL, &timer_base->tclr);
+#endif
+#ifndef CONFIG_SPL_BUILD
+       gd->lastinc = -30 * TIMER_CLOCK;
+       gd->tbl = TIMER_START;
+       gd->timer_rate_hz = TIMER_CLOCK;
+#endif
        return 0;
 }
 
@@ -67,38 +113,29 @@ int timer_init(void)
  */
 ulong get_timer(ulong base)
 {
-       return get_timer_masked() - base;
+       return tick_to_time(get_ticks() - time_to_tick(base));
 }
 
 /* delay x useconds */
 void __udelay(unsigned long usec)
 {
-       long tmo = usec * (TIMER_CLOCK / 1000) / 1000;
-       unsigned long now, last = readl(&timer_base->tcrr);
-
-       while (tmo > 0) {
-               now = readl(&timer_base->tcrr);
-               if (last > now) /* count up timer overflow */
-                       tmo -= TIMER_OVERFLOW_VAL - last + now + 1;
-               else
-                       tmo -= now - last;
-               last = now;
-       }
+       unsigned long start = readl(&timer_base->tcrr);
+       unsigned long ticks = us_to_ticks(usec);
+
+       if (usec == 0)
+               return;
+
+       if (ticks == 0)
+               ticks++;
+
+       while (readl(&timer_base->tcrr) - start < ticks)
+               /* NOP */ ;
 }
 
 ulong get_timer_masked(void)
 {
        /* current tick value */
-       ulong now = readl(&timer_base->tcrr) / (TIMER_CLOCK / CONFIG_SYS_HZ);
-
-       if (now >= gd->lastinc) /* normal mode (non roll) */
-               /* move stamp fordward with absoulte diff ticks */
-               gd->tbl += (now - gd->lastinc);
-       else    /* we have rollover of incrementer */
-               gd->tbl += ((TIMER_LOAD_VAL / (TIMER_CLOCK / CONFIG_SYS_HZ))
-                            - gd->lastinc) + now;
-       gd->lastinc = now;
-       return gd->tbl;
+       return tick_to_time(get_ticks());
 }
 
 /*
@@ -107,7 +144,12 @@ ulong get_timer_masked(void)
  */
 unsigned long long get_ticks(void)
 {
-       return get_timer(0);
+       ulong now = readl(&timer_base->tcrr);
+       ulong inc = now - gd->lastinc;
+
+       gd->tbl += inc;
+       gd->lastinc = now;
+       return gd->tbl;
 }
 
 /*
@@ -116,5 +158,5 @@ unsigned long long get_ticks(void)
  */
 ulong get_tbclk(void)
 {
-       return CONFIG_SYS_HZ;
+       return gd->timer_rate_hz;
 }
index 1fee57436493e89a3bfc3ec8f980b64a0eb0c5cf..f2e52e9ce1b7c639269bf1cbce5cc2060596860f 100644 (file)
@@ -41,6 +41,7 @@
 #include <asm/arch/gpio.h>
 #include <asm/omap_common.h>
 #include <i2c.h>
+#include <linux/compiler.h>
 
 /* Declarations */
 extern omap3_sysinfo sysinfo;
@@ -244,6 +245,17 @@ void s_init(void)
                mem_init();
 }
 
+/*
+ * Routine: misc_init_r
+ * Description: A basic misc_init_r that just displays the die ID
+ */
+int __weak misc_init_r(void)
+{
+       dieid_num_r();
+
+       return 0;
+}
+
 /******************************************************************************
  * Routine: wait_for_command_complete
  * Description: Wait for posting to finish on watchdog
index 567817e0ec3b062c3ee2a66c901b14ab1b44a8b2..09c51f62aad0cf1f64b3ba171a235f546bdc139d 100644 (file)
@@ -572,6 +572,22 @@ void prcm_init(void)
        }
 
        if (get_cpu_family() == CPU_OMAP36XX) {
+               /*
+                * In warm reset conditions on OMAP36xx/AM/DM37xx
+                * the rom code incorrectly sets the DPLL4 clock
+                * input divider to /6.5. Section 3.5.3.3.3.2.1 of
+                * the AM/DM37x TRM explains that the /6.5 divider
+                * is used only when the input clock is 13MHz.
+                *
+                * If the part is in this cpu family *and* the input
+                * clock *is not* 13 MHz, then reset the DPLL4 clock
+                * input divider to /1 as it should never set to /6.5
+                * in this case.
+                */
+               if (sys_clkin_sel != 1) /* 13 MHz */
+                       /* Bit 8: DPLL4_CLKINP_DIV */
+                       sr32(&prm_base->clksrc_ctrl, 8, 1, 0);
+
                /* Unlock MPU DPLL (slows things down, and needed later) */
                sr32(&prcm_base->clken_pll_mpu, 0, 3, PLL_LOW_POWER_BYPASS);
                wait_on_value(ST_MPU_CLK, 0, &prcm_base->idlest_pll_mpu,
index c42c5ddcc9ffac518e4bf064e0934cd57ad82448..ebf69fa17d13cc2c67e09d8bc943e2824432d716 100644 (file)
 #include <version.h>
 #include <asm/arch/mem.h>
 #include <asm/arch/clocks_omap3.h>
+#include <linux/linkage.h>
 
 _TEXT_BASE:
        .word   CONFIG_SYS_TEXT_BASE    /* sdram load addr from config.mk */
 
 #ifdef CONFIG_SPL_BUILD
-.global save_boot_params
-save_boot_params:
+ENTRY(save_boot_params)
        ldr     r4, =omap3_boot_device
        ldr     r5, [r0, #0x4]
        and     r5, r5, #0xff
        str     r5, [r4]
        bx      lr
+ENDPROC(save_boot_params)
 #endif
 
-.global omap3_gp_romcode_call
-omap3_gp_romcode_call:
+ENTRY(omap3_gp_romcode_call)
        PUSH {r4-r12, lr} @ Save all registers from ROM code!
        MOV r12, r0     @ Copy the Service ID in R12
        MOV r0, r1      @ Copy parameter to R0
@@ -55,6 +55,7 @@ omap3_gp_romcode_call:
        .word   0xe1600070      @ SMC #0 to enter monitor - hand assembled
                                @ because we use -march=armv5
        POP {r4-r12, pc}
+ENDPROC(omap3_gp_romcode_call)
 
 /*
  * Funtion for making PPA HAL API calls in secure devices
@@ -62,8 +63,7 @@ omap3_gp_romcode_call:
  *     R0 - Service ID
  *     R1 - paramer list
  */
-.global do_omap3_emu_romcode_call
-do_omap3_emu_romcode_call:
+ENTRY(do_omap3_emu_romcode_call)
        PUSH {r4-r12, lr} @ Save all registers from ROM code!
        MOV r12, r0     @ Copy the Secure Service ID in R12
        MOV r3, r1      @ Copy the pointer to va_list in R3
@@ -76,14 +76,14 @@ do_omap3_emu_romcode_call:
        .word   0xe1600071      @ SMC #1 to call PPA service - hand assembled
                                @ because we use -march=armv5
        POP {r4-r12, pc}
+ENDPROC(do_omap3_emu_romcode_call)
 
 #if !defined(CONFIG_SYS_NAND_BOOT) && !defined(CONFIG_SYS_NAND_BOOT)
 /**************************************************************************
  * cpy_clk_code: relocates clock code into SRAM where its safer to execute
  * R1 = SRAM destination address.
  *************************************************************************/
-.global cpy_clk_code
- cpy_clk_code:
+ENTRY(cpy_clk_code)
        /* Copy DPLL code into SRAM */
        adr     r0, go_to_speed         /* get addr of clock setting code */
        mov     r2, #384                /* r2 size to copy (div by 32 bytes) */
@@ -95,6 +95,7 @@ next2:
        cmp     r0, r2                  /* until source end address [r2] */
        bne     next2
        mov     pc, lr                  /* back to caller */
+ENDPROC(cpy_clk_code)
 
 /* ***************************************************************************
  *  go_to_speed: -Moves to bypass, -Commits clock dividers, -puts dpll at speed
@@ -109,8 +110,7 @@ next2:
  *        L3 when its not in self refresh seems bad for it.  Normally, this
  *       code runs from flash before SDR is init so that should be ok.
  ****************************************************************************/
-.global go_to_speed
- go_to_speed:
+ENTRY(go_to_speed)
        stmfd sp!, {r4 - r6}
 
        /* move into fast relock bypass */
@@ -171,6 +171,7 @@ wait2:
        nop
        ldmfd   sp!, {r4 - r6}
        mov     pc, lr          /* back to caller, locked */
+ENDPROC(go_to_speed)
 
 _go_to_speed: .word go_to_speed
 
@@ -211,8 +212,7 @@ pll_div_val5:
 
 #endif
 
-.globl lowlevel_init
-lowlevel_init:
+ENTRY(lowlevel_init)
        ldr     sp, SRAM_STACK
        str     ip, [sp]        /* stash old link register */
        mov     ip, lr          /* save link reg across call */
@@ -230,6 +230,7 @@ lowlevel_init:
 
        /* back to arch calling code */
        mov     pc, lr
+ENDPROC(lowlevel_init)
 
        /* the literal pools origin */
        .ltorg
@@ -480,22 +481,22 @@ per_36x_dpll_param:
 .word 26000,    432,   12,     9,      16,     9,     4,      3,      1
 .word 38400,    360,   15,     9,      16,     5,     4,      3,      1
 
-.globl get_36x_mpu_dpll_param
-get_36x_mpu_dpll_param:
+ENTRY(get_36x_mpu_dpll_param)
        adr     r0, mpu_36x_dpll_param
        mov     pc, lr
+ENDPROC(get_36x_mpu_dpll_param)
 
-.globl get_36x_iva_dpll_param
-get_36x_iva_dpll_param:
+ENTRY(get_36x_iva_dpll_param)
        adr     r0, iva_36x_dpll_param
        mov     pc, lr
+ENDPROC(get_36x_iva_dpll_param)
 
-.globl get_36x_core_dpll_param
-get_36x_core_dpll_param:
+ENTRY(get_36x_core_dpll_param)
        adr     r0, core_36x_dpll_param
        mov     pc, lr
+ENDPROC(get_36x_core_dpll_param)
 
-.globl get_36x_per_dpll_param
-get_36x_per_dpll_param:
+ENTRY(get_36x_per_dpll_param)
        adr     r0, per_36x_dpll_param
        mov     pc, lr
+ENDPROC(get_36x_per_dpll_param)
index dd694c409f827eaf24f856369816bd89533ade4e..c568951a91a27b752127960883f8792816de735d 100644 (file)
@@ -46,8 +46,6 @@
 #define puts(s)
 #endif
 
-#define abs(x) (((x) < 0) ? ((x)*-1) : (x))
-
 struct omap4_prcm_regs *const prcm = (struct omap4_prcm_regs *)0x4A004100;
 
 const u32 sys_clk_array[8] = {
@@ -378,7 +376,6 @@ void enable_basic_clocks(void)
                &prcm->cm_l4per_gptimer2_clkctrl,
                &prcm->cm_wkup_wdtimer2_clkctrl,
                &prcm->cm_l4per_uart3_clkctrl,
-               &prcm->cm_l3init_fsusb_clkctrl,
                &prcm->cm_l3init_hsusbhost_clkctrl,
                0
        };
@@ -455,10 +452,6 @@ void enable_non_essential_clocks(void)
        };
 
        u32 *const clk_modules_hw_auto_non_essential[] = {
-               &prcm->cm_mpu_m3_mpu_m3_clkctrl,
-               &prcm->cm_ivahd_ivahd_clkctrl,
-               &prcm->cm_ivahd_sl2_clkctrl,
-               &prcm->cm_dsp_dsp_clkctrl,
                &prcm->cm_l3_2_gpmc_clkctrl,
                &prcm->cm_l3instr_l3_3_clkctrl,
                &prcm->cm_l3instr_l3_instr_clkctrl,
@@ -505,7 +498,6 @@ void enable_non_essential_clocks(void)
                &prcm->cm_dss_dss_clkctrl,
                &prcm->cm_sgx_sgx_clkctrl,
                &prcm->cm_l3init_hsusbhost_clkctrl,
-               &prcm->cm_l3init_fsusb_clkctrl,
                0
        };
 
index 7da7075e1d7c5780e924a98476ebfd94f25c9569..d01cc81333ba62c6b35e38959fbdfe10229cc4e4 100644 (file)
@@ -160,3 +160,17 @@ void init_omap_revision(void)
                *omap_si_rev = OMAP5430_SILICON_ID_INVALID;
        }
 }
+
+void reset_cpu(ulong ignored)
+{
+       u32 omap_rev = omap_revision();
+
+       /*
+        * WARM reset is not functional in case of OMAP5430 ES1.0 soc.
+        * So use cold reset in case instead.
+        */
+       if (omap_rev == OMAP5430_ES1_0)
+               writel(PRM_RSTCTRL_RESET << 0x1, PRM_RSTCTRL);
+       else
+               writel(PRM_RSTCTRL_RESET, PRM_RSTCTRL);
+}
index c7d62212bde17f7200075804c4b8444b1d5ca177..000192c254c356f04755aac3d785afffd07e43a7 100644 (file)
 
 .align 5
 
+#include <linux/linkage.h>
+
 #ifndef CONFIG_SYS_L2CACHE_OFF
-.global v7_outer_cache_enable
-v7_outer_cache_enable:
+ENTRY(v7_outer_cache_enable)
        push    {r0, r1, r2, lr}
        mrc     15, 0, r3, cr1, cr0, 1
        orr     r3, r3, #2
        mcr     15, 0, r3, cr1, cr0, 1
        pop     {r1, r2, r3, pc}
+ENDPROC(v7_outer_cache_enable)
 
-.global v7_outer_cache_disable
-v7_outer_cache_disable:
+ENTRY(v7_outer_cache_disable)
        push    {r0, r1, r2, lr}
        mrc     15, 0, r3, cr1, cr0, 1
        bic     r3, r3, #2
        mcr     15, 0, r3, cr1, cr0, 1
        pop     {r1, r2, r3, pc}
+ENDPROC(v7_outer_cache_disable)
 #endif
index 70fa146cf38501b76db5daa9c9caa7e6700f743f..c7a41d03d23f04cec72b296a190690cef3d8e990 100644 (file)
  */
 
 #include <asm/arch/cpu.h>
+#include <linux/linkage.h>
 
 #define S5PC100_SWRESET                        0xE0200000
 #define S5PC110_SWRESET                        0xE0102000
 
-.globl reset_cpu
-reset_cpu:
+ENTRY(reset_cpu)
        ldr     r1, =S5PC100_PRO_ID
        ldr     r2, [r1]
        ldr     r4, =0x00010000
@@ -45,3 +45,4 @@ reset_cpu:
        str     r2, [r1]
 _loop_forever:
        b       _loop_forever
+ENDPROC(reset_cpu)
index ef08a55abc2c6189062c9d87c36d5d042139017c..ebb7c5cee011987e818e47547057a31ae1d77906 100644 (file)
@@ -33,6 +33,7 @@
 #include <config.h>
 #include <version.h>
 #include <asm/system.h>
+#include <linux/linkage.h>
 
 .globl _start
 _start: b      reset
@@ -80,7 +81,11 @@ _end_vect:
 
 .globl _TEXT_BASE
 _TEXT_BASE:
+#ifndef CONFIG_SPL_BUILD
        .word   CONFIG_SYS_TEXT_BASE
+#else
+       .word   CONFIG_SPL_TEXT_BASE
+#endif
 
 /*
  * These are defined in the board-specific linker script.
@@ -160,7 +165,7 @@ reset:
 call_board_init_f:
        ldr     sp, =(CONFIG_SYS_INIT_SP_ADDR)
        bic     sp, sp, #7 /* 8-byte alignment for ABI compliance */
-       ldr     r0,=0x00000000
+       ldr     r0, =0x00000000
        bl      board_init_f
 
 /*------------------------------------------------------------------------------*/
@@ -172,8 +177,7 @@ call_board_init_f:
  * after relocating the monitor code.
  *
  */
-       .globl  relocate_code
-relocate_code:
+ENTRY(relocate_code)
        mov     r4, r0  /* save addr_sp */
        mov     r5, r1  /* save addr of gd */
        mov     r6, r2  /* save addr of destination */
@@ -183,8 +187,7 @@ stack_setup:
        mov     sp, r4
 
        adr     r0, _start
-       cmp     r0, r6
-       moveq   r9, #0          /* no relocation. relocation offset(r9) = 0 */
+       subs    r9, r6, r0
        beq     clear_bss               /* skip relocation */
        mov     r1, r6                  /* r1 <- scratch for copy_loop */
        ldr     r3, _image_copy_end_ofs
@@ -200,7 +203,7 @@ copy_loop:
        /*
         * fix .rel.dyn relocations
         */
-       ldr     r0, _TEXT_BASE          /* r0 <- Text base */
+       adr     r0, _start              /* r0 <- beginning of code */
        sub     r9, r6, r0              /* r9 <- relocation offset */
        ldr     r10, _dynsym_start_ofs  /* r10 <- sym table ofs */
        add     r10, r10, r0            /* r10 <- sym table in FLASH */
@@ -259,11 +262,14 @@ clear_bss:
 #endif
        mov     r2, #0x00000000         /* clear                            */
 
-clbss_l:str    r2, [r0]                /* clear loop...                    */
+clbss_l:
+       cmp     r0, r1                  /* clear loop... */
+       bhs     clbss_e                 /* if reached end of bss, exit */
+       str     r2, [r0]
        add     r0, r0, #4
-       cmp     r0, r1
-       bne     clbss_l
-
+       b       clbss_l
+clbss_e:
+       
 /*
  * We are done. Do not return, instead branch to second part of board
  * initialization, now running from RAM.
@@ -289,6 +295,7 @@ jump_2_ram:
 
 _board_init_r_ofs:
        .word board_init_r - _start
+ENDPROC(relocate_code)
 
 /*************************************************************************
  *
@@ -298,8 +305,7 @@ _board_init_r_ofs:
  * CONFIG_SYS_ICACHE_OFF is defined.
  *
  *************************************************************************/
-.globl cpu_init_cp15
-cpu_init_cp15:
+ENTRY(cpu_init_cp15)
        /*
         * Invalidate L1 I/D
         */
@@ -325,7 +331,7 @@ cpu_init_cp15:
 #endif
        mcr     p15, 0, r0, c1, c0, 0
        mov     pc, lr                  @ back to my caller
-
+ENDPROC(cpu_init_cp15)
 
 #ifndef CONFIG_SKIP_LOWLEVEL_INIT
 /*************************************************************************
@@ -336,17 +342,18 @@ cpu_init_cp15:
  * setup memory timing
  *
  *************************************************************************/
-cpu_init_crit:
+ENTRY(cpu_init_crit)
        /*
         * Jump to board specific initialization...
         * The Mask ROM will have already initialized
         * basic memory. Go here to bump up clock rate and handle
         * wake up conditions.
         */
-       mov     ip, lr                  @ persevere link reg across call
+       mov     ip, lr                  @ preserve link reg across call
        bl      lowlevel_init           @ go setup pll,mux,memory
        mov     lr, ip                  @ restore link
        mov     pc, lr                  @ back to my caller
+ENDPROC(cpu_init_crit)
 #endif
 
 #ifndef CONFIG_SPL_BUILD
index e9ac6c9a710906a512611c2545b44875eeb73556..08c4137a342203d7eef3075939113864359116fb 100644 (file)
@@ -27,6 +27,7 @@
 # flags for any startup files it might use.
 CFLAGS_arch/arm/cpu/armv7/tegra2/ap20.o += -march=armv4t
 CFLAGS_arch/arm/cpu/armv7/tegra2/clock.o += -march=armv4t
+CFLAGS_arch/arm/cpu/armv7/tegra2/warmboot_avp.o += -march=armv4t
 
 include $(TOPDIR)/config.mk
 
@@ -34,7 +35,10 @@ LIB  =  $(obj)lib$(SOC).o
 
 SOBJS  := lowlevel_init.o
 COBJS-y        := ap20.o board.o clock.o funcmux.o pinmux.o sys_info.o timer.o
+COBJS-$(CONFIG_TEGRA_CLOCK_SCALING) += emc.o
+COBJS-$(CONFIG_TEGRA_PMU) += pmu.o
 COBJS-$(CONFIG_USB_EHCI_TEGRA) += usb.o
+COBJS-$(CONFIG_TEGRA2_LP0) += crypto.o warmboot.o warmboot_avp.o
 
 COBJS  := $(COBJS-y)
 SRCS   := $(SOBJS:.o=.S) $(COBJS:.o=.c)
index b749821e5abaa07048c49867f1aa09654bd8fab5..698bfd0e171c94c5ad63f77e4d9b80f7406a7c39 100644 (file)
 * MA 02111-1307 USA
 */
 
-#include "ap20.h"
 #include <asm/io.h>
 #include <asm/arch/tegra2.h>
+#include <asm/arch/ap20.h>
 #include <asm/arch/clk_rst.h>
 #include <asm/arch/clock.h>
+#include <asm/arch/fuse.h>
+#include <asm/arch/gp_padctrl.h>
 #include <asm/arch/pmc.h>
 #include <asm/arch/pinmux.h>
 #include <asm/arch/scu.h>
+#include <asm/arch/warmboot.h>
 #include <common.h>
 
+int tegra_get_chip_type(void)
+{
+       struct apb_misc_gp_ctlr *gp;
+       struct fuse_regs *fuse = (struct fuse_regs *)TEGRA2_FUSE_BASE;
+       uint tegra_sku_id, rev;
+
+       /*
+        * This is undocumented, Chip ID is bits 15:8 of the register
+        * APB_MISC + 0x804, and has value 0x20 for Tegra20, 0x30 for
+        * Tegra30
+        */
+       gp = (struct apb_misc_gp_ctlr *)TEGRA2_APB_MISC_GP_BASE;
+       rev = (readl(&gp->hidrev) & HIDREV_CHIPID_MASK) >> HIDREV_CHIPID_SHIFT;
+
+       tegra_sku_id = readl(&fuse->sku_info) & 0xff;
+
+       switch (rev) {
+       case CHIPID_TEGRA2:
+               switch (tegra_sku_id) {
+               case SKU_ID_T20:
+                       return TEGRA_SOC_T20;
+               case SKU_ID_T25SE:
+               case SKU_ID_AP25:
+               case SKU_ID_T25:
+               case SKU_ID_AP25E:
+               case SKU_ID_T25E:
+                       return TEGRA_SOC_T25;
+               }
+               break;
+       }
+       /* unknown sku id */
+       return TEGRA_SOC_UNKNOWN;
+}
+
 /* Returns 1 if the current CPU executing is a Cortex-A9, else 0 */
 static int ap20_cpu_is_cortexa9(void)
 {
@@ -286,6 +323,11 @@ void init_pmc_scratch(void)
 
        /* ODMDATA is for kernel use to determine RAM size, LP config, etc. */
        writel(CONFIG_SYS_BOARD_ODMDATA, &pmc->pmc_scratch20);
+
+#ifdef CONFIG_TEGRA2_LP0
+       /* save Sdram params to PMC 2, 4, and 24 for WB0 */
+       warmboot_save_sdram_params();
+#endif
 }
 
 void tegra2_start(void)
index a797e6fc30d9a5a4eebdc89f7bbd8525be5dc3cd..a50b1b988a23d1ced00f360ba1d1c03b17006ca7 100644 (file)
 
 #include <common.h>
 #include <asm/io.h>
-#include "ap20.h"
+#include <asm/arch/ap20.h>
 #include <asm/arch/clock.h>
 #include <asm/arch/funcmux.h>
+#include <asm/arch/pmc.h>
 #include <asm/arch/sys_proto.h>
 #include <asm/arch/tegra2.h>
-#include <asm/arch/pmc.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
index 39376ab86ef90434dacfa5b1cae8e44fabbc987e..ccad3516398cd9d781902d3c5c070c8c0490a66d 100644 (file)
@@ -410,6 +410,16 @@ enum clock_osc_freq clock_get_osc_freq(void)
        return (reg & OSC_FREQ_MASK) >> OSC_FREQ_SHIFT;
 }
 
+int clock_get_osc_bypass(void)
+{
+       struct clk_rst_ctlr *clkrst =
+                       (struct clk_rst_ctlr *)NV_PA_CLK_RST_BASE;
+       u32 reg;
+
+       reg = readl(&clkrst->crc_osc_ctrl);
+       return (reg & OSC_XOBP_MASK) >> OSC_XOBP_SHIFT;
+}
+
 /* Returns a pointer to the registers of the given pll */
 static struct clk_pll *get_pll(enum clock_id clkid)
 {
@@ -420,6 +430,28 @@ static struct clk_pll *get_pll(enum clock_id clkid)
        return &clkrst->crc_pll[clkid];
 }
 
+int clock_ll_read_pll(enum clock_id clkid, u32 *divm, u32 *divn,
+               u32 *divp, u32 *cpcon, u32 *lfcon)
+{
+       struct clk_pll *pll = get_pll(clkid);
+       u32 data;
+
+       assert(clkid != CLOCK_ID_USB);
+
+       /* Safety check, adds to code size but is small */
+       if (!clock_id_isvalid(clkid) || clkid == CLOCK_ID_USB)
+               return -1;
+       data = readl(&pll->pll_base);
+       *divm = (data & PLL_DIVM_MASK) >> PLL_DIVM_SHIFT;
+       *divn = (data & PLL_DIVN_MASK) >> PLL_DIVN_SHIFT;
+       *divp = (data & PLL_DIVP_MASK) >> PLL_DIVP_SHIFT;
+       data = readl(&pll->pll_misc);
+       *cpcon = (data & PLL_CPCON_MASK) >> PLL_CPCON_SHIFT;
+       *lfcon = (data & PLL_LFCON_MASK) >> PLL_LFCON_SHIFT;
+
+       return 0;
+}
+
 unsigned long clock_start_pll(enum clock_id clkid, u32 divm, u32 divn,
                u32 divp, u32 cpcon, u32 lfcon)
 {
@@ -1027,7 +1059,10 @@ void clock_early_init(void)
                clock_set_rate(CLOCK_ID_CGENERAL, 600, 26, 0, 8);
                break;
 
-       case CLOCK_OSC_FREQ_13_0:
+       case CLOCK_OSC_FREQ_13_0: /* OSC is 13Mhz */
+               clock_set_rate(CLOCK_ID_PERIPH, 432, 13, 1, 8);
+               clock_set_rate(CLOCK_ID_CGENERAL, 600, 13, 0, 8);
+               break;
        case CLOCK_OSC_FREQ_19_2:
        default:
                /*
diff --git a/arch/arm/cpu/armv7/tegra2/crypto.c b/arch/arm/cpu/armv7/tegra2/crypto.c
new file mode 100644 (file)
index 0000000..5f0b240
--- /dev/null
@@ -0,0 +1,230 @@
+/*
+ * Copyright (c) 2011 The Chromium OS Authors.
+ * (C) Copyright 2010 - 2011 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/errno.h>
+#include "crypto.h"
+#include "aes.h"
+
+static u8 zero_key[16];
+
+#define AES_CMAC_CONST_RB 0x87  /* from RFC 4493, Figure 2.2 */
+
+enum security_op {
+       SECURITY_SIGN           = 1 << 0,       /* Sign the data */
+       SECURITY_ENCRYPT        = 1 << 1,       /* Encrypt the data */
+};
+
+static void debug_print_vector(char *name, u32 num_bytes, u8 *data)
+{
+       u32 i;
+
+       debug("%s [%d] @0x%08x", name, num_bytes, (u32)data);
+       for (i = 0; i < num_bytes; i++) {
+               if (i % 16 == 0)
+                       debug(" = ");
+               debug("%02x", data[i]);
+               if ((i+1) % 16 != 0)
+                       debug(" ");
+       }
+       debug("\n");
+}
+
+/**
+ * Apply chain data to the destination using EOR
+ *
+ * Each array is of length AES_AES_KEY_LENGTH.
+ *
+ * \param cbc_chain_data       Chain data
+ * \param src                  Source data
+ * \param dst                  Destination data, which is modified here
+ */
+static void apply_cbc_chain_data(u8 *cbc_chain_data, u8 *src, u8 *dst)
+{
+       int i;
+
+       for (i = 0; i < 16; i++)
+               *dst++ = *src++ ^ *cbc_chain_data++;
+}
+
+/**
+ * Encrypt some data with AES.
+ *
+ * \param key_schedule         Expanded key to use
+ * \param src                  Source data to encrypt
+ * \param dst                  Destination buffer
+ * \param num_aes_blocks       Number of AES blocks to encrypt
+ */
+static void encrypt_object(u8 *key_schedule, u8 *src, u8 *dst,
+                          u32 num_aes_blocks)
+{
+       u8 tmp_data[AES_KEY_LENGTH];
+       u8 *cbc_chain_data;
+       u32 i;
+
+       cbc_chain_data = zero_key;      /* Convenient array of 0's for IV */
+
+       for (i = 0; i < num_aes_blocks; i++) {
+               debug("encrypt_object: block %d of %d\n", i, num_aes_blocks);
+               debug_print_vector("AES Src", AES_KEY_LENGTH, src);
+
+               /* Apply the chain data */
+               apply_cbc_chain_data(cbc_chain_data, src, tmp_data);
+               debug_print_vector("AES Xor", AES_KEY_LENGTH, tmp_data);
+
+               /* encrypt the AES block */
+               aes_encrypt(tmp_data, key_schedule, dst);
+               debug_print_vector("AES Dst", AES_KEY_LENGTH, dst);
+
+               /* Update pointers for next loop. */
+               cbc_chain_data = dst;
+               src += AES_KEY_LENGTH;
+               dst += AES_KEY_LENGTH;
+       }
+}
+
+/**
+ * Shift a vector left by one bit
+ *
+ * \param in   Input vector
+ * \param out  Output vector
+ * \param size Length of vector in bytes
+ */
+static void left_shift_vector(u8 *in, u8 *out, int size)
+{
+       int carry = 0;
+       int i;
+
+       for (i = size - 1; i >= 0; i--) {
+               out[i] = (in[i] << 1) | carry;
+               carry = in[i] >> 7;     /* get most significant bit */
+       }
+}
+
+/**
+ * Sign a block of data, putting the result into dst.
+ *
+ * \param key                  Input AES key, length AES_KEY_LENGTH
+ * \param key_schedule         Expanded key to use
+ * \param src                  Source data of length 'num_aes_blocks' blocks
+ * \param dst                  Destination buffer, length AES_KEY_LENGTH
+ * \param num_aes_blocks       Number of AES blocks to encrypt
+ */
+static void sign_object(u8 *key, u8 *key_schedule, u8 *src, u8 *dst,
+                       u32 num_aes_blocks)
+{
+       u8 tmp_data[AES_KEY_LENGTH];
+       u8 left[AES_KEY_LENGTH];
+       u8 k1[AES_KEY_LENGTH];
+       u8 *cbc_chain_data;
+       unsigned i;
+
+       cbc_chain_data = zero_key;      /* Convenient array of 0's for IV */
+
+       /* compute K1 constant needed by AES-CMAC calculation */
+       for (i = 0; i < AES_KEY_LENGTH; i++)
+               tmp_data[i] = 0;
+
+       encrypt_object(key_schedule, tmp_data, left, 1);
+       debug_print_vector("AES(key, nonce)", AES_KEY_LENGTH, left);
+
+       left_shift_vector(left, k1, sizeof(left));
+       debug_print_vector("L", AES_KEY_LENGTH, left);
+
+       if ((left[0] >> 7) != 0) /* get MSB of L */
+               k1[AES_KEY_LENGTH-1] ^= AES_CMAC_CONST_RB;
+       debug_print_vector("K1", AES_KEY_LENGTH, k1);
+
+       /* compute the AES-CMAC value */
+       for (i = 0; i < num_aes_blocks; i++) {
+               /* Apply the chain data */
+               apply_cbc_chain_data(cbc_chain_data, src, tmp_data);
+
+               /* for the final block, XOR K1 into the IV */
+               if (i == num_aes_blocks - 1)
+                       apply_cbc_chain_data(tmp_data, k1, tmp_data);
+
+               /* encrypt the AES block */
+               aes_encrypt(tmp_data, key_schedule, dst);
+
+               debug("sign_obj: block %d of %d\n", i, num_aes_blocks);
+               debug_print_vector("AES-CMAC Src", AES_KEY_LENGTH, src);
+               debug_print_vector("AES-CMAC Xor", AES_KEY_LENGTH, tmp_data);
+               debug_print_vector("AES-CMAC Dst", AES_KEY_LENGTH, dst);
+
+               /* Update pointers for next loop. */
+               cbc_chain_data = dst;
+               src += AES_KEY_LENGTH;
+       }
+
+       debug_print_vector("AES-CMAC Hash", AES_KEY_LENGTH, dst);
+}
+
+/**
+ * Encrypt and sign a block of data (depending on security mode).
+ *
+ * \param key          Input AES key, length AES_KEY_LENGTH
+ * \param oper         Security operations mask to perform (enum security_op)
+ * \param src          Source data
+ * \param length       Size of source data
+ * \param sig_dst      Destination address for signature, AES_KEY_LENGTH bytes
+ */
+static int encrypt_and_sign(u8 *key, enum security_op oper, u8 *src,
+                           u32 length, u8 *sig_dst)
+{
+       u32 num_aes_blocks;
+       u8 key_schedule[AES_EXPAND_KEY_LENGTH];
+
+       debug("encrypt_and_sign: length = %d\n", length);
+       debug_print_vector("AES key", AES_KEY_LENGTH, key);
+
+       /*
+        * The only need for a key is for signing/checksum purposes, so
+        * if not encrypting, expand a key of 0s.
+        */
+       aes_expand_key(oper & SECURITY_ENCRYPT ? key : zero_key, key_schedule);
+
+       num_aes_blocks = (length + AES_KEY_LENGTH - 1) / AES_KEY_LENGTH;
+
+       if (oper & SECURITY_ENCRYPT) {
+               /* Perform this in place, resulting in src being encrypted. */
+               debug("encrypt_and_sign: begin encryption\n");
+               encrypt_object(key_schedule, src, src, num_aes_blocks);
+               debug("encrypt_and_sign: end encryption\n");
+       }
+
+       if (oper & SECURITY_SIGN) {
+               /* encrypt the data, overwriting the result in signature. */
+               debug("encrypt_and_sign: begin signing\n");
+               sign_object(key, key_schedule, src, sig_dst, num_aes_blocks);
+               debug("encrypt_and_sign: end signing\n");
+       }
+
+       return 0;
+}
+
+int sign_data_block(u8 *source, unsigned length, u8 *signature)
+{
+       return encrypt_and_sign(zero_key, SECURITY_SIGN, source,
+                               length, signature);
+}
diff --git a/arch/arm/cpu/armv7/tegra2/crypto.h b/arch/arm/cpu/armv7/tegra2/crypto.h
new file mode 100644 (file)
index 0000000..aff67e7
--- /dev/null
@@ -0,0 +1,36 @@
+/*
+ * Copyright (c) 2011 The Chromium OS Authors.
+ * (C) Copyright 2010 - 2011 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 _CRYPTO_H_
+#define _CRYPTO_H_
+
+/**
+ * Sign a block of data
+ *
+ * \param source       Source data
+ * \param length       Size of source data
+ * \param signature    Destination address for signature, AES_KEY_LENGTH bytes
+ */
+int sign_data_block(u8 *source, unsigned length, u8 *signature);
+
+#endif /* #ifndef _CRYPTO_H_ */
diff --git a/arch/arm/cpu/armv7/tegra2/emc.c b/arch/arm/cpu/armv7/tegra2/emc.c
new file mode 100644 (file)
index 0000000..c0e5c56
--- /dev/null
@@ -0,0 +1,286 @@
+/*
+ * 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/ap20.h>
+#include <asm/arch/apb_misc.h>
+#include <asm/arch/clock.h>
+#include <asm/arch/emc.h>
+#include <asm/arch/tegra2.h>
+
+/*
+ * The EMC registers have shadow registers.  When the EMC clock is updated
+ * in the clock controller, the shadow registers are copied to the active
+ * registers, allowing glitchless memory bus frequency changes.
+ * This function updates the shadow registers for a new clock frequency,
+ * and relies on the clock lock on the emc clock to avoid races between
+ * multiple frequency changes
+ */
+
+/*
+ * This table defines the ordering of the registers provided to
+ * tegra_set_mmc()
+ * TODO: Convert to fdt version once available
+ */
+static const unsigned long emc_reg_addr[TEGRA_EMC_NUM_REGS] = {
+       0x2c,   /* RC */
+       0x30,   /* RFC */
+       0x34,   /* RAS */
+       0x38,   /* RP */
+       0x3c,   /* R2W */
+       0x40,   /* W2R */
+       0x44,   /* R2P */
+       0x48,   /* W2P */
+       0x4c,   /* RD_RCD */
+       0x50,   /* WR_RCD */
+       0x54,   /* RRD */
+       0x58,   /* REXT */
+       0x5c,   /* WDV */
+       0x60,   /* QUSE */
+       0x64,   /* QRST */
+       0x68,   /* QSAFE */
+       0x6c,   /* RDV */
+       0x70,   /* REFRESH */
+       0x74,   /* BURST_REFRESH_NUM */
+       0x78,   /* PDEX2WR */
+       0x7c,   /* PDEX2RD */
+       0x80,   /* PCHG2PDEN */
+       0x84,   /* ACT2PDEN */
+       0x88,   /* AR2PDEN */
+       0x8c,   /* RW2PDEN */
+       0x90,   /* TXSR */
+       0x94,   /* TCKE */
+       0x98,   /* TFAW */
+       0x9c,   /* TRPAB */
+       0xa0,   /* TCLKSTABLE */
+       0xa4,   /* TCLKSTOP */
+       0xa8,   /* TREFBW */
+       0xac,   /* QUSE_EXTRA */
+       0x114,  /* FBIO_CFG6 */
+       0xb0,   /* ODT_WRITE */
+       0xb4,   /* ODT_READ */
+       0x104,  /* FBIO_CFG5 */
+       0x2bc,  /* CFG_DIG_DLL */
+       0x2c0,  /* DLL_XFORM_DQS */
+       0x2c4,  /* DLL_XFORM_QUSE */
+       0x2e0,  /* ZCAL_REF_CNT */
+       0x2e4,  /* ZCAL_WAIT_CNT */
+       0x2a8,  /* AUTO_CAL_INTERVAL */
+       0x2d0,  /* CFG_CLKTRIM_0 */
+       0x2d4,  /* CFG_CLKTRIM_1 */
+       0x2d8,  /* CFG_CLKTRIM_2 */
+};
+
+struct emc_ctlr *emc_get_controller(const void *blob)
+{
+       fdt_addr_t addr;
+       int node;
+
+       node = fdtdec_next_compatible(blob, 0, COMPAT_NVIDIA_TEGRA20_EMC);
+       if (node > 0) {
+               addr = fdtdec_get_addr(blob, node, "reg");
+               if (addr != FDT_ADDR_T_NONE)
+                       return (struct emc_ctlr *)addr;
+       }
+       return NULL;
+}
+
+/* Error codes we use */
+enum {
+       ERR_NO_EMC_NODE = -10,
+       ERR_NO_EMC_REG,
+       ERR_NO_FREQ,
+       ERR_FREQ_NOT_FOUND,
+       ERR_BAD_REGS,
+       ERR_NO_RAM_CODE,
+       ERR_RAM_CODE_NOT_FOUND,
+};
+
+/**
+ * Find EMC tables for the given ram code.
+ *
+ * The tegra EMC binding has two options, one using the ram code and one not.
+ * We detect which is in use by looking for the nvidia,use-ram-code property.
+ * If this is not present, then the EMC tables are directly below 'node',
+ * otherwise we select the correct emc-tables subnode based on the 'ram_code'
+ * value.
+ *
+ * @param blob         Device tree blob
+ * @param node         EMC node (nvidia,tegra20-emc compatible string)
+ * @param ram_code     RAM code to select (0-3, or -1 if unknown)
+ * @return 0 if ok, otherwise a -ve ERR_ code (see enum above)
+ */
+static int find_emc_tables(const void *blob, int node, int ram_code)
+{
+       int need_ram_code;
+       int depth;
+       int offset;
+
+       /* If we are using RAM codes, scan through the tables for our code */
+       need_ram_code = fdtdec_get_bool(blob, node, "nvidia,use-ram-code");
+       if (!need_ram_code)
+               return node;
+       if (ram_code == -1) {
+               debug("%s: RAM code required but not supplied\n", __func__);
+               return ERR_NO_RAM_CODE;
+       }
+
+       offset = node;
+       depth = 0;
+       do {
+               /*
+                * Sadly there is no compatible string so we cannot use
+                * fdtdec_next_compatible_subnode().
+                */
+               offset = fdt_next_node(blob, offset, &depth);
+               if (depth <= 0)
+                       break;
+
+               /* Make sure this is a direct subnode */
+               if (depth != 1)
+                       continue;
+               if (strcmp("emc-tables", fdt_get_name(blob, offset, NULL)))
+                       continue;
+
+               if (fdtdec_get_int(blob, offset, "nvidia,ram-code", -1)
+                               == ram_code)
+                       return offset;
+       } while (1);
+
+       debug("%s: Could not find tables for RAM code %d\n", __func__,
+             ram_code);
+       return ERR_RAM_CODE_NOT_FOUND;
+}
+
+/**
+ * Decode the EMC node of the device tree, returning a pointer to the emc
+ * controller and the table to be used for the given rate.
+ *
+ * @param blob Device tree blob
+ * @param rate Clock speed of memory controller in Hz (=2x memory bus rate)
+ * @param emcp Returns address of EMC controller registers
+ * @param tablep Returns pointer to table to program into EMC. There are
+ *             TEGRA_EMC_NUM_REGS entries, destined for offsets as per the
+ *             emc_reg_addr array.
+ * @return 0 if ok, otherwise a -ve error code which will allow someone to
+ * figure out roughly what went wrong by looking at this code.
+ */
+static int decode_emc(const void *blob, unsigned rate, struct emc_ctlr **emcp,
+                     const u32 **tablep)
+{
+       struct apb_misc_pp_ctlr *pp =
+               (struct apb_misc_pp_ctlr *)NV_PA_APB_MISC_BASE;
+       int ram_code;
+       int depth;
+       int node;
+
+       ram_code = (readl(&pp->strapping_opt_a) & RAM_CODE_MASK)
+                       >> RAM_CODE_SHIFT;
+       /*
+        * The EMC clock rate is twice the bus rate, and the bus rate is
+        * measured in kHz
+        */
+       rate = rate / 2 / 1000;
+
+       node = fdtdec_next_compatible(blob, 0, COMPAT_NVIDIA_TEGRA20_EMC);
+       if (node < 0) {
+               debug("%s: No EMC node found in FDT\n", __func__);
+               return ERR_NO_EMC_NODE;
+       }
+       *emcp = (struct emc_ctlr *)fdtdec_get_addr(blob, node, "reg");
+       if (*emcp == (struct emc_ctlr *)FDT_ADDR_T_NONE) {
+               debug("%s: No EMC node reg property\n", __func__);
+               return ERR_NO_EMC_REG;
+       }
+
+       /* Work out the parent node which contains our EMC tables */
+       node = find_emc_tables(blob, node, ram_code & 3);
+       if (node < 0)
+               return node;
+
+       depth = 0;
+       for (;;) {
+               int node_rate;
+
+               node = fdtdec_next_compatible_subnode(blob, node,
+                               COMPAT_NVIDIA_TEGRA20_EMC_TABLE, &depth);
+               if (node < 0)
+                       break;
+               node_rate = fdtdec_get_int(blob, node, "clock-frequency", -1);
+               if (node_rate == -1) {
+                       debug("%s: Missing clock-frequency\n", __func__);
+                       return ERR_NO_FREQ; /* we expect this property */
+               }
+
+               if (node_rate == rate)
+                       break;
+       }
+       if (node < 0) {
+               debug("%s: No node found for clock frequency %d\n", __func__,
+                     rate);
+               return ERR_FREQ_NOT_FOUND;
+       }
+
+       *tablep = fdtdec_locate_array(blob, node, "nvidia,emc-registers",
+                                     TEGRA_EMC_NUM_REGS);
+       if (!*tablep) {
+               debug("%s: node '%s' array missing / wrong size\n", __func__,
+                     fdt_get_name(blob, node, NULL));
+               return ERR_BAD_REGS;
+       }
+
+       /* All seems well */
+       return 0;
+}
+
+int tegra_set_emc(const void *blob, unsigned rate)
+{
+       struct emc_ctlr *emc;
+       const u32 *table;
+       int err, i;
+
+       err = decode_emc(blob, rate, &emc, &table);
+       if (err) {
+               debug("Warning: no valid EMC (%d), memory timings unset\n",
+                      err);
+               return err;
+       }
+
+       debug("%s: Table found, setting EMC values as follows:\n", __func__);
+       for (i = 0; i < TEGRA_EMC_NUM_REGS; i++) {
+               u32 value = fdt32_to_cpu(table[i]);
+               u32 addr = (uintptr_t)emc + emc_reg_addr[i];
+
+               debug("   %#x: %#x\n", addr, value);
+               writel(value, addr);
+       }
+
+       /* trigger emc with new settings */
+       clock_adjust_periph_pll_div(PERIPH_ID_EMC, CLOCK_ID_MEMORY,
+                               clock_get_rate(CLOCK_ID_MEMORY), NULL);
+       debug("EMC clock set to %lu\n",
+             clock_get_periph_rate(PERIPH_ID_EMC, CLOCK_ID_MEMORY));
+
+       return 0;
+}
index c1d2dfec5f02dea5c8631ca9222c3d7be13cb486..0ef775302188a57b178e9f0ed78a3310fcc4b38e 100644 (file)
@@ -169,6 +169,22 @@ int funcmux_select(enum periph_id id, int config)
                }
                break;
 
+       case PERIPH_ID_KBC:
+               if (config == FUNCMUX_DEFAULT) {
+                       enum pmux_pingrp grp[] = {PINGRP_KBCA, PINGRP_KBCB,
+                               PINGRP_KBCC, PINGRP_KBCD, PINGRP_KBCE,
+                               PINGRP_KBCF};
+                       int i;
+
+                       for (i = 0; i < ARRAY_SIZE(grp); i++) {
+                               pinmux_tristate_disable(grp[i]);
+                               pinmux_set_func(grp[i], PMUX_FUNC_KBC);
+                               pinmux_set_pullupdown(grp[i], PMUX_PULL_UP);
+                       }
+
+                       break;
+               }
+
        default:
                debug("%s: invalid periph_id %d", __func__, id);
                return -1;
index 6b866476ce7ba746a64b62ca8ddb079211f41831..d117f23a622f549c5b24652668d295276a0e196f 100644 (file)
 
 #include <config.h>
 #include <version.h>
+#include <linux/linkage.h>
 
        .align  5
-.global reset_cpu
-reset_cpu:
+ENTRY(reset_cpu)
        ldr     r1, rstctl                      @ get addr for global reset
                                                @ reg
        ldr     r3, [r1]
@@ -39,3 +39,4 @@ _loop_forever:
        b       _loop_forever
 rstctl:
        .word   PRM_RSTCTRL
+ENDPROC(reset_cpu)
diff --git a/arch/arm/cpu/armv7/tegra2/pmu.c b/arch/arm/cpu/armv7/tegra2/pmu.c
new file mode 100644 (file)
index 0000000..4673802
--- /dev/null
@@ -0,0 +1,70 @@
+/*
+ * Copyright (c) 2011 The Chromium OS Authors.
+ * (C) Copyright 2010,2011 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 <tps6586x.h>
+#include <asm/io.h>
+#include <asm/arch/ap20.h>
+#include <asm/arch/tegra2.h>
+#include <asm/arch/tegra_i2c.h>
+#include <asm/arch/sys_proto.h>
+
+#define VDD_CORE_NOMINAL_T25   0x17    /* 1.3v */
+#define VDD_CPU_NOMINAL_T25    0x10    /* 1.125v */
+
+#define VDD_CORE_NOMINAL_T20   0x16    /* 1.275v */
+#define VDD_CPU_NOMINAL_T20    0x0f    /* 1.1v */
+
+#define VDD_RELATION           0x02    /*  50mv */
+#define VDD_TRANSITION_STEP    0x06    /* 150mv */
+#define VDD_TRANSITION_RATE    0x06    /* 3.52mv/us */
+
+int pmu_set_nominal(void)
+{
+       int core, cpu, bus;
+
+       /* by default, the table has been filled with T25 settings */
+       switch (tegra_get_chip_type()) {
+       case TEGRA_SOC_T20:
+               core = VDD_CORE_NOMINAL_T20;
+               cpu = VDD_CPU_NOMINAL_T20;
+               break;
+       case TEGRA_SOC_T25:
+               core = VDD_CORE_NOMINAL_T25;
+               cpu = VDD_CPU_NOMINAL_T25;
+               break;
+       default:
+               debug("%s: Unknown chip type\n", __func__);
+               return -1;
+       }
+
+       bus = tegra_i2c_get_dvc_bus_num();
+       if (bus == -1) {
+               debug("%s: Cannot find DVC I2C bus\n", __func__);
+               return -1;
+       }
+       tps6586x_init(bus);
+       tps6586x_set_pwm_mode(TPS6586X_PWM_SM1);
+       return tps6586x_adjust_sm0_sm1(core, cpu, VDD_TRANSITION_STEP,
+                               VDD_TRANSITION_RATE, VDD_RELATION);
+}
diff --git a/arch/arm/cpu/armv7/tegra2/warmboot.c b/arch/arm/cpu/armv7/tegra2/warmboot.c
new file mode 100644 (file)
index 0000000..25d8968
--- /dev/null
@@ -0,0 +1,386 @@
+/*
+ * (C) Copyright 2010 - 2011
+ * 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/errno.h>
+#include <asm/arch/ap20.h>
+#include <asm/arch/clk_rst.h>
+#include <asm/arch/clock.h>
+#include <asm/arch/pmc.h>
+#include <asm/arch/pinmux.h>
+#include <asm/arch/tegra2.h>
+#include <asm/arch/fuse.h>
+#include <asm/arch/emc.h>
+#include <asm/arch/gp_padctrl.h>
+#include <asm/arch/warmboot.h>
+#include <asm/arch/sdram_param.h>
+
+DECLARE_GLOBAL_DATA_PTR;
+
+#ifndef CONFIG_TEGRA_CLOCK_SCALING
+#error "You must enable CONFIG_TEGRA_CLOCK_SCALING to use CONFIG_TEGRA2_LP0"
+#endif
+
+/*
+ * This is the place in SRAM where the SDRAM parameters are stored. There
+ * are 4 blocks, one for each RAM code
+ */
+#define SDRAM_PARAMS_BASE      (AP20_BASE_PA_SRAM + 0x188)
+
+/* TODO: If we later add support for the Misc GP controller, refactor this */
+union xm2cfga_reg {
+       struct {
+               u32 reserved0:2;
+               u32 hsm_en:1;
+               u32 reserved1:2;
+               u32 preemp_en:1;
+               u32 vref_en:1;
+               u32 reserved2:5;
+               u32 cal_drvdn:5;
+               u32 reserved3:3;
+               u32 cal_drvup:5;
+               u32 reserved4:3;
+               u32 cal_drvdn_slwr:2;
+               u32 cal_drvup_slwf:2;
+       };
+       u32 word;
+};
+
+union xm2cfgd_reg {
+       struct {
+               u32 reserved0:2;
+               u32 hsm_en:1;
+               u32 schmt_en:1;
+               u32 lpmd:2;
+               u32 vref_en:1;
+               u32 reserved1:5;
+               u32 cal_drvdn:5;
+               u32 reserved2:3;
+               u32 cal_drvup:5;
+               u32 reserved3:3;
+               u32 cal_drvdn_slwr:2;
+               u32 cal_drvup_slwf:2;
+       };
+       u32 word;
+};
+
+/*
+ * TODO: This register is not documented in the TRM yet. We could move this
+ * into the EMC and give it a proper interface, but not while it is
+ * undocumented.
+ */
+union fbio_spare_reg {
+       struct {
+               u32 reserved:24;
+               u32 cfg_wb0:8;
+       };
+       u32 word;
+};
+
+/* We pack the resume information into these unions for later */
+union scratch2_reg {
+       struct {
+               u32 pllm_base_divm:5;
+               u32 pllm_base_divn:10;
+               u32 pllm_base_divp:3;
+               u32 pllm_misc_lfcon:4;
+               u32 pllm_misc_cpcon:4;
+               u32 gp_xm2cfga_padctrl_preemp:1;
+               u32 gp_xm2cfgd_padctrl_schmt:1;
+               u32 osc_ctrl_xobp:1;
+               u32 memory_type:3;
+       };
+       u32 word;
+};
+
+union scratch4_reg {
+       struct {
+               u32 emc_clock_divider:8;
+               u32 pllm_stable_time:8;
+               u32 pllx_stable_time:8;
+               u32 emc_fbio_spare_cfg_wb0:8;
+       };
+       u32 word;
+};
+
+union scratch24_reg {
+       struct {
+               u32 emc_auto_cal_wait:8;
+               u32 emc_pin_program_wait:8;
+               u32 warmboot_wait:8;
+               u32 reserved:8;
+       };
+       u32 word;
+};
+
+int warmboot_save_sdram_params(void)
+{
+       u32 ram_code;
+       struct sdram_params sdram;
+       struct pmux_tri_ctlr *pmt = (struct pmux_tri_ctlr *)NV_PA_APB_MISC_BASE;
+       struct pmc_ctlr *pmc = (struct pmc_ctlr *)TEGRA2_PMC_BASE;
+       struct apb_misc_gp_ctlr *gp =
+                       (struct apb_misc_gp_ctlr *)TEGRA2_APB_MISC_GP_BASE;
+       struct emc_ctlr *emc = emc_get_controller(gd->fdt_blob);
+       union scratch2_reg scratch2;
+       union scratch4_reg scratch4;
+       union scratch24_reg scratch24;
+       union xm2cfga_reg xm2cfga;
+       union xm2cfgd_reg xm2cfgd;
+       union fbio_spare_reg fbio_spare;
+
+       /* get ram code that is used as index to array sdram_params in BCT */
+       ram_code = (readl(&pmt->pmt_strap_opt_a) >>
+                       STRAP_OPT_A_RAM_CODE_SHIFT) & 3;
+       memcpy(&sdram,
+              (char *)((struct sdram_params *)SDRAM_PARAMS_BASE + ram_code),
+              sizeof(sdram));
+
+       xm2cfga.word = readl(&gp->xm2cfga);
+       xm2cfgd.word = readl(&gp->xm2cfgd);
+
+       scratch2.word = 0;
+       scratch2.osc_ctrl_xobp = clock_get_osc_bypass();
+
+       /* Get the memory PLL settings */
+       {
+               u32 divm, divn, divp, cpcon, lfcon;
+
+               if (clock_ll_read_pll(CLOCK_ID_MEMORY, &divm, &divn, &divp,
+                                       &cpcon, &lfcon))
+                       return -1;
+               scratch2.pllm_base_divm = divm;
+               scratch2.pllm_base_divn = divn;
+               scratch2.pllm_base_divp = divp;
+               scratch2.pllm_misc_cpcon = cpcon;
+               scratch2.pllm_misc_lfcon = lfcon;
+       }
+
+       scratch2.gp_xm2cfga_padctrl_preemp = xm2cfga.preemp_en;
+       scratch2.gp_xm2cfgd_padctrl_schmt = xm2cfgd.schmt_en;
+       scratch2.memory_type = sdram.memory_type;
+       writel(scratch2.word, &pmc->pmc_scratch2);
+
+       /* collect data from various sources for pmc_scratch4 */
+       fbio_spare.word = readl(&emc->fbio_spare);
+       scratch4.word = 0;
+       scratch4.emc_fbio_spare_cfg_wb0 = fbio_spare.cfg_wb0;
+       scratch4.emc_clock_divider = sdram.emc_clock_divider;
+       scratch4.pllm_stable_time = -1;
+       scratch4.pllx_stable_time = -1;
+       writel(scratch4.word, &pmc->pmc_scratch4);
+
+       /* collect various data from sdram for pmc_scratch24 */
+       scratch24.word = 0;
+       scratch24.emc_pin_program_wait = sdram.emc_pin_program_wait;
+       scratch24.emc_auto_cal_wait = sdram.emc_auto_cal_wait;
+       scratch24.warmboot_wait = sdram.warm_boot_wait;
+       writel(scratch24.word, &pmc->pmc_scratch24);
+
+       return 0;
+}
+
+static u32 get_major_version(void)
+{
+       u32 major_id;
+       struct apb_misc_gp_ctlr *gp =
+               (struct apb_misc_gp_ctlr *)TEGRA2_APB_MISC_GP_BASE;
+
+       major_id = (readl(&gp->hidrev) & HIDREV_MAJORPREV_MASK) >>
+                       HIDREV_MAJORPREV_SHIFT;
+       return major_id;
+}
+
+static int is_production_mode_fuse_set(struct fuse_regs *fuse)
+{
+       return readl(&fuse->production_mode);
+}
+
+static int is_odm_production_mode_fuse_set(struct fuse_regs *fuse)
+{
+       return readl(&fuse->security_mode);
+}
+
+static int is_failure_analysis_mode(struct fuse_regs *fuse)
+{
+       return readl(&fuse->fa);
+}
+
+static int ap20_is_odm_production_mode(void)
+{
+       struct fuse_regs *fuse = (struct fuse_regs *)TEGRA2_FUSE_BASE;
+
+       if (!is_failure_analysis_mode(fuse) &&
+           is_odm_production_mode_fuse_set(fuse))
+               return 1;
+       else
+               return 0;
+}
+
+static int ap20_is_production_mode(void)
+{
+       struct fuse_regs *fuse = (struct fuse_regs *)TEGRA2_FUSE_BASE;
+
+       if (get_major_version() == 0)
+               return 1;
+
+       if (!is_failure_analysis_mode(fuse) &&
+           is_production_mode_fuse_set(fuse) &&
+           !is_odm_production_mode_fuse_set(fuse))
+               return 1;
+       else
+               return 0;
+}
+
+static enum fuse_operating_mode fuse_get_operation_mode(void)
+{
+       u32 chip_id;
+       struct apb_misc_gp_ctlr *gp =
+               (struct apb_misc_gp_ctlr *)TEGRA2_APB_MISC_GP_BASE;
+
+       chip_id = (readl(&gp->hidrev) & HIDREV_CHIPID_MASK) >>
+                       HIDREV_CHIPID_SHIFT;
+       if (chip_id == CHIPID_TEGRA2) {
+               if (ap20_is_odm_production_mode()) {
+                       printf("!! odm_production_mode is not supported !!\n");
+                       return MODE_UNDEFINED;
+               } else
+                       if (ap20_is_production_mode())
+                               return MODE_PRODUCTION;
+                       else
+                               return MODE_UNDEFINED;
+       }
+       return MODE_UNDEFINED;
+}
+
+static void determine_crypto_options(int *is_encrypted, int *is_signed,
+                                    int *use_zero_key)
+{
+       switch (fuse_get_operation_mode()) {
+       case MODE_PRODUCTION:
+               *is_encrypted = 0;
+               *is_signed = 1;
+               *use_zero_key = 1;
+               break;
+       case MODE_UNDEFINED:
+       default:
+               *is_encrypted = 0;
+               *is_signed = 0;
+               *use_zero_key  = 0;
+               break;
+       }
+}
+
+static int sign_wb_code(u32 start, u32 length, int use_zero_key)
+{
+       int err;
+       u8 *source;             /* Pointer to source */
+       u8 *hash;
+
+       /* Calculate AES block parameters. */
+       source = (u8 *)(start + offsetof(struct wb_header, random_aes_block));
+       length -= offsetof(struct wb_header, random_aes_block);
+       hash = (u8 *)(start + offsetof(struct wb_header, hash));
+       err = sign_data_block(source, length, hash);
+
+       return err;
+}
+
+int warmboot_prepare_code(u32 seg_address, u32 seg_length)
+{
+       int err = 0;
+       u32 length;                     /* length of the signed/encrypt code */
+       struct wb_header *dst_header;   /* Pointer to dest WB header */
+       int is_encrypted;               /* Segment is encrypted */
+       int is_signed;                  /* Segment is signed */
+       int use_zero_key;               /* Use key of all zeros */
+
+       /* Determine crypto options. */
+       determine_crypto_options(&is_encrypted, &is_signed, &use_zero_key);
+
+       /* Get the actual code limits. */
+       length = roundup(((u32)wb_end - (u32)wb_start), 16);
+
+       /*
+        * The region specified by seg_address must be in SDRAM and must be
+        * nonzero in length.
+        */
+       if (seg_length == 0 || seg_address < NV_PA_SDRAM_BASE ||
+               seg_address + seg_length >= NV_PA_SDRAM_BASE + gd->ram_size) {
+               err = -EFAULT;
+               goto fail;
+       }
+
+       /* Things must be 16-byte aligned. */
+       if ((seg_length & 0xF) || (seg_address & 0xF)) {
+               err = -EINVAL;
+               goto fail;
+       }
+
+       /* Will the code fit? (destination includes wb_header + wb code) */
+       if (seg_length < (length + sizeof(struct wb_header))) {
+               err = -EINVAL;
+               goto fail;
+       }
+
+       dst_header = (struct wb_header *)seg_address;
+       memset((char *)dst_header, 0, sizeof(struct wb_header));
+
+       /* Populate the random_aes_block as requested. */
+       {
+               u32 *aes_block = (u32 *)&(dst_header->random_aes_block);
+               u32 *end = (u32 *)(((u32)aes_block) +
+                                  sizeof(dst_header->random_aes_block));
+
+               do {
+                       *aes_block++ = 0;
+               } while (aes_block < end);
+       }
+
+       /* Populate the header. */
+       dst_header->length_insecure = length + sizeof(struct wb_header);
+       dst_header->length_secure = length + sizeof(struct wb_header);
+       dst_header->destination = AP20_WB_RUN_ADDRESS;
+       dst_header->entry_point = AP20_WB_RUN_ADDRESS;
+       dst_header->code_length = length;
+
+       if (is_encrypted) {
+               printf("!!!! Encryption is not supported !!!!\n");
+               dst_header->length_insecure = 0;
+               err = -EACCES;
+               goto fail;
+       } else
+               /* copy the wb code directly following dst_header. */
+               memcpy((char *)(dst_header+1), (char *)wb_start, length);
+
+       if (is_signed)
+               err = sign_wb_code(seg_address, dst_header->length_insecure,
+                                  use_zero_key);
+
+fail:
+       if (err)
+               printf("Warning: warmboot code copy failed (error=%d)\n", err);
+
+       return err;
+}
diff --git a/arch/arm/cpu/armv7/tegra2/warmboot_avp.c b/arch/arm/cpu/armv7/tegra2/warmboot_avp.c
new file mode 100644 (file)
index 0000000..70bcd8e
--- /dev/null
@@ -0,0 +1,250 @@
+/*
+ * (C) Copyright 2010 - 2011
+ * 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/ap20.h>
+#include <asm/arch/clk_rst.h>
+#include <asm/arch/clock.h>
+#include <asm/arch/flow.h>
+#include <asm/arch/pinmux.h>
+#include <asm/arch/pmc.h>
+#include <asm/arch/tegra2.h>
+#include <asm/arch/warmboot.h>
+#include "warmboot_avp.h"
+
+#define DEBUG_RESET_CORESIGHT
+
+void wb_start(void)
+{
+       struct pmux_tri_ctlr *pmt = (struct pmux_tri_ctlr *)NV_PA_APB_MISC_BASE;
+       struct pmc_ctlr *pmc = (struct pmc_ctlr *)TEGRA2_PMC_BASE;
+       struct flow_ctlr *flow = (struct flow_ctlr *)NV_PA_FLOW_BASE;
+       struct clk_rst_ctlr *clkrst =
+                       (struct clk_rst_ctlr *)NV_PA_CLK_RST_BASE;
+       union osc_ctrl_reg osc_ctrl;
+       union pllx_base_reg pllx_base;
+       union pllx_misc_reg pllx_misc;
+       union scratch3_reg scratch3;
+       u32 reg;
+
+       /* enable JTAG & TBE */
+       writel(CONFIG_CTL_TBE | CONFIG_CTL_JTAG, &pmt->pmt_cfg_ctl);
+
+       /* Are we running where we're supposed to be? */
+       asm volatile (
+               "adr    %0, wb_start;"  /* reg: wb_start address */
+               : "=r"(reg)             /* output */
+                                       /* no input, no clobber list */
+       );
+
+       if (reg != AP20_WB_RUN_ADDRESS)
+               goto do_reset;
+
+       /* Are we running with AVP? */
+       if (readl(NV_PA_PG_UP_BASE + PG_UP_TAG_0) != PG_UP_TAG_AVP)
+               goto do_reset;
+
+#ifdef DEBUG_RESET_CORESIGHT
+       /* Assert CoreSight reset */
+       reg = readl(&clkrst->crc_rst_dev[TEGRA_DEV_U]);
+       reg |= SWR_CSITE_RST;
+       writel(reg, &clkrst->crc_rst_dev[TEGRA_DEV_U]);
+#endif
+
+       /* TODO: Set the drive strength - maybe make this a board parameter? */
+       osc_ctrl.word = readl(&clkrst->crc_osc_ctrl);
+       osc_ctrl.xofs = 4;
+       osc_ctrl.xoe = 1;
+       writel(osc_ctrl.word, &clkrst->crc_osc_ctrl);
+
+       /* Power up the CPU complex if necessary */
+       if (!(readl(&pmc->pmc_pwrgate_status) & PWRGATE_STATUS_CPU)) {
+               reg = PWRGATE_TOGGLE_PARTID_CPU | PWRGATE_TOGGLE_START;
+               writel(reg, &pmc->pmc_pwrgate_toggle);
+               while (!(readl(&pmc->pmc_pwrgate_status) & PWRGATE_STATUS_CPU))
+                       ;
+       }
+
+       /* Remove the I/O clamps from the CPU power partition. */
+       reg = readl(&pmc->pmc_remove_clamping);
+       reg |= CPU_CLMP;
+       writel(reg, &pmc->pmc_remove_clamping);
+
+       reg = EVENT_ZERO_VAL_20 | EVENT_MSEC | EVENT_MODE_STOP;
+       writel(reg, &flow->halt_cop_events);
+
+       /* Assert CPU complex reset */
+       reg = readl(&clkrst->crc_rst_dev[TEGRA_DEV_L]);
+       reg |= CPU_RST;
+       writel(reg, &clkrst->crc_rst_dev[TEGRA_DEV_L]);
+
+       /* Hold both CPUs in reset */
+       reg = CPU_CMPLX_CPURESET0 | CPU_CMPLX_CPURESET1 | CPU_CMPLX_DERESET0 |
+             CPU_CMPLX_DERESET1 | CPU_CMPLX_DBGRESET0 | CPU_CMPLX_DBGRESET1;
+       writel(reg, &clkrst->crc_cpu_cmplx_set);
+
+       /* Halt CPU1 at the flow controller for uni-processor configurations */
+       writel(EVENT_MODE_STOP, &flow->halt_cpu1_events);
+
+       /*
+        * Set the CPU reset vector. SCRATCH41 contains the physical
+        * address of the CPU-side restoration code.
+        */
+       reg = readl(&pmc->pmc_scratch41);
+       writel(reg, EXCEP_VECTOR_CPU_RESET_VECTOR);
+
+       /* Select CPU complex clock source */
+       writel(CCLK_PLLP_BURST_POLICY, &clkrst->crc_cclk_brst_pol);
+
+       /* Start the CPU0 clock and stop the CPU1 clock */
+       reg = CPU_CMPLX_CPU_BRIDGE_CLKDIV_4 | CPU_CMPLX_CPU0_CLK_STP_RUN |
+             CPU_CMPLX_CPU1_CLK_STP_STOP;
+       writel(reg, &clkrst->crc_clk_cpu_cmplx);
+
+       /* Enable the CPU complex clock */
+       reg = readl(&clkrst->crc_clk_out_enb[TEGRA_DEV_L]);
+       reg |= CLK_ENB_CPU;
+       writel(reg, &clkrst->crc_clk_out_enb[TEGRA_DEV_L]);
+
+       /* Make sure the resets were held for at least 2 microseconds */
+       reg = readl(TIMER_USEC_CNTR);
+       while (readl(TIMER_USEC_CNTR) <= (reg + 2))
+               ;
+
+#ifdef DEBUG_RESET_CORESIGHT
+       /*
+        * De-assert CoreSight reset.
+        * NOTE: We're leaving the CoreSight clock on the oscillator for
+        *      now. It will be restored to its original clock source
+        *      when the CPU-side restoration code runs.
+        */
+       reg = readl(&clkrst->crc_rst_dev[TEGRA_DEV_U]);
+       reg &= ~SWR_CSITE_RST;
+       writel(reg, &clkrst->crc_rst_dev[TEGRA_DEV_U]);
+#endif
+
+       /* Unlock the CPU CoreSight interfaces */
+       reg = 0xC5ACCE55;
+       writel(reg, CSITE_CPU_DBG0_LAR);
+       writel(reg, CSITE_CPU_DBG1_LAR);
+
+       /*
+        * Sample the microsecond timestamp again. This is the time we must
+        * use when returning from LP0 for PLL stabilization delays.
+        */
+       reg = readl(TIMER_USEC_CNTR);
+       writel(reg, &pmc->pmc_scratch1);
+
+       pllx_base.word = 0;
+       pllx_misc.word = 0;
+       scratch3.word = readl(&pmc->pmc_scratch3);
+
+       /* Get the OSC. For 19.2 MHz, use 19 to make the calculations easier */
+       reg = (readl(TIMER_USEC_CFG) & USEC_CFG_DIVISOR_MASK) + 1;
+
+       /*
+        * According to the TRM, for 19.2MHz OSC, the USEC_DIVISOR is 0x5f, and
+        * USEC_DIVIDEND is 0x04. So, if USEC_DIVISOR > 26, OSC is 19.2 MHz.
+        *
+        * reg is used to calculate the pllx freq, which is used to determine if
+        * to set dccon or not.
+        */
+       if (reg > 26)
+               reg = 19;
+
+       /* PLLX_BASE.PLLX_DIVM */
+       if (scratch3.pllx_base_divm == reg)
+               reg = 0;
+       else
+               reg = 1;
+
+       /* PLLX_BASE.PLLX_DIVN */
+       pllx_base.divn = scratch3.pllx_base_divn;
+       reg = scratch3.pllx_base_divn << reg;
+
+       /* PLLX_BASE.PLLX_DIVP */
+       pllx_base.divp = scratch3.pllx_base_divp;
+       reg = reg >> scratch3.pllx_base_divp;
+
+       pllx_base.bypass = 1;
+
+       /* PLLX_MISC_DCCON must be set for pllx frequency > 600 MHz. */
+       if (reg > 600)
+               pllx_misc.dccon = 1;
+
+       /* PLLX_MISC_LFCON */
+       pllx_misc.lfcon = scratch3.pllx_misc_lfcon;
+
+       /* PLLX_MISC_CPCON */
+       pllx_misc.cpcon = scratch3.pllx_misc_cpcon;
+
+       writel(pllx_misc.word, &clkrst->crc_pll_simple[SIMPLE_PLLX].pll_misc);
+       writel(pllx_base.word, &clkrst->crc_pll_simple[SIMPLE_PLLX].pll_base);
+
+       pllx_base.enable = 1;
+       writel(pllx_base.word, &clkrst->crc_pll_simple[SIMPLE_PLLX].pll_base);
+       pllx_base.bypass = 0;
+       writel(pllx_base.word, &clkrst->crc_pll_simple[SIMPLE_PLLX].pll_base);
+
+       writel(0, flow->halt_cpu_events);
+
+       reg = CPU_CMPLX_CPURESET0 | CPU_CMPLX_DBGRESET0 | CPU_CMPLX_DERESET0;
+       writel(reg, &clkrst->crc_cpu_cmplx_clr);
+
+       reg = PLLM_OUT1_RSTN_RESET_DISABLE | PLLM_OUT1_CLKEN_ENABLE |
+             PLLM_OUT1_RATIO_VAL_8;
+       writel(reg, &clkrst->crc_pll[CLOCK_ID_MEMORY].pll_out);
+
+       reg = SCLK_SWAKE_FIQ_SRC_PLLM_OUT1 | SCLK_SWAKE_IRQ_SRC_PLLM_OUT1 |
+             SCLK_SWAKE_RUN_SRC_PLLM_OUT1 | SCLK_SWAKE_IDLE_SRC_PLLM_OUT1 |
+             SCLK_SYS_STATE_IDLE;
+       writel(reg, &clkrst->crc_sclk_brst_pol);
+
+       /* avp_resume: no return after the write */
+       reg = readl(&clkrst->crc_rst_dev[TEGRA_DEV_L]);
+       reg &= ~CPU_RST;
+       writel(reg, &clkrst->crc_rst_dev[TEGRA_DEV_L]);
+
+       /* avp_halt: */
+avp_halt:
+       reg = EVENT_MODE_STOP | EVENT_JTAG;
+       writel(reg, flow->halt_cop_events);
+       goto avp_halt;
+
+do_reset:
+       /*
+        * Execution comes here if something goes wrong. The chip is reset and
+        * a cold boot is performed.
+        */
+       writel(SWR_TRIG_SYS_RST, &clkrst->crc_rst_dev[TEGRA_DEV_L]);
+       goto do_reset;
+}
+
+/*
+ * wb_end() is a dummy function, and must be directly following wb_start(),
+ * and is used to calculate the size of wb_start().
+ */
+void wb_end(void)
+{
+}
diff --git a/arch/arm/cpu/armv7/tegra2/warmboot_avp.h b/arch/arm/cpu/armv7/tegra2/warmboot_avp.h
new file mode 100644 (file)
index 0000000..4b71c07
--- /dev/null
@@ -0,0 +1,81 @@
+/*
+ * (C) Copyright 2010, 2011
+ * 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 _WARMBOOT_AVP_H_
+#define _WARMBOOT_AVP_H_
+
+#define TEGRA_DEV_L                    0
+#define TEGRA_DEV_H                    1
+#define TEGRA_DEV_U                    2
+
+#define SIMPLE_PLLX                    (CLOCK_ID_XCPU - CLOCK_ID_FIRST_SIMPLE)
+#define SIMPLE_PLLE                    (CLOCK_ID_EPCI - CLOCK_ID_FIRST_SIMPLE)
+
+#define TIMER_USEC_CNTR                        (NV_PA_TMRUS_BASE + 0)
+#define TIMER_USEC_CFG                 (NV_PA_TMRUS_BASE + 4)
+
+#define USEC_CFG_DIVISOR_MASK          0xffff
+
+#define CONFIG_CTL_TBE                 (1 << 7)
+#define CONFIG_CTL_JTAG                        (1 << 6)
+
+#define CPU_RST                                (1 << 0)
+#define CLK_ENB_CPU                    (1 << 0)
+#define SWR_TRIG_SYS_RST               (1 << 2)
+#define SWR_CSITE_RST                  (1 << 9)
+
+#define PWRGATE_STATUS_CPU             (1 << 0)
+#define PWRGATE_TOGGLE_PARTID_CPU      (0 << 0)
+#define PWRGATE_TOGGLE_START           (1 << 8)
+
+#define CPU_CMPLX_CPU_BRIDGE_CLKDIV_4  (3 << 0)
+#define CPU_CMPLX_CPU0_CLK_STP_STOP    (1 << 8)
+#define CPU_CMPLX_CPU0_CLK_STP_RUN     (0 << 8)
+#define CPU_CMPLX_CPU1_CLK_STP_STOP    (1 << 9)
+#define CPU_CMPLX_CPU1_CLK_STP_RUN     (0 << 9)
+
+#define CPU_CMPLX_CPURESET0            (1 << 0)
+#define CPU_CMPLX_CPURESET1            (1 << 1)
+#define CPU_CMPLX_DERESET0             (1 << 4)
+#define CPU_CMPLX_DERESET1             (1 << 5)
+#define CPU_CMPLX_DBGRESET0            (1 << 12)
+#define CPU_CMPLX_DBGRESET1            (1 << 13)
+
+#define PLLM_OUT1_RSTN_RESET_DISABLE   (1 << 0)
+#define PLLM_OUT1_CLKEN_ENABLE         (1 << 1)
+#define PLLM_OUT1_RATIO_VAL_8          (8 << 8)
+
+#define SCLK_SYS_STATE_IDLE            (1 << 28)
+#define SCLK_SWAKE_FIQ_SRC_PLLM_OUT1   (7 << 12)
+#define SCLK_SWAKE_IRQ_SRC_PLLM_OUT1   (7 << 8)
+#define SCLK_SWAKE_RUN_SRC_PLLM_OUT1   (7 << 4)
+#define SCLK_SWAKE_IDLE_SRC_PLLM_OUT1  (7 << 0)
+
+#define EVENT_ZERO_VAL_20              (20 << 0)
+#define EVENT_MSEC                     (1 << 24)
+#define EVENT_JTAG                     (1 << 28)
+#define EVENT_MODE_STOP                        (2 << 29)
+
+#define CCLK_PLLP_BURST_POLICY         0x20004444
+
+#endif
index cffdfd1381f9a9fda6c27b827bc2a1b12174248f..289cfb07794aec52b1a5e91414fe9f2d9f40032a 100644 (file)
  */
 
 #include <config.h>
+#include <linux/linkage.h>
 
-.globl lowlevel_init
-lowlevel_init:
+ENTRY(lowlevel_init)
        mov     pc, lr
+ENDPROC(lowlevel_init)
 
        .align  5
-.globl reset_cpu
-reset_cpu:
+ENTRY(reset_cpu)
        ldr r0, =CFG_PRCMU_BASE
        ldr r1, =0x1
        str r1, [r0, #0x228]
 _loop_forever:
        b       _loop_forever
+ENDPROC(reset_cpu)
diff --git a/arch/arm/dts/am33xx.dtsi b/arch/arm/dts/am33xx.dtsi
new file mode 100644 (file)
index 0000000..edee62f
--- /dev/null
@@ -0,0 +1,158 @@
+/*
+ * Device Tree Source for AM33XX SoC
+ *
+ * Copyright (C) 2012 Texas Instruments Incorporated - http://www.ti.com/
+ *
+ * This file is licensed under the terms of the GNU General Public License
+ * version 2.  This program is licensed "as is" without any warranty of any
+ * kind, whether express or implied.
+ */
+
+/include/ "skeleton.dtsi"
+
+/ {
+       compatible = "ti,am33xx";
+
+       aliases {
+               serial0 = &uart0;
+               serial1 = &uart1;
+               serial2 = &uart2;
+               serial3 = &uart3;
+               serial4 = &uart4;
+               serial5 = &uart5;
+       };
+
+       cpus {
+               cpu@0 {
+                       compatible = "arm,cortex-a8";
+               };
+       };
+
+       /*
+        * The soc node represents the soc top level view. It is uses for IPs
+        * that are not memory mapped in the MPU view or for the MPU itself.
+        */
+       soc {
+               compatible = "ti,omap-infra";
+               mpu {
+                       compatible = "ti,omap3-mpu";
+                       ti,hwmods = "mpu";
+               };
+       };
+
+       /*
+        * XXX: Use a flat representation of the AM33XX interconnect.
+        * The real AM33XX interconnect network is quite complex.Since
+        * that will not bring real advantage to represent that in DT
+        * for the moment, just use a fake OCP bus entry to represent
+        * the whole bus hierarchy.
+        */
+       ocp {
+               compatible = "simple-bus";
+               #address-cells = <1>;
+               #size-cells = <1>;
+               ranges;
+               ti,hwmods = "l3_main";
+
+               intc: interrupt-controller@48200000 {
+                       compatible = "ti,omap2-intc";
+                       interrupt-controller;
+                       #interrupt-cells = <1>;
+                       ti,intc-size = <128>;
+                       reg = <0x48200000 0x1000>;
+               };
+
+               gpio0: gpio@44e07000 {
+                       compatible = "ti,omap4-gpio";
+                       ti,hwmods = "gpio1";
+                       gpio-controller;
+                       #gpio-cells = <2>;
+                       interrupt-controller;
+                       #interrupt-cells = <1>;
+               };
+
+               gpio1: gpio@4804C000 {
+                       compatible = "ti,omap4-gpio";
+                       ti,hwmods = "gpio2";
+                       gpio-controller;
+                       #gpio-cells = <2>;
+                       interrupt-controller;
+                       #interrupt-cells = <1>;
+               };
+
+               gpio2: gpio@481AC000 {
+                       compatible = "ti,omap4-gpio";
+                       ti,hwmods = "gpio3";
+                       gpio-controller;
+                       #gpio-cells = <2>;
+                       interrupt-controller;
+                       #interrupt-cells = <1>;
+               };
+
+               gpio3: gpio@481AE000 {
+                       compatible = "ti,omap4-gpio";
+                       ti,hwmods = "gpio4";
+                       gpio-controller;
+                       #gpio-cells = <2>;
+                       interrupt-controller;
+                       #interrupt-cells = <1>;
+               };
+
+               uart0: serial@44E09000 {
+                       compatible = "ti,omap3-uart";
+                       ti,hwmods = "uart1";
+                       clock-frequency = <48000000>;
+               };
+
+               uart1: serial@48022000 {
+                       compatible = "ti,omap3-uart";
+                       ti,hwmods = "uart2";
+                       clock-frequency = <48000000>;
+               };
+
+               uart2: serial@48024000 {
+                       compatible = "ti,omap3-uart";
+                       ti,hwmods = "uart3";
+                       clock-frequency = <48000000>;
+               };
+
+               uart3: serial@481A6000 {
+                       compatible = "ti,omap3-uart";
+                       ti,hwmods = "uart4";
+                       clock-frequency = <48000000>;
+               };
+
+               uart4: serial@481A8000 {
+                       compatible = "ti,omap3-uart";
+                       ti,hwmods = "uart5";
+                       clock-frequency = <48000000>;
+               };
+
+               uart5: serial@481AA000 {
+                       compatible = "ti,omap3-uart";
+                       ti,hwmods = "uart6";
+                       clock-frequency = <48000000>;
+               };
+
+               i2c0: i2c@44E0B000 {
+                       compatible = "ti,omap4-i2c";
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+                       ti,hwmods = "i2c1";
+               };
+
+               i2c1: i2c@4802A000 {
+                       compatible = "ti,omap4-i2c";
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+                       ti,hwmods = "i2c2";
+               };
+
+               i2c2: i2c@4819C000 {
+                       compatible = "ti,omap4-i2c";
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+                       ti,hwmods = "i2c3";
+               };
+       };
+};
diff --git a/arch/arm/dts/mx28.dtsi b/arch/arm/dts/mx28.dtsi
new file mode 100644 (file)
index 0000000..a9bda8e
--- /dev/null
@@ -0,0 +1,872 @@
+/*
+ * Copyright 2012 Freescale Semiconductor, Inc.
+ *
+ * The code contained herein is licensed under the GNU General Public
+ * License. You may obtain a copy of the GNU General Public License
+ * Version 2 or later at the following locations:
+ *
+ * http://www.opensource.org/licenses/gpl-license.html
+ * http://www.gnu.org/copyleft/gpl.html
+ */
+
+/include/ "skeleton.dtsi"
+
+/ {
+       interrupt-parent = <&icoll>;
+
+       aliases {
+               gpio0 = &gpio0;
+               gpio1 = &gpio1;
+               gpio2 = &gpio2;
+               gpio3 = &gpio3;
+               gpio4 = &gpio4;
+               saif0 = &saif0;
+               saif1 = &saif1;
+               serial0 = &auart0;
+               serial1 = &auart1;
+               serial2 = &auart2;
+               serial3 = &auart3;
+               serial4 = &auart4;
+       };
+
+       cpus {
+               cpu@0 {
+                       compatible = "arm,arm926ejs";
+               };
+       };
+
+       apb@80000000 {
+               compatible = "simple-bus";
+               #address-cells = <1>;
+               #size-cells = <1>;
+               reg = <0x80000000 0x80000>;
+               ranges;
+
+               apbh@80000000 {
+                       compatible = "simple-bus";
+                       #address-cells = <1>;
+                       #size-cells = <1>;
+                       reg = <0x80000000 0x3c900>;
+                       ranges;
+
+                       icoll: interrupt-controller@80000000 {
+                               compatible = "fsl,imx28-icoll", "fsl,mxs-icoll";
+                               interrupt-controller;
+                               #interrupt-cells = <1>;
+                               reg = <0x80000000 0x2000>;
+                       };
+
+                       hsadc@80002000 {
+                               reg = <0x80002000 0x2000>;
+                               interrupts = <13 87>;
+                               status = "disabled";
+                       };
+
+                       dma-apbh@80004000 {
+                               compatible = "fsl,imx28-dma-apbh";
+                               reg = <0x80004000 0x2000>;
+                       };
+
+                       perfmon@80006000 {
+                               reg = <0x80006000 0x800>;
+                               interrupts = <27>;
+                               status = "disabled";
+                       };
+
+                       gpmi-nand@8000c000 {
+                               compatible = "fsl,imx28-gpmi-nand";
+                               #address-cells = <1>;
+                               #size-cells = <1>;
+                               reg = <0x8000c000 0x2000>, <0x8000a000 0x2000>;
+                               reg-names = "gpmi-nand", "bch";
+                               interrupts = <88>, <41>;
+                               interrupt-names = "gpmi-dma", "bch";
+                               fsl,gpmi-dma-channel = <4>;
+                               status = "disabled";
+                       };
+
+                       ssp0: ssp@80010000 {
+                               reg = <0x80010000 0x2000>;
+                               interrupts = <96 82>;
+                               fsl,ssp-dma-channel = <0>;
+                               status = "disabled";
+                       };
+
+                       ssp1: ssp@80012000 {
+                               reg = <0x80012000 0x2000>;
+                               interrupts = <97 83>;
+                               fsl,ssp-dma-channel = <1>;
+                               status = "disabled";
+                       };
+
+                       ssp2: ssp@80014000 {
+                               reg = <0x80014000 0x2000>;
+                               interrupts = <98 84>;
+                               fsl,ssp-dma-channel = <2>;
+                               status = "disabled";
+                       };
+
+                       ssp3: ssp@80016000 {
+                               reg = <0x80016000 0x2000>;
+                               interrupts = <99 85>;
+                               fsl,ssp-dma-channel = <3>;
+                               status = "disabled";
+                       };
+
+                       pinctrl@80018000 {
+                               #address-cells = <1>;
+                               #size-cells = <0>;
+                               compatible = "fsl,imx28-pinctrl", "simple-bus";
+                               reg = <0x80018000 0x2000>;
+
+                               gpio0: gpio@0 {
+                                       compatible = "fsl,imx28-gpio", "fsl,mxs-gpio";
+                                       interrupts = <127>;
+                                       gpio-controller;
+                                       #gpio-cells = <2>;
+                                       interrupt-controller;
+                                       #interrupt-cells = <2>;
+                               };
+
+                               gpio1: gpio@1 {
+                                       compatible = "fsl,imx28-gpio", "fsl,mxs-gpio";
+                                       interrupts = <126>;
+                                       gpio-controller;
+                                       #gpio-cells = <2>;
+                                       interrupt-controller;
+                                       #interrupt-cells = <2>;
+                               };
+
+                               gpio2: gpio@2 {
+                                       compatible = "fsl,imx28-gpio", "fsl,mxs-gpio";
+                                       interrupts = <125>;
+                                       gpio-controller;
+                                       #gpio-cells = <2>;
+                                       interrupt-controller;
+                                       #interrupt-cells = <2>;
+                               };
+
+                               gpio3: gpio@3 {
+                                       compatible = "fsl,imx28-gpio", "fsl,mxs-gpio";
+                                       interrupts = <124>;
+                                       gpio-controller;
+                                       #gpio-cells = <2>;
+                                       interrupt-controller;
+                                       #interrupt-cells = <2>;
+                               };
+
+                               gpio4: gpio@4 {
+                                       compatible = "fsl,imx28-gpio", "fsl,mxs-gpio";
+                                       interrupts = <123>;
+                                       gpio-controller;
+                                       #gpio-cells = <2>;
+                                       interrupt-controller;
+                                       #interrupt-cells = <2>;
+                               };
+
+                               duart_pins_a: duart@0 {
+                                       reg = <0>;
+                                       fsl,pinmux-ids = <
+                                               0x3102 /* MX28_PAD_PWM0__DUART_RX */
+                                               0x3112 /* MX28_PAD_PWM1__DUART_TX */
+                                       >;
+                                       fsl,drive-strength = <0>;
+                                       fsl,voltage = <1>;
+                                       fsl,pull-up = <0>;
+                               };
+
+                               duart_pins_b: duart@1 {
+                                       reg = <1>;
+                                       fsl,pinmux-ids = <
+                                               0x3022 /* MX28_PAD_AUART0_CTS__DUART_RX */
+                                               0x3032 /* MX28_PAD_AUART0_RTS__DUART_TX */
+                                       >;
+                                       fsl,drive-strength = <0>;
+                                       fsl,voltage = <1>;
+                                       fsl,pull-up = <0>;
+                               };
+
+                               duart_4pins_a: duart-4pins@0 {
+                                       reg = <0>;
+                                       fsl,pinmux-ids = <
+                                               0x3022 /* MX28_PAD_AUART0_CTS__DUART_RX */
+                                               0x3032 /* MX28_PAD_AUART0_RTS__DUART_TX */
+                                               0x3002 /* MX28_PAD_AUART0_RX__DUART_CTS */
+                                               0x3012 /* MX28_PAD_AUART0_TX__DUART_RTS */
+                                       >;
+                                       fsl,drive-strength = <0>;
+                                       fsl,voltage = <1>;
+                                       fsl,pull-up = <0>;
+                               };
+
+                               gpmi_pins_a: gpmi-nand@0 {
+                                       reg = <0>;
+                                       fsl,pinmux-ids = <
+                                               0x0000 /* MX28_PAD_GPMI_D00__GPMI_D0 */
+                                               0x0010 /* MX28_PAD_GPMI_D01__GPMI_D1 */
+                                               0x0020 /* MX28_PAD_GPMI_D02__GPMI_D2 */
+                                               0x0030 /* MX28_PAD_GPMI_D03__GPMI_D3 */
+                                               0x0040 /* MX28_PAD_GPMI_D04__GPMI_D4 */
+                                               0x0050 /* MX28_PAD_GPMI_D05__GPMI_D5 */
+                                               0x0060 /* MX28_PAD_GPMI_D06__GPMI_D6 */
+                                               0x0070 /* MX28_PAD_GPMI_D07__GPMI_D7 */
+                                               0x0100 /* MX28_PAD_GPMI_CE0N__GPMI_CE0N */
+                                               0x0140 /* MX28_PAD_GPMI_RDY0__GPMI_READY0 */
+                                               0x0180 /* MX28_PAD_GPMI_RDN__GPMI_RDN */
+                                               0x0190 /* MX28_PAD_GPMI_WRN__GPMI_WRN */
+                                               0x01a0 /* MX28_PAD_GPMI_ALE__GPMI_ALE */
+                                               0x01b0 /* MX28_PAD_GPMI_CLE__GPMI_CLE */
+                                               0x01c0 /* MX28_PAD_GPMI_RESETN__GPMI_RESETN */
+                                       >;
+                                       fsl,drive-strength = <0>;
+                                       fsl,voltage = <1>;
+                                       fsl,pull-up = <0>;
+                               };
+
+                               gpmi_status_cfg: gpmi-status-cfg {
+                                       fsl,pinmux-ids = <
+                                               0x0180 /* MX28_PAD_GPMI_RDN__GPMI_RDN */
+                                               0x0190 /* MX28_PAD_GPMI_WRN__GPMI_WRN */
+                                               0x01c0 /* MX28_PAD_GPMI_RESETN__GPMI_RESETN */
+                                       >;
+                                       fsl,drive-strength = <2>;
+                               };
+
+                               auart0_pins_a: auart0@0 {
+                                       reg = <0>;
+                                       fsl,pinmux-ids = <
+                                               0x3000 /* MX28_PAD_AUART0_RX__AUART0_RX */
+                                               0x3010 /* MX28_PAD_AUART0_TX__AUART0_TX */
+                                               0x3020 /* MX28_PAD_AUART0_CTS__AUART0_CTS */
+                                               0x3030 /* MX28_PAD_AUART0_RTS__AUART0_RTS */
+                                       >;
+                                       fsl,drive-strength = <0>;
+                                       fsl,voltage = <1>;
+                                       fsl,pull-up = <0>;
+                               };
+
+                               auart0_2pins_a: auart0-2pins@0 {
+                                       reg = <0>;
+                                       fsl,pinmux-ids = <
+                                               0x3000 /* MX28_PAD_AUART0_RX__AUART0_RX */
+                                               0x3010 /* MX28_PAD_AUART0_TX__AUART0_TX */
+                                       >;
+                                       fsl,drive-strength = <0>;
+                                       fsl,voltage = <1>;
+                                       fsl,pull-up = <0>;
+                               };
+
+                               auart1_pins_a: auart1@0 {
+                                       reg = <0>;
+                                       fsl,pinmux-ids = <
+                                               0x3040 /* MX28_PAD_AUART1_RX__AUART1_RX */
+                                               0x3050 /* MX28_PAD_AUART1_TX__AUART1_TX */
+                                               0x3060 /* MX28_PAD_AUART1_CTS__AUART1_CTS */
+                                               0x3070 /* MX28_PAD_AUART1_RTS__AUART1_RTS */
+                                       >;
+                                       fsl,drive-strength = <0>;
+                                       fsl,voltage = <1>;
+                                       fsl,pull-up = <0>;
+                               };
+
+                               auart1_2pins_a: auart1-2pins@0 {
+                                       reg = <0>;
+                                       fsl,pinmux-ids = <
+                                               0x3040 /* MX28_PAD_AUART1_RX__AUART1_RX */
+                                               0x3050 /* MX28_PAD_AUART1_TX__AUART1_TX */
+                                       >;
+                                       fsl,drive-strength = <0>;
+                                       fsl,voltage = <1>;
+                                       fsl,pull-up = <0>;
+                               };
+
+                               auart2_2pins_a: auart2-2pins@0 {
+                                       reg = <0>;
+                                       fsl,pinmux-ids = <
+                                               0x2101 /* MX28_PAD_SSP2_SCK__AUART2_RX */
+                                               0x2111 /* MX28_PAD_SSP2_MOSI__AUART2_TX */
+                                       >;
+                                       fsl,drive-strength = <0>;
+                                       fsl,voltage = <1>;
+                                       fsl,pull-up = <0>;
+                               };
+
+                               auart3_pins_a: auart3@0 {
+                                       reg = <0>;
+                                       fsl,pinmux-ids = <
+                                               0x30c0 /* MX28_PAD_AUART3_RX__AUART3_RX */
+                                               0x30d0 /* MX28_PAD_AUART3_TX__AUART3_TX */
+                                               0x30e0 /* MX28_PAD_AUART3_CTS__AUART3_CTS */
+                                               0x30f0 /* MX28_PAD_AUART3_RTS__AUART3_RTS */
+                                       >;
+                                       fsl,drive-strength = <0>;
+                                       fsl,voltage = <1>;
+                                       fsl,pull-up = <0>;
+                               };
+
+                               auart3_2pins_a: auart3-2pins@0 {
+                                       reg = <0>;
+                                       fsl,pinmux-ids = <
+                                               0x2121 /* MX28_PAD_SSP2_MISO__AUART3_RX */
+                                               0x2131 /* MX28_PAD_SSP2_SS0__AUART3_TX */
+                                       >;
+                                       fsl,drive-strength = <0>;
+                                       fsl,voltage = <1>;
+                                       fsl,pull-up = <0>;
+                               };
+
+                               mac0_pins_a: mac0@0 {
+                                       reg = <0>;
+                                       fsl,pinmux-ids = <
+                                               0x4000 /* MX28_PAD_ENET0_MDC__ENET0_MDC */
+                                               0x4010 /* MX28_PAD_ENET0_MDIO__ENET0_MDIO */
+                                               0x4020 /* MX28_PAD_ENET0_RX_EN__ENET0_RX_EN */
+                                               0x4030 /* MX28_PAD_ENET0_RXD0__ENET0_RXD0 */
+                                               0x4040 /* MX28_PAD_ENET0_RXD1__ENET0_RXD1 */
+                                               0x4060 /* MX28_PAD_ENET0_TX_EN__ENET0_TX_EN */
+                                               0x4070 /* MX28_PAD_ENET0_TXD0__ENET0_TXD0 */
+                                               0x4080 /* MX28_PAD_ENET0_TXD1__ENET0_TXD1 */
+                                               0x4100 /* MX28_PAD_ENET_CLK__CLKCTRL_ENET */
+                                       >;
+                                       fsl,drive-strength = <1>;
+                                       fsl,voltage = <1>;
+                                       fsl,pull-up = <1>;
+                               };
+
+                               mac1_pins_a: mac1@0 {
+                                       reg = <0>;
+                                       fsl,pinmux-ids = <
+                                               0x40f1 /* MX28_PAD_ENET0_CRS__ENET1_RX_EN */
+                                               0x4091 /* MX28_PAD_ENET0_RXD2__ENET1_RXD0 */
+                                               0x40a1 /* MX28_PAD_ENET0_RXD3__ENET1_RXD1 */
+                                               0x40e1 /* MX28_PAD_ENET0_COL__ENET1_TX_EN */
+                                               0x40b1 /* MX28_PAD_ENET0_TXD2__ENET1_TXD0 */
+                                               0x40c1 /* MX28_PAD_ENET0_TXD3__ENET1_TXD1 */
+                                       >;
+                                       fsl,drive-strength = <1>;
+                                       fsl,voltage = <1>;
+                                       fsl,pull-up = <1>;
+                               };
+
+                               mmc0_8bit_pins_a: mmc0-8bit@0 {
+                                       reg = <0>;
+                                       fsl,pinmux-ids = <
+                                               0x2000 /* MX28_PAD_SSP0_DATA0__SSP0_D0 */
+                                               0x2010 /* MX28_PAD_SSP0_DATA1__SSP0_D1 */
+                                               0x2020 /* MX28_PAD_SSP0_DATA2__SSP0_D2 */
+                                               0x2030 /* MX28_PAD_SSP0_DATA3__SSP0_D3 */
+                                               0x2040 /* MX28_PAD_SSP0_DATA4__SSP0_D4 */
+                                               0x2050 /* MX28_PAD_SSP0_DATA5__SSP0_D5 */
+                                               0x2060 /* MX28_PAD_SSP0_DATA6__SSP0_D6 */
+                                               0x2070 /* MX28_PAD_SSP0_DATA7__SSP0_D7 */
+                                               0x2080 /* MX28_PAD_SSP0_CMD__SSP0_CMD */
+                                               0x2090 /* MX28_PAD_SSP0_DETECT__SSP0_CARD_DETECT */
+                                               0x20a0 /* MX28_PAD_SSP0_SCK__SSP0_SCK */
+                                       >;
+                                       fsl,drive-strength = <1>;
+                                       fsl,voltage = <1>;
+                                       fsl,pull-up = <1>;
+                               };
+
+                               mmc0_4bit_pins_a: mmc0-4bit@0 {
+                                       reg = <0>;
+                                       fsl,pinmux-ids = <
+                                               0x2000 /* MX28_PAD_SSP0_DATA0__SSP0_D0 */
+                                               0x2010 /* MX28_PAD_SSP0_DATA1__SSP0_D1 */
+                                               0x2020 /* MX28_PAD_SSP0_DATA2__SSP0_D2 */
+                                               0x2030 /* MX28_PAD_SSP0_DATA3__SSP0_D3 */
+                                               0x2080 /* MX28_PAD_SSP0_CMD__SSP0_CMD */
+                                               0x2090 /* MX28_PAD_SSP0_DETECT__SSP0_CARD_DETECT */
+                                               0x20a0 /* MX28_PAD_SSP0_SCK__SSP0_SCK */
+                                       >;
+                                       fsl,drive-strength = <1>;
+                                       fsl,voltage = <1>;
+                                       fsl,pull-up = <1>;
+                               };
+
+                               mmc0_cd_cfg: mmc0-cd-cfg {
+                                       fsl,pinmux-ids = <
+                                               0x2090 /* MX28_PAD_SSP0_DETECT__SSP0_CARD_DETECT */
+                                       >;
+                                       fsl,pull-up = <0>;
+                               };
+
+                               mmc0_sck_cfg: mmc0-sck-cfg {
+                                       fsl,pinmux-ids = <
+                                               0x20a0 /* MX28_PAD_SSP0_SCK__SSP0_SCK */
+                                       >;
+                                       fsl,drive-strength = <2>;
+                                       fsl,pull-up = <0>;
+                               };
+
+                               i2c0_pins_a: i2c0@0 {
+                                       reg = <0>;
+                                       fsl,pinmux-ids = <
+                                               0x3180 /* MX28_PAD_I2C0_SCL__I2C0_SCL */
+                                               0x3190 /* MX28_PAD_I2C0_SDA__I2C0_SDA */
+                                       >;
+                                       fsl,drive-strength = <1>;
+                                       fsl,voltage = <1>;
+                                       fsl,pull-up = <1>;
+                               };
+
+                               i2c0_pins_b: i2c0@1 {
+                                       reg = <1>;
+                                       fsl,pinmux-ids = <
+                                               0x3001 /* MX28_PAD_AUART0_RX__I2C0_SCL */
+                                               0x3011 /* MX28_PAD_AUART0_TX__I2C0_SDA */
+                                       >;
+                                       fsl,drive-strength = <1>;
+                                       fsl,voltage = <1>;
+                                       fsl,pull-up = <1>;
+                               };
+
+                               i2c1_pins_a: i2c1@0 {
+                                       reg = <0>;
+                                       fsl,pinmux-ids = <
+                                               0x3101 /* MX28_PAD_PWM0__I2C1_SCL */
+                                               0x3111 /* MX28_PAD_PWM1__I2C1_SDA */
+                                       >;
+                                       fsl,drive-strength = <1>;
+                                       fsl,voltage = <1>;
+                                       fsl,pull-up = <1>;
+                               };
+
+                               saif0_pins_a: saif0@0 {
+                                       reg = <0>;
+                                       fsl,pinmux-ids = <
+                                               0x3140 /* MX28_PAD_SAIF0_MCLK__SAIF0_MCLK */
+                                               0x3150 /* MX28_PAD_SAIF0_LRCLK__SAIF0_LRCLK */
+                                               0x3160 /* MX28_PAD_SAIF0_BITCLK__SAIF0_BITCLK */
+                                               0x3170 /* MX28_PAD_SAIF0_SDATA0__SAIF0_SDATA0 */
+                                       >;
+                                       fsl,drive-strength = <2>;
+                                       fsl,voltage = <1>;
+                                       fsl,pull-up = <1>;
+                               };
+
+                               saif1_pins_a: saif1@0 {
+                                       reg = <0>;
+                                       fsl,pinmux-ids = <
+                                               0x31a0 /* MX28_PAD_SAIF1_SDATA0__SAIF1_SDATA0 */
+                                       >;
+                                       fsl,drive-strength = <2>;
+                                       fsl,voltage = <1>;
+                                       fsl,pull-up = <1>;
+                               };
+
+                               pwm0_pins_a: pwm0@0 {
+                                       reg = <0>;
+                                       fsl,pinmux-ids = <
+                                               0x3100 /* MX28_PAD_PWM0__PWM_0 */
+                                       >;
+                                       fsl,drive-strength = <0>;
+                                       fsl,voltage = <1>;
+                                       fsl,pull-up = <0>;
+                               };
+
+                               pwm2_pins_a: pwm2@0 {
+                                       reg = <0>;
+                                       fsl,pinmux-ids = <
+                                               0x3120 /* MX28_PAD_PWM2__PWM_2 */
+                                       >;
+                                       fsl,drive-strength = <0>;
+                                       fsl,voltage = <1>;
+                                       fsl,pull-up = <0>;
+                               };
+
+                               pwm4_pins_a: pwm4@0 {
+                                       reg = <0>;
+                                       fsl,pinmux-ids = <
+                                               0x31d0 /* MX28_PAD_PWM4__PWM_4 */
+                                       >;
+                                       fsl,drive-strength = <0>;
+                                       fsl,voltage = <1>;
+                                       fsl,pull-up = <0>;
+                               };
+
+                               lcdif_24bit_pins_a: lcdif-24bit@0 {
+                                       reg = <0>;
+                                       fsl,pinmux-ids = <
+                                               0x1000 /* MX28_PAD_LCD_D00__LCD_D0 */
+                                               0x1010 /* MX28_PAD_LCD_D01__LCD_D1 */
+                                               0x1020 /* MX28_PAD_LCD_D02__LCD_D2 */
+                                               0x1030 /* MX28_PAD_LCD_D03__LCD_D3 */
+                                               0x1040 /* MX28_PAD_LCD_D04__LCD_D4 */
+                                               0x1050 /* MX28_PAD_LCD_D05__LCD_D5 */
+                                               0x1060 /* MX28_PAD_LCD_D06__LCD_D6 */
+                                               0x1070 /* MX28_PAD_LCD_D07__LCD_D7 */
+                                               0x1080 /* MX28_PAD_LCD_D08__LCD_D8 */
+                                               0x1090 /* MX28_PAD_LCD_D09__LCD_D9 */
+                                               0x10a0 /* MX28_PAD_LCD_D10__LCD_D10 */
+                                               0x10b0 /* MX28_PAD_LCD_D11__LCD_D11 */
+                                               0x10c0 /* MX28_PAD_LCD_D12__LCD_D12 */
+                                               0x10d0 /* MX28_PAD_LCD_D13__LCD_D13 */
+                                               0x10e0 /* MX28_PAD_LCD_D14__LCD_D14 */
+                                               0x10f0 /* MX28_PAD_LCD_D15__LCD_D15 */
+                                               0x1100 /* MX28_PAD_LCD_D16__LCD_D16 */
+                                               0x1110 /* MX28_PAD_LCD_D17__LCD_D17 */
+                                               0x1120 /* MX28_PAD_LCD_D18__LCD_D18 */
+                                               0x1130 /* MX28_PAD_LCD_D19__LCD_D19 */
+                                               0x1140 /* MX28_PAD_LCD_D20__LCD_D20 */
+                                               0x1150 /* MX28_PAD_LCD_D21__LCD_D21 */
+                                               0x1160 /* MX28_PAD_LCD_D22__LCD_D22 */
+                                               0x1170 /* MX28_PAD_LCD_D23__LCD_D23 */
+                                       >;
+                                       fsl,drive-strength = <0>;
+                                       fsl,voltage = <1>;
+                                       fsl,pull-up = <0>;
+                               };
+
+                               can0_pins_a: can0@0 {
+                                       reg = <0>;
+                                       fsl,pinmux-ids = <
+                                               0x0161 /* MX28_PAD_GPMI_RDY2__CAN0_TX */
+                                               0x0171 /* MX28_PAD_GPMI_RDY3__CAN0_RX */
+                                       >;
+                                       fsl,drive-strength = <0>;
+                                       fsl,voltage = <1>;
+                                       fsl,pull-up = <0>;
+                               };
+
+                               can1_pins_a: can1@0 {
+                                       reg = <0>;
+                                       fsl,pinmux-ids = <
+                                               0x0121 /* MX28_PAD_GPMI_CE2N__CAN1_TX */
+                                               0x0131 /* MX28_PAD_GPMI_CE3N__CAN1_RX */
+                                       >;
+                                       fsl,drive-strength = <0>;
+                                       fsl,voltage = <1>;
+                                       fsl,pull-up = <0>;
+                               };
+
+                               spi2_pins_a: spi2@0 {
+                                       reg = <0>;
+                                       fsl,pinmux-ids = <
+                                               0x2100 /* MX28_PAD_SSP2_SCK__SSP2_SCK */
+                                               0x2110 /* MX28_PAD_SSP2_MOSI__SSP2_CMD */
+                                               0x2120 /* MX28_PAD_SSP2_MISO__SSP2_D0 */
+                                               0x2130 /* MX28_PAD_SSP2_SS0__SSP2_D3 */
+                                       >;
+                                       fsl,drive-strength = <1>;
+                                       fsl,voltage = <1>;
+                                       fsl,pull-up = <1>;
+                               };
+
+                               usbphy0_pins_a: usbphy0@0 {
+                                       reg = <0>;
+                                       fsl,pinmux-ids = <
+                                               0x2152 /* MX28_PAD_SSP2_SS2__USB0_OVERCURRENT */
+                                       >;
+                                       fsl,drive-strength = <2>;
+                                       fsl,voltage = <1>;
+                                       fsl,pull-up = <0>;
+                               };
+
+                               usbphy0_pins_b: usbphy0@1 {
+                                       reg = <1>;
+                                       fsl,pinmux-ids = <
+                                               0x3061 /* MX28_PAD_AUART1_CTS__USB0_OVERCURRENT */
+                                       >;
+                                       fsl,drive-strength = <2>;
+                                       fsl,voltage = <1>;
+                                       fsl,pull-up = <0>;
+                               };
+
+                               usbphy1_pins_a: usbphy1@0 {
+                                       reg = <0>;
+                                       fsl,pinmux-ids = <
+                                               0x2142 /* MX28_PAD_SSP2_SS1__USB1_OVERCURRENT */
+                                       >;
+                                       fsl,drive-strength = <2>;
+                                       fsl,voltage = <1>;
+                                       fsl,pull-up = <0>;
+                               };
+                       };
+
+                       digctl@8001c000 {
+                               reg = <0x8001c000 0x2000>;
+                               interrupts = <89>;
+                               status = "disabled";
+                       };
+
+                       etm@80022000 {
+                               reg = <0x80022000 0x2000>;
+                               status = "disabled";
+                       };
+
+                       dma-apbx@80024000 {
+                               compatible = "fsl,imx28-dma-apbx";
+                               reg = <0x80024000 0x2000>;
+                       };
+
+                       dcp@80028000 {
+                               reg = <0x80028000 0x2000>;
+                               interrupts = <52 53 54>;
+                               status = "disabled";
+                       };
+
+                       pxp@8002a000 {
+                               reg = <0x8002a000 0x2000>;
+                               interrupts = <39>;
+                               status = "disabled";
+                       };
+
+                       ocotp@8002c000 {
+                               reg = <0x8002c000 0x2000>;
+                               status = "disabled";
+                       };
+
+                       axi-ahb@8002e000 {
+                               reg = <0x8002e000 0x2000>;
+                               status = "disabled";
+                       };
+
+                       lcdif@80030000 {
+                               compatible = "fsl,imx28-lcdif";
+                               reg = <0x80030000 0x2000>;
+                               interrupts = <38 86>;
+                               status = "disabled";
+                       };
+
+                       can0: can@80032000 {
+                               compatible = "fsl,imx28-flexcan", "fsl,p1010-flexcan";
+                               reg = <0x80032000 0x2000>;
+                               interrupts = <8>;
+                               status = "disabled";
+                       };
+
+                       can1: can@80034000 {
+                               compatible = "fsl,imx28-flexcan", "fsl,p1010-flexcan";
+                               reg = <0x80034000 0x2000>;
+                               interrupts = <9>;
+                               status = "disabled";
+                       };
+
+                       simdbg@8003c000 {
+                               reg = <0x8003c000 0x200>;
+                               status = "disabled";
+                       };
+
+                       simgpmisel@8003c200 {
+                               reg = <0x8003c200 0x100>;
+                               status = "disabled";
+                       };
+
+                       simsspsel@8003c300 {
+                               reg = <0x8003c300 0x100>;
+                               status = "disabled";
+                       };
+
+                       simmemsel@8003c400 {
+                               reg = <0x8003c400 0x100>;
+                               status = "disabled";
+                       };
+
+                       gpiomon@8003c500 {
+                               reg = <0x8003c500 0x100>;
+                               status = "disabled";
+                       };
+
+                       simenet@8003c700 {
+                               reg = <0x8003c700 0x100>;
+                               status = "disabled";
+                       };
+
+                       armjtag@8003c800 {
+                               reg = <0x8003c800 0x100>;
+                               status = "disabled";
+                       };
+                };
+
+               apbx@80040000 {
+                       compatible = "simple-bus";
+                       #address-cells = <1>;
+                       #size-cells = <1>;
+                       reg = <0x80040000 0x40000>;
+                       ranges;
+
+                       clkctl@80040000 {
+                               reg = <0x80040000 0x2000>;
+                               status = "disabled";
+                       };
+
+                       saif0: saif@80042000 {
+                               compatible = "fsl,imx28-saif";
+                               reg = <0x80042000 0x2000>;
+                               interrupts = <59 80>;
+                               fsl,saif-dma-channel = <4>;
+                               status = "disabled";
+                       };
+
+                       power@80044000 {
+                               reg = <0x80044000 0x2000>;
+                               status = "disabled";
+                       };
+
+                       saif1: saif@80046000 {
+                               compatible = "fsl,imx28-saif";
+                               reg = <0x80046000 0x2000>;
+                               interrupts = <58 81>;
+                               fsl,saif-dma-channel = <5>;
+                               status = "disabled";
+                       };
+
+                       lradc@80050000 {
+                               compatible = "fsl,imx28-lradc";
+                               reg = <0x80050000 0x2000>;
+                               interrupts = <10 14 15 16 17 18 19
+                                               20 21 22 23 24 25>;
+                               status = "disabled";
+                       };
+
+                       spdif@80054000 {
+                               reg = <0x80054000 0x2000>;
+                               interrupts = <45 66>;
+                               status = "disabled";
+                       };
+
+                       rtc@80056000 {
+                               compatible = "fsl,imx28-rtc", "fsl,stmp3xxx-rtc";
+                               reg = <0x80056000 0x2000>;
+                               interrupts = <29>;
+                       };
+
+                       i2c0: i2c@80058000 {
+                               #address-cells = <1>;
+                               #size-cells = <0>;
+                               compatible = "fsl,imx28-i2c";
+                               reg = <0x80058000 0x2000>;
+                               interrupts = <111 68>;
+                               clock-frequency = <100000>;
+                               status = "disabled";
+                       };
+
+                       i2c1: i2c@8005a000 {
+                               #address-cells = <1>;
+                               #size-cells = <0>;
+                               compatible = "fsl,imx28-i2c";
+                               reg = <0x8005a000 0x2000>;
+                               interrupts = <110 69>;
+                               clock-frequency = <100000>;
+                               status = "disabled";
+                       };
+
+                       pwm: pwm@80064000 {
+                               compatible = "fsl,imx28-pwm", "fsl,imx23-pwm";
+                               reg = <0x80064000 0x2000>;
+                               #pwm-cells = <2>;
+                               fsl,pwm-number = <8>;
+                               status = "disabled";
+                       };
+
+                       timrot@80068000 {
+                               reg = <0x80068000 0x2000>;
+                               status = "disabled";
+                       };
+
+                       auart0: serial@8006a000 {
+                               compatible = "fsl,imx28-auart", "fsl,imx23-auart";
+                               reg = <0x8006a000 0x2000>;
+                               interrupts = <112 70 71>;
+                               status = "disabled";
+                       };
+
+                       auart1: serial@8006c000 {
+                               compatible = "fsl,imx28-auart", "fsl,imx23-auart";
+                               reg = <0x8006c000 0x2000>;
+                               interrupts = <113 72 73>;
+                               status = "disabled";
+                       };
+
+                       auart2: serial@8006e000 {
+                               compatible = "fsl,imx28-auart", "fsl,imx23-auart";
+                               reg = <0x8006e000 0x2000>;
+                               interrupts = <114 74 75>;
+                               status = "disabled";
+                       };
+
+                       auart3: serial@80070000 {
+                               compatible = "fsl,imx28-auart", "fsl,imx23-auart";
+                               reg = <0x80070000 0x2000>;
+                               interrupts = <115 76 77>;
+                               status = "disabled";
+                       };
+
+                       auart4: serial@80072000 {
+                               compatible = "fsl,imx28-auart", "fsl,imx23-auart";
+                               reg = <0x80072000 0x2000>;
+                               interrupts = <116 78 79>;
+                               status = "disabled";
+                       };
+
+                       duart: serial@80074000 {
+                               compatible = "arm,pl011", "arm,primecell";
+                               reg = <0x80074000 0x1000>;
+                               interrupts = <47>;
+                               status = "disabled";
+                       };
+
+                       usbphy0: usbphy@8007c000 {
+                               compatible = "fsl,imx28-usbphy", "fsl,imx23-usbphy";
+                               reg = <0x8007c000 0x2000>;
+                               status = "disabled";
+                       };
+
+                       usbphy1: usbphy@8007e000 {
+                               compatible = "fsl,imx28-usbphy", "fsl,imx23-usbphy";
+                               reg = <0x8007e000 0x2000>;
+                               status = "disabled";
+                       };
+               };
+       };
+
+       ahb@80080000 {
+               compatible = "simple-bus";
+               #address-cells = <1>;
+               #size-cells = <1>;
+               reg = <0x80080000 0x80000>;
+               ranges;
+
+               usb0: usb@80080000 {
+                       compatible = "fsl,imx28-usb", "fsl,imx27-usb";
+                       reg = <0x80080000 0x10000>;
+                       interrupts = <93>;
+                       fsl,usbphy = <&usbphy0>;
+                       status = "disabled";
+               };
+
+               usb1: usb@80090000 {
+                       compatible = "fsl,imx28-usb", "fsl,imx27-usb";
+                       reg = <0x80090000 0x10000>;
+                       interrupts = <92>;
+                       fsl,usbphy = <&usbphy1>;
+                       status = "disabled";
+               };
+
+               dflpt@800c0000 {
+                       reg = <0x800c0000 0x10000>;
+                       status = "disabled";
+               };
+
+               mac0: ethernet@800f0000 {
+                       compatible = "fsl,imx28-fec";
+                       reg = <0x800f0000 0x4000>;
+                       interrupts = <101>;
+                       status = "disabled";
+               };
+
+               mac1: ethernet@800f4000 {
+                       compatible = "fsl,imx28-fec";
+                       reg = <0x800f4000 0x4000>;
+                       interrupts = <102>;
+                       status = "disabled";
+               };
+
+               switch@800f8000 {
+                       reg = <0x800f8000 0x8000>;
+                       status = "disabled";
+               };
+
+       };
+};
diff --git a/arch/arm/dts/mx51.dtsi b/arch/arm/dts/mx51.dtsi
new file mode 100644 (file)
index 0000000..3688f31
--- /dev/null
@@ -0,0 +1,476 @@
+/*
+ * Copyright 2011 Freescale Semiconductor, Inc.
+ * Copyright 2011 Linaro Ltd.
+ *
+ * The code contained herein is licensed under the GNU General Public
+ * License. You may obtain a copy of the GNU General Public License
+ * Version 2 or later at the following locations:
+ *
+ * http://www.opensource.org/licenses/gpl-license.html
+ * http://www.gnu.org/copyleft/gpl.html
+ */
+
+/include/ "skeleton.dtsi"
+
+/ {
+        aliases {
+                serial0 = &uart1;
+                serial1 = &uart2;
+                serial2 = &uart3;
+               ethernet0 = &fec0;
+               gpio0 = &gpio1;
+               gpio1 = &gpio2;
+               gpio2 = &gpio3;
+               gpio3 = &gpio4;
+       };
+
+       tzic: tz-interrupt-controller@e0000000 {
+               compatible = "fsl,imx51-tzic", "fsl,tzic";
+               interrupt-controller;
+               #interrupt-cells = <1>;
+               reg = <0xe0000000 0x4000>;
+       };
+
+       clocks {
+               #address-cells = <1>;
+               #size-cells = <0>;
+
+               ckil {
+                       compatible = "fsl,imx-ckil", "fixed-clock";
+                       clock-frequency = <32768>;
+               };
+
+               ckih1 {
+                       compatible = "fsl,imx-ckih1", "fixed-clock";
+                       clock-frequency = <22579200>;
+               };
+
+               ckih2 {
+                       compatible = "fsl,imx-ckih2", "fixed-clock";
+                       clock-frequency = <0>;
+               };
+
+               osc {
+                       compatible = "fsl,imx-osc", "fixed-clock";
+                       clock-frequency = <24000000>;
+               };
+       };
+
+       soc {
+               #address-cells = <1>;
+               #size-cells = <1>;
+               compatible = "simple-bus";
+               interrupt-parent = <&tzic>;
+               ranges;
+
+               ahb: ahb@40000000 {
+                       compatible = "fsl,ahb-bus", "simple-bus";
+                       #address-cells = <1>;
+                       #size-cells = <1>;
+                       reg = <0x40000000 0x60000000>;
+                       ranges;
+
+                       ipu@5e000000 {
+                               #address-cells = <1>;
+                               #size-cells = <0>;
+                               compatible = "fsl,imx-ipuv3";
+                               reg = <0x5e000000 0x02000000>;
+                               interrupts = <10 11>;
+                               status = "disabled";
+                       };
+               };
+
+               aips@70000000 { /* AIPS1 */
+                       compatible = "fsl,aips-bus", "simple-bus";
+                       #address-cells = <1>;
+                       #size-cells = <1>;
+                       reg = <0x70000000 0x10000000>;
+                       ranges;
+
+                       spba@70000000 {
+                               compatible = "fsl,spba-bus", "simple-bus";
+                               #address-cells = <1>;
+                               #size-cells = <1>;
+                               reg = <0x70000000 0x40000>;
+                               ranges;
+
+                               esdhc@70004000 { /* ESDHC1 */
+                                       compatible = "fsl,imx51-esdhc";
+                                       reg = <0x70004000 0x4000>;
+                                       interrupts = <1>;
+                                       status = "disabled";
+                               };
+
+                               esdhc@70008000 { /* ESDHC2 */
+                                       compatible = "fsl,imx51-esdhc";
+                                       reg = <0x70008000 0x4000>;
+                                       interrupts = <2>;
+                                       status = "disabled";
+                               };
+
+                               uart3: serial@7000c000 {
+                                       compatible = "fsl,imx51-uart", "fsl,imx21-uart";
+                                       reg = <0x7000c000 0x4000>;
+                                       interrupts = <33>;
+                                       status = "disabled";
+                               };
+
+                               ecspi@70010000 { /* ECSPI1 */
+                                       #address-cells = <1>;
+                                       #size-cells = <0>;
+                                       compatible = "fsl,imx51-ecspi";
+                                       reg = <0x70010000 0x4000>;
+                                       interrupts = <36>;
+                                       status = "disabled";
+                               };
+
+                               ssi2: ssi@70014000 {
+                                       compatible = "fsl,imx51-ssi", "fsl,imx21-ssi";
+                                       reg = <0x70014000 0x4000>;
+                                       interrupts = <30>;
+                                       fsl,fifo-depth = <15>;
+                                       fsl,ssi-dma-events = <25 24 23 22>; /* TX0 RX0 TX1 RX1 */
+                                       status = "disabled";
+                               };
+
+                               esdhc@70020000 { /* ESDHC3 */
+                                       compatible = "fsl,imx51-esdhc";
+                                       reg = <0x70020000 0x4000>;
+                                       interrupts = <3>;
+                                       status = "disabled";
+                               };
+
+                               esdhc@70024000 { /* ESDHC4 */
+                                       compatible = "fsl,imx51-esdhc";
+                                       reg = <0x70024000 0x4000>;
+                                       interrupts = <4>;
+                                       status = "disabled";
+                               };
+                       };
+
+                       usb@73f80000 {
+                               compatible = "fsl,imx51-usb", "fsl,imx27-usb";
+                               reg = <0x73f80000 0x0200>;
+                               interrupts = <18>;
+                               status = "disabled";
+                       };
+
+                       usb@73f80200 {
+                               compatible = "fsl,imx51-usb", "fsl,imx27-usb";
+                               reg = <0x73f80200 0x0200>;
+                               interrupts = <14>;
+                               status = "disabled";
+                       };
+
+                       usb@73f80400 {
+                               compatible = "fsl,imx51-usb", "fsl,imx27-usb";
+                               reg = <0x73f80400 0x0200>;
+                               interrupts = <16>;
+                               status = "disabled";
+                       };
+
+                       usb@73f80600 {
+                               compatible = "fsl,imx51-usb", "fsl,imx27-usb";
+                               reg = <0x73f80600 0x0200>;
+                               interrupts = <17>;
+                               status = "disabled";
+                       };
+
+                       gpio1: gpio@73f84000 {
+                               compatible = "fsl,imx51-gpio", "fsl,imx35-gpio";
+                               reg = <0x73f84000 0x4000>;
+                               interrupts = <50 51>;
+                               gpio-controller;
+                               #gpio-cells = <2>;
+                               interrupt-controller;
+                               #interrupt-cells = <2>;
+                       };
+
+                       gpio2: gpio@73f88000 {
+                               compatible = "fsl,imx51-gpio", "fsl,imx35-gpio";
+                               reg = <0x73f88000 0x4000>;
+                               interrupts = <52 53>;
+                               gpio-controller;
+                               #gpio-cells = <2>;
+                               interrupt-controller;
+                               #interrupt-cells = <2>;
+                       };
+
+                       gpio3: gpio@73f8c000 {
+                               compatible = "fsl,imx51-gpio", "fsl,imx35-gpio";
+                               reg = <0x73f8c000 0x4000>;
+                               interrupts = <54 55>;
+                               gpio-controller;
+                               #gpio-cells = <2>;
+                               interrupt-controller;
+                               #interrupt-cells = <2>;
+                       };
+
+                       gpio4: gpio@73f90000 {
+                               compatible = "fsl,imx51-gpio", "fsl,imx35-gpio";
+                               reg = <0x73f90000 0x4000>;
+                               interrupts = <56 57>;
+                               gpio-controller;
+                               #gpio-cells = <2>;
+                               interrupt-controller;
+                               #interrupt-cells = <2>;
+                       };
+
+                       keypad@73f94000 {
+                               compatible = "fsl,imx-keypad";
+                               reg = <0x73f94000 0x4000>;
+                               interrupts = <60>;
+                               status = "disabled";
+                       };
+
+                       wdog@73f98000 { /* WDOG1 */
+                               compatible = "fsl,imx51-wdt", "fsl,imx21-wdt";
+                               reg = <0x73f98000 0x4000>;
+                               interrupts = <58>;
+                               status = "disabled";
+                       };
+
+                       wdog@73f9c000 { /* WDOG2 */
+                               compatible = "fsl,imx51-wdt", "fsl,imx21-wdt";
+                               reg = <0x73f9c000 0x4000>;
+                               interrupts = <59>;
+                               status = "disabled";
+                       };
+
+                       iomuxc@73fa8000 {
+                               compatible = "fsl,imx51-iomuxc";
+                               reg = <0x73fa8000 0x4000>;
+
+                               audmux {
+                                       pinctrl_audmux_1: audmuxgrp-1 {
+                                               fsl,pins = <
+                                                       384 0x80000000  /* MX51_PAD_AUD3_BB_TXD__AUD3_TXD */
+                                                       386 0x80000000  /* MX51_PAD_AUD3_BB_RXD__AUD3_RXD */
+                                                       389 0x80000000  /* MX51_PAD_AUD3_BB_CK__AUD3_TXC */
+                                                       391 0x80000000  /* MX51_PAD_AUD3_BB_FS__AUD3_TXFS */
+                                               >;
+                                       };
+                               };
+
+                               fec {
+                                       pinctrl_fec_1: fecgrp-1 {
+                                               fsl,pins = <
+                                                       128 0x80000000  /* MX51_PAD_EIM_EB2__FEC_MDIO */
+                                                       134 0x80000000  /* MX51_PAD_EIM_EB3__FEC_RDATA1 */
+                                                       146 0x80000000  /* MX51_PAD_EIM_CS2__FEC_RDATA2 */
+                                                       152 0x80000000  /* MX51_PAD_EIM_CS3__FEC_RDATA3 */
+                                                       158 0x80000000  /* MX51_PAD_EIM_CS4__FEC_RX_ER */
+                                                       165 0x80000000  /* MX51_PAD_EIM_CS5__FEC_CRS */
+                                                       206 0x80000000  /* MX51_PAD_NANDF_RB2__FEC_COL */
+                                                       213 0x80000000  /* MX51_PAD_NANDF_RB3__FEC_RX_CLK */
+                                                       293 0x80000000  /* MX51_PAD_NANDF_D9__FEC_RDATA0 */
+                                                       298 0x80000000  /* MX51_PAD_NANDF_D8__FEC_TDATA0 */
+                                                       225 0x80000000  /* MX51_PAD_NANDF_CS2__FEC_TX_ER */
+                                                       231 0x80000000  /* MX51_PAD_NANDF_CS3__FEC_MDC */
+                                                       237 0x80000000  /* MX51_PAD_NANDF_CS4__FEC_TDATA1 */
+                                                       243 0x80000000  /* MX51_PAD_NANDF_CS5__FEC_TDATA2 */
+                                                       250 0x80000000  /* MX51_PAD_NANDF_CS6__FEC_TDATA3 */
+                                                       255 0x80000000  /* MX51_PAD_NANDF_CS7__FEC_TX_EN */
+                                                       260 0x80000000  /* MX51_PAD_NANDF_RDY_INT__FEC_TX_CLK */
+                                               >;
+                                       };
+                               };
+
+                               ecspi1 {
+                                       pinctrl_ecspi1_1: ecspi1grp-1 {
+                                               fsl,pins = <
+                                                       398 0x185       /* MX51_PAD_CSPI1_MISO__ECSPI1_MISO */
+                                                       394 0x185       /* MX51_PAD_CSPI1_MOSI__ECSPI1_MOSI */
+                                                       409 0x185       /* MX51_PAD_CSPI1_SCLK__ECSPI1_SCLK */
+                                               >;
+                                       };
+                               };
+
+                               esdhc1 {
+                                       pinctrl_esdhc1_1: esdhc1grp-1 {
+                                               fsl,pins = <
+                                                       666 0x400020d5  /* MX51_PAD_SD1_CMD__SD1_CMD */
+                                                       669 0x20d5      /* MX51_PAD_SD1_CLK__SD1_CLK */
+                                                       672 0x20d5      /* MX51_PAD_SD1_DATA0__SD1_DATA0 */
+                                                       678 0x20d5      /* MX51_PAD_SD1_DATA1__SD1_DATA1 */
+                                                       684 0x20d5      /* MX51_PAD_SD1_DATA2__SD1_DATA2 */
+                                                       691 0x20d5      /* MX51_PAD_SD1_DATA3__SD1_DATA3 */
+                                               >;
+                                       };
+                               };
+
+                               esdhc2 {
+                                       pinctrl_esdhc2_1: esdhc2grp-1 {
+                                               fsl,pins = <
+                                                       704 0x400020d5  /* MX51_PAD_SD2_CMD__SD2_CMD */
+                                                       707 0x20d5      /* MX51_PAD_SD2_CLK__SD2_CLK */
+                                                       710 0x20d5      /* MX51_PAD_SD2_DATA0__SD2_DATA0 */
+                                                       712 0x20d5      /* MX51_PAD_SD2_DATA1__SD2_DATA1 */
+                                                       715 0x20d5      /* MX51_PAD_SD2_DATA2__SD2_DATA2 */
+                                                       719 0x20d5      /* MX51_PAD_SD2_DATA3__SD2_DATA3 */
+                                               >;
+                                       };
+                               };
+
+                               i2c2 {
+                                       pinctrl_i2c2_1: i2c2grp-1 {
+                                               fsl,pins = <
+                                                       449 0x400001ed  /* MX51_PAD_KEY_COL4__I2C2_SCL */
+                                                       454 0x400001ed  /* MX51_PAD_KEY_COL5__I2C2_SDA */
+                                               >;
+                                       };
+                               };
+
+                               uart1 {
+                                       pinctrl_uart1_1: uart1grp-1 {
+                                               fsl,pins = <
+                                                       413 0x1c5       /* MX51_PAD_UART1_RXD__UART1_RXD */
+                                                       416 0x1c5       /* MX51_PAD_UART1_TXD__UART1_TXD */
+                                                       418 0x1c5       /* MX51_PAD_UART1_RTS__UART1_RTS */
+                                                       420 0x1c5       /* MX51_PAD_UART1_CTS__UART1_CTS */
+                                               >;
+                                       };
+                               };
+
+                               uart2 {
+                                       pinctrl_uart2_1: uart2grp-1 {
+                                               fsl,pins = <
+                                                       423 0x1c5       /* MX51_PAD_UART2_RXD__UART2_RXD */
+                                                       426 0x1c5       /* MX51_PAD_UART2_TXD__UART2_TXD */
+                                               >;
+                                       };
+                               };
+
+                               uart3 {
+                                       pinctrl_uart3_1: uart3grp-1 {
+                                               fsl,pins = <
+                                                       54 0x1c5        /* MX51_PAD_EIM_D25__UART3_RXD */
+                                                       59 0x1c5        /* MX51_PAD_EIM_D26__UART3_TXD */
+                                                       65 0x1c5        /* MX51_PAD_EIM_D27__UART3_RTS */
+                                                       49 0x1c5        /* MX51_PAD_EIM_D24__UART3_CTS */
+                                               >;
+                                       };
+                               };
+                       };
+
+                       pwm@73fb4000 {
+                               compatible = "fsl,imx51-pwm", "fsl,imx27-pwm";
+                               reg = <0x73fb4000 0x4000>;
+                               interrupts = <61>;
+                               status = "disabled";
+                       };
+
+                       pwm@73fb8000 {
+                               compatible = "fsl,imx51-pwm", "fsl,imx27-pwm";
+                               reg = <0x73fb8000 0x4000>;
+                               interrupts = <94>;
+                               status = "disabled";
+                       };
+
+                       uart1: serial@73fbc000 {
+                               compatible = "fsl,imx51-uart", "fsl,imx21-uart";
+                               reg = <0x73fbc000 0x4000>;
+                               interrupts = <31>;
+                               status = "disabled";
+                       };
+
+                       uart2: serial@73fc0000 {
+                               compatible = "fsl,imx51-uart", "fsl,imx21-uart";
+                               reg = <0x73fc0000 0x4000>;
+                               interrupts = <32>;
+                               status = "disabled";
+                       };
+               };
+
+               aips@80000000 { /* AIPS2 */
+                       compatible = "fsl,aips-bus", "simple-bus";
+                       #address-cells = <1>;
+                       #size-cells = <1>;
+                       reg = <0x80000000 0x10000000>;
+                       ranges;
+
+                       ecspi@83fac000 { /* ECSPI2 */
+                               #address-cells = <1>;
+                               #size-cells = <0>;
+                               compatible = "fsl,imx51-ecspi";
+                               reg = <0x83fac000 0x4000>;
+                               interrupts = <37>;
+                               status = "disabled";
+                       };
+
+                       sdma@83fb0000 {
+                               compatible = "fsl,imx51-sdma", "fsl,imx35-sdma";
+                               reg = <0x83fb0000 0x4000>;
+                               interrupts = <6>;
+                               fsl,sdma-ram-script-name = "imx/sdma/sdma-imx51.bin";
+                       };
+
+                       cspi@83fc0000 {
+                               #address-cells = <1>;
+                               #size-cells = <0>;
+                               compatible = "fsl,imx51-cspi", "fsl,imx35-cspi";
+                               reg = <0x83fc0000 0x4000>;
+                               interrupts = <38>;
+                               status = "disabled";
+                       };
+
+                       i2c@83fc4000 { /* I2C2 */
+                               #address-cells = <1>;
+                               #size-cells = <0>;
+                               compatible = "fsl,imx51-i2c", "fsl,imx1-i2c";
+                               reg = <0x83fc4000 0x4000>;
+                               interrupts = <63>;
+                               status = "disabled";
+                       };
+
+                       i2c@83fc8000 { /* I2C1 */
+                               #address-cells = <1>;
+                               #size-cells = <0>;
+                               compatible = "fsl,imx51-i2c", "fsl,imx1-i2c";
+                               reg = <0x83fc8000 0x4000>;
+                               interrupts = <62>;
+                               status = "disabled";
+                       };
+
+                       ssi1: ssi@83fcc000 {
+                               compatible = "fsl,imx51-ssi", "fsl,imx21-ssi";
+                               reg = <0x83fcc000 0x4000>;
+                               interrupts = <29>;
+                               fsl,fifo-depth = <15>;
+                               fsl,ssi-dma-events = <29 28 27 26>; /* TX0 RX0 TX1 RX1 */
+                               status = "disabled";
+                       };
+
+                       audmux@83fd0000 {
+                               compatible = "fsl,imx51-audmux", "fsl,imx31-audmux";
+                               reg = <0x83fd0000 0x4000>;
+                               ssi-ports = <0 1 2>;
+                               ext-ports = <3 4 5 6>;
+                               status = "disabled";
+                       };
+
+                       nand@83fdb000 {
+                               compatible = "fsl,imx51-nand";
+                               reg = <0x83fdb000 0x1000 0xcfff0000 0x10000>;
+                               interrupts = <8>;
+                               status = "disabled";
+                       };
+
+                       ssi3: ssi@83fe8000 {
+                               compatible = "fsl,imx51-ssi", "fsl,imx21-ssi";
+                               reg = <0x83fe8000 0x4000>;
+                               interrupts = <96>;
+                               fsl,fifo-depth = <15>;
+                               fsl,ssi-dma-events = <47 46 37 35>; /* TX0 RX0 TX1 RX1 */
+                               status = "disabled";
+                       };
+
+                       fec0: ethernet@83fec000 {
+                               compatible = "fsl,imx51-fec", "fsl,imx27-fec";
+                               reg = <0x83fec000 0x4000>;
+                               interrupts = <87>;
+                               status = "disabled";
+                       };
+               };
+       };
+};
diff --git a/arch/arm/dts/mx53.dtsi b/arch/arm/dts/mx53.dtsi
new file mode 100644 (file)
index 0000000..f1948c2
--- /dev/null
@@ -0,0 +1,604 @@
+/*
+ * Copyright 2011 Freescale Semiconductor, Inc.
+ * Copyright 2011 Linaro Ltd.
+ *
+ * The code contained herein is licensed under the GNU General Public
+ * License. You may obtain a copy of the GNU General Public License
+ * Version 2 or later at the following locations:
+ *
+ * http://www.opensource.org/licenses/gpl-license.html
+ * http://www.gnu.org/copyleft/gpl.html
+ */
+
+/include/ "skeleton.dtsi"
+
+/ {
+       aliases {
+               serial0 = &uart1;
+               serial1 = &uart2;
+               serial2 = &uart3;
+               serial3 = &uart4;
+               serial4 = &uart5;
+               gpio0 = &gpio1;
+               gpio1 = &gpio2;
+               gpio2 = &gpio3;
+               gpio3 = &gpio4;
+               gpio4 = &gpio5;
+               gpio5 = &gpio6;
+               gpio6 = &gpio7;
+       };
+
+       tzic: tz-interrupt-controller@0fffc000 {
+               compatible = "fsl,imx53-tzic", "fsl,tzic";
+               interrupt-controller;
+               #interrupt-cells = <1>;
+               reg = <0x0fffc000 0x4000>;
+       };
+
+       clocks {
+               #address-cells = <1>;
+               #size-cells = <0>;
+
+               ckil {
+                       compatible = "fsl,imx-ckil", "fixed-clock";
+                       clock-frequency = <32768>;
+               };
+
+               ckih1 {
+                       compatible = "fsl,imx-ckih1", "fixed-clock";
+                       clock-frequency = <22579200>;
+               };
+
+               ckih2 {
+                       compatible = "fsl,imx-ckih2", "fixed-clock";
+                       clock-frequency = <0>;
+               };
+
+               osc {
+                       compatible = "fsl,imx-osc", "fixed-clock";
+                       clock-frequency = <24000000>;
+               };
+       };
+
+       soc {
+               #address-cells = <1>;
+               #size-cells = <1>;
+               compatible = "simple-bus";
+               interrupt-parent = <&tzic>;
+               ranges;
+
+               extmc@00000000 {
+                       compatible = "fsl,extmc", "simple-bus";
+                       #address-cells = <1>;
+                       #size-cells = <1>;
+                       reg = <0x00000000 0x40000000>;
+                       ranges;
+
+                       sata@10000000 {
+                               compatible = "fsl,imx53-sata", "fsl,imx-ahci";
+                               reg = <0x10000000 0x00004000>;
+                               interrupts = <28>;
+                               status = "disabled";
+                       };
+
+                       ipu@1e000000 {
+                               compatible = "fsl,imx-ipuv3";
+                               reg = <0x1e000000 0x02000000>;
+                               interrupts = <10 11>;
+                               status = "disabled";
+                       };
+               };
+
+               aips@50000000 { /* AIPS1 */
+                       compatible = "fsl,aips-bus", "simple-bus";
+                       #address-cells = <1>;
+                       #size-cells = <1>;
+                       reg = <0x50000000 0x10000000>;
+                       ranges;
+
+                       spba@50000000 {
+                               compatible = "fsl,spba-bus", "simple-bus";
+                               #address-cells = <1>;
+                               #size-cells = <1>;
+                               reg = <0x50000000 0x40000>;
+                               ranges;
+
+                               esdhc@50004000 { /* ESDHC1 */
+                                       compatible = "fsl,imx53-esdhc";
+                                       reg = <0x50004000 0x4000>;
+                                       interrupts = <1>;
+                                       status = "disabled";
+                               };
+
+                               esdhc@50008000 { /* ESDHC2 */
+                                       compatible = "fsl,imx53-esdhc";
+                                       reg = <0x50008000 0x4000>;
+                                       interrupts = <2>;
+                                       status = "disabled";
+                               };
+
+                               uart3: serial@5000c000 {
+                                       compatible = "fsl,imx53-uart", "fsl,imx21-uart";
+                                       reg = <0x5000c000 0x4000>;
+                                       interrupts = <33>;
+                                       status = "disabled";
+                               };
+
+                               ecspi@50010000 { /* ECSPI1 */
+                                       #address-cells = <1>;
+                                       #size-cells = <0>;
+                                       compatible = "fsl,imx53-ecspi", "fsl,imx51-ecspi";
+                                       reg = <0x50010000 0x4000>;
+                                       interrupts = <36>;
+                                       status = "disabled";
+                               };
+
+                               ssi2: ssi@50014000 {
+                                       compatible = "fsl,imx53-ssi", "fsl,imx21-ssi";
+                                       reg = <0x50014000 0x4000>;
+                                       interrupts = <30>;
+                                       fsl,fifo-depth = <15>;
+                                       fsl,ssi-dma-events = <25 24 23 22>; /* TX0 RX0 TX1 RX1 */
+                                       status = "disabled";
+                               };
+
+                               esdhc@50020000 { /* ESDHC3 */
+                                       compatible = "fsl,imx53-esdhc";
+                                       reg = <0x50020000 0x4000>;
+                                       interrupts = <3>;
+                                       status = "disabled";
+                               };
+
+                               esdhc@50024000 { /* ESDHC4 */
+                                       compatible = "fsl,imx53-esdhc";
+                                       reg = <0x50024000 0x4000>;
+                                       interrupts = <4>;
+                                       status = "disabled";
+                               };
+                       };
+
+                       usb@53f80000 {
+                               compatible = "fsl,imx53-usb", "fsl,imx27-usb";
+                               reg = <0x53f80000 0x0200>;
+                               interrupts = <18>;
+                               status = "disabled";
+                       };
+
+                       usb@53f80200 {
+                               compatible = "fsl,imx53-usb", "fsl,imx27-usb";
+                               reg = <0x53f80200 0x0200>;
+                               interrupts = <14>;
+                               status = "disabled";
+                       };
+
+                       usb@53f80400 {
+                               compatible = "fsl,imx53-usb", "fsl,imx27-usb";
+                               reg = <0x53f80400 0x0200>;
+                               interrupts = <16>;
+                               status = "disabled";
+                       };
+
+                       usb@53f80600 {
+                               compatible = "fsl,imx53-usb", "fsl,imx27-usb";
+                               reg = <0x53f80600 0x0200>;
+                               interrupts = <17>;
+                               status = "disabled";
+                       };
+
+                       gpio1: gpio@53f84000 {
+                               compatible = "fsl,imx53-gpio", "fsl,imx35-gpio";
+                               reg = <0x53f84000 0x4000>;
+                               interrupts = <50 51>;
+                               gpio-controller;
+                               #gpio-cells = <2>;
+                               interrupt-controller;
+                               #interrupt-cells = <2>;
+                       };
+
+                       gpio2: gpio@53f88000 {
+                               compatible = "fsl,imx53-gpio", "fsl,imx35-gpio";
+                               reg = <0x53f88000 0x4000>;
+                               interrupts = <52 53>;
+                               gpio-controller;
+                               #gpio-cells = <2>;
+                               interrupt-controller;
+                               #interrupt-cells = <2>;
+                       };
+
+                       gpio3: gpio@53f8c000 {
+                               compatible = "fsl,imx53-gpio", "fsl,imx35-gpio";
+                               reg = <0x53f8c000 0x4000>;
+                               interrupts = <54 55>;
+                               gpio-controller;
+                               #gpio-cells = <2>;
+                               interrupt-controller;
+                               #interrupt-cells = <2>;
+                       };
+
+                       gpio4: gpio@53f90000 {
+                               compatible = "fsl,imx53-gpio", "fsl,imx35-gpio";
+                               reg = <0x53f90000 0x4000>;
+                               interrupts = <56 57>;
+                               gpio-controller;
+                               #gpio-cells = <2>;
+                               interrupt-controller;
+                               #interrupt-cells = <2>;
+                       };
+
+                       keypad@53f94000 {
+                               compatible = "fsl,imx-keypad";
+                               reg = <0x53f94000 0x4000>;
+                               interrupts = <60>;
+                               status = "disabled";
+                       };
+
+                       wdog@53f98000 { /* WDOG1 */
+                               compatible = "fsl,imx53-wdt", "fsl,imx21-wdt";
+                               reg = <0x53f98000 0x4000>;
+                               interrupts = <58>;
+                               status = "disabled";
+                       };
+
+                       wdog@53f9c000 { /* WDOG2 */
+                               compatible = "fsl,imx53-wdt", "fsl,imx21-wdt";
+                               reg = <0x53f9c000 0x4000>;
+                               interrupts = <59>;
+                               status = "disabled";
+                       };
+
+                       iomuxc@53fa8000 {
+                               compatible = "fsl,imx53-iomuxc";
+                               reg = <0x53fa8000 0x4000>;
+
+                               audmux {
+                                       pinctrl_audmux_1: audmuxgrp-1 {
+                                               fsl,pins = <
+                                                       10 0x80 /* MX53_PAD_KEY_COL0__AUDMUX_AUD5_TXC */
+                                                       17 0x80 /* MX53_PAD_KEY_ROW0__AUDMUX_AUD5_TXD */
+                                                       23 0x80 /* MX53_PAD_KEY_COL1__AUDMUX_AUD5_TXFS */
+                                                       30 0x80 /* MX53_PAD_KEY_ROW1__AUDMUX_AUD5_RXD */
+                                               >;
+                                       };
+                               };
+
+                               fec {
+                                       pinctrl_fec_1: fecgrp-1 {
+                                               fsl,pins = <
+                                                       820 0x80        /* MX53_PAD_FEC_MDC__FEC_MDC */
+                                                       779 0x80        /* MX53_PAD_FEC_MDIO__FEC_MDIO */
+                                                       786 0x80        /* MX53_PAD_FEC_REF_CLK__FEC_TX_CLK */
+                                                       791 0x80        /* MX53_PAD_FEC_RX_ER__FEC_RX_ER */
+                                                       796 0x80        /* MX53_PAD_FEC_CRS_DV__FEC_RX_DV */
+                                                       799 0x80        /* MX53_PAD_FEC_RXD1__FEC_RDATA_1 */
+                                                       804 0x80        /* MX53_PAD_FEC_RXD0__FEC_RDATA_0 */
+                                                       808 0x80        /* MX53_PAD_FEC_TX_EN__FEC_TX_EN */
+                                                       811 0x80        /* MX53_PAD_FEC_TXD1__FEC_TDATA_1 */
+                                                       816 0x80        /* MX53_PAD_FEC_TXD0__FEC_TDATA_0 */
+                                               >;
+                                       };
+                               };
+
+                               ecspi1 {
+                                       pinctrl_ecspi1_1: ecspi1grp-1 {
+                                               fsl,pins = <
+                                                       433 0x80        /* MX53_PAD_EIM_D16__ECSPI1_SCLK */
+                                                       439 0x80        /* MX53_PAD_EIM_D17__ECSPI1_MISO */
+                                                       445 0x80        /* MX53_PAD_EIM_D18__ECSPI1_MOSI */
+                                               >;
+                                       };
+                               };
+
+                               esdhc1 {
+                                       pinctrl_esdhc1_1: esdhc1grp-1 {
+                                               fsl,pins = <
+                                                       995  0x1d5      /* MX53_PAD_SD1_DATA0__ESDHC1_DAT0 */
+                                                       1000 0x1d5      /* MX53_PAD_SD1_DATA1__ESDHC1_DAT1 */
+                                                       1010 0x1d5      /* MX53_PAD_SD1_DATA2__ESDHC1_DAT2 */
+                                                       1024 0x1d5      /* MX53_PAD_SD1_DATA3__ESDHC1_DAT3 */
+                                                       1005 0x1d5      /* MX53_PAD_SD1_CMD__ESDHC1_CMD */
+                                                       1018 0x1d5      /* MX53_PAD_SD1_CLK__ESDHC1_CLK */
+                                               >;
+                                       };
+
+                                       pinctrl_esdhc1_2: esdhc1grp-2 {
+                                               fsl,pins = <
+                                                       995  0x1d5      /* MX53_PAD_SD1_DATA0__ESDHC1_DAT0 */
+                                                       1000 0x1d5      /* MX53_PAD_SD1_DATA1__ESDHC1_DAT1 */
+                                                       1010 0x1d5      /* MX53_PAD_SD1_DATA2__ESDHC1_DAT2 */
+                                                       1024 0x1d5      /* MX53_PAD_SD1_DATA3__ESDHC1_DAT3 */
+                                                       941  0x1d5      /* MX53_PAD_PATA_DATA8__ESDHC1_DAT4 */
+                                                       948  0x1d5      /* MX53_PAD_PATA_DATA9__ESDHC1_DAT5 */
+                                                       955  0x1d5      /* MX53_PAD_PATA_DATA10__ESDHC1_DAT6 */
+                                                       962  0x1d5      /* MX53_PAD_PATA_DATA11__ESDHC1_DAT7 */
+                                                       1005 0x1d5      /* MX53_PAD_SD1_CMD__ESDHC1_CMD */
+                                                       1018 0x1d5      /* MX53_PAD_SD1_CLK__ESDHC1_CLK */
+                                               >;
+                                       };
+                               };
+
+                               esdhc2 {
+                                       pinctrl_esdhc2_1: esdhc2grp-1 {
+                                               fsl,pins = <
+                                                       1038 0x1d5      /* MX53_PAD_SD2_CMD__ESDHC2_CMD */
+                                                       1032 0x1d5      /* MX53_PAD_SD2_CLK__ESDHC2_CLK */
+                                                       1062 0x1d5      /* MX53_PAD_SD2_DATA0__ESDHC2_DAT0 */
+                                                       1056 0x1d5      /* MX53_PAD_SD2_DATA1__ESDHC2_DAT1 */
+                                                       1050 0x1d5      /* MX53_PAD_SD2_DATA2__ESDHC2_DAT2 */
+                                                       1044 0x1d5      /* MX53_PAD_SD2_DATA3__ESDHC2_DAT3 */
+                                               >;
+                                       };
+                               };
+
+                               esdhc3 {
+                                       pinctrl_esdhc3_1: esdhc3grp-1 {
+                                               fsl,pins = <
+                                                       943 0x1d5       /* MX53_PAD_PATA_DATA8__ESDHC3_DAT0 */
+                                                       950 0x1d5       /* MX53_PAD_PATA_DATA9__ESDHC3_DAT1 */
+                                                       957 0x1d5       /* MX53_PAD_PATA_DATA10__ESDHC3_DAT2 */
+                                                       964 0x1d5       /* MX53_PAD_PATA_DATA11__ESDHC3_DAT3 */
+                                                       893 0x1d5       /* MX53_PAD_PATA_DATA0__ESDHC3_DAT4 */
+                                                       900 0x1d5       /* MX53_PAD_PATA_DATA1__ESDHC3_DAT5 */
+                                                       906 0x1d5       /* MX53_PAD_PATA_DATA2__ESDHC3_DAT6 */
+                                                       912 0x1d5       /* MX53_PAD_PATA_DATA3__ESDHC3_DAT7 */
+                                                       857 0x1d5       /* MX53_PAD_PATA_RESET_B__ESDHC3_CMD */
+                                                       863 0x1d5       /* MX53_PAD_PATA_IORDY__ESDHC3_CLK */
+                                               >;
+                                       };
+                               };
+
+                               i2c1 {
+                                       pinctrl_i2c1_1: i2c1grp-1 {
+                                               fsl,pins = <
+                                                       333 0xc0        /* MX53_PAD_CSI0_DAT8__I2C1_SDA */
+                                                       341 0xc0        /* MX53_PAD_CSI0_DAT9__I2C1_SCL */
+                                               >;
+                                       };
+
+                                       pinctrl_i2c1_2: i2c1grp-2 {
+                                               fsl,pins = <
+                                                       529 0xc0        /* MX53_PAD_EIM_D28__I2C1_SDA */
+                                                       469 0xc0        /* MX53_PAD_EIM_D21__I2C1_SCL */
+                                               >;
+                                       };
+                               };
+
+                               i2c2 {
+                                       pinctrl_i2c2_1: i2c2grp-1 {
+                                               fsl,pins = <
+                                                       61 0xc0         /* MX53_PAD_KEY_ROW3__I2C2_SDA */
+                                                       53 0xc0         /* MX53_PAD_KEY_COL3__I2C2_SCL */
+                                               >;
+                                       };
+                               };
+
+                               i2c3 {
+                                       pinctrl_i2c3_1: i2c3grp-1 {
+                                               fsl,pins = <
+                                                       1102 0xc0       /* MX53_PAD_GPIO_6__I2C3_SDA */
+                                                       1094 0xc0       /* MX53_PAD_GPIO_3__I2C3_SCL */
+                                               >;
+                                       };
+                               };
+
+                               uart1 {
+                                       pinctrl_uart1_1: uart1grp-1 {
+                                               fsl,pins = <
+                                                       346 0x1c5       /* MX53_PAD_CSI0_DAT10__UART1_TXD_MUX */
+                                                       354 0x1c5       /* MX53_PAD_CSI0_DAT11__UART1_RXD_MUX */
+                                               >;
+                                       };
+
+                                       pinctrl_uart1_2: uart1grp-2 {
+                                               fsl,pins = <
+                                                       828 0x1c5       /* MX53_PAD_PATA_DIOW__UART1_TXD_MUX */
+                                                       832 0x1c5       /* MX53_PAD_PATA_DMACK__UART1_RXD_MUX */
+                                               >;
+                                       };
+                               };
+
+                               uart2 {
+                                       pinctrl_uart2_1: uart2grp-1 {
+                                               fsl,pins = <
+                                                       841 0x1c5       /* MX53_PAD_PATA_BUFFER_EN__UART2_RXD_MUX */
+                                                       836 0x1c5       /* MX53_PAD_PATA_DMARQ__UART2_TXD_MUX */
+                                               >;
+                                       };
+                               };
+
+                               uart3 {
+                                       pinctrl_uart3_1: uart3grp-1 {
+                                               fsl,pins = <
+                                                       884 0x1c5       /* MX53_PAD_PATA_CS_0__UART3_TXD_MUX */
+                                                       888 0x1c5       /* MX53_PAD_PATA_CS_1__UART3_RXD_MUX */
+                                                       875 0x1c5       /* MX53_PAD_PATA_DA_1__UART3_CTS */
+                                                       880 0x1c5       /* MX53_PAD_PATA_DA_2__UART3_RTS */
+                                               >;
+                                       };
+                               };
+                       };
+                       pwm@53fb4000 {
+                               compatible = "fsl,imx53-pwm", "fsl,imx27-pwm";
+                               reg = <0x53fb4000 0x4000>;
+                               interrupts = <61>;
+                               status = "disabled";
+                       };
+
+                       pwm@53fb8000 {
+                               compatible = "fsl,imx53-pwm", "fsl,imx27-pwm";
+                               reg = <0x53fb8000 0x4000>;
+                               interrupts = <94>;
+                               status = "disabled";
+                       };
+
+                       uart1: serial@53fbc000 {
+                               compatible = "fsl,imx53-uart", "fsl,imx21-uart";
+                               reg = <0x53fbc000 0x4000>;
+                               interrupts = <31>;
+                               status = "disabled";
+                       };
+
+                       uart2: serial@53fc0000 {
+                               compatible = "fsl,imx53-uart", "fsl,imx21-uart";
+                               reg = <0x53fc0000 0x4000>;
+                               interrupts = <32>;
+                               status = "disabled";
+                       };
+
+                       can1: can@53fc8000 {
+                               compatible = "fsl,imx53-flexcan", "fsl,p1010-flexcan";
+                               reg = <0x53fc8000 0x4000>;
+                               interrupts = <82>;
+                               status = "disabled";
+                       };
+
+                       can2: can@53fcc000 {
+                               compatible = "fsl,imx53-flexcan", "fsl,p1010-flexcan";
+                               reg = <0x53fcc000 0x4000>;
+                               interrupts = <83>;
+                               status = "disabled";
+                       };
+
+                       gpio5: gpio@53fdc000 {
+                               compatible = "fsl,imx53-gpio", "fsl,imx35-gpio";
+                               reg = <0x53fdc000 0x4000>;
+                               interrupts = <103 104>;
+                               gpio-controller;
+                               #gpio-cells = <2>;
+                               interrupt-controller;
+                               #interrupt-cells = <2>;
+                       };
+
+                       gpio6: gpio@53fe0000 {
+                               compatible = "fsl,imx53-gpio", "fsl,imx35-gpio";
+                               reg = <0x53fe0000 0x4000>;
+                               interrupts = <105 106>;
+                               gpio-controller;
+                               #gpio-cells = <2>;
+                               interrupt-controller;
+                               #interrupt-cells = <2>;
+                       };
+
+                       gpio7: gpio@53fe4000 {
+                               compatible = "fsl,imx53-gpio", "fsl,imx35-gpio";
+                               reg = <0x53fe4000 0x4000>;
+                               interrupts = <107 108>;
+                               gpio-controller;
+                               #gpio-cells = <2>;
+                               interrupt-controller;
+                               #interrupt-cells = <2>;
+                       };
+
+                       i2c@53fec000 { /* I2C3 */
+                               #address-cells = <1>;
+                               #size-cells = <0>;
+                               compatible = "fsl,imx53-i2c", "fsl,imx1-i2c";
+                               reg = <0x53fec000 0x4000>;
+                               interrupts = <64>;
+                               status = "disabled";
+                       };
+
+                       uart4: serial@53ff0000 {
+                               compatible = "fsl,imx53-uart", "fsl,imx21-uart";
+                               reg = <0x53ff0000 0x4000>;
+                               interrupts = <13>;
+                               status = "disabled";
+                       };
+               };
+
+               aips@60000000 { /* AIPS2 */
+                       compatible = "fsl,aips-bus", "simple-bus";
+                       #address-cells = <1>;
+                       #size-cells = <1>;
+                       reg = <0x60000000 0x10000000>;
+                       ranges;
+
+                       uart5: serial@63f90000 {
+                               compatible = "fsl,imx53-uart", "fsl,imx21-uart";
+                               reg = <0x63f90000 0x4000>;
+                               interrupts = <86>;
+                               status = "disabled";
+                       };
+
+                       ecspi@63fac000 { /* ECSPI2 */
+                               #address-cells = <1>;
+                               #size-cells = <0>;
+                               compatible = "fsl,imx53-ecspi", "fsl,imx51-ecspi";
+                               reg = <0x63fac000 0x4000>;
+                               interrupts = <37>;
+                               status = "disabled";
+                       };
+
+                       sdma@63fb0000 {
+                               compatible = "fsl,imx53-sdma", "fsl,imx35-sdma";
+                               reg = <0x63fb0000 0x4000>;
+                               interrupts = <6>;
+                               fsl,sdma-ram-script-name = "imx/sdma/sdma-imx53.bin";
+                       };
+
+                       cspi@63fc0000 {
+                               #address-cells = <1>;
+                               #size-cells = <0>;
+                               compatible = "fsl,imx53-cspi", "fsl,imx35-cspi";
+                               reg = <0x63fc0000 0x4000>;
+                               interrupts = <38>;
+                               status = "disabled";
+                       };
+
+                       i2c@63fc4000 { /* I2C2 */
+                               #address-cells = <1>;
+                               #size-cells = <0>;
+                               compatible = "fsl,imx53-i2c", "fsl,imx1-i2c";
+                               reg = <0x63fc4000 0x4000>;
+                               interrupts = <63>;
+                               status = "disabled";
+                       };
+
+                       i2c@63fc8000 { /* I2C1 */
+                               #address-cells = <1>;
+                               #size-cells = <0>;
+                               compatible = "fsl,imx53-i2c", "fsl,imx1-i2c";
+                               reg = <0x63fc8000 0x4000>;
+                               interrupts = <62>;
+                               status = "disabled";
+                       };
+
+                       ssi1: ssi@63fcc000 {
+                               compatible = "fsl,imx53-ssi", "fsl,imx21-ssi";
+                               reg = <0x63fcc000 0x4000>;
+                               interrupts = <29>;
+                               fsl,fifo-depth = <15>;
+                               fsl,ssi-dma-events = <29 28 27 26>; /* TX0 RX0 TX1 RX1 */
+                               status = "disabled";
+                       };
+
+                       audmux@63fd0000 {
+                               compatible = "fsl,imx53-audmux", "fsl,imx31-audmux";
+                               reg = <0x63fd0000 0x4000>;
+                               status = "disabled";
+                       };
+
+                       nand@63fdb000 {
+                               compatible = "fsl,imx53-nand";
+                               reg = <0x63fdb000 0x1000 0xf7ff0000 0x10000>;
+                               interrupts = <8>;
+                               status = "disabled";
+                       };
+
+                       ssi3: ssi@63fe8000 {
+                               compatible = "fsl,imx53-ssi", "fsl,imx21-ssi";
+                               reg = <0x63fe8000 0x4000>;
+                               interrupts = <96>;
+                               fsl,fifo-depth = <15>;
+                               fsl,ssi-dma-events = <47 46 45 44>; /* TX0 RX0 TX1 RX1 */
+                               status = "disabled";
+                       };
+
+                       ethernet@63fec000 {
+                               compatible = "fsl,imx53-fec", "fsl,imx25-fec";
+                               reg = <0x63fec000 0x4000>;
+                               interrupts = <87>;
+                               status = "disabled";
+                       };
+               };
+       };
+};
index d5ca02c5f522c4dc62b3ebc41bff6ee1f1d43cb1..f95be58135041b2238cbe5357806d9c0ed95dd87 100644 (file)
                clocks = <&tegra_car 59>;       /* PERIPH_ID_USB3 */
        };
 
+       emc@7000f400 {
+               #address-cells = < 1 >;
+               #size-cells = < 0 >;
+               compatible = "nvidia,tegra20-emc";
+               reg = <0x7000f400 0x200>;
+       };
+
+       kbc@7000e200 {
+               compatible = "nvidia,tegra20-kbc";
+               reg = <0x7000e200 0x0078>;
+       };
 };
index abc5b6b411dd47187049440ca9a6688199795780..1c28fce729beac740f7ee170e375e92b7fe8244b 100644 (file)
 
 #define OSC    24
 
-/* MAIN PLL Fdll = 550 MHZ, */
-#define MPUPLL_M       550
+/* MAIN PLL */
+#ifndef CONFIG_SYS_MPU_CLK
+/* default to 500 MHz */
+#define MPUPLL_M       500
+#else
+#define MPUPLL_M       CONFIG_SYS_MPU_CLK
+#endif
 #define MPUPLL_N       23
 #define MPUPLL_M2      1
 
 
 /* DDR Freq is 266 MHZ for now */
 /* Set Fdll = 400 MHZ , Fdll = M * 2 * CLKINP/ N + 1; clkout = Fdll /(2 * M2) */
+#ifndef CONFIG_SYS_DDR_CLK
 #define DDRPLL_M       266
+#else
+#define DDRPLL_M       CONFIG_SYS_DDR_CLK
+#endif
 #define DDRPLL_N       23
 #define DDRPLL_M2      1
 
+#define DISPPLL_M      200
+#define DISPPLL_N      23
+#define DISPPLL_M2     1
+
 extern void pll_init(void);
 extern void enable_emif_clocks(void);
 
index cd002e632d22383ee9b96f2d6e9ac26fa41f1a6e..963b01fb2b90cb0aeffb40f63d3398ae08f4e703 100644 (file)
 
 #include <asm/arch/hardware.h>
 
-#define BIT(x)                         (1 << x)
-#define CL_BIT(x)                      (0 << x)
+#define BIT(x)                         (1 << (x))
+#define CL_BIT(x)                      (0 << (x))
 
 /* Timer register bits */
 #define TCLR_ST                                BIT(0)  /* Start=1 Stop=0 */
 #define TCLR_AR                                BIT(1)  /* Auto reload */
 #define TCLR_PRE                       BIT(5)  /* Pre-scaler enable */
-#define TCLR_PTV_SHIFT                 (2)     /* Pre-scaler shift value */
+#define TCLR_PTV_SHIFT                 2       /* Pre-scaler shift value */
 #define TCLR_PRE_DISABLE               CL_BIT(5) /* Pre-scalar disable */
 
 /* device type */
 #define GP_DEVICE                      0x3
 
 /* cpu-id for AM33XX family */
-#define AM335X                         0xB944
+#define AM335X_ID                      0xB944
 #define DEVICE_ID                      0x44E10600
 
 /* This gives the status of the boot mode pins on the evm */
-#define SYSBOOT_MASK                   (BIT(0) | BIT(1) | BIT(2)\
-                                       | BIT(3) | BIT(4))
+#define SYSBOOT_MASK                   (BIT(0) | BIT(1) | BIT(2) | \
+                                               BIT(3) | BIT(4))
 
 /* Reset control */
-#ifdef CONFIG_AM33XX
 #define PRM_RSTCTRL                    0x44E00F00
-#endif
+#define PRM_RSTST                      0x44E00F08
 #define PRM_RSTCTRL_RESET              0x01
 
 #ifndef __KERNEL_STRICT_NAMES
@@ -62,7 +61,7 @@
 struct cm_wkuppll {
        unsigned int wkclkstctrl;       /* offset 0x00 */
        unsigned int wkctrlclkctrl;     /* offset 0x04 */
-       unsigned int resv1[1];
+       unsigned int gpio0clkctrl;
        unsigned int wkl4wkclkctrl;     /* offset 0x0c */
        unsigned int resv2[4];
        unsigned int idlestdpllmpu;     /* offset 0x20 */
@@ -72,7 +71,9 @@ struct cm_wkuppll {
        unsigned int idlestdpllddr;     /* offset 0x34 */
        unsigned int resv5[2];
        unsigned int clkseldpllddr;     /* offset 0x40 */
-       unsigned int resv6[4];
+       unsigned int autoidledplldisp;  /* offset 0x44 */
+       unsigned int idlestdplldisp;    /* offset 0x48 */
+       unsigned int resv6[2];
        unsigned int clkseldplldisp;    /* offset 0x54 */
        unsigned int resv7[1];
        unsigned int idlestdpllcore;    /* offset 0x5c */
@@ -96,7 +97,8 @@ struct cm_wkuppll {
        unsigned int resv11[1];
        unsigned int wkup_uart0ctrl;    /* offset 0xB4 */
        unsigned int wkup_i2c0ctrl;     /* offset 0xB8 */
-       unsigned int resv12[7];
+       unsigned int resv12[6];
+       unsigned int wdtimer1ctrl;
        unsigned int divm6dpllcore;     /* offset 0xD8 */
 };
 
@@ -111,11 +113,14 @@ struct cm_perpll {
        unsigned int l3clkstctrl;       /* offset 0x0c */
        unsigned int resv1;
        unsigned int cpgmac0clkctrl;    /* offset 0x14 */
-       unsigned int resv2[4];
+       unsigned int lcdcclkctrl;       /* offset 0x18 */
+       unsigned int usb0clkctrl;       /* offset 0x1c */
+       unsigned int resv2[2];
        unsigned int emifclkctrl;       /* offset 0x28 */
        unsigned int ocmcramclkctrl;    /* offset 0x2c */
        unsigned int gpmcclkctrl;       /* offset 0x30 */
-       unsigned int resv3[2];
+       unsigned int resv3[1];          /* offset 0x34 */
+       unsigned int uart5clkctrl;      /* offset 0x38 */
        unsigned int mmc0clkctrl;       /* offset 0x3C */
        unsigned int elmclkctrl;        /* offset 0x40 */
        unsigned int i2c2clkctrl;       /* offset 0x44 */
@@ -125,16 +130,26 @@ struct cm_perpll {
        unsigned int resv4[3];
        unsigned int l4lsclkctrl;       /* offset 0x60 */
        unsigned int l4fwclkctrl;       /* offset 0x64 */
-       unsigned int resv5[6];
+       unsigned int mcasp1clkctrl;     /* offset 0x68 */
+       unsigned int uart1clkctrl;      /* offset 0x6c */
+       unsigned int uart2clkctrl;      /* offset 0x70 */
+       unsigned int uart3clkctrl;      /* offset 0x74 */
+       unsigned int uart4clkctrl;      /* offset 0x78 */
+       unsigned int timer7clkctrl;     /* offset 0x7c */
        unsigned int timer2clkctrl;     /* offset 0x80 */
-       unsigned int resv6[11];
+       unsigned int resv6[10];
+       unsigned int gpio1clkctrl;      /* offset 0xAC */
        unsigned int gpio2clkctrl;      /* offset 0xB0 */
-       unsigned int resv7[7];
+       unsigned int gpio3clkctrl;      /* offset 0xB4 */
+       unsigned int resv7[6];
        unsigned int emiffwclkctrl;     /* offset 0xD0 */
        unsigned int resv8[2];
        unsigned int l3instrclkctrl;    /* offset 0xDC */
        unsigned int l3clkctrl;         /* Offset 0xE0 */
-       unsigned int resv9[14];
+       unsigned int resv8a[4];
+       unsigned int mmc1clkctrl;       /* Offset 0xF4 */
+       unsigned int mmc2clkctrl;       /* Offset 0xF8 */
+       unsigned int resv9[8];
        unsigned int l4hsclkstctrl;     /* offset 0x11C */
        unsigned int l4hsclkctrl;       /* offset 0x120 */
        unsigned int resv10[8];
@@ -214,8 +229,74 @@ struct ctrl_stat {
        unsigned int statusreg;         /* ofset 0x40 */
 };
 
+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 */
+};
+
 void init_timer(void);
+
+#define clk_get_rate(c,p)                                      \
+       __clk_get_rate(readl(&(c)->clkseldpll##p),              \
+               readl(&(c)->divm2dpll##p))
+
+unsigned long __clk_get_rate(u32 m_n, u32 div_m2);
+
 #endif /* __ASSEMBLY__ */
 #endif /* __KERNEL_STRICT_NAMES */
 
+/* Ethernet MAC ID from EFuse */
+#define MAC_ID0_LO     (CTRL_BASE + 0x630)
+#define MAC_ID0_HI     (CTRL_BASE + 0x634)
+#define MAC_ID1_LO     (CTRL_BASE + 0x638)
+#define MAC_ID1_HI     (CTRL_BASE + 0x63c)
+#define MAC_MII_SEL    (CTRL_BASE + 0x650)
+
 #endif /* _AM33XX_CPU_H */
diff --git a/arch/arm/include/asm/arch-am33xx/da8xx-fb.h b/arch/arm/include/asm/arch-am33xx/da8xx-fb.h
new file mode 100644 (file)
index 0000000..208b232
--- /dev/null
@@ -0,0 +1,126 @@
+/*
+ * Porting to u-boot:
+ *
+ * (C) Copyright 2011
+ * Stefano Babic, DENX Software Engineering, sbabic@denx.de.
+ *
+ * Copyright (C) 2008-2009 MontaVista Software Inc.
+ * Copyright (C) 2008-2009 Texas Instruments Inc
+ *
+ * Based on the LCD driver for TI Avalanche processors written by
+ * Ajay Singh and Shalom Hai.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option)any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public 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 DA8XX_FB_H
+#define DA8XX_FB_H
+
+enum panel_type {
+       QVGA = 0
+};
+
+enum panel_shade {
+       MONOCHROME = 0,
+       COLOR_ACTIVE,
+       COLOR_PASSIVE,
+};
+
+enum raster_load_mode {
+       LOAD_DATA = 1,
+       LOAD_PALETTE,
+};
+
+struct display_panel {
+       enum panel_type panel_type; /* QVGA */
+       int max_bpp;
+       int min_bpp;
+       enum panel_shade panel_shade;
+};
+
+struct da8xx_panel {
+       const char      name[25];       /* Full name <vendor>_<model> */
+       unsigned short  width;
+       unsigned short  height;
+       int             hfp;            /* Horizontal front porch */
+       int             hbp;            /* Horizontal back porch */
+       int             hsw;            /* Horizontal Sync Pulse Width */
+       int             vfp;            /* Vertical front porch */
+       int             vbp;            /* Vertical back porch */
+       int             vsw;            /* Vertical Sync Pulse Width */
+       unsigned int    pxl_clk;        /* Pixel clock */
+       unsigned char   invert_pxl_clk; /* Invert Pixel clock */
+};
+
+struct da8xx_lcdc_platform_data {
+       const char manu_name[10];
+       void *controller_data;
+       const char type[25];
+       void (*panel_power_ctrl)(int);
+};
+
+struct lcd_ctrl_config {
+       const struct display_panel *p_disp_panel;
+
+       /* AC Bias Pin Frequency */
+       int ac_bias;
+
+       /* AC Bias Pin Transitions per Interrupt */
+       int ac_bias_intrpt;
+
+       /* DMA burst size */
+       int dma_burst_sz;
+
+       /* Bits per pixel */
+       int bpp;
+
+       /* FIFO DMA Request Delay */
+       int fdd;
+
+       /* TFT Alternative Signal Mapping (Only for active) */
+       unsigned char tft_alt_mode;
+
+       /* 12 Bit Per Pixel (5-6-5) Mode (Only for passive) */
+       unsigned char stn_565_mode;
+
+       /* Mono 8-bit Mode: 1=D0-D7 or 0=D0-D3 */
+       unsigned char mono_8bit_mode;
+
+       /* Invert line clock */
+       unsigned char invert_line_clock;
+
+       /* Invert frame clock  */
+       unsigned char invert_frm_clock;
+
+       /* Horizontal and Vertical Sync Edge: 0=rising 1=falling */
+       unsigned char sync_edge;
+
+       /* Horizontal and Vertical Sync: Control: 0=ignore */
+       unsigned char sync_ctrl;
+
+       /* Raster Data Order Select: 1=Most-to-least 0=Least-to-most */
+       unsigned char raster_order;
+};
+
+struct lcd_sync_arg {
+       int back_porch;
+       int front_porch;
+       int pulse_width;
+};
+
+void da8xx_fb_disable(void);
+void da8xx_video_init(const struct da8xx_panel *panel, int bits_pixel);
+
+#endif  /* ifndef DA8XX_FB_H */
diff --git a/arch/arm/include/asm/arch-am33xx/ddr3_defs.h b/arch/arm/include/asm/arch-am33xx/ddr3_defs.h
new file mode 100644 (file)
index 0000000..3c67e9a
--- /dev/null
@@ -0,0 +1,29 @@
+/*
+ * Copyright (C) 2012 Lothar Waßmann <LW@KARO-electronics.de>
+ * based on ddr_defs.h Copyright (C) 2010 Texas Instruments
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ * ----------------------------------------------------------------------------
+ *
+ */
+
+#ifndef _DDR3_DEFS_H
+#define _DDR3_DEFS_H
+
+#include <asm/arch/hardware.h>
+
+
+#endif  /* _DDR_DEFS_H */
+
index 388336f9d70a2aab663022acba58a5da30fc860c..0356735316e3806e51412b3d6103eb7dd187152b 100644 (file)
 #include <asm/arch/hardware.h>
 
 /* AM335X EMIF Register values */
-#define EMIF_SDMGT             0x80000000
-#define EMIF_SDRAM             0x00004650
-#define EMIF_PHYCFG            0x2
 #define DDR_PHY_RESET          (0x1 << 10)
 #define DDR_FUNCTIONAL_MODE_EN 0x1
 #define DDR_PHY_READY          (0x1 << 2)
 #define VTP_CTRL_READY         (0x1 << 5)
 #define VTP_CTRL_ENABLE                (0x1 << 6)
 #define VTP_CTRL_LOCK_EN       (0x1 << 4)
-#define VTP_CTRL_START_EN      (0x1)
-#define DDR2_RATIO             0x80
-#define CMD_FORCE              0x00
-#define CMD_DELAY              0x00
-
-#define EMIF_READ_LATENCY      0x05
-#define EMIF_TIM1              0x0666B3D6
-#define EMIF_TIM2              0x143731DA
-#define EMIF_TIM3              0x00000347
-#define EMIF_SDCFG             0x43805332
-#define EMIF_SDREF             0x0000081a
-#define DDR2_DLL_LOCK_DIFF     0x0
-#define DDR2_RD_DQS            0x12
-#define DDR2_PHY_FIFO_WE       0x80
-
-#define DDR2_INVERT_CLKOUT     0x00
-#define DDR2_WR_DQS            0x00
-#define DDR2_PHY_WRLVL         0x00
-#define DDR2_PHY_GATELVL       0x00
-#define DDR2_PHY_WR_DATA       0x40
-#define PHY_RANK0_DELAY                0x01
-#define PHY_DLL_LOCK_DIFF      0x0
-#define DDR_IOCTRL_VALUE       0x18B
+#define VTP_CTRL_START_EN      (0x1 << 0)
 
 /**
  * This structure represents the EMIF registers on AM33XX devices.
@@ -131,6 +106,31 @@ int config_ddr_phy(struct ddr_phy_control *cfg);
 /**
  * This structure represents the DDR registers on AM33XX devices.
  */
+/* data macro cells */
+struct ddr_dt_regs {
+       unsigned int rdsratio0; /* offset 0x0C8 */
+       unsigned int rdsratio1; /* offset 0x0CC */
+       unsigned int resv4[3];
+       unsigned int wdsratio0; /* offset 0x0DC */
+       unsigned int wdsratio1; /* offset 0x0E0 */
+       unsigned int resv5[3];
+       unsigned int wiratio0;  /* offset 0x0F0 */
+       unsigned int wiratio1;  /* offset 0x0F4 */
+       unsigned int wimode0;   /* offset 0x0F8 */
+       unsigned int giratio0;  /* offset 0x0FC */
+       unsigned int giratio1;  /* offset 0x100 */
+       unsigned int gimode0;   /* offset 0x104 */
+       unsigned int fwsratio0; /* offset 0x108 */
+       unsigned int fwsratio1; /* offset 0x10C */
+       unsigned int resv7[4];
+       unsigned int wrsratio0; /* offset 0x120 */
+       unsigned int wrsratio1; /* offset 0x124 */
+       unsigned int resv8[3];
+       unsigned int rdelays0;  /* offset 0x134 */
+       unsigned int dldiff0;   /* offset 0x138 */
+       unsigned int resv9[12];
+};
+
 struct ddr_regs {
        unsigned int resv0[7];
        unsigned int cm0csratio;        /* offset 0x01C */
@@ -151,27 +151,8 @@ struct ddr_regs {
        unsigned int cm2dldiff;         /* offset 0x090 */
        unsigned int cm2iclkout;        /* offset 0x094 */
        unsigned int resv3[12];
-       unsigned int dt0rdsratio0;      /* offset 0x0C8 */
-       unsigned int dt0rdsratio1;      /* offset 0x0CC */
-       unsigned int resv4[3];
-       unsigned int dt0wdsratio0;      /* offset 0x0DC */
-       unsigned int dt0wdsratio1;      /* offset 0x0E0 */
-       unsigned int resv5[3];
-       unsigned int dt0wiratio0;       /* offset 0x0F0 */
-       unsigned int dt0wiratio1;       /* offset 0x0F4 */
-       unsigned int dt0giratio0;       /* offset 0x0FC */
-       unsigned int dt0giratio1;       /* offset 0x100 */
-       unsigned int resv6[1];
-       unsigned int dt0fwsratio0;      /* offset 0x108 */
-       unsigned int dt0fwsratio1;      /* offset 0x10C */
-       unsigned int resv7[4];
-       unsigned int dt0wrsratio0;      /* offset 0x120 */
-       unsigned int dt0wrsratio1;      /* offset 0x124 */
-       unsigned int resv8[3];
-       unsigned int dt0rdelays0;       /* offset 0x134 */
-       unsigned int dt0dldiff0;        /* offset 0x138 */
-       unsigned int resv9[39];
-       unsigned int dt1rdelays0;       /* offset 0x1D8 */
+       struct ddr_dt_regs dt0;
+       struct ddr_dt_regs dt1;
 };
 
 /**
diff --git a/arch/arm/include/asm/arch-am33xx/gpio.h b/arch/arm/include/asm/arch-am33xx/gpio.h
new file mode 100644 (file)
index 0000000..51f8541
--- /dev/null
@@ -0,0 +1,21 @@
+/*
+ * Copyright (c) 2012 Lothar Waßmann <LW@KARO-electronics.de>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT 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 _GPIO_AM33XX_H
+#define _GPIO_AM33XX_H
+
+#include <asm-generic/gpio.h>
+
+#define AM33XX_GPIO_NR(bank, pin)      (((bank) << 5) | (pin))
+
+#endif /* _GPIO_AM33XX_H */
index 0ec22eb918f19b86673047d7ab7098e10b61afe1..e620ab3548d7b47306f920243c4862ac558d2f88 100644 (file)
@@ -21,6 +21,7 @@
 
 /* Module base addresses */
 #define LOW_LEVEL_SRAM_STACK           0x4030B7FC
+#define SRAM0_START                    0x402F0400
 #define UART0_BASE                     0x44E09000
 
 /* DM Timer base addresses */
 #define DM_TIMER7_BASE                 0x4804A000
 
 /* GPIO Base address */
-#define GPIO0_BASE                     0x48032000
+#define GPIO0_BASE                     0x44E07000
 #define GPIO1_BASE                     0x4804C000
 #define GPIO2_BASE                     0x481AC000
+#define GPIO3_BASE                     0x481AE000
 
 /* BCH Error Location Module */
 #define ELM_BASE                       0x48080000
 #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 CPSW_BASE                      0x4A100000
+#define CPSW_MDIO_BASE                 0x4A101000
+
+/* RTC base address */
+#define AM335X_RTC_BASE                        0x44E3E000
+
+extern unsigned long lcdc_clk_rate(void);
+
 #endif /* __AM33XX_HARDWARE_H */
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..198f72b
--- /dev/null
@@ -0,0 +1,181 @@
+/*
+ * (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_
+
+#define CS0            0x0
+#define CS1            0x1 /* mirror CS1 regs appear offset 0x30 from CS0 */
+
+#ifndef __ASSEMBLY__
+enum {
+       STACKED = 0,
+       IP_DDR = 1,
+       COMBO_DDR = 2,
+       IP_SDR = 3,
+};
+#endif /* __ASSEMBLY__ */
+
+#define EARLY_INIT     1
+
+/*
+ * 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):
+ * STNOR - Intel Strata Flash
+ * SMNAND - Samsung NAND
+ * MPDB - H4 MPDB board
+ * SBNOR - Sibley NOR
+ * MNAND - Micron Large page x16 NAND
+ * ONNAND - Samsung One NAND
+ *
+ * include/configs/file.h contains the defn - for all CS we are interested
+ * #define OMAP34XX_GPMC_CSx PART
+ * #define OMAP34XX_GPMC_CSx_SIZE Size
+ * #define OMAP34XX_GPMC_CSx_MAP Map
+ * Where:
+ * x - CS number
+ * PART - Part Name as defined above
+ * SIZE - how big is the mapping to be
+ *   GPMC_SIZE_128M - 0x8
+ *   GPMC_SIZE_64M  - 0xC
+ *   GPMC_SIZE_32M  - 0xE
+ *   GPMC_SIZE_16M  - 0xF
+ * MAP  - Map this CS to which address(GPMC address space)- Absolute address
+ *   >>24 before being used.
+ */
+#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 SMNAND_GPMC_CONFIG1    0x00000800
+#define SMNAND_GPMC_CONFIG2    0x00141400
+#define SMNAND_GPMC_CONFIG3    0x00141400
+#define SMNAND_GPMC_CONFIG4    0x0F010F01
+#define SMNAND_GPMC_CONFIG5    0x010C1414
+#define SMNAND_GPMC_CONFIG6    0x1F0F0A80
+#define SMNAND_GPMC_CONFIG7    0x00000C44
+
+
+#ifdef CONFIG_AM33XX   /* SA 8-Bit Nand */
+#define M_NAND_GPMC_CONFIG1    0x00000800
+#else
+#define M_NAND_GPMC_CONFIG1    0x00001810
+#endif
+#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
+
+#define STNOR_GPMC_CONFIG1     0x3
+#define STNOR_GPMC_CONFIG2     0x00151501
+#define STNOR_GPMC_CONFIG3     0x00060602
+#define STNOR_GPMC_CONFIG4     0x11091109
+#define STNOR_GPMC_CONFIG5     0x01141F1F
+#define STNOR_GPMC_CONFIG6     0x000004c4
+
+#define SIBNOR_GPMC_CONFIG1    0x1200
+#define SIBNOR_GPMC_CONFIG2    0x001f1f00
+#define SIBNOR_GPMC_CONFIG3    0x00080802
+#define SIBNOR_GPMC_CONFIG4    0x1C091C09
+#define SIBNOR_GPMC_CONFIG5    0x01131F1F
+#define SIBNOR_GPMC_CONFIG6    0x1F0F03C2
+
+#define SDPV2_MPDB_GPMC_CONFIG1        0x00611200
+#define SDPV2_MPDB_GPMC_CONFIG2        0x001F1F01
+#define SDPV2_MPDB_GPMC_CONFIG3        0x00080803
+#define SDPV2_MPDB_GPMC_CONFIG4        0x1D091D09
+#define SDPV2_MPDB_GPMC_CONFIG5        0x041D1F1F
+#define SDPV2_MPDB_GPMC_CONFIG6        0x1D0904C4
+
+#define MPDB_GPMC_CONFIG1      0x00011000
+#define MPDB_GPMC_CONFIG2      0x001f1f01
+#define MPDB_GPMC_CONFIG3      0x00080803
+#define MPDB_GPMC_CONFIG4      0x1c0b1c0a
+#define MPDB_GPMC_CONFIG5      0x041f1F1F
+#define MPDB_GPMC_CONFIG6      0x1F0F04C4
+
+#define P2_GPMC_CONFIG1        0x0
+#define P2_GPMC_CONFIG2        0x0
+#define P2_GPMC_CONFIG3        0x0
+#define P2_GPMC_CONFIG4        0x0
+#define P2_GPMC_CONFIG5        0x0
+#define P2_GPMC_CONFIG6        0x0
+
+#define ONENAND_GPMC_CONFIG1   0x00001200
+#define ONENAND_GPMC_CONFIG2   0x000F0F01
+#define ONENAND_GPMC_CONFIG3   0x00030301
+#define ONENAND_GPMC_CONFIG4   0x0F040F04
+#define ONENAND_GPMC_CONFIG5   0x010F1010
+#define ONENAND_GPMC_CONFIG6   0x1F060000
+
+#define NET_GPMC_CONFIG1       0x00001000
+#define NET_GPMC_CONFIG2       0x001e1e01
+#define NET_GPMC_CONFIG3       0x00080300
+#define NET_GPMC_CONFIG4       0x1c091c09
+#define NET_GPMC_CONFIG5       0x04181f1f
+#define NET_GPMC_CONFIG6       0x00000FCF
+#define NET_GPMC_CONFIG7       0x00000f6c
+
+/* 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       NAND_BASE
+#define PISMO1_NAND_SIZE       GPMC_SIZE_256M
+
+#endif /* endif _MEM_H_ */
+
index 26cc300e70fc170746b766b91d4e6ff81954f9bf..b387237ee02f4fa5dd2d769ce8ea6442781ea74c 100644 (file)
 /*
  * OMAP HSMMC register definitions
  */
-#define OMAP_HSMMC1_BASE               0x48060100
+#define OMAP_HSMMC1_BASE               0x48060000
 #define OMAP_HSMMC2_BASE               0x481D8000
-#define OMAP_HSMMC3_BASE               0x47C24000
+#define OMAP_HSMMC3_BASE               0x47810000
 
 typedef struct hsmmc {
-       unsigned char res1[0x10];
-       unsigned int sysconfig;         /* 0x10 */
-       unsigned int sysstatus;         /* 0x14 */
+       unsigned char res1[0x110];
+       unsigned int sysconfig;         /* 0x110 */
+       unsigned int sysstatus;         /* 0x114 */
        unsigned char res2[0x14];
-       unsigned int con;               /* 0x2C */
+       unsigned int con;               /* 0x12C */
        unsigned char res3[0xD4];
-       unsigned int blk;               /* 0x104 */
-       unsigned int arg;               /* 0x108 */
-       unsigned int cmd;               /* 0x10C */
-       unsigned int rsp10;             /* 0x110 */
-       unsigned int rsp32;             /* 0x114 */
-       unsigned int rsp54;             /* 0x118 */
-       unsigned int rsp76;             /* 0x11C */
-       unsigned int data;              /* 0x120 */
-       unsigned int pstate;            /* 0x124 */
-       unsigned int hctl;              /* 0x128 */
-       unsigned int sysctl;            /* 0x12C */
-       unsigned int stat;              /* 0x130 */
-       unsigned int ie;                /* 0x134 */
+       unsigned int blk;               /* 0x204 */
+       unsigned int arg;               /* 0x208 */
+       unsigned int cmd;               /* 0x20C */
+       unsigned int rsp10;             /* 0x210 */
+       unsigned int rsp32;             /* 0x214 */
+       unsigned int rsp54;             /* 0x218 */
+       unsigned int rsp76;             /* 0x21C */
+       unsigned int data;              /* 0x220 */
+       unsigned int pstate;            /* 0x224 */
+       unsigned int hctl;              /* 0x228 */
+       unsigned int sysctl;            /* 0x22C */
+       unsigned int stat;              /* 0x230 */
+       unsigned int ie;                /* 0x234 */
        unsigned char res4[0x8];
-       unsigned int capa;              /* 0x140 */
+       unsigned int capa;              /* 0x240 */
 } hsmmc_t;
 
 /*
@@ -72,7 +72,7 @@ typedef struct hsmmc {
 #define BCE_DISABLE                    (0x0 << 1)
 #define BCE_ENABLE                     (0x1 << 1)
 #define ACEN_DISABLE                   (0x0 << 2)
-#define DDIR_OFFSET                    (4)
+#define DDIR_OFFSET                    4
 #define DDIR_MASK                      (0x1 << 4)
 #define DDIR_WRITE                     (0x0 << 4)
 #define DDIR_READ                      (0x1 << 4)
@@ -88,19 +88,19 @@ typedef struct hsmmc {
 #define CCCE_CHECK                     (0x1 << 19)
 #define CICE_NOCHECK                   (0x0 << 20)
 #define CICE_CHECK                     (0x1 << 20)
-#define DP_OFFSET                      (21)
+#define DP_OFFSET                      21
 #define DP_MASK                                (0x1 << 21)
 #define DP_NO_DATA                     (0x0 << 21)
 #define DP_DATA                                (0x1 << 21)
 #define CMD_TYPE_NORMAL                        (0x0 << 22)
-#define INDEX_OFFSET                   (24)
+#define INDEX_OFFSET                   24
 #define INDEX_MASK                     (0x3f << 24)
-#define INDEX(i)                       (i << 24)
+#define INDEX(i)                       ((i) << 24)
 #define DATI_MASK                      (0x1 << 1)
 #define CMDI_MASK                      (0x1 << 0)
 #define DTW_1_BITMODE                  (0x0 << 1)
 #define DTW_4_BITMODE                  (0x1 << 1)
-#define DTW_8_BITMODE                   (0x1 << 5) /* CON[DW8]*/
+#define DTW_8_BITMODE                  (0x1 << 5) /* CON[DW8]*/
 #define SDBP_PWROFF                    (0x0 << 8)
 #define SDBP_PWRON                     (0x1 << 8)
 #define SDVS_1V8                       (0x5 << 9)
@@ -113,7 +113,7 @@ typedef struct hsmmc {
 #define CEN_MASK                       (0x1 << 2)
 #define CEN_DISABLE                    (0x0 << 2)
 #define CEN_ENABLE                     (0x1 << 2)
-#define CLKD_OFFSET                    (6)
+#define CLKD_OFFSET                    6
 #define CLKD_MASK                      (0x3FF << 6)
 #define DTO_MASK                       (0xF << 16)
 #define DTO_15THDTO                    (0xE << 16)
@@ -157,7 +157,7 @@ typedef struct hsmmc {
 #define MMC_CLOCK_REFERENCE    96 /* MHz */
 
 #define mmc_reg_out(addr, mask, val)\
-       writel((readl(addr) & (~(mask))) | ((val) & (mask)), (addr))
+       writel((readl(addr) & (~(mask))) | ((val) & (mask)), addr)
 
 int omap_mmc_init(int dev_index, uint host_caps_mask, uint f_max);
 
diff --git a/arch/arm/include/asm/arch-am33xx/nand.h b/arch/arm/include/asm/arch-am33xx/nand.h
new file mode 100644 (file)
index 0000000..cde2da2
--- /dev/null
@@ -0,0 +1,219 @@
+/*
+ * (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_OMAP_GPMC_H
+#define __ASM_ARCH_OMAP_GPMC_H
+
+#include <linux/mtd/nand.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 = 4 * 13,                                             \
+       .eccpos = {  2,  3,  4,  5,  6,  7,  8,  9, 10, 11, 12, 13, 14, \
+                   16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, \
+                   30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, \
+                   44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, \
+               },                                                      \
+       .oobfree = {                                                    \
+               { .offset = 58, .length = 6, },                         \
+       },                                                              \
+}
+#endif
+
+/* Large Page x16 NAND device Layout */
+#ifdef GPMC_NAND_ECC_LP_x16_LAYOUT
+#define GPMC_NAND_HW_ECC_LAYOUT {                      \
+       .eccbytes = 4 * 3,                              \
+       .eccpos = { 2, 3, 4,                            \
+                   5, 6, 7,                            \
+                   8, 9, 10,                           \
+                   11, 12, 13,                         \
+               },                                      \
+       .oobfree = {                                    \
+               { .offset = 14, .length = 50, },        \
+       },                                              \
+}
+#endif
+
+/* NAND device layout in synch with the kernel */
+#ifdef GPMC_NAND_ECC_LP_x16_LAYOUT
+#define GPMC_NAND_HW_ECC_LAYOUT_KERNEL {               \
+       .eccbytes = 4 * 3,                              \
+       .eccpos = { 40, 41, 42,                         \
+                   43, 44, 45,                         \
+                   46, 47, 48,                         \
+                   49, 50, 51,                         \
+               },                                      \
+       .oobfree = {                                    \
+               { .offset = 2, .length = 38, },         \
+       },                                              \
+}
+#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 = 58, .length = 6, },         \
+       },                                              \
+}
+#endif
+
+#define GPMC_NAND_HW_BCH4_ECC_LAYOUT {                 \
+       .eccbytes = 4 * 8,                              \
+       .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 = 4 * 14,                                                 \
+       .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 = 4 * 26,                                                   \
+       .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, },                              \
+       },                                                                    \
+}
+
+/*
+ * 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 __KERNEL_STRICT_NAMES
+#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);
+void am33xx_nand_switch_ecc(nand_ecc_modes_t hardware, int32_t mode);
+#endif /* __ASSEMBLY__ */
+#endif /* __KERNEL_STRICT_NAMES */
+
+
+#endif /* __ASM_ARCH_OMAP_GPMC_H */
index 6c58f1b30fd6fac7e57e50f8b052fcd01d6375bd..bb0ab40c8c3ec8a739c3c120c2fa1c74a0828aa7 100644 (file)
@@ -31,3 +31,6 @@ int print_cpuinfo(void);
 u32 get_device_type(void);
 void setup_clocks_for_console(void);
 #endif
+
+void gpmc_init(void);
+void sdelay(unsigned long);
index ff0f6415d8b4082d9b0d5b8f9de3cd92fcdffe80..637fb4bd145384fd8cfdedb04577b54dfba242fa 100644 (file)
@@ -33,5 +33,8 @@ unsigned long get_arm_clk(void);
 unsigned long get_pwm_clk(void);
 unsigned long get_uart_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);
 
 #endif
index 89f2c2e3e904380b508b44e25d6fa7744a008b12..ac4ddc7354f644016a67e1428824774a84e33ad3 100644 (file)
@@ -29,6 +29,7 @@
 /* EXYNOS4 */
 #define EXYNOS4_GPIO_PART3_BASE                0x03860000
 #define EXYNOS4_PRO_ID                 0x10000000
+#define EXYNOS4_SYSREG_BASE            0x10010000
 #define EXYNOS4_POWER_BASE             0x10020000
 #define EXYNOS4_SWRESET                        0x10020400
 #define EXYNOS4_CLOCK_BASE             0x10030000
@@ -40,6 +41,7 @@
 #define EXYNOS4_GPIO_PART2_BASE                0x11000000
 #define EXYNOS4_GPIO_PART1_BASE                0x11400000
 #define EXYNOS4_FIMD_BASE              0x11C00000
+#define EXYNOS4_MIPI_DSIM_BASE         0x11C80000
 #define EXYNOS4_USBOTG_BASE            0x12480000
 #define EXYNOS4_MMC_BASE               0x12510000
 #define EXYNOS4_SROMC_BASE             0x12570000
@@ -65,6 +67,7 @@
 #define EXYNOS5_GPIO_PART3_BASE                0x10D10000
 #define EXYNOS5_DMC_CTRL_BASE          0x10DD0000
 #define EXYNOS5_GPIO_PART1_BASE                0x11400000
+#define EXYNOS5_MIPI_DSIM_BASE         0x11D00000
 #define EXYNOS5_MMC_BASE               0x12200000
 #define EXYNOS5_SROMC_BASE             0x12250000
 #define EXYNOS5_USBOTG_BASE            0x12480000
@@ -127,7 +130,9 @@ static inline unsigned int samsung_get_base_##device(void)  \
 
 SAMSUNG_BASE(adc, ADC_BASE)
 SAMSUNG_BASE(clock, CLOCK_BASE)
+SAMSUNG_BASE(sysreg, SYSREG_BASE)
 SAMSUNG_BASE(fimd, FIMD_BASE)
+SAMSUNG_BASE(mipi_dsim, MIPI_DSIM_BASE)
 SAMSUNG_BASE(gpio_part1, GPIO_PART1_BASE)
 SAMSUNG_BASE(gpio_part2, GPIO_PART2_BASE)
 SAMSUNG_BASE(gpio_part3, GPIO_PART3_BASE)
diff --git a/arch/arm/include/asm/arch-exynos/dsim.h b/arch/arm/include/asm/arch-exynos/dsim.h
new file mode 100644 (file)
index 0000000..e148aca
--- /dev/null
@@ -0,0 +1,181 @@
+/*
+ * Copyright (C) 2012 Samsung Electronics
+ *
+ * Author: InKi Dae <inki.dae@samsung.com>
+ * Author: Donghwa Lee <dh09.lee@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_ARM_ARCH_DSIM_H_
+#define __ASM_ARM_ARCH_DSIM_H_
+
+#ifndef __ASSEMBLY__
+
+struct exynos_mipi_dsim {
+       unsigned int    status;
+       unsigned int    swrst;
+       unsigned int    clkctrl;
+       unsigned int    timeout;
+       unsigned int    config;
+       unsigned int    escmode;
+       unsigned int    mdresol;
+       unsigned int    mvporch;
+       unsigned int    mhporch;
+       unsigned int    msync;
+       unsigned int    sdresol;
+       unsigned int    intsrc;
+       unsigned int    intmsk;
+       unsigned int    pkthdr;
+       unsigned int    payload;
+       unsigned int    rxfifo;
+       unsigned int    fifothld;
+       unsigned int    fifoctrl;
+       unsigned int    memacchr;
+       unsigned int    pllctrl;
+       unsigned int    plltmr;
+       unsigned int    phyacchr;
+       unsigned int    phyacchr1;
+};
+
+#endif /* __ASSEMBLY__ */
+
+/*
+ * Bit Definitions
+ */
+/* DSIM_STATUS */
+#define DSIM_STOP_STATE_DAT(x) (((x) & 0xf) << 0)
+#define DSIM_STOP_STATE_CLK    (1 << 8)
+#define DSIM_TX_READY_HS_CLK   (1 << 10)
+#define DSIM_PLL_STABLE                (1 << 31)
+
+/* DSIM_SWRST */
+#define DSIM_FUNCRST           (1 << 16)
+#define DSIM_SWRST             (1 << 0)
+
+/* EXYNOS_DSIM_TIMEOUT */
+#define DSIM_LPDR_TOUT_SHIFT   (0)
+#define DSIM_BTA_TOUT_SHIFT    (16)
+
+/* EXYNOS_DSIM_CLKCTRL */
+#define DSIM_LANE_ESC_CLKEN_SHIFT      (19)
+#define DSIM_BYTE_CLKEN_SHIFT          (24)
+#define DSIM_BYTE_CLK_SRC_SHIFT                (25)
+#define DSIM_PLL_BYPASS_SHIFT          (27)
+#define DSIM_ESC_CLKEN_SHIFT           (28)
+#define DSIM_TX_REQUEST_HSCLK_SHIFT    (31)
+#define DSIM_LANE_ESC_CLKEN(x)         (((x) & 0x1f) << \
+                                               DSIM_LANE_ESC_CLKEN_SHIFT)
+#define DSIM_BYTE_CLK_ENABLE           (1 << DSIM_BYTE_CLKEN_SHIFT)
+#define DSIM_BYTE_CLK_DISABLE          (0 << DSIM_BYTE_CLKEN_SHIFT)
+#define DSIM_PLL_BYPASS_EXTERNAL       (1 << DSIM_PLL_BYPASS_SHIFT)
+#define DSIM_ESC_CLKEN_ENABLE          (1 << DSIM_ESC_CLKEN_SHIFT)
+#define DSIM_ESC_CLKEN_DISABLE         (0 << DSIM_ESC_CLKEN_SHIFT)
+
+/* EXYNOS_DSIM_CONFIG */
+#define DSIM_NUM_OF_DATALANE_SHIFT     (5)
+#define DSIM_SUBPIX_SHIFT              (8)
+#define DSIM_MAINPIX_SHIFT             (12)
+#define DSIM_SUBVC_SHIFT               (16)
+#define DSIM_MAINVC_SHIFT              (18)
+#define DSIM_HSA_MODE_SHIFT            (20)
+#define DSIM_HBP_MODE_SHIFT            (21)
+#define DSIM_HFP_MODE_SHIFT            (22)
+#define DSIM_HSE_MODE_SHIFT            (23)
+#define DSIM_AUTO_MODE_SHIFT           (24)
+#define DSIM_VIDEO_MODE_SHIFT          (25)
+#define DSIM_BURST_MODE_SHIFT          (26)
+#define DSIM_EOT_PACKET_SHIFT          (28)
+#define DSIM_AUTO_FLUSH_SHIFT          (29)
+#define DSIM_LANE_ENx(x)               (((x) & 0x1f) << 0)
+
+#define DSIM_NUM_OF_DATA_LANE(x)       ((x) << DSIM_NUM_OF_DATALANE_SHIFT)
+
+/* EXYNOS_DSIM_ESCMODE */
+#define DSIM_TX_LPDT_SHIFT             (6)
+#define DSIM_CMD_LPDT_SHIFT            (7)
+#define DSIM_TX_LPDT_LP                        (1 << DSIM_TX_LPDT_SHIFT)
+#define DSIM_CMD_LPDT_LP               (1 << DSIM_CMD_LPDT_SHIFT)
+#define DSIM_STOP_STATE_CNT_SHIFT      (21)
+#define DSIM_FORCE_STOP_STATE_SHIFT    (20)
+
+/* EXYNOS_DSIM_MDRESOL */
+#define DSIM_MAIN_STAND_BY             (1 << 31)
+#define DSIM_MAIN_VRESOL(x)            (((x) & 0x7ff) << 16)
+#define DSIM_MAIN_HRESOL(x)            (((x) & 0X7ff) << 0)
+
+/* EXYNOS_DSIM_MVPORCH */
+#define DSIM_CMD_ALLOW_SHIFT           (28)
+#define DSIM_STABLE_VFP_SHIFT          (16)
+#define DSIM_MAIN_VBP_SHIFT            (0)
+#define DSIM_CMD_ALLOW_MASK            (0xf << DSIM_CMD_ALLOW_SHIFT)
+#define DSIM_STABLE_VFP_MASK           (0x7ff << DSIM_STABLE_VFP_SHIFT)
+#define DSIM_MAIN_VBP_MASK             (0x7ff << DSIM_MAIN_VBP_SHIFT)
+
+/* EXYNOS_DSIM_MHPORCH */
+#define DSIM_MAIN_HFP_SHIFT            (16)
+#define DSIM_MAIN_HBP_SHIFT            (0)
+#define DSIM_MAIN_HFP_MASK             ((0xffff) << DSIM_MAIN_HFP_SHIFT)
+#define DSIM_MAIN_HBP_MASK             ((0xffff) << DSIM_MAIN_HBP_SHIFT)
+
+/* EXYNOS_DSIM_MSYNC */
+#define DSIM_MAIN_VSA_SHIFT            (22)
+#define DSIM_MAIN_HSA_SHIFT            (0)
+#define DSIM_MAIN_VSA_MASK             ((0x3ff) << DSIM_MAIN_VSA_SHIFT)
+#define DSIM_MAIN_HSA_MASK             ((0xffff) << DSIM_MAIN_HSA_SHIFT)
+
+/* EXYNOS_DSIM_SDRESOL */
+#define DSIM_SUB_STANDY_SHIFT          (31)
+#define DSIM_SUB_VRESOL_SHIFT          (16)
+#define DSIM_SUB_HRESOL_SHIFT          (0)
+#define DSIM_SUB_STANDY_MASK           ((0x1) << DSIM_SUB_STANDY_SHIFT)
+#define DSIM_SUB_VRESOL_MASK           ((0x7ff) << DSIM_SUB_VRESOL_SHIFT)
+#define DSIM_SUB_HRESOL_MASK           ((0x7ff) << DSIM_SUB_HRESOL_SHIFT)
+
+/* EXYNOS_DSIM_INTSRC */
+#define INTSRC_FRAME_DONE              (1 << 24)
+#define INTSRC_PLL_STABLE              (1 << 31)
+#define INTSRC_SWRST_RELEASE           (1 << 30)
+
+/* EXYNOS_DSIM_INTMSK */
+#define INTMSK_FRAME_DONE              (1 << 24)
+
+/* EXYNOS_DSIM_FIFOCTRL */
+#define SFR_HEADER_EMPTY               (1 << 22)
+
+/* EXYNOS_DSIM_PKTHDR */
+#define DSIM_PKTHDR_DI(x)              (((x) & 0x3f) << 0)
+#define DSIM_PKTHDR_DAT0(x)            ((x) << 8)
+#define DSIM_PKTHDR_DAT1(x)            ((x) << 16)
+
+/* EXYNOS_DSIM_PHYACCHR */
+#define DSIM_AFC_CTL(x)                        (((x) & 0x7) << 5)
+#define DSIM_AFC_CTL_SHIFT             (5)
+#define DSIM_AFC_EN                    (1 << 14)
+
+/* EXYNOS_DSIM_PHYACCHR1 */
+#define DSIM_DPDN_SWAP_DATA_SHIFT      (0)
+
+/* EXYNOS_DSIM_PLLCTRL */
+#define DSIM_SCALER_SHIFT              (1)
+#define DSIM_MAIN_SHIFT                        (4)
+#define DSIM_PREDIV_SHIFT              (13)
+#define DSIM_PRECTRL_SHIFT             (20)
+#define DSIM_PLL_EN_SHIFT              (23)
+#define DSIM_FREQ_BAND_SHIFT           (24)
+#define DSIM_ZEROCTRL_SHIFT            (28)
+
+#endif
diff --git a/arch/arm/include/asm/arch-exynos/fb.h b/arch/arm/include/asm/arch-exynos/fb.h
new file mode 100644 (file)
index 0000000..b10b0da
--- /dev/null
@@ -0,0 +1,446 @@
+/*
+ * (C) Copyright 2012 Samsung Electronics
+ * Donghwa Lee <dh09.lee@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
+ * aint with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ */
+
+#ifndef __ASM_ARM_ARCH_FB_H_
+#define __ASM_ARM_ARCH_FB_H_
+
+#ifndef __ASSEMBLY__
+struct exynos4_fb {
+       unsigned int vidcon0;
+       unsigned int vidcon1;
+       unsigned int vidcon2;
+       unsigned int vidcon3;
+       unsigned int vidtcon0;
+       unsigned int vidtcon1;
+       unsigned int vidtcon2;
+       unsigned int vidtcon3;
+       unsigned int wincon0;
+       unsigned int wincon1;
+       unsigned int wincon2;
+       unsigned int wincon3;
+       unsigned int wincon4;
+
+       unsigned int winshmap;
+       unsigned int res1;
+
+       unsigned int winchmap2;
+       unsigned int vidosd0a;
+       unsigned int vidosd0b;
+       unsigned int vidosd0c;
+       unsigned int res2;
+
+       unsigned int vidosd1a;
+       unsigned int vidosd1b;
+       unsigned int vidosd1c;
+       unsigned int vidosd1d;
+
+       unsigned int vidosd2a;
+       unsigned int vidosd2b;
+       unsigned int vidosd2c;
+       unsigned int vidosd2d;
+
+       unsigned int vidosd3a;
+       unsigned int vidosd3b;
+       unsigned int vidosd3c;
+       unsigned int res3;
+
+       unsigned int vidosd4a;
+       unsigned int vidosd4b;
+       unsigned int vidosd4c;
+       unsigned int res4[5];
+
+       unsigned int vidw00add0b0;
+       unsigned int vidw00add0b1;
+       unsigned int vidw01add0b0;
+       unsigned int vidw01add0b1;
+
+       unsigned int vidw02add0b0;
+       unsigned int vidw02add0b1;
+       unsigned int vidw03add0b0;
+       unsigned int vidw03add0b1;
+       unsigned int vidw04add0b0;
+       unsigned int vidw04add0b1;
+       unsigned int res5[2];
+
+       unsigned int vidw00add1b0;
+       unsigned int vidw00add1b1;
+       unsigned int vidw01add1b0;
+       unsigned int vidw01add1b1;
+
+       unsigned int vidw02add1b0;
+       unsigned int vidw02add1b1;
+       unsigned int vidw03add1b0;
+       unsigned int vidw03add1b1;
+
+       unsigned int vidw04add1b0;
+       unsigned int vidw04add1b1;
+       unsigned int res7[2];
+
+       unsigned int vidw00add2;
+       unsigned int vidw01add2;
+       unsigned int vidw02add2;
+       unsigned int vidw03add2;
+       unsigned int vidw04add2;
+       unsigned int res8[7];
+
+       unsigned int vidintcon0;
+       unsigned int vidintcon1;
+       unsigned int res9[1];
+
+       unsigned int w1keycon0;
+       unsigned int w1keycon1;
+       unsigned int w2keycon0;
+       unsigned int w2keycon1;
+       unsigned int w3keycon0;
+       unsigned int w3keycon1;
+       unsigned int w4keycon0;
+       unsigned int w4keycon1;
+
+       unsigned int w1keyalpha;
+       unsigned int w2keyalpha;
+       unsigned int w3keyalpha;
+       unsigned int w4keyalpha;
+
+       unsigned int dithmode;
+       unsigned int res10[2];
+
+       unsigned int win0map;
+       unsigned int win1map;
+       unsigned int win2map;
+       unsigned int win3map;
+       unsigned int win4map;
+       unsigned int res11[1];
+
+       unsigned int wpalcon_h;
+       unsigned int wpalcon_l;
+
+       unsigned int trigcon;
+       unsigned int res12[2];
+
+       unsigned int i80ifcona0;
+       unsigned int i80ifcona1;
+       unsigned int i80ifconb0;
+       unsigned int i80ifconb1;
+
+       unsigned int colorgaincon;
+       unsigned int res13[2];
+
+       unsigned int ldi_cmdcon0;
+       unsigned int ldi_cmdcon1;
+       unsigned int res14[1];
+
+       /* To be updated */
+
+       unsigned char res15[156];
+       unsigned int dualrgb;
+};
+#endif
+
+/*
+ *  Register offsets
+*/
+#define EXYNOS_WINCON(x)                               (x * 0x04)
+#define EXYNOS_VIDOSD(x)                               (x * 0x10)
+#define EXYNOS_BUFFER_OFFSET(x)                                (x * 0x08)
+#define EXYNOS_BUFFER_SIZE(x)                          (x * 0x04)
+
+/*
+ * Bit Definitions
+*/
+
+/* VIDCON0 */
+#define EXYNOS_VIDCON0_DSI_DISABLE                     (0 << 30)
+#define EXYNOS_VIDCON0_DSI_ENABLE                      (1 << 30)
+#define EXYNOS_VIDCON0_SCAN_PROGRESSIVE                        (0 << 29)
+#define EXYNOS_VIDCON0_SCAN_INTERLACE                  (1 << 29)
+#define EXYNOS_VIDCON0_SCAN_MASK                       (1 << 29)
+#define EXYNOS_VIDCON0_VIDOUT_RGB                      (0 << 26)
+#define EXYNOS_VIDCON0_VIDOUT_ITU                      (1 << 26)
+#define EXYNOS_VIDCON0_VIDOUT_I80LDI0                  (2 << 26)
+#define EXYNOS_VIDCON0_VIDOUT_I80LDI1                  (3 << 26)
+#define EXYNOS_VIDCON0_VIDOUT_WB_RGB                   (4 << 26)
+#define EXYNOS_VIDCON0_VIDOUT_WB_I80LDI0               (6 << 26)
+#define EXYNOS_VIDCON0_VIDOUT_WB_I80LDI1               (7 << 26)
+#define EXYNOS_VIDCON0_VIDOUT_MASK                     (7 << 26)
+#define EXYNOS_VIDCON0_PNRMODE_RGB_P                   (0 << 17)
+#define EXYNOS_VIDCON0_PNRMODE_BGR_P                   (1 << 17)
+#define EXYNOS_VIDCON0_PNRMODE_RGB_S                   (2 << 17)
+#define EXYNOS_VIDCON0_PNRMODE_BGR_S                   (3 << 17)
+#define EXYNOS_VIDCON0_PNRMODE_MASK                    (3 << 17)
+#define EXYNOS_VIDCON0_PNRMODE_SHIFT                   (17)
+#define EXYNOS_VIDCON0_CLKVALUP_ALWAYS                 (0 << 16)
+#define EXYNOS_VIDCON0_CLKVALUP_START_FRAME            (1 << 16)
+#define EXYNOS_VIDCON0_CLKVALUP_MASK                   (1 << 16)
+#define EXYNOS_VIDCON0_CLKVAL_F(x)                     (((x) & 0xff) << 6)
+#define EXYNOS_VIDCON0_VCLKEN_NORMAL                   (0 << 5)
+#define EXYNOS_VIDCON0_VCLKEN_FREERUN                  (1 << 5)
+#define EXYNOS_VIDCON0_VCLKEN_MASK                     (1 << 5)
+#define EXYNOS_VIDCON0_CLKDIR_DIRECTED                 (0 << 4)
+#define EXYNOS_VIDCON0_CLKDIR_DIVIDED                  (1 << 4)
+#define EXYNOS_VIDCON0_CLKDIR_MASK                     (1 << 4)
+#define EXYNOS_VIDCON0_CLKSEL_HCLK                     (0 << 2)
+#define EXYNOS_VIDCON0_CLKSEL_SCLK                     (1 << 2)
+#define EXYNOS_VIDCON0_CLKSEL_MASK                     (1 << 2)
+#define EXYNOS_VIDCON0_ENVID_ENABLE                    (1 << 1)
+#define EXYNOS_VIDCON0_ENVID_DISABLE                   (0 << 1)
+#define EXYNOS_VIDCON0_ENVID_F_ENABLE                  (1 << 0)
+#define EXYNOS_VIDCON0_ENVID_F_DISABLE                 (0 << 0)
+
+/* VIDCON1 */
+#define EXYNOS_VIDCON1_IVCLK_FALLING_EDGE              (0 << 7)
+#define EXYNOS_VIDCON1_IVCLK_RISING_EDGE               (1 << 7)
+#define EXYNOS_VIDCON1_IHSYNC_NORMAL                   (0 << 6)
+#define EXYNOS_VIDCON1_IHSYNC_INVERT                   (1 << 6)
+#define EXYNOS_VIDCON1_IVSYNC_NORMAL                   (0 << 5)
+#define EXYNOS_VIDCON1_IVSYNC_INVERT                   (1 << 5)
+#define EXYNOS_VIDCON1_IVDEN_NORMAL                    (0 << 4)
+#define EXYNOS_VIDCON1_IVDEN_INVERT                    (1 << 4)
+
+/* VIDCON2 */
+#define EXYNOS_VIDCON2_EN601_DISABLE                   (0 << 23)
+#define EXYNOS_VIDCON2_EN601_ENABLE                    (1 << 23)
+#define EXYNOS_VIDCON2_EN601_MASK                      (1 << 23)
+#define EXYNOS_VIDCON2_WB_DISABLE                      (0 << 15)
+#define EXYNOS_VIDCON2_WB_ENABLE                       (1 << 15)
+#define EXYNOS_VIDCON2_WB_MASK                         (1 << 15)
+#define EXYNOS_VIDCON2_TVFORMATSEL_HW                  (0 << 14)
+#define EXYNOS_VIDCON2_TVFORMATSEL_SW                  (1 << 14)
+#define EXYNOS_VIDCON2_TVFORMATSEL_MASK                        (1 << 14)
+#define EXYNOS_VIDCON2_TVFORMATSEL_YUV422              (1 << 12)
+#define EXYNOS_VIDCON2_TVFORMATSEL_YUV444              (2 << 12)
+#define EXYNOS_VIDCON2_TVFORMATSEL_YUV_MASK            (3 << 12)
+#define EXYNOS_VIDCON2_ORGYUV_YCBCR                    (0 << 8)
+#define EXYNOS_VIDCON2_ORGYUV_CBCRY                    (1 << 8)
+#define EXYNOS_VIDCON2_ORGYUV_MASK                     (1 << 8)
+#define EXYNOS_VIDCON2_YUVORD_CBCR                     (0 << 7)
+#define EXYNOS_VIDCON2_YUVORD_CRCB                     (1 << 7)
+#define EXYNOS_VIDCON2_YUVORD_MASK                     (1 << 7)
+
+/* PRTCON */
+#define EXYNOS_PRTCON_UPDATABLE                                (0 << 11)
+#define EXYNOS_PRTCON_PROTECT                          (1 << 11)
+
+/* VIDTCON0 */
+#define EXYNOS_VIDTCON0_VBPDE(x)                       (((x) & 0xff) << 24)
+#define EXYNOS_VIDTCON0_VBPD(x)                                (((x) & 0xff) << 16)
+#define EXYNOS_VIDTCON0_VFPD(x)                                (((x) & 0xff) << 8)
+#define EXYNOS_VIDTCON0_VSPW(x)                                (((x) & 0xff) << 0)
+
+/* VIDTCON1 */
+#define EXYNOS_VIDTCON1_VFPDE(x)                       (((x) & 0xff) << 24)
+#define EXYNOS_VIDTCON1_HBPD(x)                                (((x) & 0xff) << 16)
+#define EXYNOS_VIDTCON1_HFPD(x)                                (((x) & 0xff) << 8)
+#define EXYNOS_VIDTCON1_HSPW(x)                                (((x) & 0xff) << 0)
+
+/* VIDTCON2 */
+#define EXYNOS_VIDTCON2_LINEVAL(x)                     (((x) & 0x7ff) << 11)
+#define EXYNOS_VIDTCON2_HOZVAL(x)                      (((x) & 0x7ff) << 0)
+
+/* Window 0~4 Control - WINCONx */
+#define EXYNOS_WINCON_DATAPATH_DMA                     (0 << 22)
+#define EXYNOS_WINCON_DATAPATH_LOCAL                   (1 << 22)
+#define EXYNOS_WINCON_DATAPATH_MASK                    (1 << 22)
+#define EXYNOS_WINCON_BUFSEL_0                         (0 << 20)
+#define EXYNOS_WINCON_BUFSEL_1                         (1 << 20)
+#define EXYNOS_WINCON_BUFSEL_MASK                      (1 << 20)
+#define EXYNOS_WINCON_BUFSEL_SHIFT                     (20)
+#define EXYNOS_WINCON_BUFAUTO_DISABLE                  (0 << 19)
+#define EXYNOS_WINCON_BUFAUTO_ENABLE                   (1 << 19)
+#define EXYNOS_WINCON_BUFAUTO_MASK                     (1 << 19)
+#define EXYNOS_WINCON_BITSWP_DISABLE                   (0 << 18)
+#define EXYNOS_WINCON_BITSWP_ENABLE                    (1 << 18)
+#define EXYNOS_WINCON_BITSWP_SHIFT                     (18)
+#define EXYNOS_WINCON_BYTESWP_DISABLE                  (0 << 17)
+#define EXYNOS_WINCON_BYTESWP_ENABLE                   (1 << 17)
+#define EXYNOS_WINCON_BYTESWP_SHIFT                    (17)
+#define EXYNOS_WINCON_HAWSWP_DISABLE                   (0 << 16)
+#define EXYNOS_WINCON_HAWSWP_ENABLE                    (1 << 16)
+#define EXYNOS_WINCON_HAWSWP_SHIFT                     (16)
+#define EXYNOS_WINCON_WSWP_DISABLE                     (0 << 15)
+#define EXYNOS_WINCON_WSWP_ENABLE                      (1 << 15)
+#define EXYNOS_WINCON_WSWP_SHIFT                       (15)
+#define EXYNOS_WINCON_INRGB_RGB                                (0 << 13)
+#define EXYNOS_WINCON_INRGB_YUV                                (1 << 13)
+#define EXYNOS_WINCON_INRGB_MASK                       (1 << 13)
+#define EXYNOS_WINCON_BURSTLEN_16WORD                  (0 << 9)
+#define EXYNOS_WINCON_BURSTLEN_8WORD                   (1 << 9)
+#define EXYNOS_WINCON_BURSTLEN_4WORD                   (2 << 9)
+#define EXYNOS_WINCON_BURSTLEN_MASK                    (3 << 9)
+#define EXYNOS_WINCON_ALPHA_MULTI_DISABLE              (0 << 7)
+#define EXYNOS_WINCON_ALPHA_MULTI_ENABLE               (1 << 7)
+#define EXYNOS_WINCON_BLD_PLANE                                (0 << 6)
+#define EXYNOS_WINCON_BLD_PIXEL                                (1 << 6)
+#define EXYNOS_WINCON_BLD_MASK                         (1 << 6)
+#define EXYNOS_WINCON_BPPMODE_1BPP                     (0 << 2)
+#define EXYNOS_WINCON_BPPMODE_2BPP                     (1 << 2)
+#define EXYNOS_WINCON_BPPMODE_4BPP                     (2 << 2)
+#define EXYNOS_WINCON_BPPMODE_8BPP_PAL                 (3 << 2)
+#define EXYNOS_WINCON_BPPMODE_8BPP                     (4 << 2)
+#define EXYNOS_WINCON_BPPMODE_16BPP_565                        (5 << 2)
+#define EXYNOS_WINCON_BPPMODE_16BPP_A555               (6 << 2)
+#define EXYNOS_WINCON_BPPMODE_18BPP_666                        (8 << 2)
+#define EXYNOS_WINCON_BPPMODE_18BPP_A665               (9 << 2)
+#define EXYNOS_WINCON_BPPMODE_24BPP_888                        (0xb << 2)
+#define EXYNOS_WINCON_BPPMODE_24BPP_A887               (0xc << 2)
+#define EXYNOS_WINCON_BPPMODE_32BPP                    (0xd << 2)
+#define EXYNOS_WINCON_BPPMODE_16BPP_A444               (0xe << 2)
+#define EXYNOS_WINCON_BPPMODE_15BPP_555                        (0xf << 2)
+#define EXYNOS_WINCON_BPPMODE_MASK                     (0xf << 2)
+#define EXYNOS_WINCON_BPPMODE_SHIFT                    (2)
+#define EXYNOS_WINCON_ALPHA0_SEL                       (0 << 1)
+#define EXYNOS_WINCON_ALPHA1_SEL                       (1 << 1)
+#define EXYNOS_WINCON_ALPHA_SEL_MASK                   (1 << 1)
+#define EXYNOS_WINCON_ENWIN_DISABLE                    (0 << 0)
+#define EXYNOS_WINCON_ENWIN_ENABLE                     (1 << 0)
+
+/* WINCON1 special */
+#define EXYNOS_WINCON1_VP_DISABLE                      (0 << 24)
+#define EXYNOS_WINCON1_VP_ENABLE                       (1 << 24)
+#define EXYNOS_WINCON1_LOCALSEL_FIMC1                  (0 << 23)
+#define EXYNOS_WINCON1_LOCALSEL_VP                     (1 << 23)
+#define EXYNOS_WINCON1_LOCALSEL_MASK                   (1 << 23)
+
+/* WINSHMAP */
+#define EXYNOS_WINSHMAP_PROTECT(x)                     (((x) & 0x1f) << 10)
+#define EXYNOS_WINSHMAP_CH_ENABLE(x)                   (1 << (x))
+#define EXYNOS_WINSHMAP_CH_DISABLE(x)                  (1 << (x))
+#define EXYNOS_WINSHMAP_LOCAL_ENABLE(x)                        (0x20 << (x))
+#define EXYNOS_WINSHMAP_LOCAL_DISABLE(x)               (0x20 << (x))
+
+/* VIDOSDxA, VIDOSDxB */
+#define EXYNOS_VIDOSD_LEFT_X(x)                                (((x) & 0x7ff) << 11)
+#define EXYNOS_VIDOSD_TOP_Y(x)                         (((x) & 0x7ff) << 0)
+#define EXYNOS_VIDOSD_RIGHT_X(x)                       (((x) & 0x7ff) << 11)
+#define EXYNOS_VIDOSD_BOTTOM_Y(x)                      (((x) & 0x7ff) << 0)
+
+/* VIDOSD0C, VIDOSDxD */
+#define EXYNOS_VIDOSD_SIZE(x)                          (((x) & 0xffffff) << 0)
+
+/* VIDOSDxC (1~4) */
+#define EXYNOS_VIDOSD_ALPHA0_R(x)                      (((x) & 0xf) << 20)
+#define EXYNOS_VIDOSD_ALPHA0_G(x)                      (((x) & 0xf) << 16)
+#define EXYNOS_VIDOSD_ALPHA0_B(x)                      (((x) & 0xf) << 12)
+#define EXYNOS_VIDOSD_ALPHA1_R(x)                      (((x) & 0xf) << 8)
+#define EXYNOS_VIDOSD_ALPHA1_G(x)                      (((x) & 0xf) << 4)
+#define EXYNOS_VIDOSD_ALPHA1_B(x)                      (((x) & 0xf) << 0)
+#define EXYNOS_VIDOSD_ALPHA0_SHIFT                     (12)
+#define EXYNOS_VIDOSD_ALPHA1_SHIFT                     (0)
+
+/* Start Address */
+#define EXYNOS_VIDADDR_START_VBANK(x)                  (((x) & 0xff) << 24)
+#define EXYNOS_VIDADDR_START_VBASEU(x)                 (((x) & 0xffffff) << 0)
+
+/* End Address */
+#define EXYNOS_VIDADDR_END_VBASEL(x)                   (((x) & 0xffffff) << 0)
+
+/* Buffer Size */
+#define EXYNOS_VIDADDR_OFFSIZE(x)                      (((x) & 0x1fff) << 13)
+#define EXYNOS_VIDADDR_PAGEWIDTH(x)                    (((x) & 0x1fff) << 0)
+
+/* WIN Color Map */
+#define EXYNOS_WINMAP_COLOR(x)                         ((x) & 0xffffff)
+
+/* VIDINTCON0 */
+#define EXYNOS_VIDINTCON0_SYSMAINCON_DISABLE           (0 << 19)
+#define EXYNOS_VIDINTCON0_SYSMAINCON_ENABLE            (1 << 19)
+#define EXYNOS_VIDINTCON0_SYSSUBCON_DISABLE            (0 << 18)
+#define EXYNOS_VIDINTCON0_SYSSUBCON_ENABLE             (1 << 18)
+#define EXYNOS_VIDINTCON0_SYSIFDONE_DISABLE            (0 << 17)
+#define EXYNOS_VIDINTCON0_SYSIFDONE_ENABLE             (1 << 17)
+#define EXYNOS_VIDINTCON0_FRAMESEL0_BACK               (0 << 15)
+#define EXYNOS_VIDINTCON0_FRAMESEL0_VSYNC              (1 << 15)
+#define EXYNOS_VIDINTCON0_FRAMESEL0_ACTIVE             (2 << 15)
+#define EXYNOS_VIDINTCON0_FRAMESEL0_FRONT              (3 << 15)
+#define EXYNOS_VIDINTCON0_FRAMESEL0_MASK               (3 << 15)
+#define EXYNOS_VIDINTCON0_FRAMESEL1_NONE               (0 << 13)
+#define EXYNOS_VIDINTCON0_FRAMESEL1_BACK               (1 << 13)
+#define EXYNOS_VIDINTCON0_FRAMESEL1_VSYNC              (2 << 13)
+#define EXYNOS_VIDINTCON0_FRAMESEL1_FRONT              (3 << 13)
+#define EXYNOS_VIDINTCON0_INTFRMEN_DISABLE             (0 << 12)
+#define EXYNOS_VIDINTCON0_INTFRMEN_ENABLE              (1 << 12)
+#define EXYNOS_VIDINTCON0_FIFOSEL_WIN4                 (1 << 11)
+#define EXYNOS_VIDINTCON0_FIFOSEL_WIN3                 (1 << 10)
+#define EXYNOS_VIDINTCON0_FIFOSEL_WIN2                 (1 << 9)
+#define EXYNOS_VIDINTCON0_FIFOSEL_WIN1                 (1 << 6)
+#define EXYNOS_VIDINTCON0_FIFOSEL_WIN0                 (1 << 5)
+#define EXYNOS_VIDINTCON0_FIFOSEL_ALL                  (0x73 << 5)
+#define EXYNOS_VIDINTCON0_FIFOSEL_MASK                 (0x73 << 5)
+#define EXYNOS_VIDINTCON0_FIFOLEVEL_25                 (0 << 2)
+#define EXYNOS_VIDINTCON0_FIFOLEVEL_50                 (1 << 2)
+#define EXYNOS_VIDINTCON0_FIFOLEVEL_75                 (2 << 2)
+#define EXYNOS_VIDINTCON0_FIFOLEVEL_EMPTY              (3 << 2)
+#define EXYNOS_VIDINTCON0_FIFOLEVEL_FULL               (4 << 2)
+#define EXYNOS_VIDINTCON0_FIFOLEVEL_MASK               (7 << 2)
+#define EXYNOS_VIDINTCON0_INTFIFO_DISABLE              (0 << 1)
+#define EXYNOS_VIDINTCON0_INTFIFO_ENABLE               (1 << 1)
+#define EXYNOS_VIDINTCON0_INT_DISABLE                  (0 << 0)
+#define EXYNOS_VIDINTCON0_INT_ENABLE                   (1 << 0)
+#define EXYNOS_VIDINTCON0_INT_MASK                     (1 << 0)
+
+/* VIDINTCON1 */
+#define EXYNOS_VIDINTCON1_INTVPPEND                    (1 << 5)
+#define EXYNOS_VIDINTCON1_INTI80PEND                   (1 << 2)
+#define EXYNOS_VIDINTCON1_INTFRMPEND                   (1 << 1)
+#define EXYNOS_VIDINTCON1_INTFIFOPEND                  (1 << 0)
+
+/* WINMAP */
+#define EXYNOS_WINMAP_ENABLE                           (1 << 24)
+
+/* WxKEYCON0 (1~4) */
+#define EXYNOS_KEYCON0_KEYBLEN_DISABLE                 (0 << 26)
+#define EXYNOS_KEYCON0_KEYBLEN_ENABLE                  (1 << 26)
+#define EXYNOS_KEYCON0_KEY_DISABLE                     (0 << 25)
+#define EXYNOS_KEYCON0_KEY_ENABLE                      (1 << 25)
+#define EXYNOS_KEYCON0_DIRCON_MATCH_FG                 (0 << 24)
+#define EXYNOS_KEYCON0_DIRCON_MATCH_BG                 (1 << 24)
+#define EXYNOS_KEYCON0_COMPKEY(x)                      (((x) & 0xffffff) << 0)
+
+/* WxKEYCON1 (1~4) */
+#define EXYNOS_KEYCON1_COLVAL(x)                       (((x) & 0xffffff) << 0)
+
+/* DUALRGB */
+#define EXYNOS_DUALRGB_BYPASS_SINGLE                   (0x00 << 0)
+#define EXYNOS_DUALRGB_BYPASS_DUAL                     (0x01 << 0)
+#define EXYNOS_DUALRGB_MIE_DUAL                                (0x10 << 0)
+#define EXYNOS_DUALRGB_MIE_SINGLE                      (0x11 << 0)
+#define EXYNOS_DUALRGB_LINESPLIT                       (0x0 << 2)
+#define EXYNOS_DUALRGB_FRAMESPLIT                      (0x1 << 2)
+#define EXYNOS_DUALRGB_SUB_CNT(x)                      ((x & 0xfff) << 4)
+#define EXYNOS_DUALRGB_VDEN_EN_DISABLE                 (0x0 << 16)
+#define EXYNOS_DUALRGB_VDEN_EN_ENABLE                  (0x1 << 16)
+#define EXYNOS_DUALRGB_MAIN_CNT(x)                     ((x & 0xfff) << 18)
+
+/* I80IFCONA0 and I80IFCONA1 */
+#define EXYNOS_LCD_CS_SETUP(x)                         (((x) & 0xf) << 16)
+#define EXYNOS_LCD_WR_SETUP(x)                         (((x) & 0xf) << 12)
+#define EXYNOS_LCD_WR_ACT(x)                           (((x) & 0xf) << 8)
+#define EXYNOS_LCD_WR_HOLD(x)                          (((x) & 0xf) << 4)
+#define EXYNOS_RSPOL_LOW                               (0 << 2)
+#define EXYNOS_RSPOL_HIGH                              (1 << 2)
+#define EXYNOS_I80IFEN_DISABLE                         (0 << 0)
+#define EXYNOS_I80IFEN_ENABLE                          (1 << 0)
+
+/* TRIGCON */
+#define EXYNOS_I80SOFT_TRIG_EN                         (1 << 0)
+#define EXYNOS_I80START_TRIG                           (1 << 1)
+#define EXYNOS_I80STATUS_TRIG_DONE                     (1 << 2)
+
+#endif /* _REGS_FB_H */
diff --git a/arch/arm/include/asm/arch-exynos/mipi_dsim.h b/arch/arm/include/asm/arch-exynos/mipi_dsim.h
new file mode 100644 (file)
index 0000000..ef6a3d1
--- /dev/null
@@ -0,0 +1,380 @@
+/*
+ * Copyright (C) 2012 Samsung Electronics
+ *
+ * Author: InKi Dae <inki.dae@samsung.com>
+ * Author: Donghwa Lee <dh09.lee@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 _DSIM_H
+#define _DSIM_H
+
+#include <linux/list.h>
+#include <linux/fb.h>
+
+#define PANEL_NAME_SIZE                (32)
+
+enum mipi_dsim_interface_type {
+       DSIM_COMMAND,
+       DSIM_VIDEO
+};
+
+enum mipi_dsim_virtual_ch_no {
+       DSIM_VIRTUAL_CH_0,
+       DSIM_VIRTUAL_CH_1,
+       DSIM_VIRTUAL_CH_2,
+       DSIM_VIRTUAL_CH_3
+};
+
+enum mipi_dsim_burst_mode_type {
+       DSIM_NON_BURST_SYNC_EVENT,
+       DSIM_BURST_SYNC_EVENT,
+       DSIM_NON_BURST_SYNC_PULSE,
+       DSIM_BURST,
+       DSIM_NON_VIDEO_MODE
+};
+
+enum mipi_dsim_no_of_data_lane {
+       DSIM_DATA_LANE_1,
+       DSIM_DATA_LANE_2,
+       DSIM_DATA_LANE_3,
+       DSIM_DATA_LANE_4
+};
+
+enum mipi_dsim_byte_clk_src {
+       DSIM_PLL_OUT_DIV8,
+       DSIM_EXT_CLK_DIV8,
+       DSIM_EXT_CLK_BYPASS
+};
+
+enum mipi_dsim_pixel_format {
+       DSIM_CMD_3BPP,
+       DSIM_CMD_8BPP,
+       DSIM_CMD_12BPP,
+       DSIM_CMD_16BPP,
+       DSIM_VID_16BPP_565,
+       DSIM_VID_18BPP_666PACKED,
+       DSIM_18BPP_666LOOSELYPACKED,
+       DSIM_24BPP_888
+};
+
+/* MIPI DSI Processor-to-Peripheral transaction types */
+enum {
+       MIPI_DSI_V_SYNC_START                           = 0x01,
+       MIPI_DSI_V_SYNC_END                             = 0x11,
+       MIPI_DSI_H_SYNC_START                           = 0x21,
+       MIPI_DSI_H_SYNC_END                             = 0x31,
+
+       MIPI_DSI_COLOR_MODE_OFF                         = 0x02,
+       MIPI_DSI_COLOR_MODE_ON                          = 0x12,
+       MIPI_DSI_SHUTDOWN_PERIPHERAL                    = 0x22,
+       MIPI_DSI_TURN_ON_PERIPHERAL                     = 0x32,
+
+       MIPI_DSI_GENERIC_SHORT_WRITE_0_PARAM            = 0x03,
+       MIPI_DSI_GENERIC_SHORT_WRITE_1_PARAM            = 0x13,
+       MIPI_DSI_GENERIC_SHORT_WRITE_2_PARAM            = 0x23,
+
+       MIPI_DSI_GENERIC_READ_REQUEST_0_PARAM           = 0x04,
+       MIPI_DSI_GENERIC_READ_REQUEST_1_PARAM           = 0x14,
+       MIPI_DSI_GENERIC_READ_REQUEST_2_PARAM           = 0x24,
+
+       MIPI_DSI_DCS_SHORT_WRITE                        = 0x05,
+       MIPI_DSI_DCS_SHORT_WRITE_PARAM                  = 0x15,
+
+       MIPI_DSI_DCS_READ                               = 0x06,
+
+       MIPI_DSI_SET_MAXIMUM_RETURN_PACKET_SIZE         = 0x37,
+
+       MIPI_DSI_END_OF_TRANSMISSION                    = 0x08,
+
+       MIPI_DSI_NULL_PACKET                            = 0x09,
+       MIPI_DSI_BLANKING_PACKET                        = 0x19,
+       MIPI_DSI_GENERIC_LONG_WRITE                     = 0x29,
+       MIPI_DSI_DCS_LONG_WRITE                         = 0x39,
+
+       MIPI_DSI_LOOSELY_PACKED_PIXEL_STREAM_YCBCR20    = 0x0c,
+       MIPI_DSI_PACKED_PIXEL_STREAM_YCBCR24            = 0x1c,
+       MIPI_DSI_PACKED_PIXEL_STREAM_YCBCR16            = 0x2c,
+
+       MIPI_DSI_PACKED_PIXEL_STREAM_30                 = 0x0d,
+       MIPI_DSI_PACKED_PIXEL_STREAM_36                 = 0x1d,
+       MIPI_DSI_PACKED_PIXEL_STREAM_YCBCR12            = 0x3d,
+
+       MIPI_DSI_PACKED_PIXEL_STREAM_16                 = 0x0e,
+       MIPI_DSI_PACKED_PIXEL_STREAM_18                 = 0x1e,
+       MIPI_DSI_PIXEL_STREAM_3BYTE_18                  = 0x2e,
+       MIPI_DSI_PACKED_PIXEL_STREAM_24                 = 0x3e,
+};
+
+/*
+ * struct mipi_dsim_config - interface for configuring mipi-dsi controller.
+ *
+ * @auto_flush: enable or disable Auto flush of MD FIFO using VSYNC pulse.
+ * @eot_disable: enable or disable EoT packet in HS mode.
+ * @auto_vertical_cnt: specifies auto vertical count mode.
+ *     in Video mode, the vertical line transition uses line counter
+ *     configured by VSA, VBP, and Vertical resolution.
+ *     If this bit is set to '1', the line counter does not use VSA and VBP
+ *     registers.(in command mode, this variable is ignored)
+ * @hse: set horizontal sync event mode.
+ *     In VSYNC pulse and Vporch area, MIPI DSI master transfers only HSYNC
+ *     start packet to MIPI DSI slave at MIPI DSI spec1.1r02.
+ *     this bit transfers HSYNC end packet in VSYNC pulse and Vporch area
+ *     (in mommand mode, this variable is ignored)
+ * @hfp: specifies HFP disable mode.
+ *     if this variable is set, DSI master ignores HFP area in VIDEO mode.
+ *     (in command mode, this variable is ignored)
+ * @hbp: specifies HBP disable mode.
+ *     if this variable is set, DSI master ignores HBP area in VIDEO mode.
+ *     (in command mode, this variable is ignored)
+ * @hsa: specifies HSA disable mode.
+ *     if this variable is set, DSI master ignores HSA area in VIDEO mode.
+ *     (in command mode, this variable is ignored)
+ * @e_interface: specifies interface to be used.(CPU or RGB interface)
+ * @e_virtual_ch: specifies virtual channel number that main or
+ *     sub diaplsy uses.
+ * @e_pixel_format: specifies pixel stream format for main or sub display.
+ * @e_burst_mode: selects Burst mode in Video mode.
+ *     in Non-burst mode, RGB data area is filled with RGB data and NULL
+ *     packets, according to input bandwidth of RGB interface.
+ *     In Burst mode, RGB data area is filled with RGB data only.
+ * @e_no_data_lane: specifies data lane count to be used by Master.
+ * @e_byte_clk: select byte clock source. (it must be DSIM_PLL_OUT_DIV8)
+ *     DSIM_EXT_CLK_DIV8 and DSIM_EXT_CLK_BYPASSS are not supported.
+ * @pll_stable_time: specifies the PLL Timer for stability of the ganerated
+ *     clock(System clock cycle base)
+ *     if the timer value goes to 0x00000000, the clock stable bit of status
+ *     and interrupt register is set.
+ * @esc_clk: specifies escape clock frequency for getting the escape clock
+ *     prescaler value.
+ * @stop_holding_cnt: specifies the interval value between transmitting
+ *     read packet(or write "set_tear_on" command) and BTA request.
+ *     after transmitting read packet or write "set_tear_on" command,
+ *     BTA requests to D-PHY automatically. this counter value specifies
+ *     the interval between them.
+ * @bta_timeout: specifies the timer for BTA.
+ *     this register specifies time out from BTA request to change
+ *     the direction with respect to Tx escape clock.
+ * @rx_timeout: specifies the timer for LP Rx mode timeout.
+ *     this register specifies time out on how long RxValid deasserts,
+ *     after RxLpdt asserts with respect to Tx escape clock.
+ *     - RxValid specifies Rx data valid indicator.
+ *     - RxLpdt specifies an indicator that D-PHY is under RxLpdt mode.
+ *     - RxValid and RxLpdt specifies signal from D-PHY.
+ */
+struct mipi_dsim_config {
+       unsigned char                   auto_flush;
+       unsigned char                   eot_disable;
+
+       unsigned char                   auto_vertical_cnt;
+       unsigned char                   hse;
+       unsigned char                   hfp;
+       unsigned char                   hbp;
+       unsigned char                   hsa;
+
+       enum mipi_dsim_interface_type   e_interface;
+       enum mipi_dsim_virtual_ch_no    e_virtual_ch;
+       enum mipi_dsim_pixel_format     e_pixel_format;
+       enum mipi_dsim_burst_mode_type  e_burst_mode;
+       enum mipi_dsim_no_of_data_lane  e_no_data_lane;
+       enum mipi_dsim_byte_clk_src     e_byte_clk;
+
+       /*
+        * ===========================================
+        * |    P    |    M    |    S    |    MHz    |
+        * -------------------------------------------
+        * |    3    |   100   |    3    |    100    |
+        * |    3    |   100   |    2    |    200    |
+        * |    3    |    63   |    1    |    252    |
+        * |    4    |   100   |    1    |    300    |
+        * |    4    |   110   |    1    |    330    |
+        * |   12    |   350   |    1    |    350    |
+        * |    3    |   100   |    1    |    400    |
+        * |    4    |   150   |    1    |    450    |
+        * |    6    |   118   |    1    |    472    |
+        * |    3    |   120   |    1    |    480    |
+        * |   12    |   250   |    0    |    500    |
+        * |    4    |   100   |    0    |    600    |
+        * |    3    |    81   |    0    |    648    |
+        * |    3    |    88   |    0    |    704    |
+        * |    3    |    90   |    0    |    720    |
+        * |    3    |   100   |    0    |    800    |
+        * |   12    |   425   |    0    |    850    |
+        * |    4    |   150   |    0    |    900    |
+        * |   12    |   475   |    0    |    950    |
+        * |    6    |   250   |    0    |   1000    |
+        * -------------------------------------------
+        */
+
+       /*
+        * pms could be calculated as the following.
+        * M * 24 / P * 2 ^ S = MHz
+        */
+       unsigned char                   p;
+       unsigned short                  m;
+       unsigned char                   s;
+
+       unsigned int                    pll_stable_time;
+       unsigned long                   esc_clk;
+
+       unsigned short                  stop_holding_cnt;
+       unsigned char                   bta_timeout;
+       unsigned short                  rx_timeout;
+};
+
+/*
+ * struct mipi_dsim_device - global interface for mipi-dsi driver.
+ *
+ * @dsim_config: infomation for configuring mipi-dsi controller.
+ * @master_ops: callbacks to mipi-dsi operations.
+ * @dsim_lcd_dev: pointer to activated ddi device.
+ *     (it would be registered by mipi-dsi driver.)
+ * @dsim_lcd_drv: pointer to activated_ddi driver.
+ *     (it would be registered by mipi-dsi driver.)
+ * @state: specifies status of MIPI-DSI controller.
+ *     the status could be RESET, INIT, STOP, HSCLKEN and ULPS.
+ * @data_lane: specifiec enabled data lane number.
+ *     this variable would be set by driver according to e_no_data_lane
+ *     automatically.
+ * @e_clk_src: select byte clock source.
+ * @pd: pointer to MIPI-DSI driver platform data.
+ */
+struct mipi_dsim_device {
+       struct mipi_dsim_config         *dsim_config;
+       struct mipi_dsim_master_ops     *master_ops;
+       struct mipi_dsim_lcd_device     *dsim_lcd_dev;
+       struct mipi_dsim_lcd_driver     *dsim_lcd_drv;
+
+       unsigned int                    state;
+       unsigned int                    data_lane;
+       enum mipi_dsim_byte_clk_src     e_clk_src;
+
+       struct exynos_platform_mipi_dsim        *pd;
+};
+
+/*
+ * struct exynos_platform_mipi_dsim - interface to platform data
+ *     for mipi-dsi driver.
+ *
+ * @lcd_panel_name: specifies lcd panel name registered to mipi-dsi driver.
+ *     lcd panel driver searched would be actived.
+ * @dsim_config: pointer of structure for configuring mipi-dsi controller.
+ * @lcd_panel_info: pointer for lcd panel specific structure.
+ *     this structure specifies width, height, timing and polarity and so on.
+ * @lcd_power: callback pointer for enabling or disabling lcd power.
+ * @mipi_power: callback pointer for enabling or disabling mipi power.
+ * @phy_enable: pointer to a callback controlling D-PHY enable/reset
+ */
+struct exynos_platform_mipi_dsim {
+       char                            lcd_panel_name[PANEL_NAME_SIZE];
+
+       struct mipi_dsim_config         *dsim_config;
+       void                            *lcd_panel_info;
+
+       int (*lcd_power)(void);
+       int (*mipi_power)(void);
+       void (*phy_enable)(unsigned int dev_index, unsigned int enable);
+};
+
+/*
+ * struct mipi_dsim_master_ops - callbacks to mipi-dsi operations.
+ *
+ * @cmd_write: transfer command to lcd panel at LP mode.
+ * @cmd_read: read command from rx register.
+ * @get_dsim_frame_done: get the status that all screen data have been
+ *     transferred to mipi-dsi.
+ * @clear_dsim_frame_done: clear frame done status.
+ * @get_fb_frame_done: get frame done status of display controller.
+ * @trigger: trigger display controller.
+ *     - this one would be used only in case of CPU mode.
+ */
+struct mipi_dsim_master_ops {
+       int (*cmd_write)(struct mipi_dsim_device *dsim, unsigned int data_id,
+               unsigned int data0, unsigned int data1);
+       int (*cmd_read)(struct mipi_dsim_device *dsim, unsigned int data_id,
+               unsigned int data0, unsigned int data1);
+       int (*get_dsim_frame_done)(struct mipi_dsim_device *dsim);
+       int (*clear_dsim_frame_done)(struct mipi_dsim_device *dsim);
+
+       int (*get_fb_frame_done)(void);
+       void (*trigger)(struct fb_info *info);
+};
+
+/*
+ * device structure for mipi-dsi based lcd panel.
+ *
+ * @name: name of the device to use with this device, or an
+ *     alias for that name.
+ * @id: id of device to be registered.
+ * @bus_id: bus id for identifing connected bus
+ *     and this bus id should be same as id of mipi_dsim_device.
+ * @master: pointer to mipi-dsi master device object.
+ * @platform_data: lcd panel specific platform data.
+ */
+struct mipi_dsim_lcd_device {
+       char                    *name;
+       int                     id;
+       int                     bus_id;
+
+       struct mipi_dsim_device *master;
+       void                    *platform_data;
+};
+
+/*
+ * driver structure for mipi-dsi based lcd panel.
+ *
+ * this structure should be registered by lcd panel driver.
+ * mipi-dsi driver seeks lcd panel registered through name field
+ * and calls these callback functions in appropriate time.
+ *
+ * @name: name of the driver to use with this device, or an
+ *     alias for that name.
+ * @id: id of driver to be registered.
+ *     this id would be used for finding device object registered.
+ * @mipi_panel_init: callback pointer for initializing lcd panel based on mipi
+ *     dsi interface.
+ * @mipi_display_on: callback pointer for lcd panel display on.
+ */
+struct mipi_dsim_lcd_driver {
+       char                    *name;
+       int                     id;
+
+       int     (*mipi_panel_init)(struct mipi_dsim_device *dsim_dev);
+       void    (*mipi_display_on)(struct mipi_dsim_device *dsim_dev);
+};
+
+int exynos_mipi_dsi_init(void);
+
+/*
+ * register mipi_dsim_lcd_driver object defined by lcd panel driver
+ * to mipi-dsi driver.
+ */
+int exynos_mipi_dsi_register_lcd_driver(struct mipi_dsim_lcd_driver
+                                               *lcd_drv);
+
+/*
+ * register mipi_dsim_lcd_device to mipi-dsi master.
+ */
+int exynos_mipi_dsi_register_lcd_device(struct mipi_dsim_lcd_device
+                                               *lcd_dev);
+
+void exynos_set_dsim_platform_data(struct exynos_platform_mipi_dsim *pd);
+
+/* panel driver init based on mipi dsi interface */
+void s6e8ax0_init(void);
+
+#endif /* _DSIM_H */
index fb442f7f1fdbfcae97803116be89dd7f558c67e4..6444fd04ec12a46bec9cb6a6917e1be664f70285 100644 (file)
@@ -227,4 +227,10 @@ struct exynos4_power {
 };
 #endif /* __ASSEMBLY__ */
 
+void set_mipi_phy_ctrl(unsigned int dev_index, unsigned int enable);
+
+#define EXYNOS_MIPI_PHY_ENABLE         (1 << 0)
+#define EXYNOS_MIPI_PHY_SRESETN                (1 << 1)
+#define EXYNOS_MIPI_PHY_MRESETN                (1 << 2)
+
 #endif
diff --git a/arch/arm/include/asm/arch-exynos/system.h b/arch/arm/include/asm/arch-exynos/system.h
new file mode 100644 (file)
index 0000000..c85f949
--- /dev/null
@@ -0,0 +1,53 @@
+/*
+ * (C) Copyright 2012 Samsung Electronics
+ * Donghwa Lee <dh09.lee@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_ARM_ARCH_SYSTEM_H_
+#define __ASM_ARM_ARCH_SYSTEM_H_
+
+#ifndef __ASSEMBLY__
+struct exynos4_sysreg {
+       unsigned char   res1[0x210];
+       unsigned int    display_ctrl;
+       unsigned int    display_ctrl2;
+       unsigned int    camera_control;
+       unsigned int    audio_endian;
+       unsigned int    jtag_con;
+};
+
+struct exynos5_sysreg {
+       unsigned char   res1[0x214];
+       unsigned int    disp1blk_cfg;
+       unsigned int    disp2blk_cfg;
+       unsigned int    hdcp_e_fuse;
+       unsigned int    gsclblk_cfg0;
+       unsigned int    gsclblk_cfg1;
+       unsigned int    reserved;
+       unsigned int    ispblk_cfg;
+       unsigned int    usb20phy_cfg;
+       unsigned int    mipi_dphy;
+       unsigned int    dptx_dphy;
+       unsigned int    phyclk_sel;
+};
+#endif
+
+void set_system_display_ctrl(void);
+
+#endif /* _EXYNOS4_SYSTEM_H */
index 2c9a07be45bba67fe317e1fac139bee057f2b629..c5eb4b1cc2bcda1e8c9b9e18a953b0db27aff411 100644 (file)
@@ -22,7 +22,7 @@
 #define __TZPC_H_
 
 #ifndef __ASSEMBLY__
-struct exynos5_tzpc {
+struct exynos_tzpc {
        unsigned int r0size;
        char res1[0x7FC];
        unsigned int decprot0stat;
index c59f5885700c577214c734b7fa3a7b38fd15ba89..0f47eaf053c2dd57de62eff3d21d310c9636ba8b 100644 (file)
 #ifndef __ASM_ARCH_CLOCK_H
 #define __ASM_ARCH_CLOCK_H
 
+enum mxc_clock {
+       MXC_CSI_CLK,
+       MXC_EPIT_CLK,
+       MXC_ESAI_CLK,
+       MXC_ESDHC1_CLK,
+       MXC_ESDHC2_CLK,
+       MXC_GPT_CLK,
+       MXC_I2C_CLK,
+       MXC_LCDC_CLK,
+       MXC_NFC_CLK,
+       MXC_OWIRE_CLK,
+       MXC_PWM_CLK,
+       MXC_SIM1_CLK,
+       MXC_SIM2_CLK,
+       MXC_SSI1_CLK,
+       MXC_SSI2_CLK,
+       MXC_UART_CLK,
+       MXC_ARM_CLK,
+       MXC_FEC_CLK,
+       MXC_CLK_NUM
+};
+
 ulong imx_get_perclk(int clk);
 ulong imx_get_ahbclk(void);
 
 #define imx_get_uartclk() imx_get_perclk(15)
 #define imx_get_fecclk() (imx_get_ahbclk()/2)
 
+unsigned int mxc_get_clock(enum mxc_clock clk);
 
 #endif /* __ASM_ARCH_CLOCK_H */
index 7f9449b2d0659a3614b9cadf4a5784e7de554c1f..cf925d70d52fa70c8484ee0c86581987bc19b731 100644 (file)
@@ -34,6 +34,9 @@
 #define _IMX_REGS_H
 
 #ifndef __ASSEMBLY__
+
+#include <asm/types.h>
+
 #ifdef CONFIG_FEC_MXC
 extern void mx25_fec_init_pins(void);
 #endif
index f9e6c535f23e66f851d7faadcb93163cfe96500d..5cf449bd47a1b812b12a08e5abb67582f9032c15 100644 (file)
@@ -30,6 +30,8 @@
 #include <asm/arch/regs-digctl.h>
 #include <asm/arch/regs-gpmi.h>
 #include <asm/arch/regs-i2c.h>
+#include <asm/arch/regs-lcdif.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>
@@ -37,4 +39,7 @@
 #include <asm/arch/regs-ssp.h>
 #include <asm/arch/regs-timrot.h>
 
+extern void imx_get_mac_from_fuse(int dev_id, unsigned char *mac);
+
 #endif /* __IMX_REGS_H__ */
+
diff --git a/arch/arm/include/asm/arch-mx28/mxsfb.h b/arch/arm/include/asm/arch-mx28/mxsfb.h
new file mode 100644 (file)
index 0000000..16e8212
--- /dev/null
@@ -0,0 +1,49 @@
+/*
+ * Copyright (C) 2012 Lothar Waßmann <LW@KARO-electronics.de>
+ *
+ * LCD driver for i.MX28
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.         See the
+ * GNU General Public License for more details.
+ *
+ */
+
+#ifndef __MXSFB_H
+#define __MXSFB_H
+
+#include <linux/list.h>
+#include <linux/fb.h>
+
+#define fourcc(a, b, c, d)     (((__u32)(a) << 0) |                    \
+                               ((__u32)(b) << 8) |                     \
+                               ((__u32)(c) << 16) |                    \
+                               ((__u32)(d) << 24))
+
+/*
+ * Pixel formats are defined with ASCII FOURCC code. The pixel format codes are
+ * the same used by V4L2 API.
+ */
+
+#define PIX_FMT_RGB332  fourcc('R', 'G', 'B', '1')  /*<  8  RGB-3-3-2    */
+#define PIX_FMT_RGB555  fourcc('R', 'G', 'B', 'O')  /*< 16  RGB-5-5-5    */
+#define PIX_FMT_RGB565  fourcc('R', 'G', 'B', 'P')  /*< 1 6  RGB-5-6-5   */
+#define PIX_FMT_RGB666  fourcc('R', 'G', 'B', '6')  /*< 18  RGB-6-6-6    */
+#define PIX_FMT_BGR666  fourcc('B', 'G', 'R', '6')  /*< 18  BGR-6-6-6    */
+#define PIX_FMT_BGR24   fourcc('B', 'G', 'R', '3')  /*< 24  BGR-8-8-8    */
+#define PIX_FMT_RGB24   fourcc('R', 'G', 'B', '3')  /*< 24  RGB-8-8-8    */
+
+#define PIX_FMT_GREY    fourcc('G', 'R', 'E', 'Y')  /*< 8  Greyscale */
+
+#define FB_SYNC_DATA_ENABLE_HIGH_ACT   (1 << 6)
+#define FB_SYNC_DOTCLK_FALLING_ACT     (1 << 7) /* falling/negative edge sampling */
+
+extern int mxsfb_init(struct fb_videomode *mode, uint32_t pixfmt, int bpp);
+extern void mxsfb_disable(void);
+
+#endif /* __MXSFB_H */
diff --git a/arch/arm/include/asm/arch-mx28/regs-lcdif.h b/arch/arm/include/asm/arch-mx28/regs-lcdif.h
new file mode 100644 (file)
index 0000000..27c8e74
--- /dev/null
@@ -0,0 +1,235 @@
+/*
+ * Freescale i.MX28 LCDIF Register Definitions
+ *
+ * Copyright (C) 2011 Marek Vasut <marek.vasut@gmail.com>
+ * on behalf of DENX Software Engineering GmbH
+ *
+ * Based on code from LTIB:
+ * Copyright 2008-2010 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., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+ *
+ */
+
+#ifndef __MX28_REGS_LCDIF_H__
+#define __MX28_REGS_LCDIF_H__
+
+#include <asm/arch/regs-common.h>
+
+#ifndef        __ASSEMBLY__
+struct mx28_lcdif_regs {
+       mx28_reg_32(hw_lcdif_ctrl)              /* 0x00 */
+       mx28_reg_32(hw_lcdif_ctrl1)             /* 0x10 */
+       mx28_reg_32(hw_lcdif_ctrl2)             /* 0x20 */
+       mx28_reg_32(hw_lcdif_transfer_count)    /* 0x30 */
+       mx28_reg_32(hw_lcdif_cur_buf)           /* 0x40 */
+       mx28_reg_32(hw_lcdif_next_buf)          /* 0x50 */
+       mx28_reg_32(hw_lcdif_timing)            /* 0x60 */
+       mx28_reg_32(hw_lcdif_vdctrl0)           /* 0x70 */
+       mx28_reg_32(hw_lcdif_vdctrl1)           /* 0x80 */
+       mx28_reg_32(hw_lcdif_vdctrl2)           /* 0x90 */
+       mx28_reg_32(hw_lcdif_vdctrl3)           /* 0xa0 */
+       mx28_reg_32(hw_lcdif_vdctrl4)           /* 0xb0 */
+       mx28_reg_32(hw_lcdif_dvictrl0)          /* 0xc0 */
+       mx28_reg_32(hw_lcdif_dvictrl1)          /* 0xd0 */
+       mx28_reg_32(hw_lcdif_dvictrl2)          /* 0xe0 */
+       mx28_reg_32(hw_lcdif_dvictrl3)          /* 0xf0 */
+       mx28_reg_32(hw_lcdif_dvictrl4)          /* 0x100 */
+       mx28_reg_32(hw_lcdif_csc_coeffctrl0)    /* 0x110 */
+       mx28_reg_32(hw_lcdif_csc_coeffctrl1)    /* 0x120 */
+       mx28_reg_32(hw_lcdif_csc_coeffctrl2)    /* 0x130 */
+       mx28_reg_32(hw_lcdif_csc_coeffctrl3)    /* 0x140 */
+       mx28_reg_32(hw_lcdif_csc_coeffctrl4)    /* 0x150 */
+       mx28_reg_32(hw_lcdif_csc_offset)        /* 0x160 */
+       mx28_reg_32(hw_lcdif_csc_limit)         /* 0x170 */
+       mx28_reg_32(hw_lcdif_data)              /* 0x180 */
+       mx28_reg_32(hw_lcdif_bm_error_stat)     /* 0x190 */
+       mx28_reg_32(hw_lcdif_crc_stat)          /* 0x1a0 */
+       mx28_reg_32(hw_lcdif_lcdif_stat)        /* 0x1b0 */
+       mx28_reg_32(hw_lcdif_version)           /* 0x1c0 */
+       mx28_reg_32(hw_lcdif_debug0)            /* 0x1d0 */
+       mx28_reg_32(hw_lcdif_debug1)            /* 0x1e0 */
+       mx28_reg_32(hw_lcdif_debug2)            /* 0x1f0 */
+};
+#endif
+
+#define        LCDIF_CTRL_SFTRST                               (1 << 31)
+#define        LCDIF_CTRL_CLKGATE                              (1 << 30)
+#define        LCDIF_CTRL_YCBCR422_INPUT                       (1 << 29)
+#define        LCDIF_CTRL_READ_WRITEB                          (1 << 28)
+#define        LCDIF_CTRL_WAIT_FOR_VSYNC_EDGE                  (1 << 27)
+#define        LCDIF_CTRL_DATA_SHIFT_DIR                       (1 << 26)
+#define        LCDIF_CTRL_SHIFT_NUM_BITS_MASK                  (0x1f << 21)
+#define        LCDIF_CTRL_SHIFT_NUM_BITS_OFFSET                21
+#define        LCDIF_CTRL_DVI_MODE                             (1 << 20)
+#define        LCDIF_CTRL_BYPASS_COUNT                         (1 << 19)
+#define        LCDIF_CTRL_VSYNC_MODE                           (1 << 18)
+#define        LCDIF_CTRL_DOTCLK_MODE                          (1 << 17)
+#define        LCDIF_CTRL_DATA_SELECT                          (1 << 16)
+#define        LCDIF_CTRL_INPUT_DATA_SWIZZLE_MASK              (0x3 << 14)
+#define        LCDIF_CTRL_INPUT_DATA_SWIZZLE_OFFSET            14
+#define        LCDIF_CTRL_CSC_DATA_SWIZZLE_MASK                (0x3 << 12)
+#define        LCDIF_CTRL_CSC_DATA_SWIZZLE_OFFSET              12
+#define        LCDIF_CTRL_LCD_DATABUS_WIDTH_MASK               (0x3 << 10)
+#define        LCDIF_CTRL_LCD_DATABUS_WIDTH_OFFSET             10
+#define        LCDIF_CTRL_LCD_DATABUS_WIDTH_16BIT              (0 << 10)
+#define        LCDIF_CTRL_LCD_DATABUS_WIDTH_8BIT               (1 << 10)
+#define        LCDIF_CTRL_LCD_DATABUS_WIDTH_18BIT              (2 << 10)
+#define        LCDIF_CTRL_LCD_DATABUS_WIDTH_24BIT              (3 << 10)
+#define        LCDIF_CTRL_WORD_LENGTH_MASK                     (0x3 << 8)
+#define        LCDIF_CTRL_WORD_LENGTH_OFFSET                   8
+#define        LCDIF_CTRL_WORD_LENGTH_16BIT                    (0 << 8)
+#define        LCDIF_CTRL_WORD_LENGTH_8BIT                     (1 << 8)
+#define        LCDIF_CTRL_WORD_LENGTH_18BIT                    (2 << 8)
+#define        LCDIF_CTRL_WORD_LENGTH_24BIT                    (3 << 8)
+#define        LCDIF_CTRL_RGB_TO_YCBCR422_CSC                  (1 << 7)
+#define        LCDIF_CTRL_LCDIF_MASTER                         (1 << 5)
+#define        LCDIF_CTRL_DATA_FORMAT_16_BIT                   (1 << 3)
+#define        LCDIF_CTRL_DATA_FORMAT_18_BIT                   (1 << 2)
+#define        LCDIF_CTRL_DATA_FORMAT_24_BIT                   (1 << 1)
+#define        LCDIF_CTRL_RUN                                  (1 << 0)
+
+#define        LCDIF_CTRL1_COMBINE_MPU_WR_STRB                 (1 << 27)
+#define        LCDIF_CTRL1_BM_ERROR_IRQ_EN                     (1 << 26)
+#define        LCDIF_CTRL1_BM_ERROR_IRQ                        (1 << 25)
+#define        LCDIF_CTRL1_RECOVER_ON_UNDERFLOW                (1 << 24)
+#define        LCDIF_CTRL1_INTERLACE_FIELDS                    (1 << 23)
+#define        LCDIF_CTRL1_START_INTERLACE_FROM_SECOND_FIELD   (1 << 22)
+#define        LCDIF_CTRL1_FIFO_CLEAR                          (1 << 21)
+#define        LCDIF_CTRL1_IRQ_ON_ALTERNATE_FIELDS             (1 << 20)
+#define        LCDIF_CTRL1_BYTE_PACKING_FORMAT_MASK            (0xf << 16)
+#define        LCDIF_CTRL1_BYTE_PACKING_FORMAT_OFFSET          16
+#define        LCDIF_CTRL1_BYTE_PACKING_FORMAT(n)              (((n) << LCDIF_CTRL1_BYTE_PACKING_FORMAT_OFFSET) & \
+                                               LCDIF_CTRL1_BYTE_PACKING_FORMAT_MASK)
+#define        LCDIF_CTRL1_OVERFLOW_IRQ_EN                     (1 << 15)
+#define        LCDIF_CTRL1_UNDERFLOW_IRQ_EN                    (1 << 14)
+#define        LCDIF_CTRL1_CUR_FRAME_DONE_IRQ_EN               (1 << 13)
+#define        LCDIF_CTRL1_VSYNC_EDGE_IRQ_EN                   (1 << 12)
+#define        LCDIF_CTRL1_OVERFLOW_IRQ                        (1 << 11)
+#define        LCDIF_CTRL1_UNDERFLOW_IRQ                       (1 << 10)
+#define        LCDIF_CTRL1_CUR_FRAME_DONE_IRQ                  (1 << 9)
+#define        LCDIF_CTRL1_VSYNC_EDGE_IRQ                      (1 << 8)
+#define        LCDIF_CTRL1_BUSY_ENABLE                         (1 << 2)
+#define        LCDIF_CTRL1_MODE86                              (1 << 1)
+#define        LCDIF_CTRL1_RESET                               (1 << 0)
+
+#define        LCDIF_CTRL2_OUTSTANDING_REQS_MASK               (0x7 << 21)
+#define        LCDIF_CTRL2_OUTSTANDING_REQS_OFFSET             21
+#define        LCDIF_CTRL2_OUTSTANDING_REQS_REQ_1              (0x0 << 21)
+#define        LCDIF_CTRL2_OUTSTANDING_REQS_REQ_2              (0x1 << 21)
+#define        LCDIF_CTRL2_OUTSTANDING_REQS_REQ_4              (0x2 << 21)
+#define        LCDIF_CTRL2_OUTSTANDING_REQS_REQ_8              (0x3 << 21)
+#define        LCDIF_CTRL2_OUTSTANDING_REQS_REQ_16             (0x4 << 21)
+#define        LCDIF_CTRL2_BURST_LEN_8                         (1 << 20)
+#define        LCDIF_CTRL2_ODD_LINE_PATTERN_MASK               (0x7 << 16)
+#define        LCDIF_CTRL2_ODD_LINE_PATTERN_OFFSET             16
+#define        LCDIF_CTRL2_ODD_LINE_PATTERN_RGB                (0x0 << 16)
+#define        LCDIF_CTRL2_ODD_LINE_PATTERN_RBG                (0x1 << 16)
+#define        LCDIF_CTRL2_ODD_LINE_PATTERN_GBR                (0x2 << 16)
+#define        LCDIF_CTRL2_ODD_LINE_PATTERN_GRB                (0x3 << 16)
+#define        LCDIF_CTRL2_ODD_LINE_PATTERN_BRG                (0x4 << 16)
+#define        LCDIF_CTRL2_ODD_LINE_PATTERN_BGR                (0x5 << 16)
+#define        LCDIF_CTRL2_EVEN_LINE_PATTERN_MASK              (0x7 << 12)
+#define        LCDIF_CTRL2_EVEN_LINE_PATTERN_OFFSET            12
+#define        LCDIF_CTRL2_EVEN_LINE_PATTERN_RGB               (0x0 << 12)
+#define        LCDIF_CTRL2_EVEN_LINE_PATTERN_RBG               (0x1 << 12)
+#define        LCDIF_CTRL2_EVEN_LINE_PATTERN_GBR               (0x2 << 12)
+#define        LCDIF_CTRL2_EVEN_LINE_PATTERN_GRB               (0x3 << 12)
+#define        LCDIF_CTRL2_EVEN_LINE_PATTERN_BRG               (0x4 << 12)
+#define        LCDIF_CTRL2_EVEN_LINE_PATTERN_BGR               (0x5 << 12)
+#define        LCDIF_CTRL2_READ_PACK_DIR                       (1 << 10)
+#define        LCDIF_CTRL2_READ_MODE_OUTPUT_IN_RGB_FORMAT      (1 << 9)
+#define        LCDIF_CTRL2_READ_MODE_6_BIT_INPUT               (1 << 8)
+#define        LCDIF_CTRL2_READ_MODE_NUM_PACKED_SUBWORDS_MASK  (0x7 << 4)
+#define        LCDIF_CTRL2_READ_MODE_NUM_PACKED_SUBWORDS_OFFSET 4
+#define        LCDIF_CTRL2_INITIAL_DUMMY_READ_MASK             (0x7 << 1)
+#define        LCDIF_CTRL2_INITIAL_DUMMY_READ_OFFSET           1
+
+#define        LCDIF_TRANSFER_COUNT_V_COUNT_MASK               (0xffff << 16)
+#define        LCDIF_TRANSFER_COUNT_V_COUNT_OFFSET             16
+#define        LCDIF_TRANSFER_COUNT_V_COUNT(n)                 (((n) << LCDIF_TRANSFER_COUNT_V_COUNT_OFFSET) & \
+                                               LCDIF_TRANSFER_COUNT_V_COUNT_MASK)
+#define        LCDIF_TRANSFER_COUNT_H_COUNT_MASK               (0xffff << 0)
+#define        LCDIF_TRANSFER_COUNT_H_COUNT_OFFSET             0
+#define        LCDIF_TRANSFER_COUNT_H_COUNT(n)                 (((n) << LCDIF_TRANSFER_COUNT_H_COUNT_OFFSET) & \
+                                               LCDIF_TRANSFER_COUNT_H_COUNT_MASK)
+
+#define        LCDIF_CUR_BUF_ADDR_MASK                         0xffffffff
+#define        LCDIF_CUR_BUF_ADDR_OFFSET                       0
+
+#define        LCDIF_NEXT_BUF_ADDR_MASK                        0xffffffff
+#define        LCDIF_NEXT_BUF_ADDR_OFFSET                      0
+
+#define        LCDIF_TIMING_CMD_HOLD_MASK                      (0xff << 24)
+#define        LCDIF_TIMING_CMD_HOLD_OFFSET                    24
+#define        LCDIF_TIMING_CMD_SETUP_MASK                     (0xff << 16)
+#define        LCDIF_TIMING_CMD_SETUP_OFFSET                   16
+#define        LCDIF_TIMING_DATA_HOLD_MASK                     (0xff << 8)
+#define        LCDIF_TIMING_DATA_HOLD_OFFSET                   8
+#define        LCDIF_TIMING_DATA_SETUP_MASK                    (0xff << 0)
+#define        LCDIF_TIMING_DATA_SETUP_OFFSET                  0
+
+#define        LCDIF_VDCTRL0_VSYNC_OEB                         (1 << 29)
+#define        LCDIF_VDCTRL0_ENABLE_PRESENT                    (1 << 28)
+#define        LCDIF_VDCTRL0_VSYNC_POL                         (1 << 27)
+#define        LCDIF_VDCTRL0_HSYNC_POL                         (1 << 26)
+#define        LCDIF_VDCTRL0_DOTCLK_POL                        (1 << 25)
+#define        LCDIF_VDCTRL0_ENABLE_POL                        (1 << 24)
+#define        LCDIF_VDCTRL0_VSYNC_PERIOD_UNIT                 (1 << 21)
+#define        LCDIF_VDCTRL0_VSYNC_PULSE_WIDTH_UNIT            (1 << 20)
+#define        LCDIF_VDCTRL0_HALF_LINE                         (1 << 19)
+#define        LCDIF_VDCTRL0_HALF_LINE_MODE                    (1 << 18)
+#define        LCDIF_VDCTRL0_VSYNC_PULSE_WIDTH_MASK            0x3ffff
+#define        LCDIF_VDCTRL0_VSYNC_PULSE_WIDTH_OFFSET          0
+#define        LCDIF_VDCTRL0_VSYNC_PULSE_WIDTH(n)              (((n) << LCDIF_VDCTRL0_VSYNC_PULSE_WIDTH_OFFSET) & \
+                                               LCDIF_VDCTRL0_VSYNC_PULSE_WIDTH_MASK)
+
+#define        LCDIF_VDCTRL1_VSYNC_PERIOD_MASK                 0xffffffff
+#define        LCDIF_VDCTRL1_VSYNC_PERIOD_OFFSET               0
+#define        LCDIF_VDCTRL1_VSYNC_PERIOD(n)                   (((n) << LCDIF_VDCTRL1_VSYNC_PERIOD_OFFSET) & \
+                                               LCDIF_VDCTRL1_VSYNC_PERIOD_MASK)
+
+#define        LCDIF_VDCTRL2_HSYNC_PULSE_WIDTH_MASK            (0x3fff << 18)
+#define        LCDIF_VDCTRL2_HSYNC_PULSE_WIDTH_OFFSET          18
+#define        LCDIF_VDCTRL2_HSYNC_PULSE_WIDTH(n)              (((n) << LCDIF_VDCTRL2_HSYNC_PULSE_WIDTH_OFFSET) & \
+                                               LCDIF_VDCTRL2_HSYNC_PULSE_WIDTH_MASK)
+#define        LCDIF_VDCTRL2_HSYNC_PERIOD_MASK                 0x3ffff
+#define        LCDIF_VDCTRL2_HSYNC_PERIOD_OFFSET               0
+#define        LCDIF_VDCTRL2_HSYNC_PERIOD(n)                   (((n) << LCDIF_VDCTRL2_HSYNC_PERIOD_OFFSET) & \
+                                               LCDIF_VDCTRL2_HSYNC_PERIOD_MASK)
+
+#define        LCDIF_VDCTRL3_MUX_SYNC_SIGNALS                  (1 << 29)
+#define        LCDIF_VDCTRL3_VSYNC_ONLY                        (1 << 28)
+#define        LCDIF_VDCTRL3_HORIZONTAL_WAIT_CNT_MASK          (0xfff << 16)
+#define        LCDIF_VDCTRL3_HORIZONTAL_WAIT_CNT_OFFSET        16
+#define        LCDIF_VDCTRL3_HORIZONTAL_WAIT_CNT(n)            (((n) << LCDIF_VDCTRL3_HORIZONTAL_WAIT_CNT_OFFSET) & \
+                                               LCDIF_VDCTRL3_HORIZONTAL_WAIT_CNT_MASK)
+
+#define        LCDIF_VDCTRL3_VERTICAL_WAIT_CNT_MASK            (0xffff << 0)
+#define        LCDIF_VDCTRL3_VERTICAL_WAIT_CNT_OFFSET          0
+#define        LCDIF_VDCTRL3_VERTICAL_WAIT_CNT(n)              (((n) << LCDIF_VDCTRL3_VERTICAL_WAIT_CNT_OFFSET) & \
+                                               LCDIF_VDCTRL3_VERTICAL_WAIT_CNT_MASK)
+
+#define        LCDIF_VDCTRL4_DOTCLK_DLY_SEL_MASK               (0x7 << 29)
+#define        LCDIF_VDCTRL4_DOTCLK_DLY_SEL_OFFSET             29
+#define        LCDIF_VDCTRL4_DOTCLK_DLY_SEL(n)                 (((n) << LCDIF_VDCTRL4_DOTCLK_DLY_SEL_OFFSET) & \
+                                               LCDIF_VDCTRL4_DOTCLK_DLY_SEL_MASK)
+#define        LCDIF_VDCTRL4_SYNC_SIGNALS_ON                   (1 << 18)
+#define        LCDIF_VDCTRL4_DOTCLK_H_VALID_DATA_CNT_MASK      0x3ffff
+#define        LCDIF_VDCTRL4_DOTCLK_H_VALID_DATA_CNT_OFFSET    0
+#define        LCDIF_VDCTRL4_DOTCLK_H_VALID_DATA_CNT(n)        (((n) << LCDIF_VDCTRL4_DOTCLK_H_VALID_DATA_CNT_OFFSET) & \
+                                                       LCDIF_VDCTRL4_DOTCLK_H_VALID_DATA_CNT_MASK)
+
+#endif /* __MX28_REGS_LCDIF_H__ */
diff --git a/arch/arm/include/asm/arch-mx28/regs-lradc.h b/arch/arm/include/asm/arch-mx28/regs-lradc.h
new file mode 100644 (file)
index 0000000..16e2bbf
--- /dev/null
@@ -0,0 +1,400 @@
+/*
+ * Freescale i.MX28 LRADC Register Definitions
+ *
+ * Copyright (C) 2011 Marek Vasut <marek.vasut@gmail.com>
+ * on behalf of DENX Software Engineering GmbH
+ *
+ * Based on code from LTIB:
+ * Copyright 2008-2009 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., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+ *
+ */
+
+#ifndef __MX28_REGS_LRADC_H__
+#define __MX28_REGS_LRADC_H__
+
+#include <asm/arch/regs-common.h>
+
+#ifndef        __ASSEMBLY__
+struct mx28_lradc_regs {
+       mx28_reg_32(hw_lradc_ctrl0);
+       mx28_reg_32(hw_lradc_ctrl1);
+       mx28_reg_32(hw_lradc_ctrl2);
+       mx28_reg_32(hw_lradc_ctrl3);
+       mx28_reg_32(hw_lradc_status);
+       mx28_reg_32(hw_lradc_ch0);
+       mx28_reg_32(hw_lradc_ch1);
+       mx28_reg_32(hw_lradc_ch2);
+       mx28_reg_32(hw_lradc_ch3);
+       mx28_reg_32(hw_lradc_ch4);
+       mx28_reg_32(hw_lradc_ch5);
+       mx28_reg_32(hw_lradc_ch6);
+       mx28_reg_32(hw_lradc_ch7);
+       mx28_reg_32(hw_lradc_delay0);
+       mx28_reg_32(hw_lradc_delay1);
+       mx28_reg_32(hw_lradc_delay2);
+       mx28_reg_32(hw_lradc_delay3);
+       mx28_reg_32(hw_lradc_debug0);
+       mx28_reg_32(hw_lradc_debug1);
+       mx28_reg_32(hw_lradc_conversion);
+       mx28_reg_32(hw_lradc_ctrl4);
+       mx28_reg_32(hw_lradc_treshold0);
+       mx28_reg_32(hw_lradc_treshold1);
+       mx28_reg_32(hw_lradc_version);
+};
+#endif
+
+#define        LRADC_CTRL0_SFTRST                                      (1 << 31)
+#define        LRADC_CTRL0_CLKGATE                                     (1 << 30)
+#define        LRADC_CTRL0_ONCHIP_GROUNDREF                            (1 << 26)
+#define        LRADC_CTRL0_BUTTON1_DETECT_ENABLE                       (1 << 25)
+#define        LRADC_CTRL0_BUTTON0_DETECT_ENABLE                       (1 << 24)
+#define        LRADC_CTRL0_TOUCH_DETECT_ENABLE                         (1 << 23)
+#define        LRADC_CTRL0_TOUCH_SCREEN_TYPE                           (1 << 22)
+#define        LRADC_CTRL0_YNLRSW                                      (1 << 21)
+#define        LRADC_CTRL0_YPLLSW_MASK                                 (0x3 << 19)
+#define        LRADC_CTRL0_YPLLSW_OFFSET                               19
+#define        LRADC_CTRL0_XNURSW_MASK                                 (0x3 << 17)
+#define        LRADC_CTRL0_XNURSW_OFFSET                               17
+#define        LRADC_CTRL0_XPULSW                                      (1 << 16)
+#define        LRADC_CTRL0_SCHEDULE_MASK                               0xff
+#define        LRADC_CTRL0_SCHEDULE_OFFSET                             0
+
+#define        LRADC_CTRL1_BUTTON1_DETECT_IRQ_EN                       (1 << 28)
+#define        LRADC_CTRL1_BUTTON0_DETECT_IRQ_EN                       (1 << 27)
+#define        LRADC_CTRL1_THRESHOLD1_DETECT_IRQ_EN                    (1 << 26)
+#define        LRADC_CTRL1_THRESHOLD0_DETECT_IRQ_EN                    (1 << 25)
+#define        LRADC_CTRL1_TOUCH_DETECT_IRQ_EN                         (1 << 24)
+#define        LRADC_CTRL1_LRADC7_IRQ_EN                               (1 << 23)
+#define        LRADC_CTRL1_LRADC6_IRQ_EN                               (1 << 22)
+#define        LRADC_CTRL1_LRADC5_IRQ_EN                               (1 << 21)
+#define        LRADC_CTRL1_LRADC4_IRQ_EN                               (1 << 20)
+#define        LRADC_CTRL1_LRADC3_IRQ_EN                               (1 << 19)
+#define        LRADC_CTRL1_LRADC2_IRQ_EN                               (1 << 18)
+#define        LRADC_CTRL1_LRADC1_IRQ_EN                               (1 << 17)
+#define        LRADC_CTRL1_LRADC0_IRQ_EN                               (1 << 16)
+#define        LRADC_CTRL1_BUTTON1_DETECT_IRQ                          (1 << 12)
+#define        LRADC_CTRL1_BUTTON0_DETECT_IRQ                          (1 << 11)
+#define        LRADC_CTRL1_THRESHOLD1_DETECT_IRQ                       (1 << 10)
+#define        LRADC_CTRL1_THRESHOLD0_DETECT_IRQ                       (1 << 9)
+#define        LRADC_CTRL1_TOUCH_DETECT_IRQ                            (1 << 8)
+#define        LRADC_CTRL1_LRADC7_IRQ                                  (1 << 7)
+#define        LRADC_CTRL1_LRADC6_IRQ                                  (1 << 6)
+#define        LRADC_CTRL1_LRADC5_IRQ                                  (1 << 5)
+#define        LRADC_CTRL1_LRADC4_IRQ                                  (1 << 4)
+#define        LRADC_CTRL1_LRADC3_IRQ                                  (1 << 3)
+#define        LRADC_CTRL1_LRADC2_IRQ                                  (1 << 2)
+#define        LRADC_CTRL1_LRADC1_IRQ                                  (1 << 1)
+#define        LRADC_CTRL1_LRADC0_IRQ                                  (1 << 0)
+
+#define        LRADC_CTRL2_DIVIDE_BY_TWO_MASK                          (0xff << 24)
+#define        LRADC_CTRL2_DIVIDE_BY_TWO_OFFSET                        24
+#define        LRADC_CTRL2_TEMPSENSE_PWD                               (1 << 15)
+#define        LRADC_CTRL2_VTHSENSE_MASK                               (0x3 << 13)
+#define        LRADC_CTRL2_VTHSENSE_OFFSET                             13
+#define        LRADC_CTRL2_DISABLE_MUXAMP_BYPASS                       (1 << 12)
+#define        LRADC_CTRL2_TEMP_SENSOR_IENABLE1                        (1 << 9)
+#define        LRADC_CTRL2_TEMP_SENSOR_IENABLE0                        (1 << 8)
+#define        LRADC_CTRL2_TEMP_ISRC1_MASK                             (0xf << 4)
+#define        LRADC_CTRL2_TEMP_ISRC1_OFFSET                           4
+#define        LRADC_CTRL2_TEMP_ISRC1_300                              (0xf << 4)
+#define        LRADC_CTRL2_TEMP_ISRC1_280                              (0xe << 4)
+#define        LRADC_CTRL2_TEMP_ISRC1_260                              (0xd << 4)
+#define        LRADC_CTRL2_TEMP_ISRC1_240                              (0xc << 4)
+#define        LRADC_CTRL2_TEMP_ISRC1_220                              (0xb << 4)
+#define        LRADC_CTRL2_TEMP_ISRC1_200                              (0xa << 4)
+#define        LRADC_CTRL2_TEMP_ISRC1_180                              (0x9 << 4)
+#define        LRADC_CTRL2_TEMP_ISRC1_160                              (0x8 << 4)
+#define        LRADC_CTRL2_TEMP_ISRC1_140                              (0x7 << 4)
+#define        LRADC_CTRL2_TEMP_ISRC1_120                              (0x6 << 4)
+#define        LRADC_CTRL2_TEMP_ISRC1_100                              (0x5 << 4)
+#define        LRADC_CTRL2_TEMP_ISRC1_80                               (0x4 << 4)
+#define        LRADC_CTRL2_TEMP_ISRC1_60                               (0x3 << 4)
+#define        LRADC_CTRL2_TEMP_ISRC1_40                               (0x2 << 4)
+#define        LRADC_CTRL2_TEMP_ISRC1_20                               (0x1 << 4)
+#define        LRADC_CTRL2_TEMP_ISRC1_ZERO                             (0x0 << 4)
+#define        LRADC_CTRL2_TEMP_ISRC0_MASK                             (0xf << 0)
+#define        LRADC_CTRL2_TEMP_ISRC0_OFFSET                           0
+#define        LRADC_CTRL2_TEMP_ISRC0_300                              (0xf << 0)
+#define        LRADC_CTRL2_TEMP_ISRC0_280                              (0xe << 0)
+#define        LRADC_CTRL2_TEMP_ISRC0_260                              (0xd << 0)
+#define        LRADC_CTRL2_TEMP_ISRC0_240                              (0xc << 0)
+#define        LRADC_CTRL2_TEMP_ISRC0_220                              (0xb << 0)
+#define        LRADC_CTRL2_TEMP_ISRC0_200                              (0xa << 0)
+#define        LRADC_CTRL2_TEMP_ISRC0_180                              (0x9 << 0)
+#define        LRADC_CTRL2_TEMP_ISRC0_160                              (0x8 << 0)
+#define        LRADC_CTRL2_TEMP_ISRC0_140                              (0x7 << 0)
+#define        LRADC_CTRL2_TEMP_ISRC0_120                              (0x6 << 0)
+#define        LRADC_CTRL2_TEMP_ISRC0_100                              (0x5 << 0)
+#define        LRADC_CTRL2_TEMP_ISRC0_80                               (0x4 << 0)
+#define        LRADC_CTRL2_TEMP_ISRC0_60                               (0x3 << 0)
+#define        LRADC_CTRL2_TEMP_ISRC0_40                               (0x2 << 0)
+#define        LRADC_CTRL2_TEMP_ISRC0_20                               (0x1 << 0)
+#define        LRADC_CTRL2_TEMP_ISRC0_ZERO                             (0x0 << 0)
+
+#define        LRADC_CTRL3_DISCARD_MASK                                (0x3 << 24)
+#define        LRADC_CTRL3_DISCARD_OFFSET                              24
+#define        LRADC_CTRL3_DISCARD_1_SAMPLE                            (0x1 << 24)
+#define        LRADC_CTRL3_DISCARD_2_SAMPLES                           (0x2 << 24)
+#define        LRADC_CTRL3_DISCARD_3_SAMPLES                           (0x3 << 24)
+#define        LRADC_CTRL3_FORCE_ANALOG_PWUP                           (1 << 23)
+#define        LRADC_CTRL3_FORCE_ANALOG_PWDN                           (1 << 22)
+#define        LRADC_CTRL3_CYCLE_TIME_MASK                             (0x3 << 8)
+#define        LRADC_CTRL3_CYCLE_TIME_OFFSET                           8
+#define        LRADC_CTRL3_CYCLE_TIME_6MHZ                             (0x0 << 8)
+#define        LRADC_CTRL3_CYCLE_TIME_4MHZ                             (0x1 << 8)
+#define        LRADC_CTRL3_CYCLE_TIME_3MHZ                             (0x2 << 8)
+#define        LRADC_CTRL3_CYCLE_TIME_2MHZ                             (0x3 << 8)
+#define        LRADC_CTRL3_HIGH_TIME_MASK                              (0x3 << 4)
+#define        LRADC_CTRL3_HIGH_TIME_OFFSET                            4
+#define        LRADC_CTRL3_HIGH_TIME_42NS                              (0x0 << 4)
+#define        LRADC_CTRL3_HIGH_TIME_83NS                              (0x1 << 4)
+#define        LRADC_CTRL3_HIGH_TIME_125NS                             (0x2 << 4)
+#define        LRADC_CTRL3_HIGH_TIME_250NS                             (0x3 << 4)
+#define        LRADC_CTRL3_DELAY_CLOCK                                 (1 << 1)
+#define        LRADC_CTRL3_INVERT_CLOCK                                (1 << 0)
+
+#define        LRADC_STATUS_BUTTON1_PRESENT                            (1 << 28)
+#define        LRADC_STATUS_BUTTON0_PRESENT                            (1 << 27)
+#define        LRADC_STATUS_TEMP1_PRESENT                              (1 << 26)
+#define        LRADC_STATUS_TEMP0_PRESENT                              (1 << 25)
+#define        LRADC_STATUS_TOUCH_PANEL_PRESENT                        (1 << 24)
+#define        LRADC_STATUS_CHANNEL7_PRESENT                           (1 << 23)
+#define        LRADC_STATUS_CHANNEL6_PRESENT                           (1 << 22)
+#define        LRADC_STATUS_CHANNEL5_PRESENT                           (1 << 21)
+#define        LRADC_STATUS_CHANNEL4_PRESENT                           (1 << 20)
+#define        LRADC_STATUS_CHANNEL3_PRESENT                           (1 << 19)
+#define        LRADC_STATUS_CHANNEL2_PRESENT                           (1 << 18)
+#define        LRADC_STATUS_CHANNEL1_PRESENT                           (1 << 17)
+#define        LRADC_STATUS_CHANNEL0_PRESENT                           (1 << 16)
+#define        LRADC_STATUS_BUTTON1_DETECT_RAW                         (1 << 2)
+#define        LRADC_STATUS_BUTTON0_DETECT_RAW                         (1 << 1)
+#define        LRADC_STATUS_TOUCH_DETECT_RAW                           (1 << 0)
+
+#define        LRADC_CH_TOGGLE                                         (1 << 31)
+#define        LRADC_CH7_TESTMODE_TOGGLE                               (1 << 30)
+#define        LRADC_CH_ACCUMULATE                                     (1 << 29)
+#define        LRADC_CH_NUM_SAMPLES_MASK                               (0x1f << 24)
+#define        LRADC_CH_NUM_SAMPLES_OFFSET                             24
+#define        LRADC_CH_VALUE_MASK                                     0x3ffff
+#define        LRADC_CH_VALUE_OFFSET                                   0
+
+#define        LRADC_DELAY_TRIGGER_LRADCS_MASK                         (0xff << 24)
+#define        LRADC_DELAY_TRIGGER_LRADCS_OFFSET                       24
+#define        LRADC_DELAY_KICK                                        (1 << 20)
+#define        LRADC_DELAY_TRIGGER_DELAYS_MASK                         (0xf << 16)
+#define        LRADC_DELAY_TRIGGER_DELAYS_OFFSET                       16
+#define        LRADC_DELAY_LOOP_COUNT_MASK                             (0x1f << 11)
+#define        LRADC_DELAY_LOOP_COUNT_OFFSET                           11
+#define        LRADC_DELAY_DELAY_MASK                                  0x7ff
+#define        LRADC_DELAY_DELAY_OFFSET                                0
+
+#define        LRADC_DEBUG0_READONLY_MASK                              (0xffff << 16)
+#define        LRADC_DEBUG0_READONLY_OFFSET                            16
+#define        LRADC_DEBUG0_STATE_MASK                                 (0xfff << 0)
+#define        LRADC_DEBUG0_STATE_OFFSET                               0
+
+#define        LRADC_DEBUG1_REQUEST_MASK                               (0xff << 16)
+#define        LRADC_DEBUG1_REQUEST_OFFSET                             16
+#define        LRADC_DEBUG1_TESTMODE_COUNT_MASK                        (0x1f << 8)
+#define        LRADC_DEBUG1_TESTMODE_COUNT_OFFSET                      8
+#define        LRADC_DEBUG1_TESTMODE6                                  (1 << 2)
+#define        LRADC_DEBUG1_TESTMODE5                                  (1 << 1)
+#define        LRADC_DEBUG1_TESTMODE                                   (1 << 0)
+
+#define        LRADC_CONVERSION_AUTOMATIC                              (1 << 20)
+#define        LRADC_CONVERSION_SCALE_FACTOR_MASK                      (0x3 << 16)
+#define        LRADC_CONVERSION_SCALE_FACTOR_OFFSET                    16
+#define        LRADC_CONVERSION_SCALE_FACTOR_NIMH                      (0x0 << 16)
+#define        LRADC_CONVERSION_SCALE_FACTOR_DUAL_NIMH                 (0x1 << 16)
+#define        LRADC_CONVERSION_SCALE_FACTOR_LI_ION                    (0x2 << 16)
+#define        LRADC_CONVERSION_SCALE_FACTOR_ALT_LI_ION                (0x3 << 16)
+#define        LRADC_CONVERSION_SCALED_BATT_VOLTAGE_MASK               0x3ff
+#define        LRADC_CONVERSION_SCALED_BATT_VOLTAGE_OFFSET             0
+
+#define        LRADC_CTRL4_LRADC7SELECT_MASK                           (0xf << 28)
+#define        LRADC_CTRL4_LRADC7SELECT_OFFSET                         28
+#define        LRADC_CTRL4_LRADC7SELECT_CHANNEL0                       (0x0 << 28)
+#define        LRADC_CTRL4_LRADC7SELECT_CHANNEL1                       (0x1 << 28)
+#define        LRADC_CTRL4_LRADC7SELECT_CHANNEL2                       (0x2 << 28)
+#define        LRADC_CTRL4_LRADC7SELECT_CHANNEL3                       (0x3 << 28)
+#define        LRADC_CTRL4_LRADC7SELECT_CHANNEL4                       (0x4 << 28)
+#define        LRADC_CTRL4_LRADC7SELECT_CHANNEL5                       (0x5 << 28)
+#define        LRADC_CTRL4_LRADC7SELECT_CHANNEL6                       (0x6 << 28)
+#define        LRADC_CTRL4_LRADC7SELECT_CHANNEL7                       (0x7 << 28)
+#define        LRADC_CTRL4_LRADC7SELECT_CHANNEL8                       (0x8 << 28)
+#define        LRADC_CTRL4_LRADC7SELECT_CHANNEL9                       (0x9 << 28)
+#define        LRADC_CTRL4_LRADC7SELECT_CHANNEL10                      (0xa << 28)
+#define        LRADC_CTRL4_LRADC7SELECT_CHANNEL11                      (0xb << 28)
+#define        LRADC_CTRL4_LRADC7SELECT_CHANNEL12                      (0xc << 28)
+#define        LRADC_CTRL4_LRADC7SELECT_CHANNEL13                      (0xd << 28)
+#define        LRADC_CTRL4_LRADC7SELECT_CHANNEL14                      (0xe << 28)
+#define        LRADC_CTRL4_LRADC7SELECT_CHANNEL15                      (0xf << 28)
+#define        LRADC_CTRL4_LRADC6SELECT_MASK                           (0xf << 24)
+#define        LRADC_CTRL4_LRADC6SELECT_OFFSET                         24
+#define        LRADC_CTRL4_LRADC6SELECT_CHANNEL0                       (0x0 << 24)
+#define        LRADC_CTRL4_LRADC6SELECT_CHANNEL1                       (0x1 << 24)
+#define        LRADC_CTRL4_LRADC6SELECT_CHANNEL2                       (0x2 << 24)
+#define        LRADC_CTRL4_LRADC6SELECT_CHANNEL3                       (0x3 << 24)
+#define        LRADC_CTRL4_LRADC6SELECT_CHANNEL4                       (0x4 << 24)
+#define        LRADC_CTRL4_LRADC6SELECT_CHANNEL5                       (0x5 << 24)
+#define        LRADC_CTRL4_LRADC6SELECT_CHANNEL6                       (0x6 << 24)
+#define        LRADC_CTRL4_LRADC6SELECT_CHANNEL7                       (0x7 << 24)
+#define        LRADC_CTRL4_LRADC6SELECT_CHANNEL8                       (0x8 << 24)
+#define        LRADC_CTRL4_LRADC6SELECT_CHANNEL9                       (0x9 << 24)
+#define        LRADC_CTRL4_LRADC6SELECT_CHANNEL10                      (0xa << 24)
+#define        LRADC_CTRL4_LRADC6SELECT_CHANNEL11                      (0xb << 24)
+#define        LRADC_CTRL4_LRADC6SELECT_CHANNEL12                      (0xc << 24)
+#define        LRADC_CTRL4_LRADC6SELECT_CHANNEL13                      (0xd << 24)
+#define        LRADC_CTRL4_LRADC6SELECT_CHANNEL14                      (0xe << 24)
+#define        LRADC_CTRL4_LRADC6SELECT_CHANNEL15                      (0xf << 24)
+#define        LRADC_CTRL4_LRADC5SELECT_MASK                           (0xf << 20)
+#define        LRADC_CTRL4_LRADC5SELECT_OFFSET                         20
+#define        LRADC_CTRL4_LRADC5SELECT_CHANNEL0                       (0x0 << 20)
+#define        LRADC_CTRL4_LRADC5SELECT_CHANNEL1                       (0x1 << 20)
+#define        LRADC_CTRL4_LRADC5SELECT_CHANNEL2                       (0x2 << 20)
+#define        LRADC_CTRL4_LRADC5SELECT_CHANNEL3                       (0x3 << 20)
+#define        LRADC_CTRL4_LRADC5SELECT_CHANNEL4                       (0x4 << 20)
+#define        LRADC_CTRL4_LRADC5SELECT_CHANNEL5                       (0x5 << 20)
+#define        LRADC_CTRL4_LRADC5SELECT_CHANNEL6                       (0x6 << 20)
+#define        LRADC_CTRL4_LRADC5SELECT_CHANNEL7                       (0x7 << 20)
+#define        LRADC_CTRL4_LRADC5SELECT_CHANNEL8                       (0x8 << 20)
+#define        LRADC_CTRL4_LRADC5SELECT_CHANNEL9                       (0x9 << 20)
+#define        LRADC_CTRL4_LRADC5SELECT_CHANNEL10                      (0xa << 20)
+#define        LRADC_CTRL4_LRADC5SELECT_CHANNEL11                      (0xb << 20)
+#define        LRADC_CTRL4_LRADC5SELECT_CHANNEL12                      (0xc << 20)
+#define        LRADC_CTRL4_LRADC5SELECT_CHANNEL13                      (0xd << 20)
+#define        LRADC_CTRL4_LRADC5SELECT_CHANNEL14                      (0xe << 20)
+#define        LRADC_CTRL4_LRADC5SELECT_CHANNEL15                      (0xf << 20)
+#define        LRADC_CTRL4_LRADC4SELECT_MASK                           (0xf << 16)
+#define        LRADC_CTRL4_LRADC4SELECT_OFFSET                         16
+#define        LRADC_CTRL4_LRADC4SELECT_CHANNEL0                       (0x0 << 16)
+#define        LRADC_CTRL4_LRADC4SELECT_CHANNEL1                       (0x1 << 16)
+#define        LRADC_CTRL4_LRADC4SELECT_CHANNEL2                       (0x2 << 16)
+#define        LRADC_CTRL4_LRADC4SELECT_CHANNEL3                       (0x3 << 16)
+#define        LRADC_CTRL4_LRADC4SELECT_CHANNEL4                       (0x4 << 16)
+#define        LRADC_CTRL4_LRADC4SELECT_CHANNEL5                       (0x5 << 16)
+#define        LRADC_CTRL4_LRADC4SELECT_CHANNEL6                       (0x6 << 16)
+#define        LRADC_CTRL4_LRADC4SELECT_CHANNEL7                       (0x7 << 16)
+#define        LRADC_CTRL4_LRADC4SELECT_CHANNEL8                       (0x8 << 16)
+#define        LRADC_CTRL4_LRADC4SELECT_CHANNEL9                       (0x9 << 16)
+#define        LRADC_CTRL4_LRADC4SELECT_CHANNEL10                      (0xa << 16)
+#define        LRADC_CTRL4_LRADC4SELECT_CHANNEL11                      (0xb << 16)
+#define        LRADC_CTRL4_LRADC4SELECT_CHANNEL12                      (0xc << 16)
+#define        LRADC_CTRL4_LRADC4SELECT_CHANNEL13                      (0xd << 16)
+#define        LRADC_CTRL4_LRADC4SELECT_CHANNEL14                      (0xe << 16)
+#define        LRADC_CTRL4_LRADC4SELECT_CHANNEL15                      (0xf << 16)
+#define        LRADC_CTRL4_LRADC3SELECT_MASK                           (0xf << 12)
+#define        LRADC_CTRL4_LRADC3SELECT_OFFSET                         12
+#define        LRADC_CTRL4_LRADC3SELECT_CHANNEL0                       (0x0 << 12)
+#define        LRADC_CTRL4_LRADC3SELECT_CHANNEL1                       (0x1 << 12)
+#define        LRADC_CTRL4_LRADC3SELECT_CHANNEL2                       (0x2 << 12)
+#define        LRADC_CTRL4_LRADC3SELECT_CHANNEL3                       (0x3 << 12)
+#define        LRADC_CTRL4_LRADC3SELECT_CHANNEL4                       (0x4 << 12)
+#define        LRADC_CTRL4_LRADC3SELECT_CHANNEL5                       (0x5 << 12)
+#define        LRADC_CTRL4_LRADC3SELECT_CHANNEL6                       (0x6 << 12)
+#define        LRADC_CTRL4_LRADC3SELECT_CHANNEL7                       (0x7 << 12)
+#define        LRADC_CTRL4_LRADC3SELECT_CHANNEL8                       (0x8 << 12)
+#define        LRADC_CTRL4_LRADC3SELECT_CHANNEL9                       (0x9 << 12)
+#define        LRADC_CTRL4_LRADC3SELECT_CHANNEL10                      (0xa << 12)
+#define        LRADC_CTRL4_LRADC3SELECT_CHANNEL11                      (0xb << 12)
+#define        LRADC_CTRL4_LRADC3SELECT_CHANNEL12                      (0xc << 12)
+#define        LRADC_CTRL4_LRADC3SELECT_CHANNEL13                      (0xd << 12)
+#define        LRADC_CTRL4_LRADC3SELECT_CHANNEL14                      (0xe << 12)
+#define        LRADC_CTRL4_LRADC3SELECT_CHANNEL15                      (0xf << 12)
+#define        LRADC_CTRL4_LRADC2SELECT_MASK                           (0xf << 8)
+#define        LRADC_CTRL4_LRADC2SELECT_OFFSET                         8
+#define        LRADC_CTRL4_LRADC2SELECT_CHANNEL0                       (0x0 << 8)
+#define        LRADC_CTRL4_LRADC2SELECT_CHANNEL1                       (0x1 << 8)
+#define        LRADC_CTRL4_LRADC2SELECT_CHANNEL2                       (0x2 << 8)
+#define        LRADC_CTRL4_LRADC2SELECT_CHANNEL3                       (0x3 << 8)
+#define        LRADC_CTRL4_LRADC2SELECT_CHANNEL4                       (0x4 << 8)
+#define        LRADC_CTRL4_LRADC2SELECT_CHANNEL5                       (0x5 << 8)
+#define        LRADC_CTRL4_LRADC2SELECT_CHANNEL6                       (0x6 << 8)
+#define        LRADC_CTRL4_LRADC2SELECT_CHANNEL7                       (0x7 << 8)
+#define        LRADC_CTRL4_LRADC2SELECT_CHANNEL8                       (0x8 << 8)
+#define        LRADC_CTRL4_LRADC2SELECT_CHANNEL9                       (0x9 << 8)
+#define        LRADC_CTRL4_LRADC2SELECT_CHANNEL10                      (0xa << 8)
+#define        LRADC_CTRL4_LRADC2SELECT_CHANNEL11                      (0xb << 8)
+#define        LRADC_CTRL4_LRADC2SELECT_CHANNEL12                      (0xc << 8)
+#define        LRADC_CTRL4_LRADC2SELECT_CHANNEL13                      (0xd << 8)
+#define        LRADC_CTRL4_LRADC2SELECT_CHANNEL14                      (0xe << 8)
+#define        LRADC_CTRL4_LRADC2SELECT_CHANNEL15                      (0xf << 8)
+#define        LRADC_CTRL4_LRADC1SELECT_MASK                           (0xf << 4)
+#define        LRADC_CTRL4_LRADC1SELECT_OFFSET                         4
+#define        LRADC_CTRL4_LRADC1SELECT_CHANNEL0                       (0x0 << 4)
+#define        LRADC_CTRL4_LRADC1SELECT_CHANNEL1                       (0x1 << 4)
+#define        LRADC_CTRL4_LRADC1SELECT_CHANNEL2                       (0x2 << 4)
+#define        LRADC_CTRL4_LRADC1SELECT_CHANNEL3                       (0x3 << 4)
+#define        LRADC_CTRL4_LRADC1SELECT_CHANNEL4                       (0x4 << 4)
+#define        LRADC_CTRL4_LRADC1SELECT_CHANNEL5                       (0x5 << 4)
+#define        LRADC_CTRL4_LRADC1SELECT_CHANNEL6                       (0x6 << 4)
+#define        LRADC_CTRL4_LRADC1SELECT_CHANNEL7                       (0x7 << 4)
+#define        LRADC_CTRL4_LRADC1SELECT_CHANNEL8                       (0x8 << 4)
+#define        LRADC_CTRL4_LRADC1SELECT_CHANNEL9                       (0x9 << 4)
+#define        LRADC_CTRL4_LRADC1SELECT_CHANNEL10                      (0xa << 4)
+#define        LRADC_CTRL4_LRADC1SELECT_CHANNEL11                      (0xb << 4)
+#define        LRADC_CTRL4_LRADC1SELECT_CHANNEL12                      (0xc << 4)
+#define        LRADC_CTRL4_LRADC1SELECT_CHANNEL13                      (0xd << 4)
+#define        LRADC_CTRL4_LRADC1SELECT_CHANNEL14                      (0xe << 4)
+#define        LRADC_CTRL4_LRADC1SELECT_CHANNEL15                      (0xf << 4)
+#define        LRADC_CTRL4_LRADC0SELECT_MASK                           0xf
+#define        LRADC_CTRL4_LRADC0SELECT_CHANNEL0                       (0x0 << 0)
+#define        LRADC_CTRL4_LRADC0SELECT_CHANNEL1                       (0x1 << 0)
+#define        LRADC_CTRL4_LRADC0SELECT_CHANNEL2                       (0x2 << 0)
+#define        LRADC_CTRL4_LRADC0SELECT_CHANNEL3                       (0x3 << 0)
+#define        LRADC_CTRL4_LRADC0SELECT_CHANNEL4                       (0x4 << 0)
+#define        LRADC_CTRL4_LRADC0SELECT_CHANNEL5                       (0x5 << 0)
+#define        LRADC_CTRL4_LRADC0SELECT_CHANNEL6                       (0x6 << 0)
+#define        LRADC_CTRL4_LRADC0SELECT_CHANNEL7                       (0x7 << 0)
+#define        LRADC_CTRL4_LRADC0SELECT_CHANNEL8                       (0x8 << 0)
+#define        LRADC_CTRL4_LRADC0SELECT_CHANNEL9                       (0x9 << 0)
+#define        LRADC_CTRL4_LRADC0SELECT_CHANNEL10                      (0xa << 0)
+#define        LRADC_CTRL4_LRADC0SELECT_CHANNEL11                      (0xb << 0)
+#define        LRADC_CTRL4_LRADC0SELECT_CHANNEL12                      (0xc << 0)
+#define        LRADC_CTRL4_LRADC0SELECT_CHANNEL13                      (0xd << 0)
+#define        LRADC_CTRL4_LRADC0SELECT_CHANNEL14                      (0xe << 0)
+#define        LRADC_CTRL4_LRADC0SELECT_CHANNEL15                      (0xf << 0)
+
+#define        LRADC_THRESHOLD_ENABLE                                  (1 << 24)
+#define        LRADC_THRESHOLD_BATTCHRG_DISABLE                        (1 << 23)
+#define        LRADC_THRESHOLD_CHANNEL_SEL_MASK                        (0x7 << 20)
+#define        LRADC_THRESHOLD_CHANNEL_SEL_OFFSET                      20
+#define        LRADC_THRESHOLD_CHANNEL_SEL_CHANNEL0                    (0x0 << 20)
+#define        LRADC_THRESHOLD_CHANNEL_SEL_CHANNEL1                    (0x1 << 20)
+#define        LRADC_THRESHOLD_CHANNEL_SEL_CHANNEL2                    (0x2 << 20)
+#define        LRADC_THRESHOLD_CHANNEL_SEL_CHANNEL3                    (0x3 << 20)
+#define        LRADC_THRESHOLD_CHANNEL_SEL_CHANNEL4                    (0x4 << 20)
+#define        LRADC_THRESHOLD_CHANNEL_SEL_CHANNEL5                    (0x5 << 20)
+#define        LRADC_THRESHOLD_CHANNEL_SEL_CHANNEL6                    (0x6 << 20)
+#define        LRADC_THRESHOLD_CHANNEL_SEL_CHANNEL7                    (0x7 << 20)
+#define        LRADC_THRESHOLD_SETTING_MASK                            (0x3 << 18)
+#define        LRADC_THRESHOLD_SETTING_OFFSET                          18
+#define        LRADC_THRESHOLD_SETTING_NO_COMPARE                      (0x0 << 18)
+#define        LRADC_THRESHOLD_SETTING_DETECT_LOW                      (0x1 << 18)
+#define        LRADC_THRESHOLD_SETTING_DETECT_HIGH                     (0x2 << 18)
+#define        LRADC_THRESHOLD_SETTING_RESERVED                        (0x3 << 18)
+#define        LRADC_THRESHOLD_VALUE_MASK                              0x3ffff
+#define        LRADC_THRESHOLD_VALUE_OFFSET                            0
+
+#define        LRADC_VERSION_MAJOR_MASK                                (0xff << 24)
+#define        LRADC_VERSION_MAJOR_OFFSET                              24
+#define        LRADC_VERSION_MINOR_MASK                                (0xff << 16)
+#define        LRADC_VERSION_MINOR_OFFSET                              16
+#define        LRADC_VERSION_STEP_MASK                                 0xffff
+#define        LRADC_VERSION_STEP_OFFSET                               0
+
+#endif /* __MX28_REGS_LRADC_H__ */
index 15d8de31ee91af6089f4731602538892a0bb4e88..e701c6409e0accedc8383f0f7ea9b976bc2c76c1 100644 (file)
@@ -39,6 +39,36 @@ void mx28_common_spl_init(const iomux_cfg_t *iomux_setup,
                        const unsigned int iomux_size);
 #endif
 
+struct mx28_pair {
+       uint8_t boot_pads;
+       uint8_t boot_mask;
+       const char *mode;
+};
+
+static const struct mx28_pair mx28_boot_modes[] = {
+       { 0x00, 0x0f, "USB #0" },
+       { 0x01, 0x1f, "I2C #0, master, 3V3" },
+       { 0x11, 0x1f, "I2C #0, master, 1V8" },
+       { 0x02, 0x1f, "SSP SPI #2, master, 3V3 NOR" },
+       { 0x12, 0x1f, "SSP SPI #2, master, 1V8 NOR" },
+       { 0x03, 0x1f, "SSP SPI #3, master, 3V3 NOR" },
+       { 0x13, 0x1f, "SSP SPI #3, master, 1V8 NOR" },
+       { 0x04, 0x1f, "NAND, 3V3" },
+       { 0x14, 0x1f, "NAND, 1V8" },
+       { 0x08, 0x1f, "SSP SPI #3, master, 3V3 EEPROM" },
+       { 0x18, 0x1f, "SSP SPI #3, master, 1V8 EEPROM" },
+       { 0x09, 0x1f, "SSP SD/MMC #0, 3V3" },
+       { 0x19, 0x1f, "SSP SD/MMC #0, 1V8" },
+       { 0x0a, 0x1f, "SSP SD/MMC #1, 3V3" },
+       { 0x1a, 0x1f, "SSP SD/MMC #1, 1V8" },
+       { 0x00, 0x00, "Reserved/Unknown/Wrong" },
+};
+
+struct mx28_spl_data {
+       uint8_t         boot_mode_idx;
+       uint32_t        mem_dram_size;
+};
+
 int mx28_dram_init(void);
 
 #endif /* __MX28_H__ */
index ea972a398545169e060924155bded2eebbf19cf5..35ee8155de90faf251e9e67aaa2967f6b7855d47 100644 (file)
@@ -32,6 +32,10 @@ enum mxc_clock {
        MXC_UART_CLK,
        MXC_CSPI_CLK,
        MXC_FEC_CLK,
+       MXC_SATA_CLK,
+       MXC_DDR_CLK,
+       MXC_NFC_CLK,
+       MXC_PERIPH_CLK,
 };
 
 unsigned int imx_decode_pll(unsigned int pll, unsigned int f_ref);
@@ -39,10 +43,11 @@ unsigned int imx_decode_pll(unsigned int pll, unsigned int f_ref);
 u32 imx_get_uartclk(void);
 u32 imx_get_fecclk(void);
 unsigned int mxc_get_clock(enum mxc_clock clk);
-
+int mxc_set_clock(u32 ref, u32 freq, u32 clk_type);
 void set_usb_phy2_clk(void);
 void enable_usb_phy2_clk(unsigned char enable);
 void set_usboh3_clk(void);
 void enable_usboh3_clk(unsigned char enable);
+void mxc_set_sata_internal_clock(void);
 
 #endif /* __ASM_ARCH_CLOCK_H */
index bdeafbc0df7b26ebe69838fcd79318e14bb301da..4e0fc1bc1d69277da7b6451f05f41174cae8bdf3 100644 (file)
@@ -76,6 +76,9 @@ struct mxc_ccm_reg {
        u32 CCGR4;
        u32 CCGR5;
        u32 CCGR6;      /* 0x0080 */
+#ifdef CONFIG_MX53
+       u32 CCGR7;      /* 0x0084 */
+#endif
        u32 cmeor;
 };
 
@@ -84,6 +87,9 @@ struct mxc_ccm_reg {
 #define MXC_CCM_CACRR_ARM_PODF_MASK            0x7
 
 /* Define the bits in register CBCDR */
+#define MXC_CCM_CBCDR_DDR_HIFREQ_SEL           (0x1 << 30)
+#define MXC_CCM_CBCDR_DDR_PODF_MASK            (0x7 << 27)
+#define MXC_CCM_CBCDR_DDR_PODF_OFFSET          27
 #define MXC_CCM_CBCDR_EMI_CLK_SEL              (0x1 << 26)
 #define MXC_CCM_CBCDR_PERIPH_CLK_SEL           (0x1 << 25)
 #define MXC_CCM_CBCDR_EMI_PODF_OFFSET          22
index 4fa66587a0b7dabdd9a76ba0dd7aaf02a47d5882..6f06c88568d995c7619aadb6d15182f7cda0c5a6 100644 (file)
 #if defined(CONFIG_MX51)
 #define IRAM_BASE_ADDR         0x1FFE0000      /* internal ram */
 #define IPU_CTRL_BASE_ADDR     0x40000000
-#define SPBA0_BASE_ADDR         0x70000000
-#define AIPS1_BASE_ADDR         0x73F00000
-#define AIPS2_BASE_ADDR         0x83F00000
-#define CSD0_BASE_ADDR          0x90000000
-#define CSD1_BASE_ADDR          0xA0000000
-#define NFC_BASE_ADDR_AXI       0xCFFF0000
-#define CS1_BASE_ADDR           0xB8000000
+#define SPBA0_BASE_ADDR                0x70000000
+#define AIPS1_BASE_ADDR                0x73F00000
+#define AIPS2_BASE_ADDR                0x83F00000
+#define CSD0_BASE_ADDR         0x90000000
+#define CSD1_BASE_ADDR         0xA0000000
+#define NFC_BASE_ADDR_AXI      0xCFFF0000
+#define CS1_BASE_ADDR          0xB8000000
 #elif defined(CONFIG_MX53)
-#define IPU_CTRL_BASE_ADDR      0x18000000
-#define SPBA0_BASE_ADDR         0x50000000
-#define AIPS1_BASE_ADDR         0x53F00000
-#define AIPS2_BASE_ADDR         0x63F00000
-#define CSD0_BASE_ADDR          0x70000000
-#define CSD1_BASE_ADDR          0xB0000000
-#define NFC_BASE_ADDR_AXI       0xF7FF0000
-#define IRAM_BASE_ADDR          0xF8000000
-#define CS1_BASE_ADDR           0xF4000000
+#define IPU_CTRL_BASE_ADDR     0x00000000
+#define SPBA0_BASE_ADDR                0x50000000
+#define AIPS1_BASE_ADDR                0x53F00000
+#define AIPS2_BASE_ADDR                0x63F00000
+#define CSD0_BASE_ADDR         0x70000000
+#define CSD1_BASE_ADDR         0xB0000000
+#define NFC_BASE_ADDR_AXI      0xF7FF0000
+#define IRAM_BASE_ADDR         0xF8000000
+#define CS1_BASE_ADDR          0xF4000000
+#define SATA_BASE_ADDR         0x10000000
 #else
 #error "CPU_TYPE not defined"
 #endif
@@ -55,7 +56,7 @@
 #define MMC_SDHC1_BASE_ADDR    (SPBA0_BASE_ADDR + 0x00004000)
 #define MMC_SDHC2_BASE_ADDR    (SPBA0_BASE_ADDR + 0x00008000)
 #define UART3_BASE             (SPBA0_BASE_ADDR + 0x0000C000)
-#define CSPI1_BASE_ADDR        (SPBA0_BASE_ADDR + 0x00010000)
+#define CSPI1_BASE_ADDR                (SPBA0_BASE_ADDR + 0x00010000)
 #define SSI2_BASE_ADDR         (SPBA0_BASE_ADDR + 0x00014000)
 #define MMC_SDHC3_BASE_ADDR    (SPBA0_BASE_ADDR + 0x00020000)
 #define MMC_SDHC4_BASE_ADDR    (SPBA0_BASE_ADDR + 0x00024000)
 #define GPC_BASE_ADDR          (AIPS1_BASE_ADDR + 0x000D8000)
 
 #if defined(CONFIG_MX53)
-#define GPIO5_BASE_ADDR         (AIPS1_BASE_ADDR + 0x000DC000)
-#define GPIO6_BASE_ADDR         (AIPS1_BASE_ADDR + 0x000E0000)
-#define GPIO7_BASE_ADDR         (AIPS1_BASE_ADDR + 0x000E4000)
+#define GPIO5_BASE_ADDR                (AIPS1_BASE_ADDR + 0x000DC000)
+#define GPIO6_BASE_ADDR                (AIPS1_BASE_ADDR + 0x000E0000)
+#define GPIO7_BASE_ADDR                (AIPS1_BASE_ADDR + 0x000E4000)
+#define UART4_BASE_ADDR                (AIPS1_BASE_ADDR + 0x000F0000)
 #endif
 /*
  * AIPS 2
 #define IIM_BASE_ADDR          (AIPS2_BASE_ADDR + 0x00098000)
 #define CSU_BASE_ADDR          (AIPS2_BASE_ADDR + 0x0009C000)
 #define ARM_BASE_ADDR          (AIPS2_BASE_ADDR + 0x000A0000)
-#define OWIRE_BASE_ADDR        (AIPS2_BASE_ADDR + 0x000A4000)
+#define OWIRE_BASE_ADDR                (AIPS2_BASE_ADDR + 0x000A4000)
 #define FIRI_BASE_ADDR         (AIPS2_BASE_ADDR + 0x000A8000)
 #define CSPI2_BASE_ADDR                (AIPS2_BASE_ADDR + 0x000AC000)
 #define SDMA_BASE_ADDR         (AIPS2_BASE_ADDR + 0x000B0000)
 #define VPU_BASE_ADDR          (AIPS2_BASE_ADDR + 0x000F4000)
 #define SAHARA_BASE_ADDR       (AIPS2_BASE_ADDR + 0x000F8000)
 
+#if defined(CONFIG_MX53)
+#define UART5_BASE_ADDR                (AIPS2_BASE_ADDR + 0x00090000)
+#endif
+
 /*
  * WEIM CSnGCR1
  */
 /*
  * Number of GPIO pins per port
  */
-#define GPIO_NUM_PIN            32
+#define GPIO_NUM_PIN   32
 
 #define IIM_SREV       0x24
 #define ROM_SI_REV     0x48
 #define DP_MFD_665     (96 - 1)
 #define DP_MFN_665     89
 
+#define DP_OP_600       ((6 << 4) + ((1 - 1)  << 0))
+#define DP_MFD_600      (4 - 1)
+#define DP_MFN_600      1
+
 #define DP_OP_532      ((5 << 4) + ((1 - 1)  << 0))
 #define DP_MFD_532     (24 - 1)
 #define DP_MFN_532     13
 #define DP_MFD_400     (3 - 1)
 #define DP_MFN_400     1
 
+#define DP_OP_333      ((6 << 4) + ((2 - 1)  << 0))
+#define DP_MFD_333     (16 - 1)
+#define DP_MFN_333     15
+
 #define DP_OP_216      ((6 << 4) + ((3 - 1)  << 0))
 #define DP_MFD_216     (4 - 1)
 #define DP_MFN_216     3
 
-#define CHIP_REV_1_0            0x10
-#define CHIP_REV_1_1            0x11
-#define CHIP_REV_2_0            0x20
-#define CHIP_REV_2_5           0x25
-#define CHIP_REV_3_0            0x30
+#define CHIP_REV_1_0   0x10
+#define CHIP_REV_1_1   0x11
+#define CHIP_REV_2_0   0x20
+#define CHIP_REV_2_5   0x25
+#define CHIP_REV_3_0   0x30
 
-#define BOARD_REV_1_0           0x0
-#define BOARD_REV_2_0           0x1
+#define BOARD_REV_1_0  0x0
+#define BOARD_REV_2_0  0x1
 
-#define IMX_IIM_BASE            (IIM_BASE_ADDR)
+#define IMX_IIM_BASE   IIM_BASE_ADDR
 
 #if !(defined(__KERNEL_STRICT_NAMES) || defined(__ASSEMBLY__))
 #include <asm/types.h>
@@ -465,7 +479,7 @@ struct cspi_regs {
 struct iim_regs {
        u32     stat;
        u32     statm;
-       u32     err;
+       u32     err;
        u32     emask;
        u32     fctl;
        u32     ua;
@@ -485,12 +499,19 @@ struct iim_regs {
        } bank[4];
 };
 
+struct fuse_bank0_regs {
+       u32     fuse0_23[24];
+       u32     gp[8];
+};
+
 struct fuse_bank1_regs {
        u32     fuse0_8[9];
        u32     mac_addr[6];
        u32     fuse15_31[0x11];
 };
 
+extern void imx_get_mac_from_fuse(int dev_id, unsigned char *mac);
+
 #endif /* __ASSEMBLER__*/
 
 #endif                         /* __ASM_ARCH_MX5_IMX_REGS_H__ */
diff --git a/arch/arm/include/asm/arch-mx5/imx_iim.h b/arch/arm/include/asm/arch-mx5/imx_iim.h
new file mode 100644 (file)
index 0000000..bf0ea75
--- /dev/null
@@ -0,0 +1,55 @@
+/*
+ * (C) Copyright 2009-2010 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
+ */
+
+#ifndef __IMX_IIM_H__
+#define __IMX_IIM_H__
+
+/* IIM Status & Error Register bits */
+#define IIM_STAT_BUSY  (1 << 7)
+#define IIM_STAT_PRGD  (1 << 1)
+#define IIM_STAT_SNSD  (1 << 0)
+
+#define IIM_ERR_PRGE   (1 << 7)
+#define IIM_ERR_WPE    (1 << 6)
+#define IIM_ERR_OPE    (1 << 5)
+#define IIM_ERR_RPE    (1 << 4)
+#define IIM_ERR_WLRE   (1 << 3)
+#define IIM_ERR_SNSE   (1 << 2)
+#define IIM_ERR_PARITYE        (1 << 1)
+
+#define IIM_PROD_REV_SH                3
+#define IIM_PROD_REV_LEN       5
+#define IIM_SREV_REV_SH                4
+#define IIM_SREV_REV_LEN       4
+#define PROD_SIGNATURE_MX51    0x1
+
+#define IIM_ERR_SHIFT  8
+#define POLL_FUSE_PRGD (IIM_STAT_PRGD | (IIM_ERR_PRGE << IIM_ERR_SHIFT))
+#define POLL_FUSE_SNSD (IIM_STAT_SNSD | (IIM_ERR_SNSE << IIM_ERR_SHIFT))
+
+#define IIM_BANK_AREA_0_OFFSET 0x800
+#define IIM_BANK_AREA_1_OFFSET 0xc00
+#define IIM_BANK_AREA_2_OFFSET 0x1000
+#define IIM_BANK_AREA_3_OFFSET 0x1400
+
+int iim_read(int bank, char row);
+int iim_blow(int bank, int row, int val);
+int iim_blow_func(char *func_name, char *func_val);
+
+#endif
diff --git a/arch/arm/include/asm/arch-mx5/iomux-mx51.h b/arch/arm/include/asm/arch-mx5/iomux-mx51.h
new file mode 100644 (file)
index 0000000..7e3027b
--- /dev/null
@@ -0,0 +1,813 @@
+/*
+ * Copyright (C) 2009-2010 Amit Kucheria <amit.kucheria@canonical.com>
+ * Copyright (C) 2010 Freescale Semiconductor, Inc.
+ *
+ * The code contained herein is licensed under the GNU General Public
+ * License. You may obtain a copy of the GNU General Public License
+ * Version 2 or later at the following locations:
+ *
+ * http://www.opensource.org/licenses/gpl-license.html
+ * http://www.gnu.org/copyleft/gpl.html
+ */
+
+#ifndef __MACH_IOMUX_MX51_H__
+#define __MACH_IOMUX_MX51_H__
+
+#include "iomux-v3.h"
+#define __NA_  0x000
+
+
+/* Pad control groupings */
+#define MX51_UART_PAD_CTRL     (PAD_CTL_PKE | PAD_CTL_PUE | PAD_CTL_DSE_HIGH | \
+                               PAD_CTL_HYS | PAD_CTL_SRE_FAST)
+#define MX51_I2C_PAD_CTRL      (PAD_CTL_SRE_FAST | PAD_CTL_ODE | \
+                               PAD_CTL_DSE_HIGH | PAD_CTL_PUS_100K_UP | \
+                               PAD_CTL_HYS)
+#define MX51_ESDHC_PAD_CTRL    (PAD_CTL_SRE_FAST | PAD_CTL_ODE | \
+                               PAD_CTL_DSE_HIGH | PAD_CTL_PUS_100K_UP | \
+                               PAD_CTL_HYS)
+#define MX51_USBH1_PAD_CTRL    (PAD_CTL_PKE | PAD_CTL_SRE_FAST | \
+                               PAD_CTL_DSE_HIGH | PAD_CTL_PUS_100K_UP | \
+                               PAD_CTL_HYS | PAD_CTL_PUE)
+#define MX51_ECSPI_PAD_CTRL    (PAD_CTL_PKE | PAD_CTL_HYS | \
+                               PAD_CTL_DSE_HIGH | PAD_CTL_SRE_FAST)
+#define MX51_SDHCI_PAD_CTRL    (PAD_CTL_PKE | PAD_CTL_DSE_HIGH | \
+                               PAD_CTL_PUS_47K_UP | PAD_CTL_PUE | \
+                               PAD_CTL_SRE_FAST | PAD_CTL_DVS)
+#define MX51_GPIO_PAD_CTRL     (PAD_CTL_DSE_HIGH | PAD_CTL_PKE | PAD_CTL_SRE_FAST)
+
+#define MX51_PAD_CTRL_2                (PAD_CTL_PKE | PAD_CTL_HYS)
+#define MX51_PAD_CTRL_3                (PAD_CTL_PKE | PAD_CTL_PUS_100K_UP)
+#define MX51_PAD_CTRL_4                (PAD_CTL_PKE | PAD_CTL_DVS | PAD_CTL_HYS)
+#define MX51_PAD_CTRL_5                (PAD_CTL_DVS | PAD_CTL_DSE_HIGH)
+
+/*
+ * The naming convention for the pad modes is MX51_PAD_<padname>__<padmode>
+ * If <padname> or <padmode> refers to a GPIO, it is named GPIO<unit>_<num>
+ * See also iomux-v3.h
+ */
+
+/* Raw pin modes without pad control */
+/*                                                       PAD    MUX ALT INPSE PATH PADCTRL */
+
+/* The same pins as above but with the default pad control values applied */
+#define MX51_PAD_EIM_D16__AUD4_RXFS            IOMUX_PAD(0x3f0, 0x05c, 5, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_EIM_D16__AUD5_TXD             IOMUX_PAD(0x3f0, 0x05c, 7, 0x8d8, 0, NO_PAD_CTRL)
+#define MX51_PAD_EIM_D16__EIM_D16              IOMUX_PAD(0x3f0, 0x05c, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_EIM_D16__GPIO2_0              IOMUX_PAD(0x3f0, 0x05c, 1, __NA_, 0, MX51_GPIO_PAD_CTRL)
+#define MX51_PAD_EIM_D16__I2C1_SDA             IOMUX_PAD(0x3f0, 0x05c, 0x14, 0x9b4, 0, MX51_I2C_PAD_CTRL)
+#define MX51_PAD_EIM_D16__UART2_CTS            IOMUX_PAD(0x3f0, 0x05c, 3, __NA_, 0, MX51_UART_PAD_CTRL)
+#define MX51_PAD_EIM_D16__USBH2_DATA0          IOMUX_PAD(0x3f0, 0x05c, 2, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_EIM_D17__AUD5_RXD             IOMUX_PAD(0x3f4, 0x060, 7, 0x8d4, 0, NO_PAD_CTRL)
+#define MX51_PAD_EIM_D17__EIM_D17              IOMUX_PAD(0x3f4, 0x060, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_EIM_D17__GPIO2_1              IOMUX_PAD(0x3f4, 0x060, 1, __NA_, 0, MX51_GPIO_PAD_CTRL)
+#define MX51_PAD_EIM_D17__UART2_RXD            IOMUX_PAD(0x3f4, 0x060, 3, 0x9ec, 0, MX51_UART_PAD_CTRL)
+#define MX51_PAD_EIM_D17__UART3_CTS            IOMUX_PAD(0x3f4, 0x060, 4, __NA_, 0, MX51_UART_PAD_CTRL)
+#define MX51_PAD_EIM_D17__USBH2_DATA1          IOMUX_PAD(0x3f4, 0x060, 2, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_EIM_D18__AUD5_TXC             IOMUX_PAD(0x3f8, 0x064, 7, 0x8e4, 0, NO_PAD_CTRL)
+#define MX51_PAD_EIM_D18__EIM_D18              IOMUX_PAD(0x3f8, 0x064, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_EIM_D18__GPIO2_2              IOMUX_PAD(0x3f8, 0x064, 1, __NA_, 0, MX51_GPIO_PAD_CTRL)
+#define MX51_PAD_EIM_D18__UART2_TXD            IOMUX_PAD(0x3f8, 0x064, 3, __NA_, 0, MX51_UART_PAD_CTRL)
+#define MX51_PAD_EIM_D18__UART3_RTS            IOMUX_PAD(0x3f8, 0x064, 4, 0x9f0, 1, MX51_UART_PAD_CTRL)
+#define MX51_PAD_EIM_D18__USBH2_DATA2          IOMUX_PAD(0x3f8, 0x064, 2, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_EIM_D19__AUD4_RXC             IOMUX_PAD(0x3fc, 0x068, 5, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_EIM_D19__AUD5_TXFS            IOMUX_PAD(0x3fc, 0x068, 7, 0x8e8, 0, NO_PAD_CTRL)
+#define MX51_PAD_EIM_D19__EIM_D19              IOMUX_PAD(0x3fc, 0x068, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_EIM_D19__GPIO2_3              IOMUX_PAD(0x3fc, 0x068, 1, __NA_, 0, MX51_GPIO_PAD_CTRL)
+#define MX51_PAD_EIM_D19__I2C1_SCL             IOMUX_PAD(0x3fc, 0x068, 0x14, 0x9b0, 0, MX51_I2C_PAD_CTRL)
+#define MX51_PAD_EIM_D19__UART2_RTS            IOMUX_PAD(0x3fc, 0x068, 3, 0x9e8, 1, MX51_UART_PAD_CTRL)
+#define MX51_PAD_EIM_D19__USBH2_DATA3          IOMUX_PAD(0x3fc, 0x068, 2, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_EIM_D20__AUD4_TXD             IOMUX_PAD(0x400, 0x06c, 5, 0x8c8, 0, NO_PAD_CTRL)
+#define MX51_PAD_EIM_D20__EIM_D20              IOMUX_PAD(0x400, 0x06c, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_EIM_D20__GPIO2_4              IOMUX_PAD(0x400, 0x06c, 1, __NA_, 0, MX51_GPIO_PAD_CTRL)
+#define MX51_PAD_EIM_D20__SRTC_ALARM_DEB       IOMUX_PAD(0x400, 0x06c, 4, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_EIM_D20__USBH2_DATA4          IOMUX_PAD(0x400, 0x06c, 2, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_EIM_D21__AUD4_RXD             IOMUX_PAD(0x404, 0x070, 5, 0x8c4, 0, NO_PAD_CTRL)
+#define MX51_PAD_EIM_D21__EIM_D21              IOMUX_PAD(0x404, 0x070, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_EIM_D21__GPIO2_5              IOMUX_PAD(0x404, 0x070, 1, __NA_, 0, MX51_GPIO_PAD_CTRL)
+#define MX51_PAD_EIM_D21__SRTC_ALARM_DEB       IOMUX_PAD(0x404, 0x070, 3, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_EIM_D21__USBH2_DATA5          IOMUX_PAD(0x404, 0x070, 2, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_EIM_D22__AUD4_TXC             IOMUX_PAD(0x408, 0x074, 5, 0x8cc, 0, NO_PAD_CTRL)
+#define MX51_PAD_EIM_D22__EIM_D22              IOMUX_PAD(0x408, 0x074, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_EIM_D22__GPIO2_6              IOMUX_PAD(0x408, 0x074, 1, __NA_, 0, MX51_GPIO_PAD_CTRL)
+#define MX51_PAD_EIM_D22__USBH2_DATA6          IOMUX_PAD(0x408, 0x074, 2, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_EIM_D23__AUD4_TXFS            IOMUX_PAD(0x40c, 0x078, 5, 0x8d0, 0, NO_PAD_CTRL)
+#define MX51_PAD_EIM_D23__EIM_D23              IOMUX_PAD(0x40c, 0x078, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_EIM_D23__GPIO2_7              IOMUX_PAD(0x40c, 0x078, 1, __NA_, 0, MX51_GPIO_PAD_CTRL)
+#define MX51_PAD_EIM_D23__SPDIF_OUT1           IOMUX_PAD(0x40c, 0x078, 4, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_EIM_D23__USBH2_DATA7          IOMUX_PAD(0x40c, 0x078, 2, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_EIM_D24__AUD6_RXFS            IOMUX_PAD(0x410, 0x07c, 5, 0x8f8, 0, NO_PAD_CTRL)
+#define MX51_PAD_EIM_D24__EIM_D24              IOMUX_PAD(0x410, 0x07c, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_EIM_D24__GPIO2_8              IOMUX_PAD(0x410, 0x07c, 1, __NA_, 0, MX51_GPIO_PAD_CTRL)
+#define MX51_PAD_EIM_D24__I2C2_SDA             IOMUX_PAD(0x410, 0x07c, 0x14, 0x9bc, 0, MX51_I2C_PAD_CTRL)
+#define MX51_PAD_EIM_D24__UART3_CTS            IOMUX_PAD(0x410, 0x07c, 3, __NA_, 0, MX51_UART_PAD_CTRL)
+#define MX51_PAD_EIM_D24__USBOTG_DATA0         IOMUX_PAD(0x410, 0x07c, 2, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_EIM_D25__EIM_D25              IOMUX_PAD(0x414, 0x080, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_EIM_D25__KEY_COL6             IOMUX_PAD(0x414, 0x080, 1, 0x9c8, 0, NO_PAD_CTRL)
+#define MX51_PAD_EIM_D25__UART2_CTS            IOMUX_PAD(0x414, 0x080, 4, __NA_, 0, MX51_UART_PAD_CTRL)
+#define MX51_PAD_EIM_D25__UART3_RXD            IOMUX_PAD(0x414, 0x080, 3, 0x9f4, 0, MX51_UART_PAD_CTRL)
+#define MX51_PAD_EIM_D25__USBOTG_DATA1         IOMUX_PAD(0x414, 0x080, 2, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_EIM_D26__EIM_D26              IOMUX_PAD(0x418, 0x084, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_EIM_D26__KEY_COL7             IOMUX_PAD(0x418, 0x084, 1, 0x9cc, 0, NO_PAD_CTRL)
+#define MX51_PAD_EIM_D26__UART2_RTS            IOMUX_PAD(0x418, 0x084, 4, 0x9e8, 3, MX51_UART_PAD_CTRL)
+#define MX51_PAD_EIM_D26__UART3_TXD            IOMUX_PAD(0x418, 0x084, 3, __NA_, 0, MX51_UART_PAD_CTRL)
+#define MX51_PAD_EIM_D26__USBOTG_DATA2         IOMUX_PAD(0x418, 0x084, 2, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_EIM_D27__AUD6_RXC             IOMUX_PAD(0x41c, 0x088, 5, 0x8f4, 0, NO_PAD_CTRL)
+#define MX51_PAD_EIM_D27__EIM_D27              IOMUX_PAD(0x41c, 0x088, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_EIM_D27__GPIO2_9              IOMUX_PAD(0x41c, 0x088, 1, __NA_, 0, MX51_GPIO_PAD_CTRL)
+#define MX51_PAD_EIM_D27__I2C2_SCL             IOMUX_PAD(0x41c, 0x088, 0x14, 0x9b8, 0, MX51_I2C_PAD_CTRL)
+#define MX51_PAD_EIM_D27__UART3_RTS            IOMUX_PAD(0x41c, 0x088, 3, 0x9f0, 3, MX51_UART_PAD_CTRL)
+#define MX51_PAD_EIM_D27__USBOTG_DATA3         IOMUX_PAD(0x41c, 0x088, 2, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_EIM_D28__AUD6_TXD             IOMUX_PAD(0x420, 0x08c, 5, 0x8f0, 0, NO_PAD_CTRL)
+#define MX51_PAD_EIM_D28__EIM_D28              IOMUX_PAD(0x420, 0x08c, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_EIM_D28__KEY_ROW4             IOMUX_PAD(0x420, 0x08c, 1, 0x9d0, 0, NO_PAD_CTRL)
+#define MX51_PAD_EIM_D28__USBOTG_DATA4         IOMUX_PAD(0x420, 0x08c, 2, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_EIM_D29__AUD6_RXD             IOMUX_PAD(0x424, 0x090, 5, 0x8ec, 0, NO_PAD_CTRL)
+#define MX51_PAD_EIM_D29__EIM_D29              IOMUX_PAD(0x424, 0x090, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_EIM_D29__KEY_ROW5             IOMUX_PAD(0x424, 0x090, 1, 0x9d4, 0, NO_PAD_CTRL)
+#define MX51_PAD_EIM_D29__USBOTG_DATA5         IOMUX_PAD(0x424, 0x090, 2, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_EIM_D30__AUD6_TXC             IOMUX_PAD(0x428, 0x094, 5, 0x8fc, 0, NO_PAD_CTRL)
+#define MX51_PAD_EIM_D30__EIM_D30              IOMUX_PAD(0x428, 0x094, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_EIM_D30__KEY_ROW6             IOMUX_PAD(0x428, 0x094, 1, 0x9d8, 0, NO_PAD_CTRL)
+#define MX51_PAD_EIM_D30__USBOTG_DATA6         IOMUX_PAD(0x428, 0x094, 2, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_EIM_D31__AUD6_TXFS            IOMUX_PAD(0x42c, 0x098, 5, 0x900, 0, NO_PAD_CTRL)
+#define MX51_PAD_EIM_D31__EIM_D31              IOMUX_PAD(0x42c, 0x098, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_EIM_D31__KEY_ROW7             IOMUX_PAD(0x42c, 0x098, 1, 0x9dc, 0, NO_PAD_CTRL)
+#define MX51_PAD_EIM_D31__USBOTG_DATA7         IOMUX_PAD(0x42c, 0x098, 2, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_EIM_A16__EIM_A16              IOMUX_PAD(0x430, 0x09c, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_EIM_A16__GPIO2_10             IOMUX_PAD(0x430, 0x09c, 1, __NA_, 0, MX51_GPIO_PAD_CTRL)
+#define MX51_PAD_EIM_A16__OSC_FREQ_SEL0                IOMUX_PAD(0x430, 0x09c, 7, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_EIM_A17__EIM_A17              IOMUX_PAD(0x434, 0x0a0, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_EIM_A17__GPIO2_11             IOMUX_PAD(0x434, 0x0a0, 1, __NA_, 0, MX51_GPIO_PAD_CTRL)
+#define MX51_PAD_EIM_A17__OSC_FREQ_SEL1                IOMUX_PAD(0x434, 0x0a0, 7, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_EIM_A18__BOOT_LPB0            IOMUX_PAD(0x438, 0x0a4, 7, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_EIM_A18__EIM_A18              IOMUX_PAD(0x438, 0x0a4, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_EIM_A18__GPIO2_12             IOMUX_PAD(0x438, 0x0a4, 1, __NA_, 0, MX51_GPIO_PAD_CTRL)
+#define MX51_PAD_EIM_A19__BOOT_LPB1            IOMUX_PAD(0x43c, 0x0a8, 7, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_EIM_A19__EIM_A19              IOMUX_PAD(0x43c, 0x0a8, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_EIM_A19__GPIO2_13             IOMUX_PAD(0x43c, 0x0a8, 1, __NA_, 0, MX51_GPIO_PAD_CTRL)
+#define MX51_PAD_EIM_A20__BOOT_UART_SRC0       IOMUX_PAD(0x440, 0x0ac, 7, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_EIM_A20__EIM_A20              IOMUX_PAD(0x440, 0x0ac, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_EIM_A20__GPIO2_14             IOMUX_PAD(0x440, 0x0ac, 1, __NA_, 0, MX51_GPIO_PAD_CTRL)
+#define MX51_PAD_EIM_A21__BOOT_UART_SRC1       IOMUX_PAD(0x444, 0x0b0, 7, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_EIM_A21__EIM_A21              IOMUX_PAD(0x444, 0x0b0, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_EIM_A21__GPIO2_15             IOMUX_PAD(0x444, 0x0b0, 1, __NA_, 0, MX51_GPIO_PAD_CTRL)
+#define MX51_PAD_EIM_A22__EIM_A22              IOMUX_PAD(0x448, 0x0b4, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_EIM_A22__GPIO2_16             IOMUX_PAD(0x448, 0x0b4, 1, __NA_, 0, MX51_GPIO_PAD_CTRL)
+#define MX51_PAD_EIM_A23__BOOT_HPN_EN          IOMUX_PAD(0x44c, 0x0b8, 7, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_EIM_A23__EIM_A23              IOMUX_PAD(0x44c, 0x0b8, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_EIM_A23__GPIO2_17             IOMUX_PAD(0x44c, 0x0b8, 1, __NA_, 0, MX51_GPIO_PAD_CTRL)
+#define MX51_PAD_EIM_A24__EIM_A24              IOMUX_PAD(0x450, 0x0bc, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_EIM_A24__GPIO2_18             IOMUX_PAD(0x450, 0x0bc, 1, __NA_, 0, MX51_GPIO_PAD_CTRL)
+#define MX51_PAD_EIM_A24__USBH2_CLK            IOMUX_PAD(0x450, 0x0bc, 2, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_EIM_A25__DISP1_PIN4           IOMUX_PAD(0x454, 0x0c0, 6, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_EIM_A25__EIM_A25              IOMUX_PAD(0x454, 0x0c0, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_EIM_A25__GPIO2_19             IOMUX_PAD(0x454, 0x0c0, 1, __NA_, 0, MX51_GPIO_PAD_CTRL)
+#define MX51_PAD_EIM_A25__USBH2_DIR            IOMUX_PAD(0x454, 0x0c0, 2, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_EIM_A26__CSI1_DATA_EN         IOMUX_PAD(0x458, 0x0c4, 5, 0x9a0, 0, NO_PAD_CTRL)
+#define MX51_PAD_EIM_A26__DISP2_EXT_CLK                IOMUX_PAD(0x458, 0x0c4, 6, 0x908, 0, NO_PAD_CTRL)
+#define MX51_PAD_EIM_A26__EIM_A26              IOMUX_PAD(0x458, 0x0c4, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_EIM_A26__GPIO2_20             IOMUX_PAD(0x458, 0x0c4, 1, __NA_, 0, MX51_GPIO_PAD_CTRL)
+#define MX51_PAD_EIM_A26__USBH2_STP            IOMUX_PAD(0x458, 0x0c4, 2, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_EIM_A27__CSI2_DATA_EN         IOMUX_PAD(0x45c, 0x0c8, 5, 0x99c, 0, NO_PAD_CTRL)
+#define MX51_PAD_EIM_A27__DISP1_PIN1           IOMUX_PAD(0x45c, 0x0c8, 6, 0x9a4, 0, NO_PAD_CTRL)
+#define MX51_PAD_EIM_A27__EIM_A27              IOMUX_PAD(0x45c, 0x0c8, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_EIM_A27__GPIO2_21             IOMUX_PAD(0x45c, 0x0c8, 1, __NA_, 0, MX51_GPIO_PAD_CTRL)
+#define MX51_PAD_EIM_A27__USBH2_NXT            IOMUX_PAD(0x45c, 0x0c8, 2, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_EIM_EB0__EIM_EB0              IOMUX_PAD(0x460, 0x0cc, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_EIM_EB1__EIM_EB1              IOMUX_PAD(0x464, 0x0d0, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_EIM_EB2__AUD5_RXFS            IOMUX_PAD(0x468, 0x0d4, 6, 0x8e0, 0, NO_PAD_CTRL)
+#define MX51_PAD_EIM_EB2__CSI1_D2              IOMUX_PAD(0x468, 0x0d4, 5, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_EIM_EB2__EIM_EB2              IOMUX_PAD(0x468, 0x0d4, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_EIM_EB2__FEC_MDIO             (IOMUX_PAD(0x468, 0x0d4, 3, 0x954, 0, 0) | \
+               MUX_PAD_CTRL(PAD_CTL_PUS_22K_UP | PAD_CTL_PKE | PAD_CTL_SRE_FAST | \
+               PAD_CTL_DSE_HIGH | PAD_CTL_PUE | PAD_CTL_HYS))
+#define MX51_PAD_EIM_EB2__GPIO2_22             IOMUX_PAD(0x468, 0x0d4, 1, __NA_, 0, MX51_GPIO_PAD_CTRL)
+#define MX51_PAD_EIM_EB2__GPT_CMPOUT1          IOMUX_PAD(0x468, 0x0d4, 7, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_EIM_EB3__AUD5_RXC             IOMUX_PAD(0x46c, 0x0d8, 6, 0x8dc, 0, NO_PAD_CTRL)
+#define MX51_PAD_EIM_EB3__CSI1_D3              IOMUX_PAD(0x46c, 0x0d8, 5, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_EIM_EB3__EIM_EB3              IOMUX_PAD(0x46c, 0x0d8, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_EIM_EB3__FEC_RDATA1           IOMUX_PAD(0x46c, 0x0d8, 3, 0x95c, 0, NO_PAD_CTRL)
+#define MX51_PAD_EIM_EB3__GPIO2_23             IOMUX_PAD(0x46c, 0x0d8, 1, __NA_, 0, MX51_GPIO_PAD_CTRL)
+#define MX51_PAD_EIM_EB3__GPT_CMPOUT2          IOMUX_PAD(0x46c, 0x0d8, 7, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_EIM_OE__EIM_OE                        IOMUX_PAD(0x470, 0x0dc, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_EIM_OE__GPIO2_24              IOMUX_PAD(0x470, 0x0dc, 1, __NA_, 0, MX51_GPIO_PAD_CTRL)
+#define MX51_PAD_EIM_CS0__EIM_CS0              IOMUX_PAD(0x474, 0x0e0, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_EIM_CS0__GPIO2_25             IOMUX_PAD(0x474, 0x0e0, 1, __NA_, 0, MX51_GPIO_PAD_CTRL)
+#define MX51_PAD_EIM_CS1__EIM_CS1              IOMUX_PAD(0x478, 0x0e4, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_EIM_CS1__GPIO2_26             IOMUX_PAD(0x478, 0x0e4, 1, __NA_, 0, MX51_GPIO_PAD_CTRL)
+#define MX51_PAD_EIM_CS2__AUD5_TXD             IOMUX_PAD(0x47c, 0x0e8, 6, 0x8d8, 1, NO_PAD_CTRL)
+#define MX51_PAD_EIM_CS2__CSI1_D4              IOMUX_PAD(0x47c, 0x0e8, 5, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_EIM_CS2__EIM_CS2              IOMUX_PAD(0x47c, 0x0e8, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_EIM_CS2__FEC_RDATA2           IOMUX_PAD(0x47c, 0x0e8, 3, 0x960, 0, NO_PAD_CTRL)
+#define MX51_PAD_EIM_CS2__GPIO2_27             IOMUX_PAD(0x47c, 0x0e8, 1, __NA_, 0, MX51_GPIO_PAD_CTRL)
+#define MX51_PAD_EIM_CS2__USBOTG_STP           IOMUX_PAD(0x47c, 0x0e8, 2, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_EIM_CS3__AUD5_RXD             IOMUX_PAD(0x480, 0x0ec, 6, 0x8d4, 1, NO_PAD_CTRL)
+#define MX51_PAD_EIM_CS3__CSI1_D5              IOMUX_PAD(0x480, 0x0ec, 5, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_EIM_CS3__EIM_CS3              IOMUX_PAD(0x480, 0x0ec, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_EIM_CS3__FEC_RDATA3           IOMUX_PAD(0x480, 0x0ec, 3, 0x964, 0, NO_PAD_CTRL)
+#define MX51_PAD_EIM_CS3__GPIO2_28             IOMUX_PAD(0x480, 0x0ec, 1, __NA_, 0, MX51_GPIO_PAD_CTRL)
+#define MX51_PAD_EIM_CS3__USBOTG_NXT           IOMUX_PAD(0x480, 0x0ec, 2, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_EIM_CS4__AUD5_TXC             IOMUX_PAD(0x484, 0x0f0, 6, 0x8e4, 1, NO_PAD_CTRL)
+#define MX51_PAD_EIM_CS4__CSI1_D6              IOMUX_PAD(0x484, 0x0f0, 5, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_EIM_CS4__EIM_CS4              IOMUX_PAD(0x484, 0x0f0, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_EIM_CS4__FEC_RX_ER            IOMUX_PAD(0x484, 0x0f0, 3, 0x970, 0, MX51_PAD_CTRL_2)
+#define MX51_PAD_EIM_CS4__GPIO2_29             IOMUX_PAD(0x484, 0x0f0, 1, __NA_, 0, MX51_GPIO_PAD_CTRL)
+#define MX51_PAD_EIM_CS4__USBOTG_CLK           IOMUX_PAD(0x484, 0x0f0, 2, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_EIM_CS5__AUD5_TXFS            IOMUX_PAD(0x488, 0x0f4, 6, 0x8e8, 1, NO_PAD_CTRL)
+#define MX51_PAD_EIM_CS5__CSI1_D7              IOMUX_PAD(0x488, 0x0f4, 5, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_EIM_CS5__DISP1_EXT_CLK                IOMUX_PAD(0x488, 0x0f4, 4, 0x904, 0, NO_PAD_CTRL)
+#define MX51_PAD_EIM_CS5__EIM_CS5              IOMUX_PAD(0x488, 0x0f4, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_EIM_CS5__FEC_CRS              IOMUX_PAD(0x488, 0x0f4, 3, 0x950, 0, MX51_PAD_CTRL_2)
+#define MX51_PAD_EIM_CS5__GPIO2_30             IOMUX_PAD(0x488, 0x0f4, 1, __NA_, 0, MX51_GPIO_PAD_CTRL)
+#define MX51_PAD_EIM_CS5__USBOTG_DIR           IOMUX_PAD(0x488, 0x0f4, 2, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_EIM_DTACK__EIM_DTACK          IOMUX_PAD(0x48c, 0x0f8, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_EIM_DTACK__GPIO2_31           IOMUX_PAD(0x48c, 0x0f8, 1, __NA_, 0, MX51_GPIO_PAD_CTRL)
+#define MX51_PAD_EIM_LBA__EIM_LBA              IOMUX_PAD(0x494, 0x0fc, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_EIM_LBA__GPIO3_1              IOMUX_PAD(0x494, 0x0fc, 1, 0x978, 0, MX51_GPIO_PAD_CTRL)
+#define MX51_PAD_EIM_CRE__EIM_CRE              IOMUX_PAD(0x4a0, 0x100, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_EIM_CRE__GPIO3_2              IOMUX_PAD(0x4a0, 0x100, 1, 0x97c, 0, MX51_GPIO_PAD_CTRL)
+#define MX51_PAD_DRAM_CS1__DRAM_CS1            IOMUX_PAD(0x4d0, 0x104, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_NANDF_WE_B__GPIO3_3           IOMUX_PAD(0x4e4, 0x108, 3, 0x980, 0, MX51_GPIO_PAD_CTRL)
+#define MX51_PAD_NANDF_WE_B__NANDF_WE_B                IOMUX_PAD(0x4e4, 0x108, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_NANDF_WE_B__PATA_DIOW         IOMUX_PAD(0x4e4, 0x108, 1, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_NANDF_WE_B__SD3_DATA0         IOMUX_PAD(0x4e4, 0x108, 2, 0x93c, 0, MX51_SDHCI_PAD_CTRL)
+#define MX51_PAD_NANDF_RE_B__GPIO3_4           IOMUX_PAD(0x4e8, 0x10c, 3, 0x984, 0, MX51_GPIO_PAD_CTRL)
+#define MX51_PAD_NANDF_RE_B__NANDF_RE_B                IOMUX_PAD(0x4e8, 0x10c, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_NANDF_RE_B__PATA_DIOR         IOMUX_PAD(0x4e8, 0x10c, 1, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_NANDF_RE_B__SD3_DATA1         IOMUX_PAD(0x4e8, 0x10c, 2, 0x940, 0, MX51_SDHCI_PAD_CTRL)
+#define MX51_PAD_NANDF_ALE__GPIO3_5            IOMUX_PAD(0x4ec, 0x110, 3, 0x988, 0, MX51_GPIO_PAD_CTRL)
+#define MX51_PAD_NANDF_ALE__NANDF_ALE          IOMUX_PAD(0x4ec, 0x110, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_NANDF_ALE__PATA_BUFFER_EN     IOMUX_PAD(0x4ec, 0x110, 1, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_NANDF_CLE__GPIO3_6            IOMUX_PAD(0x4f0, 0x114, 3, 0x98c, 0, MX51_GPIO_PAD_CTRL)
+#define MX51_PAD_NANDF_CLE__NANDF_CLE          IOMUX_PAD(0x4f0, 0x114, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_NANDF_CLE__PATA_RESET_B       IOMUX_PAD(0x4f0, 0x114, 1, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_NANDF_WP_B__GPIO3_7           IOMUX_PAD(0x4f4, 0x118, 3, 0x990, 0, MX51_GPIO_PAD_CTRL)
+#define MX51_PAD_NANDF_WP_B__NANDF_WP_B                IOMUX_PAD(0x4f4, 0x118, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_NANDF_WP_B__PATA_DMACK                IOMUX_PAD(0x4f4, 0x118, 1, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_NANDF_WP_B__SD3_DATA2         IOMUX_PAD(0x4f4, 0x118, 2, 0x944, 0, MX51_SDHCI_PAD_CTRL)
+#define MX51_PAD_NANDF_RB0__ECSPI2_SS1         IOMUX_PAD(0x4f8, 0x11c, 5, 0x930, 0, MX51_ECSPI_PAD_CTRL)
+#define MX51_PAD_NANDF_RB0__GPIO3_8            IOMUX_PAD(0x4f8, 0x11c, 3, 0x994, 0, MX51_GPIO_PAD_CTRL)
+#define MX51_PAD_NANDF_RB0__NANDF_RB0          IOMUX_PAD(0x4f8, 0x11c, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_NANDF_RB0__PATA_DMARQ         IOMUX_PAD(0x4f8, 0x11c, 1, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_NANDF_RB0__SD3_DATA3          IOMUX_PAD(0x4f8, 0x11c, 2, 0x948, 0, MX51_SDHCI_PAD_CTRL)
+#define MX51_PAD_NANDF_RB1__CSPI_MOSI          IOMUX_PAD(0x4fc, 0x120, 6, 0x91c, 0, MX51_ECSPI_PAD_CTRL)
+#define MX51_PAD_NANDF_RB1__ECSPI2_RDY         IOMUX_PAD(0x4fc, 0x120, 2, __NA_, 0, MX51_ECSPI_PAD_CTRL)
+#define MX51_PAD_NANDF_RB1__GPIO3_9            IOMUX_PAD(0x4fc, 0x120, 3, __NA_, 0, MX51_GPIO_PAD_CTRL)
+#define MX51_PAD_NANDF_RB1__NANDF_RB1          IOMUX_PAD(0x4fc, 0x120, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_NANDF_RB1__PATA_IORDY         IOMUX_PAD(0x4fc, 0x120, 1, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_NANDF_RB1__SD4_CMD            IOMUX_PAD(0x4fc, 0x120, 5, __NA_, 0, MX51_SDHCI_PAD_CTRL)
+#define MX51_PAD_NANDF_RB2__DISP2_WAIT         IOMUX_PAD(0x500, 0x124, 5, 0x9a8, 0, NO_PAD_CTRL)
+#define MX51_PAD_NANDF_RB2__ECSPI2_SCLK                IOMUX_PAD(0x500, 0x124, 2, __NA_, 0, MX51_ECSPI_PAD_CTRL)
+#define MX51_PAD_NANDF_RB2__FEC_COL            IOMUX_PAD(0x500, 0x124, 1, 0x94c, 0, MX51_PAD_CTRL_2)
+#define MX51_PAD_NANDF_RB2__GPIO3_10           IOMUX_PAD(0x500, 0x124, 3, __NA_, 0, MX51_GPIO_PAD_CTRL)
+#define MX51_PAD_NANDF_RB2__NANDF_RB2          IOMUX_PAD(0x500, 0x124, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_NANDF_RB2__USBH3_H3_DP                IOMUX_PAD(0x500, 0x124, 7, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_NANDF_RB2__USBH3_NXT          IOMUX_PAD(0x500, 0x124, 6, 0xa20, 0, NO_PAD_CTRL)
+#define MX51_PAD_NANDF_RB3__DISP1_WAIT         IOMUX_PAD(0x504, 0x128, 5, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_NANDF_RB3__ECSPI2_MISO                IOMUX_PAD(0x504, 0x128, 2, __NA_, 0, MX51_ECSPI_PAD_CTRL)
+#define MX51_PAD_NANDF_RB3__FEC_RX_CLK         IOMUX_PAD(0x504, 0x128, 1, 0x968, 0, MX51_PAD_CTRL_2)
+#define MX51_PAD_NANDF_RB3__GPIO3_11           IOMUX_PAD(0x504, 0x128, 3, __NA_, 0, MX51_GPIO_PAD_CTRL)
+#define MX51_PAD_NANDF_RB3__NANDF_RB3          IOMUX_PAD(0x504, 0x128, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_NANDF_RB3__USBH3_CLK          IOMUX_PAD(0x504, 0x128, 6, 0x9f8, 0, NO_PAD_CTRL)
+#define MX51_PAD_NANDF_RB3__USBH3_H3_DM                IOMUX_PAD(0x504, 0x128, 7, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_GPIO_NAND__GPIO_NAND          IOMUX_PAD(0x514, 0x12c, 0, 0x998, 0, MX51_GPIO_PAD_CTRL)
+#define MX51_PAD_GPIO_NAND__PATA_INTRQ         IOMUX_PAD(0x514, 0x12c, 1, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_NANDF_CS0__GPIO3_16           IOMUX_PAD(0x518, 0x130, 3, __NA_, 0, MX51_GPIO_PAD_CTRL)
+#define MX51_PAD_NANDF_CS0__NANDF_CS0          IOMUX_PAD(0x518, 0x130, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_NANDF_CS1__GPIO3_17           IOMUX_PAD(0x51c, 0x134, 3, __NA_, 0, MX51_GPIO_PAD_CTRL)
+#define MX51_PAD_NANDF_CS1__NANDF_CS1          IOMUX_PAD(0x51c, 0x134, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_NANDF_CS2__CSPI_SCLK          IOMUX_PAD(0x520, 0x138, 6, 0x914, 0, MX51_ECSPI_PAD_CTRL)
+#define MX51_PAD_NANDF_CS2__FEC_TX_ER          IOMUX_PAD(0x520, 0x138, 2, __NA_, 0, MX51_PAD_CTRL_5)
+#define MX51_PAD_NANDF_CS2__GPIO3_18           IOMUX_PAD(0x520, 0x138, 3, __NA_, 0, MX51_GPIO_PAD_CTRL)
+#define MX51_PAD_NANDF_CS2__NANDF_CS2          IOMUX_PAD(0x520, 0x138, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_NANDF_CS2__PATA_CS_0          IOMUX_PAD(0x520, 0x138, 1, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_NANDF_CS2__SD4_CLK            IOMUX_PAD(0x520, 0x138, 5, __NA_, 0, MX51_SDHCI_PAD_CTRL | PAD_CTL_HYS)
+#define MX51_PAD_NANDF_CS2__USBH3_H1_DP                IOMUX_PAD(0x520, 0x138, 7, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_NANDF_CS3__FEC_MDC            IOMUX_PAD(0x524, 0x13c, 2, __NA_, 0, MX51_PAD_CTRL_5)
+#define MX51_PAD_NANDF_CS3__GPIO3_19           IOMUX_PAD(0x524, 0x13c, 3, __NA_, 0, MX51_GPIO_PAD_CTRL)
+#define MX51_PAD_NANDF_CS3__NANDF_CS3          IOMUX_PAD(0x524, 0x13c, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_NANDF_CS3__PATA_CS_1          IOMUX_PAD(0x524, 0x13c, 1, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_NANDF_CS3__SD4_DAT0           IOMUX_PAD(0x524, 0x13c, 5, __NA_, 0, MX51_SDHCI_PAD_CTRL)
+#define MX51_PAD_NANDF_CS3__USBH3_H1_DM                IOMUX_PAD(0x524, 0x13c, 7, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_NANDF_CS4__FEC_TDATA1         IOMUX_PAD(0x528, 0x140, 2, __NA_, 0, MX51_PAD_CTRL_5)
+#define MX51_PAD_NANDF_CS4__GPIO3_20           IOMUX_PAD(0x528, 0x140, 3, __NA_, 0, MX51_GPIO_PAD_CTRL)
+#define MX51_PAD_NANDF_CS4__NANDF_CS4          IOMUX_PAD(0x528, 0x140, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_NANDF_CS4__PATA_DA_0          IOMUX_PAD(0x528, 0x140, 1, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_NANDF_CS4__SD4_DAT1           IOMUX_PAD(0x528, 0x140, 5, __NA_, 0, MX51_SDHCI_PAD_CTRL)
+#define MX51_PAD_NANDF_CS4__USBH3_STP          IOMUX_PAD(0x528, 0x140, 7, 0xa24, 0, NO_PAD_CTRL)
+#define MX51_PAD_NANDF_CS5__FEC_TDATA2         IOMUX_PAD(0x52c, 0x144, 2, __NA_, 0, MX51_PAD_CTRL_5)
+#define MX51_PAD_NANDF_CS5__GPIO3_21           IOMUX_PAD(0x52c, 0x144, 3, __NA_, 0, MX51_GPIO_PAD_CTRL)
+#define MX51_PAD_NANDF_CS5__NANDF_CS5          IOMUX_PAD(0x52c, 0x144, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_NANDF_CS5__PATA_DA_1          IOMUX_PAD(0x52c, 0x144, 1, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_NANDF_CS5__SD4_DAT2           IOMUX_PAD(0x52c, 0x144, 5, __NA_, 0, MX51_SDHCI_PAD_CTRL)
+#define MX51_PAD_NANDF_CS5__USBH3_DIR          IOMUX_PAD(0x52c, 0x144, 7, 0xa1c, 0, NO_PAD_CTRL)
+#define MX51_PAD_NANDF_CS6__CSPI_SS3           IOMUX_PAD(0x530, 0x148, 7, 0x928, 0, MX51_ECSPI_PAD_CTRL)
+#define MX51_PAD_NANDF_CS6__FEC_TDATA3         IOMUX_PAD(0x530, 0x148, 2, __NA_, 0, MX51_PAD_CTRL_5)
+#define MX51_PAD_NANDF_CS6__GPIO3_22           IOMUX_PAD(0x530, 0x148, 3, __NA_, 0, MX51_GPIO_PAD_CTRL)
+#define MX51_PAD_NANDF_CS6__NANDF_CS6          IOMUX_PAD(0x530, 0x148, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_NANDF_CS6__PATA_DA_2          IOMUX_PAD(0x530, 0x148, 1, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_NANDF_CS6__SD4_DAT3           IOMUX_PAD(0x530, 0x148, 5, __NA_, 0, MX51_SDHCI_PAD_CTRL)
+#define MX51_PAD_NANDF_CS7__FEC_TX_EN          IOMUX_PAD(0x534, 0x14c, 1, __NA_, 0, MX51_PAD_CTRL_5)
+#define MX51_PAD_NANDF_CS7__GPIO3_23           IOMUX_PAD(0x534, 0x14c, 3, __NA_, 0, MX51_GPIO_PAD_CTRL)
+#define MX51_PAD_NANDF_CS7__NANDF_CS7          IOMUX_PAD(0x534, 0x14c, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_NANDF_CS7__SD3_CLK            IOMUX_PAD(0x534, 0x14c, 5, __NA_, 0, MX51_SDHCI_PAD_CTRL | PAD_CTL_HYS)
+#define MX51_PAD_NANDF_RDY_INT__ECSPI2_SS0     IOMUX_PAD(0x538, 0x150, 2, __NA_, 0, MX51_ECSPI_PAD_CTRL)
+#define MX51_PAD_NANDF_RDY_INT__FEC_TX_CLK     IOMUX_PAD(0x538, 0x150, 1, 0x974, 0, MX51_PAD_CTRL_4)
+#define MX51_PAD_NANDF_RDY_INT__GPIO3_24       IOMUX_PAD(0x538, 0x150, 3, __NA_, 0, MX51_GPIO_PAD_CTRL)
+#define MX51_PAD_NANDF_RDY_INT__NANDF_RDY_INT  IOMUX_PAD(0x538, 0x150, 0, 0x938, 0, NO_PAD_CTRL)
+#define MX51_PAD_NANDF_RDY_INT__SD3_CMD                IOMUX_PAD(0x538, 0x150, 5, __NA_, 0, MX51_SDHCI_PAD_CTRL)
+#define MX51_PAD_NANDF_D15__ECSPI2_MOSI                IOMUX_PAD(0x53c, 0x154, 2, __NA_, 0, MX51_ECSPI_PAD_CTRL)
+#define MX51_PAD_NANDF_D15__GPIO3_25           IOMUX_PAD(0x53c, 0x154, 3, __NA_, 0, MX51_GPIO_PAD_CTRL)
+#define MX51_PAD_NANDF_D15__NANDF_D15          IOMUX_PAD(0x53c, 0x154, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_NANDF_D15__PATA_DATA15                IOMUX_PAD(0x53c, 0x154, 1, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_NANDF_D15__SD3_DAT7           IOMUX_PAD(0x53c, 0x154, 5, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_NANDF_D14__ECSPI2_SS3         IOMUX_PAD(0x540, 0x158, 2, 0x934, 0, MX51_ECSPI_PAD_CTRL)
+#define MX51_PAD_NANDF_D14__GPIO3_26           IOMUX_PAD(0x540, 0x158, 3, __NA_, 0, MX51_GPIO_PAD_CTRL)
+#define MX51_PAD_NANDF_D14__NANDF_D14          IOMUX_PAD(0x540, 0x158, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_NANDF_D14__PATA_DATA14                IOMUX_PAD(0x540, 0x158, 1, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_NANDF_D14__SD3_DAT6           IOMUX_PAD(0x540, 0x158, 5, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_NANDF_D13__ECSPI2_SS2         IOMUX_PAD(0x544, 0x15c, 2, __NA_, 0, MX51_ECSPI_PAD_CTRL)
+#define MX51_PAD_NANDF_D13__GPIO3_27           IOMUX_PAD(0x544, 0x15c, 3, __NA_, 0, MX51_GPIO_PAD_CTRL)
+#define MX51_PAD_NANDF_D13__NANDF_D13          IOMUX_PAD(0x544, 0x15c, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_NANDF_D13__PATA_DATA13                IOMUX_PAD(0x544, 0x15c, 1, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_NANDF_D13__SD3_DAT5           IOMUX_PAD(0x544, 0x15c, 5, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_NANDF_D12__ECSPI2_SS1         IOMUX_PAD(0x548, 0x160, 2, 0x930, 1, MX51_ECSPI_PAD_CTRL)
+#define MX51_PAD_NANDF_D12__GPIO3_28           IOMUX_PAD(0x548, 0x160, 3, __NA_, 0, MX51_GPIO_PAD_CTRL)
+#define MX51_PAD_NANDF_D12__NANDF_D12          IOMUX_PAD(0x548, 0x160, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_NANDF_D12__PATA_DATA12                IOMUX_PAD(0x548, 0x160, 1, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_NANDF_D12__SD3_DAT4           IOMUX_PAD(0x548, 0x160, 5, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_NANDF_D11__FEC_RX_DV          IOMUX_PAD(0x54c, 0x164, 2, 0x96c, 0, NO_PAD_CTRL)
+#define MX51_PAD_NANDF_D11__GPIO3_29           IOMUX_PAD(0x54c, 0x164, 3, __NA_, 0, MX51_GPIO_PAD_CTRL)
+#define MX51_PAD_NANDF_D11__NANDF_D11          IOMUX_PAD(0x54c, 0x164, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_NANDF_D11__PATA_DATA11                IOMUX_PAD(0x54c, 0x164, 1, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_NANDF_D11__SD3_DATA3          IOMUX_PAD(0x54c, 0x164, 5, 0x948, 1, NO_PAD_CTRL)
+#define MX51_PAD_NANDF_D10__GPIO3_30           IOMUX_PAD(0x550, 0x168, 3, __NA_, 0, MX51_GPIO_PAD_CTRL)
+#define MX51_PAD_NANDF_D10__NANDF_D10          IOMUX_PAD(0x550, 0x168, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_NANDF_D10__PATA_DATA10                IOMUX_PAD(0x550, 0x168, 1, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_NANDF_D10__SD3_DATA2          IOMUX_PAD(0x550, 0x168, 5, 0x944, 1, NO_PAD_CTRL)
+#define MX51_PAD_NANDF_D9__FEC_RDATA0          IOMUX_PAD(0x554, 0x16c, 2, 0x958, 0, MX51_PAD_CTRL_4)
+#define MX51_PAD_NANDF_D9__GPIO3_31            IOMUX_PAD(0x554, 0x16c, 3, __NA_, 0, MX51_GPIO_PAD_CTRL)
+#define MX51_PAD_NANDF_D9__NANDF_D9            IOMUX_PAD(0x554, 0x16c, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_NANDF_D9__PATA_DATA9          IOMUX_PAD(0x554, 0x16c, 1, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_NANDF_D9__SD3_DATA1           IOMUX_PAD(0x554, 0x16c, 5, 0x940, 1, NO_PAD_CTRL)
+#define MX51_PAD_NANDF_D8__FEC_TDATA0          IOMUX_PAD(0x558, 0x170, 2, __NA_, 0, MX51_PAD_CTRL_5)
+#define MX51_PAD_NANDF_D8__GPIO4_0             IOMUX_PAD(0x558, 0x170, 3, __NA_, 0, MX51_GPIO_PAD_CTRL)
+#define MX51_PAD_NANDF_D8__NANDF_D8            IOMUX_PAD(0x558, 0x170, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_NANDF_D8__PATA_DATA8          IOMUX_PAD(0x558, 0x170, 1, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_NANDF_D8__SD3_DATA0           IOMUX_PAD(0x558, 0x170, 5, 0x93c, 1, NO_PAD_CTRL)
+#define MX51_PAD_NANDF_D7__GPIO4_1             IOMUX_PAD(0x55c, 0x174, 3, __NA_, 0, MX51_GPIO_PAD_CTRL)
+#define MX51_PAD_NANDF_D7__NANDF_D7            IOMUX_PAD(0x55c, 0x174, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_NANDF_D7__PATA_DATA7          IOMUX_PAD(0x55c, 0x174, 1, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_NANDF_D7__USBH3_DATA0         IOMUX_PAD(0x55c, 0x174, 5, 0x9fc, 0, NO_PAD_CTRL)
+#define MX51_PAD_NANDF_D6__GPIO4_2             IOMUX_PAD(0x560, 0x178, 3, __NA_, 0, MX51_GPIO_PAD_CTRL)
+#define MX51_PAD_NANDF_D6__NANDF_D6            IOMUX_PAD(0x560, 0x178, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_NANDF_D6__PATA_DATA6          IOMUX_PAD(0x560, 0x178, 1, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_NANDF_D6__SD4_LCTL            IOMUX_PAD(0x560, 0x178, 2, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_NANDF_D6__USBH3_DATA1         IOMUX_PAD(0x560, 0x178, 5, 0xa00, 0, NO_PAD_CTRL)
+#define MX51_PAD_NANDF_D5__GPIO4_3             IOMUX_PAD(0x564, 0x17c, 3, __NA_, 0, MX51_GPIO_PAD_CTRL)
+#define MX51_PAD_NANDF_D5__NANDF_D5            IOMUX_PAD(0x564, 0x17c, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_NANDF_D5__PATA_DATA5          IOMUX_PAD(0x564, 0x17c, 1, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_NANDF_D5__SD4_WP              IOMUX_PAD(0x564, 0x17c, 2, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_NANDF_D5__USBH3_DATA2         IOMUX_PAD(0x564, 0x17c, 5, 0xa04, 0, NO_PAD_CTRL)
+#define MX51_PAD_NANDF_D4__GPIO4_4             IOMUX_PAD(0x568, 0x180, 3, __NA_, 0, MX51_GPIO_PAD_CTRL)
+#define MX51_PAD_NANDF_D4__NANDF_D4            IOMUX_PAD(0x568, 0x180, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_NANDF_D4__PATA_DATA4          IOMUX_PAD(0x568, 0x180, 1, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_NANDF_D4__SD4_CD              IOMUX_PAD(0x568, 0x180, 2, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_NANDF_D4__USBH3_DATA3         IOMUX_PAD(0x568, 0x180, 5, 0xa08, 0, NO_PAD_CTRL)
+#define MX51_PAD_NANDF_D3__GPIO4_5             IOMUX_PAD(0x56c, 0x184, 3, __NA_, 0, MX51_GPIO_PAD_CTRL)
+#define MX51_PAD_NANDF_D3__NANDF_D3            IOMUX_PAD(0x56c, 0x184, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_NANDF_D3__PATA_DATA3          IOMUX_PAD(0x56c, 0x184, 1, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_NANDF_D3__SD4_DAT4            IOMUX_PAD(0x56c, 0x184, 2, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_NANDF_D3__USBH3_DATA4         IOMUX_PAD(0x56c, 0x184, 5, 0xa0c, 0, NO_PAD_CTRL)
+#define MX51_PAD_NANDF_D2__GPIO4_6             IOMUX_PAD(0x570, 0x188, 3, __NA_, 0, MX51_GPIO_PAD_CTRL)
+#define MX51_PAD_NANDF_D2__NANDF_D2            IOMUX_PAD(0x570, 0x188, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_NANDF_D2__PATA_DATA2          IOMUX_PAD(0x570, 0x188, 1, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_NANDF_D2__SD4_DAT5            IOMUX_PAD(0x570, 0x188, 2, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_NANDF_D2__USBH3_DATA5         IOMUX_PAD(0x570, 0x188, 5, 0xa10, 0, NO_PAD_CTRL)
+#define MX51_PAD_NANDF_D1__GPIO4_7             IOMUX_PAD(0x574, 0x18c, 3, __NA_, 0, MX51_GPIO_PAD_CTRL)
+#define MX51_PAD_NANDF_D1__NANDF_D1            IOMUX_PAD(0x574, 0x18c, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_NANDF_D1__PATA_DATA1          IOMUX_PAD(0x574, 0x18c, 1, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_NANDF_D1__SD4_DAT6            IOMUX_PAD(0x574, 0x18c, 2, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_NANDF_D1__USBH3_DATA6         IOMUX_PAD(0x574, 0x18c, 5, 0xa14, 0, NO_PAD_CTRL)
+#define MX51_PAD_NANDF_D0__GPIO4_8             IOMUX_PAD(0x578, 0x190, 3, __NA_, 0, MX51_GPIO_PAD_CTRL)
+#define MX51_PAD_NANDF_D0__NANDF_D0            IOMUX_PAD(0x578, 0x190, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_NANDF_D0__PATA_DATA0          IOMUX_PAD(0x578, 0x190, 1, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_NANDF_D0__SD4_DAT7            IOMUX_PAD(0x578, 0x190, 2, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_NANDF_D0__USBH3_DATA7         IOMUX_PAD(0x578, 0x190, 5, 0xa18, 0, NO_PAD_CTRL)
+#define MX51_PAD_CSI1_D8__CSI1_D8              IOMUX_PAD(0x57c, 0x194, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_CSI1_D8__GPIO3_12             IOMUX_PAD(0x57c, 0x194, 3, 0x998, 1, MX51_GPIO_PAD_CTRL)
+#define MX51_PAD_CSI1_D9__CSI1_D9              IOMUX_PAD(0x580, 0x198, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_CSI1_D9__GPIO3_13             IOMUX_PAD(0x580, 0x198, 3, __NA_, 0, MX51_GPIO_PAD_CTRL)
+#define MX51_PAD_CSI1_D10__CSI1_D10            IOMUX_PAD(0x584, 0x19c, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_CSI1_D11__CSI1_D11            IOMUX_PAD(0x588, 0x1a0, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_CSI1_D12__CSI1_D12            IOMUX_PAD(0x58c, 0x1a4, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_CSI1_D13__CSI1_D13            IOMUX_PAD(0x590, 0x1a8, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_CSI1_D14__CSI1_D14            IOMUX_PAD(0x594, 0x1ac, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_CSI1_D15__CSI1_D15            IOMUX_PAD(0x598, 0x1b0, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_CSI1_D16__CSI1_D16            IOMUX_PAD(0x59c, 0x1b4, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_CSI1_D17__CSI1_D17            IOMUX_PAD(0x5a0, 0x1b8, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_CSI1_D18__CSI1_D18            IOMUX_PAD(0x5a4, 0x1bc, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_CSI1_D19__CSI1_D19            IOMUX_PAD(0x5a8, 0x1c0, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_CSI1_VSYNC__CSI1_VSYNC                IOMUX_PAD(0x5ac, 0x1c4, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_CSI1_VSYNC__GPIO3_14          IOMUX_PAD(0x5ac, 0x1c4, 3, __NA_, 0, MX51_GPIO_PAD_CTRL)
+#define MX51_PAD_CSI1_HSYNC__CSI1_HSYNC                IOMUX_PAD(0x5b0, 0x1c8, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_CSI1_HSYNC__GPIO3_15          IOMUX_PAD(0x5b0, 0x1c8, 3, __NA_, 0, MX51_GPIO_PAD_CTRL)
+#define MX51_PAD_CSI1_PIXCLK__CSI1_PIXCLK      IOMUX_PAD(0x5b4, __NA_, 0, 0x000, 0, NO_PAD_CTRL)
+#define MX51_PAD_CSI1_MCLK__CSI1_MCLK          IOMUX_PAD(0x5b8, __NA_, 0, 0x000, 0, NO_PAD_CTRL)
+#define MX51_PAD_CSI2_D12__CSI2_D12            IOMUX_PAD(0x5bc, 0x1cc, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_CSI2_D12__GPIO4_9             IOMUX_PAD(0x5bc, 0x1cc, 3, __NA_, 0, MX51_GPIO_PAD_CTRL)
+#define MX51_PAD_CSI2_D13__CSI2_D13            IOMUX_PAD(0x5c0, 0x1d0, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_CSI2_D13__GPIO4_10            IOMUX_PAD(0x5c0, 0x1d0, 3, __NA_, 0, MX51_GPIO_PAD_CTRL)
+#define MX51_PAD_CSI2_D14__CSI2_D14            IOMUX_PAD(0x5c4, 0x1d4, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_CSI2_D15__CSI2_D15            IOMUX_PAD(0x5c8, 0x1d8, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_CSI2_D16__CSI2_D16            IOMUX_PAD(0x5cc, 0x1dc, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_CSI2_D17__CSI2_D17            IOMUX_PAD(0x5d0, 0x1e0, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_CSI2_D18__CSI2_D18            IOMUX_PAD(0x5d4, 0x1e4, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_CSI2_D18__GPIO4_11            IOMUX_PAD(0x5d4, 0x1e4, 3, __NA_, 0, MX51_GPIO_PAD_CTRL)
+#define MX51_PAD_CSI2_D19__CSI2_D19            IOMUX_PAD(0x5d8, 0x1e8, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_CSI2_D19__GPIO4_12            IOMUX_PAD(0x5d8, 0x1e8, 3, __NA_, 0, MX51_GPIO_PAD_CTRL)
+#define MX51_PAD_CSI2_VSYNC__CSI2_VSYNC                IOMUX_PAD(0x5dc, 0x1ec, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_CSI2_VSYNC__GPIO4_13          IOMUX_PAD(0x5dc, 0x1ec, 3, __NA_, 0, MX51_GPIO_PAD_CTRL)
+#define MX51_PAD_CSI2_HSYNC__CSI2_HSYNC                IOMUX_PAD(0x5e0, 0x1f0, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_CSI2_HSYNC__GPIO4_14          IOMUX_PAD(0x5e0, 0x1f0, 3, __NA_, 0, MX51_GPIO_PAD_CTRL)
+#define MX51_PAD_CSI2_PIXCLK__CSI2_PIXCLK      IOMUX_PAD(0x5e4, 0x1f4, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_CSI2_PIXCLK__GPIO4_15         IOMUX_PAD(0x5e4, 0x1f4, 3, __NA_, 0, MX51_GPIO_PAD_CTRL)
+#define MX51_PAD_I2C1_CLK__GPIO4_16            IOMUX_PAD(0x5e8, 0x1f8, 3, __NA_, 0, MX51_GPIO_PAD_CTRL)
+#define MX51_PAD_I2C1_CLK__I2C1_CLK            IOMUX_PAD(0x5e8, 0x1f8, 0x10, __NA_, 0, MX51_I2C_PAD_CTRL)
+#define MX51_PAD_I2C1_DAT__GPIO4_17            IOMUX_PAD(0x5ec, 0x1fc, 3, __NA_, 0, MX51_GPIO_PAD_CTRL)
+#define MX51_PAD_I2C1_DAT__I2C1_DAT            IOMUX_PAD(0x5ec, 0x1fc, 0x10, __NA_, 0, MX51_I2C_PAD_CTRL)
+#define MX51_PAD_AUD3_BB_TXD__AUD3_TXD         IOMUX_PAD(0x5f0, 0x200, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_AUD3_BB_TXD__GPIO4_18         IOMUX_PAD(0x5f0, 0x200, 3, __NA_, 0, MX51_GPIO_PAD_CTRL)
+#define MX51_PAD_AUD3_BB_RXD__AUD3_RXD         IOMUX_PAD(0x5f4, 0x204, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_AUD3_BB_RXD__GPIO4_19         IOMUX_PAD(0x5f4, 0x204, 3, __NA_, 0, MX51_GPIO_PAD_CTRL)
+#define MX51_PAD_AUD3_BB_RXD__UART3_RXD                IOMUX_PAD(0x5f4, 0x204, 1, 0x9f4, 2, MX51_UART_PAD_CTRL)
+#define MX51_PAD_AUD3_BB_CK__AUD3_TXC          IOMUX_PAD(0x5f8, 0x208, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_AUD3_BB_CK__GPIO4_20          IOMUX_PAD(0x5f8, 0x208, 3, __NA_, 0, MX51_GPIO_PAD_CTRL)
+#define MX51_PAD_AUD3_BB_FS__AUD3_TXFS         IOMUX_PAD(0x5fc, 0x20c, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_AUD3_BB_FS__GPIO4_21          IOMUX_PAD(0x5fc, 0x20c, 3, __NA_, 0, MX51_GPIO_PAD_CTRL)
+#define MX51_PAD_AUD3_BB_FS__UART3_TXD         IOMUX_PAD(0x5fc, 0x20c, 1, __NA_, 0, MX51_UART_PAD_CTRL)
+#define MX51_PAD_CSPI1_MOSI__ECSPI1_MOSI       IOMUX_PAD(0x600, 0x210, 0, __NA_, 0, MX51_ECSPI_PAD_CTRL)
+#define MX51_PAD_CSPI1_MOSI__GPIO4_22          IOMUX_PAD(0x600, 0x210, 3, __NA_, 0, MX51_GPIO_PAD_CTRL)
+#define MX51_PAD_CSPI1_MOSI__I2C1_SDA          IOMUX_PAD(0x600, 0x210, 0x11, 0x9b4, 1, MX51_I2C_PAD_CTRL)
+#define MX51_PAD_CSPI1_MISO__AUD4_RXD          IOMUX_PAD(0x604, 0x214, 1, 0x8c4, 1, NO_PAD_CTRL)
+#define MX51_PAD_CSPI1_MISO__ECSPI1_MISO       IOMUX_PAD(0x604, 0x214, 0, __NA_, 0, MX51_ECSPI_PAD_CTRL)
+#define MX51_PAD_CSPI1_MISO__GPIO4_23          IOMUX_PAD(0x604, 0x214, 3, __NA_, 0, MX51_GPIO_PAD_CTRL)
+#define MX51_PAD_CSPI1_SS0__AUD4_TXC           IOMUX_PAD(0x608, 0x218, 1, 0x8cc, 1, NO_PAD_CTRL)
+#define MX51_PAD_CSPI1_SS0__ECSPI1_SS0         IOMUX_PAD(0x608, 0x218, 0, __NA_, 0, MX51_ECSPI_PAD_CTRL)
+#define MX51_PAD_CSPI1_SS0__GPIO4_24           IOMUX_PAD(0x608, 0x218, 3, __NA_, 0, MX51_GPIO_PAD_CTRL)
+#define MX51_PAD_CSPI1_SS1__AUD4_TXD           IOMUX_PAD(0x60c, 0x21c, 1, 0x8c8, 1, NO_PAD_CTRL)
+#define MX51_PAD_CSPI1_SS1__ECSPI1_SS1         IOMUX_PAD(0x60c, 0x21c, 0, __NA_, 0, MX51_ECSPI_PAD_CTRL)
+#define MX51_PAD_CSPI1_SS1__GPIO4_25           IOMUX_PAD(0x60c, 0x21c, 3, __NA_, 0, MX51_GPIO_PAD_CTRL)
+#define MX51_PAD_CSPI1_RDY__AUD4_TXFS          IOMUX_PAD(0x610, 0x220, 1, 0x8d0, 1, NO_PAD_CTRL)
+#define MX51_PAD_CSPI1_RDY__ECSPI1_RDY         IOMUX_PAD(0x610, 0x220, 0, __NA_, 0, MX51_ECSPI_PAD_CTRL)
+#define MX51_PAD_CSPI1_RDY__GPIO4_26           IOMUX_PAD(0x610, 0x220, 3, __NA_, 0, MX51_GPIO_PAD_CTRL)
+#define MX51_PAD_CSPI1_SCLK__ECSPI1_SCLK       IOMUX_PAD(0x614, 0x224, 0, __NA_, 0, MX51_ECSPI_PAD_CTRL)
+#define MX51_PAD_CSPI1_SCLK__GPIO4_27          IOMUX_PAD(0x614, 0x224, 3, __NA_, 0, MX51_GPIO_PAD_CTRL)
+#define MX51_PAD_CSPI1_SCLK__I2C1_SCL          IOMUX_PAD(0x614, 0x224, 0x11, 0x9b0, 1, MX51_I2C_PAD_CTRL)
+#define MX51_PAD_UART1_RXD__GPIO4_28           IOMUX_PAD(0x618, 0x228, 3, __NA_, 0, MX51_GPIO_PAD_CTRL)
+#define MX51_PAD_UART1_RXD__UART1_RXD          IOMUX_PAD(0x618, 0x228, 0, 0x9e4, 0, MX51_UART_PAD_CTRL)
+#define MX51_PAD_UART1_TXD__GPIO4_29           IOMUX_PAD(0x61c, 0x22c, 3, __NA_, 0, MX51_GPIO_PAD_CTRL)
+#define MX51_PAD_UART1_TXD__PWM2_PWMO          IOMUX_PAD(0x61c, 0x22c, 1, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_UART1_TXD__UART1_TXD          IOMUX_PAD(0x61c, 0x22c, 0, __NA_, 0, MX51_UART_PAD_CTRL)
+#define MX51_PAD_UART1_RTS__GPIO4_30           IOMUX_PAD(0x620, 0x230, 3, __NA_, 0, MX51_GPIO_PAD_CTRL)
+#define MX51_PAD_UART1_RTS__UART1_RTS          IOMUX_PAD(0x620, 0x230, 0, 0x9e0, 0, MX51_UART_PAD_CTRL)
+#define MX51_PAD_UART1_CTS__GPIO4_31           IOMUX_PAD(0x624, 0x234, 3, __NA_, 0, MX51_GPIO_PAD_CTRL)
+#define MX51_PAD_UART1_CTS__UART1_CTS          IOMUX_PAD(0x624, 0x234, 0, __NA_, 0, MX51_UART_PAD_CTRL)
+#define MX51_PAD_UART2_RXD__FIRI_TXD           IOMUX_PAD(0x628, 0x238, 1, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_UART2_RXD__GPIO1_20           IOMUX_PAD(0x628, 0x238, 3, __NA_, 0, MX51_GPIO_PAD_CTRL)
+#define MX51_PAD_UART2_RXD__UART2_RXD          IOMUX_PAD(0x628, 0x238, 0, 0x9ec, 2, MX51_UART_PAD_CTRL)
+#define MX51_PAD_UART2_TXD__FIRI_RXD           IOMUX_PAD(0x62c, 0x23c, 1, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_UART2_TXD__GPIO1_21           IOMUX_PAD(0x62c, 0x23c, 3, __NA_, 0, MX51_GPIO_PAD_CTRL)
+#define MX51_PAD_UART2_TXD__UART2_TXD          IOMUX_PAD(0x62c, 0x23c, 0, __NA_, 0, MX51_UART_PAD_CTRL)
+#define MX51_PAD_UART3_RXD__CSI1_D0            IOMUX_PAD(0x630, 0x240, 2, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_UART3_RXD__GPIO1_22           IOMUX_PAD(0x630, 0x240, 3, __NA_, 0, MX51_GPIO_PAD_CTRL)
+#define MX51_PAD_UART3_RXD__UART1_DTR          IOMUX_PAD(0x630, 0x240, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_UART3_RXD__UART3_RXD          IOMUX_PAD(0x630, 0x240, 1, 0x9f4, 4, MX51_UART_PAD_CTRL)
+#define MX51_PAD_UART3_TXD__CSI1_D1            IOMUX_PAD(0x634, 0x244, 2, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_UART3_TXD__GPIO1_23           IOMUX_PAD(0x634, 0x244, 3, __NA_, 0, MX51_GPIO_PAD_CTRL)
+#define MX51_PAD_UART3_TXD__UART1_DSR          IOMUX_PAD(0x634, 0x244, 0, __NA_, 0, MX51_UART_PAD_CTRL)
+#define MX51_PAD_UART3_TXD__UART3_TXD          IOMUX_PAD(0x634, 0x244, 1, __NA_, 0, MX51_UART_PAD_CTRL)
+#define MX51_PAD_OWIRE_LINE__GPIO1_24          IOMUX_PAD(0x638, 0x248, 3, __NA_, 0, MX51_GPIO_PAD_CTRL)
+#define MX51_PAD_OWIRE_LINE__OWIRE_LINE                IOMUX_PAD(0x638, 0x248, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_OWIRE_LINE__SPDIF_OUT         IOMUX_PAD(0x638, 0x248, 6, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_KEY_ROW0__KEY_ROW0            IOMUX_PAD(0x63c, 0x24c, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_KEY_ROW1__KEY_ROW1            IOMUX_PAD(0x640, 0x250, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_KEY_ROW2__KEY_ROW2            IOMUX_PAD(0x644, 0x254, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_KEY_ROW3__KEY_ROW3            IOMUX_PAD(0x648, 0x258, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_KEY_COL0__KEY_COL0            IOMUX_PAD(0x64c, 0x25c, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_KEY_COL0__PLL1_BYP            IOMUX_PAD(0x64c, 0x25c, 7, 0x90c, 0, NO_PAD_CTRL)
+#define MX51_PAD_KEY_COL1__KEY_COL1            IOMUX_PAD(0x650, 0x260, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_KEY_COL1__PLL2_BYP            IOMUX_PAD(0x650, 0x260, 7, 0x910, 0, NO_PAD_CTRL)
+#define MX51_PAD_KEY_COL2__KEY_COL2            IOMUX_PAD(0x654, 0x264, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_KEY_COL2__PLL3_BYP            IOMUX_PAD(0x654, 0x264, 7, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_KEY_COL3__KEY_COL3            IOMUX_PAD(0x658, 0x268, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_KEY_COL4__I2C2_SCL            IOMUX_PAD(0x65c, 0x26c, 0x13, 0x9b8, 1, MX51_I2C_PAD_CTRL)
+#define MX51_PAD_KEY_COL4__KEY_COL4            IOMUX_PAD(0x65c, 0x26c, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_KEY_COL4__SPDIF_OUT1          IOMUX_PAD(0x65c, 0x26c, 6, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_KEY_COL4__UART1_RI            IOMUX_PAD(0x65c, 0x26c, 1, __NA_, 0, MX51_UART_PAD_CTRL)
+#define MX51_PAD_KEY_COL4__UART3_RTS           IOMUX_PAD(0x65c, 0x26c, 2, 0x9f0, 4, MX51_UART_PAD_CTRL)
+#define MX51_PAD_KEY_COL5__I2C2_SDA            IOMUX_PAD(0x660, 0x270, 0x13, 0x9bc, 1, MX51_I2C_PAD_CTRL)
+#define MX51_PAD_KEY_COL5__KEY_COL5            IOMUX_PAD(0x660, 0x270, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_KEY_COL5__UART1_DCD           IOMUX_PAD(0x660, 0x270, 1, __NA_, 0, MX51_UART_PAD_CTRL)
+#define MX51_PAD_KEY_COL5__UART3_CTS           IOMUX_PAD(0x660, 0x270, 2, __NA_, 0, MX51_UART_PAD_CTRL)
+#define MX51_PAD_USBH1_CLK__CSPI_SCLK          IOMUX_PAD(0x678, 0x278, 1, 0x914, 1, MX51_ECSPI_PAD_CTRL)
+#define MX51_PAD_USBH1_CLK__GPIO1_25           IOMUX_PAD(0x678, 0x278, 2, __NA_, 0, MX51_GPIO_PAD_CTRL)
+#define MX51_PAD_USBH1_CLK__I2C2_SCL           IOMUX_PAD(0x678, 0x278, 0x15, 0x9b8, 2, MX51_I2C_PAD_CTRL)
+#define MX51_PAD_USBH1_CLK__USBH1_CLK          IOMUX_PAD(0x678, 0x278, 0, __NA_, 0, MX51_USBH1_PAD_CTRL)
+#define MX51_PAD_USBH1_DIR__CSPI_MOSI          IOMUX_PAD(0x67c, 0x27c, 1, 0x91c, 1, MX51_ECSPI_PAD_CTRL)
+#define MX51_PAD_USBH1_DIR__GPIO1_26           IOMUX_PAD(0x67c, 0x27c, 2, __NA_, 0, MX51_GPIO_PAD_CTRL)
+#define MX51_PAD_USBH1_DIR__I2C2_SDA           IOMUX_PAD(0x67c, 0x27c, 0x15, 0x9bc, 2, MX51_I2C_PAD_CTRL)
+#define MX51_PAD_USBH1_DIR__USBH1_DIR          IOMUX_PAD(0x67c, 0x27c, 0, __NA_, 0, MX51_USBH1_PAD_CTRL)
+#define MX51_PAD_USBH1_STP__CSPI_RDY           IOMUX_PAD(0x680, 0x280, 1, __NA_, 0, MX51_ECSPI_PAD_CTRL)
+#define MX51_PAD_USBH1_STP__GPIO1_27           IOMUX_PAD(0x680, 0x280, 2, __NA_, 0, MX51_GPIO_PAD_CTRL)
+#define MX51_PAD_USBH1_STP__UART3_RXD          IOMUX_PAD(0x680, 0x280, 5, 0x9f4, 6, MX51_UART_PAD_CTRL)
+#define MX51_PAD_USBH1_STP__USBH1_STP          IOMUX_PAD(0x680, 0x280, 0, __NA_, 0, MX51_USBH1_PAD_CTRL)
+#define MX51_PAD_USBH1_NXT__CSPI_MISO          IOMUX_PAD(0x684, 0x284, 1, 0x918, 0, MX51_ECSPI_PAD_CTRL)
+#define MX51_PAD_USBH1_NXT__GPIO1_28           IOMUX_PAD(0x684, 0x284, 2, __NA_, 0, MX51_GPIO_PAD_CTRL)
+#define MX51_PAD_USBH1_NXT__UART3_TXD          IOMUX_PAD(0x684, 0x284, 5, __NA_, 0, MX51_UART_PAD_CTRL)
+#define MX51_PAD_USBH1_NXT__USBH1_NXT          IOMUX_PAD(0x684, 0x284, 0, __NA_, 0, MX51_USBH1_PAD_CTRL)
+#define MX51_PAD_USBH1_DATA0__GPIO1_11         IOMUX_PAD(0x688, 0x288, 2, __NA_, 0, MX51_GPIO_PAD_CTRL)
+#define MX51_PAD_USBH1_DATA0__UART2_CTS                IOMUX_PAD(0x688, 0x288, 1, __NA_, 0, MX51_UART_PAD_CTRL)
+#define MX51_PAD_USBH1_DATA0__USBH1_DATA0      IOMUX_PAD(0x688, 0x288, 0, __NA_, 0, MX51_USBH1_PAD_CTRL)
+#define MX51_PAD_USBH1_DATA1__GPIO1_12         IOMUX_PAD(0x68c, 0x28c, 2, __NA_, 0, MX51_GPIO_PAD_CTRL)
+#define MX51_PAD_USBH1_DATA1__UART2_RXD                IOMUX_PAD(0x68c, 0x28c, 1, 0x9ec, 4, MX51_UART_PAD_CTRL)
+#define MX51_PAD_USBH1_DATA1__USBH1_DATA1      IOMUX_PAD(0x68c, 0x28c, 0, __NA_, 0, MX51_USBH1_PAD_CTRL)
+#define MX51_PAD_USBH1_DATA2__GPIO1_13         IOMUX_PAD(0x690, 0x290, 2, __NA_, 0, MX51_GPIO_PAD_CTRL)
+#define MX51_PAD_USBH1_DATA2__UART2_TXD                IOMUX_PAD(0x690, 0x290, 1, __NA_, 0, MX51_UART_PAD_CTRL)
+#define MX51_PAD_USBH1_DATA2__USBH1_DATA2      IOMUX_PAD(0x690, 0x290, 0, __NA_, 0, MX51_USBH1_PAD_CTRL)
+#define MX51_PAD_USBH1_DATA3__GPIO1_14         IOMUX_PAD(0x694, 0x294, 2, __NA_, 0, MX51_GPIO_PAD_CTRL)
+#define MX51_PAD_USBH1_DATA3__UART2_RTS                IOMUX_PAD(0x694, 0x294, 1, 0x9e8, 5, MX51_UART_PAD_CTRL)
+#define MX51_PAD_USBH1_DATA3__USBH1_DATA3      IOMUX_PAD(0x694, 0x294, 0, __NA_, 0, MX51_USBH1_PAD_CTRL)
+#define MX51_PAD_USBH1_DATA4__CSPI_SS0         IOMUX_PAD(0x698, 0x298, 1, __NA_, 0, MX51_ECSPI_PAD_CTRL)
+#define MX51_PAD_USBH1_DATA4__GPIO1_15         IOMUX_PAD(0x698, 0x298, 2, __NA_, 0, MX51_GPIO_PAD_CTRL)
+#define MX51_PAD_USBH1_DATA4__USBH1_DATA4      IOMUX_PAD(0x698, 0x298, 0, __NA_, 0, MX51_USBH1_PAD_CTRL)
+#define MX51_PAD_USBH1_DATA5__CSPI_SS1         IOMUX_PAD(0x69c, 0x29c, 1, 0x920, 0, MX51_ECSPI_PAD_CTRL)
+#define MX51_PAD_USBH1_DATA5__GPIO1_16         IOMUX_PAD(0x69c, 0x29c, 2, __NA_, 0, MX51_GPIO_PAD_CTRL)
+#define MX51_PAD_USBH1_DATA5__USBH1_DATA5      IOMUX_PAD(0x69c, 0x29c, 0, __NA_, 0, MX51_USBH1_PAD_CTRL)
+#define MX51_PAD_USBH1_DATA6__CSPI_SS3         IOMUX_PAD(0x6a0, 0x2a0, 1, 0x928, 1, MX51_ECSPI_PAD_CTRL)
+#define MX51_PAD_USBH1_DATA6__GPIO1_17         IOMUX_PAD(0x6a0, 0x2a0, 2, __NA_, 0, MX51_GPIO_PAD_CTRL)
+#define MX51_PAD_USBH1_DATA6__USBH1_DATA6      IOMUX_PAD(0x6a0, 0x2a0, 0, __NA_, 0, MX51_USBH1_PAD_CTRL)
+#define MX51_PAD_USBH1_DATA7__ECSPI1_SS3       IOMUX_PAD(0x6a4, 0x2a4, 1, __NA_, 0, MX51_ECSPI_PAD_CTRL)
+#define MX51_PAD_USBH1_DATA7__ECSPI2_SS3       IOMUX_PAD(0x6a4, 0x2a4, 5, 0x934, 1, MX51_ECSPI_PAD_CTRL)
+#define MX51_PAD_USBH1_DATA7__GPIO1_18         IOMUX_PAD(0x6a4, 0x2a4, 2, __NA_, 0, MX51_GPIO_PAD_CTRL)
+#define MX51_PAD_USBH1_DATA7__USBH1_DATA7      IOMUX_PAD(0x6a4, 0x2a4, 0, __NA_, 0, MX51_USBH1_PAD_CTRL)
+#define MX51_PAD_DI1_PIN11__DI1_PIN11          IOMUX_PAD(0x6a8, 0x2a8, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_DI1_PIN11__ECSPI1_SS2         IOMUX_PAD(0x6a8, 0x2a8, 7, __NA_, 0, MX51_ECSPI_PAD_CTRL)
+#define MX51_PAD_DI1_PIN11__GPIO3_0            IOMUX_PAD(0x6a8, 0x2a8, 4, __NA_, 0, MX51_GPIO_PAD_CTRL)
+#define MX51_PAD_DI1_PIN12__DI1_PIN12          IOMUX_PAD(0x6ac, 0x2ac, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_DI1_PIN12__GPIO3_1            IOMUX_PAD(0x6ac, 0x2ac, 4, 0x978, 1, MX51_GPIO_PAD_CTRL)
+#define MX51_PAD_DI1_PIN13__DI1_PIN13          IOMUX_PAD(0x6b0, 0x2b0, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_DI1_PIN13__GPIO3_2            IOMUX_PAD(0x6b0, 0x2b0, 4, 0x97c, 1, MX51_GPIO_PAD_CTRL)
+#define MX51_PAD_DI1_D0_CS__DI1_D0_CS          IOMUX_PAD(0x6b4, 0x2b4, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_DI1_D0_CS__GPIO3_3            IOMUX_PAD(0x6b4, 0x2b4, 4, 0x980, 1, MX51_GPIO_PAD_CTRL)
+#define MX51_PAD_DI1_D1_CS__DI1_D1_CS          IOMUX_PAD(0x6b8, 0x2b8, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_DI1_D1_CS__DISP1_PIN14                IOMUX_PAD(0x6b8, 0x2b8, 2, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_DI1_D1_CS__DISP1_PIN5         IOMUX_PAD(0x6b8, 0x2b8, 3, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_DI1_D1_CS__GPIO3_4            IOMUX_PAD(0x6b8, 0x2b8, 4, 0x984, 1, MX51_GPIO_PAD_CTRL)
+#define MX51_PAD_DISPB2_SER_DIN__DISP1_PIN1    IOMUX_PAD(0x6bc, 0x2bc, 2, 0x9a4, 1, NO_PAD_CTRL)
+#define MX51_PAD_DISPB2_SER_DIN__DISPB2_SER_DIN        IOMUX_PAD(0x6bc, 0x2bc, 0, 0x9c4, 0, NO_PAD_CTRL)
+#define MX51_PAD_DISPB2_SER_DIN__GPIO3_5       IOMUX_PAD(0x6bc, 0x2bc, 4, 0x988, 1, MX51_GPIO_PAD_CTRL)
+#define MX51_PAD_DISPB2_SER_DIO__DISP1_PIN6    IOMUX_PAD(0x6c0, 0x2c0, 3, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_DISPB2_SER_DIO__DISPB2_SER_DIO        IOMUX_PAD(0x6c0, 0x2c0, 0, 0x9c4, 1, NO_PAD_CTRL)
+#define MX51_PAD_DISPB2_SER_DIO__GPIO3_6       IOMUX_PAD(0x6c0, 0x2c0, 4, 0x98c, 1, MX51_GPIO_PAD_CTRL)
+#define MX51_PAD_DISPB2_SER_CLK__DISP1_PIN17   IOMUX_PAD(0x6c4, 0x2c4, 2, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_DISPB2_SER_CLK__DISP1_PIN7    IOMUX_PAD(0x6c4, 0x2c4, 3, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_DISPB2_SER_CLK__DISPB2_SER_CLK        IOMUX_PAD(0x6c4, 0x2c4, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_DISPB2_SER_CLK__GPIO3_7       IOMUX_PAD(0x6c4, 0x2c4, 4, 0x990, 1, MX51_GPIO_PAD_CTRL)
+#define MX51_PAD_DISPB2_SER_RS__DISP1_EXT_CLK  IOMUX_PAD(0x6c8, 0x2c8, 2, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_DISPB2_SER_RS__DISP1_PIN16    IOMUX_PAD(0x6c8, 0x2c8, 2, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_DISPB2_SER_RS__DISP1_PIN8     IOMUX_PAD(0x6c8, 0x2c8, 3, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_DISPB2_SER_RS__DISPB2_SER_RS  IOMUX_PAD(0x6c8, 0x2c8, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_DISPB2_SER_RS__DISPB2_SER_RS  IOMUX_PAD(0x6c8, 0x2c8, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_DISPB2_SER_RS__GPIO3_8                IOMUX_PAD(0x6c8, 0x2c8, 4, 0x994, 1, MX51_GPIO_PAD_CTRL)
+#define MX51_PAD_DISP1_DAT0__DISP1_DAT0                IOMUX_PAD(0x6cc, 0x2cc, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_DISP1_DAT1__DISP1_DAT1                IOMUX_PAD(0x6d0, 0x2d0, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_DISP1_DAT2__DISP1_DAT2                IOMUX_PAD(0x6d4, 0x2d4, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_DISP1_DAT3__DISP1_DAT3                IOMUX_PAD(0x6d8, 0x2d8, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_DISP1_DAT4__DISP1_DAT4                IOMUX_PAD(0x6dc, 0x2dc, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_DISP1_DAT5__DISP1_DAT5                IOMUX_PAD(0x6e0, 0x2e0, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_DISP1_DAT6__BOOT_USB_SRC      IOMUX_PAD(0x6e4, 0x2e4, 7, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_DISP1_DAT6__DISP1_DAT6                IOMUX_PAD(0x6e4, 0x2e4, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_DISP1_DAT7__BOOT_EEPROM_CFG   IOMUX_PAD(0x6e8, 0x2e8, 7, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_DISP1_DAT7__DISP1_DAT7                IOMUX_PAD(0x6e8, 0x2e8, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_DISP1_DAT8__BOOT_SRC0         IOMUX_PAD(0x6ec, 0x2ec, 7, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_DISP1_DAT8__DISP1_DAT8                IOMUX_PAD(0x6ec, 0x2ec, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_DISP1_DAT9__BOOT_SRC1         IOMUX_PAD(0x6f0, 0x2f0, 7, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_DISP1_DAT9__DISP1_DAT9                IOMUX_PAD(0x6f0, 0x2f0, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_DISP1_DAT10__BOOT_SPARE_SIZE  IOMUX_PAD(0x6f4, 0x2f4, 7, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_DISP1_DAT10__DISP1_DAT10      IOMUX_PAD(0x6f4, 0x2f4, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_DISP1_DAT11__BOOT_LPB_FREQ2   IOMUX_PAD(0x6f8, 0x2f8, 7, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_DISP1_DAT11__DISP1_DAT11      IOMUX_PAD(0x6f8, 0x2f8, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_DISP1_DAT12__BOOT_MLC_SEL     IOMUX_PAD(0x6fc, 0x2fc, 7, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_DISP1_DAT12__DISP1_DAT12      IOMUX_PAD(0x6fc, 0x2fc, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_DISP1_DAT13__BOOT_MEM_CTL0    IOMUX_PAD(0x700, 0x300, 7, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_DISP1_DAT13__DISP1_DAT13      IOMUX_PAD(0x700, 0x300, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_DISP1_DAT14__BOOT_MEM_CTL1    IOMUX_PAD(0x704, 0x304, 7, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_DISP1_DAT14__DISP1_DAT14      IOMUX_PAD(0x704, 0x304, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_DISP1_DAT15__BOOT_BUS_WIDTH   IOMUX_PAD(0x708, 0x308, 7, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_DISP1_DAT15__DISP1_DAT15      IOMUX_PAD(0x708, 0x308, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_DISP1_DAT16__BOOT_PAGE_SIZE0  IOMUX_PAD(0x70c, 0x30c, 7, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_DISP1_DAT16__DISP1_DAT16      IOMUX_PAD(0x70c, 0x30c, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_DISP1_DAT17__BOOT_PAGE_SIZE1  IOMUX_PAD(0x710, 0x310, 7, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_DISP1_DAT17__DISP1_DAT17      IOMUX_PAD(0x710, 0x310, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_DISP1_DAT18__BOOT_WEIM_MUXED0 IOMUX_PAD(0x714, 0x314, 7, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_DISP1_DAT18__DISP1_DAT18      IOMUX_PAD(0x714, 0x314, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_DISP1_DAT18__DISP2_PIN11      IOMUX_PAD(0x714, 0x314, 5, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_DISP1_DAT18__DISP2_PIN5       IOMUX_PAD(0x714, 0x314, 4, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_DISP1_DAT19__BOOT_WEIM_MUXED1 IOMUX_PAD(0x718, 0x318, 7, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_DISP1_DAT19__DISP1_DAT19      IOMUX_PAD(0x718, 0x318, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_DISP1_DAT19__DISP2_PIN12      IOMUX_PAD(0x718, 0x318, 5, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_DISP1_DAT19__DISP2_PIN6       IOMUX_PAD(0x718, 0x318, 4, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_DISP1_DAT20__BOOT_MEM_TYPE0   IOMUX_PAD(0x71c, 0x31c, 7, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_DISP1_DAT20__DISP1_DAT20      IOMUX_PAD(0x71c, 0x31c, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_DISP1_DAT20__DISP2_PIN13      IOMUX_PAD(0x71c, 0x31c, 5, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_DISP1_DAT20__DISP2_PIN7       IOMUX_PAD(0x71c, 0x31c, 4, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_DISP1_DAT21__BOOT_MEM_TYPE1   IOMUX_PAD(0x720, 0x320, 7, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_DISP1_DAT21__DISP1_DAT21      IOMUX_PAD(0x720, 0x320, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_DISP1_DAT21__DISP2_PIN14      IOMUX_PAD(0x720, 0x320, 5, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_DISP1_DAT21__DISP2_PIN8       IOMUX_PAD(0x720, 0x320, 4, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_DISP1_DAT22__BOOT_LPB_FREQ0   IOMUX_PAD(0x724, 0x324, 7, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_DISP1_DAT22__DISP1_DAT22      IOMUX_PAD(0x724, 0x324, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_DISP1_DAT22__DISP2_D0_CS      IOMUX_PAD(0x724, 0x324, 6, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_DISP1_DAT22__DISP2_DAT16      IOMUX_PAD(0x724, 0x324, 5, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_DISP1_DAT23__BOOT_LPB_FREQ1   IOMUX_PAD(0x728, 0x328, 7, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_DISP1_DAT23__DISP1_DAT23      IOMUX_PAD(0x728, 0x328, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_DISP1_DAT23__DISP2_D1_CS      IOMUX_PAD(0x728, 0x328, 6, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_DISP1_DAT23__DISP2_DAT17      IOMUX_PAD(0x728, 0x328, 5, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_DISP1_DAT23__DISP2_SER_CS     IOMUX_PAD(0x728, 0x328, 4, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_DI1_PIN3__DI1_PIN3            IOMUX_PAD(0x72c, 0x32c, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_DI1_PIN2__DI1_PIN2            IOMUX_PAD(0x734, 0x330, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_DI_GP2__DISP1_SER_CLK         IOMUX_PAD(0x740, 0x338, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_DI_GP2__DISP2_WAIT            IOMUX_PAD(0x740, 0x338, 2, 0x9a8, 1, NO_PAD_CTRL)
+#define MX51_PAD_DI_GP3__CSI1_DATA_EN          IOMUX_PAD(0x744, 0x33c, 3, 0x9a0, 1, NO_PAD_CTRL)
+#define MX51_PAD_DI_GP3__DISP1_SER_DIO         IOMUX_PAD(0x744, 0x33c, 0, 0x9c0, 0, NO_PAD_CTRL)
+#define MX51_PAD_DI_GP3__FEC_TX_ER             IOMUX_PAD(0x744, 0x33c, 2, __NA_, 0, MX51_PAD_CTRL_5)
+#define MX51_PAD_DI2_PIN4__CSI2_DATA_EN                IOMUX_PAD(0x748, 0x340, 3, 0x99c, 1, NO_PAD_CTRL)
+#define MX51_PAD_DI2_PIN4__DI2_PIN4            IOMUX_PAD(0x748, 0x340, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_DI2_PIN4__FEC_CRS             IOMUX_PAD(0x748, 0x340, 2, 0x950, 1, NO_PAD_CTRL)
+#define MX51_PAD_DI2_PIN2__DI2_PIN2            IOMUX_PAD(0x74c, 0x344, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_DI2_PIN2__FEC_MDC             IOMUX_PAD(0x74c, 0x344, 2, __NA_, 0, MX51_PAD_CTRL_5)
+#define MX51_PAD_DI2_PIN3__DI2_PIN3            IOMUX_PAD(0x750, 0x348, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_DI2_PIN3__FEC_MDIO            IOMUX_PAD(0x750, 0x348, 2, 0x954, 1, NO_PAD_CTRL)
+#define MX51_PAD_DI2_DISP_CLK__DI2_DISP_CLK    IOMUX_PAD(0x754, 0x34c, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_DI2_DISP_CLK__FEC_RDATA1      IOMUX_PAD(0x754, 0x34c, 2, 0x95c, 1, NO_PAD_CTRL)
+#define MX51_PAD_DI_GP4__DI2_PIN15             IOMUX_PAD(0x758, 0x350, 4, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_DI_GP4__DISP1_SER_DIN         IOMUX_PAD(0x758, 0x350, 0, 0x9c0, 1, NO_PAD_CTRL)
+#define MX51_PAD_DI_GP4__DISP2_PIN1            IOMUX_PAD(0x758, 0x350, 3, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_DI_GP4__FEC_RDATA2            IOMUX_PAD(0x758, 0x350, 2, 0x960, 1, NO_PAD_CTRL)
+#define MX51_PAD_DISP2_DAT0__DISP2_DAT0                IOMUX_PAD(0x75c, 0x354, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_DISP2_DAT0__FEC_RDATA3                IOMUX_PAD(0x75c, 0x354, 2, 0x964, 1, NO_PAD_CTRL)
+#define MX51_PAD_DISP2_DAT0__KEY_COL6          IOMUX_PAD(0x75c, 0x354, 4, 0x9c8, 1, NO_PAD_CTRL)
+#define MX51_PAD_DISP2_DAT0__UART3_RXD         IOMUX_PAD(0x75c, 0x354, 5, 0x9f4, 8, MX51_UART_PAD_CTRL)
+#define MX51_PAD_DISP2_DAT0__USBH3_CLK         IOMUX_PAD(0x75c, 0x354, 3, 0x9f8, 1, MX51_UART_PAD_CTRL)
+#define MX51_PAD_DISP2_DAT1__DISP2_DAT1                IOMUX_PAD(0x760, 0x358, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_DISP2_DAT1__FEC_RX_ER         IOMUX_PAD(0x760, 0x358, 2, 0x970, 1, NO_PAD_CTRL)
+#define MX51_PAD_DISP2_DAT1__KEY_COL7          IOMUX_PAD(0x760, 0x358, 4, 0x9cc, 1, NO_PAD_CTRL)
+#define MX51_PAD_DISP2_DAT1__UART3_TXD         IOMUX_PAD(0x760, 0x358, 5, __NA_, 0, MX51_UART_PAD_CTRL)
+#define MX51_PAD_DISP2_DAT1__USBH3_DIR         IOMUX_PAD(0x760, 0x358, 3, 0xa1c, 1, NO_PAD_CTRL)
+#define MX51_PAD_DISP2_DAT2__DISP2_DAT2                IOMUX_PAD(0x764, 0x35c, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_DISP2_DAT3__DISP2_DAT3                IOMUX_PAD(0x768, 0x360, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_DISP2_DAT4__DISP2_DAT4                IOMUX_PAD(0x76c, 0x364, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_DISP2_DAT5__DISP2_DAT5                IOMUX_PAD(0x770, 0x368, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_DISP2_DAT6__DISP2_DAT6                IOMUX_PAD(0x774, 0x36c, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_DISP2_DAT6__FEC_TDATA1                IOMUX_PAD(0x774, 0x36c, 2, __NA_, 0, MX51_PAD_CTRL_5)
+#define MX51_PAD_DISP2_DAT6__GPIO1_19          IOMUX_PAD(0x774, 0x36c, 5, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_DISP2_DAT6__KEY_ROW4          IOMUX_PAD(0x774, 0x36c, 4, 0x9d0, 1, NO_PAD_CTRL)
+#define MX51_PAD_DISP2_DAT6__USBH3_STP         IOMUX_PAD(0x774, 0x36c, 3, 0xa24, 1, NO_PAD_CTRL)
+#define MX51_PAD_DISP2_DAT7__DISP2_DAT7                IOMUX_PAD(0x778, 0x370, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_DISP2_DAT7__FEC_TDATA2                IOMUX_PAD(0x778, 0x370, 2, __NA_, 0, MX51_PAD_CTRL_5)
+#define MX51_PAD_DISP2_DAT7__GPIO1_29          IOMUX_PAD(0x778, 0x370, 5, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_DISP2_DAT7__KEY_ROW5          IOMUX_PAD(0x778, 0x370, 4, 0x9d4, 1, NO_PAD_CTRL)
+#define MX51_PAD_DISP2_DAT7__USBH3_NXT         IOMUX_PAD(0x778, 0x370, 3, 0xa20, 1, NO_PAD_CTRL)
+#define MX51_PAD_DISP2_DAT8__DISP2_DAT8                IOMUX_PAD(0x77c, 0x374, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_DISP2_DAT8__FEC_TDATA3                IOMUX_PAD(0x77c, 0x374, 2, __NA_, 0, MX51_PAD_CTRL_5)
+#define MX51_PAD_DISP2_DAT8__GPIO1_30          IOMUX_PAD(0x77c, 0x374, 5, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_DISP2_DAT8__KEY_ROW6          IOMUX_PAD(0x77c, 0x374, 4, 0x9d8, 1, NO_PAD_CTRL)
+#define MX51_PAD_DISP2_DAT8__USBH3_DATA0       IOMUX_PAD(0x77c, 0x374, 3, 0x9fc, 1, NO_PAD_CTRL)
+#define MX51_PAD_DISP2_DAT9__AUD6_RXC          IOMUX_PAD(0x780, 0x378, 4, 0x8f4, 1, NO_PAD_CTRL)
+#define MX51_PAD_DISP2_DAT9__DISP2_DAT9                IOMUX_PAD(0x780, 0x378, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_DISP2_DAT9__FEC_TX_EN         IOMUX_PAD(0x780, 0x378, 2, __NA_, 0, MX51_PAD_CTRL_5)
+#define MX51_PAD_DISP2_DAT9__GPIO1_31          IOMUX_PAD(0x780, 0x378, 5, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_DISP2_DAT9__USBH3_DATA1       IOMUX_PAD(0x780, 0x378, 3, 0xa00, 1, NO_PAD_CTRL)
+#define MX51_PAD_DISP2_DAT10__DISP2_DAT10      IOMUX_PAD(0x784, 0x37c, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_DISP2_DAT10__DISP2_SER_CS     IOMUX_PAD(0x784, 0x37c, 5, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_DISP2_DAT10__FEC_COL          IOMUX_PAD(0x784, 0x37c, 2, 0x94c, 1, NO_PAD_CTRL)
+#define MX51_PAD_DISP2_DAT10__KEY_ROW7         IOMUX_PAD(0x784, 0x37c, 4, 0x9dc, 1, NO_PAD_CTRL)
+#define MX51_PAD_DISP2_DAT10__USBH3_DATA2      IOMUX_PAD(0x784, 0x37c, 3, 0xa04, 1, NO_PAD_CTRL)
+#define MX51_PAD_DISP2_DAT11__AUD6_TXD         IOMUX_PAD(0x788, 0x380, 4, 0x8f0, 1, NO_PAD_CTRL)
+#define MX51_PAD_DISP2_DAT11__DISP2_DAT11      IOMUX_PAD(0x788, 0x380, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_DISP2_DAT11__FEC_RX_CLK       IOMUX_PAD(0x788, 0x380, 2, 0x968, 1, NO_PAD_CTRL)
+#define MX51_PAD_DISP2_DAT11__GPIO1_10         IOMUX_PAD(0x788, 0x380, 7, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_DISP2_DAT11__USBH3_DATA3      IOMUX_PAD(0x788, 0x380, 3, 0xa08, 1, NO_PAD_CTRL)
+#define MX51_PAD_DISP2_DAT12__AUD6_RXD         IOMUX_PAD(0x78c, 0x384, 4, 0x8ec, 1, NO_PAD_CTRL)
+#define MX51_PAD_DISP2_DAT12__DISP2_DAT12      IOMUX_PAD(0x78c, 0x384, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_DISP2_DAT12__FEC_RX_DV                IOMUX_PAD(0x78c, 0x384, 2, 0x96c, 1, NO_PAD_CTRL)
+#define MX51_PAD_DISP2_DAT12__USBH3_DATA4      IOMUX_PAD(0x78c, 0x384, 3, 0xa0c, 1, NO_PAD_CTRL)
+#define MX51_PAD_DISP2_DAT13__AUD6_TXC         IOMUX_PAD(0x790, 0x388, 4, 0x8fc, 1, NO_PAD_CTRL)
+#define MX51_PAD_DISP2_DAT13__DISP2_DAT13      IOMUX_PAD(0x790, 0x388, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_DISP2_DAT13__FEC_TX_CLK       IOMUX_PAD(0x790, 0x388, 2, 0x974, 1, MX51_PAD_CTRL_4)
+#define MX51_PAD_DISP2_DAT13__USBH3_DATA5      IOMUX_PAD(0x790, 0x388, 3, 0xa10, 1, NO_PAD_CTRL)
+#define MX51_PAD_DISP2_DAT14__AUD6_TXFS                IOMUX_PAD(0x794, 0x38c, 4, 0x900, 1, NO_PAD_CTRL)
+#define MX51_PAD_DISP2_DAT14__DISP2_DAT14      IOMUX_PAD(0x794, 0x38c, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_DISP2_DAT14__FEC_RDATA0       IOMUX_PAD(0x794, 0x38c, 2, 0x958, 1, MX51_PAD_CTRL_4)
+#define MX51_PAD_DISP2_DAT14__USBH3_DATA6      IOMUX_PAD(0x794, 0x38c, 3, 0xa14, 1, NO_PAD_CTRL)
+#define MX51_PAD_DISP2_DAT15__AUD6_RXFS                IOMUX_PAD(0x798, 0x390, 4, 0x8f8, 1, NO_PAD_CTRL)
+#define MX51_PAD_DISP2_DAT15__DISP1_SER_CS     IOMUX_PAD(0x798, 0x390, 5, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_DISP2_DAT15__DISP2_DAT15      IOMUX_PAD(0x798, 0x390, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_DISP2_DAT15__FEC_TDATA0       IOMUX_PAD(0x798, 0x390, 2, __NA_, 0, MX51_PAD_CTRL_5)
+#define MX51_PAD_DISP2_DAT15__USBH3_DATA7      IOMUX_PAD(0x798, 0x390, 3, 0xa18, 1, NO_PAD_CTRL)
+#define MX51_PAD_SD1_CMD__AUD5_RXFS            IOMUX_PAD(0x79c, 0x394, 1, 0x8e0, 1, NO_PAD_CTRL)
+#define MX51_PAD_SD1_CMD__CSPI_MOSI            IOMUX_PAD(0x79c, 0x394, 2, 0x91c, 2, NO_PAD_CTRL)
+#define MX51_PAD_SD1_CMD__SD1_CMD              IOMUX_PAD(0x79c, 0x394, 0x10, __NA_, 0, MX51_SDHCI_PAD_CTRL)
+#define MX51_PAD_SD1_CLK__AUD5_RXC             IOMUX_PAD(0x7a0, 0x398, 1, 0x8dc, 1, NO_PAD_CTRL)
+#define MX51_PAD_SD1_CLK__CSPI_SCLK            IOMUX_PAD(0x7a0, 0x398, 2, 0x914, 2, NO_PAD_CTRL)
+#define MX51_PAD_SD1_CLK__SD1_CLK              IOMUX_PAD(0x7a0, 0x398, 0x10, __NA_, 0, MX51_SDHCI_PAD_CTRL | PAD_CTL_HYS)
+#define MX51_PAD_SD1_DATA0__AUD5_TXD           IOMUX_PAD(0x7a4, 0x39c, 1, 0x8d8, 2, NO_PAD_CTRL)
+#define MX51_PAD_SD1_DATA0__CSPI_MISO          IOMUX_PAD(0x7a4, 0x39c, 2, 0x918, 1, MX51_ECSPI_PAD_CTRL)
+#define MX51_PAD_SD1_DATA0__SD1_DATA0          IOMUX_PAD(0x7a4, 0x39c, 0x10, __NA_, 0, MX51_SDHCI_PAD_CTRL)
+#define MX51_PAD_EIM_DA0__EIM_DA0              IOMUX_PAD(__NA_, 0x01c, 0, 0x000, 0, NO_PAD_CTRL)
+#define MX51_PAD_EIM_DA1__EIM_DA1              IOMUX_PAD(__NA_, 0x020, 0, 0x000, 0, NO_PAD_CTRL)
+#define MX51_PAD_EIM_DA2__EIM_DA2              IOMUX_PAD(__NA_, 0x024, 0, 0x000, 0, NO_PAD_CTRL)
+#define MX51_PAD_EIM_DA3__EIM_DA3              IOMUX_PAD(__NA_, 0x028, 0, 0x000, 0, NO_PAD_CTRL)
+#define MX51_PAD_SD1_DATA1__AUD5_RXD           IOMUX_PAD(0x7a8, 0x3a0, 1, 0x8d4, 2, NO_PAD_CTRL)
+#define MX51_PAD_SD1_DATA1__SD1_DATA1          IOMUX_PAD(0x7a8, 0x3a0, 0x10, __NA_, 0, MX51_SDHCI_PAD_CTRL)
+#define MX51_PAD_EIM_DA4__EIM_DA4              IOMUX_PAD(__NA_, 0x02c, 0, 0x000, 0, NO_PAD_CTRL)
+#define MX51_PAD_EIM_DA5__EIM_DA5              IOMUX_PAD(__NA_, 0x030, 0, 0x000, 0, NO_PAD_CTRL)
+#define MX51_PAD_EIM_DA6__EIM_DA6              IOMUX_PAD(__NA_, 0x034, 0, 0x000, 0, NO_PAD_CTRL)
+#define MX51_PAD_EIM_DA7__EIM_DA7              IOMUX_PAD(__NA_, 0x038, 0, 0x000, 0, NO_PAD_CTRL)
+#define MX51_PAD_SD1_DATA2__AUD5_TXC           IOMUX_PAD(0x7ac, 0x3a4, 1, 0x8e4, 2, NO_PAD_CTRL)
+#define MX51_PAD_SD1_DATA2__SD1_DATA2          IOMUX_PAD(0x7ac, 0x3a4, 0x10, __NA_, 0, MX51_SDHCI_PAD_CTRL)
+#define MX51_PAD_EIM_DA10__EIM_DA10            IOMUX_PAD(__NA_, 0x044, 0, 0x000, 0, NO_PAD_CTRL)
+#define MX51_PAD_EIM_DA11__EIM_DA11            IOMUX_PAD(__NA_, 0x048, 0, 0x000, 0, NO_PAD_CTRL)
+#define MX51_PAD_EIM_DA8__EIM_DA8              IOMUX_PAD(__NA_, 0x03c, 0, 0x000, 0, NO_PAD_CTRL)
+#define MX51_PAD_EIM_DA9__EIM_DA9              IOMUX_PAD(__NA_, 0x040, 0, 0x000, 0, NO_PAD_CTRL)
+#define MX51_PAD_SD1_DATA3__AUD5_TXFS          IOMUX_PAD(0x7b0, 0x3a8, 1, 0x8e8, 2, NO_PAD_CTRL)
+#define MX51_PAD_SD1_DATA3__CSPI_SS1           IOMUX_PAD(0x7b0, 0x3a8, 2, 0x920, 1, MX51_ECSPI_PAD_CTRL)
+#define MX51_PAD_SD1_DATA3__SD1_DATA3          IOMUX_PAD(0x7b0, 0x3a8, 0x10, __NA_, 0, MX51_SDHCI_PAD_CTRL)
+#define MX51_PAD_GPIO1_0__CSPI_SS2             IOMUX_PAD(0x7b4, 0x3ac, 2, 0x924, 0, MX51_ECSPI_PAD_CTRL)
+#define MX51_PAD_GPIO1_0__GPIO1_0              IOMUX_PAD(0x7b4, 0x3ac, 1, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_GPIO1_0__SD1_CD               IOMUX_PAD(0x7b4, 0x3ac, 0, __NA_, 0, MX51_ESDHC_PAD_CTRL)
+#define MX51_PAD_GPIO1_1__CSPI_MISO            IOMUX_PAD(0x7b8, 0x3b0, 2, 0x918, 2, MX51_ECSPI_PAD_CTRL)
+#define MX51_PAD_GPIO1_1__GPIO1_1              IOMUX_PAD(0x7b8, 0x3b0, 1, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_GPIO1_1__SD1_WP               IOMUX_PAD(0x7b8, 0x3b0, 0, __NA_, 0, MX51_ESDHC_PAD_CTRL)
+#define MX51_PAD_EIM_DA12__EIM_DA12            IOMUX_PAD(__NA_, 0x04c, 0, 0x000, 0, NO_PAD_CTRL)
+#define MX51_PAD_EIM_DA13__EIM_DA13            IOMUX_PAD(__NA_, 0x050, 0, 0x000, 0, NO_PAD_CTRL)
+#define MX51_PAD_EIM_DA14__EIM_DA14            IOMUX_PAD(__NA_, 0x054, 0, 0x000, 0, NO_PAD_CTRL)
+#define MX51_PAD_EIM_DA15__EIM_DA15            IOMUX_PAD(__NA_, 0x058, 0, 0x000, 0, NO_PAD_CTRL)
+#define MX51_PAD_SD2_CMD__CSPI_MOSI            IOMUX_PAD(__NA_, 0x3b4, 2, 0x91c, 3, MX51_ECSPI_PAD_CTRL)
+#define MX51_PAD_SD2_CMD__I2C1_SCL             IOMUX_PAD(0x7bc, 0x3b4, 0x11, 0x9b0, 2, MX51_I2C_PAD_CTRL)
+#define MX51_PAD_SD2_CMD__SD2_CMD              IOMUX_PAD(0x7bc, 0x3b4, 0x10, __NA_, 0, MX51_SDHCI_PAD_CTRL)
+#define MX51_PAD_SD2_CLK__CSPI_SCLK            IOMUX_PAD(0x7c0, 0x3b8, 2, 0x914, 3, MX51_ECSPI_PAD_CTRL)
+#define MX51_PAD_SD2_CLK__I2C1_SDA             IOMUX_PAD(0x7c0, 0x3b8, 0x11, 0x9b4, 2, MX51_I2C_PAD_CTRL)
+#define MX51_PAD_SD2_CLK__SD2_CLK              IOMUX_PAD(0x7c0, 0x3b8, 0x10, __NA_, 0, MX51_SDHCI_PAD_CTRL | PAD_CTL_HYS)
+#define MX51_PAD_SD2_DATA0__CSPI_MISO          IOMUX_PAD(0x7c4, 0x3bc, 2, 0x918, 3, MX51_ECSPI_PAD_CTRL)
+#define MX51_PAD_SD2_DATA0__SD1_DAT4           IOMUX_PAD(0x7c4, 0x3bc, 1, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_SD2_DATA0__SD2_DATA0          IOMUX_PAD(0x7c4, 0x3bc, 0x10, __NA_, 0, MX51_SDHCI_PAD_CTRL)
+#define MX51_PAD_SD2_DATA1__SD1_DAT5           IOMUX_PAD(0x7c8, 0x3c0, 1, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_SD2_DATA1__SD2_DATA1          IOMUX_PAD(0x7c8, 0x3c0, 0x10, __NA_, 0, MX51_SDHCI_PAD_CTRL)
+#define MX51_PAD_SD2_DATA1__USBH3_H2_DP                IOMUX_PAD(0x7c8, 0x3c0, 2, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_SD2_DATA2__SD1_DAT6           IOMUX_PAD(0x7cc, 0x3c4, 1, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_SD2_DATA2__SD2_DATA2          IOMUX_PAD(0x7cc, 0x3c4, 0x10, __NA_, 0, MX51_SDHCI_PAD_CTRL)
+#define MX51_PAD_SD2_DATA2__USBH3_H2_DM                IOMUX_PAD(0x7cc, 0x3c4, 2, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_SD2_DATA3__CSPI_SS2           IOMUX_PAD(0x7d0, 0x3c8, 2, 0x924, 1, MX51_ECSPI_PAD_CTRL)
+#define MX51_PAD_SD2_DATA3__SD1_DAT7           IOMUX_PAD(0x7d0, 0x3c8, 1, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_SD2_DATA3__SD2_DATA3          IOMUX_PAD(0x7d0, 0x3c8, 0x10, __NA_, 0, MX51_SDHCI_PAD_CTRL)
+#define MX51_PAD_GPIO1_2__CCM_OUT_2            IOMUX_PAD(0x7d4, 0x3cc, 5, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_GPIO1_2__GPIO1_2              IOMUX_PAD(0x7d4, 0x3cc, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_GPIO1_2__I2C2_SCL             IOMUX_PAD(0x7d4, 0x3cc, 0x12, 0x9b8, 3, MX51_I2C_PAD_CTRL)
+#define MX51_PAD_GPIO1_2__PLL1_BYP             IOMUX_PAD(0x7d4, 0x3cc, 7, 0x90c, 1, NO_PAD_CTRL)
+#define MX51_PAD_GPIO1_2__PWM1_PWMO            IOMUX_PAD(0x7d4, 0x3cc, 1, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_GPIO1_3__GPIO1_3              IOMUX_PAD(0x7d8, 0x3d0, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_GPIO1_3__I2C2_SDA             IOMUX_PAD(0x7d8, 0x3d0, 0x12, 0x9bc, 3, MX51_I2C_PAD_CTRL)
+#define MX51_PAD_GPIO1_3__PLL2_BYP             IOMUX_PAD(0x7d8, 0x3d0, 7, 0x910, 1, NO_PAD_CTRL)
+#define MX51_PAD_GPIO1_3__PWM2_PWMO            IOMUX_PAD(0x7d8, 0x3d0, 1, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_PMIC_INT_REQ__PMIC_INT_REQ    IOMUX_PAD(0x7fc, 0x3d4, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_PMIC_INT_REQ__PMIC_PMU_IRQ_B  IOMUX_PAD(0x7fc, 0x3d4, 1, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_GPIO1_4__DISP2_EXT_CLK                IOMUX_PAD(0x804, 0x3d8, 4, 0x908, 1, NO_PAD_CTRL)
+#define MX51_PAD_GPIO1_4__EIM_RDY              IOMUX_PAD(0x804, 0x3d8, 3, 0x938, 1, NO_PAD_CTRL)
+#define MX51_PAD_GPIO1_4__GPIO1_4              IOMUX_PAD(0x804, 0x3d8, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_GPIO1_4__WDOG1_WDOG_B         IOMUX_PAD(0x804, 0x3d8, 2, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_GPIO1_5__CSI2_MCLK            IOMUX_PAD(0x808, 0x3dc, 6, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_GPIO1_5__DISP2_PIN16          IOMUX_PAD(0x808, 0x3dc, 3, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_GPIO1_5__GPIO1_5              IOMUX_PAD(0x808, 0x3dc, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_GPIO1_5__WDOG2_WDOG_B         IOMUX_PAD(0x808, 0x3dc, 2, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_GPIO1_6__DISP2_PIN17          IOMUX_PAD(0x80c, 0x3e0, 4, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_GPIO1_6__GPIO1_6              IOMUX_PAD(0x80c, 0x3e0, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_GPIO1_6__REF_EN_B             IOMUX_PAD(0x80c, 0x3e0, 3, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_GPIO1_7__CCM_OUT_0            IOMUX_PAD(0x810, 0x3e4, 3, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_GPIO1_7__GPIO1_7              IOMUX_PAD(0x810, 0x3e4, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_GPIO1_7__SD2_WP               IOMUX_PAD(0x810, 0x3e4, 6, __NA_, 0, MX51_ESDHC_PAD_CTRL)
+#define MX51_PAD_GPIO1_7__SPDIF_OUT1           IOMUX_PAD(0x810, 0x3e4, 2, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_GPIO1_8__CSI2_DATA_EN         IOMUX_PAD(0x814, 0x3e8, 2, 0x99c, 2, NO_PAD_CTRL)
+#define MX51_PAD_GPIO1_8__GPIO1_8              IOMUX_PAD(0x814, 0x3e8, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_GPIO1_8__SD2_CD               IOMUX_PAD(0x814, 0x3e8, 6, __NA_, 0, MX51_ESDHC_PAD_CTRL)
+#define MX51_PAD_GPIO1_8__USBH3_PWR            IOMUX_PAD(0x814, 0x3e8, 1, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_GPIO1_9__CCM_OUT_1            IOMUX_PAD(0x818, 0x3ec, 3, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_GPIO1_9__DISP2_D1_CS          IOMUX_PAD(0x818, 0x3ec, 2, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_GPIO1_9__DISP2_SER_CS         IOMUX_PAD(0x818, 0x3ec, 7, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_GPIO1_9__GPIO1_9              IOMUX_PAD(0x818, 0x3ec, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_GPIO1_9__SD2_LCTL             IOMUX_PAD(0x818, 0x3ec, 6, __NA_, 0, NO_PAD_CTRL)
+#define MX51_PAD_GPIO1_9__USBH3_OC             IOMUX_PAD(0x818, 0x3ec, 1, __NA_, 0, NO_PAD_CTRL)
+
+#endif /* __MACH_IOMUX_MX51_H__ */
diff --git a/arch/arm/include/asm/arch-mx5/iomux-mx53.h b/arch/arm/include/asm/arch-mx5/iomux-mx53.h
new file mode 100644 (file)
index 0000000..4361cd6
--- /dev/null
@@ -0,0 +1,1219 @@
+/*
+ * Copyright (C) 2010-2011 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 __MACH_IOMUX_MX53_H__
+#define __MACH_IOMUX_MX53_H__
+
+#include "iomux-v3.h"
+
+/* These 2 defines are for pins that may not have a mux register, but could
+ * have a pad setting register, and vice-versa. */
+#define __NA_  0x00
+
+#define MX53_UART_PAD_CTRL             (PAD_CTL_PKE | PAD_CTL_PUE |    \
+               PAD_CTL_DSE_HIGH | PAD_CTL_SRE_FAST | PAD_CTL_HYS)
+#define MX53_SDHC_PAD_CTRL     (PAD_CTL_HYS | PAD_CTL_PKE | PAD_CTL_PUE | \
+                               PAD_CTL_PUS_47K_UP | PAD_CTL_DSE_HIGH | \
+                               PAD_CTL_SRE_FAST)
+
+
+#define MX53_PAD_GPIO_19__KPP_COL_5                    IOMUX_PAD(0x348, 0x020, 0, 0x840, 0, NO_PAD_CTRL)
+#define MX53_PAD_GPIO_19__GPIO4_5                      IOMUX_PAD(0x348, 0x020, 1, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_GPIO_19__CCM_CLKO                     IOMUX_PAD(0x348, 0x020, 2, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_GPIO_19__SPDIF_OUT1                   IOMUX_PAD(0x348, 0x020, 3, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_GPIO_19__RTC_CE_RTC_EXT_TRIG2         IOMUX_PAD(0x348, 0x020, 4, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_GPIO_19__ECSPI1_RDY                   IOMUX_PAD(0x348, 0x020, 5, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_GPIO_19__FEC_TDATA_3                  IOMUX_PAD(0x348, 0x020, 6, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_GPIO_19__SRC_INT_BOOT                 IOMUX_PAD(0x348, 0x020, 7, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_KEY_COL0__KPP_COL_0                   IOMUX_PAD(0x34C, 0x024, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_KEY_COL0__GPIO4_6                     IOMUX_PAD(0x34C, 0x024, 1, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_KEY_COL0__AUDMUX_AUD5_TXC             IOMUX_PAD(0x34C, 0x024, 2, 0x758, 0, NO_PAD_CTRL)
+#define MX53_PAD_KEY_COL0__UART4_TXD_MUX               IOMUX_PAD(0x34C, 0x024, 4, __NA_, 0, MX53_UART_PAD_CTRL)
+#define MX53_PAD_KEY_COL0__ECSPI1_SCLK                 IOMUX_PAD(0x34C, 0x024, 5, 0x79C, 0, NO_PAD_CTRL)
+#define MX53_PAD_KEY_COL0__FEC_RDATA_3                 IOMUX_PAD(0x34C, 0x024, 6, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_KEY_COL0__SRC_ANY_PU_RST              IOMUX_PAD(0x34C, 0x024, 7, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_KEY_ROW0__KPP_ROW_0                   IOMUX_PAD(0x350, 0x028, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_KEY_ROW0__GPIO4_7                     IOMUX_PAD(0x350, 0x028, 1, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_KEY_ROW0__AUDMUX_AUD5_TXD             IOMUX_PAD(0x350, 0x028, 2, 0x74C, 0, NO_PAD_CTRL)
+#define MX53_PAD_KEY_ROW0__UART4_RXD_MUX               IOMUX_PAD(0x350, 0x028, 4, 0x890, 1, MX53_UART_PAD_CTRL)
+#define MX53_PAD_KEY_ROW0__ECSPI1_MOSI                 IOMUX_PAD(0x350, 0x028, 5, 0x7A4, 0, NO_PAD_CTRL)
+#define MX53_PAD_KEY_ROW0__FEC_TX_ER                   IOMUX_PAD(0x350, 0x028, 6, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_KEY_COL1__KPP_COL_1                   IOMUX_PAD(0x354, 0x02C, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_KEY_COL1__GPIO4_8                     IOMUX_PAD(0x354, 0x02C, 1, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_KEY_COL1__AUDMUX_AUD5_TXFS            IOMUX_PAD(0x354, 0x02C, 2, 0x75C, 0, NO_PAD_CTRL)
+#define MX53_PAD_KEY_COL1__UART5_TXD_MUX               IOMUX_PAD(0x354, 0x02C, 4, __NA_, 0, MX53_UART_PAD_CTRL)
+#define MX53_PAD_KEY_COL1__ECSPI1_MISO                 IOMUX_PAD(0x354, 0x02C, 5, 0x7A0, 0, NO_PAD_CTRL)
+#define MX53_PAD_KEY_COL1__FEC_RX_CLK                  IOMUX_PAD(0x354, 0x02C, 6, 0x808, 0, NO_PAD_CTRL)
+#define MX53_PAD_KEY_COL1__USBPHY1_TXREADY             IOMUX_PAD(0x354, 0x02C, 7, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_KEY_ROW1__KPP_ROW_1                   IOMUX_PAD(0x358, 0x030, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_KEY_ROW1__GPIO4_9                     IOMUX_PAD(0x358, 0x030, 1, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_KEY_ROW1__AUDMUX_AUD5_RXD             IOMUX_PAD(0x358, 0x030, 2, 0x748, 0, NO_PAD_CTRL)
+#define MX53_PAD_KEY_ROW1__UART5_RXD_MUX               IOMUX_PAD(0x358, 0x030, 4, 0x898, 1, MX53_UART_PAD_CTRL)
+#define MX53_PAD_KEY_ROW1__ECSPI1_SS0                  IOMUX_PAD(0x358, 0x030, 5, 0x7A8, 0, NO_PAD_CTRL)
+#define MX53_PAD_KEY_ROW1__FEC_COL                     IOMUX_PAD(0x358, 0x030, 6, 0x800, 0, NO_PAD_CTRL)
+#define MX53_PAD_KEY_ROW1__USBPHY1_RXVALID             IOMUX_PAD(0x358, 0x030, 7, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_KEY_COL2__KPP_COL_2                   IOMUX_PAD(0x35C, 0x034, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_KEY_COL2__GPIO4_10                    IOMUX_PAD(0x35C, 0x034, 1, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_KEY_COL2__CAN1_TXCAN                  IOMUX_PAD(0x35C, 0x034, 2, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_KEY_COL2__FEC_MDIO                    IOMUX_PAD(0x35C, 0x034, 4, 0x804, 0, NO_PAD_CTRL)
+#define MX53_PAD_KEY_COL2__ECSPI1_SS1                  IOMUX_PAD(0x35C, 0x034, 5, 0x7AC, 0, NO_PAD_CTRL)
+#define MX53_PAD_KEY_COL2__FEC_RDATA_2                 IOMUX_PAD(0x35C, 0x034, 6, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_KEY_COL2__USBPHY1_RXACTIVE            IOMUX_PAD(0x35C, 0x034, 7, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_KEY_ROW2__KPP_ROW_2                   IOMUX_PAD(0x360, 0x038, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_KEY_ROW2__GPIO4_11                    IOMUX_PAD(0x360, 0x038, 1, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_KEY_ROW2__CAN1_RXCAN                  IOMUX_PAD(0x360, 0x038, 2, 0x760, 0, NO_PAD_CTRL)
+#define MX53_PAD_KEY_ROW2__FEC_MDC                     IOMUX_PAD(0x360, 0x038, 4, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_KEY_ROW2__ECSPI1_SS2                  IOMUX_PAD(0x360, 0x038, 5, 0x7B0, 0, NO_PAD_CTRL)
+#define MX53_PAD_KEY_ROW2__FEC_TDATA_2                 IOMUX_PAD(0x360, 0x038, 6, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_KEY_ROW2__USBPHY1_RXERROR             IOMUX_PAD(0x360, 0x038, 7, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_KEY_COL3__KPP_COL_3                   IOMUX_PAD(0x364, 0x03C, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_KEY_COL3__GPIO4_12                    IOMUX_PAD(0x364, 0x03C, 1, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_KEY_COL3__USBOH3_H2_DP                        IOMUX_PAD(0x364, 0x03C, 2, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_KEY_COL3__SPDIF_IN1                   IOMUX_PAD(0x364, 0x03C, 3, 0x870, 0, NO_PAD_CTRL)
+#define MX53_PAD_KEY_COL3__I2C2_SCL                    IOMUX_PAD(0x364, 0x03C, 4 | IOMUX_CONFIG_SION, 0x81C, 0, NO_PAD_CTRL)
+#define MX53_PAD_KEY_COL3__ECSPI1_SS3                  IOMUX_PAD(0x364, 0x03C, 5, 0x7B4, 0, NO_PAD_CTRL)
+#define MX53_PAD_KEY_COL3__FEC_CRS                     IOMUX_PAD(0x364, 0x03C, 6, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_KEY_COL3__USBPHY1_SIECLOCK            IOMUX_PAD(0x364, 0x03C, 7, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_KEY_ROW3__KPP_ROW_3                   IOMUX_PAD(0x368, 0x040, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_KEY_ROW3__GPIO4_13                    IOMUX_PAD(0x368, 0x040, 1, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_KEY_ROW3__USBOH3_H2_DM                        IOMUX_PAD(0x368, 0x040, 2, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_KEY_ROW3__CCM_ASRC_EXT_CLK            IOMUX_PAD(0x368, 0x040, 3, 0x768, 0, NO_PAD_CTRL)
+#define MX53_PAD_KEY_ROW3__I2C2_SDA                    IOMUX_PAD(0x368, 0x040, 4 | IOMUX_CONFIG_SION, 0x820, 0, NO_PAD_CTRL)
+#define MX53_PAD_KEY_ROW3__OSC32K_32K_OUT              IOMUX_PAD(0x368, 0x040, 5, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_KEY_ROW3__CCM_PLL4_BYP                        IOMUX_PAD(0x368, 0x040, 6, 0x77C, 0, NO_PAD_CTRL)
+#define MX53_PAD_KEY_ROW3__USBPHY1_LINESTATE_0         IOMUX_PAD(0x368, 0x040, 7, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_KEY_COL4__KPP_COL_4                   IOMUX_PAD(0x36C, 0x044, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_KEY_COL4__GPIO4_14                    IOMUX_PAD(0x36C, 0x044, 1, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_KEY_COL4__CAN2_TXCAN                  IOMUX_PAD(0x36C, 0x044, 2, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_KEY_COL4__IPU_SISG_4                  IOMUX_PAD(0x36C, 0x044, 3, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_KEY_COL4__UART5_RTS                   IOMUX_PAD(0x36C, 0x044, 4, 0x894, 0, MX53_UART_PAD_CTRL)
+#define MX53_PAD_KEY_COL4__USBOH3_USBOTG_OC            IOMUX_PAD(0x36C, 0x044, 5, 0x89C, 0, NO_PAD_CTRL)
+#define MX53_PAD_KEY_COL4__USBPHY1_LINESTATE_1         IOMUX_PAD(0x36C, 0x044, 7, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_KEY_ROW4__KPP_ROW_4                   IOMUX_PAD(0x370, 0x048, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_KEY_ROW4__GPIO4_15                    IOMUX_PAD(0x370, 0x048, 1, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_KEY_ROW4__CAN2_RXCAN                  IOMUX_PAD(0x370, 0x048, 2, 0x764, 0, NO_PAD_CTRL)
+#define MX53_PAD_KEY_ROW4__IPU_SISG_5                  IOMUX_PAD(0x370, 0x048, 3, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_KEY_ROW4__UART5_CTS                   IOMUX_PAD(0x370, 0x048, 4, __NA_, 0, MX53_UART_PAD_CTRL)
+#define MX53_PAD_KEY_ROW4__USBOH3_USBOTG_PWR           IOMUX_PAD(0x370, 0x048, 5, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_KEY_ROW4__USBPHY1_VBUSVALID           IOMUX_PAD(0x370, 0x048, 7, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_DI0_DISP_CLK__IPU_DI0_DISP_CLK                IOMUX_PAD(0x378, 0x04C, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_DI0_DISP_CLK__GPIO4_16                        IOMUX_PAD(0x378, 0x04C, 1, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_DI0_DISP_CLK__USBOH3_USBH2_DIR                IOMUX_PAD(0x378, 0x04C, 2, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_DI0_DISP_CLK__SDMA_DEBUG_CORE_STATE_0 IOMUX_PAD(0x378, 0x04C, 5, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_DI0_DISP_CLK__EMI_EMI_DEBUG_0         IOMUX_PAD(0x378, 0x04C, 6, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_DI0_DISP_CLK__USBPHY1_AVALID          IOMUX_PAD(0x378, 0x04C, 7, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_DI0_PIN15__IPU_DI0_PIN15              IOMUX_PAD(0x37C, 0x050, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_DI0_PIN15__GPIO4_17                   IOMUX_PAD(0x37C, 0x050, 1, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_DI0_PIN15__AUDMUX_AUD6_TXC            IOMUX_PAD(0x37C, 0x050, 2, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_DI0_PIN15__SDMA_DEBUG_CORE_STATE_1    IOMUX_PAD(0x37C, 0x050, 5, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_DI0_PIN15__EMI_EMI_DEBUG_1            IOMUX_PAD(0x37C, 0x050, 6, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_DI0_PIN15__USBPHY1_BVALID             IOMUX_PAD(0x37C, 0x050, 7, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_DI0_PIN2__IPU_DI0_PIN2                        IOMUX_PAD(0x380, 0x054, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_DI0_PIN2__GPIO4_18                    IOMUX_PAD(0x380, 0x054, 1, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_DI0_PIN2__AUDMUX_AUD6_TXD             IOMUX_PAD(0x380, 0x054, 2, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_DI0_PIN2__SDMA_DEBUG_CORE_STATE_2     IOMUX_PAD(0x380, 0x054, 5, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_DI0_PIN2__EMI_EMI_DEBUG_2             IOMUX_PAD(0x380, 0x054, 6, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_DI0_PIN2__USBPHY1_ENDSESSION          IOMUX_PAD(0x380, 0x054, 7, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_DI0_PIN3__IPU_DI0_PIN3                        IOMUX_PAD(0x384, 0x058, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_DI0_PIN3__GPIO4_19                    IOMUX_PAD(0x384, 0x058, 1, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_DI0_PIN3__AUDMUX_AUD6_TXFS            IOMUX_PAD(0x384, 0x058, 2, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_DI0_PIN3__SDMA_DEBUG_CORE_STATE_3     IOMUX_PAD(0x384, 0x058, 5, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_DI0_PIN3__EMI_EMI_DEBUG_3             IOMUX_PAD(0x384, 0x058, 6, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_DI0_PIN3__USBPHY1_IDDIG               IOMUX_PAD(0x384, 0x058, 7, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_DI0_PIN4__IPU_DI0_PIN4                        IOMUX_PAD(0x388, 0x05C, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_DI0_PIN4__GPIO4_20                    IOMUX_PAD(0x388, 0x05C, 1, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_DI0_PIN4__AUDMUX_AUD6_RXD             IOMUX_PAD(0x388, 0x05C, 2, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_DI0_PIN4__ESDHC1_WP                   IOMUX_PAD(0x388, 0x05C, 3, 0x7FC, 0, NO_PAD_CTRL)
+#define MX53_PAD_DI0_PIN4__SDMA_DEBUG_YIELD            IOMUX_PAD(0x388, 0x05C, 5, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_DI0_PIN4__EMI_EMI_DEBUG_4             IOMUX_PAD(0x388, 0x05C, 6, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_DI0_PIN4__USBPHY1_HOSTDISCONNECT      IOMUX_PAD(0x388, 0x05C, 7, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_DISP0_DAT0__IPU_DISP0_DAT_0           IOMUX_PAD(0x38C, 0x060, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_DISP0_DAT0__GPIO4_21                  IOMUX_PAD(0x38C, 0x060, 1, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_DISP0_DAT0__CSPI_SCLK                 IOMUX_PAD(0x38C, 0x060, 2, 0x780, 0, NO_PAD_CTRL)
+#define MX53_PAD_DISP0_DAT0__USBOH3_USBH2_DATA_0       IOMUX_PAD(0x38C, 0x060, 3, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_DISP0_DAT0__SDMA_DEBUG_CORE_RUN       IOMUX_PAD(0x38C, 0x060, 5, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_DISP0_DAT0__EMI_EMI_DEBUG_5           IOMUX_PAD(0x38C, 0x060, 6, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_DISP0_DAT0__USBPHY2_TXREADY           IOMUX_PAD(0x38C, 0x060, 7, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_DISP0_DAT1__IPU_DISP0_DAT_1           IOMUX_PAD(0x390, 0x064, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_DISP0_DAT1__GPIO4_22                  IOMUX_PAD(0x390, 0x064, 1, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_DISP0_DAT1__CSPI_MOSI                 IOMUX_PAD(0x390, 0x064, 2, 0x788, 0, NO_PAD_CTRL)
+#define MX53_PAD_DISP0_DAT1__USBOH3_USBH2_DATA_1       IOMUX_PAD(0x390, 0x064, 3, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_DISP0_DAT1__SDMA_DEBUG_EVENT_CHANNEL_SEL      \
+                                                       IOMUX_PAD(0x390, 0x064, 5, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_DISP0_DAT1__EMI_EMI_DEBUG_6           IOMUX_PAD(0x390, 0x064, 6, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_DISP0_DAT1__USBPHY2_RXVALID           IOMUX_PAD(0x390, 0x064, 7, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_DISP0_DAT2__IPU_DISP0_DAT_2           IOMUX_PAD(0x394, 0x068, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_DISP0_DAT2__GPIO4_23                  IOMUX_PAD(0x394, 0x068, 1, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_DISP0_DAT2__CSPI_MISO                 IOMUX_PAD(0x394, 0x068, 2, 0x784, 0, NO_PAD_CTRL)
+#define MX53_PAD_DISP0_DAT2__USBOH3_USBH2_DATA_2       IOMUX_PAD(0x394, 0x068, 3, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_DISP0_DAT2__SDMA_DEBUG_MODE           IOMUX_PAD(0x394, 0x068, 5, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_DISP0_DAT2__EMI_EMI_DEBUG_7           IOMUX_PAD(0x394, 0x068, 6, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_DISP0_DAT2__USBPHY2_RXACTIVE          IOMUX_PAD(0x394, 0x068, 7, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_DISP0_DAT3__IPU_DISP0_DAT_3           IOMUX_PAD(0x398, 0x06C, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_DISP0_DAT3__GPIO4_24                  IOMUX_PAD(0x398, 0x06C, 1, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_DISP0_DAT3__CSPI_SS0                  IOMUX_PAD(0x398, 0x06C, 2, 0x78C, 0, NO_PAD_CTRL)
+#define MX53_PAD_DISP0_DAT3__USBOH3_USBH2_DATA_3       IOMUX_PAD(0x398, 0x06C, 3, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_DISP0_DAT3__SDMA_DEBUG_BUS_ERROR      IOMUX_PAD(0x398, 0x06C, 5, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_DISP0_DAT3__EMI_EMI_DEBUG_8           IOMUX_PAD(0x398, 0x06C, 6, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_DISP0_DAT3__USBPHY2_RXERROR           IOMUX_PAD(0x398, 0x06C, 7, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_DISP0_DAT4__IPU_DISP0_DAT_4           IOMUX_PAD(0x39C, 0x070, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_DISP0_DAT4__GPIO4_25                  IOMUX_PAD(0x39C, 0x070, 1, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_DISP0_DAT4__CSPI_SS1                  IOMUX_PAD(0x39C, 0x070, 2, 0x790, 0, NO_PAD_CTRL)
+#define MX53_PAD_DISP0_DAT4__USBOH3_USBH2_DATA_4       IOMUX_PAD(0x39C, 0x070, 3, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_DISP0_DAT4__SDMA_DEBUG_BUS_RWB                IOMUX_PAD(0x39C, 0x070, 5, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_DISP0_DAT4__EMI_EMI_DEBUG_9           IOMUX_PAD(0x39C, 0x070, 6, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_DISP0_DAT4__USBPHY2_SIECLOCK          IOMUX_PAD(0x39C, 0x070, 7, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_DISP0_DAT5__IPU_DISP0_DAT_5           IOMUX_PAD(0x3A0, 0x074, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_DISP0_DAT5__GPIO4_26                  IOMUX_PAD(0x3A0, 0x074, 1, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_DISP0_DAT5__CSPI_SS2                  IOMUX_PAD(0x3A0, 0x074, 2, 0x794, 0, NO_PAD_CTRL)
+#define MX53_PAD_DISP0_DAT5__USBOH3_USBH2_DATA_5       IOMUX_PAD(0x3A0, 0x074, 3, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_DISP0_DAT5__SDMA_DEBUG_MATCHED_DMBUS  IOMUX_PAD(0x3A0, 0x074, 5, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_DISP0_DAT5__EMI_EMI_DEBUG_10          IOMUX_PAD(0x3A0, 0x074, 6, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_DISP0_DAT5__USBPHY2_LINESTATE_0       IOMUX_PAD(0x3A0, 0x074, 7, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_DISP0_DAT6__IPU_DISP0_DAT_6           IOMUX_PAD(0x3A4, 0x078, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_DISP0_DAT6__GPIO4_27                  IOMUX_PAD(0x3A4, 0x078, 1, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_DISP0_DAT6__CSPI_SS3                  IOMUX_PAD(0x3A4, 0x078, 2, 0x798, 0, NO_PAD_CTRL)
+#define MX53_PAD_DISP0_DAT6__USBOH3_USBH2_DATA_6       IOMUX_PAD(0x3A4, 0x078, 3, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_DISP0_DAT6__SDMA_DEBUG_RTBUFFER_WRITE IOMUX_PAD(0x3A4, 0x078, 5, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_DISP0_DAT6__EMI_EMI_DEBUG_11          IOMUX_PAD(0x3A4, 0x078, 6, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_DISP0_DAT6__USBPHY2_LINESTATE_1       IOMUX_PAD(0x3A4, 0x078, 7, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_DISP0_DAT7__IPU_DISP0_DAT_7           IOMUX_PAD(0x3A8, 0x07C, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_DISP0_DAT7__GPIO4_28                  IOMUX_PAD(0x3A8, 0x07C, 1, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_DISP0_DAT7__CSPI_RDY                  IOMUX_PAD(0x3A8, 0x07C, 2, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_DISP0_DAT7__USBOH3_USBH2_DATA_7       IOMUX_PAD(0x3A8, 0x07C, 3, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_DISP0_DAT7__SDMA_DEBUG_EVENT_CHANNEL_0        IOMUX_PAD(0x3A8, 0x07C, 5, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_DISP0_DAT7__EMI_EMI_DEBUG_12          IOMUX_PAD(0x3A8, 0x07C, 6, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_DISP0_DAT7__USBPHY2_VBUSVALID         IOMUX_PAD(0x3A8, 0x07C, 7, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_DISP0_DAT8__IPU_DISP0_DAT_8           IOMUX_PAD(0x3AC, 0x080, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_DISP0_DAT8__GPIO4_29                  IOMUX_PAD(0x3AC, 0x080, 1, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_DISP0_DAT8__PWM1_PWMO                 IOMUX_PAD(0x3AC, 0x080, 2, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_DISP0_DAT8__WDOG1_WDOG_B              IOMUX_PAD(0x3AC, 0x080, 3, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_DISP0_DAT8__SDMA_DEBUG_EVENT_CHANNEL_1        IOMUX_PAD(0x3AC, 0x080, 5, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_DISP0_DAT8__EMI_EMI_DEBUG_13          IOMUX_PAD(0x3AC, 0x080, 6, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_DISP0_DAT8__USBPHY2_AVALID            IOMUX_PAD(0x3AC, 0x080, 7, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_DISP0_DAT9__IPU_DISP0_DAT_9           IOMUX_PAD(0x3B0, 0x084, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_DISP0_DAT9__GPIO4_30                  IOMUX_PAD(0x3B0, 0x084, 1, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_DISP0_DAT9__PWM2_PWMO                 IOMUX_PAD(0x3B0, 0x084, 2, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_DISP0_DAT9__WDOG2_WDOG_B              IOMUX_PAD(0x3B0, 0x084, 3, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_DISP0_DAT9__SDMA_DEBUG_EVENT_CHANNEL_2        IOMUX_PAD(0x3B0, 0x084, 5, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_DISP0_DAT9__EMI_EMI_DEBUG_14          IOMUX_PAD(0x3B0, 0x084, 6, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_DISP0_DAT9__USBPHY2_VSTATUS_0         IOMUX_PAD(0x3B0, 0x084, 7, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_DISP0_DAT10__IPU_DISP0_DAT_10         IOMUX_PAD(0x3B4, 0x088, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_DISP0_DAT10__GPIO4_31                 IOMUX_PAD(0x3B4, 0x088, 1, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_DISP0_DAT10__USBOH3_USBH2_STP         IOMUX_PAD(0x3B4, 0x088, 2, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_DISP0_DAT10__SDMA_DEBUG_EVENT_CHANNEL_3       \
+                                                       IOMUX_PAD(0x3B4, 0x088, 5, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_DISP0_DAT10__EMI_EMI_DEBUG_15         IOMUX_PAD(0x3B4, 0x088, 6, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_DISP0_DAT10__USBPHY2_VSTATUS_1                IOMUX_PAD(0x3B4, 0x088, 7, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_DISP0_DAT11__IPU_DISP0_DAT_11         IOMUX_PAD(0x3B8, 0x08C, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_DISP0_DAT11__GPIO5_5                  IOMUX_PAD(0x3B8, 0x08C, 1, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_DISP0_DAT11__USBOH3_USBH2_NXT         IOMUX_PAD(0x3B8, 0x08C, 2, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_DISP0_DAT11__SDMA_DEBUG_EVENT_CHANNEL_4       \
+                                                       IOMUX_PAD(0x3B8, 0x08C, 5, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_DISP0_DAT11__EMI_EMI_DEBUG_16         IOMUX_PAD(0x3B8, 0x08C, 6, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_DISP0_DAT11__USBPHY2_VSTATUS_2                IOMUX_PAD(0x3B8, 0x08C, 7, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_DISP0_DAT12__IPU_DISP0_DAT_12         IOMUX_PAD(0x3BC, 0x090, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_DISP0_DAT12__GPIO5_6                  IOMUX_PAD(0x3BC, 0x090, 1, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_DISP0_DAT12__USBOH3_USBH2_CLK         IOMUX_PAD(0x3BC, 0x090, 2, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_DISP0_DAT12__SDMA_DEBUG_EVENT_CHANNEL_5       \
+                                                       IOMUX_PAD(0x3BC, 0x090, 5, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_DISP0_DAT12__EMI_EMI_DEBUG_17         IOMUX_PAD(0x3BC, 0x090, 6, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_DISP0_DAT12__USBPHY2_VSTATUS_3                IOMUX_PAD(0x3BC, 0x090, 7, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_DISP0_DAT13__IPU_DISP0_DAT_13         IOMUX_PAD(0x3C0, 0x094, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_DISP0_DAT13__GPIO5_7                  IOMUX_PAD(0x3C0, 0x094, 1, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_DISP0_DAT13__AUDMUX_AUD5_RXFS         IOMUX_PAD(0x3C0, 0x094, 3, 0x754, 0, NO_PAD_CTRL)
+#define MX53_PAD_DISP0_DAT13__SDMA_DEBUG_EVT_CHN_LINES_0       \
+                                                       IOMUX_PAD(0x3C0, 0x094, 5, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_DISP0_DAT13__EMI_EMI_DEBUG_18         IOMUX_PAD(0x3C0, 0x094, 6, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_DISP0_DAT13__USBPHY2_VSTATUS_4                IOMUX_PAD(0x3C0, 0x094, 7, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_DISP0_DAT14__IPU_DISP0_DAT_14         IOMUX_PAD(0x3C4, 0x098, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_DISP0_DAT14__GPIO5_8                  IOMUX_PAD(0x3C4, 0x098, 1, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_DISP0_DAT14__AUDMUX_AUD5_RXC          IOMUX_PAD(0x3C4, 0x098, 3, 0x750, 0, NO_PAD_CTRL)
+#define MX53_PAD_DISP0_DAT14__SDMA_DEBUG_EVT_CHN_LINES_1       \
+                                                       IOMUX_PAD(0x3C4, 0x098, 5, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_DISP0_DAT14__EMI_EMI_DEBUG_19         IOMUX_PAD(0x3C4, 0x098, 6, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_DISP0_DAT14__USBPHY2_VSTATUS_5                IOMUX_PAD(0x3C4, 0x098, 7, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_DISP0_DAT15__IPU_DISP0_DAT_15         IOMUX_PAD(0x3C8, 0x09C, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_DISP0_DAT15__GPIO5_9                  IOMUX_PAD(0x3C8, 0x09C, 1, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_DISP0_DAT15__ECSPI1_SS1               IOMUX_PAD(0x3C8, 0x09C, 2, 0x7AC, 1, NO_PAD_CTRL)
+#define MX53_PAD_DISP0_DAT15__ECSPI2_SS1               IOMUX_PAD(0x3C8, 0x09C, 3, 0x7C8, 0, NO_PAD_CTRL)
+#define MX53_PAD_DISP0_DAT15__SDMA_DEBUG_EVT_CHN_LINES_2       \
+                                                       IOMUX_PAD(0x3C8, 0x09C, 5, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_DISP0_DAT15__EMI_EMI_DEBUG_20         IOMUX_PAD(0x3C8, 0x09C, 6, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_DISP0_DAT15__USBPHY2_VSTATUS_6                IOMUX_PAD(0x3C8, 0x09C, 7, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_DISP0_DAT16__IPU_DISP0_DAT_16         IOMUX_PAD(0x3CC, 0x0A0, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_DISP0_DAT16__GPIO5_10                 IOMUX_PAD(0x3CC, 0x0A0, 1, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_DISP0_DAT16__ECSPI2_MOSI              IOMUX_PAD(0x3CC, 0x0A0, 2, 0x7C0, 0, NO_PAD_CTRL)
+#define MX53_PAD_DISP0_DAT16__AUDMUX_AUD5_TXC          IOMUX_PAD(0x3CC, 0x0A0, 3, 0x758, 1, NO_PAD_CTRL)
+#define MX53_PAD_DISP0_DAT16__SDMA_EXT_EVENT_0         IOMUX_PAD(0x3CC, 0x0A0, 4, 0x868, 0, NO_PAD_CTRL)
+#define MX53_PAD_DISP0_DAT16__SDMA_DEBUG_EVT_CHN_LINES_3       \
+                                                       IOMUX_PAD(0x3CC, 0x0A0, 5, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_DISP0_DAT16__EMI_EMI_DEBUG_21         IOMUX_PAD(0x3CC, 0x0A0, 6, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_DISP0_DAT16__USBPHY2_VSTATUS_7                IOMUX_PAD(0x3CC, 0x0A0, 7, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_DISP0_DAT17__IPU_DISP0_DAT_17         IOMUX_PAD(0x3D0, 0x0A4, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_DISP0_DAT17__GPIO5_11                 IOMUX_PAD(0x3D0, 0x0A4, 1, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_DISP0_DAT17__ECSPI2_MISO              IOMUX_PAD(0x3D0, 0x0A4, 2, 0x7BC, 0, NO_PAD_CTRL)
+#define MX53_PAD_DISP0_DAT17__AUDMUX_AUD5_TXD          IOMUX_PAD(0x3D0, 0x0A4, 3, 0x74C, 1, NO_PAD_CTRL)
+#define MX53_PAD_DISP0_DAT17__SDMA_EXT_EVENT_1         IOMUX_PAD(0x3D0, 0x0A4, 4, 0x86C, 0, NO_PAD_CTRL)
+#define MX53_PAD_DISP0_DAT17__SDMA_DEBUG_EVT_CHN_LINES_4       \
+                                                       IOMUX_PAD(0x3D0, 0x0A4, 5, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_DISP0_DAT17__EMI_EMI_DEBUG_22         IOMUX_PAD(0x3D0, 0x0A4, 6, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_DISP0_DAT18__IPU_DISP0_DAT_18         IOMUX_PAD(0x3D4, 0x0A8, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_DISP0_DAT18__GPIO5_12                 IOMUX_PAD(0x3D4, 0x0A8, 1, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_DISP0_DAT18__ECSPI2_SS0               IOMUX_PAD(0x3D4, 0x0A8, 2, 0x7C4, 0, NO_PAD_CTRL)
+#define MX53_PAD_DISP0_DAT18__AUDMUX_AUD5_TXFS         IOMUX_PAD(0x3D4, 0x0A8, 3, 0x75C, 1, NO_PAD_CTRL)
+#define MX53_PAD_DISP0_DAT18__AUDMUX_AUD4_RXFS         IOMUX_PAD(0x3D4, 0x0A8, 4, 0x73C, 0, NO_PAD_CTRL)
+#define MX53_PAD_DISP0_DAT18__SDMA_DEBUG_EVT_CHN_LINES_5       \
+                                                       IOMUX_PAD(0x3D4, 0x0A8, 5, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_DISP0_DAT18__EMI_EMI_DEBUG_23         IOMUX_PAD(0x3D4, 0x0A8, 6, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_DISP0_DAT18__EMI_WEIM_CS_2            IOMUX_PAD(0x3D4, 0x0A8, 7, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_DISP0_DAT19__IPU_DISP0_DAT_19         IOMUX_PAD(0x3D8, 0x0AC, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_DISP0_DAT19__GPIO5_13                 IOMUX_PAD(0x3D8, 0x0AC, 1, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_DISP0_DAT19__ECSPI2_SCLK              IOMUX_PAD(0x3D8, 0x0AC, 2, 0x7B8, 0, NO_PAD_CTRL)
+#define MX53_PAD_DISP0_DAT19__AUDMUX_AUD5_RXD          IOMUX_PAD(0x3D8, 0x0AC, 3, 0x748, 1, NO_PAD_CTRL)
+#define MX53_PAD_DISP0_DAT19__AUDMUX_AUD4_RXC          IOMUX_PAD(0x3D8, 0x0AC, 4, 0x738, 0, NO_PAD_CTRL)
+#define MX53_PAD_DISP0_DAT19__SDMA_DEBUG_EVT_CHN_LINES_6       \
+                                                       IOMUX_PAD(0x3D8, 0x0AC, 5, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_DISP0_DAT19__EMI_EMI_DEBUG_24         IOMUX_PAD(0x3D8, 0x0AC, 6, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_DISP0_DAT19__EMI_WEIM_CS_3            IOMUX_PAD(0x3D8, 0x0AC, 7, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_DISP0_DAT20__IPU_DISP0_DAT_20         IOMUX_PAD(0x3DC, 0x0B0, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_DISP0_DAT20__GPIO5_14                 IOMUX_PAD(0x3DC, 0x0B0, 1, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_DISP0_DAT20__ECSPI1_SCLK              IOMUX_PAD(0x3DC, 0x0B0, 2, 0x79C, 1, NO_PAD_CTRL)
+#define MX53_PAD_DISP0_DAT20__AUDMUX_AUD4_TXC          IOMUX_PAD(0x3DC, 0x0B0, 3, 0x740, 0, NO_PAD_CTRL)
+#define MX53_PAD_DISP0_DAT20__SDMA_DEBUG_EVT_CHN_LINES_7       \
+                                                       IOMUX_PAD(0x3DC, 0x0B0, 5, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_DISP0_DAT20__EMI_EMI_DEBUG_25         IOMUX_PAD(0x3DC, 0x0B0, 6, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_DISP0_DAT20__SATA_PHY_TDI             IOMUX_PAD(0x3DC, 0x0B0, 7, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_DISP0_DAT21__IPU_DISP0_DAT_21         IOMUX_PAD(0x3E0, 0x0B4, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_DISP0_DAT21__GPIO5_15                 IOMUX_PAD(0x3E0, 0x0B4, 1, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_DISP0_DAT21__ECSPI1_MOSI              IOMUX_PAD(0x3E0, 0x0B4, 2, 0x7A4, 1, NO_PAD_CTRL)
+#define MX53_PAD_DISP0_DAT21__AUDMUX_AUD4_TXD          IOMUX_PAD(0x3E0, 0x0B4, 3, 0x734, 0, NO_PAD_CTRL)
+#define MX53_PAD_DISP0_DAT21__SDMA_DEBUG_BUS_DEVICE_0  IOMUX_PAD(0x3E0, 0x0B4, 5, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_DISP0_DAT21__EMI_EMI_DEBUG_26         IOMUX_PAD(0x3E0, 0x0B4, 6, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_DISP0_DAT21__SATA_PHY_TDO             IOMUX_PAD(0x3E0, 0x0B4, 7, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_DISP0_DAT22__IPU_DISP0_DAT_22         IOMUX_PAD(0x3E4, 0x0B8, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_DISP0_DAT22__GPIO5_16                 IOMUX_PAD(0x3E4, 0x0B8, 1, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_DISP0_DAT22__ECSPI1_MISO              IOMUX_PAD(0x3E4, 0x0B8, 2, 0x7A0, 1, NO_PAD_CTRL)
+#define MX53_PAD_DISP0_DAT22__AUDMUX_AUD4_TXFS         IOMUX_PAD(0x3E4, 0x0B8, 3, 0x744, 0, NO_PAD_CTRL)
+#define MX53_PAD_DISP0_DAT22__SDMA_DEBUG_BUS_DEVICE_1  IOMUX_PAD(0x3E4, 0x0B8, 5, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_DISP0_DAT22__EMI_EMI_DEBUG_27         IOMUX_PAD(0x3E4, 0x0B8, 6, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_DISP0_DAT22__SATA_PHY_TCK             IOMUX_PAD(0x3E4, 0x0B8, 7, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_DISP0_DAT23__IPU_DISP0_DAT_23         IOMUX_PAD(0x3E8, 0x0BC, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_DISP0_DAT23__GPIO5_17                 IOMUX_PAD(0x3E8, 0x0BC, 1, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_DISP0_DAT23__ECSPI1_SS0               IOMUX_PAD(0x3E8, 0x0BC, 2, 0x7A8, 1, NO_PAD_CTRL)
+#define MX53_PAD_DISP0_DAT23__AUDMUX_AUD4_RXD          IOMUX_PAD(0x3E8, 0x0BC, 3, 0x730, 0, NO_PAD_CTRL)
+#define MX53_PAD_DISP0_DAT23__SDMA_DEBUG_BUS_DEVICE_2  IOMUX_PAD(0x3E8, 0x0BC, 5, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_DISP0_DAT23__EMI_EMI_DEBUG_28         IOMUX_PAD(0x3E8, 0x0BC, 6, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_DISP0_DAT23__SATA_PHY_TMS             IOMUX_PAD(0x3E8, 0x0BC, 7, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_CSI0_PIXCLK__IPU_CSI0_PIXCLK          IOMUX_PAD(0x3EC, 0x0C0, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_CSI0_PIXCLK__GPIO5_18                 IOMUX_PAD(0x3EC, 0x0C0, 1, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_CSI0_PIXCLK__SDMA_DEBUG_PC_0          IOMUX_PAD(0x3EC, 0x0C0, 5, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_CSI0_PIXCLK__EMI_EMI_DEBUG_29         IOMUX_PAD(0x3EC, 0x0C0, 6, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_CSI0_MCLK__IPU_CSI0_HSYNC             IOMUX_PAD(0x3F0, 0x0C4, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_CSI0_MCLK__GPIO5_19                   IOMUX_PAD(0x3F0, 0x0C4, 1, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_CSI0_MCLK__CCM_CSI0_MCLK              IOMUX_PAD(0x3F0, 0x0C4, 2, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_CSI0_MCLK__SDMA_DEBUG_PC_1            IOMUX_PAD(0x3F0, 0x0C4, 5, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_CSI0_MCLK__EMI_EMI_DEBUG_30           IOMUX_PAD(0x3F0, 0x0C4, 6, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_CSI0_MCLK__TPIU_TRCTL                 IOMUX_PAD(0x3F0, 0x0C4, 7, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_CSI0_DATA_EN__IPU_CSI0_DATA_EN                IOMUX_PAD(0x3F4, 0x0C8, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_CSI0_DATA_EN__GPIO5_20                        IOMUX_PAD(0x3F4, 0x0C8, 1, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_CSI0_DATA_EN__SDMA_DEBUG_PC_2         IOMUX_PAD(0x3F4, 0x0C8, 5, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_CSI0_DATA_EN__EMI_EMI_DEBUG_31                IOMUX_PAD(0x3F4, 0x0C8, 6, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_CSI0_DATA_EN__TPIU_TRCLK              IOMUX_PAD(0x3F4, 0x0C8, 7, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_CSI0_VSYNC__IPU_CSI0_VSYNC            IOMUX_PAD(0x3F8, 0x0CC, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_CSI0_VSYNC__GPIO5_21                  IOMUX_PAD(0x3F8, 0x0CC, 1, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_CSI0_VSYNC__SDMA_DEBUG_PC_3           IOMUX_PAD(0x3F8, 0x0CC, 5, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_CSI0_VSYNC__EMI_EMI_DEBUG_32          IOMUX_PAD(0x3F8, 0x0CC, 6, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_CSI0_VSYNC__TPIU_TRACE_0              IOMUX_PAD(0x3F8, 0x0CC, 7, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_CSI0_DAT4__IPU_CSI0_D_4               IOMUX_PAD(0x3FC, 0x0D0, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_CSI0_DAT4__GPIO5_22                   IOMUX_PAD(0x3FC, 0x0D0, 1, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_CSI0_DAT4__KPP_COL_5                  IOMUX_PAD(0x3FC, 0x0D0, 2, 0x840, 1, NO_PAD_CTRL)
+#define MX53_PAD_CSI0_DAT4__ECSPI1_SCLK                        IOMUX_PAD(0x3FC, 0x0D0, 3, 0x79C, 2, NO_PAD_CTRL)
+#define MX53_PAD_CSI0_DAT4__USBOH3_USBH3_STP           IOMUX_PAD(0x3FC, 0x0D0, 4, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_CSI0_DAT4__AUDMUX_AUD3_TXC            IOMUX_PAD(0x3FC, 0x0D0, 5, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_CSI0_DAT4__EMI_EMI_DEBUG_33           IOMUX_PAD(0x3FC, 0x0D0, 6, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_CSI0_DAT4__TPIU_TRACE_1               IOMUX_PAD(0x3FC, 0x0D0, 7, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_CSI0_DAT5__IPU_CSI0_D_5               IOMUX_PAD(0x400, 0x0D4, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_CSI0_DAT5__GPIO5_23                   IOMUX_PAD(0x400, 0x0D4, 1, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_CSI0_DAT5__KPP_ROW_5                  IOMUX_PAD(0x400, 0x0D4, 2, 0x84C, 0, NO_PAD_CTRL)
+#define MX53_PAD_CSI0_DAT5__ECSPI1_MOSI                        IOMUX_PAD(0x400, 0x0D4, 3, 0x7A4, 2, NO_PAD_CTRL)
+#define MX53_PAD_CSI0_DAT5__USBOH3_USBH3_NXT           IOMUX_PAD(0x400, 0x0D4, 4, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_CSI0_DAT5__AUDMUX_AUD3_TXD            IOMUX_PAD(0x400, 0x0D4, 5, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_CSI0_DAT5__EMI_EMI_DEBUG_34           IOMUX_PAD(0x400, 0x0D4, 6, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_CSI0_DAT5__TPIU_TRACE_2               IOMUX_PAD(0x400, 0x0D4, 7, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_CSI0_DAT6__IPU_CSI0_D_6               IOMUX_PAD(0x404, 0x0D8, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_CSI0_DAT6__GPIO5_24                   IOMUX_PAD(0x404, 0x0D8, 1, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_CSI0_DAT6__KPP_COL_6                  IOMUX_PAD(0x404, 0x0D8, 2, 0x844, 0, NO_PAD_CTRL)
+#define MX53_PAD_CSI0_DAT6__ECSPI1_MISO                        IOMUX_PAD(0x404, 0x0D8, 3, 0x7A0, 2, NO_PAD_CTRL)
+#define MX53_PAD_CSI0_DAT6__USBOH3_USBH3_CLK           IOMUX_PAD(0x404, 0x0D8, 4, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_CSI0_DAT6__AUDMUX_AUD3_TXFS           IOMUX_PAD(0x404, 0x0D8, 5, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_CSI0_DAT6__EMI_EMI_DEBUG_35           IOMUX_PAD(0x404, 0x0D8, 6, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_CSI0_DAT6__TPIU_TRACE_3               IOMUX_PAD(0x404, 0x0D8, 7, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_CSI0_DAT7__IPU_CSI0_D_7               IOMUX_PAD(0x408, 0x0DC, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_CSI0_DAT7__GPIO5_25                   IOMUX_PAD(0x408, 0x0DC, 1, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_CSI0_DAT7__KPP_ROW_6                  IOMUX_PAD(0x408, 0x0DC, 2, 0x850, 0, NO_PAD_CTRL)
+#define MX53_PAD_CSI0_DAT7__ECSPI1_SS0                 IOMUX_PAD(0x408, 0x0DC, 3, 0x7A8, 2, NO_PAD_CTRL)
+#define MX53_PAD_CSI0_DAT7__USBOH3_USBH3_DIR           IOMUX_PAD(0x408, 0x0DC, 4, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_CSI0_DAT7__AUDMUX_AUD3_RXD            IOMUX_PAD(0x408, 0x0DC, 5, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_CSI0_DAT7__EMI_EMI_DEBUG_36           IOMUX_PAD(0x408, 0x0DC, 6, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_CSI0_DAT7__TPIU_TRACE_4               IOMUX_PAD(0x408, 0x0DC, 7, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_CSI0_DAT8__IPU_CSI0_D_8               IOMUX_PAD(0x40C, 0x0E0, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_CSI0_DAT8__GPIO5_26                   IOMUX_PAD(0x40C, 0x0E0, 1, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_CSI0_DAT8__KPP_COL_7                  IOMUX_PAD(0x40C, 0x0E0, 2, 0x848, 0, NO_PAD_CTRL)
+#define MX53_PAD_CSI0_DAT8__ECSPI2_SCLK                        IOMUX_PAD(0x40C, 0x0E0, 3, 0x7B8, 1, NO_PAD_CTRL)
+#define MX53_PAD_CSI0_DAT8__USBOH3_USBH3_OC            IOMUX_PAD(0x40C, 0x0E0, 4, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_CSI0_DAT8__I2C1_SDA                   IOMUX_PAD(0x40C, 0x0E0, 5 | IOMUX_CONFIG_SION, 0x818, 0, NO_PAD_CTRL)
+#define MX53_PAD_CSI0_DAT8__EMI_EMI_DEBUG_37           IOMUX_PAD(0x40C, 0x0E0, 6, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_CSI0_DAT8__TPIU_TRACE_5               IOMUX_PAD(0x40C, 0x0E0, 7, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_CSI0_DAT9__IPU_CSI0_D_9               IOMUX_PAD(0x410, 0x0E4, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_CSI0_DAT9__GPIO5_27                   IOMUX_PAD(0x410, 0x0E4, 1, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_CSI0_DAT9__KPP_ROW_7                  IOMUX_PAD(0x410, 0x0E4, 2, 0x854, 0, NO_PAD_CTRL)
+#define MX53_PAD_CSI0_DAT9__ECSPI2_MOSI                        IOMUX_PAD(0x410, 0x0E4, 3, 0x7C0, 1, NO_PAD_CTRL)
+#define MX53_PAD_CSI0_DAT9__USBOH3_USBH3_PWR           IOMUX_PAD(0x410, 0x0E4, 4, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_CSI0_DAT9__I2C1_SCL                   IOMUX_PAD(0x410, 0x0E4, 5 | IOMUX_CONFIG_SION, 0x814, 0, NO_PAD_CTRL)
+#define MX53_PAD_CSI0_DAT9__EMI_EMI_DEBUG_38           IOMUX_PAD(0x410, 0x0E4, 6, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_CSI0_DAT9__TPIU_TRACE_6               IOMUX_PAD(0x410, 0x0E4, 7, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_CSI0_DAT10__IPU_CSI0_D_10             IOMUX_PAD(0x414, 0x0E8, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_CSI0_DAT10__GPIO5_28                  IOMUX_PAD(0x414, 0x0E8, 1, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_CSI0_DAT10__UART1_TXD_MUX             IOMUX_PAD(0x414, 0x0E8, 2, __NA_, 0, MX53_UART_PAD_CTRL)
+#define MX53_PAD_CSI0_DAT10__ECSPI2_MISO               IOMUX_PAD(0x414, 0x0E8, 3, 0x7BC, 1, NO_PAD_CTRL)
+#define MX53_PAD_CSI0_DAT10__AUDMUX_AUD3_RXC           IOMUX_PAD(0x414, 0x0E8, 4, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_CSI0_DAT10__SDMA_DEBUG_PC_4           IOMUX_PAD(0x414, 0x0E8, 5, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_CSI0_DAT10__EMI_EMI_DEBUG_39          IOMUX_PAD(0x414, 0x0E8, 6, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_CSI0_DAT10__TPIU_TRACE_7              IOMUX_PAD(0x414, 0x0E8, 7, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_CSI0_DAT11__IPU_CSI0_D_11             IOMUX_PAD(0x418, 0x0EC, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_CSI0_DAT11__GPIO5_29                  IOMUX_PAD(0x418, 0x0EC, 1, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_CSI0_DAT11__UART1_RXD_MUX             IOMUX_PAD(0x418, 0x0EC, 2, 0x878, 1, MX53_UART_PAD_CTRL)
+#define MX53_PAD_CSI0_DAT11__ECSPI2_SS0                        IOMUX_PAD(0x418, 0x0EC, 3, 0x7C4, 1, NO_PAD_CTRL)
+#define MX53_PAD_CSI0_DAT11__AUDMUX_AUD3_RXFS          IOMUX_PAD(0x418, 0x0EC, 4, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_CSI0_DAT11__SDMA_DEBUG_PC_5           IOMUX_PAD(0x418, 0x0EC, 5, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_CSI0_DAT11__EMI_EMI_DEBUG_40          IOMUX_PAD(0x418, 0x0EC, 6, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_CSI0_DAT11__TPIU_TRACE_8              IOMUX_PAD(0x418, 0x0EC, 7, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_CSI0_DAT12__IPU_CSI0_D_12             IOMUX_PAD(0x41C, 0x0F0, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_CSI0_DAT12__GPIO5_30                  IOMUX_PAD(0x41C, 0x0F0, 1, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_CSI0_DAT12__UART4_TXD_MUX             IOMUX_PAD(0x41C, 0x0F0, 2, __NA_, 0, MX53_UART_PAD_CTRL)
+#define MX53_PAD_CSI0_DAT12__USBOH3_USBH3_DATA_0       IOMUX_PAD(0x41C, 0x0F0, 4, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_CSI0_DAT12__SDMA_DEBUG_PC_6           IOMUX_PAD(0x41C, 0x0F0, 5, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_CSI0_DAT12__EMI_EMI_DEBUG_41          IOMUX_PAD(0x41C, 0x0F0, 6, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_CSI0_DAT12__TPIU_TRACE_9              IOMUX_PAD(0x41C, 0x0F0, 7, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_CSI0_DAT13__IPU_CSI0_D_13             IOMUX_PAD(0x420, 0x0F4, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_CSI0_DAT13__GPIO5_31                  IOMUX_PAD(0x420, 0x0F4, 1, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_CSI0_DAT13__UART4_RXD_MUX             IOMUX_PAD(0x420, 0x0F4, 2, 0x890, 3, MX53_UART_PAD_CTRL)
+#define MX53_PAD_CSI0_DAT13__USBOH3_USBH3_DATA_1       IOMUX_PAD(0x420, 0x0F4, 4, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_CSI0_DAT13__SDMA_DEBUG_PC_7           IOMUX_PAD(0x420, 0x0F4, 5, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_CSI0_DAT13__EMI_EMI_DEBUG_42          IOMUX_PAD(0x420, 0x0F4, 6, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_CSI0_DAT13__TPIU_TRACE_10             IOMUX_PAD(0x420, 0x0F4, 7, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_CSI0_DAT14__IPU_CSI0_D_14             IOMUX_PAD(0x424, 0x0F8, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_CSI0_DAT14__GPIO6_0                   IOMUX_PAD(0x424, 0x0F8, 1, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_CSI0_DAT14__UART5_TXD_MUX             IOMUX_PAD(0x424, 0x0F8, 2, __NA_, 0, MX53_UART_PAD_CTRL)
+#define MX53_PAD_CSI0_DAT14__USBOH3_USBH3_DATA_2       IOMUX_PAD(0x424, 0x0F8, 4, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_CSI0_DAT14__SDMA_DEBUG_PC_8           IOMUX_PAD(0x424, 0x0F8, 5, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_CSI0_DAT14__EMI_EMI_DEBUG_43          IOMUX_PAD(0x424, 0x0F8, 6, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_CSI0_DAT14__TPIU_TRACE_11             IOMUX_PAD(0x424, 0x0F8, 7, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_CSI0_DAT15__IPU_CSI0_D_15             IOMUX_PAD(0x428, 0x0FC, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_CSI0_DAT15__GPIO6_1                   IOMUX_PAD(0x428, 0x0FC, 1, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_CSI0_DAT15__UART5_RXD_MUX             IOMUX_PAD(0x428, 0x0FC, 2, 0x898, 3, MX53_UART_PAD_CTRL)
+#define MX53_PAD_CSI0_DAT15__USBOH3_USBH3_DATA_3       IOMUX_PAD(0x428, 0x0FC, 4, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_CSI0_DAT15__SDMA_DEBUG_PC_9           IOMUX_PAD(0x428, 0x0FC, 5, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_CSI0_DAT15__EMI_EMI_DEBUG_44          IOMUX_PAD(0x428, 0x0FC, 6, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_CSI0_DAT15__TPIU_TRACE_12             IOMUX_PAD(0x428, 0x0FC, 7, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_CSI0_DAT16__IPU_CSI0_D_16             IOMUX_PAD(0x42C, 0x100, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_CSI0_DAT16__GPIO6_2                   IOMUX_PAD(0x42C, 0x100, 1, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_CSI0_DAT16__UART4_RTS                 IOMUX_PAD(0x42C, 0x100, 2, 0x88C, 0, MX53_UART_PAD_CTRL)
+#define MX53_PAD_CSI0_DAT16__USBOH3_USBH3_DATA_4       IOMUX_PAD(0x42C, 0x100, 4, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_CSI0_DAT16__SDMA_DEBUG_PC_10          IOMUX_PAD(0x42C, 0x100, 5, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_CSI0_DAT16__EMI_EMI_DEBUG_45          IOMUX_PAD(0x42C, 0x100, 6, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_CSI0_DAT16__TPIU_TRACE_13             IOMUX_PAD(0x42C, 0x100, 7, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_CSI0_DAT17__IPU_CSI0_D_17             IOMUX_PAD(0x430, 0x104, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_CSI0_DAT17__GPIO6_3                   IOMUX_PAD(0x430, 0x104, 1, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_CSI0_DAT17__UART4_CTS                 IOMUX_PAD(0x430, 0x104, 2, __NA_, 0, MX53_UART_PAD_CTRL)
+#define MX53_PAD_CSI0_DAT17__USBOH3_USBH3_DATA_5       IOMUX_PAD(0x430, 0x104, 4, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_CSI0_DAT17__SDMA_DEBUG_PC_11          IOMUX_PAD(0x430, 0x104, 5, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_CSI0_DAT17__EMI_EMI_DEBUG_46          IOMUX_PAD(0x430, 0x104, 6, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_CSI0_DAT17__TPIU_TRACE_14             IOMUX_PAD(0x430, 0x104, 7, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_CSI0_DAT18__IPU_CSI0_D_18             IOMUX_PAD(0x434, 0x108, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_CSI0_DAT18__GPIO6_4                   IOMUX_PAD(0x434, 0x108, 1, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_CSI0_DAT18__UART5_RTS                 IOMUX_PAD(0x434, 0x108, 2, 0x894, 2, MX53_UART_PAD_CTRL)
+#define MX53_PAD_CSI0_DAT18__USBOH3_USBH3_DATA_6       IOMUX_PAD(0x434, 0x108, 4, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_CSI0_DAT18__SDMA_DEBUG_PC_12          IOMUX_PAD(0x434, 0x108, 5, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_CSI0_DAT18__EMI_EMI_DEBUG_47          IOMUX_PAD(0x434, 0x108, 6, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_CSI0_DAT18__TPIU_TRACE_15             IOMUX_PAD(0x434, 0x108, 7, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_CSI0_DAT19__IPU_CSI0_D_19             IOMUX_PAD(0x438, 0x10C, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_CSI0_DAT19__GPIO6_5                   IOMUX_PAD(0x438, 0x10C, 1, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_CSI0_DAT19__UART5_CTS                 IOMUX_PAD(0x438, 0x10C, 2, __NA_, 0, MX53_UART_PAD_CTRL)
+#define MX53_PAD_CSI0_DAT19__USBOH3_USBH3_DATA_7       IOMUX_PAD(0x438, 0x10C, 4, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_CSI0_DAT19__SDMA_DEBUG_PC_13          IOMUX_PAD(0x438, 0x10C, 5, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_CSI0_DAT19__EMI_EMI_DEBUG_48          IOMUX_PAD(0x438, 0x10C, 6, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_CSI0_DAT19__USBPHY2_BISTOK            IOMUX_PAD(0x438, 0x10C, 7, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_A25__EMI_WEIM_A_25                        IOMUX_PAD(0x458, 0x110, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_A25__GPIO5_2                      IOMUX_PAD(0x458, 0x110, 1, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_A25__ECSPI2_RDY                   IOMUX_PAD(0x458, 0x110, 2, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_A25__IPU_DI1_PIN12                        IOMUX_PAD(0x458, 0x110, 3, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_A25__CSPI_SS1                     IOMUX_PAD(0x458, 0x110, 4, 0x790, 1, NO_PAD_CTRL)
+#define MX53_PAD_EIM_A25__IPU_DI0_D1_CS                        IOMUX_PAD(0x458, 0x110, 6, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_A25__USBPHY1_BISTOK               IOMUX_PAD(0x458, 0x110, 7, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_EB2__EMI_WEIM_EB_2                        IOMUX_PAD(0x45C, 0x114, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_EB2__GPIO2_30                     IOMUX_PAD(0x45C, 0x114, 1, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_EB2__CCM_DI1_EXT_CLK              IOMUX_PAD(0x45C, 0x114, 2, 0x76C, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_EB2__IPU_SER_DISP1_CS             IOMUX_PAD(0x45C, 0x114, 3, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_EB2__ECSPI1_SS0                   IOMUX_PAD(0x45C, 0x114, 4, 0x7A8, 3, NO_PAD_CTRL)
+#define MX53_PAD_EIM_EB2__I2C2_SCL                     IOMUX_PAD(0x45C, 0x114, 5 | IOMUX_CONFIG_SION, 0x81C, 1, NO_PAD_CTRL)
+#define MX53_PAD_EIM_D16__EMI_WEIM_D_16                        IOMUX_PAD(0x460, 0x118, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_D16__GPIO3_16                     IOMUX_PAD(0x460, 0x118, 1, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_D16__IPU_DI0_PIN5                 IOMUX_PAD(0x460, 0x118, 2, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_D16__IPU_DISPB1_SER_CLK           IOMUX_PAD(0x460, 0x118, 3, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_D16__ECSPI1_SCLK                  IOMUX_PAD(0x460, 0x118, 4, 0x79C, 3, NO_PAD_CTRL)
+#define MX53_PAD_EIM_D16__I2C2_SDA                     IOMUX_PAD(0x460, 0x118, 5 | IOMUX_CONFIG_SION, 0x820, 1, NO_PAD_CTRL)
+#define MX53_PAD_EIM_D17__EMI_WEIM_D_17                        IOMUX_PAD(0x464, 0x11C, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_D17__GPIO3_17                     IOMUX_PAD(0x464, 0x11C, 1, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_D17__IPU_DI0_PIN6                 IOMUX_PAD(0x464, 0x11C, 2, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_D17__IPU_DISPB1_SER_DIN           IOMUX_PAD(0x464, 0x11C, 3, 0x830, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_D17__ECSPI1_MISO                  IOMUX_PAD(0x464, 0x11C, 4, 0x7A0, 3, NO_PAD_CTRL)
+#define MX53_PAD_EIM_D17__I2C3_SCL                     IOMUX_PAD(0x464, 0x11C, 5 | IOMUX_CONFIG_SION, 0x824, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_D18__EMI_WEIM_D_18                        IOMUX_PAD(0x468, 0x120, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_D18__GPIO3_18                     IOMUX_PAD(0x468, 0x120, 1, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_D18__IPU_DI0_PIN7                 IOMUX_PAD(0x468, 0x120, 2, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_D18__IPU_DISPB1_SER_DIO           IOMUX_PAD(0x468, 0x120, 3, 0x830, 1, NO_PAD_CTRL)
+#define MX53_PAD_EIM_D18__ECSPI1_MOSI                  IOMUX_PAD(0x468, 0x120, 4, 0x7A4, 3, NO_PAD_CTRL)
+#define MX53_PAD_EIM_D18__I2C3_SDA                     IOMUX_PAD(0x468, 0x120, 5 | IOMUX_CONFIG_SION, 0x828, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_D18__IPU_DI1_D0_CS                        IOMUX_PAD(0x468, 0x120, 6, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_D19__EMI_WEIM_D_19                        IOMUX_PAD(0x46C, 0x124, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_D19__GPIO3_19                     IOMUX_PAD(0x46C, 0x124, 1, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_D19__IPU_DI0_PIN8                 IOMUX_PAD(0x46C, 0x124, 2, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_D19__IPU_DISPB1_SER_RS            IOMUX_PAD(0x46C, 0x124, 3, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_D19__ECSPI1_SS1                   IOMUX_PAD(0x46C, 0x124, 4, 0x7AC, 2, NO_PAD_CTRL)
+#define MX53_PAD_EIM_D19__EPIT1_EPITO                  IOMUX_PAD(0x46C, 0x124, 5, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_D19__UART1_CTS                    IOMUX_PAD(0x46C, 0x124, 6, __NA_, 0, MX53_UART_PAD_CTRL)
+#define MX53_PAD_EIM_D19__USBOH3_USBH2_OC              IOMUX_PAD(0x46C, 0x124, 7, 0x8A4, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_D20__EMI_WEIM_D_20                        IOMUX_PAD(0x470, 0x128, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_D20__GPIO3_20                     IOMUX_PAD(0x470, 0x128, 1, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_D20__IPU_DI0_PIN16                        IOMUX_PAD(0x470, 0x128, 2, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_D20__IPU_SER_DISP0_CS             IOMUX_PAD(0x470, 0x128, 3, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_D20__CSPI_SS0                     IOMUX_PAD(0x470, 0x128, 4, 0x78C, 1, NO_PAD_CTRL)
+#define MX53_PAD_EIM_D20__EPIT2_EPITO                  IOMUX_PAD(0x470, 0x128, 5, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_D20__UART1_RTS                    IOMUX_PAD(0x470, 0x128, 6, 0x874, 1, MX53_UART_PAD_CTRL)
+#define MX53_PAD_EIM_D20__USBOH3_USBH2_PWR             IOMUX_PAD(0x470, 0x128, 7, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_D21__EMI_WEIM_D_21                        IOMUX_PAD(0x474, 0x12C, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_D21__GPIO3_21                     IOMUX_PAD(0x474, 0x12C, 1, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_D21__IPU_DI0_PIN17                        IOMUX_PAD(0x474, 0x12C, 2, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_D21__IPU_DISPB0_SER_CLK           IOMUX_PAD(0x474, 0x12C, 3, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_D21__CSPI_SCLK                    IOMUX_PAD(0x474, 0x12C, 4, 0x780, 1, NO_PAD_CTRL)
+#define MX53_PAD_EIM_D21__I2C1_SCL                     IOMUX_PAD(0x474, 0x12C, 5 | IOMUX_CONFIG_SION, 0x814, 1, NO_PAD_CTRL)
+#define MX53_PAD_EIM_D21__USBOH3_USBOTG_OC             IOMUX_PAD(0x474, 0x12C, 6, 0x89C, 1, NO_PAD_CTRL)
+#define MX53_PAD_EIM_D22__EMI_WEIM_D_22                        IOMUX_PAD(0x478, 0x130, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_D22__GPIO3_22                     IOMUX_PAD(0x478, 0x130, 1, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_D22__IPU_DI0_PIN1                 IOMUX_PAD(0x478, 0x130, 2, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_D22__IPU_DISPB0_SER_DIN           IOMUX_PAD(0x478, 0x130, 3, 0x82C, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_D22__CSPI_MISO                    IOMUX_PAD(0x478, 0x130, 4, 0x784, 1, NO_PAD_CTRL)
+#define MX53_PAD_EIM_D22__USBOH3_USBOTG_PWR            IOMUX_PAD(0x478, 0x130, 6, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_D23__EMI_WEIM_D_23                        IOMUX_PAD(0x47C, 0x134, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_D23__GPIO3_23                     IOMUX_PAD(0x47C, 0x134, 1, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_D23__UART3_CTS                    IOMUX_PAD(0x47C, 0x134, 2, __NA_, 0, MX53_UART_PAD_CTRL)
+#define MX53_PAD_EIM_D23__UART1_DCD                    IOMUX_PAD(0x47C, 0x134, 3, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_D23__IPU_DI0_D0_CS                        IOMUX_PAD(0x47C, 0x134, 4, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_D23__IPU_DI1_PIN2                 IOMUX_PAD(0x47C, 0x134, 5, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_D23__IPU_CSI1_DATA_EN             IOMUX_PAD(0x47C, 0x134, 6, 0x834, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_D23__IPU_DI1_PIN14                        IOMUX_PAD(0x47C, 0x134, 7, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_EB3__EMI_WEIM_EB_3                        IOMUX_PAD(0x480, 0x138, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_EB3__GPIO2_31                     IOMUX_PAD(0x480, 0x138, 1, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_EB3__UART3_RTS                    IOMUX_PAD(0x480, 0x138, 2, 0x884, 1, MX53_UART_PAD_CTRL)
+#define MX53_PAD_EIM_EB3__UART1_RI                     IOMUX_PAD(0x480, 0x138, 3, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_EB3__IPU_DI1_PIN3                 IOMUX_PAD(0x480, 0x138, 5, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_EB3__IPU_CSI1_HSYNC               IOMUX_PAD(0x480, 0x138, 6, 0x838, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_EB3__IPU_DI1_PIN16                        IOMUX_PAD(0x480, 0x138, 7, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_D24__EMI_WEIM_D_24                        IOMUX_PAD(0x484, 0x13C, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_D24__GPIO3_24                     IOMUX_PAD(0x484, 0x13C, 1, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_D24__UART3_TXD_MUX                        IOMUX_PAD(0x484, 0x13C, 2, __NA_, 0, MX53_UART_PAD_CTRL)
+#define MX53_PAD_EIM_D24__ECSPI1_SS2                   IOMUX_PAD(0x484, 0x13C, 3, 0x7B0, 1, NO_PAD_CTRL)
+#define MX53_PAD_EIM_D24__CSPI_SS2                     IOMUX_PAD(0x484, 0x13C, 4, 0x794, 1, NO_PAD_CTRL)
+#define MX53_PAD_EIM_D24__AUDMUX_AUD5_RXFS             IOMUX_PAD(0x484, 0x13C, 5, 0x754, 1, NO_PAD_CTRL)
+#define MX53_PAD_EIM_D24__ECSPI2_SS2                   IOMUX_PAD(0x484, 0x13C, 6, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_D24__UART1_DTR                    IOMUX_PAD(0x484, 0x13C, 7, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_D25__EMI_WEIM_D_25                        IOMUX_PAD(0x488, 0x140, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_D25__GPIO3_25                     IOMUX_PAD(0x488, 0x140, 1, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_D25__UART3_RXD_MUX                        IOMUX_PAD(0x488, 0x140, 2, 0x888, 1, MX53_UART_PAD_CTRL)
+#define MX53_PAD_EIM_D25__ECSPI1_SS3                   IOMUX_PAD(0x488, 0x140, 3, 0x7B4, 1, NO_PAD_CTRL)
+#define MX53_PAD_EIM_D25__CSPI_SS3                     IOMUX_PAD(0x488, 0x140, 4, 0x798, 1, NO_PAD_CTRL)
+#define MX53_PAD_EIM_D25__AUDMUX_AUD5_RXC              IOMUX_PAD(0x488, 0x140, 5, 0x750, 1, NO_PAD_CTRL)
+#define MX53_PAD_EIM_D25__ECSPI2_SS3                   IOMUX_PAD(0x488, 0x140, 6, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_D25__UART1_DSR                    IOMUX_PAD(0x488, 0x140, 7, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_D26__EMI_WEIM_D_26                        IOMUX_PAD(0x48C, 0x144, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_D26__GPIO3_26                     IOMUX_PAD(0x48C, 0x144, 1, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_D26__UART2_TXD_MUX                        IOMUX_PAD(0x48C, 0x144, 2, __NA_, 0, MX53_UART_PAD_CTRL)
+#define MX53_PAD_EIM_D26__FIRI_RXD                     IOMUX_PAD(0x48C, 0x144, 3, 0x80C, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_D26__IPU_CSI0_D_1                 IOMUX_PAD(0x48C, 0x144, 4, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_D26__IPU_DI1_PIN11                        IOMUX_PAD(0x48C, 0x144, 5, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_D26__IPU_SISG_2                   IOMUX_PAD(0x48C, 0x144, 6, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_D26__IPU_DISP1_DAT_22             IOMUX_PAD(0x48C, 0x144, 7, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_D27__EMI_WEIM_D_27                        IOMUX_PAD(0x490, 0x148, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_D27__GPIO3_27                     IOMUX_PAD(0x490, 0x148, 1, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_D27__UART2_RXD_MUX                        IOMUX_PAD(0x490, 0x148, 2, 0x880, 1, MX53_UART_PAD_CTRL)
+#define MX53_PAD_EIM_D27__FIRI_TXD                     IOMUX_PAD(0x490, 0x148, 3, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_D27__IPU_CSI0_D_0                 IOMUX_PAD(0x490, 0x148, 4, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_D27__IPU_DI1_PIN13                        IOMUX_PAD(0x490, 0x148, 5, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_D27__IPU_SISG_3                   IOMUX_PAD(0x490, 0x148, 6, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_D27__IPU_DISP1_DAT_23             IOMUX_PAD(0x490, 0x148, 7, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_D28__EMI_WEIM_D_28                        IOMUX_PAD(0x494, 0x14C, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_D28__GPIO3_28                     IOMUX_PAD(0x494, 0x14C, 1, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_D28__UART2_CTS                    IOMUX_PAD(0x494, 0x14C, 2, __NA_, 0, MX53_UART_PAD_CTRL)
+#define MX53_PAD_EIM_D28__IPU_DISPB0_SER_DIO           IOMUX_PAD(0x494, 0x14C, 3, 0x82C, 1, NO_PAD_CTRL)
+#define MX53_PAD_EIM_D28__CSPI_MOSI                    IOMUX_PAD(0x494, 0x14C, 4, 0x788, 1, NO_PAD_CTRL)
+#define MX53_PAD_EIM_D28__I2C1_SDA                     IOMUX_PAD(0x494, 0x14C, 5 | IOMUX_CONFIG_SION, 0x818, 1, NO_PAD_CTRL)
+#define MX53_PAD_EIM_D28__IPU_EXT_TRIG                 IOMUX_PAD(0x494, 0x14C, 6, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_D28__IPU_DI0_PIN13                        IOMUX_PAD(0x494, 0x14C, 7, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_D29__EMI_WEIM_D_29                        IOMUX_PAD(0x498, 0x150, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_D29__GPIO3_29                     IOMUX_PAD(0x498, 0x150, 1, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_D29__UART2_RTS                    IOMUX_PAD(0x498, 0x150, 2, 0x87C, 1, MX53_UART_PAD_CTRL)
+#define MX53_PAD_EIM_D29__IPU_DISPB0_SER_RS            IOMUX_PAD(0x498, 0x150, 3, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_D29__CSPI_SS0                     IOMUX_PAD(0x498, 0x150, 4, 0x78C, 2, NO_PAD_CTRL)
+#define MX53_PAD_EIM_D29__IPU_DI1_PIN15                        IOMUX_PAD(0x498, 0x150, 5, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_D29__IPU_CSI1_VSYNC               IOMUX_PAD(0x498, 0x150, 6, 0x83C, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_D29__IPU_DI0_PIN14                        IOMUX_PAD(0x498, 0x150, 7, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_D30__EMI_WEIM_D_30                        IOMUX_PAD(0x49C, 0x154, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_D30__GPIO3_30                     IOMUX_PAD(0x49C, 0x154, 1, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_D30__UART3_CTS                    IOMUX_PAD(0x49C, 0x154, 2, __NA_, 0, MX53_UART_PAD_CTRL)
+#define MX53_PAD_EIM_D30__IPU_CSI0_D_3                 IOMUX_PAD(0x49C, 0x154, 3, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_D30__IPU_DI0_PIN11                        IOMUX_PAD(0x49C, 0x154, 4, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_D30__IPU_DISP1_DAT_21             IOMUX_PAD(0x49C, 0x154, 5, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_D30__USBOH3_USBH1_OC              IOMUX_PAD(0x49C, 0x154, 6, 0x8A0, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_D30__USBOH3_USBH2_OC              IOMUX_PAD(0x49C, 0x154, 7, 0x8A4, 1, NO_PAD_CTRL)
+#define MX53_PAD_EIM_D31__EMI_WEIM_D_31                        IOMUX_PAD(0x4A0, 0x158, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_D31__GPIO3_31                     IOMUX_PAD(0x4A0, 0x158, 1, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_D31__UART3_RTS                    IOMUX_PAD(0x4A0, 0x158, 2, 0x884, 3, MX53_UART_PAD_CTRL)
+#define MX53_PAD_EIM_D31__IPU_CSI0_D_2                 IOMUX_PAD(0x4A0, 0x158, 3, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_D31__IPU_DI0_PIN12                        IOMUX_PAD(0x4A0, 0x158, 4, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_D31__IPU_DISP1_DAT_20             IOMUX_PAD(0x4A0, 0x158, 5, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_D31__USBOH3_USBH1_PWR             IOMUX_PAD(0x4A0, 0x158, 6, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_D31__USBOH3_USBH2_PWR             IOMUX_PAD(0x4A0, 0x158, 7, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_A24__EMI_WEIM_A_24                        IOMUX_PAD(0x4A8, 0x15C, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_A24__GPIO5_4                      IOMUX_PAD(0x4A8, 0x15C, 1, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_A24__IPU_DISP1_DAT_19             IOMUX_PAD(0x4A8, 0x15C, 2, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_A24__IPU_CSI1_D_19                        IOMUX_PAD(0x4A8, 0x15C, 3, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_A24__IPU_SISG_2                   IOMUX_PAD(0x4A8, 0x15C, 6, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_A24__USBPHY2_BVALID               IOMUX_PAD(0x4A8, 0x15C, 7, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_A23__EMI_WEIM_A_23                        IOMUX_PAD(0x4AC, 0x160, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_A23__GPIO6_6                      IOMUX_PAD(0x4AC, 0x160, 1, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_A23__IPU_DISP1_DAT_18             IOMUX_PAD(0x4AC, 0x160, 2, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_A23__IPU_CSI1_D_18                        IOMUX_PAD(0x4AC, 0x160, 3, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_A23__IPU_SISG_3                   IOMUX_PAD(0x4AC, 0x160, 6, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_A23__USBPHY2_ENDSESSION           IOMUX_PAD(0x4AC, 0x160, 7, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_A22__EMI_WEIM_A_22                        IOMUX_PAD(0x4B0, 0x164, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_A22__GPIO2_16                     IOMUX_PAD(0x4B0, 0x164, 1, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_A22__IPU_DISP1_DAT_17             IOMUX_PAD(0x4B0, 0x164, 2, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_A22__IPU_CSI1_D_17                        IOMUX_PAD(0x4B0, 0x164, 3, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_A22__SRC_BT_CFG1_7                        IOMUX_PAD(0x4B0, 0x164, 7, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_A21__EMI_WEIM_A_21                        IOMUX_PAD(0x4B4, 0x168, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_A21__GPIO2_17                     IOMUX_PAD(0x4B4, 0x168, 1, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_A21__IPU_DISP1_DAT_16             IOMUX_PAD(0x4B4, 0x168, 2, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_A21__IPU_CSI1_D_16                        IOMUX_PAD(0x4B4, 0x168, 3, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_A21__SRC_BT_CFG1_6                        IOMUX_PAD(0x4B4, 0x168, 7, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_A20__EMI_WEIM_A_20                        IOMUX_PAD(0x4B8, 0x16C, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_A20__GPIO2_18                     IOMUX_PAD(0x4B8, 0x16C, 1, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_A20__IPU_DISP1_DAT_15             IOMUX_PAD(0x4B8, 0x16C, 2, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_A20__IPU_CSI1_D_15                        IOMUX_PAD(0x4B8, 0x16C, 3, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_A20__SRC_BT_CFG1_5                        IOMUX_PAD(0x4B8, 0x16C, 7, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_A19__EMI_WEIM_A_19                        IOMUX_PAD(0x4BC, 0x170, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_A19__GPIO2_19                     IOMUX_PAD(0x4BC, 0x170, 1, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_A19__IPU_DISP1_DAT_14             IOMUX_PAD(0x4BC, 0x170, 2, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_A19__IPU_CSI1_D_14                        IOMUX_PAD(0x4BC, 0x170, 3, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_A19__SRC_BT_CFG1_4                        IOMUX_PAD(0x4BC, 0x170, 7, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_A18__EMI_WEIM_A_18                        IOMUX_PAD(0x4C0, 0x174, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_A18__GPIO2_20                     IOMUX_PAD(0x4C0, 0x174, 1, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_A18__IPU_DISP1_DAT_13             IOMUX_PAD(0x4C0, 0x174, 2, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_A18__IPU_CSI1_D_13                        IOMUX_PAD(0x4C0, 0x174, 3, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_A18__SRC_BT_CFG1_3                        IOMUX_PAD(0x4C0, 0x174, 7, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_A17__EMI_WEIM_A_17                        IOMUX_PAD(0x4C4, 0x178, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_A17__GPIO2_21                     IOMUX_PAD(0x4C4, 0x178, 1, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_A17__IPU_DISP1_DAT_12             IOMUX_PAD(0x4C4, 0x178, 2, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_A17__IPU_CSI1_D_12                        IOMUX_PAD(0x4C4, 0x178, 3, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_A17__SRC_BT_CFG1_2                        IOMUX_PAD(0x4C4, 0x178, 7, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_A16__EMI_WEIM_A_16                        IOMUX_PAD(0x4C8, 0x17C, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_A16__GPIO2_22                     IOMUX_PAD(0x4C8, 0x17C, 1, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_A16__IPU_DI1_DISP_CLK             IOMUX_PAD(0x4C8, 0x17C, 2, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_A16__IPU_CSI1_PIXCLK              IOMUX_PAD(0x4C8, 0x17C, 3, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_A16__SRC_BT_CFG1_1                        IOMUX_PAD(0x4C8, 0x17C, 7, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_CS0__EMI_WEIM_CS_0                        IOMUX_PAD(0x4CC, 0x180, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_CS0__GPIO2_23                     IOMUX_PAD(0x4CC, 0x180, 1, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_CS0__ECSPI2_SCLK                  IOMUX_PAD(0x4CC, 0x180, 2, 0x7B8, 2, NO_PAD_CTRL)
+#define MX53_PAD_EIM_CS0__IPU_DI1_PIN5                 IOMUX_PAD(0x4CC, 0x180, 3, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_CS1__EMI_WEIM_CS_1                        IOMUX_PAD(0x4D0, 0x184, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_CS1__GPIO2_24                     IOMUX_PAD(0x4D0, 0x184, 1, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_CS1__ECSPI2_MOSI                  IOMUX_PAD(0x4D0, 0x184, 2, 0x7C0, 2, NO_PAD_CTRL)
+#define MX53_PAD_EIM_CS1__IPU_DI1_PIN6                 IOMUX_PAD(0x4D0, 0x184, 3, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_OE__EMI_WEIM_OE                   IOMUX_PAD(0x4D4, 0x188, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_OE__GPIO2_25                      IOMUX_PAD(0x4D4, 0x188, 1, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_OE__ECSPI2_MISO                   IOMUX_PAD(0x4D4, 0x188, 2, 0x7BC, 2, NO_PAD_CTRL)
+#define MX53_PAD_EIM_OE__IPU_DI1_PIN7                  IOMUX_PAD(0x4D4, 0x188, 3, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_OE__USBPHY2_IDDIG                 IOMUX_PAD(0x4D4, 0x188, 7, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_RW__EMI_WEIM_RW                   IOMUX_PAD(0x4D8, 0x18C, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_RW__GPIO2_26                      IOMUX_PAD(0x4D8, 0x18C, 1, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_RW__ECSPI2_SS0                    IOMUX_PAD(0x4D8, 0x18C, 2, 0x7C4, 2, NO_PAD_CTRL)
+#define MX53_PAD_EIM_RW__IPU_DI1_PIN8                  IOMUX_PAD(0x4D8, 0x18C, 3, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_RW__USBPHY2_HOSTDISCONNECT                IOMUX_PAD(0x4D8, 0x18C, 7, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_LBA__EMI_WEIM_LBA                 IOMUX_PAD(0x4DC, 0x190, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_LBA__GPIO2_27                     IOMUX_PAD(0x4DC, 0x190, 1, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_LBA__ECSPI2_SS1                   IOMUX_PAD(0x4DC, 0x190, 2, 0x7C8, 1, NO_PAD_CTRL)
+#define MX53_PAD_EIM_LBA__IPU_DI1_PIN17                        IOMUX_PAD(0x4DC, 0x190, 3, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_LBA__SRC_BT_CFG1_0                        IOMUX_PAD(0x4DC, 0x190, 7, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_EB0__EMI_WEIM_EB_0                        IOMUX_PAD(0x4E4, 0x194, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_EB0__GPIO2_28                     IOMUX_PAD(0x4E4, 0x194, 1, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_EB0__IPU_DISP1_DAT_11             IOMUX_PAD(0x4E4, 0x194, 3, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_EB0__IPU_CSI1_D_11                        IOMUX_PAD(0x4E4, 0x194, 4, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_EB0__GPC_PMIC_RDY                 IOMUX_PAD(0x4E4, 0x194, 5, 0x810, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_EB0__SRC_BT_CFG2_7                        IOMUX_PAD(0x4E4, 0x194, 7, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_EB1__EMI_WEIM_EB_1                        IOMUX_PAD(0x4E8, 0x198, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_EB1__GPIO2_29                     IOMUX_PAD(0x4E8, 0x198, 1, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_EB1__IPU_DISP1_DAT_10             IOMUX_PAD(0x4E8, 0x198, 3, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_EB1__IPU_CSI1_D_10                        IOMUX_PAD(0x4E8, 0x198, 4, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_EB1__SRC_BT_CFG2_6                        IOMUX_PAD(0x4E8, 0x198, 7, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_DA0__EMI_NAND_WEIM_DA_0           IOMUX_PAD(0x4EC, 0x19C, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_DA0__GPIO3_0                      IOMUX_PAD(0x4EC, 0x19C, 1, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_DA0__IPU_DISP1_DAT_9              IOMUX_PAD(0x4EC, 0x19C, 3, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_DA0__IPU_CSI1_D_9                 IOMUX_PAD(0x4EC, 0x19C, 4, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_DA0__SRC_BT_CFG2_5                        IOMUX_PAD(0x4EC, 0x19C, 7, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_DA1__EMI_NAND_WEIM_DA_1           IOMUX_PAD(0x4F0, 0x1A0, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_DA1__GPIO3_1                      IOMUX_PAD(0x4F0, 0x1A0, 1, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_DA1__IPU_DISP1_DAT_8              IOMUX_PAD(0x4F0, 0x1A0, 3, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_DA1__IPU_CSI1_D_8                 IOMUX_PAD(0x4F0, 0x1A0, 4, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_DA1__SRC_BT_CFG2_4                        IOMUX_PAD(0x4F0, 0x1A0, 7, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_DA2__EMI_NAND_WEIM_DA_2           IOMUX_PAD(0x4F4, 0x1A4, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_DA2__GPIO3_2                      IOMUX_PAD(0x4F4, 0x1A4, 1, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_DA2__IPU_DISP1_DAT_7              IOMUX_PAD(0x4F4, 0x1A4, 3, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_DA2__IPU_CSI1_D_7                 IOMUX_PAD(0x4F4, 0x1A4, 4, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_DA2__SRC_BT_CFG2_3                        IOMUX_PAD(0x4F4, 0x1A4, 7, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_DA3__EMI_NAND_WEIM_DA_3           IOMUX_PAD(0x4F8, 0x1A8, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_DA3__GPIO3_3                      IOMUX_PAD(0x4F8, 0x1A8, 1, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_DA3__IPU_DISP1_DAT_6              IOMUX_PAD(0x4F8, 0x1A8, 3, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_DA3__IPU_CSI1_D_6                 IOMUX_PAD(0x4F8, 0x1A8, 4, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_DA3__SRC_BT_CFG2_2                        IOMUX_PAD(0x4F8, 0x1A8, 7, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_DA4__EMI_NAND_WEIM_DA_4           IOMUX_PAD(0x4FC, 0x1AC, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_DA4__GPIO3_4                      IOMUX_PAD(0x4FC, 0x1AC, 1, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_DA4__IPU_DISP1_DAT_5              IOMUX_PAD(0x4FC, 0x1AC, 3, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_DA4__IPU_CSI1_D_5                 IOMUX_PAD(0x4FC, 0x1AC, 4, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_DA4__SRC_BT_CFG3_7                        IOMUX_PAD(0x4FC, 0x1AC, 7, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_DA5__EMI_NAND_WEIM_DA_5           IOMUX_PAD(0x500, 0x1B0, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_DA5__GPIO3_5                      IOMUX_PAD(0x500, 0x1B0, 1, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_DA5__IPU_DISP1_DAT_4              IOMUX_PAD(0x500, 0x1B0, 3, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_DA5__IPU_CSI1_D_4                 IOMUX_PAD(0x500, 0x1B0, 4, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_DA5__SRC_BT_CFG3_6                        IOMUX_PAD(0x500, 0x1B0, 7 | IOMUX_CONFIG_SION, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_DA6__EMI_NAND_WEIM_DA_6           IOMUX_PAD(0x504, 0x1B4, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_DA6__GPIO3_6                      IOMUX_PAD(0x504, 0x1B4, 1, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_DA6__IPU_DISP1_DAT_3              IOMUX_PAD(0x504, 0x1B4, 3, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_DA6__IPU_CSI1_D_3                 IOMUX_PAD(0x504, 0x1B4, 4, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_DA6__SRC_BT_CFG3_5                        IOMUX_PAD(0x504, 0x1B4, 7, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_DA7__EMI_NAND_WEIM_DA_7           IOMUX_PAD(0x508, 0x1B8, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_DA7__GPIO3_7                      IOMUX_PAD(0x508, 0x1B8, 1, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_DA7__IPU_DISP1_DAT_2              IOMUX_PAD(0x508, 0x1B8, 3, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_DA7__IPU_CSI1_D_2                 IOMUX_PAD(0x508, 0x1B8, 4, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_DA7__SRC_BT_CFG3_4                        IOMUX_PAD(0x508, 0x1B8, 7, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_DA8__EMI_NAND_WEIM_DA_8           IOMUX_PAD(0x50C, 0x1BC, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_DA8__GPIO3_8                      IOMUX_PAD(0x50C, 0x1BC, 1, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_DA8__IPU_DISP1_DAT_1              IOMUX_PAD(0x50C, 0x1BC, 3, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_DA8__IPU_CSI1_D_1                 IOMUX_PAD(0x50C, 0x1BC, 4, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_DA8__SRC_BT_CFG3_3                        IOMUX_PAD(0x50C, 0x1BC, 7, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_DA9__EMI_NAND_WEIM_DA_9           IOMUX_PAD(0x510, 0x1C0, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_DA9__GPIO3_9                      IOMUX_PAD(0x510, 0x1C0, 1, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_DA9__IPU_DISP1_DAT_0              IOMUX_PAD(0x510, 0x1C0, 3, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_DA9__IPU_CSI1_D_0                 IOMUX_PAD(0x510, 0x1C0, 4, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_DA9__SRC_BT_CFG3_2                        IOMUX_PAD(0x510, 0x1C0, 7, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_DA10__EMI_NAND_WEIM_DA_10         IOMUX_PAD(0x514, 0x1C4, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_DA10__GPIO3_10                    IOMUX_PAD(0x514, 0x1C4, 1, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_DA10__IPU_DI1_PIN15               IOMUX_PAD(0x514, 0x1C4, 3, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_DA10__IPU_CSI1_DATA_EN            IOMUX_PAD(0x514, 0x1C4, 4, 0x834, 1, NO_PAD_CTRL)
+#define MX53_PAD_EIM_DA10__SRC_BT_CFG3_1               IOMUX_PAD(0x514, 0x1C4, 7, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_DA11__EMI_NAND_WEIM_DA_11         IOMUX_PAD(0x518, 0x1C8, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_DA11__GPIO3_11                    IOMUX_PAD(0x518, 0x1C8, 1, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_DA11__IPU_DI1_PIN2                        IOMUX_PAD(0x518, 0x1C8, 3, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_DA11__IPU_CSI1_HSYNC              IOMUX_PAD(0x518, 0x1C8, 4, 0x838, 1, NO_PAD_CTRL)
+#define MX53_PAD_EIM_DA12__EMI_NAND_WEIM_DA_12         IOMUX_PAD(0x51C, 0x1CC, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_DA12__GPIO3_12                    IOMUX_PAD(0x51C, 0x1CC, 1, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_DA12__IPU_DI1_PIN3                        IOMUX_PAD(0x51C, 0x1CC, 3, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_DA12__IPU_CSI1_VSYNC              IOMUX_PAD(0x51C, 0x1CC, 4, 0x83C, 1, NO_PAD_CTRL)
+#define MX53_PAD_EIM_DA13__EMI_NAND_WEIM_DA_13         IOMUX_PAD(0x520, 0x1D0, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_DA13__GPIO3_13                    IOMUX_PAD(0x520, 0x1D0, 1, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_DA13__IPU_DI1_D0_CS               IOMUX_PAD(0x520, 0x1D0, 3, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_DA13__CCM_DI1_EXT_CLK             IOMUX_PAD(0x520, 0x1D0, 4, 0x76C, 1, NO_PAD_CTRL)
+#define MX53_PAD_EIM_DA14__EMI_NAND_WEIM_DA_14         IOMUX_PAD(0x524, 0x1D4, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_DA14__GPIO3_14                    IOMUX_PAD(0x524, 0x1D4, 1, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_DA14__IPU_DI1_D1_CS               IOMUX_PAD(0x524, 0x1D4, 3, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_DA14__CCM_DI0_EXT_CLK             IOMUX_PAD(0x524, 0x1D4, 4, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_DA15__EMI_NAND_WEIM_DA_15         IOMUX_PAD(0x528, 0x1D8, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_DA15__GPIO3_15                    IOMUX_PAD(0x528, 0x1D8, 1, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_DA15__IPU_DI1_PIN1                        IOMUX_PAD(0x528, 0x1D8, 3, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_DA15__IPU_DI1_PIN4                        IOMUX_PAD(0x528, 0x1D8, 4, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_NANDF_WE_B__EMI_NANDF_WE_B            IOMUX_PAD(0x52C, 0x1DC, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_NANDF_WE_B__GPIO6_12                  IOMUX_PAD(0x52C, 0x1DC, 1, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_NANDF_RE_B__EMI_NANDF_RE_B            IOMUX_PAD(0x530, 0x1E0, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_NANDF_RE_B__GPIO6_13                  IOMUX_PAD(0x530, 0x1E0, 1, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_WAIT__EMI_WEIM_WAIT               IOMUX_PAD(0x534, 0x1E4, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_WAIT__GPIO5_0                     IOMUX_PAD(0x534, 0x1E4, 1, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_EIM_WAIT__EMI_WEIM_DTACK_B            IOMUX_PAD(0x534, 0x1E4, 2, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_LVDS1_TX3_P__GPIO6_22                 IOMUX_PAD(__NA_, 0x1EC, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_LVDS1_TX3_P__LDB_LVDS1_TX3            IOMUX_PAD(__NA_, 0x1EC, 1, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_LVDS1_TX2_P__GPIO6_24                 IOMUX_PAD(__NA_, 0x1F0, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_LVDS1_TX2_P__LDB_LVDS1_TX2            IOMUX_PAD(__NA_, 0x1F0, 1, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_LVDS1_CLK_P__GPIO6_26                 IOMUX_PAD(__NA_, 0x1F4, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_LVDS1_CLK_P__LDB_LVDS1_CLK            IOMUX_PAD(__NA_, 0x1F4, 1, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_LVDS1_TX1_P__GPIO6_28                 IOMUX_PAD(__NA_, 0x1F8, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_LVDS1_TX1_P__LDB_LVDS1_TX1            IOMUX_PAD(__NA_, 0x1F8, 1, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_LVDS1_TX0_P__GPIO6_30                 IOMUX_PAD(__NA_, 0x1FC, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_LVDS1_TX0_P__LDB_LVDS1_TX0            IOMUX_PAD(__NA_, 0x1FC, 1, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_LVDS0_TX3_P__GPIO7_22                 IOMUX_PAD(__NA_, 0x200, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_LVDS0_TX3_P__LDB_LVDS0_TX3            IOMUX_PAD(__NA_, 0x200, 1, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_LVDS0_CLK_P__GPIO7_24                 IOMUX_PAD(__NA_, 0x204, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_LVDS0_CLK_P__LDB_LVDS0_CLK            IOMUX_PAD(__NA_, 0x204, 1, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_LVDS0_TX2_P__GPIO7_26                 IOMUX_PAD(__NA_, 0x208, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_LVDS0_TX2_P__LDB_LVDS0_TX2            IOMUX_PAD(__NA_, 0x208, 1, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_LVDS0_TX1_P__GPIO7_28                 IOMUX_PAD(__NA_, 0x20C, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_LVDS0_TX1_P__LDB_LVDS0_TX1            IOMUX_PAD(__NA_, 0x20C, 1, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_LVDS0_TX0_P__GPIO7_30                 IOMUX_PAD(__NA_, 0x210, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_LVDS0_TX0_P__LDB_LVDS0_TX0            IOMUX_PAD(__NA_, 0x210, 1, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_GPIO_10__GPIO4_0                      IOMUX_PAD(0x540, 0x214, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_GPIO_10__OSC32k_32K_OUT               IOMUX_PAD(0x540, 0x214, 1, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_GPIO_11__GPIO4_1                      IOMUX_PAD(0x544, 0x218, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_GPIO_12__GPIO4_2                      IOMUX_PAD(0x548, 0x21C, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_GPIO_13__GPIO4_3                      IOMUX_PAD(0x54C, 0x220, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_GPIO_14__GPIO4_4                      IOMUX_PAD(0x550, 0x224, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_NANDF_CLE__EMI_NANDF_CLE              IOMUX_PAD(0x5A0, 0x228, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_NANDF_CLE__GPIO6_7                    IOMUX_PAD(0x5A0, 0x228, 1, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_NANDF_CLE__USBPHY1_VSTATUS_0          IOMUX_PAD(0x5A0, 0x228, 7, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_NANDF_ALE__EMI_NANDF_ALE              IOMUX_PAD(0x5A4, 0x22C, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_NANDF_ALE__GPIO6_8                    IOMUX_PAD(0x5A4, 0x22C, 1, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_NANDF_ALE__USBPHY1_VSTATUS_1          IOMUX_PAD(0x5A4, 0x22C, 7, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_NANDF_WP_B__EMI_NANDF_WP_B            IOMUX_PAD(0x5A8, 0x230, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_NANDF_WP_B__GPIO6_9                   IOMUX_PAD(0x5A8, 0x230, 1, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_NANDF_WP_B__USBPHY1_VSTATUS_2         IOMUX_PAD(0x5A8, 0x230, 7, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_NANDF_RB0__EMI_NANDF_RB_0             IOMUX_PAD(0x5AC, 0x234, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_NANDF_RB0__GPIO6_10                   IOMUX_PAD(0x5AC, 0x234, 1, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_NANDF_RB0__USBPHY1_VSTATUS_3          IOMUX_PAD(0x5AC, 0x234, 7, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_NANDF_CS0__EMI_NANDF_CS_0             IOMUX_PAD(0x5B0, 0x238, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_NANDF_CS0__GPIO6_11                   IOMUX_PAD(0x5B0, 0x238, 1, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_NANDF_CS0__USBPHY1_VSTATUS_4          IOMUX_PAD(0x5B0, 0x238, 7, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_NANDF_CS1__EMI_NANDF_CS_1             IOMUX_PAD(0x5B4, 0x23C, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_NANDF_CS1__GPIO6_14                   IOMUX_PAD(0x5B4, 0x23C, 1, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_NANDF_CS1__MLB_MLBCLK                 IOMUX_PAD(0x5B4, 0x23C, 6, 0x858, 0, NO_PAD_CTRL)
+#define MX53_PAD_NANDF_CS1__USBPHY1_VSTATUS_5          IOMUX_PAD(0x5B4, 0x23C, 7, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_NANDF_CS2__EMI_NANDF_CS_2             IOMUX_PAD(0x5B8, 0x240, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_NANDF_CS2__GPIO6_15                   IOMUX_PAD(0x5B8, 0x240, 1, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_NANDF_CS2__IPU_SISG_0                 IOMUX_PAD(0x5B8, 0x240, 2, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_NANDF_CS2__ESAI1_TX0                  IOMUX_PAD(0x5B8, 0x240, 3, 0x7E4, 0, NO_PAD_CTRL)
+#define MX53_PAD_NANDF_CS2__EMI_WEIM_CRE               IOMUX_PAD(0x5B8, 0x240, 4, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_NANDF_CS2__CCM_CSI0_MCLK              IOMUX_PAD(0x5B8, 0x240, 5, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_NANDF_CS2__MLB_MLBSIG                 IOMUX_PAD(0x5B8, 0x240, 6, 0x860, 0, NO_PAD_CTRL)
+#define MX53_PAD_NANDF_CS2__USBPHY1_VSTATUS_6          IOMUX_PAD(0x5B8, 0x240, 7, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_NANDF_CS3__EMI_NANDF_CS_3             IOMUX_PAD(0x5BC, 0x244, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_NANDF_CS3__GPIO6_16                   IOMUX_PAD(0x5BC, 0x244, 1, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_NANDF_CS3__IPU_SISG_1                 IOMUX_PAD(0x5BC, 0x244, 2, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_NANDF_CS3__ESAI1_TX1                  IOMUX_PAD(0x5BC, 0x244, 3, 0x7E8, 0, NO_PAD_CTRL)
+#define MX53_PAD_NANDF_CS3__EMI_WEIM_A_26              IOMUX_PAD(0x5BC, 0x244, 4, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_NANDF_CS3__MLB_MLBDAT                 IOMUX_PAD(0x5BC, 0x244, 6, 0x85C, 0, NO_PAD_CTRL)
+#define MX53_PAD_NANDF_CS3__USBPHY1_VSTATUS_7          IOMUX_PAD(0x5BC, 0x244, 7, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_FEC_MDIO__FEC_MDIO                    IOMUX_PAD(0x5C4, 0x248, 0, 0x804, 1, NO_PAD_CTRL)
+#define MX53_PAD_FEC_MDIO__GPIO1_22                    IOMUX_PAD(0x5C4, 0x248, 1, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_FEC_MDIO__ESAI1_SCKR                  IOMUX_PAD(0x5C4, 0x248, 2, 0x7DC, 0, NO_PAD_CTRL)
+#define MX53_PAD_FEC_MDIO__FEC_COL                     IOMUX_PAD(0x5C4, 0x248, 3, 0x800, 1, NO_PAD_CTRL)
+#define MX53_PAD_FEC_MDIO__RTC_CE_RTC_PS2              IOMUX_PAD(0x5C4, 0x248, 4, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_FEC_MDIO__SDMA_DEBUG_BUS_DEVICE_3     IOMUX_PAD(0x5C4, 0x248, 5, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_FEC_MDIO__EMI_EMI_DEBUG_49            IOMUX_PAD(0x5C4, 0x248, 6, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_FEC_REF_CLK__FEC_TX_CLK               IOMUX_PAD(0x5C8, 0x24C, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_FEC_REF_CLK__GPIO1_23                 IOMUX_PAD(0x5C8, 0x24C, 1, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_FEC_REF_CLK__ESAI1_FSR                        IOMUX_PAD(0x5C8, 0x24C, 2, 0x7CC, 0, NO_PAD_CTRL)
+#define MX53_PAD_FEC_REF_CLK__SDMA_DEBUG_BUS_DEVICE_4  IOMUX_PAD(0x5C8, 0x24C, 5, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_FEC_REF_CLK__EMI_EMI_DEBUG_50         IOMUX_PAD(0x5C8, 0x24C, 6, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_FEC_RX_ER__FEC_RX_ER                  IOMUX_PAD(0x5CC, 0x250, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_FEC_RX_ER__GPIO1_24                   IOMUX_PAD(0x5CC, 0x250, 1, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_FEC_RX_ER__ESAI1_HCKR                 IOMUX_PAD(0x5CC, 0x250, 2, 0x7D4, 0, NO_PAD_CTRL)
+#define MX53_PAD_FEC_RX_ER__FEC_RX_CLK                 IOMUX_PAD(0x5CC, 0x250, 3, 0x808, 1, NO_PAD_CTRL)
+#define MX53_PAD_FEC_RX_ER__RTC_CE_RTC_PS3             IOMUX_PAD(0x5CC, 0x250, 4, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_FEC_CRS_DV__FEC_RX_DV                 IOMUX_PAD(0x5D0, 0x254, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_FEC_CRS_DV__GPIO1_25                  IOMUX_PAD(0x5D0, 0x254, 1, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_FEC_CRS_DV__ESAI1_SCKT                        IOMUX_PAD(0x5D0, 0x254, 2, 0x7E0, 0, NO_PAD_CTRL)
+#define MX53_PAD_FEC_RXD1__FEC_RDATA_1                 IOMUX_PAD(0x5D4, 0x258, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_FEC_RXD1__GPIO1_26                    IOMUX_PAD(0x5D4, 0x258, 1, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_FEC_RXD1__ESAI1_FST                   IOMUX_PAD(0x5D4, 0x258, 2, 0x7D0, 0, NO_PAD_CTRL)
+#define MX53_PAD_FEC_RXD1__MLB_MLBSIG                  IOMUX_PAD(0x5D4, 0x258, 3, 0x860, 1, NO_PAD_CTRL)
+#define MX53_PAD_FEC_RXD1__RTC_CE_RTC_PS1              IOMUX_PAD(0x5D4, 0x258, 4, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_FEC_RXD0__FEC_RDATA_0                 IOMUX_PAD(0x5D8, 0x25C, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_FEC_RXD0__GPIO1_27                    IOMUX_PAD(0x5D8, 0x25C, 1, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_FEC_RXD0__ESAI1_HCKT                  IOMUX_PAD(0x5D8, 0x25C, 2, 0x7D8, 0, NO_PAD_CTRL)
+#define MX53_PAD_FEC_RXD0__OSC32k_32K_OUT              IOMUX_PAD(0x5D8, 0x25C, 3, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_FEC_TX_EN__FEC_TX_EN                  IOMUX_PAD(0x5DC, 0x260, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_FEC_TX_EN__GPIO1_28                   IOMUX_PAD(0x5DC, 0x260, 1, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_FEC_TX_EN__ESAI1_TX3_RX2              IOMUX_PAD(0x5DC, 0x260, 2, 0x7F0, 0, NO_PAD_CTRL)
+#define MX53_PAD_FEC_TXD1__FEC_TDATA_1                 IOMUX_PAD(0x5E0, 0x264, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_FEC_TXD1__GPIO1_29                    IOMUX_PAD(0x5E0, 0x264, 1, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_FEC_TXD1__ESAI1_TX2_RX3               IOMUX_PAD(0x5E0, 0x264, 2, 0x7EC, 0, NO_PAD_CTRL)
+#define MX53_PAD_FEC_TXD1__MLB_MLBCLK                  IOMUX_PAD(0x5E0, 0x264, 3, 0x858, 1, NO_PAD_CTRL)
+#define MX53_PAD_FEC_TXD1__RTC_CE_RTC_PRSC_CLK         IOMUX_PAD(0x5E0, 0x264, 4, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_FEC_TXD0__FEC_TDATA_0                 IOMUX_PAD(0x5E4, 0x268, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_FEC_TXD0__GPIO1_30                    IOMUX_PAD(0x5E4, 0x268, 1, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_FEC_TXD0__ESAI1_TX4_RX1               IOMUX_PAD(0x5E4, 0x268, 2, 0x7F4, 0, NO_PAD_CTRL)
+#define MX53_PAD_FEC_TXD0__USBPHY2_DATAOUT_0           IOMUX_PAD(0x5E4, 0x268, 7, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_FEC_MDC__FEC_MDC                      IOMUX_PAD(0x5E8, 0x26C, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_FEC_MDC__GPIO1_31                     IOMUX_PAD(0x5E8, 0x26C, 1, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_FEC_MDC__ESAI1_TX5_RX0                        IOMUX_PAD(0x5E8, 0x26C, 2, 0x7F8, 0, NO_PAD_CTRL)
+#define MX53_PAD_FEC_MDC__MLB_MLBDAT                   IOMUX_PAD(0x5E8, 0x26C, 3, 0x85C, 1, NO_PAD_CTRL)
+#define MX53_PAD_FEC_MDC__RTC_CE_RTC_ALARM1_TRIG       IOMUX_PAD(0x5E8, 0x26C, 4, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_FEC_MDC__USBPHY2_DATAOUT_1            IOMUX_PAD(0x5E8, 0x26C, 7, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_PATA_DIOW__PATA_DIOW                  IOMUX_PAD(0x5F0, 0x270, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_PATA_DIOW__GPIO6_17                   IOMUX_PAD(0x5F0, 0x270, 1, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_PATA_DIOW__UART1_TXD_MUX              IOMUX_PAD(0x5F0, 0x270, 3, __NA_, 0, MX53_UART_PAD_CTRL)
+#define MX53_PAD_PATA_DIOW__USBPHY2_DATAOUT_2          IOMUX_PAD(0x5F0, 0x270, 7, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_PATA_DMACK__PATA_DMACK                        IOMUX_PAD(0x5F4, 0x274, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_PATA_DMACK__GPIO6_18                  IOMUX_PAD(0x5F4, 0x274, 1, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_PATA_DMACK__UART1_RXD_MUX             IOMUX_PAD(0x5F4, 0x274, 3, 0x878, 3, MX53_UART_PAD_CTRL)
+#define MX53_PAD_PATA_DMACK__USBPHY2_DATAOUT_3         IOMUX_PAD(0x5F4, 0x274, 7, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_PATA_DMARQ__PATA_DMARQ                        IOMUX_PAD(0x5F8, 0x278, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_PATA_DMARQ__GPIO7_0                   IOMUX_PAD(0x5F8, 0x278, 1, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_PATA_DMARQ__UART2_TXD_MUX             IOMUX_PAD(0x5F8, 0x278, 3, __NA_, 0, MX53_UART_PAD_CTRL)
+#define MX53_PAD_PATA_DMARQ__CCM_CCM_OUT_0             IOMUX_PAD(0x5F8, 0x278, 5, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_PATA_DMARQ__USBPHY2_DATAOUT_4         IOMUX_PAD(0x5F8, 0x278, 7, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_PATA_BUFFER_EN__PATA_BUFFER_EN                IOMUX_PAD(0x5FC, 0x27C, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_PATA_BUFFER_EN__GPIO7_1               IOMUX_PAD(0x5FC, 0x27C, 1, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_PATA_BUFFER_EN__UART2_RXD_MUX         IOMUX_PAD(0x5FC, 0x27C, 3, 0x880, 3, MX53_UART_PAD_CTRL)
+#define MX53_PAD_PATA_BUFFER_EN__CCM_CCM_OUT_1         IOMUX_PAD(0x5FC, 0x27C, 5, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_PATA_BUFFER_EN__USBPHY2_DATAOUT_5     IOMUX_PAD(0x5FC, 0x27C, 7, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_PATA_INTRQ__PATA_INTRQ                        IOMUX_PAD(0x600, 0x280, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_PATA_INTRQ__GPIO7_2                   IOMUX_PAD(0x600, 0x280, 1, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_PATA_INTRQ__UART2_CTS                 IOMUX_PAD(0x600, 0x280, 3, __NA_, 0, MX53_UART_PAD_CTRL)
+#define MX53_PAD_PATA_INTRQ__CAN1_TXCAN                        IOMUX_PAD(0x600, 0x280, 4, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_PATA_INTRQ__CCM_CCM_OUT_2             IOMUX_PAD(0x600, 0x280, 5, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_PATA_INTRQ__USBPHY2_DATAOUT_6         IOMUX_PAD(0x600, 0x280, 7, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_PATA_DIOR__PATA_DIOR                  IOMUX_PAD(0x604, 0x284, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_PATA_DIOR__GPIO7_3                    IOMUX_PAD(0x604, 0x284, 1, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_PATA_DIOR__UART2_RTS                  IOMUX_PAD(0x604, 0x284, 3, 0x87C, 3, MX53_UART_PAD_CTRL)
+#define MX53_PAD_PATA_DIOR__CAN1_RXCAN                 IOMUX_PAD(0x604, 0x284, 4, 0x760, 1, NO_PAD_CTRL)
+#define MX53_PAD_PATA_DIOR__USBPHY2_DATAOUT_7          IOMUX_PAD(0x604, 0x284, 7, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_PATA_RESET_B__PATA_PATA_RESET_B       IOMUX_PAD(0x608, 0x288, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_PATA_RESET_B__GPIO7_4                 IOMUX_PAD(0x608, 0x288, 1, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_PATA_RESET_B__ESDHC3_CMD              IOMUX_PAD(0x608, 0x288, 2, __NA_, 0, MX53_SDHC_PAD_CTRL)
+#define MX53_PAD_PATA_RESET_B__UART1_CTS               IOMUX_PAD(0x608, 0x288, 3, __NA_, 0, MX53_UART_PAD_CTRL)
+#define MX53_PAD_PATA_RESET_B__CAN2_TXCAN              IOMUX_PAD(0x608, 0x288, 4, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_PATA_RESET_B__USBPHY1_DATAOUT_0       IOMUX_PAD(0x608, 0x288, 7, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_PATA_IORDY__PATA_IORDY                        IOMUX_PAD(0x60C, 0x28C, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_PATA_IORDY__GPIO7_5                   IOMUX_PAD(0x60C, 0x28C, 1, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_PATA_IORDY__ESDHC3_CLK                        IOMUX_PAD(0x60C, 0x28C, 2, __NA_, 0, MX53_SDHC_PAD_CTRL)
+#define MX53_PAD_PATA_IORDY__UART1_RTS                 IOMUX_PAD(0x60C, 0x28C, 3, 0x874, 3, MX53_UART_PAD_CTRL)
+#define MX53_PAD_PATA_IORDY__CAN2_RXCAN                        IOMUX_PAD(0x60C, 0x28C, 4, 0x764, 1, NO_PAD_CTRL)
+#define MX53_PAD_PATA_IORDY__USBPHY1_DATAOUT_1         IOMUX_PAD(0x60C, 0x28C, 7, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_PATA_DA_0__PATA_DA_0                  IOMUX_PAD(0x610, 0x290, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_PATA_DA_0__GPIO7_6                    IOMUX_PAD(0x610, 0x290, 1, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_PATA_DA_0__ESDHC3_RST                 IOMUX_PAD(0x610, 0x290, 2, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_PATA_DA_0__OWIRE_LINE                 IOMUX_PAD(0x610, 0x290, 4, 0x864, 0, NO_PAD_CTRL)
+#define MX53_PAD_PATA_DA_0__USBPHY1_DATAOUT_2          IOMUX_PAD(0x610, 0x290, 7, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_PATA_DA_1__PATA_DA_1                  IOMUX_PAD(0x614, 0x294, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_PATA_DA_1__GPIO7_7                    IOMUX_PAD(0x614, 0x294, 1, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_PATA_DA_1__ESDHC4_CMD                 IOMUX_PAD(0x614, 0x294, 2, __NA_, 0, MX53_SDHC_PAD_CTRL)
+#define MX53_PAD_PATA_DA_1__UART3_CTS                  IOMUX_PAD(0x614, 0x294, 4, __NA_, 0, MX53_UART_PAD_CTRL)
+#define MX53_PAD_PATA_DA_1__USBPHY1_DATAOUT_3          IOMUX_PAD(0x614, 0x294, 7, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_PATA_DA_2__PATA_DA_2                  IOMUX_PAD(0x618, 0x298, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_PATA_DA_2__GPIO7_8                    IOMUX_PAD(0x618, 0x298, 1, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_PATA_DA_2__ESDHC4_CLK                 IOMUX_PAD(0x618, 0x298, 2, __NA_, 0, MX53_SDHC_PAD_CTRL)
+#define MX53_PAD_PATA_DA_2__UART3_RTS                  IOMUX_PAD(0x618, 0x298, 4, 0x884, 5, MX53_UART_PAD_CTRL)
+#define MX53_PAD_PATA_DA_2__USBPHY1_DATAOUT_4          IOMUX_PAD(0x618, 0x298, 7, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_PATA_CS_0__PATA_CS_0                  IOMUX_PAD(0x61C, 0x29C, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_PATA_CS_0__GPIO7_9                    IOMUX_PAD(0x61C, 0x29C, 1, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_PATA_CS_0__UART3_TXD_MUX              IOMUX_PAD(0x61C, 0x29C, 4, __NA_, 0, MX53_UART_PAD_CTRL)
+#define MX53_PAD_PATA_CS_0__USBPHY1_DATAOUT_5          IOMUX_PAD(0x61C, 0x29C, 7, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_PATA_CS_1__PATA_CS_1                  IOMUX_PAD(0x620, 0x2A0, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_PATA_CS_1__GPIO7_10                   IOMUX_PAD(0x620, 0x2A0, 1, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_PATA_CS_1__UART3_RXD_MUX              IOMUX_PAD(0x620, 0x2A0, 4, 0x888, 3, MX53_UART_PAD_CTRL)
+#define MX53_PAD_PATA_CS_1__USBPHY1_DATAOUT_6          IOMUX_PAD(0x620, 0x2A0, 7, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_PATA_DATA0__PATA_DATA_0               IOMUX_PAD(0x628, 0x2A4, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_PATA_DATA0__GPIO2_0                   IOMUX_PAD(0x628, 0x2A4, 1, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_PATA_DATA0__EMI_NANDF_D_0             IOMUX_PAD(0x628, 0x2A4, 3, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_PATA_DATA0__ESDHC3_DAT4               IOMUX_PAD(0x628, 0x2A4, 4, __NA_, 0, MX53_SDHC_PAD_CTRL)
+#define MX53_PAD_PATA_DATA0__GPU3d_GPU_DEBUG_OUT_0     IOMUX_PAD(0x628, 0x2A4, 5, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_PATA_DATA0__IPU_DIAG_BUS_0            IOMUX_PAD(0x628, 0x2A4, 6, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_PATA_DATA0__USBPHY1_DATAOUT_7         IOMUX_PAD(0x628, 0x2A4, 7, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_PATA_DATA1__PATA_DATA_1               IOMUX_PAD(0x62C, 0x2A8, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_PATA_DATA1__GPIO2_1                   IOMUX_PAD(0x62C, 0x2A8, 1, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_PATA_DATA1__EMI_NANDF_D_1             IOMUX_PAD(0x62C, 0x2A8, 3, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_PATA_DATA1__ESDHC3_DAT5               IOMUX_PAD(0x62C, 0x2A8, 4, __NA_, 0, MX53_SDHC_PAD_CTRL)
+#define MX53_PAD_PATA_DATA1__GPU3d_GPU_DEBUG_OUT_1     IOMUX_PAD(0x62C, 0x2A8, 5, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_PATA_DATA1__IPU_DIAG_BUS_1            IOMUX_PAD(0x62C, 0x2A8, 6, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_PATA_DATA2__PATA_DATA_2               IOMUX_PAD(0x630, 0x2AC, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_PATA_DATA2__GPIO2_2                   IOMUX_PAD(0x630, 0x2AC, 1, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_PATA_DATA2__EMI_NANDF_D_2             IOMUX_PAD(0x630, 0x2AC, 3, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_PATA_DATA2__ESDHC3_DAT6               IOMUX_PAD(0x630, 0x2AC, 4, __NA_, 0, MX53_SDHC_PAD_CTRL)
+#define MX53_PAD_PATA_DATA2__GPU3d_GPU_DEBUG_OUT_2     IOMUX_PAD(0x630, 0x2AC, 5, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_PATA_DATA2__IPU_DIAG_BUS_2            IOMUX_PAD(0x630, 0x2AC, 6, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_PATA_DATA3__PATA_DATA_3               IOMUX_PAD(0x634, 0x2B0, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_PATA_DATA3__GPIO2_3                   IOMUX_PAD(0x634, 0x2B0, 1, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_PATA_DATA3__EMI_NANDF_D_3             IOMUX_PAD(0x634, 0x2B0, 3, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_PATA_DATA3__ESDHC3_DAT7               IOMUX_PAD(0x634, 0x2B0, 4, __NA_, 0, MX53_SDHC_PAD_CTRL)
+#define MX53_PAD_PATA_DATA3__GPU3d_GPU_DEBUG_OUT_3     IOMUX_PAD(0x634, 0x2B0, 5, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_PATA_DATA3__IPU_DIAG_BUS_3            IOMUX_PAD(0x634, 0x2B0, 6, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_PATA_DATA4__PATA_DATA_4               IOMUX_PAD(0x638, 0x2B4, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_PATA_DATA4__GPIO2_4                   IOMUX_PAD(0x638, 0x2B4, 1, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_PATA_DATA4__EMI_NANDF_D_4             IOMUX_PAD(0x638, 0x2B4, 3, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_PATA_DATA4__ESDHC4_DAT4               IOMUX_PAD(0x638, 0x2B4, 4, __NA_, 0, MX53_SDHC_PAD_CTRL)
+#define MX53_PAD_PATA_DATA4__GPU3d_GPU_DEBUG_OUT_4     IOMUX_PAD(0x638, 0x2B4, 5, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_PATA_DATA4__IPU_DIAG_BUS_4            IOMUX_PAD(0x638, 0x2B4, 6, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_PATA_DATA5__PATA_DATA_5               IOMUX_PAD(0x63C, 0x2B8, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_PATA_DATA5__GPIO2_5                   IOMUX_PAD(0x63C, 0x2B8, 1, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_PATA_DATA5__EMI_NANDF_D_5             IOMUX_PAD(0x63C, 0x2B8, 3, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_PATA_DATA5__ESDHC4_DAT5               IOMUX_PAD(0x63C, 0x2B8, 4, __NA_, 0, MX53_SDHC_PAD_CTRL)
+#define MX53_PAD_PATA_DATA5__GPU3d_GPU_DEBUG_OUT_5     IOMUX_PAD(0x63C, 0x2B8, 5, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_PATA_DATA5__IPU_DIAG_BUS_5            IOMUX_PAD(0x63C, 0x2B8, 6, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_PATA_DATA6__PATA_DATA_6               IOMUX_PAD(0x640, 0x2BC, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_PATA_DATA6__GPIO2_6                   IOMUX_PAD(0x640, 0x2BC, 1, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_PATA_DATA6__EMI_NANDF_D_6             IOMUX_PAD(0x640, 0x2BC, 3, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_PATA_DATA6__ESDHC4_DAT6               IOMUX_PAD(0x640, 0x2BC, 4, __NA_, 0, MX53_SDHC_PAD_CTRL)
+#define MX53_PAD_PATA_DATA6__GPU3d_GPU_DEBUG_OUT_6     IOMUX_PAD(0x640, 0x2BC, 5, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_PATA_DATA6__IPU_DIAG_BUS_6            IOMUX_PAD(0x640, 0x2BC, 6, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_PATA_DATA7__PATA_DATA_7               IOMUX_PAD(0x644, 0x2C0, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_PATA_DATA7__GPIO2_7                   IOMUX_PAD(0x644, 0x2C0, 1, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_PATA_DATA7__EMI_NANDF_D_7             IOMUX_PAD(0x644, 0x2C0, 3, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_PATA_DATA7__ESDHC4_DAT7               IOMUX_PAD(0x644, 0x2C0, 4, __NA_, 0, MX53_SDHC_PAD_CTRL)
+#define MX53_PAD_PATA_DATA7__GPU3d_GPU_DEBUG_OUT_7     IOMUX_PAD(0x644, 0x2C0, 5, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_PATA_DATA7__IPU_DIAG_BUS_7            IOMUX_PAD(0x644, 0x2C0, 6, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_PATA_DATA8__PATA_DATA_8               IOMUX_PAD(0x648, 0x2C4, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_PATA_DATA8__GPIO2_8                   IOMUX_PAD(0x648, 0x2C4, 1, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_PATA_DATA8__ESDHC1_DAT4               IOMUX_PAD(0x648, 0x2C4, 2, __NA_, 0, MX53_SDHC_PAD_CTRL)
+#define MX53_PAD_PATA_DATA8__EMI_NANDF_D_8             IOMUX_PAD(0x648, 0x2C4, 3, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_PATA_DATA8__ESDHC3_DAT0               IOMUX_PAD(0x648, 0x2C4, 4, __NA_, 0, MX53_SDHC_PAD_CTRL)
+#define MX53_PAD_PATA_DATA8__GPU3d_GPU_DEBUG_OUT_8     IOMUX_PAD(0x648, 0x2C4, 5, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_PATA_DATA8__IPU_DIAG_BUS_8            IOMUX_PAD(0x648, 0x2C4, 6, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_PATA_DATA9__PATA_DATA_9               IOMUX_PAD(0x64C, 0x2C8, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_PATA_DATA9__GPIO2_9                   IOMUX_PAD(0x64C, 0x2C8, 1, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_PATA_DATA9__ESDHC1_DAT5               IOMUX_PAD(0x64C, 0x2C8, 2, __NA_, 0, MX53_SDHC_PAD_CTRL)
+#define MX53_PAD_PATA_DATA9__EMI_NANDF_D_9             IOMUX_PAD(0x64C, 0x2C8, 3, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_PATA_DATA9__ESDHC3_DAT1               IOMUX_PAD(0x64C, 0x2C8, 4, __NA_, 0, MX53_SDHC_PAD_CTRL)
+#define MX53_PAD_PATA_DATA9__GPU3d_GPU_DEBUG_OUT_9     IOMUX_PAD(0x64C, 0x2C8, 5, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_PATA_DATA9__IPU_DIAG_BUS_9            IOMUX_PAD(0x64C, 0x2C8, 6, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_PATA_DATA10__PATA_DATA_10             IOMUX_PAD(0x650, 0x2CC, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_PATA_DATA10__GPIO2_10                 IOMUX_PAD(0x650, 0x2CC, 1, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_PATA_DATA10__ESDHC1_DAT6              IOMUX_PAD(0x650, 0x2CC, 2, __NA_, 0, MX53_SDHC_PAD_CTRL)
+#define MX53_PAD_PATA_DATA10__EMI_NANDF_D_10           IOMUX_PAD(0x650, 0x2CC, 3, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_PATA_DATA10__ESDHC3_DAT2              IOMUX_PAD(0x650, 0x2CC, 4, __NA_, 0, MX53_SDHC_PAD_CTRL)
+#define MX53_PAD_PATA_DATA10__GPU3d_GPU_DEBUG_OUT_10   IOMUX_PAD(0x650, 0x2CC, 5, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_PATA_DATA10__IPU_DIAG_BUS_10          IOMUX_PAD(0x650, 0x2CC, 6, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_PATA_DATA11__PATA_DATA_11             IOMUX_PAD(0x654, 0x2D0, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_PATA_DATA11__GPIO2_11                 IOMUX_PAD(0x654, 0x2D0, 1, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_PATA_DATA11__ESDHC1_DAT7              IOMUX_PAD(0x654, 0x2D0, 2, __NA_, 0, MX53_SDHC_PAD_CTRL)
+#define MX53_PAD_PATA_DATA11__EMI_NANDF_D_11           IOMUX_PAD(0x654, 0x2D0, 3, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_PATA_DATA11__ESDHC3_DAT3              IOMUX_PAD(0x654, 0x2D0, 4, __NA_, 0, MX53_SDHC_PAD_CTRL)
+#define MX53_PAD_PATA_DATA11__GPU3d_GPU_DEBUG_OUT_11   IOMUX_PAD(0x654, 0x2D0, 5, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_PATA_DATA11__IPU_DIAG_BUS_11          IOMUX_PAD(0x654, 0x2D0, 6, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_PATA_DATA12__PATA_DATA_12             IOMUX_PAD(0x658, 0x2D4, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_PATA_DATA12__GPIO2_12                 IOMUX_PAD(0x658, 0x2D4, 1, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_PATA_DATA12__ESDHC2_DAT4              IOMUX_PAD(0x658, 0x2D4, 2, __NA_, 0, MX53_SDHC_PAD_CTRL)
+#define MX53_PAD_PATA_DATA12__EMI_NANDF_D_12           IOMUX_PAD(0x658, 0x2D4, 3, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_PATA_DATA12__ESDHC4_DAT0              IOMUX_PAD(0x658, 0x2D4, 4, __NA_, 0, MX53_SDHC_PAD_CTRL)
+#define MX53_PAD_PATA_DATA12__GPU3d_GPU_DEBUG_OUT_12   IOMUX_PAD(0x658, 0x2D4, 5, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_PATA_DATA12__IPU_DIAG_BUS_12          IOMUX_PAD(0x658, 0x2D4, 6, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_PATA_DATA13__PATA_DATA_13             IOMUX_PAD(0x65C, 0x2D8, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_PATA_DATA13__GPIO2_13                 IOMUX_PAD(0x65C, 0x2D8, 1, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_PATA_DATA13__ESDHC2_DAT5              IOMUX_PAD(0x65C, 0x2D8, 2, __NA_, 0, MX53_SDHC_PAD_CTRL)
+#define MX53_PAD_PATA_DATA13__EMI_NANDF_D_13           IOMUX_PAD(0x65C, 0x2D8, 3, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_PATA_DATA13__ESDHC4_DAT1              IOMUX_PAD(0x65C, 0x2D8, 4, __NA_, 0, MX53_SDHC_PAD_CTRL)
+#define MX53_PAD_PATA_DATA13__GPU3d_GPU_DEBUG_OUT_13   IOMUX_PAD(0x65C, 0x2D8, 5, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_PATA_DATA13__IPU_DIAG_BUS_13          IOMUX_PAD(0x65C, 0x2D8, 6, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_PATA_DATA14__PATA_DATA_14             IOMUX_PAD(0x660, 0x2DC, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_PATA_DATA14__GPIO2_14                 IOMUX_PAD(0x660, 0x2DC, 1, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_PATA_DATA14__ESDHC2_DAT6              IOMUX_PAD(0x660, 0x2DC, 2, __NA_, 0, MX53_SDHC_PAD_CTRL)
+#define MX53_PAD_PATA_DATA14__EMI_NANDF_D_14           IOMUX_PAD(0x660, 0x2DC, 3, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_PATA_DATA14__ESDHC4_DAT2              IOMUX_PAD(0x660, 0x2DC, 4, __NA_, 0, MX53_SDHC_PAD_CTRL)
+#define MX53_PAD_PATA_DATA14__GPU3d_GPU_DEBUG_OUT_14   IOMUX_PAD(0x660, 0x2DC, 5, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_PATA_DATA14__IPU_DIAG_BUS_14          IOMUX_PAD(0x660, 0x2DC, 6, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_PATA_DATA15__PATA_DATA_15             IOMUX_PAD(0x664, 0x2E0, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_PATA_DATA15__GPIO2_15                 IOMUX_PAD(0x664, 0x2E0, 1, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_PATA_DATA15__ESDHC2_DAT7              IOMUX_PAD(0x664, 0x2E0, 2, __NA_, 0, MX53_SDHC_PAD_CTRL)
+#define MX53_PAD_PATA_DATA15__EMI_NANDF_D_15           IOMUX_PAD(0x664, 0x2E0, 3, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_PATA_DATA15__ESDHC4_DAT3              IOMUX_PAD(0x664, 0x2E0, 4, __NA_, 0, MX53_SDHC_PAD_CTRL)
+#define MX53_PAD_PATA_DATA15__GPU3d_GPU_DEBUG_OUT_15   IOMUX_PAD(0x664, 0x2E0, 5, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_PATA_DATA15__IPU_DIAG_BUS_15          IOMUX_PAD(0x664, 0x2E0, 6, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_SD1_DATA0__ESDHC1_DAT0                        IOMUX_PAD(0x66C, 0x2E4, 0, __NA_, 0, MX53_SDHC_PAD_CTRL)
+#define MX53_PAD_SD1_DATA0__GPIO1_16                   IOMUX_PAD(0x66C, 0x2E4, 1, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_SD1_DATA0__GPT_CAPIN1                 IOMUX_PAD(0x66C, 0x2E4, 3, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_SD1_DATA0__CSPI_MISO                  IOMUX_PAD(0x66C, 0x2E4, 5, 0x784, 2, NO_PAD_CTRL)
+#define MX53_PAD_SD1_DATA0__CCM_PLL3_BYP               IOMUX_PAD(0x66C, 0x2E4, 7, 0x778, 0, NO_PAD_CTRL)
+#define MX53_PAD_SD1_DATA1__ESDHC1_DAT1                        IOMUX_PAD(0x670, 0x2E8, 0, __NA_, 0, MX53_SDHC_PAD_CTRL)
+#define MX53_PAD_SD1_DATA1__GPIO1_17                   IOMUX_PAD(0x670, 0x2E8, 1, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_SD1_DATA1__GPT_CAPIN2                 IOMUX_PAD(0x670, 0x2E8, 3, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_SD1_DATA1__CSPI_SS0                   IOMUX_PAD(0x670, 0x2E8, 5, 0x78C, 3, NO_PAD_CTRL)
+#define MX53_PAD_SD1_DATA1__CCM_PLL4_BYP               IOMUX_PAD(0x670, 0x2E8, 7, 0x77C, 1, NO_PAD_CTRL)
+#define MX53_PAD_SD1_CMD__ESDHC1_CMD                   IOMUX_PAD(0x674, 0x2EC, 0 | IOMUX_CONFIG_SION, __NA_, 0, MX53_SDHC_PAD_CTRL)
+#define MX53_PAD_SD1_CMD__GPIO1_18                     IOMUX_PAD(0x674, 0x2EC, 1, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_SD1_CMD__GPT_CMPOUT1                  IOMUX_PAD(0x674, 0x2EC, 3, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_SD1_CMD__CSPI_MOSI                    IOMUX_PAD(0x674, 0x2EC, 5, 0x788, 2, NO_PAD_CTRL)
+#define MX53_PAD_SD1_CMD__CCM_PLL1_BYP                 IOMUX_PAD(0x674, 0x2EC, 7, 0x770, 0, NO_PAD_CTRL)
+#define MX53_PAD_SD1_DATA2__ESDHC1_DAT2                        IOMUX_PAD(0x678, 0x2F0, 0, __NA_, 0, MX53_SDHC_PAD_CTRL)
+#define MX53_PAD_SD1_DATA2__GPIO1_19                   IOMUX_PAD(0x678, 0x2F0, 1, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_SD1_DATA2__GPT_CMPOUT2                        IOMUX_PAD(0x678, 0x2F0, 2, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_SD1_DATA2__PWM2_PWMO                  IOMUX_PAD(0x678, 0x2F0, 3, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_SD1_DATA2__WDOG1_WDOG_B               IOMUX_PAD(0x678, 0x2F0, 4, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_SD1_DATA2__CSPI_SS1                   IOMUX_PAD(0x678, 0x2F0, 5, 0x790, 2, NO_PAD_CTRL)
+#define MX53_PAD_SD1_DATA2__WDOG1_WDOG_RST_B_DEB       IOMUX_PAD(0x678, 0x2F0, 6, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_SD1_DATA2__CCM_PLL2_BYP               IOMUX_PAD(0x678, 0x2F0, 7, 0x774, 0, NO_PAD_CTRL)
+#define MX53_PAD_SD1_CLK__ESDHC1_CLK                   IOMUX_PAD(0x67C, 0x2F4, 0, __NA_, 0, MX53_SDHC_PAD_CTRL)
+#define MX53_PAD_SD1_CLK__GPIO1_20                     IOMUX_PAD(0x67C, 0x2F4, 1, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_SD1_CLK__OSC32k_32K_OUT               IOMUX_PAD(0x67C, 0x2F4, 2, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_SD1_CLK__GPT_CLKIN                    IOMUX_PAD(0x67C, 0x2F4, 3, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_SD1_CLK__CSPI_SCLK                    IOMUX_PAD(0x67C, 0x2F4, 5, 0x780, 2, NO_PAD_CTRL)
+#define MX53_PAD_SD1_CLK__SATA_PHY_DTB_0               IOMUX_PAD(0x67C, 0x2F4, 7, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_SD1_DATA3__ESDHC1_DAT3                        IOMUX_PAD(0x680, 0x2F8, 0, __NA_, 0, MX53_SDHC_PAD_CTRL)
+#define MX53_PAD_SD1_DATA3__GPIO1_21                   IOMUX_PAD(0x680, 0x2F8, 1, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_SD1_DATA3__GPT_CMPOUT3                        IOMUX_PAD(0x680, 0x2F8, 2, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_SD1_DATA3__PWM1_PWMO                  IOMUX_PAD(0x680, 0x2F8, 3, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_SD1_DATA3__WDOG2_WDOG_B               IOMUX_PAD(0x680, 0x2F8, 4, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_SD1_DATA3__CSPI_SS2                   IOMUX_PAD(0x680, 0x2F8, 5, 0x794, 2, NO_PAD_CTRL)
+#define MX53_PAD_SD1_DATA3__WDOG2_WDOG_RST_B_DEB       IOMUX_PAD(0x680, 0x2F8, 6, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_SD1_DATA3__SATA_PHY_DTB_1             IOMUX_PAD(0x680, 0x2F8, 7, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_SD2_CLK__ESDHC2_CLK                   IOMUX_PAD(0x688, 0x2FC, 0, __NA_, 0, MX53_SDHC_PAD_CTRL)
+#define MX53_PAD_SD2_CLK__GPIO1_10                     IOMUX_PAD(0x688, 0x2FC, 1, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_SD2_CLK__KPP_COL_5                    IOMUX_PAD(0x688, 0x2FC, 2, 0x840, 2, NO_PAD_CTRL)
+#define MX53_PAD_SD2_CLK__AUDMUX_AUD4_RXFS             IOMUX_PAD(0x688, 0x2FC, 3, 0x73C, 1, NO_PAD_CTRL)
+#define MX53_PAD_SD2_CLK__CSPI_SCLK                    IOMUX_PAD(0x688, 0x2FC, 5, 0x780, 3, NO_PAD_CTRL)
+#define MX53_PAD_SD2_CLK__SCC_RANDOM_V                 IOMUX_PAD(0x688, 0x2FC, 7, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_SD2_CMD__ESDHC2_CMD                   IOMUX_PAD(0x68C, 0x300, 0, __NA_, 0, MX53_SDHC_PAD_CTRL)
+#define MX53_PAD_SD2_CMD__GPIO1_11                     IOMUX_PAD(0x68C, 0x300, 1, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_SD2_CMD__KPP_ROW_5                    IOMUX_PAD(0x68C, 0x300, 2, 0x84C, 1, NO_PAD_CTRL)
+#define MX53_PAD_SD2_CMD__AUDMUX_AUD4_RXC              IOMUX_PAD(0x68C, 0x300, 3, 0x738, 1, NO_PAD_CTRL)
+#define MX53_PAD_SD2_CMD__CSPI_MOSI                    IOMUX_PAD(0x68C, 0x300, 5, 0x788, 3, NO_PAD_CTRL)
+#define MX53_PAD_SD2_CMD__SCC_RANDOM                   IOMUX_PAD(0x68C, 0x300, 7, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_SD2_DATA3__ESDHC2_DAT3                        IOMUX_PAD(0x690, 0x304, 0, __NA_, 0, MX53_SDHC_PAD_CTRL)
+#define MX53_PAD_SD2_DATA3__GPIO1_12                   IOMUX_PAD(0x690, 0x304, 1, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_SD2_DATA3__KPP_COL_6                  IOMUX_PAD(0x690, 0x304, 2, 0x844, 1, NO_PAD_CTRL)
+#define MX53_PAD_SD2_DATA3__AUDMUX_AUD4_TXC            IOMUX_PAD(0x690, 0x304, 3, 0x740, 1, NO_PAD_CTRL)
+#define MX53_PAD_SD2_DATA3__CSPI_SS2                   IOMUX_PAD(0x690, 0x304, 5, 0x794, 3, NO_PAD_CTRL)
+#define MX53_PAD_SD2_DATA3__SJC_DONE                   IOMUX_PAD(0x690, 0x304, 7, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_SD2_DATA2__ESDHC2_DAT2                        IOMUX_PAD(0x694, 0x308, 0, __NA_, 0, MX53_SDHC_PAD_CTRL)
+#define MX53_PAD_SD2_DATA2__GPIO1_13                   IOMUX_PAD(0x694, 0x308, 1, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_SD2_DATA2__KPP_ROW_6                  IOMUX_PAD(0x694, 0x308, 2, 0x850, 1, NO_PAD_CTRL)
+#define MX53_PAD_SD2_DATA2__AUDMUX_AUD4_TXD            IOMUX_PAD(0x694, 0x308, 3, 0x734, 1, NO_PAD_CTRL)
+#define MX53_PAD_SD2_DATA2__CSPI_SS1                   IOMUX_PAD(0x694, 0x308, 5, 0x790, 3, NO_PAD_CTRL)
+#define MX53_PAD_SD2_DATA2__SJC_FAIL                   IOMUX_PAD(0x694, 0x308, 7, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_SD2_DATA1__ESDHC2_DAT1                        IOMUX_PAD(0x698, 0x30C, 0, __NA_, 0, MX53_SDHC_PAD_CTRL)
+#define MX53_PAD_SD2_DATA1__GPIO1_14                   IOMUX_PAD(0x698, 0x30C, 1, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_SD2_DATA1__KPP_COL_7                  IOMUX_PAD(0x698, 0x30C, 2, 0x848, 1, NO_PAD_CTRL)
+#define MX53_PAD_SD2_DATA1__AUDMUX_AUD4_TXFS           IOMUX_PAD(0x698, 0x30C, 3, 0x744, 0, NO_PAD_CTRL)
+#define MX53_PAD_SD2_DATA1__CSPI_SS0                   IOMUX_PAD(0x698, 0x30C, 5, 0x78C, 4, NO_PAD_CTRL)
+#define MX53_PAD_SD2_DATA1__RTIC_SEC_VIO               IOMUX_PAD(0x698, 0x30C, 7, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_SD2_DATA0__ESDHC2_DAT0                        IOMUX_PAD(0x69C, 0x310, 0, __NA_, 0, MX53_SDHC_PAD_CTRL)
+#define MX53_PAD_SD2_DATA0__GPIO1_15                   IOMUX_PAD(0x69C, 0x310, 1, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_SD2_DATA0__KPP_ROW_7                  IOMUX_PAD(0x69C, 0x310, 2, 0x854, 1, NO_PAD_CTRL)
+#define MX53_PAD_SD2_DATA0__AUDMUX_AUD4_RXD            IOMUX_PAD(0x69C, 0x310, 3, 0x730, 1, NO_PAD_CTRL)
+#define MX53_PAD_SD2_DATA0__CSPI_MISO                  IOMUX_PAD(0x69C, 0x310, 5, 0x784, 3, NO_PAD_CTRL)
+#define MX53_PAD_SD2_DATA0__RTIC_DONE_INT              IOMUX_PAD(0x69C, 0x310, 7, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_GPIO_0__CCM_CLKO                      IOMUX_PAD(0x6A4, 0x314, 0, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_GPIO_0__GPIO1_0                       IOMUX_PAD(0x6A4, 0x314, 1, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_GPIO_0__KPP_COL_5                     IOMUX_PAD(0x6A4, 0x314, 2, 0x840, 3, NO_PAD_CTRL)
+#define MX53_PAD_GPIO_0__CCM_SSI_EXT1_CLK              IOMUX_PAD(0x6A4, 0x314, 3, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_GPIO_0__EPIT1_EPITO                   IOMUX_PAD(0x6A4, 0x314, 4, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_GPIO_0__SRTC_ALARM_DEB                        IOMUX_PAD(0x6A4, 0x314, 5, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_GPIO_0__USBOH3_USBH1_PWR              IOMUX_PAD(0x6A4, 0x314, 6, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_GPIO_0__CSU_TD                                IOMUX_PAD(0x6A4, 0x314, 7, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_GPIO_1__ESAI1_SCKR                    IOMUX_PAD(0x6A8, 0x318, 0, 0x7DC, 1, NO_PAD_CTRL)
+#define MX53_PAD_GPIO_1__GPIO1_1                       IOMUX_PAD(0x6A8, 0x318, 1, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_GPIO_1__KPP_ROW_5                     IOMUX_PAD(0x6A8, 0x318, 2, 0x84C, 2, NO_PAD_CTRL)
+#define MX53_PAD_GPIO_1__CCM_SSI_EXT2_CLK              IOMUX_PAD(0x6A8, 0x318, 3, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_GPIO_1__PWM2_PWMO                     IOMUX_PAD(0x6A8, 0x318, 4, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_GPIO_1__WDOG2_WDOG_B                  IOMUX_PAD(0x6A8, 0x318, 5, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_GPIO_1__ESDHC1_CD                     IOMUX_PAD(0x6A8, 0x318, 6, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_GPIO_1__SRC_TESTER_ACK                        IOMUX_PAD(0x6A8, 0x318, 7, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_GPIO_9__ESAI1_FSR                     IOMUX_PAD(0x6AC, 0x31C, 0, 0x7CC, 1, NO_PAD_CTRL)
+#define MX53_PAD_GPIO_9__GPIO1_9                       IOMUX_PAD(0x6AC, 0x31C, 1, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_GPIO_9__KPP_COL_6                     IOMUX_PAD(0x6AC, 0x31C, 2, 0x844, 2, NO_PAD_CTRL)
+#define MX53_PAD_GPIO_9__CCM_REF_EN_B                  IOMUX_PAD(0x6AC, 0x31C, 3, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_GPIO_9__PWM1_PWMO                     IOMUX_PAD(0x6AC, 0x31C, 4, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_GPIO_9__WDOG1_WDOG_B                  IOMUX_PAD(0x6AC, 0x31C, 5, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_GPIO_9__ESDHC1_WP                     IOMUX_PAD(0x6AC, 0x31C, 6, 0x7FC, 1, NO_PAD_CTRL)
+#define MX53_PAD_GPIO_9__SCC_FAIL_STATE                        IOMUX_PAD(0x6AC, 0x31C, 7, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_GPIO_3__ESAI1_HCKR                    IOMUX_PAD(0x6B0, 0x320, 0, 0x7D4, 1, NO_PAD_CTRL)
+#define MX53_PAD_GPIO_3__GPIO1_3                       IOMUX_PAD(0x6B0, 0x320, 1, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_GPIO_3__I2C3_SCL                      IOMUX_PAD(0x6B0, 0x320, 2 | IOMUX_CONFIG_SION, 0x824, 1, NO_PAD_CTRL)
+#define MX53_PAD_GPIO_3__DPLLIP1_TOG_EN                        IOMUX_PAD(0x6B0, 0x320, 3, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_GPIO_3__CCM_CLKO2                     IOMUX_PAD(0x6B0, 0x320, 4, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_GPIO_3__OBSERVE_MUX_OBSRV_INT_OUT0    IOMUX_PAD(0x6B0, 0x320, 5, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_GPIO_3__USBOH3_USBH1_OC               IOMUX_PAD(0x6B0, 0x320, 6, 0x8A0, 1, NO_PAD_CTRL)
+#define MX53_PAD_GPIO_3__MLB_MLBCLK                    IOMUX_PAD(0x6B0, 0x320, 7, 0x858, 2, NO_PAD_CTRL)
+#define MX53_PAD_GPIO_6__ESAI1_SCKT                    IOMUX_PAD(0x6B4, 0x324, 0, 0x7E0, 1, NO_PAD_CTRL)
+#define MX53_PAD_GPIO_6__GPIO1_6                       IOMUX_PAD(0x6B4, 0x324, 1, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_GPIO_6__I2C3_SDA                      IOMUX_PAD(0x6B4, 0x324, 2 | IOMUX_CONFIG_SION, 0x828, 1, NO_PAD_CTRL)
+#define MX53_PAD_GPIO_6__CCM_CCM_OUT_0                 IOMUX_PAD(0x6B4, 0x324, 3, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_GPIO_6__CSU_CSU_INT_DEB               IOMUX_PAD(0x6B4, 0x324, 4, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_GPIO_6__OBSERVE_MUX_OBSRV_INT_OUT1    IOMUX_PAD(0x6B4, 0x324, 5, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_GPIO_6__ESDHC2_LCTL                   IOMUX_PAD(0x6B4, 0x324, 6, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_GPIO_6__MLB_MLBSIG                    IOMUX_PAD(0x6B4, 0x324, 7, 0x860, 2, NO_PAD_CTRL)
+#define MX53_PAD_GPIO_2__ESAI1_FST                     IOMUX_PAD(0x6B8, 0x328, 0, 0x7D0, 1, NO_PAD_CTRL)
+#define MX53_PAD_GPIO_2__GPIO1_2                       IOMUX_PAD(0x6B8, 0x328, 1, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_GPIO_2__KPP_ROW_6                     IOMUX_PAD(0x6B8, 0x328, 2, 0x850, 2, NO_PAD_CTRL)
+#define MX53_PAD_GPIO_2__CCM_CCM_OUT_1                 IOMUX_PAD(0x6B8, 0x328, 3, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_GPIO_2__CSU_CSU_ALARM_AUT_0           IOMUX_PAD(0x6B8, 0x328, 4, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_GPIO_2__OBSERVE_MUX_OBSRV_INT_OUT2    IOMUX_PAD(0x6B8, 0x328, 5, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_GPIO_2__ESDHC2_WP                     IOMUX_PAD(0x6B8, 0x328, 6, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_GPIO_2__MLB_MLBDAT                    IOMUX_PAD(0x6B8, 0x328, 7, 0x85C, 2, NO_PAD_CTRL)
+#define MX53_PAD_GPIO_4__ESAI1_HCKT                    IOMUX_PAD(0x6BC, 0x32C, 0, 0x7D8, 1, NO_PAD_CTRL)
+#define MX53_PAD_GPIO_4__GPIO1_4                       IOMUX_PAD(0x6BC, 0x32C, 1, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_GPIO_4__KPP_COL_7                     IOMUX_PAD(0x6BC, 0x32C, 2, 0x848, 2, NO_PAD_CTRL)
+#define MX53_PAD_GPIO_4__CCM_CCM_OUT_2                 IOMUX_PAD(0x6BC, 0x32C, 3, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_GPIO_4__CSU_CSU_ALARM_AUT_1           IOMUX_PAD(0x6BC, 0x32C, 4, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_GPIO_4__OBSERVE_MUX_OBSRV_INT_OUT3    IOMUX_PAD(0x6BC, 0x32C, 5, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_GPIO_4__ESDHC2_CD                     IOMUX_PAD(0x6BC, 0x32C, 6, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_GPIO_4__SCC_SEC_STATE                 IOMUX_PAD(0x6BC, 0x32C, 7, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_GPIO_5__ESAI1_TX2_RX3                 IOMUX_PAD(0x6C0, 0x330, 0, 0x7EC, 1, NO_PAD_CTRL)
+#define MX53_PAD_GPIO_5__GPIO1_5                       IOMUX_PAD(0x6C0, 0x330, 1, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_GPIO_5__KPP_ROW_7                     IOMUX_PAD(0x6C0, 0x330, 2, 0x854, 2, NO_PAD_CTRL)
+#define MX53_PAD_GPIO_5__CCM_CLKO                      IOMUX_PAD(0x6C0, 0x330, 3, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_GPIO_5__CSU_CSU_ALARM_AUT_2           IOMUX_PAD(0x6C0, 0x330, 4, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_GPIO_5__OBSERVE_MUX_OBSRV_INT_OUT4    IOMUX_PAD(0x6C0, 0x330, 5, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_GPIO_5__I2C3_SCL                      IOMUX_PAD(0x6C0, 0x330, 6 | IOMUX_CONFIG_SION, 0x824, 2, NO_PAD_CTRL)
+#define MX53_PAD_GPIO_5__CCM_PLL1_BYP                  IOMUX_PAD(0x6C0, 0x330, 7, 0x770, 1, NO_PAD_CTRL)
+#define MX53_PAD_GPIO_7__ESAI1_TX4_RX1                 IOMUX_PAD(0x6C4, 0x334, 0, 0x7F4, 1, NO_PAD_CTRL)
+#define MX53_PAD_GPIO_7__GPIO1_7                       IOMUX_PAD(0x6C4, 0x334, 1, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_GPIO_7__EPIT1_EPITO                   IOMUX_PAD(0x6C4, 0x334, 2, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_GPIO_7__CAN1_TXCAN                    IOMUX_PAD(0x6C4, 0x334, 3, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_GPIO_7__UART2_TXD_MUX                 IOMUX_PAD(0x6C4, 0x334, 4, __NA_, 0, MX53_UART_PAD_CTRL)
+#define MX53_PAD_GPIO_7__FIRI_RXD                      IOMUX_PAD(0x6C4, 0x334, 5, 0x80C, 1, NO_PAD_CTRL)
+#define MX53_PAD_GPIO_7__SPDIF_PLOCK                   IOMUX_PAD(0x6C4, 0x334, 6, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_GPIO_7__CCM_PLL2_BYP                  IOMUX_PAD(0x6C4, 0x334, 7, 0x774, 1, NO_PAD_CTRL)
+#define MX53_PAD_GPIO_8__ESAI1_TX5_RX0                 IOMUX_PAD(0x6C8, 0x338, 0, 0x7F8, 1, NO_PAD_CTRL)
+#define MX53_PAD_GPIO_8__GPIO1_8                       IOMUX_PAD(0x6C8, 0x338, 1, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_GPIO_8__EPIT2_EPITO                   IOMUX_PAD(0x6C8, 0x338, 2, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_GPIO_8__CAN1_RXCAN                    IOMUX_PAD(0x6C8, 0x338, 3, 0x760, 2, NO_PAD_CTRL)
+#define MX53_PAD_GPIO_8__UART2_RXD_MUX                 IOMUX_PAD(0x6C8, 0x338, 4, 0x880, 5, MX53_UART_PAD_CTRL)
+#define MX53_PAD_GPIO_8__FIRI_TXD                      IOMUX_PAD(0x6C8, 0x338, 5, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_GPIO_8__SPDIF_SRCLK                   IOMUX_PAD(0x6C8, 0x338, 6, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_GPIO_8__CCM_PLL3_BYP                  IOMUX_PAD(0x6C8, 0x338, 7, 0x778, 1, NO_PAD_CTRL)
+#define MX53_PAD_GPIO_16__ESAI1_TX3_RX2                        IOMUX_PAD(0x6CC, 0x33C, 0, 0x7F0, 1, NO_PAD_CTRL)
+#define MX53_PAD_GPIO_16__GPIO7_11                     IOMUX_PAD(0x6CC, 0x33C, 1, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_GPIO_16__TZIC_PWRFAIL_INT             IOMUX_PAD(0x6CC, 0x33C, 2, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_GPIO_16__RTC_CE_RTC_EXT_TRIG1         IOMUX_PAD(0x6CC, 0x33C, 4, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_GPIO_16__SPDIF_IN1                    IOMUX_PAD(0x6CC, 0x33C, 5, 0x870, 1, NO_PAD_CTRL)
+#define MX53_PAD_GPIO_16__I2C3_SDA                     IOMUX_PAD(0x6CC, 0x33C, 6 | IOMUX_CONFIG_SION, 0x828, 2, NO_PAD_CTRL)
+#define MX53_PAD_GPIO_16__SJC_DE_B                     IOMUX_PAD(0x6CC, 0x33C, 7, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_GPIO_17__ESAI1_TX0                    IOMUX_PAD(0x6D0, 0x340, 0, 0x7E4, 1, NO_PAD_CTRL)
+#define MX53_PAD_GPIO_17__GPIO7_12                     IOMUX_PAD(0x6D0, 0x340, 1, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_GPIO_17__SDMA_EXT_EVENT_0             IOMUX_PAD(0x6D0, 0x340, 2, 0x868, 1, NO_PAD_CTRL)
+#define MX53_PAD_GPIO_17__GPC_PMIC_RDY                 IOMUX_PAD(0x6D0, 0x340, 3, 0x810, 1, NO_PAD_CTRL)
+#define MX53_PAD_GPIO_17__RTC_CE_RTC_FSV_TRIG          IOMUX_PAD(0x6D0, 0x340, 4, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_GPIO_17__SPDIF_OUT1                   IOMUX_PAD(0x6D0, 0x340, 5, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_GPIO_17__IPU_SNOOP2                   IOMUX_PAD(0x6D0, 0x340, 6, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_GPIO_17__SJC_JTAG_ACT                 IOMUX_PAD(0x6D0, 0x340, 7, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_GPIO_18__ESAI1_TX1                    IOMUX_PAD(0x6D4, 0x344, 0, 0x7E8, 1, NO_PAD_CTRL)
+#define MX53_PAD_GPIO_18__GPIO7_13                     IOMUX_PAD(0x6D4, 0x344, 1, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_GPIO_18__SDMA_EXT_EVENT_1             IOMUX_PAD(0x6D4, 0x344, 2, 0x86C, 1, NO_PAD_CTRL)
+#define MX53_PAD_GPIO_18__OWIRE_LINE                   IOMUX_PAD(0x6D4, 0x344, 3, 0x864, 1, NO_PAD_CTRL)
+#define MX53_PAD_GPIO_18__RTC_CE_RTC_ALARM2_TRIG       IOMUX_PAD(0x6D4, 0x344, 4, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_GPIO_18__CCM_ASRC_EXT_CLK             IOMUX_PAD(0x6D4, 0x344, 5, 0x768, 1, NO_PAD_CTRL)
+#define MX53_PAD_GPIO_18__ESDHC1_LCTL                  IOMUX_PAD(0x6D4, 0x344, 6, __NA_, 0, NO_PAD_CTRL)
+#define MX53_PAD_GPIO_18__SRC_SYSTEM_RST               IOMUX_PAD(0x6D4, 0x344, 7, __NA_, 0, NO_PAD_CTRL)
+
+#endif /* __MACH_IOMUX_MX53_H__ */
diff --git a/arch/arm/include/asm/arch-mx5/iomux-v3.h b/arch/arm/include/asm/arch-mx5/iomux-v3.h
new file mode 100644 (file)
index 0000000..e7869b6
--- /dev/null
@@ -0,0 +1,125 @@
+/*
+ * Copyright (C) 2009 by Jan Weitzel Phytec Messtechnik GmbH,
+ *                     <armlinux@phytec.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., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ */
+
+#ifndef __MACH_IOMUX_V3_H__
+#define __MACH_IOMUX_V3_H__
+
+#include <linux/compiler.h>
+
+/*
+ *     build IOMUX_PAD structure
+ *
+ * This iomux scheme is based around pads, which are the physical balls
+ * on the processor.
+ *
+ * - Each pad has a pad control register (IOMUXC_SW_PAD_CTRL_x) which controls
+ *   things like driving strength and pullup/pulldown.
+ * - Each pad can have but not necessarily does have an output routing register
+ *   (IOMUXC_SW_MUX_CTL_PAD_x).
+ * - Each pad can have but not necessarily does have an input routing register
+ *   (IOMUXC_x_SELECT_INPUT)
+ *
+ * The three register sets do not have a fixed offset to each other,
+ * hence we order this table by pad control registers (which all pads
+ * have) and put the optional i/o routing registers into additional
+ * fields.
+ *
+ * The naming convention for the pad modes is MX35_PAD_<padname>__<padmode>
+ * If <padname> or <padmode> refers to a GPIO, it is named
+ * GPIO_<unit>_<num>
+ *
+ * IOMUX/PAD Bit field definitions
+ *
+ * MUX_CTRL_OFS:           0..11 (12)
+ * PAD_CTRL_OFS:          12..23 (12)
+ * SEL_INPUT_OFS:         24..35 (12)
+ * MUX_MODE + SION:       36..40  (5)
+ * PAD_CTRL + NO_PAD_CTRL: 41..57 (17)
+ * SEL_INP:               58..61  (4)
+ * reserved:                63    (1)
+*/
+
+typedef u64 iomux_v3_cfg_t;
+
+#define MUX_CTRL_OFS_SHIFT     0
+#define MUX_CTRL_OFS_MASK      ((iomux_v3_cfg_t)0xfff << MUX_CTRL_OFS_SHIFT)
+#define MUX_PAD_CTRL_OFS_SHIFT 12
+#define MUX_PAD_CTRL_OFS_MASK  ((iomux_v3_cfg_t)0xfff << MUX_PAD_CTRL_OFS_SHIFT)
+#define MUX_SEL_INPUT_OFS_SHIFT        24
+#define MUX_SEL_INPUT_OFS_MASK ((iomux_v3_cfg_t)0xfff << MUX_SEL_INPUT_OFS_SHIFT)
+
+#define MUX_MODE_SHIFT         36
+#define MUX_MODE_MASK          ((iomux_v3_cfg_t)0x1f << MUX_MODE_SHIFT)
+#define MUX_PAD_CTRL_SHIFT     41
+#define MUX_PAD_CTRL_MASK      ((iomux_v3_cfg_t)0x1ffff << MUX_PAD_CTRL_SHIFT)
+#define MUX_SEL_INPUT_SHIFT    58
+#define MUX_SEL_INPUT_MASK     ((iomux_v3_cfg_t)0xf << MUX_SEL_INPUT_SHIFT)
+
+#define MUX_PAD_CTRL(x)                ((iomux_v3_cfg_t)(x) << MUX_PAD_CTRL_SHIFT)
+
+#define IOMUX_PAD(_pad_ctrl_ofs, _mux_ctrl_ofs, _mux_mode, _sel_input_ofs, \
+               _sel_input, _pad_ctrl)                                  \
+       (((iomux_v3_cfg_t)(_mux_ctrl_ofs) << MUX_CTRL_OFS_SHIFT) |      \
+               ((iomux_v3_cfg_t)(_mux_mode) << MUX_MODE_SHIFT) |       \
+               ((iomux_v3_cfg_t)(_pad_ctrl_ofs) << MUX_PAD_CTRL_OFS_SHIFT) | \
+               ((iomux_v3_cfg_t)(_pad_ctrl) << MUX_PAD_CTRL_SHIFT) |   \
+               ((iomux_v3_cfg_t)(_sel_input_ofs) << MUX_SEL_INPUT_OFS_SHIFT) | \
+               ((iomux_v3_cfg_t)(_sel_input) << MUX_SEL_INPUT_SHIFT))
+
+#define NEW_PAD_CTRL(cfg, pad) (((cfg) & ~MUX_PAD_CTRL_MASK) | MUX_PAD_CTRL(pad))
+/*
+ * Use to set PAD control
+ */
+
+#define NO_PAD_CTRL                    (1 << 16)
+#define PAD_CTL_DVS                    (1 << 13)
+#define PAD_CTL_HYS                    (1 << 8)
+
+#define PAD_CTL_PKE                    (1 << 7)
+#define PAD_CTL_PUE                    (1 << 6 | PAD_CTL_PKE)
+#define PAD_CTL_PUS_100K_DOWN          (0 << 4 | PAD_CTL_PUE)
+#define PAD_CTL_PUS_47K_UP             (1 << 4 | PAD_CTL_PUE)
+#define PAD_CTL_PUS_100K_UP            (2 << 4 | PAD_CTL_PUE)
+#define PAD_CTL_PUS_22K_UP             (3 << 4 | PAD_CTL_PUE)
+
+#define PAD_CTL_ODE                    (1 << 3)
+
+#define PAD_CTL_DSE_LOW                        (0 << 1)
+#define PAD_CTL_DSE_MED                        (1 << 1)
+#define PAD_CTL_DSE_HIGH               (2 << 1)
+#define PAD_CTL_DSE_MAX                        (3 << 1)
+
+#define PAD_CTL_SRE_FAST               (1 << 0)
+#define PAD_CTL_SRE_SLOW               (0 << 0)
+
+#define IOMUX_CONFIG_SION              (0x1 << 4)
+
+/*
+ * sets up a single pad in the iomuxer
+ */
+int mxc_iomux_v3_setup_pad(iomux_v3_cfg_t pad);
+
+/*
+ * sets up mutliple pads
+ * convenient way to call the above function with tables
+ */
+int mxc_iomux_v3_setup_multiple_pads(const iomux_v3_cfg_t *pad_list, unsigned count);
+
+#endif /* __MACH_IOMUX_V3_H__*/
+
index 760371b48f321147bb2588bf0a46d2f5011942c0..e3765a37e3db27e433852898f958693e97e5bde2 100644 (file)
@@ -66,8 +66,8 @@ typedef enum iomux_pad_config {
        PAD_CTL_HYS_ENABLE = 0x1 << 8,  /* Hysteresis enabled */
        PAD_CTL_DDR_INPUT_CMOS = 0x0 << 9,/* DDR input CMOS */
        PAD_CTL_DDR_INPUT_DDR = 0x1 << 9,/* DDR input DDR */
-       PAD_CTL_DRV_VOT_LOW = 0x0 << 13, /* Low voltage mode */
-       PAD_CTL_DRV_VOT_HIGH = 0x1 << 13,/* High voltage mode */
+       PAD_CTL_DRV_VOT_LOW = 0x1 << 13, /* Low voltage mode */
+       PAD_CTL_DRV_VOT_HIGH = 0x0 << 13,/* High voltage mode */
 } iomux_pad_config_t;
 
 /* various IOMUX input functions */
index 122fbeef6ad884e7660bb4c8cad7c8eb6958c8fc..ea34d6b063d249b8d789ba3c367831742932f432 100644 (file)
@@ -74,8 +74,8 @@
 
 #define MUX_IO_P                29
 #define MUX_IO_I                24
-#define IOMUX_TO_GPIO(pin)      ((((unsigned int)pin >> MUX_IO_P) * \
-                                       GPIO_NUM_PIN) + ((pin >> MUX_IO_I) &\
+#define IOMUX_TO_GPIO(pin)      ((((unsigned int)(pin) >> MUX_IO_P) *  \
+                                       GPIO_NUM_PIN) + (((pin) >> MUX_IO_I) & \
                                        ((1 << (MUX_IO_P - MUX_IO_I)) - 1)))
 #define IOMUX_TO_IRQ(pin)       (MXC_GPIO_INT_BASE + IOMUX_TO_GPIO(pin))
 
 #define _MXC_BUILD_PIN(gp, gi, ga, mi, pi) \
        (((gp) << MUX_IO_P) | ((gi) << MUX_IO_I) | \
        ((mi) << MUX_I) | \
-       ((pi - PAD_I_START) << PAD_I) | \
+       (((pi) - PAD_I_START) << PAD_I) |       \
        ((ga) << GPIO_I))
 
 #define _MXC_BUILD_GPIO_PIN(gp, gi, ga, mi, pi) \
 #define _MXC_BUILD_NON_GPIO_PIN(mi, pi) \
        _MXC_BUILD_PIN(NON_GPIO_PORT, 0, 0, mi, pi)
 
-#define PIN_TO_IOMUX_MUX(pin)  ((pin >> MUX_I) & PIN_TO_MUX_MASK)
-#define PIN_TO_IOMUX_PAD(pin)  ((pin >> PAD_I) & PIN_TO_PAD_MASK)
-#define PIN_TO_ALT_GPIO(pin)   ((pin >> GPIO_I) & PIN_TO_ALT_GPIO_MASK)
+#define PIN_TO_IOMUX_MUX(pin)  (((pin) >> MUX_I) & PIN_TO_MUX_MASK)
+#define PIN_TO_IOMUX_PAD(pin)  (((pin) >> PAD_I) & PIN_TO_PAD_MASK)
+#define PIN_TO_ALT_GPIO(pin)   (((pin) >> GPIO_I) & PIN_TO_ALT_GPIO_MASK)
 #define PIN_TO_IOMUX_INDEX(pin)        (PIN_TO_IOMUX_MUX(pin) >> 2)
 
 /*
index 13d12ee1a445dbb76dc4d1494f338bd854e8b6e3..7b5246eea67fe61b4fc6db6aefe34f3f41b59b96 100644 (file)
@@ -35,5 +35,8 @@ void set_chipselect_size(int const);
  */
 
 int fecmxc_initialize(bd_t *bis);
+u32 get_ahb_clk(void);
+u32 get_periph_clk(void);
+char *get_reset_cause(void);
 
 #endif
index 613809bdd672495727e4b3474cc8cd904820cb1a..b91d8bf45027f798b8e4825d71857246f0ee38ff 100644 (file)
@@ -47,5 +47,6 @@ u32 imx_get_uartclk(void);
 u32 imx_get_fecclk(void);
 unsigned int mxc_get_clock(enum mxc_clock clk);
 void enable_usboh3_clk(unsigned char enable);
+int enable_sata_clock(void);
 
 #endif /* __ASM_ARCH_CLOCK_H */
similarity index 99%
rename from arch/arm/include/asm/arch-mx6/ccm_regs.h
rename to arch/arm/include/asm/arch-mx6/crm_regs.h
index 4af0b901642ba09d43e466d258c379b5c88e7ebe..0e605c26f5923edb34197536e116bf79e6d38159 100644 (file)
@@ -20,7 +20,7 @@
 #ifndef __ARCH_ARM_MACH_MX6_CCM_REGS_H__
 #define __ARCH_ARM_MACH_MX6_CCM_REGS_H__
 
-struct imx_ccm_reg {
+struct mxc_ccm_reg {
        u32 ccr;        /* 0x0000 */
        u32 ccdr;
        u32 csr;
index 6d25c8d983fa146f5c56ffa0cb0d92fc4bbb4448..e165810ddc3d5c57aba4c157068054443ff5e724 100644 (file)
@@ -436,5 +436,14 @@ struct anatop_regs {
        u32     digprog;                /* 0x260 */
 };
 
+struct iomuxc_base_regs {
+       u32     gpr[14];        /* 0x000 */
+       u32     obsrv[5];       /* 0x038 */
+       u32     swmux_ctl[197]; /* 0x04c */
+       u32     swpad_ctl[250]; /* 0x360 */
+       u32     swgrp[26];      /* 0x748 */
+       u32     daisy[104];     /* 0x7b0..94c */
+};
+
 #endif /* __ASSEMBLER__*/
 #endif /* __ASM_ARCH_MX6_IMX_REGS_H__ */
index 4558f4fba251c26172634d5180dc6e8d1f44c46b..788b413219c2a4885674caf82a628f2df63abd80 100644 (file)
@@ -100,4 +100,115 @@ typedef u64 iomux_v3_cfg_t;
 int imx_iomux_v3_setup_pad(iomux_v3_cfg_t pad);
 int imx_iomux_v3_setup_multiple_pads(iomux_v3_cfg_t *pad_list, unsigned count);
 
+/*
+ * IOMUXC_GPR13 bit fields
+ */
+#define IOMUXC_GPR13_SDMA_STOP_REQ     (1<<30)
+#define IOMUXC_GPR13_CAN2_STOP_REQ     (1<<29)
+#define IOMUXC_GPR13_CAN1_STOP_REQ     (1<<28)
+#define IOMUXC_GPR13_ENET_STOP_REQ     (1<<27)
+#define IOMUXC_GPR13_SATA_PHY_8_MASK   (7<<24)
+#define IOMUXC_GPR13_SATA_PHY_7_MASK   (0x1f<<19)
+#define IOMUXC_GPR13_SATA_PHY_6_SHIFT  16
+#define IOMUXC_GPR13_SATA_PHY_6_MASK   (7<<IOMUXC_GPR13_SATA_PHY_6_SHIFT)
+#define IOMUXC_GPR13_SATA_SPEED_MASK   (1<<15)
+#define IOMUXC_GPR13_SATA_PHY_5_MASK   (1<<14)
+#define IOMUXC_GPR13_SATA_PHY_4_MASK   (7<<11)
+#define IOMUXC_GPR13_SATA_PHY_3_MASK   (0x1f<<7)
+#define IOMUXC_GPR13_SATA_PHY_2_MASK   (0x1f<<2)
+#define IOMUXC_GPR13_SATA_PHY_1_MASK   (3<<0)
+
+#define IOMUXC_GPR13_SATA_PHY_8_RXEQ_0P5DB     (0b000<<24)
+#define IOMUXC_GPR13_SATA_PHY_8_RXEQ_1P0DB     (0b001<<24)
+#define IOMUXC_GPR13_SATA_PHY_8_RXEQ_1P5DB     (0b010<<24)
+#define IOMUXC_GPR13_SATA_PHY_8_RXEQ_2P0DB     (0b011<<24)
+#define IOMUXC_GPR13_SATA_PHY_8_RXEQ_2P5DB     (0b100<<24)
+#define IOMUXC_GPR13_SATA_PHY_8_RXEQ_3P0DB     (0b101<<24)
+#define IOMUXC_GPR13_SATA_PHY_8_RXEQ_3P5DB     (0b110<<24)
+#define IOMUXC_GPR13_SATA_PHY_8_RXEQ_4P0DB     (0b111<<24)
+
+#define IOMUXC_GPR13_SATA_PHY_7_SATA1I (0b10000<<19)
+#define IOMUXC_GPR13_SATA_PHY_7_SATA1M (0b10000<<19)
+#define IOMUXC_GPR13_SATA_PHY_7_SATA1X (0b11010<<19)
+#define IOMUXC_GPR13_SATA_PHY_7_SATA2I (0b10010<<19)
+#define IOMUXC_GPR13_SATA_PHY_7_SATA2M (0b10010<<19)
+#define IOMUXC_GPR13_SATA_PHY_7_SATA2X (0b11010<<19)
+
+#define IOMUXC_GPR13_SATA_SPEED_1P5G   (0<<15)
+#define IOMUXC_GPR13_SATA_SPEED_3G     (1<<15)
+
+#define IOMUXC_GPR13_SATA_SATA_PHY_5_SS_DISABLED       (0<<14)
+#define IOMUXC_GPR13_SATA_SATA_PHY_5_SS_ENABLED                (1<<14)
+
+#define IOMUXC_GPR13_SATA_SATA_PHY_4_ATTEN_16_16       (0<<11)
+#define IOMUXC_GPR13_SATA_SATA_PHY_4_ATTEN_14_16       (1<<11)
+#define IOMUXC_GPR13_SATA_SATA_PHY_4_ATTEN_12_16       (2<<11)
+#define IOMUXC_GPR13_SATA_SATA_PHY_4_ATTEN_10_16       (3<<11)
+#define IOMUXC_GPR13_SATA_SATA_PHY_4_ATTEN_9_16                (4<<11)
+#define IOMUXC_GPR13_SATA_SATA_PHY_4_ATTEN_8_16                (5<<11)
+
+#define IOMUXC_GPR13_SATA_PHY_3_TXBOOST_0P00_DB        (0b0000<<7)
+#define IOMUXC_GPR13_SATA_PHY_3_TXBOOST_0P37_DB        (0b0001<<7)
+#define IOMUXC_GPR13_SATA_PHY_3_TXBOOST_0P74_DB        (0b0010<<7)
+#define IOMUXC_GPR13_SATA_PHY_3_TXBOOST_1P11_DB        (0b0011<<7)
+#define IOMUXC_GPR13_SATA_PHY_3_TXBOOST_1P48_DB        (0b0100<<7)
+#define IOMUXC_GPR13_SATA_PHY_3_TXBOOST_1P85_DB        (0b0101<<7)
+#define IOMUXC_GPR13_SATA_PHY_3_TXBOOST_2P22_DB        (0b0110<<7)
+#define IOMUXC_GPR13_SATA_PHY_3_TXBOOST_2P59_DB        (0b0111<<7)
+#define IOMUXC_GPR13_SATA_PHY_3_TXBOOST_2P96_DB        (0b1000<<7)
+#define IOMUXC_GPR13_SATA_PHY_3_TXBOOST_3P33_DB        (0b1001<<7)
+#define IOMUXC_GPR13_SATA_PHY_3_TXBOOST_3P70_DB        (0b1010<<7)
+#define IOMUXC_GPR13_SATA_PHY_3_TXBOOST_4P07_DB        (0b1011<<7)
+#define IOMUXC_GPR13_SATA_PHY_3_TXBOOST_4P44_DB        (0b1100<<7)
+#define IOMUXC_GPR13_SATA_PHY_3_TXBOOST_4P81_DB        (0b1101<<7)
+#define IOMUXC_GPR13_SATA_PHY_3_TXBOOST_5P28_DB        (0b1110<<7)
+#define IOMUXC_GPR13_SATA_PHY_3_TXBOOST_5P75_DB        (0b1111<<7)
+
+#define IOMUXC_GPR13_SATA_PHY_2_TX_0P937V      (0b00000<<2)
+#define IOMUXC_GPR13_SATA_PHY_2_TX_0P947V      (0b00001<<2)
+#define IOMUXC_GPR13_SATA_PHY_2_TX_0P957V      (0b00010<<2)
+#define IOMUXC_GPR13_SATA_PHY_2_TX_0P966V      (0b00011<<2)
+#define IOMUXC_GPR13_SATA_PHY_2_TX_0P976V      (0b00100<<2)
+#define IOMUXC_GPR13_SATA_PHY_2_TX_0P986V      (0b00101<<2)
+#define IOMUXC_GPR13_SATA_PHY_2_TX_0P996V      (0b00110<<2)
+#define IOMUXC_GPR13_SATA_PHY_2_TX_1P005V      (0b00111<<2)
+#define IOMUXC_GPR13_SATA_PHY_2_TX_1P015V      (0b01000<<2)
+#define IOMUXC_GPR13_SATA_PHY_2_TX_1P025V      (0b01001<<2)
+#define IOMUXC_GPR13_SATA_PHY_2_TX_1P035V      (0b01010<<2)
+#define IOMUXC_GPR13_SATA_PHY_2_TX_1P045V      (0b01011<<2)
+#define IOMUXC_GPR13_SATA_PHY_2_TX_1P054V      (0b01100<<2)
+#define IOMUXC_GPR13_SATA_PHY_2_TX_1P064V      (0b01101<<2)
+#define IOMUXC_GPR13_SATA_PHY_2_TX_1P074V      (0b01110<<2)
+#define IOMUXC_GPR13_SATA_PHY_2_TX_1P084V      (0b01111<<2)
+#define IOMUXC_GPR13_SATA_PHY_2_TX_1P094V      (0b10000<<2)
+#define IOMUXC_GPR13_SATA_PHY_2_TX_1P104V      (0b10001<<2)
+#define IOMUXC_GPR13_SATA_PHY_2_TX_1P113V      (0b10010<<2)
+#define IOMUXC_GPR13_SATA_PHY_2_TX_1P123V      (0b10011<<2)
+#define IOMUXC_GPR13_SATA_PHY_2_TX_1P133V      (0b10100<<2)
+#define IOMUXC_GPR13_SATA_PHY_2_TX_1P143V      (0b10101<<2)
+#define IOMUXC_GPR13_SATA_PHY_2_TX_1P152V      (0b10110<<2)
+#define IOMUXC_GPR13_SATA_PHY_2_TX_1P162V      (0b10111<<2)
+#define IOMUXC_GPR13_SATA_PHY_2_TX_1P172V      (0b11000<<2)
+#define IOMUXC_GPR13_SATA_PHY_2_TX_1P182V      (0b11001<<2)
+#define IOMUXC_GPR13_SATA_PHY_2_TX_1P191V      (0b11010<<2)
+#define IOMUXC_GPR13_SATA_PHY_2_TX_1P201V      (0b11011<<2)
+#define IOMUXC_GPR13_SATA_PHY_2_TX_1P211V      (0b11100<<2)
+#define IOMUXC_GPR13_SATA_PHY_2_TX_1P221V      (0b11101<<2)
+#define IOMUXC_GPR13_SATA_PHY_2_TX_1P230V      (0b11110<<2)
+#define IOMUXC_GPR13_SATA_PHY_2_TX_1P240V      (0b11111<<2)
+
+#define IOMUXC_GPR13_SATA_PHY_1_FAST   0
+#define IOMUXC_GPR13_SATA_PHY_1_MEDIUM 1
+#define IOMUXC_GPR13_SATA_PHY_1_SLOW   2
+
+#define IOMUXC_GPR13_SATA_MASK (IOMUXC_GPR13_SATA_PHY_8_MASK \
+                               |IOMUXC_GPR13_SATA_PHY_7_MASK \
+                               |IOMUXC_GPR13_SATA_PHY_6_MASK \
+                               |IOMUXC_GPR13_SATA_SPEED_MASK \
+                               |IOMUXC_GPR13_SATA_PHY_5_MASK \
+                               |IOMUXC_GPR13_SATA_PHY_4_MASK \
+                               |IOMUXC_GPR13_SATA_PHY_3_MASK \
+                               |IOMUXC_GPR13_SATA_PHY_2_MASK \
+                               |IOMUXC_GPR13_SATA_PHY_1_MASK)
+
 #endif /* __MACH_IOMUX_V3_H__*/
index 668e77af6ab09829b5c136e98740de858bc6f49b..711b30dfe2801b9186f8d752ed26cfef123448c9 100644 (file)
 
 u32 get_cpu_rev(void);
 
+void set_vddsoc(u32 mv);
+
 /*
  * Initializes on-chip ethernet controllers.
  * to override, implement board_eth_init()
  */
 
 int fecmxc_initialize(bd_t *bis);
-
+u32 get_ahb_clk(void);
+u32 get_periph_clk(void);
 #endif
index 84308e04b352b48e519c57ff47a1cdb1f535eed1..457f99d2c5056bc1408a93670b840d5344a43933 100644 (file)
@@ -474,12 +474,11 @@ struct prm {
        u8 res3[0x1c];
        u32 clksrc_ctrl;        /* 0x1270 */
 };
-#else /* __ASSEMBLY__ */
-#define PRM_RSTCTRL            0x48307250
-#define PRM_RSTCTRL_RESET      0x04
 #endif /* __ASSEMBLY__ */
 #endif /* __KERNEL_STRICT_NAMES */
 
+#define PRM_RSTCTRL            0x48307250
+#define PRM_RSTCTRL_RESET      0x04
 #define SYSCLKDIV_1            (0x1 << 6)
 #define SYSCLKDIV_2            (0x1 << 7)
 
index 6daef49e97fff9de1d06685bc8206be193a035d3..71f183de8d1f47e2db3654264ee42bf9c288eead 100644 (file)
 #define CONTROL_PADCONF_STRBEN_DLY1    0x0224
 #define CONTROL_PADCONF_SYS_BOOT8      0x0226
 
+/* AM/DM37xx specific */
+#define CONTROL_PADCONF_GPIO127                0x0A54
+#define CONTROL_PADCONF_GPIO126                0x0A56
+#define CONTROL_PADCONF_GPIO128                0x0A58
+#define CONTROL_PADCONF_GPIO129                0x0A5A
+
 #define MUX_VAL(OFFSET,VALUE)\
        writew((VALUE), OMAP34XX_CTRL_BASE + (OFFSET));
 
index 08b9c993531bb38983121ba7414c479b3ec15b3f..feddb7de5141d8b7e21fc1a37095299a88df0e32 100644 (file)
@@ -168,4 +168,15 @@ struct watchdog {
 #define OMAP_GPIO_CLEARDATAOUT         0x0190
 #define OMAP_GPIO_SETDATAOUT           0x0194
 
+/*
+ * PRCM
+ */
+
+/* PRM */
+#define PRM_BASE               0x4A306000
+#define PRM_DEVICE_BASE                (PRM_BASE + 0x1B00)
+
+#define PRM_RSTCTRL            PRM_DEVICE_BASE
+#define PRM_RSTCTRL_RESET      0x01
+
 #endif /* _CPU_H */
index 30bfad7c20ff07ef0c407da87e0f1b38b26f5951..4de7c70bf66b19957cdaaf9cb49777ecc05d4c2d 100644 (file)
@@ -34,7 +34,7 @@ struct pad_conf_entry {
 
        u16 val;
 
-} __attribute__ ((packed));
+};
 
 #ifdef CONFIG_OFF_PADCONF
 #define OFF_PD          (1 << 12)
index 3a39787298b9456473af61176d9c8f7289bd899b..47c5883025ce818b8865e92d9c577edb8a85d3fa 100644 (file)
 #define TCLR_AR                        (0x1 << 1)
 #define TCLR_PRE               (0x1 << 5)
 
-/*
- * PRCM
- */
-
-/* PRM */
-#define PRM_BASE               0x4A306000
-#define PRM_DEVICE_BASE                (PRM_BASE + 0x1B00)
-
-#define PRM_RSTCTRL            PRM_DEVICE_BASE
-#define PRM_RSTCTRL_RESET      0x01
-
 /* Control Module */
 #define LDOSRAM_ACTMODE_VSET_IN_MASK   (0x1F << 5)
 #define LDOSRAM_VOLT_CTRL_OVERRIDE     0x0401040f
index 0697a732de44ae043177cdf73e6981b8c7af3e5c..8ef17c9a146aab0368f914b133621445c0accd66 100644 (file)
@@ -172,4 +172,15 @@ struct watchdog {
 #define OMAP_GPIO_CLEARDATAOUT         0x0190
 #define OMAP_GPIO_SETDATAOUT           0x0194
 
+/*
+ * PRCM
+ */
+
+/* PRM */
+#define PRM_BASE               0x4AE06000
+#define PRM_DEVICE_BASE                (PRM_BASE + 0x1B00)
+
+#define PRM_RSTCTRL            PRM_DEVICE_BASE
+#define PRM_RSTCTRL_RESET      0x01
+
 #endif /* _CPU_H */
index 993237bd9f625ac612cf2e70bdbc8fd2045ade9c..4a6ed8b4552fba115954c45b45bf0058dceb8a26 100644 (file)
@@ -34,7 +34,7 @@ struct pad_conf_entry {
 
        u16 val;
 
-} __attribute__ ((__packed__));
+};
 
 #ifdef CONFIG_OFF_PADCONF
 #define OFF_PD          (1 << 12)
index 27253929699e5cf8f37bfa300495c156a2faa43b..e3f55d20201316a19f850adb858379daf772cdf3 100644 (file)
 #define TCLR_AR                        (0x1 << 1)
 #define TCLR_PRE               (0x1 << 5)
 
-/*
- * PRCM
- */
-
-/* PRM */
-#define PRM_BASE               0x4AE06000
-#define PRM_DEVICE_BASE                (PRM_BASE + 0x1B00)
-
-#define PRM_RSTCTRL            PRM_DEVICE_BASE
-#define PRM_RSTCTRL_RESET      0x01
-
 /* Control Module */
 #define LDOSRAM_ACTMODE_VSET_IN_MASK   (0x1F << 5)
 #define LDOSRAM_VOLT_CTRL_OVERRIDE     0x0401040f
 /* CONTROL_EFUSE_2 */
 #define CONTROL_EFUSE_2_NMOS_PMOS_PTV_CODE_1           0x00ffc000
 
-#define MMC1_PWRDNZ                                    (1 << 26)
-#define MMC1_PBIASLITE_PWRDNZ                          (1 << 22)
-#define MMC1_PBIASLITE_VMODE                           (1 << 21)
+#define SDCARD_PWRDNZ                                  (1 << 26)
+#define SDCARD_BIAS_HIZ_MODE                           (1 << 25)
+#define SDCARD_BIAS_PWRDNZ                             (1 << 22)
+#define SDCARD_PBIASLITE_VMODE                         (1 << 21)
 
 #ifndef __ASSEMBLY__
 
similarity index 96%
rename from arch/arm/cpu/armv7/tegra2/ap20.h
rename to arch/arm/include/asm/arch-tegra2/ap20.h
index a4b4d73a407036baaede91dc745c00501b6980c3..d222c44233aa64bf3946d6ef9c9e52f750d4b176 100644 (file)
@@ -100,3 +100,10 @@ void tegra2_start(void);
 
 /* This is the main entry into U-Boot, used by the Cortex-A9 */
 extern void _start(void);
+
+/**
+ * Works out the SOC type used for clocks settings
+ *
+ * @return     SOC type - see TEGRA_SOC...
+ */
+int tegra_get_chip_type(void);
diff --git a/arch/arm/include/asm/arch-tegra2/apb_misc.h b/arch/arm/include/asm/arch-tegra2/apb_misc.h
new file mode 100644 (file)
index 0000000..eb69d18
--- /dev/null
@@ -0,0 +1,36 @@
+/*
+ * Copyright (c) 2012 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 _GP_PADCTRL_H_
+#define _GP_PADCTRL_H_
+
+/* APB_MISC_PP registers */
+struct apb_misc_pp_ctlr {
+       u32     reserved0[2];
+       u32     strapping_opt_a;/* 0x08: APB_MISC_PP_STRAPPING_OPT_A */
+};
+
+/* bit fields definitions for APB_MISC_PP_STRAPPING_OPT_A register */
+#define RAM_CODE_SHIFT         4
+#define RAM_CODE_MASK          (0xf << RAM_CODE_SHIFT)
+
+#endif
index 415e4200122543c5d2bfd621a1edc22e28d8857b..8c3be915145af938c18ab2cc71254bc98a8adb66 100644 (file)
@@ -117,6 +117,7 @@ struct clk_rst_ctlr {
 #define PLL_CPCON_MASK         (15U << PLL_CPCON_SHIFT)
 
 #define PLL_LFCON_SHIFT                4
+#define PLL_LFCON_MASK         (15U << PLL_LFCON_SHIFT)
 
 #define PLLU_VCO_FREQ_SHIFT    20
 #define PLLU_VCO_FREQ_MASK     (1U << PLLU_VCO_FREQ_SHIFT)
@@ -124,6 +125,8 @@ struct clk_rst_ctlr {
 /* CLK_RST_CONTROLLER_OSC_CTRL_0 */
 #define OSC_FREQ_SHIFT         30
 #define OSC_FREQ_MASK          (3U << OSC_FREQ_SHIFT)
+#define OSC_XOBP_SHIFT         1
+#define OSC_XOBP_MASK          (1U << OSC_XOBP_SHIFT)
 
 /*
  * CLK_RST_CONTROLLER_CLK_SOURCE_x_OUT_0 - the mask here is normally 8 bits
index 6b12c76e8d5383df41ea0a94c87e0d638b5b4340..1d3ae3864407c42d06f8f0018e2e1aeae2d4cb36 100644 (file)
@@ -210,6 +210,21 @@ enum clock_osc_freq clock_get_osc_freq(void);
 unsigned long clock_start_pll(enum clock_id id, u32 divm, u32 divn,
                u32 divp, u32 cpcon, u32 lfcon);
 
+/**
+ * Read low-level parameters of a PLL.
+ *
+ * @param id   clock id to read (note: USB is not supported)
+ * @param divm returns input divider
+ * @param divn returns feedback divider
+ * @param divp returns post divider 2^n
+ * @param cpcon        returns charge pump setup control
+ * @param lfcon        returns loop filter setup control
+ *
+ * @returns 0 if ok, -1 on error (invalid clock id)
+ */
+int clock_ll_read_pll(enum clock_id clkid, u32 *divm, u32 *divn,
+                     u32 *divp, u32 *cpcon, u32 *lfcon);
+
 /*
  * Enable a clock
  *
@@ -368,6 +383,13 @@ void clock_ll_start_uart(enum periph_id periph_id);
  */
 enum periph_id clock_decode_periph_id(const void *blob, int node);
 
+/**
+ * Checks if the oscillator bypass is enabled (XOBP bit)
+ *
+ * @return 1 if bypass is enabled, 0 if not
+ */
+int clock_get_osc_bypass(void);
+
 /*
  * Checks that clocks are valid and prints a warning if not
  *
diff --git a/arch/arm/include/asm/arch-tegra2/emc.h b/arch/arm/include/asm/arch-tegra2/emc.h
new file mode 100644 (file)
index 0000000..deb3d36
--- /dev/null
@@ -0,0 +1,113 @@
+/*
+ * Copyright (c) 2011 The Chromium OS Authors.
+ * (C) Copyright 2010,2011 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 _ARCH_EMC_H_
+#define _ARCH_EMC_H_
+
+#include <asm/types.h>
+
+#define TEGRA_EMC_NUM_REGS     46
+
+/* EMC Registers */
+struct emc_ctlr {
+       u32 cfg;                /* 0x00: EMC_CFG */
+       u32 reserved0[3];       /* 0x04 ~ 0x0C */
+       u32 adr_cfg;            /* 0x10: EMC_ADR_CFG */
+       u32 adr_cfg1;           /* 0x14: EMC_ADR_CFG_1 */
+       u32 reserved1[2];       /* 0x18 ~ 0x18 */
+       u32 refresh_ctrl;       /* 0x20: EMC_REFCTRL */
+       u32 pin;                /* 0x24: EMC_PIN */
+       u32 timing_ctrl;        /* 0x28: EMC_TIMING_CONTROL */
+       u32 rc;                 /* 0x2C: EMC_RC */
+       u32 rfc;                /* 0x30: EMC_RFC */
+       u32 ras;                /* 0x34: EMC_RAS */
+       u32 rp;                 /* 0x38: EMC_RP */
+       u32 r2w;                /* 0x3C: EMC_R2W */
+       u32 w2r;                /* 0x40: EMC_W2R */
+       u32 r2p;                /* 0x44: EMC_R2P */
+       u32 w2p;                /* 0x48: EMC_W2P */
+       u32 rd_rcd;             /* 0x4C: EMC_RD_RCD */
+       u32 wd_rcd;             /* 0x50: EMC_WD_RCD */
+       u32 rrd;                /* 0x54: EMC_RRD */
+       u32 rext;               /* 0x58: EMC_REXT */
+       u32 wdv;                /* 0x5C: EMC_WDV */
+       u32 quse;               /* 0x60: EMC_QUSE */
+       u32 qrst;               /* 0x64: EMC_QRST */
+       u32 qsafe;              /* 0x68: EMC_QSAFE */
+       u32 rdv;                /* 0x6C: EMC_RDV */
+       u32 refresh;            /* 0x70: EMC_REFRESH */
+       u32 burst_refresh_num;  /* 0x74: EMC_BURST_REFRESH_NUM */
+       u32 pdex2wr;            /* 0x78: EMC_PDEX2WR */
+       u32 pdex2rd;            /* 0x7c: EMC_PDEX2RD */
+       u32 pchg2pden;          /* 0x80: EMC_PCHG2PDEN */
+       u32 act2pden;           /* 0x84: EMC_ACT2PDEN */
+       u32 ar2pden;            /* 0x88: EMC_AR2PDEN */
+       u32 rw2pden;            /* 0x8C: EMC_RW2PDEN */
+       u32 txsr;               /* 0x90: EMC_TXSR */
+       u32 tcke;               /* 0x94: EMC_TCKE */
+       u32 tfaw;               /* 0x98: EMC_TFAW */
+       u32 trpab;              /* 0x9C: EMC_TRPAB */
+       u32 tclkstable;         /* 0xA0: EMC_TCLKSTABLE */
+       u32 tclkstop;           /* 0xA4: EMC_TCLKSTOP */
+       u32 trefbw;             /* 0xA8: EMC_TREFBW */
+       u32 quse_extra;         /* 0xAC: EMC_QUSE_EXTRA */
+       u32 odt_write;          /* 0xB0: EMC_ODT_WRITE */
+       u32 odt_read;           /* 0xB4: EMC_ODT_READ */
+       u32 reserved2[5];       /* 0xB8 ~ 0xC8 */
+       u32 mrs;                /* 0xCC: EMC_MRS */
+       u32 emrs;               /* 0xD0: EMC_EMRS */
+       u32 ref;                /* 0xD4: EMC_REF */
+       u32 pre;                /* 0xD8: EMC_PRE */
+       u32 nop;                /* 0xDC: EMC_NOP */
+       u32 self_ref;           /* 0xE0: EMC_SELF_REF */
+       u32 dpd;                /* 0xE4: EMC_DPD */
+       u32 mrw;                /* 0xE8: EMC_MRW */
+       u32 mrr;                /* 0xEC: EMC_MRR */
+       u32 reserved3;          /* 0xF0: */
+       u32 fbio_cfg1;          /* 0xF4: EMC_FBIO_CFG1 */
+       u32 fbio_dqsib_dly;     /* 0xF8: EMC_FBIO_DQSIB_DLY */
+       u32 fbio_dqsib_dly_msb; /* 0xFC: EMC_FBIO_DQSIB_DLY_MSG */
+       u32 fbio_spare;         /* 0x100: SBIO_SPARE */
+                               /* There are more registers ... */
+};
+
+/**
+ * Set up the EMC for the given rate. The timing parameters are retrieved
+ * from the device tree "nvidia,tegra20-emc" node and its
+ * "nvidia,tegra20-emc-table" sub-nodes.
+ *
+ * @param blob Device tree blob
+ * @param rate Clock speed of memory controller in Hz (=2x memory bus rate)
+ * @return 0 if ok, else -ve error code (look in emc.c to decode it)
+ */
+int tegra_set_emc(const void *blob, unsigned rate);
+
+/**
+ * Get a pointer to the EMC controller from the device tree.
+ *
+ * @param blob Device tree blob
+ * @return pointer to EMC controller
+ */
+struct emc_ctlr *emc_get_controller(const void *blob);
+
+#endif
diff --git a/arch/arm/include/asm/arch-tegra2/flow.h b/arch/arm/include/asm/arch-tegra2/flow.h
new file mode 100644 (file)
index 0000000..cce6cbf
--- /dev/null
@@ -0,0 +1,36 @@
+/*
+ * (C) Copyright 2010, 2011
+ * 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 _FLOW_H_
+#define _FLOW_H_
+
+struct flow_ctlr {
+       u32     halt_cpu_events;
+       u32     halt_cop_events;
+       u32     cpu_csr;
+       u32     cop_csr;
+       u32     halt_cpu1_events;
+       u32     cpu1_csr;
+};
+
+#endif
diff --git a/arch/arm/include/asm/arch-tegra2/fuse.h b/arch/arm/include/asm/arch-tegra2/fuse.h
new file mode 100644 (file)
index 0000000..b7e3808
--- /dev/null
@@ -0,0 +1,39 @@
+/*
+ *  (C) Copyright 2010,2011
+ *  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 _FUSE_H_
+#define _FUSE_H_
+
+/* FUSE registers */
+struct fuse_regs {
+       u32 reserved0[64];              /* 0x00 - 0xFC: */
+       u32 production_mode;            /* 0x100: FUSE_PRODUCTION_MODE */
+       u32 reserved1[3];               /* 0x104 - 0x10c: */
+       u32 sku_info;                   /* 0x110 */
+       u32 reserved2[13];              /* 0x114 - 0x144: */
+       u32 fa;                         /* 0x148: FUSE_FA */
+       u32 reserved3[21];              /* 0x14C - 0x19C: */
+       u32 security_mode;              /* 0x1A0: FUSE_SECURITY_MODE */
+};
+
+#endif /* ifndef _FUSE_H_ */
diff --git a/arch/arm/include/asm/arch-tegra2/gp_padctrl.h b/arch/arm/include/asm/arch-tegra2/gp_padctrl.h
new file mode 100644 (file)
index 0000000..1755ab2
--- /dev/null
@@ -0,0 +1,73 @@
+/*
+ *  (C) Copyright 2010,2011
+ *  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 _GP_PADCTRL_H_
+#define _GP_PADCTRL_H_
+
+/* APB_MISC_GP and padctrl registers */
+struct apb_misc_gp_ctlr {
+       u32     modereg;        /* 0x00: APB_MISC_GP_MODEREG */
+       u32     hidrev;         /* 0x04: APB_MISC_GP_HIDREV */
+       u32     reserved0[22];  /* 0x08 - 0x5C: */
+       u32     emu_revid;      /* 0x60: APB_MISC_GP_EMU_REVID */
+       u32     xactor_scratch; /* 0x64: APB_MISC_GP_XACTOR_SCRATCH */
+       u32     aocfg1;         /* 0x68: APB_MISC_GP_AOCFG1PADCTRL */
+       u32     aocfg2;         /* 0x6c: APB_MISC_GP_AOCFG2PADCTRL */
+       u32     atcfg1;         /* 0x70: APB_MISC_GP_ATCFG1PADCTRL */
+       u32     atcfg2;         /* 0x74: APB_MISC_GP_ATCFG2PADCTRL */
+       u32     cdevcfg1;       /* 0x78: APB_MISC_GP_CDEV1CFGPADCTRL */
+       u32     cdevcfg2;       /* 0x7C: APB_MISC_GP_CDEV2CFGPADCTRL */
+       u32     csuscfg;        /* 0x80: APB_MISC_GP_CSUSCFGPADCTRL */
+       u32     dap1cfg;        /* 0x84: APB_MISC_GP_DAP1CFGPADCTRL */
+       u32     dap2cfg;        /* 0x88: APB_MISC_GP_DAP2CFGPADCTRL */
+       u32     dap3cfg;        /* 0x8C: APB_MISC_GP_DAP3CFGPADCTRL */
+       u32     dap4cfg;        /* 0x90: APB_MISC_GP_DAP4CFGPADCTRL */
+       u32     dbgcfg;         /* 0x94: APB_MISC_GP_DBGCFGPADCTRL */
+       u32     lcdcfg1;        /* 0x98: APB_MISC_GP_LCDCFG1PADCTRL */
+       u32     lcdcfg2;        /* 0x9C: APB_MISC_GP_LCDCFG2PADCTRL */
+       u32     sdmmc2_cfg;     /* 0xA0: APB_MISC_GP_SDMMC2CFGPADCTRL */
+       u32     sdmmc3_cfg;     /* 0xA4: APB_MISC_GP_SDMMC3CFGPADCTRL */
+       u32     spicfg;         /* 0xA8: APB_MISC_GP_SPICFGPADCTRL */
+       u32     uaacfg;         /* 0xAC: APB_MISC_GP_UAACFGPADCTRL */
+       u32     uabcfg;         /* 0xB0: APB_MISC_GP_UABCFGPADCTRL */
+       u32     uart2cfg;       /* 0xB4: APB_MISC_GP_UART2CFGPADCTRL */
+       u32     uart3cfg;       /* 0xB8: APB_MISC_GP_UART3CFGPADCTRL */
+       u32     vicfg1;         /* 0xBC: APB_MISC_GP_VICFG1PADCTRL */
+       u32     vicfg2;         /* 0xC0: APB_MISC_GP_VICFG2PADCTRL */
+       u32     xm2cfga;        /* 0xC4: APB_MISC_GP_XM2CFGAPADCTRL */
+       u32     xm2cfgc;        /* 0xC8: APB_MISC_GP_XM2CFGCPADCTRL */
+       u32     xm2cfgd;        /* 0xCC: APB_MISC_GP_XM2CFGDPADCTRL */
+       u32     xm2clkcfg;      /* 0xD0: APB_MISC_GP_XM2CLKCFGPADCTRL */
+       u32     memcomp;        /* 0xD4: APB_MISC_GP_MEMCOMPPADCTRL */
+};
+
+/* bit fields definitions for APB_MISC_GP_HIDREV register */
+#define HIDREV_CHIPID_SHIFT            8
+#define HIDREV_CHIPID_MASK             (0xff << HIDREV_CHIPID_SHIFT)
+#define HIDREV_MAJORPREV_SHIFT         4
+#define HIDREV_MAJORPREV_MASK          (0xf << HIDREV_MAJORPREV_SHIFT)
+
+/* CHIPID field returned from APB_MISC_GP_HIDREV register */
+#define CHIPID_TEGRA2                          0x20
+
+#endif
diff --git a/arch/arm/include/asm/arch-tegra2/pmu.h b/arch/arm/include/asm/arch-tegra2/pmu.h
new file mode 100644 (file)
index 0000000..390815f
--- /dev/null
@@ -0,0 +1,30 @@
+/*
+ *  (C) Copyright 2010,2011
+ *  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 _ARCH_PMU_H_
+#define _ARCH_PMU_H_
+
+/* Set core and CPU voltages to nominal levels */
+int pmu_set_nominal(void);
+
+#endif /* _ARCH_PMU_H_ */
diff --git a/arch/arm/include/asm/arch-tegra2/sdram_param.h b/arch/arm/include/asm/arch-tegra2/sdram_param.h
new file mode 100644 (file)
index 0000000..6c427d0
--- /dev/null
@@ -0,0 +1,148 @@
+/*
+ *  (C) Copyright 2010, 2011
+ *  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 _SDRAM_PARAM_H_
+#define _SDRAM_PARAM_H_
+
+/*
+ * Defines the number of 32-bit words provided in each set of SDRAM parameters
+ * for arbitration configuration data.
+ */
+#define BCT_SDRAM_ARB_CONFIG_WORDS 27
+
+enum memory_type {
+       MEMORY_TYPE_NONE = 0,
+       MEMORY_TYPE_DDR,
+       MEMORY_TYPE_LPDDR,
+       MEMORY_TYPE_DDR2,
+       MEMORY_TYPE_LPDDR2,
+       MEMORY_TYPE_NUM,
+       MEMORY_TYPE_FORCE32 = 0x7FFFFFFF
+};
+
+/* Defines the SDRAM parameter structure */
+struct sdram_params {
+       enum memory_type memory_type;
+       u32 pllm_charge_pump_setup_control;
+       u32 pllm_loop_filter_setup_control;
+       u32 pllm_input_divider;
+       u32 pllm_feedback_divider;
+       u32 pllm_post_divider;
+       u32 pllm_stable_time;
+       u32 emc_clock_divider;
+       u32 emc_auto_cal_interval;
+       u32 emc_auto_cal_config;
+       u32 emc_auto_cal_wait;
+       u32 emc_pin_program_wait;
+       u32 emc_rc;
+       u32 emc_rfc;
+       u32 emc_ras;
+       u32 emc_rp;
+       u32 emc_r2w;
+       u32 emc_w2r;
+       u32 emc_r2p;
+       u32 emc_w2p;
+       u32 emc_rd_rcd;
+       u32 emc_wr_rcd;
+       u32 emc_rrd;
+       u32 emc_rext;
+       u32 emc_wdv;
+       u32 emc_quse;
+       u32 emc_qrst;
+       u32 emc_qsafe;
+       u32 emc_rdv;
+       u32 emc_refresh;
+       u32 emc_burst_refresh_num;
+       u32 emc_pdex2wr;
+       u32 emc_pdex2rd;
+       u32 emc_pchg2pden;
+       u32 emc_act2pden;
+       u32 emc_ar2pden;
+       u32 emc_rw2pden;
+       u32 emc_txsr;
+       u32 emc_tcke;
+       u32 emc_tfaw;
+       u32 emc_trpab;
+       u32 emc_tclkstable;
+       u32 emc_tclkstop;
+       u32 emc_trefbw;
+       u32 emc_quseextra;
+       u32 emc_fbioc_fg1;
+       u32 emc_fbio_dqsib_dly;
+       u32 emc_fbio_dqsib_dly_msb;
+       u32 emc_fbio_quse_dly;
+       u32 emc_fbio_quse_dly_msb;
+       u32 emc_fbio_cfg5;
+       u32 emc_fbio_cfg6;
+       u32 emc_fbio_spare;
+       u32 emc_mrs;
+       u32 emc_emrs;
+       u32 emc_mrw1;
+       u32 emc_mrw2;
+       u32 emc_mrw3;
+       u32 emc_mrw_reset_command;
+       u32 emc_mrw_reset_init_wait;
+       u32 emc_adr_cfg;
+       u32 emc_adr_cfg1;
+       u32 emc_emem_cfg;
+       u32 emc_low_latency_config;
+       u32 emc_cfg;
+       u32 emc_cfg2;
+       u32 emc_dbg;
+       u32 ahb_arbitration_xbar_ctrl;
+       u32 emc_cfg_dig_dll;
+       u32 emc_dll_xform_dqs;
+       u32 emc_dll_xform_quse;
+       u32 warm_boot_wait;
+       u32 emc_ctt_term_ctrl;
+       u32 emc_odt_write;
+       u32 emc_odt_read;
+       u32 emc_zcal_ref_cnt;
+       u32 emc_zcal_wait_cnt;
+       u32 emc_zcal_mrw_cmd;
+       u32 emc_mrs_reset_dll;
+       u32 emc_mrw_zq_init_dev0;
+       u32 emc_mrw_zq_init_dev1;
+       u32 emc_mrw_zq_init_wait;
+       u32 emc_mrs_reset_dll_wait;
+       u32 emc_emrs_emr2;
+       u32 emc_emrs_emr3;
+       u32 emc_emrs_ddr2_dll_enable;
+       u32 emc_mrs_ddr2_dll_reset;
+       u32 emc_emrs_ddr2_ocd_calib;
+       u32 emc_edr2_wait;
+       u32 emc_cfg_clktrim0;
+       u32 emc_cfg_clktrim1;
+       u32 emc_cfg_clktrim2;
+       u32 pmc_ddr_pwr;
+       u32 apb_misc_gp_xm2cfga_padctrl;
+       u32 apb_misc_gp_xm2cfgc_padctrl;
+       u32 apb_misc_gp_xm2cfgc_padctrl2;
+       u32 apb_misc_gp_xm2cfgd_padctrl;
+       u32 apb_misc_gp_xm2cfgd_padctrl2;
+       u32 apb_misc_gp_xm2clkcfg_padctrl;
+       u32 apb_misc_gp_xm2comp_padctrl;
+       u32 apb_misc_gp_xm2vttgen_padctrl;
+       u32 arbitration_config[BCT_SDRAM_ARB_CONFIG_WORDS];
+};
+#endif
index ca1881e3a2fd140a15f8c35d4f5d387b1b4fd0ae..d4ada10ea8cfe2a84d9a941d634ee541c7742d44 100644 (file)
@@ -33,6 +33,7 @@
 #define NV_PA_GPIO_BASE                0x6000D000
 #define NV_PA_EVP_BASE         0x6000F000
 #define NV_PA_APB_MISC_BASE    0x70000000
+#define TEGRA2_APB_MISC_GP_BASE        (NV_PA_APB_MISC_BASE + 0x0800)
 #define NV_PA_APB_UARTA_BASE   (NV_PA_APB_MISC_BASE + 0x6000)
 #define NV_PA_APB_UARTB_BASE   (NV_PA_APB_MISC_BASE + 0x6040)
 #define NV_PA_APB_UARTC_BASE   (NV_PA_APB_MISC_BASE + 0x6200)
@@ -40,6 +41,7 @@
 #define NV_PA_APB_UARTE_BASE   (NV_PA_APB_MISC_BASE + 0x6400)
 #define TEGRA2_SPI_BASE                (NV_PA_APB_MISC_BASE + 0xC380)
 #define TEGRA2_PMC_BASE                (NV_PA_APB_MISC_BASE + 0xE400)
+#define TEGRA2_FUSE_BASE       (NV_PA_APB_MISC_BASE + 0xF800)
 #define NV_PA_CSITE_BASE       0x70040000
 #define TEGRA_USB1_BASE                0xC5000000
 #define TEGRA_USB3_BASE                0xC5008000
 struct timerus {
        unsigned int cntr_1us;
 };
+
+/* Address at which WB code runs, it must not overlap Bootrom's IRAM usage */
+#define AP20_WB_RUN_ADDRESS    0x40020000
+
+/* These are the available SKUs (product types) for Tegra */
+enum {
+       SKU_ID_T20              = 0x8,
+       SKU_ID_T25SE            = 0x14,
+       SKU_ID_AP25             = 0x17,
+       SKU_ID_T25              = 0x18,
+       SKU_ID_AP25E            = 0x1b,
+       SKU_ID_T25E             = 0x1c,
+};
+
+/* These are the SOC categories that affect clocking */
+enum {
+       TEGRA_SOC_T20,
+       TEGRA_SOC_T25,
+
+       TEGRA_SOC_COUNT,
+       TEGRA_SOC_UNKNOWN       = -1,
+};
+
 #else  /* __ASSEMBLY__ */
 #define PRM_RSTCTRL            TEGRA2_PMC_BASE
 #endif
index 0a7d99c58581966f5da0d639ddc85b4040c04505..cfb136c466d5d712d951268e3a42abaca415a6a2 100644 (file)
@@ -154,4 +154,11 @@ struct i2c_ctlr {
 #define I2C_INT_ARBITRATION_LOST_SHIFT 2
 #define I2C_INT_ARBITRATION_LOST_MASK  (1 << I2C_INT_ARBITRATION_LOST_SHIFT)
 
+/**
+ * Returns the bus number of the DVC controller
+ *
+ * @return number of bus, or -1 if there is no DVC active
+ */
+int tegra_i2c_get_dvc_bus_num(void);
+
 #endif
diff --git a/arch/arm/include/asm/arch-tegra2/warmboot.h b/arch/arm/include/asm/arch-tegra2/warmboot.h
new file mode 100644 (file)
index 0000000..99ac2e7
--- /dev/null
@@ -0,0 +1,150 @@
+/*
+ * (C) Copyright 2010, 2011
+ * 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 _WARM_BOOT_H_
+#define _WARM_BOOT_H_
+
+#define STRAP_OPT_A_RAM_CODE_SHIFT     4
+#define STRAP_OPT_A_RAM_CODE_MASK      (0xf << STRAP_OPT_A_RAM_CODE_SHIFT)
+
+/* Defines the supported operating modes */
+enum fuse_operating_mode {
+       MODE_PRODUCTION = 3,
+       MODE_UNDEFINED,
+};
+
+/* Defines the CMAC-AES-128 hash length in 32 bit words. (128 bits = 4 words) */
+enum {
+       HASH_LENGTH = 4
+};
+
+/* Defines the storage for a hash value (128 bits) */
+struct hash {
+       u32 hash[HASH_LENGTH];
+};
+
+/*
+ * Defines the code header information for the boot rom.
+ *
+ * The code immediately follows the code header.
+ *
+ * Note that the code header needs to be 16 bytes aligned to preserve
+ * the alignment of relevant data for hash and decryption computations without
+ * requiring extra copies to temporary memory areas.
+ */
+struct wb_header {
+       u32 length_insecure;    /* length of the code header */
+       u32 reserved[3];
+       struct hash hash;       /* hash of header+code, starts next field*/
+       struct hash random_aes_block;   /* a data block to aid security. */
+       u32 length_secure;      /* length of the code header */
+       u32 destination;        /* destination address to put the wb code */
+       u32 entry_point;        /* execution address of the wb code */
+       u32 code_length;        /* length of the code */
+};
+
+/*
+ * The warm boot code needs direct access to these registers since it runs in
+ * SRAM and cannot call other U-Boot code.
+ */
+union osc_ctrl_reg {
+       struct {
+               u32 xoe:1;
+               u32 xobp:1;
+               u32 reserved0:2;
+               u32 xofs:6;
+               u32 reserved1:2;
+               u32 xods:5;
+               u32 reserved2:3;
+               u32 oscfi_spare:8;
+               u32 pll_ref_div:2;
+               u32 osc_freq:2;
+       };
+       u32 word;
+};
+
+union pllx_base_reg {
+       struct {
+               u32 divm:5;
+               u32 reserved0:3;
+               u32 divn:10;
+               u32 reserved1:2;
+               u32 divp:3;
+               u32 reserved2:4;
+               u32 lock:1;
+               u32 reserved3:1;
+               u32 ref_dis:1;
+               u32 enable:1;
+               u32 bypass:1;
+       };
+       u32 word;
+};
+
+union pllx_misc_reg {
+       struct {
+               u32 vcocon:4;
+               u32 lfcon:4;
+               u32 cpcon:4;
+               u32 lock_sel:6;
+               u32 reserved0:1;
+               u32 lock_enable:1;
+               u32 reserved1:1;
+               u32 dccon:1;
+               u32 pts:2;
+               u32 reserved2:6;
+               u32 out1_div_byp:1;
+               u32 out1_inv_clk:1;
+       };
+       u32 word;
+};
+
+/*
+ * TODO: This register is not documented in the TRM yet. We could move this
+ * into the EMC and give it a proper interface, but not while it is
+ * undocumented.
+ */
+union scratch3_reg {
+       struct {
+               u32 pllx_base_divm:5;
+               u32 pllx_base_divn:10;
+               u32 pllx_base_divp:3;
+               u32 pllx_misc_lfcon:4;
+               u32 pllx_misc_cpcon:4;
+       };
+       u32 word;
+};
+
+
+/**
+ * Save warmboot memory settings for a later resume
+ *
+ * @return 0 if ok, -1 on error
+ */
+int warmboot_save_sdram_params(void);
+
+int warmboot_prepare_code(u32 seg_address, u32 seg_length);
+int sign_data_block(u8 *source, u32 length, u8 *signature);
+void wb_start(void);   /* Start of WB assembly code */
+void wb_end(void);     /* End of WB assembly code */
+
+#endif
diff --git a/arch/arm/include/asm/linkage.h b/arch/arm/include/asm/linkage.h
new file mode 100644 (file)
index 0000000..dbe4b4e
--- /dev/null
@@ -0,0 +1,7 @@
+#ifndef __ASM_LINKAGE_H
+#define __ASM_LINKAGE_H
+
+#define __ALIGN .align 0
+#define __ALIGN_STR ".align 0"
+
+#endif
index 2b28a261ba0218692cf0a121807d44429ce026af..ad524c5ef00a306828a4b4b5123a2fba648c88c0 100644 (file)
@@ -64,7 +64,7 @@
 static inline unsigned int get_cr(void)
 {
        unsigned int val;
-       asm("mrc p15, 0, %0, c1, c0, 0  @ get CR" : "=r" (val) : : "cc");
+       asm volatile("mrc p15, 0, %0, c1, c0, 0 @ get CR" : "=r" (val) : : "cc");
        return val;
 }
 
index e6c3eae6f9d2dad1b0bfe2f73d58922439870afa..a69c5f6649df904e1c447405749de6e02b13546e 100644 (file)
@@ -20,7 +20,6 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  * MA 02111-1307 USA
  */
-
 #include <common.h>
 #include <asm/system.h>
 
@@ -40,16 +39,6 @@ void __arm_init_before_mmu(void)
 void arm_init_before_mmu(void)
        __attribute__((weak, alias("__arm_init_before_mmu")));
 
-static void cp_delay (void)
-{
-       volatile int i;
-
-       /* copro seems to need some delay between reading and writing */
-       for (i = 0; i < 100; i++)
-               nop();
-       asm volatile("" : : : "memory");
-}
-
 static inline void dram_bank_mmu_setup(int bank)
 {
        u32 *page_table = (u32 *)gd->tlb_addr;
@@ -80,15 +69,16 @@ static inline void mmu_setup(void)
                dram_bank_mmu_setup(i);
        }
 
-       /* Copy the page table address to cp15 */
-       asm volatile("mcr p15, 0, %0, c2, c0, 0"
-                    : : "r" (page_table) : "memory");
-       /* Set the access control to all-supervisor */
-       asm volatile("mcr p15, 0, %0, c3, c0, 0"
-                    : : "r" (~0));
+       asm volatile(
+               /* Copy the page table address to cp15 */
+               "mcr p15, 0, %0, c2, c0, 0\n"
+               /* Set the access control to all-supervisor */
+               "mcr p15, 0, %1, c3, c0, 0\n"
+               :
+               : "r"(page_table), "r"(~0)
+               );
        /* and enable the mmu */
        reg = get_cr(); /* get control reg. */
-       cp_delay();
        set_cr(reg | CR_M);
 }
 
@@ -106,7 +96,6 @@ static void cache_enable(uint32_t cache_bit)
        if ((cache_bit == CR_C) && !mmu_enabled())
                mmu_setup();
        reg = get_cr(); /* get control reg. */
-       cp_delay();
        set_cr(reg | cache_bit);
 }
 
@@ -125,7 +114,6 @@ static void cache_disable(uint32_t cache_bit)
                flush_dcache_all();
        }
        reg = get_cr();
-       cp_delay();
        set_cr(reg & ~cache_bit);
 }
 #endif
index b545fb79bc1a185972719b6c5684df6ee3f029e5..9adcb8dcd77f64c07e4660492a9f536b46ac4771 100644 (file)
@@ -33,10 +33,12 @@ void  __flush_cache(unsigned long start, unsigned long size)
        arm1136_cache_flush();
 #endif
 #ifdef CONFIG_ARM926EJS
-       /* test and clean, page 2-23 of arm926ejs manual */
-       asm("0: mrc p15, 0, r15, c7, c10, 3\n\t" "bne 0b\n" : : : "memory");
-       /* disable write buffer as well (page 2-22) */
-       asm("mcr p15, 0, %0, c7, c10, 4" : : "r" (0));
+       asm(
+               /* test and clean, page 2-23 of arm926ejs manual */
+               "0: mrc p15, 0, r15, c7, c10, 3\n\t" "bne 0b\n"
+               /* flush write buffer as well (page 2-22) */
+               "mcr p15, 0, %0, c7, c10, 4" : : "r"(0) : "memory"
+               );
 #endif
        return;
 }
index d81b555fb9334016e3b407a8ec073ef9e58253fb..89e6b08e7faf9b8dd0ee4800c819c2d47fd4f4eb 100644 (file)
@@ -99,17 +99,6 @@ int board_init(void)
        return 0;
 }
 
-/*
- * Routine: misc_init_r
- * Description: display die ID
- */
-int misc_init_r(void)
-{
-       dieid_num_r();
-
-       return 0;
-}
-
 /*
  * Routine: set_muxconf_regs
  * Description: Setting up the configuration Mux registers specific to the
@@ -241,6 +230,12 @@ static void cm_t3x_set_common_muxconf(void)
        /* I2C1 */
        MUX_VAL(CP(I2C1_SCL),           (IEN  | PTU | EN  | M0)); /*I2C1_SCL*/
        MUX_VAL(CP(I2C1_SDA),           (IEN  | PTU | EN  | M0)); /*I2C1_SDA*/
+       /* I2C2 */
+       MUX_VAL(CP(I2C2_SCL),           (IEN  | PTU | EN  | M0)); /*I2C2_SCL*/
+       MUX_VAL(CP(I2C2_SDA),           (IEN  | PTU | EN  | M0)); /*I2C2_SDA*/
+       /* I2C3 */
+       MUX_VAL(CP(I2C3_SCL),           (IEN  | PTU | EN  | M0)); /*I2C3_SCL*/
+       MUX_VAL(CP(I2C3_SDA),           (IEN  | PTU | EN  | M0)); /*I2C3_SDA*/
 
        /* control and debug */
        MUX_VAL(CP(SYS_32K),            (IEN  | PTD | DIS | M0)); /*SYS_32K*/
index 43632c2fd8076bb175147400975fc9280e98ba3e..7e000404ee6534d96fa01ed6bd2497ac7e8c0b2e 100644 (file)
@@ -272,7 +272,7 @@ int board_init(void)
        return 0;
 }
 
-#ifdef BOARD_LATE_INIT
+#ifdef CONFIG_BOARD_LATE_INIT
 
 int board_late_init(void)
 {
@@ -287,7 +287,7 @@ int board_late_init(void)
 
        return 0;
 }
-#endif /* BOARD_LATE_INIT */
+#endif /* CONFIG_BOARD_LATE_INIT */
 
 #ifdef CONFIG_DRIVER_TI_EMAC
 
index 53df4761f6033c41577f69ce348c152779b9f6cc..3d28ea84debac6ff3cf6e2cf45df83379f089dde 100644 (file)
@@ -90,6 +90,8 @@ int board_mmc_init(bd_t *bis)
 {
        /* Configure WP as input. */
        gpio_direction_input(MX28_PAD_AUART2_CTS__GPIO_3_10);
+       /* Turn on the power to the card. */
+       gpio_direction_output(MX28_PAD_PWM3__GPIO_3_28, 0);
 
        return mxsmmc_initialize(bis, 0, m28_mmc_wp);
 }
@@ -103,10 +105,18 @@ int board_mmc_init(bd_t *bis)
 
 int fecmxc_mii_postcall(int phy)
 {
+#if    defined(CONFIG_DENX_M28_V11) || defined(CONFIG_DENX_M28_V10)
+       /* KZ8031 PHY on old boards. */
+       const uint32_t freq = 0x0080;
+#else
+       /* KZ8021 PHY on new boards. */
+       const uint32_t freq = 0x0000;
+#endif
+
        miiphy_write("FEC1", phy, MII_BMCR, 0x9000);
        miiphy_write("FEC1", phy, MII_OPMODE_STRAP_OVERRIDE, 0x0202);
        if (phy == 3)
-               miiphy_write("FEC1", 3, MII_PHY_CTRL2, 0x8180);
+               miiphy_write("FEC1", 3, MII_PHY_CTRL2, 0x8100 | freq);
        return 0;
 }
 
@@ -123,6 +133,14 @@ int board_eth_init(bd_t *bis)
                CLKCTRL_ENET_TIME_SEL_MASK | CLKCTRL_ENET_CLK_OUT_EN,
                CLKCTRL_ENET_TIME_SEL_RMII_CLK);
 
+#if !defined(CONFIG_DENX_M28_V11) && !defined(CONFIG_DENX_M28_V10)
+       /* Reset the new PHY */
+       gpio_direction_output(MX28_PAD_AUART2_RTS__GPIO_3_11, 0);
+       udelay(10000);
+       gpio_set_value(MX28_PAD_AUART2_RTS__GPIO_3_11, 1);
+       udelay(10000);
+#endif
+
        ret = fecmxc_initialize_multi(bis, 0, 0, MXS_ENET0_BASE);
        if (ret) {
                printf("FEC MXS: Unable to init FEC0\n");
index a04fe180c138c951d74b42a6ebcded42f826d73c..fa48c16906acac796989c1fcf04bf666b357c68a 100644 (file)
@@ -109,8 +109,9 @@ const iomux_cfg_t iomux_setup[] = {
                (MXS_PAD_3V3 | MXS_PAD_12MA | MXS_PAD_NOPULL),
        MX28_PAD_SSP0_SCK__SSP0_SCK |
                (MXS_PAD_3V3 | MXS_PAD_12MA | MXS_PAD_NOPULL),
-       MX28_PAD_PWM3__GPIO_3_28 | MUX_CONFIG_SSP0,     /* Power .. FIXME */
-       MX28_PAD_AUART2_CTS__GPIO_3_10, /* WP ... FIXME */
+       MX28_PAD_PWM3__GPIO_3_28 | MUX_CONFIG_SSP0 |
+               (MXS_PAD_3V3 | MXS_PAD_12MA | MXS_PAD_NOPULL),  /* Power */
+       MX28_PAD_AUART2_CTS__GPIO_3_10, /* WP */
 
        /* GPMI NAND */
        MX28_PAD_GPMI_D00__GPMI_D0 | MUX_CONFIG_GPMI,
@@ -147,6 +148,9 @@ const iomux_cfg_t iomux_setup[] = {
        MX28_PAD_ENET0_RXD3__ENET1_RXD1 | MUX_CONFIG_ENET,
        MX28_PAD_ENET0_TXD2__ENET1_TXD0 | MUX_CONFIG_ENET,
        MX28_PAD_ENET0_TXD3__ENET1_TXD1 | MUX_CONFIG_ENET,
+#if !defined(CONFIG_DENX_M28_V11) && !defined(CONFIG_DENX_M28_V10)
+       MX28_PAD_AUART2_RTS__GPIO_3_11, /* PHY reset */
+#endif
 
        /* I2C */
        MX28_PAD_I2C0_SCL__I2C0_SCL,
@@ -216,3 +220,53 @@ void board_init_ll(void)
 {
        mx28_common_spl_init(iomux_setup, ARRAY_SIZE(iomux_setup));
 }
+
+static uint32_t dram_vals[] = {
+       0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+       0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+       0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+       0x00000000, 0x00000000, 0x00000100, 0x00000000, 0x00000000,
+       0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+       0x00000000, 0x00010101, 0x01010101, 0x000f0f01, 0x0f02020a,
+       0x00000000, 0x00010101, 0x00000100, 0x00000100, 0x00000000,
+       0x00000002, 0x01010000, 0x05060302, 0x06005003, 0x0a0000c8,
+       0x02009c40, 0x0000030c, 0x0036a609, 0x031a0612, 0x02030202,
+       0x00c8001c, 0x00000000, 0x00000000, 0x00012100, 0xffff0303,
+       0x00012100, 0xffff0303, 0x00012100, 0xffff0303, 0x00012100,
+       0xffff0303, 0x00000003, 0x00000000, 0x00000000, 0x00000000,
+       0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+       0x00000000, 0x00000612, 0x01000F02, 0x06120612, 0x00000200,
+       0x00020007, 0xf5014b27, 0xf5014b27, 0xf5014b27, 0xf5014b27,
+       0x07000300, 0x07000300, 0x07000300, 0x07000300, 0x00000006,
+       0x00000000, 0x00000000, 0x01000000, 0x01020408, 0x08040201,
+       0x000f1133, 0x00000000, 0x00001f04, 0x00001f04, 0x00001f04,
+       0x00001f04, 0x00001f04, 0x00001f04, 0x00001f04, 0x00001f04,
+       0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+       0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+       0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+       0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+       0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+       0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+       0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+       0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+       0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+       0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+       0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+       0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+       0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+       0x00000000, 0x00000000, 0x00010000, 0x00020304, 0x00000004,
+       0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+       0x00000000, 0x01010000, 0x01000000, 0x03030000, 0x00010303,
+       0x01020202, 0x00000000, 0x02040303, 0x21002103, 0x00061200,
+       0x06120612, 0x04320432, 0x04320432, 0x00040004, 0x00040004,
+       0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00010001
+};
+
+void mx28_ddr2_setup(void)
+{
+       int i;
+
+       serial_puts("\n");
+       for (i = 0; i < ARRAY_SIZE(dram_vals); i++)
+               writel(dram_vals[i], MXS_DRAM_BASE + (4 * i));
+}
diff --git a/board/esg/ima3-mx53/Makefile b/board/esg/ima3-mx53/Makefile
new file mode 100644 (file)
index 0000000..f3b13bc
--- /dev/null
@@ -0,0 +1,41 @@
+#
+# Copyright (C) 2012, Stefano Babic <sbabic@denx.de>
+#
+# Based on ti/evm/Makefile
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 2 of
+# the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+# MA 02111-1307 USA
+#
+
+include $(TOPDIR)/config.mk
+
+LIB    = $(obj)lib$(BOARD).o
+
+COBJS  := ima3-mx53.o
+
+SRCS   := $(SOBJS:.o=.S) $(COBJS:.o=.c)
+OBJS   := $(addprefix $(obj),$(COBJS))
+
+$(LIB):        $(obj).depend $(OBJS)
+       $(call cmd_link_o_target, $(OBJS))
+
+#########################################################################
+
+# defines $(obj).depend target
+include $(SRCTREE)/rules.mk
+
+sinclude $(obj).depend
+
+#########################################################################
diff --git a/board/esg/ima3-mx53/ima3-mx53.c b/board/esg/ima3-mx53/ima3-mx53.c
new file mode 100644 (file)
index 0000000..9ecf31d
--- /dev/null
@@ -0,0 +1,302 @@
+/*
+ * (C) Copyright 2012, Stefano Babic <sbabic@denx.de>
+ *
+ * (C) Copyright 2010 Freescale Semiconductor, Inc.
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc.
+ */
+#include <common.h>
+#include <asm/io.h>
+#include <asm/arch/imx-regs.h>
+#include <asm/arch/mx5x_pins.h>
+#include <asm/arch/sys_proto.h>
+#include <asm/arch/crm_regs.h>
+#include <asm/arch/clock.h>
+#include <asm/arch/iomux.h>
+#include <asm/errno.h>
+#include <netdev.h>
+#include <mmc.h>
+#include <fsl_esdhc.h>
+#include <asm/gpio.h>
+
+/* NOR flash configuration */
+#define IMA3_MX53_CS0GCR1      (CSEN | DSZ(2))
+#define IMA3_MX53_CS0GCR2      0
+#define IMA3_MX53_CS0RCR1      (RCSN(2) | OEN(1) | RWSC(15))
+#define IMA3_MX53_CS0RCR2      0
+#define IMA3_MX53_CS0WCR1      (WBED1 | WCSN(2) | WEN(1) | WWSC(15))
+#define IMA3_MX53_CS0WCR2      0
+
+DECLARE_GLOBAL_DATA_PTR;
+
+static void weim_nor_settings(void)
+{
+       struct weim *weim_regs = (struct weim *)WEIM_BASE_ADDR;
+
+       writel(IMA3_MX53_CS0GCR1, &weim_regs->cs0gcr1);
+       writel(IMA3_MX53_CS0GCR2, &weim_regs->cs0gcr2);
+       writel(IMA3_MX53_CS0RCR1, &weim_regs->cs0rcr1);
+       writel(IMA3_MX53_CS0RCR2, &weim_regs->cs0rcr2);
+       writel(IMA3_MX53_CS0WCR1, &weim_regs->cs0wcr1);
+       writel(IMA3_MX53_CS0WCR2, &weim_regs->cs0wcr2);
+       writel(0x0, &weim_regs->wcr);
+
+       set_chipselect_size(CS0_128);
+}
+
+int dram_init(void)
+{
+       gd->ram_size = get_ram_size((void *) CONFIG_SYS_SDRAM_BASE,
+                       PHYS_SDRAM_1_SIZE);
+       return 0;
+}
+
+static void setup_iomux_uart(void)
+{
+       /* UART4 RXD */
+       mxc_request_iomux(MX53_PIN_CSI0_D13, IOMUX_CONFIG_ALT2);
+       mxc_iomux_set_pad(MX53_PIN_CSI0_D13,
+               PAD_CTL_HYS_ENABLE | PAD_CTL_DRV_HIGH |
+               PAD_CTL_PUE_PULL | PAD_CTL_PKE_ENABLE | PAD_CTL_HYS_ENABLE |
+               PAD_CTL_100K_PU | PAD_CTL_ODE_OPENDRAIN_ENABLE);
+       mxc_iomux_set_input(MX53_UART4_IPP_UART_RXD_MUX_SELECT_INPUT, 0x3);
+
+       /* UART4 TXD */
+       mxc_request_iomux(MX53_PIN_CSI0_D12, IOMUX_CONFIG_ALT2);
+       mxc_iomux_set_pad(MX53_PIN_CSI0_D12,
+               PAD_CTL_HYS_ENABLE | PAD_CTL_DRV_HIGH |
+               PAD_CTL_PUE_PULL | PAD_CTL_PKE_ENABLE | PAD_CTL_HYS_ENABLE |
+               PAD_CTL_100K_PU | PAD_CTL_ODE_OPENDRAIN_ENABLE);
+}
+
+static void setup_iomux_fec(void)
+{
+       /*FEC_MDIO*/
+       mxc_request_iomux(MX53_PIN_FEC_MDIO, IOMUX_CONFIG_ALT0);
+       mxc_iomux_set_pad(MX53_PIN_FEC_MDIO,
+               PAD_CTL_HYS_ENABLE | PAD_CTL_DRV_HIGH |
+               PAD_CTL_PUE_PULL | PAD_CTL_PKE_ENABLE | PAD_CTL_22K_PU |
+               PAD_CTL_ODE_OPENDRAIN_ENABLE);
+       mxc_iomux_set_input(MX53_FEC_FEC_MDI_SELECT_INPUT, 0x1);
+
+       /*FEC_MDC*/
+       mxc_request_iomux(MX53_PIN_FEC_MDC, IOMUX_CONFIG_ALT0);
+       mxc_iomux_set_pad(MX53_PIN_FEC_MDC, PAD_CTL_DRV_HIGH);
+
+       /* FEC RXD3 */
+       mxc_request_iomux(MX53_PIN_KEY_COL0, IOMUX_CONFIG_ALT6);
+       mxc_iomux_set_pad(MX53_PIN_KEY_COL0, PAD_CTL_HYS_ENABLE |
+               PAD_CTL_PKE_ENABLE);
+
+       /* FEC RXD2 */
+       mxc_request_iomux(MX53_PIN_KEY_COL2, IOMUX_CONFIG_ALT6);
+       mxc_iomux_set_pad(MX53_PIN_KEY_COL2, PAD_CTL_HYS_ENABLE |
+               PAD_CTL_PKE_ENABLE);
+
+       /* FEC RXD1 */
+       mxc_request_iomux(MX53_PIN_FEC_RXD1, IOMUX_CONFIG_ALT0);
+       mxc_iomux_set_pad(MX53_PIN_FEC_RXD1, PAD_CTL_HYS_ENABLE |
+               PAD_CTL_PKE_ENABLE);
+
+       /* FEC RXD0 */
+       mxc_request_iomux(MX53_PIN_FEC_RXD0, IOMUX_CONFIG_ALT0);
+       mxc_iomux_set_pad(MX53_PIN_FEC_RXD0, PAD_CTL_HYS_ENABLE |
+               PAD_CTL_PKE_ENABLE);
+
+       /* FEC TXD3 */
+       mxc_request_iomux(MX53_PIN_GPIO_19, IOMUX_CONFIG_ALT6);
+       mxc_iomux_set_pad(MX53_PIN_GPIO_19, PAD_CTL_DRV_HIGH);
+
+       /* FEC TXD2 */
+       mxc_request_iomux(MX53_PIN_KEY_ROW2, IOMUX_CONFIG_ALT6);
+       mxc_iomux_set_pad(MX53_PIN_KEY_ROW2, PAD_CTL_DRV_HIGH);
+
+       /* FEC TXD1 */
+       mxc_request_iomux(MX53_PIN_FEC_TXD1, IOMUX_CONFIG_ALT0);
+       mxc_iomux_set_pad(MX53_PIN_FEC_TXD1, PAD_CTL_DRV_HIGH);
+
+       /* FEC TXD0 */
+       mxc_request_iomux(MX53_PIN_FEC_TXD0, IOMUX_CONFIG_ALT0);
+       mxc_iomux_set_pad(MX53_PIN_FEC_TXD0, PAD_CTL_DRV_HIGH);
+
+       /* FEC TX_EN */
+       mxc_request_iomux(MX53_PIN_FEC_TX_EN, IOMUX_CONFIG_ALT0);
+       mxc_iomux_set_pad(MX53_PIN_FEC_TX_EN, PAD_CTL_DRV_HIGH);
+
+       /* FEC TX_CLK */
+       mxc_request_iomux(MX53_PIN_FEC_REF_CLK, IOMUX_CONFIG_ALT0);
+       mxc_iomux_set_pad(MX53_PIN_FEC_REF_CLK, PAD_CTL_HYS_ENABLE |
+               PAD_CTL_PKE_ENABLE);
+
+       /* FEC RX_ER */
+       mxc_request_iomux(MX53_PIN_FEC_RX_ER, IOMUX_CONFIG_ALT0);
+       mxc_iomux_set_pad(MX53_PIN_FEC_RX_ER, PAD_CTL_HYS_ENABLE |
+               PAD_CTL_PKE_ENABLE);
+
+       /* FEC RX_DV */
+       mxc_request_iomux(MX53_PIN_FEC_CRS_DV, IOMUX_CONFIG_ALT0);
+       mxc_iomux_set_pad(MX53_PIN_FEC_CRS_DV, PAD_CTL_HYS_ENABLE |
+               PAD_CTL_PKE_ENABLE);
+
+       /* FEC CRS */
+       mxc_request_iomux(MX53_PIN_KEY_COL3, IOMUX_CONFIG_ALT6);
+       mxc_iomux_set_pad(MX53_PIN_KEY_COL3, PAD_CTL_HYS_ENABLE |
+               PAD_CTL_PKE_ENABLE);
+
+       /* FEC COL */
+       mxc_request_iomux(MX53_PIN_KEY_ROW1, IOMUX_CONFIG_ALT6);
+       mxc_iomux_set_pad(MX53_PIN_KEY_ROW1, PAD_CTL_HYS_ENABLE |
+               PAD_CTL_PKE_ENABLE);
+       mxc_iomux_set_input(MX53_FEC_FEC_COL_SELECT_INPUT, 0x0);
+
+       /* FEC RX_CLK */
+       mxc_request_iomux(MX53_PIN_KEY_COL1, IOMUX_CONFIG_ALT6);
+       mxc_iomux_set_pad(MX53_PIN_KEY_COL1, PAD_CTL_HYS_ENABLE |
+               PAD_CTL_PKE_ENABLE);
+       mxc_iomux_set_input(MX53_FEC_FEC_RX_CLK_SELECT_INPUT, 0x0);
+}
+
+#ifdef CONFIG_FSL_ESDHC
+struct fsl_esdhc_cfg esdhc_cfg = { MMC_SDHC1_BASE_ADDR, 1 };
+
+int board_mmc_getcd(struct mmc *mmc)
+{
+       int ret;
+
+       ret = !gpio_get_value(IOMUX_TO_GPIO(MX53_PIN_GPIO_1));
+
+       return ret;
+}
+
+int board_mmc_init(bd_t *bis)
+{
+       mxc_request_iomux(MX53_PIN_SD1_CMD, IOMUX_CONFIG_ALT0);
+       mxc_request_iomux(MX53_PIN_SD1_CLK, IOMUX_CONFIG_ALT0);
+       mxc_request_iomux(MX53_PIN_SD1_DATA0, IOMUX_CONFIG_ALT0);
+       mxc_request_iomux(MX53_PIN_SD1_DATA1, IOMUX_CONFIG_ALT0);
+       mxc_request_iomux(MX53_PIN_SD1_DATA2, IOMUX_CONFIG_ALT0);
+       mxc_request_iomux(MX53_PIN_SD1_DATA3, IOMUX_CONFIG_ALT0);
+       mxc_request_iomux(MX53_PIN_GPIO_1, IOMUX_CONFIG_ALT1);
+       mxc_iomux_set_pad(MX53_PIN_GPIO_1,
+               PAD_CTL_DRV_HIGH | PAD_CTL_HYS_ENABLE |
+               PAD_CTL_PUE_KEEPER | PAD_CTL_100K_PU |
+               PAD_CTL_ODE_OPENDRAIN_NONE | PAD_CTL_PKE_ENABLE);
+       gpio_direction_input(IOMUX_TO_GPIO(MX53_PIN_GPIO_1));
+
+       mxc_iomux_set_pad(MX53_PIN_SD1_CMD,
+               PAD_CTL_HYS_ENABLE | PAD_CTL_DRV_HIGH | PAD_CTL_PUE_PULL |
+               PAD_CTL_PKE_ENABLE | PAD_CTL_HYS_ENABLE | PAD_CTL_100K_PU);
+       mxc_iomux_set_pad(MX53_PIN_SD1_CLK,
+               PAD_CTL_PUE_PULL | PAD_CTL_PKE_ENABLE | PAD_CTL_HYS_ENABLE |
+               PAD_CTL_47K_PU | PAD_CTL_DRV_HIGH);
+       mxc_iomux_set_pad(MX53_PIN_SD1_DATA0,
+               PAD_CTL_HYS_ENABLE | PAD_CTL_DRV_HIGH | PAD_CTL_PUE_PULL |
+               PAD_CTL_PKE_ENABLE | PAD_CTL_HYS_ENABLE | PAD_CTL_47K_PU);
+       mxc_iomux_set_pad(MX53_PIN_SD1_DATA1,
+               PAD_CTL_HYS_ENABLE | PAD_CTL_DRV_HIGH | PAD_CTL_PUE_PULL |
+               PAD_CTL_PKE_ENABLE | PAD_CTL_HYS_ENABLE | PAD_CTL_47K_PU);
+       mxc_iomux_set_pad(MX53_PIN_SD1_DATA2,
+               PAD_CTL_HYS_ENABLE | PAD_CTL_DRV_HIGH | PAD_CTL_PUE_PULL |
+               PAD_CTL_PKE_ENABLE | PAD_CTL_HYS_ENABLE | PAD_CTL_47K_PU);
+       mxc_iomux_set_pad(MX53_PIN_SD1_DATA3,
+               PAD_CTL_HYS_ENABLE | PAD_CTL_DRV_HIGH | PAD_CTL_PUE_PULL |
+               PAD_CTL_PKE_ENABLE | PAD_CTL_HYS_ENABLE | PAD_CTL_47K_PU);
+
+       return fsl_esdhc_initialize(bis, &esdhc_cfg);
+}
+#endif
+
+static void setup_iomux_spi(void)
+{
+       /* SCLK */
+       mxc_request_iomux(MX53_PIN_CSI0_D8, IOMUX_CONFIG_ALT3);
+       mxc_iomux_set_pad(MX53_PIN_CSI0_D8,
+               PAD_CTL_HYS_ENABLE | PAD_CTL_DRV_HIGH | PAD_CTL_PUE_PULL |
+               PAD_CTL_PKE_ENABLE | PAD_CTL_HYS_ENABLE | PAD_CTL_47K_PU);
+       mxc_iomux_set_input(MX53_ECSPI2_IPP_CSPI_CLK_IN_SELECT_INPUT, 0x1);
+       /* MOSI */
+       mxc_request_iomux(MX53_PIN_CSI0_D9, IOMUX_CONFIG_ALT3);
+       mxc_iomux_set_pad(MX53_PIN_CSI0_D9,
+               PAD_CTL_HYS_ENABLE | PAD_CTL_DRV_HIGH | PAD_CTL_PUE_PULL |
+               PAD_CTL_PKE_ENABLE | PAD_CTL_HYS_ENABLE | PAD_CTL_47K_PU);
+       mxc_iomux_set_input(MX53_ECSPI2_IPP_IND_MOSI_SELECT_INPUT, 0x1);
+       /* MISO */
+       mxc_request_iomux(MX53_PIN_CSI0_D10, IOMUX_CONFIG_ALT3);
+       mxc_iomux_set_pad(MX53_PIN_CSI0_D10,
+               PAD_CTL_HYS_ENABLE | PAD_CTL_DRV_HIGH | PAD_CTL_PUE_PULL |
+               PAD_CTL_PKE_ENABLE | PAD_CTL_HYS_ENABLE | PAD_CTL_47K_PU);
+       mxc_iomux_set_input(MX53_ECSPI2_IPP_IND_MISO_SELECT_INPUT, 0x1);
+       /* SSEL 0 */
+       mxc_request_iomux(MX53_PIN_CSI0_D11, IOMUX_CONFIG_GPIO);
+       mxc_iomux_set_pad(MX53_PIN_CSI0_D11,
+               PAD_CTL_HYS_ENABLE | PAD_CTL_DRV_HIGH | PAD_CTL_PUE_PULL |
+               PAD_CTL_PKE_ENABLE | PAD_CTL_HYS_ENABLE | PAD_CTL_47K_PU);
+       gpio_direction_output(IOMUX_TO_GPIO(MX53_PIN_CSI0_D11), 1);
+}
+
+int board_early_init_f(void)
+{
+       /* configure I/O pads */
+       setup_iomux_uart();
+       setup_iomux_fec();
+
+       weim_nor_settings();
+
+       /* configure spi */
+       setup_iomux_spi();
+
+       return 0;
+}
+
+int board_init(void)
+{
+       gd->bd->bi_boot_params = PHYS_SDRAM_1 + 0x100;
+
+       mxc_set_sata_internal_clock();
+
+       return 0;
+}
+
+#if defined(CONFIG_RESET_PHY_R)
+#include <miiphy.h>
+
+void reset_phy(void)
+{
+       unsigned short reg;
+
+       /* reset the phy */
+       miiphy_reset("FEC", CONFIG_PHY_ADDR);
+
+       /* set hard link to 100Mbit, full-duplex */
+       miiphy_read("FEC", CONFIG_PHY_ADDR, MII_BMCR, &reg);
+       reg &= ~BMCR_ANENABLE;
+       reg |= (BMCR_SPEED100 | BMCR_FULLDPLX);
+       miiphy_write("FEC", CONFIG_PHY_ADDR, MII_BMCR, reg);
+
+       miiphy_read("FEC", CONFIG_PHY_ADDR, 0x16, &reg);
+       reg |= (1 << 5);
+       miiphy_write("FEC", CONFIG_PHY_ADDR, 0x16, reg);
+}
+#endif
+
+int checkboard(void)
+{
+       puts("Board: IMA3_MX53\n");
+
+       return 0;
+}
diff --git a/board/esg/ima3-mx53/imximage.cfg b/board/esg/ima3-mx53/imximage.cfg
new file mode 100644 (file)
index 0000000..fa6b42d
--- /dev/null
@@ -0,0 +1,108 @@
+#
+# (C) Copyright 2012
+# Stefano Babic DENX Software Engineering 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. 51 Franklin Street Fifth Floor Boston,
+# MA 02110-1301 USA
+#
+# Refer docs/README.imxmage for more details about how-to configure
+# and create imximage boot image
+#
+# The syntax is taken as close as possible with the kwbimage
+
+# image version
+
+IMAGE_VERSION 2
+
+# Boot Device : one of
+# spi, sd (the board has no nand neither onenand)
+
+BOOT_FROM      nor
+
+# Device Configuration Data (DCD)
+#
+# Each entry must have the format:
+# Addr-type           Address        Value
+#
+# where:
+#      Addr-type register length (1,2 or 4 bytes)
+#      Address   absolute address of the register
+#      value     value to be stored in the register
+
+# IOMUX for RAM only
+DATA 4 0x53fa8554 0x300020
+DATA 4 0x53fa8560 0x300020
+DATA 4 0x53fa8594 0x300020
+DATA 4 0x53fa8584 0x300020
+DATA 4 0x53fa8558 0x300040
+DATA 4 0x53fa8568 0x300040
+DATA 4 0x53fa8590 0x300040
+DATA 4 0x53fa857c 0x300040
+DATA 4 0x53fa8564 0x300040
+DATA 4 0x53fa8580 0x300040
+DATA 4 0x53fa8570 0x300220
+DATA 4 0x53fa8578 0x300220
+DATA 4 0x53fa872c 0x300000
+DATA 4 0x53fa8728 0x300000
+DATA 4 0x53fa871c 0x300000
+DATA 4 0x53fa8718 0x300000
+DATA 4 0x53fa8574 0x300020
+DATA 4 0x53fa8588 0x300020
+DATA 4 0x53fa855c 0x0
+DATA 4 0x53fa858c 0x0
+DATA 4 0x53fa856c 0x300040
+DATA 4 0x53fa86f0 0x300000
+DATA 4 0x53fa8720 0x300000
+DATA 4 0x53fa86fc 0x0
+DATA 4 0x53fa86f4 0x0
+DATA 4 0x53fa8714 0x0
+DATA 4 0x53fa8724 0x4000000
+#
+# DDR RAM
+DATA 4 0x63fd9088 0x40404040
+DATA 4 0x63fd9090 0x40404040
+DATA 4 0x63fd907C 0x01420143
+DATA 4 0x63fd9080 0x01450146
+DATA 4 0x63fd9018 0x00111740
+DATA 4 0x63fd9000 0x84190000
+# esdcfgX
+DATA 4 0x63fd900C 0x9f5152e3
+DATA 4 0x63fd9010 0xb68e8a63
+DATA 4 0x63fd9014 0x01ff00db
+# Read/Write command delay
+DATA 4 0x63fd902c 0x000026d2
+# Out of reset delays
+DATA 4 0x63fd9030 0x00ff0e21
+# ESDCTL ODT timing control
+DATA 4 0x63fd9008 0x12273030
+# ESDCTL power down control
+DATA 4 0x63fd9004 0x0002002d
+# Set registers in DDR memory chips
+DATA 4 0x63fd901c 0x00008032
+DATA 4 0x63fd901c 0x00008033
+DATA 4 0x63fd901c 0x00028031
+DATA 4 0x63fd901c 0x052080b0
+DATA 4 0x63fd901c 0x04008040
+# ESDCTL refresh control
+DATA 4 0x63fd9020 0x00005800
+# PHY ZQ HW control
+DATA 4 0x63fd9040 0x05380003
+# PHY ODT control
+DATA 4 0x63fd9058 0x00022222
+# start DDR3
+DATA 4 0x63fd901c 0x00000000
index 396761bdff02d2f57294002ea4de207bbafa5191..6587c454fe7f99d68f652bdf2d980b039878395d 100644 (file)
@@ -26,6 +26,7 @@
 #include <asm/arch/sys_proto.h>
 
 #define        MUX_CONFIG_SSP0 (MXS_PAD_3V3 | MXS_PAD_8MA | MXS_PAD_PULLUP)
+#define        MUX_CONFIG_GPMI (MXS_PAD_3V3 | MXS_PAD_4MA | MXS_PAD_NOPULL)
 #define        MUX_CONFIG_ENET (MXS_PAD_3V3 | MXS_PAD_8MA | MXS_PAD_PULLUP)
 #define        MUX_CONFIG_EMI  (MXS_PAD_3V3 | MXS_PAD_12MA | MXS_PAD_NOPULL)
 #define        MUX_CONFIG_SSP2 (MXS_PAD_3V3 | MXS_PAD_4MA | MXS_PAD_PULLUP)
@@ -55,6 +56,26 @@ const iomux_cfg_t iomux_setup[] = {
        MX28_PAD_PWM3__GPIO_3_28 |
                (MXS_PAD_12MA | MXS_PAD_3V3 | MXS_PAD_PULLUP),
 
+#ifdef CONFIG_NAND_MXS
+       /* GPMI NAND */
+       MX28_PAD_GPMI_D00__GPMI_D0 | MUX_CONFIG_GPMI,
+       MX28_PAD_GPMI_D01__GPMI_D1 | MUX_CONFIG_GPMI,
+       MX28_PAD_GPMI_D02__GPMI_D2 | MUX_CONFIG_GPMI,
+       MX28_PAD_GPMI_D03__GPMI_D3 | MUX_CONFIG_GPMI,
+       MX28_PAD_GPMI_D04__GPMI_D4 | MUX_CONFIG_GPMI,
+       MX28_PAD_GPMI_D05__GPMI_D5 | MUX_CONFIG_GPMI,
+       MX28_PAD_GPMI_D06__GPMI_D6 | MUX_CONFIG_GPMI,
+       MX28_PAD_GPMI_D07__GPMI_D7 | MUX_CONFIG_GPMI,
+       MX28_PAD_GPMI_CE0N__GPMI_CE0N | MUX_CONFIG_GPMI,
+       MX28_PAD_GPMI_RDY0__GPMI_READY0 | MUX_CONFIG_GPMI,
+       MX28_PAD_GPMI_RDN__GPMI_RDN |
+               (MXS_PAD_3V3 | MXS_PAD_8MA | MXS_PAD_PULLUP),
+       MX28_PAD_GPMI_WRN__GPMI_WRN | MUX_CONFIG_GPMI,
+       MX28_PAD_GPMI_ALE__GPMI_ALE | MUX_CONFIG_GPMI,
+       MX28_PAD_GPMI_CLE__GPMI_CLE | MUX_CONFIG_GPMI,
+       MX28_PAD_GPMI_RESETN__GPMI_RESETN | MUX_CONFIG_GPMI,
+#endif
+
        /* FEC0 */
        MX28_PAD_ENET0_MDC__ENET0_MDC | MUX_CONFIG_ENET,
        MX28_PAD_ENET0_MDIO__ENET0_MDIO | MUX_CONFIG_ENET,
index d736141e287ff8c68589292bccdea0bd05805743..dec966ddd6aa3caeaa377645101d13b9e35a3e64 100644 (file)
@@ -27,6 +27,7 @@
 #include <asm/arch/mx5x_pins.h>
 #include <asm/arch/sys_proto.h>
 #include <asm/arch/crm_regs.h>
+#include <asm/arch/clock.h>
 #include <asm/arch/iomux.h>
 #include <asm/arch/clock.h>
 #include <asm/errno.h>
@@ -35,6 +36,9 @@
 #include <mmc.h>
 #include <fsl_esdhc.h>
 #include <asm/gpio.h>
+#include <pmic.h>
+#include <dialog_pmic.h>
+#include <fsl_pmic.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -58,6 +62,18 @@ void dram_init_banksize(void)
        gd->bd->bi_dram[1].size = PHYS_SDRAM_2_SIZE;
 }
 
+u32 get_board_rev(void)
+{
+       struct iim_regs *iim = (struct iim_regs *)IMX_IIM_BASE;
+       struct fuse_bank *bank = &iim->bank[0];
+       struct fuse_bank0_regs *fuse =
+               (struct fuse_bank0_regs *)bank->fuse_regs;
+
+       int rev = readl(&fuse->gp[6]);
+
+       return (get_cpu_rev() & ~(0xF << 8)) | (rev & 0xF) << 8;
+}
+
 static void setup_iomux_uart(void)
 {
        /* UART1 RXD */
@@ -81,10 +97,9 @@ static void setup_iomux_uart(void)
 #ifdef CONFIG_USB_EHCI_MX5
 int board_ehci_hcd_init(int port)
 {
-       /* request VBUS power enable pin, GPIO[8}, gpio7 */
+       /* request VBUS power enable pin, GPIO7_8 */
        mxc_request_iomux(MX53_PIN_ATA_DA_2, IOMUX_CONFIG_ALT1);
-       gpio_direction_output(IOMUX_TO_GPIO(MX53_PIN_ATA_DA_2), 0);
-       gpio_set_value(IOMUX_TO_GPIO(MX53_PIN_ATA_DA_2), 1);
+       gpio_direction_output(IOMUX_TO_GPIO(MX53_PIN_ATA_DA_2), 1);
        return 0;
 }
 #endif
@@ -290,6 +305,103 @@ int board_mmc_init(bd_t *bis)
 }
 #endif
 
+static void setup_iomux_i2c(void)
+{
+       /* I2C1 SDA */
+       mxc_request_iomux(MX53_PIN_CSI0_D8,
+               IOMUX_CONFIG_ALT5 | IOMUX_CONFIG_SION);
+       mxc_iomux_set_input(MX53_I2C1_IPP_SDA_IN_SELECT_INPUT,
+               INPUT_CTL_PATH0);
+       mxc_iomux_set_pad(MX53_PIN_CSI0_D8,
+               PAD_CTL_SRE_FAST | PAD_CTL_DRV_HIGH |
+               PAD_CTL_100K_PU | PAD_CTL_PKE_ENABLE |
+               PAD_CTL_PUE_PULL |
+               PAD_CTL_ODE_OPENDRAIN_ENABLE);
+       /* I2C1 SCL */
+       mxc_request_iomux(MX53_PIN_CSI0_D9,
+               IOMUX_CONFIG_ALT5 | IOMUX_CONFIG_SION);
+       mxc_iomux_set_input(MX53_I2C1_IPP_SCL_IN_SELECT_INPUT,
+               INPUT_CTL_PATH0);
+       mxc_iomux_set_pad(MX53_PIN_CSI0_D9,
+               PAD_CTL_SRE_FAST | PAD_CTL_DRV_HIGH |
+               PAD_CTL_100K_PU | PAD_CTL_PKE_ENABLE |
+               PAD_CTL_PUE_PULL |
+               PAD_CTL_ODE_OPENDRAIN_ENABLE);
+}
+
+static int power_init(void)
+{
+       unsigned int val;
+       int ret = -1;
+       struct pmic *p;
+
+       if (!i2c_probe(CONFIG_SYS_DIALOG_PMIC_I2C_ADDR)) {
+               pmic_dialog_init();
+               p = get_pmic();
+
+               /* Set VDDA to 1.25V */
+               val = DA9052_BUCKCORE_BCOREEN | DA_BUCKCORE_VBCORE_1_250V;
+               ret = pmic_reg_write(p, DA9053_BUCKCORE_REG, val);
+
+               ret |= pmic_reg_read(p, DA9053_SUPPLY_REG, &val);
+               val |= DA9052_SUPPLY_VBCOREGO;
+               ret |= pmic_reg_write(p, DA9053_SUPPLY_REG, val);
+
+               /* Set Vcc peripheral to 1.30V */
+               ret |= pmic_reg_write(p, DA9053_BUCKPRO_REG, 0x62);
+               ret |= pmic_reg_write(p, DA9053_SUPPLY_REG, 0x62);
+       }
+
+       if (!i2c_probe(CONFIG_SYS_FSL_PMIC_I2C_ADDR)) {
+               pmic_init();
+               p = get_pmic();
+
+               /* Set VDDGP to 1.25V for 1GHz on SW1 */
+               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);
+
+               /* 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);
+
+               /* 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);
+
+               /* 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);
+
+               /* Set SWBST to 5V in auto mode */
+               val = SWBST_AUTO;
+               ret |= pmic_reg_write(p, SWBST_CTRL, val);
+       }
+
+       return ret;
+}
+
+static void clock_1GHz(void)
+{
+       int ret;
+       u32 ref_clk = CONFIG_SYS_MX5_HCLK;
+       /*
+        * After increasing voltage to 1.25V, we can switch
+        * CPU clock to 1GHz and DDR to 400MHz safely
+        */
+       ret = mxc_set_clock(ref_clk, 1000, MXC_ARM_CLK);
+       if (ret)
+               printf("CPU:   Switch CPU clock to 1GHZ failed\n");
+
+       ret = mxc_set_clock(ref_clk, 400, MXC_PERIPH_CLK);
+       ret |= mxc_set_clock(ref_clk, 400, MXC_DDR_CLK);
+       if (ret)
+               printf("CPU:   Switch DDR clock to 400MHz failed\n");
+}
+
 int board_early_init_f(void)
 {
        setup_iomux_uart();
@@ -298,10 +410,38 @@ int board_early_init_f(void)
        return 0;
 }
 
+int print_cpuinfo(void)
+{
+       u32 cpurev;
+
+       cpurev = get_cpu_rev();
+       printf("CPU:   Freescale i.MX%x family rev%d.%d at %d MHz\n",
+               (cpurev & 0xFF000) >> 12,
+               (cpurev & 0x000F0) >> 4,
+               (cpurev & 0x0000F) >> 0,
+               mxc_get_clock(MXC_ARM_CLK) / 1000000);
+       printf("Reset cause: %s\n", get_reset_cause());
+       return 0;
+}
+
+#ifdef CONFIG_BOARD_LATE_INIT
+int board_late_init(void)
+{
+       setup_iomux_i2c();
+       if (!power_init())
+               clock_1GHz();
+       print_cpuinfo();
+
+       return 0;
+}
+#endif
+
 int board_init(void)
 {
        gd->bd->bi_boot_params = PHYS_SDRAM_1 + 0x100;
 
+       mxc_set_sata_internal_clock();
+
        return 0;
 }
 
index fda3e41a030ee56e2fc844c72131d5a1dcf2a52a..29cbfed120b4f092701dcecd60dbea87bea15fd5 100644 (file)
@@ -25,6 +25,7 @@
 #include <asm/arch/imx-regs.h>
 #include <asm/arch/mx6x_pins.h>
 #include <asm/arch/iomux-v3.h>
+#include <asm/arch/clock.h>
 #include <asm/errno.h>
 #include <asm/gpio.h>
 #include <mmc.h>
@@ -50,6 +51,10 @@ DECLARE_GLOBAL_DATA_PTR;
        PAD_CTL_PUS_100K_DOWN | PAD_CTL_SPEED_MED |             \
        PAD_CTL_DSE_40ohm     | PAD_CTL_SRE_FAST)
 
+#define BUTTON_PAD_CTRL (PAD_CTL_PKE | PAD_CTL_PUE |           \
+       PAD_CTL_PUS_100K_UP | PAD_CTL_SPEED_MED   |             \
+       PAD_CTL_DSE_40ohm   | PAD_CTL_HYS)
+
 int dram_init(void)
 {
        gd->ram_size = get_ram_size((void *)PHYS_SDRAM, PHYS_SDRAM_SIZE);
@@ -122,6 +127,22 @@ iomux_v3_cfg_t enet_pads2[] = {
        MX6Q_PAD_RGMII_RX_CTL__RGMII_RX_CTL     | MUX_PAD_CTRL(ENET_PAD_CTRL),
 };
 
+/* Button assignments for J14 */
+static iomux_v3_cfg_t button_pads[] = {
+       /* Menu */
+       MX6Q_PAD_NANDF_D1__GPIO_2_1     | MUX_PAD_CTRL(BUTTON_PAD_CTRL),
+       /* Back */
+       MX6Q_PAD_NANDF_D2__GPIO_2_2     | MUX_PAD_CTRL(BUTTON_PAD_CTRL),
+       /* Labelled Search (mapped to Power under Android) */
+       MX6Q_PAD_NANDF_D3__GPIO_2_3     | MUX_PAD_CTRL(BUTTON_PAD_CTRL),
+       /* Home */
+       MX6Q_PAD_NANDF_D4__GPIO_2_4     | MUX_PAD_CTRL(BUTTON_PAD_CTRL),
+       /* Volume Down */
+       MX6Q_PAD_GPIO_19__GPIO_4_5      | MUX_PAD_CTRL(BUTTON_PAD_CTRL),
+       /* Volume Up */
+       MX6Q_PAD_GPIO_18__GPIO_7_13     | MUX_PAD_CTRL(BUTTON_PAD_CTRL),
+};
+
 static void setup_iomux_enet(void)
 {
        gpio_direction_output(87, 0);  /* GPIO 3-23 */
@@ -135,7 +156,7 @@ static void setup_iomux_enet(void)
 
        /* Need delay 10ms according to KSZ9021 spec */
        udelay(1000 * 10);
-       gpio_direction_output(87, 1);  /* GPIO 3-23 */
+       gpio_set_value(87, 1);  /* GPIO 3-23 */
 
        imx_iomux_v3_setup_multiple_pads(enet_pads2, ARRAY_SIZE(enet_pads2));
 }
@@ -267,11 +288,44 @@ int board_eth_init(bd_t *bis)
        return 0;
 }
 
+static void setup_buttons(void)
+{
+       imx_iomux_v3_setup_multiple_pads(button_pads,
+                                        ARRAY_SIZE(button_pads));
+}
+
+#ifdef CONFIG_CMD_SATA
+
+int setup_sata(void)
+{
+       struct iomuxc_base_regs *const iomuxc_regs
+               = (struct iomuxc_base_regs *) IOMUXC_BASE_ADDR;
+       int ret = enable_sata_clock();
+       if (ret)
+               return ret;
+
+       clrsetbits_le32(&iomuxc_regs->gpr[13],
+                       IOMUXC_GPR13_SATA_MASK,
+                       IOMUXC_GPR13_SATA_PHY_8_RXEQ_3P0DB
+                       |IOMUXC_GPR13_SATA_PHY_7_SATA2M
+                       |IOMUXC_GPR13_SATA_SPEED_3G
+                       |(3<<IOMUXC_GPR13_SATA_PHY_6_SHIFT)
+                       |IOMUXC_GPR13_SATA_SATA_PHY_5_SS_DISABLED
+                       |IOMUXC_GPR13_SATA_SATA_PHY_4_ATTEN_9_16
+                       |IOMUXC_GPR13_SATA_PHY_3_TXBOOST_0P00_DB
+                       |IOMUXC_GPR13_SATA_PHY_2_TX_1P104V
+                       |IOMUXC_GPR13_SATA_PHY_1_SLOW);
+
+       return 0;
+}
+#endif
+
 int board_early_init_f(void)
 {
-       setup_iomux_uart();
+       setup_iomux_uart();
+       setup_buttons();
 
-       return 0;
+       return 0;
 }
 
 int board_init(void)
@@ -283,6 +337,10 @@ int board_init(void)
        setup_spi();
 #endif
 
+#ifdef CONFIG_CMD_SATA
+       setup_sata();
+#endif
+
        return 0;
 }
 
@@ -292,3 +350,94 @@ int checkboard(void)
 
        return 0;
 }
+
+struct button_key {
+       char const      *name;
+       unsigned        gpnum;
+       char            ident;
+};
+
+static struct button_key const buttons[] = {
+       {"back",        GPIO_NUMBER(2, 2),      'B'},
+       {"home",        GPIO_NUMBER(2, 4),      'H'},
+       {"menu",        GPIO_NUMBER(2, 1),      'M'},
+       {"search",      GPIO_NUMBER(2, 3),      'S'},
+       {"volup",       GPIO_NUMBER(7, 13),     'V'},
+       {"voldown",     GPIO_NUMBER(4, 5),      'v'},
+};
+
+/*
+ * generate a null-terminated string containing the buttons pressed
+ * returns number of keys pressed
+ */
+static int read_keys(char *buf)
+{
+       int i, numpressed = 0;
+       for (i = 0; i < ARRAY_SIZE(buttons); i++) {
+               if (!gpio_get_value(buttons[i].gpnum))
+                       buf[numpressed++] = buttons[i].ident;
+       }
+       buf[numpressed] = '\0';
+       return numpressed;
+}
+
+static int do_kbd(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+{
+       char envvalue[ARRAY_SIZE(buttons)+1];
+       int numpressed = read_keys(envvalue);
+       setenv("keybd", envvalue);
+       return numpressed == 0;
+}
+
+U_BOOT_CMD(
+       kbd, 1, 1, do_kbd,
+       "Tests for keypresses, sets 'keybd' environment variable",
+       "Returns 0 (true) to shell if key is pressed."
+);
+
+#ifdef CONFIG_PREBOOT
+static char const kbd_magic_prefix[] = "key_magic";
+static char const kbd_command_prefix[] = "key_cmd";
+
+static void preboot_keys(void)
+{
+       int numpressed;
+       char keypress[ARRAY_SIZE(buttons)+1];
+       numpressed = read_keys(keypress);
+       if (numpressed) {
+               char *kbd_magic_keys = getenv("magic_keys");
+               char *suffix;
+               /*
+                * loop over all magic keys
+                */
+               for (suffix = kbd_magic_keys; *suffix; ++suffix) {
+                       char *keys;
+                       char magic[sizeof(kbd_magic_prefix) + 1];
+                       sprintf(magic, "%s%c", kbd_magic_prefix, *suffix);
+                       keys = getenv(magic);
+                       if (keys) {
+                               if (!strcmp(keys, keypress))
+                                       break;
+                       }
+               }
+               if (*suffix) {
+                       char cmd_name[sizeof(kbd_command_prefix) + 1];
+                       char *cmd;
+                       sprintf(cmd_name, "%s%c", kbd_command_prefix, *suffix);
+                       cmd = getenv(cmd_name);
+                       if (cmd) {
+                               setenv("preboot", cmd);
+                               return;
+                       }
+               }
+       }
+}
+#endif
+
+int misc_init_r(void)
+{
+#ifdef CONFIG_PREBOOT
+       preboot_keys();
+#endif
+       return 0;
+}
index 8f0b52702b02c92cef6493b5e12cea08910db138..8f75af19d4c4624ad967c0aa08b28239b0e5c1a9 100644 (file)
@@ -68,17 +68,6 @@ int board_init(void)
        return 0;
 }
 
-/*
- * Routine: misc_init_r
- * Description: late init.
- */
-int misc_init_r(void)
-{
-       dieid_num_r();
-
-       return 0;
-}
-
 /*
  * Routine: set_muxconf_regs
  * Description: Setting up the configuration Mux registers specific to the
diff --git a/board/karo/common/Makefile b/board/karo/common/Makefile
new file mode 100644 (file)
index 0000000..ca8b0f6
--- /dev/null
@@ -0,0 +1,48 @@
+#
+# (C) Copyright 2012 Lothar Waßmann <LW@KARO-electronics.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
+# version 2 as published by the Free Software Foundation.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+
+include $(TOPDIR)/config.mk
+
+ifneq ($(OBJTREE),$(SRCTREE))
+$(shell mkdir -p $(obj)board/$(VENDOR)/common)
+endif
+
+LIB    = $(obj)lib$(VENDOR).o
+
+ifeq ($(CONFIG_SPL_BUILD),)
+       COBJS-$(CONFIG_OF_BOARD_SETUP)  += fdt.o
+       COBJS-$(CONFIG_SPLASH_SCREEN)   += splashimage.o
+endif
+
+COBJS   := $(COBJS-y)
+SOBJS  := 
+
+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))
+
+all:   $(LIB)
+
+#########################################################################
+
+include $(SRCTREE)/rules.mk
+
+sinclude $(obj).depend
+
+#########################################################################
diff --git a/board/karo/common/fdt.c b/board/karo/common/fdt.c
new file mode 100644 (file)
index 0000000..eb2054c
--- /dev/null
@@ -0,0 +1,270 @@
+/*
+ * (C) Copyright 2012 Lothar Waßmann <LW@KARO-electronics.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
+ * version 2 as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+*/
+
+#include <common.h>
+#include <errno.h>
+#include <libfdt.h>
+#include <fdt_support.h>
+#include <nand.h>
+#include <jffs2/load_kernel.h>
+
+#include "karo.h"
+
+#ifdef CONFIG_MAX_DTB_SIZE
+#define MAX_DTB_SIZE   CONFIG_MAX_DTB_SIZE
+#else
+#define MAX_DTB_SIZE   SZ_64K
+#endif
+
+DECLARE_GLOBAL_DATA_PTR;
+
+static void karo_set_fdtsize(void *fdt)
+{
+       char fdt_size[9];
+       size_t fdtsize = getenv_ulong("fdtsize", 16, 0);
+
+       if (fdtsize == fdt_totalsize(fdt)) {
+               return;
+       }
+       debug("FDT size changed from %u to %u\n",
+               fdtsize, fdt_totalsize(fdt));
+
+       snprintf(fdt_size, sizeof(fdt_size), "%08x", fdt_totalsize(fdt));
+       setenv("fdtsize", fdt_size);
+}
+
+void karo_fdt_move_fdt(void)
+{
+       void *fdt;
+       unsigned long fdt_addr = getenv_ulong("fdtaddr", 16, 0);
+
+       if (!fdt_addr) {
+               printf("fdtaddr is not set\n");
+               return;
+       }
+
+       fdt = karo_fdt_load_dtb();
+       if (fdt == NULL) {
+               fdt = (void *)gd->fdt_blob;
+               if (fdt == NULL) {
+                       printf("Compiled in FDT not found\n");
+                       return;
+               }
+               debug("Checking FDT header @ %p\n", fdt);
+               if (fdt_check_header(fdt)) {
+                       printf("ERROR: No valid DTB found at %p\n", fdt);
+                       return;
+               }
+               printf("No DTB in flash; using default DTB\n");
+               debug("Moving FDT from %p..%p to %08lx..%08lx\n",
+                       fdt, fdt + fdt_totalsize(fdt) - 1,
+                       fdt_addr, fdt_addr + fdt_totalsize(fdt) - 1);
+               memmove((void *)fdt_addr, fdt, fdt_totalsize(fdt));
+       }
+       set_working_fdt_addr((void *)fdt_addr);
+       karo_set_fdtsize(fdt);
+}
+
+void karo_fdt_remove_node(void *blob, const char *node)
+{
+       debug("Removing node %s from DT\n", node);
+       fdt_del_node_and_alias(blob, node);
+       karo_set_fdtsize(blob);
+}
+
+static const char *karo_touchpanels[] = {
+       "ti,tsc2007",
+       "edt,edt-ft5x06",
+};
+
+static void fdt_del_tp_node(void *blob, const char *name)
+{
+       int offs = fdt_node_offset_by_compatible(blob, -1, name);
+       uint32_t ph1 = 0, ph2 = 0;
+       const uint32_t *prop;
+
+       if (offs < 0) {
+               debug("node '%s' not found: %d\n", name, offs);
+               return;
+       }
+
+       prop = fdt_getprop(blob, offs, "reset-switch", NULL);
+       if (prop)
+               ph1 = be32_to_cpu(*prop);
+
+       prop = fdt_getprop(blob, offs, "wake-switch", NULL);
+       if (prop)
+               ph2 = be32_to_cpu(*prop);
+
+       debug("Removing node '%s' from DT\n", name);
+       fdt_del_node(blob, offs);
+
+       if (ph1) {
+               offs = fdt_node_offset_by_phandle(blob, ph1);
+               if (offs > 0) {
+                       debug("Removing node %08x @ %08x\n", ph1, offs);
+                       fdt_del_node(blob, offs);
+               }
+       }
+       if (ph2) {
+               offs = fdt_node_offset_by_phandle(blob, ph2);
+               if (offs > 0) {
+                       debug("Removing node %08x @ %08x\n", ph2, offs);
+                       fdt_del_node(blob, offs);
+               }
+       }
+}
+
+void karo_fdt_fixup_touchpanel(void *blob)
+{
+       int i;
+       const char *model = getenv("touchpanel");
+
+       for (i = 0; i < ARRAY_SIZE(karo_touchpanels); i++) {
+               const char *tp = karo_touchpanels[i];
+
+               if (model != NULL && strcmp(model, tp) == 0)
+                       continue;
+
+               tp = strchr(tp, ',');
+               if (tp != NULL && *tp != '\0' && strcmp(model, tp + 1) == 0)
+                       continue;
+
+               fdt_del_tp_node(blob, karo_touchpanels[i]);
+               karo_set_fdtsize(blob);
+       }
+}
+
+void karo_fdt_fixup_usb_otg(void *blob)
+{
+       const char *otg_mode = getenv("otg_mode");
+       int usbphy = 2;
+
+       if (otg_mode == NULL || strcmp(otg_mode, "host") != 0) {
+               karo_fdt_remove_node(blob, "usbh1");
+               usbphy--;
+       }
+       if (otg_mode == NULL || strcmp(otg_mode, "device") != 0) {
+               karo_fdt_remove_node(blob, "usbotg");
+               usbphy--;
+       }
+       if (!usbphy) {
+               karo_fdt_remove_node(blob, "usbphy");
+       }
+       karo_set_fdtsize(blob);
+}
+
+void karo_fdt_del_prop(void *blob, const char *compat, phys_addr_t offs,
+                       const char *prop)
+{
+       int ret;
+       int offset;
+       const uint32_t *phandle;
+       uint32_t ph = 0;
+
+       offset = fdt_node_offset_by_compat_reg(blob, compat, offs);
+       if (offset <= 0)
+               return;
+
+       phandle = fdt_getprop(blob, offset, "transceiver-switch", NULL);
+       if (phandle) {
+               ph = be32_to_cpu(*phandle);
+       }
+
+       debug("Removing property '%s' from node %s@%08lx\n", prop, compat, offs);
+       ret = fdt_delprop(blob, offset, prop);
+       if (ret == 0)
+               karo_set_fdtsize(blob);
+
+       if (!ph)
+               return;
+
+       offset = fdt_node_offset_by_phandle(blob, ph);
+       if (offset <= 0)
+               return;
+
+       debug("Removing node @ %08x\n", offset);
+       fdt_del_node(blob, offset);
+       karo_set_fdtsize(blob);
+}
+
+static int karo_load_part(const char *part, void *addr, size_t len)
+{
+       int ret;
+       struct mtd_device *dev;
+       struct part_info *part_info;
+       u8 part_num;
+
+       debug("Initializing mtd_parts\n");
+       ret = mtdparts_init();
+       if (ret)
+               return ret;
+
+       debug("Trying to find NAND partition '%s'\n", part);
+       ret = find_dev_and_part(part, &dev, &part_num,
+                               &part_info);
+       if (ret) {
+               printf("Failed to find flash partition '%s': %d\n",
+                       part, ret);
+
+               return ret;
+       }
+       debug("Found partition '%s': offset=%08x size=%08x\n",
+               part, part_info->offset, part_info->size);
+       if (part_info->size < len) {
+               printf("Warning: partition '%s' smaller than requested size: %u; truncating data to %u byte\n",
+                       part, len, part_info->size);
+               len = part_info->size;
+       }
+       debug("Reading NAND partition '%s' to %p\n", part, addr);
+       ret = nand_read_skip_bad(&nand_info[0], part_info->offset, &len, addr);
+       if (ret) {
+               printf("Failed to load partition '%s' to %p\n", part, addr);
+               return ret;
+       }
+       debug("Read %u byte from partition '%s' @ offset %08x\n",
+               len, part, part_info->offset);
+       return 0;
+}
+
+void *karo_fdt_load_dtb(void)
+{
+       int ret;
+       void *fdt = (void *)getenv_ulong("fdtaddr", 16, 0);
+
+       if (tstc() || !fdt) {
+               debug("aborting DTB load\n");
+               return NULL;
+       }
+
+       /* clear FDT header in memory */
+       memset(fdt, 0, 4);
+
+       ret = karo_load_part("dtb", fdt, MAX_DTB_SIZE);
+       if (ret) {
+               printf("Failed to load dtb from flash: %d\n", ret);
+               return NULL;
+       }
+
+       if (fdt_check_header(fdt)) {
+               debug("No valid DTB in flash\n");
+               return NULL;
+       }
+       debug("Using DTB from flash\n");
+       karo_set_fdtsize(fdt);
+       return fdt;
+}
diff --git a/board/karo/common/karo.h b/board/karo/common/karo.h
new file mode 100644 (file)
index 0000000..f724d14
--- /dev/null
@@ -0,0 +1,26 @@
+/*
+ * (C) Copyright 2012 Lothar Waßmann <LW@KARO-electronics.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
+ * version 2 as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+*/
+
+void karo_fdt_remove_node(void *blob, const char *node);
+void karo_fdt_move_fdt(void);
+void karo_fdt_fixup_touchpanel(void *blob);
+void karo_fdt_fixup_usb_otg(void *blob);
+void karo_fdt_del_prop(void *blob, const char *compat, phys_addr_t offs,
+               const char *prop);
+void *karo_fdt_load_dtb(void);
+
+int karo_load_splashimage(int mode);
diff --git a/board/karo/common/splashimage.c b/board/karo/common/splashimage.c
new file mode 100644 (file)
index 0000000..23c9539
--- /dev/null
@@ -0,0 +1,180 @@
+/*
+ * (C) Copyright 2012 Lothar Waßmann <LW@KARO-electronics.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
+ * version 2 as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ */
+
+#include <common.h>
+#include <errno.h>
+#include <lcd.h>
+#include <nand.h>
+#include <jffs2/load_kernel.h>
+
+DECLARE_GLOBAL_DATA_PTR;
+
+static int karo_load_part(const char *part, void *addr, size_t len)
+{
+       int ret;
+       struct mtd_device *dev;
+       struct part_info *part_info;
+       u8 part_num;
+
+       debug("Initializing mtd_parts\n");
+       ret = mtdparts_init();
+       if (ret)
+               return ret;
+
+       debug("Trying to find NAND partition '%s'\n", part);
+       ret = find_dev_and_part(part, &dev, &part_num,
+                               &part_info);
+       if (ret) {
+               printf("Failed to find flash partition '%s': %d\n",
+                       part, ret);
+
+               return ret;
+       }
+       debug("Found partition '%s': offset=%08x size=%08x\n",
+               part, part_info->offset, part_info->size);
+       if (part_info->size < len) {
+               printf("Warning: partition '%s' smaller than requested size: %u; truncating data to %u byte\n",
+                       part, len, part_info->size);
+               len = part_info->size;
+       }
+       debug("Reading NAND partition '%s' to %p\n", part, addr);
+       ret = nand_read_skip_bad(&nand_info[0], part_info->offset, &len, addr);
+       if (ret) {
+               printf("Failed to load partition '%s' to %p\n", part, addr);
+               return ret;
+       }
+       debug("Read %u byte from partition '%s' @ offset %08x\n",
+               len, part, part_info->offset);
+       return 0;
+}
+
+static ulong calc_fbsize(void)
+{
+       return panel_info.vl_row * panel_info.vl_col *
+               NBITS(panel_info.vl_bpix) / 8;
+}
+
+int karo_load_splashimage(int mode)
+{
+       int ret;
+       int do_nand(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[]);
+       unsigned long la = gd->fb_base;
+       char *splashimage = getenv("splashimage");
+       ulong fbsize = calc_fbsize();
+       char *end;
+
+       if (!la || !splashimage)
+               return 0;
+
+       if ((simple_strtoul(splashimage, &end, 16) != 0) &&
+               *end == '\0') {
+               if (mode)
+                       return 0;
+               la = simple_strtoul(splashimage, NULL, 16);
+               splashimage = "logo.bmp";
+       } else if (!mode) {
+               return 0;
+       }
+
+       if (tstc())
+               return -ENODEV;
+
+       ret = karo_load_part(splashimage, (void *)la, fbsize);
+       if (ret) {
+               printf("Failed to load logo from '%s': %d\n", splashimage, ret);
+               return ret;
+       }
+       return 0;
+}
+
+static int erase_flash(loff_t offs, size_t len)
+{
+       nand_erase_options_t nand_erase_options;
+
+       memset(&nand_erase_options, 0, sizeof(nand_erase_options));
+       nand_erase_options.length = len;
+       nand_erase_options.offset = offs;
+
+       return nand_erase_opts(&nand_info[0], &nand_erase_options);
+}
+
+int do_fbdump(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
+{
+       int ret;
+       size_t fbsize = calc_fbsize();
+       const char *part = "logo";
+       struct mtd_device *dev;
+       struct part_info *part_info;
+       u8 part_num;
+       u_char *addr = (u_char *)gd->fb_base;
+
+       if (argc > 2)
+               return CMD_RET_USAGE;
+
+       if (argc == 2)
+               part = argv[1];
+
+       if (!addr) {
+               printf("fb address unknown\n");
+               return CMD_RET_FAILURE;
+       }
+
+       debug("Initializing mtd_parts\n");
+       ret = mtdparts_init();
+       if (ret)
+               return ret;
+
+       debug("Trying to find NAND partition '%s'\n", part);
+       ret = find_dev_and_part(part, &dev, &part_num,
+                               &part_info);
+       if (ret) {
+               printf("Failed to find flash partition '%s': %d\n",
+                       part, ret);
+
+               return ret;
+       }
+       debug("Found partition '%s': offset=%08x size=%08x\n",
+               part, part_info->offset, part_info->size);
+       if (part_info->size < fbsize) {
+               printf("Error: partition '%s' smaller than frame buffer size: %u\n",
+                       part, fbsize);
+               return CMD_RET_FAILURE;
+       }
+       debug("Writing framebuffer %p to NAND partition '%s'\n",
+               addr, part);
+
+       ret = erase_flash(part_info->offset, fbsize);
+       if (ret) {
+               printf("Failed to erase partition '%s'\n", part);
+               return CMD_RET_FAILURE;
+       }
+
+       ret = nand_write_skip_bad(&nand_info[0], part_info->offset,
+                               &fbsize, addr, WITH_DROP_FFS);
+       if (ret) {
+               printf("Failed to write partition '%s'\n", part);
+               return ret;
+       }
+       debug("Wrote %u byte from %p to partition '%s' @ offset %08x\n",
+               fbsize, addr, part, part_info->offset);
+
+       return CMD_RET_SUCCESS;
+}
+
+U_BOOT_CMD(fbdump, 2, 0, do_fbdump, "dump framebuffer contents to flash",
+       "[partition name]\n"
+       "       default partition name: 'logo'\n");
diff --git a/board/karo/dts/tx28.dts b/board/karo/dts/tx28.dts
new file mode 100644 (file)
index 0000000..fa2c45f
--- /dev/null
@@ -0,0 +1,377 @@
+/*
+ * Copyright 2012 <LW@KARO-electronics.de>
+ *
+ * The code contained herein is licensed under the GNU General Public
+ * License. You may obtain a copy of the GNU General Public License
+ * Version 2 at the following locations:
+ *
+ * http://www.opensource.org/licenses/gpl-license.html
+ * http://www.gnu.org/copyleft/gpl.html
+ */
+
+/dts-v1/;
+/include/ ARCH_CPU_DTS
+
+/ {
+       model = "Ka-Ro electronics TX28 module";
+       compatible = "karo,tx28", "fsl,imx28";
+
+       aliases {
+               usbphy0 = &usbphy0;
+               usbphy1 = &usbphy1;
+               usbotg = &usb0;
+               usbh1 = &usb1;
+               can1 = &can1;
+               ethernet0 = &mac0;
+               ethernet1 = &mac1;
+               ds1339 = &ds1339;
+               pca9554 = &pca9554;
+               stk5led = &stk5_led;
+       };
+
+       memory {
+               reg = <0 0>;
+       };
+
+       apb@80000000 {
+               apbh@80000000 {
+                       ssp0: ssp@80010000 {
+                               compatible = "fsl,imx28-mmc";
+                               pinctrl-names = "default";
+                               pinctrl-0 = <&mmc0_4bit_pins_a
+                                            &mmc0_cd_cfg
+                                            &mmc0_sck_cfg>;
+                               bus-width = <4>;
+                               status = "okay";
+                       };
+
+                       pinctrl@80018000 {
+                               pinctrl-names = "default";
+                               pinctrl-0 = <&hog_pins_a>;
+
+                               hog_pins_a: hog-gpios@1 {
+                                       reg = <0>;
+                                       fsl,pinmux-ids = <
+                                               0x31b3 /* MX28_PAD_SPDIF__GPIO_3_27 */
+                                       >;
+                                       fsl,drive-strength = <0>;
+                                       fsl,voltage = <1>;
+                                       fsl,pull-up = <0>;
+                               };
+
+                               hog_pins_stk_v3_led: hog-gpios@0 {
+                                       reg = <0>;
+                                       fsl,pinmux-ids = <
+                                               0x40a3 /* MX28_PAD_ENET0_RXD3__GPIO_4_10 */
+                                       >;
+                                       fsl,drive-strength = <0>;
+                                       fsl,voltage = <1>;
+                                       fsl,pull-up = <0>;
+                               };
+
+                               mac0_pins_gpio: mac0-gpio-mode@0 {
+                                       reg = <0>;
+                                       fsl,pinmux-ids = <
+                                               0x4003 /* MX28_PAD_ENET0_MDC__GPIO_4_0 */
+                                               0x4013 /* MX28_PAD_ENET0_MDIO__GPIO_4_1 */
+                                               0x4023 /* MX28_PAD_ENET0_RX_EN__GPIO_4_2 */
+                                               0x4033 /* MX28_PAD_ENET0_RXD0__GPIO_4_3 */
+                                               0x4043 /* MX28_PAD_ENET0_RXD1__GPIO_4_4 */
+                                               0x4063 /* MX28_PAD_ENET0_TX_EN__GPIO_4_6 */
+                                               0x4073 /* MX28_PAD_ENET0_TXD0__GPIO_4_7 */
+                                               0x4083 /* MX28_PAD_ENET0_TXD1__GPIO_4_8 */
+                                               0x4103 /* MX28_PAD_ENET_CLK__GPIO_4_16 */
+                                       >;
+                                       fsl,drive-strength = <0>;
+                                       fsl,voltage = <1>;
+                                       fsl,pull-up = <0>;
+                               };
+
+                               lcdif_pins_tx28: lcdif-tx28@0 {
+                                       fsl,pinmux-ids = <
+                                               0x1181 /* MX28_PAD_LCD_RD_E__LCD_VSYNC */
+                                               0x1191 /* MX28_PAD_LCD_WR_RWN__LCD_HSYNC */
+                                               0x11a1 /* MX28_PAD_LCD_RS__LCD_DOTCLK */
+                                               0x11b1 /* MX28_PAD_LCD_CS__LCD_ENABLE */
+                                       >;
+                                       fsl,drive-strength = <0>;
+                                       fsl,voltage = <1>;
+                                       fsl,pull-up = <0>;
+                               };
+                       };
+
+                       lcdif@80030000 {
+                               status = "okay";
+
+                                pinctrl-names = "default";
+                                pinctrl-0 = <&lcdif_24bit_pins_a
+                                             &lcdif_pins_tx28>;
+                       };
+
+                       can0: can@80032000 {
+                               status = "okay";
+
+                               pinctrl-names = "default";
+                               pinctrl-0 = <&can0_pins_a>;
+                               transceiver-switch = <&flexcan_transceiver>;
+                       };
+
+                       can1: can@80034000 {
+                               status = "okay";
+
+                               pinctrl-names = "default";
+                               pinctrl-0 = <&can1_pins_a>;
+                               transceiver-switch = <&flexcan_transceiver>;
+                       };
+               };
+
+               apbx@80040000 {
+                       saif0: saif@80042000 {
+                               status = "okay";
+
+                               pinctrl-names = "default";
+                               pinctrl-0 = <&saif0_pins_a>;
+                       };
+
+                       saif1: saif@80046000 {
+                               status = "okay";
+
+                               pinctrl-names = "default";
+                               pinctrl-0 = <&saif1_pins_a>;
+                               fsl,saif-master = <&saif0>;
+                       };
+
+                       lradc@80050000 {
+                               status = "okay";
+                       };
+
+                       i2c0: i2c@80058000 {
+                               status = "okay";
+
+                               clock-frequency = <400000>;
+                               pinctrl-names = "default";
+                               pinctrl-0 = <&i2c0_pins_a>;
+
+                               ds1339: rtc@68 {
+                                       compatible = "maxim,ds1339";
+                                       reg = <0x68>;
+                               };
+
+                               pca9554: pca953x@20 {
+                                       compatible = "nxp,pca953x";
+                                       reg = <0x20>;
+                                       interrupt-parent = <&gpio3>;
+                                       interrupts = <20>;
+                               };
+
+                               codec: sgtl5000@0a {
+                                       compatible = "fsl,sgtl5000";
+                                       reg = <0x0a>;
+                                       VDDA-supply = <&reg_2p5v>;
+                                       VDDIO-supply = <&reg_3p3v>;
+                               };
+
+                               touchscreen: tsc2007@48 {
+                                       compatible = "ti,tsc2007";
+                                       reg = <0x48>;
+                                       interrupt-parent = <&gpio3>;
+                                       interrupts = <20 0>;
+                                       pendown-gpio = <&gpio3 20 1>;
+                                       model = "2007";
+                                       x-plate-ohms = <660>;
+                               };
+
+                               polytouch: edt-ft5x06@ {
+                                       compatible = "edt,edt-ft5x06";
+                                       reg = <0x38>;
+                                       interrupt-parent = <&gpio2>;
+                                       interrupts = <5>;
+                                       reset-switch = <&edt_ft5x06_reset>;
+                                       wake-switch = <&edt_ft5x06_wake>;
+                               };
+                       };
+
+                       pwm: pwm@80064000 {
+                               status = "okay";
+
+                               pinctrl-names = "default";
+                               pinctrl-0 = <&pwm0_pins_a>;
+                       };
+
+                       auart1: serial@8006c000 {
+                               status = "okay";
+
+                               pinctrl-names = "default";
+                               pinctrl-0 = <&auart1_pins_a>;
+                       };
+
+                       auart3: serial@80070000 {
+                               status = "okay";
+
+                               pinctrl-names = "default";
+                               pinctrl-0 = <&auart3_pins_a>;
+                       };
+
+                       duart: serial@80074000 {
+                               status = "okay";
+
+                               pinctrl-names = "default";
+                               pinctrl-0 = <&duart_4pins_a>;
+                       };
+
+                       usbphy0: usbphy@8007c000 {
+                               status = "okay";
+                       };
+
+                       usbphy1: usbphy@8007e000 {
+                               status = "okay";
+                       };
+               };
+       };
+
+       ahb@80080000 {
+               usb0: usb@80080000 {
+                       status = "okay";
+
+                        vbus-supply = <&reg_usb0_vbus>;
+                        pinctrl-names = "default";
+               };
+
+               usb1: usb@80090000 {
+                       status = "okay";
+
+                        vbus-supply = <&reg_usb1_vbus>;
+                        pinctrl-names = "default";
+               };
+
+               gpmi-nand@8000c000 {
+                       status = "okay";
+
+                       pinctrl-names = "default";
+                       pinctrl-0 = <&gpmi_pins_a>;
+               };
+
+               mac0: ethernet@800f0000 {
+                       phy-mode = "rmii";
+                       pinctrl-names = "default";
+                       pinctrl-0 = <&mac0_pins_a>;
+                       status = "okay";
+                       mac-address = [000000000000]; /* will be set bootloader */
+               };
+
+               mac1: ethernet@800f4000 {
+                       phy-mode = "rmii";
+                       pinctrl-names = "default";
+                       pinctrl-0 = <&mac1_pins_a>;
+                       status = "okay";
+                       mac-address = [000000000000]; /* will be set by bootloader */
+               };
+       };
+
+       stk5_led: leds {
+               compatible = "gpio-leds";
+
+               user {
+                       label = "Heartbeat";
+                       pinctrl-names = "default";
+                       pinctrl-0 = <&hog_pins_stk_v3_led>;
+                       gpios = <&gpio4 10 0>;
+                       linux,default-trigger = "heartbeat";
+               };
+       };
+
+       backlight {
+               compatible = "pwm-backlight";
+               pwms = <&pwm 0 5000000>;
+               brightness-levels = <100 95 90 85 80 75 70 65 60 55
+                                     50 45 40 35 30 25 20 15 10 5 0>;
+               default-brightness-level = <20>;
+       };
+
+       gpio-switch {
+               compatible = "gpio-switches", "simple-bus";
+               #address-cells = <1>;
+               #size-cells = <0>;
+
+               flexcan_transceiver: gpio-switch@0 {
+                       label = "flexcan transceiver switch";
+                       gpios = <&gpio1 0 1>;
+                       gpio-shared;
+               };
+
+               lcd_power: gpio-switch@1 {
+                       compatible = "linux,gpio-switch";
+                       gpios = <&gpio1 31 0>;
+                       label = "LCD Power Enable";
+                       init-state = <0>;
+               };
+
+               lcd_reset: gpio-switch@2 {
+                       compatible = "linux,gpio-switch";
+                       gpios = <&gpio3 30 1>;
+                       label = "LCD Reset";
+                       init-state = <1>;
+               };
+
+               edt_ft5x06_reset: gpio-switch@3 {
+                       compatible = "linux,gpio-switch";
+                       gpios = <&gpio2 6 1>;
+                       label = "EDT-FT5x06 RESET";
+               };
+
+               edt_ft5x06_wake: gpio-switch@4 {
+                       compatible = "linux,gpio-switch";
+                       gpios = <&gpio4 9 0>;
+                       label = "EDT-FT5x06 WAKE";
+                       init-state = <1>;
+               };
+
+               usbotg_vbus: gpio-switch@5 {
+                       compatible = "linux,gpio-switch";
+                       gpios = <&gpio0 18 0>;
+                       label = "USBOTG VBUS";
+               };
+
+               usbh1_vbus: gpio-switch@6 {
+                       compatible = "linux,gpio-switch";
+                       gpios = <&gpio3 27 0>;
+                       label = "USBH1 VBUS";
+               };
+       };
+
+       regulators {
+               compatible = "simple-bus";
+
+               reg_2p5v: 2p5v {
+                       compatible = "regulator-fixed";
+                       regulator-name = "2P5V";
+                       regulator-min-microvolt = <2500000>;
+                       regulator-max-microvolt = <2500000>;
+                       regulator-always-on;
+               };
+
+               reg_3p3v: 3p3v {
+                       compatible = "regulator-fixed";
+                       regulator-name = "3P3V";
+                       regulator-min-microvolt = <3300000>;
+                       regulator-max-microvolt = <3300000>;
+                       regulator-always-on;
+               };
+
+                reg_usb0_vbus: usb0_vbus {
+                        compatible = "regulator-fixed";
+                        regulator-name = "usb0_vbus";
+                        regulator-min-microvolt = <5000000>;
+                        regulator-max-microvolt = <5000000>;
+                        gpio = <&gpio0 18 1>;
+                };
+
+                reg_usb1_vbus: usb1_vbus {
+                        compatible = "regulator-fixed";
+                        regulator-name = "usb1_vbus";
+                        regulator-min-microvolt = <5000000>;
+                        regulator-max-microvolt = <5000000>;
+                        gpio = <&gpio3 27 1>;
+                };
+       };
+};
diff --git a/board/karo/dts/tx48.dts b/board/karo/dts/tx48.dts
new file mode 100644 (file)
index 0000000..1ae1ff4
--- /dev/null
@@ -0,0 +1,115 @@
+/*
+ * Copyright (C) 2012 Texas Instruments Incorporated - http://www.ti.com/
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+/dts-v1/;
+
+/include/ ARCH_CPU_DTS
+
+/ {
+       model = "Ka-Ro electronics TX48 module";
+       compatible = "karo,tx48", "ti,am33xx";
+
+       memory {
+               device_type = "memory";
+               reg = <0x80000000 0x10000000>; /* 256 MB */
+       };
+
+       i2c@44E0B000 {
+               rtc1: ds1339@68 {
+                       compatible = "dallas,ds1339";
+                       reg = <0x68>;
+                       trickle-charge = <0xa5>;
+               };
+
+               pmic: lt3589@48 {
+                       compatible = "lt,lt3589";
+                       reg = <0x48>;
+               };
+
+               codec: sgtl5000@0a {
+                       compatible = "fsl,sgtl5000";
+                       reg = <0x0a>;
+                       VDDA-supply = <&reg_2p5v>;
+                       VDDIO-supply = <&reg_3p3v>;
+               };
+
+               touchscreen: tsc2007@48 {
+                       compatible = "ti,tsc2007";
+                       reg = <0x48>;
+                       interrupt-parent = <&gpio3>;
+                       interrupts = <16 0>;
+                       pendown-gpio = <&gpio3 16 1>;
+                       model = "2007";
+                       x-plate-ohms = <660>;
+               };
+
+               polytouch: edt-ft5x06@38 {
+                       compatible = "edt,edt-ft5x06";
+                       reg = <0x38>;
+                       interrupt-parent = <&gpio1>;
+                       interrupts = <17>;
+                       reset-switch = <&edt_ft5x06_reset>;
+                       wake-switch = <&edt_ft5x06_wake>;
+               };
+       };
+
+       gpio-switch {
+               compatible = "gpio-switch";
+
+               can_xcvr_enable: can-xcvr-enable {
+                       gpio = <&gpio0 22 1>;
+                       label = "Flexcan Transceiver Enable";
+                       gpio-shared;
+               };
+
+               lcd_power: lcd-power {
+                       compatible = "linux,gpio-switch";
+                       gpio = <&gpio1 22 0>;
+                       label = "LCD Power Enable";
+               };
+
+               lcd_reset: lcd-reset {
+                       compatible = "linux,gpio-switch";
+                       gpio = <&gpio1 19 1>;
+                       label = "LCD Reset";
+                       init-state = <1>;
+               };
+
+               edt_ft5x06_reset: edt-ft5x06-reset {
+                       compatible = "linux,gpio-switch";
+                       gpio = <&gpio1 18 1>;
+                       label = "EDT-FT5x06 RESET";
+               };
+
+               edt_ft5x06_wake: edt-ft5x06-wake {
+                       compatible = "linux,gpio-switch";
+                       gpio = <&gpio1 27 0>;
+                       label = "EDT-FT5x06 WAKE";
+                       init-state = <1>;
+               };
+       };
+
+       regulators {
+               compatible = "simple-bus";
+
+               reg_2p5v: 2p5v {
+                       compatible = "regulator-fixed";
+                       regulator-name = "2P5V";
+                       regulator-min-microvolt = <2500000>;
+                       regulator-max-microvolt = <2500000>;
+                       regulator-always-on;
+               };
+
+               reg_3p3v: 3p3v {
+                       compatible = "regulator-fixed";
+                       regulator-name = "3P3V";
+                       regulator-min-microvolt = <3300000>;
+                       regulator-max-microvolt = <3300000>;
+                       regulator-always-on;
+               };
+       };
+};
diff --git a/board/karo/dts/tx51.dts b/board/karo/dts/tx51.dts
new file mode 100644 (file)
index 0000000..ae86df0
--- /dev/null
@@ -0,0 +1,323 @@
+/*
+ * Copyright 2012 <LW@KARO-electronics.de>
+ *
+ * The code contained herein is licensed under the GNU General Public
+ * License. You may obtain a copy of the GNU General Public License
+ * Version 2 at the following locations:
+ *
+ * http://www.opensource.org/licenses/gpl-license.html
+ * http://www.gnu.org/copyleft/gpl.html
+ */
+
+/dts-v1/;
+/include/ ARCH_CPU_DTS
+
+/ {
+       model = "Ka-Ro electronics TX51 module";
+       compatible = "karo,tx51", "fsl,imx51";
+
+       chosen {
+               bootargs = "init=/linuxrc console=ttymxc0,115200 root=/dev/mtdblock1 ro debug panic=1";
+       };
+
+       aliases {
+               usbh1 = &usbh1;
+               usbotg = &usbotg;
+               usbphy = &usbphy;
+       };
+
+       clocks {
+               ckih1 {
+                       clock-frequency = <0>;
+               };
+       };
+
+       soc {
+               ahb: ahb@40000000 {
+                       ipu: ipu@5e000000 {
+                               status = "okay";
+                       };
+               };
+
+               aips1: aips@70000000 { /* AIPS1 */
+                       spba@70000000 {
+                               mmc0: esdhc@70004000 { /* ESDHC1 */
+                                       cd-gpios = <&gpio3 8 0>;
+                                       fsl,wp-controller;
+                                       status = "okay";
+                               };
+
+                               mmc1: esdhc@70008000 { /* ESDHC2 */
+                                       cd-gpios = <&gpio3 6 0>;
+                                       status = "okay";
+                               };
+
+                               uart@7000c000 {
+                                       status = "okay";
+                                       fsl,uart-has-rtscts;
+                               };
+
+                               spi0: ecspi@70010000 { /* ECSPI1 */
+                                       fsl,spi-num-chipselects = <2>;
+                                       cs-gpios = <&gpio4 24 0 &gpio4 25 0>;
+                                       status = "okay";
+
+                                       spidev0: spi@0 {
+                                               compatible = "spidev";
+                                               reg = <0>;
+                                               spi-max-frequency = <250000000>;
+                                       };
+                               };
+                       };
+
+                       usbotg: imxotg@73f80000 {
+                               status = "okay";
+
+                               ignore-overcurrent;
+                               enable-wakeup;
+                               phy-mode = "utmi-wide";
+                       };
+
+                       usbh1: imxotg@73f80200 {
+                               status = "okay";
+
+                               phy-mode = "ulpi";
+                               ignore-overcurrent;
+                               enable-wakeup;
+                               itc-no-threshold;
+                       };
+
+                       usbphy: imx-usb-phy@73f80800 {
+                               status = "okay";
+
+                               device-ports = <&usbotg>;
+                               host-ports = <&usbotg &usbh1>;
+                       };
+
+                       keypad@73f94000 {
+                               status = "okay";
+                               /* sample keymap */
+                               linux,keymap = < 0x00000074 /* row 0, col 0, KEY_POWER */
+                                                0x00010052 /* row 0, col 1, KEY_KP0 */
+                                                0x0002004f /* row 0, col 2, KEY_KP1 */
+                                                0x00030050 /* row 0, col 3, KEY_KP2 */
+                                                0x00040051 /* row 0, col 4, KEY_KP3 */
+                                                0x0100004b /* row 1, col 0, KEY_KP4 */
+                                                0x0101004c /* row 1, col 1, KEY_KP5 */
+                                                0x0102004d /* row 1, col 2, KEY_KP6 */
+                                                0x01030047 /* row 1, col 3, KEY_KP7 */
+                                                0x01040048 /* row 1, col 4, KEY_KP8 */
+                                                0x02000049 /* row 2, col 0, KEY_KP9 */
+                                                >;
+                       };
+
+                       wdog@73f98000 { /* WDOG1 */
+                               status = "okay";
+                       };
+
+                       iomuxc@73fa8000 {
+                               compatible = "fsl,imx51-iomuxc-tx51";
+                               reg = <0x73fa8000 0x4000>;
+                       };
+
+                       pwm1: pwm@73fb4000 {
+                               status = "okay";
+                       };
+
+                       uart@73fbc000 {
+                               status = "okay";
+                               fsl,uart-has-rtscts;
+                       };
+
+                       uart@73fc0000 {
+                               status = "okay";
+                               fsl,uart-has-rtscts;
+                       };
+               };
+
+               aips2: aips@80000000 {  /* AIPS2 */
+
+                       sdma@83fb0000 {
+                               fsl,sdma-ram-script-name = "sdma-imx51.bin";
+                       };
+
+                       i2c@83fc4000 { /* I2C2 */
+                               status = "okay";
+
+                               codec: sgtl5000@0a {
+                                       compatible = "fsl,sgtl5000";
+                                       reg = <0x0a>;
+                                       VDDA-supply = <&reg_2p5v>;
+                                       VDDIO-supply = <&reg_3p3v>;
+                               };
+
+                               touchscreen: tsc2007@48 {
+                                       compatible = "ti,tsc2007";
+                                       reg = <0x48>;
+                                       interrupt-parent = <&gpio3>;
+                                       interrupts = <3 0>;
+                                       pendown-gpio = <&gpio3 3 1>;
+                                       model = "2007";
+                                       x-plate-ohms = <660>;
+                               };
+
+                               polytouch: edt-ft5x06@38 {
+                                       compatible = "edt,edt-ft5x06";
+                                       reg = <0x38>;
+                                       interrupt-parent = <&gpio1>;
+                                       interrupts = <5>;
+                                       reset-switch = <&edt_ft5x06_reset>;
+                                       wake-switch = <&edt_ft5x06_wake>;
+                               };
+                       };
+
+                       ssi@83fcc000 {
+                               status = "okay";
+                               rx-dma = <28>;
+                               tx-dma = <29>;
+                               i2s-sync-mode;
+                       };
+
+                       ssi@70014000 {
+                               status = "okay";
+                       };
+
+                       audmux@83fd0000 {
+                               status = "okay";
+                       };
+
+                       sound-card@0 {
+                               compatible = "fsl,imx-sgtl5000";
+                               status = "okay";
+                               /* '1' based port numbers according to datasheet names */
+                               ssi-port = <1>;
+                               audmux-port = <3>;
+                               sysclk = <26000000>;
+                       };
+
+                       nand@83fdb000 {
+                               status = "okay";
+
+                               nand-bus-width = <8>;
+                               nand-ecc-mode = "hw";
+                               nand-on-flash-bbt;
+                       };
+
+                       ethernet@83fec000 {
+                               phy-mode = "mii";
+/*
+                               phy-reset-gpios = <&gpio2 14 0>;
+*/
+                               status = "okay";
+                               phy-handle = <&phy0>;
+                               mac-address = [000000000000];
+
+                               phy0: ethernet-phy@0 {
+                                       interrupt-parent = <&gpio3>;
+                                       interrupts = <18>;
+                                       device_type = "ethernet-phy";
+                               };
+                       };
+               };
+       };
+
+       i2c-gpio {
+               #address-cells = <1>;
+               #size-cells = <0>;
+               compatible = "i2c-gpio";
+               gpios = <&gpio4 17 0
+                        &gpio4 16 0>;
+               clock-frequency = <400000>;
+
+               rtc1: ds1339@68 {
+                       compatible = "dallas,ds1339";
+                       reg = <0x68>;
+               };
+       };
+
+       gpio-switch {
+               compatible = "gpio-switches", "simple-bus";
+               #address-cells = <1>;
+               #size-cells = <0>;
+               lcd_power: gpio-switch@1 {
+                       compatible = "linux,gpio-switch";
+                       gpio = <&gpio4 14 0>;
+                       label = "LCD Power Enable";
+                       init-state = <0>;
+               };
+
+               lcd_reset: gpio-switch@2 {
+                       compatible = "linux,gpio-switch";
+                       gpio = <&gpio4 13 1>;
+                       label = "LCD Reset";
+                       init-state = <1>;
+               };
+
+               edt_ft5x06_reset: gpio-switch@3 {
+                       compatible = "linux,gpio-switch";
+                       gpio = <&gpio4 15 1>;
+                       label = "EDT-FT5x06 RESET";
+               };
+
+               edt_ft5x06_wake: gpio-switch@4 {
+                       compatible = "linux,gpio-switch";
+                       gpio = <&gpio4 9 0>;
+                       label = "EDT-FT5x06 WAKE";
+                       init-state = <1>;
+               };
+
+               usbotg_vbus: gpio-switch@5 {
+                       compatible = "linux,gpio-switch";
+                       gpio = <&gpio1 8 0>;
+                       label = "USBOTG VBUS";
+               };
+       };
+
+       leds {
+               compatible = "gpio-leds";
+
+               user {
+                       label = "Heartbeat";
+                       gpios = <&gpio4 10 0>;
+                       linux,default-trigger = "heartbeat";
+               };
+       };
+
+       lcd {
+               compatible = "of-gpio-lcd";
+               parent = <&ipu>;
+
+               power-switch = <&gpio4 14 0>;
+               reset-switch = <&gpio4 13 1>;
+       };
+
+       backlight: pwm-backlight {
+               compatible = "pwm-backlight";
+
+               pwm = <&pwm1>;
+               inverted;
+               max-brightness = <100>;
+               dft-brightness = <50>;
+               pwm-period-ns = <1000000>;
+       };
+
+       regulators {
+               compatible = "simple-bus";
+
+               reg_2p5v: 2p5v {
+                       compatible = "regulator-fixed";
+                       regulator-name = "2P5V";
+                       regulator-min-microvolt = <2500000>;
+                       regulator-max-microvolt = <2500000>;
+                       regulator-always-on;
+               };
+
+               reg_3p3v: 3p3v {
+                       compatible = "regulator-fixed";
+                       regulator-name = "3P3V";
+                       regulator-min-microvolt = <3300000>;
+                       regulator-max-microvolt = <3300000>;
+                       regulator-always-on;
+               };
+       };
+};
diff --git a/board/karo/dts/tx53.dts b/board/karo/dts/tx53.dts
new file mode 100644 (file)
index 0000000..1ac3bfa
--- /dev/null
@@ -0,0 +1,440 @@
+/*
+ * Copyright 2012 <LW@KARO-electronics.de>
+ * based on imx53-qsb.dts
+ *   Copyright 2011 Freescale Semiconductor, Inc.
+ *   Copyright 2011 Linaro Ltd.
+ *
+ * The code contained herein is licensed under the GNU General Public
+ * License. You may obtain a copy of the GNU General Public License
+ * Version 2 at the following locations:
+ *
+ * http://www.opensource.org/licenses/gpl-license.html
+ * http://www.gnu.org/copyleft/gpl.html
+ */
+
+/dts-v1/;
+/include/ ARCH_CPU_DTS
+
+/ {
+       model = "Ka-Ro electronics TX53 module";
+       compatible = "karo,tx53", "fsl,imx53";
+
+       chosen {
+               bootargs = "init=/linuxrc console=ttymxc0,115200 root=/dev/mtdblock4 rootfstype=jffs2 ro debug panic=1";
+       };
+
+       aliases {
+               usbh1 = &usbh1;
+               usbotg = &usbotg;
+               usbphy = &usbphy;
+       };
+
+       clocks {
+               ckih1 {
+                       clock-frequency = <0>;
+               };
+       };
+
+       soc {
+               extmc: extmc@00000000 {
+                       sata: sata@10000000 {
+                               status = "okay";
+                       };
+
+                       ipu: ipu@1e000000 {
+                               status = "okay";
+                       };
+               };
+
+               aips1: aips@50000000 { /* AIPS1 */
+                       spba@50000000 {
+                               mmc0: esdhc@50004000 { /* ESDHC1 */
+                                       status = "okay";
+                                       cd-gpios = <&gpio3 24 0>;
+                                       fsl,wp-controller;
+                                       pinctrl-names = "default";
+                                       pinctrl-0 = <
+                                               &pinctrl_esdhc1_1
+                                               &pinctrl_esdhc1_cd
+                                       >;
+                               };
+
+                               mmc1: esdhc@50008000 { /* ESDHC2 */
+                                       status = "okay";
+                                       cd-gpios = <&gpio3 25 0>;
+                                       fsl,wp-controller;
+                                       pinctrl-names = "default";
+                                       pinctrl-0 = <
+                                               &pinctrl_esdhc2_1
+                                               &pinctrl_esdhc2_cd
+                                       >;
+                               };
+
+                               serial@5000c000 {
+                                       status = "okay";
+                                       pinctrl-names = "default";
+                                       pinctrl-0 = <&pinctrl_uart3_1>;
+                                       fsl,uart-has-rtscts;
+                               };
+
+                               spi0: ecspi@50010000 { /* ECSPI1 */
+                                       status = "okay";
+
+                                       pinctrl-names = "default";
+                                       pinctrl-0 = <
+                                               &pinctrl_ecspi1_1
+                                               &pinctrl_cspi1_cs
+                                       >;
+
+                                       fsl,spi-num-chipselects = <2>;
+                                       cs-gpios = <&gpio2 30 0 &gpio3 19 0>;
+
+                                       spidev0: spi@0 {
+                                               compatible = "spidev";
+                                               reg = <0>;
+                                               spi-max-frequency = <54000000>;
+                                       };
+                               };
+                       };
+
+                       usbotg: imxotg@53f80000 {
+                               status = "okay";
+
+                               ignore-overcurrent;
+                               enable-wakeup;
+                               vbus-gpio = <&usbotg_vbus>;
+                       };
+
+                       usbh1: imxotg@53f80200 {
+                               status = "okay";
+
+                               ignore-overcurrent;
+                               enable-wakeup;
+                               vbus-gpio = <&usbh1_vbus>;
+                       };
+
+                       usbphy: imx-usb-phy@53f80800 {
+                               status = "okay";
+
+                               device-ports = <&usbotg>;
+                               host-ports = <&usbotg &usbh1>;
+                       };
+
+                       keypad@53f94000 {
+                               status = "okay";
+                               /* sample keymap */
+                               /* row/col 0,1 are mapped to KPP row/col 6,7 */
+                               linux,keymap = < 0x06060074 /* row 6, col 6, KEY_POWER */
+                                                0x06070052 /* row 6, col 7, KEY_KP0 */
+                                                0x0602004f /* row 6, col 2, KEY_KP1 */
+                                                0x06030050 /* row 6, col 3, KEY_KP2 */
+                                                0x07060051 /* row 7, col 6, KEY_KP3 */
+                                                0x0707004b /* row 7, col 7, KEY_KP4 */
+                                                0x0702004c /* row 7, col 2, KEY_KP5 */
+                                                0x0703004d /* row 7, col 3, KEY_KP6 */
+                                                0x02060047 /* row 2, col 6, KEY_KP7 */
+                                                0x02070048 /* row 2, col 7, KEY_KP8 */
+                                                0x02020049 /* row 2, col 2, KEY_KP9 */
+                                                >;
+                       };
+
+                       wdog@53f98000 { /* WDOG1 */
+                               status = "okay";
+                       };
+
+                       iomuxc@53fa8000 {
+                               pinctrl-names = "default";
+
+                               pincontroller {
+                                       pinctrl_stk5_led: stk5-led-gpios {
+                                               fsl,pins = <
+                                                       589 0xc0 /* MX53_PAD_EIM_A18__GPIO2_20 */
+                                               >;
+                                       };
+
+                                       pinctrl_ds1339_int: ds1339-gpios {
+                                               fsl,pins = <
+                                                       104 0xe0 /* MX53_PAD_DI0_PIN4__GPIO4_20 */
+                                               >;
+                                       };
+
+                                       pinctrl_cspi1_cs: cspi1-cs-gpios {
+                                               fsl,pins = <
+                                                       424 0xe0 /* MX53_PAD_EIM_EB2__GPIO2_30 */
+                                                       449 0xe0 /* MX53_PAD_EIM_D19__GPIO3_19 */
+                                               >;
+                                       };
+
+                                       pinctrl_esdhc1_cd: esdhc1-cd-gpios {
+                                               fsl,pins = <
+                                                       501 0x1f0 /* MX53_PAD_EIM_D25__GPIO3_25 */
+                                               >;
+                                       };
+
+                                       pinctrl_esdhc2_cd: esdhc2-cd-gpios {
+                                               fsl,pins = <
+                                                       517 0x1f0 /* MX53_PAD_EIM_D27__GPIO3_27 */
+                                               >;
+                                       };
+                               };
+                       };
+
+                       pwm2: pwm@53fb8000 {
+                               status = "okay";
+                       };
+
+                       serial@53fbc000 {
+                               status = "okay";
+                               pinctrl-names = "default";
+                               pinctrl-0 = <&pinctrl_uart1_2>;
+                               fsl,uart-has-rtscts;
+                       };
+
+                       serial@53fc0000 {
+                               status = "okay";
+                               pinctrl-names = "default";
+                               pinctrl-0 = <&pinctrl_uart2_1>;
+                               fsl,uart-has-rtscts;
+                       };
+
+                       can@53fc8000 {
+                               status = "okay";
+                               transceiver-switch = <&flexcan_transceiver>;
+                       };
+
+                       can@53fcc000 {
+                               status = "okay";
+                               transceiver-switch = <&flexcan_transceiver>;
+                       };
+
+                       i2c@53fec000 { /* I2C3 */
+                               status = "okay";
+
+                               pinctrl-names = "default";
+                               pinctrl-0 = <&pinctrl_i2c3_1>;
+
+                               sgtl5000: sgtl5000@0a {
+                                       compatible = "fsl,sgtl5000";
+                                       reg = <0x0a>;
+                                       VDDA-supply = <&reg_2p5v>;
+                                       VDDIO-supply = <&reg_3p3v>;
+                                       clock-frequency = <26000000>;
+                               };
+
+                               touchscreen: tsc2007@48 {
+                                       compatible = "ti,tsc2007";
+                                       reg = <0x48>;
+                                       interrupt-parent = <&gpio3>;
+                                       interrupts = <26 0>;
+                                       pendown-gpio = <&gpio3 26 1>;
+                                       model = "2007";
+                                       x-plate-ohms = <660>;
+                               };
+
+                               polytouch: edt-ft5x06@ {
+                                       compatible = "edt,edt-ft5x06";
+                                       reg = <0x38>;
+                                       interrupt-parent = <&gpio6>;
+                                       interrupts = <15 0>;
+                                       reset-switch = <&edt_ft5x06_reset>;
+                                       wake-switch = <&edt_ft5x06_wake>;
+                               };
+                       };
+               };
+
+               aips2: aips@60000000 {  /* AIPS2 */
+
+                       sdma@63fb0000 {
+                               fsl,sdma-ram-script-name = "sdma-imx53.bin";
+                       };
+
+                       i2c@63fc8000 { /* I2C1 */
+                               status = "okay";
+
+                               pinctrl-names = "default";
+                               pinctrl-0 = <
+                                       &pinctrl_i2c1_2
+                                       &pinctrl_ds1339_int
+                               >;
+
+                               rtc1: ds1339@68 {
+                                       compatible = "dallas,ds1339";
+                                       reg = <0x68>;
+                                       trickle-charge = <0xa5>;
+                                       interrupt-parent = <&gpio4>;
+                                       interrupts = <20 0>;
+                               };
+
+                               pmic: lt3589@48 {
+                                       compatible = "lt,lt3589";
+                                       reg = <0x48>;
+                               };
+                       };
+
+                       ssi@63fcc000 {
+                               status = "okay";
+
+                               fsl,mode = "i2s-slave";
+                               codec-handle = <&sgtl5000>;
+                       };
+
+                       ssi@50014000 {
+                               status = "okay";
+                       };
+
+                       audmux@63fd0000 {
+                               status = "okay";
+
+                               pinctrl-names = "default";
+                               pinctrl-0 = <&pinctrl_audmux_1>;
+                       };
+
+                       nand@63fdb000 {
+                               status = "okay";
+
+                               nand-bus-width = <8>;
+                               nand-ecc-mode = "hw";
+                               nand-on-flash-bbt;
+                       };
+
+                       ethernet@63fec000 {
+                               status = "okay";
+
+                               pinctrl-names = "default";
+                               pinctrl-0 = <&pinctrl_fec_1>;
+
+                               phy-mode = "rmii";
+                               phy-reset-gpios = <&gpio7 6 0>;
+                               phy-handle = <&phy0>;
+                               mac-address = [000000000000];
+
+                               phy0: ethernet-phy@0 {
+                                       interrupt-parent = <&gpio2>;
+                                       interrupts = <4>;
+                                       device_type = "ethernet-phy";
+                               };
+                       };
+               };
+       };
+
+       sound {
+               compatible = "karo,tx53x-audio-sgtl5000", "fsl,imx-audio-sgtl5000";
+               status = "okay";
+               model = "tx53x-audio-sgtl5000";
+               ssi-controller = <&ssi1>;
+               audio-codec = <&sgtl5000>;
+               audio-routing =
+                       "MIC_IN", "Mic Jack",
+                       "Mic Jack", "Mic Bias",
+                       "Headphone Jack", "HP_OUT";
+               /* '1' based port numbers according to datasheet names */
+               mux-int-port = <1>;
+               mux-ext-port = <5>;
+       };
+
+       gpio-switch {
+               compatible = "gpio-switches", "simple-bus";
+               #address-cells = <1>;
+               #size-cells = <0>;
+
+               flexcan_transceiver: gpio-switch@0 {
+                       compatible = "linux,gpio-switch";
+                       gpio = <&gpio4 21 1>;
+                       label = "Flexcan Transceiver Enable";
+                       gpio-shared;
+                       init-state = <0>;
+               };
+
+               lcd_power: gpio-switch@1 {
+                       compatible = "linux,gpio-switch";
+                       gpio = <&gpio2 31 0>;
+                       label = "LCD Power Enable";
+                       init-state = <0>;
+               };
+
+               lcd_reset: gpio-switch@2 {
+                       compatible = "linux,gpio-switch";
+                       gpio = <&gpio3 29 1>;
+                       label = "LCD Reset";
+                       init-state = <1>;
+               };
+
+               edt_ft5x06_reset: gpio-switch@3 {
+                       compatible = "linux,gpio-switch";
+                       gpio = <&gpio2 22 1>;
+                       label = "EDT-FT5x06 RESET";
+               };
+
+               edt_ft5x06_wake: gpio-switch@4 {
+                       compatible = "linux,gpio-switch";
+                       gpio = <&gpio2 21 0>;
+                       label = "EDT-FT5x06 WAKE";
+                       init-state = <1>;
+               };
+
+               usbotg_vbus: gpio-switch@5 {
+                       compatible = "linux,gpio-switch";
+                       gpio = <&gpio1 7 0>;
+                       label = "USBOTG VBUS";
+               };
+
+               usbh1_vbus: gpio-switch@6 {
+                       compatible = "linux,gpio-switch";
+                       gpio = <&gpio3 31 0>;
+                       label = "USBH1 VBUS";
+               };
+       };
+
+       leds {
+               compatible = "gpio-leds";
+
+               pinctrl-names = "default";
+               pinctrl-0 = <&pinctrl_stk5_led>;
+
+               user {
+                       label = "Heartbeat";
+                       gpios = <&gpio2 20 0>;
+                       linux,default-trigger = "heartbeat";
+               };
+       };
+
+       lcd {
+               compatible = "of-gpio-lcd";
+
+               power-switch = <&lcd_power>;
+/*
+               reset-switch = <&lcd_reset>;
+               reset-delay-us = <300>;
+*/
+       };
+
+       backlight: pwm-backlight {
+               compatible = "pwm-backlight";
+
+               pwm = <&pwm2>;
+               inverted;
+               max-brightness = <100>;
+               dft-brightness = <50>;
+               pwm-period-ns = <1000000>;
+       };
+
+       regulators {
+               compatible = "simple-bus";
+
+               reg_2p5v: 2p5v {
+                       compatible = "regulator-fixed";
+                       regulator-name = "2P5V";
+                       regulator-min-microvolt = <2500000>;
+                       regulator-max-microvolt = <2500000>;
+                       regulator-always-on;
+               };
+
+               reg_3p3v: 3p3v {
+                       compatible = "regulator-fixed";
+                       regulator-name = "3P3V";
+                       regulator-min-microvolt = <3300000>;
+                       regulator-max-microvolt = <3300000>;
+                       regulator-always-on;
+               };
+       };
+};
diff --git a/board/karo/tx28/Makefile b/board/karo/tx28/Makefile
new file mode 100644 (file)
index 0000000..e793140
--- /dev/null
@@ -0,0 +1,53 @@
+#
+# (C) Copyright 2009 DENX Software Engineering
+# Author: John Rigby <jcrigby@gmail.com>
+#
+# See file CREDITS for list of people who contributed to this
+# project.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 2 of
+# the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+# MA 02111-1307 USA
+#
+
+include $(TOPDIR)/config.mk
+
+LIB    = $(obj)lib$(BOARD).o
+
+COBJS  := tx28.o
+ifeq ($(CONFIG_SPL_BUILD),y)
+       COBJS += spl_boot.o
+else
+ifeq ($(CONFIG_CMD_ROMUPDATE),y)
+       COBJS += flash.o
+endif
+endif
+
+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))
+
+$(obj)u-boot.db: u-boot.db.in
+       sed "s:@@BUILD_DIR@@:${BUILD_DIR:-.}/:" $< > $@
+
+#########################################################################
+
+include $(SRCTREE)/rules.mk
+
+sinclude $(obj).depend
+
+#########################################################################
diff --git a/board/karo/tx28/config.mk b/board/karo/tx28/config.mk
new file mode 100644 (file)
index 0000000..a11dc49
--- /dev/null
@@ -0,0 +1,10 @@
+# stack is allocated below CONFIG_SYS_TEXT_BASE
+CONFIG_SYS_TEXT_BASE := 0x40100000
+CONFIG_SPL_TEXT_BASE := 0x00000000
+
+LOGO_BMP = logos/karo.bmp
+
+PLATFORM_CPPFLAGS += -Werror
+ifneq ($(CONFIG_SPL_BUILD),y)
+       ALL-y += $(obj)u-boot.sb
+endif
diff --git a/board/karo/tx28/flash.c b/board/karo/tx28/flash.c
new file mode 100644 (file)
index 0000000..376e6b4
--- /dev/null
@@ -0,0 +1,592 @@
+#include <common.h>
+#include <malloc.h>
+#include <nand.h>
+#include <errno.h>
+
+#include <linux/err.h>
+
+#include <asm/io.h>
+#include <asm/sizes.h>
+#include <asm/arch/regs-base.h>
+#include <asm/arch/regs-gpmi.h>
+#include <asm/arch/regs-bch.h>
+
+#define FCB_START_BLOCK                0
+#define NUM_FCB_BLOCKS         1
+#define MAX_FCB_BLOCKS         32768
+
+struct mx28_nand_timing {
+       u8 data_setup;
+       u8 data_hold;
+       u8 address_setup;
+       u8 dsample_time;
+       u8 nand_timing_state;
+       u8 tREA;
+       u8 tRLOH;
+       u8 tRHOH;
+};
+
+struct mx28_fcb {
+       u32 checksum;
+       u32 fingerprint;
+       u32 version;
+       struct mx28_nand_timing timing;
+       u32 page_data_size;
+       u32 total_page_size;
+       u32 sectors_per_block;
+       u32 number_of_nands;    /* not used by ROM code */
+       u32 total_internal_die; /* not used by ROM code */
+       u32 cell_type;          /* not used by ROM code */
+       u32 ecc_blockn_type;
+       u32 ecc_block0_size;
+       u32 ecc_blockn_size;
+       u32 ecc_block0_type;
+       u32 metadata_size;
+       u32 ecc_blocks_per_page;
+       u32 rsrvd[6];            /* not used by ROM code */
+       u32 bch_mode;
+       u32 boot_patch;
+       u32 patch_sectors;
+       u32 fw1_start_page;
+       u32 fw2_start_page;
+       u32 fw1_sectors;
+       u32 fw2_sectors;
+       u32 dbbt_search_area;
+       u32 bb_mark_byte;
+       u32 bb_mark_startbit;
+       u32 bb_mark_phys_offset;
+};
+
+struct mx28_dbbt_header {
+       u32 checksum;
+       u32 fingerprint;
+       u32 version;
+       u32 number_bb;
+       u32 number_pages;
+       u8 spare[492];
+};
+
+struct mx28_dbbt {
+       u32 nand_number;
+       u32 number_bb;
+       u32 bb_num[2040 / 4];
+};
+
+#define BF_VAL(v, bf)          (((v) & bf##_MASK) >> bf##_OFFSET)
+
+static nand_info_t *mtd = &nand_info[0];
+
+extern void *_start;
+
+#define BIT(v,n)       (((v) >> (n)) & 0x1)
+
+static u8 calculate_parity_13_8(u8 d)
+{
+       u8 p = 0;
+
+       p |= (BIT(d, 6) ^ BIT(d, 5) ^ BIT(d, 3) ^ BIT(d, 2))             << 0;
+       p |= (BIT(d, 7) ^ BIT(d, 5) ^ BIT(d, 4) ^ BIT(d, 2) ^ BIT(d, 1)) << 1;
+       p |= (BIT(d, 7) ^ BIT(d, 6) ^ BIT(d, 5) ^ BIT(d, 1) ^ BIT(d, 0)) << 2;
+       p |= (BIT(d, 7) ^ BIT(d, 4) ^ BIT(d, 3) ^ BIT(d, 0))             << 3;
+       p |= (BIT(d, 6) ^ BIT(d, 4) ^ BIT(d, 3) ^ BIT(d, 2) ^ BIT(d, 1) ^ BIT(d, 0)) << 4;
+       return p;
+}
+
+static void encode_hamming_13_8(void *_src, void *_ecc, size_t size)
+{
+       int i;
+       u8 *src = _src;
+       u8 *ecc = _ecc;
+
+       for (i = 0; i < size; i++)
+               ecc[i] = calculate_parity_13_8(src[i]);
+}
+
+static u32 calc_chksum(void *buf, size_t size)
+{
+       u32 chksum = 0;
+       u8 *bp = buf;
+       size_t i;
+
+       for (i = 0; i < size; i++) {
+               chksum += bp[i];
+       }
+       return ~chksum;
+}
+
+/*
+  Physical organisation of data in NAND flash:
+  metadata
+  payload chunk 0 (may be empty)
+  ecc for metadata + payload chunk 0
+  payload chunk 1
+  ecc for payload chunk 1
+...
+  payload chunk n
+  ecc for payload chunk n
+ */
+
+static int calc_bb_offset(nand_info_t *mtd, struct mx28_fcb *fcb)
+{
+       int bb_mark_offset;
+       int chunk_data_size = fcb->ecc_blockn_size * 8;
+       int chunk_ecc_size = (fcb->ecc_blockn_type << 1) * 13;
+       int chunk_total_size = chunk_data_size + chunk_ecc_size;
+       int bb_mark_chunk, bb_mark_chunk_offs;
+
+       bb_mark_offset = (mtd->writesize - fcb->metadata_size) * 8;
+       if (fcb->ecc_block0_size == 0)
+               bb_mark_offset -= (fcb->ecc_block0_type << 1) * 13;
+
+       bb_mark_chunk = bb_mark_offset / chunk_total_size;
+       bb_mark_chunk_offs = bb_mark_offset - (bb_mark_chunk * chunk_total_size);
+       if (bb_mark_chunk_offs > chunk_data_size) {
+               printf("Unsupported ECC layout; BB mark resides in ECC data: %u\n",
+                       bb_mark_chunk_offs);
+               return -EINVAL;
+       }
+       bb_mark_offset -= bb_mark_chunk * chunk_ecc_size;
+       return bb_mark_offset;
+}
+
+static struct mx28_fcb *create_fcb(void *buf, int fw1_start_block,
+                               int fw2_start_block, size_t fw_size)
+{
+       struct mx28_gpmi_regs *gpmi_base =
+               (struct mx28_gpmi_regs *)MXS_GPMI_BASE;
+       struct mx28_bch_regs *bch_base =
+               (struct mx28_bch_regs *)MXS_BCH_BASE;
+       u32 fl0, fl1;
+       u32 t0, t1;
+       int metadata_size;
+       int bb_mark_bit_offs;
+       struct mx28_fcb *fcb;
+       int fcb_offs;
+
+       if (gpmi_base == NULL || bch_base == NULL) {
+               return ERR_PTR(-ENOMEM);
+       }
+
+       fl0 = readl(&bch_base->hw_bch_flash0layout0);
+       fl1 = readl(&bch_base->hw_bch_flash0layout1);
+       t0 = readl(&gpmi_base->hw_gpmi_timing0);
+       t1 = readl(&gpmi_base->hw_gpmi_timing1);
+
+       metadata_size = BF_VAL(fl0, BCH_FLASHLAYOUT0_META_SIZE);
+
+       fcb = buf + ALIGN(metadata_size, 4);
+       fcb_offs = (void *)fcb - buf;
+
+       memset(buf, 0xff, fcb_offs);
+       memset(fcb, 0x00, sizeof(*fcb));
+       memset(fcb + 1, 0xff, mtd->erasesize - fcb_offs - sizeof(*fcb));
+
+       strncpy((char *)&fcb->fingerprint, "FCB ", 4);
+       fcb->version = cpu_to_be32(1);
+
+       fcb->timing.data_setup = BF_VAL(t0, GPMI_TIMING0_DATA_SETUP);
+       fcb->timing.data_hold = BF_VAL(t0, GPMI_TIMING0_DATA_HOLD);
+       fcb->timing.address_setup = BF_VAL(t0, GPMI_TIMING0_ADDRESS_SETUP);
+
+       fcb->page_data_size = mtd->writesize;
+       fcb->total_page_size = mtd->writesize + mtd->oobsize;
+       fcb->sectors_per_block = mtd->erasesize / mtd->writesize;
+
+       fcb->ecc_block0_type = BF_VAL(fl0, BCH_FLASHLAYOUT0_ECC0);
+       fcb->ecc_block0_size = BF_VAL(fl0, BCH_FLASHLAYOUT0_DATA0_SIZE);
+       fcb->ecc_blockn_type = BF_VAL(fl1, BCH_FLASHLAYOUT1_ECCN);
+       fcb->ecc_blockn_size = BF_VAL(fl1, BCH_FLASHLAYOUT1_DATAN_SIZE);
+
+       fcb->metadata_size = BF_VAL(fl0, BCH_FLASHLAYOUT0_META_SIZE);
+       fcb->ecc_blocks_per_page = BF_VAL(fl0, BCH_FLASHLAYOUT0_NBLOCKS);
+       fcb->bch_mode = readl(&bch_base->hw_bch_mode);
+/*
+       fcb->boot_patch = 0;
+       fcb->patch_sectors = 0;
+*/
+       fcb->fw1_start_page = fw1_start_block * mtd->erasesize / mtd->writesize;
+       fcb->fw1_sectors = DIV_ROUND_UP(fw_size, mtd->writesize);
+
+       if (fw2_start_block != 0 && fw2_start_block < mtd->size / mtd->erasesize) {
+               fcb->fw2_start_page = fw2_start_block * mtd->erasesize / mtd->writesize;
+               fcb->fw2_sectors = fcb->fw1_sectors;
+       }
+
+       fcb->dbbt_search_area = 1;
+
+       bb_mark_bit_offs = calc_bb_offset(mtd, fcb);
+       if (bb_mark_bit_offs < 0)
+               return ERR_PTR(bb_mark_bit_offs);
+       fcb->bb_mark_byte = bb_mark_bit_offs / 8;
+       fcb->bb_mark_startbit = bb_mark_bit_offs % 8;
+       fcb->bb_mark_phys_offset = mtd->writesize;
+
+       fcb->checksum = calc_chksum(&fcb->fingerprint, 512 - 4);
+       return fcb;
+}
+
+static int find_fcb(void *ref, int page)
+{
+       int ret = 0;
+       struct nand_chip *chip = mtd->priv;
+       void *buf = malloc(mtd->erasesize);
+
+       if (buf == NULL) {
+               return -ENOMEM;
+       }
+       chip->select_chip(mtd, 0);
+       chip->cmdfunc(mtd, NAND_CMD_READ0, 0x00, page);
+       ret = chip->ecc.read_page_raw(mtd, chip, buf, page);
+       if (ret) {
+               printf("Failed to read FCB from page %u: %d\n", page, ret);
+               return ret;
+       }
+       chip->select_chip(mtd, -1);
+       if (memcmp(buf, ref, mtd->writesize) == 0) {
+               printf("%s: Found FCB in page %u (%08x)\n", __func__,
+                       page, page * mtd->writesize);
+               ret = 1;
+       }
+       free(buf);
+       return ret;
+}
+
+static int write_fcb(void *buf, int block)
+{
+       int ret;
+       struct nand_chip *chip = mtd->priv;
+       int page = block * mtd->erasesize / mtd->writesize;
+
+       ret = find_fcb(buf, page);
+       if (ret > 0) {
+               printf("FCB at block %d is up to date\n", block);
+               return 0;
+       }
+
+       ret = nand_erase(mtd, block * mtd->erasesize, mtd->erasesize);
+       if (ret) {
+               printf("Failed to erase FCB block %u\n", block);
+               return ret;
+       }
+
+       printf("Writing FCB to block %d @ %08x\n", block,
+               block * mtd->erasesize);
+       chip->select_chip(mtd, 0);
+       ret = chip->write_page(mtd, chip, buf, page, 0, 1);
+       if (ret) {
+               printf("Failed to write FCB to block %u: %d\n", block, ret);
+       }
+       chip->select_chip(mtd, -1);
+       return ret;
+}
+
+#define chk_overlap(a,b)                               \
+       ((a##_start_block <= b##_end_block &&           \
+               a##_end_block >= b##_start_block) ||    \
+       (b##_start_block <= a##_end_block &&            \
+               b##_end_block >= a##_start_block))
+
+#define fail_if_overlap(a,b,m1,m2) do {                                \
+       if (chk_overlap(a, b)) {                                \
+               printf("%s blocks %lu..%lu overlap %s in blocks %lu..%lu!\n", \
+                       m1, a##_start_block, a##_end_block,     \
+                       m2, b##_start_block, b##_end_block);    \
+               return -EINVAL;                                 \
+       }                                                       \
+} while (0)
+
+#ifndef CONFIG_ENV_OFFSET_REDUND
+#define TOTAL_ENV_SIZE CONFIG_ENV_SIZE
+#else
+#define TOTAL_ENV_SIZE (CONFIG_ENV_SIZE * 2)
+#endif
+
+int do_update(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+{
+       int ret;
+       int block;
+       int erase_size = mtd->erasesize;
+       int page_size = mtd->writesize;
+       void *buf;
+       char *load_addr;
+       char *file_size;
+       size_t size = 0;
+       void *addr = NULL;
+       struct mx28_fcb *fcb;
+       unsigned long fcb_start_block = FCB_START_BLOCK;
+       unsigned long num_fcb_blocks = NUM_FCB_BLOCKS;
+       unsigned long fcb_end_block;
+       unsigned long mtd_num_blocks = mtd->size / mtd->erasesize;
+       unsigned long env_start_block = CONFIG_ENV_OFFSET / mtd->erasesize;
+       unsigned long env_end_block = env_start_block +
+               DIV_ROUND_UP(TOTAL_ENV_SIZE, mtd->erasesize) - 1;
+       int optind;
+       int fw1_set = 0;
+       int fw2_set = 0;
+       unsigned long fw1_start_block = 0, fw1_end_block;
+       unsigned long fw2_start_block = 0, fw2_end_block;
+       unsigned long fw_num_blocks;
+       unsigned long extra_blocks = 2;
+       nand_erase_options_t erase_opts = { 0, };
+       int fcb_written = 0;
+
+       load_addr = getenv("fileaddr");
+       file_size = getenv("filesize");
+
+       if (argc < 2 && load_addr == NULL) {
+               printf("Load address not specified\n");
+               return -EINVAL;
+       }
+       if (argc < 3 && file_size == NULL) {
+               printf("Image size not specified\n");
+               return -EINVAL;
+       }
+
+       for (optind = 1; optind < argc; optind++) {
+               if (strcmp(argv[optind], "-b") == 0) {
+                       if (optind >= argc - 1) {
+                               printf("Option %s requires an argument\n", argv[optind]);
+                               return -EINVAL;
+                       }
+                       optind++;
+                       fcb_start_block = simple_strtoul(argv[optind], NULL, 0);
+                       if (fcb_start_block >= mtd_num_blocks) {
+                               printf("Block number %lu is out of range: 0..%lu\n",
+                                       fcb_start_block, mtd_num_blocks - 1);
+                               return -EINVAL;
+                       }
+               } else if (strcmp(argv[optind], "-n") == 0) {
+                       if (optind >= argc - 1) {
+                               printf("Option %s requires an argument\n", argv[optind]);
+                               return -EINVAL;
+                       }
+                       optind++;
+                       num_fcb_blocks = simple_strtoul(argv[optind], NULL, 0);
+                       if (num_fcb_blocks > MAX_FCB_BLOCKS) {
+                               printf("Extraneous number of FCB blocks; max. allowed: %u\n",
+                                       MAX_FCB_BLOCKS);
+                               return -EINVAL;
+                       }
+               } else if (strcmp(argv[optind], "-f") == 0) {
+                       if (optind >= argc - 1) {
+                               printf("Option %s requires an argument\n", argv[optind]);
+                               return -EINVAL;
+                       }
+                       optind++;
+                       fw1_start_block = simple_strtoul(argv[optind], NULL, 0);
+                       if (fw1_start_block >= mtd_num_blocks) {
+                               printf("Block number %lu is out of range: 0..%lu\n",
+                                       fw1_start_block,
+                                       mtd_num_blocks - 1);
+                               return -EINVAL;
+                       }
+                       fw1_set = 1;
+               } else if (strcmp(argv[optind], "-r") == 0) {
+                       if (optind < argc - 1 && argv[optind + 1][0] != '-') {
+                               optind++;
+                               fw2_start_block = simple_strtoul(argv[optind], NULL, 0);
+                               if (fw2_start_block >= mtd_num_blocks) {
+                                       printf("Block number %lu is out of range: 0..%lu\n",
+                                               fw2_start_block,
+                                               mtd_num_blocks - 1);
+                                       return -EINVAL;
+                               }
+                       }
+                       fw2_set = 1;
+               } else if (strcmp(argv[optind], "-e") == 0) {
+                       if (optind >= argc - 1) {
+                               printf("Option %s requires an argument\n", argv[optind]);
+                               return -EINVAL;
+                       }
+                       optind++;
+                       extra_blocks = simple_strtoul(argv[optind], NULL, 0);
+                       if (extra_blocks >= mtd_num_blocks) {
+                               printf("Extra block count %lu is out of range: 0..%lu\n",
+                                       extra_blocks,
+                                       mtd_num_blocks - 1);
+                               return -EINVAL;
+                       }
+               } else if (argv[optind][0] == '-') {
+                       printf("Unrecognized option %s\n", argv[optind]);
+                       return -EINVAL;
+               }
+       }
+       if (argc > optind) {
+               load_addr = NULL;
+               addr = (void *)simple_strtoul(argv[optind], NULL, 0);
+               optind++;
+       }
+       if (argc > optind) {
+               file_size = NULL;
+               size = simple_strtoul(argv[optind], NULL, 0);
+               optind++;
+       }
+       if (load_addr != NULL) {
+               addr = (void *)simple_strtoul(load_addr, NULL, 16);
+               printf("Using default load address %p\n", addr);
+       }
+       if (file_size != NULL) {
+               size = simple_strtoul(file_size, NULL, 16);
+               printf("Using default file size %08x\n", size);
+       }
+       fcb_end_block = fcb_start_block + num_fcb_blocks - 1;
+       fw_num_blocks = DIV_ROUND_UP(size, mtd->erasesize);
+
+       if (!fw1_set) {
+               fw1_start_block = fcb_end_block + 1;
+               fw1_end_block = fw1_start_block + fw_num_blocks + extra_blocks - 1;
+               if (chk_overlap(fw1, env)) {
+                       fw1_start_block = env_end_block + 1;
+                       fw1_end_block = fw1_start_block + fw_num_blocks + extra_blocks - 1;
+               }
+       } else {
+               fw1_end_block = fw1_start_block + fw_num_blocks + extra_blocks - 1;
+       }
+
+       if (fw2_set && fw2_start_block == 0) {
+               fw2_start_block = fw1_end_block + 1;
+               fw2_end_block = fw2_start_block + fw_num_blocks + extra_blocks - 1;
+               if (chk_overlap(fw2, env)) {
+                       fw2_start_block = env_end_block + 1;
+                       fw2_end_block = fw2_start_block + fw_num_blocks + extra_blocks - 1;
+               }
+       } else {
+               fw2_end_block = fw2_start_block + fw_num_blocks + extra_blocks - 1;
+       }
+
+       fail_if_overlap(fcb, env, "FCB", "Environment");
+       fail_if_overlap(fcb, fw1, "FCB", "FW1");
+       fail_if_overlap(fw1, env, "FW1", "Environment");
+       if (fw2_set) {
+               fail_if_overlap(fcb, fw2, "FCB", "FW2");
+               fail_if_overlap(fw2, env, "FW2", "Environment");
+               fail_if_overlap(fw1, fw2, "FW1", "FW2");
+       }
+
+       buf = malloc(erase_size);
+       if (buf == NULL) {
+               printf("Failed to allocate buffer\n");
+               return -ENOMEM;
+       }
+       /* search for first non-bad block in FW1 block range */
+       while (fw1_start_block <= fw1_end_block) {
+               if (!nand_block_isbad(mtd, fw1_start_block * mtd->erasesize))
+                       break;
+               fw1_start_block++;
+       }
+       if (fw1_end_block - fw1_start_block + 1 < fw_num_blocks) {
+               printf("Too many bad blocks in FW1 block range: %lu..%lu\n",
+                       fw1_end_block + 1 - fw_num_blocks - extra_blocks,
+                       fw1_end_block);
+               return -EINVAL;
+       }
+
+       /* search for first non-bad block in FW2 block range */
+       while (fw2_set && fw2_start_block <= fw2_end_block) {
+               if (!nand_block_isbad(mtd, fw2_start_block * mtd->erasesize))
+                       break;
+               fw2_start_block++;
+       }
+       if (fw2_end_block - fw2_start_block + 1 < fw_num_blocks) {
+               printf("Too many bad blocks in FW2 area %08lx..%08lx\n",
+                       fw2_end_block + 1 - fw_num_blocks - extra_blocks,
+                       fw2_end_block);
+               return -EINVAL;
+       }
+
+       fcb = create_fcb(buf, fw1_start_block, fw2_start_block,
+                       (fw_num_blocks + extra_blocks) * mtd->erasesize);
+       if (IS_ERR(fcb)) {
+               printf("Failed to initialize FCB: %ld\n", PTR_ERR(fcb));
+               return PTR_ERR(fcb);
+       }
+       encode_hamming_13_8(fcb, (void *)fcb + 512, 512);
+
+       for (block = fcb_start_block; block < fcb_start_block + num_fcb_blocks;
+            block++) {
+               if (nand_block_isbad(mtd, block * mtd->erasesize)) {
+                       if (block == fcb_start_block)
+                               fcb_start_block++;
+                       continue;
+               }
+               ret = write_fcb(buf, block);
+               if (ret) {
+                       printf("Failed to write FCB to block %u\n", block);
+                       return ret;
+               }
+               fcb_written = 1;
+       }
+
+       if (!fcb_written) {
+               printf("Could not write FCB to flash\n");
+               return -EIO;
+       }
+
+       printf("Programming U-Boot image from %p to block %lu\n",
+               addr, fw1_start_block);
+       if (size & (page_size - 1)) {
+               memset(addr + size, 0xff, size & (page_size - 1));
+               size = ALIGN(size, page_size);
+       }
+
+       erase_opts.offset = fcb->fw1_start_page * page_size;
+       erase_opts.length = ALIGN(size, erase_size) +
+               extra_blocks * mtd->erasesize;
+       erase_opts.quiet = 1;
+
+       printf("Erasing flash @ %08llx..%08llx\n", erase_opts.offset,
+               erase_opts.offset + erase_opts.length - 1);
+
+       ret = nand_erase_opts(mtd, &erase_opts);
+       if (ret) {
+               printf("Failed to erase flash: %d\n", ret);
+               return ret;
+       }
+       printf("Programming flash @ %08x..%08x from %p\n",
+               fcb->fw1_start_page * page_size,
+               fcb->fw1_start_page * page_size + size, addr);
+       ret = nand_write_skip_bad(mtd, fcb->fw1_start_page * page_size,
+                               &size, addr, WITH_DROP_FFS);
+       if (ret) {
+               printf("Failed to program flash: %d\n", ret);
+               return ret;
+       }
+       if (fw2_start_block == 0) {
+               return ret;
+       }
+
+       printf("Programming redundant U-Boot image to block %lu\n",
+               fw2_start_block);
+       erase_opts.offset = fcb->fw2_start_page * page_size;
+       printf("Erasing flash @ %08llx..%08llx\n", erase_opts.offset,
+               erase_opts.offset + erase_opts.length - 1);
+
+       ret = nand_erase_opts(mtd, &erase_opts);
+       if (ret) {
+               printf("Failed to erase flash: %d\n", ret);
+               return ret;
+       }
+       printf("Programming flash @ %08x..%08x from %p\n",
+               fcb->fw2_start_page * page_size,
+               fcb->fw2_start_page * page_size + size, addr);
+       ret = nand_write_skip_bad(mtd, fcb->fw2_start_page * page_size,
+                               &size, addr, WITH_DROP_FFS);
+       if (ret) {
+               printf("Failed to program flash: %d\n", ret);
+               return ret;
+       }
+       return ret;
+}
+
+U_BOOT_CMD(romupdate, 11, 0, do_update,
+       "Creates an FCB data structure and writes an U-Boot image to flash\n",
+       "[-b #] [-n #] [-f #] [-r [#]] [<address>] [<length>]\n"
+       "\t-b #\tfirst FCB block number (default 0)\n"
+       "\t-n #\ttotal number of FCB blocks (default 1)\n"
+       "\t-f #\twrite bootloader image at block #\n"
+       "\t-r\twrite redundant bootloader image at next free block after first image\n"
+       "\t-r #\twrite redundant bootloader image at block #\n"
+       "\t-e #\tspecify number of redundant blocks per boot loader image\n"
+       "\t<address>\tRAM address of bootloader image (default: ${fileaddr}\n"
+       "\t<length>\tlength of bootloader image in RAM (default: ${filesize}"
+       );
diff --git a/board/karo/tx28/spl_boot.c b/board/karo/tx28/spl_boot.c
new file mode 100644 (file)
index 0000000..e0541df
--- /dev/null
@@ -0,0 +1,341 @@
+/*
+ * Copyright (C) 2011 Lothar Waßmann <LW@KARO-electronics.de>
+ * based on: board/freesclae/mx28_evk.c (C) 2010 Freescale Semiconductor, Inc.
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+#include <common.h>
+#include <config.h>
+#include <asm/io.h>
+#include <asm/gpio.h>
+#include <asm/arch/iomux-mx28.h>
+#include <asm/arch/imx-regs.h>
+#include <asm/arch/sys_proto.h>
+
+#define        MUX_CONFIG_LED  (MXS_PAD_3V3 | MXS_PAD_4MA | MXS_PAD_NOPULL)
+#define        MUX_CONFIG_LCD  (MXS_PAD_3V3 | MXS_PAD_4MA)
+#define        MUX_CONFIG_TSC  (MXS_PAD_3V3 | MXS_PAD_8MA | MXS_PAD_PULLUP)
+#define        MUX_CONFIG_SSP0 (MXS_PAD_3V3 | MXS_PAD_12MA | MXS_PAD_PULLUP)
+#define        MUX_CONFIG_SSP2 (MXS_PAD_3V3 | MXS_PAD_4MA | MXS_PAD_PULLUP)
+#define        MUX_CONFIG_GPMI (MXS_PAD_3V3 | MXS_PAD_4MA | MXS_PAD_NOPULL)
+#define        MUX_CONFIG_ENET (MXS_PAD_3V3 | MXS_PAD_4MA | MXS_PAD_PULLUP)
+#define        MUX_CONFIG_EMI  (MXS_PAD_1V8 | MXS_PAD_12MA | MXS_PAD_NOPULL)
+#define MUX_CONFIG_GPIO (MXS_PAD_3V3 | MXS_PAD_PULLUP)
+
+static iomux_cfg_t tx28_stk5_pads[] = {
+       /* LED */
+       MX28_PAD_ENET0_RXD3__GPIO_4_10 | MUX_CONFIG_LED,
+
+       /* framebuffer */
+       MX28_PAD_LCD_D00__LCD_D0 | MUX_CONFIG_LCD,
+       MX28_PAD_LCD_D01__LCD_D1 | MUX_CONFIG_LCD,
+       MX28_PAD_LCD_D02__LCD_D2 | MUX_CONFIG_LCD,
+       MX28_PAD_LCD_D03__LCD_D3 | MUX_CONFIG_LCD,
+       MX28_PAD_LCD_D04__LCD_D4 | MUX_CONFIG_LCD,
+       MX28_PAD_LCD_D05__LCD_D5 | MUX_CONFIG_LCD,
+       MX28_PAD_LCD_D06__LCD_D6 | MUX_CONFIG_LCD,
+       MX28_PAD_LCD_D07__LCD_D7 | MUX_CONFIG_LCD,
+       MX28_PAD_LCD_D08__LCD_D8 | MUX_CONFIG_LCD,
+       MX28_PAD_LCD_D09__LCD_D9 | MUX_CONFIG_LCD,
+       MX28_PAD_LCD_D10__LCD_D10 | MUX_CONFIG_LCD,
+       MX28_PAD_LCD_D11__LCD_D11 | MUX_CONFIG_LCD,
+       MX28_PAD_LCD_D12__LCD_D12 | MUX_CONFIG_LCD,
+       MX28_PAD_LCD_D13__LCD_D13 | MUX_CONFIG_LCD,
+       MX28_PAD_LCD_D14__LCD_D14 | MUX_CONFIG_LCD,
+       MX28_PAD_LCD_D15__LCD_D15 | MUX_CONFIG_LCD,
+       MX28_PAD_LCD_D16__LCD_D16 | MUX_CONFIG_LCD,
+       MX28_PAD_LCD_D17__LCD_D17 | MUX_CONFIG_LCD,
+       MX28_PAD_LCD_D18__LCD_D18 | MUX_CONFIG_LCD,
+       MX28_PAD_LCD_D19__LCD_D19 | MUX_CONFIG_LCD,
+       MX28_PAD_LCD_D20__LCD_D20 | MUX_CONFIG_LCD,
+       MX28_PAD_LCD_D21__LCD_D21 | MUX_CONFIG_LCD,
+       MX28_PAD_LCD_D22__LCD_D22 | MUX_CONFIG_LCD,
+       MX28_PAD_LCD_D23__LCD_D23 | MUX_CONFIG_LCD,
+       MX28_PAD_LCD_RD_E__LCD_VSYNC | MUX_CONFIG_LCD,
+       MX28_PAD_LCD_WR_RWN__LCD_HSYNC | MUX_CONFIG_LCD,
+       MX28_PAD_LCD_RS__LCD_DOTCLK | MUX_CONFIG_LCD,
+       MX28_PAD_LCD_CS__LCD_CS | MUX_CONFIG_LCD,
+       MX28_PAD_LCD_VSYNC__LCD_VSYNC | MUX_CONFIG_LCD,
+       MX28_PAD_LCD_HSYNC__LCD_HSYNC | MUX_CONFIG_LCD,
+       MX28_PAD_LCD_DOTCLK__LCD_DOTCLK | MUX_CONFIG_LCD,
+       MX28_PAD_LCD_ENABLE__GPIO_1_31 | MUX_CONFIG_LCD,
+       MX28_PAD_LCD_RESET__GPIO_3_30 | MUX_CONFIG_LCD,
+
+       /* DUART pads */
+       MX28_PAD_PWM0__GPIO_3_16 | MUX_CONFIG_GPIO,
+       MX28_PAD_PWM1__GPIO_3_17 | MUX_CONFIG_GPIO,
+       MX28_PAD_I2C0_SCL__GPIO_3_24 | MUX_CONFIG_GPIO,
+       MX28_PAD_I2C0_SDA__GPIO_3_25 | MUX_CONFIG_GPIO,
+
+       MX28_PAD_AUART0_RTS__DUART_TX,
+       MX28_PAD_AUART0_CTS__DUART_RX,
+       MX28_PAD_AUART0_TX__DUART_RTS,
+       MX28_PAD_AUART0_RX__DUART_CTS,
+
+       /* EMI */
+       MX28_PAD_EMI_D00__EMI_DATA0 | MUX_CONFIG_EMI,
+       MX28_PAD_EMI_D01__EMI_DATA1 | MUX_CONFIG_EMI,
+       MX28_PAD_EMI_D02__EMI_DATA2 | MUX_CONFIG_EMI,
+       MX28_PAD_EMI_D03__EMI_DATA3 | MUX_CONFIG_EMI,
+       MX28_PAD_EMI_D04__EMI_DATA4 | MUX_CONFIG_EMI,
+       MX28_PAD_EMI_D05__EMI_DATA5 | MUX_CONFIG_EMI,
+       MX28_PAD_EMI_D06__EMI_DATA6 | MUX_CONFIG_EMI,
+       MX28_PAD_EMI_D07__EMI_DATA7 | MUX_CONFIG_EMI,
+       MX28_PAD_EMI_D08__EMI_DATA8 | MUX_CONFIG_EMI,
+       MX28_PAD_EMI_D09__EMI_DATA9 | MUX_CONFIG_EMI,
+       MX28_PAD_EMI_D10__EMI_DATA10 | MUX_CONFIG_EMI,
+       MX28_PAD_EMI_D11__EMI_DATA11 | MUX_CONFIG_EMI,
+       MX28_PAD_EMI_D12__EMI_DATA12 | MUX_CONFIG_EMI,
+       MX28_PAD_EMI_D13__EMI_DATA13 | MUX_CONFIG_EMI,
+       MX28_PAD_EMI_D14__EMI_DATA14 | MUX_CONFIG_EMI,
+       MX28_PAD_EMI_D15__EMI_DATA15 | MUX_CONFIG_EMI,
+       MX28_PAD_EMI_ODT0__EMI_ODT0 | MUX_CONFIG_EMI,
+       MX28_PAD_EMI_DQM0__EMI_DQM0 | MUX_CONFIG_EMI,
+       MX28_PAD_EMI_ODT1__EMI_ODT1 | MUX_CONFIG_EMI,
+       MX28_PAD_EMI_DQM1__EMI_DQM1 | MUX_CONFIG_EMI,
+       MX28_PAD_EMI_DDR_OPEN_FB__EMI_DDR_OPEN_FEEDBACK | MUX_CONFIG_EMI,
+       MX28_PAD_EMI_CLK__EMI_CLK | MUX_CONFIG_EMI,
+       MX28_PAD_EMI_DQS0__EMI_DQS0 | MUX_CONFIG_EMI,
+       MX28_PAD_EMI_DQS1__EMI_DQS1 | MUX_CONFIG_EMI,
+       MX28_PAD_EMI_DDR_OPEN__EMI_DDR_OPEN | MUX_CONFIG_EMI,
+
+       MX28_PAD_EMI_A00__EMI_ADDR0 | MUX_CONFIG_EMI,
+       MX28_PAD_EMI_A01__EMI_ADDR1 | MUX_CONFIG_EMI,
+       MX28_PAD_EMI_A02__EMI_ADDR2 | MUX_CONFIG_EMI,
+       MX28_PAD_EMI_A03__EMI_ADDR3 | MUX_CONFIG_EMI,
+       MX28_PAD_EMI_A04__EMI_ADDR4 | MUX_CONFIG_EMI,
+       MX28_PAD_EMI_A05__EMI_ADDR5 | MUX_CONFIG_EMI,
+       MX28_PAD_EMI_A06__EMI_ADDR6 | MUX_CONFIG_EMI,
+       MX28_PAD_EMI_A07__EMI_ADDR7 | MUX_CONFIG_EMI,
+       MX28_PAD_EMI_A08__EMI_ADDR8 | MUX_CONFIG_EMI,
+       MX28_PAD_EMI_A09__EMI_ADDR9 | MUX_CONFIG_EMI,
+       MX28_PAD_EMI_A10__EMI_ADDR10 | MUX_CONFIG_EMI,
+       MX28_PAD_EMI_A11__EMI_ADDR11 | MUX_CONFIG_EMI,
+       MX28_PAD_EMI_A12__EMI_ADDR12 | MUX_CONFIG_EMI,
+       MX28_PAD_EMI_A13__EMI_ADDR13 | MUX_CONFIG_EMI,
+       MX28_PAD_EMI_A14__EMI_ADDR14 | MUX_CONFIG_EMI,
+       MX28_PAD_EMI_BA0__EMI_BA0 | MUX_CONFIG_EMI,
+       MX28_PAD_EMI_BA1__EMI_BA1 | MUX_CONFIG_EMI,
+       MX28_PAD_EMI_BA2__EMI_BA2 | MUX_CONFIG_EMI,
+       MX28_PAD_EMI_CASN__EMI_CASN | MUX_CONFIG_EMI,
+       MX28_PAD_EMI_RASN__EMI_RASN | MUX_CONFIG_EMI,
+       MX28_PAD_EMI_WEN__EMI_WEN | MUX_CONFIG_EMI,
+       MX28_PAD_EMI_CE0N__EMI_CE0N | MUX_CONFIG_EMI,
+       MX28_PAD_EMI_CE1N__EMI_CE1N | MUX_CONFIG_EMI,
+       MX28_PAD_EMI_CKE__EMI_CKE | MUX_CONFIG_EMI,
+
+       /* FEC pads */
+       MX28_PAD_PWM4__GPIO_3_29 | MUX_CONFIG_ENET,
+       MX28_PAD_ENET0_RX_CLK__GPIO_4_13 | MUX_CONFIG_ENET,
+       MX28_PAD_ENET0_MDC__ENET0_MDC | MUX_CONFIG_ENET,
+       MX28_PAD_ENET0_MDIO__ENET0_MDIO | MUX_CONFIG_ENET,
+       MX28_PAD_ENET0_RX_EN__GPIO_4_2 | MUX_CONFIG_ENET,       /* COL/CRS_DV/MODE2 */
+       MX28_PAD_ENET0_RXD0__GPIO_4_3 | MUX_CONFIG_ENET,        /* RXD0/MODE0 */
+       MX28_PAD_ENET0_RXD1__GPIO_4_4 | MUX_CONFIG_ENET,        /* RXD1/MODE1 */
+       MX28_PAD_ENET0_TX_CLK__GPIO_4_5 | MUX_CONFIG_ENET,      /* nINT/TX_ER/TXD4 */
+       MX28_PAD_ENET0_TX_EN__ENET0_TX_EN | MUX_CONFIG_ENET,
+       MX28_PAD_ENET0_TXD0__ENET0_TXD0 | MUX_CONFIG_ENET,
+       MX28_PAD_ENET0_TXD1__ENET0_TXD1 | MUX_CONFIG_ENET,
+       MX28_PAD_ENET_CLK__CLKCTRL_ENET | MUX_CONFIG_ENET,
+
+       /* MMC pads */
+       MX28_PAD_SSP0_DATA0__SSP0_D0 | MUX_CONFIG_SSP0,
+       MX28_PAD_SSP0_DATA1__SSP0_D1 | MUX_CONFIG_SSP0,
+       MX28_PAD_SSP0_DATA2__SSP0_D2 | MUX_CONFIG_SSP0,
+       MX28_PAD_SSP0_DATA3__SSP0_D3 | MUX_CONFIG_SSP0,
+       MX28_PAD_SSP0_CMD__SSP0_CMD | MUX_CONFIG_SSP0,
+       MX28_PAD_SSP0_DETECT__SSP0_CARD_DETECT | MUX_CONFIG_GPIO,
+       MX28_PAD_SSP0_SCK__SSP0_SCK | MUX_CONFIG_SSP0,
+
+       /* GPMI pads */
+       MX28_PAD_GPMI_D00__GPMI_D0 | MUX_CONFIG_GPMI,
+       MX28_PAD_GPMI_D01__GPMI_D1 | MUX_CONFIG_GPMI,
+       MX28_PAD_GPMI_D02__GPMI_D2 | MUX_CONFIG_GPMI,
+       MX28_PAD_GPMI_D03__GPMI_D3 | MUX_CONFIG_GPMI,
+       MX28_PAD_GPMI_D04__GPMI_D4 | MUX_CONFIG_GPMI,
+       MX28_PAD_GPMI_D05__GPMI_D5 | MUX_CONFIG_GPMI,
+       MX28_PAD_GPMI_D06__GPMI_D6 | MUX_CONFIG_GPMI,
+       MX28_PAD_GPMI_D07__GPMI_D7 | MUX_CONFIG_GPMI,
+       MX28_PAD_GPMI_CE0N__GPMI_CE0N | MUX_CONFIG_GPMI,
+       MX28_PAD_GPMI_RDY0__GPMI_READY0 | MUX_CONFIG_GPMI,
+       MX28_PAD_GPMI_RDN__GPMI_RDN | MUX_CONFIG_GPMI,
+       MX28_PAD_GPMI_WRN__GPMI_WRN | MUX_CONFIG_GPMI,
+       MX28_PAD_GPMI_ALE__GPMI_ALE | MUX_CONFIG_GPMI,
+       MX28_PAD_GPMI_CLE__GPMI_CLE | MUX_CONFIG_GPMI,
+       MX28_PAD_GPMI_RESETN__GPMI_RESETN | MUX_CONFIG_GPMI,
+
+       /* maybe used for EDT-FT5x06 */
+       MX28_PAD_SSP0_DATA5__GPIO_2_5 | MUX_CONFIG_GPIO,
+       MX28_PAD_SSP0_DATA6__GPIO_2_6 | MUX_CONFIG_GPIO,
+       MX28_PAD_ENET0_RXD2__GPIO_4_9 | MUX_CONFIG_GPIO,
+
+       /* unused pads */
+       MX28_PAD_GPMI_RDY1__GPIO_0_21 | MUX_CONFIG_GPIO,
+       MX28_PAD_GPMI_RDY2__GPIO_0_22 | MUX_CONFIG_GPIO,
+       MX28_PAD_GPMI_RDY3__GPIO_0_23 | MUX_CONFIG_GPIO,
+       MX28_PAD_GPMI_CE1N__GPIO_0_17 | MUX_CONFIG_GPIO,
+       MX28_PAD_GPMI_CE2N__GPIO_0_18 | MUX_CONFIG_GPIO,
+       MX28_PAD_GPMI_CE3N__GPIO_0_19 | MUX_CONFIG_GPIO,
+
+       MX28_PAD_SSP0_DATA4__GPIO_2_4 | MUX_CONFIG_GPIO,
+       MX28_PAD_SSP0_DATA7__GPIO_2_7 | MUX_CONFIG_GPIO,
+
+       MX28_PAD_SSP2_SS0__GPIO_2_19 | MUX_CONFIG_GPIO,
+       MX28_PAD_SSP2_SS1__GPIO_2_20 | MUX_CONFIG_GPIO,
+       MX28_PAD_SSP2_SS2__GPIO_2_21 | MUX_CONFIG_GPIO,
+       MX28_PAD_SSP3_SS0__GPIO_2_27 | MUX_CONFIG_GPIO,
+
+       MX28_PAD_ENET0_TXD2__GPIO_4_11 | MUX_CONFIG_GPIO,
+       MX28_PAD_ENET0_TXD3__GPIO_4_12 | MUX_CONFIG_GPIO,
+       MX28_PAD_ENET0_CRS__GPIO_4_15 | MUX_CONFIG_GPIO,
+};
+
+static void tx28_stk5_lcd_init(void)
+{
+       gpio_direction_output(MX28_PAD_PWM0__GPIO_3_16, 1);
+       gpio_direction_output(MX28_PAD_LCD_RESET__GPIO_3_30, 0);
+       gpio_direction_output(MX28_PAD_LCD_ENABLE__GPIO_1_31, 0);
+}
+
+static void tx28_stk5_led_on(void)
+{
+       gpio_direction_output(MX28_PAD_ENET0_RXD3__GPIO_4_10, 1);
+}
+
+void board_init_ll(void)
+{
+       mx28_common_spl_init(tx28_stk5_pads, ARRAY_SIZE(tx28_stk5_pads));
+       tx28_stk5_lcd_init();
+       tx28_stk5_led_on();
+}
+
+#ifndef CONFIG_TX28_S
+static uint32_t tx28_dram_vals[] = {
+       /* TX28-41x0: NT5TU32M16DG-AC */
+       /* 000 */ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+       /* 010 */ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+       /* 020 */ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+       /* 030 */ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+       /* 040 */ 0x00000000, 0x00000100, 0x00000000, 0x00000000,
+       /* 050 */ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+       /* 060 */ 0x00000000, 0x00000000, 0x00010101, 0x01010101,
+       /* 070 */ 0x000f0f01, 0x0102020a, 0x00000000, 0x00010101,
+       /* 080 */ 0x00000100, 0x00000100, 0x00000000, 0x00000002,
+       /* 090 */ 0x01010000, 0x07080403, 0x06005003, 0x0a0000c8,
+       /* 0a0 */ 0x02009c40, 0x0002030c, 0x0036a609, 0x031a0612,
+       /* 0b0 */ 0x02030202, 0x00c8001c, 0x00000000, 0x00000000,
+       /* 0c0 */ 0x00012100, 0xffff0303, 0x00012100, 0xffff0303,
+       /* 0d0 */ 0x00012100, 0xffff0303, 0x00012100, 0xffff0303,
+       /* 0e0 */ 0x00000003, 0x00000000, 0x00000000, 0x00000000,
+       /* 0f0 */ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+       /* 100 */ 0x00000000, 0x00000000, 0x00000612, 0x01000f02,
+       /* 110 */ 0x06120612, 0x00000200, 0x00020007, 0xf4004a27,
+       /* 120 */ 0xf4004a27, 0xf4004a27, 0xf4004a27, 0x07400300,
+       /* 130 */ 0x07400300, 0x07400300, 0x07400300, 0x00000005,
+       /* 140 */ 0x00000000, 0x00000000, 0x01000000, 0x01020408,
+       /* 150 */ 0x08040201, 0x000f1133, 0x00000000, 0x00001f04,
+       /* 160 */ 0x00001f04, 0x00001f04, 0x00001f04, 0x00001f04,
+       /* 170 */ 0x00001f04, 0x00001f04, 0x00001f04, 0x00000000,
+       /* 180 */ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+       /* 190 */ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+       /* 1a0 */ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+       /* 1b0 */ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+       /* 1c0 */ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+       /* 1d0 */ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+       /* 1e0 */ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+       /* 1f0 */ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+       /* 200 */ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+       /* 210 */ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+       /* 220 */ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+       /* 230 */ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+       /* 240 */ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+       /* 250 */ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+       /* 260 */ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+       /* 270 */ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+       /* 280 */ 0x00000000, 0x00000000, 0x00010000, 0x00030404,
+       /* 290 */ 0x00000003, 0x00000000, 0x00000000, 0x00000000,
+       /* 2a0 */ 0x00000000, 0x00000000, 0x00000000, 0x01010000,
+       /* 2b0 */ 0x01000000, 0x03030000, 0x00010303, 0x01020202,
+       /* 2c0 */ 0x00000000, 0x02040303, 0x21002103, 0x00061200,
+       /* 2d0 */ 0x06120612, 0x04420442, 0x04420442, 0x00040004,
+       /* 2e0 */ 0x00040004, 0x00000000, 0x00000000, 0x00000000,
+       /* 2f0 */ 0x00000000, 0x00000000,
+};
+#else
+static uint32_t tx28_dram_vals[] = {
+       /* TX28-40x0: MT47H64M16HR-3 */
+       /* 000 */ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+       /* 010 */ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+       /* 020 */ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+       /* 030 */ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+       /* 040 */ 0x00000000, 0x00000100, 0x00000000, 0x00000000,
+       /* 050 */ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+       /* 060 */ 0x00000000, 0x00000000, 0x00010101, 0x00010101,
+       /* 070 */ 0x000f0f01, 0x0102010a, 0x00000000, 0x00000101,
+       /* 080 */ 0x00000100, 0x00000100, 0x00000000, 0x00000002,
+       /* 090 */ 0x01010000, 0x07080403, 0x06005003, 0x0a0000c8,
+       /* 0a0 */ 0x02009c40, 0x0002030c, 0x0036a609, 0x031a0612,
+       /* 0b0 */ 0x02030202, 0x00c8001c, 0x00000000, 0x00000000,
+       /* 0c0 */ 0x00012100, 0xffff0303, 0x00012100, 0xffff0303,
+       /* 0d0 */ 0x00012100, 0xffff0303, 0x00012100, 0xffff0303,
+       /* 0e0 */ 0x00000003, 0x00000000, 0x00000000, 0x00000000,
+       /* 0f0 */ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+       /* 100 */ 0x00000000, 0x00000000, 0x00000612, 0x01000f02,
+       /* 110 */ 0x06120612, 0x00000200, 0x00020007, 0xf4004a27,
+       /* 120 */ 0xf4004a27, 0xf4004a27, 0xf4004a27, 0x07400300,
+       /* 130 */ 0x07400300, 0x07400300, 0x07400300, 0x00000005,
+       /* 140 */ 0x00000000, 0x00000000, 0x01000000, 0x01020408,
+       /* 150 */ 0x08040201, 0x000f1133, 0x00000000, 0x00001f04,
+       /* 160 */ 0x00001f04, 0x00001f04, 0x00001f04, 0x00001f04,
+       /* 170 */ 0x00001f04, 0x00001f04, 0x00001f04, 0x00000000,
+       /* 180 */ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+       /* 190 */ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+       /* 1a0 */ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+       /* 1b0 */ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+       /* 1c0 */ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+       /* 1d0 */ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+       /* 1e0 */ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+       /* 1f0 */ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+       /* 200 */ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+       /* 210 */ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+       /* 220 */ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+       /* 230 */ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+       /* 240 */ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+       /* 250 */ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+       /* 260 */ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+       /* 270 */ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+       /* 280 */ 0x00000000, 0x00000000, 0x00010000, 0x00030404,
+       /* 290 */ 0x00000003, 0x00000000, 0x00000000, 0x00000000,
+       /* 2a0 */ 0x00000000, 0x00000000, 0x00000000, 0x01010000,
+       /* 2b0 */ 0x01000000, 0x03030000, 0x00010303, 0x01020202,
+       /* 2c0 */ 0x00000000, 0x02040303, 0x21002103, 0x00061200,
+       /* 2d0 */ 0x06120612, 0x04420442, 0x04420442, 0x00040004,
+       /* 2e0 */ 0x00040004, 0x00000000, 0x00000000, 0x00000000,
+       /* 2f0 */ 0x00000000, 0x00000000,
+};
+#endif
+
+void mx28_ddr2_setup(void)
+{
+       int i;
+
+       for (i = 0; i < ARRAY_SIZE(tx28_dram_vals); i++)
+               writel(tx28_dram_vals[i], MXS_DRAM_BASE + (4 * i));
+}
diff --git a/board/karo/tx28/tx28.c b/board/karo/tx28/tx28.c
new file mode 100644 (file)
index 0000000..2e7d47f
--- /dev/null
@@ -0,0 +1,767 @@
+/*
+ * Copyright (C) 2011 Lothar Waßmann <LW@KARO-electronics.de>
+ * based on: board/freesclae/mx28_evk.c (C) 2010 Freescale Semiconductor, Inc.
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+#include <common.h>
+#include <errno.h>
+#include <libfdt.h>
+#include <fdt_support.h>
+#include <lcd.h>
+#include <netdev.h>
+#include <mmc.h>
+#include <imx_ssp_mmc.h>
+#include <linux/list.h>
+#include <linux/fb.h>
+#include <asm/io.h>
+#include <asm/gpio.h>
+#include <asm/arch/iomux-mx28.h>
+#include <asm/arch/clock.h>
+#include <asm/arch/mxsfb.h>
+#include <asm/arch/imx-regs.h>
+#include <asm/arch/sys_proto.h>
+
+#include "../common/karo.h"
+
+DECLARE_GLOBAL_DATA_PTR;
+
+#define MXS_GPIO_NR(p, o)      (((p) << 5) | (o))
+
+#define TX28_LCD_PWR_GPIO      MX28_PAD_LCD_ENABLE__GPIO_1_31
+#define TX28_LCD_RST_GPIO      MX28_PAD_LCD_RESET__GPIO_3_30
+#define TX28_LCD_BACKLIGHT_GPIO        MX28_PAD_PWM0__GPIO_3_16
+
+#define TX28_USBH_VBUSEN_GPIO  MX28_PAD_SPDIF__GPIO_3_27
+#define TX28_USBH_OC_GPIO      MX28_PAD_JTAG_RTCK__GPIO_4_20
+#define TX28_USBOTG_VBUSEN_GPIO        MX28_PAD_GPMI_CE2N__GPIO_0_18
+#define TX28_USBOTG_OC_GPIO    MX28_PAD_GPMI_CE3N__GPIO_0_19
+#define TX28_USBOTG_ID_GPIO    MX28_PAD_PWM2__GPIO_3_18
+
+#define TX28_LED_GPIO          MX28_PAD_ENET0_RXD3__GPIO_4_10
+
+static const struct gpio tx28_gpios[] = {
+       { TX28_USBH_VBUSEN_GPIO, GPIOF_OUTPUT_INIT_LOW, "USBH VBUSEN", },
+       { TX28_USBH_OC_GPIO, GPIOF_INPUT, "USBH OC", },
+       { TX28_USBOTG_VBUSEN_GPIO, GPIOF_OUTPUT_INIT_LOW, "USBOTG VBUSEN", },
+       { TX28_USBOTG_OC_GPIO, GPIOF_INPUT, "USBOTG OC", },
+       { TX28_USBOTG_ID_GPIO, GPIOF_INPUT, "USBOTG ID", },
+};
+
+static const iomux_cfg_t tx28_pads[] = {
+       /* UART pads */
+#if CONFIG_CONS_INDEX == 0
+       MX28_PAD_AUART0_RX__DUART_CTS,
+       MX28_PAD_AUART0_TX__DUART_RTS,
+       MX28_PAD_AUART0_CTS__DUART_RX,
+       MX28_PAD_AUART0_RTS__DUART_TX,
+#elif CONFIG_CONS_INDEX == 1
+       MX28_PAD_AUART1_RX__AUART1_RX,
+       MX28_PAD_AUART1_TX__AUART1_TX,
+       MX28_PAD_AUART1_CTS__AUART1_CTS,
+       MX28_PAD_AUART1_RTS__AUART1_RTS,
+#elif CONFIG_CONS_INDEX == 2
+       MX28_PAD_AUART3_RX__AUART3_RX,
+       MX28_PAD_AUART3_TX__AUART3_TX,
+       MX28_PAD_AUART3_CTS__AUART3_CTS,
+       MX28_PAD_AUART3_RTS__AUART3_RTS,
+#endif
+       /* I2C bus for internal DS1339, PCA9554 and on DIMM pins 40/41 */
+       MX28_PAD_I2C0_SCL__I2C0_SCL,
+       MX28_PAD_I2C0_SDA__I2C0_SDA,
+
+       /* USBH VBUSEN, OC */
+       MX28_PAD_SPDIF__GPIO_3_27,
+       MX28_PAD_JTAG_RTCK__GPIO_4_20,
+
+       /* USBOTG VBUSEN, OC, ID */
+       MX28_PAD_GPMI_CE2N__GPIO_0_18,
+       MX28_PAD_GPMI_CE3N__GPIO_0_19,
+       MX28_PAD_PWM2__GPIO_3_18,
+};
+
+/*
+ * Functions
+ */
+int board_early_init_f(void)
+{
+       /* IO0 clock at 480MHz */
+       mx28_set_ioclk(MXC_IOCLK0, 480000);
+       /* IO1 clock at 480MHz */
+       mx28_set_ioclk(MXC_IOCLK1, 480000);
+
+       /* SSP0 clock at 96MHz */
+       mx28_set_sspclk(MXC_SSPCLK0, 96000, 0);
+       /* SSP2 clock at 96MHz */
+       mx28_set_sspclk(MXC_SSPCLK2, 96000, 0);
+
+       gpio_request_array(tx28_gpios, ARRAY_SIZE(tx28_gpios));
+       mxs_iomux_setup_multiple_pads(tx28_pads, ARRAY_SIZE(tx28_pads));
+       return 0;
+}
+
+int board_init(void)
+{
+       /* Address of boot parameters */
+       gd->bd->bi_boot_params = PHYS_SDRAM_1 + 0x1000;
+       return 0;
+}
+
+int dram_init(void)
+{
+       return mx28_dram_init();
+}
+
+#ifdef CONFIG_CMD_MMC
+static int tx28_mmc_wp(int dev_no)
+{
+       return 0;
+}
+
+int board_mmc_init(bd_t *bis)
+{
+       return mxsmmc_initialize(bis, 0, tx28_mmc_wp);
+}
+#endif /* CONFIG_CMD_MMC */
+
+#ifdef CONFIG_FEC_MXC
+#ifdef CONFIG_GET_FEC_MAC_ADDR_FROM_IIM
+
+#ifdef CONFIG_FEC_MXC_MULTI
+#define FEC_MAX_IDX                    1
+#else
+#define FEC_MAX_IDX                    0
+#endif
+
+static int fec_get_mac_addr(int index)
+{
+       u32 val1, val2;
+       int timeout = 1000;
+       struct mx28_ocotp_regs *ocotp_regs =
+               (struct mx28_ocotp_regs *)MXS_OCOTP_BASE;
+       u32 *cust = &ocotp_regs->hw_ocotp_cust0;
+       char mac[6 * 3];
+       char env_name[] = "eth.addr";
+
+       if (index < 0 || index > FEC_MAX_IDX)
+               return -EINVAL;
+
+       /* set this bit to open the OTP banks for reading */
+       writel(OCOTP_CTRL_RD_BANK_OPEN,
+               &ocotp_regs->hw_ocotp_ctrl_set);
+
+       /* wait until OTP contents are readable */
+       while (OCOTP_CTRL_BUSY & readl(&ocotp_regs->hw_ocotp_ctrl)) {
+               if (timeout-- < 0)
+                       return -ETIMEDOUT;
+               udelay(100);
+       }
+
+       val1 = readl(&cust[index * 8]);
+       val2 = readl(&cust[index * 8 + 4]);
+       if ((val1 | val2) == 0)
+               return 0;
+       snprintf(mac, sizeof(mac), "%02x:%02x:%02x:%02x:%02x:%02x",
+               (val1 >> 24) & 0xFF, (val1 >> 16) & 0xFF,
+               (val1 >> 8) & 0xFF, (val1 >> 0) & 0xFF,
+               (val2 >> 24) & 0xFF, (val2 >> 16) & 0xFF);
+       if (index == 0)
+               snprintf(env_name, sizeof(env_name), "ethaddr");
+       else
+               snprintf(env_name, sizeof(env_name), "eth%daddr", index);
+
+       setenv(env_name, mac);
+       return 0;
+}
+#endif /* CONFIG_GET_FEC_MAC_ADDR_FROM_IIM */
+
+static const iomux_cfg_t tx28_fec_pads[] = {
+       MX28_PAD_ENET0_RX_EN__ENET0_RX_EN,
+       MX28_PAD_ENET0_RXD0__ENET0_RXD0,
+       MX28_PAD_ENET0_RXD1__ENET0_RXD1,
+};
+
+int board_eth_init(bd_t *bis)
+{
+       int ret;
+
+       /* Reset the external phy */
+       gpio_direction_output(MX28_PAD_ENET0_RX_CLK__GPIO_4_13, 0);
+
+       /* Power on the external phy */
+       gpio_direction_output(MX28_PAD_PWM4__GPIO_3_29, 1);
+
+       /* Pull strap pins to high */
+       gpio_direction_output(MX28_PAD_ENET0_RX_EN__GPIO_4_2, 1);
+       gpio_direction_output(MX28_PAD_ENET0_RXD0__GPIO_4_3, 1);
+       gpio_direction_output(MX28_PAD_ENET0_RXD1__GPIO_4_4, 1);
+       gpio_direction_input(MX28_PAD_ENET0_TX_CLK__GPIO_4_5);
+
+       udelay(25000);
+       gpio_set_value(MX28_PAD_ENET0_RX_CLK__GPIO_4_13, 1);
+       udelay(100);
+
+       mxs_iomux_setup_multiple_pads(tx28_fec_pads, ARRAY_SIZE(tx28_fec_pads));
+
+       ret = cpu_eth_init(bis);
+       if (ret) {
+               printf("cpu_eth_init() failed: %d\n", ret);
+               return ret;
+       }
+
+       ret = fec_get_mac_addr(0);
+       if (ret < 0) {
+               printf("Failed to read FEC0 MAC address from OCOTP\n");
+               return ret;
+       }
+#ifdef CONFIG_FEC_MXC_MULTI
+       if (getenv("ethaddr")) {
+               ret = fecmxc_initialize_multi(bis, 0, 0, MXS_ENET0_BASE);
+               if (ret) {
+                       printf("FEC MXS: Unable to init FEC0\n");
+                       return ret;
+               }
+       }
+
+       ret = fec_get_mac_addr(1);
+       if (ret < 0) {
+               printf("Failed to read FEC1 MAC address from OCOTP\n");
+               return ret;
+       }
+       if (getenv("eth1addr")) {
+               ret = fecmxc_initialize_multi(bis, 1, 1, MXS_ENET1_BASE);
+               if (ret) {
+                       printf("FEC MXS: Unable to init FEC1\n");
+                       return ret;
+               }
+       }
+       return 0;
+#else
+       if (getenv("ethaddr")) {
+               ret = fecmxc_initialize(bis);
+       }
+       return ret;
+#endif
+}
+#endif /* CONFIG_FEC_MXC */
+
+enum {
+       LED_STATE_INIT = -1,
+       LED_STATE_OFF,
+       LED_STATE_ON,
+};
+
+void show_activity(int arg)
+{
+       static int led_state = LED_STATE_INIT;
+       static ulong last;
+
+       if (led_state == LED_STATE_INIT) {
+               last = get_timer(0);
+               gpio_set_value(TX28_LED_GPIO, 1);
+               led_state = LED_STATE_ON;
+       } else {
+               if (get_timer(last) > CONFIG_SYS_HZ) {
+                       last = get_timer(0);
+                       if (led_state == LED_STATE_ON) {
+                               gpio_set_value(TX28_LED_GPIO, 0);
+                       } else {
+                               gpio_set_value(TX28_LED_GPIO, 1);
+                       }
+                       led_state = 1 - led_state;
+               }
+       }
+}
+
+static const iomux_cfg_t stk5_pads[] = {
+       /* SW controlled LED on STK5 baseboard */
+       MX28_PAD_ENET0_RXD3__GPIO_4_10,
+};
+
+static const struct gpio stk5_gpios[] = {
+};
+
+#ifdef CONFIG_LCD
+static struct fb_videomode tx28_fb_modes[] = {
+       {
+               /* Standard VGA timing */
+               .name           = "VGA",
+               .refresh        = 60,
+               .xres           = 640,
+               .yres           = 480,
+               .pixclock       = KHZ2PICOS(25175),
+               .left_margin    = 48,
+               .hsync_len      = 96,
+               .right_margin   = 16,
+               .upper_margin   = 31,
+               .vsync_len      = 2,
+               .lower_margin   = 12,
+               .sync           = FB_SYNC_DATA_ENABLE_HIGH_ACT,
+               .vmode          = FB_VMODE_NONINTERLACED,
+       },
+       {
+               /* Emerging ETV570 640 x 480 display. Syncs low active,
+                * DE high active, 115.2 mm x 86.4 mm display area
+                * VGA compatible timing
+                */
+               .name           = "ETV570",
+               .refresh        = 60,
+               .xres           = 640,
+               .yres           = 480,
+               .pixclock       = KHZ2PICOS(25175),
+               .left_margin    = 114,
+               .hsync_len      = 30,
+               .right_margin   = 16,
+               .upper_margin   = 32,
+               .vsync_len      = 3,
+               .lower_margin   = 10,
+               .sync           = FB_SYNC_DATA_ENABLE_HIGH_ACT,
+               .vmode          = FB_VMODE_NONINTERLACED,
+       },
+       {
+               /* Emerging ET0350G0DH6 320 x 240 display.
+                * 70.08 mm x 52.56 mm display area.
+                */
+               .name           = "ET0350",
+               .refresh        = 60,
+               .xres           = 320,
+               .yres           = 240,
+               .pixclock       = KHZ2PICOS(6500),
+               .left_margin    = 68 - 34,
+               .hsync_len      = 34,
+               .right_margin   = 20,
+               .upper_margin   = 18 - 3,
+               .vsync_len      = 3,
+               .lower_margin   = 4,
+               .sync           = FB_SYNC_DATA_ENABLE_HIGH_ACT,
+               .vmode          = FB_VMODE_NONINTERLACED,
+       },
+       {
+               /* Emerging ET0430G0DH6 480 x 272 display.
+                * 95.04 mm x 53.856 mm display area.
+                */
+               .name           = "ET0430",
+               .refresh        = 60,
+               .xres           = 480,
+               .yres           = 272,
+               .pixclock       = KHZ2PICOS(9000),
+               .left_margin    = 2,
+               .hsync_len      = 41,
+               .right_margin   = 2,
+               .upper_margin   = 2,
+               .vsync_len      = 10,
+               .lower_margin   = 2,
+               .sync           = FB_SYNC_DATA_ENABLE_HIGH_ACT,
+               .vmode          = FB_VMODE_NONINTERLACED,
+       },
+       {
+               /* Emerging ET0500G0DH6 800 x 480 display.
+                * 109.6 mm x 66.4 mm display area.
+                */
+               .name           = "ET0500",
+               .refresh        = 60,
+               .xres           = 800,
+               .yres           = 480,
+               .pixclock       = KHZ2PICOS(33260),
+               .left_margin    = 216 - 128,
+               .hsync_len      = 128,
+               .right_margin   = 1056 - 800 - 216,
+               .upper_margin   = 35 - 2,
+               .vsync_len      = 2,
+               .lower_margin   = 525 - 480 - 35,
+               .sync           = FB_SYNC_DATA_ENABLE_HIGH_ACT,
+               .vmode          = FB_VMODE_NONINTERLACED,
+       },
+       {
+               /* Emerging ETQ570G0DH6 320 x 240 display.
+                * 115.2 mm x 86.4 mm display area.
+                */
+               .name           = "ETQ570",
+               .refresh        = 60,
+               .xres           = 320,
+               .yres           = 240,
+               .pixclock       = KHZ2PICOS(6400),
+               .left_margin    = 38,
+               .hsync_len      = 30,
+               .right_margin   = 30,
+               .upper_margin   = 16, /* 15 according to datasheet */
+               .vsync_len      = 3, /* TVP -> 1>x>5 */
+               .lower_margin   = 4, /* 4.5 according to datasheet */
+               .sync           = FB_SYNC_DATA_ENABLE_HIGH_ACT,
+               .vmode          = FB_VMODE_NONINTERLACED,
+       },
+       {
+               /* Emerging ET0700G0DH6 800 x 480 display.
+                * 152.4 mm x 91.44 mm display area.
+                */
+               .name           = "ET0700",
+               .refresh        = 60,
+               .xres           = 800,
+               .yres           = 480,
+               .pixclock       = KHZ2PICOS(33260),
+               .left_margin    = 216 - 128,
+               .hsync_len      = 128,
+               .right_margin   = 1056 - 800 - 216,
+               .upper_margin   = 35 - 2,
+               .vsync_len      = 2,
+               .lower_margin   = 525 - 480 - 35,
+               .sync           = FB_SYNC_DATA_ENABLE_HIGH_ACT,
+               .vmode          = FB_VMODE_NONINTERLACED,
+       },
+       {
+               /* unnamed entry for assigning parameters parsed from 'video_mode' string */
+               .sync           = FB_SYNC_DATA_ENABLE_HIGH_ACT,
+               .vmode          = FB_VMODE_NONINTERLACED,
+       },
+};
+
+static int lcd_enabled = 1;
+
+void lcd_enable(void)
+{
+       /* HACK ALERT:
+        * global variable from common/lcd.c
+        * Set to 0 here to prevent messages from going to LCD
+        * rather than serial console
+        */
+       lcd_is_enabled = 0;
+
+       karo_load_splashimage(1);
+       if (lcd_enabled) {
+               debug("Switching LCD on\n");
+               gpio_set_value(TX28_LCD_PWR_GPIO, 1);
+               udelay(100);
+               gpio_set_value(TX28_LCD_RST_GPIO, 1);
+               udelay(300000);
+               gpio_set_value(TX28_LCD_BACKLIGHT_GPIO, 0);
+       }
+}
+
+void lcd_disable(void)
+{
+       mxsfb_disable();
+}
+
+void lcd_panel_disable(void)
+{
+       if (lcd_enabled) {
+               debug("Switching LCD off\n");
+               gpio_set_value(TX28_LCD_BACKLIGHT_GPIO, 1);
+               gpio_set_value(TX28_LCD_RST_GPIO, 0);
+               gpio_set_value(TX28_LCD_PWR_GPIO, 0);
+       }
+}
+
+static const iomux_cfg_t stk5_lcd_pads[] = {
+       /* LCD RESET */
+       MX28_PAD_LCD_RESET__GPIO_3_30 | MXS_PAD_CTRL,
+       /* LCD POWER_ENABLE */
+       MX28_PAD_LCD_ENABLE__GPIO_1_31 | MXS_PAD_CTRL,
+       /* LCD Backlight (PWM) */
+       MX28_PAD_PWM0__GPIO_3_16 | MXS_PAD_CTRL,
+
+       /* Display */
+       MX28_PAD_LCD_D00__LCD_D0 | MXS_PAD_CTRL,
+       MX28_PAD_LCD_D01__LCD_D1 | MXS_PAD_CTRL,
+       MX28_PAD_LCD_D02__LCD_D2 | MXS_PAD_CTRL,
+       MX28_PAD_LCD_D03__LCD_D3 | MXS_PAD_CTRL,
+       MX28_PAD_LCD_D04__LCD_D4 | MXS_PAD_CTRL,
+       MX28_PAD_LCD_D05__LCD_D5 | MXS_PAD_CTRL,
+       MX28_PAD_LCD_D06__LCD_D6 | MXS_PAD_CTRL,
+       MX28_PAD_LCD_D07__LCD_D7 | MXS_PAD_CTRL,
+       MX28_PAD_LCD_D08__LCD_D8 | MXS_PAD_CTRL,
+       MX28_PAD_LCD_D09__LCD_D9 | MXS_PAD_CTRL,
+       MX28_PAD_LCD_D10__LCD_D10 | MXS_PAD_CTRL,
+       MX28_PAD_LCD_D11__LCD_D11 | MXS_PAD_CTRL,
+       MX28_PAD_LCD_D12__LCD_D12 | MXS_PAD_CTRL,
+       MX28_PAD_LCD_D13__LCD_D13 | MXS_PAD_CTRL,
+       MX28_PAD_LCD_D14__LCD_D14 | MXS_PAD_CTRL,
+       MX28_PAD_LCD_D15__LCD_D15 | MXS_PAD_CTRL,
+       MX28_PAD_LCD_D16__LCD_D16 | MXS_PAD_CTRL,
+       MX28_PAD_LCD_D17__LCD_D17 | MXS_PAD_CTRL,
+       MX28_PAD_LCD_D18__LCD_D18 | MXS_PAD_CTRL,
+       MX28_PAD_LCD_D19__LCD_D19 | MXS_PAD_CTRL,
+       MX28_PAD_LCD_D20__LCD_D20 | MXS_PAD_CTRL,
+       MX28_PAD_LCD_D21__LCD_D21 | MXS_PAD_CTRL,
+       MX28_PAD_LCD_D22__LCD_D22 | MXS_PAD_CTRL,
+       MX28_PAD_LCD_D23__LCD_D23 | MXS_PAD_CTRL,
+       MX28_PAD_LCD_RD_E__LCD_VSYNC | MXS_PAD_CTRL,
+       MX28_PAD_LCD_WR_RWN__LCD_HSYNC | MXS_PAD_CTRL,
+       MX28_PAD_LCD_RS__LCD_DOTCLK | MXS_PAD_CTRL,
+       MX28_PAD_LCD_CS__LCD_CS | MXS_PAD_CTRL,
+       MX28_PAD_LCD_VSYNC__LCD_VSYNC | MXS_PAD_CTRL,
+       MX28_PAD_LCD_HSYNC__LCD_HSYNC | MXS_PAD_CTRL,
+       MX28_PAD_LCD_DOTCLK__LCD_DOTCLK | MXS_PAD_CTRL,
+};
+
+static const struct gpio stk5_lcd_gpios[] = {
+       { TX28_LCD_RST_GPIO, GPIOF_OUTPUT_INIT_LOW, "LCD RESET", },
+       { TX28_LCD_PWR_GPIO, GPIOF_OUTPUT_INIT_LOW, "LCD POWER", },
+       { TX28_LCD_BACKLIGHT_GPIO, GPIOF_OUTPUT_INIT_HIGH, "LCD BACKLIGHT", },
+};
+
+extern void video_hw_init(void *lcdbase);
+
+void lcd_ctrl_init(void *lcdbase)
+{
+       int color_depth = 24;
+       char *vm;
+       unsigned long val;
+       int refresh = 60;
+       struct fb_videomode *p = &tx28_fb_modes[0];
+       int xres_set = 0, yres_set = 0, bpp_set = 0, refresh_set = 0;
+
+       if (!lcd_enabled) {
+               debug("LCD disabled\n");
+               return;
+       }
+
+       if (tstc()) {
+               debug("Disabling LCD\n");
+               lcd_enabled = 0;
+               return;
+       }
+
+       vm = getenv("video_mode");
+       if (vm == NULL) {
+               debug("Disabling LCD\n");
+               lcd_enabled = 0;
+               return;
+       }
+       while (p->name != NULL) {
+               if (strcmp(p->name, vm) == 0) {
+                       printf("Using video mode: '%s'\n", p->name);
+                       vm += strlen(vm);
+                       break;
+               }
+               p++;
+       }
+
+       while (*vm != '\0') {
+               if (*vm >= '0' && *vm <= '9') {
+                       char *end;
+
+                       val = simple_strtoul(vm, &end, 0);
+                       if (end > vm) {
+                               if (!xres_set) {
+                                       if (val > panel_info.vl_col)
+                                               val = panel_info.vl_col;
+                                       p->xres = val;
+                                       xres_set = 1;
+                               } else if (!yres_set) {
+                                       if (val > panel_info.vl_row)
+                                               val = panel_info.vl_row;
+                                       p->yres = val;
+                                       yres_set = 1;
+                               } else if (!bpp_set) {
+                                       switch (val) {
+                                       case 8:
+                                       case 16:
+                                       case 18:
+                                       case 24:
+                                               color_depth = val;
+                                               break;
+
+                                       default:
+                                               printf("Invalid color depth: '%.*s' in video_mode; using default: '%u'\n",
+                                                       end - vm, vm, color_depth);
+                                       }
+                                       bpp_set = 1;
+                               } else if (!refresh_set) {
+                                       refresh = val;
+                                       refresh_set = 1;
+                               }
+                       }
+                       vm = end;
+               }
+               switch (*vm) {
+               case '@':
+                       bpp_set = 1;
+                       /* fallthru */
+               case '-':
+                       yres_set = 1;
+                       /* fallthru */
+               case 'x':
+                       xres_set = 1;
+                       /* fallthru */
+               case 'M':
+               case 'R':
+                       vm++;
+                       break;
+
+               default:
+                       if (*vm != '\0')
+                               vm++;
+               }
+       }
+       if (p->xres == 0 || p->yres == 0) {
+               printf("Invalid video mode: %s\n", getenv("video_mode"));
+               lcd_enabled = 0;
+               printf("Supported video modes are:");
+               for (p = &tx28_fb_modes[0]; p->name != NULL; p++) {
+                       printf(" %s", p->name);
+               }
+               printf("\n");
+               return;
+       }
+       p->pixclock = KHZ2PICOS(refresh *
+               (p->xres + p->left_margin + p->right_margin + p->hsync_len) *
+               (p->yres + p->upper_margin + p->lower_margin + p->vsync_len) /
+                               1000);
+       debug("Pixel clock set to %lu.%03lu MHz\n",
+               PICOS2KHZ(p->pixclock) / 1000, PICOS2KHZ(p->pixclock) % 1000);
+
+       gpio_request_array(stk5_lcd_gpios, ARRAY_SIZE(stk5_lcd_gpios));
+       mxs_iomux_setup_multiple_pads(stk5_lcd_pads,
+                               ARRAY_SIZE(stk5_lcd_pads));
+
+       debug("video format: %ux%u-%u@%u\n", p->xres, p->yres,
+               color_depth, refresh);
+
+       if (karo_load_splashimage(0) == 0) {
+               debug("Initializing LCD controller\n");
+               mxsfb_init(p, PIX_FMT_RGB24, color_depth);
+               video_hw_init(lcdbase);
+       } else {
+               debug("Skipping initialization of LCD controller\n");
+       }
+}
+#else
+#define lcd_enabled 0
+#endif /* CONFIG_LCD */
+
+static void stk5_board_init(void)
+{
+       gpio_request_array(stk5_gpios, ARRAY_SIZE(stk5_gpios));
+       mxs_iomux_setup_multiple_pads(stk5_pads, ARRAY_SIZE(stk5_pads));
+}
+
+static void stk5v3_board_init(void)
+{
+       stk5_board_init();
+}
+
+static void stk5v5_board_init(void)
+{
+       stk5_board_init();
+
+       /* init flexcan transceiver enable GPIO */
+       gpio_request_one(MXS_GPIO_NR(0, 1), GPIOF_OUTPUT_INIT_HIGH,
+                       "Flexcan Transceiver");
+       mxs_iomux_setup_pad(MX28_PAD_LCD_D00__GPIO_1_0);
+}
+
+int board_late_init(void)
+{
+       const char *baseboard;
+
+       karo_fdt_move_fdt();
+
+       baseboard = getenv("baseboard");
+       if (!baseboard)
+               return 0;
+
+       if (strncmp(baseboard, "stk5", 4) == 0) {
+               printf("Baseboard: %s\n", baseboard);
+               if ((strlen(baseboard) == 4) ||
+                       strcmp(baseboard, "stk5-v3") == 0) {
+                       stk5v3_board_init();
+               } else if (strcmp(baseboard, "stk5-v5") == 0) {
+                       stk5v5_board_init();
+               } else {
+                       printf("WARNING: Unsupported STK5 board rev.: %s\n",
+                               baseboard + 4);
+               }
+       } else {
+               printf("WARNING: Unsupported baseboard: '%s'\n",
+                       baseboard);
+               return -EINVAL;
+       }
+
+       return 0;
+}
+
+int checkboard(void)
+{
+       printf("Board: Ka-Ro TX28-4%sxx\n", TX28_MOD_SUFFIX);
+       return 0;
+}
+
+#if defined(CONFIG_OF_BOARD_SETUP)
+#ifdef CONFIG_FDT_FIXUP_PARTITIONS
+#include <jffs2/jffs2.h>
+#include <mtd_node.h>
+struct node_info tx28_nand_nodes[] = {
+       { "gpmi-nand", MTD_DEV_TYPE_NAND, },
+};
+#else
+#define fdt_fixup_mtdparts(b,n,c) do { } while (0)
+#endif
+
+static void tx28_fixup_flexcan(void *blob)
+{
+       karo_fdt_del_prop(blob, "fsl,p1010-flexcan", 0x80032000, "transceiver-switch");
+       karo_fdt_del_prop(blob, "fsl,p1010-flexcan", 0x80034000, "transceiver-switch");
+}
+
+static void tx28_fixup_fec(void *blob)
+{
+       karo_fdt_remove_node(blob, "ethernet1");
+}
+
+void ft_board_setup(void *blob, bd_t *bd)
+{
+       const char *baseboard = getenv("baseboard");
+
+#ifdef CONFIG_TX28_S
+       /* TX28-41xx (aka TX28S) has no external RTC
+        * and no I2C GPIO extender
+        */
+       karo_fdt_remove_node(blob, "ds1339");
+       karo_fdt_remove_node(blob, "pca9554");
+#endif
+       if (baseboard != NULL && strcmp(baseboard, "stk5-v5") == 0) {
+               const char *otg_mode = getenv("otg_mode");
+
+               if (otg_mode && strcmp(otg_mode, "host") == 0) {
+                       printf("otg_mode=%s incompatible with baseboard %s\n",
+                               otg_mode, baseboard);
+                       setenv(otg_mode, "none");
+               }
+               karo_fdt_remove_node(blob, "stk5led");
+       } else {
+               tx28_fixup_flexcan(blob);
+               tx28_fixup_fec(blob);
+       }
+
+       if (baseboard != NULL && strcmp(baseboard, "stk5-v3") == 0) {
+               const char *otg_mode = getenv("otg_mode");
+
+               if (otg_mode && strcmp(otg_mode, "device") == 0)
+                       karo_fdt_remove_node(blob, "can1");
+       }
+
+       fdt_fixup_mtdparts(blob, tx28_nand_nodes, ARRAY_SIZE(tx28_nand_nodes));
+       fdt_fixup_ethernet(blob);
+
+       karo_fdt_fixup_touchpanel(blob);
+       karo_fdt_fixup_usb_otg(blob);
+}
+#endif
diff --git a/board/karo/tx28/u-boot.bd b/board/karo/tx28/u-boot.bd
new file mode 100644 (file)
index 0000000..bbf6658
--- /dev/null
@@ -0,0 +1,14 @@
+sources {
+       u_boot_spl="@@BUILD_DIR@@spl/u-boot-spl";
+       u_boot="@@BUILD_DIR@@u-boot";
+}
+
+section (0) {
+       load u_boot_spl;
+       load ivt (entry = u_boot_spl:reset) > 0x8000;
+       hab call 0x8000;
+
+       load u_boot;
+       load ivt (entry = u_boot:reset) > 0x8000;
+       hab call 0x8000;
+}
diff --git a/board/karo/tx48/Makefile b/board/karo/tx48/Makefile
new file mode 100644 (file)
index 0000000..685af9d
--- /dev/null
@@ -0,0 +1,46 @@
+#
+# Makefile
+#
+# Copyright (C) 2011 Texas Instruments Incorporated - http://www.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 version 2.
+#
+# This program is distributed "as is" WITHOUT ANY WARRANTY of any
+# kind, whether express or implied; 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
+
+LIB    = $(obj)lib$(BOARD).o
+
+ifeq ($(CONFIG_SPL_BUILD),)
+       COBJS   := tx48.o
+else
+       COBJS   := spl.o
+endif
+
+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))
+
+clean:
+       rm -f $(SOBJS) $(OBJS)
+
+distclean:     clean
+       rm -f $(LIB) core *.bak $(obj).depend
+
+#########################################################################
+
+# defines $(obj).depend target
+include $(SRCTREE)/rules.mk
+
+sinclude $(obj).depend
+
+#########################################################################
diff --git a/board/karo/tx48/config.mk b/board/karo/tx48/config.mk
new file mode 100644 (file)
index 0000000..461f2d7
--- /dev/null
@@ -0,0 +1,6 @@
+CONFIG_SYS_TEXT_BASE = 0x80800000
+ifneq ($(CONFIG_SPL_BUILD),)
+       CONFIG_SPL_TEXT_BASE = 0x402F0400
+endif
+PLATFORM_CPPFLAGS += -Werror
+LOGO_BMP = logos/karo.bmp
diff --git a/board/karo/tx48/spl.c b/board/karo/tx48/spl.c
new file mode 100644 (file)
index 0000000..d106f2a
--- /dev/null
@@ -0,0 +1,415 @@
+/*
+ * board/karo/tx48/spl.c
+ * Copyright (C) 2012 Lothar Waßmann <LW@KARO-electronics.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 version 2.
+ *
+ * This program is distributed "as is" WITHOUT ANY WARRANTY of any
+ * kind, whether express or implied; 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 <errno.h>
+#include <miiphy.h>
+#include <netdev.h>
+#include <serial.h>
+#include <libfdt.h>
+#include <fdt_support.h>
+#include <nand.h>
+#include <net.h>
+#include <linux/mtd/nand.h>
+#include <asm/gpio.h>
+#include <asm/cache.h>
+#include <asm/omap_common.h>
+#include <asm/io.h>
+#include <asm/arch/cpu.h>
+#include <asm/arch/hardware.h>
+#include <asm/arch/mmc_host_def.h>
+#include <asm/arch/sys_proto.h>
+#include <asm/arch/nand.h>
+#include <asm/arch/clock.h>
+#include <asm/arch/common_def.h>
+#include <video_fb.h>
+#include <asm/arch/da8xx-fb.h>
+
+#define TX48_LED_GPIO          AM33XX_GPIO_NR(1, 26)
+#define TX48_ETH_PHY_RST_GPIO  AM33XX_GPIO_NR(3, 8)
+#define TX48_LCD_RST_GPIO      AM33XX_GPIO_NR(1, 19)
+#define TX48_LCD_PWR_GPIO      AM33XX_GPIO_NR(1, 22)
+#define TX48_LCD_BACKLIGHT_GPIO        AM33XX_GPIO_NR(3, 14)
+
+#define GMII_SEL               (CTRL_BASE + 0x650)
+
+/* UART Defines */
+#define UART_SYSCFG_OFFSET     0x54
+#define UART_SYSSTS_OFFSET     0x58
+
+#define UART_RESET             (0x1 << 1)
+#define UART_CLK_RUNNING_MASK  0x1
+#define UART_SMART_IDLE_EN     (0x1 << 0x3)
+
+/* Timer Defines */
+#define TSICR_REG              0x54
+#define TIOCP_CFG_REG          0x10
+#define TCLR_REG               0x38
+
+/* RGMII mode define */
+#define RGMII_MODE_ENABLE      0xA
+#define RMII_MODE_ENABLE       0x5
+#define MII_MODE_ENABLE                0x0
+
+#define NO_OF_MAC_ADDR         1
+#define ETH_ALEN               6
+
+#define MUX_CFG(value, offset) {                                       \
+       __raw_writel(value, (CTRL_BASE + (offset)));                    \
+       }
+
+/* PAD Control Fields */
+#define SLEWCTRL       (0x1 << 6)
+#define        RXACTIVE        (0x1 << 5)
+#define        PULLUP_EN       (0x1 << 4) /* Pull UP Selection */
+#define PULLUDEN       (0x0 << 3) /* Pull up enabled */
+#define PULLUDDIS      (0x1 << 3) /* Pull up disabled */
+#define MODE(val)      (val)
+
+/*
+ * PAD CONTROL OFFSETS
+ * Field names corresponds to the pad signal name
+ */
+struct pad_signals {
+       int gpmc_ad0;
+       int gpmc_ad1;
+       int gpmc_ad2;
+       int gpmc_ad3;
+       int gpmc_ad4;
+       int gpmc_ad5;
+       int gpmc_ad6;
+       int gpmc_ad7;
+       int gpmc_ad8;
+       int gpmc_ad9;
+       int gpmc_ad10;
+       int gpmc_ad11;
+       int gpmc_ad12;
+       int gpmc_ad13;
+       int gpmc_ad14;
+       int gpmc_ad15;
+       int gpmc_a0;
+       int gpmc_a1;
+       int gpmc_a2;
+       int gpmc_a3;
+       int gpmc_a4;
+       int gpmc_a5;
+       int gpmc_a6;
+       int gpmc_a7;
+       int gpmc_a8;
+       int gpmc_a9;
+       int gpmc_a10;
+       int gpmc_a11;
+       int gpmc_wait0;
+       int gpmc_wpn;
+       int gpmc_be1n;
+       int gpmc_csn0;
+       int gpmc_csn1;
+       int gpmc_csn2;
+       int gpmc_csn3;
+       int gpmc_clk;
+       int gpmc_advn_ale;
+       int gpmc_oen_ren;
+       int gpmc_wen;
+       int gpmc_be0n_cle;
+       int lcd_data0;
+       int lcd_data1;
+       int lcd_data2;
+       int lcd_data3;
+       int lcd_data4;
+       int lcd_data5;
+       int lcd_data6;
+       int lcd_data7;
+       int lcd_data8;
+       int lcd_data9;
+       int lcd_data10;
+       int lcd_data11;
+       int lcd_data12;
+       int lcd_data13;
+       int lcd_data14;
+       int lcd_data15;
+       int lcd_vsync;
+       int lcd_hsync;
+       int lcd_pclk;
+       int lcd_ac_bias_en;
+       int mmc0_dat3;
+       int mmc0_dat2;
+       int mmc0_dat1;
+       int mmc0_dat0;
+       int mmc0_clk;
+       int mmc0_cmd;
+       int mii1_col;
+       int mii1_crs;
+       int mii1_rxerr;
+       int mii1_txen;
+       int mii1_rxdv;
+       int mii1_txd3;
+       int mii1_txd2;
+       int mii1_txd1;
+       int mii1_txd0;
+       int mii1_txclk;
+       int mii1_rxclk;
+       int mii1_rxd3;
+       int mii1_rxd2;
+       int mii1_rxd1;
+       int mii1_rxd0;
+       int rmii1_refclk;
+       int mdio_data;
+       int mdio_clk;
+       int spi0_sclk;
+       int spi0_d0;
+       int spi0_d1;
+       int spi0_cs0;
+       int spi0_cs1;
+       int ecap0_in_pwm0_out;
+       int uart0_ctsn;
+       int uart0_rtsn;
+       int uart0_rxd;
+       int uart0_txd;
+       int uart1_ctsn;
+       int uart1_rtsn;
+       int uart1_rxd;
+       int uart1_txd;
+       int i2c0_sda;
+       int i2c0_scl;
+       int mcasp0_aclkx;
+       int mcasp0_fsx;
+       int mcasp0_axr0;
+       int mcasp0_ahclkr;
+       int mcasp0_aclkr;
+       int mcasp0_fsr;
+       int mcasp0_axr1;
+       int mcasp0_ahclkx;
+       int xdma_event_intr0;
+       int xdma_event_intr1;
+       int nresetin_out;
+       int porz;
+       int nnmi;
+       int osc0_in;
+       int osc0_out;
+       int rsvd1;
+       int tms;
+       int tdi;
+       int tdo;
+       int tck;
+       int ntrst;
+       int emu0;
+       int emu1;
+       int osc1_in;
+       int osc1_out;
+       int pmic_power_en;
+       int rtc_porz;
+       int rsvd2;
+       int ext_wakeup;
+       int enz_kaldo_1p8v;
+       int usb0_dm;
+       int usb0_dp;
+       int usb0_ce;
+       int usb0_id;
+       int usb0_vbus;
+       int usb0_drvvbus;
+       int usb1_dm;
+       int usb1_dp;
+       int usb1_ce;
+       int usb1_id;
+       int usb1_vbus;
+       int usb1_drvvbus;
+       int ddr_resetn;
+       int ddr_csn0;
+       int ddr_cke;
+       int ddr_ck;
+       int ddr_nck;
+       int ddr_casn;
+       int ddr_rasn;
+       int ddr_wen;
+       int ddr_ba0;
+       int ddr_ba1;
+       int ddr_ba2;
+       int ddr_a0;
+       int ddr_a1;
+       int ddr_a2;
+       int ddr_a3;
+       int ddr_a4;
+       int ddr_a5;
+       int ddr_a6;
+       int ddr_a7;
+       int ddr_a8;
+       int ddr_a9;
+       int ddr_a10;
+       int ddr_a11;
+       int ddr_a12;
+       int ddr_a13;
+       int ddr_a14;
+       int ddr_a15;
+       int ddr_odt;
+       int ddr_d0;
+       int ddr_d1;
+       int ddr_d2;
+       int ddr_d3;
+       int ddr_d4;
+       int ddr_d5;
+       int ddr_d6;
+       int ddr_d7;
+       int ddr_d8;
+       int ddr_d9;
+       int ddr_d10;
+       int ddr_d11;
+       int ddr_d12;
+       int ddr_d13;
+       int ddr_d14;
+       int ddr_d15;
+       int ddr_dqm0;
+       int ddr_dqm1;
+       int ddr_dqs0;
+       int ddr_dqsn0;
+       int ddr_dqs1;
+       int ddr_dqsn1;
+       int ddr_vref;
+       int ddr_vtp;
+       int ddr_strben0;
+       int ddr_strben1;
+       int ain7;
+       int ain6;
+       int ain5;
+       int ain4;
+       int ain3;
+       int ain2;
+       int ain1;
+       int ain0;
+       int vrefp;
+       int vrefn;
+};
+
+struct pin_mux {
+       short reg_offset;
+       uint8_t val;
+};
+
+#define PAD_CTRL_BASE  0x800
+#define OFFSET(x)      (unsigned int) (&((struct pad_signals *) \
+                               (PAD_CTRL_BASE))->x)
+
+static struct pin_mux tx48_pins[] = {
+#ifdef CONFIG_CMD_NAND
+       { 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 */
+#endif
+       /* I2C0 */
+       { OFFSET(i2c0_sda), MODE(0) | RXACTIVE | PULLUDEN | SLEWCTRL, }, /* I2C_DATA */
+       { OFFSET(i2c0_scl), MODE(0) | RXACTIVE | PULLUDEN | SLEWCTRL, }, /* I2C_SCLK */
+
+#ifndef CONFIG_NO_ETH
+       /* RMII1 */
+       { OFFSET(mii1_crs), MODE(1) | RXACTIVE, },      /* RMII1_CRS */
+       { OFFSET(mii1_rxerr), MODE(1) | RXACTIVE | PULLUDEN, },  /* RMII1_RXERR */
+       { OFFSET(mii1_txen), MODE(1), },                     /* RMII1_TXEN */
+       { OFFSET(mii1_txd1), MODE(1), },                     /* RMII1_TXD1 */
+       { OFFSET(mii1_txd0), MODE(1), },                     /* RMII1_TXD0 */
+       { OFFSET(mii1_rxd1), MODE(1) | RXACTIVE | PULLUP_EN, }, /* RMII1_RXD1 */
+       { OFFSET(mii1_rxd0), MODE(1) | RXACTIVE | PULLUP_EN, }, /* RMII1_RXD0 */
+       { OFFSET(mdio_data), MODE(0) | RXACTIVE | PULLUP_EN, }, /* MDIO_DATA */
+       { OFFSET(mdio_clk), MODE(0) | PULLUP_EN, },     /* MDIO_CLK */
+       { OFFSET(rmii1_refclk), MODE(0) | RXACTIVE, },  /* RMII1_REFCLK */
+       { OFFSET(emu0), MODE(7) | RXACTIVE},         /* nINT */
+       { OFFSET(emu1), MODE(7), },                  /* nRST */
+#endif
+};
+
+static struct gpio tx48_gpios[] = {
+       /* configure this pin early to prevent flicker of the LCD */
+       { TX48_LCD_BACKLIGHT_GPIO, GPIOF_OUTPUT_INIT_HIGH, "LCD BACKLIGHT", },
+};
+
+static struct pin_mux tx48_mmc_pins[] = {
+#ifdef CONFIG_OMAP_HSMMC
+       /* MMC1 */
+       { OFFSET(mii1_rxd2), MODE(4) | RXACTIVE | PULLUP_EN, }, /* MMC1_DAT3 */
+       { OFFSET(mii1_rxd3), MODE(4) | RXACTIVE | PULLUP_EN, }, /* MMC1_DAT2 */
+       { OFFSET(mii1_rxclk), MODE(4) | RXACTIVE | PULLUP_EN, }, /* MMC1_DAT1 */
+       { OFFSET(mii1_txclk), MODE(4) | RXACTIVE | PULLUP_EN, }, /* MMC1_DAT0 */
+       { OFFSET(gpmc_csn1), MODE(2) | RXACTIVE | PULLUP_EN, }, /* MMC1_CLK */
+       { OFFSET(gpmc_csn2), MODE(2) | RXACTIVE | PULLUP_EN, }, /* MMC1_CMD */
+       { OFFSET(mcasp0_fsx), MODE(4) | RXACTIVE, },    /* MMC1_CD */
+#endif
+};
+
+/*
+ * Configure the pin mux for the module
+ */
+static inline void tx48_set_pin_mux(const struct pin_mux *pin_mux,
+                       int num_pins)
+{
+       int i;
+
+       for (i = 0; i < num_pins; i++)
+               MUX_CFG(pin_mux[i].val, pin_mux[i].reg_offset);
+}
+
+#ifdef CONFIG_SPL_BOARD_INIT
+void spl_board_init(void)
+{
+       gpio_request_array(tx48_gpios, ARRAY_SIZE(tx48_gpios));
+       tx48_set_pin_mux(tx48_pins, ARRAY_SIZE(tx48_pins));
+       gpmc_init();
+}
+#endif /* CONFIG_SPL_BOARD_INIT */
+
+static struct pin_mux tx48_uart0_pins[] = {
+#ifdef CONFIG_SYS_NS16550_COM1
+       /* UART0 for early boot messages */
+       { OFFSET(uart0_rxd), MODE(0) | PULLUP_EN | RXACTIVE, }, /* UART0_RXD */
+       { OFFSET(uart0_txd), MODE(0) | PULLUDEN, },             /* UART0_TXD */
+       { OFFSET(uart0_ctsn), MODE(0) | PULLUP_EN | RXACTIVE, },/* UART0_CTS */
+       { OFFSET(uart0_rtsn), MODE(0) | PULLUDEN, },            /* UART0_RTS */
+#endif
+#ifdef CONFIG_SYS_NS16550_COM2
+       /* UART1 */
+       { OFFSET(uart1_rxd), MODE(0) | PULLUP_EN | RXACTIVE, }, /* UART1_RXD */
+       { OFFSET(uart1_txd), MODE(0) | PULLUDEN, },             /* UART1_TXD */
+       { OFFSET(uart1_ctsn), MODE(0) | PULLUP_EN | RXACTIVE, },/* UART1_CTS */
+       { OFFSET(uart1_rtsn), MODE(0) | PULLUDEN, },            /* UART1_RTS */
+#endif
+#ifdef CONFIG_SYS_NS16550_COM3
+       /* UART5 */
+       { OFFSET(mii1_rxdv), MODE(3) | PULLUP_EN | RXACTIVE, }, /* UART5_RXD */
+       { OFFSET(mii1_col), MODE(3) | PULLUDEN, },              /* UART5_TXD */
+       { OFFSET(mmc0_dat1), MODE(2) | PULLUP_EN | RXACTIVE, }, /* UART5_CTS */
+       { OFFSET(mmc0_dat0), MODE(2) | PULLUDEN, },             /* UART5_RTS */
+#endif
+};
+
+/*
+ * early system init of muxing and clocks.
+ */
+void enable_uart0_pin_mux(void)
+{
+       tx48_set_pin_mux(tx48_uart0_pins, ARRAY_SIZE(tx48_uart0_pins));
+}
+
+void enable_mmc0_pin_mux(void)
+{
+       tx48_set_pin_mux(tx48_mmc_pins, ARRAY_SIZE(tx48_mmc_pins));
+}
diff --git a/board/karo/tx48/tx48.c b/board/karo/tx48/tx48.c
new file mode 100644 (file)
index 0000000..59df3a7
--- /dev/null
@@ -0,0 +1,860 @@
+/*
+ * tx48.c
+ * Copyright (C) 2012 Lothar Waßmann <LW@KARO-electronics.de>
+ *
+ * based on evm.c
+ * Copyright (C) 2011 Texas Instruments Incorporated - http://www.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 version 2.
+ *
+ * This program is distributed "as is" WITHOUT ANY WARRANTY of any
+ * kind, whether express or implied; 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 <errno.h>
+#include <miiphy.h>
+#include <netdev.h>
+#include <serial.h>
+#include <libfdt.h>
+#include <lcd.h>
+#include <fdt_support.h>
+#include <nand.h>
+#include <net.h>
+#include <linux/mtd/nand.h>
+#include <asm/gpio.h>
+#include <asm/cache.h>
+#include <asm/omap_common.h>
+#include <asm/io.h>
+#include <asm/arch/cpu.h>
+#include <asm/arch/hardware.h>
+#include <asm/arch/mmc_host_def.h>
+#include <asm/arch/sys_proto.h>
+#include <asm/arch/nand.h>
+#include <asm/arch/clock.h>
+#include <asm/arch/common_def.h>
+#include <video_fb.h>
+#include <asm/arch/da8xx-fb.h>
+
+#include "../common/karo.h"
+
+DECLARE_GLOBAL_DATA_PTR;
+
+#define TX48_LED_GPIO          AM33XX_GPIO_NR(1, 26)
+#define TX48_ETH_PHY_RST_GPIO  AM33XX_GPIO_NR(3, 8)
+#define TX48_LCD_RST_GPIO      AM33XX_GPIO_NR(1, 19)
+#define TX48_LCD_PWR_GPIO      AM33XX_GPIO_NR(1, 22)
+#define TX48_LCD_BACKLIGHT_GPIO        AM33XX_GPIO_NR(3, 14)
+
+#define GMII_SEL               (CTRL_BASE + 0x650)
+
+/* UART Defines */
+#define UART_SYSCFG_OFFSET     0x54
+#define UART_SYSSTS_OFFSET     0x58
+
+#define UART_RESET             (0x1 << 1)
+#define UART_CLK_RUNNING_MASK  0x1
+#define UART_SMART_IDLE_EN     (0x1 << 0x3)
+
+/* Timer Defines */
+#define TSICR_REG              0x54
+#define TIOCP_CFG_REG          0x10
+#define TCLR_REG               0x38
+
+/* RGMII mode define */
+#define RGMII_MODE_ENABLE      0xA
+#define RMII_MODE_ENABLE       0x5
+#define MII_MODE_ENABLE                0x0
+
+#define NO_OF_MAC_ADDR         1
+#define ETH_ALEN               6
+
+#define MUX_CFG(value, offset) {                                       \
+       __raw_writel(value, (CTRL_BASE + (offset)));                    \
+       }
+
+/* PAD Control Fields */
+#define SLEWCTRL       (0x1 << 6)
+#define        RXACTIVE        (0x1 << 5)
+#define        PULLUP_EN       (0x1 << 4) /* Pull UP Selection */
+#define PULLUDEN       (0x0 << 3) /* Pull up enabled */
+#define PULLUDDIS      (0x1 << 3) /* Pull up disabled */
+#define MODE(val)      (val)
+
+/*
+ * PAD CONTROL OFFSETS
+ * Field names corresponds to the pad signal name
+ */
+struct pad_signals {
+       int gpmc_ad0;
+       int gpmc_ad1;
+       int gpmc_ad2;
+       int gpmc_ad3;
+       int gpmc_ad4;
+       int gpmc_ad5;
+       int gpmc_ad6;
+       int gpmc_ad7;
+       int gpmc_ad8;
+       int gpmc_ad9;
+       int gpmc_ad10;
+       int gpmc_ad11;
+       int gpmc_ad12;
+       int gpmc_ad13;
+       int gpmc_ad14;
+       int gpmc_ad15;
+       int gpmc_a0;
+       int gpmc_a1;
+       int gpmc_a2;
+       int gpmc_a3;
+       int gpmc_a4;
+       int gpmc_a5;
+       int gpmc_a6;
+       int gpmc_a7;
+       int gpmc_a8;
+       int gpmc_a9;
+       int gpmc_a10;
+       int gpmc_a11;
+       int gpmc_wait0;
+       int gpmc_wpn;
+       int gpmc_be1n;
+       int gpmc_csn0;
+       int gpmc_csn1;
+       int gpmc_csn2;
+       int gpmc_csn3;
+       int gpmc_clk;
+       int gpmc_advn_ale;
+       int gpmc_oen_ren;
+       int gpmc_wen;
+       int gpmc_be0n_cle;
+       int lcd_data0;
+       int lcd_data1;
+       int lcd_data2;
+       int lcd_data3;
+       int lcd_data4;
+       int lcd_data5;
+       int lcd_data6;
+       int lcd_data7;
+       int lcd_data8;
+       int lcd_data9;
+       int lcd_data10;
+       int lcd_data11;
+       int lcd_data12;
+       int lcd_data13;
+       int lcd_data14;
+       int lcd_data15;
+       int lcd_vsync;
+       int lcd_hsync;
+       int lcd_pclk;
+       int lcd_ac_bias_en;
+       int mmc0_dat3;
+       int mmc0_dat2;
+       int mmc0_dat1;
+       int mmc0_dat0;
+       int mmc0_clk;
+       int mmc0_cmd;
+       int mii1_col;
+       int mii1_crs;
+       int mii1_rxerr;
+       int mii1_txen;
+       int mii1_rxdv;
+       int mii1_txd3;
+       int mii1_txd2;
+       int mii1_txd1;
+       int mii1_txd0;
+       int mii1_txclk;
+       int mii1_rxclk;
+       int mii1_rxd3;
+       int mii1_rxd2;
+       int mii1_rxd1;
+       int mii1_rxd0;
+       int rmii1_refclk;
+       int mdio_data;
+       int mdio_clk;
+       int spi0_sclk;
+       int spi0_d0;
+       int spi0_d1;
+       int spi0_cs0;
+       int spi0_cs1;
+       int ecap0_in_pwm0_out;
+       int uart0_ctsn;
+       int uart0_rtsn;
+       int uart0_rxd;
+       int uart0_txd;
+       int uart1_ctsn;
+       int uart1_rtsn;
+       int uart1_rxd;
+       int uart1_txd;
+       int i2c0_sda;
+       int i2c0_scl;
+       int mcasp0_aclkx;
+       int mcasp0_fsx;
+       int mcasp0_axr0;
+       int mcasp0_ahclkr;
+       int mcasp0_aclkr;
+       int mcasp0_fsr;
+       int mcasp0_axr1;
+       int mcasp0_ahclkx;
+       int xdma_event_intr0;
+       int xdma_event_intr1;
+       int nresetin_out;
+       int porz;
+       int nnmi;
+       int osc0_in;
+       int osc0_out;
+       int rsvd1;
+       int tms;
+       int tdi;
+       int tdo;
+       int tck;
+       int ntrst;
+       int emu0;
+       int emu1;
+       int osc1_in;
+       int osc1_out;
+       int pmic_power_en;
+       int rtc_porz;
+       int rsvd2;
+       int ext_wakeup;
+       int enz_kaldo_1p8v;
+       int usb0_dm;
+       int usb0_dp;
+       int usb0_ce;
+       int usb0_id;
+       int usb0_vbus;
+       int usb0_drvvbus;
+       int usb1_dm;
+       int usb1_dp;
+       int usb1_ce;
+       int usb1_id;
+       int usb1_vbus;
+       int usb1_drvvbus;
+       int ddr_resetn;
+       int ddr_csn0;
+       int ddr_cke;
+       int ddr_ck;
+       int ddr_nck;
+       int ddr_casn;
+       int ddr_rasn;
+       int ddr_wen;
+       int ddr_ba0;
+       int ddr_ba1;
+       int ddr_ba2;
+       int ddr_a0;
+       int ddr_a1;
+       int ddr_a2;
+       int ddr_a3;
+       int ddr_a4;
+       int ddr_a5;
+       int ddr_a6;
+       int ddr_a7;
+       int ddr_a8;
+       int ddr_a9;
+       int ddr_a10;
+       int ddr_a11;
+       int ddr_a12;
+       int ddr_a13;
+       int ddr_a14;
+       int ddr_a15;
+       int ddr_odt;
+       int ddr_d0;
+       int ddr_d1;
+       int ddr_d2;
+       int ddr_d3;
+       int ddr_d4;
+       int ddr_d5;
+       int ddr_d6;
+       int ddr_d7;
+       int ddr_d8;
+       int ddr_d9;
+       int ddr_d10;
+       int ddr_d11;
+       int ddr_d12;
+       int ddr_d13;
+       int ddr_d14;
+       int ddr_d15;
+       int ddr_dqm0;
+       int ddr_dqm1;
+       int ddr_dqs0;
+       int ddr_dqsn0;
+       int ddr_dqs1;
+       int ddr_dqsn1;
+       int ddr_vref;
+       int ddr_vtp;
+       int ddr_strben0;
+       int ddr_strben1;
+       int ain7;
+       int ain6;
+       int ain5;
+       int ain4;
+       int ain3;
+       int ain2;
+       int ain1;
+       int ain0;
+       int vrefp;
+       int vrefn;
+};
+
+struct pin_mux {
+       short reg_offset;
+       uint8_t val;
+};
+
+#define PAD_CTRL_BASE  0x800
+#define OFFSET(x)      (unsigned int) (&((struct pad_signals *) \
+                               (PAD_CTRL_BASE))->x)
+/*
+ * Configure the pin mux for the module
+ */
+static inline void tx48_set_pin_mux(const struct pin_mux *pin_mux,
+                       int num_pins)
+{
+       int i;
+
+       for (i = 0; i < num_pins; i++)
+               MUX_CFG(pin_mux[i].val, pin_mux[i].reg_offset);
+}
+
+#define PRM_RSTST_GLOBAL_COLD_RST      (1 << 0)
+#define PRM_RSTST_GLOBAL_WARM_SW_RST   (1 << 1)
+#define PRM_RSTST_WDT1_RST             (1 << 4)
+#define PRM_RSTST_EXTERNAL_WARM_RST    (1 << 5)
+#define PRM_RSTST_ICEPICK_RST          (1 << 9)
+
+struct prm_device {
+       unsigned int prmrstctrl;        /* offset 0x00 */
+       unsigned int prmrsttime;        /* offset 0x04 */
+       unsigned int prmrstst;          /* offset 0x08 */
+       /* ... */
+};
+
+static u32 prm_rstst __attribute__((section(".data")));
+
+/*
+ * Basic board specific setup
+ */
+static const struct pin_mux stk5_pads[] = {
+       /* heartbeat LED */
+       { OFFSET(gpmc_a10), MODE(7) | PULLUDEN, },
+       /* LCD RESET */
+       { OFFSET(gpmc_a3), MODE(7) | PULLUDEN, },
+       /* LCD POWER_ENABLE */
+       { OFFSET(gpmc_a6), MODE(7) | PULLUDEN, },
+       /* LCD Backlight (PWM) */
+       { OFFSET(mcasp0_aclkx), MODE(7) | PULLUDEN, },
+};
+
+static const struct pin_mux stk5_lcd_pads[] = {
+       /* LCD data bus */
+       { OFFSET(lcd_data0), MODE(0) | PULLUDEN, },
+       { OFFSET(lcd_data1), MODE(0) | PULLUDEN, },
+       { OFFSET(lcd_data2), MODE(0) | PULLUDEN, },
+       { OFFSET(lcd_data3), MODE(0) | PULLUDEN, },
+       { OFFSET(lcd_data4), MODE(0) | PULLUDEN, },
+       { OFFSET(lcd_data5), MODE(0) | PULLUDEN, },
+       { OFFSET(lcd_data6), MODE(0) | PULLUDEN, },
+       { OFFSET(lcd_data7), MODE(0) | PULLUDEN, },
+       { OFFSET(lcd_data8), MODE(0) | PULLUDEN, },
+       { OFFSET(lcd_data9), MODE(0) | PULLUDEN, },
+       { OFFSET(lcd_data10), MODE(0) | PULLUDEN, },
+       { OFFSET(lcd_data11), MODE(0) | PULLUDEN, },
+       { OFFSET(lcd_data12), MODE(0) | PULLUDEN, },
+       { OFFSET(lcd_data13), MODE(0) | PULLUDEN, },
+       { OFFSET(lcd_data14), MODE(0) | PULLUDEN, },
+       { OFFSET(lcd_data15), MODE(0) | PULLUDEN, },
+       /* LCD control signals */
+       { OFFSET(lcd_hsync), MODE(0) | PULLUDEN, },
+       { OFFSET(lcd_vsync), MODE(0) | PULLUDEN, },
+       { OFFSET(lcd_pclk), MODE(0) | PULLUDEN, },
+       { OFFSET(lcd_ac_bias_en), MODE(0) | PULLUDEN, },
+};
+
+static const struct gpio stk5_gpios[] = {
+       { AM33XX_GPIO_NR(1, 26), GPIOF_OUTPUT_INIT_LOW, "HEARTBEAT LED", },
+};
+
+static const struct gpio stk5_lcd_gpios[] = {
+       { AM33XX_GPIO_NR(1, 19), GPIOF_OUTPUT_INIT_LOW, "LCD RESET", },
+       { AM33XX_GPIO_NR(1, 22), GPIOF_OUTPUT_INIT_LOW, "LCD POWER", },
+       { AM33XX_GPIO_NR(3, 14), GPIOF_OUTPUT_INIT_HIGH, "LCD BACKLIGHT", },
+};
+
+static const struct pin_mux stk5v5_pads[] = {
+       /* CAN transceiver control */
+       { OFFSET(gpmc_ad8), MODE(7) | PULLUDEN, },
+};
+
+static const struct gpio stk5v5_gpios[] = {
+       { AM33XX_GPIO_NR(0, 22), GPIOF_OUTPUT_INIT_HIGH, "CAN XCVR", },
+};
+
+#ifdef CONFIG_LCD
+vidinfo_t panel_info = {
+       /* set to max. size supported by SoC */
+       .vl_col = 1366,
+       .vl_row = 768,
+
+       .vl_bpix = LCD_COLOR24,    /* Bits per pixel, 0: 1bpp, 1: 2bpp, 2: 4bpp, 3: 8bpp ... */
+};
+
+static struct da8xx_panel tx48_lcd_panel = {
+       .name = "640x480MR@60",
+       .width = 640,
+       .height = 480,
+       .hfp = 12,
+       .hbp = 144,
+       .hsw = 30,
+       .vfp = 10,
+       .vbp = 35,
+       .vsw = 3,
+       .pxl_clk = 25000000,
+       .invert_pxl_clk = 1,
+};
+
+void *lcd_base;                        /* Start of framebuffer memory  */
+void *lcd_console_address;     /* Start of console buffer      */
+
+int lcd_line_length;
+int lcd_color_fg;
+int lcd_color_bg;
+
+short console_col;
+short console_row;
+
+static int lcd_enabled = 1;
+
+void lcd_initcolregs(void)
+{
+}
+
+void lcd_setcolreg(ushort regno, ushort red, ushort green, ushort blue)
+{
+}
+
+void lcd_enable(void)
+{
+       /* HACK ALERT:
+        * global variable from common/lcd.c
+        * Set to 0 here to prevent messages from going to LCD
+        * rather than serial console
+        */
+       lcd_is_enabled = 0;
+
+       if (lcd_enabled) {
+               karo_load_splashimage(1);
+
+               gpio_set_value(TX48_LCD_PWR_GPIO, 1);
+               gpio_set_value(TX48_LCD_RST_GPIO, 1);
+               udelay(300000);
+               gpio_set_value(TX48_LCD_BACKLIGHT_GPIO, 0);
+       }
+}
+
+void lcd_disable(void)
+{
+       da8xx_fb_disable();
+}
+
+void lcd_panel_disable(void)
+{
+       if (lcd_enabled) {
+               gpio_set_value(TX48_LCD_BACKLIGHT_GPIO, 1);
+               gpio_set_value(TX48_LCD_PWR_GPIO, 0);
+               gpio_set_value(TX48_LCD_RST_GPIO, 0);
+       }
+}
+
+void lcd_ctrl_init(void *lcdbase)
+{
+       int color_depth = 24;
+       char *vm;
+       unsigned long val;
+       struct da8xx_panel *p = &tx48_lcd_panel;
+       int refresh = 60;
+
+       if (!lcd_enabled) {
+               printf("LCD disabled\n");
+               return;
+       }
+
+       if (tstc() || (prm_rstst & PRM_RSTST_WDT1_RST)) {
+               lcd_enabled = 0;
+               return;
+       }
+
+       vm = getenv("video_mode");
+       if (vm == NULL) {
+               lcd_enabled = 0;
+               return;
+       }
+
+       strncpy((char *)p->name, vm, sizeof(p->name));
+
+       val = simple_strtoul(vm, &vm, 0);
+       if (val != 0) {
+               if (val > panel_info.vl_col)
+                       val = panel_info.vl_col;
+               p->width = val;
+               panel_info.vl_col = val;
+       }
+       if (*vm == 'x') {
+               val = simple_strtoul(vm + 1, &vm, 0);
+               if (val > panel_info.vl_row)
+                       val = panel_info.vl_row;
+               p->height = val;
+               panel_info.vl_row = val;
+       }
+       while (*vm != '\0') {
+               switch (*vm) {
+               case 'M':
+               case 'R':
+                       vm++;
+                       break;
+
+               case '-':
+                       color_depth = simple_strtoul(vm + 1, &vm, 10);
+                       break;
+
+               case '@':
+                       refresh = simple_strtoul(vm + 1, &vm, 10);
+                       break;
+
+               default:
+                       debug("Ignoring '%c'\n", *vm);
+                       vm++;
+               }
+       }
+       switch (color_depth) {
+       case 8:
+               panel_info.vl_bpix = 3;
+               break;
+
+       case 16:
+               panel_info.vl_bpix = 4;
+               break;
+
+       case 24:
+               panel_info.vl_bpix = 5;
+               break;
+
+       default:
+               printf("Invalid color_depth %u from video_mode '%s'; using default: %u\n",
+                       color_depth, getenv("video_mode"), 24);
+       }
+       lcd_line_length = NBITS(panel_info.vl_bpix) / 8 * panel_info.vl_col;
+       p->pxl_clk = refresh *
+               (p->width + p->hfp + p->hbp + p->hsw) *
+               (p->height + p->vfp + p->vbp + p->vsw);
+       debug("Pixel clock set to %u.%03uMHz\n",
+               p->pxl_clk / 1000000, p->pxl_clk / 1000 % 1000);
+
+       gpio_request_array(stk5_lcd_gpios, ARRAY_SIZE(stk5_lcd_gpios));
+       tx48_set_pin_mux(stk5_lcd_pads, ARRAY_SIZE(stk5_lcd_pads));
+       debug("Initializing FB driver\n");
+       da8xx_video_init(&tx48_lcd_panel, color_depth);
+
+       if (karo_load_splashimage(0) == 0) {
+               debug("Initializing LCD controller\n");
+               video_hw_init();
+       } else {
+               debug("Skipping initialization of LCD controller\n");
+       }
+}
+#else
+#define lcd_enabled 0
+#endif /* CONFIG_LCD */
+
+static void stk5_board_init(void)
+{
+       tx48_set_pin_mux(stk5_pads, ARRAY_SIZE(stk5_pads));
+}
+
+static void stk5v3_board_init(void)
+{
+       stk5_board_init();
+}
+
+static void stk5v5_board_init(void)
+{
+       stk5_board_init();
+       tx48_set_pin_mux(stk5v5_pads, ARRAY_SIZE(stk5v5_pads));
+       gpio_request_array(stk5v5_gpios, ARRAY_SIZE(stk5v5_gpios));
+}
+
+/* called with default environment! */
+int board_init(void)
+{
+       /* mach type passed to kernel */
+#ifdef CONFIG_OF_LIBFDT
+       gd->bd->bi_arch_number = -1;
+#endif
+       /* address of boot parameters */
+       gd->bd->bi_boot_params = PHYS_SDRAM_1 + 0x100;
+
+       return 0;
+}
+
+static void show_reset_cause(u32 prm_rstst)
+{
+       const char *dlm = "";
+
+       printf("RESET cause: ");
+       if (prm_rstst & PRM_RSTST_GLOBAL_COLD_RST) {
+               printf("%sPOR", dlm);
+               dlm = " | ";
+       }
+       if (prm_rstst & PRM_RSTST_GLOBAL_WARM_SW_RST) {
+               printf("%sSW", dlm);
+               dlm = " | ";
+       }
+       if (prm_rstst & PRM_RSTST_WDT1_RST) {
+               printf("%sWATCHDOG", dlm);
+               dlm = " | ";
+       }
+       if (prm_rstst & PRM_RSTST_EXTERNAL_WARM_RST) {
+               printf("%sWARM", dlm);
+               dlm = " | ";
+       }
+       if (prm_rstst & PRM_RSTST_ICEPICK_RST) {
+               printf("%sJTAG", dlm);
+               dlm = " | ";
+       }
+       if (*dlm == '\0')
+               printf("unknown");
+
+       printf(" RESET\n");
+}
+
+/* called with default environment! */
+int checkboard(void)
+{
+       struct prm_device *prmdev = (struct prm_device *)PRM_DEVICE;
+
+       prm_rstst = readl(&prmdev->prmrstst);
+       show_reset_cause(prm_rstst);
+
+#ifdef CONFIG_OF_LIBFDT
+       printf("Board: Ka-Ro TX48-7020 with FDT support\n");
+#else
+       printf("Board: Ka-Ro TX48-7020\n");
+#endif
+       timer_init();
+       return 0;
+}
+
+/* called with environment from NAND or MMC */
+int board_late_init(void)
+{
+       const char *baseboard;
+
+#ifdef CONFIG_OF_BOARD_SETUP
+       karo_fdt_move_fdt();
+#endif
+       baseboard = getenv("baseboard");
+       if (!baseboard)
+               return 0;
+
+       if (strncmp(baseboard, "stk5", 4) == 0) {
+               printf("Baseboard: %s\n", baseboard);
+               if ((strlen(baseboard) == 4) ||
+                       strcmp(baseboard, "stk5-v3") == 0) {
+                       stk5v3_board_init();
+               } else if (strcmp(baseboard, "stk5-v5") == 0) {
+                       stk5v5_board_init();
+               } else {
+                       printf("WARNING: Unsupported STK5 board rev.: %s\n",
+                               baseboard + 4);
+               }
+       } else {
+               printf("WARNING: Unsupported baseboard: '%s'\n",
+                       baseboard);
+               return -EINVAL;
+       }
+
+       return 0;
+}
+
+#ifdef CONFIG_DRIVER_TI_CPSW
+static void tx48_phy_init(char *name, int addr)
+{
+       debug("%s: Resetting ethernet PHY\n", __func__);
+
+       gpio_direction_output(TX48_ETH_PHY_RST_GPIO, 0);
+
+       udelay(100);
+
+       /* Release nRST */
+       gpio_set_value(TX48_ETH_PHY_RST_GPIO, 1);
+
+       /* Wait for PHY internal POR signal to deassert */
+       udelay(25000);
+}
+
+static void cpsw_control(int enabled)
+{
+       /* nothing for now */
+       /* TODO : VTP was here before */
+}
+
+static struct cpsw_slave_data cpsw_slaves[] = {
+       {
+               .slave_reg_ofs  = 0x208,
+               .sliver_reg_ofs = 0xd80,
+               .phy_id         = 0,
+       },
+};
+
+static struct cpsw_platform_data cpsw_data = {
+       .mdio_base              = CPSW_MDIO_BASE,
+       .cpsw_base              = CPSW_BASE,
+       .mdio_div               = 0xff,
+       .channels               = 8,
+       .cpdma_reg_ofs          = 0x800,
+       .slaves                 = ARRAY_SIZE(cpsw_slaves),
+       .slave_data             = cpsw_slaves,
+       .ale_reg_ofs            = 0xd00,
+       .ale_entries            = 1024,
+       .host_port_reg_ofs      = 0x108,
+       .hw_stats_reg_ofs       = 0x900,
+       .mac_control            = (1 << 5) /* MIIEN */,
+       .control                = cpsw_control,
+       .phy_init               = tx48_phy_init,
+       .gigabit_en             = 0,
+       .host_port_num          = 0,
+       .version                = CPSW_CTRL_VERSION_2,
+};
+
+int board_eth_init(bd_t *bis)
+{
+       uint8_t mac_addr[ETH_ALEN];
+       uint32_t mac_hi, mac_lo;
+
+       /* try reading mac address from efuse */
+       mac_lo = __raw_readl(MAC_ID0_LO);
+       mac_hi = __raw_readl(MAC_ID0_HI);
+
+       mac_addr[0] = mac_hi & 0xFF;
+       mac_addr[1] = (mac_hi & 0xFF00) >> 8;
+       mac_addr[2] = (mac_hi & 0xFF0000) >> 16;
+       mac_addr[3] = (mac_hi & 0xFF000000) >> 24;
+       mac_addr[4] = mac_lo & 0xFF;
+       mac_addr[5] = (mac_lo & 0xFF00) >> 8;
+
+       if (is_valid_ether_addr(mac_addr)) {
+               debug("MAC addr set to: %02x:%02x:%02x:%02x:%02x:%02x\n",
+                       mac_addr[0], mac_addr[1], mac_addr[2],
+                       mac_addr[3], mac_addr[4], mac_addr[5]);
+               eth_setenv_enetaddr("ethaddr", mac_addr);
+       } else {
+               printf("ERROR: Did not find a valid mac address in e-fuse\n");
+       }
+
+       __raw_writel(RMII_MODE_ENABLE, MAC_MII_SEL);
+       __raw_writel(0x5D, GMII_SEL);
+       return cpsw_register(&cpsw_data);
+}
+#endif /* CONFIG_DRIVER_TI_CPSW */
+
+#if defined(CONFIG_NAND_AM33XX) && defined(CONFIG_CMD_SWITCH_ECC)
+/******************************************************************************
+ * Command to switch between NAND HW and SW ecc
+ *****************************************************************************/
+static int do_switch_ecc(cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
+{
+       int type = 0;
+
+       if (argc < 2)
+               goto usage;
+
+       if (strncmp(argv[1], "hw", 2) == 0) {
+               if (argc == 3)
+                       type = simple_strtoul(argv[2], NULL, 10);
+               am33xx_nand_switch_ecc(NAND_ECC_HW, type);
+       }
+       else if (strncmp(argv[1], "sw", 2) == 0)
+               am33xx_nand_switch_ecc(NAND_ECC_SOFT, 0);
+       else
+               goto usage;
+
+       return 0;
+
+usage:
+       printf("Usage: nandecc %s\n", cmdtp->usage);
+       return 1;
+}
+
+U_BOOT_CMD(
+       nandecc, 3, 1,  do_switch_ecc,
+       "Switch NAND ECC calculation algorithm b/w hardware and software",
+       "[sw|hw <hw_type>] \n"
+       "   [sw|hw]- Switch b/w hardware(hw) & software(sw) ecc algorithm\n"
+       "   hw_type- 0 for Hamming code\n"
+       "            1 for bch4\n"
+       "            2 for bch8\n"
+       "            3 for bch16\n"
+);
+#endif /* CONFIG_NAND_AM33XX && CONFIG_CMD_SWITCH_ECC */
+
+enum {
+       LED_STATE_INIT = -1,
+       LED_STATE_OFF,
+       LED_STATE_ON,
+};
+
+void show_activity(int arg)
+{
+       static int led_state = LED_STATE_INIT;
+       static ulong last;
+
+       if (led_state == LED_STATE_INIT) {
+               last = get_timer(0);
+               gpio_set_value(TX48_LED_GPIO, 1);
+               led_state = LED_STATE_ON;
+       } else {
+               if (get_timer(last) > CONFIG_SYS_HZ) {
+                       last = get_timer(0);
+                       if (led_state == LED_STATE_ON) {
+                               gpio_set_value(TX48_LED_GPIO, 0);
+                       } else {
+                               gpio_set_value(TX48_LED_GPIO, 1);
+                       }
+                       led_state = 1 - led_state;
+               }
+       }
+}
+
+#ifdef CONFIG_OF_BOARD_SETUP
+#ifdef CONFIG_FDT_FIXUP_PARTITIONS
+#include <jffs2/jffs2.h>
+#include <mtd_node.h>
+struct node_info nodes[] = {
+       { "ti,omap2-nand", MTD_DEV_TYPE_NAND, },
+};
+
+#else
+#define fdt_fixup_mtdparts(b,n,c) do { } while (0)
+#endif /* CONFIG_FDT_FIXUP_PARTITIONS */
+
+static void tx48_fixup_flexcan(void *blob)
+{
+       const char *baseboard = getenv("baseboard");
+
+       if (baseboard && strcmp(baseboard, "stk5-v5") == 0)
+               return;
+
+       karo_fdt_del_prop(blob, "ti,dcan", 0x481cc000, "can-xcvr-enable");
+       karo_fdt_del_prop(blob, "ti,dcan", 0x481d0000, "can-xcvr-enable");
+}
+
+void ft_board_setup(void *blob, bd_t *bd)
+{
+       fdt_fixup_mtdparts(blob, nodes, ARRAY_SIZE(nodes));
+       fdt_fixup_ethernet(blob);
+
+       karo_fdt_fixup_touchpanel(blob);
+       tx48_fixup_flexcan(blob);
+}
+#endif /* CONFIG_OF_BOARD_SETUP */
diff --git a/board/karo/tx48/u-boot.lds b/board/karo/tx48/u-boot.lds
new file mode 100644 (file)
index 0000000..ea4a058
--- /dev/null
@@ -0,0 +1,92 @@
+/*
+ * Copyright (c) 2004-2008 Texas Instruments
+ *
+ * (C) Copyright 2002
+ * Gary Jennejohn, DENX Software Engineering, <garyj@denx.de>
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm")
+OUTPUT_ARCH(arm)
+ENTRY(_start)
+SECTIONS
+{
+       . = 0x00000000;
+       .text :
+       {
+               __image_copy_start = .;
+               CPUDIR/start.o (.text)
+               *(.text)
+       }
+
+       . = ALIGN(4);
+       .rodata : { *(SORT_BY_ALIGNMENT(SORT_BY_NAME(.rodata*))) }
+
+       . = ALIGN(4);
+       .data : {
+               *(.data)
+       }
+
+       . = ALIGN(4);
+
+       . = .;
+       __u_boot_cmd_start = .;
+       .u_boot_cmd : { *(.u_boot_cmd) }
+       __u_boot_cmd_end = .;
+
+       . = ALIGN(4);
+
+       __image_copy_end = .;
+
+       .rel.dyn : {
+               __rel_dyn_start = .;
+               *(.rel*)
+               __rel_dyn_end = .;
+       }
+
+       .dynsym : {
+               __dynsym_start = .;
+               *(.dynsym)
+       }
+
+       _end = .;
+
+       /*
+        * Deprecated: this MMU section is used by pxa at present but
+        * should not be used by new boards/CPUs.
+        */
+       . = ALIGN(4096);
+       .mmutable : {
+               *(.mmutable)
+       }
+
+       .bss __rel_dyn_start (OVERLAY) : {
+               __bss_start = .;
+               *(.bss)
+                . = ALIGN(4);
+               __bss_end__ = .;
+       }
+
+       /DISCARD/ : { *(.dynstr*) }
+       /DISCARD/ : { *(.dynamic*) }
+       /DISCARD/ : { *(.plt*) }
+       /DISCARD/ : { *(.interp*) }
+       /DISCARD/ : { *(.gnu*) }
+}
diff --git a/board/karo/tx51/Makefile b/board/karo/tx51/Makefile
new file mode 100644 (file)
index 0000000..53c68a2
--- /dev/null
@@ -0,0 +1,46 @@
+#
+# (C) Copyright 2009 DENX Software Engineering
+# Author: John Rigby <jcrigby@gmail.com>
+#
+# See file CREDITS for list of people who contributed to this
+# project.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 2 of
+# the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+# MA 02111-1307 USA
+#
+
+include $(TOPDIR)/config.mk
+
+LDSCRIPT := $(BOARDDIR)/u-boot.lds
+
+LIB    = $(obj)lib$(BOARD).o
+
+COBJS  := tx51.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))
+
+#########################################################################
+
+include $(SRCTREE)/rules.mk
+
+sinclude $(obj).depend
+
+#########################################################################
diff --git a/board/karo/tx51/config.mk b/board/karo/tx51/config.mk
new file mode 100644 (file)
index 0000000..8998907
--- /dev/null
@@ -0,0 +1,5 @@
+# stack is allocated below CONFIG_SYS_TEXT_BASE
+CONFIG_SYS_TEXT_BASE := 0x90100000
+
+PLATFORM_CPPFLAGS += -Werror
+LOGO_BMP = logos/karo.bmp
diff --git a/board/karo/tx51/lowlevel_init.S b/board/karo/tx51/lowlevel_init.S
new file mode 100644 (file)
index 0000000..ebd534f
--- /dev/null
@@ -0,0 +1,179 @@
+#include <config.h>
+#include <configs/tx51.h>
+#include <asm/arch/imx-regs.h>
+
+#define DCDGEN(type, addr, data)  .long type, addr, data
+
+#define SDRAM_CLK              CONFIG_SYS_SDRAM_CLK
+
+#ifdef PHYS_SDRAM_2_SIZE
+#define SDRAM_SIZE             (PHYS_SDRAM_1_SIZE + PHYS_SDRAM_2_SIZE)
+#else
+#define SDRAM_SIZE             PHYS_SDRAM_1_SIZE
+#endif
+
+#define REG_ESDCTL0            0x00
+#define REG_ESDCFG0            0x04
+#define REG_ESDCTL1            0x08
+#define REG_ESDCFG1            0x0c
+#define REG_ESDMISC            0x10
+#define REG_ESDSCR             0x14
+#define REG_ESDGPR             0x34
+
+#define REG_CCGR0              0x68
+#define REG_CCGR1              0x6c
+#define REG_CCGR2              0x70
+#define REG_CCGR3              0x74
+#define REG_CCGR4              0x78
+#define REG_CCGR5              0x7c
+#define REG_CCGR6              0x80
+#define REG_CMEOR              0x84
+
+/* SDRAM timing setup */
+#define RALAT          1
+#define LHD            0
+
+#if SDRAM_SIZE <= SZ_128M
+#define RA_BITS                (13 - 11)       /* row addr bits - 11 */
+#else
+#define RA_BITS                (14 - 11)       /* row addr bits - 11 */
+#endif
+
+#define CA_BITS                (10 - 8)        /* 0-2: col addr bits - 8 3: rsrvd */
+#define DSIZ           2       /* 0: D[31..16] 1: D[15..D0] 2: D[31..0] 3: rsrvd */
+#define SREFR          3       /* 0: disabled 1-5: 2^n rows/clock *: rsrvd */
+#define SRT            0       /* 0: disabled *: 1: self refr. ... */
+#define PWDT           0       /* 0: disabled 1: precharge pwdn
+                                  2: pwdn after 64 clocks 3: pwdn after 128 clocks */
+#define ESDCTL_VAL     (0x80000000 | (SREFR << 28) | (RA_BITS << 24) | (CA_BITS << 20) | \
+                        (DSIZ << 16) | (SRT << 14) | (PWDT << 12))
+
+#define NS_TO_CK(ns)   (((ns) * SDRAM_CLK + 999) / 1000)
+
+       .macro          CK_VAL, name, clks, offs
+       .iflt           \clks - \offs
+       .set            \name, 0
+       .else
+       .set            \name, \clks - \offs
+       .endif
+       .endm
+
+       .macro          NS_VAL, name, ns, offs
+       .iflt           \ns - \offs
+       .set            \name, 0
+       .else
+       CK_VAL          \name, NS_TO_CK(\ns), \offs
+       .endif
+       .endm
+
+#if SDRAM_CLK < 200
+/* MT46H32M32LF-6 */
+NS_VAL tRFC, 125, 10   /* clks - 10 (0..15) */
+NS_VAL tXSR, 138, 25   /* clks - 25 (0..15) */
+NS_VAL tXP,   25,  1   /* clks - 1 (0..7)  */
+CK_VAL tWTR,   1,  1   /* clks - 1 (0..1)  */
+NS_VAL tRP,   18,  2   /* clks - 2 (0..3)  */
+CK_VAL tMRD,   2,  1   /* clks - 1 (0..3)  */
+NS_VAL tWR,   15,  2   /* clks - 2 (0..1)  */
+NS_VAL tRAS,  42,  1   /* clks - 1 (0..15) */
+NS_VAL tRRD,  12,  1   /* clks - 1 (0..3)  */
+NS_VAL tRCD,  18,  1   /* clks - 1 (0..7) */
+NS_VAL tRC,   60,  1   /* 0: 20 *: clks - 1 (0..15) */
+#else
+/* MT46H64M32LF-5 or -6 */
+NS_VAL tRFC,  72, 10   /* clks - 10 (0..15) */
+NS_VAL tXSR, 113, 25   /* clks - 25 (0..15) */
+CK_VAL tXP,    2,  1   /* clks - 1 (0..7)  */
+CK_VAL tWTR,   2,  1   /* clks - 1 (0..1)  */
+NS_VAL tRP,   18,  2   /* clks - 2 (0..3)  */
+CK_VAL tMRD,   2,  1   /* clks - 1 (0..3)  */
+NS_VAL tWR,   15,  2   /* clks - 2 (0..1)  */
+NS_VAL tRAS,  42,  1   /* clks - 1 (0..15) */
+NS_VAL tRRD,  12,  1   /* clks - 1 (0..3)  */
+NS_VAL tRCD,  18,  1   /* clks - 1 (0..7) */
+NS_VAL tRC,   60,  1   /* 0: 20 *: clks - 1 (0..15) */
+#endif
+
+#define ESDCFG_VAL     ((tRFC << 28) | (tXSR << 24) | (tXP << 21) | \
+                       (tWTR << 20) | (tRP << 18) | (tMRD << 16) | \
+                       (tRAS << 12) | (tRRD << 10) | (tWR << 7) | \
+                       (tRCD << 4) | (tRC << 0))
+
+#define ESDMISC_RALAT(n)       (((n) & 0x3) << 7)
+#define ESDMISC_DDR2_EN(n)     (((n) & 0x1) << 4)
+#define ESDMISC_DDR_EN(n)      (((n) & 0x1) << 3)
+#define ESDMISC_AP(n)          (((n) & 0xf) << 16)
+#define ESDMISC_VAL            (ESDMISC_AP(10) | ESDMISC_RALAT(RALAT) | \
+                               (LHD << 5) | ESDMISC_DDR2_EN(0) | ESDMISC_DDR_EN(0))
+
+       b       _start
+       .org    0x400
+app_start_addr:
+       .long   _start
+app_code_barker:
+       .long   0xB1
+app_code_csf:
+       .long   0 // 0x97f40000 - 0x1000
+dcd_ptr_ptr:
+       .long   dcd_ptr
+super_root_key:
+       .long   0 // hab_super_root_key
+dcd_ptr:
+       .long   dcd_data
+app_dest_ptr:
+       .long   CONFIG_SYS_TEXT_BASE
+dcd_data:
+       .long   0xB17219E9   // Fixed. can't change.
+dcd_len:
+       .long   dcd_end - dcd_start
+dcd_start:
+       DCDGEN(4, CCM_BASE_ADDR + REG_CCGR0, 0xffcffffc);
+       DCDGEN(4, CCM_BASE_ADDR + REG_CCGR1, 0x003fffff);
+       DCDGEN(4, CCM_BASE_ADDR + REG_CCGR2, 0x030c003c);
+       DCDGEN(4, CCM_BASE_ADDR + REG_CCGR3, 0x000000ff);
+       DCDGEN(4, CCM_BASE_ADDR + REG_CCGR4, 0x00000000);
+       DCDGEN(4, CCM_BASE_ADDR + REG_CCGR5, 0x003fc003);
+       DCDGEN(4, CCM_BASE_ADDR + REG_CCGR6, 0x00000000);
+       DCDGEN(4, CCM_BASE_ADDR + REG_CMEOR, 0x00000000);
+
+       DCDGEN(4, ESDCTL_BASE_ADDR + REG_ESDCTL0, 0x80000000)
+       DCDGEN(4, ESDCTL_BASE_ADDR + REG_ESDSCR, 0x04008008)
+       DCDGEN(4, ESDCTL_BASE_ADDR + REG_ESDSCR, 0x00008010)
+       DCDGEN(4, ESDCTL_BASE_ADDR + REG_ESDSCR, 0x00008010)
+       DCDGEN(4, ESDCTL_BASE_ADDR + REG_ESDSCR, 0x00338018)
+       DCDGEN(4, ESDCTL_BASE_ADDR + REG_ESDCTL0, ESDCTL_VAL)
+       DCDGEN(4, ESDCTL_BASE_ADDR + REG_ESDCFG0, ESDCFG_VAL)
+#ifdef RAM_BANK1_SIZE
+       DCDGEN(4, ESDCTL_BASE_ADDR + REG_ESDCTL1, ESDCTL_VAL)
+       DCDGEN(4, ESDCTL_BASE_ADDR + REG_ESDCFG1, ESDCFG_VAL)
+#endif
+       DCDGEN(4, ESDCTL_BASE_ADDR + REG_ESDGPR, 0x00020000 | ((RALAT & 0x3) << 29))
+       DCDGEN(4, ESDCTL_BASE_ADDR + REG_ESDMISC, ESDMISC_VAL)
+       DCDGEN(4, ESDCTL_BASE_ADDR + REG_ESDSCR, 0x00000000)
+
+       /* UART1_RXD */
+       DCDGEN(4, IOMUXC_BASE_ADDR + 0x228, 0x00000000)
+       DCDGEN(4, IOMUXC_BASE_ADDR + 0x618, 0x000001c1)
+       DCDGEN(4, IOMUXC_BASE_ADDR + 0x9e4, 0x00000000)
+       
+       /* UART1_TXD */
+       DCDGEN(4, IOMUXC_BASE_ADDR + 0x22c, 0x00000000)
+       DCDGEN(4, IOMUXC_BASE_ADDR + 0x61c, 0x000000c5)
+
+       /* UART1_RTS */
+       DCDGEN(4, IOMUXC_BASE_ADDR + 0x230, 0x00000000)
+       DCDGEN(4, IOMUXC_BASE_ADDR + 0x620, 0x000001c1)
+       DCDGEN(4, IOMUXC_BASE_ADDR + 0x9e0, 0x00000000)
+       
+       /* UART1_CTS */
+       DCDGEN(4, IOMUXC_BASE_ADDR + 0x234, 0x00000000)
+       DCDGEN(4, IOMUXC_BASE_ADDR + 0x624, 0x000000c5)
+
+       /* STK5 board LED */
+       DCDGEN(4, IOMUXC_BASE_ADDR + 0x1d0, 0x00000013)
+dcd_end:
+       .ifgt   dcd_end - dcd_start - 720
+       DCD too large!
+       .endif
+image_len:
+       .long   CONFIG_U_BOOT_IMG_SIZE
diff --git a/board/karo/tx51/tx51.c b/board/karo/tx51/tx51.c
new file mode 100644 (file)
index 0000000..b140e57
--- /dev/null
@@ -0,0 +1,891 @@
+/*
+ * Copyright (C) 2011 Lothar Waßmann <LW@KARO-electronics.de>
+ * based on: board/freescale/mx28_evk.c (C) 2010 Freescale Semiconductor, Inc.
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ */
+
+#include <common.h>
+#include <errno.h>
+#include <libfdt.h>
+#include <fdt_support.h>
+#include <lcd.h>
+#include <netdev.h>
+#include <mmc.h>
+#include <fsl_esdhc.h>
+#include <video_fb.h>
+#include <ipu_pixfmt.h>
+#include <mx2fb.h>
+#include <linux/fb.h>
+#include <asm/io.h>
+#include <asm/gpio.h>
+#include <asm/arch/iomux-mx51.h>
+#include <asm/arch/clock.h>
+#include <asm/arch/imx-regs.h>
+#include <asm/arch/crm_regs.h>
+#include <asm/arch/sys_proto.h>
+
+#include "../common/karo.h"
+
+#define IMX_GPIO_NR(b, o)      ((((b) - 1) << 5) | (o))
+
+#define TX51_FEC_RST_GPIO      IMX_GPIO_NR(2, 14)
+#define TX51_FEC_PWR_GPIO      IMX_GPIO_NR(1, 3)
+#define TX51_FEC_INT_GPIO      IMX_GPIO_NR(3, 18)
+#define TX51_LED_GPIO          IMX_GPIO_NR(4, 10)
+
+#define TX51_LCD_PWR_GPIO      IMX_GPIO_NR(4, 14)
+#define TX51_LCD_RST_GPIO      IMX_GPIO_NR(4, 13)
+#define TX51_LCD_BACKLIGHT_GPIO        IMX_GPIO_NR(1, 2)
+
+#define TX51_RESET_OUT_GPIO    IMX_GPIO_NR(2, 15)
+
+DECLARE_GLOBAL_DATA_PTR;
+
+#define IOMUX_SION             IOMUX_PAD(0, 0, IOMUX_CONFIG_SION, 0, 0, 0)
+
+#define FEC_PAD_CTL    (PAD_CTL_DVS | PAD_CTL_DSE_HIGH | \
+                       PAD_CTL_SRE_FAST)
+#define FEC_PAD_CTL2   (PAD_CTL_DVS | PAD_CTL_SRE_FAST)
+#define GPIO_PAD_CTL   (PAD_CTL_DVS | PAD_CTL_DSE_HIGH)
+
+static iomux_v3_cfg_t tx51_pads[] = {
+       /* NAND flash pads are set up in lowlevel_init.S */
+
+       /* RESET_OUT */
+       NEW_PAD_CTRL(MX51_PAD_EIM_A21__GPIO2_15, GPIO_PAD_CTL),
+
+       /* UART pads */
+#if CONFIG_MXC_UART_BASE == UART1_BASE
+       MX51_PAD_UART1_RXD__UART1_RXD,
+       MX51_PAD_UART1_TXD__UART1_TXD,
+       MX51_PAD_UART1_RTS__UART1_RTS,
+       MX51_PAD_UART1_CTS__UART1_CTS,
+#endif
+#if CONFIG_MXC_UART_BASE == UART2_BASE
+       MX51_PAD_UART2_RXD__UART2_RXD,
+       MX51_PAD_UART2_TXD__UART2_TXD,
+       MX51_PAD_EIM_D26__UART2_RTS,
+       MX51_PAD_EIM_D25__UART2_CTS,
+#endif
+#if CONFIG_MXC_UART_BASE == UART3_BASE
+       MX51_PAD_UART3_RXD__UART3_RXD,
+       MX51_PAD_UART3_TXD__UART3_TXD,
+       MX51_PAD_EIM_D18__UART3_RTS,
+       MX51_PAD_EIM_D17__UART3_CTS,
+#endif
+       /* internal I2C */
+       MX51_PAD_I2C1_DAT__GPIO4_17 | IOMUX_SION,
+       MX51_PAD_I2C1_CLK__GPIO4_16 | IOMUX_SION,
+
+       /* FEC PHY GPIO functions */
+       NEW_PAD_CTRL(MX51_PAD_GPIO1_3__GPIO1_3, GPIO_PAD_CTL),    /* PHY POWER */
+       NEW_PAD_CTRL(MX51_PAD_EIM_A20__GPIO2_14, GPIO_PAD_CTL),   /* PHY RESET */
+       NEW_PAD_CTRL(MX51_PAD_NANDF_CS2__GPIO3_18, GPIO_PAD_CTL), /* PHY INT */
+
+       /* FEC functions */
+       NEW_PAD_CTRL(MX51_PAD_NANDF_CS3__FEC_MDC, FEC_PAD_CTL),
+       NEW_PAD_CTRL(MX51_PAD_EIM_EB2__FEC_MDIO, FEC_PAD_CTL),
+       NEW_PAD_CTRL(MX51_PAD_NANDF_D11__FEC_RX_DV, FEC_PAD_CTL2),
+       NEW_PAD_CTRL(MX51_PAD_EIM_CS4__FEC_RX_ER, FEC_PAD_CTL2),
+       NEW_PAD_CTRL(MX51_PAD_NANDF_RDY_INT__FEC_TX_CLK, FEC_PAD_CTL2),
+       NEW_PAD_CTRL(MX51_PAD_NANDF_CS7__FEC_TX_EN, FEC_PAD_CTL),
+       NEW_PAD_CTRL(MX51_PAD_NANDF_D8__FEC_TDATA0, FEC_PAD_CTL),
+       NEW_PAD_CTRL(MX51_PAD_NANDF_CS4__FEC_TDATA1, FEC_PAD_CTL),
+       NEW_PAD_CTRL(MX51_PAD_NANDF_CS5__FEC_TDATA2, FEC_PAD_CTL),
+       NEW_PAD_CTRL(MX51_PAD_NANDF_CS6__FEC_TDATA3, FEC_PAD_CTL),
+
+       /* strap pins for PHY configuration */
+       NEW_PAD_CTRL(MX51_PAD_NANDF_RB3__GPIO3_11, GPIO_PAD_CTL), /* RX_CLK/REGOFF */
+       NEW_PAD_CTRL(MX51_PAD_NANDF_D9__GPIO3_31, GPIO_PAD_CTL),  /* RXD0/Mode0 */
+       NEW_PAD_CTRL(MX51_PAD_EIM_EB3__GPIO2_23, GPIO_PAD_CTL),   /* RXD1/Mode1 */
+       NEW_PAD_CTRL(MX51_PAD_EIM_CS2__GPIO2_27, GPIO_PAD_CTL),   /* RXD2/Mode2 */
+       NEW_PAD_CTRL(MX51_PAD_EIM_CS3__GPIO2_28, GPIO_PAD_CTL),   /* RXD3/nINTSEL */
+       NEW_PAD_CTRL(MX51_PAD_NANDF_RB2__GPIO3_10, GPIO_PAD_CTL), /* COL/RMII/CRSDV */
+       NEW_PAD_CTRL(MX51_PAD_EIM_CS5__GPIO2_30, GPIO_PAD_CTL),   /* CRS/PHYAD4 */
+
+       /* unusable pins on TX51 */
+       MX51_PAD_GPIO1_0__GPIO1_0,
+       MX51_PAD_GPIO1_1__GPIO1_1,
+};
+
+static const struct gpio tx51_gpios[] = {
+       /* RESET_OUT */
+       { TX51_RESET_OUT_GPIO, GPIOF_OUTPUT_INIT_LOW, "RESET_OUT", },
+
+       /* FEC PHY control GPIOs */
+       { TX51_FEC_PWR_GPIO, GPIOF_OUTPUT_INIT_LOW, "FEC POWER", }, /* PHY POWER */
+       { TX51_FEC_RST_GPIO, GPIOF_OUTPUT_INIT_LOW, "FEC RESET", }, /* PHY RESET */
+       { TX51_FEC_INT_GPIO, GPIOF_INPUT, "FEC PHY INT", },         /* PHY INT (TX_ER) */
+
+       /* FEC PHY strap pins */
+       { IMX_GPIO_NR(3, 11), GPIOF_OUTPUT_INIT_LOW, "FEC PHY REGOFF", },  /* RX_CLK/REGOFF */
+       { IMX_GPIO_NR(3, 31), GPIOF_OUTPUT_INIT_LOW, "FEC PHY MODE0", },   /* RXD0/Mode0 */
+       { IMX_GPIO_NR(2, 23), GPIOF_OUTPUT_INIT_LOW, "FEC PHY MODE1", },   /* RXD1/Mode1 */
+       { IMX_GPIO_NR(2, 27), GPIOF_OUTPUT_INIT_LOW, "FEC PHY MODE2", },   /* RXD2/Mode2 */
+       { IMX_GPIO_NR(2, 28), GPIOF_OUTPUT_INIT_LOW, "FEC PHY nINTSEL", }, /* RXD3/nINTSEL */
+       { IMX_GPIO_NR(3, 10), GPIOF_OUTPUT_INIT_LOW, "FEC PHY RMII", },    /* COL/RMII/CRSDV */
+       { IMX_GPIO_NR(2, 30), GPIOF_OUTPUT_INIT_LOW, "FEC PHY PHYAD4", },  /* CRS/PHYAD4 */
+
+       /* module internal I2C bus */
+       { IMX_GPIO_NR(4, 17), GPIOF_INPUT, "I2C1 SDA", },
+       { IMX_GPIO_NR(4, 16), GPIOF_INPUT, "I2C1 SCL", },
+
+       /* Unconnected pins */
+       { IMX_GPIO_NR(1, 0), GPIOF_OUTPUT_INIT_LOW, "N/C", },
+       { IMX_GPIO_NR(1, 1), GPIOF_OUTPUT_INIT_LOW, "N/C", },
+};
+
+/*
+ * Functions
+ */
+#define WRSR_POR       (1 << 4)
+#define WRSR_TOUT      (1 << 1)
+#define WRSR_SFTW      (1 << 0)
+
+/* placed in section '.data' to prevent overwriting relocation info
+ * overlayed with bss
+ */
+static u32 wrsr __attribute__((section(".data")));
+
+static void print_reset_cause(void)
+{
+       struct src *src_regs = (struct src *)SRC_BASE_ADDR;
+       void __iomem *wdt_base = (void __iomem *)WDOG1_BASE_ADDR;
+       u32 srsr;
+       char *dlm = "";
+
+       printf("Reset cause: ");
+
+       srsr = readl(&src_regs->srsr);
+       wrsr = readw(wdt_base + 4);
+
+       if (wrsr & WRSR_POR) {
+               printf("%sPOR", dlm);
+               dlm = " | ";
+       }
+       if (srsr & 0x00004) {
+               printf("%sCSU", dlm);
+               dlm = " | ";
+       }
+       if (srsr & 0x00008) {
+               printf("%sIPP USER", dlm);
+               dlm = " | ";
+       }
+       if (srsr & 0x00010) {
+               if (wrsr & WRSR_SFTW) {
+                       printf("%sSOFT", dlm);
+                       dlm = " | ";
+               }
+               if (wrsr & WRSR_TOUT) {
+                       printf("%sWDOG", dlm);
+                       dlm = " | ";
+               }
+       }
+       if (srsr & 0x00020) {
+               printf("%sJTAG HIGH-Z", dlm);
+               dlm = " | ";
+       }
+       if (srsr & 0x00040) {
+               printf("%sJTAG SW", dlm);
+               dlm = " | ";
+       }
+       if (srsr & 0x10000) {
+               printf("%sWARM BOOT", dlm);
+               dlm = " | ";
+       }
+       if (dlm[0] == '\0')
+               printf("unknown");
+
+       printf("\n");
+}
+
+static void print_cpuinfo(void)
+{
+       u32 cpurev;
+
+       cpurev = get_cpu_rev();
+
+       printf("CPU:   Freescale i.MX51 rev%d.%d at %d MHz\n",
+               (cpurev & 0x000F0) >> 4,
+               (cpurev & 0x0000F) >> 0,
+               mxc_get_clock(MXC_ARM_CLK) / 1000000);
+
+       print_reset_cause();
+}
+
+int board_early_init_f(void)
+{
+       struct mxc_ccm_reg *ccm_regs = (struct mxc_ccm_reg *)MXC_CCM_BASE;
+
+#ifdef CONFIG_CMD_BOOTCE
+       /* WinCE fails to enable these clocks */
+       writel(readl(&ccm_regs->CCGR2) | 0x0c000000, &ccm_regs->CCGR2); /* usboh3_ipg_ahb */
+       writel(readl(&ccm_regs->CCGR4) | 0x30000000, &ccm_regs->CCGR4); /* srtc */
+       writel(readl(&ccm_regs->CCGR6) | 0x00000300, &ccm_regs->CCGR6); /* emi_garb */
+#endif
+       gpio_request_array(tx51_gpios, ARRAY_SIZE(tx51_gpios));
+       mxc_iomux_v3_setup_multiple_pads(tx51_pads, ARRAY_SIZE(tx51_pads));
+
+       writel(0x77777777, AIPS1_BASE_ADDR + 0x00);
+       writel(0x77777777, AIPS1_BASE_ADDR + 0x04);
+
+       writel(0x00000000, AIPS1_BASE_ADDR + 0x40);
+       writel(0x00000000, AIPS1_BASE_ADDR + 0x44);
+       writel(0x00000000, AIPS1_BASE_ADDR + 0x48);
+       writel(0x00000000, AIPS1_BASE_ADDR + 0x4c);
+       writel(0x00000000, AIPS1_BASE_ADDR + 0x50);
+
+       writel(0x77777777, AIPS2_BASE_ADDR + 0x00);
+       writel(0x77777777, AIPS2_BASE_ADDR + 0x04);
+
+       writel(0x00000000, AIPS2_BASE_ADDR + 0x40);
+       writel(0x00000000, AIPS2_BASE_ADDR + 0x44);
+       writel(0x00000000, AIPS2_BASE_ADDR + 0x48);
+       writel(0x00000000, AIPS2_BASE_ADDR + 0x4c);
+       writel(0x00000000, AIPS2_BASE_ADDR + 0x50);
+
+       return 0;
+}
+
+int board_init(void)
+{
+       /* Address of boot parameters */
+       gd->bd->bi_boot_params = PHYS_SDRAM_1 + 0x1000;
+       return 0;
+}
+
+int dram_init(void)
+{
+       int ret;
+
+       /* dram_init must store complete ramsize in gd->ram_size */
+       gd->ram_size = get_ram_size((void *)CONFIG_SYS_SDRAM_BASE,
+                               PHYS_SDRAM_1_SIZE);
+
+       ret = mxc_set_clock(CONFIG_SYS_MX5_HCLK,
+               CONFIG_SYS_SDRAM_CLK, MXC_DDR_CLK);
+       if (ret)
+               printf("%s: Failed to set DDR clock to %u MHz: %d\n", __func__,
+                       CONFIG_SYS_SDRAM_CLK, ret);
+       else
+               debug("%s: DDR clock set to %u.%03u MHz (desig.: %u.000 MHz)\n",
+                       __func__, mxc_get_clock(MXC_DDR_CLK) / 1000000,
+                       mxc_get_clock(MXC_DDR_CLK) / 1000 % 1000,
+                       CONFIG_SYS_SDRAM_CLK);
+       return ret;
+}
+
+void dram_init_banksize(void)
+{
+       gd->bd->bi_dram[0].start = PHYS_SDRAM_1;
+       gd->bd->bi_dram[0].size = get_ram_size((void *)PHYS_SDRAM_1,
+                       PHYS_SDRAM_1_SIZE);
+#if CONFIG_NR_DRAM_BANKS > 1
+       gd->bd->bi_dram[1].start = PHYS_SDRAM_2;
+       gd->bd->bi_dram[1].size = get_ram_size((void *)PHYS_SDRAM_2,
+                       PHYS_SDRAM_2_SIZE);
+#endif
+}
+
+#ifdef CONFIG_CMD_MMC
+int board_mmc_getcd(struct mmc *mmc)
+{
+       struct fsl_esdhc_cfg *cfg = mmc->priv;
+
+       if (cfg->cd_gpio < 0)
+               return cfg->cd_gpio;
+
+       return !gpio_get_value(cfg->cd_gpio);
+}
+
+static struct fsl_esdhc_cfg esdhc_cfg[] = {
+       {
+               .esdhc_base = (void __iomem *)MMC_SDHC1_BASE_ADDR,
+               .no_snoop = 1,
+               .cd_gpio = IMX_GPIO_NR(3, 8),
+               .wp_gpio = -EINVAL,
+       },
+       {
+               .esdhc_base = (void __iomem *)MMC_SDHC2_BASE_ADDR,
+               .no_snoop = 1,
+               .cd_gpio = IMX_GPIO_NR(3, 6),
+               .wp_gpio = -EINVAL,
+       },
+};
+
+static const iomux_v3_cfg_t mmc0_pads[] = {
+       MX51_PAD_SD1_CMD__SD1_CMD,
+       MX51_PAD_SD1_CLK__SD1_CLK,
+       MX51_PAD_SD1_DATA0__SD1_DATA0,
+       MX51_PAD_SD1_DATA1__SD1_DATA1,
+       MX51_PAD_SD1_DATA2__SD1_DATA2,
+       MX51_PAD_SD1_DATA3__SD1_DATA3,
+       /* SD1 CD */
+       NEW_PAD_CTRL(MX51_PAD_DISPB2_SER_RS__GPIO3_8,
+               PAD_CTL_PUE | PAD_CTL_PKE),
+};
+
+static const iomux_v3_cfg_t mmc1_pads[] = {
+       MX51_PAD_SD2_CMD__SD2_CMD,
+       MX51_PAD_SD2_CLK__SD2_CLK,
+       MX51_PAD_SD2_DATA0__SD2_DATA0,
+       MX51_PAD_SD2_DATA1__SD2_DATA1,
+       MX51_PAD_SD2_DATA2__SD2_DATA2,
+       MX51_PAD_SD2_DATA3__SD2_DATA3,
+       /* SD2 CD */
+       NEW_PAD_CTRL(MX51_PAD_DISPB2_SER_DIO__GPIO3_6,
+               PAD_CTL_PUE | PAD_CTL_PKE),
+};
+
+static struct {
+       const iomux_v3_cfg_t *pads;
+       int count;
+} mmc_pad_config[] = {
+       { mmc0_pads, ARRAY_SIZE(mmc0_pads), },
+       { mmc1_pads, ARRAY_SIZE(mmc1_pads), },
+};
+
+int board_mmc_init(bd_t *bis)
+{
+       int i;
+
+       for (i = 0; i < ARRAY_SIZE(esdhc_cfg); i++) {
+               struct mmc *mmc;
+
+               if (i >= CONFIG_SYS_FSL_ESDHC_NUM)
+                       break;
+
+               mxc_iomux_v3_setup_multiple_pads(mmc_pad_config[i].pads,
+                                               mmc_pad_config[i].count);
+               fsl_esdhc_initialize(bis, &esdhc_cfg[i]);
+
+               mmc = find_mmc_device(i);
+               if (mmc == NULL)
+                       continue;
+               if (board_mmc_getcd(mmc) > 0)
+                       mmc_init(mmc);
+       }
+       return 0;
+}
+#endif /* CONFIG_CMD_MMC */
+
+#ifdef CONFIG_FEC_MXC
+
+#ifndef ETH_ALEN
+#define ETH_ALEN 6
+#endif
+
+void imx_get_mac_from_fuse(int dev_id, unsigned char *mac)
+{
+       int i;
+       struct iim_regs *iim = (struct iim_regs *)IMX_IIM_BASE;
+       struct fuse_bank *bank = &iim->bank[1];
+       struct fuse_bank1_regs *fuse = (struct fuse_bank1_regs *)bank->fuse_regs;
+
+       if (dev_id > 0)
+               return;
+
+       for (i = 0; i < ETH_ALEN; i++)
+               mac[ETH_ALEN - i - 1] = readl(&fuse->mac_addr[i]);
+}
+
+static iomux_v3_cfg_t tx51_fec_pads[] = {
+       /* reconfigure strap pins for FEC function */
+       NEW_PAD_CTRL(MX51_PAD_NANDF_RB3__FEC_RX_CLK, FEC_PAD_CTL2),
+       NEW_PAD_CTRL(MX51_PAD_NANDF_D9__FEC_RDATA0, FEC_PAD_CTL2),
+       NEW_PAD_CTRL(MX51_PAD_EIM_EB3__FEC_RDATA1, FEC_PAD_CTL2),
+       NEW_PAD_CTRL(MX51_PAD_EIM_CS2__FEC_RDATA2, FEC_PAD_CTL2),
+       NEW_PAD_CTRL(MX51_PAD_EIM_CS3__FEC_RDATA3, FEC_PAD_CTL2),
+       NEW_PAD_CTRL(MX51_PAD_NANDF_RB2__FEC_COL, FEC_PAD_CTL2),
+       NEW_PAD_CTRL(MX51_PAD_EIM_CS5__FEC_CRS, FEC_PAD_CTL),
+};
+
+/* take bit 4 of PHY address from configured PHY address or
+ * set it to 0 if PHYADDR is -1 (probe for PHY)
+ */
+#define PHYAD4 ((CONFIG_FEC_MXC_PHYADDR >> 4) & !(CONFIG_FEC_MXC_PHYADDR >> 5))
+
+static struct gpio tx51_fec_gpios[] = {
+       { TX51_FEC_PWR_GPIO, GPIOF_OUTPUT_INIT_HIGH, "FEC PHY POWER", },
+       { IMX_GPIO_NR(3, 31), GPIOF_OUTPUT_INIT_HIGH, "FEC PHY Mode0", },       /* RXD0/Mode0 */
+       { IMX_GPIO_NR(2, 23), GPIOF_OUTPUT_INIT_HIGH, "FEC PHY Mode1", },       /* RXD1/Mode1 */
+       { IMX_GPIO_NR(2, 27), GPIOF_OUTPUT_INIT_HIGH, "FEC PHY Mode2", },       /* RXD2/Mode2 */
+       { IMX_GPIO_NR(2, 28), GPIOF_OUTPUT_INIT_HIGH, "FEC PHY nINTSEL", },     /* RXD3/nINTSEL */
+#if PHYAD4
+       { IMX_GPIO_NR(2, 30), GPIOF_OUTPUT_INIT_HIGH, "FEC PHY PHYAD4", }, /* CRS/PHYAD4 */
+#else
+       { IMX_GPIO_NR(2, 30), GPIOF_OUTPUT_INIT_LOW, "FEC PHY PHYAD4", }, /* CRS/PHYAD4 */
+#endif
+};
+
+int board_eth_init(bd_t *bis)
+{
+       int ret;
+       unsigned char mac[ETH_ALEN];
+       char mac_str[ETH_ALEN * 3] = "";
+
+       /* Power up the external phy and assert strap options */
+       gpio_request_array(tx51_fec_gpios, ARRAY_SIZE(tx51_fec_gpios));
+
+       /* delay at least 21ms for the PHY internal POR signal to deassert */
+       udelay(22000);
+
+       /* Deassert RESET to the external phy */
+       gpio_set_value(TX51_FEC_RST_GPIO, 1);
+
+       /* Without this delay the PHY won't work, though nothing in
+        * the datasheets suggests that it should be necessary!
+        */
+       udelay(400);
+       mxc_iomux_v3_setup_multiple_pads(tx51_fec_pads,
+                                       ARRAY_SIZE(tx51_fec_pads));
+
+       ret = cpu_eth_init(bis);
+       if (ret) {
+               printf("cpu_eth_init() failed: %d\n", ret);
+               return ret;
+       }
+
+       imx_get_mac_from_fuse(0, mac);
+       snprintf(mac_str, sizeof(mac_str), "%02x:%02x:%02x:%02x:%02x:%02x",
+               mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
+       setenv("ethaddr", mac_str);
+
+       return ret;
+}
+#endif /* CONFIG_FEC_MXC */
+
+enum {
+       LED_STATE_INIT = -1,
+       LED_STATE_OFF,
+       LED_STATE_ON,
+};
+
+void show_activity(int arg)
+{
+       static int led_state = LED_STATE_INIT;
+       static ulong last;
+
+       if (led_state == LED_STATE_INIT) {
+               last = get_timer(0);
+               gpio_set_value(TX51_LED_GPIO, 1);
+               led_state = LED_STATE_ON;
+       } else {
+               if (get_timer(last) > CONFIG_SYS_HZ) {
+                       last = get_timer(0);
+                       if (led_state == LED_STATE_ON) {
+                               gpio_set_value(TX51_LED_GPIO, 0);
+                       } else {
+                               gpio_set_value(TX51_LED_GPIO, 1);
+                       }
+                       led_state = 1 - led_state;
+               }
+       }
+}
+
+static const iomux_v3_cfg_t stk5_pads[] = {
+       /* SW controlled LED on STK5 baseboard */
+       MX51_PAD_CSI2_D13__GPIO4_10,
+
+       /* USB PHY reset */
+       MX51_PAD_GPIO1_4__GPIO1_4,
+       /* USBOTG OC */
+       MX51_PAD_GPIO1_6__GPIO1_6,
+       /* USB PHY clock enable */
+       MX51_PAD_GPIO1_7__GPIO1_7,
+       /* USBH1 VBUS enable */
+       MX51_PAD_GPIO1_8__GPIO1_8,
+       /* USBH1 OC */
+       MX51_PAD_GPIO1_9__GPIO1_9,
+};
+
+static const struct gpio stk5_gpios[] = {
+       { TX51_LED_GPIO, GPIOF_OUTPUT_INIT_LOW, "HEARTBEAT LED", },
+
+       { IMX_GPIO_NR(1, 4), GPIOF_OUTPUT_INIT_LOW, "ULPI PHY clk enable", },
+       { IMX_GPIO_NR(1, 6), GPIOF_INPUT, "USBOTG OC", },
+       { IMX_GPIO_NR(1, 7), GPIOF_OUTPUT_INIT_LOW, "ULPI PHY reset", },
+       { IMX_GPIO_NR(1, 8), GPIOF_OUTPUT_INIT_LOW, "USBH1 VBUS enable", },
+       { IMX_GPIO_NR(1, 9), GPIOF_INPUT, "USBH1 OC", },
+};
+
+#ifdef CONFIG_LCD
+vidinfo_t panel_info = {
+       /* set to max. size supported by SoC */
+       .vl_col = 1600,
+       .vl_row = 1200,
+
+       .vl_bpix = LCD_COLOR24,    /* Bits per pixel, 0: 1bpp, 1: 2bpp, 2: 4bpp, 3: 8bpp ... */
+};
+
+static struct fb_videomode tx51_fb_mode = {
+       /* Standard VGA timing */
+       .name           = "VGA",
+       .refresh        = 60,
+       .xres           = 640,
+       .yres           = 480,
+       .pixclock       = KHZ2PICOS(25175),
+       .left_margin    = 48,
+       .hsync_len      = 96,
+       .right_margin   = 16,
+       .upper_margin   = 31,
+       .vsync_len      = 2,
+       .lower_margin   = 12,
+       .sync           = FB_SYNC_CLK_LAT_FALL,
+       .vmode          = FB_VMODE_NONINTERLACED,
+};
+
+void *lcd_base;                        /* Start of framebuffer memory  */
+void *lcd_console_address;     /* Start of console buffer      */
+
+int lcd_line_length;
+int lcd_color_fg;
+int lcd_color_bg;
+
+short console_col;
+short console_row;
+
+void lcd_initcolregs(void)
+{
+}
+
+void lcd_setcolreg(ushort regno, ushort red, ushort green, ushort blue)
+{
+}
+
+static int lcd_enabled = 1;
+
+void lcd_enable(void)
+{
+       /* HACK ALERT:
+        * global variable from common/lcd.c
+        * Set to 0 here to prevent messages from going to LCD
+        * rather than serial console
+        */
+       lcd_is_enabled = 0;
+
+       karo_load_splashimage(1);
+       if (lcd_enabled) {
+               debug("Switching LCD on\n");
+               gpio_set_value(TX51_LCD_PWR_GPIO, 1);
+               udelay(100);
+               gpio_set_value(TX51_LCD_RST_GPIO, 1);
+               udelay(300000);
+               gpio_set_value(TX51_LCD_BACKLIGHT_GPIO, 0);
+       }
+}
+
+void mxcfb_disable(void);
+
+void lcd_disable(void)
+{
+       mxcfb_disable();
+}
+
+void lcd_panel_disable(void)
+{
+       if (lcd_enabled) {
+               debug("Switching LCD off\n");
+               gpio_set_value(TX51_LCD_BACKLIGHT_GPIO, 1);
+               gpio_set_value(TX51_LCD_RST_GPIO, 0);
+               gpio_set_value(TX51_LCD_PWR_GPIO, 0);
+       }
+}
+
+static const iomux_v3_cfg_t stk5_lcd_pads[] = {
+       /* LCD RESET */
+       MX51_PAD_CSI2_VSYNC__GPIO4_13,
+       /* LCD POWER_ENABLE */
+       MX51_PAD_CSI2_HSYNC__GPIO4_14,
+       /* LCD Backlight (PWM) */
+       MX51_PAD_GPIO1_2__GPIO1_2,
+
+       /* Display */
+       MX51_PAD_DISP1_DAT0__DISP1_DAT0,
+       MX51_PAD_DISP1_DAT1__DISP1_DAT1,
+       MX51_PAD_DISP1_DAT2__DISP1_DAT2,
+       MX51_PAD_DISP1_DAT3__DISP1_DAT3,
+       MX51_PAD_DISP1_DAT4__DISP1_DAT4,
+       MX51_PAD_DISP1_DAT5__DISP1_DAT5,
+       MX51_PAD_DISP1_DAT6__DISP1_DAT6,
+       MX51_PAD_DISP1_DAT7__DISP1_DAT7,
+       MX51_PAD_DISP1_DAT8__DISP1_DAT8,
+       MX51_PAD_DISP1_DAT9__DISP1_DAT9,
+       MX51_PAD_DISP1_DAT10__DISP1_DAT10,
+       MX51_PAD_DISP1_DAT11__DISP1_DAT11,
+       MX51_PAD_DISP1_DAT12__DISP1_DAT12,
+       MX51_PAD_DISP1_DAT13__DISP1_DAT13,
+       MX51_PAD_DISP1_DAT14__DISP1_DAT14,
+       MX51_PAD_DISP1_DAT15__DISP1_DAT15,
+       MX51_PAD_DISP1_DAT16__DISP1_DAT16,
+       MX51_PAD_DISP1_DAT17__DISP1_DAT17,
+       MX51_PAD_DISP1_DAT18__DISP1_DAT18,
+       MX51_PAD_DISP1_DAT19__DISP1_DAT19,
+       MX51_PAD_DISP1_DAT20__DISP1_DAT20,
+       MX51_PAD_DISP1_DAT21__DISP1_DAT21,
+       MX51_PAD_DISP1_DAT22__DISP1_DAT22,
+       MX51_PAD_DISP1_DAT23__DISP1_DAT23,
+       MX51_PAD_DI1_PIN2__DI1_PIN2, /* HSYNC */
+       MX51_PAD_DI1_PIN3__DI1_PIN3, /* VSYNC */
+};
+
+static const struct gpio stk5_lcd_gpios[] = {
+       { TX51_LCD_RST_GPIO, GPIOF_OUTPUT_INIT_LOW, "LCD RESET", },
+       { TX51_LCD_PWR_GPIO, GPIOF_OUTPUT_INIT_LOW, "LCD POWER", },
+       { TX51_LCD_BACKLIGHT_GPIO, GPIOF_OUTPUT_INIT_HIGH, "LCD BACKLIGHT", },
+};
+
+void lcd_ctrl_init(void *lcdbase)
+{
+       int color_depth = 24;
+       char *vm;
+       unsigned long val;
+       int refresh = 60;
+       struct fb_videomode *p = &tx51_fb_mode;
+       int xres_set = 0, yres_set = 0, bpp_set = 0, refresh_set = 0;
+       int pix_fmt = 0;
+
+       if (!lcd_enabled) {
+               debug("LCD disabled\n");
+               return;
+       }
+
+       if (tstc() || (wrsr & WRSR_TOUT)) {
+               debug("Disabling LCD\n");
+               lcd_enabled = 0;
+               return;
+       }
+
+       vm = getenv("video_mode");
+       if (vm == NULL) {
+               debug("Disabling LCD\n");
+               lcd_enabled = 0;
+               return;
+       }
+       while (*vm != '\0') {
+               if (*vm >= '0' && *vm <= '9') {
+                       char *end;
+
+                       val = simple_strtoul(vm, &end, 0);
+                       if (end > vm) {
+                               if (!xres_set) {
+                                       if (val > panel_info.vl_col)
+                                               val = panel_info.vl_col;
+                                       p->xres = val;
+                                       panel_info.vl_col = val;
+                                       xres_set = 1;
+                               } else if (!yres_set) {
+                                       if (val > panel_info.vl_row)
+                                               val = panel_info.vl_row;
+                                       p->yres = val;
+                                       panel_info.vl_row = val;
+                                       yres_set = 1;
+                               } else if (!bpp_set) {
+                                       switch (val) {
+                                       case 8:
+                                       case 16:
+                                       case 24:
+                                               color_depth = val;
+                                               break;
+
+                                       default:
+                                               printf("Invalid color depth: '%.*s' in video_mode; using default: '%u'\n",
+                                                       end - vm, vm, color_depth);
+                                       }
+                                       bpp_set = 1;
+                               } else if (!refresh_set) {
+                                       refresh = val;
+                                       refresh_set = 1;
+                               }
+                       }
+                       vm = end;
+               }
+               switch (*vm) {
+               case '@':
+                       bpp_set = 1;
+                       /* fallthru */
+               case '-':
+                       yres_set = 1;
+                       /* fallthru */
+               case 'x':
+                       xres_set = 1;
+                       /* fallthru */
+               case 'M':
+               case 'R':
+                       vm++;
+                       break;
+
+               default:
+                       if (!pix_fmt) {
+                               char *tmp;
+
+                               pix_fmt = IPU_PIX_FMT_RGB24;
+                               tmp = strchr(vm, ':');
+                               if (tmp)
+                                       vm = tmp;
+                       }
+                       if (*vm != '\0')
+                               vm++;
+               }
+       }
+       switch (color_depth) {
+       case 8:
+               panel_info.vl_bpix = 3;
+               break;
+
+       case 16:
+               panel_info.vl_bpix = 4;
+               break;
+
+       case 24:
+               panel_info.vl_bpix = 5;
+       }
+       lcd_line_length = NBITS(panel_info.vl_bpix) / 8 * panel_info.vl_col;
+
+       p->pixclock = KHZ2PICOS(refresh *
+               (p->xres + p->left_margin + p->right_margin + p->hsync_len) *
+               (p->yres + p->upper_margin + p->lower_margin + p->vsync_len)
+               / 1000);
+       debug("Pixel clock set to %lu.%03lu MHz\n",
+               PICOS2KHZ(p->pixclock) / 1000,
+               PICOS2KHZ(p->pixclock) % 1000);
+
+       gpio_request_array(stk5_lcd_gpios, ARRAY_SIZE(stk5_lcd_gpios));
+       mxc_iomux_v3_setup_multiple_pads(stk5_lcd_pads,
+                                       ARRAY_SIZE(stk5_lcd_pads));
+
+       debug("Initializing FB driver\n");
+       if (!pix_fmt)
+               pix_fmt = IPU_PIX_FMT_RGB24;
+
+       if (karo_load_splashimage(0) == 0) {
+               struct mxc_ccm_reg *ccm_regs = (struct mxc_ccm_reg *)MXC_CCM_BASE;
+               u32 ccgr4 = readl(&ccm_regs->CCGR4);
+
+               debug("Initializing LCD controller\n");
+               mx5_fb_init(p, 0, pix_fmt, 1 << panel_info.vl_bpix);
+
+               /* MIPI HSC clock is required for initialization */
+               writel(ccgr4 | (3 << 12), &ccm_regs->CCGR4);
+               video_hw_init();
+               writel(ccgr4 & ~(3 << 12), &ccm_regs->CCGR4);
+       } else {
+               debug("Skipping initialization of LCD controller\n");
+       }
+}
+#else
+#define lcd_enabled 0
+#endif /* CONFIG_LCD */
+
+static void stk5_board_init(void)
+{
+       gpio_request_array(stk5_gpios, ARRAY_SIZE(stk5_gpios));
+       mxc_iomux_v3_setup_multiple_pads(stk5_pads, ARRAY_SIZE(stk5_pads));
+}
+
+static void stk5v3_board_init(void)
+{
+       stk5_board_init();
+}
+
+static void tx51_set_cpu_clock(void)
+{
+       unsigned long cpu_clk = getenv_ulong("cpu_clk", 10, 0);
+       int ret;
+
+       if (tstc() || (wrsr & WRSR_TOUT))
+               return;
+
+       if (cpu_clk == 0 || cpu_clk == mxc_get_clock(MXC_ARM_CLK) / 1000000)
+               return;
+
+       ret = mxc_set_clock(CONFIG_SYS_MX5_HCLK, cpu_clk, MXC_ARM_CLK);
+       if (ret != 0) {
+               printf("Error: Failed to set CPU clock to %lu MHz\n", cpu_clk);
+               return;
+       }
+       printf("CPU clock set to %u.%03u MHz\n",
+               mxc_get_clock(MXC_ARM_CLK) / 1000000,
+               mxc_get_clock(MXC_ARM_CLK) / 1000 % 1000);
+}
+
+int board_late_init(void)
+{
+       int ret = 0;
+       const char *baseboard;
+
+       tx51_set_cpu_clock();
+       karo_fdt_move_fdt();
+
+       baseboard = getenv("baseboard");
+       if (!baseboard)
+               goto exit;
+
+       if (strncmp(baseboard, "stk5", 4) == 0) {
+               printf("Baseboard: %s\n", baseboard);
+               if ((strlen(baseboard) == 4) ||
+                       strcmp(baseboard, "stk5-v3") == 0) {
+                       stk5v3_board_init();
+               } else if (strcmp(baseboard, "stk5-v5") == 0) {
+                       printf("ERROR: Baseboard '%s' incompatible with TX51 module!\n",
+                               baseboard);
+                       stk5v3_board_init();
+               } else {
+                       printf("WARNING: Unsupported STK5 board rev.: %s\n",
+                               baseboard + 4);
+               }
+       } else {
+               printf("WARNING: Unsupported baseboard: '%s'\n",
+                       baseboard);
+               ret = -EINVAL;
+       }
+
+exit:
+       gpio_set_value(TX51_RESET_OUT_GPIO, 1);
+       return ret;
+}
+
+int checkboard(void)
+{
+       print_cpuinfo();
+
+       printf("Board: Ka-Ro TX51-%sxx%s\n",
+               TX51_MOD_PREFIX, TX51_MOD_SUFFIX);
+
+       return 0;
+}
+
+#if defined(CONFIG_OF_BOARD_SETUP)
+#ifdef CONFIG_FDT_FIXUP_PARTITIONS
+#include <jffs2/jffs2.h>
+#include <mtd_node.h>
+struct node_info nodes[] = {
+       { "fsl,imx51-nand", MTD_DEV_TYPE_NAND, },
+};
+
+#else
+#define fdt_fixup_mtdparts(b,n,c) do { } while (0)
+#endif
+
+void ft_board_setup(void *blob, bd_t *bd)
+{
+       fdt_fixup_mtdparts(blob, nodes, ARRAY_SIZE(nodes));
+       fdt_fixup_ethernet(blob);
+
+       karo_fdt_fixup_touchpanel(blob);
+       karo_fdt_fixup_usb_otg(blob);
+}
+#endif
diff --git a/board/karo/tx51/u-boot.lds b/board/karo/tx51/u-boot.lds
new file mode 100644 (file)
index 0000000..9180f86
--- /dev/null
@@ -0,0 +1,82 @@
+/*
+ * (C) Copyright 2012  Lothar Waßmann <LW@KARO-electronics.de>
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm")
+OUTPUT_ARCH(arm)
+ENTRY(_start)
+SECTIONS
+{
+        . = 0x00000000;
+
+        . = ALIGN(4);
+        .text :
+        {
+               board/karo/tx51/lowlevel_init.o (.text)
+                __image_copy_start = .;
+                CPUDIR/start.o (.text)
+                *(.text)
+        }
+
+        . = ALIGN(4);
+        .rodata : { *(SORT_BY_ALIGNMENT(SORT_BY_NAME(.rodata*))) }
+
+        . = ALIGN(4);
+        .data : {
+                *(.data)
+        }
+
+        . = ALIGN(4);
+
+        . = .;
+        __u_boot_cmd_start = .;
+        .u_boot_cmd : { *(.u_boot_cmd) }
+        __u_boot_cmd_end = .;
+
+        . = ALIGN(4);
+
+        __image_copy_end = .;
+
+        .rel.dyn : {
+                __rel_dyn_start = .;
+                *(.rel*)
+                __rel_dyn_end = .;
+        }
+
+        .dynsym : {
+                __dynsym_start = .;
+                *(.dynsym)
+        }
+
+        _end = .;
+
+        .bss __rel_dyn_start (OVERLAY) : {
+                __bss_start = .;
+                *(.bss)
+                 . = ALIGN(4);
+                __bss_end__ = .;
+        }
+
+        /DISCARD/ : { *(.dynstr*) }
+        /DISCARD/ : { *(.dynamic*) }
+        /DISCARD/ : { *(.plt*) }
+        /DISCARD/ : { *(.interp*) }
+        /DISCARD/ : { *(.gnu*) }
+}
diff --git a/board/karo/tx53/Makefile b/board/karo/tx53/Makefile
new file mode 100644 (file)
index 0000000..3c10666
--- /dev/null
@@ -0,0 +1,39 @@
+#
+# (C) Copyright 2012 Lothar Waßmann <LW@KARO-electronics.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
+# version 2 as published by the Free Software Foundation.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+
+include $(TOPDIR)/config.mk
+
+LDSCRIPT := $(BOARDDIR)/u-boot.lds
+
+LIB    = $(obj)lib$(BOARD).o
+
+COBJS  := tx53.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))
+
+#########################################################################
+
+include $(SRCTREE)/rules.mk
+
+sinclude $(obj).depend
+
+#########################################################################
diff --git a/board/karo/tx53/config.mk b/board/karo/tx53/config.mk
new file mode 100644 (file)
index 0000000..e765c3a
--- /dev/null
@@ -0,0 +1,5 @@
+# stack is allocated below CONFIG_SYS_TEXT_BASE
+CONFIG_SYS_TEXT_BASE := 0x70100000
+
+PLATFORM_CPPFLAGS += -Werror
+LOGO_BMP = logos/karo.bmp
diff --git a/board/karo/tx53/lowlevel_init.S b/board/karo/tx53/lowlevel_init.S
new file mode 100644 (file)
index 0000000..f3a3cc9
--- /dev/null
@@ -0,0 +1,478 @@
+#include <config.h>
+#include <configs/tx53.h>
+#include <asm/arch/imx-regs.h>
+
+#define DEBUG_LED_BIT          20
+#define LED_GPIO_BASE          GPIO2_BASE_ADDR
+#define LED_MUX_OFFSET         0x174
+#define LED_MUX_MODE           0x11
+
+#define SDRAM_CLK              CONFIG_SYS_SDRAM_CLK
+
+#ifdef PHYS_SDRAM_2_SIZE
+#define SDRAM_SIZE             (PHYS_SDRAM_1_SIZE + PHYS_SDRAM_2_SIZE)
+#else
+#define SDRAM_SIZE             PHYS_SDRAM_1_SIZE
+#endif
+
+#define REG_ESDCTL0            0x00
+#define REG_ESDCFG0            0x04
+#define REG_ESDCTL1            0x08
+#define REG_ESDCFG1            0x0c
+#define REG_ESDMISC            0x10
+#define REG_ESDSCR             0x14
+#define REG_ESDGPR             0x34
+
+#define REG_CCGR0              0x68
+#define REG_CCGR1              0x6c
+#define REG_CCGR2              0x70
+#define REG_CCGR3              0x74
+#define REG_CCGR4              0x78
+#define REG_CCGR5              0x7c
+#define REG_CCGR6              0x80
+#define REG_CCGR7              0x84
+#define REG_CMEOR              0x88
+
+#define CPU_2_BE_32(l)                 \
+       ((((l) << 24) & 0xFF000000) |   \
+       (((l) << 8) & 0x00FF0000) |     \
+       (((l) >> 8) & 0x0000FF00) |     \
+       (((l) >> 24) & 0x000000FF))
+
+#define MXC_DCD_ITEM(addr, val)                \
+       .word   CPU_2_BE_32(addr), CPU_2_BE_32(val)
+
+#define MXC_DCD_CMD_SZ_BYTE            1
+#define MXC_DCD_CMD_SZ_SHORT           2
+#define MXC_DCD_CMD_SZ_WORD            4
+#define MXC_DCD_CMD_FLAG_WRITE         0x0
+#define MXC_DCD_CMD_FLAG_CLR           0x1
+#define MXC_DCD_CMD_FLAG_SET           0x3
+#define MXC_DCD_CMD_FLAG_CHK_ANY       (1 << 0)
+#define MXC_DCD_CMD_FLAG_CHK_SET       (1 << 1)
+#define MXC_DCD_CMD_FLAG_CHK_CLR       (0 << 1)
+
+#define MXC_DCD_CMD_WRT(type, flags, next)                                     \
+       .word   CPU_2_BE_32((0xcc << 24) | (((next) - .) << 8) | ((flags) << 3) | (type))
+
+#define MXC_DCD_CMD_CHK(type, flags, addr, mask)                               \
+       .word   CPU_2_BE_32((0xcf << 24) | (12 << 8) | ((flags) << 3) | (type)),\
+               CPU_2_BE_32(addr), CPU_2_BE_32(mask)
+
+#define MXC_DCD_CMD_CHK_CNT(type, flags, addr, mask, count)                    \
+       .word   CPU_2_BE_32((0xcf << 24) | (16 << 8) | ((flags) << 3) | (type)),\
+               CPU_2_BE_32(addr), CPU_2_BE_32(mask), CPU_2_BE_32(count)
+
+#define MXC_DCD_CMD_NOP()                                                      \
+       .word   CPU_2_BE_32((0xc0 << 24) | (4 << 8))
+
+#define CK_TO_NS(ck)   (((ck) * 1000 + SDRAM_CLK / 2) / SDRAM_CLK)
+#define NS_TO_CK(ns)   (((ns) * SDRAM_CLK + 999) / 1000)
+
+       .macro          CK_VAL, name, clks, offs, max
+       .iflt           \clks - \offs
+       .set            \name, 0
+       .else
+       .ifle           \clks - \offs - \max
+       .set            \name, \clks - \offs
+       .endif
+       .endif
+       .endm
+
+       .macro          NS_VAL, name, ns, offs, max
+       .iflt           \ns - \offs
+       .set            \name, 0
+       .else
+       CK_VAL          \name, NS_TO_CK(\ns), \offs, \max
+       .endif
+       .endm
+
+       .macro          CK_MAX, name, ck1, ck2, offs, max
+       .ifgt           \ck1 - \ck2
+       CK_VAL          \name, \ck1, \offs, \max
+       .else
+       CK_VAL          \name, \ck2, \offs, \max
+       .endif
+       .endm
+
+#define ESDMISC_DDR_TYPE_DDR3          0
+#define ESDMISC_DDR_TYPE_LPDDR2                1
+#define ESDMISC_DDR_TYPE_DDR2          2
+
+#define DIV_ROUND_UP(m,d)              (((m) + (d) - 1) / (d))
+
+#define CKIL_FREQ_Hz                   32768
+#define ESDOR_CLK_PERIOD_ns            (1000000000 / CKIL_FREQ_Hz / 2) /* base clock for ESDOR values */
+
+/* DDR3 SDRAM */
+#if SDRAM_SIZE > RAM_BANK0_SIZE
+#define BANK_ADDR_BITS                 2
+#else
+#define BANK_ADDR_BITS                 1
+#endif
+#define SDRAM_BURST_LENGTH             8
+#define RALAT                          5
+#define WALAT                          1
+#define ADDR_MIRROR                    0
+#define DDR_TYPE                       ESDMISC_DDR_TYPE_DDR3
+
+/* 512/1024MiB SDRAM: NT5CB128M16P-CG */
+/* ESDCFG0 0x0c */
+NS_VAL tRFC,   160, 1, 255             /* clks - 1 (0..255) */
+CK_MAX tXS,    tRFC + 1 + NS_TO_CK(10), 5, 1, 255 /* clks - 1 (0..255) tRFC + 10 */
+CK_MAX tXP,    3, NS_TO_CK(6), 1, 7    /* clks - 1 (0..7) */ /* max(6ns, 3*CK) */
+CK_MAX tXPDLL, NS_TO_CK(24), 2, 1, 15  /* clks - 1 (0..15) */
+NS_VAL tFAW,   45, 1, 31               /* clks - 1 (0..31) */
+CK_VAL tCL,    9, 3, 8                 /* clks - 3 (0..8) CAS Latency */
+
+/* ESDCFG1 0x10 */
+NS_VAL tRCD,   14, 1, 7                /* clks - 1 (0..7) */
+NS_VAL tRP,    14, 1, 7                /* clks - 1 (0..7) */
+NS_VAL tRC,    50, 1, 31               /* clks - 1 (0..31) */
+NS_VAL tRAS,   36, 1, 31               /* clks - 1 (0..31) */
+CK_VAL tRPA,   0, 0, 1                 /* clks     (0..1) */
+NS_VAL tWR,    15, 1, 15               /* clks - 1 (0..15) */
+CK_VAL tMRD,   4, 1, 15                /* clks - 1 (0..15) */
+CK_VAL tCWL,   5, 2, 6                 /* clks - 2 (0..6) */
+
+/* ESDCFG2 0x14 */
+CK_VAL tDLLK,  512, 1, 511             /* clks - 1 (0..511) */
+CK_MAX tRTP,   4, NS_TO_CK(8), 1, 7    /* clks - 1 (0..7) */
+CK_MAX tWTR,   4, NS_TO_CK(8), 1, 7    /* clks - 1 (0..7) */
+CK_MAX tRRD,   4, NS_TO_CK(8), 1, 7    /* clks - 1 (0..7) */
+
+/* ESDOR 0x30 */
+CK_MAX tXPR,   NS_TO_CK(CK_TO_NS(tRFC + 1) + 10), 5, 1, 255 /* clks - 1 (0..255) max(tRFC + 10, 5CK) */
+
+/* ESDOTC 0x08 */
+NS_VAL tAOFPD, 9, 1, 7                 /* clks - 1 (0..7) */
+NS_VAL tAONPD, 9, 1, 7                 /* clks - 1 (0..7) */
+CK_VAL tANPD,  tCWL, 1, 15             /* clks - 1 (0..15) */
+CK_VAL tAXPD,  tCWL, 1, 15             /* clks - 1 (0..15) */
+CK_VAL tODTLon tCWL - 1, 1, 7          /* clks - 1 (0..7) */
+CK_VAL tODTLoff tCWL - 1, 1, 31        /* clks - 1 (0..31) */
+
+#define tSDE_RST                       (DIV_ROUND_UP(200000, ESDOR_CLK_PERIOD_ns) + 1)
+
+                                       /* Add an extra (or two?) ESDOR_CLK_PERIOD_ns according to
+                                        * erroneous Erratum Engcm12377
+                                        */
+#define tRST_CKE                       (DIV_ROUND_UP(500000 + 2 * ESDOR_CLK_PERIOD_ns, ESDOR_CLK_PERIOD_ns) + 1)
+
+#define ROW_ADDR_BITS                  14
+#define COL_ADDR_BITS                  10
+
+       .iflt   tWR - 7
+       .set    mrs_val, (0x8080 | \
+                       (3 << 4) /* MRS command */ | \
+                       ((1 << 8) /* DLL Reset */ | \
+                       ((tWR + 1 - 4) << 9) | \
+                       (((tCL + 3) - 4) << 4)) << 16)
+       .else
+       .set    mrs_val, (0x8080 | \
+                       (3 << 4) /* MRS command */ | \
+                       ((1 << 8) /* DLL Reset */ | \
+                       (((tWR + 1) / 2) << 9) | \
+                       (((tCL + 3) - 4) << 4)) << 16)
+       .endif
+#define ESDSCR_MRS_VAL(cs)     (mrs_val | ((cs) << 3))
+
+#define ESDCFG0_VAL    (               \
+       (tRFC << 24) |                  \
+       (tXS << 16) |                   \
+       (tXP << 13) |                   \
+       (tXPDLL << 9) |                 \
+       (tFAW << 4) |                   \
+       (tCL << 0))                     \
+
+#define ESDCFG1_VAL    (               \
+       (tRCD << 29) |                  \
+       (tRP << 26) |                   \
+       (tRC << 21) |                   \
+       (tRAS << 16) |                  \
+       (tRPA << 15) |                  \
+       (tWR << 9) |                    \
+       (tMRD << 5) |                   \
+       (tCWL << 0))                    \
+
+#define ESDCFG2_VAL    (               \
+       (tDLLK << 16) |                 \
+       (tRTP << 6) |                   \
+       (tWTR << 3) |                   \
+       (tRRD << 0))
+
+#define BURST_LEN                      (SDRAM_BURST_LENGTH / 8) /* 0: 4 byte 1: 8 byte */
+#define ESDCTL_VAL                     (((ROW_ADDR_BITS - 11) << 24) | \
+                                       ((COL_ADDR_BITS - 9) << 20) | \
+                                       (BURST_LEN << 19) | \
+                                       (1 << 16) | /* SDRAM bus width */ \
+                                       ((-1) << (32 - BANK_ADDR_BITS)))
+
+#define ESDMISC_VAL                    ((1 << 12) | \
+                                       (0x3 << 9) | \
+                                       (RALAT << 6) | \
+                                       (WALAT << 16) | \
+                                       (ADDR_MIRROR << 19) | \
+                                       (DDR_TYPE << 3))
+
+#define ESDOR_VAL              ((tXPR << 16) | (tSDE_RST << 8) | (tRST_CKE << 0))
+
+#define ESDOTC_VAL             ((tAOFPD << 27) |       \
+                               (tAONPD << 24) |        \
+                               (tANPD << 20) |         \
+                               (tAXPD << 16) |         \
+                               (tODTLon << 12) |       \
+                               (tODTLoff << 4))
+
+fcb_start:
+       b       _start
+       .word   0x20424346      /* "FCB " marker */
+       .word   0x01    /* FCB version number */
+       .org    0x68
+       .word   0x0     /* primary image starting page number */
+       .word   0x0     /* secondary image starting page number */
+       .word   0x6b
+       .word   0x6b
+       .word   0x0     /* DBBT start page (0 == NO DBBT) */
+       .word   0       /* Bad block marker offset in main area (unused) */
+       .org    0xac
+       .word   0       /* BI Swap disabled */
+       .word   0       /* Bad Block marker offset in spare area */
+fcb_end:
+
+       .org    0x400
+ivt_header:
+       .word   CPU_2_BE_32((0xd1 << 24) | (32 << 8) | 0x40)
+app_start_addr:
+       .long   _start
+       .long   0x0
+dcd_ptr:
+       .long   dcd_hdr
+boot_data_ptr:
+       .word   boot_data
+self_ptr:
+       .word   ivt_header
+app_code_csf:
+       .word   0x0
+       .word   0x0
+boot_data:
+       .long   fcb_start
+image_len:
+       .long   CONFIG_U_BOOT_IMG_SIZE
+plugin:
+       .word   0
+ivt_end:
+#define DCD_VERSION    0x40
+
+dcd_hdr:
+       .word   CPU_2_BE_32((0xd2 << 24) | ((dcd_end - .) << 8) | DCD_VERSION)
+dcd_start:
+       MXC_DCD_CMD_WRT(MXC_DCD_CMD_SZ_WORD, MXC_DCD_CMD_FLAG_WRITE, zq_calib)
+       /* disable all irrelevant clocks */
+       MXC_DCD_ITEM(CCM_BASE_ADDR + REG_CCGR0, 0xffcf0fff)
+       MXC_DCD_ITEM(CCM_BASE_ADDR + REG_CCGR1, 0x000fffc3)
+       MXC_DCD_ITEM(CCM_BASE_ADDR + REG_CCGR2, 0x033c0000)
+       MXC_DCD_ITEM(CCM_BASE_ADDR + REG_CCGR3, 0x000000ff)
+       MXC_DCD_ITEM(CCM_BASE_ADDR + REG_CCGR4, 0x00000000)
+       MXC_DCD_ITEM(CCM_BASE_ADDR + REG_CCGR5, 0x00fff033)
+       MXC_DCD_ITEM(CCM_BASE_ADDR + REG_CCGR6, 0x0f00030f)
+       MXC_DCD_ITEM(CCM_BASE_ADDR + REG_CCGR7, 0xfff00000)
+       MXC_DCD_ITEM(CCM_BASE_ADDR + REG_CMEOR, 0x00000000)
+
+       MXC_DCD_ITEM(IOMUXC_BASE_ADDR + 0x340, 0x11)    /* GPIO_17 => RESET_OUT */
+
+       MXC_DCD_ITEM(0x63fd800c, 0x00000000)    /* M4IF: MUX NFC signals on WEIM */
+#if SDRAM_CLK > 333
+       MXC_DCD_ITEM(0x53fd4014, 0x00888944)    /* CBCDR */
+#else
+       MXC_DCD_ITEM(0x53fd4014, 0x00888644)    /* CBCDR */
+#endif
+       MXC_DCD_ITEM(0x53fd4018, 0x00016154)    /* CBCMR */
+
+       MXC_DCD_ITEM(0x53fd401c, 0xa6a2a020)    /* CSCMR1 */
+       MXC_DCD_ITEM(0x53fd4020, 0xb6b12f0a)    /* CSCMR2 */
+       MXC_DCD_ITEM(0x53fd4024, 0x00080b18)    /* CSCDR1 */
+
+#define DDR_SEL_VAL    2
+#define DSE_VAL                5
+#define ODT_VAL                2
+
+#define DDR_SEL_SHIFT  25
+#define ODT_SHIFT      22
+#define DSE_SHIFT      19
+#define DDR_INPUT_SHIFT        9
+#define HYS_SHIFT      8
+#define PKE_SHIFT      7
+#define PUE_SHIFT      6
+#define PUS_SHIFT      4
+
+#define DDR_SEL_MASK   (DDR_SEL_VAL << DDR_SEL_SHIFT)
+#define DSE_MASK       (DSE_VAL << DSE_SHIFT)
+#define ODT_MASK       (ODT_VAL << ODT_SHIFT)
+
+#define DQM_VAL                DSE_MASK
+#define SDQS_VAL       (ODT_MASK | DSE_MASK | (1 << PUE_SHIFT))
+#define SDODT_VAL      (DSE_MASK | (0 << PKE_SHIFT) | (1 << PUE_SHIFT) | (0 << PUS_SHIFT))
+#define SDCLK_VAL      DSE_MASK
+#define SDCKE_VAL      ((1 << PKE_SHIFT) | (1 << PUE_SHIFT) | (0 << PUS_SHIFT))
+
+       MXC_DCD_ITEM(0x53fa8724, DDR_SEL_MASK) /* DDR_TYPE: DDR3 */
+       MXC_DCD_ITEM(0x53fa86f4, 0 << DDR_INPUT_SHIFT) /* DDRMODE_CTL */
+       MXC_DCD_ITEM(0x53fa8714, 0 << DDR_INPUT_SHIFT) /* GRP_DDRMODE */
+       MXC_DCD_ITEM(0x53fa86fc, 1 << PKE_SHIFT) /* GRP_DDRPKE */
+       MXC_DCD_ITEM(0x53fa8710, 0 << HYS_SHIFT) /* GRP_DDRHYS */
+       MXC_DCD_ITEM(0x53fa8708, 1 << PUE_SHIFT) /* GRP_DDRPK */
+
+       MXC_DCD_ITEM(0x53fa8584, DQM_VAL) /* DQM0 */
+       MXC_DCD_ITEM(0x53fa8594, DQM_VAL) /* DQM1 */
+       MXC_DCD_ITEM(0x53fa8560, DQM_VAL) /* DQM2 */
+       MXC_DCD_ITEM(0x53fa8554, DQM_VAL) /* DQM3 */
+
+       MXC_DCD_ITEM(0x53fa857c, SDQS_VAL) /* SDQS0 */
+       MXC_DCD_ITEM(0x53fa8590, SDQS_VAL) /* SDQS1 */
+       MXC_DCD_ITEM(0x53fa8568, SDQS_VAL) /* SDQS2 */
+       MXC_DCD_ITEM(0x53fa8558, SDQS_VAL) /* SDQS3 */
+
+       MXC_DCD_ITEM(0x53fa8580, SDODT_VAL) /* SDODT0 */
+       MXC_DCD_ITEM(0x53fa8578, SDCLK_VAL) /* SDCLK0 */
+
+       MXC_DCD_ITEM(0x53fa8564, SDODT_VAL) /* SDODT1 */
+       MXC_DCD_ITEM(0x53fa8570, SDCLK_VAL) /* SDCLK1 */
+
+       MXC_DCD_ITEM(0x53fa858c, SDCKE_VAL) /* SDCKE0 */
+       MXC_DCD_ITEM(0x53fa855c, SDCKE_VAL) /* SDCKE1 */
+
+       MXC_DCD_ITEM(0x53fa8574, DSE_MASK) /* DRAM_CAS */
+       MXC_DCD_ITEM(0x53fa8588, DSE_MASK) /* DRAM_RAS */
+
+       MXC_DCD_ITEM(0x53fa86f0, DSE_MASK) /* GRP_ADDDS */
+       MXC_DCD_ITEM(0x53fa8720, DSE_MASK) /* GRP_CTLDS */
+       MXC_DCD_ITEM(0x53fa8718, DSE_MASK) /* GRP_B0DS */
+       MXC_DCD_ITEM(0x53fa871c, DSE_MASK) /* GRP_B1DS */
+       MXC_DCD_ITEM(0x53fa8728, DSE_MASK) /* GRP_B2DS */
+       MXC_DCD_ITEM(0x53fa872c, DSE_MASK) /* GRP_B3DS */
+
+       /* calibration defaults */
+       MXC_DCD_ITEM(0x63fd904c, 0x001f001f)
+       MXC_DCD_ITEM(0x63fd9050, 0x001f001f)
+       MXC_DCD_ITEM(0x63fd907c, 0x011e011e)
+       MXC_DCD_ITEM(0x63fd9080, 0x011f0120)
+       MXC_DCD_ITEM(0x63fd9088, 0x3a393d3b)
+       MXC_DCD_ITEM(0x63fd9090, 0x3f3f3f3f)
+
+       MXC_DCD_ITEM(0x63fd9018, ESDMISC_VAL)
+       MXC_DCD_ITEM(0x63fd9000, ESDCTL_VAL)
+       MXC_DCD_ITEM(0x63fd900c, ESDCFG0_VAL)
+       MXC_DCD_ITEM(0x63fd9010, ESDCFG1_VAL)
+       MXC_DCD_ITEM(0x63fd9014, ESDCFG2_VAL)
+
+       MXC_DCD_ITEM(0x63fd902c, 0x000026d2)
+       MXC_DCD_ITEM(0x63fd9030, ESDOR_VAL)
+       MXC_DCD_ITEM(0x63fd9008, ESDOTC_VAL)
+       MXC_DCD_ITEM(0x63fd9004, 0x00030012)
+
+       /* MR0 - CS0 */
+       MXC_DCD_ITEM(0x63fd901c, 0x00008032) /* MRS: MR2 */
+       MXC_DCD_ITEM(0x63fd901c, 0x00008033) /* MRS: MR3 */
+       MXC_DCD_ITEM(0x63fd901c, 0x00408031) /* MRS: MR1 */
+       MXC_DCD_ITEM(0x63fd901c, ESDSCR_MRS_VAL(0)) /* MRS: MR0 */
+       /* MR0 - CS1 */
+#if BANK_ADDR_BITS > 1
+       MXC_DCD_ITEM(0x63fd901c, 0x0000803a) /* MRS: MR2 */
+       MXC_DCD_ITEM(0x63fd901c, 0x0000803b) /* MRS: MR3 */
+       MXC_DCD_ITEM(0x63fd901c, 0x00408039) /* MRS: MR1 */
+       MXC_DCD_ITEM(0x63fd901c, ESDSCR_MRS_VAL(1)) /* MRS: MR0 */
+#endif
+       MXC_DCD_ITEM(0x63fd9020, 0x00005800) /* refresh interval */
+       MXC_DCD_ITEM(0x63fd9058, 0x00011112)
+
+       MXC_DCD_ITEM(0x63fd90d0, 0x00000003) /* select default compare pattern for calibration */
+
+       /* ZQ calibration */
+       MXC_DCD_ITEM(0x63fd901c, 0x04008010) /* precharge all */
+       MXC_DCD_ITEM(0x63fd901c, 0x00008040) /* MRS: ZQ calibration */
+       MXC_DCD_ITEM(0x63fd9040, 0x0539002b) /* Force ZQ calibration */
+zq_calib:
+       MXC_DCD_CMD_CHK(MXC_DCD_CMD_SZ_WORD, 0, 0x63fd9040, 0x00010000)
+       MXC_DCD_CMD_WRT(MXC_DCD_CMD_SZ_WORD, MXC_DCD_CMD_FLAG_WRITE, wl_calib)
+
+       /* Write Leveling */
+       MXC_DCD_ITEM(0x63fd901c, 0x00048033) /* MRS: select MPR */
+       MXC_DCD_ITEM(0x63fd901c, 0x00848231) /* MRS: start write leveling */
+       MXC_DCD_ITEM(0x63fd901c, 0x00000000)
+       MXC_DCD_ITEM(0x63fd9048, 0x00000001)
+wl_calib:
+       MXC_DCD_CMD_CHK(MXC_DCD_CMD_SZ_WORD, 0, 0x63fd9048, 0x00000001)
+       MXC_DCD_CMD_WRT(MXC_DCD_CMD_SZ_WORD, MXC_DCD_CMD_FLAG_WRITE, dqs_calib)
+       MXC_DCD_ITEM(0x63fd901c, 0x00048031) /* MRS: end write leveling */
+       MXC_DCD_ITEM(0x63fd901c, 0x00008033) /* MRS: select normal data path */
+
+       /* DQS calibration */
+       MXC_DCD_ITEM(0x63fd901c, 0x04008010) /* precharge all */
+       MXC_DCD_ITEM(0x63fd901c, 0x00048033) /* MRS: select MPR */
+       MXC_DCD_ITEM(0x63fd907c, 0x90000000) /* reset RD fifo and start DQS calib. */
+dqs_calib:
+       MXC_DCD_CMD_CHK(MXC_DCD_CMD_SZ_WORD, 0, 0x63fd907c, 0x90000000)
+       MXC_DCD_CMD_WRT(MXC_DCD_CMD_SZ_WORD, MXC_DCD_CMD_FLAG_WRITE, wr_dl_calib)
+       MXC_DCD_ITEM(0x63fd901c, 0x00008033) /* MRS: select normal data path */
+
+       /* WR DL calibration */
+       MXC_DCD_ITEM(0x63fd901c, 0x00000000)
+       MXC_DCD_ITEM(0x63fd901c, 0x04008010) /* precharge all */
+       MXC_DCD_ITEM(0x63fd901c, 0x00048033) /* MRS: select MPR */
+       MXC_DCD_ITEM(0x63fd90a4, 0x00000010)
+wr_dl_calib: /* 6c4 */
+       MXC_DCD_CMD_CHK(MXC_DCD_CMD_SZ_WORD, 0, 0x63fd90a4, 0x00000010)
+       MXC_DCD_CMD_WRT(MXC_DCD_CMD_SZ_WORD, MXC_DCD_CMD_FLAG_WRITE, rd_dl_calib)
+       MXC_DCD_ITEM(0x63fd901c, 0x00008033) /* MRS: select normal data path */
+
+       /* RD DL calibration */
+       MXC_DCD_ITEM(0x63fd901c, 0x04008010) /* precharge all */
+       MXC_DCD_ITEM(0x63fd901c, 0x00048033) /* MRS: select MPR */
+       MXC_DCD_ITEM(0x63fd90a0, 0x00000010)
+rd_dl_calib: /* 70c */
+       MXC_DCD_CMD_CHK(MXC_DCD_CMD_SZ_WORD, 0, 0x63fd90a0, 0x00000010)
+       MXC_DCD_CMD_WRT(MXC_DCD_CMD_SZ_WORD, MXC_DCD_CMD_FLAG_WRITE, dcd_end)
+       MXC_DCD_ITEM(0x63fd901c, 0x00008033) /* MRS: select normal data path */
+
+       MXC_DCD_ITEM(0x63fd901c, 0x00000000)
+
+       MXC_DCD_ITEM(0x53fa8004, 0x00194005)    @ set LDO to 1.3V
+
+       /* setup NFC pads */
+       /* MUX_SEL */
+       MXC_DCD_ITEM(0x53fa819c, 0x00000000)    @ EIM_DA0
+       MXC_DCD_ITEM(0x53fa81a0, 0x00000000)    @ EIM_DA1
+       MXC_DCD_ITEM(0x53fa81a4, 0x00000000)    @ EIM_DA2
+       MXC_DCD_ITEM(0x53fa81a8, 0x00000000)    @ EIM_DA3
+       MXC_DCD_ITEM(0x53fa81ac, 0x00000000)    @ EIM_DA4
+       MXC_DCD_ITEM(0x53fa81b0, 0x00000000)    @ EIM_DA5
+       MXC_DCD_ITEM(0x53fa81b4, 0x00000000)    @ EIM_DA6
+       MXC_DCD_ITEM(0x53fa81b8, 0x00000000)    @ EIM_DA7
+       MXC_DCD_ITEM(0x53fa81dc, 0x00000000)    @ WE_B
+       MXC_DCD_ITEM(0x53fa81e0, 0x00000000)    @ RE_B
+       MXC_DCD_ITEM(0x53fa8228, 0x00000000)    @ CLE
+       MXC_DCD_ITEM(0x53fa822c, 0x00000000)    @ ALE
+       MXC_DCD_ITEM(0x53fa8230, 0x00000000)    @ WP_B
+       MXC_DCD_ITEM(0x53fa8234, 0x00000000)    @ RB0
+       MXC_DCD_ITEM(0x53fa8238, 0x00000000)    @ CS0
+       /* PAD_CTL */
+       MXC_DCD_ITEM(0x53fa84ec, 0x000000e4)    @ EIM_DA0
+       MXC_DCD_ITEM(0x53fa84f0, 0x000000e4)    @ EIM_DA1
+       MXC_DCD_ITEM(0x53fa84f4, 0x000000e4)    @ EIM_DA2
+       MXC_DCD_ITEM(0x53fa84f8, 0x000000e4)    @ EIM_DA3
+       MXC_DCD_ITEM(0x53fa84fc, 0x000000e4)    @ EIM_DA4
+       MXC_DCD_ITEM(0x53fa8500, 0x000000e4)    @ EIM_DA5
+       MXC_DCD_ITEM(0x53fa8504, 0x000000e4)    @ EIM_DA6
+       MXC_DCD_ITEM(0x53fa8508, 0x000000e4)    @ EIM_DA7
+       MXC_DCD_ITEM(0x53fa852c, 0x00000004)    @ NANDF_WE_B
+       MXC_DCD_ITEM(0x53fa8530, 0x00000004)    @ NANDF_RE_B
+       MXC_DCD_ITEM(0x53fa85a0, 0x00000004)    @ NANDF_CLE_B
+       MXC_DCD_ITEM(0x53fa85a4, 0x00000004)    @ NANDF_ALE_B
+       MXC_DCD_ITEM(0x53fa85a8, 0x000000e4)    @ NANDF_WE_B
+       MXC_DCD_ITEM(0x53fa85ac, 0x000000e4)    @ NANDF_RB0
+       MXC_DCD_ITEM(0x53fa85b0, 0x00000004)    @ NANDF_CS0
+dcd_end:
+       .ifgt   dcd_end - dcd_start - 1768
+       DCD too large!
+       .endif
diff --git a/board/karo/tx53/tx53.c b/board/karo/tx53/tx53.c
new file mode 100644 (file)
index 0000000..8f86553
--- /dev/null
@@ -0,0 +1,891 @@
+/*
+ * Copyright (C) 2011 Lothar Waßmann <LW@KARO-electronics.de>
+ * based on: board/freesclae/mx28_evk.c (C) 2010 Freescale Semiconductor, Inc.
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+#include <common.h>
+#include <errno.h>
+#include <libfdt.h>
+#include <fdt_support.h>
+#include <lcd.h>
+#include <netdev.h>
+#include <mmc.h>
+#include <fsl_esdhc.h>
+#include <video_fb.h>
+#include <ipu_pixfmt.h>
+#include <mx2fb.h>
+#include <linux/fb.h>
+#include <asm/io.h>
+#include <asm/gpio.h>
+#include <asm/arch/iomux-mx53.h>
+#include <asm/arch/clock.h>
+#include <asm/arch/imx-regs.h>
+#include <asm/arch/crm_regs.h>
+#include <asm/arch/sys_proto.h>
+
+#include "../common/karo.h"
+
+#define IMX_GPIO_NR(b, o)      ((((b) - 1) << 5) | (o))
+
+#define TX53_FEC_RST_GPIO      IMX_GPIO_NR(7, 6)
+#define TX53_FEC_PWR_GPIO      IMX_GPIO_NR(3, 20)
+#define TX53_FEC_INT_GPIO      IMX_GPIO_NR(2, 4)
+#define TX53_LED_GPIO          IMX_GPIO_NR(2, 20)
+
+#define TX53_LCD_PWR_GPIO      IMX_GPIO_NR(2, 31)
+#define TX53_LCD_RST_GPIO      IMX_GPIO_NR(3, 29)
+#define TX53_LCD_BACKLIGHT_GPIO        IMX_GPIO_NR(1, 1)
+
+#define TX53_RESET_OUT_GPIO    IMX_GPIO_NR(7, 12)
+
+DECLARE_GLOBAL_DATA_PTR;
+
+#define MX53_GPIO_PAD_CTRL     (PAD_CTL_PKE | PAD_CTL_PUE |            \
+                               PAD_CTL_DSE_HIGH | PAD_CTL_PUS_22K_UP)
+
+#define TX53_SDHC_PAD_CTRL      (PAD_CTL_HYS | PAD_CTL_DSE_HIGH |      \
+                               PAD_CTL_SRE_FAST | PAD_CTL_PUS_100K_DOWN)
+
+static iomux_v3_cfg_t tx53_pads[] = {
+       /* NAND flash pads are set up in lowlevel_init.S */
+
+       /* RESET_OUT */
+       MX53_PAD_GPIO_17__GPIO7_12,
+
+       /* UART pads */
+#if CONFIG_MXC_UART_BASE == UART1_BASE
+       MX53_PAD_PATA_DIOW__UART1_TXD_MUX,
+       MX53_PAD_PATA_DMACK__UART1_RXD_MUX,
+       MX53_PAD_PATA_IORDY__UART1_RTS,
+       MX53_PAD_PATA_RESET_B__UART1_CTS,
+#endif
+#if CONFIG_MXC_UART_BASE == UART2_BASE
+       MX53_PAD_PATA_BUFFER_EN__UART2_RXD_MUX,
+       MX53_PAD_PATA_DMARQ__UART2_TXD_MUX,
+       MX53_PAD_PATA_DIOR__UART2_RTS,
+       MX53_PAD_PATA_INTRQ__UART2_CTS,
+#endif
+#if CONFIG_MXC_UART_BASE == UART3_BASE
+       MX53_PAD_PATA_CS_0__UART3_TXD_MUX,
+       MX53_PAD_PATA_CS_1__UART3_RXD_MUX,
+       MX53_PAD_PATA_DA_2__UART3_RTS,
+       MX53_PAD_PATA_DA_1__UART3_CTS,
+#endif
+       /* internal I2C */
+       NEW_PAD_CTRL(MX53_PAD_EIM_D28__I2C1_SDA, MX53_GPIO_PAD_CTRL),
+       NEW_PAD_CTRL(MX53_PAD_EIM_D21__I2C1_SCL, MX53_GPIO_PAD_CTRL),
+
+       /* FEC PHY GPIO functions */
+       MX53_PAD_EIM_D20__GPIO3_20, /* PHY POWER */
+       MX53_PAD_PATA_DA_0__GPIO7_6, /* PHY RESET */
+       MX53_PAD_PATA_DATA4__GPIO2_4, /* PHY INT */
+
+       /* FEC functions */
+       MX53_PAD_FEC_MDC__FEC_MDC,
+       MX53_PAD_FEC_MDIO__FEC_MDIO,
+       MX53_PAD_FEC_REF_CLK__FEC_TX_CLK,
+       MX53_PAD_FEC_RX_ER__FEC_RX_ER,
+       MX53_PAD_FEC_CRS_DV__FEC_RX_DV,
+       MX53_PAD_FEC_RXD1__FEC_RDATA_1,
+       MX53_PAD_FEC_RXD0__FEC_RDATA_0,
+       MX53_PAD_FEC_TX_EN__FEC_TX_EN,
+       MX53_PAD_FEC_TXD1__FEC_TDATA_1,
+       MX53_PAD_FEC_TXD0__FEC_TDATA_0,
+};
+
+static const struct gpio tx53_gpios[] = {
+       { TX53_RESET_OUT_GPIO, GPIOF_OUTPUT_INIT_HIGH, "#RESET_OUT", },
+       { TX53_FEC_PWR_GPIO, GPIOF_OUTPUT_INIT_HIGH, "FEC PHY PWR", },
+       { TX53_FEC_RST_GPIO, GPIOF_OUTPUT_INIT_LOW, "FEC PHY RESET", },
+       { TX53_FEC_INT_GPIO, GPIOF_INPUT, "FEC PHY INT", },
+};
+
+/*
+ * Functions
+ */
+/* placed in section '.data' to prevent overwriting relocation info
+ * overlayed with bss
+ */
+static u32 wrsr __attribute__((section(".data")));
+
+#define WRSR_POR       (1 << 4)
+#define WRSR_TOUT      (1 << 1)
+#define WRSR_SFTW      (1 << 0)
+
+static void print_reset_cause(void)
+{
+       struct src *src_regs = (struct src *)SRC_BASE_ADDR;
+       void __iomem *wdt_base = (void __iomem *)WDOG1_BASE_ADDR;
+       u32 srsr;
+       char *dlm = "";
+
+       printf("Reset cause: ");
+
+       srsr = readl(&src_regs->srsr);
+       wrsr = readw(wdt_base + 4);
+
+       if (wrsr & WRSR_POR) {
+               printf("%sPOR", dlm);
+               dlm = " | ";
+       }
+       if (srsr & 0x00004) {
+               printf("%sCSU", dlm);
+               dlm = " | ";
+       }
+       if (srsr & 0x00008) {
+               printf("%sIPP USER", dlm);
+               dlm = " | ";
+       }
+       if (srsr & 0x00010) {
+               if (wrsr & WRSR_SFTW) {
+                       printf("%sSOFT", dlm);
+                       dlm = " | ";
+               }
+               if (wrsr & WRSR_TOUT) {
+                       printf("%sWDOG", dlm);
+                       dlm = " | ";
+               }
+       }
+       if (srsr & 0x00020) {
+               printf("%sJTAG HIGH-Z", dlm);
+               dlm = " | ";
+       }
+       if (srsr & 0x00040) {
+               printf("%sJTAG SW", dlm);
+               dlm = " | ";
+       }
+       if (srsr & 0x10000) {
+               printf("%sWARM BOOT", dlm);
+               dlm = " | ";
+       }
+       if (dlm[0] == '\0')
+               printf("unknown");
+
+       printf("\n");
+}
+
+static void print_cpuinfo(void)
+{
+       u32 cpurev;
+
+       cpurev = get_cpu_rev();
+
+       printf("CPU:   Freescale i.MX53 rev%d.%d at %d MHz\n",
+               (cpurev & 0x000F0) >> 4,
+               (cpurev & 0x0000F) >> 0,
+               mxc_get_clock(MXC_ARM_CLK) / 1000000);
+
+       print_reset_cause();
+}
+
+int board_early_init_f(void)
+{
+       gpio_request_array(tx53_gpios, ARRAY_SIZE(tx53_gpios));
+       mxc_iomux_v3_setup_multiple_pads(tx53_pads, ARRAY_SIZE(tx53_pads));
+
+       writel(0x77777777, AIPS1_BASE_ADDR + 0x00);
+       writel(0x77777777, AIPS1_BASE_ADDR + 0x04);
+
+       writel(0x00000000, AIPS1_BASE_ADDR + 0x40);
+       writel(0x00000000, AIPS1_BASE_ADDR + 0x44);
+       writel(0x00000000, AIPS1_BASE_ADDR + 0x48);
+       writel(0x00000000, AIPS1_BASE_ADDR + 0x4c);
+       writel(0x00000000, AIPS1_BASE_ADDR + 0x50);
+
+       writel(0x77777777, AIPS2_BASE_ADDR + 0x00);
+       writel(0x77777777, AIPS2_BASE_ADDR + 0x04);
+
+       writel(0x00000000, AIPS2_BASE_ADDR + 0x40);
+       writel(0x00000000, AIPS2_BASE_ADDR + 0x44);
+       writel(0x00000000, AIPS2_BASE_ADDR + 0x48);
+       writel(0x00000000, AIPS2_BASE_ADDR + 0x4c);
+       writel(0x00000000, AIPS2_BASE_ADDR + 0x50);
+
+       return 0;
+}
+
+int board_init(void)
+{
+       /* Address of boot parameters */
+       gd->bd->bi_boot_params = PHYS_SDRAM_1 + 0x1000;
+       return 0;
+}
+
+int dram_init(void)
+{
+       int ret;
+
+       /* dram_init must store complete ramsize in gd->ram_size */
+       gd->ram_size = get_ram_size((void *)CONFIG_SYS_SDRAM_BASE,
+                               PHYS_SDRAM_1_SIZE);
+
+       ret = mxc_set_clock(CONFIG_SYS_MX5_HCLK,
+               CONFIG_SYS_SDRAM_CLK, MXC_DDR_CLK);
+       if (ret)
+               printf("%s: Failed to set DDR clock to %u MHz: %d\n", __func__,
+                       CONFIG_SYS_SDRAM_CLK, ret);
+       else
+               debug("%s: DDR clock set to %u.%03u MHz (desig.: %u.000 MHz)\n",
+                       __func__, mxc_get_clock(MXC_DDR_CLK) / 1000000,
+                       mxc_get_clock(MXC_DDR_CLK) / 1000 % 1000,
+                       CONFIG_SYS_SDRAM_CLK);
+       return ret;
+}
+
+void dram_init_banksize(void)
+{
+       gd->bd->bi_dram[0].start = PHYS_SDRAM_1;
+       gd->bd->bi_dram[0].size = get_ram_size((void *)PHYS_SDRAM_1,
+                       PHYS_SDRAM_1_SIZE);
+#if CONFIG_NR_DRAM_BANKS > 1
+       gd->bd->bi_dram[1].start = PHYS_SDRAM_2;
+       gd->bd->bi_dram[1].size = get_ram_size((void *)PHYS_SDRAM_2,
+                       PHYS_SDRAM_2_SIZE);
+#endif
+}
+
+#ifdef CONFIG_CMD_MMC
+int board_mmc_getcd(struct mmc *mmc)
+{
+       struct fsl_esdhc_cfg *cfg = mmc->priv;
+
+       if (cfg->cd_gpio < 0)
+               return cfg->cd_gpio;
+
+       return !gpio_get_value(cfg->cd_gpio);
+}
+
+static struct fsl_esdhc_cfg esdhc_cfg[] = {
+       {
+               .esdhc_base = (void __iomem *)MMC_SDHC1_BASE_ADDR,
+               .no_snoop = 1,
+               .cd_gpio = IMX_GPIO_NR(3, 24),
+               .wp_gpio = -EINVAL,
+       },
+       {
+               .esdhc_base = (void __iomem *)MMC_SDHC2_BASE_ADDR,
+               .no_snoop = 1,
+               .cd_gpio = IMX_GPIO_NR(3, 25),
+               .wp_gpio = -EINVAL,
+       },
+};
+
+static const iomux_v3_cfg_t mmc0_pads[] = {
+       NEW_PAD_CTRL(MX53_PAD_SD1_CMD__ESDHC1_CMD, TX53_SDHC_PAD_CTRL),
+       NEW_PAD_CTRL(MX53_PAD_SD1_CLK__ESDHC1_CLK, TX53_SDHC_PAD_CTRL),
+       NEW_PAD_CTRL(MX53_PAD_SD1_DATA0__ESDHC1_DAT0, TX53_SDHC_PAD_CTRL),
+       NEW_PAD_CTRL(MX53_PAD_SD1_DATA1__ESDHC1_DAT1, TX53_SDHC_PAD_CTRL),
+       NEW_PAD_CTRL(MX53_PAD_SD1_DATA2__ESDHC1_DAT2, TX53_SDHC_PAD_CTRL),
+       NEW_PAD_CTRL(MX53_PAD_SD1_DATA3__ESDHC1_DAT3, TX53_SDHC_PAD_CTRL),
+       /* SD1 CD */
+       NEW_PAD_CTRL(MX53_PAD_EIM_D24__GPIO3_24, MX53_GPIO_PAD_CTRL),
+};
+
+static const iomux_v3_cfg_t mmc1_pads[] = {
+       NEW_PAD_CTRL(MX53_PAD_SD2_CMD__ESDHC2_CMD, TX53_SDHC_PAD_CTRL),
+       NEW_PAD_CTRL(MX53_PAD_SD2_CLK__ESDHC2_CLK, TX53_SDHC_PAD_CTRL),
+       NEW_PAD_CTRL(MX53_PAD_SD2_DATA0__ESDHC2_DAT0, TX53_SDHC_PAD_CTRL),
+       NEW_PAD_CTRL(MX53_PAD_SD2_DATA1__ESDHC2_DAT1, TX53_SDHC_PAD_CTRL),
+       NEW_PAD_CTRL(MX53_PAD_SD2_DATA2__ESDHC2_DAT2, TX53_SDHC_PAD_CTRL),
+       NEW_PAD_CTRL(MX53_PAD_SD2_DATA3__ESDHC2_DAT3, TX53_SDHC_PAD_CTRL),
+       /* SD2 CD */
+       NEW_PAD_CTRL(MX53_PAD_EIM_D25__GPIO3_25, MX53_GPIO_PAD_CTRL),
+};
+
+static struct {
+       const iomux_v3_cfg_t *pads;
+       int count;
+} mmc_pad_config[] = {
+       { mmc0_pads, ARRAY_SIZE(mmc0_pads), },
+       { mmc1_pads, ARRAY_SIZE(mmc1_pads), },
+};
+
+int board_mmc_init(bd_t *bis)
+{
+       int i;
+
+       for (i = 0; i < ARRAY_SIZE(esdhc_cfg); i++) {
+               struct mmc *mmc;
+
+               if (i >= CONFIG_SYS_FSL_ESDHC_NUM)
+                       break;
+
+               mxc_iomux_v3_setup_multiple_pads(mmc_pad_config[i].pads,
+                                               mmc_pad_config[i].count);
+               fsl_esdhc_initialize(bis, &esdhc_cfg[i]);
+
+               mmc = find_mmc_device(i);
+               if (mmc == NULL)
+                       continue;
+               if (board_mmc_getcd(mmc) > 0)
+                       mmc_init(mmc);
+       }
+       return 0;
+}
+#endif /* CONFIG_CMD_MMC */
+
+#ifdef CONFIG_FEC_MXC
+
+#ifndef ETH_ALEN
+#define ETH_ALEN 6
+#endif
+
+void imx_get_mac_from_fuse(int dev_id, unsigned char *mac)
+{
+       int i;
+       struct iim_regs *iim = (struct iim_regs *)IMX_IIM_BASE;
+       struct fuse_bank *bank = &iim->bank[1];
+       struct fuse_bank1_regs *fuse = (struct fuse_bank1_regs *)bank->fuse_regs;
+
+       if (dev_id > 0)
+               return;
+
+       for (i = 0; i < ETH_ALEN; i++)
+               mac[i] = readl(&fuse->mac_addr[i]);
+}
+
+#define FEC_PAD_CTL    (PAD_CTL_DVS | PAD_CTL_DSE_HIGH | \
+                       PAD_CTL_SRE_FAST)
+#define FEC_PAD_CTL2   (PAD_CTL_DVS | PAD_CTL_SRE_FAST)
+#define GPIO_PAD_CTL   (PAD_CTL_DVS | PAD_CTL_DSE_HIGH)
+
+int board_eth_init(bd_t *bis)
+{
+       int ret;
+       unsigned char mac[ETH_ALEN];
+       char mac_str[ETH_ALEN * 3] = "";
+
+       /* delay at least 21ms for the PHY internal POR signal to deassert */
+       udelay(22000);
+
+       /* Deassert RESET to the external phy */
+       gpio_set_value(TX53_FEC_RST_GPIO, 1);
+
+       ret = cpu_eth_init(bis);
+       if (ret) {
+               printf("cpu_eth_init() failed: %d\n", ret);
+               return ret;
+       }
+
+       imx_get_mac_from_fuse(0, mac);
+       snprintf(mac_str, sizeof(mac_str), "%02x:%02x:%02x:%02x:%02x:%02x",
+               mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
+       setenv("ethaddr", mac_str);
+
+       return ret;
+}
+#endif /* CONFIG_FEC_MXC */
+
+enum {
+       LED_STATE_INIT = -1,
+       LED_STATE_OFF,
+       LED_STATE_ON,
+};
+
+void show_activity(int arg)
+{
+       static int led_state = LED_STATE_INIT;
+       static ulong last;
+
+       if (led_state == LED_STATE_INIT) {
+               last = get_timer(0);
+               gpio_set_value(TX53_LED_GPIO, 1);
+               led_state = LED_STATE_ON;
+       } else {
+               if (get_timer(last) > CONFIG_SYS_HZ) {
+                       last = get_timer(0);
+                       if (led_state == LED_STATE_ON) {
+                               gpio_set_value(TX53_LED_GPIO, 0);
+                       } else {
+                               gpio_set_value(TX53_LED_GPIO, 1);
+                       }
+                       led_state = 1 - led_state;
+               }
+       }
+}
+
+static const iomux_v3_cfg_t stk5_pads[] = {
+       /* SW controlled LED on STK5 baseboard */
+       MX53_PAD_EIM_A18__GPIO2_20,
+
+       /* I2C bus on DIMM pins 40/41 */
+       NEW_PAD_CTRL(MX53_PAD_GPIO_6__I2C3_SDA, MX53_GPIO_PAD_CTRL),
+       NEW_PAD_CTRL(MX53_PAD_GPIO_3__I2C3_SCL, MX53_GPIO_PAD_CTRL),
+
+       /* TSC200x PEN IRQ */
+       NEW_PAD_CTRL(MX53_PAD_EIM_D26__GPIO3_26, MX53_GPIO_PAD_CTRL),
+
+       /* EDT-FT5x06 Polytouch panel */
+       NEW_PAD_CTRL(MX53_PAD_NANDF_CS2__GPIO6_15, MX53_GPIO_PAD_CTRL), /* IRQ */
+       NEW_PAD_CTRL(MX53_PAD_EIM_A16__GPIO2_22, MX53_GPIO_PAD_CTRL), /* RESET */
+       NEW_PAD_CTRL(MX53_PAD_EIM_A17__GPIO2_21, MX53_GPIO_PAD_CTRL), /* WAKE */
+
+       /* USBH1 */
+       NEW_PAD_CTRL(MX53_PAD_EIM_D31__GPIO3_31, MX53_GPIO_PAD_CTRL), /* VBUSEN */
+       NEW_PAD_CTRL(MX53_PAD_EIM_D30__GPIO3_30, MX53_GPIO_PAD_CTRL), /* OC */
+       /* USBOTG */
+       MX53_PAD_GPIO_7__GPIO1_7, /* VBUSEN */
+       MX53_PAD_GPIO_8__GPIO1_8, /* OC */
+
+       /* DS1339 Interrupt */
+       NEW_PAD_CTRL(MX53_PAD_DI0_PIN4__GPIO4_20, MX53_GPIO_PAD_CTRL),
+};
+
+static const struct gpio stk5_gpios[] = {
+       { TX53_LED_GPIO, GPIOF_OUTPUT_INIT_LOW, "HEARTBEAT LED", },
+
+       { IMX_GPIO_NR(1, 8), GPIOF_INPUT, "USBOTG OC", },
+       { IMX_GPIO_NR(1, 7), GPIOF_OUTPUT_INIT_LOW, "USBOTG VBUS enable", },
+       { IMX_GPIO_NR(3, 30), GPIOF_INPUT, "USBH1 OC", },
+       { IMX_GPIO_NR(3, 31), GPIOF_OUTPUT_INIT_LOW, "USBH1 VBUS enable", },
+};
+
+#ifdef CONFIG_LCD
+vidinfo_t panel_info = {
+       /* set to max. size supported by SoC */
+       .vl_col = 1600,
+       .vl_row = 1200,
+
+       .vl_bpix = LCD_COLOR24,    /* Bits per pixel, 0: 1bpp, 1: 2bpp, 2: 4bpp, 3: 8bpp ... */
+};
+
+static struct fb_videomode tx53_fb_mode = {
+       /* Standard VGA timing */
+       .name           = "VGA",
+       .refresh        = 60,
+       .xres           = 640,
+       .yres           = 480,
+       .pixclock       = KHZ2PICOS(25175),
+       .left_margin    = 48,
+       .hsync_len      = 96,
+       .right_margin   = 16,
+       .upper_margin   = 31,
+       .vsync_len      = 2,
+       .lower_margin   = 12,
+       .sync           = FB_SYNC_CLK_LAT_FALL,
+       .vmode          = FB_VMODE_NONINTERLACED,
+};
+
+void *lcd_base;                        /* Start of framebuffer memory  */
+void *lcd_console_address;     /* Start of console buffer      */
+
+int lcd_line_length;
+int lcd_color_fg;
+int lcd_color_bg;
+
+short console_col;
+short console_row;
+
+void lcd_initcolregs(void)
+{
+}
+
+void lcd_setcolreg(ushort regno, ushort red, ushort green, ushort blue)
+{
+}
+
+static int lcd_enabled = 1;
+
+void lcd_enable(void)
+{
+       /* HACK ALERT:
+        * global variable from common/lcd.c
+        * Set to 0 here to prevent messages from going to LCD
+        * rather than serial console
+        */
+       lcd_is_enabled = 0;
+
+       karo_load_splashimage(1);
+       if (lcd_enabled) {
+               debug("Switching LCD on\n");
+               gpio_set_value(TX53_LCD_PWR_GPIO, 1);
+               udelay(100);
+               gpio_set_value(TX53_LCD_RST_GPIO, 1);
+               udelay(300000);
+               gpio_set_value(TX53_LCD_BACKLIGHT_GPIO, 0);
+       }
+}
+
+void mxcfb_disable(void);
+
+void lcd_disable(void)
+{
+       mxcfb_disable();
+}
+
+void lcd_panel_disable(void)
+{
+       if (lcd_enabled) {
+               debug("Switching LCD off\n");
+               gpio_set_value(TX53_LCD_BACKLIGHT_GPIO, 1);
+               gpio_set_value(TX53_LCD_RST_GPIO, 0);
+               gpio_set_value(TX53_LCD_PWR_GPIO, 0);
+       }
+}
+
+static const iomux_v3_cfg_t stk5_lcd_pads[] = {
+       /* LCD RESET */
+       NEW_PAD_CTRL(MX53_PAD_EIM_D29__GPIO3_29, MX53_GPIO_PAD_CTRL),
+       /* LCD POWER_ENABLE */
+       NEW_PAD_CTRL(MX53_PAD_EIM_EB3__GPIO2_31, MX53_GPIO_PAD_CTRL),
+       /* LCD Backlight (PWM) */
+       NEW_PAD_CTRL(MX53_PAD_GPIO_1__GPIO1_1, MX53_GPIO_PAD_CTRL),
+
+       /* Display */
+       MX53_PAD_DI0_DISP_CLK__IPU_DI0_DISP_CLK,
+       MX53_PAD_DI0_PIN15__IPU_DI0_PIN15,
+       MX53_PAD_DI0_PIN2__IPU_DI0_PIN2,
+       MX53_PAD_DI0_PIN3__IPU_DI0_PIN3,
+       MX53_PAD_DISP0_DAT0__IPU_DISP0_DAT_0,
+       MX53_PAD_DISP0_DAT1__IPU_DISP0_DAT_1,
+       MX53_PAD_DISP0_DAT2__IPU_DISP0_DAT_2,
+       MX53_PAD_DISP0_DAT3__IPU_DISP0_DAT_3,
+       MX53_PAD_DISP0_DAT4__IPU_DISP0_DAT_4,
+       MX53_PAD_DISP0_DAT5__IPU_DISP0_DAT_5,
+       MX53_PAD_DISP0_DAT6__IPU_DISP0_DAT_6,
+       MX53_PAD_DISP0_DAT7__IPU_DISP0_DAT_7,
+       MX53_PAD_DISP0_DAT8__IPU_DISP0_DAT_8,
+       MX53_PAD_DISP0_DAT9__IPU_DISP0_DAT_9,
+       MX53_PAD_DISP0_DAT10__IPU_DISP0_DAT_10,
+       MX53_PAD_DISP0_DAT11__IPU_DISP0_DAT_11,
+       MX53_PAD_DISP0_DAT12__IPU_DISP0_DAT_12,
+       MX53_PAD_DISP0_DAT13__IPU_DISP0_DAT_13,
+       MX53_PAD_DISP0_DAT14__IPU_DISP0_DAT_14,
+       MX53_PAD_DISP0_DAT15__IPU_DISP0_DAT_15,
+       MX53_PAD_DISP0_DAT16__IPU_DISP0_DAT_16,
+       MX53_PAD_DISP0_DAT17__IPU_DISP0_DAT_17,
+       MX53_PAD_DISP0_DAT18__IPU_DISP0_DAT_18,
+       MX53_PAD_DISP0_DAT19__IPU_DISP0_DAT_19,
+       MX53_PAD_DISP0_DAT20__IPU_DISP0_DAT_20,
+       MX53_PAD_DISP0_DAT21__IPU_DISP0_DAT_21,
+       MX53_PAD_DISP0_DAT22__IPU_DISP0_DAT_22,
+       MX53_PAD_DISP0_DAT23__IPU_DISP0_DAT_23,
+
+       /* LVDS option */
+       MX53_PAD_LVDS1_TX3_P__LDB_LVDS1_TX3,
+       MX53_PAD_LVDS1_TX2_P__LDB_LVDS1_TX2,
+       MX53_PAD_LVDS1_CLK_P__LDB_LVDS1_CLK,
+       MX53_PAD_LVDS1_TX1_P__LDB_LVDS1_TX1,
+       MX53_PAD_LVDS1_TX0_P__LDB_LVDS1_TX0,
+       MX53_PAD_LVDS0_TX3_P__LDB_LVDS0_TX3,
+       MX53_PAD_LVDS0_CLK_P__LDB_LVDS0_CLK,
+       MX53_PAD_LVDS0_TX2_P__LDB_LVDS0_TX2,
+       MX53_PAD_LVDS0_TX1_P__LDB_LVDS0_TX1,
+       MX53_PAD_LVDS0_TX0_P__LDB_LVDS0_TX0,
+};
+
+static const struct gpio stk5_lcd_gpios[] = {
+       { TX53_LCD_RST_GPIO, GPIOF_OUTPUT_INIT_LOW, "LCD RESET", },
+       { TX53_LCD_PWR_GPIO, GPIOF_OUTPUT_INIT_LOW, "LCD POWER", },
+       { TX53_LCD_BACKLIGHT_GPIO, GPIOF_OUTPUT_INIT_HIGH, "LCD BACKLIGHT", },
+};
+
+void lcd_ctrl_init(void *lcdbase)
+{
+       int color_depth = 24;
+       char *vm;
+       unsigned long val;
+       int refresh = 60;
+       struct fb_videomode *p = &tx53_fb_mode;
+       int xres_set = 0, yres_set = 0, bpp_set = 0, refresh_set = 0;
+       int pix_fmt = 0;
+
+       if (!lcd_enabled) {
+               debug("LCD disabled\n");
+               return;
+       }
+
+       if (tstc() || (wrsr & WRSR_TOUT)) {
+               debug("Disabling LCD\n");
+               lcd_enabled = 0;
+               return;
+       }
+
+       vm = getenv("video_mode");
+       if (vm == NULL) {
+               debug("Disabling LCD\n");
+               lcd_enabled = 0;
+               return;
+       }
+       while (*vm != '\0') {
+               if (*vm >= '0' && *vm <= '9') {
+                       char *end;
+
+                       val = simple_strtoul(vm, &end, 0);
+                       if (end > vm) {
+                               if (!xres_set) {
+                                       if (val > panel_info.vl_col)
+                                               val = panel_info.vl_col;
+                                       p->xres = val;
+                                       panel_info.vl_col = val;
+                                       xres_set = 1;
+                               } else if (!yres_set) {
+                                       if (val > panel_info.vl_row)
+                                               val = panel_info.vl_row;
+                                       p->yres = val;
+                                       panel_info.vl_row = val;
+                                       yres_set = 1;
+                               } else if (!bpp_set) {
+                                       switch (val) {
+                                       case 24:
+                                               if (pix_fmt == IPU_PIX_FMT_LVDS666)
+                                                       pix_fmt = IPU_PIX_FMT_LVDS888;
+                                               /* fallthru */
+                                       case 16:
+                                       case 8:
+                                               color_depth = val;
+                                               break;
+
+                                       case 18:
+                                               if (pix_fmt == IPU_PIX_FMT_LVDS666) {
+                                                       color_depth = val;
+                                                       break;
+                                               }
+                                               /* fallthru */
+                                       default:
+                                               printf("Invalid color depth: '%.*s' in video_mode; using default: '%u'\n",
+                                                       end - vm, vm, color_depth);
+                                       }
+                                       bpp_set = 1;
+                               } else if (!refresh_set) {
+                                       refresh = val;
+                                       refresh_set = 1;
+                               }
+                       }
+                       vm = end;
+               }
+               switch (*vm) {
+               case '@':
+                       bpp_set = 1;
+                       /* fallthru */
+               case '-':
+                       yres_set = 1;
+                       /* fallthru */
+               case 'x':
+                       xres_set = 1;
+                       /* fallthru */
+               case 'M':
+               case 'R':
+                       vm++;
+                       break;
+
+               default:
+                       if (!pix_fmt) {
+                               char *tmp;
+
+                               if (strncmp(vm, "LVDS", 4) == 0)
+                                       pix_fmt = IPU_PIX_FMT_LVDS666;
+                               else
+                                       pix_fmt = IPU_PIX_FMT_RGB24;
+                               tmp = strchr(vm, ':');
+                               if (tmp)
+                                       vm = tmp;
+                       }
+                       if (*vm != '\0')
+                               vm++;
+               }
+       }
+       switch (color_depth) {
+       case 8:
+               panel_info.vl_bpix = 3;
+               break;
+
+       case 16:
+               panel_info.vl_bpix = 4;
+               break;
+
+       case 18:
+       case 24:
+               panel_info.vl_bpix = 5;
+       }
+       lcd_line_length = NBITS(panel_info.vl_bpix) / 8 * panel_info.vl_col;
+
+       p->pixclock = KHZ2PICOS(refresh *
+               (p->xres + p->left_margin + p->right_margin + p->hsync_len) *
+               (p->yres + p->upper_margin + p->lower_margin + p->vsync_len)
+               / 1000);
+       debug("Pixel clock set to %lu.%03lu MHz\n",
+               PICOS2KHZ(p->pixclock) / 1000,
+               PICOS2KHZ(p->pixclock) % 1000);
+
+       gpio_request_array(stk5_lcd_gpios, ARRAY_SIZE(stk5_lcd_gpios));
+       mxc_iomux_v3_setup_multiple_pads(stk5_lcd_pads,
+                                       ARRAY_SIZE(stk5_lcd_pads));
+
+       debug("Initializing FB driver\n");
+       if (!pix_fmt)
+               pix_fmt = IPU_PIX_FMT_RGB24;
+       else if (pix_fmt == IPU_PIX_FMT_LVDS666) {
+               writel(0x01, IOMUXC_BASE_ADDR + 8);
+       } else if (pix_fmt == IPU_PIX_FMT_LVDS888) {
+               writel(0x21, IOMUXC_BASE_ADDR + 8);
+       }
+       if (pix_fmt != IPU_PIX_FMT_RGB24) {
+               struct mxc_ccm_reg *ccm_regs = (struct mxc_ccm_reg *)MXC_CCM_BASE;
+               /* enable LDB & DI0 clock */
+               writel(readl(&ccm_regs->CCGR6) | (3 << 28) | (3 << 10),
+                       &ccm_regs->CCGR6);
+       }
+
+       mx5_fb_init(p, 0, pix_fmt, 1 << panel_info.vl_bpix);
+
+       if (karo_load_splashimage(0) == 0) {
+               debug("Initializing LCD controller\n");
+               video_hw_init();
+       } else {
+               debug("Skipping initialization of LCD controller\n");
+       }
+}
+#else
+#define lcd_enabled 0
+#endif /* CONFIG_LCD */
+
+static void stk5_board_init(void)
+{
+       gpio_request_array(stk5_gpios, ARRAY_SIZE(stk5_gpios));
+       mxc_iomux_v3_setup_multiple_pads(stk5_pads, ARRAY_SIZE(stk5_pads));
+}
+
+static void stk5v3_board_init(void)
+{
+       stk5_board_init();
+}
+
+static void stk5v5_board_init(void)
+{
+       stk5_board_init();
+
+       gpio_request_one(IMX_GPIO_NR(4, 21), GPIOF_OUTPUT_INIT_HIGH,
+                       "Flexcan Transceiver");
+       mxc_iomux_v3_setup_pad(MX53_PAD_DISP0_DAT0__GPIO4_21);
+}
+
+static void tx53_set_cpu_clock(void)
+{
+       unsigned long cpu_clk = getenv_ulong("cpu_clk", 10, 0);
+       int ret;
+
+       if (tstc() || (wrsr & WRSR_TOUT))
+               return;
+
+       if (cpu_clk == 0 || cpu_clk == mxc_get_clock(MXC_ARM_CLK) / 1000000)
+               return;
+
+       ret = mxc_set_clock(CONFIG_SYS_MX5_HCLK, cpu_clk, MXC_ARM_CLK);
+       if (ret != 0) {
+               printf("Error: Failed to set CPU clock to %lu MHz\n", cpu_clk);
+               return;
+       }
+       printf("CPU clock set to %u.%03u MHz\n",
+               mxc_get_clock(MXC_ARM_CLK) / 1000000,
+               mxc_get_clock(MXC_ARM_CLK) / 1000 % 1000);
+}
+
+int board_late_init(void)
+{
+       int ret = 0;
+       const char *baseboard;
+
+       tx53_set_cpu_clock();
+       karo_fdt_move_fdt();
+
+       baseboard = getenv("baseboard");
+       if (!baseboard)
+               goto exit;
+
+       if (strncmp(baseboard, "stk5", 4) == 0) {
+               printf("Baseboard: %s\n", baseboard);
+               if ((strlen(baseboard) == 4) ||
+                       strcmp(baseboard, "stk5-v3") == 0) {
+                       stk5v3_board_init();
+               } else if (strcmp(baseboard, "stk5-v5") == 0) {
+                       stk5v5_board_init();
+               } else {
+                       printf("WARNING: Unsupported STK5 board rev.: %s\n",
+                               baseboard + 4);
+               }
+       } else {
+               printf("WARNING: Unsupported baseboard: '%s'\n",
+                       baseboard);
+               ret = -EINVAL;
+       }
+
+exit:
+       gpio_set_value(TX53_RESET_OUT_GPIO, 1);
+       return ret;
+}
+
+int checkboard(void)
+{
+       print_cpuinfo();
+
+       printf("Board: Ka-Ro TX53-xx3%s\n",
+               TX53_MOD_SUFFIX);
+
+       return 0;
+}
+
+#if defined(CONFIG_OF_BOARD_SETUP)
+#ifdef CONFIG_FDT_FIXUP_PARTITIONS
+#include <jffs2/jffs2.h>
+#include <mtd_node.h>
+struct node_info nodes[] = {
+       { "fsl,imx53-nand", MTD_DEV_TYPE_NAND, },
+};
+
+#else
+#define fdt_fixup_mtdparts(b,n,c) do { } while (0)
+#endif
+
+static void tx53_fixup_flexcan(void *blob)
+{
+       const char *baseboard = getenv("baseboard");
+
+       if (baseboard && strcmp(baseboard, "stk5-v5") == 0)
+               return;
+
+       karo_fdt_del_prop(blob, "fsl,p1010-flexcan", 0x53fc8000, "transceiver-switch");
+       karo_fdt_del_prop(blob, "fsl,p1010-flexcan", 0x53fcc000, "transceiver-switch");
+}
+
+#ifdef CONFIG_SYS_TX53_HWREV_2
+void tx53_fixup_rtc(void *blob)
+{
+       karo_fdt_del_prop(blob, "dallas,ds1339", 0x68, "interrupt-parent");
+       karo_fdt_del_prop(blob, "dallas,ds1339", 0x68, "interrupts");
+}
+#else
+static inline void tx53_fixup_rtc(void *blob)
+{
+}
+#endif
+
+void ft_board_setup(void *blob, bd_t *bd)
+{
+       fdt_fixup_mtdparts(blob, nodes, ARRAY_SIZE(nodes));
+       fdt_fixup_ethernet(blob);
+
+       karo_fdt_fixup_touchpanel(blob);
+       karo_fdt_fixup_usb_otg(blob);
+       tx53_fixup_flexcan(blob);
+       tx53_fixup_rtc(blob);
+}
+#endif
diff --git a/board/karo/tx53/u-boot.lds b/board/karo/tx53/u-boot.lds
new file mode 100644 (file)
index 0000000..7842ff8
--- /dev/null
@@ -0,0 +1,82 @@
+/*
+ * (C) Copyright 2012  Lothar Waßmann <LW@KARO-electronics.de>
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm")
+OUTPUT_ARCH(arm)
+ENTRY(_start)
+SECTIONS
+{
+        . = 0x00000000;
+
+        . = ALIGN(4);
+        .text :
+        {
+               board/karo/tx53/lowlevel_init.o (.text)
+                __image_copy_start = .;
+                CPUDIR/start.o (.text)
+                *(.text)
+        }
+
+        . = ALIGN(4);
+        .rodata : { *(SORT_BY_ALIGNMENT(SORT_BY_NAME(.rodata*))) }
+
+        . = ALIGN(4);
+        .data : {
+                *(.data)
+        }
+
+        . = ALIGN(4);
+
+        . = .;
+        __u_boot_cmd_start = .;
+        .u_boot_cmd : { *(.u_boot_cmd) }
+        __u_boot_cmd_end = .;
+
+        . = ALIGN(4);
+
+        __image_copy_end = .;
+
+        .rel.dyn : {
+                __rel_dyn_start = .;
+                *(.rel*)
+                __rel_dyn_end = .;
+        }
+
+        .dynsym : {
+                __dynsym_start = .;
+                *(.dynsym)
+        }
+
+        _end = .;
+
+        .bss __rel_dyn_start (OVERLAY) : {
+                __bss_start = .;
+                *(.bss)
+                 . = ALIGN(4);
+                __bss_end__ = .;
+        }
+
+        /DISCARD/ : { *(.dynstr*) }
+        /DISCARD/ : { *(.dynamic*) }
+        /DISCARD/ : { *(.plt*) }
+        /DISCARD/ : { *(.interp*) }
+        /DISCARD/ : { *(.gnu*) }
+}
index 89b114bf6d713ae60e35fc893e8cd8eb4f1f7f4d..12bcfcb877382e206a3411fedbb7ee720af9c11d 100644 (file)
@@ -144,17 +144,6 @@ int board_mmc_init(bd_t *bis)
 }
 #endif
 
-/*
- * Routine: misc_init_r
- * Description: display die ID register
- */
-int misc_init_r(void)
-{
-       dieid_num_r();
-
-       return 0;
-}
-
 #ifdef CONFIG_SMC911X
 /* GPMC CS1 settings for Logic SOM LV/Torpedo LAN92xx Ethernet chip */
 static const u32 gpmc_lan92xx_config[] = {
index 3e748fdd20ba9fccf388f4b23c44bc5586cd8606..a93d4583e748088284928079ad84dcac2d70c34a 100644 (file)
@@ -27,6 +27,7 @@ LIB   = $(obj)lib$(VENDOR).o
 
 COBJS-y += board.o
 COBJS-$(CONFIG_SPI_UART_SWITCH) += uart-spi-switch.o
+COBJS-$(CONFIG_TEGRA_CLOCK_SCALING) += emc.o
 
 COBJS  := $(COBJS-y)
 SRCS   := $(SOBJS:.o=.S) $(COBJS:.o=.c)
index 85dd359ec952f9bf108a1c1ef20cdbaab89ee50c..2e22133591c27347835832b483bb2ad63aa825ba 100644 (file)
@@ -23,6 +23,7 @@
 
 #include <common.h>
 #include <ns16550.h>
+#include <linux/compiler.h>
 #include <asm/io.h>
 #include <asm/arch/tegra2.h>
 #include <asm/arch/sys_proto.h>
 #include <asm/arch/board.h>
 #include <asm/arch/clk_rst.h>
 #include <asm/arch/clock.h>
+#include <asm/arch/emc.h>
 #include <asm/arch/pinmux.h>
+#include <asm/arch/pmc.h>
+#include <asm/arch/pmu.h>
 #include <asm/arch/uart.h>
+#include <asm/arch/warmboot.h>
 #include <spi.h>
 #include <asm/arch/usb.h>
 #include <i2c.h>
 #include "board.h"
+#include "emc.h"
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -58,12 +64,29 @@ void __pin_mux_usb(void)
 
 void pin_mux_usb(void) __attribute__((weak, alias("__pin_mux_usb")));
 
+/*
+ * Routine: power_det_init
+ * Description: turn off power detects
+ */
+static void power_det_init(void)
+{
+#if defined(CONFIG_TEGRA2)
+       struct pmc_ctlr *const pmc = (struct pmc_ctlr *)TEGRA2_PMC_BASE;
+
+       /* turn off power detects */
+       writel(0, &pmc->pmc_pwr_det_latch);
+       writel(0, &pmc->pmc_pwr_det);
+#endif
+}
+
 /*
  * Routine: board_init
  * Description: Early hardware init.
  */
 int board_init(void)
 {
+       __maybe_unused int err;
+
        /* Do clocks and UART first so that printf() works */
        clock_init();
        clock_verify();
@@ -76,18 +99,35 @@ int board_init(void)
 #endif
        /* boot param addr */
        gd->bd->bi_boot_params = (NV_PA_SDRAM_BASE + 0x100);
+
+       power_det_init();
+
 #ifdef CONFIG_TEGRA_I2C
 #ifndef CONFIG_SYS_I2C_INIT_BOARD
 #error "You must define CONFIG_SYS_I2C_INIT_BOARD to use i2c on Nvidia boards"
 #endif
        i2c_init_board();
-#endif
+# ifdef CONFIG_TEGRA_PMU
+       if (pmu_set_nominal())
+               debug("Failed to select nominal voltages\n");
+#  ifdef CONFIG_TEGRA_CLOCK_SCALING
+       err = board_emc_init();
+       if (err)
+               debug("Memory controller init failed: %d\n", err);
+#  endif
+# endif /* CONFIG_TEGRA_PMU */
+#endif /* CONFIG_TEGRA_I2C */
 
 #ifdef CONFIG_USB_EHCI_TEGRA
        pin_mux_usb();
        board_usb_init(gd->fdt_blob);
 #endif
 
+#ifdef CONFIG_TEGRA2_LP0
+       /* prepare the WB code to LP0 location */
+       warmboot_prepare_code(TEGRA_LP0_ADDR, TEGRA_LP0_SIZE);
+#endif
+
        return 0;
 }
 
diff --git a/board/nvidia/common/emc.c b/board/nvidia/common/emc.c
new file mode 100644 (file)
index 0000000..8e4290c
--- /dev/null
@@ -0,0 +1,53 @@
+/*
+ * 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 <asm/io.h>
+#include <asm/arch/ap20.h>
+#include <asm/arch/clk_rst.h>
+#include <asm/arch/clock.h>
+#include <asm/arch/emc.h>
+#include <asm/arch/pmu.h>
+#include <asm/arch/sys_proto.h>
+#include <asm/arch/tegra2.h>
+
+DECLARE_GLOBAL_DATA_PTR;
+
+/* These rates are hard-coded for now, until fdt provides them */
+#define EMC_SDRAM_RATE_T20     (333000 * 2 * 1000)
+#define EMC_SDRAM_RATE_T25     (380000 * 2 * 1000)
+
+int board_emc_init(void)
+{
+       unsigned rate;
+
+       switch (tegra_get_chip_type()) {
+       default:
+       case TEGRA_SOC_T20:
+               rate  = EMC_SDRAM_RATE_T20;
+               break;
+       case TEGRA_SOC_T25:
+               rate  = EMC_SDRAM_RATE_T25;
+               break;
+       }
+       return tegra_set_emc(gd->fdt_blob, rate);
+}
diff --git a/board/nvidia/common/emc.h b/board/nvidia/common/emc.h
new file mode 100644 (file)
index 0000000..ec1b115
--- /dev/null
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 2011 The Chromium OS Authors.
+ * (C) Copyright 2010,2011 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 _NVIDIA_EMC_H_
+#define _NVIDIA_EMC_H_
+
+int board_emc_init(void);
+
+#endif
index 6ba3ec48f17788e584ef7807e3bbb4f026ff24eb..335253953b28600bee2bc03221a074357cdf505f 100644 (file)
        i2c@7000c500 {
                clock-frequency = <100000>;
        };
+
+       emc@7000f400 {
+               emc-table@190000 {
+                       reg = < 190000 >;
+                       compatible = "nvidia,tegra20-emc-table";
+                       clock-frequency = < 190000 >;
+                       nvidia,emc-registers = < 0x0000000c 0x00000026
+                               0x00000009 0x00000003 0x00000004 0x00000004
+                               0x00000002 0x0000000c 0x00000003 0x00000003
+                               0x00000002 0x00000001 0x00000004 0x00000005
+                               0x00000004 0x00000009 0x0000000d 0x0000059f
+                               0x00000000 0x00000003 0x00000003 0x00000003
+                               0x00000003 0x00000001 0x0000000b 0x000000c8
+                               0x00000003 0x00000007 0x00000004 0x0000000f
+                               0x00000002 0x00000000 0x00000000 0x00000002
+                               0x00000000 0x00000000 0x00000083 0xa06204ae
+                               0x007dc010 0x00000000 0x00000000 0x00000000
+                               0x00000000 0x00000000 0x00000000 0x00000000 >;
+               };
+               emc-table@380000 {
+                       reg = < 380000 >;
+                       compatible = "nvidia,tegra20-emc-table";
+                       clock-frequency = < 380000 >;
+                       nvidia,emc-registers = < 0x00000017 0x0000004b
+                               0x00000012 0x00000006 0x00000004 0x00000005
+                               0x00000003 0x0000000c 0x00000006 0x00000006
+                               0x00000003 0x00000001 0x00000004 0x00000005
+                               0x00000004 0x00000009 0x0000000d 0x00000b5f
+                               0x00000000 0x00000003 0x00000003 0x00000006
+                               0x00000006 0x00000001 0x00000011 0x000000c8
+                               0x00000003 0x0000000e 0x00000007 0x0000000f
+                               0x00000002 0x00000000 0x00000000 0x00000002
+                               0x00000000 0x00000000 0x00000083 0xe044048b
+                               0x007d8010 0x00000000 0x00000000 0x00000000
+                               0x00000000 0x00000000 0x00000000 0x00000000 >;
+               };
+       };
+
+       kbc@7000e200 {
+               linux,keymap = <0x00020011 0x0003001f 0x0004001e 0x0005002c
+                       0x000701d0 0x0107007d 0x02060064 0x02070038 0x03000006
+                       0x03010005 0x03020013 0x03030012 0x03040021 0x03050020
+                       0x0306002d 0x04000008 0x04010007 0x04020014 0x04030023
+                       0x04040022 0x0405002f 0x0406002e 0x04070039 0x0500000a
+                       0x05010009 0x05020016 0x05030015 0x05040024 0x05050031
+                       0x05060030 0x0507002b 0x0600000c 0x0601000b 0x06020018
+                       0x06030017 0x06040026 0x06050025 0x06060033 0x06070032
+                       0x0701000d 0x0702001b 0x0703001c 0x0707008b 0x08040036
+                       0x0805002a 0x09050061 0x0907001d 0x0b00001a 0x0b010019
+                       0x0b020028 0x0b030027 0x0b040035 0x0b050034 0x0c000044
+                       0x0c010043 0x0c02000e 0x0c030004 0x0c040003 0x0c050067
+                       0x0c0600d2 0x0c070077 0x0d00006e 0x0d01006f 0x0d030068
+                       0x0d04006d 0x0d05006a 0x0d06006c 0x0d070069 0x0e000057
+                       0x0e010058 0x0e020042 0x0e030010 0x0e04003e 0x0e05003d
+                       0x0e060002 0x0e070041 0x0f000001 0x0f010029 0x0f02003f
+                       0x0f03000f 0x0f04003b 0x0f05003c 0x0f06003a 0x0f070040
+                       0x14000047 0x15000049 0x15010048 0x1502004b 0x1504004f
+                       0x16010062 0x1602004d 0x1603004c 0x16040051 0x16050050
+                       0x16070052 0x1b010037 0x1b03004a 0x1b04004e 0x1b050053
+                       0x1c050073 0x1d030066 0x1d04006b 0x1d0500e0 0x1d060072
+                       0x1d0700e1 0x1e000045 0x1e010046 0x1e020071
+                       0x1f04008a>;
+               linux,fn-keymap = <0x05040002>;
+       };
 };
index f369598d77e825f20580fa764421246b33438303..3a62e9d6330b7b326cfd570a95e9f7f9d238116e 100644 (file)
@@ -32,6 +32,7 @@
 #include <common.h>
 #include <twl4030.h>
 #include <asm/io.h>
+#include <asm/gpio.h>
 #include <asm/arch/mmc_host_def.h>
 #include <asm/arch/mux.h>
 #include <asm/arch/gpio.h>
@@ -45,6 +46,10 @@ DECLARE_GLOBAL_DATA_PTR;
 #define TWL4030_BB_CFG_BBSEL_3200MV    (3 << 2)
 #define TWL4030_BB_CFG_BBISEL_500UA    2
 
+#define CONTROL_WKUP_CTRL              0x48002a5c
+#define GPIO_IO_PWRDNZ                 (1 << 6)
+#define PBIASLITEVMODE1                        (1 << 8)
+
 /*
  * Routine: board_init
  * Description: Early hardware init.
@@ -60,29 +65,52 @@ int board_init(void)
        return 0;
 }
 
+static void set_output_gpio(unsigned int gpio, int value)
+{
+       int ret;
+
+       ret = gpio_request(gpio, "");
+       if (ret != 0) {
+               printf("could not request GPIO %u\n", gpio);
+               return;
+       }
+       ret = gpio_direction_output(gpio, value);
+       if (ret != 0)
+               printf("could not set GPIO %u to %d\n", gpio, value);
+}
+
 /*
  * Routine: misc_init_r
  * Description: Configure board specific parts
  */
 int misc_init_r(void)
 {
-       struct gpio *gpio1_base = (struct gpio *)OMAP34XX_GPIO1_BASE;
-       struct gpio *gpio4_base = (struct gpio *)OMAP34XX_GPIO4_BASE;
-       struct gpio *gpio5_base = (struct gpio *)OMAP34XX_GPIO5_BASE;
-       struct gpio *gpio6_base = (struct gpio *)OMAP34XX_GPIO6_BASE;
+       t2_t *t2_base = (t2_t *)T2_BASE;
+       u32 pbias_lite;
 
        twl4030_led_init(TWL4030_LED_LEDEN_LEDBON);
 
-       /* Configure GPIOs to output */
-       writel(~(GPIO14 | GPIO15 | GPIO16 | GPIO23), &gpio1_base->oe);
-       writel(~GPIO22, &gpio4_base->oe);       /* 118 */
-       writel(~(GPIO0 | GPIO1 | GPIO28 | GPIO29 | GPIO30 | GPIO31),
-               &gpio5_base->oe);       /* 128, 129, 156-159 */
-       writel(~GPIO4, &gpio6_base->oe);        /* 164 */
+       /* set up dual-voltage GPIOs to 1.8V */
+       pbias_lite = readl(&t2_base->pbias_lite);
+       pbias_lite &= ~PBIASLITEVMODE1;
+       pbias_lite |= PBIASLITEPWRDNZ1;
+       writel(pbias_lite, &t2_base->pbias_lite);
+       if (get_cpu_family() == CPU_OMAP36XX)
+               writel(readl(CONTROL_WKUP_CTRL) | GPIO_IO_PWRDNZ,
+                       CONTROL_WKUP_CTRL);
+
+       /* make sure audio and BT chips are in powerdown state */
+       set_output_gpio(14, 0);
+       set_output_gpio(15, 0);
+       set_output_gpio(118, 0);
+
+       /* enable USB supply */
+       set_output_gpio(164, 1);
 
-       /* Set GPIOs */
-       writel(GPIO28, &gpio5_base->setdataout);
-       writel(GPIO4, &gpio6_base->setdataout);
+       /* wifi needs a short pulse to enter powersave state */
+       set_output_gpio(23, 1);
+       udelay(5000);
+       gpio_direction_output(23, 0);
 
        /* Enable battery backup capacitor (3.2V, 0.5mA charge current) */
        twl4030_i2c_write_u8(TWL4030_CHIP_PM_RECEIVER,
@@ -103,6 +131,9 @@ int misc_init_r(void)
 void set_muxconf_regs(void)
 {
        MUX_PANDORA();
+       if (get_cpu_family() == CPU_OMAP36XX) {
+               MUX_PANDORA_3730();
+       }
 }
 
 #ifdef CONFIG_GENERIC_MMC
index f0ad16b0a407345cf9497fb8d1bd878c193198d4..fea8bf259a830f5f60677cf15883130c688bf2bd 100644 (file)
@@ -399,4 +399,10 @@ const omap3_sysinfo sysinfo = {
        MUX_VAL(CP(SDRC_CKE0),          (IDIS | PTU | EN  | M0)) /*sdrc_cke0*/\
        MUX_VAL(CP(SDRC_CKE1),          (IDIS | PTU | EN  | M0)) /*sdrc_cke1*/
 
+#define MUX_PANDORA_3730() \
+       MUX_VAL(CP(GPIO126),            (IEN  | PTD | DIS | M4)) /*GPIO_126 - MMC1_WP*/\
+       MUX_VAL(CP(GPIO127),            (IEN  | PTD | DIS | M4)) /*GPIO_127 - MMC2_WP*/\
+       MUX_VAL(CP(GPIO128),            (IDIS | PTD | DIS | M4)) /*GPIO_128 - LED_MMC1*/\
+       MUX_VAL(CP(GPIO129),            (IDIS | PTD | DIS | M4)) /*GPIO_129 - LED_MMC2*/
+
 #endif
index c2ccef3381b5e2f3011f2145f5b2e8a9b850e942..c833541fd03e39a969c01dda9433effcba83b498 100644 (file)
 /* Setting TZPC[TrustZone Protection Controller] */
 void tzpc_init(void)
 {
-       struct exynos5_tzpc *tzpc;
+       struct exynos_tzpc *tzpc;
        unsigned int addr;
 
        for (addr = TZPC0_BASE; addr <= TZPC9_BASE; addr += TZPC_BASE_OFFSET) {
-               tzpc = (struct exynos5_tzpc *)addr;
+               tzpc = (struct exynos_tzpc *)addr;
 
                if (addr == TZPC0_BASE)
                        writel(R0SIZE, &tzpc->r0size);
index aa4291df4aba82a484172b507646d15abf24d099..3085de1a145064aa1338ca2d4cc0f4be908abb0f 100644 (file)
@@ -2,6 +2,7 @@
  * Copyright (C) 2011 Samsung Electronics
  * Heungjun Kim <riverful.kim@samsung.com>
  * Kyungmin Park <kyungmin.park@samsung.com>
+ * Donghwa Lee <dh09.lee@samsung.com>
  *
  * See file CREDITS for list of people who contributed to this
  * project.
  */
 
 #include <common.h>
+#include <lcd.h>
 #include <asm/io.h>
 #include <asm/arch/cpu.h>
 #include <asm/arch/gpio.h>
 #include <asm/arch/mmc.h>
 #include <asm/arch/clock.h>
+#include <asm/arch/clk.h>
+#include <asm/arch/mipi_dsim.h>
 #include <asm/arch/watchdog.h>
 #include <asm/arch/power.h>
 #include <pmic.h>
 #include <usb/s3c_udc.h>
-#include <max8998_pmic.h>
+#include <max8997_pmic.h>
 
 #include "setup.h"
 
@@ -216,26 +220,19 @@ static int s5pc210_phy_control(int on)
                return -1;
 
        if (on) {
-               ret |= pmic_set_output(p,
-                                      MAX8998_REG_BUCK_ACTIVE_DISCHARGE3,
-                                      MAX8998_SAFEOUT1, LDO_ON);
-               ret |= pmic_set_output(p, MAX8998_REG_ONOFF1,
-                                     MAX8998_LDO3, LDO_ON);
-               ret |= pmic_set_output(p, MAX8998_REG_ONOFF2,
-                                     MAX8998_LDO8, LDO_ON);
-
+               ret |= pmic_set_output(p, MAX8997_REG_SAFEOUTCTRL,
+                                     ENSAFEOUT1, LDO_ON);
+               ret |= pmic_reg_write(p, MAX8997_REG_LDO3CTRL, EN_LDO);
+               ret |= pmic_reg_write(p, MAX8997_REG_LDO8CTRL, EN_LDO);
        } else {
-               ret |= pmic_set_output(p, MAX8998_REG_ONOFF2,
-                                     MAX8998_LDO8, LDO_OFF);
-               ret |= pmic_set_output(p, MAX8998_REG_ONOFF1,
-                                     MAX8998_LDO3, LDO_OFF);
-               ret |= pmic_set_output(p,
-                                      MAX8998_REG_BUCK_ACTIVE_DISCHARGE3,
-                                      MAX8998_SAFEOUT1, LDO_OFF);
+               ret |= pmic_reg_write(p, MAX8997_REG_LDO8CTRL, DIS_LDO);
+               ret |= pmic_reg_write(p, MAX8997_REG_LDO3CTRL, DIS_LDO);
+               ret |= pmic_set_output(p, MAX8997_REG_SAFEOUTCTRL,
+                                     ENSAFEOUT1, LDO_OFF);
        }
 
        if (ret) {
-               puts("MAX8998 LDO setting error!\n");
+               puts("MAX8997 LDO setting error!\n");
                return -1;
        }
 
@@ -364,3 +361,145 @@ int board_early_init_f(void)
 
        return 0;
 }
+
+static void lcd_reset(void)
+{
+       struct exynos4_gpio_part2 *gpio2 =
+               (struct exynos4_gpio_part2 *)samsung_get_base_gpio_part2();
+
+       s5p_gpio_direction_output(&gpio2->y4, 5, 1);
+       udelay(10000);
+       s5p_gpio_direction_output(&gpio2->y4, 5, 0);
+       udelay(10000);
+       s5p_gpio_direction_output(&gpio2->y4, 5, 1);
+}
+
+static int lcd_power(void)
+{
+       int ret = 0;
+       struct pmic *p = get_pmic();
+
+       if (pmic_probe(p))
+               return 0;
+
+       /* LDO15 voltage: 2.2v */
+       ret |= pmic_reg_write(p, MAX8997_REG_LDO15CTRL, 0x1c | EN_LDO);
+       /* LDO13 voltage: 3.0v */
+       ret |= pmic_reg_write(p, MAX8997_REG_LDO13CTRL, 0x2c | EN_LDO);
+
+       if (ret) {
+               puts("MAX8997 LDO setting error!\n");
+               return -1;
+       }
+
+       return 0;
+}
+
+static struct mipi_dsim_config dsim_config = {
+       .e_interface            = DSIM_VIDEO,
+       .e_virtual_ch           = DSIM_VIRTUAL_CH_0,
+       .e_pixel_format         = DSIM_24BPP_888,
+       .e_burst_mode           = DSIM_BURST_SYNC_EVENT,
+       .e_no_data_lane         = DSIM_DATA_LANE_4,
+       .e_byte_clk             = DSIM_PLL_OUT_DIV8,
+       .hfp                    = 1,
+
+       .p                      = 3,
+       .m                      = 120,
+       .s                      = 1,
+
+       /* D-PHY PLL stable time spec :min = 200usec ~ max 400usec */
+       .pll_stable_time        = 500,
+
+       /* escape clk : 10MHz */
+       .esc_clk                = 20 * 1000000,
+
+       /* stop state holding counter after bta change count 0 ~ 0xfff */
+       .stop_holding_cnt       = 0x7ff,
+       /* bta timeout 0 ~ 0xff */
+       .bta_timeout            = 0xff,
+       /* lp rx timeout 0 ~ 0xffff */
+       .rx_timeout             = 0xffff,
+};
+
+static struct exynos_platform_mipi_dsim s6e8ax0_platform_data = {
+       .lcd_panel_info = NULL,
+       .dsim_config = &dsim_config,
+};
+
+static struct mipi_dsim_lcd_device mipi_lcd_device = {
+       .name   = "s6e8ax0",
+       .id     = -1,
+       .bus_id = 0,
+       .platform_data  = (void *)&s6e8ax0_platform_data,
+};
+
+static int mipi_power(void)
+{
+       int ret = 0;
+       struct pmic *p = get_pmic();
+
+       if (pmic_probe(p))
+               return 0;
+
+       /* LDO3 voltage: 1.1v */
+       ret |= pmic_reg_write(p, MAX8997_REG_LDO3CTRL, 0x6 | EN_LDO);
+       /* LDO4 voltage: 1.8v */
+       ret |= pmic_reg_write(p, MAX8997_REG_LDO4CTRL, 0x14 | EN_LDO);
+
+       if (ret) {
+               puts("MAX8997 LDO setting error!\n");
+               return -1;
+       }
+
+       return 0;
+}
+
+void init_panel_info(vidinfo_t *vid)
+{
+       vid->vl_freq    = 60;
+       vid->vl_col     = 720;
+       vid->vl_row     = 1280;
+       vid->vl_width   = 720;
+       vid->vl_height  = 1280;
+       vid->vl_clkp    = CONFIG_SYS_HIGH;
+       vid->vl_hsp     = CONFIG_SYS_LOW;
+       vid->vl_vsp     = CONFIG_SYS_LOW;
+       vid->vl_dp      = CONFIG_SYS_LOW;
+
+       vid->vl_bpix    = 5;
+       vid->dual_lcd_enabled = 0;
+
+       /* s6e8ax0 Panel */
+       vid->vl_hspw    = 5;
+       vid->vl_hbpd    = 10;
+       vid->vl_hfpd    = 10;
+
+       vid->vl_vspw    = 2;
+       vid->vl_vbpd    = 1;
+       vid->vl_vfpd    = 13;
+       vid->vl_cmd_allow_len = 0xf;
+
+       vid->win_id = 3;
+       vid->cfg_gpio = NULL;
+       vid->backlight_on = NULL;
+       vid->lcd_power_on = NULL;       /* lcd_power_on in mipi dsi driver */
+       vid->reset_lcd = lcd_reset;
+
+       vid->init_delay = 0;
+       vid->power_on_delay = 0;
+       vid->reset_delay = 0;
+       vid->interface_mode = FIMD_RGB_INTERFACE;
+       vid->mipi_enabled = 1;
+
+       strcpy(s6e8ax0_platform_data.lcd_panel_name, mipi_lcd_device.name);
+       s6e8ax0_platform_data.lcd_power = lcd_power;
+       s6e8ax0_platform_data.mipi_power = mipi_power;
+       s6e8ax0_platform_data.phy_enable = set_mipi_phy_ctrl;
+       s6e8ax0_platform_data.lcd_panel_info = (void *)vid;
+       exynos_mipi_dsi_register_lcd_device(&mipi_lcd_device);
+       s6e8ax0_init();
+       exynos_set_dsim_platform_data(&s6e8ax0_platform_data);
+
+       setenv("lcdinfo", "lcd=s6e8ax0");
+}
index d0ff8341f648f3496cc14927338d0349ec134634..90fff5cf5e181af64cfd56b53937d64daac916bd 100644 (file)
@@ -58,13 +58,13 @@ int board_init(void)
        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);
-
 #if defined(CONFIG_PMIC)
        pmic_init();
 #endif
 
+       check_hw_revision();
+       printf("HW Revision:\t0x%x\n", board_rev);
+
        return 0;
 }
 
@@ -109,10 +109,27 @@ static unsigned short get_adc_value(int channel)
        return ret;
 }
 
+static int adc_power_control(int on)
+{
+       int ret;
+       struct pmic *p = get_pmic();
+
+       if (pmic_probe(p))
+               return -1;
+
+       ret = pmic_set_output(p,
+                             MAX8998_REG_ONOFF1,
+                             MAX8998_LDO4, !!on);
+
+       return ret;
+}
+
 static unsigned int get_hw_revision(void)
 {
        int hwrev, mode0, mode1;
 
+       adc_power_control(1);
+
        mode0 = get_adc_value(1);               /* HWREV_MODE0 */
        mode1 = get_adc_value(2);               /* HWREV_MODE1 */
 
@@ -135,6 +152,8 @@ static unsigned int get_hw_revision(void)
 
        debug("mode0: %d, mode1: %d, hwrev 0x%x\n", mode0, mode1, hwrev);
 
+       adc_power_control(0);
+
        return hwrev;
 }
 
index c7aedc95a625dc7ecf782312255ff57d57a4e872..9fbaedd79205de2b823019cbbe1655ed92e3530d 100644 (file)
@@ -196,13 +196,6 @@ int board_init(void)
        return 0;
 }
 
-int misc_init_r(void)
-{
-       dieid_num_r();
-
-       return 0;
-}
-
 /*
  * Routine: set_muxconf_regs
  * Description: Setting up the configuration Mux registers specific to the
index 13dc60361a272281439be39c85795f7e54a77a3e..f87a4975c9c0b995ab743335e6c73e92d7a2e7e3 100644 (file)
@@ -29,11 +29,8 @@ DECLARE_GLOBAL_DATA_PTR;
 /*
  * Basic board specific setup
  */
-int init_basic_setup(void)
+static int init_basic_setup(void)
 {
-       /* Initialize the Timer */
-       init_timer();
-
        /* address of boot parameters */
        gd->bd->bi_boot_params = PHYS_DRAM_1 + 0x100;
 
index 6f0e763f0117ec0a6ed0c7ea7d5917cfdaf0eaab..fac683a7e63ce415b2868487efd2e2b5858cd22f 100644 (file)
@@ -81,13 +81,6 @@ int board_init (void)
        return 0;
 }
 
-
-int misc_init_r (void)
-{
-       /* currently empty */
-       return (0);
-}
-
 /******************************
  Routine:
  Description:
index 88dac80225e4c62fb4f9a8d4d9e73f319e005085..c8dfdf814299f83ecb78a8f93ef9629e9c264ad7 100644 (file)
@@ -23,7 +23,7 @@
  * MA 02111-1307 USA
  */
 #include <common.h>
-#include <twl6030.h>
+#include <twl6035.h>
 #include <asm/arch/sys_proto.h>
 #include <asm/arch/mmc_host_def.h>
 
@@ -63,8 +63,8 @@ int board_eth_init(bd_t *bis)
  */
 int misc_init_r(void)
 {
-#ifdef CONFIG_TWL6030_POWER
-       twl6030_init_battery_charging();
+#ifdef CONFIG_TWL6035_POWER
+       twl6035_init_settings();
 #endif
        return 0;
 }
index 954ced5efe57caad12cb3bf803faf3457e330e83..36204b2c88e6d50e6d3bcc4b43702fd0ac566cce 100644 (file)
@@ -129,12 +129,6 @@ int board_init (void)
        return 0;
 }
 
-int misc_init_r (void)
-{
-       /* currently empty */
-       return (0);
-}
-
 /******************************
  Routine:
  Description:
index 3efc22a0284d1626a7a04997a7388d5eb37f0cba..dc8b3886c299dd425943ac7e4c2f8c7ec00a2f8b 100644 (file)
@@ -168,10 +168,10 @@ const struct pad_conf_entry core_padconf_array_non_essential[] = {
        {ABE_DMIC_DIN1, (IEN | M0)},                                    /* abe_dmic_din1 */
        {ABE_DMIC_DIN2, (PTU | IEN | M3)},                              /* gpio_121 */
        {ABE_DMIC_DIN3, (IEN | M0)},                                    /* abe_dmic_din3 */
-       {UART2_CTS, (PTU | IEN | M0)},                                  /* uart2_cts */
-       {UART2_RTS, (M0)},                                              /* uart2_rts */
-       {UART2_RX, (PTU | IEN | M0)},                                   /* uart2_rx */
-       {UART2_TX, (M0)},                                               /* uart2_tx */
+       {UART2_CTS, (PTU | IEN | M7)},                                  /* uart2_cts */
+       {UART2_RTS, (M7)},                                              /* uart2_rts */
+       {UART2_RX, (PTU | IEN | M7)},                                   /* uart2_rx */
+       {UART2_TX, (M7)},                                               /* uart2_tx */
        {HDQ_SIO, (M3)},                                                /* gpio_127 */
        {MCSPI1_CLK, (IEN | OFF_EN | OFF_PD | OFF_IN | M0)},            /* mcspi1_clk */
        {MCSPI1_SOMI, (IEN | OFF_EN | OFF_PD | OFF_IN | M0)},           /* mcspi1_somi */
index 282de95e951742bc25b83c9d4c48c62ec7ca5d51..d1bf9d680b8844624be422db895fa69721640afc 100644 (file)
@@ -604,7 +604,7 @@ void lcd_enable(void)
        gpio_set_value(2, 1);
        mxc_request_iomux(MX51_PIN_GPIO1_2, IOMUX_CONFIG_ALT0);
 
-       ret = mx51_fb_init(&nec_nl6448bc26_09c, 0, IPU_PIX_FMT_RGB666);
+       ret = mx5_fb_init(&nec_nl6448bc26_09c, 0, IPU_PIX_FMT_RGB666, 16);
        if (ret)
                puts("LCD cannot be configured\n");
 }
index 4d839d2ab2005da20205861ee16294ba68f6fcae..39a726995e2e209407854d58a4fea54c674a6d64 100644 (file)
@@ -160,6 +160,8 @@ devkit3250                   arm         arm926ejs   devkit3250          timll
 jadecpu                      arm         arm926ejs   jadecpu             syteco         mb86r0x
 mx25pdk                      arm         arm926ejs   mx25pdk             freescale      mx25           mx25pdk:IMX_CONFIG=board/freescale/mx25pdk/imximage.cfg
 tx25                         arm         arm926ejs   tx25                karo           mx25
+tx28-40xx                    arm         arm926ejs   tx28                karo           mx28           tx28:TX28
+tx28-41xx                    arm         arm926ejs   tx28                karo           mx28           tx28:TX28_S
 zmx25                        arm         arm926ejs   zmx25               syteco         mx25
 imx27lite                    arm         arm926ejs   imx27lite           logicpd        mx27
 magnesium                    arm         arm926ejs   imx27lite           logicpd        mx27
@@ -184,6 +186,8 @@ integratorap_cm946es         arm         arm946es    integrator          armltd
 integratorcp_cm946es         arm         arm946es    integrator          armltd         -               integratorcp:CM946ES
 ca9x4_ct_vxp                 arm         armv7       vexpress            armltd
 am335x_evm                   arm         armv7       am335x              ti             am33xx
+tx48                         arm         armv7       tx48                karo           am33xx         tx48:SYS_MPU_CLK=500,SYS_DDR_CLK=266
+tx48-dt                      arm         armv7       tx48                karo           am33xx         tx48:OF_LIBFDT,SYS_MPU_CLK=720,SYS_DDR_CLK=444
 highbank                     arm         armv7       highbank            -              highbank
 efikamx                      arm         armv7       efikamx             -              mx5            efikamx:MACH_TYPE=MACH_TYPE_MX51_EFIKAMX,IMX_CONFIG=board/efikamx/imximage_mx.cfg
 efikasb                      arm         armv7       efikamx             -              mx5            efikamx:MACH_TYPE=MACH_TYPE_MX51_EFIKASB,IMX_CONFIG=board/efikamx/imximage_sb.cfg
@@ -192,7 +196,18 @@ mx53ard                      arm         armv7       mx53ard             freesca
 mx53evk                      arm         armv7       mx53evk             freescale      mx5            mx53evk:IMX_CONFIG=board/freescale/mx53evk/imximage.cfg
 mx53loco                     arm         armv7       mx53loco            freescale      mx5            mx53loco:IMX_CONFIG=board/freescale/mx53loco/imximage.cfg
 mx53smd                      arm         armv7       mx53smd             freescale      mx5            mx53smd:IMX_CONFIG=board/freescale/mx53smd/imximage.cfg
+ima3-mx53                    arm         armv7       ima3-mx53           esg            mx5            ima3-mx53:IMX_CONFIG=board/esg/ima3-mx53/imximage.cfg
 vision2                      arm         armv7       vision2             ttcontrol      mx5            vision2:IMX_CONFIG=board/ttcontrol/vision2/imximage_hynix.cfg
+tx51-6xx0                    arm         armv7       tx51                karo           mx5            tx51:SYS_CPU_CLK=600,NR_DRAM_BANKS=1,SYS_SDRAM_CLK=166
+tx51-6xx1                    arm         armv7       tx51                karo           mx5            tx51:SYS_CPU_CLK=600,NR_DRAM_BANKS=2,SYS_SDRAM_CLK=200
+tx51-6xx2                    arm         armv7       tx51                karo           mx5            tx51:SYS_CPU_CLK=600,NR_DRAM_BANKS=2,SYS_SDRAM_CLK=166
+tx51-8xx0                    arm         armv7       tx51                karo           mx5            tx51:SYS_CPU_CLK=800,NR_DRAM_BANKS=1,SYS_SDRAM_CLK=166
+tx51-8xx1                    arm         armv7       tx51                karo           mx5            tx51:SYS_CPU_CLK=800,NR_DRAM_BANKS=2,SYS_SDRAM_CLK=200
+tx51-8xx2                    arm         armv7       tx51                karo           mx5            tx51:SYS_CPU_CLK=800,NR_DRAM_BANKS=2,SYS_SDRAM_CLK=166
+tx53-xx20                   arm         armv7       tx53                karo           mx5             tx53:NR_DRAM_BANKS=1,SYS_TX53_HWREV_2
+tx53-xx21                   arm         armv7       tx53                karo           mx5             tx53:NR_DRAM_BANKS=2,SYS_TX53_HWREV_2
+tx53-xx30                   arm         armv7       tx53                karo           mx5             tx53:NR_DRAM_BANKS=1
+tx53-xx31                   arm         armv7       tx53                karo           mx5             tx53:NR_DRAM_BANKS=2
 mx6qarm2                     arm         armv7       mx6qarm2            freescale      mx6            mx6qarm2:IMX_CONFIG=board/freescale/mx6qarm2/imximage.cfg
 mx6qsabrelite                arm         armv7       mx6qsabrelite       freescale      mx6            mx6qsabrelite:IMX_CONFIG=board/freescale/mx6qsabrelite/imximage.cfg
 cm_t35                       arm         armv7       cm_t35              -              omap3
index 6e23baaf6144274193a892bce44d57fbbd5cbb3c..f7b76384aed452ed8689875548b18f62e7969a47 100644 (file)
@@ -51,6 +51,9 @@ XCOBJS-$(CONFIG_ENV_IS_EMBEDDED) += env_embedded.o
 COBJS-$(CONFIG_ENV_IS_IN_EEPROM) += env_embedded.o
 XCOBJS-$(CONFIG_ENV_IS_IN_FLASH) += env_embedded.o
 COBJS-$(CONFIG_ENV_IS_IN_NVRAM) += env_embedded.o
+COBJS-$(CONFIG_ENV_IS_IN_MMC) += env_embedded.o
+COBJS-$(CONFIG_ENV_IS_IN_NAND) += env_embedded.o
+COBJS-$(CONFIG_ENV_IS_IN_SPI_FLASH) += env_embedded.o
 COBJS-$(CONFIG_ENV_IS_IN_FLASH) += env_flash.o
 COBJS-$(CONFIG_ENV_IS_IN_MG_DISK) += env_mgdisk.o
 COBJS-$(CONFIG_ENV_IS_IN_MMC) += env_mmc.o
@@ -69,6 +72,7 @@ COBJS-$(CONFIG_CMD_SOURCE) += cmd_source.o
 COBJS-$(CONFIG_CMD_BDI) += cmd_bdinfo.o
 COBJS-$(CONFIG_CMD_BEDBUG) += bedbug.o cmd_bedbug.o
 COBJS-$(CONFIG_CMD_BMP) += cmd_bmp.o
+COBJS-$(CONFIG_CMD_BOOTCE) += cmd_bootce.o
 COBJS-$(CONFIG_CMD_BOOTLDR) += cmd_bootldr.o
 COBJS-$(CONFIG_CMD_CACHE) += cmd_cache.o
 COBJS-$(CONFIG_CMD_CONSOLE) += cmd_console.o
@@ -99,6 +103,7 @@ ifdef CONFIG_FPGA
 COBJS-$(CONFIG_CMD_FPGA) += cmd_fpga.o
 endif
 COBJS-$(CONFIG_CMD_GPIO) += cmd_gpio.o
+COBJS-$(CONFIG_CMD_IIM) += cmd_iim.o
 COBJS-$(CONFIG_CMD_I2C) += cmd_i2c.o
 COBJS-$(CONFIG_CMD_IDE) += cmd_ide.o
 COBJS-$(CONFIG_CMD_IMMAP) += cmd_immap.o
@@ -132,6 +137,7 @@ COBJS-$(CONFIG_CMD_NAND) += cmd_nand.o
 COBJS-$(CONFIG_CMD_NET) += cmd_net.o
 COBJS-$(CONFIG_CMD_ONENAND) += cmd_onenand.o
 COBJS-$(CONFIG_CMD_OTP) += cmd_otp.o
+COBJS-$(CONFIG_CMD_PATA) += cmd_pata.o
 ifdef CONFIG_PCI
 COBJS-$(CONFIG_CMD_PCI) += cmd_pci.o
 endif
diff --git a/common/cmd_bootce.c b/common/cmd_bootce.c
new file mode 100644 (file)
index 0000000..78bed8d
--- /dev/null
@@ -0,0 +1,1043 @@
+/*
+ * Copyright (C) 2012 Lothar Waßmann <LW@KARO-electronics.de>
+ * based on: code from RedBoot (C) Uwe Steinkohl <US@KARO-electronics.de>
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+#include <common.h>
+#include <command.h>
+#include <net.h>
+#include <wince.h>
+#include <asm/errno.h>
+
+DECLARE_GLOBAL_DATA_PTR;
+
+#define WINCE_VRAM_BASE                0x80000000
+#define CE_FIX_ADDRESS(a)      ((void *)((a) - WINCE_VRAM_BASE + CONFIG_SYS_SDRAM_BASE))
+
+#ifndef INT_MAX
+#define INT_MAX                        ((1U << (sizeof(int) * 8 - 1)) - 1)
+#endif
+
+/* Bin image parse states */
+#define CE_PS_RTI_ADDR         0
+#define CE_PS_RTI_LEN          1
+#define CE_PS_E_ADDR           2
+#define CE_PS_E_LEN            3
+#define CE_PS_E_CHKSUM         4
+#define CE_PS_E_DATA           5
+
+#define CE_MIN(a, b)           (((a) < (b)) ? (a) : (b))
+#define CE_MAX(a, b)           (((a) > (b)) ? (a) : (b))
+
+#define _STRMAC(s)             #s
+#define STRMAC(s)              _STRMAC(s)
+
+static ce_bin __attribute__ ((aligned (32))) g_bin;
+static ce_net __attribute__ ((aligned (32))) g_net;
+
+static inline void print_IPaddr(IPaddr_t ip)
+{
+       printf("%d.%d.%d.%d",
+               ip & 0xff,
+               (ip >> 8) & 0xff,
+               (ip >> 16) & 0xff,
+               (ip >> 24) & 0xff);
+}
+
+static void ce_init_bin(ce_bin *bin, unsigned char *dataBuffer)
+{
+       memset(bin, 0, sizeof(*bin));
+
+       bin->data = dataBuffer;
+       bin->parseState = CE_PS_RTI_ADDR;
+       bin->parsePtr = (unsigned char *)bin;
+}
+
+static int ce_is_bin_image(void *image, int imglen)
+{
+       if (imglen < CE_BIN_SIGN_LEN) {
+               return 0;
+       }
+
+       return memcmp(image, CE_BIN_SIGN, CE_BIN_SIGN_LEN) == 0;
+}
+
+static const struct ce_magic {
+       char magic[8];
+       size_t size;
+       ce_std_driver_globals drv_glb;
+} ce_magic_template = {
+       .magic = "KARO_CE6",
+       .size = sizeof(ce_std_driver_globals),
+       .drv_glb = {
+               .header = {
+                       .signature = STD_DRV_GLB_SIGNATURE,
+                       .oalVersion = 1,
+                       .bspVersion = 2,
+               },
+       },
+};
+
+#ifdef DEBUG
+static void __attribute__((unused)) ce_dump_block(void *ptr, int length)
+{
+       char *p = ptr;
+       int i;
+       int j;
+
+       for (i = 0; i < length; i++) {
+               if (!(i % 16)) {
+                       printf("\n%p: ", ptr + i);
+               }
+
+               printf("%02x ", p[i]);
+               if (!((i + 1) % 16)){
+                       printf("      ");
+                       for (j = i - 15; j <= i; j++){
+                               if((p[j] > 0x1f) && (p[j] < 0x7f)) {
+                                       printf("%c", p[j]);
+                               } else {
+                                       printf(".");
+                               }
+                       }
+               }
+       }
+       printf("\n");
+}
+#else
+static inline void ce_dump_block(void *ptr, int length)
+{
+}
+#endif
+
+static void ce_setup_std_drv_globals(ce_std_driver_globals *std_drv_glb,
+                               ce_bin *bin)
+{
+       char *mtdparts = getenv("mtdparts");
+       size_t max_len = ALIGN((unsigned long)std_drv_glb, SZ_4K) -
+               (unsigned long)&std_drv_glb->mtdparts;
+
+       if (eth_get_dev()) {
+               memcpy(&std_drv_glb->kitl.mac, eth_get_dev()->enetaddr,
+                       sizeof(std_drv_glb->kitl.mac));
+       }
+       snprintf(std_drv_glb->deviceId, sizeof(std_drv_glb->deviceId),
+               "Triton%02X", eth_get_dev()->enetaddr[5]);
+
+       std_drv_glb->kitl.ipAddress = gd->bd->bi_ip_addr;
+       std_drv_glb->kitl.ipMask = getenv_IPaddr("netmask");
+       std_drv_glb->kitl.ipRoute = getenv_IPaddr("gatewayip");
+
+       if (mtdparts) {
+               strncpy(std_drv_glb->mtdparts, mtdparts, max_len);
+               std_drv_glb->mtdparts[max_len - 1] = '\0';
+       } else {
+               printf("Failed to get mtdparts environment variable\n");
+       }
+}
+
+static void ce_prepare_run_bin(ce_bin *bin)
+{
+       ce_driver_globals *drv_glb;
+       struct ce_magic *ce_magic = (void *)CONFIG_SYS_SDRAM_BASE + 0x160;
+       ce_std_driver_globals *std_drv_glb = &ce_magic->drv_glb;
+
+       /* Clear os RAM area (if needed) */
+       if (bin->edbgConfig.flags & EDBG_FL_CLEANBOOT) {
+               debug("cleaning memory from %p to %p\n",
+                       bin->eRamStart, bin->eRamStart + bin->eRamLen);
+
+               printf("Preparing clean boot ... ");
+               memset(bin->eRamStart, 0, bin->eRamLen);
+               printf("ok\n");
+       }
+
+       /* Prepare driver globals (if needed) */
+       if (bin->eDrvGlb) {
+               debug("Copying CE MAGIC from %p to %p..%p\n",
+                       &ce_magic_template, ce_magic,
+                       (void *)ce_magic + sizeof(*ce_magic) - 1);
+               memcpy(ce_magic, &ce_magic_template, sizeof(*ce_magic));
+
+               ce_setup_std_drv_globals(std_drv_glb, bin);
+               ce_magic->size = sizeof(*std_drv_glb) +
+                       strlen(std_drv_glb->mtdparts) + 1;
+               ce_dump_block(ce_magic, offsetof(struct ce_magic, drv_glb) +
+                       ce_magic->size);
+
+               drv_glb = bin->eDrvGlb;
+               memset(drv_glb, 0, sizeof(*drv_glb));
+
+               drv_glb->signature = DRV_GLB_SIGNATURE;
+
+               /* Local ethernet MAC address */
+               memcpy(drv_glb->macAddr, std_drv_glb->kitl.mac,
+                       sizeof(drv_glb->macAddr));
+               debug("got MAC address %02x:%02x:%02x:%02x:%02x:%02x from environment\n",
+                       drv_glb->macAddr[0], drv_glb->macAddr[1],
+                       drv_glb->macAddr[2], drv_glb->macAddr[3],
+                       drv_glb->macAddr[4], drv_glb->macAddr[5]);
+
+               /* Local IP address */
+               drv_glb->ipAddr = getenv_IPaddr("ipaddr");
+
+               /* Subnet mask */
+               drv_glb->ipMask = getenv_IPaddr("netmask");
+
+               /* Gateway config */
+               drv_glb->ipGate = getenv_IPaddr("gatewayip");
+#ifdef DEBUG
+               debug("got IP address ");
+               print_IPaddr(drv_glb->ipAddr);
+               debug(" from environment\n");
+               debug("got IP mask ");
+               print_IPaddr(drv_glb->ipMask);
+               debug(" from environment\n");
+               debug("got gateway address ");
+               print_IPaddr(drv_glb->ipGate);
+               debug(" from environment\n");
+#endif
+               /* EDBG services config */
+               memcpy(&drv_glb->edbgConfig, &bin->edbgConfig,
+                       sizeof(bin->edbgConfig));
+       }
+
+       /*
+        * Make sure, all the above makes it into SDRAM because
+        * WinCE switches the cache & MMU off, obviously without
+        * flushing it first!
+        */
+       flush_dcache_all();
+}
+
+static int ce_lookup_ep_bin(ce_bin *bin)
+{
+       ce_rom_hdr *header;
+       ce_toc_entry *tentry;
+       e32_rom *e32;
+       unsigned int i;
+       uint32_t *sig = (uint32_t *)(bin->rtiPhysAddr + ROM_SIGNATURE_OFFSET);
+
+       debug("Looking for TOC signature at %p\n", sig);
+
+       /* Check image Table Of Contents (TOC) signature */
+       if (*sig != ROM_SIGNATURE) {
+               printf("Error: Did not find image TOC signature!\n");
+               printf("Expected %08x at address %p; found %08x instead\n",
+                       ROM_SIGNATURE, sig, *sig);
+               return 0;
+       }
+
+       /* Lookup entry point */
+       header = CE_FIX_ADDRESS(*(unsigned int *)(bin->rtiPhysAddr +
+                                               ROM_SIGNATURE_OFFSET +
+                                               sizeof(unsigned int)));
+       tentry = (ce_toc_entry *)(header + 1);
+
+       for (i = 0; i < header->nummods; i++) {
+               // Look for 'nk.exe' module
+               if (strcmp(CE_FIX_ADDRESS(tentry[i].fileName), "nk.exe") == 0) {
+                       // Save entry point and RAM addresses
+
+                       e32 = CE_FIX_ADDRESS(tentry[i].e32Offset);
+
+                       bin->eEntryPoint = CE_FIX_ADDRESS(tentry[i].loadOffset) +
+                               e32->e32_entryrva;
+                       bin->eRamStart = CE_FIX_ADDRESS(header->ramStart);
+                       bin->eRamLen = header->ramEnd - header->ramStart;
+                       // Save driver_globals address
+                       // Must follow RAM section in CE config.bib file
+                       //
+                       // eg.
+                       //
+                       // RAM          80900000        03200000        RAM
+                       // DRV_GLB      83B00000        00001000        RESERVED
+                       //
+                       bin->eDrvGlb = CE_FIX_ADDRESS(header->ramEnd);
+                       return 1;
+               }
+       }
+
+       // Error: Did not find 'nk.exe' module
+       return 0;
+}
+
+static int ce_parse_bin(ce_bin *bin)
+{
+       unsigned char *pbData = bin->data;
+       int len = bin->dataLen;
+       int copyLen;
+
+       debug("starting ce image parsing:\n\tbin->binLen: 0x%08X\n", bin->binLen);
+
+       if (len) {
+               if (bin->binLen == 0) {
+                       // Check for the .BIN signature first
+                       if (!ce_is_bin_image(pbData, len)) {
+                               printf("Error: Invalid or corrupted .BIN image!\n");
+                               return CE_PR_ERROR;
+                       }
+
+                       printf("Loading Windows CE .BIN image ...\n");
+                       // Skip signature
+                       len -= CE_BIN_SIGN_LEN;
+                       pbData += CE_BIN_SIGN_LEN;
+               }
+
+               while (len) {
+                       switch (bin->parseState) {
+                       case CE_PS_RTI_ADDR:
+                       case CE_PS_RTI_LEN:
+                       case CE_PS_E_ADDR:
+                       case CE_PS_E_LEN:
+                       case CE_PS_E_CHKSUM:
+                               copyLen = CE_MIN(sizeof(unsigned int) - bin->parseLen, len);
+                               memcpy(&bin->parsePtr[bin->parseLen], pbData, copyLen);
+
+                               bin->parseLen += copyLen;
+                               len -= copyLen;
+                               pbData += copyLen;
+
+                               if (bin->parseLen == sizeof(unsigned int)) {
+                                       if (bin->parseState == CE_PS_RTI_ADDR)
+                                               bin->rtiPhysAddr = CE_FIX_ADDRESS(bin->rtiPhysAddr);
+                                       else if (bin->parseState == CE_PS_E_ADDR &&
+                                               bin->ePhysAddr)
+                                               bin->ePhysAddr = CE_FIX_ADDRESS(bin->ePhysAddr);
+
+                                       bin->parseState++;
+                                       bin->parseLen = 0;
+                                       bin->parsePtr += sizeof(unsigned int);
+
+                                       if (bin->parseState == CE_PS_E_DATA) {
+                                               if (bin->ePhysAddr) {
+                                                       bin->parsePtr = bin->ePhysAddr;
+                                                       bin->parseChkSum = 0;
+                                               } else {
+                                                       /* EOF */
+                                                       len = 0;
+                                                       bin->endOfBin = 1;
+                                               }
+                                       }
+                               }
+                               break;
+
+                       case CE_PS_E_DATA:
+                               if (bin->ePhysAddr) {
+                                       copyLen = CE_MIN(bin->ePhysLen - bin->parseLen, len);
+                                       bin->parseLen += copyLen;
+                                       len -= copyLen;
+
+                                       while (copyLen--) {
+                                               bin->parseChkSum += *pbData;
+                                               *bin->parsePtr++ = *pbData++;
+                                       }
+
+                                       if (bin->parseLen == bin->ePhysLen) {
+                                               printf("Section [%02d]: address %p, size 0x%08X, checksum %s\n",
+                                                       bin->section,
+                                                       bin->ePhysAddr,
+                                                       bin->ePhysLen,
+                                                       (bin->eChkSum == bin->parseChkSum) ? "ok" : "fail");
+
+                                               if (bin->eChkSum != bin->parseChkSum) {
+                                                       printf("Error: Checksum error, corrupted .BIN file!\n");
+                                                       printf("checksum calculated: 0x%08x from file: 0x%08x\n",
+                                                               bin->parseChkSum, bin->eChkSum);
+                                                       bin->binLen = 0;
+                                                       return CE_PR_ERROR;
+                                               }
+
+                                               bin->section++;
+                                               bin->parseState = CE_PS_E_ADDR;
+                                               bin->parseLen = 0;
+                                               bin->parsePtr = (unsigned char *)&bin->ePhysAddr;
+                                       }
+                               } else {
+                                       bin->parseLen = 0;
+                                       bin->endOfBin = 1;
+                                       len = 0;
+                               }
+                               break;
+                       }
+               }
+       }
+
+       if (bin->endOfBin) {
+               if (!ce_lookup_ep_bin(bin)) {
+                       printf("Error: entry point not found!\n");
+                       bin->binLen = 0;
+                       return CE_PR_ERROR;
+               }
+
+               printf("Entry point: %p, address range: %p-%p\n",
+                       bin->eEntryPoint,
+                       bin->rtiPhysAddr,
+                       bin->rtiPhysAddr + bin->rtiPhysLen);
+
+               return CE_PR_EOF;
+       }
+
+       /* Need more data */
+       bin->binLen += bin->dataLen;
+       return CE_PR_MORE;
+}
+
+static int ce_bin_load(void *image, int imglen)
+{
+       ce_init_bin(&g_bin, image);
+       g_bin.dataLen = imglen;
+       if (ce_parse_bin(&g_bin) == CE_PR_EOF) {
+               ce_prepare_run_bin(&g_bin);
+               return 1;
+       }
+
+       return 0;
+}
+
+static void ce_run_bin(void (*entry)(void))
+{
+       printf("Launching Windows CE ...\n");
+       entry();
+}
+
+static int do_bootce(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+{
+       void *addr;
+       size_t image_size;
+       char *s;
+
+       if (argc > 1) {
+               addr = (void *)simple_strtoul(argv[1], NULL, 16);
+               image_size = INT_MAX;           /* actually we do not know the image size */
+       } else if (getenv("fileaddr") != NULL) {
+               addr = (void *)getenv_ulong("fileaddr", 16, 0);
+               image_size = getenv_ulong("filesize", 16, INT_MAX);
+       } else {
+               printf ("Usage:\n%s\n", cmdtp->usage);
+               return 1;
+       }
+
+       printf ("## Booting Windows CE Image from address %p ...\n", addr);
+
+       /* check if there is a valid windows CE image */
+       if (ce_is_bin_image(addr, image_size)) {
+               if (!ce_bin_load(addr, image_size)) {
+                       /* Ops! Corrupted .BIN image! */
+                       /* Handle error here ...      */
+                       printf("corrupted .BIN image !!!\n");
+                       return 1;
+               }
+               if ((s = getenv("autostart")) != NULL) {
+                       if (*s != 'y') {
+                               /*
+                                * just use bootce to load the image to SDRAM;
+                                * Do not start it automatically.
+                                */
+                               setenv_addr("fileaddr",
+                                       g_bin.eEntryPoint);
+                               return 0;
+                       }
+               }
+               ce_run_bin(g_bin.eEntryPoint);          /* start the image */
+       } else {
+               printf("Image does not seem to be a valid Windows CE image!\n");
+               return 1;
+       }
+       return 1;       /* never reached - just to keep compiler happy */
+}
+
+U_BOOT_CMD(
+       bootce, 2,      0,      do_bootce,
+       "bootce\t- Boot a Windows CE image from memory \n",
+       "[args..]\n"
+       "\taddr\t\t-boot image from address addr\n"
+);
+
+static void wince_handler(uchar *pkt, unsigned dport, IPaddr_t sip,
+                       unsigned sport, unsigned len)
+{
+       void *eth_pkt = pkt - IP_HDR_SIZE - ETHER_HDR_SIZE;
+       unsigned eth_len = len + IP_HDR_SIZE + ETHER_HDR_SIZE;
+
+       NetState = NETLOOP_SUCCESS;     /* got input - quit net loop */
+
+       if (memcmp(eth_pkt, eth_get_dev()->enetaddr, ETH_ALEN) != 0) {
+               g_net.got_packet_4me = 0;
+               return;
+       }
+       memcpy(&g_net.data[g_net.align_offset],
+               eth_pkt, eth_len);
+
+       g_net.dataLen = len;
+       g_net.got_packet_4me = 1;
+
+       g_net.srvAddrRecv.sin_port = *((unsigned short *)(&g_net.data[
+                       ETHER_HDR_SIZE + IP_HDR_SIZE_NO_UDP + g_net.align_offset]));
+       NetCopyIP(&g_net.srvAddrRecv.sin_addr, &g_net.data[ETHER_HDR_SIZE +
+               g_net.align_offset + 12]);
+       memcpy(NetServerEther, &g_net.data[g_net.align_offset + 6], ETH_ALEN);
+#if 0
+       printf("received packet:   buffer %p   Laenge %d \n", pkt, len);
+       printf("from ");
+       print_IPaddr(g_net.srvAddrRecv.sin_addr);
+       printf(", port: %d\n", ntohs(g_net.srvAddrRecv.sin_port));
+
+       ce_dump_block(pkt, len);
+
+       printf("Headers:\n");
+       ce_dump_block(eth_pkt, ETHER_HDR_SIZE + IP_HDR_SIZE);
+       printf("my port should be: %d\n",
+               ntohs(*((unsigned short *)(&g_net.data[ETHER_HDR_SIZE +
+                                                       IP_HDR_SIZE_NO_UDP +
+                                                       g_net.align_offset + 2]))));
+#endif
+}
+
+/* returns packet length if successfull */
+static int ce_recv_packet(uchar *buf, int len, struct sockaddr_in *from,
+               struct sockaddr_in *local, struct timeval *timeout)
+{
+       int rxlength;
+       ulong time_started;
+
+       g_net.got_packet_4me = 0;
+       time_started = get_timer(0);
+       NetSetHandler(wince_handler);
+
+       while (1) {
+               rxlength = eth_rx();
+               if (g_net.got_packet_4me)
+                       return g_net.dataLen;
+               /* check for timeout */
+               if (get_timer(time_started) > timeout->tv_sec * CONFIG_SYS_HZ) {
+                       return -ETIMEDOUT;
+               }
+       }
+}
+
+static int ce_recv_frame(ce_net *net, int timeout)
+{
+       struct timeval timeo;
+
+       timeo.tv_sec = timeout;
+       timeo.tv_usec = 0;
+
+       net->dataLen = ce_recv_packet(&net->data[net->align_offset],
+                               sizeof(net->data) - net->align_offset,
+                               &net->srvAddrRecv, &net->locAddr, &timeo);
+
+       if (net->dataLen < 0 || net->dataLen > sizeof(net->data)) {
+               /* Error! No data available */
+               net->dataLen = 0;
+       }
+
+       return net->dataLen;
+}
+
+static int ce_send_frame(ce_net *net)
+{
+       uchar *pkt = (uchar *)NetTxPacket + ETHER_HDR_SIZE + IP_HDR_SIZE;
+
+       memcpy(pkt, &net->data[net->align_offset + ETHER_HDR_SIZE + IP_HDR_SIZE],
+               net->dataLen);
+       return NetSendUDPPacket(NetServerEther, net->srvAddrSend.sin_addr,
+                               ntohs(net->srvAddrSend.sin_port),
+                               ntohs(net->locAddr.sin_port), net->dataLen);
+}
+
+static int ce_send_write_ack(ce_net *net)
+{
+       unsigned short *wdata;
+       unsigned long aligned_address;
+
+       aligned_address = (unsigned long)&net->data[ETHER_HDR_SIZE + IP_HDR_SIZE + net->align_offset];
+
+       wdata = (unsigned short *)aligned_address;
+       wdata[0] = htons(EDBG_CMD_WRITE_ACK);
+       wdata[1] = htons(net->blockNum);
+
+       net->dataLen = 4;
+
+       return ce_send_frame(net);
+}
+
+static int ce_process_download(ce_net *net, ce_bin *bin)
+{
+       int ret = CE_PR_MORE;
+
+       if (net->dataLen >= 2) {
+               unsigned short command;
+
+               command = ntohs(*(unsigned short *)&net->data[CE_DOFFSET]);
+               debug("command found: 0x%04X\n", command);
+
+               switch (command) {
+               case EDBG_CMD_WRITE_REQ:
+                       if (!net->link) {
+                               // Check file name for WRITE request
+                               // CE EShell uses "boot.bin" file name
+#if 0
+                               printf(">>>>>>>> First Frame, IP: %s, port: %d\n",
+                                       inet_ntoa((in_addr_t *)&net->srvAddrRecv),
+                                       ntohs(net->srvAddrRecv.sin_port));
+#endif
+                               if (strncmp((char *)&net->data[CE_DOFFSET + 2],
+                                               "boot.bin", 8) == 0) {
+                                       // Some diag output
+                                       if (net->verbose) {
+                                               printf("Locked Down download link, IP: ");
+                                               print_IPaddr(net->srvAddrRecv.sin_addr);
+                                               printf(", port: %d\n", ntohs(net->srvAddrRecv.sin_port));
+
+                                               printf("Sending BOOTME request [%d] to ",
+                                                       net->seqNum);
+                                               print_IPaddr(net->srvAddrSend.sin_addr);
+                                               printf("\n");
+                                       }
+
+                                       // Lock down EShell download link
+                                       net->locAddr.sin_port = htons(EDBG_DOWNLOAD_PORT + 1);
+                                       net->srvAddrSend.sin_port = net->srvAddrRecv.sin_port;
+                                       net->srvAddrSend.sin_addr = net->srvAddrRecv.sin_addr;
+                                       net->link = 1;
+                               } else {
+                                       // Unknown link
+                                       net->srvAddrRecv.sin_port = 0;
+                               }
+
+                               if (net->link) {
+                                       ce_send_write_ack(net);
+                               }
+                       }
+                       break;
+
+               case EDBG_CMD_WRITE:
+                       /* Fix data len */
+                       bin->dataLen = net->dataLen - 4;
+
+                       ret = ce_parse_bin(bin);
+                       if (ret != CE_PR_ERROR) {
+                               net->blockNum++;
+                               ce_send_write_ack(net);
+                       }
+                       break;
+
+               case EDBG_CMD_READ_REQ:
+                       /* Read requests are not supported
+                        * Do nothing ...
+                        */
+                       break;
+
+               case EDBG_CMD_ERROR:
+                       printf("Error: unknown error on the host side\n");
+
+                       bin->binLen = 0;
+                       ret = CE_PR_ERROR;
+                       break;
+
+               default:
+                       printf("unknown command 0x%04X\n", command);
+                       return -EINVAL;
+               }
+       }
+       return ret;
+}
+
+static void ce_init_edbg_link(ce_net *net)
+{
+       /* Initialize EDBG link for commands */
+
+       net->locAddr.sin_port = htons(EDBG_DOWNLOAD_PORT);
+       net->srvAddrSend.sin_port = htons(EDBG_DOWNLOAD_PORT);
+       net->srvAddrRecv.sin_port = 0;
+       net->link = 0;
+}
+
+static void ce_process_edbg(ce_net *net, ce_bin *bin)
+{
+       eth_dbg_hdr *header;
+
+       if (net->dataLen < sizeof(eth_dbg_hdr)) {
+               /* Bad packet */
+
+               net->srvAddrRecv.sin_port = 0;
+               return;
+       }
+
+       header = (eth_dbg_hdr *)&net->data[net->align_offset + ETHER_HDR_SIZE + IP_HDR_SIZE];
+
+       if (header->id != EDBG_ID) {
+               /* Bad packet */
+
+               net->srvAddrRecv.sin_port = 0;
+               return;
+       }
+
+       if (header->service != EDBG_SVC_ADMIN) {
+               /* Unknown service */
+               return;
+       }
+
+       if (!net->link) {
+               /* Some diag output */
+               if (net->verbose) {
+                       printf("Locked Down EDBG service link, IP: ");
+                       print_IPaddr(net->srvAddrRecv.sin_addr);
+                       printf(", port: %d\n", ntohs(net->srvAddrRecv.sin_port));
+               }
+
+               /* Lock down EDBG link */
+               net->srvAddrSend.sin_port = net->srvAddrRecv.sin_port;
+               net->link = 1;
+       }
+
+       switch (header->cmd) {
+       case EDBG_CMD_JUMPIMG:
+               net->gotJumpingRequest = 1;
+
+               if (net->verbose) {
+                       printf("Received JUMPING command\n");
+               }
+               /* Just pass through and copy CONFIG structure */
+       case EDBG_CMD_OS_CONFIG:
+               /* Copy config structure */
+               memcpy(&bin->edbgConfig, header->data,
+                       sizeof(edbg_os_config_data));
+               if (net->verbose) {
+                       printf("Received CONFIG command\n");
+                       if (bin->edbgConfig.flags & EDBG_FL_DBGMSG) {
+                               printf("--> Enabling DBGMSG service, IP: %d.%d.%d.%d, port: %d\n",
+                                       (bin->edbgConfig.dbgMsgIPAddr >> 0) & 0xFF,
+                                       (bin->edbgConfig.dbgMsgIPAddr >> 8) & 0xFF,
+                                       (bin->edbgConfig.dbgMsgIPAddr >> 16) & 0xFF,
+                                       (bin->edbgConfig.dbgMsgIPAddr >> 24) & 0xFF,
+                                       ntohs(bin->edbgConfig.dbgMsgPort));
+                       }
+
+                       if (bin->edbgConfig.flags & EDBG_FL_PPSH) {
+                               printf("--> Enabling PPSH service, IP: %d.%d.%d.%d, port: %d\n",
+                                       (bin->edbgConfig.ppshIPAddr >> 0) & 0xFF,
+                                       (bin->edbgConfig.ppshIPAddr >> 8) & 0xFF,
+                                       (bin->edbgConfig.ppshIPAddr >> 16) & 0xFF,
+                                       (bin->edbgConfig.ppshIPAddr >> 24) & 0xFF,
+                                       ntohs(bin->edbgConfig.ppshPort));
+                       }
+
+                       if (bin->edbgConfig.flags & EDBG_FL_KDBG) {
+                               printf("--> Enabling KDBG service, IP: %d.%d.%d.%d, port: %d\n",
+                                       (bin->edbgConfig.kdbgIPAddr >> 0) & 0xFF,
+                                       (bin->edbgConfig.kdbgIPAddr >> 8) & 0xFF,
+                                       (bin->edbgConfig.kdbgIPAddr >> 16) & 0xFF,
+                                       (bin->edbgConfig.kdbgIPAddr >> 24) & 0xFF,
+                                       ntohs(bin->edbgConfig.kdbgPort));
+                       }
+
+                       if (bin->edbgConfig.flags & EDBG_FL_CLEANBOOT) {
+                               printf("--> Force clean boot\n");
+                       }
+               }
+               break;
+
+       default:
+               if (net->verbose) {
+                       printf("Received unknown command: %08X\n", header->cmd);
+               }
+               return;
+       }
+
+       /* Respond with ack */
+       header->flags = EDBG_FL_FROM_DEV | EDBG_FL_ACK;
+       net->dataLen = EDBG_DATA_OFFSET;
+       ce_send_frame(net);
+}
+
+static int ce_send_bootme(ce_net *net)
+{
+       eth_dbg_hdr *header;
+       edbg_bootme_data *data;
+#ifdef DEBUG
+       int     i;
+       unsigned char   *pkt;
+#endif
+       /* Fill out BOOTME packet */
+       memset(net->data, 0, PKTSIZE);
+       header = (eth_dbg_hdr *)&net->data[CE_DOFFSET];
+       data = (edbg_bootme_data *)header->data;
+
+       header->id = EDBG_ID;
+       header->service = EDBG_SVC_ADMIN;
+       header->flags = EDBG_FL_FROM_DEV;
+       header->seqNum = net->seqNum++;
+       header->cmd = EDBG_CMD_BOOTME;
+
+       data->versionMajor = 0;
+       data->versionMinor = 0;
+       data->cpuId = EDBG_CPU_TYPE_ARM;
+       data->bootmeVer = EDBG_CURRENT_BOOTME_VERSION;
+       data->bootFlags = 0;
+       data->downloadPort = 0;
+       data->svcPort = 0;
+
+       /* MAC address from environment*/
+       if (!eth_getenv_enetaddr("ethaddr", data->macAddr)) {
+               printf("'ethaddr' is not set or invalid\n");
+               memset(data->macAddr, 0, sizeof(data->macAddr));
+       }
+
+       /* IP address from environment */
+       data->ipAddr = getenv_IPaddr("ipaddr");
+
+       // Device name string (NULL terminated). Should include
+       // platform and number based on Ether address (e.g. Odo42, CEPCLS2346, etc)
+
+       // We will use lower MAC address segment to create device name
+       // eg. MAC '00-0C-C6-69-09-05', device name 'Triton05'
+
+       strncpy(data->platformId, "Triton", sizeof(data->platformId));
+       snprintf(data->deviceName, sizeof(data->deviceName), "%s%02X",
+               data->platformId, data->macAddr[5]);
+
+#ifdef DEBUG
+       printf("header->id: %08X\r\n", header->id);
+       printf("header->service: %08X\r\n", header->service);
+       printf("header->flags: %08X\r\n", header->flags);
+       printf("header->seqNum: %08X\r\n", header->seqNum);
+       printf("header->cmd: %08X\r\n\r\n", header->cmd);
+
+       printf("data->versionMajor: %08X\r\n", data->versionMajor);
+       printf("data->versionMinor: %08X\r\n", data->versionMinor);
+       printf("data->cpuId: %08X\r\n", data->cpuId);
+       printf("data->bootmeVer: %08X\r\n", data->bootmeVer);
+       printf("data->bootFlags: %08X\r\n", data->bootFlags);
+       printf("data->svcPort: %08X\r\n\r\n", ntohs(data->svcPort));
+
+       printf("data->macAddr: %02X-%02X-%02X-%02X-%02X-%02X\r\n",
+               data->macAddr[0], data->macAddr[1],
+               data->macAddr[2], data->macAddr[3],
+               data->macAddr[4], data->macAddr[5]);
+
+       printf("data->ipAddr: %d.%d.%d.%d\r\n",
+               (data->ipAddr >> 0) & 0xFF,
+               (data->ipAddr >> 8) & 0xFF,
+               (data->ipAddr >> 16) & 0xFF,
+               (data->ipAddr >> 24) & 0xFF);
+
+       printf("data->platformId: %s\r\n", data->platformId);
+
+       printf("data->deviceName: %s\r\n", data->deviceName);
+#endif
+       // Some diag output ...
+       if (net->verbose) {
+               printf("Sending BOOTME request [%d] to ", net->seqNum);
+               print_IPaddr(net->srvAddrSend.sin_addr);
+               printf("\n");
+       }
+
+       net->dataLen = BOOTME_PKT_SIZE;
+#ifdef DEBUG
+       debug("Start of buffer:      %p\n", net->data);
+       debug("Start of ethernet buffer:   %p\n", &net->data[net->align_offset]);
+       debug("Start of CE header:         %p\n", header);
+       debug("Start of CE data:           %p\n", data);
+
+       pkt = &net->data[net->align_offset];
+       debug("packet to send (ceconnect): \n");
+       for (i = 0; i < net->dataLen + ETHER_HDR_SIZE + IP_HDR_SIZE; i++) {
+               debug("0x%02X ", pkt[i]);
+               if (!((i + 1) % 16))
+                       debug("\n");
+       }
+       debug("\n");
+#endif
+       memcpy(NetServerEther, NetBcastAddr, 6);
+       return ce_send_frame(net);
+}
+
+static int ce_init_download_link(ce_net *net, ce_bin *bin,
+                               struct sockaddr_in *host_addr, int verbose)
+{
+       int ret;
+       unsigned long aligned_address;
+
+       if (!eth_get_dev()) {
+               printf("No network interface available\n");
+               return -ENODEV;
+       }
+       printf("Usinge device '%s'\n", eth_get_name());
+
+       /* Initialize EDBG link for download */
+       memset(net, 0, sizeof(*net));
+
+       /* our buffer contains space for ethernet- ip- and udp- headers */
+       /* calculate an offset so that our ce field is aligned to 4 bytes */
+       aligned_address = (unsigned long)net->data;
+       /* we need 42 bytes room for headers (14 Ethernet , 20 IPv4, 8 UDP) */
+       aligned_address += ETHER_HDR_SIZE + IP_HDR_SIZE;
+       /* want CE header aligned to 4 Byte boundary */
+       net->align_offset = (4 - (aligned_address % 4)) % 4;
+
+       net->locAddr.sin_family = AF_INET;
+       net->locAddr.sin_addr = getenv_IPaddr("ipaddr");
+       net->locAddr.sin_port = htons(EDBG_DOWNLOAD_PORT);
+
+       net->srvAddrSend.sin_family = AF_INET;
+       net->srvAddrSend.sin_port = htons(EDBG_DOWNLOAD_PORT);
+
+       net->srvAddrRecv.sin_family = AF_INET;
+       net->srvAddrRecv.sin_port = 0;
+
+       if (host_addr->sin_addr) {
+               /* Use specified host address ... */
+               net->srvAddrSend.sin_addr = host_addr->sin_addr;
+               net->srvAddrRecv.sin_addr = host_addr->sin_addr;
+       } else {
+               /* ... or default server address */
+               net->srvAddrSend.sin_addr = getenv_IPaddr("serverip");
+               net->srvAddrRecv.sin_addr = getenv_IPaddr("serverip");
+       }
+
+       net->verbose = verbose;
+
+       ce_init_bin(bin, &net->data[CE_DOFFSET + 4]);
+
+       eth_halt();
+
+#ifdef CONFIG_NET_MULTI
+       eth_set_current();
+#endif
+       ret = eth_init(gd->bd);
+       if (ret < 0) {
+               printf("ceconnect: failed to init ethernet: %d\n", ret);
+               eth_halt();
+               return ret;
+       }
+#ifdef ET_DEBUG
+       puts("ceconnect: init ethernet done!\n");
+#endif
+       memcpy(NetOurEther, eth_get_dev()->enetaddr, ETH_ALEN);
+       NetCopyIP(&NetOurIP, &gd->bd->bi_ip_addr);
+       NetOurGatewayIP = getenv_IPaddr("gatewayip");
+       NetOurSubnetMask = getenv_IPaddr("netmask");
+       NetServerIP = getenv_IPaddr("serverip");
+       return 0;
+}
+
+static int do_ceconnect(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+{
+       int i;
+       int verbose = 0, use_timeout = 0;
+       int timeout = 0, recv_timeout, ret;
+       struct sockaddr_in host_ip_addr;
+
+       for (i = 1; i < argc; i++){
+               if (*argv[i] != '-')
+                       break;
+               if (argv[i][1] == 'v') {
+                       verbose = 1;
+               } else if (argv[i][1] == 't') {
+                       i++;
+                       if (argc > i) {
+                               timeout = simple_strtoul(argv[i],
+                                                       NULL, 10);
+                               use_timeout = 1;
+                       } else {
+                               printf("Option requires an argument - t\n");
+                               return 1;
+                       }
+               }
+       }
+
+       memset(&host_ip_addr, 0xff, sizeof(host_ip_addr));
+
+       if (ce_init_download_link(&g_net, &g_bin, &host_ip_addr, verbose) != 0)
+               return 1;
+
+       while (1) {
+               if (g_net.link) {
+                       recv_timeout = 3;
+               } else {
+                       recv_timeout = 1;
+
+                       if (use_timeout && timeout <= 0) {
+                               printf("CELOAD - Canceled, timeout\n");
+                               eth_halt();
+                               return 1;
+                       }
+                       if (ctrlc()) {
+                               printf("CELOAD - canceled by user\n");
+                               eth_halt();
+                               return 1;
+                       }
+
+                       debug("sending broadcast frame bootme\n");
+
+                       if (ce_send_bootme(&g_net)) {
+                               printf("CELOAD - error while sending BOOTME request\n");
+                               eth_halt();
+                               return 1;
+                       }
+                       debug("net state is: %d\n", NetState);
+                       if (verbose) {
+                               if (use_timeout) {
+                                       printf("Waiting for connection, timeout %d sec\n", timeout);
+                               } else {
+                                       printf("Waiting for connection, enter ^C to abort\n");
+                               }
+                       }
+               }
+
+               if (ce_recv_frame(&g_net, recv_timeout)) {
+                       ret = ce_process_download(&g_net, &g_bin);
+                       if (ret != CE_PR_MORE)
+                               break;
+               } else if (use_timeout) {
+                       timeout -= recv_timeout;
+               }
+       }
+
+       if (g_bin.binLen) {
+               // Try to receive edbg commands from host
+               ce_init_edbg_link(&g_net);
+               if (verbose)
+                       printf("Waiting for EDBG commands ...\n");
+
+               while (ce_recv_frame(&g_net, 3))
+                       ce_process_edbg(&g_net, &g_bin);
+
+               // Prepare WinCE image for execution
+               ce_prepare_run_bin(&g_bin);
+
+               // Launch WinCE, if necessary
+               if (g_net.gotJumpingRequest)
+                       ce_run_bin(g_bin.eEntryPoint);
+       }
+       eth_halt();
+       return 0;
+}
+
+U_BOOT_CMD(
+       ceconnect,      4,      1,      do_ceconnect,
+       "ceconnect    - Set up a connection to the CE host PC over TCP/IP and download the run-time image\n",
+       "ceconnect [-v] [-t <timeout>]\n"
+       "  -v verbose operation\n"
+       "  -t <timeout> - max wait time (#sec) for the connection\n"
+);
index 9a5c53ec06c76ae15706d6f2f86a715c7893fe96..aa7707ca46faaafa617873e3e58de5aeb50b9c46 100644 (file)
@@ -824,6 +824,6 @@ U_BOOT_CMD(
        "fdt rsvmem delete <index>           - Delete a mem reserves\n"
        "fdt chosen [<start> <end>]          - Add/update the /chosen branch in the tree\n"
        "                                        <start>/<end> - initrd start/end addr\n"
-       "NOTE: Dereference aliases by omiting the leading '/', "
+       "NOTE: Dereference aliases by omitting the leading '/', "
                "e.g. fdt print ethernet0."
 );
diff --git a/common/cmd_iim.c b/common/cmd_iim.c
new file mode 100644 (file)
index 0000000..cebe9b7
--- /dev/null
@@ -0,0 +1,97 @@
+/*
+ * (C) Copyright 2008-2010 Freescale Semiconductor, Inc.
+ *
+ * Copyright 2007, Freescale Semiconductor, Inc
+ * Andy Fleming
+ *
+ * Based vaguely on the pxa mmc code:
+ * (C) Copyright 2003
+ * Kyle Harris, Nexus Technologies, Inc. kharris@nexus-tech.net
+ *
+ * Adapted for U-Boot version 2012-04-01 by Lothar Waßmann <LW@KARO-electronics.de>
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+#include <common.h>
+#include <command.h>
+#include <linux/types.h>
+#include <asm/io.h>
+#include <asm/arch/imx_iim.h>
+
+int do_iimops(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+{
+       int bank = 0,
+               row = 0,
+               val = 0;
+
+       if (argc < 3 || argc > 5)
+               goto err_rtn;
+
+       if (strcmp(argv[1], "read") == 0) {
+               if (strcmp(argv[2], "fecmac") == 0) {
+                       if (3 == argc)
+                               iim_blow_func(argv[2], NULL);
+                       else
+                               goto err_rtn;
+               } else {
+                       if (4 == argc) {
+                               bank = simple_strtoul(argv[2], NULL, 16);
+                               row = simple_strtoul(argv[3], NULL, 16);
+
+                               iim_read(bank, row);
+                       } else
+                               goto err_rtn;
+               }
+       } else if (strcmp(argv[1], "blow") == 0) {
+               if (strcmp(argv[2], "fecmac") == 0) {
+                       if (4 == argc)
+                               iim_blow_func(argv[2], argv[3]);
+                       else
+                               goto err_rtn;
+               } else {
+                       if (5 == argc) {
+                               bank = simple_strtoul(argv[2], NULL, 16);
+                               row = simple_strtoul(argv[3], NULL, 16);
+                               val = simple_strtoul(argv[4], NULL, 16);
+
+                               iim_blow(bank, row, val);
+                       } else
+                               goto err_rtn;
+               }
+       } else
+               goto err_rtn;
+
+       return 0;
+err_rtn:
+       printf("Invalid parameters!\n");
+       printf("It is too dangeous for you to use iim command.\n");
+       return 1;
+}
+
+U_BOOT_CMD(
+       iim, 5, 1, do_iimops,
+       "IIM sub system",
+       "Warning: all numbers in parameter are in hex format!\n"
+       "iim read <bank> <row>  - Read some fuses\n"
+       "iim read fecmac        - Read FEC Mac address\n"
+       "iim blow <bank> <row> <value>  - Blow some fuses\n"
+       "iim blow fecmac <0x##:0x##:0x##:0x##:0x##:0x##>"
+       "- Blow FEC Mac address");
+
index 0fd3a6c414aa9c35f13a8ec1a9bd60d4614634df..a461e64eac2f3aa7f2cec2f3c1cb91c6f8fdf8ad 100644 (file)
@@ -417,7 +417,7 @@ int do_nand(cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
 
        /* Only "dump" is repeatable. */
        if (repeat && strcmp(cmd, "dump"))
-               return 0;
+               return CMD_RET_FAILURE;
 
        if (strcmp(cmd, "info") == 0) {
 
@@ -426,7 +426,7 @@ int do_nand(cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
                        if (nand_info[i].name)
                                nand_print_and_set_info(i);
                }
-               return 0;
+               return CMD_RET_SUCCESS;
        }
 
        if (strcmp(cmd, "device") == 0) {
@@ -436,19 +436,20 @@ int do_nand(cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
                                puts("no devices available\n");
                        else
                                nand_print_and_set_info(dev);
-                       return 0;
+                       return CMD_RET_SUCCESS;
                }
 
                dev = (int)simple_strtoul(argv[2], NULL, 10);
                set_dev(dev);
 
-               return 0;
+               return CMD_RET_SUCCESS;
        }
 
 #ifdef CONFIG_ENV_OFFSET_OOB
        /* this command operates only on the first nand device */
        if (strcmp(cmd, "env.oob") == 0)
-               return do_nand_env_oob(cmdtp, argc - 1, argv + 1);
+               return do_nand_env_oob(cmdtp, argc - 1, argv + 1) ?
+                       CMD_RET_FAILURE : CMD_RET_SUCCESS;;
 #endif
 
        /* The following commands operate on the current device, unless
@@ -460,7 +461,7 @@ int do_nand(cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
        if (dev < 0 || dev >= CONFIG_SYS_MAX_NAND_DEVICE ||
            !nand_info[dev].name) {
                puts("\nno devices available\n");
-               return 1;
+               return CMD_RET_FAILURE;
        }
        nand = &nand_info[dev];
 
@@ -469,7 +470,7 @@ int do_nand(cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
                for (off = 0; off < nand->size; off += nand->erasesize)
                        if (nand_block_isbad(nand, off))
                                printf("  %08llx\n", (unsigned long long)off);
-               return 0;
+               return CMD_RET_SUCCESS;
        }
 
        /*
@@ -520,7 +521,7 @@ int do_nand(cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
                printf("\nNAND %s: ", cmd);
                /* skip first two or three arguments, look for offset and size */
                if (arg_off_size(argc - o, argv + o, &dev, &off, &size) != 0)
-                       return 1;
+                       return CMD_RET_FAILURE;
 
                nand = &nand_info[dev];
 
@@ -543,17 +544,17 @@ int do_nand(cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
                                        opts.scrub = 1;
                                else {
                                        puts("scrub aborted\n");
-                                       return -1;
+                                       return CMD_RET_FAILURE;
                                }
                        } else {
                                puts("scrub aborted\n");
-                               return -1;
+                               return CMD_RET_FAILURE;
                        }
                }
                ret = nand_erase_opts(nand, &opts);
                printf("%s\n", ret ? "ERROR" : "OK");
 
-               return ret == 0 ? 0 : 1;
+               return ret == 0 ? CMD_RET_SUCCESS : CMD_RET_FAILURE;
        }
 
        if (strncmp(cmd, "dump", 4) == 0) {
@@ -563,7 +564,7 @@ int do_nand(cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
                off = (int)simple_strtoul(argv[2], NULL, 16);
                ret = nand_dump(nand, off, !strcmp(&cmd[4], ".oob"), repeat);
 
-               return ret == 0 ? 1 : 0;
+               return ret == 0 ? CMD_RET_SUCCESS : CMD_RET_FAILURE;
        }
 
        if (strncmp(cmd, "read", 4) == 0 || strncmp(cmd, "write", 5) == 0) {
@@ -578,7 +579,7 @@ int do_nand(cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
                read = strncmp(cmd, "read", 4) == 0; /* 1 = read, 0 = write */
                printf("\nNAND %s: ", read ? "read" : "write");
                if (arg_off_size(argc - 3, argv + 3, &dev, &off, &size) != 0)
-                       return 1;
+                       return CMD_RET_FAILURE;
 
                nand = &nand_info[dev];
                rwsize = size;
@@ -596,7 +597,7 @@ int do_nand(cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
                } else if (!strcmp(s, ".trimffs")) {
                        if (read) {
                                printf("Unknown nand command suffix '%s'\n", s);
-                               return 1;
+                               return CMD_RET_FAILURE;
                        }
                        ret = nand_write_skip_bad(nand, off, &rwsize,
                                                (u_char *)addr,
@@ -606,7 +607,7 @@ int do_nand(cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
                } else if (!strcmp(s, ".yaffs")) {
                        if (read) {
                                printf("Unknown nand command suffix '%s'.\n", s);
-                               return 1;
+                               return CMD_RET_FAILURE;
                        }
                        ret = nand_write_skip_bad(nand, off, &rwsize,
                                                (u_char *)addr, WITH_YAFFS_OOB);
@@ -641,13 +642,13 @@ int do_nand(cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
                                ret = nand->write_oob(nand, off, &ops);
                } else {
                        printf("Unknown nand command suffix '%s'.\n", s);
-                       return 1;
+                       return CMD_RET_FAILURE;
                }
 
                printf(" %zu bytes %s: %s\n", rwsize,
                       read ? "read" : "written", ret ? "ERROR" : "OK");
 
-               return ret == 0 ? 0 : 1;
+               return ret == 0 ? CMD_RET_SUCCESS : CMD_RET_FAILURE;
        }
 
        if (strcmp(cmd, "markbad") == 0) {
@@ -673,12 +674,12 @@ int do_nand(cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
                        --argc;
                        ++argv;
                }
-               return ret;
+               return ret == 0 ? CMD_RET_SUCCESS : CMD_RET_FAILURE;
        }
 
        if (strcmp(cmd, "biterr") == 0) {
                /* todo */
-               return 1;
+               return CMD_RET_FAILURE;
        }
 
 #ifdef CONFIG_CMD_NAND_LOCK_UNLOCK
@@ -698,24 +699,24 @@ int do_nand(cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
                                puts("NAND flash successfully locked\n");
                        } else {
                                puts("Error locking NAND flash\n");
-                               return 1;
+                               return CMD_RET_FAILURE;
                        }
                }
-               return 0;
+               return CMD_RET_SUCCESS;
        }
 
        if (strcmp(cmd, "unlock") == 0) {
                if (arg_off_size(argc - 2, argv + 2, &dev, &off, &size) < 0)
-                       return 1;
+                       return CMD_RET_FAILURE;
 
                if (!nand_unlock(&nand_info[dev], off, size)) {
                        puts("NAND flash successfully unlocked\n");
                } else {
                        puts("Error unlocking NAND flash, "
                             "write and erase will probably fail\n");
-                       return 1;
+                       return CMD_RET_FAILURE;
                }
-               return 0;
+               return CMD_RET_SUCCESS;
        }
 #endif
 
diff --git a/common/cmd_pata.c b/common/cmd_pata.c
new file mode 100644 (file)
index 0000000..d326c1e
--- /dev/null
@@ -0,0 +1,203 @@
+/*
+ * Copyright (C) 2000-2005, DENX Software Engineering
+ *             Wolfgang Denk <wd@denx.de>
+ * Copyright (C) Procsys. All rights reserved.
+ *             Mushtaq Khan <mushtaq_k@procsys.com>
+ *                     <mushtaqk_921@yahoo.co.in>
+ * (C) Copyright 2008-2009 Freescale Semiconductor, Inc.
+ *             Terry Lv <r65388@freescale.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 <command.h>
+#include <part.h>
+#include <ata.h>
+#include <pata.h>
+
+int pata_curr_device = -1;
+block_dev_desc_t pata_dev_desc[CONFIG_SYS_ATA_MAX_DEVICE];
+
+int pata_initialize(void)
+{
+       int rc;
+       int i;
+
+       for (i = 0; i < CONFIG_SYS_ATA_MAX_DEVICE; i++) {
+               memset(&pata_dev_desc[i], 0, sizeof(struct block_dev_desc));
+               pata_dev_desc[i].if_type = IF_TYPE_ATAPI;
+               pata_dev_desc[i].dev = i;
+               pata_dev_desc[i].part_type = PART_TYPE_UNKNOWN;
+               pata_dev_desc[i].type = DEV_TYPE_HARDDISK;
+               pata_dev_desc[i].lba = 0;
+               pata_dev_desc[i].blksz = 512;
+               pata_dev_desc[i].block_read = pata_read;
+               pata_dev_desc[i].block_write = pata_write;
+
+               rc = init_pata(i);
+               rc = scan_pata(i);
+               if ((pata_dev_desc[i].lba > 0) && (pata_dev_desc[i].blksz > 0))
+                       init_part(&pata_dev_desc[i]);
+       }
+       pata_curr_device = 0;
+       return rc;
+}
+
+block_dev_desc_t *pata_get_dev(int dev)
+{
+       return (dev < CONFIG_SYS_ATA_MAX_DEVICE) ? &pata_dev_desc[dev] : NULL;
+}
+
+int do_pata(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
+{
+       int rc = 0;
+
+       if (argc == 2 && strcmp(argv[1], "init") == 0)
+               return pata_initialize();
+
+       /* If the user has not yet run `pata init`, do it now */
+       if (pata_curr_device == -1)
+               if (pata_initialize())
+                       return 1;
+
+       switch (argc) {
+       case 0:
+       case 1:
+               printf("Usage:\n%s\n", cmdtp->usage);
+               return 1;
+       case 2:
+               if (strncmp(argv[1], "inf", 3) == 0) {
+                       int i;
+                       putc('\n');
+                       for (i = 0; i < CONFIG_SYS_ATA_MAX_DEVICE; ++i) {
+                               if (pata_dev_desc[i].type == DEV_TYPE_UNKNOWN)
+                                       continue;
+                               printf("PATA device %d: ", i);
+                               dev_print(&pata_dev_desc[i]);
+                       }
+                       return 0;
+               } else if (strncmp(argv[1], "dev", 3) == 0) {
+                       if ((pata_curr_device < 0) || \
+                                       (pata_curr_device >= CONFIG_SYS_ATA_MAX_DEVICE)) {
+                               puts("\nno PATA devices available\n");
+                               return 1;
+                       }
+                       printf("\nPATA device %d: ", pata_curr_device);
+                       dev_print(&pata_dev_desc[pata_curr_device]);
+                       return 0;
+               } else if (strncmp(argv[1], "part", 4) == 0) {
+                       int dev, ok;
+
+                       for (ok = 0, dev = 0; dev < CONFIG_SYS_ATA_MAX_DEVICE; ++dev) {
+                               if (pata_dev_desc[dev].part_type != PART_TYPE_UNKNOWN) {
+                                       ++ok;
+                                       if (dev)
+                                               putc('\n');
+                                       print_part(&pata_dev_desc[dev]);
+                               }
+                       }
+                       if (!ok) {
+                               puts("\nno PATA devices available\n");
+                               rc++;
+                       }
+                       return rc;
+               }
+               printf("Usage:\n%s\n", cmdtp->usage);
+               return 1;
+       case 3:
+               if (strncmp(argv[1], "dev", 3) == 0) {
+                       int dev = (int)simple_strtoul(argv[2], NULL, 10);
+
+                       printf("\nPATA device %d: ", dev);
+                       if (dev >= CONFIG_SYS_ATA_MAX_DEVICE) {
+                               puts("unknown device\n");
+                               return 1;
+                       }
+                       dev_print(&pata_dev_desc[dev]);
+
+                       if (pata_dev_desc[dev].type == DEV_TYPE_UNKNOWN)
+                               return 1;
+
+                       pata_curr_device = dev;
+
+                       puts("... is now current device\n");
+
+                       return 0;
+               } else if (strncmp(argv[1], "part", 4) == 0) {
+                       int dev = (int)simple_strtoul(argv[2], NULL, 10);
+
+                       if (pata_dev_desc[dev].part_type != PART_TYPE_UNKNOWN) {
+                               print_part(&pata_dev_desc[dev]);
+                       } else {
+                               printf("\nPATA device %d not available\n", dev);
+                               rc = 1;
+                       }
+                       return rc;
+               }
+               printf ("Usage:\n%s\n", cmdtp->usage);
+               return 1;
+
+       default: /* at least 4 args */
+               if (strcmp(argv[1], "read") == 0) {
+                       ulong addr = simple_strtoul(argv[2], NULL, 16);
+                       ulong cnt = simple_strtoul(argv[4], NULL, 16);
+                       ulong n;
+                       lbaint_t blk = simple_strtoul(argv[3], NULL, 16);
+
+                       printf("\nPATA read: device %d block # %ld, count %ld ... ",
+                               pata_curr_device, blk, cnt);
+
+                       n = pata_read(pata_curr_device, blk, cnt, (u32 *)addr);
+
+                       /* flush cache after read */
+                       flush_cache(addr, cnt * pata_dev_desc[pata_curr_device].blksz);
+
+                       printf("%ld blocks read: %s\n",
+                               n, (n == cnt) ? "OK" : "ERROR");
+                       return (n == cnt) ? 0 : 1;
+               } else if (strcmp(argv[1], "write") == 0) {
+                       ulong addr = simple_strtoul(argv[2], NULL, 16);
+                       ulong cnt = simple_strtoul(argv[4], NULL, 16);
+                       ulong n;
+
+                       lbaint_t blk = simple_strtoul(argv[3], NULL, 16);
+
+                       printf("\nPATA write: device %d block # %ld, count %ld ... ",
+                               pata_curr_device, blk, cnt);
+
+                       n = pata_write(pata_curr_device, blk, cnt, (u32 *)addr);
+
+                       printf("%ld blocks written: %s\n",
+                               n, (n == cnt) ? "OK" : "ERROR");
+                       return (n == cnt) ? 0 : 1;
+               } else {
+                       printf("Usage:\n%s\n", cmdtp->usage);
+                       rc = 1;
+               }
+
+               return rc;
+       }
+}
+
+U_BOOT_CMD(
+       pata, 5, 1, do_pata,
+       "pata   - PATA sub system\n",
+       "pata info - show available PATA devices\n"
+       "pata device [dev] - show or set current device\n"
+       "pata part [dev] - print partition table\n"
+       "pata read addr blk# cnt\n"
+       "pata write addr blk# cnt\n");
index 7b1703fe4133df3866f023cdd45d7219026be791..e6ef0c9efcbb7881e7c615d7b8be047990699d93 100644 (file)
@@ -1,4 +1,7 @@
 /*
+ * (C) Copyright 2008-2010 Freescale Semiconductor, Inc.
+ * Terry Lv <r65388@freescale.com>
+ *
  * Copyright (C) 2000-2005, DENX Software Engineering
  *             Wolfgang Denk <wd@denx.de>
  * Copyright (C) Procsys. All rights reserved.
@@ -48,9 +51,12 @@ int __sata_initialize(void)
                sata_dev_desc[i].block_write = sata_write;
 
                rc = init_sata(i);
-               rc = scan_sata(i);
-               if ((sata_dev_desc[i].lba > 0) && (sata_dev_desc[i].blksz > 0))
-                       init_part(&sata_dev_desc[i]);
+               if (!rc) {
+                       rc = scan_sata(i);
+                       if (!rc && (sata_dev_desc[i].lba > 0) &&
+                               (sata_dev_desc[i].blksz > 0))
+                               init_part(&sata_dev_desc[i]);
+               }
        }
        sata_curr_device = 0;
        return rc;
index 6dbdbbfbe7a3eeeef03d1880d53817d76b901a62..76683ad7aa63b7a0a156cb4bc563ced0468ba437 100644 (file)
  * run_command() function.  Since this function has ARM-dependent timer
  * codes, we cannot merge it with the run_command() for now.
  */
-static int run_command_and_time_it(int flag, int argc, char * const argv[],
+static int run_command_and_time_it(int flag, int argc, char *const argv[],
                ulong *cycles)
 {
        cmd_tbl_t *cmdtp = find_cmd(argv[0]);
        int retval = 0;
+       unsigned long start;
 
        if (!cmdtp) {
                printf("%s: command not found\n", argv[0]);
@@ -40,14 +41,9 @@ static int run_command_and_time_it(int flag, int argc, char * const argv[],
        if (argc > cmdtp->maxargs)
                return CMD_RET_USAGE;
 
-       /*
-        * TODO(clchiou): get_timer_masked() is only defined in certain ARM
-        * boards.  We could use the new timer API that Graeme is proposing
-        * so that this piece of code would be arch-independent.
-        */
-       *cycles = get_timer_masked();
+       start = get_timer(0);
        retval = cmdtp->cmd(cmdtp, flag, argc, argv);
-       *cycles = get_timer_masked() - *cycles;
+       *cycles = get_timer(start);
 
        return retval;
 }
index e8daec9712bdc8d8df2f2989d7fb2c082de70c34..68af9a7b4836dc2c90fc1fe0be61cde9789b03d2 100644 (file)
@@ -60,8 +60,6 @@ char *env_name_spec = "NAND";
 env_t *env_ptr = &environment;
 #elif defined(CONFIG_NAND_ENV_DST)
 env_t *env_ptr = (env_t *)CONFIG_NAND_ENV_DST;
-#else /* ! ENV_IS_EMBEDDED */
-env_t *env_ptr;
 #endif /* ENV_IS_EMBEDDED */
 
 DECLARE_GLOBAL_DATA_PTR;
@@ -372,7 +370,9 @@ void env_relocate_spec(void)
                        gd->env_valid = 1;
        }
 
+#ifdef CONFIG_NAND_ENV_DST
        free(env_ptr);
+#endif
 
        if (gd->env_valid == 1)
                ep = tmp_env1;
index bf1a6a9e67759a061fcafe7d6b85d355876876ec..66b1c04cdd46517595699ccff406839e74916579 100644 (file)
@@ -67,7 +67,7 @@
 #ifdef CONFIG_LCD_LOGO
 # include <bmp_logo.h>         /* Get logo data, width and height      */
 # include <bmp_logo_data.h>
-# if (CONSOLE_COLOR_WHITE >= BMP_LOGO_OFFSET) && (LCD_BPP != LCD_COLOR16)
+# if (CONSOLE_COLOR_WHITE >= BMP_LOGO_OFFSET) && (LCD_BPP < LCD_COLOR16)
 #  error Default Color Map overlaps with Logo Color Map
 # endif
 #endif
@@ -107,6 +107,9 @@ static void console_scrollup (void)
 
        /* Clear the last one */
        memset (CONSOLE_ROW_LAST, COLOR_MASK(lcd_color_bg), CONSOLE_ROW_SIZE);
+
+       flush_dcache_range((unsigned long)CONSOLE_ROW_FIRST,
+                       (unsigned long)CONSOLE_ROW_LAST + CONSOLE_ROW_SIZE);
 }
 
 /*----------------------------------------------------------------------*/
@@ -213,20 +216,22 @@ void lcd_printf(const char *fmt, ...)
 
 static void lcd_drawchars (ushort x, ushort y, uchar *str, int count)
 {
-       uchar *dest;
+       void *dest;
        ushort row;
 
 #if LCD_BPP == LCD_MONOCHROME
        ushort off  = x * (1 << LCD_BPP) % 8;
 #endif
 
-       dest = (uchar *)(lcd_base + y * lcd_line_length + x * (1 << LCD_BPP) / 8);
+       dest = lcd_base + y * lcd_line_length + x * (1 << LCD_BPP) / 8;
 
        for (row=0;  row < VIDEO_FONT_HEIGHT;  ++row, dest += lcd_line_length)  {
                uchar *s = str;
                int i;
-#if LCD_BPP == LCD_COLOR16
-               ushort *d = (ushort *)dest;
+#if LCD_BPP == LCD_COLOR24
+               ulong *d = dest;
+#elif LCD_BPP == LCD_COLOR16
+               ushort *d = dest;
 #else
                uchar *d = dest;
 #endif
@@ -247,13 +252,7 @@ static void lcd_drawchars (ushort x, ushort y, uchar *str, int count)
 
                        *d++ = rest | (sym >> off);
                        rest = sym << (8-off);
-#elif LCD_BPP == LCD_COLOR8
-                       for (c=0; c<8; ++c) {
-                               *d++ = (bits & 0x80) ?
-                                               lcd_color_fg : lcd_color_bg;
-                               bits <<= 1;
-                       }
-#elif LCD_BPP == LCD_COLOR16
+#else
                        for (c=0; c<8; ++c) {
                                *d++ = (bits & 0x80) ?
                                                lcd_color_fg : lcd_color_bg;
@@ -302,6 +301,16 @@ static int test_colors[N_BLK_HOR*N_BLK_VERT] = {
        CONSOLE_COLOR_BLUE,     CONSOLE_COLOR_MAGENTA,  CONSOLE_COLOR_CYAN,
 };
 
+#if LCD_BPP == LCD_COLOR8
+typedef uchar pix_t;
+#elif LCD_BPP == LCD_COLOR16
+typedef ushort pix_t;
+#elif LCD_BPP == LCD_COLOR24
+typedef ulong pix_t;
+#else
+#error Unsupported pixelformat
+#endif
+
 static void test_pattern (void)
 {
        ushort v_max  = panel_info.vl_row;
@@ -309,16 +318,15 @@ static void test_pattern (void)
        ushort v_step = (v_max + N_BLK_VERT - 1) / N_BLK_VERT;
        ushort h_step = (h_max + N_BLK_HOR  - 1) / N_BLK_HOR;
        ushort v, h;
-       uchar *pix = (uchar *)lcd_base;
+       pix_t *pix = lcd_base;
 
        printf ("[LCD] Test Pattern: %d x %d [%d x %d]\n",
                h_max, v_max, h_step, v_step);
 
-       /* WARNING: Code silently assumes 8bit/pixel */
-       for (v=0; v<v_max; ++v) {
+       for (v = 0; v < v_max; v++) {
                uchar iy = v / v_step;
-               for (h=0; h<h_max; ++h) {
-                       uchar ix = N_BLK_HOR * iy + (h/h_step);
+               for (h = 0; h < h_max; h++) {
+                       uchar ix = N_BLK_HOR * iy + (h / h_step);
                        *pix++ = test_colors[ix];
                }
        }
@@ -330,12 +338,12 @@ static void test_pattern (void)
 /* ** GENERIC Initialization Routines                                  */
 /************************************************************************/
 
-int drv_lcd_init (void)
+int drv_lcd_init(void)
 {
        struct stdio_dev lcddev;
        int rc;
 
-       lcd_base = (void *)(gd->fb_base);
+       lcd_base = (void *)gd->fb_base;
 
        lcd_line_length = (panel_info.vl_col * NBITS (panel_info.vl_bpix)) / 8;
 
@@ -371,12 +379,12 @@ void lcd_clear(void)
 
 #elif LCD_BPP == LCD_COLOR8
        /* Setting the palette */
-       lcd_setcolreg  (CONSOLE_COLOR_BLACK,       0,    0,    0);
-       lcd_setcolreg  (CONSOLE_COLOR_RED,      0xFF,    0,    0);
-       lcd_setcolreg  (CONSOLE_COLOR_GREEN,       0, 0xFF,    0);
+       lcd_setcolreg  (CONSOLE_COLOR_BLACK,       0,    0,    0);
+       lcd_setcolreg  (CONSOLE_COLOR_RED,      0xFF,    0,    0);
+       lcd_setcolreg  (CONSOLE_COLOR_GREEN,       0, 0xFF,    0);
        lcd_setcolreg  (CONSOLE_COLOR_YELLOW,   0xFF, 0xFF,    0);
-       lcd_setcolreg  (CONSOLE_COLOR_BLUE,        0,    0, 0xFF);
-       lcd_setcolreg  (CONSOLE_COLOR_MAGENTA,  0xFF,    0, 0xFF);
+       lcd_setcolreg  (CONSOLE_COLOR_BLUE,        0,    0, 0xFF);
+       lcd_setcolreg  (CONSOLE_COLOR_MAGENTA,  0xFF,    0, 0xFF);
        lcd_setcolreg  (CONSOLE_COLOR_CYAN,        0, 0xFF, 0xFF);
        lcd_setcolreg  (CONSOLE_COLOR_GREY,     0xAA, 0xAA, 0xAA);
        lcd_setcolreg  (CONSOLE_COLOR_WHITE,    0xFF, 0xFF, 0xFF);
@@ -394,13 +402,15 @@ void lcd_clear(void)
        test_pattern();
 #else
        /* set framebuffer to background color */
-       memset ((char *)lcd_base,
+       memset (lcd_base,
                COLOR_MASK(lcd_getbgcolor()),
                lcd_line_length*panel_info.vl_row);
 #endif
        /* Paint the logo and retrieve LCD base address */
-       debug ("[LCD] Drawing the logo...\n");
+       debug ("[LCD] Drawing the logo @ %p...\n", lcd_base);
        lcd_console_address = lcd_logo ();
+       flush_dcache_range((unsigned long)lcd_base,
+                       (unsigned long)lcd_base + lcd_line_length*panel_info.vl_row);
 
        console_col = 0;
        console_row = 0;
@@ -417,7 +427,9 @@ U_BOOT_CMD(
 static int lcd_init (void *lcdbase)
 {
        /* Initialize the lcd controller */
-       debug ("[LCD] Initializing LCD frambuffer at %p\n", lcdbase);
+       debug ("[LCD] Initializing %ux%ux%u LCD framebuffer at %p\n",
+               panel_info.vl_col, panel_info.vl_row, NBITS(panel_info.vl_bpix),
+               lcdbase);
 
        lcd_ctrl_init (lcdbase);
        lcd_is_enabled = 1;
@@ -457,14 +469,14 @@ ulong lcd_setmem (ulong addr)
        size = line_length * panel_info.vl_row;
 
        /* Round up to nearest full page */
-       size = (size + (PAGE_SIZE - 1)) & ~(PAGE_SIZE - 1);
+       size = ALIGN(size, PAGE_SIZE);
 
        /* Allocate pages for the frame buffer. */
        addr -= size;
 
        debug ("Reserving %ldk for LCD Framebuffer at: %08lx\n", size>>10, addr);
 
-       return (addr);
+       return addr;
 }
 
 /*----------------------------------------------------------------------*/
@@ -492,7 +504,7 @@ static int lcd_getfgcolor (void)
 
 /*----------------------------------------------------------------------*/
 
-static int lcd_getbgcolor (void)
+static inline int lcd_getbgcolor (void)
 {
        return lcd_color_bg;
 }
@@ -513,12 +525,11 @@ void bitmap_plot (int x, int y)
        ushort i, j;
        uchar *bmap;
        uchar *fb;
-       ushort *fb16;
 #if defined(CONFIG_CPU_PXA)
        struct pxafb_info *fbi = &panel_info.pxa;
 #elif defined(CONFIG_MPC823)
        volatile immap_t *immr = (immap_t *) CONFIG_SYS_IMMR;
-       volatile cpm8xx_t *cp = &(immr->im_cpm);
+       volatile cpm8xx_t *cp = &immr->im_cpm;
 #endif
 
        debug ("Logo: width %d  height %d  colors %d  cmap %d\n",
@@ -548,7 +559,7 @@ void bitmap_plot (int x, int y)
                WATCHDOG_RESET();
 
                /* Set color map */
-               for (i=0; i<(sizeof(bmp_logo_palette)/(sizeof(ushort))); ++i) {
+               for (i = 0; i < sizeof(bmp_logo_palette) / sizeof(ushort); i++) {
                        ushort colreg = bmp_logo_palette[i];
 #ifdef CONFIG_ATMEL_LCD
                        uint lut_entry;
@@ -574,18 +585,18 @@ void bitmap_plot (int x, int y)
 
                WATCHDOG_RESET();
 
-               for (i=0; i<BMP_LOGO_HEIGHT; ++i) {
+               for (i = 0; i < BMP_LOGO_HEIGHT; i++) {
                        memcpy (fb, bmap, BMP_LOGO_WIDTH);
                        bmap += BMP_LOGO_WIDTH;
                        fb   += panel_info.vl_col;
                }
-       }
-       else { /* true color mode */
+       } else if (NBITS(panel_info.vl_bpix) == 16) {
                u16 col16;
-               fb16 = (ushort *)(lcd_base + y * lcd_line_length + x);
-               for (i=0; i<BMP_LOGO_HEIGHT; ++i) {
-                       for (j=0; j<BMP_LOGO_WIDTH; j++) {
-                               col16 = bmp_logo_palette[(bmap[j]-16)];
+               u16 *fb16 = lcd_base + y * lcd_line_length + x;
+
+               for (i = 0; i < BMP_LOGO_HEIGHT; i++) {
+                       for (j = 0; j < BMP_LOGO_WIDTH; j++) {
+                               col16 = bmp_logo_palette[bmap[j] - 16];
                                fb16[j] =
                                        ((col16 & 0x000F) << 1) |
                                        ((col16 & 0x00F0) << 3) |
@@ -594,7 +605,24 @@ void bitmap_plot (int x, int y)
                        bmap += BMP_LOGO_WIDTH;
                        fb16 += panel_info.vl_col;
                }
+       } else { /* true color mode */
+               u16 col16;
+               u32 *fb32 = lcd_base + y * lcd_line_length + x;
+
+               for (i = 0; i < BMP_LOGO_HEIGHT; i++) {
+                       for (j = 0; j < BMP_LOGO_WIDTH; j++) {
+                               col16 = bmp_logo_palette[bmap[j] - 16];
+                               fb32[j] =
+                                       ((col16 & 0x000F) << 4) |
+                                       ((col16 & 0x00F0) << 8) |
+                                       ((col16 & 0x0F00) << 12);
+                               }
+                       bmap += BMP_LOGO_WIDTH;
+                       fb32 += panel_info.vl_col;
+               }
        }
+               flush_dcache_range((unsigned long)fb,
+                               (unsigned long)fb + BMP_LOGO_HEIGHT * BMP_LOGO_WIDTH);
 
        WATCHDOG_RESET();
 }
@@ -622,9 +650,10 @@ int lcd_display_bitmap(ulong bmp_image, int x, int y)
        bmp_image_t *bmp=(bmp_image_t *)bmp_image;
        uchar *bmap;
        ushort padded_line;
-       unsigned long width, height, byte_width;
-       unsigned long pwidth = panel_info.vl_col;
-       unsigned colors, bpix, bmp_bpix;
+       int width, height, byte_width;
+       int pwidth = panel_info.vl_col;
+       unsigned long long colors;
+       unsigned bpix, bmp_bpix;
 #if defined(CONFIG_CPU_PXA)
        struct pxafb_info *fbi = &panel_info.pxa;
 #elif defined(CONFIG_MPC823)
@@ -641,26 +670,27 @@ int lcd_display_bitmap(ulong bmp_image, int x, int y)
        width = le32_to_cpu (bmp->header.width);
        height = le32_to_cpu (bmp->header.height);
        bmp_bpix = le16_to_cpu(bmp->header.bit_count);
-       colors = 1 << bmp_bpix;
+       colors = 1ULL << bmp_bpix;
 
        bpix = NBITS(panel_info.vl_bpix);
 
-       if ((bpix != 1) && (bpix != 8) && (bpix != 16)) {
+       if ((bpix != 1 && bpix != 8 && bpix != 16 && bpix != 32) ||
+               (bmp_bpix > bpix)) {
                printf ("Error: %d bit/pixel mode, but BMP has %d bit/pixel\n",
                        bpix, bmp_bpix);
                return 1;
        }
 
-       /* We support displaying 8bpp BMPs on 16bpp LCDs */
-       if (bpix != bmp_bpix && (bmp_bpix != 8 || bpix != 16)) {
+       /* We support displaying 8bpp BMPs on 16bpp or 32bpp LCDs */
+       if (bpix != bmp_bpix && (bmp_bpix != 8 || (bpix != 16 && bpix != 32))) {
                printf ("Error: %d bit/pixel mode, but BMP has %d bit/pixel\n",
                        bpix,
                        le16_to_cpu(bmp->header.bit_count));
                return 1;
        }
 
-       debug ("Display-bmp: %d x %d  with %d colors\n",
-               (int)width, (int)height, (int)colors);
+       debug ("Display-bmp: %u x %u  with %llu colors\n",
+               width, height, colors);
 
 #if !defined(CONFIG_MCC200)
        /* MCC200 LCD doesn't need CMAP, supports 1bpp b&w only */
@@ -676,7 +706,7 @@ int lcd_display_bitmap(ulong bmp_image, int x, int y)
                cmap_base = cmap;
 
                /* Set color map */
-               for (i=0; i<colors; ++i) {
+               for (i = 0; i < colors; i++) {
                        bmp_color_table_entry_t cte = bmp->color_table[i];
 #if !defined(CONFIG_ATMEL_LCD)
                        ushort colreg =
@@ -713,13 +743,13 @@ int lcd_display_bitmap(ulong bmp_image, int x, int y)
 #if defined(CONFIG_MCC200)
        if (bpix==1)
        {
-               width = ((width + 7) & ~7) >> 3;
-               x     = ((x + 7) & ~7) >> 3;
-               pwidth= ((pwidth + 7) & ~7) >> 3;
+               width = ALIGN(width, 8) >> 3;
+               x     = ALIGN(x, 8) >> 3;
+               pwidth= ALIGN(pwidth, 8) >> 3;
        }
 #endif
 
-       padded_line = (width&0x3) ? ((width&~0x3)+4) : (width);
+       padded_line = ALIGN(width, 4);
 
 #ifdef CONFIG_SPLASH_SCREEN_ALIGN
        if (x == BMP_ALIGN_CENTER)
@@ -732,46 +762,56 @@ int lcd_display_bitmap(ulong bmp_image, int x, int y)
        else if (y < 0)
                y = max(0, panel_info.vl_row - height + y + 1);
 #endif /* CONFIG_SPLASH_SCREEN_ALIGN */
+       bmap = (uchar *)bmp + le32_to_cpu (bmp->header.data_offset);
 
-       if ((x + width)>pwidth)
-               width = pwidth - x;
-       if ((y + height)>panel_info.vl_row)
+       if ((x + width) > pwidth)
+               width = max(pwidth - x, pwidth);
+       if ((y + height) > panel_info.vl_row) {
                height = panel_info.vl_row - y;
+               bmap += (panel_info.vl_row - y) * padded_line;
+       }
 
-       bmap = (uchar *)bmp + le32_to_cpu (bmp->header.data_offset);
        fb   = (uchar *) (lcd_base +
                (y + height - 1) * lcd_line_length + x * bpix / 8);
-
        switch (bmp_bpix) {
        case 1: /* pass through */
        case 8:
-               if (bpix != 16)
-                       byte_width = width;
-               else
+               if (bpix > 16)
+                       byte_width = width * 4;
+               else if (bpix == 16)
                        byte_width = width * 2;
-
-               for (i = 0; i < height; ++i) {
+               else
+                       byte_width = width;
+               for (i = 0; i < height; i++) {
                        WATCHDOG_RESET();
                        for (j = 0; j < width; j++) {
-                               if (bpix != 16) {
+                               if (bpix == 32) {
+                                       int i = *bmap++;
+
+                                       fb[3] = 0; /* T */
+                                       fb[0] = bmp->color_table[i].blue;
+                                       fb[1] = bmp->color_table[i].green;
+                                       fb[2] = bmp->color_table[i].red;
+                                       fb += sizeof(uint32_t) / sizeof(*fb);
+                               } else if (bpix == 16) {
+                                       *(uint16_t *)fb = cmap_base[*(bmap++)];
+                                       fb += sizeof(uint16_t) / sizeof(*fb);
+                               } else {
 #if defined(CONFIG_CPU_PXA) || defined(CONFIG_ATMEL_LCD)
                                        *(fb++) = *(bmap++);
 #elif defined(CONFIG_MPC823) || defined(CONFIG_MCC200)
                                        *(fb++) = 255 - *(bmap++);
 #endif
-                               } else {
-                                       *(uint16_t *)fb = cmap_base[*(bmap++)];
-                                       fb += sizeof(uint16_t) / sizeof(*fb);
                                }
                        }
-                       bmap += (width - padded_line);
-                       fb   -= (byte_width + lcd_line_length);
+                       bmap += padded_line - width;
+                       fb   -= byte_width + lcd_line_length;
                }
                break;
 
 #if defined(CONFIG_BMP_16BPP)
        case 16:
-               for (i = 0; i < height; ++i) {
+               for (i = 0; i < height; i++) {
                        WATCHDOG_RESET();
                        for (j = 0; j < width; j++) {
 #if defined(CONFIG_ATMEL_LCD_BGR555)
@@ -786,16 +826,27 @@ int lcd_display_bitmap(ulong bmp_image, int x, int y)
 #endif
                        }
                        bmap += (padded_line - width) * 2;
-                       fb   -= (width * 2 + lcd_line_length);
+                       fb   -= width * 2 + lcd_line_length;
                }
                break;
 #endif /* CONFIG_BMP_16BPP */
-
-       default:
+       case 32:
+               for (i = 0; i < height; i++) {
+                       WATCHDOG_RESET();
+                       for (j = 0; j < width; j++) {
+                               fb[3] = *bmap++; /* T */
+                               fb[0] = *bmap++; /* B */
+                               fb[1] = *bmap++; /* G */
+                               fb[2] = *bmap++; /* R */
+                               fb += 4;
+                       }
+                       bmap += (padded_line - width) * 4;
+                       fb   -= width * 4 + lcd_line_length;
+               }
                break;
        };
 
-       return (0);
+       return 0;
 }
 #endif
 
@@ -808,9 +859,13 @@ static void *lcd_logo (void)
 
        if (do_splash && (s = getenv("splashimage")) != NULL) {
                int x = 0, y = 0;
+               char *end;
+
                do_splash = 0;
 
-               addr = simple_strtoul (s, NULL, 16);
+               addr = simple_strtoul (s, &end, 16);
+               if (addr == 0 || *end != '\0')
+                       return lcd_base;
 #ifdef CONFIG_SPLASH_SCREEN_ALIGN
                if ((s = getenv ("splashpos")) != NULL) {
                        if (s[0] == 'm')
@@ -838,7 +893,7 @@ static void *lcd_logo (void)
 #endif
 
                if (lcd_display_bitmap (addr, x, y) == 0) {
-                       return ((void *)lcd_base);
+                       return lcd_base;
                }
        }
 #endif /* CONFIG_SPLASH_SCREEN */
@@ -854,9 +909,9 @@ static void *lcd_logo (void)
 #endif /* CONFIG_LCD_INFO */
 
 #if defined(CONFIG_LCD_LOGO) && !defined(CONFIG_LCD_INFO_BELOW_LOGO)
-       return ((void *)((ulong)lcd_base + BMP_LOGO_HEIGHT * lcd_line_length));
+       return lcd_base + BMP_LOGO_HEIGHT * lcd_line_length;
 #else
-       return ((void *)lcd_base);
+       return lcd_base;
 #endif /* CONFIG_LCD_LOGO && !CONFIG_LCD_INFO_BELOW_LOGO */
 }
 
index 3b9e39a9805b9da3831edef2177c44b00c72893e..4f744f4db853809131c79c4c87acc4e7fc5b016f 100644 (file)
@@ -440,9 +440,9 @@ void main_loop (void)
                else
                        rc = run_command(lastcommand, flag);
 
-               if (rc <= 0) {
+               if (rc || len < 0) {
                        /* invalid command or not repeatable, forget it */
-                       lastcommand[0] = 0;
+                       lastcommand[0] = '\0';
                }
        }
 #endif /*CONFIG_SYS_HUSH_PARSER*/
@@ -943,6 +943,13 @@ int readline_into_buffer(const char *const prompt, char *buffer, int timeout)
                if (prompt)
                        puts (prompt);
 
+#ifdef CONFIG_SHOW_ACTIVITY
+               while (!tstc()) {
+                       extern void show_activity(int arg);
+                       show_activity(0);
+                       WATCHDOG_RESET();
+               }
+#endif
                rc = cread_line(prompt, p, &len, timeout);
                return rc < 0 ? rc : len;
 
@@ -1338,7 +1345,7 @@ static int builtin_run_command(const char *cmd, int flag)
                        continue;
                }
 
-               if (cmd_process(flag, argc, argv, &repeatable))
+               if (cmd_process(flag, argc, argv, &repeatable) != CMD_RET_SUCCESS)
                        rc = -1;
 
                /* Did the user stop this? */
index a1f955b9d76ed513c2b391939d302ab790a2778a..a15f749ac33513a9dd60d18e10c3aa7f2b0b3f08 100644 (file)
@@ -69,7 +69,7 @@
 #define BSP 0x08
 #define NAK 0x15
 #define CAN 0x18
-#define EOF 0x1A               /* ^Z for DOS officionados */
+#define EOF 0x1A               /* ^Z for DOS aficionados */
 
 #define USE_YMODEM_LENGTH
 
@@ -235,7 +235,7 @@ parse_num (char *s, unsigned long *val, char **es, char *delim)
 static int
 zm_dprintf (char *fmt, ...)
 {
-  int cur_console;
+  int cur_console __attribute__((unused));
   va_list args;
 
   va_start (args, fmt);
@@ -249,9 +249,10 @@ zm_dprintf (char *fmt, ...)
 #ifdef REDBOOT
   CYGACC_CALL_IF_SET_CONSOLE_COMM (cur_console);
 #endif
+  return 0;
 }
 
-static void
+static inline void
 zm_flush (void)
 {
 }
@@ -282,7 +283,7 @@ zm_dprintf (char *fmt, ...)
   return len;
 }
 
-static void
+static inline void
 zm_flush (void)
 {
 #ifdef REDBOOT
@@ -307,19 +308,19 @@ zm_dump_buf (void *buf, int len)
 static unsigned char zm_buf[2048];
 static unsigned char *zm_bp;
 
-static void
+static inline void
 zm_new (void)
 {
   zm_bp = zm_buf;
 }
 
-static void
+static inline void
 zm_save (unsigned char c)
 {
   *zm_bp++ = c;
 }
 
-static void
+static inline void
 zm_dump (int line)
 {
   zm_dprintf ("Packet at line: %d\n", line);
index fa33e628513ce78c097f33821f77794a569c74d4..aa208576bc42c4abdf3f1114e62a411a3ee1a2ef 100644 (file)
--- a/config.mk
+++ b/config.mk
@@ -104,7 +104,7 @@ HOSTCFLAGS  += -pedantic
 
 #########################################################################
 #
-# Option checker (courtesy linux kernel) to ensure
+# Option checker, gcc version (courtesy linux kernel) to ensure
 # only supported compiler options are used
 #
 CC_OPTIONS_CACHE_FILE := $(OBJTREE)/include/generated/cc_options.mk
@@ -125,6 +125,10 @@ cc-option = $(strip $(if $(findstring $1,$(CC_OPTIONS)),$1,\
                $(if $(call cc-option-sys,$1),$1,$2)))
 endif
 
+# cc-version
+# Usage gcc-ver := $(call cc-version)
+cc-version = $(shell $(SHELL) $(SRCTREE)/tools/gcc-version.sh $(CC))
+
 #
 # Include the make variables (CC, etc...)
 #
@@ -217,20 +221,17 @@ CPPFLAGS += -I$(TOPDIR)/include
 CPPFLAGS += -fno-builtin -ffreestanding -nostdinc      \
        -isystem $(gccincdir) -pipe $(PLATFORM_CPPFLAGS)
 
-ifdef BUILD_TAG
-CFLAGS := $(CPPFLAGS) -Wall -Wstrict-prototypes \
-       -DBUILD_TAG='"$(BUILD_TAG)"'
-else
-CFLAGS := $(CPPFLAGS) -Wall -Wstrict-prototypes
-endif
-
 CFLAGS_SSP := $(call cc-option,-fno-stack-protector)
-CFLAGS += $(CFLAGS_SSP)
+
 # Some toolchains enable security related warning flags by default,
 # but they don't make much sense in the u-boot world, so disable them.
 CFLAGS_WARN := $(call cc-option,-Wno-format-nonliteral) \
               $(call cc-option,-Wno-format-security)
-CFLAGS += $(CFLAGS_WARN)
+
+CFLAGS := $(CFLAGS_SSP) $(CFLAGS_WARN) $(CPPFLAGS) -Wall -Wstrict-prototypes
+ifdef BUILD_TAG
+       CFLAGS += -DBUILD_TAG='"$(BUILD_TAG)"'
+endif
 
 # Report stack usage if supported
 CFLAGS_STACK := $(call cc-option,-fstack-usage)
index 8ca5d4bdfc7a7203dede5d7b6bc6f8a226ca0b5a..5d01b344f17afdf25a518e49166ab068ffc425b0 100644 (file)
@@ -51,6 +51,9 @@ static const struct block_drvr block_drvr[] = {
 #if defined(CONFIG_CMD_IDE)
        { .name = "ide", .get_dev = ide_get_dev, },
 #endif
+#if defined(CONFIG_CMD_PATA)
+       { .name = "pata", .get_dev = pata_get_dev, },
+#endif
 #if defined(CONFIG_CMD_SATA)
        {.name = "sata", .get_dev = sata_get_dev, },
 #endif
@@ -108,6 +111,7 @@ block_dev_desc_t *get_dev(char* ifname, int dev)
 #endif
 
 #if (defined(CONFIG_CMD_IDE) || \
+       defined(CONFIG_CMD_PATA) || \
      defined(CONFIG_CMD_MG_DISK) || \
      defined(CONFIG_CMD_SATA) || \
      defined(CONFIG_CMD_SCSI) || \
@@ -244,6 +248,7 @@ void dev_print (block_dev_desc_t *dev_desc)
 #endif
 
 #if (defined(CONFIG_CMD_IDE) || \
+       defined(CONFIG_CMD_PATA) || \
      defined(CONFIG_CMD_MG_DISK) || \
      defined(CONFIG_CMD_SATA) || \
      defined(CONFIG_CMD_SCSI) || \
diff --git a/doc/README.KARO b/doc/README.KARO
new file mode 100755 (executable)
index 0000000..9fc611e
--- /dev/null
@@ -0,0 +1,39 @@
+                             Building & Flashing U-Boot for TX28
+                             ===================================
+
+Building U-Boot
+---------------
+
+Unpacking the source
+--------------------
+mkdir u-boot
+cd u-boot
+tar -xjf /cdrom/U-Boot/u-boot-src.tar.bz2
+
+Compiling U-Boot
+----------------
+export ARCH=arm
+export CROSS_COMPILE=arm-926ejs-linux-gnueabi-
+make tx28_config
+make
+
+
+Flashing U-Boot Image
+---------------------
+Load the U-Boot image with sbloader (either the Windows version or the
+Linux version) and use the builtin 'romupdate' command to program the
+image into the flash.
+
+Put the u-boot.sb file in the TFTP server data directory (usually
+/tftpboot).
+
+Load the U-Boot image:
+Enter the following commands at the U-Boot prompt
+set autostart no
+set autoload yes
+set bootfile u-boot.sb
+bootp
+romupdate
+
+Power down the module, make sure the BOOT_MODE jumper (ST3) is removed
+and re-apply power to start from flash.
diff --git a/doc/README.KARO-FDT b/doc/README.KARO-FDT
new file mode 100644 (file)
index 0000000..4bf01fa
--- /dev/null
@@ -0,0 +1,35 @@
+                                 Managing the device tree data in U-Boot
+                                =======================================
+
+The 'fdt' command can be used to manipulate the device tree (DT) data
+that is passed from U-Boot to Linux.
+
+- 'fdt boardsetup' will trim out some device nodes according to
+  environment settings:
+
+Environment setting            removed nodes
+---------------------------------------------
+otg_mode=host                  usbh1
+otg_mode=device                        usbotg
+otg_mode=<UNSET>               <both of the above> + usbphy
+
+touchpanel=edt-ft5x06          ti,tsc2007
+touchpanel=tsc2007             edt,edt-ft5x06
+touchpanel=<UNSET>             <both of the above>
+
+Note: This command is automatically executed when booting Linux via
+      'run bootm_cmd'.
+
+- 'fdt rm' and 'fdt add' can be used to remove/create additional nodes.
+
+The whole DT data can be saved to and reloaded from the flash partition
+'dtb' (or any other partition):
+  nand erase.part dtb
+  nand write.jffs2 ${fdtaddr} dtb ${fdtsize}
+
+If a DT is loaded from flash which should not be further manipulated
+upon booting Linux, the string 'fdt boardsetup;' should be removed
+from the 'bootm_cmd' environment variable.
+
+Loading the DT data:
+  nand read ${fdtaddr} dtb
diff --git a/doc/README.KARO-TX28 b/doc/README.KARO-TX28
new file mode 100644 (file)
index 0000000..36b8657
--- /dev/null
@@ -0,0 +1,73 @@
+                                        U-Boot for TX28
+                                        ===============
+
+Building U-Boot
+---------------
+
+Note: There are currently two variants of the TX53 module, that
+      require slightly different U-Boot configurations. They are
+      distinguished through the last digit of the module name. Replace
+      the '?' in the following description with the corresponding
+      number from your TX51 module.
+      E.g. TX53-8031 => 'make tx53-xx31_config'
+
+Unpacking the source
+--------------------
+mkdir u-boot
+cd u-boot
+tar -xjf /cdrom/U-Boot/u-boot-src.tar.bz2
+
+Compiling U-Boot
+----------------
+export ARCH=arm
+export CROSS_COMPILE=arm-cortexa8-linux-gnueabi-
+make tx28-4?xx_config            (see above Note!)
+make
+
+
+Flashing U-Boot Image
+---------------------
+If you want to replace a working U-Boot with a new version, you can
+load the new U-Boot image via TFTP and program it like any other flash
+partition with:
+nand erase.part u-boot;nand write.trimffs ${fileaddr} u-boot ${filesize}
+
+If you want to revive a bricked module, U-Boot can be downloaded via
+USB with the 'sbloader' tool in recovery boot mode (Jumper ST3
+on Starterkit-5 baseboard closed). See TX28-U-Boot.pdf for details.
+
+
+U-Boot Features
+---------------
+
+Environment variables:
+
+cpu_clk       <CPU freq [MHz]>
+touchpanel    {tsc2007|edt-ft5x06}
+otg_mode      [host|device|none]
+video_mode    <video mode as understood by Linux fb_find_mode() function>
+              e.g.: VGA-1:640x480MR-24@60
+baseboard     {stk5-v3|stk5-v5} selects type of baseboard
+splashimage   either: memory address (e.g. ${loadaddr}) of a BMP file
+             to be displayed instead of the built-in logo. Since NAND
+             flash is not accessible in a memory mapped fashion,
+             U-Boot will try to load the contents of the flash
+             partition 'logo.bmp' to the address given with
+             'splashimage'.
+
+             or: the name of an MTD partition, that contains a raw
+             dump of the frame buffer contents which will be loaded
+             to the framebuffer.
+
+splashpos     (when 'splashimage' contains a memory address) the
+             position ('x,y') on the screen at which the BMP image
+             will be displayed.
+             Setting splashpos to 'm,m' will center the image on the
+             screen.
+
+Note: Some variables (like 'cpu_clk' or 'splashimage') may render the
+      board unbootable if incorrectly set. Therefore these variables
+      will not be evaluated in case the board has been reset through a
+      watchdog reset or a character is available on the serial console
+      during startup to give the user a chance to recover from this
+      situation.
diff --git a/doc/README.KARO-TX48 b/doc/README.KARO-TX48
new file mode 100644 (file)
index 0000000..74d465d
--- /dev/null
@@ -0,0 +1,55 @@
+                                        U-Boot for TX48
+                                        ===============
+
+Building U-Boot
+---------------
+
+Unpacking the source
+--------------------
+mkdir u-boot
+cd u-boot
+tar -xjf /cdrom/U-Boot/u-boot-src.tar.bz2
+
+Compiling U-Boot
+----------------
+export ARCH=arm
+export CROSS_COMPILE=arm-cortexa8-linux-gnueabi-
+make tx48_config
+make
+
+
+Flashing U-Boot Image
+---------------------
+If you want to replace a working U-Boot with a new version, you can
+load the new U-Boot image via TFTP and program it like any other flash
+partition with:
+nand erase.part u-boot;nand write.trimffs ${fileaddr} u-boot ${filesize}
+
+If you want to revive a bricked module, U-Boot can be downloaded via
+xmodem protocol over the serial port in recovery boot mode (Jumper ST3
+on Starterkit-5 baseboard closed). See TX48-U-Boot.pdf for details.
+
+
+U-Boot Features
+---------------
+
+Environment variables:
+
+cpu_clk       <CPU freq [MHz]>
+touchpanel    {tsc2007|edt-ft5x06}
+otg_mode      [host|device|none]
+video_mode    <video mode as understood by Linux fb_find_mode() function>
+              e.g.: 640x480MR-24@60
+baseboard     {stk5-v3|stk5-v5} selects type of baseboard
+splashimage   memory address of a BMP file to be displayed instead of
+             the built-in logo. Since NAND flash is not accessible in
+             a memory mapped fashion, U-Boot will try to load the
+             contents of the flash partition 'logo' to the address
+             given with 'splashimage'.
+
+Note: Some variables (like 'cpu_clk' or 'splashimage') may render the
+      board unbootable if incorrectly set. Therefore these variables
+      will not be evaluated in case the board has been reset through a
+      watchdog reset or a character is available on the serial console
+      during startup to give the user a chance to recover from this
+      situation.
diff --git a/doc/README.KARO-TX51 b/doc/README.KARO-TX51
new file mode 100644 (file)
index 0000000..c3769f2
--- /dev/null
@@ -0,0 +1,64 @@
+                                        U-Boot for TX51
+                                        ===============
+
+Building U-Boot
+---------------
+
+Note: There are currently three variants of the TX51 module, that
+      require slightly different U-Boot configurations. They are
+      distinguished through the last digit of the module name. Replace
+      the '?' in the following description with the corresponding
+      numbers from your TX51 module.
+      E.g. TX51-8021 => 'make tx51-8xx1_config'
+
+Unpacking the source
+--------------------
+mkdir u-boot
+cd u-boot
+tar -xjf /cdrom/U-Boot/u-boot-src.tar.bz2
+
+Compiling U-Boot
+----------------
+export ARCH=arm
+export CROSS_COMPILE=arm-cortexa8-linux-gnueabi-
+make tx51-?xx?_config            (see above Note!)
+make
+
+
+Flashing U-Boot Image
+---------------------
+If you want to replace a working U-Boot with a new version, you can
+load the new U-Boot image via TFTP and program it like any other flash
+partition with:
+nand erase.part u-boot;nand write ${fileaddr} u-boot ${filesize}
+
+If you want to revive a bricked module, you can use one of the
+flashtools provided with the BSP to reprogram the flash.
+
+
+U-Boot Features
+---------------
+
+Environment variables:
+
+cpu_clk       <CPU freq [MHz]>
+touchpanel    {tsc2007|edt-ft5x06}
+otg_mode      [host|device|none]
+video_mode    <video mode as understood by Linux fb_find_mode() function>
+              e.g.: VGA-1:640x480MR-24@60
+baseboard     {stk5-v3|stk5-v5} selects type of baseboard
+             'stk5-v5' setting disables USB Host mode on USBOTG port.
+             strings not starting in 'stk5' prevent the STK5 specific
+             pad initialization to be done.
+splashimage   memory address of a BMP file to be displayed instead of
+             the built-in logo. Since NAND flash is not accessible in
+             a memory mapped fashion, U-Boot will try to load the
+             contents of the flash partition 'logo' to the address
+             given with 'splashimage'.
+
+Note: Some variables (like 'cpu_clk' or 'splashimage') may render the
+      board unbootable if incorrectly set. Therefore these variables
+      will not be evaluated in case the board has been reset through a
+      watchdog reset or a character is available on the serial console
+      during startup to give the user a chance to recover from this
+      situation.
diff --git a/doc/README.KARO-TX53 b/doc/README.KARO-TX53
new file mode 100644 (file)
index 0000000..2150204
--- /dev/null
@@ -0,0 +1,65 @@
+                                        U-Boot for TX53
+                                        ===============
+
+Building U-Boot
+---------------
+
+Note: There are currently two variants of the TX53 module, that
+      require slightly different U-Boot configurations. They are
+      distinguished through the last digit of the module name. Replace
+      the '?' in the following description with the corresponding
+      number from your TX51 module.
+      E.g. TX53-8031 => 'make tx53-xx31_config'
+
+Unpacking the source
+--------------------
+mkdir u-boot
+cd u-boot
+tar -xjf /cdrom/U-Boot/u-boot-src.tar.bz2
+
+Compiling U-Boot
+----------------
+export ARCH=arm
+export CROSS_COMPILE=arm-cortexa8-linux-gnueabi-
+make tx53-xx3?_config            (see above Note!)
+make
+
+
+Flashing U-Boot Image
+---------------------
+If you want to replace a working U-Boot with a new version, you can
+load the new U-Boot image via TFTP and program it like any other flash
+partition with:
+nand erase.part u-boot;nand write ${fileaddr} u-boot ${filesize}
+
+If you want to revive a bricked module, you can use one of the
+flashtools provided with the BSP to reprogram the flash.
+
+
+U-Boot Features
+---------------
+
+Environment variables:
+
+cpu_clk       <CPU freq [MHz]>
+touchpanel    {tsc2007|edt-ft5x06}
+otg_mode      [host|device|none]
+video_mode    <video mode as understood by Linux fb_find_mode() function>
+              e.g.: VGA-1:640x480MR-24@60
+baseboard     {stk5-v3|stk5-v5} selects type of baseboard
+             'stk5-v5' setting enables CAN transceiver switch on GPIO4_21 and
+             disables USB Host mode on USBOTG port.
+             strings not starting in 'stk5' prevent the STK5 specific
+             pad initialization to be done.
+splashimage   memory address of a BMP file to be displayed instead of
+             the built-in logo. Since NAND flash is not accessible in
+             a memory mapped fashion, U-Boot will try to load the
+             contents of the flash partition 'logo' to the address
+             given with 'splashimage'.
+
+Note: Some variables (like 'cpu_clk' or 'splashimage') may render the
+      board unbootable if incorrectly set. Therefore these variables
+      will not be evaluated in case the board has been reset through a
+      watchdog reset or a character is available on the serial console
+      during startup to give the user a chance to recover from this
+      situation.
index cc5d5c09ad708fe552de5f62239159c4aedbbc6f..a543e65d39bc58021daff745ebb705a360ab69a9 100644 (file)
@@ -34,14 +34,14 @@ DDR1: 0x80000000 - 0xBFFFFFFF
 
 Option 1 (SPL only):
 0x40200800 - 0x4020BBFF: Area for SPL text, data and rodata
-0x4020BC00 - 0x4020FFFC: Area for the SPL stack.
+0x4020E000 - 0x4020FFFC: Area for the SPL stack.
 0x80000000 - 0x8007FFFF: Area for the SPL BSS.
 0x80100000: CONFIG_SYS_TEXT_BASE of U-Boot
 0x80208000 - 0x80307FFF: malloc() pool available to SPL.
 
 Option 2 (SPL or X-Loader):
 0x40200800 - 0x4020BBFF: Area for SPL text, data and rodata
-0x4020BC00 - 0x4020FFFC: Area for the SPL stack.
+0x4020E000 - 0x4020FFFC: Area for the SPL stack.
 0x80008000: CONFIG_SYS_TEXT_BASE of U-Boot
 0x87000000 - 0x8707FFFF: Area for the SPL BSS.
 0x87080000 - 0x870FFFFF: malloc() pool available to SPL.
index 7553087b2630eeefdded4c8fa90a1a3bce33b9c6..5f6c795fb7ffc8f45334eac7dca5cca2a916ae10 100644 (file)
@@ -118,11 +118,6 @@ static u32 x86emu_parity_tab[8] =
 
 #define PARITY(x)   (((x86emu_parity_tab[(x) / 32] >> ((x) % 32)) & 1) == 0)
 #define XOR2(x)            (((x) ^ ((x)>>1)) & 0x1)
-/*----------------------------- Implementation ----------------------------*/
-int abs(int v)
-{
-       return (v>0)?v:-v;
-}
 
 /*----------------------------- Implementation ----------------------------*/
 
index 98560ef76f36c198d1614f5c5f8ab90114fb2015..b9c20475c26e86ee34e77eec96073c585292df62 100644 (file)
@@ -27,6 +27,7 @@ LIB   := $(obj)libblock.o
 
 COBJS-$(CONFIG_SCSI_AHCI) += ahci.o
 COBJS-$(CONFIG_ATA_PIIX) += ata_piix.o
+COBJS-$(CONFIG_DWC_AHSATA) += dwc_ahsata.o
 COBJS-$(CONFIG_FSL_SATA) += fsl_sata.o
 COBJS-$(CONFIG_IDE_FTIDE020) += ftide020.o
 COBJS-$(CONFIG_LIBATA) += libata.o
diff --git a/drivers/block/dwc_ahsata.c b/drivers/block/dwc_ahsata.c
new file mode 100644 (file)
index 0000000..2703d3d
--- /dev/null
@@ -0,0 +1,969 @@
+/*
+ * Copyright (C) 2010-2011 Freescale Semiconductor, Inc.
+ * Terry Lv <r65388@freescale.com>
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc.
+ *
+ */
+
+#include <libata.h>
+#include <ahci.h>
+#include <fis.h>
+
+#include <common.h>
+#include <malloc.h>
+#include <linux/ctype.h>
+#include <asm/errno.h>
+#include <asm/io.h>
+#include <linux/bitops.h>
+#include <asm/arch/clock.h>
+#include "dwc_ahsata.h"
+
+struct sata_port_regs {
+       u32 clb;
+       u32 clbu;
+       u32 fb;
+       u32 fbu;
+       u32 is;
+       u32 ie;
+       u32 cmd;
+       u32 res1[1];
+       u32 tfd;
+       u32 sig;
+       u32 ssts;
+       u32 sctl;
+       u32 serr;
+       u32 sact;
+       u32 ci;
+       u32 sntf;
+       u32 res2[1];
+       u32 dmacr;
+       u32 res3[1];
+       u32 phycr;
+       u32 physr;
+};
+
+struct sata_host_regs {
+       u32 cap;
+       u32 ghc;
+       u32 is;
+       u32 pi;
+       u32 vs;
+       u32 ccc_ctl;
+       u32 ccc_ports;
+       u32 res1[2];
+       u32 cap2;
+       u32 res2[30];
+       u32 bistafr;
+       u32 bistcr;
+       u32 bistfctr;
+       u32 bistsr;
+       u32 bistdecr;
+       u32 res3[2];
+       u32 oobr;
+       u32 res4[8];
+       u32 timer1ms;
+       u32 res5[1];
+       u32 gparam1r;
+       u32 gparam2r;
+       u32 pparamr;
+       u32 testr;
+       u32 versionr;
+       u32 idr;
+};
+
+#define MAX_DATA_BYTES_PER_SG  (4 * 1024 * 1024)
+#define MAX_BYTES_PER_TRANS (AHCI_MAX_SG * MAX_DATA_BYTES_PER_SG)
+
+#define writel_with_flush(a, b)        do { writel(a, b); readl(b); } while (0)
+
+static int is_ready;
+
+static inline u32 ahci_port_base(u32 base, u32 port)
+{
+       return base + 0x100 + (port * 0x80);
+}
+
+static int waiting_for_cmd_completed(u8 *offset,
+                                       int timeout_msec,
+                                       u32 sign)
+{
+       int i;
+       u32 status;
+
+       for (i = 0;
+               ((status = readl(offset)) & sign) && i < timeout_msec;
+               ++i)
+               mdelay(1);
+
+       return (i < timeout_msec) ? 0 : -1;
+}
+
+static int ahci_setup_oobr(struct ahci_probe_ent *probe_ent,
+                                               int clk)
+{
+       struct sata_host_regs *host_mmio =
+               (struct sata_host_regs *)probe_ent->mmio_base;
+
+       writel(SATA_HOST_OOBR_WE, &(host_mmio->oobr));
+       writel(0x02060b14, &(host_mmio->oobr));
+
+       return 0;
+}
+
+static int ahci_host_init(struct ahci_probe_ent *probe_ent)
+{
+       u32 tmp, cap_save, num_ports;
+       int i, j, timeout = 1000;
+       struct sata_port_regs *port_mmio = NULL;
+       struct sata_host_regs *host_mmio =
+               (struct sata_host_regs *)probe_ent->mmio_base;
+       int clk = mxc_get_clock(MXC_SATA_CLK);
+
+       cap_save = readl(&(host_mmio->cap));
+       cap_save |= SATA_HOST_CAP_SSS;
+
+       /* global controller reset */
+       tmp = readl(&(host_mmio->ghc));
+       if ((tmp & SATA_HOST_GHC_HR) == 0)
+               writel_with_flush(tmp | SATA_HOST_GHC_HR, &(host_mmio->ghc));
+
+       while ((readl(&(host_mmio->ghc)) & SATA_HOST_GHC_HR)
+               && --timeout)
+               ;
+
+       if (timeout <= 0) {
+               debug("controller reset failed (0x%x)\n", tmp);
+               return -1;
+       }
+
+       /* Set timer 1ms */
+       writel(clk / 1000, &(host_mmio->timer1ms));
+
+       ahci_setup_oobr(probe_ent, 0);
+
+       writel_with_flush(SATA_HOST_GHC_AE, &(host_mmio->ghc));
+       writel(cap_save, &(host_mmio->cap));
+       num_ports = (cap_save & SATA_HOST_CAP_NP_MASK) + 1;
+       writel_with_flush((1 << num_ports) - 1,
+                               &(host_mmio->pi));
+
+       /*
+        * Determine which Ports are implemented by the DWC_ahsata,
+        * by reading the PI register. This bit map value aids the
+        * software to determine how many Ports are available and
+        * which Port registers need to be initialized.
+        */
+       probe_ent->cap = readl(&(host_mmio->cap));
+       probe_ent->port_map = readl(&(host_mmio->pi));
+
+       /* Determine how many command slots the HBA supports */
+       probe_ent->n_ports =
+               (probe_ent->cap & SATA_HOST_CAP_NP_MASK) + 1;
+
+       debug("cap 0x%x  port_map 0x%x  n_ports %d\n",
+               probe_ent->cap, probe_ent->port_map, probe_ent->n_ports);
+
+       for (i = 0; i < probe_ent->n_ports; i++) {
+               probe_ent->port[i].port_mmio =
+                       ahci_port_base((u32)host_mmio, i);
+               port_mmio =
+                       (struct sata_port_regs *)probe_ent->port[i].port_mmio;
+
+               /* Ensure that the DWC_ahsata is in idle state */
+               tmp = readl(&(port_mmio->cmd));
+
+               /*
+                * When P#CMD.ST, P#CMD.CR, P#CMD.FRE and P#CMD.FR
+                * are all cleared, the Port is in an idle state.
+                */
+               if (tmp & (SATA_PORT_CMD_CR | SATA_PORT_CMD_FR |
+                       SATA_PORT_CMD_FRE | SATA_PORT_CMD_ST)) {
+
+                       /*
+                        * System software places a Port into the idle state by
+                        * clearing P#CMD.ST and waiting for P#CMD.CR to return
+                        * 0 when read.
+                        */
+                       tmp &= ~SATA_PORT_CMD_ST;
+                       writel_with_flush(tmp, &(port_mmio->cmd));
+
+                       /*
+                        * spec says 500 msecs for each bit, so
+                        * this is slightly incorrect.
+                        */
+                       mdelay(500);
+
+                       timeout = 1000;
+                       while ((readl(&(port_mmio->cmd)) & SATA_PORT_CMD_CR)
+                               && --timeout)
+                               ;
+
+                       if (timeout <= 0) {
+                               debug("port reset failed (0x%x)\n", tmp);
+                               return -1;
+                       }
+               }
+
+               /* Spin-up device */
+               tmp = readl(&(port_mmio->cmd));
+               writel((tmp | SATA_PORT_CMD_SUD), &(port_mmio->cmd));
+
+               /* Wait for spin-up to finish */
+               timeout = 1000;
+               while (!(readl(&(port_mmio->cmd)) | SATA_PORT_CMD_SUD)
+                       && --timeout)
+                       ;
+               if (timeout <= 0) {
+                       debug("Spin-Up can't finish!\n");
+                       return -1;
+               }
+
+               for (j = 0; j < 100; ++j) {
+                       mdelay(10);
+                       tmp = readl(&(port_mmio->ssts));
+                       if (((tmp & SATA_PORT_SSTS_DET_MASK) == 0x3) ||
+                               ((tmp & SATA_PORT_SSTS_DET_MASK) == 0x1))
+                               break;
+               }
+
+               /* Wait for COMINIT bit 26 (DIAG_X) in SERR */
+               timeout = 1000;
+               while (!(readl(&(port_mmio->serr)) | SATA_PORT_SERR_DIAG_X)
+                       && --timeout)
+                       ;
+               if (timeout <= 0) {
+                       debug("Can't find DIAG_X set!\n");
+                       return -1;
+               }
+
+               /*
+                * For each implemented Port, clear the P#SERR
+                * register, by writing ones to each implemented\
+                * bit location.
+                */
+               tmp = readl(&(port_mmio->serr));
+               debug("P#SERR 0x%x\n",
+                               tmp);
+               writel(tmp, &(port_mmio->serr));
+
+               /* Ack any pending irq events for this port */
+               tmp = readl(&(host_mmio->is));
+               debug("IS 0x%x\n", tmp);
+               if (tmp)
+                       writel(tmp, &(host_mmio->is));
+
+               writel(1 << i, &(host_mmio->is));
+
+               /* set irq mask (enables interrupts) */
+               writel(DEF_PORT_IRQ, &(port_mmio->ie));
+
+               /* register linkup ports */
+               tmp = readl(&(port_mmio->ssts));
+               debug("Port %d status: 0x%x\n", i, tmp);
+               if ((tmp & SATA_PORT_SSTS_DET_MASK) == 0x03)
+                       probe_ent->link_port_map |= (0x01 << i);
+       }
+
+       tmp = readl(&(host_mmio->ghc));
+       debug("GHC 0x%x\n", tmp);
+       writel(tmp | SATA_HOST_GHC_IE, &(host_mmio->ghc));
+       tmp = readl(&(host_mmio->ghc));
+       debug("GHC 0x%x\n", tmp);
+
+       return 0;
+}
+
+static void ahci_print_info(struct ahci_probe_ent *probe_ent)
+{
+       struct sata_host_regs *host_mmio =
+               (struct sata_host_regs *)probe_ent->mmio_base;
+       u32 vers, cap, impl, speed;
+       const char *speed_s;
+       const char *scc_s;
+
+       vers = readl(&(host_mmio->vs));
+       cap = probe_ent->cap;
+       impl = probe_ent->port_map;
+
+       speed = (cap & SATA_HOST_CAP_ISS_MASK)
+               >> SATA_HOST_CAP_ISS_OFFSET;
+       if (speed == 1)
+               speed_s = "1.5";
+       else if (speed == 2)
+               speed_s = "3";
+       else
+               speed_s = "?";
+
+       scc_s = "SATA";
+
+       printf("AHCI %02x%02x.%02x%02x "
+               "%u slots %u ports %s Gbps 0x%x impl %s mode\n",
+               (vers >> 24) & 0xff,
+               (vers >> 16) & 0xff,
+               (vers >> 8) & 0xff,
+               vers & 0xff,
+               ((cap >> 8) & 0x1f) + 1,
+               (cap & 0x1f) + 1,
+               speed_s,
+               impl,
+               scc_s);
+
+       printf("flags: "
+               "%s%s%s%s%s%s"
+               "%s%s%s%s%s%s%s\n",
+               cap & (1 << 31) ? "64bit " : "",
+               cap & (1 << 30) ? "ncq " : "",
+               cap & (1 << 28) ? "ilck " : "",
+               cap & (1 << 27) ? "stag " : "",
+               cap & (1 << 26) ? "pm " : "",
+               cap & (1 << 25) ? "led " : "",
+               cap & (1 << 24) ? "clo " : "",
+               cap & (1 << 19) ? "nz " : "",
+               cap & (1 << 18) ? "only " : "",
+               cap & (1 << 17) ? "pmp " : "",
+               cap & (1 << 15) ? "pio " : "",
+               cap & (1 << 14) ? "slum " : "",
+               cap & (1 << 13) ? "part " : "");
+}
+
+static int ahci_init_one(int pdev)
+{
+       int rc;
+       struct ahci_probe_ent *probe_ent = NULL;
+
+       probe_ent = malloc(sizeof(struct ahci_probe_ent));
+       memset(probe_ent, 0, sizeof(struct ahci_probe_ent));
+       probe_ent->dev = pdev;
+
+       probe_ent->host_flags = ATA_FLAG_SATA
+                               | ATA_FLAG_NO_LEGACY
+                               | ATA_FLAG_MMIO
+                               | ATA_FLAG_PIO_DMA
+                               | ATA_FLAG_NO_ATAPI;
+
+       probe_ent->mmio_base = CONFIG_DWC_AHSATA_BASE_ADDR;
+
+       /* initialize adapter */
+       rc = ahci_host_init(probe_ent);
+       if (rc)
+               goto err_out;
+
+       ahci_print_info(probe_ent);
+
+       /* Save the private struct to block device struct */
+       sata_dev_desc[pdev].priv = (void *)probe_ent;
+
+       return 0;
+
+err_out:
+       return rc;
+}
+
+static int ahci_fill_sg(struct ahci_probe_ent *probe_ent,
+                       u8 port, unsigned char *buf, int buf_len)
+{
+       struct ahci_ioports *pp = &(probe_ent->port[port]);
+       struct ahci_sg *ahci_sg = pp->cmd_tbl_sg;
+       u32 sg_count, max_bytes;
+       int i;
+
+       max_bytes = MAX_DATA_BYTES_PER_SG;
+       sg_count = ((buf_len - 1) / max_bytes) + 1;
+       if (sg_count > AHCI_MAX_SG) {
+               printf("Error:Too much sg!\n");
+               return -1;
+       }
+
+       for (i = 0; i < sg_count; i++) {
+               ahci_sg->addr =
+                       cpu_to_le32((u32)buf + i * max_bytes);
+               ahci_sg->addr_hi = 0;
+               ahci_sg->flags_size = cpu_to_le32(0x3fffff &
+                                       (buf_len < max_bytes
+                                       ? (buf_len - 1)
+                                       : (max_bytes - 1)));
+               ahci_sg++;
+               buf_len -= max_bytes;
+       }
+
+       return sg_count;
+}
+
+static void ahci_fill_cmd_slot(struct ahci_ioports *pp, u32 cmd_slot, u32 opts)
+{
+       struct ahci_cmd_hdr *cmd_hdr = (struct ahci_cmd_hdr *)(pp->cmd_slot +
+                                       AHCI_CMD_SLOT_SZ * cmd_slot);
+
+       memset(cmd_hdr, 0, AHCI_CMD_SLOT_SZ);
+       cmd_hdr->opts = cpu_to_le32(opts);
+       cmd_hdr->status = 0;
+       cmd_hdr->tbl_addr = cpu_to_le32(pp->cmd_tbl & 0xffffffff);
+       cmd_hdr->tbl_addr_hi = 0;
+}
+
+#define AHCI_GET_CMD_SLOT(c) ((c) ? ffs(c) : 0)
+
+static int ahci_exec_ata_cmd(struct ahci_probe_ent *probe_ent,
+               u8 port, struct sata_fis_h2d *cfis,
+               u8 *buf, u32 buf_len, s32 is_write)
+{
+       struct ahci_ioports *pp = &(probe_ent->port[port]);
+       struct sata_port_regs *port_mmio =
+                       (struct sata_port_regs *)pp->port_mmio;
+       u32 opts;
+       int sg_count = 0, cmd_slot = 0;
+
+       cmd_slot = AHCI_GET_CMD_SLOT(readl(&(port_mmio->ci)));
+       if (32 == cmd_slot) {
+               printf("Can't find empty command slot!\n");
+               return 0;
+       }
+
+       /* Check xfer length */
+       if (buf_len > MAX_BYTES_PER_TRANS) {
+               printf("Max transfer length is %dB\n\r",
+                       MAX_BYTES_PER_TRANS);
+               return 0;
+       }
+
+       memcpy((u8 *)(pp->cmd_tbl), cfis, sizeof(struct sata_fis_h2d));
+       if (buf && buf_len)
+               sg_count = ahci_fill_sg(probe_ent, port, buf, buf_len);
+       opts = (sizeof(struct sata_fis_h2d) >> 2) | (sg_count << 16);
+       if (is_write)
+               opts |= 0x40;
+       ahci_fill_cmd_slot(pp, cmd_slot, opts);
+
+       writel_with_flush(1 << cmd_slot, &(port_mmio->ci));
+
+       if (waiting_for_cmd_completed((u8 *)&(port_mmio->ci),
+                               10000, 0x1 << cmd_slot)) {
+               printf("timeout exit!\n");
+               return -1;
+       }
+       debug("ahci_exec_ata_cmd: %d byte transferred.\n",
+             pp->cmd_slot->status);
+
+       return buf_len;
+}
+
+static void ahci_set_feature(u8 dev, u8 port)
+{
+       struct ahci_probe_ent *probe_ent =
+               (struct ahci_probe_ent *)sata_dev_desc[dev].priv;
+       struct sata_fis_h2d h2d, *cfis = &h2d;
+
+       memset(cfis, 0, sizeof(struct sata_fis_h2d));
+       cfis->fis_type = SATA_FIS_TYPE_REGISTER_H2D;
+       cfis->pm_port_c = 1 << 7;
+       cfis->command = ATA_CMD_SET_FEATURES;
+       cfis->features = SETFEATURES_XFER;
+       cfis->sector_count = ffs(probe_ent->udma_mask + 1) + 0x3e;
+
+       ahci_exec_ata_cmd(probe_ent, port, cfis, NULL, 0, READ_CMD);
+}
+
+static int ahci_port_start(struct ahci_probe_ent *probe_ent,
+                                       u8 port)
+{
+       struct ahci_ioports *pp = &(probe_ent->port[port]);
+       struct sata_port_regs *port_mmio =
+               (struct sata_port_regs *)pp->port_mmio;
+       u32 port_status;
+       u32 mem;
+       int timeout = 10000000;
+
+       debug("Enter start port: %d\n", port);
+       port_status = readl(&(port_mmio->ssts));
+       debug("Port %d status: %x\n", port, port_status);
+       if ((port_status & 0xf) != 0x03) {
+               printf("No Link on this port!\n");
+               return -1;
+       }
+
+       mem = (u32)malloc(AHCI_PORT_PRIV_DMA_SZ + 1024);
+       if (!mem) {
+               free(pp);
+               printf("No mem for table!\n");
+               return -ENOMEM;
+       }
+
+       mem = (mem + 0x400) & (~0x3ff); /* Aligned to 1024-bytes */
+       memset((u8 *)mem, 0, AHCI_PORT_PRIV_DMA_SZ);
+
+       /*
+        * First item in chunk of DMA memory: 32-slot command table,
+        * 32 bytes each in size
+        */
+       pp->cmd_slot = (struct ahci_cmd_hdr *)mem;
+       debug("cmd_slot = 0x%x\n", (unsigned int) pp->cmd_slot);
+       mem += (AHCI_CMD_SLOT_SZ * DWC_AHSATA_MAX_CMD_SLOTS);
+
+       /*
+        * Second item: Received-FIS area, 256-Byte aligned
+        */
+       pp->rx_fis = mem;
+       mem += AHCI_RX_FIS_SZ;
+
+       /*
+        * Third item: data area for storing a single command
+        * and its scatter-gather table
+        */
+       pp->cmd_tbl = mem;
+       debug("cmd_tbl_dma = 0x%x\n", pp->cmd_tbl);
+
+       mem += AHCI_CMD_TBL_HDR;
+
+       writel_with_flush(0x00004444, &(port_mmio->dmacr));
+       pp->cmd_tbl_sg = (struct ahci_sg *)mem;
+       writel_with_flush((u32)pp->cmd_slot, &(port_mmio->clb));
+       writel_with_flush(pp->rx_fis, &(port_mmio->fb));
+
+       /* Enable FRE */
+       writel_with_flush((SATA_PORT_CMD_FRE | readl(&(port_mmio->cmd))),
+                       &(port_mmio->cmd));
+
+       /* Wait device ready */
+       while ((readl(&(port_mmio->tfd)) & (SATA_PORT_TFD_STS_ERR |
+               SATA_PORT_TFD_STS_DRQ | SATA_PORT_TFD_STS_BSY))
+               && --timeout)
+               ;
+       if (timeout <= 0) {
+               debug("Device not ready for BSY, DRQ and"
+                       "ERR in TFD!\n");
+               return -1;
+       }
+
+       writel_with_flush(PORT_CMD_ICC_ACTIVE | PORT_CMD_FIS_RX |
+                         PORT_CMD_POWER_ON | PORT_CMD_SPIN_UP |
+                         PORT_CMD_START, &(port_mmio->cmd));
+
+       debug("Exit start port %d\n", port);
+
+       return 0;
+}
+
+int init_sata(int dev)
+{
+       int i;
+       u32 linkmap;
+       struct ahci_probe_ent *probe_ent = NULL;
+
+       if (dev < 0 || dev > (CONFIG_SYS_SATA_MAX_DEVICE - 1)) {
+               printf("The sata index %d is out of ranges\n\r", dev);
+               return -1;
+       }
+
+       ahci_init_one(dev);
+
+       probe_ent = (struct ahci_probe_ent *)sata_dev_desc[dev].priv;
+       linkmap = probe_ent->link_port_map;
+
+       if (0 == linkmap) {
+               printf("No port device detected!\n");
+               return 1;
+       }
+
+       for (i = 0; i < probe_ent->n_ports; i++) {
+               if ((linkmap >> i) && ((linkmap >> i) & 0x01)) {
+                       if (ahci_port_start(probe_ent, (u8)i)) {
+                               printf("Can not start port %d\n", i);
+                               return 1;
+                       }
+                       probe_ent->hard_port_no = i;
+                       break;
+               }
+       }
+
+       return 0;
+}
+
+static void dwc_ahsata_print_info(int dev)
+{
+       block_dev_desc_t *pdev = &(sata_dev_desc[dev]);
+
+       printf("SATA Device Info:\n\r");
+#ifdef CONFIG_SYS_64BIT_LBA
+       printf("S/N: %s\n\rProduct model number: %s\n\r"
+               "Firmware version: %s\n\rCapacity: %lld sectors\n\r",
+               pdev->product, pdev->vendor, pdev->revision, pdev->lba);
+#else
+       printf("S/N: %s\n\rProduct model number: %s\n\r"
+               "Firmware version: %s\n\rCapacity: %ld sectors\n\r",
+               pdev->product, pdev->vendor, pdev->revision, pdev->lba);
+#endif
+}
+
+static void dwc_ahsata_identify(int dev, u16 *id)
+{
+       struct ahci_probe_ent *probe_ent =
+               (struct ahci_probe_ent *)sata_dev_desc[dev].priv;
+       struct sata_fis_h2d h2d, *cfis = &h2d;
+       u8 port = probe_ent->hard_port_no;
+
+       memset(cfis, 0, sizeof(struct sata_fis_h2d));
+
+       cfis->fis_type = SATA_FIS_TYPE_REGISTER_H2D;
+       cfis->pm_port_c = 0x80; /* is command */
+       cfis->command = ATA_CMD_ID_ATA;
+
+       ahci_exec_ata_cmd(probe_ent, port, cfis,
+                       (u8 *)id, ATA_ID_WORDS * 2, READ_CMD);
+       ata_swap_buf_le16(id, ATA_ID_WORDS);
+}
+
+static void dwc_ahsata_xfer_mode(int dev, u16 *id)
+{
+       struct ahci_probe_ent *probe_ent =
+               (struct ahci_probe_ent *)sata_dev_desc[dev].priv;
+
+       probe_ent->pio_mask = id[ATA_ID_PIO_MODES];
+       probe_ent->udma_mask = id[ATA_ID_UDMA_MODES];
+       debug("pio %04x, udma %04x\n\r",
+               probe_ent->pio_mask, probe_ent->udma_mask);
+}
+
+static u32 dwc_ahsata_rw_cmd(int dev, u32 start, u32 blkcnt,
+                               u8 *buffer, int is_write)
+{
+       struct ahci_probe_ent *probe_ent =
+               (struct ahci_probe_ent *)sata_dev_desc[dev].priv;
+       struct sata_fis_h2d h2d, *cfis = &h2d;
+       u8 port = probe_ent->hard_port_no;
+       u32 block;
+
+       block = start;
+
+       memset(cfis, 0, sizeof(struct sata_fis_h2d));
+
+       cfis->fis_type = SATA_FIS_TYPE_REGISTER_H2D;
+       cfis->pm_port_c = 0x80; /* is command */
+       cfis->command = (is_write) ? ATA_CMD_WRITE : ATA_CMD_READ;
+       cfis->device = ATA_LBA;
+
+       cfis->device |= (block >> 24) & 0xf;
+       cfis->lba_high = (block >> 16) & 0xff;
+       cfis->lba_mid = (block >> 8) & 0xff;
+       cfis->lba_low = block & 0xff;
+       cfis->sector_count = (u8)(blkcnt & 0xff);
+
+       if (ahci_exec_ata_cmd(probe_ent, port, cfis,
+                       buffer, ATA_SECT_SIZE * blkcnt, is_write) > 0)
+               return blkcnt;
+       else
+               return 0;
+}
+
+void dwc_ahsata_flush_cache(int dev)
+{
+       struct ahci_probe_ent *probe_ent =
+               (struct ahci_probe_ent *)sata_dev_desc[dev].priv;
+       struct sata_fis_h2d h2d, *cfis = &h2d;
+       u8 port = probe_ent->hard_port_no;
+
+       memset(cfis, 0, sizeof(struct sata_fis_h2d));
+
+       cfis->fis_type = SATA_FIS_TYPE_REGISTER_H2D;
+       cfis->pm_port_c = 0x80; /* is command */
+       cfis->command = ATA_CMD_FLUSH;
+
+       ahci_exec_ata_cmd(probe_ent, port, cfis, NULL, 0, 0);
+}
+
+static u32 dwc_ahsata_rw_cmd_ext(int dev, u32 start, lbaint_t blkcnt,
+                               u8 *buffer, int is_write)
+{
+       struct ahci_probe_ent *probe_ent =
+               (struct ahci_probe_ent *)sata_dev_desc[dev].priv;
+       struct sata_fis_h2d h2d, *cfis = &h2d;
+       u8 port = probe_ent->hard_port_no;
+       u64 block;
+
+       block = (u64)start;
+
+       memset(cfis, 0, sizeof(struct sata_fis_h2d));
+
+       cfis->fis_type = SATA_FIS_TYPE_REGISTER_H2D;
+       cfis->pm_port_c = 0x80; /* is command */
+
+       cfis->command = (is_write) ? ATA_CMD_WRITE_EXT
+                                : ATA_CMD_READ_EXT;
+
+       cfis->lba_high_exp = (block >> 40) & 0xff;
+       cfis->lba_mid_exp = (block >> 32) & 0xff;
+       cfis->lba_low_exp = (block >> 24) & 0xff;
+       cfis->lba_high = (block >> 16) & 0xff;
+       cfis->lba_mid = (block >> 8) & 0xff;
+       cfis->lba_low = block & 0xff;
+       cfis->device = ATA_LBA;
+       cfis->sector_count_exp = (blkcnt >> 8) & 0xff;
+       cfis->sector_count = blkcnt & 0xff;
+
+       if (ahci_exec_ata_cmd(probe_ent, port, cfis, buffer,
+                       ATA_SECT_SIZE * blkcnt, is_write) > 0)
+               return blkcnt;
+       else
+               return 0;
+}
+
+u32 dwc_ahsata_rw_ncq_cmd(int dev, u32 start, lbaint_t blkcnt,
+                               u8 *buffer, int is_write)
+{
+       struct ahci_probe_ent *probe_ent =
+               (struct ahci_probe_ent *)sata_dev_desc[dev].priv;
+       struct sata_fis_h2d h2d, *cfis = &h2d;
+       u8 port = probe_ent->hard_port_no;
+       u64 block;
+
+       if (sata_dev_desc[dev].lba48 != 1) {
+               printf("execute FPDMA command on non-LBA48 hard disk\n\r");
+               return -1;
+       }
+
+       block = (u64)start;
+
+       memset(cfis, 0, sizeof(struct sata_fis_h2d));
+
+       cfis->fis_type = SATA_FIS_TYPE_REGISTER_H2D;
+       cfis->pm_port_c = 0x80; /* is command */
+
+       cfis->command = (is_write) ? ATA_CMD_FPDMA_WRITE
+                                : ATA_CMD_FPDMA_READ;
+
+       cfis->lba_high_exp = (block >> 40) & 0xff;
+       cfis->lba_mid_exp = (block >> 32) & 0xff;
+       cfis->lba_low_exp = (block >> 24) & 0xff;
+       cfis->lba_high = (block >> 16) & 0xff;
+       cfis->lba_mid = (block >> 8) & 0xff;
+       cfis->lba_low = block & 0xff;
+
+       cfis->device = ATA_LBA;
+       cfis->features_exp = (blkcnt >> 8) & 0xff;
+       cfis->features = blkcnt & 0xff;
+
+       /* Use the latest queue */
+       ahci_exec_ata_cmd(probe_ent, port, cfis,
+                       buffer, ATA_SECT_SIZE * blkcnt, is_write);
+
+       return blkcnt;
+}
+
+void dwc_ahsata_flush_cache_ext(int dev)
+{
+       struct ahci_probe_ent *probe_ent =
+               (struct ahci_probe_ent *)sata_dev_desc[dev].priv;
+       struct sata_fis_h2d h2d, *cfis = &h2d;
+       u8 port = probe_ent->hard_port_no;
+
+       memset(cfis, 0, sizeof(struct sata_fis_h2d));
+
+       cfis->fis_type = SATA_FIS_TYPE_REGISTER_H2D;
+       cfis->pm_port_c = 0x80; /* is command */
+       cfis->command = ATA_CMD_FLUSH_EXT;
+
+       ahci_exec_ata_cmd(probe_ent, port, cfis, NULL, 0, 0);
+}
+
+static void dwc_ahsata_init_wcache(int dev, u16 *id)
+{
+       struct ahci_probe_ent *probe_ent =
+               (struct ahci_probe_ent *)sata_dev_desc[dev].priv;
+
+       if (ata_id_has_wcache(id) && ata_id_wcache_enabled(id))
+               probe_ent->flags |= SATA_FLAG_WCACHE;
+       if (ata_id_has_flush(id))
+               probe_ent->flags |= SATA_FLAG_FLUSH;
+       if (ata_id_has_flush_ext(id))
+               probe_ent->flags |= SATA_FLAG_FLUSH_EXT;
+}
+
+u32 ata_low_level_rw_lba48(int dev, u32 blknr, lbaint_t blkcnt,
+                               void *buffer, int is_write)
+{
+       u32 start, blks;
+       u8 *addr;
+       int max_blks;
+
+       start = blknr;
+       blks = blkcnt;
+       addr = (u8 *)buffer;
+
+       max_blks = ATA_MAX_SECTORS_LBA48;
+
+       do {
+               if (blks > max_blks) {
+                       if (max_blks != dwc_ahsata_rw_cmd_ext(dev, start,
+                                               max_blks, addr, is_write))
+                               return 0;
+                       start += max_blks;
+                       blks -= max_blks;
+                       addr += ATA_SECT_SIZE * max_blks;
+               } else {
+                       if (blks != dwc_ahsata_rw_cmd_ext(dev, start,
+                                               blks, addr, is_write))
+                               return 0;
+                       start += blks;
+                       blks = 0;
+                       addr += ATA_SECT_SIZE * blks;
+               }
+       } while (blks != 0);
+
+       return blkcnt;
+}
+
+u32 ata_low_level_rw_lba28(int dev, u32 blknr, lbaint_t blkcnt,
+                               void *buffer, int is_write)
+{
+       u32 start, blks;
+       u8 *addr;
+       int max_blks;
+
+       start = blknr;
+       blks = blkcnt;
+       addr = (u8 *)buffer;
+
+       max_blks = ATA_MAX_SECTORS;
+       do {
+               if (blks > max_blks) {
+                       if (max_blks != dwc_ahsata_rw_cmd(dev, start,
+                                               max_blks, addr, is_write))
+                               return 0;
+                       start += max_blks;
+                       blks -= max_blks;
+                       addr += ATA_SECT_SIZE * max_blks;
+               } else {
+                       if (blks != dwc_ahsata_rw_cmd(dev, start,
+                                               blks, addr, is_write))
+                               return 0;
+                       start += blks;
+                       blks = 0;
+                       addr += ATA_SECT_SIZE * blks;
+               }
+       } while (blks != 0);
+
+       return blkcnt;
+}
+
+/*
+ * SATA interface between low level driver and command layer
+ */
+ulong sata_read(int dev, unsigned long blknr, lbaint_t blkcnt, void *buffer)
+{
+       u32 rc;
+
+       if (sata_dev_desc[dev].lba48)
+               rc = ata_low_level_rw_lba48(dev, blknr, blkcnt,
+                                               buffer, READ_CMD);
+       else
+               rc = ata_low_level_rw_lba28(dev, blknr, blkcnt,
+                                               buffer, READ_CMD);
+       return rc;
+}
+
+ulong sata_write(int dev, unsigned long blknr, lbaint_t blkcnt, void *buffer)
+{
+       u32 rc;
+       struct ahci_probe_ent *probe_ent =
+               (struct ahci_probe_ent *)sata_dev_desc[dev].priv;
+       u32 flags = probe_ent->flags;
+
+       if (sata_dev_desc[dev].lba48) {
+               rc = ata_low_level_rw_lba48(dev, blknr, blkcnt,
+                                               buffer, WRITE_CMD);
+               if ((flags & SATA_FLAG_WCACHE) &&
+                       (flags & SATA_FLAG_FLUSH_EXT))
+                       dwc_ahsata_flush_cache_ext(dev);
+       } else {
+               rc = ata_low_level_rw_lba28(dev, blknr, blkcnt,
+                                               buffer, WRITE_CMD);
+               if ((flags & SATA_FLAG_WCACHE) &&
+                       (flags & SATA_FLAG_FLUSH))
+                       dwc_ahsata_flush_cache(dev);
+       }
+       return rc;
+}
+
+int scan_sata(int dev)
+{
+       u8 serial[ATA_ID_SERNO_LEN + 1] = { 0 };
+       u8 firmware[ATA_ID_FW_REV_LEN + 1] = { 0 };
+       u8 product[ATA_ID_PROD_LEN + 1] = { 0 };
+       u16 *id;
+       u64 n_sectors;
+       struct ahci_probe_ent *probe_ent =
+               (struct ahci_probe_ent *)sata_dev_desc[dev].priv;
+       u8 port = probe_ent->hard_port_no;
+       block_dev_desc_t *pdev = &(sata_dev_desc[dev]);
+
+       id = (u16 *)malloc(ATA_ID_WORDS * 2);
+       if (!id) {
+               printf("id malloc failed\n\r");
+               return -1;
+       }
+
+       /* Identify device to get information */
+       dwc_ahsata_identify(dev, id);
+
+       /* Serial number */
+       ata_id_c_string(id, serial, ATA_ID_SERNO, sizeof(serial));
+       memcpy(pdev->product, serial, sizeof(serial));
+
+       /* Firmware version */
+       ata_id_c_string(id, firmware, ATA_ID_FW_REV, sizeof(firmware));
+       memcpy(pdev->revision, firmware, sizeof(firmware));
+
+       /* Product model */
+       ata_id_c_string(id, product, ATA_ID_PROD, sizeof(product));
+       memcpy(pdev->vendor, product, sizeof(product));
+
+       /* Totoal sectors */
+       n_sectors = ata_id_n_sectors(id);
+       pdev->lba = (u32)n_sectors;
+
+       pdev->type = DEV_TYPE_HARDDISK;
+       pdev->blksz = ATA_SECT_SIZE;
+       pdev->lun = 0 ;
+
+       /* Check if support LBA48 */
+       if (ata_id_has_lba48(id)) {
+               pdev->lba48 = 1;
+               debug("Device support LBA48\n\r");
+       }
+
+       /* Get the NCQ queue depth from device */
+       probe_ent->flags &= (~SATA_FLAG_Q_DEP_MASK);
+       probe_ent->flags |= ata_id_queue_depth(id);
+
+       /* Get the xfer mode from device */
+       dwc_ahsata_xfer_mode(dev, id);
+
+       /* Get the write cache status from device */
+       dwc_ahsata_init_wcache(dev, id);
+
+       /* Set the xfer mode to highest speed */
+       ahci_set_feature(dev, port);
+
+       free((void *)id);
+
+       dwc_ahsata_print_info(dev);
+
+       is_ready = 1;
+
+       return 0;
+}
diff --git a/drivers/block/dwc_ahsata.h b/drivers/block/dwc_ahsata.h
new file mode 100644 (file)
index 0000000..84860ea
--- /dev/null
@@ -0,0 +1,335 @@
+/*
+ * Copyright (C) 2010 Freescale Semiconductor, Inc.
+ * Terry Lv <r65388@freescale.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 __FSL_SATA_H__
+#define __FSL_SATA_H__
+
+#define DWC_AHSATA_MAX_CMD_SLOTS       32
+
+/* Max host controller numbers */
+#define SATA_HC_MAX_NUM                4
+/* Max command queue depth per host controller */
+#define DWC_AHSATA_HC_MAX_CMD  32
+/* Max port number per host controller */
+#define SATA_HC_MAX_PORT       16
+
+/* Generic Host Register */
+
+/* HBA Capabilities Register */
+#define SATA_HOST_CAP_S64A             0x80000000
+#define SATA_HOST_CAP_SNCQ             0x40000000
+#define SATA_HOST_CAP_SSNTF            0x20000000
+#define SATA_HOST_CAP_SMPS             0x10000000
+#define SATA_HOST_CAP_SSS              0x08000000
+#define SATA_HOST_CAP_SALP             0x04000000
+#define SATA_HOST_CAP_SAL              0x02000000
+#define SATA_HOST_CAP_SCLO             0x01000000
+#define SATA_HOST_CAP_ISS_MASK         0x00f00000
+#define SATA_HOST_CAP_ISS_OFFSET       20
+#define SATA_HOST_CAP_SNZO             0x00080000
+#define SATA_HOST_CAP_SAM              0x00040000
+#define SATA_HOST_CAP_SPM              0x00020000
+#define SATA_HOST_CAP_PMD              0x00008000
+#define SATA_HOST_CAP_SSC              0x00004000
+#define SATA_HOST_CAP_PSC              0x00002000
+#define SATA_HOST_CAP_NCS              0x00001f00
+#define SATA_HOST_CAP_CCCS             0x00000080
+#define SATA_HOST_CAP_EMS              0x00000040
+#define SATA_HOST_CAP_SXS              0x00000020
+#define SATA_HOST_CAP_NP_MASK          0x0000001f
+
+/* Global HBA Control Register */
+#define SATA_HOST_GHC_AE       0x80000000
+#define SATA_HOST_GHC_IE       0x00000002
+#define SATA_HOST_GHC_HR       0x00000001
+
+/* Interrupt Status Register */
+
+/* Ports Implemented Register */
+
+/* AHCI Version Register */
+#define SATA_HOST_VS_MJR_MASK  0xffff0000
+#define SATA_HOST_VS_MJR_OFFSET        16
+#define SATA_HOST_VS_MJR_MNR   0x0000ffff
+
+/* Command Completion Coalescing Control */
+#define SATA_HOST_CCC_CTL_TV_MASK      0xffff0000
+#define SATA_HOST_CCC_CTL_TV_OFFSET            16
+#define SATA_HOST_CCC_CTL_CC_MASK      0x0000ff00
+#define SATA_HOST_CCC_CTL_CC_OFFSET            8
+#define SATA_HOST_CCC_CTL_INT_MASK     0x000000f8
+#define SATA_HOST_CCC_CTL_INT_OFFSET   3
+#define SATA_HOST_CCC_CTL_EN   0x00000001
+
+/* Command Completion Coalescing Ports */
+
+/* HBA Capabilities Extended Register */
+#define SATA_HOST_CAP2_APST            0x00000004
+
+/* BIST Activate FIS Register */
+#define SATA_HOST_BISTAFR_NCP_MASK     0x0000ff00
+#define SATA_HOST_BISTAFR_NCP_OFFSET   8
+#define SATA_HOST_BISTAFR_PD_MASK      0x000000ff
+#define SATA_HOST_BISTAFR_PD_OFFSET            0
+
+/* BIST Control Register */
+#define SATA_HOST_BISTCR_FERLB 0x00100000
+#define SATA_HOST_BISTCR_TXO   0x00040000
+#define SATA_HOST_BISTCR_CNTCLR        0x00020000
+#define SATA_HOST_BISTCR_NEALB 0x00010000
+#define SATA_HOST_BISTCR_LLC_MASK      0x00000700
+#define SATA_HOST_BISTCR_LLC_OFFSET    8
+#define SATA_HOST_BISTCR_ERREN 0x00000040
+#define SATA_HOST_BISTCR_FLIP  0x00000020
+#define SATA_HOST_BISTCR_PV            0x00000010
+#define SATA_HOST_BISTCR_PATTERN_MASK  0x0000000f
+#define SATA_HOST_BISTCR_PATTERN_OFFSET        0
+
+/* BIST FIS Count Register */
+
+/* BIST Status Register */
+#define SATA_HOST_BISTSR_FRAMERR_MASK  0x0000ffff
+#define SATA_HOST_BISTSR_FRAMERR_OFFSET        0
+#define SATA_HOST_BISTSR_BRSTERR_MASK  0x00ff0000
+#define SATA_HOST_BISTSR_BRSTERR_OFFSET        16
+
+/* BIST DWORD Error Count Register */
+
+/* OOB Register*/
+#define SATA_HOST_OOBR_WE              0x80000000
+#define SATA_HOST_OOBR_cwMin_MASK      0x7f000000
+#define SATA_HOST_OOBR_cwMAX_MASK      0x00ff0000
+#define SATA_HOST_OOBR_ciMin_MASK      0x0000ff00
+#define SATA_HOST_OOBR_ciMax_MASK      0x000000ff
+
+/* Timer 1-ms Register */
+
+/* Global Parameter 1 Register */
+#define SATA_HOST_GPARAM1R_ALIGN_M     0x80000000
+#define SATA_HOST_GPARAM1R_RX_BUFFER   0x40000000
+#define SATA_HOST_GPARAM1R_PHY_DATA_MASK       0x30000000
+#define SATA_HOST_GPARAM1R_PHY_RST     0x08000000
+#define SATA_HOST_GPARAM1R_PHY_CTRL_MASK       0x07e00000
+#define SATA_HOST_GPARAM1R_PHY_STAT_MASK       0x001f8000
+#define SATA_HOST_GPARAM1R_LATCH_M     0x00004000
+#define SATA_HOST_GPARAM1R_BIST_M      0x00002000
+#define SATA_HOST_GPARAM1R_PHY_TYPE    0x00001000
+#define SATA_HOST_GPARAM1R_RETURN_ERR  0x00000400
+#define SATA_HOST_GPARAM1R_AHB_ENDIAN_MASK     0x00000300
+#define SATA_HOST_GPARAM1R_S_HADDR     0X00000080
+#define SATA_HOST_GPARAM1R_M_HADDR     0X00000040
+
+/* Global Parameter 2 Register */
+#define SATA_HOST_GPARAM2R_DEV_CP      0x00004000
+#define SATA_HOST_GPARAM2R_DEV_MP      0x00002000
+#define SATA_HOST_GPARAM2R_DEV_ENCODE_M        0x00001000
+#define SATA_HOST_GPARAM2R_RXOOB_CLK_M 0x00000800
+#define SATA_HOST_GPARAM2R_RXOOB_M     0x00000400
+#define SATA_HOST_GPARAM2R_TX_OOB_M    0x00000200
+#define SATA_HOST_GPARAM2R_RXOOB_CLK_MASK      0x000001ff
+
+/* Port Parameter Register */
+#define SATA_HOST_PPARAMR_TX_MEM_M     0x00000200
+#define SATA_HOST_PPARAMR_TX_MEM_S     0x00000100
+#define SATA_HOST_PPARAMR_RX_MEM_M     0x00000080
+#define SATA_HOST_PPARAMR_RX_MEM_S     0x00000040
+#define SATA_HOST_PPARAMR_TXFIFO_DEPTH_MASK    0x00000038
+#define SATA_HOST_PPARAMR_RXFIFO_DEPTH_MASK    0x00000007
+
+/* Test Register */
+#define SATA_HOST_TESTR_PSEL_MASK      0x00070000
+#define SATA_HOST_TESTR_TEST_IF                0x00000001
+
+/* Port Register Descriptions */
+/* Port# Command List Base Address Register */
+#define SATA_PORT_CLB_CLB_MASK         0xfffffc00
+
+/* Port# Command List Base Address Upper 32-Bits Register */
+
+/* Port# FIS Base Address Register */
+#define SATA_PORT_FB_FB_MASK           0xfffffff0
+
+/* Port# FIS Base Address Upper 32-Bits Register */
+
+/* Port# Interrupt Status Register */
+#define SATA_PORT_IS_CPDS              0x80000000
+#define SATA_PORT_IS_TFES              0x40000000
+#define SATA_PORT_IS_HBFS              0x20000000
+#define SATA_PORT_IS_HBDS              0x10000000
+#define SATA_PORT_IS_IFS               0x08000000
+#define SATA_PORT_IS_INFS              0x04000000
+#define SATA_PORT_IS_OFS               0x01000000
+#define SATA_PORT_IS_IPMS              0x00800000
+#define SATA_PORT_IS_PRCS              0x00400000
+#define SATA_PORT_IS_DMPS              0x00000080
+#define SATA_PORT_IS_PCS               0x00000040
+#define SATA_PORT_IS_DPS               0x00000020
+#define SATA_PORT_IS_UFS               0x00000010
+#define SATA_PORT_IS_SDBS              0x00000008
+#define SATA_PORT_IS_DSS               0x00000004
+#define SATA_PORT_IS_PSS               0x00000002
+#define SATA_PORT_IS_DHRS              0x00000001
+
+/* Port# Interrupt Enable Register */
+#define SATA_PORT_IE_CPDE              0x80000000
+#define SATA_PORT_IE_TFEE              0x40000000
+#define SATA_PORT_IE_HBFE              0x20000000
+#define SATA_PORT_IE_HBDE              0x10000000
+#define SATA_PORT_IE_IFE               0x08000000
+#define SATA_PORT_IE_INFE              0x04000000
+#define SATA_PORT_IE_OFE               0x01000000
+#define SATA_PORT_IE_IPME              0x00800000
+#define SATA_PORT_IE_PRCE              0x00400000
+#define SATA_PORT_IE_DMPE              0x00000080
+#define SATA_PORT_IE_PCE               0x00000040
+#define SATA_PORT_IE_DPE               0x00000020
+#define SATA_PORT_IE_UFE               0x00000010
+#define SATA_PORT_IE_SDBE              0x00000008
+#define SATA_PORT_IE_DSE               0x00000004
+#define SATA_PORT_IE_PSE               0x00000002
+#define SATA_PORT_IE_DHRE              0x00000001
+
+/* Port# Command Register */
+#define SATA_PORT_CMD_ICC_MASK         0xf0000000
+#define SATA_PORT_CMD_ASP              0x08000000
+#define SATA_PORT_CMD_ALPE             0x04000000
+#define SATA_PORT_CMD_DLAE             0x02000000
+#define SATA_PORT_CMD_ATAPI            0x01000000
+#define SATA_PORT_CMD_APSTE            0x00800000
+#define SATA_PORT_CMD_ESP              0x00200000
+#define SATA_PORT_CMD_CPD              0x00100000
+#define SATA_PORT_CMD_MPSP             0x00080000
+#define SATA_PORT_CMD_HPCP             0x00040000
+#define SATA_PORT_CMD_PMA              0x00020000
+#define SATA_PORT_CMD_CPS              0x00010000
+#define SATA_PORT_CMD_CR               0x00008000
+#define SATA_PORT_CMD_FR               0x00004000
+#define SATA_PORT_CMD_MPSS             0x00002000
+#define SATA_PORT_CMD_CCS_MASK         0x00001f00
+#define SATA_PORT_CMD_FRE              0x00000010
+#define SATA_PORT_CMD_CLO              0x00000008
+#define SATA_PORT_CMD_POD              0x00000004
+#define SATA_PORT_CMD_SUD              0x00000002
+#define SATA_PORT_CMD_ST               0x00000001
+
+/* Port# Task File Data Register */
+#define SATA_PORT_TFD_ERR_MASK         0x0000ff00
+#define SATA_PORT_TFD_STS_MASK         0x000000ff
+#define SATA_PORT_TFD_STS_ERR          0x00000001
+#define SATA_PORT_TFD_STS_DRQ          0x00000008
+#define SATA_PORT_TFD_STS_BSY          0x00000080
+
+/* Port# Signature Register */
+
+/* Port# Serial ATA Status {SStatus} Register */
+#define SATA_PORT_SSTS_IPM_MASK                0x00000f00
+#define SATA_PORT_SSTS_SPD_MASK                0x000000f0
+#define SATA_PORT_SSTS_DET_MASK                0x0000000f
+
+/* Port# Serial ATA Control {SControl} Register */
+#define SATA_PORT_SCTL_IPM_MASK                0x00000f00
+#define SATA_PORT_SCTL_SPD_MASK                0x000000f0
+#define SATA_PORT_SCTL_DET_MASK                0x0000000f
+
+/* Port# Serial ATA Error {SError} Register */
+#define SATA_PORT_SERR_DIAG_X          0x04000000
+#define SATA_PORT_SERR_DIAG_F          0x02000000
+#define SATA_PORT_SERR_DIAG_T          0x01000000
+#define SATA_PORT_SERR_DIAG_S          0x00800000
+#define SATA_PORT_SERR_DIAG_H          0x00400000
+#define SATA_PORT_SERR_DIAG_C          0x00200000
+#define SATA_PORT_SERR_DIAG_D          0x00100000
+#define SATA_PORT_SERR_DIAG_B          0x00080000
+#define SATA_PORT_SERR_DIAG_W          0x00040000
+#define SATA_PORT_SERR_DIAG_I          0x00020000
+#define SATA_PORT_SERR_DIAG_N          0x00010000
+#define SATA_PORT_SERR_ERR_E           0x00000800
+#define SATA_PORT_SERR_ERR_P           0x00000400
+#define SATA_PORT_SERR_ERR_C           0x00000200
+#define SATA_PORT_SERR_ERR_T           0x00000100
+#define SATA_PORT_SERR_ERR_M           0x00000002
+#define SATA_PORT_SERR_ERR_I           0x00000001
+
+/* Port# Serial ATA Active {SActive} Register */
+
+/* Port# Command Issue Register */
+
+/* Port# Serial ATA Notification Register */
+
+/* Port# DMA Control Register */
+#define SATA_PORT_DMACR_RXABL_MASK     0x0000f000
+#define SATA_PORT_DMACR_TXABL_MASK     0x00000f00
+#define SATA_PORT_DMACR_RXTS_MASK      0x000000f0
+#define SATA_PORT_DMACR_TXTS_MASK      0x0000000f
+
+/* Port# PHY Control Register */
+
+/* Port# PHY Status Register */
+
+#define SATA_HC_CMD_HDR_ENTRY_SIZE     sizeof(struct cmd_hdr_entry)
+
+/* DW0
+*/
+#define CMD_HDR_DI_CFL_MASK    0x0000001f
+#define CMD_HDR_DI_CFL_OFFSET  0
+#define CMD_HDR_DI_A                   0x00000020
+#define CMD_HDR_DI_W                   0x00000040
+#define CMD_HDR_DI_P                   0x00000080
+#define CMD_HDR_DI_R                   0x00000100
+#define CMD_HDR_DI_B                   0x00000200
+#define CMD_HDR_DI_C                   0x00000400
+#define CMD_HDR_DI_PMP_MASK    0x0000f000
+#define CMD_HDR_DI_PMP_OFFSET  12
+#define CMD_HDR_DI_PRDTL               0xffff0000
+#define CMD_HDR_DI_PRDTL_OFFSET        16
+
+/* prde_fis_len
+*/
+#define CMD_HDR_PRD_ENTRY_SHIFT        16
+#define CMD_HDR_PRD_ENTRY_MASK 0x003f0000
+#define CMD_HDR_FIS_LEN_SHIFT  2
+
+/* attribute
+*/
+#define CMD_HDR_ATTR_RES       0x00000800 /* Reserved bit, should be 1 */
+#define CMD_HDR_ATTR_VBIST     0x00000400 /* Vendor BIST */
+/* Snoop enable for all descriptor */
+#define CMD_HDR_ATTR_SNOOP     0x00000200
+#define CMD_HDR_ATTR_FPDMA     0x00000100 /* FPDMA queued command */
+#define CMD_HDR_ATTR_RESET     0x00000080 /* Reset - a SRST or device reset */
+/* BIST - require the host to enter BIST mode */
+#define CMD_HDR_ATTR_BIST      0x00000040
+#define CMD_HDR_ATTR_ATAPI     0x00000020 /* ATAPI command */
+#define CMD_HDR_ATTR_TAG       0x0000001f /* TAG mask */
+
+#define FLAGS_DMA      0x00000000
+#define FLAGS_FPDMA    0x00000001
+
+#define SATA_FLAG_Q_DEP_MASK   0x0000000f
+#define SATA_FLAG_WCACHE       0x00000100
+#define SATA_FLAG_FLUSH                0x00000200
+#define SATA_FLAG_FLUSH_EXT    0x00000400
+
+#define READ_CMD       0
+#define WRITE_CMD      1
+
+extern block_dev_desc_t sata_dev_desc[CONFIG_SYS_SATA_MAX_DEVICE];
+
+#endif /* __FSL_SATA_H__ */
diff --git a/drivers/block/mxc_ata.h b/drivers/block/mxc_ata.h
new file mode 100644 (file)
index 0000000..5d198f1
--- /dev/null
@@ -0,0 +1,90 @@
+#ifndef _MXC_ATA_H_
+#define _MXC_ATA_H_
+
+/*
+ * (C) Copyright 2008-2009 Freescale Semiconductor, Inc.
+ *
+ * See file CREDITS for        list of people who contributed to this
+ * project.
+ *
+ * This        program is free software; you can redistribute it and/or
+ * modify it under the terms of        the GNU General Public License as
+ * published by        the Free Software Foundation; either version 2 of
+ * the License,        or (at your option) any later version.
+ *
+ * This        program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59        Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+#define MXC_ATA_TIMING_REGS                             0x00
+#define MXC_ATA_FIFO_FILL                                   0x20
+#define MXC_ATA_CONTROL                                     0x24
+#define MXC_ATA_INT_PEND                                   0x28
+#define MXC_ATA_INT_EN                                       0x2C
+#define MXC_ATA_INT_CLEAR                                 0x30
+#define MXC_ATA_FIFO_ALARM                              0x34
+#define MXC_ATA_ADMA_ERROR_STATUS               0x38
+#define MXC_ATA_SYS_DMA_BADDR                       0x3C
+#define MXC_ATA_ADMA_SYS_ADDR                       0x40
+#define MXC_ATA_BLOCK_COUNT                            0x48
+#define MXC_ATA_BURST_LENGTH                          0x4C
+#define MXC_ATA_SECTOR_SIZE                             0x50
+#define MXC_ATA_DRIVE_DATA                              0xA0
+#define MXC_ATA_DFTR                                          0xA4
+#define MXC_ATA_DSCR                                          0xA8
+#define MXC_ATA_DSNR                                          0xAC
+#define MXC_ATA_DCLR                                           0xB0
+#define MXC_ATA_DCHR                                          0xB4
+#define MXC_ATA_DDHR                                          0xB8
+#define MXC_ATA_DCDR                                          0xBC
+#define MXC_ATA_DRIVE_CONTROL                         0xD8
+
+/* bits within MXC_ATA_CONTROL */
+#define MXC_ATA_CTRL_DMA_SRST                         0x1000
+#define MXC_ATA_CTRL_DMA_64ADMA                    0x800
+#define MXC_ATA_CTRL_DMA_32ADMA                    0x400
+#define MXC_ATA_CTRL_DMA_STAT_STOP               0x200
+#define MXC_ATA_CTRL_DMA_ENABLE                     0x100
+#define MXC_ATA_CTRL_FIFO_RST_B                       0x80
+#define MXC_ATA_CTRL_ATA_RST_B                        0x40
+#define MXC_ATA_CTRL_FIFO_TX_EN                      0x20
+#define MXC_ATA_CTRL_FIFO_RCV_EN                    0x10
+#define MXC_ATA_CTRL_DMA_PENDING                   0x08
+#define MXC_ATA_CTRL_DMA_ULTRA                       0x04
+#define MXC_ATA_CTRL_DMA_WRITE                       0x02
+#define MXC_ATA_CTRL_IORDY_EN                          0x01
+
+/* bits within the interrupt control registers */
+#define MXC_ATA_INTR_ATA_INTRQ1                      0x80
+#define MXC_ATA_INTR_FIFO_UNDERFLOW             0x40
+#define MXC_ATA_INTR_FIFO_OVERFLOW               0x20
+#define MXC_ATA_INTR_CTRL_IDLE                         0x10
+#define MXC_ATA_INTR_ATA_INTRQ2                      0x08
+#define MXC_ATA_INTR_DMA_ERR                           0x04
+#define MXC_ATA_INTR_DMA_TRANS_OVER            0x02
+
+/* ADMA Addr Descriptor Attribute Filed */
+#define MXC_ADMA_DES_ATTR_VALID                     0x01
+#define MXC_ADMA_DES_ATTR_END                        0x02
+#define MXC_ADMA_DES_ATTR_INT                         0x04
+#define MXC_ADMA_DES_ATTR_SET                         0x10
+#define MXC_ADMA_DES_ATTR_TRAN                      0x20
+#define MXC_ADMA_DES_ATTR_LINK                       0x30
+
+#define PIO_XFER_MODE_0                                     0
+#define PIO_XFER_MODE_1                                     1
+#define PIO_XFER_MODE_2                                     2
+#define PIO_XFER_MODE_3                                     3
+#define PIO_XFER_MODE_4                                     4
+
+#define ATA_SECTOR_SIZE                                     512
+#define MAX_SECTORS                       256
+
+#endif /* _IMX_ATA_H_ */
index fb3b09ae74cf213e7e5394f90459beae4e7bcfae..155402cdd8b07133158a4ed75990fe8575c43020 100644 (file)
@@ -25,6 +25,9 @@ include $(TOPDIR)/config.mk
 
 LIB    := $(obj)libgpio.o
 
+COBJS-y                                += gpiolib.o
+
+COBJS-$(CONFIG_AM33XX_GPIO)    += am33xx_gpio.o
 COBJS-$(CONFIG_AT91_GPIO)      += at91_gpio.o
 COBJS-$(CONFIG_KIRKWOOD_GPIO)  += kw_gpio.o
 COBJS-$(CONFIG_MARVELL_GPIO)   += mvgpio.o
diff --git a/drivers/gpio/am33xx_gpio.c b/drivers/gpio/am33xx_gpio.c
new file mode 100644 (file)
index 0000000..71cd50e
--- /dev/null
@@ -0,0 +1,106 @@
+/*
+ * Copyright (C) 2012 Lothar Waßmann <LW@KARO-electronics.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
+ * version 2 as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ */
+
+#include <common.h>
+#include <errno.h>
+#include <asm-generic/gpio.h>
+#include <asm/io.h>
+#include <asm/bitops.h>
+#include <asm/sizes.h>
+#include <asm/arch/hardware.h>
+
+struct gpio_regs {
+       unsigned int res1[0x134 / 4];
+       unsigned int oe;                /* 0x134 */
+       unsigned int datain;            /* 0x138 */
+       unsigned int res2[0x54 / 4];
+       unsigned int cleardataout;      /* 0x190 */
+       unsigned int setdataout;        /* 0x194 */
+};
+
+struct gpio_regs *gpio_base[] = {
+       (struct gpio_regs *)GPIO0_BASE,
+       (struct gpio_regs *)GPIO1_BASE,
+       (struct gpio_regs *)GPIO2_BASE,
+       (struct gpio_regs *)GPIO3_BASE,
+};
+
+static unsigned long gpio_map[ARRAY_SIZE(gpio_base)];
+
+#define MAX_GPIO       (ARRAY_SIZE(gpio_base) * 32)
+
+int gpio_request(unsigned gpio, const char *name)
+{
+       if (gpio >= MAX_GPIO)
+               return -EINVAL;
+       if (test_and_set_bit(gpio, gpio_map))
+               return -EBUSY;
+       return 0;
+}
+
+int gpio_free(unsigned gpio)
+{
+       if (gpio >= MAX_GPIO)
+               return -EINVAL;
+
+       if (test_bit(gpio, gpio_map))
+               __clear_bit(gpio, gpio_map);
+       else
+               printf("ERROR: trying to free unclaimed GPIO %u\n", gpio);
+
+       return 0;
+}
+
+int gpio_set_value(unsigned gpio, int val)
+{
+       int bank = gpio / 32;
+       int mask = 1 << (gpio % 32);
+
+       if (bank >= ARRAY_SIZE(gpio_base))
+               return -EINVAL;
+
+       if (val)
+               writel(mask, &gpio_base[bank]->setdataout);
+       else
+               writel(mask, &gpio_base[bank]->cleardataout);
+       return 0;
+}
+
+int gpio_direction_input(unsigned gpio)
+{
+       int bank = gpio / 32;
+       int mask = 1 << (gpio % 32);
+
+       if (bank >= ARRAY_SIZE(gpio_base))
+               return -EINVAL;
+
+       writel(readl(&gpio_base[bank]->oe) | mask, &gpio_base[bank]->oe);
+       return 0;
+}
+
+int gpio_direction_output(unsigned gpio, int val)
+{
+       int bank = gpio / 32;
+       int mask = 1 << (gpio % 32);
+
+       if (bank >= ARRAY_SIZE(gpio_base))
+               return -EINVAL;
+
+       gpio_set_value(gpio, val);
+       writel(readl(&gpio_base[bank]->oe) & ~mask, &gpio_base[bank]->oe);
+       return 0;
+}
diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
new file mode 100644 (file)
index 0000000..ef314ee
--- /dev/null
@@ -0,0 +1,55 @@
+#include <common.h>
+#include <asm-generic/gpio.h>
+
+int gpio_request_one(unsigned int gpio, enum gpio_flags flags,
+               const char *label)
+{
+       int ret;
+
+       ret = gpio_request(gpio, label);
+       if (ret)
+               return ret;
+
+       if (flags == GPIOF_INPUT)
+               gpio_direction_input(gpio);
+       else if (flags == GPIOF_OUTPUT_INIT_LOW)
+               gpio_direction_output(gpio, 0);
+       else if (flags == GPIOF_OUTPUT_INIT_HIGH)
+               gpio_direction_output(gpio, 1);
+
+       return ret;
+}
+
+int gpio_request_array(const struct gpio *gpios, int count)
+{
+       int ret;
+       int i;
+
+       for (i = 0; i < count; i++) {
+               ret = gpio_request_one(gpios[i].gpio, gpios[i].flags,
+                               gpios[i].label);
+               if (ret) {
+                       printf("Failed to request GPIO%d (%u of %u): %d\n",
+                               gpios[i].gpio, i, count, ret);
+                       goto error;
+               }
+       }
+       return 0;
+
+error:
+       while (--i >= 0)
+               gpio_free(gpios[i].gpio);
+
+       return ret;
+}
+
+int gpio_free_array(const struct gpio *gpios, int count)
+{
+       int ret = 0;
+       int i;
+
+       for (i = 0; i < count; i++)
+               ret |= gpio_free(gpios[i].gpio);
+
+       return ret;
+}
index f1b1c16b1b9356409f57b2295742cb91d8f24022..8a92fec6fc47319d253832a1d2dd9417489d8a9d 100644 (file)
@@ -34,14 +34,15 @@ enum mxc_gpio_direction {
        MXC_GPIO_DIRECTION_OUT,
 };
 
-#define GPIO_TO_PORT(n)                (n / 32)
+#define GPIO_TO_PORT(n)                ((n) / 32)
 
 /* GPIO port description */
 static unsigned long gpio_ports[] = {
        [0] = GPIO1_BASE_ADDR,
        [1] = GPIO2_BASE_ADDR,
        [2] = GPIO3_BASE_ADDR,
-#if defined(CONFIG_MX51) || defined(CONFIG_MX53) || defined(CONFIG_MX6Q)
+#if defined(CONFIG_MX25) || defined(CONFIG_MX51) || defined(CONFIG_MX53) || \
+               defined(CONFIG_MX6Q)
        [3] = GPIO4_BASE_ADDR,
 #endif
 #if defined(CONFIG_MX53) || defined(CONFIG_MX6Q)
@@ -140,10 +141,10 @@ int gpio_direction_input(unsigned gpio)
 
 int gpio_direction_output(unsigned gpio, int value)
 {
-       int ret = mxc_gpio_direction(gpio, MXC_GPIO_DIRECTION_OUT);
+       int ret = gpio_set_value(gpio, value);
 
        if (ret < 0)
                return ret;
 
-       return gpio_set_value(gpio, value);
+       return mxc_gpio_direction(gpio, MXC_GPIO_DIRECTION_OUT);
 }
index 21f689726920b131397615e791a873caaf84334a..5b6ea0e7599a28107413f045ade27475287f7dfb 100644 (file)
@@ -567,3 +567,17 @@ int i2c_set_bus_num(unsigned int bus)
        return 0;
 }
 #endif
+
+int tegra_i2c_get_dvc_bus_num(void)
+{
+       int i;
+
+       for (i = 0; i < CONFIG_SYS_MAX_I2C_BUS; i++) {
+               struct i2c_bus *bus = &i2c_controllers[i];
+
+               if (bus->inited && bus->is_dvc)
+                       return i;
+       }
+
+       return -1;
+}
index 1f4dad35b53dcd26892e5586d62781dc17fb0541..5c831b26116b72af3510490bc03b1441574bffa4 100644 (file)
@@ -26,10 +26,13 @@ include $(TOPDIR)/config.mk
 LIB    := $(obj)libinput.o
 
 COBJS-$(CONFIG_I8042_KBD) += i8042.o
+COBJS-$(CONFIG_TEGRA2_KEYBOARD) += tegra-kbc.o
 ifdef CONFIG_PS2KBD
 COBJS-y += keyboard.o pc_keyb.o
 COBJS-$(CONFIG_PS2MULT) += ps2mult.o ps2ser.o
 endif
+COBJS-y += input.o
+COBJS-$(CONFIG_OF_CONTROL) += key_matrix.o
 
 COBJS  := $(COBJS-y)
 SRCS   := $(COBJS:.o=.c)
diff --git a/drivers/input/input.c b/drivers/input/input.c
new file mode 100644 (file)
index 0000000..4eadd77
--- /dev/null
@@ -0,0 +1,430 @@
+/*
+ * Translate key codes into ASCII
+ *
+ * Copyright (c) 2011 The Chromium OS Authors.
+ * (C) Copyright 2004 DENX Software Engineering, Wolfgang Denk, wd@denx.de
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+#include <common.h>
+#include <stdio_dev.h>
+#include <input.h>
+#include <linux/input.h>
+
+enum {
+       /* These correspond to the lights on the keyboard */
+       FLAG_NUM_LOCK           = 1 << 0,
+       FLAG_CAPS_LOCK          = 1 << 1,
+       FLAG_SCROLL_LOCK        = 1 << 2,
+
+       /* Special flag ORed with key code to indicate release */
+       KEY_RELEASE             = 1 << 15,
+       KEY_MASK                = 0xfff,
+};
+
+/*
+ * These takes map key codes to ASCII. 0xff means no key, or special key.
+ * Three tables are provided - one for plain keys, one for when the shift
+ * 'modifier' key is pressed and one for when the ctrl modifier key is
+ * pressed.
+ */
+static const uchar kbd_plain_xlate[] = {
+       0xff, 0x1b, '1',  '2',  '3',  '4',  '5',  '6',
+       '7',  '8',  '9',  '0',  '-',  '=', '\b', '\t',  /* 0x00 - 0x0f */
+       'q',  'w',  'e',  'r',  't',  'y',  'u',  'i',
+       'o',  'p',  '[',  ']', '\r', 0xff,  'a',  's',  /* 0x10 - 0x1f */
+       'd',  'f',  'g',  'h',  'j',  'k',  'l',  ';',
+       '\'',  '`', 0xff, '\\', 'z',  'x',  'c',  'v',  /* 0x20 - 0x2f */
+       'b',  'n',  'm',  ',' ,  '.', '/', 0xff, 0xff, 0xff,
+       ' ', 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,        /* 0x30 - 0x3f */
+       0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,  '7',
+       '8',  '9',  '-',  '4',  '5',  '6',  '+',  '1',  /* 0x40 - 0x4f */
+       '2',  '3',  '0',  '.', 0xff, 0xff, 0xff, 0xff,
+       0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* 0x50 - 0x5F */
+       '\r', 0xff, 0xff
+};
+
+static unsigned char kbd_shift_xlate[] = {
+       0xff, 0x1b, '!', '@', '#', '$', '%', '^',
+       '&', '*', '(', ')', '_', '+', '\b', '\t',       /* 0x00 - 0x0f */
+       'Q', 'W', 'E', 'R', 'T', 'Y', 'U', 'I',
+       'O', 'P', '{', '}', '\r', 0xff, 'A', 'S',       /* 0x10 - 0x1f */
+       'D', 'F', 'G', 'H', 'J', 'K', 'L', ':',
+       '"', '~', 0xff, '|', 'Z', 'X', 'C', 'V',        /* 0x20 - 0x2f */
+       'B', 'N', 'M', '<', '>', '?', 0xff, 0xff, 0xff,
+       ' ', 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,        /* 0x30 - 0x3f */
+       0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, '7',
+       '8', '9', '-', '4', '5', '6', '+', '1', /* 0x40 - 0x4f */
+       '2', '3', '0', '.', 0xff, 0xff, 0xff, 0xff, 0xff,
+       0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,       /* 0x50 - 0x5F */
+       '\r', 0xff, 0xff
+};
+
+static unsigned char kbd_ctrl_xlate[] = {
+       0xff, 0x1b, '1', 0x00, '3', '4', '5', 0x1E,
+       '7', '8', '9', '0', 0x1F, '=', '\b', '\t',      /* 0x00 - 0x0f */
+       0x11, 0x17, 0x05, 0x12, 0x14, 0x18, 0x15, 0x09,
+       0x0f, 0x10, 0x1b, 0x1d, '\n', 0xff, 0x01, 0x13, /* 0x10 - 0x1f */
+       0x04, 0x06, 0x08, 0x09, 0x0a, 0x0b, 0x0c, ';',
+       '\'', '~', 0x00, 0x1c, 0x1a, 0x18, 0x03, 0x16,  /* 0x20 - 0x2f */
+       0x02, 0x0e, 0x0d, '<', '>', '?', 0xff, 0xff,
+       0xff, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* 0x30 - 0x3f */
+       0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, '7',
+       '8', '9', '-', '4', '5', '6', '+', '1',         /* 0x40 - 0x4f */
+       '2', '3', '0', '.', 0xff, 0xff, 0xff, 0xff,
+       0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* 0x50 - 0x5F */
+       '\r', 0xff, 0xff
+};
+
+
+int input_queue_ascii(struct input_config *config, int ch)
+{
+       if (config->fifo_in + 1 == INPUT_BUFFER_LEN) {
+               if (!config->fifo_out)
+                       return -1; /* buffer full */
+               else
+                       config->fifo_in = 0;
+       } else {
+               if (config->fifo_in + 1 == config->fifo_out)
+                       return -1; /* buffer full */
+               config->fifo_in++;
+       }
+       config->fifo[config->fifo_in] = (uchar)ch;
+
+       return 0;
+}
+
+int input_tstc(struct input_config *config)
+{
+       if (config->fifo_in == config->fifo_out && config->read_keys) {
+               if (!(*config->read_keys)(config))
+                       return 0;
+       }
+       return config->fifo_in != config->fifo_out;
+}
+
+int input_getc(struct input_config *config)
+{
+       int err = 0;
+
+       while (config->fifo_in == config->fifo_out) {
+               if (config->read_keys)
+                       err = (*config->read_keys)(config);
+               if (err)
+                       return -1;
+       }
+
+       if (++config->fifo_out == INPUT_BUFFER_LEN)
+               config->fifo_out = 0;
+
+       return config->fifo[config->fifo_out];
+}
+
+/**
+ * Process a modifier/special key press or release and decide which key
+ * translation array should be used as a result.
+ *
+ * TODO: Should keep track of modifier press/release
+ *
+ * @param config       Input state
+ * @param key          Key code to process
+ * @param release      0 if a press, 1 if a release
+ * @return pointer to keycode->ascii translation table that should be used
+ */
+static struct input_key_xlate *process_modifier(struct input_config *config,
+                                               int key, int release)
+{
+       struct input_key_xlate *table;
+       int flip = -1;
+       int i;
+
+       /* Start with the main table, and see what modifiers change it */
+       assert(config->num_tables > 0);
+       table = &config->table[0];
+       for (i = 1; i < config->num_tables; i++) {
+               struct input_key_xlate *tab = &config->table[i];
+
+               if (key == tab->left_keycode || key == tab->right_keycode)
+                       table = tab;
+       }
+
+       /* Handle the lighted keys */
+       if (!release) {
+               switch (key) {
+               case KEY_SCROLLLOCK:
+                       flip = FLAG_SCROLL_LOCK;
+                       break;
+               case KEY_NUMLOCK:
+                       flip = FLAG_NUM_LOCK;
+                       break;
+               case KEY_CAPSLOCK:
+                       flip = FLAG_CAPS_LOCK;
+                       break;
+               }
+       }
+
+       if (flip != -1) {
+               int leds = 0;
+
+               config->leds ^= flip;
+               if (config->flags & FLAG_NUM_LOCK)
+                       leds |= INPUT_LED_NUM;
+               if (config->flags & FLAG_CAPS_LOCK)
+                       leds |= INPUT_LED_CAPS;
+               if (config->flags & FLAG_SCROLL_LOCK)
+                       leds |= INPUT_LED_SCROLL;
+               config->leds = leds;
+       }
+
+       return table;
+}
+
+/**
+ * Search an int array for a key value
+ *
+ * @param array        Array to search
+ * @param count        Number of elements in array
+ * @param key  Key value to find
+ * @return element where value was first found, -1 if none
+ */
+static int array_search(int *array, int count, int key)
+{
+       int i;
+
+       for (i = 0; i < count; i++) {
+               if (array[i] == key)
+                       return i;
+       }
+
+       return -1;
+}
+
+/**
+ * Sort an array so that those elements that exist in the ordering are
+ * first in the array, and in the same order as the ordering. The algorithm
+ * is O(count * ocount) and designed for small arrays.
+ *
+ * TODO: Move this to common / lib?
+ *
+ * @param dest         Array with elements to sort, also destination array
+ * @param count                Number of elements to sort
+ * @param order                Array containing ordering elements
+ * @param ocount       Number of ordering elements
+ * @return number of elements in dest that are in order (these will be at the
+ *     start of dest).
+ */
+static int sort_array_by_ordering(int *dest, int count, int *order,
+                                  int ocount)
+{
+       int temp[count];
+       int dest_count;
+       int same;       /* number of elements which are the same */
+       int i;
+
+       /* setup output items, copy items to be sorted into our temp area */
+       memcpy(temp, dest, count * sizeof(*dest));
+       dest_count = 0;
+
+       /* work through the ordering, move over the elements we agree on */
+       for (i = 0; i < ocount; i++) {
+               if (array_search(temp, count, order[i]) != -1)
+                       dest[dest_count++] = order[i];
+       }
+       same = dest_count;
+
+       /* now move over the elements that are not in the ordering */
+       for (i = 0; i < count; i++) {
+               if (array_search(order, ocount, temp[i]) == -1)
+                       dest[dest_count++] = temp[i];
+       }
+       assert(dest_count == count);
+       return same;
+}
+
+/**
+ * Check a list of key codes against the previous key scan
+ *
+ * Given a list of new key codes, we check how many of these are the same
+ * as last time.
+ *
+ * @param config       Input state
+ * @param keycode      List of key codes to examine
+ * @param num_keycodes Number of key codes
+ * @param same         Returns number of key codes which are the same
+ */
+static int input_check_keycodes(struct input_config *config,
+                          int keycode[], int num_keycodes, int *same)
+{
+       /* Select the 'plain' xlate table to start with */
+       if (!config->num_tables) {
+               debug("%s: No xlate tables: cannot decode keys\n", __func__);
+               return -1;
+       }
+
+       /* sort the keycodes into the same order as the previous ones */
+       *same = sort_array_by_ordering(keycode, num_keycodes,
+                       config->prev_keycodes, config->num_prev_keycodes);
+
+       memcpy(config->prev_keycodes, keycode, num_keycodes * sizeof(int));
+       config->num_prev_keycodes = num_keycodes;
+
+       return *same != num_keycodes;
+}
+
+/**
+ * Convert a list of key codes into ASCII
+ *
+ * You must call input_check_keycodes() before this. It turns the keycode
+ * list into a list of ASCII characters which are ready to send to the
+ * input layer.
+ *
+ * Characters which were seen last time do not generate fresh ASCII output.
+ *
+ * @param config       Input state
+ * @param keycode      List of key codes to examine
+ * @param num_keycodes Number of key codes
+ * @param same         Number of key codes which are the same
+ */
+static int input_keycodes_to_ascii(struct input_config *config,
+               int keycode[], int num_keycodes, char output_ch[], int same)
+{
+       struct input_key_xlate *table;
+       int ch_count;
+       int i;
+
+       table = &config->table[0];
+
+       /* deal with modifiers first */
+       for (i = 0; i < num_keycodes; i++) {
+               int key = keycode[i] & KEY_MASK;
+
+               if (key >= table->num_entries || table->xlate[key] == 0xff) {
+                       table = process_modifier(config, key,
+                                       keycode[i] & KEY_RELEASE);
+               }
+       }
+
+       /* now find normal keys */
+       for (i = ch_count = 0; i < num_keycodes; i++) {
+               int key = keycode[i];
+
+               if (key < table->num_entries && i >= same) {
+                       int ch = table->xlate[key];
+
+                       /* If a normal key with an ASCII value, add it! */
+                       if (ch != 0xff)
+                               output_ch[ch_count++] = (uchar)ch;
+               }
+       }
+
+       /* ok, so return keys */
+       return ch_count;
+}
+
+int input_send_keycodes(struct input_config *config,
+                       int keycode[], int num_keycodes)
+{
+       char ch[num_keycodes];
+       int count, i, same = 0;
+       int is_repeat = 0;
+       unsigned delay_ms;
+
+       config->modifiers = 0;
+       if (!input_check_keycodes(config, keycode, num_keycodes, &same)) {
+               /*
+                * Same as last time - is it time for another repeat?
+                * TODO(sjg@chromium.org) We drop repeats here and since
+                * the caller may not call in again for a while, our
+                * auto-repeat speed is not quite correct. We should
+                * insert another character if we later realise that we
+                * have missed a repeat slot.
+                */
+               is_repeat = (int)get_timer(config->next_repeat_ms) >= 0;
+               if (!is_repeat)
+                       return 0;
+       }
+
+       count = input_keycodes_to_ascii(config, keycode, num_keycodes,
+                                       ch, is_repeat ? 0 : same);
+       for (i = 0; i < count; i++)
+               input_queue_ascii(config, ch[i]);
+       delay_ms = is_repeat ?
+                       config->repeat_rate_ms :
+                       config->repeat_delay_ms;
+
+       config->next_repeat_ms = get_timer(0) + delay_ms;
+       return 0;
+}
+
+int input_add_table(struct input_config *config, int left_keycode,
+                   int right_keycode, const uchar *xlate, int num_entries)
+{
+       struct input_key_xlate *table;
+
+       if (config->num_tables == INPUT_MAX_MODIFIERS) {
+               debug("%s: Too many modifier tables\n", __func__);
+               return -1;
+       }
+
+       table = &config->table[config->num_tables++];
+       table->left_keycode = left_keycode;
+       table->right_keycode = right_keycode;
+       table->xlate = xlate;
+       table->num_entries = num_entries;
+
+       return 0;
+}
+
+int input_init(struct input_config *config, int leds, int repeat_delay_ms,
+              int repeat_rate_ms)
+{
+       memset(config, '\0', sizeof(*config));
+       config->leds = leds;
+       config->repeat_delay_ms = repeat_delay_ms;
+       config->repeat_rate_ms = repeat_rate_ms;
+       if (input_add_table(config, -1, -1,
+                       kbd_plain_xlate, ARRAY_SIZE(kbd_plain_xlate)) ||
+               input_add_table(config, KEY_LEFTSHIFT, KEY_RIGHTSHIFT,
+                       kbd_shift_xlate, ARRAY_SIZE(kbd_shift_xlate)) ||
+               input_add_table(config, KEY_LEFTCTRL, KEY_RIGHTCTRL,
+                       kbd_ctrl_xlate, ARRAY_SIZE(kbd_ctrl_xlate))) {
+               debug("%s: Could not add modifier tables\n", __func__);
+               return -1;
+       }
+
+       return 0;
+}
+
+int input_stdio_register(struct stdio_dev *dev)
+{
+       int error;
+
+       error = stdio_register(dev);
+
+       /* check if this is the standard input device */
+       if (!error && strcmp(getenv("stdin"), dev->name) == 0) {
+               /* reassign the console */
+               if (OVERWRITE_CONSOLE ||
+                               console_assign(stdin, dev->name))
+                       return -1;
+       }
+
+       return 0;
+}
diff --git a/drivers/input/key_matrix.c b/drivers/input/key_matrix.c
new file mode 100644 (file)
index 0000000..84b898f
--- /dev/null
@@ -0,0 +1,208 @@
+/*
+ * Manage Keyboard Matrices
+ *
+ * Copyright (c) 2012 The Chromium OS Authors.
+ * (C) Copyright 2004 DENX Software Engineering, Wolfgang Denk, wd@denx.de
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+#include <fdtdec.h>
+#include <key_matrix.h>
+#include <malloc.h>
+#include <linux/input.h>
+
+/**
+ * Determine if the current keypress configuration can cause key ghosting
+ *
+ * We figure this out by seeing if we have two or more keys in the same
+ * column, as well as two or more keys in the same row.
+ *
+ * @param config       Keyboard matrix config
+ * @param keys         List of keys to check
+ * @param valid                Number of valid keypresses to check
+ * @return 0 if no ghosting is possible, 1 if it is
+ */
+static int has_ghosting(struct key_matrix *config, struct key_matrix_key *keys,
+                       int valid)
+{
+       int key_in_same_col = 0, key_in_same_row = 0;
+       int i, j;
+
+       for (i = 0; i < valid; i++) {
+               /*
+                * Find 2 keys such that one key is in the same row
+                * and the other is in the same column as the i-th key.
+                */
+               for (j = i + 1; j < valid; j++) {
+                       if (keys[j].col == keys[i].col)
+                               key_in_same_col = 1;
+                       if (keys[j].row == keys[i].row)
+                               key_in_same_row = 1;
+               }
+       }
+
+       if (key_in_same_col && key_in_same_row)
+               return 1;
+       else
+               return 0;
+}
+
+int key_matrix_decode(struct key_matrix *config, struct key_matrix_key keys[],
+                     int num_keys, int keycode[], int max_keycodes)
+{
+       const u8 *keymap;
+       int valid, upto;
+       int pos;
+
+       debug("%s: num_keys = %d\n", __func__, num_keys);
+       keymap = config->plain_keycode;
+       for (valid = upto = 0; upto < num_keys; upto++) {
+               struct key_matrix_key *key = &keys[upto];
+
+               debug("  valid=%d, row=%d, col=%d\n", key->valid, key->row,
+                     key->col);
+               if (!key->valid)
+                       continue;
+               pos = key->row * config->num_cols + key->col;
+               if (config->fn_keycode && pos == config->fn_pos)
+                       keymap = config->fn_keycode;
+
+               /* Convert the (row, col) values into a keycode */
+               if (valid < max_keycodes)
+                       keycode[valid++] = keymap[pos];
+               debug("    keycode=%d\n", keymap[pos]);
+       }
+
+       /* For a ghost key config, ignore the keypresses for this iteration. */
+       if (valid >= 3 && has_ghosting(config, keys, valid)) {
+               valid = 0;
+               debug("    ghosting detected!\n");
+       }
+       debug("  %d valid keycodes found\n", valid);
+
+       return valid;
+}
+
+/**
+ * Create a new keycode map from some provided data
+ *
+ * This decodes a keycode map in the format used by the fdt, which is one
+ * word per entry, with the row, col and keycode encoded in that word.
+ *
+ * We create a (row x col) size byte array with each entry containing the
+ * keycode for that (row, col). We also search for map_keycode and return
+ * its position if found (this is used for finding the Fn key).
+ *
+ * @param config        Key matrix dimensions structure
+ * @param data          Keycode data
+ * @param len           Number of entries in keycode table
+ * @param map_keycode   Key code to find in the map
+ * @param pos           Returns position of map_keycode, if found, else -1
+ * @return map  Pointer to allocated map
+ */
+static uchar *create_keymap(struct key_matrix *config, u32 *data, int len,
+                           int map_keycode, int *pos)
+{
+       uchar *map;
+
+       if (pos)
+               *pos = -1;
+       map = (uchar *)calloc(1, config->key_count);
+       if (!map) {
+               debug("%s: failed to malloc %d bytes\n", __func__,
+                       config->key_count);
+               return NULL;
+       }
+
+       for (; len >= sizeof(u32); data++, len -= 4) {
+               u32 tmp = fdt32_to_cpu(*data);
+               int key_code, row, col;
+               int entry;
+
+               row = (tmp >> 24) & 0xff;
+               col = (tmp >> 16) & 0xff;
+               key_code = tmp & 0xffff;
+               entry = row * config->num_cols + col;
+               map[entry] = key_code;
+               if (pos && map_keycode == key_code)
+                       *pos = entry;
+       }
+
+       return map;
+}
+
+int key_matrix_decode_fdt(struct key_matrix *config, const void *blob,
+                         int node)
+{
+       const struct fdt_property *prop;
+       int offset;
+
+       /* Check each property name for ones that we understand */
+       for (offset = fdt_first_property_offset(blob, node);
+                     offset > 0;
+                     offset = fdt_next_property_offset(blob, offset)) {
+               const char *name;
+               int len;
+
+               prop = fdt_get_property_by_offset(blob, offset, NULL);
+               name = fdt_string(blob, fdt32_to_cpu(prop->nameoff));
+               len = strlen(name);
+
+               /* Name needs to match "1,<type>keymap" */
+               debug("%s: property '%s'\n", __func__, name);
+               if (strncmp(name, "1,", 2) || len < 8 ||
+                   strcmp(name + len - 6, "keymap"))
+                       continue;
+
+               len -= 8;
+               if (len == 0) {
+                       config->plain_keycode = create_keymap(config,
+                               (u32 *)prop->data, fdt32_to_cpu(prop->len),
+                               KEY_FN, &config->fn_pos);
+               } else if (0 == strncmp(name + 2, "fn-", len)) {
+                       config->fn_keycode = create_keymap(config,
+                               (u32 *)prop->data, fdt32_to_cpu(prop->len),
+                               -1, NULL);
+               } else {
+                       debug("%s: unrecognised property '%s'\n", __func__,
+                             name);
+               }
+       }
+       debug("%s: Decoded key maps %p, %p from fdt\n", __func__,
+             config->plain_keycode, config->fn_keycode);
+
+       if (!config->plain_keycode) {
+               debug("%s: cannot find keycode-plain map\n", __func__);
+               return -1;
+       }
+
+       return 0;
+}
+
+int key_matrix_init(struct key_matrix *config, int rows, int cols)
+{
+       memset(config, '\0', sizeof(*config));
+       config->num_rows = rows;
+       config->num_cols = cols;
+       config->key_count = rows * cols;
+       assert(config->key_count > 0);
+
+       return 0;
+}
diff --git a/drivers/input/mxc_keyb.c b/drivers/input/mxc_keyb.c
new file mode 100644 (file)
index 0000000..ec65ab5
--- /dev/null
@@ -0,0 +1,598 @@
+/*
+ * Copyright 2004-2009 Freescale Semiconductor, Inc. All Rights Reserved.
+ */
+
+/*
+ * The code contained herein is licensed under the GNU General Public
+ * License. You may obtain a copy of the GNU General Public License
+ * Version 2 or later at the following locations:
+ *
+ * http://www.opensource.org/licenses/gpl-license.html
+ * http://www.gnu.org/copyleft/gpl.html
+ */
+
+/*!
+ * @file mxc_keyb.c
+ *
+ * @brief Driver for the Freescale Semiconductor MXC keypad port.
+ *
+ * The keypad driver is designed as a standard Input driver which interacts
+ * with low level keypad port hardware. Upon opening, the Keypad driver
+ * initializes the keypad port. When the keypad interrupt happens the driver
+ * calles keypad polling timer and scans the keypad matrix for key
+ * press/release. If all key press/release happened it comes out of timer and
+ * waits for key press interrupt. The scancode for key press and release events
+ * are passed to Input subsytem.
+ *
+ * @ingroup keypad
+ */
+
+#include <asm/io.h>
+#include <common.h>
+#include <asm/errno.h>
+#include <asm/arch/keypad.h>
+#include <linux/types.h>
+#include <malloc.h>
+
+/*
+ *  * Module header file
+ *   */
+#include <mxc_keyb.h>
+
+/*!
+ * Comment KPP_DEBUG to disable debug messages
+ */
+
+#undef KPP_DEBUG
+
+#ifdef KPP_DEBUG
+#define        KPP_PRINTF(fmt, args...)        printf(fmt , ##args)
+
+static void mxc_kpp_dump_regs()
+{
+       unsigned short t1, t2, t3;
+
+       t1 = __raw_readw(KPCR);
+       t2 = __raw_readw(KPSR);
+       t3 = __raw_readw(KDDR);
+       /*
+       KPP_PRINTF("KPCR=0x%04x, KPSR=0x%04x, KDDR=0x%04x\n",
+               t1, t2, t3);
+               */
+}
+#else
+#define KPP_PRINTF(fmt, args...)
+#endif
+
+static u16 mxc_key_mapping[] = CONFIG_MXC_KEYMAPPING;
+
+/*!
+ * This structure holds the keypad private data structure.
+ */
+static struct keypad_priv kpp_dev;
+
+/*! Indicates if the key pad device is enabled. */
+
+/*! This static variable indicates whether a key event is pressed/released. */
+static unsigned short KPress;
+
+/*! cur_rcmap and prev_rcmap array is used to detect key press and release. */
+static unsigned short *cur_rcmap;      /* max 64 bits (8x8 matrix) */
+static unsigned short *prev_rcmap;
+
+/*!
+ * Debounce polling period(10ms) in system ticks.
+ */
+static unsigned short KScanRate = (10 * CONFIG_SYS_HZ) / 1000;
+
+/*!
+ * These arrays are used to store press and release scancodes.
+ */
+static short **press_scancode;
+static short **release_scancode;
+
+static const unsigned short *mxckpd_keycodes;
+static unsigned short mxckpd_keycodes_size;
+
+/*!
+ * These functions are used to configure and the GPIO pins for keypad to
+ * activate and deactivate it.
+ */
+extern void setup_mxc_kpd(void);
+
+/*!
+ * This function is called to scan the keypad matrix to find out the key press
+ * and key release events. Make scancode and break scancode are generated for
+ * key press and key release events.
+ *
+ * The following scanning sequence are done for
+ * keypad row and column scanning,
+ * -# Write 1's to KPDR[15:8], setting column data to 1's
+ * -# Configure columns as totem pole outputs(for quick discharging of keypad
+ * capacitance)
+ * -# Configure columns as open-drain
+ * -# Write a single column to 0, others to 1.
+ * -# Sample row inputs and save data. Multiple key presses can be detected on
+ * a single column.
+ * -# Repeat steps the above steps for remaining columns.
+ * -# Return all columns to 0 in preparation for standby mode.
+ * -# Clear KPKD and KPKR status bit(s) by writing to a 1,
+ *    Set the KPKR synchronizer chain by writing "1" to KRSS register,
+ *    Clear the KPKD synchronizer chain by writing "1" to KDSC register
+ *
+ * @result    Number of key pressed/released.
+ */
+static int mxc_kpp_scan_matrix(void)
+{
+       unsigned short reg_val;
+       int col, row;
+       short scancode = 0;
+       int keycnt = 0;         /* How many keys are still pressed */
+
+       /*
+        * wmb() linux kernel function which guarantees orderings in write
+        * operations
+        */
+       /* wmb(); */
+
+       /* save cur keypad matrix to prev */
+       memcpy(prev_rcmap, cur_rcmap, kpp_dev.kpp_rows * sizeof(prev_rcmap[0]));
+       memset(cur_rcmap, 0, kpp_dev.kpp_rows * sizeof(cur_rcmap[0]));
+
+       for (col = 0; col < kpp_dev.kpp_cols; col++) {  /* Col */
+               /* 2. Write 1.s to KPDR[15:8] setting column data to 1.s */
+               reg_val = __raw_readw(KPDR);
+               reg_val |= 0xff00;
+               __raw_writew(reg_val, KPDR);
+
+               /*
+                * 3. Configure columns as totem pole outputs(for quick
+                * discharging of keypad capacitance)
+                */
+               reg_val = __raw_readw(KPCR);
+               reg_val &= 0x00ff;
+               __raw_writew(reg_val, KPCR);
+
+               udelay(2);
+
+#ifdef KPP_DEBUG
+               mxc_kpp_dump_regs();
+#endif
+
+               /*
+                * 4. Configure columns as open-drain
+                */
+               reg_val = __raw_readw(KPCR);
+               reg_val |= ((1 << kpp_dev.kpp_cols) - 1) << 8;
+               __raw_writew(reg_val, KPCR);
+
+               /*
+                * 5. Write a single column to 0, others to 1.
+                * 6. Sample row inputs and save data. Multiple key presses
+                * can be detected on a single column.
+                * 7. Repeat steps 2 - 6 for remaining columns.
+                */
+
+               /* Col bit starts at 8th bit in KPDR */
+               reg_val = __raw_readw(KPDR);
+               reg_val &= ~(1 << (8 + col));
+               __raw_writew(reg_val, KPDR);
+
+               /* Delay added to avoid propagating the 0 from column to row
+                * when scanning. */
+
+               udelay(5);
+
+#ifdef KPP_DEBUG
+               mxc_kpp_dump_regs();
+#endif
+
+               /* Read row input */
+               reg_val = __raw_readw(KPDR);
+               for (row = 0; row < kpp_dev.kpp_rows; row++) {  /* sample row */
+                       if (TEST_BIT(reg_val, row) == 0) {
+                               cur_rcmap[row] = BITSET(cur_rcmap[row], col);
+                               keycnt++;
+                       }
+               }
+       }
+
+       /*
+        * 8. Return all columns to 0 in preparation for standby mode.
+        * 9. Clear KPKD and KPKR status bit(s) by writing to a .1.,
+        * set the KPKR synchronizer chain by writing "1" to KRSS register,
+        * clear the KPKD synchronizer chain by writing "1" to KDSC register
+        */
+       reg_val = 0x00;
+       __raw_writew(reg_val, KPDR);
+       reg_val = __raw_readw(KPDR);
+       reg_val = __raw_readw(KPSR);
+       reg_val |= KBD_STAT_KPKD | KBD_STAT_KPKR | KBD_STAT_KRSS |
+           KBD_STAT_KDSC;
+       __raw_writew(reg_val, KPSR);
+
+#ifdef KPP_DEBUG
+       mxc_kpp_dump_regs();
+#endif
+
+       /* Check key press status change */
+
+       /*
+        * prev_rcmap array will contain the previous status of the keypad
+        * matrix.  cur_rcmap array will contains the present status of the
+        * keypad matrix. If a bit is set in the array, that (row, col) bit is
+        * pressed, else it is not pressed.
+        *
+        * XORing these two variables will give us the change in bit for
+        * particular row and column.  If a bit is set in XOR output, then that
+        * (row, col) has a change of status from the previous state.  From
+        * the diff variable the key press and key release of row and column
+        * are found out.
+        *
+        * If the key press is determined then scancode for key pressed
+        * can be generated using the following statement:
+        *    scancode = ((row * 8) + col);
+        *
+        * If the key release is determined then scancode for key release
+        * can be generated using the following statement:
+        *    scancode = ((row * 8) + col) + MXC_KEYRELEASE;
+        */
+       for (row = 0; row < kpp_dev.kpp_rows; row++) {
+               unsigned char diff;
+
+               /*
+                * Calculate the change in the keypad row status
+                */
+               diff = prev_rcmap[row] ^ cur_rcmap[row];
+
+               for (col = 0; col < kpp_dev.kpp_cols; col++) {
+                       if ((diff >> col) & 0x1) {
+                               /* There is a status change on col */
+                               if ((prev_rcmap[row] & BITSET(0, col)) == 0) {
+                                       /*
+                                        * Previous state is 0, so now
+                                        * a key is pressed
+                                        */
+                                       scancode =
+                                           ((row * kpp_dev.kpp_cols) +
+                                            col);
+                                       KPress = 1;
+                                       kpp_dev.iKeyState = KStateUp;
+
+                                       KPP_PRINTF("Press   (%d, %d) scan=%d "
+                                                "Kpress=%d\n",
+                                                row, col, scancode, KPress);
+                                       press_scancode[row][col] =
+                                           (short)scancode;
+                               } else {
+                                       /*
+                                        * Previous state is not 0, so
+                                        * now a key is released
+                                        */
+                                       scancode =
+                                           (row * kpp_dev.kpp_cols) +
+                                           col + MXC_KEYRELEASE;
+                                       KPress = 0;
+                                       kpp_dev.iKeyState = KStateDown;
+
+                                       KPP_PRINTF
+                                           ("Release (%d, %d) scan=%d Kpress=%d\n",
+                                            row, col, scancode, KPress);
+                                       release_scancode[row][col] =
+                                           (short)scancode;
+                                       keycnt++;
+                               }
+                       }
+               }
+       }
+
+       return keycnt;
+}
+
+static int mxc_kpp_reset(void)
+{
+       unsigned short reg_val;
+       int i;
+
+       /*
+       * Stop scanning and wait for interrupt.
+       * Enable press interrupt and disable release interrupt.
+       */
+       __raw_writew(0x00FF, KPDR);
+       reg_val = __raw_readw(KPSR);
+       reg_val |= (KBD_STAT_KPKR | KBD_STAT_KPKD);
+       reg_val |= KBD_STAT_KRSS | KBD_STAT_KDSC;
+       __raw_writew(reg_val, KPSR);
+       reg_val |= KBD_STAT_KDIE;
+       reg_val &= ~KBD_STAT_KRIE;
+       __raw_writew(reg_val, KPSR);
+
+#ifdef KPP_DEBUG
+       mxc_kpp_dump_regs();
+#endif
+
+       /*
+       * No more keys pressed... make sure unwanted key codes are
+       * not given upstairs
+       */
+       for (i = 0; i < kpp_dev.kpp_rows; i++) {
+               memset(press_scancode[i], -1,
+                       sizeof(press_scancode[0][0]) * kpp_dev.kpp_cols);
+               memset(release_scancode[i], -1,
+                       sizeof(release_scancode[0][0]) *
+                       kpp_dev.kpp_cols);
+       }
+
+       return 0;
+}
+
+int mxc_kpp_getc(struct kpp_key_info *key_info)
+{
+       int col, row;
+       static int key_cnt;
+       unsigned short reg_val;
+       short scancode = 0;
+
+       reg_val = __raw_readw(KPSR);
+
+       if (!key_cnt) {
+               if (reg_val & KBD_STAT_KPKD) {
+                       /*
+                       * Disable key press(KDIE status bit) interrupt
+                       */
+                       reg_val &= ~KBD_STAT_KDIE;
+                       __raw_writew(reg_val, KPSR);
+
+#ifdef KPP_DEBUG
+                       mxc_kpp_dump_regs();
+#endif
+
+                       key_cnt = mxc_kpp_scan_matrix();
+               } else {
+                       return 0;
+               }
+       }
+
+       /*
+       * This switch case statement is the
+       * implementation of state machine of debounc
+       * logic for key press/release.
+       * The explaination of state machine is as
+       * follows:
+       *
+       * KStateUp State:
+       * This is in intial state of the state machine
+       * this state it checks for any key presses.
+       * The key press can be checked using the
+       * variable KPress. If KPress is set, then key
+       * press is identified and switches the to
+       * KStateFirstDown state for key press to
+       * debounce.
+       *
+       * KStateFirstDown:
+       * After debounce delay(10ms), if the KPress is
+       * still set then pass scancode generated to
+       * input device and change the state to
+       * KStateDown, else key press debounce is not
+       * satisfied so change the state to KStateUp.
+       *
+       * KStateDown:
+       * In this state it checks for any key release.
+       * If KPress variable is cleared, then key
+       * release is indicated and so, switch the
+       * state to KStateFirstUp else to state
+       * KStateDown.
+       *
+       * KStateFirstUp:
+       * After debounce delay(10ms), if the KPress is
+       * still reset then pass the key release
+       * scancode to input device and change
+       * the state to KStateUp else key release is
+       * not satisfied so change the state to
+       * KStateDown.
+       */
+
+       for (row = 0; row < kpp_dev.kpp_rows; row++) {
+               for (col = 0; col < kpp_dev.kpp_cols; col++) {
+                       if ((press_scancode[row][col] != -1)) {
+                               /* Still Down, so add scancode */
+                               scancode =
+                                   press_scancode[row][col];
+
+                               key_info->val = mxckpd_keycodes[scancode];
+                               key_info->evt = KDepress;
+
+                               KPP_PRINTF("KStateFirstDown: scan=%d val=%d\n",
+                                       scancode, mxckpd_keycodes[scancode]);
+                               kpp_dev.iKeyState = KStateDown;
+                               press_scancode[row][col] = -1;
+
+                               goto key_detect;
+                       }
+               }
+       }
+
+       for (row = 0; row < kpp_dev.kpp_rows; row++) {
+               for (col = 0; col < kpp_dev.kpp_cols; col++) {
+                       if ((release_scancode[row][col] != -1)) {
+                               scancode =
+                                   release_scancode[row][col];
+                               scancode =
+                                       scancode - MXC_KEYRELEASE;
+
+                               key_info->val = mxckpd_keycodes[scancode];
+                               key_info->evt = KRelease;
+
+                               KPP_PRINTF("KStateFirstUp: scan=%d val=%d\n",
+                                       scancode, mxckpd_keycodes[scancode]);
+
+                               kpp_dev.iKeyState = KStateUp;
+                               release_scancode[row][col] = -1;
+
+                               goto key_detect;
+                       }
+               }
+       }
+
+       return 0;
+
+key_detect:
+       /* udelay(KScanRate); */
+       key_cnt = mxc_kpp_scan_matrix();
+
+       if (0 == key_cnt)
+               mxc_kpp_reset();
+       return 1;
+}
+
+/*!
+ * This function is called to free the allocated memory for local arrays
+ */
+static void mxc_kpp_free_allocated(void)
+{
+       int i;
+
+       if (press_scancode) {
+               for (i = 0; i < kpp_dev.kpp_rows; i++) {
+                       if (press_scancode[i])
+                               free(press_scancode[i]);
+               }
+               free(press_scancode);
+       }
+
+       if (release_scancode) {
+               for (i = 0; i < kpp_dev.kpp_rows; i++) {
+                       if (release_scancode[i])
+                               free(release_scancode[i]);
+               }
+               free(release_scancode);
+       }
+
+       if (cur_rcmap)
+               free(cur_rcmap);
+
+       if (prev_rcmap)
+               free(prev_rcmap);
+}
+
+/*!
+ * This function is called during the driver binding process.
+ *
+ * @param   pdev  the device structure used to store device specific
+ *                information that is used by the suspend, resume and remove
+ *                functions.
+ *
+ * @return  The function returns 0 on successful registration. Otherwise returns
+ *          specific error code.
+ */
+int mxc_kpp_init(void)
+{
+       int i;
+       int retval;
+       unsigned int reg_val;
+
+       kpp_dev.kpp_cols = CONFIG_MXC_KPD_COLMAX;
+       kpp_dev.kpp_rows = CONFIG_MXC_KPD_ROWMAX;
+
+       /* clock and IOMUX configuration for keypad */
+       setup_mxc_kpd();
+
+       /* Configure keypad */
+
+       /* Enable number of rows in keypad (KPCR[7:0])
+        * Configure keypad columns as open-drain (KPCR[15:8])
+        *
+        * Configure the rows/cols in KPP
+        * LSB nibble in KPP is for 8 rows
+        * MSB nibble in KPP is for 8 cols
+        */
+       reg_val = __raw_readw(KPCR);
+       reg_val |= (1  << kpp_dev.kpp_rows) - 1;        /* LSB */
+       reg_val |= ((1 << kpp_dev.kpp_cols) - 1) << 8;  /* MSB */
+       __raw_writew(reg_val, KPCR);
+
+       /* Write 0's to KPDR[15:8] */
+       reg_val = __raw_readw(KPDR);
+       reg_val &= 0x00ff;
+       __raw_writew(reg_val, KPDR);
+
+       /* Configure columns as output,
+        * rows as input (KDDR[15:0]) */
+       reg_val = __raw_readw(KDDR);
+       reg_val |= 0xff00;
+       reg_val &= 0xff00;
+       __raw_writew(reg_val, KDDR);
+
+       /* Clear the KPKD Status Flag
+        * and Synchronizer chain. */
+       reg_val = __raw_readw(KPSR);
+       reg_val &= ~(KBD_STAT_KPKR | KBD_STAT_KPKD);
+       reg_val |= KBD_STAT_KPKD;
+       reg_val |= KBD_STAT_KRSS | KBD_STAT_KDSC;
+       __raw_writew(reg_val, KPSR);
+       /* Set the KDIE control bit, and clear the KRIE
+        * control bit (avoid false release events). */
+       reg_val |= KBD_STAT_KDIE;
+       reg_val &= ~KBD_STAT_KRIE;
+       __raw_writew(reg_val, KPSR);
+
+#ifdef KPP_DEBUG
+       mxc_kpp_dump_regs();
+#endif
+
+       mxckpd_keycodes = mxc_key_mapping;
+       mxckpd_keycodes_size = kpp_dev.kpp_cols * kpp_dev.kpp_rows;
+
+       if ((mxckpd_keycodes == (void *)0)
+           || (mxckpd_keycodes_size == 0)) {
+               retval = -ENODEV;
+               goto err;
+       }
+
+       /* allocate required memory */
+       press_scancode   = (short **)malloc(kpp_dev.kpp_rows * sizeof(press_scancode[0]));
+       release_scancode = (short **)malloc(kpp_dev.kpp_rows * sizeof(release_scancode[0]));
+
+       if (!press_scancode || !release_scancode) {
+               retval = -ENOMEM;
+               goto err;
+       }
+
+       for (i = 0; i < kpp_dev.kpp_rows; i++) {
+               press_scancode[i] = (short *)malloc(kpp_dev.kpp_cols
+                                           * sizeof(press_scancode[0][0]));
+               release_scancode[i] =
+                   (short *)malloc(kpp_dev.kpp_cols * sizeof(release_scancode[0][0]));
+
+               if (!press_scancode[i] || !release_scancode[i]) {
+                       retval = -ENOMEM;
+                       goto err;
+               }
+       }
+
+       cur_rcmap =
+           (unsigned short *)malloc(kpp_dev.kpp_rows * sizeof(cur_rcmap[0]));
+       prev_rcmap =
+           (unsigned short *)malloc(kpp_dev.kpp_rows * sizeof(prev_rcmap[0]));
+
+       if (!cur_rcmap || !prev_rcmap) {
+               retval = -ENOMEM;
+               goto err;
+       }
+
+       for (i = 0; i < kpp_dev.kpp_rows; i++) {
+               memset(press_scancode[i], -1,
+                      sizeof(press_scancode[0][0]) * kpp_dev.kpp_cols);
+               memset(release_scancode[i], -1,
+                      sizeof(release_scancode[0][0]) * kpp_dev.kpp_cols);
+       }
+       memset(cur_rcmap, 0, kpp_dev.kpp_rows * sizeof(cur_rcmap[0]));
+       memset(prev_rcmap, 0, kpp_dev.kpp_rows * sizeof(prev_rcmap[0]));
+
+       return 0;
+
+err:
+       mxc_kpp_free_allocated();
+       return retval;
+}
+
diff --git a/drivers/input/tegra-kbc.c b/drivers/input/tegra-kbc.c
new file mode 100644 (file)
index 0000000..f164791
--- /dev/null
@@ -0,0 +1,375 @@
+/*
+ *  (C) Copyright 2011
+ *  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 <fdtdec.h>
+#include <input.h>
+#include <key_matrix.h>
+#include <stdio_dev.h>
+#include <tegra-kbc.h>
+#include <asm/io.h>
+#include <asm/arch/clock.h>
+#include <asm/arch/funcmux.h>
+#include <asm/arch/timer.h>
+#include <linux/input.h>
+
+DECLARE_GLOBAL_DATA_PTR;
+
+enum {
+       KBC_MAX_GPIO            = 24,
+       KBC_MAX_KPENT           = 8,    /* size of keypress entry queue */
+};
+
+#define KBC_FIFO_TH_CNT_SHIFT          14
+#define KBC_DEBOUNCE_CNT_SHIFT         4
+#define KBC_CONTROL_FIFO_CNT_INT_EN    (1 << 3)
+#define KBC_CONTROL_KBC_EN             (1 << 0)
+#define KBC_INT_FIFO_CNT_INT_STATUS    (1 << 2)
+#define KBC_KPENT_VALID                        (1 << 7)
+#define KBC_ST_STATUS                  (1 << 3)
+
+enum {
+       KBC_DEBOUNCE_COUNT      = 2,
+       KBC_REPEAT_RATE_MS      = 30,
+       KBC_REPEAT_DELAY_MS     = 240,
+       KBC_CLOCK_KHZ           = 32,   /* Keyboard uses a 32KHz clock */
+};
+
+/* keyboard controller config and state */
+static struct keyb {
+       struct input_config input;      /* The input layer */
+       struct key_matrix matrix;       /* The key matrix layer */
+
+       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 */
+
+       /*
+        * After init we must wait a short time before polling the keyboard.
+        * This gives the tegra keyboard controller time to react after reset
+        * and lets us grab keys pressed during reset.
+        */
+       unsigned int init_dly_ms;       /* Delay before we can read keyboard */
+       unsigned int start_time_ms;     /* Time that we inited (in ms) */
+       unsigned int last_poll_ms;      /* Time we should last polled */
+       unsigned int next_repeat_ms;    /* Next time we repeat a key */
+} config;
+
+/**
+ * reads the keyboard fifo for current keypresses
+ *
+ * @param config       Keyboard config
+ * @param fifo         Place to put fifo results
+ * @param max_keycodes Maximum number of key codes to put in the fifo
+ * @return number of items put into fifo
+ */
+static int tegra_kbc_find_keys(struct keyb *config, int *fifo,
+                              int max_keycodes)
+{
+       struct key_matrix_key keys[KBC_MAX_KPENT], *key;
+       u32 kp_ent = 0;
+       int i;
+
+       for (key = keys, i = 0; i < KBC_MAX_KPENT; i++, key++) {
+               /* Get next word */
+               if (!(i & 3))
+                       kp_ent = readl(&config->kbc->kp_ent[i / 4]);
+
+               key->valid = (kp_ent & KBC_KPENT_VALID) != 0;
+               key->row = (kp_ent >> 3) & 0xf;
+               key->col = kp_ent & 0x7;
+
+               /* Shift to get next entry */
+               kp_ent >>= 8;
+       }
+       return key_matrix_decode(&config->matrix, keys, KBC_MAX_KPENT, fifo,
+                                max_keycodes);
+}
+
+/**
+ * Process all the keypress sequences in fifo and send key codes
+ *
+ * The fifo contains zero or more keypress sets. Each set
+ * consists of from 1-8 keycodes, representing the keycodes which
+ * were simultaneously pressed during that scan.
+ *
+ * This function works through each set and generates ASCII characters
+ * for each. Not that one set may produce more than one ASCII characters -
+ * for example holding down 'd' and 'f' at the same time will generate
+ * two ASCII characters.
+ *
+ * Note: if fifo_cnt is 0, we will tell the input layer that no keys are
+ * pressed.
+ *
+ * @param config       Keyboard config
+ * @param fifo_cnt     Number of entries in the keyboard fifo
+ */
+static void process_fifo(struct keyb *config, int fifo_cnt)
+{
+       int fifo[KBC_MAX_KPENT];
+       int cnt = 0;
+
+       /* Always call input_send_keycodes() at least once */
+       do {
+               if (fifo_cnt)
+                       cnt = tegra_kbc_find_keys(config, fifo, KBC_MAX_KPENT);
+
+               input_send_keycodes(&config->input, fifo, cnt);
+       } while (--fifo_cnt > 0);
+}
+
+/**
+ * Check the keyboard controller and emit ASCII characters for any keys that
+ * are pressed.
+ *
+ * @param config       Keyboard config
+ */
+static void check_for_keys(struct keyb *config)
+{
+       int fifo_cnt;
+
+       if (!config->first_scan &&
+                       get_timer(config->last_poll_ms) < KBC_REPEAT_RATE_MS)
+               return;
+       config->last_poll_ms = get_timer(0);
+       config->first_scan = 0;
+
+       /*
+        * Once we get here we know the keyboard has been scanned. So if there
+        * scan waiting for us, we know that nothing is held down.
+        */
+       fifo_cnt = (readl(&config->kbc->interrupt) >> 4) & 0xf;
+       process_fifo(config, fifo_cnt);
+}
+
+/**
+ * In order to detect keys pressed on boot, wait for the hardware to
+ * complete scanning the keys. This includes time to transition from
+ * Wkup mode to Continous polling mode and the repoll time. We can
+ * deduct the time that's already elapsed.
+ *
+ * @param config       Keyboard config
+ */
+static void kbd_wait_for_fifo_init(struct keyb *config)
+{
+       if (!config->inited) {
+               unsigned long elapsed_time;
+               long delay_ms;
+
+               elapsed_time = get_timer(config->start_time_ms);
+               delay_ms = config->init_dly_ms - elapsed_time;
+               if (delay_ms > 0) {
+                       udelay(delay_ms * 1000);
+                       debug("%s: delay %ldms\n", __func__, delay_ms);
+               }
+
+               config->inited = 1;
+       }
+}
+
+/**
+ * Check the tegra keyboard, and send any keys that are pressed.
+ *
+ * This is called by input_tstc() and input_getc() when they need more
+ * characters
+ *
+ * @param input                Input configuration
+ * @return 1, to indicate that we have something to look at
+ */
+int tegra_kbc_check(struct input_config *input)
+{
+       kbd_wait_for_fifo_init(&config);
+       check_for_keys(&config);
+
+       return 1;
+}
+
+/**
+ * Test if keys are available to be read
+ *
+ * @return 0 if no keys available, 1 if keys are available
+ */
+static int kbd_tstc(void)
+{
+       /* Just get input to do this for us */
+       return input_tstc(&config.input);
+}
+
+/**
+ * Read a key
+ *
+ * TODO: U-Boot wants 0 for no key, but Ctrl-@ is a valid key...
+ *
+ * @return ASCII key code, or 0 if no key, or -1 if error
+ */
+static int kbd_getc(void)
+{
+       /* Just get input to do this for us */
+       return input_getc(&config.input);
+}
+
+/* configures keyboard GPIO registers to use the rows and columns */
+static void config_kbc_gpio(struct kbc_tegra *kbc)
+{
+       int i;
+
+       for (i = 0; i < KBC_MAX_GPIO; i++) {
+               u32 row_cfg, col_cfg;
+               u32 r_shift = 5 * (i % 6);
+               u32 c_shift = 4 * (i % 8);
+               u32 r_mask = 0x1f << r_shift;
+               u32 c_mask = 0xf << c_shift;
+               u32 r_offs = i / 6;
+               u32 c_offs = i / 8;
+
+               row_cfg = readl(&kbc->row_cfg[r_offs]);
+               col_cfg = readl(&kbc->col_cfg[c_offs]);
+
+               row_cfg &= ~r_mask;
+               col_cfg &= ~c_mask;
+
+               if (i < config.matrix.num_rows) {
+                       row_cfg |= ((i << 1) | 1) << r_shift;
+               } else {
+                       col_cfg |= (((i - config.matrix.num_rows) << 1) | 1)
+                                       << c_shift;
+               }
+
+               writel(row_cfg, &kbc->row_cfg[r_offs]);
+               writel(col_cfg, &kbc->col_cfg[c_offs]);
+       }
+}
+
+/**
+ * Start up the keyboard device
+ */
+static void tegra_kbc_open(void)
+{
+       struct kbc_tegra *kbc = config.kbc;
+       unsigned int scan_period;
+       u32 val;
+
+       /*
+        * We will scan at twice the keyboard repeat rate, so that there is
+        * always a scan ready when we check it in check_for_keys().
+        */
+       scan_period = KBC_REPEAT_RATE_MS / 2;
+       writel(scan_period * KBC_CLOCK_KHZ, &kbc->rpt_dly);
+       writel(scan_period * KBC_CLOCK_KHZ, &kbc->init_dly);
+       /*
+        * Before reading from the keyboard we must wait for the init_dly
+        * plus the rpt_delay, plus 2ms for the row scan time.
+        */
+       config.init_dly_ms = scan_period * 2 + 2;
+
+       val = KBC_DEBOUNCE_COUNT << KBC_DEBOUNCE_CNT_SHIFT;
+       val |= 1 << KBC_FIFO_TH_CNT_SHIFT;      /* fifo interrupt threshold */
+       val |= KBC_CONTROL_KBC_EN;              /* enable */
+       writel(val, &kbc->control);
+
+       config.start_time_ms = get_timer(0);
+       config.last_poll_ms = config.next_repeat_ms = get_timer(0);
+       config.first_scan = 1;
+}
+
+/**
+ * Set up the tegra keyboard. This is called by the stdio device handler
+ *
+ * We want to do this init when the keyboard is actually used rather than
+ * at start-up, since keyboard input may not currently be selected.
+ *
+ * Once the keyboard starts there will be a period during which we must
+ * wait for the keyboard to init. We do this only when a key is first
+ * read - see kbd_wait_for_fifo_init().
+ *
+ * @return 0 if ok, -ve on error
+ */
+static int init_tegra_keyboard(void)
+{
+#ifdef CONFIG_OF_CONTROL
+       int     node;
+
+       node = fdtdec_next_compatible(gd->fdt_blob, 0,
+                                         COMPAT_NVIDIA_TEGRA20_KBC);
+       if (node < 0) {
+               debug("%s: cannot locate keyboard node\n", __func__);
+               return node;
+       }
+       config.kbc = (struct kbc_tegra *)fdtdec_get_addr(gd->fdt_blob,
+                      node, "reg");
+       if ((fdt_addr_t)config.kbc == FDT_ADDR_T_NONE) {
+               debug("%s: No keyboard register found\n", __func__);
+               return -1;
+       }
+
+       /* Decode the keyboard matrix information (16 rows, 8 columns) */
+       if (key_matrix_init(&config.matrix, 16, 8)) {
+               debug("%s: Could not init key matrix\n", __func__);
+               return -1;
+       }
+       if (key_matrix_decode_fdt(&config.matrix, gd->fdt_blob, node)) {
+               debug("%s: Could not decode key matrix from fdt\n", __func__);
+               return -1;
+       }
+       if (config.matrix.fn_keycode) {
+               if (input_add_table(&config.input, KEY_FN, -1,
+                                   config.matrix.fn_keycode,
+                                   config.matrix.key_count))
+                       return -1;
+       }
+#else
+#error "Tegra keyboard driver requires FDT definitions"
+#endif
+
+       /* Set up pin mux and enable the clock */
+       funcmux_select(PERIPH_ID_KBC, FUNCMUX_DEFAULT);
+       clock_enable(PERIPH_ID_KBC);
+       config_kbc_gpio(config.kbc);
+
+       tegra_kbc_open();
+       debug("%s: Tegra keyboard ready\n", __func__);
+
+       return 0;
+}
+
+int drv_keyboard_init(void)
+{
+       struct stdio_dev dev;
+
+       if (input_init(&config.input, 0, KBC_REPEAT_DELAY_MS,
+                       KBC_REPEAT_RATE_MS)) {
+               debug("%s: Cannot set up input\n", __func__);
+               return -1;
+       }
+       config.input.read_keys = tegra_kbc_check;
+
+       memset(&dev, '\0', sizeof(dev));
+       strcpy(dev.name, "tegra-kbc");
+       dev.flags = DEV_FLAGS_INPUT | DEV_FLAGS_SYSTEM;
+       dev.getc = kbd_getc;
+       dev.tstc = kbd_tstc;
+       dev.start = init_tegra_keyboard;
+
+       /* Register the device. init_tegra_keyboard() will be called soon */
+       return input_stdio_register(&dev);
+}
index a70970784c2f5992d805d9b29241fcba0e4051ae..99aec1f47a57639afb1a37252adedc7d9b4bb564 100644 (file)
@@ -28,6 +28,7 @@ LIB   := $(obj)libmisc.o
 COBJS-$(CONFIG_ALI152X) += ali512x.o
 COBJS-$(CONFIG_DS4510)  += ds4510.o
 COBJS-$(CONFIG_FSL_LAW) += fsl_law.o
+COBJS-$(CONFIG_IMX_IIM) += imx_iim.o
 COBJS-$(CONFIG_GPIO_LED) += gpio_led.o
 COBJS-$(CONFIG_FSL_MC9SDZ60) += mc9sdz60.o
 COBJS-$(CONFIG_NS87308) += ns87308.o
@@ -35,10 +36,12 @@ COBJS-$(CONFIG_PDSP188x) += pdsp188x.o
 COBJS-$(CONFIG_STATUS_LED) += status_led.o
 COBJS-$(CONFIG_TWL4030_LED) += twl4030_led.o
 COBJS-$(CONFIG_PMIC) += pmic_core.o
+COBJS-$(CONFIG_DIALOG_PMIC) += pmic_dialog.o
 COBJS-$(CONFIG_PMIC_FSL) += pmic_fsl.o
 COBJS-$(CONFIG_PMIC_I2C) += pmic_i2c.o
 COBJS-$(CONFIG_PMIC_SPI) += pmic_spi.o
 COBJS-$(CONFIG_PMIC_MAX8998) += pmic_max8998.o
+COBJS-$(CONFIG_PMIC_MAX8997) += pmic_max8997.o
 
 COBJS  := $(COBJS-y)
 SRCS   := $(COBJS:.o=.c)
diff --git a/drivers/misc/imx_iim.c b/drivers/misc/imx_iim.c
new file mode 100644 (file)
index 0000000..0438ec7
--- /dev/null
@@ -0,0 +1,318 @@
+/*
+ * (C) Copyright 2008-2010 Freescale Semiconductor, Inc.
+ * Terry Lv
+ *
+ * Copyright 2007, Freescale Semiconductor, Inc
+ * Andy Fleming
+ *
+ * Based vaguely on the pxa mmc code:
+ * (C) Copyright 2003
+ * Kyle Harris, Nexus Technologies, Inc. kharris@nexus-tech.net
+ *
+ * Adapted for U-Boot version 2012-04-01 by Lothar Waßmann <LW@KARO-electronics.de>
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+#include <common.h>
+#include <net.h>
+#include <linux/types.h>
+#include <asm/io.h>
+#include <asm/arch/imx-regs.h>
+#include <asm/arch/imx_iim.h>
+
+static struct iim_regs *imx_iim = (void *)IMX_IIM_BASE;
+
+/* slen - string length, e.g.: 23 -> slen=2; abcd -> slen=4 */
+/* only convert hex value as string input. so "12" is 0x12. */
+static u32 quick_atoi(char *a, u32 slen)
+{
+       u32 i, num = 0, digit;
+
+       for (i = 0; i < slen; i++) {
+               if (a[i] >= '0' && a[i] <= '9') {
+                       digit = a[i] - '0';
+               } else if (a[i] >= 'a' && a[i] <= 'f') {
+                       digit = a[i] - 'a' + 10;
+               } else if (a[i] >= 'A' && a[i] <= 'F') {
+                       digit = a[i] - 'A' + 10;
+               } else {
+                       printf("ERROR: %c\n", a[i]);
+                       return -1;
+               }
+               num = (num * 16) + digit;
+       }
+
+    return num;
+}
+
+static void fuse_op_start(void)
+{
+       /* Do not generate interrupt */
+       writel(0, &imx_iim->statm);
+       /* clear the status bits and error bits */
+       writel(0x3, &imx_iim->stat);
+       writel(0xfe, &imx_iim->err);
+}
+
+/*
+ * The action should be either:
+ *          POLL_FUSE_PRGD
+ * or:
+ *          POLL_FUSE_SNSD
+ */
+static s32 poll_fuse_op_done(s32 action)
+{
+       u32 status, error;
+
+       if (action != POLL_FUSE_PRGD && action != POLL_FUSE_SNSD) {
+               printf("%s(%d) invalid operation\n", __func__, action);
+               return -1;
+       }
+
+       /* Poll busy bit till it is NOT set */
+       while ((readl(&imx_iim->stat) & IIM_STAT_BUSY) != 0)
+               ;
+
+       /* Test for successful write */
+       status = readl(&imx_iim->stat);
+       error = readl(&imx_iim->err);
+
+       if ((status & action) != 0 && \
+                       (error & (action >> IIM_ERR_SHIFT)) == 0) {
+               if (error) {
+                       printf("Even though the operation"
+                               "seems successful...\n");
+                       printf("There are some error(s) "
+                               "at addr=%p: 0x%x\n",
+                               &imx_iim->err, error);
+               }
+               return 0;
+       }
+       printf("%s(%d) failed\n", __func__, action);
+       printf("status address=%p, value=0x%x\n",
+               &imx_iim->stat, status);
+       printf("There are some error(s) at addr=%p: 0x%x\n",
+               &imx_iim->err, error);
+       return -1;
+}
+
+static u32 sense_fuse(s32 bank, s32 row, s32 bit)
+{
+       s32 addr, addr_l, addr_h;
+       void *reg_addr;
+
+       fuse_op_start();
+
+       addr = ((bank << 11) | (row << 3) | (bit & 0x7));
+       /* Set IIM Program Upper Address */
+       addr_h = (addr >> 8) & 0x000000FF;
+       /* Set IIM Program Lower Address */
+       addr_l = (addr & 0x000000FF);
+
+#ifdef IIM_FUSE_DEBUG
+       printf("%s: addr_h=0x%x, addr_l=0x%x\n",
+                       __func__, addr_h, addr_l);
+#endif
+       writel(addr_h, &imx_iim->ua);
+       writel(addr_l, &imx_iim->la);
+
+       /* Start sensing */
+       writel(0x8, &imx_iim->fctl);
+       if (poll_fuse_op_done(POLL_FUSE_SNSD) != 0) {
+               printf("%s(bank: %d, row: %d, bit: %d failed\n",
+                       __func__, bank, row, bit);
+       }
+       reg_addr = &imx_iim->sdat;
+
+       return readl(reg_addr);
+}
+
+int iim_read(int bank, char row)
+{
+       u32 fuse_val;
+       s32 err = 0;
+
+       printf("Read fuse at bank:%d row:%d\n", bank, row);
+       fuse_val = sense_fuse(bank, row, 0);
+       printf("fuses at (bank:%d, row:%d) = 0x%x\n", bank, row, fuse_val);
+
+       return err;
+}
+
+/* Blow fuses based on the bank, row and bit positions (all 0-based)
+*/
+static s32 fuse_blow_bit(s32 bank, s32 row, s32 bit)
+{
+       int addr, addr_l, addr_h, ret = -1;
+
+       fuse_op_start();
+
+       /* Disable IIM Program Protect */
+       writel(0xaa, &imx_iim->preg_p);
+
+       addr = ((bank << 11) | (row << 3) | (bit & 0x7));
+       /* Set IIM Program Upper Address */
+       addr_h = (addr >> 8) & 0x000000FF;
+       /* Set IIM Program Lower Address */
+       addr_l = (addr & 0x000000FF);
+
+#ifdef IIM_FUSE_DEBUG
+       printf("blowing addr_h=0x%x, addr_l=0x%x\n", addr_h, addr_l);
+#endif
+
+       writel(addr_h, &imx_iim->ua);
+       writel(addr_l, &imx_iim->la);
+
+       /* Start Programming */
+       writel(0x31, &imx_iim->fctl);
+       if (poll_fuse_op_done(POLL_FUSE_PRGD) == 0)
+               ret = 0;
+
+       /* Enable IIM Program Protect */
+       writel(0x0, &imx_iim->preg_p);
+
+       return ret;
+}
+
+static void fuse_blow_row(s32 bank, s32 row, s32 value)
+{
+       u32 reg, i;
+
+       /* enable fuse blown */
+       reg = readl(CCM_BASE_ADDR + 0x64);
+       reg |= 0x10;
+       writel(reg, CCM_BASE_ADDR + 0x64);
+
+       for (i = 0; i < 8; i++) {
+               if (((value >> i) & 0x1) == 0)
+                       continue;
+       if (fuse_blow_bit(bank, row, i) != 0) {
+                       printf("fuse_blow_bit(bank: %d, row: %d, "
+                               "bit: %d failed\n",
+                               bank, row, i);
+               }
+    }
+    reg &= ~0x10;
+    writel(reg, CCM_BASE_ADDR + 0x64);
+}
+
+int iim_blow(int bank, int row, int val)
+{
+       u32 fuse_val, err = 0;
+
+       printf("Blowing fuse at bank:%d row:%d value:%d\n",
+                       bank, row, val);
+       fuse_blow_row(bank, row, val);
+       fuse_val = sense_fuse(bank, row, 0);
+       printf("fuses at (bank:%d, row:%d) = 0x%x\n", bank, row, fuse_val);
+
+       return err;
+}
+
+int iim_blow_func(char *func_name, char *func_val)
+{
+       u32 value, i;
+       char *s;
+       char val[3];
+       s32 err = 0;
+
+       if (strcmp(func_name, "scc") == 0) {
+               /* fuse_blow scc
+       C3D153EDFD2EA9982226EF5047D3B9A0B9C7138EA87C028401D28C2C2C0B9AA2 */
+               printf("Ready to burn SCC fuses\n");
+               s = func_val;
+               for (i = 0; ; ++i) {
+                       memcpy(val, s, 2);
+                       val[2] = '\0';
+                       value = quick_atoi(val, 2);
+                       /* printf("fuse_blow_row(2, %d, value=0x%x)\n",
+                                       i, value); */
+                       fuse_blow_row(2, i, value);
+
+                       if (*(++s) == '\0') {
+                               printf("ERROR: Odd string input\n");
+                               err = -1;
+                               break;
+                       }
+                       if (*(++s) == '\0') {
+                               printf("Successful\n");
+                               break;
+                       }
+               }
+       } else if (strcmp(func_name, "srk") == 0) {
+               /* fuse_blow srk
+       418bccd09b53bee1ab59e2662b3c7877bc0094caee201052add49be8780dff95 */
+               printf("Ready to burn SRK key fuses\n");
+               s = func_val;
+               for (i = 0; ; ++i) {
+                       memcpy(val, s, 2);
+                       val[2] = '\0';
+                       value = quick_atoi(val, 2);
+                       if (i == 0) {
+                               /* 0x41 goes to SRK_HASH[255:248],
+                                * bank 1, row 1 */
+                               fuse_blow_row(1, 1, value);
+                       } else {
+                               /* 0x8b in SRK_HASH[247:240] bank 3, row 1 */
+                               /* 0xcc in SRK_HASH[239:232] bank 3, row 2 */
+                               /* ... */
+                               fuse_blow_row(3, i, value);
+
+                               if (*(++s) == '\0') {
+                                       printf("ERROR: Odd string input\n");
+                                       err = -1;
+                                       break;
+                               }
+                               if (*(++s) == '\0') {
+                                       printf("Successful\n");
+                                       break;
+                               }
+                       }
+               }
+       } else if (strcmp(func_name, "fecmac") == 0) {
+               u8 ea[6] = { 0 };
+
+               if (func_val == NULL) {
+                       /* Read the Mac address and print it */
+                       imx_get_mac_from_fuse(0, ea);
+
+                       printf("FEC MAC address: ");
+                       printf("0x%02x:0x%02x:0x%02x:0x%02x:0x%02x:0x%02x\n\n",
+                               ea[0], ea[1], ea[2], ea[3], ea[4], ea[5]);
+
+                       return 0;
+               }
+
+               eth_parse_enetaddr(func_val, ea);
+               if (!is_valid_ether_addr(ea)) {
+                       printf("Error: invalid mac address parameter!\n");
+                       err = -1;
+               } else {
+                       for (i = 0; i < 6; ++i)
+                               fuse_blow_row(1, i + 9, ea[i]);
+               }
+       } else {
+               printf("This command is not supported\n");
+       }
+
+       return err;
+}
+
+
diff --git a/drivers/misc/pmic_dialog.c b/drivers/misc/pmic_dialog.c
new file mode 100644 (file)
index 0000000..e97af1d
--- /dev/null
@@ -0,0 +1,37 @@
+/*
+ *  Copyright (C) 2011 Samsung Electronics
+ *  Lukasz Majewski <l.majewski@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.
+ */
+
+#include <common.h>
+#include <pmic.h>
+#include <dialog_pmic.h>
+
+int pmic_dialog_init(void)
+{
+       struct pmic *p = get_pmic();
+       static const char name[] = "DIALOG_PMIC";
+
+       p->name = name;
+       p->number_of_regs = DIALOG_NUM_OF_REGS;
+
+       p->interface = PMIC_I2C;
+       p->hw.i2c.addr = CONFIG_SYS_DIALOG_PMIC_I2C_ADDR;
+       p->hw.i2c.tx_num = 1;
+       p->bus = I2C_PMIC;
+
+       return 0;
+}
diff --git a/drivers/misc/pmic_max8997.c b/drivers/misc/pmic_max8997.c
new file mode 100644 (file)
index 0000000..62dbc05
--- /dev/null
@@ -0,0 +1,43 @@
+/*
+ *  Copyright (C) 2012 Samsung Electronics
+ *  Lukasz Majewski <l.majewski@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 <pmic.h>
+#include <max8997_pmic.h>
+
+int pmic_init(void)
+{
+       struct pmic *p = get_pmic();
+       static const char name[] = "MAX8997_PMIC";
+
+       puts("Board PMIC init\n");
+
+       p->name = name;
+       p->interface = PMIC_I2C;
+       p->number_of_regs = PMIC_NUM_OF_REGS;
+       p->hw.i2c.addr = MAX8997_I2C_ADDR;
+       p->hw.i2c.tx_num = 1;
+       p->bus = I2C_PMIC;
+
+       return 0;
+}
index a2f35e3e99159dc0481737a0bb4d1f1e55fc0da6..db5278b64d13a4385a129054ecb01d1aa8996ac3 100644 (file)
@@ -115,57 +115,69 @@ static void
 esdhc_pio_read_write(struct mmc *mmc, struct mmc_data *data)
 {
        struct fsl_esdhc_cfg *cfg = mmc->priv;
-       struct fsl_esdhc *regs = (struct fsl_esdhc *)cfg->esdhc_base;
+       struct fsl_esdhc *regs = cfg->esdhc_base;
        uint blocks;
        char *buffer;
        uint databuf;
        uint size;
-       uint irqstat;
        uint timeout;
+       int wml = esdhc_read32(&regs->wml);
 
        if (data->flags & MMC_DATA_READ) {
+               wml &= WML_RD_WML_MASK;
                blocks = data->blocks;
                buffer = data->dest;
                while (blocks) {
                        timeout = PIO_TIMEOUT;
                        size = data->blocksize;
-                       irqstat = esdhc_read32(&regs->irqstat);
-                       while (!(esdhc_read32(&regs->prsstat) & PRSSTAT_BREN)
-                               && --timeout);
-                       if (timeout <= 0) {
-                               printf("\nData Read Failed in PIO Mode.");
-                               return;
-                       }
-                       while (size && (!(irqstat & IRQSTAT_TC))) {
-                               udelay(100); /* Wait before last byte transfer complete */
-                               irqstat = esdhc_read32(&regs->irqstat);
-                               databuf = in_le32(&regs->datport);
-                               *((uint *)buffer) = databuf;
-                               buffer += 4;
-                               size -= 4;
+                       while (size &&
+                               !(esdhc_read32(&regs->irqstat) & IRQSTAT_TC)) {
+                               int i;
+                               u32 prsstat;
+
+                               while (!((prsstat = esdhc_read32(&regs->prsstat)) &
+                                               PRSSTAT_BREN) && --timeout)
+                                       /* NOP */;
+                               if (!(prsstat & PRSSTAT_BREN)) {
+                                       printf("%s: Data Read Failed in PIO Mode\n",
+                                               __func__);
+                                       return;
+                               }
+                               for (i = 0; i < wml && size; i++) {
+                                       databuf = in_le32(&regs->datport);
+                                       memcpy(buffer, &databuf, sizeof(databuf));
+                                       buffer += 4;
+                                       size -= 4;
+                               }
                        }
                        blocks--;
                }
        } else {
+               wml = (wml & WML_WR_WML_MASK) >> 16;
                blocks = data->blocks;
-               buffer = (char *)data->src;
+               buffer = (char *)data->src; /* cast away 'const' */
                while (blocks) {
                        timeout = PIO_TIMEOUT;
                        size = data->blocksize;
-                       irqstat = esdhc_read32(&regs->irqstat);
-                       while (!(esdhc_read32(&regs->prsstat) & PRSSTAT_BWEN)
-                               && --timeout);
-                       if (timeout <= 0) {
-                               printf("\nData Write Failed in PIO Mode.");
-                               return;
-                       }
-                       while (size && (!(irqstat & IRQSTAT_TC))) {
-                               udelay(100); /* Wait before last byte transfer complete */
-                               databuf = *((uint *)buffer);
-                               buffer += 4;
-                               size -= 4;
-                               irqstat = esdhc_read32(&regs->irqstat);
-                               out_le32(&regs->datport, databuf);
+                       while (size &&
+                               !(esdhc_read32(&regs->irqstat) & IRQSTAT_TC)) {
+                               int i;
+                               u32 prsstat;
+
+                               while (!((prsstat = esdhc_read32(&regs->prsstat)) &
+                                               PRSSTAT_BWEN) && --timeout)
+                                       /* NOP */;
+                               if (!(prsstat & PRSSTAT_BWEN)) {
+                                       printf("%s: Data Write Failed in PIO Mode\n",
+                                               __func__);
+                                       return;
+                               }
+                               for (i = 0; i < wml && size; i++) {
+                                       memcpy(&databuf, buffer, sizeof(databuf));
+                                       out_le32(&regs->datport, databuf);
+                                       buffer += 4;
+                                       size -= 4;
+                               }
                        }
                        blocks--;
                }
@@ -176,8 +188,8 @@ esdhc_pio_read_write(struct mmc *mmc, struct mmc_data *data)
 static int esdhc_setup_data(struct mmc *mmc, struct mmc_data *data)
 {
        int timeout;
-       struct fsl_esdhc_cfg *cfg = (struct fsl_esdhc_cfg *)mmc->priv;
-       struct fsl_esdhc *regs = (struct fsl_esdhc *)cfg->esdhc_base;
+       struct fsl_esdhc_cfg *cfg = mmc->priv;
+       struct fsl_esdhc *regs = cfg->esdhc_base;
 #ifndef CONFIG_SYS_FSL_ESDHC_USE_PIO
        uint wml_value;
 
@@ -197,6 +209,8 @@ static int esdhc_setup_data(struct mmc *mmc, struct mmc_data *data)
                        return TIMEOUT;
                }
 
+               flush_dcache_range((unsigned long)data->src,
+                               (unsigned long)data->src + data->blocks * data->blocksize);
                esdhc_clrsetbits32(&regs->wml, WML_WR_WML_MASK,
                                        wml_value << 16);
                esdhc_write32(&regs->dsaddr, (u32)data->src);
@@ -209,8 +223,9 @@ static int esdhc_setup_data(struct mmc *mmc, struct mmc_data *data)
                        return TIMEOUT;
                }
                esdhc_write32(&regs->dsaddr, (u32)data->src);
-       } else
+       } else {
                esdhc_write32(&regs->dsaddr, (u32)data->dest);
+       }
 #endif /* CONFIG_SYS_FSL_ESDHC_USE_PIO */
 
        esdhc_write32(&regs->blkattr, data->blocks << 16 | data->blocksize);
@@ -259,8 +274,8 @@ esdhc_send_cmd(struct mmc *mmc, struct mmc_cmd *cmd, struct mmc_data *data)
 {
        uint    xfertyp;
        uint    irqstat;
-       struct fsl_esdhc_cfg *cfg = (struct fsl_esdhc_cfg *)mmc->priv;
-       volatile struct fsl_esdhc *regs = (struct fsl_esdhc *)cfg->esdhc_base;
+       struct fsl_esdhc_cfg *cfg = mmc->priv;
+       volatile struct fsl_esdhc *regs = cfg->esdhc_base;
 
 #ifdef CONFIG_SYS_FSL_ERRATUM_ESDHC111
        if (cmd->cmdidx == MMC_CMD_STOP_TRANSMISSION)
@@ -291,7 +306,7 @@ esdhc_send_cmd(struct mmc *mmc, struct mmc_cmd *cmd, struct mmc_data *data)
                int err;
 
                err = esdhc_setup_data(mmc, data);
-               if(err)
+               if (err)
                        return err;
        }
 
@@ -350,6 +365,8 @@ esdhc_send_cmd(struct mmc *mmc, struct mmc_cmd *cmd, struct mmc_data *data)
                                return COMM_ERR;
                } while (!(irqstat & IRQSTAT_TC) &&
                                (esdhc_read32(&regs->prsstat) & PRSSTAT_DLA));
+               invalidate_dcache_range((unsigned long)data->dest,
+                       (unsigned long)data->dest + data->blocks * data->blocksize);
 #endif
        }
 
@@ -362,8 +379,8 @@ void set_sysctl(struct mmc *mmc, uint clock)
 {
        int sdhc_clk = gd->sdhc_clk;
        int div, pre_div;
-       struct fsl_esdhc_cfg *cfg = (struct fsl_esdhc_cfg *)mmc->priv;
-       volatile struct fsl_esdhc *regs = (struct fsl_esdhc *)cfg->esdhc_base;
+       struct fsl_esdhc_cfg *cfg = mmc->priv;
+       volatile struct fsl_esdhc *regs = cfg->esdhc_base;
        uint clk;
 
        if (clock < mmc->f_min)
@@ -398,8 +415,8 @@ void set_sysctl(struct mmc *mmc, uint clock)
 
 static void esdhc_set_ios(struct mmc *mmc)
 {
-       struct fsl_esdhc_cfg *cfg = (struct fsl_esdhc_cfg *)mmc->priv;
-       struct fsl_esdhc *regs = (struct fsl_esdhc *)cfg->esdhc_base;
+       struct fsl_esdhc_cfg *cfg = mmc->priv;
+       struct fsl_esdhc *regs = cfg->esdhc_base;
 
        /* Set the clock speed */
        set_sysctl(mmc, mmc->clock);
@@ -416,8 +433,8 @@ static void esdhc_set_ios(struct mmc *mmc)
 
 static int esdhc_init(struct mmc *mmc)
 {
-       struct fsl_esdhc_cfg *cfg = (struct fsl_esdhc_cfg *)mmc->priv;
-       struct fsl_esdhc *regs = (struct fsl_esdhc *)cfg->esdhc_base;
+       struct fsl_esdhc_cfg *cfg = mmc->priv;
+       struct fsl_esdhc *regs = cfg->esdhc_base;
        int timeout = 1000;
 
        /* Reset the entire host controller */
@@ -450,8 +467,8 @@ static int esdhc_init(struct mmc *mmc)
 
 static int esdhc_getcd(struct mmc *mmc)
 {
-       struct fsl_esdhc_cfg *cfg = (struct fsl_esdhc_cfg *)mmc->priv;
-       struct fsl_esdhc *regs = (struct fsl_esdhc *)cfg->esdhc_base;
+       struct fsl_esdhc_cfg *cfg = mmc->priv;
+       struct fsl_esdhc *regs = cfg->esdhc_base;
        int timeout = 1000;
 
        while (!(esdhc_read32(&regs->prsstat) & PRSSTAT_CINS) && --timeout)
@@ -483,10 +500,10 @@ int fsl_esdhc_initialize(bd_t *bis, struct fsl_esdhc_cfg *cfg)
        if (!cfg)
                return -1;
 
-       mmc = malloc(sizeof(struct mmc));
+       mmc = kzalloc(sizeof(struct mmc), GFP_KERNEL);
 
        sprintf(mmc->name, "FSL_SDHC");
-       regs = (struct fsl_esdhc *)cfg->esdhc_base;
+       regs = cfg->esdhc_base;
 
        /* First reset the eSDHC controller */
        esdhc_reset(regs);
@@ -539,9 +556,9 @@ int fsl_esdhc_mmc_init(bd_t *bis)
 {
        struct fsl_esdhc_cfg *cfg;
 
-       cfg = malloc(sizeof(struct fsl_esdhc_cfg));
-       memset(cfg, 0, sizeof(struct fsl_esdhc_cfg));
-       cfg->esdhc_base = CONFIG_SYS_FSL_ESDHC_ADDR;
+       cfg = kzalloc(sizeof(struct fsl_esdhc_cfg), GFP_KERNEL);
+
+       cfg->esdhc_base = (void __iomem *)CONFIG_SYS_FSL_ESDHC_ADDR;
        return fsl_esdhc_initialize(bis, cfg);
 }
 
diff --git a/drivers/mmc/imx_ssp_mmc.c b/drivers/mmc/imx_ssp_mmc.c
new file mode 100644 (file)
index 0000000..fc480a5
--- /dev/null
@@ -0,0 +1,385 @@
+/*
+ * (C) Copyright 2008-2010 Freescale Semiconductor, Inc.
+ * Terry Lv
+ *
+ * Copyright 2007, Freescale Semiconductor, Inc
+ * Andy Fleming
+ *
+ * Based vaguely on the pxa mmc code:
+ * (C) Copyright 2003
+ * Kyle Harris, Nexus Technologies, Inc. kharris@nexus-tech.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 <common.h>
+#include <malloc.h>
+#include <mmc.h>
+#include <asm/arch/regs-ssp.h>
+#include <asm/arch/regs-clkctrl.h>
+#include <imx_ssp_mmc.h>
+
+#undef IMX_SSP_MMC_DEBUG
+
+static inline int ssp_mmc_read(struct mmc *mmc, uint reg)
+{
+       struct imx_ssp_mmc_cfg *cfg = (struct imx_ssp_mmc_cfg *)mmc->priv;
+       return REG_RD(cfg->ssp_mmc_base, reg);
+}
+
+static inline void ssp_mmc_write(struct mmc *mmc, uint reg, uint val)
+{
+       struct imx_ssp_mmc_cfg *cfg = (struct imx_ssp_mmc_cfg *)mmc->priv;
+       REG_WR(cfg->ssp_mmc_base, reg, val);
+}
+
+static inline void mdelay(unsigned long msec)
+{
+       unsigned long i;
+       for (i = 0; i < msec; i++)
+               udelay(1000);
+}
+
+static inline void sdelay(unsigned long sec)
+{
+       unsigned long i;
+       for (i = 0; i < sec; i++)
+               mdelay(1000);
+}
+
+/*
+ * Sends a command out on the bus.  Takes the mmc pointer,
+ * a command pointer, and an optional data pointer.
+ */
+static int
+ssp_mmc_send_cmd(struct mmc *mmc, struct mmc_cmd *cmd, struct mmc_data *data)
+{
+       int i;
+
+#ifdef IMX_SSP_MMC_DEBUG
+       printf("MMC%d: CMD%d\n", mmc->block_dev.dev, cmd->cmdidx);
+#endif
+
+       /* Check bus busy */
+       i = 0;
+       while (ssp_mmc_read(mmc, HW_SSP_STATUS) & (BM_SSP_STATUS_BUSY |
+               BM_SSP_STATUS_DATA_BUSY | BM_SSP_STATUS_CMD_BUSY)) {
+               mdelay(1);
+               i++;
+               if (i == 1000) {
+                       printf("MMC%d: Bus busy timeout!\n",
+                               mmc->block_dev.dev);
+                       return TIMEOUT;
+               }
+       }
+
+       /* See if card is present */
+       if (ssp_mmc_read(mmc, HW_SSP_STATUS) & BM_SSP_STATUS_CARD_DETECT) {
+               printf("MMC%d: No card detected!\n", mmc->block_dev.dev);
+               return NO_CARD_ERR;
+       }
+
+       /* Clear all control bits except bus width */
+       ssp_mmc_write(mmc, HW_SSP_CTRL0_CLR, 0xff3fffff);
+
+       /* Set up command */
+       if (!(cmd->resp_type & MMC_RSP_CRC))
+               ssp_mmc_write(mmc, HW_SSP_CTRL0_SET, BM_SSP_CTRL0_IGNORE_CRC);
+       if (cmd->resp_type & MMC_RSP_PRESENT)   /* Need to get response */
+               ssp_mmc_write(mmc, HW_SSP_CTRL0_SET, BM_SSP_CTRL0_GET_RESP);
+       if (cmd->resp_type & MMC_RSP_136)       /* It's a 136 bits response */
+               ssp_mmc_write(mmc, HW_SSP_CTRL0_SET, BM_SSP_CTRL0_LONG_RESP);
+
+       /* Command index */
+       ssp_mmc_write(mmc, HW_SSP_CMD0,
+               (ssp_mmc_read(mmc, HW_SSP_CMD0) & ~BM_SSP_CMD0_CMD) |
+               (cmd->cmdidx << BP_SSP_CMD0_CMD));
+       /* Command argument */
+       ssp_mmc_write(mmc, HW_SSP_CMD1, cmd->cmdarg);
+
+       /* Set up data */
+       if (data) {
+               /* READ or WRITE */
+               if (data->flags & MMC_DATA_READ) {
+                       ssp_mmc_write(mmc, HW_SSP_CTRL0_SET,
+                               BM_SSP_CTRL0_READ);
+               } else if (ssp_mmc_is_wp(mmc)) {
+                       printf("MMC%d: Can not write a locked card!\n",
+                               mmc->block_dev.dev);
+                       return UNUSABLE_ERR;
+               }
+               ssp_mmc_write(mmc, HW_SSP_CTRL0_SET, BM_SSP_CTRL0_DATA_XFER);
+               ssp_mmc_write(mmc, HW_SSP_BLOCK_SIZE,
+                       ((data->blocks - 1) <<
+                               BP_SSP_BLOCK_SIZE_BLOCK_COUNT) |
+                       ((ffs(data->blocksize) - 1) <<
+                               BP_SSP_BLOCK_SIZE_BLOCK_SIZE));
+               ssp_mmc_write(mmc, HW_SSP_XFER_SIZE,
+                       data->blocksize * data->blocks);
+       }
+
+       /* Kick off the command */
+       ssp_mmc_write(mmc, HW_SSP_CTRL0_SET, BM_SSP_CTRL0_WAIT_FOR_IRQ);
+       ssp_mmc_write(mmc, HW_SSP_CTRL0_SET, BM_SSP_CTRL0_ENABLE);
+       ssp_mmc_write(mmc, HW_SSP_CTRL0_SET, BM_SSP_CTRL0_RUN);
+
+       /* Wait for the command to complete */
+       i = 0;
+       do {
+               mdelay(10);
+               if (i++ == 100) {
+                       printf("MMC%d: Command %d busy\n",
+                               mmc->block_dev.dev,
+                               cmd->cmdidx);
+                       break;
+               }
+       } while (ssp_mmc_read(mmc, HW_SSP_STATUS) &
+               BM_SSP_STATUS_CMD_BUSY);
+
+       /* Check command timeout */
+       if (ssp_mmc_read(mmc, HW_SSP_STATUS) &
+               BM_SSP_STATUS_RESP_TIMEOUT) {
+#ifdef IMX_SSP_MMC_DEBUG
+               printf("MMC%d: Command %d timeout\n", mmc->block_dev.dev,
+                       cmd->cmdidx);
+#endif
+               return TIMEOUT;
+       }
+
+       /* Check command errors */
+       if (ssp_mmc_read(mmc, HW_SSP_STATUS) &
+               (BM_SSP_STATUS_RESP_CRC_ERR | BM_SSP_STATUS_RESP_ERR)) {
+               printf("MMC%d: Command %d error (status 0x%08x)!\n",
+                       mmc->block_dev.dev, cmd->cmdidx,
+                       ssp_mmc_read(mmc, HW_SSP_STATUS));
+               return COMM_ERR;
+       }
+
+       /* Copy response to response buffer */
+       if (cmd->resp_type & MMC_RSP_136) {
+               cmd->response[3] = ssp_mmc_read(mmc, HW_SSP_SDRESP0);
+               cmd->response[2] = ssp_mmc_read(mmc, HW_SSP_SDRESP1);
+               cmd->response[1] = ssp_mmc_read(mmc, HW_SSP_SDRESP2);
+               cmd->response[0] = ssp_mmc_read(mmc, HW_SSP_SDRESP3);
+       } else
+               cmd->response[0] = ssp_mmc_read(mmc, HW_SSP_SDRESP0);
+
+       /* Return if no data to process */
+       if (!data)
+               return 0;
+
+       /* Process the data */
+       u32 xfer_cnt = data->blocksize * data->blocks;
+       u32 *tmp_ptr;
+
+       if (data->flags & MMC_DATA_READ) {
+               tmp_ptr = (u32 *)data->dest;
+               while (xfer_cnt > 0) {
+                       if ((ssp_mmc_read(mmc, HW_SSP_STATUS) &
+                               BM_SSP_STATUS_FIFO_EMPTY) == 0) {
+                               *tmp_ptr++ = ssp_mmc_read(mmc, HW_SSP_DATA);
+                               xfer_cnt -= 4;
+                       }
+               }
+       } else {
+               tmp_ptr = (u32 *)data->src;
+               while (xfer_cnt > 0) {
+                       if ((ssp_mmc_read(mmc, HW_SSP_STATUS) &
+                               BM_SSP_STATUS_FIFO_FULL) == 0) {
+                               ssp_mmc_write(mmc, HW_SSP_DATA, *tmp_ptr++);
+                               xfer_cnt -= 4;
+                       }
+               }
+       }
+
+       /* Check data errors */
+       if (ssp_mmc_read(mmc, HW_SSP_STATUS) &
+               (BM_SSP_STATUS_TIMEOUT | BM_SSP_STATUS_DATA_CRC_ERR |
+               BM_SSP_STATUS_FIFO_OVRFLW | BM_SSP_STATUS_FIFO_UNDRFLW)) {
+               printf("MMC%d: Data error with command %d (status 0x%08x)!\n",
+                       mmc->block_dev.dev, cmd->cmdidx,
+                       ssp_mmc_read(mmc, HW_SSP_STATUS));
+               return COMM_ERR;
+       }
+
+       return 0;
+}
+
+static void set_bit_clock(struct mmc *mmc, u32 clock)
+{
+       const u32 sspclk = 480000 * 18 / 29 / 1;        /* 297931 KHz */
+       u32 divide, rate, tgtclk;
+
+       /*
+        * SSP bit rate = SSPCLK / (CLOCK_DIVIDE * (1 + CLOCK_RATE)),
+        * CLOCK_DIVIDE has to be an even value from 2 to 254, and
+        * CLOCK_RATE could be any integer from 0 to 255.
+        */
+       clock /= 1000;          /* KHz */
+       for (divide = 2; divide < 254; divide += 2) {
+               rate = sspclk / clock / divide;
+               if (rate <= 256)
+                       break;
+       }
+
+       tgtclk = sspclk / divide / rate;
+       while (tgtclk > clock) {
+               rate++;
+               tgtclk = sspclk / divide / rate;
+       }
+       if (rate > 256)
+               rate = 256;
+
+       /* Always set timeout the maximum */
+       ssp_mmc_write(mmc, HW_SSP_TIMING, BM_SSP_TIMING_TIMEOUT |
+               divide << BP_SSP_TIMING_CLOCK_DIVIDE |
+               (rate - 1) << BP_SSP_TIMING_CLOCK_RATE);
+
+#ifdef IMX_SSP_MMC_DEBUG
+       printf("MMC%d: Set clock rate to %d KHz (requested %d KHz)\n",
+               mmc->block_dev.dev, tgtclk, clock);
+#endif
+}
+
+static void ssp_mmc_set_ios(struct mmc *mmc)
+{
+       u32 regval;
+
+       /* Set the clock speed */
+       if (mmc->clock)
+               set_bit_clock(mmc, mmc->clock);
+
+       /* Set the bus width */
+       regval = ssp_mmc_read(mmc, HW_SSP_CTRL0);
+       regval &= ~BM_SSP_CTRL0_BUS_WIDTH;
+       switch (mmc->bus_width) {
+       case 1:
+               regval |= (BV_SSP_CTRL0_BUS_WIDTH__ONE_BIT <<
+                               BP_SSP_CTRL0_BUS_WIDTH);
+               break;
+       case 4:
+               regval |= (BV_SSP_CTRL0_BUS_WIDTH__FOUR_BIT <<
+                               BP_SSP_CTRL0_BUS_WIDTH);
+               break;
+       case 8:
+               regval |= (BV_SSP_CTRL0_BUS_WIDTH__EIGHT_BIT <<
+                               BP_SSP_CTRL0_BUS_WIDTH);
+       }
+       ssp_mmc_write(mmc, HW_SSP_CTRL0, regval);
+
+#ifdef IMX_SSP_MMC_DEBUG
+       printf("MMC%d: Set %d bits bus width\n",
+               mmc->block_dev.dev, mmc->bus_width);
+#endif
+}
+
+static int ssp_mmc_init(struct mmc *mmc)
+{
+       struct imx_ssp_mmc_cfg *cfg = (struct imx_ssp_mmc_cfg *)mmc->priv;
+       u32 regval;
+
+       /*
+        * Set up SSPCLK
+        */
+       /* Set REF_IO0 at 297.731 MHz */
+       regval = REG_RD(REGS_CLKCTRL_BASE, HW_CLKCTRL_FRAC0);
+       regval &= ~BM_CLKCTRL_FRAC0_IO0FRAC;
+       REG_WR(REGS_CLKCTRL_BASE, HW_CLKCTRL_FRAC0,
+               regval | (29 << BP_CLKCTRL_FRAC0_IO0FRAC));
+       /* Enable REF_IO0 */
+       REG_CLR(REGS_CLKCTRL_BASE, HW_CLKCTRL_FRAC0,
+               BM_CLKCTRL_FRAC0_CLKGATEIO0);
+
+       /* Source SSPCLK from REF_IO0 */
+       REG_CLR(REGS_CLKCTRL_BASE, HW_CLKCTRL_CLKSEQ,
+               cfg->clkctrl_clkseq_ssp_offset);
+       /* Turn on SSPCLK */
+       REG_WR(REGS_CLKCTRL_BASE, cfg->clkctrl_ssp_offset,
+               REG_RD(REGS_CLKCTRL_BASE, cfg->clkctrl_ssp_offset) &
+               ~BM_CLKCTRL_SSP_CLKGATE);
+       /* Set SSPCLK divide 1 */
+       regval = REG_RD(REGS_CLKCTRL_BASE, cfg->clkctrl_ssp_offset);
+       regval &= ~(BM_CLKCTRL_SSP_DIV_FRAC_EN | BM_CLKCTRL_SSP_DIV);
+       REG_WR(REGS_CLKCTRL_BASE, cfg->clkctrl_ssp_offset,
+               regval | (1 << BP_CLKCTRL_SSP_DIV));
+       /* Wait for new divide ready */
+       do {
+               udelay(10);
+       } while (REG_RD(REGS_CLKCTRL_BASE, cfg->clkctrl_ssp_offset) &
+               BM_CLKCTRL_SSP_BUSY);
+
+       /* Prepare for software reset */
+       ssp_mmc_write(mmc, HW_SSP_CTRL0_CLR, BM_SSP_CTRL0_SFTRST);
+       ssp_mmc_write(mmc, HW_SSP_CTRL0_CLR, BM_SSP_CTRL0_CLKGATE);
+       /* Assert reset */
+       ssp_mmc_write(mmc, HW_SSP_CTRL0_SET, BM_SSP_CTRL0_SFTRST);
+       /* Wait for confirmation */
+       while (!(ssp_mmc_read(mmc, HW_SSP_CTRL0) & BM_SSP_CTRL0_CLKGATE))
+               ;
+       /* Done */
+       ssp_mmc_write(mmc, HW_SSP_CTRL0_CLR, BM_SSP_CTRL0_SFTRST);
+       ssp_mmc_write(mmc, HW_SSP_CTRL0_CLR, BM_SSP_CTRL0_CLKGATE);
+
+       /* 8 bits word length in MMC mode */
+       regval = ssp_mmc_read(mmc, HW_SSP_CTRL1);
+       regval &= ~(BM_SSP_CTRL1_SSP_MODE | BM_SSP_CTRL1_WORD_LENGTH);
+       ssp_mmc_write(mmc, HW_SSP_CTRL1, regval |
+               (BV_SSP_CTRL1_SSP_MODE__SD_MMC << BP_SSP_CTRL1_SSP_MODE) |
+               (BV_SSP_CTRL1_WORD_LENGTH__EIGHT_BITS <<
+                       BP_SSP_CTRL1_WORD_LENGTH));
+
+       /* Set initial bit clock 400 KHz */
+       set_bit_clock(mmc, 400000);
+
+       /* Send initial 74 clock cycles (185 us @ 400 KHz)*/
+       ssp_mmc_write(mmc, HW_SSP_CMD0_SET, BM_SSP_CMD0_CONT_CLKING_EN);
+       udelay(200);
+       ssp_mmc_write(mmc, HW_SSP_CMD0_CLR, BM_SSP_CMD0_CONT_CLKING_EN);
+
+       return 0;
+}
+
+int imx_ssp_mmc_initialize(bd_t *bis, struct imx_ssp_mmc_cfg *cfg)
+{
+       struct mmc *mmc;
+
+       mmc = malloc(sizeof(struct mmc));
+       sprintf(mmc->name, "IMX_SSP_MMC");
+       mmc->send_cmd = ssp_mmc_send_cmd;
+       mmc->set_ios = ssp_mmc_set_ios;
+       mmc->init = ssp_mmc_init;
+       mmc->priv = cfg;
+
+       mmc->voltages = MMC_VDD_32_33 | MMC_VDD_31_32 | MMC_VDD_30_31 |
+                       MMC_VDD_29_30 | MMC_VDD_28_29 | MMC_VDD_27_28;
+
+       mmc->host_caps = MMC_MODE_4BIT | MMC_MODE_8BIT |
+                        MMC_MODE_HS_52MHz | MMC_MODE_HS;
+
+       /*
+        * SSPCLK = 480 * 18 / 29 / 1 = 297.731 MHz
+        * SSP bit rate = SSPCLK / (CLOCK_DIVIDE * (1 + CLOCK_RATE)),
+        * CLOCK_DIVIDE has to be an even value from 2 to 254, and
+        * CLOCK_RATE could be any integer from 0 to 255.
+        */
+       mmc->f_min = 400000;
+       mmc->f_max = 148000000; /* 297.731 MHz / 2 */
+
+       mmc_register(mmc);
+       return 0;
+}
index 35c6bdabb06d4b71e8cf46263aa22c2cbf0301ec..7f643d4b31e1b99eca8137d219ceb403fa63cf73 100644 (file)
@@ -75,6 +75,8 @@ mxsmmc_send_cmd(struct mmc *mmc, struct mmc_cmd *cmd, struct mmc_data *data)
        int timeout;
        uint32_t data_count;
        uint32_t ctrl0;
+       const uint32_t busy_stat = SSP_STATUS_BUSY | SSP_STATUS_DATA_BUSY |
+               SSP_STATUS_CMD_BUSY;
 #ifndef CONFIG_MXS_MMC_DMA
        uint32_t *data_ptr;
 #else
@@ -85,17 +87,12 @@ mxsmmc_send_cmd(struct mmc *mmc, struct mmc_cmd *cmd, struct mmc_data *data)
 
        /* Check bus busy */
        timeout = MXSMMC_MAX_TIMEOUT;
-       while (--timeout) {
-               udelay(1000);
-               reg = readl(&ssp_regs->hw_ssp_status);
-               if (!(reg &
-                       (SSP_STATUS_BUSY | SSP_STATUS_DATA_BUSY |
-                       SSP_STATUS_CMD_BUSY))) {
+       while ((reg = readl(&ssp_regs->hw_ssp_status)) & busy_stat) {
+               if (timeout-- <= 0)
                        break;
-               }
+               udelay(1000);
        }
-
-       if (!timeout) {
+       if (reg & busy_stat && readl(&ssp_regs->hw_ssp_status) & busy_stat) {
                printf("MMC%d: Bus busy timeout!\n", mmc->block_dev.dev);
                return TIMEOUT;
        }
@@ -133,7 +130,8 @@ mxsmmc_send_cmd(struct mmc *mmc, struct mmc_cmd *cmd, struct mmc_data *data)
                /* READ or WRITE */
                if (data->flags & MMC_DATA_READ) {
                        ctrl0 |= SSP_CTRL0_READ;
-               } else if (priv->mmc_is_wp(mmc->block_dev.dev)) {
+               } else if (priv->mmc_is_wp &&
+                       priv->mmc_is_wp(mmc->block_dev.dev)) {
                        printf("MMC%d: Can not write a locked card!\n",
                                mmc->block_dev.dev);
                        return UNUSABLE_ERR;
@@ -162,8 +160,8 @@ mxsmmc_send_cmd(struct mmc *mmc, struct mmc_cmd *cmd, struct mmc_data *data)
                if (!(reg & SSP_STATUS_CMD_BUSY))
                        break;
        }
-
-       if (!timeout) {
+       if ((reg & SSP_STATUS_CMD_BUSY) &&
+               (readl(&ssp_regs->hw_ssp_status) & SSP_STATUS_CMD_BUSY)) {
                printf("MMC%d: Command %d busy\n",
                        mmc->block_dev.dev, cmd->cmdidx);
                return TIMEOUT;
@@ -197,7 +195,7 @@ mxsmmc_send_cmd(struct mmc *mmc, struct mmc_cmd *cmd, struct mmc_data *data)
                return 0;
 
        data_count = data->blocksize * data->blocks;
-       timeout = MXSMMC_MAX_TIMEOUT;
+       timeout = get_timer(0);
 
 #ifdef CONFIG_MXS_MMC_DMA
        if (data_count % ARCH_DMA_MINALIGN)
@@ -235,30 +233,33 @@ mxsmmc_send_cmd(struct mmc *mmc, struct mmc_cmd *cmd, struct mmc_data *data)
 #else
        if (data->flags & MMC_DATA_READ) {
                data_ptr = (uint32_t *)data->dest;
-               while (data_count && --timeout) {
+               while (data_count) {
                        reg = readl(&ssp_regs->hw_ssp_status);
                        if (!(reg & SSP_STATUS_FIFO_EMPTY)) {
                                *data_ptr++ = readl(&ssp_regs->hw_ssp_data);
                                data_count -= 4;
-                               timeout = MXSMMC_MAX_TIMEOUT;
-                       } else
-                               udelay(1000);
+                               timeout = get_timer(0);
+                       } else if ((get_timer(timeout) > MXSMMC_MAX_TIMEOUT) &&
+                               (readl(&ssp_regs->hw_ssp_status) & SSP_STATUS_FIFO_EMPTY)) {
+                               break;
+                       }
                }
        } else {
                data_ptr = (uint32_t *)data->src;
-               timeout *= 100;
-               while (data_count && --timeout) {
+               while (data_count) {
                        reg = readl(&ssp_regs->hw_ssp_status);
                        if (!(reg & SSP_STATUS_FIFO_FULL)) {
                                writel(*data_ptr++, &ssp_regs->hw_ssp_data);
                                data_count -= 4;
-                               timeout = MXSMMC_MAX_TIMEOUT;
-                       } else
-                               udelay(1000);
+                               timeout = get_timer(0);
+                       } else if ((get_timer(timeout) > MXSMMC_MAX_TIMEOUT * 100) &&
+                               (readl(&ssp_regs->hw_ssp_status) & SSP_STATUS_FIFO_FULL)) {
+                                       break;
+                       }
                }
        }
 
-       if (!timeout) {
+       if (data_count) {
                printf("MMC%d: Data timeout with command %d (status 0x%08x)!\n",
                        mmc->block_dev.dev, cmd->cmdidx, reg);
                return COMM_ERR;
@@ -340,11 +341,11 @@ int mxsmmc_initialize(bd_t *bis, int id, int (*wp)(int))
        struct mxsmmc_priv *priv = NULL;
        int ret;
 
-       mmc = malloc(sizeof(struct mmc));
+       mmc = calloc(sizeof(struct mmc), 1);
        if (!mmc)
                return -ENOMEM;
 
-       priv = malloc(sizeof(struct mxsmmc_priv));
+       priv = calloc(sizeof(struct mxsmmc_priv), 1);
        if (!priv) {
                free(mmc);
                return -ENOMEM;
@@ -398,12 +399,6 @@ int mxsmmc_initialize(bd_t *bis, int id, int (*wp)(int))
        mmc->host_caps = MMC_MODE_4BIT | MMC_MODE_8BIT |
                         MMC_MODE_HS_52MHz | MMC_MODE_HS;
 
-       /*
-        * SSPCLK = 480 * 18 / 29 / 1 = 297.731 MHz
-        * SSP bit rate = SSPCLK / (CLOCK_DIVIDE * (1 + CLOCK_RATE)),
-        * CLOCK_DIVIDE has to be an even value from 2 to 254, and
-        * CLOCK_RATE could be any integer from 0 to 255.
-        */
        mmc->f_min = 400000;
        mmc->f_max = mxc_get_clock(MXC_SSP0_CLK + id) * 1000 / 2;
        mmc->b_max = 0x40;
index f421ff9eede0f3e4dba687434ca96608ae4c333d..14e6a18ba160e26a7070296a500828ccda0ed5a4 100644 (file)
@@ -29,6 +29,7 @@
 #include <i2c.h>
 #include <twl4030.h>
 #include <twl6030.h>
+#include <twl6035.h>
 #include <asm/io.h>
 #include <asm/arch/mmc_host_def.h>
 #include <asm/arch/sys_proto.h>
@@ -60,6 +61,34 @@ static void omap4_vmmc_pbias_config(struct mmc *mmc)
 }
 #endif
 
+#if defined(CONFIG_OMAP54XX) && defined(CONFIG_TWL6035_POWER)
+static void omap5_pbias_config(struct mmc *mmc)
+{
+       u32 value = 0;
+       struct omap_sys_ctrl_regs *const ctrl =
+               (struct omap_sys_ctrl_regs *) SYSCTRL_GENERAL_CORE_BASE;
+
+       value = readl(&ctrl->control_pbias);
+       value &= ~(SDCARD_PWRDNZ | SDCARD_BIAS_PWRDNZ);
+       value |= SDCARD_BIAS_HIZ_MODE;
+       writel(value, &ctrl->control_pbias);
+
+       twl6035_mmc1_poweron_ldo();
+
+       value = readl(&ctrl->control_pbias);
+       value &= ~SDCARD_BIAS_HIZ_MODE;
+       value |= SDCARD_PBIASLITE_VMODE | SDCARD_PWRDNZ | SDCARD_BIAS_PWRDNZ;
+       writel(value, &ctrl->control_pbias);
+
+       value = readl(&ctrl->control_pbias);
+       if (value & (1 << 23)) {
+               value &= ~(SDCARD_PWRDNZ | SDCARD_BIAS_PWRDNZ);
+               value |= SDCARD_BIAS_HIZ_MODE;
+               writel(value, &ctrl->control_pbias);
+       }
+}
+#endif
+
 unsigned char mmc_board_init(struct mmc *mmc)
 {
 #if defined(CONFIG_TWL4030_POWER)
@@ -99,6 +128,10 @@ unsigned char mmc_board_init(struct mmc *mmc)
        if (mmc->block_dev.dev == 0)
                omap4_vmmc_pbias_config(mmc);
 #endif
+#if defined(CONFIG_OMAP54XX) && defined(CONFIG_TWL6035_POWER)
+       if (mmc->block_dev.dev == 0)
+               omap5_pbias_config(mmc);
+#endif
 
        return 0;
 }
@@ -112,8 +145,8 @@ void mmc_init_stream(struct hsmmc *mmc_base)
        writel(MMC_CMD0, &mmc_base->cmd);
        start = get_timer(0);
        while (!(readl(&mmc_base->stat) & CC_MASK)) {
-               if (get_timer(0) - start > MAX_RETRY_MS) {
-                       printf("%s: timedout waiting for cc!\n", __func__);
+               if (get_timer(start) > MAX_RETRY_MS) {
+                       printf("%s: timeout waiting for cc!\n", __func__);
                        return;
                }
        }
@@ -123,8 +156,8 @@ void mmc_init_stream(struct hsmmc *mmc_base)
                ;
        start = get_timer(0);
        while (!(readl(&mmc_base->stat) & CC_MASK)) {
-               if (get_timer(0) - start > MAX_RETRY_MS) {
-                       printf("%s: timedout waiting for cc2!\n", __func__);
+               if (get_timer(start) > MAX_RETRY_MS) {
+                       printf("%s: timeout waiting for cc2!\n", __func__);
                        return;
                }
        }
@@ -145,16 +178,16 @@ static int mmc_init_setup(struct mmc *mmc)
                &mmc_base->sysconfig);
        start = get_timer(0);
        while ((readl(&mmc_base->sysstatus) & RESETDONE) == 0) {
-               if (get_timer(0) - start > MAX_RETRY_MS) {
-                       printf("%s: timedout waiting for cc2!\n", __func__);
+               if (get_timer(start) > MAX_RETRY_MS) {
+                       printf("%s: timeout waiting for cc2!\n", __func__);
                        return TIMEOUT;
                }
        }
        writel(readl(&mmc_base->sysctl) | SOFTRESETALL, &mmc_base->sysctl);
        start = get_timer(0);
        while ((readl(&mmc_base->sysctl) & SOFTRESETALL) != 0x0) {
-               if (get_timer(0) - start > MAX_RETRY_MS) {
-                       printf("%s: timedout waiting for softresetall!\n",
+               if (get_timer(start) > MAX_RETRY_MS) {
+                       printf("%s: timeout waiting for softresetall!\n",
                                __func__);
                        return TIMEOUT;
                }
@@ -176,8 +209,8 @@ static int mmc_init_setup(struct mmc *mmc)
                (dsor << CLKD_OFFSET) | ICE_OSCILLATE);
        start = get_timer(0);
        while ((readl(&mmc_base->sysctl) & ICS_MASK) == ICS_NOTREADY) {
-               if (get_timer(0) - start > MAX_RETRY_MS) {
-                       printf("%s: timedout waiting for ics!\n", __func__);
+               if (get_timer(start) > MAX_RETRY_MS) {
+                       printf("%s: timeout waiting for ics!\n", __func__);
                        return TIMEOUT;
                }
        }
@@ -198,14 +231,14 @@ static int mmc_init_setup(struct mmc *mmc)
 static int mmc_send_cmd(struct mmc *mmc, struct mmc_cmd *cmd,
                        struct mmc_data *data)
 {
-       struct hsmmc *mmc_base = (struct hsmmc *)mmc->priv;
+       struct hsmmc *mmc_base = mmc->priv;
        unsigned int flags, mmc_stat;
        ulong start;
 
        start = get_timer(0);
        while ((readl(&mmc_base->pstate) & (DATI_MASK | CMDI_MASK)) != 0) {
-               if (get_timer(0) - start > MAX_RETRY_MS) {
-                       printf("%s: timedout waiting on cmd inhibit to clear\n",
+               if (get_timer(start) > MAX_RETRY_MS) {
+                       printf("%s: timeout waiting on cmd inhibit to clear\n",
                                        __func__);
                        return TIMEOUT;
                }
@@ -213,8 +246,8 @@ static int mmc_send_cmd(struct mmc *mmc, struct mmc_cmd *cmd,
        writel(0xFFFFFFFF, &mmc_base->stat);
        start = get_timer(0);
        while (readl(&mmc_base->stat)) {
-               if (get_timer(0) - start > MAX_RETRY_MS) {
-                       printf("%s: timedout waiting for stat!\n", __func__);
+               if (get_timer(start) > MAX_RETRY_MS) {
+                       printf("%s: timeout waiting for stat!\n", __func__);
                        return TIMEOUT;
                }
        }
@@ -276,7 +309,7 @@ static int mmc_send_cmd(struct mmc *mmc, struct mmc_cmd *cmd,
        start = get_timer(0);
        do {
                mmc_stat = readl(&mmc_base->stat);
-               if (get_timer(0) - start > MAX_RETRY_MS) {
+               if (get_timer(start) > MAX_RETRY_MS) {
                        printf("%s : timeout: No status update\n", __func__);
                        return TIMEOUT;
                }
@@ -328,8 +361,8 @@ static int mmc_read_data(struct hsmmc *mmc_base, char *buf, unsigned int size)
                ulong start = get_timer(0);
                do {
                        mmc_stat = readl(&mmc_base->stat);
-                       if (get_timer(0) - start > MAX_RETRY_MS) {
-                               printf("%s: timedout waiting for status!\n",
+                       if (get_timer(start) > MAX_RETRY_MS) {
+                               printf("%s: timeout waiting for status!\n",
                                                __func__);
                                return TIMEOUT;
                        }
@@ -380,8 +413,8 @@ static int mmc_write_data(struct hsmmc *mmc_base, const char *buf,
                ulong start = get_timer(0);
                do {
                        mmc_stat = readl(&mmc_base->stat);
-                       if (get_timer(0) - start > MAX_RETRY_MS) {
-                               printf("%s: timedout waiting for status!\n",
+                       if (get_timer(start) > MAX_RETRY_MS) {
+                               printf("%s: timeout waiting for status!\n",
                                                __func__);
                                return TIMEOUT;
                        }
@@ -460,8 +493,8 @@ static void mmc_set_ios(struct mmc *mmc)
 
        start = get_timer(0);
        while ((readl(&mmc_base->sysctl) & ICS_MASK) == ICS_NOTREADY) {
-               if (get_timer(0) - start > MAX_RETRY_MS) {
-                       printf("%s: timedout waiting for ics!\n", __func__);
+               if (get_timer(start) > MAX_RETRY_MS) {
+                       printf("%s: timeout waiting for ics!\n", __func__);
                        return;
                }
        }
index 1d1b6286510b3c3c7b2d769f2243e929ab7411b2..3dd21edb5ac09fe981c60d4d96e1a1d9125e20c4 100644 (file)
@@ -43,6 +43,7 @@ COBJS-y += nand_ecc.o
 COBJS-y += nand_base.o
 COBJS-$(CONFIG_NAND_ECC_BCH) += nand_bch.o
 
+COBJS-$(CONFIG_NAND_AM33XX) += am33xx_nand.o
 COBJS-$(CONFIG_NAND_ATMEL) += atmel_nand.o
 COBJS-$(CONFIG_DRIVER_NAND_BFIN) += bfin_nand.o
 COBJS-$(CONFIG_NAND_DAVINCI) += davinci_nand.o
@@ -58,11 +59,11 @@ COBJS-$(CONFIG_NAND_MXC) += mxc_nand.o
 COBJS-$(CONFIG_NAND_MXS) += mxs_nand.o
 COBJS-$(CONFIG_NAND_NDFC) += ndfc.o
 COBJS-$(CONFIG_NAND_NOMADIK) += nomadik.o
+COBJS-$(CONFIG_NAND_OMAP_GPMC) += omap_bch_decoder.o omap_gpmc.o omap_bch_soft.o
+COBJS-$(CONFIG_NAND_PLAT) += nand_plat.o
 COBJS-$(CONFIG_NAND_S3C2410) += s3c2410_nand.o
 COBJS-$(CONFIG_NAND_S3C64XX) += s3c64xx.o
 COBJS-$(CONFIG_NAND_SPEAR) += spr_nand.o
-COBJS-$(CONFIG_NAND_OMAP_GPMC) += omap_gpmc.o
-COBJS-$(CONFIG_NAND_PLAT) += nand_plat.o
 endif
 
 COBJS  := $(COBJS-y)
diff --git a/drivers/mtd/nand/am33xx_nand.c b/drivers/mtd/nand/am33xx_nand.c
new file mode 100644 (file)
index 0000000..40bfef1
--- /dev/null
@@ -0,0 +1,918 @@
+/*
+ * (C) Copyright 2012 Lothar Waßmann <LW@KARO-electronics.de>
+ * based on ti81xx_nand.c
+ * (C) Copyright 2004-2008 Texas Instruments, <www.ti.com>
+ * Mansoor Ahamed <mansoor.ahamed@ti.com>
+ *
+ * Derived from work done by Rohit Choraria <rohitkc@ti.com> for omap
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public 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/mem.h>
+#include <asm/arch/nand.h>
+#include <linux/mtd/nand_ecc.h>
+#include <nand.h>
+
+struct nand_bch_priv {
+       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 ECC_BCH4_NIBBLES       13
+#define ECC_BCH8_NIBBLES       26
+#define ECC_BCH16_NIBBLES      52
+
+static uint8_t cs;
+#ifndef CONFIG_SPL_BUILD
+static struct nand_ecclayout hw_nand_oob = GPMC_NAND_HW_ECC_LAYOUT_KERNEL;
+static struct nand_ecclayout hw_bch4_nand_oob = GPMC_NAND_HW_BCH4_ECC_LAYOUT;
+static struct nand_ecclayout hw_bch16_nand_oob = GPMC_NAND_HW_BCH16_ECC_LAYOUT;
+#endif
+static struct nand_ecclayout hw_bch8_nand_oob = GPMC_NAND_HW_BCH8_ECC_LAYOUT;
+
+static struct gpmc *gpmc_cfg = (struct gpmc *)GPMC_BASE;
+
+static struct nand_bch_priv bch_priv = {
+       .type = ECC_BCH8,
+       .nibbles = ECC_BCH8_NIBBLES,
+};
+
+#ifndef CONFIG_SYS_NAND_NO_OOB
+static uint8_t bbt_pattern[] = {'B', 'b', 't', '0' };
+static uint8_t mirror_pattern[] = {'1', 't', 'b', 'B' };
+
+static struct nand_bbt_descr bbt_main_descr = {
+       .options = NAND_BBT_LASTBLOCK | NAND_BBT_CREATE | NAND_BBT_WRITE |
+               NAND_BBT_2BIT | NAND_BBT_VERSION | NAND_BBT_PERCHIP,
+       .offs = 58,
+       .len = 4,
+       .veroffs = 62,
+       .maxblocks = 4,
+       .pattern = bbt_pattern,
+};
+
+static struct nand_bbt_descr bbt_mirror_descr = {
+       .options = NAND_BBT_LASTBLOCK | NAND_BBT_CREATE | NAND_BBT_WRITE |
+               NAND_BBT_2BIT | NAND_BBT_VERSION | NAND_BBT_PERCHIP,
+       .offs = 58,
+       .len = 4,
+       .veroffs = 62,
+       .maxblocks = 4,
+       .pattern = mirror_pattern,
+};
+#endif
+
+/*
+ * am33xx_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 am33xx_read_bch8_result(struct mtd_info *mtd, int big_endian,
+                               uint8_t *ecc_code)
+{
+       uint32_t *ptr;
+       int i = 0, j;
+
+       if (big_endian) {
+               u32 res;
+               ptr = &gpmc_cfg->bch_result_0_3[0].bch_result_x[3];
+               res = readl(ptr);
+               ecc_code[i++] = res & 0xFF;
+               for (j = 0; j < 3; j++) {
+                       u32 res = readl(--ptr);
+
+                       ecc_code[i++] = (res >> 24) & 0xFF;
+                       ecc_code[i++] = (res >> 16) & 0xFF;
+                       ecc_code[i++] = (res >>  8) & 0xFF;
+                       ecc_code[i++] = res & 0xFF;
+               }
+       } else {
+               ptr = &gpmc_cfg->bch_result_0_3[0].bch_result_x[0];
+               for (j = 0; j < 3; j++) {
+                       u32 res = readl(ptr++);
+
+                       ecc_code[i++] = res & 0xFF;
+                       ecc_code[i++] = (res >>  8) & 0xFF;
+                       ecc_code[i++] = (res >> 16) & 0xFF;
+                       ecc_code[i++] = (res >> 24) & 0xFF;
+               }
+               ecc_code[i++] = readl(ptr) & 0xFF;
+       }
+       ecc_code[i] = 0xff;
+}
+
+/*
+ * am33xx_ecc_disable - Disable H/W ECC calculation
+ *
+ * @mtd:       MTD device structure
+ *
+ */
+static void am33xx_ecc_disable(struct mtd_info *mtd)
+{
+       writel((readl(&gpmc_cfg->ecc_config) & ~0x1),
+               &gpmc_cfg->ecc_config);
+}
+
+/*
+ * am33xx_nand_hwcontrol - Set the address pointers correctly for the
+ *                     following address/data/command operation
+ */
+static void am33xx_nand_hwcontrol(struct mtd_info *mtd, int32_t cmd,
+                               uint32_t ctrl)
+{
+       register struct nand_chip *this = mtd->priv;
+
+       debug("nand cmd %08x ctrl %08x\n", cmd, ctrl);
+       /*
+        * Point the IO_ADDR to DATA and ADDRESS registers instead
+        * of chip address
+        */
+       switch (ctrl) {
+       case NAND_CTRL_CHANGE | NAND_CTRL_CLE:
+               this->IO_ADDR_W = (void __iomem *)&gpmc_cfg->cs[cs].nand_cmd;
+               break;
+       case NAND_CTRL_CHANGE | NAND_CTRL_ALE:
+               this->IO_ADDR_W = (void __iomem *)&gpmc_cfg->cs[cs].nand_adr;
+               break;
+       case NAND_CTRL_CHANGE | NAND_NCE:
+               this->IO_ADDR_W = (void __iomem *)&gpmc_cfg->cs[cs].nand_dat;
+       }
+
+       if (cmd != NAND_CMD_NONE)
+               writeb(cmd, this->IO_ADDR_W);
+}
+
+/*
+ * am33xx_hwecc_init_bch - Initialize the BCH Hardware ECC for NAND flash in
+ *                             GPMC controller
+ * @mtd:       MTD device structure
+ * @mode:      Read/Write mode
+ */
+static void am33xx_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;
+       }
+
+       /* 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);
+       }
+       /* 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);
+       /* enable ecc */
+       /* val |= (1); */ /* should not enable ECC just init i.e. config */
+       writel(val, &gpmc_cfg->ecc_config);
+}
+
+#ifndef CONFIG_SPL_BUILD
+/*
+ * am33xx_hwecc_init - Initialize the Hardware ECC for NAND flash in
+ *                   GPMC controller
+ * @mtd:        MTD device structure
+ *
+ */
+static void am33xx_hwecc_init(struct nand_chip *chip)
+{
+       /*
+        * Init ECC Control Register
+        * Clear all ECC | Enable Reg1
+        */
+       writel(ECCCLEAR | ECCRESULTREG1, &gpmc_cfg->ecc_control);
+       writel(ECCSIZE1 | ECCSIZE0 | ECCSIZE0SEL, &gpmc_cfg->ecc_size_config);
+}
+
+/*
+ * gen_true_ecc - This function will generate true ECC value, which
+ * can be used when correcting data read from NAND flash memory core
+ *
+ * @ecc_buf:   buffer to store ecc code
+ *
+ * @return:    re-formatted ECC value
+ */
+static uint32_t gen_true_ecc(uint8_t *ecc_buf)
+{
+       return ecc_buf[0] | (ecc_buf[1] << 16) | ((ecc_buf[2] & 0xF0) << 20) |
+               ((ecc_buf[2] & 0x0F) << 8);
+}
+#endif
+
+/*
+ * am33xx_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 inline void am33xx_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;
+       int n_bytes;
+       int 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;
+       }
+
+       for (i = 0, j = (n_bytes - 1); i < n_bytes; i++, j--)
+               syndrome[i] =  calc_ecc[j];
+       syndrome[i] = 0xff;
+}
+
+
+/*
+ * am33xx_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 am33xx_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;
+       int 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;
+               }
+       }
+}
+
+/*
+ * am33xx_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 inline int am33xx_read_page_bch(struct mtd_info *mtd, struct nand_chip *chip,
+                               uint8_t *buf, int page);
+
+static int am33xx_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 - 1); i++)
+               if (read_ecc[i] != 0xff)
+                       ecc_flag = 1;
+
+       if (!ecc_flag)
+               return 0;
+
+       elm_reset();
+       elm_config(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.
+        */
+       am33xx_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("uncorrectable ECC error\n");
+               return -1;
+       }
+
+       /* correct bch error */
+       if (error_count > 0) {
+               am33xx_fix_errors_bch(mtd, dat, error_count, error_loc);
+       }
+
+       return 0;
+}
+
+#ifndef CONFIG_SPL_BUILD
+/*
+ * am33xx_correct_data - Compares the ecc read from nand spare area with ECC
+ * registers values and corrects one bit error if it has occured
+ * Further details can be had from Am33xx TRM and the following selected links:
+ * http://en.wikipedia.org/wiki/Hamming_code
+ * http://www.cs.utexas.edu/users/plaxton/c/337/05f/slides/ErrorCorrection-4.pdf
+ *
+ * @mtd:                MTD device structure
+ * @dat:                page data
+ * @read_ecc:           ecc read from nand flash
+ * @calc_ecc:           ecc read from ECC registers
+ *
+ * @return 0 if data is OK or corrected, else returns -1
+ */
+static int am33xx_correct_data(struct mtd_info *mtd, uint8_t *dat,
+                               uint8_t *read_ecc, uint8_t *calc_ecc)
+{
+       uint32_t orig_ecc, new_ecc, res, hm;
+       uint16_t parity_bits, byte;
+       int bit;
+
+       /* Regenerate the orginal ECC */
+       orig_ecc = gen_true_ecc(read_ecc);
+       new_ecc = gen_true_ecc(calc_ecc);
+       /* Get the XOR of real ecc */
+       res = orig_ecc ^ new_ecc;
+       if (res) {
+               /* Get the hamming width */
+               hm = hweight32(res);
+               /* Single bit errors can be corrected! */
+               if (hm == 12) {
+                       /* Correctable data! */
+                       parity_bits = res >> 16;
+                       bit = (parity_bits & 0x7);
+                       byte = (parity_bits >> 3) & 0x1FF;
+                       /* Flip the bit to correct */
+                       dat[byte] ^= (0x1 << bit);
+               } else if (hm == 1) {
+                       printf("am33xx_nand: Error: Corrupted ECC\n");
+                       /* ECC itself is corrupted */
+                       return 2;
+               } else {
+                       /*
+                        * hm distance != parity pairs OR one, could mean 2 bit
+                        * error OR potentially be on a blank page..
+                        * orig_ecc: contains spare area data from nand flash.
+                        * new_ecc: generated ecc while reading data area.
+                        * Note: if the ecc = 0, all data bits from which it was
+                        * generated are 0xFF.
+                        * The 3 byte(24 bits) ecc is generated per 512byte
+                        * chunk of a page. If orig_ecc(from spare area)
+                        * is 0xFF && new_ecc(computed now from data area)=0x0,
+                        * this means that data area is 0xFF and spare area is
+                        * 0xFF. A sure sign of an erased page!
+                        */
+                       if ((orig_ecc == 0x0FFF0FFF) && (new_ecc == 0x00000000))
+                               return 0;
+                       printf("am33xx_nand: Error: Multibit error detected; hm=%d\n",
+                               hm);
+                       /* detected 2 bit error */
+                       return -1;
+               }
+       }
+       return 0;
+}
+#endif
+
+/*
+ *  am33xx_calculate_ecc_bch - Read BCH ECC result
+ *
+ *  @mtd:      MTD structure
+ *  @dat:      unused
+ *  @ecc_code: ecc_code buffer
+ */
+static int am33xx_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;
+       int big_endian = 1;
+       int ret = 0;
+
+       if (bch->type == ECC_BCH8)
+               am33xx_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
+        */
+       am33xx_ecc_disable(mtd);
+
+       return ret;
+}
+
+#ifndef CONFIG_SPL_BUILD
+/*
+ *  am33xx_calculate_ecc - Generate non-inverted ECC bytes.
+ *
+ *  Using noninverted ECC can be considered ugly since writing a blank
+ *  page ie. padding will clear the ECC bytes. This is no problem as
+ *  long nobody is trying to write data on the seemingly unused page.
+ *  Reading an erased page will produce an ECC mismatch between
+ *  generated and read ECC bytes that has to be dealt with separately.
+ *  E.g. if page is 0xFF (fresh erased), and if HW ECC engine within GPMC
+ *  is used, the result of read will be 0x0 while the ECC offsets of the
+ *  spare area will be 0xFF which will result in an ECC mismatch.
+ *  @mtd:      MTD structure
+ *  @dat:      unused
+ *  @ecc_code: ecc_code buffer
+ */
+static int am33xx_calculate_ecc(struct mtd_info *mtd, const uint8_t *dat,
+                               uint8_t *ecc_code)
+{
+       u_int32_t val;
+
+       /* Start Reading from HW ECC1_Result = 0x200 */
+       val = readl(&gpmc_cfg->ecc1_result);
+
+       ecc_code[0] = val & 0xFF;
+       ecc_code[1] = (val >> 16) & 0xFF;
+       ecc_code[2] = ((val >> 8) & 0x0F) | ((val >> 20) & 0xF0);
+
+       /*
+        * Stop reading anymore ECC vals and clear old results
+        * enable will be called if more reads are required
+        */
+       writel(0x000, &gpmc_cfg->ecc_config);
+
+       return 0;
+}
+#endif
+
+#ifdef CONFIG_SPL_BUILD
+static void am33xx_spl_nand_command(struct mtd_info *mtd, unsigned int cmd,
+                               int col, int page)
+{
+       struct nand_chip *chip = mtd->priv;
+
+       while (!chip->dev_ready(mtd))
+               ;
+
+       /* Emulate NAND_CMD_READOOB */
+       if (cmd == NAND_CMD_READOOB) {
+               col += CONFIG_SYS_NAND_PAGE_SIZE;
+               cmd = NAND_CMD_READ0;
+       }
+
+       /* Shift the offset from byte addressing to word addressing. */
+       if (chip->options & NAND_BUSWIDTH_16)
+               col >>= 1;
+
+       /* Begin command latch cycle */
+       chip->cmd_ctrl(mtd, cmd, NAND_CTRL_CLE | NAND_CTRL_CHANGE);
+       /* Set ALE and clear CLE to start address cycle */
+       /* Column address */
+       chip->cmd_ctrl(mtd, col & 0xff,
+                      NAND_CTRL_ALE | NAND_CTRL_CHANGE); /* A[7:0] */
+       chip->cmd_ctrl(mtd, (col >> 8) & 0xff, NAND_CTRL_ALE); /* A[11:9] */
+       /* Row address */
+       chip->cmd_ctrl(mtd, page & 0xff, NAND_CTRL_ALE); /* A[19:12] */
+       chip->cmd_ctrl(mtd, (page >> 8) & 0xff,
+                      NAND_CTRL_ALE); /* A[27:20] */
+#ifdef CONFIG_SYS_NAND_5_ADDR_CYCLE
+       /* One more address cycle for devices > 128MiB */
+       chip->cmd_ctrl(mtd, (page >> 16) & 0x0f,
+                      NAND_CTRL_ALE); /* A[31:28] */
+#endif
+       chip->cmd_ctrl(mtd, NAND_CMD_NONE, NAND_NCE | NAND_CTRL_CHANGE);
+
+       /* Latch in address */
+       chip->cmd_ctrl(mtd, cmd == NAND_CMD_RNDOUT ?
+               NAND_CMD_RNDOUTSTART : NAND_CMD_READSTART,
+               NAND_CTRL_CLE | NAND_CTRL_CHANGE);
+       chip->cmd_ctrl(mtd, NAND_CMD_NONE, NAND_NCE | NAND_CTRL_CHANGE);
+
+       /*
+        * Wait a while for the data to be ready
+        */
+       while (!chip->dev_ready(mtd))
+               ;
+}
+#endif
+
+/**
+ * am33xx_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 inline int am33xx_read_page_bch(struct mtd_info *mtd, struct nand_chip *chip,
+                               uint8_t *buf, int page)
+{
+       int ret = 0;
+       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 = 0;
+       uint32_t oob_pos = (eccsize * eccsteps) + eccpos[0];
+
+       chip->cmdfunc(mtd, NAND_CMD_READ0, data_pos, page);
+
+       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[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) {
+                       printf("am33xx_nand: uncorrectable ECC error in page %5d\n",
+                               page);
+                       mtd->ecc_stats.failed++;
+                       return -EBADMSG;
+               } else if (stat) {
+                       mtd->ecc_stats.corrected += stat;
+                       printf("%s: corrected ECC errors: %d\n", __func__, stat);
+                       ret += stat;
+               }
+       }
+       return ret;
+}
+
+/*
+ * am33xx_enable_ecc_bch- This function enables the bch h/w ecc functionality
+ * @mtd:        MTD device structure
+ * @mode:       Read/Write mode
+ *
+ */
+static void am33xx_enable_ecc_bch(struct mtd_info *mtd, int32_t mode)
+{
+       struct nand_chip *chip = mtd->priv;
+
+       am33xx_hwecc_init_bch(chip, mode);
+       /* enable ecc */
+       writel(readl(&gpmc_cfg->ecc_config) | 0x1, &gpmc_cfg->ecc_config);
+}
+
+#ifndef CONFIG_SPL_BUILD
+/*
+ * am33xx_enable_ecc - This function enables the hardware ecc functionality
+ * @mtd:        MTD device structure
+ * @mode:       Read/Write mode
+ */
+static void am33xx_enable_ecc(struct mtd_info *mtd, int32_t mode)
+{
+       struct nand_chip *chip = mtd->priv;
+       uint32_t val, dev_width = (chip->options & NAND_BUSWIDTH_16) >> 1;
+
+       switch (mode) {
+       case NAND_ECC_READ:
+       case NAND_ECC_WRITE:
+               /* Clear the ecc result registers, select ecc reg as 1 */
+               writel(ECCCLEAR | ECCRESULTREG1, &gpmc_cfg->ecc_control);
+
+               /*
+                * Size 0 = 0xFF, Size1 is 0xFF - both are 512 bytes
+                * tell all regs to generate size0 sized regs
+                * we just have a single ECC engine for all CS
+                */
+               writel(ECCSIZE1 | ECCSIZE0 | ECCSIZE0SEL,
+                       &gpmc_cfg->ecc_size_config);
+               val = (dev_width << 7) | (cs << 1) | (1 << 0);
+               writel(val, &gpmc_cfg->ecc_config);
+               break;
+       default:
+               printf("Error: Unrecognized Mode[%d]!\n", mode);
+       }
+}
+
+/*
+ * __am33xx_nand_switch_ecc - switch the ECC operation ib/w h/w ecc
+ * (i.e. hamming / bch) and s/w ecc.
+ * The default is to come up on s/w ecc
+ *
+ * @nand:      NAND chip datastructure
+ * @hardware:  NAND_ECC_HW -switch to h/w ecc
+ *                             NAND_ECC_SOFT -switch to s/w ecc
+ *
+ * @mode:      0 - hamming code
+ *             1 - bch4
+ *             2 - bch8
+ *             3 - bch16
+ */
+static void __am33xx_nand_switch_ecc(struct nand_chip *nand,
+               nand_ecc_modes_t hardware, int32_t mode)
+{
+       struct nand_bch_priv *bch;
+
+       bch = nand->priv;
+
+       /* Reset ecc interface */
+       nand->ecc.read_page = NULL;
+       nand->ecc.write_page = NULL;
+       nand->ecc.read_oob = NULL;
+       nand->ecc.write_oob = NULL;
+       nand->ecc.hwctl = NULL;
+       nand->ecc.correct = NULL;
+       nand->ecc.calculate = NULL;
+
+       nand->ecc.mode = hardware;
+       /* Setup the ecc configurations again */
+       if (hardware == NAND_ECC_HW) {
+               if (mode) {
+                       /* -1 for converting mode to bch type */
+                       bch->type = mode - 1;
+                       debug("HW ECC BCH");
+                       switch (bch->type) {
+                               case ECC_BCH4:
+                                       nand->ecc.bytes = 8;
+                                       nand->ecc.layout = &hw_bch4_nand_oob;
+                                       bch->nibbles = ECC_BCH4_NIBBLES;
+                                       debug("4 not supported\n");
+                                       return;
+
+                               case ECC_BCH16:
+                                       nand->ecc.bytes = 26;
+                                       nand->ecc.layout = &hw_bch16_nand_oob;
+                                       bch->nibbles = ECC_BCH16_NIBBLES;
+                                       debug("16 not supported\n");
+                                       return;
+
+                               case ECC_BCH8:
+                               default:
+                                       nand->ecc.bytes = CONFIG_SYS_NAND_ECCBYTES;
+                                       nand->ecc.layout = &hw_bch8_nand_oob;
+                                       bch->nibbles = ECC_BCH8_NIBBLES;
+                                       debug("8 Selected\n");
+                       }
+                       nand->ecc.mode = NAND_ECC_HW;
+                       nand->ecc.size = 512;
+                       nand->ecc.read_page = am33xx_read_page_bch;
+                       nand->ecc.hwctl = am33xx_enable_ecc_bch;
+                       nand->ecc.correct = am33xx_correct_data_bch;
+                       nand->ecc.calculate = am33xx_calculate_ecc_bch;
+                       am33xx_hwecc_init_bch(nand, NAND_ECC_READ);
+               } else {
+                       nand->ecc.layout = &hw_nand_oob;
+                       nand->ecc.size = 512;
+                       nand->ecc.bytes = 3;
+                       nand->ecc.hwctl = am33xx_enable_ecc;
+                       nand->ecc.correct = am33xx_correct_data;
+                       nand->ecc.calculate = am33xx_calculate_ecc;
+                       am33xx_hwecc_init(nand);
+                       debug("HW ECC Hamming Code selected\n");
+               }
+       } else if (hardware == NAND_ECC_SOFT) {
+               /* Use mtd default settings */
+               nand->ecc.layout = NULL;
+               debug("SW ECC selected\n");
+       } else {
+               debug("ECC Disabled\n");
+       }
+}
+
+/*
+ * am33xx_nand_switch_ecc - switch the ECC operation ib/w h/w ecc
+ * (i.e. hamming / bch) and s/w ecc.
+ * The default is to come up on s/w ecc
+ *
+ * @hardware -  NAND_ECC_HW -switch to h/w ecc
+ *                             NAND_ECC_SOFT -switch to s/w ecc
+ *
+ * @mode -     0 - hamming code
+ *             1 - bch4
+ *             2 - bch8
+ *             3 - bch16
+ */
+void am33xx_nand_switch_ecc(nand_ecc_modes_t hardware, int32_t mode)
+{
+       struct nand_chip *nand;
+       struct mtd_info *mtd;
+
+       if (nand_curr_device < 0 ||
+           nand_curr_device >= CONFIG_SYS_MAX_NAND_DEVICE) {
+               printf("Error: Can't switch ecc, no devices available\n");
+               return;
+       }
+
+       mtd = &nand_info[nand_curr_device];
+       nand = mtd->priv;
+
+       __am33xx_nand_switch_ecc(nand, hardware, mode);
+
+       nand->options |= NAND_OWN_BUFFERS;
+       /* Update NAND handling after ECC mode switch */
+       nand_scan_tail(mtd);
+       nand->options &= ~NAND_OWN_BUFFERS;
+}
+
+#else /* CONFIG_SPL_BUILD */
+/* Check wait pin as dev ready indicator */
+static int am33xx_spl_dev_ready(struct mtd_info *mtd)
+{
+       int ret;
+
+//     printf("dev status: ");
+       ret = readl(&gpmc_cfg->status) & (1 << 8);
+//     printf("%d %08x\n", ret, gpmc_cfg->status);
+       return ret;
+}
+#endif
+
+/*
+ * Board-specific NAND initialization. The following members of the
+ * argument are board-specific:
+ * - IO_ADDR_R: address to read the 8 I/O lines of the flash device
+ * - IO_ADDR_W: address to write the 8 I/O lines of the flash device
+ * - cmd_ctrl: hardwarespecific function for accesing control-lines
+ * - waitfunc: hardwarespecific function for accesing device ready/busy line
+ * - ecc.hwctl: function to enable (reset) hardware ecc generator
+ * - ecc.mode: mode of ecc, see defines
+ * - chip_delay: chip dependent delay for transfering data from array to
+ *   read regs (tR)
+ * - options: various chip options. They can partly be set to inform
+ *   nand_scan about special functionality. See the defines for further
+ *   explanation
+ */
+int board_nand_init(struct nand_chip *nand)
+{
+       /* int32_t gpmc_config = 0; */
+       cs = 0;
+
+       /*
+        * xloader/Uboot's gpmc configuration would have configured GPMC for
+        * nand type of memory. The following logic scans and latches on to the
+        * first CS with NAND type memory.
+        * TBD: need to make this logic generic to handle multiple CS NAND
+        * devices.
+        */
+       while (cs < GPMC_MAX_CS) {
+               /* Check if NAND type is set */
+               if ((readl(&gpmc_cfg->cs[cs].config1) & 0xC00) == 0x800) {
+                       /* Found it!! */
+                       debug("Searching for NAND device @ GPMC CS:%d\n", cs);
+                       break;
+               }
+               cs++;
+       }
+       if (cs >= GPMC_MAX_CS) {
+               printf("NAND: Unable to find NAND settings in "
+                       "GPMC Configuration - quitting\n");
+               return -ENODEV;
+       }
+
+       nand->IO_ADDR_R = (void __iomem *)&gpmc_cfg->cs[cs].nand_dat;
+       nand->IO_ADDR_W = (void __iomem *)&gpmc_cfg->cs[cs].nand_cmd;
+
+       nand->cmd_ctrl = am33xx_nand_hwcontrol;
+       nand->options = NAND_NO_PADDING | NAND_CACHEPRG | NAND_NO_AUTOINCR;
+#ifdef CONFIG_SYS_NAND_USE_FLASH_BBT
+#ifdef CONFIG_SYS_NAND_NO_OOB
+       nand->options |= NAND_USE_FLASH_BBT | NAND_USE_FLASH_BBT_NO_OOB;
+#else
+       nand->options |= NAND_USE_FLASH_BBT;
+       nand->bbt_td = &bbt_main_descr;
+       nand->bbt_md = &bbt_mirror_descr;
+#endif /* CONFIG_SYS_NAND_NO_OOB */
+#endif /* CONFIG_SYS_NAND_USE_FLASH_BBT */
+
+       /* If we are 16 bit dev, our gpmc config tells us that */
+       if ((readl(&gpmc_cfg->cs[cs].config1) & 0x3000) == 0x1000) {
+               nand->options |= NAND_BUSWIDTH_16;
+       }
+
+       nand->chip_delay = 100;
+
+       /* required in case of BCH */
+       elm_init();
+
+       /* BCH info that will be correct for SPL or overridden otherwise. */
+       nand->priv = &bch_priv;
+
+       bch_priv.nibbles = ECC_BCH8_NIBBLES;
+       bch_priv.type = ECC_BCH8;
+       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 = am33xx_enable_ecc_bch;
+       nand->ecc.read_page = am33xx_read_page_bch;
+       nand->ecc.correct = am33xx_correct_data_bch;
+       nand->ecc.calculate = am33xx_calculate_ecc_bch;
+
+#ifndef CONFIG_SPL_BUILD
+       nand_curr_device = 0;
+#else
+       nand->cmdfunc = am33xx_spl_nand_command;
+
+       nand->ecc.steps = CONFIG_SYS_NAND_PAGE_SIZE / CONFIG_SYS_NAND_ECCSIZE;
+       nand->ecc.total = CONFIG_SYS_NAND_ECCBYTES * nand->ecc.steps;
+
+       if (nand->options & NAND_BUSWIDTH_16)
+               nand->read_buf = nand_read_buf16;
+       else
+               nand->read_buf = nand_read_buf;
+
+       nand->dev_ready = am33xx_spl_dev_ready;
+#endif /* CONFIG_SPL_BUILD */
+       am33xx_hwecc_init_bch(nand, NAND_ECC_READ);
+
+       return 0;
+}
index 35e89a0f4d69428878edcbe384263f02a7360b78..0e89828ee622c11b6ca0b9628a51469db2b3fdd2 100644 (file)
@@ -3,6 +3,8 @@
  * Copyright 2008 Sascha Hauer, kernel@pengutronix.de
  * Copyright 2009 Ilya Yanok, <yanok@emcraft.com>
  *
+ * Copyright 2012 Lothar Waßmann <LW@KARO-electronics.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
  */
 
 #include <common.h>
+#include <malloc.h>
 #include <nand.h>
 #include <linux/err.h>
 #include <asm/io.h>
-#if defined(CONFIG_MX25) || defined(CONFIG_MX27) || defined(CONFIG_MX35)
+#if defined(CONFIG_MX25) || defined(CONFIG_MX27) || defined(CONFIG_MX35) || \
+       defined(CONFIG_MX51) || defined(CONFIG_MX53)
 #include <asm/arch/imx-regs.h>
 #endif
 
-#define DRIVER_NAME "mxc_nand"
-
-/*
- * TODO: Use same register defs here as nand_spl mxc nand driver.
- */
-/*
- * Register map and bit definitions for the Freescale NAND Flash Controller
- * present in various i.MX devices.
- *
- * MX31 and MX27 have version 1 which has
- *     4 512 byte main buffers and
- *     4 16 byte spare buffers
- *     to support up to 2K byte pagesize nand.
- *     Reading or writing a 2K page requires 4 FDI/FDO cycles.
- *
- * MX25 has version 1.1 which has
- *     8 512 byte main buffers and
- *     8 64 byte spare buffers
- *     to support up to 4K byte pagesize nand.
- *     Reading or writing a 2K or 4K page requires only 1 FDI/FDO cycle.
- *      Also some of registers are moved and/or changed meaning as seen below.
- */
-#if defined(CONFIG_MX31) || defined(CONFIG_MX27)
-#define MXC_NFC_V1
-#elif defined(CONFIG_MX25) || defined(CONFIG_MX35)
-#define MXC_NFC_V1_1
-#else
-#warning "MXC NFC version not defined"
-#endif
-
-#if defined(MXC_NFC_V1)
-#define NAND_MXC_NR_BUFS               4
-#define NAND_MXC_SPARE_BUF_SIZE                16
-#define NAND_MXC_REG_OFFSET            0xe00
-#define is_mxc_nfc_11()                0
-#elif defined(MXC_NFC_V1_1)
-#define NAND_MXC_NR_BUFS               8
-#define NAND_MXC_SPARE_BUF_SIZE                64
-#define NAND_MXC_REG_OFFSET            0x1e00
-#define is_mxc_nfc_11()                1
+#ifdef DEBUG
+#define pr_debug(fmt...) printk(fmt)
 #else
-#error "define CONFIG_NAND_MXC_VXXX to use mtd mxc nand driver"
-#endif
-struct nfc_regs {
-       uint8_t main_area[NAND_MXC_NR_BUFS][0x200];
-       uint8_t spare_area[NAND_MXC_NR_BUFS][NAND_MXC_SPARE_BUF_SIZE];
-       /*
-        * reserved size is offset of nfc registers
-        * minus total main and spare sizes
-        */
-       uint8_t reserved1[NAND_MXC_REG_OFFSET
-               - NAND_MXC_NR_BUFS * (512 + NAND_MXC_SPARE_BUF_SIZE)];
-#if defined(MXC_NFC_V1)
-       uint16_t nfc_buf_size;
-       uint16_t reserved2;
-       uint16_t nfc_buf_addr;
-       uint16_t nfc_flash_addr;
-       uint16_t nfc_flash_cmd;
-       uint16_t nfc_config;
-       uint16_t nfc_ecc_status_result;
-       uint16_t nfc_rsltmain_area;
-       uint16_t nfc_rsltspare_area;
-       uint16_t nfc_wrprot;
-       uint16_t nfc_unlockstart_blkaddr;
-       uint16_t nfc_unlockend_blkaddr;
-       uint16_t nfc_nf_wrprst;
-       uint16_t nfc_config1;
-       uint16_t nfc_config2;
-#elif defined(MXC_NFC_V1_1)
-       uint16_t reserved2[2];
-       uint16_t nfc_buf_addr;
-       uint16_t nfc_flash_addr;
-       uint16_t nfc_flash_cmd;
-       uint16_t nfc_config;
-       uint16_t nfc_ecc_status_result;
-       uint16_t nfc_ecc_status_result2;
-       uint16_t nfc_spare_area_size;
-       uint16_t nfc_wrprot;
-       uint16_t reserved3[2];
-       uint16_t nfc_nf_wrprst;
-       uint16_t nfc_config1;
-       uint16_t nfc_config2;
-       uint16_t reserved4;
-       uint16_t nfc_unlockstart_blkaddr;
-       uint16_t nfc_unlockend_blkaddr;
-       uint16_t nfc_unlockstart_blkaddr1;
-       uint16_t nfc_unlockend_blkaddr1;
-       uint16_t nfc_unlockstart_blkaddr2;
-       uint16_t nfc_unlockend_blkaddr2;
-       uint16_t nfc_unlockstart_blkaddr3;
-       uint16_t nfc_unlockend_blkaddr3;
+#define pr_debug(fmt...) do { } while (0)
 #endif
-};
-
-/*
- * Set INT to 0, FCMD to 1, rest to 0 in NFC_CONFIG2 Register
- * for Command operation
- */
-#define NFC_CMD            0x1
-
-/*
- * Set INT to 0, FADD to 1, rest to 0 in NFC_CONFIG2 Register
- * for Address operation
- */
-#define NFC_ADDR           0x2
-
-/*
- * Set INT to 0, FDI to 1, rest to 0 in NFC_CONFIG2 Register
- * for Input operation
- */
-#define NFC_INPUT          0x4
-
-/*
- * Set INT to 0, FDO to 001, rest to 0 in NFC_CONFIG2 Register
- * for Data Output operation
- */
-#define NFC_OUTPUT         0x8
 
-/*
- * Set INT to 0, FD0 to 010, rest to 0 in NFC_CONFIG2 Register
- * for Read ID operation
- */
-#define NFC_ID             0x10
-
-/*
- * Set INT to 0, FDO to 100, rest to 0 in NFC_CONFIG2 Register
- * for Read Status operation
- */
-#define NFC_STATUS         0x20
-
-/*
- * Set INT to 1, rest to 0 in NFC_CONFIG2 Register for Read
- * Status operation
- */
-#define NFC_INT            0x8000
-
-#ifdef MXC_NFC_V1_1
-#define NFC_4_8N_ECC   (1 << 0)
-#else
-#define NFC_4_8N_ECC   0
-#endif
-#define NFC_SP_EN           (1 << 2)
-#define NFC_ECC_EN          (1 << 3)
-#define NFC_BIG             (1 << 5)
-#define NFC_RST             (1 << 6)
-#define NFC_CE              (1 << 7)
-#define NFC_ONE_CYCLE       (1 << 8)
-
-typedef enum {false, true} bool;
-
-struct mxc_nand_host {
-       struct mtd_info         mtd;
-       struct nand_chip        *nand;
-
-       struct nfc_regs __iomem *regs;
-       int                     spare_only;
-       int                     status_request;
-       int                     pagesize_2k;
-       int                     clk_act;
-       uint16_t                col_addr;
-       unsigned int            page_addr;
-};
+typedef enum _bool { false, true } bool;
 
 static struct mxc_nand_host mxc_host;
 static struct mxc_nand_host *host = &mxc_host;
 
-/* Define delays in microsec for NAND device operations */
-#define TROP_US_DELAY   2000
-/* Macros to get byte and bit positions of ECC */
-#define COLPOS(x)  ((x) >> 3)
-#define BITPOS(x) ((x) & 0xf)
-
-/* Define single bit Error positions in Main & Spare area */
-#define MAIN_SINGLEBIT_ERROR 0x4
-#define SPARE_SINGLEBIT_ERROR 0x1
-
-/* OOB placement block for use with hardware ecc generation */
-#if defined(MXC_NFC_V1)
-#ifndef CONFIG_SYS_NAND_LARGEPAGE
-static struct nand_ecclayout nand_hw_eccoob = {
-       .eccbytes = 5,
-       .eccpos = {6, 7, 8, 9, 10},
-       .oobfree = { {0, 5}, {11, 5}, }
-};
-#else
-static struct nand_ecclayout nand_hw_eccoob2k = {
-       .eccbytes = 20,
-       .eccpos = {
-               6, 7, 8, 9, 10,
-               22, 23, 24, 25, 26,
-               38, 39, 40, 41, 42,
-               54, 55, 56, 57, 58,
-       },
-       .oobfree = { {2, 4}, {11, 11}, {27, 11}, {43, 11}, {59, 5} },
-};
-#endif
-#elif defined(MXC_NFC_V1_1)
-#ifndef CONFIG_SYS_NAND_LARGEPAGE
-static struct nand_ecclayout nand_hw_eccoob = {
-       .eccbytes = 9,
-       .eccpos = {7, 8, 9, 10, 11, 12, 13, 14, 15},
-       .oobfree = { {2, 5} }
-};
-#else
-static struct nand_ecclayout nand_hw_eccoob2k = {
-       .eccbytes = 36,
-       .eccpos = {
-               7, 8, 9, 10, 11, 12, 13, 14, 15,
-               23, 24, 25, 26, 27, 28, 29, 30, 31,
-               39, 40, 41, 42, 43, 44, 45, 46, 47,
-               55, 56, 57, 58, 59, 60, 61, 62, 63,
-       },
-       .oobfree = { {2, 5}, {16, 7}, {32, 7}, {48, 7} },
-};
-#endif
-#endif
-
 #ifdef CONFIG_MX27
 static int is_16bit_nand(void)
 {
@@ -276,6 +74,28 @@ static int is_16bit_nand(void)
        else
                return 0;
 }
+#elif defined(CONFIG_MX51)
+static int is_16bit_nand(void)
+{
+       struct src *src = (struct src *)SRC_BASE_ADDR;
+
+       if (readl(&src->sbmr) & (1 << 2))
+               return 1;
+       else
+               return 0;
+}
+#elif defined(CONFIG_MX53)
+/* BOOT_CFG[1..3][0..7] */
+#define SRC_BOOT_CFG(m, n)             (1 << ((m) * 8 + (n)))
+static int is_16bit_nand(void)
+{
+       struct src *src = (struct src *)SRC_BASE_ADDR;
+
+       if (readl(&src->sbmr) & SRC_BOOT_CFG(2, 5))
+               return 1;
+       else
+               return 0;
+}
 #else
 #warning "8/16 bit NAND autodetection not supported"
 static int is_16bit_nand(void)
@@ -284,557 +104,463 @@ static int is_16bit_nand(void)
 }
 #endif
 
-static uint32_t *mxc_nand_memcpy32(uint32_t *dest, uint32_t *source, size_t size)
-{
-       uint32_t *d = dest;
-
-       size >>= 2;
-       while (size--)
-               __raw_writel(__raw_readl(source++), d++);
-       return dest;
-}
+#define MXC_NAND_TIMEOUT       (1 * HZ)
 
-/*
- * This function polls the NANDFC to wait for the basic operation to
- * complete by checking the INT bit of config2 register.
- */
-static void wait_op_done(struct mxc_nand_host *host, int max_retries,
-                               uint16_t param)
-{
-       uint32_t tmp;
+#define DRIVER_NAME "mxc_nand"
 
-       while (max_retries-- > 0) {
-               if (readw(&host->regs->nfc_config2) & NFC_INT) {
-                       tmp = readw(&host->regs->nfc_config2);
-                       tmp  &= ~NFC_INT;
-                       writew(tmp, &host->regs->nfc_config2);
-                       break;
-               }
-               udelay(1);
-       }
-       if (max_retries < 0) {
-               MTDDEBUG(MTD_DEBUG_LEVEL0, "%s(%d): INT not set\n",
-                               __func__, param);
-       }
-}
+#ifndef CONFIG_MXC_NAND_REGS_BASE
+#error CONFIG_MXC_NAND_REGS_BASE not defined
+#endif
 
-/*
- * This function issues the specified command to the NAND device and
- * waits for completion.
- */
-static void send_cmd(struct mxc_nand_host *host, uint16_t cmd)
-{
-       MTDDEBUG(MTD_DEBUG_LEVEL3, "send_cmd(host, 0x%x)\n", cmd);
+#if defined(CONFIG_MX27) || defined(CONFIG_MX31)
+#define nfc_is_v1()            1
+#define nfc_is_v21()           0
+#define nfc_is_v3_2()          0
+#define nfc_is_v3()            nfc_is_v3_2()
+#define NFC_VERSION            "V1"
+#elif defined(CONFIG_MX25) || defined(CONFIG_MX35)
+#define nfc_is_v1()            0
+#define nfc_is_v21()           1
+#define nfc_is_v3_2()          0
+#define nfc_is_v3()            nfc_is_v3_2()
+#define NFC_VERSION            "V2"
+#elif defined(CONFIG_MX51) || defined(CONFIG_MX53)
+#define nfc_is_v1()            0
+#define nfc_is_v21()           0
+#define nfc_is_v3_2()          1
+#define nfc_is_v3()            nfc_is_v3_2()
+#define NFC_VERSION            "V3"
+#ifndef CONFIG_MXC_NAND_IP_BASE
+#error CONFIG_MXC_NAND_IP_BASE not defined
+#endif
+#else
+#error mxc_nand driver not supported on this platform
+#define NFC_VERSION            "unknown"
+#endif
 
-       writew(cmd, &host->regs->nfc_flash_cmd);
-       writew(NFC_CMD, &host->regs->nfc_config2);
+#ifndef CONFIG_MXC_NAND_IP_BASE
+#define CONFIG_MXC_NAND_IP_BASE        0
+#endif
 
-       /* Wait for operation to complete */
-       wait_op_done(host, TROP_US_DELAY, cmd);
-}
+/* Addresses for NFC registers */
+#define NFC_V1_V2_BUF_SIZE             (host->regs + 0x00)
+#define NFC_V1_V2_BUF_ADDR             (host->regs + 0x04)
+#define NFC_V1_V2_FLASH_ADDR           (host->regs + 0x06)
+#define NFC_V1_V2_FLASH_CMD            (host->regs + 0x08)
+#define NFC_V1_V2_CONFIG               (host->regs + 0x0a)
+#define NFC_V1_V2_ECC_STATUS_RESULT    (host->regs + 0x0c)
+#define NFC_V1_V2_RSLTMAIN_AREA                (host->regs + 0x0e)
+#define NFC_V1_V2_RSLTSPARE_AREA       (host->regs + 0x10)
+#define NFC_V1_V2_WRPROT               (host->regs + 0x12)
+#define NFC_V1_UNLOCKSTART_BLKADDR     (host->regs + 0x14)
+#define NFC_V1_UNLOCKEND_BLKADDR       (host->regs + 0x16)
+#define NFC_V21_UNLOCKSTART_BLKADDR0   (host->regs + 0x20)
+#define NFC_V21_UNLOCKSTART_BLKADDR1   (host->regs + 0x24)
+#define NFC_V21_UNLOCKSTART_BLKADDR2   (host->regs + 0x28)
+#define NFC_V21_UNLOCKSTART_BLKADDR3   (host->regs + 0x2c)
+#define NFC_V21_UNLOCKEND_BLKADDR0     (host->regs + 0x22)
+#define NFC_V21_UNLOCKEND_BLKADDR1     (host->regs + 0x26)
+#define NFC_V21_UNLOCKEND_BLKADDR2     (host->regs + 0x2a)
+#define NFC_V21_UNLOCKEND_BLKADDR3     (host->regs + 0x2e)
+#define NFC_V1_V2_NF_WRPRST            (host->regs + 0x18)
+#define NFC_V1_V2_CONFIG1              (host->regs + 0x1a)
+#define NFC_V1_V2_CONFIG2              (host->regs + 0x1c)
+
+#define NFC_V2_CONFIG1_ECC_MODE_4      (1 << 0)
+#define NFC_V1_V2_CONFIG1_SP_EN                (1 << 2)
+#define NFC_V1_V2_CONFIG1_ECC_EN       (1 << 3)
+#define NFC_V1_V2_CONFIG1_INT_MSK      (1 << 4)
+#define NFC_V1_V2_CONFIG1_BIG          (1 << 5)
+#define NFC_V1_V2_CONFIG1_RST          (1 << 6)
+#define NFC_V1_V2_CONFIG1_CE           (1 << 7)
+#define NFC_V2_CONFIG1_ONE_CYCLE       (1 << 8)
+#define NFC_V2_CONFIG1_PPB(x)          (((x) & 0x3) << 9)
+#define NFC_V2_CONFIG1_FP_INT          (1 << 11)
+
+#define NFC_V1_V2_CONFIG2_INT          (1 << 15)
 
 /*
- * This function sends an address (or partial address) to the
- * NAND device. The address is used to select the source/destination for
- * a NAND command.
+ * Operation modes for the NFC. Valid for v1, v2 and v3
+ * type controllers.
  */
-static void send_addr(struct mxc_nand_host *host, uint16_t addr)
-{
-       MTDDEBUG(MTD_DEBUG_LEVEL3, "send_addr(host, 0x%x)\n", addr);
+#define NFC_CMD                                (1 << 0)
+#define NFC_ADDR                       (1 << 1)
+#define NFC_INPUT                      (1 << 2)
+#define NFC_OUTPUT                     (1 << 3)
+#define NFC_ID                         (1 << 4)
+#define NFC_STATUS                     (1 << 5)
+
+#define NFC_V3_FLASH_CMD               (host->regs_axi + 0x00)
+#define NFC_V3_FLASH_ADDR0             (host->regs_axi + 0x04)
+
+#define NFC_V3_CONFIG1                 (host->regs_axi + 0x34)
+#define NFC_V3_CONFIG1_SP_EN           (1 << 0)
+#define NFC_V3_CONFIG1_RBA(x)          (((x) & 0x7 ) << 4)
+
+#define NFC_V3_ECC_STATUS_RESULT       (host->regs_axi + 0x38)
+
+#define NFC_V3_LAUNCH                  (host->regs_axi + 0x40)
+
+#define NFC_V3_WRPROT                  (host->regs_ip + 0x0)
+#define NFC_V3_WRPROT_LOCK_TIGHT       (1 << 0)
+#define NFC_V3_WRPROT_LOCK             (1 << 1)
+#define NFC_V3_WRPROT_UNLOCK           (1 << 2)
+#define NFC_V3_WRPROT_BLS_UNLOCK       (2 << 6)
+
+#define NFC_V3_WRPROT_UNLOCK_BLK_ADD0   (host->regs_ip + 0x04)
+
+#define NFC_V3_CONFIG2                 (host->regs_ip + 0x24)
+#define NFC_V3_CONFIG2_PS_512                  (0 << 0)
+#define NFC_V3_CONFIG2_PS_2048                 (1 << 0)
+#define NFC_V3_CONFIG2_PS_4096                 (2 << 0)
+#define NFC_V3_CONFIG2_ONE_CYCLE               (1 << 2)
+#define NFC_V3_CONFIG2_ECC_EN                  (1 << 3)
+#define NFC_V3_CONFIG2_2CMD_PHASES             (1 << 4)
+#define NFC_V3_CONFIG2_NUM_ADDR_PHASE0         (1 << 5)
+#define NFC_V3_CONFIG2_ECC_MODE_8              (1 << 6)
+#define NFC_V3_CONFIG2_PPB(x)                  (((x) & 0x3) << 7)
+#define MX53_CONFIG2_PPB(x)                    (((x) & 0x3) << 8)
+#define NFC_V3_CONFIG2_NUM_ADDR_PHASE1(x)      (((x) & 0x3) << 12)
+#define NFC_V3_CONFIG2_INT_MSK                 (1 << 15)
+#define NFC_V3_CONFIG2_ST_CMD(x)               (((x) & 0xff) << 24)
+#define NFC_V3_CONFIG2_SPAS(x)                 (((x) & 0xff) << 16)
+
+#define NFC_V3_CONFIG3                         (host->regs_ip + 0x28)
+#define NFC_V3_CONFIG3_ADD_OP(x)               (((x) & 0x3) << 0)
+#define NFC_V3_CONFIG3_FW8                     (1 << 3)
+#define NFC_V3_CONFIG3_SBB(x)                  (((x) & 0x7) << 8)
+#define NFC_V3_CONFIG3_NUM_OF_DEVICES(x)       (((x) & 0x7) << 12)
+#define NFC_V3_CONFIG3_RBB_MODE                        (1 << 15)
+#define NFC_V3_CONFIG3_NO_SDMA                 (1 << 20)
+
+#define NFC_V3_IPC                     (host->regs_ip + 0x2C)
+#define NFC_V3_IPC_CREQ                        (1 << 0)
+#define NFC_V3_IPC_CACK                        (1 << 1)
+#define NFC_V3_IPC_INT                 (1 << 31)
+
+#define NFC_V3_DELAY_LINE              (host->regs_ip + 0x34)
 
-       writew(addr, &host->regs->nfc_flash_addr);
-       writew(NFC_ADDR, &host->regs->nfc_config2);
+struct mxc_nand_host {
+       struct mtd_info         mtd;
+       struct nand_chip        nand;
 
-       /* Wait for operation to complete */
-       wait_op_done(host, TROP_US_DELAY, addr);
-}
+       void                    *spare0;
+       void                    *main_area0;
 
-/*
- * This function requests the NANDFC to initiate the transfer
- * of data currently in the NANDFC RAM buffer to the NAND device.
- */
-static void send_prog_page(struct mxc_nand_host *host, uint8_t buf_id,
-                       int spare_only)
-{
-       if (spare_only)
-               MTDDEBUG(MTD_DEBUG_LEVEL1, "send_prog_page (%d)\n", spare_only);
+       void __iomem            *base;
+       void __iomem            *regs;
+       void __iomem            *regs_axi;
+       void __iomem            *regs_ip;
+       int                     status_request;
+       int                     eccsize;
+       int                     active_cs;
+
+       uint8_t                 *data_buf;
+       unsigned int            buf_start;
+       int                     spare_len;
+
+       void                    (*preset)(struct mtd_info *);
+       void                    (*send_cmd)(struct mxc_nand_host *, uint16_t, int);
+       void                    (*send_addr)(struct mxc_nand_host *, uint16_t, int);
+       void                    (*send_page)(struct mtd_info *, unsigned int);
+       void                    (*send_read_id)(struct mxc_nand_host *);
+       uint16_t                (*get_dev_status)(struct mxc_nand_host *);
+       int                     (*check_int)(struct mxc_nand_host *);
+};
 
-       if (is_mxc_nfc_11()) {
-               int i;
-               /*
-                *  The controller copies the 64 bytes of spare data from
-                *  the first 16 bytes of each of the 4 64 byte spare buffers.
-                *  Copy the contiguous data starting in spare_area[0] to
-                *  the four spare area buffers.
-                */
-               for (i = 1; i < 4; i++) {
-                       void __iomem *src = &host->regs->spare_area[0][i * 16];
-                       void __iomem *dst = &host->regs->spare_area[i][0];
+/* OOB placement block for use with hardware ecc generation */
+static struct nand_ecclayout nandv1_hw_eccoob_smallpage = {
+       .eccbytes = 5,
+       .eccpos = {6, 7, 8, 9, 10},
+       .oobfree = {{0, 5}, {12, 4}, }
+};
 
-                       mxc_nand_memcpy32(dst, src, 16);
-               }
+static struct nand_ecclayout nandv1_hw_eccoob_largepage = {
+       .eccbytes = 20,
+       .eccpos = {6, 7, 8, 9, 10, 22, 23, 24, 25, 26,
+                  38, 39, 40, 41, 42, 54, 55, 56, 57, 58},
+       .oobfree = {{2, 4}, {11, 10}, {27, 10}, {43, 10}, {59, 5}, }
+};
+
+/* OOB description for 512 byte pages with 16 byte OOB */
+static struct nand_ecclayout nandv2_hw_eccoob_smallpage = {
+       .eccbytes = 1 * 9,
+       .eccpos = {
+                7,  8,  9, 10, 11, 12, 13, 14, 15
+       },
+       .oobfree = {
+               {.offset = 0, .length = 5}
        }
+};
 
-       writew(buf_id, &host->regs->nfc_buf_addr);
+/* OOB description for 2048 byte pages with 64 byte OOB */
+static struct nand_ecclayout nandv2_hw_eccoob_largepage = {
+       .eccbytes = 4 * 9,
+       .eccpos = {
+                7,  8,  9, 10, 11, 12, 13, 14, 15,
+               23, 24, 25, 26, 27, 28, 29, 30, 31,
+               39, 40, 41, 42, 43, 44, 45, 46, 47,
+               55, 56, 57, 58, 59, 60, 61, 62, 63
+       },
+       .oobfree = {
+               {.offset = 2, .length = 4},
+               {.offset = 16, .length = 7},
+               {.offset = 32, .length = 7},
+               {.offset = 48, .length = 7}
+       }
+};
 
-       /* Configure spare or page+spare access */
-       if (!host->pagesize_2k) {
-               uint16_t config1 = readw(&host->regs->nfc_config1);
-               if (spare_only)
-                       config1 |= NFC_SP_EN;
-               else
-                       config1 &= ~(NFC_SP_EN);
-               writew(config1, &host->regs->nfc_config1);
+/* OOB description for 4096 byte pages with 128 byte OOB */
+static struct nand_ecclayout nandv2_hw_eccoob_4k = {
+       .eccbytes = 8 * 9,
+       .eccpos = {
+               7,  8,  9, 10, 11, 12, 13, 14, 15,
+               23, 24, 25, 26, 27, 28, 29, 30, 31,
+               39, 40, 41, 42, 43, 44, 45, 46, 47,
+               55, 56, 57, 58, 59, 60, 61, 62, 63,
+               71, 72, 73, 74, 75, 76, 77, 78, 79,
+               87, 88, 89, 90, 91, 92, 93, 94, 95,
+               103, 104, 105, 106, 107, 108, 109, 110, 111,
+               119, 120, 121, 122, 123, 124, 125, 126, 127,
+       },
+       .oobfree = {
+               {.offset = 2, .length = 4},
+               {.offset = 16, .length = 7},
+               {.offset = 32, .length = 7},
+               {.offset = 48, .length = 7},
+               {.offset = 64, .length = 7},
+               {.offset = 80, .length = 7},
+               {.offset = 96, .length = 7},
+               {.offset = 112, .length = 7},
        }
+};
+
+static int check_int_v3(struct mxc_nand_host *host)
+{
+       uint32_t tmp;
 
-       writew(NFC_INPUT, &host->regs->nfc_config2);
+       tmp = readl(NFC_V3_IPC);
+       if (!(tmp & NFC_V3_IPC_INT))
+               return 0;
 
-       /* Wait for operation to complete */
-       wait_op_done(host, TROP_US_DELAY, spare_only);
+       tmp &= ~NFC_V3_IPC_INT;
+       writel(tmp, NFC_V3_IPC);
+
+       return 1;
 }
 
-/*
- * Requests NANDFC to initiate the transfer of data from the
- * NAND device into in the NANDFC ram buffer.
- */
-static void send_read_page(struct mxc_nand_host *host, uint8_t buf_id,
-               int spare_only)
+static int check_int_v1_v2(struct mxc_nand_host *host)
 {
-       MTDDEBUG(MTD_DEBUG_LEVEL3, "send_read_page (%d)\n", spare_only);
-
-       writew(buf_id, &host->regs->nfc_buf_addr);
+       uint32_t tmp;
 
-       /* Configure spare or page+spare access */
-       if (!host->pagesize_2k) {
-               uint32_t config1 = readw(&host->regs->nfc_config1);
-               if (spare_only)
-                       config1 |= NFC_SP_EN;
-               else
-                       config1 &= ~NFC_SP_EN;
-               writew(config1, &host->regs->nfc_config1);
-       }
+       tmp = readw(NFC_V1_V2_CONFIG2);
+       if (!(tmp & NFC_V1_V2_CONFIG2_INT))
+               return 0;
 
-       writew(NFC_OUTPUT, &host->regs->nfc_config2);
+       writew(tmp & ~NFC_V1_V2_CONFIG2_INT, NFC_V1_V2_CONFIG2);
 
-       /* Wait for operation to complete */
-       wait_op_done(host, TROP_US_DELAY, spare_only);
+       return 1;
+}
 
-       if (is_mxc_nfc_11()) {
-               int i;
+/* This function polls the NANDFC to wait for the basic operation to
+ * complete by checking the INT bit of config2 register.
+ */
+static void wait_op_done(struct mxc_nand_host *host, bool useirq)
+{
+       int max_retries = 8000;
 
-               /*
-                *  The controller copies the 64 bytes of spare data to
-                *  the first 16 bytes of each of the 4 spare buffers.
-                *  Make the data contiguous starting in spare_area[0].
-                */
-               for (i = 1; i < 4; i++) {
-                       void __iomem *src = &host->regs->spare_area[i][0];
-                       void __iomem *dst = &host->regs->spare_area[0][i * 16];
+       while (max_retries-- > 0) {
+               if (host->check_int(host))
+                       break;
 
-                       mxc_nand_memcpy32(dst, src, 16);
-               }
+               udelay(1);
        }
+       if (max_retries < 0)
+               pr_debug("%s: INT not set\n", __func__);
 }
 
-/* Request the NANDFC to perform a read of the NAND device ID. */
-static void send_read_id(struct mxc_nand_host *host)
+static void send_cmd_v3(struct mxc_nand_host *host, uint16_t cmd, int useirq)
 {
-       uint16_t tmp;
-
-       /* NANDFC buffer 0 is used for device ID output */
-       writew(0x0, &host->regs->nfc_buf_addr);
+       /* fill command */
+       writel(cmd, NFC_V3_FLASH_CMD);
 
-       /* Read ID into main buffer */
-       tmp = readw(&host->regs->nfc_config1);
-       tmp &= ~NFC_SP_EN;
-       writew(tmp, &host->regs->nfc_config1);
-
-       writew(NFC_ID, &host->regs->nfc_config2);
+       /* send out command */
+       writel(NFC_CMD, NFC_V3_LAUNCH);
 
        /* Wait for operation to complete */
-       wait_op_done(host, TROP_US_DELAY, 0);
+       wait_op_done(host, useirq);
 }
 
-/*
- * This function requests the NANDFC to perform a read of the
- * NAND device status and returns the current status.
- */
-static uint16_t get_dev_status(struct mxc_nand_host *host)
+/* This function issues the specified command to the NAND device and
+ * waits for completion. */
+static void send_cmd_v1_v2(struct mxc_nand_host *host, uint16_t cmd, int useirq)
 {
-       void __iomem *main_buf = host->regs->main_area[1];
-       uint32_t store;
-       uint16_t ret, tmp;
-       /* Issue status request to NAND device */
-
-       /* store the main area1 first word, later do recovery */
-       store = readl(main_buf);
-       /* NANDFC buffer 1 is used for device status */
-       writew(1, &host->regs->nfc_buf_addr);
-
-       /* Read status into main buffer */
-       tmp = readw(&host->regs->nfc_config1);
-       tmp &= ~NFC_SP_EN;
-       writew(tmp, &host->regs->nfc_config1);
+       pr_debug("send_cmd(host, 0x%x, %d)\n", cmd, useirq);
 
-       writew(NFC_STATUS, &host->regs->nfc_config2);
+       writew(cmd, NFC_V1_V2_FLASH_CMD);
+       writew(NFC_CMD, NFC_V1_V2_CONFIG2);
 
        /* Wait for operation to complete */
-       wait_op_done(host, TROP_US_DELAY, 0);
-
-       /*
-        *  Status is placed in first word of main buffer
-        * get status, then recovery area 1 data
-        */
-       ret = readw(main_buf);
-       writel(store, main_buf);
-
-       return ret;
+       wait_op_done(host, useirq);
 }
 
-/* This function is used by upper layer to checks if device is ready */
-static int mxc_nand_dev_ready(struct mtd_info *mtd)
+static void send_addr_v3(struct mxc_nand_host *host, uint16_t addr, int islast)
 {
-       /*
-        * NFC handles R/B internally. Therefore, this function
-        * always returns status as ready.
-        */
-       return 1;
-}
+       /* fill address */
+       writel(addr, NFC_V3_FLASH_ADDR0);
 
-#ifdef CONFIG_MXC_NAND_HWECC
-static void mxc_nand_enable_hwecc(struct mtd_info *mtd, int mode)
-{
-       /*
-        * If HW ECC is enabled, we turn it on during init. There is
-        * no need to enable again here.
-        */
+       /* send out address */
+       writel(NFC_ADDR, NFC_V3_LAUNCH);
+
+       wait_op_done(host, islast);
 }
 
-#ifdef MXC_NFC_V1_1
-static void _mxc_nand_enable_hwecc(struct mtd_info *mtd, int on)
+/* This function sends an address (or partial address) to the
+ * NAND device. The address is used to select the source/destination for
+ * a NAND command. */
+static void send_addr_v1_v2(struct mxc_nand_host *host, uint16_t addr, int islast)
 {
-       struct nand_chip *nand_chip = mtd->priv;
-       struct mxc_nand_host *host = nand_chip->priv;
-       uint16_t tmp = readw(&host->regs->nfc_config1);
+       pr_debug("send_addr(host, 0x%x %d)\n", addr, islast);
 
-       if (on)
-               tmp |= NFC_ECC_EN;
-       else
-               tmp &= ~NFC_ECC_EN;
-       writew(tmp, &host->regs->nfc_config1);
-}
+       writew(addr, NFC_V1_V2_FLASH_ADDR);
+       writew(NFC_ADDR, NFC_V1_V2_CONFIG2);
 
-static int mxc_nand_read_oob_syndrome(struct mtd_info *mtd,
-                                     struct nand_chip *chip,
-                                     int page, int sndcmd)
-{
-       struct mxc_nand_host *host = chip->priv;
-       uint8_t *buf = chip->oob_poi;
-       int length = mtd->oobsize;
-       int eccpitch = chip->ecc.bytes + chip->ecc.prepad + chip->ecc.postpad;
-       uint8_t *bufpoi = buf;
-       int i, toread;
-
-       MTDDEBUG(MTD_DEBUG_LEVEL0,
-                       "%s: Reading OOB area of page %u to oob %p\n",
-                        __FUNCTION__, host->page_addr, buf);
-
-       chip->cmdfunc(mtd, NAND_CMD_READOOB, mtd->writesize, page);
-       for (i = 0; i < chip->ecc.steps; i++) {
-               toread = min_t(int, length, chip->ecc.prepad);
-               if (toread) {
-                       chip->read_buf(mtd, bufpoi, toread);
-                       bufpoi += toread;
-                       length -= toread;
-               }
-               bufpoi += chip->ecc.bytes;
-               host->col_addr += chip->ecc.bytes;
-               length -= chip->ecc.bytes;
-
-               toread = min_t(int, length, chip->ecc.postpad);
-               if (toread) {
-                       chip->read_buf(mtd, bufpoi, toread);
-                       bufpoi += toread;
-                       length -= toread;
-               }
-       }
-       if (length > 0)
-               chip->read_buf(mtd, bufpoi, length);
-
-       _mxc_nand_enable_hwecc(mtd, 0);
-       chip->cmdfunc(mtd, NAND_CMD_READOOB,
-                       mtd->writesize + chip->ecc.prepad, page);
-       bufpoi = buf + chip->ecc.prepad;
-       length = mtd->oobsize - chip->ecc.prepad;
-       for (i = 0; i < chip->ecc.steps; i++) {
-               toread = min_t(int, length, chip->ecc.bytes);
-               chip->read_buf(mtd, bufpoi, toread);
-               bufpoi += eccpitch;
-               length -= eccpitch;
-               host->col_addr += chip->ecc.postpad + chip->ecc.prepad;
-       }
-       _mxc_nand_enable_hwecc(mtd, 1);
-       return 1;
+       /* Wait for operation to complete */
+       wait_op_done(host, islast);
 }
 
-static int mxc_nand_read_page_raw_syndrome(struct mtd_info *mtd,
-                                          struct nand_chip *chip,
-                                          uint8_t *buf,
-                                          int page)
+static void send_page_v3(struct mtd_info *mtd, unsigned int ops)
 {
-       struct mxc_nand_host *host = chip->priv;
-       int eccsize = chip->ecc.size;
-       int eccbytes = chip->ecc.bytes;
-       int eccpitch = eccbytes + chip->ecc.prepad + chip->ecc.postpad;
-       uint8_t *oob = chip->oob_poi;
-       int steps, size;
-       int n;
-
-       _mxc_nand_enable_hwecc(mtd, 0);
-       chip->cmdfunc(mtd, NAND_CMD_READ0, 0x00, host->page_addr);
-
-       for (n = 0, steps = chip->ecc.steps; steps > 0; n++, steps--) {
-               host->col_addr = n * eccsize;
-               chip->read_buf(mtd, buf, eccsize);
-               buf += eccsize;
-
-               host->col_addr = mtd->writesize + n * eccpitch;
-               if (chip->ecc.prepad) {
-                       chip->read_buf(mtd, oob, chip->ecc.prepad);
-                       oob += chip->ecc.prepad;
-               }
-
-               chip->read_buf(mtd, oob, eccbytes);
-               oob += eccbytes;
+       struct nand_chip *nand_chip = mtd->priv;
+       struct mxc_nand_host *host = nand_chip->priv;
+       uint32_t tmp;
 
-               if (chip->ecc.postpad) {
-                       chip->read_buf(mtd, oob, chip->ecc.postpad);
-                       oob += chip->ecc.postpad;
-               }
-       }
+       tmp = readl(NFC_V3_CONFIG1);
+       tmp &= ~(7 << 4);
+       writel(tmp, NFC_V3_CONFIG1);
 
-       size = mtd->oobsize - (oob - chip->oob_poi);
-       if (size)
-               chip->read_buf(mtd, oob, size);
-       _mxc_nand_enable_hwecc(mtd, 0);
+       /* transfer data from NFC ram to nand */
+       writel(ops, NFC_V3_LAUNCH);
 
-       return 0;
+       wait_op_done(host, false);
 }
 
-static int mxc_nand_read_page_syndrome(struct mtd_info *mtd,
-                                      struct nand_chip *chip,
-                                      uint8_t *buf,
-                                      int page)
+static void send_page_v1_v2(struct mtd_info *mtd, unsigned int ops)
 {
-       struct mxc_nand_host *host = chip->priv;
-       int n, eccsize = chip->ecc.size;
-       int eccbytes = chip->ecc.bytes;
-       int eccpitch = eccbytes + chip->ecc.prepad + chip->ecc.postpad;
-       int eccsteps = chip->ecc.steps;
-       uint8_t *p = buf;
-       uint8_t *oob = chip->oob_poi;
-
-       MTDDEBUG(MTD_DEBUG_LEVEL1, "Reading page %u to buf %p oob %p\n",
-             host->page_addr, buf, oob);
+       struct nand_chip *nand_chip = mtd->priv;
+       struct mxc_nand_host *host = nand_chip->priv;
+       int bufs, i;
 
-       /* first read the data area and the available portion of OOB */
-       for (n = 0; eccsteps; n++, eccsteps--, p += eccsize) {
-               int stat;
+       if (nfc_is_v1() && mtd->writesize > 512)
+               bufs = 4;
+       else
+               bufs = 1;
 
-               host->col_addr = n * eccsize;
+       for (i = 0; i < bufs; i++) {
 
-               chip->read_buf(mtd, p, eccsize);
+               /* NANDFC buffer 0 is used for page read/write */
+               writew((host->active_cs << 4) | i, NFC_V1_V2_BUF_ADDR);
 
-               host->col_addr = mtd->writesize + n * eccpitch;
+               writew(ops, NFC_V1_V2_CONFIG2);
 
-               if (chip->ecc.prepad) {
-                       chip->read_buf(mtd, oob, chip->ecc.prepad);
-                       oob += chip->ecc.prepad;
-               }
+               /* Wait for operation to complete */
+               wait_op_done(host, true);
+       }
+}
 
-               stat = chip->ecc.correct(mtd, p, oob, NULL);
+static void send_read_id_v3(struct mxc_nand_host *host)
+{
+       /* Read ID into main buffer */
+       writel(NFC_ID, NFC_V3_LAUNCH);
 
-               if (stat < 0)
-                       mtd->ecc_stats.failed++;
-               else
-                       mtd->ecc_stats.corrected += stat;
-               oob += eccbytes;
+       wait_op_done(host, true);
 
-               if (chip->ecc.postpad) {
-                       chip->read_buf(mtd, oob, chip->ecc.postpad);
-                       oob += chip->ecc.postpad;
-               }
-       }
+       memcpy(host->data_buf, host->main_area0, 16);
 
-       /* Calculate remaining oob bytes */
-       n = mtd->oobsize - (oob - chip->oob_poi);
-       if (n)
-               chip->read_buf(mtd, oob, n);
-
-       /* Then switch ECC off and read the OOB area to get the ECC code */
-       _mxc_nand_enable_hwecc(mtd, 0);
-       chip->cmdfunc(mtd, NAND_CMD_READOOB, mtd->writesize, host->page_addr);
-       eccsteps = chip->ecc.steps;
-       oob = chip->oob_poi + chip->ecc.prepad;
-       for (n = 0; eccsteps; n++, eccsteps--, p += eccsize) {
-               host->col_addr = mtd->writesize +
-                                n * eccpitch +
-                                chip->ecc.prepad;
-               chip->read_buf(mtd, oob, eccbytes);
-               oob += eccbytes + chip->ecc.postpad;
-       }
-       _mxc_nand_enable_hwecc(mtd, 1);
-       return 0;
+       pr_debug("read ID %02x %02x %02x %02x\n",
+               host->data_buf[0], host->data_buf[1],
+               host->data_buf[2], host->data_buf[3]);
 }
 
-static int mxc_nand_write_oob_syndrome(struct mtd_info *mtd,
-                                      struct nand_chip *chip, int page)
+/* Request the NANDFC to perform a read of the NAND device ID. */
+static void send_read_id_v1_v2(struct mxc_nand_host *host)
 {
-       struct mxc_nand_host *host = chip->priv;
-       int eccpitch = chip->ecc.bytes + chip->ecc.prepad + chip->ecc.postpad;
-       int length = mtd->oobsize;
-       int i, len, status, steps = chip->ecc.steps;
-       const uint8_t *bufpoi = chip->oob_poi;
-
-       chip->cmdfunc(mtd, NAND_CMD_SEQIN, mtd->writesize, page);
-       for (i = 0; i < steps; i++) {
-               len = min_t(int, length, eccpitch);
-
-               chip->write_buf(mtd, bufpoi, len);
-               bufpoi += len;
-               length -= len;
-               host->col_addr += chip->ecc.prepad + chip->ecc.postpad;
-       }
-       if (length > 0)
-               chip->write_buf(mtd, bufpoi, length);
+       struct nand_chip *this = &host->nand;
 
-       chip->cmdfunc(mtd, NAND_CMD_PAGEPROG, -1, -1);
-       status = chip->waitfunc(mtd, chip);
-       return status & NAND_STATUS_FAIL ? -EIO : 0;
-}
+       /* NANDFC buffer 0 is used for device ID output */
+       writew(host->active_cs << 4, NFC_V1_V2_BUF_ADDR);
 
-static void mxc_nand_write_page_raw_syndrome(struct mtd_info *mtd,
-                                            struct nand_chip *chip,
-                                            const uint8_t *buf)
-{
-       struct mxc_nand_host *host = chip->priv;
-       int eccsize = chip->ecc.size;
-       int eccbytes = chip->ecc.bytes;
-       int eccpitch = eccbytes + chip->ecc.prepad + chip->ecc.postpad;
-       uint8_t *oob = chip->oob_poi;
-       int steps, size;
-       int n;
-
-       for (n = 0, steps = chip->ecc.steps; steps > 0; n++, steps--) {
-               host->col_addr = n * eccsize;
-               chip->write_buf(mtd, buf, eccsize);
-               buf += eccsize;
-
-               host->col_addr = mtd->writesize + n * eccpitch;
-
-               if (chip->ecc.prepad) {
-                       chip->write_buf(mtd, oob, chip->ecc.prepad);
-                       oob += chip->ecc.prepad;
-               }
+       writew(NFC_ID, NFC_V1_V2_CONFIG2);
 
-               host->col_addr += eccbytes;
-               oob += eccbytes;
+       /* Wait for operation to complete */
+       wait_op_done(host, true);
 
-               if (chip->ecc.postpad) {
-                       chip->write_buf(mtd, oob, chip->ecc.postpad);
-                       oob += chip->ecc.postpad;
-               }
-       }
+       memcpy(host->data_buf, host->main_area0, 16);
 
-       size = mtd->oobsize - (oob - chip->oob_poi);
-       if (size)
-               chip->write_buf(mtd, oob, size);
+       if (this->options & NAND_BUSWIDTH_16) {
+               /* compress the ID info */
+               host->data_buf[1] = host->data_buf[2];
+               host->data_buf[2] = host->data_buf[4];
+               host->data_buf[3] = host->data_buf[6];
+               host->data_buf[4] = host->data_buf[8];
+               host->data_buf[5] = host->data_buf[10];
+       }
 }
 
-static void mxc_nand_write_page_syndrome(struct mtd_info *mtd,
-                                        struct nand_chip *chip,
-                                        const uint8_t *buf)
+static uint16_t get_dev_status_v3(struct mxc_nand_host *host)
 {
-       struct mxc_nand_host *host = chip->priv;
-       int i, n, eccsize = chip->ecc.size;
-       int eccbytes = chip->ecc.bytes;
-       int eccpitch = eccbytes + chip->ecc.prepad + chip->ecc.postpad;
-       int eccsteps = chip->ecc.steps;
-       const uint8_t *p = buf;
-       uint8_t *oob = chip->oob_poi;
+       writel(NFC_STATUS, NFC_V3_LAUNCH);
+       wait_op_done(host, true);
 
-       chip->ecc.hwctl(mtd, NAND_ECC_WRITE);
+       return readl(NFC_V3_CONFIG1) >> 16;
+}
 
-       for (i = n = 0;
-            eccsteps;
-            n++, eccsteps--, i += eccbytes, p += eccsize) {
-               host->col_addr = n * eccsize;
+/* This function requests the NANDFC to perform a read of the
+ * NAND device status and returns the current status. */
+static uint16_t get_dev_status_v1_v2(struct mxc_nand_host *host)
+{
+       void __iomem *main_buf = host->main_area0;
+       uint32_t store;
+       uint16_t ret;
 
-               chip->write_buf(mtd, p, eccsize);
+       writew(host->active_cs << 4, NFC_V1_V2_BUF_ADDR);
 
-               host->col_addr = mtd->writesize + n * eccpitch;
+       /*
+        * The device status is stored in main_area0. To
+        * prevent corruption of the buffer save the value
+        * and restore it afterwards.
+        */
+       store = readl(main_buf);
 
-               if (chip->ecc.prepad) {
-                       chip->write_buf(mtd, oob, chip->ecc.prepad);
-                       oob += chip->ecc.prepad;
-               }
+       writew(NFC_STATUS, NFC_V1_V2_CONFIG2);
+       wait_op_done(host, true);
 
-               chip->write_buf(mtd, oob, eccbytes);
-               oob += eccbytes;
+       ret = readw(main_buf);
 
-               if (chip->ecc.postpad) {
-                       chip->write_buf(mtd, oob, chip->ecc.postpad);
-                       oob += chip->ecc.postpad;
-               }
-       }
+       writel(store, main_buf);
 
-       /* Calculate remaining oob bytes */
-       i = mtd->oobsize - (oob - chip->oob_poi);
-       if (i)
-               chip->write_buf(mtd, oob, i);
+       return ret;
 }
 
-static int mxc_nand_correct_data(struct mtd_info *mtd, u_char *dat,
-                                u_char *read_ecc, u_char *calc_ecc)
+/* This functions is used by upper layer to checks if device is ready */
+static int mxc_nand_dev_ready(struct mtd_info *mtd)
 {
-       struct nand_chip *nand_chip = mtd->priv;
-       struct mxc_nand_host *host = nand_chip->priv;
-       uint16_t ecc_status = readw(&host->regs->nfc_ecc_status_result);
-       int subpages = mtd->writesize / nand_chip->subpagesize;
-       int pg2blk_shift = nand_chip->phys_erase_shift -
-                          nand_chip->page_shift;
-
-       do {
-               if ((ecc_status & 0xf) > 4) {
-                       static int last_bad = -1;
-
-                       if (last_bad != host->page_addr >> pg2blk_shift) {
-                               last_bad = host->page_addr >> pg2blk_shift;
-                               printk(KERN_DEBUG
-                                      "MXC_NAND: HWECC uncorrectable ECC error"
-                                      " in block %u page %u subpage %d\n",
-                                      last_bad, host->page_addr,
-                                      mtd->writesize / nand_chip->subpagesize
-                                           - subpages);
-                       }
-                       return -1;
-               }
-               ecc_status >>= 4;
-               subpages--;
-       } while (subpages > 0);
+       /*
+        * NFC handles R/B internally. Therefore, this function
+        * always returns status as ready.
+        */
+       return 1;
+}
 
-       return 0;
+static void mxc_nand_enable_hwecc(struct mtd_info *mtd, int mode)
+{
+       /*
+        * If HW ECC is enabled, we turn it on during init. There is
+        * no need to enable again here.
+        */
 }
-#else
-#define mxc_nand_read_page_syndrome NULL
-#define mxc_nand_read_page_raw_syndrome NULL
-#define mxc_nand_read_oob_syndrome NULL
-#define mxc_nand_write_page_syndrome NULL
-#define mxc_nand_write_page_raw_syndrome NULL
-#define mxc_nand_write_oob_syndrome NULL
-#define mxc_nfc_11_nand_correct_data NULL
-
-static int mxc_nand_correct_data(struct mtd_info *mtd, u_char *dat,
+
+static int mxc_nand_correct_data_v1(struct mtd_info *mtd, u_char *dat,
                                 u_char *read_ecc, u_char *calc_ecc)
 {
        struct nand_chip *nand_chip = mtd->priv;
@@ -845,61 +571,72 @@ static int mxc_nand_correct_data(struct mtd_info *mtd, u_char *dat,
         * additional correction.  2-Bit errors cannot be corrected by
         * HW ECC, so we need to return failure
         */
-       uint16_t ecc_status = readw(&host->regs->nfc_ecc_status_result);
+       uint16_t ecc_status = readw(NFC_V1_V2_ECC_STATUS_RESULT);
 
        if (((ecc_status & 0x3) == 2) || ((ecc_status >> 2) == 2)) {
-               MTDDEBUG(MTD_DEBUG_LEVEL0,
-                     "MXC_NAND: HWECC uncorrectable 2-bit ECC error\n");
+               printk("MXC_NAND: HWECC uncorrectable 2-bit ECC error\n");
                return -1;
        }
 
        return 0;
 }
-#endif
+
+static int mxc_nand_correct_data_v2_v3(struct mtd_info *mtd, u_char *dat,
+                                u_char *read_ecc, u_char *calc_ecc)
+{
+       struct nand_chip *nand_chip = mtd->priv;
+       struct mxc_nand_host *host = nand_chip->priv;
+       u32 ecc_stat, err;
+       int no_subpages = 1;
+       int ret = 0;
+       u8 ecc_bit_mask, err_limit;
+
+       ecc_bit_mask = (host->eccsize == 4) ? 0x7 : 0xf;
+       err_limit = (host->eccsize == 4) ? 0x4 : 0x8;
+
+       no_subpages = mtd->writesize >> 9;
+
+       if (nfc_is_v21())
+               ecc_stat = readl(NFC_V1_V2_ECC_STATUS_RESULT);
+       else
+               ecc_stat = readl(NFC_V3_ECC_STATUS_RESULT);
+
+       do {
+               err = ecc_stat & ecc_bit_mask;
+               if (err > err_limit) {
+                       printk(KERN_WARNING "UnCorrectable RS-ECC Error\n");
+                       return -1;
+               } else {
+                       ret += err;
+               }
+               ecc_stat >>= 4;
+       } while (--no_subpages);
+
+       mtd->ecc_stats.corrected += ret;
+       if (ret)
+               pr_debug("%d Symbol Correctable RS-ECC Errors\n", ret);
+
+       return ret;
+}
 
 static int mxc_nand_calculate_ecc(struct mtd_info *mtd, const u_char *dat,
                                  u_char *ecc_code)
 {
        return 0;
 }
-#endif
 
 static u_char mxc_nand_read_byte(struct mtd_info *mtd)
 {
        struct nand_chip *nand_chip = mtd->priv;
        struct mxc_nand_host *host = nand_chip->priv;
-       uint8_t ret = 0;
-       uint16_t col;
-       uint16_t __iomem *main_buf =
-               (uint16_t __iomem *)host->regs->main_area[0];
-       uint16_t __iomem *spare_buf =
-               (uint16_t __iomem *)host->regs->spare_area[0];
-       union {
-               uint16_t word;
-               uint8_t bytes[2];
-       } nfc_word;
+       uint8_t ret;
 
        /* Check for status request */
        if (host->status_request)
-               return get_dev_status(host) & 0xFF;
+               return host->get_dev_status(host) & 0xFF;
 
-       /* Get column for 16-bit access */
-       col = host->col_addr >> 1;
-
-       /* If we are accessing the spare region */
-       if (host->spare_only)
-               nfc_word.word = readw(&spare_buf[col]);
-       else
-               nfc_word.word = readw(&main_buf[col]);
-
-       /* Pick upper/lower byte of word from RAM buffer */
-       ret = nfc_word.bytes[host->col_addr & 0x1];
-
-       /* Update saved column address */
-       if (nand_chip->options & NAND_BUSWIDTH_16)
-               host->col_addr += 2;
-       else
-               host->col_addr++;
+       ret = *(uint8_t *)(host->data_buf + host->buf_start);
+       host->buf_start++;
 
        return ret;
 }
@@ -908,246 +645,292 @@ static uint16_t mxc_nand_read_word(struct mtd_info *mtd)
 {
        struct nand_chip *nand_chip = mtd->priv;
        struct mxc_nand_host *host = nand_chip->priv;
-       uint16_t col, ret;
-       uint16_t __iomem *p;
-
-       MTDDEBUG(MTD_DEBUG_LEVEL3,
-             "mxc_nand_read_word(col = %d)\n", host->col_addr);
-
-       col = host->col_addr;
-       /* Adjust saved column address */
-       if (col < mtd->writesize && host->spare_only)
-               col += mtd->writesize;
-
-       if (col < mtd->writesize) {
-               p = (uint16_t __iomem *)(host->regs->main_area[0] +
-                               (col >> 1));
-       } else {
-               p = (uint16_t __iomem *)(host->regs->spare_area[0] +
-                               ((col - mtd->writesize) >> 1));
-       }
-
-       if (col & 1) {
-               union {
-                       uint16_t word;
-                       uint8_t bytes[2];
-               } nfc_word[3];
-
-               nfc_word[0].word = readw(p);
-               nfc_word[1].word = readw(p + 1);
-
-               nfc_word[2].bytes[0] = nfc_word[0].bytes[1];
-               nfc_word[2].bytes[1] = nfc_word[1].bytes[0];
+       uint16_t ret;
 
-               ret = nfc_word[2].word;
-       } else {
-               ret = readw(p);
-       }
-
-       /* Update saved column address */
-       host->col_addr = col + 2;
+       ret = *(uint16_t *)(host->data_buf + host->buf_start);
+       host->buf_start += 2;
 
        return ret;
 }
 
-/*
- * Write data of length len to buffer buf. The data to be
+/* Write data of length len to buffer buf. The data to be
  * written on NAND Flash is first copied to RAMbuffer. After the Data Input
- * Operation by the NFC, the data is written to NAND Flash
- */
+ * Operation by the NFC, the data is written to NAND Flash */
 static void mxc_nand_write_buf(struct mtd_info *mtd,
                                const u_char *buf, int len)
 {
        struct nand_chip *nand_chip = mtd->priv;
        struct mxc_nand_host *host = nand_chip->priv;
-       int n, col, i = 0;
+       u16 col = host->buf_start;
+       int n = mtd->oobsize + mtd->writesize - col;
 
-       MTDDEBUG(MTD_DEBUG_LEVEL3,
-             "mxc_nand_write_buf(col = %d, len = %d)\n", host->col_addr,
-             len);
+       n = min(n, len);
 
-       col = host->col_addr;
+       memcpy(host->data_buf + col, buf, n);
 
-       /* Adjust saved column address */
-       if (col < mtd->writesize && host->spare_only)
-               col += mtd->writesize;
+       host->buf_start += n;
+}
 
-       n = mtd->writesize + mtd->oobsize - col;
-       n = min(len, n);
+/* Read the data buffer from the NAND Flash. To read the data from NAND
+ * Flash first the data output cycle is initiated by the NFC, which copies
+ * the data to RAMbuffer. This data of length len is then copied to buffer buf.
+ */
+static void mxc_nand_read_buf(struct mtd_info *mtd, u_char *buf, int len)
+{
+       struct nand_chip *nand_chip = mtd->priv;
+       struct mxc_nand_host *host = nand_chip->priv;
+       u16 col = host->buf_start;
+       int n = mtd->oobsize + mtd->writesize - col;
 
-       MTDDEBUG(MTD_DEBUG_LEVEL3,
-             "%s:%d: col = %d, n = %d\n", __func__, __LINE__, col, n);
+       n = min(n, len);
 
-       while (n > 0) {
-               void __iomem *p;
+       memcpy(buf, host->data_buf + col, n);
 
-               if (col < mtd->writesize) {
-                       p = host->regs->main_area[0] + (col & ~3);
-               } else {
-                       p = host->regs->spare_area[0] -
-                                               mtd->writesize + (col & ~3);
-               }
+       host->buf_start += n;
+}
 
-               MTDDEBUG(MTD_DEBUG_LEVEL3, "%s:%d: p = %p\n", __func__,
-                     __LINE__, p);
+/* Used by the upper layer to verify the data in NAND Flash
+ * with the data in the buf. */
+static int mxc_nand_verify_buf(struct mtd_info *mtd,
+                               const u_char *buf, int len)
+{
+       return -EFAULT;
+}
 
-               if (((col | (unsigned long)&buf[i]) & 3) || n < 4) {
-                       union {
-                               uint32_t word;
-                               uint8_t bytes[4];
-                       } nfc_word;
+/* This function is used by upper layer for select and
+ * deselect of the NAND chip */
+static void mxc_nand_select_chip(struct mtd_info *mtd, int chip)
+{
+       struct nand_chip *nand_chip = mtd->priv;
+       struct mxc_nand_host *host = nand_chip->priv;
 
-                       nfc_word.word = readl(p);
-                       nfc_word.bytes[col & 3] = buf[i++];
-                       n--;
-                       col++;
+       if (nfc_is_v21()) {
+               host->active_cs = chip;
+               writew(host->active_cs << 4, NFC_V1_V2_BUF_ADDR);
+       }
+}
 
-                       writel(nfc_word.word, p);
-               } else {
-                       int m = mtd->writesize - col;
+/*
+ * Function to transfer data to/from spare area.
+ */
+static void copy_spare(struct mtd_info *mtd, bool bfrom)
+{
+       struct nand_chip *this = mtd->priv;
+       struct mxc_nand_host *host = this->priv;
+       u16 i, j;
+       u16 n = mtd->writesize >> 9;
+       u8 *d = host->data_buf + mtd->writesize;
+       u8 *s = host->spare0;
+       u16 t = host->spare_len;
+
+       j = (mtd->oobsize / n >> 1) << 1;
+
+       if (bfrom) {
+               for (i = 0; i < n - 1; i++)
+                       memcpy(d + i * j, s + i * t, j);
+
+               /* the last section */
+               memcpy(d + i * j, s + i * t, mtd->oobsize - i * j);
+       } else {
+               for (i = 0; i < n - 1; i++)
+                       memcpy(&s[i * t], &d[i * j], j);
 
-                       if (col >= mtd->writesize)
-                               m += mtd->oobsize;
+               /* the last section */
+               memcpy(&s[i * t], &d[i * j], mtd->oobsize - i * j);
+       }
+}
 
-                       m = min(n, m) & ~3;
+static void mxc_do_addr_cycle(struct mtd_info *mtd, int column, int page_addr)
+{
+       struct nand_chip *nand_chip = mtd->priv;
+       struct mxc_nand_host *host = nand_chip->priv;
 
-                       MTDDEBUG(MTD_DEBUG_LEVEL3,
-                             "%s:%d: n = %d, m = %d, i = %d, col = %d\n",
-                             __func__,  __LINE__, n, m, i, col);
+       /* Write out column address, if necessary */
+       if (column != -1) {
+               /*
+                * MXC NANDFC can only perform full page+spare or
+                * spare-only read/write.  When the upper layers
+                * perform a read/write buf operation, the saved column
+                 * address is used to index into the full page.
+                */
+               host->send_addr(host, 0, page_addr == -1);
+               if (mtd->writesize > 512)
+                       /* another col addr cycle for 2k page */
+                       host->send_addr(host, 0, false);
+       }
 
-                       mxc_nand_memcpy32(p, (uint32_t *)&buf[i], m);
-                       col += m;
-                       i += m;
-                       n -= m;
+       /* Write out page address, if necessary */
+       if (page_addr != -1) {
+               /* paddr_0 - p_addr_7 */
+               host->send_addr(host, (page_addr & 0xff), false);
+
+               if (mtd->writesize > 512) {
+                       if (mtd->size >= 0x10000000) {
+                               /* paddr_8 - paddr_15 */
+                               host->send_addr(host, (page_addr >> 8) & 0xff, false);
+                               host->send_addr(host, (page_addr >> 16) & 0xff, true);
+                       } else
+                               /* paddr_8 - paddr_15 */
+                               host->send_addr(host, (page_addr >> 8) & 0xff, true);
+               } else {
+                       /* One more address cycle for higher density devices */
+                       if (mtd->size >= 0x4000000) {
+                               /* paddr_8 - paddr_15 */
+                               host->send_addr(host, (page_addr >> 8) & 0xff, false);
+                               host->send_addr(host, (page_addr >> 16) & 0xff, true);
+                       } else
+                               /* paddr_8 - paddr_15 */
+                               host->send_addr(host, (page_addr >> 8) & 0xff, true);
                }
        }
-       /* Update saved column address */
-       host->col_addr = col;
 }
 
 /*
- * Read the data buffer from the NAND Flash. To read the data from NAND
- * Flash first the data output cycle is initiated by the NFC, which copies
- * the data to RAMbuffer. This data of length len is then copied to buffer buf.
+ * v2 and v3 type controllers can do 4bit or 8bit ecc depending
+ * on how much oob the nand chip has. For 8bit ecc we need at least
+ * 26 bytes of oob data per 512 byte block.
  */
-static void mxc_nand_read_buf(struct mtd_info *mtd, u_char *buf, int len)
+static int get_eccsize(struct mtd_info *mtd)
 {
-       struct nand_chip *nand_chip = mtd->priv;
-       struct mxc_nand_host *host = nand_chip->priv;
-       int n, col, i = 0;
+       int oobbytes_per_512 = 0;
 
-       MTDDEBUG(MTD_DEBUG_LEVEL3,
-             "mxc_nand_read_buf(col = %d, len = %d)\n", host->col_addr, len);
+       oobbytes_per_512 = mtd->oobsize * 512 / mtd->writesize;
 
-       col = host->col_addr;
+       if (oobbytes_per_512 < 26)
+               return 4;
+       else
+               return 8;
+}
 
-       /* Adjust saved column address */
-       if (col < mtd->writesize && host->spare_only)
-               col += mtd->writesize;
+static void preset_v1_v2(struct mtd_info *mtd)
+{
+       struct nand_chip *nand_chip = mtd->priv;
+       struct mxc_nand_host *host = nand_chip->priv;
+       uint16_t config1 = 0;
 
-       n = mtd->writesize + mtd->oobsize - col;
-       n = min(len, n);
+       if (nand_chip->ecc.mode == NAND_ECC_HW)
+               config1 |= NFC_V1_V2_CONFIG1_ECC_EN;
 
-       while (n > 0) {
-               void __iomem *p;
+       if (nfc_is_v21())
+               config1 |= NFC_V2_CONFIG1_FP_INT;
 
-               if (col < mtd->writesize) {
-                       p = host->regs->main_area[0] + (col & ~3);
-               } else {
-                       p = host->regs->spare_area[0] -
-                                       mtd->writesize + (col & ~3);
-               }
+       if (nfc_is_v21() && mtd->writesize) {
+               uint16_t pages_per_block = mtd->erasesize / mtd->writesize;
 
-               if (((col | (int)&buf[i]) & 3) || n < 4) {
-                       union {
-                               uint32_t word;
-                               uint8_t bytes[4];
-                       } nfc_word;
+               host->eccsize = get_eccsize(mtd);
+               if (host->eccsize == 4)
+                       config1 |= NFC_V2_CONFIG1_ECC_MODE_4;
 
-                       nfc_word.word = readl(p);
-                       buf[i++] = nfc_word.bytes[col & 3];
-                       n--;
-                       col++;
-               } else {
-                       int m = mtd->writesize - col;
+               config1 |= NFC_V2_CONFIG1_PPB(ffs(pages_per_block) - 6);
+       } else {
+               host->eccsize = 1;
+       }
 
-                       if (col >= mtd->writesize)
-                               m += mtd->oobsize;
+       writew(config1, NFC_V1_V2_CONFIG1);
+       /* preset operation */
 
-                       m = min(n, m) & ~3;
-                       mxc_nand_memcpy32((uint32_t *)&buf[i], p, m);
+       /* Unlock the internal RAM Buffer */
+       writew(0x2, NFC_V1_V2_CONFIG);
 
-                       col += m;
-                       i += m;
-                       n -= m;
-               }
-       }
-       /* Update saved column address */
-       host->col_addr = col;
+       /* Blocks to be unlocked */
+       if (nfc_is_v21()) {
+               writew(0x0, NFC_V21_UNLOCKSTART_BLKADDR0);
+               writew(0x0, NFC_V21_UNLOCKSTART_BLKADDR1);
+               writew(0x0, NFC_V21_UNLOCKSTART_BLKADDR2);
+               writew(0x0, NFC_V21_UNLOCKSTART_BLKADDR3);
+               writew(0xffff, NFC_V21_UNLOCKEND_BLKADDR0);
+               writew(0xffff, NFC_V21_UNLOCKEND_BLKADDR1);
+               writew(0xffff, NFC_V21_UNLOCKEND_BLKADDR2);
+               writew(0xffff, NFC_V21_UNLOCKEND_BLKADDR3);
+       } else if (nfc_is_v1()) {
+               writew(0x0, NFC_V1_UNLOCKSTART_BLKADDR);
+               writew(0x4000, NFC_V1_UNLOCKEND_BLKADDR);
+       } else
+               BUG();
+
+       /* Unlock Block Command for given address range */
+       writew(0x4, NFC_V1_V2_WRPROT);
 }
 
-/*
- * Used by the upper layer to verify the data in NAND Flash
- * with the data in the buf.
- */
-static int mxc_nand_verify_buf(struct mtd_info *mtd,
-                               const u_char *buf, int len)
+static void preset_v3(struct mtd_info *mtd)
 {
-       u_char tmp[256];
-       uint bsize;
+       struct nand_chip *chip = mtd->priv;
+       struct mxc_nand_host *host = chip->priv;
+       uint32_t config2, config3;
+       int i, addr_phases;
 
-       while (len) {
-               bsize = min(len, 256);
-               mxc_nand_read_buf(mtd, tmp, bsize);
+       writel(NFC_V3_CONFIG1_RBA(0), NFC_V3_CONFIG1);
+       writel(NFC_V3_IPC_CREQ, NFC_V3_IPC);
+       WARN_ON(!(readl(NFC_V3_IPC) & NFC_V3_IPC_CACK));
 
-               if (memcmp(buf, tmp, bsize))
-                       return 1;
+       /* Unlock the internal RAM Buffer */
+       writel(NFC_V3_WRPROT_BLS_UNLOCK | NFC_V3_WRPROT_UNLOCK,
+                       NFC_V3_WRPROT);
 
-               buf += bsize;
-               len -= bsize;
+       /* Blocks to be unlocked */
+       for (i = 0; i < CONFIG_SYS_NAND_MAX_CHIPS; i++)
+               writel(0x0 | (0xffff << 16),
+                               NFC_V3_WRPROT_UNLOCK_BLK_ADD0 + (i << 2));
+
+       config2 = NFC_V3_CONFIG2_ONE_CYCLE |
+               NFC_V3_CONFIG2_2CMD_PHASES |
+               NFC_V3_CONFIG2_SPAS(mtd->oobsize >> 1) |
+               NFC_V3_CONFIG2_ST_CMD(0x70) |
+               NFC_V3_CONFIG2_NUM_ADDR_PHASE0;
+
+       if (chip->ecc.mode == NAND_ECC_HW)
+               config2 |= NFC_V3_CONFIG2_ECC_EN;
+
+       addr_phases = fls(chip->pagemask) >> 3;
+
+       if (mtd->writesize == 2048) {
+               config2 |= NFC_V3_CONFIG2_PS_2048;
+               config2 |= NFC_V3_CONFIG2_NUM_ADDR_PHASE1(addr_phases);
+       } else if (mtd->writesize == 4096) {
+               config2 |= NFC_V3_CONFIG2_PS_4096;
+               config2 |= NFC_V3_CONFIG2_NUM_ADDR_PHASE1(addr_phases);
+       } else {
+               config2 |= NFC_V3_CONFIG2_PS_512;
+               config2 |= NFC_V3_CONFIG2_NUM_ADDR_PHASE1(addr_phases - 1);
        }
 
-       return 0;
-}
+       if (mtd->writesize) {
+#if defined CONFIG_MX53
+               config2 |= MX53_CONFIG2_PPB(ffs(mtd->erasesize / mtd->writesize) - 6);
+#else
+               config2 |= NFC_V3_CONFIG2_PPB(ffs(mtd->erasesize / mtd->writesize) - 6);
+#endif
+               host->eccsize = get_eccsize(mtd);
+               if (host->eccsize == 8)
+                       config2 |= NFC_V3_CONFIG2_ECC_MODE_8;
+       }
 
-/*
- * This function is used by upper layer for select and
- * deselect of the NAND chip
- */
-static void mxc_nand_select_chip(struct mtd_info *mtd, int chip)
-{
-       struct nand_chip *nand_chip = mtd->priv;
-       struct mxc_nand_host *host = nand_chip->priv;
+       writel(config2, NFC_V3_CONFIG2);
 
-       switch (chip) {
-       case -1:
-               /* TODO: Disable the NFC clock */
-               if (host->clk_act)
-                       host->clk_act = 0;
-               break;
-       case 0:
-               /* TODO: Enable the NFC clock */
-               if (!host->clk_act)
-                       host->clk_act = 1;
-               break;
+       config3 = NFC_V3_CONFIG3_NUM_OF_DEVICES(0) |
+                       NFC_V3_CONFIG3_NO_SDMA |
+                       NFC_V3_CONFIG3_RBB_MODE |
+                       NFC_V3_CONFIG3_SBB(6) | /* Reset default */
+                       NFC_V3_CONFIG3_ADD_OP(0);
 
-       default:
-               break;
-       }
+       if (!(chip->options & NAND_BUSWIDTH_16))
+               config3 |= NFC_V3_CONFIG3_FW8;
+
+       writel(config3, NFC_V3_CONFIG3);
+
+       writel(0, NFC_V3_DELAY_LINE);
+       writel(0, NFC_V3_IPC);
 }
 
-/*
- * Used by the upper layer to write command to NAND Flash for
- * different operations to be carried out on NAND Flash
- */
-void mxc_nand_command(struct mtd_info *mtd, unsigned command,
+/* Used by the upper layer to write command to NAND Flash for
+ * different operations to be carried out on NAND Flash */
+static void mxc_nand_command(struct mtd_info *mtd, unsigned command,
                                int column, int page_addr)
 {
        struct nand_chip *nand_chip = mtd->priv;
        struct mxc_nand_host *host = nand_chip->priv;
 
-       MTDDEBUG(MTD_DEBUG_LEVEL3,
-             "mxc_nand_command (cmd = 0x%x, col = 0x%x, page = 0x%x)\n",
+       pr_debug("mxc_nand_command (cmd = 0x%x, col = 0x%x, page = 0x%x)\n",
              command, column, page_addr);
 
        /* Reset command state information */
@@ -1155,165 +938,123 @@ void mxc_nand_command(struct mtd_info *mtd, unsigned command,
 
        /* Command pre-processing step */
        switch (command) {
+       case NAND_CMD_RESET:
+               host->preset(mtd);
+               host->send_cmd(host, command, false);
+               break;
 
        case NAND_CMD_STATUS:
-               host->col_addr = 0;
+               host->buf_start = 0;
                host->status_request = true;
-               break;
 
-       case NAND_CMD_READ0:
-               host->page_addr = page_addr;
-               host->col_addr = column;
-               host->spare_only = false;
+               host->send_cmd(host, command, true);
+               mxc_do_addr_cycle(mtd, column, page_addr);
                break;
 
+       case NAND_CMD_READ0:
        case NAND_CMD_READOOB:
-               host->col_addr = column;
-               host->spare_only = true;
-               if (host->pagesize_2k)
-                       command = NAND_CMD_READ0; /* only READ0 is valid */
-               break;
+               if (command == NAND_CMD_READ0)
+                       host->buf_start = column;
+               else
+                       host->buf_start = column + mtd->writesize;
 
-       case NAND_CMD_SEQIN:
-               if (column >= mtd->writesize) {
-                       /*
-                        * before sending SEQIN command for partial write,
-                        * we need read one page out. FSL NFC does not support
-                        * partial write. It always sends out 512+ecc+512+ecc
-                        * for large page nand flash. But for small page nand
-                        * flash, it does support SPARE ONLY operation.
-                        */
-                       if (host->pagesize_2k) {
-                               /* call ourself to read a page */
-                               mxc_nand_command(mtd, NAND_CMD_READ0, 0,
-                                               page_addr);
-                       }
-
-                       host->col_addr = column - mtd->writesize;
-                       host->spare_only = true;
-
-                       /* Set program pointer to spare region */
-                       if (!host->pagesize_2k)
-                               send_cmd(host, NAND_CMD_READOOB);
-               } else {
-                       host->spare_only = false;
-                       host->col_addr = column;
+               command = NAND_CMD_READ0; /* only READ0 is valid */
 
-                       /* Set program pointer to page start */
-                       if (!host->pagesize_2k)
-                               send_cmd(host, NAND_CMD_READ0);
-               }
-               break;
+               host->send_cmd(host, command, false);
+               mxc_do_addr_cycle(mtd, column, page_addr);
 
-       case NAND_CMD_PAGEPROG:
-               send_prog_page(host, 0, host->spare_only);
+               if (mtd->writesize > 512)
+                       host->send_cmd(host, NAND_CMD_READSTART, true);
 
-               if (host->pagesize_2k && !is_mxc_nfc_11()) {
-                       /* data in 4 areas */
-                       send_prog_page(host, 1, host->spare_only);
-                       send_prog_page(host, 2, host->spare_only);
-                       send_prog_page(host, 3, host->spare_only);
-               }
+               host->send_page(mtd, NFC_OUTPUT);
 
+               memcpy(host->data_buf, host->main_area0, mtd->writesize);
+               copy_spare(mtd, true);
                break;
-       }
 
-       /* Write out the command to the device. */
-       send_cmd(host, command);
-
-       /* Write out column address, if necessary */
-       if (column != -1) {
-               /*
-                * MXC NANDFC can only perform full page+spare or
-                * spare-only read/write. When the upper layers perform
-                * a read/write buffer operation, we will use the saved
-                * column address to index into the full page.
-                */
-               send_addr(host, 0);
-               if (host->pagesize_2k)
-                       /* another col addr cycle for 2k page */
-                       send_addr(host, 0);
-       }
-
-       /* Write out page address, if necessary */
-       if (page_addr != -1) {
-               u32 page_mask = nand_chip->pagemask;
-               do {
-                       send_addr(host, page_addr & 0xFF);
-                       page_addr >>= 8;
-                       page_mask >>= 8;
-               } while (page_mask);
-       }
-
-       /* Command post-processing step */
-       switch (command) {
+       case NAND_CMD_SEQIN:
+               if (column >= mtd->writesize)
+                       /* call ourself to read a page */
+                       mxc_nand_command(mtd, NAND_CMD_READ0, 0, page_addr);
 
-       case NAND_CMD_RESET:
-               break;
+               host->buf_start = column;
 
-       case NAND_CMD_READOOB:
-       case NAND_CMD_READ0:
-               if (host->pagesize_2k) {
-                       /* send read confirm command */
-                       send_cmd(host, NAND_CMD_READSTART);
-                       /* read for each AREA */
-                       send_read_page(host, 0, host->spare_only);
-                       if (!is_mxc_nfc_11()) {
-                               send_read_page(host, 1, host->spare_only);
-                               send_read_page(host, 2, host->spare_only);
-                               send_read_page(host, 3, host->spare_only);
-                       }
-               } else {
-                       send_read_page(host, 0, host->spare_only);
-               }
-               break;
-
-       case NAND_CMD_READID:
-               host->col_addr = 0;
-               send_read_id(host);
+               host->send_cmd(host, command, false);
+               mxc_do_addr_cycle(mtd, column, page_addr);
                break;
 
        case NAND_CMD_PAGEPROG:
+               memcpy(host->main_area0, host->data_buf, mtd->writesize);
+               copy_spare(mtd, false);
+               host->send_page(mtd, NFC_INPUT);
+               host->send_cmd(host, command, true);
+               mxc_do_addr_cycle(mtd, column, page_addr);
                break;
 
-       case NAND_CMD_STATUS:
+       case NAND_CMD_READID:
+               host->send_cmd(host, command, true);
+               mxc_do_addr_cycle(mtd, column, page_addr);
+               host->send_read_id(host);
+               host->buf_start = column;
                break;
 
+       case NAND_CMD_ERASE1:
        case NAND_CMD_ERASE2:
+               host->send_cmd(host, command, false);
+               mxc_do_addr_cycle(mtd, column, page_addr);
+
                break;
        }
 }
 
-#ifdef MXC_NFC_V1_1
-static void mxc_setup_config1(void)
-{
-       uint16_t tmp;
-
-       tmp = readw(&host->regs->nfc_config1);
-       tmp |= NFC_ONE_CYCLE;
-       tmp |= NFC_4_8N_ECC;
-       writew(tmp, &host->regs->nfc_config1);
-       if (host->pagesize_2k)
-               writew(64/2, &host->regs->nfc_spare_area_size);
-       else
-               writew(16/2, &host->regs->nfc_spare_area_size);
-}
-#else
-#define mxc_setup_config1()
-#endif
+/*
+ * The generic flash bbt decriptors overlap with our ecc
+ * hardware, so define some i.MX specific ones.
+ */
+static uint8_t bbt_pattern[] = { 'B', 'b', 't', '0' };
+static uint8_t mirror_pattern[] = { '1', 't', 'b', 'B' };
+
+static struct nand_bbt_descr bbt_main_descr = {
+       .options = NAND_BBT_LASTBLOCK | NAND_BBT_WRITE |
+               NAND_BBT_2BIT | NAND_BBT_VERSION | NAND_BBT_PERCHIP,
+       .offs = 0,
+       .len = 4,
+       .veroffs = 4,
+       .maxblocks = 4,
+       .pattern = bbt_pattern,
+};
 
-int board_nand_init(struct nand_chip *this)
+static struct nand_bbt_descr bbt_mirror_descr = {
+       .options = NAND_BBT_LASTBLOCK | NAND_BBT_WRITE |
+               NAND_BBT_2BIT | NAND_BBT_VERSION | NAND_BBT_PERCHIP,
+       .offs = 0,
+       .len = 4,
+       .veroffs = 4,
+       .maxblocks = 4,
+       .pattern = mirror_pattern,
+};
+
+static void mxc_nand_chip_init(int devno)
 {
-       struct mtd_info *mtd;
-       uint16_t tmp;
-       int err = 0;
+       int err;
+       struct nand_chip *this;
+       struct mtd_info *mtd = &nand_info[devno];
+       struct nand_ecclayout *oob_smallpage, *oob_largepage;
+
+       /* allocate a minimal buffer for the read_id command */
+       host->data_buf = malloc(16);
+       if (!host->data_buf) {
+               printk("Failed to allocate ID buffer\n");
+               return;
+       }
 
        /* structures must be linked */
-       mtd = &host->mtd;
+       this = &host->nand;
+//     host->mtd = mtd;
        mtd->priv = this;
-       host->nand = this;
+       mtd->name = DRIVER_NAME;
 
-       /* 5 us command delay time */
+       /* 50 us command delay time */
        this->chip_delay = 5;
 
        this->priv = host;
@@ -1326,78 +1067,120 @@ int board_nand_init(struct nand_chip *this)
        this->read_buf = mxc_nand_read_buf;
        this->verify_buf = mxc_nand_verify_buf;
 
-       host->regs = (struct nfc_regs __iomem *)CONFIG_MXC_NAND_REGS_BASE;
-       host->clk_act = 1;
+       host->base = (void __iomem *)CONFIG_MXC_NAND_REGS_BASE;
+       if (!host->base) {
+               return;
+       }
 
-#ifdef CONFIG_MXC_NAND_HWECC
-       this->ecc.calculate = mxc_nand_calculate_ecc;
-       this->ecc.hwctl = mxc_nand_enable_hwecc;
-       this->ecc.correct = mxc_nand_correct_data;
-       if (is_mxc_nfc_11()) {
-               this->ecc.mode = NAND_ECC_HW_SYNDROME;
-               this->ecc.read_page = mxc_nand_read_page_syndrome;
-               this->ecc.read_page_raw = mxc_nand_read_page_raw_syndrome;
-               this->ecc.read_oob = mxc_nand_read_oob_syndrome;
-               this->ecc.write_page = mxc_nand_write_page_syndrome;
-               this->ecc.write_page_raw = mxc_nand_write_page_raw_syndrome;
-               this->ecc.write_oob = mxc_nand_write_oob_syndrome;
-               this->ecc.bytes = 9;
-               this->ecc.prepad = 7;
-       } else {
-               this->ecc.mode = NAND_ECC_HW;
+       host->main_area0 = host->base;
+
+       if (nfc_is_v1() || nfc_is_v21()) {
+               host->preset = preset_v1_v2;
+               host->send_cmd = send_cmd_v1_v2;
+               host->send_addr = send_addr_v1_v2;
+               host->send_page = send_page_v1_v2;
+               host->send_read_id = send_read_id_v1_v2;
+               host->get_dev_status = get_dev_status_v1_v2;
+               host->check_int = check_int_v1_v2;
        }
 
-       host->pagesize_2k = 0;
+       if (nfc_is_v21()) {
+               host->regs = host->base + 0x1e00;
+               host->spare0 = host->base + 0x1000;
+               host->spare_len = 64;
+               oob_smallpage = &nandv2_hw_eccoob_smallpage;
+               oob_largepage = &nandv2_hw_eccoob_largepage;
+               this->ecc.bytes = 9;
+       } else if (nfc_is_v1()) {
+               host->regs = host->base + 0xe00;
+               host->spare0 = host->base + 0x800;
+               host->spare_len = 16;
+               oob_smallpage = &nandv1_hw_eccoob_smallpage;
+               oob_largepage = &nandv1_hw_eccoob_largepage;
+               this->ecc.bytes = 3;
+               host->eccsize = 1;
+       } else if (nfc_is_v3_2()) {
+               host->regs_ip = (void __iomem *)CONFIG_MXC_NAND_IP_BASE;
+               host->regs_axi = host->base + 0x1e00;
+               host->spare0 = host->base + 0x1000;
+               host->spare_len = 64;
+               host->preset = preset_v3;
+               host->send_cmd = send_cmd_v3;
+               host->send_addr = send_addr_v3;
+               host->send_page = send_page_v3;
+               host->send_read_id = send_read_id_v3;
+               host->check_int = check_int_v3;
+               host->get_dev_status = get_dev_status_v3;
+               oob_smallpage = &nandv2_hw_eccoob_smallpage;
+               oob_largepage = &nandv2_hw_eccoob_largepage;
+       } else
+               hang();
 
        this->ecc.size = 512;
-       tmp = readw(&host->regs->nfc_config1);
-       tmp |= NFC_ECC_EN;
-       writew(tmp, &host->regs->nfc_config1);
+       this->ecc.layout = oob_smallpage;
+
+#ifdef CONFIG_MXC_NAND_HWECC
+       this->ecc.calculate = mxc_nand_calculate_ecc;
+       this->ecc.hwctl = mxc_nand_enable_hwecc;
+       if (nfc_is_v1())
+               this->ecc.correct = mxc_nand_correct_data_v1;
+       else
+               this->ecc.correct = mxc_nand_correct_data_v2_v3;
+       this->ecc.mode = NAND_ECC_HW;
 #else
-       this->ecc.layout = &nand_soft_eccoob;
        this->ecc.mode = NAND_ECC_SOFT;
-       tmp = readw(&host->regs->nfc_config1);
-       tmp &= ~NFC_ECC_EN;
-       writew(tmp, &host->regs->nfc_config1);
 #endif
-       /* Reset NAND */
-       this->cmdfunc(mtd, NAND_CMD_RESET, -1, -1);
+       /* NAND bus width determines access funtions used by upper layer */
+       if (is_16bit_nand())
+               this->options |= NAND_BUSWIDTH_16;
 
-       /*
-        * preset operation
-        * Unlock the internal RAM Buffer
-        */
-       writew(0x2, &host->regs->nfc_config);
+#ifdef CONFIG_SYS_NAND_USE_FLASH_BBT
+       this->options |= NAND_USE_FLASH_BBT;
+       this->bbt_td = &bbt_main_descr;
+       this->bbt_md = &bbt_mirror_descr;
+       this->bbt_td->options |= NAND_BBT_CREATE;
+       this->bbt_md->options |= NAND_BBT_CREATE;
+#endif
 
-       /* Blocks to be unlocked */
-       writew(0x0, &host->regs->nfc_unlockstart_blkaddr);
-       /* Originally (Freescale LTIB 2.6.21) 0x4000 was written to the
-        * unlockend_blkaddr, but the magic 0x4000 does not always work
-        * when writing more than some 32 megabytes (on 2k page nands)
-        * However 0xFFFF doesn't seem to have this kind
-        * of limitation (tried it back and forth several times).
-        * The linux kernel driver sets this to 0xFFFF for the v2 controller
-        * only, but probably this was not tested there for v1.
-        * The very same limitation seems to apply to this kernel driver.
-        * This might be NAND chip specific and the i.MX31 datasheet is
-        * extremely vague about the semantics of this register.
-        */
-       writew(0xFFFF, &host->regs->nfc_unlockend_blkaddr);
+       /* first scan to find the device and get the page size */
+       if (nand_scan_ident(mtd, nfc_is_v21() ? 4 : 1, NULL)) {
+               return;
+       }
 
-       /* Unlock Block Command for given address range */
-       writew(0x4, &host->regs->nfc_wrprot);
+       host->data_buf = realloc(host->data_buf,
+                               mtd->writesize + mtd->oobsize);
+       if (!host->data_buf) {
+               printk("Failed to allocate data buffer of %u byte\n",
+                       mtd->writesize + mtd->oobsize);
+               return;
+       }
+       pr_debug("Allocated %u byte data buffer\n",
+               mtd->writesize + mtd->oobsize);
+
+       /* Call preset again, with correct writesize this time */
+       host->preset(mtd);
+
+       if (mtd->writesize == 2048)
+               this->ecc.layout = oob_largepage;
+       if (nfc_is_v21() && mtd->writesize == 4096)
+               this->ecc.layout = &nandv2_hw_eccoob_4k;
+
+       /* second phase scan */
+       err = nand_scan_tail(mtd);
+       if (err) {
+               printk("Nand scan failed: %d\n", err);
+               return;
+       }
 
-       /* NAND bus width determines access functions used by upper layer */
-       if (is_16bit_nand())
-               this->options |= NAND_BUSWIDTH_16;
+       err = nand_register(devno);
+       if (err)
+               return;
+}
 
-#ifdef CONFIG_SYS_NAND_LARGEPAGE
-       host->pagesize_2k = 1;
-       this->ecc.layout = &nand_hw_eccoob2k;
-#else
-       host->pagesize_2k = 0;
-       this->ecc.layout = &nand_hw_eccoob;
-#endif
-       mxc_setup_config1();
-       return err;
+void board_nand_init(void)
+{
+       int i;
+
+       for (i = 0; i < CONFIG_SYS_MAX_NAND_DEVICE; i++)
+               mxc_nand_chip_init(i);
 }
index 9c9581105414fae8a2dc53f38a6dd5585446a838..a9cef16d7c354ae5fbd31e3c5a38e1218c4e7410 100644 (file)
@@ -542,6 +542,16 @@ static uint8_t mxs_nand_read_byte(struct mtd_info *mtd)
        return buf;
 }
 
+static void flush_buffers(struct mtd_info *mtd, struct mxs_nand_info *nand_info)
+{
+       flush_dcache_range((unsigned long)nand_info->data_buf,
+                       (unsigned long)nand_info->data_buf +
+                       mtd->writesize);
+       flush_dcache_range((unsigned long)nand_info->oob_buf,
+                       (unsigned long)nand_info->oob_buf +
+                       mtd->oobsize);
+}
+
 /*
  * Read a page from NAND.
  */
@@ -595,6 +605,8 @@ static int mxs_nand_ecc_read_page(struct mtd_info *mtd, struct nand_chip *nand,
        d->cmd.pio_words[4] = (dma_addr_t)nand_info->data_buf;
        d->cmd.pio_words[5] = (dma_addr_t)nand_info->oob_buf;
 
+       flush_buffers(mtd, nand_info);
+
        mxs_dma_desc_append(channel, d);
 
        /* Compile the DMA descriptor - disable the BCH block. */
@@ -724,10 +736,12 @@ static void mxs_nand_ecc_write_page(struct mtd_info *mtd,
                GPMI_ECCCTRL_ENABLE_ECC |
                GPMI_ECCCTRL_ECC_CMD_ENCODE |
                GPMI_ECCCTRL_BUFFER_MASK_BCH_PAGE;
-       d->cmd.pio_words[3] = (mtd->writesize + mtd->oobsize);
+       d->cmd.pio_words[3] = mtd->writesize + mtd->oobsize;
        d->cmd.pio_words[4] = (dma_addr_t)nand_info->data_buf;
        d->cmd.pio_words[5] = (dma_addr_t)nand_info->oob_buf;
 
+       flush_buffers(mtd, nand_info);
+
        mxs_dma_desc_append(channel, d);
 
        /* Flush caches */
@@ -953,7 +967,7 @@ static int mxs_nand_block_bad(struct mtd_info *mtd, loff_t ofs, int getchip)
 /*
  * Nominally, the purpose of this function is to look for or create the bad
  * block table. In fact, since the we call this function at the very end of
- * the initialization process started by nand_scan(), and we doesn't have a
+ * the initialization process started by nand_scan(), and we don't have a
  * more formal mechanism, we "hook" this function to continue init process.
  *
  * At this point, the physical NAND Flash chips have been identified and
@@ -972,7 +986,14 @@ static int mxs_nand_scan_bbt(struct mtd_info *mtd)
        uint32_t tmp;
 
        /* Configure BCH and set NFC geometry */
-       mx28_reset_block(&bch_regs->hw_bch_ctrl_reg);
+       if (readl(&bch_regs->hw_bch_ctrl_reg) &
+               (BCH_CTRL_SFTRST | BCH_CTRL_CLKGATE))
+               /* When booting from NAND the BCH engine will already
+                * be operational and obviously does not like being reset here.
+                * There will be occasional read errors upon boot when this
+                * reset is done.
+                */
+               mx28_reset_block(&bch_regs->hw_bch_ctrl_reg);
 
        /* Configure layout 0 */
        tmp = (mxs_nand_ecc_chunk_cnt(mtd->writesize) - 1)
@@ -1138,7 +1159,9 @@ int board_nand_init(struct nand_chip *nand)
 
        nand->priv = nand_info;
        nand->options |= NAND_NO_SUBPAGE_WRITE;
-
+#ifdef CONFIG_SYS_NAND_USE_FLASH_BBT
+       nand->options |= NAND_USE_FLASH_BBT | NAND_USE_FLASH_BBT_NO_OOB;
+#endif
        nand->cmd_ctrl          = mxs_nand_cmd_ctrl;
 
        nand->dev_ready         = mxs_nand_device_ready;
index bef79bed0fe1563489a85ed9ecaa69ed25805304..de2c713bf15406aa50dc0fa892d0f078c87cb2fb 100644 (file)
@@ -1903,8 +1903,6 @@ static uint8_t *nand_fill_oob(struct nand_chip *chip, uint8_t *oob, size_t len,
        return NULL;
 }
 
-#define NOTALIGNED(x)  ((x & (chip->subpagesize - 1)) != 0)
-
 /**
  * nand_do_write_ops - [Internal] NAND write with ECC
  * @mtd:       MTD device structure
@@ -2931,6 +2929,7 @@ int nand_scan_ident(struct mtd_info *mtd, int maxchips,
  */
 int nand_scan_tail(struct mtd_info *mtd)
 {
+       uint32_t dev_width;
        int i;
        struct nand_chip *chip = mtd->priv;
 
@@ -2942,6 +2941,8 @@ int nand_scan_tail(struct mtd_info *mtd)
        /* Set the internal oob buffer location, just after the page data */
        chip->oob_poi = chip->buffers->databuf + mtd->writesize;
 
+       dev_width = (chip->options & NAND_BUSWIDTH_16) >> 1;
+
        /*
         * If no default placement scheme is given, select an appropriate one
         */
index dc6c6480e58bbed1ab272b38645347e0a9346b89..50690cbb6cc4d6590788c8ec00e55d8f307d852a 100644 (file)
@@ -259,9 +259,7 @@ static int read_bbt(struct mtd_info *mtd, uint8_t *buf, int page, int num,
                                        mtd->ecc_stats.bbtblocks++;
                                        continue;
                                }
-                               /* Leave it for now, if its matured we can move this
-                                * message to MTD_DEBUG_LEVEL0 */
-                               printk(KERN_DEBUG "nand_read_bbt: Bad block at 0x%012llx\n",
+                               MTDDEBUG(MTD_DEBUG_LEVEL0, "nand_read_bbt: Bad block at 0x%012llx\n",
                                       (loff_t)((offs << 2) + (act >> 1)) << this->bbt_erase_shift);
                                /* Factory marked bad or worn out ? */
                                if (tmp == 0)
@@ -651,8 +649,9 @@ static int search_bbt(struct mtd_info *mtd, uint8_t *buf, struct nand_bbt_descr
                if (td->pages[i] == -1)
                        printk(KERN_WARNING "Bad block table not found for chip %d\n", i);
                else
-                       printk(KERN_DEBUG "Bad block table found at page %d, version 0x%02X\n", td->pages[i],
-                              td->version[i]);
+                       MTDDEBUG(MTD_DEBUG_LEVEL0,
+                               "Bad block table found at page %d, version 0x%02X\n",
+                               td->pages[i], td->version[i]);
        }
        return 0;
 }
index 4a4d02f4c8b5c1c4d95c8735a52862ab4c7fd4fe..4dfa623689450e5def1206789b9708164e8ce372 100644 (file)
@@ -221,9 +221,16 @@ static int nand_read_page(int block, int page, void *dst)
 
 int nand_spl_load_image(uint32_t offs, unsigned int size, void *dst)
 {
-       unsigned int block, lastblock;
+       unsigned int block, lastblock, bad = 0;
        unsigned int page;
+       const int ppb = CONFIG_SYS_NAND_BLOCK_SIZE / CONFIG_SYS_NAND_PAGE_SIZE;
+       int maxbad;
 
+#ifdef CONFIG_SYS_NAND_MAXBAD
+       maxbad = CONFIG_SYS_NAND_MAXBAD;
+#else
+       maxbad = mtd.size;
+#endif
        /*
         * offs has to be aligned to a page address!
         */
@@ -237,16 +244,37 @@ int nand_spl_load_image(uint32_t offs, unsigned int size, void *dst)
                         * Skip bad blocks
                         */
                        while (page < CONFIG_SYS_NAND_PAGE_COUNT) {
-                               nand_read_page(block, page, dst);
+                               if (nand_chip.ecc.read_page) {
+                                       int ret;
+
+                                       ret = nand_chip.ecc.read_page(&mtd, &nand_chip,
+                                               dst, block * ppb + page);
+                                       if (ret) {
+                                               if (page > 0)
+                                                       dst -= (page - 1) * CONFIG_SYS_NAND_PAGE_SIZE;
+                                               bad++;
+                                               lastblock++;
+                                               break;
+                                       }
+                               } else {
+                                       nand_read_page(block, page, dst);
+                               }
                                dst += CONFIG_SYS_NAND_PAGE_SIZE;
                                page++;
                        }
 
                        page = 0;
                } else {
+                       printf("Skipping bad block %d\n", block);
+                       bad++;
                        lastblock++;
                }
 
+               if (maxbad > 0 && bad > maxbad) {
+                       printf("Too many bad blocks encountered\n");
+                       return -1;
+               }
+
                block++;
        }
 
@@ -256,12 +284,21 @@ int nand_spl_load_image(uint32_t offs, unsigned int size, void *dst)
 /* nand_init() - initialize data to make nand usable by SPL */
 void nand_init(void)
 {
+       static struct nand_buffers ecc_buf;
+
        /*
         * Init board specific nand support
         */
        mtd.priv = &nand_chip;
+       mtd.erasesize = CONFIG_SYS_NAND_BLOCK_SIZE;
+       mtd.writesize = CONFIG_SYS_NAND_PAGE_SIZE;
+       mtd.oobsize = CONFIG_SYS_NAND_OOBSIZE;
+
        nand_chip.IO_ADDR_R = nand_chip.IO_ADDR_W =
                (void  __iomem *)CONFIG_SYS_NAND_BASE;
+       nand_chip.oob_poi = ecc_buf.databuf;
+       nand_chip.buffers = &ecc_buf;
+
        board_nand_init(&nand_chip);
 
 #ifdef CONFIG_SPL_NAND_SOFTECC
index 90f83924e2bf23b9ab4c621495ca236c14a19acd..b82da5014125e21f63ada9f832f464088d5bcf8e 100644 (file)
@@ -39,6 +39,9 @@ COBJS-$(CONFIG_SPI_FLASH_STMICRO)     += stmicro.o
 COBJS-$(CONFIG_SPI_FLASH_WINBOND)      += winbond.o
 COBJS-$(CONFIG_SPI_FRAM_RAMTRON)       += ramtron.o
 COBJS-$(CONFIG_SPI_M95XXX) += eeprom_m95xxx.o
+COBJS-$(CONFIG_SPI_FLASH_IMX)  += imx_spi_nor.o
+COBJS-$(CONFIG_SPI_FLASH_IMX_SST)      += imx_spi_nor_sst.o
+COBJS-$(CONFIG_SPI_FLASH_IMX_ATMEL)    += imx_spi_nor_atmel.o
 
 COBJS  := $(COBJS-y)
 SRCS   := $(COBJS:.o=.c)
diff --git a/drivers/mtd/spi/imx_spi_nor_atmel.c b/drivers/mtd/spi/imx_spi_nor_atmel.c
new file mode 100644 (file)
index 0000000..5575498
--- /dev/null
@@ -0,0 +1,532 @@
+/*
+ * (C) Copyright 2008-2010 Freescale Semiconductor, Inc.
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+#include <config.h>
+#include <common.h>
+#include <spi.h>
+#include <spi_flash.h>
+#include <asm/errno.h>
+#include <linux/types.h>
+#include <malloc.h>
+
+#include <imx_spi.h>
+#include <imx_spi_nor.h>
+
+static u8 g_tx_buf[256];
+static u8 g_rx_buf[256];
+
+#define WRITE_ENABLE(a)                         spi_nor_cmd_1byte(a, WREN)
+#define ENABLE_WRITE_STATUS(a)  spi_nor_cmd_1byte(a, EWSR)
+
+struct imx_spi_flash_params {
+       u8              idcode1;
+       u32             block_size;
+       u32             block_count;
+       u32             device_size;
+       const char      *name;
+};
+
+struct imx_spi_flash {
+       const struct imx_spi_flash_params *params;
+       struct spi_flash flash;
+};
+
+static inline struct imx_spi_flash *
+to_imx_spi_flash(struct spi_flash *flash)
+{
+       return container_of(flash, struct imx_spi_flash, flash);
+}
+
+static const struct imx_spi_flash_params imx_spi_flash_table[] = {
+       {
+               .idcode1                = 0x27,
+               .block_size             = SZ_64K,
+               .block_count            = 64,
+               .device_size            = SZ_64K * 64,
+               .name                   = "AT45DB321D - 4MB",
+       },
+};
+
+static s32 spi_nor_flash_query(struct spi_flash *flash, void* data)
+{
+       u8 au8Tmp[4] = { 0 };
+       u8 *pData = (u8 *)data;
+
+       g_tx_buf[3] = JEDEC_ID;
+
+       if (spi_xfer(flash->spi, (4 << 3), g_tx_buf, au8Tmp,
+                               SPI_XFER_BEGIN | SPI_XFER_END)) {
+               return -1;
+       }
+
+       printf("JEDEC ID: 0x%02x:0x%02x:0x%02x\n",
+                       au8Tmp[2], au8Tmp[1], au8Tmp[0]);
+
+       pData[0] = au8Tmp[2];
+       pData[1] = au8Tmp[1];
+       pData[2] = au8Tmp[0];
+
+       return 0;
+}
+
+static s32 spi_nor_status(struct spi_flash *flash)
+{
+       g_tx_buf[1] = STAT_READ;
+
+       if (spi_xfer(flash->spi, 2 << 3, g_tx_buf, g_rx_buf,
+                       SPI_XFER_BEGIN | SPI_XFER_END) != 0) {
+               printf("Error: %s(): %d\n", __func__, __LINE__);
+               return 0;
+       }
+       return g_rx_buf[0];
+}
+
+#if 0
+/*!
+ * Erase a block_size data from block_addr offset in the flash
+ */
+static int spi_nor_erase_page(struct spi_flash *flash,
+                               void *page_addr)
+{
+       u32 addr = (u32)page_addr;
+
+       if ((addr & 512) != 0) {
+               printf("Error - page_addr is not "
+                               "512 Bytes aligned: %p\n",
+                               page_addr);
+               return -1;
+       }
+
+       /* now do the block erase */
+       if (spi_xfer(flash->spi, 4 << 3, g_tx_buf, g_rx_buf,
+                       SPI_XFER_BEGIN | SPI_XFER_END) != 0) {
+               return -1;
+       }
+
+       while (spi_nor_status(flash) & RDSR_BUSY)
+               ;
+
+       return 0;
+}
+#endif
+
+static int spi_nor_flash_read(struct spi_flash *flash, u32 offset,
+               size_t len, void *buf)
+{
+       struct imx_spi_flash *imx_sf = to_imx_spi_flash(flash);
+       u32 *cmd = (u32 *)g_tx_buf;
+       u32 max_rx_sz = (MAX_SPI_BYTES) - 4;
+       u8 *d_buf = (u8 *)buf;
+       u8 *s_buf;
+       s32 s32remain_size = len;
+       int i;
+
+       if (!(flash->spi))
+               return -1;
+
+       printf("Reading SPI NOR flash 0x%x [0x%x bytes] -> ram 0x%p\n",
+               offset, len, buf);
+       debug("%s(from flash=0x%08x to ram=%p len=0x%x)\n",
+               __func__,
+               offset, buf, len);
+
+       if (len == 0)
+               return 0;
+
+       *cmd = (READ << 24) | ((u32)offset & 0x00FFFFFF);
+
+       for (; s32remain_size > 0;
+                       s32remain_size -= max_rx_sz, *cmd += max_rx_sz) {
+               debug("Addr:0x%p=>Offset:0x%08x, %d bytes transferred\n",
+                               d_buf,
+                               (*cmd & 0x00FFFFFF),
+                               (len - s32remain_size));
+               debug("%d%% completed\n", ((len - s32remain_size) * 100 / len));
+
+               if (s32remain_size < max_rx_sz) {
+                       debug("100%% completed\n");
+
+                       if (spi_xfer(flash->spi, (s32remain_size + 4) << 3,
+                               g_tx_buf, g_rx_buf,
+                               SPI_XFER_BEGIN | SPI_XFER_END) != 0) {
+                               printf("Error: %s(%d): failed\n",
+                                       __FILE__, __LINE__);
+                               return -1;
+                       }
+                       /* throw away 4 bytes (5th received bytes is real) */
+                       s_buf = g_rx_buf + 4;
+
+                       /* now adjust the endianness */
+                       for (i = s32remain_size; i >= 0; i -= 4, s_buf += 4) {
+                               if (i < 4) {
+                                       if (i == 1) {
+                                               *d_buf = s_buf[0];
+                                       } else if (i == 2) {
+                                               *d_buf++ = s_buf[1];
+                                               *d_buf++ = s_buf[0];
+                                       } else if (i == 3) {
+                                               *d_buf++ = s_buf[2];
+                                               *d_buf++ = s_buf[1];
+                                               *d_buf++ = s_buf[0];
+                                       }
+                                       printf("SUCCESS\n\n");
+                                       return 0;
+                               }
+                               /* copy 4 bytes */
+                               *d_buf++ = s_buf[3];
+                               *d_buf++ = s_buf[2];
+                               *d_buf++ = s_buf[1];
+                               *d_buf++ = s_buf[0];
+                       }
+               }
+
+               /* now grab max_rx_sz data (+4 is
+               *needed due to 4-throw away bytes */
+               if (spi_xfer(flash->spi, (max_rx_sz + 4) << 3,
+                       g_tx_buf, g_rx_buf,
+                       SPI_XFER_BEGIN | SPI_XFER_END) != 0) {
+                       printf("Error: %s(%d): failed\n", __FILE__, __LINE__);
+                       return -1;
+               }
+               /* throw away 4 bytes (5th received bytes is real) */
+               s_buf = g_rx_buf + 4;
+               /* now adjust the endianness */
+               for (i = 0; i < max_rx_sz; i += 4, s_buf += 4) {
+                       *d_buf++ = s_buf[3];
+                       *d_buf++ = s_buf[2];
+                       *d_buf++ = s_buf[1];
+                       *d_buf++ = s_buf[0];
+               }
+
+               if ((s32remain_size % imx_sf->params->block_size) == 0)
+                       printf(".");
+       }
+       printf("SUCCESS\n\n");
+
+       return -1;
+}
+
+static int spi_nor_flash_write(struct spi_flash *flash, u32 offset,
+               size_t len, const void *buf)
+{
+       u32 d_addr = offset;
+       u8 *s_buf = (u8 *)buf;
+       unsigned int final_addr = 0;
+       int page_size = 528, trans_bytes = 0, buf_ptr = 0,
+               bytes_sent = 0, byte_sent_per_iter = 0;
+       int page_no = 0, buf_addr = 0, page_off = 0,
+               i = 0, j = 0, k = 0, fifo_size = 32;
+       int remain_len = 0;
+
+       if (!(flash->spi))
+               return -1;
+
+       if (len == 0)
+               return 0;
+
+       printf("Writing SPI NOR flash 0x%x [0x%x bytes] <- ram 0x%p\n",
+               offset, len, buf);
+       debug("%s(flash addr=0x%08x, ram=%p, len=0x%x)\n",
+                       __func__, offset, buf, len);
+
+       /* Read the status register to get the Page size */
+       if (spi_nor_status(flash) & STAT_PG_SZ) {
+               page_size = 512;
+       } else {
+               puts("Unsupported Page Size of 528 bytes\n");
+               g_tx_buf[0] = CONFIG_REG4;
+               g_tx_buf[1] = CONFIG_REG3;
+               g_tx_buf[2] = CONFIG_REG2;
+               g_tx_buf[3] = CONFIG_REG1;
+
+               if (spi_xfer(flash->spi, 4 << 3, g_tx_buf, g_rx_buf,
+                               SPI_XFER_BEGIN | SPI_XFER_END) != 0) {
+                       printf("Error: %s(): %d", __func__, __LINE__);
+                       return -1;
+               }
+
+               while (!(spi_nor_status(flash) & STAT_BUSY))
+                       ;
+
+               puts("Reprogrammed the Page Size to 512 bytes\n");
+               puts("Please Power Cycle the board for the change to take effect\n");
+
+               return -1;
+       }
+
+       /* Due to the way CSPI operates send data less
+          that 4 bytes in a different manner */
+       remain_len = len % 4;
+       if (remain_len)
+               len -= remain_len;
+
+       while (1) {
+               page_no = d_addr / page_size;
+               /* Get the offset within the page
+               if address is not page-aligned */
+               page_off = (d_addr % page_size);
+               if (page_off) {
+                       if (page_no == 0)
+                               buf_addr = d_addr;
+                       else
+                               buf_addr = page_off;
+
+                       trans_bytes = page_size - buf_addr;
+               } else {
+                       buf_addr = 0;
+                       trans_bytes = page_size;
+               }
+
+               if (len <= 0)
+                       break;
+
+               if (trans_bytes > len)
+                       trans_bytes = len;
+
+               bytes_sent = trans_bytes;
+               /* Write the data to the SPI-NOR Buffer first */
+               while (trans_bytes > 0) {
+                       final_addr = (buf_addr & 0x3FF);
+                       g_tx_buf[0] = final_addr;
+                       g_tx_buf[1] = final_addr >> 8;
+                       g_tx_buf[2] = final_addr >> 16;
+                       g_tx_buf[3] = BUF1_WR; /*Opcode */
+
+                       /* 4 bytes already used for Opcode & address bytes,
+                       check to ensure we do not overflow the SPI TX buffer */
+                       if (trans_bytes > (fifo_size - 4))
+                               byte_sent_per_iter = fifo_size;
+                       else
+                               byte_sent_per_iter = trans_bytes + 4;
+
+                       for (i = 4; i < byte_sent_per_iter; i += 4) {
+                               g_tx_buf[i + 3] = s_buf[buf_ptr++];
+                               g_tx_buf[i + 2] = s_buf[buf_ptr++];
+                               g_tx_buf[i + 1] = s_buf[buf_ptr++];
+                               g_tx_buf[i] = s_buf[buf_ptr++];
+                       }
+
+                       if (spi_xfer(flash->spi, byte_sent_per_iter << 3,
+                                       g_tx_buf, g_rx_buf,
+                                       SPI_XFER_BEGIN | SPI_XFER_END) != 0) {
+                               printf("Error: %s(%d): failed\n",
+                                       __FILE__, __LINE__);
+                               return -1;
+                       }
+
+                       while (!(spi_nor_status(flash) & STAT_BUSY))
+                               ;
+
+                       /* Deduct 4 bytes as it is used for Opcode & address bytes */
+                       trans_bytes -= (byte_sent_per_iter - 4);
+                       /* Update the destination buffer address */
+                       buf_addr += (byte_sent_per_iter - 4);
+               }
+
+               /* Send the command to write data from the SPI-NOR Buffer to Flash memory */
+               final_addr = (page_size == 512) ? ((page_no & 0x1FFF) << 9) : \
+                               ((page_no & 0x1FFF) << 10);
+
+               /* Specify the Page address in Flash where the data should be written to */
+               g_tx_buf[0] = final_addr;
+               g_tx_buf[1] = final_addr >> 8;
+               g_tx_buf[2] = final_addr >> 16;
+               g_tx_buf[3] = BUF1_TO_MEM; /*Opcode */
+               if (spi_xfer(flash->spi, 4 << 3, g_tx_buf, g_rx_buf,
+                               SPI_XFER_BEGIN | SPI_XFER_END) != 0) {
+                       printf("Error: %s(%d): failed\n", __FILE__, __LINE__);
+                       return -1;
+               }
+
+               while (!(spi_nor_status(flash) & STAT_BUSY))
+                       ;
+
+               d_addr += bytes_sent;
+               len -= bytes_sent;
+               if (d_addr % (page_size * 50) == 0)
+                       puts(".");
+       }
+
+       if (remain_len) {
+               buf_ptr += remain_len;
+               /* Write the remaining data bytes first */
+               for (i = 0; i < remain_len; ++i)
+                       g_tx_buf[i] = s_buf[buf_ptr--];
+
+               /* Write the address bytes next in the same word
+               as the data byte from the next byte */
+               for (j = i, k = 0; j < 4; j++, k++)
+                       g_tx_buf[j] = final_addr >> (k * 8);
+
+               /* Write the remaining address bytes in the next word */
+               j = 0;
+               final_addr = (buf_addr & 0x3FF);
+
+               for (j = 0; k < 3; j++, k++)
+                       g_tx_buf[j] = final_addr >> (k * 8);
+
+               /* Finally the Opcode to write the data to the buffer */
+               g_tx_buf[j] = BUF1_WR; /*Opcode */
+
+               if (spi_xfer(flash->spi, (remain_len + 4) << 3,
+                       g_tx_buf, g_rx_buf,
+                       SPI_XFER_BEGIN | SPI_XFER_END) != 0) {
+                       printf("Error: %s(%d): failed\n", __FILE__, __LINE__);
+                       return -1;
+               }
+
+               while (!(spi_nor_status(flash) & STAT_BUSY))
+                       ;
+
+               if (page_size == 512)
+                       final_addr = (page_no & 0x1FFF) << 9;
+               else
+                       final_addr = (page_no & 0x1FFF) << 10;
+
+               g_tx_buf[0] = final_addr;
+               g_tx_buf[1] = final_addr >> 8;
+               g_tx_buf[2] = final_addr >> 16;
+               g_tx_buf[3] = BUF1_TO_MEM; /*Opcode */
+               if (spi_xfer(flash->spi, 4 << 3, g_tx_buf, g_rx_buf,
+                       SPI_XFER_BEGIN | SPI_XFER_END) != 0) {
+                       printf("Error: %s(%d): failed\n", __FILE__, __LINE__);
+                               return -1;
+               }
+
+               while (!(spi_nor_status(flash) & STAT_BUSY))
+                               ;
+       }
+
+       printf("SUCCESS\n\n");
+
+       return 0;
+}
+
+static int spi_nor_flash_erase(struct spi_flash *flash, u32 offset,
+               size_t len)
+{
+       printf("Erase is built in program.\n");
+
+       return 0;
+}
+
+struct spi_flash *spi_flash_probe(unsigned int bus, unsigned int cs, unsigned int max_hz, unsigned int spi_mode)
+{
+       struct spi_slave *spi = NULL;
+       const struct imx_spi_flash_params *params = NULL;
+       struct imx_spi_flash *imx_sf = NULL;
+       u8  idcode[4] = { 0 };
+       u32 i = 0;
+       s32 ret = 0;
+
+       if (CONFIG_SPI_FLASH_CS != cs) {
+               printf("Invalid cs for SPI NOR.\n");
+               return NULL;
+       }
+
+       spi = spi_setup_slave(bus, cs, max_hz, spi_mode);
+
+       if (!spi) {
+               debug("SF: Failed to set up slave\n");
+               return NULL;
+       }
+
+       ret = spi_claim_bus(spi);
+       if (ret) {
+               debug("SF: Failed to claim SPI bus: %d\n", ret);
+               goto err_claim_bus;
+       }
+
+       imx_sf = (struct imx_spi_flash *)malloc(sizeof(struct imx_spi_flash));
+
+       if (!imx_sf) {
+               debug("SF: Failed to allocate memory\n");
+               spi_free_slave(spi);
+               return NULL;
+       }
+
+       imx_sf->flash.spi = spi;
+
+       /* Read the ID codes */
+       ret = spi_nor_flash_query(&(imx_sf->flash), idcode);
+       if (ret)
+               goto err_read_id;
+
+       for (i = 0; i < ARRAY_SIZE(imx_spi_flash_table); ++i) {
+               params = &imx_spi_flash_table[i];
+               if (params->idcode1 == idcode[1])
+                       break;
+       }
+
+       if (i == ARRAY_SIZE(imx_spi_flash_table)) {
+               debug("SF: Unsupported DataFlash ID %02x\n",
+                               idcode[1]);
+
+               goto err_invalid_dev;
+       }
+
+       imx_sf->params = params;
+
+       imx_sf->flash.name = params->name;
+       imx_sf->flash.size = params->device_size;
+
+       imx_sf->flash.read  = spi_nor_flash_read;
+       imx_sf->flash.write = spi_nor_flash_write;
+       imx_sf->flash.erase = spi_nor_flash_erase;
+
+       debug("SF: Detected %s with block size %lu, "
+                       "block count %lu, total %u bytes\n",
+                       params->name,
+                       params->block_size,
+                       params->block_count,
+                       params->device_size);
+
+       return &(imx_sf->flash);
+
+err_read_id:
+       spi_release_bus(spi);
+err_invalid_dev:
+       if (imx_sf)
+               free(imx_sf);
+err_claim_bus:
+       if (spi)
+               spi_free_slave(spi);
+       return NULL;
+}
+
+void spi_flash_free(struct spi_flash *flash)
+{
+       struct imx_spi_flash *imx_sf = NULL;
+
+       if (!flash)
+               return;
+
+       imx_sf = to_imx_spi_flash(flash);
+
+       if (flash->spi) {
+               spi_free_slave(flash->spi);
+               flash->spi = NULL;
+       }
+
+       free(imx_sf);
+}
+
diff --git a/drivers/mtd/spi/imx_spi_nor_sst.c b/drivers/mtd/spi/imx_spi_nor_sst.c
new file mode 100644 (file)
index 0000000..d484a51
--- /dev/null
@@ -0,0 +1,564 @@
+/*
+ * (C) Copyright 2008-2010 Freescale Semiconductor, Inc.
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+#include <config.h>
+#include <common.h>
+#include <spi.h>
+#include <spi_flash.h>
+#include <asm/errno.h>
+#include <linux/types.h>
+#include <malloc.h>
+
+#include <imx_spi.h>
+#include <imx_spi_nor.h>
+
+static u8 g_tx_buf[256];
+static u8 g_rx_buf[256];
+
+#define WRITE_ENABLE(a)                         spi_nor_cmd_1byte(a, WREN)
+#define WRITE_DISABLE(a)                spi_nor_cmd_1byte(a, WRDI)
+#define ENABLE_WRITE_STATUS(a)  spi_nor_cmd_1byte(a, EWSR)
+
+struct imx_spi_flash_params {
+       u8              idcode1;
+       u32             block_size;
+       u32             block_count;
+       u32             device_size;
+       const char      *name;
+};
+
+struct imx_spi_flash {
+       const struct imx_spi_flash_params *params;
+       struct spi_flash flash;
+};
+
+static inline struct imx_spi_flash *
+to_imx_spi_flash(struct spi_flash *flash)
+{
+       return container_of(flash, struct imx_spi_flash, flash);
+}
+
+static const struct imx_spi_flash_params imx_spi_flash_table[] = {
+       {
+               .idcode1                = 0x25,
+               .block_size             = SZ_64K,
+               .block_count            = 32,
+               .device_size            = SZ_64K * 32,
+               .name                   = "SST25VF016B - 2MB",
+       },
+};
+
+static s32 spi_nor_flash_query(struct spi_flash *flash, void* data)
+{
+       u8 au8Tmp[4] = { 0 };
+       u8 *pData = (u8 *)data;
+
+       g_tx_buf[3] = JEDEC_ID;
+
+       if (spi_xfer(flash->spi, (4 << 3), g_tx_buf, au8Tmp,
+                               SPI_XFER_BEGIN | SPI_XFER_END)) {
+               return -1;
+       }
+
+       printf("JEDEC ID: 0x%02x:0x%02x:0x%02x\n",
+                       au8Tmp[2], au8Tmp[1], au8Tmp[0]);
+
+       pData[0] = au8Tmp[2];
+       pData[1] = au8Tmp[1];
+       pData[2] = au8Tmp[0];
+
+       return 0;
+}
+
+static s32 spi_nor_cmd_1byte(struct spi_flash *flash, u8 cmd)
+{
+       g_tx_buf[0] = cmd;
+
+       if (spi_xfer(flash->spi, (1 << 3), g_tx_buf, g_rx_buf,
+                       SPI_XFER_BEGIN | SPI_XFER_END) != 0) {
+               printf("Error: %s(): %d\n", __func__, __LINE__);
+               return -1;
+       }
+       return 0;
+}
+
+static s32 spi_nor_status(struct spi_flash *flash)
+{
+       g_tx_buf[1] = RDSR;
+
+       if (spi_xfer(flash->spi, 2 << 3, g_tx_buf, g_rx_buf,
+                       SPI_XFER_BEGIN | SPI_XFER_END) != 0) {
+               printf("Error: %s(): %d\n", __func__, __LINE__);
+               return 0;
+       }
+       return g_rx_buf[0];
+}
+
+static int spi_nor_program_1byte(struct spi_flash *flash,
+               u8 data, void *addr)
+{
+       u32 addr_val = (u32)addr;
+
+       /* need to do write-enable command */
+       if (WRITE_ENABLE(flash) != 0) {
+               printf("Error : %d\n", __LINE__);
+               return -1;
+       }
+       g_tx_buf[0] = BYTE_PROG; /* need to skip bytes 1, 2, 3 */
+       g_tx_buf[4] = data;
+       g_tx_buf[5] = addr_val & 0xFF;
+       g_tx_buf[6] = (addr_val >> 8) & 0xFF;
+       g_tx_buf[7] = (addr_val >> 16) & 0xFF;
+
+       debug("0x%x: 0x%x\n", *(u32 *)g_tx_buf, *(u32 *)(g_tx_buf + 4));
+       debug("addr=0x%x\n", addr_val);
+
+       if (spi_xfer(flash->spi, 5 << 3, g_tx_buf, g_rx_buf,
+                       SPI_XFER_BEGIN | SPI_XFER_END) != 0) {
+               printf("Error: %s(%d): failed\n", __FILE__, __LINE__);
+               return -1;
+       }
+
+       while (spi_nor_status(flash) & RDSR_BUSY)
+               ;
+
+       return 0;
+}
+
+/*!
+ * Write 'val' to flash WRSR (write status register)
+ */
+static int spi_nor_write_status(struct spi_flash *flash, u8 val)
+{
+       g_tx_buf[0] = val;
+       g_tx_buf[1] = WRSR;
+
+       if (spi_xfer(flash->spi, 2 << 3, g_tx_buf, g_rx_buf,
+                       SPI_XFER_BEGIN | SPI_XFER_END) != 0) {
+               printf("Error: %s(): %d\n", __func__, __LINE__);
+               return -1;
+       }
+       return 0;
+}
+
+/*!
+ * Erase a block_size data from block_addr offset in the flash
+ */
+static int spi_nor_erase_block(struct spi_flash *flash,
+                               void *block_addr, u32 block_size)
+{
+       u32 *cmd = (u32 *)g_tx_buf;
+       u32 addr = (u32) block_addr;
+
+       if (block_size != SZ_64K &&
+               block_size != SZ_32K &&
+               block_size != SZ_4K) {
+               printf("Error - block_size is not "
+                               "4kB, 32kB or 64kB: 0x%x\n",
+                               block_size);
+               return -1;
+       }
+
+       if ((addr & (block_size - 1)) != 0) {
+               printf("Error - block_addr is not "
+                               "4kB, 32kB or 64kB aligned: %p\n",
+                               block_addr);
+               return -1;
+       }
+
+       if (ENABLE_WRITE_STATUS(flash) != 0 ||
+                       spi_nor_write_status(flash, 0) != 0) {
+               printf("Error: %s: %d\n", __func__, __LINE__);
+               return -1;
+       }
+
+       /* need to do write-enable command */
+       if (WRITE_ENABLE(flash) != 0) {
+               printf("Error : %d\n", __LINE__);
+               return -1;
+       }
+
+       if (block_size == SZ_64K)
+               *cmd = (ERASE_64K << 24) | (addr & 0x00FFFFFF);
+       else if (block_size == SZ_32K)
+               *cmd = (ERASE_32K << 24) | (addr & 0x00FFFFFF);
+       else if (block_size == SZ_4K)
+               *cmd = (ERASE_4K << 24) | (addr & 0x00FFFFFF);
+
+       /* now do the block erase */
+       if (spi_xfer(flash->spi, 4 << 3, g_tx_buf, g_rx_buf,
+                       SPI_XFER_BEGIN | SPI_XFER_END) != 0) {
+               return -1;
+       }
+
+       while (spi_nor_status(flash) & RDSR_BUSY)
+               ;
+
+       return 0;
+}
+
+static int spi_nor_flash_read(struct spi_flash *flash, u32 offset,
+               size_t len, void *buf)
+{
+       struct imx_spi_flash *imx_sf = to_imx_spi_flash(flash);
+       u32 *cmd = (u32 *)g_tx_buf;
+       u32 max_rx_sz = (MAX_SPI_BYTES) - 4;
+       u8 *d_buf = (u8 *)buf;
+       u8 *s_buf;
+       s32 s32remain_size = len;
+       int i;
+
+       if (!(flash->spi))
+               return -1;
+
+       printf("Reading SPI NOR flash 0x%x [0x%x bytes] -> ram 0x%p\n",
+               offset, len, buf);
+       debug("%s(from flash=0x%08x to ram=%p len=0x%x)\n",
+               __func__,
+               offset, buf, len);
+
+       if (len == 0)
+               return 0;
+
+       *cmd = (READ << 24) | ((u32)offset & 0x00FFFFFF);
+
+       for (; s32remain_size > 0; s32remain_size -= max_rx_sz, *cmd += max_rx_sz) {
+               debug("Addr:0x%p=>Offset:0x%08x, %d bytes transferred\n",
+                               d_buf,
+                               (*cmd & 0x00FFFFFF),
+                               (len - s32remain_size));
+               debug("%d%% completed\n", ((len - s32remain_size) * 100 / len));
+
+               if (s32remain_size < max_rx_sz) {
+                       debug("100%% completed\n");
+
+                       if (spi_xfer(flash->spi, (s32remain_size + 4) << 3,
+                               g_tx_buf, g_rx_buf,
+                               SPI_XFER_BEGIN | SPI_XFER_END) != 0) {
+                               printf("Error: %s(%d): failed\n", __FILE__, __LINE__);
+                               return -1;
+                       }
+                       /* throw away 4 bytes (5th received bytes is real) */
+                       s_buf = g_rx_buf + 4;
+
+                       /* now adjust the endianness */
+                       for (i = s32remain_size; i >= 0; i -= 4, s_buf += 4) {
+                               if (i < 4) {
+                                       if (i == 1) {
+                                               *d_buf = s_buf[0];
+                                       } else if (i == 2) {
+                                               *d_buf++ = s_buf[1];
+                                               *d_buf++ = s_buf[0];
+                                       } else if (i == 3) {
+                                               *d_buf++ = s_buf[2];
+                                               *d_buf++ = s_buf[1];
+                                               *d_buf++ = s_buf[0];
+                                       }
+                                       printf("SUCCESS\n\n");
+                                       return 0;
+                               }
+                               /* copy 4 bytes */
+                               *d_buf++ = s_buf[3];
+                               *d_buf++ = s_buf[2];
+                               *d_buf++ = s_buf[1];
+                               *d_buf++ = s_buf[0];
+                       }
+               }
+
+               /* now grab max_rx_sz data (+4 is
+               *needed due to 4-throw away bytes */
+               if (spi_xfer(flash->spi, (max_rx_sz + 4) << 3,
+                       g_tx_buf, g_rx_buf, SPI_XFER_BEGIN | SPI_XFER_END) != 0) {
+                       printf("Error: %s(%d): failed\n", __FILE__, __LINE__);
+                       return -1;
+               }
+               /* throw away 4 bytes (5th received bytes is real) */
+               s_buf = g_rx_buf + 4;
+               /* now adjust the endianness */
+               for (i = 0; i < max_rx_sz; i += 4, s_buf += 4) {
+                       *d_buf++ = s_buf[3];
+                       *d_buf++ = s_buf[2];
+                       *d_buf++ = s_buf[1];
+                       *d_buf++ = s_buf[0];
+               }
+
+               if ((s32remain_size % imx_sf->params->block_size) == 0)
+                       printf(".");
+       }
+       printf("SUCCESS\n\n");
+
+       return -1;
+}
+
+static int spi_nor_flash_write(struct spi_flash *flash, u32 offset,
+               size_t len, const void *buf)
+{
+       struct imx_spi_flash *imx_sf = to_imx_spi_flash(flash);
+       u32 d_addr = offset;
+       u8 *s_buf = (u8 *)buf;
+       s32 s32remain_size = len;
+
+       if (!(flash->spi))
+               return -1;
+
+       if (len == 0)
+               return 0;
+
+       printf("Writing SPI NOR flash 0x%x [0x%x bytes] <- ram 0x%p\n",
+               offset, len, buf);
+       debug("%s(flash addr=0x%08x, ram=%p, len=0x%x)\n",
+                       __func__, offset, buf, len);
+
+       if (ENABLE_WRITE_STATUS(flash) != 0 ||
+                       spi_nor_write_status(flash, 0) != 0) {
+               printf("Error: %s: %d\n", __func__, __LINE__);
+               return -1;
+       }
+
+       if ((d_addr & 1) != 0) {
+               /* program 1st byte */
+               if (spi_nor_program_1byte(flash, s_buf[0],
+                                       (void *)d_addr) != 0) {
+                       printf("Error: %s(%d)\n", __func__, __LINE__);
+                       return -1;
+               }
+               if (--s32remain_size == 0)
+                       return 0;
+               d_addr++;
+               s_buf++;
+       }
+
+       /* need to do write-enable command */
+       if (WRITE_ENABLE(flash) != 0) {
+               printf("Error : %d\n", __LINE__);
+               return -1;
+       }
+
+       /*
+       These two bytes write will be copied to txfifo first with
+       g_tx_buf[1] being shifted out and followed by g_tx_buf[0].
+       The reason for this is we will specify burst len=6. So SPI will
+       do this kind of data movement.
+       */
+       g_tx_buf[0] = d_addr >> 16;
+       g_tx_buf[1] = AAI_PROG;    /* need to skip bytes 1, 2 */
+       /* byte shifted order is: 7, 6, 5, 4 */
+       g_tx_buf[4] = s_buf[1];
+       g_tx_buf[5] = s_buf[0];
+       g_tx_buf[6] = d_addr;
+       g_tx_buf[7] = d_addr >> 8;
+       if (spi_xfer(flash->spi, 6 << 3, g_tx_buf, g_rx_buf,
+                       SPI_XFER_BEGIN | SPI_XFER_END) != 0) {
+               printf("Error: %s(%d): failed\n",
+                               __FILE__, __LINE__);
+               return -1;
+       }
+
+       while (spi_nor_status(flash) & RDSR_BUSY)
+               ;
+
+       for (d_addr += 2, s_buf += 2, s32remain_size -= 2;
+               s32remain_size > 1;
+               d_addr += 2, s_buf += 2, s32remain_size -= 2) {
+               debug("%d%% transferred\n",
+                       ((len - s32remain_size) * 100 / len));
+               /* byte shifted order is: 2,1,0 */
+               g_tx_buf[2] = AAI_PROG;
+               g_tx_buf[1] = s_buf[0];
+               g_tx_buf[0] = s_buf[1];
+
+               if (spi_xfer(flash->spi, 3 << 3, g_tx_buf, g_rx_buf,
+                               SPI_XFER_BEGIN | SPI_XFER_END) != 0) {
+                       printf("Error: %s(%d): failed\n",
+                                       __FILE__, __LINE__);
+                       return -1;
+               }
+
+               while (spi_nor_status(flash) & RDSR_BUSY)
+                       ;
+
+               if ((s32remain_size % imx_sf->params->block_size) == 0)
+                       printf(".");
+       }
+       printf("SUCCESS\n\n");
+       debug("100%% transferred\n");
+
+       WRITE_DISABLE(flash);
+       while (spi_nor_status(flash) & RDSR_BUSY)
+               ;
+
+       if (WRITE_ENABLE(flash) != 0) {
+               printf("Error : %d\n", __LINE__);
+               return -1;
+       }
+
+       if (len == 1) {
+               /* need to do write-enable command */
+               /* only 1 byte left */
+               if (spi_nor_program_1byte(flash, s_buf[0],
+                                       (void *)d_addr) != 0) {
+                       printf("Error: %s(%d)\n",
+                                       __func__, __LINE__);
+                       return -1;
+               }
+       }
+       return 0;
+}
+
+static int spi_nor_flash_erase(struct spi_flash *flash, u32 offset,
+               size_t len)
+{
+       s32 s32remain_size = len;
+
+       if (!(flash->spi))
+               return -1;
+
+       printf("Erasing SPI NOR flash 0x%x [0x%x bytes]\n",
+               offset, len);
+
+       if ((len % SZ_4K) != 0 || len == 0) {
+               printf("Error: size (0x%x) is not integer multiples of 4kB(0x1000)\n",
+                       len);
+               return -1;
+       }
+       if ((offset & (SZ_4K - 1)) != 0) {
+               printf("Error - addr is not 4kB(0x1000) aligned: 0x%08x\n",
+                       offset);
+               return -1;
+       }
+       for (; s32remain_size > 0; s32remain_size -= SZ_4K, offset += SZ_4K) {
+               debug("Erasing 0x%08x, %d%% erased\n",
+                               offset,
+                               ((len - s32remain_size) * 100 / len));
+               if (spi_nor_erase_block(flash,
+                               (void *)offset, SZ_4K) != 0) {
+                       printf("Error: spi_nor_flash_erase(): %d\n", __LINE__);
+                       return -1;
+               }
+               printf(".");
+       }
+       printf("SUCCESS\n\n");
+       debug("100%% erased\n");
+       return 0;
+}
+
+struct spi_flash *spi_flash_probe(unsigned int bus, unsigned int cs, unsigned int max_hz, unsigned int spi_mode)
+{
+       struct spi_slave *spi = NULL;
+       const struct imx_spi_flash_params *params = NULL;
+       struct imx_spi_flash *imx_sf = NULL;
+       u8  idcode[4] = { 0 };
+       u32 i = 0;
+       s32 ret = 0;
+
+       if (CONFIG_SPI_FLASH_CS != cs) {
+               printf("Invalid cs for SPI NOR.\n");
+               return NULL;
+       }
+
+       spi = spi_setup_slave(bus, cs, max_hz, spi_mode);
+
+       if (!spi) {
+               debug("SF: Failed to set up slave\n");
+               return NULL;
+       }
+
+       ret = spi_claim_bus(spi);
+       if (ret) {
+               debug("SF: Failed to claim SPI bus: %d\n", ret);
+               goto err_claim_bus;
+       }
+
+       imx_sf = (struct imx_spi_flash *)malloc(sizeof(struct imx_spi_flash));
+
+       if (!imx_sf) {
+               debug("SF: Failed to allocate memory\n");
+               spi_free_slave(spi);
+               return NULL;
+       }
+
+       imx_sf->flash.spi = spi;
+
+       /* Read the ID codes */
+       ret = spi_nor_flash_query(&(imx_sf->flash), idcode);
+       if (ret)
+               goto err_read_id;
+
+       for (i = 0; i < ARRAY_SIZE(imx_spi_flash_table); ++i) {
+               params = &imx_spi_flash_table[i];
+               if (params->idcode1 == idcode[1])
+                       break;
+       }
+
+       if (i == ARRAY_SIZE(imx_spi_flash_table)) {
+               debug("SF: Unsupported DataFlash ID %02x\n",
+                               idcode[1]);
+
+               goto err_invalid_dev;
+       }
+
+       imx_sf->params = params;
+
+       imx_sf->flash.name = params->name;
+       imx_sf->flash.size = params->device_size;
+
+       imx_sf->flash.read  = spi_nor_flash_read;
+       imx_sf->flash.write = spi_nor_flash_write;
+       imx_sf->flash.erase = spi_nor_flash_erase;
+
+       debug("SF: Detected %s with block size %lu, "
+                       "block count %lu, total %u bytes\n",
+                       params->name,
+                       params->block_size,
+                       params->block_count,
+                       params->device_size);
+
+       return &(imx_sf->flash);
+
+err_read_id:
+       spi_release_bus(spi);
+err_invalid_dev:
+       if (imx_sf)
+               free(imx_sf);
+err_claim_bus:
+       if (spi)
+               spi_free_slave(spi);
+       return NULL;
+}
+
+void spi_flash_free(struct spi_flash *flash)
+{
+       struct imx_spi_flash *imx_sf = NULL;
+
+       if (!flash)
+               return;
+
+       imx_sf = to_imx_spi_flash(flash);
+
+       if (flash->spi) {
+               spi_free_slave(flash->spi);
+               flash->spi = NULL;
+       }
+
+       free(imx_sf);
+}
+
index 430f90ceaf3fa14f5551cbddd182758ac702d44c..987c41b83a9e9832c2db0270e9f4f4e5de0b19f1 100644 (file)
@@ -70,6 +70,7 @@ COBJS-$(CONFIG_SH_ETHER) += sh_eth.o
 COBJS-$(CONFIG_SMC91111) += smc91111.o
 COBJS-$(CONFIG_SMC911X) += smc911x.o
 COBJS-$(CONFIG_DRIVER_TI_EMAC) += davinci_emac.o
+COBJS-$(CONFIG_DRIVER_TI_CPSW) += cpsw.o
 COBJS-$(CONFIG_TSEC_ENET) += tsec.o fsl_mdio.o
 COBJS-$(CONFIG_FMAN_ENET) += fsl_mdio.o
 COBJS-$(CONFIG_TSI108_ETH) += tsi108_eth.o
diff --git a/drivers/net/cpsw.c b/drivers/net/cpsw.c
new file mode 100644 (file)
index 0000000..d4c0818
--- /dev/null
@@ -0,0 +1,1022 @@
+/*
+ * CPSW Ethernet Switch Driver
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#include <common.h>
+#include <command.h>
+#include <net.h>
+#include <miiphy.h>
+#include <malloc.h>
+#include <net.h>
+#include <netdev.h>
+#include <asm/errno.h>
+#include <asm/io.h>
+#include <asm/arch/cpu.h>
+
+#define BITMASK(bits)          ((1 << (bits)) - 1)
+#define PHY_REG_MASK           0x1f
+#define PHY_ID_MASK            0x1f
+#define NUM_DESCS              (PKTBUFSRX * 2)
+#define PKT_MIN                        60
+#define PKT_MAX                        (1500 + 14 + 4 + 4)
+
+/* DMA Registers */
+#define CPDMA_TXCONTROL                0x004
+#define CPDMA_RXCONTROL                0x014
+#define CPDMA_SOFTRESET                0x01c
+#define CPDMA_RXFREE           0x0e0
+#define CPDMA_TXHDP_VER1       0x100
+#define CPDMA_TXHDP_VER2       0x200
+#define CPDMA_RXHDP_VER1       0x120
+#define CPDMA_RXHDP_VER2       0x220
+#define CPDMA_TXCP_VER1                0x140
+#define CPDMA_TXCP_VER2                0x240
+#define CPDMA_RXCP_VER1                0x160
+#define CPDMA_RXCP_VER2                0x260
+
+/* Descriptor mode bits */
+#define CPDMA_DESC_SOP         BIT(31)
+#define CPDMA_DESC_EOP         BIT(30)
+#define CPDMA_DESC_OWNER       BIT(29)
+#define CPDMA_DESC_EOQ         BIT(28)
+
+#ifndef CONFIG_SYS_CACHELINE_SIZE
+#define CONFIG_SYS_CACHELINE_SIZE      64
+#endif
+
+struct cpsw_mdio_regs {
+       u32     version;
+       u32     control;
+#define CONTROL_IDLE           (1 << 31)
+#define CONTROL_ENABLE         (1 << 30)
+
+       u32     alive;
+       u32     link;
+       u32     linkintraw;
+       u32     linkintmasked;
+       u32     __reserved_0[2];
+       u32     userintraw;
+       u32     userintmasked;
+       u32     userintmaskset;
+       u32     userintmaskclr;
+       u32     __reserved_1[20];
+
+       struct {
+               u32 access;
+               u32 physel;
+#define USERACCESS_GO          (1 << 31)
+#define USERACCESS_WRITE       (1 << 30)
+#define USERACCESS_ACK         (1 << 29)
+#define USERACCESS_READ                0
+#define USERACCESS_DATA                0xffff
+       } user[0];
+};
+
+struct cpsw_regs {
+       u32     id_ver;
+       u32     control;
+       u32     soft_reset;
+       u32     stat_port_en;
+       u32     ptype;
+};
+
+struct cpsw_slave_regs {
+       u32     max_blks;
+       u32     blk_cnt;
+       u32     flow_thresh;
+       u32     port_vlan;
+       u32     tx_pri_map;
+       u32     ts_seq_mtype;
+#ifdef CONFIG_TI814X
+       u32     ts_ctl;
+       u32     ts_seq_ltype;
+       u32     ts_vlan;
+#endif
+       u32     sa_lo;
+       u32     sa_hi;
+};
+
+struct cpsw_host_regs {
+       u32     max_blks;
+       u32     blk_cnt;
+       u32     flow_thresh;
+       u32     port_vlan;
+       u32     tx_pri_map;
+       u32     cpdma_tx_pri_map;
+       u32     cpdma_rx_chan_map;
+};
+
+struct cpsw_sliver_regs {
+       u32     id_ver;
+       u32     mac_control;
+       u32     mac_status;
+       u32     soft_reset;
+       u32     rx_maxlen;
+       u32     __reserved_0;
+       u32     rx_pause;
+       u32     tx_pause;
+       u32     __reserved_1;
+       u32     rx_pri_map;
+};
+
+#define ALE_ENTRY_BITS         68
+#define ALE_ENTRY_WORDS                DIV_ROUND_UP(ALE_ENTRY_BITS, 32)
+
+/* ALE Registers */
+#define ALE_CONTROL            0x08
+#define ALE_UNKNOWNVLAN                0x18
+#define ALE_TABLE_CONTROL      0x20
+#define ALE_TABLE              0x34
+#define ALE_PORTCTL            0x40
+
+#define ALE_TABLE_WRITE                BIT(31)
+
+#define ALE_TYPE_FREE                  0
+#define ALE_TYPE_ADDR                  1
+#define ALE_TYPE_VLAN                  2
+#define ALE_TYPE_VLAN_ADDR             3
+
+#define ALE_UCAST_PERSISTANT           0
+#define ALE_UCAST_UNTOUCHED            1
+#define ALE_UCAST_OUI                  2
+#define ALE_UCAST_TOUCHED              3
+
+#define ALE_MCAST_FWD                  0
+#define ALE_MCAST_BLOCK_LEARN_FWD      1
+#define ALE_MCAST_FWD_LEARN            2
+#define ALE_MCAST_FWD_2                        3
+
+enum cpsw_ale_port_state {
+       ALE_PORT_STATE_DISABLE  = 0x00,
+       ALE_PORT_STATE_BLOCK    = 0x01,
+       ALE_PORT_STATE_LEARN    = 0x02,
+       ALE_PORT_STATE_FORWARD  = 0x03,
+};
+
+/* ALE unicast entry flags - passed into cpsw_ale_add_ucast() */
+#define ALE_SECURE     1
+#define ALE_BLOCKED    2
+
+struct cpsw_slave {
+       struct cpsw_slave_regs          *regs;
+       struct cpsw_sliver_regs         *sliver;
+       int                             slave_num;
+       u32                             mac_control;
+       struct cpsw_slave_data          *data;
+};
+
+struct cpdma_desc {
+       /* hardware fields */
+       u32                     hw_next;
+       u32                     hw_buffer;
+       u32                     hw_len;
+       u32                     hw_mode;
+} __attribute__((aligned(CONFIG_SYS_CACHELINE_SIZE)));
+
+struct cpsw_desc {
+       volatile void *sw_buffer;
+       struct cpsw_desc *next;
+       struct cpdma_desc *dma_desc;
+};
+
+struct cpdma_chan {
+       struct cpsw_desc        *head, *tail;
+       void                    *hdp, *cp, *rxfree;
+};
+
+#define desc_write(desc, fld, val)     __raw_writel((u32)(val), &(desc)->dma_desc->fld)
+#define desc_read(desc, fld)           __raw_readl(&(desc)->dma_desc->fld)
+#define desc_read_ptr(desc, fld)       ((void *)__raw_readl(&(desc)->dma_desc->fld))
+
+#define chan_write(chan, fld, val)     __raw_writel((u32)(val), (chan)->fld)
+#define chan_read(chan, fld)           __raw_readl((chan)->fld)
+#define chan_read_ptr(chan, fld)       ((void *)__raw_readl((chan)->fld))
+
+struct cpsw_priv {
+       struct eth_device               *dev;
+       struct cpsw_platform_data       *data;
+       int                             host_port;
+
+       struct cpsw_regs                *regs;
+       void                            *dma_regs;
+       struct cpsw_host_regs           *host_port_regs;
+       void                            *ale_regs;
+
+       struct cpsw_desc                descs[NUM_DESCS];
+       struct cpsw_desc                *desc_free;
+       struct cpdma_chan               rx_chan, tx_chan;
+
+       struct cpsw_slave               *slaves;
+};
+
+#define for_each_slave(priv, func, arg...)     \
+       do {                                                            \
+               int idx;                                                \
+               for (idx = 0; idx < (priv)->data->slaves; idx++)        \
+                       (func)((priv)->slaves + idx, ##arg);            \
+       } while (0)
+
+static inline int cpsw_ale_get_field(u32 *ale_entry, u32 start, u32 bits)
+{
+       int idx;
+
+       idx    = start / 32;
+       start -= idx * 32;
+       idx    = 2 - idx; /* flip */
+       return (ale_entry[idx] >> start) & BITMASK(bits);
+}
+
+static inline void cpsw_ale_set_field(u32 *ale_entry, u32 start, u32 bits,
+                                     u32 value)
+{
+       int idx;
+
+       value &= BITMASK(bits);
+       idx    = start / 32;
+       start -= idx * 32;
+       idx    = 2 - idx; /* flip */
+       ale_entry[idx] &= ~(BITMASK(bits) << start);
+       ale_entry[idx] |=  (value << start);
+}
+
+#define DEFINE_ALE_FIELD(name, start, bits)                            \
+static inline int cpsw_ale_get_##name(u32 *ale_entry)                  \
+{                                                                      \
+       return cpsw_ale_get_field(ale_entry, start, bits);              \
+}                                                                      \
+static inline void cpsw_ale_set_##name(u32 *ale_entry, u32 value)      \
+{                                                                      \
+       cpsw_ale_set_field(ale_entry, start, bits, value);              \
+}
+
+DEFINE_ALE_FIELD(entry_type,           60,     2)
+DEFINE_ALE_FIELD(mcast_state,          62,     2)
+DEFINE_ALE_FIELD(port_mask,            66,     3)
+DEFINE_ALE_FIELD(ucast_type,           62,     2)
+DEFINE_ALE_FIELD(port_num,             66,     2)
+DEFINE_ALE_FIELD(blocked,              65,     1)
+DEFINE_ALE_FIELD(secure,               64,     1)
+DEFINE_ALE_FIELD(mcast,                        40,     1)
+
+/* The MAC address field in the ALE entry cannot be macroized as above */
+static inline void cpsw_ale_get_addr(u32 *ale_entry, u8 *addr)
+{
+       int i;
+
+       for (i = 0; i < 6; i++)
+               addr[i] = cpsw_ale_get_field(ale_entry, 40 - 8*i, 8);
+}
+
+static inline void cpsw_ale_set_addr(u32 *ale_entry, u8 *addr)
+{
+       int i;
+
+       for (i = 0; i < 6; i++)
+               cpsw_ale_set_field(ale_entry, 40 - 8*i, 8, addr[i]);
+}
+
+static int cpsw_ale_read(struct cpsw_priv *priv, int idx, u32 *ale_entry)
+{
+       int i;
+
+       __raw_writel(idx, priv->ale_regs + ALE_TABLE_CONTROL);
+
+       for (i = 0; i < ALE_ENTRY_WORDS; i++)
+               ale_entry[i] = __raw_readl(priv->ale_regs + ALE_TABLE + 4 * i);
+
+       return idx;
+}
+
+static int cpsw_ale_write(struct cpsw_priv *priv, int idx, u32 *ale_entry)
+{
+       int i;
+
+       for (i = 0; i < ALE_ENTRY_WORDS; i++)
+               __raw_writel(ale_entry[i], priv->ale_regs + ALE_TABLE + 4 * i);
+
+       __raw_writel(idx | ALE_TABLE_WRITE, priv->ale_regs + ALE_TABLE_CONTROL);
+
+       return idx;
+}
+
+static int cpsw_ale_match_addr(struct cpsw_priv *priv, u8* addr)
+{
+       u32 ale_entry[ALE_ENTRY_WORDS];
+       int type, idx;
+
+       for (idx = 0; idx < priv->data->ale_entries; idx++) {
+               u8 entry_addr[6];
+
+               cpsw_ale_read(priv, idx, ale_entry);
+               type = cpsw_ale_get_entry_type(ale_entry);
+               if (type != ALE_TYPE_ADDR && type != ALE_TYPE_VLAN_ADDR)
+                       continue;
+               cpsw_ale_get_addr(ale_entry, entry_addr);
+               if (memcmp(entry_addr, addr, 6) == 0)
+                       return idx;
+       }
+       return -ENOENT;
+}
+
+static int cpsw_ale_match_free(struct cpsw_priv *priv)
+{
+       u32 ale_entry[ALE_ENTRY_WORDS];
+       int type, idx;
+
+       for (idx = 0; idx < priv->data->ale_entries; idx++) {
+               cpsw_ale_read(priv, idx, ale_entry);
+               type = cpsw_ale_get_entry_type(ale_entry);
+               if (type == ALE_TYPE_FREE)
+                       return idx;
+       }
+       return -ENOENT;
+}
+
+static int cpsw_ale_find_ageable(struct cpsw_priv *priv)
+{
+       u32 ale_entry[ALE_ENTRY_WORDS];
+       int type, idx;
+
+       for (idx = 0; idx < priv->data->ale_entries; idx++) {
+               cpsw_ale_read(priv, idx, ale_entry);
+               type = cpsw_ale_get_entry_type(ale_entry);
+               if (type != ALE_TYPE_ADDR && type != ALE_TYPE_VLAN_ADDR)
+                       continue;
+               if (cpsw_ale_get_mcast(ale_entry))
+                       continue;
+               type = cpsw_ale_get_ucast_type(ale_entry);
+               if (type != ALE_UCAST_PERSISTANT &&
+                   type != ALE_UCAST_OUI)
+                       return idx;
+       }
+       return -ENOENT;
+}
+
+static int cpsw_ale_add_ucast(struct cpsw_priv *priv, u8 *addr,
+                             int port, int flags)
+{
+       u32 ale_entry[ALE_ENTRY_WORDS] = {0, 0, 0};
+       int idx;
+
+       cpsw_ale_set_entry_type(ale_entry, ALE_TYPE_ADDR);
+       cpsw_ale_set_addr(ale_entry, addr);
+       cpsw_ale_set_ucast_type(ale_entry, ALE_UCAST_PERSISTANT);
+       cpsw_ale_set_secure(ale_entry, (flags & ALE_SECURE) ? 1 : 0);
+       cpsw_ale_set_blocked(ale_entry, (flags & ALE_BLOCKED) ? 1 : 0);
+       cpsw_ale_set_port_num(ale_entry, port);
+
+       idx = cpsw_ale_match_addr(priv, addr);
+       if (idx < 0)
+               idx = cpsw_ale_match_free(priv);
+       if (idx < 0)
+               idx = cpsw_ale_find_ageable(priv);
+       if (idx < 0)
+               return -ENOMEM;
+
+       cpsw_ale_write(priv, idx, ale_entry);
+       return 0;
+}
+
+static int cpsw_ale_add_mcast(struct cpsw_priv *priv, u8 *addr, int port_mask)
+{
+       u32 ale_entry[ALE_ENTRY_WORDS] = {0, 0, 0};
+       int idx, mask;
+
+       idx = cpsw_ale_match_addr(priv, addr);
+       if (idx >= 0)
+               cpsw_ale_read(priv, idx, ale_entry);
+
+       cpsw_ale_set_entry_type(ale_entry, ALE_TYPE_ADDR);
+       cpsw_ale_set_addr(ale_entry, addr);
+       cpsw_ale_set_mcast_state(ale_entry, ALE_MCAST_FWD_2);
+
+       mask = cpsw_ale_get_port_mask(ale_entry);
+       port_mask |= mask;
+       cpsw_ale_set_port_mask(ale_entry, port_mask);
+
+       if (idx < 0)
+               idx = cpsw_ale_match_free(priv);
+       if (idx < 0)
+               idx = cpsw_ale_find_ageable(priv);
+       if (idx < 0)
+               return -ENOMEM;
+
+       cpsw_ale_write(priv, idx, ale_entry);
+       return 0;
+}
+
+static inline void cpsw_ale_control(struct cpsw_priv *priv, int bit, int val)
+{
+       u32 tmp, mask = BIT(bit);
+
+       tmp  = __raw_readl(priv->ale_regs + ALE_CONTROL);
+       tmp &= ~mask;
+       tmp |= val ? mask : 0;
+       __raw_writel(tmp, priv->ale_regs + ALE_CONTROL);
+}
+
+#define cpsw_ale_enable(priv, val)     cpsw_ale_control(priv, 31, val)
+#define cpsw_ale_clear(priv, val)      cpsw_ale_control(priv, 30, val)
+#define cpsw_ale_vlan_aware(priv, val) cpsw_ale_control(priv,  2, val)
+
+static inline void cpsw_ale_port_state(struct cpsw_priv *priv, int port,
+                                      int val)
+{
+       int offset = ALE_PORTCTL + 4 * port;
+       u32 tmp, mask = 0x3;
+
+       tmp  = __raw_readl(priv->ale_regs + offset);
+       tmp &= ~mask;
+       tmp |= val & 0x3;
+       __raw_writel(tmp, priv->ale_regs + offset);
+}
+
+static struct cpsw_mdio_regs *mdio_regs;
+
+/* wait until hardware is ready for another user access */
+static inline u32 wait_for_user_access(void)
+{
+       int timeout = 1000;
+       u32 reg;
+
+       while ((reg = __raw_readl(&mdio_regs->user[0].access)) & USERACCESS_GO) {
+               udelay(1);
+               if (--timeout <= 0) {
+                       printf("TIMEOUT waiting for USERACCESS_GO\n");
+                       return -1;
+               }
+       }
+
+       return reg;
+}
+
+/* wait until hardware state machine is idle */
+static inline void wait_for_idle(void)
+{
+       int timeout = 1000;
+
+       while ((__raw_readl(&mdio_regs->control) & CONTROL_IDLE) == 0) {
+               if (--timeout <= 0) {
+                       printf("TIMEOUT waiting for state machine idle\n");
+                       break;
+               }
+               udelay(1);
+       }
+}
+
+static int cpsw_mdio_read(const char *devname, unsigned char phy_id,
+                         unsigned char phy_reg, unsigned short *data)
+{
+       u32 reg;
+
+       if (phy_reg & ~PHY_REG_MASK || phy_id & ~PHY_ID_MASK)
+               return -EINVAL;
+
+       wait_for_user_access();
+       reg = (USERACCESS_GO | USERACCESS_READ | (phy_reg << 21) |
+              (phy_id << 16));
+       __raw_writel(reg, &mdio_regs->user[0].access);
+       reg = wait_for_user_access();
+
+       *data = (reg & USERACCESS_ACK) ? (reg & USERACCESS_DATA) : -1;
+       return (reg & USERACCESS_ACK) ? 0 : -EIO;
+}
+
+static int cpsw_mdio_write(const char *devname, unsigned char phy_id,
+                          unsigned char phy_reg, unsigned short data)
+{
+       u32 reg;
+
+       if (phy_reg & ~PHY_REG_MASK || phy_id & ~PHY_ID_MASK)
+               return -EINVAL;
+
+       wait_for_user_access();
+       reg = (USERACCESS_GO | USERACCESS_WRITE | (phy_reg << 21) |
+                  (phy_id << 16) | (data & USERACCESS_DATA));
+       __raw_writel(reg, &mdio_regs->user[0].access);
+       wait_for_user_access();
+
+       return 0;
+}
+
+static void cpsw_mdio_init(char *name, u32 mdio_base, u32 div)
+{
+       mdio_regs = (struct cpsw_mdio_regs *)mdio_base;
+
+       /* set enable and clock divider */
+       __raw_writel(div | CONTROL_ENABLE, &mdio_regs->control);
+
+       /*
+        * wait for scan logic to settle:
+        * the scan time consists of (a) a large fixed component, and (b) a
+        * small component that varies with the mii bus frequency.  These
+        * were estimated using measurements at 1.1 and 2.2 MHz on tnetv107x
+        * silicon.  Since the effect of (b) was found to be largely
+        * negligible, we keep things simple here.
+        */
+       udelay(1000);
+
+       miiphy_register(name, cpsw_mdio_read, cpsw_mdio_write);
+}
+
+static inline void soft_reset(void *reg)
+{
+       int loops = 0;
+
+       debug("%s %p\n", __func__, reg);
+       __raw_writel(1, reg);
+       while (__raw_readl(reg) & 1) {
+               loops++;
+       }
+       debug("%s: reset finished after %u loops\n", __func__, loops);
+}
+
+#define mac_hi(mac)    (((mac)[0] << 0) | ((mac)[1] << 8) |    \
+                        ((mac)[2] << 16) | ((mac)[3] << 24))
+#define mac_lo(mac)    (((mac)[4] << 0) | ((mac)[5] << 8))
+
+static void cpsw_set_slave_mac(struct cpsw_slave *slave,
+                              struct cpsw_priv *priv)
+{
+       __raw_writel(mac_hi(priv->dev->enetaddr), &slave->regs->sa_hi);
+       __raw_writel(mac_lo(priv->dev->enetaddr), &slave->regs->sa_lo);
+}
+
+#define NUM_TRIES 50
+static void cpsw_slave_update_link(struct cpsw_slave *slave,
+                                  struct cpsw_priv *priv, int *link)
+{
+       char *name = priv->dev->name;
+       int phy_id = slave->data->phy_id;
+       int speed, duplex;
+       unsigned short reg;
+       u32 mac_control = 0;
+       int retries = NUM_TRIES;
+
+       while (retries-- > 0) {
+               if (miiphy_read(name, phy_id, MII_BMSR, &reg)) {
+                       printf("Failed to read PHY reg\n");
+                       return; /* could not read, assume no link */
+               }
+
+               if (reg & BMSR_LSTATUS) { /* link up */
+                       speed = miiphy_speed(name, phy_id);
+                       duplex = miiphy_duplex(name, phy_id);
+
+                       *link = 1;
+                       mac_control = priv->data->mac_control;
+                       if (speed == 10)
+                               mac_control |= BIT(18); /* In Band mode */
+                       else if (speed == 100)
+                               mac_control |= BIT(15);
+                       else if (speed == 1000) {
+                               if (priv->data->gigabit_en)
+                                       mac_control |= BIT(7);
+                               else {
+                                       /* Disable gigabit as it's non-functional */
+                                       mac_control &= ~BIT(7);
+                                       speed = 100;
+                               }
+                       }
+
+                       if (duplex == FULL)
+                               mac_control |= BIT(0);  /* FULLDUPLEXEN */
+                       break;
+               }
+               udelay(100000);
+       }
+       debug("%s: mac_control: %08x -> %08x after %u loops\n", __func__,
+               slave->mac_control, mac_control, NUM_TRIES - retries);
+
+       if (mac_control == slave->mac_control)
+               return;
+
+       if (mac_control) {
+               printf("link up on port %d, speed %d, %s duplex\n",
+                               slave->slave_num, speed,
+                               (duplex == FULL) ?  "full" : "half");
+       } else {
+               printf("link down on port %d\n", slave->slave_num);
+       }
+
+       __raw_writel(mac_control, &slave->sliver->mac_control);
+       slave->mac_control = mac_control;
+}
+
+static int cpsw_update_link(struct cpsw_priv *priv)
+{
+       int link = 0;
+       for_each_slave(priv, cpsw_slave_update_link, priv, &link);
+       return link;
+}
+
+static inline u32 cpsw_get_slave_port(struct cpsw_priv *priv, u32 slave_num)
+{
+       if (priv->host_port == 0)
+               return slave_num + 1;
+       else
+               return slave_num;
+}
+
+static void cpsw_slave_init(struct cpsw_slave *slave, struct cpsw_priv *priv)
+{
+       u32     slave_port;
+
+       debug("%s\n", __func__);
+
+       soft_reset(&slave->sliver->soft_reset);
+
+       /* setup priority mapping */
+       __raw_writel(0x76543210, &slave->sliver->rx_pri_map);
+       __raw_writel(0x33221100, &slave->regs->tx_pri_map);
+
+       /* setup max packet size, and mac address */
+       __raw_writel(PKT_MAX, &slave->sliver->rx_maxlen);
+       cpsw_set_slave_mac(slave, priv);
+
+       slave->mac_control = 0; /* no link yet */
+
+       /* enable forwarding */
+       slave_port = cpsw_get_slave_port(priv, slave->slave_num);
+       cpsw_ale_port_state(priv, slave_port, ALE_PORT_STATE_FORWARD);
+
+       cpsw_ale_add_mcast(priv, NetBcastAddr, 1 << slave_port);
+
+       priv->data->phy_init(priv->dev->name, slave->data->phy_id);
+}
+
+static void cpdma_desc_get(struct cpsw_desc *desc)
+{
+       invalidate_dcache_range((u32)desc->dma_desc, (u32)(&desc->dma_desc[1]));
+}
+
+static void cpdma_desc_put(struct cpsw_desc *desc)
+{
+       flush_dcache_range((u32)desc->dma_desc, (u32)(&desc->dma_desc[1]));
+}
+
+static struct cpsw_desc *cpdma_desc_alloc(struct cpsw_priv *priv)
+{
+       struct cpsw_desc *desc = priv->desc_free;
+
+       if (desc) {
+               cpdma_desc_get(desc);
+               priv->desc_free = desc->next;
+       }
+       return desc;
+}
+
+static void cpdma_desc_free(struct cpsw_priv *priv, struct cpsw_desc *desc)
+{
+       if (desc) {
+               desc_write(desc, hw_next, priv->desc_free->dma_desc);
+               cpdma_desc_put(desc);
+               desc->next = priv->desc_free;
+               priv->desc_free = desc;
+       }
+}
+static int cpdma_submit(struct cpsw_priv *priv, struct cpdma_chan *chan,
+                       volatile void *buffer, int len)
+{
+       struct cpsw_desc *desc, *prev;
+       u32 mode;
+
+       if (!buffer) {
+               printf("ERROR: %s() NULL buffer\n", __func__);
+               return -EINVAL;
+       }
+
+       flush_dcache_range((u32)buffer, (u32)buffer + len);
+
+       desc = cpdma_desc_alloc(priv);
+       if (!desc)
+               return -ENOMEM;
+
+       debug("%s@%d: %cX desc %p DMA %p\n", __func__, __LINE__,
+               chan == &priv->rx_chan ? 'R' : 'T', desc, desc->dma_desc);
+       if (len < PKT_MIN)
+               len = PKT_MIN;
+
+       mode = CPDMA_DESC_OWNER | CPDMA_DESC_SOP | CPDMA_DESC_EOP;
+
+       desc->next = NULL;
+       desc_write(desc, hw_next,   0);
+       desc_write(desc, hw_buffer, buffer);
+       desc_write(desc, hw_len,    len);
+       desc_write(desc, hw_mode,   mode | len);
+
+       desc->sw_buffer = buffer;
+
+       cpdma_desc_put(desc);
+       if (!chan->head) {
+               /* simple case - first packet enqueued */
+               chan->head = desc;
+               chan->tail = desc;
+               chan_write(chan, hdp, desc->dma_desc);
+               goto done;
+       }
+
+       /* not the first packet - enqueue at the tail */
+       prev = chan->tail;
+
+       prev->next = desc;
+       cpdma_desc_get(prev);
+       desc_write(prev, hw_next, desc->dma_desc);
+       cpdma_desc_put(prev);
+
+       chan->tail = desc;
+
+       /* next check if EOQ has been triggered already */
+       if (desc_read(prev, hw_mode) & CPDMA_DESC_EOQ)
+               chan_write(chan, hdp, desc->dma_desc);
+
+done:
+       if (chan->rxfree)
+               chan_write(chan, rxfree, 1);
+       debug("%s@%d\n", __func__, __LINE__);
+       return 0;
+}
+
+static int cpdma_process(struct cpsw_priv *priv, struct cpdma_chan *chan,
+                        volatile void **buffer, int *len)
+{
+       struct cpsw_desc *desc = chan->head;
+       u32 status;
+
+       if (!desc)
+               return -ENOENT;
+
+       cpdma_desc_get(desc);
+
+       status = desc_read(desc, hw_mode);
+       if (status & CPDMA_DESC_OWNER)
+               return -EBUSY;
+
+       if (len)
+               *len = status & 0x7ff;
+
+       if (buffer)
+               *buffer = desc->sw_buffer;
+       debug("%s@%d: buffer=%p\n", __func__, __LINE__, desc->sw_buffer);
+
+       chan->head = desc->next;
+       chan_write(chan, cp, desc->dma_desc);
+
+       cpdma_desc_free(priv, desc);
+       return 0;
+}
+
+static int cpsw_init(struct eth_device *dev, bd_t *bis)
+{
+       struct cpsw_priv        *priv = dev->priv;
+       int i, ret;
+
+       debug("%s\n", __func__);
+
+       priv->data->control(1);
+
+       /* soft reset the controller and initialize priv */
+       soft_reset(&priv->regs->soft_reset);
+
+       /* initialize and reset the address lookup engine */
+       cpsw_ale_enable(priv, 1);
+       cpsw_ale_clear(priv, 1);
+       cpsw_ale_vlan_aware(priv, 0); /* vlan unaware mode */
+
+       /* setup host port priority mapping */
+       __raw_writel(0x76543210, &priv->host_port_regs->cpdma_tx_pri_map);
+       __raw_writel(0, &priv->host_port_regs->cpdma_rx_chan_map);
+
+       /* disable priority elevation and enable statistics on all ports */
+       __raw_writel(0, &priv->regs->ptype);
+
+       /* enable statistics collection only on the host port */
+       __raw_writel(BIT(priv->host_port), &priv->regs->stat_port_en);
+
+       cpsw_ale_port_state(priv, priv->host_port, ALE_PORT_STATE_FORWARD);
+
+       cpsw_ale_add_ucast(priv, priv->dev->enetaddr, priv->host_port,
+                          ALE_SECURE);
+       cpsw_ale_add_mcast(priv, NetBcastAddr, 1 << priv->host_port);
+
+       for_each_slave(priv, cpsw_slave_init, priv);
+
+       cpsw_update_link(priv);
+
+       /* init descriptor pool */
+       for (i = 0; i < NUM_DESCS; i++) {
+               struct cpsw_desc *next_desc = (i < (NUM_DESCS - 1)) ?
+                       &priv->descs[i + 1] : NULL;
+
+               priv->descs[i].next = next_desc;
+               desc_write(&priv->descs[i], hw_next,
+                       next_desc ? next_desc->dma_desc : 0);
+               cpdma_desc_put(&priv->descs[i]);
+       }
+       priv->desc_free = &priv->descs[0];
+
+       /* initialize channels */
+       if (priv->data->version == CPSW_CTRL_VERSION_2) {
+               memset(&priv->rx_chan, 0, sizeof(struct cpdma_chan));
+               priv->rx_chan.hdp       = priv->dma_regs + CPDMA_RXHDP_VER2;
+               priv->rx_chan.cp        = priv->dma_regs + CPDMA_RXCP_VER2;
+               priv->rx_chan.rxfree    = priv->dma_regs + CPDMA_RXFREE;
+
+               memset(&priv->tx_chan, 0, sizeof(struct cpdma_chan));
+               priv->tx_chan.hdp       = priv->dma_regs + CPDMA_TXHDP_VER2;
+               priv->tx_chan.cp        = priv->dma_regs + CPDMA_TXCP_VER2;
+       } else {
+               memset(&priv->rx_chan, 0, sizeof(struct cpdma_chan));
+               priv->rx_chan.hdp       = priv->dma_regs + CPDMA_RXHDP_VER1;
+               priv->rx_chan.cp        = priv->dma_regs + CPDMA_RXCP_VER1;
+               priv->rx_chan.rxfree    = priv->dma_regs + CPDMA_RXFREE;
+
+               memset(&priv->tx_chan, 0, sizeof(struct cpdma_chan));
+               priv->tx_chan.hdp       = priv->dma_regs + CPDMA_TXHDP_VER1;
+               priv->tx_chan.cp        = priv->dma_regs + CPDMA_TXCP_VER1;
+       }
+
+       /* clear dma state */
+       soft_reset(priv->dma_regs + CPDMA_SOFTRESET);
+
+       if (priv->data->version == CPSW_CTRL_VERSION_2) {
+               for (i = 0; i < priv->data->channels; i++) {
+                       __raw_writel(0, priv->dma_regs + CPDMA_RXHDP_VER2 + 4 * i);
+                       __raw_writel(0, priv->dma_regs + CPDMA_RXFREE + 4 * i);
+                       __raw_writel(0, priv->dma_regs + CPDMA_RXCP_VER2 + 4 * i);
+                       __raw_writel(0, priv->dma_regs + CPDMA_TXHDP_VER2 + 4 * i);
+                       __raw_writel(0, priv->dma_regs + CPDMA_TXCP_VER2 + 4 * i);
+               }
+       } else {
+               for (i = 0; i < priv->data->channels; i++) {
+                       __raw_writel(0, priv->dma_regs + CPDMA_RXHDP_VER1 + 4 * i);
+                       __raw_writel(0, priv->dma_regs + CPDMA_RXFREE + 4 * i);
+                       __raw_writel(0, priv->dma_regs + CPDMA_RXCP_VER1 + 4 * i);
+                       __raw_writel(0, priv->dma_regs + CPDMA_TXHDP_VER1 + 4 * i);
+                       __raw_writel(0, priv->dma_regs + CPDMA_TXCP_VER1 + 4 * i);
+
+               }
+       }
+       __raw_writel(1, priv->dma_regs + CPDMA_TXCONTROL);
+       __raw_writel(1, priv->dma_regs + CPDMA_RXCONTROL);
+
+       /* submit rx descs */
+       for (i = 0; i < PKTBUFSRX; i++) {
+               ret = cpdma_submit(priv, &priv->rx_chan, NetRxPackets[i],
+                                  PKTSIZE);
+               if (ret < 0) {
+                       printf("error %d submitting rx desc\n", ret);
+                       break;
+               }
+       }
+
+       return ret;
+}
+
+static void cpsw_halt(struct eth_device *dev)
+{
+       struct cpsw_priv *priv = dev->priv;
+
+       debug("%s\n", __func__);
+       priv->data->control(0);
+}
+
+static int cpsw_send(struct eth_device *dev, volatile void *packet, int length)
+{
+       struct cpsw_priv *priv = dev->priv;
+       volatile void *buffer;
+       int len;
+
+       debug("%s@%d: sending packet %p..%p\n", __func__, __LINE__,
+               packet, packet + length - 1);
+
+       if (!priv->data->mac_control && !cpsw_update_link(priv)) {
+               printf("%s: Cannot send packet; link is down\n", __func__);
+               return -EIO;
+       }
+
+       /* first reap completed packets */
+       while (cpdma_process(priv, &priv->tx_chan, &buffer, &len) == 0)
+               /* NOP */;
+
+       return cpdma_submit(priv, &priv->tx_chan, packet, length);
+}
+
+static int cpsw_recv(struct eth_device *dev)
+{
+       struct cpsw_priv        *priv = dev->priv;
+       volatile void *buffer;
+       int len;
+
+       while (cpdma_process(priv, &priv->rx_chan, &buffer, &len) == 0) {
+               if (buffer) {
+                       NetReceive(buffer, len);
+                       cpdma_submit(priv, &priv->rx_chan, buffer, PKTSIZE);
+               } else {
+                       printf("NULL buffer returned from cpdma_process\n");
+                       return -EIO;
+               }
+       }
+       return 0;
+}
+
+static void cpsw_slave_setup(struct cpsw_slave *slave, int slave_num,
+                           struct cpsw_priv *priv)
+{
+       void                    *regs = priv->regs;
+       struct cpsw_slave_data  *data = priv->data->slave_data + slave_num;
+
+       debug("%s@%d: slave[%d] %p\n", __func__, __LINE__,
+               slave_num, slave);
+       slave->slave_num = slave_num;
+       slave->data     = data;
+       slave->regs     = regs + data->slave_reg_ofs;
+       slave->sliver   = regs + data->sliver_reg_ofs;
+}
+
+int cpsw_register(struct cpsw_platform_data *data)
+{
+       struct cpsw_priv        *priv;
+       void                    *regs = (void *)data->cpsw_base;
+       struct eth_device       *dev;
+       int i;
+
+       debug("%s@%d\n", __func__, __LINE__);
+
+       dev = calloc(sizeof(*dev), 1);
+       if (!dev)
+               return -ENOMEM;
+
+       priv = calloc(sizeof(*priv), 1);
+       if (!priv) {
+               free(dev);
+               return -ENOMEM;
+       }
+
+       priv->data = data;
+       priv->dev  = dev;
+
+       priv->slaves = calloc(sizeof(struct cpsw_slave), data->slaves);
+       if (!priv->slaves) {
+               free(dev);
+               free(priv);
+               return -ENOMEM;
+       }
+
+       for (i = 0; i < NUM_DESCS; i++) {
+               priv->descs[i].dma_desc = memalign(CONFIG_SYS_CACHELINE_SIZE,
+                               sizeof(struct cpsw_desc) * NUM_DESCS);
+               if (!priv->descs[i].dma_desc) {
+                       while (--i >= 0) {
+                               free(priv->descs[i].dma_desc);
+                       }
+                       free(priv->slaves);
+                       free(priv);
+                       free(dev);
+                       return -ENOMEM;
+               }
+               debug("DMA desc[%d] allocated @ %p desc_size %u\n",
+                       i, priv->descs[i].dma_desc,
+                       sizeof(*priv->descs[i].dma_desc));
+       }
+
+       priv->host_port         = data->host_port_num;
+       priv->regs              = regs;
+       priv->host_port_regs    = regs + data->host_port_reg_ofs;
+       priv->dma_regs          = regs + data->cpdma_reg_ofs;
+       priv->ale_regs          = regs + data->ale_reg_ofs;
+
+       for_each_slave(priv, cpsw_slave_setup, idx, priv);
+       debug("%s@%d\n", __func__, __LINE__);
+
+       strcpy(dev->name, "cpsw");
+       dev->iobase     = 0;
+       dev->init       = cpsw_init;
+       dev->halt       = cpsw_halt;
+       dev->send       = cpsw_send;
+       dev->recv       = cpsw_recv;
+       dev->priv       = priv;
+
+       eth_register(dev);
+
+       cpsw_mdio_init(dev->name, data->mdio_base, data->mdio_div);
+
+       return 1;
+}
index d8db9f0c6e808fd2d14a6f000f2f4dd0c80fbd47..8d4cef00c5a3934170a0958cfedd91e6e7d0d8c4 100644 (file)
@@ -71,6 +71,8 @@ struct nbuf {
        uint8_t head[16];       /**< MAC header(6 + 6 + 2) + 2(aligned) */
 };
 
+static int rx_idx;
+
 #ifdef CONFIG_FEC_MXC_SWAP_PACKET
 static void swap_packet(uint32_t *packet, int length)
 {
@@ -89,7 +91,7 @@ static int fec_mdio_read(struct ethernet_regs *eth, uint8_t phyAddr,
 {
        uint32_t reg;           /* convenient holder for the PHY register */
        uint32_t phy;           /* convenient holder for the PHY */
-       uint32_t start;
+       ulong start;
        int val;
 
        /*
@@ -109,6 +111,8 @@ static int fec_mdio_read(struct ethernet_regs *eth, uint8_t phyAddr,
        start = get_timer(0);
        while (!(readl(&eth->ievent) & FEC_IEVENT_MII)) {
                if (get_timer(start) > (CONFIG_SYS_HZ / 1000)) {
+                       if (readl(&eth->ievent) & FEC_IEVENT_MII)
+                               break;
                        printf("Read MDIO failed...\n");
                        return -1;
                }
@@ -123,7 +127,7 @@ static int fec_mdio_read(struct ethernet_regs *eth, uint8_t phyAddr,
         * it's now safe to read the PHY's register
         */
        val = (unsigned short)readl(&eth->mii_data);
-       debug("%s: phy: %02x reg:%02x val:%#x\n", __func__, phyAddr,
+       debug("%s: phy: %02x reg:%02x val:%#06x\n", __func__, phyAddr,
                        regAddr, val);
        return val;
 }
@@ -144,7 +148,7 @@ static int fec_mdio_write(struct ethernet_regs *eth, uint8_t phyAddr,
 {
        uint32_t reg;           /* convenient holder for the PHY register */
        uint32_t phy;           /* convenient holder for the PHY */
-       uint32_t start;
+       ulong start;
 
        reg = regAddr << FEC_MII_DATA_RA_SHIFT;
        phy = phyAddr << FEC_MII_DATA_PA_SHIFT;
@@ -158,6 +162,8 @@ static int fec_mdio_write(struct ethernet_regs *eth, uint8_t phyAddr,
        start = get_timer(0);
        while (!(readl(&eth->ievent) & FEC_IEVENT_MII)) {
                if (get_timer(start) > (CONFIG_SYS_HZ / 1000)) {
+                       if (readl(&eth->ievent) & FEC_IEVENT_MII)
+                               break;
                        printf("Write MDIO failed...\n");
                        return -1;
                }
@@ -167,7 +173,7 @@ static int fec_mdio_write(struct ethernet_regs *eth, uint8_t phyAddr,
         * clear MII interrupt bit
         */
        writel(FEC_IEVENT_MII, &eth->ievent);
-       debug("%s: phy: %02x reg:%02x val:%#x\n", __func__, phyAddr,
+       debug("%s: phy: %02x reg:%02x val:%#06x\n", __func__, phyAddr,
                        regAddr, data);
 
        return 0;
@@ -187,9 +193,10 @@ int fec_phy_write(struct mii_dev *bus, int phyAddr, int dev_addr, int regAddr,
 #ifndef CONFIG_PHYLIB
 static int miiphy_restart_aneg(struct eth_device *dev)
 {
+       int ret = 0;
+#if !defined(CONFIG_FEC_MXC_NO_ANEG)
        struct fec_priv *fec = (struct fec_priv *)dev->priv;
        struct ethernet_regs *eth = fec->bus->priv;
-       int ret = 0;
 
        /*
         * Wake up from sleep if necessary
@@ -213,6 +220,7 @@ static int miiphy_restart_aneg(struct eth_device *dev)
        if (fec->mii_postcall)
                ret = fec->mii_postcall(fec->phy_id);
 
+#endif
        return ret;
 }
 
@@ -245,26 +253,22 @@ static int miiphy_wait_aneg(struct eth_device *dev)
 }
 #endif
 
-static int fec_rx_task_enable(struct fec_priv *fec)
+static inline void fec_rx_task_enable(struct fec_priv *fec)
 {
        writel(1 << 24, &fec->eth->r_des_active);
-       return 0;
 }
 
-static int fec_rx_task_disable(struct fec_priv *fec)
+static inline void fec_rx_task_disable(struct fec_priv *fec)
 {
-       return 0;
 }
 
-static int fec_tx_task_enable(struct fec_priv *fec)
+static inline void fec_tx_task_enable(struct fec_priv *fec)
 {
        writel(1 << 24, &fec->eth->x_des_active);
-       return 0;
 }
 
-static int fec_tx_task_disable(struct fec_priv *fec)
+static inline void fec_tx_task_disable(struct fec_priv *fec)
 {
-       return 0;
 }
 
 /**
@@ -339,7 +343,7 @@ static void fec_tbd_init(struct fec_priv *fec)
        writew(0x0000, &fec->tbd_base[0].status);
        writew(FEC_TBD_WRAP, &fec->tbd_base[1].status);
        fec->tbd_index = 0;
-       flush_dcache_range(addr, addr+size);
+       flush_dcache_range(addr, addr + size);
 }
 
 /**
@@ -389,8 +393,21 @@ static void fec_eth_phy_config(struct eth_device *dev)
        struct fec_priv *fec = (struct fec_priv *)dev->priv;
        struct phy_device *phydev;
 
-       phydev = phy_connect(fec->bus, fec->phy_id, dev,
-                       PHY_INTERFACE_MODE_RGMII);
+       if (fec->phy_id < 0) {
+               int phy_id;
+
+               for (phy_id = 0; phy_id < 32; phy_id++) {
+                       debug("%s: Probing PHY ID %02x\n", __func__, phy_id);
+                       phydev = phy_connect(fec->bus, phy_id, dev,
+                                       PHY_INTERFACE_MODE_RGMII);
+
+                       if (phydev)
+                               break;
+               }
+       } else {
+               phydev = phy_connect(fec->bus, fec->phy_id, dev,
+                               PHY_INTERFACE_MODE_RGMII);
+       }
        if (phydev) {
                fec->phydev = phydev;
                phy_config(phydev);
@@ -398,13 +415,49 @@ static void fec_eth_phy_config(struct eth_device *dev)
 #endif
 }
 
+/*
+ * Do initial configuration of the FEC registers
+ */
+static void fec_reg_setup(struct fec_priv *fec)
+{
+       uint32_t rcntrl;
+
+       /*
+        * Set interrupt mask register
+        */
+       writel(0x00000000, &fec->eth->imask);
+
+       /*
+        * Clear FEC-Lite interrupt event register(IEVENT)
+        */
+       writel(0xffffffff, &fec->eth->ievent);
+
+
+       /*
+        * Set FEC-Lite receive control register(R_CNTRL):
+        */
+
+       /* Start with frame length = 1518, common for all modes. */
+       rcntrl = PKTSIZE << FEC_RCNTRL_MAX_FL_SHIFT;
+       if (fec->xcv_type == SEVENWIRE)
+               rcntrl |= FEC_RCNTRL_FCE;
+       else if (fec->xcv_type == RGMII)
+               rcntrl |= FEC_RCNTRL_RGMII;
+       else if (fec->xcv_type == RMII)
+               rcntrl |= FEC_RCNTRL_RMII;
+       else    /* MII mode */
+               rcntrl |= FEC_RCNTRL_FCE | FEC_RCNTRL_MII_MODE;
+
+       writel(rcntrl, &fec->eth->r_cntrl);
+}
+
 /**
  * Start the FEC engine
  * @param[in] dev Our device to handle
  */
 static int fec_open(struct eth_device *edev)
 {
-       struct fec_priv *fec = (struct fec_priv *)edev->priv;
+       struct fec_priv *fec = edev->priv;
        int speed;
        uint32_t addr, size;
        int i;
@@ -510,9 +563,8 @@ static int fec_open(struct eth_device *edev)
 
 static int fec_init(struct eth_device *dev, bd_t* bd)
 {
-       struct fec_priv *fec = (struct fec_priv *)dev->priv;
-       uint32_t mib_ptr = (uint32_t)&fec->eth->rmon_t_drop;
-       uint32_t rcntrl;
+       struct fec_priv *fec = dev->priv;
+       uint32_t *mib_ptr = (uint32_t *)&fec->eth->rmon_t_drop;
        uint32_t size;
        int i, ret;
 
@@ -560,33 +612,7 @@ static int fec_init(struct eth_device *dev, bd_t* bd)
                                   (unsigned)fec->rbd_base + size);
        }
 
-       /*
-        * Set interrupt mask register
-        */
-       writel(0x00000000, &fec->eth->imask);
-
-       /*
-        * Clear FEC-Lite interrupt event register(IEVENT)
-        */
-       writel(0xffffffff, &fec->eth->ievent);
-
-
-       /*
-        * Set FEC-Lite receive control register(R_CNTRL):
-        */
-
-       /* Start with frame length = 1518, common for all modes. */
-       rcntrl = PKTSIZE << FEC_RCNTRL_MAX_FL_SHIFT;
-       if (fec->xcv_type == SEVENWIRE)
-               rcntrl |= FEC_RCNTRL_FCE;
-       else if (fec->xcv_type == RGMII)
-               rcntrl |= FEC_RCNTRL_RGMII;
-       else if (fec->xcv_type == RMII)
-               rcntrl |= FEC_RCNTRL_RMII;
-       else    /* MII mode */
-               rcntrl |= FEC_RCNTRL_FCE | FEC_RCNTRL_MII_MODE;
-
-       writel(rcntrl, &fec->eth->r_cntrl);
+       fec_reg_setup(fec);
 
        if (fec->xcv_type == MII10 || fec->xcv_type == MII100)
                fec_mii_setspeed(fec);
@@ -604,8 +630,8 @@ static int fec_init(struct eth_device *dev, bd_t* bd)
 
 
        /* clear MIB RAM */
-       for (i = mib_ptr; i <= mib_ptr + 0xfc; i += 4)
-               writel(0, i);
+       for (i = 0; i <= 0xfc >> 2; i++)
+               writel(0, &mib_ptr[i]);
 
        /* FIFO receive start register */
        writel(0x520, &fec->eth->r_fstart);
@@ -637,7 +663,7 @@ err1:
 static void fec_halt(struct eth_device *dev)
 {
        struct fec_priv *fec = (struct fec_priv *)dev->priv;
-       int counter = 0xffff;
+       int counter = 1000;
 
        /*
         * issue graceful stop command to the FEC transmitter if necessary
@@ -650,7 +676,7 @@ static void fec_halt(struct eth_device *dev)
         * wait for graceful stop to register
         */
        while ((counter--) && (!(readl(&fec->eth->ievent) & FEC_IEVENT_GRA)))
-               udelay(1);
+               udelay(100);
 
        /*
         * Disable SmartDMA tasks
@@ -679,6 +705,7 @@ static void fec_halt(struct eth_device *dev)
 static int fec_send(struct eth_device *dev, volatile void *packet, int length)
 {
        unsigned int status;
+       int timeout = 1000;
        uint32_t size;
        uint32_t addr;
 
@@ -686,7 +713,7 @@ static int fec_send(struct eth_device *dev, volatile void *packet, int length)
         * This routine transmits one frame.  This routine only accepts
         * 6-byte Ethernet addresses.
         */
-       struct fec_priv *fec = (struct fec_priv *)dev->priv;
+       struct fec_priv *fec = dev->priv;
 
        /*
         * Check for valid length of data.
@@ -716,7 +743,7 @@ static int fec_send(struct eth_device *dev, volatile void *packet, int length)
         * update BD's status now
         * This block:
         * - is always the last in a chain (means no chain)
-        * - should transmitt the CRC
+        * - should transmit the CRC
         * - might be the last BD in the list, so the address counter should
         *   wrap (-> keep the WRAP flag)
         */
@@ -745,11 +772,13 @@ static int fec_send(struct eth_device *dev, volatile void *packet, int length)
         */
        invalidate_dcache_range(addr, addr + size);
        while (readw(&fec->tbd_base[fec->tbd_index].status) & FEC_TBD_READY) {
+               if (--timeout < 0)
+                       return -ETIMEDOUT;
                udelay(1);
                invalidate_dcache_range(addr, addr + size);
        }
 
-       debug("fec_send: status 0x%x index %d\n",
+       debug("fec_send: status 0x%04x index %d\n",
                        readw(&fec->tbd_base[fec->tbd_index].status),
                        fec->tbd_index);
        /* for next transmission use the other buffer */
@@ -776,14 +805,15 @@ static int fec_recv(struct eth_device *dev)
        uint16_t bd_status;
        uint32_t addr, size;
        int i;
-       uchar buff[FEC_MAX_PKT_SIZE];
 
        /*
         * Check if any critical events have happened
         */
        ievent = readl(&fec->eth->ievent);
        writel(ievent, &fec->eth->ievent);
-       debug("fec_recv: ievent 0x%lx\n", ievent);
+
+       if (ievent)
+               debug("fec_recv: ievent 0x%lx\n", ievent);
        if (ievent & FEC_IEVENT_BABR) {
                fec_halt(dev);
                fec_init(dev, fec->bd);
@@ -824,9 +854,9 @@ static int fec_recv(struct eth_device *dev)
        invalidate_dcache_range(addr, addr + size);
 
        bd_status = readw(&rbd->status);
-       debug("fec_recv: status 0x%x\n", bd_status);
-
        if (!(bd_status & FEC_RBD_EMPTY)) {
+               debug("fec_recv: status 0x%04x len %u\n", bd_status,
+                       readw(&rbd->data_length) - 4);
                if ((bd_status & FEC_RBD_LAST) && !(bd_status & FEC_RBD_ERR) &&
                        ((readw(&rbd->data_length) - 4) > 14)) {
                        /*
@@ -834,6 +864,7 @@ static int fec_recv(struct eth_device *dev)
                         */
                        frame = (struct nbuf *)readl(&rbd->data_pointer);
                        frame_length = readw(&rbd->data_length) - 4;
+
                        /*
                         * Invalidate data cache over the buffer
                         */
@@ -847,8 +878,9 @@ static int fec_recv(struct eth_device *dev)
 #ifdef CONFIG_FEC_MXC_SWAP_PACKET
                        swap_packet((uint32_t *)frame->data, frame_length);
 #endif
-                       memcpy(buff, frame->data, frame_length);
-                       NetReceive(buff, frame_length);
+                       memcpy((void *)NetRxPackets[rx_idx], frame->data, frame_length);
+                       NetReceive(NetRxPackets[rx_idx], frame_length);
+                       rx_idx = (rx_idx + 1) % PKTBUFSRX;
                        len = frame_length;
                } else {
                        if (bd_status & FEC_RBD_ERR)
@@ -877,8 +909,8 @@ static int fec_recv(struct eth_device *dev)
 
                fec_rx_task_enable(fec);
                fec->rbd_index = (fec->rbd_index + 1) % FEC_RBD_NUM;
+               debug("fec_recv: stop\n");
        }
-       debug("fec_recv: stop\n");
 
        return len;
 }
@@ -893,23 +925,20 @@ static int fec_probe(bd_t *bd, int dev_id, int phy_id, uint32_t base_addr)
        int ret = 0;
 
        /* create and fill edev struct */
-       edev = (struct eth_device *)malloc(sizeof(struct eth_device));
+       edev = calloc(sizeof(struct eth_device), 1);
        if (!edev) {
                puts("fec_mxc: not enough malloc memory for eth_device\n");
                ret = -ENOMEM;
                goto err1;
        }
 
-       fec = (struct fec_priv *)malloc(sizeof(struct fec_priv));
+       fec = calloc(sizeof(struct fec_priv), 1);
        if (!fec) {
                puts("fec_mxc: not enough malloc memory for fec_priv\n");
                ret = -ENOMEM;
                goto err2;
        }
 
-       memset(edev, 0, sizeof(*edev));
-       memset(fec, 0, sizeof(*fec));
-
        edev->priv = fec;
        edev->init = fec_init;
        edev->send = fec_send;
@@ -933,24 +962,7 @@ static int fec_probe(bd_t *bd, int dev_id, int phy_id, uint32_t base_addr)
                udelay(10);
        }
 
-       /*
-        * Set interrupt mask register
-        */
-       writel(0x00000000, &fec->eth->imask);
-
-       /*
-        * Clear FEC-Lite interrupt event register(IEVENT)
-        */
-       writel(0xffffffff, &fec->eth->ievent);
-
-       /*
-        * Set FEC-Lite receive control register(R_CNTRL):
-        */
-       /*
-        * Frame length=1518; MII mode;
-        */
-       writel((PKTSIZE << FEC_RCNTRL_MAX_FL_SHIFT) | FEC_RCNTRL_FCE |
-               FEC_RCNTRL_MII_MODE, &fec->eth->r_cntrl);
+       fec_reg_setup(fec);
        fec_mii_setspeed(fec);
 
        if (dev_id == -1) {
@@ -1011,7 +1023,8 @@ int fecmxc_initialize(bd_t *bd)
 {
        int lout = 1;
 
-       debug("eth_init: fec_probe(bd)\n");
+       debug("eth_init: fec_probe(PHY %02x FEC: %08x)\n",
+               CONFIG_FEC_MXC_PHYADDR, IMX_FEC_BASE);
        lout = fec_probe(bd, -1, CONFIG_FEC_MXC_PHYADDR, IMX_FEC_BASE);
 
        return lout;
index 852b2e07e715a830c6348d4cf49f0757212edf36..c81247336487f971556c661c1bd7da5b845f4fb7 100644 (file)
@@ -32,8 +32,6 @@
 #ifndef __FEC_MXC_H
 #define __FEC_MXC_H
 
-void imx_get_mac_from_fuse(int dev_id, unsigned char *mac);
-
 /**
  * Layout description of the FEC
  */
index 7d327f766a2cf23bbfd622de4f0b7e4bae8c4226..32e1500eaa253e71d702ccbdb66375c378be56d5 100644 (file)
@@ -612,10 +612,9 @@ struct phy_device *get_phy_device(struct mii_dev *bus, int addr,
 
                /* If the phy_id is mostly Fs, there is no device there */
                if ((phy_id & 0x1fffffff) != 0x1fffffff)
-                       break;
+                       return phy_device_create(bus, addr, phy_id, interface);
        }
-
-       return phy_device_create(bus, addr, phy_id, interface);
+       return NULL;
 }
 
 int phy_reset(struct phy_device *phydev)
index a290073bb8b42814c8129aba4f25647c3ea93b7f..ff7e4f1ff5697dd10ae3f83fd26bacb77f7ffe01 100644 (file)
@@ -30,7 +30,8 @@
 #define DRIVERNAME "smc911x"
 
 #if defined (CONFIG_SMC911X_32_BIT) && \
-       defined (CONFIG_SMC911X_16_BIT)
+       defined (CONFIG_SMC911X_16_BIT) && \
+       defined(CONFIG_SMC911X_CPLD)
 #error "SMC911X: Only one of CONFIG_SMC911X_32_BIT and \
        CONFIG_SMC911X_16_BIT shall be set"
 #endif
@@ -62,6 +63,19 @@ static inline void smc911x_reg_write(struct eth_device *dev,
        *(volatile u16 *)(dev->iobase + offset) = (u16)val;
        *(volatile u16 *)(dev->iobase + offset + 2) = (u16)(val >> 16);
 }
+#elif defined(CONFIG_SMC911X_CPLD)
+#include <asm/arch/imx_spi_cpld.h>
+static inline u32 smc911x_reg_read(struct eth_device *dev, u32 offset)
+{
+       return cpld_reg_xfer(offset, 0x0, 1) | \
+               (cpld_reg_xfer(offset + 0x2, 0x0, 1) << 16);
+}
+static void smc911x_reg_write(struct eth_device *dev,
+                       u32 offset, u32 val)
+{
+       cpld_reg_xfer(offset, val, 0);
+       cpld_reg_xfer(offset + 0x2, (val >> 16), 0);
+}
 #else
 #error "SMC911X: undefined bus width"
 #endif /* CONFIG_SMC911X_16_BIT */
index ead00f8dae6a3b0ac9fdbf2efc938faf1d0ac2b0..6bf388cb7d59036fd2922eb51dd89d09328af05d 100644 (file)
@@ -26,8 +26,10 @@ include $(TOPDIR)/config.mk
 LIB    := $(obj)libpower.o
 
 COBJS-$(CONFIG_FTPMU010_POWER) += ftpmu010.o
+COBJS-$(CONFIG_TPS6586X_POWER) += tps6586x.o
 COBJS-$(CONFIG_TWL4030_POWER)  += twl4030.o
 COBJS-$(CONFIG_TWL6030_POWER)  += twl6030.o
+COBJS-$(CONFIG_TWL6035_POWER)  += twl6035.o
 
 COBJS  := $(COBJS-y)
 SRCS   := $(COBJS:.o=.c)
diff --git a/drivers/power/tps6586x.c b/drivers/power/tps6586x.c
new file mode 100644 (file)
index 0000000..f3f2ec6
--- /dev/null
@@ -0,0 +1,280 @@
+/*
+ * Copyright (c) 2011 The Chromium OS Authors.
+ * (C) Copyright 2010,2011 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 <tps6586x.h>
+#include <asm/io.h>
+#include <i2c.h>
+
+static int bus_num;            /* I2C bus we are on */
+#define I2C_ADDRESS            0x34    /* chip requires this address */
+static char inited;            /* 1 if we have been inited */
+
+enum {
+       /* Registers that we access */
+       SUPPLY_CONTROL1         = 0x20,
+       SUPPLY_CONTROL2,
+       SM1_VOLTAGE_V1          = 0x23,
+       SM1_VOLTAGE_V2,
+       SM0_VOLTAGE_V1          = 0x26,
+       SM0_VOLTAGE_V2,
+       PFM_MODE                = 0x47,
+
+       /* Bits in the supply control registers */
+       CTRL_SM1_RAMP           = 0x01,
+       CTRL_SM1_SUPPLY2        = 0x02,
+       CTRL_SM0_RAMP           = 0x04,
+       CTRL_SM0_SUPPLY2        = 0x08,
+};
+
+#define MAX_I2C_RETRY  3
+int tps6586x_read(int reg)
+{
+       int     i;
+       uchar   data;
+       int     retval = -1;
+       int     old_bus_num;
+
+       old_bus_num = i2c_get_bus_num();
+       i2c_set_bus_num(bus_num);
+
+       for (i = 0; i < MAX_I2C_RETRY; ++i) {
+               if (!i2c_read(I2C_ADDRESS, reg, 1, &data, 1)) {
+                       retval = (int)data;
+                       goto exit;
+               }
+
+               /* i2c access failed, retry */
+               udelay(100);
+       }
+
+exit:
+       i2c_set_bus_num(old_bus_num);
+       debug("pmu_read %x=%x\n", reg, retval);
+       if (retval < 0)
+               debug("%s: failed to read register %#x: %d\n", __func__, reg,
+                     retval);
+       return retval;
+}
+
+int tps6586x_write(int reg, uchar *data, uint len)
+{
+       int     i;
+       int     retval = -1;
+       int     old_bus_num;
+
+       old_bus_num = i2c_get_bus_num();
+       i2c_set_bus_num(bus_num);
+
+       for (i = 0; i < MAX_I2C_RETRY; ++i) {
+               if (!i2c_write(I2C_ADDRESS, reg, 1, data, len)) {
+                       retval = 0;
+                       goto exit;
+               }
+
+               /* i2c access failed, retry */
+               udelay(100);
+       }
+
+exit:
+       i2c_set_bus_num(old_bus_num);
+       debug("pmu_write %x=%x: ", reg, retval);
+       for (i = 0; i < len; i++)
+               debug("%x ", data[i]);
+       if (retval)
+               debug("%s: failed to write register %#x\n", __func__, reg);
+       return retval;
+}
+
+/*
+ * Get current voltage of SM0 and SM1
+ *
+ * @param sm0  Place to put SM0 voltage
+ * @param sm1  Place to put SM1 voltage
+ * @return 0 if ok, -1 on error
+ */
+static int read_voltages(int *sm0, int *sm1)
+{
+       int ctrl1, ctrl2;
+       int is_v2;
+
+       /*
+        * Each vdd has two supply sources, ie, v1 and v2.
+        * The supply control reg1 and reg2 determine the current selection.
+        */
+       ctrl1 = tps6586x_read(SUPPLY_CONTROL1);
+       ctrl2 = tps6586x_read(SUPPLY_CONTROL2);
+       if (ctrl1 == -1 || ctrl2 == -1)
+               return -1;
+
+       /* Figure out whether V1 or V2 is selected */
+       is_v2 = (ctrl1 | ctrl2) & CTRL_SM0_SUPPLY2;
+       *sm0 = tps6586x_read(is_v2 ? SM0_VOLTAGE_V2 : SM0_VOLTAGE_V1);
+       *sm1 = tps6586x_read(is_v2 ? SM1_VOLTAGE_V2 : SM1_VOLTAGE_V1);
+       if (*sm0 == -1 || *sm1 == -1)
+               return -1;
+
+       return 0;
+}
+
+static int set_voltage(int reg, int data, int rate)
+{
+       uchar control_bit;
+       uchar buff[3];
+
+       control_bit = (reg == SM0_VOLTAGE_V1 ? CTRL_SM0_RAMP : CTRL_SM1_RAMP);
+
+       /*
+        * Only one supply is needed in u-boot. set both v1 and v2 to
+        * same value.
+        *
+        * When both v1 and v2 are set to same value, we just need to set
+        * control1 reg to trigger the supply selection.
+        */
+       buff[0] = buff[1] = (uchar)data;
+       buff[2] = rate;
+
+       /* write v1, v2 and rate, then trigger */
+       if (tps6586x_write(reg, buff, 3) ||
+           tps6586x_write(SUPPLY_CONTROL1, &control_bit, 1))
+               return -1;
+
+       return 0;
+}
+
+static int calculate_next_voltage(int voltage, int target, int step)
+{
+       int diff = voltage < target ? step : -step;
+
+       if (abs(target - voltage) > step)
+               voltage += diff;
+       else
+               voltage = target;
+
+       return voltage;
+}
+
+int tps6586x_set_pwm_mode(int mask)
+{
+       uchar val;
+       int ret;
+
+       assert(inited);
+       ret = tps6586x_read(PFM_MODE);
+       if (ret != -1) {
+               val = (uchar)ret;
+               val |= mask;
+
+               ret = tps6586x_write(PFM_MODE, &val, 1);
+       }
+
+       if (ret == -1)
+               debug("%s: Failed to read/write PWM mode reg\n", __func__);
+
+       return ret;
+}
+
+int tps6586x_adjust_sm0_sm1(int sm0_target, int sm1_target, int step, int rate,
+                           int min_sm0_over_sm1)
+{
+       int sm0, sm1;
+       int bad;
+
+       assert(inited);
+
+       /* get current voltage settings */
+       if (read_voltages(&sm0, &sm1)) {
+               debug("%s: Cannot read voltage settings\n", __func__);
+               return -1;
+       }
+
+       /*
+        * if vdd_core < vdd_cpu + rel
+        *    skip
+        *
+        * This condition may happen when system reboots due to kernel crash.
+        */
+       if (min_sm0_over_sm1 != -1 && sm0 < sm1 + min_sm0_over_sm1) {
+               debug("%s: SM0 is %d, SM1 is %d, but min_sm0_over_sm1 is %d\n",
+                     __func__, sm0, sm1, min_sm0_over_sm1);
+               return -1;
+       }
+
+       /*
+        * Since vdd_core and vdd_cpu may both stand at either greater or less
+        * than their nominal voltage, the adjustment may go either directions.
+        *
+        * Make sure vdd_core is always higher than vdd_cpu with certain margin.
+        * So, find out which vdd to adjust first in each step.
+        *
+        * case 1: both sm0 and sm1 need to move up
+        *              adjust sm0 before sm1
+        *
+        * case 2: both sm0 and sm1 need to move down
+        *              adjust sm1 before sm0
+        *
+        * case 3: sm0 moves down and sm1 moves up
+        *              adjusting either one first is fine.
+        *
+        * Adjust vdd_core and vdd_cpu one step at a time until they reach
+        * their nominal values.
+        */
+       bad = 0;
+       while (!bad && (sm0 != sm0_target || sm1 != sm1_target)) {
+               int adjust_sm0_late = 0; /* flag to adjust vdd_core later */
+
+               debug("%d-%d   %d-%d   ", sm0, sm0_target, sm1, sm1_target);
+
+               if (sm0 != sm0_target) {
+                       /*
+                        * if case 1 and case 3, set new sm0 first.
+                        * otherwise, hold down until new sm1 is set.
+                        */
+                       sm0 = calculate_next_voltage(sm0, sm0_target, step);
+                       if (sm1 < sm1_target)
+                               bad |= set_voltage(SM0_VOLTAGE_V1, sm0, rate);
+                       else
+                               adjust_sm0_late = 1;
+               }
+
+               if (sm1 != sm1_target) {
+                       sm1 = calculate_next_voltage(sm1, sm1_target, step);
+                       bad |= set_voltage(SM1_VOLTAGE_V1, sm1, rate);
+               }
+
+               if (adjust_sm0_late)
+                       bad |= set_voltage(SM0_VOLTAGE_V1, sm0, rate);
+               debug("%d\n", adjust_sm0_late);
+       }
+       debug("%d-%d   %d-%d   done\n", sm0, sm0_target, sm1, sm1_target);
+
+       return bad ? -1 : 0;
+}
+
+int tps6586x_init(int bus)
+{
+       bus_num = bus;
+       inited = 1;
+
+       return 0;
+}
diff --git a/drivers/power/twl6035.c b/drivers/power/twl6035.c
new file mode 100644 (file)
index 0000000..624c09e
--- /dev/null
@@ -0,0 +1,65 @@
+/*
+ * (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
+ */
+#include <config.h>
+#include <twl6035.h>
+
+/* Functions to read and write from TWL6030 */
+int twl6035_i2c_write_u8(u8 chip_no, u8 val, u8 reg)
+{
+       return i2c_write(chip_no, reg, 1, &val, 1);
+}
+
+int twl6035_i2c_read_u8(u8 chip_no, u8 *val, u8 reg)
+{
+       return i2c_read(chip_no, reg, 1, val, 1);
+}
+
+/* To align with i2c mw/mr address, reg, val command syntax */
+static inline int palmas_write_u8(u8 chip_no, u8 reg, u8 val)
+{
+       return i2c_write(chip_no, reg, 1, &val, 1);
+}
+
+static inline int palmas_read_u8(u8 chip_no, u8 reg, u8 *val)
+{
+       return i2c_read(chip_no, reg, 1, val, 1);
+}
+
+void twl6035_init_settings(void)
+{
+       return;
+}
+
+void 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);
+
+       /* TURN ON LDO9 */
+       val = LDO_ON | LDO_MODE_SLEEP | LDO_MODE_ACTIVE;
+       palmas_write_u8(0x48, LDO9_CTRL, val);
+       return;
+}
index 0d6ad6283ace04ff723afafc1bb1908cc9d4d310..562f2e8f3b712e4d012bcee938a830e754a28909 100644 (file)
@@ -55,12 +55,16 @@ DECLARE_GLOBAL_DATA_PTR;
 #error "Console port 3 defined but not configured."
 #elif CONFIG_CONS_INDEX == 4 && !defined(CONFIG_SYS_NS16550_COM4)
 #error "Console port 4 defined but not configured."
+#elif CONFIG_CONS_INDEX == 5 && !defined(CONFIG_SYS_NS16550_COM5)
+#error "Console port 5 defined but not configured."
+#elif CONFIG_CONS_INDEX == 6 && !defined(CONFIG_SYS_NS16550_COM6)
+#error "Console port 6 defined but not configured."
 #endif
 
 /* Note: The port number specified in the functions is 1 based.
  *      the array is 0 based.
  */
-static NS16550_t serial_ports[4] = {
+static NS16550_t serial_ports[] = {
 #ifdef CONFIG_SYS_NS16550_COM1
        (NS16550_t)CONFIG_SYS_NS16550_COM1,
 #else
@@ -77,9 +81,19 @@ static NS16550_t serial_ports[4] = {
        NULL,
 #endif
 #ifdef CONFIG_SYS_NS16550_COM4
-       (NS16550_t)CONFIG_SYS_NS16550_COM4
+       (NS16550_t)CONFIG_SYS_NS16550_COM4,
 #else
-       NULL
+       NULL,
+#endif
+#ifdef CONFIG_SYS_NS16550_COM5
+       (NS16550_t)CONFIG_SYS_NS16550_COM5,
+#else
+       NULL,
+#endif
+#ifdef CONFIG_SYS_NS16550_COM6
+       (NS16550_t)CONFIG_SYS_NS16550_COM6,
+#else
+       NULL,
 #endif
 };
 
@@ -178,6 +192,14 @@ int serial_init (void)
        clock_divisor = calc_divisor(serial_ports[3]);
        NS16550_init(serial_ports[3], clock_divisor);
 #endif
+#ifdef CONFIG_SYS_NS16550_COM5
+       clock_divisor = calc_divisor(serial_ports[4]);
+       NS16550_init(serial_ports[4], clock_divisor);
+#endif
+#ifdef CONFIG_SYS_NS16550_COM6
+       clock_divisor = calc_divisor(serial_ports[5]);
+       NS16550_init(serial_ports[5], clock_divisor);
+#endif
 
        return (0);
 }
diff --git a/drivers/serial/stmp3xxx_dbguart.c b/drivers/serial/stmp3xxx_dbguart.c
new file mode 100644 (file)
index 0000000..1d24da8
--- /dev/null
@@ -0,0 +1,114 @@
+/*
+ * (c) 2007 Sascha Hauer <s.hauer@pengutronix.de>
+ *
+ * (C) Copyright 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 <common.h>
+
+#ifdef CONFIG_STMP3XXX_DBGUART
+
+#include "stmp3xxx_dbguart.h"
+
+DECLARE_GLOBAL_DATA_PTR;
+
+/*
+ * Set baud rate. The settings are always 8n1:
+ * 8 data bits, no parity, 1 stop bit
+ */
+void serial_setbrg(void)
+{
+       u32 cr, lcr_h;
+       u32 quot;
+
+       /* Disable everything */
+       cr = REG_RD(DBGUART_BASE + UARTDBGCR);
+       REG_WR(DBGUART_BASE + UARTDBGCR, 0);
+
+       /* Calculate and set baudrate */
+       quot = (CONFIG_DBGUART_CLK * 4) / gd->baudrate;
+       REG_WR(DBGUART_BASE + UARTDBGFBRD, quot & 0x3f);
+       REG_WR(DBGUART_BASE + UARTDBGIBRD, quot >> 6);
+
+       /* Set 8n1 mode, enable FIFOs */
+       lcr_h = WLEN8 | FEN;
+       REG_WR(DBGUART_BASE + UARTDBGLCR_H, lcr_h);
+
+       /* Enable Debug UART */
+       REG_WR(DBGUART_BASE + UARTDBGCR, cr);
+}
+
+int serial_init(void)
+{
+       u32 cr;
+
+       /* Disable UART */
+       REG_WR(DBGUART_BASE + UARTDBGCR, 0);
+
+       /* Mask interrupts */
+       REG_WR(DBGUART_BASE + UARTDBGIMSC, 0);
+
+       /* Set default baudrate */
+       serial_setbrg();
+
+       /* Enable UART */
+       cr = TXE | RXE | UARTEN;
+       REG_WR(DBGUART_BASE + UARTDBGCR, cr);
+
+       return 0;
+}
+
+/* Send a character */
+void serial_putc(const char c)
+{
+       /* Wait for room in TX FIFO */
+       while (REG_RD(DBGUART_BASE + UARTDBGFR) & TXFF)
+               ;
+
+       /* Write the data byte */
+       REG_WR(DBGUART_BASE + UARTDBGDR, c);
+
+       if (c == '\n')
+               serial_putc('\r');
+}
+
+void serial_puts(const char *s)
+{
+       while (*s) {
+               serial_putc(*s++);
+       }
+}
+
+/* Test whether a character is in TX buffer */
+int serial_tstc(void)
+{
+       /* Check if RX FIFO is not empty */
+       return !(REG_RD(DBGUART_BASE + UARTDBGFR) & RXFE);
+}
+
+/* Receive character */
+int serial_getc(void)
+{
+       /* Wait while TX FIFO is empty */
+       while (REG_RD(DBGUART_BASE + UARTDBGFR) & RXFE)
+               ;
+
+       /* Read data byte */
+       return REG_RD(DBGUART_BASE + UARTDBGDR) & 0xff;
+}
+
+#endif /* CONFIG_STMP378X_DBGUART */
diff --git a/drivers/serial/stmp3xxx_dbguart.h b/drivers/serial/stmp3xxx_dbguart.h
new file mode 100644 (file)
index 0000000..5ad4a85
--- /dev/null
@@ -0,0 +1,61 @@
+/*
+ * Debug UART register definitions
+ * (C) Copyright 2009 Freescale Semiconductor, Inc.
+ */
+
+#ifndef STMP3XXX_DBGUART_H
+#define STMP3XXX_DBGUART_H
+
+#include <asm/arch/dbguart.h>
+
+#define UARTDBGDR      0x00
+#define UARTDBGRSR_ECR 0x04
+#define UARTDBGFR      0x18
+#define UARTDBGILPR    0x20
+#define UARTDBGIBRD    0x24
+#define UARTDBGFBRD    0x28
+#define UARTDBGLCR_H   0x2c
+#define UARTDBGCR      0x30
+#define UARTDBGIFLS    0x34
+#define UARTDBGIMSC    0x38
+#define UARTDBGRIS     0x3c
+#define UARTDBGMIS     0x40
+#define UARTDBGICR     0x44
+#define UARTDBGDMACR   0x48
+
+/* UARTDBGFR - Flag Register bits */
+#define CTS    0x0001
+#define DSR    0x0002
+#define DCD    0x0004
+#define BUSY   0x0008
+#define RXFE   0x0010
+#define TXFF   0x0020
+#define RXFF   0x0040
+#define TXFE   0x0080
+#define RI     0x0100
+
+/* UARTDBGLCR_H - Line Control Register bits */
+#define BRK    0x0001
+#define PEN    0x0002
+#define EPS    0x0004
+#define STP2   0x0008
+#define FEN    0x0010
+#define WLEN5  0x0000
+#define WLEN6  0x0020
+#define WLEN7  0x0040
+#define WLEN8  0x0060
+#define SPS    0x0080
+
+/* UARTDBGCR - Control Register bits */
+#define UARTEN 0x0001
+#define LBE    0x0080
+#define TXE    0x0100
+#define RXE    0x0200
+#define DTR    0x0400
+#define RTS    0x0800
+#define OUT1   0x1000
+#define OUT2   0x2000
+#define RTSEN  0x4000
+#define CTSEN  0x8000
+
+#endif /* STMP3XXX_DBGUART_H */
diff --git a/drivers/spi/imx_cspi.c b/drivers/spi/imx_cspi.c
new file mode 100644 (file)
index 0000000..438ab8d
--- /dev/null
@@ -0,0 +1,255 @@
+/*
+ * (C) Copyright 2008-2010 Freescale Semiconductor, Inc.
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+#include <config.h>
+#include <common.h>
+#include <spi.h>
+#include <asm/errno.h>
+#include <linux/types.h>
+#include <asm/io.h>
+#include <malloc.h>
+
+#include <imx_spi.h>
+
+extern s32 spi_get_cfg(struct imx_spi_dev_t *dev);
+
+static inline struct imx_spi_dev_t *to_imx_spi_slave(struct spi_slave *slave)
+{
+       return container_of(slave, struct imx_spi_dev_t, slave);
+}
+
+static s32 spi_reset(struct spi_slave *slave)
+{
+       u32 clk_src = mxc_get_clock(MXC_CSPI_CLK);
+       s32 div = 0, i, reg_ctrl;
+       struct imx_spi_dev_t *dev = to_imx_spi_slave(slave);
+       struct spi_reg_t *reg = &(dev->reg);
+       int lim = 0;
+       unsigned int baud_rate_div[] = { 4, 8, 16, 32, 64, 128, 256, 512 };
+
+       if (dev->freq == 0) {
+               printf("Error: desired clock is 0\n");
+               return 1;
+       }
+
+       reg_ctrl = readl(dev->base + SPI_CON_REG);
+       /* Reset spi */
+       writel(0, dev->base + SPI_CON_REG);
+       writel((reg_ctrl | SPI_CTRL_EN), dev->base + SPI_CON_REG);
+
+       lim = sizeof(baud_rate_div) / sizeof(unsigned int);
+       if (clk_src > dev->freq) {
+               div = clk_src / dev->freq;
+
+               for (i = 0; i < lim; i++) {
+                       if (div <= baud_rate_div[i])
+                               break;
+               }
+       }
+       debug("div = %d\n", baud_rate_div[i]);
+
+       reg_ctrl =
+           (reg_ctrl & ~SPI_CTRL_SS_MASK) | (dev->ss << SPI_CTRL_SS_OFF);
+       reg_ctrl = (reg_ctrl & ~SPI_CTRL_DATA_MASK) | (i << SPI_CTRL_DATA_OFF);
+       reg_ctrl |= SPI_CTRL_MODE;      /* always set to master mode !!!! */
+       reg_ctrl &= ~SPI_CTRL_EN;       /* disable spi */
+
+       /* configuration register setup */
+       reg_ctrl =
+           (reg_ctrl & ~SPI_CTRL_SSPOL) | (dev->ss_pol << SPI_CTRL_SSPOL_OFF);
+       reg_ctrl =
+           (reg_ctrl & ~SPI_CTRL_SSCTL) | (dev->ssctl << SPI_CTRL_SSCTL_OFF);
+       reg_ctrl =
+           (reg_ctrl & ~SPI_CTRL_SCLK_POL) | (dev->
+                                              sclkpol <<
+                                              SPI_CTRL_SCLK_POL_OFF);
+       reg_ctrl =
+           (reg_ctrl & ~SPI_CTRL_SCLK_PHA) | (dev->
+                                              sclkpha <<
+                                              SPI_CTRL_SCLK_PHA_OFF);
+
+       debug("reg_ctrl = 0x%x\n", reg_ctrl);
+       writel(reg_ctrl, dev->base + SPI_CON_REG);
+       /* save control register */
+       reg->ctrl_reg = reg_ctrl;
+
+       /* clear interrupt reg */
+       writel(0, dev->base + SPI_INT_REG);
+       writel(SPI_INT_STAT_TC, dev->base + SPI_STAT_REG);
+
+       return 0;
+}
+
+void spi_init(void)
+{
+}
+
+struct spi_slave *spi_setup_slave(unsigned int bus, unsigned int cs,
+                                 unsigned int max_hz, unsigned int mode)
+{
+       struct imx_spi_dev_t *imx_spi_slave = NULL;
+
+       if (!spi_cs_is_valid(bus, cs))
+               return NULL;
+
+       imx_spi_slave =
+           (struct imx_spi_dev_t *)malloc(sizeof(struct imx_spi_dev_t));
+       if (!imx_spi_slave)
+               return NULL;
+
+       imx_spi_slave->slave.bus = bus;
+       imx_spi_slave->slave.cs = cs;
+
+       spi_get_cfg(imx_spi_slave);
+
+       spi_io_init(imx_spi_slave);
+
+       spi_reset(&(imx_spi_slave->slave));
+
+       return &(imx_spi_slave->slave);
+}
+
+void spi_free_slave(struct spi_slave *slave)
+{
+       struct imx_spi_dev_t *imx_spi_slave;
+
+       if (slave) {
+               imx_spi_slave = to_imx_spi_slave(slave);
+               free(imx_spi_slave);
+       }
+}
+
+int spi_claim_bus(struct spi_slave *slave)
+{
+       return 0;
+}
+
+void spi_release_bus(struct spi_slave *slave)
+{
+
+}
+
+/*
+ * SPI transfer:
+ *
+ * See include/spi.h and http://www.altera.com/literature/ds/ds_nios_spi.pdf
+ * for more informations.
+ */
+int spi_xfer(struct spi_slave *slave, unsigned int bitlen, const void *dout,
+            void *din, unsigned long flags)
+{
+       s32 val = SPI_RETRY_TIMES;
+       u32 *p_buf;
+       u32 reg;
+       s32 len = 0, ret_val = 0;
+       s32 burst_bytes = bitlen >> 3;
+       struct imx_spi_dev_t *dev = to_imx_spi_slave(slave);
+       struct spi_reg_t *spi_reg = &(dev->reg);
+
+       if (!slave)
+               return -1;
+
+       if ((bitlen % 8) != 0)
+               burst_bytes++;
+
+       if (burst_bytes > (dev->fifo_sz)) {
+               printf("Error: maximum burst size is 0x%x bytes, asking 0x%x\n",
+                      dev->fifo_sz, burst_bytes);
+               return -1;
+       }
+
+       if (flags & SPI_XFER_BEGIN) {
+               spi_cs_activate(slave);
+
+               if (spi_reg->ctrl_reg == 0) {
+                       printf
+                           ("Error: spi(base=0x%x) has not been initialized\n",
+                            dev->base);
+                       return -1;
+               }
+
+               spi_reg->ctrl_reg = (spi_reg->ctrl_reg & ~SPI_CTRL_BURST_MASK) |
+                   ((bitlen - 1) << SPI_CTRL_BURST_OFF);
+               writel(spi_reg->ctrl_reg | SPI_CTRL_EN,
+                      dev->base + SPI_CON_REG);
+               debug("ctrl_reg=0x%x\n", readl(dev->base + SPI_CON_REG));
+
+               /* move data to the tx fifo */
+               if (dout) {
+                       for (p_buf = (u32 *) dout, len = burst_bytes; len > 0;
+                            p_buf++, len -= 4)
+                               writel(*p_buf, dev->base + SPI_TX_DATA);
+               }
+
+               reg = readl(dev->base + SPI_CON_REG);
+               reg |= SPI_CTRL_REG_XCH_BIT;    /* set xch bit */
+               debug("control reg = 0x%08x\n", reg);
+               writel(reg, dev->base + SPI_CON_REG);
+
+               /* poll on the TC bit (transfer complete) */
+               while ((val-- > 0) &&
+                      (((reg =
+                         readl(dev->base + SPI_STAT_REG)) & SPI_INT_STAT_TC) ==
+                       0));
+
+               /* clear the TC bit */
+               writel(reg | SPI_INT_STAT_TC, dev->base + SPI_STAT_REG);
+               if (val <= 0) {
+                       printf
+                           ("Error: re-tried %d times without response. Give up\n",
+                            SPI_RETRY_TIMES);
+                       ret_val = -1;
+                       goto error;
+               }
+       }
+
+       /* move data in the rx buf */
+       if (flags & SPI_XFER_END) {
+               if (din) {
+                       for (p_buf = (u32 *) din, len = burst_bytes; len > 0;
+                            p_buf++, len -= 4)
+                               *p_buf = readl(dev->base + SPI_RX_DATA);
+               }
+       }
+error:
+       spi_cs_deactivate(slave);
+       return ret_val;
+}
+
+int spi_cs_is_valid(unsigned int bus, unsigned int cs)
+{
+       return 1;
+}
+
+void spi_cs_activate(struct spi_slave *slave)
+{
+       struct imx_spi_dev_t *dev = to_imx_spi_slave(slave);
+
+       spi_io_init(dev);
+}
+
+void spi_cs_deactivate(struct spi_slave *slave)
+{
+       struct imx_spi_dev_t *dev = to_imx_spi_slave(slave);
+
+       writel(0, dev->base + SPI_CON_REG);
+}
diff --git a/drivers/spi/imx_ecspi.c b/drivers/spi/imx_ecspi.c
new file mode 100644 (file)
index 0000000..1e86cf1
--- /dev/null
@@ -0,0 +1,302 @@
+/*
+ * (C) Copyright 2008-2010 Freescale Semiconductor, Inc.
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+#include <config.h>
+#include <common.h>
+#include <spi.h>
+#include <asm/errno.h>
+#include <linux/types.h>
+#include <asm/io.h>
+#include <malloc.h>
+
+#include <imx_spi.h>
+
+#ifdef DEBUG
+
+/* -----------------------------------------------
+ * Helper functions to peek into tx and rx buffers
+ * ----------------------------------------------- */
+static const char * const hex_digit = "0123456789ABCDEF";
+
+static char quickhex(int i)
+{
+       return hex_digit[i];
+}
+
+static void memdump(const void *pv, int num)
+{
+
+}
+
+#else /* !DEBUG */
+
+#define        memdump(p, n)
+
+#endif /* DEBUG */
+
+extern s32 spi_get_cfg(struct imx_spi_dev_t *dev);
+
+static inline struct imx_spi_dev_t *to_imx_spi_slave(struct spi_slave *slave)
+{
+       return container_of(slave, struct imx_spi_dev_t, slave);
+}
+
+static s32 spi_reset(struct spi_slave *slave)
+{
+       u32 clk_src = mxc_get_clock(MXC_CSPI_CLK);
+       s32 pre_div = 0, post_div = 0, i, reg_ctrl, reg_config;
+       struct imx_spi_dev_t *dev = to_imx_spi_slave(slave);
+       struct spi_reg_t *reg = &(dev->reg);
+
+       if (dev->freq == 0) {
+               printf("Error: desired clock is 0\n");
+               return 1;
+       }
+
+       reg_ctrl = readl(dev->base + SPI_CON_REG);
+       /* Reset spi */
+       writel(0, dev->base + SPI_CON_REG);
+       writel((reg_ctrl | 0x1), dev->base + SPI_CON_REG);
+
+       /* Control register setup */
+       if (clk_src > dev->freq) {
+               pre_div = clk_src / dev->freq;
+               if (pre_div > 16) {
+                       post_div = pre_div / 16;
+                       pre_div = 15;
+               }
+               if (post_div != 0) {
+                       for (i = 0; i < 16; i++) {
+                               if ((1 << i) >= post_div)
+                                       break;
+                       }
+                       if (i == 16) {
+                               printf("Error: no divider can meet the freq: %d\n",
+                                       dev->freq);
+                               return -1;
+                       }
+                       post_div = i;
+               }
+       }
+
+       debug("pre_div = %d, post_div=%d\n", pre_div, post_div);
+       reg_ctrl = (reg_ctrl & ~(3 << 18)) | dev->ss << 18;
+       reg_ctrl = (reg_ctrl & ~(0xF << 12)) | pre_div << 12;
+       reg_ctrl = (reg_ctrl & ~(0xF << 8)) | post_div << 8;
+       reg_ctrl |= 1 << (dev->ss + 4); /* always set to master mode !!!! */
+       reg_ctrl &= ~0x1;               /* disable spi */
+
+       reg_config = readl(dev->base + SPI_CFG_REG);
+       /* configuration register setup */
+       reg_config = (reg_config & ~(1 << ((dev->ss + 12)))) |
+               (dev->ss_pol << (dev->ss + 12));
+       reg_config = (reg_config & ~(1 << ((dev->ss + 20)))) |
+               (dev->in_sctl << (dev->ss + 20));
+       reg_config = (reg_config & ~(1 << ((dev->ss + 16)))) |
+               (dev->in_dctl << (dev->ss + 16));
+       reg_config = (reg_config & ~(1 << ((dev->ss + 8)))) |
+               (dev->ssctl << (dev->ss + 8));
+       reg_config = (reg_config & ~(1 << ((dev->ss + 4)))) |
+               (dev->sclkpol << (dev->ss + 4));
+       reg_config = (reg_config & ~(1 << ((dev->ss + 0)))) |
+               (dev->sclkpha << (dev->ss + 0));
+
+       debug("reg_ctrl = 0x%x\n", reg_ctrl);
+       writel(reg_ctrl, dev->base + SPI_CON_REG);
+       debug("reg_config = 0x%x\n", reg_config);
+       writel(reg_config, dev->base + SPI_CFG_REG);
+
+       /* save config register and control register */
+       reg->cfg_reg  = reg_config;
+       reg->ctrl_reg = reg_ctrl;
+
+       /* clear interrupt reg */
+       writel(0, dev->base + SPI_INT_REG);
+       writel(3 << 6, dev->base + SPI_STAT_REG);
+
+       return 0;
+}
+
+void spi_init(void)
+{
+}
+
+struct spi_slave *spi_setup_slave(unsigned int bus, unsigned int cs,
+               unsigned int max_hz, unsigned int mode)
+{
+       struct imx_spi_dev_t *imx_spi_slave = NULL;
+
+       if (!spi_cs_is_valid(bus, cs))
+               return NULL;
+
+       imx_spi_slave = (struct imx_spi_dev_t *)malloc(sizeof(struct imx_spi_dev_t));
+       if (!imx_spi_slave)
+               return NULL;
+
+       imx_spi_slave->slave.bus = bus;
+       imx_spi_slave->slave.cs = cs;
+
+       spi_get_cfg(imx_spi_slave);
+
+       spi_io_init(imx_spi_slave);
+
+       spi_reset(&(imx_spi_slave->slave));
+
+       return &(imx_spi_slave->slave);
+}
+
+void spi_free_slave(struct spi_slave *slave)
+{
+       struct imx_spi_dev_t *imx_spi_slave;
+
+       if (slave) {
+               imx_spi_slave = to_imx_spi_slave(slave);
+               free(imx_spi_slave);
+       }
+}
+
+int spi_claim_bus(struct spi_slave *slave)
+{
+       return 0;
+}
+
+void spi_release_bus(struct spi_slave *slave)
+{
+
+}
+
+/*
+ * SPI transfer:
+ *
+ * See include/spi.h and http://www.altera.com/literature/ds/ds_nios_spi.pdf
+ * for more informations.
+ */
+int spi_xfer(struct spi_slave *slave, unsigned int bitlen, const void *dout,
+               void *din, unsigned long flags)
+{
+       s32 val = SPI_RETRY_TIMES;
+       u32 *p_buf;
+       u32 reg;
+       s32 len = 0,
+               ret_val = 0;
+       s32 burst_bytes = bitlen >> 3;
+       s32 tmp = 0;
+       struct imx_spi_dev_t *dev = to_imx_spi_slave(slave);
+       struct spi_reg_t *spi_reg = &(dev->reg);
+
+       if (!slave)
+               return -1;
+
+       if (burst_bytes > (MAX_SPI_BYTES)) {
+               printf("Error: maximum burst size is 0x%x bytes, asking 0x%x\n",
+                               MAX_SPI_BYTES, burst_bytes);
+               return -1;
+       }
+
+       if (flags & SPI_XFER_BEGIN) {
+               spi_cs_activate(slave);
+
+               if (spi_reg->ctrl_reg == 0) {
+                       printf("Error: spi(base=0x%x) has not been initialized yet\n",
+                                       dev->base);
+                       return -1;
+               }
+               spi_reg->ctrl_reg = (spi_reg->ctrl_reg & ~0xFFF00000) | \
+                                       ((burst_bytes * 8 - 1) << 20);
+
+               writel(spi_reg->ctrl_reg | 0x1, dev->base + SPI_CON_REG);
+               writel(spi_reg->cfg_reg, dev->base + SPI_CFG_REG);
+               debug("ctrl_reg=0x%x, cfg_reg=0x%x\n",
+                                        readl(dev->base + SPI_CON_REG),
+                                        readl(dev->base + SPI_CFG_REG));
+
+               /* move data to the tx fifo */
+               if (dout) {
+                       for (p_buf = (u32 *)dout, len = burst_bytes; len > 0;
+                               p_buf++, len -= 4)
+                               writel(*p_buf, dev->base + SPI_TX_DATA);
+               } else {
+                       for (len = burst_bytes; len > 0; len -= 4)
+                               writel(tmp, dev->base + SPI_TX_DATA);
+               }
+
+               reg = readl(dev->base + SPI_CON_REG);
+               reg |= (1 << 2); /* set xch bit */
+               debug("control reg = 0x%08x\n", reg);
+               writel(reg, dev->base + SPI_CON_REG);
+
+               /* poll on the TC bit (transfer complete) */
+               while ((val-- > 0) &&
+                       (readl(dev->base + SPI_STAT_REG) & (1 << 7)) == 0) {
+                       udelay(100);
+               }
+
+               /* clear the TC bit */
+               writel(3 << 6, dev->base + SPI_STAT_REG);
+               if (val <= 0) {
+                       printf("Error: re-tried %d times without response. Give up\n",
+                                       SPI_RETRY_TIMES);
+                       ret_val = -1;
+                       goto error;
+               }
+       }
+
+       /* move data in the rx buf */
+       if (flags & SPI_XFER_END) {
+               if (din) {
+                       for (p_buf = (u32 *)din, len = burst_bytes; len > 0;
+                               ++p_buf, len -= 4)
+                               *p_buf = readl(dev->base + SPI_RX_DATA);
+               } else {
+                       for (len = burst_bytes; len > 0; len -= 4)
+                               tmp = readl(dev->base + SPI_RX_DATA);
+               }
+
+               spi_cs_deactivate(slave);
+       }
+
+       return ret_val;
+
+error:
+       spi_cs_deactivate(slave);
+       return ret_val;
+}
+
+int spi_cs_is_valid(unsigned int bus, unsigned int cs)
+{
+       return 1;
+}
+
+void spi_cs_activate(struct spi_slave *slave)
+{
+       struct imx_spi_dev_t *dev = to_imx_spi_slave(slave);
+
+       spi_io_init(dev);
+}
+
+void spi_cs_deactivate(struct spi_slave *slave)
+{
+       struct imx_spi_dev_t *dev = to_imx_spi_slave(slave);
+
+       writel(0, dev->base + SPI_CON_REG);
+}
+
diff --git a/drivers/spi/imx_spi_cpld.c b/drivers/spi/imx_spi_cpld.c
new file mode 100644 (file)
index 0000000..6e1e556
--- /dev/null
@@ -0,0 +1,118 @@
+/*
+ * (C) Copyright 2009 Freescale Semiconductor, Inc.
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+#include <config.h>
+#include <common.h>
+#include <spi.h>
+#include <asm/errno.h>
+#include <linux/types.h>
+
+#include <imx_spi.h>
+#include <asm/arch/imx_spi_cpld.h>
+
+static struct spi_slave *cpld_slave;
+
+void cpld_reg_write(u32 offset, u32 val)
+{
+       cpld_reg_xfer(offset, val, 0);
+       cpld_reg_xfer(offset + 0x2, (val >> 16), 0);
+}
+
+u32 cpld_reg_read(u32 offset)
+{
+       return cpld_reg_xfer(offset, 0x0, 1) | \
+               (cpld_reg_xfer(offset + 0x2, 0x0, 1) << 16);
+}
+
+/*!
+ * To read/write to a CPLD register.
+ *
+ * @param   reg         register number inside the CPLD
+ * @param   val         data to be written to the register; don't care for read
+ * @param   read        0 for write; 1 for read
+ *
+ * @return              the actual data in the CPLD register
+ */
+unsigned int cpld_reg_xfer(unsigned int reg, unsigned int val,
+                          unsigned int read)
+{
+       unsigned int local_val1, local_val2;
+       unsigned int g_tx_buf[2], g_rx_buf[2];
+
+       reg >>= 1;
+
+       local_val1 = (read << 13) | ((reg & 0x0001FFFF) >> 5) | 0x00001000;
+       if (read)
+               local_val2 = (((reg & 0x0000001F) << 27) | 0x0200001f);
+       else
+               local_val2 =
+                   (((reg & 0x0000001F) << 27) | ((val & 0x0000FFFF) << 6) |
+                    0x03C00027);
+
+       *g_tx_buf = local_val1;
+       *(g_tx_buf + 1) = local_val2;
+
+       if (read) {
+               if (spi_xfer(cpld_slave, 46, (u8 *) g_tx_buf, (u8 *) g_rx_buf,
+                            SPI_XFER_BEGIN | SPI_XFER_END)) {
+                       return -1;
+               }
+       } else {
+               if (spi_xfer(cpld_slave, 46, (u8 *) g_tx_buf, (u8 *) g_rx_buf,
+                            SPI_XFER_BEGIN)) {
+                       return -1;
+               }
+       }
+       return ((*(g_rx_buf + 1)) >> 6) & 0xffff;
+}
+
+struct spi_slave *spi_cpld_probe()
+{
+       u32 reg;
+       cpld_slave = spi_setup_slave(0, 0, 25000000, 0);
+
+       udelay(1000);
+
+       /* Reset interrupt status reg */
+       cpld_reg_write(PBC_INT_REST, 0x1F);
+       cpld_reg_write(PBC_INT_REST, 0);
+       cpld_reg_write(PBC_INT_MASK, 0xFFFF);
+       /* Reset the XUART and Ethernet controllers */
+       reg = cpld_reg_read(PBC_SW_RESET);
+       reg |= 0x9;
+       cpld_reg_write(PBC_SW_RESET, reg);
+       reg &= ~0x9;
+       cpld_reg_write(PBC_SW_RESET, reg);
+
+       return cpld_slave;
+}
+
+void mxc_cpld_spi_init(void)
+{
+       spi_cpld_probe();
+}
+
+void spi_cpld_free(struct spi_slave *slave)
+{
+       if (slave)
+               spi_free_slave(slave);
+}
diff --git a/drivers/spi/imx_spi_pmic.c b/drivers/spi/imx_spi_pmic.c
new file mode 100644 (file)
index 0000000..ec32277
--- /dev/null
@@ -0,0 +1,131 @@
+/*
+ * (C) Copyright 2008-2009 Freescale Semiconductor, Inc.
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+#include <config.h>
+#include <common.h>
+#include <spi.h>
+#include <asm/errno.h>
+#include <linux/types.h>
+
+#include <imx_spi.h>
+
+static u32 pmic_tx, pmic_rx;
+
+/*!
+ * To read/write to a PMIC register. For write, it does another read for the
+ * actual register value.
+ *
+ * @param      reg                     register number inside the PMIC
+ * @param      val                     data to be written to the register; don't care for read
+ * @param      write           0 for read; 1 for write
+ *
+ * @return                             the actual data in the PMIC register
+ */
+u32 pmic_reg(struct spi_slave *slave, u32 reg, u32 val, u32 write)
+{
+       if (!slave)
+               return 0;
+
+       if (reg > 63 || write > 1) {
+               printf("<reg num> = %d is invalide. Should be less then 63\n",
+                       reg);
+               return 0;
+       }
+       pmic_tx = (write << 31) | (reg << 25) | (val & 0x00FFFFFF);
+       debug("reg=0x%x, val=0x%08x\n", reg, pmic_tx);
+
+       if (spi_xfer(slave, 4 << 3, (u8 *)&pmic_tx, (u8 *)&pmic_rx,
+                       SPI_XFER_BEGIN | SPI_XFER_END)) {
+               return -1;
+       }
+
+       if (write) {
+               pmic_tx &= ~(1 << 31);
+               if (spi_xfer(slave, 4 << 3, (u8 *)&pmic_tx, (u8 *)&pmic_rx,
+                       SPI_XFER_BEGIN | SPI_XFER_END)) {
+                       return -1;
+               }
+       }
+
+       return pmic_rx;
+}
+
+void show_pmic_info(struct spi_slave *slave)
+{
+       volatile u32 rev_id;
+
+       if (!slave)
+               return;
+
+       rev_id = pmic_reg(slave, 7, 0, 0);
+       debug("PMIC ID: 0x%08x [Rev: ", rev_id);
+       switch (rev_id & 0x1F) {
+       case 0x1:
+               printf("1.0");
+               break;
+       case 0x9:
+               printf("1.1");
+               break;
+       case 0xA:
+               printf("1.2");
+               break;
+       case 0x10:
+               printf("2.0");
+               break;
+       case 0x11:
+               printf("2.1");
+               break;
+       case 0x18:
+               printf("3.0");
+               break;
+       case 0x19:
+               printf("3.1");
+               break;
+       case 0x1A:
+               printf("3.2");
+               break;
+       case 0x2:
+               printf("3.2A");
+               break;
+       case 0x1B:
+               printf("3.3");
+               break;
+       case 0x1D:
+               printf("3.5");
+               break;
+       default:
+               printf("unknown");
+               break;
+       }
+       printf("]\n");
+}
+
+struct spi_slave *spi_pmic_probe(void)
+{
+       return spi_setup_slave(0, CONFIG_IMX_SPI_PMIC_CS, 2500000, 0);
+}
+
+void spi_pmic_free(struct spi_slave *slave)
+{
+       if (slave)
+               spi_free_slave(slave);
+}
index 4e6f14ee0722d102b2db33cdcb67ff1c02a1c272..7859536a6725569da9ad439b8f4d49e3a5672194 100644 (file)
@@ -34,6 +34,8 @@
 
 #define        MXS_SPI_MAX_TIMEOUT     1000000
 #define        MXS_SPI_PORT_OFFSET     0x2000
+#define MXS_SSP_CHIPSELECT_MASK                0x00300000
+#define MXS_SSP_CHIPSELECT_SHIFT       20
 
 struct mxs_spi_slave {
        struct spi_slave        slave;
@@ -51,14 +53,25 @@ void spi_init(void)
 {
 }
 
+int spi_cs_is_valid(unsigned int bus, unsigned int cs)
+{
+       /* MXS SPI: 4 ports and 3 chip selects maximum */
+       if (bus > 3 || cs > 2)
+               return 0;
+       else
+               return 1;
+}
+
 struct spi_slave *spi_setup_slave(unsigned int bus, unsigned int cs,
                                  unsigned int max_hz, unsigned int mode)
 {
        struct mxs_spi_slave *mxs_slave;
        uint32_t addr;
+       struct mx28_ssp_regs *ssp_regs;
+       int reg;
 
-       if (bus > 3) {
-               printf("MXS SPI: Max bus number is 3\n");
+       if (!spi_cs_is_valid(bus, cs)) {
+               printf("mxs_spi: invalid bus %d / chip select %d\n", bus, cs);
                return NULL;
        }
 
@@ -73,7 +86,13 @@ struct spi_slave *spi_setup_slave(unsigned int bus, unsigned int cs,
        mxs_slave->max_khz = max_hz / 1000;
        mxs_slave->mode = mode;
        mxs_slave->regs = (struct mx28_ssp_regs *)addr;
+       ssp_regs = mxs_slave->regs;
+
+       reg = readl(&ssp_regs->hw_ssp_ctrl0);
+       reg &= ~(MXS_SSP_CHIPSELECT_MASK);
+       reg |= cs << MXS_SSP_CHIPSELECT_SHIFT;
 
+       writel(reg, &ssp_regs->hw_ssp_ctrl0);
        return &mxs_slave->slave;
 }
 
index 5dec673c8ef69532f528229680c2848fb067f9bb..42c77fe333dce56609c3b663191c97475b70fbf3 100644 (file)
@@ -73,7 +73,8 @@ static void usbh1_internal_phy_clock_gate(int on)
 
 static void usbh1_power_config(void)
 {
-       struct anatop_regs *anatop = (struct anatop_regs *)ANATOP_BASE_ADDR;
+       struct anatop_regs __iomem *anatop =
+               (struct anatop_regs __iomem *)ANATOP_BASE_ADDR;
        /*
         * Some phy and power's special controls for host1
         * 1. The external charger detector needs to be disabled
@@ -87,7 +88,7 @@ static void usbh1_power_config(void)
                     &anatop->usb2_chrg_detect);
 
        __raw_writel(ANADIG_USB2_PLL_480_CTRL_BYPASS,
-                    &anatop->usb2_pll_480_ctrl);
+                    &anatop->usb2_pll_480_ctrl_clr);
 
        __raw_writel(ANADIG_USB2_PLL_480_CTRL_ENABLE |
                     ANADIG_USB2_PLL_480_CTRL_POWER |
index 61dbccd53cd7a01f8f15a8fcf329428f14137921..45cbd18a00253ee65b4aacf79d520dc883a02b24 100644 (file)
@@ -125,11 +125,7 @@ int ehci_hcd_init(void)
        hcor = (struct ehci_hcor *)((uint32_t) hccr +
                        HC_LENGTH(ehci_readl(&hccr->cr_capbase)));
        setbits_le32(&ehci->usbmode, CM_HOST);
-#ifdef CONFIG_MX31
-       setbits_le32(&ehci->control, USB_EN);
-
        __raw_writel(CONFIG_MXC_USB_PORTSC, &ehci->portsc);
-#endif
        mxc_set_usbcontrol(CONFIG_MXC_USB_PORT, CONFIG_MXC_USB_FLAGS);
 
        udelay(10000);
index 6252f6a25f716a689681378ee93c5bfb9ad2f8db..51fe5bc3c5d1547f07555c942d2405e003956b33 100644 (file)
@@ -28,7 +28,11 @@ LIB  := $(obj)libvideo.o
 COBJS-$(CONFIG_ATI_RADEON_FB) += ati_radeon_fb.o videomodes.o
 COBJS-$(CONFIG_ATMEL_LCD) += atmel_lcdfb.o
 COBJS-$(CONFIG_CFB_CONSOLE) += cfb_console.o
+COBJS-$(CONFIG_EXYNOS_FB) += exynos_fb.o exynos_fimd.o
+COBJS-$(CONFIG_EXYNOS_MIPI_DSIM) += exynos_mipi_dsi.o exynos_mipi_dsi_common.o \
+                               exynos_mipi_dsi_lowlevel.o
 COBJS-$(CONFIG_FSL_DIU_FB) += fsl_diu_fb.o videomodes.o
+COBJS-$(CONFIG_S6E8AX0) += s6e8ax0.o
 COBJS-$(CONFIG_S6E63D6) += s6e63d6.o
 COBJS-$(CONFIG_SED156X) += sed156x.o
 COBJS-$(CONFIG_VIDEO_AMBA) += amba.o
@@ -38,6 +42,7 @@ COBJS-$(CONFIG_VIDEO_MB862xx) += mb862xx.o videomodes.o
 COBJS-$(CONFIG_VIDEO_MB86R0xGDC) += mb86r0xgdc.o videomodes.o
 COBJS-$(CONFIG_VIDEO_MX3) += mx3fb.o videomodes.o
 COBJS-$(CONFIG_VIDEO_MX5) += mxc_ipuv3_fb.o ipu_common.o ipu_disp.o
+COBJS-$(CONFIG_VIDEO_MXS) += mxsfb.o
 COBJS-$(CONFIG_VIDEO_OMAP3) += omap3_dss.o videomodes.o
 COBJS-$(CONFIG_VIDEO_SED13806) += sed13806.o
 COBJS-$(CONFIG_VIDEO_SM501) += sm501.o
index a2981b18eb50b1e31bdda016478b0ea9135a78ea..06157b7305f6ca14820821ba062b1d75d7d97cbc 100644 (file)
@@ -30,6 +30,7 @@
 #include <video_fb.h>
 #include <linux/list.h>
 #include <linux/fb.h>
+#include <lcd.h>
 
 #include <asm/errno.h>
 #include <asm/io.h>
 
 #define DRIVER_NAME "da8xx_lcdc"
 
+#define LCD_VERSION_1  1
+#define LCD_VERSION_2  2
+
+#define BIT(x) (1 << (x))
+
 /* LCD Status Register */
-#define LCD_END_OF_FRAME1              (1 << 9)
-#define LCD_END_OF_FRAME0              (1 << 8)
-#define LCD_PL_LOAD_DONE               (1 << 6)
-#define LCD_FIFO_UNDERFLOW             (1 << 5)
-#define LCD_SYNC_LOST                  (1 << 2)
+#define LCD_END_OF_FRAME1              BIT(9)
+#define LCD_END_OF_FRAME0              BIT(8)
+#define LCD_PL_LOAD_DONE               BIT(6)
+#define LCD_FIFO_UNDERFLOW             BIT(5)
+#define LCD_SYNC_LOST                  BIT(2)
 
 /* LCD DMA Control Register */
 #define LCD_DMA_BURST_SIZE(x)          ((x) << 4)
+#define LCD_DMA_BURST_SIZE_MASK                (0x7 << 4)
 #define LCD_DMA_BURST_1                        0x0
 #define LCD_DMA_BURST_2                        0x1
 #define LCD_DMA_BURST_4                        0x2
 #define LCD_DMA_BURST_8                        0x3
 #define LCD_DMA_BURST_16               0x4
-#define LCD_END_OF_FRAME_INT_ENA       (1 << 2)
-#define LCD_DUAL_FRAME_BUFFER_ENABLE   (1 << 0)
+#define LCD_V1_END_OF_FRAME_INT_ENA    BIT(2)
+#define LCD_V2_END_OF_FRAME0_INT_ENA   BIT(8)
+#define LCD_V2_END_OF_FRAME1_INT_ENA   BIT(9)
+#define LCD_DUAL_FRAME_BUFFER_ENABLE   BIT(0)
 
 /* LCD Control Register */
 #define LCD_CLK_DIVISOR(x)             ((x) << 8)
 #define PALETTE_ONLY                   0x01
 #define DATA_ONLY                      0x02
 
-#define LCD_MONO_8BIT_MODE             (1 << 9)
-#define LCD_RASTER_ORDER               (1 << 8)
-#define LCD_TFT_MODE                   (1 << 7)
-#define LCD_UNDERFLOW_INT_ENA          (1 << 6)
-#define LCD_PL_ENABLE                  (1 << 4)
-#define LCD_MONOCHROME_MODE            (1 << 1)
-#define LCD_RASTER_ENABLE              (1 << 0)
-#define LCD_TFT_ALT_ENABLE             (1 << 23)
-#define LCD_STN_565_ENABLE             (1 << 24)
+#define LCD_MONO_8BIT_MODE             BIT(9)
+#define LCD_RASTER_ORDER               BIT(8)
+#define LCD_TFT_MODE                   BIT(7)
+#define LCD_V1_UNDERFLOW_INT_ENA       BIT(6)
+#define LCD_V2_UNDERFLOW_INT_ENA       BIT(5)
+#define LCD_V1_PL_INT_ENA              BIT(4)
+#define LCD_V2_PL_INT_ENA              BIT(6)
+#define LCD_MONOCHROME_MODE            BIT(1)
+#define LCD_RASTER_ENABLE              BIT(0)
+#define LCD_TFT_ALT_ENABLE             BIT(23)
+#define LCD_STN_565_ENABLE             BIT(24)
+#define LCD_TFT24                      BIT(25)
+#define LCD_TFT24_UNPACKED             BIT(26)
+#define LCD_V2_DMA_CLK_EN              BIT(2)
+#define LCD_V2_LIDD_CLK_EN             BIT(1)
+#define LCD_V2_CORE_CLK_EN             BIT(0)
+#define LCD_V2_LPP_B10                 26
 
 /* LCD Raster Timing 2 Register */
 #define LCD_AC_BIAS_TRANSITIONS_PER_INT(x)     ((x) << 16)
 #define LCD_AC_BIAS_FREQUENCY(x)               ((x) << 8)
-#define LCD_SYNC_CTRL                          (1 << 25)
-#define LCD_SYNC_EDGE                          (1 << 24)
-#define LCD_INVERT_PIXEL_CLOCK                 (1 << 22)
-#define LCD_INVERT_LINE_CLOCK                  (1 << 21)
-#define LCD_INVERT_FRAME_CLOCK                 (1 << 20)
+#define LCD_SYNC_CTRL                          BIT(25)
+#define LCD_SYNC_EDGE                          BIT(24)
+#define LCD_INVERT_PIXEL_CLOCK                 BIT(22)
+#define LCD_INVERT_LINE_CLOCK                  BIT(21)
+#define LCD_INVERT_FRAME_CLOCK                 BIT(20)
+
+/* Clock reset register */
+#define  LCD_CLK_MAIN_RESET                    BIT(3)
 
 /* LCD Block */
 struct da8xx_lcd_regs {
-       u32     revid;
-       u32     ctrl;
-       u32     stat;
-       u32     lidd_ctrl;
-       u32     lidd_cs0_conf;
-       u32     lidd_cs0_addr;
-       u32     lidd_cs0_data;
-       u32     lidd_cs1_conf;
-       u32     lidd_cs1_addr;
-       u32     lidd_cs1_data;
-       u32     raster_ctrl;
-       u32     raster_timing_0;
-       u32     raster_timing_1;
-       u32     raster_timing_2;
-       u32     raster_subpanel;
-       u32     reserved;
-       u32     dma_ctrl;
-       u32     dma_frm_buf_base_addr_0;
-       u32     dma_frm_buf_ceiling_addr_0;
-       u32     dma_frm_buf_base_addr_1;
-       u32     dma_frm_buf_ceiling_addr_1;
+       u32     revid;                          /* 0x00 */
+       u32     ctrl;                           /* 0x04 */
+       u32     stat;                           /* 0x08 */
+       u32     lidd_ctrl;                      /* 0x0c */
+       u32     lidd_cs0_conf;                  /* 0x10 */
+       u32     lidd_cs0_addr;                  /* 0x14 */
+       u32     lidd_cs0_data;                  /* 0x18 */
+       u32     lidd_cs1_conf;                  /* 0x1c */
+       u32     lidd_cs1_addr;                  /* 0x20 */
+       u32     lidd_cs1_data;                  /* 0x24 */
+       u32     raster_ctrl;                    /* 0x28 */
+       u32     raster_timing_0;                /* 0x2c */
+       u32     raster_timing_1;                /* 0x30 */
+       u32     raster_timing_2;                /* 0x34 */
+       u32     raster_subpanel;                /* 0x38 */
+       u32     reserved;                       /* 0x3c */
+       u32     dma_ctrl;                       /* 0x40 */
+       u32     dma_frm_buf_base_addr_0;        /* 0x44 */
+       u32     dma_frm_buf_ceiling_addr_0;     /* 0x48 */
+       u32     dma_frm_buf_base_addr_1;        /* 0x4c */
+       u32     dma_frm_buf_ceiling_addr_1;     /* 0x50 */
+       u32     rsrvd1;                         /* 0x54 */
+       u32     raw_stat;                       /* 0x58 */
+       u32     masked_stat;                    /* 0x5c */
+       u32     int_enable_set;                 /* 0x60 */
+       u32     int_enable_clr;                 /* 0x64 */
+       u32     end_of_int_ind;                 /* 0x68 */
+       u32     clk_enable;                     /* 0x6c */
+       u32     clk_reset;                      /* 0x70 */
 };
 
 #define LCD_NUM_BUFFERS        1
@@ -120,22 +148,21 @@ struct da8xx_lcd_regs {
 #define UPPER_MARGIN   32
 #define LOWER_MARGIN   32
 
-#define calc_fbsize() (panel.plnSizeX * panel.plnSizeY * panel.gdfBytesPP)
-#define mdelay(n) ({unsigned long msec = (n); while (msec--) udelay(1000); })
+DECLARE_GLOBAL_DATA_PTR;
 
 static struct da8xx_lcd_regs *da8xx_fb_reg_base;
-
-DECLARE_GLOBAL_DATA_PTR;
+static unsigned int lcd_revision;
 
 /* graphics setup */
 static GraphicDevice gpanel;
 static const struct da8xx_panel *lcd_panel;
 static struct fb_info *da8xx_fb_info;
 static int bits_x_pixel;
+static u32 (*lcdc_irq_handler)(void);
 
 static inline unsigned int lcdc_read(u32 *addr)
 {
-       return (unsigned int)readl(addr);
+       return readl(addr);
 }
 
 static inline void lcdc_write(unsigned int val, u32 *addr)
@@ -144,8 +171,8 @@ static inline void lcdc_write(unsigned int val, u32 *addr)
 }
 
 struct da8xx_fb_par {
-       u32                      p_palette_base;
-       unsigned char *v_palette_base;
+       unsigned long           p_palette_base;
+       void                    *v_palette_base;
        dma_addr_t              vram_phys;
        unsigned long           vram_size;
        void                    *vram_virt;
@@ -161,7 +188,6 @@ struct da8xx_fb_par {
        int                     vsync_timeout;
 };
 
-
 /* Variable Screen Information */
 static struct fb_var_screeninfo da8xx_fb_var = {
        .xoffset = 0,
@@ -193,10 +219,10 @@ static struct fb_fix_screeninfo da8xx_fb_fix = {
 };
 
 static const struct display_panel disp_panel = {
-       QVGA,
-       16,
-       16,
-       COLOR_ACTIVE,
+       .panel_type = QVGA,
+       .max_bpp = 24,
+       .min_bpp = 16,
+       .panel_shade = COLOR_ACTIVE,
 };
 
 static const struct lcd_ctrl_config lcd_cfg = {
@@ -204,7 +230,7 @@ static const struct lcd_ctrl_config lcd_cfg = {
        .ac_bias                = 255,
        .ac_bias_intrpt         = 0,
        .dma_burst_sz           = 16,
-       .bpp                    = 16,
+       .bpp                    = 1 << LCD_BPP,
        .fdd                    = 255,
        .tft_alt_mode           = 0,
        .stn_565_mode           = 0,
@@ -221,6 +247,10 @@ static inline void lcd_enable_raster(void)
 {
        u32 reg;
 
+       /* Bring LCDC out of reset */
+       if (lcd_revision == LCD_VERSION_2)
+               lcdc_write(0, &da8xx_fb_reg_base->clk_reset);
+
        reg = lcdc_read(&da8xx_fb_reg_base->raster_ctrl);
        if (!(reg & LCD_RASTER_ENABLE))
                lcdc_write(reg | LCD_RASTER_ENABLE,
@@ -236,6 +266,9 @@ static inline void lcd_disable_raster(void)
        if (reg & LCD_RASTER_ENABLE)
                lcdc_write(reg & ~LCD_RASTER_ENABLE,
                        &da8xx_fb_reg_base->raster_ctrl);
+       if (lcd_revision == LCD_VERSION_2)
+               /* Write 1 to reset LCDC */
+               lcdc_write(LCD_CLK_MAIN_RESET, &da8xx_fb_reg_base->clk_reset);
 }
 
 static void lcd_blit(int load_mode, struct da8xx_fb_par *par)
@@ -244,6 +277,7 @@ static void lcd_blit(int load_mode, struct da8xx_fb_par *par)
        u32 end;
        u32 reg_ras;
        u32 reg_dma;
+       u32 reg_int;
 
        /* init reg to clear PLM (loading mode) fields */
        reg_ras = lcdc_read(&da8xx_fb_reg_base->raster_ctrl);
@@ -256,8 +290,15 @@ static void lcd_blit(int load_mode, struct da8xx_fb_par *par)
                end      = par->dma_end;
 
                reg_ras |= LCD_PALETTE_LOAD_MODE(DATA_ONLY);
-               reg_dma |= LCD_END_OF_FRAME_INT_ENA;
-
+               if (lcd_revision == LCD_VERSION_1) {
+                       reg_dma |= LCD_V1_END_OF_FRAME_INT_ENA;
+               } else {
+                       reg_int = lcdc_read(&da8xx_fb_reg_base->int_enable_set) |
+                               LCD_V2_END_OF_FRAME0_INT_ENA |
+                               LCD_V2_END_OF_FRAME1_INT_ENA;
+                       lcdc_write(reg_int,
+                               &da8xx_fb_reg_base->int_enable_set);
+               }
 #if (LCD_NUM_BUFFERS == 2)
                reg_dma |= LCD_DUAL_FRAME_BUFFER_ENABLE;
                lcdc_write(start, &da8xx_fb_reg_base->dma_frm_buf_base_addr_0);
@@ -271,14 +312,19 @@ static void lcd_blit(int load_mode, struct da8xx_fb_par *par)
                lcdc_write(0, &da8xx_fb_reg_base->dma_frm_buf_base_addr_1);
                lcdc_write(0, &da8xx_fb_reg_base->dma_frm_buf_ceiling_addr_1);
 #endif
-
        } else if (load_mode == LOAD_PALETTE) {
                start    = par->p_palette_base;
                end      = start + par->palette_sz - 1;
 
                reg_ras |= LCD_PALETTE_LOAD_MODE(PALETTE_ONLY);
-               reg_ras |= LCD_PL_ENABLE;
 
+               if (lcd_revision == LCD_VERSION_1) {
+                       reg_ras |= LCD_V1_PL_INT_ENA;
+               } else {
+                       reg_int = lcdc_read(&da8xx_fb_reg_base->int_enable_set) |
+                               LCD_V2_PL_INT_ENA;
+                       lcdc_write(reg_int, &da8xx_fb_reg_base->int_enable_set);
+               }
                lcdc_write(start, &da8xx_fb_reg_base->dma_frm_buf_base_addr_0);
                lcdc_write(end, &da8xx_fb_reg_base->dma_frm_buf_ceiling_addr_0);
        }
@@ -298,7 +344,8 @@ static int lcd_cfg_dma(int burst_size)
 {
        u32 reg;
 
-       reg = lcdc_read(&da8xx_fb_reg_base->dma_ctrl) & 0x00000001;
+       reg = lcdc_read(&da8xx_fb_reg_base->dma_ctrl);
+       reg &= ~LCD_DMA_BURST_SIZE_MASK;
        switch (burst_size) {
        case 1:
                reg |= LCD_DMA_BURST_SIZE(LCD_DMA_BURST_1);
@@ -361,10 +408,13 @@ static void lcd_cfg_vertical_sync(int back_porch, int pulse_width,
 static int lcd_cfg_display(const struct lcd_ctrl_config *cfg)
 {
        u32 reg;
+       u32 reg_int;
 
        reg = lcdc_read(&da8xx_fb_reg_base->raster_ctrl) & ~(LCD_TFT_MODE |
                                                LCD_MONO_8BIT_MODE |
-                                               LCD_MONOCHROME_MODE);
+                                               LCD_MONOCHROME_MODE |
+                                               LCD_TFT24 |
+                                               LCD_TFT24_UNPACKED);
 
        switch (cfg->p_disp_panel->panel_shade) {
        case MONOCHROME:
@@ -388,7 +438,17 @@ static int lcd_cfg_display(const struct lcd_ctrl_config *cfg)
        }
 
        /* enable additional interrupts here */
-       reg |= LCD_UNDERFLOW_INT_ENA;
+       if (lcd_revision == LCD_VERSION_1) {
+               reg |= LCD_V1_UNDERFLOW_INT_ENA;
+       } else {
+               if (bits_x_pixel >= 24)
+                       reg |= LCD_TFT24;
+               if (cfg->bpp == 32)
+                       reg |= LCD_TFT24_UNPACKED;
+               reg_int = lcdc_read(&da8xx_fb_reg_base->int_enable_set) |
+                       LCD_V2_UNDERFLOW_INT_ENA;
+               lcdc_write(reg_int, &da8xx_fb_reg_base->int_enable_set);
+       }
 
        lcdc_write(reg, &da8xx_fb_reg_base->raster_ctrl);
 
@@ -426,18 +486,44 @@ static int lcd_cfg_frame_buffer(struct da8xx_fb_par *par, u32 width, u32 height,
 
        /* Set the Panel Width */
        /* Pixels per line = (PPL + 1)*16 */
-       /*0x3F in bits 4..9 gives max horisontal resolution = 1024 pixels*/
-       width &= 0x3f0;
+       /* Pixels per line = (PPL + 1)*16 */
+       if (lcd_revision == LCD_VERSION_1) {
+               /*
+                * 0x3F in bits 4..9 gives max horizontal resolution = 1024
+                * pixels.
+                */
+               width &= 0x3f0;
+       } else {
+               /*
+                * 0x7F in bits 4..10 gives max horizontal resolution = 2048
+                * pixels.
+                */
+               width &= 0x7f0;
+       }
+
        reg = lcdc_read(&da8xx_fb_reg_base->raster_timing_0);
        reg &= 0xfffffc00;
-       reg |= ((width >> 4) - 1) << 4;
+       if (lcd_revision == LCD_VERSION_1) {
+               reg |= ((width >> 4) - 1) << 4;
+       } else {
+               width = (width >> 4) - 1;
+               reg |= ((width & 0x3f) << 4) | ((width & 0x40) >> 3);
+       }
        lcdc_write(reg, &da8xx_fb_reg_base->raster_timing_0);
 
        /* Set the Panel Height */
+       /* Set bits 9:0 of Lines Per Pixel */
        reg = lcdc_read(&da8xx_fb_reg_base->raster_timing_1);
        reg = ((height - 1) & 0x3ff) | (reg & 0xfffffc00);
        lcdc_write(reg, &da8xx_fb_reg_base->raster_timing_1);
 
+       /* Set bit 10 of Lines Per Pixel */
+       if (lcd_revision == LCD_VERSION_2) {
+               reg = lcdc_read(&da8xx_fb_reg_base->raster_timing_2);
+               reg |= ((height - 1) & 0x400) << 16;
+               lcdc_write(reg, &da8xx_fb_reg_base->raster_timing_2);
+       }
+
        /* Set the Raster Order of the Frame Buffer */
        reg = lcdc_read(&da8xx_fb_reg_base->raster_ctrl) & ~(1 << 8);
        if (raster_order)
@@ -449,6 +535,7 @@ static int lcd_cfg_frame_buffer(struct da8xx_fb_par *par, u32 width, u32 height,
        case 2:
        case 4:
        case 16:
+       case 24:
                par->palette_sz = 16 * 2;
                break;
 
@@ -468,7 +555,7 @@ static int fb_setcolreg(unsigned regno, unsigned red, unsigned green,
                              struct fb_info *info)
 {
        struct da8xx_fb_par *par = info->par;
-       unsigned short *palette = (unsigned short *) par->v_palette_base;
+       unsigned short *palette = par->v_palette_base;
        u_short pal;
        int update_hw = 0;
 
@@ -491,7 +578,7 @@ static int fb_setcolreg(unsigned regno, unsigned red, unsigned green,
                        update_hw = 1;
                        palette[regno] = pal;
                }
-       } else if ((info->var.bits_per_pixel == 16) && regno < 16) {
+       } else if ((info->var.bits_per_pixel >= 16) && regno < 16) {
                red >>= (16 - info->var.red.length);
                red <<= info->var.red.offset;
 
@@ -524,22 +611,45 @@ static void lcd_reset(struct da8xx_fb_par *par)
        /* DMA has to be disabled */
        lcdc_write(0, &da8xx_fb_reg_base->dma_ctrl);
        lcdc_write(0, &da8xx_fb_reg_base->raster_ctrl);
+
+       if (lcd_revision == LCD_VERSION_2) {
+               lcdc_write(0, &da8xx_fb_reg_base->int_enable_set);
+               /* Write 1 to reset */
+               lcdc_write(LCD_CLK_MAIN_RESET, &da8xx_fb_reg_base->clk_reset);
+               lcdc_write(0, &da8xx_fb_reg_base->clk_reset);
+       }
 }
 
 static void lcd_calc_clk_divider(struct da8xx_fb_par *par)
 {
        unsigned int lcd_clk, div;
 
+#ifndef CONFIG_AM33XX
        /* Get clock from sysclk2 */
        lcd_clk = clk_get(2);
-
-       div = lcd_clk / par->pxl_clk;
-       debug("LCD Clock: 0x%x Divider: 0x%x PixClk: 0x%x\n",
-               lcd_clk, div, par->pxl_clk);
+#else
+       lcd_clk = lcdc_clk_rate();
+#endif
+       /* calculate divisor so that the resulting clock is rounded down */
+       div = (lcd_clk + par->pxl_clk - 1)/ par->pxl_clk;
+       if (div > 255)
+               div = 255;
+       if (div < 2)
+               div = 2;
+
+       debug("LCD Clock: %u.%03uMHz Divider: 0x%08x PixClk requested: %u.%03uMHz actual: %u.%03uMHz\n",
+               lcd_clk / 1000000, lcd_clk / 1000 % 1000, div,
+               par->pxl_clk / 1000000, par->pxl_clk / 1000 % 1000,
+               lcd_clk / div / 1000000, lcd_clk / div / 1000 % 1000);
 
        /* Configure the LCD clock divisor. */
-       lcdc_write(LCD_CLK_DIVISOR(div) |
-                       (LCD_RASTER_MODE & 0x1), &da8xx_fb_reg_base->ctrl);
+       lcdc_write(LCD_CLK_DIVISOR(div) | LCD_RASTER_MODE,
+               &da8xx_fb_reg_base->ctrl);
+
+       if (lcd_revision == LCD_VERSION_2)
+               lcdc_write(LCD_V2_DMA_CLK_EN | LCD_V2_LIDD_CLK_EN |
+                               LCD_V2_CORE_CLK_EN, &da8xx_fb_reg_base->clk_enable);
+
 }
 
 static int lcd_init(struct da8xx_fb_par *par, const struct lcd_ctrl_config *cfg,
@@ -574,7 +684,7 @@ static int lcd_init(struct da8xx_fb_par *par, const struct lcd_ctrl_config *cfg,
        lcd_cfg_vertical_sync(panel->vbp, panel->vsw, panel->vfp);
        lcd_cfg_horizontal_sync(panel->hbp, panel->hsw, panel->hfp);
 
-       /* Configure for disply */
+       /* Configure for display */
        ret = lcd_cfg_display(cfg);
        if (ret < 0)
                return ret;
@@ -615,7 +725,68 @@ static void lcdc_dma_start(void)
                &da8xx_fb_reg_base->dma_frm_buf_ceiling_addr_1);
 }
 
-static u32 lcdc_irq_handler(void)
+/* IRQ handler for version 2 of LCDC */
+static u32 lcdc_irq_handler_rev02(void)
+{
+       u32 ret = 0;
+       struct da8xx_fb_par *par = da8xx_fb_info->par;
+       u32 stat = lcdc_read(&da8xx_fb_reg_base->masked_stat);
+
+       debug("%s: stat=%08x\n", __func__, stat);
+
+       if ((stat & LCD_SYNC_LOST) && (stat & LCD_FIFO_UNDERFLOW)) {
+               debug("LCD_SYNC_LOST\n");
+               lcd_disable_raster();
+               lcdc_write(stat, &da8xx_fb_reg_base->masked_stat);
+               lcd_enable_raster();
+               ret = LCD_SYNC_LOST;
+       } else if (stat & LCD_PL_LOAD_DONE) {
+               debug("LCD_PL_LOAD_DONE\n");
+               /*
+                * Must disable raster before changing state of any control bit.
+                * And also must be disabled before clearing the PL loading
+                * interrupt via the following write to the status register. If
+                * this is done after then one gets multiple PL done interrupts.
+                */
+               lcd_disable_raster();
+
+               lcdc_write(stat, &da8xx_fb_reg_base->masked_stat);
+
+               /* Disable PL completion inerrupt */
+               lcdc_write(LCD_V2_PL_INT_ENA,
+                       &da8xx_fb_reg_base->int_enable_clr);
+
+               /* Setup and start data loading mode */
+               lcd_blit(LOAD_DATA, par);
+               ret = LCD_PL_LOAD_DONE;
+       } else if (stat & (LCD_END_OF_FRAME0 | LCD_END_OF_FRAME1)) {
+               par->vsync_flag = 1;
+               lcdc_write(stat, &da8xx_fb_reg_base->masked_stat);
+
+               if (stat & LCD_END_OF_FRAME0) {
+                       debug("LCD_END_OF_FRAME0\n");
+
+                       lcdc_write(par->dma_start,
+                               &da8xx_fb_reg_base->dma_frm_buf_base_addr_0);
+                       lcdc_write(par->dma_end,
+                               &da8xx_fb_reg_base->dma_frm_buf_ceiling_addr_0);
+               }
+               if (stat & LCD_END_OF_FRAME1) {
+                       debug("LCD_END_OF_FRAME1\n");
+                       lcdc_write(par->dma_start,
+                               &da8xx_fb_reg_base->dma_frm_buf_base_addr_1);
+                       lcdc_write(par->dma_end,
+                               &da8xx_fb_reg_base->dma_frm_buf_ceiling_addr_1);
+                       par->vsync_flag = 1;
+               }
+               ret = (stat & LCD_END_OF_FRAME0) ?
+                       LCD_END_OF_FRAME0 : LCD_END_OF_FRAME1;
+       }
+       lcdc_write(0, &da8xx_fb_reg_base->end_of_int_ind);
+       return ret;
+}
+
+static u32 lcdc_irq_handler_rev01(void)
 {
        struct da8xx_fb_par *par = da8xx_fb_info->par;
        u32 stat = lcdc_read(&da8xx_fb_reg_base->stat);
@@ -641,37 +812,50 @@ static u32 lcdc_irq_handler(void)
 
                /* Disable PL completion inerrupt */
                reg_ras  = lcdc_read(&da8xx_fb_reg_base->raster_ctrl);
-               reg_ras &= ~LCD_PL_ENABLE;
+               reg_ras &= ~LCD_V1_PL_INT_ENA;
                lcdc_write(reg_ras, &da8xx_fb_reg_base->raster_ctrl);
 
                /* Setup and start data loading mode */
                lcd_blit(LOAD_DATA, par);
                return LCD_PL_LOAD_DONE;
-       } else {
+       } else if (stat & (LCD_END_OF_FRAME0 | LCD_END_OF_FRAME1)) {
+               par->vsync_flag = 1;
                lcdc_write(stat, &da8xx_fb_reg_base->stat);
 
-               if (stat & LCD_END_OF_FRAME0)
+               if (stat & LCD_END_OF_FRAME0) {
                        debug("LCD_END_OF_FRAME0\n");
 
-               lcdc_write(par->dma_start,
-                       &da8xx_fb_reg_base->dma_frm_buf_base_addr_0);
-               lcdc_write(par->dma_end,
-                       &da8xx_fb_reg_base->dma_frm_buf_ceiling_addr_0);
-               par->vsync_flag = 1;
-               return LCD_END_OF_FRAME0;
+                       lcdc_write(par->dma_start,
+                               &da8xx_fb_reg_base->dma_frm_buf_base_addr_0);
+                       lcdc_write(par->dma_end,
+                               &da8xx_fb_reg_base->dma_frm_buf_ceiling_addr_0);
+               }
+
+               if (stat & LCD_END_OF_FRAME1) {
+                       debug("LCD_END_OF_FRAME1\n");
+                       lcdc_write(par->dma_start,
+                               &da8xx_fb_reg_base->dma_frm_buf_base_addr_1);
+                       lcdc_write(par->dma_end,
+                               &da8xx_fb_reg_base->dma_frm_buf_ceiling_addr_1);
+               }
+
+               return (stat & LCD_END_OF_FRAME0) ?
+                       LCD_END_OF_FRAME0 : LCD_END_OF_FRAME1;
        }
        return stat;
 }
 
 static u32 wait_for_event(u32 event)
 {
-       u32 timeout = 50000;
+       int timeout = 100;
        u32 ret;
 
        do {
                ret = lcdc_irq_handler();
+               if (ret & event)
+                       break;
                udelay(1000);
-       } while (!(ret & event));
+       } while (--timeout > 0);
 
        if (timeout <= 0) {
                printf("%s: event %d not hit\n", __func__, event);
@@ -692,6 +876,7 @@ void *video_hw_init(void)
                printf("Display not initialized\n");
                return NULL;
        }
+
        gpanel.winSizeX = lcd_panel->width;
        gpanel.winSizeY = lcd_panel->height;
        gpanel.plnSizeX = lcd_panel->width;
@@ -709,19 +894,36 @@ void *video_hw_init(void)
        default:
                gpanel.gdfBytesPP = 1;
                gpanel.gdfIndex = GDF__8BIT_INDEX;
-               break;
        }
 
        da8xx_fb_reg_base = (struct da8xx_lcd_regs *)DAVINCI_LCD_CNTL_BASE;
 
-       debug("Resolution: %dx%d %x\n",
+       /* Determine LCD IP Version */
+
+       lcd_revision = lcdc_read(&da8xx_fb_reg_base->revid);
+       switch (lcd_revision & 0xfff00000) {
+       case 0x4C100000:
+               lcd_revision = LCD_VERSION_1;
+               break;
+
+       case 0x4F200000:
+               lcd_revision = LCD_VERSION_2;
+               break;
+
+       default:
+               printf("Unknown PID Reg value 0x%08x, defaulting to LCD revision 1\n",
+                               lcd_revision);
+               lcd_revision = LCD_VERSION_1;
+       }
+
+       debug("Resolution: %dx%d %d\n",
                gpanel.winSizeX,
                gpanel.winSizeY,
                lcd_cfg.bpp);
 
        size = sizeof(struct fb_info) + sizeof(struct da8xx_fb_par);
        da8xx_fb_info = malloc(size);
-       debug("da8xx_fb_info at %x\n", (unsigned int)da8xx_fb_info);
+       debug("da8xx_fb_info at %p\n", da8xx_fb_info);
 
        if (!da8xx_fb_info) {
                printf("Memory allocation failed for fb_info\n");
@@ -744,23 +946,27 @@ void *video_hw_init(void)
        par->vram_size = lcd_panel->width * lcd_panel->height * lcd_cfg.bpp;
        par->vram_size = par->vram_size * LCD_NUM_BUFFERS / 8;
 
+#ifdef CONFIG_LCD
+       par->vram_virt = lcd_base;
+#else
        par->vram_virt = malloc(par->vram_size);
-
+#endif
        par->vram_phys = (dma_addr_t) par->vram_virt;
-       debug("Requesting 0x%x bytes for framebuffer at 0x%x\n",
-               (unsigned int)par->vram_size,
-               (unsigned int)par->vram_virt);
+       debug("Requesting 0x%lx bytes for framebuffer at 0x%p\n",
+               par->vram_size, par->vram_virt);
        if (!par->vram_virt) {
                printf("GLCD: malloc for frame buffer failed\n");
                goto err_release_fb;
        }
 
        gpanel.frameAdrs = (unsigned int)par->vram_virt;
-       da8xx_fb_info->screen_base = (char *) par->vram_virt;
+       da8xx_fb_info->screen_base = par->vram_virt;
        da8xx_fb_fix.smem_start = gpanel.frameAdrs;
        da8xx_fb_fix.smem_len = par->vram_size;
        da8xx_fb_fix.line_length = (lcd_panel->width * lcd_cfg.bpp) / 8;
-
+       debug("%s: vram_virt: %p size %ux%u=%lu bpp %u\n", __func__,
+               par->vram_virt, lcd_panel->width, lcd_panel->height,
+               par->vram_size, lcd_cfg.bpp);
        par->dma_start = par->vram_phys;
        par->dma_end   = par->dma_start + lcd_panel->height *
                da8xx_fb_fix.line_length - 1;
@@ -772,11 +978,9 @@ void *video_hw_init(void)
                goto err_release_fb_mem;
        }
        memset(par->v_palette_base, 0, PALETTE_SIZE);
-       par->p_palette_base = (unsigned int)par->v_palette_base;
-
-       /* Initialize par */
-       da8xx_fb_info->var.bits_per_pixel = lcd_cfg.bpp;
+       par->p_palette_base = (unsigned long)par->v_palette_base;
 
+       /* Initialize var */
        da8xx_fb_var.xres = lcd_panel->width;
        da8xx_fb_var.xres_virtual = lcd_panel->width;
 
@@ -798,11 +1002,16 @@ void *video_hw_init(void)
        da8xx_fb_info->fix.visual = (da8xx_fb_info->var.bits_per_pixel <= 8) ?
                                FB_VISUAL_PSEUDOCOLOR : FB_VISUAL_TRUECOLOR;
 
+       if (lcd_revision == LCD_VERSION_1)
+               lcdc_irq_handler = lcdc_irq_handler_rev01;
+       else
+               lcdc_irq_handler = lcdc_irq_handler_rev02;
+
        /* Clear interrupt */
-       memset((void *)par->vram_virt, 0, par->vram_size);
+       memset(par->vram_virt, 0, par->vram_size);
        lcd_disable_raster();
        lcdc_write(0xFFFF, &da8xx_fb_reg_base->stat);
-       debug("Palette at 0x%x size %d\n", par->p_palette_base,
+       debug("Palette at 0x%08lx size %u\n", par->p_palette_base,
                par->palette_sz);
        lcdc_dma_start();
 
@@ -815,10 +1024,12 @@ void *video_hw_init(void)
        /* Wait until DMA is working */
        wait_for_event(LCD_END_OF_FRAME0);
 
-       return (void *)&gpanel;
+       return &gpanel;
 
 err_release_fb_mem:
+#ifndef CONFIG_LCD
        free(par->vram_virt);
+#endif
 
 err_release_fb:
        free(da8xx_fb_info);
@@ -826,14 +1037,17 @@ err_release_fb:
        return NULL;
 }
 
+void da8xx_fb_disable(void)
+{
+       lcd_reset(da8xx_fb_info->par);
+}
+
 void video_set_lut(unsigned int index, /* color number */
                    unsigned char r,    /* red */
                    unsigned char g,    /* green */
                    unsigned char b     /* blue */
                    )
 {
-
-       return;
 }
 
 void da8xx_video_init(const struct da8xx_panel *panel, int bits_pixel)
diff --git a/drivers/video/exynos_fb.c b/drivers/video/exynos_fb.c
new file mode 100644 (file)
index 0000000..a1cf449
--- /dev/null
@@ -0,0 +1,128 @@
+/*
+ * Copyright (C) 2012 Samsung Electronics
+ *
+ * Author: InKi Dae <inki.dae@samsung.com>
+ * Author: Donghwa Lee <dh09.lee@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 <config.h>
+#include <common.h>
+#include <lcd.h>
+#include <asm/io.h>
+#include <asm/arch/cpu.h>
+#include <asm/arch/clock.h>
+#include <asm/arch/clk.h>
+#include <asm/arch/mipi_dsim.h>
+#include <asm/arch/system.h>
+
+#include "exynos_fb.h"
+
+int lcd_line_length;
+int lcd_color_fg;
+int lcd_color_bg;
+
+void *lcd_base;
+void *lcd_console_address;
+
+short console_col;
+short console_row;
+
+static unsigned int panel_width, panel_height;
+
+/* LCD Panel data */
+vidinfo_t panel_info;
+
+static void exynos_lcd_init_mem(void *lcdbase, vidinfo_t *vid)
+{
+       unsigned long palette_size;
+       unsigned int fb_size;
+
+       fb_size = vid->vl_row * vid->vl_col * (NBITS(vid->vl_bpix) >> 3);
+
+       lcd_base = lcdbase;
+
+       palette_size = NBITS(vid->vl_bpix) == 8 ? 256 : 16;
+
+       exynos_fimd_lcd_init_mem((unsigned long)lcd_base,
+                       (unsigned long)fb_size, palette_size);
+}
+
+static void exynos_lcd_init(vidinfo_t *vid)
+{
+       exynos_fimd_lcd_init(vid);
+}
+
+static void lcd_panel_on(vidinfo_t *vid)
+{
+       udelay(vid->init_delay);
+
+       if (vid->backlight_reset)
+               vid->backlight_reset();
+
+       if (vid->cfg_gpio)
+               vid->cfg_gpio();
+
+       if (vid->lcd_power_on)
+               vid->lcd_power_on();
+
+       udelay(vid->power_on_delay);
+
+       if (vid->reset_lcd) {
+               vid->reset_lcd();
+               udelay(vid->reset_delay);
+       }
+
+       if (vid->backlight_on)
+               vid->backlight_on(1);
+
+       if (vid->cfg_ldo)
+               vid->cfg_ldo();
+
+       if (vid->enable_ldo)
+               vid->enable_ldo(1);
+
+       if (vid->mipi_enabled)
+               exynos_mipi_dsi_init();
+}
+
+void lcd_ctrl_init(void *lcdbase)
+{
+       set_system_display_ctrl();
+       set_lcd_clk();
+
+       /* initialize parameters which is specific to panel. */
+       init_panel_info(&panel_info);
+
+       panel_width = panel_info.vl_width;
+       panel_height = panel_info.vl_height;
+
+       exynos_lcd_init_mem(lcdbase, &panel_info);
+
+       exynos_lcd_init(&panel_info);
+}
+
+void lcd_enable(void)
+{
+       lcd_panel_on(&panel_info);
+}
+
+/* dummy function */
+void lcd_setcolreg(ushort regno, ushort red, ushort green, ushort blue)
+{
+       return;
+}
diff --git a/drivers/video/exynos_fb.h b/drivers/video/exynos_fb.h
new file mode 100644 (file)
index 0000000..66f5da6
--- /dev/null
@@ -0,0 +1,61 @@
+/*
+ * Copyright (C) 2012 Samsung Electronics
+ *
+ * Author: InKi Dae <inki.dae@samsung.com>
+ * Author: Donghwa Lee <dh09.lee@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 _EXYNOS_FB_H_
+#define _EXYNOS_FB_H_
+
+#include <asm/arch/fb.h>
+
+#define MAX_CLOCK      (86 * 1000000)
+
+enum exynos_fb_rgb_mode_t {
+       MODE_RGB_P = 0,
+       MODE_BGR_P = 1,
+       MODE_RGB_S = 2,
+       MODE_BGR_S = 3,
+};
+
+enum exynos_cpu_auto_cmd_rate {
+       DISABLE_AUTO_FRM,
+       PER_TWO_FRM,
+       PER_FOUR_FRM,
+       PER_SIX_FRM,
+       PER_EIGHT_FRM,
+       PER_TEN_FRM,
+       PER_TWELVE_FRM,
+       PER_FOURTEEN_FRM,
+       PER_SIXTEEN_FRM,
+       PER_EIGHTEEN_FRM,
+       PER_TWENTY_FRM,
+       PER_TWENTY_TWO_FRM,
+       PER_TWENTY_FOUR_FRM,
+       PER_TWENTY_SIX_FRM,
+       PER_TWENTY_EIGHT_FRM,
+       PER_THIRTY_FRM,
+};
+
+void exynos_fimd_lcd_init_mem(unsigned long screen_base, unsigned long fb_size,
+       unsigned long palette_size);
+void exynos_fimd_lcd_init(vidinfo_t *vid);
+unsigned long exynos_fimd_calc_fbsize(void);
+
+#endif
diff --git a/drivers/video/exynos_fimd.c b/drivers/video/exynos_fimd.c
new file mode 100644 (file)
index 0000000..6416b90
--- /dev/null
@@ -0,0 +1,354 @@
+/*
+ * Copyright (C) 2012 Samsung Electronics
+ *
+ * Author: InKi Dae <inki.dae@samsung.com>
+ * Author: Donghwa Lee <dh09.lee@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 <config.h>
+#include <common.h>
+#include <asm/io.h>
+#include <lcd.h>
+#include <div64.h>
+#include <asm/arch/clk.h>
+#include <asm/arch/clock.h>
+#include <asm/arch/cpu.h>
+#include "exynos_fb.h"
+
+static unsigned long *lcd_base_addr;
+static vidinfo_t *pvid;
+
+void exynos_fimd_lcd_init_mem(u_long screen_base, u_long fb_size,
+               u_long palette_size)
+{
+       lcd_base_addr = (unsigned long *)screen_base;
+}
+
+static void exynos_fimd_set_dualrgb(unsigned int enabled)
+{
+       struct exynos4_fb *fimd_ctrl =
+               (struct exynos4_fb *)samsung_get_base_fimd();
+       unsigned int cfg = 0;
+
+       if (enabled) {
+               cfg = EXYNOS_DUALRGB_BYPASS_DUAL | EXYNOS_DUALRGB_LINESPLIT |
+                       EXYNOS_DUALRGB_VDEN_EN_ENABLE;
+
+               /* in case of Line Split mode, MAIN_CNT doesn't neet to set. */
+               cfg |= EXYNOS_DUALRGB_SUB_CNT(pvid->vl_col / 2) |
+                       EXYNOS_DUALRGB_MAIN_CNT(0);
+       }
+
+       writel(cfg, &fimd_ctrl->dualrgb);
+}
+
+static void exynos_fimd_set_par(unsigned int win_id)
+{
+       unsigned int cfg = 0;
+       struct exynos4_fb *fimd_ctrl =
+               (struct exynos4_fb *)samsung_get_base_fimd();
+
+       /* set window control */
+       cfg = readl((unsigned int)&fimd_ctrl->wincon0 +
+                       EXYNOS_WINCON(win_id));
+
+       cfg &= ~(EXYNOS_WINCON_BITSWP_ENABLE | EXYNOS_WINCON_BYTESWP_ENABLE |
+               EXYNOS_WINCON_HAWSWP_ENABLE | EXYNOS_WINCON_WSWP_ENABLE |
+               EXYNOS_WINCON_BURSTLEN_MASK | EXYNOS_WINCON_BPPMODE_MASK |
+               EXYNOS_WINCON_INRGB_MASK | EXYNOS_WINCON_DATAPATH_MASK);
+
+       /* DATAPATH is DMA */
+       cfg |= EXYNOS_WINCON_DATAPATH_DMA;
+
+       /* bpp is 32 */
+       cfg |= EXYNOS_WINCON_WSWP_ENABLE;
+
+       /* dma burst is 16 */
+       cfg |= EXYNOS_WINCON_BURSTLEN_16WORD;
+
+       /* pixel format is unpacked RGB888 */
+       cfg |= EXYNOS_WINCON_BPPMODE_24BPP_888;
+
+       writel(cfg, (unsigned int)&fimd_ctrl->wincon0 +
+                       EXYNOS_WINCON(win_id));
+
+       /* set window position to x=0, y=0*/
+       cfg = EXYNOS_VIDOSD_LEFT_X(0) | EXYNOS_VIDOSD_TOP_Y(0);
+       writel(cfg, (unsigned int)&fimd_ctrl->vidosd0a +
+                       EXYNOS_VIDOSD(win_id));
+
+       cfg = EXYNOS_VIDOSD_RIGHT_X(pvid->vl_col - 1) |
+               EXYNOS_VIDOSD_BOTTOM_Y(pvid->vl_row - 1);
+       writel(cfg, (unsigned int)&fimd_ctrl->vidosd0b +
+                       EXYNOS_VIDOSD(win_id));
+
+       /* set window size for window0*/
+       cfg = EXYNOS_VIDOSD_SIZE(pvid->vl_col * pvid->vl_row);
+       writel(cfg, (unsigned int)&fimd_ctrl->vidosd0c +
+                       EXYNOS_VIDOSD(win_id));
+}
+
+static void exynos_fimd_set_buffer_address(unsigned int win_id)
+{
+       unsigned long start_addr, end_addr;
+       struct exynos4_fb *fimd_ctrl =
+               (struct exynos4_fb *)samsung_get_base_fimd();
+
+       start_addr = (unsigned long)lcd_base_addr;
+       end_addr = start_addr + ((pvid->vl_col * (NBITS(pvid->vl_bpix) / 8)) *
+                               pvid->vl_row);
+
+       writel(start_addr, (unsigned int)&fimd_ctrl->vidw00add0b0 +
+                       EXYNOS_BUFFER_OFFSET(win_id));
+       writel(end_addr, (unsigned int)&fimd_ctrl->vidw00add1b0 +
+                       EXYNOS_BUFFER_OFFSET(win_id));
+}
+
+static void exynos_fimd_set_clock(vidinfo_t *pvid)
+{
+       unsigned int cfg = 0, div = 0, remainder, remainder_div;
+       unsigned long pixel_clock;
+       unsigned long long src_clock;
+       struct exynos4_fb *fimd_ctrl =
+               (struct exynos4_fb *)samsung_get_base_fimd();
+
+       if (pvid->dual_lcd_enabled) {
+               pixel_clock = pvid->vl_freq *
+                               (pvid->vl_hspw + pvid->vl_hfpd +
+                                pvid->vl_hbpd + pvid->vl_col / 2) *
+                               (pvid->vl_vspw + pvid->vl_vfpd +
+                                pvid->vl_vbpd + pvid->vl_row);
+       } else if (pvid->interface_mode == FIMD_CPU_INTERFACE) {
+               pixel_clock = pvid->vl_freq *
+                               pvid->vl_width * pvid->vl_height *
+                               (pvid->cs_setup + pvid->wr_setup +
+                                pvid->wr_act + pvid->wr_hold + 1);
+       } else {
+               pixel_clock = pvid->vl_freq *
+                               (pvid->vl_hspw + pvid->vl_hfpd +
+                                pvid->vl_hbpd + pvid->vl_col) *
+                               (pvid->vl_vspw + pvid->vl_vfpd +
+                                pvid->vl_vbpd + pvid->vl_row);
+       }
+
+       cfg = readl(&fimd_ctrl->vidcon0);
+       cfg &= ~(EXYNOS_VIDCON0_CLKSEL_MASK | EXYNOS_VIDCON0_CLKVALUP_MASK |
+               EXYNOS_VIDCON0_CLKVAL_F(0xFF) | EXYNOS_VIDCON0_VCLKEN_MASK |
+               EXYNOS_VIDCON0_CLKDIR_MASK);
+       cfg |= (EXYNOS_VIDCON0_CLKSEL_SCLK | EXYNOS_VIDCON0_CLKVALUP_ALWAYS |
+               EXYNOS_VIDCON0_VCLKEN_NORMAL | EXYNOS_VIDCON0_CLKDIR_DIVIDED);
+
+       if (pixel_clock > MAX_CLOCK)
+               pixel_clock = MAX_CLOCK;
+
+       src_clock = (unsigned long long) get_lcd_clk();
+
+       /* get quotient and remainder. */
+       remainder = do_div(src_clock, pixel_clock);
+       div = src_clock;
+
+       remainder *= 10;
+       remainder_div = remainder / pixel_clock;
+
+       /* round about one places of decimals. */
+       if (remainder_div >= 5)
+               div++;
+
+       /* in case of dual lcd mode. */
+       if (pvid->dual_lcd_enabled)
+               div--;
+
+       cfg |= EXYNOS_VIDCON0_CLKVAL_F(div - 1);
+       writel(cfg, &fimd_ctrl->vidcon0);
+}
+
+void exynos_set_trigger(void)
+{
+       unsigned int cfg = 0;
+       struct exynos4_fb *fimd_ctrl =
+               (struct exynos4_fb *)samsung_get_base_fimd();
+
+       cfg = readl(&fimd_ctrl->trigcon);
+
+       cfg |= (EXYNOS_I80SOFT_TRIG_EN | EXYNOS_I80START_TRIG);
+
+       writel(cfg, &fimd_ctrl->trigcon);
+}
+
+int exynos_is_i80_frame_done(void)
+{
+       unsigned int cfg = 0;
+       int status;
+       struct exynos4_fb *fimd_ctrl =
+               (struct exynos4_fb *)samsung_get_base_fimd();
+
+       cfg = readl(&fimd_ctrl->trigcon);
+
+       /* frame done func is valid only when TRIMODE[0] is set to 1. */
+       status = (cfg & EXYNOS_I80STATUS_TRIG_DONE) ==
+                       EXYNOS_I80STATUS_TRIG_DONE;
+
+       return status;
+}
+
+static void exynos_fimd_lcd_on(void)
+{
+       unsigned int cfg = 0;
+       struct exynos4_fb *fimd_ctrl =
+               (struct exynos4_fb *)samsung_get_base_fimd();
+
+       /* display on */
+       cfg = readl(&fimd_ctrl->vidcon0);
+       cfg |= (EXYNOS_VIDCON0_ENVID_ENABLE | EXYNOS_VIDCON0_ENVID_F_ENABLE);
+       writel(cfg, &fimd_ctrl->vidcon0);
+}
+
+static void exynos_fimd_window_on(unsigned int win_id)
+{
+       unsigned int cfg = 0;
+       struct exynos4_fb *fimd_ctrl =
+               (struct exynos4_fb *)samsung_get_base_fimd();
+
+       /* enable window */
+       cfg = readl((unsigned int)&fimd_ctrl->wincon0 +
+                       EXYNOS_WINCON(win_id));
+       cfg |= EXYNOS_WINCON_ENWIN_ENABLE;
+       writel(cfg, (unsigned int)&fimd_ctrl->wincon0 +
+                       EXYNOS_WINCON(win_id));
+
+       cfg = readl(&fimd_ctrl->winshmap);
+       cfg |= EXYNOS_WINSHMAP_CH_ENABLE(win_id);
+       writel(cfg, &fimd_ctrl->winshmap);
+}
+
+void exynos_fimd_lcd_off(void)
+{
+       unsigned int cfg = 0;
+       struct exynos4_fb *fimd_ctrl =
+               (struct exynos4_fb *)samsung_get_base_fimd();
+
+       cfg = readl(&fimd_ctrl->vidcon0);
+       cfg &= (EXYNOS_VIDCON0_ENVID_DISABLE | EXYNOS_VIDCON0_ENVID_F_DISABLE);
+       writel(cfg, &fimd_ctrl->vidcon0);
+}
+
+void exynos_fimd_window_off(unsigned int win_id)
+{
+       unsigned int cfg = 0;
+       struct exynos4_fb *fimd_ctrl =
+               (struct exynos4_fb *)samsung_get_base_fimd();
+
+       cfg = readl((unsigned int)&fimd_ctrl->wincon0 +
+                       EXYNOS_WINCON(win_id));
+       cfg &= EXYNOS_WINCON_ENWIN_DISABLE;
+       writel(cfg, (unsigned int)&fimd_ctrl->wincon0 +
+                       EXYNOS_WINCON(win_id));
+
+       cfg = readl(&fimd_ctrl->winshmap);
+       cfg &= ~EXYNOS_WINSHMAP_CH_DISABLE(win_id);
+       writel(cfg, &fimd_ctrl->winshmap);
+}
+
+void exynos_fimd_lcd_init(vidinfo_t *vid)
+{
+       unsigned int cfg = 0, rgb_mode;
+       struct exynos4_fb *fimd_ctrl =
+               (struct exynos4_fb *)samsung_get_base_fimd();
+
+       /* store panel info to global variable */
+       pvid = vid;
+
+       rgb_mode = MODE_RGB_P;
+
+       if (vid->interface_mode == FIMD_RGB_INTERFACE) {
+               cfg |= EXYNOS_VIDCON0_VIDOUT_RGB;
+               writel(cfg, &fimd_ctrl->vidcon0);
+
+               cfg = readl(&fimd_ctrl->vidcon2);
+               cfg &= ~(EXYNOS_VIDCON2_WB_MASK |
+                       EXYNOS_VIDCON2_TVFORMATSEL_MASK |
+                       EXYNOS_VIDCON2_TVFORMATSEL_YUV_MASK);
+               cfg |= EXYNOS_VIDCON2_WB_DISABLE;
+               writel(cfg, &fimd_ctrl->vidcon2);
+
+               /* set polarity */
+               cfg = 0;
+               if (!pvid->vl_clkp)
+                       cfg |= EXYNOS_VIDCON1_IVCLK_RISING_EDGE;
+               if (!pvid->vl_hsp)
+                       cfg |= EXYNOS_VIDCON1_IHSYNC_INVERT;
+               if (!pvid->vl_vsp)
+                       cfg |= EXYNOS_VIDCON1_IVSYNC_INVERT;
+               if (!pvid->vl_dp)
+                       cfg |= EXYNOS_VIDCON1_IVDEN_INVERT;
+
+               writel(cfg, &fimd_ctrl->vidcon1);
+
+               /* set timing */
+               cfg = EXYNOS_VIDTCON0_VFPD(pvid->vl_vfpd - 1);
+               cfg |= EXYNOS_VIDTCON0_VBPD(pvid->vl_vbpd - 1);
+               cfg |= EXYNOS_VIDTCON0_VSPW(pvid->vl_vspw - 1);
+               writel(cfg, &fimd_ctrl->vidtcon0);
+
+               cfg = EXYNOS_VIDTCON1_HFPD(pvid->vl_hfpd - 1);
+               cfg |= EXYNOS_VIDTCON1_HBPD(pvid->vl_hbpd - 1);
+               cfg |= EXYNOS_VIDTCON1_HSPW(pvid->vl_hspw - 1);
+
+               writel(cfg, &fimd_ctrl->vidtcon1);
+
+               /* set lcd size */
+               cfg = EXYNOS_VIDTCON2_HOZVAL(pvid->vl_col - 1);
+               cfg |= EXYNOS_VIDTCON2_LINEVAL(pvid->vl_row - 1);
+
+               writel(cfg, &fimd_ctrl->vidtcon2);
+       }
+
+       /* set display mode */
+       cfg = readl(&fimd_ctrl->vidcon0);
+       cfg &= ~EXYNOS_VIDCON0_PNRMODE_MASK;
+       cfg |= (rgb_mode << EXYNOS_VIDCON0_PNRMODE_SHIFT);
+       writel(cfg, &fimd_ctrl->vidcon0);
+
+       /* set par */
+       exynos_fimd_set_par(pvid->win_id);
+
+       /* set memory address */
+       exynos_fimd_set_buffer_address(pvid->win_id);
+
+       /* set buffer size */
+       cfg = EXYNOS_VIDADDR_PAGEWIDTH(pvid->vl_col * NBITS(pvid->vl_bpix) / 8);
+       writel(cfg, (unsigned int)&fimd_ctrl->vidw00add2 +
+                                       EXYNOS_BUFFER_SIZE(pvid->win_id));
+
+       /* set clock */
+       exynos_fimd_set_clock(pvid);
+
+       /* set rgb mode to dual lcd. */
+       exynos_fimd_set_dualrgb(pvid->dual_lcd_enabled);
+
+       /* display on */
+       exynos_fimd_lcd_on();
+
+       /* window on */
+       exynos_fimd_window_on(pvid->win_id);
+}
+
+unsigned long exynos_fimd_calc_fbsize(void)
+{
+       return pvid->vl_col * pvid->vl_row * (NBITS(pvid->vl_bpix) / 8);
+}
diff --git a/drivers/video/exynos_mipi_dsi.c b/drivers/video/exynos_mipi_dsi.c
new file mode 100644 (file)
index 0000000..aee248c
--- /dev/null
@@ -0,0 +1,253 @@
+/*
+ * Copyright (C) 2012 Samsung Electronics
+ *
+ * Author: InKi Dae <inki.dae@samsung.com>
+ * Author: Donghwa Lee <dh09.lee@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 <linux/err.h>
+#include <asm/arch/dsim.h>
+#include <asm/arch/mipi_dsim.h>
+#include <asm/arch/power.h>
+#include <asm/arch/cpu.h>
+#include <asm/arch/clk.h>
+
+#include "exynos_mipi_dsi_lowlevel.h"
+#include "exynos_mipi_dsi_common.h"
+
+#define master_to_driver(a)    (a->dsim_lcd_drv)
+#define master_to_device(a)    (a->dsim_lcd_dev)
+
+static struct exynos_platform_mipi_dsim *dsim_pd;
+
+struct mipi_dsim_ddi {
+       int                             bus_id;
+       struct list_head                list;
+       struct mipi_dsim_lcd_device     *dsim_lcd_dev;
+       struct mipi_dsim_lcd_driver     *dsim_lcd_drv;
+};
+
+static LIST_HEAD(dsim_ddi_list);
+static LIST_HEAD(dsim_lcd_dev_list);
+
+int exynos_mipi_dsi_register_lcd_device(struct mipi_dsim_lcd_device *lcd_dev)
+{
+       struct mipi_dsim_ddi *dsim_ddi;
+
+       if (!lcd_dev) {
+               debug("mipi_dsim_lcd_device is NULL.\n");
+               return -EFAULT;
+       }
+
+       if (!lcd_dev->name) {
+               debug("dsim_lcd_device name is NULL.\n");
+               return -EFAULT;
+       }
+
+       dsim_ddi = kzalloc(sizeof(struct mipi_dsim_ddi), GFP_KERNEL);
+       if (!dsim_ddi) {
+               debug("failed to allocate dsim_ddi object.\n");
+               return -EFAULT;
+       }
+
+       dsim_ddi->dsim_lcd_dev = lcd_dev;
+
+       list_add_tail(&dsim_ddi->list, &dsim_ddi_list);
+
+       return 0;
+}
+
+struct mipi_dsim_ddi
+       *exynos_mipi_dsi_find_lcd_device(struct mipi_dsim_lcd_driver *lcd_drv)
+{
+       struct mipi_dsim_ddi *dsim_ddi;
+       struct mipi_dsim_lcd_device *lcd_dev;
+
+       list_for_each_entry(dsim_ddi, &dsim_ddi_list, list) {
+               lcd_dev = dsim_ddi->dsim_lcd_dev;
+               if (!lcd_dev)
+                       continue;
+
+               if (lcd_drv->id >= 0) {
+                       if ((strcmp(lcd_drv->name, lcd_dev->name)) == 0 &&
+                                       lcd_drv->id == lcd_dev->id) {
+                               /**
+                                * bus_id would be used to identify
+                                * connected bus.
+                                */
+                               dsim_ddi->bus_id = lcd_dev->bus_id;
+
+                               return dsim_ddi;
+                       }
+               } else {
+                       if ((strcmp(lcd_drv->name, lcd_dev->name)) == 0) {
+                               /**
+                                * bus_id would be used to identify
+                                * connected bus.
+                                */
+                               dsim_ddi->bus_id = lcd_dev->bus_id;
+
+                               return dsim_ddi;
+                       }
+               }
+
+               kfree(dsim_ddi);
+               list_del(&dsim_ddi_list);
+       }
+
+       return NULL;
+}
+
+int exynos_mipi_dsi_register_lcd_driver(struct mipi_dsim_lcd_driver *lcd_drv)
+{
+       struct mipi_dsim_ddi *dsim_ddi;
+
+       if (!lcd_drv) {
+               debug("mipi_dsim_lcd_driver is NULL.\n");
+               return -EFAULT;
+       }
+
+       if (!lcd_drv->name) {
+               debug("dsim_lcd_driver name is NULL.\n");
+               return -EFAULT;
+       }
+
+       dsim_ddi = exynos_mipi_dsi_find_lcd_device(lcd_drv);
+       if (!dsim_ddi) {
+               debug("mipi_dsim_ddi object not found.\n");
+               return -EFAULT;
+       }
+
+       dsim_ddi->dsim_lcd_drv = lcd_drv;
+
+       debug("registered panel driver(%s) to mipi-dsi driver.\n",
+               lcd_drv->name);
+
+       return 0;
+
+}
+
+struct mipi_dsim_ddi
+       *exynos_mipi_dsi_bind_lcd_ddi(struct mipi_dsim_device *dsim,
+                       const char *name)
+{
+       struct mipi_dsim_ddi *dsim_ddi;
+       struct mipi_dsim_lcd_driver *lcd_drv;
+       struct mipi_dsim_lcd_device *lcd_dev;
+
+       list_for_each_entry(dsim_ddi, &dsim_ddi_list, list) {
+               lcd_drv = dsim_ddi->dsim_lcd_drv;
+               lcd_dev = dsim_ddi->dsim_lcd_dev;
+               if (!lcd_drv || !lcd_dev)
+                       continue;
+
+               debug("lcd_drv->id = %d, lcd_dev->id = %d\n",
+                                       lcd_drv->id, lcd_dev->id);
+
+               if ((strcmp(lcd_drv->name, name) == 0)) {
+                       lcd_dev->master = dsim;
+
+                       dsim->dsim_lcd_dev = lcd_dev;
+                       dsim->dsim_lcd_drv = lcd_drv;
+
+                       return dsim_ddi;
+               }
+       }
+
+       return NULL;
+}
+
+/* define MIPI-DSI Master operations. */
+static struct mipi_dsim_master_ops master_ops = {
+       .cmd_write                      = exynos_mipi_dsi_wr_data,
+       .get_dsim_frame_done            = exynos_mipi_dsi_get_frame_done_status,
+       .clear_dsim_frame_done          = exynos_mipi_dsi_clear_frame_done,
+};
+
+int exynos_mipi_dsi_init(void)
+{
+       struct mipi_dsim_device *dsim;
+       struct mipi_dsim_config *dsim_config;
+       struct mipi_dsim_ddi *dsim_ddi;
+
+       dsim = kzalloc(sizeof(struct mipi_dsim_device), GFP_KERNEL);
+       if (!dsim) {
+               debug("failed to allocate dsim object.\n");
+               return -EFAULT;
+       }
+
+       /* get mipi_dsim_config. */
+       dsim_config = dsim_pd->dsim_config;
+       if (dsim_config == NULL) {
+               debug("failed to get dsim config data.\n");
+               return -EFAULT;
+       }
+
+       dsim->pd = dsim_pd;
+       dsim->dsim_config = dsim_config;
+       dsim->master_ops = &master_ops;
+
+       /* bind lcd ddi matched with panel name. */
+       dsim_ddi = exynos_mipi_dsi_bind_lcd_ddi(dsim, dsim_pd->lcd_panel_name);
+       if (!dsim_ddi) {
+               debug("mipi_dsim_ddi object not found.\n");
+               return -ENOSYS;
+       }
+       if (dsim_pd->lcd_power)
+               dsim_pd->lcd_power();
+
+       if (dsim_pd->mipi_power)
+               dsim_pd->mipi_power();
+
+       /* phy_enable(unsigned int dev_index, unsigned int enable) */
+       if (dsim_pd->phy_enable)
+               dsim_pd->phy_enable(0, 1);
+
+       set_mipi_clk();
+
+       exynos_mipi_dsi_init_dsim(dsim);
+       exynos_mipi_dsi_init_link(dsim);
+       exynos_mipi_dsi_set_hs_enable(dsim);
+
+       /* set display timing. */
+       exynos_mipi_dsi_set_display_mode(dsim, dsim->dsim_config);
+
+       /* initialize mipi-dsi client(lcd panel). */
+       if (dsim_ddi->dsim_lcd_drv && dsim_ddi->dsim_lcd_drv->mipi_panel_init) {
+               dsim_ddi->dsim_lcd_drv->mipi_panel_init(dsim);
+               dsim_ddi->dsim_lcd_drv->mipi_display_on(dsim);
+       }
+
+       debug("mipi-dsi driver(%s mode) has been probed.\n",
+               (dsim_config->e_interface == DSIM_COMMAND) ?
+                       "CPU" : "RGB");
+
+       return 0;
+}
+
+void exynos_set_dsim_platform_data(struct exynos_platform_mipi_dsim *pd)
+{
+       if (pd == NULL) {
+               debug("pd is NULL\n");
+               return;
+       }
+
+       dsim_pd = pd;
+}
diff --git a/drivers/video/exynos_mipi_dsi_common.c b/drivers/video/exynos_mipi_dsi_common.c
new file mode 100644 (file)
index 0000000..6eeb464
--- /dev/null
@@ -0,0 +1,637 @@
+/*
+ * Copyright (C) 2012 Samsung Electronics
+ *
+ * Author: InKi Dae <inki.dae@samsung.com>
+ * Author: Donghwa Lee <dh09.lee@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 <lcd.h>
+#include <linux/err.h>
+#include <asm/arch/dsim.h>
+#include <asm/arch/mipi_dsim.h>
+
+#include "exynos_mipi_dsi_lowlevel.h"
+
+#define MHZ                    (1000 * 1000)
+#define FIN_HZ                 (24 * MHZ)
+
+#define DFIN_PLL_MIN_HZ                (6 * MHZ)
+#define DFIN_PLL_MAX_HZ                (12 * MHZ)
+
+#define DFVCO_MIN_HZ           (500 * MHZ)
+#define DFVCO_MAX_HZ           (1000 * MHZ)
+
+#define TRY_GET_FIFO_TIMEOUT   (5000 * 2)
+
+/* MIPI-DSIM status types. */
+enum {
+       DSIM_STATE_INIT,        /* should be initialized. */
+       DSIM_STATE_STOP,        /* CPU and LCDC are LP mode. */
+       DSIM_STATE_HSCLKEN,     /* HS clock was enabled. */
+       DSIM_STATE_ULPS
+};
+
+/* define DSI lane types. */
+enum {
+       DSIM_LANE_CLOCK = (1 << 0),
+       DSIM_LANE_DATA0 = (1 << 1),
+       DSIM_LANE_DATA1 = (1 << 2),
+       DSIM_LANE_DATA2 = (1 << 3),
+       DSIM_LANE_DATA3 = (1 << 4)
+};
+
+static unsigned int dpll_table[15] = {
+       100, 120, 170, 220, 270,
+       320, 390, 450, 510, 560,
+       640, 690, 770, 870, 950
+};
+
+static void exynos_mipi_dsi_long_data_wr(struct mipi_dsim_device *dsim,
+               unsigned int data0, unsigned int data1)
+{
+       unsigned int data_cnt = 0, payload = 0;
+
+       /* in case that data count is more then 4 */
+       for (data_cnt = 0; data_cnt < data1; data_cnt += 4) {
+               /*
+                * after sending 4bytes per one time,
+                * send remainder data less then 4.
+                */
+               if ((data1 - data_cnt) < 4) {
+                       if ((data1 - data_cnt) == 3) {
+                               payload = *(u8 *)(data0 + data_cnt) |
+                                       (*(u8 *)(data0 + (data_cnt + 1))) << 8 |
+                                       (*(u8 *)(data0 + (data_cnt + 2))) << 16;
+                       debug("count = 3 payload = %x, %x %x %x\n",
+                               payload, *(u8 *)(data0 + data_cnt),
+                               *(u8 *)(data0 + (data_cnt + 1)),
+                               *(u8 *)(data0 + (data_cnt + 2)));
+                       } else if ((data1 - data_cnt) == 2) {
+                               payload = *(u8 *)(data0 + data_cnt) |
+                                       (*(u8 *)(data0 + (data_cnt + 1))) << 8;
+                       debug("count = 2 payload = %x, %x %x\n", payload,
+                               *(u8 *)(data0 + data_cnt),
+                               *(u8 *)(data0 + (data_cnt + 1)));
+                       } else if ((data1 - data_cnt) == 1) {
+                               payload = *(u8 *)(data0 + data_cnt);
+                       }
+               } else {
+                       /* send 4bytes per one time. */
+                       payload = *(u8 *)(data0 + data_cnt) |
+                               (*(u8 *)(data0 + (data_cnt + 1))) << 8 |
+                               (*(u8 *)(data0 + (data_cnt + 2))) << 16 |
+                               (*(u8 *)(data0 + (data_cnt + 3))) << 24;
+
+                       debug("count = 4 payload = %x, %x %x %x %x\n",
+                               payload, *(u8 *)(data0 + data_cnt),
+                               *(u8 *)(data0 + (data_cnt + 1)),
+                               *(u8 *)(data0 + (data_cnt + 2)),
+                               *(u8 *)(data0 + (data_cnt + 3)));
+
+               }
+               exynos_mipi_dsi_wr_tx_data(dsim, payload);
+       }
+}
+
+int exynos_mipi_dsi_wr_data(struct mipi_dsim_device *dsim, unsigned int data_id,
+       unsigned int data0, unsigned int data1)
+{
+       unsigned int timeout = TRY_GET_FIFO_TIMEOUT;
+       unsigned long delay_val, delay;
+       unsigned int check_rx_ack = 0;
+
+       if (dsim->state == DSIM_STATE_ULPS) {
+               debug("state is ULPS.\n");
+
+               return -EINVAL;
+       }
+
+       delay_val = MHZ / dsim->dsim_config->esc_clk;
+       delay = 10 * delay_val;
+
+       mdelay(delay);
+
+       /* only if transfer mode is LPDT, wait SFR becomes empty. */
+       if (dsim->state == DSIM_STATE_STOP) {
+               while (!(exynos_mipi_dsi_get_fifo_state(dsim) &
+                               SFR_HEADER_EMPTY)) {
+                       if ((timeout--) > 0)
+                               mdelay(1);
+                       else {
+                               debug("SRF header fifo is not empty.\n");
+                               return -EINVAL;
+                       }
+               }
+       }
+
+       switch (data_id) {
+       /* short packet types of packet types for command. */
+       case MIPI_DSI_GENERIC_SHORT_WRITE_0_PARAM:
+       case MIPI_DSI_GENERIC_SHORT_WRITE_1_PARAM:
+       case MIPI_DSI_GENERIC_SHORT_WRITE_2_PARAM:
+       case MIPI_DSI_DCS_SHORT_WRITE:
+       case MIPI_DSI_DCS_SHORT_WRITE_PARAM:
+       case MIPI_DSI_SET_MAXIMUM_RETURN_PACKET_SIZE:
+               debug("data0 = %x data1 = %x\n",
+                               data0, data1);
+               exynos_mipi_dsi_wr_tx_header(dsim, data_id, data0, data1);
+               if (check_rx_ack) {
+                       /* process response func should be implemented */
+                       return 0;
+               } else {
+                       return -EINVAL;
+               }
+
+       /* general command */
+       case MIPI_DSI_COLOR_MODE_OFF:
+       case MIPI_DSI_COLOR_MODE_ON:
+       case MIPI_DSI_SHUTDOWN_PERIPHERAL:
+       case MIPI_DSI_TURN_ON_PERIPHERAL:
+               exynos_mipi_dsi_wr_tx_header(dsim, data_id, data0, data1);
+               if (check_rx_ack) {
+                       /* process response func should be implemented. */
+                       return 0;
+               } else {
+                       return -EINVAL;
+               }
+
+       /* packet types for video data */
+       case MIPI_DSI_V_SYNC_START:
+       case MIPI_DSI_V_SYNC_END:
+       case MIPI_DSI_H_SYNC_START:
+       case MIPI_DSI_H_SYNC_END:
+       case MIPI_DSI_END_OF_TRANSMISSION:
+               return 0;
+
+       /* short and response packet types for command */
+       case MIPI_DSI_GENERIC_READ_REQUEST_0_PARAM:
+       case MIPI_DSI_GENERIC_READ_REQUEST_1_PARAM:
+       case MIPI_DSI_GENERIC_READ_REQUEST_2_PARAM:
+       case MIPI_DSI_DCS_READ:
+               exynos_mipi_dsi_clear_all_interrupt(dsim);
+               exynos_mipi_dsi_wr_tx_header(dsim, data_id, data0, data1);
+               /* process response func should be implemented. */
+               return 0;
+
+       /* long packet type and null packet */
+       case MIPI_DSI_NULL_PACKET:
+       case MIPI_DSI_BLANKING_PACKET:
+               return 0;
+       case MIPI_DSI_GENERIC_LONG_WRITE:
+       case MIPI_DSI_DCS_LONG_WRITE:
+       {
+               unsigned int data_cnt = 0, payload = 0;
+
+               /* if data count is less then 4, then send 3bytes data.  */
+               if (data1 < 4) {
+                       payload = *(u8 *)(data0) |
+                               *(u8 *)(data0 + 1) << 8 |
+                               *(u8 *)(data0 + 2) << 16;
+
+                       exynos_mipi_dsi_wr_tx_data(dsim, payload);
+
+                       debug("count = %d payload = %x,%x %x %x\n",
+                               data1, payload,
+                               *(u8 *)(data0 + data_cnt),
+                               *(u8 *)(data0 + (data_cnt + 1)),
+                               *(u8 *)(data0 + (data_cnt + 2)));
+               } else {
+                       /* in case that data count is more then 4 */
+                       exynos_mipi_dsi_long_data_wr(dsim, data0, data1);
+               }
+
+               /* put data into header fifo */
+               exynos_mipi_dsi_wr_tx_header(dsim, data_id, data1 & 0xff,
+                       (data1 & 0xff00) >> 8);
+
+       }
+       if (check_rx_ack)
+               /* process response func should be implemented. */
+               return 0;
+       else
+               return -EINVAL;
+
+       /* packet typo for video data */
+       case MIPI_DSI_PACKED_PIXEL_STREAM_16:
+       case MIPI_DSI_PACKED_PIXEL_STREAM_18:
+       case MIPI_DSI_PIXEL_STREAM_3BYTE_18:
+       case MIPI_DSI_PACKED_PIXEL_STREAM_24:
+               if (check_rx_ack) {
+                       /* process response func should be implemented. */
+                       return 0;
+               } else {
+                       return -EINVAL;
+               }
+       default:
+               debug("data id %x is not supported current DSI spec.\n",
+                       data_id);
+
+               return -EINVAL;
+       }
+
+       return 0;
+}
+
+int exynos_mipi_dsi_pll_on(struct mipi_dsim_device *dsim, unsigned int enable)
+{
+       int sw_timeout;
+
+       if (enable) {
+               sw_timeout = 1000;
+
+               exynos_mipi_dsi_clear_interrupt(dsim);
+               exynos_mipi_dsi_enable_pll(dsim, 1);
+               while (1) {
+                       sw_timeout--;
+                       if (exynos_mipi_dsi_is_pll_stable(dsim))
+                               return 0;
+                       if (sw_timeout == 0)
+                               return -EINVAL;
+               }
+       } else
+               exynos_mipi_dsi_enable_pll(dsim, 0);
+
+       return 0;
+}
+
+unsigned long exynos_mipi_dsi_change_pll(struct mipi_dsim_device *dsim,
+       unsigned int pre_divider, unsigned int main_divider,
+       unsigned int scaler)
+{
+       unsigned long dfin_pll, dfvco, dpll_out;
+       unsigned int i, freq_band = 0xf;
+
+       dfin_pll = (FIN_HZ / pre_divider);
+
+       /******************************************************
+        *      Serial Clock(=ByteClk X 8)      FreqBand[3:0] *
+        ******************************************************
+        *      ~ 99.99 MHz                     0000
+        *      100 ~ 119.99 MHz                0001
+        *      120 ~ 159.99 MHz                0010
+        *      160 ~ 199.99 MHz                0011
+        *      200 ~ 239.99 MHz                0100
+        *      140 ~ 319.99 MHz                0101
+        *      320 ~ 389.99 MHz                0110
+        *      390 ~ 449.99 MHz                0111
+        *      450 ~ 509.99 MHz                1000
+        *      510 ~ 559.99 MHz                1001
+        *      560 ~ 639.99 MHz                1010
+        *      640 ~ 689.99 MHz                1011
+        *      690 ~ 769.99 MHz                1100
+        *      770 ~ 869.99 MHz                1101
+        *      870 ~ 949.99 MHz                1110
+        *      950 ~ 1000 MHz                  1111
+        ******************************************************/
+       if (dfin_pll < DFIN_PLL_MIN_HZ || dfin_pll > DFIN_PLL_MAX_HZ) {
+               debug("fin_pll range should be 6MHz ~ 12MHz\n");
+               exynos_mipi_dsi_enable_afc(dsim, 0, 0);
+       } else {
+               if (dfin_pll < 7 * MHZ)
+                       exynos_mipi_dsi_enable_afc(dsim, 1, 0x1);
+               else if (dfin_pll < 8 * MHZ)
+                       exynos_mipi_dsi_enable_afc(dsim, 1, 0x0);
+               else if (dfin_pll < 9 * MHZ)
+                       exynos_mipi_dsi_enable_afc(dsim, 1, 0x3);
+               else if (dfin_pll < 10 * MHZ)
+                       exynos_mipi_dsi_enable_afc(dsim, 1, 0x2);
+               else if (dfin_pll < 11 * MHZ)
+                       exynos_mipi_dsi_enable_afc(dsim, 1, 0x5);
+               else
+                       exynos_mipi_dsi_enable_afc(dsim, 1, 0x4);
+       }
+
+       dfvco = dfin_pll * main_divider;
+       debug("dfvco = %lu, dfin_pll = %lu, main_divider = %d\n",
+                               dfvco, dfin_pll, main_divider);
+       if (dfvco < DFVCO_MIN_HZ || dfvco > DFVCO_MAX_HZ)
+               debug("fvco range should be 500MHz ~ 1000MHz\n");
+
+       dpll_out = dfvco / (1 << scaler);
+       debug("dpll_out = %lu, dfvco = %lu, scaler = %d\n",
+               dpll_out, dfvco, scaler);
+
+       for (i = 0; i < ARRAY_SIZE(dpll_table); i++) {
+               if (dpll_out < dpll_table[i] * MHZ) {
+                       freq_band = i;
+                       break;
+               }
+       }
+
+       debug("freq_band = %d\n", freq_band);
+
+       exynos_mipi_dsi_pll_freq(dsim, pre_divider, main_divider, scaler);
+
+       exynos_mipi_dsi_hs_zero_ctrl(dsim, 0);
+       exynos_mipi_dsi_prep_ctrl(dsim, 0);
+
+       /* Freq Band */
+       exynos_mipi_dsi_pll_freq_band(dsim, freq_band);
+
+       /* Stable time */
+       exynos_mipi_dsi_pll_stable_time(dsim,
+                               dsim->dsim_config->pll_stable_time);
+
+       /* Enable PLL */
+       debug("FOUT of mipi dphy pll is %luMHz\n",
+               (dpll_out / MHZ));
+
+       return dpll_out;
+}
+
+int exynos_mipi_dsi_set_clock(struct mipi_dsim_device *dsim,
+       unsigned int byte_clk_sel, unsigned int enable)
+{
+       unsigned int esc_div;
+       unsigned long esc_clk_error_rate;
+       unsigned long hs_clk = 0, byte_clk = 0, escape_clk = 0;
+
+       if (enable) {
+               dsim->e_clk_src = byte_clk_sel;
+
+               /* Escape mode clock and byte clock source */
+               exynos_mipi_dsi_set_byte_clock_src(dsim, byte_clk_sel);
+
+               /* DPHY, DSIM Link : D-PHY clock out */
+               if (byte_clk_sel == DSIM_PLL_OUT_DIV8) {
+                       hs_clk = exynos_mipi_dsi_change_pll(dsim,
+                               dsim->dsim_config->p, dsim->dsim_config->m,
+                               dsim->dsim_config->s);
+                       if (hs_clk == 0) {
+                               debug("failed to get hs clock.\n");
+                               return -EINVAL;
+                       }
+
+                       byte_clk = hs_clk / 8;
+                       exynos_mipi_dsi_enable_pll_bypass(dsim, 0);
+                       exynos_mipi_dsi_pll_on(dsim, 1);
+               /* DPHY : D-PHY clock out, DSIM link : external clock out */
+               } else if (byte_clk_sel == DSIM_EXT_CLK_DIV8)
+                       debug("not support EXT CLK source for MIPI DSIM\n");
+               else if (byte_clk_sel == DSIM_EXT_CLK_BYPASS)
+                       debug("not support EXT CLK source for MIPI DSIM\n");
+
+               /* escape clock divider */
+               esc_div = byte_clk / (dsim->dsim_config->esc_clk);
+               debug("esc_div = %d, byte_clk = %lu, esc_clk = %lu\n",
+                       esc_div, byte_clk, dsim->dsim_config->esc_clk);
+               if ((byte_clk / esc_div) >= (20 * MHZ) ||
+                       (byte_clk / esc_div) > dsim->dsim_config->esc_clk)
+                       esc_div += 1;
+
+               escape_clk = byte_clk / esc_div;
+               debug("escape_clk = %lu, byte_clk = %lu, esc_div = %d\n",
+                       escape_clk, byte_clk, esc_div);
+
+               /* enable escape clock. */
+               exynos_mipi_dsi_enable_byte_clock(dsim, 1);
+
+               /* enable byte clk and escape clock */
+               exynos_mipi_dsi_set_esc_clk_prs(dsim, 1, esc_div);
+               /* escape clock on lane */
+               exynos_mipi_dsi_enable_esc_clk_on_lane(dsim,
+                       (DSIM_LANE_CLOCK | dsim->data_lane), 1);
+
+               debug("byte clock is %luMHz\n",
+                       (byte_clk / MHZ));
+               debug("escape clock that user's need is %lu\n",
+                       (dsim->dsim_config->esc_clk / MHZ));
+               debug("escape clock divider is %x\n", esc_div);
+               debug("escape clock is %luMHz\n",
+                       ((byte_clk / esc_div) / MHZ));
+
+               if ((byte_clk / esc_div) > escape_clk) {
+                       esc_clk_error_rate = escape_clk /
+                               (byte_clk / esc_div);
+                       debug("error rate is %lu over.\n",
+                               (esc_clk_error_rate / 100));
+               } else if ((byte_clk / esc_div) < (escape_clk)) {
+                       esc_clk_error_rate = (byte_clk / esc_div) /
+                               escape_clk;
+                       debug("error rate is %lu under.\n",
+                               (esc_clk_error_rate / 100));
+               }
+       } else {
+               exynos_mipi_dsi_enable_esc_clk_on_lane(dsim,
+                       (DSIM_LANE_CLOCK | dsim->data_lane), 0);
+               exynos_mipi_dsi_set_esc_clk_prs(dsim, 0, 0);
+
+               /* disable escape clock. */
+               exynos_mipi_dsi_enable_byte_clock(dsim, 0);
+
+               if (byte_clk_sel == DSIM_PLL_OUT_DIV8)
+                       exynos_mipi_dsi_pll_on(dsim, 0);
+       }
+
+       return 0;
+}
+
+int exynos_mipi_dsi_init_dsim(struct mipi_dsim_device *dsim)
+{
+       dsim->state = DSIM_STATE_INIT;
+
+       switch (dsim->dsim_config->e_no_data_lane) {
+       case DSIM_DATA_LANE_1:
+               dsim->data_lane = DSIM_LANE_DATA0;
+               break;
+       case DSIM_DATA_LANE_2:
+               dsim->data_lane = DSIM_LANE_DATA0 | DSIM_LANE_DATA1;
+               break;
+       case DSIM_DATA_LANE_3:
+               dsim->data_lane = DSIM_LANE_DATA0 | DSIM_LANE_DATA1 |
+                       DSIM_LANE_DATA2;
+               break;
+       case DSIM_DATA_LANE_4:
+               dsim->data_lane = DSIM_LANE_DATA0 | DSIM_LANE_DATA1 |
+                       DSIM_LANE_DATA2 | DSIM_LANE_DATA3;
+               break;
+       default:
+               debug("data lane is invalid.\n");
+               return -EINVAL;
+       };
+
+       exynos_mipi_dsi_sw_reset(dsim);
+       exynos_mipi_dsi_dp_dn_swap(dsim, 0);
+
+       return 0;
+}
+
+int exynos_mipi_dsi_enable_frame_done_int(struct mipi_dsim_device *dsim,
+       unsigned int enable)
+{
+       /* enable only frame done interrupt */
+       exynos_mipi_dsi_set_interrupt_mask(dsim, INTMSK_FRAME_DONE, enable);
+
+       return 0;
+}
+
+static void convert_to_fb_videomode(struct fb_videomode *mode1,
+                               vidinfo_t *mode2)
+{
+       mode1->xres = mode2->vl_width;
+       mode1->yres = mode2->vl_height;
+       mode1->upper_margin = mode2->vl_vfpd;
+       mode1->lower_margin = mode2->vl_vbpd;
+       mode1->left_margin = mode2->vl_hfpd;
+       mode1->right_margin = mode2->vl_hbpd;
+       mode1->vsync_len = mode2->vl_vspw;
+       mode1->hsync_len = mode2->vl_hspw;
+}
+
+int exynos_mipi_dsi_set_display_mode(struct mipi_dsim_device *dsim,
+       struct mipi_dsim_config *dsim_config)
+{
+       struct exynos_platform_mipi_dsim *dsim_pd;
+       struct fb_videomode lcd_video;
+       vidinfo_t *vid;
+
+       dsim_pd = (struct exynos_platform_mipi_dsim *)dsim->pd;
+       vid = (vidinfo_t *)dsim_pd->lcd_panel_info;
+
+       convert_to_fb_videomode(&lcd_video, vid);
+
+       /* in case of VIDEO MODE (RGB INTERFACE), it sets polarities. */
+       if (dsim->dsim_config->e_interface == (u32) DSIM_VIDEO) {
+               if (dsim->dsim_config->auto_vertical_cnt == 0) {
+                       exynos_mipi_dsi_set_main_disp_vporch(dsim,
+                               vid->vl_cmd_allow_len,
+                               lcd_video.upper_margin,
+                               lcd_video.lower_margin);
+                       exynos_mipi_dsi_set_main_disp_hporch(dsim,
+                               lcd_video.left_margin,
+                               lcd_video.right_margin);
+                       exynos_mipi_dsi_set_main_disp_sync_area(dsim,
+                               lcd_video.vsync_len,
+                               lcd_video.hsync_len);
+               }
+       }
+
+       exynos_mipi_dsi_set_main_disp_resol(dsim, lcd_video.xres,
+                       lcd_video.yres);
+
+       exynos_mipi_dsi_display_config(dsim, dsim->dsim_config);
+
+       debug("lcd panel ==> width = %d, height = %d\n",
+                       lcd_video.xres, lcd_video.yres);
+
+       return 0;
+}
+
+int exynos_mipi_dsi_init_link(struct mipi_dsim_device *dsim)
+{
+       unsigned int time_out = 100;
+
+       switch (dsim->state) {
+       case DSIM_STATE_INIT:
+               exynos_mipi_dsi_init_fifo_pointer(dsim, 0x1f);
+
+               /* dsi configuration */
+               exynos_mipi_dsi_init_config(dsim);
+               exynos_mipi_dsi_enable_lane(dsim, DSIM_LANE_CLOCK, 1);
+               exynos_mipi_dsi_enable_lane(dsim, dsim->data_lane, 1);
+
+               /* set clock configuration */
+               exynos_mipi_dsi_set_clock(dsim,
+                                       dsim->dsim_config->e_byte_clk, 1);
+
+               /* check clock and data lane state are stop state */
+               while (!(exynos_mipi_dsi_is_lane_state(dsim))) {
+                       time_out--;
+                       if (time_out == 0) {
+                               debug("DSI Master is not stop state.\n");
+                               debug("Check initialization process\n");
+
+                               return -EINVAL;
+                       }
+               }
+
+               dsim->state = DSIM_STATE_STOP;
+
+               /* BTA sequence counters */
+               exynos_mipi_dsi_set_stop_state_counter(dsim,
+                       dsim->dsim_config->stop_holding_cnt);
+               exynos_mipi_dsi_set_bta_timeout(dsim,
+                       dsim->dsim_config->bta_timeout);
+               exynos_mipi_dsi_set_lpdr_timeout(dsim,
+                       dsim->dsim_config->rx_timeout);
+
+               return 0;
+       default:
+               debug("DSI Master is already init.\n");
+               return 0;
+       }
+
+       return 0;
+}
+
+int exynos_mipi_dsi_set_hs_enable(struct mipi_dsim_device *dsim)
+{
+       if (dsim->state == DSIM_STATE_STOP) {
+               if (dsim->e_clk_src != DSIM_EXT_CLK_BYPASS) {
+                       dsim->state = DSIM_STATE_HSCLKEN;
+
+                        /* set LCDC and CPU transfer mode to HS. */
+                       exynos_mipi_dsi_set_lcdc_transfer_mode(dsim, 0);
+                       exynos_mipi_dsi_set_cpu_transfer_mode(dsim, 0);
+
+                       exynos_mipi_dsi_enable_hs_clock(dsim, 1);
+
+                       return 0;
+               } else
+                       debug("clock source is external bypass.\n");
+       } else
+               debug("DSIM is not stop state.\n");
+
+       return 0;
+}
+
+int exynos_mipi_dsi_set_data_transfer_mode(struct mipi_dsim_device *dsim,
+               unsigned int mode)
+{
+       if (mode) {
+               if (dsim->state != DSIM_STATE_HSCLKEN) {
+                       debug("HS Clock lane is not enabled.\n");
+                       return -EINVAL;
+               }
+
+               exynos_mipi_dsi_set_lcdc_transfer_mode(dsim, 0);
+       } else {
+               if (dsim->state == DSIM_STATE_INIT || dsim->state ==
+                       DSIM_STATE_ULPS) {
+                       debug("DSI Master is not STOP or HSDT state.\n");
+                       return -EINVAL;
+               }
+
+               exynos_mipi_dsi_set_cpu_transfer_mode(dsim, 0);
+       }
+
+       return 0;
+}
+
+int exynos_mipi_dsi_get_frame_done_status(struct mipi_dsim_device *dsim)
+{
+       return _exynos_mipi_dsi_get_frame_done_status(dsim);
+}
+
+int exynos_mipi_dsi_clear_frame_done(struct mipi_dsim_device *dsim)
+{
+       _exynos_mipi_dsi_clear_frame_done(dsim);
+
+       return 0;
+}
diff --git a/drivers/video/exynos_mipi_dsi_common.h b/drivers/video/exynos_mipi_dsi_common.h
new file mode 100644 (file)
index 0000000..4d80679
--- /dev/null
@@ -0,0 +1,48 @@
+/*
+ * Copyright (C) 2012 Samsung Electronics
+ *
+ * Author: InKi Dae <inki.dae@samsung.com>
+ * Author: Donghwa Lee <dh09.lee@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 <linux/fb.h>
+
+#ifndef _EXYNOS_MIPI_DSI_COMMON_H
+#define _EXYNOS_MIPI_DSI_COMMON_H
+
+int exynos_mipi_dsi_wr_data(struct mipi_dsim_device *dsim, unsigned int data_id,
+       unsigned int data0, unsigned int data1);
+int exynos_mipi_dsi_pll_on(struct mipi_dsim_device *dsim, unsigned int enable);
+unsigned long exynos_mipi_dsi_change_pll(struct mipi_dsim_device *dsim,
+       unsigned int pre_divider, unsigned int main_divider,
+       unsigned int scaler);
+int exynos_mipi_dsi_set_clock(struct mipi_dsim_device *dsim,
+       unsigned int byte_clk_sel, unsigned int enable);
+int exynos_mipi_dsi_init_dsim(struct mipi_dsim_device *dsim);
+int exynos_mipi_dsi_set_display_mode(struct mipi_dsim_device *dsim,
+                       struct mipi_dsim_config *dsim_info);
+int exynos_mipi_dsi_init_link(struct mipi_dsim_device *dsim);
+int exynos_mipi_dsi_set_hs_enable(struct mipi_dsim_device *dsim);
+int exynos_mipi_dsi_set_data_transfer_mode(struct mipi_dsim_device *dsim,
+               unsigned int mode);
+int exynos_mipi_dsi_enable_frame_done_int(struct mipi_dsim_device *dsim,
+       unsigned int enable);
+int exynos_mipi_dsi_get_frame_done_status(struct mipi_dsim_device *dsim);
+int exynos_mipi_dsi_clear_frame_done(struct mipi_dsim_device *dsim);
+
+#endif /* _EXYNOS_MIPI_DSI_COMMON_H */
diff --git a/drivers/video/exynos_mipi_dsi_lowlevel.c b/drivers/video/exynos_mipi_dsi_lowlevel.c
new file mode 100644 (file)
index 0000000..d61b773
--- /dev/null
@@ -0,0 +1,652 @@
+/*
+ * Copyright (C) 2012 Samsung Electronics
+ *
+ * Author: InKi Dae <inki.dae@samsung.com>
+ * Author: Donghwa Lee <dh09.lee@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 <asm/arch/dsim.h>
+#include <asm/arch/mipi_dsim.h>
+#include <asm/arch/power.h>
+#include <asm/arch/cpu.h>
+
+#include "exynos_mipi_dsi_lowlevel.h"
+#include "exynos_mipi_dsi_common.h"
+
+void exynos_mipi_dsi_func_reset(struct mipi_dsim_device *dsim)
+{
+       unsigned int reg;
+
+       struct exynos_mipi_dsim *mipi_dsim =
+               (struct exynos_mipi_dsim *)samsung_get_base_mipi_dsim();
+
+       reg = readl(&mipi_dsim->swrst);
+
+       reg |= DSIM_FUNCRST;
+
+       writel(reg, &mipi_dsim->swrst);
+}
+
+void exynos_mipi_dsi_sw_reset(struct mipi_dsim_device *dsim)
+{
+       unsigned int reg = 0;
+
+       struct exynos_mipi_dsim *mipi_dsim =
+               (struct exynos_mipi_dsim *)samsung_get_base_mipi_dsim();
+
+       reg = readl(&mipi_dsim->swrst);
+
+       reg |= DSIM_SWRST;
+       reg |= DSIM_FUNCRST;
+
+       writel(reg, &mipi_dsim->swrst);
+}
+
+void exynos_mipi_dsi_sw_release(struct mipi_dsim_device *dsim)
+{
+       struct exynos_mipi_dsim *mipi_dsim =
+               (struct exynos_mipi_dsim *)samsung_get_base_mipi_dsim();
+       unsigned int reg = readl(&mipi_dsim->intsrc);
+
+       reg |= INTSRC_SWRST_RELEASE;
+
+       writel(reg, &mipi_dsim->intsrc);
+}
+
+void exynos_mipi_dsi_set_interrupt_mask(struct mipi_dsim_device *dsim,
+               unsigned int mode, unsigned int mask)
+{
+       struct exynos_mipi_dsim *mipi_dsim =
+               (struct exynos_mipi_dsim *)samsung_get_base_mipi_dsim();
+       unsigned int reg = readl(&mipi_dsim->intmsk);
+
+       if (mask)
+               reg |= mode;
+       else
+               reg &= ~mode;
+
+       writel(reg, &mipi_dsim->intmsk);
+}
+
+void exynos_mipi_dsi_init_fifo_pointer(struct mipi_dsim_device *dsim,
+               unsigned int cfg)
+{
+       unsigned int reg;
+       struct exynos_mipi_dsim *mipi_dsim =
+               (struct exynos_mipi_dsim *)samsung_get_base_mipi_dsim();
+
+       reg = readl(&mipi_dsim->fifoctrl);
+
+       writel(reg & ~(cfg), &mipi_dsim->fifoctrl);
+       udelay(10 * 1000);
+       reg |= cfg;
+
+       writel(reg, &mipi_dsim->fifoctrl);
+}
+
+/*
+ * this function set PLL P, M and S value in D-PHY
+ */
+void exynos_mipi_dsi_set_phy_tunning(struct mipi_dsim_device *dsim,
+               unsigned int value)
+{
+       struct exynos_mipi_dsim *mipi_dsim =
+               (struct exynos_mipi_dsim *)samsung_get_base_mipi_dsim();
+
+       writel(DSIM_AFC_CTL(value), &mipi_dsim->phyacchr);
+}
+
+void exynos_mipi_dsi_set_main_disp_resol(struct mipi_dsim_device *dsim,
+       unsigned int width_resol, unsigned int height_resol)
+{
+       unsigned int reg;
+       struct exynos_mipi_dsim *mipi_dsim =
+               (struct exynos_mipi_dsim *)samsung_get_base_mipi_dsim();
+
+       /* standby should be set after configuration so set to not ready*/
+       reg = (readl(&mipi_dsim->mdresol)) & ~(DSIM_MAIN_STAND_BY);
+       writel(reg, &mipi_dsim->mdresol);
+
+       /* reset resolution */
+       reg &= ~(DSIM_MAIN_VRESOL(0x7ff) | DSIM_MAIN_HRESOL(0x7ff));
+       reg |= DSIM_MAIN_VRESOL(height_resol) | DSIM_MAIN_HRESOL(width_resol);
+
+       reg |= DSIM_MAIN_STAND_BY;
+       writel(reg, &mipi_dsim->mdresol);
+}
+
+void exynos_mipi_dsi_set_main_disp_vporch(struct mipi_dsim_device *dsim,
+       unsigned int cmd_allow, unsigned int vfront, unsigned int vback)
+{
+       unsigned int reg;
+       struct exynos_mipi_dsim *mipi_dsim =
+               (struct exynos_mipi_dsim *)samsung_get_base_mipi_dsim();
+
+       reg = (readl(&mipi_dsim->mvporch)) &
+               ~((DSIM_CMD_ALLOW_MASK) | (DSIM_STABLE_VFP_MASK) |
+               (DSIM_MAIN_VBP_MASK));
+
+       reg |= ((cmd_allow & 0xf) << DSIM_CMD_ALLOW_SHIFT) |
+               ((vfront & 0x7ff) << DSIM_STABLE_VFP_SHIFT) |
+               ((vback & 0x7ff) << DSIM_MAIN_VBP_SHIFT);
+
+       writel(reg, &mipi_dsim->mvporch);
+}
+
+void exynos_mipi_dsi_set_main_disp_hporch(struct mipi_dsim_device *dsim,
+       unsigned int front, unsigned int back)
+{
+       unsigned int reg;
+       struct exynos_mipi_dsim *mipi_dsim =
+               (struct exynos_mipi_dsim *)samsung_get_base_mipi_dsim();
+
+       reg = (readl(&mipi_dsim->mhporch)) &
+               ~((DSIM_MAIN_HFP_MASK) | (DSIM_MAIN_HBP_MASK));
+
+       reg |= (front << DSIM_MAIN_HFP_SHIFT) | (back << DSIM_MAIN_HBP_SHIFT);
+
+       writel(reg, &mipi_dsim->mhporch);
+}
+
+void exynos_mipi_dsi_set_main_disp_sync_area(struct mipi_dsim_device *dsim,
+       unsigned int vert, unsigned int hori)
+{
+       unsigned int reg;
+       struct exynos_mipi_dsim *mipi_dsim =
+               (struct exynos_mipi_dsim *)samsung_get_base_mipi_dsim();
+
+       reg = (readl(&mipi_dsim->msync)) &
+               ~((DSIM_MAIN_VSA_MASK) | (DSIM_MAIN_HSA_MASK));
+
+       reg |= ((vert & 0x3ff) << DSIM_MAIN_VSA_SHIFT) |
+               (hori << DSIM_MAIN_HSA_SHIFT);
+
+       writel(reg, &mipi_dsim->msync);
+}
+
+void exynos_mipi_dsi_set_sub_disp_resol(struct mipi_dsim_device *dsim,
+       unsigned int vert, unsigned int hori)
+{
+       unsigned int reg;
+       struct exynos_mipi_dsim *mipi_dsim =
+               (struct exynos_mipi_dsim *)samsung_get_base_mipi_dsim();
+
+       reg = (readl(&mipi_dsim->sdresol)) &
+               ~(DSIM_SUB_STANDY_MASK);
+
+       writel(reg, &mipi_dsim->sdresol);
+
+       reg &= ~(DSIM_SUB_VRESOL_MASK) | ~(DSIM_SUB_HRESOL_MASK);
+       reg |= ((vert & 0x7ff) << DSIM_SUB_VRESOL_SHIFT) |
+               ((hori & 0x7ff) << DSIM_SUB_HRESOL_SHIFT);
+       writel(reg, &mipi_dsim->sdresol);
+
+       /* DSIM STANDBY */
+       reg |= (1 << DSIM_SUB_STANDY_SHIFT);
+       writel(reg, &mipi_dsim->sdresol);
+}
+
+void exynos_mipi_dsi_init_config(struct mipi_dsim_device *dsim)
+{
+       struct mipi_dsim_config *dsim_config = dsim->dsim_config;
+       struct exynos_mipi_dsim *mipi_dsim =
+               (struct exynos_mipi_dsim *)samsung_get_base_mipi_dsim();
+       unsigned int cfg = (readl(&mipi_dsim->config)) &
+               ~((1 << DSIM_EOT_PACKET_SHIFT) |
+               (0x1f << DSIM_HSA_MODE_SHIFT) |
+               (0x3 << DSIM_NUM_OF_DATALANE_SHIFT));
+
+       cfg |=  (dsim_config->auto_flush << DSIM_AUTO_FLUSH_SHIFT) |
+               (dsim_config->eot_disable << DSIM_EOT_PACKET_SHIFT) |
+               (dsim_config->auto_vertical_cnt << DSIM_AUTO_MODE_SHIFT) |
+               (dsim_config->hse << DSIM_HSE_MODE_SHIFT) |
+               (dsim_config->hfp << DSIM_HFP_MODE_SHIFT) |
+               (dsim_config->hbp << DSIM_HBP_MODE_SHIFT) |
+               (dsim_config->hsa << DSIM_HSA_MODE_SHIFT) |
+               (dsim_config->e_no_data_lane << DSIM_NUM_OF_DATALANE_SHIFT);
+
+       writel(cfg, &mipi_dsim->config);
+}
+
+void exynos_mipi_dsi_display_config(struct mipi_dsim_device *dsim,
+                               struct mipi_dsim_config *dsim_config)
+{
+       struct exynos_mipi_dsim *mipi_dsim =
+               (struct exynos_mipi_dsim *)samsung_get_base_mipi_dsim();
+
+       u32 reg = (readl(&mipi_dsim->config)) &
+               ~((0x3 << DSIM_BURST_MODE_SHIFT) | (1 << DSIM_VIDEO_MODE_SHIFT)
+               | (0x3 << DSIM_MAINVC_SHIFT) | (0x7 << DSIM_MAINPIX_SHIFT)
+               | (0x3 << DSIM_SUBVC_SHIFT) | (0x7 << DSIM_SUBPIX_SHIFT));
+
+       if (dsim_config->e_interface == DSIM_VIDEO)
+               reg |= (1 << DSIM_VIDEO_MODE_SHIFT);
+       else if (dsim_config->e_interface == DSIM_COMMAND)
+               reg &= ~(1 << DSIM_VIDEO_MODE_SHIFT);
+       else {
+               printf("unknown lcd type.\n");
+               return;
+       }
+
+       /* main lcd */
+       reg |= ((u8) (dsim_config->e_burst_mode) & 0x3) << DSIM_BURST_MODE_SHIFT
+       | ((u8) (dsim_config->e_virtual_ch) & 0x3) << DSIM_MAINVC_SHIFT
+       | ((u8) (dsim_config->e_pixel_format) & 0x7) << DSIM_MAINPIX_SHIFT;
+
+       writel(reg, &mipi_dsim->config);
+}
+
+void exynos_mipi_dsi_enable_lane(struct mipi_dsim_device *dsim,
+                       unsigned int lane, unsigned int enable)
+{
+       unsigned int reg;
+       struct exynos_mipi_dsim *mipi_dsim =
+               (struct exynos_mipi_dsim *)samsung_get_base_mipi_dsim();
+
+       reg = readl(&mipi_dsim->config);
+
+       if (enable)
+               reg |= DSIM_LANE_ENx(lane);
+       else
+               reg &= ~DSIM_LANE_ENx(lane);
+
+       writel(reg, &mipi_dsim->config);
+}
+
+void exynos_mipi_dsi_set_data_lane_number(struct mipi_dsim_device *dsim,
+       unsigned int count)
+{
+       unsigned int cfg;
+       struct exynos_mipi_dsim *mipi_dsim =
+               (struct exynos_mipi_dsim *)samsung_get_base_mipi_dsim();
+
+       /* get the data lane number. */
+       cfg = DSIM_NUM_OF_DATA_LANE(count);
+
+       writel(cfg, &mipi_dsim->config);
+}
+
+void exynos_mipi_dsi_enable_afc(struct mipi_dsim_device *dsim,
+                       unsigned int enable, unsigned int afc_code)
+{
+       struct exynos_mipi_dsim *mipi_dsim =
+               (struct exynos_mipi_dsim *)samsung_get_base_mipi_dsim();
+       unsigned int reg = readl(&mipi_dsim->phyacchr);
+
+       reg = 0;
+
+       if (enable) {
+               reg |= DSIM_AFC_EN;
+               reg &= ~(0x7 << DSIM_AFC_CTL_SHIFT);
+               reg |= DSIM_AFC_CTL(afc_code);
+       } else
+               reg &= ~DSIM_AFC_EN;
+
+       writel(reg, &mipi_dsim->phyacchr);
+}
+
+void exynos_mipi_dsi_enable_pll_bypass(struct mipi_dsim_device *dsim,
+       unsigned int enable)
+{
+       struct exynos_mipi_dsim *mipi_dsim =
+               (struct exynos_mipi_dsim *)samsung_get_base_mipi_dsim();
+       unsigned int reg = (readl(&mipi_dsim->clkctrl)) &
+               ~(DSIM_PLL_BYPASS_EXTERNAL);
+
+       reg |= enable << DSIM_PLL_BYPASS_SHIFT;
+
+       writel(reg, &mipi_dsim->clkctrl);
+}
+
+void exynos_mipi_dsi_pll_freq_band(struct mipi_dsim_device *dsim,
+               unsigned int freq_band)
+{
+       struct exynos_mipi_dsim *mipi_dsim =
+               (struct exynos_mipi_dsim *)samsung_get_base_mipi_dsim();
+       unsigned int reg = (readl(&mipi_dsim->pllctrl)) &
+               ~(0x1f << DSIM_FREQ_BAND_SHIFT);
+
+       reg |= ((freq_band & 0x1f) << DSIM_FREQ_BAND_SHIFT);
+
+       writel(reg, &mipi_dsim->pllctrl);
+}
+
+void exynos_mipi_dsi_pll_freq(struct mipi_dsim_device *dsim,
+               unsigned int pre_divider, unsigned int main_divider,
+               unsigned int scaler)
+{
+       struct exynos_mipi_dsim *mipi_dsim =
+               (struct exynos_mipi_dsim *)samsung_get_base_mipi_dsim();
+       unsigned int reg = (readl(&mipi_dsim->pllctrl)) &
+               ~(0x7ffff << 1);
+
+       reg |= ((pre_divider & 0x3f) << DSIM_PREDIV_SHIFT) |
+               ((main_divider & 0x1ff) << DSIM_MAIN_SHIFT) |
+               ((scaler & 0x7) << DSIM_SCALER_SHIFT);
+
+       writel(reg, &mipi_dsim->pllctrl);
+}
+
+void exynos_mipi_dsi_pll_stable_time(struct mipi_dsim_device *dsim,
+       unsigned int lock_time)
+{
+       struct exynos_mipi_dsim *mipi_dsim =
+               (struct exynos_mipi_dsim *)samsung_get_base_mipi_dsim();
+
+       writel(lock_time, &mipi_dsim->plltmr);
+}
+
+void exynos_mipi_dsi_enable_pll(struct mipi_dsim_device *dsim,
+                               unsigned int enable)
+{
+       struct exynos_mipi_dsim *mipi_dsim =
+               (struct exynos_mipi_dsim *)samsung_get_base_mipi_dsim();
+       unsigned int reg = (readl(&mipi_dsim->pllctrl)) &
+               ~(0x1 << DSIM_PLL_EN_SHIFT);
+
+       reg |= ((enable & 0x1) << DSIM_PLL_EN_SHIFT);
+
+       writel(reg, &mipi_dsim->pllctrl);
+}
+
+void exynos_mipi_dsi_set_byte_clock_src(struct mipi_dsim_device *dsim,
+               unsigned int src)
+{
+       struct exynos_mipi_dsim *mipi_dsim =
+               (struct exynos_mipi_dsim *)samsung_get_base_mipi_dsim();
+       unsigned int reg = (readl(&mipi_dsim->clkctrl)) &
+               ~(0x3 << DSIM_BYTE_CLK_SRC_SHIFT);
+
+       reg |= ((unsigned int) src) << DSIM_BYTE_CLK_SRC_SHIFT;
+
+       writel(reg, &mipi_dsim->clkctrl);
+}
+
+void exynos_mipi_dsi_enable_byte_clock(struct mipi_dsim_device *dsim,
+               unsigned int enable)
+{
+       struct exynos_mipi_dsim *mipi_dsim =
+               (struct exynos_mipi_dsim *)samsung_get_base_mipi_dsim();
+       unsigned int reg = (readl(&mipi_dsim->clkctrl)) &
+               ~(1 << DSIM_BYTE_CLKEN_SHIFT);
+
+       reg |= enable << DSIM_BYTE_CLKEN_SHIFT;
+
+       writel(reg, &mipi_dsim->clkctrl);
+}
+
+void exynos_mipi_dsi_set_esc_clk_prs(struct mipi_dsim_device *dsim,
+               unsigned int enable, unsigned int prs_val)
+{
+       struct exynos_mipi_dsim *mipi_dsim =
+               (struct exynos_mipi_dsim *)samsung_get_base_mipi_dsim();
+       unsigned int reg = (readl(&mipi_dsim->clkctrl)) &
+               ~((1 << DSIM_ESC_CLKEN_SHIFT) | (0xffff));
+
+       reg |= enable << DSIM_ESC_CLKEN_SHIFT;
+       if (enable)
+               reg |= prs_val;
+
+       writel(reg, &mipi_dsim->clkctrl);
+}
+
+void exynos_mipi_dsi_enable_esc_clk_on_lane(struct mipi_dsim_device *dsim,
+               unsigned int lane_sel, unsigned int enable)
+{
+       struct exynos_mipi_dsim *mipi_dsim =
+               (struct exynos_mipi_dsim *)samsung_get_base_mipi_dsim();
+       unsigned int reg = readl(&mipi_dsim->clkctrl);
+
+       if (enable)
+               reg |= DSIM_LANE_ESC_CLKEN(lane_sel);
+       else
+               reg &= ~DSIM_LANE_ESC_CLKEN(lane_sel);
+
+       writel(reg, &mipi_dsim->clkctrl);
+}
+
+void exynos_mipi_dsi_force_dphy_stop_state(struct mipi_dsim_device *dsim,
+       unsigned int enable)
+{
+       struct exynos_mipi_dsim *mipi_dsim =
+               (struct exynos_mipi_dsim *)samsung_get_base_mipi_dsim();
+       unsigned int reg = (readl(&mipi_dsim->escmode)) &
+               ~(0x1 << DSIM_FORCE_STOP_STATE_SHIFT);
+
+       reg |= ((enable & 0x1) << DSIM_FORCE_STOP_STATE_SHIFT);
+
+       writel(reg, &mipi_dsim->escmode);
+}
+
+unsigned int exynos_mipi_dsi_is_lane_state(struct mipi_dsim_device *dsim)
+{
+       struct exynos_mipi_dsim *mipi_dsim =
+               (struct exynos_mipi_dsim *)samsung_get_base_mipi_dsim();
+       unsigned int reg = readl(&mipi_dsim->status);
+
+       /**
+        * check clock and data lane states.
+        * if MIPI-DSI controller was enabled at bootloader then
+        * TX_READY_HS_CLK is enabled otherwise STOP_STATE_CLK.
+        * so it should be checked for two case.
+        */
+       if ((reg & DSIM_STOP_STATE_DAT(0xf)) &&
+                       ((reg & DSIM_STOP_STATE_CLK) ||
+                        (reg & DSIM_TX_READY_HS_CLK)))
+               return 1;
+       else
+               return 0;
+}
+
+void exynos_mipi_dsi_set_stop_state_counter(struct mipi_dsim_device *dsim,
+               unsigned int cnt_val)
+{
+       struct exynos_mipi_dsim *mipi_dsim =
+               (struct exynos_mipi_dsim *)samsung_get_base_mipi_dsim();
+       unsigned int reg = (readl(&mipi_dsim->escmode)) &
+               ~(0x7ff << DSIM_STOP_STATE_CNT_SHIFT);
+
+       reg |= ((cnt_val & 0x7ff) << DSIM_STOP_STATE_CNT_SHIFT);
+
+       writel(reg, &mipi_dsim->escmode);
+}
+
+void exynos_mipi_dsi_set_bta_timeout(struct mipi_dsim_device *dsim,
+               unsigned int timeout)
+{
+       struct exynos_mipi_dsim *mipi_dsim =
+               (struct exynos_mipi_dsim *)samsung_get_base_mipi_dsim();
+       unsigned int reg = (readl(&mipi_dsim->timeout)) &
+               ~(0xff << DSIM_BTA_TOUT_SHIFT);
+
+       reg |= (timeout << DSIM_BTA_TOUT_SHIFT);
+
+       writel(reg, &mipi_dsim->timeout);
+}
+
+void exynos_mipi_dsi_set_lpdr_timeout(struct mipi_dsim_device *dsim,
+               unsigned int timeout)
+{
+       struct exynos_mipi_dsim *mipi_dsim =
+               (struct exynos_mipi_dsim *)samsung_get_base_mipi_dsim();
+       unsigned int reg = (readl(&mipi_dsim->timeout)) &
+               ~(0xffff << DSIM_LPDR_TOUT_SHIFT);
+
+       reg |= (timeout << DSIM_LPDR_TOUT_SHIFT);
+
+       writel(reg, &mipi_dsim->timeout);
+}
+
+void exynos_mipi_dsi_set_cpu_transfer_mode(struct mipi_dsim_device *dsim,
+               unsigned int lp)
+{
+       struct exynos_mipi_dsim *mipi_dsim =
+               (struct exynos_mipi_dsim *)samsung_get_base_mipi_dsim();
+       unsigned int reg = readl(&mipi_dsim->escmode);
+
+       reg &= ~DSIM_CMD_LPDT_LP;
+
+       if (lp)
+               reg |= DSIM_CMD_LPDT_LP;
+
+       writel(reg, &mipi_dsim->escmode);
+}
+
+void exynos_mipi_dsi_set_lcdc_transfer_mode(struct mipi_dsim_device *dsim,
+               unsigned int lp)
+{
+       struct exynos_mipi_dsim *mipi_dsim =
+               (struct exynos_mipi_dsim *)samsung_get_base_mipi_dsim();
+       unsigned int reg = readl(&mipi_dsim->escmode);
+
+       reg &= ~DSIM_TX_LPDT_LP;
+
+       if (lp)
+               reg |= DSIM_TX_LPDT_LP;
+
+       writel(reg, &mipi_dsim->escmode);
+}
+
+void exynos_mipi_dsi_enable_hs_clock(struct mipi_dsim_device *dsim,
+               unsigned int enable)
+{
+       struct exynos_mipi_dsim *mipi_dsim =
+               (struct exynos_mipi_dsim *)samsung_get_base_mipi_dsim();
+       unsigned int reg = (readl(&mipi_dsim->clkctrl)) &
+               ~(1 << DSIM_TX_REQUEST_HSCLK_SHIFT);
+
+       reg |= enable << DSIM_TX_REQUEST_HSCLK_SHIFT;
+
+       writel(reg, &mipi_dsim->clkctrl);
+}
+
+void exynos_mipi_dsi_dp_dn_swap(struct mipi_dsim_device *dsim,
+               unsigned int swap_en)
+{
+       struct exynos_mipi_dsim *mipi_dsim =
+               (struct exynos_mipi_dsim *)samsung_get_base_mipi_dsim();
+       unsigned int reg = readl(&mipi_dsim->phyacchr1);
+
+       reg &= ~(0x3 << DSIM_DPDN_SWAP_DATA_SHIFT);
+       reg |= (swap_en & 0x3) << DSIM_DPDN_SWAP_DATA_SHIFT;
+
+       writel(reg, &mipi_dsim->phyacchr1);
+}
+
+void exynos_mipi_dsi_hs_zero_ctrl(struct mipi_dsim_device *dsim,
+               unsigned int hs_zero)
+{
+       struct exynos_mipi_dsim *mipi_dsim =
+               (struct exynos_mipi_dsim *)samsung_get_base_mipi_dsim();
+       unsigned int reg = (readl(&mipi_dsim->pllctrl)) &
+               ~(0xf << DSIM_ZEROCTRL_SHIFT);
+
+       reg |= ((hs_zero & 0xf) << DSIM_ZEROCTRL_SHIFT);
+
+       writel(reg, &mipi_dsim->pllctrl);
+}
+
+void exynos_mipi_dsi_prep_ctrl(struct mipi_dsim_device *dsim, unsigned int prep)
+{
+       struct exynos_mipi_dsim *mipi_dsim =
+               (struct exynos_mipi_dsim *)samsung_get_base_mipi_dsim();
+       unsigned int reg = (readl(&mipi_dsim->pllctrl)) &
+               ~(0x7 << DSIM_PRECTRL_SHIFT);
+
+       reg |= ((prep & 0x7) << DSIM_PRECTRL_SHIFT);
+
+       writel(reg, &mipi_dsim->pllctrl);
+}
+
+void exynos_mipi_dsi_clear_interrupt(struct mipi_dsim_device *dsim)
+{
+       struct exynos_mipi_dsim *mipi_dsim =
+               (struct exynos_mipi_dsim *)samsung_get_base_mipi_dsim();
+       unsigned int reg = readl(&mipi_dsim->intsrc);
+
+       reg |= INTSRC_PLL_STABLE;
+
+       writel(reg, &mipi_dsim->intsrc);
+}
+
+void exynos_mipi_dsi_clear_all_interrupt(struct mipi_dsim_device *dsim)
+{
+       struct exynos_mipi_dsim *mipi_dsim =
+               (struct exynos_mipi_dsim *)samsung_get_base_mipi_dsim();
+
+       writel(0xffffffff, &mipi_dsim->intsrc);
+}
+
+unsigned int exynos_mipi_dsi_is_pll_stable(struct mipi_dsim_device *dsim)
+{
+       unsigned int reg;
+       struct exynos_mipi_dsim *mipi_dsim =
+               (struct exynos_mipi_dsim *)samsung_get_base_mipi_dsim();
+
+       reg = readl(&mipi_dsim->status);
+
+       return reg & DSIM_PLL_STABLE ? 1 : 0;
+}
+
+unsigned int exynos_mipi_dsi_get_fifo_state(struct mipi_dsim_device *dsim)
+{
+       struct exynos_mipi_dsim *mipi_dsim =
+               (struct exynos_mipi_dsim *)samsung_get_base_mipi_dsim();
+
+       return readl(&mipi_dsim->fifoctrl) & ~(0x1f);
+}
+
+void exynos_mipi_dsi_wr_tx_header(struct mipi_dsim_device *dsim,
+       unsigned int di, unsigned int data0, unsigned int data1)
+{
+       struct exynos_mipi_dsim *mipi_dsim =
+               (struct exynos_mipi_dsim *)samsung_get_base_mipi_dsim();
+       unsigned int reg = (DSIM_PKTHDR_DAT1(data1) | DSIM_PKTHDR_DAT0(data0) |
+                       DSIM_PKTHDR_DI(di));
+
+       writel(reg, &mipi_dsim->pkthdr);
+}
+
+unsigned int _exynos_mipi_dsi_get_frame_done_status(struct mipi_dsim_device
+                                               *dsim)
+{
+       struct exynos_mipi_dsim *mipi_dsim =
+               (struct exynos_mipi_dsim *)samsung_get_base_mipi_dsim();
+       unsigned int reg = readl(&mipi_dsim->intsrc);
+
+       return (reg & INTSRC_FRAME_DONE) ? 1 : 0;
+}
+
+void _exynos_mipi_dsi_clear_frame_done(struct mipi_dsim_device *dsim)
+{
+       struct exynos_mipi_dsim *mipi_dsim =
+               (struct exynos_mipi_dsim *)samsung_get_base_mipi_dsim();
+       unsigned int reg = readl(&mipi_dsim->intsrc);
+
+       writel(reg | INTSRC_FRAME_DONE, &mipi_dsim->intsrc);
+}
+
+void exynos_mipi_dsi_wr_tx_data(struct mipi_dsim_device *dsim,
+               unsigned int tx_data)
+{
+       struct exynos_mipi_dsim *mipi_dsim =
+               (struct exynos_mipi_dsim *)samsung_get_base_mipi_dsim();
+
+       writel(tx_data, &mipi_dsim->payload);
+}
diff --git a/drivers/video/exynos_mipi_dsi_lowlevel.h b/drivers/video/exynos_mipi_dsi_lowlevel.h
new file mode 100644 (file)
index 0000000..4b8c441
--- /dev/null
@@ -0,0 +1,111 @@
+/*
+ * Copyright (C) 2012 Samsung Electronics
+ *
+ * Author: InKi Dae <inki.dae@samsung.com>
+ * Author: Donghwa Lee <dh09.lee@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 _EXYNOS_MIPI_DSI_LOWLEVEL_H
+#define _EXYNOS_MIPI_DSI_LOWLEVEL_H
+
+void exynos_mipi_dsi_register(struct mipi_dsim_device *dsim);
+void exynos_mipi_dsi_func_reset(struct mipi_dsim_device *dsim);
+void exynos_mipi_dsi_sw_reset(struct mipi_dsim_device *dsim);
+void exynos_mipi_dsi_sw_release(struct mipi_dsim_device *dsim);
+void exynos_mipi_dsi_set_interrupt_mask(struct mipi_dsim_device *dsim,
+       unsigned int mode, unsigned int mask);
+void exynos_mipi_dsi_set_data_lane_number(struct mipi_dsim_device *dsim,
+                                       unsigned int count);
+void exynos_mipi_dsi_init_fifo_pointer(struct mipi_dsim_device *dsim,
+                                       unsigned int cfg);
+void exynos_mipi_dsi_set_phy_tunning(struct mipi_dsim_device *dsim,
+                               unsigned int value);
+void exynos_mipi_dsi_set_phy_tunning(struct mipi_dsim_device *dsim,
+                               unsigned int value);
+void exynos_mipi_dsi_set_main_disp_resol(struct mipi_dsim_device *dsim,
+               unsigned int width_resol, unsigned int height_resol);
+void exynos_mipi_dsi_set_main_disp_vporch(struct mipi_dsim_device *dsim,
+       unsigned int cmd_allow, unsigned int vfront, unsigned int vback);
+void exynos_mipi_dsi_set_main_disp_hporch(struct mipi_dsim_device *dsim,
+                       unsigned int front, unsigned int back);
+void exynos_mipi_dsi_set_main_disp_sync_area(struct mipi_dsim_device *dsim,
+                               unsigned int vert, unsigned int hori);
+void exynos_mipi_dsi_set_sub_disp_resol(struct mipi_dsim_device *dsim,
+                               unsigned int vert, unsigned int hori);
+void exynos_mipi_dsi_init_config(struct mipi_dsim_device *dsim);
+void exynos_mipi_dsi_display_config(struct mipi_dsim_device *dsim,
+                               struct mipi_dsim_config *dsim_config);
+void exynos_mipi_dsi_set_data_lane_number(struct mipi_dsim_device *dsim,
+                               unsigned int count);
+void exynos_mipi_dsi_enable_lane(struct mipi_dsim_device *dsim,
+                       unsigned int lane, unsigned int enable);
+void exynos_mipi_dsi_enable_afc(struct mipi_dsim_device *dsim,
+                       unsigned int enable, unsigned int afc_code);
+void exynos_mipi_dsi_enable_pll_bypass(struct mipi_dsim_device *dsim,
+                               unsigned int enable);
+void exynos_mipi_dsi_pll_freq_band(struct mipi_dsim_device *dsim,
+                               unsigned int freq_band);
+void exynos_mipi_dsi_pll_freq(struct mipi_dsim_device *dsim,
+                       unsigned int pre_divider, unsigned int main_divider,
+                       unsigned int scaler);
+void exynos_mipi_dsi_pll_stable_time(struct mipi_dsim_device *dsim,
+                       unsigned int lock_time);
+void exynos_mipi_dsi_enable_pll(struct mipi_dsim_device *dsim,
+                                       unsigned int enable);
+void exynos_mipi_dsi_set_byte_clock_src(struct mipi_dsim_device *dsim,
+                                       unsigned int src);
+void exynos_mipi_dsi_enable_byte_clock(struct mipi_dsim_device *dsim,
+                                       unsigned int enable);
+void exynos_mipi_dsi_set_esc_clk_prs(struct mipi_dsim_device *dsim,
+                               unsigned int enable, unsigned int prs_val);
+void exynos_mipi_dsi_enable_esc_clk_on_lane(struct mipi_dsim_device *dsim,
+                               unsigned int lane_sel, unsigned int enable);
+void exynos_mipi_dsi_force_dphy_stop_state(struct mipi_dsim_device *dsim,
+                               unsigned int enable);
+unsigned int exynos_mipi_dsi_is_lane_state(struct mipi_dsim_device *dsim);
+void exynos_mipi_dsi_set_stop_state_counter(struct mipi_dsim_device *dsim,
+                               unsigned int cnt_val);
+void exynos_mipi_dsi_set_bta_timeout(struct mipi_dsim_device *dsim,
+                               unsigned int timeout);
+void exynos_mipi_dsi_set_lpdr_timeout(struct mipi_dsim_device *dsim,
+                               unsigned int timeout);
+void exynos_mipi_dsi_set_lcdc_transfer_mode(struct mipi_dsim_device *dsim,
+                                       unsigned int lp);
+void exynos_mipi_dsi_set_cpu_transfer_mode(struct mipi_dsim_device *dsim,
+                                       unsigned int lp);
+void exynos_mipi_dsi_enable_hs_clock(struct mipi_dsim_device *dsim,
+                               unsigned int enable);
+void exynos_mipi_dsi_dp_dn_swap(struct mipi_dsim_device *dsim,
+                               unsigned int swap_en);
+void exynos_mipi_dsi_hs_zero_ctrl(struct mipi_dsim_device *dsim,
+                               unsigned int hs_zero);
+void exynos_mipi_dsi_prep_ctrl(struct mipi_dsim_device *dsim,
+                               unsigned int prep);
+void exynos_mipi_dsi_clear_interrupt(struct mipi_dsim_device *dsim);
+void exynos_mipi_dsi_clear_all_interrupt(struct mipi_dsim_device *dsim);
+unsigned int exynos_mipi_dsi_is_pll_stable(struct mipi_dsim_device *dsim);
+unsigned int exynos_mipi_dsi_get_fifo_state(struct mipi_dsim_device *dsim);
+unsigned int _exynos_mipi_dsi_get_frame_done_status(struct mipi_dsim_device
+                                               *dsim);
+void _exynos_mipi_dsi_clear_frame_done(struct mipi_dsim_device *dsim);
+void exynos_mipi_dsi_wr_tx_header(struct mipi_dsim_device *dsim,
+               unsigned int di, unsigned int data0, unsigned int data1);
+void exynos_mipi_dsi_wr_tx_data(struct mipi_dsim_device *dsim,
+               unsigned int tx_data);
+
+#endif /* _EXYNOS_MIPI_DSI_LOWLEVEL_H */
index 9d20c864bac8adc70cd1acb1dcf2538d71bcaebd..38c9a929aa74d257d9abbe9af31b6a579266cf74 100644 (file)
@@ -207,13 +207,16 @@ static void clk_ipu_disable(struct clk *clk)
 
 static struct clk ipu_clk = {
        .name = "ipu_clk",
+#if defined(CONFIG_MX51)
        .rate = 133000000,
+#elif defined(CONFIG_MX53)
+       .rate = 216000000,
+#endif
        .enable_reg = (u32 *)(MXC_CCM_BASE +
                offsetof(struct mxc_ccm_reg, CCGR5)),
        .enable_shift = MXC_CCM_CCGR5_CG5_OFFSET,
        .enable = clk_ipu_enable,
        .disable = clk_ipu_disable,
-       .usecount = 0,
 };
 
 /* Globals */
@@ -287,7 +290,7 @@ static unsigned long ipu_pixel_clk_round_rate(struct clk *clk,
         * Fractional part is 4 bits,
         * so simply multiply by 2^4 to get fractional part.
         */
-       tmp = (clk->parent->rate * 16);
+       tmp = clk->parent->rate * 16;
        div = tmp / rate;
 
        if (div < 0x10)            /* Min DI disp clock divider is 1 */
@@ -331,7 +334,6 @@ static void ipu_pixel_clk_disable(struct clk *clk)
        u32 disp_gen = __raw_readl(IPU_DISP_GEN);
        disp_gen &= clk->id ? ~DI1_COUNTER_RELEASE : ~DI0_COUNTER_RELEASE;
        __raw_writel(disp_gen, IPU_DISP_GEN);
-
 }
 
 static int ipu_pixel_clk_set_parent(struct clk *clk, struct clk *parent)
@@ -352,26 +354,24 @@ static int ipu_pixel_clk_set_parent(struct clk *clk, struct clk *parent)
 
 static struct clk pixel_clk[] = {
        {
-       .name = "pixel_clk",
-       .id = 0,
-       .recalc = ipu_pixel_clk_recalc,
-       .set_rate = ipu_pixel_clk_set_rate,
-       .round_rate = ipu_pixel_clk_round_rate,
-       .set_parent = ipu_pixel_clk_set_parent,
-       .enable = ipu_pixel_clk_enable,
-       .disable = ipu_pixel_clk_disable,
-       .usecount = 0,
+               .name = "pixel_clk",
+               .id = 0,
+               .recalc = ipu_pixel_clk_recalc,
+               .set_rate = ipu_pixel_clk_set_rate,
+               .round_rate = ipu_pixel_clk_round_rate,
+               .set_parent = ipu_pixel_clk_set_parent,
+               .enable = ipu_pixel_clk_enable,
+               .disable = ipu_pixel_clk_disable,
        },
        {
-       .name = "pixel_clk",
-       .id = 1,
-       .recalc = ipu_pixel_clk_recalc,
-       .set_rate = ipu_pixel_clk_set_rate,
-       .round_rate = ipu_pixel_clk_round_rate,
-       .set_parent = ipu_pixel_clk_set_parent,
-       .enable = ipu_pixel_clk_enable,
-       .disable = ipu_pixel_clk_disable,
-       .usecount = 0,
+               .name = "pixel_clk",
+               .id = 1,
+               .recalc = ipu_pixel_clk_recalc,
+               .set_rate = ipu_pixel_clk_set_rate,
+               .round_rate = ipu_pixel_clk_round_rate,
+               .set_parent = ipu_pixel_clk_set_parent,
+               .enable = ipu_pixel_clk_enable,
+               .disable = ipu_pixel_clk_disable,
        },
 };
 
@@ -401,8 +401,8 @@ void ipu_reset(void)
 int ipu_probe(void)
 {
        unsigned long ipu_base;
+#ifdef CONFIG_MX51
        u32 temp;
-
        u32 *reg_hsc_mcd = (u32 *)MIPI_HSC_BASE_ADDR;
        u32 *reg_hsc_mxt_conf = (u32 *)(MIPI_HSC_BASE_ADDR + 0x800);
 
@@ -414,7 +414,7 @@ int ipu_probe(void)
 
        temp = __raw_readl(reg_hsc_mxt_conf);
        __raw_writel(temp | 0x10000, reg_hsc_mxt_conf);
-
+#endif
        ipu_base = IPU_CTRL_BASE_ADDR;
        ipu_cpmem_base = (u32 *)(ipu_base + IPU_CPMEM_REG_BASE);
        ipu_dc_tmpl_reg = (u32 *)(ipu_base + IPU_DC_TMPL_REG_BASE);
@@ -461,37 +461,37 @@ int ipu_probe(void)
 
 void ipu_dump_registers(void)
 {
-       debug("IPU_CONF = \t0x%08X\n", __raw_readl(IPU_CONF));
-       debug("IDMAC_CONF = \t0x%08X\n", __raw_readl(IDMAC_CONF));
-       debug("IDMAC_CHA_EN1 = \t0x%08X\n",
+       debug("IPU_CONF             0x%08X\n", __raw_readl(IPU_CONF));
+       debug("IDMAC_CONF           0x%08X\n", __raw_readl(IDMAC_CONF));
+       debug("IDMAC_CHA_EN1        0x%08X\n",
               __raw_readl(IDMAC_CHA_EN(0)));
-       debug("IDMAC_CHA_EN2 = \t0x%08X\n",
+       debug("IDMAC_CHA_EN2        0x%08X\n",
               __raw_readl(IDMAC_CHA_EN(32)));
-       debug("IDMAC_CHA_PRI1 = \t0x%08X\n",
+       debug("IDMAC_CHA_PRI1       0x%08X\n",
               __raw_readl(IDMAC_CHA_PRI(0)));
-       debug("IDMAC_CHA_PRI2 = \t0x%08X\n",
+       debug("IDMAC_CHA_PRI2       0x%08X\n",
               __raw_readl(IDMAC_CHA_PRI(32)));
-       debug("IPU_CHA_DB_MODE_SEL0 = \t0x%08X\n",
+       debug("IPU_CHA_DB_MODE_SEL0 0x%08X\n",
               __raw_readl(IPU_CHA_DB_MODE_SEL(0)));
-       debug("IPU_CHA_DB_MODE_SEL1 = \t0x%08X\n",
+       debug("IPU_CHA_DB_MODE_SEL1 0x%08X\n",
               __raw_readl(IPU_CHA_DB_MODE_SEL(32)));
-       debug("DMFC_WR_CHAN = \t0x%08X\n",
+       debug("DMFC_WR_CHAN         0x%08X\n",
               __raw_readl(DMFC_WR_CHAN));
-       debug("DMFC_WR_CHAN_DEF = \t0x%08X\n",
+       debug("DMFC_WR_CHAN_DEF     0x%08X\n",
               __raw_readl(DMFC_WR_CHAN_DEF));
-       debug("DMFC_DP_CHAN = \t0x%08X\n",
+       debug("DMFC_DP_CHAN         0x%08X\n",
               __raw_readl(DMFC_DP_CHAN));
-       debug("DMFC_DP_CHAN_DEF = \t0x%08X\n",
+       debug("DMFC_DP_CHAN_DEF     0x%08X\n",
               __raw_readl(DMFC_DP_CHAN_DEF));
-       debug("DMFC_IC_CTRL = \t0x%08X\n",
+       debug("DMFC_IC_CTRL         0x%08X\n",
               __raw_readl(DMFC_IC_CTRL));
-       debug("IPU_FS_PROC_FLOW1 = \t0x%08X\n",
+       debug("IPU_FS_PROC_FLOW1    0x%08X\n",
               __raw_readl(IPU_FS_PROC_FLOW1));
-       debug("IPU_FS_PROC_FLOW2 = \t0x%08X\n",
+       debug("IPU_FS_PROC_FLOW2    0x%08X\n",
               __raw_readl(IPU_FS_PROC_FLOW2));
-       debug("IPU_FS_PROC_FLOW3 = \t0x%08X\n",
+       debug("IPU_FS_PROC_FLOW3    0x%08X\n",
               __raw_readl(IPU_FS_PROC_FLOW3));
-       debug("IPU_FS_DISP_FLOW1 = \t0x%08X\n",
+       debug("IPU_FS_DISP_FLOW1    0x%08X\n",
               __raw_readl(IPU_FS_DISP_FLOW1));
 }
 
@@ -879,8 +879,8 @@ static void ipu_ch_param_init(int ch,
                u_offset = (u == 0) ? stride * height : u;
                break;
        default:
-               puts("mxc ipu: unimplemented pixel format\n");
-               break;
+               printf("mxc ipu: unimplemented pixel format: %08x\n",
+                       pixel_fmt);
        }
 
 
@@ -955,8 +955,7 @@ int32_t ipu_init_channel_buffer(ipu_channel_t channel, ipu_buffer_t type,
                stride = width * bytes_per_pixel(pixel_fmt);
 
        if (stride % 4) {
-               printf(
-                       "Stride not 32-bit aligned, stride = %d\n", stride);
+               printf("Stride not 32-bit aligned, stride = %d\n", stride);
                return -EINVAL;
        }
        /* Build parameter memory data for DMA channel */
@@ -1133,16 +1132,13 @@ uint32_t bytes_per_pixel(uint32_t fmt)
        case IPU_PIX_FMT_YUV420P:
        case IPU_PIX_FMT_YUV422P:
                return 1;
-               break;
        case IPU_PIX_FMT_RGB565:
        case IPU_PIX_FMT_YUYV:
        case IPU_PIX_FMT_UYVY:
                return 2;
-               break;
        case IPU_PIX_FMT_BGR24:
        case IPU_PIX_FMT_RGB24:
                return 3;
-               break;
        case IPU_PIX_FMT_GENERIC_32:    /*generic data */
        case IPU_PIX_FMT_BGR32:
        case IPU_PIX_FMT_BGRA32:
@@ -1150,10 +1146,8 @@ uint32_t bytes_per_pixel(uint32_t fmt)
        case IPU_PIX_FMT_RGBA32:
        case IPU_PIX_FMT_ABGR32:
                return 4;
-               break;
        default:
                return 1;
-               break;
        }
        return 0;
 }
@@ -1173,11 +1167,9 @@ ipu_color_space_t format_to_colorspace(uint32_t fmt)
        case IPU_PIX_FMT_LVDS666:
        case IPU_PIX_FMT_LVDS888:
                return RGB;
-               break;
 
        default:
                return YCbCr;
-               break;
        }
        return RGB;
 }
index fa8fb2c357774fd3e2e585204086cf649fa661f4..52f82e6e229865554e7379db75b0f9dbb69b97a7 100644 (file)
@@ -804,8 +804,8 @@ void ipu_init_dc_mappings(void)
        /* IPU_PIX_FMT_LVDS666 */
        ipu_dc_map_clear(4);
        ipu_dc_map_config(4, 0, 5, 0xFC);
-       ipu_dc_map_config(4, 1, 13, 0xFC);
-       ipu_dc_map_config(4, 2, 21, 0xFC);
+       ipu_dc_map_config(4, 1, 11, 0xFC);
+       ipu_dc_map_config(4, 2, 17, 0xFC);
 }
 
 int ipu_pixfmt_to_map(uint32_t fmt)
@@ -813,6 +813,7 @@ int ipu_pixfmt_to_map(uint32_t fmt)
        switch (fmt) {
        case IPU_PIX_FMT_GENERIC:
        case IPU_PIX_FMT_RGB24:
+       case IPU_PIX_FMT_LVDS888:
                return 0;
        case IPU_PIX_FMT_RGB666:
                return 1;
@@ -916,7 +917,7 @@ int32_t ipu_init_sync_panel(int disp, uint32_t pixel_clk,
        debug("pixel clk = %d\n", pixel_clk);
 
        if (sig.ext_clk) {
-               if (!(g_di1_tvout && (disp == 1))) { /*not round div for tvout*/
+               if (!(g_di1_tvout && (disp == 1))) { /* don't round div for tvout */
                        /*
                         * Set the  PLL to be an even multiple
                         * of the pixel clock.
@@ -947,13 +948,24 @@ int32_t ipu_init_sync_panel(int disp, uint32_t pixel_clk,
                        clk_set_parent(g_pixel_clk[disp], g_ipu_clk);
        }
        rounded_pixel_clk = clk_round_rate(g_pixel_clk[disp], pixel_clk);
-       clk_set_rate(g_pixel_clk[disp], rounded_pixel_clk);
-       udelay(5000);
-       /* Get integer portion of divider */
-       div = clk_get_rate(clk_get_parent(g_pixel_clk[disp])) /
-               rounded_pixel_clk;
 
-       ipu_di_data_wave_config(disp, SYNC_WAVE, div - 1, div - 1);
+       di_gen = 0;
+
+       if (pixel_fmt != IPU_PIX_FMT_LVDS666 &&
+                       pixel_fmt != IPU_PIX_FMT_LVDS888) {
+               clk_set_rate(g_pixel_clk[disp], rounded_pixel_clk);
+               udelay(5000);
+               /* Get integer portion of divider */
+               div = clk_get_rate(clk_get_parent(g_pixel_clk[disp])) /
+                       rounded_pixel_clk;
+               ipu_di_data_wave_config(disp, SYNC_WAVE, div - 1, div - 1);
+       } else {
+               clk_set_rate(g_pixel_clk[disp], clk_get_rate(g_ipu_clk));
+               div = 1;
+               ipu_di_data_wave_config(disp, SYNC_WAVE, 0, 0);
+               di_gen |= (6 << 24);
+               di_gen |= DI_GEN_DI_CLK_EXT;
+       }
        ipu_di_data_pin_config(disp, SYNC_WAVE, DI_PIN15, 3, 0, div * 2);
 
        map = ipu_pixfmt_to_map(pixel_fmt);
@@ -962,8 +974,6 @@ int32_t ipu_init_sync_panel(int disp, uint32_t pixel_clk,
                return -EINVAL;
        }
 
-       di_gen = __raw_readl(DI_GENERAL(disp));
-
        if (sig.interlaced) {
                /* Setup internal HSYNC waveform */
                ipu_di_sync_config(
@@ -1121,7 +1131,7 @@ int32_t ipu_init_sync_panel(int disp, uint32_t pixel_clk,
                /* set gentime select and tag sel */
                reg = __raw_readl(DI_SW_GEN1(disp, 9));
                reg &= 0x1FFFFFFF;
-               reg |= (3 - 1)<<29 | 0x00008000;
+               reg |= ((3 - 1) << 29) | 0x00008000;
                __raw_writel(reg, DI_SW_GEN1(disp, 9));
 
                __raw_writel(v_total / 2 - 1, DI_SCR_CONF(disp));
@@ -1179,13 +1189,13 @@ int32_t ipu_init_sync_panel(int disp, uint32_t pixel_clk,
 
                /* Init template microcode */
                if (disp) {
-                  ipu_dc_write_tmpl(2, WROD(0), 0, map, SYNC_WAVE, 8, 5);
-                  ipu_dc_write_tmpl(3, WROD(0), 0, map, SYNC_WAVE, 4, 5);
-                  ipu_dc_write_tmpl(4, WROD(0), 0, map, SYNC_WAVE, 0, 5);
+                       ipu_dc_write_tmpl(2, WROD(0), 0, map, SYNC_WAVE, 8, 5);
+                       ipu_dc_write_tmpl(3, WROD(0), 0, map, SYNC_WAVE, 4, 5);
+                       ipu_dc_write_tmpl(4, WROD(0), 0, map, SYNC_WAVE, 0, 5);
                } else {
-                  ipu_dc_write_tmpl(5, WROD(0), 0, map, SYNC_WAVE, 8, 5);
-                  ipu_dc_write_tmpl(6, WROD(0), 0, map, SYNC_WAVE, 4, 5);
-                  ipu_dc_write_tmpl(7, WROD(0), 0, map, SYNC_WAVE, 0, 5);
+                       ipu_dc_write_tmpl(5, WROD(0), 0, map, SYNC_WAVE, 8, 5);
+                       ipu_dc_write_tmpl(6, WROD(0), 0, map, SYNC_WAVE, 4, 5);
+                       ipu_dc_write_tmpl(7, WROD(0), 0, map, SYNC_WAVE, 0, 5);
                }
 
                if (sig.Hsync_pol)
@@ -1195,7 +1205,6 @@ int32_t ipu_init_sync_panel(int disp, uint32_t pixel_clk,
 
                if (sig.clk_pol)
                        di_gen |= DI_GEN_POL_CLK;
-
        }
 
        __raw_writel(di_gen, DI_GENERAL(disp));
index 9964c2039c966d0048ea83a22d44235bca318946..d89d280b4f1ac3885ed4b13cee8de9b4119451b3 100644 (file)
@@ -97,7 +97,7 @@ enum {
        DI_DW_GEN_ACCESS_SIZE_OFFSET = 24,
        DI_DW_GEN_COMPONENT_SIZE_OFFSET = 16,
 
-       DI_GEN_DI_CLK_EXT = 0x100000,
+       DI_GEN_DI_CLK_EXT = 0x00100000,
        DI_GEN_POLARITY_1 = 0x00000001,
        DI_GEN_POLARITY_2 = 0x00000002,
        DI_GEN_POLARITY_3 = 0x00000004,
@@ -106,7 +106,7 @@ enum {
        DI_GEN_POLARITY_6 = 0x00000020,
        DI_GEN_POLARITY_7 = 0x00000040,
        DI_GEN_POLARITY_8 = 0x00000080,
-       DI_GEN_POL_CLK = 0x20000,
+       DI_GEN_POL_CLK    = 0x00020000,
 
        DI_POL_DRDY_DATA_POLARITY = 0x00000080,
        DI_POL_DRDY_POLARITY_15 = 0x00000010,
diff --git a/drivers/video/mx2fb.c b/drivers/video/mx2fb.c
new file mode 100644 (file)
index 0000000..35d1e00
--- /dev/null
@@ -0,0 +1,125 @@
+/*
+ * Copyright (C) 2010 Freescale Semiconductor, Inc.
+ *
+ * Configuration settings for the MX53-EVK Freescale 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
+ */
+
+#include <common.h>
+#include <lcd.h>
+#include <asm/arch/mx25-regs.h>
+#include <asm/io.h>
+#include <asm/errno.h>
+#include <asm/errno.h>
+#include <mx2fb.h>
+
+DECLARE_GLOBAL_DATA_PTR;
+
+void *lcd_base;                        /* Start of framebuffer memory  */
+void *lcd_console_address;     /* Start of console buffer      */
+
+int lcd_line_length;
+int lcd_color_fg;
+int lcd_color_bg;
+
+short console_col;
+short console_row;
+
+
+void lcd_initcolregs(void)
+{
+}
+
+void lcd_setcolreg(ushort regno, ushort red, ushort green, ushort blue)
+{
+}
+
+void lcd_enable(void)
+{
+}
+
+void lcd_disable(void)
+{
+}
+
+void lcd_panel_disable(void)
+{
+}
+
+void lcd_ctrl_init(void *lcdbase)
+{
+       u32 ccm_ipg_cg, pcr;
+
+       /* LSSAR */
+       writel(gd->fb_base, LCDC_BASE + 0x00);
+       /* LSR = x << 20 + y */
+       writel(((panel_info.vl_col >> 4) << 20) + panel_info.vl_row,
+               LCDC_BASE + 0x04);
+       /* LVPWR = x_res * 2 / 2 */
+       writel(panel_info.vl_col / 2, LCDC_BASE + 0x08);
+       /* LPCR =  To be fixed using Linux BSP Value for now */
+       switch (panel_info.vl_bpix) {
+       /* bpix = 4 (16bpp) */
+       case 4:
+               pcr = LCDC_LPCR | (0x5 << 25);
+               break;
+       default:
+               pcr = LCDC_LPCR;
+               break;
+       }
+
+       pcr |= (panel_info.vl_sync & FB_SYNC_CLK_LAT_FALL) ? 0x00200000 : 0;
+       pcr |= (panel_info.vl_sync & FB_SYNC_DATA_INVERT) ? 0x01000000 : 0;
+       pcr |= (panel_info.vl_sync & FB_SYNC_SHARP_MODE) ? 0x00000040 : 0;
+       pcr |= (panel_info.vl_sync & FB_SYNC_OE_LOW_ACT) ? 0x00100000 : 0;
+
+       pcr |= LCDC_LPCR_PCD;
+
+       writel(pcr, LCDC_BASE + 0x18);
+       /* LHCR = H Pulse width, Right and Left Margins */
+       writel(((panel_info.vl_hsync - 1) << 26) + \
+               ((panel_info.vl_right_margin - 1) << 8) + \
+               (panel_info.vl_left_margin - 3),
+               LCDC_BASE + 0x1c);
+       /* LVCR = V Pulse width, lower and upper margins */
+       writel((panel_info.vl_vsync << 26) + \
+               (panel_info.vl_lower_margin << 8) + \
+               (panel_info.vl_upper_margin),
+               LCDC_BASE + 0x20);
+       /* LSCR */
+       writel(LCDC_LSCR, LCDC_BASE + 0x28);
+       /* LRMCR */
+       writel(LCDC_LRMCR, LCDC_BASE + 0x34);
+       /* LDCR */
+       writel(LCDC_LDCR, LCDC_BASE + 0x30);
+       /* LPCCR = PWM */
+       writel(LCDC_LPCCR, LCDC_BASE + 0x2c);
+
+       /* On and off clock gating */
+       ccm_ipg_cg = readl(CCM_BASE + 0x10);
+
+       writel(ccm_ipg_cg&0xDFFFFFFF, CCM_BASE + 0x10);
+       writel(ccm_ipg_cg|0x20000000, CCM_BASE + 0x10);
+}
+
+ulong calc_fbsize(void)
+{
+       return panel_info.vl_row * panel_info.vl_col * 2 \
+               * NBITS(panel_info.vl_bpix) / 8;
+}
+
+
diff --git a/drivers/video/mxc_epdc_fb.c b/drivers/video/mxc_epdc_fb.c
new file mode 100644 (file)
index 0000000..6430cc9
--- /dev/null
@@ -0,0 +1,446 @@
+/*
+ * Copyright (C) 2010 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
+ *
+ */
+/*
+ * Based on STMP378X LCDIF
+ * Copyright 2008 Embedded Alley Solutions, Inc All Rights Reserved.
+ */
+
+#include <common.h>
+#include <lcd.h>
+#include <linux/list.h>
+#include <linux/err.h>
+#include <linux/types.h>
+#include <asm/arch/mx50.h>
+
+#include "mxc_epdc_fb.h"
+
+
+extern int setup_waveform_file();
+extern void epdc_power_on();
+extern void epdc_power_off();
+
+DECLARE_GLOBAL_DATA_PTR;
+
+void *lcd_base;                        /* Start of framebuffer memory  */
+void *lcd_console_address;     /* Start of console buffer      */
+
+int lcd_line_length;
+int lcd_color_fg;
+int lcd_color_bg;
+
+short console_col;
+short console_row;
+
+void lcd_initcolregs(void)
+{
+}
+
+void lcd_setcolreg(ushort regno, ushort red, ushort green, ushort blue)
+{
+}
+
+#define TEMP_USE_DEFAULT 8
+
+#define UPDATE_MODE_PARTIAL                    0x0
+#define UPDATE_MODE_FULL                       0x1
+
+#define TRUE 1
+#define FALSE 0
+
+#define msleep(a)      udelay(a * 1000)
+
+
+/********************************************************
+ * Start Low-Level EPDC Functions
+ ********************************************************/
+
+static inline void epdc_set_screen_res(u32 width, u32 height)
+{
+       u32 val = (height << EPDC_RES_VERTICAL_OFFSET) | width;
+
+       REG_WR(EPDC_BASE, EPDC_RES, val);
+}
+
+static inline void epdc_set_update_coord(u32 x, u32 y)
+{
+       u32 val = (y << EPDC_UPD_CORD_YCORD_OFFSET) | x;
+
+       REG_WR(EPDC_BASE, EPDC_UPD_CORD, val);
+}
+
+static inline void epdc_set_update_dimensions(u32 width, u32 height)
+{
+       u32 val = (height << EPDC_UPD_SIZE_HEIGHT_OFFSET) | width;
+
+       REG_WR(EPDC_BASE, EPDC_UPD_SIZE, val);
+}
+
+static void epdc_submit_update(u32 lut_num, u32 waveform_mode, u32 update_mode,
+                              int use_test_mode, u32 np_val)
+{
+       u32 reg_val = 0;
+
+       if (use_test_mode) {
+               reg_val |=
+                       ((np_val << EPDC_UPD_FIXED_FIXNP_OFFSET) &
+                       EPDC_UPD_FIXED_FIXNP_MASK) | EPDC_UPD_FIXED_FIXNP_EN;
+
+               REG_WR(EPDC_BASE, EPDC_UPD_FIXED, reg_val);
+
+               reg_val = EPDC_UPD_CTRL_USE_FIXED;
+       } else {
+               REG_WR(EPDC_BASE, EPDC_UPD_FIXED, reg_val);
+       }
+
+       reg_val |=
+               ((lut_num << EPDC_UPD_CTRL_LUT_SEL_OFFSET) &
+               EPDC_UPD_CTRL_LUT_SEL_MASK) |
+               ((waveform_mode << EPDC_UPD_CTRL_WAVEFORM_MODE_OFFSET) &
+               EPDC_UPD_CTRL_WAVEFORM_MODE_MASK) |
+               update_mode;
+
+       REG_WR(EPDC_BASE, EPDC_UPD_CTRL, reg_val);
+}
+
+static inline int epdc_is_lut_active(u32 lut_num)
+{
+       u32 val = REG_RD(EPDC_BASE, EPDC_STATUS_LUTS);
+       int is_active = val & (1 << lut_num) ? TRUE : FALSE;
+
+       return is_active;
+}
+
+static void epdc_set_horizontal_timing(u32 horiz_start, u32 horiz_end,
+                                      u32 hsync_width, u32 hsync_line_length)
+{
+       u32 reg_val =
+               ((hsync_width << EPDC_TCE_HSCAN1_LINE_SYNC_WIDTH_OFFSET) &
+               EPDC_TCE_HSCAN1_LINE_SYNC_WIDTH_MASK)
+               | ((hsync_line_length << EPDC_TCE_HSCAN1_LINE_SYNC_OFFSET) &
+               EPDC_TCE_HSCAN1_LINE_SYNC_MASK);
+       REG_WR(EPDC_BASE, EPDC_TCE_HSCAN1, reg_val);
+
+       reg_val =
+               ((horiz_start << EPDC_TCE_HSCAN2_LINE_BEGIN_OFFSET) &
+               EPDC_TCE_HSCAN2_LINE_BEGIN_MASK)
+               | ((horiz_end << EPDC_TCE_HSCAN2_LINE_END_OFFSET) &
+               EPDC_TCE_HSCAN2_LINE_END_MASK);
+       REG_WR(EPDC_BASE, EPDC_TCE_HSCAN2, reg_val);
+}
+
+static void epdc_set_vertical_timing(u32 vert_start, u32 vert_end,
+                                       u32 vsync_width)
+{
+       u32 reg_val =
+               ((vert_start << EPDC_TCE_VSCAN_FRAME_BEGIN_OFFSET) &
+               EPDC_TCE_VSCAN_FRAME_BEGIN_MASK)
+               | ((vert_end << EPDC_TCE_VSCAN_FRAME_END_OFFSET) &
+               EPDC_TCE_VSCAN_FRAME_END_MASK)
+               | ((vsync_width << EPDC_TCE_VSCAN_FRAME_SYNC_OFFSET) &
+               EPDC_TCE_VSCAN_FRAME_SYNC_MASK);
+       REG_WR(EPDC_BASE, EPDC_TCE_VSCAN, reg_val);
+}
+
+static void epdc_init_settings(void)
+{
+       u32 reg_val;
+
+       /* EPDC_CTRL */
+       reg_val = REG_RD(EPDC_BASE, EPDC_CTRL);
+       reg_val &= ~EPDC_CTRL_UPD_DATA_SWIZZLE_MASK;
+       reg_val |= EPDC_CTRL_UPD_DATA_SWIZZLE_NO_SWAP;
+       reg_val &= ~EPDC_CTRL_LUT_DATA_SWIZZLE_MASK;
+       reg_val |= EPDC_CTRL_LUT_DATA_SWIZZLE_NO_SWAP;
+       REG_SET(EPDC_BASE, EPDC_CTRL, reg_val);
+
+       /* EPDC_FORMAT - 2bit TFT and 4bit Buf pixel format */
+       reg_val = EPDC_FORMAT_TFT_PIXEL_FORMAT_2BIT
+               | EPDC_FORMAT_BUF_PIXEL_FORMAT_P4N
+               | ((0x0 << EPDC_FORMAT_DEFAULT_TFT_PIXEL_OFFSET) &
+               EPDC_FORMAT_DEFAULT_TFT_PIXEL_MASK);
+       REG_WR(EPDC_BASE, EPDC_FORMAT, reg_val);
+
+       /* EPDC_FIFOCTRL (disabled) */
+       reg_val =
+               ((100 << EPDC_FIFOCTRL_FIFO_INIT_LEVEL_OFFSET) &
+               EPDC_FIFOCTRL_FIFO_INIT_LEVEL_MASK)
+               | ((200 << EPDC_FIFOCTRL_FIFO_H_LEVEL_OFFSET) &
+               EPDC_FIFOCTRL_FIFO_H_LEVEL_MASK)
+               | ((100 << EPDC_FIFOCTRL_FIFO_L_LEVEL_OFFSET) &
+               EPDC_FIFOCTRL_FIFO_L_LEVEL_MASK);
+       REG_WR(EPDC_BASE, EPDC_FIFOCTRL, reg_val);
+
+       /* EPDC_TEMP - Use default temperature */
+       REG_WR(EPDC_BASE, EPDC_TEMP, TEMP_USE_DEFAULT);
+
+       /* EPDC_RES */
+       epdc_set_screen_res(panel_info.vl_col, panel_info.vl_row);
+
+       /*
+        * EPDC_TCE_CTRL
+        * VSCAN_HOLDOFF = 4
+        * VCOM_MODE = MANUAL
+        * VCOM_VAL = 0
+        * DDR_MODE = DISABLED
+        * LVDS_MODE_CE = DISABLED
+        * LVDS_MODE = DISABLED
+        * DUAL_SCAN = DISABLED
+        * SDDO_WIDTH = 8bit
+        * PIXELS_PER_SDCLK = 4
+        */
+       reg_val =
+               ((4 << EPDC_TCE_CTRL_VSCAN_HOLDOFF_OFFSET) &
+               EPDC_TCE_CTRL_VSCAN_HOLDOFF_MASK)
+               | EPDC_TCE_CTRL_PIXELS_PER_SDCLK_4;
+       REG_WR(EPDC_BASE, EPDC_TCE_CTRL, reg_val);
+
+       /* EPDC_TCE_HSCAN */
+       epdc_set_horizontal_timing(panel_info.vl_left_margin,
+                               panel_info.vl_right_margin,
+                               panel_info.vl_hsync,
+                               panel_info.vl_hsync);
+
+       /* EPDC_TCE_VSCAN */
+       epdc_set_vertical_timing(panel_info.vl_upper_margin,
+                                panel_info.vl_lower_margin,
+                                panel_info.vl_vsync);
+
+       /* EPDC_TCE_OE */
+       reg_val =
+               ((10 << EPDC_TCE_OE_SDOED_WIDTH_OFFSET) &
+               EPDC_TCE_OE_SDOED_WIDTH_MASK)
+               | ((20 << EPDC_TCE_OE_SDOED_DLY_OFFSET) &
+               EPDC_TCE_OE_SDOED_DLY_MASK)
+               | ((10 << EPDC_TCE_OE_SDOEZ_WIDTH_OFFSET) &
+               EPDC_TCE_OE_SDOEZ_WIDTH_MASK)
+               | ((20 << EPDC_TCE_OE_SDOEZ_DLY_OFFSET) &
+               EPDC_TCE_OE_SDOEZ_DLY_MASK);
+       REG_WR(EPDC_BASE, EPDC_TCE_OE, reg_val);
+
+       /* EPDC_TCE_TIMING1 */
+       REG_WR(EPDC_BASE, EPDC_TCE_TIMING1, 0x0);
+
+       /* EPDC_TCE_TIMING2 */
+       reg_val =
+               ((480 << EPDC_TCE_TIMING2_GDCLK_HP_OFFSET) &
+               EPDC_TCE_TIMING2_GDCLK_HP_MASK)
+               | ((20 << EPDC_TCE_TIMING2_GDSP_OFFSET_OFFSET) &
+               EPDC_TCE_TIMING2_GDSP_OFFSET_MASK);
+       REG_WR(EPDC_BASE, EPDC_TCE_TIMING2, reg_val);
+
+       /* EPDC_TCE_TIMING3 */
+       reg_val =
+               ((0 << EPDC_TCE_TIMING3_GDOE_OFFSET_OFFSET) &
+               EPDC_TCE_TIMING3_GDOE_OFFSET_MASK)
+               | ((1 << EPDC_TCE_TIMING3_GDCLK_OFFSET_OFFSET) &
+               EPDC_TCE_TIMING3_GDCLK_OFFSET_MASK);
+       REG_WR(EPDC_BASE, EPDC_TCE_TIMING3, reg_val);
+
+       /*
+        * EPDC_TCE_SDCFG
+        * SDCLK_HOLD = 1
+        * SDSHR = 1
+        * NUM_CE = 1
+        * SDDO_REFORMAT = FLIP_PIXELS
+        * SDDO_INVERT = DISABLED
+        * PIXELS_PER_CE = display horizontal resolution
+        */
+       reg_val = EPDC_TCE_SDCFG_SDCLK_HOLD | EPDC_TCE_SDCFG_SDSHR
+               | ((1 << EPDC_TCE_SDCFG_NUM_CE_OFFSET) & EPDC_TCE_SDCFG_NUM_CE_MASK)
+               | EPDC_TCE_SDCFG_SDDO_REFORMAT_FLIP_PIXELS
+               | ((panel_info.vl_col << EPDC_TCE_SDCFG_PIXELS_PER_CE_OFFSET) &
+               EPDC_TCE_SDCFG_PIXELS_PER_CE_MASK);
+       REG_WR(EPDC_BASE, EPDC_TCE_SDCFG, reg_val);
+
+       /*
+        * EPDC_TCE_GDCFG
+        * GDRL = 1
+        * GDOE_MODE = 0;
+        * GDSP_MODE = 0;
+        */
+       reg_val = EPDC_TCE_SDCFG_GDRL;
+       REG_WR(EPDC_BASE, EPDC_TCE_GDCFG, reg_val);
+
+       /*
+        * EPDC_TCE_POLARITY
+        * SDCE_POL = ACTIVE LOW
+        * SDLE_POL = ACTIVE HIGH
+        * SDOE_POL = ACTIVE HIGH
+        * GDOE_POL = ACTIVE HIGH
+        * GDSP_POL = ACTIVE LOW
+        */
+       reg_val = EPDC_TCE_POLARITY_SDLE_POL_ACTIVE_HIGH
+               | EPDC_TCE_POLARITY_SDOE_POL_ACTIVE_HIGH
+               | EPDC_TCE_POLARITY_GDOE_POL_ACTIVE_HIGH;
+       REG_WR(EPDC_BASE, EPDC_TCE_POLARITY, reg_val);
+
+       /* EPDC_IRQ_MASK */
+       REG_WR(EPDC_BASE, EPDC_IRQ_MASK,
+               EPDC_IRQ_TCE_UNDERRUN_IRQ);
+
+       /*
+        * EPDC_GPIO
+        * PWRCOM = ?
+        * PWRCTRL = ?
+        * BDR = ?
+        */
+       reg_val = ((0 << EPDC_GPIO_PWRCTRL_OFFSET) & EPDC_GPIO_PWRCTRL_MASK)
+               | ((0 << EPDC_GPIO_BDR_OFFSET) & EPDC_GPIO_BDR_MASK);
+       REG_WR(EPDC_BASE, EPDC_GPIO, reg_val);
+}
+
+static void draw_mode0(void)
+{
+       int i;
+
+       /* Program EPDC update to process buffer */
+       epdc_set_update_coord(0, 0);
+       epdc_set_update_dimensions(panel_info.vl_col, panel_info.vl_row);
+       epdc_submit_update(0, panel_info.epdc_data.wv_modes.mode_init,
+                               UPDATE_MODE_FULL, FALSE, 0);
+
+       debug("Mode0 update - Waiting for LUT to complete...\n");
+
+       /* Will timeout after ~4-5 seconds */
+
+       for (i = 0; i < 40; i++) {
+               if (!epdc_is_lut_active(0)) {
+                       debug("Mode0 init complete\n");
+                       return;
+               }
+               msleep(100);
+       }
+
+       debug("Mode0 init failed!\n");
+
+}
+
+static void draw_splash_screen(void)
+{
+       int i;
+       int lut_num = 0;
+
+       /* Program EPDC update to process buffer */
+       epdc_set_update_coord(0, 0);
+       epdc_set_update_dimensions(panel_info.vl_col, panel_info.vl_row);
+       epdc_submit_update(lut_num, panel_info.epdc_data.wv_modes.mode_gc16,
+               UPDATE_MODE_FULL, FALSE, 0);
+
+       for (i = 0; i < 40; i++) {
+               if (!epdc_is_lut_active(lut_num)) {
+                       debug("Splash screen update complete\n");
+                       return;
+               }
+               msleep(100);
+       }
+       debug("Splash screen update failed!\n");
+
+}
+
+void lcd_enable(void)
+{
+       int i;
+
+       epdc_power_on();
+
+       /* Draw black border around framebuffer*/
+       memset(lcd_base, 0xFF, panel_info.vl_col * panel_info.vl_row);
+       memset(lcd_base, 0x0, 24 * panel_info.vl_col);
+       for (i = 24; i < (panel_info.vl_row - 24); i++) {
+               memset((u8 *)lcd_base + i * panel_info.vl_col, 0x00, 24);
+               memset((u8 *)lcd_base + i * panel_info.vl_col
+                       + panel_info.vl_col - 24, 0x00, 24);
+       }
+       memset((u8 *)lcd_base + panel_info.vl_col * (panel_info.vl_row - 24),
+               0x00, 24 * panel_info.vl_col);
+
+       /* Draw data to display */
+       draw_mode0();
+
+       draw_splash_screen();
+}
+
+void lcd_disable(void)
+{
+       debug("lcd_disable\n");
+
+       /* Disable clocks to EPDC */
+       REG_SET(EPDC_BASE, EPDC_CTRL, EPDC_CTRL_CLKGATE);
+}
+
+void lcd_panel_disable(void)
+{
+       epdc_power_off();
+}
+
+void lcd_ctrl_init(void *lcdbase)
+{
+       /*
+        * We rely on lcdbase being a physical address, i.e., either MMU off,
+        * or 1-to-1 mapping. Might want to add some virt2phys here.
+        */
+       if (!lcdbase)
+               return;
+
+       lcd_color_fg = 0xFF;
+       lcd_color_bg = 0xFF;
+
+       /* Reset */
+       REG_SET(EPDC_BASE, EPDC_CTRL, EPDC_CTRL_SFTRST);
+       while (!(REG_RD(EPDC_BASE, EPDC_CTRL) & EPDC_CTRL_CLKGATE))
+               ;
+       REG_CLR(EPDC_BASE, EPDC_CTRL, EPDC_CTRL_SFTRST);
+
+       /* Enable clock gating (clear to enable) */
+       REG_CLR(EPDC_BASE, EPDC_CTRL, EPDC_CTRL_CLKGATE);
+       while (REG_RD(EPDC_BASE, EPDC_CTRL) &
+              (EPDC_CTRL_SFTRST | EPDC_CTRL_CLKGATE))
+               ;
+
+       debug("resolution %dx%d, bpp %d\n", (int)panel_info.vl_col,
+               (int)panel_info.vl_row, NBITS(panel_info.vl_bpix));
+
+       /* Set framebuffer pointer */
+       REG_WR(EPDC_BASE, EPDC_UPD_ADDR, (u32)lcdbase);
+
+       /* Set Working Buffer pointer */
+       REG_WR(EPDC_BASE, EPDC_WB_ADDR, panel_info.epdc_data.working_buf_addr);
+
+       /* Get waveform data address and offset */
+       if (setup_waveform_file()) {
+               printf("Can't load waveform data!\n");
+               return;
+       }
+
+       /* Set Waveform Buffer pointer */
+       REG_WR(EPDC_BASE, EPDC_WVADDR,
+               panel_info.epdc_data.waveform_buf_addr);
+
+       /* Initialize EPDC, passing pointer to EPDC registers */
+       epdc_init_settings();
+
+       return;
+}
+
+ulong calc_fbsize(void)
+{
+       return panel_info.vl_row * panel_info.vl_col * 2 \
+               * NBITS(panel_info.vl_bpix) / 8;
+}
+
diff --git a/drivers/video/mxc_epdc_fb.h b/drivers/video/mxc_epdc_fb.h
new file mode 100644 (file)
index 0000000..e078538
--- /dev/null
@@ -0,0 +1,299 @@
+/*
+ * Copyright (C) 2010 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
+ *
+ */
+#ifndef __EPDC_REGS_INCLUDED__
+#define __EPDC_REGS_INCLUDED__
+
+#include <linux/types.h>
+#include <linux/list.h>
+
+/*************************************
+ * Register addresses
+ *************************************/
+#define EPDC_BASE                      (EPDC_BASE_ADDR)
+
+#define EPDC_CTRL                      (0x000)
+#define EPDC_CTRL_SET                  (0x004)
+#define EPDC_CTRL_CLR                  (0x008)
+#define EPDC_CTRL_TOG                  (0x00c)
+#define EPDC_WVADDR                    (0x020)
+#define EPDC_WB_ADDR                   (0x030)
+#define EPDC_RES                       (0x040)
+#define EPDC_FORMAT                    (0x050)
+#define EPDC_FORMAT_SET                        (0x054)
+#define EPDC_FORMAT_CLR                        (0x058)
+#define EPDC_FORMAT_TOG                        (0x05c)
+#define EPDC_FIFOCTRL                  (0x0a0)
+#define EPDC_FIFOCTRL_SET              (0x0a4)
+#define EPDC_FIFOCTRL_CLR              (0x0a8)
+#define EPDC_FIFOCTRL_TOG              (0x0ac)
+#define EPDC_UPD_ADDR                  (0x100)
+#define EPDC_UPD_CORD                  (0x120)
+#define EPDC_UPD_SIZE                  (0x140)
+#define EPDC_UPD_CTRL                  (0x160)
+#define EPDC_UPD_FIXED                 (0x180)
+#define EPDC_TEMP                      (0x1a0)
+#define EPDC_TCE_CTRL                  (0x200)
+#define EPDC_TCE_SDCFG                 (0x220)
+#define EPDC_TCE_GDCFG                 (0x240)
+#define EPDC_TCE_HSCAN1                        (0x260)
+#define EPDC_TCE_HSCAN2                        (0x280)
+#define EPDC_TCE_VSCAN                 (0x2a0)
+#define EPDC_TCE_OE                    (0x2c0)
+#define EPDC_TCE_POLARITY              (0x2e0)
+#define EPDC_TCE_TIMING1               (0x300)
+#define EPDC_TCE_TIMING2               (0x310)
+#define EPDC_TCE_TIMING3               (0x320)
+#define EPDC_IRQ_MASK                  (0x400)
+#define EPDC_IRQ_MASK_SET              (0x404)
+#define EPDC_IRQ_MASK_CLR              (0x408)
+#define EPDC_IRQ_MASK_TOG              (0x40c)
+#define EPDC_IRQ                       (0x420)
+#define EPDC_IRQ_SET                   (0x424)
+#define EPDC_IRQ_CLR                   (0x428)
+#define EPDC_IRQ_TOG                   (0x42c)
+#define EPDC_STATUS_LUTS               (0x440)
+#define EPDC_STATUS_LUTS_SET           (0x444)
+#define EPDC_STATUS_LUTS_CLR           (0x448)
+#define EPDC_STATUS_LUTS_TOG           (0x44c)
+#define EPDC_STATUS_NEXTLUT            (0x460)
+#define EPDC_STATUS_COL                        (0x480)
+#define EPDC_STATUS                    (0x4a0)
+#define EPDC_STATUS_SET                        (0x4a4)
+#define EPDC_STATUS_CLR                        (0x4a8)
+#define EPDC_STATUS_TOG                        (0x4ac)
+#define EPDC_DEBUG                     (0x500)
+#define EPDC_DEBUG_LUT0                        (0x540)
+#define EPDC_DEBUG_LUT1                        (0x550)
+#define EPDC_DEBUG_LUT2                        (0x560)
+#define EPDC_DEBUG_LUT3                        (0x570)
+#define EPDC_DEBUG_LUT4                        (0x580)
+#define EPDC_DEBUG_LUT5                        (0x590)
+#define EPDC_DEBUG_LUT6                        (0x5a0)
+#define EPDC_DEBUG_LUT7                        (0x5b0)
+#define EPDC_DEBUG_LUT8                        (0x5c0)
+#define EPDC_DEBUG_LUT9                        (0x5d0)
+#define EPDC_DEBUG_LUT10               (0x5e0)
+#define EPDC_DEBUG_LUT11               (0x5f0)
+#define EPDC_DEBUG_LUT12               (0x600)
+#define EPDC_DEBUG_LUT13               (0x610)
+#define EPDC_DEBUG_LUT14               (0x620)
+#define EPDC_DEBUG_LUT15               (0x630)
+#define EPDC_GPIO                      (0x700)
+#define EPDC_VERSION                   (0x7f0)
+
+enum {
+       /* EPDC_CTRL field values */
+       EPDC_CTRL_SFTRST = 0x80000000,
+       EPDC_CTRL_CLKGATE = 0x40000000,
+       EPDC_CTRL_SRAM_POWERDOWN = 0x100,
+       EPDC_CTRL_UPD_DATA_SWIZZLE_MASK = 0xc0,
+       EPDC_CTRL_UPD_DATA_SWIZZLE_NO_SWAP = 0,
+       EPDC_CTRL_UPD_DATA_SWIZZLE_ALL_BYTES_SWAP = 0x40,
+       EPDC_CTRL_UPD_DATA_SWIZZLE_HWD_SWAP = 0x80,
+       EPDC_CTRL_UPD_DATA_SWIZZLE_HWD_BYTE_SWAP = 0xc0,
+       EPDC_CTRL_LUT_DATA_SWIZZLE_MASK = 0x30,
+       EPDC_CTRL_LUT_DATA_SWIZZLE_NO_SWAP = 0,
+       EPDC_CTRL_LUT_DATA_SWIZZLE_ALL_BYTES_SWAP = 0x10,
+       EPDC_CTRL_LUT_DATA_SWIZZLE_HWD_SWAP = 0x20,
+       EPDC_CTRL_LUT_DATA_SWIZZLE_HWD_BYTE_SWAP = 0x30,
+       EPDC_CTRL_BURST_LEN_8_8 = 0x1,
+       EPDC_CTRL_BURST_LEN_8_16 = 0,
+
+       /* EPDC_RES field values */
+       EPDC_RES_VERTICAL_MASK = 0x1fff0000,
+       EPDC_RES_VERTICAL_OFFSET = 16,
+       EPDC_RES_HORIZONTAL_MASK = 0x1fff,
+       EPDC_RES_HORIZONTAL_OFFSET = 0,
+
+       /* EPDC_FORMAT field values */
+       EPDC_FORMAT_BUF_PIXEL_SCALE_ROUND = 0x1000000,
+       EPDC_FORMAT_DEFAULT_TFT_PIXEL_MASK = 0xff0000,
+       EPDC_FORMAT_DEFAULT_TFT_PIXEL_OFFSET = 16,
+       EPDC_FORMAT_BUF_PIXEL_FORMAT_P2N = 0x200,
+       EPDC_FORMAT_BUF_PIXEL_FORMAT_P3N = 0x300,
+       EPDC_FORMAT_BUF_PIXEL_FORMAT_P4N = 0x400,
+       EPDC_FORMAT_BUF_PIXEL_FORMAT_P5N = 0x500,
+       EPDC_FORMAT_TFT_PIXEL_FORMAT_2BIT = 0x0,
+       EPDC_FORMAT_TFT_PIXEL_FORMAT_2BIT_VCOM = 0x1,
+       EPDC_FORMAT_TFT_PIXEL_FORMAT_4BIT = 0x2,
+       EPDC_FORMAT_TFT_PIXEL_FORMAT_4BIT_VCOM = 0x3,
+
+       /* EPDC_FIFOCTRL field values */
+       EPDC_FIFOCTRL_ENABLE_PRIORITY = 0x80000000,
+       EPDC_FIFOCTRL_FIFO_INIT_LEVEL_MASK = 0xff0000,
+       EPDC_FIFOCTRL_FIFO_INIT_LEVEL_OFFSET = 16,
+       EPDC_FIFOCTRL_FIFO_H_LEVEL_MASK = 0xff00,
+       EPDC_FIFOCTRL_FIFO_H_LEVEL_OFFSET = 8,
+       EPDC_FIFOCTRL_FIFO_L_LEVEL_MASK = 0xff,
+       EPDC_FIFOCTRL_FIFO_L_LEVEL_OFFSET = 0,
+
+       /* EPDC_UPD_CORD field values */
+       EPDC_UPD_CORD_YCORD_MASK = 0x1fff0000,
+       EPDC_UPD_CORD_YCORD_OFFSET = 16,
+       EPDC_UPD_CORD_XCORD_MASK = 0x1fff,
+       EPDC_UPD_CORD_XCORD_OFFSET = 0,
+
+       /* EPDC_UPD_SIZE field values */
+       EPDC_UPD_SIZE_HEIGHT_MASK = 0x1fff0000,
+       EPDC_UPD_SIZE_HEIGHT_OFFSET = 16,
+       EPDC_UPD_SIZE_WIDTH_MASK = 0x1fff,
+       EPDC_UPD_SIZE_WIDTH_OFFSET = 0,
+
+       /* EPDC_UPD_CTRL field values */
+       EPDC_UPD_CTRL_USE_FIXED = 0x80000000,
+       EPDC_UPD_CTRL_LUT_SEL_MASK = 0xf0000,
+       EPDC_UPD_CTRL_LUT_SEL_OFFSET = 16,
+       EPDC_UPD_CTRL_WAVEFORM_MODE_MASK = 0xff00,
+       EPDC_UPD_CTRL_WAVEFORM_MODE_OFFSET = 8,
+       EPDC_UPD_CTRL_UPDATE_MODE_FULL = 0x1,
+
+       /* EPDC_UPD_FIXED field values */
+       EPDC_UPD_FIXED_FIXNP_EN = 0x80000000,
+       EPDC_UPD_FIXED_FIXCP_EN = 0x40000000,
+       EPDC_UPD_FIXED_FIXNP_MASK = 0xff00,
+       EPDC_UPD_FIXED_FIXNP_OFFSET = 8,
+       EPDC_UPD_FIXED_FIXCP_MASK = 0xff,
+       EPDC_UPD_FIXED_FIXCP_OFFSET = 0,
+
+       /* EPDC_TCE_CTRL field values */
+       EPDC_TCE_CTRL_VSCAN_HOLDOFF_MASK = 0x1ff0000,
+       EPDC_TCE_CTRL_VSCAN_HOLDOFF_OFFSET = 16,
+       EPDC_TCE_CTRL_VCOM_VAL_MASK = 0xc00,
+       EPDC_TCE_CTRL_VCOM_VAL_OFFSET = 10,
+       EPDC_TCE_CTRL_VCOM_MODE_AUTO = 0x200,
+       EPDC_TCE_CTRL_VCOM_MODE_MANUAL = 0x000,
+       EPDC_TCE_CTRL_DDR_MODE_ENABLE = 0x100,
+       EPDC_TCE_CTRL_LVDS_MODE_CE_ENABLE = 0x80,
+       EPDC_TCE_CTRL_LVDS_MODE_ENABLE = 0x40,
+       EPDC_TCE_CTRL_SCAN_DIR_1_UP = 0x20,
+       EPDC_TCE_CTRL_SCAN_DIR_0_UP = 0x10,
+       EPDC_TCE_CTRL_DUAL_SCAN_ENABLE = 0x8,
+       EPDC_TCE_CTRL_SDDO_WIDTH_16BIT = 0x4,
+       EPDC_TCE_CTRL_PIXELS_PER_SDCLK_2 = 1,
+       EPDC_TCE_CTRL_PIXELS_PER_SDCLK_4 = 2,
+       EPDC_TCE_CTRL_PIXELS_PER_SDCLK_8 = 3,
+
+       /* EPDC_TCE_SDCFG field values */
+       EPDC_TCE_SDCFG_SDCLK_HOLD = 0x200000,
+       EPDC_TCE_SDCFG_SDSHR = 0x100000,
+       EPDC_TCE_SDCFG_NUM_CE_MASK = 0xf0000,
+       EPDC_TCE_SDCFG_NUM_CE_OFFSET = 16,
+       EPDC_TCE_SDCFG_SDDO_REFORMAT_STANDARD = 0,
+       EPDC_TCE_SDCFG_SDDO_REFORMAT_FLIP_PIXELS = 0x4000,
+       EPDC_TCE_SDCFG_SDDO_INVERT_ENABLE = 0x2000,
+       EPDC_TCE_SDCFG_PIXELS_PER_CE_MASK = 0x1fff,
+       EPDC_TCE_SDCFG_PIXELS_PER_CE_OFFSET = 0,
+
+       /* EPDC_TCE_GDCFG field values */
+       EPDC_TCE_SDCFG_GDRL = 0x10,
+       EPDC_TCE_SDCFG_GDOE_MODE_DELAYED_GDCLK = 0x2,
+       EPDC_TCE_SDCFG_GDSP_MODE_FRAME_SYNC = 0x1,
+       EPDC_TCE_SDCFG_GDSP_MODE_ONE_LINE = 0x0,
+
+       /* EPDC_TCE_HSCAN1 field values */
+       EPDC_TCE_HSCAN1_LINE_SYNC_WIDTH_MASK = 0xfff0000,
+       EPDC_TCE_HSCAN1_LINE_SYNC_WIDTH_OFFSET = 16,
+       EPDC_TCE_HSCAN1_LINE_SYNC_MASK = 0xfff,
+       EPDC_TCE_HSCAN1_LINE_SYNC_OFFSET = 0,
+
+       /* EPDC_TCE_HSCAN2 field values */
+       EPDC_TCE_HSCAN2_LINE_END_MASK = 0xfff0000,
+       EPDC_TCE_HSCAN2_LINE_END_OFFSET = 16,
+       EPDC_TCE_HSCAN2_LINE_BEGIN_MASK = 0xfff,
+       EPDC_TCE_HSCAN2_LINE_BEGIN_OFFSET = 0,
+
+       /* EPDC_TCE_VSCAN field values */
+       EPDC_TCE_VSCAN_FRAME_END_MASK = 0xff0000,
+       EPDC_TCE_VSCAN_FRAME_END_OFFSET = 16,
+       EPDC_TCE_VSCAN_FRAME_BEGIN_MASK = 0xff00,
+       EPDC_TCE_VSCAN_FRAME_BEGIN_OFFSET = 8,
+       EPDC_TCE_VSCAN_FRAME_SYNC_MASK = 0xff,
+       EPDC_TCE_VSCAN_FRAME_SYNC_OFFSET = 0,
+
+       /* EPDC_TCE_OE field values */
+       EPDC_TCE_OE_SDOED_WIDTH_MASK = 0xff000000,
+       EPDC_TCE_OE_SDOED_WIDTH_OFFSET = 24,
+       EPDC_TCE_OE_SDOED_DLY_MASK = 0xff0000,
+       EPDC_TCE_OE_SDOED_DLY_OFFSET = 16,
+       EPDC_TCE_OE_SDOEZ_WIDTH_MASK = 0xff00,
+       EPDC_TCE_OE_SDOEZ_WIDTH_OFFSET = 8,
+       EPDC_TCE_OE_SDOEZ_DLY_MASK = 0xff,
+       EPDC_TCE_OE_SDOEZ_DLY_OFFSET = 0,
+
+       /* EPDC_TCE_POLARITY field values */
+       EPDC_TCE_POLARITY_GDSP_POL_ACTIVE_HIGH = 0x10,
+       EPDC_TCE_POLARITY_GDOE_POL_ACTIVE_HIGH = 0x8,
+       EPDC_TCE_POLARITY_SDOE_POL_ACTIVE_HIGH = 0x4,
+       EPDC_TCE_POLARITY_SDLE_POL_ACTIVE_HIGH = 0x2,
+       EPDC_TCE_POLARITY_SDCE_POL_ACTIVE_HIGH = 0x1,
+
+       /* EPDC_TCE_TIMING1 field values */
+       EPDC_TCE_TIMING1_SDLE_SHIFT_NONE = 0x00,
+       EPDC_TCE_TIMING1_SDLE_SHIFT_1 = 0x10,
+       EPDC_TCE_TIMING1_SDLE_SHIFT_2 = 0x20,
+       EPDC_TCE_TIMING1_SDLE_SHIFT_3 = 0x30,
+       EPDC_TCE_TIMING1_SDCLK_INVERT = 0x8,
+       EPDC_TCE_TIMING1_SDCLK_SHIFT_NONE = 0,
+       EPDC_TCE_TIMING1_SDCLK_SHIFT_1CYCLE = 1,
+       EPDC_TCE_TIMING1_SDCLK_SHIFT_2CYCLES = 2,
+       EPDC_TCE_TIMING1_SDCLK_SHIFT_3CYCLES = 3,
+
+       /* EPDC_TCE_TIMING2 field values */
+       EPDC_TCE_TIMING2_GDCLK_HP_MASK = 0xffff0000,
+       EPDC_TCE_TIMING2_GDCLK_HP_OFFSET = 16,
+       EPDC_TCE_TIMING2_GDSP_OFFSET_MASK = 0xffff,
+       EPDC_TCE_TIMING2_GDSP_OFFSET_OFFSET = 0,
+
+       /* EPDC_TCE_TIMING3 field values */
+       EPDC_TCE_TIMING3_GDOE_OFFSET_MASK = 0xffff0000,
+       EPDC_TCE_TIMING3_GDOE_OFFSET_OFFSET = 16,
+       EPDC_TCE_TIMING3_GDCLK_OFFSET_MASK = 0xffff,
+       EPDC_TCE_TIMING3_GDCLK_OFFSET_OFFSET = 0,
+
+       /* EPDC_IRQ_MASK/EPDC_IRQ field values */
+       EPDC_IRQ_WB_CMPLT_IRQ = 0x10000,
+       EPDC_IRQ_LUT_COL_IRQ = 0x20000,
+       EPDC_IRQ_TCE_UNDERRUN_IRQ = 0x40000,
+       EPDC_IRQ_FRAME_END_IRQ = 0x80000,
+       EPDC_IRQ_BUS_ERROR_IRQ = 0x100000,
+       EPDC_IRQ_TCE_IDLE_IRQ = 0x200000,
+
+       /* EPDC_STATUS_NEXTLUT field values */
+       EPDC_STATUS_NEXTLUT_NEXT_LUT_VALID = 0x100,
+       EPDC_STATUS_NEXTLUT_NEXT_LUT_MASK = 0xf,
+       EPDC_STATUS_NEXTLUT_NEXT_LUT_OFFSET = 0,
+
+       /* EPDC_STATUS field values */
+       EPDC_STATUS_LUTS_UNDERRUN = 0x4,
+       EPDC_STATUS_LUTS_BUSY = 0x2,
+       EPDC_STATUS_WB_BUSY = 0x1,
+
+       /* EPDC_DEBUG field values */
+       EPDC_DEBUG_UNDERRUN_RECOVER = 0x2,
+       EPDC_DEBUG_COLLISION_OFF = 0x1,
+
+       /* EPDC_GPIO field values */
+       EPDC_GPIO_PWRCOM = 0x40,
+       EPDC_GPIO_PWRCTRL_MASK = 0x3c,
+       EPDC_GPIO_PWRCTRL_OFFSET = 2,
+       EPDC_GPIO_BDR_MASK = 0x3,
+       EPDC_GPIO_BDR_OFFSET = 0,
+};
+
+#endif
index 1bee54c1a1f6bf469421b85ef35db28cbd7605bd..a49c9fd07589fb00ab4461a5e610bacfab1449e4 100644 (file)
@@ -39,6 +39,8 @@
 #include "ipu.h"
 #include "mxcfb.h"
 
+DECLARE_GLOBAL_DATA_PTR;
+
 static int mxcfb_map_video_memory(struct fb_info *fbi);
 static int mxcfb_unmap_video_memory(struct fb_info *fbi);
 
@@ -48,7 +50,7 @@ static struct fb_videomode *gmode;
 static uint8_t gdisp;
 static uint32_t gpixfmt;
 
-void fb_videomode_to_var(struct fb_var_screeninfo *var,
+static void fb_videomode_to_var(struct fb_var_screeninfo *var,
                         const struct fb_videomode *mode)
 {
        var->xres = mode->xres;
@@ -111,15 +113,16 @@ static uint32_t bpp_to_pixfmt(struct fb_info *fbi)
                return fbi->var.nonstd;
 
        switch (fbi->var.bits_per_pixel) {
-       case 24:
-               pixfmt = IPU_PIX_FMT_BGR24;
-               break;
        case 32:
                pixfmt = IPU_PIX_FMT_BGR32;
                break;
+
        case 16:
                pixfmt = IPU_PIX_FMT_RGB565;
                break;
+
+       case 8:
+               pixfmt = IPU_PIX_FMT_GENERIC;
        }
        return pixfmt;
 }
@@ -148,7 +151,7 @@ static int mxcfb_set_fix(struct fb_info *info)
 static int setup_disp_channel1(struct fb_info *fbi)
 {
        ipu_channel_params_t params;
-       struct mxcfb_info *mxc_fbi = (struct mxcfb_info *)fbi->par;
+       struct mxcfb_info *mxc_fbi = fbi->par;
 
        memset(&params, 0, sizeof(params));
        params.mem_dp_bg_sync.di = mxc_fbi->ipu_di;
@@ -183,7 +186,7 @@ static int setup_disp_channel1(struct fb_info *fbi)
 static int setup_disp_channel2(struct fb_info *fbi)
 {
        int retval = 0;
-       struct mxcfb_info *mxc_fbi = (struct mxcfb_info *)fbi->par;
+       struct mxcfb_info *mxc_fbi = fbi->par;
 
        mxc_fbi->cur_ipu_buf = 1;
        if (mxc_fbi->alpha_chan_en)
@@ -191,7 +194,7 @@ static int setup_disp_channel2(struct fb_info *fbi)
 
        fbi->var.xoffset = fbi->var.yoffset = 0;
 
-       debug("%s: %x %d %d %d %lx %lx\n",
+       debug("%s: ch: %08x xres: %d yres: %d line_length: %d mem: %08lx .. %08lx\n",
                __func__,
                mxc_fbi->ipu_ch,
                fbi->var.xres,
@@ -199,7 +202,7 @@ static int setup_disp_channel2(struct fb_info *fbi)
                fbi->fix.line_length,
                fbi->fix.smem_start,
                fbi->fix.smem_start +
-               (fbi->fix.line_length * fbi->var.yres));
+               (fbi->fix.line_length * fbi->var.yres) - 1);
 
        retval = ipu_init_channel_buffer(mxc_fbi->ipu_ch, IPU_INPUT_BUFFER,
                                         bpp_to_pixfmt(fbi),
@@ -225,7 +228,7 @@ static int mxcfb_set_par(struct fb_info *fbi)
        int retval = 0;
        u32 mem_len;
        ipu_di_signal_cfg_t sig_cfg;
-       struct mxcfb_info *mxc_fbi = (struct mxcfb_info *)fbi->par;
+       struct mxcfb_info *mxc_fbi = fbi->par;
        uint32_t out_pixel_fmt;
 
        ipu_disable_channel(mxc_fbi->ipu_ch);
@@ -270,10 +273,11 @@ static int mxcfb_set_par(struct fb_info *fbi)
        if (fbi->var.sync & FB_SYNC_CLK_IDLE_EN)
                sig_cfg.clkidle_en = 1;
 
-       debug("pixclock = %ul Hz\n",
-               (u32) (PICOS2KHZ(fbi->var.pixclock) * 1000UL));
+       debug("pixclock = %lu.%03lu MHz\n",
+               PICOS2KHZ(fbi->var.pixclock) / 1000,
+               PICOS2KHZ(fbi->var.pixclock) % 1000);
 
-       if (ipu_init_sync_panel(mxc_fbi->ipu_di,
+       retval = ipu_init_sync_panel(mxc_fbi->ipu_di,
                                (PICOS2KHZ(fbi->var.pixclock)) * 1000UL,
                                fbi->var.xres, fbi->var.yres,
                                out_pixel_fmt,
@@ -283,9 +287,10 @@ static int mxcfb_set_par(struct fb_info *fbi)
                                fbi->var.upper_margin,
                                fbi->var.vsync_len,
                                fbi->var.lower_margin,
-                               0, sig_cfg) != 0) {
-               puts("mxcfb: Error initializing panel.\n");
-               return -EINVAL;
+                               0, sig_cfg);
+       if (retval != 0) {
+               printf("mxc_ipuv3_fb: Error %d initializing panel\n", retval);
+               return retval;
        }
 
        retval = setup_disp_channel2(fbi);
@@ -315,8 +320,8 @@ static int mxcfb_check_var(struct fb_var_screeninfo *var, struct fb_info *info)
        if (var->yres_virtual < var->yres)
                var->yres_virtual = var->yres;
 
-       if ((var->bits_per_pixel != 32) && (var->bits_per_pixel != 24) &&
-           (var->bits_per_pixel != 16) && (var->bits_per_pixel != 8))
+       if ((var->bits_per_pixel != 32) && (var->bits_per_pixel != 16) &&
+               (var->bits_per_pixel != 8))
                var->bits_per_pixel = default_bpp;
 
        switch (var->bits_per_pixel) {
@@ -337,6 +342,7 @@ static int mxcfb_check_var(struct fb_var_screeninfo *var, struct fb_info *info)
                var->transp.offset = 0;
                var->transp.msb_right = 0;
                break;
+
        case 16:
                var->red.length = 5;
                var->red.offset = 11;
@@ -354,23 +360,7 @@ static int mxcfb_check_var(struct fb_var_screeninfo *var, struct fb_info *info)
                var->transp.offset = 0;
                var->transp.msb_right = 0;
                break;
-       case 24:
-               var->red.length = 8;
-               var->red.offset = 16;
-               var->red.msb_right = 0;
-
-               var->green.length = 8;
-               var->green.offset = 8;
-               var->green.msb_right = 0;
 
-               var->blue.length = 8;
-               var->blue.offset = 0;
-               var->blue.msb_right = 0;
-
-               var->transp.length = 0;
-               var->transp.offset = 0;
-               var->transp.msb_right = 0;
-               break;
        case 32:
                var->red.length = 8;
                var->red.offset = 16;
@@ -414,15 +404,16 @@ static int mxcfb_map_video_memory(struct fb_info *fbi)
                fbi->fix.smem_len = fbi->var.yres_virtual *
                                    fbi->fix.line_length;
        }
-
-       fbi->screen_base = (char *)malloc(fbi->fix.smem_len);
-       fbi->fix.smem_start = (unsigned long)fbi->screen_base;
-       if (fbi->screen_base == 0) {
+       if (gd->fb_base)
+               fbi->screen_base = (void *)gd->fb_base;
+       else
+               fbi->screen_base = malloc(fbi->fix.smem_len);
+       if (fbi->screen_base == NULL) {
                puts("Unable to allocate framebuffer memory\n");
                fbi->fix.smem_len = 0;
-               fbi->fix.smem_start = 0;
                return -EBUSY;
        }
+       fbi->fix.smem_start = (unsigned long)fbi->screen_base;
 
        debug("allocated fb @ paddr=0x%08X, size=%d.\n",
                (uint32_t) fbi->fix.smem_start, fbi->fix.smem_len);
@@ -430,7 +421,7 @@ static int mxcfb_map_video_memory(struct fb_info *fbi)
        fbi->screen_size = fbi->fix.smem_len;
 
        /* Clear the screen */
-       memset((char *)fbi->screen_base, 0, fbi->fix.smem_len);
+       memset(fbi->screen_base, 0, fbi->fix.smem_len);
 
        return 0;
 }
@@ -454,17 +445,14 @@ static int mxcfb_unmap_video_memory(struct fb_info *fbi)
  */
 static struct fb_info *mxcfb_init_fbinfo(void)
 {
-#define BYTES_PER_LONG 4
-#define PADDING (BYTES_PER_LONG - (sizeof(struct fb_info) % BYTES_PER_LONG))
        struct fb_info *fbi;
        struct mxcfb_info *mxcfbi;
-       char *p;
-       int size = sizeof(struct mxcfb_info) + PADDING +
+       void *p;
+       int size = ALIGN(sizeof(struct mxcfb_info), sizeof(long)) +
                sizeof(struct fb_info);
 
-       debug("%s: %d %d %d %d\n",
+       debug("%s: %d %d %d\n",
                __func__,
-               PADDING,
                size,
                sizeof(struct mxcfb_info),
                sizeof(struct fb_info));
@@ -478,12 +466,12 @@ static struct fb_info *mxcfb_init_fbinfo(void)
 
        memset(p, 0, size);
 
-       fbi = (struct fb_info *)p;
-       fbi->par = p + sizeof(struct fb_info) + PADDING;
+       fbi = p;
+       fbi->par = p + ALIGN(sizeof(struct fb_info), sizeof(long));
 
-       mxcfbi = (struct mxcfb_info *)fbi->par;
-       debug("Framebuffer structures at: fbi=0x%x mxcfbi=0x%x\n",
-               (unsigned int)fbi, (unsigned int)mxcfbi);
+       mxcfbi = fbi->par;
+       debug("Framebuffer structures at: fbi=%p mxcfbi=%p\n",
+               fbi, mxcfbi);
 
        fbi->var.activate = FB_ACTIVATE_NOW;
 
@@ -506,17 +494,15 @@ static int mxcfb_probe(u32 interface_pix_fmt, uint8_t disp,
 {
        struct fb_info *fbi;
        struct mxcfb_info *mxcfbi;
-       int ret = 0;
 
        /*
         * Initialize FB structures
         */
        fbi = mxcfb_init_fbinfo();
-       if (!fbi) {
-               ret = -ENOMEM;
-               goto err0;
-       }
-       mxcfbi = (struct mxcfb_info *)fbi->par;
+       if (!fbi)
+               return -ENOMEM;
+
+       mxcfbi = fbi->par;
 
        if (!g_dp_in_use) {
                mxcfbi->ipu_ch = MEM_BG_SYNC;
@@ -540,18 +526,14 @@ static int mxcfb_probe(u32 interface_pix_fmt, uint8_t disp,
 
        mxcfbi->ipu_di_pix_fmt = interface_pix_fmt;
        fb_videomode_to_var(&fbi->var, mode);
-       fbi->var.bits_per_pixel = 16;
+       fbi->var.bits_per_pixel = default_bpp;
        fbi->fix.line_length = fbi->var.xres * (fbi->var.bits_per_pixel / 8);
        fbi->fix.smem_len = fbi->var.yres_virtual * fbi->fix.line_length;
 
        mxcfb_check_var(&fbi->var, fbi);
-
-       /* Default Y virtual size is 2x panel size */
-       fbi->var.yres_virtual = fbi->var.yres * 2;
-
        mxcfb_set_fix(fbi);
 
-       /* alocate fb first */
+       /* allocate fb first */
        if (mxcfb_map_video_memory(fbi) < 0)
                return -ENOMEM;
 
@@ -565,15 +547,35 @@ static int mxcfb_probe(u32 interface_pix_fmt, uint8_t disp,
        panel.frameAdrs = (u32)fbi->screen_base;
        panel.memSize = fbi->screen_size;
 
-       panel.gdfBytesPP = 2;
-       panel.gdfIndex = GDF_16BIT_565RGB;
+       switch (fbi->var.bits_per_pixel) {
+       case 8:
+               panel.gdfBytesPP = 1;
+               panel.gdfIndex = GDF__8BIT_INDEX;
+               break;
+
+       case 16:
+               panel.gdfBytesPP = 2;
+               panel.gdfIndex = GDF_16BIT_565RGB;
+               break;
+
+       case 32:
+               panel.gdfBytesPP = 4;
+               panel.gdfIndex = GDF_32BIT_X888RGB;
+               break;
+
+       default:
+               hang();
+       }
 
        ipu_dump_registers();
 
        return 0;
+}
 
-err0:
-       return ret;
+void mxcfb_disable(void)
+{
+       ipu_disable_channel(MEM_BG_SYNC);
+       ipu_uninit_channel(MEM_BG_SYNC);
 }
 
 void *video_hw_init(void)
@@ -585,9 +587,9 @@ void *video_hw_init(void)
                puts("Error initializing IPU\n");
 
        ret = mxcfb_probe(gpixfmt, gdisp, gmode);
-       debug("Framebuffer at 0x%x\n", (unsigned int)panel.frameAdrs);
+       debug("Framebuffer at 0x%08x\n", panel.frameAdrs);
 
-       return (void *)&panel;
+       return &panel;
 }
 
 void video_set_lut(unsigned int index, /* color number */
@@ -599,11 +601,12 @@ void video_set_lut(unsigned int index, /* color number */
        return;
 }
 
-int mx51_fb_init(struct fb_videomode *mode, uint8_t disp, uint32_t pixfmt)
+int mx5_fb_init(struct fb_videomode *mode, uint8_t disp, uint32_t pixfmt, int bpp)
 {
        gmode = mode;
        gdisp = disp;
        gpixfmt = pixfmt;
+       default_bpp = bpp;
 
        return 0;
 }
diff --git a/drivers/video/mxsfb.c b/drivers/video/mxsfb.c
new file mode 100644 (file)
index 0000000..d0acaa4
--- /dev/null
@@ -0,0 +1,310 @@
+/*
+ * Copyright (C) 2012 Lothar Waßmann <LW@KARO-electronics.de>
+ *
+ * LCD driver for i.MX28
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.         See the
+ * GNU General Public License for more details.
+ *
+ */
+
+#include <common.h>
+#include <errno.h>
+#include <lcd.h>
+#include <malloc.h>
+#include <asm/io.h>
+#include <asm/arch/imx-regs.h>
+#include <asm/arch/mxsfb.h>
+#include <asm/arch/sys_proto.h>
+
+vidinfo_t panel_info = {
+       /* set to max. size supported by SoC */
+       .vl_col = 800,
+       .vl_row = 480,
+
+       .vl_bpix = LCD_COLOR24,    /* Bits per pixel, 0: 1bpp, 1: 2bpp, 2: 4bpp, 3: 8bpp ... */
+};
+
+static int bits_per_pixel;
+static int color_depth;
+static uint32_t pix_fmt;
+static struct fb_var_screeninfo mxsfb_var;
+
+static struct mx28_lcdif_regs *lcd_regs = (void *)MXS_LCDIF_BASE;
+
+void *lcd_base;                        /* Start of framebuffer memory  */
+void *lcd_console_address;     /* Start of console buffer      */
+
+int lcd_line_length;
+int lcd_color_fg;
+int lcd_color_bg;
+
+short console_col;
+short console_row;
+
+void lcd_initcolregs(void)
+{
+}
+
+void lcd_setcolreg(ushort regno, ushort red, ushort green, ushort blue)
+{
+}
+
+#define fourcc_str(fourcc)     ((fourcc) >> 0) & 0xff, \
+               ((fourcc) >> 8) & 0xff,                 \
+               ((fourcc) >> 16) & 0xff,                \
+               ((fourcc) >> 24) & 0xff
+
+#define LCD_CTRL_DEFAULT       (LCDIF_CTRL_LCDIF_MASTER |      \
+                               LCDIF_CTRL_BYPASS_COUNT |       \
+                               LCDIF_CTRL_DOTCLK_MODE)
+
+#define LCD_CTRL1_DEFAULT      0
+#define LCD_CTRL2_DEFAULT      LCDIF_CTRL2_OUTSTANDING_REQS_REQ_2
+
+#define LCD_VDCTRL0_DEFAULT    (LCDIF_VDCTRL0_ENABLE_PRESENT |         \
+                               LCDIF_VDCTRL0_VSYNC_PERIOD_UNIT |       \
+                               LCDIF_VDCTRL0_VSYNC_PULSE_WIDTH_UNIT)
+#define LCD_VDCTRL1_DEFAULT    0
+#define LCD_VDCTRL2_DEFAULT    0
+#define LCD_VDCTRL3_DEFAULT    0
+#define LCD_VDCTRL4_DEFAULT    LCDIF_VDCTRL4_SYNC_SIGNALS_ON
+
+void video_hw_init(void *lcdbase)
+{
+       int ret;
+       unsigned int div = 0, best = 0, pix_clk;
+       u32 frac1;
+       const unsigned long lcd_clk = 480000000;
+       u32 lcd_ctrl = LCD_CTRL_DEFAULT | LCDIF_CTRL_RUN;
+       u32 lcd_ctrl1 = LCD_CTRL1_DEFAULT, lcd_ctrl2 = LCD_CTRL2_DEFAULT;
+       u32 lcd_vdctrl0 = LCD_VDCTRL0_DEFAULT;
+       u32 lcd_vdctrl1 = LCD_VDCTRL1_DEFAULT;
+       u32 lcd_vdctrl2 = LCD_VDCTRL2_DEFAULT;
+       u32 lcd_vdctrl3 = LCD_VDCTRL3_DEFAULT;
+       u32 lcd_vdctrl4 = LCD_VDCTRL4_DEFAULT;
+       struct mx28_clkctrl_regs *clk_regs = (void *)MXS_CLKCTRL_BASE;
+       char buf1[16], buf2[16];
+
+       /* pixel format in memory */
+       switch (color_depth) {
+       case 8:
+               lcd_ctrl |= LCDIF_CTRL_WORD_LENGTH_8BIT;
+               lcd_ctrl1 |= LCDIF_CTRL1_BYTE_PACKING_FORMAT(1);
+               break;
+
+       case 16:
+               lcd_ctrl |= LCDIF_CTRL_WORD_LENGTH_16BIT;
+               lcd_ctrl1 |= LCDIF_CTRL1_BYTE_PACKING_FORMAT(3);
+               break;
+
+       case 18:
+               lcd_ctrl |= LCDIF_CTRL_WORD_LENGTH_18BIT;
+               lcd_ctrl1 |= LCDIF_CTRL1_BYTE_PACKING_FORMAT(7);
+               break;
+
+       case 24:
+               lcd_ctrl |= LCDIF_CTRL_WORD_LENGTH_24BIT;
+               lcd_ctrl1 |= LCDIF_CTRL1_BYTE_PACKING_FORMAT(7);
+               break;
+
+       default:
+               printf("Invalid bpp: %d\n", color_depth);
+               return;
+       }
+
+       /* pixel format on the LCD data pins */
+       switch (pix_fmt) {
+       case PIX_FMT_RGB332:
+               lcd_ctrl |= LCDIF_CTRL_LCD_DATABUS_WIDTH_8BIT;
+               break;
+
+       case PIX_FMT_RGB565:
+               lcd_ctrl |= LCDIF_CTRL_LCD_DATABUS_WIDTH_16BIT;
+               break;
+
+       case PIX_FMT_BGR666:
+               lcd_ctrl |= 1 << LCDIF_CTRL_INPUT_DATA_SWIZZLE_OFFSET;
+               /* fallthru */
+       case PIX_FMT_RGB666:
+               lcd_ctrl |= LCDIF_CTRL_LCD_DATABUS_WIDTH_18BIT;
+               break;
+
+       case PIX_FMT_BGR24:
+               lcd_ctrl |= 1 << LCDIF_CTRL_INPUT_DATA_SWIZZLE_OFFSET;
+               /* fallthru */
+       case PIX_FMT_RGB24:
+               lcd_ctrl |= LCDIF_CTRL_LCD_DATABUS_WIDTH_24BIT;
+               break;
+
+       default:
+               printf("Invalid pixel format: %c%c%c%c\n", fourcc_str(pix_fmt));
+               return;
+       }
+
+       pix_clk = PICOS2KHZ(mxsfb_var.pixclock);
+       debug("designated pix_clk: %sMHz\n", strmhz(buf1, pix_clk * 1000));
+
+       for (frac1 = 18; frac1 < 36; frac1++) {
+               static unsigned int err = ~0;
+               unsigned long clk = lcd_clk / 1000 * 18 / frac1;
+               unsigned int d = (clk + pix_clk - 1) / pix_clk;
+               unsigned int diff = abs(clk / d - pix_clk);
+
+               debug("frac1=%u div=%u lcd_clk=%-8sMHz pix_clk=%-8sMHz diff=%u err=%u\n",
+                       frac1, d, strmhz(buf1, clk * 1000), strmhz(buf2, clk * 1000 / d),
+                       diff, err);
+
+               if (clk < pix_clk)
+                       break;
+               if (d > 255)
+                       continue;
+
+               if (diff < err) {
+                       best = frac1;
+                       div = d;
+                       err = diff;
+                       if (err == 0)
+                               break;
+               }
+       }
+       if (div == 0) {
+               printf("Requested pixel clock %sMHz out of range\n",
+                       strmhz(buf1, pix_clk * 1000));
+               return;
+       }
+
+       debug("div=%lu(%u*%u/18) for pixel clock %sMHz with base clock %sMHz\n",
+               lcd_clk / pix_clk / 1000, best, div,
+               strmhz(buf1, lcd_clk / div * 18 / best),
+               strmhz(buf2, lcd_clk));
+
+       frac1 = (readl(&clk_regs->hw_clkctrl_frac1_reg) & ~0xff) | best;
+       writel(frac1, &clk_regs->hw_clkctrl_frac1_reg);
+       writel(1 << 14, &clk_regs->hw_clkctrl_clkseq_clr);
+
+       /* enable LCD clk and fractional divider */
+       writel(div, &clk_regs->hw_clkctrl_lcdif_reg);
+       while (readl(&clk_regs->hw_clkctrl_lcdif_reg) & (1 << 29))
+               ;
+
+       ret = mx28_reset_block(&lcd_regs->hw_lcdif_ctrl_reg);
+       if (ret) {
+               printf("Failed to reset LCD controller: LCDIF_CTRL: %08x CLKCTRL_LCDIF: %08x\n",
+                       readl(&lcd_regs->hw_lcdif_ctrl_reg),
+                       readl(&clk_regs->hw_clkctrl_lcdif_reg));
+               return;
+       }
+
+       if (mxsfb_var.sync & FB_SYNC_HOR_HIGH_ACT)
+               lcd_vdctrl0 |= LCDIF_VDCTRL0_HSYNC_POL;
+
+       if (mxsfb_var.sync & FB_SYNC_VERT_HIGH_ACT)
+               lcd_vdctrl0 |= LCDIF_VDCTRL0_HSYNC_POL;
+
+       if (mxsfb_var.sync & FB_SYNC_DATA_ENABLE_HIGH_ACT)
+               lcd_vdctrl0 |= LCDIF_VDCTRL0_ENABLE_POL;
+
+       if (mxsfb_var.sync & FB_SYNC_DOTCLK_FALLING_ACT)
+               lcd_vdctrl0 |= LCDIF_VDCTRL0_DOTCLK_POL;
+
+       lcd_vdctrl0 |= LCDIF_VDCTRL0_VSYNC_PULSE_WIDTH(mxsfb_var.vsync_len);
+       lcd_vdctrl1 |= LCDIF_VDCTRL1_VSYNC_PERIOD(mxsfb_var.vsync_len +
+                                               mxsfb_var.upper_margin +
+                                               mxsfb_var.lower_margin +
+                                               mxsfb_var.yres);
+       lcd_vdctrl2 |= LCDIF_VDCTRL2_HSYNC_PULSE_WIDTH(mxsfb_var.hsync_len);
+       lcd_vdctrl2 |= LCDIF_VDCTRL2_HSYNC_PERIOD(mxsfb_var.hsync_len +
+                                               mxsfb_var.left_margin +
+                                               mxsfb_var.right_margin +
+                                               mxsfb_var.xres);
+
+       lcd_vdctrl3 |= LCDIF_VDCTRL3_HORIZONTAL_WAIT_CNT(mxsfb_var.left_margin +
+                                                       mxsfb_var.hsync_len);
+       lcd_vdctrl3 |= LCDIF_VDCTRL3_VERTICAL_WAIT_CNT(mxsfb_var.upper_margin +
+                                                       mxsfb_var.vsync_len);
+
+       lcd_vdctrl4 |= LCDIF_VDCTRL4_DOTCLK_H_VALID_DATA_CNT(mxsfb_var.xres);
+
+       writel((u32)lcdbase, &lcd_regs->hw_lcdif_next_buf_reg);
+       writel(LCDIF_TRANSFER_COUNT_H_COUNT(mxsfb_var.xres) |
+               LCDIF_TRANSFER_COUNT_V_COUNT(mxsfb_var.yres),
+               &lcd_regs->hw_lcdif_transfer_count_reg);
+
+       writel(lcd_vdctrl0, &lcd_regs->hw_lcdif_vdctrl0_reg);
+       writel(lcd_vdctrl1, &lcd_regs->hw_lcdif_vdctrl1_reg);
+       writel(lcd_vdctrl2, &lcd_regs->hw_lcdif_vdctrl2_reg);
+       writel(lcd_vdctrl3, &lcd_regs->hw_lcdif_vdctrl3_reg);
+       writel(lcd_vdctrl4, &lcd_regs->hw_lcdif_vdctrl4_reg);
+
+       writel(lcd_ctrl1, &lcd_regs->hw_lcdif_ctrl1_reg);
+       writel(lcd_ctrl2, &lcd_regs->hw_lcdif_ctrl2_reg);
+
+       writel(lcd_ctrl, &lcd_regs->hw_lcdif_ctrl_reg);
+
+       debug("mxsfb framebuffer driver initialized\n");
+}
+
+void mxsfb_disable(void)
+{
+       u32 lcd_ctrl = readl(&lcd_regs->hw_lcdif_ctrl_reg);
+
+       writel(lcd_ctrl & ~LCDIF_CTRL_RUN, &lcd_regs->hw_lcdif_ctrl_reg);
+}
+
+int mxsfb_init(struct fb_videomode *mode, uint32_t pixfmt, int bpp)
+{
+       switch (bpp) {
+       case 8:
+               bits_per_pixel = 8;
+               panel_info.vl_bpix = LCD_COLOR8;
+               break;
+
+       case 16:
+               bits_per_pixel = 16;
+               panel_info.vl_bpix = LCD_COLOR16;
+               break;
+
+       case 18:
+               bits_per_pixel = 32;
+               panel_info.vl_bpix = LCD_COLOR24;
+               break;
+
+       case 24:
+               bits_per_pixel = 32;
+               panel_info.vl_bpix = LCD_COLOR24;
+               break;
+
+       default:
+               return -EINVAL;
+       }
+
+       pix_fmt = pixfmt;
+       color_depth = bpp;
+
+       lcd_line_length = bits_per_pixel / 8 * mode->xres;
+
+       mxsfb_var.xres = mode->xres;
+       mxsfb_var.yres = mode->yres;
+       mxsfb_var.xres_virtual = mode->xres;
+       mxsfb_var.yres_virtual = mode->yres;
+       mxsfb_var.pixclock = mode->pixclock;
+       mxsfb_var.left_margin = mode->left_margin;
+       mxsfb_var.right_margin = mode->right_margin;
+       mxsfb_var.upper_margin = mode->upper_margin;
+       mxsfb_var.lower_margin = mode->lower_margin;
+       mxsfb_var.hsync_len = mode->hsync_len;
+       mxsfb_var.vsync_len = mode->vsync_len;
+       mxsfb_var.sync = mode->sync;
+
+       panel_info.vl_col = mode->xres;
+       panel_info.vl_row = mode->yres;
+
+       return 0;
+}
diff --git a/drivers/video/s6e8ax0.c b/drivers/video/s6e8ax0.c
new file mode 100644 (file)
index 0000000..1ec7fd6
--- /dev/null
@@ -0,0 +1,256 @@
+/*
+ * Copyright (C) 2012 Samsung Electronics
+ *
+ * Author: Donghwa Lee <dh09.lee@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 <asm/arch/mipi_dsim.h>
+
+#include "exynos_mipi_dsi_lowlevel.h"
+#include "exynos_mipi_dsi_common.h"
+
+static void s6e8ax0_panel_cond(struct mipi_dsim_device *dsim_dev)
+{
+       struct mipi_dsim_master_ops *ops = dsim_dev->master_ops;
+       const unsigned char data_to_send[] = {
+               0xf8, 0x3d, 0x35, 0x00, 0x00, 0x00, 0x8d, 0x00, 0x4c,
+               0x6e, 0x10, 0x27, 0x7d, 0x3f, 0x10, 0x00, 0x00, 0x20,
+               0x04, 0x08, 0x6e, 0x00, 0x00, 0x00, 0x02, 0x08, 0x08,
+               0x23, 0x23, 0xc0, 0xc8, 0x08, 0x48, 0xc1, 0x00, 0xc3,
+               0xff, 0xff, 0xc8
+       };
+
+       ops->cmd_write(dsim_dev, MIPI_DSI_DCS_LONG_WRITE,
+                       (unsigned int)data_to_send, ARRAY_SIZE(data_to_send));
+}
+
+static void s6e8ax0_display_cond(struct mipi_dsim_device *dsim_dev)
+{
+       struct mipi_dsim_master_ops *ops = dsim_dev->master_ops;
+       const unsigned char data_to_send[] = {
+               0xf2, 0x80, 0x03, 0x0d
+       };
+
+       ops->cmd_write(dsim_dev, MIPI_DSI_DCS_LONG_WRITE,
+                       (unsigned int)data_to_send,
+                       ARRAY_SIZE(data_to_send));
+}
+
+static void s6e8ax0_gamma_cond(struct mipi_dsim_device *dsim_dev)
+{
+       struct mipi_dsim_master_ops *ops = dsim_dev->master_ops;
+       /* 7500K 2.2 Set (M3, 300cd) */
+       const unsigned char data_to_send[] = {
+               0xfa, 0x01, 0x0f, 0x00, 0x0f, 0xda, 0xc0, 0xe4, 0xc8,
+               0xc8, 0xc6, 0xd3, 0xd6, 0xd0, 0xab, 0xb2, 0xa6, 0xbf,
+               0xc2, 0xb9, 0x00, 0x93, 0x00, 0x86, 0x00, 0xd1
+       };
+
+       ops->cmd_write(dsim_dev, MIPI_DSI_DCS_LONG_WRITE,
+                       (unsigned int)data_to_send,
+                       ARRAY_SIZE(data_to_send));
+}
+
+static void s6e8ax0_gamma_update(struct mipi_dsim_device *dsim_dev)
+{
+       struct mipi_dsim_master_ops *ops = dsim_dev->master_ops;
+
+       ops->cmd_write(dsim_dev, MIPI_DSI_DCS_SHORT_WRITE_PARAM, 0xf7, 0x3);
+}
+
+static void s6e8ax0_etc_source_control(struct mipi_dsim_device *dsim_dev)
+{
+       struct mipi_dsim_master_ops *ops = dsim_dev->master_ops;
+       const unsigned char data_to_send[] = {
+               0xf6, 0x00, 0x02, 0x00
+       };
+
+       ops->cmd_write(dsim_dev, MIPI_DSI_DCS_LONG_WRITE,
+                       (unsigned int)data_to_send,
+                       ARRAY_SIZE(data_to_send));
+}
+
+static void s6e8ax0_etc_pentile_control(struct mipi_dsim_device *dsim_dev)
+{
+       struct mipi_dsim_master_ops *ops = dsim_dev->master_ops;
+       const unsigned char data_to_send[] = {
+               0xb6, 0x0c, 0x02, 0x03, 0x32, 0xff, 0x44, 0x44, 0xc0,
+               0x00
+       };
+
+       ops->cmd_write(dsim_dev, MIPI_DSI_DCS_LONG_WRITE,
+                       (unsigned int)data_to_send,
+                       ARRAY_SIZE(data_to_send));
+}
+
+static void s6e8ax0_etc_mipi_control1(struct mipi_dsim_device *dsim_dev)
+{
+       struct mipi_dsim_master_ops *ops = dsim_dev->master_ops;
+       const unsigned char data_to_send[] = {
+               0xe1, 0x10, 0x1c, 0x17, 0x08, 0x1d
+       };
+
+       ops->cmd_write(dsim_dev, MIPI_DSI_DCS_LONG_WRITE,
+                       (unsigned int)data_to_send,
+                       ARRAY_SIZE(data_to_send));
+}
+
+static void s6e8ax0_etc_mipi_control2(struct mipi_dsim_device *dsim_dev)
+{
+       struct mipi_dsim_master_ops *ops = dsim_dev->master_ops;
+       const unsigned char data_to_send[] = {
+               0xe2, 0xed, 0x07, 0xc3, 0x13, 0x0d, 0x03
+       };
+
+       ops->cmd_write(dsim_dev, MIPI_DSI_DCS_LONG_WRITE,
+                       (unsigned int)data_to_send,
+                       ARRAY_SIZE(data_to_send));
+}
+
+static void s6e8ax0_etc_power_control(struct mipi_dsim_device *dsim_dev)
+{
+       struct mipi_dsim_master_ops *ops = dsim_dev->master_ops;
+       const unsigned char data_to_send[] = {
+               0xf4, 0xcf, 0x0a, 0x12, 0x10, 0x19, 0x33, 0x02
+       };
+
+       ops->cmd_write(dsim_dev, MIPI_DSI_DCS_LONG_WRITE,
+               (unsigned int)data_to_send, ARRAY_SIZE(data_to_send));
+}
+
+static void s6e8ax0_etc_mipi_control3(struct mipi_dsim_device *dsim_dev)
+{
+       struct mipi_dsim_master_ops *ops = dsim_dev->master_ops;
+
+       ops->cmd_write(dsim_dev, MIPI_DSI_DCS_SHORT_WRITE_PARAM, 0xe3, 0x40);
+}
+
+static void s6e8ax0_etc_mipi_control4(struct mipi_dsim_device *dsim_dev)
+{
+       struct mipi_dsim_master_ops *ops = dsim_dev->master_ops;
+       const unsigned char data_to_send[] = {
+               0xe4, 0x00, 0x00, 0x14, 0x80, 0x00, 0x00, 0x00
+       };
+
+       ops->cmd_write(dsim_dev, MIPI_DSI_DCS_LONG_WRITE,
+               (unsigned int)data_to_send, ARRAY_SIZE(data_to_send));
+}
+
+static void s6e8ax0_elvss_set(struct mipi_dsim_device *dsim_dev)
+{
+       struct mipi_dsim_master_ops *ops = dsim_dev->master_ops;
+       const unsigned char data_to_send[] = {
+               0xb1, 0x04, 0x00
+       };
+
+       ops->cmd_write(dsim_dev, MIPI_DSI_DCS_LONG_WRITE,
+                       (unsigned int)data_to_send,
+                       ARRAY_SIZE(data_to_send));
+}
+
+static void s6e8ax0_display_on(struct mipi_dsim_device *dsim_dev)
+{
+       struct mipi_dsim_master_ops *ops = dsim_dev->master_ops;
+
+       ops->cmd_write(dsim_dev,
+               MIPI_DSI_DCS_SHORT_WRITE, 0x29, 0x00);
+}
+
+static void s6e8ax0_sleep_out(struct mipi_dsim_device *dsim_dev)
+{
+       struct mipi_dsim_master_ops *ops = dsim_dev->master_ops;
+
+       ops->cmd_write(dsim_dev,
+               MIPI_DSI_DCS_SHORT_WRITE, 0x11, 0x00);
+}
+
+static void s6e8ax0_apply_level1_key(struct mipi_dsim_device *dsim_dev)
+{
+       struct mipi_dsim_master_ops *ops = dsim_dev->master_ops;
+       const unsigned char data_to_send[] = {
+               0xf0, 0x5a, 0x5a
+       };
+
+       ops->cmd_write(dsim_dev, MIPI_DSI_DCS_LONG_WRITE,
+               (unsigned int)data_to_send, ARRAY_SIZE(data_to_send));
+}
+
+static void s6e8ax0_apply_mtp_key(struct mipi_dsim_device *dsim_dev)
+{
+       struct mipi_dsim_master_ops *ops = dsim_dev->master_ops;
+       const unsigned char data_to_send[] = {
+               0xf1, 0x5a, 0x5a
+       };
+
+       ops->cmd_write(dsim_dev, MIPI_DSI_DCS_LONG_WRITE,
+               (unsigned int)data_to_send, ARRAY_SIZE(data_to_send));
+}
+
+static void s6e8ax0_panel_init(struct mipi_dsim_device *dsim_dev)
+{
+       /*
+        * in case of setting gamma and panel condition at first,
+        * it shuold be setting like below.
+        * set_gamma() -> set_panel_condition()
+        */
+
+       s6e8ax0_apply_level1_key(dsim_dev);
+       s6e8ax0_apply_mtp_key(dsim_dev);
+
+       s6e8ax0_sleep_out(dsim_dev);
+       mdelay(5);
+       s6e8ax0_panel_cond(dsim_dev);
+       s6e8ax0_display_cond(dsim_dev);
+       s6e8ax0_gamma_cond(dsim_dev);
+       s6e8ax0_gamma_update(dsim_dev);
+
+       s6e8ax0_etc_source_control(dsim_dev);
+       s6e8ax0_elvss_set(dsim_dev);
+       s6e8ax0_etc_pentile_control(dsim_dev);
+       s6e8ax0_etc_mipi_control1(dsim_dev);
+       s6e8ax0_etc_mipi_control2(dsim_dev);
+       s6e8ax0_etc_power_control(dsim_dev);
+       s6e8ax0_etc_mipi_control3(dsim_dev);
+       s6e8ax0_etc_mipi_control4(dsim_dev);
+}
+
+static int s6e8ax0_panel_set(struct mipi_dsim_device *dsim_dev)
+{
+       s6e8ax0_panel_init(dsim_dev);
+
+       return 0;
+}
+
+static void s6e8ax0_display_enable(struct mipi_dsim_device *dsim_dev)
+{
+       s6e8ax0_display_on(dsim_dev);
+}
+
+static struct mipi_dsim_lcd_driver s6e8ax0_dsim_ddi_driver = {
+       .name = "s6e8ax0",
+       .id = -1,
+
+       .mipi_panel_init = s6e8ax0_panel_set,
+       .mipi_display_on = s6e8ax0_display_enable,
+};
+
+void s6e8ax0_init(void)
+{
+       exynos_mipi_dsi_register_lcd_driver(&s6e8ax0_dsim_ddi_driver);
+}
index 914e479fb2aa6a765d09baef84174f04e2404718..67b2997483a31cde90ec1fc0aa991d25e64b5340 100644 (file)
@@ -47,8 +47,8 @@ DT_BIN        := $(obj)dt.dtb
 
 $(DT_BIN): $(TOPDIR)/board/$(VENDOR)/dts/$(DEVICE_TREE).dts
        rc=$$( \
-               cat $< | $(CPP) -P $(DTS_CPPFLAGS) - | \
-               { { $(DTC) -R 4 -p 0x1000 -O dtb -o ${DT_BIN} - 2>&1 ; \
+               cat $< | $(CPP) -P -x assembler-with-cpp $(DTS_CPPFLAGS) - | \
+               { { $(DTC) -R 4 -p 0x1000 -O dtb -o ${DT_BIN} - >&2 ; \
                    echo $$? >&3 ; } | \
                  grep -v '^DTC: dts->dtb  on file' ; \
                } 3>&1 ) ; \
@@ -66,18 +66,17 @@ $(obj)dt.o: $(DT_BIN)
        # We look in the LDSCRIPT first.
        # Then try the linker which should give us the answer.
        # Then check it worked.
-       oformat=`$(call process_lds,cat $(LDSCRIPT),FORMAT)` ;\
-       oarch=`$(call process_lds,cat $(LDSCRIPT),ARCH)` ;\
-       \
-       [ -z $${oformat} ] && \
+       [ -n "$${LDSCRIPT}" ] && oformat=`$(call process_lds,cat $(LDSCRIPT),FORMAT)` &&\
+               oarch=`$(call process_lds,cat $(LDSCRIPT),ARCH)` ;\
+       [ -z "$${oformat}" ] && \
                oformat=`$(call process_lds,$(GET_LDS),FORMAT)` ;\
-       [ -z $${oarch} ] && \
+       [ -z "$${oarch}" ] && \
                oarch=`$(call process_lds,$(GET_LDS),ARCH)` ;\
        \
-       [ -z $${oformat} ] && \
+       [ -z "$${oformat}" ] && \
                echo "Cannot read OUTPUT_FORMAT from lds file $(LDSCRIPT)" && \
                exit 1 || true ;\
-       [ -z $${oarch} ] && \
+       [ -z "$${oarch}" ] && \
                echo "Cannot read OUTPUT_ARCH from lds file $(LDSCRIPT)" && \
                exit 1 || true ;\
        \
diff --git a/include/aes.h b/include/aes.h
new file mode 100644 (file)
index 0000000..41b0db2
--- /dev/null
@@ -0,0 +1,70 @@
+/*
+ * Copyright (c) 2011 The Chromium OS Authors.
+ * (C) Copyright 2010 - 2011 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 _AES_REF_H_
+#define _AES_REF_H_
+
+/*
+ * AES encryption library, with small code size, supporting only 128-bit AES
+ *
+ * AES is a stream cipher which works a block at a time, with each block
+ * in this case being AES_KEY_LENGTH bytes.
+ */
+
+enum {
+       AES_STATECOLS   = 4,    /* columns in the state & expanded key */
+       AES_KEYCOLS     = 4,    /* columns in a key */
+       AES_ROUNDS      = 10,   /* rounds in encryption */
+
+       AES_KEY_LENGTH  = 128 / 8,
+       AES_EXPAND_KEY_LENGTH   = 4 * AES_STATECOLS * (AES_ROUNDS + 1),
+};
+
+/**
+ * Expand a key into a key schedule, which is then used for the other
+ * operations.
+ *
+ * \param key          Key, of length AES_KEY_LENGTH bytes
+ * \param expkey       Buffer to place expanded key, AES_EXPAND_KEY_LENGTH
+ */
+void aes_expand_key(u8 *key, u8 *expkey);
+
+/**
+ * Encrypt a single block of data
+ *
+ * in          Input data
+ * expkey      Expanded key to use for encryption (from aes_expand_key())
+ * out         Output data
+ */
+void aes_encrypt(u8 *in, u8 *expkey, u8 *out);
+
+/**
+ * Decrypt a single block of data
+ *
+ * in          Input data
+ * expkey      Expanded key to use for decryption (from aes_expand_key())
+ * out         Output data
+ */
+void aes_decrypt(u8 *in, u8 *expkey, u8 *out);
+
+#endif /* _AES_REF_H_ */
index 465ea7fcbbb020d6384342076e42153fa8cc6616..d9563f48a13e3385ae757c119b49d6ecc58ab4a8 100644 (file)
@@ -1,4 +1,7 @@
 /*
+ * (C) Copyright 2008-2010 Freescale Semiconductor, Inc.
+ * Terry Lv <r65388@freescale.com>
+ *
  * Copyright (C) Freescale Semiconductor, Inc. 2006.
  * Author: Jason Jin<Jason.jin@freescale.com>
  *         Zhang Wei<wei.zhang@freescale.com>
 
 #define AHCI_PCI_BAR           0x24
 #define AHCI_MAX_SG            56 /* hardware max is 64K */
+#define AHCI_MAX_CMD_SLOT      32
 #define AHCI_CMD_SLOT_SZ       32
+#define AHCI_MAX_CMD_SLOT      32
 #define AHCI_RX_FIS_SZ         256
 #define AHCI_CMD_TBL_HDR       0x80
 #define AHCI_CMD_TBL_CDB       0x40
-#define AHCI_CMD_TBL_SZ                AHCI_CMD_TBL_HDR + (AHCI_MAX_SG * 16)
-#define AHCI_PORT_PRIV_DMA_SZ  AHCI_CMD_SLOT_SZ + AHCI_CMD_TBL_SZ      \
-                               + AHCI_RX_FIS_SZ
+#define AHCI_CMD_TBL_SZ                (AHCI_CMD_TBL_HDR + (AHCI_MAX_SG * 16))
+#define AHCI_PORT_PRIV_DMA_SZ  (AHCI_CMD_SLOT_SZ * AHCI_MAX_CMD_SLOT + \
+                               AHCI_CMD_TBL_SZ + AHCI_RX_FIS_SZ)
 #define AHCI_CMD_ATAPI         (1 << 5)
 #define AHCI_CMD_WRITE         (1 << 6)
 #define AHCI_CMD_PREFETCH      (1 << 7)
@@ -181,7 +186,7 @@ struct ahci_probe_ent {
        u32     host_flags;
        u32     host_set_flags;
        u32     mmio_base;
-       u32     pio_mask;
+       u32     pio_mask;
        u32     udma_mask;
        u32     flags;
        u32     cap;    /* cache of HOST_CAP register */
diff --git a/include/asm-arm/fec.h b/include/asm-arm/fec.h
new file mode 100644 (file)
index 0000000..60a7690
--- /dev/null
@@ -0,0 +1,284 @@
+/*
+ * fec.h -- Fast Ethernet Controller definitions
+ *
+ * Some definitions copied from commproc.h for MPC8xx:
+ * MPC8xx Communication Processor Module.
+ * Copyright (c) 1997 Dan Malek (dmalek@jlc.net)
+ *
+ * Add FEC Structure and definitions
+ * Copyright 2004-2010 Freescale Semiconductor, Inc.
+ * TsiChung Liew (Tsi-Chung.Liew@freescale.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        fec_h
+#define        fec_h
+
+extern int fec_get_mac_addr(unsigned char *mac);
+
+#include <net.h>
+
+/* Buffer descriptors used FEC.
+*/
+typedef struct cpm_buf_desc {
+       ushort cbd_datlen;      /* Data length in buffer */
+       ushort cbd_sc;          /* Status and Control */
+       ulong cbd_bufaddr;      /* Buffer address in host memory */
+} cbd_t;
+
+#define BD_SC_EMPTY            ((ushort)0x8000)        /* Recieve is empty */
+#define BD_SC_READY            ((ushort)0x8000)        /* Transmit is ready */
+#define BD_SC_WRAP             ((ushort)0x2000)/* Last buffer descriptor */
+#define BD_SC_INTRPT           ((ushort)0x1000)/* Interrupt on change */
+#define BD_SC_LAST             ((ushort)0x0800)/* Last buffer in frame */
+#define BD_SC_TC               ((ushort)0x0400)        /* Transmit CRC */
+#define BD_SC_CM               ((ushort)0x0200)        /* Continous mode */
+#define BD_SC_ID               ((ushort)0x0100)/* Rec'd too many idles */
+#define BD_SC_P                        ((ushort)0x0100)        /* xmt preamble */
+#define BD_SC_BR               ((ushort)0x0020)        /* Break received */
+#define BD_SC_FR               ((ushort)0x0010)        /* Framing error */
+#define BD_SC_PR               ((ushort)0x0008)        /* Parity error */
+#define BD_SC_OV               ((ushort)0x0002)        /* Overrun */
+#define BD_SC_CD               ((ushort)0x0001)/* Carrier Detect lost */
+
+/* Buffer descriptor control/status used by Ethernet receive.
+*/
+#define BD_ENET_RX_EMPTY       ((ushort)0x8000)
+#define BD_ENET_RX_RO1         ((ushort)0x4000)
+#define BD_ENET_RX_WRAP                ((ushort)0x2000)
+#define BD_ENET_RX_INTR                ((ushort)0x1000)
+#define BD_ENET_RX_RO2         BD_ENET_RX_INTR
+#define BD_ENET_RX_LAST                ((ushort)0x0800)
+#define BD_ENET_RX_FIRST       ((ushort)0x0400)
+#define BD_ENET_RX_MISS                ((ushort)0x0100)
+#define BD_ENET_RX_BC          ((ushort)0x0080)
+#define BD_ENET_RX_MC          ((ushort)0x0040)
+#define BD_ENET_RX_LG          ((ushort)0x0020)
+#define BD_ENET_RX_NO          ((ushort)0x0010)
+#define BD_ENET_RX_SH          ((ushort)0x0008)
+#define BD_ENET_RX_CR          ((ushort)0x0004)
+#define BD_ENET_RX_OV          ((ushort)0x0002)
+#define BD_ENET_RX_CL          ((ushort)0x0001)
+#define BD_ENET_RX_TR          BD_ENET_RX_CL
+#define BD_ENET_RX_STATS       ((ushort)0x013f)        /* All status bits */
+
+/* Buffer descriptor control/status used by Ethernet transmit.
+*/
+#define BD_ENET_TX_READY       ((ushort)0x8000)
+#define BD_ENET_TX_PAD         ((ushort)0x4000)
+#define BD_ENET_TX_TO1         BD_ENET_TX_PAD
+#define BD_ENET_TX_WRAP                ((ushort)0x2000)
+#define BD_ENET_TX_INTR                ((ushort)0x1000)
+#define BD_ENET_TX_TO2         BD_ENET_TX_INTR_
+#define BD_ENET_TX_LAST                ((ushort)0x0800)
+#define BD_ENET_TX_TC          ((ushort)0x0400)
+#define BD_ENET_TX_DEF         ((ushort)0x0200)
+#define BD_ENET_TX_ABC         BD_ENET_TX_DEF
+#define BD_ENET_TX_HB          ((ushort)0x0100)
+#define BD_ENET_TX_LC          ((ushort)0x0080)
+#define BD_ENET_TX_RL          ((ushort)0x0040)
+#define BD_ENET_TX_RCMASK      ((ushort)0x003c)
+#define BD_ENET_TX_UN          ((ushort)0x0002)
+#define BD_ENET_TX_CSL         ((ushort)0x0001)
+#define BD_ENET_TX_STATS       ((ushort)0x03ff)        /* All status bits */
+
+/*********************************************************************
+* Fast Ethernet Controller (FEC)
+*********************************************************************/
+/* FEC private information */
+struct fec_info_s {
+       int index;
+       volatile void *iobase;
+       int phy_addr;
+       int dup_spd;
+       char *phy_name;
+       int phyname_init;
+       cbd_t *rxbd;            /* Rx BD */
+       cbd_t *txbd;            /* Tx BD */
+       uint rxIdx;
+       uint txIdx;
+       char *txbuf;
+#ifdef CONFIG_ARCH_MMU
+       char *rxbuf[PKTBUFSRX];
+#endif
+       int initialized;
+       struct fec_info_s *next;
+};
+
+/* Register read/write struct */
+typedef struct fec {
+       u32 resv0;
+       u32 eir;
+       u32 eimr;
+       u32 resv1;
+       u32 rdar;
+       u32 tdar;
+       u32 resv2[0x03];
+       u32 ecr;
+       u32 resv3[0x06];
+       u32 mmfr;
+       u32 mscr;
+       u32 resv4[0x07];
+       u32 mibc;
+       u32 resv5[0x07];
+       u32 rcr;
+       u32 resv6[0x0F];
+       u32 tcr;
+       u32 resv7[0x07];
+       u32 palr;
+       u32 paur;
+       u32 opd;
+       u32 resv8[0x0A];
+       u32 iaur;
+       u32 ialr;
+       u32 gaur;
+       u32 galr;
+       u32 resv9[0x07];
+       u32 tfwr;
+       u32 resv10;
+       u32 frbr;
+       u32 frsr;
+       u32 resv11[0x0B];
+       u32 erdsr;
+       u32 etdsr;
+       u32 emrbr;
+       u32 resv12[93];
+       u32 fec_miigsk_cfgr;
+       u32 fec_reserved13;
+       u32 fec_miigsk_enr;
+} fec_t;
+
+/*********************************************************************
+* Fast Ethernet Controller (FEC)
+*********************************************************************/
+/* Bit definitions and macros for FEC_EIR */
+#define FEC_EIR_CLEAR_ALL              (0xFFF80000)
+#define FEC_EIR_HBERR                  (0x80000000)
+#define FEC_EIR_BABR                   (0x40000000)
+#define FEC_EIR_BABT                   (0x20000000)
+#define FEC_EIR_GRA                    (0x10000000)
+#define FEC_EIR_TXF                    (0x08000000)
+#define FEC_EIR_TXB                    (0x04000000)
+#define FEC_EIR_RXF                    (0x02000000)
+#define FEC_EIR_RXB                    (0x01000000)
+#define FEC_EIR_MII                    (0x00800000)
+#define FEC_EIR_EBERR                  (0x00400000)
+#define FEC_EIR_LC                     (0x00200000)
+#define FEC_EIR_RL                     (0x00100000)
+#define FEC_EIR_UN                     (0x00080000)
+
+/* Bit definitions and macros for FEC_RDAR */
+#define FEC_RDAR_R_DES_ACTIVE          (0x01000000)
+
+/* Bit definitions and macros for FEC_TDAR */
+#define FEC_TDAR_X_DES_ACTIVE          (0x01000000)
+
+/* Bit definitions and macros for FEC_ECR */
+#define FEC_ECR_ETHER_EN               (0x00000002)
+#define FEC_ECR_RESET                  (0x00000001)
+
+/* Bit definitions and macros for FEC_MMFR */
+#define FEC_MMFR_DATA(x)               (((x)&0xFFFF))
+#define FEC_MMFR_ST(x)                 (((x)&0x03)<<30)
+#define FEC_MMFR_ST_01                 (0x40000000)
+#define FEC_MMFR_OP_RD                 (0x20000000)
+#define FEC_MMFR_OP_WR                 (0x10000000)
+#define FEC_MMFR_PA(x)                 (((x)&0x1F)<<23)
+#define FEC_MMFR_RA(x)                 (((x)&0x1F)<<18)
+#define FEC_MMFR_TA(x)                 (((x)&0x03)<<16)
+#define FEC_MMFR_TA_10                 (0x00020000)
+
+/* Bit definitions and macros for FEC_MSCR */
+#define FEC_MSCR_DIS_PREAMBLE          (0x00000080)
+#define FEC_MSCR_MII_SPEED(x)          (((x)&0x3F)<<1)
+
+/* Bit definitions and macros for FEC_MIBC */
+#define FEC_MIBC_MIB_DISABLE           (0x80000000)
+#define FEC_MIBC_MIB_IDLE              (0x40000000)
+
+/* Bit definitions and macros for FEC_RCR */
+#define FEC_RCR_GRS                    (0x80000000)
+#define FEC_RCR_NO_LGTH_CHECK          (0x40000000)
+#define FEC_RCR_MAX_FL(x)              (((x)&0x7FF)<<16)
+#define FEC_RCR_CNTL_FRM_ENA           (0x00008000)
+#define FEC_RCR_CRC_FWD                        (0x00004000)
+#define FEC_RCR_PAUSE_FWD              (0x00002000)
+#define FEC_RCR_PAD_EN                 (0x00001000)
+#define FEC_RCR_RMII_ECHO              (0x00000800)
+#define FEC_RCR_RMII_LOOP              (0x00000400)
+#define FEC_RCR_RMII_10T               (0x00000200)
+#define FEC_RCR_RMII_MODE              (0x00000100)
+#define FEC_RCR_SGMII_ENA              (0x00000080)
+#define FEC_RCR_RGMII_ENA              (0x00000040)
+#define FEC_RCR_FCE                    (0x00000020)
+#define FEC_RCR_BC_REJ                 (0x00000010)
+#define FEC_RCR_PROM                   (0x00000008)
+#define FEC_RCR_MII_MODE               (0x00000004)
+#define FEC_RCR_DRT                    (0x00000002)
+#define FEC_RCR_LOOP                   (0x00000001)
+
+/* Bit definitions and macros for FEC_TCR */
+#define FEC_TCR_RFC_PAUSE              (0x00000010)
+#define FEC_TCR_TFC_PAUSE              (0x00000008)
+#define FEC_TCR_FDEN                   (0x00000004)
+#define FEC_TCR_HBC                    (0x00000002)
+#define FEC_TCR_GTS                    (0x00000001)
+
+/* Bit definitions and macros for FEC_PAUR */
+#define FEC_PAUR_PADDR2(x)             (((x)&0xFFFF)<<16)
+#define FEC_PAUR_TYPE(x)               ((x)&0xFFFF)
+
+/* Bit definitions and macros for FEC_OPD */
+#define FEC_OPD_PAUSE_DUR(x)           (((x)&0x0000FFFF)<<0)
+#define FEC_OPD_OPCODE(x)              (((x)&0x0000FFFF)<<16)
+
+/* Bit definitions and macros for FEC_TFWR */
+#define FEC_TFWR_X_WMRK(x)             ((x)&0x03)
+#define FEC_TFWR_X_WMRK_64             (0x01)
+#define FEC_TFWR_X_WMRK_128            (0x02)
+#define FEC_TFWR_X_WMRK_192            (0x03)
+
+/* Bit definitions and macros for FEC_FRBR */
+#define FEC_FRBR_R_BOUND(x)            (((x)&0xFF)<<2)
+
+/* Bit definitions and macros for FEC_FRSR */
+#define FEC_FRSR_R_FSTART(x)           (((x)&0xFF)<<2)
+
+/* Bit definitions and macros for FEC_ERDSR */
+#define FEC_ERDSR_R_DES_START(x)       (((x)&0x3FFFFFFF)<<2)
+
+/* Bit definitions and macros for FEC_ETDSR */
+#define FEC_ETDSR_X_DES_START(x)       (((x)&0x3FFFFFFF)<<2)
+
+/* Bit definitions and macros for FEC_EMRBR */
+#define FEC_EMRBR_R_BUF_SIZE(x)                (((x)&0x7F)<<4)
+
+#define        FEC_RESET_DELAY                 100
+#define FEC_RX_TOUT                    100
+
+#define FEC_MAX_TIMEOUT                        50000
+#define FEC_TIMEOUT_TICKET             2
+
+/*
+ * Functions
+ */
+int mxc_fec_initialize(bd_t *bis);
+
+#endif                         /* fec_h */
diff --git a/include/asm-arm/mmu.h b/include/asm-arm/mmu.h
new file mode 100644 (file)
index 0000000..f1b7574
--- /dev/null
@@ -0,0 +1,118 @@
+/*
+ * Copyright 2004-2010 Freescale Semiconductor, Inc. All Rights Reserved.
+ */
+
+/*
+ * The code contained herein is licensed under the GNU General Public
+ * License. You may obtain a copy of the GNU General Public License
+ * Version 2 or later at the following locations:
+ *
+ * http://www.opensource.org/licenses/gpl-license.html
+ * http://www.gnu.org/copyleft/gpl.html
+ */
+
+#ifndef __ASM_MMU_H
+#define __ASM_MMU_H
+
+#include <asm/system.h>
+
+#define MMU_L1_TYPE         0x03  /* Descriptor type */
+#define MMU_L1_TYPE_Fault   0x00  /* Invalid */
+#define MMU_L1_TYPE_Page    0x11  /* Individual page mapping */
+#define MMU_L1_TYPE_Section 0x12  /* Mapping for 1M segment */
+
+#define MMU_L2_TYPE         0x03  /* Descriptor type */
+#define MMU_L2_TYPE_Fault   0x00  /* Invalid data */
+#define MMU_L2_TYPE_Large   0x01  /* Large page (64K) */
+#define MMU_L2_TYPE_Small   0x02  /* Small page (4K) */
+
+#define MMU_Bufferable      0x04  /* Data can use write-buffer */
+#define MMU_Cacheable       0x08  /* Data can use cache */
+
+#define MMU_AP_Limited     0x000  /* Limited access */
+#define MMU_AP_Supervisor  0x400  /* Supervisor RW, User none */
+#define MMU_AP_UserRead    0x800  /* Supervisor RW, User read only */
+#define MMU_AP_Any         0xC00  /* Supervisor RW, User RW */
+
+#define MMU_AP_ap0_Any     0x030
+#define MMU_AP_ap1_Any     0x0C0
+#define MMU_AP_ap2_Any     0x300
+#define MMU_AP_ap3_Any     0xC00
+#define MMU_AP_All (MMU_AP_ap0_Any|MMU_AP_ap1_Any|MMU_AP_ap2_Any|MMU_AP_ap3_Any)
+
+#define MMU_DOMAIN(x)      ((x)<<5)
+
+#define MMU_PAGE_SIZE      0x1000
+#define MMU_SECTION_SIZE   0x100000
+
+#define MMU_CP               p15      /* Co-processor ID */
+#define MMU_Control          c1       /* Control register */
+#define MMU_Base             c2       /* Page tables base */
+#define MMU_DomainAccess     c3       /* Domain access control */
+#define MMU_FaultStatus      c5       /* Fault status register */
+#define MMU_FaultAddress     c6       /* Fault Address */
+#define MMU_InvalidateCache  c7       /* Invalidate cache data */
+#define MMU_TLB              c8       /* Translation Lookaside Buffer */
+
+/* These seem to be 710 specific */
+#define MMU_FlushTLB         c5
+#define MMU_FlushIDC         c7
+
+#define MMU_Control_M  0x001    /* Enable MMU */
+#define MMU_Control_A  0x002    /* Enable address alignment faults */
+#define MMU_Control_C  0x004    /* Enable cache */
+#define MMU_Control_W  0x008    /* Enable write-buffer */
+#define MMU_Control_P  0x010    /* Compatability: 32 bit code */
+#define MMU_Control_D  0x020    /* Compatability: 32 bit data */
+#define MMU_Control_L  0x040    /* Compatability: */
+#define MMU_Control_B  0x080    /* Enable Big-Endian */
+#define MMU_Control_S  0x100    /* Enable system protection */
+#define MMU_Control_R  0x200    /* Enable ROM protection */
+#define MMU_Control_I  0x1000   /* Enable Instruction cache */
+#define MMU_Control_X  0x2000   /* Set interrupt vectors at 0xFFFF0000 */
+#define MMU_Control_Init (MMU_Control_P|MMU_Control_D|MMU_Control_L)
+
+/* Extras for some newer versions eg. ARM920 with architecture version 4. */
+#define MMU_Control_F  0x400    /* IMPLEMENTATION DEFINED */
+#define MMU_Control_Z  0x800    /* Enable branch predicion */
+#define MMU_Control_RR 0x4000   /* Select non-random cache replacement */
+
+#ifdef CONFIG_ARCH_MMU
+
+#define MMU_ON()       \
+       {       \
+       unsigned long cr = 0;   \
+       asm volatile ("mrc p15, 0, %0, c1, c0;" : "=r"(cr) : /*:*/);    \
+       cr |= (CR_M | CR_A | CR_C | CR_Z);      \
+       asm volatile ("mcr p15, 0, %0, c1, c0;" : : "r"(cr) /*:*/);     \
+       /* Clean instruction pipeline */        \
+       asm volatile (  \
+               "b skip;"       \
+               "nop;"  \
+               "nop;"  \
+               "nop;"  \
+               "skip:" \
+       );      \
+       }
+
+#define MMU_OFF()      \
+       {       \
+       unsigned long cr = 0;   \
+       asm volatile ("mrc p15, 0, %0, c1, c0;" : "=r"(cr) /*: :*/);    \
+       cr &= (~(CR_M | CR_A | CR_C | CR_I));   \
+       asm volatile ("mcr p15, 0, %0, c1, c0;" : : "r"(cr) /*:*/);     \
+       asm volatile (  \
+               "nop;" /* flush i+d-TLBs */      \
+               "nop;" /* flush i+d-TLBs */      \
+               "nop;" /* flush i+d-TLBs */     \
+       );      \
+       }
+
+#else
+
+#define MMU_ON()
+#define MMU_OFF()
+
+#endif
+
+#endif
index c19e16cd21dc80cab6c42bfb9a2671ce908231dd..e003103e3c8b91464237a8d21ddd11f309458b16 100644 (file)
  * an error value of -1.
  */
 
+enum gpio_flags {
+       GPIOF_INPUT,
+       GPIOF_OUTPUT_INIT_LOW,
+       GPIOF_OUTPUT_INIT_HIGH,
+};
+
+struct gpio {
+       unsigned int gpio;
+       enum gpio_flags flags;
+       const char *label;
+};
+
 /**
  * Request ownership of a GPIO.
  *
@@ -94,4 +106,25 @@ int gpio_get_value(unsigned gpio);
  */
 int gpio_set_value(unsigned gpio, int value);
 
+/**
+ * Request a GPIO and configure it
+ * @param gpios        pointer to array of gpio defs
+ * @param count        number of GPIOs to set up
+ */
+int gpio_request_one(unsigned gpio, enum gpio_flags flags, const char *label);
+
+/**
+ * Request a set of GPIOs and configure them
+ * @param gpios        pointer to array of gpio defs
+ * @param count        number of GPIOs to set up
+ */
+int gpio_request_array(const struct gpio *gpios, int count);
+
+/**
+ * Release a set of GPIOs
+ * @param gpios        pointer to array of gpio defs
+ * @param count        number of GPIOs to set up
+ */
+int gpio_free_array(const struct gpio *gpios, int count);
+
 #endif /* _ASM_GENERIC_GPIO_H_ */
index 4b5841ef47015925cd78cebe5c2e0c07ac8445af..ff7126d35d836b53d8153c6063904b92b4407299 100644 (file)
@@ -222,6 +222,31 @@ typedef void (interrupt_handler_t)(void *);
 #define MIN(x, y)  min(x, y)
 #define MAX(x, y)  max(x, y)
 
+/*
+ * Return the absolute value of a number.
+ *
+ * This handles unsigned and signed longs, ints, shorts and chars.  For all
+ * input types abs() returns a signed long.
+ *
+ * For 64-bit types, use abs64()
+ */
+#define abs(x) ({                                              \
+               long ret;                                       \
+               if (sizeof(x) == sizeof(long)) {                \
+                       long __x = (x);                         \
+                       ret = (__x < 0) ? -__x : __x;           \
+               } else {                                        \
+                       int __x = (x);                          \
+                       ret = (__x < 0) ? -__x : __x;           \
+               }                                               \
+               ret;                                            \
+       })
+
+#define abs64(x) ({                            \
+               s64 __x = (x);                  \
+               (__x < 0) ? -__x : __x;         \
+       })
+
 #if defined(CONFIG_ENV_IS_EMBEDDED)
 #define TOTAL_MALLOC_LEN       CONFIG_SYS_MALLOC_LEN
 #elif ( ((CONFIG_ENV_ADDR+CONFIG_ENV_SIZE) < CONFIG_SYS_MONITOR_BASE) || \
index e057b1f9459002dfd7155eabefda5c743f3f5078..e632d1bd37ea0c40102aa531fe54885ebe59ea59 100644 (file)
@@ -310,9 +310,6 @@ extern unsigned long get_clock_freq(void);
 #define CONFIG_OF_BOARD_SETUP
 #define CONFIG_OF_STDOUT_VIA_ALIAS
 
-#define CONFIG_SYS_64BIT_VSPRINTF
-#define CONFIG_SYS_64BIT_STRTOUL
-
 /* new uImage format support */
 #define CONFIG_FIT
 #define CONFIG_FIT_VERBOSE     /* enable fit_format_{error,warning}() */
index 365322c6a59788bffaa4cfc3e3a8cdeae74057f8..28122ecc11527fa648489332ec882ac6b790a0c6 100644 (file)
@@ -416,8 +416,6 @@ extern unsigned long get_board_sys_clk(unsigned long dummy);
 #endif
 
 /* Misc Extra Settings */
-#define CONFIG_SYS_64BIT_VSPRINTF      1
-#define CONFIG_SYS_64BIT_STRTOUL       1
 #define CONFIG_CMD_DHCP                        1
 
 #define CONFIG_CMD_DATE                        1
index b0dd2f0af61ff1f2ceb9ad8386909791e1b9b67a..1233985aa6da5577239b6c35937d3d52be044fb7 100644 (file)
 
 #define CONFIG_SYS_MAX_NAND_DEVICE     1               /* Max number of */
                                                        /* NAND devices */
-#define CONFIG_SYS_64BIT_VSPRINTF              /* needed for nand_util.c */
 
 #define CONFIG_JFFS2_NAND
 /* nand device jffs2 lives on */
 #define CONFIG_SPL
 #define CONFIG_SPL_NAND_SIMPLE
 #define CONFIG_SPL_TEXT_BASE           0x40200800
-#define CONFIG_SPL_MAX_SIZE            (45 * 1024)
+#define CONFIG_SPL_MAX_SIZE            (54 * 1024)     /* 8 KB for stack */
 #define CONFIG_SPL_STACK               LOW_LEVEL_SRAM_STACK
 
 #define CONFIG_SPL_BSS_START_ADDR      0x80000000
index b5f75d1e8da7a39704ebef21409479792f28633c..ff8d1b013924258640a3e924333eba235fe99e89 100644 (file)
 
 #define CONFIG_SYS_MAX_NAND_DEVICE     1               /* Max number of */
                                                        /* NAND devices */
-#define CONFIG_SYS_64BIT_VSPRINTF              /* needed for nand_util.c */
-
 #define CONFIG_JFFS2_NAND
 /* nand device jffs2 lives on */
 #define CONFIG_JFFS2_DEV               "nand0"
 #define CONFIG_SPL
 #define CONFIG_SPL_NAND_SIMPLE
 #define CONFIG_SPL_TEXT_BASE           0x40200800
-#define CONFIG_SPL_MAX_SIZE            (45 * 1024)
+#define CONFIG_SPL_MAX_SIZE            (54 * 1024)     /* 8 KB for stack */
 #define CONFIG_SPL_STACK               LOW_LEVEL_SRAM_STACK
 
 #define CONFIG_SPL_BSS_START_ADDR      0x80000000
index 83992461f906c4a2e29ffd70382d9fe92f36fecb..f424e5a5bd77331f282c8d4165304929f8ef92a8 100644 (file)
 #define CONFIG_SYS_NAND_MASK_CLE               (1 << 22)
 #define CONFIG_SYS_NAND_ENABLE_PIN             AT91_PIN_PD15
 #define CONFIG_SYS_NAND_READY_PIN              AT91_PIN_PA22
-
-#define CONFIG_SYS_64BIT_VSPRINTF              /* needed for nand_util.c */
 #endif
 
 /* Ethernet */
index 99856ebfdf2dcc84063dab26b84ac8bd8c5e292c..71faf1cc9ff2bbbe67eb44a40e63ebb41d536916 100644 (file)
@@ -37,7 +37,7 @@
 
 #define CONFIG_HOSTNAME                        cam_enc_4xx
 
-#define        BOARD_LATE_INIT
+#define        CONFIG_BOARD_LATE_INIT
 #define CONFIG_CAM_ENC_LED_MASK                0x0fc00000
 
 /* Memory Info */
index fe91c10409b2cff78f51d9b6223e4c1114f80594..b28bd8e3139f05511cecf7af3ee42d6e69c81cb1 100644 (file)
 #define CONFIG_DRIVER_OMAP34XX_I2C
 #define CONFIG_SYS_I2C_EEPROM_ADDR     0x50
 #define CONFIG_SYS_I2C_EEPROM_ADDR_LEN 1
+#define CONFIG_I2C_MULTI_BUS
 
 /*
  * TWL4030
index 4532e4f4fdd18fe6b2322654a65cb3a87ddb295a..781878ef399af8ad3917329b2a848a491bd075eb 100644 (file)
 #define CONFIG_SYS_NAND_CS             3
 #define CONFIG_SYS_NAND_BASE           DAVINCI_ASYNC_EMIF_DATA_CE3_BASE
 #define CONFIG_SYS_NAND_PAGE_2K
-#define CONFIG_SYS_64BIT_VSPRINTF      /* needed for nand_util.c */
 #define CONFIG_SYS_CLE_MASK            0x10
 #define CONFIG_SYS_ALE_MASK            0x8
 #define CONFIG_SYS_MAX_NAND_DEVICE     1 /* Max number of NAND devices */
index eb7c376780dc476680664f166092d1a04ba20f9f..248a5b2fa36c3d5a1d2cbda9d21bc6af1e80ef15 100644 (file)
 #define CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR 0x300 /* address 0x60000 */
 
 #define CONFIG_SPL_TEXT_BASE           0x40200000 /*CONFIG_SYS_SRAM_START*/
-#define CONFIG_SPL_MAX_SIZE            0xB400  /* 45 K */
+#define CONFIG_SPL_MAX_SIZE            (54 * 1024)     /* 8 KB for stack */
 #define CONFIG_SPL_STACK               LOW_LEVEL_SRAM_STACK
 
 #define CONFIG_SPL_BSS_START_ADDR       0x80000500 /* leave space for bootargs*/
index e059b308266d3abaaa037deae23fd789562b0297..88b085d4a7af009ec2ed3cd578a5bb4be5dfd128 100644 (file)
@@ -31,7 +31,7 @@
 #define        CONFIG_SYS_USE_NAND
 #define CONFIG_DRIVER_TI_EMAC_USE_RMII
 #define CONFIG_BOARD_EARLY_INIT_F
-#define BOARD_LATE_INIT
+#define CONFIG_BOARD_LATE_INIT
 #define CONFIG_VIDEO
 #define CONFIG_PREBOOT
 
 #define CONFIG_SYS_NAND_4BIT_HW_ECC_OOBFIRST
 #define        CONFIG_SYS_NAND_USE_FLASH_BBT
 #define CONFIG_SYS_MAX_NAND_DEVICE     1 /* Max number of NAND devices */
-#define CONFIG_SYS_64BIT_VSPRINTF      /* needed for nand_util.c */
 #endif
 
 /* SPI Flash */
index eb05e2a0b06cc390c6d60ecee7e83996cb7e9dc6..21c471adf6c762364f3844c93748dcdfe7b18e7d 100644 (file)
 #define CONFIG_SYS_NAND_BASE           0x40000000
 #define CONFIG_SYS_NAND_DBW_8          1
 
-#define CONFIG_SYS_64BIT_VSPRINTF      1
-
 /* Status LED's */
 
 #define CONFIG_STATUS_LED              1
index f046a587bec2570391b3e9d7f5b5a85e9d528a5b..dd7c73f3c7bb38c27cb768f5ca6799735a593312 100644 (file)
@@ -48,8 +48,6 @@
 /* Set TEXT at the beginning of the NOR flash */
 #define CONFIG_SYS_TEXT_BASE   0xA0000000
 
-#define CONFIG_SYS_64BIT_VSPRINTF
-
 /* This is required to setup the ESDC controller */
 #define CONFIG_BOARD_EARLY_INIT_F
 
index 085937138798c2f9c132b3c2f0d0b0e5b1aa70f6..6d2d4fb91d7eb3d79e9aeb60569d9cf78bad11d9 100644 (file)
 #define CFG_DAVINCI_STD_NAND_LAYOUT
 #define CONFIG_SYS_NAND_CS             3
 #define CONFIG_SYS_NAND_PAGE_2K
-#define CONFIG_SYS_64BIT_VSPRINTF      /* needed for nand_util.c */
 /* Max number of NAND devices */
 #define CONFIG_SYS_MAX_NAND_DEVICE     1
 #define CONFIG_SYS_NAND_BASE_LIST      { 0x62000000, }
index d2b4b849290e5e1ba6746e539984072c38ca1e08..a99f332a85696f120614075a6ab43eb6f465e7da 100644 (file)
        "loadaddr=0x82000000\0" \
        "usbtty=cdc_acm\0" \
        "console=ttyS2,115200n8\0" \
-       "mpurate=500\0" \
+       "mpurate=auto\0" \
        "vram=12M\0" \
        "dvimode=1024x768MR-16@60\0" \
        "defaultdisplay=dvi\0" \
                "omapdss.def_disp=${defaultdisplay} " \
                "root=${nandroot} " \
                "rootfstype=${nandrootfstype}\0" \
-       "loadbootscript=fatload mmc ${mmcdev} ${loadaddr} boot.scr\0" \
-       "bootscript=echo Running bootscript from mmc ...; " \
-               "source ${loadaddr}\0" \
+       "loadbootenv=fatload mmc ${mmcdev} ${loadaddr} uEnv.txt\0" \
+       "importbootenv=echo Importing environment from mmc ...; " \
+               "env import -t $loadaddr $filesize\0" \
        "loaduimage=fatload mmc ${mmcdev} ${loadaddr} uImage\0" \
        "mmcboot=echo Booting from mmc ...; " \
                "run mmcargs; " \
 
 #define CONFIG_BOOTCOMMAND \
        "if mmc rescan ${mmcdev}; then " \
-               "if run loadbootscript; then " \
-                       "run bootscript; " \
-               "else " \
-                       "if run loaduimage; then " \
-                               "run mmcboot; " \
-                       "else run nandboot; " \
-                       "fi; " \
-               "fi; " \
-       "else run nandboot; fi"
+               "echo SD/MMC found on device ${mmcdev};" \
+               "if run loadbootenv; then " \
+                       "run importbootenv;" \
+               "fi;" \
+               "if test -n $uenvcmd; then " \
+                       "echo Running uenvcmd ...;" \
+                       "run uenvcmd;" \
+               "fi;" \
+               "if run loaduimage; then " \
+                       "run mmcboot;" \
+               "fi;" \
+       "fi;" \
+       "run nandboot;" \
 
 #define CONFIG_AUTO_COMPLETE           1
 
diff --git a/include/configs/ima3-mx53.h b/include/configs/ima3-mx53.h
new file mode 100644 (file)
index 0000000..ea48d64
--- /dev/null
@@ -0,0 +1,269 @@
+/*
+ * (C) Copyright 2012, Stefano Babic <sbabic@denx.de>
+ *
+ * Copyright (C) 2010 Freescale Semiconductor, Inc.
+ *
+ * Configuration settings for the MX53-EVK Freescale 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.
+ */
+
+#ifndef __CONFIG_H
+#define __CONFIG_H
+
+/* SOC type must be included before imx-regs.h */
+#define CONFIG_MX53
+#include <asm/arch/imx-regs.h>
+#include <asm/arch/mx5x_pins.h>
+
+#define CONFIG_SYS_MX5_HCLK            24000000
+#define CONFIG_SYS_MX5_CLK32           32768
+
+#define CONFIG_DISPLAY_CPUINFO
+#define CONFIG_DISPLAY_BOARDINFO
+
+#define CONFIG_CMDLINE_TAG             /* enable passing of ATAGs */
+#define CONFIG_SETUP_MEMORY_TAGS
+#define CONFIG_INITRD_TAG
+
+#define CONFIG_OF_LIBFDT
+
+/* Size of malloc() pool */
+#define CONFIG_SYS_MALLOC_LEN          (CONFIG_ENV_SIZE + 2 * 1024 * 1024)
+
+#define CONFIG_BOARD_EARLY_INIT_F
+
+/* Enable GPIOs */
+#define CONFIG_MXC_GPIO
+
+/* UART */
+#define CONFIG_MXC_UART
+#define CONFIG_MXC_UART_BASE   UART4_BASE_ADDR
+
+/* MMC */
+#define CONFIG_FSL_ESDHC
+#define CONFIG_SYS_FSL_ESDHC_ADDR      0
+#define CONFIG_SYS_FSL_ESDHC_NUM       1
+
+#define CONFIG_MMC
+#define CONFIG_GENERIC_MMC
+#define CONFIG_DOS_PARTITION
+
+/* Ethernet on FEC */
+#define CONFIG_NET_MULTI
+#define CONFIG_MII
+#define CONFIG_DISCOVER_PHY
+
+#define CONFIG_FEC_MXC
+#define IMX_FEC_BASE                   FEC_BASE_ADDR
+#define CONFIG_FEC_MXC_PHYADDR         0x01
+#define CONFIG_PHY_ADDR                        CONFIG_FEC_MXC_PHYADDR
+#define CONFIG_RESET_PHY_R
+#define CONFIG_FEC_MXC_NO_ANEG
+#define CONFIG_PRIME   "FEC0"
+
+/* SPI */
+#define CONFIG_HARD_SPI
+#define CONFIG_MXC_SPI
+#define CONFIG_DEFAULT_SPI_BUS         1
+#define CONFIG_DEFAULT_SPI_MODE                SPI_MODE_0
+
+/* SPI FLASH - not used for environment */
+#define CONFIG_SPI_FLASH
+#define CONFIG_SPI_FLASH_STMICRO
+#define CONFIG_SPI_FLASH_CS            (IOMUX_TO_GPIO(MX53_PIN_CSI0_D11) \
+                                                << 8) | 0
+#define CONFIG_SF_DEFAULT_MODE         SPI_MODE_0
+#define CONFIG_SF_DEFAULT_SPEED                25000000
+
+/* allow to overwrite serial and ethaddr */
+#define CONFIG_ENV_OVERWRITE
+#define CONFIG_CONS_INDEX              1
+#define CONFIG_BAUDRATE                        115200
+#define CONFIG_SYS_BAUDRATE_TABLE      {9600, 19200, 38400, 57600, 115200}
+
+/* Command definition */
+#include <config_cmd_default.h>
+#define CONFIG_CMD_PING
+#define CONFIG_CMD_DHCP
+#define CONFIG_CMD_MII
+#define CONFIG_CMD_MMC
+#define CONFIG_CMD_FAT
+#define CONFIG_CMD_EXT2
+#define CONFIG_CMD_MTDPARTS
+#define CONFIG_CMD_SPI
+#define CONFIG_CMD_SF
+#define CONFIG_CMD_GPIO
+
+#define CONFIG_BOOTDELAY       3
+
+#define CONFIG_LOADADDR                0x70800000      /* loadaddr env var */
+#define CONFIG_SYS_TEXT_BASE    0xf0001400 /* uboot in nor flash */
+
+#define CONFIG_ARP_TIMEOUT     200UL
+
+/* Miscellaneous configurable options */
+#define CONFIG_SYS_LONGHELP            /* undef to save memory */
+#define CONFIG_SYS_HUSH_PARSER         /* use "hush" command parser */
+#define CONFIG_SYS_PROMPT_HUSH_PS2     "> "
+#define CONFIG_SYS_PROMPT              "IMA3 MX53 U-Boot > "
+#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       0x70000000
+#define CONFIG_SYS_MEMTEST_END         0x10000
+
+#define CONFIG_SYS_LOAD_ADDR           CONFIG_LOADADDR
+
+#define CONFIG_SYS_HZ          1000
+#define CONFIG_CMDLINE_EDITING
+
+/* Stack sizes */
+#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      (1024 * 1024 * 1024)
+
+#define CONFIG_SYS_SDRAM_BASE          (PHYS_SDRAM_1)
+#define CONFIG_SYS_INIT_RAM_ADDR       (IRAM_BASE_ADDR)
+#define CONFIG_SYS_INIT_RAM_SIZE       (IRAM_SIZE)
+
+#define CONFIG_SYS_INIT_SP_OFFSET \
+       (CONFIG_SYS_INIT_RAM_SIZE - GENERATED_GBL_DATA_SIZE)
+#define CONFIG_SYS_INIT_SP_ADDR \
+       (CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_INIT_SP_OFFSET)
+
+#define CONFIG_MTD_DEVICE              /* needed for mtdparts commands */
+#define MTDIDS_DEFAULT         "nor0=f0000000.flash"
+
+/* FLASH and environment organization */
+
+#define CONFIG_SYS_FLASH_BASE          0xF0000000
+#define CONFIG_SYS_FLASH_CFI           /* Flash is CFI conformant */
+#define CONFIG_FLASH_CFI_DRIVER                /* Use the common driver */
+#define CONFIG_FLASH_CFI_MTD           /* with MTD support */
+#define CONFIG_SYS_FLASH_BANKS_LIST    { CONFIG_SYS_FLASH_BASE }
+#define CONFIG_SYS_MAX_FLASH_BANKS     1
+#define CONFIG_SYS_MAX_FLASH_SECT      1024
+
+#define CONFIG_SYS_FLASH_EMPTY_INFO
+#define CONFIG_SYS_FLASH_USE_BUFFER_WRITE
+
+#define CONFIG_SYS_MONITOR_BASE                CONFIG_SYS_FLASH_BASE
+#define CONFIG_SYS_MONITOR_LEN         (512 * 1024)
+
+#define CONFIG_ENV_SIZE        (8 * 1024)
+#define CONFIG_ENV_IS_IN_FLASH
+#define CONFIG_ENV_ADDR                (CONFIG_SYS_MONITOR_BASE + \
+                               CONFIG_SYS_MONITOR_LEN)
+#define CONFIG_ENV_SECT_SIZE   0x20000
+#define CONFIG_ENV_OFFSET_REDUND       (CONFIG_ENV_OFFSET + \
+                                       CONFIG_ENV_SECT_SIZE)
+#define CONFIG_ENV_SIZE_REDUND CONFIG_ENV_SIZE
+
+/*
+ * Default environment and default scripts
+ * to update uboot and load kernel
+ */
+
+#define HOSTNAME ima3-mx53
+#define xstr(s)        str(s)
+#define str(s) #s
+
+#define CONFIG_HOSTNAME ima3-mx53
+#define        CONFIG_EXTRA_ENV_SETTINGS                                       \
+       "netdev=eth0\0"                                                 \
+       "nfsargs=setenv bootargs root=/dev/nfs rw "                     \
+               "nfsroot=${serverip}:${rootpath}\0"                     \
+       "ramargs=setenv bootargs root=/dev/ram0 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=${console},${baudrate}\0"                     \
+       "addmisc=setenv bootargs ${bootargs} ${misc}\0"                 \
+       "console=ttymxc3\0"                                             \
+       "loadaddr=70800000\0"                                           \
+       "kernel_addr_r=70800000\0"                                      \
+       "ramdisk_addr_r=71000000\0"                                     \
+       "hostname=" xstr(CONFIG_HOSTNAME) "\0"                          \
+       "bootfile=" xstr(CONFIG_HOSTNAME) "/uImage\0"                   \
+       "ramdisk_file=" xstr(CONFIG_HOSTNAME) "/uRamdisk\0"             \
+       "mmcargs=setenv bootargs root=${mmcroot} "                      \
+               "rootfstype=${mmcrootfstype}\0"                         \
+       "mmcroot=/dev/mmcblk0p3 rw\0"                                   \
+       "mmcboot=echo Booting from mmc ...; "                           \
+               "run mmcargs addip addtty addmtd addmisc mmcload;"      \
+               "bootm\0"                                               \
+       "mmcload=fatload mmc ${mmcdev}:${mmcpart} "                     \
+               "${loadaddr} ${uimage}\0"                               \
+       "mmcrootfstype=ext3 rootwait\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 ${ramdisk_addr_r} ${ramdisk_file};"         \
+               "tftp ${kernel_addr_r} ${bootfile}\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"                      \
+       "satargs=setenv bootargs root=/dev/sda1\0"                      \
+       "satafile=boot/uImage\0"                                        \
+       "ssdboot=echo Booting from ssd ...; "                           \
+               "run satargs addip addtty addmtd addmisc;"              \
+               "sata init;ext2load sata 0:1 ${kernel_addr_r} "         \
+               "${satafile};bootm\0"                                   \
+       "u-boot=" xstr(CONFIG_HOSTNAME) "/u-boot.imx\0"                 \
+       "uimage=uImage\0"                                               \
+       "load=tftp ${loadaddr} ${u-boot}\0"                             \
+       "uboot_addr=0xf0001000\0"                                       \
+       "update=protect off 0xf0000000 +60000;"                         \
+               "erase ${uboot_addr} +60000;"                           \
+               "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"
+
+
+#define CONFIG_CMD_SATA
+#ifdef CONFIG_CMD_SATA
+       #define CONFIG_DWC_AHSATA
+       #define CONFIG_SYS_SATA_MAX_DEVICE      1
+       #define CONFIG_DWC_AHSATA_PORT_ID       0
+       #define CONFIG_DWC_AHSATA_BASE_ADDR     SATA_BASE_ADDR
+       #define CONFIG_LBA48
+       #define CONFIG_LIBATA
+#endif
+
+#endif                         /* __CONFIG_H */
index 2af4e7af3144f211aa2a0e1e971ec9eacdb08285..c1f1aa6a8a37e4e587fa321f65bef6014a1f2f1d 100644 (file)
 #define CONFIG_SYS_NAND_BASE           0xd8000000
 #define CONFIG_JFFS2_NAND
 #define CONFIG_MXC_NAND_HWECC
-#define CONFIG_SYS_64BIT_VSPRINTF      /* needed for nand_util.c */
 
 /*
  * SD/MMC
index 012381a500a4ea029133ef5c878979ee2d9985b6..c62f4d01fd3c477caf263b91bcbf6b4ebdba6055 100644 (file)
@@ -43,6 +43,8 @@
 #define        CONFIG_ARCH_CPU_INIT
 #define        CONFIG_ARCH_MISC_INIT
 
+#define CONFIG_OF_LIBFDT
+
 /*
  * SPL
  */
@@ -52,6 +54,7 @@
 #define        CONFIG_SPL_LDSCRIPT     "arch/arm/cpu/arm926ejs/mx28/u-boot-spl.lds"
 #define        CONFIG_SPL_LIBCOMMON_SUPPORT
 #define        CONFIG_SPL_LIBGENERIC_SUPPORT
+#define        CONFIG_SPL_GPIO_SUPPORT
 
 /*
  * U-Boot Commands
@@ -84,7 +87,7 @@
  */
 #define        CONFIG_NR_DRAM_BANKS            1               /* 1 bank of DRAM */
 #define        PHYS_SDRAM_1                    0x40000000      /* Base address */
-#define        PHYS_SDRAM_1_SIZE               0x40000000      /* Max 1 GB RAM */
+#define        PHYS_SDRAM_1_SIZE               0x20000000      /* Max 512 MB RAM */
 #define        CONFIG_STACKSIZE                0x00010000      /* 128 KB stack */
 #define        CONFIG_SYS_MALLOC_LEN           0x00400000      /* 4 MB for malloc */
 #define        CONFIG_SYS_GBL_DATA_SIZE        128             /* Initial data */
 #define        CONFIG_BOOTCOMMAND      "run bootcmd_net"
 #define        CONFIG_LOADADDR         0x42000000
 #define        CONFIG_SYS_LOAD_ADDR    CONFIG_LOADADDR
+#define        CONFIG_OF_LIBFDT
 
 /*
  * Extra Environments
 #define        CONFIG_EXTRA_ENV_SETTINGS                                       \
        "update_nand_full_filename=u-boot.nand\0"                       \
        "update_nand_firmware_filename=u-boot.sb\0"                     \
+       "update_sd_firmware_filename=u-boot.sd\0"                       \
        "update_nand_firmware_maxsz=0x100000\0"                         \
        "update_nand_stride=0x40\0"     /* MX28 datasheet ch. 12.12 */  \
        "update_nand_count=0x4\0"       /* MX28 datasheet ch. 12.12 */  \
                "nand erase ${fcb_sz} ${fw_sz} ; "                      \
                "nand write ${loadaddr} ${fcb_sz} ${filesize} ; "       \
                "nand write ${loadaddr} ${fw_off} ${filesize} ; "       \
+               "fi\0"                                                  \
+       "update_sd_firmware="           /* Update the SD firmware partition */ \
+               "if mmc rescan ; then "                                 \
+               "if tftp ${update_sd_firmware_filename} ; then "        \
+               "setexpr fw_sz ${filesize} / 0x200 ; "  /* SD block size */ \
+               "setexpr fw_sz ${fw_sz} + 1 ; "                         \
+               "mmc write ${loadaddr} 0x800 ${fw_sz} ; "               \
+               "fi ; "                                                 \
                "fi\0"
 
 #endif /* __M28_H__ */
index 1315c3ceb81097433970b539bc86dbd04d610840..f6a83a8505eece56d076143e9b78a0ef62f314b0 100644 (file)
 
 #define CONFIG_SYS_MAX_NAND_DEVICE     1               /* Max number of */
                                                        /* NAND devices */
-#define CONFIG_SYS_64BIT_VSPRINTF              /* needed for nand_util.c */
-
 #define CONFIG_JFFS2_NAND
 /* nand device jffs2 lives on */
 #define CONFIG_JFFS2_DEV               "nand0"
 #define CONFIG_SPL_LDSCRIPT            "$(CPUDIR)/omap-common/u-boot-spl.lds"
 
 #define CONFIG_SPL_TEXT_BASE           0x40200000 /*CONFIG_SYS_SRAM_START*/
-#define CONFIG_SPL_MAX_SIZE            (45 << 10)
+#define CONFIG_SPL_MAX_SIZE            (54 * 1024)     /* 8 KB for stack */
 #define CONFIG_SPL_STACK               LOW_LEVEL_SRAM_STACK
 
 /* move malloc and bss high to prevent clashing with the main image */
index d6197bc610ab3ff1b8ff3dd94eabe84e7050b5ad..db1e87d69c1687af36eb6cd469ebab6f292bb23f 100644 (file)
 # define CONFIG_SYS_NAND_MASK_CLE              (1 << 22)
 # define CONFIG_SYS_NAND_ENABLE_PIN            AT91_PIO_PORTD, 15
 # define CONFIG_SYS_NAND_READY_PIN             AT91_PIO_PORTA, 22
-# define CONFIG_SYS_64BIT_VSPRINTF             /* needed for nand_util.c */
 #endif
 
 /* Ethernet */
index 1a6379176b3b4c3590326abe6f0aa43b16bb420b..27b489902bd75ad6746b84326ca2f4045ae35f49 100644 (file)
  */
 #ifdef CONFIG_CMD_NAND
 #define CONFIG_SYS_MAX_NAND_DEVICE     1
-#define CONFIG_SYS_64BIT_VSPRINTF      /* needed for nand_util.c */
 #endif
 
 /*
diff --git a/include/configs/mx23_evk.h b/include/configs/mx23_evk.h
new file mode 100644 (file)
index 0000000..1600128
--- /dev/null
@@ -0,0 +1,154 @@
+/*
+ * Copyright (C) 2008 Embedded Alley Solutions, Inc.
+ *
+ * (C) Copyright 2009-2010 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
+ */
+
+#ifndef __CONFIG_H
+#define __CONFIG_H
+#include <asm/sizes.h>
+
+/*
+ * Define this to make U-Boot skip low level initialization when loaded
+ * by initial bootloader. Not required by NAND U-Boot version but IS
+ * required for a NOR version used to burn the real NOR U-Boot into
+ * NOR Flash. NAND and NOR support for DaVinci chips is mutually exclusive
+ * so it is NOT possible to build a U-Boot with both NAND and NOR routines.
+ * NOR U-Boot is loaded directly from Flash so it must perform all the
+ * low level initialization itself. NAND version is loaded by an initial
+ * bootloader (UBL in TI-ese) that performs such an initialization so it's
+ * skipped in NAND version. The third DaVinci boot mode loads a bootloader
+ * via UART0 and that bootloader in turn loads and runs U-Boot (or whatever)
+ * performing low level init prior to loading. All that means we can NOT use
+ * NAND version to put U-Boot into NOR because it doesn't have NOR support and
+ * we can NOT use NOR version because it performs low level initialization
+ * effectively destroying itself in DDR memory. That's why a separate NOR
+ * version with this define is needed. It is loaded via UART, then one uses
+ * it to somehow download a proper NOR version built WITHOUT this define to
+ * RAM (tftp?) and burn it to NOR Flash. I would be probably able to squeeze
+ * NOR support into the initial bootloader so it won't be needed but DaVinci
+ * static RAM might be too small for this (I have something like 2Kbytes left
+ * as of now, without NOR support) so this might've not happened...
+ *
+ */
+
+/*===================*/
+/* SoC Configuration */
+/*===================*/
+#define CONFIG_ARM926EJS                       /* arm926ejs CPU core */
+#define CONFIG_MX23                            /* MX23 SoC */
+#define CONFIG_MX23_EVK                                /* MX23 EVK board */
+#define CONFIG_SYS_CLK_FREQ    120000000       /* Arm Clock frequency */
+#define CONFIG_USE_TIMER0                      /* use timer 0 */
+#define CONFIG_SYS_HZ          1000            /* Ticks per second */
+/*=============*/
+/* Memory Info */
+/*=============*/
+#define CONFIG_SYS_MALLOC_LEN  (0x10000 + 128*1024)    /* malloc() len */
+#define CONFIG_SYS_GBL_DATA_SIZE 128           /* reserved for initial data */
+#define CONFIG_SYS_MEMTEST_START 0x40000000    /* memtest start address */
+#define CONFIG_SYS_MEMTEST_END  0x41000000     /* 16MB RAM test */
+#define CONFIG_NR_DRAM_BANKS   1               /* we have 1 bank of DRAM */
+#define CONFIG_STACKSIZE       (256*1024)      /* regular stack */
+#define PHYS_SDRAM_1           0x40000000      /* mDDR Start */
+#define PHYS_SDRAM_1_SIZE      0x02000000      /* mDDR size 32MB */
+
+/*====================*/
+/* Serial Driver info */
+/*====================*/
+#define CONFIG_STMP3XXX_DBGUART                        /* 378x debug UART */
+#define CONFIG_DBGUART_CLK     24000000
+#define CONFIG_BAUDRATE                115200          /* Default baud rate */
+#define CONFIG_SYS_BAUDRATE_TABLE      { 9600, 19200, 38400, 57600, 115200 }
+
+/*====================*/
+/* SPI Driver info */
+/*====================*/
+#define CONFIG_SSP_CLK         48000000
+#define CONFIG_SPI_CLK         3000000
+#define CONFIG_SPI_SSP1
+#undef CONFIG_SPI_SSP2
+
+/*=====================*/
+/* Flash & Environment */
+/*=====================*/
+#define CONFIG_SYS_NO_FLASH                    /* Flash is not supported */
+#define CONFIG_ENV_IS_NOWHERE          /* Store ENV in memory only */
+#define CONFIG_ENV_SIZE                0x20000
+
+/*==============================*/
+/* U-Boot general configuration */
+/*==============================*/
+#undef CONFIG_USE_IRQ                          /* No IRQ/FIQ in U-Boot */
+#define CONFIG_MISC_INIT_R
+#define CONFIG_NETMASK         255.255.255.0
+#define CONFIG_IPADDR          192.167.10.2
+#define CONFIG_SERVERIP                192.167.10.1
+#define CONFIG_BOOTDELAY       2
+#define CONFIG_BOOTFILE                "uImage"        /* Boot file name */
+#define CONFIG_SYS_PROMPT      "MX23 U-Boot > "
+                                               /* Monitor Command Prompt */
+#define CONFIG_SYS_CBSIZE      1024            /* Console I/O Buffer Size  */
+#define CONFIG_SYS_PBSIZE      (CONFIG_SYS_CBSIZE+sizeof(CONFIG_SYS_PROMPT)+16)
+                                               /* Print buffer sz */
+#define CONFIG_SYS_MAXARGS     16              /* max number of command args */
+#define CONFIG_SYS_BARGSIZE    CONFIG_SYS_CBSIZE
+                                               /* Boot Argument Buffer Size */
+#define CONFIG_SYS_LOAD_ADDR   0x40400000
+                               /* default Linux kernel load address */
+#define CONFIG_VERSION_VARIABLE
+#define CONFIG_AUTO_COMPLETE   /* Won't work with hush so far, may be later */
+#define CFG_HUSH_PARSER
+#define CFG_PROMPT_HUSH_PS2    "> "
+#define CONFIG_CMDLINE_EDITING
+#define CFG_LONGHELP
+#define CONFIG_CRC32_VERIFY
+#define CONFIG_MX_CYCLIC
+
+/*===================*/
+/* Linux Information */
+/*===================*/
+#define LINUX_BOOT_PARAM_ADDR  0x40000100
+#define CONFIG_CMDLINE_TAG
+#define CONFIG_SETUP_MEMORY_TAGS
+#define CONFIG_BOOTARGS                "console=ttyAM0,115200n8 "\
+                       "root=/dev/mtdblock1 rootfstype=jffs2 lcd_panel=lms350"
+#define CONFIG_BOOTCOMMAND     "tftpboot ; bootm"
+
+/*=================*/
+/* U-Boot commands */
+/*=================*/
+#include <config_cmd_default.h>
+#define CONFIG_CMD_ASKENV
+#define CONFIG_CMD_DHCP
+#define CONFIG_BOOTP_SUBNETMASK
+#define CONFIG_BOOTP_GATEWAY
+#define CONFIG_BOOTP_DNS
+#undef CONFIG_CMD_DIAG
+#define CONFIG_CMD_MII
+#define CONFIG_CMD_PING
+#define CONFIG_CMD_NET
+#define CONFIG_CMD_SAVES
+#undef CONFIG_CMD_IMLS
+
+/* Ethernet chip - select an alternative driver */
+#define CONFIG_ENC28J60_ETH
+#define CONFIG_ENC28J60_ETH_SPI_BUS    0
+#define CONFIG_ENC28J60_ETH_SPI_CS     0
+
+#endif /* __CONFIG_H */
diff --git a/include/configs/mx25_3stack.h b/include/configs/mx25_3stack.h
new file mode 100644 (file)
index 0000000..e8383c2
--- /dev/null
@@ -0,0 +1,282 @@
+/*
+ * (C) Copyright 2009-2010 Freescale Semiconductor
+ *
+ * (C) Copyright 2004
+ * Texas Instruments.
+ * Richard Woodruff <r-woodruff2@ti.com>
+ * Kshitij Gupta <kshitij@ti.com>
+ *
+ * Configuration settings for the Freescale i.MX31 PDK 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
+
+#include <asm/arch/mx25.h>
+#include <asm/arch/mx25-regs.h>
+
+/* High Level Configuration Options */
+#define CONFIG_ARM926EJS       1       /* This is an arm1136 CPU core */
+#define CONFIG_MX25            1       /* in a mx31 */
+#define CONFIG_MX25_HCLK_FREQ  24000000
+#define CONFIG_MX25_CLK32      32768
+
+#define CONFIG_IMX_CSPI                1
+#define IMX_CSPI_VER_0_7       1
+#define CONFIG_IMX_SPI_CPLD
+
+/* IF iMX25 3DS V-1.0 define it */
+/* #define CONFIG_MX25_3DS_V10 */
+
+#ifdef CONFIG_MX25_3DS_V10
+#define MXC_MEMORY_MDDR
+#endif
+
+#define CONFIG_DISPLAY_CPUINFO
+#define CONFIG_DISPLAY_BOARDINFO
+
+#define CONFIG_SYS_64BIT_VSPRINTF
+
+#define BOARD_LATE_INIT
+
+#define CONFIG_CMDLINE_TAG             1       /* enable passing of ATAGs */
+#define CONFIG_SETUP_MEMORY_TAGS       1
+#define CONFIG_INITRD_TAG              1
+
+/* No support for NAND boot for i.MX31 PDK yet, so we rely on some other
+ * program to initialize the SDRAM.
+ */
+#define CONFIG_SKIP_RELOCATE_UBOOT
+
+/*
+ * Size of malloc() pool
+ */
+#define CONFIG_SYS_MALLOC_LEN          (CONFIG_ENV_SIZE + 512 * 1024)
+#define CONFIG_SYS_GBL_DATA_SIZE       128 /* bytes reserved initial data */
+
+/*
+ * Hardware drivers
+ */
+#define CONFIG_HARD_I2C                1
+#define CONFIG_I2C_MXC         1
+#define CONFIG_SYS_I2C_PORT            I2C1_BASE
+#define CONFIG_SYS_I2C_SPEED           40000
+#define CONFIG_SYS_I2C_SLAVE           0xfe
+
+#define CONFIG_MX25_UART       1
+#define CONFIG_MX25_UART1              1
+
+/* allow to overwrite serial and ethaddr */
+#define CONFIG_ENV_OVERWRITE
+#define CONFIG_CONS_INDEX      1
+#define CONFIG_BAUDRATE                115200
+#define CONFIG_SYS_BAUDRATE_TABLE      {9600, 19200, 38400, 57600, 115200}
+
+/***********************************************************
+ * Command definition
+ ***********************************************************/
+
+#include <config_cmd_default.h>
+
+#define CONFIG_CMD_I2C
+#define CONFIG_CMD_MII
+#define CONFIG_CMD_PING
+/* #define CONFIG_CMD_SPI */
+/* #define CONFIG_CMD_DATE */
+#define CONFIG_CMD_NAND
+#define CONFIG_CMD_MMC
+#define CONFIG_MXC_NAND
+
+
+/*
+ * MMC Configs
+ * */
+#ifdef CONFIG_CMD_MMC
+       #define CONFIG_MMC                              1
+       #define CONFIG_GENERIC_MMC
+       #define CONFIG_IMX_MMC
+       #define CONFIG_SYS_FSL_ESDHC_NUM        2
+       #define CONFIG_SYS_FSL_ESDHC_ADDR       0
+       #define CONFIG_SYS_MMC_ENV_DEV  0
+       #define CONFIG_IMX_ESDHC_V1
+       #define CONFIG_DOS_PARTITION    1
+       #define CONFIG_CMD_FAT          1
+#endif
+
+/* Disabled due to compilation errors in cmd_bootm.c (IMLS seems to require
+ * that CONFIG_NO_FLASH is undefined).
+ */
+#undef CONFIG_CMD_IMLS
+
+#define CONFIG_BOOTDELAY       3
+
+#define CONFIG_LOADADDR                0x80800000      /* loadaddr env var */
+
+#define        CONFIG_EXTRA_ENV_SETTINGS                                       \
+       "netdev=eth0\0"                                                 \
+       "ethprime=smc911x-0\0"                                          \
+       "uboot=u-boot.bin\0"                                            \
+       "uboot_addr=0xa0000000\0"                                       \
+       "kernel=uImage\0"                                               \
+       "bootargs_base=setenv bootargs console=ttymxc0,115200\0"        \
+       "bootargs_nfs=setenv bootargs $(bootargs) root=/dev/nfs "       \
+               "ip=dhcp nfsroot=$(serverip):$(nfsrootfs),v3,tcp\0"     \
+       "bootcmd=run bootcmd_net\0"                                     \
+       "bootcmd_net=run bootargs_base bootargs_nfs; "                  \
+               "tftpboot ${loadaddr} ${kernel}; bootm\0"               \
+       "load_uboot=tftpboot ${loadaddr} ${uboot}\0"    \
+       "splashimage=0x80800000\0"
+
+/*Support LAN9217*/
+#define CONFIG_SMC911X
+#define CONFIG_SMC911X_CPLD
+#define CONFIG_SMC911X_BASE    0
+
+#define CONFIG_HAS_ETH1
+#define CONFIG_CMD_NET
+#define CONFIG_NET_RETRY_COUNT 100
+#define CONFIG_CMD_DHCP
+#define CONFIG_BOOTP_SUBNETMASK
+#define CONFIG_BOOTP_GATEWAY
+#define CONFIG_BOOTP_DNS
+#define CONFIG_NET_MULTI
+#define CONFIG_ETHPRIME
+
+#define CONFIG_MXC_FEC
+#define CONFIG_MII
+#define CONFIG_MII_GASKET
+#define CONFIG_DISCOVER_PHY
+
+#define CONFIG_GET_FEC_MAC_ADDR_FROM_IIM
+#define CONFIG_IIM_MAC_ADDR_OFFSET     0x68
+
+#define CONFIG_FEC0_IOBASE FEC_BASE
+#define CONFIG_FEC0_PINMUX -1
+#define CONFIG_FEC0_PHY_ADDR 0x1F
+#define CONFIG_FEC0_MIIBASE -1
+
+/*
+ * Miscellaneous configurable options
+ */
+#define CONFIG_SYS_LONGHELP    /* undef to save memory */
+#define CONFIG_SYS_PROMPT      "MX25 U-Boot > "
+#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 Buf Size */
+
+#define CONFIG_SYS_MEMTEST_START       PHYS_SDRAM_1    /* memtest works on */
+#define CONFIG_SYS_MEMTEST_END 0x10000
+
+#define CONFIG_SYS_LOAD_ADDR   CONFIG_LOADADDR /* default load address */
+
+#define CONFIG_SYS_HZ                  1000
+
+#define UBOOT_IMAGE_SIZE       0x40000
+
+#define CONFIG_CMDLINE_EDITING 1
+
+/*-----------------------------------------------------------------------
+ * 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
+
+/* iMX25 V-1.0 has 128MB but V-1.1 has only 64MB */
+#ifdef CONFIG_MX25_3DS_V10
+#define PHYS_SDRAM_1_SIZE      (128 * 1024 * 1024)
+#else
+#define PHYS_SDRAM_1_SIZE       (64 * 1024 * 1024)
+#endif
+
+/* LCD */
+/*
+#define CONFIG_SPLASH_SCREEN
+*/
+
+#ifdef CONFIG_SPLASH_SCREEN
+       #define CONFIG_LCD
+       #define CONFIG_MXC2_LCD 1
+       #undef LCD_TEST_PATTERN
+       #define CONFIG_FB_BASE                          0x81400000
+       #define CONFIG_SYS_CONSOLE_IS_IN_ENV            1
+       #define CONFIG_SPLASH_SCREEN                    1
+       #define CONFIG_SPLASH_IS_IN_MMC                 1
+       #define LCD_BPP                                 LCD_COLOR16
+       /* #define CONFIG_SPLASH_SCREEN_ALIGN           1 */
+
+       #define CONFIG_CMD_BMP
+       #define CONFIG_BMP_24BPP 1
+       #define CONFIG_BMP_16BPP 1
+#endif
+
+
+#ifdef CONFIG_SPLASH_IS_IN_MMC
+       #define CONFIG_SPLASH_IMG_MMC_DEV       0
+       #define CONFIG_SPLASH_IMG_OFFSET        0x4c000
+       #define CONFIG_SPLASH_IMG_SIZE          0x19000
+#endif
+
+/* Monitor at beginning of flash */
+/* #define CONFIG_FSL_ENV_IN_MMC */
+#define CONFIG_FSL_ENV_IN_NAND
+
+/*-----------------------------------------------------------------------
+ * FLASH and environment organization
+ */
+#if defined(CONFIG_FSL_ENV_IN_NAND)
+       #define CONFIG_ENV_IS_IN_NAND 1
+       #define CONFIG_ENV_OFFSET       0x80000
+#elif defined(CONFIG_FSL_ENV_IN_MMC)
+       #define CONFIG_ENV_IS_IN_MMC    1
+       #define CONFIG_ENV_OFFSET       (768 * 1024)
+#else
+       #define CONFIG_ENV_IS_NOWHERE   1
+#endif
+
+#define CONFIG_ENV_SECT_SIZE   (256 * 1024)
+#define CONFIG_ENV_SIZE         CONFIG_ENV_SECT_SIZE
+
+/*-----------------------------------------------------------------------
+ * NAND FLASH driver setup
+ */
+#define CONFIG_SYS_NO_FLASH
+#define NAND_MAX_CHIPS         1
+#define CONFIG_SYS_MAX_NAND_DEVICE     1
+#define CONFIG_SYS_NAND_BASE           0x40000000
+
+/*
+ * JFFS2 partitions TODO:
+ */
+#undef CONFIG_JFFS2_CMDLINE
+#define CONFIG_JFFS2_DEV       "nand0"
+
+#endif /* __CONFIG_H */
+
diff --git a/include/configs/mx25_3stack_mfg.h b/include/configs/mx25_3stack_mfg.h
new file mode 100644 (file)
index 0000000..a907d06
--- /dev/null
@@ -0,0 +1,262 @@
+/*
+ * (C) Copyright 2009-2010 Freescale Semiconductor
+ *
+ * (C) Copyright 2004
+ * Texas Instruments.
+ * Richard Woodruff <r-woodruff2@ti.com>
+ * Kshitij Gupta <kshitij@ti.com>
+ *
+ * Configuration settings for the Freescale i.MX31 PDK 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
+
+#include <asm/arch/mx25.h>
+#include <asm/arch/mx25-regs.h>
+
+/* High Level Configuration Options */
+#define CONFIG_ARM926EJS       1       /* This is an arm1136 CPU core */
+#define CONFIG_MX25            1       /* in a mx31 */
+#define CONFIG_MX25_HCLK_FREQ  24000000
+#define CONFIG_MX25_CLK32      32768
+
+#define CONFIG_MFG             1
+#define CONFIG_IMX_CSPI                1
+#define IMX_CSPI_VER_0_7       1
+#define CONFIG_IMX_SPI_CPLD
+
+/* IF iMX25 3DS V-1.0 define it */
+/* #define CONFIG_MX25_3DS_V10 */
+
+#ifdef CONFIG_MX25_3DS_V10
+#define MXC_MEMORY_MDDR
+#endif
+
+#define CONFIG_DISPLAY_CPUINFO
+#define CONFIG_DISPLAY_BOARDINFO
+
+#define CONFIG_SYS_64BIT_VSPRINTF
+#define BOARD_LATE_INIT
+
+#define CONFIG_CMDLINE_TAG             1       /* enable passing of ATAGs */
+#define CONFIG_SETUP_MEMORY_TAGS       1
+#define CONFIG_INITRD_TAG              1
+#define CONFIG_REVISION_TAG             1
+
+/* No support for NAND boot for i.MX31 PDK yet, so we rely on some other
+ * program to initialize the SDRAM.
+ */
+#define CONFIG_SKIP_RELOCATE_UBOOT
+
+/*
+ * Size of malloc() pool
+ */
+#define CONFIG_SYS_MALLOC_LEN          (CONFIG_ENV_SIZE + 512 * 1024)
+#define CONFIG_SYS_GBL_DATA_SIZE       128 /* bytes reserved initial data */
+
+/*
+ * Hardware drivers
+ */
+#define CONFIG_HARD_I2C                1
+#define CONFIG_I2C_MXC         1
+#define CONFIG_SYS_I2C_PORT            I2C1_BASE
+#define CONFIG_SYS_I2C_SPEED           40000
+#define CONFIG_SYS_I2C_SLAVE           0xfe
+
+#define CONFIG_MX25_UART       1
+#define CONFIG_MX25_UART1              1
+
+/* allow to overwrite serial and ethaddr */
+#define CONFIG_ENV_OVERWRITE
+#define CONFIG_CONS_INDEX      1
+#define CONFIG_BAUDRATE                115200
+#define CONFIG_SYS_BAUDRATE_TABLE      {9600, 19200, 38400, 57600, 115200}
+
+/***********************************************************
+ * Command definition
+ ***********************************************************/
+
+#include <config_cmd_default.h>
+
+#define CONFIG_CMD_I2C
+#define CONFIG_CMD_MII
+#define CONFIG_CMD_PING
+/* #define CONFIG_CMD_SPI */
+/* #define CONFIG_CMD_DATE */
+#define CONFIG_CMD_NAND
+#define CONFIG_CMD_MMC
+#define CONFIG_MXC_NAND
+
+/*
+ * MMC Configs
+ * */
+#ifdef CONFIG_CMD_MMC
+       #define CONFIG_MMC                              1
+       #define CONFIG_GENERIC_MMC
+       #define CONFIG_IMX_MMC
+       #define CONFIG_SYS_FSL_ESDHC_NUM        2
+       #define CONFIG_SYS_FSL_ESDHC_ADDR       0
+       #define CONFIG_SYS_MMC_ENV_DEV  0
+       #define CONFIG_IMX_ESDHC_V1
+       #define CONFIG_DOS_PARTITION    1
+       #define CONFIG_CMD_FAT          1
+#endif
+
+/* Disabled due to compilation errors in cmd_bootm.c (IMLS seems to require
+ * that CONFIG_NO_FLASH is undefined).
+ */
+#undef CONFIG_CMD_IMLS
+
+#define CONFIG_BOOTDELAY       0
+
+#define CONFIG_LOADADDR                0x80100000      /* loadaddr env var */
+
+#define CONFIG_BOOTAGS         "console=ttymxc0,115200 "\
+                               "rdinit=/linuxrc"
+#define CONFIG_BOOTCOMMAND      "bootm ${loadaddr} 0x80800000"
+#define CONFIG_ENV_IS_EMBEDDED
+
+/*
+#define        CONFIG_EXTRA_ENV_SETTINGS                                       \
+       "netdev=eth0\0"                                                 \
+       "ethprime=smc911x-0\0"                                          \
+       "uboot=u-boot.bin\0"                                            \
+       "uboot_addr=0xa0000000\0"                                       \
+       "kernel=uImage\0"                                               \
+       "bootargs_base=setenv bootargs console=ttymxc0,115200\0"        \
+       "bootargs_nfs=setenv bootargs $(bootargs) root=/dev/nfs "       \
+               "ip=dhcp nfsroot=$(serverip):$(nfsrootfs),v3,tcp\0"     \
+       "bootcmd=run bootcmd_net\0"                                     \
+       "bootcmd_net=run bootargs_base bootargs_nfs; "                  \
+               "tftpboot ${loadaddr} ${kernel}; bootm\0"               \
+       "load_uboot=tftpboot ${loadaddr} ${uboot}\0"
+*/
+
+/*Support LAN9217*/
+#define CONFIG_SMC911X
+#define CONFIG_SMC911X_CPLD
+#define CONFIG_SMC911X_BASE    0
+
+#define CONFIG_HAS_ETH1
+#define CONFIG_CMD_NET
+#define CONFIG_NET_RETRY_COUNT 100
+#define CONFIG_CMD_DHCP
+#define CONFIG_BOOTP_SUBNETMASK
+#define CONFIG_BOOTP_GATEWAY
+#define CONFIG_BOOTP_DNS
+#define CONFIG_NET_MULTI
+#define CONFIG_ETHPRIME
+
+#define CONFIG_MXC_FEC
+#define CONFIG_MII
+#define CONFIG_MII_GASKET
+#define CONFIG_DISCOVER_PHY
+
+#define CONFIG_FEC0_IOBASE FEC_BASE
+#define CONFIG_FEC0_PINMUX -1
+#define CONFIG_FEC0_PHY_ADDR 0x1F
+#define CONFIG_FEC0_MIIBASE -1
+
+/*
+ * Miscellaneous configurable options
+ */
+#define CONFIG_SYS_LONGHELP    /* undef to save memory */
+#define CONFIG_SYS_PROMPT      "MX25 U-Boot > "
+#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 Buf Size */
+
+#define CONFIG_SYS_MEMTEST_START       PHYS_SDRAM_1    /* memtest works on */
+#define CONFIG_SYS_MEMTEST_END 0x10000
+
+#define CONFIG_SYS_LOAD_ADDR   CONFIG_LOADADDR /* default load address */
+
+#define CONFIG_SYS_HZ                  1000
+
+#define UBOOT_IMAGE_SIZE       0x40000
+
+#define CONFIG_CMDLINE_EDITING 1
+
+/*-----------------------------------------------------------------------
+ * 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
+
+/* iMX25 V-1.0 has 128MB but V-1.1 has only 64MB */
+#ifdef CONFIG_MX25_3DS_V10
+#define PHYS_SDRAM_1_SIZE      (128 * 1024 * 1024)
+#else
+#define PHYS_SDRAM_1_SIZE       (64 * 1024 * 1024)
+#endif
+
+/* Monitor at beginning of flash */
+/* #define CONFIG_FSL_ENV_IN_MMC */
+/*#define CONFIG_FSL_ENV_IN_NAND*/
+
+/*-----------------------------------------------------------------------
+ * FLASH and environment organization
+ */
+/*
+#if defined(CONFIG_FSL_ENV_IN_NAND)
+       #define CONFIG_ENV_IS_IN_NAND 1
+       #define CONFIG_ENV_OFFSET       0x80000
+#elif defined(CONFIG_FSL_ENV_IN_MMC)
+       #define CONFIG_ENV_IS_IN_MMC    1
+       #define CONFIG_ENV_OFFSET       (768 * 1024)
+#else
+       #define CONFIG_ENV_IS_NOWHERE   1
+#endif
+*/
+
+#define CONFIG_ENV_IS_NOWHERE
+
+#define CONFIG_ENV_SECT_SIZE   (256 * 1024)
+#define CONFIG_ENV_SIZE         CONFIG_ENV_SECT_SIZE
+
+/*-----------------------------------------------------------------------
+ * NAND FLASH driver setup
+ */
+#define CONFIG_SYS_NO_FLASH
+#define NAND_MAX_CHIPS         1
+#define CONFIG_SYS_MAX_NAND_DEVICE     1
+#define CONFIG_SYS_NAND_BASE           0x40000000
+
+/*
+ * JFFS2 partitions TODO:
+ */
+/*
+#undef CONFIG_JFFS2_CMDLINE
+#define CONFIG_JFFS2_DEV       "nand0"
+*/
+#endif /* __CONFIG_H */
+
index d1ba02b6eedcd8875572c2f56e93a6cb9f5cd080..7210b6e80f24dd3a493fcd9f9662d62ffe5f9263 100644 (file)
@@ -65,7 +65,6 @@
 #define CONFIG_ENV_IS_NOWHERE
 
 #define CONFIG_SYS_NO_FLASH
-#define CONFIG_SYS_64BIT_VSPRINTF
 
 /* U-Boot general configuration */
 #define CONFIG_SYS_PROMPT      "MX25PDK U-Boot > "
diff --git a/include/configs/mx28_evk.h b/include/configs/mx28_evk.h
new file mode 100644 (file)
index 0000000..3148fd2
--- /dev/null
@@ -0,0 +1,160 @@
+/*
+ * Copyright (C) 2010 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
+ */
+#ifndef __MX28_EVK_H
+#define __MX28_EVK_H
+
+#include <asm/arch/mx28.h>
+
+/*
+ * SoC configurations
+ */
+#define CONFIG_MX28                            /* i.MX28 SoC */
+#define CONFIG_MX28_TO1_2
+#define CONFIG_SYS_HZ          1000            /* Ticks per second */
+/* ROM loads UBOOT into DRAM */
+#define CONFIG_SKIP_RELOCATE_UBOOT
+
+/*
+ * Memory configurations
+ */
+#define CONFIG_NR_DRAM_BANKS   1               /* 1 bank of DRAM */
+#define PHYS_SDRAM_1           0x40000000      /* Base address */
+#define PHYS_SDRAM_1_SIZE      0x08000000      /* 128 MB */
+#define CONFIG_STACKSIZE       0x00020000      /* 128 KB stack */
+#define CONFIG_SYS_MALLOC_LEN  0x00400000      /* 4 MB for malloc */
+#define CONFIG_SYS_GBL_DATA_SIZE 128           /* Reserved for initial data */
+#define CONFIG_SYS_MEMTEST_START 0x40000000    /* Memtest start address */
+#define CONFIG_SYS_MEMTEST_END  0x40400000     /* 4 MB RAM test */
+
+/*
+ * U-Boot general configurations
+ */
+#define CONFIG_SYS_PROMPT      "MX28 U-Boot > "
+#define CONFIG_SYS_CBSIZE      1024            /* Console I/O buffer size */
+#define CONFIG_SYS_PBSIZE \
+       (CONFIG_SYS_CBSIZE + sizeof(CONFIG_SYS_PROMPT) + 16)
+                                               /* Print buffer size */
+#define CONFIG_SYS_MAXARGS     16              /* Max number of command args */
+#define CONFIG_SYS_BARGSIZE    CONFIG_SYS_CBSIZE
+                                               /* Boot argument buffer size */
+#define CONFIG_VERSION_VARIABLE                        /* U-BOOT version */
+#define CONFIG_AUTO_COMPLETE                   /* Command auto complete */
+#define CONFIG_CMDLINE_EDITING                 /* Command history etc */
+
+#define CONFIG_SYS_64BIT_VSPRINTF
+
+/*
+ * Boot Linux
+ */
+#define CONFIG_CMDLINE_TAG
+#define CONFIG_SETUP_MEMORY_TAGS
+#define CONFIG_BOOTDELAY       3
+#define CONFIG_BOOTFILE                "uImage"
+#define CONFIG_BOOTARGS                "console=ttyAM0,115200n8 "
+#define CONFIG_BOOTCOMMAND     "run bootcmd_net"
+#define CONFIG_LOADADDR                0x42000000
+#define CONFIG_SYS_LOAD_ADDR   CONFIG_LOADADDR
+
+/*
+ * Extra Environments
+ */
+#define        CONFIG_EXTRA_ENV_SETTINGS \
+       "nfsroot=/home/notroot/nfs/rootfs\0" \
+       "bootargs_nfs=setenv bootargs ${bootargs} root=/dev/nfs " \
+               "ip=dhcp nfsroot=${serverip}:${nfsroot},v3,tcp " \
+               "fec_mac=${ethaddr}\0" \
+       "bootcmd_net=run bootargs_nfs; dhcp; bootm\0" \
+       "bootargs_mmc=setenv bootargs ${bootargs} root=/dev/mmcblk0p3 " \
+               "rw rootwait ip=dhcp fec_mac=${ethaddr}\0" \
+       "bootcmd_mmc=run bootargs_mmc; " \
+               "mmc read 0 ${loadaddr} 100 3000; bootm\0" \
+
+/*
+ * U-Boot Commands
+ */
+#define CONFIG_SYS_NO_FLASH
+#include <config_cmd_default.h>
+#define CONFIG_ARCH_CPU_INIT
+#define CONFIG_DISPLAY_CPUINFO
+
+/*
+ * Serial Driver
+ */
+#define CONFIG_UARTDBG_CLK             24000000
+#define CONFIG_BAUDRATE                        115200          /* Default baud rate */
+#define CONFIG_SYS_BAUDRATE_TABLE      { 9600, 19200, 38400, 57600, 115200 }
+
+/*
+ * FEC Driver
+ */
+#define CONFIG_MXC_FEC
+#define CONFIG_GET_FEC_MAC_ADDR_FROM_IIM
+#define CONFIG_FEC0_IOBASE             REGS_ENET_BASE
+#define CONFIG_FEC0_PHY_ADDR           0
+#define CONFIG_NET_MULTI
+#define CONFIG_ETH_PRIME
+#define CONFIG_RMII
+#define CONFIG_CMD_MII
+#define CONFIG_CMD_DHCP
+#define CONFIG_CMD_PING
+#define CONFIG_IPADDR                  192.168.1.103
+#define CONFIG_SERVERIP                        192.168.1.101
+#define CONFIG_NETMASK                 255.255.255.0
+/* Add for working with "strict" DHCP server */
+#define CONFIG_BOOTP_SUBNETMASK
+#define CONFIG_BOOTP_GATEWAY
+#define CONFIG_BOOTP_DNS
+
+/*
+ * MMC Driver
+ */
+#define CONFIG_CMD_MMC
+#define CONFIG_MMC
+#define CONFIG_IMX_SSP_MMC             /* MMC driver based on SSP */
+#define CONFIG_GENERIC_MMC
+#define CONFIG_SYS_MMC_ENV_DEV 0
+#define CONFIG_DOS_PARTITION
+#define CONFIG_CMD_FAT
+#define CONFIG_SYS_SSP_MMC_NUM 2
+
+/*
+ * Environments on MMC
+ */
+#define CONFIG_CMD_ENV
+#define CONFIG_ENV_OVERWRITE
+#define CONFIG_ENV_IS_IN_MMC
+/* Assoiated with the MMC layout defined in mmcops.c */
+#define CONFIG_ENV_OFFSET              (0x400) /* 1 KB */
+#define CONFIG_ENV_SIZE                        (0x20000 - 0x400) /* 127 KB */
+#define CONFIG_DYNAMIC_MMC_DEVNO
+
+/* The global boot mode will be detected by ROM code and
+ * a boot mode value will be stored at fixed address:
+ * TO1.0 addr 0x0001a7f0
+ * TO1.2 addr 0x00019BF0
+ */
+#ifndef MX28_EVK_TO1_0
+ #define GLOBAL_BOOT_MODE_ADDR 0x00019BF0
+#else
+ #define GLOBAL_BOOT_MODE_ADDR 0x0001a7f0
+#endif
+#define BOOT_MODE_SD0 0x9
+#define BOOT_MODE_SD1 0xa
+
+#endif /* __MX28_EVK_H */
index 02f3366ed263ff66fe3b9b2089ec95ef461a92c0..0c18e5022a142e98e2e1e5510cf5bdf5e3aaa699 100644 (file)
@@ -46,6 +46,7 @@
 #define CONFIG_SPL_LDSCRIPT    "arch/arm/cpu/arm926ejs/mx28/u-boot-spl.lds"
 #define CONFIG_SPL_LIBCOMMON_SUPPORT
 #define CONFIG_SPL_LIBGENERIC_SUPPORT
+#define CONFIG_SPL_GPIO_SUPPORT
 
 /*
  * U-Boot Commands
@@ -67,6 +68,7 @@
 #define CONFIG_CMD_SF
 #define CONFIG_CMD_SPI
 #define CONFIG_CMD_USB
+#define CONFIG_CMD_BOOTZ
 
 /*
  * Memory configurations
 #define CONFIG_MXS_MMC
 #endif
 
+/*
+ * NAND Driver
+ */
+#ifdef CONFIG_CMD_NAND
+#define CONFIG_NAND_MXS
+#define CONFIG_SYS_MAX_NAND_DEVICE     1
+#define CONFIG_SYS_NAND_BASE           0x60000000
+#define CONFIG_SYS_NAND_5_ADDR_CYCLE
+#endif
+
 /*
  * Ethernet on SOC (FEC)
  */
 #define CONFIG_BOOTCOMMAND     "run bootcmd_net"
 #define CONFIG_LOADADDR        0x42000000
 #define CONFIG_SYS_LOAD_ADDR   CONFIG_LOADADDR
+#define CONFIG_OF_LIBFDT
 
 /*
  * Extra Environments
diff --git a/include/configs/mx31_3stack.h b/include/configs/mx31_3stack.h
new file mode 100644 (file)
index 0000000..d7629b2
--- /dev/null
@@ -0,0 +1,163 @@
+/*
+ * Copyright 2008-2009 Freescale Semiconductor, Inc. All Rights Reserved.
+ *
+ * Configuration settings for the MX31 3Stack Freescale 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/mx31-regs.h>
+
+ /* High Level Configuration Options */
+#define CONFIG_ARM1136         1       /* This is an arm1136 CPU core */
+#define CONFIG_MX31            1       /* in a mx31 */
+#define CONFIG_MX31_HCLK_FREQ  26000000
+#define CONFIG_MX31_CLK32      32768
+
+#define CONFIG_MX31_NAND
+
+#define CONFIG_DISPLAY_CPUINFO
+#define CONFIG_DISPLAY_BOARDINFO
+
+#define CONFIG_SKIP_RELOCATE_UBOOT
+
+#define CONFIG_CMDLINE_TAG             1       /* enable passing of ATAGs */
+#define CONFIG_SETUP_MEMORY_TAGS       1
+#define CONFIG_INITRD_TAG              1
+
+/*
+ * Size of malloc() pool
+ */
+#define CONFIG_SYS_MALLOC_LEN          (CONFIG_ENV_SIZE + 512 * 1024)
+#define CONFIG_SYS_GBL_DATA_SIZE       128
+
+/*
+ * Hardware drivers
+ */
+#define CONFIG_MXC_UART        1
+#define CONFIG_SYS_MX31_UART1   1
+
+#define CONFIG_MXC_SPI         1
+
+#define CONFIG_RTC_MC13783     1
+#define CONFIG_MC13783_SPI_BUS 1
+#define CONFIG_MC13783_SPI_CS   0
+
+/* allow to overwrite serial and ethaddr */
+#define CONFIG_ENV_OVERWRITE
+#define CONFIG_CONS_INDEX      1
+#define CONFIG_BAUDRATE                115200
+#define CONFIG_SYS_BAUDRATE_TABLE      {9600, 19200, 38400, 57600, 115200}
+
+/***********************************************************
+ * Command definition
+ ***********************************************************/
+
+#include <config_cmd_default.h>
+
+#define CONFIG_CMD_PING
+#define CONFIG_CMD_DHCP
+#define CONFIG_CMD_SPI
+#define CONFIG_CMD_DATE
+#define CONFIG_CMD_NAND
+#undef CONFIG_CMD_IMLS
+
+#define CONFIG_BOOTDELAY       3
+
+#define CONFIG_LOADADDR                0x80800000      /* loadaddr env var */
+
+#define        CONFIG_EXTRA_ENV_SETTINGS                               \
+       "netdev=eth0\0"                                         \
+       "uboot=u-boot.bin\0"                                    \
+       "kernel=uImage\0"                                       \
+       "loadaddr=0x80010000\0"                                 \
+       "tftp_server=10.192.225.58\0"           \
+       "serverip=10.192.225.211\0"                     \
+       "nfsroot=/tools/rootfs/rootfs-2.6.24\0"                 \
+       "bootargs_base=setenv bootargs console=ttymxc0,115200\0"        \
+       "bootargs_nfs=setenv bootargs ${bootargs} root=/dev/nfs "       \
+               "ip=dhcp nfsroot=${serverip}:${nfsroot} rw\0"   \
+       "bootcmd=run bootcmd_net\0"                                     \
+       "bootcmd_net=run bootargs_base bootargs_nfs; "                  \
+               "tftpboot ${loadaddr} ${tftp_server}:${kernel}; bootm\0"
+
+/* configure for smc91xx debug board ethernet */
+#define CONFIG_NET_MULTI
+#define CONFIG_SMC911X          1
+#define CONFIG_SMC911X_16_BIT   1
+#define CONFIG_SMC911X_BASE     CS5_BASE
+
+#define CONFIG_ARP_TIMEOUT     200UL
+
+/*
+ * Miscellaneous configurable options
+ */
+#define CONFIG_SYS_LONGHELP    /* undef to save memory */
+#define CONFIG_SYS_PROMPT      "MX31 U-Boot > "
+#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          CONFIG_MX31_CLK32
+
+#define CONFIG_CMDLINE_EDITING 1
+
+/*-----------------------------------------------------------------------
+ * 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
+#define PHYS_SDRAM_1_SIZE      (128 * 1024 * 1024)
+
+/*
+ * TODO: NAND Flash configure
+ */
+
+#define CONFIG_SYS_NO_FLASH
+#define NAND_MAX_CHIPS         1
+#define CONFIG_SYS_MAX_NAND_DEVICE    1
+#define CONFIG_SYS_NAND_BASE          0x40000000
+
+#define        CONFIG_ENV_IS_IN_NAND   1
+#define CONFIG_ENV_OFFSET      0x40000 /* 2nd block */
+#define CONFIG_ENV_SIZE                (128*1024)
+/*
+ * JFFS2 partitions TODO:
+ */
+#undef CONFIG_JFFS2_CMDLINE
+#define CONFIG_JFFS2_DEV       "nand0"
+
+#endif /* __CONFIG_H */
index 49d440b9ae3c736223244c179c9577d5c7942449..6ce97bc69fe14f9fda0ec7a042f28160c86feb59 100644 (file)
@@ -99,6 +99,7 @@
 #define CONFIG_CMD_SPI
 #define CONFIG_CMD_DATE
 #define CONFIG_CMD_NAND
+#define CONFIG_CMD_BOOTZ
 
 /*
  * Disabled due to compilation errors in cmd_bootm.c (IMLS seems to require
diff --git a/include/configs/mx35_3stack.h b/include/configs/mx35_3stack.h
new file mode 100644 (file)
index 0000000..89b9f39
--- /dev/null
@@ -0,0 +1,253 @@
+/*
+ * Copyright (C) 2007, Guennadi Liakhovetski <lg@denx.de>
+ *
+ * (C) Copyright 2008-2010 Freescale Semiconductor, Inc.
+ *
+ * Configuration settings for the MX31ADS Freescale 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/mx35.h>
+
+ /* High Level Configuration Options */
+#define CONFIG_ARM1136         1       /* This is an arm1136 CPU core */
+#define CONFIG_MXC             1
+#define CONFIG_MX35            1       /* in a mx31 */
+#define CONFIG_MX35_HCLK_FREQ  24000000        /* RedBoot says 26MHz */
+
+#define CONFIG_DISPLAY_CPUINFO
+#define CONFIG_DISPLAY_BOARDINFO
+
+#define CONFIG_SYS_64BIT_VSPRINTF
+
+#define BOARD_LATE_INIT
+/*
+ * Disabled for now due to build problems under Debian and a significant increase
+ * in the final file size: 144260 vs. 109536 Bytes.
+ */
+#if 0
+#define CONFIG_OF_LIBFDT               1
+#define CONFIG_FIT                     1
+#define CONFIG_FIT_VERBOSE             1
+#endif
+
+#define CONFIG_CMDLINE_TAG             1       /* enable passing of ATAGs */
+#define CONFIG_REVISION_TAG            1
+#define CONFIG_SETUP_MEMORY_TAGS       1
+#define CONFIG_INITRD_TAG              1
+
+/*
+ * Size of malloc() pool
+ */
+#define CONFIG_SYS_MALLOC_LEN          (CONFIG_ENV_SIZE + 512 * 1024)
+#define CONFIG_SYS_GBL_DATA_SIZE       128/* size in bytes reserved for initial data */
+
+/*
+ * Hardware drivers
+ */
+#define CONFIG_HARD_I2C                1
+#define CONFIG_I2C_MXC         1
+#define CONFIG_SYS_I2C_PORT            I2C_BASE_ADDR
+#define CONFIG_SYS_I2C_SPEED           100000
+#define CONFIG_SYS_I2C_SLAVE           0xfe
+
+#define CONFIG_MX35_UART       UART1_BASE_ADDR
+
+/* allow to overwrite serial and ethaddr */
+#define CONFIG_ENV_OVERWRITE
+#define CONFIG_CONS_INDEX      1
+#define CONFIG_BAUDRATE                115200
+#define CONFIG_SYS_BAUDRATE_TABLE      {9600, 19200, 38400, 57600, 115200}
+
+/***********************************************************
+ * Command definition
+ ***********************************************************/
+
+#include <config_cmd_default.h>
+
+#define CONFIG_CMD_PING
+#define CONFIG_CMD_DHCP
+#define CONFIG_BOOTP_SUBNETMASK
+#define CONFIG_BOOTP_GATEWAY
+#define CONFIG_BOOTP_DNS
+/*#define CONFIG_CMD_SPI*/
+/*#define CONFIG_CMD_DATE*/
+#define CONFIG_CMD_NAND
+#define CONFIG_MXC_NAND
+
+#define CONFIG_CMD_I2C
+#define CONFIG_CMD_MII
+#define CONFIG_CMD_NET
+#define CONFIG_NET_RETRY_COUNT 100
+
+#define CONFIG_BOOTDELAY       3
+
+#define CONFIG_LOADADDR                0x80800000      /* loadaddr env var */
+
+#define        CONFIG_EXTRA_ENV_SETTINGS                                       \
+               "netdev=eth0\0"                                         \
+               "ethprime=smc911x\0"                                    \
+               "uboot_addr=0xa0000000\0"                               \
+               "uboot=u-boot.bin\0"                    \
+               "kernel=uImage\0"                               \
+               "nfsroot=/opt/eldk/arm\0"                               \
+               "bootargs_base=setenv bootargs console=ttymxc0,115200\0"\
+               "bootargs_nfs=setenv bootargs ${bootargs} root=/dev/nfs "\
+                       "ip=dhcp nfsroot=${serverip}:${nfsroot},v3,tcp\0"\
+               "bootcmd=run bootcmd_net\0"                             \
+               "bootcmd_net=run bootargs_base bootargs_nfs; "          \
+                       "tftpboot ${loadaddr} ${kernel}; bootm\0"       \
+               "prg_uboot=tftpboot ${loadaddr} ${uboot}; "             \
+                       "protect off ${uboot_addr} 0xa003ffff; "        \
+                       "erase ${uboot_addr} 0xa003ffff; "              \
+                       "cp.b ${loadaddr} ${uboot_addr} ${filesize}; "  \
+                       "setenv filesize; saveenv\0"
+
+/*Support LAN9217*/
+#define CONFIG_SMC911X         1
+#define CONFIG_SMC911X_16_BIT 1
+#define CONFIG_SMC911X_BASE CS5_BASE_ADDR
+
+#define CONFIG_HAS_ETH1
+#define CONFIG_NET_MULTI 1
+#define CONFIG_ETHPRIME
+#define CONFIG_MXC_FEC
+#define CONFIG_MII
+#define CONFIG_DISCOVER_PHY
+
+#define CONFIG_FEC0_IOBASE FEC_BASE_ADDR
+#define CONFIG_FEC0_PINMUX     -1
+#define CONFIG_FEC0_PHY_ADDR   0x1F
+#define CONFIG_FEC0_MIIBASE -1
+
+/*
+ * The MX31ADS board seems to have a hardware "peculiarity" confirmed under
+ * U-Boot, RedBoot and Linux: the ethernet Rx signal is reaching the CS8900A
+ * controller inverted. The controller is capable of detecting and correcting
+ * this, but it needs 4 network packets for that. Which means, at startup, you
+ * will not receive answers to the first 4 packest, unless there have been some
+ * broadcasts on the network, or your board is on a hub. Reducing the ARP
+ * timeout from default 5 seconds to 200ms we speed up the initial TFTP
+ * transfer, should the user wish one, significantly.
+ */
+#define CONFIG_ARP_TIMEOUT     200UL
+
+/*
+ * Miscellaneous configurable options
+ */
+#define CONFIG_SYS_LONGHELP    /* undef to save memory */
+#define CONFIG_SYS_PROMPT      "MX35 U-Boot > "
+#define CONFIG_ARCH_CPU_INIT
+#define CONFIG_ARCH_MMU
+#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
+
+#define CONFIG_CMDLINE_EDITING 1
+
+/*-----------------------------------------------------------------------
+ * 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      (128 * 1024 * 1024)
+#define iomem_valid_addr(addr, size) \
+       (addr >= PHYS_SDRAM_1 && addr <= (PHYS_SDRAM_1 + PHYS_SDRAM_1_SIZE))
+
+/*-----------------------------------------------------------------------
+ * 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)    /* Reserve 256KiB */
+
+#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 (2 * 1024 * 1024)
+#define CONFIG_ENV_SIZE_REDUND CONFIG_ENV_SIZE
+
+/*
+ * S29WS256N NOR flash has 4 32KiB small sectors at the beginning and at the
+ * end. The rest of 32MiB is in 128KiB big sectors. U-Boot occupies the low
+ * 4 sectors, if we put environment next to it, we will have to occupy 128KiB
+ * for it. Putting it at the top of flash we use only 32KiB.
+ */
+#define CONFIG_ENV_ADDR                (CONFIG_SYS_MONITOR_BASE + CONFIG_ENV_SECT_SIZE)
+
+#if defined(CONFIG_CMD_NAND)
+       #define CONFIG_FSL_ENV_IN_NAND
+#else
+       #define CONFIG_ENV_IS_IN_FLASH  1
+#endif
+
+#if defined(CONFIG_FSL_ENV_IN_NAND)
+       #define CONFIG_ENV_IS_IN_NAND 1
+       #define CONFIG_ENV_OFFSET       (1024 * 1024)
+#elif defined(CONFIG_FSL_ENV_IS_IN_FLASH)
+       #define CONFIG_ENV_IS_IN_FLASH  1
+#endif
+
+/*-----------------------------------------------------------------------
+ * CFI FLASH driver setup
+ */
+#define CONFIG_SYS_FLASH_CFI           1/* Flash memory is CFI compliant */
+#define CONFIG_FLASH_CFI_DRIVER                1/* Use drivers/cfi_flash.c */
+/* A non-standard buffered write algorithm */
+#define CONFIG_FLASH_SPANSION_S29WS_N  1
+#define CONFIG_SYS_FLASH_USE_BUFFER_WRITE 1/* Use buffered writes (~10x faster) */
+#define CONFIG_SYS_FLASH_PROTECTION    1/* Use hardware sector protection */
+
+/*-----------------------------------------------------------------------
+ * NAND FLASH driver setup
+ */
+#define NAND_MAX_CHIPS         1
+#define CONFIG_SYS_MAX_NAND_DEVICE    1
+#define CONFIG_SYS_NAND_BASE          0x40000000
+/*
+ * JFFS2 partitions
+ */
+#undef CONFIG_JFFS2_CMDLINE
+#define CONFIG_JFFS2_DEV       "nor0"
+
+#endif                         /* __CONFIG_H */
diff --git a/include/configs/mx35_3stack_mfg.h b/include/configs/mx35_3stack_mfg.h
new file mode 100644 (file)
index 0000000..ba962ef
--- /dev/null
@@ -0,0 +1,255 @@
+/*
+ * Copyright (C) 2007, Guennadi Liakhovetski <lg@denx.de>
+ *
+ * (C) Copyright 2008-2010 Freescale Semiconductor, Inc.
+ *
+ * Configuration settings for the MX35 3stack Freescale 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/mx35.h>
+/* for mfg firmware */
+#define CONFIG_MFG
+#define CONFIG_BOOTARGS "console=ttymxc0,115200 rdinit=/linuxrc"
+#define CONFIG_ENV_IS_NOWHERE
+ /* High Level Configuration Options */
+#define CONFIG_ARM1136         1       /* This is an arm1136 CPU core */
+#define CONFIG_MXC             1
+#define CONFIG_MX35            1       /* in a mx31 */
+#define CONFIG_MX35_HCLK_FREQ  24000000        /* RedBoot says 26MHz */
+
+#define CONFIG_ARCH_CPU_INIT
+#define CONFIG_ARCH_MMU
+
+#define CONFIG_DISPLAY_CPUINFO
+#define CONFIG_DISPLAY_BOARDINFO
+
+#define CONFIG_SYS_64BIT_VSPRINTF
+
+#define BOARD_LATE_INIT
+/*
+ * Disabled for now due to build problems under Debian
+ * and a significant increase
+ * in the final file size: 144260 vs. 109536 Bytes.
+ */
+#if 0
+#define CONFIG_OF_LIBFDT               1
+#define CONFIG_FIT                     1
+#define CONFIG_FIT_VERBOSE             1
+#endif
+
+#define CONFIG_CMDLINE_TAG             1       /* enable passing of ATAGs */
+#define CONFIG_REVISION_TAG            1
+#define CONFIG_SETUP_MEMORY_TAGS       1
+#define CONFIG_INITRD_TAG              1
+
+/*
+ * Size of malloc() pool
+ */
+#define CONFIG_SYS_MALLOC_LEN          (CONFIG_ENV_SIZE + 512 * 1024)
+/* size in bytes reserved for initial data */
+#define CONFIG_SYS_GBL_DATA_SIZE       128
+
+/*
+ * Hardware drivers
+ */
+#define CONFIG_HARD_I2C                1
+#define CONFIG_I2C_MXC         1
+#define CONFIG_SYS_I2C_PORT            I2C_BASE_ADDR
+#define CONFIG_SYS_I2C_SPEED           100000
+#define CONFIG_SYS_I2C_SLAVE           0xfe
+
+#define CONFIG_MX35_UART       UART1_BASE_ADDR
+
+/* allow to overwrite serial and ethaddr */
+#define CONFIG_ENV_OVERWRITE
+#define CONFIG_CONS_INDEX      1
+#define CONFIG_BAUDRATE                115200
+#define CONFIG_SYS_BAUDRATE_TABLE      {9600, 19200, 38400, 57600, 115200}
+
+/***********************************************************
+ * Command definition
+ ***********************************************************/
+
+#include <config_cmd_default.h>
+
+#define CONFIG_CMD_PING
+#define CONFIG_CMD_DHCP
+#define CONFIG_BOOTP_SUBNETMASK
+#define CONFIG_BOOTP_GATEWAY
+#define CONFIG_BOOTP_DNS
+/*#define CONFIG_CMD_SPI*/
+/*#define CONFIG_CMD_DATE*/
+/*#define CONFIG_CMD_NAND*/
+#define CONFIG_CMD_ENV
+/* #define CONFIG_CMD_MMC */
+
+#define CONFIG_CMD_I2C
+#define CONFIG_CMD_MII
+#define CONFIG_CMD_NET
+#define CONFIG_NET_RETRY_COUNT 100
+
+#define CONFIG_BOOTDELAY       0
+
+#define CONFIG_LOADADDR                0x80100000      /* loadaddr env var */
+#define CONFIG_BOOTCOMMAND      "bootm ${loadaddr} 0x80800000"
+/*Support LAN9217*/
+#define CONFIG_SMC911X 1
+#define CONFIG_SMC911X_16_BIT 1
+#define CONFIG_SMC911X_BASE CS5_BASE_ADDR
+
+#define CONFIG_HAS_ETH1
+#define CONFIG_NET_MULTI 1
+#define CONFIG_ETHPRIME
+#define CONFIG_MXC_FEC
+#define CONFIG_MII
+#define CONFIG_DISCOVER_PHY
+
+#define CONFIG_FEC0_IOBASE FEC_BASE_ADDR
+#define CONFIG_FEC0_PINMUX     -1
+#define CONFIG_FEC0_PHY_ADDR   0x1F
+#define CONFIG_FEC0_MIIBASE -1
+
+/*
+ * The MX31ADS board seems to have a hardware "peculiarity" confirmed under
+ * U-Boot, RedBoot and Linux: the ethernet Rx signal is reaching the CS8900A
+ * controller inverted. The controller is capable of detecting and correcting
+ * this, but it needs 4 network packets for that. Which means, at startup, you
+ * will not receive answers to the first 4 packest, unless there have been some
+ * broadcasts on the network, or your board is on a hub. Reducing the ARP
+ * timeout from default 5 seconds to 200ms we speed up the initial TFTP
+ * transfer, should the user wish one, significantly.
+ */
+#define CONFIG_ARP_TIMEOUT     200UL
+
+/*
+ * Miscellaneous configurable options
+ */
+#define CONFIG_SYS_LONGHELP    /* undef to save memory */
+#define CONFIG_SYS_PROMPT      "MX35 U-Boot > "
+#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
+
+#define CONFIG_CMDLINE_EDITING 1
+
+/*-----------------------------------------------------------------------
+ * 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      (128 * 1024 * 1024)
+#define iomem_valid_addr(addr, size) \
+       (addr >= PHYS_SDRAM_1 && addr <= (PHYS_SDRAM_1 + PHYS_SDRAM_1_SIZE))
+
+/*
+ * MMC Configs
+ * */
+#ifdef CONFIG_CMD_MMC
+       #define CONFIG_MMC                              1
+       #define CONFIG_GENERIC_MMC
+       #define CONFIG_IMX_MMC
+       #define CONFIG_SYS_FSL_ESDHC_NUM        2
+       #define CONFIG_SYS_FSL_ESDHC_ADDR       0
+       #define CONFIG_SYS_MMC_ENV_DEV          0
+       #define CONFIG_DOS_PARTITION    1
+       #define CONFIG_CMD_FAT          1
+#endif
+
+#define CONFIG_DOS_PARTITION    1
+#define CONFIG_CMD_FAT          1
+
+/*-----------------------------------------------------------------------
+ * 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)    /* Reserve 256KiB */
+
+#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
+
+/*
+ * S29WS256N NOR flash has 4 32KiB small sectors at the beginning and at the
+ * end. The rest of 32MiB is in 128KiB big sectors. U-Boot occupies the low
+ * 4 sectors, if we put environment next to it, we will have to occupy 128KiB
+ * for it. Putting it at the top of flash we use only 32KiB.
+ */
+#define CONFIG_ENV_ADDR                (CONFIG_SYS_MONITOR_BASE + CONFIG_ENV_SECT_SIZE)
+
+#if defined(CONFIG_CMD_MMC)
+       #define CONFIG_ENV_IS_IN_MMC    1
+       #define CONFIG_ENV_OFFSET       (768 * 1024)
+#elif defined(CONFIG_CMD_NAND)
+       #define CONFIG_ENV_IS_IN_NAND 1
+       #define CONFIG_ENV_OFFSET       0x100000
+#else
+       #define CONFIG_ENV_IS_IN_FLASH  1
+#endif
+
+/*-----------------------------------------------------------------------
+ * CFI FLASH driver setup
+ */
+#define CONFIG_SYS_FLASH_CFI           1/* Flash memory is CFI compliant */
+#define CONFIG_FLASH_CFI_DRIVER                1/* Use drivers/cfi_flash.c */
+/* A non-standard buffered write algorithm */
+#define CONFIG_FLASH_SPANSION_S29WS_N  1
+#define CONFIG_SYS_FLASH_USE_BUFFER_WRITE 1/* Use buffered writes (~10x faster) */
+#define CONFIG_SYS_FLASH_PROTECTION    1/* Use hardware sector protection */
+
+/*-----------------------------------------------------------------------
+ * NAND FLASH driver setup
+ */
+#define NAND_MAX_CHIPS         1
+#define CONFIG_SYS_MAX_NAND_DEVICE    1
+#define CONFIG_SYS_NAND_BASE          0x40000000
+/*
+ * JFFS2 partitions
+ */
+#undef CONFIG_JFFS2_CMDLINE
+#define CONFIG_JFFS2_DEV       "nor0"
+
+#endif                         /* __CONFIG_H */
diff --git a/include/configs/mx35_3stack_mmc.h b/include/configs/mx35_3stack_mmc.h
new file mode 100644 (file)
index 0000000..c0c53fd
--- /dev/null
@@ -0,0 +1,273 @@
+/*
+ * Copyright (C) 2007, Guennadi Liakhovetski <lg@denx.de>
+ *
+ * (C) Copyright 2008-2010 Freescale Semiconductor, Inc.
+ *
+ * Configuration settings for the MX31ADS Freescale 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/mx35.h>
+
+ /* High Level Configuration Options */
+#define CONFIG_ARM1136         1       /* This is an arm1136 CPU core */
+#define CONFIG_MXC             1
+#define CONFIG_MX35            1       /* in a mx31 */
+#define CONFIG_MX35_HCLK_FREQ  24000000        /* RedBoot says 26MHz */
+
+#define CONFIG_ARCH_CPU_INIT
+#define CONFIG_ARCH_MMU
+
+#define CONFIG_DISPLAY_CPUINFO
+#define CONFIG_DISPLAY_BOARDINFO
+
+#define CONFIG_SYS_64BIT_VSPRINTF
+
+#define BOARD_LATE_INIT
+/*
+ * Disabled for now due to build problems under Debian and a significant increase
+ * in the final file size: 144260 vs. 109536 Bytes.
+ */
+#if 0
+#define CONFIG_OF_LIBFDT               1
+#define CONFIG_FIT                     1
+#define CONFIG_FIT_VERBOSE             1
+#endif
+
+#define CONFIG_CMDLINE_TAG             1       /* enable passing of ATAGs */
+#define CONFIG_REVISION_TAG            1
+#define CONFIG_SETUP_MEMORY_TAGS       1
+#define CONFIG_INITRD_TAG              1
+
+/*
+ * Size of malloc() pool
+ */
+#define CONFIG_SYS_MALLOC_LEN          (CONFIG_ENV_SIZE + 512 * 1024)
+#define CONFIG_SYS_GBL_DATA_SIZE       128/* size in bytes reserved for initial data */
+
+/*
+ * Hardware drivers
+ */
+#define CONFIG_HARD_I2C                1
+#define CONFIG_I2C_MXC         1
+#define CONFIG_SYS_I2C_PORT            I2C_BASE_ADDR
+#define CONFIG_SYS_I2C_SPEED           100000
+#define CONFIG_SYS_I2C_SLAVE           0xfe
+
+#define CONFIG_MX35_UART       UART1_BASE_ADDR
+
+/* allow to overwrite serial and ethaddr */
+#define CONFIG_ENV_OVERWRITE
+#define CONFIG_CONS_INDEX      1
+#define CONFIG_BAUDRATE                115200
+#define CONFIG_SYS_BAUDRATE_TABLE      {9600, 19200, 38400, 57600, 115200}
+
+/***********************************************************
+ * Command definition
+ ***********************************************************/
+
+#include <config_cmd_default.h>
+
+#define CONFIG_CMD_PING
+#define CONFIG_CMD_DHCP
+#define CONFIG_BOOTP_SUBNETMASK
+#define CONFIG_BOOTP_GATEWAY
+#define CONFIG_BOOTP_DNS
+/*#define CONFIG_CMD_SPI*/
+/*#define CONFIG_CMD_DATE*/
+/*#define CONFIG_CMD_NAND*/
+#define CONFIG_CMD_ENV
+#define CONFIG_CMD_MMC
+
+#define CONFIG_CMD_I2C
+#define CONFIG_CMD_MII
+#define CONFIG_CMD_NET
+#define CONFIG_NET_RETRY_COUNT 100
+
+#define CONFIG_BOOTDELAY       3
+
+#define CONFIG_LOADADDR                0x80800000      /* loadaddr env var */
+
+#define        CONFIG_EXTRA_ENV_SETTINGS                                       \
+               "netdev=eth0\0"                                         \
+               "ethprime=smc911x\0"                                    \
+               "uboot_addr=0xa0000000\0"                               \
+               "uboot=u-boot.bin\0"                    \
+               "kernel=uImage\0"                               \
+               "nfsroot=/opt/eldk/arm\0"                               \
+               "bootargs_base=setenv bootargs console=ttymxc0,115200\0"\
+               "bootargs_nfs=setenv bootargs ${bootargs} root=/dev/nfs "\
+                       "ip=dhcp nfsroot=${serverip}:${nfsroot},v3,tcp\0"\
+               "bootcmd=run bootcmd_net\0"                             \
+               "bootcmd_net=run bootargs_base bootargs_nfs; "          \
+                       "tftpboot ${loadaddr} ${kernel}; bootm\0"       \
+               "prg_uboot=tftpboot ${loadaddr} ${uboot}; "             \
+                       "protect off ${uboot_addr} 0xa003ffff; "        \
+                       "erase ${uboot_addr} 0xa003ffff; "              \
+                       "cp.b ${loadaddr} ${uboot_addr} ${filesize}; "  \
+                       "setenv filesize; saveenv\0"
+
+/*Support LAN9217*/
+#define CONFIG_SMC911X 1
+#define CONFIG_SMC911X_16_BIT 1
+#define CONFIG_SMC911X_BASE CS5_BASE_ADDR
+
+#define CONFIG_HAS_ETH1
+#define CONFIG_NET_MULTI 1
+#define CONFIG_ETHPRIME
+#define CONFIG_MXC_FEC
+#define CONFIG_MII
+#define CONFIG_DISCOVER_PHY
+
+#define CONFIG_FEC0_IOBASE FEC_BASE_ADDR
+#define CONFIG_FEC0_PINMUX     -1
+#define CONFIG_FEC0_PHY_ADDR   0x1F
+#define CONFIG_FEC0_MIIBASE -1
+
+/*
+ * The MX31ADS board seems to have a hardware "peculiarity" confirmed under
+ * U-Boot, RedBoot and Linux: the ethernet Rx signal is reaching the CS8900A
+ * controller inverted. The controller is capable of detecting and correcting
+ * this, but it needs 4 network packets for that. Which means, at startup, you
+ * will not receive answers to the first 4 packest, unless there have been some
+ * broadcasts on the network, or your board is on a hub. Reducing the ARP
+ * timeout from default 5 seconds to 200ms we speed up the initial TFTP
+ * transfer, should the user wish one, significantly.
+ */
+#define CONFIG_ARP_TIMEOUT     200UL
+
+/*
+ * Miscellaneous configurable options
+ */
+#define CONFIG_SYS_LONGHELP    /* undef to save memory */
+#define CONFIG_SYS_PROMPT      "MX35 U-Boot > "
+#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
+
+#define CONFIG_CMDLINE_EDITING 1
+
+/*-----------------------------------------------------------------------
+ * 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      (128 * 1024 * 1024)
+#define iomem_valid_addr(addr, size) \
+       (addr >= PHYS_SDRAM_1 && addr <= (PHYS_SDRAM_1 + PHYS_SDRAM_1_SIZE))
+
+/*
+ * MMC Configs
+ * */
+#ifdef CONFIG_CMD_MMC
+       #define CONFIG_MMC                              1
+       #define CONFIG_GENERIC_MMC
+       #define CONFIG_IMX_MMC
+       #define CONFIG_SYS_FSL_ESDHC_NUM        2
+       #define CONFIG_SYS_FSL_ESDHC_ADDR       0
+       #define CONFIG_SYS_MMC_ENV_DEV          0
+       #define CONFIG_DOS_PARTITION    1
+       #define CONFIG_CMD_FAT          1
+#endif
+
+#define CONFIG_FLASH_HEADER     1
+#define CONFIG_FLASH_HEADER_OFFSET 0x400
+#define CONFIG_FLASH_HEADER_BARKER 0xB1
+
+#define CONFIG_DOS_PARTITION    1
+#define CONFIG_CMD_FAT          1
+
+/*-----------------------------------------------------------------------
+ * 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)    /* Reserve 256KiB */
+
+#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
+
+/*
+ * S29WS256N NOR flash has 4 32KiB small sectors at the beginning and at the
+ * end. The rest of 32MiB is in 128KiB big sectors. U-Boot occupies the low
+ * 4 sectors, if we put environment next to it, we will have to occupy 128KiB
+ * for it. Putting it at the top of flash we use only 32KiB.
+ */
+#define CONFIG_ENV_ADDR                (CONFIG_SYS_MONITOR_BASE + CONFIG_ENV_SECT_SIZE)
+
+#if defined(CONFIG_CMD_MMC)
+       #define CONFIG_ENV_IS_IN_MMC    1
+       #define CONFIG_ENV_OFFSET       (768 * 1024)
+#elif defined(CONFIG_CMD_NAND)
+       #define CONFIG_ENV_IS_IN_NAND 1
+       #define CONFIG_ENV_OFFSET       0x100000
+#else
+       #define CONFIG_ENV_IS_IN_FLASH  1
+#endif
+
+/*-----------------------------------------------------------------------
+ * CFI FLASH driver setup
+ */
+#define CONFIG_SYS_FLASH_CFI           1/* Flash memory is CFI compliant */
+#define CONFIG_FLASH_CFI_DRIVER                1/* Use drivers/cfi_flash.c */
+/* A non-standard buffered write algorithm */
+#define CONFIG_FLASH_SPANSION_S29WS_N  1
+#define CONFIG_SYS_FLASH_USE_BUFFER_WRITE 1/* Use buffered writes (~10x faster) */
+#define CONFIG_SYS_FLASH_PROTECTION    1/* Use hardware sector protection */
+
+/*-----------------------------------------------------------------------
+ * NAND FLASH driver setup
+ */
+#define NAND_MAX_CHIPS         1
+#define CONFIG_SYS_MAX_NAND_DEVICE    1
+#define CONFIG_SYS_NAND_BASE          0x40000000
+/*
+ * JFFS2 partitions
+ */
+#undef CONFIG_JFFS2_CMDLINE
+#define CONFIG_JFFS2_DEV       "nor0"
+
+#endif                         /* __CONFIG_H */
index de4b954a52fa3d225aa8766e1004cf0a294a1e1b..bd57baa808ff1c4f76735ec7c6555097b3b11aa2 100644 (file)
@@ -39,8 +39,6 @@
 #define CONFIG_SYS_TEXT_BASE   0xA0000000
 #define CONFIG_SYS_CACHELINE_SIZE      32
 
-#define CONFIG_SYS_64BIT_VSPRINTF
-
 #define CONFIG_BOARD_EARLY_INIT_F
 #define CONFIG_BOARD_LATE_INIT
 
diff --git a/include/configs/mx50_arm2.h b/include/configs/mx50_arm2.h
new file mode 100644 (file)
index 0000000..c7f8faf
--- /dev/null
@@ -0,0 +1,284 @@
+/*
+ * Copyright (C) 2010 Freescale Semiconductor, Inc.
+ *
+ * Configuration settings for the MX50-ARM2 Freescale 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/mx50.h>
+
+ /* High Level Configuration Options */
+#define CONFIG_MXC
+#define CONFIG_MX50
+#define CONFIG_MX50_ARM2
+#define CONFIG_FLASH_HEADER
+#define CONFIG_FLASH_HEADER_OFFSET 0x400
+
+#define CONFIG_SKIP_RELOCATE_UBOOT
+
+#define CONFIG_ARCH_CPU_INIT
+#define CONFIG_ARCH_MMU
+
+#define CONFIG_MX50_HCLK_FREQ  24000000
+#define CONFIG_SYS_PLL2_FREQ    400
+#define CONFIG_SYS_AHB_PODF     2
+#define CONFIG_SYS_AXIA_PODF    0
+#define CONFIG_SYS_AXIB_PODF    1
+
+#define CONFIG_DISPLAY_CPUINFO
+#define CONFIG_DISPLAY_BOARDINFO
+
+#define CONFIG_SYS_64BIT_VSPRINTF
+
+#define BOARD_LATE_INIT
+/*
+ * 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             1       /* enable passing of ATAGs */
+#define CONFIG_REVISION_TAG            1
+#define CONFIG_SETUP_MEMORY_TAGS       1
+#define CONFIG_INITRD_TAG              1
+
+/*
+ * Size of malloc() pool
+ */
+#define CONFIG_SYS_MALLOC_LEN          (CONFIG_ENV_SIZE + 2 * 1024 * 1024)
+/* size in bytes reserved for initial data */
+#define CONFIG_SYS_GBL_DATA_SIZE       128
+
+/*
+ * Hardware drivers
+ */
+#define CONFIG_MX50_UART       1
+#define CONFIG_MX50_UART1      1
+
+/* allow to overwrite serial and ethaddr */
+#define CONFIG_ENV_OVERWRITE
+#define CONFIG_CONS_INDEX              1
+#define CONFIG_BAUDRATE                        115200
+#define CONFIG_SYS_BAUDRATE_TABLE      {9600, 19200, 38400, 57600, 115200}
+
+/***********************************************************
+ * Command definition
+ ***********************************************************/
+
+#include <config_cmd_default.h>
+
+#define CONFIG_CMD_PING
+#define CONFIG_CMD_DHCP
+#define CONFIG_CMD_MII
+#define CONFIG_CMD_NET
+#define CONFIG_NET_RETRY_COUNT  100
+#define CONFIG_NET_MULTI 1
+#define CONFIG_BOOTP_SUBNETMASK
+#define CONFIG_BOOTP_GATEWAY
+#define CONFIG_BOOTP_DNS
+
+#define CONFIG_CMD_MMC
+#define CONFIG_CMD_ENV
+
+/*#define CONFIG_CMD */
+#define CONFIG_REF_CLK_FREQ CONFIG_MX50_HCLK_FREQ
+
+#undef CONFIG_CMD_IMLS
+
+#define CONFIG_BOOTDELAY       3
+
+#define CONFIG_PRIME   "FEC0"
+
+#define CONFIG_LOADADDR                0x70800000      /* loadaddr env var */
+#define CONFIG_RD_LOADADDR     (CONFIG_LOADADDR + 0x300000)
+
+#define        CONFIG_EXTRA_ENV_SETTINGS                                       \
+               "netdev=eth0\0"                                         \
+               "ethprime=FEC0\0"                                       \
+               "uboot=u-boot.bin\0"                    \
+               "kernel=uImage\0"                               \
+               "nfsroot=/opt/eldk/arm\0"                               \
+               "bootargs_base=setenv bootargs console=ttymxc0,115200\0"\
+               "bootargs_nfs=setenv bootargs ${bootargs} root=/dev/nfs "\
+                       "ip=dhcp nfsroot=${serverip}:${nfsroot},v3,tcp\0"\
+               "bootcmd_net=run bootargs_base bootargs_nfs; "          \
+                       "tftpboot ${loadaddr} ${kernel}; bootm\0"       \
+               "bootargs_mmc=setenv bootargs ${bootargs} ip=dhcp "     \
+                       "root=/dev/mmcblk0p2 rootwait\0"                \
+               "bootcmd_mmc=run bootargs_base bootargs_mmc; bootm\0"   \
+               "bootcmd=run bootcmd_net\0"                             \
+
+
+#define CONFIG_ARP_TIMEOUT     200UL
+
+/*
+ * Miscellaneous configurable options
+ */
+#define CONFIG_SYS_LONGHELP            /* undef to save memory */
+#define CONFIG_SYS_PROMPT              "ARM2 U-Boot > "
+#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
+
+#define CONFIG_CMDLINE_EDITING 1
+
+#define CONFIG_FEC0_IOBASE     FEC_BASE_ADDR
+#define CONFIG_FEC0_PINMUX     -1
+#define CONFIG_FEC0_PHY_ADDR   -1
+#define CONFIG_FEC0_MIIBASE    -1
+
+#define CONFIG_GET_FEC_MAC_ADDR_FROM_IIM
+
+#define CONFIG_MXC_FEC
+#define CONFIG_MII
+#define CONFIG_MII_GASKET
+#define CONFIG_DISCOVER_PHY
+
+/*
+#define CONFIG_SPLASH_SCREEN
+*/
+
+/*
+ * SPLASH SCREEN Configs
+ */
+#ifdef CONFIG_SPLASH_SCREEN
+       #define CONFIG_LCD
+       #undef LCD_TEST_PATTERN
+       #define CONFIG_FB_BASE                          (TEXT_BASE + 0x300000)
+       #define CONFIG_SYS_CONSOLE_IS_IN_ENV            1
+       /* #define CONFIG_SPLASH_IS_IN_MMC                 1 */
+       #define LCD_BPP                                 LCD_MONOCHROME
+       /* #define CONFIG_SPLASH_SCREEN_ALIGN           1 */
+
+       #define CONFIG_MXC_EPDC                         1
+
+       #define CONFIG_WORKING_BUF_ADDR                 (TEXT_BASE + 0x100000)
+       #define CONFIG_WAVEFORM_BUF_ADDR                (TEXT_BASE + 0x200000)
+       #define CONFIG_WAVEFORM_FILE_OFFSET             0x100000
+       #define CONFIG_WAVEFORM_FILE_SIZE               0xB4000
+       #define CONFIG_WAVEFORM_FILE_IN_MMC
+#endif
+
+#ifdef CONFIG_SPLASH_IS_IN_MMC
+       #define CONFIG_SPLASH_IMG_OFFSET                0x4c000
+       #define CONFIG_SPLASH_IMG_SIZE                  0x19000
+#endif
+
+/*
+ * I2C Configs
+ */
+#define CONFIG_CMD_I2C          1
+#define CONFIG_HARD_I2C         1
+#define CONFIG_I2C_MXC          1
+#define CONFIG_SYS_I2C_PORT             I2C2_BASE_ADDR
+#define CONFIG_SYS_I2C_SPEED            100000
+#define CONFIG_SYS_I2C_SLAVE            0xfe
+
+
+/*
+ * SPI Configs
+ */
+#define CONFIG_FSL_SF          1
+#define CONFIG_CMD_SPI
+#define CONFIG_CMD_SF
+#define CONFIG_SPI_FLASH_IMX_ATMEL     1
+#define CONFIG_SPI_FLASH_CS    1
+#define CONFIG_IMX_CSPI
+#define IMX_CSPI_VER_0_7        1
+#define MAX_SPI_BYTES          (8 * 4)
+#define CONFIG_IMX_SPI_PMIC
+#define CONFIG_IMX_SPI_PMIC_CS 0
+
+/*
+ * MMC Configs
+ */
+#ifdef CONFIG_CMD_MMC
+       #define CONFIG_MMC                              1
+       #define CONFIG_GENERIC_MMC
+       #define CONFIG_IMX_MMC
+       #define CONFIG_SYS_FSL_ESDHC_NUM        3
+       #define CONFIG_SYS_FSL_ESDHC_ADDR       0
+       #define CONFIG_SYS_MMC_ENV_DEV  0
+       #define CONFIG_DOS_PARTITION    1
+       #define CONFIG_CMD_FAT          1
+       #define CONFIG_CMD_EXT2         1
+
+       /* detect whether ESDHC1, ESDHC2, or ESDHC3 is boot device */
+       #define CONFIG_DYNAMIC_MMC_DEVNO
+
+       #define CONFIG_BOOT_PARTITION_ACCESS
+       #define CONFIG_EMMC_DDR_MODE
+
+       /* Indicate to esdhc driver which ports support 8-bit data */
+       #define CONFIG_MMC_8BIT_PORTS           0x6   /* ports 1 and 2 */
+
+#endif
+/*-----------------------------------------------------------------------
+ * 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 iomem_valid_addr(addr, size) \
+       (addr >= PHYS_SDRAM_1 && addr <= (PHYS_SDRAM_1 + PHYS_SDRAM_1_SIZE))
+
+/*-----------------------------------------------------------------------
+ * FLASH and environment organization
+ */
+#define CONFIG_SYS_NO_FLASH
+
+/* Monitor at beginning of flash */
+#define CONFIG_FSL_ENV_IN_MMC
+
+#define CONFIG_ENV_SECT_SIZE    (128 * 1024)
+#define CONFIG_ENV_SIZE         CONFIG_ENV_SECT_SIZE
+
+#if defined(CONFIG_FSL_ENV_IN_NAND)
+       #define CONFIG_ENV_IS_IN_NAND 1
+       #define CONFIG_ENV_OFFSET       0x100000
+#elif defined(CONFIG_FSL_ENV_IN_MMC)
+       #define CONFIG_ENV_IS_IN_MMC    1
+       #define CONFIG_ENV_OFFSET       (768 * 1024)
+#elif defined(CONFIG_FSL_ENV_IN_SF)
+       #define CONFIG_ENV_IS_IN_SPI_FLASH      1
+       #define CONFIG_ENV_SPI_CS               1
+       #define CONFIG_ENV_OFFSET       (768 * 1024)
+#else
+       #define CONFIG_ENV_IS_NOWHERE   1
+#endif
+#endif                         /* __CONFIG_H */
diff --git a/include/configs/mx50_arm2_iram.h b/include/configs/mx50_arm2_iram.h
new file mode 100644 (file)
index 0000000..0e7f4b4
--- /dev/null
@@ -0,0 +1,194 @@
+/*
+ * Copyright (C) 2010 Freescale Semiconductor, Inc.
+ *
+ * Configuration settings for the MX50-ARM2 Freescale 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/mx50.h>
+
+ /* High Level Configuration Options */
+#define CONFIG_ARMV7           1       /* This is armv7 Cortex-A8 CPU core */
+
+#define CONFIG_MXC
+#define CONFIG_MX50
+#define CONFIG_MX50_ARM2
+#define CONFIG_FLASH_HEADER
+#define CONFIG_FLASH_HEADER_OFFSET 0x400
+
+#define CONFIG_SKIP_RELOCATE_UBOOT
+
+/*
+#define CONFIG_ARCH_CPU_INIT
+#define CONFIG_ARCH_MMU
+*/
+
+#define CONFIG_MX50_HCLK_FREQ  24000000
+#define CONFIG_SYS_PLL2_FREQ    600
+#define CONFIG_SYS_AHB_PODF     4
+#define CONFIG_SYS_AXIA_PODF    1
+#define CONFIG_SYS_AXIB_PODF    2
+#define CONFIG_DISPLAY_CPUINFO
+#define CONFIG_DISPLAY_BOARDINFO
+
+#define BOARD_LATE_INIT
+
+/*
+ * 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             1       /* enable passing of ATAGs */
+#define CONFIG_REVISION_TAG            1
+#define CONFIG_SETUP_MEMORY_TAGS       1
+#define CONFIG_INITRD_TAG              1
+
+/*
+ * Size of malloc() pool
+ */
+#define CONFIG_SYS_MALLOC_LEN          (3 * 1024)
+/* size in bytes reserved for initial data */
+#define CONFIG_SYS_GBL_DATA_SIZE       128
+
+/*
+ * Hardware drivers
+ */
+#define CONFIG_MX50_UART       1
+#define CONFIG_MX50_UART1      1
+
+/* allow to overwrite serial and ethaddr */
+#define CONFIG_ENV_OVERWRITE
+#define CONFIG_CONS_INDEX              1
+#define CONFIG_BAUDRATE                        115200
+#define CONFIG_SYS_BAUDRATE_TABLE      {9600, 19200, 38400, 57600, 115200}
+
+/***********************************************************
+ * Command definition
+ ***********************************************************/
+
+#define CONFIG_CMD_BDI         /* bdinfo                       */
+#define CONFIG_CMD_BOOTD       /* bootd                        */
+#define CONFIG_CMD_CONSOLE     /* coninfo                      */
+#define CONFIG_CMD_RUN         /* run command in env variable  */
+
+/*
+ * SPI Configs
+ * */
+
+/*
+ * MMC Configs
+ * */
+/*
+ * Eth Configs
+ */
+
+
+/* Enable below configure when supporting nand */
+#define CONFIG_CMD_ENV
+
+#define CONFIG_REF_CLK_FREQ CONFIG_MX50_HCLK_FREQ
+
+#undef CONFIG_CMD_IMLS
+
+#define CONFIG_BOOTDELAY       3
+
+#define CONFIG_PRIME   "FEC0"
+
+#define CONFIG_LOADADDR                0x70800000      /* loadaddr env var */
+#define CONFIG_RD_LOADADDR     (CONFIG_LOADADDR + 0x300000)
+
+#define CONFIG_BOOTARGS         "console=ttymxc0,115200 "\
+                               "rdinit=/linuxrc"
+
+#define CONFIG_BOOTCOMMAND      "bootm"
+#define CONFIG_ENV_IS_EMBEDDED
+/*
+ * The MX51 3stack board seems to have a hardware "peculiarity" confirmed under
+ * U-Boot, RedBoot and Linux: the ethernet Rx signal is reaching the CS8900A
+ * controller inverted. The controller is capable of detecting and correcting
+ * this, but it needs 4 network packets for that. Which means, at startup, you
+ * will not receive answers to the first 4 packest, unless there have been some
+ * broadcasts on the network, or your board is on a hub. Reducing the ARP
+ * timeout from default 5 seconds to 200ms we speed up the initial TFTP
+ * transfer, should the user wish one, significantly.
+ */
+#define CONFIG_ARP_TIMEOUT     200UL
+
+/*
+ * Miscellaneous configurable options
+ */
+#define CONFIG_SYS_PROMPT              "ARM2 U-Boot > "
+#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
+
+#define CONFIG_CMDLINE_EDITING 1
+
+/*-----------------------------------------------------------------------
+ * Stack sizes
+ *
+ * The stack sizes are set up in start.S using the settings below
+ */
+#define CONFIG_STACKSIZE       (6 * 1024)      /* regular stack */
+
+/*-----------------------------------------------------------------------
+ * Physical Memory Map
+ */
+#define CONFIG_NR_DRAM_BANKS   1
+#define PHYS_SDRAM_1           CSD0_BASE_ADDR
+/* TO1 boards */
+/* #define PHYS_SDRAM_1_SIZE   (128 * 1024 * 1024) */
+#define PHYS_SDRAM_1_SIZE      (512 * 1024 * 1024)
+#define iomem_valid_addr(addr, size) \
+       (addr >= PHYS_SDRAM_1 && addr <= (PHYS_SDRAM_1 + PHYS_SDRAM_1_SIZE))
+
+/*-----------------------------------------------------------------------
+ * FLASH and environment organization
+ */
+#define CONFIG_SYS_NO_FLASH
+
+/* Monitor at beginning of flash */
+/* #define CONFIG_FSL_ENV_IN_SF
+*/
+/* #define CONFIG_FSL_ENV_IN_MMC */
+
+#define CONFIG_ENV_SECT_SIZE    (1 * 1024)
+#define CONFIG_ENV_SIZE         CONFIG_ENV_SECT_SIZE
+#define CONFIG_ENV_IS_NOWHERE
+
+/*
+ * JFFS2 partitions
+ */
+/*
+#undef CONFIG_JFFS2_CMDLINE
+#define CONFIG_JFFS2_DEV       "nand0"
+*/
+#endif                         /* __CONFIG_H */
diff --git a/include/configs/mx50_arm2_lpddr2.h b/include/configs/mx50_arm2_lpddr2.h
new file mode 100644 (file)
index 0000000..6efe6a6
--- /dev/null
@@ -0,0 +1,286 @@
+/*
+ * Copyright (C) 2010 Freescale Semiconductor, Inc.
+ *
+ * Configuration settings for the MX50-ARM2 Freescale 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/mx50.h>
+
+ /* High Level Configuration Options */
+#define CONFIG_MXC
+#define CONFIG_MX50
+#define CONFIG_MX50_ARM2
+#define CONFIG_LPDDR2
+#define CONFIG_FLASH_HEADER
+#define CONFIG_FLASH_HEADER_OFFSET 0x400
+
+#define CONFIG_SKIP_RELOCATE_UBOOT
+
+#define CONFIG_ARCH_CPU_INIT
+#define CONFIG_ARCH_MMU
+
+#define CONFIG_MX50_HCLK_FREQ  24000000
+#define CONFIG_SYS_PLL2_FREQ    400
+#define CONFIG_SYS_AHB_PODF     2
+#define CONFIG_SYS_AXIA_PODF    0
+#define CONFIG_SYS_AXIB_PODF    1
+
+#define CONFIG_DISPLAY_CPUINFO
+#define CONFIG_DISPLAY_BOARDINFO
+
+#define CONFIG_SYS_64BIT_VSPRINTF
+
+#define BOARD_LATE_INIT
+/*
+ * 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             1       /* enable passing of ATAGs */
+#define CONFIG_REVISION_TAG            1
+#define CONFIG_SETUP_MEMORY_TAGS       1
+#define CONFIG_INITRD_TAG              1
+
+/*
+ * Size of malloc() pool
+ */
+#define CONFIG_SYS_MALLOC_LEN          (CONFIG_ENV_SIZE + 2 * 1024 * 1024)
+/* size in bytes reserved for initial data */
+#define CONFIG_SYS_GBL_DATA_SIZE       128
+
+/*
+ * Hardware drivers
+ */
+#define CONFIG_MX50_UART       1
+#define CONFIG_MX50_UART1      1
+
+/* allow to overwrite serial and ethaddr */
+#define CONFIG_ENV_OVERWRITE
+#define CONFIG_CONS_INDEX              1
+#define CONFIG_BAUDRATE                        115200
+#define CONFIG_SYS_BAUDRATE_TABLE      {9600, 19200, 38400, 57600, 115200}
+
+/***********************************************************
+ * Command definition
+ ***********************************************************/
+
+#include <config_cmd_default.h>
+
+#define CONFIG_CMD_PING
+#define CONFIG_CMD_DHCP
+#define CONFIG_CMD_MII
+#define CONFIG_CMD_NET
+#define CONFIG_NET_RETRY_COUNT  100
+#define CONFIG_NET_MULTI 1
+#define CONFIG_BOOTP_SUBNETMASK
+#define CONFIG_BOOTP_GATEWAY
+#define CONFIG_BOOTP_DNS
+
+#define CONFIG_CMD_MMC
+#define CONFIG_CMD_ENV
+
+/*#define CONFIG_CMD */
+#define CONFIG_REF_CLK_FREQ CONFIG_MX50_HCLK_FREQ
+
+#undef CONFIG_CMD_IMLS
+
+#define CONFIG_BOOTDELAY       3
+
+#define CONFIG_PRIME   "FEC0"
+
+#define CONFIG_LOADADDR                0x70800000      /* loadaddr env var */
+#define CONFIG_RD_LOADADDR     (CONFIG_LOADADDR + 0x300000)
+
+#define        CONFIG_EXTRA_ENV_SETTINGS                                       \
+               "netdev=eth0\0"                                         \
+               "ethprime=FEC0\0"                                       \
+               "uboot=u-boot.bin\0"                    \
+               "kernel=uImage\0"                               \
+               "nfsroot=/opt/eldk/arm\0"                               \
+               "bootargs_base=setenv bootargs console=ttymxc0,115200\0"\
+               "bootargs_nfs=setenv bootargs ${bootargs} root=/dev/nfs "\
+                       "ip=dhcp nfsroot=${serverip}:${nfsroot},v3,tcp\0"\
+               "bootcmd_net=run bootargs_base bootargs_nfs; "          \
+                       "tftpboot ${loadaddr} ${kernel}; bootm\0"       \
+               "bootargs_mmc=setenv bootargs ${bootargs} ip=dhcp "     \
+                       "root=/dev/mmcblk0p2 rootwait\0"                \
+               "bootcmd_mmc=run bootargs_base bootargs_mmc; bootm\0"   \
+               "bootcmd=run bootcmd_net\0"                             \
+
+
+#define CONFIG_ARP_TIMEOUT     200UL
+
+/*
+ * Miscellaneous configurable options
+ */
+#define CONFIG_SYS_LONGHELP            /* undef to save memory */
+#define CONFIG_SYS_PROMPT              "ARM2 U-Boot > "
+#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
+
+#define CONFIG_CMDLINE_EDITING 1
+
+#define CONFIG_FEC0_IOBASE     FEC_BASE_ADDR
+#define CONFIG_FEC0_PINMUX     -1
+#define CONFIG_FEC0_PHY_ADDR   -1
+#define CONFIG_FEC0_MIIBASE    -1
+
+#define CONFIG_GET_FEC_MAC_ADDR_FROM_IIM
+
+#define CONFIG_MXC_FEC
+#define CONFIG_MII
+#define CONFIG_MII_GASKET
+#define CONFIG_DISCOVER_PHY
+
+/*
+#define CONFIG_SPLASH_SCREEN
+*/
+
+/*
+ * SPLASH SCREEN Configs
+ */
+#ifdef CONFIG_SPLASH_SCREEN
+       #define CONFIG_LCD
+       #undef LCD_TEST_PATTERN
+       #define CONFIG_FB_BASE                          (TEXT_BASE + 0x300000)
+       #define CONFIG_SYS_CONSOLE_IS_IN_ENV            1
+       /* #define CONFIG_SPLASH_IS_IN_MMC                 1 */
+       #define LCD_BPP                                 LCD_MONOCHROME
+       /* #define CONFIG_SPLASH_SCREEN_ALIGN           1 */
+
+       #define CONFIG_MXC_EPDC                         1
+
+       #define CONFIG_WORKING_BUF_ADDR                 (TEXT_BASE + 0x100000)
+       #define CONFIG_WAVEFORM_BUF_ADDR                (TEXT_BASE + 0x200000)
+       #define CONFIG_WAVEFORM_FILE_OFFSET             0x100000
+       #define CONFIG_WAVEFORM_FILE_SIZE               0xB4000
+       #define CONFIG_WAVEFORM_FILE_IN_MMC
+#endif
+
+#ifdef CONFIG_SPLASH_IS_IN_MMC
+       #define CONFIG_SPLASH_IMG_OFFSET                0x4c000
+       #define CONFIG_SPLASH_IMG_SIZE                  0x19000
+#endif
+
+/*
+ * I2C Configs
+ */
+#define CONFIG_CMD_I2C          1
+#define CONFIG_HARD_I2C         1
+#define CONFIG_I2C_MXC          1
+#define CONFIG_SYS_I2C_PORT             I2C2_BASE_ADDR
+#define CONFIG_SYS_I2C_SPEED            100000
+#define CONFIG_SYS_I2C_SLAVE            0xfe
+
+
+/*
+ * SPI Configs
+ */
+#define CONFIG_FSL_SF          1
+#define CONFIG_CMD_SPI
+#define CONFIG_CMD_SF
+#define CONFIG_SPI_FLASH_IMX_ATMEL     1
+#define CONFIG_SPI_FLASH_CS    1
+#define CONFIG_IMX_CSPI
+#define IMX_CSPI_VER_0_7        1
+#define MAX_SPI_BYTES          (8 * 4)
+#define CONFIG_IMX_SPI_PMIC
+#define CONFIG_IMX_SPI_PMIC_CS 0
+
+/*
+ * MMC Configs
+ */
+#ifdef CONFIG_CMD_MMC
+       #define CONFIG_MMC                              1
+       #define CONFIG_GENERIC_MMC
+       #define CONFIG_IMX_MMC
+       #define CONFIG_SYS_FSL_ESDHC_NUM        3
+       #define CONFIG_SYS_FSL_ESDHC_ADDR       0
+       #define CONFIG_SYS_MMC_ENV_DEV  0
+       #define CONFIG_DOS_PARTITION    1
+       #define CONFIG_CMD_FAT          1
+       #define CONFIG_CMD_EXT2         1
+
+       /* detect whether ESDHC1, ESDHC2, or ESDHC3 is boot device */
+       #define CONFIG_DYNAMIC_MMC_DEVNO
+
+       #define CONFIG_BOOT_PARTITION_ACCESS
+       #define CONFIG_EMMC_DDR_MODE
+
+       /* Indicate to esdhc driver which ports support 8-bit data */
+       #define CONFIG_MMC_8BIT_PORTS           0x6   /* ports 1 and 2 */
+
+
+#endif
+/*-----------------------------------------------------------------------
+ * 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   2
+#define PHYS_SDRAM_1           CSD0_BASE_ADDR
+#define PHYS_SDRAM_1_SIZE      (256 * 1024 * 1024)
+#define iomem_valid_addr(addr, size) \
+       (addr >= PHYS_SDRAM_1 && addr <= (PHYS_SDRAM_1 + PHYS_SDRAM_1_SIZE))
+
+/*-----------------------------------------------------------------------
+ * FLASH and environment organization
+ */
+#define CONFIG_SYS_NO_FLASH
+
+/* Monitor at beginning of flash */
+#define CONFIG_FSL_ENV_IN_MMC
+
+#define CONFIG_ENV_SECT_SIZE    (128 * 1024)
+#define CONFIG_ENV_SIZE         CONFIG_ENV_SECT_SIZE
+
+#if defined(CONFIG_FSL_ENV_IN_NAND)
+       #define CONFIG_ENV_IS_IN_NAND 1
+       #define CONFIG_ENV_OFFSET       0x100000
+#elif defined(CONFIG_FSL_ENV_IN_MMC)
+       #define CONFIG_ENV_IS_IN_MMC    1
+       #define CONFIG_ENV_OFFSET       (768 * 1024)
+#elif defined(CONFIG_FSL_ENV_IN_SF)
+       #define CONFIG_ENV_IS_IN_SPI_FLASH      1
+       #define CONFIG_ENV_SPI_CS               1
+       #define CONFIG_ENV_OFFSET       (768 * 1024)
+#else
+       #define CONFIG_ENV_IS_NOWHERE   1
+#endif
+#endif                         /* __CONFIG_H */
diff --git a/include/configs/mx50_arm2_mfg.h b/include/configs/mx50_arm2_mfg.h
new file mode 100644 (file)
index 0000000..b29c7a9
--- /dev/null
@@ -0,0 +1,253 @@
+/*
+ * Copyright (C) 2010 Freescale Semiconductor, Inc.
+ *
+ * Configuration settings for the MX50-ARM2 Freescale 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/mx50.h>
+
+ /* High Level Configuration Options */
+#define CONFIG_MFG
+#define CONFIG_MXC
+#define CONFIG_MX50
+#define CONFIG_MX50_ARM2
+#define CONFIG_FLASH_HEADER
+#define CONFIG_FLASH_HEADER_OFFSET 0x400
+
+#define CONFIG_SKIP_RELOCATE_UBOOT
+
+#define CONFIG_ARCH_CPU_INIT
+#define CONFIG_ARCH_MMU
+
+#define CONFIG_MX50_HCLK_FREQ  24000000
+#define CONFIG_SYS_PLL2_FREQ    400
+#define CONFIG_SYS_AHB_PODF     2
+#define CONFIG_SYS_AXIA_PODF    0
+#define CONFIG_SYS_AXIB_PODF    1
+
+#define CONFIG_DISPLAY_CPUINFO
+#define CONFIG_DISPLAY_BOARDINFO
+
+#define CONFIG_SYS_64BIT_VSPRINTF
+
+#define BOARD_LATE_INIT
+/*
+ * 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             1       /* enable passing of ATAGs */
+#define CONFIG_REVISION_TAG            1
+#define CONFIG_SETUP_MEMORY_TAGS       1
+#define CONFIG_INITRD_TAG              1
+
+/*
+ * Size of malloc() pool
+ */
+#define CONFIG_SYS_MALLOC_LEN          (CONFIG_ENV_SIZE + 2 * 1024 * 1024)
+/* size in bytes reserved for initial data */
+#define CONFIG_SYS_GBL_DATA_SIZE       128
+
+/*
+ * Hardware drivers
+ */
+#define CONFIG_MX50_UART       1
+#define CONFIG_MX50_UART1      1
+
+/* allow to overwrite serial and ethaddr */
+#define CONFIG_ENV_OVERWRITE
+#define CONFIG_CONS_INDEX              1
+#define CONFIG_BAUDRATE                        115200
+#define CONFIG_SYS_BAUDRATE_TABLE      {9600, 19200, 38400, 57600, 115200}
+
+/***********************************************************
+ * Command definition
+ ***********************************************************/
+
+#include <config_cmd_default.h>
+
+#define CONFIG_CMD_PING
+#define CONFIG_CMD_DHCP
+#define CONFIG_CMD_MII
+#define CONFIG_CMD_NET
+#define CONFIG_NET_RETRY_COUNT  100
+#define CONFIG_NET_MULTI 1
+#define CONFIG_BOOTP_SUBNETMASK
+#define CONFIG_BOOTP_GATEWAY
+#define CONFIG_BOOTP_DNS
+
+/* #define CONFIG_CMD_MMC */
+/* #define CONFIG_CMD_ENV */
+
+/*#define CONFIG_CMD */
+#define CONFIG_REF_CLK_FREQ CONFIG_MX50_HCLK_FREQ
+
+#undef CONFIG_CMD_IMLS
+
+#define CONFIG_BOOTDELAY       0
+
+#define CONFIG_PRIME   "FEC0"
+
+#define CONFIG_LOADADDR                0x70800000      /* loadaddr env var */
+#define CONFIG_RD_LOADADDR     (CONFIG_LOADADDR + 0x300000)
+
+#define CONFIG_BOOTARGS         "console=ttymxc0,115200 "\
+                               "rdinit=/linuxrc"
+#define CONFIG_BOOTCOMMAND      "bootm 0x70800000 0x70B00000"
+#define CONFIG_ENV_IS_EMBEDDED
+#define        CONFIG_EXTRA_ENV_SETTINGS                                       \
+               "netdev=eth0\0"                                         \
+               "ethprime=FEC0\0"                                       \
+               "uboot=u-boot.bin\0"                    \
+               "kernel=uImage\0"                               \
+               "nfsroot=/opt/eldk/arm\0"                               \
+               "bootargs_base=setenv bootargs console=ttymxc0,115200\0"\
+               "bootargs_nfs=setenv bootargs ${bootargs} root=/dev/nfs "\
+                       "ip=dhcp nfsroot=${serverip}:${nfsroot},v3,tcp\0"\
+               "bootcmd_net=run bootargs_base bootargs_nfs; "          \
+                       "tftpboot ${loadaddr} ${kernel}; bootm\0"       \
+               "bootargs_mmc=setenv bootargs ${bootargs} ip=dhcp "     \
+                       "root=/dev/mmcblk0p2 rootwait\0"                \
+               "bootcmd_mmc=run bootargs_base bootargs_mmc; bootm\0"   \
+               "bootcmd=run bootcmd_net\0"                             \
+
+
+#define CONFIG_ARP_TIMEOUT     200UL
+
+/*
+ * Miscellaneous configurable options
+ */
+#define CONFIG_SYS_LONGHELP            /* undef to save memory */
+#define CONFIG_SYS_PROMPT              "ARM2 MFG U-Boot > "
+#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
+
+#define CONFIG_CMDLINE_EDITING 1
+
+#define CONFIG_FEC0_IOBASE     FEC_BASE_ADDR
+#define CONFIG_FEC0_PINMUX     -1
+#define CONFIG_FEC0_PHY_ADDR   -1
+#define CONFIG_FEC0_MIIBASE    -1
+
+#define CONFIG_MXC_FEC
+#define CONFIG_MII
+#define CONFIG_MII_GASKET
+#define CONFIG_DISCOVER_PHY
+
+/*
+ * I2C Configs
+ */
+#define CONFIG_CMD_I2C          1
+#define CONFIG_HARD_I2C         1
+#define CONFIG_I2C_MXC          1
+#define CONFIG_SYS_I2C_PORT             I2C2_BASE_ADDR
+#define CONFIG_SYS_I2C_SPEED            100000
+#define CONFIG_SYS_I2C_SLAVE            0xfe
+
+
+/*
+ * SPI Configs
+ */
+#define CONFIG_FSL_SF          1
+#define CONFIG_CMD_SPI
+#define CONFIG_CMD_SF
+#define CONFIG_SPI_FLASH_IMX_ATMEL     1
+#define CONFIG_SPI_FLASH_CS    1
+#define CONFIG_IMX_CSPI
+#define IMX_CSPI_VER_0_7        1
+#define MAX_SPI_BYTES          (8 * 4)
+#define CONFIG_IMX_SPI_PMIC
+#define CONFIG_IMX_SPI_PMIC_CS 0
+
+/*
+ * MMC Configs
+ */
+#ifdef CONFIG_CMD_MMC
+       #define CONFIG_MMC                              1
+       #define CONFIG_GENERIC_MMC
+       #define CONFIG_IMX_MMC
+       #define CONFIG_SYS_FSL_ESDHC_NUM        3
+       #define CONFIG_SYS_FSL_ESDHC_ADDR       0
+       #define CONFIG_SYS_MMC_ENV_DEV  0
+       #define CONFIG_DOS_PARTITION    1
+       #define CONFIG_CMD_FAT          1
+       #define CONFIG_CMD_EXT2         1
+
+       /* detect whether ESDHC1 or ESDHC3 is boot device */
+       #define CONFIG_DYNAMIC_MMC_DEVNO
+
+       #define CONFIG_BOOT_PARTITION_ACCESS
+
+#endif
+/*-----------------------------------------------------------------------
+ * 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      (128 * 1024 * 1024)
+#define iomem_valid_addr(addr, size) \
+       (addr >= PHYS_SDRAM_1 && addr <= (PHYS_SDRAM_1 + PHYS_SDRAM_1_SIZE))
+
+/*-----------------------------------------------------------------------
+ * FLASH and environment organization
+ */
+#define CONFIG_SYS_NO_FLASH
+
+/* Monitor at beginning of flash */
+/* #define CONFIG_FSL_ENV_IN_MMC */
+
+#define CONFIG_ENV_SECT_SIZE    (128 * 1024)
+#define CONFIG_ENV_SIZE         CONFIG_ENV_SECT_SIZE
+
+#if defined(CONFIG_FSL_ENV_IN_NAND)
+       #define CONFIG_ENV_IS_IN_NAND 1
+       #define CONFIG_ENV_OFFSET       0x100000
+#elif defined(CONFIG_FSL_ENV_IN_MMC)
+       #define CONFIG_ENV_IS_IN_MMC    1
+       #define CONFIG_ENV_OFFSET       (768 * 1024)
+#elif defined(CONFIG_FSL_ENV_IN_SF)
+       #define CONFIG_ENV_IS_IN_SPI_FLASH      1
+       #define CONFIG_ENV_SPI_CS               1
+       #define CONFIG_ENV_OFFSET       (768 * 1024)
+#else
+       #define CONFIG_ENV_IS_NOWHERE   1
+#endif
+#endif                         /* __CONFIG_H */
diff --git a/include/configs/mx51_3stack.h b/include/configs/mx51_3stack.h
new file mode 100644 (file)
index 0000000..e628ede
--- /dev/null
@@ -0,0 +1,267 @@
+/*
+ * Copyright (C) 2007, Guennadi Liakhovetski <lg@denx.de>
+ *
+ * (C) Copyright 2009-2010 Freescale Semiconductor, Inc.
+ *
+ * Configuration settings for the MX51-3Stack Freescale 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/mx51.h>
+
+ /* High Level Configuration Options */
+#define CONFIG_ARMV7           1       /* This is armv7 Cortex-A8 CPU core */
+#define CONFIG_SYS_APCS_GNU
+
+#define CONFIG_MXC             1
+#define CONFIG_MX51_3DS                1       /* in a mx51 */
+#define CONFIG_FLASH_HEADER    1
+#define CONFIG_FLASH_HEADER_OFFSET 0x400
+#define CONFIG_FLASH_HEADER_BARKER 0xB1
+
+#define CONFIG_SKIP_RELOCATE_UBOOT
+
+#define CONFIG_MX51_HCLK_FREQ  24000000        /* RedBoot says 26MHz */
+
+#define CONFIG_ARCH_CPU_INIT
+#define CONFIG_ARCH_MMU
+
+#define CONFIG_DISPLAY_CPUINFO
+#define CONFIG_DISPLAY_BOARDINFO
+
+#define CONFIG_SYS_64BIT_VSPRINTF
+
+#define BOARD_LATE_INIT
+/*
+ * 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             1       /* enable passing of ATAGs */
+#define CONFIG_REVISION_TAG            1
+#define CONFIG_SETUP_MEMORY_TAGS       1
+#define CONFIG_INITRD_TAG              1
+
+/*
+ * Size of malloc() pool
+ */
+#define CONFIG_SYS_MALLOC_LEN          (CONFIG_ENV_SIZE + 2 * 1024 * 1024)
+/* size in bytes reserved for initial data */
+#define CONFIG_SYS_GBL_DATA_SIZE       128
+
+/*
+ * Hardware drivers
+ */
+#define CONFIG_MX51_UART       1
+#define CONFIG_MX51_UART1      1
+
+/* allow to overwrite serial and ethaddr */
+#define CONFIG_ENV_OVERWRITE
+#define CONFIG_CONS_INDEX      1
+#define CONFIG_BAUDRATE                115200
+#define CONFIG_SYS_BAUDRATE_TABLE      {9600, 19200, 38400, 57600, 115200}
+
+/***********************************************************
+ * Command definition
+ ***********************************************************/
+
+#include <config_cmd_default.h>
+
+#define CONFIG_CMD_PING
+#define CONFIG_CMD_DHCP
+#define CONFIG_BOOTP_SUBNETMASK
+#define CONFIG_BOOTP_GATEWAY
+#define CONFIG_BOOTP_DNS
+/* Enable below configure when supporting nand */
+#define CONFIG_CMD_NAND
+#define CONFIG_MXC_NAND
+#define CONFIG_CMD_ENV
+#define CMD_SAVEENV
+#undef CONFIG_CMD_IMLS
+#define CONFIG_CMD_MII
+#define CONFIG_CMD_NET
+#define CONFIG_CMD_MMC
+#define CONFIG_CMD_IIM
+
+/*
+ * FUSE Configs
+ * */
+#ifdef CONFIG_CMD_IIM
+       #define CONFIG_IMX_IIM
+       #define IMX_IIM_BASE    IIM_BASE_ADDR
+       #define CONFIG_IIM_MAC_BANK     1
+       #define CONFIG_IIM_MAC_ROW      9
+#endif
+
+/*
+ * MMC Configs
+ */
+#ifdef CONFIG_CMD_MMC
+       #define CONFIG_MMC                              1
+       #define CONFIG_GENERIC_MMC
+       #define CONFIG_IMX_MMC
+       #define CONFIG_SYS_FSL_ESDHC_ADDR       0
+       #define CONFIG_SYS_MMC_ENV_DEV  0
+       #define CONFIG_DOS_PARTITION    1
+       #define CONFIG_CMD_FAT          1
+       #define CONFIG_SYS_FSL_ESDHC_NUM 1
+#endif
+
+/*
+ * I2C Configs
+ */
+#define CONFIG_CMD_I2C          1
+#define CONFIG_HARD_I2C         1
+#define CONFIG_I2C_MXC          1
+#define CONFIG_SYS_I2C_PORT             I2C2_BASE_ADDR
+#define CONFIG_SYS_I2C_SPEED            400000
+#define CONFIG_SYS_I2C_SLAVE            0xfe
+
+/*
+ * Eth Configs
+ */
+#define CONFIG_HAS_ETH1
+#define CONFIG_ETHPRIME
+#define CONFIG_NET_RETRY_COUNT 100
+#define CONFIG_NET_MULTI
+#define CONFIG_MXC_FEC
+#define CONFIG_MII
+#define CONFIG_DISCOVER_PHY
+
+#define CONFIG_FEC0_IOBASE     FEC_BASE_ADDR
+#define CONFIG_FEC0_PINMUX     -1
+#define CONFIG_FEC0_PHY_ADDR   0x1F
+#define CONFIG_FEC0_MIIBASE    -1
+
+
+#define CONFIG_BOOTDELAY       3
+
+#define CONFIG_LOADADDR                0x90800000      /* loadaddr env var */
+
+#define        CONFIG_EXTRA_ENV_SETTINGS                                       \
+               "netdev=eth0\0"                                         \
+               "ethprime=smc911x\0"                                    \
+               "uboot_addr=0xa0000000\0"                               \
+               "uboot=u-boot.bin\0"                    \
+               "kernel=uImage\0"                               \
+               "nfsroot=/opt/eldk/arm\0"                               \
+               "bootargs_base=setenv bootargs console=ttymxc0,115200\0"\
+               "bootargs_nfs=setenv bootargs ${bootargs} root=/dev/nfs "\
+                       "ip=dhcp nfsroot=${serverip}:${nfsroot},v3,tcp\0"\
+               "bootcmd=run bootcmd_net\0"                             \
+               "bootcmd_net=run bootargs_base bootargs_nfs; "          \
+                       "tftpboot ${loadaddr} ${kernel}; bootm\0"       \
+               "prg_uboot=tftpboot ${loadaddr} ${uboot}; "             \
+                       "protect off ${uboot_addr} 0xa003ffff; "        \
+                       "erase ${uboot_addr} 0xa003ffff; "              \
+                       "cp.b ${loadaddr} ${uboot_addr} ${filesize}; "  \
+                       "setenv filesize; saveenv\0"
+
+/*Support LAN9217*/
+#define CONFIG_SMC911X 1
+#define CONFIG_SMC911X_16_BIT 1
+#define CONFIG_SMC911X_BASE mx51_io_base_addr
+
+/*
+ * The MX51 3stack board seems to have a hardware "peculiarity" confirmed under
+ * U-Boot, RedBoot and Linux: the ethernet Rx signal is reaching the CS8900A
+ * controller inverted. The controller is capable of detecting and correcting
+ * this, but it needs 4 network packets for that. Which means, at startup, you
+ * will not receive answers to the first 4 packest, unless there have been some
+ * broadcasts on the network, or your board is on a hub. Reducing the ARP
+ * timeout from default 5 seconds to 200ms we speed up the initial TFTP
+ * transfer, should the user wish one, significantly.
+ */
+#define CONFIG_ARP_TIMEOUT     200UL
+
+/*
+ * Miscellaneous configurable options
+ */
+#define CONFIG_SYS_LONGHELP            /* undef to save memory */
+#define CONFIG_SYS_PROMPT              "MX51 U-Boot > "
+#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
+
+#define CONFIG_CMDLINE_EDITING 1
+
+/*-----------------------------------------------------------------------
+ * 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      (512 * 1024 * 1024)
+#define iomem_valid_addr(addr, size) \
+       (addr >= PHYS_SDRAM_1 && addr <= (PHYS_SDRAM_1 + PHYS_SDRAM_1_SIZE))
+
+/*-----------------------------------------------------------------------
+ * FLASH and environment organization
+ */
+#define CONFIG_SYS_NO_FLASH
+
+/*-----------------------------------------------------------------------
+ * NAND FLASH driver setup
+ */
+#define NAND_MAX_CHIPS         8
+#define CONFIG_SYS_MAX_NAND_DEVICE    1
+#define CONFIG_SYS_NAND_BASE          0x40000000
+#define CONFIG_NAND_FW_16BIT   0 /* 1: 16bit 0: 8bit */
+
+/* Monitor at beginning of flash */
+#define CONFIG_FSL_ENV_IN_NAND
+/* #define CONFIG_FSL_ENV_IN_NAND */
+
+#define CONFIG_ENV_SECT_SIZE    (128 * 1024)
+#define CONFIG_ENV_SIZE                CONFIG_ENV_SECT_SIZE
+#if defined(CONFIG_FSL_ENV_IN_NAND)
+       #define CONFIG_ENV_IS_IN_NAND 1
+       #define CONFIG_ENV_OFFSET       0x100000
+#elif defined(CONFIG_FSL_ENV_IN_MMC)
+       #define CONFIG_ENV_IS_IN_MMC    1
+       #define CONFIG_ENV_OFFSET       (768 * 1024)
+#else
+       #define CONFIG_ENV_IS_NOWHERE   1
+#endif
+/*
+ * JFFS2 partitions
+ */
+#undef CONFIG_JFFS2_CMDLINE
+#define CONFIG_JFFS2_DEV       "nand0"
+
+#endif                         /* __CONFIG_H */
diff --git a/include/configs/mx51_3stack_android.h b/include/configs/mx51_3stack_android.h
new file mode 100644 (file)
index 0000000..3189269
--- /dev/null
@@ -0,0 +1,322 @@
+/*
+ * Copyright (C) 2007, Guennadi Liakhovetski <lg@denx.de>
+ *
+ * (C) Copyright 2009-2010 Freescale Semiconductor, Inc.
+ *
+ * Configuration settings for the MX51-3Stack Freescale 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/mx51.h>
+
+ /* High Level Configuration Options */
+#define CONFIG_ARMV7           1       /* This is armv7 Cortex-A8 CPU core */
+#define CONFIG_SYS_APCS_GNU
+
+#define CONFIG_MXC             1
+#define CONFIG_MX51_3DS                1       /* in a mx51 */
+#define CONFIG_FLASH_HEADER    1
+#define CONFIG_FLASH_HEADER_OFFSET 0x400
+#define CONFIG_FLASH_HEADER_BARKER 0xB1
+
+#define CONFIG_ARCH_CPU_INIT
+#define CONFIG_ARCH_MMU
+
+#define CONFIG_SKIP_RELOCATE_UBOOT
+
+#define CONFIG_MX51_HCLK_FREQ  24000000        /* RedBoot says 26MHz */
+
+#define CONFIG_DISPLAY_CPUINFO
+#define CONFIG_DISPLAY_BOARDINFO
+
+#define CONFIG_SYS_64BIT_VSPRINTF
+
+#define BOARD_LATE_INIT
+/*
+ * 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             1       /* enable passing of ATAGs */
+#define CONFIG_REVISION_TAG            1
+#define CONFIG_SETUP_MEMORY_TAGS       1
+#define CONFIG_INITRD_TAG              1
+
+/*
+ * Size of malloc() pool
+ */
+#define CONFIG_SYS_MALLOC_LEN          (CONFIG_ENV_SIZE + 4 * 1024 * 1024)
+/* size in bytes reserved for initial data */
+#define CONFIG_SYS_GBL_DATA_SIZE       128
+
+/*
+ * Hardware drivers
+ */
+#define CONFIG_MX51_UART       1
+#define CONFIG_MX51_UART1      1
+
+/*
+ * SPI Configs
+ * */
+/*
+#define CONFIG_FSL_SF          1
+#define CONFIG_CMD_SPI
+#define CONFIG_CMD_SF
+#define CONFIG_SPI_FLASH_IMX_ATMEL     1
+#define CONFIG_SPI_FLASH_CS    1
+#define CONFIG_IMX_ECSPI
+#define CONFIG_IMX_SPI_PMIC
+#define CONFIG_IMX_SPI_PMIC_CS 0
+#define IMX_CSPI_VER_2_3       1
+#define MAX_SPI_BYTES          (64 * 4)
+*/
+
+
+#define CONFIG_CMD_PING
+#define CONFIG_CMD_DHCP
+#define CONFIG_BOOTP_SUBNETMASK
+#define CONFIG_BOOTP_GATEWAY
+#define CONFIG_BOOTP_DNS
+#define CONFIG_CMD_MII
+#define CONFIG_CMD_NET
+#define CONFIG_NET_RETRY_COUNT 100
+
+#define CONFIG_CMD_UBI
+#define CONFIG_CMD_UBIFS
+#define CONFIG_CMD_MTDPARTS
+#define CONFIG_MTD_DEVICE
+#define CONFIG_MTD_PARTITIONS
+#define MTDIDS_DEFAULT "nand0=nand0"
+#define MTDPARTS_DEFAULT "mtdparts=nand0:0x700000@0x0(BOOT),0x100000@0x700000(MISC),0x1400000@0x800000(RECOVERY),-@0x1c00000(ROOT)"
+#define MTD_ACTIVE_PART "nand0,3"
+#define CONFIG_RBTREE
+#define CONFIG_LZO
+
+/*
+ * Android support Configs
+ */
+#include <asm/arch/keypad.h>
+
+#define CONFIG_FSL_ANDROID
+
+#define CONFIG_MXC_KPD
+#define CONFIG_MXC_KEYMAPPING \
+       {       \
+               KEY_1, KEY_2, KEY_3, KEY_F1, KEY_UP, KEY_F2, \
+               KEY_4, KEY_5, KEY_6, KEY_LEFT, KEY_SELECT, KEY_RIGHT, \
+               KEY_7, KEY_8, KEY_9, KEY_F3, KEY_DOWN, KEY_F4, \
+               KEY_0, KEY_OK, KEY_ESC, KEY_ENTER, KEY_MENU, KEY_BACK, \
+       }
+#define CONFIG_MXC_KPD_COLMAX 6
+#define CONFIG_MXC_KPD_ROWMAX 4
+#define CONFIG_ANDROID_RECOVERY_BOOTARGS_MMC \
+       "setenv bootargs ${bootargs} root=/dev/mmcblk0p4 ip=off init=/init rootfstype=ext3"
+#define CONFIG_ANDROID_RECOVERY_BOOTCMD_MMC  \
+       "run bootargs_base bootargs_android;mmc read 0 ${loadaddr} 0x800 0x1280;bootm"
+#define CONFIG_ANDROID_RECOVERY_BOOTARGS_NAND \
+       "setenv bootargs ${bootargs} ip=off rootfstype=ubifs root=ubi1:recovery init=/init ubi.mtd=3 ubi.mtd=2"
+#define CONFIG_ANDROID_RECOVERY_BOOTCMD_NAND  \
+       "run bootargs_base bootargs_android;nand read ${loadaddr} 0x300000 0x250000;bootm"
+#define CONFIG_ANDROID_RECOVERY_CMD_FILE "/recovery/command"
+#define CONFIG_ANDROID_BOOTMOD_DELAY 3
+#define CONFIG_ANDROID_CACHE_PARTITION_MMC 6
+#define CONFIG_ANDROID_UBIFS_PARTITION_NM  "ROOT"
+#define CONFIG_ANDROID_CACHE_PARTITION_NAND "cache"
+
+/* allow to overwrite serial and ethaddr */
+#define CONFIG_ENV_OVERWRITE
+#define CONFIG_CONS_INDEX              1
+#define CONFIG_BAUDRATE                        115200
+#define CONFIG_SYS_BAUDRATE_TABLE      {9600, 19200, 38400, 57600, 115200}
+
+/***********************************************************
+ * Command definition
+ ***********************************************************/
+
+#include <config_cmd_default.h>
+
+#define CONFIG_CMD_PING
+#define CONFIG_CMD_DHCP
+/* Enable below configure when supporting nand */
+#define CONFIG_CMD_NAND
+#define CONFIG_MXC_NAND
+#define CONFIG_CMD_MMC
+#define CONFIG_CMD_ENV
+
+#undef CONFIG_CMD_IMLS
+
+#define CONFIG_BOOTDELAY       3
+
+#define CONFIG_PRIME   "FEC0"
+
+#define CONFIG_LOADADDR                0x90800000      /* loadaddr env var */
+#define CONFIG_RD_LOADADDR     (CONFIG_LOADADDR + 0x300000)
+
+#define        CONFIG_EXTRA_ENV_SETTINGS                                       \
+               "netdev=eth0\0"                                         \
+               "ethprime=smc911x\0"                                    \
+               "uboot_addr=0xa0000000\0"                               \
+               "uboot=u-boot.bin\0"                    \
+               "kernel=uImage\0"                               \
+               "rd_loadaddr=0x90B00000\0"      \
+               "nfsroot=/opt/eldk/arm\0"                               \
+               "bootargs_base=setenv bootargs console=ttymxc0,115200\0"\
+               "bootargs_nfs=setenv bootargs ${bootargs} root=/dev/nfs "\
+                       "ip=dhcp nfsroot=${serverip}:${nfsroot},v3,tcp\0"\
+               "bootargs_android=setenv bootargs ${bootargs} ip=dhcp mem=480M init=/init wvga calibration\0"   \
+               "bootcmd=run bootcmd_android\0"                         \
+               "bootcmd_net=run bootargs_base bootargs_nfs; "          \
+                       "tftpboot ${loadaddr} ${kernel}; bootm\0"       \
+               "bootcmd_android=run bootargs_base bootargs_android; "  \
+                       "mmc read 0 ${loadaddr} 0x800 0x1280; " \
+                       "mmc read 0 ${rd_loadaddr} 0x2000 0x258; "      \
+                       "bootm ${loadaddr} ${rd_loadaddr}\0"            \
+               "prg_uboot=tftpboot ${loadaddr} ${uboot}; "             \
+                       "protect off ${uboot_addr} 0xa003ffff; "        \
+                       "erase ${uboot_addr} 0xa003ffff; "              \
+                       "cp.b ${loadaddr} ${uboot_addr} ${filesize}; "  \
+                       "setenv filesize; saveenv\0"
+
+/*Support LAN9217*/
+#define CONFIG_SMC911X 1
+#define CONFIG_SMC911X_16_BIT 1
+#define CONFIG_SMC911X_BASE mx51_io_base_addr
+
+/*
+ * MMC Configs
+ * */
+#ifdef CONFIG_CMD_MMC
+       #define CONFIG_MMC                              1
+       #define CONFIG_GENERIC_MMC
+       #define CONFIG_IMX_MMC
+       #define CONFIG_SYS_FSL_ESDHC_NUM        2
+       #define CONFIG_SYS_FSL_ESDHC_ADDR       0
+       #define CONFIG_SYS_MMC_ENV_DEV  0
+       #define CONFIG_DOS_PARTITION    1
+       #define CONFIG_CMD_FAT          1
+       #define CONFIG_CMD_EXT2         1
+       #define CONFIG_SYS_FSL_ESDHC_NUM 1
+#endif
+
+/*
+ * Eth Configs
+ */
+#define CONFIG_HAS_ETH1
+#define CONFIG_NET_MULTI 1
+#define CONFIG_ETHPRIME
+#define CONFIG_MXC_FEC
+#define CONFIG_MII
+#define CONFIG_DISCOVER_PHY
+
+#define CONFIG_FEC0_IOBASE     FEC_BASE_ADDR
+#define CONFIG_FEC0_PINMUX     -1
+#define CONFIG_FEC0_PHY_ADDR   0x1F
+#define CONFIG_FEC0_MIIBASE    -1
+
+/*
+ * The MX51 3stack board seems to have a hardware "peculiarity" confirmed under
+ * U-Boot, RedBoot and Linux: the ethernet Rx signal is reaching the CS8900A
+ * controller inverted. The controller is capable of detecting and correcting
+ * this, but it needs 4 network packets for that. Which means, at startup, you
+ * will not receive answers to the first 4 packest, unless there have been some
+ * broadcasts on the network, or your board is on a hub. Reducing the ARP
+ * timeout from default 5 seconds to 200ms we speed up the initial TFTP
+ * transfer, should the user wish one, significantly.
+ */
+#define CONFIG_ARP_TIMEOUT     200UL
+
+/*
+ * Miscellaneous configurable options
+ */
+#define CONFIG_SYS_LONGHELP            /* undef to save memory */
+#define CONFIG_SYS_PROMPT              "MX51 U-Boot > "
+#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
+
+#define CONFIG_CMDLINE_EDITING 1
+
+/*-----------------------------------------------------------------------
+ * 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      (512 * 1024 * 1024)
+#define iomem_valid_addr(addr, size) \
+       (addr >= PHYS_SDRAM_1 && addr <= (PHYS_SDRAM_1 + PHYS_SDRAM_1_SIZE))
+
+/*-----------------------------------------------------------------------
+ * FLASH and environment organization
+ */
+#define CONFIG_SYS_NO_FLASH
+
+/*-----------------------------------------------------------------------
+ * NAND FLASH driver setup
+ */
+#define NAND_MAX_CHIPS         8
+#define CONFIG_SYS_MAX_NAND_DEVICE    1
+#define CONFIG_SYS_NAND_BASE          0x40000000
+
+/* Monitor at beginning of flash */
+/* #define CONFIG_FSL_ENV_IN_MMC */
+#define CONFIG_FSL_ENV_IN_NAND
+
+#define CONFIG_ENV_SECT_SIZE    (128 * 1024)
+#define CONFIG_ENV_SIZE         CONFIG_ENV_SECT_SIZE
+
+#if defined(CONFIG_FSL_ENV_IN_NAND)
+       #define CONFIG_ENV_IS_IN_NAND 1
+       #define CONFIG_ENV_OFFSET       0x100000
+#elif defined(CONFIG_FSL_ENV_IN_MMC)
+       #define CONFIG_ENV_IS_IN_MMC    1
+       #define CONFIG_ENV_OFFSET       (768 * 1024)
+#elif defined(CONFIG_FSL_ENV_IN_SF)
+       #define CONFIG_ENV_IS_IN_SPI_FLASH      1
+       #define CONFIG_ENV_SPI_CS               1
+       #define CONFIG_ENV_OFFSET       (768 * 1024)
+#else
+       #define CONFIG_ENV_IS_NOWHERE   1
+#endif
+/*
+ * JFFS2 partitions
+ */
+#undef CONFIG_JFFS2_CMDLINE
+#define CONFIG_JFFS2_DEV       "nand0"
+
+#endif                         /* __CONFIG_H */
diff --git a/include/configs/mx51_bbg.h b/include/configs/mx51_bbg.h
new file mode 100644 (file)
index 0000000..c240ada
--- /dev/null
@@ -0,0 +1,274 @@
+/*
+ * Copyright (C) 2007, Guennadi Liakhovetski <lg@denx.de>
+ *
+ * (C) Copyright 2009-2010 Freescale Semiconductor, Inc.
+ *
+ * Configuration settings for the MX51-3Stack Freescale 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/mx51.h>
+
+ /* High Level Configuration Options */
+#define CONFIG_ARMV7           1       /* This is armv7 Cortex-A8 CPU core */
+
+#define CONFIG_MXC             1
+#define CONFIG_MX51_BBG                1       /* in a mx51 */
+#define CONFIG_FLASH_HEADER    1
+#define CONFIG_FLASH_HEADER_OFFSET 0x400
+#define CONFIG_FLASH_HEADER_BARKER 0xB1
+
+#define CONFIG_SKIP_RELOCATE_UBOOT
+
+#define CONFIG_MX51_HCLK_FREQ  24000000        /* RedBoot says 26MHz */
+
+#define CONFIG_ARCH_CPU_INIT
+#define CONFIG_ARCH_MMU
+
+#define CONFIG_DISPLAY_CPUINFO
+#define CONFIG_DISPLAY_BOARDINFO
+
+#define CONFIG_SYS_64BIT_VSPRINTF
+
+#define BOARD_LATE_INIT
+/*
+ * 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             1       /* enable passing of ATAGs */
+#define CONFIG_REVISION_TAG            1
+#define CONFIG_SETUP_MEMORY_TAGS       1
+#define CONFIG_INITRD_TAG              1
+
+/*
+ * Size of malloc() pool
+ */
+#define CONFIG_SYS_MALLOC_LEN          (CONFIG_ENV_SIZE + 2 * 1024 * 1024)
+/* size in bytes reserved for initial data */
+#define CONFIG_SYS_GBL_DATA_SIZE       128
+
+/*
+ * Hardware drivers
+ */
+#define CONFIG_MX51_UART       1
+#define CONFIG_MX51_UART1      1
+
+/* allow to overwrite serial and ethaddr */
+#define CONFIG_ENV_OVERWRITE
+#define CONFIG_CONS_INDEX              1
+#define CONFIG_BAUDRATE                        115200
+#define CONFIG_SYS_BAUDRATE_TABLE      {9600, 19200, 38400, 57600, 115200}
+
+/***********************************************************
+ * Command definition
+ ***********************************************************/
+
+#include <config_cmd_default.h>
+
+#define CONFIG_CMD_PING
+#define CONFIG_CMD_DHCP
+#define CONFIG_BOOTP_SUBNETMASK
+#define CONFIG_BOOTP_GATEWAY
+#define CONFIG_BOOTP_DNS
+#define CONFIG_CMD_MII
+#define CONFIG_CMD_NET
+#define CONFIG_NET_RETRY_COUNT 100
+#define CONFIG_CMD_SPI
+#define CONFIG_CMD_SF
+#define CONFIG_CMD_MMC
+#define CONFIG_CMD_IIM
+#define CONFIG_CMD_I2C
+
+/*
+ * FUSE Configs
+ * */
+#ifdef CONFIG_CMD_IIM
+       #define CONFIG_IMX_IIM
+       #define IMX_IIM_BASE    IIM_BASE_ADDR
+       #define CONFIG_IIM_MAC_BANK     1
+       #define CONFIG_IIM_MAC_ROW      9
+#endif
+
+/*
+ * SPI Configs
+ * */
+#ifdef CONFIG_CMD_SF
+       #define CONFIG_FSL_SF           1
+       #define CONFIG_SPI_FLASH_IMX_ATMEL      1
+       #define CONFIG_SPI_FLASH_CS     1
+       #define CONFIG_IMX_ECSPI
+       #define IMX_CSPI_VER_2_3        1
+       #define CONFIG_IMX_SPI_PMIC
+       #define CONFIG_IMX_SPI_PMIC_CS 0
+
+       #define MAX_SPI_BYTES           (64 * 4)
+#endif
+
+/*
+ * MMC Configs
+ * */
+#ifdef CONFIG_CMD_MMC
+       #define CONFIG_MMC                              1
+       #define CONFIG_GENERIC_MMC
+       #define CONFIG_IMX_MMC
+       #define CONFIG_SYS_FSL_ESDHC_NUM        2
+       #define CONFIG_SYS_FSL_ESDHC_ADDR       0
+       #define CONFIG_SYS_MMC_ENV_DEV  0
+       #define CONFIG_DOS_PARTITION    1
+       #define CONFIG_CMD_FAT          1
+       #define CONFIG_DYNAMIC_MMC_DEVNO
+#endif
+
+/*
+ * I2C Configs
+ */
+#ifdef CONFIG_CMD_I2C
+       #define CONFIG_HARD_I2C         1
+       #define CONFIG_I2C_MXC          1
+       #define CONFIG_SYS_I2C_PORT             I2C1_BASE_ADDR
+       #define CONFIG_SYS_I2C_SPEED            400000
+       #define CONFIG_SYS_I2C_SLAVE            0xfe
+#endif
+
+/*
+ * Eth Configs
+ */
+#define CONFIG_HAS_ETH1
+#define CONFIG_NET_MULTI 1
+#define CONFIG_MXC_FEC
+#define CONFIG_MII
+#define CONFIG_DISCOVER_PHY
+
+#define CONFIG_GET_FEC_MAC_ADDR_FROM_IIM
+#define CONFIG_IIM_MAC_ADDR_OFFSET      0x24
+
+#define CONFIG_FEC0_IOBASE     FEC_BASE_ADDR
+#define CONFIG_FEC0_PINMUX     -1
+#define CONFIG_FEC0_PHY_ADDR   0x1F
+#define CONFIG_FEC0_MIIBASE    -1
+
+
+
+/* Enable below configure when supporting nand */
+#define CONFIG_CMD_ENV
+
+#undef CONFIG_CMD_IMLS
+
+#define CONFIG_BOOTDELAY       3
+
+#define CONFIG_PRIME   "FEC0"
+
+#define CONFIG_LOADADDR                0x90800000      /* loadaddr env var */
+
+#define        CONFIG_EXTRA_ENV_SETTINGS                                       \
+               "netdev=eth0\0"                                         \
+               "ethprime=FEC0\0"                                       \
+               "uboot_addr=0xa0000000\0"                               \
+               "uboot=u-boot.bin\0"                    \
+               "kernel=uImage\0"                               \
+               "bootargs_base=setenv bootargs console=ttymxc0,115200\0"\
+               "bootargs_nfs=setenv bootargs ${bootargs} root=/dev/nfs "\
+                       "ip=dhcp nfsroot=${serverip}:${nfsroot},v3,tcp\0"\
+               "bootcmd=run bootcmd_net\0"                             \
+               "bootcmd_net=run bootargs_base bootargs_nfs; "          \
+                       "tftpboot ${loadaddr} ${kernel}; bootm\0"       \
+               "load_uboot=tftpboot ${loadaddr} ${uboot}\0"            \
+
+/*
+ * The MX51 3stack board seems to have a hardware "peculiarity" confirmed under
+ * U-Boot, RedBoot and Linux: the ethernet Rx signal is reaching the CS8900A
+ * controller inverted. The controller is capable of detecting and correcting
+ * this, but it needs 4 network packets for that. Which means, at startup, you
+ * will not receive answers to the first 4 packest, unless there have been some
+ * broadcasts on the network, or your board is on a hub. Reducing the ARP
+ * timeout from default 5 seconds to 200ms we speed up the initial TFTP
+ * transfer, should the user wish one, significantly.
+ */
+#define CONFIG_ARP_TIMEOUT     200UL
+
+/*
+ * Miscellaneous configurable options
+ */
+#define CONFIG_SYS_LONGHELP            /* undef to save memory */
+#define CONFIG_SYS_PROMPT              "BBG U-Boot > "
+#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
+
+#define CONFIG_CMDLINE_EDITING 1
+
+/*-----------------------------------------------------------------------
+ * 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      (512 * 1024 * 1024)
+#define iomem_valid_addr(addr, size) \
+       (addr >= PHYS_SDRAM_1 && addr <= (PHYS_SDRAM_1 + PHYS_SDRAM_1_SIZE))
+
+/*-----------------------------------------------------------------------
+ * FLASH and environment organization
+ */
+#define CONFIG_SYS_NO_FLASH
+
+/* Monitor at beginning of flash */
+/* #define CONFIG_FSL_ENV_IN_SF */
+#define CONFIG_FSL_ENV_IN_MMC
+
+#define CONFIG_ENV_SECT_SIZE    (128 * 1024)
+#define CONFIG_ENV_SIZE         CONFIG_ENV_SECT_SIZE
+
+#if defined(CONFIG_FSL_ENV_IN_MMC)
+       #define CONFIG_ENV_IS_IN_MMC    1
+       #define CONFIG_ENV_OFFSET       (768 * 1024)
+#elif defined(CONFIG_FSL_ENV_IN_SF)
+       #define CONFIG_ENV_IS_IN_SPI_FLASH      1
+       #define CONFIG_ENV_SPI_CS               1
+       #define CONFIG_ENV_OFFSET       (768 * 1024)
+#else
+       #define CONFIG_ENV_IS_NOWHERE   1
+#endif
+/*
+ * JFFS2 partitions
+ */
+#undef CONFIG_JFFS2_CMDLINE
+#define CONFIG_JFFS2_DEV       "nand0"
+
+#endif                         /* __CONFIG_H */
diff --git a/include/configs/mx51_bbg_android.h b/include/configs/mx51_bbg_android.h
new file mode 100644 (file)
index 0000000..79aae09
--- /dev/null
@@ -0,0 +1,326 @@
+/*
+ * Copyright (C) 2007, Guennadi Liakhovetski <lg@denx.de>
+ *
+ * (C) Copyright 2009-2010 Freescale Semiconductor, Inc.
+ *
+ * Configuration settings for the MX51-3Stack Freescale 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/mx51.h>
+
+ /* High Level Configuration Options */
+#define CONFIG_ARMV7           1       /* This is armv7 Cortex-A8 CPU core */
+#define CONFIG_SYS_APCS_GNU
+
+#define CONFIG_MXC             1
+#define CONFIG_MX51_BBG                1       /* in a mx51 */
+#define CONFIG_FLASH_HEADER    1
+#define CONFIG_FLASH_HEADER_OFFSET 0x400
+#define CONFIG_FLASH_HEADER_BARKER 0xB1
+
+#define CONFIG_ARCH_CPU_INIT
+#define CONFIG_ARCH_MMU
+
+#define CONFIG_SKIP_RELOCATE_UBOOT
+
+#define CONFIG_MX51_HCLK_FREQ  24000000        /* RedBoot says 26MHz */
+
+#define CONFIG_DISPLAY_CPUINFO
+#define CONFIG_DISPLAY_BOARDINFO
+
+#define CONFIG_SYS_64BIT_VSPRINTF
+
+#define BOARD_LATE_INIT
+/*
+ * 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             1       /* enable passing of ATAGs */
+#define CONFIG_REVISION_TAG            1
+#define CONFIG_SETUP_MEMORY_TAGS       1
+#define CONFIG_INITRD_TAG              1
+
+/*
+ * Size of malloc() pool
+ */
+#define CONFIG_SYS_MALLOC_LEN          (CONFIG_ENV_SIZE + 2 * 1024 * 1024)
+/* size in bytes reserved for initial data */
+#define CONFIG_SYS_GBL_DATA_SIZE       128
+
+/*
+ * Hardware drivers
+ */
+#define CONFIG_MX51_UART       1
+#define CONFIG_MX51_UART1      1
+
+
+#define CONFIG_CMD_PING
+#define CONFIG_CMD_DHCP
+#define CONFIG_BOOTP_SUBNETMASK
+#define CONFIG_BOOTP_GATEWAY
+#define CONFIG_BOOTP_DNS
+#define CONFIG_CMD_MII
+#define CONFIG_CMD_NET
+#define CONFIG_NET_RETRY_COUNT 100
+#define CONFIG_CMD_I2C
+
+/*
+ * Android support Configs
+ */
+#include <asm/arch/keypad.h>
+
+#define CONFIG_FSL_ANDROID
+
+#define CONFIG_MTD_DEVICE
+#define CONFIG_MTD_PARTITIONS
+
+
+#define CONFIG_MXC_KPD
+#define CONFIG_MXC_KEYMAPPING \
+       {       \
+               KEY_1, KEY_2, KEY_3, KEY_F1, KEY_UP, KEY_F2, \
+               KEY_4, KEY_5, KEY_6, KEY_LEFT, KEY_SELECT, KEY_RIGHT, \
+               KEY_7, KEY_8, KEY_9, KEY_F3, KEY_DOWN, KEY_F4, \
+               KEY_0, KEY_OK, KEY_ESC, KEY_ENTER, KEY_MENU, KEY_BACK, \
+       }
+       /*
+       {       \
+               KEY_3,         KEY_2,        KEY_0, KEY_OK, KEY_ESC, KEY_ENTER,
+               KEY_F1, KEY_4, KEY_6, KEY_5,
+               KEY_LEFT,      KEY_1,        KEY_ , KEY_8,  KEY_9,   KEY_RIGHT,
+       }
+       */
+#define CONFIG_MXC_KPD_COLMAX 6
+#define CONFIG_MXC_KPD_ROWMAX 4
+#define CONFIG_ANDROID_RECOVERY_BOOTARGS_MMC \
+       "setenv bootargs ${bootargs} root=/dev/mmcblk0p4 ip=off init=/init rootfstype=ext3 wvga"
+#define CONFIG_ANDROID_RECOVERY_BOOTCMD_MMC  \
+       "run bootargs_base bootargs_android;mmc read 0 ${loadaddr} 0x800 0x1280;bootm"
+#define CONFIG_ANDROID_RECOVERY_CMD_FILE "/recovery/command"
+#define CONFIG_ANDROID_BOOTMOD_DELAY 3
+#define CONFIG_ANDROID_CACHE_PARTITION_MMC 6
+
+/* allow to overwrite serial and ethaddr */
+#define CONFIG_ENV_OVERWRITE
+#define CONFIG_CONS_INDEX              1
+#define CONFIG_BAUDRATE                        115200
+#define CONFIG_SYS_BAUDRATE_TABLE      {9600, 19200, 38400, 57600, 115200}
+
+/***********************************************************
+ * Command definition
+ ***********************************************************/
+
+#include <config_cmd_default.h>
+
+#define CONFIG_CMD_PING
+#define CONFIG_CMD_DHCP
+/* Enable below configure when supporting nand */
+/* #define CONFIG_CMD_NAND */
+#define CONFIG_CMD_MMC
+#define CONFIG_CMD_ENV
+
+#undef CONFIG_CMD_IMLS
+
+#define CONFIG_BOOTDELAY       3
+
+#define CONFIG_PRIME   "FEC0"
+
+#define CONFIG_LOADADDR                0x90800000      /* loadaddr env var */
+#define CONFIG_RD_LOADADDR     (CONFIG_LOADADDR + 0x300000)
+
+#define        CONFIG_EXTRA_ENV_SETTINGS                                       \
+               "netdev=eth0\0"                                         \
+               "ethprime=FEC0\0"                                       \
+               "uboot_addr=0xa0000000\0"                               \
+               "uboot=u-boot.bin\0"                    \
+               "kernel=uImage\0"                               \
+               "rd_loadaddr=0x90B00000\0"      \
+               "nfsroot=/opt/eldk/arm\0"                               \
+               "bootargs_base=setenv bootargs console=ttymxc0,115200\0"\
+               "bootargs_nfs=setenv bootargs ${bootargs} root=/dev/nfs "\
+                       "ip=dhcp nfsroot=${serverip}:${nfsroot},v3,tcp\0"\
+               "bootargs_android=setenv bootargs ${bootargs} ip=dhcp mem=480M init=/init wvga calibration\0"   \
+               "bootcmd=run bootcmd_android\0"                         \
+               "bootcmd_net=run bootargs_base bootargs_nfs; "          \
+                       "tftpboot ${loadaddr} ${kernel}; bootm\0"       \
+               "bootcmd_android=run bootargs_base bootargs_android; "  \
+                       "mmcinit;cp.b 0x100000 ${loadaddr} 0x250000; "  \
+                       "cp.b 0x400000 ${rd_loadaddr} 0x4B000; "        \
+                       "bootm ${loadaddr} ${rd_loadaddr}\0"            \
+               "prg_uboot=tftpboot ${loadaddr} ${uboot}; "             \
+                       "protect off ${uboot_addr} 0xa003ffff; "        \
+                       "erase ${uboot_addr} 0xa003ffff; "              \
+                       "cp.b ${loadaddr} ${uboot_addr} ${filesize}; "  \
+                       "setenv filesize; saveenv\0"
+
+/*Support LAN9217*/
+/*
+#define CONFIG_SMC911X 1
+#define CONFIG_SMC911X_16_BIT 1
+#define CONFIG_SMC911X_BASE mx51_io_base_addr
+*/
+
+/*
+ * The MX51 3stack board seems to have a hardware "peculiarity" confirmed under
+ * U-Boot, RedBoot and Linux: the ethernet Rx signal is reaching the CS8900A
+ * controller inverted. The controller is capable of detecting and correcting
+ * this, but it needs 4 network packets for that. Which means, at startup, you
+ * will not receive answers to the first 4 packest, unless there have been some
+ * broadcasts on the network, or your board is on a hub. Reducing the ARP
+ * timeout from default 5 seconds to 200ms we speed up the initial TFTP
+ * transfer, should the user wish one, significantly.
+ */
+#define CONFIG_ARP_TIMEOUT     200UL
+
+/*
+ * Miscellaneous configurable options
+ */
+#define CONFIG_SYS_LONGHELP            /* undef to save memory */
+#define CONFIG_SYS_PROMPT              "BBG U-Boot > "
+#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
+
+#define CONFIG_CMDLINE_EDITING 1
+
+/*
+ * Eth Configs
+ */
+#define CONFIG_HAS_ETH1
+#define CONFIG_NET_MULTI 1
+#define CONFIG_MXC_FEC
+#define CONFIG_MII
+#define CONFIG_DISCOVER_PHY
+
+#define CONFIG_FEC0_IOBASE     FEC_BASE_ADDR
+#define CONFIG_FEC0_PINMUX     -1
+#define CONFIG_FEC0_PHY_ADDR   0x1F
+#define CONFIG_FEC0_MIIBASE    -1
+
+/*
+ * SPI Configs
+ * */
+#define CONFIG_FSL_SF          1
+#define CONFIG_CMD_SPI
+#define CONFIG_CMD_SF
+#define CONFIG_SPI_FLASH_IMX_ATMEL     1
+#define CONFIG_SPI_FLASH_CS    1
+#define CONFIG_IMX_ECSPI
+#define CONFIG_IMX_SPI_PMIC
+#define CONFIG_IMX_SPI_PMIC_CS 0
+#define IMX_CSPI_VER_2_3        1
+
+#define MAX_SPI_BYTES          (64 * 4)
+
+/*
+ * MMC Configs
+ * */
+#ifdef CONFIG_CMD_MMC
+       #define CONFIG_MMC                              1
+       #define CONFIG_GENERIC_MMC
+       #define CONFIG_IMX_MMC
+       #define CONFIG_SYS_FSL_ESDHC_NUM        2
+       #define CONFIG_SYS_FSL_ESDHC_ADDR       0
+       #define CONFIG_SYS_MMC_ENV_DEV  0
+       #define CONFIG_DOS_PARTITION    1
+       #define CONFIG_CMD_FAT          1
+       #define CONFIG_CMD_EXT2         1
+       #define CONFIG_DYNAMIC_MMC_DEVNO
+#endif
+
+/*
+ * I2C Configs
+ */
+#define CONFIG_HARD_I2C         1
+#define CONFIG_I2C_MXC          1
+#define CONFIG_SYS_I2C_PORT             I2C1_BASE_ADDR
+#define CONFIG_SYS_I2C_SPEED            400000
+#define CONFIG_SYS_I2C_SLAVE            0xfe
+
+/*-----------------------------------------------------------------------
+ * 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      (512 * 1024 * 1024)
+#define iomem_valid_addr(addr, size) \
+       (addr >= PHYS_SDRAM_1 && addr <= (PHYS_SDRAM_1 + PHYS_SDRAM_1_SIZE))
+
+/*-----------------------------------------------------------------------
+ * FLASH and environment organization
+ */
+#define CONFIG_SYS_NO_FLASH
+
+/*-----------------------------------------------------------------------
+ * NAND FLASH driver setup
+ */
+#define NAND_MAX_CHIPS         8
+#define CONFIG_SYS_MAX_NAND_DEVICE    1
+#define CONFIG_SYS_NAND_BASE          0x40000000
+
+/* Monitor at beginning of flash */
+/* #define CONFIG_FSL_ENV_IN_SF */
+#define CONFIG_FSL_ENV_IN_MMC
+/* #define CONFIG_FSL_ENV_IN_NAND */
+
+#define CONFIG_ENV_SECT_SIZE    (128 * 1024)
+#define CONFIG_ENV_SIZE         CONFIG_ENV_SECT_SIZE
+
+#if defined(CONFIG_FSL_ENV_IN_NAND)
+       #define CONFIG_ENV_IS_IN_NAND 1
+       #define CONFIG_ENV_OFFSET       0x100000
+#elif defined(CONFIG_FSL_ENV_IN_MMC)
+       #define CONFIG_ENV_IS_IN_MMC    1
+       #define CONFIG_ENV_OFFSET       (768 * 1024)
+#elif defined(CONFIG_FSL_ENV_IN_SF)
+       #define CONFIG_ENV_IS_IN_SPI_FLASH      1
+       #define CONFIG_ENV_SPI_CS               1
+       #define CONFIG_ENV_OFFSET       (768 * 1024)
+#else
+       #define CONFIG_ENV_IS_NOWHERE   1
+#endif
+/*
+ * JFFS2 partitions
+ */
+#undef CONFIG_JFFS2_CMDLINE
+#define CONFIG_JFFS2_DEV       "nand0"
+
+#endif                         /* __CONFIG_H */
diff --git a/include/configs/mx51_bbg_mfg.h b/include/configs/mx51_bbg_mfg.h
new file mode 100644 (file)
index 0000000..becad73
--- /dev/null
@@ -0,0 +1,235 @@
+/*
+ * Copyright (C) 2007, Guennadi Liakhovetski <lg@denx.de>
+ *
+ * (C) Copyright 2009-2010 Freescale Semiconductor, Inc.
+ *
+ * Configuration settings for the MX51-3Stack Freescale 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/mx51.h>
+
+ /* High Level Configuration Options */
+#define CONFIG_ARMV7           1       /* This is armv7 Cortex-A8 CPU core */
+
+#define CONFIG_MFG             1
+#define CONFIG_MXC             1
+#define CONFIG_MX51_BBG                1       /* in a mx51 */
+#define CONFIG_FLASH_HEADER    1
+#define CONFIG_FLASH_HEADER_OFFSET 0x400
+#define CONFIG_FLASH_HEADER_BARKER 0xB1
+
+#define CONFIG_SKIP_RELOCATE_UBOOT
+
+#define CONFIG_MX51_HCLK_FREQ  24000000        /* RedBoot says 26MHz */
+
+#define CONFIG_ARCH_CPU_INIT
+#define CONFIG_ARCH_MMU
+
+#define CONFIG_DISPLAY_CPUINFO
+#define CONFIG_DISPLAY_BOARDINFO
+
+#define BOARD_LATE_INIT
+
+/*
+ * 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             1       /* enable passing of ATAGs */
+#define CONFIG_REVISION_TAG            1
+#define CONFIG_SETUP_MEMORY_TAGS       1
+#define CONFIG_INITRD_TAG              1
+
+/*
+ * Size of malloc() pool
+ */
+#define CONFIG_SYS_MALLOC_LEN          (CONFIG_ENV_SIZE + 2 * 1024 * 1024)
+/* size in bytes reserved for initial data */
+#define CONFIG_SYS_GBL_DATA_SIZE       128
+
+/*
+ * Hardware drivers
+ */
+#define CONFIG_MX51_UART       1
+#define CONFIG_MX51_UART1      1
+
+/*
+ * SPI Configs
+ * */
+#define CONFIG_FSL_SF          1
+#define CONFIG_SPI_FLASH_IMX_ATMEL     1
+#define CONFIG_SPI_FLASH_CS    1
+#define CONFIG_IMX_ECSPI
+#define CONFIG_IMX_SPI_PMIC
+#define CONFIG_IMX_SPI_PMIC_CS 0
+#define        IMX_CSPI_VER_2_3        1
+#define MAX_SPI_BYTES          (64 * 4)
+
+/*
+ * MMC Configs
+ * */
+
+/*
+ * Eth Configs
+ */
+#define CONFIG_HAS_ETH1
+#define CONFIG_NET_MULTI 1
+#define CONFIG_MXC_FEC
+#define CONFIG_MII
+#define CONFIG_DISCOVER_PHY
+
+#define CONFIG_FEC0_IOBASE     FEC_BASE_ADDR
+#define CONFIG_FEC0_PINMUX     -1
+#define CONFIG_FEC0_PHY_ADDR   0x1F
+#define CONFIG_FEC0_MIIBASE    -1
+
+/* allow to overwrite serial and ethaddr */
+#define CONFIG_ENV_OVERWRITE
+#define CONFIG_CONS_INDEX              1
+#define CONFIG_BAUDRATE                        115200
+#define CONFIG_SYS_BAUDRATE_TABLE      {9600, 19200, 38400, 57600, 115200}
+
+/***********************************************************
+ * Command definition
+ ***********************************************************/
+
+#include <config_cmd_default.h>
+
+#define CONFIG_CMD_PING
+#define CONFIG_CMD_DHCP
+#define CONFIG_CMD_MII
+#define CONFIG_CMD_NET
+#define CONFIG_NET_RETRY_COUNT 100
+
+/*
+ * SPI Configs
+ * */
+
+/*
+ * MMC Configs
+ * */
+/*
+ * Eth Configs
+ */
+#define CONFIG_HAS_ETH1
+#define CONFIG_NET_MULTI 1
+#define CONFIG_MXC_FEC
+#define CONFIG_MII
+#define CONFIG_DISCOVER_PHY
+
+#define CONFIG_FEC0_IOBASE     FEC_BASE_ADDR
+#define CONFIG_FEC0_PINMUX     -1
+#define CONFIG_FEC0_PHY_ADDR   0x1F
+#define CONFIG_FEC0_MIIBASE    -1
+
+
+
+/* Enable below configure when supporting nand */
+#define CONFIG_CMD_ENV
+
+#undef CONFIG_CMD_IMLS
+
+#define CONFIG_BOOTDELAY       0
+
+#define CONFIG_PRIME   "FEC0"
+
+#define CONFIG_LOADADDR                0x90100000      /* loadaddr env var */
+
+#define CONFIG_BOOTARGS         "console=ttymxc0,115200 "\
+                               "rdinit=/linuxrc"
+
+#define CONFIG_BOOTCOMMAND      "bootm ${loadaddr} 0x90800000"
+#define CONFIG_ENV_IS_EMBEDDED
+/*
+ * The MX51 3stack board seems to have a hardware "peculiarity" confirmed under
+ * U-Boot, RedBoot and Linux: the ethernet Rx signal is reaching the CS8900A
+ * controller inverted. The controller is capable of detecting and correcting
+ * this, but it needs 4 network packets for that. Which means, at startup, you
+ * will not receive answers to the first 4 packest, unless there have been some
+ * broadcasts on the network, or your board is on a hub. Reducing the ARP
+ * timeout from default 5 seconds to 200ms we speed up the initial TFTP
+ * transfer, should the user wish one, significantly.
+ */
+#define CONFIG_ARP_TIMEOUT     200UL
+
+/*
+ * Miscellaneous configurable options
+ */
+#define CONFIG_SYS_LONGHELP            /* undef to save memory */
+#define CONFIG_SYS_PROMPT              "BBG U-Boot > "
+#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
+
+#define CONFIG_CMDLINE_EDITING 1
+
+/*-----------------------------------------------------------------------
+ * 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
+/* TO1 boards */
+/* #define PHYS_SDRAM_1_SIZE   (128 * 1024 * 1024) */
+#define PHYS_SDRAM_1_SIZE      (512 * 1024 * 1024)
+#define iomem_valid_addr(addr, size) \
+       (addr >= PHYS_SDRAM_1 && addr <= (PHYS_SDRAM_1 + PHYS_SDRAM_1_SIZE))
+
+/*-----------------------------------------------------------------------
+ * FLASH and environment organization
+ */
+#define CONFIG_SYS_NO_FLASH
+
+/* Monitor at beginning of flash */
+/* #define CONFIG_FSL_ENV_IN_SF
+*/
+/* #define CONFIG_FSL_ENV_IN_MMC */
+
+#define CONFIG_ENV_SECT_SIZE    (128 * 1024)
+#define CONFIG_ENV_SIZE         CONFIG_ENV_SECT_SIZE
+#define CONFIG_ENV_IS_NOWHERE
+
+/*
+ * JFFS2 partitions
+ */
+/*
+#undef CONFIG_JFFS2_CMDLINE
+#define CONFIG_JFFS2_DEV       "nand0"
+*/
+#endif                         /* __CONFIG_H */
diff --git a/include/configs/mx53_arm2.h b/include/configs/mx53_arm2.h
new file mode 100644 (file)
index 0000000..f94191d
--- /dev/null
@@ -0,0 +1,274 @@
+/*
+ * Copyright (C) 2010 Freescale Semiconductor, Inc.
+ *
+ * Configuration settings for the MX53-ARM2 Freescale 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/mx53.h>
+
+ /* High Level Configuration Options */
+#define CONFIG_ARMV7           /* This is armv7 Cortex-A8 CPU core */
+#define CONFIG_MXC
+#define CONFIG_MX53
+#define CONFIG_MX53_ARM2
+#define CONFIG_FLASH_HEADER
+#define CONFIG_FLASH_HEADER_OFFSET 0x400
+
+#define CONFIG_SKIP_RELOCATE_UBOOT
+
+#define CONFIG_ARCH_CPU_INIT
+#define CONFIG_ARCH_MMU
+
+#define CONFIG_MX53_HCLK_FREQ  24000000
+#define CONFIG_SYS_PLL2_FREQ    400
+#define CONFIG_SYS_AHB_PODF     2
+#define CONFIG_SYS_AXIA_PODF    0
+#define CONFIG_SYS_AXIB_PODF    1
+
+#define CONFIG_DISPLAY_CPUINFO
+#define CONFIG_DISPLAY_BOARDINFO
+
+#define CONFIG_SYS_64BIT_VSPRINTF
+
+#define BOARD_LATE_INIT
+/*
+ * 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             1       /* enable passing of ATAGs */
+#define CONFIG_REVISION_TAG            1
+#define CONFIG_SETUP_MEMORY_TAGS       1
+#define CONFIG_INITRD_TAG              1
+
+/*
+ * Size of malloc() pool
+ */
+#define CONFIG_SYS_MALLOC_LEN          (CONFIG_ENV_SIZE + 2 * 1024 * 1024)
+/* size in bytes reserved for initial data */
+#define CONFIG_SYS_GBL_DATA_SIZE       128
+
+/*
+ * Hardware drivers
+ */
+#define CONFIG_MX53_UART       1
+#define CONFIG_MX53_UART1      1
+
+/* allow to overwrite serial and ethaddr */
+#define CONFIG_ENV_OVERWRITE
+#define CONFIG_CONS_INDEX              1
+#define CONFIG_BAUDRATE                        115200
+#define CONFIG_SYS_BAUDRATE_TABLE      {9600, 19200, 38400, 57600, 115200}
+
+/***********************************************************
+ * Command definition
+ ***********************************************************/
+
+#include <config_cmd_default.h>
+
+#define CONFIG_CMD_PING
+#define CONFIG_CMD_DHCP
+#define CONFIG_CMD_MII
+#define CONFIG_CMD_NET
+#define CONFIG_NET_RETRY_COUNT  100
+#define CONFIG_NET_MULTI 1
+#define CONFIG_BOOTP_SUBNETMASK
+#define CONFIG_BOOTP_GATEWAY
+#define CONFIG_BOOTP_DNS
+
+#define CONFIG_CMD_MMC
+#define CONFIG_CMD_ENV
+
+#define CONFIG_CMD_IIM
+
+#define CONFIG_CMD_CLOCK
+#define CONFIG_REF_CLK_FREQ CONFIG_MX53_HCLK_FREQ
+
+#define CONFIG_CMD_SATA
+
+#undef CONFIG_CMD_IMLS
+
+#define CONFIG_BOOTDELAY       3
+
+#define CONFIG_PRIME   "FEC0"
+
+#define CONFIG_LOADADDR                0x70800000      /* loadaddr env var */
+#define CONFIG_RD_LOADADDR     (CONFIG_LOADADDR + 0x300000)
+
+#define        CONFIG_EXTRA_ENV_SETTINGS                                       \
+               "netdev=eth0\0"                                         \
+               "ethprime=FEC0\0"                                       \
+               "uboot=u-boot.bin\0"                    \
+               "kernel=uImage\0"                               \
+               "nfsroot=/opt/eldk/arm\0"                               \
+               "bootargs_base=setenv bootargs console=ttymxc0,115200\0"\
+               "bootargs_nfs=setenv bootargs ${bootargs} root=/dev/nfs "\
+                       "ip=dhcp nfsroot=${serverip}:${nfsroot},v3,tcp\0"\
+               "bootcmd_net=run bootargs_base bootargs_nfs; "          \
+                       "tftpboot ${loadaddr} ${kernel}; bootm\0"       \
+               "bootargs_mmc=setenv bootargs ${bootargs} ip=dhcp "     \
+                       "root=/dev/mmcblk0p2 rootwait\0"                \
+               "bootcmd_mmc=run bootargs_base bootargs_mmc; bootm\0"   \
+               "bootcmd=run bootcmd_net\0"                             \
+
+
+#define CONFIG_ARP_TIMEOUT     200UL
+
+/*
+ * Miscellaneous configurable options
+ */
+#define CONFIG_SYS_LONGHELP            /* undef to save memory */
+#define CONFIG_SYS_PROMPT              "ARM2 U-Boot > "
+#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
+
+#define CONFIG_CMDLINE_EDITING 1
+
+#define CONFIG_FEC0_IOBASE     FEC_BASE_ADDR
+#define CONFIG_FEC0_PINMUX     -1
+#define CONFIG_FEC0_PHY_ADDR   -1
+#define CONFIG_FEC0_MIIBASE    -1
+
+#define CONFIG_GET_FEC_MAC_ADDR_FROM_IIM
+#define CONFIG_IIM_MAC_ADDR_OFFSET      0x24
+
+#define CONFIG_MXC_FEC
+#define CONFIG_MII
+#define CONFIG_MII_GASKET
+#define CONFIG_DISCOVER_PHY
+
+/*
+ * FUSE Configs
+ * */
+#ifdef CONFIG_CMD_MMC
+       #define CONFIG_IMX_IIM
+       #define IMX_IIM_BASE    IIM_BASE_ADDR
+       #define CONFIG_IIM_MAC_BANK     1
+       #define CONFIG_IIM_MAC_ROW      9
+#endif
+
+/*
+ * I2C Configs
+ */
+#define CONFIG_CMD_I2C          1
+#define CONFIG_HARD_I2C         1
+#define CONFIG_I2C_MXC          1
+#define CONFIG_SYS_I2C_PORT             I2C2_BASE_ADDR
+#define CONFIG_SYS_I2C_SPEED            100000
+#define CONFIG_SYS_I2C_SLAVE            0xfe
+
+
+/*
+ * SPI Configs
+ */
+#define CONFIG_FSL_SF          1
+#define CONFIG_CMD_SPI
+#define CONFIG_CMD_SF
+#define CONFIG_SPI_FLASH_IMX_ATMEL     1
+#define CONFIG_SPI_FLASH_CS    1
+#define CONFIG_IMX_ECSPI
+#define IMX_CSPI_VER_2_3        1
+#define MAX_SPI_BYTES          (64 * 4)
+
+/*
+ * MMC Configs
+ */
+#ifdef CONFIG_CMD_MMC
+       #define CONFIG_MMC                              1
+       #define CONFIG_GENERIC_MMC
+       #define CONFIG_IMX_MMC
+       #define CONFIG_SYS_FSL_ESDHC_NUM        2
+       #define CONFIG_SYS_FSL_ESDHC_ADDR       0
+       #define CONFIG_SYS_MMC_ENV_DEV  1
+       #define CONFIG_DOS_PARTITION    1
+       #define CONFIG_CMD_FAT          1
+       #define CONFIG_CMD_EXT2         1
+
+       #define CONFIG_BOOT_PARTITION_ACCESS
+#endif
+
+/*
+ * SATA Configs
+ */
+#ifdef CONFIG_CMD_SATA
+       #define CONFIG_DWC_AHSATA
+       #define CONFIG_SYS_SATA_MAX_DEVICE      1
+       #define CONFIG_DWC_AHSATA_PORT_ID       0
+       #define CONFIG_DWC_AHSATA_BASE_ADDR     SATA_BASE_ADDR
+       #define CONFIG_LBA48
+       #define CONFIG_LIBATA
+#endif
+
+/*-----------------------------------------------------------------------
+ * 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      (1024 * 1024 * 1024)
+#define iomem_valid_addr(addr, size) \
+       (addr >= PHYS_SDRAM_1 && addr <= \
+               (unsigned long)(PHYS_SDRAM_1 + PHYS_SDRAM_1_SIZE))
+
+/*-----------------------------------------------------------------------
+ * FLASH and environment organization
+ */
+#define CONFIG_SYS_NO_FLASH
+
+/* Monitor at beginning of flash */
+#define CONFIG_FSL_ENV_IN_MMC
+
+#define CONFIG_ENV_SECT_SIZE    (128 * 1024)
+#define CONFIG_ENV_SIZE         CONFIG_ENV_SECT_SIZE
+
+#if defined(CONFIG_FSL_ENV_IN_NAND)
+       #define CONFIG_ENV_IS_IN_NAND 1
+       #define CONFIG_ENV_OFFSET       0x100000
+#elif defined(CONFIG_FSL_ENV_IN_MMC)
+       #define CONFIG_ENV_IS_IN_MMC    1
+       #define CONFIG_ENV_OFFSET       (768 * 1024)
+#elif defined(CONFIG_FSL_ENV_IN_SF)
+       #define CONFIG_ENV_IS_IN_SPI_FLASH      1
+       #define CONFIG_ENV_SPI_CS               1
+       #define CONFIG_ENV_OFFSET       (768 * 1024)
+#else
+       #define CONFIG_ENV_IS_NOWHERE   1
+#endif
+#endif                         /* __CONFIG_H */
diff --git a/include/configs/mx53_arm2_ddr3.h b/include/configs/mx53_arm2_ddr3.h
new file mode 100644 (file)
index 0000000..f4cd6ba
--- /dev/null
@@ -0,0 +1,256 @@
+/*
+ * Copyright (C) 2010 Freescale Semiconductor, Inc.
+ *
+ * Configuration settings for the MX53-ARM2-DDR3 Freescale 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/mx53.h>
+
+ /* High Level Configuration Options */
+#define CONFIG_ARMV7           /* This is armv7 Cortex-A8 CPU core */
+#define CONFIG_MXC
+#define CONFIG_MX53
+#define CONFIG_MX53_ARM2_DDR3
+#define CONFIG_FLASH_HEADER
+#define CONFIG_FLASH_HEADER_OFFSET 0x400
+
+#define CONFIG_SKIP_RELOCATE_UBOOT
+
+#define CONFIG_ARCH_CPU_INIT
+#define CONFIG_ARCH_MMU
+
+#define CONFIG_MX53_HCLK_FREQ  24000000
+#define CONFIG_SYS_PLL2_FREQ    400
+#define CONFIG_SYS_AHB_PODF     2
+#define CONFIG_SYS_AXIA_PODF    0
+#define CONFIG_SYS_AXIB_PODF    1
+
+#define CONFIG_DISPLAY_CPUINFO
+#define CONFIG_DISPLAY_BOARDINFO
+
+#define CONFIG_SYS_64BIT_VSPRINTF
+
+#define BOARD_LATE_INIT
+/*
+ * 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             1       /* enable passing of ATAGs */
+#define CONFIG_REVISION_TAG            1
+#define CONFIG_SETUP_MEMORY_TAGS       1
+#define CONFIG_INITRD_TAG              1
+
+/*
+ * Size of malloc() pool
+ */
+#define CONFIG_SYS_MALLOC_LEN          (CONFIG_ENV_SIZE + 2 * 1024 * 1024)
+/* size in bytes reserved for initial data */
+#define CONFIG_SYS_GBL_DATA_SIZE       128
+
+/*
+ * Hardware drivers
+ */
+#define CONFIG_MX53_UART       1
+#define CONFIG_MX53_UART1      1
+
+/* allow to overwrite serial and ethaddr */
+#define CONFIG_ENV_OVERWRITE
+#define CONFIG_CONS_INDEX              1
+#define CONFIG_BAUDRATE                        115200
+#define CONFIG_SYS_BAUDRATE_TABLE      {9600, 19200, 38400, 57600, 115200}
+
+/***********************************************************
+ * Command definition
+ ***********************************************************/
+
+#include <config_cmd_default.h>
+
+#define CONFIG_CMD_PING
+#define CONFIG_CMD_DHCP
+#define CONFIG_CMD_MII
+#define CONFIG_CMD_NET
+#define CONFIG_NET_RETRY_COUNT  100
+#define CONFIG_NET_MULTI 1
+#define CONFIG_BOOTP_SUBNETMASK
+#define CONFIG_BOOTP_GATEWAY
+#define CONFIG_BOOTP_DNS
+
+#define CONFIG_CMD_MMC
+#define CONFIG_CMD_ENV
+
+#define CONFIG_CMD_IIM
+
+#define CONFIG_CMD_CLOCK
+#define CONFIG_REF_CLK_FREQ CONFIG_MX53_HCLK_FREQ
+
+#undef CONFIG_CMD_IMLS
+
+#define CONFIG_BOOTDELAY       3
+
+#define CONFIG_PRIME   "FEC0"
+
+#define CONFIG_LOADADDR                0x70800000      /* loadaddr env var */
+#define CONFIG_RD_LOADADDR     (CONFIG_LOADADDR + 0x300000)
+
+#define        CONFIG_EXTRA_ENV_SETTINGS                                       \
+               "netdev=eth0\0"                                         \
+               "ethprime=FEC0\0"                                       \
+               "uboot=u-boot.bin\0"                    \
+               "kernel=uImage\0"                               \
+               "nfsroot=/opt/eldk/arm\0"                               \
+               "bootargs_base=setenv bootargs console=ttymxc0,115200\0"\
+               "bootargs_nfs=setenv bootargs ${bootargs} root=/dev/nfs "\
+                       "ip=dhcp nfsroot=${serverip}:${nfsroot},v3,tcp\0"\
+               "bootcmd_net=run bootargs_base bootargs_nfs; "          \
+                       "tftpboot ${loadaddr} ${kernel}; bootm\0"       \
+               "bootargs_mmc=setenv bootargs ${bootargs} ip=dhcp "     \
+                       "root=/dev/mmcblk0p2 rootwait\0"                \
+               "bootcmd_mmc=run bootargs_base bootargs_mmc; bootm\0"   \
+               "bootcmd=run bootcmd_net\0"                             \
+
+
+#define CONFIG_ARP_TIMEOUT     200UL
+
+/*
+ * Miscellaneous configurable options
+ */
+#define CONFIG_SYS_LONGHELP            /* undef to save memory */
+#define CONFIG_SYS_PROMPT              "ARM2-DDR3 U-Boot > "
+#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
+
+#define CONFIG_CMDLINE_EDITING 1
+
+#define CONFIG_FEC0_IOBASE     FEC_BASE_ADDR
+#define CONFIG_FEC0_PINMUX     -1
+#define CONFIG_FEC0_PHY_ADDR   -1
+#define CONFIG_FEC0_MIIBASE    -1
+
+#define CONFIG_GET_FEC_MAC_ADDR_FROM_IIM
+#define CONFIG_IIM_MAC_ADDR_OFFSET      0x24
+
+#define CONFIG_MXC_FEC
+#define CONFIG_MII
+#define CONFIG_MII_GASKET
+#define CONFIG_DISCOVER_PHY
+
+/*
+ * FUSE Configs
+ * */
+#ifdef CONFIG_CMD_MMC
+       #define CONFIG_IMX_IIM
+       #define IMX_IIM_BASE    IIM_BASE_ADDR
+       #define CONFIG_IIM_MAC_BANK     1
+       #define CONFIG_IIM_MAC_ROW      9
+#endif
+
+/*
+ * I2C Configs
+ */
+#define CONFIG_CMD_I2C          1
+#define CONFIG_HARD_I2C         1
+#define CONFIG_I2C_MXC          1
+#define CONFIG_SYS_I2C_PORT             I2C2_BASE_ADDR
+#define CONFIG_SYS_I2C_SPEED            100000
+#define CONFIG_SYS_I2C_SLAVE            0xfe
+
+
+/*
+ * SPI Configs
+ */
+#define CONFIG_FSL_SF          1
+#define CONFIG_CMD_SPI
+#define CONFIG_CMD_SF
+#define CONFIG_SPI_FLASH_IMX_ATMEL     1
+#define CONFIG_SPI_FLASH_CS    1
+#define CONFIG_IMX_ECSPI
+#define IMX_CSPI_VER_2_3        1
+#define MAX_SPI_BYTES          (64 * 4)
+
+/*
+ * MMC Configs
+ */
+#ifdef CONFIG_CMD_MMC
+       #define CONFIG_MMC                              1
+       #define CONFIG_GENERIC_MMC
+       #define CONFIG_IMX_MMC
+       #define CONFIG_SYS_FSL_ESDHC_NUM        2
+       #define CONFIG_SYS_FSL_ESDHC_ADDR       0
+       #define CONFIG_SYS_MMC_ENV_DEV  1
+       #define CONFIG_DOS_PARTITION    1
+       #define CONFIG_CMD_FAT          1
+       #define CONFIG_CMD_EXT2         1
+#endif
+/*-----------------------------------------------------------------------
+ * 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      (1024 * 1024 * 1024)
+#define iomem_valid_addr(addr, size) \
+       (addr >= PHYS_SDRAM_1 && addr <= (PHYS_SDRAM_1 + PHYS_SDRAM_1_SIZE))
+
+/*-----------------------------------------------------------------------
+ * FLASH and environment organization
+ */
+#define CONFIG_SYS_NO_FLASH
+
+/* Monitor at beginning of flash */
+#define CONFIG_FSL_ENV_IN_MMC
+
+#define CONFIG_ENV_SECT_SIZE    (128 * 1024)
+#define CONFIG_ENV_SIZE         CONFIG_ENV_SECT_SIZE
+
+#if defined(CONFIG_FSL_ENV_IN_NAND)
+       #define CONFIG_ENV_IS_IN_NAND 1
+       #define CONFIG_ENV_OFFSET       0x100000
+#elif defined(CONFIG_FSL_ENV_IN_MMC)
+       #define CONFIG_ENV_IS_IN_MMC    1
+       #define CONFIG_ENV_OFFSET       (768 * 1024)
+#elif defined(CONFIG_FSL_ENV_IN_SF)
+       #define CONFIG_ENV_IS_IN_SPI_FLASH      1
+       #define CONFIG_ENV_SPI_CS               1
+       #define CONFIG_ENV_OFFSET       (768 * 1024)
+#else
+       #define CONFIG_ENV_IS_NOWHERE   1
+#endif
+#endif                         /* __CONFIG_H */
diff --git a/include/configs/mx53_evk.h b/include/configs/mx53_evk.h
new file mode 100644 (file)
index 0000000..0b1e75e
--- /dev/null
@@ -0,0 +1,273 @@
+/*
+ * Copyright (C) 2010 Freescale Semiconductor, Inc.
+ *
+ * Configuration settings for the MX53-EVK Freescale 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/mx53.h>
+
+ /* High Level Configuration Options */
+#define CONFIG_ARMV7           /* This is armv7 Cortex-A8 CPU core */
+#define CONFIG_MXC
+#define CONFIG_MX53
+#define CONFIG_MX53_EVK
+#define CONFIG_FLASH_HEADER
+#define CONFIG_FLASH_HEADER_OFFSET 0x400
+
+#define CONFIG_SKIP_RELOCATE_UBOOT
+
+#define CONFIG_ARCH_CPU_INIT
+#define CONFIG_ARCH_MMU
+
+#define CONFIG_MX53_HCLK_FREQ  24000000
+#define CONFIG_SYS_PLL2_FREQ    600
+#define CONFIG_SYS_AHB_PODF     4
+#define CONFIG_SYS_AXIA_PODF    1
+#define CONFIG_SYS_AXIB_PODF    2
+
+#define CONFIG_DISPLAY_CPUINFO
+#define CONFIG_DISPLAY_BOARDINFO
+
+#define CONFIG_SYS_64BIT_VSPRINTF
+
+#define BOARD_LATE_INIT
+/*
+ * 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             1       /* enable passing of ATAGs */
+#define CONFIG_REVISION_TAG            1
+#define CONFIG_SETUP_MEMORY_TAGS       1
+#define CONFIG_INITRD_TAG              1
+
+/*
+ * Size of malloc() pool
+ */
+#define CONFIG_SYS_MALLOC_LEN          (CONFIG_ENV_SIZE + 2 * 1024 * 1024)
+/* size in bytes reserved for initial data */
+#define CONFIG_SYS_GBL_DATA_SIZE       128
+
+/*
+ * Hardware drivers
+ */
+#define CONFIG_MX53_UART       1
+#define CONFIG_MX53_UART1      1
+
+/* allow to overwrite serial and ethaddr */
+#define CONFIG_ENV_OVERWRITE
+#define CONFIG_CONS_INDEX              1
+#define CONFIG_BAUDRATE                        115200
+#define CONFIG_SYS_BAUDRATE_TABLE      {9600, 19200, 38400, 57600, 115200}
+
+/***********************************************************
+ * Command definition
+ ***********************************************************/
+
+#include <config_cmd_default.h>
+
+#define CONFIG_CMD_PING
+#define CONFIG_CMD_DHCP
+#define CONFIG_CMD_MII
+#define CONFIG_CMD_NET
+#define CONFIG_NET_RETRY_COUNT  100
+#define CONFIG_NET_MULTI 1
+#define CONFIG_BOOTP_SUBNETMASK
+#define CONFIG_BOOTP_GATEWAY
+#define CONFIG_BOOTP_DNS
+#define CONFIG_CMD_IIM
+#define CONFIG_CMD_MMC
+#define CONFIG_CMD_ENV
+
+#define CONFIG_CMD_CLOCK
+#define CONFIG_REF_CLK_FREQ CONFIG_MX53_HCLK_FREQ
+
+#define CONFIG_CMD_SATA
+#undef CONFIG_CMD_IMLS
+
+#define CONFIG_BOOTDELAY       3
+
+#define CONFIG_PRIME   "FEC0"
+
+#define CONFIG_LOADADDR                0x70800000      /* loadaddr env var */
+#define CONFIG_RD_LOADADDR     (CONFIG_LOADADDR + 0x300000)
+
+#define        CONFIG_EXTRA_ENV_SETTINGS                                       \
+               "netdev=eth0\0"                                         \
+               "ethprime=FEC0\0"                                       \
+               "uboot=u-boot.bin\0"                    \
+               "kernel=uImage\0"                               \
+               "nfsroot=/opt/eldk/arm\0"                               \
+               "bootargs_base=setenv bootargs console=ttymxc0,115200\0"\
+               "bootargs_nfs=setenv bootargs ${bootargs} root=/dev/nfs "\
+                       "ip=dhcp nfsroot=${serverip}:${nfsroot},v3,tcp\0"\
+               "bootcmd_net=run bootargs_base bootargs_nfs; "          \
+                       "tftpboot ${loadaddr} ${kernel}; bootm\0"       \
+               "bootargs_mmc=setenv bootargs ${bootargs} ip=dhcp "     \
+                       "root=/dev/mmcblk0p2 rootwait\0"                \
+               "bootcmd_mmc=run bootargs_base bootargs_mmc; bootm\0"   \
+               "bootcmd=run bootcmd_net\0"                             \
+
+
+#define CONFIG_ARP_TIMEOUT     200UL
+
+/*
+ * Miscellaneous configurable options
+ */
+#define CONFIG_SYS_LONGHELP            /* undef to save memory */
+#define CONFIG_SYS_PROMPT              "EVK U-Boot > "
+#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
+
+#define CONFIG_CMDLINE_EDITING 1
+
+#define CONFIG_FEC0_IOBASE     FEC_BASE_ADDR
+#define CONFIG_FEC0_PINMUX     -1
+#define CONFIG_FEC0_PHY_ADDR   -1
+#define CONFIG_FEC0_MIIBASE    -1
+
+#define CONFIG_GET_FEC_MAC_ADDR_FROM_IIM
+#define CONFIG_IIM_MAC_ADDR_OFFSET      0x24
+
+#define CONFIG_MXC_FEC
+#define CONFIG_MII
+#define CONFIG_MII_GASKET
+#define CONFIG_DISCOVER_PHY
+
+/*
+ * FUSE Configs
+ * */
+#ifdef CONFIG_CMD_MMC
+       #define CONFIG_IMX_IIM
+       #define IMX_IIM_BASE    IIM_BASE_ADDR
+       #define CONFIG_IIM_MAC_BANK     1
+       #define CONFIG_IIM_MAC_ROW      9
+#endif
+
+/*
+ * I2C Configs
+ */
+#define CONFIG_CMD_I2C          1
+#define CONFIG_HARD_I2C         1
+#define CONFIG_I2C_MXC          1
+#define CONFIG_SYS_I2C_PORT             I2C2_BASE_ADDR
+#define CONFIG_SYS_I2C_SPEED            100000
+#define CONFIG_SYS_I2C_SLAVE            0xfe
+
+
+/*
+ * SPI Configs
+ */
+#define CONFIG_FSL_SF          1
+#define CONFIG_CMD_SPI
+#define CONFIG_CMD_SF
+#define CONFIG_SPI_FLASH_IMX_ATMEL     1
+#define CONFIG_SPI_FLASH_CS    1
+#define CONFIG_IMX_ECSPI
+#define IMX_CSPI_VER_2_3        1
+#define MAX_SPI_BYTES          (64 * 4)
+
+/*
+ * MMC Configs
+ */
+#ifdef CONFIG_CMD_MMC
+       #define CONFIG_MMC                              1
+       #define CONFIG_GENERIC_MMC
+       #define CONFIG_IMX_MMC
+       #define CONFIG_SYS_FSL_ESDHC_NUM        2
+       #define CONFIG_SYS_FSL_ESDHC_ADDR       0
+       #define CONFIG_SYS_MMC_ENV_DEV  0
+       #define CONFIG_DOS_PARTITION    1
+       #define CONFIG_CMD_FAT          1
+       #define CONFIG_CMD_EXT2         1
+
+       /* detect whether ESDHC1 or ESDHC3 is boot device */
+       #define CONFIG_DYNAMIC_MMC_DEVNO
+
+       #define CONFIG_BOOT_PARTITION_ACCESS
+#endif
+
+/*
+ * SATA Configs
+ */
+#ifdef CONFIG_CMD_SATA
+       #define CONFIG_DWC_AHSATA
+       #define CONFIG_SYS_SATA_MAX_DEVICE      1
+       #define CONFIG_DWC_AHSATA_PORT_ID       0
+       #define CONFIG_DWC_AHSATA_BASE_ADDR     SATA_BASE_ADDR
+       #define CONFIG_LBA48
+       #define CONFIG_LIBATA
+#endif
+
+/*-----------------------------------------------------------------------
+ * 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      (1024 * 1024 * 1024)
+#define iomem_valid_addr(addr, size) \
+       (addr >= PHYS_SDRAM_1 && addr <= (PHYS_SDRAM_1 + PHYS_SDRAM_1_SIZE))
+
+/*-----------------------------------------------------------------------
+ * FLASH and environment organization
+ */
+#define CONFIG_SYS_NO_FLASH
+
+/* Monitor at beginning of flash */
+#define CONFIG_FSL_ENV_IN_MMC
+
+#define CONFIG_ENV_SECT_SIZE    (128 * 1024)
+#define CONFIG_ENV_SIZE         CONFIG_ENV_SECT_SIZE
+
+#if defined(CONFIG_FSL_ENV_IN_NAND)
+       #define CONFIG_ENV_IS_IN_NAND 1
+       #define CONFIG_ENV_OFFSET       0x100000
+#elif defined(CONFIG_FSL_ENV_IN_MMC)
+       #define CONFIG_ENV_IS_IN_MMC    1
+       #define CONFIG_ENV_OFFSET       (768 * 1024)
+#elif defined(CONFIG_FSL_ENV_IN_SF)
+       #define CONFIG_ENV_IS_IN_SPI_FLASH      1
+       #define CONFIG_ENV_SPI_CS               1
+       #define CONFIG_ENV_OFFSET       (768 * 1024)
+#else
+       #define CONFIG_ENV_IS_NOWHERE   1
+#endif
+#endif                         /* __CONFIG_H */
diff --git a/include/configs/mx53_evk_mfg.h b/include/configs/mx53_evk_mfg.h
new file mode 100644 (file)
index 0000000..b2b9f4f
--- /dev/null
@@ -0,0 +1,217 @@
+/*
+ * Copyright (C) 2010 Freescale Semiconductor, Inc.
+ *
+ * Configuration settings for the MX53-EVK Freescale 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/mx53.h>
+
+ /* High Level Configuration Options */
+#define CONFIG_MFG     1
+#define CONFIG_ARMV7           /* This is armv7 Cortex-A8 CPU core */
+#define CONFIG_MXC
+#define CONFIG_MX53
+#define CONFIG_MX53_EVK
+#define CONFIG_FLASH_HEADER
+#define CONFIG_FLASH_HEADER_OFFSET 0x400
+
+#define CONFIG_SKIP_RELOCATE_UBOOT
+
+#define CONFIG_ARCH_CPU_INIT
+#define CONFIG_ARCH_MMU
+
+#define CONFIG_MX53_HCLK_FREQ  24000000
+#define CONFIG_SYS_PLL2_FREQ    600
+#define CONFIG_SYS_AHB_PODF     4
+#define CONFIG_SYS_AXIA_PODF    1
+#define CONFIG_SYS_AXIB_PODF    2
+
+#define CONFIG_DISPLAY_CPUINFO
+#define CONFIG_DISPLAY_BOARDINFO
+
+#define CONFIG_SYS_64BIT_VSPRINTF
+
+#define BOARD_LATE_INIT
+/*
+ * 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             1       /* enable passing of ATAGs */
+#define CONFIG_REVISION_TAG            1
+#define CONFIG_SETUP_MEMORY_TAGS       1
+#define CONFIG_INITRD_TAG              1
+
+/*
+ * Size of malloc() pool
+ */
+#define CONFIG_SYS_MALLOC_LEN          (CONFIG_ENV_SIZE + 2 * 1024 * 1024)
+/* size in bytes reserved for initial data */
+#define CONFIG_SYS_GBL_DATA_SIZE       128
+
+/*
+ * Hardware drivers
+ */
+#define CONFIG_MX53_UART       1
+#define CONFIG_MX53_UART1      1
+
+/* allow to overwrite serial and ethaddr */
+#define CONFIG_ENV_OVERWRITE
+#define CONFIG_CONS_INDEX              1
+#define CONFIG_BAUDRATE                        115200
+#define CONFIG_SYS_BAUDRATE_TABLE      {9600, 19200, 38400, 57600, 115200}
+
+/***********************************************************
+ * Command definition
+ ***********************************************************/
+
+#include <config_cmd_default.h>
+
+#define CONFIG_CMD_PING
+#define CONFIG_CMD_DHCP
+#define CONFIG_CMD_MII
+#define CONFIG_CMD_NET
+#define CONFIG_NET_RETRY_COUNT  100
+#define CONFIG_NET_MULTI 1
+#define CONFIG_BOOTP_SUBNETMASK
+#define CONFIG_BOOTP_GATEWAY
+#define CONFIG_BOOTP_DNS
+
+#define CONFIG_CMD_MMC
+#define CONFIG_CMD_ENV
+
+#define CONFIG_CMD_CLOCK
+#define CONFIG_REF_CLK_FREQ CONFIG_MX53_HCLK_FREQ
+
+#undef CONFIG_CMD_IMLS
+
+#define CONFIG_BOOTDELAY       0
+
+#define CONFIG_PRIME   "FEC0"
+
+#define CONFIG_LOADADDR                0x70800000      /* loadaddr env var */
+#define CONFIG_RD_LOADADDR     (CONFIG_LOADADDR + 0x300000)
+
+#define CONFIG_BOOTARGS         "console=ttymxc0,115200 "\
+                               "rdinit=/linuxrc"
+#define CONFIG_BOOTCOMMAND      "bootm 0x70800000 0x70B00000"
+#define CONFIG_ENV_IS_EMBEDDED
+
+#define CONFIG_ARP_TIMEOUT     200UL
+
+/*
+ * Miscellaneous configurable options
+ */
+#define CONFIG_SYS_LONGHELP            /* undef to save memory */
+#define CONFIG_SYS_PROMPT              "EVK MFG U-Boot > "
+#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
+
+#define CONFIG_CMDLINE_EDITING 1
+
+#define CONFIG_FEC0_IOBASE     FEC_BASE_ADDR
+#define CONFIG_FEC0_PINMUX     -1
+#define CONFIG_FEC0_PHY_ADDR   -1
+#define CONFIG_FEC0_MIIBASE    -1
+
+#define CONFIG_MXC_FEC
+#define CONFIG_MII
+#define CONFIG_MII_GASKET
+#define CONFIG_DISCOVER_PHY
+
+/*
+ * I2C Configs
+ */
+#define CONFIG_CMD_I2C          1
+#define CONFIG_HARD_I2C         1
+#define CONFIG_I2C_MXC          1
+#define CONFIG_SYS_I2C_PORT             I2C2_BASE_ADDR
+#define CONFIG_SYS_I2C_SPEED            100000
+#define CONFIG_SYS_I2C_SLAVE            0xfe
+
+
+/*
+ * SPI Configs
+ */
+#define CONFIG_FSL_SF          1
+#define CONFIG_CMD_SPI
+#define CONFIG_CMD_SF
+#define CONFIG_SPI_FLASH_IMX_ATMEL     1
+#define CONFIG_SPI_FLASH_CS    1
+#define CONFIG_IMX_ECSPI
+#define IMX_CSPI_VER_2_3        1
+#define MAX_SPI_BYTES          (64 * 4)
+
+/*
+ * MMC Configs
+ */
+#ifdef CONFIG_CMD_MMC
+       #define CONFIG_MMC                              1
+       #define CONFIG_GENERIC_MMC
+       #define CONFIG_IMX_MMC
+       #define CONFIG_SYS_FSL_ESDHC_NUM        2
+       #define CONFIG_SYS_FSL_ESDHC_ADDR       0
+       #define CONFIG_SYS_MMC_ENV_DEV  0
+       #define CONFIG_DOS_PARTITION    1
+       #define CONFIG_CMD_FAT          1
+       #define CONFIG_CMD_EXT2         1
+#endif
+/*-----------------------------------------------------------------------
+ * 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      (1024 * 1024 * 1024)
+#define iomem_valid_addr(addr, size) \
+       (addr >= PHYS_SDRAM_1 && addr <= (PHYS_SDRAM_1 + PHYS_SDRAM_1_SIZE))
+
+/*-----------------------------------------------------------------------
+ * FLASH and environment organization
+ */
+#define CONFIG_SYS_NO_FLASH
+
+
+#define CONFIG_ENV_SECT_SIZE    (128 * 1024)
+#define CONFIG_ENV_SIZE         CONFIG_ENV_SECT_SIZE
+
+#define CONFIG_ENV_IS_NOWHERE
+
+#endif                         /* __CONFIG_H */
index 34a4edd41e921f038bc82716f9ad7b21af0c1f59..eab0e27fb5f64ab25d5cf96b8c9895ececc02211 100644 (file)
@@ -27,7 +27,6 @@
 
 #define CONFIG_SYS_MX5_HCLK    24000000
 #define CONFIG_SYS_MX5_CLK32           32768
-#define CONFIG_DISPLAY_CPUINFO
 #define CONFIG_DISPLAY_BOARDINFO
 
 #define CONFIG_MACH_TYPE       MACH_TYPE_MX53_LOCO
@@ -42,7 +41,9 @@
 #define CONFIG_SYS_MALLOC_LEN          (CONFIG_ENV_SIZE + 2 * 1024 * 1024)
 
 #define CONFIG_BOARD_EARLY_INIT_F
+#define CONFIG_BOARD_LATE_INIT
 #define CONFIG_MXC_GPIO
+#define CONFIG_REVISION_TAG
 
 #define CONFIG_MXC_UART
 #define CONFIG_MXC_UART_BASE   UART1_BASE
@@ -56,6 +57,7 @@
 #define CONFIG_CMD_MMC
 #define CONFIG_GENERIC_MMC
 #define CONFIG_CMD_FAT
+#define CONFIG_CMD_EXT2
 #define CONFIG_DOS_PARTITION
 
 /* Eth Configs */
 #define CONFIG_MXC_USB_PORTSC  (PORT_PTS_UTMI | PORT_PTS_PTW)
 #define CONFIG_MXC_USB_FLAGS   0
 
+/* I2C Configs */
+#define CONFIG_HARD_I2C
+#define CONFIG_I2C_MXC
+#define CONFIG_SYS_I2C_MX53_PORT1
+#define CONFIG_SYS_I2C_SPEED           100000
+#define CONFIG_SYS_I2C_SLAVE           0xfe
+
+/* PMIC Controller */
+#define CONFIG_PMIC
+#define CONFIG_PMIC_I2C
+#define CONFIG_DIALOG_PMIC
+#define CONFIG_PMIC_FSL
+#define CONFIG_SYS_DIALOG_PMIC_I2C_ADDR        0x48
+#define CONFIG_SYS_FSL_PMIC_I2C_ADDR   0x8
+
 /* allow to overwrite serial and ethaddr */
 #define CONFIG_ENV_OVERWRITE
 #define CONFIG_CONS_INDEX              1
 
 #define CONFIG_OF_LIBFDT
 
+#define CONFIG_CMD_SATA
+#ifdef CONFIG_CMD_SATA
+       #define CONFIG_DWC_AHSATA
+       #define CONFIG_SYS_SATA_MAX_DEVICE      1
+       #define CONFIG_DWC_AHSATA_PORT_ID       0
+       #define CONFIG_DWC_AHSATA_BASE_ADDR     SATA_BASE_ADDR
+       #define CONFIG_LBA48
+       #define CONFIG_LIBATA
+#endif
+
 #endif                         /* __CONFIG_H */
index e83aec6c21e798a10bca89419ca833af8ae0d249..90652c6629998439a2b9a1e24b1a61cf8ed65d69 100644 (file)
 #define CONFIG_SYS_MMC_ENV_DEV         1
 
 #define CONFIG_OF_LIBFDT
+#define CONFIG_CMD_BOOTZ
 
 #define CONFIG_SYS_DCACHE_OFF
 
index 3f7e51d877cd3032b4c4e1f51f9d3bb053697659..feabc05a475b022e194bf84972f4f9b46c1da350 100644 (file)
@@ -42,6 +42,7 @@
 
 #define CONFIG_ARCH_CPU_INIT
 #define CONFIG_BOARD_EARLY_INIT_F
+#define CONFIG_MISC_INIT_R
 #define CONFIG_MXC_GPIO
 
 #define CONFIG_MXC_UART
 #define CONFIG_CMD_FAT
 #define CONFIG_DOS_PARTITION
 
+#define CONFIG_CMD_SATA
+/*
+ * SATA Configs
+ */
+#ifdef CONFIG_CMD_SATA
+#define CONFIG_DWC_AHSATA
+#define CONFIG_SYS_SATA_MAX_DEVICE     1
+#define CONFIG_DWC_AHSATA_PORT_ID      0
+#define CONFIG_DWC_AHSATA_BASE_ADDR    SATA_ARB_BASE_ADDR
+#define CONFIG_LBA48
+#define CONFIG_LIBATA
+#endif
+
 #define CONFIG_CMD_PING
 #define CONFIG_CMD_DHCP
 #define CONFIG_CMD_MII
 
 #define CONFIG_BOOTDELAY              3
 
+#define CONFIG_PREBOOT                 ""
+
 #define CONFIG_LOADADDR                               0x10800000
 #define CONFIG_SYS_TEXT_BASE          0x17800000
 
 #endif
 
 #define CONFIG_OF_LIBFDT
+#define CONFIG_CMD_BOOTZ
 
 #define CONFIG_SYS_DCACHE_OFF
 
index ddeb4146f756cc096432efe75a7c7501d7177eec..b891ee49255d6649dbf5b6b5d5670cfd883e1f78 100644 (file)
 #define CONFIG_SPL
 #define CONFIG_SPL_NAND_SIMPLE
 #define CONFIG_SPL_TEXT_BASE           0x40200800
-#define CONFIG_SPL_MAX_SIZE            (45 * 1024)
+#define CONFIG_SPL_MAX_SIZE            (54 * 1024)     /* 8 KB for stack */
 #define CONFIG_SPL_STACK               LOW_LEVEL_SRAM_STACK
 
 #define CONFIG_SPL_BSS_START_ADDR      0x80000000
 #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 4910ddaa83b14c9e966aa78d8323440137f779b0..7b21a5c8c4b9ebd76496b87bbbb85f12f3274905 100644 (file)
 /* Defines for SPL */
 #define CONFIG_SPL
 #define CONFIG_SPL_TEXT_BASE           0x40200800
-#define CONFIG_SPL_MAX_SIZE            (45 * 1024)     /* 45 KB */
+#define CONFIG_SPL_MAX_SIZE            (54 * 1024)     /* 8 KB for stack */
 #define CONFIG_SPL_STACK               LOW_LEVEL_SRAM_STACK
 
 #define CONFIG_SPL_BSS_START_ADDR      0x80000000
 #define CONFIG_SPL_BSS_MAX_SIZE                0x80000         /* 512 KB */
 
+#define CONFIG_SPL_BOARD_INIT
 #define CONFIG_SPL_LIBCOMMON_SUPPORT
 #define CONFIG_SPL_LIBDISK_SUPPORT
 #define CONFIG_SPL_I2C_SUPPORT
index 64adc7455c52b3fd18cea5ff09a6cdf5b0a9c257..a0a7a1c42aeeb2f964f1cfce00be64d4d0c7197f 100644 (file)
 #define CONFIG_SPL
 #define CONFIG_SPL_NAND_SIMPLE
 #define CONFIG_SPL_TEXT_BASE           0x40200800
-#define CONFIG_SPL_MAX_SIZE            (45 * 1024)
+#define CONFIG_SPL_MAX_SIZE            (54 * 1024)     /* 8 KB for stack */
 #define CONFIG_SPL_STACK               LOW_LEVEL_SRAM_STACK
 
 /* move malloc and bss high to prevent clashing with the main image */
 #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 4df5f5dac55f41e263d81de20537e7e23987b67e..d02f338437409e088c6ec39427dec5840d74ca20 100644 (file)
        "usbtty=cdc_acm\0" \
        "loadaddr=0x82000000\0" \
        "bootargs=ubi.mtd=4 ubi.mtd=3 root=ubi0:rootfs rootfstype=ubifs " \
-       "rw rootflags=bulk_read console=ttyS0,115200n8 " \
-       "vram=6272K omapfb.vram=0:3000K\0" \
+               "rw rootflags=bulk_read vram=6272K omapfb.vram=0:3000K\0" \
        "mtdparts=" MTDPARTS_DEFAULT "\0" \
 
 #define CONFIG_BOOTCOMMAND \
index a989721afc4eab7ce6f743961e801d5f1303b913..072e17bab8f141270efc2f9c33ff6a948e801d84 100644 (file)
@@ -35,7 +35,6 @@
 #define CONFIG_OMAP            1       /* in a TI OMAP core */
 #define CONFIG_OMAP44XX                1       /* which is a 44XX */
 #define CONFIG_OMAP4430                1       /* which is in a 4430 */
-#define CONFIG_ARCH_CPU_INIT
 
 /* Get CPU defs */
 #include <asm/arch/cpu.h>
 #define CONFIG_GENERIC_MMC             1
 #define CONFIG_MMC                     1
 #define CONFIG_OMAP_HSMMC              1
-#define CONFIG_SYS_MMC_SET_DEV         1
 #define CONFIG_DOS_PARTITION           1
 
 
 #define CONFIG_EXTRA_ENV_SETTINGS \
        "loadaddr=0x82000000\0" \
        "console=ttyO2,115200n8\0" \
+       "fdt_high=0xffffffff\0" \
        "usbtty=cdc_acm\0" \
        "vram=16M\0" \
        "mmcdev=0\0" \
 
 #define CONFIG_SYS_ENABLE_PADS_ALL
 
+#define CONFIG_SYS_THUMB_BUILD
+
 #endif /* __CONFIG_OMAP4_COMMON_H */
index a8dfef321d36ca5668bdb27d7daf4f1773bf6a39..d3a2438e2824ddc106881d6a1f720a0e444bdeed 100644 (file)
@@ -44,8 +44,6 @@
 
 #undef CONFIG_USE_IRQ  /* we don't need IRQ/FIQ stuff */
 
-#define CONFIG_MISC_INIT_R
-
 #define CONFIG_CMDLINE_TAG     1       /* enable passing of ATAGs  */
 #define CONFIG_SETUP_MEMORY_TAGS       1
 #define CONFIG_INITRD_TAG      1       /* Required for ramdisk support */
index 0bdfd6948b002a818d1097560f94c85fce439606..38b5028060ade6a8d311996f49e6af9444300009 100644 (file)
@@ -38,7 +38,6 @@
 #define CONFIG_OMAP54XX        /* which is a 54XX */
 #define CONFIG_OMAP5430        /* which is in a 5430 */
 #define CONFIG_5430EVM /* working with EVM */
-#define CONFIG_ARCH_CPU_INIT
 
 /* Get CPU defs */
 #include <asm/arch/cpu.h>
 #define CONFIG_DRIVER_OMAP34XX_I2C
 #define CONFIG_I2C_MULTI_BUS
 
+/* TWL6035 */
+#ifndef CONFIG_SPL_BUILD
+#define CONFIG_TWL6035_POWER
+#endif
+
 /* MMC */
 #define CONFIG_GENERIC_MMC
 #define CONFIG_MMC
 #define CONFIG_ENV_IS_IN_MMC
 #define CONFIG_SYS_MMC_ENV_DEV         1       /* SLOT2: eMMC(1) */
 #define CONFIG_ENV_OFFSET              0xE0000
+#define CONFIG_CMD_SAVEENV
 
 #define CONFIG_SYS_CONSOLE_IS_IN_ENV
 
index 26e7e1f1e0efd4a6a455066d210c359d0c68bc56..f7900e0d83fcd0b5616bd3862c399e8462806ada 100644 (file)
@@ -49,8 +49,6 @@
 
 #undef CONFIG_USE_IRQ                       /* we don't need IRQ/FIQ stuff */
 
-#define CONFIG_MISC_INIT_R
-
 #define CONFIG_CMDLINE_TAG        1         /* enable passing of ATAGs  */
 #define CONFIG_SETUP_MEMORY_TAGS   1
 
index b322c775a1052775a35bfa7f1d06ba177a83c56d..85993789b9713dd77ec116caed5596de9e6e6bf7 100644 (file)
 # define CONFIG_SYS_NAND_MASK_CLE              (1 << 22)
 # define CONFIG_SYS_NAND_ENABLE_PIN            AT91_PIO_PORTD, 15
 # define CONFIG_SYS_NAND_READY_PIN             AT91_PIO_PORTA, 22
-# define CONFIG_SYS_64BIT_VSPRINTF             /* needed for nand_util.c */
 #endif
 
 /* Ethernet */
index 9f2951d687983d3331ab0ad5035be05e6cf4c4a1..04fd8d07f58a6529e6858f85b3df91cd81327683 100644 (file)
 #define CONFIG_OF_BOARD_SETUP
 #define CONFIG_OF_STDOUT_VIA_ALIAS
 
-#define CONFIG_SYS_64BIT_VSPRINTF
-#define CONFIG_SYS_64BIT_STRTOUL
-
 /* new uImage format support */
 #define CONFIG_FIT
 #define CONFIG_FIT_VERBOSE     /* enable fit_format_{error,warning}() */
index ae075e786ef91848e7a3bf768e34e625e54dc835..46d42281b78d2ee3c53acd503addbfa453e26afa 100644 (file)
 #define __CONFIG_H
 
 #include <asm/sizes.h>
+
+/* LP0 suspend / resume */
+#define CONFIG_TEGRA2_LP0
+#define CONFIG_AES
+#define CONFIG_TEGRA_PMU
+#define CONFIG_TPS6586X_POWER
+#define CONFIG_TEGRA_CLOCK_SCALING
+
 #include "tegra2-common.h"
 
 /* Enable fdt support for Seaboard. Flash the image in u-boot-dtb.bin */
 #define CONFIG_USB_STORAGE
 #define CONFIG_CMD_USB
 
+/* Enable keyboard */
+#define CONFIG_TEGRA2_KEYBOARD
+#define CONFIG_KEYBOARD
+
+#undef TEGRA2_DEVICE_SETTINGS
+#define TEGRA2_DEVICE_SETTINGS "stdin=serial,tegra-kbc\0" \
+                                       "stdout=serial\0" \
+                                       "stderr=serial\0"
 #endif /* __CONFIG_H */
index a79181565e2694dde472821a72acd777a3d4fe11..ab1b33209e369fa790caed83ab8fbcee70d78741 100644 (file)
 #define CONFIG_SYS_BARGSIZE                    CONFIG_SYS_CBSIZE
 #define CONFIG_SYS_LOAD_ADDR                   0x00800000
 #define CONFIG_SYS_CONSOLE_INFO_QUIET          1
-#define CONFIG_SYS_64BIT_VSPRINTF              1
 
 #define CONFIG_EXTRA_ENV_SETTINGS              CONFIG_EXTRA_ENV_USBTTY
 
index 4c4321d2ff3606d700445648eed2dbe9d67a33ff..3fc2c443490283ffb0ec46f7c7399fa5ce19be79 100644 (file)
 
 #define CONFIG_SYS_MAX_NAND_DEVICE     1               /* Max number of */
                                                        /* NAND devices */
-#define CONFIG_SYS_64BIT_VSPRINTF              /* needed for nand_util.c */
 
 #define CONFIG_AUTO_COMPLETE
 
 #define CONFIG_SPL_LDSCRIPT            "$(CPUDIR)/omap-common/u-boot-spl.lds"
 
 #define CONFIG_SPL_TEXT_BASE           0x40200000 /*CONFIG_SYS_SRAM_START*/
-#define CONFIG_SPL_MAX_SIZE            (45 << 10)      /* 45 K */
+#define CONFIG_SPL_MAX_SIZE            (54 * 1024)     /* 8 KB for stack */
 #define CONFIG_SPL_STACK               LOW_LEVEL_SRAM_STACK
 
 #define CONFIG_SYS_SPL_MALLOC_START    0x8f000000
index 837f859c7cccce4326e0440c5a030b0a9224ce28..068ce8855ff6efe49eb2ad3982dba8c94bbe2f0d 100644 (file)
 #define __TEGRA2_COMMON_H
 #include <asm/sizes.h>
 
+/*
+ * QUOTE(m) will evaluate to a string version of the value of the macro m
+ * passed in.  The extra level of indirection here is to first evaluate the
+ * macro m before applying the quoting operator.
+ */
+#define QUOTE_(m)       #m
+#define QUOTE(m)        QUOTE_(m)
+
 /*
  * High Level Configuration Options
  */
 #define CONFIG_CMDLINE_TAG             /* enable passing of ATAGs */
 #define CONFIG_OF_LIBFDT               /* enable passing of devicetree */
 
+#ifdef CONFIG_TEGRA2_LP0
+#define TEGRA_LP0_ADDR                 0x1C406000
+#define TEGRA_LP0_SIZE                 0x2000
+#define TEGRA_LP0_VEC \
+       "lp0_vec=" QUOTE(TEGRA_LP0_SIZE) "@" QUOTE(TEGRA_LP0_ADDR) " "
+#else
+#define TEGRA_LP0_VEC
+#endif
+
 /* Environment */
 #define CONFIG_ENV_SIZE                        0x2000  /* Total Size Environment */
 
 
 #define CONFIG_SYS_NO_FLASH
 
-/* Environment information */
+/* Environment information, boards can override if required */
+#define CONFIG_CONSOLE_MUX
+#define CONFIG_SYS_CONSOLE_IS_IN_ENV
+#define TEGRA2_DEVICE_SETTINGS "stdin=serial\0" \
+                                       "stdout=serial\0" \
+                                       "stderr=serial\0"
+
 #define CONFIG_EXTRA_ENV_SETTINGS \
        "console=ttyS0,115200n8\0" \
        "mem=" TEGRA2_SYSMEM "\0" \
        "smpflag=smp\0" \
+       TEGRA2_DEVICE_SETTINGS
 
 #define CONFIG_LOADADDR                0x408000        /* def. location for kernel */
 #define CONFIG_BOOTDELAY       2               /* -1 to disable auto boot */
index 10f11d95792edb04389b2a3f90d55cd4eaac09d2..5f913ca9ac0309bacc8e6499a257609e0da6516e 100644 (file)
@@ -53,7 +53,6 @@
 
 #define CONFIG_SETUP_MEMORY_TAGS
 #define CONFIG_CMDLINE_TAG
-#define CONFIG_INITRD_TAG
 #define CONFIG_REVISION_TAG
 #define CONFIG_CMDLINE_EDITING
 #define CONFIG_SKIP_LOWLEVEL_INIT
 /* TRATS has 2 banks of DRAM */
 #define CONFIG_NR_DRAM_BANKS   2
 #define PHYS_SDRAM_1           CONFIG_SYS_SDRAM_BASE   /* LDDDR2 DMC 0 */
-#define PHYS_SDRAM_1_SIZE      (256 << 20)             /* 256 MB in CS 0 */
+#define PHYS_SDRAM_1_SIZE      (512 << 20)             /* 512 MB in CS 0 */
 #define PHYS_SDRAM_2           0x50000000              /* LPDDR2 DMC 1 */
-#define PHYS_SDRAM_2_SIZE      (256 << 20)             /* 256 MB in CS 0 */
+#define PHYS_SDRAM_2_SIZE      (512 << 20)             /* 512 MB in CS 0 */
 
 #define CONFIG_SYS_MEM_TOP_HIDE                (1 << 20)       /* ram console */
 
 
 #define CONFIG_PMIC
 #define CONFIG_PMIC_I2C
-#define CONFIG_PMIC_MAX8998
+#define CONFIG_PMIC_MAX8997
 
 #define CONFIG_USB_GADGET
 #define CONFIG_USB_GADGET_S3C_UDC_OTG
 #define CONFIG_USB_GADGET_DUALSPEED
 
+/* LCD */
+#define CONFIG_EXYNOS_FB
+#define CONFIG_LCD
+#define CONFIG_FB_ADDR         0x52504000
+#define CONFIG_S6E8AX0
+#define CONFIG_EXYNOS_MIPI_DSIM
+#define CONFIG_SYS_VIDEO_LOGO_MAX_SIZE (1280 * 720 * 4)
+
 #endif /* __CONFIG_H */
index 801a24fd889da79a40f89e7358159af617eae1d3..9955fca4768064b2e58bbe5a02d1cdccdd834ec9 100644 (file)
 #define CONFIG_SPL
 #define CONFIG_SPL_NAND_SIMPLE
 
+#define CONFIG_SPL_BOARD_INIT
 #define CONFIG_SPL_LIBCOMMON_SUPPORT
 #define CONFIG_SPL_LIBDISK_SUPPORT
 #define CONFIG_SPL_I2C_SUPPORT
 #define CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR 0x300 /* address 0x60000 */
 
 #define CONFIG_SPL_TEXT_BASE           0x40200000 /*CONFIG_SYS_SRAM_START*/
-#define CONFIG_SPL_MAX_SIZE            0xB400  /* 45 K */
+#define CONFIG_SPL_MAX_SIZE            (54 * 1024)     /* 8 KB for stack */
 #define CONFIG_SPL_STACK               LOW_LEVEL_SRAM_STACK
 
 #define CONFIG_SPL_BSS_START_ADDR      0x80000000 /*CONFIG_SYS_SDRAM_BASE*/
diff --git a/include/configs/triton320.h b/include/configs/triton320.h
new file mode 100644 (file)
index 0000000..5af7c1a
--- /dev/null
@@ -0,0 +1,266 @@
+/*
+ * (C) Copyright 2002
+ * Kyle Harris, Nexus Technologies, Inc. kharris@nexus-tech.net
+ *
+ * (C) Copyright 2002
+ * Sysgo Real-Time Solutions, GmbH <www.elinos.com>
+ * Marius Groeger <mgroeger@sysgo.de>
+ *
+ * Configuation settings for the TRITON320 board.
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.         See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+#ifndef __CONFIG_H
+#define __CONFIG_H
+
+/*
+ * High Level Configuration Options
+ * (easy to change)
+ */
+#define CONFIG_CPU_MONAHANS    1       /* Intel Monahan CPU    */
+#define CONFIG_TRITON320       1       /* Zylonite board       */
+
+/* #define CONFIG_LCD          1 */
+#ifdef CONFIG_LCD
+#define CONFIG_SHARP_LM8V31
+#endif
+/* #define CONFIG_MMC          1 */
+#define BOARD_LATE_INIT                1
+
+#define CONFIG_SKIP_RELOCATE_UBOOT     1
+#undef CONFIG_SKIP_LOWLEVEL_INIT  
+#undef CONFIG_USE_IRQ                  /* we don't need IRQ/FIQ stuff */
+
+/*
+ * Size of malloc() pool
+ */
+#define CFG_MALLOC_LEN     (CFG_ENV_SIZE + 256*1024)
+#define CFG_GBL_DATA_SIZE      512     /* size in bytes reserved for initial data */
+
+/*
+ * Hardware drivers
+ */
+
+
+#define CONFIG_DRIVER_DM9000           1
+#define CONFIG_DM9000_BASE             0x10000300
+#define DM9000_IO                      CONFIG_DM9000_BASE
+#define DM9000_DATA                    (CONFIG_DM9000_BASE+0x8000)
+#define CONFIG_DM9000_USE_16BIT
+
+
+
+/*
+ * select serial console configuration
+ */
+#define CONFIG_FFUART         1
+
+/* allow to overwrite serial and ethaddr */
+#define CONFIG_ENV_OVERWRITE
+
+#define CONFIG_BAUDRATE                38400
+
+#if 0
+# define CONFIG_COMMANDS       CFG_CMD_AUTOSCRIPT      \
+               |       CFG_CMD_BDI             \
+               |       CFG_CMD_BOOTD           \
+               |       CFG_CMD_CONSOLE         \
+               |       CFG_CMD_ECHO            \
+               |       CFG_CMD_ENV             \
+               |       CFG_CMD_IMI             \
+               |       CFG_CMD_ITEST           \
+               |       CFG_CMD_LOADB           \
+               |       CFG_CMD_LOADS           \
+               |       CFG_CMD_MEMORY          \
+               |       CFG_CMD_NAND            \
+               |       CFG_CMD_REGINFO         \
+               |       CFG_CMD_RUN     \
+               &       ~(CFG_CMD_JFFS2 | CFG_CMD_FLASH | CFG_CMD_IMLS)
+#endif
+
+#define CONFIG_COMMANDS        ((CONFIG_CMD_DFL|       \
+                        CFG_CMD_NAND   |       \
+                        CFG_CMD_JFFS2  |       \
+                        CFG_CMD_PING   |       \
+                        CFG_CMD_DHCP)  &       \
+                       ~(CFG_CMD_FLASH |       \
+                         CFG_CMD_IMLS))
+
+/* this must be included AFTER the definition of CONFIG_COMMANDS (if any) */
+#include <cmd_confdefs.h>
+
+#define CONFIG_BOOTDELAY                       3
+#define CONFIG_BOOTCOMMAND                     "bootm 80000"
+#define CONFIG_BOOTARGS                                "root=/dev/mtdblock1 rootfstype=jffs2 console=ttyS0,38400"
+#define CONFIG_BOOT_RETRY_TIME         -1
+#define CONFIG_BOOT_RETRY_MIN          60
+#define CONFIG_RESET_TO_RETRY
+#define CONFIG_AUTOBOOT_PROMPT         "autoboot in %d seconds\n"
+#define CONFIG_AUTOBOOT_DELAY_STR      " "
+#define CONFIG_AUTOBOOT_STOP_STR       "system"
+
+#define CONFIG_ETHADDR                 ff:ff:ff:ff:ff:ff
+#define CONFIG_NETMASK                 255.255.255.255
+#define CONFIG_IPADDR                  0.0.0.0
+#define CONFIG_SERVERIP                        0.0.0.0
+#define CONFIG_CMDLINE_TAG             1
+#define CONFIG_SETUP_MEMORY_TAGS       1
+#define CONFIG_CMDLINE_EDITING
+#define CONFIG_TIMESTAMP
+#define CONFIG_USE_MAC_FROM_ENV
+
+#if (CONFIG_COMMANDS & CFG_CMD_KGDB)
+#define CONFIG_KGDB_BAUDRATE   230400          /* speed to run kgdb serial port */
+#define CONFIG_KGDB_SER_INDEX  2               /* which serial port to use */
+#endif
+
+/*
+ * Miscellaneous configurable options
+ */
+#define CFG_HUSH_PARSER                1
+#define CFG_PROMPT_HUSH_PS2    "> "
+
+#define CFG_LONGHELP                           /* undef to save memory         */
+#ifdef CFG_HUSH_PARSER
+#define CFG_PROMPT             "$ "            /* Monitor Command Prompt */
+#else
+#define CFG_PROMPT             "=> "           /* Monitor Command Prompt */
+#endif
+#define CFG_CBSIZE             256             /* Console I/O Buffer Size      */
+#define CFG_PBSIZE (CFG_CBSIZE+sizeof(CFG_PROMPT)+16) /* Print Buffer Size */
+#define CFG_MAXARGS            16              /* max number of command args   */
+#define CFG_BARGSIZE           CFG_CBSIZE      /* Boot Argument Buffer Size    */
+#define CFG_DEVICE_NULLDEV     1
+
+#define CFG_MEMTEST_START      0x00400000      /* memtest works on     */
+#define CFG_MEMTEST_END                0x00800000      /* 4 ... 8 MB in DRAM   */
+
+#undef CFG_CLKS_IN_HZ          /* everything, incl board info, in Hz */
+
+#define CFG_HZ                 3250000         /* incrementer freq: 3.25 MHz */
+
+/* Monahans Core Frequency */
+#define CFG_MONAHANS_RUN_MODE_OSC_RATIO                31 /* valid values: 8, 16, 24, 31 */
+#define CFG_MONAHANS_TURBO_RUN_MODE_RATIO      2  /* valid values: 1, 2 */
+
+                                               /* valid baudrates */
+#define CFG_BAUDRATE_TABLE     { 9600, 19200, 38400, 57600, 115200 }
+
+/* #define CFG_MMC_BASE                0xF0000000 */
+
+/*
+ * Stack sizes
+ *
+ * The stack sizes are set up in start.S using the settings below
+ */
+#define CONFIG_STACKSIZE       (128*1024)      /* regular stack */
+#ifdef CONFIG_USE_IRQ
+#define CONFIG_STACKSIZE_IRQ   (4*1024)        /* IRQ stack */
+#define CONFIG_STACKSIZE_FIQ   (4*1024)        /* FIQ stack */
+#endif
+
+/*
+ * Physical Memory Map
+ */
+#define CONFIG_NR_DRAM_BANKS   1          /* we have 1 banks of DRAM */
+#define PHYS_SDRAM_1           0x80000000 /* SDRAM Bank #1 */
+#define PHYS_SDRAM_1_SIZE      0x04000000 /* 64 MB */
+
+#define CFG_DRAM_BASE          PHYS_SDRAM_1
+#define CFG_DRAM_SIZE          PHYS_SDRAM_1_SIZE
+
+
+#define CFG_LOAD_ADDR          (PHYS_SDRAM_1 + 0x100000) /* default load address */
+
+#define CFG_SKIP_DRAM_SCRUB
+
+/*
+ * NAND Flash
+ */
+/* Use the new NAND code. (BOARDLIBS = drivers/nand/libnand.a required) */
+#define CONFIG_NEW_NAND_CODE
+#define CFG_NAND0_BASE         0x0
+#undef CFG_NAND1_BASE
+
+#define CONFIG_MTD_NAND_ECC_JFFS2 1
+
+#define CFG_NAND_BASE_LIST     { CFG_NAND0_BASE }
+#define CFG_MAX_NAND_DEVICE    1       /* Max number of NAND devices */
+
+/* nand timeout values */
+#define CFG_NAND_PROG_ERASE_TO 9000
+#define CFG_NAND_OTHER_TO      2000
+#define CFG_NAND_SENDCMD_RETRY 3
+#undef NAND_ALLOW_ERASE_ALL    /* Allow erasing bad blocks - don't use */
+
+/* NAND Timing Parameters (in ns) */
+#define NAND_TIMING_tCH                10
+#define NAND_TIMING_tCS                0
+#define NAND_TIMING_tWH                20
+#define NAND_TIMING_tWP                40
+
+#define NAND_TIMING_tRH                20
+#define NAND_TIMING_tRP                40
+
+#define NAND_TIMING_tR         11123
+#define NAND_TIMING_tWHR       100
+#define NAND_TIMING_tAR                10
+
+/* NAND debugging */
+#if 0
+#define        CFG_DFC_DEBUG1          /* useful */
+#define                CFG_DFC_DEBUG2          /* noisy */
+#define        CFG_DFC_DEBUG3          /* extremly noisy  */
+#else
+#undef         CFG_DFC_DEBUG1          /* useful */
+#undef         CFG_DFC_DEBUG2          /* noisy */
+#undef         CFG_DFC_DEBUG3          /* extremly noisy  */
+#endif
+
+#define CONFIG_MTD_DEBUG       0
+#define CONFIG_MTD_DEBUG_VERBOSE 0
+
+#define ADDR_COLUMN            1
+#define ADDR_PAGE              2
+#define ADDR_COLUMN_PAGE       3
+
+#define NAND_ChipID_UNKNOWN    0x00
+#define NAND_MAX_FLOORS                1
+#define NAND_MAX_CHIPS         1
+
+#define CFG_NO_FLASH           1
+
+#define CFG_ENV_IS_IN_NAND     1
+#define CFG_ENV_OFFSET         0x60000
+#undef CFG_ENV_OFFSET_REDUND
+#define CFG_ENV_SIZE           0x20000
+
+#define CONFIG_JFFS2_NAND 1
+#define CONFIG_JFFS2_NAND_DEV "nand0"                  /* nand device jffs2 lives on */
+#define CONFIG_JFFS2_NAND_OFF 0x80000                  /* start of jffs2 partition */
+#define CONFIG_JFFS2_NAND_SIZE 64*1024*1024            /* size of jffs2 partition */
+
+
+/* mtdparts command line support */
+#define CONFIG_JFFS2_CMDLINE
+#define MTDIDS_DEFAULT         "nand0=triton320-nand"
+#define MTDPARTS_DEFAULT       "mtdparts=triton320-nand:128k(sbootl),256k(u-boot),128k(env),2m(linux_kernel),83456k(userfs),32m(wince);" 
+
+#endif /* __CONFIG_H */
index 87bd8a6756ca98e2948a6bb2b91182a6b148e559..3dfafa50775efb861189293c464c343b2384f80a 100644 (file)
 #define CONFIG_MXC_NAND_HWECC
 #define CONFIG_SYS_NAND_LARGEPAGE
 
-#define CONFIG_SYS_64BIT_VSPRINTF
-
 /* U-Boot general configuration */
 #define CONFIG_SYS_PROMPT      "=> "   /* Monitor Command Prompt */
 #define CONFIG_SYS_CBSIZE      1024    /* Console I/O Buffer Size  */
diff --git a/include/configs/tx28.h b/include/configs/tx28.h
new file mode 100644 (file)
index 0000000..452ced4
--- /dev/null
@@ -0,0 +1,288 @@
+/*
+ * Copyright (C) 2012 <LW@KARO-electronics.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 version 2.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT 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 __TX28_H
+#define __TX28_H
+
+#include <config.h>
+#include <asm/sizes.h>
+#include <asm/arch/regs-base.h>
+
+/*
+ * Ka-Ro TX28 board - SoC configuration
+ */
+#define CONFIG_MX28                            /* i.MX28 SoC */
+#define CONFIG_MXS_GPIO                                /* GPIO control */
+#define CONFIG_SYS_HZ          1000            /* Ticks per second */
+#ifdef CONFIG_TX28_S
+#define PHYS_SDRAM_1_SIZE      SZ_64M
+#define TX28_MOD_SUFFIX                "1"
+#else
+#define PHYS_SDRAM_1_SIZE      SZ_128M
+#define CONFIG_SYS_SPL_FIXED_BATT_SUPPLY
+#define TX28_MOD_SUFFIX                "0"
+#endif
+
+#ifndef CONFIG_SPL_BUILD
+#define CONFIG_SKIP_LOWLEVEL_INIT
+#define CONFIG_SHOW_ACTIVITY
+#define CONFIG_ARCH_CPU_INIT
+#define CONFIG_DISPLAY_CPUINFO
+#define CONFIG_BOARD_LATE_INIT
+#define CONFIG_BOARD_EARLY_INIT_F
+
+/* LCD Logo and Splash screen support */
+#define CONFIG_LCD
+#ifdef CONFIG_LCD
+#define CONFIG_SPLASH_SCREEN
+#define CONFIG_SPLASH_SCREEN_ALIGN
+#define CONFIG_VIDEO_MXS
+#define CONFIG_LCD_LOGO
+#define LCD_BPP                                LCD_COLOR24
+#define CONFIG_CMD_BMP
+#define CONFIG_VIDEO_BMP_RLE8
+#endif /* CONFIG_LCD */
+#endif /* CONFIG_SPL_BUILD */
+
+/*
+ * Memory configuration options
+ */
+#define CONFIG_NR_DRAM_BANKS           1               /* 1 bank of SDRAM */
+#define PHYS_SDRAM_1                   0x40000000      /* SDRAM Bank #1 */
+#define CONFIG_STACKSIZE               SZ_64K
+#define CONFIG_SYS_MALLOC_LEN          SZ_4M
+#define CONFIG_SYS_MEMTEST_START       PHYS_SDRAM_1    /* Memtest start address */
+#define CONFIG_SYS_MEMTEST_END         (CONFIG_SYS_MEMTEST_START + SZ_4M)
+
+/*
+ * U-Boot general configurations
+ */
+#define CONFIG_SYS_LONGHELP
+#define CONFIG_SYS_PROMPT      "TX28 U-Boot > "
+#define CONFIG_SYS_CBSIZE      2048            /* Console I/O buffer size */
+#define CONFIG_SYS_PBSIZE \
+       (CONFIG_SYS_CBSIZE + sizeof(CONFIG_SYS_PROMPT) + 16)
+                                               /* Print buffer size */
+#define CONFIG_SYS_MAXARGS     64              /* Max number of command args */
+#define CONFIG_SYS_BARGSIZE    CONFIG_SYS_CBSIZE
+                                               /* Boot argument buffer size */
+#define CONFIG_VERSION_VARIABLE                        /* U-BOOT version */
+#define CONFIG_AUTO_COMPLETE                   /* Command auto complete */
+#define CONFIG_CMDLINE_EDITING                 /* Command history etc */
+
+#define CONFIG_SYS_64BIT_VSPRINTF
+#define CONFIG_SYS_NO_FLASH
+
+/*
+ * Flattened Device Tree (FDT) support
+*/
+#define CONFIG_OF_LIBFDT
+#ifdef CONFIG_OF_LIBFDT
+#define CONFIG_FDT_FIXUP_PARTITIONS
+#define CONFIG_OF_EMBED
+#define CONFIG_OF_BOARD_SETUP
+#define CONFIG_DEFAULT_DEVICE_TREE     tx28
+#define CONFIG_ARCH_DEVICE_TREE                mx28
+#endif
+
+/*
+ * Boot Linux
+ */
+#define xstr(s)        str(s)
+#define str(s) #s
+#define __pfx(x, s)    (x##s)
+#define _pfx(x, s)     __pfx(x, s)
+
+#define CONFIG_CMDLINE_TAG
+#define CONFIG_SETUP_MEMORY_TAGS
+#define CONFIG_BOOTDELAY       3
+#define CONFIG_ZERO_BOOTDELAY_CHECK
+#define CONFIG_SYS_AUTOLOAD    "no"
+#define CONFIG_BOOTFILE                "uImage"
+#define CONFIG_BOOTARGS                "console=ttyAMA0,115200 ro debug panic=1"
+#define CONFIG_BOOTCOMMAND     "run bootcmd_nand"
+#define CONFIG_LOADADDR                43000000
+#define CONFIG_SYS_LOAD_ADDR   _pfx(0x, CONFIG_LOADADDR)
+#define CONFIG_U_BOOT_IMG_SIZE SZ_1M
+
+/*
+ * Extra Environments
+ */
+#define CONFIG_EXTRA_ENV_SETTINGS                                      \
+       "autostart=no\0"                                                \
+       "baseboard=stk5-v3\0"                                           \
+       "bootargs_mmc=run default_bootargs;set bootargs ${bootargs}"    \
+       " root=/dev/mmcblk0p3 rootwait\0"                               \
+       "bootargs_nand=run default_bootargs;set bootargs ${bootargs}"   \
+       " root=/dev/mtdblock3 rootfstype=jffs2\0"                       \
+       "nfsroot=/tftpboot/rootfs\0"                                    \
+       "bootargs_nfs=run default_bootargs;set bootargs ${bootargs}"    \
+       " root=/dev/nfs ip=dhcp nfsroot=${serverip}:${nfsroot},nolock\0"\
+       "bootcmd_mmc=set autostart no;run bootargs_mmc;"                \
+       " fatload mmc 0 ${loadaddr} uImage;run bootm_cmd\0"             \
+       "bootcmd_nand=set autostart no;run bootargs_nand;"              \
+       " nboot linux;run bootm_cmd\0"                                  \
+       "bootcmd_net=set autostart no;run bootargs_nfs;dhcp;"           \
+       " run bootm_cmd\0"                                              \
+       "bootm_cmd=fdt boardsetup;bootm ${loadaddr} - ${fdtaddr}\0"     \
+       "default_bootargs=set bootargs " CONFIG_BOOTARGS                \
+       " mxsfb.mode=${video_mode} ${append_bootargs}\0"                \
+       "fdtaddr=41000000\0"                                            \
+       "mtdids=" MTDIDS_DEFAULT "\0"                                   \
+       "mtdparts=" MTDPARTS_DEFAULT "\0"                               \
+       "otg_mode=device\0"                                             \
+       "touchpanel=tsc2007\0"                                          \
+       "video_mode=VGA\0"
+
+#define MTD_NAME                       "gpmi-nand"
+#define MTDIDS_DEFAULT                 "nand0=" MTD_NAME
+
+/*
+ * U-Boot Commands
+ */
+#include <config_cmd_default.h>
+#define CONFIG_CMD_CACHE
+#define CONFIG_CMD_MMC
+#define CONFIG_CMD_NAND
+#define CONFIG_CMD_MTDPARTS
+#define CONFIG_CMD_BOOTCE
+#define CONFIG_CMD_TIME
+
+/*
+ * Serial Driver
+ */
+#define CONFIG_PL011_SERIAL
+#define CONFIG_PL011_CLOCK             24000000
+#define CONFIG_PL01x_PORTS     {       \
+       (void *)MXS_UARTDBG_BASE,       \
+       }
+#define CONFIG_CONS_INDEX              0               /* do not change! */
+#define CONFIG_BAUDRATE                        115200          /* Default baud rate */
+#define CONFIG_SYS_BAUDRATE_TABLE      { 9600, 19200, 38400, 57600, 115200, }
+#define CONFIG_SYS_CONSOLE_INFO_QUIET
+
+/*
+ * Ethernet Driver
+ */
+#define CONFIG_FEC_MXC
+#ifdef CONFIG_FEC_MXC
+/* This is required for the FEC driver to work with cache enabled */
+#define CONFIG_SYS_ARM_CACHE_WRITETHROUGH
+
+#ifndef CONFIG_TX28_S
+#define CONFIG_FEC_MXC_MULTI
+#else
+#define IMX_FEC_BASE                   MXS_ENET0_BASE
+#define CONFIG_FEC_MXC_PHYADDR         0x00
+#endif
+
+#define CONFIG_MII
+#define CONFIG_FEC_XCV_TYPE            RMII
+#define CONFIG_GET_FEC_MAC_ADDR_FROM_IIM
+#define CONFIG_NET_MULTI
+#define CONFIG_CMD_MII
+#define CONFIG_CMD_DHCP
+#define CONFIG_CMD_PING
+/* Add for working with "strict" DHCP server */
+#define CONFIG_BOOTP_SUBNETMASK
+#define CONFIG_BOOTP_GATEWAY
+#define CONFIG_BOOTP_DNS
+#endif
+
+/*
+ * NAND flash driver
+ */
+#ifdef CONFIG_CMD_NAND
+#define CONFIG_MTD_DEVICE
+#define CONFIG_ENV_IS_IN_NAND
+#define CONFIG_NAND_MXS
+#define CONFIG_APBH_DMA
+#define CONFIG_APBH_DMA_BURST
+#define CONFIG_APBH_DMA_BURST8
+#define CONFIG_SYS_NAND_U_BOOT_OFFS    0x20000
+#define CONFIG_CMD_NAND_TRIMFFS
+#define CONFIG_SYS_MXS_DMA_CHANNEL     4
+#define CONFIG_SYS_MAX_FLASH_SECT      1024
+#define CONFIG_SYS_MAX_FLASH_BANKS     1
+#define CONFIG_SYS_NAND_MAX_CHIPS      1
+#define CONFIG_SYS_MAX_NAND_DEVICE     1
+#define CONFIG_SYS_NAND_5_ADDR_CYCLE
+#define CONFIG_SYS_NAND_USE_FLASH_BBT
+#ifdef CONFIG_ENV_IS_IN_NAND
+#define CONFIG_ENV_OVERWRITE
+#define CONFIG_ENV_OFFSET              (CONFIG_U_BOOT_IMG_SIZE + CONFIG_SYS_NAND_U_BOOT_OFFS)
+#define CONFIG_ENV_SIZE                        SZ_128K
+#define CONFIG_ENV_RANGE               0x60000
+#endif /* CONFIG_ENV_IS_IN_NAND */
+#define CONFIG_SYS_NAND_BASE           0x00000000
+#define CONFIG_CMD_ROMUPDATE
+#endif /* CONFIG_CMD_NAND */
+
+/*
+ * MMC Driver
+ */
+#ifdef CONFIG_CMD_MMC
+#ifndef CONFIG_ENV_IS_IN_NAND
+#define CONFIG_ENV_IS_IN_MMC
+#endif
+#define CONFIG_MMC
+#define CONFIG_GENERIC_MMC
+#define CONFIG_MXS_MMC
+
+#define CONFIG_DOS_PARTITION
+#define CONFIG_CMD_FAT
+#define CONFIG_CMD_EXT2
+
+/*
+ * Environments on MMC
+ */
+#ifdef CONFIG_ENV_IS_IN_MMC
+#define CONFIG_SYS_MMC_ENV_DEV 0
+#define CONFIG_ENV_OVERWRITE
+/* Associated with the MMC layout defined in mmcops.c */
+#define CONFIG_ENV_OFFSET              SZ_1K
+#define CONFIG_ENV_SIZE                        (SZ_128K - CONFIG_ENV_OFFSET)
+#define CONFIG_DYNAMIC_MMC_DEVNO
+#endif /* CONFIG_ENV_IS_IN_MMC */
+#endif /* CONFIG_CMD_MMC */
+
+#ifdef CONFIG_ENV_OFFSET_REDUND
+#define MTDPARTS_DEFAULT               "mtdparts=" MTD_NAME ":"        \
+       "1m@" xstr(CONFIG_SYS_NAND_U_BOOT_OFFS) "(u-boot),"                     \
+       xstr(CONFIG_ENV_RANGE)                                          \
+       "(env),"                                                        \
+       xstr(CONFIG_ENV_RANGE)                                          \
+       "(env2),4m(linux),16m(rootfs),256k(dtb),-(userfs)"
+#else
+#define MTDPARTS_DEFAULT               "mtdparts=" MTD_NAME ":"        \
+       "1m@" xstr(CONFIG_SYS_NAND_U_BOOT_OFFS) "(u-boot),"                     \
+       xstr(CONFIG_ENV_RANGE)                                          \
+       "(env),4m(linux),16m(rootfs),256k(dtb),-(userfs)"
+#endif
+
+#define CONFIG_SYS_SDRAM_BASE          PHYS_SDRAM_1
+#define CONFIG_SYS_INIT_SP_ADDR                (CONFIG_SYS_SDRAM_BASE + 0x1000 - /* Fix this */ \
+                                       GENERATED_GBL_DATA_SIZE)
+
+/* Defines for SPL */
+#define CONFIG_SPL
+#define CONFIG_SPL_NO_CPU_SUPPORT_CODE
+#define CONFIG_SPL_START_S_PATH        "arch/arm/cpu/arm926ejs/mx28"
+#define CONFIG_SPL_LDSCRIPT    "arch/arm/cpu/arm926ejs/mx28/u-boot-spl.lds"
+#define CONFIG_SPL_LIBCOMMON_SUPPORT
+#define CONFIG_SPL_LIBGENERIC_SUPPORT
+#define CONFIG_SPL_SERIAL_SUPPORT
+#define CONFIG_SPL_GPIO_SUPPORT
+#define CONFIG_SYS_SPL_VDDD_VAL                1500
+#define CONFIG_SYS_SPL_BATT_BO_LEVEL   2800
+
+#endif /* __CONFIG_H */
diff --git a/include/configs/tx48.h b/include/configs/tx48.h
new file mode 100644 (file)
index 0000000..96df26c
--- /dev/null
@@ -0,0 +1,347 @@
+/*
+ * tx48.h
+ *
+ * Copyright (C) 2012 Lothar Waßmann <LW@KARO-electronics.de>
+ *
+ * based on: am335x_evm
+ * Copyright (C) 2011 Texas Instruments Incorporated - http://www.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 version 2.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT 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 __TX48_H
+#define __TX48_H
+
+#include <config.h>
+#include <asm/sizes.h>
+
+/*
+ * Ka-Ro TX48 board - SoC configuration
+ */
+#define CONFIG_AM33XX
+#define CONFIG_AM33XX_GPIO
+#define CONFIG_SYS_HZ                  1000            /* Ticks per second */
+
+#ifndef CONFIG_SPL_BUILD
+#define CONFIG_SKIP_LOWLEVEL_INIT
+#define CONFIG_SHOW_ACTIVITY
+#define CONFIG_DISPLAY_CPUINFO
+#define CONFIG_DISPLAY_BOARDINFO
+#define CONFIG_BOARD_LATE_INIT
+
+/* LCD Logo and Splash screen support */
+#define CONFIG_LCD
+#ifdef CONFIG_LCD
+#define CONFIG_SPLASH_SCREEN
+#define CONFIG_SPLASH_SCREEN_ALIGN
+#define CONFIG_VIDEO_DA8XX
+#define DAVINCI_LCD_CNTL_BASE          0x4830e000
+#define CONFIG_LCD_LOGO
+#define LCD_BPP                                LCD_COLOR24
+#define CONFIG_CMD_BMP
+#define CONFIG_VIDEO_BMP_RLE8
+#endif /* CONFIG_LCD */
+#endif /* CONFIG_SPL_BUILD */
+
+/* Clock Defines */
+#define V_OSCK                         24000000  /* Clock output from T2 */
+#define V_SCLK                         V_OSCK
+
+/*
+ * Memory configuration options
+ */
+#define CONFIG_SYS_SDRAM_DDR3
+#define CONFIG_NR_DRAM_BANKS           1               /*  1 bank of SDRAM */
+#define PHYS_SDRAM_1                   0x80000000      /* SDRAM Bank #1 */
+#define CONFIG_MAX_RAM_BANK_SIZE       SZ_1G
+
+#define CONFIG_STACKSIZE               SZ_64K
+#define CONFIG_SYS_MALLOC_LEN          SZ_4M
+
+#define CONFIG_SYS_MEMTEST_START       (PHYS_SDRAM_1 + SZ_64M)
+#define CONFIG_SYS_MEMTEST_END         (CONFIG_SYS_MEMTEST_START + SZ_8M)
+
+/*
+ * U-Boot general configurations
+ */
+#define CONFIG_SYS_LONGHELP
+#define CONFIG_SYS_PROMPT      "TX48 U-Boot > "
+#define CONFIG_SYS_CBSIZE      2048            /* Console I/O buffer size */
+#define CONFIG_SYS_PBSIZE \
+       (CONFIG_SYS_CBSIZE + sizeof(CONFIG_SYS_PROMPT) + 16)
+                                               /* Print buffer size */
+#define CONFIG_SYS_MAXARGS     64              /* Max number of command args */
+#define CONFIG_SYS_BARGSIZE    CONFIG_SYS_CBSIZE
+                                               /* Boot argument buffer size */
+#define CONFIG_VERSION_VARIABLE                        /* U-BOOT version */
+#define CONFIG_AUTO_COMPLETE                   /* Command auto complete */
+#define CONFIG_CMDLINE_EDITING                 /* Command history etc */
+
+#define CONFIG_SYS_64BIT_VSPRINTF
+#define CONFIG_SYS_NO_FLASH
+
+/*
+ * Flattened Device Tree (FDT) support
+*/
+#ifdef CONFIG_OF_LIBFDT /* set via cmdline parameter thru boards.cfg */
+#define CONFIG_FDT_FIXUP_PARTITIONS
+#define CONFIG_OF_EMBED
+#define CONFIG_OF_BOARD_SETUP
+#define CONFIG_DEFAULT_DEVICE_TREE     tx48
+#define CONFIG_ARCH_DEVICE_TREE                am33xx
+#define CONFIG_MACH_TYPE               (-1)
+#else
+#ifndef MACH_TYPE_TIAM335EVM
+#define MACH_TYPE_TIAM335EVM            3589    /* Until the next sync */
+#endif
+#define CONFIG_MACH_TYPE        MACH_TYPE_TIAM335EVM
+#endif
+
+/*
+ * Boot Linux
+ */
+#define xstr(s)        str(s)
+#define str(s) #s
+#define __pfx(x, s)    (x##s)
+#define _pfx(x, s)     __pfx(x, s)
+
+#define CONFIG_CMDLINE_TAG
+#define CONFIG_SETUP_MEMORY_TAGS
+#define CONFIG_BOOTDELAY       3
+#define CONFIG_ZERO_BOOTDELAY_CHECK
+#define CONFIG_SYS_AUTOLOAD    "no"
+#define CONFIG_BOOTFILE                "uImage"
+#define CONFIG_BOOTARGS                "console=ttyO0,115200 ro debug panic=1"
+#define CONFIG_BOOTCOMMAND     "run bootcmd_nand"
+#define CONFIG_LOADADDR                83000000
+#define CONFIG_SYS_LOAD_ADDR   _pfx(0x, CONFIG_LOADADDR)
+#define CONFIG_U_BOOT_IMG_SIZE SZ_1M
+#define CONFIG_HW_WATCHDOG
+
+/*
+ * Extra Environments
+ */
+#ifdef CONFIG_OF_LIBFDT
+#define TX48_BOOTM_CMD                                                 \
+       "bootm_cmd=fdt boardsetup;bootm ${loadaddr} - ${fdtaddr}\0"
+#define TX48_MTDPARTS_CMD ""
+#else
+#define TX48_BOOTM_CMD                                                 \
+       "bootm_cmd=bootm\0"
+#define TX48_MTDPARTS_CMD "${mtdparts} "
+#endif
+
+#define CONFIG_EXTRA_ENV_SETTINGS                                      \
+       "autostart=no\0"                                                \
+       "baseboard=stk5-v3\0"                                           \
+       "bootargs_mmc=run default_bootargs;set bootargs ${bootargs}"    \
+       " root=/dev/mmcblk0p2 rootwait\0"                               \
+       "bootargs_nand=run default_bootargs;set bootargs ${bootargs}"   \
+       " root=/dev/mtdblock4 rootfstype=jffs2\0"                       \
+       "nfsroot=/tftpboot/rootfs\0"                                    \
+       "bootargs_nfs=run default_bootargs;set bootargs ${bootargs}"    \
+       " root=/dev/nfs ip=dhcp nfsroot=${serverip}:${nfsroot},nolock\0"\
+       "bootcmd_mmc=set autostart no;run bootargs_mmc;"                \
+       " fatload mmc 0 ${loadaddr} uImage;run bootm_cmd\0"             \
+       "bootcmd_nand=set autostart no;run bootargs_nand;"              \
+       " nboot linux;run bootm_cmd\0"                                  \
+       "bootcmd_net=set autostart no;run bootargs_nfs;dhcp;"           \
+       " run bootm_cmd\0"                                              \
+       TX48_BOOTM_CMD                                                  \
+       "default_bootargs=set bootargs " CONFIG_BOOTARGS                \
+       TX48_MTDPARTS_CMD                                               \
+       " video=${video_mode} ${append_bootargs}\0"                     \
+       "cpu_clk=400\0"                                                 \
+       "fdtaddr=81000000\0"                                            \
+       "mtdids=" MTDIDS_DEFAULT "\0"                                   \
+       "mtdparts=" MTDPARTS_DEFAULT "\0"                               \
+       "otg_mode=device\0"                                             \
+       "touchpanel=tsc2007\0"                                          \
+       "video_mode=640x480MR-24@60\0"
+
+#define MTD_NAME                       "omap2-nand.0"
+#define MTDIDS_DEFAULT                 "nand0=" MTD_NAME
+
+/*
+ * U-Boot Commands
+ */
+#include <config_cmd_default.h>
+#define CONFIG_CMD_CACHE
+#define CONFIG_CMD_MMC
+#define CONFIG_CMD_NAND
+#define CONFIG_CMD_MTDPARTS
+#define CONFIG_CMD_BOOTCE
+#define CONFIG_CMD_TIME
+
+/*
+ * Serial Driver
+ */
+#define CONFIG_SYS_NS16550
+#define CONFIG_SYS_NS16550_SERIAL
+#define CONFIG_SYS_NS16550_MEM32
+#define CONFIG_SYS_NS16550_REG_SIZE    (-4)
+#define CONFIG_SYS_NS16550_CLK         48000000
+#define CONFIG_SYS_NS16550_COM1                0x44e09000      /* UART0 */
+#define CONFIG_SYS_NS16550_COM2                0x48022000      /* UART1 */
+#define CONFIG_SYS_NS16550_COM6                0x481aa000      /* UART5 */
+
+#define CONFIG_SYS_NS16550_COM3                0x481aa000      /* UART2 */
+#define CONFIG_SYS_NS16550_COM4                0x481aa000      /* UART3 */
+#define CONFIG_SYS_NS16550_COM5                0x481aa000      /* UART4 */
+#define CONFIG_CONS_INDEX              1               /* one based! */
+#define CONFIG_BAUDRATE                        115200          /* Default baud rate */
+#define CONFIG_SYS_BAUDRATE_TABLE      { 9600, 19200, 38400, 57600, 115200, }
+#define CONFIG_SYS_CONSOLE_INFO_QUIET
+
+/*
+ * Ethernet Driver
+ */
+#ifdef CONFIG_CMD_NET
+#define CONFIG_DRIVER_TI_CPSW
+#define CONFIG_NET_MULTI
+#define CONFIG_PHY_GIGE
+#define CONFIG_MII
+#define CONFIG_CMD_MII
+#define CONFIG_CMD_DHCP
+#define CONFIG_CMD_PING
+/* Add for working with "strict" DHCP server */
+#define CONFIG_BOOTP_SUBNETMASK
+#define CONFIG_BOOTP_GATEWAY
+#define CONFIG_BOOTP_DNS
+#define CONFIG_BOOTP_DNS2
+#endif
+
+/*
+ * NAND flash driver
+ */
+#ifdef CONFIG_CMD_NAND
+#define CONFIG_MTD_DEVICE
+#define CONFIG_ENV_IS_IN_NAND
+#define CONFIG_NAND_AM33XX
+#define GPMC_NAND_ECC_LP_x8_LAYOUT
+#define GPMC_NAND_HW_ECC_LAYOUT_KERNEL GPMC_NAND_HW_ECC_LAYOUT
+#define CONFIG_SYS_NAND_U_BOOT_OFFS    0x20000
+#define CONFIG_SYS_NAND_PAGE_SIZE      2048
+#define CONFIG_SYS_NAND_OOBSIZE                64
+#define CONFIG_SYS_NAND_ECCSIZE                512
+#define CONFIG_SYS_NAND_ECCBYTES       14
+#define CONFIG_CMD_NAND_TRIMFFS
+#define CONFIG_SYS_NAND_MAX_CHIPS      1
+#define CONFIG_SYS_NAND_MAXBAD         20 /* Max. number of bad blocks guaranteed by manufacturer */
+#define CONFIG_SYS_MAX_NAND_DEVICE     1
+#define CONFIG_SYS_NAND_5_ADDR_CYCLE
+#define CONFIG_SYS_NAND_USE_FLASH_BBT
+#ifdef CONFIG_ENV_IS_IN_NAND
+#define CONFIG_ENV_OVERWRITE
+#define CONFIG_ENV_OFFSET              (CONFIG_U_BOOT_IMG_SIZE + CONFIG_SYS_NAND_U_BOOT_OFFS)
+#define CONFIG_ENV_SIZE                        SZ_128K
+#define CONFIG_ENV_RANGE               0x60000
+#endif /* CONFIG_ENV_IS_IN_NAND */
+#define CONFIG_SYS_NAND_BASE           0x08000000 /* must be defined but value is irrelevant */
+#define NAND_BASE                      CONFIG_SYS_NAND_BASE
+#endif /* CONFIG_CMD_NAND */
+
+/*
+ * MMC Driver
+ */
+#ifdef CONFIG_CMD_MMC
+#ifndef CONFIG_ENV_IS_IN_NAND
+#define CONFIG_ENV_IS_IN_MMC
+#endif
+#define CONFIG_MMC
+#define CONFIG_GENERIC_MMC
+#define CONFIG_OMAP_HSMMC
+#define CONFIG_OMAP_MMC_DEV_1
+
+#define CONFIG_DOS_PARTITION
+#define CONFIG_CMD_FAT
+#define CONFIG_CMD_EXT2
+
+/*
+ * Environments on MMC
+ */
+#ifdef CONFIG_ENV_IS_IN_MMC
+#define CONFIG_SYS_MMC_ENV_DEV 0
+#define CONFIG_ENV_OVERWRITE
+/* Associated with the MMC layout defined in mmcops.c */
+#define CONFIG_ENV_OFFSET              SZ_1K
+#define CONFIG_ENV_SIZE                        (SZ_128K - CONFIG_ENV_OFFSET)
+#define CONFIG_DYNAMIC_MMC_DEVNO
+#endif /* CONFIG_ENV_IS_IN_MMC */
+#endif /* CONFIG_CMD_MMC */
+
+#ifdef CONFIG_ENV_OFFSET_REDUND
+#define MTDPARTS_DEFAULT               "mtdparts=" MTD_NAME ":"        \
+       "128k(u-boot-spl),"                                             \
+       "1m(u-boot),"                                                   \
+       xstr(CONFIG_ENV_RANGE)                                          \
+       "(env),"                                                        \
+       xstr(CONFIG_ENV_RANGE)                                          \
+       "(env2),4m(linux),16m(rootfs),256k(dtb),-(userfs)"
+#else
+#define MTDPARTS_DEFAULT               "mtdparts=" MTD_NAME ":"        \
+       "128k(u-boot-spl),"                                             \
+       "1m(u-boot),"                                                   \
+       xstr(CONFIG_ENV_RANGE)                                          \
+       "(env),4m(linux),16m(rootfs),256k(dtb),-(userfs)"
+#endif
+
+#define CONFIG_SYS_SDRAM_BASE          PHYS_SDRAM_1
+#define SRAM0_SIZE                     SZ_64K
+#define CONFIG_SYS_INIT_SP_ADDR                0x4030B7FC
+#define CONFIG_SPL_STACK               CONFIG_SYS_INIT_SP_ADDR
+
+ /* Platform/Board specific defs */
+#define CONFIG_SYS_TIMERBASE           0x48040000      /* Use Timer2 */
+#define CONFIG_SYS_PTV                 2       /* Divisor: 2^(PTV+1) => 8 */
+
+/* Defines for SPL */
+#define CONFIG_SPL
+#define CONFIG_SPL_BOARD_INIT
+#define CONFIG_SPL_MAX_SIZE            (46 * SZ_1K)
+#define CONFIG_SPL_GPIO_SUPPORT
+#ifdef CONFIG_NAND_AM33XX
+#define CONFIG_SPL_NAND_SUPPORT
+#define CONFIG_SPL_NAND_SIMPLE
+#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_BLOCK_SIZE     SZ_128K
+#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, }
+#endif
+
+#define CONFIG_SPL_BSS_START_ADDR      PHYS_SDRAM_1
+#define CONFIG_SPL_BSS_MAX_SIZE                SZ_512K
+
+#define CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR        0x300 /* address 0x60000 */
+
+#define CONFIG_SPL_LIBCOMMON_SUPPORT
+#define CONFIG_SPL_LIBGENERIC_SUPPORT
+#define CONFIG_SPL_SERIAL_SUPPORT
+#define CONFIG_SPL_YMODEM_SUPPORT
+#define CONFIG_SPL_LDSCRIPT            "$(CPUDIR)/omap-common/u-boot-spl.lds"
+
+/*
+ * 1MB into the SDRAM to allow for SPL's bss at the beginning of SDRAM
+ * 64 bytes before this address should be set aside for u-boot.img's
+ * header. That is 0x800FFFC0--0x80100000 should not be used for any
+ * other needs.
+ */
+#define CONFIG_SYS_SPL_MALLOC_START    (PHYS_SDRAM_1 + SZ_2M + SZ_32K)
+#define CONFIG_SYS_SPL_MALLOC_SIZE     SZ_1M
+
+#endif /* __TX48_H */
diff --git a/include/configs/tx51.h b/include/configs/tx51.h
new file mode 100644 (file)
index 0000000..d855a59
--- /dev/null
@@ -0,0 +1,294 @@
+/*
+ * Copyright (C) 2012 <LW@KARO-electronics.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 version 2.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT 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 __TX51_H
+#define __TX51_H
+
+#include <config.h>
+#include <asm/sizes.h>
+
+/*
+ * Ka-Ro TX51 board - SoC configuration
+ */
+#define CONFIG_MX51                            /* i.MX51 SoC */
+#define CONFIG_SYS_MX5_IOMUX_V3
+#define CONFIG_MXC_GPIO                                /* GPIO control */
+#define CONFIG_SYS_MX5_HCLK    24000000
+#define CONFIG_SYS_MX5_CLK32   32768
+#define CONFIG_SYS_DDR_CLKSEL  0
+#define CONFIG_SYS_HZ          1000            /* Ticks per second */
+#define CONFIG_SHOW_ACTIVITY
+#define CONFIG_DISPLAY_BOARDINFO
+#define CONFIG_BOARD_LATE_INIT
+#define CONFIG_BOARD_EARLY_INIT_F
+
+#if CONFIG_SYS_CPU_CLK == 600
+#define TX51_MOD_PREFIX                "6"
+#elif CONFIG_SYS_CPU_CLK == 800
+#define TX51_MOD_PREFIX                "8"
+#define CONFIG_MX51_PLL_ERRATA
+#else
+#error Invalid CPU clock
+#endif
+
+/* LCD Logo and Splash screen support */
+#define CONFIG_LCD
+#ifdef CONFIG_LCD
+#define CONFIG_SPLASH_SCREEN
+#define CONFIG_SPLASH_SCREEN_ALIGN
+#define CONFIG_VIDEO_MX5
+#define CONFIG_LCD_LOGO
+#define LCD_BPP                                LCD_COLOR24
+#define CONFIG_CMD_BMP
+#define CONFIG_VIDEO_BMP_RLE8
+#endif /* CONFIG_LCD */
+
+/*
+ * Memory configurations
+ */
+#define PHYS_SDRAM_1           0x90000000      /* Base address of bank 1 */
+#define PHYS_SDRAM_1_SIZE      SZ_128M
+#if CONFIG_NR_DRAM_BANKS > 1
+#define PHYS_SDRAM_2           0x98000000      /* Base address of bank 2 */
+#define PHYS_SDRAM_2_SIZE      SZ_128M
+#else
+#define TX51_MOD_SUFFIX                "0"
+#endif
+#define CONFIG_STACKSIZE       SZ_128K
+#define CONFIG_SYS_MALLOC_LEN  SZ_8M
+#define CONFIG_SYS_MEMTEST_START PHYS_SDRAM_1  /* Memtest start address */
+#define CONFIG_SYS_MEMTEST_END  (PHYS_SDRAM_1 + SZ_4M) /* 4 MB RAM test */
+#if CONFIG_SYS_SDRAM_CLK == 200
+#define CONFIG_SYS_CLKTL_CBCDR 0x59e35180
+#define TX51_MOD_SUFFIX                "1"
+#elif CONFIG_SYS_SDRAM_CLK == 166
+#define CONFIG_SYS_CLKTL_CBCDR 0x01e35180
+#ifndef TX51_MOD_SUFFIX
+#define TX51_MOD_SUFFIX                "2"
+#endif
+#else
+#error Invalid SDRAM clock
+#endif
+
+/*
+ * U-Boot general configurations
+ */
+#define CONFIG_SYS_LONGHELP
+#define CONFIG_SYS_PROMPT      "TX51 U-Boot > "
+#define CONFIG_SYS_CBSIZE      2048            /* Console I/O buffer size */
+#define CONFIG_SYS_PBSIZE \
+       (CONFIG_SYS_CBSIZE + sizeof(CONFIG_SYS_PROMPT) + 16)
+                                               /* Print buffer size */
+#define CONFIG_SYS_MAXARGS     64              /* Max number of command args */
+#define CONFIG_SYS_BARGSIZE    CONFIG_SYS_CBSIZE
+                                               /* Boot argument buffer size */
+#define CONFIG_VERSION_VARIABLE                        /* U-BOOT version */
+#define CONFIG_AUTO_COMPLETE                   /* Command auto complete */
+#define CONFIG_CMDLINE_EDITING                 /* Command history etc */
+
+#define CONFIG_SYS_64BIT_VSPRINTF
+#define CONFIG_SYS_NO_FLASH
+
+/*
+ * Flattened Device Tree (FDT) support
+*/
+#define CONFIG_OF_LIBFDT
+#define CONFIG_OF_EMBED
+#define CONFIG_OF_BOARD_SETUP
+#define CONFIG_DEFAULT_DEVICE_TREE     tx51
+#define CONFIG_ARCH_DEVICE_TREE                mx51
+
+/*
+ * Boot Linux
+ */
+#define xstr(s)        str(s)
+#define str(s) #s
+#define __pfx(x, s)    (x##s)
+#define _pfx(x, s)     __pfx(x, s)
+
+#define CONFIG_CMDLINE_TAG
+#define CONFIG_SETUP_MEMORY_TAGS
+#define CONFIG_BOOTDELAY       3
+#define CONFIG_ZERO_BOOTDELAY_CHECK
+#define CONFIG_SYS_AUTOLOAD    "no"
+#define CONFIG_BOOTFILE                "uImage"
+#define CONFIG_BOOTARGS                "console=ttymxc0,115200 ro debug panic=1"
+#define CONFIG_BOOTCOMMAND     "run bootcmd_nand"
+#define CONFIG_LOADADDR                94000000
+#define CONFIG_SYS_LOAD_ADDR   _pfx(0x, CONFIG_LOADADDR)
+#define CONFIG_U_BOOT_IMG_SIZE SZ_1M
+#define CONFIG_HW_WATCHDOG
+
+/*
+ * Extra Environments
+ */
+#define CONFIG_EXTRA_ENV_SETTINGS                                      \
+       "autostart=no\0"                                                \
+       "baseboard=stk5-v3\0"                                           \
+       "bootargs_mmc=run default_bootargs;set bootargs ${bootargs}"    \
+       " root=/dev/mmcblk0p3 rootwait\0"                               \
+       "bootargs_nand=run default_bootargs;set bootargs ${bootargs}"   \
+       " root=/dev/mtdblock3 rootfstype=jffs2\0"                       \
+       "nfsroot=/tftpboot/rootfs\0"                                    \
+       "bootargs_nfs=run default_bootargs;set bootargs ${bootargs}"    \
+       " root=/dev/nfs ip=dhcp nfsroot=${serverip}:${nfsroot},nolock\0"\
+       "bootcmd_mmc=set autostart no;run bootargs_mmc;"                \
+       "mmc read ${loadaddr} 100 3000;run bootm_cmd\0"                 \
+       "bootcmd_nand=set autostart no;run bootargs_nand;"              \
+       "nboot linux;run bootm_cmd\0"                                   \
+       "bootcmd_net=set autostart no;run bootargs_nfs;dhcp;"           \
+       "run bootm_cmd\0"                                               \
+       "bootm_cmd=fdt boardsetup;bootm ${loadaddr} - ${fdtaddr}\0"     \
+       "default_bootargs=set bootargs " CONFIG_BOOTARGS                \
+       " ${mtdparts} video=${video_mode} ${append_bootargs}\0"         \
+       "cpu_clk=" xstr(CONFIG_SYS_CPU_CLK) "\0"                        \
+       "fdtaddr=91000000\0"                                            \
+       "mtdids=" MTDIDS_DEFAULT "\0"                                   \
+       "mtdparts=" MTDPARTS_DEFAULT "\0"                               \
+       "otg_mode=device\0"                                             \
+       "touchpanel=tsc2007\0"                                          \
+       "video_mode=VGA-1:640x480MR-24@60\0"
+
+#define MTD_NAME                       "mxc_nand"
+#define MTDIDS_DEFAULT                 "nand0=" MTD_NAME
+#define CONFIG_FDT_FIXUP_PARTITIONS
+
+/*
+ * U-Boot Commands
+ */
+#include <config_cmd_default.h>
+#define CONFIG_CMD_CACHE
+#define CONFIG_CMD_IIM
+#define CONFIG_CMD_MMC
+#define CONFIG_CMD_NAND
+#define CONFIG_CMD_MTDPARTS
+#define CONFIG_CMD_BOOTCE
+#define CONFIG_CMD_TIME
+
+/*
+ * Serial Driver
+ */
+#define CONFIG_MXC_UART
+#define CONFIG_MXC_UART_BASE           UART1_BASE
+#define CONFIG_BAUDRATE                        115200          /* Default baud rate */
+#define CONFIG_SYS_BAUDRATE_TABLE      { 9600, 19200, 38400, 57600, 115200, }
+#define CONFIG_SYS_CONSOLE_INFO_QUIET
+
+/*
+ * Ethernet Driver
+ */
+#define CONFIG_FEC_MXC
+#ifdef CONFIG_FEC_MXC
+#define IMX_FEC_BASE                   FEC_BASE_ADDR
+#define CONFIG_FEC_MXC_PHYADDR         0x1f
+#define CONFIG_PHYLIB
+#define CONFIG_PHY_SMSC
+#define CONFIG_MII
+#define CONFIG_FEC_XCV_TYPE            MII100
+#define CONFIG_GET_FEC_MAC_ADDR_FROM_IIM
+#define CONFIG_CMD_MII
+#define CONFIG_CMD_DHCP
+#define CONFIG_CMD_PING
+/* Add for working with "strict" DHCP server */
+#define CONFIG_BOOTP_SUBNETMASK
+#define CONFIG_BOOTP_GATEWAY
+#define CONFIG_BOOTP_DNS
+#endif
+
+/*
+ * NAND flash driver
+ */
+#ifdef CONFIG_CMD_NAND
+#define CONFIG_MTD_DEVICE
+#define CONFIG_ENV_IS_IN_NAND
+#define CONFIG_NAND_MXC
+#define CONFIG_MXC_NAND_REGS_BASE      0xcfff0000
+#define CONFIG_MXC_NAND_IP_BASE                0x83fdb000
+#define CONFIG_MXC_NAND_HWECC
+#define CONFIG_CMD_NAND_TRIMFFS
+#define CONFIG_SYS_MAX_FLASH_SECT      1024
+#define CONFIG_SYS_MAX_FLASH_BANKS     1
+#define CONFIG_SYS_NAND_MAX_CHIPS      1
+#define CONFIG_SYS_MAX_NAND_DEVICE     1
+#define CONFIG_SYS_NAND_5_ADDR_CYCLE
+#define CONFIG_SYS_NAND_USE_FLASH_BBT
+#ifdef CONFIG_ENV_IS_IN_NAND
+#define CONFIG_ENV_OVERWRITE
+#define CONFIG_ENV_OFFSET              CONFIG_U_BOOT_IMG_SIZE
+#define CONFIG_ENV_SIZE                        0x20000 /* 128 KiB */
+#define CONFIG_ENV_RANGE               0x60000
+#endif
+#ifndef CONFIG_SYS_NO_FLASH
+#define CONFIG_CMD_FLASH
+#define CONFIG_SYS_NAND_BASE           0xa0000000
+#define CONFIG_FIT
+#else
+#define CONFIG_SYS_NAND_BASE           0x00000000
+#define CONFIG_CMD_ROMUPDATE
+#endif
+#endif /* CONFIG_CMD_NAND */
+
+/*
+ * MMC Driver
+ */
+#ifdef CONFIG_CMD_MMC
+#ifndef CONFIG_ENV_IS_IN_NAND
+#define CONFIG_ENV_IS_IN_MMC
+#endif
+#define CONFIG_MMC
+#define CONFIG_GENERIC_MMC
+#define CONFIG_FSL_ESDHC
+#define CONFIG_SYS_FSL_ESDHC_USE_PIO
+#define CONFIG_SYS_FSL_ESDHC_ADDR      0
+#define CONFIG_SYS_FSL_ESDHC_NUM       2
+
+#define CONFIG_BOOT_PARTITION_ACCESS
+#define CONFIG_DOS_PARTITION
+#define CONFIG_CMD_FAT
+#define CONFIG_CMD_EXT2
+
+/*
+ * Environments on MMC
+ */
+#ifdef CONFIG_ENV_IS_IN_MMC
+#define CONFIG_SYS_MMC_ENV_DEV 0
+#define CONFIG_ENV_OVERWRITE
+/* Associated with the MMC layout defined in mmcops.c */
+#define CONFIG_ENV_OFFSET              SZ_1K
+#define CONFIG_ENV_SIZE                        (SZ_128K - CONFIG_ENV_OFFSET)
+#define CONFIG_DYNAMIC_MMC_DEVNO
+#endif /* CONFIG_ENV_IS_IN_MMC */
+#endif /* CONFIG_CMD_MMC */
+
+#ifdef CONFIG_ENV_OFFSET_REDUND
+#define MTDPARTS_DEFAULT               "mtdparts=" MTD_NAME ":"        \
+       "1m(u-boot),"                                                   \
+       xstr(CONFIG_ENV_RANGE)                                          \
+       "(env),"                                                        \
+       xstr(CONFIG_ENV_RANGE)                                          \
+       "(env2),4m(linux),16m(rootfs),256k(dtb),-(userfs)"
+#else
+#define MTDPARTS_DEFAULT               "mtdparts=" MTD_NAME ":"        \
+       "1m(u-boot),"                                                   \
+       xstr(CONFIG_ENV_RANGE)                                          \
+       "(env),4m(linux),16m(rootfs),256k(dtb),-(userfs)"
+#endif
+
+#define CONFIG_SYS_SDRAM_BASE          PHYS_SDRAM_1
+#define CONFIG_SYS_INIT_SP_ADDR                (CONFIG_SYS_SDRAM_BASE + 0x1000 - /* Fix this */ \
+                                       GENERATED_GBL_DATA_SIZE)
+
+#ifdef CONFIG_CMD_IIM
+#define CONFIG_IMX_IIM
+#endif
+
+#endif /* __CONFIG_H */
diff --git a/include/configs/tx53.h b/include/configs/tx53.h
new file mode 100644 (file)
index 0000000..4084b41
--- /dev/null
@@ -0,0 +1,277 @@
+/*
+ * Copyright (C) 2012 <LW@KARO-electronics.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 version 2.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT 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 __TX53_H
+#define __TX53_H
+
+#include <config.h>
+#include <asm/sizes.h>
+
+/*
+ * Ka-Ro TX53 board - SoC configuration
+ */
+#define CONFIG_TX53                            /* TX53 SoM */
+#define CONFIG_MX53                            /* i.MX53 SoC */
+#define CONFIG_SYS_MX5_IOMUX_V3
+#define CONFIG_MXC_GPIO                                /* GPIO control */
+#define CONFIG_SYS_MX5_HCLK    24000000
+#define CONFIG_SYS_MX5_CLK32   32768
+#define CONFIG_SYS_DDR_CLKSEL  0
+#define CONFIG_SYS_HZ          1000            /* Ticks per second */
+#define CONFIG_SHOW_ACTIVITY
+#define CONFIG_DISPLAY_BOARDINFO
+#define CONFIG_BOARD_LATE_INIT
+#define CONFIG_BOARD_EARLY_INIT_F
+
+/* LCD Logo and Splash screen support */
+#define CONFIG_LCD
+#ifdef CONFIG_LCD
+#define CONFIG_SPLASH_SCREEN
+#define CONFIG_SPLASH_SCREEN_ALIGN
+#define CONFIG_VIDEO_MX5
+#define CONFIG_LCD_LOGO
+#define LCD_BPP                        LCD_COLOR24
+#define CONFIG_CMD_BMP
+#define CONFIG_VIDEO_BMP_RLE8
+#endif /* CONFIG_LCD */
+
+/*
+ * Memory configurations
+ */
+#define PHYS_SDRAM_1           0x70000000      /* Base address of bank 1 */
+#define PHYS_SDRAM_1_SIZE      SZ_512M
+#if CONFIG_NR_DRAM_BANKS > 1
+#define PHYS_SDRAM_2           0xb0000000      /* Base address of bank 2 */
+#define PHYS_SDRAM_2_SIZE      SZ_512M
+#define TX53_MOD_SUFFIX                "1"
+#else
+#define TX53_MOD_SUFFIX                "0"
+#endif
+#define CONFIG_STACKSIZE       SZ_128K
+#define CONFIG_SYS_MALLOC_LEN  SZ_8M
+#define CONFIG_SYS_MEMTEST_START PHYS_SDRAM_1  /* Memtest start address */
+#define CONFIG_SYS_MEMTEST_END (PHYS_SDRAM_1 + SZ_4M)  /* 4 MB RAM test */
+#define CONFIG_SYS_SDRAM_CLK   400
+
+/*
+ * U-Boot general configurations
+ */
+#define CONFIG_SYS_LONGHELP
+#define CONFIG_SYS_PROMPT      "TX53 U-Boot > "
+#define CONFIG_SYS_CBSIZE      2048            /* Console I/O buffer size */
+#define CONFIG_SYS_PBSIZE \
+       (CONFIG_SYS_CBSIZE + sizeof(CONFIG_SYS_PROMPT) + 16)
+                                               /* Print buffer size */
+#define CONFIG_SYS_MAXARGS     64              /* Max number of command args */
+#define CONFIG_SYS_BARGSIZE    CONFIG_SYS_CBSIZE
+                                               /* Boot argument buffer size */
+#define CONFIG_VERSION_VARIABLE                        /* U-BOOT version */
+#define CONFIG_AUTO_COMPLETE                   /* Command auto complete */
+#define CONFIG_CMDLINE_EDITING                 /* Command history etc */
+
+#define CONFIG_SYS_64BIT_VSPRINTF
+#define CONFIG_SYS_NO_FLASH
+
+/*
+ * Flattened Device Tree (FDT) support
+*/
+#define CONFIG_OF_LIBFDT
+#define CONFIG_OF_EMBED
+#define CONFIG_OF_BOARD_SETUP
+#define CONFIG_DEFAULT_DEVICE_TREE     tx53
+#define CONFIG_ARCH_DEVICE_TREE                mx53
+
+/*
+ * Boot Linux
+ */
+#define xstr(s)        str(s)
+#define str(s) #s
+#define __pfx(x, s)    (x##s)
+#define _pfx(x, s)     __pfx(x, s)
+
+#define CONFIG_CMDLINE_TAG
+#define CONFIG_SETUP_MEMORY_TAGS
+#define CONFIG_BOOTDELAY       3
+#define CONFIG_ZERO_BOOTDELAY_CHECK
+#define CONFIG_SYS_AUTOLOAD    "no"
+#define CONFIG_BOOTFILE                "uImage"
+#define CONFIG_BOOTARGS                "console=ttymxc0,115200 ro debug panic=1"
+#define CONFIG_BOOTCOMMAND     "run bootcmd_nand"
+#define CONFIG_LOADADDR                78000000
+#define CONFIG_SYS_LOAD_ADDR   _pfx(0x, CONFIG_LOADADDR)
+#define CONFIG_U_BOOT_IMG_SIZE SZ_1M
+#define CONFIG_HW_WATCHDOG
+
+/*
+ * Extra Environments
+ */
+#define CONFIG_EXTRA_ENV_SETTINGS                                      \
+       "autostart=no\0"                                                \
+       "baseboard=stk5-v3\0"                                           \
+       "bootargs_mmc=run default_bootargs;set bootargs ${bootargs}"    \
+       " root=/dev/mmcblk0p3 rootwait\0"                               \
+       "bootargs_nand=run default_bootargs;set bootargs ${bootargs}"   \
+       " root=/dev/mtdblock3 rootfstype=jffs2\0"                       \
+       "nfsroot=/tftpboot/rootfs\0"                                    \
+       "bootargs_nfs=run default_bootargs;set bootargs ${bootargs}"    \
+       " root=/dev/nfs ip=dhcp nfsroot=${serverip}:${nfsroot},nolock\0"\
+       "bootcmd_mmc=set autostart no;run bootargs_mmc;"                \
+       "mmc read ${loadaddr} 100 3000;run bootm_cmd\0"                 \
+       "bootcmd_nand=set autostart no;run bootargs_nand;"              \
+       "nboot linux;run bootm_cmd\0"                                   \
+       "bootcmd_net=set autostart no;run bootargs_nfs;dhcp;"           \
+       "run bootm_cmd\0"                                               \
+       "bootm_cmd=fdt boardsetup;bootm ${loadaddr} - ${fdtaddr}\0"     \
+       "default_bootargs=set bootargs " CONFIG_BOOTARGS                \
+       " ${mtdparts} video=${video_mode} ${append_bootargs}\0"         \
+       "cpu_clk=800\0"                                                 \
+       "fdtaddr=71000000\0"                                            \
+       "mtdids=" MTDIDS_DEFAULT "\0"                                   \
+       "mtdparts=" MTDPARTS_DEFAULT "\0"                               \
+       "otg_mode=device\0"                                             \
+       "touchpanel=tsc2007\0"                                          \
+       "video_mode=VGA-1:640x480MR-24@60\0"
+
+#define MTD_NAME                       "mxc_nand"
+#define MTDIDS_DEFAULT                 "nand0=" MTD_NAME
+#define CONFIG_FDT_FIXUP_PARTITIONS
+
+/*
+ * U-Boot Commands
+ */
+#include <config_cmd_default.h>
+#define CONFIG_CMD_CACHE
+#define CONFIG_CMD_IIM
+#define CONFIG_CMD_MMC
+#define CONFIG_CMD_NAND
+#define CONFIG_CMD_MTDPARTS
+#define CONFIG_CMD_BOOTCE
+#define CONFIG_CMD_TIME
+
+/*
+ * Serial Driver
+ */
+#define CONFIG_MXC_UART
+#define CONFIG_MXC_UART_BASE           UART1_BASE
+#define CONFIG_MXC_GPIO
+#define CONFIG_BAUDRATE                        115200          /* Default baud rate */
+#define CONFIG_SYS_BAUDRATE_TABLE      { 9600, 19200, 38400, 57600, 115200, }
+#define CONFIG_SYS_CONSOLE_INFO_QUIET
+
+/*
+ * Ethernet Driver
+ */
+#define CONFIG_FEC_MXC
+#ifdef CONFIG_FEC_MXC
+#define IMX_FEC_BASE                   FEC_BASE_ADDR
+#define CONFIG_FEC_MXC_PHYADDR         0
+#define CONFIG_PHYLIB
+#define CONFIG_PHY_SMSC
+#define CONFIG_MII
+#define CONFIG_FEC_XCV_TYPE            MII100
+#define CONFIG_GET_FEC_MAC_ADDR_FROM_IIM
+#define CONFIG_CMD_MII
+#define CONFIG_CMD_DHCP
+#define CONFIG_CMD_PING
+/* Add for working with "strict" DHCP server */
+#define CONFIG_BOOTP_SUBNETMASK
+#define CONFIG_BOOTP_GATEWAY
+#define CONFIG_BOOTP_DNS
+#endif
+
+/*
+ * NAND flash driver
+ */
+#ifdef CONFIG_CMD_NAND
+#define CONFIG_MTD_DEVICE
+#define CONFIG_ENV_IS_IN_NAND
+#define CONFIG_NAND_MXC
+#define CONFIG_MXC_NAND_REGS_BASE      0xf7ff0000
+#define CONFIG_MXC_NAND_IP_BASE                0x63fdb000
+#define CONFIG_MXC_NAND_HWECC
+#define CONFIG_CMD_NAND_TRIMFFS
+#define CONFIG_SYS_MAX_FLASH_SECT      1024
+#define CONFIG_SYS_MAX_FLASH_BANKS     1
+#define CONFIG_SYS_NAND_MAX_CHIPS      1
+#define CONFIG_SYS_MAX_NAND_DEVICE     1
+#define CONFIG_SYS_NAND_5_ADDR_CYCLE
+#define CONFIG_SYS_NAND_USE_FLASH_BBT
+#ifdef CONFIG_ENV_IS_IN_NAND
+#define CONFIG_ENV_OVERWRITE
+#define CONFIG_ENV_OFFSET              CONFIG_U_BOOT_IMG_SIZE
+#define CONFIG_ENV_SIZE                        0x20000 /* 128 KiB */
+#define CONFIG_ENV_RANGE               0x60000
+#endif
+#ifndef CONFIG_SYS_NO_FLASH
+#define CONFIG_CMD_FLASH
+#define CONFIG_SYS_NAND_BASE           0xa0000000
+#define CONFIG_FIT
+#else
+#define CONFIG_SYS_NAND_BASE           0x00000000
+#define CONFIG_CMD_ROMUPDATE
+#endif
+#endif /* CONFIG_CMD_NAND */
+
+/*
+ * MMC Driver
+ */
+#ifdef CONFIG_CMD_MMC
+#ifndef CONFIG_ENV_IS_IN_NAND
+#define CONFIG_ENV_IS_IN_MMC
+#endif
+#define CONFIG_MMC
+#define CONFIG_GENERIC_MMC
+#define CONFIG_FSL_ESDHC
+#define CONFIG_SYS_FSL_ESDHC_USE_PIO
+#define CONFIG_SYS_FSL_ESDHC_ADDR      0
+#define CONFIG_SYS_FSL_ESDHC_NUM       2
+
+#define CONFIG_DOS_PARTITION
+#define CONFIG_CMD_FAT
+#define CONFIG_CMD_EXT2
+
+/*
+ * Environments on MMC
+ */
+#ifdef CONFIG_ENV_IS_IN_MMC
+#define CONFIG_SYS_MMC_ENV_DEV 0
+#define CONFIG_ENV_OVERWRITE
+/* Associated with the MMC layout defined in mmcops.c */
+#define CONFIG_ENV_OFFSET              SZ_1K
+#define CONFIG_ENV_SIZE                        (SZ_128K - CONFIG_ENV_OFFSET)
+#define CONFIG_DYNAMIC_MMC_DEVNO
+#endif /* CONFIG_ENV_IS_IN_MMC */
+#endif /* CONFIG_CMD_MMC */
+
+#ifdef CONFIG_ENV_OFFSET_REDUND
+#define MTDPARTS_DEFAULT               "mtdparts=" MTD_NAME ":"        \
+       "1m(u-boot),"                                                   \
+       xstr(CONFIG_ENV_RANGE)                                          \
+       "(env),"                                                        \
+       xstr(CONFIG_ENV_RANGE)                                          \
+       "(env2),4m(linux),16m(rootfs),256k(dtb),-(userfs)"
+#else
+#define MTDPARTS_DEFAULT               "mtdparts=" MTD_NAME ":"        \
+       "1m(u-boot),"                                                   \
+       xstr(CONFIG_ENV_RANGE)                                          \
+       "(env),4m(linux),16m(rootfs),256k(dtb),-(userfs)"
+#endif
+
+#define CONFIG_SYS_SDRAM_BASE          PHYS_SDRAM_1
+#define CONFIG_SYS_INIT_SP_ADDR                (CONFIG_SYS_SDRAM_BASE + 0x1000 - /* Fix this */ \
+                                       GENERATED_GBL_DATA_SIZE)
+
+#ifdef CONFIG_CMD_IIM
+#define CONFIG_IMX_IIM
+#endif
+
+#endif /* __CONFIG_H */
index 599d5bb42aacc9f3a9b24106b958f27a763c6acc..d7ce6c64de6d35c5fef18c04e57f334515b7dea8 100644 (file)
@@ -93,8 +93,6 @@
 #define CONFIG_CMD_NET
 #define CONFIG_CMD_CACHE
 
-#define CONFIG_SYS_64BIT_VSPRINTF
-
 /*
  * Additional command
  */
diff --git a/include/dialog_pmic.h b/include/dialog_pmic.h
new file mode 100644 (file)
index 0000000..8d43585
--- /dev/null
@@ -0,0 +1,187 @@
+/*
+ * da9053 register declarations.
+ *
+ * Copyright(c) 2009 Dialog Semiconductor Ltd.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+#ifndef __DIALOG_PMIC_H__
+#define __DIALOG_PMIC_H__
+
+enum {
+       DA9053_PAGECON0_REG = 0,
+       DA9053_STATUSA_REG,
+       DA9053_STATUSB_REG,
+       DA9053_STATUSC_REG,
+       DA9053_STATUSD_REG,
+       DA9053_EVENTA_REG,
+       DA9053_EVENTB_REG,
+       DA9053_EVENTC_REG,
+       DA9053_EVENTD_REG,
+       DA9053_FAULTLOG_REG,
+       DA9053_IRQMASKA_REG,
+       DA9053_IRQMASKB_REG,
+       DA9053_IRQMASKC_REG,
+       DA9053_IRQMASKD_REG,
+       DA9053_CONTROLA_REG,
+       DA9053_CONTROLB_REG,
+       DA9053_CONTROLC_REG,
+       DA9053_CONTROLD_REG,
+       DA9053_PDDIS_REG,
+       DA9053_INTERFACE_REG,
+       DA9053_RESET_REG,
+       DA9053_GPIO0001_REG,
+       DA9053_GPIO0203_REG,
+       DA9053_GPIO0405_REG,
+       DA9053_GPIO0607_REG,
+       DA9053_GPIO0809_REG,
+       DA9053_GPIO1011_REG,
+       DA9053_GPIO1213_REG,
+       DA9053_GPIO1415_REG,
+       DA9053_ID01_REG,
+       DA9053_ID23_REG,
+       DA9053_ID45_REG,
+       DA9053_ID67_REG,
+       DA9053_ID89_REG,
+       DA9053_ID1011_REG,
+       DA9053_ID1213_REG,
+       DA9053_ID1415_REG,
+       DA9053_ID1617_REG,
+       DA9053_ID1819_REG,
+       DA9053_ID2021_REG,
+       DA9053_SEQSTATUS_REG,
+       DA9053_SEQA_REG,
+       DA9053_SEQB_REG,
+       DA9053_SEQTIMER_REG,
+       DA9053_BUCKA_REG,
+       DA9053_BUCKB_REG,
+       DA9053_BUCKCORE_REG,
+       DA9053_BUCKPRO_REG,
+       DA9053_BUCKMEM_REG,
+       DA9053_BUCKPERI_REG,
+       DA9053_LDO1_REG,
+       DA9053_LDO2_REG,
+       DA9053_LDO3_REG,
+       DA9053_LDO4_REG,
+       DA9053_LDO5_REG,
+       DA9053_LDO6_REG,
+       DA9053_LDO7_REG,
+       DA9053_LDO8_REG,
+       DA9053_LDO9_REG,
+       DA9053_LDO10_REG,
+       DA9053_SUPPLY_REG,
+       DA9053_PULLDOWN_REG,
+       DA9053_CHGBUCK_REG,
+       DA9053_WAITCONT_REG,
+       DA9053_ISET_REG,
+       DA9053_BATCHG_REG,
+       DA9053_CHGCONT_REG,
+       DA9053_INPUTCONT_REG,
+       DA9053_CHGTIME_REG,
+       DA9053_BBATCONT_REG,
+       DA9053_BOOST_REG,
+       DA9053_LEDCONT_REG,
+       DA9053_LEDMIN123_REG,
+       DA9053_LED1CONF_REG,
+       DA9053_LED2CONF_REG,
+       DA9053_LED3CONF_REG,
+       DA9053_LED1CONT_REG,
+       DA9053_LED2CONT_REG,
+       DA9053_LED3CONT_REG,
+       DA9053_LED4CONT_REG,
+       DA9053_LED5CONT_REG,
+       DA9053_ADCMAN_REG,
+       DA9053_ADCCONT_REG,
+       DA9053_ADCRESL_REG,
+       DA9053_ADCRESH_REG,
+       DA9053_VDDRES_REG,
+       DA9053_VDDMON_REG,
+       DA9053_ICHGAV_REG,
+       DA9053_ICHGTHD_REG,
+       DA9053_ICHGEND_REG,
+       DA9053_TBATRES_REG,
+       DA9053_TBATHIGHP_REG,
+       DA9053_TBATHIGHIN_REG,
+       DA9053_TBATLOW_REG,
+       DA9053_TOFFSET_REG,
+       DA9053_ADCIN4RES_REG,
+       DA9053_AUTO4HIGH_REG,
+       DA9053_AUTO4LOW_REG,
+       DA9053_ADCIN5RES_REG,
+       DA9053_AUTO5HIGH_REG,
+       DA9053_AUTO5LOW_REG,
+       DA9053_ADCIN6RES_REG,
+       DA9053_AUTO6HIGH_REG,
+       DA9053_AUTO6LOW_REG,
+       DA9053_TJUNCRES_REG,
+       DA9053_TSICONTA_REG,
+       DA9053_TSICONTB_REG,
+       DA9053_TSIXMSB_REG,
+       DA9053_TSIYMSB_REG,
+       DA9053_TSILSB_REG,
+       DA9053_TSIZMSB_REG,
+       DA9053_COUNTS_REG,
+       DA9053_COUNTMI_REG,
+       DA9053_COUNTH_REG,
+       DA9053_COUNTD_REG,
+       DA9053_COUNTMO_REG,
+       DA9053_COUNTY_REG,
+       DA9053_ALARMMI_REG,
+       DA9053_ALARMH_REG,
+       DA9053_ALARMD_REG,
+       DA9053_ALARMMO_REG,
+       DA9053_ALARMY_REG,
+       DA9053_SECONDA_REG,
+       DA9053_SECONDB_REG,
+       DA9053_SECONDC_REG,
+       DA9053_SECONDD_REG,
+       DA9053_PAGECON128_REG,
+       DA9053_CHIPID_REG,
+       DA9053_CONFIGID_REG,
+       DA9053_OTPCONT_REG,
+       DA9053_OSCTRIM_REG,
+       DA9053_GPID0_REG,
+       DA9053_GPID1_REG,
+       DA9053_GPID2_REG,
+       DA9053_GPID3_REG,
+       DA9053_GPID4_REG,
+       DA9053_GPID5_REG,
+       DA9053_GPID6_REG,
+       DA9053_GPID7_REG,
+       DA9053_GPID8_REG,
+       DA9053_GPID9_REG,
+       DIALOG_NUM_OF_REGS,
+};
+
+#define DA_BUCKCORE_VBCORE_1_250V              0x1E
+
+/* BUCKCORE REGISTER */
+#define DA9052_BUCKCORE_BCORECONF               (1 << 7)
+#define DA9052_BUCKCORE_BCOREEN                 (1 << 6)
+#define DA9052_BUCKCORE_VBCORE                  63
+
+/* SUPPLY REGISTER */
+#define DA9052_SUPPLY_VLOCK                     (1 << 7)
+#define DA9052_SUPPLY_VMEMSWEN                  (1 << 6)
+#define DA9052_SUPPLY_VPERISWEN                 (1 << 5)
+#define DA9052_SUPPLY_VLDO3GO                   (1 << 4)
+#define DA9052_SUPPLY_VLDO2GO                   (1 << 3)
+#define DA9052_SUPPLY_VBMEMGO                   (1 << 2)
+#define DA9052_SUPPLY_VBPROGO                   (1 << 1)
+#define DA9052_SUPPLY_VBCOREGO                  (1 << 0)
+
+#endif /* __DIALOG_PMIC_H__ */
index 1ef44f3cc6d7076935aad1736bcf19f853a17491..338c4cd8ff7a521dd150304e3ba8e19cc6ea49ad 100644 (file)
@@ -105,6 +105,18 @@ extern unsigned long nand_env_oob_offset;
 # endif
 #endif /* CONFIG_ENV_IS_IN_MG_DISK */
 
+#if defined(CONFIG_ENV_IS_IN_MMC)
+# ifndef       CONFIG_ENV_ADDR
+#  define      CONFIG_ENV_ADDR CONFIG_ENV_OFFSET
+# endif
+# ifndef       CONFIG_ENV_OFFSET
+#  define      CONFIG_ENV_OFFSET CONFIG_ENV_ADDR
+# endif
+# ifdef CONFIG_ENV_OFFSET_REDUND
+#  define CONFIG_SYS_REDUNDAND_ENVIRONMENT
+# endif
+#endif /* CONFIG_ENV_IS_IN_MMC */
+
 /* Embedded env is only supported for some flash types */
 #ifdef CONFIG_ENV_IS_EMBEDDED
 # if   !defined(CONFIG_ENV_IS_IN_FLASH)        && \
index 171c628485340cb1a0e2683eeeae87b8e3fceb80..fab577ed32f5e7321e6a49e2808a6f21368c471f 100644 (file)
@@ -60,6 +60,9 @@ enum fdt_compat_id {
        COMPAT_NVIDIA_TEGRA20_USB,      /* Tegra2 USB port */
        COMPAT_NVIDIA_TEGRA20_I2C,      /* Tegra2 i2c */
        COMPAT_NVIDIA_TEGRA20_DVC,      /* Tegra2 dvc (really just i2c) */
+       COMPAT_NVIDIA_TEGRA20_EMC,      /* Tegra2 memory controller */
+       COMPAT_NVIDIA_TEGRA20_EMC_TABLE, /* Tegra2 memory timing table */
+       COMPAT_NVIDIA_TEGRA20_KBC,      /* Tegra2 Keyboard */
 
        COMPAT_COUNT,
 };
@@ -116,6 +119,23 @@ int fdtdec_next_alias(const void *blob, const char *name,
 int fdtdec_next_compatible(const void *blob, int node,
                enum fdt_compat_id id);
 
+/**
+ * Find the next compatible subnode for a peripheral.
+ *
+ * Do the first call with node set to the parent and depth = 0. This
+ * function will return the offset of the next compatible node. Next time
+ * you call this function, pass the node value returned last time, with
+ * depth unchanged, and the next node will be provided.
+ *
+ * @param blob         FDT blob to use
+ * @param node         Start node for search
+ * @param id           Compatible ID to look for (enum fdt_compat_id)
+ * @param depthp       Current depth (set to 0 before first call)
+ * @return offset of next compatible node, or -FDT_ERR_NOTFOUND if no more
+ */
+int fdtdec_next_compatible_subnode(const void *blob, int node,
+               enum fdt_compat_id id, int *depthp);
+
 /**
  * Look up an address property in a node and return it as an address.
  * The property must hold either one address with no trailing data or
@@ -271,6 +291,25 @@ int fdtdec_lookup_phandle(const void *blob, int node, const char *prop_name);
 int fdtdec_get_int_array(const void *blob, int node, const char *prop_name,
                u32 *array, int count);
 
+/**
+ * Look up a property in a node and return a pointer to its contents as a
+ * unsigned int array of given length. The property must have at least enough
+ * data for the array ('count' cells). It may have more, but this will be
+ * ignored. The data is not copied.
+ *
+ * Note that you must access elements of the array with fdt32_to_cpu(),
+ * since the elements will be big endian even on a little endian machine.
+ *
+ * @param blob         FDT blob
+ * @param node         node to examine
+ * @param prop_name    name of property to find
+ * @param count                number of array elements
+ * @return pointer to array if found, or NULL if the property is not
+ *             found or there is not enough data
+ */
+const u32 *fdtdec_locate_array(const void *blob, int node,
+                              const char *prop_name, int count);
+
 /**
  * Look up a boolean property in a node and return it.
  *
@@ -311,3 +350,35 @@ int fdtdec_decode_gpio(const void *blob, int node, const char *prop_name,
  * @return 0 if all ok or gpio was FDT_GPIO_NONE; -1 on error
  */
 int fdtdec_setup_gpio(struct fdt_gpio_state *gpio);
+
+/*
+ * Look up a property in a node and return its contents in a byte
+ * array of given length. The property must have at least enough data for
+ * the array (count bytes). It may have more, but this will be ignored.
+ *
+ * @param blob         FDT blob
+ * @param node         node to examine
+ * @param prop_name    name of property to find
+ * @param array                array to fill with data
+ * @param count                number of array elements
+ * @return 0 if ok, or -FDT_ERR_MISSING if the property is not found,
+ *             or -FDT_ERR_BADLAYOUT if not enough data
+ */
+int fdtdec_get_byte_array(const void *blob, int node, const char *prop_name,
+               u8 *array, int count);
+
+/**
+ * Look up a property in a node and return a pointer to its contents as a
+ * byte array of given length. The property must have at least enough data
+ * for the array (count bytes). It may have more, but this will be ignored.
+ * The data is not copied.
+ *
+ * @param blob         FDT blob
+ * @param node         node to examine
+ * @param prop_name    name of property to find
+ * @param count                number of array elements
+ * @return pointer to byte array if found, or NULL if the property is not
+ *             found or there is not enough data
+ */
+const u8 *fdtdec_locate_byte_array(const void *blob, int node,
+                            const char *prop_name, int count);
index 8418bf7f47aa177af9bcd029276646c5525e15b9..86320a16a576fde1804b4f724f21e50975cf6078 100644 (file)
@@ -26,6 +26,7 @@
 #ifndef  __FSL_ESDHC_H__
 #define        __FSL_ESDHC_H__
 
+#include <linux/compat.h>
 #include <asm/errno.h>
 #include <asm/byteorder.h>
 
 #define ESDHC_HOSTCAPBLT_HSS   0x00200000
 
 struct fsl_esdhc_cfg {
-       u32     esdhc_base;
+       void __iomem *esdhc_base;
        u32     no_snoop;
+       int     cd_gpio;
+       int     wp_gpio;
 };
 
 /* Select the correct accessors depending on endianess */
index 742f2e19f9e9533573c07e1563978da8ba7bdfd7..64c1e2ef65e15bab8f9f5aaf0a6cdb4b1fee6c5a 100644 (file)
@@ -122,4 +122,15 @@ enum {
 /* Interrupt status 1 */
 #define RTCRSTI                (1 << 7)
 
+/* MC34708 Definitions */
+#define SWx_VOLT_MASK_MC34708  0x3F
+#define SWx_1_250V_MC34708     0x30
+#define SWx_1_300V_MC34708     0x34
+#define TIMER_MASK_MC34708     0x300
+#define TIMER_4S_MC34708       0x100
+#define VUSBSEL_MC34708                (1 << 2)
+#define VUSBEN_MC34708         (1 << 3)
+#define SWBST_CTRL             31
+#define SWBST_AUTO             0x8
+
 #endif
diff --git a/include/imx_spi.h b/include/imx_spi.h
new file mode 100644 (file)
index 0000000..e4f6444
--- /dev/null
@@ -0,0 +1,96 @@
+/*
+ * (C) Copyright 2008-2009 Freescale Semiconductor, Inc.
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+#ifndef __IMX_SPI_H__
+#define __IMX_SPI_H__
+
+#include <spi.h>
+
+#undef IMX_SPI_DEBUG
+
+#define IMX_SPI_ACTIVE_HIGH     1
+#define IMX_SPI_ACTIVE_LOW      0
+#define SPI_RETRY_TIMES         100
+
+#if defined(IMX_CSPI_VER_0_7)
+       #define SPI_RX_DATA             0x0
+       #define SPI_TX_DATA             0x4
+       #define SPI_CON_REG             0x8
+       #define SPI_INT_REG             0xC
+       #define SPI_DMA_REG             0x10
+       #define SPI_STAT_REG            0x14
+       #define SPI_PERIOD_REG          0x18
+
+       #define SPI_CTRL_EN             (1 << 0)
+       #define SPI_CTRL_MODE           (1 << 1)
+       #define SPI_CTRL_REG_XCH_BIT    (1 << 2)
+       #define SPI_CTRL_SSPOL          (1 << 7)
+       #define SPI_CTRL_SSPOL_OFF      (7)
+       #define SPI_CTRL_SSCTL          (1 << 6)
+       #define SPI_CTRL_SSCTL_OFF      (6)
+       #define SPI_CTRL_SCLK_POL       (1 << 4)
+       #define SPI_CTRL_SCLK_POL_OFF   (4)
+       #define SPI_CTRL_SCLK_PHA       (1 << 5)
+       #define SPI_CTRL_SCLK_PHA_OFF   (5)
+       #define SPI_CTRL_SS_OFF         (12)
+       #define SPI_CTRL_SS_MASK        (3 << 12)
+       #define SPI_CTRL_DATA_OFF       (16)
+       #define SPI_CTRL_DATA_MASK      (7 << 16)
+       #define SPI_CTRL_BURST_OFF      (20)
+       #define SPI_CTRL_BURST_MASK     (0xFFF << 20)
+       #define SPI_INT_STAT_TC         (1 << 7)
+
+#elif defined(IMX_CSPI_VER_2_3)
+       #define SPI_RX_DATA             0x0
+       #define SPI_TX_DATA             0x4
+       #define SPI_CON_REG             0x8
+       #define SPI_CFG_REG             0xC
+       #define SPI_INT_REG             0x10
+       #define SPI_DMA_REG             0x14
+       #define SPI_STAT_REG            0x18
+       #define SPI_PERIOD_REG          0x1C
+#endif
+
+struct spi_reg_t {
+       u32 ctrl_reg;
+       u32 cfg_reg;
+};
+
+struct imx_spi_dev_t {
+       struct spi_slave slave;
+       u32 base;      /* base address of SPI module the device is connected to */
+       u32 freq;      /* desired clock freq in Hz for this device */
+       u32 ss_pol;    /* ss polarity: 1=active high; 0=active low */
+       u32 ss;        /* slave select */
+       u32 in_sctl;   /* inactive sclk ctl: 1=stay low; 0=stay high */
+       u32 in_dctl;   /* inactive data ctl: 1=stay low; 0=stay high */
+       u32 ssctl;     /* single burst mode vs multiple: 0=single; 1=multi */
+       u32 sclkpol;   /* sclk polarity: active high=0; active low=1 */
+       u32 sclkpha;   /* sclk phase: 0=phase 0; 1=phase1 */
+       u32 fifo_sz;   /* fifo size in bytes for either tx or rx. Don't add them up! */
+       u32 us_delay;  /* us delay in each xfer */
+       struct spi_reg_t reg; /* pointer to a set of SPI registers */
+};
+
+extern void spi_io_init(struct imx_spi_dev_t *dev);
+
+#endif /* __IMX_SPI_H__ */
diff --git a/include/imx_spi_nor.h b/include/imx_spi_nor.h
new file mode 100644 (file)
index 0000000..9425d59
--- /dev/null
@@ -0,0 +1,70 @@
+/*
+ * (C) Copyright 2008-2010 Freescale Semiconductor, Inc.
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+#ifndef _IMX_SPI_NOR_H_
+#define _IMX_SPI_NOR_H_
+
+#define READ        0x03    /* tx:1 byte cmd + 3 byte addr;rx:variable bytes */
+#define READ_HS     0x0B    /* tx:1 byte cmd + 3 byte addr + 1 byte dummy; */
+#define RDSR        0x05    /* read stat reg 1 byte tx cmd + 1 byte rx status */
+#define RDSR_BUSY       (1 << 0)    /* 1=write-in-progress (default 0) */
+#define RDSR_WEL        (1 << 1)    /* 1=write enable (default 0) */
+#define RDSR_BP0        (1 << 2)    /* block write prot level (default 1) */
+#define RDSR_BP1        (1 << 3)    /* block write prot level (default 1) */
+#define RDSR_BP2        (1 << 4)    /* block write prot level (default 1) */
+#define RDSR_BP3        (1 << 5)    /* block write prot level (default 1) */
+#define RDSR_AAI        (1 << 6)    /* 1=AAI prog mode; 0=byte prog (def 0) */
+#define RDSR_BPL        (1 << 7)    /* 1=BP3,BP2,BP1,BP0 RO; 0=R/W (def 0)  */
+#define WREN        0x06    /* write enable. 1 byte tx cmd */
+#define WRDI        0x04    /* write disable. 1 byte tx cmd */
+#define EWSR        0x50    /* Enable write status. 1 byte tx cmd */
+#define WRSR        0x01    /* Write stat reg. 1 byte tx cmd + 1 byte tx val */
+#define ERASE_4K    0x20    /* sector erase. 1 byte cmd + 3 byte addr */
+#define ERASE_32K   0x52    /* 32K block erase. 1 byte cmd + 3 byte addr */
+#define ERASE_64K   0xD8    /* 64K block erase. 1 byte cmd + 3 byte addr */
+#define ERASE_CHIP  0x60    /* whole chip erase */
+#define BYTE_PROG   0x02    /* all tx: 1 cmd + 3 addr + 1 data */
+#define AAI_PROG    0xAD    /* all tx: [1 cmd + 3 addr + 2 data] + RDSR */
+                               /* + [1cmd + 2 data] + .. + [WRDI] + [RDSR] */
+#define JEDEC_ID    0x9F    /* read JEDEC ID. tx: 1 byte cmd; rx: 3 byte ID */
+
+/* Atmel SPI-NOR commands */
+#define WR_2_MEM_DIR   0x82
+#define BUF1_WR                0x84
+#define BUF2_WR                0x87
+#define BUF1_TO_MEM    0x83
+#define BUF2_TO_MEM    0x86
+#define STAT_READ      0xD7
+#define STAT_PG_SZ     (1 << 0)  /* 1=Page size is 512, 0=Page size is 528 */
+#define STAT_PROT      (1 << 1)  /* 1=sector protection enabled (default 0) */
+#define STAT_COMP      (1 << 6)
+#define STAT_BUSY      (1 << 7) /* 1=Device not busy */
+#define CONFIG_REG1    0x3D
+#define CONFIG_REG2    0x2A
+#define CONFIG_REG3    0x80
+#define CONFIG_REG4    0xA6
+
+#define SZ_64K      0x10000
+#define SZ_32K      0x8000
+#define SZ_4K       0x1000
+
+#endif /* _IMX_SPI_NOR_H_ */
diff --git a/include/imx_ssp_mmc.h b/include/imx_ssp_mmc.h
new file mode 100644 (file)
index 0000000..a3c157d
--- /dev/null
@@ -0,0 +1,50 @@
+/*
+ * IMX SSP MMC Defines
+ *-------------------------------------------------------------------
+ *
+ * Copyright (C) 2007-2008, 2010 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
+ *
+ *-------------------------------------------------------------------
+ *
+ */
+
+#ifndef __IMX_SSP_MMC_H__
+#define        __IMX_SSP_MMC_H__
+
+/* Common definition */
+#define BM_CLKCTRL_SSP_CLKGATE                 0x80000000
+#define BM_CLKCTRL_SSP_BUSY            0x20000000
+#define BM_CLKCTRL_SSP_DIV_FRAC_EN     0x00000200
+#define BM_CLKCTRL_SSP_DIV             0x000001FF
+#define BP_CLKCTRL_SSP_DIV             0
+
+struct imx_ssp_mmc_cfg {
+       u32     ssp_mmc_base;
+
+       /* CLKCTRL register offset */
+       u32     clkctrl_ssp_offset;
+       u32     clkctrl_clkseq_ssp_offset;
+};
+
+#ifdef CONFIG_IMX_SSP_MMC
+int imx_ssp_mmc_initialize(bd_t *bis, struct imx_ssp_mmc_cfg *cfg);
+
+extern u32 ssp_mmc_is_wp(struct mmc *mmc);
+#endif /* CONFIG_IMX_SSP_MMC */
+
+#endif  /* __IMX_SSP_MMC_H__ */
diff --git a/include/input.h b/include/input.h
new file mode 100644 (file)
index 0000000..31b1ef9
--- /dev/null
@@ -0,0 +1,147 @@
+/*
+ * Keyboard input helper functions (too small to be called a layer)
+ *
+ * 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 _INPUT_H
+#define _INPUT_H
+
+enum {
+       INPUT_MAX_MODIFIERS     = 4,
+       INPUT_BUFFER_LEN        = 16,
+};
+
+enum {
+       /* Keyboard LEDs */
+       INPUT_LED_SCROLL        = 1 << 0,
+       INPUT_LED_CAPS          = 1 << 1,
+       INPUT_LED_NUM           = 1 << 2,
+};
+
+/*
+ * This table translates key codes to ASCII. Most of the entries are ASCII
+ * codes, but entries after KEY_FIRST_MOD indicate that this key is a
+ * modifier key, like shift, ctrl. KEY_FIRST_MOD + MOD_SHIFT is the shift
+ * key, for example.
+ */
+struct input_key_xlate {
+       /* keycode of the modifiers which select this table, -1 if none */
+       int left_keycode;
+       int right_keycode;
+       const uchar *xlate;     /* keycode to ASCII table */
+       int num_entries;        /* number of entries in this table */
+};
+
+struct input_config {
+       uchar fifo[INPUT_BUFFER_LEN];
+       int fifo_in, fifo_out;
+
+       /* Which modifiers are active (1 bit for each MOD_... value) */
+       uchar modifiers;
+       uchar flags;            /* active state keys (FLAGS_...) */
+       uchar leds;             /* active LEDS (INPUT_LED_...) */
+       uchar num_tables;       /* number of modifier tables */
+       int prev_keycodes[INPUT_BUFFER_LEN];    /* keys held last time */
+       int num_prev_keycodes;  /* number of prev keys */
+       struct input_key_xlate table[INPUT_MAX_MODIFIERS];
+
+       /**
+        * Function the input helper calls to scan the keyboard
+        *
+        * @param config        Input state
+        * @return 0 if no keys read, otherwise number of keys read, or 1 if
+        *              unknown
+        */
+       int (*read_keys)(struct input_config *config);
+       unsigned int next_repeat_ms;    /* Next time we repeat a key */
+       unsigned int repeat_delay_ms;   /* Time before autorepeat starts */
+       unsigned int repeat_rate_ms;    /* Autorepeat rate in ms */
+};
+
+struct stdio_dev;
+
+/**
+ * Convert a list of key codes into ASCII and send them
+ *
+ * @param config       Input state
+ * @param keycode      List of key codes to examine
+ * @param num_keycodes Number of key codes
+ */
+int input_send_keycodes(struct input_config *config, int keycode[], int count);
+
+/**
+ * Add a new key translation table to the input
+ *
+ * @param config       Input state
+ * @param left_keycode Key to hold to get into this table
+ * @param right_keycode        Another key to hold to get into this table
+ * @param xlate                Conversion table from key codes to ASCII
+ * @param num_entries  Number of entries in xlate table
+ */
+int input_add_table(struct input_config *config, int left_keycode,
+                   int right_keycode, const uchar *xlate, int num_entries);
+
+/**
+ * Test if keys are available to be read
+ *
+ * @param config       Input state
+ * @return 0 if no keys available, 1 if keys are available
+ */
+int input_tstc(struct input_config *config);
+
+/**
+ * Read a key
+ *
+ * TODO: U-Boot wants 0 for no key, but Ctrl-@ is a valid key...
+ *
+ * @param config       Input state
+ * @return key, or 0 if no key, or -1 if error
+ */
+int input_getc(struct input_config *config);
+
+/**
+ * Register a new device with stdio and switch to it if wanted
+ *
+ * @param dev  Pointer to device
+ * @return 0 if ok, -1 on error
+ */
+int input_stdio_register(struct stdio_dev *dev);
+
+/**
+ * Set up the input handler with basic key maps.
+ *
+ * @param config       Input state
+ * @param leds         Initial LED value (INPUT_LED_ mask), 0 suggested
+ * @param repeat_delay_ms      Delay before key auto-repeat starts (in ms)
+ * @param repeat_rate_ms       Delay between successive key repeats (in ms)
+ * @return 0 if ok, -1 on error
+ */
+int input_init(struct input_config *config, int leds, int repeat_delay_ms,
+              int repeat_rate_ms);
+
+#ifdef CONFIG_SYS_CONSOLE_OVERWRITE_ROUTINE
+extern int overwrite_console(void);
+#define OVERWRITE_CONSOLE overwrite_console()
+#else
+#define OVERWRITE_CONSOLE 0
+#endif /* CONFIG_SYS_CONSOLE_OVERWRITE_ROUTINE */
+
+#endif
index 656f605462ea66031e1247be7cd28cc8782fcf3f..5ffc98d861422ac9cdf804a6c1e3130e24811c9f 100644 (file)
@@ -76,6 +76,6 @@
 #define IPU_PIX_FMT_YVU422P fourcc('Y', 'V', '1', '6') /*< 16 YVU 4:2:2 */
 #define IPU_PIX_FMT_YUV422P fourcc('4', '2', '2', 'P') /*< 16 YUV 4:2:2 */
 
-int mx51_fb_init(struct fb_videomode *mode, uint8_t disp, uint32_t pixfmt);
+int mx5_fb_init(struct fb_videomode *mode, uint8_t disp, uint32_t pixfmt, int bpp);
 
 #endif
diff --git a/include/key_matrix.h b/include/key_matrix.h
new file mode 100644 (file)
index 0000000..f413314
--- /dev/null
@@ -0,0 +1,99 @@
+/*
+ * Keyboard matrix helper functions
+ *
+ * Copyright (c) 2012 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 _KEY_MATRIX_H
+#define _KEY_MATRIX_H
+
+#include <common.h>
+
+/* Information about a matrix keyboard */
+struct key_matrix {
+       /* Dimensions of the keyboard matrix, in rows and columns */
+       int num_rows;
+       int num_cols;
+       int key_count;  /* number of keys in the matrix (= rows * cols) */
+
+       /*
+        * Information about keycode mappings. The plain_keycode array must
+        * exist but fn may be NULL in which case it is not decoded.
+        */
+       const u8 *plain_keycode;        /* key code for each row / column */
+       const u8 *fn_keycode;           /* ...when Fn held down */
+       int fn_pos;                     /* position of Fn key in key (or -1) */
+};
+
+/* Information about a particular key (row, column pair) in the matrix */
+struct key_matrix_key {
+       uint8_t row;    /* row number (0 = first) */
+       uint8_t col;    /* column number (0 = first) */
+       uint8_t valid;  /* 1 if valid, 0 to ignore this */
+};
+
+/**
+ * Decode a set of pressed keys into key codes
+ *
+ * Given a list of keys that are pressed, this converts this list into
+ * a list of key codes. Each of the keys has a valid flag, which can be
+ * used to mark a particular key as invalid (so that it is ignored).
+ *
+ * The plain keymap is used, unless the Fn key is detected along the way,
+ * at which point we switch to the Fn key map.
+ *
+ * If key ghosting is detected, we simply ignore the keys and return 0.
+ *
+ * @param config        Keyboard matrix config
+ * @param keys         List of keys to process (each is row, col)
+ * @param num_keys     Number of keys to process
+ * @param keycode      Returns a list of key codes, decoded from input
+ * @param max_keycodes Size of key codes array (suggest 8)
+ *
+ */
+int key_matrix_decode(struct key_matrix *config, struct key_matrix_key *keys,
+                     int num_keys, int keycode[], int max_keycodes);
+
+/**
+ * Read the keyboard configuration out of the fdt.
+ *
+ * Decode properties of named "linux,<type>keymap" where <type> is either
+ * empty, or "fn-". Then set up the plain key map (and the FN keymap if
+ * present).
+ *
+ * @param config        Keyboard matrix config
+ * @param blob          FDT blob
+ * @param node          Node containing compatible data
+ * @return 0 if ok, -1 on error
+ */
+int key_matrix_decode_fdt(struct key_matrix *config, const void *blob,
+                         int node);
+
+/**
+ * Set up a new key matrix.
+ *
+ * @param config       Keyboard matrix config
+ * @param rows         Number of rows in key matrix
+ * @param cols         Number of columns in key matrix
+ * @return 0 if ok, -1 on error
+ */
+int key_matrix_init(struct key_matrix *config, int rows, int cols);
+
+#endif
index d95feeb791d713355e997f95fe2c908a1fcfa8a4..65e834ed4eb44b96dd576f20bedb4717734d750c 100644 (file)
@@ -1,4 +1,6 @@
 /*
+ * Copyright (C) 2004-2010 Freescale Semiconductor, Inc.
+ *
  * MPC823 and PXA LCD Controller
  *
  * Modeled after video interface by Paolo Scaffardi
@@ -183,6 +185,129 @@ typedef struct vidinfo {
        u_long  mmio;           /* Memory mapped registers */
 } vidinfo_t;
 
+#elif defined(CONFIG_EXYNOS_FB)
+
+enum {
+       FIMD_RGB_INTERFACE = 1,
+       FIMD_CPU_INTERFACE = 2,
+};
+
+typedef struct vidinfo {
+       ushort vl_col;          /* Number of columns (i.e. 640) */
+       ushort vl_row;          /* Number of rows (i.e. 480) */
+       ushort vl_width;        /* Width of display area in millimeters */
+       ushort vl_height;       /* Height of display area in millimeters */
+
+       /* LCD configuration register */
+       u_char vl_freq;         /* Frequency */
+       u_char vl_clkp;         /* Clock polarity */
+       u_char vl_oep;          /* Output Enable polarity */
+       u_char vl_hsp;          /* Horizontal Sync polarity */
+       u_char vl_vsp;          /* Vertical Sync polarity */
+       u_char vl_dp;           /* Data polarity */
+       u_char vl_bpix;         /* Bits per pixel */
+
+       /* Horizontal control register. Timing from data sheet */
+       u_char vl_hspw;         /* Horz sync pulse width */
+       u_char vl_hfpd;         /* Wait before of line */
+       u_char vl_hbpd;         /* Wait end of line */
+
+       /* Vertical control register. */
+       u_char  vl_vspw;        /* Vertical sync pulse width */
+       u_char  vl_vfpd;        /* Wait before of frame */
+       u_char  vl_vbpd;        /* Wait end of frame */
+       u_char  vl_cmd_allow_len; /* Wait end of frame */
+
+       void (*cfg_gpio)(void);
+       void (*backlight_on)(unsigned int onoff);
+       void (*reset_lcd)(void);
+       void (*lcd_power_on)(void);
+       void (*cfg_ldo)(void);
+       void (*enable_ldo)(unsigned int onoff);
+       void (*mipi_power)(void);
+       void (*backlight_reset)(void);
+
+       unsigned int win_id;
+       unsigned int init_delay;
+       unsigned int power_on_delay;
+       unsigned int reset_delay;
+       unsigned int interface_mode;
+       unsigned int mipi_enabled;
+       unsigned int cs_setup;
+       unsigned int wr_setup;
+       unsigned int wr_act;
+       unsigned int wr_hold;
+
+       /* parent clock name(MPLL, EPLL or VPLL) */
+       unsigned int pclk_name;
+       /* ratio value for source clock from parent clock. */
+       unsigned int sclk_div;
+
+       unsigned int dual_lcd_enabled;
+
+} vidinfo_t;
+
+void init_panel_info(vidinfo_t *vid);
+
+#elif defined(CONFIG_MXC2_LCD)
+
+typedef struct vidinfo {
+       u_long vl_refresh;      /* Refresh Rate Hz */
+       u_long vl_row;          /* resolution in x */
+       u_long vl_col;          /* resolution in y */
+       u_long vl_pixclock;     /* pixel clock in picoseconds */
+       u_long vl_left_margin;  /* Horizontal back porch */
+       u_long vl_right_margin; /* Horizontal front porch */
+       u_long vl_upper_margin; /* Vertical back porch */
+       u_long vl_lower_margin; /* Vertical front porch */
+       u_long vl_hsync;        /* Horizontal sync pulse length */
+       u_long vl_vsync;        /* Vertical sync pulse length */
+       u_long vl_sync;         /* Polarity on data enable */
+       u_long vl_mode;         /* Video Mode */
+       u_long vl_flag;
+       u_char  vl_bpix;
+       ushort  *cmap;
+} vidinfo_t;
+
+#elif defined(CONFIG_MXC_EPDC)
+
+struct waveform_modes {
+       int mode_init;
+       int mode_du;
+       int mode_gc4;
+       int mode_gc8;
+       int mode_gc16;
+       int mode_gc32;
+};
+
+struct epdc_data_struct {
+       /* EPDC buffer pointers */
+       u_long working_buf_addr;
+       u_long waveform_buf_addr;
+
+       /* Waveform mode definitions */
+       struct waveform_modes wv_modes;
+};
+
+typedef struct vidinfo {
+       u_long vl_refresh;      /* Refresh Rate Hz */
+       u_long vl_row;          /* resolution in x */
+       u_long vl_col;          /* resolution in y */
+       u_long vl_pixclock;     /* pixel clock in picoseconds */
+       u_long vl_left_margin;  /* Horizontal back porch */
+       u_long vl_right_margin; /* Horizontal front porch */
+       u_long vl_upper_margin; /* Vertical back porch */
+       u_long vl_lower_margin; /* Vertical front porch */
+       u_long vl_hsync;        /* Horizontal sync pulse length */
+       u_long vl_vsync;        /* Vertical sync pulse length */
+       u_long vl_sync;         /* Polarity on data enable */
+       u_long vl_mode;         /* Video Mode */
+       u_long vl_flag;
+       u_char  vl_bpix;
+       ushort  *cmap;
+       struct epdc_data_struct epdc_data;
+} vidinfo_t;
+
 #else
 
 typedef struct vidinfo {
@@ -202,10 +327,8 @@ extern vidinfo_t panel_info;
 
 /* Video functions */
 
-#if defined(CONFIG_RBC823)
 void   lcd_disable     (void);
-#endif
-
+void   lcd_panel_disable(void);
 
 /* int lcd_init        (void *lcdbase); */
 void   lcd_putc        (const char c);
@@ -238,6 +361,7 @@ void lcd_show_board_info(void);
 #define LCD_COLOR4     2
 #define LCD_COLOR8     3
 #define LCD_COLOR16    4
+#define LCD_COLOR24    5
 
 /*----------------------------------------------------------------------*/
 #if defined(CONFIG_LCD_INFO_BELOW_LOGO)
@@ -289,14 +413,36 @@ void lcd_show_board_info(void);
 # define CONSOLE_COLOR_GREY    14
 # define CONSOLE_COLOR_WHITE   15      /* Must remain last / highest   */
 
-#else
+#elif LCD_BPP == LCD_COLOR16
 
 /*
  * 16bpp color definitions
  */
 # define CONSOLE_COLOR_BLACK   0x0000
+# define CONSOLE_COLOR_RED     0xf800
+# define CONSOLE_COLOR_GREEN   0x07e0
+# define CONSOLE_COLOR_YELLOW  0xffe0
+# define CONSOLE_COLOR_BLUE    0x001f
+# define CONSOLE_COLOR_MAGENTA 0xf81f
+# define CONSOLE_COLOR_CYAN    0x07ff
+# define CONSOLE_COLOR_GREY    0xcccc
 # define CONSOLE_COLOR_WHITE   0xffff  /* Must remain last / highest   */
 
+#elif LCD_BPP == LCD_COLOR24
+/*
+ * 16bpp color definitions
+ */
+# define CONSOLE_COLOR_BLACK   0x00000000
+# define CONSOLE_COLOR_RED     0x00ff0000
+# define CONSOLE_COLOR_GREEN   0x0000ff00
+# define CONSOLE_COLOR_YELLOW  0x00ffff00
+# define CONSOLE_COLOR_BLUE    0x000000ff
+# define CONSOLE_COLOR_MAGENTA 0x00ff00ff
+# define CONSOLE_COLOR_CYAN    0x0000ffff
+# define CONSOLE_COLOR_GREY    0x00cccccc
+# define CONSOLE_COLOR_WHITE   0x00ffffff      /* Must remain last / highest   */
+#else
+#error Invalid LCD_BPP setting
 #endif /* color definitions */
 
 /************************************************************************/
@@ -326,7 +472,7 @@ void lcd_show_board_info(void);
 #if LCD_BPP == LCD_MONOCHROME
 # define COLOR_MASK(c)         ((c)      | (c) << 1 | (c) << 2 | (c) << 3 | \
                                 (c) << 4 | (c) << 5 | (c) << 6 | (c) << 7)
-#elif (LCD_BPP == LCD_COLOR8) || (LCD_BPP == LCD_COLOR16)
+#elif (LCD_BPP == LCD_COLOR8) || (LCD_BPP == LCD_COLOR16) || (LCD_BPP == LCD_COLOR24)
 # define COLOR_MASK(c)         (c)
 #else
 # error Unsupported LCD BPP.
diff --git a/include/linux/input.h b/include/linux/input.h
new file mode 100644 (file)
index 0000000..44aec76
--- /dev/null
@@ -0,0 +1,155 @@
+/*
+ * Copyright (c) 1999-2002 Vojtech Pavlik
+ *
+ * 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.
+ */
+
+#ifndef _LINUX_INPUT_H
+#define _LINUX_INPUT_H
+
+/*
+ * Keys and buttons
+ *
+ * Most of the keys/buttons are modeled after USB HUT 1.12
+ * (see http://www.usb.org/developers/hidpage).
+ * Abbreviations in the comments:
+ * AC - Application Control
+ * AL - Application Launch Button
+ * SC - System Control
+ */
+
+#define KEY_RESERVED           0
+#define KEY_ESC                        1
+#define KEY_1                  2
+#define KEY_2                  3
+#define KEY_3                  4
+#define KEY_4                  5
+#define KEY_5                  6
+#define KEY_6                  7
+#define KEY_7                  8
+#define KEY_8                  9
+#define KEY_9                  10
+#define KEY_0                  11
+#define KEY_MINUS              12
+#define KEY_EQUAL              13
+#define KEY_BACKSPACE          14
+#define KEY_TAB                        15
+#define KEY_Q                  16
+#define KEY_W                  17
+#define KEY_E                  18
+#define KEY_R                  19
+#define KEY_T                  20
+#define KEY_Y                  21
+#define KEY_U                  22
+#define KEY_I                  23
+#define KEY_O                  24
+#define KEY_P                  25
+#define KEY_LEFTBRACE          26
+#define KEY_RIGHTBRACE         27
+#define KEY_ENTER              28
+#define KEY_LEFTCTRL           29
+#define KEY_A                  30
+#define KEY_S                  31
+#define KEY_D                  32
+#define KEY_F                  33
+#define KEY_G                  34
+#define KEY_H                  35
+#define KEY_J                  36
+#define KEY_K                  37
+#define KEY_L                  38
+#define KEY_SEMICOLON          39
+#define KEY_APOSTROPHE         40
+#define KEY_GRAVE              41
+#define KEY_LEFTSHIFT          42
+#define KEY_BACKSLASH          43
+#define KEY_Z                  44
+#define KEY_X                  45
+#define KEY_C                  46
+#define KEY_V                  47
+#define KEY_B                  48
+#define KEY_N                  49
+#define KEY_M                  50
+#define KEY_COMMA              51
+#define KEY_DOT                        52
+#define KEY_SLASH              53
+#define KEY_RIGHTSHIFT         54
+#define KEY_KPASTERISK         55
+#define KEY_LEFTALT            56
+#define KEY_SPACE              57
+#define KEY_CAPSLOCK           58
+#define KEY_F1                 59
+#define KEY_F2                 60
+#define KEY_F3                 61
+#define KEY_F4                 62
+#define KEY_F5                 63
+#define KEY_F6                 64
+#define KEY_F7                 65
+#define KEY_F8                 66
+#define KEY_F9                 67
+#define KEY_F10                        68
+#define KEY_NUMLOCK            69
+#define KEY_SCROLLLOCK         70
+#define KEY_KP7                        71
+#define KEY_KP8                        72
+#define KEY_KP9                        73
+#define KEY_KPMINUS            74
+#define KEY_KP4                        75
+#define KEY_KP5                        76
+#define KEY_KP6                        77
+#define KEY_KPPLUS             78
+#define KEY_KP1                        79
+#define KEY_KP2                        80
+#define KEY_KP3                        81
+#define KEY_KP0                        82
+#define KEY_KPDOT              83
+
+#define KEY_ZENKAKUHANKAKU     85
+#define KEY_102ND              86
+#define KEY_F11                        87
+#define KEY_F12                        88
+#define KEY_RO                 89
+#define KEY_KATAKANA           90
+#define KEY_HIRAGANA           91
+#define KEY_HENKAN             92
+#define KEY_KATAKANAHIRAGANA   93
+#define KEY_MUHENKAN           94
+#define KEY_KPJPCOMMA          95
+#define KEY_KPENTER            96
+#define KEY_RIGHTCTRL          97
+#define KEY_KPSLASH            98
+#define KEY_SYSRQ              99
+#define KEY_RIGHTALT           100
+#define KEY_LINEFEED           101
+#define KEY_HOME               102
+#define KEY_UP                 103
+#define KEY_PAGEUP             104
+#define KEY_LEFT               105
+#define KEY_RIGHT              106
+#define KEY_END                        107
+#define KEY_DOWN               108
+#define KEY_PAGEDOWN           109
+#define KEY_INSERT             110
+#define KEY_DELETE             111
+#define KEY_MACRO              112
+#define KEY_MUTE               113
+#define KEY_VOLUMEDOWN         114
+#define KEY_VOLUMEUP           115
+#define KEY_POWER              116     /* SC System Power Down */
+#define KEY_KPEQUAL            117
+#define KEY_KPPLUSMINUS                118
+#define KEY_PAUSE              119
+#define KEY_SCALE              120     /* AL Compiz Scale (Expose) */
+
+#define KEY_KPCOMMA            121
+#define KEY_HANGEUL            122
+#define KEY_HANGUEL            KEY_HANGEUL
+#define KEY_HANJA              123
+#define KEY_YEN                        124
+#define KEY_LEFTMETA           125
+#define KEY_RIGHTMETA          126
+#define KEY_COMPOSE            127
+#define KEY_FN                 0x1d0
+
+#endif
index ed4cf6cbcd507a8f53b7ed9bc68b8e2f0e84de60..7b749bbda708a8b6f1edcbbcd0becf21e566d2d7 100644 (file)
 #define SYMBOL_NAME_LABEL(X)   X:
 #endif
 
+#ifndef __ALIGN
 #define __ALIGN .align         4
+#endif
+
+#ifndef __ALIGN_STR
 #define __ALIGN_STR            ".align 4"
+#endif
 
 #ifdef __ASSEMBLY__
 
@@ -67,7 +72,7 @@
 
 #ifndef ENDPROC
 #define ENDPROC(name) \
-       .type name, @function; \
+       .type name STT_FUNC; \
        END(name)
 #endif
 
index 8cbcdae1143fa28ef406ce7dc795c8c0b6f8f7b8..5ccdb67ff4be53d62843adbb697e4e8b729123b9 100644 (file)
@@ -4,10 +4,10 @@
  *  NAND family Bad Block Management (BBM) header file
  *    - Bad Block Table (BBT) implementation
  *
- *  Copyright (c) 2005-2007 Samsung Electronics
+ *  Copyright © 2005 Samsung Electronics
  *  Kyungmin Park <kyungmin.park@samsung.com>
  *
- *  Copyright (c) 2000-2005
+ *  Copyright © 2000-2005
  *  Thomas Gleixner <tglx@linuxtronix.de>
  *
  * This program is free software; you can redistribute it and/or modify
 
 /**
  * struct nand_bbt_descr - bad block table descriptor
- * @param options      options for this descriptor
- * @param pages                the page(s) where we find the bbt, used with
- *                     option BBT_ABSPAGE when bbt is searched,
- *                     then we store the found bbts pages here.
- *                     Its an array and supports up to 8 chips now
- * @param offs         offset of the pattern in the oob area of the page
- * @param veroffs      offset of the bbt version counter in the oob are of the page
- * @param version      version read from the bbt page during scan
- * @param len          length of the pattern, if 0 no pattern check is performed
- * @param maxblocks    maximum number of blocks to search for a bbt. This number of
- *                     blocks is reserved at the end of the device
- *                     where the tables are written.
- * @param reserved_block_code  if non-0, this pattern denotes a reserved
- *                     (rather than bad) block in the stored bbt
- * @param pattern      pattern to identify bad block table or factory marked
- *                     good / bad blocks, can be NULL, if len = 0
+ * @options:   options for this descriptor
+ * @pages:     the page(s) where we find the bbt, used with option BBT_ABSPAGE
+ *             when bbt is searched, then we store the found bbts pages here.
+ *             Its an array and supports up to 8 chips now
+ * @offs:      offset of the pattern in the oob area of the page
+ * @veroffs:   offset of the bbt version counter in the oob are of the page
+ * @version:   version read from the bbt page during scan
+ * @len:       length of the pattern, if 0 no pattern check is performed
+ * @maxblocks: maximum number of blocks to search for a bbt. This number of
+ *             blocks is reserved at the end of the device where the tables are
+ *             written.
+ * @reserved_block_code: if non-0, this pattern denotes a reserved (rather than
+ *              bad) block in the stored bbt
+ * @pattern:   pattern to identify bad block table or factory marked good /
+ *             bad blocks, can be NULL, if len = 0
  *
  * Descriptor for the bad block table marker and the descriptor for the
  * pattern which identifies good and bad blocks. The assumption is made
@@ -114,22 +113,27 @@ struct nand_bbt_descr {
 /*
  * Constants for oob configuration
  */
-#define ONENAND_BADBLOCK_POS   0
+#define NAND_SMALL_BADBLOCK_POS                5
+#define NAND_LARGE_BADBLOCK_POS                0
+#define ONENAND_BADBLOCK_POS           0
 
 /*
  * Bad block scanning errors
  */
-#define ONENAND_BBT_READ_ERROR          1
-#define ONENAND_BBT_READ_ECC_ERROR      2
-#define ONENAND_BBT_READ_FATAL_ERROR    4
+#define ONENAND_BBT_READ_ERROR         1
+#define ONENAND_BBT_READ_ECC_ERROR     2
+#define ONENAND_BBT_READ_FATAL_ERROR   4
 
 /**
- * struct bbt_info - [GENERIC] Bad Block Table data structure
- * @param bbt_erase_shift      [INTERN] number of address bits in a bbt entry
- * @param badblockpos          [INTERN] position of the bad block marker in the oob area
- * @param bbt                  [INTERN] bad block table pointer
- * @param badblock_pattern     [REPLACEABLE] bad block scan pattern used for initial bad block scan
- * @param priv                 [OPTIONAL] pointer to private bbm date
+ * struct bbm_info - [GENERIC] Bad Block Table data structure
+ * @bbt_erase_shift:   [INTERN] number of address bits in a bbt entry
+ * @badblockpos:       [INTERN] position of the bad block marker in the oob area
+ * @options:           options for this descriptor
+ * @bbt:               [INTERN] bad block table pointer
+ * @isbad_bbt:         function to determine if a block is bad
+ * @badblock_pattern:  [REPLACEABLE] bad block scan pattern used for
+ *                     initial bad block scan
+ * @priv:              [OPTIONAL] pointer to private bbm date
  */
 struct bbm_info {
        int bbt_erase_shift;
@@ -138,7 +142,7 @@ struct bbm_info {
 
        uint8_t *bbt;
 
-       int (*isbad_bbt) (struct mtd_info * mtd, loff_t ofs, int allowbbt);
+       int (*isbad_bbt)(struct mtd_info *mtd, loff_t ofs, int allowbbt);
 
        /* TODO Add more NAND specific fileds */
        struct nand_bbt_descr *badblock_pattern;
@@ -147,7 +151,7 @@ struct bbm_info {
 };
 
 /* OneNAND BBT interface */
-extern int onenand_scan_bbt (struct mtd_info *mtd, struct nand_bbt_descr *bd);
-extern int onenand_default_bbt (struct mtd_info *mtd);
+extern int onenand_scan_bbt(struct mtd_info *mtd, struct nand_bbt_descr *bd);
+extern int onenand_default_bbt(struct mtd_info *mtd);
 
-#endif                         /* __LINUX_MTD_BBM_H */
+#endif /* __LINUX_MTD_BBM_H */
diff --git a/include/max8997_pmic.h b/include/max8997_pmic.h
new file mode 100644 (file)
index 0000000..17ae24e
--- /dev/null
@@ -0,0 +1,190 @@
+/*
+ *  Copyright (C) 2011 Samsung Electronics
+ *  Lukasz Majewski <l.majewski@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 __MAX8997_PMIC_H_
+#define __MAX8997_PMIC_H_
+
+/* MAX 8997 registers */
+enum {
+       MAX8997_REG_PMIC_ID0    = 0x00,
+       MAX8997_REG_PMIC_ID1    = 0x01,
+       MAX8997_REG_INTSRC      = 0x02,
+       MAX8997_REG_INT1        = 0x03,
+       MAX8997_REG_INT2        = 0x04,
+       MAX8997_REG_INT3        = 0x05,
+       MAX8997_REG_INT4        = 0x06,
+
+       MAX8997_REG_INT1MSK     = 0x08,
+       MAX8997_REG_INT2MSK     = 0x09,
+       MAX8997_REG_INT3MSK     = 0x0a,
+       MAX8997_REG_INT4MSK     = 0x0b,
+
+       MAX8997_REG_STATUS1     = 0x0d,
+       MAX8997_REG_STATUS2     = 0x0e,
+       MAX8997_REG_STATUS3     = 0x0f,
+       MAX8997_REG_STATUS4     = 0x10,
+
+       MAX8997_REG_MAINCON1    = 0x13,
+       MAX8997_REG_MAINCON2    = 0x14,
+       MAX8997_REG_BUCKRAMP    = 0x15,
+
+       MAX8997_REG_BUCK1CTRL   = 0x18,
+       MAX8997_REG_BUCK1DVS1   = 0x19,
+       MAX8997_REG_BUCK1DVS2   = 0x1a,
+       MAX8997_REG_BUCK1DVS3   = 0x1b,
+       MAX8997_REG_BUCK1DVS4   = 0x1c,
+       MAX8997_REG_BUCK1DVS5   = 0x1d,
+       MAX8997_REG_BUCK1DVS6   = 0x1e,
+       MAX8997_REG_BUCK1DVS7   = 0x1f,
+       MAX8997_REG_BUCK1DVS8   = 0x20,
+       MAX8997_REG_BUCK2CTRL   = 0x21,
+       MAX8997_REG_BUCK2DVS1   = 0x22,
+       MAX8997_REG_BUCK2DVS2   = 0x23,
+       MAX8997_REG_BUCK2DVS3   = 0x24,
+       MAX8997_REG_BUCK2DVS4   = 0x25,
+       MAX8997_REG_BUCK2DVS5   = 0x26,
+       MAX8997_REG_BUCK2DVS6   = 0x27,
+       MAX8997_REG_BUCK2DVS7   = 0x28,
+       MAX8997_REG_BUCK2DVS8   = 0x29,
+       MAX8997_REG_BUCK3CTRL   = 0x2a,
+       MAX8997_REG_BUCK3DVS    = 0x2b,
+       MAX8997_REG_BUCK4CTRL   = 0x2c,
+       MAX8997_REG_BUCK4DVS    = 0x2d,
+       MAX8997_REG_BUCK5CTRL   = 0x2e,
+       MAX8997_REG_BUCK5DVS1   = 0x2f,
+       MAX8997_REG_BUCK5DVS2   = 0x30,
+       MAX8997_REG_BUCK5DVS3   = 0x31,
+       MAX8997_REG_BUCK5DVS4   = 0x32,
+       MAX8997_REG_BUCK5DVS5   = 0x33,
+       MAX8997_REG_BUCK5DVS6   = 0x34,
+       MAX8997_REG_BUCK5DVS7   = 0x35,
+       MAX8997_REG_BUCK5DVS8   = 0x36,
+       MAX8997_REG_BUCK6CTRL   = 0x37,
+       MAX8997_REG_BUCK6BPSKIPCTRL     = 0x38,
+       MAX8997_REG_BUCK7CTRL   = 0x39,
+       MAX8997_REG_BUCK7DVS    = 0x3a,
+       MAX8997_REG_LDO1CTRL    = 0x3b,
+       MAX8997_REG_LDO2CTRL    = 0x3c,
+       MAX8997_REG_LDO3CTRL    = 0x3d,
+       MAX8997_REG_LDO4CTRL    = 0x3e,
+       MAX8997_REG_LDO5CTRL    = 0x3f,
+       MAX8997_REG_LDO6CTRL    = 0x40,
+       MAX8997_REG_LDO7CTRL    = 0x41,
+       MAX8997_REG_LDO8CTRL    = 0x42,
+       MAX8997_REG_LDO9CTRL    = 0x43,
+       MAX8997_REG_LDO10CTRL   = 0x44,
+       MAX8997_REG_LDO11CTRL   = 0x45,
+       MAX8997_REG_LDO12CTRL   = 0x46,
+       MAX8997_REG_LDO13CTRL   = 0x47,
+       MAX8997_REG_LDO14CTRL   = 0x48,
+       MAX8997_REG_LDO15CTRL   = 0x49,
+       MAX8997_REG_LDO16CTRL   = 0x4a,
+       MAX8997_REG_LDO17CTRL   = 0x4b,
+       MAX8997_REG_LDO18CTRL   = 0x4c,
+       MAX8997_REG_LDO21CTRL   = 0x4d,
+
+       MAX8997_REG_MBCCTRL1    = 0x50,
+       MAX8997_REG_MBCCTRL2    = 0x51,
+       MAX8997_REG_MBCCTRL3    = 0x52,
+       MAX8997_REG_MBCCTRL4    = 0x53,
+       MAX8997_REG_MBCCTRL5    = 0x54,
+       MAX8997_REG_MBCCTRL6    = 0x55,
+       MAX8997_REG_OTPCGHCVS   = 0x56,
+
+       MAX8997_REG_SAFEOUTCTRL = 0x5a,
+
+       MAX8997_REG_LBCNFG1     = 0x5e,
+       MAX8997_REG_LBCNFG2     = 0x5f,
+       MAX8997_REG_BBCCTRL     = 0x60,
+
+       MAX8997_REG_FLASH1_CUR  = 0x63, /* 0x63 ~ 0x6e for FLASH */
+       MAX8997_REG_FLASH2_CUR  = 0x64,
+       MAX8997_REG_MOVIE_CUR   = 0x65,
+       MAX8997_REG_GSMB_CUR    = 0x66,
+       MAX8997_REG_BOOST_CNTL  = 0x67,
+       MAX8997_REG_LEN_CNTL    = 0x68,
+       MAX8997_REG_FLASH_CNTL  = 0x69,
+       MAX8997_REG_WDT_CNTL    = 0x6a,
+       MAX8997_REG_MAXFLASH1   = 0x6b,
+       MAX8997_REG_MAXFLASH2   = 0x6c,
+       MAX8997_REG_FLASHSTATUS = 0x6d,
+       MAX8997_REG_FLASHSTATUSMASK     = 0x6e,
+
+       MAX8997_REG_GPIOCNTL1   = 0x70,
+       MAX8997_REG_GPIOCNTL2   = 0x71,
+       MAX8997_REG_GPIOCNTL3   = 0x72,
+       MAX8997_REG_GPIOCNTL4   = 0x73,
+       MAX8997_REG_GPIOCNTL5   = 0x74,
+       MAX8997_REG_GPIOCNTL6   = 0x75,
+       MAX8997_REG_GPIOCNTL7   = 0x76,
+       MAX8997_REG_GPIOCNTL8   = 0x77,
+       MAX8997_REG_GPIOCNTL9   = 0x78,
+       MAX8997_REG_GPIOCNTL10  = 0x79,
+       MAX8997_REG_GPIOCNTL11  = 0x7a,
+       MAX8997_REG_GPIOCNTL12  = 0x7b,
+
+       MAX8997_REG_LDO1CONFIG  = 0x80,
+       MAX8997_REG_LDO2CONFIG  = 0x81,
+       MAX8997_REG_LDO3CONFIG  = 0x82,
+       MAX8997_REG_LDO4CONFIG  = 0x83,
+       MAX8997_REG_LDO5CONFIG  = 0x84,
+       MAX8997_REG_LDO6CONFIG  = 0x85,
+       MAX8997_REG_LDO7CONFIG  = 0x86,
+       MAX8997_REG_LDO8CONFIG  = 0x87,
+       MAX8997_REG_LDO9CONFIG  = 0x88,
+       MAX8997_REG_LDO10CONFIG = 0x89,
+       MAX8997_REG_LDO11CONFIG = 0x8a,
+       MAX8997_REG_LDO12CONFIG = 0x8b,
+       MAX8997_REG_LDO13CONFIG = 0x8c,
+       MAX8997_REG_LDO14CONFIG = 0x8d,
+       MAX8997_REG_LDO15CONFIG = 0x8e,
+       MAX8997_REG_LDO16CONFIG = 0x8f,
+       MAX8997_REG_LDO17CONFIG = 0x90,
+       MAX8997_REG_LDO18CONFIG = 0x91,
+       MAX8997_REG_LDO21CONFIG = 0x92,
+
+       MAX8997_REG_DVSOKTIMER1 = 0x97,
+       MAX8997_REG_DVSOKTIMER2 = 0x98,
+       MAX8997_REG_DVSOKTIMER4 = 0x99,
+       MAX8997_REG_DVSOKTIMER5 = 0x9a,
+
+       PMIC_NUM_OF_REGS = 0x9b,
+};
+
+#define ENSAFEOUT1 (1 << 6)
+#define ENSAFEOUT2 (1 << 7)
+
+#define MAX8997_I2C_ADDR        (0xCC >> 1)
+#define MAX8997_RTC_ADDR       (0x0C >> 1)
+#define MAX8997_MUIC_ADDR      (0x4A >> 1)
+#define MAX8997_FG_ADDR        (0x6C >> 1)
+
+enum {
+       LDO_OFF = 0,
+       LDO_ON = 1,
+
+       DIS_LDO = (0x00 << 6),
+       EN_LDO = (0x3 << 6),
+};
+
+#endif /* __MAX8997_PMIC_H_ */
index 10c892a51df82d2d59fed3fc28b3abf992e5cf65..ca21f882c29344aae475cc967fc55255619ad3fe 100644 (file)
@@ -75,6 +75,7 @@ enum {
 };
 
 #define MAX8998_LDO3           (1 << 2)
+#define MAX8998_LDO4           (1 << 1)
 #define MAX8998_LDO8           (1 << 5)
 #define MAX8998_SAFEOUT1       (1 << 4)
 
diff --git a/include/mx2fb.h b/include/mx2fb.h
new file mode 100644 (file)
index 0000000..de05bc0
--- /dev/null
@@ -0,0 +1,47 @@
+/*
+ * Copyright (C) 2004-2010 Freescale Semiconductor, Inc.
+ */
+
+/*
+ * The code contained herein is licensed under the GNU General Public
+ * License. You may obtain a copy of the GNU General Public License
+ * Version 2 or later at the following locations:
+ *
+ * http://www.opensource.org/licenses/gpl-license.html
+ * http://www.gnu.org/copyleft/gpl.html
+ */
+
+/*!
+ * @file mx2fb.h
+ *
+ * @brief MX 25 LCD controller header file.
+ *
+ *
+ */
+
+#ifndef __MX2FB_H__
+#define __MX2FB_H__
+
+
+/* LCDC register settings */
+
+#define LCDC_LSCR 0x00120300
+
+#define LCDC_LRMCR 0x00000000
+
+#define LCDC_LDCR 0x00020010
+
+#define LCDC_LPCCR 0x00a9037f
+
+#define LCDC_LPCR 0xFA008B80
+
+#define LCDC_LPCR_PCD 0x4
+
+#define FB_SYNC_OE_LOW_ACT     0x80000000
+#define FB_SYNC_CLK_LAT_FALL   0x40000000
+#define FB_SYNC_DATA_INVERT    0x20000000
+#define FB_SYNC_CLK_IDLE_EN    0x10000000
+#define FB_SYNC_SHARP_MODE     0x08000000
+#define FB_SYNC_SWAP_RGB       0x04000000
+
+#endif                         /* __MX2FB_H__ */
diff --git a/include/mxc_keyb.h b/include/mxc_keyb.h
new file mode 100644 (file)
index 0000000..a4b0a4e
--- /dev/null
@@ -0,0 +1,201 @@
+/*
+ * Copyright 2004-2009 Freescale Semiconductor, Inc. All Rights Reserved.
+ */
+
+/*
+ * The code contained herein is licensed under the GNU General Public
+ * License. You may obtain a copy of the GNU General Public License
+ * Version 2 or later at the following locations:
+ *
+ * http://www.opensource.org/licenses/gpl-license.html
+ * http://www.gnu.org/copyleft/gpl.html
+ */
+
+/*!
+ * @defgroup keypad Keypad Driver
+ */
+
+/*!
+ * @file mxc_keyb.h
+ *
+ * @brief MXC keypad header file.
+ *
+ * @ingroup keypad
+ */
+#ifndef __MXC_KEYB_H__
+#define __MXC_KEYB_H__
+
+/*!
+ * Keypad Module Name
+ */
+#define MOD_NAME  "mxckpd"
+
+/*!
+ * Keypad irq number
+ */
+#define KPP_IRQ  MXC_INT_KPP
+
+/*!
+ * XLATE mode selection
+ */
+#define KEYPAD_XLATE        0
+
+/*!
+ * RAW mode selection
+ */
+#define KEYPAD_RAW          1
+
+/*!
+ * Maximum number of keys.
+ */
+#define MAXROW                 8
+#define MAXCOL                 8
+#define MXC_MAXKEY             (MAXROW * MAXCOL)
+
+/*!
+ * This define indicates break scancode for every key release. A constant
+ * of 128 is added to the key press scancode.
+ */
+#define  MXC_KEYRELEASE   128
+
+/*
+ * _reg_KPP_KPCR   _reg_KPP_KPSR _reg_KPP_KDDR _reg_KPP_KPDR
+ * Keypad Control Register Address
+ */
+#define KPCR    (KPP_BASE_ADDR + 0x00)
+
+/*
+ * Keypad Status Register Address
+ */
+#define KPSR    (KPP_BASE_ADDR + 0x02)
+
+/*
+ * Keypad Data Direction Address
+ */
+#define KDDR    (KPP_BASE_ADDR + 0x04)
+
+/*
+ * Keypad Data Register
+ */
+#define KPDR    (KPP_BASE_ADDR + 0x06)
+
+/*
+ * Key Press Interrupt Status bit
+ */
+#define KBD_STAT_KPKD        0x01
+
+/*
+ * Key Release Interrupt Status bit
+ */
+#define KBD_STAT_KPKR        0x02
+
+/*
+ * Key Depress Synchronizer Chain Status bit
+ */
+#define KBD_STAT_KDSC        0x04
+
+/*
+ * Key Release Synchronizer Status bit
+ */
+#define KBD_STAT_KRSS        0x08
+
+/*
+ * Key Depress Interrupt Enable Status bit
+ */
+#define KBD_STAT_KDIE        0x100
+
+/*
+ * Key Release Interrupt Enable
+ */
+#define KBD_STAT_KRIE        0x200
+
+/*
+ * Keypad Clock Enable
+ */
+#define KBD_STAT_KPPEN       0x400
+
+/*!
+ * Buffer size of keypad queue. Should be a power of 2.
+ */
+#define KPP_BUF_SIZE    128
+
+/*!
+ * Test whether bit is set for integer c
+ */
+#define TEST_BIT(c, n) ((c) & (0x1 << (n)))
+
+/*!
+ * Set nth bit in the integer c
+ */
+#define BITSET(c, n)   ((c) | (1 << (n)))
+
+/*!
+ * Reset nth bit in the integer c
+ */
+#define BITRESET(c, n) ((c) & ~(1 << (n)))
+
+enum KeyEvent {
+       KDepress,
+       KRelease
+};
+
+/*!
+ * This enum represents the keypad state machine to maintain debounce logic
+ * for key press/release.
+ */
+enum KeyState {
+
+       /*!
+        * Key press state.
+        */
+       KStateUp,
+
+       /*!
+        * Key press debounce state.
+        */
+       KStateFirstDown,
+
+       /*!
+        * Key release state.
+        */
+       KStateDown,
+
+       /*!
+        * Key release debounce state.
+        */
+       KStateFirstUp
+};
+
+/*!
+ * Keypad Private Data Structure
+ */
+typedef struct keypad_priv {
+
+       /*!
+        * Keypad state machine.
+        */
+       enum KeyState iKeyState;
+
+       /*!
+        * Number of rows configured in the keypad matrix
+        */
+       unsigned long kpp_rows;
+
+       /*!
+        * Number of Columns configured in the keypad matrix
+        */
+       unsigned long kpp_cols;
+} keypad_priv;
+
+/*!
+ * Keypad Data Structure
+ * */
+struct kpp_key_info {
+       enum KeyEvent evt;
+       unsigned short val;
+};
+
+int mxc_kpp_init(void);
+int mxc_kpp_getc(struct kpp_key_info *);
+
+#endif                         /* __MXC_KEYB_H__ */
index a48b1b8ed1a514831511303abca62cb48fccb96d..2f8e5f16668204c091caca5d73f9b8da8d04276d 100644 (file)
@@ -34,6 +34,9 @@
 #if defined(CONFIG_NAND_FSL_ELBC)
 #define CONFIG_SYS_NAND_SELF_INIT
 #endif
+#if defined(CONFIG_NAND_MXC)
+#define CONFIG_SYS_NAND_SELF_INIT
+#endif
 
 extern void nand_init(void);
 
index 4724717d99a58d94e411a39cbfbdb677717d3dc0..8a2cece24520e8638a0491ef6e0fe31ff91b7105 100644 (file)
@@ -204,6 +204,42 @@ struct mv88e61xx_config {
 int mv88e61xx_switch_initialize(struct mv88e61xx_config *swconfig);
 #endif /* CONFIG_MV88E61XX_SWITCH */
 
+#ifdef CONFIG_DRIVER_TI_CPSW
+
+enum {
+       CPSW_CTRL_VERSION_1 = 0, /* version1 devices */
+       CPSW_CTRL_VERSION_2      /* version2 devices */
+};
+
+struct cpsw_slave_data {
+       u32             slave_reg_ofs;
+       u32             sliver_reg_ofs;
+       int             phy_id;
+};
+
+struct cpsw_platform_data {
+       u32     mdio_base;
+       u32     cpsw_base;
+       int     mdio_div;
+       int     channels;       /* number of cpdma channels (symmetric) */
+       u32     cpdma_reg_ofs;  /* cpdma register offset                */
+       int     slaves;         /* number of slave cpgmac ports         */
+       u32     ale_reg_ofs;    /* address lookup engine reg offset     */
+       int     ale_entries;    /* ale table size                       */
+       u32     host_port_reg_ofs;      /* cpdma host port registers    */
+       u32     hw_stats_reg_ofs;       /* cpsw hw stats counters       */
+       u32     mac_control;
+       struct cpsw_slave_data  *slave_data;
+       void    (*control)(int enabled);
+       void    (*phy_init)(char *name, int addr);
+       u32     gigabit_en;     /* gigabit capable AND enabled          */
+       u32     host_port_num;
+       u8      version;
+};
+
+int cpsw_register(struct cpsw_platform_data *data);
+
+#endif /* CONFIG_DRIVER_TI_CPSW */
 /*
  * Allow FEC to fine-tune MII configuration on boards which require this.
  */
diff --git a/include/pata.h b/include/pata.h
new file mode 100644 (file)
index 0000000..ef14810
--- /dev/null
@@ -0,0 +1,35 @@
+#ifndef __PATA_H__
+#define __PATA_H__
+
+/*
+ * (C) Copyright 2008-2009 Freescale Semiconductor, Inc.
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+#include <linux/types.h>
+
+int init_pata(int dev);
+int scan_pata(int dev);
+ulong pata_read(int dev, ulong blknr, ulong blkcnt, void *buffer);
+ulong pata_write(int dev, ulong blknr, ulong blkcnt, const void *buffer);
+
+int pata_initialize();
+
+#endif
index 52a1526d951c407cc337bfd1f5426d3cd8212953..6a05b40aefe34f05a7bd1265772b7b0e2b7e4b3c 100644 (file)
@@ -55,6 +55,7 @@ struct pmic {
 };
 
 int pmic_init(void);
+int pmic_dialog_init(void);
 int check_reg(u32 reg);
 struct pmic *get_pmic(void);
 int pmic_probe(struct pmic *p);
diff --git a/include/tegra-kbc.h b/include/tegra-kbc.h
new file mode 100644 (file)
index 0000000..f331c79
--- /dev/null
@@ -0,0 +1,33 @@
+/*
+ * Copyright (c) 2011 The Chromium OS Authors. All rights reserved.
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#ifndef __include_tegra_kbc_h__
+#define __include_tegra_kbc_h__
+
+#include <common.h>
+
+#define KEY_IS_MODIFIER(key) ((key) >= KEY_FIRST_MODIFIER)
+
+struct kbc_tegra {
+       u32 control;
+       u32 interrupt;
+       u32 row_cfg[4];
+       u32 col_cfg[3];
+       u32 timeout_dly;
+       u32 init_dly;
+       u32 rpt_dly;
+       u32 kp_ent[2];
+       u32 row_mask[16];
+};
+
+#ifdef CONFIG_SYS_CONSOLE_OVERWRITE_ROUTINE
+extern int overwrite_console(void);
+#define OVERWRITE_CONSOLE overwrite_console()
+#else
+#define OVERWRITE_CONSOLE 0
+#endif /* CONFIG_SYS_CONSOLE_OVERWRITE_ROUTINE */
+
+#endif /* __include_tegra_kbc_h__ */
diff --git a/include/tps6586x.h b/include/tps6586x.h
new file mode 100644 (file)
index 0000000..ab88082
--- /dev/null
@@ -0,0 +1,68 @@
+/*
+ *  (C) Copyright 2010,2011
+ *  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 __H_
+#define _TPS6586X_H_
+
+enum {
+       /* SM0-2 PWM/PFM Mode Selection */
+       TPS6586X_PWM_SM0        = 1 << 0,
+       TPS6586X_PWM_SM1        = 1 << 1,
+       TPS6586X_PWM_SM2        = 1 << 2,
+};
+
+/**
+ * Enable PWM mode for selected SM0-2
+ *
+ * @param mask Mask of synchronous converter to enable (TPS6586X_PWM_...)
+ * @return 0 if ok, -1 on error
+ */
+int tps6586x_set_pwm_mode(int mask);
+
+/**
+ * Adjust SM0 and SM1 voltages to the given targets in incremental steps.
+ *
+ * @param sm0_target   Target voltage for SM0 in 25mW units, 0=725mV, 31=1.5V
+ * @param sm1_target   Target voltage for SM1 in 25mW units, 0=725mV, 31=1.5V
+ * @param step         Amount to change voltage in each step, in 25mW units
+ * @param rate         Slew ratein mV/us: 0=instantly, 1=0.11, 2=0.22,
+ *                     3=0.44, 4=0.88, 5=1.76, 6=3.52, 7=7.04
+ * @param min_sm0_over_sm1     Minimum amount by which sm0 must exceed sm1.
+ *                     If this condition is not met, no adjustment will be
+ *                     done and an error will be reported. Use -1 to skip
+ *                     this check.
+ * @return 0 if ok, -1 on error
+ */
+int tps6586x_adjust_sm0_sm1(int sm0_target, int sm1_target, int step, int rate,
+                           int min_sm0_over_sm1);
+
+/**
+ * Set up the TPS6586X I2C bus number. This will be used for all operations
+ * on the device. This function must be called before using other functions.
+ *
+ * @param bus  I2C bus number containing the TPS6586X chip
+ * @return 0 (always succeeds)
+ */
+int tps6586x_init(int bus);
+
+#endif /* _TPS6586X_H_ */
diff --git a/include/twl6035.h b/include/twl6035.h
new file mode 100644 (file)
index 0000000..e21ddba
--- /dev/null
@@ -0,0 +1,42 @@
+/*
+ * (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
+ */
+
+#include <common.h>
+#include <i2c.h>
+
+/* I2C chip addresses */
+#define TWL6035_CHIP_ADDR      0x48
+
+/* 0x1XY translates to page 1, register address 0xXY */
+#define LDO9_CTRL              0x60
+#define LDO9_VOLTAGE           0x61
+
+/* Bit field definitions for LDOx_CTRL */
+#define LDO_ON                 (1 << 4)
+#define LDO_MODE_SLEEP         (1 << 2)
+#define LDO_MODE_ACTIVE                (1 << 0)
+
+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);
diff --git a/include/wince.h b/include/wince.h
new file mode 100644 (file)
index 0000000..ff8d165
--- /dev/null
@@ -0,0 +1,426 @@
+/*
+ * Copyright (C) 2012 Lothar Waßmann <LW@KARO-electronics.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.
+ *
+ */
+#ifndef __WINCE_H__
+#define __WINCE_H__
+
+#define CE_DOFFSET             (net->align_offset + ETHER_HDR_SIZE + IP_HDR_SIZE)
+
+/* Bin image parse results */
+#define CE_PR_EOF      0
+#define CE_PR_MORE     1
+#define CE_PR_ERROR    2
+
+#pragma pack(1)
+
+/* Edbg BOOTME packet structures */
+typedef struct {
+       unsigned int    id;             /* Protocol identifier ("EDBG" on the wire) */
+       unsigned char   service;        /* Service identifier */
+       unsigned char   flags;          /* Flags (see defs below) */
+       unsigned char   seqNum;         /* For detection of dropped packets */
+       unsigned char   cmd;            /* For administrative messages */
+       uchar           data[];         /* Cmd specific data starts here (format is determined by
+                                        * Cmd, len is determined by UDP packet size)
+                                        */
+} eth_dbg_hdr;
+
+#define OFFSETOF(s,m)                                  ((unsigned int)&(((s*)0)->m))
+#define EDBG_DATA_OFFSET                               (OFFSETOF(eth_dbg_hdr, data))
+
+typedef struct {
+       unsigned char   versionMajor;   /* Bootloader version */
+       unsigned char   versionMinor;   /* Bootloader version */
+       unsigned char   macAddr[6];     /* Ether address of device (net byte order) */
+       unsigned int    ipAddr;         /* IP address of device (net byte order) */
+       char            platformId[17]; /* Platform Id string (NULL terminated) */
+       char            deviceName[17]; /* Device name string (NULL terminated). Should include
+                                        * platform and number based on Ether address
+                                        * (e.g. Odo42, CEPCLS2346, etc)
+                                        */
+       unsigned char   cpuId;          /* CPU identifier (upper nibble = type) */
+/* The following fields were added in CE 3.0 Platform Builder release */
+       unsigned char   bootmeVer;      /* BOOTME Version.
+                                        * Must be in the range 2 -> EDBG_CURRENT_BOOTME_VERSION,
+                                        * or remaining fields will be ignored by Eshell and defaults will be used.
+                                        */
+       unsigned int    bootFlags;      /* Boot Flags */
+       unsigned short  downloadPort;   /* Download Port (net byte order) (0 -> EDBG_DOWNLOAD_PORT) */
+       unsigned short  svcPort;        /* Service Port (net byte order) (0 -> EDBG_SVC_PORT) */
+} edbg_bootme_data;
+
+#define BOOTME_PKT_SIZE                        (EDBG_DATA_OFFSET + sizeof(edbg_bootme_data))
+
+// WinCE .BIN file format signature
+#define CE_BIN_SIGN    "B000FF\x0A"
+#define CE_BIN_SIGN_LEN        7
+
+typedef struct {
+       unsigned char sign[CE_BIN_SIGN_LEN];
+       unsigned int rtiPhysAddr;
+       unsigned int rtiPhysLen;
+} ce_bin_hdr;
+
+typedef struct {
+       unsigned int physAddr;
+       unsigned int physLen;
+       unsigned int chkSum;
+       unsigned char data[];
+} ce_bin_entry;
+
+// CE ROM image structures
+
+#define ROM_SIGNATURE_OFFSET           0x40    /* Offset from the image's physfirst address to the ROM signature. */
+#define ROM_SIGNATURE                  0x43454345 /* Signature 'CECE' (little endian) */
+#define ROM_TOC_POINTER_OFFSET         0x44    /* Offset from the image's physfirst address to the TOC pointer. */
+#define ROM_TOC_OFFSET_OFFSET          0x48    /* Offset from the image's physfirst address to the TOC offset (from physfirst). */
+
+typedef struct {
+       unsigned int    dllfirst;       /* first DLL address */
+       unsigned int    dlllast;        /* last DLL address */
+       unsigned int    physfirst;      /* first physical address */
+       unsigned int    physlast;       /* highest physical address */
+       unsigned int    nummods;        /* number of TOCentry's */
+       unsigned int    ramStart;       /* start of RAM */
+       unsigned int    ramFree;        /* start of RAM free space */
+       unsigned int    ramEnd;         /* end of RAM */
+       unsigned int    copyEntries;    /* number of copy section entries */
+       unsigned int    copyOffset;     /* offset to copy section */
+       unsigned int    profileLen;     /* length of PROFentries RAM */
+       unsigned int    profileOffset;  /* offset to PROFentries */
+       unsigned int    numfiles;       /* number of FILES */
+       unsigned int    kernelFlags;    /* optional kernel flags from ROMFLAGS .bib config option */
+       unsigned int    fsRamPercent;   /* Percentage of RAM used for filesystem */
+/* from FSRAMPERCENT .bib config option
+ * byte 0 = #4K chunks/Mbyte of RAM for filesystem 0-2Mbytes 0-255
+ * byte 1 = #4K chunks/Mbyte of RAM for filesystem 2-4Mbytes 0-255
+ * byte 2 = #4K chunks/Mbyte of RAM for filesystem 4-6Mbytes 0-255
+ * byte 3 = #4K chunks/Mbyte of RAM for filesystem > 6Mbytes 0-255
+ */
+       unsigned int    drivglobStart;  /* device driver global starting address */
+       unsigned int    drivglobLen;    /* device driver global length */
+       unsigned short  cpuType;        /* CPU (machine) Type */
+       unsigned short  miscFlags;      /* Miscellaneous flags */
+       void            *extensions;    /* pointer to ROM Header extensions */
+       unsigned int    trackingStart;  /* tracking memory starting address */
+       unsigned int    trackingLen;    /* tracking memory ending address */
+} ce_rom_hdr;
+
+/* Win32 FILETIME strcuture */
+typedef struct {
+    unsigned int       loDateTime;
+    unsigned int       hiDateTime;
+} ce_file_time;
+
+/* Table Of Contents entry structure */
+typedef struct {
+       unsigned int    fileAttributes;
+       ce_file_time    fileTime;
+       unsigned int    fileSize;
+       char            *fileName;
+       unsigned int    e32Offset;            /* Offset to E32 structure */
+       unsigned int    o32Offset;            /* Offset to O32 structure */
+       unsigned int    loadOffset;           /* MODULE load buffer offset */
+} ce_toc_entry;
+
+/* Extra information header block */
+typedef struct {
+       unsigned int    rva;            /* Virtual relative address of info    */
+       unsigned int    size;           /* Size of information block           */
+} e32_info;
+
+#define ROM_EXTRA      9
+
+typedef struct {
+       unsigned short  e32_objcnt;     /* Number of memory objects            */
+       unsigned short  e32_imageflags; /* Image flags                         */
+       unsigned int    e32_entryrva;   /* Relative virt. addr. of entry point */
+       unsigned int    e32_vbase;      /* Virtual base address of module      */
+       unsigned short  e32_subsysmajor;/* The subsystem major version number  */
+       unsigned short  e32_subsysminor;/* The subsystem minor version number  */
+       unsigned int    e32_stackmax;   /* Maximum stack size                  */
+       unsigned int    e32_vsize;      /* Virtual size of the entire image    */
+       unsigned int    e32_sect14rva;  /* section 14 rva */
+       unsigned int    e32_sect14size; /* section 14 size */
+       unsigned int    e32_timestamp;  /* Time EXE/DLL was created/modified   */
+       e32_info        e32_unit[ROM_EXTRA]; /* Array of extra info units      */
+       unsigned short  e32_subsys;     /* The subsystem type                  */
+} e32_rom;
+
+
+
+/* OS config msg */
+
+#define EDBG_FL_DBGMSG    0x01  /* Debug messages */
+#define EDBG_FL_PPSH      0x02  /* Text shell */
+#define EDBG_FL_KDBG      0x04  /* Kernel debugger */
+#define EDBG_FL_CLEANBOOT 0x08  /* Force a clean boot */
+
+typedef struct {
+       unsigned char   flags;           /* Flags that will be used to determine what features are
+                                         * enabled over ethernet (saved in driver globals by bootloader)
+                                         */
+       unsigned char   kitlTransport;   /* Tells KITL which transport to start */
+
+       /* The following specify addressing info, only valid if the corresponding
+        * flag is set in the Flags field.
+        */
+       unsigned int    dbgMsgIPAddr;
+       unsigned short  dbgMsgPort;
+       unsigned int    ppshIPAddr;
+       unsigned short  ppshPort;
+       unsigned int    kdbgIPAddr;
+       unsigned short  kdbgPort;
+} edbg_os_config_data;
+
+/* Driver globals structure
+ * Used to pass driver globals info from RedBoot to WinCE core
+ */
+#define DRV_GLB_SIGNATURE      0x424C4744      /* "DGLB" */
+#define STD_DRV_GLB_SIGNATURE  0x53475241      /* "ARGS" */
+
+typedef struct {
+       unsigned int    signature;              /* Signature */
+       unsigned int    flags;                  /* Misc flags */
+       unsigned int    ipAddr;                 /* IP address of device (net byte order) */
+       unsigned int    ipGate;                 /* IP address of gateway (net byte order) */
+       unsigned int    ipMask;                 /* Subnet mask */
+       unsigned char   macAddr[6];             /* Ether address of device (net byte order) */
+       edbg_os_config_data edbgConfig;         /* EDBG services info */
+} ce_driver_globals;
+
+#pragma pack(4)
+
+typedef struct
+{
+       unsigned long   signature;
+       unsigned short  oalVersion;
+       unsigned short  bspVersion;
+} OAL_ARGS_HEADER;
+
+typedef struct _DEVICE_LOCATION
+{
+       unsigned long IfcType;
+       unsigned long BusNumber;
+       unsigned long LogicalLoc;
+       void *PhysicalLoc;
+       unsigned long Pin;
+} DEVICE_LOCATION;
+
+typedef struct
+{
+       unsigned long flags;
+       DEVICE_LOCATION devLoc;
+       union {
+               struct {
+                       unsigned long baudRate;
+                       unsigned long dataBits;
+                       unsigned long stopBits;
+                       unsigned long parity;
+               };
+               struct {
+                       unsigned short mac[3];
+                       unsigned long ipAddress;
+                       unsigned long ipMask;
+                       unsigned long ipRoute;
+               };
+       };
+} OAL_KITL_ARGS;
+
+typedef struct
+{
+       OAL_ARGS_HEADER header;
+       char            deviceId[16];   // Device identification
+       OAL_KITL_ARGS   kitl;
+       char            mtdparts[];
+} ce_std_driver_globals;
+
+#pragma pack()
+
+typedef struct {
+       void         *rtiPhysAddr;
+       unsigned int rtiPhysLen;
+       void         *ePhysAddr;
+       unsigned int ePhysLen;
+       unsigned int eChkSum;
+
+       void         *eEntryPoint;
+       void         *eRamStart;
+       unsigned int eRamLen;
+       ce_driver_globals *eDrvGlb;
+
+       unsigned char parseState;
+       unsigned int parseChkSum;
+       int parseLen;
+       unsigned char *parsePtr;
+       int section;
+
+       int dataLen;
+       unsigned char *data;
+
+       int binLen;
+       int endOfBin;
+
+       edbg_os_config_data edbgConfig;
+} __attribute__((packed)) ce_bin;
+
+/* IPv4 support */
+
+/* Socket/connection information */
+struct sockaddr_in {
+       IPaddr_t sin_addr;
+       unsigned short sin_port;
+       unsigned short sin_family;
+       short          sin_len;
+};
+
+#define AF_INET                1
+#define INADDR_ANY     0
+#ifndef ETH_ALEN
+#define ETH_ALEN       6
+#endif
+
+typedef struct {
+       int verbose;
+       int link;
+       struct sockaddr_in locAddr;
+       struct sockaddr_in srvAddrSend;
+       struct sockaddr_in srvAddrRecv;
+       int gotJumpingRequest;
+       unsigned char seqNum;
+       unsigned short blockNum;
+       int dataLen;
+       int align_offset;
+       int got_packet_4me;
+       unsigned char data[PKTSIZE_ALIGN];
+} ce_net;
+
+struct timeval {
+       long    tv_sec;         /* seconds */
+       long    tv_usec;        /* and microseconds */
+};
+
+/* Default UDP ports used for Ethernet download and EDBG messages.  May be overriden
+ * by device in BOOTME message.
+ */
+#define  EDBG_DOWNLOAD_PORT                            980   /* For downloading images to bootloader via TFTP */
+#define  EDBG_SVC_PORT                                 981   /* Other types of transfers */
+
+/* Byte string for Id field (note - must not conflict with valid TFTP
+ * opcodes (0-5), as we share the download port with TFTP)
+ */
+#define EDBG_ID                                                        0x47424445 /* "EDBG" */
+
+/* Defs for reserved values of the Service field */
+#define EDBG_SVC_DBGMSG                0   /* Debug messages */
+#define EDBG_SVC_PPSH          1   /* Text shell and PPFS file system */
+#define EDBG_SVC_KDBG          2   /* Kernel debugger */
+#define EDBG_SVC_ADMIN         0xFF  /* Administrative messages */
+
+/* Commands */
+#define EDBG_CMD_READ_REQ      1       /* Read request */
+#define EDBG_CMD_WRITE_REQ     2       /* Write request */
+#define EDBG_CMD_WRITE         3       /* Host ack */
+#define EDBG_CMD_WRITE_ACK     4       /* Target ack */
+#define EDBG_CMD_ERROR         5       /* Error */
+
+/* Service Ids from 3-FE are used for user apps */
+#define NUM_DFLT_EDBG_SERVICES 3
+
+/* Size of send and receive windows (except for stop and wait mode) */
+#define EDBG_WINDOW_SIZE       8
+
+/* The window size can be negotiated up to this amount if a client provides
+* enough memory.
+ */
+#define EDBG_MAX_WINDOW_SIZE   16
+
+/* Max size for an EDBG frame.  Based on ethernet MTU - protocol overhead.
+* Limited to one MTU because we don't do IP fragmentation on device.
+ */
+#define EDBG_MAX_DATA_SIZE     1446
+
+/* Defs for Flags field. */
+#define EDBG_FL_FROM_DEV       0x01   /* Set if message is from the device */
+#define EDBG_FL_NACK           0x02   /* Set if frame is a nack */
+#define EDBG_FL_ACK                    0x04   /* Set if frame is an ack */
+#define EDBG_FL_SYNC           0x08   /* Can be used to reset sequence # to 0 */
+#define EDBG_FL_ADMIN_RESP     0x10    /* For admin messages, indicate whether this is a response */
+
+/* Definitions for Cmd field (used for administrative messages) */
+/* Msgs from device */
+#define EDBG_CMD_BOOTME                0   /* Initial bootup message from device */
+
+/* Msgs from PC */
+#define EDBG_CMD_SETDEBUG      1       /* Used to set debug zones on device (TBD) */
+#define EDBG_CMD_JUMPIMG       2       /* Command to tell bootloader to jump to existing
+                                        * flash or RAM image. Data is same as CMD_OS_CONFIG. */
+#define EDBG_CMD_OS_CONFIG     3       /* Configure OS for debug ethernet services */
+#define EDBG_CMD_QUERYINFO     4       /* "Ping" device, and return information (same fmt as bootme) */
+#define EDBG_CMD_RESET         5       /* Command to have platform perform SW reset (e.g. so it
+                                        * can be reprogrammed).  Support for this command is
+                                        * processor dependant, and may not be implemented
+                                        * on all platforms (requires HW mods for Odo).
+                                        */
+/* Msgs from device or PC */
+#define EDBG_CMD_SVC_CONFIG    6
+#define EDBG_CMD_SVC_DATA      7
+
+#define EDBG_CMD_DEBUGBREAK    8 /* Break into debugger */
+
+/* Structures for Data portion of EDBG packets */
+#define EDBG_MAX_DEV_NAMELEN   16
+
+/* BOOTME message - Devices broadcast this message when booted to request configuration */
+#define EDBG_CURRENT_BOOTME_VERSION    2
+
+/*
+ * Capability and boot Flags for dwBootFlags in EDBG_BOOTME_DATA
+ * LOWORD for boot flags, HIWORD for capability flags
+ */
+
+/* Always download image */
+#define EDBG_BOOTFLAG_FORCE_DOWNLOAD   0x00000001
+
+/* Support passive-kitl */
+#define EDBG_CAPS_PASSIVEKITL          0x00010000
+
+/* Defs for CPUId */
+#define EDBG_CPU_TYPE_SHX                              0x10
+#define EDBG_CPU_TYPE_MIPS                             0x20
+#define EDBG_CPU_TYPE_X86                              0x30
+#define EDBG_CPU_TYPE_ARM                              0x40
+#define EDBG_CPU_TYPE_PPC                              0x50
+#define EDBG_CPU_TYPE_THUMB                            0x60
+
+#define EDBG_CPU_SH3                                   (EDBG_CPU_TYPE_SHX  | 0)
+#define EDBG_CPU_SH4                                   (EDBG_CPU_TYPE_SHX  | 1)
+#define EDBG_CPU_R3000                                 (EDBG_CPU_TYPE_MIPS | 0)
+#define EDBG_CPU_R4101                                 (EDBG_CPU_TYPE_MIPS | 1)
+#define EDBG_CPU_R4102                                 (EDBG_CPU_TYPE_MIPS | 2)
+#define EDBG_CPU_R4111                                 (EDBG_CPU_TYPE_MIPS | 3)
+#define EDBG_CPU_R4200                                 (EDBG_CPU_TYPE_MIPS | 4)
+#define EDBG_CPU_R4300                                 (EDBG_CPU_TYPE_MIPS | 5)
+#define EDBG_CPU_R5230                                 (EDBG_CPU_TYPE_MIPS | 6)
+#define EDBG_CPU_R5432                                 (EDBG_CPU_TYPE_MIPS | 7)
+#define EDBG_CPU_i486                                  (EDBG_CPU_TYPE_X86  | 0)
+#define EDBG_CPU_SA1100                                        (EDBG_CPU_TYPE_ARM | 0)
+#define EDBG_CPU_ARM720                                        (EDBG_CPU_TYPE_ARM | 1)
+#define EDBG_CPU_PPC821                                        (EDBG_CPU_TYPE_PPC | 0)
+#define EDBG_CPU_PPC403                                        (EDBG_CPU_TYPE_PPC | 1)
+#define EDBG_CPU_THUMB720                              (EDBG_CPU_TYPE_THUMB | 0)
+#endif
index a0fec60a136a07388f4cf4d9b8c216b211c02881..1e8478f0312e1a4f9d81513a2ad9ec06272a70cf 100644 (file)
@@ -28,6 +28,7 @@ LIB   = $(obj)libgeneric.o
 ifndef CONFIG_SPL_BUILD
 COBJS-$(CONFIG_ADDR_MAP) += addr_map.o
 COBJS-$(CONFIG_BCH) += bch.o
+COBJS-$(CONFIG_AES) += aes.o
 COBJS-$(CONFIG_BZIP2) += bzlib.o
 COBJS-$(CONFIG_BZIP2) += bzlib_crctable.o
 COBJS-$(CONFIG_BZIP2) += bzlib_decompress.o
diff --git a/lib/aes.c b/lib/aes.c
new file mode 100644 (file)
index 0000000..7da9edb
--- /dev/null
+++ b/lib/aes.c
@@ -0,0 +1,598 @@
+/*
+ * Copyright (c) 2011 The Chromium OS Authors.
+ * (C) Copyright 2011 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
+ */
+
+/*
+ * advanced encryption standard
+ * author: karl malbrain, malbrain@yahoo.com
+ *
+ * This work, including the source code, documentation
+ * and related data, is placed into the public domain.
+ *
+ * The orginal author is Karl Malbrain.
+ *
+ * THIS SOFTWARE IS PROVIDED AS-IS WITHOUT WARRANTY
+ * OF ANY KIND, NOT EVEN THE IMPLIED WARRANTY OF
+ * MERCHANTABILITY. THE AUTHOR OF THIS SOFTWARE,
+ * ASSUMES _NO_ RESPONSIBILITY FOR ANY CONSEQUENCE
+ * RESULTING FROM THE USE, MODIFICATION, OR
+ * REDISTRIBUTION OF THIS SOFTWARE.
+*/
+
+#include <common.h>
+#include "aes.h"
+
+/* forward s-box */
+static const u8 sbox[256] = {
+       0x63, 0x7c, 0x77, 0x7b, 0xf2, 0x6b, 0x6f, 0xc5,
+       0x30, 0x01, 0x67, 0x2b, 0xfe, 0xd7, 0xab, 0x76,
+       0xca, 0x82, 0xc9, 0x7d, 0xfa, 0x59, 0x47, 0xf0,
+       0xad, 0xd4, 0xa2, 0xaf, 0x9c, 0xa4, 0x72, 0xc0,
+       0xb7, 0xfd, 0x93, 0x26, 0x36, 0x3f, 0xf7, 0xcc,
+       0x34, 0xa5, 0xe5, 0xf1, 0x71, 0xd8, 0x31, 0x15,
+       0x04, 0xc7, 0x23, 0xc3, 0x18, 0x96, 0x05, 0x9a,
+       0x07, 0x12, 0x80, 0xe2, 0xeb, 0x27, 0xb2, 0x75,
+       0x09, 0x83, 0x2c, 0x1a, 0x1b, 0x6e, 0x5a, 0xa0,
+       0x52, 0x3b, 0xd6, 0xb3, 0x29, 0xe3, 0x2f, 0x84,
+       0x53, 0xd1, 0x00, 0xed, 0x20, 0xfc, 0xb1, 0x5b,
+       0x6a, 0xcb, 0xbe, 0x39, 0x4a, 0x4c, 0x58, 0xcf,
+       0xd0, 0xef, 0xaa, 0xfb, 0x43, 0x4d, 0x33, 0x85,
+       0x45, 0xf9, 0x02, 0x7f, 0x50, 0x3c, 0x9f, 0xa8,
+       0x51, 0xa3, 0x40, 0x8f, 0x92, 0x9d, 0x38, 0xf5,
+       0xbc, 0xb6, 0xda, 0x21, 0x10, 0xff, 0xf3, 0xd2,
+       0xcd, 0x0c, 0x13, 0xec, 0x5f, 0x97, 0x44, 0x17,
+       0xc4, 0xa7, 0x7e, 0x3d, 0x64, 0x5d, 0x19, 0x73,
+       0x60, 0x81, 0x4f, 0xdc, 0x22, 0x2a, 0x90, 0x88,
+       0x46, 0xee, 0xb8, 0x14, 0xde, 0x5e, 0x0b, 0xdb,
+       0xe0, 0x32, 0x3a, 0x0a, 0x49, 0x06, 0x24, 0x5c,
+       0xc2, 0xd3, 0xac, 0x62, 0x91, 0x95, 0xe4, 0x79,
+       0xe7, 0xc8, 0x37, 0x6d, 0x8d, 0xd5, 0x4e, 0xa9,
+       0x6c, 0x56, 0xf4, 0xea, 0x65, 0x7a, 0xae, 0x08,
+       0xba, 0x78, 0x25, 0x2e, 0x1c, 0xa6, 0xb4, 0xc6,
+       0xe8, 0xdd, 0x74, 0x1f, 0x4b, 0xbd, 0x8b, 0x8a,
+       0x70, 0x3e, 0xb5, 0x66, 0x48, 0x03, 0xf6, 0x0e,
+       0x61, 0x35, 0x57, 0xb9, 0x86, 0xc1, 0x1d, 0x9e,
+       0xe1, 0xf8, 0x98, 0x11, 0x69, 0xd9, 0x8e, 0x94,
+       0x9b, 0x1e, 0x87, 0xe9, 0xce, 0x55, 0x28, 0xdf,
+       0x8c, 0xa1, 0x89, 0x0d, 0xbf, 0xe6, 0x42, 0x68,
+       0x41, 0x99, 0x2d, 0x0f, 0xb0, 0x54, 0xbb, 0x16
+};
+
+/* inverse s-box */
+static const u8 inv_sbox[256] = {
+       0x52, 0x09, 0x6a, 0xd5, 0x30, 0x36, 0xa5, 0x38,
+       0xbf, 0x40, 0xa3, 0x9e, 0x81, 0xf3, 0xd7, 0xfb,
+       0x7c, 0xe3, 0x39, 0x82, 0x9b, 0x2f, 0xff, 0x87,
+       0x34, 0x8e, 0x43, 0x44, 0xc4, 0xde, 0xe9, 0xcb,
+       0x54, 0x7b, 0x94, 0x32, 0xa6, 0xc2, 0x23, 0x3d,
+       0xee, 0x4c, 0x95, 0x0b, 0x42, 0xfa, 0xc3, 0x4e,
+       0x08, 0x2e, 0xa1, 0x66, 0x28, 0xd9, 0x24, 0xb2,
+       0x76, 0x5b, 0xa2, 0x49, 0x6d, 0x8b, 0xd1, 0x25,
+       0x72, 0xf8, 0xf6, 0x64, 0x86, 0x68, 0x98, 0x16,
+       0xd4, 0xa4, 0x5c, 0xcc, 0x5d, 0x65, 0xb6, 0x92,
+       0x6c, 0x70, 0x48, 0x50, 0xfd, 0xed, 0xb9, 0xda,
+       0x5e, 0x15, 0x46, 0x57, 0xa7, 0x8d, 0x9d, 0x84,
+       0x90, 0xd8, 0xab, 0x00, 0x8c, 0xbc, 0xd3, 0x0a,
+       0xf7, 0xe4, 0x58, 0x05, 0xb8, 0xb3, 0x45, 0x06,
+       0xd0, 0x2c, 0x1e, 0x8f, 0xca, 0x3f, 0x0f, 0x02,
+       0xc1, 0xaf, 0xbd, 0x03, 0x01, 0x13, 0x8a, 0x6b,
+       0x3a, 0x91, 0x11, 0x41, 0x4f, 0x67, 0xdc, 0xea,
+       0x97, 0xf2, 0xcf, 0xce, 0xf0, 0xb4, 0xe6, 0x73,
+       0x96, 0xac, 0x74, 0x22, 0xe7, 0xad, 0x35, 0x85,
+       0xe2, 0xf9, 0x37, 0xe8, 0x1c, 0x75, 0xdf, 0x6e,
+       0x47, 0xf1, 0x1a, 0x71, 0x1d, 0x29, 0xc5, 0x89,
+       0x6f, 0xb7, 0x62, 0x0e, 0xaa, 0x18, 0xbe, 0x1b,
+       0xfc, 0x56, 0x3e, 0x4b, 0xc6, 0xd2, 0x79, 0x20,
+       0x9a, 0xdb, 0xc0, 0xfe, 0x78, 0xcd, 0x5a, 0xf4,
+       0x1f, 0xdd, 0xa8, 0x33, 0x88, 0x07, 0xc7, 0x31,
+       0xb1, 0x12, 0x10, 0x59, 0x27, 0x80, 0xec, 0x5f,
+       0x60, 0x51, 0x7f, 0xa9, 0x19, 0xb5, 0x4a, 0x0d,
+       0x2d, 0xe5, 0x7a, 0x9f, 0x93, 0xc9, 0x9c, 0xef,
+       0xa0, 0xe0, 0x3b, 0x4d, 0xae, 0x2a, 0xf5, 0xb0,
+       0xc8, 0xeb, 0xbb, 0x3c, 0x83, 0x53, 0x99, 0x61,
+       0x17, 0x2b, 0x04, 0x7e, 0xba, 0x77, 0xd6, 0x26,
+       0xe1, 0x69, 0x14, 0x63, 0x55, 0x21, 0x0c, 0x7d
+};
+
+/* combined Xtimes2[Sbox[]] */
+static const u8 x2_sbox[256] = {
+       0xc6, 0xf8, 0xee, 0xf6, 0xff, 0xd6, 0xde, 0x91,
+       0x60, 0x02, 0xce, 0x56, 0xe7, 0xb5, 0x4d, 0xec,
+       0x8f, 0x1f, 0x89, 0xfa, 0xef, 0xb2, 0x8e, 0xfb,
+       0x41, 0xb3, 0x5f, 0x45, 0x23, 0x53, 0xe4, 0x9b,
+       0x75, 0xe1, 0x3d, 0x4c, 0x6c, 0x7e, 0xf5, 0x83,
+       0x68, 0x51, 0xd1, 0xf9, 0xe2, 0xab, 0x62, 0x2a,
+       0x08, 0x95, 0x46, 0x9d, 0x30, 0x37, 0x0a, 0x2f,
+       0x0e, 0x24, 0x1b, 0xdf, 0xcd, 0x4e, 0x7f, 0xea,
+       0x12, 0x1d, 0x58, 0x34, 0x36, 0xdc, 0xb4, 0x5b,
+       0xa4, 0x76, 0xb7, 0x7d, 0x52, 0xdd, 0x5e, 0x13,
+       0xa6, 0xb9, 0x00, 0xc1, 0x40, 0xe3, 0x79, 0xb6,
+       0xd4, 0x8d, 0x67, 0x72, 0x94, 0x98, 0xb0, 0x85,
+       0xbb, 0xc5, 0x4f, 0xed, 0x86, 0x9a, 0x66, 0x11,
+       0x8a, 0xe9, 0x04, 0xfe, 0xa0, 0x78, 0x25, 0x4b,
+       0xa2, 0x5d, 0x80, 0x05, 0x3f, 0x21, 0x70, 0xf1,
+       0x63, 0x77, 0xaf, 0x42, 0x20, 0xe5, 0xfd, 0xbf,
+       0x81, 0x18, 0x26, 0xc3, 0xbe, 0x35, 0x88, 0x2e,
+       0x93, 0x55, 0xfc, 0x7a, 0xc8, 0xba, 0x32, 0xe6,
+       0xc0, 0x19, 0x9e, 0xa3, 0x44, 0x54, 0x3b, 0x0b,
+       0x8c, 0xc7, 0x6b, 0x28, 0xa7, 0xbc, 0x16, 0xad,
+       0xdb, 0x64, 0x74, 0x14, 0x92, 0x0c, 0x48, 0xb8,
+       0x9f, 0xbd, 0x43, 0xc4, 0x39, 0x31, 0xd3, 0xf2,
+       0xd5, 0x8b, 0x6e, 0xda, 0x01, 0xb1, 0x9c, 0x49,
+       0xd8, 0xac, 0xf3, 0xcf, 0xca, 0xf4, 0x47, 0x10,
+       0x6f, 0xf0, 0x4a, 0x5c, 0x38, 0x57, 0x73, 0x97,
+       0xcb, 0xa1, 0xe8, 0x3e, 0x96, 0x61, 0x0d, 0x0f,
+       0xe0, 0x7c, 0x71, 0xcc, 0x90, 0x06, 0xf7, 0x1c,
+       0xc2, 0x6a, 0xae, 0x69, 0x17, 0x99, 0x3a, 0x27,
+       0xd9, 0xeb, 0x2b, 0x22, 0xd2, 0xa9, 0x07, 0x33,
+       0x2d, 0x3c, 0x15, 0xc9, 0x87, 0xaa, 0x50, 0xa5,
+       0x03, 0x59, 0x09, 0x1a, 0x65, 0xd7, 0x84, 0xd0,
+       0x82, 0x29, 0x5a, 0x1e, 0x7b, 0xa8, 0x6d, 0x2c
+};
+
+/* combined Xtimes3[Sbox[]] */
+static const u8 x3_sbox[256] = {
+       0xa5, 0x84, 0x99, 0x8d, 0x0d, 0xbd, 0xb1, 0x54,
+       0x50, 0x03, 0xa9, 0x7d, 0x19, 0x62, 0xe6, 0x9a,
+       0x45, 0x9d, 0x40, 0x87, 0x15, 0xeb, 0xc9, 0x0b,
+       0xec, 0x67, 0xfd, 0xea, 0xbf, 0xf7, 0x96, 0x5b,
+       0xc2, 0x1c, 0xae, 0x6a, 0x5a, 0x41, 0x02, 0x4f,
+       0x5c, 0xf4, 0x34, 0x08, 0x93, 0x73, 0x53, 0x3f,
+       0x0c, 0x52, 0x65, 0x5e, 0x28, 0xa1, 0x0f, 0xb5,
+       0x09, 0x36, 0x9b, 0x3d, 0x26, 0x69, 0xcd, 0x9f,
+       0x1b, 0x9e, 0x74, 0x2e, 0x2d, 0xb2, 0xee, 0xfb,
+       0xf6, 0x4d, 0x61, 0xce, 0x7b, 0x3e, 0x71, 0x97,
+       0xf5, 0x68, 0x00, 0x2c, 0x60, 0x1f, 0xc8, 0xed,
+       0xbe, 0x46, 0xd9, 0x4b, 0xde, 0xd4, 0xe8, 0x4a,
+       0x6b, 0x2a, 0xe5, 0x16, 0xc5, 0xd7, 0x55, 0x94,
+       0xcf, 0x10, 0x06, 0x81, 0xf0, 0x44, 0xba, 0xe3,
+       0xf3, 0xfe, 0xc0, 0x8a, 0xad, 0xbc, 0x48, 0x04,
+       0xdf, 0xc1, 0x75, 0x63, 0x30, 0x1a, 0x0e, 0x6d,
+       0x4c, 0x14, 0x35, 0x2f, 0xe1, 0xa2, 0xcc, 0x39,
+       0x57, 0xf2, 0x82, 0x47, 0xac, 0xe7, 0x2b, 0x95,
+       0xa0, 0x98, 0xd1, 0x7f, 0x66, 0x7e, 0xab, 0x83,
+       0xca, 0x29, 0xd3, 0x3c, 0x79, 0xe2, 0x1d, 0x76,
+       0x3b, 0x56, 0x4e, 0x1e, 0xdb, 0x0a, 0x6c, 0xe4,
+       0x5d, 0x6e, 0xef, 0xa6, 0xa8, 0xa4, 0x37, 0x8b,
+       0x32, 0x43, 0x59, 0xb7, 0x8c, 0x64, 0xd2, 0xe0,
+       0xb4, 0xfa, 0x07, 0x25, 0xaf, 0x8e, 0xe9, 0x18,
+       0xd5, 0x88, 0x6f, 0x72, 0x24, 0xf1, 0xc7, 0x51,
+       0x23, 0x7c, 0x9c, 0x21, 0xdd, 0xdc, 0x86, 0x85,
+       0x90, 0x42, 0xc4, 0xaa, 0xd8, 0x05, 0x01, 0x12,
+       0xa3, 0x5f, 0xf9, 0xd0, 0x91, 0x58, 0x27, 0xb9,
+       0x38, 0x13, 0xb3, 0x33, 0xbb, 0x70, 0x89, 0xa7,
+       0xb6, 0x22, 0x92, 0x20, 0x49, 0xff, 0x78, 0x7a,
+       0x8f, 0xf8, 0x80, 0x17, 0xda, 0x31, 0xc6, 0xb8,
+       0xc3, 0xb0, 0x77, 0x11, 0xcb, 0xfc, 0xd6, 0x3a
+};
+
+/*
+ * modular multiplication tables based on:
+ *
+ * Xtime2[x] = (x & 0x80 ? 0x1b : 0) ^ (x + x)
+ * Xtime3[x] = x^Xtime2[x];
+ */
+static const u8 x_time_9[256] = {
+       0x00, 0x09, 0x12, 0x1b, 0x24, 0x2d, 0x36, 0x3f,
+       0x48, 0x41, 0x5a, 0x53, 0x6c, 0x65, 0x7e, 0x77,
+       0x90, 0x99, 0x82, 0x8b, 0xb4, 0xbd, 0xa6, 0xaf,
+       0xd8, 0xd1, 0xca, 0xc3, 0xfc, 0xf5, 0xee, 0xe7,
+       0x3b, 0x32, 0x29, 0x20, 0x1f, 0x16, 0x0d, 0x04,
+       0x73, 0x7a, 0x61, 0x68, 0x57, 0x5e, 0x45, 0x4c,
+       0xab, 0xa2, 0xb9, 0xb0, 0x8f, 0x86, 0x9d, 0x94,
+       0xe3, 0xea, 0xf1, 0xf8, 0xc7, 0xce, 0xd5, 0xdc,
+       0x76, 0x7f, 0x64, 0x6d, 0x52, 0x5b, 0x40, 0x49,
+       0x3e, 0x37, 0x2c, 0x25, 0x1a, 0x13, 0x08, 0x01,
+       0xe6, 0xef, 0xf4, 0xfd, 0xc2, 0xcb, 0xd0, 0xd9,
+       0xae, 0xa7, 0xbc, 0xb5, 0x8a, 0x83, 0x98, 0x91,
+       0x4d, 0x44, 0x5f, 0x56, 0x69, 0x60, 0x7b, 0x72,
+       0x05, 0x0c, 0x17, 0x1e, 0x21, 0x28, 0x33, 0x3a,
+       0xdd, 0xd4, 0xcf, 0xc6, 0xf9, 0xf0, 0xeb, 0xe2,
+       0x95, 0x9c, 0x87, 0x8e, 0xb1, 0xb8, 0xa3, 0xaa,
+       0xec, 0xe5, 0xfe, 0xf7, 0xc8, 0xc1, 0xda, 0xd3,
+       0xa4, 0xad, 0xb6, 0xbf, 0x80, 0x89, 0x92, 0x9b,
+       0x7c, 0x75, 0x6e, 0x67, 0x58, 0x51, 0x4a, 0x43,
+       0x34, 0x3d, 0x26, 0x2f, 0x10, 0x19, 0x02, 0x0b,
+       0xd7, 0xde, 0xc5, 0xcc, 0xf3, 0xfa, 0xe1, 0xe8,
+       0x9f, 0x96, 0x8d, 0x84, 0xbb, 0xb2, 0xa9, 0xa0,
+       0x47, 0x4e, 0x55, 0x5c, 0x63, 0x6a, 0x71, 0x78,
+       0x0f, 0x06, 0x1d, 0x14, 0x2b, 0x22, 0x39, 0x30,
+       0x9a, 0x93, 0x88, 0x81, 0xbe, 0xb7, 0xac, 0xa5,
+       0xd2, 0xdb, 0xc0, 0xc9, 0xf6, 0xff, 0xe4, 0xed,
+       0x0a, 0x03, 0x18, 0x11, 0x2e, 0x27, 0x3c, 0x35,
+       0x42, 0x4b, 0x50, 0x59, 0x66, 0x6f, 0x74, 0x7d,
+       0xa1, 0xa8, 0xb3, 0xba, 0x85, 0x8c, 0x97, 0x9e,
+       0xe9, 0xe0, 0xfb, 0xf2, 0xcd, 0xc4, 0xdf, 0xd6,
+       0x31, 0x38, 0x23, 0x2a, 0x15, 0x1c, 0x07, 0x0e,
+       0x79, 0x70, 0x6b, 0x62, 0x5d, 0x54, 0x4f, 0x46
+};
+
+static const u8 x_time_b[256] = {
+       0x00, 0x0b, 0x16, 0x1d, 0x2c, 0x27, 0x3a, 0x31,
+       0x58, 0x53, 0x4e, 0x45, 0x74, 0x7f, 0x62, 0x69,
+       0xb0, 0xbb, 0xa6, 0xad, 0x9c, 0x97, 0x8a, 0x81,
+       0xe8, 0xe3, 0xfe, 0xf5, 0xc4, 0xcf, 0xd2, 0xd9,
+       0x7b, 0x70, 0x6d, 0x66, 0x57, 0x5c, 0x41, 0x4a,
+       0x23, 0x28, 0x35, 0x3e, 0x0f, 0x04, 0x19, 0x12,
+       0xcb, 0xc0, 0xdd, 0xd6, 0xe7, 0xec, 0xf1, 0xfa,
+       0x93, 0x98, 0x85, 0x8e, 0xbf, 0xb4, 0xa9, 0xa2,
+       0xf6, 0xfd, 0xe0, 0xeb, 0xda, 0xd1, 0xcc, 0xc7,
+       0xae, 0xa5, 0xb8, 0xb3, 0x82, 0x89, 0x94, 0x9f,
+       0x46, 0x4d, 0x50, 0x5b, 0x6a, 0x61, 0x7c, 0x77,
+       0x1e, 0x15, 0x08, 0x03, 0x32, 0x39, 0x24, 0x2f,
+       0x8d, 0x86, 0x9b, 0x90, 0xa1, 0xaa, 0xb7, 0xbc,
+       0xd5, 0xde, 0xc3, 0xc8, 0xf9, 0xf2, 0xef, 0xe4,
+       0x3d, 0x36, 0x2b, 0x20, 0x11, 0x1a, 0x07, 0x0c,
+       0x65, 0x6e, 0x73, 0x78, 0x49, 0x42, 0x5f, 0x54,
+       0xf7, 0xfc, 0xe1, 0xea, 0xdb, 0xd0, 0xcd, 0xc6,
+       0xaf, 0xa4, 0xb9, 0xb2, 0x83, 0x88, 0x95, 0x9e,
+       0x47, 0x4c, 0x51, 0x5a, 0x6b, 0x60, 0x7d, 0x76,
+       0x1f, 0x14, 0x09, 0x02, 0x33, 0x38, 0x25, 0x2e,
+       0x8c, 0x87, 0x9a, 0x91, 0xa0, 0xab, 0xb6, 0xbd,
+       0xd4, 0xdf, 0xc2, 0xc9, 0xf8, 0xf3, 0xee, 0xe5,
+       0x3c, 0x37, 0x2a, 0x21, 0x10, 0x1b, 0x06, 0x0d,
+       0x64, 0x6f, 0x72, 0x79, 0x48, 0x43, 0x5e, 0x55,
+       0x01, 0x0a, 0x17, 0x1c, 0x2d, 0x26, 0x3b, 0x30,
+       0x59, 0x52, 0x4f, 0x44, 0x75, 0x7e, 0x63, 0x68,
+       0xb1, 0xba, 0xa7, 0xac, 0x9d, 0x96, 0x8b, 0x80,
+       0xe9, 0xe2, 0xff, 0xf4, 0xc5, 0xce, 0xd3, 0xd8,
+       0x7a, 0x71, 0x6c, 0x67, 0x56, 0x5d, 0x40, 0x4b,
+       0x22, 0x29, 0x34, 0x3f, 0x0e, 0x05, 0x18, 0x13,
+       0xca, 0xc1, 0xdc, 0xd7, 0xe6, 0xed, 0xf0, 0xfb,
+       0x92, 0x99, 0x84, 0x8f, 0xbe, 0xb5, 0xa8, 0xa3
+};
+
+static const u8 x_time_d[256] = {
+       0x00, 0x0d, 0x1a, 0x17, 0x34, 0x39, 0x2e, 0x23,
+       0x68, 0x65, 0x72, 0x7f, 0x5c, 0x51, 0x46, 0x4b,
+       0xd0, 0xdd, 0xca, 0xc7, 0xe4, 0xe9, 0xfe, 0xf3,
+       0xb8, 0xb5, 0xa2, 0xaf, 0x8c, 0x81, 0x96, 0x9b,
+       0xbb, 0xb6, 0xa1, 0xac, 0x8f, 0x82, 0x95, 0x98,
+       0xd3, 0xde, 0xc9, 0xc4, 0xe7, 0xea, 0xfd, 0xf0,
+       0x6b, 0x66, 0x71, 0x7c, 0x5f, 0x52, 0x45, 0x48,
+       0x03, 0x0e, 0x19, 0x14, 0x37, 0x3a, 0x2d, 0x20,
+       0x6d, 0x60, 0x77, 0x7a, 0x59, 0x54, 0x43, 0x4e,
+       0x05, 0x08, 0x1f, 0x12, 0x31, 0x3c, 0x2b, 0x26,
+       0xbd, 0xb0, 0xa7, 0xaa, 0x89, 0x84, 0x93, 0x9e,
+       0xd5, 0xd8, 0xcf, 0xc2, 0xe1, 0xec, 0xfb, 0xf6,
+       0xd6, 0xdb, 0xcc, 0xc1, 0xe2, 0xef, 0xf8, 0xf5,
+       0xbe, 0xb3, 0xa4, 0xa9, 0x8a, 0x87, 0x90, 0x9d,
+       0x06, 0x0b, 0x1c, 0x11, 0x32, 0x3f, 0x28, 0x25,
+       0x6e, 0x63, 0x74, 0x79, 0x5a, 0x57, 0x40, 0x4d,
+       0xda, 0xd7, 0xc0, 0xcd, 0xee, 0xe3, 0xf4, 0xf9,
+       0xb2, 0xbf, 0xa8, 0xa5, 0x86, 0x8b, 0x9c, 0x91,
+       0x0a, 0x07, 0x10, 0x1d, 0x3e, 0x33, 0x24, 0x29,
+       0x62, 0x6f, 0x78, 0x75, 0x56, 0x5b, 0x4c, 0x41,
+       0x61, 0x6c, 0x7b, 0x76, 0x55, 0x58, 0x4f, 0x42,
+       0x09, 0x04, 0x13, 0x1e, 0x3d, 0x30, 0x27, 0x2a,
+       0xb1, 0xbc, 0xab, 0xa6, 0x85, 0x88, 0x9f, 0x92,
+       0xd9, 0xd4, 0xc3, 0xce, 0xed, 0xe0, 0xf7, 0xfa,
+       0xb7, 0xba, 0xad, 0xa0, 0x83, 0x8e, 0x99, 0x94,
+       0xdf, 0xd2, 0xc5, 0xc8, 0xeb, 0xe6, 0xf1, 0xfc,
+       0x67, 0x6a, 0x7d, 0x70, 0x53, 0x5e, 0x49, 0x44,
+       0x0f, 0x02, 0x15, 0x18, 0x3b, 0x36, 0x21, 0x2c,
+       0x0c, 0x01, 0x16, 0x1b, 0x38, 0x35, 0x22, 0x2f,
+       0x64, 0x69, 0x7e, 0x73, 0x50, 0x5d, 0x4a, 0x47,
+       0xdc, 0xd1, 0xc6, 0xcb, 0xe8, 0xe5, 0xf2, 0xff,
+       0xb4, 0xb9, 0xae, 0xa3, 0x80, 0x8d, 0x9a, 0x97
+};
+
+static const u8 x_time_e[256] = {
+       0x00, 0x0e, 0x1c, 0x12, 0x38, 0x36, 0x24, 0x2a,
+       0x70, 0x7e, 0x6c, 0x62, 0x48, 0x46, 0x54, 0x5a,
+       0xe0, 0xee, 0xfc, 0xf2, 0xd8, 0xd6, 0xc4, 0xca,
+       0x90, 0x9e, 0x8c, 0x82, 0xa8, 0xa6, 0xb4, 0xba,
+       0xdb, 0xd5, 0xc7, 0xc9, 0xe3, 0xed, 0xff, 0xf1,
+       0xab, 0xa5, 0xb7, 0xb9, 0x93, 0x9d, 0x8f, 0x81,
+       0x3b, 0x35, 0x27, 0x29, 0x03, 0x0d, 0x1f, 0x11,
+       0x4b, 0x45, 0x57, 0x59, 0x73, 0x7d, 0x6f, 0x61,
+       0xad, 0xa3, 0xb1, 0xbf, 0x95, 0x9b, 0x89, 0x87,
+       0xdd, 0xd3, 0xc1, 0xcf, 0xe5, 0xeb, 0xf9, 0xf7,
+       0x4d, 0x43, 0x51, 0x5f, 0x75, 0x7b, 0x69, 0x67,
+       0x3d, 0x33, 0x21, 0x2f, 0x05, 0x0b, 0x19, 0x17,
+       0x76, 0x78, 0x6a, 0x64, 0x4e, 0x40, 0x52, 0x5c,
+       0x06, 0x08, 0x1a, 0x14, 0x3e, 0x30, 0x22, 0x2c,
+       0x96, 0x98, 0x8a, 0x84, 0xae, 0xa0, 0xb2, 0xbc,
+       0xe6, 0xe8, 0xfa, 0xf4, 0xde, 0xd0, 0xc2, 0xcc,
+       0x41, 0x4f, 0x5d, 0x53, 0x79, 0x77, 0x65, 0x6b,
+       0x31, 0x3f, 0x2d, 0x23, 0x09, 0x07, 0x15, 0x1b,
+       0xa1, 0xaf, 0xbd, 0xb3, 0x99, 0x97, 0x85, 0x8b,
+       0xd1, 0xdf, 0xcd, 0xc3, 0xe9, 0xe7, 0xf5, 0xfb,
+       0x9a, 0x94, 0x86, 0x88, 0xa2, 0xac, 0xbe, 0xb0,
+       0xea, 0xe4, 0xf6, 0xf8, 0xd2, 0xdc, 0xce, 0xc0,
+       0x7a, 0x74, 0x66, 0x68, 0x42, 0x4c, 0x5e, 0x50,
+       0x0a, 0x04, 0x16, 0x18, 0x32, 0x3c, 0x2e, 0x20,
+       0xec, 0xe2, 0xf0, 0xfe, 0xd4, 0xda, 0xc8, 0xc6,
+       0x9c, 0x92, 0x80, 0x8e, 0xa4, 0xaa, 0xb8, 0xb6,
+       0x0c, 0x02, 0x10, 0x1e, 0x34, 0x3a, 0x28, 0x26,
+       0x7c, 0x72, 0x60, 0x6e, 0x44, 0x4a, 0x58, 0x56,
+       0x37, 0x39, 0x2b, 0x25, 0x0f, 0x01, 0x13, 0x1d,
+       0x47, 0x49, 0x5b, 0x55, 0x7f, 0x71, 0x63, 0x6d,
+       0xd7, 0xd9, 0xcb, 0xc5, 0xef, 0xe1, 0xf3, 0xfd,
+       0xa7, 0xa9, 0xbb, 0xb5, 0x9f, 0x91, 0x83, 0x8d
+};
+
+/*
+ * Exchanges columns in each of 4 rows
+ * row0 - unchanged, row1- shifted left 1,
+ * row2 - shifted left 2 and row3 - shifted left 3
+ */
+static void shift_rows(u8 *state)
+{
+       u8 tmp;
+
+       /* just substitute row 0 */
+       state[0] = sbox[state[0]];
+       state[4] = sbox[state[4]];
+       state[8] = sbox[state[8]];
+       state[12] = sbox[state[12]];
+
+       /* rotate row 1 */
+       tmp = sbox[state[1]];
+       state[1] = sbox[state[5]];
+       state[5] = sbox[state[9]];
+       state[9] = sbox[state[13]];
+       state[13] = tmp;
+
+       /* rotate row 2 */
+       tmp = sbox[state[2]];
+       state[2] = sbox[state[10]];
+       state[10] = tmp;
+       tmp = sbox[state[6]];
+       state[6] = sbox[state[14]];
+       state[14] = tmp;
+
+       /* rotate row 3 */
+       tmp = sbox[state[15]];
+       state[15] = sbox[state[11]];
+       state[11] = sbox[state[7]];
+       state[7] = sbox[state[3]];
+       state[3] = tmp;
+}
+
+/*
+ * restores columns in each of 4 rows
+ * row0 - unchanged, row1- shifted right 1,
+ * row2 - shifted right 2 and row3 - shifted right 3
+ */
+static void inv_shift_rows(u8 *state)
+{
+       u8 tmp;
+
+       /* restore row 0 */
+       state[0] = inv_sbox[state[0]];
+       state[4] = inv_sbox[state[4]];
+       state[8] = inv_sbox[state[8]];
+       state[12] = inv_sbox[state[12]];
+
+       /* restore row 1 */
+       tmp = inv_sbox[state[13]];
+       state[13] = inv_sbox[state[9]];
+       state[9] = inv_sbox[state[5]];
+       state[5] = inv_sbox[state[1]];
+       state[1] = tmp;
+
+       /* restore row 2 */
+       tmp = inv_sbox[state[2]];
+       state[2] = inv_sbox[state[10]];
+       state[10] = tmp;
+       tmp = inv_sbox[state[6]];
+       state[6] = inv_sbox[state[14]];
+       state[14] = tmp;
+
+       /* restore row 3 */
+       tmp = inv_sbox[state[3]];
+       state[3] = inv_sbox[state[7]];
+       state[7] = inv_sbox[state[11]];
+       state[11] = inv_sbox[state[15]];
+       state[15] = tmp;
+}
+
+/* recombine and mix each row in a column */
+static void mix_sub_columns(u8 *state)
+{
+       u8 tmp[4 * AES_STATECOLS];
+
+       /* mixing column 0 */
+       tmp[0] = x2_sbox[state[0]] ^ x3_sbox[state[5]] ^
+                sbox[state[10]] ^ sbox[state[15]];
+       tmp[1] = sbox[state[0]] ^ x2_sbox[state[5]] ^
+                x3_sbox[state[10]] ^ sbox[state[15]];
+       tmp[2] = sbox[state[0]] ^ sbox[state[5]] ^
+                x2_sbox[state[10]] ^ x3_sbox[state[15]];
+       tmp[3] = x3_sbox[state[0]] ^ sbox[state[5]] ^
+                sbox[state[10]] ^ x2_sbox[state[15]];
+
+       /* mixing column 1 */
+       tmp[4] = x2_sbox[state[4]] ^ x3_sbox[state[9]] ^
+                sbox[state[14]] ^ sbox[state[3]];
+       tmp[5] = sbox[state[4]] ^ x2_sbox[state[9]] ^
+                x3_sbox[state[14]] ^ sbox[state[3]];
+       tmp[6] = sbox[state[4]] ^ sbox[state[9]] ^
+                x2_sbox[state[14]] ^ x3_sbox[state[3]];
+       tmp[7] = x3_sbox[state[4]] ^ sbox[state[9]] ^
+                sbox[state[14]] ^ x2_sbox[state[3]];
+
+       /* mixing column 2 */
+       tmp[8] = x2_sbox[state[8]] ^ x3_sbox[state[13]] ^
+                sbox[state[2]] ^ sbox[state[7]];
+       tmp[9] = sbox[state[8]] ^ x2_sbox[state[13]] ^
+                x3_sbox[state[2]] ^ sbox[state[7]];
+       tmp[10] = sbox[state[8]] ^ sbox[state[13]] ^
+                 x2_sbox[state[2]] ^ x3_sbox[state[7]];
+       tmp[11] = x3_sbox[state[8]] ^ sbox[state[13]] ^
+                 sbox[state[2]] ^ x2_sbox[state[7]];
+
+       /* mixing column 3 */
+       tmp[12] = x2_sbox[state[12]] ^ x3_sbox[state[1]] ^
+                 sbox[state[6]] ^ sbox[state[11]];
+       tmp[13] = sbox[state[12]] ^ x2_sbox[state[1]] ^
+                 x3_sbox[state[6]] ^ sbox[state[11]];
+       tmp[14] = sbox[state[12]] ^ sbox[state[1]] ^
+                 x2_sbox[state[6]] ^ x3_sbox[state[11]];
+       tmp[15] = x3_sbox[state[12]] ^ sbox[state[1]] ^
+                 sbox[state[6]] ^ x2_sbox[state[11]];
+
+       memcpy(state, tmp, sizeof(tmp));
+}
+
+/* restore and un-mix each row in a column */
+static void inv_mix_sub_columns(u8 *state)
+{
+       u8 tmp[4 * AES_STATECOLS];
+       int  i;
+
+       /* restore column 0 */
+       tmp[0] = x_time_e[state[0]] ^ x_time_b[state[1]] ^
+                x_time_d[state[2]] ^ x_time_9[state[3]];
+       tmp[5] = x_time_9[state[0]] ^ x_time_e[state[1]] ^
+                x_time_b[state[2]] ^ x_time_d[state[3]];
+       tmp[10] = x_time_d[state[0]] ^ x_time_9[state[1]] ^
+                 x_time_e[state[2]] ^ x_time_b[state[3]];
+       tmp[15] = x_time_b[state[0]] ^ x_time_d[state[1]] ^
+                 x_time_9[state[2]] ^ x_time_e[state[3]];
+
+       /* restore column 1 */
+       tmp[4] = x_time_e[state[4]] ^ x_time_b[state[5]] ^
+                x_time_d[state[6]] ^ x_time_9[state[7]];
+       tmp[9] = x_time_9[state[4]] ^ x_time_e[state[5]] ^
+                x_time_b[state[6]] ^ x_time_d[state[7]];
+       tmp[14] = x_time_d[state[4]] ^ x_time_9[state[5]] ^
+                 x_time_e[state[6]] ^ x_time_b[state[7]];
+       tmp[3] = x_time_b[state[4]] ^ x_time_d[state[5]] ^
+                x_time_9[state[6]] ^ x_time_e[state[7]];
+
+       /* restore column 2 */
+       tmp[8] = x_time_e[state[8]] ^ x_time_b[state[9]] ^
+                x_time_d[state[10]] ^ x_time_9[state[11]];
+       tmp[13] = x_time_9[state[8]] ^ x_time_e[state[9]] ^
+                 x_time_b[state[10]] ^ x_time_d[state[11]];
+       tmp[2] = x_time_d[state[8]] ^ x_time_9[state[9]] ^
+                x_time_e[state[10]] ^ x_time_b[state[11]];
+       tmp[7] = x_time_b[state[8]] ^ x_time_d[state[9]] ^
+                x_time_9[state[10]] ^ x_time_e[state[11]];
+
+       /* restore column 3 */
+       tmp[12] = x_time_e[state[12]] ^ x_time_b[state[13]] ^
+                 x_time_d[state[14]] ^ x_time_9[state[15]];
+       tmp[1] = x_time_9[state[12]] ^ x_time_e[state[13]] ^
+                x_time_b[state[14]] ^ x_time_d[state[15]];
+       tmp[6] = x_time_d[state[12]] ^ x_time_9[state[13]] ^
+                x_time_e[state[14]] ^ x_time_b[state[15]];
+       tmp[11] = x_time_b[state[12]] ^ x_time_d[state[13]] ^
+                 x_time_9[state[14]] ^ x_time_e[state[15]];
+
+       for (i = 0; i < 4 * AES_STATECOLS; i++)
+               state[i] = inv_sbox[tmp[i]];
+}
+
+/*
+ * encrypt/decrypt columns of the key
+ * n.b. you can replace this with byte-wise xor if you wish.
+ */
+static void add_round_key(u32 *state, u32 *key)
+{
+       int idx;
+
+       for (idx = 0; idx < 4; idx++)
+               state[idx] ^= key[idx];
+}
+
+static u8 rcon[11] = {
+       0x00, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36
+};
+
+/* produce AES_STATECOLS bytes for each round */
+void aes_expand_key(u8 *key, u8 *expkey)
+{
+       u8 tmp0, tmp1, tmp2, tmp3, tmp4;
+       u32 idx;
+
+       memcpy(expkey, key, AES_KEYCOLS * 4);
+
+       for (idx = AES_KEYCOLS; idx < AES_STATECOLS * (AES_ROUNDS + 1); idx++) {
+               tmp0 = expkey[4*idx - 4];
+               tmp1 = expkey[4*idx - 3];
+               tmp2 = expkey[4*idx - 2];
+               tmp3 = expkey[4*idx - 1];
+               if (!(idx % AES_KEYCOLS)) {
+                       tmp4 = tmp3;
+                       tmp3 = sbox[tmp0];
+                       tmp0 = sbox[tmp1] ^ rcon[idx / AES_KEYCOLS];
+                       tmp1 = sbox[tmp2];
+                       tmp2 = sbox[tmp4];
+               } else if ((AES_KEYCOLS > 6) && (idx % AES_KEYCOLS == 4)) {
+                       tmp0 = sbox[tmp0];
+                       tmp1 = sbox[tmp1];
+                       tmp2 = sbox[tmp2];
+                       tmp3 = sbox[tmp3];
+               }
+
+               expkey[4*idx+0] = expkey[4*idx - 4*AES_KEYCOLS + 0] ^ tmp0;
+               expkey[4*idx+1] = expkey[4*idx - 4*AES_KEYCOLS + 1] ^ tmp1;
+               expkey[4*idx+2] = expkey[4*idx - 4*AES_KEYCOLS + 2] ^ tmp2;
+               expkey[4*idx+3] = expkey[4*idx - 4*AES_KEYCOLS + 3] ^ tmp3;
+       }
+}
+
+/* encrypt one 128 bit block */
+void aes_encrypt(u8 *in, u8 *expkey, u8 *out)
+{
+       u8 state[AES_STATECOLS * 4];
+       u32 round;
+
+       memcpy(state, in, AES_STATECOLS * 4);
+       add_round_key((u32 *)state, (u32 *)expkey);
+
+       for (round = 1; round < AES_ROUNDS + 1; round++) {
+               if (round < AES_ROUNDS)
+                       mix_sub_columns(state);
+               else
+                       shift_rows(state);
+
+               add_round_key((u32 *)state,
+                             (u32 *)expkey + round * AES_STATECOLS);
+       }
+
+       memcpy(out, state, sizeof(state));
+}
+
+void aes_decrypt(u8 *in, u8 *expkey, u8 *out)
+{
+       u8 state[AES_STATECOLS * 4];
+       int round;
+
+       memcpy(state, in, sizeof(state));
+
+       add_round_key((u32 *)state,
+                     (u32 *)expkey + AES_ROUNDS * AES_STATECOLS);
+       inv_shift_rows(state);
+
+       for (round = AES_ROUNDS; round--; ) {
+               add_round_key((u32 *)state,
+                             (u32 *)expkey + round * AES_STATECOLS);
+               if (round)
+                       inv_mix_sub_columns(state);
+       }
+
+       memcpy(out, state, sizeof(state));
+}
index bdec1a0d962b1ce256b60f65e12774a42dde376c..cc09e06c730d993c06f3cc5798ef02077807d979 100644 (file)
@@ -40,6 +40,9 @@ static const char * const compat_names[COMPAT_COUNT] = {
        COMPAT(NVIDIA_TEGRA20_USB, "nvidia,tegra20-ehci"),
        COMPAT(NVIDIA_TEGRA20_I2C, "nvidia,tegra20-i2c"),
        COMPAT(NVIDIA_TEGRA20_DVC, "nvidia,tegra20-i2c-dvc"),
+       COMPAT(NVIDIA_TEGRA20_EMC, "nvidia,tegra20-emc"),
+       COMPAT(NVIDIA_TEGRA20_EMC_TABLE, "nvidia,tegra20-emc-table"),
+       COMPAT(NVIDIA_TEGRA20_KBC, "nvidia,tegra20-kbc"),
 };
 
 const char *fdtdec_get_compatible(enum fdt_compat_id id)
@@ -133,6 +136,21 @@ int fdtdec_next_compatible(const void *blob, int node,
        return fdt_node_offset_by_compatible(blob, node, compat_names[id]);
 }
 
+int fdtdec_next_compatible_subnode(const void *blob, int node,
+               enum fdt_compat_id id, int *depthp)
+{
+       do {
+               node = fdt_next_node(blob, node, depthp);
+       } while (*depthp > 1);
+
+       /* If this is a direct subnode, and compatible, return it */
+       if (*depthp == 1 && 0 == fdt_node_check_compatible(
+                                               blob, node, compat_names[id]))
+               return node;
+
+       return -FDT_ERR_NOTFOUND;
+}
+
 int fdtdec_next_alias(const void *blob, const char *name,
                enum fdt_compat_id id, int *upto)
 {
@@ -363,6 +381,17 @@ int fdtdec_get_int_array(const void *blob, int node, const char *prop_name,
        return err;
 }
 
+const u32 *fdtdec_locate_array(const void *blob, int node,
+                              const char *prop_name, int count)
+{
+       const u32 *cell;
+       int err;
+
+       cell = get_prop_check_min_len(blob, node, prop_name,
+                                     sizeof(u32) * count, &err);
+       return err ? NULL : cell;
+}
+
 int fdtdec_get_bool(const void *blob, int node, const char *prop_name)
 {
        const s32 *cell;
@@ -448,3 +477,27 @@ int fdtdec_setup_gpio(struct fdt_gpio_state *gpio)
                return -1;
        return 0;
 }
+
+int fdtdec_get_byte_array(const void *blob, int node, const char *prop_name,
+               u8 *array, int count)
+{
+       const u8 *cell;
+       int err;
+
+       cell = get_prop_check_min_len(blob, node, prop_name, count, &err);
+       if (!err)
+               memcpy(array, cell, count);
+       return err;
+}
+
+const u8 *fdtdec_locate_byte_array(const void *blob, int node,
+                            const char *prop_name, int count)
+{
+       const u8 *cell;
+       int err;
+
+       cell = get_prop_check_min_len(blob, node, prop_name, count, &err);
+       if (err)
+               return NULL;
+       return cell;
+}
index 9e324769db12e07b49b4a6dda91c01487d1fa035..621c3752a280ee0a0c5f51c756d09cf934a6a8f8 100644 (file)
 #define CONFIG_DHCP_MIN_EXT_LEN 64
 #endif
 
-ulong          BootpID;
+static ulong           BootpID;
 int            BootpTry;
 #ifdef CONFIG_BOOTP_RANDOM_DELAY
-ulong          seed1, seed2;
+static ulong           seed1, seed2;
 #endif
 
 #if defined(CONFIG_CMD_DHCP)
-dhcp_state_t dhcp_state = INIT;
-unsigned long dhcp_leasetime = 0;
-IPaddr_t NetDHCPServerIP = 0;
+static dhcp_state_t dhcp_state = INIT;
+static unsigned long dhcp_leasetime = 0;
+static IPaddr_t NetDHCPServerIP = 0;
 static void DhcpHandler(uchar *pkt, unsigned dest, IPaddr_t sip, unsigned src,
                        unsigned len);
 
index 50625abea1839e6ecff7d04c8137a3ab6ca64c32..882a060969c7f9554a0b40ca6ca8e44fd37fe033 100644 (file)
@@ -56,13 +56,7 @@ typedef struct
  */
 
 /* bootp.c */
-extern ulong   BootpID;                /* ID of cur BOOTP request              */
-extern char    BootFile[128];          /* Boot file name                       */
 extern int     BootpTry;
-#ifdef CONFIG_BOOTP_RANDOM_DELAY
-extern ulong   seed1, seed2;           /* seed for random BOOTP delay          */
-#endif
-
 
 /* Send a BOOTP request */
 extern void    BootpRequest (void);
diff --git a/tools/elftosb/COPYING b/tools/elftosb/COPYING
new file mode 100644 (file)
index 0000000..f829e09
--- /dev/null
@@ -0,0 +1,28 @@
+Copyright (c) 2004-2010 Freescale Semiconductor, Inc.
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without modification,
+are permitted provided that the following conditions are met:
+
+* Redistributions of source code must retain the above copyright notice, this list
+  of conditions and the following disclaimer.
+    
+* Redistributions in binary form must reproduce the above copyright notice, this
+  list of conditions and the following disclaimer in the documentation and/or
+  other materials provided with the distribution.
+    
+* Neither the name of the Freescale Semiconductor, Inc. nor the names of its
+  contributors may be used to endorse or promote products derived from this
+  software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
+ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
diff --git a/tools/elftosb/ReadMe.txt b/tools/elftosb/ReadMe.txt
new file mode 100644 (file)
index 0000000..b1fe9bd
--- /dev/null
@@ -0,0 +1,45 @@
+elftosb 2.x read me
+-------------------
+
+Directories
+
+elftosb2 - elftosb 2.x
+sbtool - sbtool 1.x
+keygen - keygen 1.x
+common - source files common between elftosb2, sbtool, and keygen
+winsupport - files needed only by the windows build
+elftosb - old elftosb 1.x, does not use anything from common
+generatekeys - old key generation tool for elftosb 1.x
+decrypt - old decryption tool for elftosb 1.x
+unittests - old unit tests for elftosb 1.x
+test_files - test ELF and Srecord files
+old - contains old makefiles for elftosb 1.x
+
+Development
+
+The preferred way to work on elftosb and related tools is to use Xcode on Mac OS X. The
+elftosb.xcodeproj directory is an Xcode project "file". It has targets for elftosb,
+keygen, sbtool, and an aggregate target that builds all of the above. The main reason
+to use Xcode is that the project is set up so that the flex and bison input files are
+processed automatically and the output files compiled.
+
+The Windows project and Linux makefile are not configured to build the flex or bison
+source files. They simply use the output files copied into the elftosb2 directory.
+You can run flex or bison manually to generate these files if you don't want to use Xcode.
+If you do use the Xcode project and make changes to the .l or .y files, be sure to copy
+the output .cpp files into the elftosb2 directory before you move the changes to either
+Windows or Linux.
+
+Building
+
+On Windows, open the .sln file in Microsoft Visual Studio. The solution contains projects
+for each of the individual projects, including the old elftosb 1.x and related tools.
+
+For Linux, run 'make all' from within the top level elftosb directory. This will build only
+the new elftosb 2.x, sbtool, and keygen. The old makefile to build elftosb 1.x and its
+tools is located in the "old" directory.
+
+On Mac OS X just open the .xcodeproj project and build the "Everything" target.
+
+
+
diff --git a/tools/elftosb/bdfiles/basic_test_cmd.e b/tools/elftosb/bdfiles/basic_test_cmd.e
new file mode 100644 (file)
index 0000000..dbdad1f
--- /dev/null
@@ -0,0 +1,192 @@
+
+# ooh! test input command file for elftosb 2!
+
+options {
+       coalesce = yes;
+
+       # most elf files are GHS produced
+       toolset = "GHS";
+
+       # set versions
+       productVersion = "111.222.333";
+       componentVersion = "999.888.777";
+
+       # set file flags
+       flags = (1 << 0) | (1 << 1);
+}
+
+constants {
+       ocram_start = 0;
+       ocram_size = 256K;
+       ocram_end = ocram_start + ocram_size - 1;
+
+#      ocram = ocram_start .. ocram_end;
+#
+#      ocram = ocram_start +.. ocram_size;
+
+       string_addr = 0x4500;
+
+       # boot modes
+       USB_BM = 0;
+       JTAG_BM = 7;
+       newBootMode = USB_BM;
+}
+
+sources {
+       hello = extern(0);  # elf
+       redboot = extern(1);  # srec
+       hostlink = extern(2); # elf
+       sd_player = extern(3) ( toolset="GCC" ); # elf
+       datasrc = "test0.key"; # binary
+}
+
+section (0) {
+       # load dcd
+       load dcd {{ 00 11 22 33 }} > 0;
+
+       # same load without dcd
+       load {{ 00 11 22 33 }} > 0;
+
+       call 0xf000;
+
+    hab call 0xf0000000 (128);
+       hab jump 0;
+
+/*
+       # load a simple IVT to an absolute address
+       # this fills in the IVT self address field from the target address
+       load ivt (entry=hello:_start) > 0x1000;
+
+       # load simple IVT. the IVT self address is set explicitly in the IVT declaration,
+       # giving the IVT a natural address so you don't have to tell where to load it.
+       load ivt (entry=hello:_start, self=0x1000);
+
+       load ivt (entry=hello:_start, self=0x1000, csf=0x2000, dcd=0);
+
+       # Setting IVT entry point to the default entry point of a source file.
+       load ivt (entry=hostlink) > 0;
+
+       load ivt (entry=hello:_start, self=0x1000);
+       hab call 0x1000;
+
+       # Special syntax that combines the load and call into one statement.
+       hab call ivt(entry=hello:_start, self=0x1000);
+
+
+
+       load ivt (
+           entry = hello:_start,
+           csf = 0x2000
+       ) > 0x1000;
+
+       # All supported IVT fields.
+       load ivt (
+           entry = hello:,
+           dcd = 0,
+           boot_data = 0,
+           self = 0,
+           csf = 0
+       );
+
+       hab call ivt; # Call the last loaded IVT. */
+}
+
+section (32) {
+       # load a string to some address
+       load "some string" > string_addr;
+
+       # byte fill a region
+       load 0x55.b > ocram_start..ocram_end;
+
+       from hostlink {
+               load $*;
+       }
+
+       # jump to a symbol
+       jump hostlink:_start (100);
+}
+
+section (100)
+{
+       load redboot;
+       call redboot;
+}
+
+section(0x5a)
+{
+       load datasrc > 0..8;
+
+       from hostlink
+       {
+#              load $* ( $.ocram.*, ~$.sdram.* );
+
+#              load $.sdram.*;
+#              load $.ocram.*;
+
+               call :main;
+               call :_start;
+       }
+
+#      goto 0x5b;
+}
+
+section (0x5b)
+{
+#      load $* from sd_player;
+
+#      load hello$.text @ 64K;
+#      load hello$*
+
+       load $.text from hello > 0x10000;
+       call sd_player (0xdeadbeef);
+}
+
+section (0x5c)
+{
+       # these loads should produce fill commands with a
+       # length equal to the pattern word size
+       load 0x55.b > 0x200;
+       load 0x55aa.h > 0x400;
+       load 0x55aa66bb.w > 0x800;
+
+#      load 0x55.b to 0x200;
+#      load 0x55aa.h to 0x400;
+#      load 0x55aa66bb.w to 0x800;
+
+#      load 0x55.b @ 0x200;
+#      load 0x55aa.h @ 0x400;
+#      load 0x55aa66bb.w @ 0x800;
+
+#      load $.text from hello @ .;
+#      load hello$.text @ .;
+#      load hello$* @ .
+
+       # this should produce a fill command with a length
+       # of 0x100
+       load 0x4c8e.h > 0x100..0x200;
+
+#      load [ 0a 9b 77 66 55 44 33 22 11 00 ] @ 0x100;
+}
+
+# non-bootable section
+section (0x100) <= datasrc;
+
+#section (1K)
+#{
+#      load 0xff.b > hostlink:g_wUsbVID + 4;
+#
+#      load "Fred's Auto Service\x00" > hostlink:g_wUsbVendorName;
+#
+#      from sd_player
+#      {
+#              load [ 00 11 22 33 44 55 66 77 ] > :g_data + 16;
+#      }
+#
+##     (0x10 .. 0x20) + 5  ==  0x15 .. 0x25
+#}
+
+# section that switches modes
+section (2K)
+{
+       mode newBootMode;
+}
diff --git a/tools/elftosb/bdfiles/complex.bd b/tools/elftosb/bdfiles/complex.bd
new file mode 100644 (file)
index 0000000..4038a52
--- /dev/null
@@ -0,0 +1,260 @@
+/*
+ * Copyright (c) 2006 SigmaTel, Inc.
+ *
+ * elftosb boot description file that creates some complicated situations for
+ * the loader to handle. of course this is also a good test for elftosb itself.
+ */
+
+/* testing C style comments */
+// testing C++ style comments
+# testing shell style comments
+
+constants {
+       kProgressReportsImageFlag = 0x1;
+       
+       kPlayerDriveTag = 0xa0;
+       kHostlinkDriveTag = 0xb0;
+}
+
+options {
+       productVersion = "5.0.999";
+       componentVersion = "5.0.999";
+    
+    flags = kProgressReportsImageFlag;  // turn on progress reports
+       
+       secinfoClear = "ignore";
+}
+
+constants {
+    arg = 0xfeedf00d;
+    
+    callArg1 = 2;
+    callArg2 = 3;
+    
+    halfword = 10.h;
+    
+//    flag = 1;
+       
+       testboolexpr = 1 > 0;
+       
+       mainSizeIsDefined = defined(mainSize);
+}
+
+sources {
+    elffile = extern(0) (toolset="ghs");
+    binfile1 = extern(1);
+    binfile2 = extern(2);
+    foofile = "file.dat";
+    anotherfile = "another.dat";
+       srecfile = "test_files/sd_player_gcc.srec";
+}
+
+options {
+       driveTag = kPlayerDriveTag;
+       
+       some_option = defined(testboolexpr);
+}
+
+constants {
+       printMessageAddr = elffile:printMessage;
+       printMessageSize = sizeof(elffile:printMessage);
+       
+       // create const with address of main() in elffile
+       mainAddr = elffile:main;
+       
+       mainSize = sizeof(elffile:main);
+       
+       halfwordSize = sizeof(halfword);
+       
+       elf_startAddr = elffile:_start;
+       
+//     poop = exists(nonexistantfile);
+
+       binfile1size = sizeof(binfile1);
+}
+
+/*
+ * test s-record support
+ */
+section (0)
+{
+       load dcd {{ 00 11 22 33 }} > 0;
+       load srecfile;
+       call srecfile;
+}
+
+section(1; coalesce=true) {
+       
+       info "welcome to section 1!";
+       info "elffile path = $(elffile)";
+       info "mainSizeIsDefined = $(d:mainSizeIsDefined)";
+       info "printMessage = $(x:printMessageAddr)";
+       
+       info "size of binfile1 = $(binfile1size)";
+       
+       // can use symbol refs inside bool expressions in an if stmt
+       if elffile:main == 0
+       {
+               warning "$(elffile) does not seem to have a main() function";
+       }
+       else
+       {
+               info "address of main() of $(elffile) is $(x:mainAddr)";
+       }
+       
+       if defined(flag) && flag != 0
+       {
+               load 0x1234.h > 0..10K;
+       }
+       else
+       {
+               // print message using both decimal and hex formatting
+               warning "loading only halfword = $(d:halfword) [$(x:halfword)]!";
+               load halfword > 0..1K;
+       }
+       
+       info "size of main() in $(elffile) is $(mainSize)";
+       info "printMessage() size is $(printMessageSize)";
+       info "size of halfword = $(halfwordSize)";
+       
+       load 0xff.b > 32K..32K + sizeof(elffile:printMessage);
+       
+       from elffile {
+       load {{ 00 01 02 03 04 }} > 1K;
+               
+               // load all sections except .mytext
+               load ~$.mytext;
+               
+               // figure out where to go from here
+               call :maybeSwitchSections(callArg1);
+               
+               // print msg and loop
+               load "hi from section 1" > :szMsg;
+               call :printMessage(0);
+               
+               jump :hello(0);
+       }
+       
+       // erase a function in memory
+       load 0.w > (elffile:endOfLine)..(elffile:endOfLine + sizeof(elffile:endOfLine));
+}
+
+section(2; alignment=64K) {
+       // cause an error if testConst has not been set
+       if !defined(testConst)
+       {
+               error "testConst is not defined!";
+       }
+       
+    from elffile {
+        load "in section 2" > :szMsg;
+        call :printMessage();
+    }
+    
+    // load the contents of binfile1 into the upper 128KB of ocram
+    load binfile1 > 128K..192K;
+    
+    from elffile {
+        load "loaded binfile1" > :szMsg;
+        call :printMessage(0);
+        
+        call :maybeSwitchSections(callArg2);
+        
+        jump :endOfLine(2);
+    }
+}
+
+// non-bootable section between two bootable sections
+section(0xbeef; alignment=32K, cleartext=false) <= binfile2;
+
+section(3; alignment=8K) {
+    // load our special section
+    load $.mytext from elffile;
+    call elffile:countToN(5);
+    
+       if (exists(foofile) && exists(anotherfile))
+       {
+               // a trainload of beef!
+               load 0xbeef.h > 128K..192K;
+       }
+       else if (exists(elffile) && callArg1 == 2)
+       {
+               // aaaaaaah!
+               load 0x12345678.w > 128K..192K;
+       }
+       else
+       {
+               from elffile
+               {
+                       // aaaaaaah!
+                       load 0xaaaa.h > 128K..192K;
+                       load $.text;
+                       load 0xbbbb.h > 128K..192K;
+               }
+       }
+    
+    from elffile {
+        load "hold on now, in section 3" > :szMsg;
+        call :printMessage(0);
+        
+        jump :endOfLine(3);
+    }
+    
+    from elffile {
+       load elffile;
+       load elffile > .;
+       load elffile[ $.bss ] > elffile:countToN;
+//             load [ $.bss ] > (elffile:countToN)..(elffile:countToN + sizeof(elffile:countToN));
+       call elffile;
+       call elffile(1);
+    }
+    
+    info "address of _start in $(elffile) is $(elf_startAddr)";
+}
+
+section ('four'; alignment=8K, sectionFlags=0x1000) <= binfile1;
+
+section ('five'; alignment=8K, cleartext=1, sectionFlags=0x1000) <= binfile1;
+
+/*
+ * create a data section out of some sections of an elf file
+ */
+section (1234) <= ~$.bss, ~$.data from elffile;
+section (4321) <= elffile [ $* ];
+section (1111) <= elffile;
+
+/* test data sections from various data sources */
+section (0xaa) <= 0x12345678.w;
+section (0xbb) <= "hi there! this is a data section.";
+section (0xcc) <= {{ aa55aa55aa55aa55aa55aa55aa55aa55 }};
+
+
+section (2345)
+{
+       load elffile[ $*.text*, ~$.sdram* ];
+}
+
+
+section ('six_')
+{
+       // load a blob at address 0x1000
+       load {{
+               00 0a 07 b0 bb ff 03 78
+               00 0a 07 b0 bb ff 03 78
+               00 0a 07 b0 bb ff 03 78
+               00 0a 07 b0 bb ff 03 78
+               00 0a 07 b0 bb ff 03 78
+       }} > 0x1000;
+}
+
+section ('bad_')
+{
+       // uncomment to test better error reporting for files that failed to open
+//     load foofile;
+}
+
+//section (2345) <= {{ 00 11 22 33 44 55 }};
+
+
+
+
diff --git a/tools/elftosb/bdfiles/habtest.bd b/tools/elftosb/bdfiles/habtest.bd
new file mode 100644 (file)
index 0000000..25fc8de
--- /dev/null
@@ -0,0 +1,36 @@
+sources {
+    elffile = extern(0) (toolset="ghs");
+    redboot = extern(1);
+    hostlink = extern(2);
+       srecfile = "test_files/sd_player_gcc.srec";
+}
+
+constants {
+    IVT_ADDR = 0x1000;
+}
+
+section (0)
+{
+
+    load hostlink;
+    call hostlink;
+
+    load dcd {{ 00 11 22 33 }} > 0x100;
+
+    load ivt (
+        entry = elffile:_start
+//        dcd = 0x2000,
+//        csf = 0x3000,
+//        boot_data = 0x55aa55aa.w
+//        self = IVT_ADDR
+    ) > IVT_ADDR;
+
+    hab call IVT_ADDR;
+
+    load ivt (entry=hostlink:_start, self=IVT_ADDR);
+
+    hab jump IVT_ADDR;
+}
+
+
+
diff --git a/tools/elftosb/bdfiles/simple.e b/tools/elftosb/bdfiles/simple.e
new file mode 100644 (file)
index 0000000..65ac5e8
--- /dev/null
@@ -0,0 +1,8 @@
+options {}\r
+\r
+# create a section\r
+section (0) {\r
+    load 0 > 0..256K;\r
+    load "hello world!" > 0x1000;\r
+}\r
+\r
diff --git a/tools/elftosb/bdfiles/test_cmd.e b/tools/elftosb/bdfiles/test_cmd.e
new file mode 100644 (file)
index 0000000..29af510
--- /dev/null
@@ -0,0 +1,120 @@
+
+# ooh! test input command file for elftosb 2!
+
+options {
+       searchPath = "elftosb2:elftosb2/elf_test_files";
+       
+       maximumLoadBlock = 4K;
+       sectionAlign = 4K;
+       
+       productVersion = "4.4.720";
+       componentVersion = "4.4.999";
+       
+       coalesce = yes;
+}
+
+constants {
+       ocram_start = 0;
+       ocram_size = 256K;
+       ocram_end = ocram_start + ocram_size - 1;
+       
+       prec_test = 1 + 5 * 10;
+       paren_test = (1 + 5) * 10;
+       
+       a = 123;
+       foo = (1 + 0x1cf1.w).w ^ 5 + a;
+       
+       bar1 = 0xa << 2;
+       bar2 = bar1 | 0x1000;
+       bar3 = bar2 & 0x5555;
+       bar4 = bar3 >> 1;
+       
+       mod = 35 % 16;
+       
+       n = -1;
+       x = 1 + -2;
+       
+       c1 = 'x';
+       c2 = 'oh';
+       c4 = 'shit';
+       
+       # test int size promotion
+       x = 0xff.b;
+       y = 0x1234.h;
+       z = 0x55aa55aa.w;
+       xx = x - (x / 2.b);     # should produce byte
+       xy = x + y;                     # should produce half-word
+       xz = x - z;                     # should produce word
+       yz = y + z;                     # should produce word
+       xh = x.h;
+       xw = x.w;
+}
+
+sources {
+       hostlink = extern(0);
+       redboot = extern(1);
+       
+       sd_player_elf="elftosb2/elf_test_files/sd_player_gcc";
+       sd_player_srec="elftosb2/elf_test_files/sd_player_gcc.srec";
+       
+       datafile="elftosb2/elf_test_files/hello_NOR_arm";
+}
+
+#section('foo!') {
+#      load 0.w > ocram_start..ocram_end;      # word fill all ocram with 0
+#      
+#      load hostlink;                                  # load all of hostlink source
+#      
+#      load 0x1000ffff.w > 0x1000;             # load a word to address 0x1000
+#      load 0x55aa.h > 0x2000;                 # load a half-word to address 0x2000
+#      load redboot;                                   # load all sections of redboot source
+#      
+#      from hostlink {
+#         load $.*.text;                               # load some sections to their natural location
+#         call :_start;                                # call function "_start" from hostlink
+#         call hostlink:foofn;                 # call function "foofn" from hostlink
+#         
+#         call :monkey (1 + 1);                # call function "monkey" from hostlink with an argument
+#         
+#         load $* > .;                                 # load all sections of hostlink to their natural location
+#         
+#         load $.text > 0x1000;                # load .text section to address 0x1000
+#         
+#         load 0x55.b > 0x0..0x4000;   # fill 0 through 0x4000 with byte pattern 0x55
+#      }
+#      
+#      load $*.text from hostlink > .; # load sections match "*.text" from hostlink to default places
+#      
+#      jump redboot;                                   # jump to entry point of redboot source
+#}
+
+## this section...
+#section(2) {
+#      from sd_player_elf {
+#              load $* > .;
+#              call :_start();
+#      }
+#}
+#
+## and this one are both equivalent except for section ids
+#section(3) {
+#      load $* from sd_player_elf;
+#      call sd_player_elf:_start();
+#}
+#
+#section(100) {
+#    # set the value of a symbol
+#    load hostlink;
+#    load 0x5555.h > hostlink:g_USBPID;
+#    
+#    # load a string to memory
+#    load "this is a string" > 0x1e0;
+#}
+
+section (32) {
+       load sd_player_srec;
+       call sd_player_srec;
+}
+
+#section('rsrc') <= datafile;
+
diff --git a/tools/elftosb/common/AESKey.cpp b/tools/elftosb/common/AESKey.cpp
new file mode 100644 (file)
index 0000000..eedab32
--- /dev/null
@@ -0,0 +1,78 @@
+/*
+ * File:       AESKey.cpp
+ *
+ * Copyright (c) Freescale Semiconductor, Inc. All rights reserved.
+ * See included license file for license details.
+ */
+
+#include "AESKey.h"
+#include <stdexcept>
+#include "smart_ptr.h"
+#include "HexValues.h"
+#include <ctype.h>
+
+//! The data from the stream is expected to be hex encoded. Each two characters
+//! from the stream encode a single result byte. All non-hexadecimal characters
+//! are ignored, including newlines. Every two hexadecimal characters form
+//! an encoded byte. This is true even if the two characters representing the
+//! upper and lower nibbles are separated by whitespace or other characters.
+//!
+//! \post The stream read head is left pointing just after the last encoded byte.
+//!
+//! \param stream Input stream to read from.
+//! \param bytes Number of encoded bytes to read. This is the number of \e
+//!            result bytes, not the count of bytes to read from the stream.
+//! \param[out] buffer Pointer to the buffer where decoded data is written.
+//!
+//! \exception std::runtime_error This exception will be thrown if less
+//!            data than required is available from \a stream, or if some other
+//!            error occurs while reading from \a stream.
+void AESKeyBase::_readFromStream(std::istream & stream, unsigned bytes, uint8_t * buffer)
+{
+       char temp[2];
+       char c;
+       char n = 0;
+       
+       while (bytes)
+       {
+               if (stream.get(c).fail())
+               {
+                       throw std::runtime_error("not enough data in stream");
+               }
+               
+               if (isHexDigit(c))
+               {
+                       temp[n++] = c;
+                       if (n == 2)
+                       {
+                               *buffer++ = hexByteToInt(temp);
+                               bytes--;
+                               n = 0;
+                       }
+               }
+       }
+}
+
+//! Key data is written to \a stream as a sequence of hex encoded octets, each two
+//! characters long. No spaces or newlines are inserted between the encoded octets
+//! or at the end of the sequence.
+//!
+//! \exception std::runtime_error Thrown if the \a stream reports an error while
+//!            writing the key data.
+void AESKeyBase::_writeToStream(std::ostream & stream, unsigned bytes, const uint8_t * buffer)
+{
+       const char hexChars[] = "0123456789ABCDEF";
+       while (bytes--)
+       {
+               uint8_t thisByte = *buffer++;
+               char byteString[2];
+               byteString[0] = hexChars[(thisByte & 0xf0) >> 4];
+               byteString[1] = hexChars[thisByte & 0x0f];
+               if (stream.write(byteString, 2).bad())
+               {
+                       throw std::runtime_error("error while writing to stream");
+               }
+       }
+}
+
+
diff --git a/tools/elftosb/common/AESKey.h b/tools/elftosb/common/AESKey.h
new file mode 100644 (file)
index 0000000..b92b1ae
--- /dev/null
@@ -0,0 +1,144 @@
+/*
+ * File:       AESKey.h
+ *
+ * Copyright (c) Freescale Semiconductor, Inc. All rights reserved.
+ * See included license file for license details.
+ */
+#if !defined(_AESKey_h_)
+#define _AESKey_h_
+
+#include "stdafx.h"
+#include <string.h>
+#include <iostream>
+#include "Random.h"
+
+//! An AES-128 key is 128 bits, or 16 bytes.
+typedef uint8_t aes128_key_t[16];
+
+/*!
+ * \brief Base class for AESKey<S>.
+ *
+ * This class implements some bigger, non-template methods used in the
+ * AESKey<S> templated subclass.
+ */
+class AESKeyBase
+{
+public:
+       //! \brief Reads hex encoded data from \a stream.
+       void _readFromStream(std::istream & stream, unsigned bytes, uint8_t * buffer);
+       
+       //! \brief Writes hex encoded data to \a stream.
+       void _writeToStream(std::ostream & stream, unsigned bytes, const uint8_t * buffer);
+};
+
+/*!
+ * \brief Generic AES key class.
+ *
+ * The template parameter \a S is the number of bits in the key.
+ *
+ * The underlying key type can be accessed like this: AESKey<128>::key_t
+ *
+ * When a key instance is destroyed, it erases the key data by setting it
+ * to all zeroes.
+ *
+ * \todo Add a way to allow only key sizes of 128, 192, and 256 bits.
+ * \todo Find a cross platform way to prevent the key data from being written
+ *             to the VM swapfile.
+ *
+ * AESKey<128> key = AESKey<128>::readFromStream(s);
+ */
+template <int S>
+class AESKey : public AESKeyBase
+{
+public:
+       //! Type for this size of AES key.
+       typedef uint8_t key_t[S/8];
+       
+public:
+       //! \brief Default constructor.
+       //!
+       //! Initializes the key to 0.
+       AESKey()
+       {
+               memset(m_key, 0, sizeof(m_key));
+       }
+       
+       //! \brief Constructor taking a key value reference.
+       AESKey(const key_t & key)
+       {
+               memcpy(m_key, &key, sizeof(m_key));
+       }
+       
+       // \brief Constructor taking a key value pointer.
+       AESKey(const key_t * key)
+       {
+               memcpy(m_key, key, sizeof(m_key));
+       }
+       
+       //! \brief Constructor, reads key from stream in hex format.
+       AESKey(std::istream & stream)
+       {
+               readFromStream(stream);
+       }
+       
+       //! \brief Copy constructor.
+       AESKey(const AESKey<S> & other)
+       {
+               memcpy(m_key, other.m_key, sizeof(m_key));
+       }
+       
+       //! \brief Destructor.
+       //!
+       //! Sets the key value to zero.
+       ~AESKey()
+       {
+               memset(m_key, 0, sizeof(m_key));
+       }
+       
+       //! \brief Set to the key to a randomly generated value.
+       void randomize()
+       {
+               RandomNumberGenerator rng;
+               rng.generateBlock(m_key, sizeof(m_key));
+       }
+       
+       //! \brief Reads the key from a hex encoded data stream.
+       void readFromStream(std::istream & stream)
+       {
+               _readFromStream(stream, S/8, reinterpret_cast<uint8_t*>(&m_key));
+       }
+       
+       //! \brief Writes the key to a data stream in hex encoded format.
+       void writeToStream(std::ostream & stream)
+       {
+               _writeToStream(stream, S/8, reinterpret_cast<uint8_t*>(&m_key));
+       }
+       
+       //! \name Key accessors
+       //@{
+       inline const key_t & getKey() const { return m_key; }
+       inline void getKey(key_t * key) const { memcpy(key, m_key, sizeof(m_key)); }
+       
+       inline void setKey(const key_t & key) { memcpy(m_key, &key, sizeof(m_key)); }
+       inline void setKey(const key_t * key) { memcpy(m_key, key, sizeof(m_key)); }
+       inline void setKey(const AESKey<S> & key) { memcpy(m_key, key.m_key, sizeof(m_key)); }
+       //@}
+       
+       //! \name Operators
+       //@{
+       const AESKey<S> & operator = (const AESKey<S> & key) { setKey(key); return *this; }
+       const AESKey<S> & operator = (const key_t & key) { setKey(key); return *this; }
+       const AESKey<S> & operator = (const key_t * key) { setKey(key); return *this; }
+       
+       operator const key_t & () const { return m_key; }
+       operator const key_t * () const { return m_key; }
+       //@}
+       
+protected:
+       key_t m_key;    //!< The key value.
+};
+
+//! Standard type definition for an AES-128 key.
+typedef AESKey<128> AES128Key;
+
+#endif // _AESKey_h_
diff --git a/tools/elftosb/common/Blob.cpp b/tools/elftosb/common/Blob.cpp
new file mode 100644 (file)
index 0000000..3d02521
--- /dev/null
@@ -0,0 +1,123 @@
+/*
+ * File:       Blob.cpp
+ *
+ * Copyright (c) Freescale Semiconductor, Inc. All rights reserved.
+ * See included license file for license details.
+ */
+
+#include "Blob.h"
+#include <stdexcept>
+#include <stdlib.h>
+#include <string.h>
+
+Blob::Blob()
+:      m_data(0),
+       m_length(0)
+{
+}
+
+//! Makes a local copy of the \a data argument.
+//!
+Blob::Blob(const uint8_t * data, unsigned length)
+:      m_data(0),
+       m_length(length)
+{
+       m_data = reinterpret_cast<uint8_t*>(malloc(length));
+       memcpy(m_data, data, length);
+}
+
+//! Makes a local copy of the data owned by \a other.
+//!
+Blob::Blob(const Blob & other)
+:      m_data(0),
+       m_length(other.m_length)
+{
+       m_data = reinterpret_cast<uint8_t *>(malloc(m_length));
+       memcpy(m_data, other.m_data, m_length);
+}
+
+//! Disposes of the binary data associated with this object.
+Blob::~Blob()
+{
+       if (m_data)
+       {
+               free(m_data);
+       }
+}
+
+//! Copies \a data onto the blob's data. The blob does not assume ownership
+//! of \a data.
+//!
+//! \param data Pointer to a buffer containing the data which will be copied
+//!            into the blob.
+//! \param length Number of bytes pointed to by \a data.
+void Blob::setData(const uint8_t * data, unsigned length)
+{
+       setLength(length);
+       memcpy(m_data, data, length);
+}
+
+//! Sets the #m_length member variable to \a length and resizes #m_data to
+//! the new length. The contents of #m_data past any previous contents are undefined.
+//! If the new \a length is 0 then the data will be freed and a subsequent call
+//! to getData() will return NULL.
+//!
+//! \param length New length of the blob's data in bytes.
+void Blob::setLength(unsigned length)
+{
+       if (length == 0)
+       {
+               clear();
+               return;
+       }
+       
+       // Allocate new block.
+       if (!m_data)
+       {
+               m_data = reinterpret_cast<uint8_t*>(malloc(length));
+               if (!m_data)
+               {
+                       throw std::runtime_error("failed to allocate memory");
+               }
+       }
+       // Reallocate previous block.
+       else
+       {
+               void * newBlob = realloc(m_data, length);
+               if (!newBlob)
+               {
+                       throw std::runtime_error("failed to reallocate memory");
+               }
+               m_data = reinterpret_cast<uint8_t*>(newBlob);
+       }
+       
+       // Set length.
+       m_length = length;
+}
+
+void Blob::append(const uint8_t * newData, unsigned newDataLength)
+{
+       unsigned oldLength = m_length;
+       
+       setLength(m_length + newDataLength);
+       
+       memcpy(m_data + oldLength, newData, newDataLength);
+}
+
+void Blob::clear()
+{
+       if (m_data)
+       {
+               free(m_data);
+               m_data = NULL;
+       }
+       
+       m_length = 0;
+}
+
+void Blob::relinquish()
+{
+       m_data = NULL;
+       m_length = 0;
+}
+
diff --git a/tools/elftosb/common/Blob.h b/tools/elftosb/common/Blob.h
new file mode 100644 (file)
index 0000000..e7753b3
--- /dev/null
@@ -0,0 +1,70 @@
+/*
+ * File:       Blob.h
+ *
+ * Copyright (c) Freescale Semiconductor, Inc. All rights reserved.
+ * See included license file for license details.
+ */
+#if !defined(_Blob_h_)
+#define _Blob_h_
+
+#include "stdafx.h"
+
+/*!
+ * \brief Manages a binary object of arbitrary length.
+ *
+ * The data block is allocated with malloc() instead of the new
+ * operator so that we can use realloc() to resize it.
+ */
+class Blob
+{
+public:
+       //! \brief Default constructor.
+       Blob();
+       
+       //! \brief Constructor.
+       Blob(const uint8_t * data, unsigned length);
+       
+       //! \brief Copy constructor.
+       Blob(const Blob & other);
+       
+       //! \brief Destructor.
+       virtual ~Blob();
+       
+       //! \name Operations
+       //@{
+       //! \brief Replaces the blob's data.
+       void setData(const uint8_t * data, unsigned length);
+       
+       //! \brief Change the size of the blob's data.
+       void setLength(unsigned length);
+       
+       //! \brief Adds data to the end of the blob.
+       void append(const uint8_t * newData, unsigned newDataLength);
+       
+       //! \brief Disposes of the data.
+       void clear();
+       
+       //! \brief Tell the blob that it no longer owns its data.
+       void relinquish();
+       //@}
+       
+       //! \name Accessors
+       //@{
+       uint8_t * getData() { return m_data; }
+       const uint8_t * getData() const { return m_data; }
+       unsigned getLength() const { return m_length; }
+       //@}
+       
+       //! \name Operators
+       //@{
+       operator uint8_t * () { return m_data; }
+       operator const uint8_t * () const { return m_data; }
+       //@}
+
+protected:
+       uint8_t * m_data;       //!< The binary data held by this object.
+       unsigned m_length;      //!< Number of bytes pointed to by #m_data.
+};
+
+#endif // _Blob_h_
+
diff --git a/tools/elftosb/common/BootImage.h b/tools/elftosb/common/BootImage.h
new file mode 100644 (file)
index 0000000..4ca2c21
--- /dev/null
@@ -0,0 +1,54 @@
+/*
+ * File:       BootImage.h
+ *
+ * Copyright (c) Freescale Semiconductor, Inc. All rights reserved.
+ * See included license file for license details.
+ */
+#if !defined(_BootImage_h_)
+#define _BootImage_h_
+
+#include <iostream>
+#include "Version.h"
+
+namespace elftosb
+{
+
+/*!
+ * \brief Abstract base class for all boot image format classes.
+ *
+ * Provides virtual methods for all of the common features between different
+ * boot image formats. These are the product and component version numbers
+ * and the drive tag.
+ *
+ * Also provided is the virtual method writeToStream() that lets the caller
+ * stream out the boot image without knowing the underlying format type.
+ */
+class BootImage
+{
+public:
+       //! \brief Constructor.
+       BootImage() {}
+       
+       //! \brief Destructor.
+       virtual ~BootImage() {}
+       
+       //! \name Versions
+       //@{
+       virtual void setProductVersion(const version_t & version)=0;
+       virtual void setComponentVersion(const version_t & version)=0;
+       //@}
+       
+       //! \brief Specify the drive tag to be set in the output file header.
+       virtual void setDriveTag(uint16_t tag)=0;
+
+       //! \brief Returns a string containing the preferred file extension for image format.
+       virtual std::string getFileExtension() const=0;
+       
+       //! \brief Write the boot image to an output stream.
+       virtual void writeToStream(std::ostream & stream)=0;
+};
+
+}; // namespace elftosb
+
+#endif // _BootImage_h_
+
diff --git a/tools/elftosb/common/DataSource.cpp b/tools/elftosb/common/DataSource.cpp
new file mode 100644 (file)
index 0000000..214104b
--- /dev/null
@@ -0,0 +1,224 @@
+/*
+ * File:       DataSource.cpp
+ *
+ * Copyright (c) Freescale Semiconductor, Inc. All rights reserved.
+ * See included license file for license details.
+ */
+
+#include "DataSource.h"
+#include "DataTarget.h"
+#include <assert.h>
+#include <string.h>
+using namespace elftosb;
+
+#pragma mark *** DataSource::PatternSegment ***
+
+DataSource::PatternSegment::PatternSegment(DataSource & source)
+:      DataSource::Segment(source), m_pattern()
+{
+}
+
+DataSource::PatternSegment::PatternSegment(DataSource & source, const SizedIntegerValue & pattern)
+:      DataSource::Segment(source), m_pattern(pattern)
+{
+}
+
+DataSource::PatternSegment::PatternSegment(DataSource & source, uint8_t pattern)
+:      DataSource::Segment(source), m_pattern(static_cast<uint8_t>(pattern))
+{
+}
+
+DataSource::PatternSegment::PatternSegment(DataSource & source, uint16_t pattern)
+:      DataSource::Segment(source), m_pattern(static_cast<uint16_t>(pattern))
+{
+}
+
+DataSource::PatternSegment::PatternSegment(DataSource & source, uint32_t pattern)
+:      DataSource::Segment(source), m_pattern(static_cast<uint32_t>(pattern))
+{
+}
+
+unsigned DataSource::PatternSegment::getData(unsigned offset, unsigned maxBytes, uint8_t * buffer)
+{
+       memset(buffer, 0, maxBytes);
+       
+       return maxBytes;
+}
+
+//! The pattern segment's length is a function of the data target. If the
+//! target is bounded, then the segment's length is simply the target's
+//! length. Otherwise, if no target has been set or the target is unbounded,
+//! then the length returned is 0.
+unsigned DataSource::PatternSegment::getLength()
+{
+       DataTarget * target = m_source.getTarget();
+       if (!target)
+       {
+               return 0;
+       }
+       
+       uint32_t length;
+       if (target->isBounded())
+       {
+               length = target->getEndAddress() - target->getBeginAddress();
+       }
+       else
+       {
+               length = m_pattern.getSize();
+       }
+       return length;
+}
+
+#pragma mark *** PatternSource ***
+
+PatternSource::PatternSource()
+:      DataSource(), DataSource::PatternSegment((DataSource&)*this)
+{
+}
+
+PatternSource::PatternSource(const SizedIntegerValue & value)
+:      DataSource(), DataSource::PatternSegment((DataSource&)*this, value)
+{
+}
+
+#pragma mark *** UnmappedDataSource ***
+
+UnmappedDataSource::UnmappedDataSource()
+:      DataSource(), DataSource::Segment((DataSource&)*this), m_data(), m_length(0)
+{
+}
+
+UnmappedDataSource::UnmappedDataSource(const uint8_t * data, unsigned length)
+:      DataSource(), DataSource::Segment((DataSource&)*this), m_data(), m_length(0)
+{
+       setData(data, length);
+}
+
+//! Makes a copy of \a data that is freed when the data source is
+//! destroyed. The caller does not have to maintain \a data after this call
+//! returns.
+void UnmappedDataSource::setData(const uint8_t * data, unsigned length)
+{
+       m_data.safe_delete();
+       
+       uint8_t * dataCopy = new uint8_t[length];
+       memcpy(dataCopy, data, length);
+       m_data = dataCopy;
+       m_length = length;
+}
+
+unsigned UnmappedDataSource::getData(unsigned offset, unsigned maxBytes, uint8_t * buffer)
+{
+       assert(offset < m_length);
+       unsigned copyBytes = std::min<unsigned>(m_length - offset, maxBytes);
+       memcpy(buffer, m_data.get(), copyBytes);
+       return copyBytes;
+}
+
+#pragma mark *** MemoryImageDataSource ***
+
+MemoryImageDataSource::MemoryImageDataSource(StExecutableImage * image)
+:      DataSource(), m_image(image)
+{
+       // reserve enough room for all segments
+       m_segments.reserve(m_image->getRegionCount());
+}
+
+MemoryImageDataSource::~MemoryImageDataSource()
+{
+       segment_array_t::iterator it = m_segments.begin();
+       for (; it != m_segments.end(); ++it)
+       {
+               // delete this segment if it has been created
+               if (*it)
+               {
+                       delete *it;
+               }
+       }
+}
+
+unsigned MemoryImageDataSource::getSegmentCount()
+{
+       return m_image->getRegionCount();
+}
+
+DataSource::Segment * MemoryImageDataSource::getSegmentAt(unsigned index)
+{
+       // return previously created segment
+       if (index < m_segments.size() && m_segments[index])
+       {
+               return m_segments[index];
+       }
+       
+       // extend array out to this index
+       if (index >= m_segments.size() && index < m_image->getRegionCount())
+       {
+               m_segments.resize(index + 1, NULL);
+       }
+       
+       // create the new segment object
+       DataSource::Segment * newSegment;
+       const StExecutableImage::MemoryRegion & region = m_image->getRegionAtIndex(index);
+       if (region.m_type == StExecutableImage::TEXT_REGION)
+       {
+               newSegment = new TextSegment(*this, m_image, index);
+       }
+       else if (region.m_type == StExecutableImage::FILL_REGION)
+       {
+               newSegment = new FillSegment(*this, m_image, index);
+       }
+       
+       m_segments[index] = newSegment;
+       return newSegment;
+}
+
+#pragma mark *** MemoryImageDataSource::TextSegment ***
+
+MemoryImageDataSource::TextSegment::TextSegment(MemoryImageDataSource & source, StExecutableImage * image, unsigned index)
+:      DataSource::Segment(source), m_image(image), m_index(index)
+{
+}
+
+unsigned MemoryImageDataSource::TextSegment::getData(unsigned offset, unsigned maxBytes, uint8_t * buffer)
+{
+       const StExecutableImage::MemoryRegion & region = m_image->getRegionAtIndex(m_index);
+       assert(region.m_type == StExecutableImage::TEXT_REGION);
+       
+       unsigned copyBytes = std::min<unsigned>(region.m_length - offset, maxBytes);    
+       memcpy(buffer, &region.m_data[offset], copyBytes);
+       
+       return copyBytes;
+}
+
+unsigned MemoryImageDataSource::TextSegment::getLength()
+{
+       const StExecutableImage::MemoryRegion & region = m_image->getRegionAtIndex(m_index);
+       return region.m_length;
+}
+
+uint32_t MemoryImageDataSource::TextSegment::getBaseAddress()
+{
+       const StExecutableImage::MemoryRegion & region = m_image->getRegionAtIndex(m_index);
+       return region.m_address;
+}
+
+#pragma mark *** MemoryImageDataSource::FillSegment ***
+
+MemoryImageDataSource::FillSegment::FillSegment(MemoryImageDataSource & source, StExecutableImage * image, unsigned index)
+:      DataSource::PatternSegment(source), m_image(image), m_index(index)
+{
+       SizedIntegerValue zero(0, kWordSize);
+       setPattern(zero);
+}
+
+unsigned MemoryImageDataSource::FillSegment::getLength()
+{
+       const StExecutableImage::MemoryRegion & region = m_image->getRegionAtIndex(m_index);
+       return region.m_length;
+}
+
+uint32_t MemoryImageDataSource::FillSegment::getBaseAddress()
+{
+       const StExecutableImage::MemoryRegion & region = m_image->getRegionAtIndex(m_index);
+       return region.m_address;
+}
diff --git a/tools/elftosb/common/DataSource.h b/tools/elftosb/common/DataSource.h
new file mode 100644 (file)
index 0000000..4fb9f00
--- /dev/null
@@ -0,0 +1,299 @@
+/*
+ * File:       DataSource.h
+ *
+ * Copyright (c) Freescale Semiconductor, Inc. All rights reserved.
+ * See included license file for license details.
+ */
+#if !defined(_DataSource_h_)
+#define _DataSource_h_
+
+#include <vector>
+#include "Value.h"
+#include "smart_ptr.h"
+#include "StExecutableImage.h"
+
+namespace elftosb
+{
+
+// Forward declaration
+class DataTarget;
+
+/*!
+ * \brief Abstract base class for data sources.
+ *
+ * Data sources represent any sort of data that can be placed or loaded
+ * into a target region. Sources may be a single blob of data read from
+ * a file or may consist of many segments.
+ *
+ * The three most important features of data sources are:
+ * - Sources may be multi-segmented.
+ * - Sources and/or segments can have a "natural" or default target location.
+ * - The target for a source may be taken into consideration when the source
+ *             describes itself.
+ */
+class DataSource
+{
+public:
+       /*!
+        * \brief Discrete, contiguous part of the source's data.
+        *
+        * This class is purely abstract and subclasses of DataSource are expected
+        * to subclass it to implement a segment particular to their needs.
+        */
+       class Segment
+       {
+       public:
+               //! \brief Default constructor.
+               Segment(DataSource & source) : m_source(source) {}
+               
+               //! \brief Destructor.
+               virtual ~Segment() {}
+               
+               //! \brief Gets all or a portion of the segment's data.
+               //!
+               //! The data is copied into \a buffer. Up to \a maxBytes bytes may be
+               //! copied, so \a buffer must be at least that large.
+               //!
+               //! \param offset Index of the first byte to start copying from.
+               //! \param maxBytes The maximum number of bytes that can be returned. \a buffer
+               //!             must be at least this large.
+               //! \param buffer Pointer to buffer where the data is copied.
+               //! \return The number of bytes copied into \a buffer.
+               virtual unsigned getData(unsigned offset, unsigned maxBytes, uint8_t * buffer)=0;
+               
+               //! \brief Gets the length of the segment's data.
+               virtual unsigned getLength()=0;
+               
+               //! \brief Returns whether the segment has an associated address.
+               virtual bool hasNaturalLocation()=0;
+               
+               //! \brief Returns the address associated with the segment.
+               virtual uint32_t getBaseAddress() { return 0; }
+       
+       protected:
+               DataSource & m_source;  //!< The data source to which this segment belongs.
+       };
+       
+       /*!
+        * \brief This is a special type of segment containing a repeating pattern.
+        *
+        * By default the segment doesn't have a specific length or data. The length depends
+        * on the target's address range. And the data is just the pattern, repeated
+        * many times. In addition, pattern segments do not have a natural location.
+        *
+        * Calling code should look for instances of PatternSegment and handle them
+        * as special cases that can be optimized.
+        */
+       class PatternSegment : public Segment
+       {
+       public:
+               //! \brief Default constructor.
+               PatternSegment(DataSource & source);
+               
+               //! \brief Constructor taking a fill pattern.
+               PatternSegment(DataSource & source, const SizedIntegerValue & pattern);
+               
+               //! \brief Constructor taking a byte fill pattern.
+               PatternSegment(DataSource & source, uint8_t pattern);
+               
+               //! \brief Constructor taking a half-word fill pattern.
+               PatternSegment(DataSource & source, uint16_t pattern);
+               
+               //! \brief Constructor taking a word fill pattern.
+               PatternSegment(DataSource & source, uint32_t pattern);
+
+               //! \name Segment methods
+               //@{
+               //! \brief Pattern segments have no natural address.
+               virtual bool hasNaturalLocation() { return false; }
+               
+               //! \brief Performs a pattern fill into the \a buffer.
+               virtual unsigned getData(unsigned offset, unsigned maxBytes, uint8_t * buffer);
+               
+               //! \brief Returns a length based on the data target's address range.
+               virtual unsigned getLength();
+               //@}
+               
+               //! \name Pattern accessors
+               //@{
+               //! \brief Assigns a new fill pattern.
+               inline void setPattern(const SizedIntegerValue & newPattern) { m_pattern = newPattern; }
+               
+               //! \brief Return the fill pattern for the segment.
+               inline SizedIntegerValue & getPattern() { return m_pattern; }
+       
+               //! \brief Assignment operator, sets the pattern value and length.
+               PatternSegment & operator = (const SizedIntegerValue & value) { m_pattern = value; return *this; }
+               //@}
+               
+       protected:
+               SizedIntegerValue m_pattern;    //!< The fill pattern.
+       };
+       
+public:
+       //! \brief Default constructor.
+       DataSource() : m_target(0) {}
+       
+       //! \brief Destructor.
+       virtual ~DataSource() {}
+       
+       //! \name Data target
+       //@{
+       //! \brief Sets the associated data target.
+       inline void setTarget(DataTarget * target) { m_target = target; }
+       
+       //! \brief Gets the associated data target.
+       inline DataTarget * getTarget() const { return m_target; }
+       //@}
+       
+       //! \name Segments
+       //@{
+       //! \brief Returns the number of segments in this data source.
+       virtual unsigned getSegmentCount()=0;
+       
+       //! \brief Returns segment number \a index of the data source.
+       virtual Segment * getSegmentAt(unsigned index)=0;
+       //@}
+       
+protected:
+       DataTarget * m_target;  //!< Corresponding target for this source.
+};
+
+/*!
+ * \brief Data source for a repeating pattern.
+ *
+ * The pattern is represented by a SizedIntegerValue object. Thus the pattern
+ * can be either byte, half-word, or word sized.
+ *
+ * This data source has only one segment, and the PatternSource instance acts
+ * as its own single segment.
+ */
+class PatternSource : public DataSource, public DataSource::PatternSegment
+{
+public:
+       //! \brief Default constructor.
+       PatternSource();
+       
+       //! \brief Constructor taking the pattern value.
+       PatternSource(const SizedIntegerValue & value);
+       
+       //! \brief There is only one segment.
+       virtual unsigned getSegmentCount() { return 1; }
+       
+       //! \brief Returns this object, as it is its own segment.
+       virtual DataSource::Segment * getSegmentAt(unsigned index) { return this; }
+       
+       //! \brief Assignment operator, sets the pattern value and length.
+       PatternSource & operator = (const SizedIntegerValue & value) { setPattern(value); return *this; }
+};
+
+/*!
+ * \brief Data source for data that is not memory mapped (has no natural address).
+ *
+ * This data source can only manage a single block of data, which has no
+ * associated address. It acts as its own Segment.
+ */
+class UnmappedDataSource : public DataSource, public DataSource::Segment
+{
+public:
+       //! \brief Default constructor.
+       UnmappedDataSource();
+       
+       //! \brief Constructor taking the data, which is copied.
+       UnmappedDataSource(const uint8_t * data, unsigned length);
+       
+       //! \brief Sets the source's data.
+       void setData(const uint8_t * data, unsigned length);
+       
+       //! \brief There is only one segment.
+       virtual unsigned getSegmentCount() { return 1; }
+       
+       //! \brief Returns this object, as it is its own segment.
+       virtual DataSource::Segment * getSegmentAt(unsigned index) { return this; }
+               
+       //! \name Segment methods
+       //@{
+       //! \brief Unmapped data sources have no natural address.
+       virtual bool hasNaturalLocation() { return false; }
+       
+       //! \brief Copies a portion of the data into \a buffer.
+       virtual unsigned getData(unsigned offset, unsigned maxBytes, uint8_t * buffer);
+       
+       //! \brief Returns the number of bytes of data managed by the source.
+       virtual unsigned getLength() { return m_length; }
+       //@}
+
+protected:
+       smart_array_ptr<uint8_t> m_data;        //!< The data.
+       unsigned m_length;      //!< Byte count of the data.
+};
+
+/*!
+ * \brief Data source that takes its data from an executable image.
+ *
+ * \see StExecutableImage
+ */
+class MemoryImageDataSource : public DataSource
+{
+public:
+       //! \brief Default constructor.
+       MemoryImageDataSource(StExecutableImage * image);
+       
+       //! \brief Destructor.
+       virtual ~MemoryImageDataSource();
+       
+       //! \brief Returns the number of memory regions in the image.
+       virtual unsigned getSegmentCount();
+       
+       //! \brief Returns the data source segment at position \a index.
+       virtual DataSource::Segment * getSegmentAt(unsigned index);
+       
+protected:
+       /*!
+        * \brief Segment corresponding to a text region of the executable image.
+        */
+       class TextSegment : public DataSource::Segment
+       {
+       public:
+               //! \brief Default constructor
+               TextSegment(MemoryImageDataSource & source, StExecutableImage * image, unsigned index);
+               
+               virtual unsigned getData(unsigned offset, unsigned maxBytes, uint8_t * buffer);
+               virtual unsigned getLength();
+       
+               virtual bool hasNaturalLocation() { return true; }
+               virtual uint32_t getBaseAddress();
+       
+       protected:
+               StExecutableImage * m_image;    //!< Coalesced image of the file.
+               unsigned m_index;       //!< Record index.
+       };
+       
+       /*!
+        * \brief Segment corresponding to a fill region of the executable image.
+        */
+       class FillSegment : public DataSource::PatternSegment
+       {
+       public:
+               FillSegment(MemoryImageDataSource & source, StExecutableImage * image, unsigned index);
+               
+               virtual unsigned getLength();
+       
+               virtual bool hasNaturalLocation() { return true; }
+               virtual uint32_t getBaseAddress();
+       
+       protected:
+               StExecutableImage * m_image;    //!< Coalesced image of the file.
+               unsigned m_index;       //!< Record index.
+       };
+       
+protected:
+       StExecutableImage * m_image;    //!< The memory image that is the data source.
+       
+       typedef std::vector<DataSource::Segment*> segment_array_t;      //!< An array of segments.
+       segment_array_t m_segments;     //!< The array of Segment instances.
+};
+
+}; // namespace elftosb
+
+#endif // _DataSource_h_
diff --git a/tools/elftosb/common/DataSourceImager.cpp b/tools/elftosb/common/DataSourceImager.cpp
new file mode 100644 (file)
index 0000000..14a9307
--- /dev/null
@@ -0,0 +1,143 @@
+/*
+ * File:       DataSourceImager.cpp
+ *
+ * Copyright (c) Freescale Semiconductor, Inc. All rights reserved.
+ * See included license file for license details.
+ */
+
+#include "DataSourceImager.h"
+#include <stdlib.h>
+#include <string.h>
+
+using namespace elftosb;
+
+DataSourceImager::DataSourceImager()
+:      Blob(),
+       m_fill(0),
+       m_baseAddress(0),
+       m_isBaseAddressSet(false)
+{
+}
+
+void DataSourceImager::setBaseAddress(uint32_t address)
+{
+       m_baseAddress = address;
+       m_isBaseAddressSet = true;
+}
+
+void DataSourceImager::setFillPattern(uint8_t pattern)
+{
+       m_fill = pattern;
+}
+
+void DataSourceImager::reset()
+{
+       clear();
+       
+       m_fill = 0;
+       m_baseAddress = 0;
+       m_isBaseAddressSet = false;
+}
+
+//! \param dataSource Pointer to an instance of a concrete data source subclass.
+//!
+void DataSourceImager::addDataSource(DataSource * source)
+{
+       unsigned segmentCount = source->getSegmentCount();
+       unsigned index = 0;
+       for (; index < segmentCount; ++index)
+       {
+               addDataSegment(source->getSegmentAt(index));
+       }
+}
+
+//! \param segment The segment to add. May be any type of data segment, including
+//!            a pattern segment.
+void DataSourceImager::addDataSegment(DataSource::Segment * segment)
+{
+       DataSource::PatternSegment * patternSegment = dynamic_cast<DataSource::PatternSegment*>(segment);
+       
+       unsigned segmentLength = segment->getLength();
+       bool segmentHasLocation = segment->hasNaturalLocation();
+       uint32_t segmentAddress = segment->getBaseAddress();
+       
+       uint8_t * toPtr = NULL;
+       unsigned addressDelta;
+       unsigned newLength;
+       
+       // If a pattern segment's length is 0 then make it as big as the fill pattern.
+       // This needs to be done before the buffer is adjusted.
+       if (patternSegment && segmentLength == 0)
+       {
+               SizedIntegerValue & pattern = patternSegment->getPattern();
+               segmentLength = pattern.getSize();
+       }
+       
+       if (segmentLength)
+       {
+               if (segmentHasLocation)
+               {
+                       // Make sure a base address is set.
+                       if (!m_isBaseAddressSet)
+                       {
+                               m_baseAddress = segmentAddress;
+                               m_isBaseAddressSet = true;
+                       }
+                       
+                       // The segment is located before our buffer's first address.
+                       // toPtr is not set in this if, but in the else branch of the next if.
+                       // Unless the segment completely overwrite the current data.
+                       if (segmentAddress < m_baseAddress)
+                       {
+                               addressDelta = m_baseAddress - segmentAddress;
+                               
+                               uint8_t * newData = (uint8_t *)malloc(m_length + addressDelta);
+                               memcpy(&newData[addressDelta], m_data, m_length);
+                               free(m_data);
+                               
+                               m_data = newData;
+                               m_length += addressDelta;
+                               m_baseAddress = segmentAddress;
+                       }
+                       
+                       // This segment is located or extends outside of our buffer.
+                       if (segmentAddress + segmentLength > m_baseAddress + m_length)
+                       {
+                               newLength = segmentAddress + segmentLength - m_baseAddress;
+                               
+                               m_data = (uint8_t *)realloc(m_data, newLength);
+                               
+                               // Clear any bytes between the old data and the new segment.
+                               addressDelta = segmentAddress - (m_baseAddress + m_length);
+                               if (addressDelta)
+                               {
+                                       memset(m_data + m_length, 0, addressDelta);
+                               }
+                               
+                               toPtr = m_data + (segmentAddress - m_baseAddress);
+                               m_length = newLength;
+                       }
+                       else
+                       {
+                               toPtr = m_data + (segmentAddress - m_baseAddress);
+                       }
+               }
+               // Segment has no natural location, so just append it to the end of our buffer.
+               else
+               {
+                       newLength = m_length + segmentLength;
+                       m_data = (uint8_t *)realloc(m_data, newLength);
+                       toPtr = m_data + m_length;
+                       m_length = newLength;
+               }
+       }
+
+       // A loop is used because getData() may fill in less than the requested
+       // number of bytes per call.
+       unsigned offset = 0;
+       while (offset < segmentLength)
+       {
+               offset += segment->getData(offset, segmentLength - offset, toPtr + offset);
+       }
+}
+
diff --git a/tools/elftosb/common/DataSourceImager.h b/tools/elftosb/common/DataSourceImager.h
new file mode 100644 (file)
index 0000000..00e61df
--- /dev/null
@@ -0,0 +1,54 @@
+/*
+ * File:       DataSourceImager.h
+ *
+ * Copyright (c) Freescale Semiconductor, Inc. All rights reserved.
+ * See included license file for license details.
+ */
+#if !defined(_DataSourceImager_h_)
+#define _DataSourceImager_h_
+
+#include "Blob.h"
+#include "DataSource.h"
+
+namespace elftosb {
+
+/*!
+ * \brief Converts a DataSource into a single binary buffer.
+ */
+class DataSourceImager : public Blob
+{
+public:
+       //! \brief Constructor.
+       DataSourceImager();
+       
+       //! \name Setup
+       //@{
+       void setBaseAddress(uint32_t address);
+       void setFillPattern(uint8_t pattern);
+       //@}
+       
+       void reset();
+       
+       //! \name Accessors
+       //@{
+       uint32_t getBaseAddress() { return m_baseAddress; }
+       //@}
+       
+       //! \name Operations
+       //@{
+       //! \brief Adds all of the segments of which \a dataSource is composed.
+       void addDataSource(DataSource * source);
+       
+       //! \brief Adds the data from one data segment.
+       void addDataSegment(DataSource::Segment * segment);
+       //@}
+
+protected:
+       uint8_t m_fill;
+       uint32_t m_baseAddress;
+       bool m_isBaseAddressSet;
+};
+
+};
+
+#endif // _DataSourceImager_h_
diff --git a/tools/elftosb/common/DataTarget.cpp b/tools/elftosb/common/DataTarget.cpp
new file mode 100644 (file)
index 0000000..aab2c7b
--- /dev/null
@@ -0,0 +1,59 @@
+/*
+ * File:       DataTarget.cpp
+ *
+ * Copyright (c) Freescale Semiconductor, Inc. All rights reserved.
+ * See included license file for license details.
+ */
+
+#include "DataTarget.h"
+#include "DataSource.h"
+#include "ElftosbErrors.h"
+
+using namespace elftosb;
+
+//! \exception elftosb::semantic_error Thrown if the source has multiple segments.
+DataTarget::AddressRange ConstantDataTarget::getRangeForSegment(DataSource & source, DataSource::Segment & segment)
+{
+       // can't handle multi-segment data sources
+       if (source.getSegmentCount() > 1)
+       {
+               throw semantic_error("constant targets only support single-segment sources");
+       }
+       
+       // always relocate the segment to our begin address
+       AddressRange range;
+       range.m_begin = m_begin;
+       
+       if (isBounded())
+       {
+               // we have an end address. trim the result range to the segment size
+               // or let the end address crop the segment.
+               range.m_end = std::min<uint32_t>(m_end, m_begin + segment.getLength());
+       }
+       else
+       {
+               // we have no end address, so the segment size determines it.
+               range.m_end = m_begin + segment.getLength();
+       }
+       
+       return range;
+}
+
+//! If the \a segment has a natural location, the returned address range extends
+//! from the segment's base address to its base address plus its length.
+//!
+//! \exception elftosb::semantic_error This exception is thrown if the \a segment
+//!            does not have a natural location associated with it.
+DataTarget::AddressRange NaturalDataTarget::getRangeForSegment(DataSource & source, DataSource::Segment & segment)
+{
+       if (!segment.hasNaturalLocation())
+       {
+               throw semantic_error("source has no natural location");
+       }
+       
+       AddressRange range;
+       range.m_begin = segment.getBaseAddress();
+       range.m_end = segment.getBaseAddress() + segment.getLength();
+       return range;
+}
+
diff --git a/tools/elftosb/common/DataTarget.h b/tools/elftosb/common/DataTarget.h
new file mode 100644 (file)
index 0000000..e154491
--- /dev/null
@@ -0,0 +1,122 @@
+/*
+ * File:       DataTarget.h
+ *
+ * Copyright (c) Freescale Semiconductor, Inc. All rights reserved.
+ * See included license file for license details.
+ */
+#if !defined(_DataTarget_h_)
+#define _DataTarget_h_
+
+#include "stdafx.h"
+#include "DataSource.h"
+
+namespace elftosb
+{
+
+// Forward declaration
+class DataSource;
+
+/*!
+ * \brief Abstract base class for the target address or range of data.
+ *
+ * Targets at the most basic level have a single address, and potentially
+ * an address range. Unbounded targets have a beginning address but no
+ * specific end address, while bounded targets do have an end address.
+ *
+ * Users of a data target can access the begin and end addresses directly.
+ * However, the most powerful way to use a target is with the
+ * getRangeForSegment() method. This method returns the target address range
+ * for a segment of a data source. The value of the resulting range can be
+ * completely dependent upon the segment's properties, those of its data
+ * source, and the type of data target.
+ *
+ * \see elftosb::DataSource
+ */
+class DataTarget
+{
+public:
+       //! \brief Simple structure that describes an addressed region of memory.
+       //! \todo Decide if the end address is inclusive or not.
+       struct AddressRange
+       {
+               uint32_t m_begin;
+               uint32_t m_end;
+       };
+       
+public:
+       //! \brief Default constructor.
+       DataTarget() : m_source(0) {}
+       
+       //! \brief Destructor.
+       virtual ~DataTarget() {}
+       
+       //! \brief Whether the target is just a single address or has an end to it.
+       virtual bool isBounded() { return false; }
+       
+       virtual uint32_t getBeginAddress() { return 0; }
+       virtual uint32_t getEndAddress() { return 0; }
+       
+       //! \brief Return the address range for a segment of a data source.
+       virtual DataTarget::AddressRange getRangeForSegment(DataSource & source, DataSource::Segment & segment)=0;
+       
+       inline void setSource(DataSource * source) { m_source = source; }
+       inline DataSource * getSource() const { return m_source; }
+       
+protected:
+       DataSource * m_source;  //!< Corresponding data source for this target.
+};
+
+/*!
+ * \brief Target with a constant values for the addresses.
+ *
+ * This target type supports can be both bounded and unbounded. It always has
+ * at least one address, the beginning address. The end address is optional,
+ * and if not provided makes the target unbounded.
+ */
+class ConstantDataTarget : public DataTarget
+{
+public:
+       //! \brief Constructor taking only a begin address.
+       ConstantDataTarget(uint32_t start) : DataTarget(), m_begin(start), m_end(0), m_hasEnd(false) {}
+       
+       //! \brief Constructor taking both begin and end addresses.
+       ConstantDataTarget(uint32_t start, uint32_t end) : DataTarget(), m_begin(start), m_end(end), m_hasEnd(true) {}
+       
+       //! \brief The target is bounded if an end address was specified.
+       virtual bool isBounded() { return m_hasEnd; }
+       
+       virtual uint32_t getBeginAddress() { return m_begin; }
+       virtual uint32_t getEndAddress() { return m_end; }
+       
+       //! \brief Return the address range for a segment of a data source.
+       virtual DataTarget::AddressRange getRangeForSegment(DataSource & source, DataSource::Segment & segment);
+       
+protected:
+       uint32_t m_begin;       //!< Start address.
+       uint32_t m_end;         //!< End address.
+       bool m_hasEnd;          //!< Was an end address specified?
+};
+
+/*!
+ * \brief Target address that is the "natural" location of whatever the source data is.
+ *
+ * The data source used with the target must have a natural location. If
+ * getRangeForSegment() is called with a segment that does not have a natural
+ * location, a semantic_error will be thrown.
+ */
+class NaturalDataTarget : public DataTarget
+{
+public:
+       //! \brief Default constructor.
+       NaturalDataTarget() : DataTarget() {}
+       
+       //! \brief Natural data targets are bounded by their source's segment lengths.
+       virtual bool isBounded() { return true; }
+       
+       //! \brief Return the address range for a segment of a data source.
+       virtual DataTarget::AddressRange getRangeForSegment(DataSource & source, DataSource::Segment & segment);
+};
+
+}; // namespace elftosb
+
+#endif // _DataTarget_h_
diff --git a/tools/elftosb/common/ELF.h b/tools/elftosb/common/ELF.h
new file mode 100644 (file)
index 0000000..f477610
--- /dev/null
@@ -0,0 +1,332 @@
+/*
+ * File:       ELF.h
+ *
+ * Copyright (c) Freescale Semiconductor, Inc. All rights reserved.
+ * See included license file for license details.
+ */
+#if !defined(_ELF_h_)
+#define _ELF_h_
+
+//! \name ELF types
+//! Types used in ELF file structures.
+//@{
+typedef uint32_t Elf32_Addr;
+typedef uint16_t Elf32_Half;
+typedef /*off_t*/ uint32_t Elf32_Off;
+typedef int32_t Elf32_Sword;
+typedef uint32_t Elf32_Word;
+//@}
+
+// All ELF structures are byte aligned. Any alignment padding is explicit.
+#pragma pack(1)
+
+//! \name File header
+//@{
+
+/*!
+ * Constants for the various fields of Elf32_Ehdr.e_ident.
+ */
+enum {
+       EI_MAG0 = 0,
+       EI_MAG1,
+       EI_MAG2,
+       EI_MAG3,
+       EI_CLASS,
+       EI_DATA,
+       EI_VERSION,
+       EI_PAD,
+       EI_NIDENT = 16,
+       
+       // Magic number.
+       ELFMAG0 = 0x7f,
+       ELFMAG1 = 'E',
+       ELFMAG2 = 'L',
+       ELFMAG3 = 'F',
+       
+       // EI_CLASS
+       ELFCLASSNONE = 0,
+       ELFCLASS32 = 1,
+       ELFCLASS64 = 2,
+       
+       // EI_DATA
+       ELFDATANONE = 0,
+       ELFDATA2LSB = 1,
+       ELFDATA2MSB = 2
+};
+
+/*!
+ * \brief ELF file header.
+ */
+struct Elf32_Ehdr
+{
+       unsigned char e_ident[EI_NIDENT];       //!< Magic number identifying the file format.
+       Elf32_Half e_type;              //!< Identifies the object file format.
+       Elf32_Half e_machine;   //!< Specified the architecture for the object file.
+       Elf32_Word e_version;   //!< Object file version.
+       Elf32_Addr e_entry;             //!< Virtual address of the entry point, or 0.
+       Elf32_Off e_phoff;              //!< Program header table offset in bytes, or 0 if no program header table.
+       Elf32_Off e_shoff;              //!< Section header table offset in bytes, or 0 if no section header table.
+       Elf32_Word e_flags;             //!< Processor-specific flags associated with the file.
+       Elf32_Half e_ehsize;    //!< The ELF header's size in bytes.
+       Elf32_Half e_phentsize; //!< Size in bytes of one entry in the program header table.
+       Elf32_Half e_phnum;             //!< Number of entries in the program header table.
+       Elf32_Half e_shentsize; //!< Size in bytes of an entry in the section header table.
+       Elf32_Half e_shnum;             //!< Number of entries in the section header table.
+       Elf32_Half e_shstrndx;  //!< Section header table index of the section name string table.
+};
+
+/*!
+ * Constants for #Elf32_Ehdr.e_type.
+ */
+enum {
+       ET_NONE,        //!< No file type.
+       ET_REL,         //!< Relocatable file.
+       ET_EXEC,        //!< Executable file.
+       ET_DYN,         //!< Shared object file.
+       ET_CORE,        //!< Core file.
+       ET_LOPROC,      //!< Low bound of processor-specific file types.
+       ET_HIPROC       //!< High bound of processor-specific file types.
+};     
+
+/*!
+ * ARM-specific #Elf32_Ehdr.e_flags
+ */
+enum {
+       EF_ARM_HASENTRY = 0x02,                 //!< #Elf32_Ehdr.e_entry contains a program-loader entry point.
+       EF_ARM_SYMSARESORTED = 0x04,    //!< Each subsection of the symbol table is sorted by symbol value.
+       EF_ARM_DYNSYMSUSESEGIDX = 0x08, //!< Symbols in dynamic symbol tables that are defined in sections included in program segment n have #Elf32_Sym.st_shndx = n + 1.
+       EF_ARM_MAPSYMSFIRST = 0x10,             //!< Mapping symbols precede other local symbols in the symbol table.
+       EF_ARM_EABIMASK = 0xff000000,   //!< This masks an 8-bit version number, the version of the ARM EABI to which this ELF file conforms. The current EABI version is #ARM_EABI_VERSION.
+       
+       ARM_EABI_VERSION = 0x02000000   //!< Current ARM EABI version.
+};
+
+//@}
+
+//! \name Sections
+//@{
+
+/*!
+ * \brief ELF section header.
+ *
+ * An object file's section header table lets one locate all the file's
+ * sections. The section header table is an array of #Elf32_Shdr structures.
+ * A section header table index is a subscript into this array. The ELF
+ * header's #Elf32_Ehdr::e_shoff member gives the byte offset from the beginning of
+ * the file to the section header table; #Elf32_Ehdr::e_shnum tells how many entries
+ * the section header table contains; #Elf32_Ehdr::e_shentsize gives the size in bytes
+ * of each entry.
+ *
+ * Some section header table indexes are reserved. An object file will not
+ * have sections for these special indexes:
+ *  - #SHN_UNDEF
+ *  - #SHN_LORESERVE
+ *  - #SHN_LOPROC
+ *  - #SHN_HIPROC
+ *  - #SHN_ABS
+ *  - #SHN_COMMON
+ *  - #SHN_HIRESERVE
+ */
+struct Elf32_Shdr
+{
+       Elf32_Word sh_name;             //!< The section's name. Index into the section header string table section.
+       Elf32_Word sh_type;             //!< Section type, describing the contents and semantics.
+       Elf32_Word sh_flags;    //!< Section flags describing various attributes.
+       Elf32_Addr sh_addr;             //!< The address at which the section will appear in the memory image, or 0.
+       Elf32_Off sh_offset;    //!< Offset from beginning of the file to the first byte in the section.
+       Elf32_Word sh_size;             //!< The section's size in bytes.
+       Elf32_Word sh_link;             //!< Section header table link index. Interpretation depends on section type.
+       Elf32_Word sh_info;             //!< Extra information about the section. Depends on section type.
+       Elf32_Word sh_addralign;        //!< Address alignment constraint. Values are 0 and positive powers of 2.
+       Elf32_Word sh_entsize;  //!< Size in bytes of section entries, or 0 if the section does not have fixed-size entries.
+};
+
+/*!
+ * Special section indexes.
+ */
+enum {
+       SHN_UNDEF = 0,
+       SHN_LORESERVE = 0xff00,
+       SHN_LOPROC = 0xff00,
+       SHN_HIPROC = 0xff1f,
+       SHN_ABS = 0xfff1,               //!< The symbol has an absolute value that will not change because of relocation.
+       SHN_COMMON = 0xfff2,    //!< The symbol labels a common block that has not yet been allocated.
+       SHN_HIRESERVE = 0xffff
+};
+
+/*!
+ * Section type constants.
+ */
+enum {
+       SHT_NULL = 0,
+       SHT_PROGBITS = 1,
+       SHT_SYMTAB = 2,
+       SHT_STRTAB = 3,
+       SHT_RELA = 4,
+       SHT_HASH = 5,
+       SHT_DYNAMIC = 6,
+       SHT_NOTE = 7,
+       SHT_NOBITS = 8,
+       SHT_REL = 9,
+       SHT_SHLIB = 10,
+       SHT_DYNSYM = 11
+};
+
+/*!
+ * Section flag constants.
+ */
+enum {
+       SHF_WRITE = 0x1,        //!< Section is writable.
+       SHF_ALLOC = 0x2,        //!< Allocate section.
+       SHF_EXECINSTR = 0x4     //!< Section contains executable instructions.
+};
+
+/*!
+ * ARM-specific section flag constants
+ */
+enum {
+       SHF_ENTRYSECT = 0x10000000,     //!< The section contains an entry point.
+       SHF_COMDEF = 0x80000000         //!< The section may be multiply defined in the input to a link step.
+};
+
+#define BSS_SECTION_NAME ".bss"
+#define DATA_SECTION_NAME ".data"
+#define TEXT_SECTION_NAME ".text"
+#define SHSTRTAB_SECTION_NAME ".shstrtab"
+#define STRTAB_SECTION_NAME ".strtab"
+#define SYMTAB_SECTION_NAME ".symtab"
+
+//@}
+
+//! \name Segments
+//@{
+
+/*!
+ * \brief ELF program header.
+ *
+ * An executable or shared object file's program header table is an array of
+ * structures, each describing a segment or other information the system needs
+ * to prepare the program for execution. An object file segment contains one
+ * or more sections. Program headers are meaningful only for executable and
+ * shared object files. A file specifies its own program header size with the
+ * ELF header's #Elf32_Ehdr::e_phentsize and #Elf32_Ehdr::e_phnum members.
+ */
+struct Elf32_Phdr
+{
+       Elf32_Word p_type;              //!< What type of segment this header describes.
+       Elf32_Off p_offset;             //!< Offset in bytes from start of file to the first byte of the segment.
+       Elf32_Addr p_vaddr;             //!< Virtual address at which the segment will reside in memory.
+       Elf32_Addr p_paddr;             //!< Physical address, for systems where this is relevant.
+       Elf32_Word p_filesz;    //!< Number of bytes of file data the segment consumes. May be zero.
+       Elf32_Word p_memsz;             //!< Size in bytes of the segment in memory. May be zero.
+       Elf32_Word p_flags;             //!< Flags relevant to the segment.
+       Elf32_Word p_align;             //!< Alignment constraint for segment addresses. Possible values are 0 and positive powers of 2.
+};
+
+/*!
+ * Segment type constants.
+ */
+enum {
+       PT_NULL = 0,
+       PT_LOAD = 1,
+       PT_DYNAMIC = 2,
+       PT_INTERP = 3,
+       PT_NOTE = 4,
+       PT_SHLIB = 5,
+       PT_PHDR = 6
+};
+
+/*!
+ * Program header flag constants.
+ */
+enum {
+       PF_X = 0x1,     //!< Segment is executable.
+       PF_W = 0x2,     //!< Segment is writable.
+       PF_R = 0x4      //!< Segment is readable.
+};
+
+//@}
+
+//! \name Symbol table
+//@{
+
+enum {
+       STN_UNDEF = 0   //!< Undefined symbol index.
+};
+
+/*!
+ * \brief ELF symbol table entry.
+ *
+ * An object file's symbol table holds information needed to locate and
+ * relocate a program's symbolic definitions and references. A symbol
+ * table index is a subscript into this array. Index 0 both designates
+ * the first entry in the table and serves as the undefined symbol index.
+ */
+struct Elf32_Sym
+{
+       Elf32_Word st_name;             //!< Index into file's string table.
+       Elf32_Addr st_value;    //!< Value associated with the symbol. Depends on context.
+       Elf32_Word st_size;             //!< Size associated with symbol. 0 if the symbol has no size or an unknown size.
+       unsigned char st_info;  //!< Specified the symbol's type and binding attributes.
+       unsigned char st_other; //!< Currently 0 (reserved).
+       Elf32_Half st_shndx;    //!< Section header table index for this symbol.
+};
+
+//! \name st_info macros
+//! Macros for manipulating the st_info field of Elf32_Sym struct.
+//@{
+#define ELF32_ST_BIND(i) ((i) >> 4)                    //!< Get binding attributes.
+#define ELF32_ST_TYPE(i) ((i) & 0x0f)          //!< Get symbol type.
+#define ELF32_ST_INFO(b, t) (((b) << 4) + ((t) & 0x0f))        //!< Construct st_info value from binding attributes and symbol type.
+//@}
+
+/*!
+ * \brief Symbol binding attributes.
+ *
+ * These constants are mask values.
+ */
+enum {
+       STB_LOCAL = 0,  //!< Local symbol not visible outside the object file.
+       STB_GLOBAL = 1, //!< Symbol is visible to all object files being linked together.
+       STB_WEAK = 2,   //!< Like global symbols, but with lower precedence.
+       
+       // Processor-specific semantics.
+       STB_LOPROC = 13,
+       STB_HIPROC = 15
+};
+
+/*!
+ * \brief Symbol types.
+ */
+enum {
+       STT_NOTYPE = 0,         //!< The symbol's type is not specified.
+       STT_OBJECT = 1,         //!< The symbol is associated with a data object, such as a variable or array.
+       STT_FUNC = 2,           //!< The symbol is associated with a function or other executable code.
+       STT_SECTION = 3,        //!< The synmbol is associated with a section. Primarily used for relocation.
+       STT_FILE = 4,           //!< A file symbol has STB_LOCAL binding, its section index is SHN_ABS, and it precedes the other STB_LOCAL symbols for the file, if it is present.
+       
+       STT_LOPROC = 13,        //!< Low bound of processor-specific symbol types.
+       STT_HIPROC = 15         //!< High bound of processor-specific symbol types.
+};
+
+/*!
+ * GHS-specific constants
+ */
+enum {
+       STO_THUMB = 1   //!< This flag is set on #Elf32_Sym.st_other if the symbol is Thumb mode code.
+};
+
+#define ARM_SEQUENCE_MAPSYM "$a"
+#define DATA_SEQUENCE_MAPSYM "$d"
+#define THUMB_SEQUENCE_MAPSYM "$t"
+
+#define THUMB_BL_TAGSYM "$b"
+#define FN_PTR_CONST_TAGSYM "$f"
+#define INDIRECT_FN_CALL_TAGSYM "$p"
+#define MAPPING_SYMBOL_COUNT_TAGSYM "$m"
+
+//@}
+
+#pragma pack()
+
+#endif // _ELF_h_
diff --git a/tools/elftosb/common/ELFSourceFile.cpp b/tools/elftosb/common/ELFSourceFile.cpp
new file mode 100644 (file)
index 0000000..962256a
--- /dev/null
@@ -0,0 +1,540 @@
+/*
+ * File:       ELFSourceFile.cpp
+ *
+ * Copyright (c) Freescale Semiconductor, Inc. All rights reserved.
+ * See included license file for license details.
+ */
+
+#include "ELFSourceFile.h"
+#include "Logging.h"
+#include "GHSSecInfo.h"
+#include <ctype.h>
+#include <algorithm>
+#include "string.h"
+
+//! The name of the toolset option.
+#define kToolsetOptionName "toolset"
+#define kGHSToolsetName "GHS"
+#define kGCCToolsetName "GCC"
+#define kGNUToolsetName "GNU"
+#define kADSToolsetName "ADS"
+
+//! Name of the option to control .secinfo action.
+#define kSecinfoClearOptionName "secinfoClear"
+#define kSecinfoDefaultName "DEFAULT"
+#define kSecinfoIgnoreName "IGNORE"
+#define kSecinfoROMName "ROM"
+#define kSecinfoCName "C"
+
+using namespace elftosb;
+
+ELFSourceFile::ELFSourceFile(const std::string & path)
+:      SourceFile(path),
+       m_toolset(kUnknownToolset),
+       m_secinfoOption(kSecinfoDefault)
+{
+}
+
+ELFSourceFile::~ELFSourceFile()
+{
+}
+
+bool ELFSourceFile::isELFFile(std::istream & stream)
+{
+       try
+       {
+               StELFFile elf(stream);
+               return true;
+       }
+       catch (...)
+       {
+               return false;
+       }
+}
+
+void ELFSourceFile::open()
+{
+       // Read toolset option
+       m_toolset = readToolsetOption();
+
+       // Read option and select default value
+       m_secinfoOption = readSecinfoClearOption();
+       if (m_secinfoOption == kSecinfoDefault)
+       {
+               m_secinfoOption = kSecinfoCStartupClear;
+       }
+       
+       // Open the stream
+       SourceFile::open();
+       
+       m_file = new StELFFile(*m_stream);
+//     m_file->dumpSections();
+       
+       // Set toolset in elf file object
+       switch (m_toolset)
+       {
+        // default toolset is GHS
+               case kGHSToolset:
+        case kUnknownToolset:
+                       m_file->setELFVariant(eGHSVariant);
+                       break;
+               case kGCCToolset:
+                       m_file->setELFVariant(eGCCVariant);
+                       break;
+               case kADSToolset:
+                       m_file->setELFVariant(eARMVariant);
+                       break;
+       }
+}
+
+void ELFSourceFile::close()
+{
+       SourceFile::close();
+       
+       m_file.safe_delete();
+}
+
+elf_toolset_t ELFSourceFile::readToolsetOption()
+{
+       do {
+               const OptionContext * options = getOptions();
+               if (!options || !options->hasOption(kToolsetOptionName))
+               {
+                       break;
+               }
+               
+               const Value * value = options->getOption(kToolsetOptionName);
+               const StringValue * stringValue = dynamic_cast<const StringValue*>(value);
+               if (!stringValue)
+               {
+                       // Not a string value, warn the user.
+                       Log::log(Logger::WARNING, "invalid type for 'toolset' option\n");
+                       break;
+               }
+               
+               std::string toolsetName = *stringValue;
+               
+               // convert option value to uppercase
+               std::transform<std::string::const_iterator, std::string::iterator, int (*)(int)>(toolsetName.begin(), toolsetName.end(), toolsetName.begin(), toupper);
+               
+               if (toolsetName == kGHSToolsetName)
+               {
+                       return kGHSToolset;
+               }
+               else if (toolsetName == kGCCToolsetName || toolsetName == kGNUToolsetName)
+               {
+                       return kGCCToolset;
+               }
+               else if (toolsetName == kADSToolsetName)
+               {
+                       return kADSToolset;
+               }
+
+               // Unrecognized option value, log a warning.
+               Log::log(Logger::WARNING, "unrecognized value for 'toolset' option\n");
+       } while (0);
+       
+       return kUnknownToolset;
+}
+
+//! It is up to the caller to convert from kSecinfoDefault to the actual default
+//! value.
+secinfo_clear_t ELFSourceFile::readSecinfoClearOption()
+{
+       do {
+               const OptionContext * options = getOptions();
+               if (!options || !options->hasOption(kSecinfoClearOptionName))
+               {
+                       break;
+               }
+               
+               const Value * value = options->getOption(kSecinfoClearOptionName);
+               const StringValue * stringValue = dynamic_cast<const StringValue*>(value);
+               if (!stringValue)
+               {
+                       // Not a string value, warn the user.
+                       Log::log(Logger::WARNING, "invalid type for 'secinfoClear' option\n");
+                       break;
+               }
+               
+               std::string secinfoOption = *stringValue;
+               
+               // convert option value to uppercase
+               std::transform<std::string::const_iterator, std::string::iterator, int (*)(int)>(secinfoOption.begin(), secinfoOption.end(), secinfoOption.begin(), toupper);
+               
+               if (secinfoOption == kSecinfoDefaultName)
+               {
+                       return kSecinfoDefault;
+               }
+               else if (secinfoOption == kSecinfoIgnoreName)
+               {
+                       return kSecinfoIgnore;
+               }
+               else if (secinfoOption == kSecinfoROMName)
+               {
+                       return kSecinfoROMClear;
+               }
+               else if (secinfoOption == kSecinfoCName)
+               {
+                       return kSecinfoCStartupClear;
+               }
+
+               // Unrecognized option value, log a warning.
+               Log::log(Logger::WARNING, "unrecognized value for 'secinfoClear' option\n");
+       } while (0);
+       
+       return kSecinfoDefault;
+}
+
+//! To create a data source for all sections of the ELF file, a WildcardMatcher
+//! is instantiated and passed to createDataSource(StringMatcher&).
+DataSource * ELFSourceFile::createDataSource()
+{
+       WildcardMatcher matcher;
+       return createDataSource(matcher);
+}
+       
+DataSource * ELFSourceFile::createDataSource(StringMatcher & matcher)
+{
+       assert(m_file);
+       ELFDataSource * source = new ELFDataSource(m_file);
+       source->setSecinfoOption(m_secinfoOption);
+       
+       Log::log(Logger::DEBUG2, "filtering sections of file: %s\n", getPath().c_str());
+       
+       // We start at section 1 to skip the null section that is always first.
+       unsigned index = 1;
+       for (; index < m_file->getSectionCount(); ++index)
+       {
+               const Elf32_Shdr & header = m_file->getSectionAtIndex(index);
+               std::string name = m_file->getSectionNameAtIndex(header.sh_name);
+               
+               // Ignore most section types
+               switch (header.sh_type) {
+               case SHT_PROGBITS:
+               case SHT_NOBITS:
+               case SHT_REL:
+               case SHT_DYNSYM:
+                       break;
+
+               default:
+                       continue;
+               }
+
+               // Ignore sections that don't have the allocate flag set.
+               if ((header.sh_flags & SHF_ALLOC) == 0)
+               {
+                       continue;
+               }
+
+               if (matcher.match(name))
+               {
+                       Log::log(Logger::DEBUG2, "creating segment for section %s\n", name.c_str());
+                       source->addSection(index);
+               }
+               else
+               {
+                       Log::log(Logger::DEBUG2, "section %s did not match\n", name.c_str());
+               }
+       }
+       
+       return source;
+}
+
+//! It is assumed that all ELF files have an entry point.
+//!
+bool ELFSourceFile::hasEntryPoint()
+{
+       return true;
+}
+
+//! The StELFFile::getTypeOfSymbolAtIndex() method uses different methods of determining
+//! ARM/Thumb mode depending on the toolset.
+uint32_t ELFSourceFile::getEntryPointAddress()
+{
+       uint32_t entryPoint = 0;
+       
+       // get entry point address
+       const Elf32_Ehdr & header = m_file->getFileHeader();
+
+       // find symbol corresponding to entry point and determine if
+       // it is arm or thumb mode
+       unsigned symbolIndex = m_file->getIndexOfSymbolAtAddress(header.e_entry);
+       if (symbolIndex != 0)
+       {
+               ARMSymbolType_t symbolType = m_file->getTypeOfSymbolAtIndex(symbolIndex);
+               bool entryPointIsThumb = (symbolType == eThumbSymbol);
+               const Elf32_Sym & symbol = m_file->getSymbolAtIndex(symbolIndex);
+               std::string symbolName = m_file->getSymbolName(symbol);
+
+               Log::log(Logger::DEBUG2, "Entry point is %s@0x%08x (%s)\n", symbolName.c_str(), symbol.st_value, entryPointIsThumb ? "Thumb" : "ARM");
+
+               // set entry point, setting the low bit if it is thumb mode
+               entryPoint = header.e_entry + (entryPointIsThumb ? 1 : 0);
+       }
+       else
+       {
+               entryPoint = header.e_entry;
+       }
+       
+       return entryPoint;
+}
+
+//! \return A DataTarget that describes the named section.
+//! \retval NULL There was no section with the requested name.
+DataTarget * ELFSourceFile::createDataTargetForSection(const std::string & section)
+{
+       assert(m_file);
+       unsigned index = m_file->getIndexOfSectionWithName(section);
+       if (index == SHN_UNDEF)
+       {
+               return NULL;
+       }
+       
+       const Elf32_Shdr & sectionHeader = m_file->getSectionAtIndex(index);
+       uint32_t beginAddress = sectionHeader.sh_addr;
+       uint32_t endAddress = beginAddress + sectionHeader.sh_size;
+       ConstantDataTarget * target = new ConstantDataTarget(beginAddress, endAddress);
+       return target;
+}
+
+//! \return A DataTarget instance pointing at the requested symbol.
+//! \retval NULL No symbol matching the requested name was found.
+DataTarget * ELFSourceFile::createDataTargetForSymbol(const std::string & symbol)
+{
+       assert(m_file);
+       unsigned symbolCount = m_file->getSymbolCount();
+       unsigned i;
+       
+       for (i=0; i < symbolCount; ++i)
+       {
+               const Elf32_Sym & symbolHeader = m_file->getSymbolAtIndex(i);
+               std::string symbolName = m_file->getSymbolName(symbolHeader);
+               if (symbolName == symbol)
+               {
+            ARMSymbolType_t symbolType = m_file->getTypeOfSymbolAtIndex(i);
+            bool symbolIsThumb = (symbolType == eThumbSymbol);
+            
+                       uint32_t beginAddress = symbolHeader.st_value + (symbolIsThumb ? 1 : 0);
+                       uint32_t endAddress = beginAddress + symbolHeader.st_size;
+                       ConstantDataTarget * target = new ConstantDataTarget(beginAddress, endAddress);
+                       return target;
+               }
+       }
+       
+       // didn't find a matching symbol
+       return NULL; 
+}
+
+bool ELFSourceFile::hasSymbol(const std::string & name)
+{
+       Elf32_Sym symbol;
+       return lookupSymbol(name, symbol);
+}
+
+uint32_t ELFSourceFile::getSymbolValue(const std::string & name)
+{
+       unsigned symbolCount = m_file->getSymbolCount();
+       unsigned i;
+       
+       for (i=0; i < symbolCount; ++i)
+       {
+               const Elf32_Sym & symbolHeader = m_file->getSymbolAtIndex(i);
+               std::string symbolName = m_file->getSymbolName(symbolHeader);
+               if (symbolName == name)
+               {
+            // If the symbol is a function, then we check to see if it is Thumb code and set bit 0 if so.
+            if (ELF32_ST_TYPE(symbolHeader.st_info) == STT_FUNC)
+            {
+                ARMSymbolType_t symbolType = m_file->getTypeOfSymbolAtIndex(i);
+                bool symbolIsThumb = (symbolType == eThumbSymbol);
+                return symbolHeader.st_value + (symbolIsThumb ? 1 : 0);
+            }
+            else
+            {
+                           return symbolHeader.st_value;
+            }
+               }
+       }
+       
+    // Couldn't find the symbol, so return 0.
+       return 0;
+}
+
+unsigned ELFSourceFile::getSymbolSize(const std::string & name)
+{
+       Elf32_Sym symbol;
+       if (!lookupSymbol(name, symbol))
+       {
+               return 0;
+       }
+       
+       return symbol.st_size;
+}
+
+//! \param name The name of the symbol on which info is wanted.
+//! \param[out] info Upon succssful return this is filled in with the symbol's information.
+//!
+//! \retval true The symbol was found and \a info is valid.
+//! \retval false No symbol with \a name was found in the file.
+bool ELFSourceFile::lookupSymbol(const std::string & name, Elf32_Sym & info)
+{
+       assert(m_file);
+       unsigned symbolCount = m_file->getSymbolCount();
+       unsigned i;
+       
+       for (i=0; i < symbolCount; ++i)
+       {
+               const Elf32_Sym & symbol = m_file->getSymbolAtIndex(i);
+               std::string thisSymbolName = m_file->getSymbolName(symbol);
+               
+               // Is this the symbol we're looking for?
+               if (thisSymbolName == name)
+               {
+                       info = symbol;
+                       return true;
+               }
+       }
+       
+       // Didn't file the symbol.
+       return false;
+}
+
+ELFSourceFile::ELFDataSource::~ELFDataSource()
+{
+       segment_vector_t::iterator it = m_segments.begin();
+       for (; it != m_segments.end(); ++it)
+       {
+               delete *it;
+       }
+}
+
+//! Not all sections will actually result in a new segment being created. Only
+//! those sections whose type is #SHT_PROGBITS or #SHT_NOBITS will create
+//! a new segment. Also, only sections whose size is non-zero will actually
+//! create a segment.
+//!
+//! In addition to this, ELF files that have been marked as being created by
+//! the Green Hills Software toolset have an extra step. #SHT_NOBITS sections
+//! are looked up in the .secinfo section to determine if they really
+//! should be filled. If not in the .secinfo table, no segment will be
+//! created for the section.
+void ELFSourceFile::ELFDataSource::addSection(unsigned sectionIndex)
+{
+       // get section info
+       const Elf32_Shdr & section = m_elf->getSectionAtIndex(sectionIndex);
+       if (section.sh_size == 0)
+       {
+               // empty section, so ignore it
+               return;
+       }
+       
+       // create the right segment subclass based on the section type
+       DataSource::Segment * segment = NULL;
+       switch (section.sh_type) {
+       case SHT_PROGBITS:
+       case SHT_REL:
+       case SHT_DYNSYM:
+               segment = new ProgBitsSegment(*this, m_elf, sectionIndex);
+               break;
+
+       case SHT_NOBITS:
+       {
+               // Always add NOBITS sections by default.
+               bool addNobits = true;
+
+               // For GHS ELF files, we use the secinfoClear option to figure out what to do.
+               // If set to ignore, treat like a normal ELF file and always add. If set to
+               // ROM, then only clear if the section is listed in .secinfo. Otherwise if set
+               // to C startup, then let the C startup do all clearing.
+               addNobits = false;
+               if (m_elf->ELFVariant() == eGHSVariant)
+               {
+                       GHSSecInfo secinfo(m_elf);
+
+                       // If there isn't a .secinfo section present then use the normal ELF rules
+                       // and always add NOBITS sections.
+                       if (secinfo.hasSecinfo() && m_secinfoOption != kSecinfoIgnore)
+                       {
+                               switch (m_secinfoOption)
+                               {
+                                       case kSecinfoROMClear:
+                                               addNobits = secinfo.isSectionFilled(section);
+                                               break;
+
+                                       case kSecinfoCStartupClear:
+                                               addNobits = false;
+                                               break;
+                               }
+                       }
+               }
+
+               if (addNobits)
+               {
+                       segment = new NoBitsSegment(*this, m_elf, sectionIndex);
+               }
+               else
+               {
+                       std::string name = m_elf->getSectionNameAtIndex(section.sh_name);
+                       Log::log(Logger::DEBUG2, "..section %s is not filled\n", name.c_str());
+               }
+       }
+       break;
+       }
+       // add segment if one was created
+       if (segment)
+       {
+               m_segments.push_back(segment);
+       }
+}
+
+ELFSourceFile::ELFDataSource::ProgBitsSegment::ProgBitsSegment(ELFDataSource & source, StELFFile * elf, unsigned index)
+:      DataSource::Segment(source), m_elf(elf), m_sectionIndex(index)
+{
+}
+
+unsigned ELFSourceFile::ELFDataSource::ProgBitsSegment::getData(unsigned offset, unsigned maxBytes, uint8_t * buffer)
+{
+       const Elf32_Shdr & section = m_elf->getSectionAtIndex(m_sectionIndex);
+       uint8_t * data = m_elf->getSectionDataAtIndex(m_sectionIndex);
+       
+       assert(offset < section.sh_size);
+       
+       unsigned copyBytes = std::min<unsigned>(section.sh_size - offset, maxBytes);
+       if (copyBytes)
+       {
+               memcpy(buffer, &data[offset], copyBytes);
+       }
+       
+       return copyBytes;
+}
+
+unsigned ELFSourceFile::ELFDataSource::ProgBitsSegment::getLength()
+{
+       const Elf32_Shdr & section = m_elf->getSectionAtIndex(m_sectionIndex);
+       return section.sh_size;
+}
+
+uint32_t ELFSourceFile::ELFDataSource::ProgBitsSegment::getBaseAddress()
+{
+       const Elf32_Shdr & section = m_elf->getSectionAtIndex(m_sectionIndex);
+       return section.sh_addr;
+}
+
+ELFSourceFile::ELFDataSource::NoBitsSegment::NoBitsSegment(ELFDataSource & source, StELFFile * elf, unsigned index)
+:      DataSource::PatternSegment(source), m_elf(elf), m_sectionIndex(index)
+{
+}
+
+unsigned ELFSourceFile::ELFDataSource::NoBitsSegment::getLength()
+{
+       const Elf32_Shdr & section = m_elf->getSectionAtIndex(m_sectionIndex);
+       return section.sh_size;
+}
+
+uint32_t ELFSourceFile::ELFDataSource::NoBitsSegment::getBaseAddress()
+{
+       const Elf32_Shdr & section = m_elf->getSectionAtIndex(m_sectionIndex);
+       return section.sh_addr;
+}
+
diff --git a/tools/elftosb/common/ELFSourceFile.h b/tools/elftosb/common/ELFSourceFile.h
new file mode 100644 (file)
index 0000000..c07aa56
--- /dev/null
@@ -0,0 +1,224 @@
+/*
+ * File:       ELFSourceFile.h
+ *
+ * Copyright (c) Freescale Semiconductor, Inc. All rights reserved.
+ * See included license file for license details.
+ */
+#if !defined(_ELFSourceFile_h_)
+#define _ELFSourceFile_h_
+
+#include "SourceFile.h"
+#include "StELFFile.h"
+#include "smart_ptr.h"
+#include "DataSource.h"
+#include "DataTarget.h"
+#include "ELF.h"
+
+namespace elftosb
+{
+
+//! Set of supported compiler toolsets.
+enum elf_toolset_t
+{
+       kUnknownToolset,        //!< Unknown.
+       kGHSToolset,            //!< Green Hills Software MULTI
+       kGCCToolset,            //!< GNU GCC
+       kADSToolset                     //!< ARM UK RealView
+};
+
+//! Options for handling the .secinfo section in GHS-produced ELF files.
+enum secinfo_clear_t
+{
+       // Default value for the .secinfo action.
+       kSecinfoDefault,
+
+       //! Ignore the .secinfo section if present. The standard ELF loading
+       //! rules are followed.
+       kSecinfoIgnore,
+
+       //! The boot ROM clears only those SHT_NOBITS sections present in .secinfo.
+       kSecinfoROMClear,
+       
+       //! The C startup is responsible for clearing sections. No fill commands
+       //! are generated for any SHT_NOBITS sections.
+       kSecinfoCStartupClear
+};
+
+/*!
+ * \brief Executable and Loading Format (ELF) source file.
+ */
+class ELFSourceFile : public SourceFile
+{
+public:
+       //! \brief Default constructor.
+       ELFSourceFile(const std::string & path);
+       
+       //! \brief Destructor.
+       virtual ~ELFSourceFile();
+       
+       //! \brief Identifies whether the stream contains an ELF file.
+       static bool isELFFile(std::istream & stream);
+       
+       //! \name Opening and closing
+       //@{
+       //! \brief Opens the file.
+       virtual void open();
+       
+       //! \brief Closes the file.
+       virtual void close();
+       //@}
+       
+       //! \name Format capabilities
+       //@{
+       virtual bool supportsNamedSections() const { return true; }
+       virtual bool supportsNamedSymbols() const { return true; }
+       //@}
+       
+       //! \name Data source
+       //@{
+       //! \brief Creates a data source from the entire file.
+       virtual DataSource * createDataSource();
+       
+       //! \brief Creates a data source from one or more sections of the file.
+       virtual DataSource * createDataSource(StringMatcher & matcher);
+       //@}
+       
+       //! \name Entry point
+       //@{
+       //! \brief Returns true if an entry point was set in the file.
+       virtual bool hasEntryPoint();
+       
+       //! \brief Returns the entry point address.
+       virtual uint32_t getEntryPointAddress();
+       //@}
+       
+       //! \name Data target
+       //@{
+       virtual DataTarget * createDataTargetForSection(const std::string & section);
+       virtual DataTarget * createDataTargetForSymbol(const std::string & symbol);
+       //@}
+       
+       //! \name Symbols
+       //@{
+       //! \brief Returns whether a symbol exists in the source file.
+       virtual bool hasSymbol(const std::string & name);
+       
+       //! \brief Returns the value of a symbol.
+       virtual uint32_t getSymbolValue(const std::string & name);
+       
+       //! \brief Returns the size of a symbol.
+       virtual unsigned getSymbolSize(const std::string & name);
+       //@}
+       
+       //! \name Direct ELF format access
+       //@{
+       //! \brief Returns the underlying StELFFile object.
+       StELFFile * getELFFile() { return m_file; }
+       
+       //! \brief Gets information about a symbol in the ELF file.
+       bool lookupSymbol(const std::string & name, Elf32_Sym & info);
+       //@}
+
+protected:
+       smart_ptr<StELFFile> m_file;    //!< Parser for the ELF file.
+       elf_toolset_t m_toolset;        //!< Toolset that produced the ELF file.
+       secinfo_clear_t m_secinfoOption;        //!< How to deal with the .secinfo section. Ignored if the toolset is not GHS.
+
+protected:
+       //! \brief Parses the toolset option value.
+       elf_toolset_t readToolsetOption();
+
+       //! \brief Reads the secinfoClear option.
+       secinfo_clear_t readSecinfoClearOption();
+       
+protected:
+       /*!
+        * \brief A data source with ELF file sections as the contents.
+        *
+        * Each segment of this data source corresponds directly with a named section
+        * of the ELF file it represents. When the data source is created, it contains
+        * no segments. Segments are created with the addSection() method, which takes
+        * the index of an ELF section and creates a corresponding segment.
+        *
+        * Two segment subclasses are used with this data source. The first, ProgBitsSegment,
+        * is used to represent sections whose type is #SHT_PROGBITS. These sections have
+        * binary data stored in the ELF file. The second segment type is NoBitsSegment.
+        * It is used to represent sections whose type is #SHT_NOBITS. These sections have
+        * no data, but simply allocate a region of memory to be filled with zeroes.
+        * As such, the NoBitsSegment class is a subclass of DataSource::PatternSegment.
+        */
+       class ELFDataSource : public DataSource
+       {
+       public:
+               /*!
+                * \brief Represents one named #SHT_PROGBITS section within the ELF file.
+                */
+               class ProgBitsSegment : public DataSource::Segment
+               {
+               public:
+                       ProgBitsSegment(ELFDataSource & source, StELFFile * elf, unsigned index);
+                       
+                       virtual unsigned getData(unsigned offset, unsigned maxBytes, uint8_t * buffer);
+                       virtual unsigned getLength();
+               
+                       virtual bool hasNaturalLocation() { return true; }
+                       virtual uint32_t getBaseAddress();
+               
+               protected:
+                       StELFFile * m_elf;      //!< The format parser instance for this ELF file.
+                       unsigned m_sectionIndex;        //!< The index of the section this segment represents.
+               };
+               
+               /*!
+                * \brief Represents one named #SHT_NOBITS section within the ELF file.
+                *
+                * This segment class is a subclass of DataSource::PatternSegment since it
+                * represents a region of memory to be filled with zeroes.
+                */
+               class NoBitsSegment : public DataSource::PatternSegment
+               {
+               public:
+                       NoBitsSegment(ELFDataSource & source, StELFFile * elf, unsigned index);
+                       
+                       virtual unsigned getLength();
+               
+                       virtual bool hasNaturalLocation() { return true; }
+                       virtual uint32_t getBaseAddress();
+               
+               protected:
+                       StELFFile * m_elf;      //!< The format parser instance for this ELF file.
+                       unsigned m_sectionIndex;        //!< The index of the section this segment represents.
+               };
+               
+       public:
+               //! \brief Default constructor.
+               ELFDataSource(StELFFile * elf) : DataSource(), m_elf(elf) {}
+               
+               //! \brief Destructor.
+               virtual ~ELFDataSource();
+
+               //! Set the option to control .secinfo usage.
+               inline void setSecinfoOption(secinfo_clear_t option) { m_secinfoOption = option; }
+               
+               //! \brief Adds the ELF section at position \a sectionIndex to the data source.
+               void addSection(unsigned sectionIndex);
+               
+               //! \brief Returns the number of segments in the source.
+               virtual unsigned getSegmentCount() { return (unsigned)m_segments.size(); }
+               
+               //! \brief Returns the segment at position \a index.
+               virtual DataSource::Segment * getSegmentAt(unsigned index) { return m_segments[index]; }
+               
+       protected:
+               StELFFile * m_elf;      //!< The ELF file parser.
+               secinfo_clear_t m_secinfoOption;        //!< How to deal with the .secinfo section. Ignored if the toolset is not GHS.
+               
+               typedef std::vector<DataSource::Segment*> segment_vector_t;     //!< A list of segment instances.
+               segment_vector_t m_segments;    //!< The segments of this data source.
+       };
+
+};
+
+}; // namespace elftosb
+
+#endif // _ELFSourceFile_h_
diff --git a/tools/elftosb/common/EncoreBootImage.cpp b/tools/elftosb/common/EncoreBootImage.cpp
new file mode 100644 (file)
index 0000000..cca62b7
--- /dev/null
@@ -0,0 +1,1372 @@
+/*
+ * File:       EncoreBootImage.cpp
+ *
+ * Copyright (c) Freescale Semiconductor, Inc. All rights reserved.
+ * See included license file for license details.
+ */
+
+#include "EncoreBootImage.h"
+#include <stdexcept>
+#include <algorithm>
+#include <time.h>
+#include "crc.h"
+#include "SHA1.h"
+#include "Random.h"
+#include "rijndael.h"
+#include "RijndaelCBCMAC.h"
+#include "Logging.h"
+#include "EndianUtilities.h"
+
+using namespace elftosb;
+
+EncoreBootImage::EncoreBootImage()
+:      m_headerFlags(0),
+       m_productVersion(),
+       m_componentVersion(),
+       m_driveTag(0)
+{
+}
+
+EncoreBootImage::~EncoreBootImage()
+{
+       // dispose of all sections
+       section_iterator_t it = beginSection();
+       for (; it != endSection(); ++it)
+       {
+               delete *it;
+       }
+}
+
+//! \exception std::runtime_error Raised if \a newSection has the same tag as a previously
+//!            added section.
+void EncoreBootImage::addSection(Section * newSection)
+{
+       // check for another section with this tag
+       section_iterator_t it = beginSection();
+       for (; it != endSection(); ++it)
+       {
+               if ((*it)->getIdentifier() == newSection->getIdentifier())
+               {
+                       throw std::runtime_error("new section with non-unique tag");
+               }
+       }
+       
+       // no conflicting section tags, so add it
+       m_sections.push_back(newSection);
+       
+       // tell the image who owns it now
+       newSection->setImage(this);
+}
+
+EncoreBootImage::section_iterator_t EncoreBootImage::findSection(Section * section)
+{
+       return std::find(beginSection(), endSection(), section);
+}
+
+void EncoreBootImage::setProductVersion(const version_t & version)
+{
+       m_productVersion = version;
+}
+
+void EncoreBootImage::setComponentVersion(const version_t & version)
+{
+       m_componentVersion = version;
+}
+
+//! \todo Optimize writing section data. Right now it only writes one block at a
+//!            time, which is of course quite slow (in relative terms).
+//!    \todo Refactor this into several different methods for writing each region
+//!            of the image. Use a context structure to keep track of shared data between
+//!            each of the methods.
+//! \todo Refactor the section and boot tag writing code to only have a single
+//!            copy of the block writing and encryption loop.
+void EncoreBootImage::writeToStream(std::ostream & stream)
+{
+       // always generate the session key or DEK even if image is unencrypted
+       m_sessionKey.randomize();
+       
+       // prepare to compute CBC-MACs with each KEK
+       unsigned i;
+       smart_array_ptr<RijndaelCBCMAC> macs(0);
+       if (isEncrypted())
+       {
+               macs = new RijndaelCBCMAC[m_keys.size()];
+               for (i=0; i < m_keys.size(); ++i)
+               {
+                       RijndaelCBCMAC mac(m_keys[i]);
+                       (macs.get())[i] = mac;
+               }
+       }
+       
+       // prepare to compute SHA-1 digest over entire image
+       CSHA1 hash;
+       hash.Reset();
+       
+       // count of total blocks written to the file
+       unsigned fileBlocksWritten = 0;
+
+       // we need some pieces of the header down below
+       boot_image_header_t imageHeader;
+       prepareImageHeader(imageHeader);
+       
+       // write plaintext header
+       {
+               // write header
+               assert(sizeOfPaddingForCipherBlocks(sizeof(boot_image_header_t)) == 0);
+               stream.write(reinterpret_cast<char *>(&imageHeader), sizeof(imageHeader));
+               fileBlocksWritten += numberOfCipherBlocks(sizeof(imageHeader));
+               
+               // update CBC-MAC over image header
+               if (isEncrypted())
+               {
+                       for (i=0; i < m_keys.size(); ++i)
+                       {
+                               (macs.get())[i].update(reinterpret_cast<uint8_t *>(&imageHeader), sizeof(imageHeader));
+                       }
+               }
+               
+               // update SHA-1
+               hash.Update(reinterpret_cast<uint8_t *>(&imageHeader), sizeof(imageHeader));
+       }
+       
+       // write plaintext section table
+       {
+               section_iterator_t it = beginSection();
+               for (; it != endSection(); ++it)
+               {
+                       Section * section = *it;
+                       
+                       // write header for this section
+                       assert(sizeOfPaddingForCipherBlocks(sizeof(section_header_t)) == 0);
+                       section_header_t sectionHeader;
+                       section->fillSectionHeader(sectionHeader);
+                       stream.write(reinterpret_cast<char *>(&sectionHeader), sizeof(sectionHeader));
+                       fileBlocksWritten += numberOfCipherBlocks(sizeof(sectionHeader));
+                       
+                       // update CBC-MAC over this entry
+                       if (isEncrypted())
+                       {
+                               for (i=0; i < m_keys.size(); ++i)
+                               {
+                                       (macs.get())[i].update(reinterpret_cast<uint8_t *>(&sectionHeader), sizeof(sectionHeader));
+                               }
+                       }
+                       
+                       // update SHA-1
+                       hash.Update(reinterpret_cast<uint8_t *>(&sectionHeader), sizeof(sectionHeader));
+               }
+       }
+       
+       // finished with the CBC-MAC
+       if (isEncrypted())
+       {
+               for (i=0; i < m_keys.size(); ++i)
+               {
+                       (macs.get())[i].finalize();
+               }
+       }
+       
+       // write key dictionary
+       if (isEncrypted())
+       {
+               key_iterator_t it = beginKeys();
+               for (i=0; it != endKeys(); ++it, ++i)
+               {
+                       // write CBC-MAC result for this key, then update SHA-1
+                       RijndaelCBCMAC & mac = (macs.get())[i];
+                       const RijndaelCBCMAC::block_t & macResult = mac.getMAC();
+                       stream.write(reinterpret_cast<const char *>(&macResult), sizeof(RijndaelCBCMAC::block_t));
+                       hash.Update(reinterpret_cast<const uint8_t *>(&macResult), sizeof(RijndaelCBCMAC::block_t));
+                       fileBlocksWritten++;
+                       
+                       // encrypt DEK with this key, write it out, and update image digest
+                       Rijndael cipher;
+                       cipher.init(Rijndael::CBC, Rijndael::Encrypt, *it, Rijndael::Key16Bytes, imageHeader.m_iv);
+                       AESKey<128>::key_t wrappedSessionKey;
+                       cipher.blockEncrypt(m_sessionKey, sizeof(AESKey<128>::key_t) * 8, wrappedSessionKey);
+                       stream.write(reinterpret_cast<char *>(&wrappedSessionKey), sizeof(wrappedSessionKey));
+                       hash.Update(reinterpret_cast<uint8_t *>(&wrappedSessionKey), sizeof(wrappedSessionKey));
+                       fileBlocksWritten++;
+               }
+       }
+       
+       // write sections and boot tags
+       {
+               section_iterator_t it = beginSection();
+               for (; it != endSection(); ++it)
+               {
+                       section_iterator_t itCopy = it;
+                       bool isLastSection = (++itCopy == endSection());
+                       
+                       Section * section = *it;
+                       cipher_block_t block;
+                       unsigned blockCount = section->getBlockCount();
+                       unsigned blocksWritten = 0;
+                       
+                       Rijndael cipher;
+                       cipher.init(Rijndael::CBC, Rijndael::Encrypt, m_sessionKey, Rijndael::Key16Bytes, imageHeader.m_iv);
+                       
+                       // Compute the number of padding blocks needed to align the section. This first
+                       // call to getPadBlockCountForOffset() passes an offset that excludes
+                       // the boot tag for this section.
+                       unsigned paddingBlocks = getPadBlockCountForSection(section, fileBlocksWritten);
+                       
+                       // Insert nop commands as padding to align the start of the section, if
+                       // the section has special alignment requirements.
+                       NopCommand nop;
+                       while (paddingBlocks--)
+                       {
+                               blockCount = nop.getBlockCount();
+                               blocksWritten = 0;
+                               while (blocksWritten < blockCount)
+                               {
+                                       nop.getBlocks(blocksWritten, 1, &block);
+                                       
+                                       if (isEncrypted())
+                                       {
+                                               // re-init after encrypt to update IV
+                                               cipher.blockEncrypt(block, sizeof(cipher_block_t) * 8, block);
+                                               cipher.init(Rijndael::CBC, Rijndael::Encrypt, m_sessionKey, Rijndael::Key16Bytes, block);
+                                       }
+                                       
+                                       stream.write(reinterpret_cast<char *>(&block), sizeof(cipher_block_t));
+                                       hash.Update(reinterpret_cast<uint8_t *>(&block), sizeof(cipher_block_t));
+                                       
+                                       blocksWritten++;
+                                       fileBlocksWritten++;
+                               }
+                       }
+                       
+                       // reinit cipher for boot tag
+                       cipher.init(Rijndael::CBC, Rijndael::Encrypt, m_sessionKey, Rijndael::Key16Bytes, imageHeader.m_iv);
+                       
+                       // write boot tag
+                       TagCommand tag(*section);
+                       tag.setLast(isLastSection);
+                       if (!isLastSection)
+                       {
+                               // If this isn't the last section, the tag needs to include any
+                               // padding for the next section in its length, otherwise the ROM
+                               // won't be able to find the next section's boot tag.
+                               unsigned nextSectionOffset = fileBlocksWritten + section->getBlockCount() + 1;
+                               tag.setSectionLength(section->getBlockCount() + getPadBlockCountForSection(*itCopy, nextSectionOffset));
+                       }
+                       blockCount = tag.getBlockCount();
+                       blocksWritten = 0;
+                       while (blocksWritten < blockCount)
+                       {
+                               tag.getBlocks(blocksWritten, 1, &block);
+                               
+                               if (isEncrypted())
+                               {
+                                       // re-init after encrypt to update IV
+                                       cipher.blockEncrypt(block, sizeof(cipher_block_t) * 8, block);
+                                       cipher.init(Rijndael::CBC, Rijndael::Encrypt, m_sessionKey, Rijndael::Key16Bytes, block);
+                               }
+                               
+                               stream.write(reinterpret_cast<char *>(&block), sizeof(cipher_block_t));
+                               hash.Update(reinterpret_cast<uint8_t *>(&block), sizeof(cipher_block_t));
+                               
+                               blocksWritten++;
+                               fileBlocksWritten++;
+                       }
+                       
+                       // reinit cipher for section data
+                       cipher.init(Rijndael::CBC, Rijndael::Encrypt, m_sessionKey, Rijndael::Key16Bytes, imageHeader.m_iv);
+                       
+                       // write section data
+                       blockCount = section->getBlockCount();
+                       blocksWritten = 0;
+                       while (blocksWritten < blockCount)
+                       {
+                               section->getBlocks(blocksWritten, 1, &block);
+                               
+                               // Only encrypt the section contents if the entire boot image is encrypted
+                               // and the section doesn't have the "leave unencrypted" flag set. Even if the
+                               // section is unencrypted the boot tag will remain encrypted.
+                               if (isEncrypted() && !section->getLeaveUnencrypted())
+                               {
+                                       // re-init after encrypt to update IV
+                                       cipher.blockEncrypt(block, sizeof(cipher_block_t) * 8, block);
+                                       cipher.init(Rijndael::CBC, Rijndael::Encrypt, m_sessionKey, Rijndael::Key16Bytes, block);
+                               }
+                               
+                               stream.write(reinterpret_cast<char *>(&block), sizeof(cipher_block_t));
+                               hash.Update(reinterpret_cast<uint8_t *>(&block), sizeof(cipher_block_t));
+                               
+                               blocksWritten++;
+                               fileBlocksWritten++;
+                       }
+               }
+       }
+       
+       // write SHA-1 digest over entire image
+       {
+               // allocate enough room for digest and bytes to pad out to the next cipher block
+               const unsigned padBytes = sizeOfPaddingForCipherBlocks(sizeof(sha1_digest_t));
+               unsigned digestBlocksSize = sizeof(sha1_digest_t) + padBytes;
+               smart_array_ptr<uint8_t> digestBlocks = new uint8_t[digestBlocksSize];
+               hash.Final();
+               hash.GetHash(digestBlocks.get());
+               
+               // set the pad bytes to random values
+               RandomNumberGenerator rng;
+               rng.generateBlock(&(digestBlocks.get())[sizeof(sha1_digest_t)], padBytes);
+               
+               // encrypt with session key
+               if (isEncrypted())
+               {
+                       Rijndael cipher;
+                       cipher.init(Rijndael::CBC, Rijndael::Encrypt, m_sessionKey, Rijndael::Key16Bytes, imageHeader.m_iv);
+                       cipher.blockEncrypt(digestBlocks.get(), digestBlocksSize * 8, digestBlocks.get());
+               }
+               
+               // write to the stream
+               stream.write(reinterpret_cast<char *>(digestBlocks.get()), digestBlocksSize);
+       }
+}
+
+void EncoreBootImage::prepareImageHeader(boot_image_header_t & header)
+{
+       // get identifier for the first bootable section
+       Section * firstBootSection = findFirstBootableSection();
+       section_id_t firstBootSectionID = 0;
+       if (firstBootSection)
+       {
+               firstBootSectionID = firstBootSection->getIdentifier();
+       }
+       
+       // fill in header fields
+       header.m_signature[0] = 'S';
+       header.m_signature[1] = 'T';
+       header.m_signature[2] = 'M';
+       header.m_signature[3] = 'P';
+       header.m_majorVersion = ROM_BOOT_IMAGE_MAJOR_VERSION;
+       header.m_minorVersion = ROM_BOOT_IMAGE_MINOR_VERSION;
+       header.m_flags = ENDIAN_HOST_TO_LITTLE_U16(m_headerFlags);
+       header.m_imageBlocks = ENDIAN_HOST_TO_LITTLE_U32(getImageSize());
+       header.m_firstBootableSectionID = ENDIAN_HOST_TO_LITTLE_U32(firstBootSectionID);
+       header.m_keyCount = ENDIAN_HOST_TO_LITTLE_U16((uint16_t)m_keys.size());
+       header.m_headerBlocks = ENDIAN_HOST_TO_LITTLE_U16((uint16_t)numberOfCipherBlocks(sizeof(header)));
+       header.m_sectionCount = ENDIAN_HOST_TO_LITTLE_U16((uint16_t)m_sections.size());
+       header.m_sectionHeaderSize = ENDIAN_HOST_TO_LITTLE_U16((uint16_t)numberOfCipherBlocks(sizeof(section_header_t)));
+       header.m_signature2[0] = 's';
+       header.m_signature2[1] = 'g';
+       header.m_signature2[2] = 't';
+       header.m_signature2[3] = 'l';
+       header.m_timestamp = ENDIAN_HOST_TO_LITTLE_U64(getTimestamp());
+       header.m_driveTag = m_driveTag;
+
+       // Prepare version fields by converting them to the correct byte order.
+       header.m_productVersion = m_productVersion;
+       header.m_componentVersion = m_componentVersion;
+       header.m_productVersion.fixByteOrder();
+       header.m_componentVersion.fixByteOrder();
+
+       // the fields are dependant on others
+       header.m_keyDictionaryBlock = ENDIAN_HOST_TO_LITTLE_U16(header.m_headerBlocks + header.m_sectionCount * header.m_sectionHeaderSize);
+       header.m_firstBootTagBlock = ENDIAN_HOST_TO_LITTLE_U32(header.m_keyDictionaryBlock + header.m_keyCount * 2);
+       
+       // generate random pad bytes
+       RandomNumberGenerator rng;
+       rng.generateBlock(header.m_padding0, sizeof(header.m_padding0));
+       rng.generateBlock(header.m_padding1, sizeof(header.m_padding1));
+       
+       // compute SHA-1 digest over the image header
+       uint8_t * message = reinterpret_cast<uint8_t *>(&header.m_signature);
+       uint32_t length = static_cast<uint32_t>(sizeof(header) - sizeof(header.m_digest)); // include padding
+       
+       CSHA1 hash;
+       hash.Reset();
+       hash.Update(message, length);
+       hash.Final();
+       hash.GetHash(header.m_digest);
+}
+
+//! Returns the number of microseconds since 00:00 1-1-2000. In actuality, the timestamp
+//! is only accurate to seconds, and is simply extended out to microseconds.
+//!
+//! \todo Use the operating system's low-level functions to get a true microsecond
+//!            timestamp, instead of faking it like we do now.
+//! \bug The timestamp might be off an hour.
+uint64_t EncoreBootImage::getTimestamp()
+{
+#if WIN32
+       struct tm epoch = { 0, 0, 0, 1, 0, 100, 0, 0 }; // 00:00 1-1-2000
+#else
+       struct tm epoch = { 0, 0, 0, 1, 0, 100, 0, 0, 1, 0, NULL }; // 00:00 1-1-2000
+#endif
+       time_t epochTime = mktime(&epoch);
+       time_t now = time(NULL);
+       now -= epochTime;
+       uint64_t microNow = uint64_t(now) * 1000000;    // convert to microseconds
+       return microNow;
+}
+
+//! Scans the section list looking for the first section which has
+//! the #ROM_SECTION_BOOTABLE flag set on it.
+EncoreBootImage::Section * EncoreBootImage::findFirstBootableSection()
+{
+       section_iterator_t it = beginSection();
+       for (; it != endSection(); ++it)
+       {
+               if ((*it)->getFlags() & ROM_SECTION_BOOTABLE)
+               {
+                       return *it;
+               }
+       }
+       
+       // no bootable sections were found
+       return NULL;
+}
+
+//! The boot tag for \a section is taken into account, thus making the
+//! result offset point to the first block of the actual section data.
+//!
+//! \note The offset will only be valid if all encryption keys and all
+//! sections have already been added to the image.
+uint32_t EncoreBootImage::getSectionOffset(Section * section)
+{
+       // start with boot image headers 
+       uint32_t offset = numberOfCipherBlocks(sizeof(boot_image_header_t));    // header
+       offset += numberOfCipherBlocks(sizeof(section_header_t)) * sectionCount();      // section table
+       offset += 2 * keyCount();       // key dictiontary
+       
+       // add up sections before this one
+       section_iterator_t it = beginSection();
+       for (; it != endSection() && *it != section; ++it)
+       {
+               Section * thisSection = *it;
+               
+               // insert padding for section alignment
+               offset += getPadBlockCountForSection(thisSection, offset);
+               
+               // add one for boot tag associated with this section
+               offset++;
+               
+               // now add the section's contents
+               offset += thisSection->getBlockCount();
+       }
+       
+       // and add padding for this section
+       offset += getPadBlockCountForSection(section, offset);
+       
+       // skip over this section's boot tag
+       offset++;
+       
+       return offset;
+}
+
+//! Computes the number of blocks of padding required to align \a section while
+//! taking into account the boot tag that gets inserted before the section contents.
+unsigned EncoreBootImage::getPadBlockCountForSection(Section * section, unsigned offset)
+{
+       // Compute the number of padding blocks needed to align the section. This first
+       // call to getPadBlockCountForOffset() passes an offset that excludes
+       // the boot tag for this section.
+       unsigned paddingBlocks = section->getPadBlockCountForOffset(offset);
+       
+       // If the pad count comes back as 0 then we need to try again with an offset that
+       // includes the boot tag. This is all because we're aligning the section contents
+       // start and not the section's boot tag.
+       if (paddingBlocks == 0)
+       {
+               paddingBlocks = section->getPadBlockCountForOffset(offset + 1);
+       }
+       // Otherwise if we get a nonzero pad amount then we need to subtract the block
+       // for the section's boot tag from the pad count.
+       else
+       {
+               paddingBlocks--;
+       }
+       
+       return paddingBlocks;
+}
+
+uint32_t EncoreBootImage::getImageSize()
+{
+       // determine to total size of the image
+       const uint32_t headerBlocks = numberOfCipherBlocks(sizeof(boot_image_header_t));
+       const uint32_t sectionHeaderSize = numberOfCipherBlocks(sizeof(section_header_t));
+       uint32_t imageBlocks = headerBlocks;
+       imageBlocks += sectionHeaderSize * m_sections.size();   // section table
+       imageBlocks += 2 * m_keys.size();       // key dict
+       
+       // add in each section's size
+       section_iterator_t it = beginSection();
+       for (; it != endSection(); ++it)
+       {
+               // add in this section's size, padding to align it, and its boot tag
+               imageBlocks += getPadBlockCountForSection(*it, imageBlocks);
+               imageBlocks += (*it)->getBlockCount();
+               imageBlocks++;
+       }
+       
+       // image MAC
+       imageBlocks += 2;
+       
+       return imageBlocks;
+}
+
+void EncoreBootImage::debugPrint() const
+{
+       const_section_iterator_t it = beginSection();
+       for (; it != endSection(); ++it)
+       {
+               const Section * section = *it;
+               section->debugPrint();
+       }
+}
+
+//! \param blocks Pointer to the raw data blocks.
+//! \param count Number of blocks pointed to by \a blocks.
+//! \param[out] consumed On exit, this points to the number of cipher blocks that were occupied
+//!            by the command. Should be at least 1 for every command. This must not be NULL
+//!            on entry!
+//!
+//! \return A new boot command instance.
+//! \retval NULL The boot command pointed to by \a blocks was not recognized as a known
+//!     command type.
+//!
+//! \exception std::runtime_error This exception indicates that a command was recognized
+//!     but contained invalid data. Compare this to a NULL result which indicates that
+//!     no command was recognized at all.
+EncoreBootImage::BootCommand * EncoreBootImage::BootCommand::createFromData(const cipher_block_t * blocks, unsigned count, unsigned * consumed)
+{
+       const boot_command_t * header = reinterpret_cast<const boot_command_t *>(blocks);
+    BootCommand * command = NULL;
+       
+    switch (header->m_tag)
+    {
+        case ROM_NOP_CMD:
+            command = new NopCommand();
+            break;
+        case ROM_TAG_CMD:
+            command = new TagCommand();
+            break;
+        case ROM_LOAD_CMD:
+            command = new LoadCommand();
+            break;
+        case ROM_FILL_CMD:
+            command = new FillCommand();
+            break;
+        case ROM_MODE_CMD:
+            command = new ModeCommand();
+            break;
+        case ROM_JUMP_CMD:
+            command = new JumpCommand();
+            break;
+        case ROM_CALL_CMD:
+            command = new CallCommand();
+            break;
+    }
+    
+    if (command)
+    {
+        command->initFromData(blocks, count, consumed);
+    }
+    return command;
+}
+
+//! The checksum algorithm is totally straightforward, except that the
+//! initial checksum byte value is set to 0x5a instead of 0.
+uint8_t EncoreBootImage::BootCommand::calculateChecksum(const boot_command_t & header)
+{
+       const uint8_t * bytes = reinterpret_cast<const uint8_t *>(&header);
+       uint8_t checksum = 0x5a;
+       int i;
+       
+       // start at one to skip checksum field
+       for (i = 1; i < sizeof(header); ++i)
+       {
+               checksum += bytes[i];
+       }
+       
+       return checksum;
+}
+
+//! The default implementation returns 0, indicating that no blocks are
+//! available.
+unsigned EncoreBootImage::BootCommand::getBlockCount() const
+{
+       return 1 + getDataBlockCount();
+}
+
+//! Up to \a maxCount cipher blocks are copied into the buffer pointed to by
+//! the \a data argument. The index of the first block to copy is
+//! held in the \a offset argument.
+//!
+//! \param offset Starting block number to copy. Zero means the first available block.
+//! \param maxCount Up to this number of blocks may be copied into \a data. Must be 1 or greater.
+//! \param data Buffer for outgoing cipher blocks. Must have enough room to hold
+//!            \a maxCount blocks.
+//!
+//! \return The number of cipher blocks copied into \a data.
+//! \retval 0 No more blocks are available and nothing was written to \a data.
+//!
+//! \exception std::out_of_range If \a offset is invalid.
+unsigned EncoreBootImage::BootCommand::getBlocks(unsigned offset, unsigned maxCount, cipher_block_t * data)
+{
+       assert(data);
+       assert(maxCount >= 1);
+       
+       // check for valid offset
+       if (offset >= getBlockCount())
+       {
+               throw std::out_of_range("invalid offset");
+       }
+       
+       // handle the command header block separately
+       if (offset == 0)
+       {
+               assert(sizeof(boot_command_t) == sizeof(cipher_block_t));
+               
+               boot_command_t header;
+               fillCommandHeader(header);
+               memcpy(data, &header, sizeof(header));
+               
+               return 1;
+       }
+       
+       // handle any data blocks
+       return getDataBlocks(offset - 1, maxCount, data);
+}
+
+//! The checksum field of \a testHeader is always computed and checked against itself.
+//! All other fields are compared to the corresponding value set in \a modelHeader
+//! if the appropriate flag is set in \a whichFields. For example, the m_address fields
+//! in \a testHeader and \a modelHeader are compared when the CMD_ADDRESS_FIELD bit
+//! is set in \a whichFields. An exception is thrown if any comparison fails.
+//!
+//! \param modelHeader The baseline header to compare against. Only those fields that
+//!            have corresponding bits set in \a whichFields need to be set.
+//! \param testHeader The actual command header which is being validated.
+//! \param whichFields A bitfield used to determine which fields of the boot command
+//!            header are compared. Possible values are:
+//!                    - CMD_TAG_FIELD
+//!                    - CMD_FLAGS_FIELD
+//!                    - CMD_ADDRESS_FIELD
+//!                    - CMD_COUNT_FIELD
+//!                    - CMD_DATA_FIELD
+//!
+//! \exception std::runtime_error Thrown if any requested validation fails.
+void EncoreBootImage::BootCommand::validateHeader(const boot_command_t * modelHeader, const boot_command_t * testHeader, unsigned whichFields)
+{
+       // compare all the fields that were requested
+       if ((whichFields & CMD_TAG_FIELD) && (testHeader->m_tag != modelHeader->m_tag))
+       {
+               throw std::runtime_error("invalid tag field");
+       }
+       
+       if ((whichFields & CMD_FLAGS_FIELD) && (testHeader->m_flags != modelHeader->m_flags))
+       {
+               throw std::runtime_error("invalid flags field");
+       }
+       
+       if ((whichFields & CMD_ADDRESS_FIELD) && (testHeader->m_address != modelHeader->m_address))
+       {
+               throw std::runtime_error("invalid address field");
+       }
+       
+       if ((whichFields & CMD_COUNT_FIELD) && (testHeader->m_count != modelHeader->m_count))
+       {
+               throw std::runtime_error("invalid count field");
+       }
+       
+       if ((whichFields & CMD_DATA_FIELD) && (testHeader->m_data != modelHeader->m_data))
+       {
+               throw std::runtime_error("invalid data field");
+       }
+       
+       // calculate checksum
+       uint8_t testChecksum = calculateChecksum(*testHeader);
+       if (testChecksum != testHeader->m_checksum)
+       {
+               throw std::runtime_error("invalid checksum");
+       }
+}
+
+//! Since the NOP command has no data, this method just validates the command header.
+//! All fields except the checksum are expected to be set to 0.
+//!
+//! \param blocks Pointer to the raw data blocks.
+//! \param count Number of blocks pointed to by \a blocks.
+//! \param[out] consumed On exit, this points to the number of cipher blocks that were occupied
+//!            by the command. Should be at least 1 for every command. This must not be NULL
+//!            on entry!
+//!
+//! \exception std::runtime_error Thrown if header fields are invalid.
+void EncoreBootImage::NopCommand::initFromData(const cipher_block_t * blocks, unsigned count, unsigned * consumed)
+{
+       const boot_command_t model = { 0, ROM_NOP_CMD, 0, 0, 0, 0 };
+       const boot_command_t * header = reinterpret_cast<const boot_command_t *>(blocks);
+       validateHeader(&model, header, CMD_TAG_FIELD | CMD_FLAGS_FIELD | CMD_ADDRESS_FIELD | CMD_COUNT_FIELD | CMD_DATA_FIELD);
+       
+       *consumed = 1;
+}
+
+//! All fields of the boot command header structure are set to 0, except
+//! for the checksum. This includes the tag field since the tag value for
+//! the #ROM_NOP_CMD is zero. And since all fields are zeroes the checksum
+//! remains the initial checksum value of 0x5a.
+void EncoreBootImage::NopCommand::fillCommandHeader(boot_command_t & header)
+{
+       header.m_tag = getTag();
+       header.m_flags = 0;
+       header.m_address = 0;
+       header.m_count = 0;
+       header.m_data = 0;
+       header.m_checksum = calculateChecksum(header);  // do this last
+}
+
+void EncoreBootImage::NopCommand::debugPrint() const
+{
+       Log::log(Logger::INFO2, "\tNOOP\n");
+}
+
+//! The identifier, length, and flags fields are taken from \a section.
+//!
+//! \todo How does length get set correctly if the length is supposed to include
+//!            this command?
+EncoreBootImage::TagCommand::TagCommand(const Section & section)
+{
+       m_sectionIdentifier = section.getIdentifier();
+       m_sectionLength = section.getBlockCount();
+       m_sectionFlags = section.getFlags();
+}
+
+//! \param blocks Pointer to the raw data blocks.
+//! \param count Number of blocks pointed to by \a blocks.
+//! \param[out] consumed On exit, this points to the number of cipher blocks that were occupied
+//!            by the command. Should be at least 1 for every command. This must not be NULL
+//!            on entry!
+//!
+//! \exception std::runtime_error Thrown if header fields are invalid.
+void EncoreBootImage::TagCommand::initFromData(const cipher_block_t * blocks, unsigned count, unsigned * consumed)
+{
+       const boot_command_t model = { 0, ROM_TAG_CMD, 0, 0, 0, 0 };
+       const boot_command_t * header = reinterpret_cast<const boot_command_t *>(blocks);
+       validateHeader(&model, header, CMD_TAG_FIELD);
+       
+    // read fields from header
+       m_isLast = (ENDIAN_LITTLE_TO_HOST_U16(header->m_flags) & ROM_LAST_TAG) != 0;
+       m_sectionIdentifier = ENDIAN_LITTLE_TO_HOST_U32(header->m_address);
+       m_sectionLength = ENDIAN_LITTLE_TO_HOST_U32(header->m_count);
+       m_sectionFlags = ENDIAN_LITTLE_TO_HOST_U32(header->m_data);
+       
+       *consumed = 1;
+}
+
+//! This method currently assumes that the next tag command will come immediately
+//! after the data for this section.
+void EncoreBootImage::TagCommand::fillCommandHeader(boot_command_t & header)
+{
+       header.m_tag = getTag();
+       header.m_flags = ENDIAN_HOST_TO_LITTLE_U16(m_isLast ? ROM_LAST_TAG : 0);
+       header.m_address = ENDIAN_HOST_TO_LITTLE_U32(m_sectionIdentifier);
+       header.m_count = ENDIAN_HOST_TO_LITTLE_U32(m_sectionLength);
+       header.m_data = ENDIAN_HOST_TO_LITTLE_U32(m_sectionFlags);
+       header.m_checksum = calculateChecksum(header);  // do this last
+}
+
+void EncoreBootImage::TagCommand::debugPrint() const
+{
+       Log::log(Logger::INFO2, "  BTAG | sec=0x%08x | cnt=0x%08x | flg=0x%08x\n", m_sectionIdentifier, m_sectionLength, m_sectionFlags);
+}
+
+//! All fields are set to zero.
+//!
+EncoreBootImage::LoadCommand::LoadCommand()
+:      BootCommand(), m_data(), m_padCount(0), m_length(0), m_address(0), m_loadDCD(false)
+{
+       fillPadding();
+}
+
+EncoreBootImage::LoadCommand::LoadCommand(uint32_t address, const uint8_t * data, uint32_t length)
+:      BootCommand(), m_data(), m_padCount(0), m_length(0), m_address(address), m_loadDCD(false)
+{
+       fillPadding();
+       setData(data, length);
+}
+
+//! \param blocks Pointer to the raw data blocks.
+//! \param count Number of blocks pointed to by \a blocks.
+//! \param[out] consumed On exit, this points to the number of cipher blocks that were occupied
+//!            by the command. Should be at least 1 for every command. This must not be NULL
+//!            on entry!
+//!
+//! \exception std::runtime_error This exception is thrown if the actual CRC of the load
+//!     data does not match the CRC stored in the command header. Also thrown if the
+//!     \a count parameter is less than the number of data blocks needed for the length
+//!     specified in the command header or if header fields are invalid.
+void EncoreBootImage::LoadCommand::initFromData(const cipher_block_t * blocks, unsigned count, unsigned * consumed)
+{
+    // check static fields
+       const boot_command_t model = { 0, ROM_LOAD_CMD, 0, 0, 0, 0 };
+       const boot_command_t * header = reinterpret_cast<const boot_command_t *>(blocks);
+       validateHeader(&model, header, CMD_TAG_FIELD);
+       
+    // read fields from header
+       m_address = ENDIAN_LITTLE_TO_HOST_U32(header->m_address);
+       m_length = ENDIAN_LITTLE_TO_HOST_U32(header->m_count);
+    unsigned crc = ENDIAN_LITTLE_TO_HOST_U32(header->m_data);
+    unsigned dataBlockCount = numberOfCipherBlocks(m_length);
+    m_padCount = sizeOfPaddingForCipherBlocks(dataBlockCount);
+       m_loadDCD = (ENDIAN_LITTLE_TO_HOST_U16(header->m_flags) & ROM_LOAD_DCD) != 0;
+       
+    // make sure there are enough blocks
+    if (count - 1 < dataBlockCount)
+    {
+        throw std::runtime_error("not enough cipher blocks for load data");
+    }
+    
+    // copy data
+    setData(reinterpret_cast<const uint8_t *>(blocks + 1), m_length);
+    
+    // copy padding
+    if (m_padCount)
+    {
+        const uint8_t * firstPadByte = reinterpret_cast<const uint8_t *> (blocks + (1 + dataBlockCount)) - m_padCount;
+        memcpy(m_padding, firstPadByte, m_padCount);
+    }
+    
+    // check CRC
+    uint32_t actualCRC = calculateCRC();
+    if (actualCRC != crc)
+    {
+        throw std::runtime_error("load data failed CRC check");
+    }
+    
+       *consumed = 1 + dataBlockCount;
+}
+
+//! The only thing unique in the load command header is the
+//! #elftosb::EncoreBootImage::boot_command_t::m_data. It contains a CRC-32 over the
+//! load data, plus any bytes of padding in the last data cipher block.
+void EncoreBootImage::LoadCommand::fillCommandHeader(boot_command_t & header)
+{
+       header.m_tag = getTag();
+       header.m_flags = ENDIAN_HOST_TO_LITTLE_U16(m_loadDCD ? ROM_LOAD_DCD : 0);
+       header.m_address = ENDIAN_HOST_TO_LITTLE_U32(m_address);
+       header.m_count = ENDIAN_HOST_TO_LITTLE_U32(m_length);
+       header.m_data = ENDIAN_HOST_TO_LITTLE_U32(calculateCRC());
+       
+       // do this last
+       header.m_checksum = calculateChecksum(header);
+}
+
+//! A CRC-32 is calculated over the load data, including any pad bytes
+//! that are required in the last data cipher block. Including the
+//! pad bytes in the CRC makes it vastly easier for the ROM to calculate
+//! the CRC for validation.
+uint32_t EncoreBootImage::LoadCommand::calculateCRC() const
+{
+       uint32_t result;
+       CRC32 crc;
+       crc.update(m_data, m_length);
+       if (m_padCount)
+       {
+               // include random padding in the CRC
+               crc.update(m_padding, m_padCount);
+       }
+       crc.truncatedFinal(reinterpret_cast<uint8_t*>(&result), sizeof(result));
+       
+       return result;
+}
+
+//! A local copy of the load data is made. This copy will be disposed of when this object
+//! is destroyed. This means the caller is free to deallocate \a data after this call
+//! returns. It also means the caller can pass a pointer into the middle of a buffer for
+//! \a data and not worry about ownership issues. 
+void EncoreBootImage::LoadCommand::setData(const uint8_t * data, uint32_t length)
+{
+       assert(data);
+       assert(length);
+       
+       uint8_t * dataCopy = new uint8_t[length];
+       memcpy(dataCopy, data, length);
+       
+       m_data = dataCopy;
+       m_length = length;
+       
+       m_padCount = sizeOfPaddingForCipherBlocks(m_length);
+}
+
+//! \return The number of cipher blocks required to hold the load data,
+//!            rounded up as necessary.
+unsigned EncoreBootImage::LoadCommand::getDataBlockCount() const
+{
+       // round up to the next cipher block
+       return numberOfCipherBlocks(m_length);
+}
+
+//! Up to \a maxCount data blocks are copied into the buffer pointed to by
+//! the \a data argument. This is only a request for \a maxCount blocks.
+//! A return value of 0 indicates that no more blocks are available. The
+//! index of the first block to copy is held in the \a offset argument.
+//! If there are pad bytes needed to fill out the last data block, they
+//! will be filled with random data in order to add to the "whiteness" of
+//! the data on both sides of encryption.
+//!
+//! \param offset Starting block number to copy. Zero means the first available block.
+//! \param maxCount Up to this number of blocks may be copied into \a data. Must be 1 or greater.
+//! \param data Buffer for outgoing data blocks. Must have enough room to hold
+//!            \a maxCount blocks.
+//!
+//! \return The number of data blocks copied into \a data.
+//! \retval 0 No more blocks are available and nothing was written to \a data.
+//!
+//! \exception std::out_of_range Thrown when offset is invalid.
+//!
+//! \todo fill pad bytes with random bytes
+unsigned EncoreBootImage::LoadCommand::getDataBlocks(unsigned offset, unsigned maxCount, cipher_block_t * data)
+{
+       assert(data);
+       assert(maxCount != 0);
+       
+       uint32_t blockCount = getDataBlockCount();
+       
+       // check offset
+       if (offset >= blockCount)
+       {
+               throw std::out_of_range("invalid offset");
+       }
+       
+       // figure out how many blocks to return
+       unsigned resultBlocks = blockCount - offset;
+       if (resultBlocks > maxCount)
+       {
+               resultBlocks = maxCount;
+               
+               // exclude last block if there is padding
+               if (m_padCount && (offset != blockCount - 1) && (offset + resultBlocks == blockCount))
+               {
+                       resultBlocks--;
+               }
+       }
+       
+       // if there are pad bytes, handle the last block specially
+       if (m_padCount && offset == blockCount - 1)
+       {
+               // copy the remainder of the load data into the first part of the result block
+               unsigned remainderLength = sizeof(cipher_block_t) - m_padCount;
+               memcpy(data, &m_data[sizeof(cipher_block_t) * offset], remainderLength);
+               
+               // copy pad bytes we previously generated into the last part of the result block
+               // data is a cipher block pointer, so indexing is done on cipher block
+               // boundaries, thus we need a byte pointer to index properly
+               uint8_t * bytePtr = reinterpret_cast<uint8_t*>(data);
+               memcpy(bytePtr + remainderLength, &m_padding, m_padCount);
+       }
+       else
+       {
+               memcpy(data, &m_data[sizeof(cipher_block_t) * offset], sizeof(cipher_block_t) * resultBlocks);
+       }
+       
+       return resultBlocks;
+}
+
+//! Fills #m_padding with random bytes that may be used to fill up the last data
+//! cipher block.
+void EncoreBootImage::LoadCommand::fillPadding()
+{
+       RandomNumberGenerator rng;
+       rng.generateBlock(m_padding, sizeof(m_padding));
+}
+
+void EncoreBootImage::LoadCommand::debugPrint() const
+{
+       Log::log(Logger::INFO2, "  LOAD | adr=0x%08x | len=0x%08x | crc=0x%08x | flg=0x%08x\n", m_address, m_length, calculateCRC(), m_loadDCD ? ROM_LOAD_DCD : 0);
+}
+
+//! The pattern, address, and count are all initialized to zero, and the pattern
+//! size is set to a word.
+EncoreBootImage::FillCommand::FillCommand()
+:      BootCommand(), m_address(0), m_count(0), m_pattern(0)
+{
+}
+
+//! \param blocks Pointer to the raw data blocks.
+//! \param count Number of blocks pointed to by \a blocks.
+//! \param[out] consumed On exit, this points to the number of cipher blocks that were occupied
+//!            by the command. Should be at least 1 for every command. This must not be NULL
+//!            on entry!
+//!
+//! \exception std::runtime_error Thrown if header fields are invalid.
+void EncoreBootImage::FillCommand::initFromData(const cipher_block_t * blocks, unsigned count, unsigned * consumed)
+{
+    // check static fields
+       const boot_command_t model = { 0, ROM_FILL_CMD, 0, 0, 0, 0 };
+       const boot_command_t * header = reinterpret_cast<const boot_command_t *>(blocks);
+       validateHeader(&model, header, CMD_TAG_FIELD | CMD_FLAGS_FIELD);
+       
+    // read fields from header
+       m_address = ENDIAN_LITTLE_TO_HOST_U32(header->m_address);
+       m_count = ENDIAN_LITTLE_TO_HOST_U32(header->m_count);
+    m_pattern = ENDIAN_LITTLE_TO_HOST_U32(header->m_data);
+    
+       *consumed = 1;
+}
+
+void EncoreBootImage::FillCommand::fillCommandHeader(boot_command_t & header)
+{
+       header.m_tag = getTag();
+       header.m_flags = 0;
+       header.m_address = ENDIAN_HOST_TO_LITTLE_U32(m_address);
+       header.m_count = ENDIAN_HOST_TO_LITTLE_U32(m_count);
+       header.m_data = ENDIAN_HOST_TO_LITTLE_U32(m_pattern);
+       header.m_checksum = calculateChecksum(header);  // do this last
+}
+
+//! Extends the pattern across 32 bits.
+//!
+void EncoreBootImage::FillCommand::setPattern(uint8_t pattern)
+{
+       m_pattern = (pattern << 24) | (pattern << 16) | (pattern << 8) | pattern;
+}
+
+//! Extends the pattern across 32 bits.
+//!
+void EncoreBootImage::FillCommand::setPattern(uint16_t pattern)
+{
+       m_pattern = (pattern << 16) | pattern;
+}
+
+void EncoreBootImage::FillCommand::setPattern(uint32_t pattern)
+{
+       m_pattern = pattern;
+}
+
+void EncoreBootImage::FillCommand::debugPrint() const
+{
+       Log::log(Logger::INFO2, "  FILL | adr=0x%08x | len=0x%08x | ptn=0x%08x\n", m_address, m_count, m_pattern);
+}
+
+//! \param blocks Pointer to the raw data blocks.
+//! \param count Number of blocks pointed to by \a blocks.
+//! \param[out] consumed On exit, this points to the number of cipher blocks that were occupied
+//!            by the command. Should be at least 1 for every command. This must not be NULL
+//!            on entry!
+//!
+//! \exception std::runtime_error Thrown if header fields are invalid.
+void EncoreBootImage::ModeCommand::initFromData(const cipher_block_t * blocks, unsigned count, unsigned * consumed)
+{
+    // check static fields
+       const boot_command_t model = { 0, ROM_MODE_CMD, 0, 0, 0, 0 };
+       const boot_command_t * header = reinterpret_cast<const boot_command_t *>(blocks);
+       validateHeader(&model, header, CMD_TAG_FIELD | CMD_FLAGS_FIELD | CMD_ADDRESS_FIELD | CMD_COUNT_FIELD);
+       
+    // read fields from header
+    m_mode = ENDIAN_LITTLE_TO_HOST_U32(header->m_data);
+    
+       *consumed = 1;
+}
+
+void EncoreBootImage::ModeCommand::fillCommandHeader(boot_command_t & header)
+{
+       header.m_tag = getTag();
+       header.m_flags = 0;
+       header.m_address = 0;
+       header.m_count = 0;
+       header.m_data = ENDIAN_HOST_TO_LITTLE_U32(m_mode);
+       header.m_checksum = calculateChecksum(header);  // do this last
+}
+
+void EncoreBootImage::ModeCommand::debugPrint() const
+{
+       Log::log(Logger::INFO2, "  MODE | mod=0x%08x\n", m_mode);
+}
+
+//! \param blocks Pointer to the raw data blocks.
+//! \param count Number of blocks pointed to by \a blocks.
+//! \param[out] consumed On exit, this points to the number of cipher blocks that were occupied
+//!            by the command. Should be at least 1 for every command. This must not be NULL
+//!            on entry!
+//!
+//! \exception std::runtime_error Thrown if header fields are invalid.
+void EncoreBootImage::JumpCommand::initFromData(const cipher_block_t * blocks, unsigned count, unsigned * consumed)
+{
+    // check static fields
+       const boot_command_t model = { 0, getTag(), 0, 0, 0, 0 };
+       const boot_command_t * header = reinterpret_cast<const boot_command_t *>(blocks);
+       validateHeader(&model, header, CMD_TAG_FIELD | CMD_COUNT_FIELD);
+       
+    // read fields from header
+    m_address = ENDIAN_LITTLE_TO_HOST_U32(header->m_address);
+    m_argument = ENDIAN_LITTLE_TO_HOST_U32(header->m_data);
+       m_isHAB = (ENDIAN_LITTLE_TO_HOST_U16(header->m_flags) & ROM_HAB_EXEC) != 0;
+    
+       *consumed = 1;
+}
+
+void EncoreBootImage::JumpCommand::fillCommandHeader(boot_command_t & header)
+{
+       header.m_tag = getTag();
+       header.m_flags = ENDIAN_HOST_TO_LITTLE_U16(m_isHAB ? ROM_HAB_EXEC : 0);
+       header.m_address = ENDIAN_HOST_TO_LITTLE_U32(m_address);
+       header.m_count = 0;
+       header.m_data = ENDIAN_HOST_TO_LITTLE_U32(m_argument);
+       header.m_checksum = calculateChecksum(header);  // do this last
+}
+
+void EncoreBootImage::JumpCommand::debugPrint() const
+{
+       Log::log(Logger::INFO2, "  JUMP | adr=0x%08x | arg=0x%08x | flg=0x%08x\n", m_address, m_argument, m_isHAB ? ROM_HAB_EXEC : 0);
+}
+
+void EncoreBootImage::CallCommand::debugPrint() const
+{
+       Log::log(Logger::INFO2, "  CALL | adr=0x%08x | arg=0x%08x | flg=0x%08x\n", m_address, m_argument, m_isHAB ? ROM_HAB_EXEC : 0);
+}
+
+//! Only if the section has been assigned a boot image owner object will this
+//! method be able to fill in the #section_header_t::m_offset field. If no
+//! boot image has been set the offset will be set to 0.
+void EncoreBootImage::Section::fillSectionHeader(section_header_t & header)
+{
+       header.m_tag = getIdentifier();
+       header.m_offset = 0;
+       header.m_length = ENDIAN_HOST_TO_LITTLE_U32(getBlockCount());
+       header.m_flags = ENDIAN_HOST_TO_LITTLE_U32(getFlags());
+       
+       // if we're attached to an image, we can compute our real offset
+       if (m_image)
+       {
+               header.m_offset = ENDIAN_HOST_TO_LITTLE_U32(m_image->getSectionOffset(this));
+       }
+}
+
+//! The alignment will never be less than 16, since that is the size of the
+//! cipher block which is the basic unit of the boot image format. If an
+//! alignment less than 16 is set it will be ignored.
+//!
+//! \param alignment Alignment in bytes for this section. Must be a power of two.
+//!            Ignored if less than 16.
+void EncoreBootImage::Section::setAlignment(unsigned alignment)
+{
+       if (alignment > BOOT_IMAGE_MINIMUM_SECTION_ALIGNMENT)
+       {
+               m_alignment = alignment;
+       }
+}
+
+//! This method calculates the number of padding blocks that need to be inserted
+//! from a given offset for the section to be properly aligned. The value returned
+//! is the number of padding blocks that should be inserted starting just after
+//! \a offset to align the first cipher block of the section contents. The section's
+//! boot tag is \i not taken into account by this method, so the caller must
+//! deal with that herself.
+//!
+//! \param offset Start offset in cipher blocks (not bytes).
+//!
+//! \return A number of cipher blocks of padding to insert.
+unsigned EncoreBootImage::Section::getPadBlockCountForOffset(unsigned offset)
+{
+       // convert alignment from byte to block alignment
+       unsigned blockAlignment = m_alignment >> 4;
+       
+       unsigned nextAlignmentOffset = (offset + blockAlignment - 1) / blockAlignment * blockAlignment;
+       
+       return nextAlignmentOffset - offset;
+}
+
+EncoreBootImage::BootSection::~BootSection()
+{
+       deleteCommands();
+}
+
+void EncoreBootImage::BootSection::deleteCommands()
+{
+       // dispose of all sections
+       iterator_t it = begin();
+       for (; it != end(); ++it)
+       {
+               delete *it;
+       }
+}
+
+//! Always returns at least 1 for the required tag command.
+//!
+unsigned EncoreBootImage::BootSection::getBlockCount() const
+{
+       unsigned count = 0;
+       
+       const_iterator_t it = begin();
+       for (; it != end(); ++it)
+       {
+               count += (*it)->getBlockCount();
+       }
+       
+       return count;
+}
+
+//! Up to \a maxCount cipher blocks are copied into the buffer pointed to by
+//! the \a data argument. A return value of 0 indicates that
+//! no more blocks are available. The index of the first block to copy is
+//! held in the \a offset argument.
+//!
+//! \param offset Starting block number to copy. Zero means the first available block.
+//! \param maxCount Up to this number of blocks may be copied into \a data.
+//! \param data Buffer for outgoing cipher blocks. Must have enough room to hold
+//!            \a maxCount blocks.
+//!
+//! \return The number of cipher blocks copied into \a data.
+//! \retval 0 No more blocks are available and nothing was written to \a data.
+unsigned EncoreBootImage::BootSection::getBlocks(unsigned offset, unsigned maxCount, cipher_block_t * data)
+{
+       assert(data);
+       assert(maxCount >= 1);
+       
+       unsigned currentOffset = 0;
+       unsigned readCount = maxCount;
+       
+       iterator_t it = begin();
+       for (; it != end(); ++it)
+       {
+               BootCommand * command = *it;
+               unsigned commandBlocks = command->getBlockCount();
+               
+               // this should never be false!
+               assert(offset >= currentOffset);
+               
+               // skip forward until we hit the requested offset
+               if (offset >= currentOffset + commandBlocks)
+               {
+                       currentOffset += commandBlocks;
+                       continue;
+               }
+               
+               // read from this command
+               unsigned commandOffset = offset - currentOffset;
+               unsigned commandRemaining = commandBlocks - commandOffset;
+               if (readCount > commandRemaining)
+               {
+                       readCount = commandRemaining;
+               }
+               return command->getBlocks(commandOffset, readCount, data);
+       }
+       
+       return 0;
+}
+
+//! The entire contents of the section must be in memory, pointed to by \a blocks.
+//! Any commands that had previously been added to the section are disposed of.
+//!
+//! \param blocks Pointer to the section contents.
+//! \param count Number of blocks pointed to by \a blocks.
+//!
+//! \exception std::runtime_error Thrown if a boot command cannot be created from
+//!            the cipher block stream.
+void EncoreBootImage::BootSection::fillFromData(const cipher_block_t * blocks, unsigned count)
+{
+       // start with an empty slate
+       deleteCommands();
+       
+       const cipher_block_t * currentBlock = blocks;
+       unsigned remaining = count;
+       while (remaining)
+       {
+               // try to create a command from the next cipher block. the number of
+               // blocks the command used up is returned in consumed.
+               unsigned consumed;
+               BootCommand * command = BootCommand::createFromData(currentBlock, remaining, &consumed);
+               if (!command)
+               {
+                       throw std::runtime_error("invalid boot section data");
+               }
+               
+               addCommand(command);
+               
+               // update loop counters
+               remaining -= consumed;
+               currentBlock += consumed;
+       }
+}
+
+void EncoreBootImage::BootSection::debugPrint() const
+{
+       Log::log(Logger::INFO2, "Boot Section 0x%08x:\n", m_identifier);
+       
+       const_iterator_t it = begin();
+       for (; it != end(); ++it)
+       {
+               const BootCommand * command = *it;
+               command->debugPrint();
+       }
+}
+
+//! A copy is made of \a data. Any previously assigned data is disposed of.
+//!
+void EncoreBootImage::DataSection::setData(const uint8_t * data, unsigned length)
+{
+       m_data = new uint8_t[length];
+       memcpy(m_data.get(), data, length);
+       m_length = length;
+}
+
+//! The section takes ownership of \a data and will dispose of it using the
+//! array delete operator upon its destruction.
+void EncoreBootImage::DataSection::setDataNoCopy(const uint8_t * data, unsigned length)
+{
+       m_data = data;
+       m_length = length;
+}
+
+unsigned EncoreBootImage::DataSection::getBlockCount() const
+{
+       return numberOfCipherBlocks(m_length);
+}
+
+unsigned EncoreBootImage::DataSection::getBlocks(unsigned offset, unsigned maxCount, cipher_block_t * data)
+{
+       assert(data);
+       assert(maxCount != 0);
+       
+       unsigned blockCount = getBlockCount();
+       unsigned padCount = sizeOfPaddingForCipherBlocks(m_length);
+       
+       // check offset
+       if (offset >= blockCount)
+       {
+               throw std::out_of_range("invalid offset");
+       }
+       
+       // figure out how many blocks to return
+       unsigned resultBlocks = blockCount - offset;
+       if (resultBlocks > maxCount)
+       {
+               resultBlocks = maxCount;
+               
+               // exclude last block if there is padding
+               if (padCount && (offset != blockCount - 1) && (offset + resultBlocks == blockCount))
+               {
+                       resultBlocks--;
+               }
+       }
+       
+       // if there are pad bytes, handle the last block specially
+       if (padCount && offset == blockCount - 1)
+       {
+               // copy the remainder of the load data into the first part of the result block
+               unsigned remainderLength = sizeof(cipher_block_t) - padCount;
+               memcpy(data, &m_data[sizeOfCipherBlocks(offset)], remainderLength);
+               
+               // set pad bytes to zeroes.
+               // data is a cipher block pointer, so indexing is done on cipher block
+               // boundaries, thus we need a byte pointer to index properly
+               uint8_t * bytePtr = reinterpret_cast<uint8_t*>(data);
+               memset(bytePtr + remainderLength, 0, padCount);
+       }
+       else
+       {
+               memcpy(data, &m_data[sizeOfCipherBlocks(offset)], sizeOfCipherBlocks(resultBlocks));
+       }
+       
+       return resultBlocks;
+}
+
+void EncoreBootImage::DataSection::debugPrint() const
+{
+       Log::log(Logger::INFO2, "Data Section 0x%08x: (%d bytes, %d blocks)\n", m_identifier, m_length, getBlockCount());
+}
+
diff --git a/tools/elftosb/common/EncoreBootImage.h b/tools/elftosb/common/EncoreBootImage.h
new file mode 100644 (file)
index 0000000..1e78aee
--- /dev/null
@@ -0,0 +1,967 @@
+/*
+ * File:       EncoreBootImage.h
+ *
+ * Copyright (c) Freescale Semiconductor, Inc. All rights reserved.
+ * See included license file for license details.
+ */
+#if !defined(_EncoreBootImage_h_)
+#define _EncoreBootImage_h_
+
+#include <list>
+#include <vector>
+#include <string>
+#include <iostream>
+#include <fstream>
+#include <string.h>
+#include "BootImage.h"
+#include "rijndael.h"
+#include "smart_ptr.h"
+#include "AESKey.h"
+#include "StExecutableImage.h"
+
+namespace elftosb
+{
+
+//! An AES-128 cipher block is 16 bytes.
+typedef uint8_t cipher_block_t[16];
+
+//! A SHA-1 digest is 160 bits, or 20 bytes.
+typedef uint8_t sha1_digest_t[20];
+
+//! Unique identifier type for a section.
+typedef uint32_t section_id_t;
+
+//! Utility to return the byte length of a number of cipher blocks.
+inline size_t sizeOfCipherBlocks(unsigned count) { return sizeof(cipher_block_t) * count; }
+
+//! Utility to return the number of cipher blocks required to hold an object
+//! that is \a s bytes long.
+inline size_t numberOfCipherBlocks(size_t s) { return (s + sizeof(cipher_block_t) - 1) / sizeof(cipher_block_t); }
+
+//! Utility to calculate the byte length for the cipher blocks required to hold
+//! and object that is \a bytes long.
+inline size_t sizeInCipherBlocks(size_t s) { return (unsigned)sizeOfCipherBlocks(numberOfCipherBlocks(s)); }
+
+//! Utility to return the number of bytes of padding required to fill out
+//! the last cipher block in a set of cipher blocks large enough to hold
+//! an object that is \a s bytes large. The result may be 0 if \a s is
+//! an even multiple of the cipher block size.
+inline size_t sizeOfPaddingForCipherBlocks(size_t s) { return sizeInCipherBlocks(s) - s; }
+
+/*!
+ * \brief Class to manage Encore boot image files.
+ *
+ * Initially this class will only support generation of boot images, but
+ * its design will facilitate the addition of the ability to read an
+ * image and examine its contents.
+ *
+ * A boot image is composed of the following regions:
+ * - Header
+ * - Section table
+ * - Key dictionary
+ * - Section data
+ * - Authentication
+ *
+ * Multiple sections are within a boot image are fully supported. Two general types
+ * of sections are supported with this class. Bootable sections, represented by the
+ * EncoreBootImage::BootSection class, contain a sequence of commands to be
+ * interpreted by the boot ROM. Data sections are represented by the
+ * EncoreBootImage::DataSection class and can contain any arbitrary data.
+ *
+ * An image can either be encrypted or unencrypted. The image uses a session key,
+ * or DEK (data encryption key), and the key dictionary to support any number of keys
+ * using a single image. The header and section table are always unencrypted even
+ * in encrypted images. This allows host utilities to access the individual
+ * sections without needing to have access to an encryption key.
+ *
+ * To construct a boot image, first create an instance of EncoreBootImage. Then
+ * create instances of the EncoreBootImage::BootSection or EncoreBootImage::DataSection
+ * for each of the sections in the image. For bootable sections, create and add
+ * the desired boot command objects. These are all subclasses of
+ * EncoreBootImage::BootCommand.
+ *
+ * If the boot image is to be encrypted, you need to add keys, which are instances
+ * of the AES128Key class. If no keys are added, the entire boot image will be unencrypted.
+ *
+ * When the image is fully constructed, it can be written to any std::ostream with
+ * a call to writeToStream(). The same image can be written to streams any
+ * number of times.
+ */
+class EncoreBootImage : public BootImage
+{
+public:
+       //! \brief Flag constants for the m_flags field of #elftosb::EncoreBootImage::boot_image_header_t.
+       enum
+       {
+               ROM_DISPLAY_PROGRESS = (1 << 0),                //!< Print progress reports.
+               ROM_VERBOSE_PROGRESS = (1 << 1)                 //!< Progress reports are verbose.
+       };
+       
+       enum {
+               ROM_IMAGE_HEADER_SIGNATURE = 'STMP',    //!< Signature in #elftosb::EncoreBootImage::boot_image_header_t::m_signature.
+               ROM_IMAGE_HEADER_SIGNATURE2 = 'sgtl',   //!< Value for #elftosb::EncoreBootImage::boot_image_header_t::m_signature2;
+               ROM_BOOT_IMAGE_MAJOR_VERSION = 1,               //!< Current boot image major version.
+               ROM_BOOT_IMAGE_MINOR_VERSION = 1                //!< Current boot image minor version.
+       };
+       
+       enum {
+               //! Minimum alignment for a section is 16 bytes.
+               BOOT_IMAGE_MINIMUM_SECTION_ALIGNMENT = sizeof(cipher_block_t)
+       };
+       
+// All of these structures are packed to byte alignment in order to match
+// the structure on disk.
+#pragma pack(1)
+       
+       //! \brief Header for the entire boot image.
+       //!
+       //! Fields of this header are arranged so that those used by the bootloader ROM all come
+       //! first. They are also set up so that all fields are not split across cipher block
+       //! boundaries. The fields not used by the bootloader are not subject to this
+       //! restraint.
+       //!
+       //! Image header size is always a round number of cipher blocks. The same also applies to
+       //! the boot image itself. The padding, held in #elftosb::EncoreBootImage::boot_image_header_t::m_padding0
+       //! and #elftosb::EncoreBootImage::boot_image_header_t::m_padding1 is filled with random bytes.
+       //!
+       //! The DEK dictionary, section table, and each section data region must all start on
+       //! cipher block boundaries.
+       //!
+       //! This header is not encrypted in the image file.
+       //!
+       //! The m_digest field contains a SHA-1 digest of the fields of the header that follow it.
+       //! It is the first field in the header so it doesn't change position or split the header
+       //! in two if fields are added to the header.
+       struct boot_image_header_t
+       {
+               union
+               {
+                       sha1_digest_t m_digest;         //!< SHA-1 digest of image header. Also used as the crypto IV.
+                       struct
+                       {
+                               cipher_block_t m_iv;    //!< The first 16 bytes of the digest form the initialization vector.
+                               uint8_t m_extra[4];             //!< The leftover top four bytes of the SHA-1 digest.
+                       };
+               };
+               uint8_t m_signature[4];                 //!< 'STMP', see #ROM_IMAGE_HEADER_SIGNATURE.
+               uint8_t m_majorVersion;                 //!< Major version for the image format, see #ROM_BOOT_IMAGE_MAJOR_VERSION.
+               uint8_t m_minorVersion;         //!< Minor version of the boot image format, see #ROM_BOOT_IMAGE_MINOR_VERSION.
+               uint16_t m_flags;                               //!< Flags or options associated with the entire image.
+               uint32_t m_imageBlocks;                 //!< Size of entire image in blocks.
+               uint32_t m_firstBootTagBlock;   //!< Offset from start of file to the first boot tag, in blocks.
+               section_id_t m_firstBootableSectionID;  //!< ID of section to start booting from.
+               uint16_t m_keyCount;                    //!< Number of entries in DEK dictionary.
+               uint16_t m_keyDictionaryBlock;  //!< Starting block number for the key dictionary.
+               uint16_t m_headerBlocks;                //!< Size of this header, including this size word, in blocks.
+               uint16_t m_sectionCount;                //!< Number of section headers in this table.
+               uint16_t m_sectionHeaderSize;   //!< Size in blocks of a section header.
+               uint8_t m_padding0[2];                  //!< Padding to align #m_timestamp to long word.
+               uint8_t m_signature2[4];                //!< Second signature to distinguish this .sb format from the 36xx format, see #ROM_IMAGE_HEADER_SIGNATURE2.
+               uint64_t m_timestamp;                   //!< Timestamp when image was generated in microseconds since 1-1-2000.
+               version_t m_productVersion;             //!< Product version.
+               version_t m_componentVersion;   //!< Component version.
+               uint16_t m_driveTag;                    //!< Drive tag for the system drive which this boot image belongs to.
+               uint8_t m_padding1[6];          //!< Padding to round up to next cipher block.
+       };
+
+       //! \brief Entry in #elftosb::EncoreBootImage::dek_dictionary_t.
+       //!
+       //! The m_dek field in each entry is encrypted using the KEK with the m_iv field from
+       //! the image header as the IV.
+       struct dek_dictionary_entry_t
+       {
+               cipher_block_t m_mac;                   //!< CBC-MAC of the header.
+               aes128_key_t m_dek;                             //!< AES-128 key with which the image payload is encrypted.
+       };
+
+       //! \brief The DEK dictionary always follows the image header, in the next cipher block.
+       struct dek_dictionary_t
+       {
+               dek_dictionary_entry_t m_entries[1];
+       };
+
+       //! \brief Section flags constants for the m_flags field of #elftosb::EncoreBootImage::section_header_t.
+       enum
+       {
+               ROM_SECTION_BOOTABLE = (1 << 0),        //!< The section contains bootloader commands.
+               ROM_SECTION_CLEARTEXT = (1 << 1)        //!< The section is unencrypted. Applies only if the rest of the boot image is encrypted.
+       };
+
+       //! \brief Information about each section, held in the section table.
+       //! \see section_table_t
+       struct section_header_t
+       {
+               uint32_t m_tag;                                 //!< Unique identifier for this section. High bit must be zero.
+               uint32_t m_offset;                              //!< Offset to section data from start of image in blocks.
+               uint32_t m_length;                              //!< Size of section data in blocks.
+               uint32_t m_flags;                               //!< Section flags.
+       };
+       
+       //! \brief An index of all sections within the boot image.
+       //!
+       //! The section table will be padded so that its length is divisible by 16 (if necessary).
+       //! Actually, each entry is padded to be a round number of cipher blocks, which
+       //! automatically makes this true for the entire table.
+       //!
+       //! Sections are ordered as they appear in this table, but are identified by the
+       //! #elftosb::EncoreBootImage::section_header_t::m_tag.
+       //!
+       //! The data for each section in encrypted separately with the DEK in CBC mode using
+       //! m_iv for the IV. This allows the ROM to jump to any given section without needing
+       //! to read the previous cipher block. In addition, the data for each section is
+       //! prefixed with a "boot tag", which describes the section which follows it. Boot
+       //! tags are the same format as a boot command, and are described by the
+       //! EncoreBootImage::TagCommand class.
+       //!
+       //! The section table starts immediately after the image header, coming before the
+       //! key dictionary (if present). The section table is not encrypted.
+       struct section_table_t
+       {
+               section_header_t m_sections[1]; //!< The table entries.
+       };
+
+       //! \brief Structure for a Piano bootloader command.
+       //!
+       //! Each command is composed of a fixed length header of 16 bytes. This happens to be
+       //! the size of a cipher block. Most commands will only require the header.
+       //!
+       //! But some commands, i.e. the "load data" command, may require additional arbitrary
+       //! amounts of data. This data is packed into the N cipher blocks that immediately
+       //! follow the command header. If the length of the data is not divisible by 16, then
+       //! random (not zero!) pad bytes will be added.
+       struct boot_command_t
+       {
+               uint8_t m_checksum;                             //!< Simple checksum over other command fields.
+               uint8_t m_tag;                                  //!< Tag telling which command this is.
+               uint16_t m_flags;                               //!< Flags for this command.
+               uint32_t m_address;                             //!< Target address.
+               uint32_t m_count;                               //!< Number of bytes on which to operate.
+               uint32_t m_data;                                //!< Additional data used by certain commands.
+       };
+
+#pragma pack()
+       
+       //! \brief Bootloader command tag constants.
+       enum
+       {
+               ROM_NOP_CMD = 0x00,             //!< A no-op command.
+               ROM_TAG_CMD = 0x01,             //!< Section tag command.
+               ROM_LOAD_CMD = 0x02,    //!< Load data command.
+               ROM_FILL_CMD = 0x03,    //!< Pattern fill command.
+               ROM_JUMP_CMD = 0x04,    //!< Jump to address command.
+               ROM_CALL_CMD = 0x05,    //!< Call function command.
+               ROM_MODE_CMD = 0x06             //!< Change boot mode command.
+       };
+       
+       //! \brief Flag field constants for #ROM_TAG_CMD.
+       enum
+       {
+               ROM_LAST_TAG = (1 << 0) //!< This tag command is the last one in the image.
+       };
+       
+       //! \brief Flag field constants for #ROM_LOAD_CMD.
+       enum
+       {
+               ROM_LOAD_DCD = (1 << 0) //!< Execute the DCD after loading completes.
+       };
+       
+       //! \brief Flag field constants for #ROM_FILL_CMD.
+       enum
+       {
+               ROM_FILL_BYTE = 0,              //!< Fill with byte sized pattern.
+               ROM_FILL_HALF_WORD = 1, //!< Fill with half-word sized pattern.
+               ROM_FILL_WORD = 2               //!< Fill with word sized pattern.
+       };
+       
+       //! brief Flag field constants for #ROM_JUMP_CMD and #ROM_CALL_CMD.
+       enum
+       {
+               ROM_HAB_EXEC = (1 << 0) //!< Changes jump or call command to a HAB jump or call.
+       };
+
+public:
+       // Forward declaration.
+       class Section;
+       
+       /*!
+        * \brief Base class for objects that produce cipher blocks.
+        */
+       class CipherBlockGenerator
+       {
+       public:
+       
+               //! \name Cipher blocks
+               //@{
+               //! \brief Returns the total number of cipher blocks.
+               //!
+               //! The default implementation returns 0, indicating that no blocks are
+               //! available.
+               virtual unsigned getBlockCount() const { return 0; }
+               
+               //! \brief Returns the contents of up to \a maxCount cipher blocks.
+               //!
+               //! Up to \a maxCount cipher blocks are copied into the buffer pointed to by
+               //! the \a data argument. This is only a request for \a maxCount blocks,
+               //! the subclass implementation of this method is free to return any number
+               //! of blocks from 0 up to \a maxCount. A return value of 0 indicates that
+               //! no more blocks are available. The index of the first block to copy is
+               //! held in the \a offset argument.
+               //!
+               //! \param offset Starting block number to copy. Zero means the first available block.
+               //! \param maxCount Up to this number of blocks may be copied into \a data. Must be 1 or greater.
+               //! \param data Buffer for outgoing cipher blocks. Must have enough room to hold
+               //!             \a maxCount blocks.
+               //!
+               //! \return The number of cipher blocks copied into \a data.
+               //! \retval 0 No more blocks are available and nothing was written to \a data.
+               virtual unsigned getBlocks(unsigned offset, unsigned maxCount, cipher_block_t * data) { return 0; }
+               //@}
+               
+               //! \brief Print out a string representation of the object.
+               virtual void debugPrint() const {}
+       };
+       
+       /*!
+        * \brief Abstract base class for all bootloader commands.
+        */
+       class BootCommand : public CipherBlockGenerator
+       {
+       public:
+               //! \brief Creates the correct subclass of BootCommand for the given raw data.
+               static BootCommand * createFromData(const cipher_block_t * blocks, unsigned count, unsigned * consumed);
+               
+       public:
+               //! \brief Default constructor.
+               BootCommand() : CipherBlockGenerator() {}
+               
+               //! \brief Destructor.
+               virtual ~BootCommand() {}
+               
+               //! \brief Read the command contents from raw data.
+               //!
+               //! The subclass implementations should validate the contents of the command, including
+               //! the fields of the command header in the first block. It should be assumed that
+               //! only the tag field was examined to determine which subclass of BootCommand
+               //! should be created.
+               //!
+               //! \param blocks Pointer to the raw data blocks.
+               //! \param count Number of blocks pointed to by \a blocks.
+               //! \param[out] consumed On exit, this points to the number of cipher blocks that were occupied
+               //!             by the command. Should be at least 1 for every command. This must not be NULL
+               //!             on entry!
+               virtual void initFromData(const cipher_block_t * blocks, unsigned count, unsigned * consumed)=0;
+               
+               //! \name Header
+               //@{
+               //! \brief Pure virtual method to return the tag value for this command.
+               virtual uint8_t getTag() const = 0;
+               
+               //! \brief Pure virtual method to construct the header for this boot command.
+               virtual void fillCommandHeader(boot_command_t & header) = 0;
+               
+               //! \brief Calculates the checksum for the given command header.
+               virtual uint8_t calculateChecksum(const boot_command_t & header);
+               //@}
+               
+               //! \name Cipher blocks
+               //@{
+               //! \brief Returns the total number of cipher blocks.
+               virtual unsigned getBlockCount() const;
+               
+               //! \brief Returns the contents of up to \a maxCount cipher blocks.
+               virtual unsigned getBlocks(unsigned offset, unsigned maxCount, cipher_block_t * data);
+               //@}
+               
+               //! \name Data blocks
+               //@{
+               //! \brief Returns the number of data cipher blocks that follow this command.
+               //!
+               //! The default implementation returns 0, indicating that no data blocks are
+               //! available.
+               virtual unsigned getDataBlockCount() const { return 0; }
+               
+               //! \brief Returns the contents of up to \a maxCount data blocks.
+               //!
+               //! Up to \a maxCount data blocks are copied into the buffer pointed to by
+               //! the \a data argument. This is only a request for \a maxCount blocks,
+               //! the subclass implementation of this method is free to return any number
+               //! of blocks from 0 up to \a maxCount. A return value of 0 indicates that
+               //! no more blocks are available. The index of the first block to copy is
+               //! held in the \a offset argument.
+               //!
+               //! \param offset Starting block number to copy. Zero means the first available block.
+               //! \param maxCount Up to this number of blocks may be copied into \a data. Must be 1 or greater.
+               //! \param data Buffer for outgoing data blocks. Must have enough room to hold
+               //!             \a maxCount blocks.
+               //!
+               //! \return The number of data blocks copied into \a data.
+               //! \retval 0 No more blocks are available and nothing was written to \a data.
+               virtual unsigned getDataBlocks(unsigned offset, unsigned maxCount, cipher_block_t * data) { return 0; }
+               //@}
+       
+       protected:
+               //! The flag bit values for the \a whichFields parameter of validateHeader().
+               enum
+               {
+                       CMD_TAG_FIELD = 1,
+                       CMD_FLAGS_FIELD = 2,
+                       CMD_ADDRESS_FIELD = 4,
+                       CMD_COUNT_FIELD = 8,
+                       CMD_DATA_FIELD = 16
+               };
+
+               //! \brief
+               void validateHeader(const boot_command_t * modelHeader, const boot_command_t * testHeader, unsigned whichFields);
+       };
+       
+       /*!
+        * \brief No operation bootloader command.
+        */
+       class NopCommand : public BootCommand
+       {
+       public:
+               //! \brief Default constructor.
+               NopCommand() : BootCommand() {}
+               
+               //! \brief Read the command contents from raw data.
+               virtual void initFromData(const cipher_block_t * blocks, unsigned count, unsigned * consumed);
+               
+               //! \name Header
+               //@{
+               //! \brief Returns the tag value for this command.
+               virtual uint8_t getTag() const { return ROM_NOP_CMD; }
+               
+               //! \brief Constructs the header for this boot command.
+               virtual void fillCommandHeader(boot_command_t & header);
+               //@}
+               
+               //! \brief Print out a string representation of the object.
+               virtual void debugPrint() const;
+       };
+       
+       /*!
+        * \brief Section tag bootloader command.
+        */
+       class TagCommand : public BootCommand
+       {
+       public:
+               //! \brief Default constructor.
+               TagCommand() : BootCommand() {}
+               
+               //! \brief Constructor taking a section object.
+               TagCommand(const Section & section);
+               
+               //! \brief Read the command contents from raw data.
+               virtual void initFromData(const cipher_block_t * blocks, unsigned count, unsigned * consumed);
+               
+               //! \name Header
+               //@{
+               //! \brief Returns the tag value for this command.
+               virtual uint8_t getTag() const { return ROM_TAG_CMD; }
+               
+               //! \brief Constructs the header for this boot command.
+               virtual void fillCommandHeader(boot_command_t & header);
+               //@}
+               
+               //! \name Field accessors
+               //@{
+               inline void setSectionIdentifier(uint32_t identifier) { m_sectionIdentifier = identifier; }
+               inline void setSectionLength(uint32_t length) { m_sectionLength = length; }
+               inline void setSectionFlags(uint32_t flags) { m_sectionFlags = flags; }
+               inline void setLast(bool isLast) { m_isLast = isLast; }
+               //@}
+               
+               //! \brief Print out a string representation of the object.
+               virtual void debugPrint() const;
+               
+       protected:
+               uint32_t m_sectionIdentifier;   //!< Unique identifier for the section containing this command.
+               uint32_t m_sectionLength;       //!< Number of cipher blocks this section occupies.
+               uint32_t m_sectionFlags;        //!< Flags pertaining to this section.
+               bool m_isLast;  //!< Is this the last tag command?
+       };
+       
+       /*!
+        * \brief Load data bootloader command.
+        */
+       class LoadCommand : public BootCommand
+       {
+       public:
+               //! \brief Default constructor.
+               LoadCommand();
+               
+               //! \brief Constructor.
+               LoadCommand(uint32_t address, const uint8_t * data, uint32_t length);
+               
+               //! \brief Read the command contents from raw data.
+               virtual void initFromData(const cipher_block_t * blocks, unsigned count, unsigned * consumed);
+               
+               //! \name Header
+               //@{
+               //! \brief Returns the tag value for this command.
+               virtual uint8_t getTag() const { return ROM_LOAD_CMD; }
+               
+               //! \brief Constructs the header for this boot command.
+               virtual void fillCommandHeader(boot_command_t & header);
+               
+               //! \brief Sets the load-dcd flag.
+               inline void setDCD(bool isDCD) { m_loadDCD = isDCD; }
+               //@}
+               
+               //! \name Address
+               //@{
+               inline void setLoadAddress(uint32_t address) { m_address = address; }
+               inline uint32_t getLoadAddress() const { return m_address; }
+               //@}
+               
+               //! \name Load data
+               //@{
+               //! \brief Set the data for the command to load.
+               void setData(const uint8_t * data, uint32_t length);
+               
+               inline uint8_t * getData() { return m_data; }
+               inline const uint8_t * getData() const { return m_data; }
+               inline uint32_t getLength() const { return m_length; }
+               //@}
+               
+               //! \name Data blocks
+               //@{
+               //! \brief Returns the number of data cipher blocks that follow this command.
+               virtual unsigned getDataBlockCount() const;
+               
+               //! \brief Returns the contents of up to \a maxCount data blocks.
+               virtual unsigned getDataBlocks(unsigned offset, unsigned maxCount, cipher_block_t * data);
+               //@}
+               
+               //! \brief Print out a string representation of the object.
+               virtual void debugPrint() const;
+       
+       protected:
+               smart_array_ptr<uint8_t> m_data;        //!< Pointer to data to load.
+               uint8_t m_padding[15];  //!< Up to 15 pad bytes may be required.
+               unsigned m_padCount;    //!< Number of pad bytes.
+               uint32_t m_length;      //!< Number of bytes to load.
+               uint32_t m_address;     //!< Address to which data will be loaded.
+               bool m_loadDCD; //!< Whether to execute the DCD after loading.
+               
+               void fillPadding();
+               uint32_t calculateCRC() const;
+       };
+       
+       /*!
+        * \brief Pattern fill bootloader command.
+        */
+       class FillCommand : public BootCommand
+       {
+       public:
+               //! \brief Default constructor.
+               FillCommand();
+               
+               //! \brief Read the command contents from raw data.
+               virtual void initFromData(const cipher_block_t * blocks, unsigned count, unsigned * consumed);
+               
+               //! \name Header
+               //@{
+               //! \brief Returns the tag value for this command.
+               virtual uint8_t getTag() const { return ROM_FILL_CMD; }
+               
+               //! \brief Constructs the header for this boot command.
+               virtual void fillCommandHeader(boot_command_t & header);
+               //@}
+               
+               //! \name Address range
+               //@{
+               inline void setAddress(uint32_t address) { m_address = address; };
+               inline uint32_t getAddress() const { return m_address; }
+               
+               inline void setFillCount(uint32_t count) { m_count = count; }
+               inline uint32_t getFillCount() const { return m_count; }
+               //@}
+               
+               //! \name Pattern
+               //@{
+               void setPattern(uint8_t pattern);
+               void setPattern(uint16_t pattern);
+               void setPattern(uint32_t pattern);
+               
+               inline uint32_t getPattern() const { return m_pattern; }
+               //@}
+               
+               //! \brief Print out a string representation of the object.
+               virtual void debugPrint() const;
+       
+       protected:
+               uint32_t m_address;     //!< Fill start address.
+               uint32_t m_count;       //!< Number of bytes to fill.
+               uint32_t m_pattern;     //!< Fill pattern.
+       };
+       
+       /*!
+        * \brief Change boot mode bootloader command.
+        */
+       class ModeCommand : public BootCommand
+       {
+       public:
+               //! \brief Default constructor.
+               ModeCommand() : BootCommand(), m_mode(0) {}
+               
+               //! \brief Read the command contents from raw data.
+               virtual void initFromData(const cipher_block_t * blocks, unsigned count, unsigned * consumed);
+               
+               //! \name Header
+               //@{
+               //! \brief Returns the tag value for this command.
+               virtual uint8_t getTag() const { return ROM_MODE_CMD; }
+               
+               //! \brief Constructs the header for this boot command.
+               virtual void fillCommandHeader(boot_command_t & header);
+               //@}
+               
+               //! \name Boot mode
+               //@{
+               inline void setBootMode(uint32_t mode) { m_mode = mode; }
+               inline uint32_t getBootMode() const { return m_mode; }
+               //@}
+               
+               //! \brief Print out a string representation of the object.
+               virtual void debugPrint() const;
+       
+       protected:
+               uint32_t m_mode;        //!< New boot mode.
+       };
+       
+       /*!
+        * \brief Jump to address bootloader command.
+        */
+       class JumpCommand : public BootCommand
+       {
+       public:
+               //! \brief Default constructor.
+               JumpCommand() : BootCommand(), m_address(0), m_argument(0), m_isHAB(false), m_ivtSize(0) {}
+               
+               //! \brief Read the command contents from raw data.
+               virtual void initFromData(const cipher_block_t * blocks, unsigned count, unsigned * consumed);
+               
+               //! \name Header
+               //@{
+               //! \brief Returns the tag value for this command.
+               virtual uint8_t getTag() const { return ROM_JUMP_CMD; }
+               
+               //! \brief Constructs the header for this boot command.
+               virtual void fillCommandHeader(boot_command_t & header);
+               //@}
+               
+               //! \name Accessors
+               //@{
+               inline void setAddress(uint32_t address) { m_address = address; }
+               inline uint32_t getAddress() const { return m_address; }
+               
+               inline void setArgument(uint32_t argument) { m_argument = argument; }
+               inline uint32_t getArgument() const { return m_argument; }
+               
+               inline void setIsHAB(bool isHAB) { m_isHAB = isHAB; }
+               inline bool isHAB() const { return m_isHAB; }
+               
+               inline void setIVTSize(uint32_t ivtSize) { m_ivtSize = ivtSize; }
+               inline uint32_t getIVTSize() const { return m_ivtSize; }
+               //@}
+               
+               //! \brief Print out a string representation of the object.
+               virtual void debugPrint() const;
+               
+       protected:
+               uint32_t m_address;     //!< Address of the code to execute.
+               uint32_t m_argument;    //!< Sole argument to pass to code.
+               bool m_isHAB;           //!< Whether this jump/call is a special HAB jump/call. When this flag is set, m_address becomes the IVT address and m_ivtSize is the IVT size.
+               uint32_t m_ivtSize;     //!< Size of the IVT for a HAB jump/call.
+       };
+       
+       /*!
+        * \brief Call function bootloader command.
+        */
+       class CallCommand : public JumpCommand
+       {
+       public:
+               //! \brief Default constructor.
+               CallCommand() : JumpCommand() {}
+               
+               //! \brief Returns the tag value for this command.
+               virtual uint8_t getTag() const { return ROM_CALL_CMD; }
+               
+               //! \brief Print out a string representation of the object.
+               virtual void debugPrint() const;
+       };
+       
+       /*!
+        * \brief Base class for a section of an Encore boot image.
+        *
+        * Provides methods to manage the unique identifier that all sections have, and
+        * to set the boot image object which owns the section. There are also virtual
+        * methods to get header flags and fill in the header used in the section
+        * table. Subclasses must implement at least fillSectionHeader().
+        */
+       class Section : public CipherBlockGenerator
+       {
+       public:
+               //! \brief Default constructor.
+               Section() : CipherBlockGenerator(), m_identifier(0), m_image(0), m_alignment(BOOT_IMAGE_MINIMUM_SECTION_ALIGNMENT), m_flags(0), m_leaveUnencrypted(false) {}
+               
+               //! \brief Constructor taking the unique identifier for this section.
+               Section(uint32_t identifier) : CipherBlockGenerator(), m_identifier(identifier), m_image(0), m_alignment(BOOT_IMAGE_MINIMUM_SECTION_ALIGNMENT), m_flags(0), m_leaveUnencrypted(false) {}
+               
+               //! \name Identifier
+               //@{
+               inline void setIdentifier(uint32_t identifier) { m_identifier = identifier; }
+               inline uint32_t getIdentifier() const { return m_identifier; }
+               //@}
+               
+               //! \name Header
+               //@{
+               //! \brief Sets explicit flags for this section.
+               virtual void setFlags(uint32_t flags) { m_flags = flags; }
+               
+               //! \brief Returns the flags for this section.
+               //!
+               //! The return value consists of the flags set with setFlags() possibly or-ed
+               //! with #ROM_SECTION_CLEARTEXT if the section has been set to be left
+               //! unencrypted.
+               virtual uint32_t getFlags() const { return m_flags | ( m_leaveUnencrypted ? ROM_SECTION_CLEARTEXT : 0); }
+               
+               //! \brief Pure virtual method to construct the header for this section.
+               virtual void fillSectionHeader(section_header_t & header);
+               //@}
+               
+               //! \name Owner image
+               //@{
+               //! \brief Called when the section is added to an image.
+               void setImage(EncoreBootImage * image) { m_image = image; }
+               
+               //! \brief Returns a pointer to the image that this section belongs to.
+               EncoreBootImage * getImage() const { return m_image; }
+               //@}
+               
+               //! \name Alignment
+               //@{
+               //! \brief Sets the required alignment in the output file for this section.
+               void setAlignment(unsigned alignment);
+               
+               //! \brief Returns the current alignment, the minimum of which will be 16.
+               unsigned getAlignment() const { return m_alignment; }
+               
+               //! \brief Computes padding amount for alignment requirement.
+               unsigned getPadBlockCountForOffset(unsigned offset);
+               //@}
+               
+               //! \name Leave unencrypted flag
+               //@{
+               //! \brief Sets whether the section will be left unencrypted.
+               void setLeaveUnencrypted(unsigned flag) { m_leaveUnencrypted = flag; }
+               
+               //! \brief Returns true if the section will remain unencrypted.
+               bool getLeaveUnencrypted() const { return m_leaveUnencrypted; }
+               //@}
+       
+       protected:
+               uint32_t m_identifier;  //!< Unique identifier for this section.
+               EncoreBootImage * m_image;      //!< The image to which this section belongs.
+               unsigned m_alignment;   //!< Alignment requirement for the start of this section.
+               uint32_t m_flags;       //!< Section flags set by the user.
+               bool m_leaveUnencrypted;        //!< Set to true to prevent this section from being encrypted.
+       };
+       
+       /*!
+        * \brief A bootable section of an Encore boot image.
+        */
+       class BootSection : public Section
+       {
+       public:
+               typedef std::list<BootCommand*> command_list_t;
+               typedef command_list_t::iterator iterator_t;
+               typedef command_list_t::const_iterator const_iterator_t;
+               
+       public:
+               //! \brief Default constructor.
+               BootSection() : Section() {}
+               
+               //! \brief Constructor taking the unique identifier for this section.
+               BootSection(uint32_t identifier) : Section(identifier) {}
+               
+               //! \brief Destructor.
+               virtual ~BootSection();
+               
+               //! \brief Load the section from raw data.
+               virtual void fillFromData(const cipher_block_t * blocks, unsigned count);
+               
+               //! \name Header
+               //@{
+               //! \brief Returns the flags for this section.
+               virtual uint32_t getFlags() const { return Section::getFlags() | ROM_SECTION_BOOTABLE; }
+               //@}
+               
+               //! \name Commands
+               //@{
+               //! \brief Append a new command to the section.
+               //!
+               //! The section takes ownership of the command and will delete it when
+               //! the section is destroyed.
+               void addCommand(BootCommand * command) { m_commands.push_back(command); }
+               
+               //! \brief Returns the number of commands in this section, excluding the tag command.
+               unsigned getCommandCount() const { return (unsigned)m_commands.size(); }
+               
+               iterator_t begin() { return m_commands.begin(); }
+               iterator_t end() { return m_commands.end(); }
+               
+               const_iterator_t begin() const { return m_commands.begin(); }
+               const_iterator_t end() const { return m_commands.end(); }
+               //@}
+       
+               //! \name Cipher blocks
+               //@{
+               //! \brief Returns the total number of cipher blocks occupied by this section.
+               virtual unsigned getBlockCount() const;
+               
+               //! \brief Returns the contents of up to \a maxCount cipher blocks.
+               virtual unsigned getBlocks(unsigned offset, unsigned maxCount, cipher_block_t * data);
+               //@}
+               
+               //! \brief Print out a string representation of the object.
+               virtual void debugPrint() const;
+               
+       protected:
+               command_list_t m_commands;      //!< Commands held in this section.
+               
+       protected:
+               //! \brief Remove all commands from the section.
+               void deleteCommands();
+       };
+       
+       /*!
+        * \brief A non-bootable section of an Encore boot image.
+        */
+       class DataSection : public Section
+       {
+       public:
+               //! \brief Default constructor.
+               DataSection() : Section(), m_data(), m_length(0) {}
+               
+               //! \brief Constructor taking the unique identifier for this section.
+               DataSection(uint32_t identifier) : Section(identifier), m_data(), m_length(0) {}
+               
+               //! \brief Set the data section's contents.
+               void setData(const uint8_t * data, unsigned length);
+               
+               //! \brief Set the data section's contents without copying \a data.
+               void setDataNoCopy(const uint8_t * data, unsigned length);
+       
+               //! \name Cipher blocks
+               //@{
+               //! \brief Returns the total number of cipher blocks occupied by this section.
+               virtual unsigned getBlockCount() const;
+               
+               //! \brief Returns the contents of up to \a maxCount cipher blocks.
+               virtual unsigned getBlocks(unsigned offset, unsigned maxCount, cipher_block_t * data);
+               //@}
+               
+               //! \brief Print out a string representation of the object.
+               virtual void debugPrint() const;
+               
+       protected:
+               smart_array_ptr<uint8_t> m_data;        //!< The section's contents.
+               unsigned m_length;      //!< Number of bytes of data.
+       };
+
+public:
+       typedef std::list<Section*> section_list_t;                             //!< List of image sections.
+       typedef section_list_t::iterator section_iterator_t;    //!< Iterator over sections.
+       typedef section_list_t::const_iterator const_section_iterator_t;        //!< Const iterator over sections.
+       
+       typedef std::vector<AES128Key> key_list_t;                              //!< List of KEKs.
+       typedef key_list_t::iterator key_iterator_t;                    //!< Iterator over KEKs.
+       typedef key_list_t::const_iterator const_key_iterator_t;                        //!< Const iterator over KEKs.
+
+public:
+       //! \brief Default constructor.
+       EncoreBootImage();
+       
+       //! \brief Destructor.
+       virtual ~EncoreBootImage();
+       
+       //! \name Sections
+       //@{
+       void addSection(Section * newSection);
+       inline unsigned sectionCount() const { return (unsigned)m_sections.size(); }
+       
+       inline section_iterator_t beginSection() { return m_sections.begin(); }
+       inline section_iterator_t endSection() { return m_sections.end(); }
+       inline const_section_iterator_t beginSection() const { return m_sections.begin(); }
+       inline const_section_iterator_t endSection() const { return m_sections.end(); }
+       
+       section_iterator_t findSection(Section * section);
+       
+       //! \brief Calculates the starting block number for the given section.
+       uint32_t getSectionOffset(Section * section);
+       //@}
+       
+       //! \name Encryption keys
+       //@{
+       inline void addKey(const AES128Key & newKey) { m_keys.push_back(newKey); }
+       inline unsigned keyCount() const { return (unsigned)m_keys.size(); }
+
+       inline key_iterator_t beginKeys() { return m_keys.begin(); }
+       inline key_iterator_t endKeys() { return m_keys.end(); }
+       inline const_key_iterator_t beginKeys() const { return m_keys.begin(); }
+       inline const_key_iterator_t endKeys() const { return m_keys.end(); }
+       
+       //! \brief The image is encrypted if there is at least one key.
+       inline bool isEncrypted() const { return m_keys.size() != 0; }
+       //@}
+       
+       //! \name Versions
+       //@{
+       virtual void setProductVersion(const version_t & version);
+       virtual void setComponentVersion(const version_t & version);
+       //@}
+       
+       //! \name Flags
+       //@{
+       inline void setFlags(uint16_t flags) { m_headerFlags = flags; }
+       inline uint32_t getFlags() const { return m_headerFlags; }
+       //@}
+       
+       //! \brief Specify the drive tag to be set in the output file header.
+       virtual void setDriveTag(uint16_t tag) { m_driveTag = tag; }
+       
+       //! \brief Calculates the total number of cipher blocks the image consumes.
+       uint32_t getImageSize();
+       
+       //! \brief Returns the preferred ".sb" extension for Encore boot images.
+       virtual std::string getFileExtension() const { return ".sb"; }
+       
+       //! \name Output
+       //@{
+       //! \brief Write the boot image to an output stream.
+       virtual void writeToStream(std::ostream & stream);
+       //@}
+               
+       //! \brief Print out a string representation of the object.
+       virtual void debugPrint() const;
+       
+protected:
+       uint16_t m_headerFlags; //!< Flags field in the boot image header.
+       version_t m_productVersion;             //!< Product version.
+       version_t m_componentVersion;   //!< Component version.
+       uint16_t m_driveTag;    //!< System drive tag for this boot image.
+       section_list_t m_sections;      //!< Sections contained in this image.
+       key_list_t m_keys;      //!< List of key encryption keys. If empty, the image is unencrypted.
+       AES128Key m_sessionKey; //!< Session key we're using.
+       
+       void prepareImageHeader(boot_image_header_t & header);
+       uint64_t getTimestamp();
+       Section * findFirstBootableSection();
+       unsigned getPadBlockCountForSection(Section * section, unsigned offset);
+};
+
+}; // namespace elftosb
+
+#endif // _EncoreBootImage_h_
diff --git a/tools/elftosb/common/EndianUtilities.h b/tools/elftosb/common/EndianUtilities.h
new file mode 100644 (file)
index 0000000..f915309
--- /dev/null
@@ -0,0 +1,141 @@
+/*
+ * File:       EndianUtilities.h
+ *
+ * Copyright (c) Freescale Semiconductor, Inc. All rights reserved.
+ * See included license file for license details.
+ */
+#if !defined(_EndianUtilities_h_)
+#define _EndianUtilities_h_
+
+//! \name Swap macros
+//! These macros always swap the data.
+//@{
+
+//! Byte swap 16-bit value.
+#define _BYTESWAP16(value)                 \
+        (((((uint16_t)value)<<8) & 0xFF00)   | \
+         ((((uint16_t)value)>>8) & 0x00FF))
+
+//! Byte swap 32-bit value.
+#define _BYTESWAP32(value)                     \
+        (((((uint32_t)value)<<24) & 0xFF000000)  | \
+         ((((uint32_t)value)<< 8) & 0x00FF0000)  | \
+         ((((uint32_t)value)>> 8) & 0x0000FF00)  | \
+         ((((uint32_t)value)>>24) & 0x000000FF))
+
+//! Byte swap 64-bit value.
+#define _BYTESWAP64(value)                                \
+               (((((uint64_t)value)<<56) & 0xFF00000000000000ULL)  | \
+                ((((uint64_t)value)<<40) & 0x00FF000000000000ULL)  | \
+                ((((uint64_t)value)<<24) & 0x0000FF0000000000ULL)  | \
+                ((((uint64_t)value)<< 8) & 0x000000FF00000000ULL)  | \
+                ((((uint64_t)value)>> 8) & 0x00000000FF000000ULL)  | \
+                ((((uint64_t)value)>>24) & 0x0000000000FF0000ULL)  | \
+                ((((uint64_t)value)>>40) & 0x000000000000FF00ULL)  | \
+                ((((uint64_t)value)>>56) & 0x00000000000000FFULL))
+
+//@}
+
+//! \name Inline swap functions
+//@{
+
+inline uint16_t _swap_u16(uint16_t value) { return _BYTESWAP16(value); }
+inline int16_t _swap_s16(int16_t value) { return (int16_t)_BYTESWAP16((uint16_t)value); }
+
+inline uint32_t _swap_u32(uint32_t value) { return _BYTESWAP32(value); }
+inline int32_t _swap_s32(int32_t value) { return (int32_t)_BYTESWAP32((uint32_t)value); }
+
+inline uint64_t _swap_u64(uint64_t value) { return _BYTESWAP64(value); }
+inline int64_t _swap_s64(int64_t value) { return (uint64_t)_BYTESWAP64((uint64_t)value); }
+
+//@}
+
+#if defined(__LITTLE_ENDIAN__)
+
+       /* little endian host */
+
+       #define ENDIAN_BIG_TO_HOST_U16(value) (_swap_u16(value))
+       #define ENDIAN_HOST_TO_BIG_U16(value) (_swap_u16(value))
+       
+       #define ENDIAN_BIG_TO_HOST_S16(value) (_swap_s16(value))
+       #define ENDIAN_HOST_TO_BIG_S16(value) (_swap_s16(value))
+       
+       #define ENDIAN_BIG_TO_HOST_U32(value) (_swap_u32(value))
+       #define ENDIAN_HOST_TO_BIG_U32(value) (_swap_u32(value))
+       
+       #define ENDIAN_BIG_TO_HOST_S32(value) (_swap_s32(value))
+       #define ENDIAN_HOST_TO_BIG_S32(value) (_swap_s32(value))
+       
+       #define ENDIAN_BIG_TO_HOST_U64(value) (_swap_u64(value))
+       #define ENDIAN_HOST_TO_BIG_U64(value) (_swap_u64(value))
+       
+       #define ENDIAN_BIG_TO_HOST_S64(value) (_swap_s64(value))
+       #define ENDIAN_HOST_TO_BIG_S64(value) (_swap_s64(value))
+       
+       /* no-ops */
+       
+       #define ENDIAN_LITTLE_TO_HOST_U16(value) (value)
+       #define ENDIAN_HOST_TO_LITTLE_U16(value) (value)
+
+       #define ENDIAN_LITTLE_TO_HOST_S16(value) (value)
+       #define ENDIAN_HOST_TO_LITTLE_S16(value) (value)
+       
+       #define ENDIAN_LITTLE_TO_HOST_U32(value) (value)
+       #define ENDIAN_HOST_TO_LITTLE_U32(value) (value)
+       
+       #define ENDIAN_LITTLE_TO_HOST_S32(value) (value)
+       #define ENDIAN_HOST_TO_LITTLE_S32(value) (value)
+       
+       #define ENDIAN_LITTLE_TO_HOST_U64(value) (value)
+       #define ENDIAN_HOST_TO_LITTLE_U64(value) (value)
+       
+       #define ENDIAN_LITTLE_TO_HOST_S64(value) (value)
+       #define ENDIAN_HOST_TO_LITTLE_S64(value) (value)
+       
+#elif defined(__BIG_ENDIAN__)
+
+       /* big endian host */
+
+       #define ENDIAN_LITTLE_TO_HOST_U16(value) (_swap_u16(value))
+       #define ENDIAN_HOST_TO_LITTLE_U16(value) (_swap_u16(value))
+
+       #define ENDIAN_LITTLE_TO_HOST_S16(value) (_swap_s16(value))
+       #define ENDIAN_HOST_TO_LITTLE_S16(value) (_swap_s16(value))
+       
+       #define ENDIAN_LITTLE_TO_HOST_U32(value) (_swap_u32(value))
+       #define ENDIAN_HOST_TO_LITTLE_U32(value) (_swap_u32(value))
+       
+       #define ENDIAN_LITTLE_TO_HOST_S32(value) (_swap_s32(value))
+       #define ENDIAN_HOST_TO_LITTLE_S32(value) (_swap_s32(value))
+       
+       #define ENDIAN_LITTLE_TO_HOST_U64(value) (_swap_u64(value))
+       #define ENDIAN_HOST_TO_LITTLE_U64(value) (_swap_u64(value))
+       
+       #define ENDIAN_LITTLE_TO_HOST_S64(value) (_swap_s64(value))
+       #define ENDIAN_HOST_TO_LITTLE_S64(value) (_swap_s64(value))
+       
+       /* no-ops */
+       
+       #define ENDIAN_BIG_TO_HOST_U16(value) (value)
+       #define ENDIAN_HOST_TO_BIG_U16(value) (value)
+       
+       #define ENDIAN_BIG_TO_HOST_S16(value) (value)
+       #define ENDIAN_HOST_TO_BIG_S16(value) (value)
+       
+       #define ENDIAN_BIG_TO_HOST_U32(value) (value)
+       #define ENDIAN_HOST_TO_BIG_U32(value) (value)
+       
+       #define ENDIAN_BIG_TO_HOST_S32(value) (value)
+       #define ENDIAN_HOST_TO_BIG_S32(value) (value)
+       
+       #define ENDIAN_BIG_TO_HOST_U64(value) (value)
+       #define ENDIAN_HOST_TO_BIG_U64(value) (value)
+       
+       #define ENDIAN_BIG_TO_HOST_S64(value) (value)
+       #define ENDIAN_HOST_TO_BIG_S64(value) (value)
+
+#endif
+
+
+
+#endif // _EndianUtilities_h_
diff --git a/tools/elftosb/common/EvalContext.cpp b/tools/elftosb/common/EvalContext.cpp
new file mode 100644 (file)
index 0000000..876bb81
--- /dev/null
@@ -0,0 +1,111 @@
+/*
+ * File:       EvalContext.h
+ *
+ * Copyright (c) Freescale Semiconductor, Inc. All rights reserved.
+ * See included license file for license details.
+ */
+
+#include "EvalContext.h"
+#include <stdexcept>
+#include "format_string.h"
+
+using namespace elftosb;
+
+EvalContext::EvalContext()
+:      m_sourcesManager(0)
+{
+}
+
+EvalContext::~EvalContext()
+{
+}
+
+bool EvalContext::isVariableDefined(const std::string & name)
+{
+       variable_map_t::const_iterator it = m_variables.find(name);
+       return it != m_variables.end();
+}
+
+uint32_t EvalContext::getVariableValue(const std::string & name)
+{
+       variable_map_t::const_iterator it = m_variables.find(name);
+       if (it == m_variables.end())
+       {
+               throw std::runtime_error(format_string("undefined variable '%s'", name.c_str()));
+       }
+       
+       return it->second.m_value;
+}
+
+int_size_t EvalContext::getVariableSize(const std::string & name)
+{
+       variable_map_t::const_iterator it = m_variables.find(name);
+       if (it == m_variables.end())
+       {
+               throw std::runtime_error(format_string("undefined variable '%s'", name.c_str()));
+       }
+       
+       return it->second.m_size;
+}
+
+void EvalContext::setVariable(const std::string & name, uint32_t value, int_size_t size)
+{
+       // check if var is locked
+       variable_map_t::const_iterator it = m_variables.find(name);
+       if (it != m_variables.end() && it->second.m_isLocked)
+       {
+               return;
+       }
+       
+       // set var info
+       variable_info_t info;
+       info.m_value = value;
+       info.m_size = size;
+       info.m_isLocked = false;
+       m_variables[name] = info;
+}
+
+bool EvalContext::isVariableLocked(const std::string & name)
+{
+       variable_map_t::const_iterator it = m_variables.find(name);
+       if (it == m_variables.end())
+       {
+               throw std::runtime_error(format_string("undefined variable '%s'", name.c_str()));
+       }
+       
+       return it->second.m_isLocked;
+}
+
+void EvalContext::lockVariable(const std::string & name)
+{
+       variable_map_t::iterator it = m_variables.find(name);
+       if (it == m_variables.end())
+       {
+               throw std::runtime_error(format_string("undefined variable '%s'", name.c_str()));
+       }
+       
+       it->second.m_isLocked = true;
+}
+
+void EvalContext::unlockVariable(const std::string & name)
+{
+       variable_map_t::iterator it = m_variables.find(name);
+       if (it == m_variables.end())
+       {
+               throw std::runtime_error("undefined variable");
+       }
+       
+       it->second.m_isLocked = false;
+}
+
+void EvalContext::dump()
+{
+       variable_map_t::iterator it = m_variables.begin();
+       for (; it != m_variables.end(); ++it)
+       {
+               variable_info_t & info = it->second;
+               const char * lockedString = info.m_isLocked ? "locked" : "unlocked";
+               printf("%s = %u:%d (%s)\n", it->first.c_str(), info.m_value, (int)info.m_size, lockedString);
+       }
+}
+
diff --git a/tools/elftosb/common/EvalContext.h b/tools/elftosb/common/EvalContext.h
new file mode 100644 (file)
index 0000000..8c56d60
--- /dev/null
@@ -0,0 +1,99 @@
+/*
+ * File:       EvalContext.h
+ *
+ * Copyright (c) Freescale Semiconductor, Inc. All rights reserved.
+ * See included license file for license details.
+ */
+#if !defined(_EvalContext_h_)
+#define _EvalContext_h_
+
+#include <map>
+#include <string>
+#include "Value.h"
+#include "int_size.h"
+#include "SourceFile.h"
+
+namespace elftosb
+{
+
+/*!
+ * \brief Context for evaluating AST tree and expressions.
+ *
+ * Keeps a map of variable names to integer values. Each integer value has a
+ * size attribute in addition to the actual value. Variables can be locked, which
+ * simply means that they cannot be assigned a new value.
+ *
+ * \todo Switch to using Value instances to keep track of variable values. This
+ *             will enable variables to have string values, for one.
+ */
+class EvalContext
+{
+public:
+       /*!
+        * \brief Abstract interface for a manager of source files.
+        */
+       class SourceFileManager
+       {
+       public:
+               //! \brief Returns true if a source file with the name \a name exists.
+               virtual bool hasSourceFile(const std::string & name)=0;
+               
+               //! \brief Gets the requested source file.
+               virtual SourceFile * getSourceFile(const std::string & name)=0;
+               
+               //! \brief Returns the default source file, or NULL if none is set.
+               virtual SourceFile * getDefaultSourceFile()=0;
+       };
+       
+public:
+       //! \brief Constructor.
+       EvalContext();
+       
+       //! \brief Destructor.
+       virtual ~EvalContext();
+       
+       //! \name Source file manager
+       //@{
+       //! \brief
+       void setSourceFileManager(SourceFileManager * manager) { m_sourcesManager = manager; }
+       
+       //! \brief
+       SourceFileManager * getSourceFileManager() { return m_sourcesManager; }
+       //@}
+       
+       //! \name Variables
+       //@{
+       bool isVariableDefined(const std::string & name);
+       uint32_t getVariableValue(const std::string & name);
+       int_size_t getVariableSize(const std::string & name);
+       void setVariable(const std::string & name, uint32_t value, int_size_t size=kWordSize);
+       //@}
+       
+       //! \name Locks
+       //@{
+       bool isVariableLocked(const std::string & name);
+       void lockVariable(const std::string & name);
+       void unlockVariable(const std::string & name);
+       //@}
+       
+       void dump();
+
+protected:
+       //! Information about a variable's value.
+       struct variable_info_t
+       {
+               uint32_t m_value;       //!< Variable value.
+               int_size_t m_size;      //!< Number of bytes
+               bool m_isLocked;        //!< Can this variable's value be changed?
+       };
+       
+       //! Type to maps between the variable name and its info.
+       typedef std::map<std::string, variable_info_t> variable_map_t;
+       
+       SourceFileManager * m_sourcesManager; //!< Interface to source file manager.
+       variable_map_t m_variables;     //!< Map of variables to their final values.
+};
+
+}; // namespace elftosb
+
+#endif // _EvalContext_h_
diff --git a/tools/elftosb/common/ExcludesListMatcher.cpp b/tools/elftosb/common/ExcludesListMatcher.cpp
new file mode 100644 (file)
index 0000000..56d67d6
--- /dev/null
@@ -0,0 +1,88 @@
+/*
+ * File:       ExcludesListMatcher.cpp
+ *
+ * Copyright (c) Freescale Semiconductor, Inc. All rights reserved.
+ * See included license file for license details.
+ */
+
+#include "ExcludesListMatcher.h"
+
+using namespace elftosb;
+
+ExcludesListMatcher::ExcludesListMatcher()
+:      GlobMatcher("")
+{
+}
+
+ExcludesListMatcher::~ExcludesListMatcher()
+{
+}
+
+//! \param isInclude True if this pattern is an include, false if it is an exclude.
+//! \param pattern String containing the glob pattern.
+void ExcludesListMatcher::addPattern(bool isInclude, const std::string & pattern)
+{
+       glob_list_item_t item;
+       item.m_isInclude = isInclude;
+       item.m_glob = pattern;
+       
+       // add to end of list
+       m_patterns.push_back(item);
+}
+
+//! If there are no entries in the match list, the match fails.
+//!
+//! \param testValue The string to match against the pattern list.
+//! \retval true The \a testValue argument matches.
+//! \retval false No match was made against the argument.
+bool ExcludesListMatcher::match(const std::string & testValue)
+{
+       if (!m_patterns.size())
+       {
+               return false;
+       }
+       
+       // Iterate over the match list. Includes act as an OR operator, while
+       // excludes act as an AND operator.
+       bool didMatch = false;
+       bool isFirstItem = true;
+       glob_list_t::iterator it = m_patterns.begin();
+       for (; it != m_patterns.end(); ++it)
+       {
+               glob_list_item_t & item = *it;
+               
+               // if this pattern is an include and it doesn't match, or
+               // if this pattern is an exclude and it does match, then the match fails
+               bool didItemMatch = globMatch(testValue.c_str(), item.m_glob.c_str());
+               
+               if (item.m_isInclude)
+               {
+                       // Include
+                       if (isFirstItem)
+                       {
+                               didMatch = didItemMatch;
+                       }
+                       else
+                       {
+                               didMatch = didMatch || didItemMatch;
+                       }
+               }
+               else
+               {
+                       // Exclude
+                       if (isFirstItem)
+                       {
+                               didMatch = !didItemMatch;
+                       }
+                       else
+                       {
+                               didMatch = didMatch && !didItemMatch;
+                       }
+               }
+               
+               isFirstItem = false;
+       }
+       
+       return didMatch;
+}
+
diff --git a/tools/elftosb/common/ExcludesListMatcher.h b/tools/elftosb/common/ExcludesListMatcher.h
new file mode 100644 (file)
index 0000000..31398a8
--- /dev/null
@@ -0,0 +1,67 @@
+/*
+ * File:       ExcludesListMatcher.h
+ *
+ * Copyright (c) Freescale Semiconductor, Inc. All rights reserved.
+ * See included license file for license details.
+ */
+#if !defined(_ExcludesListMatcher_h_)
+#define _ExcludesListMatcher_h_
+
+#include "GlobMatcher.h"
+#include <vector>
+#include <string>
+
+namespace elftosb
+{
+
+/*!
+ * \brief Matches strings using a series of include and exclude glob patterns.
+ *
+ * This string matcher class uses a sequential, ordered list of glob patterns to
+ * determine whether a string matches.  Attached to each pattern is an include/exclude
+ * action. The patterns in the list effectively form a Boolean expression. Includes
+ * act as an OR operator while excludes act as an AND NOT operator.
+ *
+ * Examples (plus prefix is include, minus prefix is exclude):
+ * - +foo: foo
+ * - -foo: !foo
+ * - +foo, +bar: foo || bar
+ * - +foo, -bar: foo && !bar
+ * - +foo, -bar, +baz: foo && !bar || baz
+ *
+ * The only reason for inheriting from GlobMatcher is so we can access the protected
+ * globMatch() method.
+ */
+class ExcludesListMatcher : public GlobMatcher
+{
+public:
+       //! \brief Default constructor.
+       ExcludesListMatcher();
+       
+       //! \brief Destructor.
+       ~ExcludesListMatcher();
+       
+       //! \name Pattern list
+       //@{
+       //! \brief Add one include or exclude pattern to the end of the match list.
+       void addPattern(bool isInclude, const std::string & pattern);
+       //@}
+       
+       //! \brief Performs a single string match test against testValue.
+       virtual bool match(const std::string & testValue);
+
+protected:
+       //! \brief Information about one glob pattern entry in a match list.
+       struct glob_list_item_t
+       {
+               bool m_isInclude;       //!< True if include, false if exclude.
+               std::string m_glob;     //!< The glob pattern to match.
+       };
+       
+       typedef std::vector<glob_list_item_t> glob_list_t;
+       glob_list_t m_patterns; //!< Ordered list of include and exclude patterns.
+};
+
+}; // namespace elftosb
+
+#endif // _ExcludesListMatcher_h_
diff --git a/tools/elftosb/common/GHSSecInfo.cpp b/tools/elftosb/common/GHSSecInfo.cpp
new file mode 100644 (file)
index 0000000..300366c
--- /dev/null
@@ -0,0 +1,100 @@
+/*
+ * File:    GHSSecInfo.cpp
+ *
+ * Copyright (c) Freescale Semiconductor, Inc. All rights reserved.
+ * See included license file for license details.
+ */
+
+#include "GHSSecInfo.h"
+#include <stdexcept>
+#include "Logging.h"
+#include "EndianUtilities.h"
+
+//! The name of the GHS-specific section info table ELF section.
+const char * const kSecInfoSectionName = ".secinfo";
+
+using namespace elftosb;
+
+//! The ELF file passed into this constructor as the \a elf argument must remain
+//! valid for the life of this object.
+//!
+//! \param elf The ELF file parser. An assertion is raised if this is NULL.
+GHSSecInfo::GHSSecInfo(StELFFile * elf)
+:      m_elf(elf), m_hasInfo(false), m_info(0), m_entryCount(0)
+{
+       assert(elf);
+       
+       // look up the section. if it's not there just leave m_info and m_entryCount to 0
+       unsigned sectionIndex = m_elf->getIndexOfSectionWithName(kSecInfoSectionName);
+       if (sectionIndex == SHN_UNDEF)
+       {
+               return;
+       }
+       
+       // get the section data
+       const Elf32_Shdr & secInfo = m_elf->getSectionAtIndex(sectionIndex);
+       if (secInfo.sh_type != SHT_PROGBITS)
+       {
+               // .secinfo section isn't the right type, so something is wrong
+               return;
+       }
+
+       m_hasInfo = true;
+       m_info = (ghs_secinfo_t *)m_elf->getSectionDataAtIndex(sectionIndex);
+       m_entryCount = secInfo.sh_size / sizeof(ghs_secinfo_t);
+}
+
+//! Looks up \a addr for \a length in the .secinfo array. Only if that address is in the
+//! .secinfo array does this section need to be filled. If the section is found but the
+//! length does not match the \a length argument, a message is logged at the
+//! #Logger::WARNING level.
+//!
+//! If the .secinfo section is not present in the ELF file, this method always returns
+//! true.
+//!
+//! \param addr The start address of the section to query.
+//! \param length The length of the section. If a section with a start address matching
+//!            \a addr is found, its length must match \a length to be considered.
+//!
+//! \retval true The section matching \a addr and \a length was found and should be filled.
+//!            True is also returned when the ELF file does not have a .secinfo section.
+//! \retval false The section was not found and should not be filled.
+bool GHSSecInfo::isSectionFilled(uint32_t addr, uint32_t length)
+{
+       if (!m_hasInfo)
+       {
+               return true;
+       }
+
+       unsigned i;
+       for (i = 0; i < m_entryCount; ++i)
+       {
+               // byte swap these values into host endianness
+               uint32_t clearAddr = ENDIAN_LITTLE_TO_HOST_U32(m_info[i].m_clearAddr);
+               uint32_t numBytesToClear = ENDIAN_LITTLE_TO_HOST_U32(m_info[i].m_numBytesToClear);
+               
+               // we only consider non-zero length clear regions
+               if ((addr == clearAddr) && (numBytesToClear != 0))
+               {
+                       // it is an error if the address matches but the length does not
+                       if (length != numBytesToClear)
+                       {
+                               Log::log(Logger::WARNING, "ELF Error: Size mismatch @ sect=%u, .secinfo=%u at addr 0x%08X\n", length, numBytesToClear, addr);
+                       }
+                       return true;
+               }
+       }
+
+       return false;
+}
+
+//! Simply calls through to isSectionFilled(uint32_t, uint32_t) to determine
+//! if \a section should be filled.
+//!
+//! If the .secinfo section is not present in the ELF file, this method always returns
+//! true.
+bool GHSSecInfo::isSectionFilled(const Elf32_Shdr & section)
+{
+       return isSectionFilled(section.sh_addr, section.sh_size);
+}
+
diff --git a/tools/elftosb/common/GHSSecInfo.h b/tools/elftosb/common/GHSSecInfo.h
new file mode 100644 (file)
index 0000000..9042d39
--- /dev/null
@@ -0,0 +1,72 @@
+/*
+ * File:    GHSSecInfo.h
+ *
+ * Copyright (c) Freescale Semiconductor, Inc. All rights reserved.
+ * See included license file for license details.
+ */
+#if !defined(_GHSSecInfo_h_)
+#define _GHSSecInfo_h_
+
+#include "StELFFile.h"
+#include "smart_ptr.h"
+
+namespace elftosb
+{
+
+/*!
+ * \brief Wrapper around the GHS-specific .secinfo ELF section.
+ *
+ * ELF files produced by the Green Hills MULTI toolset will have a
+ * special .secinfo section. For the most part, this section contains
+ * a list of address
+ * ranges that should be filled by the C runtime startup code. The
+ * address ranges correspond to those of ELF sections whose type is
+ * #SHT_NOBITS. The GHS runtime uses this table instead of just filling
+ * all #SHT_NOBITS sections because the linker command file can
+ * be used to optionally not fill individual sections.
+ *
+ * The isSectionFilled() methods let calling code determine if an ELF
+ * section is found in the .secinfo table. If the section is found,
+ * then it should be filled.
+ */
+class GHSSecInfo
+{
+public:
+       //! \brief Default constructor.
+       GHSSecInfo(StELFFile * elf);
+
+       //! \brief Returns true if there is a .secinfo section present in the ELF file.
+       bool hasSecinfo() const { return m_hasInfo; }
+       
+       //! \brief Determines if a section should be filled.
+       bool isSectionFilled(uint32_t addr, uint32_t length);
+       
+       //! \brief Determines if \a section should be filled.
+       bool isSectionFilled(const Elf32_Shdr & section);
+       
+protected:
+
+#pragma pack(1)
+
+       /*!
+        * \brief The structure of one .secinfo entry.
+        */
+       struct ghs_secinfo_t
+       {
+               uint32_t m_clearAddr;   //!< Address to start filling from.
+               uint32_t m_clearValue;  //!< Value to fill with.
+               uint32_t m_numBytesToClear;     //!< Number of bytes to fill.
+       };
+
+#pragma pack()
+
+protected:
+       StELFFile * m_elf;      //!< The parser object for our ELF file.
+       bool m_hasInfo;         //!< Whether .secinfo is present in the ELF file.
+       smart_array_ptr<ghs_secinfo_t> m_info;  //!< Pointer to the .secinfo entries. Will be NULL if there is no .secinfo section in the file.
+       unsigned m_entryCount;  //!< Number of entries in #m_info.
+};
+
+}; // namespace elftosb
+
+#endif // _GHSSecInfo_h_
diff --git a/tools/elftosb/common/GlobMatcher.cpp b/tools/elftosb/common/GlobMatcher.cpp
new file mode 100644 (file)
index 0000000..24e7b91
--- /dev/null
@@ -0,0 +1,129 @@
+/*
+ * File:       GlobMatcher.cpp
+ *
+ * Copyright (c) Freescale Semiconductor, Inc. All rights reserved.
+ * See included license file for license details.
+ */
+
+#include "GlobMatcher.h"
+
+#ifndef NEGATE
+#define NEGATE '^'                     // std cset negation char
+#endif
+
+using namespace elftosb;
+
+//! The glob pattern must match the \e entire test value argument in order
+//! for the match to be considered successful. Thus, even if, for example,
+//! the pattern matches all but the last character the result will be false.
+//!
+//! \retval true The test value does match the glob pattern.
+//! \retval false The test value does not match the glob pattern.
+bool GlobMatcher::match(const std::string & testValue)
+{
+       return globMatch(testValue.c_str(), m_pattern.c_str());
+}
+
+//! \note This glob implementation was originally written by ozan s. yigit in
+//!            December 1994. This is public domain source code.
+bool GlobMatcher::globMatch(const char *str, const char *p)
+{
+       int negate;
+       int match;
+       int c;
+
+       while (*p) {
+               if (!*str && *p != '*')
+                       return false;
+
+               switch (c = *p++) {
+
+               case '*':
+                       while (*p == '*')
+                               p++;
+
+                       if (!*p)
+                               return true;
+
+                       if (*p != '?' && *p != '[' && *p != '\\')
+                               while (*str && *p != *str)
+                                       str++;
+
+                       while (*str) {
+                               if (globMatch(str, p))
+                                       return true;
+                               str++;
+                       }
+                       return false;
+
+               case '?':
+                       if (*str)
+                               break;
+                       return false;
+               
+               // set specification is inclusive, that is [a-z] is a, z and
+               // everything in between. this means [z-a] may be interpreted
+               // as a set that contains z, a and nothing in between.
+               case '[':
+                       if (*p != NEGATE)
+                               negate = false;
+                       else {
+                               negate = true;
+                               p++;
+                       }
+
+                       match = false;
+
+                       while (!match && (c = *p++)) {
+                               if (!*p)
+                                       return false;
+                               if (*p == '-') {        // c-c
+                                       if (!*++p)
+                                               return false;
+                                       if (*p != ']') {
+                                               if (*str == c || *str == *p ||
+                                                   (*str > c && *str < *p))
+                                                       match = true;
+                                       }
+                                       else {          // c-]
+                                               if (*str >= c)
+                                                       match = true;
+                                               break;
+                                       }
+                               }
+                               else {                  // cc or c]
+                                       if (c == *str)
+                                               match = true;
+                                       if (*p != ']') {
+                                               if (*p == *str)
+                                                       match = true;
+                                       }
+                                       else
+                                               break;
+                               }
+                       }
+
+                       if (negate == match)
+                               return false;
+                       // if there is a match, skip past the cset and continue on
+                       while (*p && *p != ']')
+                               p++;
+                       if (!*p++)      // oops!
+                               return false;
+                       break;
+
+               case '\\':
+                       if (*p)
+                               c = *p++;
+               default:
+                       if (c != *str)
+                               return false;
+                       break;
+
+               }
+               str++;
+       }
+
+       return !*str;
+}
+
diff --git a/tools/elftosb/common/GlobMatcher.h b/tools/elftosb/common/GlobMatcher.h
new file mode 100644 (file)
index 0000000..c9e5641
--- /dev/null
@@ -0,0 +1,59 @@
+/*
+ * File:       GlobMatcher.h
+ *
+ * Copyright (c) Freescale Semiconductor, Inc. All rights reserved.
+ * See included license file for license details.
+ */
+#if !defined(_GlobMatcher_h_)
+#define _GlobMatcher_h_
+
+#include "StringMatcher.h"
+
+namespace elftosb
+{
+
+/*!
+ * \brief This class uses glob pattern matching to match strings.
+ *
+ * Glob patterns:
+ *     - *     matches zero or more characters
+ *     - ?     matches any single character
+ *     - [set] matches any character in the set
+ *     - [^set]        matches any character NOT in the set
+ *             where a set is a group of characters or ranges. a range
+ *             is written as two characters seperated with a hyphen: a-z denotes
+ *             all characters between a to z inclusive.
+ *     - [-set]        set matches a literal hypen and any character in the set
+ *     - []set]        matches a literal close bracket and any character in the set
+ *
+ *     - char  matches itself except where char is '*' or '?' or '['
+ *     - \\char        matches char, including any pattern character
+ *
+ * Examples:
+ *     - a*c           ac abc abbc ...
+ *     - a?c           acc abc aXc ...
+ *     - a[a-z]c               aac abc acc ...
+ *     - a[-a-z]c      a-c aac abc ...
+ */
+class GlobMatcher : public StringMatcher
+{
+public:
+       //! \brief Constructor.
+       GlobMatcher(const std::string & pattern)
+       :       StringMatcher(), m_pattern(pattern)
+       {
+       }
+       
+       //! \brief Returns whether \a testValue matches the glob pattern.
+       virtual bool match(const std::string & testValue);
+       
+protected:
+       std::string m_pattern;  //!< The glob pattern to match against.
+       
+       //! \brief Glob implementation.
+       bool globMatch(const char * str, const char * p);
+};
+
+}; // namespace elftosb
+
+#endif // _GlobMatcher_h_
diff --git a/tools/elftosb/common/HexValues.cpp b/tools/elftosb/common/HexValues.cpp
new file mode 100644 (file)
index 0000000..5eb2e39
--- /dev/null
@@ -0,0 +1,34 @@
+/*
+ * File:       HexValues.cpp
+ *
+ * Copyright (c) Freescale Semiconductor, Inc. All rights reserved.
+ * See included license file for license details.
+ */
+
+#include "HexValues.h"
+
+bool isHexDigit(char c)
+{
+       return isdigit(c) || (c >= 'a' && c <= 'f') || (c >= 'A' && c <= 'F');
+}
+
+//! \return The integer equivalent to \a c.
+//! \retval -1 The character \a c is not a hex character.
+uint8_t hexCharToInt(char c)
+{
+       if (c >= '0' && c <= '9')
+               return c - '0';
+       else if (c >= 'a' && c <= 'f')
+               return c - 'a' + 10;
+       else if (c >= 'A' && c <= 'F')
+               return c - 'A' + 10;
+       else
+               return static_cast<uint8_t>(-1);
+}
+
+//! \param encodedByte Must point to at least two ASCII hex characters.
+//!
+uint8_t hexByteToInt(const char * encodedByte)
+{
+       return (hexCharToInt(encodedByte[0]) << 4) | hexCharToInt(encodedByte[1]);
+}
diff --git a/tools/elftosb/common/HexValues.h b/tools/elftosb/common/HexValues.h
new file mode 100644 (file)
index 0000000..b6dd821
--- /dev/null
@@ -0,0 +1,21 @@
+/*
+ * File:       HexValues.h
+ *
+ * Copyright (c) Freescale Semiconductor, Inc. All rights reserved.
+ * See included license file for license details.
+ */
+#if !defined(_HexValues_h_)
+#define _HexValues_h_
+
+#include "stdafx.h"
+
+//! \brief Determines whether \a c is a hex digit character.
+bool isHexDigit(char c);
+
+//! \brief Converts a hexidecimal character to the integer equivalent.
+uint8_t hexCharToInt(char c);
+
+//! \brief Converts a hex-encoded byte to the integer equivalent.
+uint8_t hexByteToInt(const char * encodedByte);
+
+#endif // _HexValues_h_
diff --git a/tools/elftosb/common/IVTDataSource.cpp b/tools/elftosb/common/IVTDataSource.cpp
new file mode 100644 (file)
index 0000000..88c4753
--- /dev/null
@@ -0,0 +1,113 @@
+/*
+ * File:       DataSource.h
+ *
+ * Copyright (c) Freescale Semiconductor, Inc. All rights reserved.
+ *
+ * Freescale Semiconductor, Inc.
+ * Proprietary & Confidential
+ *
+ * This source code and the algorithms implemented therein constitute
+ * confidential information and may comprise trade secrets of Freescale Semiconductor, Inc.
+ * or its associates, and any use thereof is subject to the terms and
+ * conditions of the Confidential Disclosure Agreement pursual to which this
+ * source code was originally received.
+ */
+
+#include "IVTDataSource.h"
+#include "DataTarget.h"
+#include "EndianUtilities.h"
+#include <algorithm>
+#include <stdlib.h>
+#include <string.h>
+
+using namespace elftosb;
+
+IVTDataSource::IVTDataSource()
+:   DataSource(),
+    DataSource::Segment((DataSource&)*this),
+    m_isSelfSet(false)
+{
+    // Init the IVT structure.
+    memset(&m_ivt, 0, sizeof(m_ivt));
+    hab_hdr_t hdr = IVT_HDR(sizeof(m_ivt), HAB_VERSION);
+    m_ivt.hdr = hdr;
+}
+
+unsigned IVTDataSource::getData(unsigned offset, unsigned maxBytes, uint8_t * buffer)
+{
+    // Bail if the offset is out of range.
+    if (offset >= sizeof(m_ivt))
+    {
+        return 0;
+    }
+    
+    // If we have an associated target, and the IVT self pointer is not set, then
+    // fill in the self pointer from the target address.
+    if (m_target && !m_isSelfSet)
+    {
+        m_ivt.self = ENDIAN_HOST_TO_LITTLE_U32(m_target->getBeginAddress());
+    }
+    
+    // Truncate max bytes at the end of the IVT.
+    maxBytes = std::min<unsigned>(maxBytes, sizeof(m_ivt) - offset);
+    
+    // Copy into output buffer.
+    if (maxBytes)
+    {
+        memcpy(buffer, (uint8_t *)&m_ivt + offset, maxBytes);
+    }
+    
+    return maxBytes;
+}
+
+unsigned IVTDataSource::getLength()
+{
+    return sizeof(m_ivt);
+}
+
+//! The IVT has a natural location if its self pointer was explicitly specified.
+//!
+bool IVTDataSource::hasNaturalLocation()
+{
+    return m_isSelfSet;
+}
+
+//!
+uint32_t IVTDataSource::getBaseAddress()
+{
+    return m_ivt.self;
+}
+
+bool IVTDataSource::setFieldByName(const std::string & name, uint32_t value)
+{
+    if (name == "entry")
+    {
+        m_ivt.entry = ENDIAN_HOST_TO_LITTLE_U32(value);
+    }
+    else if (name == "dcd")
+    {
+        m_ivt.dcd = ENDIAN_HOST_TO_LITTLE_U32(value);
+    }
+    else if (name == "boot_data")
+    {
+        m_ivt.boot_data = ENDIAN_HOST_TO_LITTLE_U32(value);
+    }
+    else if (name == "self")
+    {
+        m_ivt.self = ENDIAN_HOST_TO_LITTLE_U32(value);
+        m_isSelfSet = true;
+    }
+    else if (name == "csf")
+    {
+        m_ivt.csf = ENDIAN_HOST_TO_LITTLE_U32(value);
+    }
+    else
+    {
+        // Unrecognized field name.
+        return false;
+    }
+    
+    return true;
+}
+
+
diff --git a/tools/elftosb/common/IVTDataSource.h b/tools/elftosb/common/IVTDataSource.h
new file mode 100644 (file)
index 0000000..1890bdd
--- /dev/null
@@ -0,0 +1,296 @@
+/*
+ * File:       DataSource.h
+ *
+ * Copyright (c) Freescale Semiconductor, Inc. All rights reserved.
+ *
+ * Freescale Semiconductor, Inc.
+ * Proprietary & Confidential
+ *
+ * This source code and the algorithms implemented therein constitute
+ * confidential information and may comprise trade secrets of Freescale Semiconductor, Inc.
+ * or its associates, and any use thereof is subject to the terms and
+ * conditions of the Confidential Disclosure Agreement pursual to which this
+ * source code was originally received.
+ */
+#if !defined(_IVTDataSource_h_)
+#define _IVTDataSource_h_
+
+#include "DataSource.h"
+
+/** Header field components
+ * @ingroup hdr
+ */
+typedef struct hab_hdr {
+    uint8_t tag;              /**< Tag field */
+    uint8_t len[2];           /**< Length field in bytes (big-endian) */
+    uint8_t par;              /**< Parameters field */
+} hab_hdr_t;
+
+/** Image entry function prototype
+ *  @ingroup rvt
+ *
+ * This typedef serves as the return type for hab_rvt.authenticate_image().  It
+ * specifies a void-void function pointer, but can be cast to another function
+ * pointer type if required.
+ */
+typedef void (*hab_image_entry_f)(void);
+
+/** @ref ivt structure
+ * @ingroup ivt
+ *
+ * @par Format
+ *
+ * An @ref ivt consists of a @ref hdr followed by a list of addresses as
+ * described further below.
+ *
+ * @warning The @a entry address may not be NULL.
+ *
+ * @warning On an IC not configured as #HAB_CFG_CLOSED, the
+ * @a csf address may be NULL.  If it is not NULL, the @ref csf will be
+ * processed, but any failures should be non-fatal.
+ *
+ * @warning On an IC configured as #HAB_CFG_CLOSED, the @a
+ * csf address may not be NULL, and @ref csf failures are typically fatal.
+ *
+ * @remark The Boot Data located using the @a boot_data field is interpreted
+ * by the HAB caller in a boot-mode specific manner.  This may be used by the
+ * boot ROM as to determine the load address and boot device configuration for
+ * images loaded from block devices (see @ref ref_rug for details).
+ *
+ * @remark All addresses given in the IVT, including the Boot Data (if
+ * present) are those for the final load location. 
+ *
+ * @anchor ila
+ *
+ * @par Initial load addresses
+ *
+ * The @a self field is used to calculate addresses in boot modes where an
+ * initial portion of the image is loaded to an initial location.  In such
+ * cases, the IVT, Boot Data (if present) and DCD (if present) are used in
+ * configuring the IC and loading the full image to its final location.  Only
+ * the IVT, Boot Data (if present) and DCD (if present) are required to be
+ * within the initial image portion.
+ *
+ * The method for calculating an initial load address for the DCD is
+ * illustrated in the following C fragment.  Similar calculations apply to
+ * other fields.
+ *
+@verbatim
+        hab_ivt_t* ivt_initial = <initial IVT load address>;
+        const void* dcd_initial = ivt_initial->dcd;
+        if (ivt_initial->dcd != NULL)
+            dcd_initial = (const uint8_t*)ivt_initial 
+                          + (ivt_initial->dcd - ivt_initial->self)
+@endverbatim
+
+ * \note The void* types in this structure have been changed to uint32_t so
+ *      that this code will work correctly when compiled on a 64-bit host.
+ *      Otherwise the structure would come out incorrect.
+ */
+struct hab_ivt {
+    /** @ref hdr with tag #HAB_TAG_IVT, length and HAB version fields
+     *  (see @ref data)
+     */
+    hab_hdr_t hdr;
+    /** Absolute address of the first instruction to execute from the
+     *  image
+     */
+    /*hab_image_entry_f*/ uint32_t entry;
+    /** Reserved in this version of HAB: should be NULL. */
+    /*const void*/ uint32_t reserved1;
+    /** Absolute address of the image DCD: may be NULL. */
+    /*const void*/ uint32_t dcd;
+    /** Absolute address of the Boot Data: may be NULL, but not interpreted
+     *  any further by HAB
+     */
+    /*const void*/ uint32_t boot_data;
+    /** Absolute address of the IVT.*/
+    /*const void*/ uint32_t self;
+    /** Absolute address of the image CSF.*/
+    /*const void*/ uint32_t csf;
+    /** Reserved in this version of HAB: should be zero. */
+    uint32_t reserved2;
+};
+
+/** @ref ivt type
+ * @ingroup ivt
+ */
+typedef struct hab_ivt hab_ivt_t;
+
+/*
+ *    Helper macros
+ */
+#define HAB_CMD_UNS     0xff
+
+#define DEFAULT_IMG_KEY_IDX     2
+
+#define GEN_MASK(width)                         \
+    ((1UL << (width)) - 1)
+
+#define GEN_FIELD(f, width, shift)              \
+    (((f) & GEN_MASK(width)) << (shift))
+
+#define PACK_UINT32(a, b, c, d)                 \
+    ( (((a) & 0xFF) << 24)                      \
+      |(((b) & 0xFF) << 16)                     \
+      |(((c) & 0xFF) << 8)                      \
+      |(((d) & 0xFF)) )
+
+#define EXPAND_UINT32(w)                                                \
+    (uint8_t)((w)>>24), (uint8_t)((w)>>16), (uint8_t)((w)>>8), (uint8_t)(w)
+
+#define HDR(tag, bytes, par)                                            \
+    (uint8_t)(tag), (uint8_t)((bytes)>>8), (uint8_t)(bytes), (uint8_t)(par)
+
+#define HAB_VER(maj, min)                                       \
+    (GEN_FIELD((maj), HAB_VER_MAJ_WIDTH, HAB_VER_MAJ_SHIFT)     \
+     | GEN_FIELD((min), HAB_VER_MIN_WIDTH, HAB_VER_MIN_SHIFT))
+
+/*
+ *    CSF header
+ */
+
+#define CSF_HDR(bytes, HABVER)                  \
+    HDR(HAB_TAG_CSF, (bytes), HABVER)
+    
+    
+/*
+ *    DCD  header
+ */
+
+#define DCD_HDR(bytes, HABVER)                  \
+    HDR(HAB_TAG_DCD, (bytes), HABVER)
+
+/*
+ *   IVT  header (goes in the struct's hab_hdr_t field, not a byte array)
+ */
+#define IVT_HDR(bytes, HABVER)                  \
+    {HAB_TAG_IVT, {(uint8_t)((bytes)>>8), (uint8_t)(bytes)}, HABVER}
+
+/** @name External data structure tags
+ * @anchor dat_tag
+ *
+ * Tag values 0x00 .. 0xef are reserved for HAB.  Values 0xf0 .. 0xff
+ * are available for custom use.
+ */
+/*@{*/
+#define HAB_TAG_IVT  0xd1       /**< Image Vector Table */
+#define HAB_TAG_DCD  0xd2       /**< Device Configuration Data */
+#define HAB_TAG_CSF  0xd4       /**< Command Sequence File */
+#define HAB_TAG_CRT  0xd7       /**< Certificate */
+#define HAB_TAG_SIG  0xd8       /**< Signature */
+#define HAB_TAG_EVT  0xdb       /**< Event */
+#define HAB_TAG_RVT  0xdd       /**< ROM Vector Table */
+/* Values b0 ... cf reserved for CSF commands.  Values e0 ... ef reserved for
+ * key types.
+ *
+ * Available values: 03, 05, 06, 09, 0a, 0c, 0f, 11, 12, 14, 17, 18, 1b, 1d,
+ * 1e, 21, 22, 24, 27, 28, 2b, 2d, 2e, 30, 33, 35, 36, 39, 3a, 3c, 3f, 41, 42,
+ * 44, 47, 48, 4b, 4d, 4e, 50, 53, 55, 56, 59, 5a, 5c, 5f, 60, 63, 65, 66, 69,
+ * 6a, 6c, 6f, 71, 72, 74, 77, 78, 7b, 7d, 7e, 81, 82, 84, 87, 88, 8b, 8d, 8e,
+ * 90, 93, 95, 96, 99, 9a, 9c, 9f, a0, a3, a5, a6, a9, aa, ac, af, b1, b2, b4,
+ * b7, b8, bb, bd, be
+ *
+ * Custom values: f0, f3, f5, f6, f9, fa, fc, ff
+ */
+/*@}*/
+
+/** @name HAB version */
+/*@{*/
+#define HAB_MAJOR_VERSION  4    /**< Major version of this HAB release */
+#define HAB_MINOR_VERSION  0    /**< Minor version of this HAB release */
+#define HAB_VER_MAJ_WIDTH 4     /**< Major version field width  */
+#define HAB_VER_MAJ_SHIFT 4     /**< Major version field offset  */
+#define HAB_VER_MIN_WIDTH 4     /**< Minor version field width  */
+#define HAB_VER_MIN_SHIFT 0     /**< Minor version field offset  */
+/** Full version of this HAB release @hideinitializer */
+#define HAB_VERSION HAB_VER(HAB_MAJOR_VERSION, HAB_MINOR_VERSION) 
+/** Base version for this HAB release @hideinitializer */
+#define HAB_BASE_VERSION HAB_VER(HAB_MAJOR_VERSION, 0) 
+
+/*@}*/
+
+namespace elftosb {
+
+/*!
+ * \brief Data source for an IVT structure used by HAB4.
+ *
+ * This data source represents an IVT structure used by HAB4. Fields of the IVT can be set
+ * by name, making it easy to interface with a parser. And it has some intelligence regarding
+ * the IVT's self pointer. Before the data is copied out by the getData() method, the self field
+ * will be filled in automatically if it has not already been set and there is an associated
+ * data target object. This lets the IVT pick up its own address from the location where it is
+ * being loaded. Alternatively, if the self pointer is filled in explicitly, then the data
+ * source will have a natural location equal to the self pointer.
+ *
+ * This data source acts as its own segment.
+ */
+class IVTDataSource : public DataSource, public DataSource::Segment
+{
+public:
+    //! \brief Default constructor.
+    IVTDataSource();
+    
+       //! \brief There is only one segment.
+       virtual unsigned getSegmentCount() { return 1; }
+       
+       //! \brief Returns this object, as it is its own segment.
+       virtual DataSource::Segment * getSegmentAt(unsigned index) { return this; }
+
+    //! \name Segment methods
+    //@{
+    
+    //! \brief Copy out some or all of the IVT structure.
+    //!
+    virtual unsigned getData(unsigned offset, unsigned maxBytes, uint8_t * buffer);
+    
+    //! \brief Gets the length of the segment's data.
+    virtual unsigned getLength();
+    
+    //! \brief Returns whether the segment has an associated address.
+    virtual bool hasNaturalLocation();
+    
+    //! \brief Returns the address associated with the segment.
+    virtual uint32_t getBaseAddress();
+    
+    //@}
+    
+    //! \name IVT access
+    //@{
+    
+    //! \brief Set one of the IVT's fields by providing its name.
+    //!
+    //! Acceptable field names are:
+    //! - entry
+    //! - dcd
+    //! - boot_data
+    //! - self
+    //! - csf
+    //!
+    //! As long as the \a name parameter specifies one of these fields, the return value
+    //! will be true. If \a name contains any other value, then false will be returned and
+    //! the IVT left unmodified.
+    //!
+    //! Once the \a self field has been set to any value, the data source will have a
+    //! natural location. This works even if the \a self address is 0.
+    //!
+    //! \param name The name of the field to set. Field names are case sensitive, just like in
+    //!     the C language.
+    //! \param value The value to which the field will be set.
+    //! \retval true The field was set successfully.
+    //! \retval false There is no field with the provided name.
+    bool setFieldByName(const std::string & name, uint32_t value);
+    
+    //! \brief Returns a reference to the IVT structure.
+    hab_ivt_t & getIVT() { return m_ivt; }
+    
+    //@}
+
+protected:
+    hab_ivt_t m_ivt;  //!< The IVT structure.
+    bool m_isSelfSet; //!< True if the IVT self pointer was explicitly set.
+};
+
+} // elftosb
+
+#endif // _IVTDataSource_h_
diff --git a/tools/elftosb/common/Logging.cpp b/tools/elftosb/common/Logging.cpp
new file mode 100644 (file)
index 0000000..f6d3906
--- /dev/null
@@ -0,0 +1,91 @@
+/*
+ * File:       Logging.cpp
+ *
+ * Copyright (c) Freescale Semiconductor, Inc. All rights reserved.
+ * See included license file for license details.
+ */
+
+#include "Logging.h"
+#include <stdarg.h>
+#include <stdio.h>
+#include "smart_ptr.h"
+
+// init global logger to null
+Logger * Log::s_logger = NULL;
+
+void Logger::log(const char * fmt, ...)
+{
+       va_list args;
+       va_start(args, fmt);
+       log(m_level, fmt, args);
+       va_end(args);
+}
+
+void Logger::log(log_level_t level, const char * fmt, ...)
+{
+       va_list args;
+       va_start(args, fmt);
+       log(level, fmt, args);
+       va_end(args);
+}
+
+void Logger::log(const char * fmt, va_list args)
+{
+       log(m_level, fmt, args);
+}
+
+//! Allocates a temporary 1KB buffer which is used to hold the
+//! formatted string.
+void Logger::log(log_level_t level, const char * fmt, va_list args)
+{
+       smart_array_ptr<char> buffer = new char[1024];
+       vsprintf(buffer, fmt, args);
+       if (level <= m_filter)
+       {
+               _log(buffer);
+       }
+}
+
+void Log::log(const char * fmt, ...)
+{
+       if (s_logger)
+       {
+               va_list args;
+               va_start(args, fmt);
+               s_logger->log(fmt, args);
+               va_end(args);
+       }
+}
+
+void Log::log(const std::string & msg)
+{
+       if (s_logger)
+       {
+               s_logger->log(msg);
+       }
+}
+
+void Log::log(Logger::log_level_t level, const char * fmt, ...)
+{
+       if (s_logger)
+       {
+               va_list args;
+               va_start(args, fmt);
+               s_logger->log(level, fmt, args);
+               va_end(args);
+       }
+}
+
+void Log::log(Logger::log_level_t level, const std::string & msg)
+{
+       if (s_logger)
+       {
+               s_logger->log(level, msg);
+       }
+}
+
+void StdoutLogger::_log(const char * msg)
+{
+       printf(msg);
+}
+
diff --git a/tools/elftosb/common/Logging.h b/tools/elftosb/common/Logging.h
new file mode 100644 (file)
index 0000000..a8e7bed
--- /dev/null
@@ -0,0 +1,226 @@
+/*
+ * File:       Logging.h
+ *
+ * Copyright (c) Freescale Semiconductor, Inc. All rights reserved.
+ * See included license file for license details.
+ */
+#if !defined(_Logging_h_)
+#define _Logging_h_
+
+#include <string>
+#include <assert.h>
+#include <stdarg.h>
+
+/*!
+ * \brief Base logger class.
+ *
+ * There are two types of logging levels that are used by this class. First
+ * there is the filter level. Any log message that is assigned a level
+ * higher than the current filter level is discarded. Secondly there is the
+ * current output level. Log messages that do not have their own level
+ * use the current output level to determine if they should be shown or
+ * not.
+ *
+ * The two methods setFilterLevel() and setOutputLevel() set the filter
+ * and default output logging levels, respectively. There are corresponding
+ * getter methods as well. Both the filter and output levels are
+ * initialized to #INFO during object construction.
+ *
+ * Most use of the logger classes is expected to be through the Log
+ * class. It provides static logging methods that call through to a global
+ * singleton logger instance. There is also a Log::SetOutputLevel utility
+ * class that makes it extremely easiy to temporarily change the default
+ * output logging level.
+ *
+ * Of all the overloaded log() methods in this class, none of them are
+ * really expected to be reimplemented by subclasses. Instead, there is
+ * the single protected _log() method that takes a simple string pointer.
+ * The other log methods all wind up calling _log(), so it provides a
+ * single point to override. In fact, _log() is pure virtual, so subclasses
+ * must implement it.
+ *
+ * \see Log
+ */
+class Logger
+{
+public:
+       //! \brief Logging levels.
+       enum log_level_t
+       {
+               URGENT = 0,     //!< The lowest level, for messages that must always be logged.
+               ERROR,          //!< For fatal error messages.
+               WARNING,        //!< For non-fatal warning messages.
+               INFO,           //!< The normal log level, for status messages.
+               INFO2,          //!< For verbose status messages.
+               DEBUG,          //!< For internal reporting.
+               DEBUG2          //!< Highest log level; verbose debug logging.
+       };
+       
+public:
+       //! \brief Default constructor.
+       Logger() : m_filter(INFO), m_level(INFO) {}
+       
+       //! \brief Destructor.
+       virtual ~Logger() {}
+       
+       //! \name Logging levels
+       //@{
+       //! \brief Changes the logging level to \a level.
+       inline void setFilterLevel(log_level_t level) { m_filter = level; }
+       
+       //! \brief Returns the current logging filter level.
+       inline log_level_t getFilterLevel() const { return m_filter; }
+       
+       //! \brief Changes the logging output level to \a level.
+       inline void setOutputLevel(log_level_t level) { m_level = level; }
+       
+       //! \brief Returns the current logging output level.
+       inline log_level_t getOutputLevel() const { return m_level; }
+       //@}
+       
+       //! \name Logging
+       //@{
+       //! \brief Log with format.
+       virtual void log(const char * fmt, ...);
+       
+       //! \brief Log a string object.
+       virtual void log(const std::string & msg) { log(msg.c_str()); }
+       
+       //! \brief Log with format at a specific output level.
+       virtual void log(log_level_t level, const char * fmt, ...);
+       
+       //! \brief Log a string output at a specific output level.
+       virtual void log(log_level_t level, const std::string & msg) { log(level, msg.c_str()); }
+       
+       //! \brief Log with format using an argument list.
+       virtual void log(const char * fmt, va_list args);
+       
+       //! \brief Log with format using an argument with a specific output level.
+       virtual void log(log_level_t level, const char * fmt, va_list args);
+       //@}
+               
+protected:
+       log_level_t m_filter;   //!< The current logging filter level.
+       log_level_t m_level;    //!< The current log output level.
+       
+protected:
+       //! \brief The base pure virtual logging function implemented by subclasses.
+       virtual void _log(const char * msg)=0;
+};
+
+/*!
+ * \brief Wraps a set of static functions for easy global logging access.
+ *
+ * This class has a set of static methods that make it easy to access a global
+ * logger instance without having to worry about extern symbols. It does this
+ * by keeping a static member variable pointing at the singleton logger instance,
+ * which is set with the setLogger() static method.
+ *
+ * There is also an inner utility class called SetOutputLevel that uses
+ * C++ scoping rules to temporarily change the output logging level. When the
+ * SetOutputLevel instance falls out of scope the output level is restored
+ * to the previous value.
+ */
+class Log
+{
+public:
+       //! \name Singleton logger access
+       //@{
+       //! \brief Returns the current global logger singleton.
+       static inline Logger * getLogger() { return s_logger; }
+       
+       //! \brief Sets the global logger singleton instance.
+       static inline void setLogger(Logger * logger) { s_logger = logger; }
+       //@}
+       
+       //! \name Logging
+       //@{
+       //! \brief Log with format.
+       static void log(const char * fmt, ...);
+       
+       //! \brief Log a string object.
+       static void log(const std::string & msg);
+       
+       //! \brief Log with format at a specific output level.
+       static void log(Logger::log_level_t level, const char * fmt, ...);
+       
+       //! \brief Log a string output at a specific output level.
+       static void log(Logger::log_level_t level, const std::string & msg);
+       //@}
+       
+protected:
+       static Logger * s_logger;       //!< The single global logger instance.
+       
+public:
+       /*!
+        * \brief Utility class to temporarily change the logging output level.
+        *
+        * This class will change the current logging output level of a given
+        * logger instance. Then when it falls out of scope it will set the
+        * level back to what it was originally.
+        *
+        * Use like this:
+        * \code
+        *              // output level is some value here
+        *              {
+        *                      Log::SetOutputLevel leveler(Logger::DEBUG);
+        *                      // now output level is DEBUG
+        *                      Log::log("my debug message 1");
+        *                      Log::log("my debug message 2");
+        *              }
+        *              // output level is restored to previous value
+        * \endcode
+        */
+       class SetOutputLevel
+       {
+       public:
+               //! \brief Default constructor.
+               //!
+               //! Saves the current logging output level of the global logger,
+               //! as managed by the Log class, and sets the new level to \a level.
+               SetOutputLevel(Logger::log_level_t level)
+               :       m_logger(Log::getLogger()), m_saved(Logger::INFO)
+               {
+                       assert(m_logger);
+                       m_saved = m_logger->getOutputLevel();
+                       m_logger->setOutputLevel(level);
+               }
+               
+               //! \brief Constructor.
+               //!
+               //! Saves the current logging output level of \a logger and sets
+               //! the new level to \a level.
+               SetOutputLevel(Logger * logger, Logger::log_level_t level)
+               :       m_logger(logger), m_saved(logger->getOutputLevel())
+               {
+                       assert(m_logger);
+                       m_logger->setOutputLevel(level);
+               }
+               
+               //! \brief Destructor.
+               //!
+               //! Restores the saved logging output level.
+               ~SetOutputLevel()
+               {
+                       m_logger->setOutputLevel(m_saved);
+               }
+               
+       protected:
+               Logger * m_logger;      //!< The logger instance we're controlling.
+               Logger::log_level_t m_saved;    //!< Original logging output level.
+       };
+
+};
+
+
+/*!
+ * \brief Simple logger that writes to stdout.
+ */
+class StdoutLogger : public Logger
+{
+protected:
+       //! \brief Logs the message to stdout.
+       virtual void _log(const char * msg);
+};
+
+#endif // _Logging_h_
diff --git a/tools/elftosb/common/Operation.cpp b/tools/elftosb/common/Operation.cpp
new file mode 100644 (file)
index 0000000..79fd6d4
--- /dev/null
@@ -0,0 +1,63 @@
+/*
+ * File:       Operation.cpp
+ *
+ * Copyright (c) Freescale Semiconductor, Inc. All rights reserved.
+ * See included license file for license details.
+ */
+
+#include "Operation.h"
+
+using namespace elftosb;
+
+//! The operation object takes ownership of \a source.
+//!
+//! Cross references between the target and source are updated.
+void LoadOperation::setSource(DataSource * source)
+{
+       m_source = source;
+       
+       if (m_target)
+       {
+               m_target->setSource(m_source);
+       }
+       if (m_source)
+       {
+               m_source->setTarget(m_target);
+       }
+}
+
+//! The operation object takes ownership of \a target.
+//!
+//! Cross references between the target and source are updated.
+void LoadOperation::setTarget(DataTarget * target)
+{
+       m_target = target;
+       
+       if (m_target)
+       {
+               m_target->setSource(m_source);
+       }
+       if (m_source)
+       {
+               m_source->setTarget(m_target);
+       }
+}
+
+//! Disposes of operations objects in the sequence.
+OperationSequence::~OperationSequence()
+{
+//     iterator_t it = begin();
+//     for (; it != end(); ++it)
+//     {
+//             delete it->second;
+//     }
+}
+
+void OperationSequence::append(const OperationSequence * other)
+{
+       const_iterator_t it = other->begin();
+       for (; it != other->end(); ++it)
+       {
+               m_operations.push_back(*it);
+       }
+}
diff --git a/tools/elftosb/common/Operation.h b/tools/elftosb/common/Operation.h
new file mode 100644 (file)
index 0000000..2b184e3
--- /dev/null
@@ -0,0 +1,168 @@
+/*
+ * File:       Operation.h
+ *
+ * Copyright (c) Freescale Semiconductor, Inc. All rights reserved.
+ * See included license file for license details.
+ */
+#if !defined(_Operation_h_)
+#define _Operation_h_
+
+#include "stdafx.h"
+#include <vector>
+#include "DataSource.h"
+#include "DataTarget.h"
+#include "smart_ptr.h"
+
+namespace elftosb
+{
+
+/*!
+ * \brief Abstract base class for all boot operations.
+ */
+class Operation
+{
+public:
+       Operation() {}
+       virtual ~Operation() {}
+};
+
+/*!
+ * \brief Load data into memory operation.
+ */
+class LoadOperation : public Operation
+{
+public:
+       LoadOperation() : Operation(), m_source(), m_target() {}
+       
+       void setSource(DataSource * source);
+       inline DataSource * getSource() { return m_source; }
+       
+       void setTarget(DataTarget * target);
+       inline DataTarget * getTarget() { return m_target; }
+       
+       inline void setDCDLoad(bool isDCD) { m_isDCDLoad = isDCD; }
+       inline bool isDCDLoad() const { return m_isDCDLoad; }
+       
+protected:
+       smart_ptr<DataSource> m_source;
+       smart_ptr<DataTarget> m_target;
+       bool m_isDCDLoad;
+};
+
+/*!
+ * \brief Operation to execute code at a certain address.
+ */
+class ExecuteOperation : public Operation
+{
+public:
+       enum execute_type_t
+       {
+               kJump,
+               kCall
+       };
+       
+public:
+       ExecuteOperation() : Operation(), m_target(), m_argument(0), m_type(kCall), m_isHAB(false) {}
+
+       inline void setTarget(DataTarget * target) { m_target = target; }
+       inline DataTarget * getTarget() { return m_target; }
+       
+       inline void setArgument(uint32_t arg) { m_argument = arg; }
+       inline uint32_t getArgument() { return m_argument; }
+       
+       inline void setExecuteType(execute_type_t type) { m_type = type; }
+       inline execute_type_t getExecuteType() { return m_type; }
+       
+       inline void setIsHAB(bool isHAB) { m_isHAB = isHAB; }
+       inline bool isHAB() const { return m_isHAB; }
+       
+protected:
+       smart_ptr<DataTarget> m_target;
+       uint32_t m_argument;
+       execute_type_t m_type;
+       bool m_isHAB;
+};
+
+/*!
+ * \brief Authenticate with HAB and execute the entry point.
+ */
+class HABExecuteOperation : public ExecuteOperation
+{
+public:
+       HABExecuteOperation() : ExecuteOperation() {}
+};
+
+/*!
+ * \brief Operation to switch boot modes.
+ */
+class BootModeOperation : public Operation
+{
+public:
+       BootModeOperation() : Operation() {}
+       
+       inline void setBootMode(uint32_t mode) { m_bootMode = mode; }
+       inline uint32_t getBootMode() const { return m_bootMode; }
+
+protected:
+       uint32_t m_bootMode;    //!< The new boot mode value.
+};
+
+/*!
+ * \brief Ordered sequence of operations.
+ *
+ * The operation objects owned by the sequence are \e not deleted when the
+ * sequence is destroyed. The owner of the sequence must manually delete
+ * the operation objects.
+ */
+class OperationSequence
+{
+public:
+       typedef std::vector<Operation*> operation_list_t;       //!< Type for a list of operation objects.
+       typedef operation_list_t::iterator iterator_t;  //!< Iterator over operations.
+       typedef operation_list_t::const_iterator const_iterator_t;      //!< Const iterator over operations.
+
+public:
+       //! \brief Default constructor.
+       OperationSequence() {}
+       
+       //! \brief Constructor. Makes a one-element sequence from \a soleElement.
+       OperationSequence(Operation * soleElement) { m_operations.push_back(soleElement); }
+       
+       //! \brief Destructor.
+       virtual ~OperationSequence();
+       
+       //! \name Iterators
+       //@{
+       inline iterator_t begin() { return m_operations.begin(); }
+       inline const_iterator_t begin() const { return m_operations.begin(); }
+       inline iterator_t end() { return m_operations.end(); }
+       inline const_iterator_t end() const { return m_operations.end(); }
+       //@}
+       
+       inline Operation * operator [] (unsigned index) const { return m_operations[index]; }
+       
+       //! \name Status
+       //@{
+       //! \brief Returns the number of operations in the sequence.
+       inline unsigned getCount() const { return m_operations.size(); }
+       //@}
+       
+       //! \name Operations
+       //@{
+       //! \brief Append one operation object to the sequence.
+       inline void append(Operation * op) { m_operations.push_back(op); }
+       
+       //! \brief Append the contents of \a other onto this sequence.
+       void append(const OperationSequence * other);
+       
+       //! \brief Appends \a other onto this sequence.
+       OperationSequence & operator += (const OperationSequence * other) { append(other); return *this; }
+       //@}
+
+protected:
+       operation_list_t m_operations;  //!< The list of operations.
+};
+
+}; // namespace elftosb
+
+#endif // _Operation_h_
diff --git a/tools/elftosb/common/OptionContext.h b/tools/elftosb/common/OptionContext.h
new file mode 100644 (file)
index 0000000..d005164
--- /dev/null
@@ -0,0 +1,50 @@
+/*
+ * File:       OptionContext.h
+ *
+ * Copyright (c) Freescale Semiconductor, Inc. All rights reserved.
+ * See included license file for license details.
+ */
+#if !defined(_OptionContext_h_)
+#define _OptionContext_h_
+
+#include <string>
+#include "Value.h"
+
+namespace elftosb
+{
+
+/*!
+ * \brief Pure abstract interface class to a table of options.
+ */
+class OptionContext
+{
+public:        
+       //! \brief Detemine whether the named option is present in the table.
+       //! \param name The name of the option to query.
+       //! \retval true The option is present and has a value.
+       //! \retval false No option with that name is in the table.
+       virtual bool hasOption(const std::string & name) const=0;
+       
+       //! \brief Returns the option's value.
+       //! \param name The name of the option.
+       //! \return The value for the option named \a name.
+       //! \retval NULL No option is in the table with that name.
+       virtual const Value * getOption(const std::string & name) const=0;
+       
+       //! \brief Adds or changes an option's value.
+       //!
+       //! If the option was not already present in the table, it is added.
+       //! Otherwise the old value is replaced.
+       //!
+       //! \param name The option's name.
+       //! \param value New value for the option.
+       virtual void setOption(const std::string & name, Value * value)=0;
+       
+       //! \brief Removes an option from the table.
+       //! \param name The name of the option to remove.
+       virtual void deleteOption(const std::string & name)=0;
+};
+
+}; // namespace elftosb
+
+#endif // _OptionContext_h_
diff --git a/tools/elftosb/common/OptionDictionary.cpp b/tools/elftosb/common/OptionDictionary.cpp
new file mode 100644 (file)
index 0000000..a9acec7
--- /dev/null
@@ -0,0 +1,170 @@
+/*
+ * File:       OptionDictionary.h
+ *
+ * Copyright (c) Freescale Semiconductor, Inc. All rights reserved.
+ * See included license file for license details.
+ */
+
+#include "OptionDictionary.h"
+
+using namespace elftosb;
+
+//! Deletes all of the option values that have been assigned locally.
+//!
+OptionDictionary::~OptionDictionary()
+{
+       option_map_t::iterator it = m_options.begin();
+       for (; it != m_options.end(); ++it)
+       {
+               if (it->second.m_value)
+               {
+                       delete it->second.m_value;
+               }
+       }
+}
+
+//! If a parent context has been set and the option does not exist in
+//! this instance, then the parent is asked if it contains the option.
+//!
+//! \param name The name of the option to query.
+//! \retval true The option is present in this instance or one of the parent.
+//! \retval false No option with that name is in the dictionary, or any parent
+bool OptionDictionary::hasOption(const std::string & name) const
+{
+       bool hasIt = (m_options.find(name) != m_options.end());
+       if (!hasIt && m_parent)
+       {
+               return m_parent->hasOption(name);
+       }
+       return hasIt;
+}
+
+//! If this object does not contain an option with the name of \a name,
+//! then the parent is asked for the value (if a parent has been set).
+//!
+//! \param name The name of the option.
+//! \return The value for the option named \a name.
+//! \retval NULL No option is in the table with that name. An option may also
+//!            explicitly be set to a NULL value. The only way to tell the difference
+//!            is to use the hasOption() method.
+const Value * OptionDictionary::getOption(const std::string & name) const
+{
+       option_map_t::const_iterator it = m_options.find(name);
+       if (it == m_options.end())
+       {
+               if (m_parent)
+               {
+                       return m_parent->getOption(name);
+               }
+               else
+               {
+                       return NULL;
+               }
+       }
+       
+       return it->second.m_value;
+}
+
+//! If the option was not already present in the table, it is added.
+//! Otherwise the old value is replaced. The option is always set locally;
+//! parent objects are never modified.
+//!
+//! If the option has been locked with a call to lockOption() before trying
+//! to set its value, the setOption() is effectively ignored. To tell if
+//! an option is locked, use the isOptionLocked() method.
+//!
+//! \warning If the option already had a value, that previous value is deleted.
+//!            This means that it cannot currently be in use by another piece of code.
+//!            See the note in getOption().
+//!
+//! \param name The option's name.
+//! \param value New value for the option.
+void OptionDictionary::setOption(const std::string & name, Value * value)
+{
+       option_map_t::iterator it = m_options.find(name);
+       OptionValue newValue;
+
+       // delete the option value instance before replacing it
+       if (it != m_options.end())
+       {
+               // Cannot modify value if locked.
+               if (it->second.m_isLocked)
+               {
+                       return;
+               }
+
+               if (it->second.m_value)
+               {
+                       delete it->second.m_value;
+               }
+
+               // save previous locked value
+               newValue.m_isLocked = it->second.m_isLocked;
+       }
+       
+       // set new option value
+       newValue.m_value = value;
+       m_options[name] = newValue;
+}
+
+//! \param name The name of the option to remove.
+//!
+void OptionDictionary::deleteOption(const std::string & name)
+{
+       if (m_options.find(name) != m_options.end())
+       {
+               if (m_options[name].m_value)
+               {
+                       delete m_options[name].m_value;
+               }
+               m_options.erase(name);
+       }
+}
+
+//! \param name Name of the option to query.
+//!
+//! \return True if the option is locked, false if unlocked or not present.
+//!
+bool OptionDictionary::isOptionLocked(const std::string & name) const
+{
+       option_map_t::const_iterator it = m_options.find(name);
+       if (it != m_options.end())
+       {
+               return it->second.m_isLocked;
+       }
+
+       return false;
+}
+
+//! \param name Name of the option to lock.
+//!
+void OptionDictionary::lockOption(const std::string & name)
+{
+       if (!hasOption(name))
+       {
+               m_options[name].m_value = 0;
+       }
+
+       m_options[name].m_isLocked = true;
+}
+
+//! \param name Name of the option to unlock.
+//!
+void OptionDictionary::unlockOption(const std::string & name)
+{
+       if (!hasOption(name))
+       {
+               m_options[name].m_value = 0;
+       }
+
+       m_options[name].m_isLocked = false;
+}
+
+
+//! Simply calls getOption().
+//!
+const Value * OptionDictionary::operator [] (const std::string & name) const
+{
+       return getOption(name);
+}
+
diff --git a/tools/elftosb/common/OptionDictionary.h b/tools/elftosb/common/OptionDictionary.h
new file mode 100644 (file)
index 0000000..275bd01
--- /dev/null
@@ -0,0 +1,107 @@
+/*
+ * File:       OptionDictionary.h
+ *
+ * Copyright (c) Freescale Semiconductor, Inc. All rights reserved.
+ * See included license file for license details.
+ */
+#if !defined(_OptionDictionary_h_)
+#define _OptionDictionary_h_
+
+#include "OptionContext.h"
+#include <map>
+
+namespace elftosb
+{
+
+/*!
+ * \brief Concrete implementation of OptionContext.
+ *
+ * This context subclass supports having a parent context. If an option is not
+ * found in the receiving instance, the request is passed to the parent.
+ * The hasOption() and getOption() methods will ask up the parent chain
+ * if the requested option does not exist in the receiving instance.
+ * But the setOption() and deleteOption() methods only operate locally,
+ * on the instance on which they were called. This allows a caller to
+ * locally override an option value without affecting any of the parent
+ * contexts.
+ */
+class OptionDictionary : public OptionContext
+{
+public:
+       //! \brief Default constructor.
+       OptionDictionary() : m_parent(0) {}
+       
+       //! \brief Constructor taking a parent context.
+       OptionDictionary(OptionContext * parent) : m_parent(parent) {}
+       
+       //! \brief Destructor.
+       ~OptionDictionary();
+       
+       //! \name Parents
+       //@{
+       //! \brief Returns the current parent context.
+       //! \return The current parent context instance.
+       //! \retval NULL No parent has been set.
+       inline OptionContext * getParent() const { return m_parent; }
+       
+       //! \brief Change the parent context.
+       //! \param newParent The parent context object. May be NULL, in which case
+       //!             the object will no longer have a parent context.
+       inline void setParent(OptionContext * newParent) { m_parent = newParent; }
+       //@}
+       
+       //! \name Options
+       //@{
+       //! \brief Detemine whether the named option is present in the table.
+       virtual bool hasOption(const std::string & name) const;
+       
+       //! \brief Returns the option's value.
+       virtual const Value * getOption(const std::string & name) const;
+       
+       //! \brief Adds or changes an option's value.
+       virtual void setOption(const std::string & name, Value * value);
+       
+       //! \brief Removes an option from the table.
+       virtual void deleteOption(const std::string & name);
+       //@}
+
+       //! \name Locking
+       //@{
+       //! \brief Returns true if the specified option is locked from further changes.
+       bool isOptionLocked(const std::string & name) const;
+
+       //! \brief Prevent further modifications of an option's value.
+       void lockOption(const std::string & name);
+
+       //! \brief Allow an option to be changed.
+       void unlockOption(const std::string & name);
+       //@}
+       
+       //! \name Operators
+       //@{
+       //! \brief Indexing operator; returns the value for the option \a name.
+       const Value * operator [] (const std::string & name) const;
+       //@}
+       
+protected:
+       OptionContext * m_parent;       //!< Our parent context.
+
+       /*!
+        * \brief Information about one option's value.
+        */
+       struct OptionValue
+       {
+               Value * m_value;        //!< The object for this option's value.
+               bool m_isLocked;        //!< True if this value is locked from further changes.
+
+               //! \brief Constructor.
+               OptionValue() : m_value(0), m_isLocked(false) {}
+       };
+       
+       typedef std::map<std::string, OptionValue> option_map_t;        //!< Map from option name to value.
+       option_map_t m_options; //!< The option dictionary.
+};
+
+}; // namespace elftosb
+
+#endif // _OptionDictionary_h_
diff --git a/tools/elftosb/common/OutputSection.cpp b/tools/elftosb/common/OutputSection.cpp
new file mode 100644 (file)
index 0000000..a6cb622
--- /dev/null
@@ -0,0 +1,9 @@
+/*
+ * File:       OutputSection.cpp
+ *
+ * Copyright (c) Freescale Semiconductor, Inc. All rights reserved.
+ * See included license file for license details.
+ */
+
+#include "OutputSection.h"
+
diff --git a/tools/elftosb/common/OutputSection.h b/tools/elftosb/common/OutputSection.h
new file mode 100644 (file)
index 0000000..702a52b
--- /dev/null
@@ -0,0 +1,72 @@
+/*
+ * File:       OutputSection.h
+ *
+ * Copyright (c) Freescale Semiconductor, Inc. All rights reserved.
+ * See included license file for license details.
+ */
+#if !defined(_OutputSection_h_)
+#define _OutputSection_h_
+
+#include "Operation.h"
+#include "smart_ptr.h"
+#include "Blob.h"
+#include "OptionContext.h"
+
+namespace elftosb
+{
+
+/*!
+ * @brief Base class for data model of sections of the output file.
+ */
+class OutputSection
+{
+public:
+       OutputSection() : m_id(0), m_options(0) {}
+       OutputSection(uint32_t identifier) : m_id(identifier), m_options(0) {}
+       virtual ~OutputSection() {}
+       
+       void setIdentifier(uint32_t identifier) { m_id = identifier; }
+       uint32_t getIdentifier() const { return m_id; }
+       
+       //! \brief Set the option context.
+       //!
+       //! The output section object will assume ownership of the option context
+       //! and delete it when the section is deleted.
+       inline void setOptions(OptionContext * context) { m_options = context; }
+       
+       //! \brief Return the option context.
+       inline const OptionContext * getOptions() const { return m_options; }
+       
+protected:
+       uint32_t m_id;  //!< Unique identifier.
+       smart_ptr<OptionContext> m_options;     //!< Options associated with just this section.
+};
+
+/*!
+ * @brief A section of the output that contains boot operations.
+ */
+class OperationSequenceSection : public OutputSection
+{
+public:
+       OperationSequenceSection() : OutputSection() {}
+       OperationSequenceSection(uint32_t identifier) : OutputSection(identifier) {}
+       
+       OperationSequence & getSequence() { return m_sequence; }
+
+protected:
+       OperationSequence m_sequence;
+};
+
+/*!
+ * @brief A section of the output file that contains arbitrary binary data.
+ */
+class BinaryDataSection : public OutputSection, public Blob
+{
+public:
+       BinaryDataSection() : OutputSection(), Blob() {}
+       BinaryDataSection(uint32_t identifier) : OutputSection(identifier), Blob() {}
+};
+
+}; // namespace elftosb
+
+#endif // _OutputSection_h_
diff --git a/tools/elftosb/common/Random.cpp b/tools/elftosb/common/Random.cpp
new file mode 100644 (file)
index 0000000..e9785aa
--- /dev/null
@@ -0,0 +1,85 @@
+/*
+ * File:       Random.cpp
+ *
+ * Copyright (c) Freescale Semiconductor, Inc. All rights reserved.
+ * See included license file for license details.
+ */
+
+#include "Random.h"
+#include <stdexcept>
+
+#ifdef WIN32
+       #ifndef _WIN32_WINNT
+               #define _WIN32_WINNT 0x0400
+       #endif
+       #include <windows.h>
+       #include <wincrypt.h>
+#else  // WIN32
+       #include <errno.h>
+       #include <fcntl.h>
+       #include <unistd.h>
+#endif // WIN32
+
+
+
+#ifdef WIN32
+
+MicrosoftCryptoProvider::MicrosoftCryptoProvider()
+{
+       if(!CryptAcquireContext(&m_hProvider, 0, 0, PROV_RSA_FULL, CRYPT_VERIFYCONTEXT))
+       {
+               throw std::runtime_error("CryptAcquireContext");
+       }
+}
+
+MicrosoftCryptoProvider::~MicrosoftCryptoProvider()
+{
+       CryptReleaseContext(m_hProvider, 0);
+}
+
+#endif // WIN32
+
+RandomNumberGenerator::RandomNumberGenerator()
+{
+#ifndef WIN32
+       m_fd = open("/dev/urandom",O_RDONLY);
+       if (m_fd == -1)
+       {
+               throw std::runtime_error("open /dev/urandom");
+       }
+#endif // WIN32
+}
+
+RandomNumberGenerator::~RandomNumberGenerator()
+{
+#ifndef WIN32
+       close(m_fd);
+#endif // WIN32
+}
+
+uint8_t RandomNumberGenerator::generateByte()
+{
+       uint8_t result;
+       generateBlock(&result, 1);
+       return result;
+}
+
+void RandomNumberGenerator::generateBlock(uint8_t * output, unsigned count)
+{
+#ifdef WIN32
+#      ifdef WORKAROUND_MS_BUG_Q258000
+               static MicrosoftCryptoProvider m_provider;
+#      endif
+       if (!CryptGenRandom(m_provider.GetProviderHandle(), count, output))
+       {
+               throw std::runtime_error("CryptGenRandom");
+       }
+#else  // WIN32
+       if (read(m_fd, output, count) != count)
+       {
+               throw std::runtime_error("read /dev/urandom");
+       }
+#endif // WIN32
+}
+
+
diff --git a/tools/elftosb/common/Random.h b/tools/elftosb/common/Random.h
new file mode 100644 (file)
index 0000000..5aac6ab
--- /dev/null
@@ -0,0 +1,57 @@
+/*
+ * File:       Random.h
+ *
+ * Copyright (c) Freescale Semiconductor, Inc. All rights reserved.
+ * See included license file for license details.
+ */
+#if !defined(_Random_h_)
+#define _Random_h_
+
+#include "stdafx.h"
+
+#ifdef WIN32
+/*!
+ * This class is from the crypto++ library.
+ */
+class MicrosoftCryptoProvider
+{
+public:
+       MicrosoftCryptoProvider();
+       ~MicrosoftCryptoProvider();
+#if defined(_WIN64)
+       typedef unsigned __int64 ProviderHandle;        // type HCRYPTPROV, avoid #include <windows.h>
+#else
+       typedef unsigned long ProviderHandle;
+#endif
+       ProviderHandle GetProviderHandle() const {return m_hProvider;}
+private:
+       ProviderHandle m_hProvider;
+};
+
+#pragma comment(lib, "advapi32.lib")
+#endif // WIN32
+
+/*!
+ * Encapsulates the Windows CryptoAPI's CryptGenRandom or /dev/urandom on Unix systems.
+ */
+class RandomNumberGenerator
+{
+public:
+       RandomNumberGenerator();
+       ~RandomNumberGenerator();
+       
+       uint8_t generateByte();
+       void generateBlock(uint8_t * output, unsigned count);
+
+protected:
+#ifdef WIN32
+#      ifndef WORKAROUND_MS_BUG_Q258000
+               MicrosoftCryptoProvider m_provider;
+#      endif
+#else  // WIN32
+       int m_fd;
+#endif // WIN32
+};
+
+
+#endif // _Random_h_
diff --git a/tools/elftosb/common/RijndaelCBCMAC.cpp b/tools/elftosb/common/RijndaelCBCMAC.cpp
new file mode 100644 (file)
index 0000000..fad0339
--- /dev/null
@@ -0,0 +1,86 @@
+/*
+ * File:       RijndaelCBCMAC.cpp
+ *
+ * Copyright (c) Freescale Semiconductor, Inc. All rights reserved.
+ * See included license file for license details.
+ */
+
+#include "RijndaelCBCMAC.h"
+#include "rijndael.h"
+#include <assert.h>
+#include "Logging.h"
+
+void logHexArray(Logger::log_level_t level, const uint8_t * bytes, unsigned count);
+
+//! \param key The key to use as the CBC-MAC secret.
+//! \param iv Initialization vector. Defaults to zero if not provided.
+RijndaelCBCMAC::RijndaelCBCMAC(const AESKey<128> & key, const uint8_t * iv)
+:      m_key(key)
+{
+       if (iv)
+       {
+               memcpy(m_mac, iv, sizeof(m_mac));
+       }
+       else
+       {
+               memset(m_mac, 0, sizeof(m_mac));
+       }
+}
+
+//! \param data Pointer to data to process.
+//! \param length Number of bytes to process. Must be evenly divisible by #BLOCK_SIZE.
+void RijndaelCBCMAC::update(const uint8_t * data, unsigned length)
+{
+       assert(length % BLOCK_SIZE == 0);
+       unsigned blocks = length / BLOCK_SIZE;
+       while (blocks--)
+       {
+               updateOneBlock(data);
+               data += BLOCK_SIZE;
+       }
+}
+
+//! It appears that some forms of CBC-MAC encrypt the final output block again in
+//! order to protect against a plaintext attack. This method is a placeholder for
+//! such an operation, but it currently does nothing.
+void RijndaelCBCMAC::finalize()
+{
+}
+
+//! On entry the current value of m_mac becomes the initialization vector
+//! for the CBC encryption of this block. The output of the encryption then
+//! becomes the new MAC, which is stored in m_mac.
+void RijndaelCBCMAC::updateOneBlock(const uint8_t * data)
+{
+       Rijndael cipher;
+       cipher.init(Rijndael::CBC, Rijndael::Encrypt, m_key, Rijndael::Key16Bytes, m_mac);
+       cipher.blockEncrypt(data, BLOCK_SIZE * 8, m_mac);       // size is in bits
+       
+//     Log::log(Logger::DEBUG2, "CBC-MAC output block:\n");
+//     logHexArray(Logger::DEBUG2, (const uint8_t *)&m_mac, sizeof(m_mac));
+}
+
+/*!
+ * \brief Log an array of bytes as hex.
+ */
+void logHexArray(Logger::log_level_t level, const uint8_t * bytes, unsigned count)
+{
+       Log::SetOutputLevel leveler(level);
+//             Log::log("    ");
+       unsigned i;
+       for (i = 0; i < count; ++i, ++bytes)
+       {
+               if ((i % 16 == 0) && (i < count - 1))
+               {
+                       if (i != 0)
+                       {
+                               Log::log("\n");
+                       }
+                       Log::log("    0x%04x: ", i);
+               }
+               Log::log("%02x ", *bytes & 0xff);
+       }
+       
+       Log::log("\n");
+}
+
diff --git a/tools/elftosb/common/RijndaelCBCMAC.h b/tools/elftosb/common/RijndaelCBCMAC.h
new file mode 100644 (file)
index 0000000..97e1f47
--- /dev/null
@@ -0,0 +1,62 @@
+/*
+ * File:       RijndaelCBCMAC.h
+ *
+ * Copyright (c) Freescale Semiconductor, Inc. All rights reserved.
+ * See included license file for license details.
+ */
+#if !defined(_RijndaelCBCMAC_h_)
+#define _RijndaelCBCMAC_h_
+
+#include "AESKey.h"
+#include <string.h>
+
+/*!
+ * \brief Class to compute CBC-MAC using the AES/Rijndael cipher.
+ *
+ * Currently only supports 128-bit keys and block sizes.
+ */
+class RijndaelCBCMAC
+{
+public:
+       enum
+       {
+               BLOCK_SIZE = 16 //!< Number of bytes in one cipher block.
+       };
+       
+       //! The cipher block data type.
+       typedef uint8_t block_t[BLOCK_SIZE];
+       
+public:
+       //! \brief Default constructor.
+       //!
+       //! The key and IV are both set to zero.
+       RijndaelCBCMAC() {}
+       
+       //! \brief Constructor.
+       RijndaelCBCMAC(const AESKey<128> & key, const uint8_t * iv=0);
+       
+       //! \brief Process data.
+       void update(const uint8_t * data, unsigned length);
+       
+       //! \brief Signal that all data has been processed.
+       void finalize();
+       
+       //! \brief Returns a reference to the current MAC value.
+       const block_t & getMAC() const { return m_mac; }
+       
+       //! \brief Assignment operator.
+       RijndaelCBCMAC & operator = (const RijndaelCBCMAC & other)
+       {
+               m_key = other.m_key;
+               memcpy(m_mac, other.m_mac, sizeof(m_mac));
+               return *this;
+       }
+       
+protected:
+       AESKey<128> m_key;      //!< 128-bit key to use for the CBC-MAC.
+       block_t m_mac;  //!< Current message authentication code value.
+       
+       void updateOneBlock(const uint8_t * data);
+};
+
+#endif // _RijndaelCBCMAC_h_
diff --git a/tools/elftosb/common/SHA1.cpp b/tools/elftosb/common/SHA1.cpp
new file mode 100644 (file)
index 0000000..93b9a99
--- /dev/null
@@ -0,0 +1,274 @@
+/*
+       100% free public domain implementation of the SHA-1 algorithm
+       by Dominik Reichl <dominik.reichl@t-online.de>
+       Web: http://www.dominik-reichl.de/
+
+       Version 1.6 - 2005-02-07 (thanks to Howard Kapustein for patches)
+       - You can set the endianness in your files, no need to modify the
+         header file of the CSHA1 class any more
+       - Aligned data support
+       - Made support/compilation of the utility functions (ReportHash
+         and HashFile) optional (useful, if bytes count, for example in
+         embedded environments)
+
+       Version 1.5 - 2005-01-01
+       - 64-bit compiler compatibility added
+       - Made variable wiping optional (define SHA1_WIPE_VARIABLES)
+       - Removed unnecessary variable initializations
+       - ROL32 improvement for the Microsoft compiler (using _rotl)
+
+       ======== Test Vectors (from FIPS PUB 180-1) ========
+
+       SHA1("abc") =
+               A9993E36 4706816A BA3E2571 7850C26C 9CD0D89D
+
+       SHA1("abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq") =
+               84983E44 1C3BD26E BAAE4AA1 F95129E5 E54670F1
+
+       SHA1(A million repetitions of "a") =
+               34AA973C D4C4DAA4 F61EEB2B DBAD2731 6534016F
+*/
+
+#include "SHA1.h"
+
+#ifdef SHA1_UTILITY_FUNCTIONS
+#define SHA1_MAX_FILE_BUFFER 8000
+#endif
+
+// Rotate x bits to the left
+#ifndef ROL32
+#ifdef _MSC_VER
+#define ROL32(_val32, _nBits) _rotl(_val32, _nBits)
+#else
+#define ROL32(_val32, _nBits) (((_val32)<<(_nBits))|((_val32)>>(32-(_nBits))))
+#endif
+#endif
+
+#ifdef SHA1_LITTLE_ENDIAN
+#define SHABLK0(i) (m_block->l[i] = \
+       (ROL32(m_block->l[i],24) & 0xFF00FF00) | (ROL32(m_block->l[i],8) & 0x00FF00FF))
+#else
+#define SHABLK0(i) (m_block->l[i])
+#endif
+
+#define SHABLK(i) (m_block->l[i&15] = ROL32(m_block->l[(i+13)&15] ^ m_block->l[(i+8)&15] \
+       ^ m_block->l[(i+2)&15] ^ m_block->l[i&15],1))
+
+// SHA-1 rounds
+#define _R0(v,w,x,y,z,i) { z+=((w&(x^y))^y)+SHABLK0(i)+0x5A827999+ROL32(v,5); w=ROL32(w,30); }
+#define _R1(v,w,x,y,z,i) { z+=((w&(x^y))^y)+SHABLK(i)+0x5A827999+ROL32(v,5); w=ROL32(w,30); }
+#define _R2(v,w,x,y,z,i) { z+=(w^x^y)+SHABLK(i)+0x6ED9EBA1+ROL32(v,5); w=ROL32(w,30); }
+#define _R3(v,w,x,y,z,i) { z+=(((w|x)&y)|(w&x))+SHABLK(i)+0x8F1BBCDC+ROL32(v,5); w=ROL32(w,30); }
+#define _R4(v,w,x,y,z,i) { z+=(w^x^y)+SHABLK(i)+0xCA62C1D6+ROL32(v,5); w=ROL32(w,30); }
+
+CSHA1::CSHA1()
+{
+       m_block = (SHA1_WORKSPACE_BLOCK *)m_workspace;
+
+       Reset();
+}
+
+CSHA1::~CSHA1()
+{
+       Reset();
+}
+
+void CSHA1::Reset()
+{
+       // SHA1 initialization constants
+       m_state[0] = 0x67452301;
+       m_state[1] = 0xEFCDAB89;
+       m_state[2] = 0x98BADCFE;
+       m_state[3] = 0x10325476;
+       m_state[4] = 0xC3D2E1F0;
+
+       m_count[0] = 0;
+       m_count[1] = 0;
+}
+
+void CSHA1::Transform(uint32_t *state, const uint8_t *buffer)
+{
+       // Copy state[] to working vars
+       uint32_t a = state[0], b = state[1], c = state[2], d = state[3], e = state[4];
+
+       memcpy(m_block, buffer, 64);
+
+       // 4 rounds of 20 operations each. Loop unrolled.
+       _R0(a,b,c,d,e, 0); _R0(e,a,b,c,d, 1); _R0(d,e,a,b,c, 2); _R0(c,d,e,a,b, 3);
+       _R0(b,c,d,e,a, 4); _R0(a,b,c,d,e, 5); _R0(e,a,b,c,d, 6); _R0(d,e,a,b,c, 7);
+       _R0(c,d,e,a,b, 8); _R0(b,c,d,e,a, 9); _R0(a,b,c,d,e,10); _R0(e,a,b,c,d,11);
+       _R0(d,e,a,b,c,12); _R0(c,d,e,a,b,13); _R0(b,c,d,e,a,14); _R0(a,b,c,d,e,15);
+       _R1(e,a,b,c,d,16); _R1(d,e,a,b,c,17); _R1(c,d,e,a,b,18); _R1(b,c,d,e,a,19);
+       _R2(a,b,c,d,e,20); _R2(e,a,b,c,d,21); _R2(d,e,a,b,c,22); _R2(c,d,e,a,b,23);
+       _R2(b,c,d,e,a,24); _R2(a,b,c,d,e,25); _R2(e,a,b,c,d,26); _R2(d,e,a,b,c,27);
+       _R2(c,d,e,a,b,28); _R2(b,c,d,e,a,29); _R2(a,b,c,d,e,30); _R2(e,a,b,c,d,31);
+       _R2(d,e,a,b,c,32); _R2(c,d,e,a,b,33); _R2(b,c,d,e,a,34); _R2(a,b,c,d,e,35);
+       _R2(e,a,b,c,d,36); _R2(d,e,a,b,c,37); _R2(c,d,e,a,b,38); _R2(b,c,d,e,a,39);
+       _R3(a,b,c,d,e,40); _R3(e,a,b,c,d,41); _R3(d,e,a,b,c,42); _R3(c,d,e,a,b,43);
+       _R3(b,c,d,e,a,44); _R3(a,b,c,d,e,45); _R3(e,a,b,c,d,46); _R3(d,e,a,b,c,47);
+       _R3(c,d,e,a,b,48); _R3(b,c,d,e,a,49); _R3(a,b,c,d,e,50); _R3(e,a,b,c,d,51);
+       _R3(d,e,a,b,c,52); _R3(c,d,e,a,b,53); _R3(b,c,d,e,a,54); _R3(a,b,c,d,e,55);
+       _R3(e,a,b,c,d,56); _R3(d,e,a,b,c,57); _R3(c,d,e,a,b,58); _R3(b,c,d,e,a,59);
+       _R4(a,b,c,d,e,60); _R4(e,a,b,c,d,61); _R4(d,e,a,b,c,62); _R4(c,d,e,a,b,63);
+       _R4(b,c,d,e,a,64); _R4(a,b,c,d,e,65); _R4(e,a,b,c,d,66); _R4(d,e,a,b,c,67);
+       _R4(c,d,e,a,b,68); _R4(b,c,d,e,a,69); _R4(a,b,c,d,e,70); _R4(e,a,b,c,d,71);
+       _R4(d,e,a,b,c,72); _R4(c,d,e,a,b,73); _R4(b,c,d,e,a,74); _R4(a,b,c,d,e,75);
+       _R4(e,a,b,c,d,76); _R4(d,e,a,b,c,77); _R4(c,d,e,a,b,78); _R4(b,c,d,e,a,79);
+
+       // Add the working vars back into state
+       state[0] += a;
+       state[1] += b;
+       state[2] += c;
+       state[3] += d;
+       state[4] += e;
+
+       // Wipe variables
+#ifdef SHA1_WIPE_VARIABLES
+       a = b = c = d = e = 0;
+#endif
+}
+
+// Use this function to hash in binary data and strings
+void CSHA1::Update(const uint8_t *data, uint32_t len)
+{
+       uint32_t i, j;
+
+       j = (m_count[0] >> 3) & 63;
+
+       if((m_count[0] += len << 3) < (len << 3)) m_count[1]++;
+
+       m_count[1] += (len >> 29);
+
+       if((j + len) > 63)
+       {
+               i = 64 - j;
+               memcpy(&m_buffer[j], data, i);
+               Transform(m_state, m_buffer);
+
+               for( ; i + 63 < len; i += 64) Transform(m_state, &data[i]);
+
+               j = 0;
+       }
+       else i = 0;
+
+       memcpy(&m_buffer[j], &data[i], len - i);
+}
+
+#ifdef SHA1_UTILITY_FUNCTIONS
+// Hash in file contents
+bool CSHA1::HashFile(char *szFileName)
+{
+       unsigned long ulFileSize, ulRest, ulBlocks;
+       unsigned long i;
+       uint8_t uData[SHA1_MAX_FILE_BUFFER];
+       FILE *fIn;
+
+       if(szFileName == NULL) return false;
+
+       fIn = fopen(szFileName, "rb");
+       if(fIn == NULL) return false;
+
+       fseek(fIn, 0, SEEK_END);
+       ulFileSize = (unsigned long)ftell(fIn);
+       fseek(fIn, 0, SEEK_SET);
+
+       if(ulFileSize != 0)
+       {
+               ulBlocks = ulFileSize / SHA1_MAX_FILE_BUFFER;
+               ulRest = ulFileSize % SHA1_MAX_FILE_BUFFER;
+       }
+       else
+       {
+               ulBlocks = 0;
+               ulRest = 0;
+       }
+
+       for(i = 0; i < ulBlocks; i++)
+       {
+               fread(uData, 1, SHA1_MAX_FILE_BUFFER, fIn);
+               Update((uint8_t *)uData, SHA1_MAX_FILE_BUFFER);
+       }
+
+       if(ulRest != 0)
+       {
+               fread(uData, 1, ulRest, fIn);
+               Update((uint8_t *)uData, ulRest);
+       }
+
+       fclose(fIn); fIn = NULL;
+       return true;
+}
+#endif
+
+void CSHA1::Final()
+{
+       uint32_t i;
+       uint8_t finalcount[8];
+
+       for(i = 0; i < 8; i++)
+               finalcount[i] = (uint8_t)((m_count[((i >= 4) ? 0 : 1)]
+                       >> ((3 - (i & 3)) * 8) ) & 255); // Endian independent
+
+       Update((uint8_t *)"\200", 1);
+
+       while ((m_count[0] & 504) != 448)
+               Update((uint8_t *)"\0", 1);
+
+       Update(finalcount, 8); // Cause a SHA1Transform()
+
+       for(i = 0; i < 20; i++)
+       {
+               m_digest[i] = (uint8_t)((m_state[i >> 2] >> ((3 - (i & 3)) * 8) ) & 255);
+       }
+
+       // Wipe variables for security reasons
+#ifdef SHA1_WIPE_VARIABLES
+       i = 0;
+       memset(m_buffer, 0, 64);
+       memset(m_state, 0, 20);
+       memset(m_count, 0, 8);
+       memset(finalcount, 0, 8);
+       Transform(m_state, m_buffer);
+#endif
+}
+
+#ifdef SHA1_UTILITY_FUNCTIONS
+// Get the final hash as a pre-formatted string
+void CSHA1::ReportHash(char *szReport, unsigned char uReportType)
+{
+       unsigned char i;
+       char szTemp[16];
+
+       if(szReport == NULL) return;
+
+       if(uReportType == REPORT_HEX)
+       {
+               sprintf(szTemp, "%02X", m_digest[0]);
+               strcat(szReport, szTemp);
+
+               for(i = 1; i < 20; i++)
+               {
+                       sprintf(szTemp, " %02X", m_digest[i]);
+                       strcat(szReport, szTemp);
+               }
+       }
+       else if(uReportType == REPORT_DIGIT)
+       {
+               sprintf(szTemp, "%u", m_digest[0]);
+               strcat(szReport, szTemp);
+
+               for(i = 1; i < 20; i++)
+               {
+                       sprintf(szTemp, " %u", m_digest[i]);
+                       strcat(szReport, szTemp);
+               }
+       }
+       else strcpy(szReport, "Error: Unknown report type!");
+}
+#endif
+
+// Get the raw message digest
+void CSHA1::GetHash(uint8_t *puDest)
+{
+       memcpy(puDest, m_digest, 20);
+}
diff --git a/tools/elftosb/common/SHA1.h b/tools/elftosb/common/SHA1.h
new file mode 100644 (file)
index 0000000..114ece4
--- /dev/null
@@ -0,0 +1,149 @@
+/*
+       100% free public domain implementation of the SHA-1 algorithm
+       by Dominik Reichl <dominik.reichl@t-online.de>
+       Web: http://www.dominik-reichl.de/
+
+       Version 1.6 - 2005-02-07 (thanks to Howard Kapustein for patches)
+       - You can set the endianness in your files, no need to modify the
+         header file of the CSHA1 class any more
+       - Aligned data support
+       - Made support/compilation of the utility functions (ReportHash
+         and HashFile) optional (useful, if bytes count, for example in
+         embedded environments)
+
+       Version 1.5 - 2005-01-01
+       - 64-bit compiler compatibility added
+       - Made variable wiping optional (define SHA1_WIPE_VARIABLES)
+       - Removed unnecessary variable initializations
+       - ROL32 improvement for the Microsoft compiler (using _rotl)
+
+       ======== Test Vectors (from FIPS PUB 180-1) ========
+
+       SHA1("abc") =
+               A9993E36 4706816A BA3E2571 7850C26C 9CD0D89D
+
+       SHA1("abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq") =
+               84983E44 1C3BD26E BAAE4AA1 F95129E5 E54670F1
+
+       SHA1(A million repetitions of "a") =
+               34AA973C D4C4DAA4 F61EEB2B DBAD2731 6534016F
+*/
+
+#ifndef ___SHA1_HDR___
+#define ___SHA1_HDR___
+
+#if !defined(SHA1_UTILITY_FUNCTIONS) && !defined(SHA1_NO_UTILITY_FUNCTIONS)
+#define SHA1_UTILITY_FUNCTIONS
+#endif
+
+#include <memory.h> // Needed for memset and memcpy
+#include "stdafx.h"
+
+#ifdef SHA1_UTILITY_FUNCTIONS
+#include <stdio.h>  // Needed for file access and sprintf
+#include <string.h> // Needed for strcat and strcpy
+#endif
+
+#ifdef _MSC_VER
+#include <stdlib.h>
+#endif
+
+// You can define the endian mode in your files, without modifying the SHA1
+// source files. Just #define SHA1_LITTLE_ENDIAN or #define SHA1_BIG_ENDIAN
+// in your files, before including the SHA1.h header file. If you don't
+// define anything, the class defaults to little endian.
+
+#if !defined(SHA1_LITTLE_ENDIAN) && !defined(SHA1_BIG_ENDIAN)
+#define SHA1_LITTLE_ENDIAN
+#endif
+
+// Same here. If you want variable wiping, #define SHA1_WIPE_VARIABLES, if
+// not, #define SHA1_NO_WIPE_VARIABLES. If you don't define anything, it
+// defaults to wiping.
+
+#if !defined(SHA1_WIPE_VARIABLES) && !defined(SHA1_NO_WIPE_VARIABLES)
+#define SHA1_WIPE_VARIABLES
+#endif
+
+/////////////////////////////////////////////////////////////////////////////
+// Define 8- and 32-bit variables
+
+//#ifndef uint32_t
+//
+//#ifdef _MSC_VER
+//
+//#define uint8_t  unsigned __int8
+//#define uint32_t unsigned __int32
+//
+//#else
+//
+//#define uint8_t unsigned char
+//
+//#if (ULONG_MAX == 0xFFFFFFFF)
+//#define uint32_t unsigned long
+//#else
+//#define uint32_t unsigned int
+//#endif
+//
+//#endif
+//#endif
+
+/////////////////////////////////////////////////////////////////////////////
+// Declare SHA1 workspace
+
+typedef union
+{
+       uint8_t  c[64];
+       uint32_t l[16];
+} SHA1_WORKSPACE_BLOCK;
+
+class CSHA1
+{
+public:
+#ifdef SHA1_UTILITY_FUNCTIONS
+       // Two different formats for ReportHash(...)
+       enum
+       {
+               REPORT_HEX = 0,
+               REPORT_DIGIT = 1
+       };
+#endif
+
+       // Constructor and Destructor
+       CSHA1();
+       ~CSHA1();
+
+       uint32_t m_state[5];
+       uint32_t m_count[2];
+       uint32_t __reserved1[1];
+       uint8_t  m_buffer[64];
+       uint8_t  m_digest[20];
+       uint32_t __reserved2[3];
+
+       void Reset();
+
+       // Update the hash value
+       void Update(const uint8_t *data, uint32_t len);
+#ifdef SHA1_UTILITY_FUNCTIONS
+       bool HashFile(char *szFileName);
+#endif
+
+       // Finalize hash and report
+       void Final();
+
+       // Report functions: as pre-formatted and raw data
+#ifdef SHA1_UTILITY_FUNCTIONS
+       void ReportHash(char *szReport, unsigned char uReportType = REPORT_HEX);
+#endif
+       void GetHash(uint8_t *puDest);
+
+private:
+       // Private SHA-1 transformation
+       void Transform(uint32_t *state, const uint8_t *buffer);
+
+       // Member variables
+       uint8_t m_workspace[64];
+       SHA1_WORKSPACE_BLOCK *m_block; // SHA1 pointer to the byte array above
+};
+
+#endif
diff --git a/tools/elftosb/common/SRecordSourceFile.cpp b/tools/elftosb/common/SRecordSourceFile.cpp
new file mode 100644 (file)
index 0000000..3521c69
--- /dev/null
@@ -0,0 +1,176 @@
+/*
+ * File:       SRecordSourceFile.cpp
+ *
+ * Copyright (c) Freescale Semiconductor, Inc. All rights reserved.
+ * See included license file for license details.
+ */
+
+#include "SRecordSourceFile.h"
+#include "Logging.h"
+#include "smart_ptr.h"
+#include <assert.h>
+#include <string.h>
+enum
+{
+       //! Size in bytes of the buffer used to collect S-record data records
+       //! before adding them to the executable image. Currently 64KB.
+       COLLECTION_BUFFER_SIZE = 64 * 1024
+};
+
+using namespace elftosb;
+
+SRecordSourceFile::SRecordSourceFile(const std::string & path)
+:      SourceFile(path), m_image(0), m_hasEntryRecord(false)
+{
+}
+
+bool SRecordSourceFile::isSRecordFile(std::istream & stream)
+{
+       StSRecordFile srec(stream);
+       return srec.isSRecordFile();
+}
+
+void SRecordSourceFile::open()
+{
+       SourceFile::open();
+       
+       // create file parser and examine file
+       m_file = new StSRecordFile(*m_stream);
+       m_file->parse();
+       
+       // build an image of the file
+       m_image = new StExecutableImage();
+       buildMemoryImage();
+       
+       // dispose of file parser object
+       delete m_file;
+       m_file = 0;
+}
+
+void SRecordSourceFile::close()
+{
+       assert(m_image);
+       
+       SourceFile::close();
+       
+       // dispose of memory image
+       delete m_image;
+       m_image = 0;
+}
+
+//! \pre The file must be open before this method can be called.
+//!
+DataSource * SRecordSourceFile::createDataSource()
+{
+       assert(m_image);
+       return new MemoryImageDataSource(m_image);
+}
+
+//! \retval true The file has an S7, S8, or S9 record.
+//! \retval false No entry point is available.
+bool SRecordSourceFile::hasEntryPoint()
+{
+       return m_hasEntryRecord;
+}
+
+//! If no entry point is available then 0 is returned instead. The method scans
+//! the records in the file looking for S7, S8, or S9 records. Thus, 16-bit,
+//! 24-bit, and 32-bit entry point records are supported.
+//!
+//! \return Entry point address.
+//! \retval 0 No entry point is available.
+uint32_t SRecordSourceFile::getEntryPointAddress()
+{
+       if (m_hasEntryRecord)
+       {
+               // the address in the record is the entry point
+               Log::log(Logger::DEBUG2, "entry point address is 0x%08x\n", m_entryRecord.m_address);
+               return m_entryRecord.m_address;
+       }
+       
+       return 0;
+}
+
+//! Scans the S-records of the file looking for data records. These are S3, S2, or
+//! S1 records. The contents of these records are added to an StExecutableImage
+//! object, which coalesces the individual records into contiguous regions of
+//! memory.
+//!
+//! Also looks for S7, S8, or S9 records that contain the entry point. The first
+//! match of one of these records is saved off into the #m_entryRecord member.
+//! 
+//! \pre The #m_file member must be valid.
+//! \pre The #m_image member variable must have been instantiated.
+void SRecordSourceFile::buildMemoryImage()
+{
+       assert(m_file);
+       assert(m_image);
+       
+       // Clear the entry point related members.
+       m_hasEntryRecord = false;
+       memset(&m_entryRecord, 0, sizeof(m_entryRecord));
+       
+       // Allocate buffer to hold data before adding it to the executable image.
+       // Contiguous records are added to this buffer. When overflowed or when a
+       // non-contiguous record is encountered the buffer is added to the executable
+       // image where it will be coalesced further. We don't add records individually
+       // to the image because coalescing record by record is very slow.
+       smart_array_ptr<uint8_t> buffer = new uint8_t[COLLECTION_BUFFER_SIZE];
+       unsigned startAddress;
+       unsigned nextAddress;
+       unsigned dataLength = 0;
+       
+       // process SRecords
+    StSRecordFile::const_iterator it = m_file->getBegin();
+       for (; it != m_file->getEnd(); it++)
+       {
+        const StSRecordFile::SRecord & theRecord = *it;
+        
+        // only handle S3,2,1 records
+        bool isDataRecord = theRecord.m_type == 3 || theRecord.m_type == 2 || theRecord.m_type == 1;
+        bool hasData = theRecord.m_data && theRecord.m_dataCount;
+               if (isDataRecord && hasData)
+               {
+                       // If this record's data would overflow the collection buffer, or if the
+                       // record is not contiguous with the rest of the data in the collection
+                       // buffer, then flush the buffer to the executable image and restart.
+                       if (dataLength && ((dataLength + theRecord.m_dataCount > COLLECTION_BUFFER_SIZE) || (theRecord.m_address != nextAddress)))
+                       {
+                               m_image->addTextRegion(startAddress, buffer, dataLength);
+                               
+                               dataLength = 0;
+                       }
+                       
+                       // Capture addresses when starting an empty buffer.
+                       if (dataLength == 0)
+                       {
+                               startAddress = theRecord.m_address;
+                               nextAddress = startAddress;
+                       }
+                       
+                       // Copy record data into place in the collection buffer and update
+                       // size and address.
+                       memcpy(&buffer[dataLength], theRecord.m_data, theRecord.m_dataCount);
+                       dataLength += theRecord.m_dataCount;
+                       nextAddress += theRecord.m_dataCount;
+               }
+               else if (!m_hasEntryRecord)
+               {
+                       // look for S7,8,9 records
+                       bool isEntryPointRecord = theRecord.m_type == 7 || theRecord.m_type == 8 || theRecord.m_type == 9;
+                       if (isEntryPointRecord)
+                       {
+                               // save off the entry point record so we don't have to scan again
+                               memcpy(&m_entryRecord, &theRecord, sizeof(m_entryRecord));
+                               m_hasEntryRecord = true;
+                       }
+               }
+       }
+       
+       // Add any leftover data in the collection buffer to the executable image.
+       if (dataLength)
+       {
+               m_image->addTextRegion(startAddress, buffer, dataLength);
+       }
+}
+
diff --git a/tools/elftosb/common/SRecordSourceFile.h b/tools/elftosb/common/SRecordSourceFile.h
new file mode 100644 (file)
index 0000000..c0bc2a9
--- /dev/null
@@ -0,0 +1,83 @@
+/*
+ * File:       SRecordSourceFile.h
+ *
+ * Copyright (c) Freescale Semiconductor, Inc. All rights reserved.
+ * See included license file for license details.
+ */
+#if !defined(_SRecordSourceFile_h_)
+#define _SRecordSourceFile_h_
+
+#include "SourceFile.h"
+#include "StSRecordFile.h"
+#include "StExecutableImage.h"
+
+namespace elftosb
+{
+
+/*!
+ * \brief Executable file in the Motorola S-record format.
+ *
+ * Instead of presenting each S-record in the file separately, this class
+ * builds up a memory image of all of the records. Records next to each other
+ * in memory are coalesced into a single memory region. The data source that
+ * is returned from createDataSource() exposes these regions as its segments.
+ *
+ * Because the S-record format does not support the concepts, no support is
+ * provided for named sections or symbols.
+ */
+class SRecordSourceFile : public SourceFile
+{
+public:
+       //! \brief Default constructor.
+       SRecordSourceFile(const std::string & path);
+       
+       //! \brief Destructor.
+       virtual ~SRecordSourceFile() {}
+       
+       //! \brief Test whether the \a stream contains a valid S-record file.
+       static bool isSRecordFile(std::istream & stream);
+       
+       //! \name Opening and closing
+       //@{
+       //! \brief Opens the file.
+       virtual void open();
+       
+       //! \brief Closes the file.
+       virtual void close();
+       //@}
+       
+       //! \name Format capabilities
+       //@{
+       virtual bool supportsNamedSections() const { return false; }
+       virtual bool supportsNamedSymbols() const { return false; }
+       //@}
+       
+       //! \name Data sources
+       //@{
+       //! \brief Returns data source for the entire file.
+       virtual DataSource * createDataSource();
+       //@}
+       
+       //! \name Entry point
+       //@{
+       //! \brief Returns true if an entry point was set in the file.
+       virtual bool hasEntryPoint();
+       
+       //! \brief Returns the entry point address.
+       virtual uint32_t getEntryPointAddress();
+       //@}
+
+protected:
+       StSRecordFile * m_file; //!< S-record parser instance.
+       StExecutableImage * m_image;    //!< Memory image of the S-record file.
+       bool m_hasEntryRecord;  //!< Whether an S7,8,9 record was found.
+       StSRecordFile::SRecord m_entryRecord;   //!< Record for the entry point.
+       
+protected:
+       //! \brief Build memory image of the S-record file.
+       void buildMemoryImage();
+};
+
+}; // namespace elftosb
+
+#endif // _SRecordSourceFile_h_
diff --git a/tools/elftosb/common/SearchPath.cpp b/tools/elftosb/common/SearchPath.cpp
new file mode 100644 (file)
index 0000000..8a8a742
--- /dev/null
@@ -0,0 +1,121 @@
+/*
+ * File:       SearchPath.cpp
+ *
+ * Copyright (c) Freescale Semiconductor, Inc. All rights reserved.
+ * See included license file for license details.
+ */
+
+#include "SearchPath.h"
+#include <stdio.h>
+
+#if defined(WIN32)
+       #define PATH_SEP_CHAR '\\'
+       #define PATH_SEP_STRING "\\"
+#else
+       #define PATH_SEP_CHAR '/'
+       #define PATH_SEP_STRING "/"
+#endif
+
+PathSearcher * PathSearcher::s_searcher = NULL;
+
+//! This function will create the global path search object if it has
+//! not already been created.
+PathSearcher & PathSearcher::getGlobalSearcher()
+{
+       if (!s_searcher)
+       {
+               s_searcher = new PathSearcher;
+       }
+       
+       return *s_searcher;
+}
+
+void PathSearcher::addSearchPath(std::string & path)
+{
+       m_paths.push_back(path);
+}
+
+//! The \a base path argument can be either a relative or absolute path. If the path
+//! is relative, then it is joined with search paths one after another until a matching
+//! file is located or all search paths are exhausted. If the \a base is absolute,
+//! only that path is tested and if invalid false is returned.
+//!
+//! \param base A path to the file that is to be found.
+//! \param targetType Currently ignored. In the future it will let you select whether to
+//!            find a file or directory.
+//! \param searchCwd If set to true, the current working directory is searched before using
+//!            any of the search paths. Otherwise only the search paths are considered.
+//! \param[out] result When true is returned this string is set to the first path at which
+//!            a valid file was found.
+//!
+//! \retval true A matching file was found among the search paths. The contents of \a result
+//!            are a valid path.
+//! \retval false No match could be made. \a result has been left unmodified.
+bool PathSearcher::search(const std::string & base, target_type_t targetType, bool searchCwd, std::string & result)
+{
+       FILE * tempFile;
+       bool absolute = isAbsolute(base);
+       
+       // Try cwd first if requested. Same process applies to absolute paths.
+       if (absolute || searchCwd)
+       {
+               tempFile = fopen(base.c_str(), "r");
+               if (tempFile)
+               {
+                       fclose(tempFile);
+                       result = base;
+                       return true;
+               }
+       }
+       
+       // If the base path is absolute and the previous test failed, then we don't go any further.
+       if (absolute)
+       {
+               return false;
+       }
+       
+       // Iterate over all search paths.
+       string_list_t::const_iterator it = m_paths.begin();
+       for (; it != m_paths.end(); ++it)
+       {
+               std::string searchPath = joinPaths(*it, base);
+               
+               tempFile = fopen(searchPath.c_str(), "r");
+               if (tempFile)
+               {
+                       fclose(tempFile);
+                       result = searchPath;
+                       return true;
+               }
+       }
+       
+       // Couldn't find anything matching the base path.
+       return false;
+}
+
+bool PathSearcher::isAbsolute(const std::string & path)
+{
+#if __WIN32__
+       return path.size() >= 3 && path[1] == ':' && path[2] == '\\';
+#else
+       return path.size() >= 1 && path[0] == '/';
+#endif
+}
+
+std::string PathSearcher::joinPaths(const std::string & first, const std::string & second)
+{
+       // Start with first string.
+       std::string result = first;
+       
+       // Add path separator if needed
+       if ((first[first.size() - 1] != PATH_SEP_CHAR) && (second[0] != PATH_SEP_CHAR))
+       {
+               result += PATH_SEP_STRING;
+       }
+       
+       // Append the second string.
+       result += second;
+       
+       // And return the whole mess.
+       return result;
+}
diff --git a/tools/elftosb/common/SearchPath.h b/tools/elftosb/common/SearchPath.h
new file mode 100644 (file)
index 0000000..4ae6018
--- /dev/null
@@ -0,0 +1,58 @@
+/*
+ * File:       SearchPath.h
+ *
+ * Copyright (c) Freescale Semiconductor, Inc. All rights reserved.
+ * See included license file for license details.
+ */
+#if !defined(_searchpath_h_)
+#define _searchpath_h_
+
+#include <string>
+#include <list>
+
+/*!
+ * \brief Handles searching a list of paths for a file.
+ */
+class PathSearcher
+{
+public:
+       //!
+       enum _target_type
+       {
+               kFindFile,
+               kFindDirectory
+       };
+       
+       //!
+       typedef enum _target_type target_type_t;
+       
+protected:
+       //! Global search object singleton.
+       static PathSearcher * s_searcher;
+       
+public:
+       //! \brief Access global path searching object.
+       static PathSearcher & getGlobalSearcher();
+       
+public:
+       //! \brief Constructor.
+       PathSearcher() {}
+       
+       //! \brief Add a new search path to the end of the list.
+       void addSearchPath(std::string & path);
+       
+       //! \brief Attempts to locate a file by using the search paths.
+       bool search(const std::string & base, target_type_t targetType, bool searchCwd, std::string & result);
+
+protected:
+       typedef std::list<std::string> string_list_t;   //!< Linked list of strings.
+       string_list_t m_paths;  //!< Ordered list of paths to search.
+       
+       //! \brief Returns whether \a path is absolute.
+       bool isAbsolute(const std::string & path);
+       
+       //! \brief Combines two paths into a single one.
+       std::string joinPaths(const std::string & first, const std::string & second);
+};
+
+#endif // _searchpath_h_
diff --git a/tools/elftosb/common/SourceFile.cpp b/tools/elftosb/common/SourceFile.cpp
new file mode 100644 (file)
index 0000000..947ae17
--- /dev/null
@@ -0,0 +1,178 @@
+/*
+ * File:       SourceFile.cpp
+ *
+ * Copyright (c) Freescale Semiconductor, Inc. All rights reserved.
+ * See included license file for license details.
+ */
+
+#include "SourceFile.h"
+#include "ELFSourceFile.h"
+#include "SRecordSourceFile.h"
+#include <assert.h>
+#include "format_string.h"
+#include "SearchPath.h"
+
+using namespace elftosb;
+
+//! The supported file types are currently:
+//!            - ELF files
+//!            - Motorola S-record files
+//!            - Binary files
+//!
+//! Any file that is not picked up by the other subclasses will result in a
+//! an instance of BinaryDataFile.
+//!
+//! \return An instance of the correct subclass of SourceFile for the given path.
+//!
+//! \exception std::runtime_error Thrown if the file cannot be opened.
+//!
+//! \see elftosb::ELFSourceFile
+//! \see elftosb::SRecordSourceFile
+//! \see elftosb::BinarySourceFile
+SourceFile * SourceFile::openFile(const std::string & path)
+{
+       // Search for file using search paths
+       std::string actualPath;
+       bool found = PathSearcher::getGlobalSearcher().search(path, PathSearcher::kFindFile, true, actualPath);
+       if (!found)
+       {
+               throw std::runtime_error(format_string("unable to find file %s\n", path.c_str()));
+       }
+
+       std::ifstream testStream(actualPath.c_str(), std::ios_base::in | std::ios_base::binary);
+       if (!testStream.is_open())
+       {
+               throw std::runtime_error(format_string("failed to open file: %s", actualPath.c_str()));
+       }
+       
+       // catch exceptions so we can close the file stream
+       try
+       {
+               if (ELFSourceFile::isELFFile(testStream))
+               {
+                       testStream.close();
+                       return new ELFSourceFile(actualPath);
+               }
+               else if (SRecordSourceFile::isSRecordFile(testStream))
+               {
+                       testStream.close();
+                       return new SRecordSourceFile(actualPath);
+               }
+               
+               // treat it as a binary file
+               testStream.close();
+               return new BinarySourceFile(actualPath);
+       }
+       catch (...)
+       {
+               testStream.close();
+               throw;
+       }
+}
+
+SourceFile::SourceFile(const std::string & path)
+:      m_path(path), m_stream()
+{
+}
+
+//! The file is closed if it had been left opened.
+//!
+SourceFile::~SourceFile()
+{
+       if (isOpen())
+       {
+               m_stream->close();
+       }
+}
+
+//! \exception std::runtime_error Raised if the file could not be opened successfully.
+void SourceFile::open()
+{
+       assert(!isOpen());
+       m_stream = new std::ifstream(m_path.c_str(), std::ios_base::in | std::ios_base::binary);
+       if (!m_stream->is_open())
+       {
+               throw std::runtime_error(format_string("failed to open file: %s", m_path.c_str()));
+       }
+}
+
+void SourceFile::close()
+{
+       assert(isOpen());
+       
+       m_stream->close();
+       m_stream.safe_delete();
+}
+
+unsigned SourceFile::getSize()
+{
+       bool wasOpen = isOpen();
+       std::ifstream::pos_type oldPosition;
+       
+       if (!wasOpen)
+       {
+               open();
+       }
+       
+       assert(m_stream);
+       oldPosition = m_stream->tellg();
+       m_stream->seekg(0, std::ios_base::end);
+       unsigned resultSize = m_stream->tellg();
+       m_stream->seekg(oldPosition);
+       
+       if (!wasOpen)
+       {
+               close();
+       }
+       
+       return resultSize;
+}
+
+//! If the file does not support named sections, or if there is not a
+//! section with the given name, this method may return NULL.
+//!
+//! This method is just a small wrapper that creates an
+//! FixedMatcher string matcher instance and uses the createDataSource()
+//! that takes a reference to a StringMatcher.
+DataSource * SourceFile::createDataSource(const std::string & section)
+{
+       FixedMatcher matcher(section);
+       return createDataSource(matcher);
+}
+
+DataTarget * SourceFile::createDataTargetForEntryPoint()
+{
+       if (!hasEntryPoint())
+       {
+               return NULL;
+       }
+       
+       return new ConstantDataTarget(getEntryPointAddress());
+}
+
+DataSource * BinarySourceFile::createDataSource()
+{
+       std::istream * fileStream = getStream();
+       assert(fileStream);
+       
+       // get stream size
+       fileStream->seekg(0, std::ios_base::end);
+       int length = fileStream->tellg();
+       
+       // allocate buffer
+       smart_array_ptr<uint8_t> data = new uint8_t[length];
+//     if (!data)
+//     {
+//         throw std::bad_alloc();
+//     }
+       
+       // read entire file into the buffer
+       fileStream->seekg(0, std::ios_base::beg);
+       if (fileStream->read((char *)data.get(), length).bad())
+       {
+               throw std::runtime_error(format_string("unexpected end of file: %s", m_path.c_str()));
+       }
+       
+       // create the data source. the buffer is copied, so we can dispose of it.
+       return new UnmappedDataSource(data, length);
+}
diff --git a/tools/elftosb/common/SourceFile.h b/tools/elftosb/common/SourceFile.h
new file mode 100644 (file)
index 0000000..773dd5b
--- /dev/null
@@ -0,0 +1,156 @@
+/*
+ * File:       SourceFile.h
+ *
+ * Copyright (c) Freescale Semiconductor, Inc. All rights reserved.
+ * See included license file for license details.
+ */
+#if !defined(_SourceFile_h_)
+#define _SourceFile_h_
+
+#include <string>
+#include <iostream>
+#include <fstream>
+#include "smart_ptr.h"
+#include "DataSource.h"
+#include "DataTarget.h"
+#include "StringMatcher.h"
+#include "OptionContext.h"
+
+namespace elftosb
+{
+
+/*!
+ * \brief Abstract base class for a source file containing executable code.
+ *
+ * The purpose of this class cluster is to provide a common interface for
+ * accessing the contents of different file formats. This is accomplished
+ * through several small sets of methods along with the DataSource and
+ * DataTarget classes.
+ *
+ * The primary interface for creating instances of SourceFile is the static
+ * SourceFile::openFile() function. It will create the correct subclass of
+ * SourceFile by inspecting the file to determine its type.
+ */
+class SourceFile
+{
+public:
+       // \brief Factory function that creates the correct subclass of SourceFile.
+       static SourceFile * openFile(const std::string & path);
+       
+public:
+       //! \brief Default constructor.
+       SourceFile(const std::string & path);
+       
+       //! \brief Destructor.
+       virtual ~SourceFile();
+       
+       //! \brief Set the option context.
+       //!
+       //! The source file will take ownership of the @a context and delete it
+       //! when the source file is itself deleted.
+       inline void setOptions(OptionContext * context) { m_options = context; }
+       
+       //! \brief Return the option context.
+       inline const OptionContext * getOptions() const { return m_options; }
+       
+       //! \brief Returns the path to the file.
+       inline const std::string & getPath() const { return m_path; }
+       
+       //! \brief Get the size in bytes of the file.
+       unsigned getSize();
+       
+       //! \name Opening and closing
+       //@{
+       //! \brief Opens the file.
+       virtual void open();
+       
+       //! \brief Closes the file.
+       virtual void close();
+       
+       //! \brief Returns whether the file is already open.
+       virtual bool isOpen() const { return (bool)m_stream && const_cast<std::ifstream*>(m_stream.get())->is_open(); }
+       //@}
+       
+       //! \name Format capabilities
+       //@{
+       virtual bool supportsNamedSections() const=0;
+       virtual bool supportsNamedSymbols() const=0;
+       //@}
+       
+       //! \name Data source creation
+       //@{
+       //! \brief Creates a data source from the entire file.
+       virtual DataSource * createDataSource()=0;
+       
+       //! \brief Creates a data source out of one or more sections of the file.
+       //!
+       //! The \a selector object is used to perform the section name comparison.
+       //! If the file does not support named sections, or if there is not a
+       //! section with the given name, this method may return NULL.
+       virtual DataSource * createDataSource(StringMatcher & matcher) { return NULL; }
+       
+       //! \brief Creates a data source out of one section of the file.
+       virtual DataSource * createDataSource(const std::string & section);
+       //@}
+       
+       //! \name Entry point
+       //@{
+       //! \brief Returns true if an entry point was set in the file.
+       virtual bool hasEntryPoint()=0;
+       
+       //! \brief Returns the entry point address.
+       virtual uint32_t getEntryPointAddress() { return 0; }
+       //@}
+       
+       //! \name Data target creation
+       //@{
+       virtual DataTarget * createDataTargetForSection(const std::string & section) { return NULL; }
+       virtual DataTarget * createDataTargetForSymbol(const std::string & symbol) { return NULL; }
+       virtual DataTarget * createDataTargetForEntryPoint();
+       //@}
+       
+       //! \name Symbols
+       //@{
+       //! \brief Returns whether a symbol exists in the source file.
+       virtual bool hasSymbol(const std::string & name) { return false; }
+       
+       //! \brief Returns the value of a symbol.
+       virtual uint32_t getSymbolValue(const std::string & name) { return 0; }
+       
+       //! \brief Returns the size of a symbol.
+       virtual unsigned getSymbolSize(const std::string & name) { return 0; }
+       //@}
+       
+protected:
+       std::string m_path;     //!< Path to the file.
+       smart_ptr<std::ifstream> m_stream;      //!< File stream, or NULL if file is closed.
+       smart_ptr<OptionContext> m_options;     //!< Table of option values.
+       
+       //! \brief Internal access to the input stream object.
+       inline std::ifstream * getStream() { return m_stream; }
+};
+
+/*!
+ * \brief Binary data file.
+ */
+class BinarySourceFile : public SourceFile
+{
+public:
+       //! \brief Default constructor.
+       BinarySourceFile(const std::string & path) : SourceFile(path) {}
+       
+       //! \name Format capabilities
+       //@{
+       virtual bool supportsNamedSections() const { return false; }
+       virtual bool supportsNamedSymbols() const { return false; }
+       //@}
+       
+       //! \brief Creates an unmapped data source from the entire file.
+       virtual DataSource * createDataSource();
+       
+       virtual bool hasEntryPoint() { return false; }
+};
+
+}; // namespace elftosb
+
+#endif // _SourceFile_h_
diff --git a/tools/elftosb/common/StELFFile.cpp b/tools/elftosb/common/StELFFile.cpp
new file mode 100644 (file)
index 0000000..09124d5
--- /dev/null
@@ -0,0 +1,543 @@
+/*
+ * File:       StELFFile.cpp
+ *
+ * Copyright (c) Freescale Semiconductor, Inc. All rights reserved.
+ * See included license file for license details.
+ */
+
+#include "StELFFile.h"
+#include <ios>
+#include <stdexcept>
+#include <stdio.h>
+#include "EndianUtilities.h"
+
+//! \exception StELFFileException is thrown if there is a problem with the file format.
+//!
+StELFFile::StELFFile(std::istream & inStream)
+:      m_stream(inStream)
+{
+       readFileHeaders();
+}
+
+//! Disposes of the string table data.
+StELFFile::~StELFFile()
+{
+       SectionDataMap::iterator it = m_sectionDataCache.begin();
+       for (; it != m_sectionDataCache.end(); ++it)
+       {
+               SectionDataInfo & info = it->second;
+               if (info.m_data != NULL)
+               {
+                       delete [] info.m_data;
+               }
+       }
+}
+
+//! \exception StELFFileException is thrown if the file is not an ELF file.
+//!
+void StELFFile::readFileHeaders()
+{
+       // move read head to beginning of stream
+       m_stream.seekg(0, std::ios_base::beg);
+       
+       // read ELF header
+       m_stream.read(reinterpret_cast<char *>(&m_header), sizeof(m_header));
+       if (m_stream.bad())
+       {
+               throw StELFFileException("could not read file header");
+       }
+       
+       // convert endianness
+       m_header.e_type = ENDIAN_LITTLE_TO_HOST_U16(m_header.e_type);
+       m_header.e_machine = ENDIAN_LITTLE_TO_HOST_U16(m_header.e_machine);
+       m_header.e_version = ENDIAN_LITTLE_TO_HOST_U32(m_header.e_version);
+       m_header.e_entry = ENDIAN_LITTLE_TO_HOST_U32(m_header.e_entry);
+       m_header.e_phoff = ENDIAN_LITTLE_TO_HOST_U32(m_header.e_phoff);
+       m_header.e_shoff = ENDIAN_LITTLE_TO_HOST_U32(m_header.e_shoff);
+       m_header.e_flags = ENDIAN_LITTLE_TO_HOST_U32(m_header.e_flags);
+       m_header.e_ehsize = ENDIAN_LITTLE_TO_HOST_U16(m_header.e_ehsize);
+       m_header.e_phentsize = ENDIAN_LITTLE_TO_HOST_U16(m_header.e_phentsize);
+       m_header.e_phnum = ENDIAN_LITTLE_TO_HOST_U16(m_header.e_phnum);
+       m_header.e_shentsize = ENDIAN_LITTLE_TO_HOST_U16(m_header.e_shentsize);
+       m_header.e_shnum = ENDIAN_LITTLE_TO_HOST_U16(m_header.e_shnum);
+       m_header.e_shstrndx = ENDIAN_LITTLE_TO_HOST_U16(m_header.e_shstrndx);
+       
+       // check magic number
+       if (!(m_header.e_ident[EI_MAG0] == ELFMAG0 && m_header.e_ident[EI_MAG1] == ELFMAG1 && m_header.e_ident[EI_MAG2] == ELFMAG2 && m_header.e_ident[EI_MAG3] == ELFMAG3))
+       {
+               throw StELFFileException("invalid magic number in ELF header");
+       }
+       
+       try
+       {
+               int i;
+               
+               // read section headers
+               if (m_header.e_shoff != 0 && m_header.e_shnum > 0)
+               {
+                       Elf32_Shdr sectionHeader;
+                       for (i=0; i < m_header.e_shnum; ++i)
+                       {
+                               m_stream.seekg(m_header.e_shoff + m_header.e_shentsize * i, std::ios::beg);
+                               m_stream.read(reinterpret_cast<char *>(&sectionHeader), sizeof(sectionHeader));
+                               if (m_stream.bad())
+                               {
+                                       throw StELFFileException("could not read section header");
+                               }
+                               
+                               // convert endianness
+                               sectionHeader.sh_name = ENDIAN_LITTLE_TO_HOST_U32(sectionHeader.sh_name);
+                               sectionHeader.sh_type = ENDIAN_LITTLE_TO_HOST_U32(sectionHeader.sh_type);
+                               sectionHeader.sh_flags = ENDIAN_LITTLE_TO_HOST_U32(sectionHeader.sh_flags);
+                               sectionHeader.sh_addr = ENDIAN_LITTLE_TO_HOST_U32(sectionHeader.sh_addr);
+                               sectionHeader.sh_offset = ENDIAN_LITTLE_TO_HOST_U32(sectionHeader.sh_offset);
+                               sectionHeader.sh_size = ENDIAN_LITTLE_TO_HOST_U32(sectionHeader.sh_size);
+                               sectionHeader.sh_link = ENDIAN_LITTLE_TO_HOST_U32(sectionHeader.sh_link);
+                               sectionHeader.sh_info = ENDIAN_LITTLE_TO_HOST_U32(sectionHeader.sh_info);
+                               sectionHeader.sh_addralign = ENDIAN_LITTLE_TO_HOST_U32(sectionHeader.sh_addralign);
+                               sectionHeader.sh_entsize = ENDIAN_LITTLE_TO_HOST_U32(sectionHeader.sh_entsize);
+                               
+                               m_sectionHeaders.push_back(sectionHeader);
+                       }
+               }
+               
+               // read program headers
+               if (m_header.e_phoff != 0 && m_header.e_phnum > 0)
+               {
+                       Elf32_Phdr programHeader;
+                       for (i=0; i < m_header.e_phnum; ++i)
+                       {
+                               m_stream.seekg(m_header.e_phoff + m_header.e_phentsize * i, std::ios::beg);
+                               m_stream.read(reinterpret_cast<char *>(&programHeader), sizeof(programHeader));
+                               if (m_stream.bad())
+                               {
+                                       throw StELFFileException("could not read program header");
+                               }
+                               
+                               // convert endianness
+                               programHeader.p_type = ENDIAN_LITTLE_TO_HOST_U32(programHeader.p_type);
+                               programHeader.p_offset = ENDIAN_LITTLE_TO_HOST_U32(programHeader.p_type);
+                               programHeader.p_vaddr = ENDIAN_LITTLE_TO_HOST_U32(programHeader.p_vaddr);
+                               programHeader.p_paddr = ENDIAN_LITTLE_TO_HOST_U32(programHeader.p_paddr);
+                               programHeader.p_filesz = ENDIAN_LITTLE_TO_HOST_U32(programHeader.p_filesz);
+                               programHeader.p_memsz = ENDIAN_LITTLE_TO_HOST_U32(programHeader.p_memsz);
+                               programHeader.p_flags = ENDIAN_LITTLE_TO_HOST_U32(programHeader.p_flags);
+                               programHeader.p_align = ENDIAN_LITTLE_TO_HOST_U32(programHeader.p_align);
+                               
+                               m_programHeaders.push_back(programHeader);
+                       }
+               }
+               
+               // look up symbol table section index
+               {
+                   std::string symtab_section_name(SYMTAB_SECTION_NAME);
+                   m_symbolTableIndex = getIndexOfSectionWithName(symtab_section_name);
+               }
+       }
+       catch (...)
+       {
+               throw StELFFileException("error reading file");
+       }
+}
+
+const Elf32_Shdr & StELFFile::getSectionAtIndex(unsigned inIndex) const
+{
+       if (inIndex > m_sectionHeaders.size())
+               throw std::invalid_argument("inIndex");
+       
+       return m_sectionHeaders[inIndex];
+}
+
+//! If there is not a matching section, then #SHN_UNDEF is returned instead.
+//!
+unsigned StELFFile::getIndexOfSectionWithName(const std::string & inName)
+{
+       unsigned sectionIndex = 0;
+       const_section_iterator it = getSectionBegin();
+       for (; it != getSectionEnd(); ++it, ++sectionIndex)
+       {
+               const Elf32_Shdr & header = *it;
+               if (header.sh_name != 0)
+               {
+                       std::string sectionName = getSectionNameAtIndex(header.sh_name);
+                       if (inName == sectionName)
+                               return sectionIndex;
+               }
+       }
+       
+       // no matching section
+       return SHN_UNDEF;
+}
+
+//! The pointer returned from this method must be freed with the delete array operator (i.e., delete []).
+//! If either the section data offset (sh_offset) or the section size (sh_size) are 0, then NULL will
+//! be returned instead.
+//!
+//! The data is read directly from the input stream passed into the constructor. The stream must
+//! still be open, or an exception will be thrown.
+//!
+//! \exception StELFFileException is thrown if an error occurs while reading the file.
+//! \exception std::bad_alloc is thrown if memory for the data cannot be allocated.
+uint8_t * StELFFile::getSectionDataAtIndex(unsigned inIndex)
+{
+       return readSectionData(m_sectionHeaders[inIndex]);
+}
+
+//! The pointer returned from this method must be freed with the delete array operator (i.e., delete []).
+//! If either the section data offset (sh_offset) or the section size (sh_size) are 0, then NULL will
+//! be returned instead.
+//!
+//! The data is read directly from the input stream passed into the constructor. The stream must
+//! still be open, or an exception will be thrown.
+//!
+//! \exception StELFFileException is thrown if an error occurs while reading the file.
+//! \exception std::bad_alloc is thrown if memory for the data cannot be allocated.
+uint8_t * StELFFile::getSectionData(const_section_iterator inSection)
+{
+       return readSectionData(*inSection);
+}
+
+//! \exception StELFFileException is thrown if an error occurs while reading the file.
+//! \exception std::bad_alloc is thrown if memory for the data cannot be allocated.
+uint8_t * StELFFile::readSectionData(const Elf32_Shdr & inHeader)
+{
+       // check for empty data
+       if (inHeader.sh_offset == 0 || inHeader.sh_size == 0)
+               return NULL;
+               
+       uint8_t * sectionData = new uint8_t[inHeader.sh_size];
+       
+       try
+       {
+               m_stream.seekg(inHeader.sh_offset, std::ios::beg);
+               m_stream.read(reinterpret_cast<char *>(sectionData), inHeader.sh_size);
+               if (m_stream.bad())
+                       throw StELFFileException("could not read entire section");
+       }
+       catch (StELFFileException)
+       {
+               throw;
+       }
+       catch (...)
+       {
+               throw StELFFileException("error reading section data");
+       }
+               
+       return sectionData;
+}
+
+const Elf32_Phdr & StELFFile::getSegmentAtIndex(unsigned inIndex) const
+{
+       if (inIndex > m_programHeaders.size())
+               throw std::invalid_argument("inIndex");
+       
+       return m_programHeaders[inIndex];
+}
+
+//! The pointer returned from this method must be freed with the delete array operator (i.e., delete []).
+//! If either the segment offset (p_offset) or the segment file size (p_filesz) are 0, then NULL will
+//! be returned instead.
+//!
+//! The data is read directly from the input stream passed into the constructor. The stream must
+//! still be open, or an exception will be thrown.
+//!
+//! \exception StELFFileException is thrown if an error occurs while reading the file.
+//! \exception std::bad_alloc is thrown if memory for the data cannot be allocated.
+uint8_t * StELFFile::getSegmentDataAtIndex(unsigned inIndex)
+{
+       return readSegmentData(m_programHeaders[inIndex]);
+}
+
+//! The pointer returned from this method must be freed with the delete array operator (i.e., delete []).
+//! If either the segment offset (p_offset) or the segment file size (p_filesz) are 0, then NULL will
+//! be returned instead.
+//!
+//! The data is read directly from the input stream passed into the constructor. The stream must
+//! still be open, or an exception will be thrown.
+//!
+//! \exception StELFFileException is thrown if an error occurs while reading the file.
+//! \exception std::bad_alloc is thrown if memory for the data cannot be allocated.
+uint8_t * StELFFile::getSegmentData(const_segment_iterator inSegment)
+{
+       return readSegmentData(*inSegment);
+}
+       
+//! \exception StELFFileException is thrown if an error occurs while reading the file.
+//! \exception std::bad_alloc is thrown if memory for the data cannot be allocated.
+uint8_t * StELFFile::readSegmentData(const Elf32_Phdr & inHeader)
+{
+       // check for empty data
+       if (inHeader.p_offset == 0 || inHeader.p_filesz== 0)
+               return NULL;
+               
+       uint8_t * segmentData = new uint8_t[inHeader.p_filesz];
+       
+       try
+       {
+               m_stream.seekg(inHeader.p_offset, std::ios::beg);
+               m_stream.read(reinterpret_cast<char *>(segmentData), inHeader.p_filesz);
+               if (m_stream.bad())
+                       throw StELFFileException("could not read entire segment");
+       }
+       catch (StELFFileException)
+       {
+               throw;
+       }
+       catch (...)
+       {
+               throw StELFFileException("error reading segment data");
+       }
+       
+       return segmentData;
+}
+
+//! If the index is out of range, or if there is no string table in the file, then
+//! an empty string will be returned instead. This will also happen when the index
+//! is either 0 or the last byte in the table, since the table begins and ends with
+//! zero bytes.
+std::string StELFFile::getSectionNameAtIndex(unsigned inIndex)
+{
+       // make sure there's a section name string table
+       if (m_header.e_shstrndx == SHN_UNDEF)
+               return std::string("");
+       
+       return getStringAtIndex(m_header.e_shstrndx, inIndex);
+}
+
+//! \exception std::invalid_argument is thrown if the section identified by \a
+//!            inStringTableSectionIndex is not actually a string table, or if \a
+//!            inStringIndex is out of range for the string table.
+std::string StELFFile::getStringAtIndex(unsigned inStringTableSectionIndex, unsigned inStringIndex)
+{
+       // check section type
+       const Elf32_Shdr & header = getSectionAtIndex(inStringTableSectionIndex);
+       if (header.sh_type != SHT_STRTAB)
+               throw std::invalid_argument("inStringTableSectionIndex");
+       
+       if (inStringIndex >= header.sh_size)
+               throw std::invalid_argument("inStringTableSectionIndex");
+       
+       // check cache
+       SectionDataInfo & info = getCachedSectionData(inStringTableSectionIndex);
+       return std::string(&reinterpret_cast<char *>(info.m_data)[inStringIndex]);
+}
+
+StELFFile::SectionDataInfo & StELFFile::getCachedSectionData(unsigned inSectionIndex)
+{
+       // check cache
+       SectionDataMap::iterator it = m_sectionDataCache.find(inSectionIndex);
+       if (it != m_sectionDataCache.end())
+               return it->second;
+       
+       // not in cache, add it
+       const Elf32_Shdr & header = getSectionAtIndex(inSectionIndex);
+       uint8_t * data = getSectionDataAtIndex(inSectionIndex);
+       
+       SectionDataInfo info;
+       info.m_data = data;
+       info.m_size = header.sh_size;
+       
+       m_sectionDataCache[inSectionIndex] = info;
+       return m_sectionDataCache[inSectionIndex];
+}
+
+//! The number of entries in the symbol table is the symbol table section size
+//! divided by the size of each symbol entry (the #Elf32_Shdr::sh_entsize field of the
+//! symbol table section header).
+unsigned StELFFile::getSymbolCount()
+{
+       if (m_symbolTableIndex == SHN_UNDEF)
+               return 0;
+       
+       const Elf32_Shdr & header = getSectionAtIndex(m_symbolTableIndex);
+       return header.sh_size / header.sh_entsize;
+}
+
+//! \exception std::invalid_argument is thrown if \a inIndex is out of range.]
+//!
+const Elf32_Sym & StELFFile::getSymbolAtIndex(unsigned inIndex)
+{
+       // get section data
+       const Elf32_Shdr & header = getSectionAtIndex(m_symbolTableIndex);
+       SectionDataInfo & info = getCachedSectionData(m_symbolTableIndex);
+       
+       // has the symbol table been byte swapped yet?
+       if (!info.m_swapped)
+       {
+               byteSwapSymbolTable(header, info);
+       }
+       
+       unsigned symbolOffset = header.sh_entsize * inIndex;
+       if (symbolOffset >= info.m_size)
+       {
+               throw std::invalid_argument("inIndex");
+       }
+       
+       Elf32_Sym * symbol = reinterpret_cast<Elf32_Sym *>(&info.m_data[symbolOffset]);
+       return *symbol;
+}
+
+void StELFFile::byteSwapSymbolTable(const Elf32_Shdr & header, SectionDataInfo & info)
+{
+       unsigned symbolCount = getSymbolCount();
+       unsigned i = 0;
+       unsigned symbolOffset = 0;
+       
+       for (; i < symbolCount; ++i, symbolOffset += header.sh_entsize)
+       {
+               Elf32_Sym * symbol = reinterpret_cast<Elf32_Sym *>(&info.m_data[symbolOffset]);
+               symbol->st_name = ENDIAN_LITTLE_TO_HOST_U32(symbol->st_name);
+               symbol->st_value = ENDIAN_LITTLE_TO_HOST_U32(symbol->st_value);
+               symbol->st_size = ENDIAN_LITTLE_TO_HOST_U32(symbol->st_size);
+               symbol->st_shndx = ENDIAN_LITTLE_TO_HOST_U16(symbol->st_shndx);
+       }
+       
+       // remember that we've byte swapped the symbols
+       info.m_swapped = true;
+}
+
+unsigned StELFFile::getSymbolNameStringTableIndex() const
+{
+       const Elf32_Shdr & header = getSectionAtIndex(m_symbolTableIndex);
+       return header.sh_link;
+}
+
+std::string StELFFile::getSymbolName(const Elf32_Sym & inSymbol)
+{
+       unsigned symbolStringTableIndex = getSymbolNameStringTableIndex();
+       return getStringAtIndex(symbolStringTableIndex, inSymbol.st_name);
+}
+
+//! Returns STN_UNDEF if it cannot find a symbol at the given \a symbolAddress.
+unsigned StELFFile::getIndexOfSymbolAtAddress(uint32_t symbolAddress, bool strict)
+{
+       unsigned symbolCount = getSymbolCount();
+       unsigned symbolIndex = 0;
+       for (; symbolIndex < symbolCount; ++symbolIndex)
+       {
+               const Elf32_Sym & symbol = getSymbolAtIndex(symbolIndex);
+               
+               // the GHS toolchain puts in STT_FUNC symbols marking the beginning and ending of each
+               // file. if the entry point happens to be at the beginning of the file, the beginning-
+               // of-file symbol will have the same value and type. fortunately, the size of these
+               // symbols is 0 (or seems to be). we also ignore symbols that start with two dots just
+               // in case.
+               if (symbol.st_value == symbolAddress && (strict && ELF32_ST_TYPE(symbol.st_info) == STT_FUNC && symbol.st_size != 0))
+               {
+                       std::string symbolName = getSymbolName(symbol);
+                       
+                       // ignore symbols that start with two dots
+                       if (symbolName[0] == '.' && symbolName[1] == '.')
+                               continue;
+                       
+                       // found the symbol!
+                       return symbolIndex;
+               }
+       }
+       
+       return STN_UNDEF;
+}
+
+ARMSymbolType_t StELFFile::getTypeOfSymbolAtIndex(unsigned symbolIndex)
+{
+       ARMSymbolType_t symType = eARMSymbol;
+       const Elf32_Sym & symbol = getSymbolAtIndex(symbolIndex);
+       
+       if (m_elfVariant == eGHSVariant)
+       {
+               if (symbol.st_other & STO_THUMB)
+                       symType = eThumbSymbol;
+       }
+       else
+       {
+               unsigned mappingSymStart = 1;
+               unsigned mappingSymCount = getSymbolCount() - 1;        // don't include first undefined symbol
+               bool mapSymsFirst = (m_header.e_flags & EF_ARM_MAPSYMSFIRST) != 0;
+               if (mapSymsFirst)
+               {
+                       // first symbol '$m' is number of mapping syms
+                       const Elf32_Sym & mappingSymCountSym = getSymbolAtIndex(1);
+                       if (getSymbolName(mappingSymCountSym) == MAPPING_SYMBOL_COUNT_TAGSYM)
+                       {
+                               mappingSymCount = mappingSymCountSym.st_value;
+                               mappingSymStart = 2;
+                       }
+
+               }
+               
+               uint32_t lastMappingSymAddress = 0;
+               unsigned mappingSymIndex = mappingSymStart;
+               for (; mappingSymIndex < mappingSymCount + mappingSymStart; ++mappingSymIndex)
+               {
+                       const Elf32_Sym & mappingSym = getSymbolAtIndex(mappingSymIndex);
+                       std::string mappingSymName = getSymbolName(mappingSym);
+                       ARMSymbolType_t nextSymType = eUnknownSymbol;
+                       
+                       if (mappingSymName == ARM_SEQUENCE_MAPSYM)
+                               symType = eARMSymbol;
+                       else if (mappingSymName == DATA_SEQUENCE_MAPSYM)
+                               symType = eDataSymbol;
+                       else if (mappingSymName == THUMB_SEQUENCE_MAPSYM)
+                               symType = eThumbSymbol;
+                       
+                       if (nextSymType != eUnknownSymbol)
+                       {
+                               if (symbol.st_value >= lastMappingSymAddress && symbol.st_value < mappingSym.st_value)
+                                       break;
+                               
+                               symType = nextSymType;
+                               lastMappingSymAddress = mappingSym.st_value;
+                       }
+               }
+       }
+       
+       return symType;
+}
+
+void StELFFile::dumpSections()
+{
+       unsigned count = getSectionCount();
+       unsigned i = 0;
+       
+       const char * sectionTypes[12] = { "NULL", "PROGBITS", "SYMTAB", "STRTAB", "RELA", "HASH", "DYNAMIC", "NOTE", "NOBITS", "REL", "SHLIB", "DYNSYM" };
+       
+       for (; i < count; ++i)
+       {
+               const Elf32_Shdr & header = getSectionAtIndex(i);
+               std::string name = getSectionNameAtIndex(header.sh_name);
+
+               if (header.sh_type < sizeof(sectionTypes) / sizeof(sectionTypes[0])) {
+                       printf("%s: %s, 0x%08x, 0x%08x, 0x%08x, %d, %d, %d\n",
+                              name.c_str(), sectionTypes[header.sh_type],
+                              header.sh_addr, header.sh_offset,
+                              header.sh_size, header.sh_link,
+                              header.sh_info, header.sh_entsize);
+               } else {
+                       printf("%s: 0x%02x, 0x%08x, 0x%08x, 0x%08x, %d, %d, %d\n",
+                              name.c_str(), header.sh_type,
+                              header.sh_addr, header.sh_offset,
+                              header.sh_size, header.sh_link,
+                              header.sh_info, header.sh_entsize);
+               }
+       }
+}
+
+void StELFFile::dumpSymbolTable()
+{
+       const char * symbolTypes[5] = { "NOTYPE", "OBJECT", "FUNC", "SECTION", "FILE" };
+       const char * symbolBinding[3] = { "LOCAL", "GLOBAL", "WEAK" };
+       
+       unsigned count = getSymbolCount();
+       unsigned i = 0;
+       
+       for (; i < count; ++i)
+       {
+               const Elf32_Sym & symbol = getSymbolAtIndex(i);
+               std::string name = getSymbolName(symbol);
+               
+               printf("'%s': %s, %s, 0x%08x, 0x%08x, %d. 0x%08x\n", name.c_str(), symbolTypes[ELF32_ST_TYPE(symbol.st_info)], symbolBinding[ELF32_ST_BIND(symbol.st_info)], symbol.st_value, symbol.st_size, symbol.st_shndx, symbol.st_other);
+       }
+}
+
+
+
diff --git a/tools/elftosb/common/StELFFile.h b/tools/elftosb/common/StELFFile.h
new file mode 100644 (file)
index 0000000..3ab9899
--- /dev/null
@@ -0,0 +1,196 @@
+/*
+ * File:       StELFFile.h
+ *
+ * Copyright (c) Freescale Semiconductor, Inc. All rights reserved.
+ * See included license file for license details.
+ */
+#if !defined(_StELFFile_h_)
+#define _StELFFile_h_
+
+#include "stdafx.h"
+#include <string>
+#include <vector>
+#include <map>
+#include <iostream>
+#include <stdexcept>
+#include "ELF.h"
+
+//! Variations of the ARM ELF format.
+typedef enum {
+       eARMVariant = 1,        //!< Standard ARM ELF specification.
+       eGHSVariant,            //!< Green Hills Software variant.
+       eGCCVariant             //!< GNU Compiler Collection variant.
+} ELFVariant_t;
+
+//! Possible ARM ELF symbol types.
+typedef enum {
+       eUnknownSymbol,
+       eARMSymbol,
+       eThumbSymbol,
+       eDataSymbol
+} ARMSymbolType_t;
+
+/*!
+ * \brief Parser for Executable and Linking Format (ELF) files.
+ *
+ * The stream passed into the constructor needs to stay open for the life
+ * of the object. This is because calls to getSectionDataAtIndex() and
+ * getSegmentDataAtIndex() read the data directly from the input stream.
+ */
+class StELFFile
+{
+public:
+       typedef std::vector<Elf32_Shdr>::const_iterator const_section_iterator;
+       typedef std::vector<Elf32_Phdr>::const_iterator const_segment_iterator;
+       
+public:
+       //! \brief Constructor.
+       StELFFile(std::istream & inStream);
+       
+       //! \brief Destructor.
+       virtual ~StELFFile();
+       
+       //! \name File format variant
+       //@{
+       //! \brief Return the ELF format variant to which this file is set.
+       virtual ELFVariant_t ELFVariant() { return m_elfVariant; }
+       
+       //! \brief Set the ELF format variation to either #eARMVariant or #eGHSVariant.
+       virtual void setELFVariant(ELFVariant_t variant) { m_elfVariant = variant; }
+       //@}
+       
+       //! \name File name
+       //@{
+       virtual void setName(const std::string & inName) { m_name = inName; }
+       virtual std::string getName() const { return m_name; }
+       //@}
+       
+       //! \name ELF header
+       //@{
+       //! \brief Returns the ELF file header.
+       inline const Elf32_Ehdr & getFileHeader() const { return m_header; }
+       //@}
+       
+       //! \name Sections
+       //! Methods pertaining to the object file's sections.
+       //@{
+       //! \brief Returns the number of sections in the file.
+       inline unsigned getSectionCount() const { return static_cast<unsigned>(m_sectionHeaders.size()); }
+       
+       //! \brief Returns a reference to section number \a inIndex.
+       const Elf32_Shdr & getSectionAtIndex(unsigned inIndex) const;
+       
+       inline const_section_iterator getSectionBegin() const { return m_sectionHeaders.begin(); }
+       inline const_section_iterator getSectionEnd() const { return m_sectionHeaders.end(); }
+       
+       //! \brief Returns the index of the section with the name \a inName.
+       unsigned getIndexOfSectionWithName(const std::string & inName);
+       
+       //! \brief Returns the data for the section.
+       uint8_t * getSectionDataAtIndex(unsigned inIndex);
+       
+       //! \brief Returns the data for the section.
+       uint8_t * getSectionData(const_section_iterator inSection);
+       //@}
+       
+       //! \name Segments
+       //! Methods for accessing the file's program headers for segments.
+       //@{
+       //! \brief Returns the number of segments, or program headers, in the file.
+       inline unsigned getSegmentCount() const { return static_cast<unsigned>(m_programHeaders.size()); }
+       
+       //! \brief Returns a reference to the given segment.
+       const Elf32_Phdr & getSegmentAtIndex(unsigned inIndex) const;
+
+       inline const_segment_iterator getSegmentBegin() const { return m_programHeaders.begin(); }
+       inline const_segment_iterator getSegmentEnd() const { return m_programHeaders.end(); }
+       
+       //! \brief Returns the data of the specified segment.
+       uint8_t * getSegmentDataAtIndex(unsigned inIndex);
+       
+       //! \brief Returns the data of the specified segment.
+       uint8_t * getSegmentData(const_segment_iterator inSegment);
+       //@}
+       
+       //! \name String table
+       //! Methods for accessing the string tables.
+       //@{
+       //! \brief Returns a string from the file's section name string table.
+       std::string getSectionNameAtIndex(unsigned inIndex);
+       
+       //! \brief Returns a string from any string table in the object file.
+       std::string getStringAtIndex(unsigned inStringTableSectionIndex, unsigned inStringIndex);
+       //@}
+       
+       //! \name Symbol table
+       //! Methods for accessing the object file's symbol table. Currently only
+       //! a single symbol table with the section name ".symtab" is supported.
+       //@{
+       //! \brief Returns the number of symbols in the default ".symtab" symbol table.
+       unsigned getSymbolCount();
+       
+       //! \brief Returns the symbol with index \a inIndex.
+       const Elf32_Sym & getSymbolAtIndex(unsigned inIndex);
+       
+       //! \brief Returns the section index of the string table containing symbol names.
+       unsigned getSymbolNameStringTableIndex() const;
+       
+       //! \brief Returns the name of the symbol described by \a inSymbol.
+       std::string getSymbolName(const Elf32_Sym & inSymbol);
+       
+       unsigned getIndexOfSymbolAtAddress(uint32_t symbolAddress, bool strict=true);
+       
+       ARMSymbolType_t getTypeOfSymbolAtIndex(unsigned symbolIndex);
+       //@}
+       
+       //! \name Debugging
+       //@{
+       void dumpSections();
+       void dumpSymbolTable();
+       //@}
+
+protected:
+       std::istream & m_stream;        //!< The source stream for the ELF file.
+       ELFVariant_t m_elfVariant;      //!< Variant of the ARM ELF format specification.
+       std::string m_name;                     //!< File name. (optional)
+       Elf32_Ehdr m_header;    //!< The ELF file header.
+       std::vector<Elf32_Shdr> m_sectionHeaders;       //!< All of the section headers.
+       std::vector<Elf32_Phdr> m_programHeaders;       //!< All of the program headers.
+       unsigned m_symbolTableIndex;    //!< Index of ".symtab" section, or #SHN_UNDEF if not present.
+       
+       /*!
+        * Little structure containing information about cached section data.
+        */
+       struct SectionDataInfo
+       {
+               uint8_t * m_data;       //!< Pointer to section data.
+               unsigned m_size;        //!< Section data size in bytes.
+               bool m_swapped; //!< Has this section been byte swapped yet? Used for symbol table.
+       };
+       typedef std::map<unsigned, SectionDataInfo> SectionDataMap;
+       SectionDataMap m_sectionDataCache;      //!< Cached data of sections.
+       
+       //! \brief Reads a section's data either from cache or from disk.
+       SectionDataInfo & getCachedSectionData(unsigned inSectionIndex);
+       
+       //! \brief Reads the file, section, and program headers into memory.
+       void readFileHeaders();
+       
+       uint8_t * readSectionData(const Elf32_Shdr & inHeader);
+       uint8_t * readSegmentData(const Elf32_Phdr & inHeader);
+       
+       //! \brief Byte swaps the symbol table data into host endianness.
+       void byteSwapSymbolTable(const Elf32_Shdr & header, SectionDataInfo & info);
+};
+
+/*!
+ * \brief Simple exception thrown to indicate an error in the input ELF file format.
+ */
+class StELFFileException : public std::runtime_error
+{
+public:
+       //! \brief Default constructor.
+       StELFFileException(const std::string & inMessage) : std::runtime_error(inMessage) {}
+};
+
+#endif // _StELFFile_h_
diff --git a/tools/elftosb/common/StExecutableImage.cpp b/tools/elftosb/common/StExecutableImage.cpp
new file mode 100644 (file)
index 0000000..7f5eb0a
--- /dev/null
@@ -0,0 +1,463 @@
+/*
+ * File:       StExecutableImage.cpp
+ *
+ * Copyright (c) Freescale Semiconductor, Inc. All rights reserved.
+ * See included license file for license details.
+ */
+
+#include "StExecutableImage.h"
+#include <stdexcept>
+#include <algorithm>
+#include <string.h>
+#include <stdio.h>
+
+StExecutableImage::StExecutableImage(int inAlignment)
+:      m_alignment(inAlignment),
+       m_hasEntry(false),
+       m_entry(0)
+{
+}
+
+//! Makes a duplicate of each memory region.
+StExecutableImage::StExecutableImage(const StExecutableImage & inOther)
+:      m_name(inOther.m_name),
+    m_alignment(inOther.m_alignment),
+       m_hasEntry(inOther.m_hasEntry),
+       m_entry(inOther.m_entry),
+    m_filters(inOther.m_filters)
+{
+       const_iterator it = inOther.getRegionBegin();
+       for (; it != inOther.getRegionEnd(); ++it)
+       {
+               const MemoryRegion & region = *it;
+               
+               MemoryRegion regionCopy(region);
+               if (region.m_type == FILL_REGION && region.m_data != NULL)
+               {
+                       regionCopy.m_data = new uint8_t[region.m_length];
+                       memcpy(regionCopy.m_data, region.m_data, region.m_length);
+               }
+               
+               m_image.push_back(regionCopy);
+       }
+}
+
+//! Disposes of memory allocated for each region.
+StExecutableImage::~StExecutableImage()
+{
+       MemoryRegionList::iterator it;
+       for (it = m_image.begin(); it != m_image.end(); ++it)
+       {
+               if (it->m_data)
+               {
+                       delete [] it->m_data;
+                       it->m_data = NULL;
+               }
+       }
+}
+
+//! A copy of \a inName is made, so the original may be disposed of by the caller
+//! after this method returns.
+void StExecutableImage::setName(const std::string & inName)
+{
+       m_name = inName;
+}
+
+std::string StExecutableImage::getName() const
+{
+       return m_name;
+}
+
+// The region is added with read and write flags set.
+//! \exception std::runtime_error will be thrown if the new overlaps an
+//!            existing region.
+void StExecutableImage::addFillRegion(uint32_t inAddress, unsigned inLength)
+{
+       MemoryRegion region;
+       region.m_type = FILL_REGION;
+       region.m_address = inAddress;
+       region.m_data = NULL;
+       region.m_length = inLength;
+       region.m_flags = REGION_RW_FLAG;
+       
+       insertOrMergeRegion(region);
+}
+
+//! A copy of \a inData is made before returning. The copy will be deleted when 
+//! the executable image is destructed. Currently, the text region is created with
+//! read, write, and executable flags set.
+//! \exception std::runtime_error will be thrown if the new overlaps an
+//!            existing region.
+//! \exception std::bad_alloc is thrown if memory for the copy of \a inData
+//!            cannot be allocated.
+void StExecutableImage::addTextRegion(uint32_t inAddress, const uint8_t * inData, unsigned inLength)
+{
+       MemoryRegion region;
+       region.m_type = TEXT_REGION;
+       region.m_address = inAddress;
+       region.m_flags = REGION_RW_FLAG | REGION_EXEC_FLAG;
+       
+       // copy the data
+       region.m_data = new uint8_t[inLength];
+       region.m_length = inLength;
+       memcpy(region.m_data, inData, inLength);
+       
+       insertOrMergeRegion(region);
+}
+
+//! \exception std::out_of_range is thrown if \a inIndex is out of range.
+//!
+const StExecutableImage::MemoryRegion & StExecutableImage::getRegionAtIndex(unsigned inIndex) const
+{
+       // check bounds
+       if (inIndex >= m_image.size())
+               throw std::out_of_range("inIndex");
+       
+       // find region by index
+       MemoryRegionList::const_iterator it = m_image.begin();
+       unsigned i = 0;
+       for (; it != m_image.end(); ++it, ++i)
+       {
+               if (i == inIndex)
+                       break;
+       }
+       return *it;
+}
+
+//! The list of address filters is kept sorted as filters are added.
+//!
+void StExecutableImage::addAddressFilter(const AddressFilter & filter)
+{
+    m_filters.push_back(filter);
+    m_filters.sort();
+}
+
+//!
+void StExecutableImage::clearAddressFilters()
+{
+    m_filters.clear();
+}
+
+//! \exception StExecutableImage::address_filter_exception Raised when a filter
+//!     with the type #ADDR_FILTER_ERROR or #ADDR_FILTER_WARNING is matched.
+//!
+//! \todo Build a list of all matching filters and then execute them at once.
+//!     For the warning and error filters, a single exception should be raised
+//!     that identifies all the overlapping errors. Currently the user will only
+//!     see the first (lowest address) overlap.
+void StExecutableImage::applyAddressFilters()
+{
+restart_loops:
+    // Iterate over filters.
+    AddressFilterList::const_iterator fit = m_filters.begin();
+    for (; fit != m_filters.end(); ++fit)
+    {
+        const AddressFilter & filter = *fit;
+        
+        // Iterator over regions.
+        MemoryRegionList::iterator rit = m_image.begin();
+        for (; rit != m_image.end(); ++rit)
+        {
+            MemoryRegion & region = *rit;
+            
+            if (filter.matchesMemoryRegion(region))
+            {
+                switch (filter.m_action)
+                {
+                    case ADDR_FILTER_NONE:
+                        // Do nothing.
+                        break;
+                        
+                    case ADDR_FILTER_ERROR:
+                        // throw error exception
+                        throw address_filter_exception(true, m_name, filter);
+                        break;
+                        
+                    case ADDR_FILTER_WARNING:
+                        // throw warning exception
+                        throw address_filter_exception(false, m_name, filter);
+                        break;
+                        
+                    case ADDR_FILTER_CROP:
+                        // Delete the offending portion of the region and restart
+                        // the iteration loops.
+                        cropRegionToFilter(region, filter);
+                        goto restart_loops;
+                        break;
+                }
+            }
+        }
+    }
+}
+
+//! There are several possible cases here:
+//!     - No overlap at all. Nothing is done.
+//!
+//!     - All of the memory region is matched by the \a filter. The region is
+//!         removed from #StExecutableImage::m_image and its data memory freed.
+//!
+//!     - The remaining portion of the region is one contiguous chunk. In this
+//!         case, \a region is simply modified. 
+//!
+//!     - The region is split in the middle by the filter. The original \a region
+//!         is modified to match the first remaining chunk. And a new #StExecutableImage::MemoryRegion
+//!         instance is created to hold the other leftover piece.
+void StExecutableImage::cropRegionToFilter(MemoryRegion & region, const AddressFilter & filter)
+{
+    uint32_t firstByte = region.m_address;      // first byte occupied by this region
+    uint32_t lastByte = region.endAddress();    // last used byte in this region
+    
+    // compute new address range
+    uint32_t cropFrom = filter.m_fromAddress;
+    if (cropFrom < firstByte)
+    {
+        cropFrom = firstByte;
+    }
+    
+    uint32_t cropTo = filter.m_toAddress;
+    if (cropTo > lastByte)
+    {
+        cropTo = lastByte;
+    }
+    
+    // is there actually a match?
+    if (cropFrom > filter.m_toAddress || cropTo < filter.m_fromAddress)
+    {
+        // nothing to do, so bail
+        return;
+    }
+    
+    printf("Deleting region 0x%08x-0x%08x\n", cropFrom, cropTo);
+    
+    // handle if the entire region is to be deleted
+    if (cropFrom == firstByte && cropTo == lastByte)
+    {
+        delete [] region.m_data;
+        region.m_data = NULL;
+        m_image.remove(region);
+    }
+    
+    // there is at least a little of the original region remaining
+    uint32_t newLength = cropTo - cropFrom + 1;
+    uint32_t leftoverLength = lastByte - cropTo;
+    uint8_t * oldData = region.m_data;
+    
+    // update the region
+    region.m_address = cropFrom;
+    region.m_length = newLength;
+    
+    // crop data buffer for text regions
+    if (region.m_type == TEXT_REGION && oldData)
+    {
+        region.m_data = new uint8_t[newLength];
+        memcpy(region.m_data, &oldData[cropFrom - firstByte], newLength);
+        
+        // dispose of old data
+        delete [] oldData;
+    }
+    
+    // create a new region for any part of the original region that was past
+    // the crop to address. this will happen if the filter range falls in the
+    // middle of the region.
+    if (leftoverLength)
+    {
+        MemoryRegion newRegion;
+        newRegion.m_type = region.m_type;
+        newRegion.m_flags = region.m_flags;
+        newRegion.m_address = cropTo + 1;
+        newRegion.m_length = leftoverLength;
+        
+        if (region.m_type == TEXT_REGION && oldData)
+        {
+            newRegion.m_data = new uint8_t[leftoverLength];
+            memcpy(newRegion.m_data, &oldData[cropTo - firstByte + 1], leftoverLength);
+        }
+        
+        insertOrMergeRegion(newRegion);
+    }
+}
+
+//! \exception std::runtime_error will be thrown if \a inRegion overlaps an
+//!            existing region.
+//!
+//! \todo Need to investigate if we can use the STL sort algorithm at all. Even
+//!     though we're doing merges too, we could sort first then examine the list
+//!     for merges.
+void StExecutableImage::insertOrMergeRegion(MemoryRegion & inRegion)
+{
+       uint32_t newStart = inRegion.m_address;
+       uint32_t newEnd = newStart + inRegion.m_length;
+       
+       MemoryRegionList::iterator it = m_image.begin();
+       MemoryRegionList::iterator sortedPosition = m_image.begin();
+       for (; it != m_image.end(); ++it)
+       {
+               MemoryRegion & region = *it;
+               uint32_t thisStart = region.m_address;
+               uint32_t thisEnd = thisStart + region.m_length;
+               
+               // keep track of where to insert it to retain sort order
+               if (thisStart >= newEnd)
+               {
+                       break;
+               }
+                       
+               // region types and flags must match in order to merge
+               if (region.m_type == inRegion.m_type && region.m_flags == inRegion.m_flags)
+               {
+                       if (newStart == thisEnd || newEnd == thisStart)
+                       {
+                               mergeRegions(region, inRegion);
+                               return;
+                       }
+                       else if ((newStart >= thisStart && newStart < thisEnd) || (newEnd >= thisStart && newEnd < thisEnd))
+                       {
+                               throw std::runtime_error("new region overlaps existing region");
+                       }
+               }
+       }
+       
+       // not merged, so just insert it in the sorted position
+       m_image.insert(it, inRegion);
+}
+
+//! Extends \a inNewRegion to include the data in \a inOldRegion. It is
+//! assumed that the two regions are compatible. The new region may come either
+//! before or after the old region in memory. Note that while the two regions
+//! don't necessarily have to be touching, it's probably a good idea. That's
+//! because any data between the regions will be set to 0.
+//!
+//! For TEXT_REGION types, the two original regions will have their data deleted
+//! during the merge. Thus, this method is not safe if any outside callers may
+//! be accessing the region's data.
+void StExecutableImage::mergeRegions(MemoryRegion & inOldRegion, MemoryRegion & inNewRegion)
+{
+       bool isOldBefore = inOldRegion.m_address < inNewRegion.m_address;
+       uint32_t oldEnd = inOldRegion.m_address + inOldRegion.m_length;
+       uint32_t newEnd = inNewRegion.m_address + inNewRegion.m_length;
+       
+       switch (inOldRegion.m_type)
+       {
+               case TEXT_REGION:
+               {
+                       // calculate new length
+                       unsigned newLength;
+                       if (isOldBefore)
+                       {
+                               newLength = newEnd - inOldRegion.m_address;
+                       }
+                       else
+                       {
+                               newLength = oldEnd - inNewRegion.m_address;
+                       }
+                       
+                       // alloc memory
+                       uint8_t * newData = new uint8_t[newLength];
+                       memset(newData, 0, newLength);
+                       
+                       // copy data from the two regions into new block
+                       if (isOldBefore)
+                       {
+                               memcpy(newData, inOldRegion.m_data, inOldRegion.m_length);
+                               memcpy(&newData[newLength - inNewRegion.m_length], inNewRegion.m_data, inNewRegion.m_length);
+                       }
+                       else
+                       {
+                               memcpy(newData, inNewRegion.m_data, inNewRegion.m_length);
+                               memcpy(&newData[newLength - inOldRegion.m_length], inOldRegion.m_data, inOldRegion.m_length);
+                               
+                               inOldRegion.m_address = inNewRegion.m_address;
+                       }
+                       
+                       // replace old region's data
+                       delete [] inOldRegion.m_data;
+                       inOldRegion.m_data = newData;
+                       inOldRegion.m_length = newLength;
+                       
+                       // delete new region's data
+                       delete [] inNewRegion.m_data;
+                       inNewRegion.m_data = NULL;
+                       break;
+               }
+                       
+               case FILL_REGION:
+               {
+                       if (isOldBefore)
+                       {
+                               inOldRegion.m_length = newEnd - inOldRegion.m_address;
+                       }
+                       else
+                       {
+                               inOldRegion.m_length = oldEnd - inNewRegion.m_address;
+                               inOldRegion.m_address = inNewRegion.m_address;
+                       }
+                       break;
+               }
+       }
+}
+
+//! Used when we remove a region from the region list by value. Because this
+//! operator compares the #m_data member, it will only return true for either an
+//! exact copy or a reference to the original.
+bool StExecutableImage::MemoryRegion::operator == (const MemoryRegion & other)
+{
+   return (m_type == other.m_type) && (m_address == other.m_address) && (m_length == other.m_length) && (m_flags == other.m_flags) && (m_data == other.m_data);
+}
+
+//! Returns true if the address filter overlaps \a region.
+bool StExecutableImage::AddressFilter::matchesMemoryRegion(const MemoryRegion & region) const
+{
+    uint32_t firstByte = region.m_address;      // first byte occupied by this region
+    uint32_t lastByte = region.endAddress();    // last used byte in this region
+    return (firstByte >= m_fromAddress && firstByte <= m_toAddress) || (lastByte >= m_fromAddress && lastByte <= m_toAddress);
+}
+
+//! The comparison does \em not take the action into account. It only looks at the
+//! priority and address ranges of each filter. Priority is considered only if the two
+//! filters overlap. Lower priority filters will come after higher priority ones.
+//!
+//! \retval -1 This filter is less than filter \a b.
+//! \retval 0 This filter is equal to filter \a b.
+//! \retval 1 This filter is greater than filter \a b.
+int StExecutableImage::AddressFilter::compare(const AddressFilter & other) const
+{
+    if (m_priority != other.m_priority && ((m_fromAddress >= other.m_fromAddress && m_fromAddress <= other.m_toAddress) || (m_toAddress >= other.m_fromAddress && m_toAddress <= other.m_toAddress)))
+    {
+        // we know the priorities are not equal
+        if (m_priority > other.m_priority)
+        {
+            return -1;
+        }
+        else
+        {
+            return 1;
+        }
+    }
+    
+    if (m_fromAddress == other.m_fromAddress)
+    {
+        if (m_toAddress == other.m_toAddress)
+        {
+            return 0;
+        }
+        else if (m_toAddress < other.m_toAddress)
+        {
+            return -1;
+        }
+        else
+        {
+            return 1;
+        }
+    }
+    else if (m_fromAddress < other.m_fromAddress)
+    {
+        return -1;
+    }
+    else
+    {
+        return 1;
+    }
+}
+
+
+
diff --git a/tools/elftosb/common/StExecutableImage.h b/tools/elftosb/common/StExecutableImage.h
new file mode 100644 (file)
index 0000000..edfd5f4
--- /dev/null
@@ -0,0 +1,251 @@
+/*
+ * File:       StExecutableImage.h
+ *
+ * Copyright (c) Freescale Semiconductor, Inc. All rights reserved.
+ * See included license file for license details.
+ */
+#if !defined(_StExecutableImage_h_)
+#define _StExecutableImage_h_
+
+#include "stdafx.h"
+#include <list>
+
+/*!
+ * \brief Used to build a representation of memory regions.
+ *
+ * An intermediate representation of the memory regions and segments loaded
+ * from an executable file. Also used to find contiguous segments that are
+ * specified separately in the source file.
+ *
+ * When regions are added, an attempt is made to coalesce contiguous regions.
+ * In order for this to succeed, the touching regions must be of the same
+ * type and have the same permissions. Regions are also kept sorted by their
+ * address range as they are added.
+ *
+ * \todo Implement alignment support.
+ */
+class StExecutableImage
+{
+public:
+       //! Possible types of memory regions.
+       typedef enum {
+               TEXT_REGION,    //!< A region containing data or instructions.
+               FILL_REGION             //!< Region to be initialized with zero bytes.
+       } MemoryRegionType;
+       
+       //! Memory region flag constants.
+       enum {
+               REGION_READ_FLAG = 1,   //!< Region is readable.
+               REGION_WRITE_FLAG = 2,  //!< Region is writable.
+               REGION_EXEC_FLAG = 4,   //!< Region may contain executable code.
+               
+               REGION_RW_FLAG = REGION_READ_FLAG | REGION_WRITE_FLAG,  //!< Region is read-write.
+               
+               //! Mask to access only permissions flags for a region.
+               REGION_PERM_FLAG_MASK = 0x7
+       };
+       
+       /*!
+        * Representation of a contiguous region of memory.
+     *
+     * \todo Add comparison operators so we can use the STL sort algorithm.
+        */
+       struct MemoryRegion
+       {
+               MemoryRegionType m_type;        //!< Memory region type.
+               uint32_t m_address;     //!< The 32-bit start address of this region.
+               uint32_t m_length;      //!< Number of bytes in this region.
+               uint8_t * m_data;       //!< Pointer to data. Will be NULL for FILL_REGION type.
+               unsigned m_flags;       //!< Flags for the region.
+        
+        //! \brief Calculates the address of the last byte occupied by this region.
+        inline uint32_t endAddress() const { return m_address + m_length - 1; }
+        
+        //! \brief Equality operator.
+        bool operator == (const MemoryRegion & other);
+       };
+       
+       //! A list of #StExecutableImage::MemoryRegion objects.
+       typedef std::list<MemoryRegion> MemoryRegionList;
+    
+    //! The iterator type used to access #StExecutableImage::MemoryRegion objects. This type
+    //! is used by the methods #getRegionBegin() and #getRegionEnd().
+       typedef MemoryRegionList::const_iterator const_iterator;
+       
+    //! The possible actions for regions matching an address filter range.
+    typedef enum {
+        ADDR_FILTER_NONE,       //!< Do nothing.
+        ADDR_FILTER_ERROR,      //!< Raise an error exception.
+        ADDR_FILTER_WARNING,    //!< Raise a warning exception.
+        ADDR_FILTER_CROP        //!< Don't include the matching address range in the executable image.
+    } AddressFilterAction;
+    
+    /*!
+     * An address filter consists of a single address range and an action. If a
+     * memory region overlaps the filter's range then the action will be performed.
+     * The possible filter actions are defined by the #AddressFilterAction enumeration.
+     */
+    struct AddressFilter
+    {
+        AddressFilterAction m_action;   //!< Action to be performed when the filter is matched.
+        uint32_t m_fromAddress; //!< Start address of the filter. Should be lower than or equal to #m_toAddress.
+        uint32_t m_toAddress;   //!< End address of the filter. Should be higher than or equal to #m_fromAddress.
+        unsigned m_priority;     //!< Priority for this filter. Zero is the lowest priority.
+        
+        //! \brief Constructor.
+        AddressFilter(AddressFilterAction action, uint32_t from, uint32_t to, unsigned priority=0)
+        :   m_action(action), m_fromAddress(from), m_toAddress(to), m_priority(priority)
+        {
+        }
+        
+        //! \brief Test routine.
+        bool matchesMemoryRegion(const MemoryRegion & region) const;
+        
+        //! \brief Compares two address filter objects.
+        int compare(const AddressFilter & other) const;
+        
+        //! \name Comparison operators
+        //@{
+        inline bool operator < (const AddressFilter & other) const { return compare(other) == -1; }
+        inline bool operator > (const AddressFilter & other) const { return compare(other) == 1; }
+        inline bool operator == (const AddressFilter & other) const { return compare(other) == 0; }
+        inline bool operator <= (const AddressFilter & other) const { return compare(other) != 1; }
+        inline bool operator >= (const AddressFilter & other) const { return compare(other) != -1; }
+        //@}
+    };
+    
+    //! List of #StExecutableImage::AddressFilter objects.
+    typedef std::list<AddressFilter> AddressFilterList;
+    
+    //! The exception class raised for the #ADDR_FILTER_ERROR and #ADDR_FILTER_WARNING
+    //! filter actions.
+    class address_filter_exception
+    {
+    public:
+        //! \brief Constructor.
+        //!
+        //! A local copy of \a matchingFilter is made, in case the image and/or filter
+        //! are on the stack and would be disposed of when the exception is raised.
+        address_filter_exception(bool isError, std::string & imageName, const AddressFilter & matchingFilter)
+        : m_isError(isError), m_imageName(imageName), m_filter(matchingFilter)
+        {
+        }
+        
+        //! \brief Returns true if the exception is an error. Otherwise the exception
+        //!     is for a warning.
+        inline bool isError() const { return m_isError; }
+        
+        //! \brief
+        inline std::string getImageName() const { return m_imageName; }
+        
+        //! \brief
+        inline const AddressFilter & getMatchingFilter() const { return m_filter; }
+    
+    protected:
+        bool m_isError;
+        std::string m_imageName;
+        AddressFilter m_filter;
+    };
+    
+public:
+       //! \brief Constructor.
+       StExecutableImage(int inAlignment=256);
+       
+       //! \brief Copy constructor.
+       StExecutableImage(const StExecutableImage & inOther);
+       
+       //! \brief Destructor.
+       virtual ~StExecutableImage();
+       
+       //! \name Image name
+       //! Methods for getting and setting the image name.
+       //@{
+       //! \brief Sets the image's name to \a inName.
+       virtual void setName(const std::string & inName);
+       
+       //! \brief Returns a copy of the image's name.
+       virtual std::string getName() const;
+       //@}
+       
+       //! \name Regions
+       //! Methods to add and access memory regions.
+       //@{
+       //! \brief Add a region to be filled with zeroes.
+       virtual void addFillRegion(uint32_t inAddress, unsigned inLength);
+       
+       //! \brief Add a region containing data to be loaded.
+       virtual void addTextRegion(uint32_t inAddress, const uint8_t * inData, unsigned inLength);
+       
+       //! \brief Returns the total number of regions.
+       //!
+       //! Note that this count may not be the same as the number of calls to
+       //! addFillRegion() and addTextRegion() due to region coalescing.
+       inline unsigned getRegionCount() const { return static_cast<unsigned>(m_image.size()); }
+       
+       //! \brief Returns a reference to the region specified by \a inIndex.
+       const MemoryRegion & getRegionAtIndex(unsigned inIndex) const;
+       
+    //! \brief Return an iterator to the first region.
+       inline const_iterator getRegionBegin() const { return m_image.begin(); }
+    
+    //! \brief Return an iterator to the next-after-last region.
+       inline const_iterator getRegionEnd() const { return m_image.end(); }
+       //@}
+       
+       //! \name Entry point
+       //@{
+       //! \brief Sets the entry point address.
+       inline void setEntryPoint(uint32_t inEntryAddress) { m_entry = inEntryAddress; m_hasEntry = true; }
+       
+       //! \brief Returns true if an entry point has been set.
+       inline bool hasEntryPoint() const { return m_hasEntry; }
+       
+       //! \brief Returns the entry point address.
+       inline uint32_t getEntryPoint() const { return hasEntryPoint() ? m_entry : 0; }
+       //@}
+    
+    //! \name Address filter
+    //@{
+    //! \brief Add a new address filter.
+    virtual void addAddressFilter(const AddressFilter & filter);
+    
+    //! \brief Add multiple address filters at once.
+    //!
+    //! The template argument \a _T must be an iterator or const iterator that
+    //! dereferences to an StExecutableImage::AddressFilter reference. All filters
+    //! from \a from to \a to will be added to the address filter list.
+    template<typename _T> void addAddressFilters(_T from, _T to)
+    {
+        _T it = from;
+        for (; it != to; ++it)
+        {
+            addAddressFilter(*it);
+        }
+    }
+    
+    //! \brief Remove all active filters.
+    virtual void clearAddressFilters();
+    
+    //! \brief Process all active filters and perform associated actions.
+    virtual void applyAddressFilters();
+    //@}
+       
+protected:
+       std::string m_name;     //!< The name of the image (can be a file name, for instance).
+       int m_alignment;        //!< The required address alignment for each memory region.
+       bool m_hasEntry;        //!< True if an entry point has been set.
+       uint32_t m_entry;       //!< Entry point address.
+       MemoryRegionList m_image;       //!< The memory regions.
+    AddressFilterList m_filters;    //!< List of active address filters.
+    
+    //! \brief Deletes the portion \a region that overlaps \a filter.
+    void cropRegionToFilter(MemoryRegion & region, const AddressFilter & filter);
+       
+       //! \brief Inserts the region in sorted order or merges with one already in the image.
+       void insertOrMergeRegion(MemoryRegion & inRegion);
+       
+       //! \brief Merges two memory regions into one.
+       void mergeRegions(MemoryRegion & inOldRegion, MemoryRegion & inNewRegion);
+};
+
+#endif // _StExecutableImage_h_
diff --git a/tools/elftosb/common/StSRecordFile.cpp b/tools/elftosb/common/StSRecordFile.cpp
new file mode 100644 (file)
index 0000000..1ad0872
--- /dev/null
@@ -0,0 +1,235 @@
+/*
+ * File:       StSRecordFile.cpp
+ *
+ * Copyright (c) Freescale Semiconductor, Inc. All rights reserved.
+ * See included license file for license details.
+ */
+
+#include "stdafx.h"
+#include "StSRecordFile.h"
+#include "string.h"
+
+StSRecordFile::StSRecordFile(std::istream & inStream)
+:      m_stream(inStream)
+{
+}
+
+//! Frees any data allocated as part of an S-record.
+StSRecordFile::~StSRecordFile()
+{
+       const_iterator it;
+       for (it = m_records.begin(); it != m_records.end(); it++)
+       {
+               SRecord & theRecord = (SRecord &)*it;
+               if (theRecord.m_data)
+               {
+                       delete [] theRecord.m_data;
+                       theRecord.m_data = NULL;
+               }
+       }
+}
+
+//! Just looks for "S[0-9]" as the first two characters of the file.
+bool StSRecordFile::isSRecordFile()
+{
+       int savePosition = m_stream.tellg();
+       m_stream.seekg(0, std::ios_base::beg);
+       
+       char buffer[2];
+       m_stream.read(buffer, 2);
+       bool isSRecord = (buffer[0] == 'S' && isdigit(buffer[1]));
+       
+       m_stream.seekg(savePosition, std::ios_base::beg);
+       
+       return isSRecord;
+}
+
+//! Extract records one line at a time and hand them to the parseLine()
+//! method. Either CR, LF, or CRLF line endings are supported. The input
+//! stream is read until EOF.
+//! The parse() method must be called after the object has been constructed
+//! before any of the records will become accessible.
+//! \exception StSRecordParseException will be thrown if any error occurs while
+//!            parsing the input.
+void StSRecordFile::parse()
+{
+       // back to start of stream
+       m_stream.seekg(0, std::ios_base::beg);
+       
+       std::string thisLine;
+       
+       do {
+               char thisChar;
+               m_stream.get(thisChar);
+               
+               if (thisChar == '\r' || thisChar == '\n')
+               {
+                       // skip the LF in a CRLF
+                       if (thisChar == '\r' && m_stream.peek() == '\n')
+                               m_stream.ignore();
+                       
+                       // parse line if it's not empty
+                       if (!thisLine.empty())
+                       {
+                               parseLine(thisLine);
+                       
+                               // reset line
+                               thisLine.clear();
+                       }
+               }
+               else
+               {
+                       thisLine += thisChar;
+               }
+       } while (!m_stream.eof());
+}
+
+bool StSRecordFile::isHexDigit(char c)
+{
+       return (isdigit(c) || (c >= 'a' && c <= 'f') || (c >= 'A' && c <= 'F'));
+}
+
+int StSRecordFile::hexDigitToInt(char digit)
+{
+       if (isdigit(digit))
+               return digit - '0';
+       else if (digit >= 'a' && digit <= 'f')
+               return 10 + digit - 'a';
+       else if (digit >= 'A' && digit <= 'F')
+               return 10 + digit - 'A';
+       
+       // unknow char
+       return 0;
+}
+
+//! \exception StSRecordParseException is thrown if either of the nibble characters
+//!            is not a valid hex digit.
+int StSRecordFile::readHexByte(std::string & inString, int inIndex)
+{
+       char nibbleCharHi= inString[inIndex];
+       char nibbleCharLo = inString[inIndex + 1];
+       
+       // must be hex digits
+       if (!(isHexDigit(nibbleCharHi) && isHexDigit(nibbleCharLo)))
+    {
+               throw StSRecordParseException("invalid hex digit");
+    }
+       
+       return (hexDigitToInt(nibbleCharHi) << 4) | hexDigitToInt(nibbleCharLo);
+}
+
+//! \brief Parses individual S-records.
+//!
+//! Takes a single S-record line as input and appends a new SRecord struct
+//! to the m_records vector.
+//! \exception StSRecordParseException will be thrown if any error occurs while
+//!            parsing \a inLine.
+void StSRecordFile::parseLine(std::string & inLine)
+{
+       int checksum = 0;
+       SRecord newRecord;
+       memset(&newRecord, 0, sizeof(newRecord));
+       
+       // must start with "S" and be at least a certain length
+       if (inLine[0] != SRECORD_START_CHAR && inLine.length() >= SRECORD_MIN_LENGTH)
+    {
+        throw StSRecordParseException("invalid record length");
+    }
+
+       // parse type field
+       char typeChar = inLine[1];
+       if (!isdigit(typeChar))
+    {
+               throw StSRecordParseException("invalid S-record type");
+    }
+       newRecord.m_type = typeChar - '0';
+       
+       // parse count field
+       newRecord.m_count = readHexByte(inLine, 2);
+       checksum += newRecord.m_count;
+       
+       // verify the record length now that we know the count
+       if (inLine.length() != 4 + newRecord.m_count * 2)
+    {
+               throw StSRecordParseException("invalid record length");
+    }
+       
+       // get address length
+       int addressLength;      // len in bytes
+       bool hasData = false;
+       switch (newRecord.m_type)
+       {
+               case 0:     // contains header information
+                       addressLength = 2;
+                       hasData = true;
+                       break;
+               case 1:     // data record with 2-byte address
+                       addressLength = 2;
+                       hasData = true;
+                       break;
+               case 2:     // data record with 3-byte address
+                       addressLength = 3;
+                       hasData = true;
+                       break;
+               case 3:     // data record with 4-byte address
+                       addressLength = 4;
+                       hasData = true;
+                       break;
+               case 5:     // the 2-byte address field contains a count of all prior S1, S2, and S3 records
+                       addressLength = 2;
+                       break;
+               case 7:     // entry point record with 4-byte address
+                       addressLength = 4;
+                       break;
+               case 8:     // entry point record with 3-byte address
+                       addressLength = 3;
+                       break;
+               case 9:     // entry point record with 2-byte address
+                       addressLength = 2;
+                       break;
+               default:
+                       // unrecognized type
+                       //throw StSRecordParseException("unknown S-record type");
+            break;
+       }
+       
+       // read address
+       int address = 0;
+       int i;
+       for (i=0; i < addressLength; ++i)
+       {
+               int addressByte = readHexByte(inLine, SRECORD_ADDRESS_START_CHAR_INDEX + i * 2);
+               address = (address << 8) | addressByte;
+               checksum += addressByte;
+       }
+       newRecord.m_address = address;
+               
+       // read data
+       if (hasData)
+       {
+               int dataStartCharIndex = 4 + addressLength * 2;
+               int dataLength = newRecord.m_count - addressLength - 1; // total rem - addr - cksum (in bytes)
+               uint8_t * data = new uint8_t[dataLength];
+               
+               for (i=0; i < dataLength; ++i)
+               {
+                       int dataByte = readHexByte(inLine, dataStartCharIndex + i * 2);
+                       data[i] = dataByte;
+                       checksum += dataByte;
+               }
+               
+               newRecord.m_data = data;
+               newRecord.m_dataCount = dataLength;
+       }
+       
+       // read and compare checksum byte
+       checksum = (~checksum) & 0xff;  // low byte of one's complement of sum of other bytes
+       newRecord.m_checksum = readHexByte(inLine, (int)inLine.length() - 2);
+       if (checksum != newRecord.m_checksum)
+    {
+               throw StSRecordParseException("invalid checksum");
+    }
+       
+       // now save the new S-record
+       m_records.push_back(newRecord);
+}
diff --git a/tools/elftosb/common/StSRecordFile.h b/tools/elftosb/common/StSRecordFile.h
new file mode 100644 (file)
index 0000000..4340c6a
--- /dev/null
@@ -0,0 +1,119 @@
+/*
+ * File:       StSRecordFile.h
+ *
+ * Copyright (c) Freescale Semiconductor, Inc. All rights reserved.
+ * See included license file for license details.
+ */
+#if !defined(_StSRecordFile_h_)
+#define _StSRecordFile_h_
+
+//#include <stdint.h>
+#include "stdafx.h"
+#include <istream>
+#include <string>
+#include <vector>
+#include <stdexcept>
+
+enum {
+       //! The required first character of an S-record.
+       SRECORD_START_CHAR = 'S',
+       
+       //! The minimum length of a S-record. This is the type (2) + count (2) + addr (4) + cksum (2).
+       SRECORD_MIN_LENGTH = 10,
+       
+       //! Index of the first character of the address field.
+       SRECORD_ADDRESS_START_CHAR_INDEX = 4
+};
+
+/*!
+ * \brief S-record parser.
+ *
+ * This class takes an input stream and parses it as an S-record file. While
+ * the individual records that comprise the file are available for access, the
+ * class also provides a higher-level view of the contents. It processes the
+ * individual records and builds an image of what the memory touched by the
+ * file looks like. Then you can access the contiguous sections of memory.
+ */
+class StSRecordFile
+{
+public:
+       /*!
+        * Structure representing each individual line of the S-record input data.
+        */
+       struct SRecord
+       {
+               unsigned m_type;                //!< Record number type, such as 9 for "S9", 3 for "S3" and so on.
+               unsigned m_count;               //!< Number of character pairs (bytes) from address through checksum.
+               uint32_t m_address;                     //!< The address specified as part of the S-record.
+               unsigned m_dataCount;   //!< Number of bytes of data.
+               uint8_t * m_data;                       //!< Pointer to data, or NULL if no data for this record type.
+               uint8_t m_checksum;                     //!< The checksum byte present in the S-record.
+       };
+       
+       //! Iterator type.
+       typedef std::vector<SRecord>::const_iterator const_iterator;
+       
+public:
+       //! \brief Constructor.
+       StSRecordFile(std::istream & inStream);
+       
+       //! \brief Destructor.
+       virtual ~StSRecordFile();
+
+       //! \name File name
+       //@{
+       virtual void setName(const std::string & inName) { m_name = inName; }
+       virtual std::string getName() const { return m_name; }
+       //@}
+       
+       //! \name Parsing
+       //@{
+       //! \brief Determine if the file is an S-record file.
+       virtual bool isSRecordFile();
+       
+       //! \brief Parses the entire S-record input stream.
+       virtual void parse();
+       //@}
+       
+       //! \name Record access
+       //@{
+       //! \return the number of S-records that have been parsed from the input stream.
+       inline unsigned getRecordCount() const { return static_cast<unsigned>(m_records.size()); }
+       
+       //! \return iterator for 
+       inline const_iterator getBegin() const { return m_records.begin(); }
+       inline const_iterator getEnd() const { return m_records.end(); }
+       //@}
+       
+       //! \name Operators
+       //@{
+       inline const SRecord & operator [] (unsigned inIndex) { return m_records[inIndex]; }
+       //@}
+       
+protected:
+       std::istream& m_stream; //!< The input stream for the S-record data.
+       std::vector<SRecord> m_records; //!< Vector of S-records in the input data.
+
+    std::string m_name;                        //!< File name. (optional)
+
+       //! \name Parsing utilities
+       //@{
+       virtual void parseLine(std::string & inLine);
+       
+       bool isHexDigit(char c);
+       int hexDigitToInt(char digit);
+       int readHexByte(std::string & inString, int inIndex);
+       //@}
+};
+
+/*!
+ * \brief Simple exception thrown to indicate an error in the input SRecord data format.
+ */
+class StSRecordParseException : public std::runtime_error
+{
+public:
+    //! \brief Default constructor.
+    StSRecordParseException(const std::string & inMessage) : std::runtime_error(inMessage) {}
+};
+
+#endif // _StSRecordFile_h_
diff --git a/tools/elftosb/common/StringMatcher.h b/tools/elftosb/common/StringMatcher.h
new file mode 100644 (file)
index 0000000..e8074ff
--- /dev/null
@@ -0,0 +1,62 @@
+/*
+ * File:       GlobSectionSelector.h
+ *
+ * Copyright (c) Freescale Semiconductor, Inc. All rights reserved.
+ * See included license file for license details.
+ */
+#if !defined(_StringMatcher_h_)
+#define _StringMatcher_h_
+
+#include <string>
+
+namespace elftosb
+{
+
+/*!
+ * \brief Abstract interface class used to select strings by name.
+ */
+class StringMatcher
+{
+public:
+       //! \brief Performs a single string match test against testValue.
+       //!
+       //! \retval true The \a testValue argument matches.
+       //! \retval false No match was made against the argument.
+       virtual bool match(const std::string & testValue)=0;
+};
+
+/*!
+ * \brief String matcher subclass that matches all test strings.
+ */
+class WildcardMatcher : public StringMatcher
+{
+public:
+       //! \brief Always returns true, indicating a positive match.
+       virtual bool match(const std::string & testValue) { return true; }
+};
+
+/*!
+ * \brief Simple string matcher that compares against a fixed value.
+ */
+class FixedMatcher : public StringMatcher
+{
+public:
+       //! \brief Constructor. Sets the string to compare against to be \a fixedValue.
+       FixedMatcher(const std::string & fixedValue) : m_value(fixedValue) {}
+       
+       //! \brief Returns whether \a testValue is the same as the value passed to the constructor.
+       //!
+       //! \retval true The \a testValue argument matches the fixed compare value.
+       //! \retval false The argument is not the same as the compare value.
+       virtual bool match(const std::string & testValue)
+       {
+               return testValue == m_value;
+       }
+
+protected:
+       const std::string & m_value;    //!< The section name to look for.
+};
+
+}; // namespace elftosb
+
+#endif // _StringMatcher_h_
diff --git a/tools/elftosb/common/Value.cpp b/tools/elftosb/common/Value.cpp
new file mode 100644 (file)
index 0000000..5a6a034
--- /dev/null
@@ -0,0 +1,43 @@
+/*
+ * File:       Value.cpp
+ *
+ * Copyright (c) Freescale Semiconductor, Inc. All rights reserved.
+ * See included license file for license details.
+ */
+
+#include "Value.h"
+
+using namespace elftosb;
+
+//! Returns a varying size depending on the word size attribute.
+//!
+size_t SizedIntegerValue::getSize() const
+{
+       switch (m_size)
+       {
+               case kWordSize:
+                       return sizeof(uint32_t);
+               case kHalfWordSize:
+                       return sizeof(uint16_t);
+               case kByteSize:
+                       return sizeof(uint8_t);
+       }
+       return kWordSize;
+}
+
+//! The resulting mask can be used to truncate the integer value to be
+//! certain it doesn't extend beyond the associated word size.
+uint32_t SizedIntegerValue::getWordSizeMask() const
+{
+       switch (m_size)
+       {
+               case kWordSize:
+                       return 0xffffffff;
+               case kHalfWordSize:
+                       return 0x0000ffff;
+               case kByteSize:
+                       return 0x000000ff;
+       }
+       return 0;
+}
+
diff --git a/tools/elftosb/common/Value.h b/tools/elftosb/common/Value.h
new file mode 100644 (file)
index 0000000..8a676d5
--- /dev/null
@@ -0,0 +1,138 @@
+/*
+ * File:       Value.h
+ *
+ * Copyright (c) Freescale Semiconductor, Inc. All rights reserved.
+ * See included license file for license details.
+ */
+#if !defined(_Value_h_)
+#define _Value_h_
+
+#include "stdafx.h"
+#include <string>
+#include "int_size.h"
+#include "Blob.h"
+
+namespace elftosb
+{
+
+/*!
+ * \brief Abstract base class for values of arbitrary types.
+ */
+class Value
+{
+public:
+       Value() {}
+       virtual ~Value() {}
+       
+       virtual std::string getTypeName() const = 0;
+       virtual size_t getSize() const = 0;
+};
+
+/*!
+ * \brief 32-bit signed integer value.
+ */
+class IntegerValue : public Value
+{
+public:
+       IntegerValue() : m_value(0) {}
+       IntegerValue(uint32_t value) : m_value(value) {}
+       IntegerValue(const IntegerValue & other) : m_value(other.m_value) {}
+       
+       virtual std::string getTypeName() const { return "integer"; }
+       virtual size_t getSize() const { return sizeof(m_value); }
+       
+       inline uint32_t getValue() const { return m_value; }
+       
+       inline operator uint32_t () const { return m_value; }
+       
+       inline IntegerValue & operator = (uint32_t value) { m_value = value; return *this; }
+
+protected:
+       uint32_t m_value;       //!< The integer value.
+};
+
+/*!
+ * \brief Adds a word size attribute to IntegerValue.
+ *
+ * The word size really only acts as an attribute that is carried along
+ * with the integer value. It doesn't affect the actual value at all.
+ * However, you can use the getWordSizeMask() method to mask off bits
+ * that should not be there.
+ *
+ * The word size defaults to a 32-bit word.
+ */
+class SizedIntegerValue : public IntegerValue
+{
+public:
+       SizedIntegerValue() : IntegerValue(), m_size(kWordSize) {}
+       SizedIntegerValue(uint32_t value, int_size_t size=kWordSize) : IntegerValue(value), m_size(size) {}
+       SizedIntegerValue(uint16_t value) : IntegerValue(value), m_size(kHalfWordSize) {}
+       SizedIntegerValue(uint8_t value) : IntegerValue(value), m_size(kByteSize) {}
+       SizedIntegerValue(const SizedIntegerValue & other) : IntegerValue(other), m_size(other.m_size) {}
+       
+       virtual std::string getTypeName() const { return "sized integer"; }
+       virtual size_t getSize() const;
+       
+       inline int_size_t getWordSize() const { return m_size; }
+       inline void setWordSize(int_size_t size) { m_size = size; }
+       
+       //! \brief Returns a 32-bit mask value dependant on the word size attribute.
+       uint32_t getWordSizeMask() const;
+       
+       //! \name Assignment operators
+       //! These operators set the word size as well as the integer value.
+       //@{
+       SizedIntegerValue & operator = (uint8_t value) { m_value = value; m_size = kByteSize; return *this; }
+       SizedIntegerValue & operator = (uint16_t value) { m_value = value; m_size = kHalfWordSize; return *this; }
+       SizedIntegerValue & operator = (uint32_t value) { m_value = value; m_size = kWordSize; return *this; }
+       //@}
+       
+protected:
+       int_size_t m_size;      //!< Size of the integer.
+};
+
+/*!
+ * \brief String value.
+ *
+ * Simply wraps the STL std::string class.
+ */
+class StringValue : public Value
+{
+public:
+       StringValue() : m_value() {}
+       StringValue(const std::string & value) : m_value(value) {}
+       StringValue(const std::string * value) : m_value(*value) {}
+       StringValue(const StringValue & other) : m_value(other.m_value) {}
+       
+       virtual std::string getTypeName() const { return "string"; }
+       virtual size_t getSize() const { return m_value.size(); }
+       
+       operator const char * () const { return m_value.c_str(); }
+       operator const std::string & () const { return m_value; }
+       operator std::string & () { return m_value; }
+       operator const std::string * () { return &m_value; }
+       operator std::string * () { return &m_value; }
+       
+       StringValue & operator = (const StringValue & other) { m_value = other.m_value; return *this; }
+       StringValue & operator = (const std::string & value) { m_value = value; return *this; }
+       StringValue & operator = (const char * value) { m_value = value; return *this; }
+       
+protected:
+       std::string m_value;
+};
+
+/*!
+ * \brief Binary object value of arbitrary size.
+ */
+class BinaryValue : public Value, public Blob
+{
+public:
+       BinaryValue() : Value(), Blob() {}
+       
+       virtual std::string getTypeName() const { return "binary"; }
+       virtual size_t getSize() const { return getLength(); }
+};
+
+}; // namespace elftosb
+
+#endif // _Value_h_
diff --git a/tools/elftosb/common/Version.cpp b/tools/elftosb/common/Version.cpp
new file mode 100644 (file)
index 0000000..5d40d67
--- /dev/null
@@ -0,0 +1,143 @@
+/*
+ * File:       Version.cpp
+ *
+ * Copyright (c) Freescale Semiconductor, Inc. All rights reserved.
+ * See included license file for license details.
+ */
+
+#include "Version.h"
+#include "EndianUtilities.h"
+
+using namespace elftosb;
+
+/*!
+ * Parses a string in the form "xxx.xxx.xxx" (where x is a digit) into
+ * three version fields for major, minor, and revision. The output is
+ * right aligned BCD in host-natural byte order.
+ *
+ * \param versionString String containing the version.
+ */
+void version_t::set(const std::string & versionString)
+{
+       size_t length = versionString.size();
+       unsigned version = 0;
+       unsigned index = 0;
+       
+       typedef enum {
+               kVersionStateNone,
+               kVersionStateMajor,
+               kVersionStateMinor,
+               kVersionStateRevision
+       } VersionParseState;
+       
+       // set initial versions to 0s
+       m_major = 0;
+       m_minor = 0;
+       m_revision = 0;
+       
+       VersionParseState parseState = kVersionStateNone;
+       bool done = false;
+       for (; index < length && !done; ++index)
+       {
+               char c = versionString[index];
+               
+               if (isdigit(c))
+               {
+                       switch (parseState)
+                       {
+                               case kVersionStateNone:
+                                       parseState = kVersionStateMajor;
+                                       version = c - '0';
+                                       break;
+                               case kVersionStateMajor:
+                               case kVersionStateMinor:
+                               case kVersionStateRevision:
+                                       version = (version << 4) | (c - '0');
+                                       break;
+                       }
+               }
+               else if (c == '.')
+               {
+                       switch (parseState)
+                       {
+                               case kVersionStateNone:
+                                       parseState = kVersionStateNone;
+                                       break;
+                               case kVersionStateMajor:
+                                       m_major = version;
+                                       version = 0;
+                                       parseState = kVersionStateMinor;
+                                       break;
+                               case kVersionStateMinor:
+                                       m_minor = version;
+                                       version = 0;
+                                       parseState = kVersionStateRevision;
+                                       break;
+                               case kVersionStateRevision:
+                                       m_revision = version;
+                                       version = 0;
+                                       done = true;
+                                       break;
+                       }
+               }
+               else
+               {
+                       switch (parseState)
+                       {
+                               case kVersionStateNone:
+                                       parseState = kVersionStateNone;
+                                       break;
+                               case kVersionStateMajor:
+                                       m_major = version;
+                                       done = true;
+                                       break;
+                               case kVersionStateMinor:
+                                       m_minor = version;
+                                       done = true;
+                                       break;
+                               case kVersionStateRevision:
+                                       m_revision = version;
+                                       done = true;
+                                       break;
+                       }
+               }
+       }
+       
+       switch (parseState)
+       {
+               case kVersionStateMajor:
+                       m_major = version;
+                       break;
+               case kVersionStateMinor:
+                       m_minor = version;
+                       break;
+               case kVersionStateRevision:
+                       m_revision = version;
+                       break;
+               default:
+                       // do nothing
+                       break;
+       }
+}
+
+//! \brief Converts host endian BCD version values to the equivalent big-endian BCD values.
+//!
+//! The output is a half-word. And BCD is inherently big-endian, or byte ordered, if
+//! you prefer to think of it that way. So for little endian systems, we need to convert
+//! the output half-word in reverse byte order. When it is written to disk or a
+//! buffer it will come out big endian.
+//!
+//! For example:
+//!     - The input is BCD in host endian format, so 0x1234. Written to a file, this would
+//!       come out as 0x34 0x12, reverse of what we want.
+//!     - The desired BCD output is the two bytes 0x12 0x34.
+//!     - So the function's uint16_t result must be 0x3412 on a little-endian host.
+//!
+//! On big endian hosts, we don't have to worry about byte swapping.
+void version_t::fixByteOrder()
+{
+       m_major = ENDIAN_HOST_TO_BIG_U16(m_major);
+       m_minor = ENDIAN_HOST_TO_BIG_U16(m_minor);
+       m_revision = ENDIAN_HOST_TO_BIG_U16(m_revision);
+}
+
diff --git a/tools/elftosb/common/Version.h b/tools/elftosb/common/Version.h
new file mode 100644 (file)
index 0000000..9533586
--- /dev/null
@@ -0,0 +1,51 @@
+/*
+ * File:       Version.h
+ *
+ * Copyright (c) Freescale Semiconductor, Inc. All rights reserved.
+ * See included license file for license details.
+ */
+#if !defined(_Version_h_)
+#define _Version_h_
+
+#include <string>
+#include "stdafx.h"
+
+namespace elftosb
+{
+
+//! Same version struct used for 3600 boot image.
+struct version_t
+{
+       uint16_t m_major;
+       uint16_t m_pad0;
+       uint16_t m_minor;
+       uint16_t m_pad1;
+       uint16_t m_revision;
+       uint16_t m_pad2;
+       
+       version_t()
+       :       m_major(0x999), m_pad0(0), m_minor(0x999), m_pad1(0), m_revision(0x999), m_pad2(0)
+       {
+       }
+       
+       version_t(uint16_t maj, uint16_t min, uint16_t rev)
+       :       m_major(maj), m_pad0(0), m_minor(min), m_pad1(0), m_revision(rev), m_pad2(0)
+       {
+       }
+       
+       version_t(const std::string & versionString)
+       :       m_major(0x999), m_pad0(0), m_minor(0x999), m_pad1(0), m_revision(0x999), m_pad2(0)
+       {
+               set(versionString);
+       }
+       
+       //! \brief Sets the version by parsing a string.
+       void set(const std::string & versionString);
+
+       //! \brief
+       void fixByteOrder();
+};
+
+}; // namespace elftosb
+
+#endif // _Version_h_
diff --git a/tools/elftosb/common/crc.cpp b/tools/elftosb/common/crc.cpp
new file mode 100644 (file)
index 0000000..8c32819
--- /dev/null
@@ -0,0 +1,292 @@
+/*
+ * File:       crc.cpp
+ *
+ * Copyright (c) Freescale Semiconductor, Inc. All rights reserved.
+ * See included license file for license details.
+ */
+
+#include "crc.h"
+
+//! Table of CRC-32's of all single byte values. The values in
+//! this table are those used in the Ethernet CRC algorithm.
+const uint32_t CRC32::m_tab[] = {
+//#ifdef __LITTLE_ENDIAN__
+    0x00000000,
+    0x04c11db7, 0x09823b6e, 0x0d4326d9, 0x130476dc, 0x17c56b6b,
+    0x1a864db2, 0x1e475005, 0x2608edb8, 0x22c9f00f, 0x2f8ad6d6,
+    0x2b4bcb61, 0x350c9b64, 0x31cd86d3, 0x3c8ea00a, 0x384fbdbd,
+    0x4c11db70, 0x48d0c6c7, 0x4593e01e, 0x4152fda9, 0x5f15adac,
+    0x5bd4b01b, 0x569796c2, 0x52568b75, 0x6a1936c8, 0x6ed82b7f,
+    0x639b0da6, 0x675a1011, 0x791d4014, 0x7ddc5da3, 0x709f7b7a,
+    0x745e66cd, 0x9823b6e0, 0x9ce2ab57, 0x91a18d8e, 0x95609039,
+    0x8b27c03c, 0x8fe6dd8b, 0x82a5fb52, 0x8664e6e5, 0xbe2b5b58,
+    0xbaea46ef, 0xb7a96036, 0xb3687d81, 0xad2f2d84, 0xa9ee3033,
+    0xa4ad16ea, 0xa06c0b5d, 0xd4326d90, 0xd0f37027, 0xddb056fe,
+    0xd9714b49, 0xc7361b4c, 0xc3f706fb, 0xceb42022, 0xca753d95,
+    0xf23a8028, 0xf6fb9d9f, 0xfbb8bb46, 0xff79a6f1, 0xe13ef6f4,
+    0xe5ffeb43, 0xe8bccd9a, 0xec7dd02d, 0x34867077, 0x30476dc0,
+    0x3d044b19, 0x39c556ae, 0x278206ab, 0x23431b1c, 0x2e003dc5,
+    0x2ac12072, 0x128e9dcf, 0x164f8078, 0x1b0ca6a1, 0x1fcdbb16,
+    0x018aeb13, 0x054bf6a4, 0x0808d07d, 0x0cc9cdca, 0x7897ab07,
+    0x7c56b6b0, 0x71159069, 0x75d48dde, 0x6b93dddb, 0x6f52c06c,
+    0x6211e6b5, 0x66d0fb02, 0x5e9f46bf, 0x5a5e5b08, 0x571d7dd1,
+    0x53dc6066, 0x4d9b3063, 0x495a2dd4, 0x44190b0d, 0x40d816ba,
+    0xaca5c697, 0xa864db20, 0xa527fdf9, 0xa1e6e04e, 0xbfa1b04b,
+    0xbb60adfc, 0xb6238b25, 0xb2e29692, 0x8aad2b2f, 0x8e6c3698,
+    0x832f1041, 0x87ee0df6, 0x99a95df3, 0x9d684044, 0x902b669d,
+    0x94ea7b2a, 0xe0b41de7, 0xe4750050, 0xe9362689, 0xedf73b3e,
+    0xf3b06b3b, 0xf771768c, 0xfa325055, 0xfef34de2, 0xc6bcf05f,
+    0xc27dede8, 0xcf3ecb31, 0xcbffd686, 0xd5b88683, 0xd1799b34,
+    0xdc3abded, 0xd8fba05a, 0x690ce0ee, 0x6dcdfd59, 0x608edb80,
+    0x644fc637, 0x7a089632, 0x7ec98b85, 0x738aad5c, 0x774bb0eb,
+    0x4f040d56, 0x4bc510e1, 0x46863638, 0x42472b8f, 0x5c007b8a,
+    0x58c1663d, 0x558240e4, 0x51435d53, 0x251d3b9e, 0x21dc2629,
+    0x2c9f00f0, 0x285e1d47, 0x36194d42, 0x32d850f5, 0x3f9b762c,
+    0x3b5a6b9b, 0x0315d626, 0x07d4cb91, 0x0a97ed48, 0x0e56f0ff,
+    0x1011a0fa, 0x14d0bd4d, 0x19939b94, 0x1d528623, 0xf12f560e,
+    0xf5ee4bb9, 0xf8ad6d60, 0xfc6c70d7, 0xe22b20d2, 0xe6ea3d65,
+    0xeba91bbc, 0xef68060b, 0xd727bbb6, 0xd3e6a601, 0xdea580d8,
+    0xda649d6f, 0xc423cd6a, 0xc0e2d0dd, 0xcda1f604, 0xc960ebb3,
+    0xbd3e8d7e, 0xb9ff90c9, 0xb4bcb610, 0xb07daba7, 0xae3afba2,
+    0xaafbe615, 0xa7b8c0cc, 0xa379dd7b, 0x9b3660c6, 0x9ff77d71,
+    0x92b45ba8, 0x9675461f, 0x8832161a, 0x8cf30bad, 0x81b02d74,
+    0x857130c3, 0x5d8a9099, 0x594b8d2e, 0x5408abf7, 0x50c9b640,
+    0x4e8ee645, 0x4a4ffbf2, 0x470cdd2b, 0x43cdc09c, 0x7b827d21,
+    0x7f436096, 0x7200464f, 0x76c15bf8, 0x68860bfd, 0x6c47164a,
+    0x61043093, 0x65c52d24, 0x119b4be9, 0x155a565e, 0x18197087,
+    0x1cd86d30, 0x029f3d35, 0x065e2082, 0x0b1d065b, 0x0fdc1bec,
+    0x3793a651, 0x3352bbe6, 0x3e119d3f, 0x3ad08088, 0x2497d08d,
+    0x2056cd3a, 0x2d15ebe3, 0x29d4f654, 0xc5a92679, 0xc1683bce,
+    0xcc2b1d17, 0xc8ea00a0, 0xd6ad50a5, 0xd26c4d12, 0xdf2f6bcb,
+    0xdbee767c, 0xe3a1cbc1, 0xe760d676, 0xea23f0af, 0xeee2ed18,
+    0xf0a5bd1d, 0xf464a0aa, 0xf9278673, 0xfde69bc4, 0x89b8fd09,
+    0x8d79e0be, 0x803ac667, 0x84fbdbd0, 0x9abc8bd5, 0x9e7d9662,
+    0x933eb0bb, 0x97ffad0c, 0xafb010b1, 0xab710d06, 0xa6322bdf,
+    0xa2f33668, 0xbcb4666d, 0xb8757bda, 0xb5365d03, 0xb1f740b4
+//#else
+//    0x00000000,
+//    0xb71dc104, 0x6e3b8209, 0xd926430d, 0xdc760413, 0x6b6bc517,
+//    0xb24d861a, 0x0550471e, 0xb8ed0826, 0x0ff0c922, 0xd6d68a2f,
+//    0x61cb4b2b, 0x649b0c35, 0xd386cd31, 0x0aa08e3c, 0xbdbd4f38,
+//    0x70db114c, 0xc7c6d048, 0x1ee09345, 0xa9fd5241, 0xacad155f,
+//    0x1bb0d45b, 0xc2969756, 0x758b5652, 0xc836196a, 0x7f2bd86e,
+//    0xa60d9b63, 0x11105a67, 0x14401d79, 0xa35ddc7d, 0x7a7b9f70,
+//    0xcd665e74, 0xe0b62398, 0x57abe29c, 0x8e8da191, 0x39906095,
+//    0x3cc0278b, 0x8bdde68f, 0x52fba582, 0xe5e66486, 0x585b2bbe,
+//    0xef46eaba, 0x3660a9b7, 0x817d68b3, 0x842d2fad, 0x3330eea9,
+//    0xea16ada4, 0x5d0b6ca0, 0x906d32d4, 0x2770f3d0, 0xfe56b0dd,
+//    0x494b71d9, 0x4c1b36c7, 0xfb06f7c3, 0x2220b4ce, 0x953d75ca,
+//    0x28803af2, 0x9f9dfbf6, 0x46bbb8fb, 0xf1a679ff, 0xf4f63ee1,
+//    0x43ebffe5, 0x9acdbce8, 0x2dd07dec, 0x77708634, 0xc06d4730,
+//    0x194b043d, 0xae56c539, 0xab068227, 0x1c1b4323, 0xc53d002e,
+//    0x7220c12a, 0xcf9d8e12, 0x78804f16, 0xa1a60c1b, 0x16bbcd1f,
+//    0x13eb8a01, 0xa4f64b05, 0x7dd00808, 0xcacdc90c, 0x07ab9778,
+//    0xb0b6567c, 0x69901571, 0xde8dd475, 0xdbdd936b, 0x6cc0526f,
+//    0xb5e61162, 0x02fbd066, 0xbf469f5e, 0x085b5e5a, 0xd17d1d57,
+//    0x6660dc53, 0x63309b4d, 0xd42d5a49, 0x0d0b1944, 0xba16d840,
+//    0x97c6a5ac, 0x20db64a8, 0xf9fd27a5, 0x4ee0e6a1, 0x4bb0a1bf,
+//    0xfcad60bb, 0x258b23b6, 0x9296e2b2, 0x2f2bad8a, 0x98366c8e,
+//    0x41102f83, 0xf60dee87, 0xf35da999, 0x4440689d, 0x9d662b90,
+//    0x2a7bea94, 0xe71db4e0, 0x500075e4, 0x892636e9, 0x3e3bf7ed,
+//    0x3b6bb0f3, 0x8c7671f7, 0x555032fa, 0xe24df3fe, 0x5ff0bcc6,
+//    0xe8ed7dc2, 0x31cb3ecf, 0x86d6ffcb, 0x8386b8d5, 0x349b79d1,
+//    0xedbd3adc, 0x5aa0fbd8, 0xeee00c69, 0x59fdcd6d, 0x80db8e60,
+//    0x37c64f64, 0x3296087a, 0x858bc97e, 0x5cad8a73, 0xebb04b77,
+//    0x560d044f, 0xe110c54b, 0x38368646, 0x8f2b4742, 0x8a7b005c,
+//    0x3d66c158, 0xe4408255, 0x535d4351, 0x9e3b1d25, 0x2926dc21,
+//    0xf0009f2c, 0x471d5e28, 0x424d1936, 0xf550d832, 0x2c769b3f,
+//    0x9b6b5a3b, 0x26d61503, 0x91cbd407, 0x48ed970a, 0xfff0560e,
+//    0xfaa01110, 0x4dbdd014, 0x949b9319, 0x2386521d, 0x0e562ff1,
+//    0xb94beef5, 0x606dadf8, 0xd7706cfc, 0xd2202be2, 0x653deae6,
+//    0xbc1ba9eb, 0x0b0668ef, 0xb6bb27d7, 0x01a6e6d3, 0xd880a5de,
+//    0x6f9d64da, 0x6acd23c4, 0xddd0e2c0, 0x04f6a1cd, 0xb3eb60c9,
+//    0x7e8d3ebd, 0xc990ffb9, 0x10b6bcb4, 0xa7ab7db0, 0xa2fb3aae,
+//    0x15e6fbaa, 0xccc0b8a7, 0x7bdd79a3, 0xc660369b, 0x717df79f,
+//    0xa85bb492, 0x1f467596, 0x1a163288, 0xad0bf38c, 0x742db081,
+//    0xc3307185, 0x99908a5d, 0x2e8d4b59, 0xf7ab0854, 0x40b6c950,
+//    0x45e68e4e, 0xf2fb4f4a, 0x2bdd0c47, 0x9cc0cd43, 0x217d827b,
+//    0x9660437f, 0x4f460072, 0xf85bc176, 0xfd0b8668, 0x4a16476c,
+//    0x93300461, 0x242dc565, 0xe94b9b11, 0x5e565a15, 0x87701918,
+//    0x306dd81c, 0x353d9f02, 0x82205e06, 0x5b061d0b, 0xec1bdc0f,
+//    0x51a69337, 0xe6bb5233, 0x3f9d113e, 0x8880d03a, 0x8dd09724,
+//    0x3acd5620, 0xe3eb152d, 0x54f6d429, 0x7926a9c5, 0xce3b68c1,
+//    0x171d2bcc, 0xa000eac8, 0xa550add6, 0x124d6cd2, 0xcb6b2fdf,
+//    0x7c76eedb, 0xc1cba1e3, 0x76d660e7, 0xaff023ea, 0x18ede2ee,
+//    0x1dbda5f0, 0xaaa064f4, 0x738627f9, 0xc49be6fd, 0x09fdb889,
+//    0xbee0798d, 0x67c63a80, 0xd0dbfb84, 0xd58bbc9a, 0x62967d9e,
+//    0xbbb03e93, 0x0cadff97, 0xb110b0af, 0x060d71ab, 0xdf2b32a6,
+//    0x6836f3a2, 0x6d66b4bc, 0xda7b75b8, 0x035d36b5, 0xb440f7b1
+//#endif // __LITTLE_ENDIAN__
+
+// This is the original table that came with this source.
+//#ifdef __LITTLE_ENDIAN__
+//     0x00000000L, 0x77073096L, 0xee0e612cL, 0x990951baL, 0x076dc419L,
+//     0x706af48fL, 0xe963a535L, 0x9e6495a3L, 0x0edb8832L, 0x79dcb8a4L,
+//     0xe0d5e91eL, 0x97d2d988L, 0x09b64c2bL, 0x7eb17cbdL, 0xe7b82d07L,
+//     0x90bf1d91L, 0x1db71064L, 0x6ab020f2L, 0xf3b97148L, 0x84be41deL,
+//     0x1adad47dL, 0x6ddde4ebL, 0xf4d4b551L, 0x83d385c7L, 0x136c9856L,
+//     0x646ba8c0L, 0xfd62f97aL, 0x8a65c9ecL, 0x14015c4fL, 0x63066cd9L,
+//     0xfa0f3d63L, 0x8d080df5L, 0x3b6e20c8L, 0x4c69105eL, 0xd56041e4L,
+//     0xa2677172L, 0x3c03e4d1L, 0x4b04d447L, 0xd20d85fdL, 0xa50ab56bL,
+//     0x35b5a8faL, 0x42b2986cL, 0xdbbbc9d6L, 0xacbcf940L, 0x32d86ce3L,
+//     0x45df5c75L, 0xdcd60dcfL, 0xabd13d59L, 0x26d930acL, 0x51de003aL,
+//     0xc8d75180L, 0xbfd06116L, 0x21b4f4b5L, 0x56b3c423L, 0xcfba9599L,
+//     0xb8bda50fL, 0x2802b89eL, 0x5f058808L, 0xc60cd9b2L, 0xb10be924L,
+//     0x2f6f7c87L, 0x58684c11L, 0xc1611dabL, 0xb6662d3dL, 0x76dc4190L,
+//     0x01db7106L, 0x98d220bcL, 0xefd5102aL, 0x71b18589L, 0x06b6b51fL,
+//     0x9fbfe4a5L, 0xe8b8d433L, 0x7807c9a2L, 0x0f00f934L, 0x9609a88eL,
+//     0xe10e9818L, 0x7f6a0dbbL, 0x086d3d2dL, 0x91646c97L, 0xe6635c01L,
+//     0x6b6b51f4L, 0x1c6c6162L, 0x856530d8L, 0xf262004eL, 0x6c0695edL,
+//     0x1b01a57bL, 0x8208f4c1L, 0xf50fc457L, 0x65b0d9c6L, 0x12b7e950L,
+//     0x8bbeb8eaL, 0xfcb9887cL, 0x62dd1ddfL, 0x15da2d49L, 0x8cd37cf3L,
+//     0xfbd44c65L, 0x4db26158L, 0x3ab551ceL, 0xa3bc0074L, 0xd4bb30e2L,
+//     0x4adfa541L, 0x3dd895d7L, 0xa4d1c46dL, 0xd3d6f4fbL, 0x4369e96aL,
+//     0x346ed9fcL, 0xad678846L, 0xda60b8d0L, 0x44042d73L, 0x33031de5L,
+//     0xaa0a4c5fL, 0xdd0d7cc9L, 0x5005713cL, 0x270241aaL, 0xbe0b1010L,
+//     0xc90c2086L, 0x5768b525L, 0x206f85b3L, 0xb966d409L, 0xce61e49fL,
+//     0x5edef90eL, 0x29d9c998L, 0xb0d09822L, 0xc7d7a8b4L, 0x59b33d17L,
+//     0x2eb40d81L, 0xb7bd5c3bL, 0xc0ba6cadL, 0xedb88320L, 0x9abfb3b6L,
+//     0x03b6e20cL, 0x74b1d29aL, 0xead54739L, 0x9dd277afL, 0x04db2615L,
+//     0x73dc1683L, 0xe3630b12L, 0x94643b84L, 0x0d6d6a3eL, 0x7a6a5aa8L,
+//     0xe40ecf0bL, 0x9309ff9dL, 0x0a00ae27L, 0x7d079eb1L, 0xf00f9344L,
+//     0x8708a3d2L, 0x1e01f268L, 0x6906c2feL, 0xf762575dL, 0x806567cbL,
+//     0x196c3671L, 0x6e6b06e7L, 0xfed41b76L, 0x89d32be0L, 0x10da7a5aL,
+//     0x67dd4accL, 0xf9b9df6fL, 0x8ebeeff9L, 0x17b7be43L, 0x60b08ed5L,
+//     0xd6d6a3e8L, 0xa1d1937eL, 0x38d8c2c4L, 0x4fdff252L, 0xd1bb67f1L,
+//     0xa6bc5767L, 0x3fb506ddL, 0x48b2364bL, 0xd80d2bdaL, 0xaf0a1b4cL,
+//     0x36034af6L, 0x41047a60L, 0xdf60efc3L, 0xa867df55L, 0x316e8eefL,
+//     0x4669be79L, 0xcb61b38cL, 0xbc66831aL, 0x256fd2a0L, 0x5268e236L,
+//     0xcc0c7795L, 0xbb0b4703L, 0x220216b9L, 0x5505262fL, 0xc5ba3bbeL,
+//     0xb2bd0b28L, 0x2bb45a92L, 0x5cb36a04L, 0xc2d7ffa7L, 0xb5d0cf31L,
+//     0x2cd99e8bL, 0x5bdeae1dL, 0x9b64c2b0L, 0xec63f226L, 0x756aa39cL,
+//     0x026d930aL, 0x9c0906a9L, 0xeb0e363fL, 0x72076785L, 0x05005713L,
+//     0x95bf4a82L, 0xe2b87a14L, 0x7bb12baeL, 0x0cb61b38L, 0x92d28e9bL,
+//     0xe5d5be0dL, 0x7cdcefb7L, 0x0bdbdf21L, 0x86d3d2d4L, 0xf1d4e242L,
+//     0x68ddb3f8L, 0x1fda836eL, 0x81be16cdL, 0xf6b9265bL, 0x6fb077e1L,
+//     0x18b74777L, 0x88085ae6L, 0xff0f6a70L, 0x66063bcaL, 0x11010b5cL,
+//     0x8f659effL, 0xf862ae69L, 0x616bffd3L, 0x166ccf45L, 0xa00ae278L,
+//     0xd70dd2eeL, 0x4e048354L, 0x3903b3c2L, 0xa7672661L, 0xd06016f7L,
+//     0x4969474dL, 0x3e6e77dbL, 0xaed16a4aL, 0xd9d65adcL, 0x40df0b66L,
+//     0x37d83bf0L, 0xa9bcae53L, 0xdebb9ec5L, 0x47b2cf7fL, 0x30b5ffe9L,
+//     0xbdbdf21cL, 0xcabac28aL, 0x53b39330L, 0x24b4a3a6L, 0xbad03605L,
+//     0xcdd70693L, 0x54de5729L, 0x23d967bfL, 0xb3667a2eL, 0xc4614ab8L,
+//     0x5d681b02L, 0x2a6f2b94L, 0xb40bbe37L, 0xc30c8ea1L, 0x5a05df1bL,
+//     0x2d02ef8dL
+//#else
+//     0x00000000L, 0x96300777L, 0x2c610eeeL, 0xba510999L, 0x19c46d07L,
+//     0x8ff46a70L, 0x35a563e9L, 0xa395649eL, 0x3288db0eL, 0xa4b8dc79L,
+//     0x1ee9d5e0L, 0x88d9d297L, 0x2b4cb609L, 0xbd7cb17eL, 0x072db8e7L,
+//     0x911dbf90L, 0x6410b71dL, 0xf220b06aL, 0x4871b9f3L, 0xde41be84L,
+//     0x7dd4da1aL, 0xebe4dd6dL, 0x51b5d4f4L, 0xc785d383L, 0x56986c13L,
+//     0xc0a86b64L, 0x7af962fdL, 0xecc9658aL, 0x4f5c0114L, 0xd96c0663L,
+//     0x633d0ffaL, 0xf50d088dL, 0xc8206e3bL, 0x5e10694cL, 0xe44160d5L,
+//     0x727167a2L, 0xd1e4033cL, 0x47d4044bL, 0xfd850dd2L, 0x6bb50aa5L,
+//     0xfaa8b535L, 0x6c98b242L, 0xd6c9bbdbL, 0x40f9bcacL, 0xe36cd832L,
+//     0x755cdf45L, 0xcf0dd6dcL, 0x593dd1abL, 0xac30d926L, 0x3a00de51L,
+//     0x8051d7c8L, 0x1661d0bfL, 0xb5f4b421L, 0x23c4b356L, 0x9995bacfL,
+//     0x0fa5bdb8L, 0x9eb80228L, 0x0888055fL, 0xb2d90cc6L, 0x24e90bb1L,
+//     0x877c6f2fL, 0x114c6858L, 0xab1d61c1L, 0x3d2d66b6L, 0x9041dc76L,
+//     0x0671db01L, 0xbc20d298L, 0x2a10d5efL, 0x8985b171L, 0x1fb5b606L,
+//     0xa5e4bf9fL, 0x33d4b8e8L, 0xa2c90778L, 0x34f9000fL, 0x8ea80996L,
+//     0x18980ee1L, 0xbb0d6a7fL, 0x2d3d6d08L, 0x976c6491L, 0x015c63e6L,
+//     0xf4516b6bL, 0x62616c1cL, 0xd8306585L, 0x4e0062f2L, 0xed95066cL,
+//     0x7ba5011bL, 0xc1f40882L, 0x57c40ff5L, 0xc6d9b065L, 0x50e9b712L,
+//     0xeab8be8bL, 0x7c88b9fcL, 0xdf1ddd62L, 0x492dda15L, 0xf37cd38cL,
+//     0x654cd4fbL, 0x5861b24dL, 0xce51b53aL, 0x7400bca3L, 0xe230bbd4L,
+//     0x41a5df4aL, 0xd795d83dL, 0x6dc4d1a4L, 0xfbf4d6d3L, 0x6ae96943L,
+//     0xfcd96e34L, 0x468867adL, 0xd0b860daL, 0x732d0444L, 0xe51d0333L,
+//     0x5f4c0aaaL, 0xc97c0dddL, 0x3c710550L, 0xaa410227L, 0x10100bbeL,
+//     0x86200cc9L, 0x25b56857L, 0xb3856f20L, 0x09d466b9L, 0x9fe461ceL,
+//     0x0ef9de5eL, 0x98c9d929L, 0x2298d0b0L, 0xb4a8d7c7L, 0x173db359L,
+//     0x810db42eL, 0x3b5cbdb7L, 0xad6cbac0L, 0x2083b8edL, 0xb6b3bf9aL,
+//     0x0ce2b603L, 0x9ad2b174L, 0x3947d5eaL, 0xaf77d29dL, 0x1526db04L,
+//     0x8316dc73L, 0x120b63e3L, 0x843b6494L, 0x3e6a6d0dL, 0xa85a6a7aL,
+//     0x0bcf0ee4L, 0x9dff0993L, 0x27ae000aL, 0xb19e077dL, 0x44930ff0L,
+//     0xd2a30887L, 0x68f2011eL, 0xfec20669L, 0x5d5762f7L, 0xcb676580L,
+//     0x71366c19L, 0xe7066b6eL, 0x761bd4feL, 0xe02bd389L, 0x5a7ada10L,
+//     0xcc4add67L, 0x6fdfb9f9L, 0xf9efbe8eL, 0x43beb717L, 0xd58eb060L,
+//     0xe8a3d6d6L, 0x7e93d1a1L, 0xc4c2d838L, 0x52f2df4fL, 0xf167bbd1L,
+//     0x6757bca6L, 0xdd06b53fL, 0x4b36b248L, 0xda2b0dd8L, 0x4c1b0aafL,
+//     0xf64a0336L, 0x607a0441L, 0xc3ef60dfL, 0x55df67a8L, 0xef8e6e31L,
+//     0x79be6946L, 0x8cb361cbL, 0x1a8366bcL, 0xa0d26f25L, 0x36e26852L,
+//     0x95770cccL, 0x03470bbbL, 0xb9160222L, 0x2f260555L, 0xbe3bbac5L,
+//     0x280bbdb2L, 0x925ab42bL, 0x046ab35cL, 0xa7ffd7c2L, 0x31cfd0b5L,
+//     0x8b9ed92cL, 0x1daede5bL, 0xb0c2649bL, 0x26f263ecL, 0x9ca36a75L,
+//     0x0a936d02L, 0xa906099cL, 0x3f360eebL, 0x85670772L, 0x13570005L,
+//     0x824abf95L, 0x147ab8e2L, 0xae2bb17bL, 0x381bb60cL, 0x9b8ed292L,
+//     0x0dbed5e5L, 0xb7efdc7cL, 0x21dfdb0bL, 0xd4d2d386L, 0x42e2d4f1L,
+//     0xf8b3dd68L, 0x6e83da1fL, 0xcd16be81L, 0x5b26b9f6L, 0xe177b06fL,
+//     0x7747b718L, 0xe65a0888L, 0x706a0fffL, 0xca3b0666L, 0x5c0b0111L,
+//     0xff9e658fL, 0x69ae62f8L, 0xd3ff6b61L, 0x45cf6c16L, 0x78e20aa0L,
+//     0xeed20dd7L, 0x5483044eL, 0xc2b30339L, 0x612667a7L, 0xf71660d0L,
+//     0x4d476949L, 0xdb776e3eL, 0x4a6ad1aeL, 0xdc5ad6d9L, 0x660bdf40L,
+//     0xf03bd837L, 0x53aebca9L, 0xc59ebbdeL, 0x7fcfb247L, 0xe9ffb530L,
+//     0x1cf2bdbdL, 0x8ac2bacaL, 0x3093b353L, 0xa6a3b424L, 0x0536d0baL,
+//     0x9306d7cdL, 0x2957de54L, 0xbf67d923L, 0x2e7a66b3L, 0xb84a61c4L,
+//     0x021b685dL, 0x942b6f2aL, 0x37be0bb4L, 0xa18e0cc3L, 0x1bdf055aL,
+//     0x8def022dL
+//#endif
+};
+
+CRC32::CRC32()
+{
+       reset();
+}
+
+void CRC32::update(const uint8_t * s, unsigned n)
+{
+       uint32_t crc = m_crc;
+    m_count += n;
+    
+    while (n--)
+    {
+        uint8_t c = *s++ & 0xff;
+        crc = (crc << 8) ^ m_tab[(crc >> 24) ^ c];
+    }
+       
+//     for(; !((reinterpret_cast<uint32_t>(s) & 0x3) == 0) && n > 0; n--)
+//     {
+//             crc = m_tab[CRC32_INDEX(crc) ^ *s++] ^ CRC32_SHIFTED(crc);
+//     }
+//
+//     while (n >= 4)
+//     {
+//             crc ^= *(const uint32_t *)s;
+//             crc = m_tab[CRC32_INDEX(crc)] ^ CRC32_SHIFTED(crc);
+//             crc = m_tab[CRC32_INDEX(crc)] ^ CRC32_SHIFTED(crc);
+//             crc = m_tab[CRC32_INDEX(crc)] ^ CRC32_SHIFTED(crc);
+//             crc = m_tab[CRC32_INDEX(crc)] ^ CRC32_SHIFTED(crc);
+//             n -= 4;
+//             s += 4;
+//     }
+//
+//     while (n--)
+//     {
+//             crc = m_tab[CRC32_INDEX(crc) ^ *s++] ^ CRC32_SHIFTED(crc);
+//     }
+
+       m_crc = crc;
+}
+
+void CRC32::truncatedFinal(uint8_t * hash, unsigned size)
+{
+    // pad with zeroes
+    if (m_count % 4)
+    {
+        unsigned i;
+        for (i = m_count % 4; i < 4; i++) {
+            m_crc = (m_crc << 8) ^ m_tab[(m_crc >> 24) ^ 0];
+        }
+    }
+    
+//     m_crc ^= CRC32_NEGL;
+       
+       unsigned i;
+       for (i=0; i<size; i++)
+       {
+               hash[i] = getCrcByte(i);
+       }
+
+       reset();
+}
+
diff --git a/tools/elftosb/common/crc.h b/tools/elftosb/common/crc.h
new file mode 100644 (file)
index 0000000..d6d0b7a
--- /dev/null
@@ -0,0 +1,48 @@
+/*
+ * File:       crc.h
+ *
+ * Copyright (c) Freescale Semiconductor, Inc. All rights reserved.
+ * See included license file for license details.
+ */
+#if !defined(_crc_h_)
+#define CRYPTOPP_CRC32_H
+
+#include "stdafx.h"
+
+const uint32_t CRC32_NEGL = 0xffffffffL;
+
+#ifdef __LITTLE_ENDIAN__
+       #define CRC32_INDEX(c) (c & 0xff)
+       #define CRC32_SHIFTED(c) (c >> 8)
+#else
+       #define CRC32_INDEX(c) (c >> 24)
+       #define CRC32_SHIFTED(c) (c << 8)
+#endif
+
+//! CRC Checksum Calculation
+class CRC32
+{
+public:
+       enum
+       {
+               DIGESTSIZE = 4
+       };
+       
+       CRC32();
+       
+       void update(const uint8_t * input, unsigned length);
+       
+       void truncatedFinal(uint8_t * hash, unsigned size);
+
+       void updateByte(uint8_t b) { m_crc = m_tab[CRC32_INDEX(m_crc) ^ b] ^ CRC32_SHIFTED(m_crc); }
+       uint8_t getCrcByte(unsigned i) const { return ((uint8_t *)&(m_crc))[i]; }
+
+private:
+       void reset() { m_crc = CRC32_NEGL; m_count = 0; }
+       
+       static const uint32_t m_tab[256];
+       uint32_t m_crc;
+    unsigned m_count;
+};
+
+#endif // _crc_h_
diff --git a/tools/elftosb/common/format_string.cpp b/tools/elftosb/common/format_string.cpp
new file mode 100644 (file)
index 0000000..3a26d0c
--- /dev/null
@@ -0,0 +1,79 @@
+/*
+ * File:       format_string.cpp
+ *
+ * Copyright (c) Freescale Semiconductor, Inc. All rights reserved.
+ * See included license file for license details.
+ */
+
+#include "format_string.h"
+#include <stdio.h>
+#include <stdarg.h>
+#include <stdexcept>
+#include <string.h>
+#include <stdlib.h>
+//! Size of the temporary buffer to hold the formatted output string.
+#define WIN32_FMT_BUF_LEN (512)
+
+/*!
+ * \brief Simple template class to free a pointer.
+ */
+template <typename T>
+class free_ptr
+{
+public:
+       //! \brief Constructor.
+       free_ptr(T ptr)
+       :       m_p(ptr)
+       {
+       }
+       
+       //! \brief Destructor.
+       ~free_ptr()
+       {
+               if (m_p)
+               {
+                       free(m_p);
+               }
+       }
+
+protected:
+       T m_p;  //!< The value to free.
+};
+
+//! The purpose of this function to provide a convenient way of generating formatted
+//! STL strings inline. This is especially useful when throwing exceptions that take
+//! a std::string for a message. The length of the formatted output string is limited
+//! only by memory. Memory temporarily allocated for the output string is disposed of
+//! before returning.
+//!
+//! Example usage:
+//! \code
+//!            throw std::runtime_error(format_string("error on line %d", line));
+//! \endcode
+//!
+//! \param fmt Format string using printf-style format markers.
+//! \return An STL string object of the formatted output.
+std::string format_string(const char * fmt, ...)
+{
+       char * buf = 0;
+       va_list vargs;
+       va_start(vargs, fmt);
+       int result = -1;
+#if WIN32
+    buf = (char *)malloc(WIN32_FMT_BUF_LEN);
+    if (buf)
+    {
+        result = _vsnprintf(buf, WIN32_FMT_BUF_LEN, fmt, vargs);
+    }
+#else // WIN32
+       result = vasprintf(&buf, fmt, vargs);
+#endif // WIN32
+       va_end(vargs);
+       if (result != -1 && buf)
+       {
+               free_ptr<char *> freebuf(buf);
+               return std::string(buf);
+       }
+       return "";
+}
+
diff --git a/tools/elftosb/common/format_string.h b/tools/elftosb/common/format_string.h
new file mode 100644 (file)
index 0000000..a879d4e
--- /dev/null
@@ -0,0 +1,20 @@
+/*
+ * File:       format_string.h
+ *
+ * Copyright (c) Freescale Semiconductor, Inc. All rights reserved.
+ * See included license file for license details.
+ */
+#if !defined(_format_string_h_)
+#define _format_string_h_
+
+#include <string>
+#include <stdexcept>
+
+/*!
+ * \brief Returns a formatted STL string using printf format strings.
+ */
+std::string format_string(const char * fmt, ...);
+
+
+#endif // _format_string_h_
+
diff --git a/tools/elftosb/common/int_size.h b/tools/elftosb/common/int_size.h
new file mode 100644 (file)
index 0000000..cf66d68
--- /dev/null
@@ -0,0 +1,22 @@
+/*
+ * File:       int_size.h
+ *
+ * Copyright (c) Freescale Semiconductor, Inc. All rights reserved.
+ * See included license file for license details.
+ */
+#if !defined(_int_size_h_)
+#define _int_size_h_
+
+namespace elftosb
+{
+
+//! Supported sizes of integers.
+typedef enum {
+       kWordSize,              //!< 32-bit word.
+       kHalfWordSize,  //!< 16-bit half word.
+       kByteSize               //!< 8-bit byte.
+} int_size_t;
+
+}; // namespace elftosb
+
+#endif // _int_size_h_
diff --git a/tools/elftosb/common/options.cpp b/tools/elftosb/common/options.cpp
new file mode 100644 (file)
index 0000000..9f12aa6
--- /dev/null
@@ -0,0 +1,1140 @@
+// ****************************************************************************
+// ^FILE: options.c - implement the functions defined in <options.h>
+//
+// ^HISTORY:
+//    01/16/92 Brad Appleton   <bradapp@enteract.com>  Created
+//
+//    03/23/93 Brad Appleton   <bradapp@enteract.com>
+//    - Added OptIstreamIter class
+//
+//    10/08/93 Brad Appleton   <bradapp@enteract.com>
+//    - Added "hidden" options
+//
+//    02/08/94 Brad Appleton   <bradapp@enteract.com>
+//    - Added "OptionSpec" class
+//    - Permitted use of stdio instead of iostreams via #ifdef USE_STDIO
+//
+//    03/08/94 Brad Appleton   <bradapp@enteract.com>
+//    - completed support for USE_STDIO
+//    - added #ifdef NO_USAGE for people who always want to print their own
+//    - Fixed stupid NULL pointer error in OptionsSpec class
+//
+//    07/31/97 Brad Appleton   <bradapp@enteract.com>
+//    - Added PARSE_POS control flag and POSITIONAL return value.
+// ^^**************************************************************************
+
+// #include <stdlib.h>
+#include <ctype.h>
+#include <string.h>
+
+#include "options.h"
+
+using namespace std;
+
+extern "C" {
+   void  exit(int);
+}
+
+static const char ident[] = "@(#)Options  1.05" ;
+
+   // I need a portable version of "tolower" that does NOT modify
+   // non-uppercase characters.
+   //
+#define  TOLOWER(c)  (isupper(c) ? tolower(c) : c)
+
+   // Use this to shut the compiler up about NULL strings
+#define  NULLSTR  (char *)NULL
+
+// ******************************************************** insertion operators
+
+  // If you are using <stdio.h> then you need this stuff!
+  // If you are using <iostream.h> then #ifdef this stuff out
+  //
+
+
+#ifdef  USE_STDIO
+
+   // Implement just enough of ostream to get this file to compile
+   //
+
+static const char endl = '\n' ;
+
+class  ostream {
+public:
+   ostream(FILE * fileptr) : fp(fileptr) {}
+
+   ostream &
+   operator<<(char ch);
+
+   ostream &
+   operator<<(const char * str);
+
+   ostream &
+   write(const char * buf, unsigned bufsize);
+
+private:
+   FILE * fp;
+} ;
+
+ostream &
+ostream::operator<<(char ch) {
+   fputc(ch, fp);
+   return *this;
+}
+
+ostream &
+ostream::operator<<(const char * str) {
+   fputs(str, fp);
+   return *this;
+}
+
+ostream &
+ostream::write(const char * buf, unsigned ) {
+   fputs(buf, fp);
+   return *this;
+}
+
+static  ostream  cerr(stderr);
+static  ostream  cout(stdout);
+
+#endif  /* USE_STDIO */
+
+// ************************************************************** OptIter
+
+OptIter::~OptIter(void) {}
+
+const char *
+OptIter::operator()(void)  {
+   const char * elt = curr();
+   (void) next();
+   return  elt;
+}
+
+// ************************************************************** OptIterRwd
+
+OptIterRwd::OptIterRwd(void) {}
+
+OptIterRwd::~OptIterRwd(void) {}
+
+// ************************************************************** OptArgvIter
+
+OptArgvIter::~OptArgvIter(void) {}
+
+const char *
+OptArgvIter::curr(void) {
+   return ((ndx == ac) || (av[ndx] == NULL)) ? NULLSTR : av[ndx];
+}
+
+void
+OptArgvIter::next(void) {
+   if ((ndx != ac) && av[ndx]) ++ndx;
+}
+
+const char *
+OptArgvIter::operator()(void) {
+   return ((ndx == ac) || (av[ndx] == NULL)) ? NULLSTR : av[ndx++];
+}
+
+void
+OptArgvIter::rewind(void) { ndx = 0; }
+
+// ************************************************************** OptStrTokIter
+
+static const char WHITESPACE[] = " \t\n\r\v\f" ;
+const char * OptStrTokIter::default_delims = WHITESPACE ;
+
+OptStrTokIter::OptStrTokIter(const char * tokens, const char * delimiters)
+   : len(unsigned(strlen(tokens))), str(tokens), seps(delimiters),
+     cur(NULLSTR), tokstr(NULLSTR)
+{
+   if (seps == NULL)  seps = default_delims;
+   tokstr = new char[len + 1];
+   (void) ::strcpy(tokstr, str);
+   cur = ::strtok(tokstr, seps);
+}
+
+
+OptStrTokIter::~OptStrTokIter(void) { delete [] tokstr; }
+
+const char *
+OptStrTokIter::curr(void) { return cur; }
+
+void
+OptStrTokIter::next(void) { if (cur) cur = ::strtok(NULL, seps); }
+
+const char *
+OptStrTokIter::operator()(void) {
+   const char * elt = cur;
+   if (cur) cur = ::strtok(NULL, seps);
+   return  elt;
+}
+
+void
+OptStrTokIter::rewind(void) {
+   (void) ::strcpy(tokstr, str);
+   cur = ::strtok(tokstr, seps);
+}
+
+// ************************************************************* OptIstreamIter
+
+#ifdef vms
+   enum { c_COMMENT = '!' } ;
+#else
+   enum { c_COMMENT = '#' } ;
+#endif
+
+const unsigned  OptIstreamIter::MAX_LINE_LEN = 1024 ;
+
+   // Constructor
+OptIstreamIter::OptIstreamIter(istream & input) : is(input), tok_iter(NULL)
+{
+#ifdef  USE_STDIO
+   fprintf(stderr, "%s: Can't use OptIstreamIter class:\n",
+                   "OptIstreamIter::OptIstreamIter");
+   fprintf(stderr, "\tOptions(3C++) was compiled with USE_STDIO #defined.\n");
+   exit(-1);
+#endif  /* USE_STDIO */
+}
+
+   // Destructor
+OptIstreamIter::~OptIstreamIter(void) {
+   delete  tok_iter;
+}
+
+const char *
+OptIstreamIter::curr(void) {
+#ifdef  USE_STDIO
+   return  NULLSTR;
+#else
+   const char * result = NULLSTR;
+   if (tok_iter)  result = tok_iter->curr();
+   if (result)  return  result;
+   fill();
+   return (! is) ? NULLSTR : tok_iter->curr();
+#endif  /* USE_STDIO */
+}
+
+void
+OptIstreamIter::next(void) {
+#ifdef  USE_STDIO
+   return;
+#else
+   const char * result = NULLSTR;
+   if (tok_iter)  result = tok_iter->operator()();
+   if (result)  return;
+   fill();
+   if (! is) tok_iter->next();
+#endif  /* USE_STDIO */
+}
+
+const char *
+OptIstreamIter::operator()(void) {
+#ifdef  USE_STDIO
+   return  NULLSTR;
+#else
+   const char * result = NULLSTR;
+   if (tok_iter)  result = tok_iter->operator()();
+   if (result)  return  result;
+   fill();
+   return (! is) ? NULLSTR : tok_iter->operator()();
+#endif  /* USE_STDIO */
+}
+
+   // What we do is this: for each line of text in the istream, we use
+   // a OptStrTokIter to iterate over each token on the line.
+   //
+   // If the first non-white character on a line is c_COMMENT, then we
+   // consider the line to be a comment and we ignore it.
+   //
+void
+OptIstreamIter::fill(void) {
+#ifdef USE_STDIO
+   return;
+#else
+   char buf[OptIstreamIter::MAX_LINE_LEN];
+   do {
+      *buf = '\0';
+      is.getline(buf, sizeof(buf));
+      char * ptr = buf;
+      while (isspace(*ptr)) ++ptr;
+      if (*ptr && (*ptr != c_COMMENT)) {
+         delete  tok_iter;
+         tok_iter = new OptStrTokIter(ptr);
+         return;
+      }
+   } while (is);
+#endif  /* USE_STDIO */
+}
+
+// **************************************************** Options class utilities
+
+   // Is this option-char null?
+inline static int
+isNullOpt(char optchar) {
+   return  ((! optchar) || isspace(optchar) || (! isprint(optchar)));
+}
+   
+   // Check for explicit "end-of-options"
+inline static int
+isEndOpts(const char * token) {
+   return ((token == NULL) || (! ::strcmp(token, "--"))) ;
+}
+
+   // See if an argument is an option
+inline static int
+isOption(unsigned  flags, const char * arg) {
+   return  (((*arg != '\0') || (arg[1] != '\0')) &&
+            ((*arg == '-')  || ((flags & Options::PLUS) && (*arg == '+')))) ;
+}
+
+   // See if we should be parsing only options or if we also need to
+   // parse positional arguments
+inline static int
+isOptsOnly(unsigned  flags) {
+   return  (flags & Options::PARSE_POS) ? 0 : 1;
+}
+
+   // return values for a keyword matching function
+enum kwdmatch_t { NO_MATCH, PARTIAL_MATCH, EXACT_MATCH } ;
+
+// ---------------------------------------------------------------------------
+// ^FUNCTION: kwdmatch - match a keyword
+//
+// ^SYNOPSIS:
+//    static kwdmatch_t kwdmatch(src, attempt, len)
+//
+// ^PARAMETERS:
+//    char * src -- the actual keyword to match
+//    char * attempt -- the possible keyword to compare against "src"
+//    int len -- number of character of "attempt" to consider
+//               (if 0 then we should use all of "attempt")
+//
+// ^DESCRIPTION:
+//    See if "attempt" matches some prefix of "src" (case insensitive).
+//
+// ^REQUIREMENTS:
+//    - attempt should be non-NULL and non-empty
+//
+// ^SIDE-EFFECTS:
+//    None.
+//
+// ^RETURN-VALUE:
+//    An enumeration value of type kwdmatch_t corresponding to whether
+//    We had an exact match, a partial match, or no match.
+//
+// ^ALGORITHM:
+//    Trivial
+// ^^-------------------------------------------------------------------------
+static kwdmatch_t
+kwdmatch(const char * src, const char * attempt, int len =0) {
+   int  i;
+
+   if (src == attempt)  return  EXACT_MATCH ;
+   if ((src == NULL) || (attempt == NULL))  return  NO_MATCH ;
+   if ((! *src) && (! *attempt))  return  EXACT_MATCH ;
+   if ((! *src) || (! *attempt))  return  NO_MATCH ;
+
+   for (i = 0 ; ((i < len) || (len == 0)) &&
+                (attempt[i]) && (attempt[i] != ' ') ; i++) {
+      if (TOLOWER(src[i]) != TOLOWER(attempt[i]))  return  NO_MATCH ;
+   }
+
+   return  (src[i]) ? PARTIAL_MATCH : EXACT_MATCH ;
+}
+
+// **************************************************************** OptionSpec
+
+   // Class that represents an option-specification
+   //    *NOTE*:: Assumes that the char-ptr given to the constructor points
+   //             to storage that will NOT be modified and whose lifetime will
+   //             be as least as long as the OptionSpec object we construct.
+   //
+class OptionSpec {
+public:
+   OptionSpec(const char * decl =NULLSTR)
+      : hidden(0), spec(decl)
+   {
+      if (spec == NULL)  spec = NULL_spec;
+      CheckHidden();
+   }
+
+   OptionSpec(const OptionSpec & cp) : hidden(cp.hidden), spec(cp.spec) {}
+
+   // NOTE: use default destructor!
+
+      // Assign to another OptionSpec
+   OptionSpec &
+   operator=(const OptionSpec & cp) {
+      if (this != &cp) {
+         spec = cp.spec;
+         hidden = cp.hidden;
+      }
+      return *this;
+   }
+
+      // Assign to a string
+   OptionSpec &
+   operator=(const char * decl) {
+      if (spec != decl) {
+         spec = decl;
+         hidden = 0;
+         CheckHidden();
+      }
+      return *this;
+   }
+
+      // Convert to char-ptr by returning the original declaration-string
+   operator const char*() { return  isHiddenOpt() ? (spec - 1) : spec; }
+
+      // Is this option NULL?
+   int
+   isNULL(void) const { return ((spec == NULL) || (spec == NULL_spec)); }
+
+      // Is this options incorrectly specified?
+   int
+   isSyntaxError(const char * name) const;
+
+      // See if this is a Hidden option
+   int
+   isHiddenOpt(void) const { return  hidden; }
+
+      // Get the corresponding option-character
+   char
+   OptChar(void) const { return  *spec; }
+
+      // Get the corresponding long-option string
+   const char *
+   LongOpt(void) const {
+       return  (spec[1] && spec[2] && (! isspace(spec[2]))) ? (spec + 2) : NULLSTR;
+   }
+
+      // Does this option require an argument?
+   int
+   isValRequired(void) const {
+      return  ((spec[1] == ':') || (spec[1] == '+'));
+   }
+
+      // Does this option take an optional argument?
+   int
+   isValOptional(void) const {
+      return  ((spec[1] == '?') || (spec[1] == '*'));
+   }
+
+      // Does this option take no arguments?
+   int
+   isNoArg(void) const {
+      return  ((spec[1] == '|') || (! spec[1]));
+   }
+
+      // Can this option take more than one argument?
+   int
+   isList(void) const {
+      return  ((spec[1] == '+') || (spec[1] == '*'));
+   }
+
+      // Does this option take any arguments?
+   int
+   isValTaken(void) const {
+      return  (isValRequired() || isValOptional()) ;
+   }
+
+      // Format this option in the given buffer
+   unsigned
+   Format(char * buf, unsigned optctrls) const;
+
+private:
+   void
+   CheckHidden(void) {
+      if ((! hidden) && (*spec == '-')) {
+         ++hidden;
+         ++spec;
+      }
+   }
+
+   unsigned     hidden : 1;  // hidden-flag
+   const char * spec;        // string specification
+
+   static const char NULL_spec[];
+} ;
+
+const char OptionSpec::NULL_spec[] = "\0\0\0" ;
+
+int
+OptionSpec::isSyntaxError(const char * name) const {
+   int  error = 0;
+   if ((! spec) || (! *spec)) {
+      cerr << name << ": empty option specifier." << endl;
+      cerr << "\tmust be at least 1 character long." << endl;
+      ++error;
+   } else if (spec[1] && (strchr("|?:*+", spec[1]) == NULL)) {
+      cerr << name << ": bad option specifier \"" << spec << "\"." << endl;
+      cerr << "\t2nd character must be in the set \"|?:*+\"." << endl;
+      ++error;
+   }
+   return  error;
+}
+
+// ---------------------------------------------------------------------------
+// ^FUNCTION: OptionSpec::Format - format an option-spec for a usage message
+//
+// ^SYNOPSIS:
+//    unsigned OptionSpec::Format(buf, optctrls) const
+//
+// ^PARAMETERS:
+//    char * buf -- where to print the formatted option
+//    unsigned  optctrls -- option-parsing configuration flags
+//
+// ^DESCRIPTION:
+//    Self-explanatory.
+//
+// ^REQUIREMENTS:
+//    - buf must be large enough to hold the result
+//
+// ^SIDE-EFFECTS:
+//    - writes to buf.
+//
+// ^RETURN-VALUE:
+//    Number of characters written to buf.
+//
+// ^ALGORITHM:
+//    Follow along in the source - it's not hard but it is tedious!
+// ^^-------------------------------------------------------------------------
+unsigned
+OptionSpec::Format(char * buf, unsigned optctrls) const {
+#ifdef NO_USAGE
+   return  (*buf = '\0');
+#else
+   static  char default_value[] = "<value>";
+   if (isHiddenOpt())  return (unsigned)(*buf = '\0');
+   char optchar = OptChar();
+   const char * longopt = LongOpt();
+   char * p = buf ;
+
+   const char * value = NULLSTR;
+   int    longopt_len = 0;
+   int    value_len = 0;
+
+   if (longopt) {
+      value = ::strchr(longopt, ' ');
+      longopt_len = (value) ? (value - longopt) : ::strlen(longopt);
+   } else {
+      value = ::strchr(spec + 1, ' ');
+   }
+   while (value && (*value == ' '))  ++value;
+   if (value && *value) {
+      value_len = ::strlen(value);
+   } else {
+      value = default_value;
+      value_len = sizeof(default_value) - 1;
+   }
+
+   if ((optctrls & Options::SHORT_ONLY) &&
+       ((! isNullOpt(optchar)) || (optctrls & Options::NOGUESSING))) {
+      longopt = NULLSTR;
+   }
+   if ((optctrls & Options::LONG_ONLY) &&
+       (longopt || (optctrls & Options::NOGUESSING))) {
+      optchar = '\0';
+   }
+   if (isNullOpt(optchar) && (longopt == NULL)) {
+      *buf = '\0';
+      return  0;
+   }
+
+   *(p++) = '[';
+
+   // print the single character option
+   if (! isNullOpt(optchar)) {
+      *(p++) = '-';
+      *(p++) = optchar;
+   }
+
+   if ((! isNullOpt(optchar)) && (longopt))  *(p++) = '|';
+
+   // print the long option
+   if (longopt) {
+      *(p++) = '-';
+      if (! (optctrls & (Options::LONG_ONLY | Options::SHORT_ONLY))) {
+         *(p++) = '-';
+      }
+      strncpy(p, longopt, longopt_len);
+      p += longopt_len;
+   }
+
+   // print any argument the option takes
+   if (isValTaken()) {
+      *(p++) = ' ' ;
+      if (isValOptional())  *(p++) = '[' ;
+      strcpy(p, value);
+      p += value_len;
+      if (isList()) {
+         strcpy(p, " ...");
+         p += 4;
+      }
+      if (isValOptional())  *(p++) = ']' ;
+   }
+
+   *(p++) = ']';
+   *p = '\0';
+
+   return  (unsigned) strlen(buf);
+#endif  /* USE_STDIO */
+}
+
+// ******************************************************************* Options
+
+#if (defined(MSWIN) || defined(OS2) || defined(MSDOS))
+# define DIR_SEP_CHAR '\\'
+#else
+# define DIR_SEP_CHAR '/'
+#endif
+
+Options::Options(const char * name, const char * const optv[])
+   : cmdname(name), optvec(optv), explicit_end(0), optctrls(DEFAULT),
+     nextchar(NULLSTR), listopt(NULLSTR)
+{
+   const char * basename = ::strrchr(cmdname, DIR_SEP_CHAR);
+   if (basename)  cmdname = basename + 1;
+   check_syntax();
+}
+
+Options::~Options(void) {}
+
+   // Make sure each option-specifier has correct syntax.
+   //
+   // If there is even one invalid specifier, then exit ungracefully!
+   //
+void
+Options::check_syntax(void) const {
+   int  errors = 0;
+   if ((optvec == NULL) || (! *optvec))  return;
+
+   for (const char * const * optv = optvec ; *optv ; optv++) {
+      OptionSpec  optspec = *optv;
+      errors += optspec.isSyntaxError(cmdname);
+   }
+   if (errors)  exit(127);
+}
+
+// ---------------------------------------------------------------------------
+// ^FUNCTION: Options::match_opt - match an option
+//
+// ^SYNOPSIS:
+//    const char * match_opt(opt, int  ignore_case) const
+//
+// ^PARAMETERS:
+//    char opt -- the option-character to match
+//    int  ignore_case -- should we ignore character-case?
+//
+// ^DESCRIPTION:
+//    See if "opt" is found in "optvec"
+//
+// ^REQUIREMENTS:
+//    - optvec should be non-NULL and terminated by a NULL pointer.
+//
+// ^SIDE-EFFECTS:
+//    None.
+//
+// ^RETURN-VALUE:
+//    NULL if no match is found,
+//    otherwise a pointer to the matching option-spec.
+//
+// ^ALGORITHM:
+//    foreach option-spec
+//       - see if "opt" is a match, if so return option-spec
+//    end-for
+// ^^-------------------------------------------------------------------------
+const char *
+Options::match_opt(char opt, int ignore_case) const {
+   if ((optvec == NULL) || (! *optvec))  return  NULLSTR;
+
+   for (const char * const * optv = optvec ; *optv ; optv++) {
+      OptionSpec  optspec = *optv;
+      char optchar = optspec.OptChar();
+      if (isNullOpt(optchar))  continue;
+      if (opt == optchar) {
+         return  optspec;
+      } else if (ignore_case && (TOLOWER(opt) == TOLOWER(optchar))) {
+         return  optspec;
+      }
+   }
+
+   return  NULLSTR;  // not found
+}
+
+// ---------------------------------------------------------------------------
+// ^FUNCTION: Options::match_longopt - match a long-option
+//
+// ^SYNOPSIS:
+//   const char * Options::match_longopt(opt, len, ambiguous)
+//
+// ^PARAMETERS:
+//    char * opt -- the long-option to match
+//    int len -- the number of character of "opt" to match
+//    int & ambiguous -- set by this routine before returning.
+//
+// ^DESCRIPTION:
+//    Try to match "opt" against some unique prefix of a long-option
+//    (case insensitive).
+//
+// ^REQUIREMENTS:
+//    - optvec should be non-NULL and terminated by a NULL pointer.
+//
+// ^SIDE-EFFECTS:
+//    - *ambiguous is set to '1' if "opt" matches >1 long-option
+//      (otherwise it is set to 0).
+//
+// ^RETURN-VALUE:
+//    NULL if no match is found,
+//    otherwise a pointer to the matching option-spec.
+//
+// ^ALGORITHM:
+//    ambiguous is FALSE
+//    foreach option-spec
+//       if we have an EXACT-MATCH, return the option-spec
+//       if we have a partial-match then
+//          if we already had a previous partial match then
+//             set ambiguous = TRUE and return NULL
+//          else
+//             remember this options spec and continue matching
+//          end-if
+//       end-if
+//    end-for
+//    if we had exactly 1 partial match return it, else return NULL
+// ^^-------------------------------------------------------------------------
+const char *
+Options::match_longopt(const char * opt, int  len, int & ambiguous) const {
+   kwdmatch_t  result;
+   const char * matched = NULLSTR ;
+
+   ambiguous = 0;
+   if ((optvec == NULL) || (! *optvec))  return  NULLSTR;
+
+   for (const char * const * optv = optvec ; *optv ; optv++) {
+      OptionSpec  optspec = *optv;
+      const char * longopt = optspec.LongOpt();
+      if (longopt == NULL)  continue;
+      result = kwdmatch(longopt, opt, len);
+      if (result == EXACT_MATCH) {
+         return  optspec;
+      } else if (result == PARTIAL_MATCH) {
+         if (matched) {
+            ++ambiguous;
+            return  NULLSTR;
+         } else {
+            matched = optspec;
+         }
+      }
+   }//for
+
+   return  matched;
+}
+
+// ---------------------------------------------------------------------------
+// ^FUNCTION: Options::parse_opt - parse an option
+//
+// ^SYNOPSIS:
+//    int Options::parse_opt(iter, optarg)
+//
+// ^PARAMETERS:
+//    OptIter & iter -- option iterator
+//    const char * & optarg -- where to store any option-argument
+//
+// ^DESCRIPTION:
+//    Parse the next option in iter (advancing as necessary).
+//    Make sure we update the nextchar pointer along the way. Any option
+//    we find should be returned and optarg should point to its argument.
+//
+// ^REQUIREMENTS:
+//    - nextchar must point to the prospective option character
+//
+// ^SIDE-EFFECTS:
+//    - iter is advanced when an argument completely parsed
+//    - optarg is modified to point to any option argument
+//    - if Options::QUIET is not set, error messages are printed on cerr
+//
+// ^RETURN-VALUE:
+//    'c' if the -c option was matched (optarg points to its argument)
+//    BADCHAR if the option is invalid (optarg points to the bad
+//                                                   option-character).
+//
+// ^ALGORITHM:
+//    It gets complicated -- follow the comments in the source.
+// ^^-------------------------------------------------------------------------
+int
+Options::parse_opt(OptIter & iter, const char * & optarg) {
+   listopt = NULLSTR;  // reset the list pointer
+
+   if ((optvec == NULL) || (! *optvec))  return  Options::ENDOPTS;
+
+      // Try to match a known option
+   OptionSpec optspec = match_opt(*(nextchar++), (optctrls & Options::ANYCASE));
+
+      // Check for an unknown option
+   if (optspec.isNULL()) {
+      // See if this was a long-option in disguise
+      if (! (optctrls & Options::NOGUESSING)) {
+         unsigned  save_ctrls = optctrls;
+         const char * save_nextchar = nextchar;
+         nextchar -= 1;
+         optctrls |= (Options::QUIET | Options::NOGUESSING);
+         int  optchar = parse_longopt(iter, optarg);
+         optctrls = save_ctrls;
+         if (optchar > 0) {
+            return  optchar;
+         } else {
+            nextchar = save_nextchar;
+         }
+      }
+      if (! (optctrls & Options::QUIET)) {
+         cerr << cmdname << ": unknown option -"
+              << *(nextchar - 1) << "." << endl ;
+      }
+      optarg = (nextchar - 1);  // record the bad option in optarg
+      return  Options::BADCHAR;
+   }
+
+      // If no argument is taken, then leave now
+   if (optspec.isNoArg()) {
+      optarg = NULLSTR;
+      return  optspec.OptChar();
+   }
+
+      // Check for argument in this arg
+   if (*nextchar) {
+      optarg = nextchar; // the argument is right here
+      nextchar = NULLSTR;   // we've exhausted this arg
+      if (optspec.isList())  listopt = optspec ;  // save the list-spec
+      return  optspec.OptChar();
+   }
+
+      // Check for argument in next arg
+   const char * nextarg = iter.curr();
+   if ((nextarg != NULL)  &&
+       (optspec.isValRequired() || (! isOption(optctrls, nextarg)))) {
+      optarg = nextarg;    // the argument is here
+      iter.next();         // end of arg - advance
+      if (optspec.isList())  listopt = optspec ;  // save the list-spec
+      return  optspec.OptChar();
+   }
+
+     // No argument given - if its required, thats an error
+   optarg = NULLSTR;
+   if (optspec.isValRequired() &&  !(optctrls & Options::QUIET)) {
+      cerr << cmdname << ": argument required for -" << optspec.OptChar()
+           << " option." << endl ;
+   }
+   return  optspec.OptChar();
+}
+
+// ---------------------------------------------------------------------------
+// ^FUNCTION: Options::parse_longopt - parse a long-option
+//
+// ^SYNOPSIS:
+//    int Options::parse_longopt(iter, optarg)
+//
+// ^PARAMETERS:
+//    OptIter & iter -- option iterator
+//    const char * & optarg -- where to store any option-argument
+//
+// ^DESCRIPTION:
+//    Parse the next long-option in iter (advancing as necessary).
+//    Make sure we update the nextchar pointer along the way. Any option
+//    we find should be returned and optarg should point to its argument.
+//
+// ^REQUIREMENTS:
+//    - nextchar must point to the prospective option character
+//
+// ^SIDE-EFFECTS:
+//    - iter is advanced when an argument completely parsed
+//    - optarg is modified to point to any option argument
+//    - if Options::QUIET is not set, error messages are printed on cerr
+//
+// ^RETURN-VALUE:
+//    'c' if the the long-option corresponding to the -c option was matched
+//         (optarg points to its argument)
+//    BADKWD if the option is invalid (optarg points to the bad long-option
+//                                                                     name).
+//
+// ^ALGORITHM:
+//    It gets complicated -- follow the comments in the source.
+// ^^-------------------------------------------------------------------------
+int
+Options::parse_longopt(OptIter & iter, const char * & optarg) {
+   int  len = 0, ambiguous = 0;
+
+   listopt = NULLSTR ;  // reset the list-spec
+
+   if ((optvec == NULL) || (! *optvec))  return  Options::ENDOPTS;
+
+      // if a value is supplied in this argv element, get it now
+   const char * val = strpbrk(nextchar, ":=") ;
+   if (val) {
+      len = val - nextchar ;
+      ++val ;
+   }
+
+      // Try to match a known long-option
+   OptionSpec  optspec = match_longopt(nextchar, len, ambiguous);
+
+      // Check for an unknown long-option
+   if (optspec.isNULL()) {
+      // See if this was a short-option in disguise
+      if ((! ambiguous) && (! (optctrls & Options::NOGUESSING))) {
+         unsigned  save_ctrls = optctrls;
+         const char * save_nextchar = nextchar;
+         optctrls |= (Options::QUIET | Options::NOGUESSING);
+         int  optchar = parse_opt(iter, optarg);
+         optctrls = save_ctrls;
+         if (optchar > 0) {
+            return  optchar;
+         } else {
+            nextchar = save_nextchar;
+         }
+      }
+      if (! (optctrls & Options::QUIET)) {
+         cerr << cmdname << ": " << ((ambiguous) ? "ambiguous" : "unknown")
+              << " option "
+              << ((optctrls & Options::LONG_ONLY) ? "-" : "--")
+              << nextchar << "." << endl ;
+      }
+      optarg = nextchar;  // record the bad option in optarg
+      nextchar = NULLSTR;    // we've exhausted this argument
+      return  (ambiguous) ? Options::AMBIGUOUS : Options::BADKWD;
+   }
+
+      // If no argument is taken, then leave now
+   if (optspec.isNoArg()) {
+      if ((val) && ! (optctrls & Options::QUIET)) {
+         cerr << cmdname << ": option "
+              << ((optctrls & Options::LONG_ONLY) ? "-" : "--")
+              << optspec.LongOpt() << " does NOT take an argument." << endl ;
+      }
+      optarg = val;     // record the unexpected argument
+      nextchar = NULLSTR;  // we've exhausted this argument
+      return  optspec.OptChar();
+   }
+
+      // Check for argument in this arg
+   if (val) {
+      optarg = val;      // the argument is right here
+      nextchar = NULLSTR;   // we exhausted the rest of this arg
+      if (optspec.isList())  listopt = optspec ;  // save the list-spec
+      return  optspec.OptChar();
+   }
+
+      // Check for argument in next arg
+   const char * nextarg = iter.curr();  // find the next argument to parse
+   if ((nextarg != NULL)  &&
+       (optspec.isValRequired() || (! isOption(optctrls, nextarg)))) {
+      optarg = nextarg;        // the argument is right here
+      iter.next();             // end of arg - advance
+      nextchar = NULLSTR;         // we exhausted the rest of this arg
+      if (optspec.isList())  listopt = optspec ;  // save the list-spec
+      return  optspec.OptChar();
+   }
+
+     // No argument given - if its required, thats an error
+   optarg = NULLSTR;
+   if (optspec.isValRequired() &&  !(optctrls & Options::QUIET)) {
+      const char * longopt = optspec.LongOpt();
+      const char * spc = ::strchr(longopt, ' ');
+      int  longopt_len;
+      if (spc) {
+         longopt_len = spc - longopt;
+      } else {
+         longopt_len = ::strlen(longopt);
+      }
+      cerr << cmdname << ": argument required for "
+           << ((optctrls & Options::LONG_ONLY) ? "-" : "--");
+      cerr.write(longopt, longopt_len) << " option." << endl ;
+   }
+   nextchar = NULLSTR;           // we exhausted the rest of this arg
+   return  optspec.OptChar();
+}
+
+// ---------------------------------------------------------------------------
+// ^FUNCTION: Options::usage - print usage
+//
+// ^SYNOPSIS:
+//    void Options::usage(os, positionals)
+//
+// ^PARAMETERS:
+//    ostream & os -- where to print the usage
+//    char * positionals -- command-line syntax for any positional args
+//
+// ^DESCRIPTION:
+//    Print command-usage (using either option or long-option syntax) on os.
+//
+// ^REQUIREMENTS:
+//    os should correspond to an open output file.
+//
+// ^SIDE-EFFECTS:
+//    Prints on os
+//
+// ^RETURN-VALUE:
+//    None.
+//
+// ^ALGORITHM:
+//    Print usage on os, wrapping long lines where necessary.
+// ^^-------------------------------------------------------------------------
+void
+Options::usage(ostream & os, const char * positionals) const {
+#ifdef NO_USAGE
+   return;
+#else
+   const char * const * optv = optvec;
+   unsigned  cols = 79;
+   int  first, nloop;
+   char  buf[256] ;
+
+   if ((optv == NULL) || (! *optv))  return;
+
+      // print first portion "usage: progname"
+   os << "usage: " << cmdname ;
+   unsigned  ll = strlen(cmdname) + 7;
+
+      // save the current length so we know how much space to skip for
+      // subsequent lines.
+      //
+   unsigned  margin = ll + 1;
+
+      // print the options and the positional arguments
+   for (nloop = 0, first = 1 ; !nloop ; optv++, first = 0) {
+      unsigned  len;
+      OptionSpec   optspec = *optv;
+
+         // figure out how wide this parameter is (for printing)
+      if (! *optv) {
+         len = strlen(positionals);
+         ++nloop;  // terminate this loop
+      } else {
+         if (optspec.isHiddenOpt())  continue;
+         len = optspec.Format(buf, optctrls);
+      }
+
+      //  Will this fit?
+      if ((ll + len + 1) > (cols - first)) {
+         os << '\n' ;  // No - start a new line;
+#ifdef USE_STDIO
+         for (int _i_ = 0; _i_ < margin; ++_i_)  os << " ";
+#else
+         os.width(margin); os << "" ;
+#endif
+         ll = margin;
+      } else {
+         os << ' ' ;  // Yes - just throw in a space
+         ++ll;
+      }
+      ll += len;
+      os << ((nloop) ? positionals : buf) ;
+   }// for each ad
+
+   os << endl ;
+#endif  /* NO_USAGE */
+}
+
+
+// ---------------------------------------------------------------------------
+// ^FUNCTION: Options::operator() - get options from the command-line
+//
+// ^SYNOPSIS:
+//   int Options::operator()(iter, optarg)
+//
+// ^PARAMETERS:
+//    OptIter & iter -- option iterator
+//    const char * & optarg -- where to store any option-argument
+//
+// ^DESCRIPTION:
+//    Parse the next option in iter (advancing as necessary).
+//    Make sure we update the nextchar pointer along the way. Any option
+//    we find should be returned and optarg should point to its argument.
+//
+// ^REQUIREMENTS:
+//    None.
+//
+// ^SIDE-EFFECTS:
+//    - iter is advanced when an argument is completely parsed
+//    - optarg is modified to point to any option argument
+//    - if Options::QUIET is not set, error messages are printed on cerr
+//
+// ^RETURN-VALUE:
+//     0 if all options have been parsed.
+//    'c' if the the option or long-option corresponding to the -c option was
+//         matched (optarg points to its argument).
+//    BADCHAR if the option is invalid (optarg points to the bad option char).
+//    BADKWD if the option is invalid (optarg points to the bad long-opt name).
+//    AMBIGUOUS if an ambiguous keyword name was given (optarg points to the
+//         ambiguous keyword name).
+//    POSITIONAL if PARSE_POS was set and the current argument is a positional
+//         parameter (in which case optarg points to the positional argument).
+//
+// ^ALGORITHM:
+//    It gets complicated -- follow the comments in the source.
+// ^^-------------------------------------------------------------------------
+int
+Options::operator()(OptIter & iter, const char * & optarg) {
+   int parse_opts_only = isOptsOnly(optctrls);
+   if (parse_opts_only)  explicit_end = 0;
+
+      // See if we have an option left over from before ...
+   if ((nextchar) && *nextchar) {
+      return  parse_opt(iter, optarg);
+   }
+
+      // Check for end-of-options ...
+   const char * arg = NULLSTR;
+   int get_next_arg = 0;
+   do {
+      arg = iter.curr();
+      get_next_arg = 0;
+      if (arg == NULL) {
+         listopt = NULLSTR;
+         return  Options::ENDOPTS;
+      } else if ((! explicit_end) && isEndOpts(arg)) {
+         iter.next();   // advance past end-of-options arg
+         listopt = NULLSTR;
+         explicit_end = 1;
+         if (parse_opts_only)  return  Options::ENDOPTS;
+         get_next_arg = 1;  // make sure we look at the next argument.
+      }
+   } while (get_next_arg);
+
+      // Do we have a positional arg?
+   if ( explicit_end || (! isOption(optctrls, arg)) ) {
+      if (parse_opts_only) {
+         return  Options::ENDOPTS;
+      } else {
+         optarg = arg;  // set optarg to the positional argument
+         iter.next();   // advance iterator to the next argument
+         return  Options::POSITIONAL;
+      }
+   }
+
+   iter.next();  // pass the argument that arg already points to
+
+      // See if we have a long option ...
+   if (! (optctrls & Options::SHORT_ONLY)) {
+      if ((*arg == '-') && (arg[1] == '-')) {
+         nextchar = arg + 2;
+         return  parse_longopt(iter, optarg);
+      } else if ((optctrls & Options::PLUS) && (*arg == '+')) {
+         nextchar = arg + 1;
+         return  parse_longopt(iter, optarg);
+      }
+   }
+   if (*arg == '-') {
+      nextchar = arg + 1;
+      if (optctrls & Options::LONG_ONLY) {
+         return  parse_longopt(iter, optarg);
+      } else {
+         return  parse_opt(iter, optarg);
+      }
+   }
+
+      // If we get here - it is because we have a list value
+   OptionSpec  optspec = listopt;
+   optarg = arg ;        // record the list value
+   return  optspec.OptChar() ;
+}
+
diff --git a/tools/elftosb/common/options.h b/tools/elftosb/common/options.h
new file mode 100644 (file)
index 0000000..0c4e49c
--- /dev/null
@@ -0,0 +1,488 @@
+// ****************************************************************************
+// ^FILE: options.h - option parsing classes
+//
+// ^DESCRIPTION:
+//    This file defines classes used to parse command-line options.
+//    Options may be parsed from an array of strings, or from any structure
+//    for which a corresponding option-iterator exists.
+//
+// ^HISTORY:
+//    03/06/92  Brad Appleton   <bradapp@enteract.com>   Created
+//
+//    03/23/93 Brad Appleton   <bradapp@enteract.com>
+//    - Added OptIstreamIter class
+//
+//    03/08/94 Brad Appleton   <bradapp@enteract.com>
+//    - Added Options::reset() member function
+//
+//    07/31/97 Brad Appleton   <bradapp@enteract.com>
+//    - Added PARSE_POS control flag and POSITIONAL return value
+//
+//       04/30/06  Chris Reed
+//    - Updated to modern C++ and STL
+//    - Converted comments to doxygen style
+// ^^**************************************************************************
+
+#ifndef _options_h
+#define _options_h
+
+#ifdef USE_STDIO
+       #include <stdio.h>
+#else
+       #include <iostream>
+#endif
+
+
+//! Abstract class to iterate through options/arguments
+//!
+class OptIter {
+public:
+   OptIter(void) {}
+   virtual ~OptIter(void);
+
+      //! curr() returns the current item in the iterator without
+      //! advancing on to the next item. If we are at the end of items
+      //! then NULL is returned.
+   virtual const char *
+   curr(void) = 0;
+
+      //! next() advances to the next item.
+   virtual void
+   next(void) = 0;
+
+      //! operator() returns the current item in the iterator and then
+      //! advances on to the next item. If we are at the end of items
+      //! then NULL is returned.
+   virtual const char *
+   operator()(void);
+} ;
+
+//! Abstract class for a rewindable OptIter
+//!
+class OptIterRwd : public OptIter {
+public:
+   OptIterRwd(void);
+
+   virtual ~OptIterRwd(void);
+
+   virtual const char *
+   curr(void) = 0;
+
+   virtual void
+   next(void) = 0;
+
+   virtual const char *
+   operator()(void) = 0;
+
+      //! rewind() resets the "current-element" to the first one in the "list"
+   virtual void
+   rewind(void) = 0;
+} ;
+
+//! Class to iterate through an array of tokens. The array may be terminated
+//! by NULL or a count containing the number of tokens may be given.
+//!
+class OptArgvIter : public OptIterRwd {
+private:
+   int            ndx;   // index of current arg
+   int            ac;    // arg count
+   const char * const * av;  // arg vector
+
+public:
+   OptArgvIter(const char * const argv[])
+      : av(argv), ac(-1), ndx(0) {}
+
+   OptArgvIter(int argc, const char * const argv[])
+      : av(argv), ac(argc), ndx(0) {}
+
+   virtual
+   ~OptArgvIter(void);
+
+   virtual const char *
+   curr(void);
+
+   virtual void
+   next(void);
+
+   virtual const char *
+   operator()(void);
+
+   virtual void
+   rewind(void);
+
+      //! index returns the current index to use for argv[]
+   int index(void)  { return  ndx; }
+} ;
+
+
+//! Class to iterate through a string containing delimiter-separated tokens
+//!
+class OptStrTokIter : public OptIterRwd {
+private:
+   unsigned     len;        // length of token-string
+   const char * str;        // the token-string
+   const char * seps;       // delimiter-set (separator-characters)
+   const char * cur;        // current token
+   char       * tokstr;     // our copy of the token-string
+
+   static const char * default_delims;  // default delimiters = whitespace
+
+public:
+   OptStrTokIter(const char * tokens, const char * delimiters =0);
+
+   virtual
+   ~OptStrTokIter(void);
+
+   virtual const char *
+   curr(void);
+
+   virtual void
+   next(void);
+
+   virtual const char *
+   operator()(void);
+
+   virtual void
+   rewind(void);
+
+      //! delimiters() with NO arguments returns the current set of delimiters,
+      //! If an argument is given then it is used as the new set of delimiters.
+   const char *
+   delimiters(void)  { return  seps; }
+
+   void
+   delimiters(const char * delims) {
+      seps = (delims) ? delims : default_delims ;
+   }
+} ;
+
+
+//! OptIstreamIter is a class for iterating over arguments that come
+//! from an input stream. Each line of the input stream is considered
+//! to be a set of white-space separated tokens. If the the first
+//! non-white character on a line is '#' ('!' for VMS systems) then
+//! the line is considered a comment and is ignored.
+//!
+//! \note If a line is more than 1022 characters in length then we
+//! treat it as if it were several lines of length 1022 or less.
+//!
+//! \note The string tokens returned by this iterator are pointers
+//!         to temporary buffers which may not necessarily stick around
+//!         for too long after the call to curr() or operator(), hence
+//!         if you need the string value to persist - you will need to
+//!         make a copy.
+//!
+class OptIstreamIter : public OptIter {
+private:
+   std::istream & is ;
+   OptStrTokIter * tok_iter ;
+
+   void
+   fill(void);
+
+public:
+   static const unsigned  MAX_LINE_LEN ;
+
+   OptIstreamIter(std::istream & input);
+
+   virtual
+   ~OptIstreamIter(void);
+
+   virtual const char *
+   curr(void);
+
+   virtual void
+   next(void);
+
+   virtual const char *
+   operator()(void);
+} ;
+
+
+//! \brief parse command-line options
+//!
+//! \section Synopsis
+//! \code
+//!   #include <options.h>
+//!
+//!   Options opts(cmdname, optv);
+//!   char cmdname[], *optv[];
+//! \endcode
+//! \section Description
+//! The Options constructor expects a command-name (usually argv[0]) and
+//! a pointer to an array of strings.  The last element in this array MUST
+//! be NULL. Each non-NULL string in the array must have the following format:
+//!
+//!   The 1st character must be the option-name ('c' for a -c option).
+//!
+//!   The 2nd character must be one of '|', '?', ':', '*', or '+'.
+//!      '|' -- indicates that the option takes NO argument;
+//!      '?' -- indicates that the option takes an OPTIONAL argument;
+//!      ':' -- indicates that the option takes a REQUIRED argument;
+//!      '*' -- indicates that the option takes 0 or more arguments;
+//!      '+' -- indicates that the option takes 1 or more arguments;
+//!
+//!   The remainder of the string must be the long-option name.
+//!
+//!   If desired, the long-option name may be followed by one or more
+//!   spaces and then by the name of the option value. This name will
+//!   be used when printing usage messages. If the option-value-name
+//!   is not given then the string "<value>" will be used in usage
+//!   messages.
+//!
+//!   One may use a space to indicate that a particular option does not
+//!   have a corresponding long-option.  For example, "c: " (or "c:")
+//!   means the -c option takes a value & has NO corresponding long-option.
+//!
+//!   To specify a long-option that has no corresponding single-character
+//!   option is a bit trickier: Options::operator() still needs an "option-
+//!   character" to return when that option is matched. One may use a whitespace
+//!   character or a non-printable character as the single-character option
+//!   in such a case. (hence " |hello" would only match "--hello").
+//!
+//!   \section Exceptions Exceptions to the above
+//!   If the 1st character of the string is '-', then the rest of the
+//!   string must correspond to the above format, and the option is
+//!   considered to be a hidden-option. This means it will be parsed
+//!   when actually matching options from the command-line, but will
+//!   NOT show-up if a usage message is printed using the usage() member
+//!   function. Such an example might be "-h|hidden". If you want to
+//!   use any "dummy" options (options that are not parsed, but that
+//!   to show up in the usage message), you can specify them along with
+//!   any positional parameters to the usage() member function.
+//!
+//!   If the 2nd character of the string is '\0' then it is assumed
+//!   that there is no corresponding long-option and that the option
+//!   takes no argument (hence "f", and "f| " are equivalent).
+//!
+//!   \code
+//!      const char * optv[] = {
+//!          "c:count   <number>",
+//!          "s?str     <string>",
+//!          "x",
+//!          " |hello",
+//!          "g+groups  <newsgroup>",
+//!          NULL
+//!      } ;
+//!    \endcode
+//!      optv[] now corresponds to the following:
+//!
+//!            usage: cmdname [-c|--count <number>] [-s|--str [<string>]]
+//!                           [-x] [--hello] [-g|--groups <newsgroup> ...]
+//!
+//! Long-option names are matched case-insensitive and only a unique prefix
+//! of the name needs to be specified.
+//!
+//! Option-name characters are case-sensitive!
+//!
+//! \section Caveat
+//! Because of the way in which multi-valued options and options with optional
+//! values are handled, it is NOT possible to supply a value to an option in
+//! a separate argument (different argv[] element) if the value is OPTIONAL
+//! and begins with a '-'. What this means is that if an option "-s" takes an
+//! optional value value and you wish to supply a value of "-foo" then you must
+//! specify this on the command-line as "-s-foo" instead of "-s -foo" because
+//! "-s -foo" will be considered to be two separate sets of options.
+//!
+//! A multi-valued option is terminated by another option or by the end-of
+//! options. The following are all equivalent (if "-l" is a multi-valued
+//! option and "-x" is an option that takes no value):
+//!
+//!    cmdname -x -l item1 item2 item3 -- arg1 arg2 arg3
+//!    cmdname -x -litem1 -litem2 -litem3 -- arg1 arg2 arg3
+//!    cmdname -l item1 item2 item3 -x arg1 arg2 arg3
+//!
+//!
+//! \code
+//!    #include <options.h>
+//!
+//!    static const char * optv[] = {
+//!       "H|help",
+//!       "c:count   <number>",
+//!       "s?str     <string>",
+//!       "x",
+//!       " |hello",
+//!       "g+groups  <newsgroup>",
+//!       NULL
+//!    } ;
+//!
+//!    main(int argc, char * argv[]) {
+//!       int  optchar;
+//!       const char * optarg;
+//!       const char * str = "default_string";
+//!       int  count = 0, xflag = 0, hello = 0;
+//!       int  errors = 0, ngroups = 0;
+//!    
+//!       Options  opts(*argv, optv);
+//!       OptArgvIter  iter(--argc, ++argv);
+//!    
+//!       while( optchar = opts(iter, optarg) ) {
+//!          switch (optchar) {
+//!          case 'H' :
+//!             opts.usage(cout, "files ...");
+//!             exit(0);
+//!             break;
+//!          case 'g' :
+//!             ++ngroups; break;  //! the groupname is in "optarg"
+//!          case 's' :
+//!             str = optarg; break;
+//!          case 'x' :
+//!             ++xflag; break;
+//!          case ' ' :
+//!             ++hello; break;
+//!          case 'c' :
+//!             if (optarg == NULL)  ++errors;
+//!             else  count = (int) atol(optarg);
+//!             break;
+//!          default :  ++errors; break;
+//!          } //!switch
+//!       }
+//!    
+//!       if (errors || (iter.index() == argc)) {
+//!          if (! errors) {
+//!             cerr << opts.name() << ": no filenames given." << endl ;
+//!          }
+//!          opts.usage(cerr, "files ...");
+//!          exit(1);
+//!       }
+//!    
+//!       cout << "xflag=" << ((xflag) ? "ON"  : "OFF") << endl
+//!            << "hello=" << ((hello) ? "YES" : "NO") << endl
+//!            << "count=" << count << endl
+//!            << "str=\"" << ((str) ? str : "No value given!") << "\"" << endl
+//!            << "ngroups=" << ngroups << endl ;
+//!    
+//!       if (iter.index() < argc) {
+//!          cout << "files=" ;
+//!          for (int i = iter.index() ; i < argc ; i++) {
+//!             cout << "\"" << argv[i] << "\" " ;
+//!          }
+//!          cout << endl ;
+//!       }
+//!    }
+//! \endcode
+class Options {
+private:
+   unsigned       explicit_end : 1;  //!< were we terminated because of "--"?
+   unsigned       optctrls : 7;  //!< control settings (a set of OptCtrl masks)
+   const char  * const * optvec; //!< vector of option-specifications (last=NULL)
+   const char   * nextchar;      //!< next option-character to process
+   const char   * listopt;       //!< last list-option we matched
+   const char   * cmdname;       //!< name of the command
+
+   void
+   check_syntax(void) const;
+
+   const char *
+   match_opt(char opt, int ignore_case =0) const;
+
+   const char *
+   match_longopt(const char * opt, int  len, int & ambiguous) const;
+
+   int
+   parse_opt(OptIter & iter, const char * & optarg);
+
+   int
+   parse_longopt(OptIter & iter, const char * & optarg);
+
+public:
+   enum OptCtrl {
+      DEFAULT    = 0x00,  //!< Default setting
+      ANYCASE    = 0x01,  //!< Ignore case when matching short-options
+      QUIET      = 0x02,  //!< Dont print error messages
+      PLUS       = 0x04,  //!< Allow "+" as a long-option prefix
+      SHORT_ONLY = 0x08,  //!< Dont accept long-options
+      LONG_ONLY  = 0x10,  //!< Dont accept short-options
+                            //!< (also allows "-" as a long-option prefix).
+      NOGUESSING = 0x20,  //!< Normally, when we see a short (long) option
+                            //!< on the command line that doesnt match any
+                            //!< known short (long) options, then we try to
+                            //!< "guess" by seeing if it will match any known
+                            //!< long (short) option. Setting this mask prevents
+                            //!< this "guessing" from occurring.
+      PARSE_POS = 0x40    //!< By default, Options will not present positional
+                            //!< command-line arguments to the user and will
+                            //!< instead stop parsing when the first positonal
+                            //!< argument has been encountered. If this flag
+                            //!< is given, Options will present positional
+                            //!< arguments to the user with a return code of
+                            //!< POSITIONAL; ENDOPTS will be returned only
+                            //!< when the end of the argument list is reached.
+   } ;
+
+      //! Error return values for operator()
+      //!
+   enum OptRC {
+      ENDOPTS    =  0,
+      BADCHAR    = -1,
+      BADKWD     = -2,
+      AMBIGUOUS  = -3,
+      POSITIONAL = -4
+   } ;
+
+   Options(const char * name, const char * const optv[]);
+
+   virtual
+   ~Options(void);
+
+      //! name() returns the command name
+   const char *
+   name(void) const { return  cmdname; }
+
+      //! ctrls() (with no arguments) returns the existing control settings
+   unsigned
+   ctrls(void) const { return  optctrls; }
+
+      //! ctrls() (with 1 argument) sets new control settings
+   void
+   ctrls(unsigned newctrls) { optctrls = newctrls; }
+
+      //! reset for another pass to parse for options
+   void
+   reset(void) { nextchar = listopt = NULL; }
+  
+      //! usage() prints options usage (followed by any positional arguments
+      //! listed in the parameter "positionals") on the given outstream
+   void
+   usage(std::ostream & os, const char * positionals) const ;
+
+      //! operator() iterates through the arguments as necessary (using the
+      //! given iterator) and returns the character value of the option
+      //! (or long-option) that it matched. If the option has a value
+      //! then the value given may be found in optarg (otherwise optarg
+      //! will be NULL).
+      //!
+      //! 0 is returned upon end-of-options. At this point, "iter" may
+      //! be used to process any remaining positional parameters. If the
+      //! PARSE_POS control-flag is set then 0 is returned only when all
+      //! arguments in "iter" have been exhausted.
+      //!
+      //! If an invalid option is found then BADCHAR is returned and *optarg
+      //! is the unrecognized option character.
+      //!
+      //! If an invalid long-option is found then BADKWD is returned and optarg
+      //! points to the bad long-option.
+      //!
+      //! If an ambiguous long-option is found then AMBIGUOUS is returned and
+      //! optarg points to the ambiguous long-option.
+      //!
+      //! If the PARSE_POS control-flag is set then POSITIONAL is returned
+      //! when a positional argument is encountered and optarg points to
+      //! the positonal argument (and "iter" is advanced to the next argument
+      //! in the iterator).
+      //!
+      //! Unless Options::QUIET is used, missing option-arguments and
+      //! invalid options (and the like) will automatically cause error
+      //! messages to be issued to cerr.
+   int
+   operator()(OptIter & iter, const char * & optarg) ;
+
+      //! Call this member function after operator() has returned 0
+      //! if you want to know whether or not options were explicitly
+      //! terminated because "--" appeared on the command-line.
+      //!
+   int
+   explicit_endopts() const { return  explicit_end; }
+} ;
+
+#endif /* _options_h */
diff --git a/tools/elftosb/common/rijndael.cpp b/tools/elftosb/common/rijndael.cpp
new file mode 100644 (file)
index 0000000..5708711
--- /dev/null
@@ -0,0 +1,1604 @@
+//
+// File : rijndael.cpp
+// Creation date : Sun Nov 5 2000 03:22:10 CEST
+// Author : Szymon Stefanek (stefanek@tin.it)
+//
+// Another implementation of the Rijndael cipher.
+// This is intended to be an easily usable library file.
+// This code is public domain.
+// Based on the Vincent Rijmen and K.U.Leuven implementation 2.4.
+//
+
+//
+// Original Copyright notice:
+//
+//    rijndael-alg-fst.c   v2.4   April '2000
+//    rijndael-alg-fst.h
+//    rijndael-api-fst.c
+//    rijndael-api-fst.h
+//
+//    Optimised ANSI C code
+//
+//    authors: v1.0: Antoon Bosselaers
+//             v2.0: Vincent Rijmen, K.U.Leuven
+//             v2.3: Paulo Barreto
+//             v2.4: Vincent Rijmen, K.U.Leuven
+//
+//    This code is placed in the public domain.
+//
+
+//
+// This implementation works on 128 , 192 , 256 bit keys
+// and on 128 bit blocks
+//
+
+#define _RIJNDAEL_CPP_
+
+#include "rijndael.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+
+static uint8_t S[256]=
+{
+        99, 124, 119, 123, 242, 107, 111, 197,  48,   1, 103,  43, 254, 215, 171, 118, 
+       202, 130, 201, 125, 250,  89,  71, 240, 173, 212, 162, 175, 156, 164, 114, 192, 
+       183, 253, 147,  38,  54,  63, 247, 204,  52, 165, 229, 241, 113, 216,  49,  21, 
+         4, 199,  35, 195,  24, 150,   5, 154,   7,  18, 128, 226, 235,  39, 178, 117, 
+         9, 131,  44,  26,  27, 110,  90, 160,  82,  59, 214, 179,  41, 227,  47, 132, 
+        83, 209,   0, 237,  32, 252, 177,  91, 106, 203, 190,  57,  74,  76,  88, 207, 
+       208, 239, 170, 251,  67,  77,  51, 133,  69, 249,   2, 127,  80,  60, 159, 168, 
+        81, 163,  64, 143, 146, 157,  56, 245, 188, 182, 218,  33,  16, 255, 243, 210, 
+       205,  12,  19, 236,  95, 151,  68,  23, 196, 167, 126,  61, 100,  93,  25, 115, 
+        96, 129,  79, 220,  34,  42, 144, 136,  70, 238, 184,  20, 222,  94,  11, 219, 
+       224,  50,  58,  10,  73,   6,  36,  92, 194, 211, 172,  98, 145, 149, 228, 121, 
+       231, 200,  55, 109, 141, 213,  78, 169, 108,  86, 244, 234, 101, 122, 174,   8, 
+       186, 120,  37,  46,  28, 166, 180, 198, 232, 221, 116,  31,  75, 189, 139, 138, 
+       112,  62, 181, 102,  72,   3, 246,  14,  97,  53,  87, 185, 134, 193,  29, 158, 
+       225, 248, 152,  17, 105, 217, 142, 148, 155,  30, 135, 233, 206,  85,  40, 223, 
+       140, 161, 137,  13, 191, 230,  66, 104,  65, 153,  45,  15, 176,  84, 187,  22
+};
+
+
+static uint8_t T1[256][4]=
+{
+       0xc6,0x63,0x63,0xa5, 0xf8,0x7c,0x7c,0x84, 0xee,0x77,0x77,0x99, 0xf6,0x7b,0x7b,0x8d, 
+       0xff,0xf2,0xf2,0x0d, 0xd6,0x6b,0x6b,0xbd, 0xde,0x6f,0x6f,0xb1, 0x91,0xc5,0xc5,0x54, 
+       0x60,0x30,0x30,0x50, 0x02,0x01,0x01,0x03, 0xce,0x67,0x67,0xa9, 0x56,0x2b,0x2b,0x7d, 
+       0xe7,0xfe,0xfe,0x19, 0xb5,0xd7,0xd7,0x62, 0x4d,0xab,0xab,0xe6, 0xec,0x76,0x76,0x9a, 
+       0x8f,0xca,0xca,0x45, 0x1f,0x82,0x82,0x9d, 0x89,0xc9,0xc9,0x40, 0xfa,0x7d,0x7d,0x87, 
+       0xef,0xfa,0xfa,0x15, 0xb2,0x59,0x59,0xeb, 0x8e,0x47,0x47,0xc9, 0xfb,0xf0,0xf0,0x0b, 
+       0x41,0xad,0xad,0xec, 0xb3,0xd4,0xd4,0x67, 0x5f,0xa2,0xa2,0xfd, 0x45,0xaf,0xaf,0xea, 
+       0x23,0x9c,0x9c,0xbf, 0x53,0xa4,0xa4,0xf7, 0xe4,0x72,0x72,0x96, 0x9b,0xc0,0xc0,0x5b, 
+       0x75,0xb7,0xb7,0xc2, 0xe1,0xfd,0xfd,0x1c, 0x3d,0x93,0x93,0xae, 0x4c,0x26,0x26,0x6a, 
+       0x6c,0x36,0x36,0x5a, 0x7e,0x3f,0x3f,0x41, 0xf5,0xf7,0xf7,0x02, 0x83,0xcc,0xcc,0x4f, 
+       0x68,0x34,0x34,0x5c, 0x51,0xa5,0xa5,0xf4, 0xd1,0xe5,0xe5,0x34, 0xf9,0xf1,0xf1,0x08, 
+       0xe2,0x71,0x71,0x93, 0xab,0xd8,0xd8,0x73, 0x62,0x31,0x31,0x53, 0x2a,0x15,0x15,0x3f, 
+       0x08,0x04,0x04,0x0c, 0x95,0xc7,0xc7,0x52, 0x46,0x23,0x23,0x65, 0x9d,0xc3,0xc3,0x5e, 
+       0x30,0x18,0x18,0x28, 0x37,0x96,0x96,0xa1, 0x0a,0x05,0x05,0x0f, 0x2f,0x9a,0x9a,0xb5, 
+       0x0e,0x07,0x07,0x09, 0x24,0x12,0x12,0x36, 0x1b,0x80,0x80,0x9b, 0xdf,0xe2,0xe2,0x3d, 
+       0xcd,0xeb,0xeb,0x26, 0x4e,0x27,0x27,0x69, 0x7f,0xb2,0xb2,0xcd, 0xea,0x75,0x75,0x9f, 
+       0x12,0x09,0x09,0x1b, 0x1d,0x83,0x83,0x9e, 0x58,0x2c,0x2c,0x74, 0x34,0x1a,0x1a,0x2e, 
+       0x36,0x1b,0x1b,0x2d, 0xdc,0x6e,0x6e,0xb2, 0xb4,0x5a,0x5a,0xee, 0x5b,0xa0,0xa0,0xfb, 
+       0xa4,0x52,0x52,0xf6, 0x76,0x3b,0x3b,0x4d, 0xb7,0xd6,0xd6,0x61, 0x7d,0xb3,0xb3,0xce, 
+       0x52,0x29,0x29,0x7b, 0xdd,0xe3,0xe3,0x3e, 0x5e,0x2f,0x2f,0x71, 0x13,0x84,0x84,0x97, 
+       0xa6,0x53,0x53,0xf5, 0xb9,0xd1,0xd1,0x68, 0x00,0x00,0x00,0x00, 0xc1,0xed,0xed,0x2c, 
+       0x40,0x20,0x20,0x60, 0xe3,0xfc,0xfc,0x1f, 0x79,0xb1,0xb1,0xc8, 0xb6,0x5b,0x5b,0xed, 
+       0xd4,0x6a,0x6a,0xbe, 0x8d,0xcb,0xcb,0x46, 0x67,0xbe,0xbe,0xd9, 0x72,0x39,0x39,0x4b, 
+       0x94,0x4a,0x4a,0xde, 0x98,0x4c,0x4c,0xd4, 0xb0,0x58,0x58,0xe8, 0x85,0xcf,0xcf,0x4a, 
+       0xbb,0xd0,0xd0,0x6b, 0xc5,0xef,0xef,0x2a, 0x4f,0xaa,0xaa,0xe5, 0xed,0xfb,0xfb,0x16, 
+       0x86,0x43,0x43,0xc5, 0x9a,0x4d,0x4d,0xd7, 0x66,0x33,0x33,0x55, 0x11,0x85,0x85,0x94, 
+       0x8a,0x45,0x45,0xcf, 0xe9,0xf9,0xf9,0x10, 0x04,0x02,0x02,0x06, 0xfe,0x7f,0x7f,0x81, 
+       0xa0,0x50,0x50,0xf0, 0x78,0x3c,0x3c,0x44, 0x25,0x9f,0x9f,0xba, 0x4b,0xa8,0xa8,0xe3, 
+       0xa2,0x51,0x51,0xf3, 0x5d,0xa3,0xa3,0xfe, 0x80,0x40,0x40,0xc0, 0x05,0x8f,0x8f,0x8a, 
+       0x3f,0x92,0x92,0xad, 0x21,0x9d,0x9d,0xbc, 0x70,0x38,0x38,0x48, 0xf1,0xf5,0xf5,0x04, 
+       0x63,0xbc,0xbc,0xdf, 0x77,0xb6,0xb6,0xc1, 0xaf,0xda,0xda,0x75, 0x42,0x21,0x21,0x63, 
+       0x20,0x10,0x10,0x30, 0xe5,0xff,0xff,0x1a, 0xfd,0xf3,0xf3,0x0e, 0xbf,0xd2,0xd2,0x6d, 
+       0x81,0xcd,0xcd,0x4c, 0x18,0x0c,0x0c,0x14, 0x26,0x13,0x13,0x35, 0xc3,0xec,0xec,0x2f, 
+       0xbe,0x5f,0x5f,0xe1, 0x35,0x97,0x97,0xa2, 0x88,0x44,0x44,0xcc, 0x2e,0x17,0x17,0x39, 
+       0x93,0xc4,0xc4,0x57, 0x55,0xa7,0xa7,0xf2, 0xfc,0x7e,0x7e,0x82, 0x7a,0x3d,0x3d,0x47, 
+       0xc8,0x64,0x64,0xac, 0xba,0x5d,0x5d,0xe7, 0x32,0x19,0x19,0x2b, 0xe6,0x73,0x73,0x95, 
+       0xc0,0x60,0x60,0xa0, 0x19,0x81,0x81,0x98, 0x9e,0x4f,0x4f,0xd1, 0xa3,0xdc,0xdc,0x7f, 
+       0x44,0x22,0x22,0x66, 0x54,0x2a,0x2a,0x7e, 0x3b,0x90,0x90,0xab, 0x0b,0x88,0x88,0x83, 
+       0x8c,0x46,0x46,0xca, 0xc7,0xee,0xee,0x29, 0x6b,0xb8,0xb8,0xd3, 0x28,0x14,0x14,0x3c, 
+       0xa7,0xde,0xde,0x79, 0xbc,0x5e,0x5e,0xe2, 0x16,0x0b,0x0b,0x1d, 0xad,0xdb,0xdb,0x76, 
+       0xdb,0xe0,0xe0,0x3b, 0x64,0x32,0x32,0x56, 0x74,0x3a,0x3a,0x4e, 0x14,0x0a,0x0a,0x1e, 
+       0x92,0x49,0x49,0xdb, 0x0c,0x06,0x06,0x0a, 0x48,0x24,0x24,0x6c, 0xb8,0x5c,0x5c,0xe4, 
+       0x9f,0xc2,0xc2,0x5d, 0xbd,0xd3,0xd3,0x6e, 0x43,0xac,0xac,0xef, 0xc4,0x62,0x62,0xa6, 
+       0x39,0x91,0x91,0xa8, 0x31,0x95,0x95,0xa4, 0xd3,0xe4,0xe4,0x37, 0xf2,0x79,0x79,0x8b, 
+       0xd5,0xe7,0xe7,0x32, 0x8b,0xc8,0xc8,0x43, 0x6e,0x37,0x37,0x59, 0xda,0x6d,0x6d,0xb7, 
+       0x01,0x8d,0x8d,0x8c, 0xb1,0xd5,0xd5,0x64, 0x9c,0x4e,0x4e,0xd2, 0x49,0xa9,0xa9,0xe0, 
+       0xd8,0x6c,0x6c,0xb4, 0xac,0x56,0x56,0xfa, 0xf3,0xf4,0xf4,0x07, 0xcf,0xea,0xea,0x25, 
+       0xca,0x65,0x65,0xaf, 0xf4,0x7a,0x7a,0x8e, 0x47,0xae,0xae,0xe9, 0x10,0x08,0x08,0x18, 
+       0x6f,0xba,0xba,0xd5, 0xf0,0x78,0x78,0x88, 0x4a,0x25,0x25,0x6f, 0x5c,0x2e,0x2e,0x72, 
+       0x38,0x1c,0x1c,0x24, 0x57,0xa6,0xa6,0xf1, 0x73,0xb4,0xb4,0xc7, 0x97,0xc6,0xc6,0x51, 
+       0xcb,0xe8,0xe8,0x23, 0xa1,0xdd,0xdd,0x7c, 0xe8,0x74,0x74,0x9c, 0x3e,0x1f,0x1f,0x21, 
+       0x96,0x4b,0x4b,0xdd, 0x61,0xbd,0xbd,0xdc, 0x0d,0x8b,0x8b,0x86, 0x0f,0x8a,0x8a,0x85, 
+       0xe0,0x70,0x70,0x90, 0x7c,0x3e,0x3e,0x42, 0x71,0xb5,0xb5,0xc4, 0xcc,0x66,0x66,0xaa, 
+       0x90,0x48,0x48,0xd8, 0x06,0x03,0x03,0x05, 0xf7,0xf6,0xf6,0x01, 0x1c,0x0e,0x0e,0x12, 
+       0xc2,0x61,0x61,0xa3, 0x6a,0x35,0x35,0x5f, 0xae,0x57,0x57,0xf9, 0x69,0xb9,0xb9,0xd0, 
+       0x17,0x86,0x86,0x91, 0x99,0xc1,0xc1,0x58, 0x3a,0x1d,0x1d,0x27, 0x27,0x9e,0x9e,0xb9, 
+       0xd9,0xe1,0xe1,0x38, 0xeb,0xf8,0xf8,0x13, 0x2b,0x98,0x98,0xb3, 0x22,0x11,0x11,0x33, 
+       0xd2,0x69,0x69,0xbb, 0xa9,0xd9,0xd9,0x70, 0x07,0x8e,0x8e,0x89, 0x33,0x94,0x94,0xa7, 
+       0x2d,0x9b,0x9b,0xb6, 0x3c,0x1e,0x1e,0x22, 0x15,0x87,0x87,0x92, 0xc9,0xe9,0xe9,0x20, 
+       0x87,0xce,0xce,0x49, 0xaa,0x55,0x55,0xff, 0x50,0x28,0x28,0x78, 0xa5,0xdf,0xdf,0x7a, 
+       0x03,0x8c,0x8c,0x8f, 0x59,0xa1,0xa1,0xf8, 0x09,0x89,0x89,0x80, 0x1a,0x0d,0x0d,0x17, 
+       0x65,0xbf,0xbf,0xda, 0xd7,0xe6,0xe6,0x31, 0x84,0x42,0x42,0xc6, 0xd0,0x68,0x68,0xb8, 
+       0x82,0x41,0x41,0xc3, 0x29,0x99,0x99,0xb0, 0x5a,0x2d,0x2d,0x77, 0x1e,0x0f,0x0f,0x11, 
+       0x7b,0xb0,0xb0,0xcb, 0xa8,0x54,0x54,0xfc, 0x6d,0xbb,0xbb,0xd6, 0x2c,0x16,0x16,0x3a
+};
+       
+static uint8_t T2[256][4]=
+{
+       0xa5,0xc6,0x63,0x63, 0x84,0xf8,0x7c,0x7c, 0x99,0xee,0x77,0x77, 0x8d,0xf6,0x7b,0x7b, 
+       0x0d,0xff,0xf2,0xf2, 0xbd,0xd6,0x6b,0x6b, 0xb1,0xde,0x6f,0x6f, 0x54,0x91,0xc5,0xc5, 
+       0x50,0x60,0x30,0x30, 0x03,0x02,0x01,0x01, 0xa9,0xce,0x67,0x67, 0x7d,0x56,0x2b,0x2b, 
+       0x19,0xe7,0xfe,0xfe, 0x62,0xb5,0xd7,0xd7, 0xe6,0x4d,0xab,0xab, 0x9a,0xec,0x76,0x76, 
+       0x45,0x8f,0xca,0xca, 0x9d,0x1f,0x82,0x82, 0x40,0x89,0xc9,0xc9, 0x87,0xfa,0x7d,0x7d, 
+       0x15,0xef,0xfa,0xfa, 0xeb,0xb2,0x59,0x59, 0xc9,0x8e,0x47,0x47, 0x0b,0xfb,0xf0,0xf0, 
+       0xec,0x41,0xad,0xad, 0x67,0xb3,0xd4,0xd4, 0xfd,0x5f,0xa2,0xa2, 0xea,0x45,0xaf,0xaf, 
+       0xbf,0x23,0x9c,0x9c, 0xf7,0x53,0xa4,0xa4, 0x96,0xe4,0x72,0x72, 0x5b,0x9b,0xc0,0xc0, 
+       0xc2,0x75,0xb7,0xb7, 0x1c,0xe1,0xfd,0xfd, 0xae,0x3d,0x93,0x93, 0x6a,0x4c,0x26,0x26, 
+       0x5a,0x6c,0x36,0x36, 0x41,0x7e,0x3f,0x3f, 0x02,0xf5,0xf7,0xf7, 0x4f,0x83,0xcc,0xcc, 
+       0x5c,0x68,0x34,0x34, 0xf4,0x51,0xa5,0xa5, 0x34,0xd1,0xe5,0xe5, 0x08,0xf9,0xf1,0xf1, 
+       0x93,0xe2,0x71,0x71, 0x73,0xab,0xd8,0xd8, 0x53,0x62,0x31,0x31, 0x3f,0x2a,0x15,0x15, 
+       0x0c,0x08,0x04,0x04, 0x52,0x95,0xc7,0xc7, 0x65,0x46,0x23,0x23, 0x5e,0x9d,0xc3,0xc3, 
+       0x28,0x30,0x18,0x18, 0xa1,0x37,0x96,0x96, 0x0f,0x0a,0x05,0x05, 0xb5,0x2f,0x9a,0x9a, 
+       0x09,0x0e,0x07,0x07, 0x36,0x24,0x12,0x12, 0x9b,0x1b,0x80,0x80, 0x3d,0xdf,0xe2,0xe2, 
+       0x26,0xcd,0xeb,0xeb, 0x69,0x4e,0x27,0x27, 0xcd,0x7f,0xb2,0xb2, 0x9f,0xea,0x75,0x75, 
+       0x1b,0x12,0x09,0x09, 0x9e,0x1d,0x83,0x83, 0x74,0x58,0x2c,0x2c, 0x2e,0x34,0x1a,0x1a, 
+       0x2d,0x36,0x1b,0x1b, 0xb2,0xdc,0x6e,0x6e, 0xee,0xb4,0x5a,0x5a, 0xfb,0x5b,0xa0,0xa0, 
+       0xf6,0xa4,0x52,0x52, 0x4d,0x76,0x3b,0x3b, 0x61,0xb7,0xd6,0xd6, 0xce,0x7d,0xb3,0xb3, 
+       0x7b,0x52,0x29,0x29, 0x3e,0xdd,0xe3,0xe3, 0x71,0x5e,0x2f,0x2f, 0x97,0x13,0x84,0x84, 
+       0xf5,0xa6,0x53,0x53, 0x68,0xb9,0xd1,0xd1, 0x00,0x00,0x00,0x00, 0x2c,0xc1,0xed,0xed, 
+       0x60,0x40,0x20,0x20, 0x1f,0xe3,0xfc,0xfc, 0xc8,0x79,0xb1,0xb1, 0xed,0xb6,0x5b,0x5b, 
+       0xbe,0xd4,0x6a,0x6a, 0x46,0x8d,0xcb,0xcb, 0xd9,0x67,0xbe,0xbe, 0x4b,0x72,0x39,0x39, 
+       0xde,0x94,0x4a,0x4a, 0xd4,0x98,0x4c,0x4c, 0xe8,0xb0,0x58,0x58, 0x4a,0x85,0xcf,0xcf, 
+       0x6b,0xbb,0xd0,0xd0, 0x2a,0xc5,0xef,0xef, 0xe5,0x4f,0xaa,0xaa, 0x16,0xed,0xfb,0xfb, 
+       0xc5,0x86,0x43,0x43, 0xd7,0x9a,0x4d,0x4d, 0x55,0x66,0x33,0x33, 0x94,0x11,0x85,0x85, 
+       0xcf,0x8a,0x45,0x45, 0x10,0xe9,0xf9,0xf9, 0x06,0x04,0x02,0x02, 0x81,0xfe,0x7f,0x7f, 
+       0xf0,0xa0,0x50,0x50, 0x44,0x78,0x3c,0x3c, 0xba,0x25,0x9f,0x9f, 0xe3,0x4b,0xa8,0xa8, 
+       0xf3,0xa2,0x51,0x51, 0xfe,0x5d,0xa3,0xa3, 0xc0,0x80,0x40,0x40, 0x8a,0x05,0x8f,0x8f, 
+       0xad,0x3f,0x92,0x92, 0xbc,0x21,0x9d,0x9d, 0x48,0x70,0x38,0x38, 0x04,0xf1,0xf5,0xf5, 
+       0xdf,0x63,0xbc,0xbc, 0xc1,0x77,0xb6,0xb6, 0x75,0xaf,0xda,0xda, 0x63,0x42,0x21,0x21, 
+       0x30,0x20,0x10,0x10, 0x1a,0xe5,0xff,0xff, 0x0e,0xfd,0xf3,0xf3, 0x6d,0xbf,0xd2,0xd2, 
+       0x4c,0x81,0xcd,0xcd, 0x14,0x18,0x0c,0x0c, 0x35,0x26,0x13,0x13, 0x2f,0xc3,0xec,0xec, 
+       0xe1,0xbe,0x5f,0x5f, 0xa2,0x35,0x97,0x97, 0xcc,0x88,0x44,0x44, 0x39,0x2e,0x17,0x17, 
+       0x57,0x93,0xc4,0xc4, 0xf2,0x55,0xa7,0xa7, 0x82,0xfc,0x7e,0x7e, 0x47,0x7a,0x3d,0x3d, 
+       0xac,0xc8,0x64,0x64, 0xe7,0xba,0x5d,0x5d, 0x2b,0x32,0x19,0x19, 0x95,0xe6,0x73,0x73, 
+       0xa0,0xc0,0x60,0x60, 0x98,0x19,0x81,0x81, 0xd1,0x9e,0x4f,0x4f, 0x7f,0xa3,0xdc,0xdc, 
+       0x66,0x44,0x22,0x22, 0x7e,0x54,0x2a,0x2a, 0xab,0x3b,0x90,0x90, 0x83,0x0b,0x88,0x88, 
+       0xca,0x8c,0x46,0x46, 0x29,0xc7,0xee,0xee, 0xd3,0x6b,0xb8,0xb8, 0x3c,0x28,0x14,0x14, 
+       0x79,0xa7,0xde,0xde, 0xe2,0xbc,0x5e,0x5e, 0x1d,0x16,0x0b,0x0b, 0x76,0xad,0xdb,0xdb, 
+       0x3b,0xdb,0xe0,0xe0, 0x56,0x64,0x32,0x32, 0x4e,0x74,0x3a,0x3a, 0x1e,0x14,0x0a,0x0a, 
+       0xdb,0x92,0x49,0x49, 0x0a,0x0c,0x06,0x06, 0x6c,0x48,0x24,0x24, 0xe4,0xb8,0x5c,0x5c, 
+       0x5d,0x9f,0xc2,0xc2, 0x6e,0xbd,0xd3,0xd3, 0xef,0x43,0xac,0xac, 0xa6,0xc4,0x62,0x62, 
+       0xa8,0x39,0x91,0x91, 0xa4,0x31,0x95,0x95, 0x37,0xd3,0xe4,0xe4, 0x8b,0xf2,0x79,0x79, 
+       0x32,0xd5,0xe7,0xe7, 0x43,0x8b,0xc8,0xc8, 0x59,0x6e,0x37,0x37, 0xb7,0xda,0x6d,0x6d, 
+       0x8c,0x01,0x8d,0x8d, 0x64,0xb1,0xd5,0xd5, 0xd2,0x9c,0x4e,0x4e, 0xe0,0x49,0xa9,0xa9, 
+       0xb4,0xd8,0x6c,0x6c, 0xfa,0xac,0x56,0x56, 0x07,0xf3,0xf4,0xf4, 0x25,0xcf,0xea,0xea, 
+       0xaf,0xca,0x65,0x65, 0x8e,0xf4,0x7a,0x7a, 0xe9,0x47,0xae,0xae, 0x18,0x10,0x08,0x08, 
+       0xd5,0x6f,0xba,0xba, 0x88,0xf0,0x78,0x78, 0x6f,0x4a,0x25,0x25, 0x72,0x5c,0x2e,0x2e, 
+       0x24,0x38,0x1c,0x1c, 0xf1,0x57,0xa6,0xa6, 0xc7,0x73,0xb4,0xb4, 0x51,0x97,0xc6,0xc6, 
+       0x23,0xcb,0xe8,0xe8, 0x7c,0xa1,0xdd,0xdd, 0x9c,0xe8,0x74,0x74, 0x21,0x3e,0x1f,0x1f, 
+       0xdd,0x96,0x4b,0x4b, 0xdc,0x61,0xbd,0xbd, 0x86,0x0d,0x8b,0x8b, 0x85,0x0f,0x8a,0x8a, 
+       0x90,0xe0,0x70,0x70, 0x42,0x7c,0x3e,0x3e, 0xc4,0x71,0xb5,0xb5, 0xaa,0xcc,0x66,0x66, 
+       0xd8,0x90,0x48,0x48, 0x05,0x06,0x03,0x03, 0x01,0xf7,0xf6,0xf6, 0x12,0x1c,0x0e,0x0e, 
+       0xa3,0xc2,0x61,0x61, 0x5f,0x6a,0x35,0x35, 0xf9,0xae,0x57,0x57, 0xd0,0x69,0xb9,0xb9, 
+       0x91,0x17,0x86,0x86, 0x58,0x99,0xc1,0xc1, 0x27,0x3a,0x1d,0x1d, 0xb9,0x27,0x9e,0x9e, 
+       0x38,0xd9,0xe1,0xe1, 0x13,0xeb,0xf8,0xf8, 0xb3,0x2b,0x98,0x98, 0x33,0x22,0x11,0x11, 
+       0xbb,0xd2,0x69,0x69, 0x70,0xa9,0xd9,0xd9, 0x89,0x07,0x8e,0x8e, 0xa7,0x33,0x94,0x94, 
+       0xb6,0x2d,0x9b,0x9b, 0x22,0x3c,0x1e,0x1e, 0x92,0x15,0x87,0x87, 0x20,0xc9,0xe9,0xe9, 
+       0x49,0x87,0xce,0xce, 0xff,0xaa,0x55,0x55, 0x78,0x50,0x28,0x28, 0x7a,0xa5,0xdf,0xdf, 
+       0x8f,0x03,0x8c,0x8c, 0xf8,0x59,0xa1,0xa1, 0x80,0x09,0x89,0x89, 0x17,0x1a,0x0d,0x0d, 
+       0xda,0x65,0xbf,0xbf, 0x31,0xd7,0xe6,0xe6, 0xc6,0x84,0x42,0x42, 0xb8,0xd0,0x68,0x68, 
+       0xc3,0x82,0x41,0x41, 0xb0,0x29,0x99,0x99, 0x77,0x5a,0x2d,0x2d, 0x11,0x1e,0x0f,0x0f, 
+       0xcb,0x7b,0xb0,0xb0, 0xfc,0xa8,0x54,0x54, 0xd6,0x6d,0xbb,0xbb, 0x3a,0x2c,0x16,0x16
+};
+
+static uint8_t T3[256][4]=
+{
+       0x63,0xa5,0xc6,0x63, 0x7c,0x84,0xf8,0x7c, 0x77,0x99,0xee,0x77, 0x7b,0x8d,0xf6,0x7b, 
+       0xf2,0x0d,0xff,0xf2, 0x6b,0xbd,0xd6,0x6b, 0x6f,0xb1,0xde,0x6f, 0xc5,0x54,0x91,0xc5, 
+       0x30,0x50,0x60,0x30, 0x01,0x03,0x02,0x01, 0x67,0xa9,0xce,0x67, 0x2b,0x7d,0x56,0x2b, 
+       0xfe,0x19,0xe7,0xfe, 0xd7,0x62,0xb5,0xd7, 0xab,0xe6,0x4d,0xab, 0x76,0x9a,0xec,0x76, 
+       0xca,0x45,0x8f,0xca, 0x82,0x9d,0x1f,0x82, 0xc9,0x40,0x89,0xc9, 0x7d,0x87,0xfa,0x7d, 
+       0xfa,0x15,0xef,0xfa, 0x59,0xeb,0xb2,0x59, 0x47,0xc9,0x8e,0x47, 0xf0,0x0b,0xfb,0xf0, 
+       0xad,0xec,0x41,0xad, 0xd4,0x67,0xb3,0xd4, 0xa2,0xfd,0x5f,0xa2, 0xaf,0xea,0x45,0xaf, 
+       0x9c,0xbf,0x23,0x9c, 0xa4,0xf7,0x53,0xa4, 0x72,0x96,0xe4,0x72, 0xc0,0x5b,0x9b,0xc0, 
+       0xb7,0xc2,0x75,0xb7, 0xfd,0x1c,0xe1,0xfd, 0x93,0xae,0x3d,0x93, 0x26,0x6a,0x4c,0x26, 
+       0x36,0x5a,0x6c,0x36, 0x3f,0x41,0x7e,0x3f, 0xf7,0x02,0xf5,0xf7, 0xcc,0x4f,0x83,0xcc, 
+       0x34,0x5c,0x68,0x34, 0xa5,0xf4,0x51,0xa5, 0xe5,0x34,0xd1,0xe5, 0xf1,0x08,0xf9,0xf1, 
+       0x71,0x93,0xe2,0x71, 0xd8,0x73,0xab,0xd8, 0x31,0x53,0x62,0x31, 0x15,0x3f,0x2a,0x15, 
+       0x04,0x0c,0x08,0x04, 0xc7,0x52,0x95,0xc7, 0x23,0x65,0x46,0x23, 0xc3,0x5e,0x9d,0xc3, 
+       0x18,0x28,0x30,0x18, 0x96,0xa1,0x37,0x96, 0x05,0x0f,0x0a,0x05, 0x9a,0xb5,0x2f,0x9a, 
+       0x07,0x09,0x0e,0x07, 0x12,0x36,0x24,0x12, 0x80,0x9b,0x1b,0x80, 0xe2,0x3d,0xdf,0xe2, 
+       0xeb,0x26,0xcd,0xeb, 0x27,0x69,0x4e,0x27, 0xb2,0xcd,0x7f,0xb2, 0x75,0x9f,0xea,0x75, 
+       0x09,0x1b,0x12,0x09, 0x83,0x9e,0x1d,0x83, 0x2c,0x74,0x58,0x2c, 0x1a,0x2e,0x34,0x1a, 
+       0x1b,0x2d,0x36,0x1b, 0x6e,0xb2,0xdc,0x6e, 0x5a,0xee,0xb4,0x5a, 0xa0,0xfb,0x5b,0xa0, 
+       0x52,0xf6,0xa4,0x52, 0x3b,0x4d,0x76,0x3b, 0xd6,0x61,0xb7,0xd6, 0xb3,0xce,0x7d,0xb3, 
+       0x29,0x7b,0x52,0x29, 0xe3,0x3e,0xdd,0xe3, 0x2f,0x71,0x5e,0x2f, 0x84,0x97,0x13,0x84, 
+       0x53,0xf5,0xa6,0x53, 0xd1,0x68,0xb9,0xd1, 0x00,0x00,0x00,0x00, 0xed,0x2c,0xc1,0xed, 
+       0x20,0x60,0x40,0x20, 0xfc,0x1f,0xe3,0xfc, 0xb1,0xc8,0x79,0xb1, 0x5b,0xed,0xb6,0x5b, 
+       0x6a,0xbe,0xd4,0x6a, 0xcb,0x46,0x8d,0xcb, 0xbe,0xd9,0x67,0xbe, 0x39,0x4b,0x72,0x39, 
+       0x4a,0xde,0x94,0x4a, 0x4c,0xd4,0x98,0x4c, 0x58,0xe8,0xb0,0x58, 0xcf,0x4a,0x85,0xcf, 
+       0xd0,0x6b,0xbb,0xd0, 0xef,0x2a,0xc5,0xef, 0xaa,0xe5,0x4f,0xaa, 0xfb,0x16,0xed,0xfb, 
+       0x43,0xc5,0x86,0x43, 0x4d,0xd7,0x9a,0x4d, 0x33,0x55,0x66,0x33, 0x85,0x94,0x11,0x85, 
+       0x45,0xcf,0x8a,0x45, 0xf9,0x10,0xe9,0xf9, 0x02,0x06,0x04,0x02, 0x7f,0x81,0xfe,0x7f, 
+       0x50,0xf0,0xa0,0x50, 0x3c,0x44,0x78,0x3c, 0x9f,0xba,0x25,0x9f, 0xa8,0xe3,0x4b,0xa8, 
+       0x51,0xf3,0xa2,0x51, 0xa3,0xfe,0x5d,0xa3, 0x40,0xc0,0x80,0x40, 0x8f,0x8a,0x05,0x8f, 
+       0x92,0xad,0x3f,0x92, 0x9d,0xbc,0x21,0x9d, 0x38,0x48,0x70,0x38, 0xf5,0x04,0xf1,0xf5, 
+       0xbc,0xdf,0x63,0xbc, 0xb6,0xc1,0x77,0xb6, 0xda,0x75,0xaf,0xda, 0x21,0x63,0x42,0x21, 
+       0x10,0x30,0x20,0x10, 0xff,0x1a,0xe5,0xff, 0xf3,0x0e,0xfd,0xf3, 0xd2,0x6d,0xbf,0xd2, 
+       0xcd,0x4c,0x81,0xcd, 0x0c,0x14,0x18,0x0c, 0x13,0x35,0x26,0x13, 0xec,0x2f,0xc3,0xec, 
+       0x5f,0xe1,0xbe,0x5f, 0x97,0xa2,0x35,0x97, 0x44,0xcc,0x88,0x44, 0x17,0x39,0x2e,0x17, 
+       0xc4,0x57,0x93,0xc4, 0xa7,0xf2,0x55,0xa7, 0x7e,0x82,0xfc,0x7e, 0x3d,0x47,0x7a,0x3d, 
+       0x64,0xac,0xc8,0x64, 0x5d,0xe7,0xba,0x5d, 0x19,0x2b,0x32,0x19, 0x73,0x95,0xe6,0x73, 
+       0x60,0xa0,0xc0,0x60, 0x81,0x98,0x19,0x81, 0x4f,0xd1,0x9e,0x4f, 0xdc,0x7f,0xa3,0xdc, 
+       0x22,0x66,0x44,0x22, 0x2a,0x7e,0x54,0x2a, 0x90,0xab,0x3b,0x90, 0x88,0x83,0x0b,0x88, 
+       0x46,0xca,0x8c,0x46, 0xee,0x29,0xc7,0xee, 0xb8,0xd3,0x6b,0xb8, 0x14,0x3c,0x28,0x14, 
+       0xde,0x79,0xa7,0xde, 0x5e,0xe2,0xbc,0x5e, 0x0b,0x1d,0x16,0x0b, 0xdb,0x76,0xad,0xdb, 
+       0xe0,0x3b,0xdb,0xe0, 0x32,0x56,0x64,0x32, 0x3a,0x4e,0x74,0x3a, 0x0a,0x1e,0x14,0x0a, 
+       0x49,0xdb,0x92,0x49, 0x06,0x0a,0x0c,0x06, 0x24,0x6c,0x48,0x24, 0x5c,0xe4,0xb8,0x5c, 
+       0xc2,0x5d,0x9f,0xc2, 0xd3,0x6e,0xbd,0xd3, 0xac,0xef,0x43,0xac, 0x62,0xa6,0xc4,0x62, 
+       0x91,0xa8,0x39,0x91, 0x95,0xa4,0x31,0x95, 0xe4,0x37,0xd3,0xe4, 0x79,0x8b,0xf2,0x79, 
+       0xe7,0x32,0xd5,0xe7, 0xc8,0x43,0x8b,0xc8, 0x37,0x59,0x6e,0x37, 0x6d,0xb7,0xda,0x6d, 
+       0x8d,0x8c,0x01,0x8d, 0xd5,0x64,0xb1,0xd5, 0x4e,0xd2,0x9c,0x4e, 0xa9,0xe0,0x49,0xa9, 
+       0x6c,0xb4,0xd8,0x6c, 0x56,0xfa,0xac,0x56, 0xf4,0x07,0xf3,0xf4, 0xea,0x25,0xcf,0xea, 
+       0x65,0xaf,0xca,0x65, 0x7a,0x8e,0xf4,0x7a, 0xae,0xe9,0x47,0xae, 0x08,0x18,0x10,0x08, 
+       0xba,0xd5,0x6f,0xba, 0x78,0x88,0xf0,0x78, 0x25,0x6f,0x4a,0x25, 0x2e,0x72,0x5c,0x2e, 
+       0x1c,0x24,0x38,0x1c, 0xa6,0xf1,0x57,0xa6, 0xb4,0xc7,0x73,0xb4, 0xc6,0x51,0x97,0xc6, 
+       0xe8,0x23,0xcb,0xe8, 0xdd,0x7c,0xa1,0xdd, 0x74,0x9c,0xe8,0x74, 0x1f,0x21,0x3e,0x1f, 
+       0x4b,0xdd,0x96,0x4b, 0xbd,0xdc,0x61,0xbd, 0x8b,0x86,0x0d,0x8b, 0x8a,0x85,0x0f,0x8a, 
+       0x70,0x90,0xe0,0x70, 0x3e,0x42,0x7c,0x3e, 0xb5,0xc4,0x71,0xb5, 0x66,0xaa,0xcc,0x66, 
+       0x48,0xd8,0x90,0x48, 0x03,0x05,0x06,0x03, 0xf6,0x01,0xf7,0xf6, 0x0e,0x12,0x1c,0x0e, 
+       0x61,0xa3,0xc2,0x61, 0x35,0x5f,0x6a,0x35, 0x57,0xf9,0xae,0x57, 0xb9,0xd0,0x69,0xb9, 
+       0x86,0x91,0x17,0x86, 0xc1,0x58,0x99,0xc1, 0x1d,0x27,0x3a,0x1d, 0x9e,0xb9,0x27,0x9e, 
+       0xe1,0x38,0xd9,0xe1, 0xf8,0x13,0xeb,0xf8, 0x98,0xb3,0x2b,0x98, 0x11,0x33,0x22,0x11, 
+       0x69,0xbb,0xd2,0x69, 0xd9,0x70,0xa9,0xd9, 0x8e,0x89,0x07,0x8e, 0x94,0xa7,0x33,0x94, 
+       0x9b,0xb6,0x2d,0x9b, 0x1e,0x22,0x3c,0x1e, 0x87,0x92,0x15,0x87, 0xe9,0x20,0xc9,0xe9, 
+       0xce,0x49,0x87,0xce, 0x55,0xff,0xaa,0x55, 0x28,0x78,0x50,0x28, 0xdf,0x7a,0xa5,0xdf, 
+       0x8c,0x8f,0x03,0x8c, 0xa1,0xf8,0x59,0xa1, 0x89,0x80,0x09,0x89, 0x0d,0x17,0x1a,0x0d, 
+       0xbf,0xda,0x65,0xbf, 0xe6,0x31,0xd7,0xe6, 0x42,0xc6,0x84,0x42, 0x68,0xb8,0xd0,0x68, 
+       0x41,0xc3,0x82,0x41, 0x99,0xb0,0x29,0x99, 0x2d,0x77,0x5a,0x2d, 0x0f,0x11,0x1e,0x0f, 
+       0xb0,0xcb,0x7b,0xb0, 0x54,0xfc,0xa8,0x54, 0xbb,0xd6,0x6d,0xbb, 0x16,0x3a,0x2c,0x16
+};
+
+static uint8_t T4[256][4]=
+{
+       0x63,0x63,0xa5,0xc6, 0x7c,0x7c,0x84,0xf8, 0x77,0x77,0x99,0xee, 0x7b,0x7b,0x8d,0xf6, 
+       0xf2,0xf2,0x0d,0xff, 0x6b,0x6b,0xbd,0xd6, 0x6f,0x6f,0xb1,0xde, 0xc5,0xc5,0x54,0x91, 
+       0x30,0x30,0x50,0x60, 0x01,0x01,0x03,0x02, 0x67,0x67,0xa9,0xce, 0x2b,0x2b,0x7d,0x56, 
+       0xfe,0xfe,0x19,0xe7, 0xd7,0xd7,0x62,0xb5, 0xab,0xab,0xe6,0x4d, 0x76,0x76,0x9a,0xec, 
+       0xca,0xca,0x45,0x8f, 0x82,0x82,0x9d,0x1f, 0xc9,0xc9,0x40,0x89, 0x7d,0x7d,0x87,0xfa, 
+       0xfa,0xfa,0x15,0xef, 0x59,0x59,0xeb,0xb2, 0x47,0x47,0xc9,0x8e, 0xf0,0xf0,0x0b,0xfb, 
+       0xad,0xad,0xec,0x41, 0xd4,0xd4,0x67,0xb3, 0xa2,0xa2,0xfd,0x5f, 0xaf,0xaf,0xea,0x45, 
+       0x9c,0x9c,0xbf,0x23, 0xa4,0xa4,0xf7,0x53, 0x72,0x72,0x96,0xe4, 0xc0,0xc0,0x5b,0x9b, 
+       0xb7,0xb7,0xc2,0x75, 0xfd,0xfd,0x1c,0xe1, 0x93,0x93,0xae,0x3d, 0x26,0x26,0x6a,0x4c, 
+       0x36,0x36,0x5a,0x6c, 0x3f,0x3f,0x41,0x7e, 0xf7,0xf7,0x02,0xf5, 0xcc,0xcc,0x4f,0x83, 
+       0x34,0x34,0x5c,0x68, 0xa5,0xa5,0xf4,0x51, 0xe5,0xe5,0x34,0xd1, 0xf1,0xf1,0x08,0xf9, 
+       0x71,0x71,0x93,0xe2, 0xd8,0xd8,0x73,0xab, 0x31,0x31,0x53,0x62, 0x15,0x15,0x3f,0x2a, 
+       0x04,0x04,0x0c,0x08, 0xc7,0xc7,0x52,0x95, 0x23,0x23,0x65,0x46, 0xc3,0xc3,0x5e,0x9d, 
+       0x18,0x18,0x28,0x30, 0x96,0x96,0xa1,0x37, 0x05,0x05,0x0f,0x0a, 0x9a,0x9a,0xb5,0x2f, 
+       0x07,0x07,0x09,0x0e, 0x12,0x12,0x36,0x24, 0x80,0x80,0x9b,0x1b, 0xe2,0xe2,0x3d,0xdf, 
+       0xeb,0xeb,0x26,0xcd, 0x27,0x27,0x69,0x4e, 0xb2,0xb2,0xcd,0x7f, 0x75,0x75,0x9f,0xea, 
+       0x09,0x09,0x1b,0x12, 0x83,0x83,0x9e,0x1d, 0x2c,0x2c,0x74,0x58, 0x1a,0x1a,0x2e,0x34, 
+       0x1b,0x1b,0x2d,0x36, 0x6e,0x6e,0xb2,0xdc, 0x5a,0x5a,0xee,0xb4, 0xa0,0xa0,0xfb,0x5b, 
+       0x52,0x52,0xf6,0xa4, 0x3b,0x3b,0x4d,0x76, 0xd6,0xd6,0x61,0xb7, 0xb3,0xb3,0xce,0x7d, 
+       0x29,0x29,0x7b,0x52, 0xe3,0xe3,0x3e,0xdd, 0x2f,0x2f,0x71,0x5e, 0x84,0x84,0x97,0x13, 
+       0x53,0x53,0xf5,0xa6, 0xd1,0xd1,0x68,0xb9, 0x00,0x00,0x00,0x00, 0xed,0xed,0x2c,0xc1, 
+       0x20,0x20,0x60,0x40, 0xfc,0xfc,0x1f,0xe3, 0xb1,0xb1,0xc8,0x79, 0x5b,0x5b,0xed,0xb6, 
+       0x6a,0x6a,0xbe,0xd4, 0xcb,0xcb,0x46,0x8d, 0xbe,0xbe,0xd9,0x67, 0x39,0x39,0x4b,0x72, 
+       0x4a,0x4a,0xde,0x94, 0x4c,0x4c,0xd4,0x98, 0x58,0x58,0xe8,0xb0, 0xcf,0xcf,0x4a,0x85, 
+       0xd0,0xd0,0x6b,0xbb, 0xef,0xef,0x2a,0xc5, 0xaa,0xaa,0xe5,0x4f, 0xfb,0xfb,0x16,0xed, 
+       0x43,0x43,0xc5,0x86, 0x4d,0x4d,0xd7,0x9a, 0x33,0x33,0x55,0x66, 0x85,0x85,0x94,0x11, 
+       0x45,0x45,0xcf,0x8a, 0xf9,0xf9,0x10,0xe9, 0x02,0x02,0x06,0x04, 0x7f,0x7f,0x81,0xfe, 
+       0x50,0x50,0xf0,0xa0, 0x3c,0x3c,0x44,0x78, 0x9f,0x9f,0xba,0x25, 0xa8,0xa8,0xe3,0x4b, 
+       0x51,0x51,0xf3,0xa2, 0xa3,0xa3,0xfe,0x5d, 0x40,0x40,0xc0,0x80, 0x8f,0x8f,0x8a,0x05, 
+       0x92,0x92,0xad,0x3f, 0x9d,0x9d,0xbc,0x21, 0x38,0x38,0x48,0x70, 0xf5,0xf5,0x04,0xf1, 
+       0xbc,0xbc,0xdf,0x63, 0xb6,0xb6,0xc1,0x77, 0xda,0xda,0x75,0xaf, 0x21,0x21,0x63,0x42, 
+       0x10,0x10,0x30,0x20, 0xff,0xff,0x1a,0xe5, 0xf3,0xf3,0x0e,0xfd, 0xd2,0xd2,0x6d,0xbf, 
+       0xcd,0xcd,0x4c,0x81, 0x0c,0x0c,0x14,0x18, 0x13,0x13,0x35,0x26, 0xec,0xec,0x2f,0xc3, 
+       0x5f,0x5f,0xe1,0xbe, 0x97,0x97,0xa2,0x35, 0x44,0x44,0xcc,0x88, 0x17,0x17,0x39,0x2e, 
+       0xc4,0xc4,0x57,0x93, 0xa7,0xa7,0xf2,0x55, 0x7e,0x7e,0x82,0xfc, 0x3d,0x3d,0x47,0x7a, 
+       0x64,0x64,0xac,0xc8, 0x5d,0x5d,0xe7,0xba, 0x19,0x19,0x2b,0x32, 0x73,0x73,0x95,0xe6, 
+       0x60,0x60,0xa0,0xc0, 0x81,0x81,0x98,0x19, 0x4f,0x4f,0xd1,0x9e, 0xdc,0xdc,0x7f,0xa3, 
+       0x22,0x22,0x66,0x44, 0x2a,0x2a,0x7e,0x54, 0x90,0x90,0xab,0x3b, 0x88,0x88,0x83,0x0b, 
+       0x46,0x46,0xca,0x8c, 0xee,0xee,0x29,0xc7, 0xb8,0xb8,0xd3,0x6b, 0x14,0x14,0x3c,0x28, 
+       0xde,0xde,0x79,0xa7, 0x5e,0x5e,0xe2,0xbc, 0x0b,0x0b,0x1d,0x16, 0xdb,0xdb,0x76,0xad, 
+       0xe0,0xe0,0x3b,0xdb, 0x32,0x32,0x56,0x64, 0x3a,0x3a,0x4e,0x74, 0x0a,0x0a,0x1e,0x14, 
+       0x49,0x49,0xdb,0x92, 0x06,0x06,0x0a,0x0c, 0x24,0x24,0x6c,0x48, 0x5c,0x5c,0xe4,0xb8, 
+       0xc2,0xc2,0x5d,0x9f, 0xd3,0xd3,0x6e,0xbd, 0xac,0xac,0xef,0x43, 0x62,0x62,0xa6,0xc4, 
+       0x91,0x91,0xa8,0x39, 0x95,0x95,0xa4,0x31, 0xe4,0xe4,0x37,0xd3, 0x79,0x79,0x8b,0xf2, 
+       0xe7,0xe7,0x32,0xd5, 0xc8,0xc8,0x43,0x8b, 0x37,0x37,0x59,0x6e, 0x6d,0x6d,0xb7,0xda, 
+       0x8d,0x8d,0x8c,0x01, 0xd5,0xd5,0x64,0xb1, 0x4e,0x4e,0xd2,0x9c, 0xa9,0xa9,0xe0,0x49, 
+       0x6c,0x6c,0xb4,0xd8, 0x56,0x56,0xfa,0xac, 0xf4,0xf4,0x07,0xf3, 0xea,0xea,0x25,0xcf, 
+       0x65,0x65,0xaf,0xca, 0x7a,0x7a,0x8e,0xf4, 0xae,0xae,0xe9,0x47, 0x08,0x08,0x18,0x10, 
+       0xba,0xba,0xd5,0x6f, 0x78,0x78,0x88,0xf0, 0x25,0x25,0x6f,0x4a, 0x2e,0x2e,0x72,0x5c, 
+       0x1c,0x1c,0x24,0x38, 0xa6,0xa6,0xf1,0x57, 0xb4,0xb4,0xc7,0x73, 0xc6,0xc6,0x51,0x97, 
+       0xe8,0xe8,0x23,0xcb, 0xdd,0xdd,0x7c,0xa1, 0x74,0x74,0x9c,0xe8, 0x1f,0x1f,0x21,0x3e, 
+       0x4b,0x4b,0xdd,0x96, 0xbd,0xbd,0xdc,0x61, 0x8b,0x8b,0x86,0x0d, 0x8a,0x8a,0x85,0x0f, 
+       0x70,0x70,0x90,0xe0, 0x3e,0x3e,0x42,0x7c, 0xb5,0xb5,0xc4,0x71, 0x66,0x66,0xaa,0xcc, 
+       0x48,0x48,0xd8,0x90, 0x03,0x03,0x05,0x06, 0xf6,0xf6,0x01,0xf7, 0x0e,0x0e,0x12,0x1c, 
+       0x61,0x61,0xa3,0xc2, 0x35,0x35,0x5f,0x6a, 0x57,0x57,0xf9,0xae, 0xb9,0xb9,0xd0,0x69, 
+       0x86,0x86,0x91,0x17, 0xc1,0xc1,0x58,0x99, 0x1d,0x1d,0x27,0x3a, 0x9e,0x9e,0xb9,0x27, 
+       0xe1,0xe1,0x38,0xd9, 0xf8,0xf8,0x13,0xeb, 0x98,0x98,0xb3,0x2b, 0x11,0x11,0x33,0x22, 
+       0x69,0x69,0xbb,0xd2, 0xd9,0xd9,0x70,0xa9, 0x8e,0x8e,0x89,0x07, 0x94,0x94,0xa7,0x33, 
+       0x9b,0x9b,0xb6,0x2d, 0x1e,0x1e,0x22,0x3c, 0x87,0x87,0x92,0x15, 0xe9,0xe9,0x20,0xc9, 
+       0xce,0xce,0x49,0x87, 0x55,0x55,0xff,0xaa, 0x28,0x28,0x78,0x50, 0xdf,0xdf,0x7a,0xa5, 
+       0x8c,0x8c,0x8f,0x03, 0xa1,0xa1,0xf8,0x59, 0x89,0x89,0x80,0x09, 0x0d,0x0d,0x17,0x1a, 
+       0xbf,0xbf,0xda,0x65, 0xe6,0xe6,0x31,0xd7, 0x42,0x42,0xc6,0x84, 0x68,0x68,0xb8,0xd0, 
+       0x41,0x41,0xc3,0x82, 0x99,0x99,0xb0,0x29, 0x2d,0x2d,0x77,0x5a, 0x0f,0x0f,0x11,0x1e, 
+       0xb0,0xb0,0xcb,0x7b, 0x54,0x54,0xfc,0xa8, 0xbb,0xbb,0xd6,0x6d, 0x16,0x16,0x3a,0x2c
+};
+
+static uint8_t T5[256][4]=
+{
+       0x51,0xf4,0xa7,0x50, 0x7e,0x41,0x65,0x53, 0x1a,0x17,0xa4,0xc3, 0x3a,0x27,0x5e,0x96, 
+       0x3b,0xab,0x6b,0xcb, 0x1f,0x9d,0x45,0xf1, 0xac,0xfa,0x58,0xab, 0x4b,0xe3,0x03,0x93, 
+       0x20,0x30,0xfa,0x55, 0xad,0x76,0x6d,0xf6, 0x88,0xcc,0x76,0x91, 0xf5,0x02,0x4c,0x25, 
+       0x4f,0xe5,0xd7,0xfc, 0xc5,0x2a,0xcb,0xd7, 0x26,0x35,0x44,0x80, 0xb5,0x62,0xa3,0x8f, 
+       0xde,0xb1,0x5a,0x49, 0x25,0xba,0x1b,0x67, 0x45,0xea,0x0e,0x98, 0x5d,0xfe,0xc0,0xe1, 
+       0xc3,0x2f,0x75,0x02, 0x81,0x4c,0xf0,0x12, 0x8d,0x46,0x97,0xa3, 0x6b,0xd3,0xf9,0xc6, 
+       0x03,0x8f,0x5f,0xe7, 0x15,0x92,0x9c,0x95, 0xbf,0x6d,0x7a,0xeb, 0x95,0x52,0x59,0xda, 
+       0xd4,0xbe,0x83,0x2d, 0x58,0x74,0x21,0xd3, 0x49,0xe0,0x69,0x29, 0x8e,0xc9,0xc8,0x44, 
+       0x75,0xc2,0x89,0x6a, 0xf4,0x8e,0x79,0x78, 0x99,0x58,0x3e,0x6b, 0x27,0xb9,0x71,0xdd, 
+       0xbe,0xe1,0x4f,0xb6, 0xf0,0x88,0xad,0x17, 0xc9,0x20,0xac,0x66, 0x7d,0xce,0x3a,0xb4, 
+       0x63,0xdf,0x4a,0x18, 0xe5,0x1a,0x31,0x82, 0x97,0x51,0x33,0x60, 0x62,0x53,0x7f,0x45, 
+       0xb1,0x64,0x77,0xe0, 0xbb,0x6b,0xae,0x84, 0xfe,0x81,0xa0,0x1c, 0xf9,0x08,0x2b,0x94, 
+       0x70,0x48,0x68,0x58, 0x8f,0x45,0xfd,0x19, 0x94,0xde,0x6c,0x87, 0x52,0x7b,0xf8,0xb7, 
+       0xab,0x73,0xd3,0x23, 0x72,0x4b,0x02,0xe2, 0xe3,0x1f,0x8f,0x57, 0x66,0x55,0xab,0x2a, 
+       0xb2,0xeb,0x28,0x07, 0x2f,0xb5,0xc2,0x03, 0x86,0xc5,0x7b,0x9a, 0xd3,0x37,0x08,0xa5, 
+       0x30,0x28,0x87,0xf2, 0x23,0xbf,0xa5,0xb2, 0x02,0x03,0x6a,0xba, 0xed,0x16,0x82,0x5c, 
+       0x8a,0xcf,0x1c,0x2b, 0xa7,0x79,0xb4,0x92, 0xf3,0x07,0xf2,0xf0, 0x4e,0x69,0xe2,0xa1, 
+       0x65,0xda,0xf4,0xcd, 0x06,0x05,0xbe,0xd5, 0xd1,0x34,0x62,0x1f, 0xc4,0xa6,0xfe,0x8a, 
+       0x34,0x2e,0x53,0x9d, 0xa2,0xf3,0x55,0xa0, 0x05,0x8a,0xe1,0x32, 0xa4,0xf6,0xeb,0x75, 
+       0x0b,0x83,0xec,0x39, 0x40,0x60,0xef,0xaa, 0x5e,0x71,0x9f,0x06, 0xbd,0x6e,0x10,0x51, 
+       0x3e,0x21,0x8a,0xf9, 0x96,0xdd,0x06,0x3d, 0xdd,0x3e,0x05,0xae, 0x4d,0xe6,0xbd,0x46, 
+       0x91,0x54,0x8d,0xb5, 0x71,0xc4,0x5d,0x05, 0x04,0x06,0xd4,0x6f, 0x60,0x50,0x15,0xff, 
+       0x19,0x98,0xfb,0x24, 0xd6,0xbd,0xe9,0x97, 0x89,0x40,0x43,0xcc, 0x67,0xd9,0x9e,0x77, 
+       0xb0,0xe8,0x42,0xbd, 0x07,0x89,0x8b,0x88, 0xe7,0x19,0x5b,0x38, 0x79,0xc8,0xee,0xdb, 
+       0xa1,0x7c,0x0a,0x47, 0x7c,0x42,0x0f,0xe9, 0xf8,0x84,0x1e,0xc9, 0x00,0x00,0x00,0x00, 
+       0x09,0x80,0x86,0x83, 0x32,0x2b,0xed,0x48, 0x1e,0x11,0x70,0xac, 0x6c,0x5a,0x72,0x4e, 
+       0xfd,0x0e,0xff,0xfb, 0x0f,0x85,0x38,0x56, 0x3d,0xae,0xd5,0x1e, 0x36,0x2d,0x39,0x27, 
+       0x0a,0x0f,0xd9,0x64, 0x68,0x5c,0xa6,0x21, 0x9b,0x5b,0x54,0xd1, 0x24,0x36,0x2e,0x3a, 
+       0x0c,0x0a,0x67,0xb1, 0x93,0x57,0xe7,0x0f, 0xb4,0xee,0x96,0xd2, 0x1b,0x9b,0x91,0x9e, 
+       0x80,0xc0,0xc5,0x4f, 0x61,0xdc,0x20,0xa2, 0x5a,0x77,0x4b,0x69, 0x1c,0x12,0x1a,0x16, 
+       0xe2,0x93,0xba,0x0a, 0xc0,0xa0,0x2a,0xe5, 0x3c,0x22,0xe0,0x43, 0x12,0x1b,0x17,0x1d, 
+       0x0e,0x09,0x0d,0x0b, 0xf2,0x8b,0xc7,0xad, 0x2d,0xb6,0xa8,0xb9, 0x14,0x1e,0xa9,0xc8, 
+       0x57,0xf1,0x19,0x85, 0xaf,0x75,0x07,0x4c, 0xee,0x99,0xdd,0xbb, 0xa3,0x7f,0x60,0xfd, 
+       0xf7,0x01,0x26,0x9f, 0x5c,0x72,0xf5,0xbc, 0x44,0x66,0x3b,0xc5, 0x5b,0xfb,0x7e,0x34, 
+       0x8b,0x43,0x29,0x76, 0xcb,0x23,0xc6,0xdc, 0xb6,0xed,0xfc,0x68, 0xb8,0xe4,0xf1,0x63, 
+       0xd7,0x31,0xdc,0xca, 0x42,0x63,0x85,0x10, 0x13,0x97,0x22,0x40, 0x84,0xc6,0x11,0x20, 
+       0x85,0x4a,0x24,0x7d, 0xd2,0xbb,0x3d,0xf8, 0xae,0xf9,0x32,0x11, 0xc7,0x29,0xa1,0x6d, 
+       0x1d,0x9e,0x2f,0x4b, 0xdc,0xb2,0x30,0xf3, 0x0d,0x86,0x52,0xec, 0x77,0xc1,0xe3,0xd0, 
+       0x2b,0xb3,0x16,0x6c, 0xa9,0x70,0xb9,0x99, 0x11,0x94,0x48,0xfa, 0x47,0xe9,0x64,0x22, 
+       0xa8,0xfc,0x8c,0xc4, 0xa0,0xf0,0x3f,0x1a, 0x56,0x7d,0x2c,0xd8, 0x22,0x33,0x90,0xef, 
+       0x87,0x49,0x4e,0xc7, 0xd9,0x38,0xd1,0xc1, 0x8c,0xca,0xa2,0xfe, 0x98,0xd4,0x0b,0x36, 
+       0xa6,0xf5,0x81,0xcf, 0xa5,0x7a,0xde,0x28, 0xda,0xb7,0x8e,0x26, 0x3f,0xad,0xbf,0xa4, 
+       0x2c,0x3a,0x9d,0xe4, 0x50,0x78,0x92,0x0d, 0x6a,0x5f,0xcc,0x9b, 0x54,0x7e,0x46,0x62, 
+       0xf6,0x8d,0x13,0xc2, 0x90,0xd8,0xb8,0xe8, 0x2e,0x39,0xf7,0x5e, 0x82,0xc3,0xaf,0xf5, 
+       0x9f,0x5d,0x80,0xbe, 0x69,0xd0,0x93,0x7c, 0x6f,0xd5,0x2d,0xa9, 0xcf,0x25,0x12,0xb3, 
+       0xc8,0xac,0x99,0x3b, 0x10,0x18,0x7d,0xa7, 0xe8,0x9c,0x63,0x6e, 0xdb,0x3b,0xbb,0x7b, 
+       0xcd,0x26,0x78,0x09, 0x6e,0x59,0x18,0xf4, 0xec,0x9a,0xb7,0x01, 0x83,0x4f,0x9a,0xa8, 
+       0xe6,0x95,0x6e,0x65, 0xaa,0xff,0xe6,0x7e, 0x21,0xbc,0xcf,0x08, 0xef,0x15,0xe8,0xe6, 
+       0xba,0xe7,0x9b,0xd9, 0x4a,0x6f,0x36,0xce, 0xea,0x9f,0x09,0xd4, 0x29,0xb0,0x7c,0xd6, 
+       0x31,0xa4,0xb2,0xaf, 0x2a,0x3f,0x23,0x31, 0xc6,0xa5,0x94,0x30, 0x35,0xa2,0x66,0xc0, 
+       0x74,0x4e,0xbc,0x37, 0xfc,0x82,0xca,0xa6, 0xe0,0x90,0xd0,0xb0, 0x33,0xa7,0xd8,0x15, 
+       0xf1,0x04,0x98,0x4a, 0x41,0xec,0xda,0xf7, 0x7f,0xcd,0x50,0x0e, 0x17,0x91,0xf6,0x2f, 
+       0x76,0x4d,0xd6,0x8d, 0x43,0xef,0xb0,0x4d, 0xcc,0xaa,0x4d,0x54, 0xe4,0x96,0x04,0xdf, 
+       0x9e,0xd1,0xb5,0xe3, 0x4c,0x6a,0x88,0x1b, 0xc1,0x2c,0x1f,0xb8, 0x46,0x65,0x51,0x7f, 
+       0x9d,0x5e,0xea,0x04, 0x01,0x8c,0x35,0x5d, 0xfa,0x87,0x74,0x73, 0xfb,0x0b,0x41,0x2e, 
+       0xb3,0x67,0x1d,0x5a, 0x92,0xdb,0xd2,0x52, 0xe9,0x10,0x56,0x33, 0x6d,0xd6,0x47,0x13, 
+       0x9a,0xd7,0x61,0x8c, 0x37,0xa1,0x0c,0x7a, 0x59,0xf8,0x14,0x8e, 0xeb,0x13,0x3c,0x89, 
+       0xce,0xa9,0x27,0xee, 0xb7,0x61,0xc9,0x35, 0xe1,0x1c,0xe5,0xed, 0x7a,0x47,0xb1,0x3c, 
+       0x9c,0xd2,0xdf,0x59, 0x55,0xf2,0x73,0x3f, 0x18,0x14,0xce,0x79, 0x73,0xc7,0x37,0xbf, 
+       0x53,0xf7,0xcd,0xea, 0x5f,0xfd,0xaa,0x5b, 0xdf,0x3d,0x6f,0x14, 0x78,0x44,0xdb,0x86, 
+       0xca,0xaf,0xf3,0x81, 0xb9,0x68,0xc4,0x3e, 0x38,0x24,0x34,0x2c, 0xc2,0xa3,0x40,0x5f, 
+       0x16,0x1d,0xc3,0x72, 0xbc,0xe2,0x25,0x0c, 0x28,0x3c,0x49,0x8b, 0xff,0x0d,0x95,0x41, 
+       0x39,0xa8,0x01,0x71, 0x08,0x0c,0xb3,0xde, 0xd8,0xb4,0xe4,0x9c, 0x64,0x56,0xc1,0x90, 
+       0x7b,0xcb,0x84,0x61, 0xd5,0x32,0xb6,0x70, 0x48,0x6c,0x5c,0x74, 0xd0,0xb8,0x57,0x42
+};
+
+static uint8_t T6[256][4]=
+{
+       0x50,0x51,0xf4,0xa7, 0x53,0x7e,0x41,0x65, 0xc3,0x1a,0x17,0xa4, 0x96,0x3a,0x27,0x5e, 
+       0xcb,0x3b,0xab,0x6b, 0xf1,0x1f,0x9d,0x45, 0xab,0xac,0xfa,0x58, 0x93,0x4b,0xe3,0x03, 
+       0x55,0x20,0x30,0xfa, 0xf6,0xad,0x76,0x6d, 0x91,0x88,0xcc,0x76, 0x25,0xf5,0x02,0x4c, 
+       0xfc,0x4f,0xe5,0xd7, 0xd7,0xc5,0x2a,0xcb, 0x80,0x26,0x35,0x44, 0x8f,0xb5,0x62,0xa3, 
+       0x49,0xde,0xb1,0x5a, 0x67,0x25,0xba,0x1b, 0x98,0x45,0xea,0x0e, 0xe1,0x5d,0xfe,0xc0, 
+       0x02,0xc3,0x2f,0x75, 0x12,0x81,0x4c,0xf0, 0xa3,0x8d,0x46,0x97, 0xc6,0x6b,0xd3,0xf9, 
+       0xe7,0x03,0x8f,0x5f, 0x95,0x15,0x92,0x9c, 0xeb,0xbf,0x6d,0x7a, 0xda,0x95,0x52,0x59, 
+       0x2d,0xd4,0xbe,0x83, 0xd3,0x58,0x74,0x21, 0x29,0x49,0xe0,0x69, 0x44,0x8e,0xc9,0xc8, 
+       0x6a,0x75,0xc2,0x89, 0x78,0xf4,0x8e,0x79, 0x6b,0x99,0x58,0x3e, 0xdd,0x27,0xb9,0x71, 
+       0xb6,0xbe,0xe1,0x4f, 0x17,0xf0,0x88,0xad, 0x66,0xc9,0x20,0xac, 0xb4,0x7d,0xce,0x3a, 
+       0x18,0x63,0xdf,0x4a, 0x82,0xe5,0x1a,0x31, 0x60,0x97,0x51,0x33, 0x45,0x62,0x53,0x7f, 
+       0xe0,0xb1,0x64,0x77, 0x84,0xbb,0x6b,0xae, 0x1c,0xfe,0x81,0xa0, 0x94,0xf9,0x08,0x2b, 
+       0x58,0x70,0x48,0x68, 0x19,0x8f,0x45,0xfd, 0x87,0x94,0xde,0x6c, 0xb7,0x52,0x7b,0xf8, 
+       0x23,0xab,0x73,0xd3, 0xe2,0x72,0x4b,0x02, 0x57,0xe3,0x1f,0x8f, 0x2a,0x66,0x55,0xab, 
+       0x07,0xb2,0xeb,0x28, 0x03,0x2f,0xb5,0xc2, 0x9a,0x86,0xc5,0x7b, 0xa5,0xd3,0x37,0x08, 
+       0xf2,0x30,0x28,0x87, 0xb2,0x23,0xbf,0xa5, 0xba,0x02,0x03,0x6a, 0x5c,0xed,0x16,0x82, 
+       0x2b,0x8a,0xcf,0x1c, 0x92,0xa7,0x79,0xb4, 0xf0,0xf3,0x07,0xf2, 0xa1,0x4e,0x69,0xe2, 
+       0xcd,0x65,0xda,0xf4, 0xd5,0x06,0x05,0xbe, 0x1f,0xd1,0x34,0x62, 0x8a,0xc4,0xa6,0xfe, 
+       0x9d,0x34,0x2e,0x53, 0xa0,0xa2,0xf3,0x55, 0x32,0x05,0x8a,0xe1, 0x75,0xa4,0xf6,0xeb, 
+       0x39,0x0b,0x83,0xec, 0xaa,0x40,0x60,0xef, 0x06,0x5e,0x71,0x9f, 0x51,0xbd,0x6e,0x10, 
+       0xf9,0x3e,0x21,0x8a, 0x3d,0x96,0xdd,0x06, 0xae,0xdd,0x3e,0x05, 0x46,0x4d,0xe6,0xbd, 
+       0xb5,0x91,0x54,0x8d, 0x05,0x71,0xc4,0x5d, 0x6f,0x04,0x06,0xd4, 0xff,0x60,0x50,0x15, 
+       0x24,0x19,0x98,0xfb, 0x97,0xd6,0xbd,0xe9, 0xcc,0x89,0x40,0x43, 0x77,0x67,0xd9,0x9e, 
+       0xbd,0xb0,0xe8,0x42, 0x88,0x07,0x89,0x8b, 0x38,0xe7,0x19,0x5b, 0xdb,0x79,0xc8,0xee, 
+       0x47,0xa1,0x7c,0x0a, 0xe9,0x7c,0x42,0x0f, 0xc9,0xf8,0x84,0x1e, 0x00,0x00,0x00,0x00, 
+       0x83,0x09,0x80,0x86, 0x48,0x32,0x2b,0xed, 0xac,0x1e,0x11,0x70, 0x4e,0x6c,0x5a,0x72, 
+       0xfb,0xfd,0x0e,0xff, 0x56,0x0f,0x85,0x38, 0x1e,0x3d,0xae,0xd5, 0x27,0x36,0x2d,0x39, 
+       0x64,0x0a,0x0f,0xd9, 0x21,0x68,0x5c,0xa6, 0xd1,0x9b,0x5b,0x54, 0x3a,0x24,0x36,0x2e, 
+       0xb1,0x0c,0x0a,0x67, 0x0f,0x93,0x57,0xe7, 0xd2,0xb4,0xee,0x96, 0x9e,0x1b,0x9b,0x91, 
+       0x4f,0x80,0xc0,0xc5, 0xa2,0x61,0xdc,0x20, 0x69,0x5a,0x77,0x4b, 0x16,0x1c,0x12,0x1a, 
+       0x0a,0xe2,0x93,0xba, 0xe5,0xc0,0xa0,0x2a, 0x43,0x3c,0x22,0xe0, 0x1d,0x12,0x1b,0x17, 
+       0x0b,0x0e,0x09,0x0d, 0xad,0xf2,0x8b,0xc7, 0xb9,0x2d,0xb6,0xa8, 0xc8,0x14,0x1e,0xa9, 
+       0x85,0x57,0xf1,0x19, 0x4c,0xaf,0x75,0x07, 0xbb,0xee,0x99,0xdd, 0xfd,0xa3,0x7f,0x60, 
+       0x9f,0xf7,0x01,0x26, 0xbc,0x5c,0x72,0xf5, 0xc5,0x44,0x66,0x3b, 0x34,0x5b,0xfb,0x7e, 
+       0x76,0x8b,0x43,0x29, 0xdc,0xcb,0x23,0xc6, 0x68,0xb6,0xed,0xfc, 0x63,0xb8,0xe4,0xf1, 
+       0xca,0xd7,0x31,0xdc, 0x10,0x42,0x63,0x85, 0x40,0x13,0x97,0x22, 0x20,0x84,0xc6,0x11, 
+       0x7d,0x85,0x4a,0x24, 0xf8,0xd2,0xbb,0x3d, 0x11,0xae,0xf9,0x32, 0x6d,0xc7,0x29,0xa1, 
+       0x4b,0x1d,0x9e,0x2f, 0xf3,0xdc,0xb2,0x30, 0xec,0x0d,0x86,0x52, 0xd0,0x77,0xc1,0xe3, 
+       0x6c,0x2b,0xb3,0x16, 0x99,0xa9,0x70,0xb9, 0xfa,0x11,0x94,0x48, 0x22,0x47,0xe9,0x64, 
+       0xc4,0xa8,0xfc,0x8c, 0x1a,0xa0,0xf0,0x3f, 0xd8,0x56,0x7d,0x2c, 0xef,0x22,0x33,0x90, 
+       0xc7,0x87,0x49,0x4e, 0xc1,0xd9,0x38,0xd1, 0xfe,0x8c,0xca,0xa2, 0x36,0x98,0xd4,0x0b, 
+       0xcf,0xa6,0xf5,0x81, 0x28,0xa5,0x7a,0xde, 0x26,0xda,0xb7,0x8e, 0xa4,0x3f,0xad,0xbf, 
+       0xe4,0x2c,0x3a,0x9d, 0x0d,0x50,0x78,0x92, 0x9b,0x6a,0x5f,0xcc, 0x62,0x54,0x7e,0x46, 
+       0xc2,0xf6,0x8d,0x13, 0xe8,0x90,0xd8,0xb8, 0x5e,0x2e,0x39,0xf7, 0xf5,0x82,0xc3,0xaf, 
+       0xbe,0x9f,0x5d,0x80, 0x7c,0x69,0xd0,0x93, 0xa9,0x6f,0xd5,0x2d, 0xb3,0xcf,0x25,0x12, 
+       0x3b,0xc8,0xac,0x99, 0xa7,0x10,0x18,0x7d, 0x6e,0xe8,0x9c,0x63, 0x7b,0xdb,0x3b,0xbb, 
+       0x09,0xcd,0x26,0x78, 0xf4,0x6e,0x59,0x18, 0x01,0xec,0x9a,0xb7, 0xa8,0x83,0x4f,0x9a, 
+       0x65,0xe6,0x95,0x6e, 0x7e,0xaa,0xff,0xe6, 0x08,0x21,0xbc,0xcf, 0xe6,0xef,0x15,0xe8, 
+       0xd9,0xba,0xe7,0x9b, 0xce,0x4a,0x6f,0x36, 0xd4,0xea,0x9f,0x09, 0xd6,0x29,0xb0,0x7c, 
+       0xaf,0x31,0xa4,0xb2, 0x31,0x2a,0x3f,0x23, 0x30,0xc6,0xa5,0x94, 0xc0,0x35,0xa2,0x66, 
+       0x37,0x74,0x4e,0xbc, 0xa6,0xfc,0x82,0xca, 0xb0,0xe0,0x90,0xd0, 0x15,0x33,0xa7,0xd8, 
+       0x4a,0xf1,0x04,0x98, 0xf7,0x41,0xec,0xda, 0x0e,0x7f,0xcd,0x50, 0x2f,0x17,0x91,0xf6, 
+       0x8d,0x76,0x4d,0xd6, 0x4d,0x43,0xef,0xb0, 0x54,0xcc,0xaa,0x4d, 0xdf,0xe4,0x96,0x04, 
+       0xe3,0x9e,0xd1,0xb5, 0x1b,0x4c,0x6a,0x88, 0xb8,0xc1,0x2c,0x1f, 0x7f,0x46,0x65,0x51, 
+       0x04,0x9d,0x5e,0xea, 0x5d,0x01,0x8c,0x35, 0x73,0xfa,0x87,0x74, 0x2e,0xfb,0x0b,0x41, 
+       0x5a,0xb3,0x67,0x1d, 0x52,0x92,0xdb,0xd2, 0x33,0xe9,0x10,0x56, 0x13,0x6d,0xd6,0x47, 
+       0x8c,0x9a,0xd7,0x61, 0x7a,0x37,0xa1,0x0c, 0x8e,0x59,0xf8,0x14, 0x89,0xeb,0x13,0x3c, 
+       0xee,0xce,0xa9,0x27, 0x35,0xb7,0x61,0xc9, 0xed,0xe1,0x1c,0xe5, 0x3c,0x7a,0x47,0xb1, 
+       0x59,0x9c,0xd2,0xdf, 0x3f,0x55,0xf2,0x73, 0x79,0x18,0x14,0xce, 0xbf,0x73,0xc7,0x37, 
+       0xea,0x53,0xf7,0xcd, 0x5b,0x5f,0xfd,0xaa, 0x14,0xdf,0x3d,0x6f, 0x86,0x78,0x44,0xdb, 
+       0x81,0xca,0xaf,0xf3, 0x3e,0xb9,0x68,0xc4, 0x2c,0x38,0x24,0x34, 0x5f,0xc2,0xa3,0x40, 
+       0x72,0x16,0x1d,0xc3, 0x0c,0xbc,0xe2,0x25, 0x8b,0x28,0x3c,0x49, 0x41,0xff,0x0d,0x95, 
+       0x71,0x39,0xa8,0x01, 0xde,0x08,0x0c,0xb3, 0x9c,0xd8,0xb4,0xe4, 0x90,0x64,0x56,0xc1, 
+       0x61,0x7b,0xcb,0x84, 0x70,0xd5,0x32,0xb6, 0x74,0x48,0x6c,0x5c, 0x42,0xd0,0xb8,0x57
+};
+
+static uint8_t T7[256][4]=
+{
+       0xa7,0x50,0x51,0xf4, 0x65,0x53,0x7e,0x41, 0xa4,0xc3,0x1a,0x17, 0x5e,0x96,0x3a,0x27, 
+       0x6b,0xcb,0x3b,0xab, 0x45,0xf1,0x1f,0x9d, 0x58,0xab,0xac,0xfa, 0x03,0x93,0x4b,0xe3, 
+       0xfa,0x55,0x20,0x30, 0x6d,0xf6,0xad,0x76, 0x76,0x91,0x88,0xcc, 0x4c,0x25,0xf5,0x02, 
+       0xd7,0xfc,0x4f,0xe5, 0xcb,0xd7,0xc5,0x2a, 0x44,0x80,0x26,0x35, 0xa3,0x8f,0xb5,0x62, 
+       0x5a,0x49,0xde,0xb1, 0x1b,0x67,0x25,0xba, 0x0e,0x98,0x45,0xea, 0xc0,0xe1,0x5d,0xfe, 
+       0x75,0x02,0xc3,0x2f, 0xf0,0x12,0x81,0x4c, 0x97,0xa3,0x8d,0x46, 0xf9,0xc6,0x6b,0xd3, 
+       0x5f,0xe7,0x03,0x8f, 0x9c,0x95,0x15,0x92, 0x7a,0xeb,0xbf,0x6d, 0x59,0xda,0x95,0x52, 
+       0x83,0x2d,0xd4,0xbe, 0x21,0xd3,0x58,0x74, 0x69,0x29,0x49,0xe0, 0xc8,0x44,0x8e,0xc9, 
+       0x89,0x6a,0x75,0xc2, 0x79,0x78,0xf4,0x8e, 0x3e,0x6b,0x99,0x58, 0x71,0xdd,0x27,0xb9, 
+       0x4f,0xb6,0xbe,0xe1, 0xad,0x17,0xf0,0x88, 0xac,0x66,0xc9,0x20, 0x3a,0xb4,0x7d,0xce, 
+       0x4a,0x18,0x63,0xdf, 0x31,0x82,0xe5,0x1a, 0x33,0x60,0x97,0x51, 0x7f,0x45,0x62,0x53, 
+       0x77,0xe0,0xb1,0x64, 0xae,0x84,0xbb,0x6b, 0xa0,0x1c,0xfe,0x81, 0x2b,0x94,0xf9,0x08, 
+       0x68,0x58,0x70,0x48, 0xfd,0x19,0x8f,0x45, 0x6c,0x87,0x94,0xde, 0xf8,0xb7,0x52,0x7b, 
+       0xd3,0x23,0xab,0x73, 0x02,0xe2,0x72,0x4b, 0x8f,0x57,0xe3,0x1f, 0xab,0x2a,0x66,0x55, 
+       0x28,0x07,0xb2,0xeb, 0xc2,0x03,0x2f,0xb5, 0x7b,0x9a,0x86,0xc5, 0x08,0xa5,0xd3,0x37, 
+       0x87,0xf2,0x30,0x28, 0xa5,0xb2,0x23,0xbf, 0x6a,0xba,0x02,0x03, 0x82,0x5c,0xed,0x16, 
+       0x1c,0x2b,0x8a,0xcf, 0xb4,0x92,0xa7,0x79, 0xf2,0xf0,0xf3,0x07, 0xe2,0xa1,0x4e,0x69, 
+       0xf4,0xcd,0x65,0xda, 0xbe,0xd5,0x06,0x05, 0x62,0x1f,0xd1,0x34, 0xfe,0x8a,0xc4,0xa6, 
+       0x53,0x9d,0x34,0x2e, 0x55,0xa0,0xa2,0xf3, 0xe1,0x32,0x05,0x8a, 0xeb,0x75,0xa4,0xf6, 
+       0xec,0x39,0x0b,0x83, 0xef,0xaa,0x40,0x60, 0x9f,0x06,0x5e,0x71, 0x10,0x51,0xbd,0x6e, 
+       0x8a,0xf9,0x3e,0x21, 0x06,0x3d,0x96,0xdd, 0x05,0xae,0xdd,0x3e, 0xbd,0x46,0x4d,0xe6, 
+       0x8d,0xb5,0x91,0x54, 0x5d,0x05,0x71,0xc4, 0xd4,0x6f,0x04,0x06, 0x15,0xff,0x60,0x50, 
+       0xfb,0x24,0x19,0x98, 0xe9,0x97,0xd6,0xbd, 0x43,0xcc,0x89,0x40, 0x9e,0x77,0x67,0xd9, 
+       0x42,0xbd,0xb0,0xe8, 0x8b,0x88,0x07,0x89, 0x5b,0x38,0xe7,0x19, 0xee,0xdb,0x79,0xc8, 
+       0x0a,0x47,0xa1,0x7c, 0x0f,0xe9,0x7c,0x42, 0x1e,0xc9,0xf8,0x84, 0x00,0x00,0x00,0x00, 
+       0x86,0x83,0x09,0x80, 0xed,0x48,0x32,0x2b, 0x70,0xac,0x1e,0x11, 0x72,0x4e,0x6c,0x5a, 
+       0xff,0xfb,0xfd,0x0e, 0x38,0x56,0x0f,0x85, 0xd5,0x1e,0x3d,0xae, 0x39,0x27,0x36,0x2d, 
+       0xd9,0x64,0x0a,0x0f, 0xa6,0x21,0x68,0x5c, 0x54,0xd1,0x9b,0x5b, 0x2e,0x3a,0x24,0x36, 
+       0x67,0xb1,0x0c,0x0a, 0xe7,0x0f,0x93,0x57, 0x96,0xd2,0xb4,0xee, 0x91,0x9e,0x1b,0x9b, 
+       0xc5,0x4f,0x80,0xc0, 0x20,0xa2,0x61,0xdc, 0x4b,0x69,0x5a,0x77, 0x1a,0x16,0x1c,0x12, 
+       0xba,0x0a,0xe2,0x93, 0x2a,0xe5,0xc0,0xa0, 0xe0,0x43,0x3c,0x22, 0x17,0x1d,0x12,0x1b, 
+       0x0d,0x0b,0x0e,0x09, 0xc7,0xad,0xf2,0x8b, 0xa8,0xb9,0x2d,0xb6, 0xa9,0xc8,0x14,0x1e, 
+       0x19,0x85,0x57,0xf1, 0x07,0x4c,0xaf,0x75, 0xdd,0xbb,0xee,0x99, 0x60,0xfd,0xa3,0x7f, 
+       0x26,0x9f,0xf7,0x01, 0xf5,0xbc,0x5c,0x72, 0x3b,0xc5,0x44,0x66, 0x7e,0x34,0x5b,0xfb, 
+       0x29,0x76,0x8b,0x43, 0xc6,0xdc,0xcb,0x23, 0xfc,0x68,0xb6,0xed, 0xf1,0x63,0xb8,0xe4, 
+       0xdc,0xca,0xd7,0x31, 0x85,0x10,0x42,0x63, 0x22,0x40,0x13,0x97, 0x11,0x20,0x84,0xc6, 
+       0x24,0x7d,0x85,0x4a, 0x3d,0xf8,0xd2,0xbb, 0x32,0x11,0xae,0xf9, 0xa1,0x6d,0xc7,0x29, 
+       0x2f,0x4b,0x1d,0x9e, 0x30,0xf3,0xdc,0xb2, 0x52,0xec,0x0d,0x86, 0xe3,0xd0,0x77,0xc1, 
+       0x16,0x6c,0x2b,0xb3, 0xb9,0x99,0xa9,0x70, 0x48,0xfa,0x11,0x94, 0x64,0x22,0x47,0xe9, 
+       0x8c,0xc4,0xa8,0xfc, 0x3f,0x1a,0xa0,0xf0, 0x2c,0xd8,0x56,0x7d, 0x90,0xef,0x22,0x33, 
+       0x4e,0xc7,0x87,0x49, 0xd1,0xc1,0xd9,0x38, 0xa2,0xfe,0x8c,0xca, 0x0b,0x36,0x98,0xd4, 
+       0x81,0xcf,0xa6,0xf5, 0xde,0x28,0xa5,0x7a, 0x8e,0x26,0xda,0xb7, 0xbf,0xa4,0x3f,0xad, 
+       0x9d,0xe4,0x2c,0x3a, 0x92,0x0d,0x50,0x78, 0xcc,0x9b,0x6a,0x5f, 0x46,0x62,0x54,0x7e, 
+       0x13,0xc2,0xf6,0x8d, 0xb8,0xe8,0x90,0xd8, 0xf7,0x5e,0x2e,0x39, 0xaf,0xf5,0x82,0xc3, 
+       0x80,0xbe,0x9f,0x5d, 0x93,0x7c,0x69,0xd0, 0x2d,0xa9,0x6f,0xd5, 0x12,0xb3,0xcf,0x25, 
+       0x99,0x3b,0xc8,0xac, 0x7d,0xa7,0x10,0x18, 0x63,0x6e,0xe8,0x9c, 0xbb,0x7b,0xdb,0x3b, 
+       0x78,0x09,0xcd,0x26, 0x18,0xf4,0x6e,0x59, 0xb7,0x01,0xec,0x9a, 0x9a,0xa8,0x83,0x4f, 
+       0x6e,0x65,0xe6,0x95, 0xe6,0x7e,0xaa,0xff, 0xcf,0x08,0x21,0xbc, 0xe8,0xe6,0xef,0x15, 
+       0x9b,0xd9,0xba,0xe7, 0x36,0xce,0x4a,0x6f, 0x09,0xd4,0xea,0x9f, 0x7c,0xd6,0x29,0xb0, 
+       0xb2,0xaf,0x31,0xa4, 0x23,0x31,0x2a,0x3f, 0x94,0x30,0xc6,0xa5, 0x66,0xc0,0x35,0xa2, 
+       0xbc,0x37,0x74,0x4e, 0xca,0xa6,0xfc,0x82, 0xd0,0xb0,0xe0,0x90, 0xd8,0x15,0x33,0xa7, 
+       0x98,0x4a,0xf1,0x04, 0xda,0xf7,0x41,0xec, 0x50,0x0e,0x7f,0xcd, 0xf6,0x2f,0x17,0x91, 
+       0xd6,0x8d,0x76,0x4d, 0xb0,0x4d,0x43,0xef, 0x4d,0x54,0xcc,0xaa, 0x04,0xdf,0xe4,0x96, 
+       0xb5,0xe3,0x9e,0xd1, 0x88,0x1b,0x4c,0x6a, 0x1f,0xb8,0xc1,0x2c, 0x51,0x7f,0x46,0x65, 
+       0xea,0x04,0x9d,0x5e, 0x35,0x5d,0x01,0x8c, 0x74,0x73,0xfa,0x87, 0x41,0x2e,0xfb,0x0b, 
+       0x1d,0x5a,0xb3,0x67, 0xd2,0x52,0x92,0xdb, 0x56,0x33,0xe9,0x10, 0x47,0x13,0x6d,0xd6, 
+       0x61,0x8c,0x9a,0xd7, 0x0c,0x7a,0x37,0xa1, 0x14,0x8e,0x59,0xf8, 0x3c,0x89,0xeb,0x13, 
+       0x27,0xee,0xce,0xa9, 0xc9,0x35,0xb7,0x61, 0xe5,0xed,0xe1,0x1c, 0xb1,0x3c,0x7a,0x47, 
+       0xdf,0x59,0x9c,0xd2, 0x73,0x3f,0x55,0xf2, 0xce,0x79,0x18,0x14, 0x37,0xbf,0x73,0xc7, 
+       0xcd,0xea,0x53,0xf7, 0xaa,0x5b,0x5f,0xfd, 0x6f,0x14,0xdf,0x3d, 0xdb,0x86,0x78,0x44, 
+       0xf3,0x81,0xca,0xaf, 0xc4,0x3e,0xb9,0x68, 0x34,0x2c,0x38,0x24, 0x40,0x5f,0xc2,0xa3, 
+       0xc3,0x72,0x16,0x1d, 0x25,0x0c,0xbc,0xe2, 0x49,0x8b,0x28,0x3c, 0x95,0x41,0xff,0x0d, 
+       0x01,0x71,0x39,0xa8, 0xb3,0xde,0x08,0x0c, 0xe4,0x9c,0xd8,0xb4, 0xc1,0x90,0x64,0x56, 
+       0x84,0x61,0x7b,0xcb, 0xb6,0x70,0xd5,0x32, 0x5c,0x74,0x48,0x6c, 0x57,0x42,0xd0,0xb8
+};
+
+static uint8_t T8[256][4]=
+{
+       0xf4,0xa7,0x50,0x51, 0x41,0x65,0x53,0x7e, 0x17,0xa4,0xc3,0x1a, 0x27,0x5e,0x96,0x3a, 
+       0xab,0x6b,0xcb,0x3b, 0x9d,0x45,0xf1,0x1f, 0xfa,0x58,0xab,0xac, 0xe3,0x03,0x93,0x4b, 
+       0x30,0xfa,0x55,0x20, 0x76,0x6d,0xf6,0xad, 0xcc,0x76,0x91,0x88, 0x02,0x4c,0x25,0xf5, 
+       0xe5,0xd7,0xfc,0x4f, 0x2a,0xcb,0xd7,0xc5, 0x35,0x44,0x80,0x26, 0x62,0xa3,0x8f,0xb5, 
+       0xb1,0x5a,0x49,0xde, 0xba,0x1b,0x67,0x25, 0xea,0x0e,0x98,0x45, 0xfe,0xc0,0xe1,0x5d, 
+       0x2f,0x75,0x02,0xc3, 0x4c,0xf0,0x12,0x81, 0x46,0x97,0xa3,0x8d, 0xd3,0xf9,0xc6,0x6b, 
+       0x8f,0x5f,0xe7,0x03, 0x92,0x9c,0x95,0x15, 0x6d,0x7a,0xeb,0xbf, 0x52,0x59,0xda,0x95, 
+       0xbe,0x83,0x2d,0xd4, 0x74,0x21,0xd3,0x58, 0xe0,0x69,0x29,0x49, 0xc9,0xc8,0x44,0x8e, 
+       0xc2,0x89,0x6a,0x75, 0x8e,0x79,0x78,0xf4, 0x58,0x3e,0x6b,0x99, 0xb9,0x71,0xdd,0x27, 
+       0xe1,0x4f,0xb6,0xbe, 0x88,0xad,0x17,0xf0, 0x20,0xac,0x66,0xc9, 0xce,0x3a,0xb4,0x7d, 
+       0xdf,0x4a,0x18,0x63, 0x1a,0x31,0x82,0xe5, 0x51,0x33,0x60,0x97, 0x53,0x7f,0x45,0x62, 
+       0x64,0x77,0xe0,0xb1, 0x6b,0xae,0x84,0xbb, 0x81,0xa0,0x1c,0xfe, 0x08,0x2b,0x94,0xf9, 
+       0x48,0x68,0x58,0x70, 0x45,0xfd,0x19,0x8f, 0xde,0x6c,0x87,0x94, 0x7b,0xf8,0xb7,0x52, 
+       0x73,0xd3,0x23,0xab, 0x4b,0x02,0xe2,0x72, 0x1f,0x8f,0x57,0xe3, 0x55,0xab,0x2a,0x66, 
+       0xeb,0x28,0x07,0xb2, 0xb5,0xc2,0x03,0x2f, 0xc5,0x7b,0x9a,0x86, 0x37,0x08,0xa5,0xd3, 
+       0x28,0x87,0xf2,0x30, 0xbf,0xa5,0xb2,0x23, 0x03,0x6a,0xba,0x02, 0x16,0x82,0x5c,0xed, 
+       0xcf,0x1c,0x2b,0x8a, 0x79,0xb4,0x92,0xa7, 0x07,0xf2,0xf0,0xf3, 0x69,0xe2,0xa1,0x4e, 
+       0xda,0xf4,0xcd,0x65, 0x05,0xbe,0xd5,0x06, 0x34,0x62,0x1f,0xd1, 0xa6,0xfe,0x8a,0xc4, 
+       0x2e,0x53,0x9d,0x34, 0xf3,0x55,0xa0,0xa2, 0x8a,0xe1,0x32,0x05, 0xf6,0xeb,0x75,0xa4, 
+       0x83,0xec,0x39,0x0b, 0x60,0xef,0xaa,0x40, 0x71,0x9f,0x06,0x5e, 0x6e,0x10,0x51,0xbd, 
+       0x21,0x8a,0xf9,0x3e, 0xdd,0x06,0x3d,0x96, 0x3e,0x05,0xae,0xdd, 0xe6,0xbd,0x46,0x4d, 
+       0x54,0x8d,0xb5,0x91, 0xc4,0x5d,0x05,0x71, 0x06,0xd4,0x6f,0x04, 0x50,0x15,0xff,0x60, 
+       0x98,0xfb,0x24,0x19, 0xbd,0xe9,0x97,0xd6, 0x40,0x43,0xcc,0x89, 0xd9,0x9e,0x77,0x67, 
+       0xe8,0x42,0xbd,0xb0, 0x89,0x8b,0x88,0x07, 0x19,0x5b,0x38,0xe7, 0xc8,0xee,0xdb,0x79, 
+       0x7c,0x0a,0x47,0xa1, 0x42,0x0f,0xe9,0x7c, 0x84,0x1e,0xc9,0xf8, 0x00,0x00,0x00,0x00, 
+       0x80,0x86,0x83,0x09, 0x2b,0xed,0x48,0x32, 0x11,0x70,0xac,0x1e, 0x5a,0x72,0x4e,0x6c, 
+       0x0e,0xff,0xfb,0xfd, 0x85,0x38,0x56,0x0f, 0xae,0xd5,0x1e,0x3d, 0x2d,0x39,0x27,0x36, 
+       0x0f,0xd9,0x64,0x0a, 0x5c,0xa6,0x21,0x68, 0x5b,0x54,0xd1,0x9b, 0x36,0x2e,0x3a,0x24, 
+       0x0a,0x67,0xb1,0x0c, 0x57,0xe7,0x0f,0x93, 0xee,0x96,0xd2,0xb4, 0x9b,0x91,0x9e,0x1b, 
+       0xc0,0xc5,0x4f,0x80, 0xdc,0x20,0xa2,0x61, 0x77,0x4b,0x69,0x5a, 0x12,0x1a,0x16,0x1c, 
+       0x93,0xba,0x0a,0xe2, 0xa0,0x2a,0xe5,0xc0, 0x22,0xe0,0x43,0x3c, 0x1b,0x17,0x1d,0x12, 
+       0x09,0x0d,0x0b,0x0e, 0x8b,0xc7,0xad,0xf2, 0xb6,0xa8,0xb9,0x2d, 0x1e,0xa9,0xc8,0x14, 
+       0xf1,0x19,0x85,0x57, 0x75,0x07,0x4c,0xaf, 0x99,0xdd,0xbb,0xee, 0x7f,0x60,0xfd,0xa3, 
+       0x01,0x26,0x9f,0xf7, 0x72,0xf5,0xbc,0x5c, 0x66,0x3b,0xc5,0x44, 0xfb,0x7e,0x34,0x5b, 
+       0x43,0x29,0x76,0x8b, 0x23,0xc6,0xdc,0xcb, 0xed,0xfc,0x68,0xb6, 0xe4,0xf1,0x63,0xb8, 
+       0x31,0xdc,0xca,0xd7, 0x63,0x85,0x10,0x42, 0x97,0x22,0x40,0x13, 0xc6,0x11,0x20,0x84, 
+       0x4a,0x24,0x7d,0x85, 0xbb,0x3d,0xf8,0xd2, 0xf9,0x32,0x11,0xae, 0x29,0xa1,0x6d,0xc7, 
+       0x9e,0x2f,0x4b,0x1d, 0xb2,0x30,0xf3,0xdc, 0x86,0x52,0xec,0x0d, 0xc1,0xe3,0xd0,0x77, 
+       0xb3,0x16,0x6c,0x2b, 0x70,0xb9,0x99,0xa9, 0x94,0x48,0xfa,0x11, 0xe9,0x64,0x22,0x47, 
+       0xfc,0x8c,0xc4,0xa8, 0xf0,0x3f,0x1a,0xa0, 0x7d,0x2c,0xd8,0x56, 0x33,0x90,0xef,0x22, 
+       0x49,0x4e,0xc7,0x87, 0x38,0xd1,0xc1,0xd9, 0xca,0xa2,0xfe,0x8c, 0xd4,0x0b,0x36,0x98, 
+       0xf5,0x81,0xcf,0xa6, 0x7a,0xde,0x28,0xa5, 0xb7,0x8e,0x26,0xda, 0xad,0xbf,0xa4,0x3f, 
+       0x3a,0x9d,0xe4,0x2c, 0x78,0x92,0x0d,0x50, 0x5f,0xcc,0x9b,0x6a, 0x7e,0x46,0x62,0x54, 
+       0x8d,0x13,0xc2,0xf6, 0xd8,0xb8,0xe8,0x90, 0x39,0xf7,0x5e,0x2e, 0xc3,0xaf,0xf5,0x82, 
+       0x5d,0x80,0xbe,0x9f, 0xd0,0x93,0x7c,0x69, 0xd5,0x2d,0xa9,0x6f, 0x25,0x12,0xb3,0xcf, 
+       0xac,0x99,0x3b,0xc8, 0x18,0x7d,0xa7,0x10, 0x9c,0x63,0x6e,0xe8, 0x3b,0xbb,0x7b,0xdb, 
+       0x26,0x78,0x09,0xcd, 0x59,0x18,0xf4,0x6e, 0x9a,0xb7,0x01,0xec, 0x4f,0x9a,0xa8,0x83, 
+       0x95,0x6e,0x65,0xe6, 0xff,0xe6,0x7e,0xaa, 0xbc,0xcf,0x08,0x21, 0x15,0xe8,0xe6,0xef, 
+       0xe7,0x9b,0xd9,0xba, 0x6f,0x36,0xce,0x4a, 0x9f,0x09,0xd4,0xea, 0xb0,0x7c,0xd6,0x29, 
+       0xa4,0xb2,0xaf,0x31, 0x3f,0x23,0x31,0x2a, 0xa5,0x94,0x30,0xc6, 0xa2,0x66,0xc0,0x35, 
+       0x4e,0xbc,0x37,0x74, 0x82,0xca,0xa6,0xfc, 0x90,0xd0,0xb0,0xe0, 0xa7,0xd8,0x15,0x33, 
+       0x04,0x98,0x4a,0xf1, 0xec,0xda,0xf7,0x41, 0xcd,0x50,0x0e,0x7f, 0x91,0xf6,0x2f,0x17, 
+       0x4d,0xd6,0x8d,0x76, 0xef,0xb0,0x4d,0x43, 0xaa,0x4d,0x54,0xcc, 0x96,0x04,0xdf,0xe4, 
+       0xd1,0xb5,0xe3,0x9e, 0x6a,0x88,0x1b,0x4c, 0x2c,0x1f,0xb8,0xc1, 0x65,0x51,0x7f,0x46, 
+       0x5e,0xea,0x04,0x9d, 0x8c,0x35,0x5d,0x01, 0x87,0x74,0x73,0xfa, 0x0b,0x41,0x2e,0xfb, 
+       0x67,0x1d,0x5a,0xb3, 0xdb,0xd2,0x52,0x92, 0x10,0x56,0x33,0xe9, 0xd6,0x47,0x13,0x6d, 
+       0xd7,0x61,0x8c,0x9a, 0xa1,0x0c,0x7a,0x37, 0xf8,0x14,0x8e,0x59, 0x13,0x3c,0x89,0xeb, 
+       0xa9,0x27,0xee,0xce, 0x61,0xc9,0x35,0xb7, 0x1c,0xe5,0xed,0xe1, 0x47,0xb1,0x3c,0x7a, 
+       0xd2,0xdf,0x59,0x9c, 0xf2,0x73,0x3f,0x55, 0x14,0xce,0x79,0x18, 0xc7,0x37,0xbf,0x73, 
+       0xf7,0xcd,0xea,0x53, 0xfd,0xaa,0x5b,0x5f, 0x3d,0x6f,0x14,0xdf, 0x44,0xdb,0x86,0x78, 
+       0xaf,0xf3,0x81,0xca, 0x68,0xc4,0x3e,0xb9, 0x24,0x34,0x2c,0x38, 0xa3,0x40,0x5f,0xc2, 
+       0x1d,0xc3,0x72,0x16, 0xe2,0x25,0x0c,0xbc, 0x3c,0x49,0x8b,0x28, 0x0d,0x95,0x41,0xff, 
+       0xa8,0x01,0x71,0x39, 0x0c,0xb3,0xde,0x08, 0xb4,0xe4,0x9c,0xd8, 0x56,0xc1,0x90,0x64, 
+       0xcb,0x84,0x61,0x7b, 0x32,0xb6,0x70,0xd5, 0x6c,0x5c,0x74,0x48, 0xb8,0x57,0x42,0xd0
+};
+
+static uint8_t S5[256]=
+{
+       0x52,0x09,0x6a,0xd5,
+       0x30,0x36,0xa5,0x38,
+       0xbf,0x40,0xa3,0x9e,
+       0x81,0xf3,0xd7,0xfb,
+       0x7c,0xe3,0x39,0x82,
+       0x9b,0x2f,0xff,0x87,
+       0x34,0x8e,0x43,0x44,
+       0xc4,0xde,0xe9,0xcb,
+       0x54,0x7b,0x94,0x32,
+       0xa6,0xc2,0x23,0x3d,
+       0xee,0x4c,0x95,0x0b,
+       0x42,0xfa,0xc3,0x4e,
+       0x08,0x2e,0xa1,0x66,
+       0x28,0xd9,0x24,0xb2,
+       0x76,0x5b,0xa2,0x49,
+       0x6d,0x8b,0xd1,0x25,
+       0x72,0xf8,0xf6,0x64,
+       0x86,0x68,0x98,0x16,
+       0xd4,0xa4,0x5c,0xcc,
+       0x5d,0x65,0xb6,0x92,
+       0x6c,0x70,0x48,0x50,
+       0xfd,0xed,0xb9,0xda,
+       0x5e,0x15,0x46,0x57,
+       0xa7,0x8d,0x9d,0x84,
+       0x90,0xd8,0xab,0x00,
+       0x8c,0xbc,0xd3,0x0a,
+       0xf7,0xe4,0x58,0x05,
+       0xb8,0xb3,0x45,0x06,
+       0xd0,0x2c,0x1e,0x8f,
+       0xca,0x3f,0x0f,0x02,
+       0xc1,0xaf,0xbd,0x03,
+       0x01,0x13,0x8a,0x6b,
+       0x3a,0x91,0x11,0x41,
+       0x4f,0x67,0xdc,0xea,
+       0x97,0xf2,0xcf,0xce,
+       0xf0,0xb4,0xe6,0x73,
+       0x96,0xac,0x74,0x22,
+       0xe7,0xad,0x35,0x85,
+       0xe2,0xf9,0x37,0xe8,
+       0x1c,0x75,0xdf,0x6e,
+       0x47,0xf1,0x1a,0x71,
+       0x1d,0x29,0xc5,0x89,
+       0x6f,0xb7,0x62,0x0e,
+       0xaa,0x18,0xbe,0x1b,
+       0xfc,0x56,0x3e,0x4b,
+       0xc6,0xd2,0x79,0x20,
+       0x9a,0xdb,0xc0,0xfe,
+       0x78,0xcd,0x5a,0xf4,
+       0x1f,0xdd,0xa8,0x33,
+       0x88,0x07,0xc7,0x31,
+       0xb1,0x12,0x10,0x59,
+       0x27,0x80,0xec,0x5f,
+       0x60,0x51,0x7f,0xa9,
+       0x19,0xb5,0x4a,0x0d,
+       0x2d,0xe5,0x7a,0x9f,
+       0x93,0xc9,0x9c,0xef,
+       0xa0,0xe0,0x3b,0x4d,
+       0xae,0x2a,0xf5,0xb0,
+       0xc8,0xeb,0xbb,0x3c,
+       0x83,0x53,0x99,0x61,
+       0x17,0x2b,0x04,0x7e,
+       0xba,0x77,0xd6,0x26,
+       0xe1,0x69,0x14,0x63,
+       0x55,0x21,0x0c,0x7d
+};
+
+static uint8_t U1[256][4]=
+{
+       0x00,0x00,0x00,0x00, 0x0e,0x09,0x0d,0x0b, 0x1c,0x12,0x1a,0x16, 0x12,0x1b,0x17,0x1d, 
+       0x38,0x24,0x34,0x2c, 0x36,0x2d,0x39,0x27, 0x24,0x36,0x2e,0x3a, 0x2a,0x3f,0x23,0x31, 
+       0x70,0x48,0x68,0x58, 0x7e,0x41,0x65,0x53, 0x6c,0x5a,0x72,0x4e, 0x62,0x53,0x7f,0x45, 
+       0x48,0x6c,0x5c,0x74, 0x46,0x65,0x51,0x7f, 0x54,0x7e,0x46,0x62, 0x5a,0x77,0x4b,0x69, 
+       0xe0,0x90,0xd0,0xb0, 0xee,0x99,0xdd,0xbb, 0xfc,0x82,0xca,0xa6, 0xf2,0x8b,0xc7,0xad, 
+       0xd8,0xb4,0xe4,0x9c, 0xd6,0xbd,0xe9,0x97, 0xc4,0xa6,0xfe,0x8a, 0xca,0xaf,0xf3,0x81, 
+       0x90,0xd8,0xb8,0xe8, 0x9e,0xd1,0xb5,0xe3, 0x8c,0xca,0xa2,0xfe, 0x82,0xc3,0xaf,0xf5, 
+       0xa8,0xfc,0x8c,0xc4, 0xa6,0xf5,0x81,0xcf, 0xb4,0xee,0x96,0xd2, 0xba,0xe7,0x9b,0xd9, 
+       0xdb,0x3b,0xbb,0x7b, 0xd5,0x32,0xb6,0x70, 0xc7,0x29,0xa1,0x6d, 0xc9,0x20,0xac,0x66, 
+       0xe3,0x1f,0x8f,0x57, 0xed,0x16,0x82,0x5c, 0xff,0x0d,0x95,0x41, 0xf1,0x04,0x98,0x4a, 
+       0xab,0x73,0xd3,0x23, 0xa5,0x7a,0xde,0x28, 0xb7,0x61,0xc9,0x35, 0xb9,0x68,0xc4,0x3e, 
+       0x93,0x57,0xe7,0x0f, 0x9d,0x5e,0xea,0x04, 0x8f,0x45,0xfd,0x19, 0x81,0x4c,0xf0,0x12, 
+       0x3b,0xab,0x6b,0xcb, 0x35,0xa2,0x66,0xc0, 0x27,0xb9,0x71,0xdd, 0x29,0xb0,0x7c,0xd6, 
+       0x03,0x8f,0x5f,0xe7, 0x0d,0x86,0x52,0xec, 0x1f,0x9d,0x45,0xf1, 0x11,0x94,0x48,0xfa, 
+       0x4b,0xe3,0x03,0x93, 0x45,0xea,0x0e,0x98, 0x57,0xf1,0x19,0x85, 0x59,0xf8,0x14,0x8e, 
+       0x73,0xc7,0x37,0xbf, 0x7d,0xce,0x3a,0xb4, 0x6f,0xd5,0x2d,0xa9, 0x61,0xdc,0x20,0xa2, 
+       0xad,0x76,0x6d,0xf6, 0xa3,0x7f,0x60,0xfd, 0xb1,0x64,0x77,0xe0, 0xbf,0x6d,0x7a,0xeb, 
+       0x95,0x52,0x59,0xda, 0x9b,0x5b,0x54,0xd1, 0x89,0x40,0x43,0xcc, 0x87,0x49,0x4e,0xc7, 
+       0xdd,0x3e,0x05,0xae, 0xd3,0x37,0x08,0xa5, 0xc1,0x2c,0x1f,0xb8, 0xcf,0x25,0x12,0xb3, 
+       0xe5,0x1a,0x31,0x82, 0xeb,0x13,0x3c,0x89, 0xf9,0x08,0x2b,0x94, 0xf7,0x01,0x26,0x9f, 
+       0x4d,0xe6,0xbd,0x46, 0x43,0xef,0xb0,0x4d, 0x51,0xf4,0xa7,0x50, 0x5f,0xfd,0xaa,0x5b, 
+       0x75,0xc2,0x89,0x6a, 0x7b,0xcb,0x84,0x61, 0x69,0xd0,0x93,0x7c, 0x67,0xd9,0x9e,0x77, 
+       0x3d,0xae,0xd5,0x1e, 0x33,0xa7,0xd8,0x15, 0x21,0xbc,0xcf,0x08, 0x2f,0xb5,0xc2,0x03, 
+       0x05,0x8a,0xe1,0x32, 0x0b,0x83,0xec,0x39, 0x19,0x98,0xfb,0x24, 0x17,0x91,0xf6,0x2f, 
+       0x76,0x4d,0xd6,0x8d, 0x78,0x44,0xdb,0x86, 0x6a,0x5f,0xcc,0x9b, 0x64,0x56,0xc1,0x90, 
+       0x4e,0x69,0xe2,0xa1, 0x40,0x60,0xef,0xaa, 0x52,0x7b,0xf8,0xb7, 0x5c,0x72,0xf5,0xbc, 
+       0x06,0x05,0xbe,0xd5, 0x08,0x0c,0xb3,0xde, 0x1a,0x17,0xa4,0xc3, 0x14,0x1e,0xa9,0xc8, 
+       0x3e,0x21,0x8a,0xf9, 0x30,0x28,0x87,0xf2, 0x22,0x33,0x90,0xef, 0x2c,0x3a,0x9d,0xe4, 
+       0x96,0xdd,0x06,0x3d, 0x98,0xd4,0x0b,0x36, 0x8a,0xcf,0x1c,0x2b, 0x84,0xc6,0x11,0x20, 
+       0xae,0xf9,0x32,0x11, 0xa0,0xf0,0x3f,0x1a, 0xb2,0xeb,0x28,0x07, 0xbc,0xe2,0x25,0x0c, 
+       0xe6,0x95,0x6e,0x65, 0xe8,0x9c,0x63,0x6e, 0xfa,0x87,0x74,0x73, 0xf4,0x8e,0x79,0x78, 
+       0xde,0xb1,0x5a,0x49, 0xd0,0xb8,0x57,0x42, 0xc2,0xa3,0x40,0x5f, 0xcc,0xaa,0x4d,0x54, 
+       0x41,0xec,0xda,0xf7, 0x4f,0xe5,0xd7,0xfc, 0x5d,0xfe,0xc0,0xe1, 0x53,0xf7,0xcd,0xea, 
+       0x79,0xc8,0xee,0xdb, 0x77,0xc1,0xe3,0xd0, 0x65,0xda,0xf4,0xcd, 0x6b,0xd3,0xf9,0xc6, 
+       0x31,0xa4,0xb2,0xaf, 0x3f,0xad,0xbf,0xa4, 0x2d,0xb6,0xa8,0xb9, 0x23,0xbf,0xa5,0xb2, 
+       0x09,0x80,0x86,0x83, 0x07,0x89,0x8b,0x88, 0x15,0x92,0x9c,0x95, 0x1b,0x9b,0x91,0x9e, 
+       0xa1,0x7c,0x0a,0x47, 0xaf,0x75,0x07,0x4c, 0xbd,0x6e,0x10,0x51, 0xb3,0x67,0x1d,0x5a, 
+       0x99,0x58,0x3e,0x6b, 0x97,0x51,0x33,0x60, 0x85,0x4a,0x24,0x7d, 0x8b,0x43,0x29,0x76, 
+       0xd1,0x34,0x62,0x1f, 0xdf,0x3d,0x6f,0x14, 0xcd,0x26,0x78,0x09, 0xc3,0x2f,0x75,0x02, 
+       0xe9,0x10,0x56,0x33, 0xe7,0x19,0x5b,0x38, 0xf5,0x02,0x4c,0x25, 0xfb,0x0b,0x41,0x2e, 
+       0x9a,0xd7,0x61,0x8c, 0x94,0xde,0x6c,0x87, 0x86,0xc5,0x7b,0x9a, 0x88,0xcc,0x76,0x91, 
+       0xa2,0xf3,0x55,0xa0, 0xac,0xfa,0x58,0xab, 0xbe,0xe1,0x4f,0xb6, 0xb0,0xe8,0x42,0xbd, 
+       0xea,0x9f,0x09,0xd4, 0xe4,0x96,0x04,0xdf, 0xf6,0x8d,0x13,0xc2, 0xf8,0x84,0x1e,0xc9, 
+       0xd2,0xbb,0x3d,0xf8, 0xdc,0xb2,0x30,0xf3, 0xce,0xa9,0x27,0xee, 0xc0,0xa0,0x2a,0xe5, 
+       0x7a,0x47,0xb1,0x3c, 0x74,0x4e,0xbc,0x37, 0x66,0x55,0xab,0x2a, 0x68,0x5c,0xa6,0x21, 
+       0x42,0x63,0x85,0x10, 0x4c,0x6a,0x88,0x1b, 0x5e,0x71,0x9f,0x06, 0x50,0x78,0x92,0x0d, 
+       0x0a,0x0f,0xd9,0x64, 0x04,0x06,0xd4,0x6f, 0x16,0x1d,0xc3,0x72, 0x18,0x14,0xce,0x79, 
+       0x32,0x2b,0xed,0x48, 0x3c,0x22,0xe0,0x43, 0x2e,0x39,0xf7,0x5e, 0x20,0x30,0xfa,0x55, 
+       0xec,0x9a,0xb7,0x01, 0xe2,0x93,0xba,0x0a, 0xf0,0x88,0xad,0x17, 0xfe,0x81,0xa0,0x1c, 
+       0xd4,0xbe,0x83,0x2d, 0xda,0xb7,0x8e,0x26, 0xc8,0xac,0x99,0x3b, 0xc6,0xa5,0x94,0x30, 
+       0x9c,0xd2,0xdf,0x59, 0x92,0xdb,0xd2,0x52, 0x80,0xc0,0xc5,0x4f, 0x8e,0xc9,0xc8,0x44, 
+       0xa4,0xf6,0xeb,0x75, 0xaa,0xff,0xe6,0x7e, 0xb8,0xe4,0xf1,0x63, 0xb6,0xed,0xfc,0x68, 
+       0x0c,0x0a,0x67,0xb1, 0x02,0x03,0x6a,0xba, 0x10,0x18,0x7d,0xa7, 0x1e,0x11,0x70,0xac, 
+       0x34,0x2e,0x53,0x9d, 0x3a,0x27,0x5e,0x96, 0x28,0x3c,0x49,0x8b, 0x26,0x35,0x44,0x80, 
+       0x7c,0x42,0x0f,0xe9, 0x72,0x4b,0x02,0xe2, 0x60,0x50,0x15,0xff, 0x6e,0x59,0x18,0xf4, 
+       0x44,0x66,0x3b,0xc5, 0x4a,0x6f,0x36,0xce, 0x58,0x74,0x21,0xd3, 0x56,0x7d,0x2c,0xd8, 
+       0x37,0xa1,0x0c,0x7a, 0x39,0xa8,0x01,0x71, 0x2b,0xb3,0x16,0x6c, 0x25,0xba,0x1b,0x67, 
+       0x0f,0x85,0x38,0x56, 0x01,0x8c,0x35,0x5d, 0x13,0x97,0x22,0x40, 0x1d,0x9e,0x2f,0x4b, 
+       0x47,0xe9,0x64,0x22, 0x49,0xe0,0x69,0x29, 0x5b,0xfb,0x7e,0x34, 0x55,0xf2,0x73,0x3f, 
+       0x7f,0xcd,0x50,0x0e, 0x71,0xc4,0x5d,0x05, 0x63,0xdf,0x4a,0x18, 0x6d,0xd6,0x47,0x13, 
+       0xd7,0x31,0xdc,0xca, 0xd9,0x38,0xd1,0xc1, 0xcb,0x23,0xc6,0xdc, 0xc5,0x2a,0xcb,0xd7, 
+       0xef,0x15,0xe8,0xe6, 0xe1,0x1c,0xe5,0xed, 0xf3,0x07,0xf2,0xf0, 0xfd,0x0e,0xff,0xfb, 
+       0xa7,0x79,0xb4,0x92, 0xa9,0x70,0xb9,0x99, 0xbb,0x6b,0xae,0x84, 0xb5,0x62,0xa3,0x8f, 
+       0x9f,0x5d,0x80,0xbe, 0x91,0x54,0x8d,0xb5, 0x83,0x4f,0x9a,0xa8, 0x8d,0x46,0x97,0xa3
+};
+       
+static uint8_t U2[256][4]=
+{
+       0x00,0x00,0x00,0x00, 0x0b,0x0e,0x09,0x0d, 0x16,0x1c,0x12,0x1a, 0x1d,0x12,0x1b,0x17, 
+       0x2c,0x38,0x24,0x34, 0x27,0x36,0x2d,0x39, 0x3a,0x24,0x36,0x2e, 0x31,0x2a,0x3f,0x23, 
+       0x58,0x70,0x48,0x68, 0x53,0x7e,0x41,0x65, 0x4e,0x6c,0x5a,0x72, 0x45,0x62,0x53,0x7f, 
+       0x74,0x48,0x6c,0x5c, 0x7f,0x46,0x65,0x51, 0x62,0x54,0x7e,0x46, 0x69,0x5a,0x77,0x4b, 
+       0xb0,0xe0,0x90,0xd0, 0xbb,0xee,0x99,0xdd, 0xa6,0xfc,0x82,0xca, 0xad,0xf2,0x8b,0xc7, 
+       0x9c,0xd8,0xb4,0xe4, 0x97,0xd6,0xbd,0xe9, 0x8a,0xc4,0xa6,0xfe, 0x81,0xca,0xaf,0xf3, 
+       0xe8,0x90,0xd8,0xb8, 0xe3,0x9e,0xd1,0xb5, 0xfe,0x8c,0xca,0xa2, 0xf5,0x82,0xc3,0xaf, 
+       0xc4,0xa8,0xfc,0x8c, 0xcf,0xa6,0xf5,0x81, 0xd2,0xb4,0xee,0x96, 0xd9,0xba,0xe7,0x9b, 
+       0x7b,0xdb,0x3b,0xbb, 0x70,0xd5,0x32,0xb6, 0x6d,0xc7,0x29,0xa1, 0x66,0xc9,0x20,0xac, 
+       0x57,0xe3,0x1f,0x8f, 0x5c,0xed,0x16,0x82, 0x41,0xff,0x0d,0x95, 0x4a,0xf1,0x04,0x98, 
+       0x23,0xab,0x73,0xd3, 0x28,0xa5,0x7a,0xde, 0x35,0xb7,0x61,0xc9, 0x3e,0xb9,0x68,0xc4, 
+       0x0f,0x93,0x57,0xe7, 0x04,0x9d,0x5e,0xea, 0x19,0x8f,0x45,0xfd, 0x12,0x81,0x4c,0xf0, 
+       0xcb,0x3b,0xab,0x6b, 0xc0,0x35,0xa2,0x66, 0xdd,0x27,0xb9,0x71, 0xd6,0x29,0xb0,0x7c, 
+       0xe7,0x03,0x8f,0x5f, 0xec,0x0d,0x86,0x52, 0xf1,0x1f,0x9d,0x45, 0xfa,0x11,0x94,0x48, 
+       0x93,0x4b,0xe3,0x03, 0x98,0x45,0xea,0x0e, 0x85,0x57,0xf1,0x19, 0x8e,0x59,0xf8,0x14, 
+       0xbf,0x73,0xc7,0x37, 0xb4,0x7d,0xce,0x3a, 0xa9,0x6f,0xd5,0x2d, 0xa2,0x61,0xdc,0x20, 
+       0xf6,0xad,0x76,0x6d, 0xfd,0xa3,0x7f,0x60, 0xe0,0xb1,0x64,0x77, 0xeb,0xbf,0x6d,0x7a, 
+       0xda,0x95,0x52,0x59, 0xd1,0x9b,0x5b,0x54, 0xcc,0x89,0x40,0x43, 0xc7,0x87,0x49,0x4e, 
+       0xae,0xdd,0x3e,0x05, 0xa5,0xd3,0x37,0x08, 0xb8,0xc1,0x2c,0x1f, 0xb3,0xcf,0x25,0x12, 
+       0x82,0xe5,0x1a,0x31, 0x89,0xeb,0x13,0x3c, 0x94,0xf9,0x08,0x2b, 0x9f,0xf7,0x01,0x26, 
+       0x46,0x4d,0xe6,0xbd, 0x4d,0x43,0xef,0xb0, 0x50,0x51,0xf4,0xa7, 0x5b,0x5f,0xfd,0xaa, 
+       0x6a,0x75,0xc2,0x89, 0x61,0x7b,0xcb,0x84, 0x7c,0x69,0xd0,0x93, 0x77,0x67,0xd9,0x9e, 
+       0x1e,0x3d,0xae,0xd5, 0x15,0x33,0xa7,0xd8, 0x08,0x21,0xbc,0xcf, 0x03,0x2f,0xb5,0xc2, 
+       0x32,0x05,0x8a,0xe1, 0x39,0x0b,0x83,0xec, 0x24,0x19,0x98,0xfb, 0x2f,0x17,0x91,0xf6, 
+       0x8d,0x76,0x4d,0xd6, 0x86,0x78,0x44,0xdb, 0x9b,0x6a,0x5f,0xcc, 0x90,0x64,0x56,0xc1, 
+       0xa1,0x4e,0x69,0xe2, 0xaa,0x40,0x60,0xef, 0xb7,0x52,0x7b,0xf8, 0xbc,0x5c,0x72,0xf5, 
+       0xd5,0x06,0x05,0xbe, 0xde,0x08,0x0c,0xb3, 0xc3,0x1a,0x17,0xa4, 0xc8,0x14,0x1e,0xa9, 
+       0xf9,0x3e,0x21,0x8a, 0xf2,0x30,0x28,0x87, 0xef,0x22,0x33,0x90, 0xe4,0x2c,0x3a,0x9d, 
+       0x3d,0x96,0xdd,0x06, 0x36,0x98,0xd4,0x0b, 0x2b,0x8a,0xcf,0x1c, 0x20,0x84,0xc6,0x11, 
+       0x11,0xae,0xf9,0x32, 0x1a,0xa0,0xf0,0x3f, 0x07,0xb2,0xeb,0x28, 0x0c,0xbc,0xe2,0x25, 
+       0x65,0xe6,0x95,0x6e, 0x6e,0xe8,0x9c,0x63, 0x73,0xfa,0x87,0x74, 0x78,0xf4,0x8e,0x79, 
+       0x49,0xde,0xb1,0x5a, 0x42,0xd0,0xb8,0x57, 0x5f,0xc2,0xa3,0x40, 0x54,0xcc,0xaa,0x4d, 
+       0xf7,0x41,0xec,0xda, 0xfc,0x4f,0xe5,0xd7, 0xe1,0x5d,0xfe,0xc0, 0xea,0x53,0xf7,0xcd, 
+       0xdb,0x79,0xc8,0xee, 0xd0,0x77,0xc1,0xe3, 0xcd,0x65,0xda,0xf4, 0xc6,0x6b,0xd3,0xf9, 
+       0xaf,0x31,0xa4,0xb2, 0xa4,0x3f,0xad,0xbf, 0xb9,0x2d,0xb6,0xa8, 0xb2,0x23,0xbf,0xa5, 
+       0x83,0x09,0x80,0x86, 0x88,0x07,0x89,0x8b, 0x95,0x15,0x92,0x9c, 0x9e,0x1b,0x9b,0x91, 
+       0x47,0xa1,0x7c,0x0a, 0x4c,0xaf,0x75,0x07, 0x51,0xbd,0x6e,0x10, 0x5a,0xb3,0x67,0x1d, 
+       0x6b,0x99,0x58,0x3e, 0x60,0x97,0x51,0x33, 0x7d,0x85,0x4a,0x24, 0x76,0x8b,0x43,0x29, 
+       0x1f,0xd1,0x34,0x62, 0x14,0xdf,0x3d,0x6f, 0x09,0xcd,0x26,0x78, 0x02,0xc3,0x2f,0x75, 
+       0x33,0xe9,0x10,0x56, 0x38,0xe7,0x19,0x5b, 0x25,0xf5,0x02,0x4c, 0x2e,0xfb,0x0b,0x41, 
+       0x8c,0x9a,0xd7,0x61, 0x87,0x94,0xde,0x6c, 0x9a,0x86,0xc5,0x7b, 0x91,0x88,0xcc,0x76, 
+       0xa0,0xa2,0xf3,0x55, 0xab,0xac,0xfa,0x58, 0xb6,0xbe,0xe1,0x4f, 0xbd,0xb0,0xe8,0x42, 
+       0xd4,0xea,0x9f,0x09, 0xdf,0xe4,0x96,0x04, 0xc2,0xf6,0x8d,0x13, 0xc9,0xf8,0x84,0x1e, 
+       0xf8,0xd2,0xbb,0x3d, 0xf3,0xdc,0xb2,0x30, 0xee,0xce,0xa9,0x27, 0xe5,0xc0,0xa0,0x2a, 
+       0x3c,0x7a,0x47,0xb1, 0x37,0x74,0x4e,0xbc, 0x2a,0x66,0x55,0xab, 0x21,0x68,0x5c,0xa6, 
+       0x10,0x42,0x63,0x85, 0x1b,0x4c,0x6a,0x88, 0x06,0x5e,0x71,0x9f, 0x0d,0x50,0x78,0x92, 
+       0x64,0x0a,0x0f,0xd9, 0x6f,0x04,0x06,0xd4, 0x72,0x16,0x1d,0xc3, 0x79,0x18,0x14,0xce, 
+       0x48,0x32,0x2b,0xed, 0x43,0x3c,0x22,0xe0, 0x5e,0x2e,0x39,0xf7, 0x55,0x20,0x30,0xfa, 
+       0x01,0xec,0x9a,0xb7, 0x0a,0xe2,0x93,0xba, 0x17,0xf0,0x88,0xad, 0x1c,0xfe,0x81,0xa0, 
+       0x2d,0xd4,0xbe,0x83, 0x26,0xda,0xb7,0x8e, 0x3b,0xc8,0xac,0x99, 0x30,0xc6,0xa5,0x94, 
+       0x59,0x9c,0xd2,0xdf, 0x52,0x92,0xdb,0xd2, 0x4f,0x80,0xc0,0xc5, 0x44,0x8e,0xc9,0xc8, 
+       0x75,0xa4,0xf6,0xeb, 0x7e,0xaa,0xff,0xe6, 0x63,0xb8,0xe4,0xf1, 0x68,0xb6,0xed,0xfc, 
+       0xb1,0x0c,0x0a,0x67, 0xba,0x02,0x03,0x6a, 0xa7,0x10,0x18,0x7d, 0xac,0x1e,0x11,0x70, 
+       0x9d,0x34,0x2e,0x53, 0x96,0x3a,0x27,0x5e, 0x8b,0x28,0x3c,0x49, 0x80,0x26,0x35,0x44, 
+       0xe9,0x7c,0x42,0x0f, 0xe2,0x72,0x4b,0x02, 0xff,0x60,0x50,0x15, 0xf4,0x6e,0x59,0x18, 
+       0xc5,0x44,0x66,0x3b, 0xce,0x4a,0x6f,0x36, 0xd3,0x58,0x74,0x21, 0xd8,0x56,0x7d,0x2c, 
+       0x7a,0x37,0xa1,0x0c, 0x71,0x39,0xa8,0x01, 0x6c,0x2b,0xb3,0x16, 0x67,0x25,0xba,0x1b, 
+       0x56,0x0f,0x85,0x38, 0x5d,0x01,0x8c,0x35, 0x40,0x13,0x97,0x22, 0x4b,0x1d,0x9e,0x2f, 
+       0x22,0x47,0xe9,0x64, 0x29,0x49,0xe0,0x69, 0x34,0x5b,0xfb,0x7e, 0x3f,0x55,0xf2,0x73, 
+       0x0e,0x7f,0xcd,0x50, 0x05,0x71,0xc4,0x5d, 0x18,0x63,0xdf,0x4a, 0x13,0x6d,0xd6,0x47, 
+       0xca,0xd7,0x31,0xdc, 0xc1,0xd9,0x38,0xd1, 0xdc,0xcb,0x23,0xc6, 0xd7,0xc5,0x2a,0xcb, 
+       0xe6,0xef,0x15,0xe8, 0xed,0xe1,0x1c,0xe5, 0xf0,0xf3,0x07,0xf2, 0xfb,0xfd,0x0e,0xff, 
+       0x92,0xa7,0x79,0xb4, 0x99,0xa9,0x70,0xb9, 0x84,0xbb,0x6b,0xae, 0x8f,0xb5,0x62,0xa3, 
+       0xbe,0x9f,0x5d,0x80, 0xb5,0x91,0x54,0x8d, 0xa8,0x83,0x4f,0x9a, 0xa3,0x8d,0x46,0x97
+};
+
+static uint8_t U3[256][4]=
+{
+       0x00,0x00,0x00,0x00, 0x0d,0x0b,0x0e,0x09, 0x1a,0x16,0x1c,0x12, 0x17,0x1d,0x12,0x1b, 
+       0x34,0x2c,0x38,0x24, 0x39,0x27,0x36,0x2d, 0x2e,0x3a,0x24,0x36, 0x23,0x31,0x2a,0x3f, 
+       0x68,0x58,0x70,0x48, 0x65,0x53,0x7e,0x41, 0x72,0x4e,0x6c,0x5a, 0x7f,0x45,0x62,0x53, 
+       0x5c,0x74,0x48,0x6c, 0x51,0x7f,0x46,0x65, 0x46,0x62,0x54,0x7e, 0x4b,0x69,0x5a,0x77, 
+       0xd0,0xb0,0xe0,0x90, 0xdd,0xbb,0xee,0x99, 0xca,0xa6,0xfc,0x82, 0xc7,0xad,0xf2,0x8b, 
+       0xe4,0x9c,0xd8,0xb4, 0xe9,0x97,0xd6,0xbd, 0xfe,0x8a,0xc4,0xa6, 0xf3,0x81,0xca,0xaf, 
+       0xb8,0xe8,0x90,0xd8, 0xb5,0xe3,0x9e,0xd1, 0xa2,0xfe,0x8c,0xca, 0xaf,0xf5,0x82,0xc3, 
+       0x8c,0xc4,0xa8,0xfc, 0x81,0xcf,0xa6,0xf5, 0x96,0xd2,0xb4,0xee, 0x9b,0xd9,0xba,0xe7, 
+       0xbb,0x7b,0xdb,0x3b, 0xb6,0x70,0xd5,0x32, 0xa1,0x6d,0xc7,0x29, 0xac,0x66,0xc9,0x20, 
+       0x8f,0x57,0xe3,0x1f, 0x82,0x5c,0xed,0x16, 0x95,0x41,0xff,0x0d, 0x98,0x4a,0xf1,0x04, 
+       0xd3,0x23,0xab,0x73, 0xde,0x28,0xa5,0x7a, 0xc9,0x35,0xb7,0x61, 0xc4,0x3e,0xb9,0x68, 
+       0xe7,0x0f,0x93,0x57, 0xea,0x04,0x9d,0x5e, 0xfd,0x19,0x8f,0x45, 0xf0,0x12,0x81,0x4c, 
+       0x6b,0xcb,0x3b,0xab, 0x66,0xc0,0x35,0xa2, 0x71,0xdd,0x27,0xb9, 0x7c,0xd6,0x29,0xb0, 
+       0x5f,0xe7,0x03,0x8f, 0x52,0xec,0x0d,0x86, 0x45,0xf1,0x1f,0x9d, 0x48,0xfa,0x11,0x94, 
+       0x03,0x93,0x4b,0xe3, 0x0e,0x98,0x45,0xea, 0x19,0x85,0x57,0xf1, 0x14,0x8e,0x59,0xf8, 
+       0x37,0xbf,0x73,0xc7, 0x3a,0xb4,0x7d,0xce, 0x2d,0xa9,0x6f,0xd5, 0x20,0xa2,0x61,0xdc, 
+       0x6d,0xf6,0xad,0x76, 0x60,0xfd,0xa3,0x7f, 0x77,0xe0,0xb1,0x64, 0x7a,0xeb,0xbf,0x6d, 
+       0x59,0xda,0x95,0x52, 0x54,0xd1,0x9b,0x5b, 0x43,0xcc,0x89,0x40, 0x4e,0xc7,0x87,0x49, 
+       0x05,0xae,0xdd,0x3e, 0x08,0xa5,0xd3,0x37, 0x1f,0xb8,0xc1,0x2c, 0x12,0xb3,0xcf,0x25, 
+       0x31,0x82,0xe5,0x1a, 0x3c,0x89,0xeb,0x13, 0x2b,0x94,0xf9,0x08, 0x26,0x9f,0xf7,0x01, 
+       0xbd,0x46,0x4d,0xe6, 0xb0,0x4d,0x43,0xef, 0xa7,0x50,0x51,0xf4, 0xaa,0x5b,0x5f,0xfd, 
+       0x89,0x6a,0x75,0xc2, 0x84,0x61,0x7b,0xcb, 0x93,0x7c,0x69,0xd0, 0x9e,0x77,0x67,0xd9, 
+       0xd5,0x1e,0x3d,0xae, 0xd8,0x15,0x33,0xa7, 0xcf,0x08,0x21,0xbc, 0xc2,0x03,0x2f,0xb5, 
+       0xe1,0x32,0x05,0x8a, 0xec,0x39,0x0b,0x83, 0xfb,0x24,0x19,0x98, 0xf6,0x2f,0x17,0x91, 
+       0xd6,0x8d,0x76,0x4d, 0xdb,0x86,0x78,0x44, 0xcc,0x9b,0x6a,0x5f, 0xc1,0x90,0x64,0x56, 
+       0xe2,0xa1,0x4e,0x69, 0xef,0xaa,0x40,0x60, 0xf8,0xb7,0x52,0x7b, 0xf5,0xbc,0x5c,0x72, 
+       0xbe,0xd5,0x06,0x05, 0xb3,0xde,0x08,0x0c, 0xa4,0xc3,0x1a,0x17, 0xa9,0xc8,0x14,0x1e, 
+       0x8a,0xf9,0x3e,0x21, 0x87,0xf2,0x30,0x28, 0x90,0xef,0x22,0x33, 0x9d,0xe4,0x2c,0x3a, 
+       0x06,0x3d,0x96,0xdd, 0x0b,0x36,0x98,0xd4, 0x1c,0x2b,0x8a,0xcf, 0x11,0x20,0x84,0xc6, 
+       0x32,0x11,0xae,0xf9, 0x3f,0x1a,0xa0,0xf0, 0x28,0x07,0xb2,0xeb, 0x25,0x0c,0xbc,0xe2, 
+       0x6e,0x65,0xe6,0x95, 0x63,0x6e,0xe8,0x9c, 0x74,0x73,0xfa,0x87, 0x79,0x78,0xf4,0x8e, 
+       0x5a,0x49,0xde,0xb1, 0x57,0x42,0xd0,0xb8, 0x40,0x5f,0xc2,0xa3, 0x4d,0x54,0xcc,0xaa, 
+       0xda,0xf7,0x41,0xec, 0xd7,0xfc,0x4f,0xe5, 0xc0,0xe1,0x5d,0xfe, 0xcd,0xea,0x53,0xf7, 
+       0xee,0xdb,0x79,0xc8, 0xe3,0xd0,0x77,0xc1, 0xf4,0xcd,0x65,0xda, 0xf9,0xc6,0x6b,0xd3, 
+       0xb2,0xaf,0x31,0xa4, 0xbf,0xa4,0x3f,0xad, 0xa8,0xb9,0x2d,0xb6, 0xa5,0xb2,0x23,0xbf, 
+       0x86,0x83,0x09,0x80, 0x8b,0x88,0x07,0x89, 0x9c,0x95,0x15,0x92, 0x91,0x9e,0x1b,0x9b, 
+       0x0a,0x47,0xa1,0x7c, 0x07,0x4c,0xaf,0x75, 0x10,0x51,0xbd,0x6e, 0x1d,0x5a,0xb3,0x67, 
+       0x3e,0x6b,0x99,0x58, 0x33,0x60,0x97,0x51, 0x24,0x7d,0x85,0x4a, 0x29,0x76,0x8b,0x43, 
+       0x62,0x1f,0xd1,0x34, 0x6f,0x14,0xdf,0x3d, 0x78,0x09,0xcd,0x26, 0x75,0x02,0xc3,0x2f, 
+       0x56,0x33,0xe9,0x10, 0x5b,0x38,0xe7,0x19, 0x4c,0x25,0xf5,0x02, 0x41,0x2e,0xfb,0x0b, 
+       0x61,0x8c,0x9a,0xd7, 0x6c,0x87,0x94,0xde, 0x7b,0x9a,0x86,0xc5, 0x76,0x91,0x88,0xcc, 
+       0x55,0xa0,0xa2,0xf3, 0x58,0xab,0xac,0xfa, 0x4f,0xb6,0xbe,0xe1, 0x42,0xbd,0xb0,0xe8, 
+       0x09,0xd4,0xea,0x9f, 0x04,0xdf,0xe4,0x96, 0x13,0xc2,0xf6,0x8d, 0x1e,0xc9,0xf8,0x84, 
+       0x3d,0xf8,0xd2,0xbb, 0x30,0xf3,0xdc,0xb2, 0x27,0xee,0xce,0xa9, 0x2a,0xe5,0xc0,0xa0, 
+       0xb1,0x3c,0x7a,0x47, 0xbc,0x37,0x74,0x4e, 0xab,0x2a,0x66,0x55, 0xa6,0x21,0x68,0x5c, 
+       0x85,0x10,0x42,0x63, 0x88,0x1b,0x4c,0x6a, 0x9f,0x06,0x5e,0x71, 0x92,0x0d,0x50,0x78, 
+       0xd9,0x64,0x0a,0x0f, 0xd4,0x6f,0x04,0x06, 0xc3,0x72,0x16,0x1d, 0xce,0x79,0x18,0x14, 
+       0xed,0x48,0x32,0x2b, 0xe0,0x43,0x3c,0x22, 0xf7,0x5e,0x2e,0x39, 0xfa,0x55,0x20,0x30, 
+       0xb7,0x01,0xec,0x9a, 0xba,0x0a,0xe2,0x93, 0xad,0x17,0xf0,0x88, 0xa0,0x1c,0xfe,0x81, 
+       0x83,0x2d,0xd4,0xbe, 0x8e,0x26,0xda,0xb7, 0x99,0x3b,0xc8,0xac, 0x94,0x30,0xc6,0xa5, 
+       0xdf,0x59,0x9c,0xd2, 0xd2,0x52,0x92,0xdb, 0xc5,0x4f,0x80,0xc0, 0xc8,0x44,0x8e,0xc9, 
+       0xeb,0x75,0xa4,0xf6, 0xe6,0x7e,0xaa,0xff, 0xf1,0x63,0xb8,0xe4, 0xfc,0x68,0xb6,0xed, 
+       0x67,0xb1,0x0c,0x0a, 0x6a,0xba,0x02,0x03, 0x7d,0xa7,0x10,0x18, 0x70,0xac,0x1e,0x11, 
+       0x53,0x9d,0x34,0x2e, 0x5e,0x96,0x3a,0x27, 0x49,0x8b,0x28,0x3c, 0x44,0x80,0x26,0x35, 
+       0x0f,0xe9,0x7c,0x42, 0x02,0xe2,0x72,0x4b, 0x15,0xff,0x60,0x50, 0x18,0xf4,0x6e,0x59, 
+       0x3b,0xc5,0x44,0x66, 0x36,0xce,0x4a,0x6f, 0x21,0xd3,0x58,0x74, 0x2c,0xd8,0x56,0x7d, 
+       0x0c,0x7a,0x37,0xa1, 0x01,0x71,0x39,0xa8, 0x16,0x6c,0x2b,0xb3, 0x1b,0x67,0x25,0xba, 
+       0x38,0x56,0x0f,0x85, 0x35,0x5d,0x01,0x8c, 0x22,0x40,0x13,0x97, 0x2f,0x4b,0x1d,0x9e, 
+       0x64,0x22,0x47,0xe9, 0x69,0x29,0x49,0xe0, 0x7e,0x34,0x5b,0xfb, 0x73,0x3f,0x55,0xf2, 
+       0x50,0x0e,0x7f,0xcd, 0x5d,0x05,0x71,0xc4, 0x4a,0x18,0x63,0xdf, 0x47,0x13,0x6d,0xd6, 
+       0xdc,0xca,0xd7,0x31, 0xd1,0xc1,0xd9,0x38, 0xc6,0xdc,0xcb,0x23, 0xcb,0xd7,0xc5,0x2a, 
+       0xe8,0xe6,0xef,0x15, 0xe5,0xed,0xe1,0x1c, 0xf2,0xf0,0xf3,0x07, 0xff,0xfb,0xfd,0x0e, 
+       0xb4,0x92,0xa7,0x79, 0xb9,0x99,0xa9,0x70, 0xae,0x84,0xbb,0x6b, 0xa3,0x8f,0xb5,0x62, 
+       0x80,0xbe,0x9f,0x5d, 0x8d,0xb5,0x91,0x54, 0x9a,0xa8,0x83,0x4f, 0x97,0xa3,0x8d,0x46
+};
+
+static uint8_t U4[256][4]=
+{
+       0x00,0x00,0x00,0x00, 0x09,0x0d,0x0b,0x0e, 0x12,0x1a,0x16,0x1c, 0x1b,0x17,0x1d,0x12, 
+       0x24,0x34,0x2c,0x38, 0x2d,0x39,0x27,0x36, 0x36,0x2e,0x3a,0x24, 0x3f,0x23,0x31,0x2a, 
+       0x48,0x68,0x58,0x70, 0x41,0x65,0x53,0x7e, 0x5a,0x72,0x4e,0x6c, 0x53,0x7f,0x45,0x62, 
+       0x6c,0x5c,0x74,0x48, 0x65,0x51,0x7f,0x46, 0x7e,0x46,0x62,0x54, 0x77,0x4b,0x69,0x5a, 
+       0x90,0xd0,0xb0,0xe0, 0x99,0xdd,0xbb,0xee, 0x82,0xca,0xa6,0xfc, 0x8b,0xc7,0xad,0xf2, 
+       0xb4,0xe4,0x9c,0xd8, 0xbd,0xe9,0x97,0xd6, 0xa6,0xfe,0x8a,0xc4, 0xaf,0xf3,0x81,0xca, 
+       0xd8,0xb8,0xe8,0x90, 0xd1,0xb5,0xe3,0x9e, 0xca,0xa2,0xfe,0x8c, 0xc3,0xaf,0xf5,0x82, 
+       0xfc,0x8c,0xc4,0xa8, 0xf5,0x81,0xcf,0xa6, 0xee,0x96,0xd2,0xb4, 0xe7,0x9b,0xd9,0xba, 
+       0x3b,0xbb,0x7b,0xdb, 0x32,0xb6,0x70,0xd5, 0x29,0xa1,0x6d,0xc7, 0x20,0xac,0x66,0xc9, 
+       0x1f,0x8f,0x57,0xe3, 0x16,0x82,0x5c,0xed, 0x0d,0x95,0x41,0xff, 0x04,0x98,0x4a,0xf1, 
+       0x73,0xd3,0x23,0xab, 0x7a,0xde,0x28,0xa5, 0x61,0xc9,0x35,0xb7, 0x68,0xc4,0x3e,0xb9, 
+       0x57,0xe7,0x0f,0x93, 0x5e,0xea,0x04,0x9d, 0x45,0xfd,0x19,0x8f, 0x4c,0xf0,0x12,0x81, 
+       0xab,0x6b,0xcb,0x3b, 0xa2,0x66,0xc0,0x35, 0xb9,0x71,0xdd,0x27, 0xb0,0x7c,0xd6,0x29, 
+       0x8f,0x5f,0xe7,0x03, 0x86,0x52,0xec,0x0d, 0x9d,0x45,0xf1,0x1f, 0x94,0x48,0xfa,0x11, 
+       0xe3,0x03,0x93,0x4b, 0xea,0x0e,0x98,0x45, 0xf1,0x19,0x85,0x57, 0xf8,0x14,0x8e,0x59, 
+       0xc7,0x37,0xbf,0x73, 0xce,0x3a,0xb4,0x7d, 0xd5,0x2d,0xa9,0x6f, 0xdc,0x20,0xa2,0x61, 
+       0x76,0x6d,0xf6,0xad, 0x7f,0x60,0xfd,0xa3, 0x64,0x77,0xe0,0xb1, 0x6d,0x7a,0xeb,0xbf, 
+       0x52,0x59,0xda,0x95, 0x5b,0x54,0xd1,0x9b, 0x40,0x43,0xcc,0x89, 0x49,0x4e,0xc7,0x87, 
+       0x3e,0x05,0xae,0xdd, 0x37,0x08,0xa5,0xd3, 0x2c,0x1f,0xb8,0xc1, 0x25,0x12,0xb3,0xcf, 
+       0x1a,0x31,0x82,0xe5, 0x13,0x3c,0x89,0xeb, 0x08,0x2b,0x94,0xf9, 0x01,0x26,0x9f,0xf7, 
+       0xe6,0xbd,0x46,0x4d, 0xef,0xb0,0x4d,0x43, 0xf4,0xa7,0x50,0x51, 0xfd,0xaa,0x5b,0x5f, 
+       0xc2,0x89,0x6a,0x75, 0xcb,0x84,0x61,0x7b, 0xd0,0x93,0x7c,0x69, 0xd9,0x9e,0x77,0x67, 
+       0xae,0xd5,0x1e,0x3d, 0xa7,0xd8,0x15,0x33, 0xbc,0xcf,0x08,0x21, 0xb5,0xc2,0x03,0x2f, 
+       0x8a,0xe1,0x32,0x05, 0x83,0xec,0x39,0x0b, 0x98,0xfb,0x24,0x19, 0x91,0xf6,0x2f,0x17, 
+       0x4d,0xd6,0x8d,0x76, 0x44,0xdb,0x86,0x78, 0x5f,0xcc,0x9b,0x6a, 0x56,0xc1,0x90,0x64, 
+       0x69,0xe2,0xa1,0x4e, 0x60,0xef,0xaa,0x40, 0x7b,0xf8,0xb7,0x52, 0x72,0xf5,0xbc,0x5c, 
+       0x05,0xbe,0xd5,0x06, 0x0c,0xb3,0xde,0x08, 0x17,0xa4,0xc3,0x1a, 0x1e,0xa9,0xc8,0x14, 
+       0x21,0x8a,0xf9,0x3e, 0x28,0x87,0xf2,0x30, 0x33,0x90,0xef,0x22, 0x3a,0x9d,0xe4,0x2c, 
+       0xdd,0x06,0x3d,0x96, 0xd4,0x0b,0x36,0x98, 0xcf,0x1c,0x2b,0x8a, 0xc6,0x11,0x20,0x84, 
+       0xf9,0x32,0x11,0xae, 0xf0,0x3f,0x1a,0xa0, 0xeb,0x28,0x07,0xb2, 0xe2,0x25,0x0c,0xbc, 
+       0x95,0x6e,0x65,0xe6, 0x9c,0x63,0x6e,0xe8, 0x87,0x74,0x73,0xfa, 0x8e,0x79,0x78,0xf4, 
+       0xb1,0x5a,0x49,0xde, 0xb8,0x57,0x42,0xd0, 0xa3,0x40,0x5f,0xc2, 0xaa,0x4d,0x54,0xcc, 
+       0xec,0xda,0xf7,0x41, 0xe5,0xd7,0xfc,0x4f, 0xfe,0xc0,0xe1,0x5d, 0xf7,0xcd,0xea,0x53, 
+       0xc8,0xee,0xdb,0x79, 0xc1,0xe3,0xd0,0x77, 0xda,0xf4,0xcd,0x65, 0xd3,0xf9,0xc6,0x6b, 
+       0xa4,0xb2,0xaf,0x31, 0xad,0xbf,0xa4,0x3f, 0xb6,0xa8,0xb9,0x2d, 0xbf,0xa5,0xb2,0x23, 
+       0x80,0x86,0x83,0x09, 0x89,0x8b,0x88,0x07, 0x92,0x9c,0x95,0x15, 0x9b,0x91,0x9e,0x1b, 
+       0x7c,0x0a,0x47,0xa1, 0x75,0x07,0x4c,0xaf, 0x6e,0x10,0x51,0xbd, 0x67,0x1d,0x5a,0xb3, 
+       0x58,0x3e,0x6b,0x99, 0x51,0x33,0x60,0x97, 0x4a,0x24,0x7d,0x85, 0x43,0x29,0x76,0x8b, 
+       0x34,0x62,0x1f,0xd1, 0x3d,0x6f,0x14,0xdf, 0x26,0x78,0x09,0xcd, 0x2f,0x75,0x02,0xc3, 
+       0x10,0x56,0x33,0xe9, 0x19,0x5b,0x38,0xe7, 0x02,0x4c,0x25,0xf5, 0x0b,0x41,0x2e,0xfb, 
+       0xd7,0x61,0x8c,0x9a, 0xde,0x6c,0x87,0x94, 0xc5,0x7b,0x9a,0x86, 0xcc,0x76,0x91,0x88, 
+       0xf3,0x55,0xa0,0xa2, 0xfa,0x58,0xab,0xac, 0xe1,0x4f,0xb6,0xbe, 0xe8,0x42,0xbd,0xb0, 
+       0x9f,0x09,0xd4,0xea, 0x96,0x04,0xdf,0xe4, 0x8d,0x13,0xc2,0xf6, 0x84,0x1e,0xc9,0xf8, 
+       0xbb,0x3d,0xf8,0xd2, 0xb2,0x30,0xf3,0xdc, 0xa9,0x27,0xee,0xce, 0xa0,0x2a,0xe5,0xc0, 
+       0x47,0xb1,0x3c,0x7a, 0x4e,0xbc,0x37,0x74, 0x55,0xab,0x2a,0x66, 0x5c,0xa6,0x21,0x68, 
+       0x63,0x85,0x10,0x42, 0x6a,0x88,0x1b,0x4c, 0x71,0x9f,0x06,0x5e, 0x78,0x92,0x0d,0x50, 
+       0x0f,0xd9,0x64,0x0a, 0x06,0xd4,0x6f,0x04, 0x1d,0xc3,0x72,0x16, 0x14,0xce,0x79,0x18, 
+       0x2b,0xed,0x48,0x32, 0x22,0xe0,0x43,0x3c, 0x39,0xf7,0x5e,0x2e, 0x30,0xfa,0x55,0x20, 
+       0x9a,0xb7,0x01,0xec, 0x93,0xba,0x0a,0xe2, 0x88,0xad,0x17,0xf0, 0x81,0xa0,0x1c,0xfe, 
+       0xbe,0x83,0x2d,0xd4, 0xb7,0x8e,0x26,0xda, 0xac,0x99,0x3b,0xc8, 0xa5,0x94,0x30,0xc6, 
+       0xd2,0xdf,0x59,0x9c, 0xdb,0xd2,0x52,0x92, 0xc0,0xc5,0x4f,0x80, 0xc9,0xc8,0x44,0x8e, 
+       0xf6,0xeb,0x75,0xa4, 0xff,0xe6,0x7e,0xaa, 0xe4,0xf1,0x63,0xb8, 0xed,0xfc,0x68,0xb6, 
+       0x0a,0x67,0xb1,0x0c, 0x03,0x6a,0xba,0x02, 0x18,0x7d,0xa7,0x10, 0x11,0x70,0xac,0x1e, 
+       0x2e,0x53,0x9d,0x34, 0x27,0x5e,0x96,0x3a, 0x3c,0x49,0x8b,0x28, 0x35,0x44,0x80,0x26, 
+       0x42,0x0f,0xe9,0x7c, 0x4b,0x02,0xe2,0x72, 0x50,0x15,0xff,0x60, 0x59,0x18,0xf4,0x6e, 
+       0x66,0x3b,0xc5,0x44, 0x6f,0x36,0xce,0x4a, 0x74,0x21,0xd3,0x58, 0x7d,0x2c,0xd8,0x56, 
+       0xa1,0x0c,0x7a,0x37, 0xa8,0x01,0x71,0x39, 0xb3,0x16,0x6c,0x2b, 0xba,0x1b,0x67,0x25, 
+       0x85,0x38,0x56,0x0f, 0x8c,0x35,0x5d,0x01, 0x97,0x22,0x40,0x13, 0x9e,0x2f,0x4b,0x1d, 
+       0xe9,0x64,0x22,0x47, 0xe0,0x69,0x29,0x49, 0xfb,0x7e,0x34,0x5b, 0xf2,0x73,0x3f,0x55, 
+       0xcd,0x50,0x0e,0x7f, 0xc4,0x5d,0x05,0x71, 0xdf,0x4a,0x18,0x63, 0xd6,0x47,0x13,0x6d, 
+       0x31,0xdc,0xca,0xd7, 0x38,0xd1,0xc1,0xd9, 0x23,0xc6,0xdc,0xcb, 0x2a,0xcb,0xd7,0xc5, 
+       0x15,0xe8,0xe6,0xef, 0x1c,0xe5,0xed,0xe1, 0x07,0xf2,0xf0,0xf3, 0x0e,0xff,0xfb,0xfd, 
+       0x79,0xb4,0x92,0xa7, 0x70,0xb9,0x99,0xa9, 0x6b,0xae,0x84,0xbb, 0x62,0xa3,0x8f,0xb5, 
+       0x5d,0x80,0xbe,0x9f, 0x54,0x8d,0xb5,0x91, 0x4f,0x9a,0xa8,0x83, 0x46,0x97,0xa3,0x8d
+};
+
+static uint32_t rcon[30]=
+{ 
+       0x01, 0x02, 0x04, 0x08, 0x10, 0x20,
+       0x40, 0x80, 0x1b, 0x36, 0x6c, 0xd8,
+       0xab, 0x4d, 0x9a, 0x2f, 0x5e, 0xbc,
+       0x63, 0xc6, 0x97, 0x35, 0x6a, 0xd4,
+       0xb3, 0x7d, 0xfa, 0xef, 0xc5, 0x91
+};
+
+
+
+//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+// API
+//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+Rijndael::Rijndael()
+{
+        m_state = Invalid;
+}
+
+Rijndael::~Rijndael()
+{
+       // nothing here
+}
+
+int Rijndael::init(Mode mode,Direction dir,const uint8_t * key,KeyLength keyLen,uint8_t * initVector)
+{
+       // Not initialized yet
+       m_state = Invalid;
+
+       // Check the mode
+       if((mode != CBC) && (mode != ECB) && (mode != CFB1))return RIJNDAEL_UNSUPPORTED_MODE;
+       m_mode = mode;
+
+       // And the direction
+       if((dir != Encrypt) && (dir != Decrypt))return RIJNDAEL_UNSUPPORTED_DIRECTION;
+       m_direction = dir;
+
+       // Allow to set an init vector
+       if(initVector)
+       {
+               // specified init vector
+               for(int i = 0;i < MAX_IV_SIZE;i++)
+               {
+                       m_initVector[i] = initVector[i];
+               }
+       } else {
+               // zero init vector
+               for(int i = 0;i < MAX_IV_SIZE;i++)
+               {
+                       m_initVector[i] = 0;
+               }
+       }
+
+       uint32_t uKeyLenInBytes;
+
+       // And check the key length
+       switch(keyLen)
+       {
+               case Key16Bytes:
+                       uKeyLenInBytes = 16;
+                       m_uRounds = 10;
+               break;
+               case Key24Bytes:
+                       uKeyLenInBytes = 24;
+                       m_uRounds = 12;
+               break;
+               case Key32Bytes:
+                       uKeyLenInBytes = 32;
+                       m_uRounds = 14;
+               break;
+               default:
+                       return RIJNDAEL_UNSUPPORTED_KEY_LENGTH;
+               break;
+       }
+       // The number of rounds is calculated as
+       // m_uRounds = (m_uKeyLenInBits / 32) + 6;
+
+       if(!key)return RIJNDAEL_BAD_KEY;
+
+       uint8_t keyMatrix[_MAX_KEY_COLUMNS][4];
+
+       for(uint32_t i = 0;i < uKeyLenInBytes;i++)keyMatrix[i >> 2][i & 3] = key[i]; 
+
+       keySched(keyMatrix);
+
+       if(m_direction == Decrypt)keyEncToDec();
+
+       m_state = Valid;
+
+       return RIJNDAEL_SUCCESS;
+}
+
+int Rijndael::blockEncrypt(const uint8_t *input,int inputLen,uint8_t *outBuffer)
+{
+       int i, k, numBlocks;
+       uint8_t block[16], iv[4][4];
+
+       if(m_state != Valid)return RIJNDAEL_NOT_INITIALIZED;
+       if(m_direction != Encrypt)return RIJNDAEL_BAD_DIRECTION;
+
+       if(input == 0 || inputLen <= 0)return 0;
+
+       numBlocks = inputLen/128;
+       
+       switch(m_mode){
+               case ECB: 
+                       for(i = numBlocks;i > 0;i--)
+                       {
+                               encrypt(input,outBuffer);
+                               input += 16;
+                               outBuffer += 16;
+                       }
+               break;
+               case CBC:
+                       ((uint32_t*)block)[0] = ((uint32_t*)m_initVector)[0] ^ ((uint32_t*)input)[0];
+                       ((uint32_t*)block)[1] = ((uint32_t*)m_initVector)[1] ^ ((uint32_t*)input)[1];
+                       ((uint32_t*)block)[2] = ((uint32_t*)m_initVector)[2] ^ ((uint32_t*)input)[2];
+                       ((uint32_t*)block)[3] = ((uint32_t*)m_initVector)[3] ^ ((uint32_t*)input)[3];
+                       encrypt(block,outBuffer);
+                       input += 16;
+                       for(i = numBlocks - 1;i > 0;i--)
+                       {
+                               ((uint32_t*)block)[0] = ((uint32_t*)outBuffer)[0] ^ ((uint32_t*)input)[0];
+                               ((uint32_t*)block)[1] = ((uint32_t*)outBuffer)[1] ^ ((uint32_t*)input)[1];
+                               ((uint32_t*)block)[2] = ((uint32_t*)outBuffer)[2] ^ ((uint32_t*)input)[2];
+                               ((uint32_t*)block)[3] = ((uint32_t*)outBuffer)[3] ^ ((uint32_t*)input)[3];
+                               outBuffer += 16;
+                               encrypt(block,outBuffer);
+                               input += 16;
+                       }
+               break;
+               case CFB1:
+#if STRICT_ALIGN 
+                       memcpy(iv,m_initVector,16); 
+#else  /* !STRICT_ALIGN */
+                       *((uint32_t*)iv[0]) = *((uint32_t*)(m_initVector   ));
+                       *((uint32_t*)iv[1]) = *((uint32_t*)(m_initVector + 4));
+                       *((uint32_t*)iv[2]) = *((uint32_t*)(m_initVector + 8));
+                       *((uint32_t*)iv[3]) = *((uint32_t*)(m_initVector +12));
+#endif /* ?STRICT_ALIGN */
+                       for(i = numBlocks; i > 0; i--)
+                       {
+                               for(k = 0; k < 128; k++)
+                               {
+                                       *((uint32_t*) block    ) = *((uint32_t*)iv[0]);
+                                       *((uint32_t*)(block+ 4)) = *((uint32_t*)iv[1]);
+                                       *((uint32_t*)(block+ 8)) = *((uint32_t*)iv[2]);
+                                       *((uint32_t*)(block+12)) = *((uint32_t*)iv[3]);
+                                       encrypt(block,block);
+                                       outBuffer[k/8] ^= (block[0] & 0x80) >> (k & 7);
+                                       iv[0][0] = (iv[0][0] << 1) | (iv[0][1] >> 7);
+                                       iv[0][1] = (iv[0][1] << 1) | (iv[0][2] >> 7);
+                                       iv[0][2] = (iv[0][2] << 1) | (iv[0][3] >> 7);
+                                       iv[0][3] = (iv[0][3] << 1) | (iv[1][0] >> 7);
+                                       iv[1][0] = (iv[1][0] << 1) | (iv[1][1] >> 7);
+                                       iv[1][1] = (iv[1][1] << 1) | (iv[1][2] >> 7);
+                                       iv[1][2] = (iv[1][2] << 1) | (iv[1][3] >> 7);
+                                       iv[1][3] = (iv[1][3] << 1) | (iv[2][0] >> 7);
+                                       iv[2][0] = (iv[2][0] << 1) | (iv[2][1] >> 7);
+                                       iv[2][1] = (iv[2][1] << 1) | (iv[2][2] >> 7);
+                                       iv[2][2] = (iv[2][2] << 1) | (iv[2][3] >> 7);
+                                       iv[2][3] = (iv[2][3] << 1) | (iv[3][0] >> 7);
+                                       iv[3][0] = (iv[3][0] << 1) | (iv[3][1] >> 7);
+                                       iv[3][1] = (iv[3][1] << 1) | (iv[3][2] >> 7);
+                                       iv[3][2] = (iv[3][2] << 1) | (iv[3][3] >> 7);
+                                       iv[3][3] = (iv[3][3] << 1) | (outBuffer[k/8] >> (7-(k&7))) & 1;
+                               }
+                       }
+               break;
+               default:
+                       return -1;
+               break;
+       }
+       
+       return 128 * numBlocks;
+}
+
+int Rijndael::padEncrypt(const uint8_t *input, int inputOctets, uint8_t *outBuffer)
+{
+       int i, numBlocks, padLen;
+       uint8_t block[16], *iv;
+
+       if(m_state != Valid)return RIJNDAEL_NOT_INITIALIZED;
+       if(m_direction != Encrypt)return RIJNDAEL_NOT_INITIALIZED;
+
+       if(input == 0 || inputOctets <= 0)return 0;
+
+       numBlocks = inputOctets/16;
+
+       switch(m_mode)
+       {
+               case ECB: 
+                       for(i = numBlocks; i > 0; i--)
+                       {
+                               encrypt(input, outBuffer);
+                               input += 16;
+                               outBuffer += 16;
+                       }
+                       padLen = 16 - (inputOctets - 16*numBlocks);
+//                     assert(padLen > 0 && padLen <= 16);
+                       memcpy(block, input, 16 - padLen);
+                       memset(block + 16 - padLen, padLen, padLen);
+                       encrypt(block,outBuffer);
+               break;
+               case CBC:
+                       iv = m_initVector;
+                       for(i = numBlocks; i > 0; i--)
+                       {
+                               ((uint32_t*)block)[0] = ((uint32_t*)input)[0] ^ ((uint32_t*)iv)[0];
+                               ((uint32_t*)block)[1] = ((uint32_t*)input)[1] ^ ((uint32_t*)iv)[1];
+                               ((uint32_t*)block)[2] = ((uint32_t*)input)[2] ^ ((uint32_t*)iv)[2];
+                               ((uint32_t*)block)[3] = ((uint32_t*)input)[3] ^ ((uint32_t*)iv)[3];
+                               encrypt(block, outBuffer);
+                               iv = outBuffer;
+                               input += 16;
+                               outBuffer += 16;
+                       }
+                       padLen = 16 - (inputOctets - 16*numBlocks);
+//                     assert(padLen > 0 && padLen <= 16); // DO SOMETHING HERE ?
+                       for (i = 0; i < 16 - padLen; i++) {
+                               block[i] = input[i] ^ iv[i];
+                       }
+                       for (i = 16 - padLen; i < 16; i++) {
+                               block[i] = (uint8_t)padLen ^ iv[i];
+                       }
+                       encrypt(block,outBuffer);
+               break;
+               default:
+                       return -1;
+               break;
+       }
+       
+       return 16*(numBlocks + 1);
+}
+       
+int Rijndael::blockDecrypt(const uint8_t *input, int inputLen, uint8_t *outBuffer)
+{
+       int i, k, numBlocks;
+       uint8_t block[16], iv[4][4];
+
+       if(m_state != Valid)return RIJNDAEL_NOT_INITIALIZED;
+       if((m_mode != CFB1) && (m_direction == Encrypt))return RIJNDAEL_BAD_DIRECTION;
+
+       if (input == 0 || inputLen <= 0)return 0;
+
+       numBlocks = inputLen/128;
+
+       switch(m_mode)
+       {
+               case ECB: 
+                       for (i = numBlocks; i > 0; i--)
+                       {
+                               decrypt(input,outBuffer);
+                               input += 16;
+                               outBuffer += 16;
+                       }
+               break;
+               case CBC:
+#if STRICT_ALIGN 
+                       memcpy(iv,m_initVector,16); 
+#else
+                       *((uint32_t*)iv[0]) = *((uint32_t*)(m_initVector  ));
+                       *((uint32_t*)iv[1]) = *((uint32_t*)(m_initVector+ 4));
+                       *((uint32_t*)iv[2]) = *((uint32_t*)(m_initVector+ 8));
+                       *((uint32_t*)iv[3]) = *((uint32_t*)(m_initVector+12));
+#endif
+                       for (i = numBlocks; i > 0; i--)
+                       {
+                               decrypt(input, block);
+                               ((uint32_t*)block)[0] ^= *((uint32_t*)iv[0]);
+                               ((uint32_t*)block)[1] ^= *((uint32_t*)iv[1]);
+                               ((uint32_t*)block)[2] ^= *((uint32_t*)iv[2]);
+                               ((uint32_t*)block)[3] ^= *((uint32_t*)iv[3]);
+#if STRICT_ALIGN
+                               memcpy(iv, input, 16);
+                               memcpy(outBuf, block, 16);
+#else
+                               *((uint32_t*)iv[0]) = ((uint32_t*)input)[0]; ((uint32_t*)outBuffer)[0] = ((uint32_t*)block)[0];
+                               *((uint32_t*)iv[1]) = ((uint32_t*)input)[1]; ((uint32_t*)outBuffer)[1] = ((uint32_t*)block)[1];
+                               *((uint32_t*)iv[2]) = ((uint32_t*)input)[2]; ((uint32_t*)outBuffer)[2] = ((uint32_t*)block)[2];
+                               *((uint32_t*)iv[3]) = ((uint32_t*)input)[3]; ((uint32_t*)outBuffer)[3] = ((uint32_t*)block)[3];
+#endif
+                               input += 16;
+                               outBuffer += 16;
+                       }
+                       break;
+               case CFB1:
+#if STRICT_ALIGN 
+                       memcpy(iv, m_initVector, 16); 
+#else
+                       *((uint32_t*)iv[0]) = *((uint32_t*)(m_initVector));
+                       *((uint32_t*)iv[1]) = *((uint32_t*)(m_initVector+ 4));
+                       *((uint32_t*)iv[2]) = *((uint32_t*)(m_initVector+ 8));
+                       *((uint32_t*)iv[3]) = *((uint32_t*)(m_initVector+12));
+#endif
+                       for(i = numBlocks; i > 0; i--)
+                       {
+                               for(k = 0; k < 128; k++)
+                               {
+                                       *((uint32_t*) block    ) = *((uint32_t*)iv[0]);
+                                       *((uint32_t*)(block+ 4)) = *((uint32_t*)iv[1]);
+                                       *((uint32_t*)(block+ 8)) = *((uint32_t*)iv[2]);
+                                       *((uint32_t*)(block+12)) = *((uint32_t*)iv[3]);
+                                       encrypt(block, block);
+                                       iv[0][0] = (iv[0][0] << 1) | (iv[0][1] >> 7);
+                                       iv[0][1] = (iv[0][1] << 1) | (iv[0][2] >> 7);
+                                       iv[0][2] = (iv[0][2] << 1) | (iv[0][3] >> 7);
+                                       iv[0][3] = (iv[0][3] << 1) | (iv[1][0] >> 7);
+                                       iv[1][0] = (iv[1][0] << 1) | (iv[1][1] >> 7);
+                                       iv[1][1] = (iv[1][1] << 1) | (iv[1][2] >> 7);
+                                       iv[1][2] = (iv[1][2] << 1) | (iv[1][3] >> 7);
+                                       iv[1][3] = (iv[1][3] << 1) | (iv[2][0] >> 7);
+                                       iv[2][0] = (iv[2][0] << 1) | (iv[2][1] >> 7);
+                                       iv[2][1] = (iv[2][1] << 1) | (iv[2][2] >> 7);
+                                       iv[2][2] = (iv[2][2] << 1) | (iv[2][3] >> 7);
+                                       iv[2][3] = (iv[2][3] << 1) | (iv[3][0] >> 7);
+                                       iv[3][0] = (iv[3][0] << 1) | (iv[3][1] >> 7);
+                                       iv[3][1] = (iv[3][1] << 1) | (iv[3][2] >> 7);
+                                       iv[3][2] = (iv[3][2] << 1) | (iv[3][3] >> 7);
+                                       iv[3][3] = (iv[3][3] << 1) | (input[k/8] >> (7-(k&7))) & 1;
+                                       outBuffer[k/8] ^= (block[0] & 0x80) >> (k & 7);
+                               }
+                       }
+               break;
+               default:
+                       return -1;
+               break;
+       }
+       
+       return 128*numBlocks;
+}
+
+int Rijndael::padDecrypt(const uint8_t *input, int inputOctets, uint8_t *outBuffer)
+{
+       int i, numBlocks, padLen;
+       uint8_t block[16];
+       uint32_t iv[4];
+
+       if(m_state != Valid)return RIJNDAEL_NOT_INITIALIZED;
+       if(m_direction != Decrypt)return RIJNDAEL_BAD_DIRECTION;
+
+       if(input == 0 || inputOctets <= 0)return 0;
+
+       if((inputOctets % 16) != 0)return RIJNDAEL_CORRUPTED_DATA;
+
+       numBlocks = inputOctets/16;
+
+       switch(m_mode){
+               case ECB:
+                       for (i = numBlocks - 1; i > 0; i--)
+                       {
+                               decrypt(input, outBuffer);
+                               input += 16;
+                               outBuffer += 16;
+                       }
+
+                       decrypt(input, block);
+                       padLen = block[15];
+                       if (padLen >= 16)return RIJNDAEL_CORRUPTED_DATA;
+                       for(i = 16 - padLen; i < 16; i++)
+                       {
+                               if(block[i] != padLen)return RIJNDAEL_CORRUPTED_DATA;
+                       }
+                       memcpy(outBuffer, block, 16 - padLen);
+               break;  
+               case CBC:
+                       memcpy(iv, m_initVector, 16);
+                       /* all blocks but last */
+                       for (i = numBlocks - 1; i > 0; i--)
+                       {
+                               decrypt(input, block);
+                               ((uint32_t*)block)[0] ^= iv[0];
+                               ((uint32_t*)block)[1] ^= iv[1];
+                               ((uint32_t*)block)[2] ^= iv[2];
+                               ((uint32_t*)block)[3] ^= iv[3];
+                               memcpy(iv, input, 16);
+                               memcpy(outBuffer, block, 16);
+                               input += 16;
+                               outBuffer += 16;
+                       }
+                       /* last block */
+                       decrypt(input, block);
+                       ((uint32_t*)block)[0] ^= iv[0];
+                       ((uint32_t*)block)[1] ^= iv[1];
+                       ((uint32_t*)block)[2] ^= iv[2];
+                       ((uint32_t*)block)[3] ^= iv[3];
+                       padLen = block[15];
+                       if(padLen <= 0 || padLen > 16)return RIJNDAEL_CORRUPTED_DATA;
+                       for(i = 16 - padLen; i < 16; i++)
+                       {
+                               if(block[i] != padLen)return RIJNDAEL_CORRUPTED_DATA;
+                       }
+                       memcpy(outBuffer, block, 16 - padLen);
+                       break;
+               
+               default:
+                       return -1;
+               break;
+       }
+       
+       return 16*numBlocks - padLen;
+}
+
+//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+// ALGORITHM
+//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+
+void Rijndael::keySched(uint8_t key[_MAX_KEY_COLUMNS][4])
+{
+       unsigned j,rconpointer = 0;
+
+       // Calculate the necessary round keys
+       // The number of calculations depends on keyBits and blockBits
+       unsigned uKeyColumns = m_uRounds - 6;
+
+       uint8_t tempKey[_MAX_KEY_COLUMNS][4];
+
+       // Copy the input key to the temporary key matrix
+
+       for(j = 0;j < uKeyColumns;j++)
+       {
+               *((uint32_t*)(tempKey[j])) = *((uint32_t*)(key[j]));
+       }
+
+       unsigned r = 0;
+       unsigned t = 0;
+
+       // copy values into round key array
+       for(j = 0;(j < uKeyColumns) && (r <= m_uRounds); )
+       {
+               for(;(j < uKeyColumns) && (t < 4); j++, t++)
+               {
+                       *((uint32_t*)m_expandedKey[r][t]) = *((uint32_t*)tempKey[j]);
+               }
+
+
+               if(t == 4)
+               {
+                       r++;
+                       t = 0;
+               }
+       }
+               
+       while(r <= m_uRounds)
+       {
+               tempKey[0][0] ^= S[tempKey[uKeyColumns-1][1]];
+               tempKey[0][1] ^= S[tempKey[uKeyColumns-1][2]];
+               tempKey[0][2] ^= S[tempKey[uKeyColumns-1][3]];
+               tempKey[0][3] ^= S[tempKey[uKeyColumns-1][0]];
+               tempKey[0][0] ^= rcon[rconpointer++];
+
+               if (uKeyColumns != 8)
+               {
+                       for(j = 1; j < uKeyColumns; j++)
+                       {
+                               *((uint32_t*)tempKey[j]) ^= *((uint32_t*)tempKey[j-1]);
+                       }
+               } else {
+                       for(j = 1; j < uKeyColumns/2; j++)
+                       {
+                               *((uint32_t*)tempKey[j]) ^= *((uint32_t*)tempKey[j-1]);
+                       }
+                       tempKey[uKeyColumns/2][0] ^= S[tempKey[uKeyColumns/2 - 1][0]];
+                       tempKey[uKeyColumns/2][1] ^= S[tempKey[uKeyColumns/2 - 1][1]];
+                       tempKey[uKeyColumns/2][2] ^= S[tempKey[uKeyColumns/2 - 1][2]];
+                       tempKey[uKeyColumns/2][3] ^= S[tempKey[uKeyColumns/2 - 1][3]];
+                       for(j = uKeyColumns/2 + 1; j < uKeyColumns; j++)
+                       {
+                               *((uint32_t*)tempKey[j]) ^= *((uint32_t*)tempKey[j-1]);
+                       }
+               }
+               for(j = 0; (j < uKeyColumns) && (r <= m_uRounds); )
+               {
+                       for(; (j < uKeyColumns) && (t < 4); j++, t++)
+                       {
+                               *((uint32_t*)m_expandedKey[r][t]) = *((uint32_t*)tempKey[j]);
+                       }
+                       if(t == 4)
+                       {
+                               r++;
+                               t = 0;
+                       }
+               }
+       }               
+}
+
+void Rijndael::keyEncToDec()
+{
+       unsigned r;
+       uint8_t *w;
+
+       for(r = 1; r < m_uRounds; r++)
+       {
+               w = m_expandedKey[r][0];
+               *((uint32_t*)w) = *((uint32_t*)U1[w[0]]) ^ *((uint32_t*)U2[w[1]]) ^ *((uint32_t*)U3[w[2]]) ^ *((uint32_t*)U4[w[3]]);
+               w = m_expandedKey[r][1];
+               *((uint32_t*)w) = *((uint32_t*)U1[w[0]]) ^ *((uint32_t*)U2[w[1]]) ^ *((uint32_t*)U3[w[2]]) ^ *((uint32_t*)U4[w[3]]);
+               w = m_expandedKey[r][2];
+               *((uint32_t*)w) = *((uint32_t*)U1[w[0]]) ^ *((uint32_t*)U2[w[1]]) ^ *((uint32_t*)U3[w[2]]) ^ *((uint32_t*)U4[w[3]]);
+               w = m_expandedKey[r][3];
+               *((uint32_t*)w) = *((uint32_t*)U1[w[0]]) ^ *((uint32_t*)U2[w[1]]) ^ *((uint32_t*)U3[w[2]]) ^ *((uint32_t*)U4[w[3]]);
+       }
+}      
+
+void Rijndael::encrypt(const uint8_t a[16], uint8_t b[16])
+{
+       unsigned r;
+       uint8_t temp[4][4];
+
+    *((uint32_t*)temp[0]) = *((uint32_t*)(a   )) ^ *((uint32_t*)m_expandedKey[0][0]);
+    *((uint32_t*)temp[1]) = *((uint32_t*)(a+ 4)) ^ *((uint32_t*)m_expandedKey[0][1]);
+    *((uint32_t*)temp[2]) = *((uint32_t*)(a+ 8)) ^ *((uint32_t*)m_expandedKey[0][2]);
+    *((uint32_t*)temp[3]) = *((uint32_t*)(a+12)) ^ *((uint32_t*)m_expandedKey[0][3]);
+    *((uint32_t*)(b    )) = *((uint32_t*)T1[temp[0][0]])
+                                               ^ *((uint32_t*)T2[temp[1][1]])
+                                               ^ *((uint32_t*)T3[temp[2][2]]) 
+                                               ^ *((uint32_t*)T4[temp[3][3]]);
+    *((uint32_t*)(b + 4)) = *((uint32_t*)T1[temp[1][0]])
+                                               ^ *((uint32_t*)T2[temp[2][1]])
+                                               ^ *((uint32_t*)T3[temp[3][2]]) 
+                                               ^ *((uint32_t*)T4[temp[0][3]]);
+    *((uint32_t*)(b + 8)) = *((uint32_t*)T1[temp[2][0]])
+                                               ^ *((uint32_t*)T2[temp[3][1]])
+                                               ^ *((uint32_t*)T3[temp[0][2]]) 
+                                               ^ *((uint32_t*)T4[temp[1][3]]);
+    *((uint32_t*)(b +12)) = *((uint32_t*)T1[temp[3][0]])
+                                               ^ *((uint32_t*)T2[temp[0][1]])
+                                               ^ *((uint32_t*)T3[temp[1][2]]) 
+                                               ^ *((uint32_t*)T4[temp[2][3]]);
+       for(r = 1; r < m_uRounds-1; r++)
+       {
+               *((uint32_t*)temp[0]) = *((uint32_t*)(b   )) ^ *((uint32_t*)m_expandedKey[r][0]);
+               *((uint32_t*)temp[1]) = *((uint32_t*)(b+ 4)) ^ *((uint32_t*)m_expandedKey[r][1]);
+               *((uint32_t*)temp[2]) = *((uint32_t*)(b+ 8)) ^ *((uint32_t*)m_expandedKey[r][2]);
+               *((uint32_t*)temp[3]) = *((uint32_t*)(b+12)) ^ *((uint32_t*)m_expandedKey[r][3]);
+
+               *((uint32_t*)(b    )) = *((uint32_t*)T1[temp[0][0]])
+                                                       ^ *((uint32_t*)T2[temp[1][1]])
+                                                       ^ *((uint32_t*)T3[temp[2][2]]) 
+                                                       ^ *((uint32_t*)T4[temp[3][3]]);
+               *((uint32_t*)(b + 4)) = *((uint32_t*)T1[temp[1][0]])
+                                                       ^ *((uint32_t*)T2[temp[2][1]])
+                                                       ^ *((uint32_t*)T3[temp[3][2]]) 
+                                                       ^ *((uint32_t*)T4[temp[0][3]]);
+               *((uint32_t*)(b + 8)) = *((uint32_t*)T1[temp[2][0]])
+                                                       ^ *((uint32_t*)T2[temp[3][1]])
+                                                       ^ *((uint32_t*)T3[temp[0][2]]) 
+                                                       ^ *((uint32_t*)T4[temp[1][3]]);
+               *((uint32_t*)(b +12)) = *((uint32_t*)T1[temp[3][0]])
+                                                       ^ *((uint32_t*)T2[temp[0][1]])
+                                                       ^ *((uint32_t*)T3[temp[1][2]]) 
+                                                       ^ *((uint32_t*)T4[temp[2][3]]);
+       }
+       *((uint32_t*)temp[0]) = *((uint32_t*)(b   )) ^ *((uint32_t*)m_expandedKey[m_uRounds-1][0]);
+       *((uint32_t*)temp[1]) = *((uint32_t*)(b+ 4)) ^ *((uint32_t*)m_expandedKey[m_uRounds-1][1]);
+       *((uint32_t*)temp[2]) = *((uint32_t*)(b+ 8)) ^ *((uint32_t*)m_expandedKey[m_uRounds-1][2]);
+       *((uint32_t*)temp[3]) = *((uint32_t*)(b+12)) ^ *((uint32_t*)m_expandedKey[m_uRounds-1][3]);
+       b[ 0] = T1[temp[0][0]][1];
+       b[ 1] = T1[temp[1][1]][1];
+       b[ 2] = T1[temp[2][2]][1];
+       b[ 3] = T1[temp[3][3]][1];
+       b[ 4] = T1[temp[1][0]][1];
+       b[ 5] = T1[temp[2][1]][1];
+       b[ 6] = T1[temp[3][2]][1];
+       b[ 7] = T1[temp[0][3]][1];
+       b[ 8] = T1[temp[2][0]][1];
+       b[ 9] = T1[temp[3][1]][1];
+       b[10] = T1[temp[0][2]][1];
+       b[11] = T1[temp[1][3]][1];
+       b[12] = T1[temp[3][0]][1];
+       b[13] = T1[temp[0][1]][1];
+       b[14] = T1[temp[1][2]][1];
+       b[15] = T1[temp[2][3]][1];
+       *((uint32_t*)(b   )) ^= *((uint32_t*)m_expandedKey[m_uRounds][0]);
+       *((uint32_t*)(b+ 4)) ^= *((uint32_t*)m_expandedKey[m_uRounds][1]);
+       *((uint32_t*)(b+ 8)) ^= *((uint32_t*)m_expandedKey[m_uRounds][2]);
+       *((uint32_t*)(b+12)) ^= *((uint32_t*)m_expandedKey[m_uRounds][3]);
+}
+
+void Rijndael::decrypt(const uint8_t a[16], uint8_t b[16])
+{
+       int r;
+       uint8_t temp[4][4];
+       
+    *((uint32_t*)temp[0]) = *((uint32_t*)(a   )) ^ *((uint32_t*)m_expandedKey[m_uRounds][0]);
+    *((uint32_t*)temp[1]) = *((uint32_t*)(a+ 4)) ^ *((uint32_t*)m_expandedKey[m_uRounds][1]);
+    *((uint32_t*)temp[2]) = *((uint32_t*)(a+ 8)) ^ *((uint32_t*)m_expandedKey[m_uRounds][2]);
+    *((uint32_t*)temp[3]) = *((uint32_t*)(a+12)) ^ *((uint32_t*)m_expandedKey[m_uRounds][3]);
+
+    *((uint32_t*)(b   )) = *((uint32_t*)T5[temp[0][0]])
+           ^ *((uint32_t*)T6[temp[3][1]])
+           ^ *((uint32_t*)T7[temp[2][2]]) 
+           ^ *((uint32_t*)T8[temp[1][3]]);
+       *((uint32_t*)(b+ 4)) = *((uint32_t*)T5[temp[1][0]])
+           ^ *((uint32_t*)T6[temp[0][1]])
+           ^ *((uint32_t*)T7[temp[3][2]]) 
+           ^ *((uint32_t*)T8[temp[2][3]]);
+       *((uint32_t*)(b+ 8)) = *((uint32_t*)T5[temp[2][0]])
+           ^ *((uint32_t*)T6[temp[1][1]])
+           ^ *((uint32_t*)T7[temp[0][2]]) 
+           ^ *((uint32_t*)T8[temp[3][3]]);
+       *((uint32_t*)(b+12)) = *((uint32_t*)T5[temp[3][0]])
+           ^ *((uint32_t*)T6[temp[2][1]])
+           ^ *((uint32_t*)T7[temp[1][2]]) 
+           ^ *((uint32_t*)T8[temp[0][3]]);
+       for(r = m_uRounds-1; r > 1; r--)
+       {
+               *((uint32_t*)temp[0]) = *((uint32_t*)(b   )) ^ *((uint32_t*)m_expandedKey[r][0]);
+               *((uint32_t*)temp[1]) = *((uint32_t*)(b+ 4)) ^ *((uint32_t*)m_expandedKey[r][1]);
+               *((uint32_t*)temp[2]) = *((uint32_t*)(b+ 8)) ^ *((uint32_t*)m_expandedKey[r][2]);
+               *((uint32_t*)temp[3]) = *((uint32_t*)(b+12)) ^ *((uint32_t*)m_expandedKey[r][3]);
+               *((uint32_t*)(b   )) = *((uint32_t*)T5[temp[0][0]])
+           ^ *((uint32_t*)T6[temp[3][1]])
+           ^ *((uint32_t*)T7[temp[2][2]]) 
+           ^ *((uint32_t*)T8[temp[1][3]]);
+               *((uint32_t*)(b+ 4)) = *((uint32_t*)T5[temp[1][0]])
+           ^ *((uint32_t*)T6[temp[0][1]])
+           ^ *((uint32_t*)T7[temp[3][2]]) 
+           ^ *((uint32_t*)T8[temp[2][3]]);
+               *((uint32_t*)(b+ 8)) = *((uint32_t*)T5[temp[2][0]])
+           ^ *((uint32_t*)T6[temp[1][1]])
+           ^ *((uint32_t*)T7[temp[0][2]]) 
+           ^ *((uint32_t*)T8[temp[3][3]]);
+               *((uint32_t*)(b+12)) = *((uint32_t*)T5[temp[3][0]])
+           ^ *((uint32_t*)T6[temp[2][1]])
+           ^ *((uint32_t*)T7[temp[1][2]]) 
+           ^ *((uint32_t*)T8[temp[0][3]]);
+       }
+       *((uint32_t*)temp[0]) = *((uint32_t*)(b   )) ^ *((uint32_t*)m_expandedKey[1][0]);
+       *((uint32_t*)temp[1]) = *((uint32_t*)(b+ 4)) ^ *((uint32_t*)m_expandedKey[1][1]);
+       *((uint32_t*)temp[2]) = *((uint32_t*)(b+ 8)) ^ *((uint32_t*)m_expandedKey[1][2]);
+       *((uint32_t*)temp[3]) = *((uint32_t*)(b+12)) ^ *((uint32_t*)m_expandedKey[1][3]);
+       b[ 0] = S5[temp[0][0]];
+       b[ 1] = S5[temp[3][1]];
+       b[ 2] = S5[temp[2][2]];
+       b[ 3] = S5[temp[1][3]];
+       b[ 4] = S5[temp[1][0]];
+       b[ 5] = S5[temp[0][1]];
+       b[ 6] = S5[temp[3][2]];
+       b[ 7] = S5[temp[2][3]];
+       b[ 8] = S5[temp[2][0]];
+       b[ 9] = S5[temp[1][1]];
+       b[10] = S5[temp[0][2]];
+       b[11] = S5[temp[3][3]];
+       b[12] = S5[temp[3][0]];
+       b[13] = S5[temp[2][1]];
+       b[14] = S5[temp[1][2]];
+       b[15] = S5[temp[0][3]];
+       *((uint32_t*)(b   )) ^= *((uint32_t*)m_expandedKey[0][0]);
+       *((uint32_t*)(b+ 4)) ^= *((uint32_t*)m_expandedKey[0][1]);
+       *((uint32_t*)(b+ 8)) ^= *((uint32_t*)m_expandedKey[0][2]);
+       *((uint32_t*)(b+12)) ^= *((uint32_t*)m_expandedKey[0][3]);
+}
diff --git a/tools/elftosb/common/rijndael.h b/tools/elftosb/common/rijndael.h
new file mode 100644 (file)
index 0000000..79bb8ca
--- /dev/null
@@ -0,0 +1,159 @@
+#ifndef _RIJNDAEL_H_
+#define _RIJNDAEL_H_
+
+//
+// File : rijndael.h
+// Creation date : Sun Nov 5 2000 03:21:05 CEST
+// Author : Szymon Stefanek (stefanek@tin.it)
+//
+// Another implementation of the Rijndael cipher.
+// This is intended to be an easily usable library file.
+// This code is public domain.
+// Based on the Vincent Rijmen and K.U.Leuven implementation 2.4.
+//
+
+//
+// Original Copyright notice:
+//
+//    rijndael-alg-fst.c   v2.4   April '2000
+//    rijndael-alg-fst.h
+//    rijndael-api-fst.c
+//    rijndael-api-fst.h
+//
+//    Optimised ANSI C code
+//
+//    authors: v1.0: Antoon Bosselaers
+//             v2.0: Vincent Rijmen, K.U.Leuven
+//             v2.3: Paulo Barreto
+//             v2.4: Vincent Rijmen, K.U.Leuven
+//
+//    This code is placed in the public domain.
+//
+
+//
+// This implementation works on 128 , 192 , 256 bit keys
+// and on 128 bit blocks
+//
+
+//
+// Example of usage:
+//
+//  // Input data
+//  unsigned char key[32];                       // The key
+//  initializeYour256BitKey();                   // Obviously initialized with sth
+//  const unsigned char * plainText = getYourPlainText(); // Your plain text
+//  int plainTextLen = strlen(plainText);        // Plain text length
+//
+//  // Encrypting
+//  Rijndael rin;
+//  unsigned char output[plainTextLen + 16];
+//
+//  rin.init(Rijndael::CBC,Rijndael::Encrypt,key,Rijndael::Key32Bytes);
+//  // It is a good idea to check the error code
+//  int len = rin.padEncrypt(plainText,len,output);
+//  if(len >= 0)useYourEncryptedText();
+//  else encryptError(len);
+//
+//  // Decrypting: we can reuse the same object
+//  unsigned char output2[len];
+//  rin.init(Rijndael::CBC,Rijndael::Decrypt,key,Rijndael::Key32Bytes));
+//  len = rin.padDecrypt(output,len,output2);
+//  if(len >= 0)useYourDecryptedText();
+//  else decryptError(len);
+//
+
+#include "stdafx.h"
+
+#define _MAX_KEY_COLUMNS (256/32)
+#define _MAX_ROUNDS      14
+#define MAX_IV_SIZE      16
+
+// We assume that unsigned int is 32 bits long.... 
+//typedef unsigned char  uint8_t;
+//typedef unsigned int   uint32_t;
+//typedef unsigned short uint16_t;
+
+// Error codes
+#define RIJNDAEL_SUCCESS 0
+#define RIJNDAEL_UNSUPPORTED_MODE -1
+#define RIJNDAEL_UNSUPPORTED_DIRECTION -2
+#define RIJNDAEL_UNSUPPORTED_KEY_LENGTH -3
+#define RIJNDAEL_BAD_KEY -4
+#define RIJNDAEL_NOT_INITIALIZED -5
+#define RIJNDAEL_BAD_DIRECTION -6
+#define RIJNDAEL_CORRUPTED_DATA -7
+
+class Rijndael
+{      
+public:
+       enum Direction { Encrypt , Decrypt };
+       enum Mode { ECB , CBC , CFB1 };
+       enum KeyLength { Key16Bytes , Key24Bytes , Key32Bytes };
+       //
+       // Creates a Rijndael cipher object
+       // You have to call init() before you can encrypt or decrypt stuff
+       //
+       Rijndael();
+       ~Rijndael();
+protected:
+       // Internal stuff
+       enum State { Valid , Invalid };
+
+       State     m_state;
+       Mode      m_mode;
+       Direction m_direction;
+       uint8_t     m_initVector[MAX_IV_SIZE];
+       uint32_t    m_uRounds;
+       uint8_t     m_expandedKey[_MAX_ROUNDS+1][4][4];
+public:
+       //////////////////////////////////////////////////////////////////////////////////////////
+       // API
+       //////////////////////////////////////////////////////////////////////////////////////////
+
+       // init(): Initializes the crypt session
+       // Returns RIJNDAEL_SUCCESS or an error code
+       // mode      : Rijndael::ECB, Rijndael::CBC or Rijndael::CFB1
+       //             You have to use the same mode for encrypting and decrypting
+       // dir       : Rijndael::Encrypt or Rijndael::Decrypt
+       //             A cipher instance works only in one direction
+       //             (Well , it could be easily modified to work in both
+       //             directions with a single init() call, but it looks
+       //             useless to me...anyway , it is a matter of generating
+       //             two expanded keys)
+       // key       : array of unsigned octets , it can be 16 , 24 or 32 bytes long
+       //             this CAN be binary data (it is not expected to be null terminated)
+       // keyLen    : Rijndael::Key16Bytes , Rijndael::Key24Bytes or Rijndael::Key32Bytes
+       // initVector: initialization vector, you will usually use 0 here
+       int init(Mode mode,Direction dir,const uint8_t *key,KeyLength keyLen,uint8_t * initVector = 0);
+       // Encrypts the input array (can be binary data)
+       // The input array length must be a multiple of 16 bytes, the remaining part
+       // is DISCARDED.
+       // so it actually encrypts inputLen / 128 blocks of input and puts it in outBuffer
+       // Input len is in BITS!
+       // outBuffer must be at least inputLen / 8 bytes long.
+       // Returns the encrypted buffer length in BITS or an error code < 0 in case of error
+       int blockEncrypt(const uint8_t *input, int inputLen, uint8_t *outBuffer);
+       // Encrypts the input array (can be binary data)
+       // The input array can be any length , it is automatically padded on a 16 byte boundary.
+       // Input len is in BYTES!
+       // outBuffer must be at least (inputLen + 16) bytes long
+       // Returns the encrypted buffer length in BYTES or an error code < 0 in case of error
+       int padEncrypt(const uint8_t *input, int inputOctets, uint8_t *outBuffer);
+       // Decrypts the input vector
+       // Input len is in BITS!
+       // outBuffer must be at least inputLen / 8 bytes long
+       // Returns the decrypted buffer length in BITS and an error code < 0 in case of error
+       int blockDecrypt(const uint8_t *input, int inputLen, uint8_t *outBuffer);
+       // Decrypts the input vector
+       // Input len is in BYTES!
+       // outBuffer must be at least inputLen bytes long
+       // Returns the decrypted buffer length in BYTES and an error code < 0 in case of error
+       int padDecrypt(const uint8_t *input, int inputOctets, uint8_t *outBuffer);
+protected:
+       void keySched(uint8_t key[_MAX_KEY_COLUMNS][4]);
+       void keyEncToDec();
+       void encrypt(const uint8_t a[16], uint8_t b[16]);
+       void decrypt(const uint8_t a[16], uint8_t b[16]);
+};
+       
+#endif // _RIJNDAEL_H_
diff --git a/tools/elftosb/common/smart_ptr.h b/tools/elftosb/common/smart_ptr.h
new file mode 100644 (file)
index 0000000..dd02345
--- /dev/null
@@ -0,0 +1,232 @@
+/*
+ *  smart_ptr.h
+ *  elftosb
+ *
+ *  Created by Chris Reed on 4/18/06.
+ *  Copyright 2006 __MyCompanyName__. All rights reserved.
+ *
+ */
+#if !defined(_smart_ptr_h_)
+#define _smart_ptr_h_
+
+/*!
+ * \brief Simple, standard smart pointer class.
+ *
+ * This class only supports the single-owner paradigm.
+ */
+template <typename T>
+class smart_ptr
+{
+public:
+       typedef T data_type;
+       typedef T * ptr_type;
+       typedef const T * const_ptr_type;
+       typedef T & ref_type;
+       typedef const T & const_ref_type;
+       
+       //! Default constuctor. Initialises with no pointer set.
+       smart_ptr() : _p(0) {}
+       
+       //! This constructor takes a pointer to the object to be deleted.
+       smart_ptr(ptr_type p) : _p(p) {}
+       
+       //! Destructor. If an object (pointer) has been set, it will be deleted.
+       //! Deletes the object using safe_delete().
+       virtual ~smart_ptr() { safe_delete(); }
+       
+       //! Return the current pointer value.
+       ptr_type get() { return _p; }
+       
+       //! Return the const form of the current pointer value.
+       const_ptr_type get() const { return _p; }
+       
+       //! Change the pointer value, or set if if the default constructor was used.
+       //! If a pointer had previously been associated with the object, and \a p is
+       //! different than that previous pointer, it will be deleted before taking
+       //! ownership of \a p. If this is not desired, call reset() beforehand.
+       void set(ptr_type p)
+       {
+               if (_p && p != _p)
+               {
+                       safe_delete();
+               }
+               _p = p;
+       }
+       
+       //! Dissociates any previously set pointer value without deleting it.
+       void reset() { _p = 0; }
+       
+       //! Dissociates a previously set pointer value, deleting it at the same time.
+       void clear() { safe_delete(); }
+       
+       //! Forces immediate deletion of the object. If you are planning on using
+       //! this method, think about just using a normal pointer. It probably makes
+       //! more sense.
+       virtual void safe_delete()
+       {
+               if (_p)
+               {
+                       delete _p;
+                       _p = 0;
+               } 
+       }
+       
+       //! \name Operators
+       //@{
+       
+       //! Makes the object transparent as the template type.
+       operator ptr_type () { return _p; }
+       
+       //! Const version of the pointer operator.
+       operator const_ptr_type () const { return _p; }
+       
+       //! Makes the object transparent as a reference of the template type.
+       operator ref_type () { return *_p; }
+       
+       //! Const version of the reference operator.
+       operator const_ref_type () const { return *_p; }
+       
+       //! Returns a boolean indicating whether the object has a pointer set or not.
+       operator bool () const { return _p != 0; }
+       
+       //! To allow setting the pointer directly. Equivalent to a call to set().
+       smart_ptr<T> & operator = (const_ptr_type p)
+       {
+               set(const_cast<ptr_type>(p));
+               return *this;
+       }
+       
+       //! Another operator to allow you to treat the object just like a pointer.
+       ptr_type operator ->() { return _p; }
+       
+       //! Another operator to allow you to treat the object just like a pointer.
+       const_ptr_type operator ->() const { return _p; }
+       
+//     //! Pointer dereferencing operator.
+//     ref_type operator * () const { return *_p; }
+//     
+//     //! Const version of the pointer dereference operator.
+//     const_ref_type operator * () const { return *_p; }
+       
+       //@}
+
+protected:
+       ptr_type _p;    //!< The wrapped pointer.
+};
+
+/*!
+ * \brief Simple, standard smart pointer class that uses the array delete operator.
+ *
+ * This class only supports the single-owner paradigm.
+ *
+ * This is almost entirely a copy of smart_ptr since the final C++ specification
+ * does not allow template subclass members to access members  of the parent that
+ * do not depend on the template parameter.
+ */
+template <typename T>
+class smart_array_ptr
+{
+public:
+       typedef T data_type;
+       typedef T * ptr_type;
+       typedef const T * const_ptr_type;
+       typedef T & ref_type;
+       typedef const T & const_ref_type;
+       
+       //! Default constuctor. Initialises with no pointer set.
+       smart_array_ptr() : _p(0) {}
+       
+       //! This constructor takes a pointer to the object to be deleted.
+       smart_array_ptr(ptr_type p) : _p(p) {}
+       
+       //! Destructor. If an array has been set, it will be deleted.
+       //! Deletes the array using safe_delete().
+       virtual ~smart_array_ptr() { safe_delete(); }
+       
+       //! Return the current pointer value.
+       ptr_type get() { return _p; }
+       
+       //! Return the const form of the current pointer value.
+       const_ptr_type get() const { return _p; }
+       
+       //! Change the pointer value, or set if if the default constructor was used.
+       //! If a pointer had previously been associated with the object, and \a p is
+       //! different than that previous pointer, it will be deleted before taking
+       //! ownership of \a p. If this is not desired, call reset() beforehand.
+       void set(ptr_type p)
+       {
+               if (_p && p != _p)
+               {
+                       safe_delete();
+               }
+               _p = p;
+       }
+       
+       //! Dissociates any previously set pointer value without deleting it.
+       void reset() { _p = 0; }
+       
+       //! Dissociates a previously set pointer value, deleting it at the same time.
+       void clear() { safe_delete(); }
+       
+       //! Forces immediate deletion of the object. If you are planning on using
+       //! this method, think about just using a normal pointer. It probably makes
+       //! more sense.
+       virtual void safe_delete()
+       {
+               if (_p)
+               {
+                       delete [] _p;
+                       _p = 0;
+               } 
+       }
+       
+       //! \name Operators
+       //@{
+       
+       //! Makes the object transparent as the template type.
+       operator ptr_type () { return _p; }
+       
+       //! Const version of the pointer operator.
+       operator const_ptr_type () const { return _p; }
+       
+       //! Makes the object transparent as a reference of the template type.
+       operator ref_type () { return *_p; }
+       
+       //! Const version of the reference operator.
+       operator const_ref_type () const { return *_p; }
+       
+       //! Returns a boolean indicating whether the object has a pointer set or not.
+       operator bool () const { return _p != 0; }
+       
+       //! To allow setting the pointer directly. Equivalent to a call to set().
+       smart_array_ptr<T> & operator = (const_ptr_type p)
+       {
+               set(const_cast<ptr_type>(p));
+               return *this;
+       }
+       
+       //! Another operator to allow you to treat the object just like a pointer.
+       ptr_type operator ->() { return _p; }
+       
+       //! Another operator to allow you to treat the object just like a pointer.
+       const_ptr_type operator ->() const { return _p; }
+       
+       //! Indexing operator.
+       ref_type operator [] (unsigned index) { return _p[index]; }
+       
+       //! Indexing operator.
+       const_ref_type operator [] (unsigned index) const { return _p[index]; }
+       
+//     //! Pointer dereferencing operator.
+//     ref_type operator * () const { return *_p; }
+//     
+//     //! Const version of the pointer dereference operator.
+//     const_ref_type operator * () const { return *_p; }
+       
+       //@}
+
+protected:
+       ptr_type _p;    //!< The wrapped pointer.
+};
+
+#endif // _smart_ptr_h_
diff --git a/tools/elftosb/common/stdafx.cpp b/tools/elftosb/common/stdafx.cpp
new file mode 100644 (file)
index 0000000..9b7c4ac
--- /dev/null
@@ -0,0 +1,8 @@
+// stdafx.cpp : source file that includes just the standard includes
+// elftosb.pch will be the pre-compiled header
+// stdafx.obj will contain the pre-compiled type information
+
+#include "stdafx.h"
+
+// TODO: reference any additional headers you need in STDAFX.H
+// and not in this file
diff --git a/tools/elftosb/common/stdafx.h b/tools/elftosb/common/stdafx.h
new file mode 100644 (file)
index 0000000..e6bf9dd
--- /dev/null
@@ -0,0 +1,83 @@
+#ifndef stdafx_h_
+#define stdafx_h_
+
+// stdafx.h : include file for standard system include files,
+// or project specific include files that are used frequently, but
+// are changed infrequently
+//
+
+// Default to external release.
+#ifndef SGTL_INTERNAL
+    #define SGTL_INTERNAL 0
+#endif
+
+#include <iostream>
+#include <stdexcept>
+
+#if defined(WIN32)
+//#include <tchar.h>
+    
+    // define this macro for use in VC++
+    #if !defined(__LITTLE_ENDIAN__)
+        #define __LITTLE_ENDIAN__ 1
+    #endif // !defined(__LITTLE_ENDIAN__)
+#endif // defined(WIN32)
+
+#if defined(Linux)
+// For Linux systems only, types.h only defines the signed
+// integer types.  This is not professional code.
+// Update: They are defined in the header files in the more recent version of redhat enterprise gcc.
+#include "/usr/include/sys/types.h"
+#include <stdint.h>
+//typedef unsigned long uint32_t;
+//typedef unsigned short uint16_t;
+//typedef unsigned char uint8_t;
+
+//#define TCHAR char
+//#define _tmain main
+
+    // give a default endian in case one is not defined on Linux (it should be, though)
+    #if !defined(__LITTLE_ENDIAN__) && !defined(__BIG_ENDIAN__)
+        #define __LITTLE_ENDIAN__ 1
+    #endif // !defined(__LITTLE_ENDIAN__) && !defined(__BIG_ENDIAN__)
+
+#endif // defined(Linux)
+
+// gcc on Mac OS X
+#if defined(__GNUC__) && ( defined(__APPLE_CPP__) || defined(__APPLE_CC__) || defined(__MACOS_CLASSIC__) )
+       #include <TargetConditionals.h>
+       
+       #if defined(TARGET_RT_LITTLE_ENDIAN) && TARGET_RT_LITTLE_ENDIAN
+               #if !defined(__LITTLE_ENDIAN__)
+                       #define __LITTLE_ENDIAN__
+               #endif
+       #elif defined(TARGET_RT_BIG_ENDIAN) && TARGET_RT_BIG_ENDIAN
+               #if !defined(__BIG_ENDIAN__)
+                       #define __BIG_ENDIAN__
+               #endif
+       #endif
+#endif
+
+#if defined(WIN32) //!defined(Linux) || !defined(__GNUC__)
+// redefine missing typedefs from stdint.h or syst/types.h
+
+typedef unsigned long long uint64_t;
+typedef unsigned long uint32_t;
+typedef unsigned short uint16_t;
+typedef unsigned char uint8_t;
+
+typedef long long int64_t;
+typedef long int32_t;
+typedef short int16_t;
+typedef char int8_t;
+#endif // !defined(Linux)
+
+#if !defined(TRUE)
+    #define TRUE 1
+#endif // !defined(TRUE)
+
+#if !defined(FALSE)
+    #define FALSE 0
+#endif // !defined(FALSE)
+
+#endif // stdafx_h_
diff --git a/tools/elftosb/elftosb.ccscc b/tools/elftosb/elftosb.ccscc
new file mode 100644 (file)
index 0000000..a72c5bb
--- /dev/null
@@ -0,0 +1,7 @@
+..\elftosb\elftosb.vcproj\r
+..\unittests\unittests.vcproj\r
+..\generatekeys\generatekeys.vcproj\r
+..\decrypt\decrypt.vcproj\r
+..\elftosb2\elftosb2.vcproj\r
+..\sbtool\sbtool.vcproj\r
+..\keygen\keygen.vcproj\r
diff --git a/tools/elftosb/elftosb.xcodeproj/creed.mode1 b/tools/elftosb/elftosb.xcodeproj/creed.mode1
new file mode 100644 (file)
index 0000000..aac6f7a
--- /dev/null
@@ -0,0 +1,1527 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+       <key>ActivePerspectiveName</key>
+       <string>Project</string>
+       <key>AllowedModules</key>
+       <array>
+               <dict>
+                       <key>BundleLoadPath</key>
+                       <string></string>
+                       <key>MaxInstances</key>
+                       <string>n</string>
+                       <key>Module</key>
+                       <string>PBXSmartGroupTreeModule</string>
+                       <key>Name</key>
+                       <string>Groups and Files Outline View</string>
+               </dict>
+               <dict>
+                       <key>BundleLoadPath</key>
+                       <string></string>
+                       <key>MaxInstances</key>
+                       <string>n</string>
+                       <key>Module</key>
+                       <string>PBXNavigatorGroup</string>
+                       <key>Name</key>
+                       <string>Editor</string>
+               </dict>
+               <dict>
+                       <key>BundleLoadPath</key>
+                       <string></string>
+                       <key>MaxInstances</key>
+                       <string>n</string>
+                       <key>Module</key>
+                       <string>XCTaskListModule</string>
+                       <key>Name</key>
+                       <string>Task List</string>
+               </dict>
+               <dict>
+                       <key>BundleLoadPath</key>
+                       <string></string>
+                       <key>MaxInstances</key>
+                       <string>n</string>
+                       <key>Module</key>
+                       <string>XCDetailModule</string>
+                       <key>Name</key>
+                       <string>File and Smart Group Detail Viewer</string>
+               </dict>
+               <dict>
+                       <key>BundleLoadPath</key>
+                       <string></string>
+                       <key>MaxInstances</key>
+                       <string>1</string>
+                       <key>Module</key>
+                       <string>PBXBuildResultsModule</string>
+                       <key>Name</key>
+                       <string>Detailed Build Results Viewer</string>
+               </dict>
+               <dict>
+                       <key>BundleLoadPath</key>
+                       <string></string>
+                       <key>MaxInstances</key>
+                       <string>1</string>
+                       <key>Module</key>
+                       <string>PBXProjectFindModule</string>
+                       <key>Name</key>
+                       <string>Project Batch Find Tool</string>
+               </dict>
+               <dict>
+                       <key>BundleLoadPath</key>
+                       <string></string>
+                       <key>MaxInstances</key>
+                       <string>n</string>
+                       <key>Module</key>
+                       <string>PBXRunSessionModule</string>
+                       <key>Name</key>
+                       <string>Run Log</string>
+               </dict>
+               <dict>
+                       <key>BundleLoadPath</key>
+                       <string></string>
+                       <key>MaxInstances</key>
+                       <string>n</string>
+                       <key>Module</key>
+                       <string>PBXBookmarksModule</string>
+                       <key>Name</key>
+                       <string>Bookmarks Tool</string>
+               </dict>
+               <dict>
+                       <key>BundleLoadPath</key>
+                       <string></string>
+                       <key>MaxInstances</key>
+                       <string>n</string>
+                       <key>Module</key>
+                       <string>PBXClassBrowserModule</string>
+                       <key>Name</key>
+                       <string>Class Browser</string>
+               </dict>
+               <dict>
+                       <key>BundleLoadPath</key>
+                       <string></string>
+                       <key>MaxInstances</key>
+                       <string>n</string>
+                       <key>Module</key>
+                       <string>PBXCVSModule</string>
+                       <key>Name</key>
+                       <string>Source Code Control Tool</string>
+               </dict>
+               <dict>
+                       <key>BundleLoadPath</key>
+                       <string></string>
+                       <key>MaxInstances</key>
+                       <string>n</string>
+                       <key>Module</key>
+                       <string>PBXDebugBreakpointsModule</string>
+                       <key>Name</key>
+                       <string>Debug Breakpoints Tool</string>
+               </dict>
+               <dict>
+                       <key>BundleLoadPath</key>
+                       <string></string>
+                       <key>MaxInstances</key>
+                       <string>n</string>
+                       <key>Module</key>
+                       <string>XCDockableInspector</string>
+                       <key>Name</key>
+                       <string>Inspector</string>
+               </dict>
+               <dict>
+                       <key>BundleLoadPath</key>
+                       <string></string>
+                       <key>MaxInstances</key>
+                       <string>n</string>
+                       <key>Module</key>
+                       <string>PBXOpenQuicklyModule</string>
+                       <key>Name</key>
+                       <string>Open Quickly Tool</string>
+               </dict>
+               <dict>
+                       <key>BundleLoadPath</key>
+                       <string></string>
+                       <key>MaxInstances</key>
+                       <string>1</string>
+                       <key>Module</key>
+                       <string>PBXDebugSessionModule</string>
+                       <key>Name</key>
+                       <string>Debugger</string>
+               </dict>
+               <dict>
+                       <key>BundleLoadPath</key>
+                       <string></string>
+                       <key>MaxInstances</key>
+                       <string>1</string>
+                       <key>Module</key>
+                       <string>PBXDebugCLIModule</string>
+                       <key>Name</key>
+                       <string>Debug Console</string>
+               </dict>
+       </array>
+       <key>Description</key>
+       <string>DefaultDescriptionKey</string>
+       <key>DockingSystemVisible</key>
+       <false/>
+       <key>Extension</key>
+       <string>mode1</string>
+       <key>FavBarConfig</key>
+       <dict>
+               <key>PBXProjectModuleGUID</key>
+               <string>0246B7EF09C375FC009A0CA3</string>
+               <key>XCBarModuleItemNames</key>
+               <dict/>
+               <key>XCBarModuleItems</key>
+               <array/>
+       </dict>
+       <key>FirstTimeWindowDisplayed</key>
+       <false/>
+       <key>Identifier</key>
+       <string>com.apple.perspectives.project.mode1</string>
+       <key>MajorVersion</key>
+       <integer>31</integer>
+       <key>MinorVersion</key>
+       <integer>1</integer>
+       <key>Name</key>
+       <string>Default</string>
+       <key>Notifications</key>
+       <array>
+               <dict>
+                       <key>XCObserverAutoDisconnectKey</key>
+                       <true/>
+                       <key>XCObserverDefintionKey</key>
+                       <dict/>
+                       <key>XCObserverFactoryKey</key>
+                       <string>XCPerspectivesSpecificationIdentifier</string>
+                       <key>XCObserverGUIDKey</key>
+                       <string>XCObserverProjectIdentifier</string>
+                       <key>XCObserverNotificationKey</key>
+                       <string>PBXStatusBuildStateMessageNotification</string>
+                       <key>XCObserverTargetKey</key>
+                       <string>XCMainBuildResultsModuleGUID</string>
+                       <key>XCObserverTriggerKey</key>
+                       <string>awakenModuleWithObserver:</string>
+                       <key>XCObserverValidationKey</key>
+                       <dict/>
+               </dict>
+       </array>
+       <key>OpenEditors</key>
+       <array/>
+       <key>PerspectiveWidths</key>
+       <array>
+               <integer>-1</integer>
+               <integer>-1</integer>
+       </array>
+       <key>Perspectives</key>
+       <array>
+               <dict>
+                       <key>ChosenToolbarItems</key>
+                       <array>
+                               <string>active-target-popup</string>
+                               <string>active-buildstyle-popup</string>
+                               <string>action</string>
+                               <string>NSToolbarFlexibleSpaceItem</string>
+                               <string>buildOrClean</string>
+                               <string>build-and-runOrDebug</string>
+                               <string>com.apple.ide.PBXToolbarStopButton</string>
+                               <string>show-inspector</string>
+                               <string>get-info</string>
+                               <string>toggle-editor</string>
+                               <string>NSToolbarFlexibleSpaceItem</string>
+                               <string>com.apple.pbx.toolbar.searchfield</string>
+                       </array>
+                       <key>ControllerClassBaseName</key>
+                       <string></string>
+                       <key>IconName</key>
+                       <string>WindowOfProjectWithEditor</string>
+                       <key>Identifier</key>
+                       <string>perspective.project</string>
+                       <key>IsVertical</key>
+                       <false/>
+                       <key>Layout</key>
+                       <array>
+                               <dict>
+                                       <key>ContentConfiguration</key>
+                                       <dict>
+                                               <key>PBXBottomSmartGroupGIDs</key>
+                                               <array>
+                                                       <string>1C37FBAC04509CD000000102</string>
+                                                       <string>1C37FAAC04509CD000000102</string>
+                                                       <string>1C08E77C0454961000C914BD</string>
+                                                       <string>1C37FABC05509CD000000102</string>
+                                                       <string>1C37FABC05539CD112110102</string>
+                                                       <string>E2644B35053B69B200211256</string>
+                                                       <string>1C37FABC04509CD000100104</string>
+                                                       <string>1CC0EA4004350EF90044410B</string>
+                                                       <string>1CC0EA4004350EF90041110B</string>
+                                               </array>
+                                               <key>PBXProjectModuleGUID</key>
+                                               <string>1CE0B1FE06471DED0097A5F4</string>
+                                               <key>PBXProjectModuleLabel</key>
+                                               <string>Files</string>
+                                               <key>PBXProjectStructureProvided</key>
+                                               <string>yes</string>
+                                               <key>PBXSmartGroupTreeModuleColumnData</key>
+                                               <dict>
+                                                       <key>PBXSmartGroupTreeModuleColumnWidthsKey</key>
+                                                       <array>
+                                                               <real>22</real>
+                                                               <real>22</real>
+                                                               <real>260</real>
+                                                       </array>
+                                                       <key>PBXSmartGroupTreeModuleColumnsKey_v4</key>
+                                                       <array>
+                                                               <string>TargetStatusColumn</string>
+                                                               <string>SCMStatusColumn</string>
+                                                               <string>MainColumn</string>
+                                                       </array>
+                                               </dict>
+                                               <key>PBXSmartGroupTreeModuleOutlineStateKey_v7</key>
+                                               <dict>
+                                                       <key>PBXSmartGroupTreeModuleOutlineStateExpansionKey</key>
+                                                       <array>
+                                                               <string>08FB7794FE84155DC02AAC07</string>
+                                                               <string>02FE65020BFE669B004A1450</string>
+                                                               <string>08FB7795FE84155DC02AAC07</string>
+                                                               <string>0296A45909D9AE9400F80AFF</string>
+                                                               <string>020D47700A1691F10027E24E</string>
+                                                               <string>1C37FBAC04509CD000000102</string>
+                                                               <string>1C37FAAC04509CD000000102</string>
+                                                       </array>
+                                                       <key>PBXSmartGroupTreeModuleOutlineStateSelectionKey</key>
+                                                       <array>
+                                                               <array>
+                                                                       <integer>2</integer>
+                                                                       <integer>0</integer>
+                                                               </array>
+                                                       </array>
+                                                       <key>PBXSmartGroupTreeModuleOutlineStateVisibleRectKey</key>
+                                                       <string>{{0, 0}, {304, 786}}</string>
+                                               </dict>
+                                               <key>PBXTopSmartGroupGIDs</key>
+                                               <array/>
+                                               <key>XCIncludePerspectivesSwitch</key>
+                                               <true/>
+                                               <key>XCSharingToken</key>
+                                               <string>com.apple.Xcode.GFSharingToken</string>
+                                       </dict>
+                                       <key>GeometryConfiguration</key>
+                                       <dict>
+                                               <key>Frame</key>
+                                               <string>{{0, 0}, {321, 804}}</string>
+                                               <key>GroupTreeTableConfiguration</key>
+                                               <array>
+                                                       <string>TargetStatusColumn</string>
+                                                       <real>22</real>
+                                                       <string>SCMStatusColumn</string>
+                                                       <real>22</real>
+                                                       <string>MainColumn</string>
+                                                       <real>260</real>
+                                               </array>
+                                               <key>RubberWindowFrame</key>
+                                               <string>8 33 1079 845 0 0 1440 878 </string>
+                                       </dict>
+                                       <key>Module</key>
+                                       <string>PBXSmartGroupTreeModule</string>
+                                       <key>Proportion</key>
+                                       <string>321pt</string>
+                               </dict>
+                               <dict>
+                                       <key>Dock</key>
+                                       <array>
+                                               <dict>
+                                                       <key>BecomeActive</key>
+                                                       <true/>
+                                                       <key>ContentConfiguration</key>
+                                                       <dict>
+                                                               <key>PBXProjectModuleGUID</key>
+                                                               <string>1CE0B20306471E060097A5F4</string>
+                                                               <key>PBXProjectModuleLabel</key>
+                                                               <string>elftosb.cpp</string>
+                                                               <key>PBXSplitModuleInNavigatorKey</key>
+                                                               <dict>
+                                                                       <key>Split0</key>
+                                                                       <dict>
+                                                                               <key>PBXProjectModuleGUID</key>
+                                                                               <string>1CE0B20406471E060097A5F4</string>
+                                                                               <key>PBXProjectModuleLabel</key>
+                                                                               <string>elftosb.cpp</string>
+                                                                               <key>_historyCapacity</key>
+                                                                               <integer>0</integer>
+                                                                               <key>bookmark</key>
+                                                                               <string>0292B61F0CDA9CFD00A3A500</string>
+                                                                               <key>history</key>
+                                                                               <array>
+                                                                                       <string>02DC60CD0A87DBB90027E7F9</string>
+                                                                                       <string>021CA4400A8D2F740028326F</string>
+                                                                                       <string>021CA4420A8D2F740028326F</string>
+                                                                                       <string>021CA4480A8D2F740028326F</string>
+                                                                                       <string>02C5DBD20A926A7F003B9C11</string>
+                                                                                       <string>02C5DBDA0A926A7F003B9C11</string>
+                                                                                       <string>02C5DBDB0A926A7F003B9C11</string>
+                                                                                       <string>02C5DC310A93C14E003B9C11</string>
+                                                                                       <string>02C5DC330A93C14E003B9C11</string>
+                                                                                       <string>02C5DC350A93C14E003B9C11</string>
+                                                                                       <string>02C5DC5B0A93C796003B9C11</string>
+                                                                                       <string>02C5DCB50A93CA0A003B9C11</string>
+                                                                                       <string>02C5DCB60A93CA0A003B9C11</string>
+                                                                                       <string>02C5DD520A93D327003B9C11</string>
+                                                                                       <string>02C5DDCD0A940126003B9C11</string>
+                                                                                       <string>02C5DDCF0A940126003B9C11</string>
+                                                                                       <string>02C5DDD00A940126003B9C11</string>
+                                                                                       <string>02C5DE8D0A98B7E7003B9C11</string>
+                                                                                       <string>02CAC9B90BA06EA50020B29B</string>
+                                                                                       <string>02CAC9BA0BA06EA50020B29B</string>
+                                                                                       <string>02D1FD190BD039BF007C7450</string>
+                                                                                       <string>02D1FE2B0BD1505E007C7450</string>
+                                                                                       <string>02D1FE2E0BD1505E007C7450</string>
+                                                                                       <string>02D1FE300BD1505E007C7450</string>
+                                                                                       <string>02D1FE310BD1505E007C7450</string>
+                                                                                       <string>027EE3C30BD6930A00A6A136</string>
+                                                                                       <string>027EE3C40BD6930A00A6A136</string>
+                                                                                       <string>027EE3C50BD6930A00A6A136</string>
+                                                                                       <string>027EE3C60BD6930A00A6A136</string>
+                                                                                       <string>027EE3C70BD6930A00A6A136</string>
+                                                                                       <string>027EE3C80BD6930A00A6A136</string>
+                                                                                       <string>027EE3CE0BD6930A00A6A136</string>
+                                                                                       <string>027EE3D30BD6930A00A6A136</string>
+                                                                                       <string>027EE3D40BD6930A00A6A136</string>
+                                                                                       <string>02FE651B0BFF94B2004A1450</string>
+                                                                                       <string>02FE65200BFF94B2004A1450</string>
+                                                                                       <string>02FE65220BFF94B2004A1450</string>
+                                                                                       <string>02FE656E0C0521EA004A1450</string>
+                                                                                       <string>02FE656F0C0521EA004A1450</string>
+                                                                                       <string>02FE65710C0521EA004A1450</string>
+                                                                                       <string>02FE65730C0521EA004A1450</string>
+                                                                                       <string>02E535CF0C24641A00CBD4A5</string>
+                                                                                       <string>02E535D00C24641A00CBD4A5</string>
+                                                                                       <string>02E535D20C24641A00CBD4A5</string>
+                                                                                       <string>02E535D40C24641A00CBD4A5</string>
+                                                                                       <string>02E535D60C24641A00CBD4A5</string>
+                                                                                       <string>02E535D70C24641A00CBD4A5</string>
+                                                                                       <string>02E535D90C24641A00CBD4A5</string>
+                                                                                       <string>02E535DF0C24641A00CBD4A5</string>
+                                                                                       <string>02E535E20C24641A00CBD4A5</string>
+                                                                                       <string>02E535E30C24641A00CBD4A5</string>
+                                                                                       <string>02E535E50C24641A00CBD4A5</string>
+                                                                                       <string>02E535E70C24641A00CBD4A5</string>
+                                                                                       <string>02E535E80C24641A00CBD4A5</string>
+                                                                                       <string>02E535EB0C24641A00CBD4A5</string>
+                                                                                       <string>02E535EE0C24641A00CBD4A5</string>
+                                                                                       <string>02E535F10C24641A00CBD4A5</string>
+                                                                                       <string>02E535F20C24641A00CBD4A5</string>
+                                                                                       <string>02E535F30C24641A00CBD4A5</string>
+                                                                                       <string>02E535F70C24641A00CBD4A5</string>
+                                                                                       <string>02E5361C0C25CA2B00CBD4A5</string>
+                                                                                       <string>02E5362D0C38763700CBD4A5</string>
+                                                                                       <string>02E5362E0C38763700CBD4A5</string>
+                                                                                       <string>02E536300C38763700CBD4A5</string>
+                                                                                       <string>02E536310C38763700CBD4A5</string>
+                                                                                       <string>02E536320C38763700CBD4A5</string>
+                                                                                       <string>02E536330C38763700CBD4A5</string>
+                                                                                       <string>02E536340C38763700CBD4A5</string>
+                                                                                       <string>02E536350C38763700CBD4A5</string>
+                                                                                       <string>02E536360C38763700CBD4A5</string>
+                                                                                       <string>02E5363F0C3C4FF000CBD4A5</string>
+                                                                                       <string>024A0F200C53B9D8000317D4</string>
+                                                                                       <string>0259C9740CA30C56005285B7</string>
+                                                                                       <string>0259C9750CA30C56005285B7</string>
+                                                                                       <string>0259C9760CA30C56005285B7</string>
+                                                                                       <string>0292B60E0CDA9CFD00A3A500</string>
+                                                                                       <string>0292B60F0CDA9CFD00A3A500</string>
+                                                                                       <string>0292B6100CDA9CFD00A3A500</string>
+                                                                                       <string>0292B6110CDA9CFD00A3A500</string>
+                                                                                       <string>0292B6120CDA9CFD00A3A500</string>
+                                                                                       <string>0292B6130CDA9CFD00A3A500</string>
+                                                                                       <string>0292B6140CDA9CFD00A3A500</string>
+                                                                                       <string>0292B6150CDA9CFD00A3A500</string>
+                                                                                       <string>0292B6160CDA9CFD00A3A500</string>
+                                                                                       <string>0292B6170CDA9CFD00A3A500</string>
+                                                                                       <string>0292B6180CDA9CFD00A3A500</string>
+                                                                                       <string>0292B6190CDA9CFD00A3A500</string>
+                                                                               </array>
+                                                                               <key>nextStack</key>
+                                                                               <array>
+                                                                                       <string>0292B61A0CDA9CFD00A3A500</string>
+                                                                                       <string>0292B61B0CDA9CFD00A3A500</string>
+                                                                                       <string>0292B61C0CDA9CFD00A3A500</string>
+                                                                                       <string>0292B61D0CDA9CFD00A3A500</string>
+                                                                                       <string>0292B61E0CDA9CFD00A3A500</string>
+                                                                               </array>
+                                                                               <key>prevStack</key>
+                                                                               <array>
+                                                                                       <string>02DC60DC0A87DBB90027E7F9</string>
+                                                                                       <string>027EE3D80BD6930A00A6A136</string>
+                                                                                       <string>027EE3D90BD6930A00A6A136</string>
+                                                                                       <string>027EE3DA0BD6930A00A6A136</string>
+                                                                                       <string>027EE3DB0BD6930A00A6A136</string>
+                                                                                       <string>027EE3DC0BD6930A00A6A136</string>
+                                                                                       <string>027EE3DD0BD6930A00A6A136</string>
+                                                                                       <string>02FE657B0C0521EA004A1450</string>
+                                                                                       <string>02FE657C0C0521EA004A1450</string>
+                                                                                       <string>02FE65970C0A1F1A004A1450</string>
+                                                                                       <string>02E535FB0C24641A00CBD4A5</string>
+                                                                                       <string>02E535FC0C24641A00CBD4A5</string>
+                                                                                       <string>02E536200C25CA2B00CBD4A5</string>
+                                                                                       <string>02E536210C25CA2B00CBD4A5</string>
+                                                                                       <string>02E536370C38763700CBD4A5</string>
+                                                                                       <string>02E536380C38763700CBD4A5</string>
+                                                                                       <string>02E536390C38763700CBD4A5</string>
+                                                                                       <string>02E5363A0C38763700CBD4A5</string>
+                                                                                       <string>02E5363B0C38763700CBD4A5</string>
+                                                                                       <string>02E536400C3C4FF000CBD4A5</string>
+                                                                                       <string>024A0F250C53B9D8000317D4</string>
+                                                                                       <string>0259C9790CA30C56005285B7</string>
+                                                                               </array>
+                                                                       </dict>
+                                                                       <key>SplitCount</key>
+                                                                       <string>1</string>
+                                                               </dict>
+                                                               <key>StatusBarVisibility</key>
+                                                               <true/>
+                                                       </dict>
+                                                       <key>GeometryConfiguration</key>
+                                                       <dict>
+                                                               <key>Frame</key>
+                                                               <string>{{0, 0}, {753, 799}}</string>
+                                                               <key>RubberWindowFrame</key>
+                                                               <string>8 33 1079 845 0 0 1440 878 </string>
+                                                       </dict>
+                                                       <key>Module</key>
+                                                       <string>PBXNavigatorGroup</string>
+                                                       <key>Proportion</key>
+                                                       <string>799pt</string>
+                                               </dict>
+                                               <dict>
+                                                       <key>ContentConfiguration</key>
+                                                       <dict>
+                                                               <key>PBXProjectModuleGUID</key>
+                                                               <string>1CE0B20506471E060097A5F4</string>
+                                                               <key>PBXProjectModuleLabel</key>
+                                                               <string>Detail</string>
+                                                       </dict>
+                                                       <key>GeometryConfiguration</key>
+                                                       <dict>
+                                                               <key>Frame</key>
+                                                               <string>{{0, 804}, {753, 0}}</string>
+                                                               <key>RubberWindowFrame</key>
+                                                               <string>8 33 1079 845 0 0 1440 878 </string>
+                                                       </dict>
+                                                       <key>Module</key>
+                                                       <string>XCDetailModule</string>
+                                                       <key>Proportion</key>
+                                                       <string>0pt</string>
+                                               </dict>
+                                       </array>
+                                       <key>Proportion</key>
+                                       <string>753pt</string>
+                               </dict>
+                       </array>
+                       <key>Name</key>
+                       <string>Project</string>
+                       <key>ServiceClasses</key>
+                       <array>
+                               <string>XCModuleDock</string>
+                               <string>PBXSmartGroupTreeModule</string>
+                               <string>XCModuleDock</string>
+                               <string>PBXNavigatorGroup</string>
+                               <string>XCDetailModule</string>
+                       </array>
+                       <key>TableOfContents</key>
+                       <array>
+                               <string>0292B6200CDA9CFD00A3A500</string>
+                               <string>1CE0B1FE06471DED0097A5F4</string>
+                               <string>0292B6210CDA9CFD00A3A500</string>
+                               <string>1CE0B20306471E060097A5F4</string>
+                               <string>1CE0B20506471E060097A5F4</string>
+                       </array>
+                       <key>ToolbarConfiguration</key>
+                       <string>xcode.toolbar.config.default</string>
+               </dict>
+               <dict>
+                       <key>ControllerClassBaseName</key>
+                       <string></string>
+                       <key>IconName</key>
+                       <string>WindowOfProject</string>
+                       <key>Identifier</key>
+                       <string>perspective.morph</string>
+                       <key>IsVertical</key>
+                       <integer>0</integer>
+                       <key>Layout</key>
+                       <array>
+                               <dict>
+                                       <key>BecomeActive</key>
+                                       <integer>1</integer>
+                                       <key>ContentConfiguration</key>
+                                       <dict>
+                                               <key>PBXBottomSmartGroupGIDs</key>
+                                               <array>
+                                                       <string>1C37FBAC04509CD000000102</string>
+                                                       <string>1C37FAAC04509CD000000102</string>
+                                                       <string>1C08E77C0454961000C914BD</string>
+                                                       <string>1C37FABC05509CD000000102</string>
+                                                       <string>1C37FABC05539CD112110102</string>
+                                                       <string>E2644B35053B69B200211256</string>
+                                                       <string>1C37FABC04509CD000100104</string>
+                                                       <string>1CC0EA4004350EF90044410B</string>
+                                                       <string>1CC0EA4004350EF90041110B</string>
+                                               </array>
+                                               <key>PBXProjectModuleGUID</key>
+                                               <string>11E0B1FE06471DED0097A5F4</string>
+                                               <key>PBXProjectModuleLabel</key>
+                                               <string>Files</string>
+                                               <key>PBXProjectStructureProvided</key>
+                                               <string>yes</string>
+                                               <key>PBXSmartGroupTreeModuleColumnData</key>
+                                               <dict>
+                                                       <key>PBXSmartGroupTreeModuleColumnWidthsKey</key>
+                                                       <array>
+                                                               <real>186</real>
+                                                       </array>
+                                                       <key>PBXSmartGroupTreeModuleColumnsKey_v4</key>
+                                                       <array>
+                                                               <string>MainColumn</string>
+                                                       </array>
+                                               </dict>
+                                               <key>PBXSmartGroupTreeModuleOutlineStateKey_v7</key>
+                                               <dict>
+                                                       <key>PBXSmartGroupTreeModuleOutlineStateExpansionKey</key>
+                                                       <array>
+                                                               <string>29B97314FDCFA39411CA2CEA</string>
+                                                               <string>1C37FABC05509CD000000102</string>
+                                                       </array>
+                                                       <key>PBXSmartGroupTreeModuleOutlineStateSelectionKey</key>
+                                                       <array>
+                                                               <array>
+                                                                       <integer>0</integer>
+                                                               </array>
+                                                       </array>
+                                                       <key>PBXSmartGroupTreeModuleOutlineStateVisibleRectKey</key>
+                                                       <string>{{0, 0}, {186, 337}}</string>
+                                               </dict>
+                                               <key>PBXTopSmartGroupGIDs</key>
+                                               <array/>
+                                               <key>XCIncludePerspectivesSwitch</key>
+                                               <integer>1</integer>
+                                               <key>XCSharingToken</key>
+                                               <string>com.apple.Xcode.GFSharingToken</string>
+                                       </dict>
+                                       <key>GeometryConfiguration</key>
+                                       <dict>
+                                               <key>Frame</key>
+                                               <string>{{0, 0}, {203, 355}}</string>
+                                               <key>GroupTreeTableConfiguration</key>
+                                               <array>
+                                                       <string>MainColumn</string>
+                                                       <real>186</real>
+                                               </array>
+                                               <key>RubberWindowFrame</key>
+                                               <string>373 269 690 397 0 0 1440 878 </string>
+                                       </dict>
+                                       <key>Module</key>
+                                       <string>PBXSmartGroupTreeModule</string>
+                                       <key>Proportion</key>
+                                       <string>100%</string>
+                               </dict>
+                       </array>
+                       <key>Name</key>
+                       <string>Morph</string>
+                       <key>PreferredWidth</key>
+                       <integer>300</integer>
+                       <key>ServiceClasses</key>
+                       <array>
+                               <string>XCModuleDock</string>
+                               <string>PBXSmartGroupTreeModule</string>
+                       </array>
+                       <key>TableOfContents</key>
+                       <array>
+                               <string>11E0B1FE06471DED0097A5F4</string>
+                       </array>
+                       <key>ToolbarConfiguration</key>
+                       <string>xcode.toolbar.config.default.short</string>
+               </dict>
+       </array>
+       <key>PerspectivesBarVisible</key>
+       <false/>
+       <key>ShelfIsVisible</key>
+       <false/>
+       <key>SourceDescription</key>
+       <string>file at '/System/Library/PrivateFrameworks/DevToolsInterface.framework/Versions/A/Resources/XCPerspectivesSpecificationMode1.xcperspec'</string>
+       <key>StatusbarIsVisible</key>
+       <true/>
+       <key>TimeStamp</key>
+       <real>215653629.27717999</real>
+       <key>ToolbarDisplayMode</key>
+       <integer>2</integer>
+       <key>ToolbarIsVisible</key>
+       <true/>
+       <key>ToolbarSizeMode</key>
+       <integer>2</integer>
+       <key>Type</key>
+       <string>Perspectives</string>
+       <key>UpdateMessage</key>
+       <string>The Default Workspace in this version of Xcode now includes support to hide and show the detail view (what has been referred to as the "Metro-Morph" feature).  You must discard your current Default Workspace settings and update to the latest Default Workspace in order to gain this feature.  Do you wish to update to the latest Workspace defaults for project '%@'?</string>
+       <key>WindowJustification</key>
+       <integer>5</integer>
+       <key>WindowOrderList</key>
+       <array>
+               <string>0292B6220CDA9CFD00A3A500</string>
+               <string>0292B6230CDA9CFD00A3A500</string>
+               <string>02CD175D09F6CC1200ABE650</string>
+               <string>0292B5F70CD9689200A3A500</string>
+               <string>0246B8AB09C37E4E009A0CA3</string>
+               <string>1CD10A99069EF8BA00B06720</string>
+               <string>/Users/creed/projects/sgtl/elftosb/elftosb.xcodeproj</string>
+               <string>1C0AD2B3069F1EA900FABCE6</string>
+       </array>
+       <key>WindowString</key>
+       <string>8 33 1079 845 0 0 1440 878 </string>
+       <key>WindowTools</key>
+       <array>
+               <dict>
+                       <key>FirstTimeWindowDisplayed</key>
+                       <false/>
+                       <key>Identifier</key>
+                       <string>windowTool.build</string>
+                       <key>IsVertical</key>
+                       <true/>
+                       <key>Layout</key>
+                       <array>
+                               <dict>
+                                       <key>Dock</key>
+                                       <array>
+                                               <dict>
+                                                       <key>ContentConfiguration</key>
+                                                       <dict>
+                                                               <key>PBXProjectModuleGUID</key>
+                                                               <string>1CD0528F0623707200166675</string>
+                                                               <key>PBXProjectModuleLabel</key>
+                                                               <string></string>
+                                                               <key>StatusBarVisibility</key>
+                                                               <true/>
+                                                       </dict>
+                                                       <key>GeometryConfiguration</key>
+                                                       <dict>
+                                                               <key>Frame</key>
+                                                               <string>{{0, 0}, {744, 0}}</string>
+                                                               <key>RubberWindowFrame</key>
+                                                               <string>566 98 744 502 0 0 1440 878 </string>
+                                                       </dict>
+                                                       <key>Module</key>
+                                                       <string>PBXNavigatorGroup</string>
+                                                       <key>Proportion</key>
+                                                       <string>0pt</string>
+                                               </dict>
+                                               <dict>
+                                                       <key>BecomeActive</key>
+                                                       <true/>
+                                                       <key>ContentConfiguration</key>
+                                                       <dict>
+                                                               <key>PBXBuildLogShowsTranscriptDefaultKey</key>
+                                                               <string>{{0, 207}, {744, 249}}</string>
+                                                               <key>PBXProjectModuleGUID</key>
+                                                               <string>XCMainBuildResultsModuleGUID</string>
+                                                               <key>PBXProjectModuleLabel</key>
+                                                               <string>Build</string>
+                                                               <key>XCBuildResultsTrigger_Collapse</key>
+                                                               <integer>1022</integer>
+                                                               <key>XCBuildResultsTrigger_Open</key>
+                                                               <integer>1010</integer>
+                                                       </dict>
+                                                       <key>GeometryConfiguration</key>
+                                                       <dict>
+                                                               <key>Frame</key>
+                                                               <string>{{0, 5}, {744, 456}}</string>
+                                                               <key>RubberWindowFrame</key>
+                                                               <string>566 98 744 502 0 0 1440 878 </string>
+                                                       </dict>
+                                                       <key>Module</key>
+                                                       <string>PBXBuildResultsModule</string>
+                                                       <key>Proportion</key>
+                                                       <string>456pt</string>
+                                               </dict>
+                                       </array>
+                                       <key>Proportion</key>
+                                       <string>461pt</string>
+                               </dict>
+                       </array>
+                       <key>Name</key>
+                       <string>Build Results</string>
+                       <key>ServiceClasses</key>
+                       <array>
+                               <string>PBXBuildResultsModule</string>
+                       </array>
+                       <key>StatusbarIsVisible</key>
+                       <true/>
+                       <key>TableOfContents</key>
+                       <array>
+                               <string>0246B8AB09C37E4E009A0CA3</string>
+                               <string>0292B5ED0CD9677200A3A500</string>
+                               <string>1CD0528F0623707200166675</string>
+                               <string>XCMainBuildResultsModuleGUID</string>
+                       </array>
+                       <key>ToolbarConfiguration</key>
+                       <string>xcode.toolbar.config.build</string>
+                       <key>WindowString</key>
+                       <string>566 98 744 502 0 0 1440 878 </string>
+                       <key>WindowToolGUID</key>
+                       <string>0246B8AB09C37E4E009A0CA3</string>
+                       <key>WindowToolIsVisible</key>
+                       <false/>
+               </dict>
+               <dict>
+                       <key>FirstTimeWindowDisplayed</key>
+                       <false/>
+                       <key>Identifier</key>
+                       <string>windowTool.debugger</string>
+                       <key>IsVertical</key>
+                       <true/>
+                       <key>Layout</key>
+                       <array>
+                               <dict>
+                                       <key>Dock</key>
+                                       <array>
+                                               <dict>
+                                                       <key>ContentConfiguration</key>
+                                                       <dict>
+                                                               <key>Debugger</key>
+                                                               <dict>
+                                                                       <key>HorizontalSplitView</key>
+                                                                       <dict>
+                                                                               <key>_collapsingFrameDimension</key>
+                                                                               <real>0.0</real>
+                                                                               <key>_indexOfCollapsedView</key>
+                                                                               <integer>0</integer>
+                                                                               <key>_percentageOfCollapsedView</key>
+                                                                               <real>0.0</real>
+                                                                               <key>isCollapsed</key>
+                                                                               <string>yes</string>
+                                                                               <key>sizes</key>
+                                                                               <array>
+                                                                                       <string>{{0, 0}, {307, 301}}</string>
+                                                                                       <string>{{0, 301}, {307, 480}}</string>
+                                                                               </array>
+                                                                       </dict>
+                                                                       <key>VerticalSplitView</key>
+                                                                       <dict>
+                                                                               <key>_collapsingFrameDimension</key>
+                                                                               <real>0.0</real>
+                                                                               <key>_indexOfCollapsedView</key>
+                                                                               <integer>0</integer>
+                                                                               <key>_percentageOfCollapsedView</key>
+                                                                               <real>0.0</real>
+                                                                               <key>isCollapsed</key>
+                                                                               <string>yes</string>
+                                                                               <key>sizes</key>
+                                                                               <array>
+                                                                                       <string>{{0, 0}, {307, 781}}</string>
+                                                                                       <string>{{307, 0}, {792, 781}}</string>
+                                                                               </array>
+                                                                       </dict>
+                                                               </dict>
+                                                               <key>LauncherConfigVersion</key>
+                                                               <string>8</string>
+                                                               <key>PBXProjectModuleGUID</key>
+                                                               <string>1C162984064C10D400B95A72</string>
+                                                               <key>PBXProjectModuleLabel</key>
+                                                               <string>Debug - GLUTExamples (Underwater)</string>
+                                                       </dict>
+                                                       <key>GeometryConfiguration</key>
+                                                       <dict>
+                                                               <key>DebugConsoleDrawerSize</key>
+                                                               <string>{100, 120}</string>
+                                                               <key>DebugConsoleVisible</key>
+                                                               <string>None</string>
+                                                               <key>DebugConsoleWindowFrame</key>
+                                                               <string>{{200, 200}, {500, 300}}</string>
+                                                               <key>DebugSTDIOWindowFrame</key>
+                                                               <string>{{200, 200}, {500, 300}}</string>
+                                                               <key>Frame</key>
+                                                               <string>{{0, 0}, {1099, 781}}</string>
+                                                               <key>RubberWindowFrame</key>
+                                                               <string>142 56 1099 822 0 0 1440 878 </string>
+                                                       </dict>
+                                                       <key>Module</key>
+                                                       <string>PBXDebugSessionModule</string>
+                                                       <key>Proportion</key>
+                                                       <string>781pt</string>
+                                               </dict>
+                                       </array>
+                                       <key>Proportion</key>
+                                       <string>781pt</string>
+                               </dict>
+                       </array>
+                       <key>Name</key>
+                       <string>Debugger</string>
+                       <key>ServiceClasses</key>
+                       <array>
+                               <string>PBXDebugSessionModule</string>
+                       </array>
+                       <key>StatusbarIsVisible</key>
+                       <true/>
+                       <key>TableOfContents</key>
+                       <array>
+                               <string>1CD10A99069EF8BA00B06720</string>
+                               <string>0292B5F10CD9689200A3A500</string>
+                               <string>1C162984064C10D400B95A72</string>
+                               <string>0292B5F20CD9689200A3A500</string>
+                               <string>0292B5F30CD9689200A3A500</string>
+                               <string>0292B5F40CD9689200A3A500</string>
+                               <string>0292B5F50CD9689200A3A500</string>
+                               <string>0292B5F60CD9689200A3A500</string>
+                               <string>0292B5F70CD9689200A3A500</string>
+                       </array>
+                       <key>ToolbarConfiguration</key>
+                       <string>xcode.toolbar.config.debug</string>
+                       <key>WindowString</key>
+                       <string>142 56 1099 822 0 0 1440 878 </string>
+                       <key>WindowToolGUID</key>
+                       <string>1CD10A99069EF8BA00B06720</string>
+                       <key>WindowToolIsVisible</key>
+                       <true/>
+               </dict>
+               <dict>
+                       <key>FirstTimeWindowDisplayed</key>
+                       <false/>
+                       <key>Identifier</key>
+                       <string>windowTool.find</string>
+                       <key>IsVertical</key>
+                       <true/>
+                       <key>Layout</key>
+                       <array>
+                               <dict>
+                                       <key>Dock</key>
+                                       <array>
+                                               <dict>
+                                                       <key>Dock</key>
+                                                       <array>
+                                                               <dict>
+                                                                       <key>BecomeActive</key>
+                                                                       <true/>
+                                                                       <key>ContentConfiguration</key>
+                                                                       <dict>
+                                                                               <key>PBXProjectModuleGUID</key>
+                                                                               <string>1CDD528C0622207200134675</string>
+                                                                               <key>PBXProjectModuleLabel</key>
+                                                                               <string>SourceFile.cpp</string>
+                                                                               <key>StatusBarVisibility</key>
+                                                                               <true/>
+                                                                       </dict>
+                                                                       <key>GeometryConfiguration</key>
+                                                                       <dict>
+                                                                               <key>Frame</key>
+                                                                               <string>{{0, 0}, {792, 405}}</string>
+                                                                               <key>RubberWindowFrame</key>
+                                                                               <string>387 14 792 854 0 0 1440 878 </string>
+                                                                       </dict>
+                                                                       <key>Module</key>
+                                                                       <string>PBXNavigatorGroup</string>
+                                                                       <key>Proportion</key>
+                                                                       <string>792pt</string>
+                                                               </dict>
+                                                       </array>
+                                                       <key>Proportion</key>
+                                                       <string>405pt</string>
+                                               </dict>
+                                               <dict>
+                                                       <key>ContentConfiguration</key>
+                                                       <dict>
+                                                               <key>PBXProjectModuleGUID</key>
+                                                               <string>1CD0528E0623707200166675</string>
+                                                               <key>PBXProjectModuleLabel</key>
+                                                               <string>Project Find</string>
+                                                       </dict>
+                                                       <key>GeometryConfiguration</key>
+                                                       <dict>
+                                                               <key>Frame</key>
+                                                               <string>{{0, 410}, {792, 403}}</string>
+                                                               <key>RubberWindowFrame</key>
+                                                               <string>387 14 792 854 0 0 1440 878 </string>
+                                                       </dict>
+                                                       <key>Module</key>
+                                                       <string>PBXProjectFindModule</string>
+                                                       <key>Proportion</key>
+                                                       <string>403pt</string>
+                                               </dict>
+                                       </array>
+                                       <key>Proportion</key>
+                                       <string>813pt</string>
+                               </dict>
+                       </array>
+                       <key>Name</key>
+                       <string>Project Find</string>
+                       <key>ServiceClasses</key>
+                       <array>
+                               <string>PBXProjectFindModule</string>
+                       </array>
+                       <key>StatusbarIsVisible</key>
+                       <true/>
+                       <key>TableOfContents</key>
+                       <array>
+                               <string>1C530D57069F1CE1000CFCEE</string>
+                               <string>02D1FD080BD039AB007C7450</string>
+                               <string>02D1FD090BD039AB007C7450</string>
+                               <string>1CDD528C0622207200134675</string>
+                               <string>1CD0528E0623707200166675</string>
+                       </array>
+                       <key>WindowString</key>
+                       <string>387 14 792 854 0 0 1440 878 </string>
+                       <key>WindowToolGUID</key>
+                       <string>1C530D57069F1CE1000CFCEE</string>
+                       <key>WindowToolIsVisible</key>
+                       <true/>
+               </dict>
+               <dict>
+                       <key>Identifier</key>
+                       <string>MENUSEPARATOR</string>
+               </dict>
+               <dict>
+                       <key>FirstTimeWindowDisplayed</key>
+                       <false/>
+                       <key>Identifier</key>
+                       <string>windowTool.debuggerConsole</string>
+                       <key>IsVertical</key>
+                       <true/>
+                       <key>Layout</key>
+                       <array>
+                               <dict>
+                                       <key>Dock</key>
+                                       <array>
+                                               <dict>
+                                                       <key>ContentConfiguration</key>
+                                                       <dict>
+                                                               <key>PBXProjectModuleGUID</key>
+                                                               <string>1C78EAAC065D492600B07095</string>
+                                                               <key>PBXProjectModuleLabel</key>
+                                                               <string>Debugger Console</string>
+                                                       </dict>
+                                                       <key>GeometryConfiguration</key>
+                                                       <dict>
+                                                               <key>Frame</key>
+                                                               <string>{{0, 0}, {440, 358}}</string>
+                                                               <key>RubberWindowFrame</key>
+                                                               <string>928 1 440 400 0 0 1440 878 </string>
+                                                       </dict>
+                                                       <key>Module</key>
+                                                       <string>PBXDebugCLIModule</string>
+                                                       <key>Proportion</key>
+                                                       <string>358pt</string>
+                                               </dict>
+                                       </array>
+                                       <key>Proportion</key>
+                                       <string>359pt</string>
+                               </dict>
+                       </array>
+                       <key>Name</key>
+                       <string>Debugger Console</string>
+                       <key>ServiceClasses</key>
+                       <array>
+                               <string>PBXDebugCLIModule</string>
+                       </array>
+                       <key>StatusbarIsVisible</key>
+                       <true/>
+                       <key>TableOfContents</key>
+                       <array>
+                               <string>02CD175D09F6CC1200ABE650</string>
+                               <string>0292B5F80CD9689200A3A500</string>
+                               <string>1C78EAAC065D492600B07095</string>
+                       </array>
+                       <key>WindowString</key>
+                       <string>928 1 440 400 0 0 1440 878 </string>
+                       <key>WindowToolGUID</key>
+                       <string>02CD175D09F6CC1200ABE650</string>
+                       <key>WindowToolIsVisible</key>
+                       <false/>
+               </dict>
+               <dict>
+                       <key>FirstTimeWindowDisplayed</key>
+                       <false/>
+                       <key>Identifier</key>
+                       <string>windowTool.run</string>
+                       <key>IsVertical</key>
+                       <true/>
+                       <key>Layout</key>
+                       <array>
+                               <dict>
+                                       <key>Dock</key>
+                                       <array>
+                                               <dict>
+                                                       <key>ContentConfiguration</key>
+                                                       <dict>
+                                                               <key>LauncherConfigVersion</key>
+                                                               <string>3</string>
+                                                               <key>PBXProjectModuleGUID</key>
+                                                               <string>1CD0528B0623707200166675</string>
+                                                               <key>PBXProjectModuleLabel</key>
+                                                               <string>Run</string>
+                                                               <key>Runner</key>
+                                                               <dict>
+                                                                       <key>HorizontalSplitView</key>
+                                                                       <dict>
+                                                                               <key>_collapsingFrameDimension</key>
+                                                                               <real>0.0</real>
+                                                                               <key>_indexOfCollapsedView</key>
+                                                                               <integer>0</integer>
+                                                                               <key>_percentageOfCollapsedView</key>
+                                                                               <real>0.0</real>
+                                                                               <key>isCollapsed</key>
+                                                                               <string>yes</string>
+                                                                               <key>sizes</key>
+                                                                               <array>
+                                                                                       <string>{{0, 0}, {367, 168}}</string>
+                                                                                       <string>{{0, 173}, {367, 270}}</string>
+                                                                               </array>
+                                                                       </dict>
+                                                                       <key>VerticalSplitView</key>
+                                                                       <dict>
+                                                                               <key>_collapsingFrameDimension</key>
+                                                                               <real>0.0</real>
+                                                                               <key>_indexOfCollapsedView</key>
+                                                                               <integer>0</integer>
+                                                                               <key>_percentageOfCollapsedView</key>
+                                                                               <real>0.0</real>
+                                                                               <key>isCollapsed</key>
+                                                                               <string>yes</string>
+                                                                               <key>sizes</key>
+                                                                               <array>
+                                                                                       <string>{{0, 0}, {406, 443}}</string>
+                                                                                       <string>{{411, 0}, {517, 443}}</string>
+                                                                               </array>
+                                                                       </dict>
+                                                               </dict>
+                                                       </dict>
+                                                       <key>GeometryConfiguration</key>
+                                                       <dict>
+                                                               <key>Frame</key>
+                                                               <string>{{0, 0}, {662, 502}}</string>
+                                                               <key>RubberWindowFrame</key>
+                                                               <string>708 293 662 543 0 0 1440 878 </string>
+                                                       </dict>
+                                                       <key>Module</key>
+                                                       <string>PBXRunSessionModule</string>
+                                                       <key>Proportion</key>
+                                                       <string>502pt</string>
+                                               </dict>
+                                       </array>
+                                       <key>Proportion</key>
+                                       <string>502pt</string>
+                               </dict>
+                       </array>
+                       <key>Name</key>
+                       <string>Run Log</string>
+                       <key>ServiceClasses</key>
+                       <array>
+                               <string>PBXRunSessionModule</string>
+                       </array>
+                       <key>StatusbarIsVisible</key>
+                       <true/>
+                       <key>TableOfContents</key>
+                       <array>
+                               <string>1C0AD2B3069F1EA900FABCE6</string>
+                               <string>0292B5F90CD9689200A3A500</string>
+                               <string>1CD0528B0623707200166675</string>
+                               <string>0292B5FA0CD9689200A3A500</string>
+                       </array>
+                       <key>ToolbarConfiguration</key>
+                       <string>xcode.toolbar.config.run</string>
+                       <key>WindowString</key>
+                       <string>708 293 662 543 0 0 1440 878 </string>
+                       <key>WindowToolGUID</key>
+                       <string>1C0AD2B3069F1EA900FABCE6</string>
+                       <key>WindowToolIsVisible</key>
+                       <true/>
+               </dict>
+               <dict>
+                       <key>FirstTimeWindowDisplayed</key>
+                       <false/>
+                       <key>Identifier</key>
+                       <string>windowTool.scm</string>
+                       <key>IsVertical</key>
+                       <true/>
+                       <key>Layout</key>
+                       <array>
+                               <dict>
+                                       <key>Dock</key>
+                                       <array>
+                                               <dict>
+                                                       <key>ContentConfiguration</key>
+                                                       <dict>
+                                                               <key>PBXProjectModuleGUID</key>
+                                                               <string>1C78EAB2065D492600B07095</string>
+                                                               <key>PBXProjectModuleLabel</key>
+                                                               <string></string>
+                                                               <key>StatusBarVisibility</key>
+                                                               <true/>
+                                                       </dict>
+                                                       <key>GeometryConfiguration</key>
+                                                       <dict>
+                                                               <key>Frame</key>
+                                                               <string>{{0, 0}, {452, 0}}</string>
+                                                               <key>RubberWindowFrame</key>
+                                                               <string>30 547 452 308 0 0 1440 878 </string>
+                                                       </dict>
+                                                       <key>Module</key>
+                                                       <string>PBXNavigatorGroup</string>
+                                                       <key>Proportion</key>
+                                                       <string>0pt</string>
+                                               </dict>
+                                               <dict>
+                                                       <key>BecomeActive</key>
+                                                       <true/>
+                                                       <key>ContentConfiguration</key>
+                                                       <dict>
+                                                               <key>PBXProjectModuleGUID</key>
+                                                               <string>1CD052920623707200166675</string>
+                                                               <key>PBXProjectModuleLabel</key>
+                                                               <string>SCM Results</string>
+                                                       </dict>
+                                                       <key>GeometryConfiguration</key>
+                                                       <dict>
+                                                               <key>Frame</key>
+                                                               <string>{{0, 5}, {452, 262}}</string>
+                                                               <key>RubberWindowFrame</key>
+                                                               <string>30 547 452 308 0 0 1440 878 </string>
+                                                       </dict>
+                                                       <key>Module</key>
+                                                       <string>PBXCVSModule</string>
+                                                       <key>Proportion</key>
+                                                       <string>262pt</string>
+                                               </dict>
+                                       </array>
+                                       <key>Proportion</key>
+                                       <string>267pt</string>
+                               </dict>
+                       </array>
+                       <key>Name</key>
+                       <string>SCM</string>
+                       <key>ServiceClasses</key>
+                       <array>
+                               <string>PBXCVSModule</string>
+                       </array>
+                       <key>StatusbarIsVisible</key>
+                       <true/>
+                       <key>TableOfContents</key>
+                       <array>
+                               <string>02FE643D0BF793B0004A1450</string>
+                               <string>02FE643E0BF793B0004A1450</string>
+                               <string>1C78EAB2065D492600B07095</string>
+                               <string>1CD052920623707200166675</string>
+                       </array>
+                       <key>ToolbarConfiguration</key>
+                       <string>xcode.toolbar.config.scm</string>
+                       <key>WindowString</key>
+                       <string>30 547 452 308 0 0 1440 878 </string>
+                       <key>WindowToolGUID</key>
+                       <string>02FE643D0BF793B0004A1450</string>
+                       <key>WindowToolIsVisible</key>
+                       <false/>
+               </dict>
+               <dict>
+                       <key>FirstTimeWindowDisplayed</key>
+                       <false/>
+                       <key>Identifier</key>
+                       <string>windowTool.breakpoints</string>
+                       <key>IsVertical</key>
+                       <false/>
+                       <key>Layout</key>
+                       <array>
+                               <dict>
+                                       <key>Dock</key>
+                                       <array>
+                                               <dict>
+                                                       <key>ContentConfiguration</key>
+                                                       <dict>
+                                                               <key>PBXBottomSmartGroupGIDs</key>
+                                                               <array>
+                                                                       <string>1C77FABC04509CD000000102</string>
+                                                               </array>
+                                                               <key>PBXProjectModuleGUID</key>
+                                                               <string>1CE0B1FE06471DED0097A5F4</string>
+                                                               <key>PBXProjectModuleLabel</key>
+                                                               <string>Files</string>
+                                                               <key>PBXProjectStructureProvided</key>
+                                                               <string>no</string>
+                                                               <key>PBXSmartGroupTreeModuleColumnData</key>
+                                                               <dict>
+                                                                       <key>PBXSmartGroupTreeModuleColumnWidthsKey</key>
+                                                                       <array>
+                                                                               <real>168</real>
+                                                                       </array>
+                                                                       <key>PBXSmartGroupTreeModuleColumnsKey_v4</key>
+                                                                       <array>
+                                                                               <string>MainColumn</string>
+                                                                       </array>
+                                                               </dict>
+                                                               <key>PBXSmartGroupTreeModuleOutlineStateKey_v7</key>
+                                                               <dict>
+                                                                       <key>PBXSmartGroupTreeModuleOutlineStateExpansionKey</key>
+                                                                       <array>
+                                                                               <string>1C77FABC04509CD000000102</string>
+                                                                               <string>1C3E0DCA080725EA00A55177</string>
+                                                                       </array>
+                                                                       <key>PBXSmartGroupTreeModuleOutlineStateSelectionKey</key>
+                                                                       <array>
+                                                                               <array>
+                                                                                       <integer>0</integer>
+                                                                               </array>
+                                                                       </array>
+                                                                       <key>PBXSmartGroupTreeModuleOutlineStateVisibleRectKey</key>
+                                                                       <string>{{0, 0}, {168, 350}}</string>
+                                                               </dict>
+                                                               <key>PBXTopSmartGroupGIDs</key>
+                                                               <array/>
+                                                               <key>XCIncludePerspectivesSwitch</key>
+                                                               <false/>
+                                                       </dict>
+                                                       <key>GeometryConfiguration</key>
+                                                       <dict>
+                                                               <key>Frame</key>
+                                                               <string>{{0, 0}, {185, 368}}</string>
+                                                               <key>GroupTreeTableConfiguration</key>
+                                                               <array>
+                                                                       <string>MainColumn</string>
+                                                                       <real>168</real>
+                                                               </array>
+                                                               <key>RubberWindowFrame</key>
+                                                               <string>28 375 744 409 0 0 1440 878 </string>
+                                                       </dict>
+                                                       <key>Module</key>
+                                                       <string>PBXSmartGroupTreeModule</string>
+                                                       <key>Proportion</key>
+                                                       <string>185pt</string>
+                                               </dict>
+                                               <dict>
+                                                       <key>BecomeActive</key>
+                                                       <true/>
+                                                       <key>ContentConfiguration</key>
+                                                       <dict>
+                                                               <key>PBXProjectModuleGUID</key>
+                                                               <string>1CA1AED706398EBD00589147</string>
+                                                               <key>PBXProjectModuleLabel</key>
+                                                               <string>Detail</string>
+                                                       </dict>
+                                                       <key>GeometryConfiguration</key>
+                                                       <dict>
+                                                               <key>Frame</key>
+                                                               <string>{{190, 0}, {554, 368}}</string>
+                                                               <key>RubberWindowFrame</key>
+                                                               <string>28 375 744 409 0 0 1440 878 </string>
+                                                       </dict>
+                                                       <key>Module</key>
+                                                       <string>XCDetailModule</string>
+                                                       <key>Proportion</key>
+                                                       <string>554pt</string>
+                                               </dict>
+                                       </array>
+                                       <key>Proportion</key>
+                                       <string>368pt</string>
+                               </dict>
+                       </array>
+                       <key>MajorVersion</key>
+                       <integer>2</integer>
+                       <key>MinorVersion</key>
+                       <integer>0</integer>
+                       <key>Name</key>
+                       <string>Breakpoints</string>
+                       <key>ServiceClasses</key>
+                       <array>
+                               <string>PBXSmartGroupTreeModule</string>
+                               <string>XCDetailModule</string>
+                       </array>
+                       <key>StatusbarIsVisible</key>
+                       <true/>
+                       <key>TableOfContents</key>
+                       <array>
+                               <string>027EE4730BD6D24700A6A136</string>
+                               <string>027EE4740BD6D24700A6A136</string>
+                               <string>1CE0B1FE06471DED0097A5F4</string>
+                               <string>1CA1AED706398EBD00589147</string>
+                       </array>
+                       <key>ToolbarConfiguration</key>
+                       <string>xcode.toolbar.config.breakpoints</string>
+                       <key>WindowString</key>
+                       <string>28 375 744 409 0 0 1440 878 </string>
+                       <key>WindowToolGUID</key>
+                       <string>027EE4730BD6D24700A6A136</string>
+                       <key>WindowToolIsVisible</key>
+                       <false/>
+               </dict>
+               <dict>
+                       <key>FirstTimeWindowDisplayed</key>
+                       <false/>
+                       <key>Identifier</key>
+                       <string>windowTool.debugAnimator</string>
+                       <key>IsVertical</key>
+                       <true/>
+                       <key>Layout</key>
+                       <array>
+                               <dict>
+                                       <key>Dock</key>
+                                       <array>
+                                               <dict>
+                                                       <key>BecomeActive</key>
+                                                       <true/>
+                                                       <key>ContentConfiguration</key>
+                                                       <dict>
+                                                               <key>PBXProjectModuleGUID</key>
+                                                               <string>02E39A7909F721C80055992A</string>
+                                                               <key>PBXProjectModuleLabel</key>
+                                                               <string></string>
+                                                               <key>StatusBarVisibility</key>
+                                                               <true/>
+                                                       </dict>
+                                                       <key>GeometryConfiguration</key>
+                                                       <dict>
+                                                               <key>Frame</key>
+                                                               <string>{{0, 0}, {700, 459}}</string>
+                                                               <key>RubberWindowFrame</key>
+                                                               <string>36 211 700 500 0 0 1440 878 </string>
+                                                       </dict>
+                                                       <key>Module</key>
+                                                       <string>PBXNavigatorGroup</string>
+                                                       <key>Proportion</key>
+                                                       <string>459pt</string>
+                                               </dict>
+                                       </array>
+                                       <key>Proportion</key>
+                                       <string>459pt</string>
+                               </dict>
+                       </array>
+                       <key>Name</key>
+                       <string>Debug Visualizer</string>
+                       <key>ServiceClasses</key>
+                       <array>
+                               <string>PBXNavigatorGroup</string>
+                       </array>
+                       <key>StatusbarIsVisible</key>
+                       <true/>
+                       <key>TableOfContents</key>
+                       <array>
+                               <string>027EE4660BD6CDCB00A6A136</string>
+                               <string>027EE4670BD6CDCB00A6A136</string>
+                               <string>02E39A7909F721C80055992A</string>
+                       </array>
+                       <key>ToolbarConfiguration</key>
+                       <string>xcode.toolbar.config.debugAnimator</string>
+                       <key>WindowString</key>
+                       <string>36 211 700 500 0 0 1440 878 </string>
+                       <key>WindowToolGUID</key>
+                       <string>027EE4660BD6CDCB00A6A136</string>
+                       <key>WindowToolIsVisible</key>
+                       <false/>
+               </dict>
+               <dict>
+                       <key>Identifier</key>
+                       <string>windowTool.bookmarks</string>
+                       <key>Layout</key>
+                       <array>
+                               <dict>
+                                       <key>Dock</key>
+                                       <array>
+                                               <dict>
+                                                       <key>Module</key>
+                                                       <string>PBXBookmarksModule</string>
+                                                       <key>Proportion</key>
+                                                       <string>100%</string>
+                                               </dict>
+                                       </array>
+                                       <key>Proportion</key>
+                                       <string>100%</string>
+                               </dict>
+                       </array>
+                       <key>Name</key>
+                       <string>Bookmarks</string>
+                       <key>ServiceClasses</key>
+                       <array>
+                               <string>PBXBookmarksModule</string>
+                       </array>
+                       <key>StatusbarIsVisible</key>
+                       <integer>0</integer>
+                       <key>WindowString</key>
+                       <string>538 42 401 187 0 0 1280 1002 </string>
+               </dict>
+               <dict>
+                       <key>FirstTimeWindowDisplayed</key>
+                       <false/>
+                       <key>Identifier</key>
+                       <string>windowTool.classBrowser</string>
+                       <key>IsVertical</key>
+                       <true/>
+                       <key>Layout</key>
+                       <array>
+                               <dict>
+                                       <key>Dock</key>
+                                       <array>
+                                               <dict>
+                                                       <key>ContentConfiguration</key>
+                                                       <dict>
+                                                               <key>OptionsSetName</key>
+                                                               <string>Hierarchy, project classes</string>
+                                                               <key>PBXProjectModuleGUID</key>
+                                                               <string>1CA6456E063B45B4001379D8</string>
+                                                               <key>PBXProjectModuleLabel</key>
+                                                               <string>Class Browser - RijndaelCBCMAC</string>
+                                                       </dict>
+                                                       <key>GeometryConfiguration</key>
+                                                       <dict>
+                                                               <key>ClassesFrame</key>
+                                                               <string>{{0, 0}, {759, 298}}</string>
+                                                               <key>ClassesTreeTableConfiguration</key>
+                                                               <array>
+                                                                       <string>PBXClassNameColumnIdentifier</string>
+                                                                       <real>208</real>
+                                                                       <string>PBXClassBookColumnIdentifier</string>
+                                                                       <real>22</real>
+                                                               </array>
+                                                               <key>Frame</key>
+                                                               <string>{{0, 0}, {1011, 802}}</string>
+                                                               <key>MembersFrame</key>
+                                                               <string>{{0, 303}, {759, 499}}</string>
+                                                               <key>MembersTreeTableConfiguration</key>
+                                                               <array>
+                                                                       <string>PBXMemberTypeIconColumnIdentifier</string>
+                                                                       <real>22</real>
+                                                                       <string>PBXMemberNameColumnIdentifier</string>
+                                                                       <real>216</real>
+                                                                       <string>PBXMemberTypeColumnIdentifier</string>
+                                                                       <real>482</real>
+                                                                       <string>PBXMemberBookColumnIdentifier</string>
+                                                                       <real>22</real>
+                                                               </array>
+                                                               <key>RubberWindowFrame</key>
+                                                               <string>159 56 1011 822 0 0 1440 878 </string>
+                                                       </dict>
+                                                       <key>Module</key>
+                                                       <string>PBXClassBrowserModule</string>
+                                                       <key>Proportion</key>
+                                                       <string>802pt</string>
+                                               </dict>
+                                       </array>
+                                       <key>Proportion</key>
+                                       <string>802pt</string>
+                               </dict>
+                       </array>
+                       <key>Name</key>
+                       <string>Class Browser</string>
+                       <key>ServiceClasses</key>
+                       <array>
+                               <string>PBXClassBrowserModule</string>
+                       </array>
+                       <key>StatusbarIsVisible</key>
+                       <false/>
+                       <key>TableOfContents</key>
+                       <array>
+                               <string>1C0AD2AF069F1E9B00FABCE6</string>
+                               <string>027EE3B20BD5CE9600A6A136</string>
+                               <string>1CA6456E063B45B4001379D8</string>
+                       </array>
+                       <key>ToolbarConfiguration</key>
+                       <string>xcode.toolbar.config.classbrowser</string>
+                       <key>WindowString</key>
+                       <string>159 56 1011 822 0 0 1440 878 </string>
+                       <key>WindowToolGUID</key>
+                       <string>1C0AD2AF069F1E9B00FABCE6</string>
+                       <key>WindowToolIsVisible</key>
+                       <false/>
+               </dict>
+       </array>
+</dict>
+</plist>
diff --git a/tools/elftosb/elftosb.xcodeproj/creed.mode1v3 b/tools/elftosb/elftosb.xcodeproj/creed.mode1v3
new file mode 100644 (file)
index 0000000..55efe7c
--- /dev/null
@@ -0,0 +1,1569 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+       <key>ActivePerspectiveName</key>
+       <string>Project</string>
+       <key>AllowedModules</key>
+       <array>
+               <dict>
+                       <key>BundleLoadPath</key>
+                       <string></string>
+                       <key>MaxInstances</key>
+                       <string>n</string>
+                       <key>Module</key>
+                       <string>PBXSmartGroupTreeModule</string>
+                       <key>Name</key>
+                       <string>Groups and Files Outline View</string>
+               </dict>
+               <dict>
+                       <key>BundleLoadPath</key>
+                       <string></string>
+                       <key>MaxInstances</key>
+                       <string>n</string>
+                       <key>Module</key>
+                       <string>PBXNavigatorGroup</string>
+                       <key>Name</key>
+                       <string>Editor</string>
+               </dict>
+               <dict>
+                       <key>BundleLoadPath</key>
+                       <string></string>
+                       <key>MaxInstances</key>
+                       <string>n</string>
+                       <key>Module</key>
+                       <string>XCTaskListModule</string>
+                       <key>Name</key>
+                       <string>Task List</string>
+               </dict>
+               <dict>
+                       <key>BundleLoadPath</key>
+                       <string></string>
+                       <key>MaxInstances</key>
+                       <string>n</string>
+                       <key>Module</key>
+                       <string>XCDetailModule</string>
+                       <key>Name</key>
+                       <string>File and Smart Group Detail Viewer</string>
+               </dict>
+               <dict>
+                       <key>BundleLoadPath</key>
+                       <string></string>
+                       <key>MaxInstances</key>
+                       <string>1</string>
+                       <key>Module</key>
+                       <string>PBXBuildResultsModule</string>
+                       <key>Name</key>
+                       <string>Detailed Build Results Viewer</string>
+               </dict>
+               <dict>
+                       <key>BundleLoadPath</key>
+                       <string></string>
+                       <key>MaxInstances</key>
+                       <string>1</string>
+                       <key>Module</key>
+                       <string>PBXProjectFindModule</string>
+                       <key>Name</key>
+                       <string>Project Batch Find Tool</string>
+               </dict>
+               <dict>
+                       <key>BundleLoadPath</key>
+                       <string></string>
+                       <key>MaxInstances</key>
+                       <string>n</string>
+                       <key>Module</key>
+                       <string>XCProjectFormatConflictsModule</string>
+                       <key>Name</key>
+                       <string>Project Format Conflicts List</string>
+               </dict>
+               <dict>
+                       <key>BundleLoadPath</key>
+                       <string></string>
+                       <key>MaxInstances</key>
+                       <string>n</string>
+                       <key>Module</key>
+                       <string>PBXBookmarksModule</string>
+                       <key>Name</key>
+                       <string>Bookmarks Tool</string>
+               </dict>
+               <dict>
+                       <key>BundleLoadPath</key>
+                       <string></string>
+                       <key>MaxInstances</key>
+                       <string>n</string>
+                       <key>Module</key>
+                       <string>PBXClassBrowserModule</string>
+                       <key>Name</key>
+                       <string>Class Browser</string>
+               </dict>
+               <dict>
+                       <key>BundleLoadPath</key>
+                       <string></string>
+                       <key>MaxInstances</key>
+                       <string>n</string>
+                       <key>Module</key>
+                       <string>PBXCVSModule</string>
+                       <key>Name</key>
+                       <string>Source Code Control Tool</string>
+               </dict>
+               <dict>
+                       <key>BundleLoadPath</key>
+                       <string></string>
+                       <key>MaxInstances</key>
+                       <string>n</string>
+                       <key>Module</key>
+                       <string>PBXDebugBreakpointsModule</string>
+                       <key>Name</key>
+                       <string>Debug Breakpoints Tool</string>
+               </dict>
+               <dict>
+                       <key>BundleLoadPath</key>
+                       <string></string>
+                       <key>MaxInstances</key>
+                       <string>n</string>
+                       <key>Module</key>
+                       <string>XCDockableInspector</string>
+                       <key>Name</key>
+                       <string>Inspector</string>
+               </dict>
+               <dict>
+                       <key>BundleLoadPath</key>
+                       <string></string>
+                       <key>MaxInstances</key>
+                       <string>n</string>
+                       <key>Module</key>
+                       <string>PBXOpenQuicklyModule</string>
+                       <key>Name</key>
+                       <string>Open Quickly Tool</string>
+               </dict>
+               <dict>
+                       <key>BundleLoadPath</key>
+                       <string></string>
+                       <key>MaxInstances</key>
+                       <string>1</string>
+                       <key>Module</key>
+                       <string>PBXDebugSessionModule</string>
+                       <key>Name</key>
+                       <string>Debugger</string>
+               </dict>
+               <dict>
+                       <key>BundleLoadPath</key>
+                       <string></string>
+                       <key>MaxInstances</key>
+                       <string>1</string>
+                       <key>Module</key>
+                       <string>PBXDebugCLIModule</string>
+                       <key>Name</key>
+                       <string>Debug Console</string>
+               </dict>
+               <dict>
+                       <key>BundleLoadPath</key>
+                       <string></string>
+                       <key>MaxInstances</key>
+                       <string>n</string>
+                       <key>Module</key>
+                       <string>XCSnapshotModule</string>
+                       <key>Name</key>
+                       <string>Snapshots Tool</string>
+               </dict>
+       </array>
+       <key>Description</key>
+       <string>DefaultDescriptionKey</string>
+       <key>DockingSystemVisible</key>
+       <false/>
+       <key>Extension</key>
+       <string>mode1v3</string>
+       <key>FavBarConfig</key>
+       <dict>
+               <key>PBXProjectModuleGUID</key>
+               <string>025881920CF13C0400681C7E</string>
+               <key>XCBarModuleItemNames</key>
+               <dict/>
+               <key>XCBarModuleItems</key>
+               <array/>
+       </dict>
+       <key>FirstTimeWindowDisplayed</key>
+       <false/>
+       <key>Identifier</key>
+       <string>com.apple.perspectives.project.mode1v3</string>
+       <key>MajorVersion</key>
+       <integer>33</integer>
+       <key>MinorVersion</key>
+       <integer>0</integer>
+       <key>Name</key>
+       <string>Default</string>
+       <key>Notifications</key>
+       <array>
+               <dict>
+                       <key>XCObserverAutoDisconnectKey</key>
+                       <true/>
+                       <key>XCObserverDefintionKey</key>
+                       <dict/>
+                       <key>XCObserverFactoryKey</key>
+                       <string>XCPerspectivesSpecificationIdentifier</string>
+                       <key>XCObserverGUIDKey</key>
+                       <string>XCObserverProjectIdentifier</string>
+                       <key>XCObserverNotificationKey</key>
+                       <string>PBXStatusBuildStateMessageNotification</string>
+                       <key>XCObserverTargetKey</key>
+                       <string>XCMainBuildResultsModuleGUID</string>
+                       <key>XCObserverTriggerKey</key>
+                       <string>awakenModuleWithObserver:</string>
+                       <key>XCObserverValidationKey</key>
+                       <dict/>
+               </dict>
+       </array>
+       <key>OpenEditors</key>
+       <array/>
+       <key>PerspectiveWidths</key>
+       <array>
+               <integer>1079</integer>
+               <integer>300</integer>
+       </array>
+       <key>Perspectives</key>
+       <array>
+               <dict>
+                       <key>ChosenToolbarItems</key>
+                       <array>
+                               <string>active-combo-popup</string>
+                               <string>action</string>
+                               <string>NSToolbarFlexibleSpaceItem</string>
+                               <string>debugger-enable-breakpoints</string>
+                               <string>build-and-go</string>
+                               <string>buildOrClean</string>
+                               <string>com.apple.ide.PBXToolbarStopButton</string>
+                               <string>get-info</string>
+                               <string>show-inspector</string>
+                               <string>NSToolbarFlexibleSpaceItem</string>
+                               <string>servicesModuleCVS</string>
+                               <string>servicesModuledebug</string>
+                               <string>servicesModulebreakpoints</string>
+                               <string>servicesModulefind</string>
+                               <string>com.apple.pbx.toolbar.searchfield</string>
+                       </array>
+                       <key>ControllerClassBaseName</key>
+                       <string></string>
+                       <key>IconName</key>
+                       <string>WindowOfProjectWithEditor</string>
+                       <key>Identifier</key>
+                       <string>perspective.project</string>
+                       <key>IsVertical</key>
+                       <false/>
+                       <key>Layout</key>
+                       <array>
+                               <dict>
+                                       <key>ContentConfiguration</key>
+                                       <dict>
+                                               <key>PBXBottomSmartGroupGIDs</key>
+                                               <array>
+                                                       <string>1C37FBAC04509CD000000102</string>
+                                                       <string>1C37FAAC04509CD000000102</string>
+                                                       <string>1C37FABC05509CD000000102</string>
+                                                       <string>1C37FABC05539CD112110102</string>
+                                                       <string>E2644B35053B69B200211256</string>
+                                                       <string>1C37FABC04509CD000100104</string>
+                                                       <string>1CC0EA4004350EF90044410B</string>
+                                                       <string>1CC0EA4004350EF90041110B</string>
+                                               </array>
+                                               <key>PBXProjectModuleGUID</key>
+                                               <string>1CE0B1FE06471DED0097A5F4</string>
+                                               <key>PBXProjectModuleLabel</key>
+                                               <string>Files</string>
+                                               <key>PBXProjectStructureProvided</key>
+                                               <string>yes</string>
+                                               <key>PBXSmartGroupTreeModuleColumnData</key>
+                                               <dict>
+                                                       <key>PBXSmartGroupTreeModuleColumnWidthsKey</key>
+                                                       <array>
+                                                               <real>22</real>
+                                                               <real>22</real>
+                                                               <real>260</real>
+                                                       </array>
+                                                       <key>PBXSmartGroupTreeModuleColumnsKey_v4</key>
+                                                       <array>
+                                                               <string>TargetStatusColumn</string>
+                                                               <string>SCMStatusColumn</string>
+                                                               <string>MainColumn</string>
+                                                       </array>
+                                               </dict>
+                                               <key>PBXSmartGroupTreeModuleOutlineStateKey_v7</key>
+                                               <dict>
+                                                       <key>PBXSmartGroupTreeModuleOutlineStateExpansionKey</key>
+                                                       <array>
+                                                               <string>08FB7794FE84155DC02AAC07</string>
+                                                               <string>02FE65020BFE669B004A1450</string>
+                                                               <string>08FB7795FE84155DC02AAC07</string>
+                                                               <string>0296A45909D9AE9400F80AFF</string>
+                                                               <string>02D46C140FED492C00E65706</string>
+                                                               <string>020D47700A1691F10027E24E</string>
+                                                               <string>1C37FAAC04509CD000000102</string>
+                                                               <string>1C37FABC05509CD000000102</string>
+                                                       </array>
+                                                       <key>PBXSmartGroupTreeModuleOutlineStateSelectionKey</key>
+                                                       <array>
+                                                               <array>
+                                                                       <integer>26</integer>
+                                                                       <integer>11</integer>
+                                                                       <integer>7</integer>
+                                                                       <integer>0</integer>
+                                                               </array>
+                                                       </array>
+                                                       <key>PBXSmartGroupTreeModuleOutlineStateVisibleRectKey</key>
+                                                       <string>{{0, 44}, {304, 1080}}</string>
+                                               </dict>
+                                               <key>PBXTopSmartGroupGIDs</key>
+                                               <array/>
+                                               <key>XCIncludePerspectivesSwitch</key>
+                                               <true/>
+                                               <key>XCSharingToken</key>
+                                               <string>com.apple.Xcode.GFSharingToken</string>
+                                       </dict>
+                                       <key>GeometryConfiguration</key>
+                                       <dict>
+                                               <key>Frame</key>
+                                               <string>{{0, 0}, {321, 1098}}</string>
+                                               <key>GroupTreeTableConfiguration</key>
+                                               <array>
+                                                       <string>TargetStatusColumn</string>
+                                                       <real>22</real>
+                                                       <string>SCMStatusColumn</string>
+                                                       <real>22</real>
+                                                       <string>MainColumn</string>
+                                                       <real>260</real>
+                                               </array>
+                                               <key>RubberWindowFrame</key>
+                                               <string>19 39 1197 1139 0 0 1920 1178 </string>
+                                       </dict>
+                                       <key>Module</key>
+                                       <string>PBXSmartGroupTreeModule</string>
+                                       <key>Proportion</key>
+                                       <string>321pt</string>
+                               </dict>
+                               <dict>
+                                       <key>Dock</key>
+                                       <array>
+                                               <dict>
+                                                       <key>BecomeActive</key>
+                                                       <true/>
+                                                       <key>ContentConfiguration</key>
+                                                       <dict>
+                                                               <key>PBXProjectModuleGUID</key>
+                                                               <string>1CE0B20306471E060097A5F4</string>
+                                                               <key>PBXProjectModuleLabel</key>
+                                                               <string>elftosb.cpp</string>
+                                                               <key>PBXSplitModuleInNavigatorKey</key>
+                                                               <dict>
+                                                                       <key>Split0</key>
+                                                                       <dict>
+                                                                               <key>PBXProjectModuleGUID</key>
+                                                                               <string>1CE0B20406471E060097A5F4</string>
+                                                                               <key>PBXProjectModuleLabel</key>
+                                                                               <string>elftosb.cpp</string>
+                                                                               <key>_historyCapacity</key>
+                                                                               <integer>0</integer>
+                                                                               <key>bookmark</key>
+                                                                               <string>022B47721218CDBF00A74F96</string>
+                                                                               <key>history</key>
+                                                                               <array>
+                                                                                       <string>021CA4400A8D2F740028326F</string>
+                                                                                       <string>021CA4420A8D2F740028326F</string>
+                                                                                       <string>02C5DBD20A926A7F003B9C11</string>
+                                                                                       <string>02C5DBDB0A926A7F003B9C11</string>
+                                                                                       <string>02C5DC310A93C14E003B9C11</string>
+                                                                                       <string>02C5DC330A93C14E003B9C11</string>
+                                                                                       <string>02C5DC350A93C14E003B9C11</string>
+                                                                                       <string>02C5DCB50A93CA0A003B9C11</string>
+                                                                                       <string>02C5DD520A93D327003B9C11</string>
+                                                                                       <string>02C5DDCD0A940126003B9C11</string>
+                                                                                       <string>02C5DDCF0A940126003B9C11</string>
+                                                                                       <string>02CAC9BA0BA06EA50020B29B</string>
+                                                                                       <string>02D1FD190BD039BF007C7450</string>
+                                                                                       <string>02D1FE2E0BD1505E007C7450</string>
+                                                                                       <string>027EE3C30BD6930A00A6A136</string>
+                                                                                       <string>027EE3C80BD6930A00A6A136</string>
+                                                                                       <string>02FE651B0BFF94B2004A1450</string>
+                                                                                       <string>02E535CF0C24641A00CBD4A5</string>
+                                                                                       <string>02E535D00C24641A00CBD4A5</string>
+                                                                                       <string>02E535D20C24641A00CBD4A5</string>
+                                                                                       <string>02E535D40C24641A00CBD4A5</string>
+                                                                                       <string>02E535D70C24641A00CBD4A5</string>
+                                                                                       <string>02E535D90C24641A00CBD4A5</string>
+                                                                                       <string>02E535F10C24641A00CBD4A5</string>
+                                                                                       <string>02E5362D0C38763700CBD4A5</string>
+                                                                                       <string>02E536320C38763700CBD4A5</string>
+                                                                                       <string>02E536360C38763700CBD4A5</string>
+                                                                                       <string>02E5363F0C3C4FF000CBD4A5</string>
+                                                                                       <string>024A0F200C53B9D8000317D4</string>
+                                                                                       <string>0292B60E0CDA9CFD00A3A500</string>
+                                                                                       <string>0292B60F0CDA9CFD00A3A500</string>
+                                                                                       <string>0292B6100CDA9CFD00A3A500</string>
+                                                                                       <string>0292B6170CDA9CFD00A3A500</string>
+                                                                                       <string>0292B6180CDA9CFD00A3A500</string>
+                                                                                       <string>0258817C0CF13C0400681C7E</string>
+                                                                                       <string>025881810CF13C0400681C7E</string>
+                                                                                       <string>025881850CF13C0400681C7E</string>
+                                                                                       <string>025881860CF13C0400681C7E</string>
+                                                                                       <string>025881890CF13C0400681C7E</string>
+                                                                                       <string>0234AF900D69029300A16BFF</string>
+                                                                                       <string>0234AF910D69029300A16BFF</string>
+                                                                                       <string>0234AF920D69029300A16BFF</string>
+                                                                                       <string>0234AF930D69029300A16BFF</string>
+                                                                                       <string>0234AF950D69029300A16BFF</string>
+                                                                                       <string>0234AF970D69029300A16BFF</string>
+                                                                                       <string>0234AF9A0D69029300A16BFF</string>
+                                                                                       <string>0234AF9C0D69029300A16BFF</string>
+                                                                                       <string>0234AF9D0D69029300A16BFF</string>
+                                                                                       <string>0234AFA00D69029300A16BFF</string>
+                                                                                       <string>02D46C3F0FED5C3600E65706</string>
+                                                                                       <string>02D46C690FED5F4B00E65706</string>
+                                                                                       <string>02D46D1A0FED80BF00E65706</string>
+                                                                                       <string>02D795420FF00D8B00C1C5DF</string>
+                                                                                       <string>02D795430FF00D8B00C1C5DF</string>
+                                                                                       <string>02D795450FF00D8B00C1C5DF</string>
+                                                                                       <string>02D795460FF00D8B00C1C5DF</string>
+                                                                                       <string>02D795470FF00D8B00C1C5DF</string>
+                                                                                       <string>02D795480FF00D8B00C1C5DF</string>
+                                                                                       <string>02D795490FF00D8B00C1C5DF</string>
+                                                                                       <string>02D7954D0FF00D8B00C1C5DF</string>
+                                                                                       <string>02D6133010F28A6500B7DF2F</string>
+                                                                                       <string>02D6138C10F3E89000B7DF2F</string>
+                                                                                       <string>02D6138E10F3E89000B7DF2F</string>
+                                                                                       <string>02D6139110F3E89000B7DF2F</string>
+                                                                                       <string>02D6139510F3E89000B7DF2F</string>
+                                                                                       <string>02D6139710F3E89000B7DF2F</string>
+                                                                                       <string>02D6139810F3E89000B7DF2F</string>
+                                                                                       <string>02D6139910F3E89000B7DF2F</string>
+                                                                                       <string>022B461D1216FEA700A74F96</string>
+                                                                                       <string>022B468B1218659A00A74F96</string>
+                                                                                       <string>022B468D1218659A00A74F96</string>
+                                                                                       <string>022B468E1218659A00A74F96</string>
+                                                                                       <string>022B468F1218659A00A74F96</string>
+                                                                                       <string>022B46901218659A00A74F96</string>
+                                                                                       <string>022B46921218659A00A74F96</string>
+                                                                                       <string>022B46931218659A00A74F96</string>
+                                                                                       <string>022B46941218659A00A74F96</string>
+                                                                                       <string>022B46951218659A00A74F96</string>
+                                                                                       <string>022B47281218C17F00A74F96</string>
+                                                                                       <string>022B47391218C46A00A74F96</string>
+                                                                                       <string>022B473A1218C46A00A74F96</string>
+                                                                                       <string>022B474B1218CA9A00A74F96</string>
+                                                                                       <string>022B474C1218CA9A00A74F96</string>
+                                                                                       <string>022B476F1218CDBF00A74F96</string>
+                                                                                       <string>022B47701218CDBF00A74F96</string>
+                                                                                       <string>022B47711218CDBF00A74F96</string>
+                                                                               </array>
+                                                                       </dict>
+                                                                       <key>SplitCount</key>
+                                                                       <string>1</string>
+                                                               </dict>
+                                                               <key>StatusBarVisibility</key>
+                                                               <true/>
+                                                       </dict>
+                                                       <key>GeometryConfiguration</key>
+                                                       <dict>
+                                                               <key>Frame</key>
+                                                               <string>{{0, 0}, {871, 1093}}</string>
+                                                               <key>RubberWindowFrame</key>
+                                                               <string>19 39 1197 1139 0 0 1920 1178 </string>
+                                                       </dict>
+                                                       <key>Module</key>
+                                                       <string>PBXNavigatorGroup</string>
+                                                       <key>Proportion</key>
+                                                       <string>1093pt</string>
+                                               </dict>
+                                               <dict>
+                                                       <key>ContentConfiguration</key>
+                                                       <dict>
+                                                               <key>PBXProjectModuleGUID</key>
+                                                               <string>1CE0B20506471E060097A5F4</string>
+                                                               <key>PBXProjectModuleLabel</key>
+                                                               <string>Detail</string>
+                                                       </dict>
+                                                       <key>GeometryConfiguration</key>
+                                                       <dict>
+                                                               <key>Frame</key>
+                                                               <string>{{0, 1098}, {871, 0}}</string>
+                                                               <key>RubberWindowFrame</key>
+                                                               <string>19 39 1197 1139 0 0 1920 1178 </string>
+                                                       </dict>
+                                                       <key>Module</key>
+                                                       <string>XCDetailModule</string>
+                                                       <key>Proportion</key>
+                                                       <string>0pt</string>
+                                               </dict>
+                                       </array>
+                                       <key>Proportion</key>
+                                       <string>871pt</string>
+                               </dict>
+                       </array>
+                       <key>Name</key>
+                       <string>Project</string>
+                       <key>ServiceClasses</key>
+                       <array>
+                               <string>XCModuleDock</string>
+                               <string>PBXSmartGroupTreeModule</string>
+                               <string>XCModuleDock</string>
+                               <string>PBXNavigatorGroup</string>
+                               <string>XCDetailModule</string>
+                       </array>
+                       <key>TableOfContents</key>
+                       <array>
+                               <string>022B46261216FEA700A74F96</string>
+                               <string>1CE0B1FE06471DED0097A5F4</string>
+                               <string>022B46271216FEA700A74F96</string>
+                               <string>1CE0B20306471E060097A5F4</string>
+                               <string>1CE0B20506471E060097A5F4</string>
+                       </array>
+                       <key>ToolbarConfigUserDefaultsMinorVersion</key>
+                       <string>2</string>
+                       <key>ToolbarConfiguration</key>
+                       <string>xcode.toolbar.config.defaultV3</string>
+               </dict>
+               <dict>
+                       <key>ChosenToolbarItems</key>
+                       <array>
+                               <string>XCToolbarPerspectiveControl</string>
+                               <string>NSToolbarSeparatorItem</string>
+                               <string>buildOrClean</string>
+                               <string>build-and-goOrGo</string>
+                               <string>debugger-enable-breakpoints</string>
+                               <string>com.apple.ide.PBXToolbarStopButton</string>
+                               <string>NSToolbarFlexibleSpaceItem</string>
+                               <string>get-info</string>
+                       </array>
+                       <key>ControllerClassBaseName</key>
+                       <string></string>
+                       <key>IconName</key>
+                       <string>WindowOfProject</string>
+                       <key>Identifier</key>
+                       <string>perspective.morph</string>
+                       <key>IsVertical</key>
+                       <false/>
+                       <key>Layout</key>
+                       <array>
+                               <dict>
+                                       <key>ContentConfiguration</key>
+                                       <dict>
+                                               <key>PBXBottomSmartGroupGIDs</key>
+                                               <array>
+                                                       <string>1C37FBAC04509CD000000102</string>
+                                                       <string>1C37FAAC04509CD000000102</string>
+                                                       <string>1C08E77C0454961000C914BD</string>
+                                                       <string>1C37FABC05509CD000000102</string>
+                                                       <string>1C37FABC05539CD112110102</string>
+                                                       <string>E2644B35053B69B200211256</string>
+                                                       <string>1C37FABC04509CD000100104</string>
+                                                       <string>1CC0EA4004350EF90044410B</string>
+                                                       <string>1CC0EA4004350EF90041110B</string>
+                                               </array>
+                                               <key>PBXProjectModuleGUID</key>
+                                               <string>11E0B1FE06471DED0097A5F4</string>
+                                               <key>PBXProjectModuleLabel</key>
+                                               <string>Files</string>
+                                               <key>PBXProjectStructureProvided</key>
+                                               <string>yes</string>
+                                               <key>PBXSmartGroupTreeModuleColumnData</key>
+                                               <dict>
+                                                       <key>PBXSmartGroupTreeModuleColumnWidthsKey</key>
+                                                       <array>
+                                                               <real>22</real>
+                                                               <real>22</real>
+                                                               <real>239</real>
+                                                       </array>
+                                                       <key>PBXSmartGroupTreeModuleColumnsKey_v4</key>
+                                                       <array>
+                                                               <string>TargetStatusColumn</string>
+                                                               <string>SCMStatusColumn</string>
+                                                               <string>MainColumn</string>
+                                                       </array>
+                                               </dict>
+                                               <key>PBXSmartGroupTreeModuleOutlineStateKey_v7</key>
+                                               <dict>
+                                                       <key>PBXSmartGroupTreeModuleOutlineStateExpansionKey</key>
+                                                       <array>
+                                                               <string>08FB7794FE84155DC02AAC07</string>
+                                                               <string>02FE65020BFE669B004A1450</string>
+                                                               <string>08FB7795FE84155DC02AAC07</string>
+                                                               <string>0296A45909D9AE9400F80AFF</string>
+                                                               <string>020D47700A1691F10027E24E</string>
+                                                               <string>1C37FBAC04509CD000000102</string>
+                                                               <string>1C37FAAC04509CD000000102</string>
+                                                               <string>1C37FABC05509CD000000102</string>
+                                                       </array>
+                                                       <key>PBXSmartGroupTreeModuleOutlineStateSelectionKey</key>
+                                                       <array>
+                                                               <array>
+                                                                       <integer>42</integer>
+                                                                       <integer>7</integer>
+                                                                       <integer>0</integer>
+                                                               </array>
+                                                       </array>
+                                                       <key>PBXSmartGroupTreeModuleOutlineStateVisibleRectKey</key>
+                                                       <string>{{0, 0}, {283, 782}}</string>
+                                               </dict>
+                                               <key>PBXTopSmartGroupGIDs</key>
+                                               <array/>
+                                               <key>XCIncludePerspectivesSwitch</key>
+                                               <true/>
+                                               <key>XCSharingToken</key>
+                                               <string>com.apple.Xcode.GFSharingToken</string>
+                                       </dict>
+                                       <key>GeometryConfiguration</key>
+                                       <dict>
+                                               <key>Frame</key>
+                                               <string>{{0, 0}, {300, 800}}</string>
+                                               <key>GroupTreeTableConfiguration</key>
+                                               <array>
+                                                       <string>TargetStatusColumn</string>
+                                                       <real>22</real>
+                                                       <string>SCMStatusColumn</string>
+                                                       <real>22</real>
+                                                       <string>MainColumn</string>
+                                                       <real>239</real>
+                                               </array>
+                                       </dict>
+                                       <key>Module</key>
+                                       <string>PBXSmartGroupTreeModule</string>
+                                       <key>Proportion</key>
+                                       <string>300pt</string>
+                               </dict>
+                       </array>
+                       <key>Name</key>
+                       <string>Morph</string>
+                       <key>PreferredWidth</key>
+                       <integer>300</integer>
+                       <key>ServiceClasses</key>
+                       <array>
+                               <string>XCModuleDock</string>
+                               <string>PBXSmartGroupTreeModule</string>
+                       </array>
+                       <key>TableOfContents</key>
+                       <array>
+                               <string>025881910CF13C0400681C7E</string>
+                               <string>11E0B1FE06471DED0097A5F4</string>
+                       </array>
+                       <key>ToolbarConfiguration</key>
+                       <string>xcode.toolbar.config.default.shortV3</string>
+               </dict>
+       </array>
+       <key>PerspectivesBarVisible</key>
+       <false/>
+       <key>ShelfIsVisible</key>
+       <false/>
+       <key>StatusbarIsVisible</key>
+       <true/>
+       <key>TimeStamp</key>
+       <real>303615423.96806198</real>
+       <key>ToolbarDisplayMode</key>
+       <integer>2</integer>
+       <key>ToolbarIsVisible</key>
+       <true/>
+       <key>ToolbarSizeMode</key>
+       <integer>1</integer>
+       <key>Type</key>
+       <string>Perspectives</string>
+       <key>UpdateMessage</key>
+       <string>The Default Workspace in this version of Xcode now includes support to hide and show the detail view (what has been referred to as the "Metro-Morph" feature).  You must discard your current Default Workspace settings and update to the latest Default Workspace in order to gain this feature.  Do you wish to update to the latest Workspace defaults for project '%@'?</string>
+       <key>WindowJustification</key>
+       <integer>5</integer>
+       <key>WindowOrderList</key>
+       <array>
+               <string>022B46991218659A00A74F96</string>
+               <string>022B469A1218659A00A74F96</string>
+               <string>02D46D160FED80AF00E65706</string>
+               <string>1CD10A99069EF8BA00B06720</string>
+               <string>1C530D57069F1CE1000CFCEE</string>
+               <string>025880F00CEE3D1200681C7E</string>
+               <string>/Users/creed/projects/fsl/fromsvr/elftosb/elftosb.xcodeproj</string>
+               <string>1C78EAAD065D492600B07095</string>
+       </array>
+       <key>WindowString</key>
+       <string>19 39 1197 1139 0 0 1920 1178 </string>
+       <key>WindowToolsV3</key>
+       <array>
+               <dict>
+                       <key>FirstTimeWindowDisplayed</key>
+                       <false/>
+                       <key>Identifier</key>
+                       <string>windowTool.build</string>
+                       <key>IsVertical</key>
+                       <true/>
+                       <key>Layout</key>
+                       <array>
+                               <dict>
+                                       <key>Dock</key>
+                                       <array>
+                                               <dict>
+                                                       <key>ContentConfiguration</key>
+                                                       <dict>
+                                                               <key>PBXProjectModuleGUID</key>
+                                                               <string>1CD0528F0623707200166675</string>
+                                                               <key>PBXProjectModuleLabel</key>
+                                                               <string>ElftosbAST.cpp</string>
+                                                               <key>StatusBarVisibility</key>
+                                                               <true/>
+                                                       </dict>
+                                                       <key>GeometryConfiguration</key>
+                                                       <dict>
+                                                               <key>Frame</key>
+                                                               <string>{{0, 0}, {744, 171}}</string>
+                                                               <key>RubberWindowFrame</key>
+                                                               <string>1048 148 744 502 0 0 1920 1178 </string>
+                                                       </dict>
+                                                       <key>Module</key>
+                                                       <string>PBXNavigatorGroup</string>
+                                                       <key>Proportion</key>
+                                                       <string>171pt</string>
+                                               </dict>
+                                               <dict>
+                                                       <key>BecomeActive</key>
+                                                       <true/>
+                                                       <key>ContentConfiguration</key>
+                                                       <dict>
+                                                               <key>PBXProjectModuleGUID</key>
+                                                               <string>XCMainBuildResultsModuleGUID</string>
+                                                               <key>PBXProjectModuleLabel</key>
+                                                               <string>Build Results</string>
+                                                               <key>XCBuildResultsTrigger_Collapse</key>
+                                                               <integer>1022</integer>
+                                                               <key>XCBuildResultsTrigger_Open</key>
+                                                               <integer>1010</integer>
+                                                       </dict>
+                                                       <key>GeometryConfiguration</key>
+                                                       <dict>
+                                                               <key>Frame</key>
+                                                               <string>{{0, 176}, {744, 285}}</string>
+                                                               <key>RubberWindowFrame</key>
+                                                               <string>1048 148 744 502 0 0 1920 1178 </string>
+                                                       </dict>
+                                                       <key>Module</key>
+                                                       <string>PBXBuildResultsModule</string>
+                                                       <key>Proportion</key>
+                                                       <string>285pt</string>
+                                               </dict>
+                                       </array>
+                                       <key>Proportion</key>
+                                       <string>461pt</string>
+                               </dict>
+                       </array>
+                       <key>Name</key>
+                       <string>Build Results</string>
+                       <key>ServiceClasses</key>
+                       <array>
+                               <string>PBXBuildResultsModule</string>
+                       </array>
+                       <key>StatusbarIsVisible</key>
+                       <true/>
+                       <key>TableOfContents</key>
+                       <array>
+                               <string>025880F00CEE3D1200681C7E</string>
+                               <string>022B461512136A6A00A74F96</string>
+                               <string>1CD0528F0623707200166675</string>
+                               <string>XCMainBuildResultsModuleGUID</string>
+                       </array>
+                       <key>ToolbarConfiguration</key>
+                       <string>xcode.toolbar.config.buildV3</string>
+                       <key>WindowString</key>
+                       <string>1048 148 744 502 0 0 1920 1178 </string>
+                       <key>WindowToolGUID</key>
+                       <string>025880F00CEE3D1200681C7E</string>
+                       <key>WindowToolIsVisible</key>
+                       <false/>
+               </dict>
+               <dict>
+                       <key>FirstTimeWindowDisplayed</key>
+                       <false/>
+                       <key>Identifier</key>
+                       <string>windowTool.debugger</string>
+                       <key>IsVertical</key>
+                       <true/>
+                       <key>Layout</key>
+                       <array>
+                               <dict>
+                                       <key>Dock</key>
+                                       <array>
+                                               <dict>
+                                                       <key>ContentConfiguration</key>
+                                                       <dict>
+                                                               <key>Debugger</key>
+                                                               <dict>
+                                                                       <key>HorizontalSplitView</key>
+                                                                       <dict>
+                                                                               <key>_collapsingFrameDimension</key>
+                                                                               <real>0.0</real>
+                                                                               <key>_indexOfCollapsedView</key>
+                                                                               <integer>0</integer>
+                                                                               <key>_percentageOfCollapsedView</key>
+                                                                               <real>0.0</real>
+                                                                               <key>isCollapsed</key>
+                                                                               <string>yes</string>
+                                                                               <key>sizes</key>
+                                                                               <array>
+                                                                                       <string>{{0, 0}, {308, 302}}</string>
+                                                                                       <string>{{0, 302}, {308, 479}}</string>
+                                                                               </array>
+                                                                       </dict>
+                                                                       <key>VerticalSplitView</key>
+                                                                       <dict>
+                                                                               <key>_collapsingFrameDimension</key>
+                                                                               <real>0.0</real>
+                                                                               <key>_indexOfCollapsedView</key>
+                                                                               <integer>0</integer>
+                                                                               <key>_percentageOfCollapsedView</key>
+                                                                               <real>0.0</real>
+                                                                               <key>isCollapsed</key>
+                                                                               <string>yes</string>
+                                                                               <key>sizes</key>
+                                                                               <array>
+                                                                                       <string>{{0, 0}, {308, 781}}</string>
+                                                                                       <string>{{308, 0}, {791, 781}}</string>
+                                                                               </array>
+                                                                       </dict>
+                                                               </dict>
+                                                               <key>LauncherConfigVersion</key>
+                                                               <string>8</string>
+                                                               <key>PBXProjectModuleGUID</key>
+                                                               <string>1C162984064C10D400B95A72</string>
+                                                               <key>PBXProjectModuleLabel</key>
+                                                               <string>Debug - GLUTExamples (Underwater)</string>
+                                                       </dict>
+                                                       <key>GeometryConfiguration</key>
+                                                       <dict>
+                                                               <key>DebugConsoleVisible</key>
+                                                               <string>None</string>
+                                                               <key>DebugConsoleWindowFrame</key>
+                                                               <string>{{200, 200}, {500, 300}}</string>
+                                                               <key>DebugSTDIOWindowFrame</key>
+                                                               <string>{{200, 200}, {500, 300}}</string>
+                                                               <key>Frame</key>
+                                                               <string>{{0, 0}, {1099, 781}}</string>
+                                                               <key>PBXDebugSessionStackFrameViewKey</key>
+                                                               <dict>
+                                                                       <key>DebugVariablesTableConfiguration</key>
+                                                                       <array>
+                                                                               <string>Name</string>
+                                                                               <real>120</real>
+                                                                               <string>Value</string>
+                                                                               <real>85</real>
+                                                                               <string>Summary</string>
+                                                                               <real>80</real>
+                                                                       </array>
+                                                                       <key>Frame</key>
+                                                                       <string>{{0, 302}, {308, 479}}</string>
+                                                                       <key>RubberWindowFrame</key>
+                                                                       <string>342 356 1099 822 0 0 1920 1178 </string>
+                                                               </dict>
+                                                               <key>RubberWindowFrame</key>
+                                                               <string>342 356 1099 822 0 0 1920 1178 </string>
+                                                       </dict>
+                                                       <key>Module</key>
+                                                       <string>PBXDebugSessionModule</string>
+                                                       <key>Proportion</key>
+                                                       <string>781pt</string>
+                                               </dict>
+                                       </array>
+                                       <key>Proportion</key>
+                                       <string>781pt</string>
+                               </dict>
+                       </array>
+                       <key>Name</key>
+                       <string>Debugger</string>
+                       <key>ServiceClasses</key>
+                       <array>
+                               <string>PBXDebugSessionModule</string>
+                       </array>
+                       <key>StatusbarIsVisible</key>
+                       <true/>
+                       <key>TableOfContents</key>
+                       <array>
+                               <string>1CD10A99069EF8BA00B06720</string>
+                               <string>022B4633121700F300A74F96</string>
+                               <string>1C162984064C10D400B95A72</string>
+                               <string>022B4634121700F300A74F96</string>
+                               <string>022B4635121700F300A74F96</string>
+                               <string>022B4636121700F300A74F96</string>
+                               <string>022B4637121700F300A74F96</string>
+                               <string>022B4638121700F300A74F96</string>
+                       </array>
+                       <key>ToolbarConfiguration</key>
+                       <string>xcode.toolbar.config.debugV3</string>
+                       <key>WindowString</key>
+                       <string>342 356 1099 822 0 0 1920 1178 </string>
+                       <key>WindowToolGUID</key>
+                       <string>1CD10A99069EF8BA00B06720</string>
+                       <key>WindowToolIsVisible</key>
+                       <false/>
+               </dict>
+               <dict>
+                       <key>FirstTimeWindowDisplayed</key>
+                       <false/>
+                       <key>Identifier</key>
+                       <string>windowTool.find</string>
+                       <key>IsVertical</key>
+                       <true/>
+                       <key>Layout</key>
+                       <array>
+                               <dict>
+                                       <key>Dock</key>
+                                       <array>
+                                               <dict>
+                                                       <key>Dock</key>
+                                                       <array>
+                                                               <dict>
+                                                                       <key>ContentConfiguration</key>
+                                                                       <dict>
+                                                                               <key>PBXProjectModuleGUID</key>
+                                                                               <string>1CDD528C0622207200134675</string>
+                                                                               <key>PBXProjectModuleLabel</key>
+                                                                               <string>Operation.cpp</string>
+                                                                               <key>StatusBarVisibility</key>
+                                                                               <true/>
+                                                                       </dict>
+                                                                       <key>GeometryConfiguration</key>
+                                                                       <dict>
+                                                                               <key>Frame</key>
+                                                                               <string>{{0, 0}, {792, 405}}</string>
+                                                                               <key>RubberWindowFrame</key>
+                                                                               <string>674 189 792 854 0 0 1920 1178 </string>
+                                                                       </dict>
+                                                                       <key>Module</key>
+                                                                       <string>PBXNavigatorGroup</string>
+                                                                       <key>Proportion</key>
+                                                                       <string>792pt</string>
+                                                               </dict>
+                                                       </array>
+                                                       <key>Proportion</key>
+                                                       <string>405pt</string>
+                                               </dict>
+                                               <dict>
+                                                       <key>BecomeActive</key>
+                                                       <true/>
+                                                       <key>ContentConfiguration</key>
+                                                       <dict>
+                                                               <key>PBXProjectModuleGUID</key>
+                                                               <string>1CD0528E0623707200166675</string>
+                                                               <key>PBXProjectModuleLabel</key>
+                                                               <string>Project Find</string>
+                                                       </dict>
+                                                       <key>GeometryConfiguration</key>
+                                                       <dict>
+                                                               <key>Frame</key>
+                                                               <string>{{0, 410}, {792, 403}}</string>
+                                                               <key>RubberWindowFrame</key>
+                                                               <string>674 189 792 854 0 0 1920 1178 </string>
+                                                       </dict>
+                                                       <key>Module</key>
+                                                       <string>PBXProjectFindModule</string>
+                                                       <key>Proportion</key>
+                                                       <string>403pt</string>
+                                               </dict>
+                                       </array>
+                                       <key>Proportion</key>
+                                       <string>813pt</string>
+                               </dict>
+                       </array>
+                       <key>Name</key>
+                       <string>Project Find</string>
+                       <key>ServiceClasses</key>
+                       <array>
+                               <string>PBXProjectFindModule</string>
+                       </array>
+                       <key>StatusbarIsVisible</key>
+                       <true/>
+                       <key>TableOfContents</key>
+                       <array>
+                               <string>1C530D57069F1CE1000CFCEE</string>
+                               <string>022B461B1216FE9C00A74F96</string>
+                               <string>022B461C1216FE9C00A74F96</string>
+                               <string>1CDD528C0622207200134675</string>
+                               <string>1CD0528E0623707200166675</string>
+                       </array>
+                       <key>WindowString</key>
+                       <string>674 189 792 854 0 0 1920 1178 </string>
+                       <key>WindowToolGUID</key>
+                       <string>1C530D57069F1CE1000CFCEE</string>
+                       <key>WindowToolIsVisible</key>
+                       <false/>
+               </dict>
+               <dict>
+                       <key>FirstTimeWindowDisplayed</key>
+                       <false/>
+                       <key>Identifier</key>
+                       <string>MENUSEPARATOR</string>
+               </dict>
+               <dict>
+                       <key>FirstTimeWindowDisplayed</key>
+                       <false/>
+                       <key>Identifier</key>
+                       <string>windowTool.debuggerConsole</string>
+                       <key>IsVertical</key>
+                       <true/>
+                       <key>Layout</key>
+                       <array>
+                               <dict>
+                                       <key>Dock</key>
+                                       <array>
+                                               <dict>
+                                                       <key>BecomeActive</key>
+                                                       <true/>
+                                                       <key>ContentConfiguration</key>
+                                                       <dict>
+                                                               <key>PBXProjectModuleGUID</key>
+                                                               <string>1C78EAAC065D492600B07095</string>
+                                                               <key>PBXProjectModuleLabel</key>
+                                                               <string>Debugger Console</string>
+                                                       </dict>
+                                                       <key>GeometryConfiguration</key>
+                                                       <dict>
+                                                               <key>Frame</key>
+                                                               <string>{{0, 0}, {734, 603}}</string>
+                                                               <key>RubberWindowFrame</key>
+                                                               <string>998 534 734 644 0 0 1920 1178 </string>
+                                                       </dict>
+                                                       <key>Module</key>
+                                                       <string>PBXDebugCLIModule</string>
+                                                       <key>Proportion</key>
+                                                       <string>603pt</string>
+                                               </dict>
+                                       </array>
+                                       <key>Proportion</key>
+                                       <string>603pt</string>
+                               </dict>
+                       </array>
+                       <key>Name</key>
+                       <string>Debugger Console</string>
+                       <key>ServiceClasses</key>
+                       <array>
+                               <string>PBXDebugCLIModule</string>
+                       </array>
+                       <key>StatusbarIsVisible</key>
+                       <true/>
+                       <key>TableOfContents</key>
+                       <array>
+                               <string>1C78EAAD065D492600B07095</string>
+                               <string>022B46821218654500A74F96</string>
+                               <string>1C78EAAC065D492600B07095</string>
+                       </array>
+                       <key>ToolbarConfiguration</key>
+                       <string>xcode.toolbar.config.consoleV3</string>
+                       <key>WindowString</key>
+                       <string>998 534 734 644 0 0 1920 1178 </string>
+                       <key>WindowToolGUID</key>
+                       <string>1C78EAAD065D492600B07095</string>
+                       <key>WindowToolIsVisible</key>
+                       <true/>
+               </dict>
+               <dict>
+                       <key>Identifier</key>
+                       <string>windowTool.snapshots</string>
+                       <key>Layout</key>
+                       <array>
+                               <dict>
+                                       <key>Dock</key>
+                                       <array>
+                                               <dict>
+                                                       <key>Module</key>
+                                                       <string>XCSnapshotModule</string>
+                                                       <key>Proportion</key>
+                                                       <string>100%</string>
+                                               </dict>
+                                       </array>
+                                       <key>Proportion</key>
+                                       <string>100%</string>
+                               </dict>
+                       </array>
+                       <key>Name</key>
+                       <string>Snapshots</string>
+                       <key>ServiceClasses</key>
+                       <array>
+                               <string>XCSnapshotModule</string>
+                       </array>
+                       <key>StatusbarIsVisible</key>
+                       <string>Yes</string>
+                       <key>ToolbarConfiguration</key>
+                       <string>xcode.toolbar.config.snapshots</string>
+                       <key>WindowString</key>
+                       <string>315 824 300 550 0 0 1440 878 </string>
+                       <key>WindowToolIsVisible</key>
+                       <string>Yes</string>
+               </dict>
+               <dict>
+                       <key>FirstTimeWindowDisplayed</key>
+                       <false/>
+                       <key>Identifier</key>
+                       <string>windowTool.scm</string>
+                       <key>IsVertical</key>
+                       <true/>
+                       <key>Layout</key>
+                       <array>
+                               <dict>
+                                       <key>Dock</key>
+                                       <array>
+                                               <dict>
+                                                       <key>ContentConfiguration</key>
+                                                       <dict>
+                                                               <key>PBXProjectModuleGUID</key>
+                                                               <string>1C78EAB2065D492600B07095</string>
+                                                               <key>PBXProjectModuleLabel</key>
+                                                               <string></string>
+                                                               <key>StatusBarVisibility</key>
+                                                               <true/>
+                                                       </dict>
+                                                       <key>GeometryConfiguration</key>
+                                                       <dict>
+                                                               <key>Frame</key>
+                                                               <string>{{0, 0}, {721, 0}}</string>
+                                                               <key>RubberWindowFrame</key>
+                                                               <string>1006 695 721 483 0 0 1920 1178 </string>
+                                                       </dict>
+                                                       <key>Module</key>
+                                                       <string>PBXNavigatorGroup</string>
+                                                       <key>Proportion</key>
+                                                       <string>0pt</string>
+                                               </dict>
+                                               <dict>
+                                                       <key>BecomeActive</key>
+                                                       <true/>
+                                                       <key>ContentConfiguration</key>
+                                                       <dict>
+                                                               <key>PBXCVSModuleFilterTypeKey</key>
+                                                               <integer>1032</integer>
+                                                               <key>PBXCVSModuleTreeModuleColumnData</key>
+                                                               <dict>
+                                                                       <key>PBXCVSModuleTreeModuleColumnWidthsKey</key>
+                                                                       <array>
+                                                                               <real>305</real>
+                                                                               <real>56</real>
+                                                                               <real>63</real>
+                                                                               <real>60</real>
+                                                                               <real>63</real>
+                                                                               <real>139</real>
+                                                                       </array>
+                                                                       <key>PBXCVSModuleTreeModuleColumnsKey</key>
+                                                                       <array>
+                                                                               <string>Name</string>
+                                                                               <string>Status</string>
+                                                                               <string>Update</string>
+                                                                               <string>Revision</string>
+                                                                               <string>Author</string>
+                                                                               <string>Date</string>
+                                                                       </array>
+                                                               </dict>
+                                                               <key>PBXProjectModuleGUID</key>
+                                                               <string>1CD052920623707200166675</string>
+                                                               <key>PBXProjectModuleLabel</key>
+                                                               <string>SCM Results</string>
+                                                               <key>SCMActivityViewerShowingDefaultKey</key>
+                                                               <string>{{0, 304}, {721, 133}}</string>
+                                                       </dict>
+                                                       <key>GeometryConfiguration</key>
+                                                       <dict>
+                                                               <key>Frame</key>
+                                                               <string>{{0, 5}, {721, 437}}</string>
+                                                               <key>RubberWindowFrame</key>
+                                                               <string>1006 695 721 483 0 0 1920 1178 </string>
+                                                       </dict>
+                                                       <key>Module</key>
+                                                       <string>PBXCVSModule</string>
+                                                       <key>Proportion</key>
+                                                       <string>437pt</string>
+                                               </dict>
+                                       </array>
+                                       <key>Proportion</key>
+                                       <string>442pt</string>
+                               </dict>
+                       </array>
+                       <key>Name</key>
+                       <string>SCM</string>
+                       <key>ServiceClasses</key>
+                       <array>
+                               <string>PBXCVSModule</string>
+                       </array>
+                       <key>StatusbarIsVisible</key>
+                       <true/>
+                       <key>TableOfContents</key>
+                       <array>
+                               <string>02D46D160FED80AF00E65706</string>
+                               <string>022B463B121700F300A74F96</string>
+                               <string>1C78EAB2065D492600B07095</string>
+                               <string>1CD052920623707200166675</string>
+                       </array>
+                       <key>ToolbarConfiguration</key>
+                       <string>xcode.toolbar.config.scm</string>
+                       <key>WindowString</key>
+                       <string>1006 695 721 483 0 0 1920 1178 </string>
+                       <key>WindowToolGUID</key>
+                       <string>02D46D160FED80AF00E65706</string>
+                       <key>WindowToolIsVisible</key>
+                       <false/>
+               </dict>
+               <dict>
+                       <key>FirstTimeWindowDisplayed</key>
+                       <false/>
+                       <key>Identifier</key>
+                       <string>windowTool.breakpoints</string>
+                       <key>IsVertical</key>
+                       <false/>
+                       <key>Layout</key>
+                       <array>
+                               <dict>
+                                       <key>Dock</key>
+                                       <array>
+                                               <dict>
+                                                       <key>ContentConfiguration</key>
+                                                       <dict>
+                                                               <key>PBXBottomSmartGroupGIDs</key>
+                                                               <array>
+                                                                       <string>1C77FABC04509CD000000102</string>
+                                                               </array>
+                                                               <key>PBXProjectModuleGUID</key>
+                                                               <string>1CE0B1FE06471DED0097A5F4</string>
+                                                               <key>PBXProjectModuleLabel</key>
+                                                               <string>Files</string>
+                                                               <key>PBXProjectStructureProvided</key>
+                                                               <string>no</string>
+                                                               <key>PBXSmartGroupTreeModuleColumnData</key>
+                                                               <dict>
+                                                                       <key>PBXSmartGroupTreeModuleColumnWidthsKey</key>
+                                                                       <array>
+                                                                               <real>168</real>
+                                                                       </array>
+                                                                       <key>PBXSmartGroupTreeModuleColumnsKey_v4</key>
+                                                                       <array>
+                                                                               <string>MainColumn</string>
+                                                                       </array>
+                                                               </dict>
+                                                               <key>PBXSmartGroupTreeModuleOutlineStateKey_v7</key>
+                                                               <dict>
+                                                                       <key>PBXSmartGroupTreeModuleOutlineStateExpansionKey</key>
+                                                                       <array>
+                                                                               <string>1C77FABC04509CD000000102</string>
+                                                                               <string>1C3E0DCA080725EA00A55177</string>
+                                                                       </array>
+                                                                       <key>PBXSmartGroupTreeModuleOutlineStateSelectionKey</key>
+                                                                       <array>
+                                                                               <array>
+                                                                                       <integer>0</integer>
+                                                                               </array>
+                                                                       </array>
+                                                                       <key>PBXSmartGroupTreeModuleOutlineStateVisibleRectKey</key>
+                                                                       <string>{{0, 0}, {168, 350}}</string>
+                                                               </dict>
+                                                               <key>PBXTopSmartGroupGIDs</key>
+                                                               <array/>
+                                                               <key>XCIncludePerspectivesSwitch</key>
+                                                               <false/>
+                                                       </dict>
+                                                       <key>GeometryConfiguration</key>
+                                                       <dict>
+                                                               <key>Frame</key>
+                                                               <string>{{0, 0}, {185, 368}}</string>
+                                                               <key>GroupTreeTableConfiguration</key>
+                                                               <array>
+                                                                       <string>MainColumn</string>
+                                                                       <real>168</real>
+                                                               </array>
+                                                               <key>RubberWindowFrame</key>
+                                                               <string>28 375 744 409 0 0 1440 878 </string>
+                                                       </dict>
+                                                       <key>Module</key>
+                                                       <string>PBXSmartGroupTreeModule</string>
+                                                       <key>Proportion</key>
+                                                       <string>185pt</string>
+                                               </dict>
+                                               <dict>
+                                                       <key>BecomeActive</key>
+                                                       <true/>
+                                                       <key>ContentConfiguration</key>
+                                                       <dict>
+                                                               <key>PBXProjectModuleGUID</key>
+                                                               <string>1CA1AED706398EBD00589147</string>
+                                                               <key>PBXProjectModuleLabel</key>
+                                                               <string>Detail</string>
+                                                       </dict>
+                                                       <key>GeometryConfiguration</key>
+                                                       <dict>
+                                                               <key>Frame</key>
+                                                               <string>{{190, 0}, {554, 368}}</string>
+                                                               <key>RubberWindowFrame</key>
+                                                               <string>28 375 744 409 0 0 1440 878 </string>
+                                                       </dict>
+                                                       <key>Module</key>
+                                                       <string>XCDetailModule</string>
+                                                       <key>Proportion</key>
+                                                       <string>554pt</string>
+                                               </dict>
+                                       </array>
+                                       <key>Proportion</key>
+                                       <string>368pt</string>
+                               </dict>
+                       </array>
+                       <key>MajorVersion</key>
+                       <integer>3</integer>
+                       <key>MinorVersion</key>
+                       <integer>0</integer>
+                       <key>Name</key>
+                       <string>Breakpoints</string>
+                       <key>ServiceClasses</key>
+                       <array>
+                               <string>PBXSmartGroupTreeModule</string>
+                               <string>XCDetailModule</string>
+                       </array>
+                       <key>StatusbarIsVisible</key>
+                       <true/>
+                       <key>TableOfContents</key>
+                       <array>
+                               <string>0258810E0CEE488000681C7E</string>
+                               <string>0258810F0CEE488000681C7E</string>
+                               <string>1CE0B1FE06471DED0097A5F4</string>
+                               <string>1CA1AED706398EBD00589147</string>
+                       </array>
+                       <key>ToolbarConfiguration</key>
+                       <string>xcode.toolbar.config.breakpointsV3</string>
+                       <key>WindowString</key>
+                       <string>28 375 744 409 0 0 1440 878 </string>
+                       <key>WindowToolGUID</key>
+                       <string>0258810E0CEE488000681C7E</string>
+                       <key>WindowToolIsVisible</key>
+                       <false/>
+               </dict>
+               <dict>
+                       <key>FirstTimeWindowDisplayed</key>
+                       <false/>
+                       <key>Identifier</key>
+                       <string>windowTool.debugAnimator</string>
+                       <key>Layout</key>
+                       <array>
+                               <dict>
+                                       <key>Dock</key>
+                                       <array>
+                                               <dict>
+                                                       <key>BecomeActive</key>
+                                                       <true/>
+                                                       <key>ContentConfiguration</key>
+                                                       <dict>
+                                                               <key>PBXProjectModuleGUID</key>
+                                                               <string>02E39A7909F721C80055992A</string>
+                                                               <key>PBXProjectModuleLabel</key>
+                                                               <string></string>
+                                                               <key>StatusBarVisibility</key>
+                                                               <true/>
+                                                       </dict>
+                                                       <key>GeometryConfiguration</key>
+                                                       <dict>
+                                                               <key>Frame</key>
+                                                               <string>{{0, 0}, {700, 459}}</string>
+                                                               <key>RubberWindowFrame</key>
+                                                               <string>36 211 700 500 0 0 1440 878 </string>
+                                                       </dict>
+                                                       <key>Module</key>
+                                                       <string>PBXNavigatorGroup</string>
+                                                       <key>Proportion</key>
+                                                       <string>459pt</string>
+                                               </dict>
+                                       </array>
+                                       <key>Proportion</key>
+                                       <string>459pt</string>
+                               </dict>
+                       </array>
+                       <key>Name</key>
+                       <string>Debug Visualizer</string>
+                       <key>ServiceClasses</key>
+                       <array>
+                               <string>PBXNavigatorGroup</string>
+                       </array>
+                       <key>StatusbarIsVisible</key>
+                       <true/>
+                       <key>ToolbarConfiguration</key>
+                       <string>xcode.toolbar.config.debugAnimatorV3</string>
+                       <key>WindowString</key>
+                       <string>36 211 700 500 0 0 1440 878 </string>
+               </dict>
+               <dict>
+                       <key>FirstTimeWindowDisplayed</key>
+                       <false/>
+                       <key>Identifier</key>
+                       <string>windowTool.bookmarks</string>
+                       <key>Layout</key>
+                       <array>
+                               <dict>
+                                       <key>Dock</key>
+                                       <array>
+                                               <dict>
+                                                       <key>Module</key>
+                                                       <string>PBXBookmarksModule</string>
+                                                       <key>Proportion</key>
+                                                       <string>100%</string>
+                                               </dict>
+                                       </array>
+                                       <key>Proportion</key>
+                                       <string>100%</string>
+                               </dict>
+                       </array>
+                       <key>Name</key>
+                       <string>Bookmarks</string>
+                       <key>ServiceClasses</key>
+                       <array>
+                               <string>PBXBookmarksModule</string>
+                       </array>
+                       <key>StatusbarIsVisible</key>
+                       <false/>
+                       <key>WindowString</key>
+                       <string>538 42 401 187 0 0 1280 1002 </string>
+               </dict>
+               <dict>
+                       <key>Identifier</key>
+                       <string>windowTool.projectFormatConflicts</string>
+                       <key>Layout</key>
+                       <array>
+                               <dict>
+                                       <key>Dock</key>
+                                       <array>
+                                               <dict>
+                                                       <key>Module</key>
+                                                       <string>XCProjectFormatConflictsModule</string>
+                                                       <key>Proportion</key>
+                                                       <string>100%</string>
+                                               </dict>
+                                       </array>
+                                       <key>Proportion</key>
+                                       <string>100%</string>
+                               </dict>
+                       </array>
+                       <key>Name</key>
+                       <string>Project Format Conflicts</string>
+                       <key>ServiceClasses</key>
+                       <array>
+                               <string>XCProjectFormatConflictsModule</string>
+                       </array>
+                       <key>StatusbarIsVisible</key>
+                       <false/>
+                       <key>WindowContentMinSize</key>
+                       <string>450 300</string>
+                       <key>WindowString</key>
+                       <string>50 850 472 307 0 0 1440 877</string>
+               </dict>
+               <dict>
+                       <key>FirstTimeWindowDisplayed</key>
+                       <false/>
+                       <key>Identifier</key>
+                       <string>windowTool.classBrowser</string>
+                       <key>Layout</key>
+                       <array>
+                               <dict>
+                                       <key>Dock</key>
+                                       <array>
+                                               <dict>
+                                                       <key>ContentConfiguration</key>
+                                                       <dict>
+                                                               <key>OptionsSetName</key>
+                                                               <string>Hierarchy, project classes</string>
+                                                               <key>PBXProjectModuleGUID</key>
+                                                               <string>1CA6456E063B45B4001379D8</string>
+                                                               <key>PBXProjectModuleLabel</key>
+                                                               <string>Class Browser - RijndaelCBCMAC</string>
+                                                       </dict>
+                                                       <key>GeometryConfiguration</key>
+                                                       <dict>
+                                                               <key>ClassesFrame</key>
+                                                               <string>{{0, 0}, {759, 298}}</string>
+                                                               <key>ClassesTreeTableConfiguration</key>
+                                                               <array>
+                                                                       <string>PBXClassNameColumnIdentifier</string>
+                                                                       <real>208</real>
+                                                                       <string>PBXClassBookColumnIdentifier</string>
+                                                                       <real>22</real>
+                                                               </array>
+                                                               <key>Frame</key>
+                                                               <string>{{0, 0}, {1011, 802}}</string>
+                                                               <key>MembersFrame</key>
+                                                               <string>{{0, 303}, {759, 499}}</string>
+                                                               <key>MembersTreeTableConfiguration</key>
+                                                               <array>
+                                                                       <string>PBXMemberTypeIconColumnIdentifier</string>
+                                                                       <real>22</real>
+                                                                       <string>PBXMemberNameColumnIdentifier</string>
+                                                                       <real>216</real>
+                                                                       <string>PBXMemberTypeColumnIdentifier</string>
+                                                                       <real>482</real>
+                                                                       <string>PBXMemberBookColumnIdentifier</string>
+                                                                       <real>22</real>
+                                                               </array>
+                                                               <key>RubberWindowFrame</key>
+                                                               <string>159 56 1011 822 0 0 1440 878 </string>
+                                                       </dict>
+                                                       <key>Module</key>
+                                                       <string>PBXClassBrowserModule</string>
+                                                       <key>Proportion</key>
+                                                       <string>802pt</string>
+                                               </dict>
+                                       </array>
+                                       <key>Proportion</key>
+                                       <string>802pt</string>
+                               </dict>
+                       </array>
+                       <key>Name</key>
+                       <string>Class Browser</string>
+                       <key>ServiceClasses</key>
+                       <array>
+                               <string>PBXClassBrowserModule</string>
+                       </array>
+                       <key>StatusbarIsVisible</key>
+                       <false/>
+                       <key>TableOfContents</key>
+                       <array>
+                               <string>1C0AD2AF069F1E9B00FABCE6</string>
+                               <string>1C0AD2B0069F1E9B00FABCE6</string>
+                               <string>1CA6456E063B45B4001379D8</string>
+                       </array>
+                       <key>ToolbarConfiguration</key>
+                       <string>xcode.toolbar.config.classbrowser</string>
+                       <key>WindowString</key>
+                       <string>159 56 1011 822 0 0 1440 878 </string>
+                       <key>WindowToolGUID</key>
+                       <string>1C0AD2AF069F1E9B00FABCE6</string>
+                       <key>WindowToolIsVisible</key>
+                       <false/>
+               </dict>
+               <dict>
+                       <key>Identifier</key>
+                       <string>windowTool.refactoring</string>
+                       <key>IncludeInToolsMenu</key>
+                       <false/>
+                       <key>Layout</key>
+                       <array>
+                               <dict>
+                                       <key>Dock</key>
+                                       <array>
+                                               <dict>
+                                                       <key>BecomeActive</key>
+                                                       <true/>
+                                                       <key>GeometryConfiguration</key>
+                                                       <dict>
+                                                               <key>Frame</key>
+                                                               <string>{0, 0}, {500, 335}</string>
+                                                               <key>RubberWindowFrame</key>
+                                                               <string>{0, 0}, {500, 335}</string>
+                                                       </dict>
+                                                       <key>Module</key>
+                                                       <string>XCRefactoringModule</string>
+                                                       <key>Proportion</key>
+                                                       <string>100%</string>
+                                               </dict>
+                                       </array>
+                                       <key>Proportion</key>
+                                       <string>100%</string>
+                               </dict>
+                       </array>
+                       <key>Name</key>
+                       <string>Refactoring</string>
+                       <key>ServiceClasses</key>
+                       <array>
+                               <string>XCRefactoringModule</string>
+                       </array>
+                       <key>WindowString</key>
+                       <string>200 200 500 356 0 0 1920 1200 </string>
+               </dict>
+       </array>
+</dict>
+</plist>
diff --git a/tools/elftosb/elftosb.xcodeproj/creed.pbxuser b/tools/elftosb/elftosb.xcodeproj/creed.pbxuser
new file mode 100644 (file)
index 0000000..b2b2767
--- /dev/null
@@ -0,0 +1,4452 @@
+// !$*UTF8*$!
+{
+       0208BEB10A02D2B800255D31 /* SHA1.cpp */ = {
+               uiCtxt = {
+                       sepNavIntBoundsRect = "{{0, 0}, {692, 3556}}";
+                       sepNavSelRange = "{4579, 54}";
+                       sepNavVisRange = "{3781, 1473}";
+                       sepNavVisRect = "{{0, 1086}, {736, 782}}";
+               };
+       };
+       0208BEB20A02D2B800255D31 /* SHA1.h */ = {
+               uiCtxt = {
+                       sepNavIntBoundsRect = "{{0, 0}, {811, 2100}}";
+                       sepNavSelRange = "{2747, 12}";
+                       sepNavVisRect = "{{0, 1319}, {811, 482}}";
+               };
+       };
+       0208BF4A0A03137800255D31 /* Random.h */ = {
+               uiCtxt = {
+                       sepNavIntBoundsRect = "{{0, 0}, {692, 924}}";
+                       sepNavSelRange = "{1299, 0}";
+                       sepNavVisRange = "{201, 1260}";
+                       sepNavVisRect = "{{0, 142}, {706, 782}}";
+               };
+       };
+       0208BF4B0A03137800255D31 /* Random.cpp */ = {
+               uiCtxt = {
+                       sepNavIntBoundsRect = "{{0, 0}, {745, 1316}}";
+                       sepNavSelRange = "{1172, 5}";
+                       sepNavVisRect = "{{0, 583}, {745, 388}}";
+               };
+       };
+       0208BF890A03E04800255D31 /* RijndaelCBCMAC.h */ = {
+               uiCtxt = {
+                       sepNavIntBoundsRect = "{{0, 0}, {811, 994}}";
+                       sepNavSelRange = "{713, 21}";
+                       sepNavVisRect = "{{0, 512}, {811, 482}}";
+               };
+       };
+       0208BF8A0A03E04800255D31 /* RijndaelCBCMAC.cpp */ = {
+               uiCtxt = {
+                       sepNavIntBoundsRect = "{{0, 0}, {745, 1330}}";
+                       sepNavSelRange = "{2069, 0}";
+                       sepNavVisRect = "{{0, 611}, {745, 388}}";
+               };
+       };
+       0208C03D0A0544BA00255D31 /* options.cpp */ = {
+               uiCtxt = {
+                       sepNavIntBoundsRect = "{{0, 0}, {736, 15974}}";
+                       sepNavSelRange = "{28198, 63}";
+                       sepNavVisRect = "{{0, 13343}, {736, 782}}";
+               };
+       };
+       0208C03E0A0544BA00255D31 /* options.h */ = {
+               uiCtxt = {
+                       sepNavIntBoundsRect = "{{0, 0}, {811, 6846}}";
+                       sepNavSelRange = "{4732, 40}";
+                       sepNavVisRect = "{{0, 2202}, {811, 482}}";
+               };
+       };
+       0208C08B0A05677000255D31 /* AESKey.cpp */ = {
+               uiCtxt = {
+                       sepNavIntBoundsRect = "{{0, 0}, {692, 1218}}";
+                       sepNavSelRange = "{968, 0}";
+                       sepNavVisRange = "{280, 1825}";
+                       sepNavVisRect = "{{0, 266}, {706, 782}}";
+               };
+       };
+       0208C2880A0A4E5F00255D31 /* DataSource.cpp */ = {
+               uiCtxt = {
+                       sepNavIntBoundsRect = "{{0, 0}, {810, 3094}}";
+                       sepNavSelRange = "{2183, 48}";
+                       sepNavVisRange = "{30, 2207}";
+                       sepNavVisRect = "{{0, 280}, {706, 782}}";
+               };
+       };
+       0208C2890A0A4E5F00255D31 /* DataSource.h */ = {
+               uiCtxt = {
+                       sepNavFolds = "{\n    c =     (\n                {\n            r = \"{3114, 1494}\";\n            s = 0;\n        }\n    );\n    r = \"{0, 9539}\";\n    s = 0;\n}";
+                       sepNavIntBoundsRect = "{{0, 0}, {810, 3406}}";
+                       sepNavSelRange = "{3191, 0}";
+                       sepNavVisRange = "{1297, 2673}";
+                       sepNavVisRect = "{{0, 1254}, {706, 782}}";
+               };
+       };
+       0208C28A0A0A4E5F00255D31 /* Operation.cpp */ = {
+               uiCtxt = {
+                       sepNavIntBoundsRect = "{{0, 0}, {731, 936}}";
+                       sepNavSelRange = "{753, 9}";
+                       sepNavVisRange = "{430, 602}";
+                       sepNavVisRect = "{{0, 30}, {706, 782}}";
+               };
+       };
+       0208C28B0A0A4E5F00255D31 /* Operation.h */ = {
+               uiCtxt = {
+                       sepNavIntBoundsRect = "{{0, 0}, {692, 2674}}";
+                       sepNavSelRange = "{1618, 0}";
+                       sepNavVisRange = "{1197, 1240}";
+                       sepNavVisRect = "{{0, 759}, {732, 782}}";
+               };
+       };
+       0208C28C0A0A4E5F00255D31 /* DataTarget.cpp */ = {
+               uiCtxt = {
+                       sepNavIntBoundsRect = "{{0, 0}, {810, 1076}}";
+                       sepNavSelRange = "{0, 0}";
+                       sepNavVisRange = "{0, 2068}";
+                       sepNavVisRect = "{{0, 564}, {745, 388}}";
+               };
+       };
+       0208C28D0A0A4E5F00255D31 /* DataTarget.h */ = {
+               uiCtxt = {
+                       sepNavIntBoundsRect = "{{0, 0}, {810, 1703}}";
+                       sepNavSelRange = "{2252, 0}";
+                       sepNavVisRange = "{931, 2954}";
+                       sepNavVisRect = "{{0, 406}, {706, 782}}";
+               };
+       };
+       0208C2990A0A4EE800255D31 /* ConversionController.cpp */ = {
+               uiCtxt = {
+                       sepNavIntBoundsRect = "{{0, 0}, {810, 18707}}";
+                       sepNavSelRange = "{36256, 0}";
+                       sepNavVisRange = "{35162, 2941}";
+                       sepNavVisRect = "{{0, 7204}, {706, 782}}";
+                       sepNavWindowFrame = "{{15, -5}, {777, 878}}";
+               };
+       };
+       0208C29A0A0A4EE800255D31 /* ConversionController.h */ = {
+               uiCtxt = {
+                       sepNavIntBoundsRect = "{{0, 0}, {810, 2223}}";
+                       sepNavSelRange = "{4632, 0}";
+                       sepNavVisRange = "{1812, 2982}";
+                       sepNavVisRect = "{{0, 1402}, {706, 782}}";
+               };
+       };
+       0208C2E00A0AA4F700255D31 /* int_size.h */ = {
+               uiCtxt = {
+                       sepNavIntBoundsRect = "{{0, 0}, {692, 778}}";
+                       sepNavSelRange = "{0, 0}";
+                       sepNavVisRange = "{0, 751}";
+                       sepNavVisRect = "{{0, 0}, {706, 782}}";
+               };
+       };
+       020D416A0A0FE8AC0027E24E /* StringMatcher.h */ = {
+               uiCtxt = {
+                       sepNavIntBoundsRect = "{{0, 0}, {706, 994}}";
+                       sepNavSelRange = "{1117, 0}";
+                       sepNavVisRect = "{{0, 212}, {706, 782}}";
+               };
+       };
+       020D41850A0FF0C20027E24E /* OutputSection.h */ = {
+               uiCtxt = {
+                       sepNavIntBoundsRect = "{{0, 0}, {706, 1134}}";
+                       sepNavSelRange = "{625, 0}";
+                       sepNavVisRect = "{{0, 336}, {706, 782}}";
+               };
+       };
+       020D41860A0FF0C20027E24E /* OutputSection.cpp */ = {
+               uiCtxt = {
+                       sepNavIntBoundsRect = "{{0, 0}, {706, 782}}";
+                       sepNavSelRange = "{29, 0}";
+                       sepNavVisRect = "{{0, 0}, {706, 782}}";
+               };
+       };
+       020D41970A0FF5BF0027E24E /* BootImageGenerator.h */ = {
+               uiCtxt = {
+                       sepNavIntBoundsRect = "{{0, 0}, {692, 1092}}";
+                       sepNavSelRange = "{0, 0}";
+                       sepNavVisRange = "{481, 1843}";
+                       sepNavVisRect = "{{0, 140}, {706, 782}}";
+               };
+       };
+       020D41980A0FF5BF0027E24E /* BootImageGenerator.cpp */ = {
+               uiCtxt = {
+                       sepNavIntBoundsRect = "{{0, 0}, {692, 1148}}";
+                       sepNavSelRange = "{0, 0}";
+                       sepNavVisRange = "{202, 1426}";
+                       sepNavVisRect = "{{0, 351}, {706, 782}}";
+               };
+       };
+       020D41A30A0FF8880027E24E /* Version.h */ = {
+               uiCtxt = {
+                       sepNavIntBoundsRect = "{{0, 0}, {692, 840}}";
+                       sepNavSelRange = "{627, 17}";
+                       sepNavVisRange = "{78, 1276}";
+                       sepNavVisRect = "{{0, 0}, {706, 782}}";
+               };
+       };
+       020D41A40A0FF8880027E24E /* Version.cpp */ = {
+               uiCtxt = {
+                       sepNavIntBoundsRect = "{{0, 0}, {736, 1820}}";
+                       sepNavSelRange = "{833, 0}";
+                       sepNavVisRect = "{{0, 56}, {736, 782}}";
+               };
+       };
+       020D41AE0A0FFB040027E24E /* BootImage.h */ = {
+               uiCtxt = {
+                       sepNavIntBoundsRect = "{{0, 0}, {692, 882}}";
+                       sepNavSelRange = "{0, 0}";
+                       sepNavVisRange = "{83, 1600}";
+                       sepNavVisRect = "{{0, 0}, {706, 782}}";
+               };
+       };
+       020D41B70A0FFD140027E24E /* EncoreBootImageGenerator.h */ = {
+               uiCtxt = {
+                       sepNavIntBoundsRect = "{{0, 0}, {740, 1076}}";
+                       sepNavSelRange = "{918, 0}";
+                       sepNavVisRange = "{0, 2176}";
+                       sepNavVisRect = "{{0, 233}, {706, 542}}";
+                       sepNavWindowFrame = "{{15, -5}, {777, 878}}";
+               };
+       };
+       020D41B80A0FFD140027E24E /* EncoreBootImageGenerator.cpp */ = {
+               uiCtxt = {
+                       sepNavIntBoundsRect = "{{0, 0}, {810, 3991}}";
+                       sepNavSelRange = "{5399, 0}";
+                       sepNavVisRange = "{4738, 2409}";
+                       sepNavVisRect = "{{0, 2571}, {706, 782}}";
+               };
+       };
+       020D43A50A14D7E20027E24E /* Logging.h */ = {
+               uiCtxt = {
+                       sepNavIntBoundsRect = "{{0, 0}, {811, 3276}}";
+                       sepNavSelRange = "{6107, 22}";
+                       sepNavVisRect = "{{0, 2286}, {811, 482}}";
+               };
+       };
+       020D43A60A14D7E20027E24E /* Logging.cpp */ = {
+               uiCtxt = {
+                       sepNavIntBoundsRect = "{{0, 0}, {736, 1400}}";
+                       sepNavSelRange = "{1208, 0}";
+                       sepNavVisRect = "{{0, 618}, {736, 782}}";
+               };
+       };
+       020D45040A1523350027E24E /* GHSSecInfo.h */ = {
+               uiCtxt = {
+                       sepNavIntBoundsRect = "{{0, 0}, {692, 1148}}";
+                       sepNavSelRange = "{0, 0}";
+                       sepNavVisRange = "{665, 1793}";
+                       sepNavVisRect = "{{0, 268}, {736, 782}}";
+               };
+       };
+       020D45050A1523350027E24E /* GHSSecInfo.cpp */ = {
+               uiCtxt = {
+                       sepNavIntBoundsRect = "{{0, 0}, {706, 1540}}";
+                       sepNavSelRange = "{2485, 0}";
+                       sepNavVisRect = "{{0, 114}, {706, 782}}";
+               };
+       };
+       020D454F0A1533550027E24E /* OptionContext.h */ = {
+               uiCtxt = {
+                       sepNavIntBoundsRect = "{{0, 0}, {732, 826}}";
+                       sepNavSelRange = "{1259, 0}";
+                       sepNavVisRect = "{{0, 28}, {732, 782}}";
+               };
+       };
+       020D467A0A16657C0027E24E /* sbtool */ = {
+               activeExec = 0;
+               executables = (
+                       020D467C0A16657C0027E24E /* sbtool */,
+               );
+       };
+       020D467C0A16657C0027E24E /* sbtool */ = {
+               isa = PBXExecutable;
+               activeArgIndices = (
+                       NO,
+                       NO,
+                       YES,
+                       YES,
+                       NO,
+                       NO,
+                       NO,
+                       NO,
+                       NO,
+                       NO,
+                       NO,
+                       NO,
+                       NO,
+                       NO,
+                       YES,
+                       NO,
+               );
+               argumentStrings = (
+                       "--quiet",
+                       "--debug",
+                       "--verbose",
+                       "-z",
+                       "-k",
+                       test1.key,
+                       "--zero-key",
+                       "--extract",
+                       0,
+                       1,
+                       3,
+                       5,
+                       8,
+                       "--binary",
+                       test_output/output.sb2,
+                       nand_profile_bd/nand_profile.sb,
+               );
+               autoAttachOnCrash = 1;
+               breakpointsEnabled = 0;
+               configStateDict = {
+                       "PBXLSLaunchAction-0" = {
+                               PBXLSLaunchAction = 0;
+                               PBXLSLaunchStartAction = 1;
+                               PBXLSLaunchStdioStyle = 2;
+                               PBXLSLaunchStyle = 0;
+                               class = PBXLSRunLaunchConfig;
+                               displayName = "Executable Runner";
+                               identifier = com.apple.Xcode.launch.runConfig;
+                               remoteHostInfo = "";
+                               startActionInfo = "";
+                       };
+               };
+               customDataFormattersEnabled = 1;
+               dataTipCustomDataFormattersEnabled = 1;
+               dataTipShowTypeColumn = 1;
+               dataTipSortType = 0;
+               debuggerPlugin = GDBDebugging;
+               disassemblyDisplayState = 0;
+               dylibVariantSuffix = "";
+               enableDebugStr = 1;
+               environmentEntries = (
+               );
+               executableSystemSymbolLevel = 0;
+               executableUserSymbolLevel = 0;
+               libgmallocEnabled = 0;
+               name = sbtool;
+               savedGlobals = {
+               };
+               showTypeColumn = 0;
+               sourceDirectories = (
+               );
+               startupPath = "<<ProjectDirectory>>";
+               variableFormatDictionary = {
+               };
+       };
+       020D46830A1665D90027E24E /* sbtool.cpp */ = {
+               uiCtxt = {
+                       sepNavIntBoundsRect = "{{0, 0}, {692, 8960}}";
+                       sepNavSelRange = "{844, 0}";
+                       sepNavVisRange = "{23, 1414}";
+                       sepNavVisRect = "{{0, 6036}, {706, 782}}";
+               };
+       };
+       020D47A00A16C1E00027E24E /* EncoreBootImageReader.h */ = {
+               uiCtxt = {
+                       sepNavIntBoundsRect = "{{0, 0}, {692, 1764}}";
+                       sepNavSelRange = "{863, 0}";
+                       sepNavVisRange = "{682, 1721}";
+                       sepNavVisRect = "{{0, 922}, {706, 782}}";
+               };
+       };
+       020D47A10A16C1E00027E24E /* EncoreBootImageReader.cpp */ = {
+               uiCtxt = {
+                       sepNavIntBoundsRect = "{{0, 0}, {692, 5096}}";
+                       sepNavSelRange = "{0, 0}";
+                       sepNavVisRange = "{3994, 2023}";
+                       sepNavVisRect = "{{0, 219}, {706, 782}}";
+               };
+       };
+       020DDBEA0A1D08AD00E1CB49 /* OptionDictionary.h */ = {
+               uiCtxt = {
+                       sepNavIntBoundsRect = "{{0, 0}, {732, 1288}}";
+                       sepNavSelRange = "{1197, 16}";
+                       sepNavVisRect = "{{0, 460}, {732, 782}}";
+               };
+       };
+       020DDBEB0A1D08AD00E1CB49 /* OptionDictionary.cpp */ = {
+               uiCtxt = {
+                       sepNavIntBoundsRect = "{{0, 0}, {732, 1582}}";
+                       sepNavSelRange = "{2894, 0}";
+                       sepNavVisRect = "{{0, 556}, {732, 782}}";
+               };
+       };
+       020DDCA30A1E32A400E1CB49 /* PBXCPPExceptionBreakpoint */ = {
+               isa = PBXCPPExceptionBreakpoint;
+               actions = (
+               );
+               breakpointStyle = 0;
+               condition = 020DDCA50A1E32C200E1CB49 /* XCCPPCondition */;
+               continueAfterActions = 0;
+               countType = 0;
+               delayBeforeContinue = 0;
+               exceptionName = $;
+               hitCount = 0;
+               ignoreCount = 0;
+               isThrow = 0;
+               modificationTime = 267302557.457919;
+               originalNumberOfMultipleMatches = 0;
+               state = 2;
+       };
+       020DDCA50A1E32C200E1CB49 /* XCCPPCondition */ = {
+               isa = XCCPPCondition;
+               conditionString = "On Catch";
+       };
+       020DDCE80A1E858600E1CB49 /* Everything */ = {
+               activeExec = 0;
+       };
+       02123F2F0A6B057E003CF33F /* Blob.h */ = {
+               uiCtxt = {
+                       sepNavIntBoundsRect = "{{0, 0}, {740, 1076}}";
+                       sepNavSelRange = "{1584, 0}";
+                       sepNavVisRange = "{0, 1876}";
+                       sepNavVisRect = "{{0, 296}, {706, 782}}";
+               };
+       };
+       02123F300A6B057E003CF33F /* Blob.cpp */ = {
+               uiCtxt = {
+                       sepNavIntBoundsRect = "{{0, 0}, {810, 1547}}";
+                       sepNavSelRange = "{1143, 4}";
+                       sepNavVisRange = "{0, 1990}";
+                       sepNavVisRect = "{{0, 215}, {706, 782}}";
+               };
+       };
+       02123F370A6B09CF003CF33F /* HexValues.h */ = {
+               uiCtxt = {
+                       sepNavIntBoundsRect = "{{0, 0}, {692, 779}}";
+                       sepNavSelRange = "{471, 0}";
+                       sepNavVisRange = "{0, 872}";
+                       sepNavVisRect = "{{0, 0}, {706, 782}}";
+               };
+       };
+       02123F380A6B09CF003CF33F /* HexValues.cpp */ = {
+               uiCtxt = {
+                       sepNavIntBoundsRect = "{{0, 0}, {732, 782}}";
+                       sepNavSelRange = "{1007, 0}";
+                       sepNavVisRect = "{{0, 0}, {732, 782}}";
+               };
+       };
+       0215B3BA09F3FBF100EA7C45 /* ElftosbLexer.h */ = {
+               uiCtxt = {
+                       sepNavIntBoundsRect = "{{0, 0}, {683, 1443}}";
+                       sepNavSelRange = "{742, 34}";
+                       sepNavVisRange = "{694, 198}";
+                       sepNavVisRect = "{{0, 266}, {732, 782}}";
+                       sepNavWindowFrame = "{{15, 63}, {775, 810}}";
+               };
+       };
+       0215B3D209F424D800EA7C45 /* elftosb_parser.y */ = {
+               uiCtxt = {
+                       sepNavIntBoundsRect = "{{0, 0}, {810, 13351}}";
+                       sepNavSelRange = "{11226, 0}";
+                       sepNavVisRange = "{10479, 1812}";
+                       sepNavVisRect = "{{0, 11622}, {706, 782}}";
+               };
+       };
+       021CA3F00A8D16960028326F /* ExcludesListMatcher.h */ = {
+               uiCtxt = {
+                       sepNavIntBoundsRect = "{{0, 0}, {692, 1064}}";
+                       sepNavSelRange = "{1122, 0}";
+                       sepNavVisRange = "{596, 1642}";
+                       sepNavVisRect = "{{0, 218}, {706, 782}}";
+               };
+       };
+       021CA3F10A8D16960028326F /* ExcludesListMatcher.cpp */ = {
+               uiCtxt = {
+                       sepNavIntBoundsRect = "{{0, 0}, {692, 1358}}";
+                       sepNavSelRange = "{2115, 0}";
+                       sepNavVisRange = "{1018, 1218}";
+                       sepNavVisRect = "{{0, 0}, {732, 782}}";
+               };
+       };
+       021CA4400A8D2F740028326F /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 020DDBEA0A1D08AD00E1CB49 /* OptionDictionary.h */;
+               name = OptionDictionary;
+               rLen = 16;
+               rLoc = 1197;
+               rType = 0;
+               vrLen = 1754;
+               vrLoc = 1102;
+       };
+       021CA4420A8D2F740028326F /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 020DDBEB0A1D08AD00E1CB49 /* OptionDictionary.cpp */;
+               name = "OptionDictionary.cpp: 107";
+               rLen = 0;
+               rLoc = 2894;
+               rType = 0;
+               vrLen = 1547;
+               vrLoc = 1144;
+       };
+       022B461212136A6A00A74F96 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 02E535B40C245AEC00CBD4A5 /* DataSourceImager.cpp */;
+               name = "DataSourceImager.cpp: 17";
+               rLen = 0;
+               rLoc = 528;
+               rType = 0;
+               vrLen = 278;
+               vrLoc = 360;
+       };
+       022B461312136A6A00A74F96 /* XCBuildMessageTextBookmark */ = {
+               isa = PBXTextBookmark;
+               comments = "Malloc.h: No such file or directory";
+               fRef = 02C5DB920A925C61003B9C11 /* format_string.cpp */;
+               fallbackIsa = XCBuildMessageTextBookmark;
+               rLen = 1;
+               rLoc = 20;
+               rType = 1;
+       };
+       022B461412136A6A00A74F96 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 02C5DB920A925C61003B9C11 /* format_string.cpp */;
+               name = "format_string.cpp: 21";
+               rLen = 0;
+               rLoc = 602;
+               rType = 0;
+               vrLen = 290;
+               vrLoc = 478;
+       };
+       022B46161216FE9C00A74F96 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 02C5DB920A925C61003B9C11 /* format_string.cpp */;
+               name = "format_string.cpp: 21";
+               rLen = 0;
+               rLoc = 602;
+               rType = 0;
+               vrLen = 290;
+               vrLoc = 478;
+       };
+       022B46181216FE9C00A74F96 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 0208C2990A0A4EE800255D31 /* ConversionController.cpp */;
+               name = "ConversionController.cpp: 704";
+               rLen = 9;
+               rLoc = 21541;
+               rType = 0;
+               vrLen = 651;
+               vrLoc = 21067;
+       };
+       022B46191216FE9C00A74F96 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 0208C28A0A0A4E5F00255D31 /* Operation.cpp */;
+               rLen = 9;
+               rLoc = 753;
+               rType = 0;
+       };
+       022B461A1216FE9C00A74F96 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 0208C28A0A0A4E5F00255D31 /* Operation.cpp */;
+               name = "Operation.cpp: 29";
+               rLen = 9;
+               rLoc = 753;
+               rType = 0;
+               vrLen = 602;
+               vrLoc = 430;
+       };
+       022B461D1216FEA700A74F96 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 02123F300A6B057E003CF33F /* Blob.cpp */;
+               name = "Blob.cpp: 52";
+               rLen = 4;
+               rLoc = 1143;
+               rType = 0;
+               vrLen = 1990;
+               vrLoc = 0;
+       };
+       022B461E1216FEA700A74F96 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 0296A49309D9AE9400F80AFF /* elftosb.cpp */;
+               name = "elftosb.cpp: 45";
+               rLen = 0;
+               rLoc = 1198;
+               rType = 0;
+               vrLen = 2223;
+               vrLoc = 13685;
+       };
+       022B461F1216FEA700A74F96 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 02E535B30C245AEC00CBD4A5 /* DataSourceImager.h */;
+               name = "DataSourceImager.h: 55";
+               rLen = 0;
+               rLoc = 1268;
+               rType = 0;
+               vrLen = 1359;
+               vrLoc = 0;
+       };
+       022B46201216FEA700A74F96 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 0208C28C0A0A4E5F00255D31 /* DataTarget.cpp */;
+               name = "DataTarget.cpp: 1";
+               rLen = 0;
+               rLoc = 0;
+               rType = 0;
+               vrLen = 2068;
+               vrLoc = 0;
+       };
+       022B46211216FEA700A74F96 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 0208C2890A0A4E5F00255D31 /* DataSource.h */;
+               name = "DataSource.h: 151";
+               rLen = 9;
+               rLoc = 4826;
+               rType = 0;
+               vrLen = 2727;
+               vrLoc = 2520;
+       };
+       022B46221216FEA700A74F96 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 0208C2990A0A4EE800255D31 /* ConversionController.cpp */;
+               name = "ConversionController.cpp: 704";
+               rLen = 9;
+               rLoc = 21541;
+               rType = 0;
+               vrLen = 2033;
+               vrLoc = 20377;
+       };
+       022B46231216FEA700A74F96 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 0208C28D0A0A4E5F00255D31 /* DataTarget.h */;
+               name = "DataTarget.h: 72";
+               rLen = 0;
+               rLoc = 2252;
+               rType = 0;
+               vrLen = 2954;
+               vrLoc = 931;
+       };
+       022B46241216FEA700A74F96 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 020D41B80A0FFD140027E24E /* EncoreBootImageGenerator.cpp */;
+               name = "EncoreBootImageGenerator.cpp: 195";
+               rLen = 0;
+               rLoc = 5404;
+               rType = 0;
+               vrLen = 2422;
+               vrLoc = 4738;
+       };
+       022B46251216FEA700A74F96 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 020D41B80A0FFD140027E24E /* EncoreBootImageGenerator.cpp */;
+               name = "EncoreBootImageGenerator.cpp: 194";
+               rLen = 0;
+               rLoc = 5399;
+               rType = 0;
+               vrLen = 2409;
+               vrLoc = 4738;
+       };
+       022B4632121700F300A74F96 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 02C5DB920A925C61003B9C11 /* format_string.cpp */;
+               name = "format_string.cpp: 21";
+               rLen = 0;
+               rLoc = 602;
+               rType = 0;
+               vrLen = 290;
+               vrLoc = 478;
+       };
+       022B4639121700F300A74F96 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 0208C28A0A0A4E5F00255D31 /* Operation.cpp */;
+               name = "Operation.cpp: 29";
+               rLen = 9;
+               rLoc = 753;
+               rType = 0;
+               vrLen = 602;
+               vrLoc = 430;
+       };
+       022B464E1217576E00A74F96 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 02C5DB920A925C61003B9C11 /* format_string.cpp */;
+               name = "format_string.cpp: 21";
+               rLen = 0;
+               rLoc = 602;
+               rType = 0;
+               vrLen = 290;
+               vrLoc = 478;
+       };
+       022B464F1217576E00A74F96 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 0215B3D209F424D800EA7C45 /* elftosb_parser.y */;
+               name = "elftosb_parser.y: 15";
+               rLen = 26;
+               rLoc = 189;
+               rType = 0;
+               vrLen = 233;
+               vrLoc = 125;
+       };
+       022B46501217576E00A74F96 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 02D46C110FED492400E65706 /* elftosb_parser.tab.cpp */;
+               name = "elftosb_parser.tab.cpp: 141";
+               rLen = 0;
+               rLoc = 3846;
+               rType = 0;
+               vrLen = 297;
+               vrLoc = 3210;
+       };
+       022B46511217576E00A74F96 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 0215B3BA09F3FBF100EA7C45 /* ElftosbLexer.h */;
+               name = "ElftosbLexer.h: 24";
+               rLen = 34;
+               rLoc = 742;
+               rType = 0;
+               vrLen = 198;
+               vrLoc = 694;
+       };
+       022B46521217576E00A74F96 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 02E3997909F2E0410055992A /* elftosb_lexer.l */;
+               name = "elftosb_lexer.l: 61";
+               rLen = 0;
+               rLoc = 1417;
+               rType = 0;
+               vrLen = 380;
+               vrLoc = 1267;
+       };
+       022B46531217576E00A74F96 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 02E3997909F2E0410055992A /* elftosb_lexer.l */;
+               name = "elftosb_lexer.l: 61";
+               rLen = 0;
+               rLoc = 1417;
+               rType = 0;
+               vrLen = 380;
+               vrLoc = 1267;
+       };
+       022B46541217576E00A74F96 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 0208C28A0A0A4E5F00255D31 /* Operation.cpp */;
+               name = "Operation.cpp: 29";
+               rLen = 9;
+               rLoc = 753;
+               rType = 0;
+               vrLen = 602;
+               vrLoc = 430;
+       };
+       022B4655121763A100A74F96 /* IVTDataSource.h */ = {
+               uiCtxt = {
+                       sepNavIntBoundsRect = "{{0, 0}, {683, 3887}}";
+                       sepNavSelRange = "{9792, 0}";
+                       sepNavVisRange = "{9594, 261}";
+               };
+       };
+       022B4656121763A100A74F96 /* IVTDataSource.cpp */ = {
+               uiCtxt = {
+                       sepNavIntBoundsRect = "{{0, 0}, {810, 1365}}";
+                       sepNavSelRange = "{569, 0}";
+                       sepNavVisRange = "{519, 1989}";
+               };
+       };
+       022B46601218557900A74F96 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 02E3997909F2E0410055992A /* elftosb_lexer.l */;
+               name = "elftosb_lexer.l: 61";
+               rLen = 0;
+               rLoc = 1417;
+               rType = 0;
+               vrLen = 380;
+               vrLoc = 1267;
+       };
+       022B46611218557900A74F96 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 0208C28A0A0A4E5F00255D31 /* Operation.cpp */;
+               name = "Operation.cpp: 29";
+               rLen = 9;
+               rLoc = 753;
+               rType = 0;
+               vrLen = 602;
+               vrLoc = 430;
+       };
+       022B466412185DA400A74F96 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 02E3997909F2E0410055992A /* elftosb_lexer.l */;
+               name = "elftosb_lexer.l: 61";
+               rLen = 0;
+               rLoc = 1417;
+               rType = 0;
+               vrLen = 380;
+               vrLoc = 1267;
+       };
+       022B466512185DA400A74F96 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 0208C28A0A0A4E5F00255D31 /* Operation.cpp */;
+               name = "Operation.cpp: 29";
+               rLen = 9;
+               rLoc = 753;
+               rType = 0;
+               vrLen = 602;
+               vrLoc = 430;
+       };
+       022B466C12185F4800A74F96 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 02E3997909F2E0410055992A /* elftosb_lexer.l */;
+               name = "elftosb_lexer.l: 61";
+               rLen = 0;
+               rLoc = 1417;
+               rType = 0;
+               vrLen = 380;
+               vrLoc = 1267;
+       };
+       022B466D12185F4800A74F96 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 0208C28A0A0A4E5F00255D31 /* Operation.cpp */;
+               name = "Operation.cpp: 29";
+               rLen = 9;
+               rLoc = 753;
+               rType = 0;
+               vrLen = 602;
+               vrLoc = 430;
+       };
+       022B46701218625A00A74F96 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 02E3997909F2E0410055992A /* elftosb_lexer.l */;
+               name = "elftosb_lexer.l: 61";
+               rLen = 0;
+               rLoc = 1417;
+               rType = 0;
+               vrLen = 380;
+               vrLoc = 1267;
+       };
+       022B46711218625A00A74F96 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 0208C28A0A0A4E5F00255D31 /* Operation.cpp */;
+               name = "Operation.cpp: 29";
+               rLen = 9;
+               rLoc = 753;
+               rType = 0;
+               vrLen = 602;
+               vrLoc = 430;
+       };
+       022B4678121864A000A74F96 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 02E3997909F2E0410055992A /* elftosb_lexer.l */;
+               name = "elftosb_lexer.l: 61";
+               rLen = 0;
+               rLoc = 1417;
+               rType = 0;
+               vrLen = 380;
+               vrLoc = 1267;
+       };
+       022B4679121864A000A74F96 /* XCBuildMessageTextBookmark */ = {
+               isa = PBXTextBookmark;
+               comments = "Field 'm_ivt' has incomplete type";
+               fRef = 022B4655121763A100A74F96 /* IVTDataSource.h */;
+               fallbackIsa = XCBuildMessageTextBookmark;
+               rLen = 1;
+               rLoc = 282;
+               rType = 1;
+       };
+       022B467A121864A000A74F96 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 022B4655121763A100A74F96 /* IVTDataSource.h */;
+               name = "IVTDataSource.h: 283";
+               rLen = 0;
+               rLoc = 9792;
+               rType = 0;
+               vrLen = 261;
+               vrLoc = 9594;
+       };
+       022B467B121864A000A74F96 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 0208C28A0A0A4E5F00255D31 /* Operation.cpp */;
+               name = "Operation.cpp: 29";
+               rLen = 9;
+               rLoc = 753;
+               rType = 0;
+               vrLen = 602;
+               vrLoc = 430;
+       };
+       022B46801218654500A74F96 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 022B4655121763A100A74F96 /* IVTDataSource.h */;
+               name = "IVTDataSource.h: 283";
+               rLen = 0;
+               rLoc = 9792;
+               rType = 0;
+               vrLen = 261;
+               vrLoc = 9594;
+       };
+       022B46811218654500A74F96 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 0208C28A0A0A4E5F00255D31 /* Operation.cpp */;
+               name = "Operation.cpp: 29";
+               rLen = 9;
+               rLoc = 753;
+               rType = 0;
+               vrLen = 602;
+               vrLoc = 430;
+       };
+       022B46871218659100A74F96 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 022B4655121763A100A74F96 /* IVTDataSource.h */;
+               name = "IVTDataSource.h: 283";
+               rLen = 0;
+               rLoc = 9792;
+               rType = 0;
+               vrLen = 261;
+               vrLoc = 9594;
+       };
+       022B46881218659100A74F96 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 0208C28A0A0A4E5F00255D31 /* Operation.cpp */;
+               name = "Operation.cpp: 29";
+               rLen = 9;
+               rLoc = 753;
+               rType = 0;
+               vrLen = 602;
+               vrLoc = 430;
+       };
+       022B46891218659A00A74F96 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 02CD157409F543FE00ABE650 /* ElftosbAST.cpp */;
+               name = "ElftosbAST.cpp: 916";
+               rLen = 0;
+               rLoc = 21776;
+               rType = 0;
+               vrLen = 1970;
+               vrLoc = 20175;
+       };
+       022B468A1218659A00A74F96 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 02E3997909F2E0410055992A /* elftosb_lexer.l */;
+               name = "elftosb_lexer.l: 61";
+               rLen = 0;
+               rLoc = 1417;
+               rType = 0;
+               vrLen = 2085;
+               vrLoc = 0;
+       };
+       022B468B1218659A00A74F96 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 0208C29A0A0A4EE800255D31 /* ConversionController.h */;
+               name = "ConversionController.h: 128";
+               rLen = 0;
+               rLoc = 4632;
+               rType = 0;
+               vrLen = 2982;
+               vrLoc = 1812;
+       };
+       022B468C1218659A00A74F96 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 02CD157309F543FE00ABE650 /* ElftosbAST.h */;
+               name = "ElftosbAST.h: 619";
+               rLen = 0;
+               rLoc = 16098;
+               rType = 0;
+               vrLen = 2151;
+               vrLoc = 15487;
+       };
+       022B468D1218659A00A74F96 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 0208C2880A0A4E5F00255D31 /* DataSource.cpp */;
+               name = "DataSource.cpp: 83";
+               rLen = 48;
+               rLoc = 2183;
+               rType = 0;
+               vrLen = 2207;
+               vrLoc = 30;
+       };
+       022B468E1218659A00A74F96 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 0208C2890A0A4E5F00255D31 /* DataSource.h */;
+               name = "DataSource.h: 143";
+               rLen = 0;
+               rLoc = 4684;
+               rType = 0;
+               vrLen = 4166;
+               vrLoc = 1297;
+       };
+       022B468F1218659A00A74F96 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 02E535B40C245AEC00CBD4A5 /* DataSourceImager.cpp */;
+               name = "DataSourceImager.cpp: 17";
+               rLen = 40;
+               rLoc = 512;
+               rType = 0;
+               vrLen = 2065;
+               vrLoc = 482;
+       };
+       022B46901218659A00A74F96 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 020D41B80A0FFD140027E24E /* EncoreBootImageGenerator.cpp */;
+               name = "EncoreBootImageGenerator.cpp: 194";
+               rLen = 0;
+               rLoc = 5399;
+               rType = 0;
+               vrLen = 2409;
+               vrLoc = 4738;
+       };
+       022B46911218659A00A74F96 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 0215B3D209F424D800EA7C45 /* elftosb_parser.y */;
+               name = "elftosb_parser.y: 539";
+               rLen = 0;
+               rLoc = 13192;
+               rType = 0;
+               vrLen = 2003;
+               vrLoc = 12514;
+       };
+       022B46921218659A00A74F96 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 0208C28C0A0A4E5F00255D31 /* DataTarget.cpp */;
+               name = "DataTarget.cpp: 1";
+               rLen = 0;
+               rLoc = 0;
+               rType = 0;
+               vrLen = 2068;
+               vrLoc = 0;
+       };
+       022B46931218659A00A74F96 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 0208C28D0A0A4E5F00255D31 /* DataTarget.h */;
+               name = "DataTarget.h: 72";
+               rLen = 0;
+               rLoc = 2252;
+               rType = 0;
+               vrLen = 2954;
+               vrLoc = 931;
+       };
+       022B46941218659A00A74F96 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 022B4656121763A100A74F96 /* IVTDataSource.cpp */;
+               name = "IVTDataSource.cpp: 17";
+               rLen = 0;
+               rLoc = 569;
+               rType = 0;
+               vrLen = 1989;
+               vrLoc = 519;
+       };
+       022B46951218659A00A74F96 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 022B4655121763A100A74F96 /* IVTDataSource.h */;
+               name = "IVTDataSource.h: 278";
+               rLen = 0;
+               rLoc = 9736;
+               rType = 0;
+               vrLen = 2953;
+               vrLoc = 1371;
+       };
+       022B46961218659A00A74F96 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 0208C2990A0A4EE800255D31 /* ConversionController.cpp */;
+               name = "ConversionController.cpp: 1201";
+               rLen = 0;
+               rLoc = 36267;
+               rType = 0;
+               vrLen = 2895;
+               vrLoc = 35162;
+       };
+       022B46971218659A00A74F96 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 0208C2990A0A4EE800255D31 /* ConversionController.cpp */;
+               name = "ConversionController.cpp: 1201";
+               rLen = 0;
+               rLoc = 36267;
+               rType = 0;
+               vrLen = 2893;
+               vrLoc = 35162;
+       };
+       022B469D121865E000A74F96 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 022B4655121763A100A74F96 /* IVTDataSource.h */;
+               name = "IVTDataSource.h: 283";
+               rLen = 0;
+               rLoc = 9792;
+               rType = 0;
+               vrLen = 248;
+               vrLoc = 9594;
+       };
+       022B469E121865E000A74F96 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 0208C28A0A0A4E5F00255D31 /* Operation.cpp */;
+               name = "Operation.cpp: 29";
+               rLen = 9;
+               rLoc = 753;
+               rType = 0;
+               vrLen = 580;
+               vrLoc = 430;
+       };
+       022B46A1121865E300A74F96 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 022B4655121763A100A74F96 /* IVTDataSource.h */;
+               name = "IVTDataSource.h: 283";
+               rLen = 0;
+               rLoc = 9792;
+               rType = 0;
+               vrLen = 261;
+               vrLoc = 9594;
+       };
+       022B46A2121865E300A74F96 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 0208C28A0A0A4E5F00255D31 /* Operation.cpp */;
+               name = "Operation.cpp: 29";
+               rLen = 9;
+               rLoc = 753;
+               rType = 0;
+               vrLen = 602;
+               vrLoc = 430;
+       };
+       022B46A5121865F700A74F96 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 022B4655121763A100A74F96 /* IVTDataSource.h */;
+               name = "IVTDataSource.h: 283";
+               rLen = 0;
+               rLoc = 9792;
+               rType = 0;
+               vrLen = 261;
+               vrLoc = 9594;
+       };
+       022B46A6121865F700A74F96 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 0208C28A0A0A4E5F00255D31 /* Operation.cpp */;
+               name = "Operation.cpp: 29";
+               rLen = 9;
+               rLoc = 753;
+               rType = 0;
+               vrLen = 602;
+               vrLoc = 430;
+       };
+       022B46A91218660A00A74F96 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 022B4655121763A100A74F96 /* IVTDataSource.h */;
+               name = "IVTDataSource.h: 283";
+               rLen = 0;
+               rLoc = 9792;
+               rType = 0;
+               vrLen = 261;
+               vrLoc = 9594;
+       };
+       022B46AA1218660A00A74F96 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 0208C28A0A0A4E5F00255D31 /* Operation.cpp */;
+               name = "Operation.cpp: 29";
+               rLen = 9;
+               rLoc = 753;
+               rType = 0;
+               vrLen = 602;
+               vrLoc = 430;
+       };
+       022B46AD1218662100A74F96 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 022B4655121763A100A74F96 /* IVTDataSource.h */;
+               name = "IVTDataSource.h: 283";
+               rLen = 0;
+               rLoc = 9792;
+               rType = 0;
+               vrLen = 261;
+               vrLoc = 9594;
+       };
+       022B46AE1218662100A74F96 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 0208C28A0A0A4E5F00255D31 /* Operation.cpp */;
+               name = "Operation.cpp: 29";
+               rLen = 9;
+               rLoc = 753;
+               rType = 0;
+               vrLen = 602;
+               vrLoc = 430;
+       };
+       022B46B11218662D00A74F96 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 022B4655121763A100A74F96 /* IVTDataSource.h */;
+               name = "IVTDataSource.h: 283";
+               rLen = 0;
+               rLoc = 9792;
+               rType = 0;
+               vrLen = 261;
+               vrLoc = 9594;
+       };
+       022B46B21218662D00A74F96 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 0208C28A0A0A4E5F00255D31 /* Operation.cpp */;
+               name = "Operation.cpp: 29";
+               rLen = 9;
+               rLoc = 753;
+               rType = 0;
+               vrLen = 602;
+               vrLoc = 430;
+       };
+       022B46B31218663500A74F96 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 0208C2990A0A4EE800255D31 /* ConversionController.cpp */;
+               name = "ConversionController.cpp: 1201";
+               rLen = 0;
+               rLoc = 36267;
+               rType = 0;
+               vrLen = 2893;
+               vrLoc = 35162;
+       };
+       022B46B71218665300A74F96 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 022B4655121763A100A74F96 /* IVTDataSource.h */;
+               name = "IVTDataSource.h: 283";
+               rLen = 0;
+               rLoc = 9792;
+               rType = 0;
+               vrLen = 261;
+               vrLoc = 9594;
+       };
+       022B46B81218665300A74F96 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 0208C28A0A0A4E5F00255D31 /* Operation.cpp */;
+               name = "Operation.cpp: 29";
+               rLen = 9;
+               rLoc = 753;
+               rType = 0;
+               vrLen = 602;
+               vrLoc = 430;
+       };
+       022B46B91218665600A74F96 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 0208C2990A0A4EE800255D31 /* ConversionController.cpp */;
+               name = "ConversionController.cpp: 1201";
+               rLen = 0;
+               rLoc = 36267;
+               rType = 0;
+               vrLen = 2893;
+               vrLoc = 35162;
+       };
+       022B46BD1218667B00A74F96 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 022B4655121763A100A74F96 /* IVTDataSource.h */;
+               name = "IVTDataSource.h: 283";
+               rLen = 0;
+               rLoc = 9792;
+               rType = 0;
+               vrLen = 261;
+               vrLoc = 9594;
+       };
+       022B46BE1218667B00A74F96 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 0208C28A0A0A4E5F00255D31 /* Operation.cpp */;
+               name = "Operation.cpp: 29";
+               rLen = 9;
+               rLoc = 753;
+               rType = 0;
+               vrLen = 602;
+               vrLoc = 430;
+       };
+       022B46C11218673300A74F96 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 022B4655121763A100A74F96 /* IVTDataSource.h */;
+               name = "IVTDataSource.h: 283";
+               rLen = 0;
+               rLoc = 9792;
+               rType = 0;
+               vrLen = 261;
+               vrLoc = 9594;
+       };
+       022B46C21218673300A74F96 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 0208C28A0A0A4E5F00255D31 /* Operation.cpp */;
+               name = "Operation.cpp: 29";
+               rLen = 9;
+               rLoc = 753;
+               rType = 0;
+               vrLen = 602;
+               vrLoc = 430;
+       };
+       022B46C3121867D800A74F96 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 0208C2990A0A4EE800255D31 /* ConversionController.cpp */;
+               name = "ConversionController.cpp: 1201";
+               rLen = 0;
+               rLoc = 36267;
+               rType = 0;
+               vrLen = 2895;
+               vrLoc = 35162;
+       };
+       022B46C61218685B00A74F96 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 022B4655121763A100A74F96 /* IVTDataSource.h */;
+               name = "IVTDataSource.h: 283";
+               rLen = 0;
+               rLoc = 9792;
+               rType = 0;
+               vrLen = 261;
+               vrLoc = 9594;
+       };
+       022B46C71218685B00A74F96 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 0208C28A0A0A4E5F00255D31 /* Operation.cpp */;
+               name = "Operation.cpp: 29";
+               rLen = 9;
+               rLoc = 753;
+               rType = 0;
+               vrLen = 602;
+               vrLoc = 430;
+       };
+       022B46C81218686300A74F96 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 0208C2990A0A4EE800255D31 /* ConversionController.cpp */;
+               name = "ConversionController.cpp: 1201";
+               rLen = 0;
+               rLoc = 36267;
+               rType = 0;
+               vrLen = 2893;
+               vrLoc = 35162;
+       };
+       022B46CC1218687300A74F96 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 022B4655121763A100A74F96 /* IVTDataSource.h */;
+               name = "IVTDataSource.h: 283";
+               rLen = 0;
+               rLoc = 9792;
+               rType = 0;
+               vrLen = 261;
+               vrLoc = 9594;
+       };
+       022B46CD1218687300A74F96 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 0208C28A0A0A4E5F00255D31 /* Operation.cpp */;
+               name = "Operation.cpp: 29";
+               rLen = 9;
+               rLoc = 753;
+               rType = 0;
+               vrLen = 602;
+               vrLoc = 430;
+       };
+       022B46CE1218687700A74F96 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 0208C2990A0A4EE800255D31 /* ConversionController.cpp */;
+               name = "ConversionController.cpp: 1201";
+               rLen = 0;
+               rLoc = 36267;
+               rType = 0;
+               vrLen = 2895;
+               vrLoc = 35162;
+       };
+       022B46D1121868F200A74F96 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 022B4655121763A100A74F96 /* IVTDataSource.h */;
+               name = "IVTDataSource.h: 283";
+               rLen = 0;
+               rLoc = 9792;
+               rType = 0;
+               vrLen = 261;
+               vrLoc = 9594;
+       };
+       022B46D2121868F200A74F96 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 0208C28A0A0A4E5F00255D31 /* Operation.cpp */;
+               name = "Operation.cpp: 29";
+               rLen = 9;
+               rLoc = 753;
+               rType = 0;
+               vrLen = 602;
+               vrLoc = 430;
+       };
+       022B46D3121868FD00A74F96 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 0208C2990A0A4EE800255D31 /* ConversionController.cpp */;
+               name = "ConversionController.cpp: 1162";
+               rLen = 0;
+               rLoc = 35162;
+               rType = 0;
+               vrLen = 2895;
+               vrLoc = 35162;
+       };
+       022B46D4121868FD00A74F96 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 0215B3D209F424D800EA7C45 /* elftosb_parser.y */;
+               name = "elftosb_parser.y: 539";
+               rLen = 0;
+               rLoc = 13192;
+               rType = 0;
+               vrLen = 2003;
+               vrLoc = 12514;
+       };
+       022B46D5121868FD00A74F96 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 0215B3D209F424D800EA7C45 /* elftosb_parser.y */;
+               name = "elftosb_parser.y: 216";
+               rLen = 0;
+               rLoc = 5696;
+               rType = 0;
+               vrLen = 1993;
+               vrLoc = 4162;
+       };
+       022B46D81218690400A74F96 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 022B4655121763A100A74F96 /* IVTDataSource.h */;
+               name = "IVTDataSource.h: 283";
+               rLen = 0;
+               rLoc = 9792;
+               rType = 0;
+               vrLen = 261;
+               vrLoc = 9594;
+       };
+       022B46D91218690400A74F96 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 0208C28A0A0A4E5F00255D31 /* Operation.cpp */;
+               name = "Operation.cpp: 29";
+               rLen = 9;
+               rLoc = 753;
+               rType = 0;
+               vrLen = 602;
+               vrLoc = 430;
+       };
+       022B46DC1218694400A74F96 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 022B4655121763A100A74F96 /* IVTDataSource.h */;
+               name = "IVTDataSource.h: 283";
+               rLen = 0;
+               rLoc = 9792;
+               rType = 0;
+               vrLen = 261;
+               vrLoc = 9594;
+       };
+       022B46DD1218694400A74F96 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 0208C28A0A0A4E5F00255D31 /* Operation.cpp */;
+               name = "Operation.cpp: 29";
+               rLen = 9;
+               rLoc = 753;
+               rType = 0;
+               vrLen = 602;
+               vrLoc = 430;
+       };
+       022B46DE1218694900A74F96 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 0215B3D209F424D800EA7C45 /* elftosb_parser.y */;
+               name = "elftosb_parser.y: 216";
+               rLen = 0;
+               rLoc = 5696;
+               rType = 0;
+               vrLen = 1993;
+               vrLoc = 4162;
+       };
+       022B46E11218696F00A74F96 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 022B4655121763A100A74F96 /* IVTDataSource.h */;
+               name = "IVTDataSource.h: 283";
+               rLen = 0;
+               rLoc = 9792;
+               rType = 0;
+               vrLen = 261;
+               vrLoc = 9594;
+       };
+       022B46E21218696F00A74F96 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 0208C28A0A0A4E5F00255D31 /* Operation.cpp */;
+               name = "Operation.cpp: 29";
+               rLen = 9;
+               rLoc = 753;
+               rType = 0;
+               vrLen = 602;
+               vrLoc = 430;
+       };
+       022B46E31218697600A74F96 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 0215B3D209F424D800EA7C45 /* elftosb_parser.y */;
+               name = "elftosb_parser.y: 216";
+               rLen = 0;
+               rLoc = 5696;
+               rType = 0;
+               vrLen = 1993;
+               vrLoc = 4162;
+       };
+       022B46E61218699C00A74F96 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 022B4655121763A100A74F96 /* IVTDataSource.h */;
+               name = "IVTDataSource.h: 283";
+               rLen = 0;
+               rLoc = 9792;
+               rType = 0;
+               vrLen = 261;
+               vrLoc = 9594;
+       };
+       022B46E71218699C00A74F96 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 0208C28A0A0A4E5F00255D31 /* Operation.cpp */;
+               name = "Operation.cpp: 29";
+               rLen = 9;
+               rLoc = 753;
+               rType = 0;
+               vrLen = 602;
+               vrLoc = 430;
+       };
+       022B46E8121869A100A74F96 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 0215B3D209F424D800EA7C45 /* elftosb_parser.y */;
+               name = "elftosb_parser.y: 216";
+               rLen = 0;
+               rLoc = 5696;
+               rType = 0;
+               vrLen = 1985;
+               vrLoc = 4162;
+       };
+       022B46EC12186A4400A74F96 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 022B4655121763A100A74F96 /* IVTDataSource.h */;
+               name = "IVTDataSource.h: 283";
+               rLen = 0;
+               rLoc = 9792;
+               rType = 0;
+               vrLen = 261;
+               vrLoc = 9594;
+       };
+       022B46ED12186A4400A74F96 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 0208C28A0A0A4E5F00255D31 /* Operation.cpp */;
+               name = "Operation.cpp: 29";
+               rLen = 9;
+               rLoc = 753;
+               rType = 0;
+               vrLen = 602;
+               vrLoc = 430;
+       };
+       022B46EE12186A5B00A74F96 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 0215B3D209F424D800EA7C45 /* elftosb_parser.y */;
+               name = "elftosb_parser.y: 216";
+               rLen = 0;
+               rLoc = 5696;
+               rType = 0;
+               vrLen = 1993;
+               vrLoc = 4162;
+       };
+       022B46F112186A6700A74F96 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 022B4655121763A100A74F96 /* IVTDataSource.h */;
+               name = "IVTDataSource.h: 283";
+               rLen = 0;
+               rLoc = 9792;
+               rType = 0;
+               vrLen = 261;
+               vrLoc = 9594;
+       };
+       022B46F212186A6700A74F96 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 0208C28A0A0A4E5F00255D31 /* Operation.cpp */;
+               name = "Operation.cpp: 29";
+               rLen = 9;
+               rLoc = 753;
+               rType = 0;
+               vrLen = 602;
+               vrLoc = 430;
+       };
+       022B46F312186A8300A74F96 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 0215B3D209F424D800EA7C45 /* elftosb_parser.y */;
+               name = "elftosb_parser.y: 216";
+               rLen = 0;
+               rLoc = 5696;
+               rType = 0;
+               vrLen = 1993;
+               vrLoc = 4162;
+       };
+       022B46F612186AFC00A74F96 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 022B4655121763A100A74F96 /* IVTDataSource.h */;
+               name = "IVTDataSource.h: 283";
+               rLen = 0;
+               rLoc = 9792;
+               rType = 0;
+               vrLen = 261;
+               vrLoc = 9594;
+       };
+       022B46F712186AFC00A74F96 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 0208C28A0A0A4E5F00255D31 /* Operation.cpp */;
+               name = "Operation.cpp: 29";
+               rLen = 9;
+               rLoc = 753;
+               rType = 0;
+               vrLen = 602;
+               vrLoc = 430;
+       };
+       022B46FA1218B7B300A74F96 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 022B4655121763A100A74F96 /* IVTDataSource.h */;
+               name = "IVTDataSource.h: 283";
+               rLen = 0;
+               rLoc = 9792;
+               rType = 0;
+               vrLen = 261;
+               vrLoc = 9594;
+       };
+       022B46FB1218B7B300A74F96 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 0208C28A0A0A4E5F00255D31 /* Operation.cpp */;
+               name = "Operation.cpp: 29";
+               rLen = 9;
+               rLoc = 753;
+               rType = 0;
+               vrLen = 602;
+               vrLoc = 430;
+       };
+       022B46FE1218B7F600A74F96 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 022B4655121763A100A74F96 /* IVTDataSource.h */;
+               name = "IVTDataSource.h: 283";
+               rLen = 0;
+               rLoc = 9792;
+               rType = 0;
+               vrLen = 261;
+               vrLoc = 9594;
+       };
+       022B46FF1218B7F600A74F96 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 0208C28A0A0A4E5F00255D31 /* Operation.cpp */;
+               name = "Operation.cpp: 29";
+               rLen = 9;
+               rLoc = 753;
+               rType = 0;
+               vrLen = 602;
+               vrLoc = 430;
+       };
+       022B47021218B95800A74F96 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 022B4655121763A100A74F96 /* IVTDataSource.h */;
+               name = "IVTDataSource.h: 283";
+               rLen = 0;
+               rLoc = 9792;
+               rType = 0;
+               vrLen = 261;
+               vrLoc = 9594;
+       };
+       022B47031218B95800A74F96 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 0208C28A0A0A4E5F00255D31 /* Operation.cpp */;
+               name = "Operation.cpp: 29";
+               rLen = 9;
+               rLoc = 753;
+               rType = 0;
+               vrLen = 602;
+               vrLoc = 430;
+       };
+       022B47041218B95D00A74F96 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 0215B3D209F424D800EA7C45 /* elftosb_parser.y */;
+               name = "elftosb_parser.y: 154";
+               rLen = 0;
+               rLoc = 4145;
+               rType = 0;
+               vrLen = 1864;
+               vrLoc = 12242;
+       };
+       022B47051218B95D00A74F96 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 0208C2990A0A4EE800255D31 /* ConversionController.cpp */;
+               name = "ConversionController.cpp: 1162";
+               rLen = 0;
+               rLoc = 35162;
+               rType = 0;
+               vrLen = 2895;
+               vrLoc = 35162;
+       };
+       022B47061218B95D00A74F96 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 0208C2990A0A4EE800255D31 /* ConversionController.cpp */;
+               name = "ConversionController.cpp: 1195";
+               rLen = 0;
+               rLoc = 36256;
+               rType = 0;
+               vrLen = 2941;
+               vrLoc = 35162;
+       };
+       022B47091218B96300A74F96 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 022B4655121763A100A74F96 /* IVTDataSource.h */;
+               name = "IVTDataSource.h: 283";
+               rLen = 0;
+               rLoc = 9792;
+               rType = 0;
+               vrLen = 261;
+               vrLoc = 9594;
+       };
+       022B470A1218B96300A74F96 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 0208C28A0A0A4E5F00255D31 /* Operation.cpp */;
+               name = "Operation.cpp: 29";
+               rLen = 9;
+               rLoc = 753;
+               rType = 0;
+               vrLen = 602;
+               vrLoc = 430;
+       };
+       022B470D1218B99F00A74F96 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 022B4655121763A100A74F96 /* IVTDataSource.h */;
+               name = "IVTDataSource.h: 283";
+               rLen = 0;
+               rLoc = 9792;
+               rType = 0;
+               vrLen = 261;
+               vrLoc = 9594;
+       };
+       022B470E1218B99F00A74F96 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 0208C28A0A0A4E5F00255D31 /* Operation.cpp */;
+               name = "Operation.cpp: 29";
+               rLen = 9;
+               rLoc = 753;
+               rType = 0;
+               vrLen = 602;
+               vrLoc = 430;
+       };
+       022B470F1218B9AF00A74F96 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 0208C2990A0A4EE800255D31 /* ConversionController.cpp */;
+               name = "ConversionController.cpp: 1195";
+               rLen = 0;
+               rLoc = 36256;
+               rType = 0;
+               vrLen = 2941;
+               vrLoc = 35162;
+       };
+       022B47121218B9B300A74F96 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 022B4655121763A100A74F96 /* IVTDataSource.h */;
+               name = "IVTDataSource.h: 283";
+               rLen = 0;
+               rLoc = 9792;
+               rType = 0;
+               vrLen = 261;
+               vrLoc = 9594;
+       };
+       022B47131218B9B300A74F96 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 0208C28A0A0A4E5F00255D31 /* Operation.cpp */;
+               name = "Operation.cpp: 29";
+               rLen = 9;
+               rLoc = 753;
+               rType = 0;
+               vrLen = 602;
+               vrLoc = 430;
+       };
+       022B47161218C00000A74F96 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 022B4655121763A100A74F96 /* IVTDataSource.h */;
+               name = "IVTDataSource.h: 283";
+               rLen = 0;
+               rLoc = 9792;
+               rType = 0;
+               vrLen = 261;
+               vrLoc = 9594;
+       };
+       022B47171218C00000A74F96 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 0208C28A0A0A4E5F00255D31 /* Operation.cpp */;
+               name = "Operation.cpp: 29";
+               rLen = 9;
+               rLoc = 753;
+               rType = 0;
+               vrLen = 602;
+               vrLoc = 430;
+       };
+       022B47181218C00400A74F96 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 0208C2990A0A4EE800255D31 /* ConversionController.cpp */;
+               name = "ConversionController.cpp: 1195";
+               rLen = 0;
+               rLoc = 36256;
+               rType = 0;
+               vrLen = 2941;
+               vrLoc = 35162;
+       };
+       022B471B1218C00E00A74F96 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 022B4655121763A100A74F96 /* IVTDataSource.h */;
+               name = "IVTDataSource.h: 283";
+               rLen = 0;
+               rLoc = 9792;
+               rType = 0;
+               vrLen = 261;
+               vrLoc = 9594;
+       };
+       022B471C1218C00E00A74F96 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 0208C28A0A0A4E5F00255D31 /* Operation.cpp */;
+               name = "Operation.cpp: 29";
+               rLen = 9;
+               rLoc = 753;
+               rType = 0;
+               vrLen = 602;
+               vrLoc = 430;
+       };
+       022B471D1218C01000A74F96 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 0208C2990A0A4EE800255D31 /* ConversionController.cpp */;
+               name = "ConversionController.cpp: 1195";
+               rLen = 0;
+               rLoc = 36256;
+               rType = 0;
+               vrLen = 2941;
+               vrLoc = 35162;
+       };
+       022B47201218C12800A74F96 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 022B4655121763A100A74F96 /* IVTDataSource.h */;
+               name = "IVTDataSource.h: 283";
+               rLen = 0;
+               rLoc = 9792;
+               rType = 0;
+               vrLen = 261;
+               vrLoc = 9594;
+       };
+       022B47211218C12800A74F96 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 0208C28A0A0A4E5F00255D31 /* Operation.cpp */;
+               name = "Operation.cpp: 29";
+               rLen = 9;
+               rLoc = 753;
+               rType = 0;
+               vrLen = 602;
+               vrLoc = 430;
+       };
+       022B47221218C13000A74F96 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 0208C2990A0A4EE800255D31 /* ConversionController.cpp */;
+               name = "ConversionController.cpp: 1195";
+               rLen = 0;
+               rLoc = 36256;
+               rType = 0;
+               vrLen = 2911;
+               vrLoc = 35162;
+       };
+       022B47261218C17D00A74F96 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 022B4655121763A100A74F96 /* IVTDataSource.h */;
+               name = "IVTDataSource.h: 283";
+               rLen = 0;
+               rLoc = 9792;
+               rType = 0;
+               vrLen = 261;
+               vrLoc = 9594;
+       };
+       022B47271218C17D00A74F96 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 0208C28A0A0A4E5F00255D31 /* Operation.cpp */;
+               name = "Operation.cpp: 29";
+               rLen = 9;
+               rLoc = 753;
+               rType = 0;
+               vrLen = 602;
+               vrLoc = 430;
+       };
+       022B47281218C17F00A74F96 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 0208C2990A0A4EE800255D31 /* ConversionController.cpp */;
+               name = "ConversionController.cpp: 1195";
+               rLen = 0;
+               rLoc = 36256;
+               rType = 0;
+               vrLen = 2941;
+               vrLoc = 35162;
+       };
+       022B47291218C17F00A74F96 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 0215B3D209F424D800EA7C45 /* elftosb_parser.y */;
+               name = "elftosb_parser.y: 154";
+               rLen = 0;
+               rLoc = 4145;
+               rType = 0;
+               vrLen = 2564;
+               vrLoc = 2608;
+       };
+       022B472A1218C17F00A74F96 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 0215B3D209F424D800EA7C45 /* elftosb_parser.y */;
+               name = "elftosb_parser.y: 809";
+               rLen = 0;
+               rLoc = 20588;
+               rType = 0;
+               vrLen = 2382;
+               vrLoc = 18475;
+       };
+       022B472D1218C18600A74F96 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 022B4655121763A100A74F96 /* IVTDataSource.h */;
+               name = "IVTDataSource.h: 283";
+               rLen = 0;
+               rLoc = 9792;
+               rType = 0;
+               vrLen = 261;
+               vrLoc = 9594;
+       };
+       022B472E1218C18600A74F96 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 0208C28A0A0A4E5F00255D31 /* Operation.cpp */;
+               name = "Operation.cpp: 29";
+               rLen = 9;
+               rLoc = 753;
+               rType = 0;
+               vrLen = 602;
+               vrLoc = 430;
+       };
+       022B472F1218C19000A74F96 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 0215B3D209F424D800EA7C45 /* elftosb_parser.y */;
+               name = "elftosb_parser.y: 809";
+               rLen = 0;
+               rLoc = 20588;
+               rType = 0;
+               vrLen = 2353;
+               vrLoc = 18475;
+       };
+       022B47351218C46700A74F96 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 022B4655121763A100A74F96 /* IVTDataSource.h */;
+               name = "IVTDataSource.h: 283";
+               rLen = 0;
+               rLoc = 9792;
+               rType = 0;
+               vrLen = 261;
+               vrLoc = 9594;
+       };
+       022B47361218C46700A74F96 /* XCBuildMessageTextBookmark */ = {
+               isa = PBXTextBookmark;
+               comments = "Expected primary-expression before '(' token";
+               fRef = 02CD157409F543FE00ABE650 /* ElftosbAST.cpp */;
+               fallbackIsa = XCBuildMessageTextBookmark;
+               rLen = 1;
+               rLoc = 332;
+               rType = 1;
+       };
+       022B47371218C46700A74F96 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 02CD157409F543FE00ABE650 /* ElftosbAST.cpp */;
+               name = "ElftosbAST.cpp: 333";
+               rLen = 0;
+               rLoc = 7480;
+               rType = 0;
+               vrLen = 436;
+               vrLoc = 7125;
+       };
+       022B47381218C46700A74F96 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 0208C28A0A0A4E5F00255D31 /* Operation.cpp */;
+               name = "Operation.cpp: 29";
+               rLen = 9;
+               rLoc = 753;
+               rType = 0;
+               vrLen = 602;
+               vrLoc = 430;
+       };
+       022B47391218C46A00A74F96 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 02F8D5600A0152AB004CBE69 /* SourceFile.h */;
+               name = "SourceFile.h: 110";
+               rLen = 20;
+               rLoc = 3395;
+               rType = 0;
+               vrLen = 2643;
+               vrLoc = 1842;
+       };
+       022B473A1218C46A00A74F96 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 02CD157309F543FE00ABE650 /* ElftosbAST.h */;
+               name = "ElftosbAST.h: 1118";
+               rLen = 13;
+               rLoc = 29207;
+               rType = 0;
+               vrLen = 2093;
+               vrLoc = 28110;
+       };
+       022B473B1218C46A00A74F96 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 0215B3D209F424D800EA7C45 /* elftosb_parser.y */;
+               name = "elftosb_parser.y: 813";
+               rLen = 0;
+               rLoc = 20588;
+               rType = 0;
+               vrLen = 2224;
+               vrLoc = 19102;
+       };
+       022B473C1218C46A00A74F96 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 02CD157409F543FE00ABE650 /* ElftosbAST.cpp */;
+               name = "ElftosbAST.cpp: 333";
+               rLen = 0;
+               rLoc = 7333;
+               rType = 0;
+               vrLen = 2018;
+               vrLoc = 6493;
+       };
+       022B473F1218C46E00A74F96 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 02CD157409F543FE00ABE650 /* ElftosbAST.cpp */;
+               name = "ElftosbAST.cpp: 333";
+               rLen = 0;
+               rLoc = 7480;
+               rType = 0;
+               vrLen = 436;
+               vrLoc = 7125;
+       };
+       022B47401218C46E00A74F96 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 0208C28A0A0A4E5F00255D31 /* Operation.cpp */;
+               name = "Operation.cpp: 29";
+               rLen = 9;
+               rLoc = 753;
+               rType = 0;
+               vrLen = 602;
+               vrLoc = 430;
+       };
+       022B47411218C47C00A74F96 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 02CD157409F543FE00ABE650 /* ElftosbAST.cpp */;
+               name = "ElftosbAST.cpp: 333";
+               rLen = 0;
+               rLoc = 7333;
+               rType = 0;
+               vrLen = 2016;
+               vrLoc = 6493;
+       };
+       022B47451218C49900A74F96 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 02CD157409F543FE00ABE650 /* ElftosbAST.cpp */;
+               name = "ElftosbAST.cpp: 333";
+               rLen = 0;
+               rLoc = 7480;
+               rType = 0;
+               vrLen = 436;
+               vrLoc = 7125;
+       };
+       022B47461218C49900A74F96 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 0208C28A0A0A4E5F00255D31 /* Operation.cpp */;
+               name = "Operation.cpp: 29";
+               rLen = 9;
+               rLoc = 753;
+               rType = 0;
+               vrLen = 602;
+               vrLoc = 430;
+       };
+       022B47491218CA9900A74F96 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 02CD157409F543FE00ABE650 /* ElftosbAST.cpp */;
+               name = "ElftosbAST.cpp: 333";
+               rLen = 0;
+               rLoc = 7480;
+               rType = 0;
+               vrLen = 436;
+               vrLoc = 7125;
+       };
+       022B474A1218CA9900A74F96 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 0208C28A0A0A4E5F00255D31 /* Operation.cpp */;
+               name = "Operation.cpp: 29";
+               rLen = 9;
+               rLoc = 753;
+               rType = 0;
+               vrLen = 602;
+               vrLoc = 430;
+       };
+       022B474B1218CA9A00A74F96 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 02CD157409F543FE00ABE650 /* ElftosbAST.cpp */;
+               name = "ElftosbAST.cpp: 333";
+               rLen = 0;
+               rLoc = 7333;
+               rType = 0;
+               vrLen = 2018;
+               vrLoc = 6493;
+       };
+       022B474C1218CA9A00A74F96 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 02E3997909F2E0410055992A /* elftosb_lexer.l */;
+               name = "elftosb_lexer.l: 61";
+               rLen = 0;
+               rLoc = 1417;
+               rType = 0;
+               vrLen = 1528;
+               vrLoc = 3894;
+       };
+       022B474D1218CA9A00A74F96 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 0215B3D209F424D800EA7C45 /* elftosb_parser.y */;
+               name = "elftosb_parser.y: 809";
+               rLen = 0;
+               rLoc = 20588;
+               rType = 0;
+               vrLen = 2224;
+               vrLoc = 19102;
+       };
+       022B474E1218CA9A00A74F96 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 0215B3D209F424D800EA7C45 /* elftosb_parser.y */;
+               name = "elftosb_parser.y: 1";
+               rLen = 0;
+               rLoc = 0;
+               rType = 0;
+               vrLen = 2169;
+               vrLoc = 19508;
+       };
+       022B47511218CAA200A74F96 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 02CD157409F543FE00ABE650 /* ElftosbAST.cpp */;
+               name = "ElftosbAST.cpp: 333";
+               rLen = 0;
+               rLoc = 7480;
+               rType = 0;
+               vrLen = 436;
+               vrLoc = 7125;
+       };
+       022B47521218CAA200A74F96 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 0208C28A0A0A4E5F00255D31 /* Operation.cpp */;
+               name = "Operation.cpp: 29";
+               rLen = 9;
+               rLoc = 753;
+               rType = 0;
+               vrLen = 602;
+               vrLoc = 430;
+       };
+       022B47531218CAAA00A74F96 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 0215B3D209F424D800EA7C45 /* elftosb_parser.y */;
+               name = "elftosb_parser.y: 1";
+               rLen = 0;
+               rLoc = 0;
+               rType = 0;
+               vrLen = 2130;
+               vrLoc = 19547;
+       };
+       022B47571218CACE00A74F96 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 02CD157409F543FE00ABE650 /* ElftosbAST.cpp */;
+               name = "ElftosbAST.cpp: 333";
+               rLen = 0;
+               rLoc = 7480;
+               rType = 0;
+               vrLen = 436;
+               vrLoc = 7125;
+       };
+       022B47581218CACE00A74F96 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 0208C28A0A0A4E5F00255D31 /* Operation.cpp */;
+               name = "Operation.cpp: 29";
+               rLen = 9;
+               rLoc = 753;
+               rType = 0;
+               vrLen = 602;
+               vrLoc = 430;
+       };
+       022B475B1218CAD200A74F96 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 02CD157409F543FE00ABE650 /* ElftosbAST.cpp */;
+               name = "ElftosbAST.cpp: 333";
+               rLen = 0;
+               rLoc = 7480;
+               rType = 0;
+               vrLen = 436;
+               vrLoc = 7125;
+       };
+       022B475C1218CAD200A74F96 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 0208C28A0A0A4E5F00255D31 /* Operation.cpp */;
+               name = "Operation.cpp: 29";
+               rLen = 9;
+               rLoc = 753;
+               rType = 0;
+               vrLen = 602;
+               vrLoc = 430;
+       };
+       022B475D1218CAD700A74F96 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 0215B3D209F424D800EA7C45 /* elftosb_parser.y */;
+               name = "elftosb_parser.y: 454";
+               rLen = 0;
+               rLoc = 11226;
+               rType = 0;
+               vrLen = 1812;
+               vrLoc = 10479;
+       };
+       022B47601218CADD00A74F96 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 02CD157409F543FE00ABE650 /* ElftosbAST.cpp */;
+               name = "ElftosbAST.cpp: 333";
+               rLen = 0;
+               rLoc = 7480;
+               rType = 0;
+               vrLen = 436;
+               vrLoc = 7125;
+       };
+       022B47611218CADD00A74F96 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 0208C28A0A0A4E5F00255D31 /* Operation.cpp */;
+               name = "Operation.cpp: 29";
+               rLen = 9;
+               rLoc = 753;
+               rType = 0;
+               vrLen = 602;
+               vrLoc = 430;
+       };
+       022B47621218CAE000A74F96 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 0215B3D209F424D800EA7C45 /* elftosb_parser.y */;
+               name = "elftosb_parser.y: 454";
+               rLen = 0;
+               rLoc = 11226;
+               rType = 0;
+               vrLen = 1812;
+               vrLoc = 10479;
+       };
+       022B47651218CDA800A74F96 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 02CD157409F543FE00ABE650 /* ElftosbAST.cpp */;
+               name = "ElftosbAST.cpp: 333";
+               rLen = 0;
+               rLoc = 7480;
+               rType = 0;
+               vrLen = 436;
+               vrLoc = 7125;
+       };
+       022B47661218CDA800A74F96 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 0208C28A0A0A4E5F00255D31 /* Operation.cpp */;
+               name = "Operation.cpp: 29";
+               rLen = 9;
+               rLoc = 753;
+               rType = 0;
+               vrLen = 602;
+               vrLoc = 430;
+       };
+       022B47691218CDAE00A74F96 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 02CD157409F543FE00ABE650 /* ElftosbAST.cpp */;
+               name = "ElftosbAST.cpp: 333";
+               rLen = 0;
+               rLoc = 7480;
+               rType = 0;
+               vrLen = 436;
+               vrLoc = 7125;
+       };
+       022B476A1218CDAE00A74F96 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 0208C28A0A0A4E5F00255D31 /* Operation.cpp */;
+               name = "Operation.cpp: 29";
+               rLen = 9;
+               rLoc = 753;
+               rType = 0;
+               vrLen = 602;
+               vrLoc = 430;
+       };
+       022B476D1218CDBB00A74F96 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 02CD157409F543FE00ABE650 /* ElftosbAST.cpp */;
+               name = "ElftosbAST.cpp: 333";
+               rLen = 0;
+               rLoc = 7480;
+               rType = 0;
+               vrLen = 436;
+               vrLoc = 7125;
+       };
+       022B476E1218CDBB00A74F96 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 0208C28A0A0A4E5F00255D31 /* Operation.cpp */;
+               name = "Operation.cpp: 29";
+               rLen = 9;
+               rLoc = 753;
+               rType = 0;
+               vrLen = 602;
+               vrLoc = 430;
+       };
+       022B476F1218CDBF00A74F96 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 0215B3D209F424D800EA7C45 /* elftosb_parser.y */;
+               name = "elftosb_parser.y: 454";
+               rLen = 0;
+               rLoc = 11226;
+               rType = 0;
+               vrLen = 1812;
+               vrLoc = 10479;
+       };
+       022B47701218CDBF00A74F96 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 02E535B30C245AEC00CBD4A5 /* DataSourceImager.h */;
+               name = "DataSourceImager.h: 55";
+               rLen = 0;
+               rLoc = 1268;
+               rType = 0;
+               vrLen = 1359;
+               vrLoc = 0;
+       };
+       022B47711218CDBF00A74F96 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 0296A49309D9AE9400F80AFF /* elftosb.cpp */;
+               name = "elftosb.cpp: 574";
+               rLen = 0;
+               rLoc = 14572;
+               rType = 0;
+               vrLen = 2191;
+               vrLoc = 13336;
+       };
+       022B47721218CDBF00A74F96 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 0296A49309D9AE9400F80AFF /* elftosb.cpp */;
+               name = "elftosb.cpp: 45";
+               rLen = 0;
+               rLoc = 1198;
+               rType = 0;
+               vrLen = 2551;
+               vrLoc = 428;
+       };
+       0234AF900D69029300A16BFF /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 020D47A00A16C1E00027E24E /* EncoreBootImageReader.h */;
+               name = "EncoreBootImageReader.h: 34";
+               rLen = 0;
+               rLoc = 863;
+               rType = 0;
+               vrLen = 1721;
+               vrLoc = 682;
+       };
+       0234AF910D69029300A16BFF /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 020D47A10A16C1E00027E24E /* EncoreBootImageReader.cpp */;
+               name = "EncoreBootImageReader.cpp: 1";
+               rLen = 0;
+               rLoc = 0;
+               rType = 0;
+               vrLen = 2023;
+               vrLoc = 3994;
+       };
+       0234AF920D69029300A16BFF /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 02C5DDD20A940126003B9C11 /* istream */;
+               name = "istream: 69";
+               rLen = 15;
+               rLoc = 2509;
+               rType = 0;
+               vrLen = 1912;
+               vrLoc = 2126;
+       };
+       0234AF930D69029300A16BFF /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 0234AF940D69029300A16BFF /* ios_base.h */;
+               name = "ios_base.h: 392";
+               rLen = 34;
+               rLoc = 13347;
+               rType = 0;
+               vrLen = 1830;
+               vrLoc = 12554;
+       };
+       0234AF940D69029300A16BFF /* ios_base.h */ = {
+               isa = PBXFileReference;
+               lastKnownFileType = sourcecode.c.h;
+               name = ios_base.h;
+               path = "/Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.0.0/bits/ios_base.h";
+               sourceTree = "<absolute>";
+       };
+       0234AF950D69029300A16BFF /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 0234AF960D69029300A16BFF /* streambuf */;
+               name = "streambuf: 483";
+               rLen = 62;
+               rLoc = 16527;
+               rType = 0;
+               vrLen = 1541;
+               vrLoc = 15775;
+       };
+       0234AF960D69029300A16BFF /* streambuf */ = {
+               isa = PBXFileReference;
+               lastKnownFileType = sourcecode.cpp.h;
+               name = streambuf;
+               path = "/Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.0.0/streambuf";
+               sourceTree = "<absolute>";
+       };
+       0234AF970D69029300A16BFF /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 024F1D600A0BCD8300D21D61 /* ELFSourceFile.h */;
+               name = "ELFSourceFile.h: 127";
+               rLen = 0;
+               rLoc = 3389;
+               rType = 0;
+               vrLen = 2032;
+               vrLoc = 4242;
+       };
+       0234AF9A0D69029300A16BFF /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 024F1D610A0BCD8300D21D61 /* ELFSourceFile.cpp */;
+               name = "ELFSourceFile.cpp: 104";
+               rLen = 32;
+               rLoc = 2168;
+               rType = 0;
+               vrLen = 1442;
+               vrLoc = 4626;
+       };
+       0234AF9C0D69029300A16BFF /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 020D41980A0FF5BF0027E24E /* BootImageGenerator.cpp */;
+               name = "BootImageGenerator.cpp: 1";
+               rLen = 0;
+               rLoc = 0;
+               rType = 0;
+               vrLen = 1426;
+               vrLoc = 202;
+       };
+       0234AF9D0D69029300A16BFF /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 020D41970A0FF5BF0027E24E /* BootImageGenerator.h */;
+               name = "BootImageGenerator.h: 1";
+               rLen = 0;
+               rLoc = 0;
+               rType = 0;
+               vrLen = 1843;
+               vrLoc = 481;
+       };
+       0234AFA00D69029300A16BFF /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 021CA3F10A8D16960028326F /* ExcludesListMatcher.cpp */;
+               name = "ExcludesListMatcher.cpp: 83";
+               rLen = 0;
+               rLoc = 2115;
+               rType = 0;
+               vrLen = 1218;
+               vrLoc = 1018;
+       };
+       0234AFA20D69029300A16BFF /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 02E535B30C245AEC00CBD4A5 /* DataSourceImager.h */;
+               name = "DataSourceImager.h: 55";
+               rLen = 0;
+               rLoc = 1268;
+               rType = 0;
+               vrLen = 1251;
+               vrLoc = 108;
+       };
+       024A0F200C53B9D8000317D4 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 02D1FD180BD039BF007C7450 /* stl_list.h */;
+               name = erase;
+               rLen = 5;
+               rLoc = 27870;
+               rType = 0;
+               vrLen = 2248;
+               vrLoc = 25661;
+       };
+       024F1D5C0A0BCD7200D21D61 /* SRecordSourceFile.h */ = {
+               uiCtxt = {
+                       sepNavIntBoundsRect = "{{0, 0}, {692, 1288}}";
+                       sepNavSelRange = "{2137, 0}";
+                       sepNavVisRange = "{1103, 1429}";
+                       sepNavVisRect = "{{0, 448}, {706, 782}}";
+               };
+       };
+       024F1D5D0A0BCD7200D21D61 /* SRecordSourceFile.cpp */ = {
+               uiCtxt = {
+                       sepNavIntBoundsRect = "{{0, 0}, {692, 2604}}";
+                       sepNavSelRange = "{4100, 0}";
+                       sepNavVisRange = "{0, 1348}";
+                       sepNavVisRect = "{{0, 1822}, {706, 782}}";
+               };
+       };
+       024F1D600A0BCD8300D21D61 /* ELFSourceFile.h */ = {
+               uiCtxt = {
+                       sepNavIntBoundsRect = "{{0, 0}, {692, 3360}}";
+                       sepNavSelRange = "{3389, 0}";
+                       sepNavVisRange = "{4242, 2032}";
+                       sepNavVisRect = "{{0, 2136}, {706, 782}}";
+               };
+       };
+       024F1D610A0BCD8300D21D61 /* ELFSourceFile.cpp */ = {
+               uiCtxt = {
+                       sepNavIntBoundsRect = "{{0, 0}, {692, 7378}}";
+                       sepNavSelRange = "{2168, 32}";
+                       sepNavVisRange = "{4626, 1442}";
+                       sepNavVisRect = "{{0, 2762}, {706, 782}}";
+                       sepNavWindowFrame = "{{15, 63}, {775, 810}}";
+               };
+       };
+       024F1E190A0D20C900D21D61 /* ElftosbErrors.h */ = {
+               uiCtxt = {
+                       sepNavIntBoundsRect = "{{0, 0}, {706, 782}}";
+                       sepNavSelRange = "{688, 49}";
+                       sepNavVisRect = "{{0, 0}, {706, 782}}";
+               };
+       };
+       0258817C0CF13C0400681C7E /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 0258817D0CF13C0400681C7E /* backward_warning.h */;
+               name = "backward_warning.h: 32";
+               rLen = 76;
+               rLoc = 1475;
+               rType = 0;
+               vrLen = 1853;
+               vrLoc = 0;
+       };
+       0258817D0CF13C0400681C7E /* backward_warning.h */ = {
+               isa = PBXFileReference;
+               lastKnownFileType = sourcecode.c.h;
+               name = backward_warning.h;
+               path = "/Developer/SDKs/MacOSX10.4u.sdk/usr/include/c++/4.0.0/backward/backward_warning.h";
+               sourceTree = "<absolute>";
+       };
+       025881810CF13C0400681C7E /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 025881820CF13C0400681C7E /* FlexLexer.h */;
+               name = "FlexLexer.h: 104";
+               rLen = 11;
+               rLoc = 3198;
+               rType = 0;
+               vrLen = 1767;
+               vrLoc = 2593;
+       };
+       025881820CF13C0400681C7E /* FlexLexer.h */ = {
+               isa = PBXFileReference;
+               lastKnownFileType = sourcecode.c.h;
+               name = FlexLexer.h;
+               path = /Developer/SDKs/MacOSX10.5.sdk/usr/include/FlexLexer.h;
+               sourceTree = "<absolute>";
+       };
+       025881850CF13C0400681C7E /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 0208C08B0A05677000255D31 /* AESKey.cpp */;
+               name = "AESKey.cpp: 26";
+               rLen = 0;
+               rLoc = 968;
+               rType = 0;
+               vrLen = 1825;
+               vrLoc = 280;
+       };
+       025881860CF13C0400681C7E /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 02123F370A6B09CF003CF33F /* HexValues.h */;
+               name = "HexValues.h: 14";
+               rLen = 0;
+               rLoc = 471;
+               rType = 0;
+               vrLen = 872;
+               vrLoc = 0;
+       };
+       025881870CF13C0400681C7E /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 02FE65860C0522B0004A1450 /* todo.txt */;
+               name = "todo.txt: 13";
+               rLen = 0;
+               rLoc = 281;
+               rType = 0;
+               vrLen = 348;
+               vrLoc = 0;
+       };
+       025881890CF13C0400681C7E /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 0208BEB10A02D2B800255D31 /* SHA1.cpp */;
+               name = "SHA1.cpp: 132";
+               rLen = 54;
+               rLoc = 4579;
+               rType = 0;
+               vrLen = 1473;
+               vrLoc = 3781;
+       };
+       027402E30A0FB00000CF4BE7 /* GlobMatcher.h */ = {
+               uiCtxt = {
+                       sepNavIntBoundsRect = "{{0, 0}, {692, 952}}";
+                       sepNavSelRange = "{1227, 0}";
+                       sepNavVisRange = "{353, 1560}";
+                       sepNavVisRect = "{{0, 170}, {706, 782}}";
+               };
+       };
+       027402E40A0FB00000CF4BE7 /* GlobMatcher.cpp */ = {
+               uiCtxt = {
+                       sepNavIntBoundsRect = "{{0, 0}, {706, 1932}}";
+                       sepNavSelRange = "{564, 0}";
+                       sepNavVisRect = "{{0, 262}, {706, 782}}";
+               };
+       };
+       027EE3C30BD6930A00A6A136 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 020D41860A0FF0C20027E24E /* OutputSection.cpp */;
+               name = "OutputSection.cpp: 2";
+               rLen = 0;
+               rLoc = 29;
+               rType = 0;
+               vrLen = 507;
+               vrLoc = 0;
+       };
+       027EE3C80BD6930A00A6A136 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 027402E40A0FB00000CF4BE7 /* GlobMatcher.cpp */;
+               name = "GlobMatcher.cpp: NEGATE";
+               rLen = 0;
+               rLoc = 564;
+               rType = 0;
+               vrLen = 1377;
+               vrLoc = 518;
+       };
+       027EE42D0BD6AF1B00A6A136 /* string.h */ = {
+               isa = PBXFileReference;
+               lastKnownFileType = sourcecode.c.h;
+               name = string.h;
+               path = /Developer/SDKs/MacOSX10.4u.sdk/usr/include/string.h;
+               sourceTree = "<absolute>";
+       };
+       0292B60E0CDA9CFD00A3A500 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 02CD158809F557D300ABE650 /* ElftosbLexer.cpp */;
+               name = "ElftosbLexer.cpp: processStringEscapes";
+               rLen = 0;
+               rLoc = 3573;
+               rType = 0;
+               vrLen = 1665;
+               vrLoc = 1066;
+       };
+       0292B60F0CDA9CFD00A3A500 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 020D45050A1523350027E24E /* GHSSecInfo.cpp */;
+               name = "GHSSecInfo.cpp: isSectionFilled";
+               rLen = 0;
+               rLoc = 2485;
+               rType = 0;
+               vrLen = 2010;
+               vrLoc = 140;
+       };
+       0292B6100CDA9CFD00A3A500 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 02E9D67409FBFE98006D7279 /* EvalContext.cpp */;
+               name = "EvalContext::EvalContext()";
+               rLen = 27;
+               rLoc = 575;
+               rType = 0;
+               vrLen = 1382;
+               vrLoc = 0;
+       };
+       0292B6160CDA9CFD00A3A500 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 02F8D5600A0152AB004CBE69 /* SourceFile.h */;
+               name = "SourceFile.h: 68";
+               rLen = 0;
+               rLoc = 2070;
+               rType = 0;
+               vrLen = 1924;
+               vrLoc = 2408;
+       };
+       0292B6170CDA9CFD00A3A500 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 02FE65040BFE669B004A1450 /* complex.bd */;
+               name = "complex.bd: 92";
+               rLen = 0;
+               rLoc = 1778;
+               rType = 0;
+               vrLen = 1102;
+               vrLoc = 871;
+       };
+       0292B6180CDA9CFD00A3A500 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 02F8D5610A0152AB004CBE69 /* SourceFile.cpp */;
+               name = "SourceFile.cpp: 125";
+               rLen = 0;
+               rLoc = 2968;
+               rType = 0;
+               vrLen = 986;
+               vrLoc = 2165;
+       };
+       0296A45509D9AE7A00F80AFF /* elftosb */ = {
+               isa = PBXExecutable;
+               activeArgIndices = (
+                       YES,
+                       YES,
+                       YES,
+                       YES,
+                       YES,
+                       NO,
+                       YES,
+                       NO,
+                       NO,
+                       YES,
+                       YES,
+                       YES,
+                       YES,
+                       NO,
+                       NO,
+                       NO,
+                       YES,
+                       NO,
+                       NO,
+                       YES,
+                       NO,
+                       NO,
+                       NO,
+                       NO,
+                       YES,
+                       YES,
+                       YES,
+                       NO,
+                       NO,
+                       NO,
+                       NO,
+                       NO,
+                       NO,
+                       YES,
+                       YES,
+                       YES,
+                       YES,
+                       NO,
+                       NO,
+                       NO,
+                       NO,
+                       NO,
+                       NO,
+                       NO,
+                       NO,
+                       NO,
+               );
+               argumentStrings = (
+                       "-p",
+                       test_files,
+                       "-p",
+                       bdfiles,
+                       "--chip-family",
+                       37xx,
+                       i.MX28,
+                       mx233,
+                       36xx,
+                       "-D",
+                       "testConst=1",
+                       "--debug",
+                       "--verbose",
+                       "-O",
+                       "enableSections=true",
+                       "-q",
+                       "-z",
+                       "-k",
+                       test1.key,
+                       "-c",
+                       habtest.bd,
+                       bdfiles/simple.e,
+                       complex.bd,
+                       bdfiles/complex.bd,
+                       bdfiles/basic_test_cmd.e,
+                       "-o",
+                       output.sb,
+                       test_output/output.sb2,
+                       "-D",
+                       "switchArg1=2",
+                       "-D",
+                       "switchArg2=0",
+                       "newBootMode=5",
+                       test_files/hello_NOR_mixed,
+                       test_files/redboot_gcc.srec,
+                       test_files/hostlink,
+                       test_files/sd_player_gcc,
+                       test_files/sd_player_gcc.srec,
+                       plugin_complex,
+                       test_files/plugin_complex,
+                       test0.key,
+                       test0.key,
+                       ProfileSeedFile50k.bin,
+                       ProfileSeed.bin,
+                       test_files/ProfileSeedFile50k.bin,
+                       test_files/ProfileSeed.bin,
+               );
+               autoAttachOnCrash = 1;
+               breakpointsEnabled = 0;
+               configStateDict = {
+                       "PBXLSLaunchAction-0" = {
+                               PBXLSLaunchAction = 0;
+                               PBXLSLaunchStartAction = 1;
+                               PBXLSLaunchStdioStyle = 2;
+                               PBXLSLaunchStyle = 0;
+                               class = PBXLSRunLaunchConfig;
+                               displayName = "Executable Runner";
+                               identifier = com.apple.Xcode.launch.runConfig;
+                               remoteHostInfo = "";
+                               startActionInfo = "";
+                       };
+               };
+               customDataFormattersEnabled = 1;
+               dataTipCustomDataFormattersEnabled = 1;
+               dataTipShowTypeColumn = 1;
+               dataTipSortType = 0;
+               debuggerPlugin = GDBDebugging;
+               disassemblyDisplayState = 0;
+               dylibVariantSuffix = "";
+               enableDebugStr = 1;
+               environmentEntries = (
+               );
+               executableSystemSymbolLevel = 0;
+               executableUserSymbolLevel = 3;
+               libgmallocEnabled = 0;
+               name = elftosb;
+               savedGlobals = {
+               };
+               showTypeColumn = 0;
+               sourceDirectories = (
+               );
+               startupPath = "<<ProjectDirectory>>";
+               variableFormatDictionary = {
+                       $cs = 1;
+                       $ds = 1;
+                       $eax = 1;
+                       $ebp = 1;
+                       $ebx = 1;
+                       $ecx = 1;
+                       $edi = 1;
+                       $edx = 1;
+                       $eflags = 1;
+                       $eip = 1;
+                       $es = 1;
+                       $esi = 1;
+                       $esp = 1;
+                       $gs = 1;
+                       $mm0 = 1;
+                       $mm1 = 1;
+                       $mm2 = 1;
+                       $mm3 = 1;
+                       $mm4 = 1;
+                       $mm5 = 1;
+                       $mm6 = 1;
+                       $mm7 = 1;
+                       $mxcsr = 1;
+                       $ss = 1;
+                       $xmm0 = 1;
+                       $xmm1 = 1;
+                       $xmm2 = 1;
+                       $xmm3 = 1;
+                       $xmm4 = 1;
+                       $xmm5 = 1;
+                       $xmm6 = 1;
+                       $xmm7 = 1;
+                       "0-uint8_t-elftosbTool::addCryptoKeys" = 1;
+                       "1-uint8_t-elftosbTool::addCryptoKeys" = 1;
+                       "10-uint8_t-elftosbTool::addCryptoKeys" = 1;
+                       "11-uint8_t-elftosbTool::addCryptoKeys" = 1;
+                       "12-uint8_t-elftosbTool::addCryptoKeys" = 1;
+                       "13-uint8_t-elftosbTool::addCryptoKeys" = 1;
+                       "14-uint8_t-elftosbTool::addCryptoKeys" = 1;
+                       "15-uint8_t-elftosbTool::addCryptoKeys" = 1;
+                       "2-uint8_t-elftosbTool::addCryptoKeys" = 1;
+                       "3-uint8_t-elftosbTool::addCryptoKeys" = 1;
+                       "4-uint8_t-elftosbTool::addCryptoKeys" = 1;
+                       "5-uint8_t-elftosbTool::addCryptoKeys" = 1;
+                       "6-uint8_t-elftosbTool::addCryptoKeys" = 1;
+                       "7-uint8_t-elftosbTool::addCryptoKeys" = 1;
+                       "8-uint8_t-elftosbTool::addCryptoKeys" = 1;
+                       "9-uint8_t-elftosbTool::addCryptoKeys" = 1;
+                       "m_identifier-uint32_t-elftosb::EncoreBootImageGenerator::processSectionOptions" = 1;
+                       "m_key-uint8_t [16]-elftosbTool::addCryptoKeys" = 1;
+               };
+       };
+       0296A48709D9AE9400F80AFF /* ELF.h */ = {
+               uiCtxt = {
+                       sepNavIntBoundsRect = "{{0, 0}, {706, 4858}}";
+                       sepNavSelRange = "{8439, 17}";
+                       sepNavVisRect = "{{0, 3564}, {706, 782}}";
+               };
+       };
+       0296A49309D9AE9400F80AFF /* elftosb.cpp */ = {
+               uiCtxt = {
+                       sepNavIntBoundsRect = "{{0, 0}, {810, 10075}}";
+                       sepNavSelRange = "{1198, 0}";
+                       sepNavVisRange = "{428, 2551}";
+                       sepNavVisRect = "{{0, 238}, {706, 782}}";
+               };
+       };
+       0296A49409D9AE9400F80AFF /* elftosb.h */ = {
+               uiCtxt = {
+                       sepNavIntBoundsRect = "{{0, 0}, {706, 542}}";
+                       sepNavSelRange = "{0, 0}";
+                       sepNavVisRect = "{{0, 0}, {706, 542}}";
+               };
+       };
+       0296A49E09D9AE9400F80AFF /* stdafx.cpp */ = {
+               uiCtxt = {
+                       sepNavIntBoundsRect = "{{0, 0}, {736, 752}}";
+                       sepNavSelRange = "{294, 0}";
+                       sepNavVisRect = "{{0, 0}, {736, 752}}";
+               };
+       };
+       0296A49F09D9AE9400F80AFF /* StELFFile.cpp */ = {
+               uiCtxt = {
+                       sepNavIntBoundsRect = "{{0, 0}, {701, 7630}}";
+                       sepNavSelRange = "{12530, 0}";
+                       sepNavVisRect = "{{0, 4707}, {701, 764}}";
+               };
+       };
+       0296A4A009D9AE9400F80AFF /* StELFFile.h */ = {
+               uiCtxt = {
+                       sepNavIntBoundsRect = "{{0, 0}, {692, 2870}}";
+                       sepNavSelRange = "{0, 0}";
+                       sepNavVisRange = "{0, 1545}";
+                       sepNavVisRect = "{{0, 1514}, {706, 542}}";
+               };
+       };
+       0296A4A409D9AE9400F80AFF /* StExecutableImage.cpp */ = {
+               uiCtxt = {
+                       sepNavIntBoundsRect = "{{0, 0}, {732, 6622}}";
+                       sepNavSelRange = "{6397, 0}";
+                       sepNavVisRect = "{{0, 2800}, {732, 782}}";
+               };
+       };
+       0296A4A509D9AE9400F80AFF /* StExecutableImage.h */ = {
+               uiCtxt = {
+                       sepNavIntBoundsRect = "{{0, 0}, {692, 3640}}";
+                       sepNavSelRange = "{2539, 57}";
+                       sepNavVisRange = "{1155, 2120}";
+                       sepNavVisRect = "{{0, 2177}, {742, 782}}";
+               };
+       };
+       0296A4AA09D9AE9400F80AFF /* StSRecordFile.cpp */ = {
+               uiCtxt = {
+                       sepNavIntBoundsRect = "{{0, 0}, {732, 3402}}";
+                       sepNavSelRange = "{2909, 0}";
+                       sepNavVisRect = "{{0, 2058}, {732, 782}}";
+               };
+       };
+       0296A4AB09D9AE9400F80AFF /* StSRecordFile.h */ = {
+               uiCtxt = {
+                       sepNavIntBoundsRect = "{{0, 0}, {692, 1792}}";
+                       sepNavSelRange = "{3611, 0}";
+                       sepNavVisRange = "{2223, 1584}";
+                       sepNavVisRect = "{{0, 1010}, {706, 782}}";
+               };
+       };
+       0296A50409D9AE9400F80AFF /* Source Control */ = {
+               isa = PBXSourceControlManager;
+               fallbackIsa = XCSourceControlManager;
+               isSCMEnabled = 0;
+               scmConfiguration = {
+                       repositoryName = himikoip;
+                       repositoryNamesForRoots = {
+                               "" = "psg-firmware";
+                       };
+               };
+               scmType = scm.subversion;
+       };
+       0296A50509D9AE9400F80AFF /* Code sense */ = {
+               isa = PBXCodeSenseManager;
+               indexTemplatePath = "";
+       };
+       0296CF9C09DB3C5200F80AFF /* stdafx.h */ = {
+               uiCtxt = {
+                       sepNavIntBoundsRect = "{{0, 0}, {740, 1092}}";
+                       sepNavSelRange = "{1626, 0}";
+                       sepNavVisRange = "{0, 2167}";
+                       sepNavVisRect = "{{0, 372}, {732, 782}}";
+               };
+       };
+       02B9D4FB0B9A13AE0084CE1F /* SB36xxBootImageGenerator.h */ = {
+               uiCtxt = {
+                       sepNavIntBoundsRect = "{{0, 0}, {706, 826}}";
+                       sepNavSelRange = "{1395, 0}";
+                       sepNavVisRect = "{{0, 0}, {706, 782}}";
+               };
+       };
+       02B9D4FC0B9A13AE0084CE1F /* SB36xxBootImageGenerator.cpp */ = {
+               uiCtxt = {
+                       sepNavIntBoundsRect = "{{0, 0}, {706, 3402}}";
+                       sepNavSelRange = "{3994, 0}";
+                       sepNavVisRect = "{{0, 1262}, {706, 782}}";
+               };
+       };
+       02B9D5020B9A16C10084CE1F /* St3600IPL.cpp */ = {
+               uiCtxt = {
+                       sepNavIntBoundsRect = "{{0, 0}, {692, 11746}}";
+                       sepNavSelRange = "{21214, 23}";
+                       sepNavVisRange = "{21696, 1756}";
+                       sepNavVisRect = "{{0, 9338}, {706, 782}}";
+               };
+       };
+       02B9D5030B9A16C10084CE1F /* St3600IPL.h */ = {
+               uiCtxt = {
+                       sepNavIntBoundsRect = "{{0, 0}, {740, 5044}}";
+                       sepNavSelRange = "{2516, 135}";
+                       sepNavVisRange = "{1241, 2955}";
+                       sepNavVisRect = "{{0, 3086}, {706, 782}}";
+               };
+       };
+       02B9D5060B9A16C10084CE1F /* StKeySet.h */ = {
+               uiCtxt = {
+                       sepNavIntBoundsRect = "{{0, 0}, {742, 938}}";
+                       sepNavSelRange = "{0, 0}";
+                       sepNavVisRect = "{{0, 129}, {742, 782}}";
+               };
+       };
+       02B9D5090B9A16C10084CE1F /* table.c */ = {
+               uiCtxt = {
+                       sepNavIntBoundsRect = "{{0, 0}, {706, 18424}}";
+                       sepNavSelRange = "{0, 0}";
+                       sepNavVisRect = "{{0, 0}, {706, 782}}";
+               };
+       };
+       02B9D56B0B9B37890084CE1F /* default_rom_key.h */ = {
+               uiCtxt = {
+                       sepNavIntBoundsRect = "{{0, 0}, {742, 782}}";
+                       sepNavSelRange = "{0, 0}";
+                       sepNavVisRect = "{{0, 0}, {742, 782}}";
+               };
+       };
+       02C5DB910A925C61003B9C11 /* format_string.h */ = {
+               uiCtxt = {
+                       sepNavIntBoundsRect = "{{0, 0}, {692, 778}}";
+                       sepNavSelRange = "{649, 0}";
+                       sepNavVisRange = "{0, 734}";
+                       sepNavVisRect = "{{0, 0}, {706, 782}}";
+               };
+       };
+       02C5DB920A925C61003B9C11 /* format_string.cpp */ = {
+               uiCtxt = {
+                       sepNavIntBoundsRect = "{{0, 0}, {683, 1079}}";
+                       sepNavSelRange = "{602, 0}";
+                       sepNavVisRange = "{478, 290}";
+                       sepNavVisRect = "{{0, 247}, {706, 782}}";
+               };
+       };
+       02C5DBD20A926A7F003B9C11 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 02C5DBD30A926A7F003B9C11 /* stdarg.h */;
+               name = "(null): 1";
+               rLen = 0;
+               rLoc = 0;
+               rType = 0;
+               vrLen = 1796;
+               vrLoc = 761;
+       };
+       02C5DBD30A926A7F003B9C11 /* stdarg.h */ = {
+               isa = PBXFileReference;
+               lastKnownFileType = sourcecode.c.h;
+               name = stdarg.h;
+               path = "/Developer/SDKs/MacOSX10.4u.sdk/usr/lib/gcc/i686-apple-darwin8/4.0.1/include/stdarg.h";
+               sourceTree = "<absolute>";
+       };
+       02C5DBD50A926A7F003B9C11 /* stdio.h */ = {
+               isa = PBXFileReference;
+               lastKnownFileType = sourcecode.c.h;
+               name = stdio.h;
+               path = /Developer/SDKs/MacOSX10.4u.sdk/usr/include/stdio.h;
+               sourceTree = "<absolute>";
+       };
+       02C5DBDB0A926A7F003B9C11 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 024F1E190A0D20C900D21D61 /* ElftosbErrors.h */;
+               name = "ElftosbErrors.h: semantic_error";
+               rLen = 0;
+               rLoc = 827;
+               rType = 0;
+               vrLen = 885;
+               vrLoc = 0;
+       };
+       02C5DC000A93AC85003B9C11 /* EndianUtilities.h */ = {
+               uiCtxt = {
+                       sepNavIntBoundsRect = "{{0, 0}, {692, 2100}}";
+                       sepNavSelRange = "{2183, 0}";
+                       sepNavVisRange = "{3291, 1685}";
+                       sepNavVisRect = "{{0, 93}, {706, 782}}";
+               };
+       };
+       02C5DC310A93C14E003B9C11 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 02C5DC320A93C14E003B9C11 /* Endian.h */;
+               name = "(null): 126";
+               rLen = 0;
+               rLoc = 4144;
+               rType = 0;
+               vrLen = 2784;
+               vrLoc = 5362;
+       };
+       02C5DC320A93C14E003B9C11 /* Endian.h */ = {
+               isa = PBXFileReference;
+               lastKnownFileType = sourcecode.c.h;
+               name = Endian.h;
+               path = /Developer/SDKs/MacOSX10.4u.sdk/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/CarbonCore.framework/Versions/A/Headers/Endian.h;
+               sourceTree = "<absolute>";
+       };
+       02C5DC330A93C14E003B9C11 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 02C5DC340A93C14E003B9C11 /* TargetConditionals.h */;
+               name = "#if defined(__GNUC__) && ( defined(__APPLE_CPP__) || defined(__APPLE_CC__) || defined(__MACOS_CLASSIC__) )";
+               rLen = 106;
+               rLoc = 2474;
+               rType = 0;
+               vrLen = 2403;
+               vrLoc = 1435;
+       };
+       02C5DC340A93C14E003B9C11 /* TargetConditionals.h */ = {
+               isa = PBXFileReference;
+               lastKnownFileType = sourcecode.c.h;
+               name = TargetConditionals.h;
+               path = /Developer/SDKs/MacOSX10.4u.sdk/usr/include/TargetConditionals.h;
+               sourceTree = "<absolute>";
+       };
+       02C5DC350A93C14E003B9C11 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 02C5DC360A93C14E003B9C11 /* ConditionalMacros.h */;
+               name = TargetConditionals.h;
+               rLen = 20;
+               rLoc = 1458;
+               rType = 0;
+               vrLen = 2328;
+               vrLoc = 333;
+       };
+       02C5DC360A93C14E003B9C11 /* ConditionalMacros.h */ = {
+               isa = PBXFileReference;
+               lastKnownFileType = sourcecode.c.h;
+               name = ConditionalMacros.h;
+               path = /Developer/SDKs/MacOSX10.4u.sdk/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/CarbonCore.framework/Versions/A/Headers/ConditionalMacros.h;
+               sourceTree = "<absolute>";
+       };
+       02C5DCB50A93CA0A003B9C11 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 0296A4A409D9AE9400F80AFF /* StExecutableImage.cpp */;
+               name = "StExecutableImage.cpp: 209";
+               rLen = 0;
+               rLoc = 6397;
+               rType = 0;
+               vrLen = 1942;
+               vrLoc = 5927;
+       };
+       02C5DD520A93D327003B9C11 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 0296A4AA09D9AE9400F80AFF /* StSRecordFile.cpp */;
+               name = "StSRecordFile.cpp: 115";
+               rLen = 0;
+               rLoc = 2909;
+               rType = 0;
+               vrLen = 1505;
+               vrLoc = 3910;
+       };
+       02C5DDCD0A940126003B9C11 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 02C5DDCE0A940126003B9C11 /* ctype.h */;
+               name = "(null): 1";
+               rLen = 0;
+               rLoc = 0;
+               rType = 0;
+               vrLen = 1755;
+               vrLoc = 4602;
+       };
+       02C5DDCE0A940126003B9C11 /* ctype.h */ = {
+               isa = PBXFileReference;
+               lastKnownFileType = sourcecode.c.h;
+               name = ctype.h;
+               path = /Developer/SDKs/MacOSX10.4u.sdk/usr/include/ctype.h;
+               sourceTree = "<absolute>";
+       };
+       02C5DDCF0A940126003B9C11 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 02123F380A6B09CF003CF33F /* HexValues.cpp */;
+               name = "HexValues.cpp: 38";
+               rLen = 0;
+               rLoc = 1007;
+               rType = 0;
+               vrLen = 1135;
+               vrLoc = 0;
+       };
+       02C5DDD20A940126003B9C11 /* istream */ = {
+               isa = PBXFileReference;
+               lastKnownFileType = sourcecode.cpp.h;
+               name = istream;
+               path = "/Developer/SDKs/MacOSX10.4u.sdk/usr/include/c++/4.0.0/istream";
+               sourceTree = "<absolute>";
+       };
+       02CAC9BA0BA06EA50020B29B /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 02CAC9BB0BA06EA50020B29B /* stdexcept */;
+               name = invalid_argument;
+               rLen = 16;
+               rLoc = 2759;
+               rType = 0;
+               vrLen = 2133;
+               vrLoc = 1621;
+       };
+       02CAC9BB0BA06EA50020B29B /* stdexcept */ = {
+               isa = PBXFileReference;
+               lastKnownFileType = sourcecode.cpp.h;
+               name = stdexcept;
+               path = "/Developer/SDKs/MacOSX10.4u.sdk/usr/include/c++/4.0.0/stdexcept";
+               sourceTree = "<absolute>";
+       };
+       02CD157309F543FE00ABE650 /* ElftosbAST.h */ = {
+               uiCtxt = {
+                       sepNavIntBoundsRect = "{{0, 0}, {810, 16107}}";
+                       sepNavSelRange = "{29207, 13}";
+                       sepNavVisRange = "{28110, 2093}";
+                       sepNavVisRect = "{{0, 5658}, {706, 782}}";
+               };
+       };
+       02CD157409F543FE00ABE650 /* ElftosbAST.cpp */ = {
+               uiCtxt = {
+                       sepNavIntBoundsRect = "{{0, 0}, {683, 17771}}";
+                       sepNavSelRange = "{7480, 0}";
+                       sepNavVisRange = "{7125, 436}";
+                       sepNavVisRect = "{{0, 7297}, {706, 782}}";
+               };
+       };
+       02CD158809F557D300ABE650 /* ElftosbLexer.cpp */ = {
+               uiCtxt = {
+                       sepNavIntBoundsRect = "{{0, 0}, {706, 2212}}";
+                       sepNavSelRange = "{3573, 0}";
+                       sepNavVisRect = "{{0, 606}, {706, 782}}";
+               };
+       };
+       02D1FCA70BD02B69007C7450 /* SearchPath.h */ = {
+               uiCtxt = {
+                       sepNavIntBoundsRect = "{{0, 0}, {692, 938}}";
+                       sepNavSelRange = "{1478, 0}";
+                       sepNavVisRange = "{282, 1401}";
+                       sepNavVisRect = "{{0, 148}, {706, 782}}";
+               };
+       };
+       02D1FCA80BD02B69007C7450 /* SearchPath.cpp */ = {
+               uiCtxt = {
+                       sepNavIntBoundsRect = "{{0, 0}, {692, 1792}}";
+                       sepNavSelRange = "{1816, 0}";
+                       sepNavVisRange = "{1353, 1637}";
+                       sepNavVisRect = "{{0, 546}, {706, 782}}";
+               };
+       };
+       02D1FD180BD039BF007C7450 /* stl_list.h */ = {
+               isa = PBXFileReference;
+               lastKnownFileType = sourcecode.c.h;
+               name = stl_list.h;
+               path = "/Developer/SDKs/MacOSX10.4u.sdk/usr/include/c++/4.0.0/bits/stl_list.h";
+               sourceTree = "<absolute>";
+       };
+       02D1FD190BD039BF007C7450 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 02C5DBD50A926A7F003B9C11 /* stdio.h */;
+               name = fopen;
+               rLen = 5;
+               rLoc = 9282;
+               rType = 0;
+               vrLen = 2059;
+               vrLoc = 8686;
+       };
+       02D1FE2E0BD1505E007C7450 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 02B9D4FB0B9A13AE0084CE1F /* SB36xxBootImageGenerator.h */;
+               name = "SB36xxBootImageGenerator.h: processOptions";
+               rLen = 0;
+               rLoc = 1395;
+               rType = 0;
+               vrLen = 1805;
+               vrLoc = 0;
+       };
+       02D46C100FED492400E65706 /* elftosb_lexer.cpp */ = {
+               uiCtxt = {
+                       sepNavIntBoundsRect = "{{0, 0}, {683, 29055}}";
+                       sepNavSelRange = "{64618, 0}";
+                       sepNavVisRange = "{43654, 237}";
+               };
+       };
+       02D46C110FED492400E65706 /* elftosb_parser.tab.cpp */ = {
+               uiCtxt = {
+                       sepNavIntBoundsRect = "{{0, 0}, {683, 39182}}";
+                       sepNavSelRange = "{3846, 0}";
+                       sepNavVisRange = "{3210, 297}";
+               };
+       };
+       02D46C120FED492400E65706 /* elftosb_parser.tab.hpp */ = {
+               uiCtxt = {
+                       sepNavIntBoundsRect = "{{0, 0}, {740, 1976}}";
+                       sepNavSelRange = "{201, 0}";
+                       sepNavVisRange = "{2150, 1900}";
+               };
+       };
+       02D46C3B0FED5C3600E65706 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 02E535B40C245AEC00CBD4A5 /* DataSourceImager.cpp */;
+               name = "DataSourceImager.cpp: 93";
+               rLen = 0;
+               rLoc = 2416;
+               rType = 0;
+               vrLen = 1639;
+               vrLoc = 2038;
+       };
+       02D46C3F0FED5C3600E65706 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 02B9D5020B9A16C10084CE1F /* St3600IPL.cpp */;
+               name = "St3600IPL.cpp: 627";
+               rLen = 23;
+               rLoc = 21214;
+               rType = 0;
+               vrLen = 1756;
+               vrLoc = 21696;
+       };
+       02D46C690FED5F4B00E65706 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 02FE65050BFE669B004A1450 /* simple.e */;
+               name = "simple.e: 2";
+               rLen = 0;
+               rLoc = 12;
+               rType = 0;
+               vrLen = 112;
+               vrLoc = 0;
+       };
+       02D46D1A0FED80BF00E65706 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 02F8D41C09FE86FA004CBE69 /* EncoreBootImage.cpp */;
+               name = "EncoreBootImage.cpp: 857";
+               rLen = 0;
+               rLoc = 29517;
+               rType = 0;
+               vrLen = 1960;
+               vrLoc = 28758;
+       };
+       02D6132E10F28A6500B7DF2F /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 02D46C100FED492400E65706 /* elftosb_lexer.cpp */;
+               name = "elftosb_lexer.cpp: 327";
+               rLen = 6;
+               rLoc = 9110;
+               rType = 0;
+               vrLen = 2447;
+               vrLoc = 8031;
+       };
+       02D6132F10F28A6500B7DF2F /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 02E3997909F2E0410055992A /* elftosb_lexer.l */;
+               name = "elftosb_lexer.l: 6";
+               rLen = 12;
+               rLoc = 104;
+               rType = 0;
+               vrLen = 2015;
+               vrLoc = 0;
+       };
+       02D6133010F28A6500B7DF2F /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 0215B3BA09F3FBF100EA7C45 /* ElftosbLexer.h */;
+               name = "ElftosbLexer.h: 65";
+               rLen = 11;
+               rLoc = 1845;
+               rType = 0;
+               vrLen = 2353;
+               vrLoc = 695;
+       };
+       02D6138C10F3E89000B7DF2F /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 02E3998909F2ED990055992A /* FlexLexer.h */;
+               name = "FlexLexer.h: 107";
+               rLen = 0;
+               rLoc = 3394;
+               rType = 0;
+               vrLen = 2605;
+               vrLoc = 3015;
+       };
+       02D6138D10F3E89000B7DF2F /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 020D41B80A0FFD140027E24E /* EncoreBootImageGenerator.cpp */;
+               name = "EncoreBootImageGenerator.cpp: 279";
+               rLen = 0;
+               rLoc = 7882;
+               rType = 0;
+               vrLen = 2263;
+               vrLoc = 6290;
+       };
+       02D6138E10F3E89000B7DF2F /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 020D41B70A0FFD140027E24E /* EncoreBootImageGenerator.h */;
+               name = "EncoreBootImageGenerator.h: 31";
+               rLen = 0;
+               rLoc = 918;
+               rType = 0;
+               vrLen = 2176;
+               vrLoc = 0;
+       };
+       02D6138F10F3E89000B7DF2F /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 02CD157309F543FE00ABE650 /* ElftosbAST.h */;
+               name = "ElftosbAST.h: 955";
+               rLen = 0;
+               rLoc = 25686;
+               rType = 0;
+               vrLen = 2192;
+               vrLoc = 0;
+       };
+       02D6139010F3E89000B7DF2F /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 02D46C120FED492400E65706 /* elftosb_parser.tab.hpp */;
+               name = "elftosb_parser.tab.hpp: 5";
+               rLen = 0;
+               rLoc = 201;
+               rType = 0;
+               vrLen = 1900;
+               vrLoc = 2150;
+       };
+       02D6139110F3E89000B7DF2F /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 02B9D5030B9A16C10084CE1F /* St3600IPL.h */;
+               name = "St3600IPL.h: 91";
+               rLen = 135;
+               rLoc = 2516;
+               rType = 0;
+               vrLen = 2955;
+               vrLoc = 1241;
+       };
+       02D6139210F3E89000B7DF2F /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 0208C29A0A0A4EE800255D31 /* ConversionController.h */;
+               name = "ConversionController.h: 72";
+               rLen = 0;
+               rLoc = 2407;
+               rType = 0;
+               vrLen = 3032;
+               vrLoc = 1610;
+       };
+       02D6139310F3E89000B7DF2F /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 0215B3D209F424D800EA7C45 /* elftosb_parser.y */;
+               name = "elftosb_parser.y: 565";
+               rLen = 0;
+               rLoc = 14295;
+               rType = 0;
+               vrLen = 2554;
+               vrLoc = 2578;
+       };
+       02D6139410F3E89000B7DF2F /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 0208C2990A0A4EE800255D31 /* ConversionController.cpp */;
+               name = "ConversionController.cpp: 40";
+               rLen = 27;
+               rLoc = 1209;
+               rType = 0;
+               vrLen = 2268;
+               vrLoc = 0;
+       };
+       02D6139510F3E89000B7DF2F /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 02FE65030BFE669B004A1450 /* basic_test_cmd.e */;
+               name = "basic_test_cmd.e: 45";
+               rLen = 4;
+               rLoc = 746;
+               rType = 0;
+               vrLen = 1164;
+               vrLoc = 319;
+       };
+       02D6139610F3E89000B7DF2F /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 0296A49309D9AE9400F80AFF /* elftosb.cpp */;
+               name = "elftosb.cpp: 572";
+               rLen = 0;
+               rLoc = 14572;
+               rType = 0;
+               vrLen = 2113;
+               vrLoc = 13347;
+       };
+       02D6139710F3E89000B7DF2F /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 02123F2F0A6B057E003CF33F /* Blob.h */;
+               name = "Blob.h: 65";
+               rLen = 0;
+               rLoc = 1584;
+               rType = 0;
+               vrLen = 1876;
+               vrLoc = 0;
+       };
+       02D6139810F3E89000B7DF2F /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 0296CF9C09DB3C5200F80AFF /* stdafx.h */;
+               name = "stdafx.h: 56";
+               rLen = 0;
+               rLoc = 1626;
+               rType = 0;
+               vrLen = 2167;
+               vrLoc = 0;
+       };
+       02D6139910F3E89000B7DF2F /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 02D6139A10F3E89000B7DF2F /* string.h */;
+               name = "string.h: 83";
+               rLen = 44;
+               rLoc = 3369;
+               rType = 0;
+               vrLen = 2973;
+               vrLoc = 2024;
+       };
+       02D6139A10F3E89000B7DF2F /* string.h */ = {
+               isa = PBXFileReference;
+               lastKnownFileType = sourcecode.c.h;
+               name = string.h;
+               path = /Developer/SDKs/MacOSX10.5.sdk/usr/include/string.h;
+               sourceTree = "<absolute>";
+       };
+       02D6139B10F3E89000B7DF2F /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 02123F300A6B057E003CF33F /* Blob.cpp */;
+               name = "Blob.cpp: 33";
+               rLen = 6;
+               rLoc = 784;
+               rType = 0;
+               vrLen = 1973;
+               vrLoc = 0;
+       };
+       02D6139F10F3E96300B7DF2F /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 02123F300A6B057E003CF33F /* Blob.cpp */;
+               name = "Blob.cpp: 52";
+               rLen = 4;
+               rLoc = 1143;
+               rType = 0;
+               vrLen = 1990;
+               vrLoc = 0;
+       };
+       02D795420FF00D8B00C1C5DF /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 020D46830A1665D90027E24E /* sbtool.cpp */;
+               name = "sbtool.cpp: 33";
+               rLen = 0;
+               rLoc = 844;
+               rType = 0;
+               vrLen = 1414;
+               vrLoc = 23;
+       };
+       02D795430FF00D8B00C1C5DF /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 02E25EA90A1A5DCB001161B5 /* keygen.cpp */;
+               name = "keygen.cpp: 36";
+               rLen = 0;
+               rLoc = 949;
+               rType = 0;
+               vrLen = 1579;
+               vrLoc = 23;
+       };
+       02D795440FF00D8B00C1C5DF /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 02CD157409F543FE00ABE650 /* ElftosbAST.cpp */;
+               name = "ElftosbAST.cpp: 1129";
+               rLen = 0;
+               rLoc = 27632;
+               rType = 0;
+               vrLen = 1350;
+               vrLoc = 26432;
+       };
+       02D795450FF00D8B00C1C5DF /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 02F8D41B09FE86FA004CBE69 /* EncoreBootImage.h */;
+               name = "EncoreBootImage.h: 670";
+               rLen = 0;
+               rLoc = 25015;
+               rType = 0;
+               vrLen = 1962;
+               vrLoc = 24513;
+       };
+       02D795460FF00D8B00C1C5DF /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 0208C28A0A0A4E5F00255D31 /* Operation.cpp */;
+               name = "Operation.cpp: 29";
+               rLen = 9;
+               rLoc = 753;
+               rType = 0;
+               vrLen = 1237;
+               vrLoc = 0;
+       };
+       02D795470FF00D8B00C1C5DF /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 02C5DB920A925C61003B9C11 /* format_string.cpp */;
+               name = "format_string.cpp: 28";
+               rLen = 15;
+               rLoc = 751;
+               rType = 0;
+               vrLen = 1232;
+               vrLoc = 801;
+       };
+       02D795480FF00D8B00C1C5DF /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 02C5DB910A925C61003B9C11 /* format_string.h */;
+               name = "format_string.h: 23";
+               rLen = 0;
+               rLoc = 649;
+               rType = 0;
+               vrLen = 734;
+               vrLoc = 0;
+       };
+       02D795490FF00D8B00C1C5DF /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 02D1FCA80BD02B69007C7450 /* SearchPath.cpp */;
+               name = "SearchPath.cpp: 57";
+               rLen = 0;
+               rLoc = 1816;
+               rType = 0;
+               vrLen = 1637;
+               vrLoc = 1353;
+       };
+       02D7954A0FF00D8B00C1C5DF /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 0208C28D0A0A4E5F00255D31 /* DataTarget.h */;
+               name = "DataTarget.h: 72";
+               rLen = 0;
+               rLoc = 2252;
+               rType = 0;
+               vrLen = 1982;
+               vrLoc = 2339;
+       };
+       02D7954D0FF00D8B00C1C5DF /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 0208C28B0A0A4E5F00255D31 /* Operation.h */;
+               name = "Operation.h: 73";
+               rLen = 0;
+               rLoc = 1618;
+               rType = 0;
+               vrLen = 1240;
+               vrLoc = 1197;
+       };
+       02DC603C0A7AAA7A0027E7F9 /* index.html */ = {
+               uiCtxt = {
+                       sepNavIntBoundsRect = "{{0, 0}, {732, 782}}";
+                       sepNavSelRange = "{303, 0}";
+                       sepNavVisRect = "{{0, 0}, {732, 782}}";
+               };
+       };
+       02E25EA40A1A5DB0001161B5 /* keygen */ = {
+               activeExec = 0;
+               executables = (
+                       02E25EA60A1A5DB0001161B5 /* keygen */,
+               );
+       };
+       02E25EA60A1A5DB0001161B5 /* keygen */ = {
+               isa = PBXExecutable;
+               activeArgIndices = (
+               );
+               argumentStrings = (
+               );
+               autoAttachOnCrash = 1;
+               breakpointsEnabled = 1;
+               configStateDict = {
+               };
+               customDataFormattersEnabled = 1;
+               dataTipCustomDataFormattersEnabled = 1;
+               dataTipShowTypeColumn = 1;
+               dataTipSortType = 0;
+               debuggerPlugin = GDBDebugging;
+               disassemblyDisplayState = 0;
+               enableDebugStr = 1;
+               environmentEntries = (
+               );
+               executableSystemSymbolLevel = 0;
+               executableUserSymbolLevel = 0;
+               libgmallocEnabled = 0;
+               name = keygen;
+               showTypeColumn = 0;
+               sourceDirectories = (
+               );
+       };
+       02E25EA90A1A5DCB001161B5 /* keygen.cpp */ = {
+               uiCtxt = {
+                       sepNavIntBoundsRect = "{{0, 0}, {692, 4788}}";
+                       sepNavSelRange = "{949, 0}";
+                       sepNavVisRange = "{23, 1579}";
+                       sepNavVisRect = "{{0, 64}, {732, 782}}";
+                       sepNavWindowFrame = "{{15, 63}, {775, 810}}";
+               };
+       };
+       02E3997909F2E0410055992A /* elftosb_lexer.l */ = {
+               uiCtxt = {
+                       sepNavIntBoundsRect = "{{0, 0}, {810, 3939}}";
+                       sepNavSelRange = "{1417, 0}";
+                       sepNavVisRange = "{3894, 1528}";
+                       sepNavVisRect = "{{0, 3362}, {706, 782}}";
+                       sepNavWindowFrame = "{{15, 0}, {671, 1178}}";
+               };
+       };
+       02E3998909F2ED990055992A /* FlexLexer.h */ = {
+               uiCtxt = {
+                       sepNavIntBoundsRect = "{{0, 0}, {731, 2717}}";
+                       sepNavSelRange = "{6344, 0}";
+                       sepNavVisRange = "{4228, 930}";
+                       sepNavVisRect = "{{0, 1465}, {745, 388}}";
+               };
+       };
+       02E3998D09F2EFAA0055992A /* rijndael.cpp */ = {
+               uiCtxt = {
+                       sepNavIntBoundsRect = "{{0, 0}, {732, 22526}}";
+                       sepNavSelRange = "{72196, 0}";
+                       sepNavVisRect = "{{0, 14532}, {732, 782}}";
+               };
+       };
+       02E3998E09F2EFAA0055992A /* rijndael.h */ = {
+               uiCtxt = {
+                       sepNavIntBoundsRect = "{{0, 0}, {732, 2240}}";
+                       sepNavSelRange = "{1812, 0}";
+                       sepNavVisRect = "{{0, 1458}, {732, 782}}";
+               };
+       };
+       02E535B30C245AEC00CBD4A5 /* DataSourceImager.h */ = {
+               uiCtxt = {
+                       sepNavIntBoundsRect = "{{0, 0}, {810, 1076}}";
+                       sepNavSelRange = "{1268, 0}";
+                       sepNavVisRange = "{0, 1359}";
+                       sepNavVisRect = "{{0, 84}, {706, 782}}";
+               };
+       };
+       02E535B40C245AEC00CBD4A5 /* DataSourceImager.cpp */ = {
+               uiCtxt = {
+                       sepNavIntBoundsRect = "{{0, 0}, {810, 1950}}";
+                       sepNavSelRange = "{512, 40}";
+                       sepNavVisRange = "{482, 2065}";
+                       sepNavVisRect = "{{0, 1304}, {706, 782}}";
+               };
+       };
+       02E535CF0C24641A00CBD4A5 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 027EE42D0BD6AF1B00A6A136 /* string.h */;
+               name = "size_t\t strlen(const char *);";
+               rLen = 30;
+               rLoc = 3873;
+               rType = 0;
+               vrLen = 1824;
+               vrLoc = 3059;
+       };
+       02E535D00C24641A00CBD4A5 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 02E535D10C24641A00CBD4A5 /* algorithm */;
+               name = bits/stl_algobase.h;
+               rLen = 19;
+               rLoc = 2669;
+               rType = 0;
+               vrLen = 2194;
+               vrLoc = 624;
+       };
+       02E535D10C24641A00CBD4A5 /* algorithm */ = {
+               isa = PBXFileReference;
+               lastKnownFileType = sourcecode.cpp.h;
+               name = algorithm;
+               path = "/Developer/SDKs/MacOSX10.4u.sdk/usr/include/c++/4.0.0/algorithm";
+               sourceTree = "<absolute>";
+       };
+       02E535D20C24641A00CBD4A5 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 02E535D30C24641A00CBD4A5 /* string */;
+               name = bits/basic_string.h;
+               rLen = 19;
+               rLoc = 1984;
+               rType = 0;
+               vrLen = 2016;
+               vrLoc = 132;
+       };
+       02E535D30C24641A00CBD4A5 /* string */ = {
+               isa = PBXFileReference;
+               lastKnownFileType = sourcecode.cpp.h;
+               name = string;
+               path = "/Developer/SDKs/MacOSX10.4u.sdk/usr/include/c++/4.0.0/string";
+               sourceTree = "<absolute>";
+       };
+       02E535D40C24641A00CBD4A5 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 02E535D50C24641A00CBD4A5 /* basic_string.h */;
+               name = begin;
+               rLen = 5;
+               rLoc = 16411;
+               rType = 0;
+               vrLen = 1129;
+               vrLoc = 15813;
+       };
+       02E535D50C24641A00CBD4A5 /* basic_string.h */ = {
+               isa = PBXFileReference;
+               lastKnownFileType = sourcecode.c.h;
+               name = basic_string.h;
+               path = "/Developer/SDKs/MacOSX10.4u.sdk/usr/include/c++/4.0.0/bits/basic_string.h";
+               sourceTree = "<absolute>";
+       };
+       02E535D70C24641A00CBD4A5 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 02E535D80C24641A00CBD4A5 /* stl_algobase.h */;
+               name = lexicographical_compare;
+               rLen = 23;
+               rLoc = 27547;
+               rType = 0;
+               vrLen = 1663;
+               vrLoc = 29305;
+       };
+       02E535D80C24641A00CBD4A5 /* stl_algobase.h */ = {
+               isa = PBXFileReference;
+               lastKnownFileType = sourcecode.c.h;
+               name = stl_algobase.h;
+               path = "/Developer/SDKs/MacOSX10.4u.sdk/usr/include/c++/4.0.0/bits/stl_algobase.h";
+               sourceTree = "<absolute>";
+       };
+       02E535D90C24641A00CBD4A5 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 02E535DA0C24641A00CBD4A5 /* stl_algo.h */;
+               name = find;
+               rLen = 4;
+               rLoc = 8733;
+               rType = 0;
+               vrLen = 1567;
+               vrLoc = 8131;
+       };
+       02E535DA0C24641A00CBD4A5 /* stl_algo.h */ = {
+               isa = PBXFileReference;
+               lastKnownFileType = sourcecode.c.h;
+               name = stl_algo.h;
+               path = "/Developer/SDKs/MacOSX10.4u.sdk/usr/include/c++/4.0.0/bits/stl_algo.h";
+               sourceTree = "<absolute>";
+       };
+       02E535DC0C24641A00CBD4A5 /* stl_map.h */ = {
+               isa = PBXFileReference;
+               lastKnownFileType = sourcecode.c.h;
+               name = stl_map.h;
+               path = "/Developer/SDKs/MacOSX10.4u.sdk/usr/include/c++/4.0.0/bits/stl_map.h";
+               sourceTree = "<absolute>";
+       };
+       02E535DE0C24641A00CBD4A5 /* map */ = {
+               isa = PBXFileReference;
+               lastKnownFileType = sourcecode.cpp.h;
+               name = map;
+               path = "/Developer/SDKs/MacOSX10.4u.sdk/usr/include/c++/4.0.0/map";
+               sourceTree = "<absolute>";
+       };
+       02E535F10C24641A00CBD4A5 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 020D41850A0FF0C20027E24E /* OutputSection.h */;
+               name = "OutputSection.h: 21";
+               rLen = 0;
+               rLoc = 625;
+               rType = 0;
+               vrLen = 1572;
+               vrLoc = 647;
+       };
+       02E5362D0C38763700CBD4A5 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 02F8D5490A014F5D004CBE69 /* Value.h */;
+               name = "Value.h: 133";
+               rLen = 0;
+               rLoc = 4209;
+               rType = 0;
+               vrLen = 1390;
+               vrLoc = 531;
+       };
+       02E536320C38763700CBD4A5 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 020D416A0A0FE8AC0027E24E /* StringMatcher.h */;
+               name = "StringMatcher.h: 42";
+               rLen = 0;
+               rLoc = 1117;
+               rType = 0;
+               vrLen = 1426;
+               vrLoc = 514;
+       };
+       02E536340C38763700CBD4A5 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 0208C2880A0A4E5F00255D31 /* DataSource.cpp */;
+               name = "DataSource.cpp: 50";
+               rLen = 0;
+               rLoc = 1464;
+               rType = 0;
+               vrLen = 1494;
+               vrLoc = 570;
+       };
+       02E536350C38763700CBD4A5 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 0208C2890A0A4E5F00255D31 /* DataSource.h */;
+               name = "DataSource.h: 113";
+               rLen = 0;
+               rLoc = 3693;
+               rType = 0;
+               vrLen = 1872;
+               vrLoc = 2865;
+       };
+       02E536360C38763700CBD4A5 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 02E535DE0C24641A00CBD4A5 /* map */;
+               name = bits/stl_map.;
+               rLen = 13;
+               rLoc = 2682;
+               rType = 0;
+               vrLen = 1967;
+               vrLoc = 841;
+       };
+       02E5363F0C3C4FF000CBD4A5 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 02E535DC0C24641A00CBD4A5 /* stl_map.h */;
+               name = erase;
+               rLen = 5;
+               rLoc = 15389;
+               rType = 0;
+               vrLen = 2055;
+               vrLoc = 11183;
+       };
+       02E9D5B009FA8AE4006D7279 /* smart_ptr.h */ = {
+               uiCtxt = {
+                       sepNavIntBoundsRect = "{{0, 0}, {692, 3262}}";
+                       sepNavSelRange = "{1953, 0}";
+                       sepNavVisRange = "{0, 1477}";
+                       sepNavVisRect = "{{0, 208}, {706, 542}}";
+               };
+       };
+       02E9D67309FBFE97006D7279 /* EvalContext.h */ = {
+               uiCtxt = {
+                       sepNavIntBoundsRect = "{{0, 0}, {692, 1540}}";
+                       sepNavSelRange = "{1402, 26}";
+                       sepNavVisRange = "{874, 1518}";
+                       sepNavVisRect = "{{0, 364}, {706, 782}}";
+               };
+       };
+       02E9D67409FBFE98006D7279 /* EvalContext.cpp */ = {
+               uiCtxt = {
+                       sepNavIntBoundsRect = "{{0, 0}, {706, 1680}}";
+                       sepNavSelRange = "{575, 27}";
+                       sepNavVisRect = "{{0, 0}, {706, 782}}";
+               };
+       };
+       02F8D41B09FE86FA004CBE69 /* EncoreBootImage.h */ = {
+               uiCtxt = {
+                       sepNavFolds = "{\n    c =     (\n                {\n            r = \"{12406, 1422}\";\n            s = 0;\n        },\n                {\n            r = \"{17593, 599}\";\n            s = 0;\n        },\n                {\n            r = \"{18291, 1349}\";\n            s = 0;\n        },\n                {\n            r = \"{21868, 1241}\";\n            s = 0;\n        },\n                {\n            r = \"{23214, 821}\";\n            s = 0;\n        },\n                {\n            r = \"{26522, 2695}\";\n            s = 0;\n        },\n                {\n            r = \"{29325, 2002}\";\n            s = 0;\n        },\n                {\n            r = \"{31439, 1052}\";\n            s = 0;\n        }\n    );\n    r = \"{0, 35984}\";\n    s = 0;\n}";
+                       sepNavIntBoundsRect = "{{0, 0}, {692, 9912}}";
+                       sepNavSelRange = "{19588, 0}";
+                       sepNavVisRange = "{19086, 1962}";
+                       sepNavVisRect = "{{0, 1867}, {706, 782}}";
+               };
+       };
+       02F8D41C09FE86FA004CBE69 /* EncoreBootImage.cpp */ = {
+               uiCtxt = {
+                       sepNavIntBoundsRect = "{{0, 0}, {692, 19460}}";
+                       sepNavSelRange = "{37227, 0}";
+                       sepNavVisRange = "{34594, 1909}";
+                       sepNavVisRect = "{{0, 4734}, {706, 782}}";
+               };
+       };
+       02F8D46509FEA584004CBE69 /* AESKey.h */ = {
+               uiCtxt = {
+                       sepNavIntBoundsRect = "{{0, 0}, {692, 2142}}";
+                       sepNavSelRange = "{3236, 0}";
+                       sepNavVisRange = "{2384, 1593}";
+                       sepNavVisRect = "{{0, 1235}, {648, 764}}";
+               };
+       };
+       02F8D4EF09FEE91B004CBE69 /* crc.cpp */ = {
+               uiCtxt = {
+                       sepNavIntBoundsRect = "{{0, 0}, {736, 2450}}";
+                       sepNavSelRange = "{7654, 0}";
+                       sepNavVisRect = "{{0, 1632}, {736, 782}}";
+               };
+       };
+       02F8D4F009FEE91B004CBE69 /* crc.h */ = {
+               uiCtxt = {
+                       sepNavIntBoundsRect = "{{0, 0}, {811, 798}}";
+                       sepNavSelRange = "{814, 13}";
+                       sepNavVisRect = "{{0, 316}, {811, 482}}";
+               };
+       };
+       02F8D5490A014F5D004CBE69 /* Value.h */ = {
+               uiCtxt = {
+                       sepNavIntBoundsRect = "{{0, 0}, {706, 2058}}";
+                       sepNavSelRange = "{4209, 0}";
+                       sepNavVisRect = "{{0, 260}, {706, 782}}";
+               };
+       };
+       02F8D54A0A014F5D004CBE69 /* Value.cpp */ = {
+               uiCtxt = {
+                       sepNavIntBoundsRect = "{{0, 0}, {753, 782}}";
+                       sepNavSelRange = "{1161, 0}";
+                       sepNavVisRect = "{{0, 0}, {753, 782}}";
+               };
+       };
+       02F8D5600A0152AB004CBE69 /* SourceFile.h */ = {
+               uiCtxt = {
+                       sepNavIntBoundsRect = "{{0, 0}, {810, 2119}}";
+                       sepNavSelRange = "{3395, 20}";
+                       sepNavVisRange = "{1842, 2643}";
+                       sepNavVisRect = "{{0, 1134}, {706, 782}}";
+                       sepNavWindowFrame = "{{15, -5}, {777, 878}}";
+               };
+       };
+       02F8D5610A0152AB004CBE69 /* SourceFile.cpp */ = {
+               uiCtxt = {
+                       sepNavIntBoundsRect = "{{0, 0}, {745, 2618}}";
+                       sepNavSelRange = "{2877, 0}";
+                       sepNavVisRect = "{{0, 1258}, {745, 764}}";
+               };
+       };
+       02F8D5DC0A01A38A004CBE69 /* PBXCPPExceptionBreakpoint */ = {
+               isa = PBXCPPExceptionBreakpoint;
+               actions = (
+               );
+               breakpointStyle = 0;
+               condition = 02F8D5DD0A01A3A8004CBE69 /* XCCPPCondition */;
+               continueAfterActions = 1;
+               countType = 0;
+               delayBeforeContinue = 0;
+               exceptionName = $;
+               hitCount = 0;
+               ignoreCount = 0;
+               isThrow = 1;
+               modificationTime = 267302557.4579;
+               originalNumberOfMultipleMatches = 0;
+               state = 2;
+       };
+       02F8D5DD0A01A3A8004CBE69 /* XCCPPCondition */ = {
+               isa = XCCPPCondition;
+               conditionString = "On Throw";
+       };
+       02FE65030BFE669B004A1450 /* basic_test_cmd.e */ = {
+               uiCtxt = {
+                       sepNavIntBoundsRect = "{{0, 0}, {740, 2132}}";
+                       sepNavSelRange = "{746, 4}";
+                       sepNavVisRange = "{319, 1164}";
+               };
+       };
+       02FE65040BFE669B004A1450 /* complex.bd */ = {
+               uiCtxt = {
+                       sepNavIntBoundsRect = "{{0, 0}, {692, 3668}}";
+                       sepNavSelRange = "{1471, 33}";
+                       sepNavVisRange = "{975, 1067}";
+                       sepNavVisRect = "{{0, 2716}, {706, 782}}";
+               };
+       };
+       02FE65050BFE669B004A1450 /* simple.e */ = {
+               uiCtxt = {
+                       sepNavIntBoundsRect = "{{0, 0}, {692, 778}}";
+                       sepNavSelRange = "{12, 0}";
+                       sepNavVisRange = "{0, 112}";
+                       sepNavVisRect = "{{0, 0}, {706, 782}}";
+               };
+       };
+       02FE65060BFE669B004A1450 /* test_cmd.e */ = {
+               uiCtxt = {
+                       sepNavIntBoundsRect = "{{0, 0}, {692, 1694}}";
+                       sepNavSelRange = "{0, 0}";
+                       sepNavVisRange = "{0, 914}";
+                       sepNavVisRect = "{{0, 168}, {706, 782}}";
+               };
+       };
+       02FE651B0BFF94B2004A1450 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = 0296A49409D9AE9400F80AFF /* elftosb.h */;
+               name = "elftosb.h: 1";
+               rLen = 0;
+               rLoc = 0;
+               rType = 0;
+               vrLen = 757;
+               vrLoc = 0;
+       };
+       02FE65860C0522B0004A1450 /* todo.txt */ = {
+               uiCtxt = {
+                       sepNavIntBoundsRect = "{{0, 0}, {692, 779}}";
+                       sepNavSelRange = "{281, 0}";
+                       sepNavVisRange = "{0, 348}";
+                       sepNavVisRect = "{{0, 0}, {706, 782}}";
+               };
+       };
+       08FB7793FE84155DC02AAC07 /* Project object */ = {
+               activeBuildConfigurationName = Debug;
+               activeExecutable = 0296A45509D9AE7A00F80AFF /* elftosb */;
+               activeTarget = 8DD76F620486A84900D96B5E /* elftosb */;
+               addToTargets = (
+                       8DD76F620486A84900D96B5E /* elftosb */,
+               );
+               breakpoints = (
+                       02F8D5DC0A01A38A004CBE69 /* PBXCPPExceptionBreakpoint */,
+                       020DDCA30A1E32A400E1CB49 /* PBXCPPExceptionBreakpoint */,
+               );
+               codeSenseManager = 0296A50509D9AE9400F80AFF /* Code sense */;
+               executables = (
+                       0296A45509D9AE7A00F80AFF /* elftosb */,
+                       020D467C0A16657C0027E24E /* sbtool */,
+                       02E25EA60A1A5DB0001161B5 /* keygen */,
+               );
+               expressions = (
+                       "(SRecordSourceFile*)this",
+                       yytext,
+               );
+               perUserDictionary = {
+                       "PBXConfiguration.PBXBreakpointsDataSource.v1:1CA1AED706398EBD00589147" = {
+                               PBXFileTableDataSourceColumnSortingDirectionKey = "-1";
+                               PBXFileTableDataSourceColumnSortingKey = PBXBreakpointsDataSource_LocationID;
+                               PBXFileTableDataSourceColumnWidthsKey = (
+                                       20,
+                                       20,
+                                       210,
+                                       20,
+                                       138,
+                                       81,
+                                       20,
+                               );
+                               PBXFileTableDataSourceColumnsKey = (
+                                       PBXBreakpointsDataSource_ActionID,
+                                       PBXBreakpointsDataSource_TypeID,
+                                       PBXBreakpointsDataSource_BreakpointID,
+                                       PBXBreakpointsDataSource_UseID,
+                                       PBXBreakpointsDataSource_LocationID,
+                                       PBXBreakpointsDataSource_ConditionID,
+                                       PBXBreakpointsDataSource_ContinueID,
+                               );
+                       };
+                       PBXConfiguration.PBXFileTableDataSource3.PBXErrorsWarningsDataSource = {
+                               PBXFileTableDataSourceColumnSortingDirectionKey = "-1";
+                               PBXFileTableDataSourceColumnSortingKey = PBXErrorsWarningsDataSource_LocationID;
+                               PBXFileTableDataSourceColumnWidthsKey = (
+                                       20,
+                                       578,
+                                       126,
+                               );
+                               PBXFileTableDataSourceColumnsKey = (
+                                       PBXErrorsWarningsDataSource_TypeID,
+                                       PBXErrorsWarningsDataSource_MessageID,
+                                       PBXErrorsWarningsDataSource_LocationID,
+                               );
+                       };
+                       PBXConfiguration.PBXFileTableDataSource3.PBXExecutablesDataSource = {
+                               PBXFileTableDataSourceColumnSortingDirectionKey = "-1";
+                               PBXFileTableDataSourceColumnSortingKey = PBXExecutablesDataSource_NameID;
+                               PBXFileTableDataSourceColumnWidthsKey = (
+                                       22,
+                                       300,
+                                       402,
+                               );
+                               PBXFileTableDataSourceColumnsKey = (
+                                       PBXExecutablesDataSource_ActiveFlagID,
+                                       PBXExecutablesDataSource_NameID,
+                                       PBXExecutablesDataSource_CommentsID,
+                               );
+                       };
+                       PBXConfiguration.PBXFileTableDataSource3.PBXFileTableDataSource = {
+                               PBXFileTableDataSourceColumnSortingDirectionKey = "-1";
+                               PBXFileTableDataSourceColumnSortingKey = PBXFileDataSource_Filename_ColumnID;
+                               PBXFileTableDataSourceColumnWidthsKey = (
+                                       20,
+                                       632,
+                                       20,
+                                       48,
+                                       43,
+                                       43,
+                                       20,
+                               );
+                               PBXFileTableDataSourceColumnsKey = (
+                                       PBXFileDataSource_FiletypeID,
+                                       PBXFileDataSource_Filename_ColumnID,
+                                       PBXFileDataSource_Built_ColumnID,
+                                       PBXFileDataSource_ObjectSize_ColumnID,
+                                       PBXFileDataSource_Errors_ColumnID,
+                                       PBXFileDataSource_Warnings_ColumnID,
+                                       PBXFileDataSource_Target_ColumnID,
+                               );
+                       };
+                       PBXConfiguration.PBXFileTableDataSource3.PBXFindDataSource = {
+                               PBXFileTableDataSourceColumnSortingDirectionKey = "-1";
+                               PBXFileTableDataSourceColumnSortingKey = PBXFindDataSource_LocationID;
+                               PBXFileTableDataSourceColumnWidthsKey = (
+                                       575,
+                                       157,
+                               );
+                               PBXFileTableDataSourceColumnsKey = (
+                                       PBXFindDataSource_MessageID,
+                                       PBXFindDataSource_LocationID,
+                               );
+                       };
+                       PBXConfiguration.PBXFileTableDataSource3.XCSCMDataSource = {
+                               PBXFileTableDataSourceColumnSortingDirectionKey = "-1";
+                               PBXFileTableDataSourceColumnSortingKey = PBXFileDataSource_Filename_ColumnID;
+                               PBXFileTableDataSourceColumnWidthsKey = (
+                                       20,
+                                       20,
+                                       524,
+                                       20,
+                                       48.1626,
+                                       43,
+                                       43,
+                                       20,
+                               );
+                               PBXFileTableDataSourceColumnsKey = (
+                                       PBXFileDataSource_SCM_ColumnID,
+                                       PBXFileDataSource_FiletypeID,
+                                       PBXFileDataSource_Filename_ColumnID,
+                                       PBXFileDataSource_Built_ColumnID,
+                                       PBXFileDataSource_ObjectSize_ColumnID,
+                                       PBXFileDataSource_Errors_ColumnID,
+                                       PBXFileDataSource_Warnings_ColumnID,
+                                       PBXFileDataSource_Target_ColumnID,
+                               );
+                       };
+                       PBXConfiguration.PBXTargetDataSource.PBXTargetDataSource = {
+                               PBXFileTableDataSourceColumnSortingDirectionKey = "-1";
+                               PBXFileTableDataSourceColumnSortingKey = PBXFileDataSource_Filename_ColumnID;
+                               PBXFileTableDataSourceColumnWidthsKey = (
+                                       20,
+                                       200,
+                                       360,
+                                       20,
+                                       48,
+                                       43,
+                                       43,
+                               );
+                               PBXFileTableDataSourceColumnsKey = (
+                                       PBXFileDataSource_FiletypeID,
+                                       PBXFileDataSource_Filename_ColumnID,
+                                       PBXTargetDataSource_PrimaryAttribute,
+                                       PBXFileDataSource_Built_ColumnID,
+                                       PBXFileDataSource_ObjectSize_ColumnID,
+                                       PBXFileDataSource_Errors_ColumnID,
+                                       PBXFileDataSource_Warnings_ColumnID,
+                               );
+                       };
+                       PBXPerProjectTemplateStateSaveDate = 303262107;
+                       PBXWorkspaceStateSaveDate = 303262107;
+               };
+               perUserProjectItems = {
+                       021CA4400A8D2F740028326F = 021CA4400A8D2F740028326F /* PBXTextBookmark */;
+                       021CA4420A8D2F740028326F = 021CA4420A8D2F740028326F /* PBXTextBookmark */;
+                       022B461212136A6A00A74F96 /* PBXTextBookmark */ = 022B461212136A6A00A74F96 /* PBXTextBookmark */;
+                       022B461312136A6A00A74F96 /* XCBuildMessageTextBookmark */ = 022B461312136A6A00A74F96 /* XCBuildMessageTextBookmark */;
+                       022B461412136A6A00A74F96 /* PBXTextBookmark */ = 022B461412136A6A00A74F96 /* PBXTextBookmark */;
+                       022B46161216FE9C00A74F96 /* PBXTextBookmark */ = 022B46161216FE9C00A74F96 /* PBXTextBookmark */;
+                       022B46181216FE9C00A74F96 /* PBXTextBookmark */ = 022B46181216FE9C00A74F96 /* PBXTextBookmark */;
+                       022B46191216FE9C00A74F96 /* PBXTextBookmark */ = 022B46191216FE9C00A74F96 /* PBXTextBookmark */;
+                       022B461A1216FE9C00A74F96 /* PBXTextBookmark */ = 022B461A1216FE9C00A74F96 /* PBXTextBookmark */;
+                       022B461D1216FEA700A74F96 /* PBXTextBookmark */ = 022B461D1216FEA700A74F96 /* PBXTextBookmark */;
+                       022B461E1216FEA700A74F96 /* PBXTextBookmark */ = 022B461E1216FEA700A74F96 /* PBXTextBookmark */;
+                       022B461F1216FEA700A74F96 /* PBXTextBookmark */ = 022B461F1216FEA700A74F96 /* PBXTextBookmark */;
+                       022B46201216FEA700A74F96 /* PBXTextBookmark */ = 022B46201216FEA700A74F96 /* PBXTextBookmark */;
+                       022B46211216FEA700A74F96 /* PBXTextBookmark */ = 022B46211216FEA700A74F96 /* PBXTextBookmark */;
+                       022B46221216FEA700A74F96 /* PBXTextBookmark */ = 022B46221216FEA700A74F96 /* PBXTextBookmark */;
+                       022B46231216FEA700A74F96 /* PBXTextBookmark */ = 022B46231216FEA700A74F96 /* PBXTextBookmark */;
+                       022B46241216FEA700A74F96 /* PBXTextBookmark */ = 022B46241216FEA700A74F96 /* PBXTextBookmark */;
+                       022B46251216FEA700A74F96 /* PBXTextBookmark */ = 022B46251216FEA700A74F96 /* PBXTextBookmark */;
+                       022B4632121700F300A74F96 /* PBXTextBookmark */ = 022B4632121700F300A74F96 /* PBXTextBookmark */;
+                       022B4639121700F300A74F96 /* PBXTextBookmark */ = 022B4639121700F300A74F96 /* PBXTextBookmark */;
+                       022B464E1217576E00A74F96 /* PBXTextBookmark */ = 022B464E1217576E00A74F96 /* PBXTextBookmark */;
+                       022B464F1217576E00A74F96 /* PBXTextBookmark */ = 022B464F1217576E00A74F96 /* PBXTextBookmark */;
+                       022B46501217576E00A74F96 /* PBXTextBookmark */ = 022B46501217576E00A74F96 /* PBXTextBookmark */;
+                       022B46511217576E00A74F96 /* PBXTextBookmark */ = 022B46511217576E00A74F96 /* PBXTextBookmark */;
+                       022B46521217576E00A74F96 /* PBXTextBookmark */ = 022B46521217576E00A74F96 /* PBXTextBookmark */;
+                       022B46531217576E00A74F96 /* PBXTextBookmark */ = 022B46531217576E00A74F96 /* PBXTextBookmark */;
+                       022B46541217576E00A74F96 /* PBXTextBookmark */ = 022B46541217576E00A74F96 /* PBXTextBookmark */;
+                       022B46601218557900A74F96 /* PBXTextBookmark */ = 022B46601218557900A74F96 /* PBXTextBookmark */;
+                       022B46611218557900A74F96 /* PBXTextBookmark */ = 022B46611218557900A74F96 /* PBXTextBookmark */;
+                       022B466412185DA400A74F96 /* PBXTextBookmark */ = 022B466412185DA400A74F96 /* PBXTextBookmark */;
+                       022B466512185DA400A74F96 /* PBXTextBookmark */ = 022B466512185DA400A74F96 /* PBXTextBookmark */;
+                       022B466C12185F4800A74F96 /* PBXTextBookmark */ = 022B466C12185F4800A74F96 /* PBXTextBookmark */;
+                       022B466D12185F4800A74F96 /* PBXTextBookmark */ = 022B466D12185F4800A74F96 /* PBXTextBookmark */;
+                       022B46701218625A00A74F96 /* PBXTextBookmark */ = 022B46701218625A00A74F96 /* PBXTextBookmark */;
+                       022B46711218625A00A74F96 /* PBXTextBookmark */ = 022B46711218625A00A74F96 /* PBXTextBookmark */;
+                       022B4678121864A000A74F96 /* PBXTextBookmark */ = 022B4678121864A000A74F96 /* PBXTextBookmark */;
+                       022B4679121864A000A74F96 /* XCBuildMessageTextBookmark */ = 022B4679121864A000A74F96 /* XCBuildMessageTextBookmark */;
+                       022B467A121864A000A74F96 /* PBXTextBookmark */ = 022B467A121864A000A74F96 /* PBXTextBookmark */;
+                       022B467B121864A000A74F96 /* PBXTextBookmark */ = 022B467B121864A000A74F96 /* PBXTextBookmark */;
+                       022B46801218654500A74F96 /* PBXTextBookmark */ = 022B46801218654500A74F96 /* PBXTextBookmark */;
+                       022B46811218654500A74F96 /* PBXTextBookmark */ = 022B46811218654500A74F96 /* PBXTextBookmark */;
+                       022B46871218659100A74F96 /* PBXTextBookmark */ = 022B46871218659100A74F96 /* PBXTextBookmark */;
+                       022B46881218659100A74F96 /* PBXTextBookmark */ = 022B46881218659100A74F96 /* PBXTextBookmark */;
+                       022B46891218659A00A74F96 /* PBXTextBookmark */ = 022B46891218659A00A74F96 /* PBXTextBookmark */;
+                       022B468A1218659A00A74F96 /* PBXTextBookmark */ = 022B468A1218659A00A74F96 /* PBXTextBookmark */;
+                       022B468B1218659A00A74F96 /* PBXTextBookmark */ = 022B468B1218659A00A74F96 /* PBXTextBookmark */;
+                       022B468C1218659A00A74F96 /* PBXTextBookmark */ = 022B468C1218659A00A74F96 /* PBXTextBookmark */;
+                       022B468D1218659A00A74F96 /* PBXTextBookmark */ = 022B468D1218659A00A74F96 /* PBXTextBookmark */;
+                       022B468E1218659A00A74F96 /* PBXTextBookmark */ = 022B468E1218659A00A74F96 /* PBXTextBookmark */;
+                       022B468F1218659A00A74F96 /* PBXTextBookmark */ = 022B468F1218659A00A74F96 /* PBXTextBookmark */;
+                       022B46901218659A00A74F96 /* PBXTextBookmark */ = 022B46901218659A00A74F96 /* PBXTextBookmark */;
+                       022B46911218659A00A74F96 /* PBXTextBookmark */ = 022B46911218659A00A74F96 /* PBXTextBookmark */;
+                       022B46921218659A00A74F96 /* PBXTextBookmark */ = 022B46921218659A00A74F96 /* PBXTextBookmark */;
+                       022B46931218659A00A74F96 /* PBXTextBookmark */ = 022B46931218659A00A74F96 /* PBXTextBookmark */;
+                       022B46941218659A00A74F96 /* PBXTextBookmark */ = 022B46941218659A00A74F96 /* PBXTextBookmark */;
+                       022B46951218659A00A74F96 /* PBXTextBookmark */ = 022B46951218659A00A74F96 /* PBXTextBookmark */;
+                       022B46961218659A00A74F96 /* PBXTextBookmark */ = 022B46961218659A00A74F96 /* PBXTextBookmark */;
+                       022B46971218659A00A74F96 /* PBXTextBookmark */ = 022B46971218659A00A74F96 /* PBXTextBookmark */;
+                       022B469D121865E000A74F96 /* PBXTextBookmark */ = 022B469D121865E000A74F96 /* PBXTextBookmark */;
+                       022B469E121865E000A74F96 /* PBXTextBookmark */ = 022B469E121865E000A74F96 /* PBXTextBookmark */;
+                       022B46A1121865E300A74F96 /* PBXTextBookmark */ = 022B46A1121865E300A74F96 /* PBXTextBookmark */;
+                       022B46A2121865E300A74F96 /* PBXTextBookmark */ = 022B46A2121865E300A74F96 /* PBXTextBookmark */;
+                       022B46A5121865F700A74F96 /* PBXTextBookmark */ = 022B46A5121865F700A74F96 /* PBXTextBookmark */;
+                       022B46A6121865F700A74F96 /* PBXTextBookmark */ = 022B46A6121865F700A74F96 /* PBXTextBookmark */;
+                       022B46A91218660A00A74F96 /* PBXTextBookmark */ = 022B46A91218660A00A74F96 /* PBXTextBookmark */;
+                       022B46AA1218660A00A74F96 /* PBXTextBookmark */ = 022B46AA1218660A00A74F96 /* PBXTextBookmark */;
+                       022B46AD1218662100A74F96 /* PBXTextBookmark */ = 022B46AD1218662100A74F96 /* PBXTextBookmark */;
+                       022B46AE1218662100A74F96 /* PBXTextBookmark */ = 022B46AE1218662100A74F96 /* PBXTextBookmark */;
+                       022B46B11218662D00A74F96 /* PBXTextBookmark */ = 022B46B11218662D00A74F96 /* PBXTextBookmark */;
+                       022B46B21218662D00A74F96 /* PBXTextBookmark */ = 022B46B21218662D00A74F96 /* PBXTextBookmark */;
+                       022B46B31218663500A74F96 /* PBXTextBookmark */ = 022B46B31218663500A74F96 /* PBXTextBookmark */;
+                       022B46B71218665300A74F96 /* PBXTextBookmark */ = 022B46B71218665300A74F96 /* PBXTextBookmark */;
+                       022B46B81218665300A74F96 /* PBXTextBookmark */ = 022B46B81218665300A74F96 /* PBXTextBookmark */;
+                       022B46B91218665600A74F96 /* PBXTextBookmark */ = 022B46B91218665600A74F96 /* PBXTextBookmark */;
+                       022B46BD1218667B00A74F96 /* PBXTextBookmark */ = 022B46BD1218667B00A74F96 /* PBXTextBookmark */;
+                       022B46BE1218667B00A74F96 /* PBXTextBookmark */ = 022B46BE1218667B00A74F96 /* PBXTextBookmark */;
+                       022B46C11218673300A74F96 /* PBXTextBookmark */ = 022B46C11218673300A74F96 /* PBXTextBookmark */;
+                       022B46C21218673300A74F96 /* PBXTextBookmark */ = 022B46C21218673300A74F96 /* PBXTextBookmark */;
+                       022B46C3121867D800A74F96 /* PBXTextBookmark */ = 022B46C3121867D800A74F96 /* PBXTextBookmark */;
+                       022B46C61218685B00A74F96 /* PBXTextBookmark */ = 022B46C61218685B00A74F96 /* PBXTextBookmark */;
+                       022B46C71218685B00A74F96 /* PBXTextBookmark */ = 022B46C71218685B00A74F96 /* PBXTextBookmark */;
+                       022B46C81218686300A74F96 /* PBXTextBookmark */ = 022B46C81218686300A74F96 /* PBXTextBookmark */;
+                       022B46CC1218687300A74F96 /* PBXTextBookmark */ = 022B46CC1218687300A74F96 /* PBXTextBookmark */;
+                       022B46CD1218687300A74F96 /* PBXTextBookmark */ = 022B46CD1218687300A74F96 /* PBXTextBookmark */;
+                       022B46CE1218687700A74F96 /* PBXTextBookmark */ = 022B46CE1218687700A74F96 /* PBXTextBookmark */;
+                       022B46D1121868F200A74F96 /* PBXTextBookmark */ = 022B46D1121868F200A74F96 /* PBXTextBookmark */;
+                       022B46D2121868F200A74F96 /* PBXTextBookmark */ = 022B46D2121868F200A74F96 /* PBXTextBookmark */;
+                       022B46D3121868FD00A74F96 /* PBXTextBookmark */ = 022B46D3121868FD00A74F96 /* PBXTextBookmark */;
+                       022B46D4121868FD00A74F96 /* PBXTextBookmark */ = 022B46D4121868FD00A74F96 /* PBXTextBookmark */;
+                       022B46D5121868FD00A74F96 /* PBXTextBookmark */ = 022B46D5121868FD00A74F96 /* PBXTextBookmark */;
+                       022B46D81218690400A74F96 /* PBXTextBookmark */ = 022B46D81218690400A74F96 /* PBXTextBookmark */;
+                       022B46D91218690400A74F96 /* PBXTextBookmark */ = 022B46D91218690400A74F96 /* PBXTextBookmark */;
+                       022B46DC1218694400A74F96 /* PBXTextBookmark */ = 022B46DC1218694400A74F96 /* PBXTextBookmark */;
+                       022B46DD1218694400A74F96 /* PBXTextBookmark */ = 022B46DD1218694400A74F96 /* PBXTextBookmark */;
+                       022B46DE1218694900A74F96 /* PBXTextBookmark */ = 022B46DE1218694900A74F96 /* PBXTextBookmark */;
+                       022B46E11218696F00A74F96 /* PBXTextBookmark */ = 022B46E11218696F00A74F96 /* PBXTextBookmark */;
+                       022B46E21218696F00A74F96 /* PBXTextBookmark */ = 022B46E21218696F00A74F96 /* PBXTextBookmark */;
+                       022B46E31218697600A74F96 /* PBXTextBookmark */ = 022B46E31218697600A74F96 /* PBXTextBookmark */;
+                       022B46E61218699C00A74F96 /* PBXTextBookmark */ = 022B46E61218699C00A74F96 /* PBXTextBookmark */;
+                       022B46E71218699C00A74F96 /* PBXTextBookmark */ = 022B46E71218699C00A74F96 /* PBXTextBookmark */;
+                       022B46E8121869A100A74F96 /* PBXTextBookmark */ = 022B46E8121869A100A74F96 /* PBXTextBookmark */;
+                       022B46EC12186A4400A74F96 /* PBXTextBookmark */ = 022B46EC12186A4400A74F96 /* PBXTextBookmark */;
+                       022B46ED12186A4400A74F96 /* PBXTextBookmark */ = 022B46ED12186A4400A74F96 /* PBXTextBookmark */;
+                       022B46EE12186A5B00A74F96 /* PBXTextBookmark */ = 022B46EE12186A5B00A74F96 /* PBXTextBookmark */;
+                       022B46F112186A6700A74F96 /* PBXTextBookmark */ = 022B46F112186A6700A74F96 /* PBXTextBookmark */;
+                       022B46F212186A6700A74F96 /* PBXTextBookmark */ = 022B46F212186A6700A74F96 /* PBXTextBookmark */;
+                       022B46F312186A8300A74F96 /* PBXTextBookmark */ = 022B46F312186A8300A74F96 /* PBXTextBookmark */;
+                       022B46F612186AFC00A74F96 /* PBXTextBookmark */ = 022B46F612186AFC00A74F96 /* PBXTextBookmark */;
+                       022B46F712186AFC00A74F96 /* PBXTextBookmark */ = 022B46F712186AFC00A74F96 /* PBXTextBookmark */;
+                       022B46FA1218B7B300A74F96 /* PBXTextBookmark */ = 022B46FA1218B7B300A74F96 /* PBXTextBookmark */;
+                       022B46FB1218B7B300A74F96 /* PBXTextBookmark */ = 022B46FB1218B7B300A74F96 /* PBXTextBookmark */;
+                       022B46FE1218B7F600A74F96 /* PBXTextBookmark */ = 022B46FE1218B7F600A74F96 /* PBXTextBookmark */;
+                       022B46FF1218B7F600A74F96 /* PBXTextBookmark */ = 022B46FF1218B7F600A74F96 /* PBXTextBookmark */;
+                       022B47021218B95800A74F96 /* PBXTextBookmark */ = 022B47021218B95800A74F96 /* PBXTextBookmark */;
+                       022B47031218B95800A74F96 /* PBXTextBookmark */ = 022B47031218B95800A74F96 /* PBXTextBookmark */;
+                       022B47041218B95D00A74F96 /* PBXTextBookmark */ = 022B47041218B95D00A74F96 /* PBXTextBookmark */;
+                       022B47051218B95D00A74F96 /* PBXTextBookmark */ = 022B47051218B95D00A74F96 /* PBXTextBookmark */;
+                       022B47061218B95D00A74F96 /* PBXTextBookmark */ = 022B47061218B95D00A74F96 /* PBXTextBookmark */;
+                       022B47091218B96300A74F96 /* PBXTextBookmark */ = 022B47091218B96300A74F96 /* PBXTextBookmark */;
+                       022B470A1218B96300A74F96 /* PBXTextBookmark */ = 022B470A1218B96300A74F96 /* PBXTextBookmark */;
+                       022B470D1218B99F00A74F96 /* PBXTextBookmark */ = 022B470D1218B99F00A74F96 /* PBXTextBookmark */;
+                       022B470E1218B99F00A74F96 /* PBXTextBookmark */ = 022B470E1218B99F00A74F96 /* PBXTextBookmark */;
+                       022B470F1218B9AF00A74F96 /* PBXTextBookmark */ = 022B470F1218B9AF00A74F96 /* PBXTextBookmark */;
+                       022B47121218B9B300A74F96 /* PBXTextBookmark */ = 022B47121218B9B300A74F96 /* PBXTextBookmark */;
+                       022B47131218B9B300A74F96 /* PBXTextBookmark */ = 022B47131218B9B300A74F96 /* PBXTextBookmark */;
+                       022B47161218C00000A74F96 /* PBXTextBookmark */ = 022B47161218C00000A74F96 /* PBXTextBookmark */;
+                       022B47171218C00000A74F96 /* PBXTextBookmark */ = 022B47171218C00000A74F96 /* PBXTextBookmark */;
+                       022B47181218C00400A74F96 /* PBXTextBookmark */ = 022B47181218C00400A74F96 /* PBXTextBookmark */;
+                       022B471B1218C00E00A74F96 /* PBXTextBookmark */ = 022B471B1218C00E00A74F96 /* PBXTextBookmark */;
+                       022B471C1218C00E00A74F96 /* PBXTextBookmark */ = 022B471C1218C00E00A74F96 /* PBXTextBookmark */;
+                       022B471D1218C01000A74F96 /* PBXTextBookmark */ = 022B471D1218C01000A74F96 /* PBXTextBookmark */;
+                       022B47201218C12800A74F96 /* PBXTextBookmark */ = 022B47201218C12800A74F96 /* PBXTextBookmark */;
+                       022B47211218C12800A74F96 /* PBXTextBookmark */ = 022B47211218C12800A74F96 /* PBXTextBookmark */;
+                       022B47221218C13000A74F96 /* PBXTextBookmark */ = 022B47221218C13000A74F96 /* PBXTextBookmark */;
+                       022B47261218C17D00A74F96 /* PBXTextBookmark */ = 022B47261218C17D00A74F96 /* PBXTextBookmark */;
+                       022B47271218C17D00A74F96 /* PBXTextBookmark */ = 022B47271218C17D00A74F96 /* PBXTextBookmark */;
+                       022B47281218C17F00A74F96 /* PBXTextBookmark */ = 022B47281218C17F00A74F96 /* PBXTextBookmark */;
+                       022B47291218C17F00A74F96 /* PBXTextBookmark */ = 022B47291218C17F00A74F96 /* PBXTextBookmark */;
+                       022B472A1218C17F00A74F96 /* PBXTextBookmark */ = 022B472A1218C17F00A74F96 /* PBXTextBookmark */;
+                       022B472D1218C18600A74F96 /* PBXTextBookmark */ = 022B472D1218C18600A74F96 /* PBXTextBookmark */;
+                       022B472E1218C18600A74F96 /* PBXTextBookmark */ = 022B472E1218C18600A74F96 /* PBXTextBookmark */;
+                       022B472F1218C19000A74F96 /* PBXTextBookmark */ = 022B472F1218C19000A74F96 /* PBXTextBookmark */;
+                       022B47351218C46700A74F96 /* PBXTextBookmark */ = 022B47351218C46700A74F96 /* PBXTextBookmark */;
+                       022B47361218C46700A74F96 /* XCBuildMessageTextBookmark */ = 022B47361218C46700A74F96 /* XCBuildMessageTextBookmark */;
+                       022B47371218C46700A74F96 /* PBXTextBookmark */ = 022B47371218C46700A74F96 /* PBXTextBookmark */;
+                       022B47381218C46700A74F96 /* PBXTextBookmark */ = 022B47381218C46700A74F96 /* PBXTextBookmark */;
+                       022B47391218C46A00A74F96 /* PBXTextBookmark */ = 022B47391218C46A00A74F96 /* PBXTextBookmark */;
+                       022B473A1218C46A00A74F96 /* PBXTextBookmark */ = 022B473A1218C46A00A74F96 /* PBXTextBookmark */;
+                       022B473B1218C46A00A74F96 /* PBXTextBookmark */ = 022B473B1218C46A00A74F96 /* PBXTextBookmark */;
+                       022B473C1218C46A00A74F96 /* PBXTextBookmark */ = 022B473C1218C46A00A74F96 /* PBXTextBookmark */;
+                       022B473F1218C46E00A74F96 /* PBXTextBookmark */ = 022B473F1218C46E00A74F96 /* PBXTextBookmark */;
+                       022B47401218C46E00A74F96 /* PBXTextBookmark */ = 022B47401218C46E00A74F96 /* PBXTextBookmark */;
+                       022B47411218C47C00A74F96 /* PBXTextBookmark */ = 022B47411218C47C00A74F96 /* PBXTextBookmark */;
+                       022B47451218C49900A74F96 /* PBXTextBookmark */ = 022B47451218C49900A74F96 /* PBXTextBookmark */;
+                       022B47461218C49900A74F96 /* PBXTextBookmark */ = 022B47461218C49900A74F96 /* PBXTextBookmark */;
+                       022B47491218CA9900A74F96 /* PBXTextBookmark */ = 022B47491218CA9900A74F96 /* PBXTextBookmark */;
+                       022B474A1218CA9900A74F96 /* PBXTextBookmark */ = 022B474A1218CA9900A74F96 /* PBXTextBookmark */;
+                       022B474B1218CA9A00A74F96 /* PBXTextBookmark */ = 022B474B1218CA9A00A74F96 /* PBXTextBookmark */;
+                       022B474C1218CA9A00A74F96 /* PBXTextBookmark */ = 022B474C1218CA9A00A74F96 /* PBXTextBookmark */;
+                       022B474D1218CA9A00A74F96 /* PBXTextBookmark */ = 022B474D1218CA9A00A74F96 /* PBXTextBookmark */;
+                       022B474E1218CA9A00A74F96 /* PBXTextBookmark */ = 022B474E1218CA9A00A74F96 /* PBXTextBookmark */;
+                       022B47511218CAA200A74F96 /* PBXTextBookmark */ = 022B47511218CAA200A74F96 /* PBXTextBookmark */;
+                       022B47521218CAA200A74F96 /* PBXTextBookmark */ = 022B47521218CAA200A74F96 /* PBXTextBookmark */;
+                       022B47531218CAAA00A74F96 /* PBXTextBookmark */ = 022B47531218CAAA00A74F96 /* PBXTextBookmark */;
+                       022B47571218CACE00A74F96 /* PBXTextBookmark */ = 022B47571218CACE00A74F96 /* PBXTextBookmark */;
+                       022B47581218CACE00A74F96 /* PBXTextBookmark */ = 022B47581218CACE00A74F96 /* PBXTextBookmark */;
+                       022B475B1218CAD200A74F96 /* PBXTextBookmark */ = 022B475B1218CAD200A74F96 /* PBXTextBookmark */;
+                       022B475C1218CAD200A74F96 /* PBXTextBookmark */ = 022B475C1218CAD200A74F96 /* PBXTextBookmark */;
+                       022B475D1218CAD700A74F96 /* PBXTextBookmark */ = 022B475D1218CAD700A74F96 /* PBXTextBookmark */;
+                       022B47601218CADD00A74F96 /* PBXTextBookmark */ = 022B47601218CADD00A74F96 /* PBXTextBookmark */;
+                       022B47611218CADD00A74F96 /* PBXTextBookmark */ = 022B47611218CADD00A74F96 /* PBXTextBookmark */;
+                       022B47621218CAE000A74F96 /* PBXTextBookmark */ = 022B47621218CAE000A74F96 /* PBXTextBookmark */;
+                       022B47651218CDA800A74F96 /* PBXTextBookmark */ = 022B47651218CDA800A74F96 /* PBXTextBookmark */;
+                       022B47661218CDA800A74F96 /* PBXTextBookmark */ = 022B47661218CDA800A74F96 /* PBXTextBookmark */;
+                       022B47691218CDAE00A74F96 /* PBXTextBookmark */ = 022B47691218CDAE00A74F96 /* PBXTextBookmark */;
+                       022B476A1218CDAE00A74F96 /* PBXTextBookmark */ = 022B476A1218CDAE00A74F96 /* PBXTextBookmark */;
+                       022B476D1218CDBB00A74F96 /* PBXTextBookmark */ = 022B476D1218CDBB00A74F96 /* PBXTextBookmark */;
+                       022B476E1218CDBB00A74F96 /* PBXTextBookmark */ = 022B476E1218CDBB00A74F96 /* PBXTextBookmark */;
+                       022B476F1218CDBF00A74F96 /* PBXTextBookmark */ = 022B476F1218CDBF00A74F96 /* PBXTextBookmark */;
+                       022B47701218CDBF00A74F96 /* PBXTextBookmark */ = 022B47701218CDBF00A74F96 /* PBXTextBookmark */;
+                       022B47711218CDBF00A74F96 /* PBXTextBookmark */ = 022B47711218CDBF00A74F96 /* PBXTextBookmark */;
+                       022B47721218CDBF00A74F96 /* PBXTextBookmark */ = 022B47721218CDBF00A74F96 /* PBXTextBookmark */;
+                       0234AF900D69029300A16BFF = 0234AF900D69029300A16BFF /* PBXTextBookmark */;
+                       0234AF910D69029300A16BFF = 0234AF910D69029300A16BFF /* PBXTextBookmark */;
+                       0234AF920D69029300A16BFF = 0234AF920D69029300A16BFF /* PBXTextBookmark */;
+                       0234AF930D69029300A16BFF = 0234AF930D69029300A16BFF /* PBXTextBookmark */;
+                       0234AF950D69029300A16BFF = 0234AF950D69029300A16BFF /* PBXTextBookmark */;
+                       0234AF970D69029300A16BFF = 0234AF970D69029300A16BFF /* PBXTextBookmark */;
+                       0234AF9A0D69029300A16BFF = 0234AF9A0D69029300A16BFF /* PBXTextBookmark */;
+                       0234AF9C0D69029300A16BFF = 0234AF9C0D69029300A16BFF /* PBXTextBookmark */;
+                       0234AF9D0D69029300A16BFF = 0234AF9D0D69029300A16BFF /* PBXTextBookmark */;
+                       0234AFA00D69029300A16BFF = 0234AFA00D69029300A16BFF /* PBXTextBookmark */;
+                       0234AFA20D69029300A16BFF = 0234AFA20D69029300A16BFF /* PBXTextBookmark */;
+                       024A0F200C53B9D8000317D4 = 024A0F200C53B9D8000317D4 /* PBXTextBookmark */;
+                       0258817C0CF13C0400681C7E = 0258817C0CF13C0400681C7E /* PBXTextBookmark */;
+                       025881810CF13C0400681C7E = 025881810CF13C0400681C7E /* PBXTextBookmark */;
+                       025881850CF13C0400681C7E = 025881850CF13C0400681C7E /* PBXTextBookmark */;
+                       025881860CF13C0400681C7E = 025881860CF13C0400681C7E /* PBXTextBookmark */;
+                       025881870CF13C0400681C7E = 025881870CF13C0400681C7E /* PBXTextBookmark */;
+                       025881890CF13C0400681C7E = 025881890CF13C0400681C7E /* PBXTextBookmark */;
+                       027EE3C30BD6930A00A6A136 = 027EE3C30BD6930A00A6A136 /* PBXTextBookmark */;
+                       027EE3C80BD6930A00A6A136 = 027EE3C80BD6930A00A6A136 /* PBXTextBookmark */;
+                       0292B60E0CDA9CFD00A3A500 = 0292B60E0CDA9CFD00A3A500 /* PBXTextBookmark */;
+                       0292B60F0CDA9CFD00A3A500 = 0292B60F0CDA9CFD00A3A500 /* PBXTextBookmark */;
+                       0292B6100CDA9CFD00A3A500 = 0292B6100CDA9CFD00A3A500 /* PBXTextBookmark */;
+                       0292B6160CDA9CFD00A3A500 = 0292B6160CDA9CFD00A3A500 /* PBXTextBookmark */;
+                       0292B6170CDA9CFD00A3A500 = 0292B6170CDA9CFD00A3A500 /* PBXTextBookmark */;
+                       0292B6180CDA9CFD00A3A500 = 0292B6180CDA9CFD00A3A500 /* PBXTextBookmark */;
+                       02C5DBD20A926A7F003B9C11 = 02C5DBD20A926A7F003B9C11 /* PBXTextBookmark */;
+                       02C5DBDB0A926A7F003B9C11 = 02C5DBDB0A926A7F003B9C11 /* PBXTextBookmark */;
+                       02C5DC310A93C14E003B9C11 = 02C5DC310A93C14E003B9C11 /* PBXTextBookmark */;
+                       02C5DC330A93C14E003B9C11 = 02C5DC330A93C14E003B9C11 /* PBXTextBookmark */;
+                       02C5DC350A93C14E003B9C11 = 02C5DC350A93C14E003B9C11 /* PBXTextBookmark */;
+                       02C5DCB50A93CA0A003B9C11 = 02C5DCB50A93CA0A003B9C11 /* PBXTextBookmark */;
+                       02C5DD520A93D327003B9C11 = 02C5DD520A93D327003B9C11 /* PBXTextBookmark */;
+                       02C5DDCD0A940126003B9C11 = 02C5DDCD0A940126003B9C11 /* PBXTextBookmark */;
+                       02C5DDCF0A940126003B9C11 = 02C5DDCF0A940126003B9C11 /* PBXTextBookmark */;
+                       02CAC9BA0BA06EA50020B29B = 02CAC9BA0BA06EA50020B29B /* PBXTextBookmark */;
+                       02D1FD190BD039BF007C7450 = 02D1FD190BD039BF007C7450 /* PBXTextBookmark */;
+                       02D1FE2E0BD1505E007C7450 = 02D1FE2E0BD1505E007C7450 /* PBXTextBookmark */;
+                       02D46C3B0FED5C3600E65706 = 02D46C3B0FED5C3600E65706 /* PBXTextBookmark */;
+                       02D46C3F0FED5C3600E65706 = 02D46C3F0FED5C3600E65706 /* PBXTextBookmark */;
+                       02D46C690FED5F4B00E65706 = 02D46C690FED5F4B00E65706 /* PBXTextBookmark */;
+                       02D46D1A0FED80BF00E65706 = 02D46D1A0FED80BF00E65706 /* PBXTextBookmark */;
+                       02D6132E10F28A6500B7DF2F = 02D6132E10F28A6500B7DF2F /* PBXTextBookmark */;
+                       02D6132F10F28A6500B7DF2F = 02D6132F10F28A6500B7DF2F /* PBXTextBookmark */;
+                       02D6133010F28A6500B7DF2F = 02D6133010F28A6500B7DF2F /* PBXTextBookmark */;
+                       02D6138C10F3E89000B7DF2F = 02D6138C10F3E89000B7DF2F /* PBXTextBookmark */;
+                       02D6138D10F3E89000B7DF2F = 02D6138D10F3E89000B7DF2F /* PBXTextBookmark */;
+                       02D6138E10F3E89000B7DF2F = 02D6138E10F3E89000B7DF2F /* PBXTextBookmark */;
+                       02D6138F10F3E89000B7DF2F = 02D6138F10F3E89000B7DF2F /* PBXTextBookmark */;
+                       02D6139010F3E89000B7DF2F = 02D6139010F3E89000B7DF2F /* PBXTextBookmark */;
+                       02D6139110F3E89000B7DF2F = 02D6139110F3E89000B7DF2F /* PBXTextBookmark */;
+                       02D6139210F3E89000B7DF2F = 02D6139210F3E89000B7DF2F /* PBXTextBookmark */;
+                       02D6139310F3E89000B7DF2F = 02D6139310F3E89000B7DF2F /* PBXTextBookmark */;
+                       02D6139410F3E89000B7DF2F = 02D6139410F3E89000B7DF2F /* PBXTextBookmark */;
+                       02D6139510F3E89000B7DF2F = 02D6139510F3E89000B7DF2F /* PBXTextBookmark */;
+                       02D6139610F3E89000B7DF2F = 02D6139610F3E89000B7DF2F /* PBXTextBookmark */;
+                       02D6139710F3E89000B7DF2F = 02D6139710F3E89000B7DF2F /* PBXTextBookmark */;
+                       02D6139810F3E89000B7DF2F = 02D6139810F3E89000B7DF2F /* PBXTextBookmark */;
+                       02D6139910F3E89000B7DF2F = 02D6139910F3E89000B7DF2F /* PBXTextBookmark */;
+                       02D6139B10F3E89000B7DF2F = 02D6139B10F3E89000B7DF2F /* PBXTextBookmark */;
+                       02D6139F10F3E96300B7DF2F = 02D6139F10F3E96300B7DF2F /* PBXTextBookmark */;
+                       02D795420FF00D8B00C1C5DF = 02D795420FF00D8B00C1C5DF /* PBXTextBookmark */;
+                       02D795430FF00D8B00C1C5DF = 02D795430FF00D8B00C1C5DF /* PBXTextBookmark */;
+                       02D795440FF00D8B00C1C5DF = 02D795440FF00D8B00C1C5DF /* PBXTextBookmark */;
+                       02D795450FF00D8B00C1C5DF = 02D795450FF00D8B00C1C5DF /* PBXTextBookmark */;
+                       02D795460FF00D8B00C1C5DF = 02D795460FF00D8B00C1C5DF /* PBXTextBookmark */;
+                       02D795470FF00D8B00C1C5DF = 02D795470FF00D8B00C1C5DF /* PBXTextBookmark */;
+                       02D795480FF00D8B00C1C5DF = 02D795480FF00D8B00C1C5DF /* PBXTextBookmark */;
+                       02D795490FF00D8B00C1C5DF = 02D795490FF00D8B00C1C5DF /* PBXTextBookmark */;
+                       02D7954A0FF00D8B00C1C5DF = 02D7954A0FF00D8B00C1C5DF /* PBXTextBookmark */;
+                       02D7954D0FF00D8B00C1C5DF = 02D7954D0FF00D8B00C1C5DF /* PBXTextBookmark */;
+                       02E535CF0C24641A00CBD4A5 = 02E535CF0C24641A00CBD4A5 /* PBXTextBookmark */;
+                       02E535D00C24641A00CBD4A5 = 02E535D00C24641A00CBD4A5 /* PBXTextBookmark */;
+                       02E535D20C24641A00CBD4A5 = 02E535D20C24641A00CBD4A5 /* PBXTextBookmark */;
+                       02E535D40C24641A00CBD4A5 = 02E535D40C24641A00CBD4A5 /* PBXTextBookmark */;
+                       02E535D70C24641A00CBD4A5 = 02E535D70C24641A00CBD4A5 /* PBXTextBookmark */;
+                       02E535D90C24641A00CBD4A5 = 02E535D90C24641A00CBD4A5 /* PBXTextBookmark */;
+                       02E535F10C24641A00CBD4A5 = 02E535F10C24641A00CBD4A5 /* PBXTextBookmark */;
+                       02E5362D0C38763700CBD4A5 = 02E5362D0C38763700CBD4A5 /* PBXTextBookmark */;
+                       02E536320C38763700CBD4A5 = 02E536320C38763700CBD4A5 /* PBXTextBookmark */;
+                       02E536340C38763700CBD4A5 = 02E536340C38763700CBD4A5 /* PBXTextBookmark */;
+                       02E536350C38763700CBD4A5 = 02E536350C38763700CBD4A5 /* PBXTextBookmark */;
+                       02E536360C38763700CBD4A5 = 02E536360C38763700CBD4A5 /* PBXTextBookmark */;
+                       02E5363F0C3C4FF000CBD4A5 = 02E5363F0C3C4FF000CBD4A5 /* PBXTextBookmark */;
+                       02FE651B0BFF94B2004A1450 = 02FE651B0BFF94B2004A1450 /* PBXTextBookmark */;
+               };
+               sourceControlManager = 0296A50409D9AE9400F80AFF /* Source Control */;
+               userBuildSettings = {
+               };
+       };
+       8DD76F620486A84900D96B5E /* elftosb */ = {
+               activeExec = 0;
+               executables = (
+                       0296A45509D9AE7A00F80AFF /* elftosb */,
+               );
+       };
+}
diff --git a/tools/elftosb/elftosb.xcodeproj/project.pbxproj b/tools/elftosb/elftosb.xcodeproj/project.pbxproj
new file mode 100644 (file)
index 0000000..85ab788
--- /dev/null
@@ -0,0 +1,943 @@
+// !$*UTF8*$!
+{
+       archiveVersion = 1;
+       classes = {
+       };
+       objectVersion = 45;
+       objects = {
+
+/* Begin PBXAggregateTarget section */
+               020DDCE80A1E858600E1CB49 /* Everything */ = {
+                       isa = PBXAggregateTarget;
+                       buildConfigurationList = 020DDCF00A1E85BA00E1CB49 /* Build configuration list for PBXAggregateTarget "Everything" */;
+                       buildPhases = (
+                       );
+                       dependencies = (
+                               020DDCEA0A1E858D00E1CB49 /* PBXTargetDependency */,
+                               020DDCEC0A1E858D00E1CB49 /* PBXTargetDependency */,
+                               020DDCEE0A1E858D00E1CB49 /* PBXTargetDependency */,
+                       );
+                       name = Everything;
+                       productName = Everything;
+               };
+/* End PBXAggregateTarget section */
+
+/* Begin PBXBuildFile section */
+               0208BEB30A02D2B800255D31 /* SHA1.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0208BEB10A02D2B800255D31 /* SHA1.cpp */; };
+               0208BF4D0A03137800255D31 /* Random.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0208BF4B0A03137800255D31 /* Random.cpp */; };
+               0208BF8C0A03E04800255D31 /* RijndaelCBCMAC.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0208BF8A0A03E04800255D31 /* RijndaelCBCMAC.cpp */; };
+               0208C03F0A0544BA00255D31 /* options.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0208C03D0A0544BA00255D31 /* options.cpp */; };
+               0208C08C0A05677000255D31 /* AESKey.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0208C08B0A05677000255D31 /* AESKey.cpp */; };
+               0208C28E0A0A4E5F00255D31 /* DataSource.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0208C2880A0A4E5F00255D31 /* DataSource.cpp */; };
+               0208C2900A0A4E5F00255D31 /* Operation.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0208C28A0A0A4E5F00255D31 /* Operation.cpp */; };
+               0208C2920A0A4E5F00255D31 /* DataTarget.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0208C28C0A0A4E5F00255D31 /* DataTarget.cpp */; };
+               0208C29B0A0A4EE800255D31 /* ConversionController.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0208C2990A0A4EE800255D31 /* ConversionController.cpp */; };
+               020D41880A0FF0C20027E24E /* OutputSection.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 020D41860A0FF0C20027E24E /* OutputSection.cpp */; };
+               020D419A0A0FF5BF0027E24E /* BootImageGenerator.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 020D41980A0FF5BF0027E24E /* BootImageGenerator.cpp */; };
+               020D41A60A0FF8880027E24E /* Version.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 020D41A40A0FF8880027E24E /* Version.cpp */; };
+               020D41BA0A0FFD140027E24E /* EncoreBootImageGenerator.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 020D41B80A0FFD140027E24E /* EncoreBootImageGenerator.cpp */; };
+               020D43A80A14D7E20027E24E /* Logging.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 020D43A60A14D7E20027E24E /* Logging.cpp */; };
+               020D45070A1523350027E24E /* GHSSecInfo.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 020D45050A1523350027E24E /* GHSSecInfo.cpp */; };
+               020D46840A1665D90027E24E /* sbtool.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 020D46830A1665D90027E24E /* sbtool.cpp */; };
+               020D46870A1668440027E24E /* AESKey.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0208C08B0A05677000255D31 /* AESKey.cpp */; };
+               020D46880A16684D0027E24E /* crc.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 02F8D4EF09FEE91B004CBE69 /* crc.cpp */; };
+               020D46890A16684E0027E24E /* DataSource.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0208C2880A0A4E5F00255D31 /* DataSource.cpp */; };
+               020D468A0A16684F0027E24E /* DataTarget.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0208C28C0A0A4E5F00255D31 /* DataTarget.cpp */; };
+               020D468B0A1668510027E24E /* ELFSourceFile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 024F1D610A0BCD8300D21D61 /* ELFSourceFile.cpp */; };
+               020D468C0A1668580027E24E /* EncoreBootImage.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 02F8D41C09FE86FA004CBE69 /* EncoreBootImage.cpp */; };
+               020D468D0A16685B0027E24E /* EvalContext.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 02E9D67409FBFE98006D7279 /* EvalContext.cpp */; };
+               020D468E0A16685D0027E24E /* GHSSecInfo.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 020D45050A1523350027E24E /* GHSSecInfo.cpp */; };
+               020D468F0A16685F0027E24E /* GlobMatcher.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 027402E40A0FB00000CF4BE7 /* GlobMatcher.cpp */; };
+               020D46900A1668600027E24E /* Logging.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 020D43A60A14D7E20027E24E /* Logging.cpp */; };
+               020D46910A1668630027E24E /* Operation.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0208C28A0A0A4E5F00255D31 /* Operation.cpp */; };
+               020D46920A1668650027E24E /* options.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0208C03D0A0544BA00255D31 /* options.cpp */; };
+               020D46930A1668680027E24E /* OutputSection.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 020D41860A0FF0C20027E24E /* OutputSection.cpp */; };
+               020D46940A1668690027E24E /* Random.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0208BF4B0A03137800255D31 /* Random.cpp */; };
+               020D46950A16686A0027E24E /* rijndael.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 02E3998D09F2EFAA0055992A /* rijndael.cpp */; };
+               020D46960A16686B0027E24E /* RijndaelCBCMAC.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0208BF8A0A03E04800255D31 /* RijndaelCBCMAC.cpp */; };
+               020D46970A16686D0027E24E /* SHA1.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0208BEB10A02D2B800255D31 /* SHA1.cpp */; };
+               020D46980A16686F0027E24E /* SourceFile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 02F8D5610A0152AB004CBE69 /* SourceFile.cpp */; };
+               020D46990A1668710027E24E /* SRecordSourceFile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 024F1D5D0A0BCD7200D21D61 /* SRecordSourceFile.cpp */; };
+               020D469A0A1668730027E24E /* stdafx.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0296A49E09D9AE9400F80AFF /* stdafx.cpp */; };
+               020D469B0A1668760027E24E /* StELFFile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0296A49F09D9AE9400F80AFF /* StELFFile.cpp */; };
+               020D469C0A1668770027E24E /* StExecutableImage.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0296A4A409D9AE9400F80AFF /* StExecutableImage.cpp */; };
+               020D469D0A1668780027E24E /* StSRecordFile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0296A4AA09D9AE9400F80AFF /* StSRecordFile.cpp */; };
+               020D469E0A16687A0027E24E /* Value.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 02F8D54A0A014F5D004CBE69 /* Value.cpp */; };
+               020D469F0A16687A0027E24E /* Version.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 020D41A40A0FF8880027E24E /* Version.cpp */; };
+               020D47A20A16C1E00027E24E /* EncoreBootImageReader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 020D47A10A16C1E00027E24E /* EncoreBootImageReader.cpp */; };
+               020DDBED0A1D08AD00E1CB49 /* OptionDictionary.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 020DDBEB0A1D08AD00E1CB49 /* OptionDictionary.cpp */; };
+               02123F320A6B057E003CF33F /* Blob.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 02123F300A6B057E003CF33F /* Blob.cpp */; };
+               02123F3A0A6B09CF003CF33F /* HexValues.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 02123F380A6B09CF003CF33F /* HexValues.cpp */; };
+               021240010A6C3AA9003CF33F /* Blob.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 02123F300A6B057E003CF33F /* Blob.cpp */; };
+               021240020A6C3AAA003CF33F /* HexValues.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 02123F380A6B09CF003CF33F /* HexValues.cpp */; };
+               0215B3D309F424D800EA7C45 /* elftosb_parser.y in Sources */ = {isa = PBXBuildFile; fileRef = 0215B3D209F424D800EA7C45 /* elftosb_parser.y */; };
+               0215B3E909F4277100EA7C45 /* elftosb_lexer.l in Sources */ = {isa = PBXBuildFile; fileRef = 02E3997909F2E0410055992A /* elftosb_lexer.l */; };
+               021CA3F30A8D16960028326F /* ExcludesListMatcher.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 021CA3F10A8D16960028326F /* ExcludesListMatcher.cpp */; };
+               022B4657121763A100A74F96 /* IVTDataSource.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 022B4656121763A100A74F96 /* IVTDataSource.cpp */; };
+               024F1D5F0A0BCD7200D21D61 /* SRecordSourceFile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 024F1D5D0A0BCD7200D21D61 /* SRecordSourceFile.cpp */; };
+               024F1D630A0BCD8300D21D61 /* ELFSourceFile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 024F1D610A0BCD8300D21D61 /* ELFSourceFile.cpp */; };
+               025881010CEE47A900681C7E /* HexValues.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 02123F380A6B09CF003CF33F /* HexValues.cpp */; };
+               027402E60A0FB00000CF4BE7 /* GlobMatcher.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 027402E40A0FB00000CF4BE7 /* GlobMatcher.cpp */; };
+               0296A4E709D9AE9400F80AFF /* elftosb.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0296A49309D9AE9400F80AFF /* elftosb.cpp */; };
+               0296A4F209D9AE9400F80AFF /* stdafx.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0296A49E09D9AE9400F80AFF /* stdafx.cpp */; };
+               0296A4F309D9AE9400F80AFF /* StELFFile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0296A49F09D9AE9400F80AFF /* StELFFile.cpp */; };
+               0296A4F809D9AE9400F80AFF /* StExecutableImage.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0296A4A409D9AE9400F80AFF /* StExecutableImage.cpp */; };
+               0296A4FE09D9AE9400F80AFF /* StSRecordFile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0296A4AA09D9AE9400F80AFF /* StSRecordFile.cpp */; };
+               02B9D4FD0B9A13AE0084CE1F /* SB36xxBootImageGenerator.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 02B9D4FC0B9A13AE0084CE1F /* SB36xxBootImageGenerator.cpp */; };
+               02B9D50A0B9A16C10084CE1F /* crypto.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 02B9D5000B9A16C10084CE1F /* crypto.cpp */; };
+               02B9D50B0B9A16C10084CE1F /* St3600IPL.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 02B9D5020B9A16C10084CE1F /* St3600IPL.cpp */; };
+               02B9D50C0B9A16C10084CE1F /* StKeySet.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 02B9D5050B9A16C10084CE1F /* StKeySet.cpp */; };
+               02B9D50D0B9A16C10084CE1F /* StLFSREncrypter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 02B9D5070B9A16C10084CE1F /* StLFSREncrypter.cpp */; };
+               02B9D50E0B9A16C10084CE1F /* table.c in Sources */ = {isa = PBXBuildFile; fileRef = 02B9D5090B9A16C10084CE1F /* table.c */; };
+               02B9D56C0B9B37890084CE1F /* default_rom_key.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 02B9D56A0B9B37890084CE1F /* default_rom_key.cpp */; };
+               02C5DB940A925C61003B9C11 /* format_string.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 02C5DB920A925C61003B9C11 /* format_string.cpp */; };
+               02C5DB950A925C61003B9C11 /* format_string.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 02C5DB920A925C61003B9C11 /* format_string.cpp */; };
+               02C5DB960A925C61003B9C11 /* format_string.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 02C5DB920A925C61003B9C11 /* format_string.cpp */; };
+               02CD157609F543FE00ABE650 /* ElftosbAST.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 02CD157409F543FE00ABE650 /* ElftosbAST.cpp */; };
+               02CD158909F557D300ABE650 /* ElftosbLexer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 02CD158809F557D300ABE650 /* ElftosbLexer.cpp */; };
+               02D1FCA90BD02B69007C7450 /* SearchPath.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 02D1FCA80BD02B69007C7450 /* SearchPath.cpp */; };
+               02D1FCF70BD039A0007C7450 /* SearchPath.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 02D1FCA80BD02B69007C7450 /* SearchPath.cpp */; };
+               02E25EAA0A1A5DCB001161B5 /* keygen.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 02E25EA90A1A5DCB001161B5 /* keygen.cpp */; };
+               02E25EAE0A1A5DF4001161B5 /* AESKey.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0208C08B0A05677000255D31 /* AESKey.cpp */; };
+               02E25EAF0A1A5E09001161B5 /* Random.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0208BF4B0A03137800255D31 /* Random.cpp */; };
+               02E25EB00A1A5E0C001161B5 /* Logging.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 020D43A60A14D7E20027E24E /* Logging.cpp */; };
+               02E25EB10A1A5E18001161B5 /* stdafx.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0296A49E09D9AE9400F80AFF /* stdafx.cpp */; };
+               02E25EB20A1A5E1C001161B5 /* options.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0208C03D0A0544BA00255D31 /* options.cpp */; };
+               02E3998F09F2EFAA0055992A /* rijndael.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 02E3998D09F2EFAA0055992A /* rijndael.cpp */; };
+               02E535B50C245AEC00CBD4A5 /* DataSourceImager.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 02E535B40C245AEC00CBD4A5 /* DataSourceImager.cpp */; };
+               02E9D67609FBFE98006D7279 /* EvalContext.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 02E9D67409FBFE98006D7279 /* EvalContext.cpp */; };
+               02F8D41E09FE86FB004CBE69 /* EncoreBootImage.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 02F8D41C09FE86FA004CBE69 /* EncoreBootImage.cpp */; };
+               02F8D4F109FEE91B004CBE69 /* crc.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 02F8D4EF09FEE91B004CBE69 /* crc.cpp */; };
+               02F8D54C0A014F5D004CBE69 /* Value.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 02F8D54A0A014F5D004CBE69 /* Value.cpp */; };
+               02F8D5630A0152AB004CBE69 /* SourceFile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 02F8D5610A0152AB004CBE69 /* SourceFile.cpp */; };
+/* End PBXBuildFile section */
+
+/* Begin PBXBuildRule section */
+               0215B3D509F4254100EA7C45 /* PBXBuildRule */ = {
+                       isa = PBXBuildRule;
+                       compilerSpec = com.apple.compilers.proxy.script;
+                       fileType = sourcecode.lex;
+                       isEditable = 1;
+                       outputFiles = (
+                               "${DERIVED_FILES_DIR}/${INPUT_FILE_BASE}.cpp",
+                       );
+                       script = "flex -o${DERIVED_FILES_DIR}/${INPUT_FILE_BASE}.cpp ${INPUT_FILE_DIR}/${INPUT_FILE_NAME}";
+               };
+               0215B3D609F4255D00EA7C45 /* PBXBuildRule */ = {
+                       isa = PBXBuildRule;
+                       compilerSpec = com.apple.compilers.proxy.script;
+                       fileType = sourcecode.yacc;
+                       isEditable = 1;
+                       outputFiles = (
+                               "${DERIVED_FILES_DIR}/${INPUT_FILE_BASE}.tab.cpp",
+                       );
+                       script = "/usr/local/bin/bison -o ${DERIVED_FILES_DIR}/${INPUT_FILE_BASE}.tab.cpp ${INPUT_FILE_DIR}/${INPUT_FILE_NAME}";
+               };
+               0296CF9309DB3B8700F80AFF /* PBXBuildRule */ = {
+                       isa = PBXBuildRule;
+                       compilerSpec = com.apple.compilers.gcc;
+                       fileType = sourcecode.c;
+                       isEditable = 1;
+                       outputFiles = (
+                       );
+               };
+/* End PBXBuildRule section */
+
+/* Begin PBXContainerItemProxy section */
+               020DDCE90A1E858D00E1CB49 /* PBXContainerItemProxy */ = {
+                       isa = PBXContainerItemProxy;
+                       containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */;
+                       proxyType = 1;
+                       remoteGlobalIDString = 8DD76F620486A84900D96B5E;
+                       remoteInfo = elftosb;
+               };
+               020DDCEB0A1E858D00E1CB49 /* PBXContainerItemProxy */ = {
+                       isa = PBXContainerItemProxy;
+                       containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */;
+                       proxyType = 1;
+                       remoteGlobalIDString = 020D467A0A16657C0027E24E;
+                       remoteInfo = sbtool;
+               };
+               020DDCED0A1E858D00E1CB49 /* PBXContainerItemProxy */ = {
+                       isa = PBXContainerItemProxy;
+                       containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */;
+                       proxyType = 1;
+                       remoteGlobalIDString = 02E25EA40A1A5DB0001161B5;
+                       remoteInfo = keygen;
+               };
+/* End PBXContainerItemProxy section */
+
+/* Begin PBXFileReference section */
+               0208BEB10A02D2B800255D31 /* SHA1.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SHA1.cpp; sourceTree = "<group>"; };
+               0208BEB20A02D2B800255D31 /* SHA1.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SHA1.h; sourceTree = "<group>"; };
+               0208BF4A0A03137800255D31 /* Random.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Random.h; sourceTree = "<group>"; };
+               0208BF4B0A03137800255D31 /* Random.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Random.cpp; sourceTree = "<group>"; };
+               0208BF890A03E04800255D31 /* RijndaelCBCMAC.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RijndaelCBCMAC.h; sourceTree = "<group>"; };
+               0208BF8A0A03E04800255D31 /* RijndaelCBCMAC.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RijndaelCBCMAC.cpp; sourceTree = "<group>"; };
+               0208C03D0A0544BA00255D31 /* options.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = options.cpp; sourceTree = "<group>"; };
+               0208C03E0A0544BA00255D31 /* options.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = options.h; sourceTree = "<group>"; };
+               0208C08B0A05677000255D31 /* AESKey.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AESKey.cpp; sourceTree = "<group>"; };
+               0208C2880A0A4E5F00255D31 /* DataSource.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DataSource.cpp; sourceTree = "<group>"; };
+               0208C2890A0A4E5F00255D31 /* DataSource.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DataSource.h; sourceTree = "<group>"; };
+               0208C28A0A0A4E5F00255D31 /* Operation.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Operation.cpp; sourceTree = "<group>"; };
+               0208C28B0A0A4E5F00255D31 /* Operation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Operation.h; sourceTree = "<group>"; };
+               0208C28C0A0A4E5F00255D31 /* DataTarget.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DataTarget.cpp; sourceTree = "<group>"; };
+               0208C28D0A0A4E5F00255D31 /* DataTarget.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DataTarget.h; sourceTree = "<group>"; };
+               0208C2990A0A4EE800255D31 /* ConversionController.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ConversionController.cpp; sourceTree = "<group>"; };
+               0208C29A0A0A4EE800255D31 /* ConversionController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ConversionController.h; sourceTree = "<group>"; };
+               0208C2E00A0AA4F700255D31 /* int_size.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = int_size.h; sourceTree = "<group>"; };
+               020D416A0A0FE8AC0027E24E /* StringMatcher.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StringMatcher.h; sourceTree = "<group>"; };
+               020D41850A0FF0C20027E24E /* OutputSection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OutputSection.h; sourceTree = "<group>"; };
+               020D41860A0FF0C20027E24E /* OutputSection.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = OutputSection.cpp; sourceTree = "<group>"; };
+               020D41970A0FF5BF0027E24E /* BootImageGenerator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BootImageGenerator.h; sourceTree = "<group>"; };
+               020D41980A0FF5BF0027E24E /* BootImageGenerator.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = BootImageGenerator.cpp; sourceTree = "<group>"; };
+               020D41A30A0FF8880027E24E /* Version.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Version.h; sourceTree = "<group>"; };
+               020D41A40A0FF8880027E24E /* Version.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Version.cpp; sourceTree = "<group>"; };
+               020D41AE0A0FFB040027E24E /* BootImage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BootImage.h; sourceTree = "<group>"; };
+               020D41B70A0FFD140027E24E /* EncoreBootImageGenerator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EncoreBootImageGenerator.h; sourceTree = "<group>"; };
+               020D41B80A0FFD140027E24E /* EncoreBootImageGenerator.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = EncoreBootImageGenerator.cpp; sourceTree = "<group>"; };
+               020D43A50A14D7E20027E24E /* Logging.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Logging.h; sourceTree = "<group>"; };
+               020D43A60A14D7E20027E24E /* Logging.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Logging.cpp; sourceTree = "<group>"; };
+               020D45040A1523350027E24E /* GHSSecInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GHSSecInfo.h; sourceTree = "<group>"; };
+               020D45050A1523350027E24E /* GHSSecInfo.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GHSSecInfo.cpp; sourceTree = "<group>"; };
+               020D454F0A1533550027E24E /* OptionContext.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OptionContext.h; sourceTree = "<group>"; };
+               020D467B0A16657C0027E24E /* sbtool */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = sbtool; sourceTree = BUILT_PRODUCTS_DIR; };
+               020D46830A1665D90027E24E /* sbtool.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = sbtool.cpp; sourceTree = "<group>"; };
+               020D47A00A16C1E00027E24E /* EncoreBootImageReader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EncoreBootImageReader.h; sourceTree = "<group>"; };
+               020D47A10A16C1E00027E24E /* EncoreBootImageReader.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = EncoreBootImageReader.cpp; sourceTree = "<group>"; };
+               020DDBEA0A1D08AD00E1CB49 /* OptionDictionary.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OptionDictionary.h; sourceTree = "<group>"; };
+               020DDBEB0A1D08AD00E1CB49 /* OptionDictionary.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = OptionDictionary.cpp; sourceTree = "<group>"; };
+               02123F2F0A6B057E003CF33F /* Blob.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Blob.h; sourceTree = "<group>"; };
+               02123F300A6B057E003CF33F /* Blob.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Blob.cpp; sourceTree = "<group>"; };
+               02123F370A6B09CF003CF33F /* HexValues.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HexValues.h; sourceTree = "<group>"; };
+               02123F380A6B09CF003CF33F /* HexValues.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HexValues.cpp; sourceTree = "<group>"; };
+               0215B3BA09F3FBF100EA7C45 /* ElftosbLexer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ElftosbLexer.h; sourceTree = "<group>"; };
+               0215B3D209F424D800EA7C45 /* elftosb_parser.y */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.yacc; path = elftosb_parser.y; sourceTree = "<group>"; tabWidth = 4; usesTabs = 1; };
+               021CA3F00A8D16960028326F /* ExcludesListMatcher.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ExcludesListMatcher.h; sourceTree = "<group>"; };
+               021CA3F10A8D16960028326F /* ExcludesListMatcher.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ExcludesListMatcher.cpp; sourceTree = "<group>"; };
+               022B4655121763A100A74F96 /* IVTDataSource.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IVTDataSource.h; sourceTree = "<group>"; };
+               022B4656121763A100A74F96 /* IVTDataSource.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = IVTDataSource.cpp; sourceTree = "<group>"; };
+               024F1D5C0A0BCD7200D21D61 /* SRecordSourceFile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SRecordSourceFile.h; sourceTree = "<group>"; };
+               024F1D5D0A0BCD7200D21D61 /* SRecordSourceFile.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SRecordSourceFile.cpp; sourceTree = "<group>"; };
+               024F1D600A0BCD8300D21D61 /* ELFSourceFile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ELFSourceFile.h; sourceTree = "<group>"; };
+               024F1D610A0BCD8300D21D61 /* ELFSourceFile.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ELFSourceFile.cpp; sourceTree = "<group>"; };
+               024F1E190A0D20C900D21D61 /* ElftosbErrors.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ElftosbErrors.h; sourceTree = "<group>"; };
+               027402E30A0FB00000CF4BE7 /* GlobMatcher.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GlobMatcher.h; sourceTree = "<group>"; };
+               027402E40A0FB00000CF4BE7 /* GlobMatcher.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GlobMatcher.cpp; sourceTree = "<group>"; };
+               0296A48709D9AE9400F80AFF /* ELF.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = ELF.h; sourceTree = "<group>"; };
+               0296A48909D9AE9400F80AFF /* hello_NOR_arm */ = {isa = PBXFileReference; lastKnownFileType = file; path = hello_NOR_arm; sourceTree = "<group>"; };
+               0296A48A09D9AE9400F80AFF /* hello_NOR_arm.map */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; path = hello_NOR_arm.map; sourceTree = "<group>"; };
+               0296A48B09D9AE9400F80AFF /* hello_NOR_mixed */ = {isa = PBXFileReference; lastKnownFileType = file; path = hello_NOR_mixed; sourceTree = "<group>"; };
+               0296A48C09D9AE9400F80AFF /* hello_NOR_mixed.map */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; path = hello_NOR_mixed.map; sourceTree = "<group>"; };
+               0296A48D09D9AE9400F80AFF /* hello_NOR_thumb */ = {isa = PBXFileReference; lastKnownFileType = file; path = hello_NOR_thumb; sourceTree = "<group>"; };
+               0296A48E09D9AE9400F80AFF /* hello_NOR_thumb.map */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; path = hello_NOR_thumb.map; sourceTree = "<group>"; };
+               0296A48F09D9AE9400F80AFF /* hostlink */ = {isa = PBXFileReference; lastKnownFileType = file; path = hostlink; sourceTree = "<group>"; };
+               0296A49009D9AE9400F80AFF /* redboot_gcc.srec */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; path = redboot_gcc.srec; sourceTree = "<group>"; };
+               0296A49109D9AE9400F80AFF /* sd_player_gcc */ = {isa = PBXFileReference; lastKnownFileType = file; path = sd_player_gcc; sourceTree = "<group>"; };
+               0296A49209D9AE9400F80AFF /* sd_player_gcc.srec */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; path = sd_player_gcc.srec; sourceTree = "<group>"; };
+               0296A49309D9AE9400F80AFF /* elftosb.cpp */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.cpp.cpp; path = elftosb.cpp; sourceTree = "<group>"; tabWidth = 4; usesTabs = 1; };
+               0296A49409D9AE9400F80AFF /* elftosb.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = elftosb.h; sourceTree = "<group>"; };
+               0296A49E09D9AE9400F80AFF /* stdafx.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = stdafx.cpp; sourceTree = "<group>"; };
+               0296A49F09D9AE9400F80AFF /* StELFFile.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = StELFFile.cpp; sourceTree = "<group>"; };
+               0296A4A009D9AE9400F80AFF /* StELFFile.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = StELFFile.h; sourceTree = "<group>"; };
+               0296A4A409D9AE9400F80AFF /* StExecutableImage.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = StExecutableImage.cpp; sourceTree = "<group>"; };
+               0296A4A509D9AE9400F80AFF /* StExecutableImage.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = StExecutableImage.h; sourceTree = "<group>"; };
+               0296A4AA09D9AE9400F80AFF /* StSRecordFile.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = StSRecordFile.cpp; sourceTree = "<group>"; };
+               0296A4AB09D9AE9400F80AFF /* StSRecordFile.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = StSRecordFile.h; sourceTree = "<group>"; };
+               0296CF9C09DB3C5200F80AFF /* stdafx.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = stdafx.h; sourceTree = "<group>"; };
+               02B9D4FB0B9A13AE0084CE1F /* SB36xxBootImageGenerator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SB36xxBootImageGenerator.h; sourceTree = "<group>"; };
+               02B9D4FC0B9A13AE0084CE1F /* SB36xxBootImageGenerator.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SB36xxBootImageGenerator.cpp; sourceTree = "<group>"; };
+               02B9D5000B9A16C10084CE1F /* crypto.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = crypto.cpp; sourceTree = "<group>"; };
+               02B9D5010B9A16C10084CE1F /* crypto.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = crypto.h; sourceTree = "<group>"; };
+               02B9D5020B9A16C10084CE1F /* St3600IPL.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = St3600IPL.cpp; sourceTree = "<group>"; };
+               02B9D5030B9A16C10084CE1F /* St3600IPL.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = St3600IPL.h; sourceTree = "<group>"; };
+               02B9D5040B9A16C10084CE1F /* StEncrypter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StEncrypter.h; sourceTree = "<group>"; };
+               02B9D5050B9A16C10084CE1F /* StKeySet.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = StKeySet.cpp; sourceTree = "<group>"; };
+               02B9D5060B9A16C10084CE1F /* StKeySet.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StKeySet.h; sourceTree = "<group>"; };
+               02B9D5070B9A16C10084CE1F /* StLFSREncrypter.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = StLFSREncrypter.cpp; sourceTree = "<group>"; };
+               02B9D5080B9A16C10084CE1F /* StLFSREncrypter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StLFSREncrypter.h; sourceTree = "<group>"; };
+               02B9D5090B9A16C10084CE1F /* table.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = table.c; sourceTree = "<group>"; };
+               02B9D56A0B9B37890084CE1F /* default_rom_key.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = default_rom_key.cpp; sourceTree = "<group>"; };
+               02B9D56B0B9B37890084CE1F /* default_rom_key.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = default_rom_key.h; sourceTree = "<group>"; };
+               02C5DB910A925C61003B9C11 /* format_string.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = format_string.h; sourceTree = "<group>"; };
+               02C5DB920A925C61003B9C11 /* format_string.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = format_string.cpp; sourceTree = "<group>"; };
+               02C5DC000A93AC85003B9C11 /* EndianUtilities.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EndianUtilities.h; sourceTree = "<group>"; };
+               02CD157309F543FE00ABE650 /* ElftosbAST.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ElftosbAST.h; sourceTree = "<group>"; };
+               02CD157409F543FE00ABE650 /* ElftosbAST.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ElftosbAST.cpp; sourceTree = "<group>"; };
+               02CD158809F557D300ABE650 /* ElftosbLexer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ElftosbLexer.cpp; sourceTree = "<group>"; };
+               02D1FCA70BD02B69007C7450 /* SearchPath.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SearchPath.h; sourceTree = "<group>"; };
+               02D1FCA80BD02B69007C7450 /* SearchPath.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SearchPath.cpp; sourceTree = "<group>"; };
+               02D46C100FED492400E65706 /* elftosb_lexer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = elftosb_lexer.cpp; path = build/elftosb.build/Debug/elftosb.build/DerivedSources/elftosb_lexer.cpp; sourceTree = SOURCE_ROOT; };
+               02D46C110FED492400E65706 /* elftosb_parser.tab.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = elftosb_parser.tab.cpp; path = build/elftosb.build/Debug/elftosb.build/DerivedSources/elftosb_parser.tab.cpp; sourceTree = SOURCE_ROOT; };
+               02D46C120FED492400E65706 /* elftosb_parser.tab.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = elftosb_parser.tab.hpp; path = build/elftosb.build/Debug/elftosb.build/DerivedSources/elftosb_parser.tab.hpp; sourceTree = SOURCE_ROOT; };
+               02DC603C0A7AAA7A0027E7F9 /* index.html */ = {isa = PBXFileReference; explicitFileType = text.html.documentation; fileEncoding = 4; name = index.html; path = elftosb2/html/index.html; sourceTree = "<group>"; };
+               02E25EA50A1A5DB0001161B5 /* keygen */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = keygen; sourceTree = BUILT_PRODUCTS_DIR; };
+               02E25EA90A1A5DCB001161B5 /* keygen.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = keygen.cpp; sourceTree = "<group>"; };
+               02E3997909F2E0410055992A /* elftosb_lexer.l */ = {isa = PBXFileReference; explicitFileType = sourcecode.lex; fileEncoding = 4; path = elftosb_lexer.l; sourceTree = "<group>"; };
+               02E3998909F2ED990055992A /* FlexLexer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FlexLexer.h; sourceTree = "<group>"; };
+               02E3998D09F2EFAA0055992A /* rijndael.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = rijndael.cpp; sourceTree = "<group>"; };
+               02E3998E09F2EFAA0055992A /* rijndael.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = rijndael.h; sourceTree = "<group>"; };
+               02E535B30C245AEC00CBD4A5 /* DataSourceImager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DataSourceImager.h; sourceTree = "<group>"; };
+               02E535B40C245AEC00CBD4A5 /* DataSourceImager.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DataSourceImager.cpp; sourceTree = "<group>"; };
+               02E9D5B009FA8AE4006D7279 /* smart_ptr.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = smart_ptr.h; sourceTree = "<group>"; };
+               02E9D67309FBFE97006D7279 /* EvalContext.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EvalContext.h; sourceTree = "<group>"; };
+               02E9D67409FBFE98006D7279 /* EvalContext.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = EvalContext.cpp; sourceTree = "<group>"; };
+               02F8D41B09FE86FA004CBE69 /* EncoreBootImage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EncoreBootImage.h; sourceTree = "<group>"; };
+               02F8D41C09FE86FA004CBE69 /* EncoreBootImage.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = EncoreBootImage.cpp; sourceTree = "<group>"; };
+               02F8D46509FEA584004CBE69 /* AESKey.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AESKey.h; sourceTree = "<group>"; };
+               02F8D4EF09FEE91B004CBE69 /* crc.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = crc.cpp; sourceTree = "<group>"; };
+               02F8D4F009FEE91B004CBE69 /* crc.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = crc.h; sourceTree = "<group>"; };
+               02F8D5490A014F5D004CBE69 /* Value.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Value.h; sourceTree = "<group>"; };
+               02F8D54A0A014F5D004CBE69 /* Value.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Value.cpp; sourceTree = "<group>"; };
+               02F8D5600A0152AB004CBE69 /* SourceFile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SourceFile.h; sourceTree = "<group>"; };
+               02F8D5610A0152AB004CBE69 /* SourceFile.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SourceFile.cpp; sourceTree = "<group>"; };
+               02FE65030BFE669B004A1450 /* basic_test_cmd.e */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = basic_test_cmd.e; sourceTree = "<group>"; };
+               02FE65040BFE669B004A1450 /* complex.bd */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = complex.bd; sourceTree = "<group>"; };
+               02FE65050BFE669B004A1450 /* simple.e */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = simple.e; sourceTree = "<group>"; };
+               02FE65060BFE669B004A1450 /* test_cmd.e */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = test_cmd.e; sourceTree = "<group>"; };
+               02FE65860C0522B0004A1450 /* todo.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = todo.txt; path = elftosb2/todo.txt; sourceTree = "<group>"; };
+               8DD76F6C0486A84900D96B5E /* elftosb */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = elftosb; sourceTree = BUILT_PRODUCTS_DIR; };
+               C6859E8B029090EE04C91782 /* elftosb.1 */ = {isa = PBXFileReference; lastKnownFileType = text.man; path = elftosb.1; sourceTree = "<group>"; };
+/* End PBXFileReference section */
+
+/* Begin PBXFrameworksBuildPhase section */
+               020D46790A16657C0027E24E /* Frameworks */ = {
+                       isa = PBXFrameworksBuildPhase;
+                       buildActionMask = 2147483647;
+                       files = (
+                       );
+                       runOnlyForDeploymentPostprocessing = 0;
+               };
+               02E25EA30A1A5DB0001161B5 /* Frameworks */ = {
+                       isa = PBXFrameworksBuildPhase;
+                       buildActionMask = 2147483647;
+                       files = (
+                       );
+                       runOnlyForDeploymentPostprocessing = 0;
+               };
+               8DD76F660486A84900D96B5E /* Frameworks */ = {
+                       isa = PBXFrameworksBuildPhase;
+                       buildActionMask = 2147483647;
+                       files = (
+                       );
+                       runOnlyForDeploymentPostprocessing = 0;
+               };
+/* End PBXFrameworksBuildPhase section */
+
+/* Begin PBXGroup section */
+               020D46810A1665A20027E24E /* sbtool */ = {
+                       isa = PBXGroup;
+                       children = (
+                               020D46830A1665D90027E24E /* sbtool.cpp */,
+                               020D47A00A16C1E00027E24E /* EncoreBootImageReader.h */,
+                               020D47A10A16C1E00027E24E /* EncoreBootImageReader.cpp */,
+                       );
+                       path = sbtool;
+                       sourceTree = "<group>";
+               };
+               020D47700A1691F10027E24E /* common */ = {
+                       isa = PBXGroup;
+                       children = (
+                               0208C08B0A05677000255D31 /* AESKey.cpp */,
+                               02F8D46509FEA584004CBE69 /* AESKey.h */,
+                               02123F300A6B057E003CF33F /* Blob.cpp */,
+                               02123F2F0A6B057E003CF33F /* Blob.h */,
+                               020D41AE0A0FFB040027E24E /* BootImage.h */,
+                               02F8D4EF09FEE91B004CBE69 /* crc.cpp */,
+                               02F8D4F009FEE91B004CBE69 /* crc.h */,
+                               0208C2880A0A4E5F00255D31 /* DataSource.cpp */,
+                               0208C2890A0A4E5F00255D31 /* DataSource.h */,
+                               02E535B40C245AEC00CBD4A5 /* DataSourceImager.cpp */,
+                               02E535B30C245AEC00CBD4A5 /* DataSourceImager.h */,
+                               0208C28C0A0A4E5F00255D31 /* DataTarget.cpp */,
+                               0208C28D0A0A4E5F00255D31 /* DataTarget.h */,
+                               0296A48709D9AE9400F80AFF /* ELF.h */,
+                               024F1D610A0BCD8300D21D61 /* ELFSourceFile.cpp */,
+                               024F1D600A0BCD8300D21D61 /* ELFSourceFile.h */,
+                               02F8D41C09FE86FA004CBE69 /* EncoreBootImage.cpp */,
+                               02F8D41B09FE86FA004CBE69 /* EncoreBootImage.h */,
+                               02C5DC000A93AC85003B9C11 /* EndianUtilities.h */,
+                               02E9D67409FBFE98006D7279 /* EvalContext.cpp */,
+                               02E9D67309FBFE97006D7279 /* EvalContext.h */,
+                               021CA3F10A8D16960028326F /* ExcludesListMatcher.cpp */,
+                               021CA3F00A8D16960028326F /* ExcludesListMatcher.h */,
+                               02C5DB920A925C61003B9C11 /* format_string.cpp */,
+                               02C5DB910A925C61003B9C11 /* format_string.h */,
+                               020D45050A1523350027E24E /* GHSSecInfo.cpp */,
+                               020D45040A1523350027E24E /* GHSSecInfo.h */,
+                               027402E40A0FB00000CF4BE7 /* GlobMatcher.cpp */,
+                               027402E30A0FB00000CF4BE7 /* GlobMatcher.h */,
+                               02123F380A6B09CF003CF33F /* HexValues.cpp */,
+                               02123F370A6B09CF003CF33F /* HexValues.h */,
+                               0208C2E00A0AA4F700255D31 /* int_size.h */,
+                               020D43A60A14D7E20027E24E /* Logging.cpp */,
+                               020D43A50A14D7E20027E24E /* Logging.h */,
+                               0208C28A0A0A4E5F00255D31 /* Operation.cpp */,
+                               0208C28B0A0A4E5F00255D31 /* Operation.h */,
+                               020D454F0A1533550027E24E /* OptionContext.h */,
+                               020DDBEB0A1D08AD00E1CB49 /* OptionDictionary.cpp */,
+                               020DDBEA0A1D08AD00E1CB49 /* OptionDictionary.h */,
+                               0208C03D0A0544BA00255D31 /* options.cpp */,
+                               0208C03E0A0544BA00255D31 /* options.h */,
+                               020D41860A0FF0C20027E24E /* OutputSection.cpp */,
+                               020D41850A0FF0C20027E24E /* OutputSection.h */,
+                               0208BF4B0A03137800255D31 /* Random.cpp */,
+                               0208BF4A0A03137800255D31 /* Random.h */,
+                               02E3998D09F2EFAA0055992A /* rijndael.cpp */,
+                               02E3998E09F2EFAA0055992A /* rijndael.h */,
+                               0208BF8A0A03E04800255D31 /* RijndaelCBCMAC.cpp */,
+                               0208BF890A03E04800255D31 /* RijndaelCBCMAC.h */,
+                               02D1FCA80BD02B69007C7450 /* SearchPath.cpp */,
+                               02D1FCA70BD02B69007C7450 /* SearchPath.h */,
+                               0208BEB10A02D2B800255D31 /* SHA1.cpp */,
+                               0208BEB20A02D2B800255D31 /* SHA1.h */,
+                               02E9D5B009FA8AE4006D7279 /* smart_ptr.h */,
+                               02F8D5610A0152AB004CBE69 /* SourceFile.cpp */,
+                               02F8D5600A0152AB004CBE69 /* SourceFile.h */,
+                               024F1D5D0A0BCD7200D21D61 /* SRecordSourceFile.cpp */,
+                               024F1D5C0A0BCD7200D21D61 /* SRecordSourceFile.h */,
+                               0296A49E09D9AE9400F80AFF /* stdafx.cpp */,
+                               0296CF9C09DB3C5200F80AFF /* stdafx.h */,
+                               0296A49F09D9AE9400F80AFF /* StELFFile.cpp */,
+                               0296A4A009D9AE9400F80AFF /* StELFFile.h */,
+                               0296A4A409D9AE9400F80AFF /* StExecutableImage.cpp */,
+                               0296A4A509D9AE9400F80AFF /* StExecutableImage.h */,
+                               020D416A0A0FE8AC0027E24E /* StringMatcher.h */,
+                               0296A4AA09D9AE9400F80AFF /* StSRecordFile.cpp */,
+                               0296A4AB09D9AE9400F80AFF /* StSRecordFile.h */,
+                               02F8D54A0A014F5D004CBE69 /* Value.cpp */,
+                               02F8D5490A014F5D004CBE69 /* Value.h */,
+                               020D41A40A0FF8880027E24E /* Version.cpp */,
+                               020D41A30A0FF8880027E24E /* Version.h */,
+                               022B4655121763A100A74F96 /* IVTDataSource.h */,
+                               022B4656121763A100A74F96 /* IVTDataSource.cpp */,
+                       );
+                       path = common;
+                       sourceTree = "<group>";
+               };
+               0296A45909D9AE9400F80AFF /* elftosb2 */ = {
+                       isa = PBXGroup;
+                       children = (
+                               02D46C140FED492C00E65706 /* Derived Sources */,
+                               020D41980A0FF5BF0027E24E /* BootImageGenerator.cpp */,
+                               020D41970A0FF5BF0027E24E /* BootImageGenerator.h */,
+                               0208C2990A0A4EE800255D31 /* ConversionController.cpp */,
+                               0208C29A0A0A4EE800255D31 /* ConversionController.h */,
+                               02B9D5000B9A16C10084CE1F /* crypto.cpp */,
+                               02B9D5010B9A16C10084CE1F /* crypto.h */,
+                               02B9D56A0B9B37890084CE1F /* default_rom_key.cpp */,
+                               02B9D56B0B9B37890084CE1F /* default_rom_key.h */,
+                               0296A49309D9AE9400F80AFF /* elftosb.cpp */,
+                               0296A49409D9AE9400F80AFF /* elftosb.h */,
+                               02E3997909F2E0410055992A /* elftosb_lexer.l */,
+                               0215B3D209F424D800EA7C45 /* elftosb_parser.y */,
+                               02CD157409F543FE00ABE650 /* ElftosbAST.cpp */,
+                               02CD157309F543FE00ABE650 /* ElftosbAST.h */,
+                               024F1E190A0D20C900D21D61 /* ElftosbErrors.h */,
+                               02CD158809F557D300ABE650 /* ElftosbLexer.cpp */,
+                               0215B3BA09F3FBF100EA7C45 /* ElftosbLexer.h */,
+                               020D41B80A0FFD140027E24E /* EncoreBootImageGenerator.cpp */,
+                               020D41B70A0FFD140027E24E /* EncoreBootImageGenerator.h */,
+                               02E3998909F2ED990055992A /* FlexLexer.h */,
+                               02B9D4FC0B9A13AE0084CE1F /* SB36xxBootImageGenerator.cpp */,
+                               02B9D4FB0B9A13AE0084CE1F /* SB36xxBootImageGenerator.h */,
+                               02B9D5020B9A16C10084CE1F /* St3600IPL.cpp */,
+                               02B9D5030B9A16C10084CE1F /* St3600IPL.h */,
+                               02B9D5040B9A16C10084CE1F /* StEncrypter.h */,
+                               02B9D5050B9A16C10084CE1F /* StKeySet.cpp */,
+                               02B9D5060B9A16C10084CE1F /* StKeySet.h */,
+                               02B9D5070B9A16C10084CE1F /* StLFSREncrypter.cpp */,
+                               02B9D5080B9A16C10084CE1F /* StLFSREncrypter.h */,
+                               02B9D5090B9A16C10084CE1F /* table.c */,
+                       );
+                       path = elftosb2;
+                       sourceTree = "<group>";
+               };
+               0296A48809D9AE9400F80AFF /* test_files */ = {
+                       isa = PBXGroup;
+                       children = (
+                               0296A48909D9AE9400F80AFF /* hello_NOR_arm */,
+                               0296A48A09D9AE9400F80AFF /* hello_NOR_arm.map */,
+                               0296A48B09D9AE9400F80AFF /* hello_NOR_mixed */,
+                               0296A48C09D9AE9400F80AFF /* hello_NOR_mixed.map */,
+                               0296A48D09D9AE9400F80AFF /* hello_NOR_thumb */,
+                               0296A48E09D9AE9400F80AFF /* hello_NOR_thumb.map */,
+                               0296A48F09D9AE9400F80AFF /* hostlink */,
+                               0296A49009D9AE9400F80AFF /* redboot_gcc.srec */,
+                               0296A49109D9AE9400F80AFF /* sd_player_gcc */,
+                               0296A49209D9AE9400F80AFF /* sd_player_gcc.srec */,
+                       );
+                       path = test_files;
+                       sourceTree = "<group>";
+               };
+               02D46C140FED492C00E65706 /* Derived Sources */ = {
+                       isa = PBXGroup;
+                       children = (
+                               02D46C100FED492400E65706 /* elftosb_lexer.cpp */,
+                               02D46C110FED492400E65706 /* elftosb_parser.tab.cpp */,
+                               02D46C120FED492400E65706 /* elftosb_parser.tab.hpp */,
+                       );
+                       name = "Derived Sources";
+                       sourceTree = "<group>";
+               };
+               02E25EA70A1A5DCB001161B5 /* keygen */ = {
+                       isa = PBXGroup;
+                       children = (
+                               02E25EA90A1A5DCB001161B5 /* keygen.cpp */,
+                       );
+                       path = keygen;
+                       sourceTree = "<group>";
+               };
+               02FE65020BFE669B004A1450 /* bdfiles */ = {
+                       isa = PBXGroup;
+                       children = (
+                               02FE65030BFE669B004A1450 /* basic_test_cmd.e */,
+                               02FE65040BFE669B004A1450 /* complex.bd */,
+                               02FE65050BFE669B004A1450 /* simple.e */,
+                               02FE65060BFE669B004A1450 /* test_cmd.e */,
+                       );
+                       path = bdfiles;
+                       sourceTree = "<group>";
+               };
+               08FB7794FE84155DC02AAC07 /* elftosb */ = {
+                       isa = PBXGroup;
+                       children = (
+                               02FE65860C0522B0004A1450 /* todo.txt */,
+                               02FE65020BFE669B004A1450 /* bdfiles */,
+                               08FB7795FE84155DC02AAC07 /* Source */,
+                               C6859E8C029090F304C91782 /* Documentation */,
+                               1AB674ADFE9D54B511CA2CBB /* Products */,
+                       );
+                       name = elftosb;
+                       sourceTree = "<group>";
+               };
+               08FB7795FE84155DC02AAC07 /* Source */ = {
+                       isa = PBXGroup;
+                       children = (
+                               0296A48809D9AE9400F80AFF /* test_files */,
+                               02E25EA70A1A5DCB001161B5 /* keygen */,
+                               020D46810A1665A20027E24E /* sbtool */,
+                               0296A45909D9AE9400F80AFF /* elftosb2 */,
+                               020D47700A1691F10027E24E /* common */,
+                       );
+                       name = Source;
+                       sourceTree = "<group>";
+               };
+               1AB674ADFE9D54B511CA2CBB /* Products */ = {
+                       isa = PBXGroup;
+                       children = (
+                               8DD76F6C0486A84900D96B5E /* elftosb */,
+                               020D467B0A16657C0027E24E /* sbtool */,
+                               02E25EA50A1A5DB0001161B5 /* keygen */,
+                       );
+                       name = Products;
+                       sourceTree = "<group>";
+               };
+               C6859E8C029090F304C91782 /* Documentation */ = {
+                       isa = PBXGroup;
+                       children = (
+                               02DC603C0A7AAA7A0027E7F9 /* index.html */,
+                               C6859E8B029090EE04C91782 /* elftosb.1 */,
+                       );
+                       name = Documentation;
+                       sourceTree = "<group>";
+               };
+/* End PBXGroup section */
+
+/* Begin PBXNativeTarget section */
+               020D467A0A16657C0027E24E /* sbtool */ = {
+                       isa = PBXNativeTarget;
+                       buildConfigurationList = 020D467E0A1665890027E24E /* Build configuration list for PBXNativeTarget "sbtool" */;
+                       buildPhases = (
+                               020D46780A16657C0027E24E /* Sources */,
+                               020D46790A16657C0027E24E /* Frameworks */,
+                       );
+                       buildRules = (
+                       );
+                       dependencies = (
+                       );
+                       name = sbtool;
+                       productName = sbtool;
+                       productReference = 020D467B0A16657C0027E24E /* sbtool */;
+                       productType = "com.apple.product-type.tool";
+               };
+               02E25EA40A1A5DB0001161B5 /* keygen */ = {
+                       isa = PBXNativeTarget;
+                       buildConfigurationList = 02E25EAB0A1A5DCB001161B5 /* Build configuration list for PBXNativeTarget "keygen" */;
+                       buildPhases = (
+                               02E25EA20A1A5DB0001161B5 /* Sources */,
+                               02E25EA30A1A5DB0001161B5 /* Frameworks */,
+                       );
+                       buildRules = (
+                       );
+                       dependencies = (
+                       );
+                       name = keygen;
+                       productName = keygen;
+                       productReference = 02E25EA50A1A5DB0001161B5 /* keygen */;
+                       productType = "com.apple.product-type.tool";
+               };
+               8DD76F620486A84900D96B5E /* elftosb */ = {
+                       isa = PBXNativeTarget;
+                       buildConfigurationList = 1DEB923108733DC60010E9CD /* Build configuration list for PBXNativeTarget "elftosb" */;
+                       buildPhases = (
+                               8DD76F640486A84900D96B5E /* Sources */,
+                               8DD76F660486A84900D96B5E /* Frameworks */,
+                       );
+                       buildRules = (
+                               0215B3D609F4255D00EA7C45 /* PBXBuildRule */,
+                               0215B3D509F4254100EA7C45 /* PBXBuildRule */,
+                               0296CF9309DB3B8700F80AFF /* PBXBuildRule */,
+                       );
+                       dependencies = (
+                       );
+                       name = elftosb;
+                       productInstallPath = "$(HOME)/bin";
+                       productName = elftosb;
+                       productReference = 8DD76F6C0486A84900D96B5E /* elftosb */;
+                       productType = "com.apple.product-type.tool";
+               };
+/* End PBXNativeTarget section */
+
+/* Begin PBXProject section */
+               08FB7793FE84155DC02AAC07 /* Project object */ = {
+                       isa = PBXProject;
+                       buildConfigurationList = 1DEB923508733DC60010E9CD /* Build configuration list for PBXProject "elftosb" */;
+                       compatibilityVersion = "Xcode 3.1";
+                       hasScannedForEncodings = 1;
+                       mainGroup = 08FB7794FE84155DC02AAC07 /* elftosb */;
+                       projectDirPath = "";
+                       projectRoot = "";
+                       targets = (
+                               8DD76F620486A84900D96B5E /* elftosb */,
+                               020D467A0A16657C0027E24E /* sbtool */,
+                               02E25EA40A1A5DB0001161B5 /* keygen */,
+                               020DDCE80A1E858600E1CB49 /* Everything */,
+                       );
+               };
+/* End PBXProject section */
+
+/* Begin PBXSourcesBuildPhase section */
+               020D46780A16657C0027E24E /* Sources */ = {
+                       isa = PBXSourcesBuildPhase;
+                       buildActionMask = 2147483647;
+                       files = (
+                               020D46840A1665D90027E24E /* sbtool.cpp in Sources */,
+                               020D46870A1668440027E24E /* AESKey.cpp in Sources */,
+                               020D46880A16684D0027E24E /* crc.cpp in Sources */,
+                               020D46890A16684E0027E24E /* DataSource.cpp in Sources */,
+                               020D468A0A16684F0027E24E /* DataTarget.cpp in Sources */,
+                               020D468B0A1668510027E24E /* ELFSourceFile.cpp in Sources */,
+                               020D468C0A1668580027E24E /* EncoreBootImage.cpp in Sources */,
+                               020D468D0A16685B0027E24E /* EvalContext.cpp in Sources */,
+                               020D468E0A16685D0027E24E /* GHSSecInfo.cpp in Sources */,
+                               020D468F0A16685F0027E24E /* GlobMatcher.cpp in Sources */,
+                               020D46900A1668600027E24E /* Logging.cpp in Sources */,
+                               020D46910A1668630027E24E /* Operation.cpp in Sources */,
+                               020D46920A1668650027E24E /* options.cpp in Sources */,
+                               020D46930A1668680027E24E /* OutputSection.cpp in Sources */,
+                               020D46940A1668690027E24E /* Random.cpp in Sources */,
+                               020D46950A16686A0027E24E /* rijndael.cpp in Sources */,
+                               020D46960A16686B0027E24E /* RijndaelCBCMAC.cpp in Sources */,
+                               020D46970A16686D0027E24E /* SHA1.cpp in Sources */,
+                               020D46980A16686F0027E24E /* SourceFile.cpp in Sources */,
+                               020D46990A1668710027E24E /* SRecordSourceFile.cpp in Sources */,
+                               020D469A0A1668730027E24E /* stdafx.cpp in Sources */,
+                               020D469B0A1668760027E24E /* StELFFile.cpp in Sources */,
+                               020D469C0A1668770027E24E /* StExecutableImage.cpp in Sources */,
+                               020D469D0A1668780027E24E /* StSRecordFile.cpp in Sources */,
+                               020D469E0A16687A0027E24E /* Value.cpp in Sources */,
+                               020D469F0A16687A0027E24E /* Version.cpp in Sources */,
+                               020D47A20A16C1E00027E24E /* EncoreBootImageReader.cpp in Sources */,
+                               021240010A6C3AA9003CF33F /* Blob.cpp in Sources */,
+                               021240020A6C3AAA003CF33F /* HexValues.cpp in Sources */,
+                               02C5DB950A925C61003B9C11 /* format_string.cpp in Sources */,
+                               02D1FCF70BD039A0007C7450 /* SearchPath.cpp in Sources */,
+                       );
+                       runOnlyForDeploymentPostprocessing = 0;
+               };
+               02E25EA20A1A5DB0001161B5 /* Sources */ = {
+                       isa = PBXSourcesBuildPhase;
+                       buildActionMask = 2147483647;
+                       files = (
+                               02E25EAA0A1A5DCB001161B5 /* keygen.cpp in Sources */,
+                               02E25EAE0A1A5DF4001161B5 /* AESKey.cpp in Sources */,
+                               02E25EAF0A1A5E09001161B5 /* Random.cpp in Sources */,
+                               02E25EB00A1A5E0C001161B5 /* Logging.cpp in Sources */,
+                               02E25EB10A1A5E18001161B5 /* stdafx.cpp in Sources */,
+                               02E25EB20A1A5E1C001161B5 /* options.cpp in Sources */,
+                               02C5DB960A925C61003B9C11 /* format_string.cpp in Sources */,
+                               025881010CEE47A900681C7E /* HexValues.cpp in Sources */,
+                       );
+                       runOnlyForDeploymentPostprocessing = 0;
+               };
+               8DD76F640486A84900D96B5E /* Sources */ = {
+                       isa = PBXSourcesBuildPhase;
+                       buildActionMask = 2147483647;
+                       files = (
+                               0215B3D309F424D800EA7C45 /* elftosb_parser.y in Sources */,
+                               0215B3E909F4277100EA7C45 /* elftosb_lexer.l in Sources */,
+                               0296A4E709D9AE9400F80AFF /* elftosb.cpp in Sources */,
+                               0296A4F209D9AE9400F80AFF /* stdafx.cpp in Sources */,
+                               0296A4F309D9AE9400F80AFF /* StELFFile.cpp in Sources */,
+                               0296A4F809D9AE9400F80AFF /* StExecutableImage.cpp in Sources */,
+                               0296A4FE09D9AE9400F80AFF /* StSRecordFile.cpp in Sources */,
+                               02E3998F09F2EFAA0055992A /* rijndael.cpp in Sources */,
+                               02CD157609F543FE00ABE650 /* ElftosbAST.cpp in Sources */,
+                               02CD158909F557D300ABE650 /* ElftosbLexer.cpp in Sources */,
+                               02E9D67609FBFE98006D7279 /* EvalContext.cpp in Sources */,
+                               02F8D41E09FE86FB004CBE69 /* EncoreBootImage.cpp in Sources */,
+                               02F8D4F109FEE91B004CBE69 /* crc.cpp in Sources */,
+                               02F8D54C0A014F5D004CBE69 /* Value.cpp in Sources */,
+                               02F8D5630A0152AB004CBE69 /* SourceFile.cpp in Sources */,
+                               0208BEB30A02D2B800255D31 /* SHA1.cpp in Sources */,
+                               0208BF4D0A03137800255D31 /* Random.cpp in Sources */,
+                               0208BF8C0A03E04800255D31 /* RijndaelCBCMAC.cpp in Sources */,
+                               0208C03F0A0544BA00255D31 /* options.cpp in Sources */,
+                               0208C08C0A05677000255D31 /* AESKey.cpp in Sources */,
+                               0208C28E0A0A4E5F00255D31 /* DataSource.cpp in Sources */,
+                               0208C2900A0A4E5F00255D31 /* Operation.cpp in Sources */,
+                               0208C2920A0A4E5F00255D31 /* DataTarget.cpp in Sources */,
+                               0208C29B0A0A4EE800255D31 /* ConversionController.cpp in Sources */,
+                               024F1D5F0A0BCD7200D21D61 /* SRecordSourceFile.cpp in Sources */,
+                               024F1D630A0BCD8300D21D61 /* ELFSourceFile.cpp in Sources */,
+                               027402E60A0FB00000CF4BE7 /* GlobMatcher.cpp in Sources */,
+                               020D41880A0FF0C20027E24E /* OutputSection.cpp in Sources */,
+                               020D419A0A0FF5BF0027E24E /* BootImageGenerator.cpp in Sources */,
+                               020D41A60A0FF8880027E24E /* Version.cpp in Sources */,
+                               020D41BA0A0FFD140027E24E /* EncoreBootImageGenerator.cpp in Sources */,
+                               020D43A80A14D7E20027E24E /* Logging.cpp in Sources */,
+                               020D45070A1523350027E24E /* GHSSecInfo.cpp in Sources */,
+                               020DDBED0A1D08AD00E1CB49 /* OptionDictionary.cpp in Sources */,
+                               02123F320A6B057E003CF33F /* Blob.cpp in Sources */,
+                               02123F3A0A6B09CF003CF33F /* HexValues.cpp in Sources */,
+                               021CA3F30A8D16960028326F /* ExcludesListMatcher.cpp in Sources */,
+                               02C5DB940A925C61003B9C11 /* format_string.cpp in Sources */,
+                               02B9D4FD0B9A13AE0084CE1F /* SB36xxBootImageGenerator.cpp in Sources */,
+                               02B9D50A0B9A16C10084CE1F /* crypto.cpp in Sources */,
+                               02B9D50B0B9A16C10084CE1F /* St3600IPL.cpp in Sources */,
+                               02B9D50C0B9A16C10084CE1F /* StKeySet.cpp in Sources */,
+                               02B9D50D0B9A16C10084CE1F /* StLFSREncrypter.cpp in Sources */,
+                               02B9D50E0B9A16C10084CE1F /* table.c in Sources */,
+                               02B9D56C0B9B37890084CE1F /* default_rom_key.cpp in Sources */,
+                               02D1FCA90BD02B69007C7450 /* SearchPath.cpp in Sources */,
+                               02E535B50C245AEC00CBD4A5 /* DataSourceImager.cpp in Sources */,
+                               022B4657121763A100A74F96 /* IVTDataSource.cpp in Sources */,
+                       );
+                       runOnlyForDeploymentPostprocessing = 0;
+               };
+/* End PBXSourcesBuildPhase section */
+
+/* Begin PBXTargetDependency section */
+               020DDCEA0A1E858D00E1CB49 /* PBXTargetDependency */ = {
+                       isa = PBXTargetDependency;
+                       target = 8DD76F620486A84900D96B5E /* elftosb */;
+                       targetProxy = 020DDCE90A1E858D00E1CB49 /* PBXContainerItemProxy */;
+               };
+               020DDCEC0A1E858D00E1CB49 /* PBXTargetDependency */ = {
+                       isa = PBXTargetDependency;
+                       target = 020D467A0A16657C0027E24E /* sbtool */;
+                       targetProxy = 020DDCEB0A1E858D00E1CB49 /* PBXContainerItemProxy */;
+               };
+               020DDCEE0A1E858D00E1CB49 /* PBXTargetDependency */ = {
+                       isa = PBXTargetDependency;
+                       target = 02E25EA40A1A5DB0001161B5 /* keygen */;
+                       targetProxy = 020DDCED0A1E858D00E1CB49 /* PBXContainerItemProxy */;
+               };
+/* End PBXTargetDependency section */
+
+/* Begin XCBuildConfiguration section */
+               020D467F0A1665890027E24E /* Debug */ = {
+                       isa = XCBuildConfiguration;
+                       buildSettings = {
+                               COPY_PHASE_STRIP = NO;
+                               GCC_DYNAMIC_NO_PIC = NO;
+                               GCC_ENABLE_FIX_AND_CONTINUE = YES;
+                               GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
+                               GCC_MODEL_TUNING = G5;
+                               GCC_OPTIMIZATION_LEVEL = 0;
+                               INSTALL_PATH = "$(HOME)/bin";
+                               PREBINDING = NO;
+                               PRODUCT_NAME = sbtool;
+                               ZERO_LINK = NO;
+                       };
+                       name = Debug;
+               };
+               020D46800A1665890027E24E /* Release */ = {
+                       isa = XCBuildConfiguration;
+                       buildSettings = {
+                               COPY_PHASE_STRIP = YES;
+                               GCC_ENABLE_FIX_AND_CONTINUE = NO;
+                               GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
+                               GCC_MODEL_TUNING = G5;
+                               INSTALL_PATH = "$(HOME)/bin";
+                               PREBINDING = NO;
+                               PRODUCT_NAME = sbtool;
+                               ZERO_LINK = NO;
+                       };
+                       name = Release;
+               };
+               020DDCF10A1E85BA00E1CB49 /* Debug */ = {
+                       isa = XCBuildConfiguration;
+                       buildSettings = {
+                               COPY_PHASE_STRIP = NO;
+                               GCC_DYNAMIC_NO_PIC = NO;
+                               GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
+                               GCC_OPTIMIZATION_LEVEL = 0;
+                               PRODUCT_NAME = Everything;
+                       };
+                       name = Debug;
+               };
+               020DDCF20A1E85BA00E1CB49 /* Release */ = {
+                       isa = XCBuildConfiguration;
+                       buildSettings = {
+                               COPY_PHASE_STRIP = YES;
+                               GCC_ENABLE_FIX_AND_CONTINUE = NO;
+                               GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
+                               PRODUCT_NAME = Everything;
+                               ZERO_LINK = NO;
+                       };
+                       name = Release;
+               };
+               02E25EAC0A1A5DCB001161B5 /* Debug */ = {
+                       isa = XCBuildConfiguration;
+                       buildSettings = {
+                               COPY_PHASE_STRIP = NO;
+                               GCC_DYNAMIC_NO_PIC = NO;
+                               GCC_ENABLE_FIX_AND_CONTINUE = YES;
+                               GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
+                               GCC_MODEL_TUNING = G5;
+                               GCC_OPTIMIZATION_LEVEL = 0;
+                               INSTALL_PATH = "$(HOME)/bin";
+                               PREBINDING = NO;
+                               PRODUCT_NAME = keygen;
+                               ZERO_LINK = YES;
+                       };
+                       name = Debug;
+               };
+               02E25EAD0A1A5DCB001161B5 /* Release */ = {
+                       isa = XCBuildConfiguration;
+                       buildSettings = {
+                               COPY_PHASE_STRIP = YES;
+                               GCC_ENABLE_FIX_AND_CONTINUE = NO;
+                               GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
+                               GCC_MODEL_TUNING = G5;
+                               INSTALL_PATH = "$(HOME)/bin";
+                               PREBINDING = NO;
+                               PRODUCT_NAME = keygen;
+                               ZERO_LINK = NO;
+                       };
+                       name = Release;
+               };
+               1DEB923208733DC60010E9CD /* Debug */ = {
+                       isa = XCBuildConfiguration;
+                       buildSettings = {
+                               COPY_PHASE_STRIP = NO;
+                               DEBUG_INFORMATION_FORMAT = dwarf;
+                               GCC_DYNAMIC_NO_PIC = NO;
+                               GCC_ENABLE_FIX_AND_CONTINUE = YES;
+                               GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
+                               GCC_MODEL_TUNING = G5;
+                               GCC_OPTIMIZATION_LEVEL = 0;
+                               GCC_PREPROCESSOR_DEFINITIONS = (
+                                       SHA1_NO_UTILITY_FUNCTIONS,
+                                       "$(GCC_PREPROCESSOR_DEFINITIONS)",
+                               );
+                               INSTALL_PATH = "$(HOME)/bin";
+                               PRODUCT_NAME = elftosb;
+                               ZERO_LINK = NO;
+                       };
+                       name = Debug;
+               };
+               1DEB923308733DC60010E9CD /* Release */ = {
+                       isa = XCBuildConfiguration;
+                       buildSettings = {
+                               ARCHS = (
+                                       ppc,
+                                       i386,
+                               );
+                               DEBUG_INFORMATION_FORMAT = dwarf;
+                               GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
+                               GCC_MODEL_TUNING = G5;
+                               GCC_PREPROCESSOR_DEFINITIONS = (
+                                       SHA1_NO_UTILITY_FUNCTIONS,
+                                       "$(GCC_PREPROCESSOR_DEFINITIONS)",
+                               );
+                               INSTALL_PATH = "$(HOME)/bin";
+                               PRODUCT_NAME = elftosb;
+                               ZERO_LINK = NO;
+                       };
+                       name = Release;
+               };
+               1DEB923608733DC60010E9CD /* Debug */ = {
+                       isa = XCBuildConfiguration;
+                       buildSettings = {
+                               GCC_WARN_ABOUT_RETURN_TYPE = YES;
+                               GCC_WARN_UNUSED_VARIABLE = YES;
+                               PREBINDING = NO;
+                               SDKROOT = macosx10.5;
+                       };
+                       name = Debug;
+               };
+               1DEB923708733DC60010E9CD /* Release */ = {
+                       isa = XCBuildConfiguration;
+                       buildSettings = {
+                               GCC_WARN_ABOUT_RETURN_TYPE = YES;
+                               GCC_WARN_UNUSED_VARIABLE = YES;
+                               PREBINDING = NO;
+                               SDKROOT = macosx10.5;
+                       };
+                       name = Release;
+               };
+/* End XCBuildConfiguration section */
+
+/* Begin XCConfigurationList section */
+               020D467E0A1665890027E24E /* Build configuration list for PBXNativeTarget "sbtool" */ = {
+                       isa = XCConfigurationList;
+                       buildConfigurations = (
+                               020D467F0A1665890027E24E /* Debug */,
+                               020D46800A1665890027E24E /* Release */,
+                       );
+                       defaultConfigurationIsVisible = 0;
+                       defaultConfigurationName = Release;
+               };
+               020DDCF00A1E85BA00E1CB49 /* Build configuration list for PBXAggregateTarget "Everything" */ = {
+                       isa = XCConfigurationList;
+                       buildConfigurations = (
+                               020DDCF10A1E85BA00E1CB49 /* Debug */,
+                               020DDCF20A1E85BA00E1CB49 /* Release */,
+                       );
+                       defaultConfigurationIsVisible = 0;
+                       defaultConfigurationName = Release;
+               };
+               02E25EAB0A1A5DCB001161B5 /* Build configuration list for PBXNativeTarget "keygen" */ = {
+                       isa = XCConfigurationList;
+                       buildConfigurations = (
+                               02E25EAC0A1A5DCB001161B5 /* Debug */,
+                               02E25EAD0A1A5DCB001161B5 /* Release */,
+                       );
+                       defaultConfigurationIsVisible = 0;
+                       defaultConfigurationName = Release;
+               };
+               1DEB923108733DC60010E9CD /* Build configuration list for PBXNativeTarget "elftosb" */ = {
+                       isa = XCConfigurationList;
+                       buildConfigurations = (
+                               1DEB923208733DC60010E9CD /* Debug */,
+                               1DEB923308733DC60010E9CD /* Release */,
+                       );
+                       defaultConfigurationIsVisible = 0;
+                       defaultConfigurationName = Release;
+               };
+               1DEB923508733DC60010E9CD /* Build configuration list for PBXProject "elftosb" */ = {
+                       isa = XCConfigurationList;
+                       buildConfigurations = (
+                               1DEB923608733DC60010E9CD /* Debug */,
+                               1DEB923708733DC60010E9CD /* Release */,
+                       );
+                       defaultConfigurationIsVisible = 0;
+                       defaultConfigurationName = Release;
+               };
+/* End XCConfigurationList section */
+       };
+       rootObject = 08FB7793FE84155DC02AAC07 /* Project object */;
+}
diff --git a/tools/elftosb/elftosb2/BootImageGenerator.cpp b/tools/elftosb/elftosb2/BootImageGenerator.cpp
new file mode 100644 (file)
index 0000000..63daf26
--- /dev/null
@@ -0,0 +1,80 @@
+/*
+ *  BootImageGenerator.cpp
+ *  elftosb
+ *
+ * Copyright (c) Freescale Semiconductor, Inc. All rights reserved.
+ * See included license file for license details.
+ */
+
+#include "BootImageGenerator.h"
+#include "Logging.h"
+
+//! Name of product version option.
+#define kProductVersionOption "productVersion"
+
+//! Name of component version option.
+#define kComponentVersionOption "componentVersion"
+
+//! Name of option that specifies the drive tag for this .sb file.
+#define kDriveTagOption "driveTag"
+
+using namespace elftosb;
+
+void BootImageGenerator::processVersionOptions(BootImage * image)
+{
+       // bail if no option context was set
+       if (!m_options)
+       {
+               return;
+       }
+       
+       const StringValue * stringValue;
+       version_t version;
+       
+    // productVersion
+       if (m_options->hasOption(kProductVersionOption))
+       {
+               stringValue = dynamic_cast<const StringValue *>(m_options->getOption(kProductVersionOption));
+               if (stringValue)
+               {
+                       version.set(*stringValue);
+                       image->setProductVersion(version);
+               }
+        else
+        {
+            Log::log(Logger::WARNING, "warning: productVersion option is an unexpected type\n");
+        }
+       }
+       
+    // componentVersion
+       if (m_options->hasOption(kComponentVersionOption))
+       {
+               stringValue = dynamic_cast<const StringValue *>(m_options->getOption(kComponentVersionOption));
+               if (stringValue)
+               {
+                       version.set(*stringValue);
+                       image->setComponentVersion(version);
+               }
+        else
+        {
+            Log::log(Logger::WARNING, "warning: componentVersion option is an unexpected type\n");
+        }
+       }
+}
+
+void BootImageGenerator::processDriveTagOption(BootImage * image)
+{
+       if (m_options->hasOption(kDriveTagOption))
+       {
+               const IntegerValue * intValue = dynamic_cast<const IntegerValue *>(m_options->getOption(kDriveTagOption));
+               if (intValue)
+               {
+                       image->setDriveTag(intValue->getValue());
+               }
+        else
+        {
+            Log::log(Logger::WARNING, "warning: driveTag option is an unexpected type\n");
+        }
+       }
+}
+
diff --git a/tools/elftosb/elftosb2/BootImageGenerator.h b/tools/elftosb/elftosb2/BootImageGenerator.h
new file mode 100644 (file)
index 0000000..3d50fbb
--- /dev/null
@@ -0,0 +1,69 @@
+/*
+ * File:       BootImageGenerator.h
+ *
+ * Copyright (c) Freescale Semiconductor, Inc. All rights reserved.
+ * See included license file for license details.
+ */
+#if !defined(_BootImageGenerator_h_)
+#define _BootImageGenerator_h_
+
+#include "OutputSection.h"
+#include "BootImage.h"
+#include "OptionContext.h"
+
+namespace elftosb
+{
+
+/*!
+ * \brief Abstract base class for generators of specific boot image formats.
+ *
+ * Subclasses implement a concrete generator for a certain boot image format, but
+ * they all have the same interface.
+ *
+ * After creating an instance of a subclass the user adds OutputSection objects
+ * to the generator. These objects describe discrete sections within the resulting
+ * boot image file. If the format does not support multiple sections then only
+ * the first will be used.
+ *
+ * Options that are common to all boot image formats are handled by methods
+ * defined in this class. These are the current common options:
+ *     - productVersion
+ *     - componentVersion
+ *     - driveTag
+ */
+class BootImageGenerator
+{
+public:
+       //! \brief Constructor.
+       BootImageGenerator() {}
+       
+       //! \brief Destructor.
+       virtual ~BootImageGenerator() {}
+       
+       //! \brief Add another section to the output.
+       void addOutputSection(OutputSection * section) { m_sections.push_back(section); }
+       
+       //! \brief Set the global option context.
+       void setOptionContext(OptionContext * context) { m_options = context; }
+       
+       //! \brief Pure virtual method to generate the output BootImage from input sections.
+       virtual BootImage * generate()=0;
+       
+protected:
+       //! Type for a list of model output sections.
+       typedef std::vector<OutputSection*> section_vector_t;
+       
+       section_vector_t m_sections;    //!< Requested output sections.
+       OptionContext * m_options;      //!< Global option context.
+    
+    //! \brief Handle common product and component version options.
+    void processVersionOptions(BootImage * image);
+       
+       //! \brief Handle the common option which sets the system drive tag.
+       void processDriveTagOption(BootImage * image);
+};
+
+}; // namespace elftosb
+
+#endif // _BootImageGenerator_h_
+
diff --git a/tools/elftosb/elftosb2/ConversionController.cpp b/tools/elftosb/elftosb2/ConversionController.cpp
new file mode 100644 (file)
index 0000000..dd3341c
--- /dev/null
@@ -0,0 +1,1428 @@
+/*
+ * File:       ConversionController.cpp
+ *
+ * Copyright (c) Freescale Semiconductor, Inc. All rights reserved.
+ * See included license file for license details.
+ */
+
+#include "ConversionController.h"
+#include <stdexcept>
+#include "EvalContext.h"
+#include "ElftosbErrors.h"
+#include "GlobMatcher.h"
+#include "ExcludesListMatcher.h"
+#include "BootImageGenerator.h"
+#include "EncoreBootImageGenerator.h"
+#include "Logging.h"
+#include "OptionDictionary.h"
+#include "format_string.h"
+#include "SearchPath.h"
+#include "DataSourceImager.h"
+#include "IVTDataSource.h"
+#include <algorithm>
+
+//! Set to 1 to cause the ConversionController to print information about
+//! the values that it processes (options, constants, etc.).
+#define PRINT_VALUES 1
+
+using namespace elftosb;
+
+// Define the parser function prototype;
+extern int yyparse(ElftosbLexer * lexer, CommandFileASTNode ** resultAST);
+
+bool elftosb::g_enableHABSupport = false;
+
+ConversionController::ConversionController()
+:      OptionDictionary(),
+       m_commandFilePath(),
+       m_ast(),
+       m_defaultSource(0)
+{
+       m_context.setSourceFileManager(this);
+}
+
+ConversionController::~ConversionController()
+{
+       // clean up sources
+       source_map_t::iterator it = m_sources.begin();
+       for (; it != m_sources.end(); ++it)
+       {
+               if (it->second)
+               {
+                       delete it->second;
+               }
+       }
+}
+
+void ConversionController::setCommandFilePath(const std::string & path)
+{
+       m_commandFilePath = new std::string(path);
+}
+
+//! The paths provided to this method are added to an array and accessed with the
+//! "extern(N)" notation in the command file. So the path provided in the third
+//! call to addExternalFilePath() will be found with N=2 in the source definition.
+void ConversionController::addExternalFilePath(const std::string & path)
+{
+       m_externPaths.push_back(path);
+}
+
+bool ConversionController::hasSourceFile(const std::string & name)
+{
+       return m_sources.find(name) != m_sources.end();
+}
+
+SourceFile * ConversionController::getSourceFile(const std::string & name)
+{
+       if (!hasSourceFile(name))
+       {
+               return NULL;
+       }
+       
+       return m_sources[name];
+}
+
+SourceFile * ConversionController::getDefaultSourceFile()
+{
+       return m_defaultSource;
+}
+
+//! These steps are executed while running this method:
+//!            - The command file is parsed into an abstract syntax tree.
+//!            - The list of options is extracted.
+//!            - Constant expressions are evaluated.
+//!            - The list of source files is extracted and source file objects created.
+//!            - Section definitions are extracted.
+//!
+//! This method does not produce any output. It processes the input files and
+//! builds a representation of the output in memory. Use the generateOutput() method
+//! to produce a BootImage object after this method returns.
+//!
+//! \note This method is \e not reentrant. And in fact, the whole class is not designed
+//!            to be reentrant.
+//!
+//! \exception std::runtime_error Any number of problems will cause this exception to
+//!            be thrown.
+//!
+//! \see parseCommandFile()
+//! \see processOptions()
+//! \see processConstants()
+//! \see processSources()
+//! \see processSections()
+void ConversionController::run()
+{
+#if PRINT_VALUES
+       Log::SetOutputLevel debugLevel(Logger::DEBUG2);
+#endif
+
+       parseCommandFile();
+       assert(m_ast);
+       
+       ListASTNode * blocks = m_ast->getBlocks();
+       if (!blocks)
+       {
+               throw std::runtime_error("command file has no blocks");
+       }
+       
+       ListASTNode::iterator it = blocks->begin();
+       for (; it != blocks->end(); ++it)
+       {
+               ASTNode * node = *it;
+               
+               // Handle an options block.
+               OptionsBlockASTNode * options = dynamic_cast<OptionsBlockASTNode *>(node);
+               if (options)
+               {
+                       processOptions(options->getOptions());
+                       continue;
+               }
+               
+               // Handle a constants block.
+               ConstantsBlockASTNode * constants = dynamic_cast<ConstantsBlockASTNode *>(node);
+               if (constants)
+               {
+                       processConstants(constants->getConstants());
+                       continue;
+               }
+               
+               // Handle a sources block.
+               SourcesBlockASTNode * sources = dynamic_cast<SourcesBlockASTNode *>(node);
+               if (sources)
+               {
+                       processSources(sources->getSources());
+               }
+       }
+       
+       processSections(m_ast->getSections());
+}
+
+//! Opens the command file and runs it through the lexer and parser. The resulting
+//! abstract syntax tree is held in the m_ast member variable. After parsing, the
+//! command file is closed.
+//!
+//! \exception std::runtime_error Several problems will cause this exception to be
+//!            raised, including an unspecified command file path or an error opening the
+//!            file.
+void ConversionController::parseCommandFile()
+{
+       if (!m_commandFilePath)
+       {
+               throw std::runtime_error("no command file path was provided");
+       }
+       
+       // Search for command file
+       std::string actualPath;
+       bool found = PathSearcher::getGlobalSearcher().search(*m_commandFilePath, PathSearcher::kFindFile, true, actualPath);
+       if (!found)
+       {
+               throw runtime_error(format_string("unable to find command file %s\n", m_commandFilePath->c_str()));
+       }
+
+       // open command file
+       std::ifstream commandFile(actualPath.c_str(), ios_base::in | ios_base::binary);
+       if (!commandFile.is_open())
+       {
+               throw std::runtime_error("could not open command file");
+       }
+       
+       try
+       {
+               // create lexer instance
+               ElftosbLexer lexer(commandFile);
+//             testLexer(lexer);
+               
+               CommandFileASTNode * ast = NULL;
+               int result = yyparse(&lexer, &ast);
+               m_ast = ast;
+               
+               // check results
+               if (result || !m_ast)
+               {
+                       throw std::runtime_error("failed to parse command file");
+               }
+               
+               // dump AST
+//             m_ast->printTree(0);
+               
+               // close command file
+               commandFile.close();
+       }
+       catch (...)
+       {
+               // close command file
+               commandFile.close();
+               
+               // rethrow exception
+               throw;
+       }
+}
+
+//! Iterates over the option definition AST nodes. elftosb::Value objects are created for
+//! each option value and added to the option dictionary.
+//!
+//! \exception std::runtime_error Various errors will cause this exception to be thrown. These
+//!            include AST nodes being an unexpected type or expression not evaluating to integers.
+void ConversionController::processOptions(ListASTNode * options)
+{
+       if (!options)
+       {
+               return;
+       }
+       
+       ListASTNode::iterator it = options->begin();
+       for (; it != options->end(); ++it)
+       {
+               std::string ident;
+               Value * value = convertAssignmentNodeToValue(*it, ident);
+               
+               // check if this option has already been set
+               if (hasOption(ident))
+               {
+                       throw semantic_error(format_string("line %d: option already set", (*it)->getFirstLine()));
+               }
+               
+               // now save the option value in our map
+               if (value)
+               {
+                       setOption(ident, value);
+               }
+       }
+}
+
+//! Scans the constant definition AST nodes, evaluates expression nodes by calling their
+//! elftosb::ExprASTNode::reduce() method, and updates the evaluation context member so
+//! those constant values can be used in other expressions.
+//!
+//! \exception std::runtime_error Various errors will cause this exception to be thrown. These
+//!            include AST nodes being an unexpected type or expression not evaluating to integers.
+void ConversionController::processConstants(ListASTNode * constants)
+{
+       if (!constants)
+       {
+               return;
+       }
+       
+       ListASTNode::iterator it = constants->begin();
+       for (; it != constants->end(); ++it)
+       {
+               std::string ident;
+               Value * value = convertAssignmentNodeToValue(*it, ident);
+               
+               SizedIntegerValue * intValue = dynamic_cast<SizedIntegerValue*>(value);
+               if (!intValue)
+               {
+                       throw semantic_error(format_string("line %d: constant value is an invalid type", (*it)->getFirstLine()));
+               }
+                               
+//#if PRINT_VALUES
+//             Log::log("constant ");
+//             printIntConstExpr(ident, intValue);
+//#endif
+               
+               // record this constant's value in the evaluation context
+               m_context.setVariable(ident, intValue->getValue(), intValue->getWordSize());
+       }
+}
+
+//! \exception std::runtime_error Various errors will cause this exception to be thrown. These
+//!            include AST nodes being an unexpected type or expression not evaluating to integers.
+//!
+//! \todo Handle freeing of dict if an exception occurs.
+void ConversionController::processSources(ListASTNode * sources)
+{
+       if (!sources)
+       {
+               return;
+       }
+       
+       ListASTNode::iterator it = sources->begin();
+       for (; it != sources->end(); ++it)
+       {
+               SourceDefASTNode * node = dynamic_cast<SourceDefASTNode*>(*it);
+               if (!node)
+               {
+                       throw semantic_error(format_string("line %d: source definition node is an unexpected type", node->getFirstLine()));
+               }
+               
+               // get source name and check if it has already been defined
+               std::string * name = node->getName();
+               if (m_sources.find(*name) != m_sources.end())
+               {
+                       // can't define a source multiple times
+                       throw semantic_error(format_string("line %d: source already defined", node->getFirstLine()));
+               }
+               
+               // convert attributes into an option dict
+               OptionDictionary * dict = new OptionDictionary(this);
+               ListASTNode * attrsNode = node->getAttributes();
+               if (attrsNode)
+               {
+                       ListASTNode::iterator attrIt = attrsNode->begin();
+                       for (; attrIt != attrsNode->end(); ++attrIt)
+                       {
+                               std::string ident;
+                               Value * value = convertAssignmentNodeToValue(*attrIt, ident);
+                               dict->setOption(ident, value);
+                       }
+               }
+               
+               // figure out which type of source definition this is
+               PathSourceDefASTNode * pathNode = dynamic_cast<PathSourceDefASTNode*>(node);
+               ExternSourceDefASTNode * externNode = dynamic_cast<ExternSourceDefASTNode*>(node);
+               SourceFile * file = NULL;
+               
+               if (pathNode)
+               {
+                       // explicit path
+                       std::string * path = pathNode->getPath();
+                       
+#if PRINT_VALUES
+                       Log::log("source %s => path(%s)\n", name->c_str(), path->c_str());
+#endif
+                       
+                       try
+                       {
+                               file = SourceFile::openFile(*path);
+                       }
+                       catch (...)
+                       {
+                               // file doesn't exist
+                               Log::log(Logger::INFO2, "failed to open source file: %s (ignoring for now)\n", path->c_str());
+                               m_failedSources.push_back(*name);
+                       }
+               }
+               else if (externNode)
+               {
+                       // externally provided path
+                       ExprASTNode * expr = externNode->getSourceNumberExpr()->reduce(m_context);
+                       IntConstExprASTNode * intConst = dynamic_cast<IntConstExprASTNode*>(expr);
+                       if (!intConst)
+                       {
+                               throw semantic_error(format_string("line %d: expression didn't evaluate to an integer", expr->getFirstLine()));
+                       }
+                       
+                       uint32_t externalFileNumber = static_cast<uint32_t>(intConst->getValue());
+                       
+                       // make sure the extern number is valid
+                       if (externalFileNumber >= 0 && externalFileNumber < m_externPaths.size())
+                       {
+                       
+#if PRINT_VALUES
+                       Log::log("source %s => extern(%d=%s)\n", name->c_str(), externalFileNumber, m_externPaths[externalFileNumber].c_str());
+#endif
+                       
+                               try
+                               {
+                                       file = SourceFile::openFile(m_externPaths[externalFileNumber]);
+                               }
+                               catch (...)
+                               {
+                                       Log::log(Logger::INFO2, "failed to open source file: %s (ignoring for now)\n", m_externPaths[externalFileNumber].c_str());
+                                       m_failedSources.push_back(*name);
+                               }
+                       }
+               }
+               else
+               {
+                       throw semantic_error(format_string("line %d: unexpected source definition node type", node->getFirstLine()));
+               }
+               
+               if (file)
+               {
+                       // set options
+                       file->setOptions(dict);
+                       
+                       // stick the file object in the source map
+                       m_sources[*name] = file;
+               }
+       }
+}
+
+void ConversionController::processSections(ListASTNode * sections)
+{
+       if (!sections)
+       {
+               Log::log(Logger::WARNING, "warning: no sections were defined in command file");
+               return;
+       }
+       
+       ListASTNode::iterator it = sections->begin();
+       for (; it != sections->end(); ++it)
+       {
+               SectionContentsASTNode * node = dynamic_cast<SectionContentsASTNode*>(*it);
+               if (!node)
+               {
+                       throw semantic_error(format_string("line %d: section definition is unexpected type", node->getFirstLine()));
+               }
+               
+               // evaluate section number
+               ExprASTNode * idExpr = node->getSectionNumberExpr()->reduce(m_context);
+               IntConstExprASTNode * idConst = dynamic_cast<IntConstExprASTNode*>(idExpr);
+               if (!idConst)
+               {
+                       throw semantic_error(format_string("line %d: section number did not evaluate to an integer", idExpr->getFirstLine()));
+               }
+               uint32_t sectionID = idConst->getValue();
+               
+               // Create options context for this section. The options context has the
+               // conversion controller as its parent context so it will inherit global options.
+               // The context will be set in the section after the section is created below.
+               OptionDictionary * optionsDict = new OptionDictionary(this);
+               ListASTNode * attrsNode = node->getOptions();
+               if (attrsNode)
+               {
+                       ListASTNode::iterator attrIt = attrsNode->begin();
+                       for (; attrIt != attrsNode->end(); ++attrIt)
+                       {
+                               std::string ident;
+                               Value * value = convertAssignmentNodeToValue(*attrIt, ident);
+                               optionsDict->setOption(ident, value);
+                       }
+               }
+               
+               // Now create the actual section object based on its type.
+               OutputSection * outputSection = NULL;
+               BootableSectionContentsASTNode * bootableSection;
+               DataSectionContentsASTNode * dataSection;
+               if (bootableSection = dynamic_cast<BootableSectionContentsASTNode*>(node))
+               {               
+                       // process statements into a sequence of operations
+                       ListASTNode * statements = bootableSection->getStatements();
+                       OperationSequence * sequence = convertStatementList(statements);
+
+#if 0
+                       Log::log("section ID = %d\n", sectionID);
+                       statements->printTree(0);
+                       
+                       Log::log("sequence has %d operations\n", sequence->getCount());
+                       OperationSequence::iterator_t it = sequence->begin();
+                       for (; it != sequence->end(); ++it)
+                       {
+                               Operation * op = *it;
+                               Log::log("op = %p\n", op);
+                       }
+#endif
+                       
+                       // create the output section and add it to the list
+                       OperationSequenceSection * opSection = new OperationSequenceSection(sectionID);
+                       opSection->setOptions(optionsDict);
+                       opSection->getSequence() += sequence;
+                       outputSection = opSection;
+               }
+               else if (dataSection = dynamic_cast<DataSectionContentsASTNode*>(node))
+               {
+                       outputSection = convertDataSection(dataSection, sectionID, optionsDict);
+               }
+               else
+               {
+                       throw semantic_error(format_string("line %d: unexpected section contents type", node->getFirstLine()));
+               }
+               
+               if (outputSection)
+               {
+                       m_outputSections.push_back(outputSection);
+               }
+       }
+}
+
+//! Creates an instance of BinaryDataSection from the AST node passed in the
+//! \a dataSection parameter. The section-specific options for this node will
+//! have already been converted into an OptionDictionary, the one passed in
+//! the \a optionsDict parameter.
+//!
+//! The \a dataSection node will have as its contents one of the AST node
+//! classes that represents a source of data. The member function
+//! createSourceFromNode() is used to convert this AST node into an
+//! instance of a DataSource subclass. Then the method imageDataSource()
+//! converts the segments of the DataSource into a raw binary buffer that
+//! becomes the contents of the BinaryDataSection this is returned.
+//!
+//! \param dataSection The AST node for the data section.
+//! \param sectionID Unique tag value the user has assigned to this section.
+//! \param optionsDict Options that apply only to this section. This dictionary
+//!            will be assigned as the options dictionary for the resulting section
+//!            object. Its parent is the conversion controller itself.
+//! \return An instance of BinaryDataSection. Its contents are a contiguous
+//!            binary representation of the contents of \a dataSection.
+OutputSection * ConversionController::convertDataSection(DataSectionContentsASTNode * dataSection, uint32_t sectionID, OptionDictionary * optionsDict)
+{
+       // Create a data source from the section contents AST node.
+       ASTNode * contents = dataSection->getContents();
+       DataSource * dataSource = createSourceFromNode(contents);
+       
+       // Convert the data source to a raw buffer.
+       DataSourceImager imager;
+       imager.addDataSource(dataSource);
+       
+       // Then make a data section from the buffer.
+       BinaryDataSection * resultSection = new BinaryDataSection(sectionID);
+       resultSection->setOptions(optionsDict);
+       if (imager.getLength())
+       {
+               resultSection->setData(imager.getData(), imager.getLength());
+       }
+       
+       return resultSection;
+}
+
+//! @param node The AST node instance for the assignment expression.
+//! @param[out] ident Upon exit this string will be set the the left hand side of the
+//!            assignment expression, the identifier name.
+//!
+//! @return An object that is a subclass of Value is returned. The specific subclass will
+//!            depend on the type of the right hand side of the assignment expression whose AST
+//!            node was provided in the @a node argument.
+//!
+//! @exception semantic_error Thrown for any error where an AST node is an unexpected type.
+//!            This may be the @a node argument itself, if it is not an AssignmentASTNode. Or it
+//!            may be an unexpected type for either the right or left hand side of the assignment.
+//!            The message for the exception will contain a description of the error.
+Value * ConversionController::convertAssignmentNodeToValue(ASTNode * node, std::string & ident)
+{
+       Value * resultValue = NULL;
+       
+       // each item of the options list should be an assignment node
+       AssignmentASTNode * assignmentNode = dynamic_cast<AssignmentASTNode*>(node);
+       if (!node)
+       {
+               throw semantic_error(format_string("line %d: node is wrong type", assignmentNode->getFirstLine()));
+       }
+       
+       // save the left hand side (the identifier) into ident
+       ident = *assignmentNode->getIdent();
+       
+       // get the right hand side and convert it to a Value instance
+       ASTNode * valueNode = assignmentNode->getValue();
+       StringConstASTNode * str;
+       ExprASTNode * expr;
+       if (str = dynamic_cast<StringConstASTNode*>(valueNode))
+       {
+               // the option value is a string constant
+               resultValue = new StringValue(str->getString());
+
+//#if PRINT_VALUES
+//             Log::log("option %s => \'%s\'\n", ident->c_str(), str->getString()->c_str());
+//#endif
+       }
+       else if (expr = dynamic_cast<ExprASTNode*>(valueNode))
+       {
+               ExprASTNode * reducedExpr = expr->reduce(m_context);
+               IntConstExprASTNode * intConst = dynamic_cast<IntConstExprASTNode*>(reducedExpr);
+               if (!intConst)
+               {
+                       throw semantic_error(format_string("line %d: expression didn't evaluate to an integer", expr->getFirstLine()));
+               }
+               
+//#if PRINT_VALUES
+//             Log::log("option ");
+//             printIntConstExpr(*ident, intConst);
+//#endif
+               
+               resultValue = new SizedIntegerValue(intConst->getValue(), intConst->getSize());
+       }
+       else
+       {
+               throw semantic_error(format_string("line %d: right hand side node is an unexpected type", valueNode->getFirstLine()));
+       }
+       
+       return resultValue;
+}
+
+//! Builds up a sequence of Operation objects that are equivalent to the
+//! statements in the \a statements list. The statement list is simply iterated
+//! over and the results of convertOneStatement() are used to build up
+//! the final result sequence.
+//!
+//! \see convertOneStatement()
+OperationSequence * ConversionController::convertStatementList(ListASTNode * statements)
+{
+       OperationSequence * resultSequence = new OperationSequence();
+       ListASTNode::iterator it = statements->begin();
+       for (; it != statements->end(); ++it)
+       {
+               StatementASTNode * statement = dynamic_cast<StatementASTNode*>(*it);
+               if (!statement)
+               {
+                       throw semantic_error(format_string("line %d: statement node is unexpected type", (*it)->getFirstLine()));
+               }
+               
+               // convert this statement and append it to the result
+               OperationSequence * sequence = convertOneStatement(statement);
+               if (sequence)
+               {
+                       *resultSequence += sequence;
+               }
+       }
+       
+       return resultSequence;
+}
+
+//! Uses C++ RTTI to identify the particular subclass of StatementASTNode that
+//! the \a statement argument matches. Then the appropriate conversion method
+//! is called.
+//!
+//! \see convertLoadStatement()
+//! \see convertCallStatement()
+//! \see convertFromStatement()
+OperationSequence * ConversionController::convertOneStatement(StatementASTNode * statement)
+{
+       // see if it's a load statement
+       LoadStatementASTNode * load = dynamic_cast<LoadStatementASTNode*>(statement);
+       if (load)
+       {
+               return convertLoadStatement(load);
+       }
+       
+       // see if it's a call statement
+       CallStatementASTNode * call = dynamic_cast<CallStatementASTNode*>(statement);
+       if (call)
+       {
+               return convertCallStatement(call);
+       }
+       
+       // see if it's a from statement
+       FromStatementASTNode * from = dynamic_cast<FromStatementASTNode*>(statement);
+       if (from)
+       {
+               return convertFromStatement(from);
+       }
+       
+       // see if it's a mode statement
+       ModeStatementASTNode * mode = dynamic_cast<ModeStatementASTNode*>(statement);
+       if (mode)
+       {
+               return convertModeStatement(mode);
+       }
+       
+       // see if it's an if statement
+       IfStatementASTNode * ifStmt = dynamic_cast<IfStatementASTNode*>(statement);
+       if (ifStmt)
+       {
+               return convertIfStatement(ifStmt);
+       }
+       
+       // see if it's a message statement
+       MessageStatementASTNode * messageStmt = dynamic_cast<MessageStatementASTNode*>(statement);
+       if (messageStmt)
+       {
+               // Message statements don't produce operation sequences.
+               handleMessageStatement(messageStmt);
+               return NULL;
+       }
+       
+       // didn't match any of the expected statement types
+       throw semantic_error(format_string("line %d: unexpected statement type", statement->getFirstLine()));
+       return NULL;
+}
+
+//! Possible load data node types:
+//! - StringConstASTNode
+//! - ExprASTNode
+//! - SourceASTNode
+//! - SectionMatchListASTNode
+//!
+//! Possible load target node types:
+//! - SymbolASTNode
+//! - NaturalLocationASTNode
+//! - AddressRangeASTNode
+OperationSequence * ConversionController::convertLoadStatement(LoadStatementASTNode * statement)
+{
+       LoadOperation * op = NULL;
+       
+       try
+       {
+               // build load operation from source and target
+               op = new LoadOperation();
+               op->setSource(createSourceFromNode(statement->getData()));
+               op->setTarget(createTargetFromNode(statement->getTarget()));
+               op->setDCDLoad(statement->isDCDLoad());
+               
+               return new OperationSequence(op);
+       }
+       catch (...)
+       {
+               if (op)
+               {
+                       delete op;
+               }
+               throw;
+       }
+}
+
+//! Possible call target node types:
+//! - SymbolASTNode
+//! - ExprASTNode
+//!
+//! Possible call argument node types:
+//! - ExprASTNode
+//! - NULL
+OperationSequence * ConversionController::convertCallStatement(CallStatementASTNode * statement)
+{
+       ExecuteOperation * op = NULL;
+       
+       try
+       {
+               // create operation from AST nodes
+               op = new ExecuteOperation();
+               
+               bool isHAB = statement->isHAB();
+               
+               op->setTarget(createTargetFromNode(statement->getTarget()));
+               
+               // set argument value, which defaults to 0 if no expression was provided
+               uint32_t arg = 0;
+               ASTNode * argNode = statement->getArgument();
+               if (argNode)
+               {
+                       ExprASTNode * argExprNode = dynamic_cast<ExprASTNode*>(argNode);
+                       if (!argExprNode)
+                       {
+                               throw semantic_error(format_string("line %d: call argument is unexpected type", argNode->getFirstLine()));
+                       }
+                       argExprNode = argExprNode->reduce(m_context);
+                       IntConstExprASTNode * intNode = dynamic_cast<IntConstExprASTNode*>(argExprNode);
+                       if (!intNode)
+                       {
+                               throw semantic_error(format_string("line %d: call argument did not evaluate to an integer", argExprNode->getFirstLine()));
+                       }
+                       
+                       arg = intNode->getValue();
+               }
+               op->setArgument(arg);
+               
+               // set call type
+               switch (statement->getCallType())
+               {
+                       case CallStatementASTNode::kCallType:
+                               op->setExecuteType(ExecuteOperation::kCall);
+                               break;
+                       case CallStatementASTNode::kJumpType:
+                               op->setExecuteType(ExecuteOperation::kJump);
+                               break;
+               }
+               
+               // Set the HAB mode flag.
+               op->setIsHAB(isHAB);
+               
+               return new OperationSequence(op);
+       }
+       catch (...)
+       {
+               // delete op and rethrow exception
+               if (op)
+               {
+                       delete op;
+               }
+               throw;
+       }
+}
+
+//! First this method sets the default source to the source identified in
+//! the from statement. Then the statements within the from block are
+//! processed recursively by calling convertStatementList(). The resulting
+//! operation sequence is returned.
+OperationSequence * ConversionController::convertFromStatement(FromStatementASTNode * statement)
+{
+       if (m_defaultSource)
+       {
+               throw semantic_error(format_string("line %d: from statements cannot be nested", statement->getFirstLine()));
+       }
+       
+       // look up source file instance
+       std::string * fromSourceName = statement->getSourceName();
+       assert(fromSourceName);
+       
+       // make sure it's a valid source name
+       source_map_t::iterator sourceIt = m_sources.find(*fromSourceName);
+       if (sourceIt == m_sources.end())
+       {
+               throw semantic_error(format_string("line %d: bad source name", statement->getFirstLine()));
+       }
+       
+       // set default source
+       m_defaultSource = sourceIt->second;
+       assert(m_defaultSource);
+       
+       // get statements inside the from block
+       ListASTNode * fromStatements = statement->getStatements();
+       assert(fromStatements);
+       
+       // produce resulting operation sequence
+       OperationSequence * result = convertStatementList(fromStatements);
+       
+       // restore default source to NULL
+       m_defaultSource = NULL;
+       
+       return result;
+}
+
+//! Evaluates the expression to get the new boot mode value. Then creates a
+//! BootModeOperation object and returns an OperationSequence containing it.
+//!
+//! \exception elftosb::semantic_error Thrown if a semantic problem is found with
+//!            the boot mode expression.
+OperationSequence * ConversionController::convertModeStatement(ModeStatementASTNode * statement)
+{
+       BootModeOperation * op = NULL;
+       
+       try
+       {
+               op = new BootModeOperation();
+               
+               // evaluate the boot mode expression
+               ExprASTNode * modeExprNode = statement->getModeExpr();
+               if (!modeExprNode)
+               {
+                       throw semantic_error(format_string("line %d: mode statement has invalid boot mode expression", statement->getFirstLine()));
+               }
+               modeExprNode = modeExprNode->reduce(m_context);
+               IntConstExprASTNode * intNode = dynamic_cast<IntConstExprASTNode*>(modeExprNode);
+               if (!intNode)
+               {
+                       throw semantic_error(format_string("line %d: boot mode did not evaluate to an integer", statement->getFirstLine()));
+               }
+               
+               op->setBootMode(intNode->getValue());
+               
+               return new OperationSequence(op);
+       }
+       catch (...)
+       {
+               if (op)
+               {
+                       delete op;
+               }
+               
+               // rethrow exception
+               throw;
+       }
+}
+
+//! Else branches, including else-if, are handled recursively, so there is a limit
+//! on the number of them based on the stack size.
+//!
+//! \return Returns the operation sequence for the branch of the if statement that
+//!            evaluated to true. If the statement did not have an else branch and the
+//!            condition expression evaluated to false, then NULL will be returned.
+//!
+//! \todo Handle else branches without recursion.
+OperationSequence * ConversionController::convertIfStatement(IfStatementASTNode * statement)
+{
+       // Get the if's conditional expression.
+       ExprASTNode * conditionalExpr = statement->getConditionExpr();
+       if (!conditionalExpr)
+       {
+               throw semantic_error(format_string("line %d: missing or invalid conditional expression", statement->getFirstLine()));
+       }
+       
+       // Reduce the conditional to a single integer.
+       conditionalExpr = conditionalExpr->reduce(m_context);
+       IntConstExprASTNode * intNode = dynamic_cast<IntConstExprASTNode*>(conditionalExpr);
+       if (!intNode)
+       {
+               throw semantic_error(format_string("line %d: if statement conditional expression did not evaluate to an integer", statement->getFirstLine()));
+       }
+       
+       // Decide which statements to further process by the conditional's boolean value.
+       if (intNode->getValue() && statement->getIfStatements())
+       {
+               return convertStatementList(statement->getIfStatements());
+       }
+       else if (statement->getElseStatements())
+       {
+               return convertStatementList(statement->getElseStatements());
+       }
+       else
+       {
+               // No else branch and the conditional was false, so there are no operations to return.
+               return NULL;
+       }
+}
+
+//! Message statements are executed immediately, by this method. They are
+//! not converted into an abstract operation. All messages are passed through
+//! substituteVariables() before being output.
+//!
+//! \param statement The message statement AST node object.
+void ConversionController::handleMessageStatement(MessageStatementASTNode * statement)
+{
+       string * message = statement->getMessage();
+       if (!message)
+       {
+               throw runtime_error("message statement had no message");
+       }
+       
+       smart_ptr<string> finalMessage = substituteVariables(message);
+       
+       switch (statement->getType())
+       {
+               case MessageStatementASTNode::kInfo:
+                       Log::log(Logger::INFO, "%s\n", finalMessage->c_str());
+                       break;
+               
+               case MessageStatementASTNode::kWarning:
+                       Log::log(Logger::WARNING, "warning: %s\n", finalMessage->c_str());
+                       break;
+               
+               case MessageStatementASTNode::kError:
+                       throw runtime_error(*finalMessage);
+                       break;
+       }
+}
+
+//! Performs shell-like variable substitution on the string passed into it.
+//! Both sources and constants can be substituted. Sources will be replaced
+//! with their path and constants with their integer value. The syntax allows
+//! for some simple formatting for constants.
+//!
+//! The syntax is mostly standard. A substitution begins with a dollar-sign
+//! and is followed by the source or constant name in parentheses. For instance,
+//! "$(mysource)" or "$(myconst)". The parentheses are always required.
+//!
+//! Constant names can be prefixed by a single formatting character followed
+//! by a colon. The only formatting characters currently supported are 'd' for
+//! decimal and 'x' for hex. For example, "$(x:myconst)" will be replaced with
+//! the value of the constant named "myconst" formatted as hexadecimal. The
+//! default is decimal, so the 'd' formatting character isn't really ever
+//! needed.
+//!
+//! \param message The string to perform substitution on.
+//! \return Returns a newly allocated std::string object that has all
+//!            substitutions replaced with the associated value. The caller is
+//!            responsible for freeing the string object using the delete operator.
+std::string * ConversionController::substituteVariables(const std::string * message)
+{
+       string * result = new string();
+       int i;
+       int state = 0;
+       string name;
+       
+       for (i=0; i < message->size(); ++i)
+       {
+               char c = (*message)[i];
+               switch (state)
+               {
+                       case 0:
+                               if (c == '$')
+                               {
+                                       state = 1;
+                               }
+                               else
+                               {
+                                       (*result) += c;
+                               }
+                               break;
+                       
+                       case 1:
+                               if (c == '(')
+                               {
+                                       state = 2;
+                               }
+                               else
+                               {
+                                       // Wasn't a variable substitution, so revert to initial state after
+                                       // inserting the original characters.
+                                       (*result) += '$';
+                                       (*result) += c;
+                                       state = 0;
+                               }
+                               break;
+                       
+                       case 2:
+                               if (c == ')')
+                               {
+                                       // Try the name as a source name first.
+                                       if (m_sources.find(name) != m_sources.end())
+                                       {
+                                               (*result) += m_sources[name]->getPath();
+                                       }
+                                       // Otherwise try it as a variable.
+                                       else
+                                       {
+                                               // Select format.
+                                               const char * fmt = "%d";
+                                               if (name[1] == ':' && (name[0] == 'd' || name[0] == 'x'))
+                                               {
+                                                       if (name[0] == 'x')
+                                                       {
+                                                               fmt = "0x%x";
+                                                       }
+                                                       
+                                                       // Delete the format characters.
+                                                       name.erase(0, 2);
+                                               }
+                                               
+                                               // Now insert the formatted variable if it exists.
+                                               if (m_context.isVariableDefined(name))
+                                               {
+                                                       (*result) += format_string(fmt, m_context.getVariableValue(name));
+                                               }
+                                       }
+                                       
+                                       // Switch back to initial state and clear name.
+                                       state = 0;
+                                       name.clear();
+                               }
+                               else
+                               {
+                                       // Just keep building up the variable name.
+                                       name += c;
+                               }
+                               break;
+               }
+       }
+       
+       return result;
+}
+
+//!
+//! \param generator The generator to use.
+BootImage * ConversionController::generateOutput(BootImageGenerator * generator)
+{
+       // set the generator's option context
+       generator->setOptionContext(this);
+       
+       // add output sections to the generator in sequence
+       section_vector_t::iterator it = m_outputSections.begin();
+       for (; it != m_outputSections.end(); ++it)
+       {
+               generator->addOutputSection(*it);
+       }
+       
+       // and produce the output
+       BootImage * image = generator->generate();
+//     Log::log("boot image = %p\n", image);
+       return image;
+}
+
+//! Takes an AST node that is one of the following subclasses and creates the corresponding
+//! type of DataSource object from it.
+//! - StringConstASTNode
+//! - ExprASTNode
+//! - SourceASTNode
+//! - SectionASTNode
+//! - SectionMatchListASTNode
+//! - BlobConstASTNode
+//! - IVTConstASTNode
+//!
+//! \exception elftosb::semantic_error Thrown if a semantic problem is found with
+//!            the data node.
+//! \exception std::runtime_error Thrown if an error occurs that shouldn't be possible
+//!            based on the grammar.
+DataSource * ConversionController::createSourceFromNode(ASTNode * dataNode)
+{
+       assert(dataNode);
+       
+       DataSource * source = NULL;
+       StringConstASTNode * stringNode;
+       BlobConstASTNode * blobNode;
+       ExprASTNode * exprNode;
+       SourceASTNode * sourceNode;
+       SectionASTNode * sectionNode;
+       SectionMatchListASTNode * matchListNode;
+    IVTConstASTNode * ivtNode;
+       
+       if (stringNode = dynamic_cast<StringConstASTNode*>(dataNode))
+       {
+               // create a data source with the string contents
+               std::string * stringData = stringNode->getString();
+               const uint8_t * stringContents = reinterpret_cast<const uint8_t *>(stringData->c_str());
+               source = new UnmappedDataSource(stringContents, static_cast<unsigned>(stringData->size()));
+       }
+       else if (blobNode = dynamic_cast<BlobConstASTNode*>(dataNode))
+       {
+               // create a data source with the raw binary data
+               Blob * blob = blobNode->getBlob();
+               source = new UnmappedDataSource(blob->getData(), blob->getLength());
+       }
+       else if (exprNode = dynamic_cast<ExprASTNode*>(dataNode))
+       {
+               // reduce the expression first
+               exprNode = exprNode->reduce(m_context);
+               IntConstExprASTNode * intNode = dynamic_cast<IntConstExprASTNode*>(exprNode);
+               if (!intNode)
+               {
+                       throw semantic_error("load pattern expression did not evaluate to an integer");
+               }
+               
+               SizedIntegerValue intValue(intNode->getValue(), intNode->getSize());
+               source = new PatternSource(intValue);
+       }
+       else if (sourceNode = dynamic_cast<SourceASTNode*>(dataNode))
+       {
+               // load the entire source contents
+               SourceFile * sourceFile = getSourceFromName(sourceNode->getSourceName(), sourceNode->getFirstLine());
+               source = sourceFile->createDataSource();
+       }
+       else if (sectionNode = dynamic_cast<SectionASTNode*>(dataNode))
+       {
+               // load some subset of the source
+               SourceFile * sourceFile = getSourceFromName(sectionNode->getSourceName(), sectionNode->getFirstLine());
+               if (!sourceFile->supportsNamedSections())
+               {
+                       throw semantic_error(format_string("line %d: source does not support sections", sectionNode->getFirstLine()));
+               }
+               
+               // create data source from the section name
+               std::string * sectionName = sectionNode->getSectionName();
+               GlobMatcher globber(*sectionName);
+               source = sourceFile->createDataSource(globber);
+               if (!source)
+               {
+                       throw semantic_error(format_string("line %d: no sections match the pattern", sectionNode->getFirstLine()));
+               }
+       }
+       else if (matchListNode = dynamic_cast<SectionMatchListASTNode*>(dataNode))
+       {
+               SourceFile * sourceFile = getSourceFromName(matchListNode->getSourceName(), matchListNode->getFirstLine());
+               if (!sourceFile->supportsNamedSections())
+               {
+                       throw semantic_error(format_string("line %d: source type does not support sections", matchListNode->getFirstLine()));
+               }
+               
+               // create string matcher
+               ExcludesListMatcher matcher;
+               
+               // add each pattern to the matcher
+               ListASTNode * matchList = matchListNode->getSections();
+               ListASTNode::iterator it = matchList->begin();
+               for (; it != matchList->end(); ++it)
+               {
+                       ASTNode * node = *it;
+                       sectionNode = dynamic_cast<SectionASTNode*>(node);
+                       if (!sectionNode)
+                       {
+                               throw std::runtime_error(format_string("line %d: unexpected node type in section pattern list", (*it)->getFirstLine()));
+                       }
+                       bool isInclude = sectionNode->getAction() == SectionASTNode::kInclude;
+                       matcher.addPattern(isInclude, *(sectionNode->getSectionName()));
+               }
+               
+               // create data source from the section match list
+               source = sourceFile->createDataSource(matcher);
+               if (!source)
+               {
+                       throw semantic_error(format_string("line %d: no sections match the section pattern list", matchListNode->getFirstLine()));
+               }
+       }
+    else if (ivtNode = dynamic_cast<IVTConstASTNode*>(dataNode))
+    {
+        source = createIVTDataSource(ivtNode);
+    }
+       else
+       {
+               throw semantic_error(format_string("line %d: unexpected load data node type", dataNode->getFirstLine()));
+       }
+       
+       return source;
+}
+
+DataSource * ConversionController::createIVTDataSource(IVTConstASTNode * ivtNode)
+{
+    IVTDataSource * source = new IVTDataSource;
+    
+    // Iterate over the assignment statements in the IVT definition.
+    ListASTNode * fieldList = ivtNode->getFieldAssignments();
+    
+    if (fieldList)
+    {
+        ListASTNode::iterator it = fieldList->begin();
+        for (; it != fieldList->end(); ++it)
+        {
+            AssignmentASTNode * assignmentNode = dynamic_cast<AssignmentASTNode*>(*it);
+            if (!assignmentNode)
+            {
+                throw std::runtime_error(format_string("line %d: unexpected node type in IVT definition", (*it)->getFirstLine()));
+            }
+            
+            // Get the IVT field name.
+            std::string * fieldName = assignmentNode->getIdent();
+            
+            // Reduce the field expression and get the integer result.
+            ASTNode * valueNode = assignmentNode->getValue();
+            ExprASTNode * valueExpr = dynamic_cast<ExprASTNode*>(valueNode);
+            if (!valueExpr)
+            {
+                throw semantic_error("IVT field must have a valid expression");
+            }
+            IntConstExprASTNode * valueIntExpr = dynamic_cast<IntConstExprASTNode*>(valueExpr->reduce(m_context));
+            if (!valueIntExpr)
+            {
+                throw semantic_error(format_string("line %d: IVT field '%s' does not evaluate to an integer", valueNode->getFirstLine(), fieldName->c_str()));
+            }
+            uint32_t value = static_cast<uint32_t>(valueIntExpr->getValue());
+            
+            // Set the field in the IVT data source.
+            if (!source->setFieldByName(*fieldName, value))
+            {
+                throw semantic_error(format_string("line %d: unknown IVT field '%s'", assignmentNode->getFirstLine(), fieldName->c_str()));
+            }
+        }
+    }
+    
+    return source;
+}
+
+//! Takes an AST node subclass and returns an appropriate DataTarget object that contains
+//! the same information. Supported AST node types are:
+//! - SymbolASTNode
+//! - NaturalLocationASTNode
+//! - AddressRangeASTNode
+//!
+//! \exception elftosb::semantic_error Thrown if a semantic problem is found with
+//!            the target node.
+DataTarget * ConversionController::createTargetFromNode(ASTNode * targetNode)
+{
+       assert(targetNode);
+       
+       DataTarget * target = NULL;
+       SymbolASTNode * symbolNode;
+       NaturalLocationASTNode * naturalNode;
+       AddressRangeASTNode * addressNode;
+       
+       if (symbolNode = dynamic_cast<SymbolASTNode*>(targetNode))
+       {
+               SourceFile * sourceFile = getSourceFromName(symbolNode->getSource(), symbolNode->getFirstLine());
+               std::string * symbolName = symbolNode->getSymbolName();
+               
+               // symbol name is optional
+               if (symbolName)
+               {
+                       if (!sourceFile->supportsNamedSymbols())
+                       {
+                               throw std::runtime_error(format_string("line %d: source does not support symbols", symbolNode->getFirstLine()));
+                       }
+                       
+                       target = sourceFile->createDataTargetForSymbol(*symbolName);
+                       if (!target)
+                       {
+                               throw std::runtime_error(format_string("line %d: source does not have a symbol with that name", symbolNode->getFirstLine()));
+                       }
+               }
+               else
+               {
+                       // no symbol name was specified so use entry point
+                       target = sourceFile->createDataTargetForEntryPoint();
+                       if (!target)
+                       {
+                               throw std::runtime_error(format_string("line %d: source does not have an entry point", symbolNode->getFirstLine()));
+                       }
+               }
+       }
+       else if (naturalNode = dynamic_cast<NaturalLocationASTNode*>(targetNode))
+       {
+               // the target is the source's natural location
+               target = new NaturalDataTarget();
+       }
+       else if (addressNode = dynamic_cast<AddressRangeASTNode*>(targetNode))
+       {
+               // evaluate begin address
+               ExprASTNode * beginExpr = dynamic_cast<ExprASTNode*>(addressNode->getBegin());
+               if (!beginExpr)
+               {
+                       throw semantic_error("address range must always have a beginning expression");
+               }
+               IntConstExprASTNode * beginIntExpr = dynamic_cast<IntConstExprASTNode*>(beginExpr->reduce(m_context));
+               if (!beginIntExpr)
+               {
+                       throw semantic_error("address range begin did not evaluate to an integer");
+               }
+               uint32_t beginAddress = static_cast<uint32_t>(beginIntExpr->getValue());
+               
+               // evaluate end address
+               ExprASTNode * endExpr = dynamic_cast<ExprASTNode*>(addressNode->getEnd());
+               uint32_t endAddress = 0;
+               bool hasEndAddress = false;
+               if (endExpr)
+               {
+                       IntConstExprASTNode * endIntExpr = dynamic_cast<IntConstExprASTNode*>(endExpr->reduce(m_context));
+                       if (!endIntExpr)
+                       {
+                               throw semantic_error("address range end did not evaluate to an integer");
+                       }
+                       endAddress = static_cast<uint32_t>(endIntExpr->getValue());
+                       hasEndAddress = true;
+               }
+               
+               // create target
+               if (hasEndAddress)
+               {
+                       target = new ConstantDataTarget(beginAddress, endAddress);
+               }
+               else
+               {
+                       target = new ConstantDataTarget(beginAddress);
+               }
+       }
+       else
+       {
+               throw semantic_error("unexpected load target node type");
+       }
+       
+       return target;
+}
+
+//! \param sourceName Pointer to string containing the name of the source to look up.
+//!            May be NULL, in which case the default source is used.
+//! \param line The line number on which the source name was located.
+//!
+//! \result A source file object that was previously created in the processSources()
+//!            stage.
+//!
+//! \exception std::runtime_error Thrown if the source name is invalid, or if it
+//!            was NULL and there is no default source (i.e., we're not inside a from
+//!            statement).
+SourceFile * ConversionController::getSourceFromName(std::string * sourceName, int line)
+{
+       SourceFile * sourceFile = NULL;
+       if (sourceName)
+       {
+               // look up source in map
+               source_map_t::iterator it = m_sources.find(*sourceName);
+               if (it == m_sources.end())
+               {
+                       source_name_vector_t::const_iterator findIt = std::find<source_name_vector_t::const_iterator, std::string>(m_failedSources.begin(), m_failedSources.end(), *sourceName);
+                       if (findIt != m_failedSources.end())
+                       {
+                               throw semantic_error(format_string("line %d: error opening source '%s'", line, sourceName->c_str()));
+                       }
+                       else
+                       {
+                               throw semantic_error(format_string("line %d: invalid source name '%s'", line, sourceName->c_str()));
+                       }
+               }
+               sourceFile = it->second;
+       }
+       else
+       {
+               // no name provided - use default source
+               sourceFile = m_defaultSource;
+               if (!sourceFile)
+               {
+                       throw semantic_error(format_string("line %d: source required but no default source is available", line));
+               }
+       }
+       
+       // open the file if it hasn't already been
+       if (!sourceFile->isOpen())
+       {
+               sourceFile->open();
+       }
+       return sourceFile;
+}
+
+//! Exercises the lexer by printing out the value of every token produced by the
+//! lexer. It is assumed that the lexer object has already be configured to read
+//! from some input file. The method will return when the lexer has exhausted all
+//! tokens, or an error occurs.
+void ConversionController::testLexer(ElftosbLexer & lexer)
+{
+       // test lexer
+       while (1)
+       {
+               YYSTYPE value;
+               int lexresult = lexer.yylex();
+               if (lexresult == 0)
+                       break;
+               lexer.getSymbolValue(&value);
+               Log::log("%d -> int:%d, ast:%p", lexresult, value.m_int, value.m_str, value.m_ast);
+               if (lexresult == TOK_IDENT || lexresult == TOK_SOURCE_NAME || lexresult == TOK_STRING_LITERAL)
+               {
+                       if (value.m_str)
+                       {
+                               Log::log(", str:%s\n", value.m_str->c_str());
+                       }
+                       else
+                       {
+                               Log::log("str:NULL\n");
+                       }
+               }
+               else
+               {
+                       Log::log("\n");
+               }
+       }
+}
+
+//! Prints out the value of an integer constant expression AST node. Also prints
+//! the name of the identifier associated with that node, as well as the integer
+//! size.
+void ConversionController::printIntConstExpr(const std::string & ident, IntConstExprASTNode * expr)
+{
+       // print constant value
+       char sizeChar;
+       switch (expr->getSize())
+       {
+               case kWordSize:
+                       sizeChar = 'w';
+                       break;
+               case kHalfWordSize:
+                       sizeChar = 'h';
+                       break;
+               case kByteSize:
+                       sizeChar = 'b';
+                       break;
+       }
+       Log::log("%s => %d:%c\n", ident.c_str(), expr->getValue(), sizeChar);
+}
+
diff --git a/tools/elftosb/elftosb2/ConversionController.h b/tools/elftosb/elftosb2/ConversionController.h
new file mode 100644 (file)
index 0000000..16ae247
--- /dev/null
@@ -0,0 +1,153 @@
+/*
+ * File:       ConversionController.h
+ *
+ * Copyright (c) Freescale Semiconductor, Inc. All rights reserved.
+ * See included license file for license details.
+ */
+#if !defined(_ConversionController_h_)
+#define _ConversionController_h_
+
+#include <iostream>
+#include <fstream>
+#include <string>
+#include <stdexcept>
+#include <smart_ptr.h>
+#include <ElftosbLexer.h>
+#include <ElftosbAST.h>
+#include "EvalContext.h"
+#include "Value.h"
+#include "SourceFile.h"
+#include "Operation.h"
+#include "DataSource.h"
+#include "DataTarget.h"
+#include "OutputSection.h"
+#include "BootImage.h"
+#include "OptionDictionary.h"
+#include "BootImageGenerator.h"
+
+namespace elftosb
+{
+
+/*!
+ * \brief Manages the entire elftosb file conversion process.
+ *
+ * Instances of this class are intended to be used only once. There is no
+ * way to reset an instance once it has started or completed a conversion.
+ * Thus the run() method is not reentrant. State information is stored in
+ * the object during the conversion process.
+ *
+ * Two things need to be done before the conversion can be started. The
+ * command file path has to be set with the setCommandFilePath() method,
+ * and the paths of any externally provided (i.e., from the command line)
+ * files need to be added with addExternalFilePath(). Once these tasks
+ * are completed, the run() method can be called to parse and execute the
+ * command file. After run() returns, pass an instance of 
+ * BootImageGenerator to the generateOutput() method in order to get
+ * an instance of BootImage that can be written to the output file.
+ */
+class ConversionController : public OptionDictionary, public EvalContext::SourceFileManager
+{
+public:
+       //! \brief Default constructor.
+       ConversionController();
+       
+       //! \brief Destructor.
+       virtual ~ConversionController();
+       
+       //! \name Paths
+       //@{
+       //! \brief Specify the command file that controls the conversion process.
+       void setCommandFilePath(const std::string & path);
+       
+       //! \brief Specify the path of a file provided by the user from outside the command file.
+       void addExternalFilePath(const std::string & path);
+       //@}
+       
+       //! \name Conversion
+       //@{
+       //! \brief Process input files.
+       void run();
+       
+       //! \brief Uses a BootImageGenerator object to create the final output boot image.
+       BootImage * generateOutput(BootImageGenerator * generator);
+       //@}
+       
+       //! \name SourceFileManager interface
+       //@{
+       //! \brief Returns true if a source file with the name \a name exists.
+       virtual bool hasSourceFile(const std::string & name);
+               
+       //! \brief Gets the requested source file.
+       virtual SourceFile * getSourceFile(const std::string & name);
+       
+       //! \brief Returns the default source file, or NULL if none is set.
+       virtual SourceFile * getDefaultSourceFile();
+       //@}
+       
+       //! \brief Returns a reference to the context used for expression evaluation.
+       inline EvalContext & getEvalContext() { return m_context; }
+
+protected:     
+       //! \name AST processing
+       //@{
+       void parseCommandFile();
+       void processOptions(ListASTNode * options);
+       void processConstants(ListASTNode * constants);
+       void processSources(ListASTNode * sources);
+       void processSections(ListASTNode * sections);
+       OutputSection * convertDataSection(DataSectionContentsASTNode * dataSection, uint32_t sectionID, OptionDictionary * optionsDict);
+       //@}
+       
+       //! \name Statement conversion
+       //@{
+       OperationSequence * convertStatementList(ListASTNode * statements);
+       OperationSequence * convertOneStatement(StatementASTNode * statement);
+       OperationSequence * convertLoadStatement(LoadStatementASTNode * statement);
+       OperationSequence * convertCallStatement(CallStatementASTNode * statement);
+       OperationSequence * convertFromStatement(FromStatementASTNode * statement);
+       OperationSequence * convertModeStatement(ModeStatementASTNode * statement);
+       OperationSequence * convertIfStatement(IfStatementASTNode * statement);
+       void handleMessageStatement(MessageStatementASTNode * statement);
+       //@}
+       
+       //! \name Utilities
+       //@{
+       Value * convertAssignmentNodeToValue(ASTNode * node, std::string & ident);
+       SourceFile * getSourceFromName(std::string * sourceName, int line);
+       DataSource * createSourceFromNode(ASTNode * dataNode);
+       DataTarget * createTargetFromNode(ASTNode * targetNode);
+       std::string * substituteVariables(const std::string * message);
+    DataSource * createIVTDataSource(IVTConstASTNode * ivtNode);
+       //@}
+       
+       //! \name Debugging
+       //@{
+       void testLexer(ElftosbLexer & lexer);
+       void printIntConstExpr(const std::string & ident, IntConstExprASTNode * expr);
+       //@}
+
+protected:
+       typedef std::map<std::string, SourceFile*> source_map_t;        //!< Map from source name to object.
+       typedef std::vector<std::string> path_vector_t; //!< List of file paths.
+       typedef std::vector<OutputSection*> section_vector_t;   //!< List of output sections.
+       typedef std::vector<std::string> source_name_vector_t;  //!< List of source names.
+       
+       smart_ptr<std::string> m_commandFilePath;       //!< Path to command file.
+       smart_ptr<CommandFileASTNode> m_ast;    //!< Root of the abstract syntax tree.
+       EvalContext m_context;  //!< Evaluation context for expressions.
+       source_map_t m_sources; //!< Map of source names to file objects.
+       path_vector_t m_externPaths;    //!< Paths provided on the command line by the user.
+       SourceFile * m_defaultSource;   //!< Source to use when one isn't provided.
+       section_vector_t m_outputSections;      //!< List of output sections the user wants.
+       source_name_vector_t m_failedSources;   //!< List of sources that failed to open successfully.
+};
+
+//! \brief Whether to support HAB keywords during parsing.
+//!
+//! This is a standalone global solely so that the bison-generated parser code can get to it
+//! as simply as possible.
+extern bool g_enableHABSupport;
+
+}; // namespace elftosb
+
+#endif // _ConversionController_h_
diff --git a/tools/elftosb/elftosb2/Doxyfile b/tools/elftosb/elftosb2/Doxyfile
new file mode 100644 (file)
index 0000000..6e7f239
--- /dev/null
@@ -0,0 +1,250 @@
+# Doxyfile 1.3.9
+
+#---------------------------------------------------------------------------
+# Project related configuration options
+#---------------------------------------------------------------------------
+PROJECT_NAME           = elftosb
+PROJECT_NUMBER         = 2.0
+OUTPUT_DIRECTORY       = .
+CREATE_SUBDIRS         = YES
+OUTPUT_LANGUAGE        = English
+USE_WINDOWS_ENCODING   = YES
+BRIEF_MEMBER_DESC      = YES
+REPEAT_BRIEF           = YES
+ABBREVIATE_BRIEF       = "The $name class" \
+                         "The $name widget" \
+                         "The $name file" \
+                         is \
+                         provides \
+                         specifies \
+                         contains \
+                         represents \
+                         a \
+                         an \
+                         the
+ALWAYS_DETAILED_SEC    = NO
+INLINE_INHERITED_MEMB  = NO
+FULL_PATH_NAMES        = NO
+STRIP_FROM_PATH        = "/Users/creed/projects/elftosb/elftosb2" \
+                                                "/Users/creed/projects/sgtl/elftosb/sbtool" \
+                                                "/Users/creed/projects/elftosb/common" \
+                                                "/Users/creed/projects/sgtl/elftosb/common"
+STRIP_FROM_INC_PATH    = 
+SHORT_NAMES            = NO
+JAVADOC_AUTOBRIEF      = NO
+MULTILINE_CPP_IS_BRIEF = NO
+DETAILS_AT_TOP         = YES
+INHERIT_DOCS           = YES
+DISTRIBUTE_GROUP_DOC   = NO
+TAB_SIZE               = 4
+ALIASES                = 
+OPTIMIZE_OUTPUT_FOR_C  = NO
+OPTIMIZE_OUTPUT_JAVA   = NO
+SUBGROUPING            = YES
+#---------------------------------------------------------------------------
+# Build related configuration options
+#---------------------------------------------------------------------------
+EXTRACT_ALL            = YES
+EXTRACT_PRIVATE        = YES
+EXTRACT_STATIC         = YES
+EXTRACT_LOCAL_CLASSES  = YES
+EXTRACT_LOCAL_METHODS  = NO
+HIDE_UNDOC_MEMBERS     = NO
+HIDE_UNDOC_CLASSES     = NO
+HIDE_FRIEND_COMPOUNDS  = NO
+HIDE_IN_BODY_DOCS      = NO
+INTERNAL_DOCS          = NO
+CASE_SENSE_NAMES       = NO
+HIDE_SCOPE_NAMES       = NO
+SHOW_INCLUDE_FILES     = YES
+INLINE_INFO            = YES
+SORT_MEMBER_DOCS       = YES
+SORT_BRIEF_DOCS        = NO
+SORT_BY_SCOPE_NAME     = NO
+GENERATE_TODOLIST      = YES
+GENERATE_TESTLIST      = YES
+GENERATE_BUGLIST       = YES
+GENERATE_DEPRECATEDLIST= YES
+ENABLED_SECTIONS       = 
+MAX_INITIALIZER_LINES  = 30
+SHOW_USED_FILES        = YES
+SHOW_DIRECTORIES       = YES
+#---------------------------------------------------------------------------
+# configuration options related to warning and progress messages
+#---------------------------------------------------------------------------
+QUIET                  = NO
+WARNINGS               = YES
+WARN_IF_UNDOCUMENTED   = YES
+WARN_IF_DOC_ERROR      = YES
+WARN_FORMAT            = "$file:$line: $text"
+WARN_LOGFILE           = 
+#---------------------------------------------------------------------------
+# configuration options related to the input files
+#---------------------------------------------------------------------------
+INPUT                  = . ../common
+FILE_PATTERNS          = *.c \
+                         *.cc \
+                         *.cxx \
+                         *.cpp \
+                         *.c++ \
+                         *.java \
+                         *.ii \
+                         *.ixx \
+                         *.ipp \
+                         *.i++ \
+                         *.inl \
+                         *.h \
+                         *.hh \
+                         *.hxx \
+                         *.hpp \
+                         *.h++ \
+                         *.idl \
+                         *.odl \
+                         *.cs \
+                         *.php \
+                         *.php3 \
+                         *.inc \
+                         *.m \
+                         *.mm
+RECURSIVE              = NO
+EXCLUDE                = 
+EXCLUDE_SYMLINKS       = NO
+EXCLUDE_PATTERNS       = 
+EXAMPLE_PATH           = 
+EXAMPLE_PATTERNS       = *
+EXAMPLE_RECURSIVE      = NO
+IMAGE_PATH             = 
+INPUT_FILTER           = 
+FILTER_PATTERNS        = 
+FILTER_SOURCE_FILES    = NO
+#---------------------------------------------------------------------------
+# configuration options related to source browsing
+#---------------------------------------------------------------------------
+SOURCE_BROWSER         = NO
+INLINE_SOURCES         = NO
+STRIP_CODE_COMMENTS    = YES
+REFERENCED_BY_RELATION = NO
+REFERENCES_RELATION    = NO
+VERBATIM_HEADERS       = NO
+#---------------------------------------------------------------------------
+# configuration options related to the alphabetical class index
+#---------------------------------------------------------------------------
+ALPHABETICAL_INDEX     = NO
+COLS_IN_ALPHA_INDEX    = 5
+IGNORE_PREFIX          = 
+#---------------------------------------------------------------------------
+# configuration options related to the HTML output
+#---------------------------------------------------------------------------
+GENERATE_HTML          = YES
+HTML_OUTPUT            = html
+HTML_FILE_EXTENSION    = .html
+HTML_HEADER            = 
+HTML_FOOTER            = 
+HTML_STYLESHEET        = 
+HTML_ALIGN_MEMBERS     = YES
+GENERATE_HTMLHELP      = NO
+CHM_FILE               = 
+HHC_LOCATION           = 
+GENERATE_CHI           = NO
+BINARY_TOC             = NO
+TOC_EXPAND             = NO
+DISABLE_INDEX          = NO
+ENUM_VALUES_PER_LINE   = 4
+GENERATE_TREEVIEW      = YES
+TREEVIEW_WIDTH         = 250
+#---------------------------------------------------------------------------
+# configuration options related to the LaTeX output
+#---------------------------------------------------------------------------
+GENERATE_LATEX         = NO
+LATEX_OUTPUT           = latex
+LATEX_CMD_NAME         = latex
+MAKEINDEX_CMD_NAME     = makeindex
+COMPACT_LATEX          = NO
+PAPER_TYPE             = a4wide
+EXTRA_PACKAGES         = 
+LATEX_HEADER           = 
+PDF_HYPERLINKS         = NO
+USE_PDFLATEX           = NO
+LATEX_BATCHMODE        = NO
+LATEX_HIDE_INDICES     = NO
+#---------------------------------------------------------------------------
+# configuration options related to the RTF output
+#---------------------------------------------------------------------------
+GENERATE_RTF           = NO
+RTF_OUTPUT             = rtf
+COMPACT_RTF            = NO
+RTF_HYPERLINKS         = NO
+RTF_STYLESHEET_FILE    = 
+RTF_EXTENSIONS_FILE    = 
+#---------------------------------------------------------------------------
+# configuration options related to the man page output
+#---------------------------------------------------------------------------
+GENERATE_MAN           = NO
+MAN_OUTPUT             = man
+MAN_EXTENSION          = .3
+MAN_LINKS              = NO
+#---------------------------------------------------------------------------
+# configuration options related to the XML output
+#---------------------------------------------------------------------------
+GENERATE_XML           = NO
+XML_OUTPUT             = xml
+XML_SCHEMA             = 
+XML_DTD                = 
+XML_PROGRAMLISTING     = YES
+#---------------------------------------------------------------------------
+# configuration options for the AutoGen Definitions output
+#---------------------------------------------------------------------------
+GENERATE_AUTOGEN_DEF   = NO
+#---------------------------------------------------------------------------
+# configuration options related to the Perl module output
+#---------------------------------------------------------------------------
+GENERATE_PERLMOD       = NO
+PERLMOD_LATEX          = NO
+PERLMOD_PRETTY         = YES
+PERLMOD_MAKEVAR_PREFIX = 
+#---------------------------------------------------------------------------
+# Configuration options related to the preprocessor   
+#---------------------------------------------------------------------------
+ENABLE_PREPROCESSING   = YES
+MACRO_EXPANSION        = NO
+EXPAND_ONLY_PREDEF     = NO
+SEARCH_INCLUDES        = YES
+INCLUDE_PATH           = 
+INCLUDE_FILE_PATTERNS  = 
+PREDEFINED             = 
+EXPAND_AS_DEFINED      = 
+SKIP_FUNCTION_MACROS   = YES
+#---------------------------------------------------------------------------
+# Configuration::additions related to external references   
+#---------------------------------------------------------------------------
+TAGFILES               = 
+GENERATE_TAGFILE       = 
+ALLEXTERNALS           = NO
+EXTERNAL_GROUPS        = YES
+PERL_PATH              = /usr/bin/perl
+#---------------------------------------------------------------------------
+# Configuration options related to the dot tool   
+#---------------------------------------------------------------------------
+CLASS_DIAGRAMS         = NO
+HIDE_UNDOC_RELATIONS   = YES
+HAVE_DOT               = NO
+CLASS_GRAPH            = YES
+COLLABORATION_GRAPH    = YES
+UML_LOOK               = NO
+TEMPLATE_RELATIONS     = NO
+INCLUDE_GRAPH          = YES
+INCLUDED_BY_GRAPH      = YES
+CALL_GRAPH             = NO
+GRAPHICAL_HIERARCHY    = YES
+DOT_IMAGE_FORMAT       = png
+DOT_PATH               = 
+DOTFILE_DIRS           = 
+MAX_DOT_GRAPH_WIDTH    = 1024
+MAX_DOT_GRAPH_HEIGHT   = 1024
+MAX_DOT_GRAPH_DEPTH    = 1000
+GENERATE_LEGEND        = YES
+DOT_CLEANUP            = YES
+#---------------------------------------------------------------------------
+# Configuration::additions related to the search engine   
+#---------------------------------------------------------------------------
+SEARCHENGINE           = NO
diff --git a/tools/elftosb/elftosb2/ElftosbAST.cpp b/tools/elftosb/elftosb2/ElftosbAST.cpp
new file mode 100644 (file)
index 0000000..ab7732b
--- /dev/null
@@ -0,0 +1,1352 @@
+/*
+ * File:       ElftosbAST.cpp
+ *
+ * Copyright (c) Freescale Semiconductor, Inc. All rights reserved.
+ * See included license file for license details.
+ */
+
+#include "ElftosbAST.h"
+#include <stdexcept>
+#include <math.h>
+#include <assert.h>
+#include "ElftosbErrors.h"
+#include "format_string.h"
+
+using namespace elftosb;
+
+#pragma mark = ASTNode =
+
+void ASTNode::printTree(int indent) const
+{
+       printIndent(indent);
+       printf("%s\n", nodeName().c_str());
+}
+
+void ASTNode::printIndent(int indent) const
+{
+       int i;
+       for (i=0; i<indent; ++i)
+       {
+               printf("   ");
+       }
+}
+
+void ASTNode::setLocation(token_loc_t & first, token_loc_t & last)
+{
+       m_location.m_firstLine = first.m_firstLine;
+       m_location.m_lastLine = last.m_lastLine;
+}
+
+void ASTNode::setLocation(ASTNode * first, ASTNode * last)
+{
+       m_location.m_firstLine = first->getLocation().m_firstLine;
+       m_location.m_lastLine = last->getLocation().m_lastLine;
+}
+
+#pragma mark = ListASTNode =
+
+ListASTNode::ListASTNode(const ListASTNode & other)
+:      ASTNode(other), m_list()
+{
+       // deep copy each item of the original's list
+       const_iterator it = other.begin();
+       for (; it != other.end(); ++it)
+       {
+               m_list.push_back((*it)->clone());
+       }
+}
+
+//! Deletes child node in the list.
+//!
+ListASTNode::~ListASTNode()
+{
+       iterator it = begin();
+       for (; it != end(); it++)
+       {
+               delete *it;
+       }
+}
+
+//! If \a node is NULL then the list is left unmodified.
+//!
+//! The list node's location is automatically updated after the node is added by a call
+//! to updateLocation().
+void ListASTNode::appendNode(ASTNode * node)
+{
+       if (node)
+       {
+               m_list.push_back(node);
+               updateLocation();
+       }
+}
+
+void ListASTNode::printTree(int indent) const
+{
+       ASTNode::printTree(indent);
+       
+       int n = 0;
+       const_iterator it = begin();
+       for (; it != end(); it++, n++)
+       {
+               printIndent(indent + 1);
+               printf("%d:\n", n);
+               (*it)->printTree(indent + 2);
+       }
+}
+
+void ListASTNode::updateLocation()
+{
+       token_loc_t current = { 0 };
+       const_iterator it = begin();
+       for (; it != end(); it++)
+       {
+               const ASTNode * node = *it;
+               const token_loc_t & loc = node->getLocation();
+               
+               // handle first node
+               if (current.m_firstLine == 0)
+               {
+                       current = loc;
+                       continue;
+               }
+
+               if (loc.m_firstLine < current.m_firstLine)
+               {
+                       current.m_firstLine = loc.m_firstLine;
+               }
+               
+               if (loc.m_lastLine > current.m_lastLine)
+               {
+                       current.m_lastLine = loc.m_lastLine;
+               }
+       }
+       
+       setLocation(current);
+}
+
+#pragma mark = CommandFileASTNode =
+
+CommandFileASTNode::CommandFileASTNode()
+:      ASTNode(), m_options(), m_constants(), m_sources(), m_sections()
+{
+}
+
+CommandFileASTNode::CommandFileASTNode(const CommandFileASTNode & other)
+:      ASTNode(other), m_options(), m_constants(), m_sources(), m_sections()
+{
+       m_options = dynamic_cast<ListASTNode*>(other.m_options->clone());
+       m_constants = dynamic_cast<ListASTNode*>(other.m_constants->clone());
+       m_sources = dynamic_cast<ListASTNode*>(other.m_sources->clone());
+       m_sections = dynamic_cast<ListASTNode*>(other.m_sections->clone());
+}
+
+void CommandFileASTNode::printTree(int indent) const
+{
+       ASTNode::printTree(indent);
+       
+       printIndent(indent + 1);
+       printf("options:\n");
+       if (m_options) m_options->printTree(indent + 2);
+       
+       printIndent(indent + 1);
+       printf("constants:\n");
+       if (m_constants) m_constants->printTree(indent + 2);
+       
+       printIndent(indent + 1);
+       printf("sources:\n");
+       if (m_sources) m_sources->printTree(indent + 2);
+       
+       printIndent(indent + 1);
+       printf("sections:\n");
+       if (m_sections) m_sections->printTree(indent + 2);
+}
+
+#pragma mark = ExprASTNode =
+
+int_size_t ExprASTNode::resultIntSize(int_size_t a, int_size_t b)
+{
+       int_size_t result;
+       switch (a)
+       {
+               case kWordSize:
+                       result = kWordSize;
+                       break;
+               case kHalfWordSize:
+                       if (b == kWordSize)
+                       {
+                               result = kWordSize;
+                       }
+                       else
+                       {
+                               result = kHalfWordSize;
+                       }
+                       break;
+               case kByteSize:
+                       if (b == kWordSize)
+                       {
+                               result = kWordSize;
+                       }
+                       else if (b == kHalfWordSize)
+                       {
+                               result = kHalfWordSize;
+                       }
+                       else
+                       {
+                               result = kByteSize;
+                       }
+                       break;
+       }
+       
+       return result;
+}
+
+#pragma mark = IntConstExprASTNode =
+
+IntConstExprASTNode::IntConstExprASTNode(const IntConstExprASTNode & other)
+:      ExprASTNode(other), m_value(other.m_value), m_size(other.m_size)
+{
+}
+
+void IntConstExprASTNode::printTree(int indent) const
+{
+       printIndent(indent);
+       char sizeChar='?';
+       switch (m_size)
+       {
+               case kWordSize:
+                       sizeChar = 'w';
+                       break;
+               case kHalfWordSize:
+                       sizeChar = 'h';
+                       break;
+               case kByteSize:
+                       sizeChar = 'b';
+                       break;
+       }
+       printf("%s(%d:%c)\n", nodeName().c_str(), m_value, sizeChar);
+}
+
+#pragma mark = VariableExprASTNode =
+
+VariableExprASTNode::VariableExprASTNode(const VariableExprASTNode & other)
+:      ExprASTNode(other), m_variable()
+{
+       m_variable = new std::string(*other.m_variable);
+}
+
+void VariableExprASTNode::printTree(int indent) const
+{
+       printIndent(indent);
+       printf("%s(%s)\n", nodeName().c_str(), m_variable->c_str());
+}
+
+ExprASTNode * VariableExprASTNode::reduce(EvalContext & context)
+{
+       if (!context.isVariableDefined(*m_variable))
+       {
+               throw std::runtime_error(format_string("line %d: undefined variable '%s'", getFirstLine(), m_variable->c_str()));
+       }
+       
+       uint32_t value = context.getVariableValue(*m_variable);
+       int_size_t size = context.getVariableSize(*m_variable);
+       return new IntConstExprASTNode(value, size);
+}
+
+#pragma mark = SymbolRefExprASTNode =
+
+SymbolRefExprASTNode::SymbolRefExprASTNode(const SymbolRefExprASTNode & other)
+:      ExprASTNode(other), m_symbol(NULL)
+{
+       if (other.m_symbol)
+       {
+               m_symbol = dynamic_cast<SymbolASTNode*>(other.m_symbol->clone());
+       }
+}
+
+void SymbolRefExprASTNode::printTree(int indent) const
+{
+}
+
+ExprASTNode * SymbolRefExprASTNode::reduce(EvalContext & context)
+{
+       EvalContext::SourceFileManager * manager = context.getSourceFileManager();
+       if (!manager)
+       {
+               throw std::runtime_error("no source manager available");
+       }
+       
+       if (!m_symbol)
+       {
+               throw semantic_error("no symbol provided");
+       }
+       
+       // Get the name of the symbol
+       std::string * symbolName = m_symbol->getSymbolName();
+//     if (!symbolName)
+//     {
+//             throw semantic_error(format_string("line %d: no symbol name provided", getFirstLine()));
+//     }
+       
+       // Get the source file.
+       std::string * sourceName = m_symbol->getSource();
+       SourceFile * sourceFile;
+       
+       if (sourceName)
+       {
+               sourceFile = manager->getSourceFile(*sourceName);
+               if (!sourceFile)
+               {
+                       throw semantic_error(format_string("line %d: no source file named %s", getFirstLine(), sourceName->c_str()));
+               }
+       }
+       else
+       {
+               sourceFile = manager->getDefaultSourceFile();
+               if (!sourceFile)
+               {
+                       throw semantic_error(format_string("line %d: no default source file is set", getFirstLine()));
+               }
+       }
+       
+       // open the file if it hasn't already been
+       if (!sourceFile->isOpen())
+       {
+               sourceFile->open();
+       }
+       
+       // Make sure the source file supports symbols before going any further
+       if (symbolName && !sourceFile->supportsNamedSymbols())
+       {
+               throw semantic_error(format_string("line %d: source file %s does not support symbols", getFirstLine(), sourceFile->getPath().c_str()));
+       }
+    
+    if (!symbolName && !sourceFile->hasEntryPoint())
+    {
+        throw semantic_error(format_string("line %d: source file %s does not have an entry point", getFirstLine(), sourceFile->getPath().c_str()));
+    }
+       
+       // Returns a const expr node with the symbol's value.
+       uint32_t value;
+    if (symbolName)
+    {
+        value = sourceFile->getSymbolValue(*symbolName);
+    }
+    else
+    {
+        value = sourceFile->getEntryPointAddress();
+    }
+       return new IntConstExprASTNode(value);
+}
+
+#pragma mark = NegativeExprASTNode =
+
+NegativeExprASTNode::NegativeExprASTNode(const NegativeExprASTNode & other)
+:      ExprASTNode(other), m_expr()
+{
+       m_expr = dynamic_cast<ExprASTNode*>(other.m_expr->clone());
+}
+
+void NegativeExprASTNode::printTree(int indent) const
+{
+       ExprASTNode::printTree(indent);
+       if (m_expr) m_expr->printTree(indent + 1);
+}
+
+ExprASTNode * NegativeExprASTNode::reduce(EvalContext & context)
+{
+       if (!m_expr)
+       {
+               return this;
+       }
+       
+       m_expr = m_expr->reduce(context);
+       IntConstExprASTNode * intConst = dynamic_cast<IntConstExprASTNode*>(m_expr.get());
+       if (intConst)
+       {
+           int32_t value = -(int32_t)intConst->getValue();
+               return new IntConstExprASTNode((uint32_t)value, intConst->getSize());
+       }
+       else
+       {
+               return this;
+       }
+}
+
+#pragma mark = BooleanNotExprASTNode =
+
+BooleanNotExprASTNode::BooleanNotExprASTNode(const BooleanNotExprASTNode & other)
+:      ExprASTNode(other), m_expr()
+{
+       m_expr = dynamic_cast<ExprASTNode*>(other.m_expr->clone());
+}
+
+void BooleanNotExprASTNode::printTree(int indent) const
+{
+       ExprASTNode::printTree(indent);
+       if (m_expr) m_expr->printTree(indent + 1);
+}
+
+ExprASTNode * BooleanNotExprASTNode::reduce(EvalContext & context)
+{
+       if (!m_expr)
+       {
+               return this;
+       }
+       
+       m_expr = m_expr->reduce(context);
+       IntConstExprASTNode * intConst = dynamic_cast<IntConstExprASTNode*>(m_expr.get());
+       if (intConst)
+       {
+           int32_t value = !((int32_t)intConst->getValue());
+               return new IntConstExprASTNode((uint32_t)value, intConst->getSize());
+       }
+       else
+       {
+               throw semantic_error(format_string("line %d: expression did not evaluate to an integer", m_expr->getFirstLine()));
+       }
+}
+
+#pragma mark = SourceFileFunctionASTNode =
+
+SourceFileFunctionASTNode::SourceFileFunctionASTNode(const SourceFileFunctionASTNode & other)
+:      ExprASTNode(other), m_functionName(), m_sourceFile()
+{
+       m_functionName = new std::string(*other.m_functionName);
+       m_sourceFile = new std::string(*other.m_sourceFile);
+}
+
+void SourceFileFunctionASTNode::printTree(int indent) const
+{
+       ExprASTNode::printTree(indent);
+       printIndent(indent+1);
+
+       // for some stupid reason the msft C++ compiler barfs on the following line if the ".get()" parts are remove,
+       // even though the first line of reduce() below has the same expression, just in parentheses. stupid compiler.
+       if (m_functionName.get() && m_sourceFile.get())
+       {
+               printf("%s ( %s )\n", m_functionName->c_str(), m_sourceFile->c_str());
+       }
+}
+
+ExprASTNode * SourceFileFunctionASTNode::reduce(EvalContext & context)
+{
+       if (!(m_functionName && m_sourceFile))
+       {
+               throw std::runtime_error("unset function name or source file");
+       }
+       
+       // Get source file manager from evaluation context. This will be the
+       // conversion controller itself.
+       EvalContext::SourceFileManager * mgr = context.getSourceFileManager();
+       if (!mgr)
+       {
+               throw std::runtime_error("source file manager is not set");
+       }
+       
+       // Perform function
+       uint32_t functionResult = 0;
+       if (*m_functionName == "exists")
+       {
+               functionResult = static_cast<uint32_t>(mgr->hasSourceFile(*m_sourceFile));
+       }
+       
+       // Return function result as an expression node
+       return new IntConstExprASTNode(functionResult);
+}
+
+#pragma mark = DefinedOperatorASTNode =
+
+DefinedOperatorASTNode::DefinedOperatorASTNode(const DefinedOperatorASTNode & other)
+:      ExprASTNode(other), m_constantName()
+{
+       m_constantName = new std::string(*other.m_constantName);
+}
+
+void DefinedOperatorASTNode::printTree(int indent) const
+{
+       ExprASTNode::printTree(indent);
+       printIndent(indent+1);
+
+       if (m_constantName)
+       {
+               printf("defined ( %s )\n", m_constantName->c_str());
+       }
+}
+
+ExprASTNode * DefinedOperatorASTNode::reduce(EvalContext & context)
+{
+       assert(m_constantName);
+       
+       // Return function result as an expression node
+       return new IntConstExprASTNode(context.isVariableDefined(m_constantName) ? 1 : 0);
+}
+
+#pragma mark = SizeofOperatorASTNode =
+
+SizeofOperatorASTNode::SizeofOperatorASTNode(const SizeofOperatorASTNode & other)
+:      ExprASTNode(other), m_constantName(), m_symbol()
+{
+       m_constantName = new std::string(*other.m_constantName);
+       m_symbol = dynamic_cast<SymbolASTNode*>(other.m_symbol->clone());
+}
+
+void SizeofOperatorASTNode::printTree(int indent) const
+{
+       ExprASTNode::printTree(indent);
+       
+       printIndent(indent+1);
+
+       if (m_constantName)
+       {
+               printf("sizeof: %s\n", m_constantName->c_str());
+       }
+       else if (m_symbol)
+       {
+               printf("sizeof:\n");
+               m_symbol->printTree(indent + 2);
+       }
+}
+
+ExprASTNode * SizeofOperatorASTNode::reduce(EvalContext & context)
+{
+       // One or the other must be defined.
+       assert(m_constantName || m_symbol);
+       
+       EvalContext::SourceFileManager * manager = context.getSourceFileManager();
+       assert(manager);
+       
+       unsigned sizeInBytes = 0;
+       SourceFile * sourceFile;
+       
+       if (m_symbol)
+       {
+               // Get the symbol name.
+               std::string * symbolName = m_symbol->getSymbolName();
+               assert(symbolName);
+               
+               // Get the source file, using the default if one is not specified.
+               std::string * sourceName = m_symbol->getSource();
+               if (sourceName)
+               {
+                       sourceFile = manager->getSourceFile(*sourceName);
+                       if (!sourceFile)
+                       {
+                               throw semantic_error(format_string("line %d: invalid source file: %s", getFirstLine(), sourceName->c_str()));
+                       }
+               }
+               else
+               {
+                       sourceFile = manager->getDefaultSourceFile();
+                       if (!sourceFile)
+                       {
+                               throw semantic_error(format_string("line %d: no default source file is set", getFirstLine()));
+                       }
+               }
+               
+               // Get the size of the symbol.
+               if (sourceFile->hasSymbol(*symbolName))
+               {
+                       sizeInBytes = sourceFile->getSymbolSize(*symbolName);
+               }
+       }
+       else if (m_constantName)
+       {
+               // See if the "constant" is really a constant or if it's a source name.
+               if (manager->hasSourceFile(m_constantName))
+               {
+                       sourceFile = manager->getSourceFile(m_constantName);
+                       if (sourceFile)
+                       {
+                               sizeInBytes = sourceFile->getSize();
+                       }
+               }
+               else
+               {
+                       // Regular constant.
+                       if (!context.isVariableDefined(*m_constantName))
+                       {
+                               throw semantic_error(format_string("line %d: cannot get size of undefined constant %s", getFirstLine(), m_constantName->c_str()));
+                       }
+                       
+                       int_size_t intSize = context.getVariableSize(*m_constantName);
+                       switch (intSize)
+                       {
+                               case kWordSize:
+                                       sizeInBytes = sizeof(uint32_t);
+                                       break;
+                               case kHalfWordSize:
+                                       sizeInBytes = sizeof(uint16_t);
+                                       break;
+                               case kByteSize:
+                                       sizeInBytes = sizeof(uint8_t);
+                                       break;
+                       }
+               }
+       }
+       
+       // Return function result as an expression node
+       return new IntConstExprASTNode(sizeInBytes);
+}
+
+#pragma mark = BinaryOpExprASTNode =
+
+BinaryOpExprASTNode::BinaryOpExprASTNode(const BinaryOpExprASTNode & other)
+:      ExprASTNode(other), m_left(), m_op(other.m_op), m_right()
+{
+       m_left = dynamic_cast<ExprASTNode*>(other.m_left->clone());
+       m_right = dynamic_cast<ExprASTNode*>(other.m_right->clone());
+}
+
+void BinaryOpExprASTNode::printTree(int indent) const
+{
+       ExprASTNode::printTree(indent);
+
+       printIndent(indent + 1);
+       printf("left:\n");
+       if (m_left) m_left->printTree(indent + 2);
+       
+       printIndent(indent + 1);
+       printf("op: %s\n", getOperatorName().c_str());
+
+       printIndent(indent + 1);
+       printf("right:\n");
+       if (m_right) m_right->printTree(indent + 2);
+}
+
+std::string BinaryOpExprASTNode::getOperatorName() const
+{
+       switch (m_op)
+       {
+               case kAdd:
+                       return "+";
+               case kSubtract:
+                       return "-";
+               case kMultiply:
+                       return "*";
+               case kDivide:
+                       return "/";
+               case kModulus:
+                       return "%";
+               case kPower:
+                       return "**";
+               case kBitwiseAnd:
+                       return "&";
+               case kBitwiseOr:
+                       return "|";
+               case kBitwiseXor:
+                       return "^";
+               case kShiftLeft:
+                       return "<<";
+               case kShiftRight:
+                       return ">>";
+               case kLessThan:
+                       return "<";
+               case kGreaterThan:
+                       return ">";
+               case kLessThanEqual:
+                       return "<=";
+               case kGreaterThanEqual:
+                       return ">";
+               case kEqual:
+                       return "==";
+               case kNotEqual:
+                       return "!=";
+               case kBooleanAnd:
+                       return "&&";
+               case kBooleanOr:
+                       return "||";
+       }
+       
+       return "???";
+}
+
+//! \todo Fix power operator under windows!!!
+//!
+ExprASTNode * BinaryOpExprASTNode::reduce(EvalContext & context)
+{
+       if (!m_left || !m_right)
+       {
+               return this;
+       }
+       
+       IntConstExprASTNode * leftIntConst = NULL;
+       IntConstExprASTNode * rightIntConst = NULL;
+       uint32_t leftValue;
+       uint32_t rightValue;
+       uint32_t result = 0;
+       
+       // Always reduce the left hand side.
+       m_left = m_left->reduce(context);
+       leftIntConst = dynamic_cast<IntConstExprASTNode*>(m_left.get());
+       if (!leftIntConst)
+       {
+               throw semantic_error(format_string("left hand side of %s operator failed to evaluate to an integer", getOperatorName().c_str()));
+       }
+       leftValue = leftIntConst->getValue();
+       
+       // Boolean && and || operators are handled separately so that we can perform
+       // short-circuit evaluation.
+       if (m_op == kBooleanAnd || m_op == kBooleanOr)
+       {
+               // Reduce right hand side only if required to evaluate the boolean operator.
+               if ((m_op == kBooleanAnd && leftValue != 0) || (m_op == kBooleanOr && leftValue == 0))
+               {
+                       m_right = m_right->reduce(context);
+                       rightIntConst = dynamic_cast<IntConstExprASTNode*>(m_right.get());
+                       if (!rightIntConst)
+                       {
+                               throw semantic_error(format_string("right hand side of %s operator failed to evaluate to an integer", getOperatorName().c_str()));
+                       }
+                       rightValue = rightIntConst->getValue();
+                       
+                       // Perform the boolean operation.
+                       switch (m_op)
+                       {
+                               case kBooleanAnd:
+                                       result = leftValue && rightValue;
+                                       break;
+                               
+                               case kBooleanOr:
+                                       result = leftValue && rightValue;
+                                       break;
+                       }
+               }
+               else if (m_op == kBooleanAnd)
+               {
+                       // The left hand side is false, so the && operator's result must be false
+                       // without regard to the right hand side.
+                       result = 0;
+               }
+               else if (m_op == kBooleanOr)
+               {
+                       // The left hand value is true so the || result is automatically true.
+                       result = 1;
+               }
+       }
+       else
+       {
+               // Reduce right hand side always for most operators.
+               m_right = m_right->reduce(context);
+               rightIntConst = dynamic_cast<IntConstExprASTNode*>(m_right.get());
+               if (!rightIntConst)
+               {
+                       throw semantic_error(format_string("right hand side of %s operator failed to evaluate to an integer", getOperatorName().c_str()));
+               }
+               rightValue = rightIntConst->getValue();
+               
+               switch (m_op)
+               {
+                       case kAdd:
+                               result = leftValue + rightValue;
+                               break;
+                       case kSubtract:
+                               result = leftValue - rightValue;
+                               break;
+                       case kMultiply:
+                               result = leftValue * rightValue;
+                               break;
+                       case kDivide:
+                               result = leftValue / rightValue;
+                               break;
+                       case kModulus:
+                               result = leftValue % rightValue;
+                               break;
+                       case kPower:
+                       #ifdef WIN32
+                               result = 0;
+                       #else
+                               result = lroundf(powf(float(leftValue), float(rightValue)));
+                       #endif
+                               break;
+                       case kBitwiseAnd:
+                               result = leftValue & rightValue;
+                               break;
+                       case kBitwiseOr:
+                               result = leftValue | rightValue;
+                               break;
+                       case kBitwiseXor:
+                               result = leftValue ^ rightValue;
+                               break;
+                       case kShiftLeft:
+                               result = leftValue << rightValue;
+                               break;
+                       case kShiftRight:
+                               result = leftValue >> rightValue;
+                               break;
+                       case kLessThan:
+                               result = leftValue < rightValue;
+                               break;
+                       case kGreaterThan:
+                               result = leftValue > rightValue;
+                               break;
+                       case kLessThanEqual:
+                               result = leftValue <= rightValue;
+                               break;
+                       case kGreaterThanEqual:
+                               result = leftValue >= rightValue;
+                               break;
+                       case kEqual:
+                               result = leftValue == rightValue;
+                               break;
+                       case kNotEqual:
+                               result = leftValue != rightValue;
+                               break;
+               }
+       }
+       
+       // Create the result value.
+       int_size_t resultSize;
+       if (leftIntConst && rightIntConst)
+       {
+               resultSize = resultIntSize(leftIntConst->getSize(), rightIntConst->getSize());
+       }
+       else if (leftIntConst)
+       {
+               resultSize = leftIntConst->getSize();
+       }
+       else
+       {
+               // This shouldn't really be possible, but just in case.
+               resultSize = kWordSize;
+       }
+       return new IntConstExprASTNode(result, resultSize);
+}
+
+#pragma mark = IntSizeExprASTNode =
+
+IntSizeExprASTNode::IntSizeExprASTNode(const IntSizeExprASTNode & other)
+:      ExprASTNode(other), m_expr(), m_size(other.m_size)
+{
+       m_expr = dynamic_cast<ExprASTNode*>(other.m_expr->clone());
+}
+
+void IntSizeExprASTNode::printTree(int indent) const
+{
+       ExprASTNode::printTree(indent);
+       
+       char sizeChar='?';
+       switch (m_size)
+       {
+               case kWordSize:
+                       sizeChar = 'w';
+                       break;
+               case kHalfWordSize:
+                       sizeChar = 'h';
+                       break;
+               case kByteSize:
+                       sizeChar = 'b';
+                       break;
+       }
+       printIndent(indent + 1);
+       printf("size: %c\n", sizeChar);
+       
+       printIndent(indent + 1);
+       printf("expr:\n");
+       if (m_expr) m_expr->printTree(indent + 2);
+}
+
+ExprASTNode * IntSizeExprASTNode::reduce(EvalContext & context)
+{
+       if (!m_expr)
+       {
+               return this;
+       }
+       
+       m_expr = m_expr->reduce(context);
+       IntConstExprASTNode * intConst = dynamic_cast<IntConstExprASTNode*>(m_expr.get());
+       if (!intConst)
+       {
+               return this;
+       }
+       
+       return new IntConstExprASTNode(intConst->getValue(), m_size);
+}
+
+#pragma mark = ExprConstASTNode =
+
+ExprConstASTNode::ExprConstASTNode(const ExprConstASTNode & other)
+:      ConstASTNode(other), m_expr()
+{
+       m_expr = dynamic_cast<ExprASTNode*>(other.m_expr->clone());
+}
+
+void ExprConstASTNode::printTree(int indent) const
+{
+       ConstASTNode::printTree(indent);
+       if (m_expr) m_expr->printTree(indent + 1);
+}
+
+#pragma mark = StringConstASTNode =
+
+StringConstASTNode::StringConstASTNode(const StringConstASTNode & other)
+:      ConstASTNode(other), m_value()
+{
+       m_value = new std::string(other.m_value);
+}
+
+void StringConstASTNode::printTree(int indent) const
+{
+       printIndent(indent);
+       printf("%s(%s)\n", nodeName().c_str(), m_value->c_str());
+}
+
+#pragma mark = BlobConstASTNode =
+
+BlobConstASTNode::BlobConstASTNode(const BlobConstASTNode & other)
+:      ConstASTNode(other), m_blob()
+{
+       m_blob = new Blob(*other.m_blob);
+}
+
+void BlobConstASTNode::printTree(int indent) const
+{
+       printIndent(indent);
+       
+       const uint8_t * dataPtr = m_blob->getData();
+       unsigned dataLen = m_blob->getLength();
+       printf("%s(%p:%d)\n", nodeName().c_str(), dataPtr, dataLen);
+}
+
+#pragma mark = IVTConstASTNode =
+
+IVTConstASTNode::IVTConstASTNode(const IVTConstASTNode & other)
+:      ConstASTNode(other), m_fields()
+{
+       m_fields = dynamic_cast<ListASTNode*>(other.m_fields->clone());
+}
+
+void IVTConstASTNode::printTree(int indent) const
+{
+       printIndent(indent);
+       printf("%s:\n", nodeName().c_str());
+    if (m_fields)
+    {
+        m_fields->printTree(indent + 1);
+    }
+}
+
+#pragma mark = AssignmentASTNode =
+
+AssignmentASTNode::AssignmentASTNode(const AssignmentASTNode & other)
+:      ASTNode(other), m_ident(), m_value()
+{
+       m_ident = new std::string(*other.m_ident);
+       m_value = dynamic_cast<ConstASTNode*>(other.m_value->clone());
+}
+
+void AssignmentASTNode::printTree(int indent) const
+{
+       printIndent(indent);
+       printf("%s(%s)\n", nodeName().c_str(), m_ident->c_str());
+       
+       if (m_value) m_value->printTree(indent + 1);
+}
+
+#pragma mark = SourceDefASTNode =
+
+SourceDefASTNode::SourceDefASTNode(const SourceDefASTNode & other)
+:      ASTNode(other), m_name()
+{
+       m_name = new std::string(*other.m_name);
+}
+
+#pragma mark = PathSourceDefASTNode =
+
+PathSourceDefASTNode::PathSourceDefASTNode(const PathSourceDefASTNode & other)
+:      SourceDefASTNode(other), m_path()
+{
+       m_path = new std::string(*other.m_path);
+}
+
+void PathSourceDefASTNode::printTree(int indent) const
+{
+       SourceDefASTNode::printTree(indent);
+       
+       printIndent(indent+1);
+       printf("path: %s\n", m_path->c_str());
+       
+       printIndent(indent+1);
+       printf("attributes:\n");
+       if (m_attributes)
+       {
+               m_attributes->printTree(indent+2);
+       }
+}
+
+#pragma mark = ExternSourceDefASTNode =
+
+ExternSourceDefASTNode::ExternSourceDefASTNode(const ExternSourceDefASTNode & other)
+:      SourceDefASTNode(other), m_expr()
+{
+       m_expr = dynamic_cast<ExprASTNode*>(other.m_expr->clone());
+}
+
+void ExternSourceDefASTNode::printTree(int indent) const
+{
+       SourceDefASTNode::printTree(indent);
+       
+       printIndent(indent+1);
+       printf("expr:\n");
+       if (m_expr) m_expr->printTree(indent + 2);
+       
+       printIndent(indent+1);
+       printf("attributes:\n");
+       if (m_attributes)
+       {
+               m_attributes->printTree(indent+2);
+       }
+}
+
+#pragma mark = SectionContentsASTNode =
+
+SectionContentsASTNode::SectionContentsASTNode(const SectionContentsASTNode & other)
+:      ASTNode(other), m_sectionExpr()
+{
+       m_sectionExpr = dynamic_cast<ExprASTNode*>(other.m_sectionExpr->clone());
+}
+
+void SectionContentsASTNode::printTree(int indent) const
+{
+       ASTNode::printTree(indent);
+       
+       printIndent(indent + 1);
+       printf("section#:\n");
+       if (m_sectionExpr) m_sectionExpr->printTree(indent + 2);
+}
+
+#pragma mark = DataSectionContentsASTNode =
+
+DataSectionContentsASTNode::DataSectionContentsASTNode(const DataSectionContentsASTNode & other)
+:      SectionContentsASTNode(other), m_contents()
+{
+       m_contents = dynamic_cast<ASTNode*>(other.m_contents->clone());
+}
+
+void DataSectionContentsASTNode::printTree(int indent) const
+{
+       SectionContentsASTNode::printTree(indent);
+       
+       if (m_contents)
+       {
+               m_contents->printTree(indent + 1);
+       }
+}
+
+#pragma mark = BootableSectionContentsASTNode =
+
+BootableSectionContentsASTNode::BootableSectionContentsASTNode(const BootableSectionContentsASTNode & other)
+:      SectionContentsASTNode(other), m_statements()
+{
+       m_statements = dynamic_cast<ListASTNode*>(other.m_statements->clone());
+}
+
+void BootableSectionContentsASTNode::printTree(int indent) const
+{
+       SectionContentsASTNode::printTree(indent);
+       
+       printIndent(indent + 1);
+       printf("statements:\n");
+       if (m_statements) m_statements->printTree(indent + 2);
+}
+
+#pragma mark = IfStatementASTNode =
+
+//! \warning Be careful; this method could enter an infinite loop if m_nextIf feeds
+//!            back onto itself. m_nextIf must be NULL at some point down the next if list.
+IfStatementASTNode::IfStatementASTNode(const IfStatementASTNode & other)
+:      StatementASTNode(),
+       m_conditionExpr(),
+       m_ifStatements(),
+       m_nextIf(),
+       m_elseStatements()
+{
+       m_conditionExpr = dynamic_cast<ExprASTNode*>(other.m_conditionExpr->clone());
+       m_ifStatements = dynamic_cast<ListASTNode*>(other.m_ifStatements->clone());
+       m_nextIf = dynamic_cast<IfStatementASTNode*>(other.m_nextIf->clone());
+       m_elseStatements = dynamic_cast<ListASTNode*>(other.m_elseStatements->clone());
+}
+
+#pragma mark = ModeStatementASTNode =
+
+ModeStatementASTNode::ModeStatementASTNode(const ModeStatementASTNode & other)
+:      StatementASTNode(other), m_modeExpr()
+{
+       m_modeExpr = dynamic_cast<ExprASTNode*>(other.m_modeExpr->clone());
+}
+
+void ModeStatementASTNode::printTree(int indent) const
+{
+       StatementASTNode::printTree(indent);
+       printIndent(indent + 1);
+       printf("mode:\n");
+       if (m_modeExpr) m_modeExpr->printTree(indent + 2);
+}
+
+#pragma mark = MessageStatementASTNode =
+
+MessageStatementASTNode::MessageStatementASTNode(const MessageStatementASTNode & other)
+:      StatementASTNode(other), m_type(other.m_type), m_message()
+{
+       m_message = new std::string(*other.m_message);
+}
+
+void MessageStatementASTNode::printTree(int indent) const
+{
+       StatementASTNode::printTree(indent);
+       printIndent(indent + 1);
+       printf("%s: %s\n", getTypeName(), m_message->c_str());
+}
+
+const char * MessageStatementASTNode::getTypeName() const
+{
+       switch (m_type)
+       {
+               case kInfo:
+                       return "info";
+               
+               case kWarning:
+                       return "warning";
+               
+               case kError:
+                       return "error";
+       }
+       
+       return "unknown";
+}
+
+#pragma mark = LoadStatementASTNode =
+
+LoadStatementASTNode::LoadStatementASTNode(const LoadStatementASTNode & other)
+:      StatementASTNode(other), m_data(), m_target(), m_isDCDLoad(other.m_isDCDLoad)
+{
+       m_data = other.m_data->clone();
+       m_target = other.m_target->clone();
+}
+
+void LoadStatementASTNode::printTree(int indent) const
+{
+       StatementASTNode::printTree(indent);
+       
+       printIndent(indent + 1);
+       printf("data:\n");
+       if (m_data) m_data->printTree(indent + 2);
+       
+       printIndent(indent + 1);
+       printf("target:\n");
+       if (m_target) m_target->printTree(indent + 2);
+}
+
+#pragma mark = CallStatementASTNode =
+
+CallStatementASTNode::CallStatementASTNode(const CallStatementASTNode & other)
+:      StatementASTNode(other), m_type(other.m_type), m_target(), m_arg()
+{
+       m_target = other.m_target->clone();
+       m_arg = other.m_arg->clone();
+}
+
+void CallStatementASTNode::printTree(int indent) const
+{
+       printIndent(indent);
+       printf("%s(%s)%s\n", nodeName().c_str(), (m_type == kCallType ? "call" : "jump"), (m_isHAB ? "/HAB" : ""));
+       
+       printIndent(indent + 1);
+       printf("target:\n");
+       if (m_target) m_target->printTree(indent + 2);
+       
+       printIndent(indent + 1);
+       printf("arg:\n");
+       if (m_arg) m_arg->printTree(indent + 2);
+}
+
+#pragma mark = SourceASTNode =
+
+SourceASTNode::SourceASTNode(const SourceASTNode & other)
+:      ASTNode(other), m_name()
+{
+       m_name = new std::string(*other.m_name);
+}
+
+void SourceASTNode::printTree(int indent) const
+{
+       printIndent(indent);
+       printf("%s(%s)\n", nodeName().c_str(), m_name->c_str());
+}
+
+#pragma mark = SectionMatchListASTNode =
+
+SectionMatchListASTNode::SectionMatchListASTNode(const SectionMatchListASTNode & other)
+:      ASTNode(other), m_sections(), m_source()
+{
+       if (other.m_sections)
+       {
+               m_sections = dynamic_cast<ListASTNode *>(other.m_sections->clone());
+       }
+       
+       if (other.m_source)
+       {
+               m_source = new std::string(*other.m_source);
+       }
+}
+
+void SectionMatchListASTNode::printTree(int indent) const
+{
+       ASTNode::printTree(indent);
+       
+       printIndent(indent+1);
+       printf("sections:\n");
+       if (m_sections)
+       {
+               m_sections->printTree(indent+2);
+       }
+       
+       printIndent(indent+1);
+       printf("source: ", m_source->c_str());
+       if (m_source)
+       {
+               printf("%s\n", m_source->c_str());
+       }
+       else
+       {
+               printf("\n");
+       }
+}
+
+#pragma mark = SectionASTNode =
+
+SectionASTNode::SectionASTNode(const SectionASTNode & other)
+:      ASTNode(other), m_name(), m_source()
+{
+       m_action = other.m_action;
+       
+       if (other.m_name)
+       {
+               m_name = new std::string(*other.m_name);
+       }
+       
+       if (other.m_source)
+       {
+               m_source = new std::string(*other.m_source);
+       }
+}
+
+void SectionASTNode::printTree(int indent) const
+{
+       printIndent(indent);
+       
+       const char * actionName;
+       switch (m_action)
+       {
+               case kInclude:
+                       actionName = "include";
+                       break;
+               case kExclude:
+                       actionName = "exclude";
+                       break;
+       }
+       
+       if (m_source)
+       {
+               printf("%s(%s:%s:%s)\n", nodeName().c_str(), actionName, m_name->c_str(), m_source->c_str());
+       }
+       else
+       {
+               printf("%s(%s:%s)\n", nodeName().c_str(), actionName, m_name->c_str());
+       }
+}
+
+#pragma mark = SymbolASTNode =
+
+SymbolASTNode::SymbolASTNode(const SymbolASTNode & other)
+:      ASTNode(other), m_symbol(), m_source()
+{
+       m_symbol = new std::string(*other.m_symbol);
+       m_source = new std::string(*other.m_source);
+}
+
+void SymbolASTNode::printTree(int indent) const
+{
+       printIndent(indent);
+       
+       const char * symbol = NULL;
+       if (m_symbol)
+       {
+               symbol = m_symbol->c_str();
+       }
+       
+       const char * source = NULL;
+       if (m_source)
+       {
+               source = m_source->c_str();
+       }
+       
+       printf("%s(", nodeName().c_str());
+       if (source)
+       {
+               printf(source);
+       }
+       else
+       {
+               printf(".");
+       }
+       printf(":");
+       if (symbol)
+       {
+               printf(symbol);
+       }
+       else
+       {
+               printf(".");
+       }
+       printf(")\n");
+}
+
+#pragma mark = AddressRangeASTNode =
+
+AddressRangeASTNode::AddressRangeASTNode(const AddressRangeASTNode & other)
+:      ASTNode(other), m_begin(), m_end()
+{
+       m_begin = other.m_begin->clone();
+       m_end = other.m_end->clone();
+}
+
+void AddressRangeASTNode::printTree(int indent) const
+{
+       ASTNode::printTree(indent);
+       
+       printIndent(indent + 1);
+       printf("begin:\n");
+       if (m_begin) m_begin->printTree(indent + 2);
+       
+       printIndent(indent + 1);
+       printf("end:\n");
+       if (m_end) m_end->printTree(indent + 2);
+}
+
+#pragma mark = FromStatementASTNode =
+
+FromStatementASTNode::FromStatementASTNode(std::string * source, ListASTNode * statements)
+:      StatementASTNode(), m_source(source), m_statements(statements)
+{
+}
+
+FromStatementASTNode::FromStatementASTNode(const FromStatementASTNode & other)
+:      StatementASTNode(), m_source(), m_statements()
+{
+       m_source = new std::string(*other.m_source);
+       m_statements = dynamic_cast<ListASTNode*>(other.m_statements->clone());
+}
+
+void FromStatementASTNode::printTree(int indent) const
+{
+       ASTNode::printTree(indent);
+       
+       printIndent(indent + 1);
+       printf("source: ");
+       if (m_source) printf("%s\n", m_source->c_str());
+       
+       printIndent(indent + 1);
+       printf("statements:\n");
+       if (m_statements) m_statements->printTree(indent + 2);
+}
+
diff --git a/tools/elftosb/elftosb2/ElftosbAST.h b/tools/elftosb/elftosb2/ElftosbAST.h
new file mode 100644 (file)
index 0000000..cb70f49
--- /dev/null
@@ -0,0 +1,1227 @@
+/*
+ * File:       ElftosbAST.h
+ *
+ * Copyright (c) Freescale Semiconductor, Inc. All rights reserved.
+ * See included license file for license details.
+ */
+#if !defined(_ElftosbAST_h_)
+#define _ElftosbAST_h_
+
+#include "stdafx.h"
+#include <string>
+#include <list>
+#include "smart_ptr.h"
+#include "EvalContext.h"
+
+namespace elftosb
+{
+
+// forward reference
+class SymbolASTNode;
+
+/*!
+ * \brief Token location in the source file.
+ */
+struct token_loc_t
+{
+       int m_firstLine;        //!< Starting line of the token.
+       int m_lastLine;         //!< Ending line of the token.
+};
+
+/*!
+ * \brief The base class for all AST node classes.
+ */
+class ASTNode
+{
+public:
+       //! \brief Default constructor.
+       ASTNode() : m_parent(0) {}
+       
+       //! \brief Constructor taking a parent node.
+       ASTNode(ASTNode * parent) : m_parent(parent) {}
+       
+       //! \brief Copy constructor.
+       ASTNode(const ASTNode & other) : m_parent(other.m_parent) {}
+       
+       //! \brief Destructor.
+       virtual ~ASTNode() {}
+       
+       //! \brief Returns an exact duplicate of this object.
+       virtual ASTNode * clone() const = 0;
+       
+       //! \brief Returns the name of the object's class.
+       virtual std::string nodeName() const { return "ASTNode"; }
+
+       //! \name Parents
+       //@{
+       virtual ASTNode * getParent() const { return m_parent; }
+       virtual void setParent(ASTNode * newParent) { m_parent = newParent; }
+       //@}
+       
+       //! \name Tree printing
+       //@{
+       virtual void printTree() const { printTree(0); }
+       virtual void printTree(int indent) const;
+       //@}
+       
+       //! \name Location
+       //@{
+       virtual void setLocation(token_loc_t & loc) { m_location = loc; }
+       virtual void setLocation(token_loc_t & first, token_loc_t & last);
+       virtual void setLocation(ASTNode * loc) { setLocation(loc->getLocation()); }
+       virtual void setLocation(ASTNode * first, ASTNode * last);
+       
+       virtual token_loc_t & getLocation() { return m_location; }
+       virtual const token_loc_t & getLocation() const { return m_location; }
+       
+       virtual int getFirstLine() { return m_location.m_firstLine; }
+       virtual int getLastLine() { return m_location.m_lastLine; }
+       //@}
+
+protected:
+       ASTNode * m_parent;     //!< Pointer to parent node of this object. May be NULL.
+       token_loc_t m_location; //!< Location of this node in the source file.
+       
+       //! \brief Prints \a indent number of spaces.
+       void printIndent(int indent) const;
+};
+
+/*!
+ * \brief AST node that contains other AST nodes.
+ *
+ * Unlike other AST nodes, the location of a ListASTNode is computed dynamically
+ * based on the nodes in its list. Or mostly dynamic at least. The updateLocation()
+ * method is used to force the list object to recalculate its beginning and ending
+ * line numbers.
+ *
+ * \todo Figure out why it crashes in the destructor when the
+ *       ast_list_t type is a list of smart_ptr<ASTNode>.
+ */
+class ListASTNode : public ASTNode
+{
+public:
+       typedef std::list< /*smart_ptr<ASTNode>*/ ASTNode * > ast_list_t;       
+       typedef ast_list_t::iterator iterator;
+       typedef ast_list_t::const_iterator const_iterator;
+
+public:
+       ListASTNode() {}
+       
+       ListASTNode(const ListASTNode & other);
+       
+       virtual ~ListASTNode();
+       
+       virtual ASTNode * clone() const { return new ListASTNode(*this); }
+       
+       virtual std::string nodeName() const { return "ListASTNode"; }
+
+       virtual void printTree(int indent) const;
+
+       //! \name List operations
+       //@{
+       //! \brief Adds \a node to the end of the ordered list of child nodes.
+       virtual void appendNode(ASTNode * node);
+       
+       //! \brief Returns the number of nodes in this list.
+       virtual unsigned nodeCount() const { return static_cast<unsigned>(m_list.size()); }
+       //@}
+
+       //! \name Node iterators
+       //@{
+       inline iterator begin() { return m_list.begin(); }
+       inline iterator end() { return m_list.end(); }
+
+       inline const_iterator begin() const { return m_list.begin(); }
+       inline const_iterator end() const { return m_list.end(); }
+       //@}
+       
+       //! \name Location
+       //@{
+       virtual void updateLocation();
+       //@}
+
+protected:
+       ast_list_t m_list;      //!< Ordered list of child nodes.
+};
+
+/*!
+ *
+ */
+class OptionsBlockASTNode : public ASTNode
+{
+public:
+       OptionsBlockASTNode(ListASTNode * options) : ASTNode(), m_options(options) {}
+       
+       inline ListASTNode * getOptions() { return m_options; }
+       
+       virtual ASTNode * clone() const { return NULL; }
+
+protected:
+       smart_ptr<ListASTNode> m_options;
+};
+
+/*!
+ *
+ */
+class ConstantsBlockASTNode : public ASTNode
+{
+public:
+       ConstantsBlockASTNode(ListASTNode * constants) : ASTNode(), m_constants(constants) {}
+       
+       inline ListASTNode * getConstants() { return m_constants; }
+       
+       virtual ASTNode * clone() const { return NULL; }
+       
+protected:
+       smart_ptr<ListASTNode> m_constants;
+};
+
+/*!
+ *
+ */
+class SourcesBlockASTNode : public ASTNode
+{
+public:
+       SourcesBlockASTNode(ListASTNode * sources) : ASTNode(), m_sources(sources) {}
+       
+       inline ListASTNode * getSources() { return m_sources; }
+       
+       virtual ASTNode * clone() const { return NULL; }
+       
+protected:
+       smart_ptr<ListASTNode> m_sources;
+};
+
+/*!
+ * \brief Root node for the entire file.
+ */
+class CommandFileASTNode : public ASTNode
+{
+public:
+       CommandFileASTNode();
+       CommandFileASTNode(const CommandFileASTNode & other);
+       
+       virtual std::string nodeName() const { return "CommandFileASTNode"; }
+       
+       virtual ASTNode * clone() const { return new CommandFileASTNode(*this); }
+
+       virtual void printTree(int indent) const;
+
+       inline void setBlocks(ListASTNode * blocks) { m_blocks = blocks; }
+       inline void setOptions(ListASTNode * options) { m_options = options; }
+       inline void setConstants(ListASTNode * constants) { m_constants = constants; }
+       inline void setSources(ListASTNode * sources) { m_sources = sources; }
+       inline void setSections(ListASTNode * sections) { m_sections = sections; }
+       
+       inline ListASTNode * getBlocks() { return m_blocks; }
+       inline ListASTNode * getOptions() { return m_options; }
+       inline ListASTNode * getConstants() { return m_constants; }
+       inline ListASTNode * getSources() { return m_sources; }
+       inline ListASTNode * getSections() { return m_sections; }
+
+protected:
+       smart_ptr<ListASTNode> m_blocks;
+       smart_ptr<ListASTNode> m_options;
+       smart_ptr<ListASTNode> m_constants;
+       smart_ptr<ListASTNode> m_sources;
+       smart_ptr<ListASTNode> m_sections;
+};
+
+/*!
+ * \brief Abstract base class for all expression AST nodes.
+ */
+class ExprASTNode : public ASTNode
+{
+public:
+       ExprASTNode() : ASTNode() {}
+       ExprASTNode(const ExprASTNode & other) : ASTNode(other) {}
+
+       virtual std::string nodeName() const { return "ExprASTNode"; }
+
+       //! \brief Evaluate the expression and produce a result node to replace this one.
+       //!
+       //! The default implementation simply return this node unmodified. This
+       //! method is responsible for deleting any nodes that are no longer needed.
+       //! (?) how to delete this?
+       virtual ExprASTNode * reduce(EvalContext & context) { return this; }
+       
+       int_size_t resultIntSize(int_size_t a, int_size_t b);
+};
+
+/*!
+ *
+ */
+class IntConstExprASTNode : public ExprASTNode
+{
+public:
+       IntConstExprASTNode(uint32_t value, int_size_t size=kWordSize)
+       :       ExprASTNode(), m_value(value), m_size(size)
+       {
+       }
+       
+       IntConstExprASTNode(const IntConstExprASTNode & other);
+
+       virtual std::string nodeName() const { return "IntConstExprASTNode"; }
+       
+       virtual ASTNode * clone() const { return new IntConstExprASTNode(*this); }
+
+       virtual void printTree(int indent) const;
+       
+       uint32_t getValue() const { return m_value; }
+       int_size_t getSize() const { return m_size; }
+
+protected:
+       uint32_t m_value;
+       int_size_t m_size;
+};
+
+/*!
+ *
+ */
+class VariableExprASTNode : public ExprASTNode
+{
+public:
+       VariableExprASTNode(std::string * name) : ExprASTNode(), m_variable(name) {}
+       VariableExprASTNode(const VariableExprASTNode & other);
+       
+       inline std::string * getVariableName() { return m_variable; }
+       
+       virtual ASTNode * clone() const { return new VariableExprASTNode(*this); }
+       
+       virtual std::string nodeName() const { return "VariableExprASTNode"; }
+
+       virtual void printTree(int indent) const;
+       
+       virtual ExprASTNode * reduce(EvalContext & context);
+       
+protected:
+       smart_ptr<std::string> m_variable;
+};
+
+/*!
+ * \brief Expression node for a symbol reference.
+ *
+ * The symbol evaluates to its address.
+ */
+class SymbolRefExprASTNode : public ExprASTNode
+{
+public:
+       SymbolRefExprASTNode(SymbolASTNode * sym) : ExprASTNode(), m_symbol(sym) {}
+       SymbolRefExprASTNode(const SymbolRefExprASTNode & other);
+       
+       virtual ASTNode * clone() const { return new SymbolRefExprASTNode(*this); }
+       
+       virtual std::string nodeName() const { return "SymbolRefExprASTNode"; }
+       
+       virtual void printTree(int indent) const;
+       
+       virtual ExprASTNode * reduce(EvalContext & context);
+       
+protected:
+       SymbolASTNode * m_symbol;
+};
+
+/*!
+ * \brief Negates an expression.
+ */
+class NegativeExprASTNode : public ExprASTNode
+{
+public:
+       NegativeExprASTNode(ExprASTNode * expr) : ExprASTNode(), m_expr(expr) {}
+       NegativeExprASTNode(const NegativeExprASTNode & other);
+
+       virtual ASTNode * clone() const { return new NegativeExprASTNode(*this); }
+
+       virtual std::string nodeName() const { return "NegativeExprASTNode"; }
+       
+       virtual void printTree(int indent) const;
+       
+       virtual ExprASTNode * reduce(EvalContext & context);
+       
+       ExprASTNode * getExpr() { return m_expr; }
+
+protected:
+       smart_ptr<ExprASTNode> m_expr;
+};
+
+/*!
+ * \brief Performa a boolean inversion.
+ */
+class BooleanNotExprASTNode : public ExprASTNode
+{
+public:
+       BooleanNotExprASTNode(ExprASTNode * expr) : ExprASTNode(), m_expr(expr) {}
+       BooleanNotExprASTNode(const BooleanNotExprASTNode & other);
+
+       virtual ASTNode * clone() const { return new BooleanNotExprASTNode(*this); }
+
+       virtual std::string nodeName() const { return "BooleanNotExprASTNode"; }
+       
+       virtual void printTree(int indent) const;
+       
+       virtual ExprASTNode * reduce(EvalContext & context);
+       
+       ExprASTNode * getExpr() { return m_expr; }
+
+protected:
+       smart_ptr<ExprASTNode> m_expr;
+};
+
+/*!
+ * \brief Calls a built-in function with a source as the parameter.
+ */
+class SourceFileFunctionASTNode : public ExprASTNode
+{
+public:
+       SourceFileFunctionASTNode(std::string * functionName, std::string * sourceFileName) : ExprASTNode(), m_functionName(functionName), m_sourceFile(sourceFileName) {}
+       SourceFileFunctionASTNode(const SourceFileFunctionASTNode & other);
+
+       virtual ASTNode * clone() const { return new SourceFileFunctionASTNode(*this); }
+
+       virtual std::string nodeName() const { return "SourceFileFunctionASTNode"; }
+       
+       virtual void printTree(int indent) const;
+       
+       virtual ExprASTNode * reduce(EvalContext & context);
+       
+       std::string * getFunctionName() { return m_functionName; }
+       std::string * getSourceFile() { return m_sourceFile; }
+
+protected:
+       smart_ptr<std::string> m_functionName;
+       smart_ptr<std::string> m_sourceFile;
+};
+
+/*!
+ * \brief Returns true or false depending on whether a constant is defined.
+ */
+class DefinedOperatorASTNode : public ExprASTNode
+{
+public:
+       DefinedOperatorASTNode(std::string * constantName) : ExprASTNode(), m_constantName(constantName) {}
+       DefinedOperatorASTNode(const DefinedOperatorASTNode & other);
+
+       virtual ASTNode * clone() const { return new DefinedOperatorASTNode(*this); }
+
+       virtual std::string nodeName() const { return "DefinedOperatorASTNode"; }
+       
+       virtual void printTree(int indent) const;
+       
+       virtual ExprASTNode * reduce(EvalContext & context);
+       
+       std::string * getConstantName() { return m_constantName; }
+
+protected:
+       smart_ptr<std::string> m_constantName;  //!< Name of the constant.
+};
+
+class SymbolASTNode;
+
+/*!
+ * \brief Returns an integer that is the size in bytes of the operand.
+ */
+class SizeofOperatorASTNode : public ExprASTNode
+{
+public:
+       SizeofOperatorASTNode(std::string * constantName) : ExprASTNode(), m_constantName(constantName), m_symbol() {}
+       SizeofOperatorASTNode(SymbolASTNode * symbol) : ExprASTNode(), m_constantName(), m_symbol(symbol) {}
+       SizeofOperatorASTNode(const SizeofOperatorASTNode & other);
+
+       virtual ASTNode * clone() const { return new SizeofOperatorASTNode(*this); }
+
+       virtual std::string nodeName() const { return "SizeofOperatorASTNode"; }
+       
+       virtual void printTree(int indent) const;
+       
+       virtual ExprASTNode * reduce(EvalContext & context);
+       
+       std::string * getConstantName() { return m_constantName; }
+       SymbolASTNode * getSymbol() { return m_symbol; }
+
+protected:
+       smart_ptr<std::string> m_constantName;  //!< Name of the constant.
+       smart_ptr<SymbolASTNode> m_symbol;      //!< Symbol reference. If this is non-NULL then the constant name is used instead.
+};
+
+/*!
+ *
+ */
+class BinaryOpExprASTNode : public ExprASTNode
+{
+public:
+       enum operator_t
+       {
+               kAdd,
+               kSubtract,
+               kMultiply,
+               kDivide,
+               kModulus,
+               kPower,
+               kBitwiseAnd,
+               kBitwiseOr,
+               kBitwiseXor,
+               kShiftLeft,
+               kShiftRight,
+               kLessThan,
+               kGreaterThan,
+               kLessThanEqual,
+               kGreaterThanEqual,
+               kEqual,
+               kNotEqual,
+               kBooleanAnd,
+               kBooleanOr
+       };
+       
+       BinaryOpExprASTNode(ExprASTNode * left, operator_t op, ExprASTNode * right)
+       :       ExprASTNode(), m_left(left), m_op(op), m_right(right)
+       {
+       }
+       
+       BinaryOpExprASTNode(const BinaryOpExprASTNode & other);
+       
+       virtual ASTNode * clone() const { return new BinaryOpExprASTNode(*this); }
+
+       virtual std::string nodeName() const { return "BinaryOpExprASTNode"; }
+       
+       virtual void printTree(int indent) const;
+       
+       virtual ExprASTNode * reduce(EvalContext & context);
+       
+       ExprASTNode * getLeftExpr() { return m_left; }
+       ExprASTNode * getRightExpr() { return m_right; }
+       operator_t getOp() const { return m_op; }
+
+protected:
+       smart_ptr<ExprASTNode> m_left;
+       smart_ptr<ExprASTNode> m_right;
+       operator_t m_op;
+       
+       std::string getOperatorName() const;
+};
+
+/*!
+ * \brief Negates an expression.
+ */
+class IntSizeExprASTNode : public ExprASTNode
+{
+public:
+       IntSizeExprASTNode(ExprASTNode * expr, int_size_t intSize) : ExprASTNode(), m_expr(expr), m_size(intSize) {}
+       IntSizeExprASTNode(const IntSizeExprASTNode & other);
+       
+       virtual ASTNode * clone() const { return new IntSizeExprASTNode(*this); }
+
+       virtual std::string nodeName() const { return "IntSizeExprASTNode"; }
+       
+       virtual void printTree(int indent) const;
+       
+       virtual ExprASTNode * reduce(EvalContext & context);
+       
+       ExprASTNode * getExpr() { return m_expr; }
+       int_size_t getIntSize() { return m_size; }
+
+protected:
+       smart_ptr<ExprASTNode> m_expr;
+       int_size_t m_size;
+};
+
+/*!
+ * Base class for const AST nodes.
+ */
+class ConstASTNode : public ASTNode
+{
+public:
+       ConstASTNode() : ASTNode() {}
+       ConstASTNode(const ConstASTNode & other) : ASTNode(other) {}
+
+protected:
+};
+
+/*!
+ *
+ */
+class ExprConstASTNode : public ConstASTNode
+{
+public:
+       ExprConstASTNode(ExprASTNode * expr) : ConstASTNode(), m_expr(expr) {}
+       ExprConstASTNode(const ExprConstASTNode & other);
+       
+       virtual ASTNode * clone() const { return new ExprConstASTNode(*this); }
+
+       virtual std::string nodeName() const { return "ExprConstASTNode"; }
+       
+       virtual void printTree(int indent) const;
+       
+       ExprASTNode * getExpr() { return m_expr; }
+
+protected:
+       smart_ptr<ExprASTNode> m_expr;
+};
+
+/*!
+ *
+ */
+class StringConstASTNode : public ConstASTNode
+{
+public:
+       StringConstASTNode(std::string * value) : ConstASTNode(), m_value(value) {}
+       StringConstASTNode(const StringConstASTNode & other);
+       
+       virtual ASTNode * clone() const { return new StringConstASTNode(*this); }
+
+       virtual std::string nodeName() const { return "StringConstASTNode"; }
+       
+       virtual void printTree(int indent) const;
+
+       std::string * getString() { return m_value; }
+
+protected:
+       smart_ptr<std::string> m_value;
+};
+
+/*!
+ *
+ */
+class BlobConstASTNode : public ConstASTNode
+{
+public:
+       BlobConstASTNode(Blob * value) : ConstASTNode(), m_blob(value) {}
+       BlobConstASTNode(const BlobConstASTNode & other);
+       
+       virtual ASTNode * clone() const { return new BlobConstASTNode(*this); }
+
+       virtual std::string nodeName() const { return "BlobConstASTNode"; }
+       
+       virtual void printTree(int indent) const;
+
+       Blob * getBlob() { return m_blob; }
+
+protected:
+       smart_ptr<Blob> m_blob;
+};
+
+// Forward declaration.
+struct hab_ivt;
+
+/*!
+ * \brief Node for a constant IVT structure as used by HAB4.
+ */
+class IVTConstASTNode : public ConstASTNode
+{
+public:
+    IVTConstASTNode() : ConstASTNode(), m_fields() {}
+    IVTConstASTNode(const IVTConstASTNode & other);
+    
+       virtual ASTNode * clone() const { return new IVTConstASTNode(*this); }
+    
+       virtual std::string nodeName() const { return "IVTConstASTNode"; }
+
+       virtual void printTree(int indent) const;
+    
+    void setFieldAssignments(ListASTNode * fields) { m_fields = fields; }
+    ListASTNode * getFieldAssignments() { return m_fields; }
+
+protected:
+    //! Fields of the IVT are set through assignment statements.
+    smart_ptr<ListASTNode> m_fields;
+};
+
+/*!
+ *
+ */
+class AssignmentASTNode : public ASTNode
+{
+public:
+       AssignmentASTNode(std::string * ident, ASTNode * value)
+       :       ASTNode(), m_ident(ident), m_value(value)
+       {
+       }
+       
+       AssignmentASTNode(const AssignmentASTNode & other);
+       
+       virtual ASTNode * clone() const { return new AssignmentASTNode(*this); }
+
+       virtual std::string nodeName() const { return "AssignmentASTNode"; }
+       
+       virtual void printTree(int indent) const;
+       
+       inline std::string * getIdent() { return m_ident; }
+       inline ASTNode * getValue() { return m_value; }
+
+protected:
+       smart_ptr<std::string> m_ident;
+       smart_ptr<ASTNode> m_value;
+};
+
+/*!
+ * Base class for PathSourceDefASTNode and ExternSourceDefASTNode.
+ */
+class SourceDefASTNode : public ASTNode
+{
+public:
+       SourceDefASTNode(std::string * name) : m_name(name) {}
+       SourceDefASTNode(const SourceDefASTNode & other);
+       
+       inline std::string * getName() { return m_name; }
+
+       inline void setAttributes(ListASTNode * attributes) { m_attributes = attributes; }
+       inline ListASTNode * getAttributes() { return m_attributes; }
+       
+protected:
+       smart_ptr<std::string> m_name;
+       smart_ptr<ListASTNode> m_attributes;
+};
+
+/*!
+ *
+ */
+class PathSourceDefASTNode : public SourceDefASTNode
+{
+public:
+       PathSourceDefASTNode(std::string * name, std::string * path)
+       :       SourceDefASTNode(name), m_path(path)
+       {
+       }
+       
+       PathSourceDefASTNode(const PathSourceDefASTNode & other);
+       
+       virtual PathSourceDefASTNode * clone() const { return new PathSourceDefASTNode(*this); }
+
+       virtual std::string nodeName() const { return "PathSourceDefASTNode"; }
+       
+       virtual void printTree(int indent) const;
+       
+       std::string * getPath() { return m_path; }
+       
+protected:
+       smart_ptr<std::string> m_path;
+};
+
+/*!
+ *
+ */
+class ExternSourceDefASTNode : public SourceDefASTNode
+{
+public:
+       ExternSourceDefASTNode(std::string * name, ExprASTNode * expr)
+       :       SourceDefASTNode(name), m_expr(expr)
+       {
+       }
+       
+       ExternSourceDefASTNode(const ExternSourceDefASTNode & other);
+       
+       virtual ASTNode * clone() const { return new ExternSourceDefASTNode(*this); }
+
+       virtual std::string nodeName() const { return "ExternSourceDefASTNode"; }
+       
+       virtual void printTree(int indent) const;
+       
+       ExprASTNode * getSourceNumberExpr() { return m_expr; }
+
+protected:
+       smart_ptr<ExprASTNode> m_expr;
+};
+
+/*!
+ *
+ */
+class SectionContentsASTNode : public ASTNode
+{
+public:
+       SectionContentsASTNode() : m_sectionExpr() {}
+       SectionContentsASTNode(ExprASTNode * section) : m_sectionExpr(section) {}
+       SectionContentsASTNode(const SectionContentsASTNode & other);
+       
+       virtual ASTNode * clone() const { return new SectionContentsASTNode(*this); }
+
+       virtual std::string nodeName() const { return "SectionContentsASTNode"; }
+       
+       virtual void printTree(int indent) const;
+       
+       inline void setSectionNumberExpr(ExprASTNode * section)
+       {
+               m_sectionExpr = section;
+       }
+       
+       inline ExprASTNode * getSectionNumberExpr()
+       {
+               return m_sectionExpr;
+       }
+       
+       inline void setOptions(ListASTNode * options)
+       {
+               m_options = options;
+       }
+       
+       inline ListASTNode * getOptions()
+       {
+               return m_options;
+       }
+
+protected:
+       smart_ptr<ExprASTNode> m_sectionExpr;
+       smart_ptr<ListASTNode> m_options;
+};
+
+/*!
+ * @brief Node representing a raw binary section definition.
+ */
+class DataSectionContentsASTNode : public SectionContentsASTNode
+{
+public:
+       DataSectionContentsASTNode(ASTNode * contents)
+       :       SectionContentsASTNode(), m_contents(contents)
+       {
+       }
+       
+       DataSectionContentsASTNode(const DataSectionContentsASTNode & other);
+       
+       virtual ASTNode * clone() const { return new DataSectionContentsASTNode(*this); }
+
+       virtual std::string nodeName() const { return "DataSectionContentsASTNode"; }
+       
+       virtual void printTree(int indent) const;
+       
+       ASTNode * getContents() { return m_contents; }
+       
+protected:
+       smart_ptr<ASTNode> m_contents;
+};
+
+/*!
+ *
+ */
+class BootableSectionContentsASTNode : public SectionContentsASTNode
+{
+public:
+       BootableSectionContentsASTNode(ListASTNode * statements)
+       :       SectionContentsASTNode(), m_statements(statements)
+       {
+       }
+       
+       BootableSectionContentsASTNode(const BootableSectionContentsASTNode & other);
+       
+       virtual ASTNode * clone() const { return new BootableSectionContentsASTNode(*this); }
+
+       virtual std::string nodeName() const { return "BootableSectionContentsASTNode"; }
+       
+       virtual void printTree(int indent) const;
+       
+       ListASTNode * getStatements() { return m_statements; }
+
+protected:
+       smart_ptr<ListASTNode> m_statements;
+};
+
+/*!
+ *
+ */
+class StatementASTNode : public ASTNode
+{
+public:
+       StatementASTNode() : ASTNode() {}
+       StatementASTNode(const StatementASTNode & other) : ASTNode(other) {}
+
+protected:
+};
+
+/*!
+ *
+ */
+class IfStatementASTNode : public StatementASTNode
+{
+public:
+       IfStatementASTNode() : StatementASTNode(), m_ifStatements(), m_nextIf(), m_elseStatements() {}
+       IfStatementASTNode(const IfStatementASTNode & other);
+       
+       virtual ASTNode * clone() const { return new IfStatementASTNode(*this); }
+       
+       void setConditionExpr(ExprASTNode * expr) { m_conditionExpr = expr; }
+       ExprASTNode * getConditionExpr() { return m_conditionExpr; }
+       
+       void setIfStatements(ListASTNode * statements) { m_ifStatements = statements; }
+       ListASTNode * getIfStatements() { return m_ifStatements; }
+       
+       void setNextIf(IfStatementASTNode * nextIf) { m_nextIf = nextIf; }
+       IfStatementASTNode * getNextIf() { return m_nextIf; }
+       
+       void setElseStatements(ListASTNode * statements) { m_elseStatements = statements; }
+       ListASTNode * getElseStatements() { return m_elseStatements; }
+
+protected:
+       smart_ptr<ExprASTNode> m_conditionExpr; //!< Boolean expression.
+       smart_ptr<ListASTNode> m_ifStatements;  //!< List of "if" section statements.
+       smart_ptr<IfStatementASTNode> m_nextIf; //!< Link to next "else if". If this is non-NULL then #m_elseStatements must be NULL and vice-versa.
+       smart_ptr<ListASTNode> m_elseStatements;        //!< Statements for the "else" part of the statements.
+};
+
+/*!
+ * \brief Statement to insert a ROM_MODE_CMD command.
+ */
+class ModeStatementASTNode : public StatementASTNode
+{
+public:
+       ModeStatementASTNode() : StatementASTNode(), m_modeExpr() {}
+       ModeStatementASTNode(ExprASTNode * modeExpr) : StatementASTNode(), m_modeExpr(modeExpr) {}
+       ModeStatementASTNode(const ModeStatementASTNode & other);
+       
+       virtual ASTNode * clone() const { return new ModeStatementASTNode(*this); }
+       
+       virtual std::string nodeName() const { return "ModeStatementASTNode"; }
+       
+       virtual void printTree(int indent) const;
+       
+       inline void setModeExpr(ExprASTNode * modeExpr) { m_modeExpr = modeExpr; }
+       inline ExprASTNode * getModeExpr() { return m_modeExpr; }
+
+protected:
+       smart_ptr<ExprASTNode> m_modeExpr;      //!< Expression that evaluates to the new boot mode.
+};
+
+/*!
+ * \brief Statement to print a message to the elftosb user.
+ */
+class MessageStatementASTNode : public StatementASTNode
+{
+public:
+       enum _message_type
+       {
+               kInfo,  //!< Prints an informational messag to the user.
+               kWarning,       //!< Prints a warning to the user.
+               kError  //!< Throws an error exception.
+       };
+       
+       typedef enum _message_type message_type_t;
+       
+public:
+       MessageStatementASTNode(message_type_t messageType, std::string * message) : StatementASTNode(), m_type(messageType), m_message(message) {}
+       MessageStatementASTNode(const MessageStatementASTNode & other);
+       
+       virtual ASTNode * clone() const { return new MessageStatementASTNode(*this); }
+       
+       virtual std::string nodeName() const { return "MessageStatementASTNode"; }
+       
+       virtual void printTree(int indent) const;
+       
+       inline message_type_t getType() { return m_type; }
+       inline std::string * getMessage() { return m_message; }
+       
+       const char * getTypeName() const;
+
+protected:
+       message_type_t m_type;
+       smart_ptr<std::string> m_message;       //!< Message to report.
+};
+
+/*!
+ * \brief AST node for a load statement.
+ */
+class LoadStatementASTNode : public StatementASTNode
+{
+public:
+       LoadStatementASTNode()
+       :       StatementASTNode(), m_data(), m_target(), m_isDCDLoad(false)
+       {
+       }
+       
+       LoadStatementASTNode(ASTNode * data, ASTNode * target)
+       :       StatementASTNode(), m_data(data), m_target(), m_isDCDLoad(false)
+       {
+       }
+       
+       LoadStatementASTNode(const LoadStatementASTNode & other);
+       
+       virtual ASTNode * clone() const { return new LoadStatementASTNode(*this); }
+
+       virtual std::string nodeName() const { return "LoadStatementASTNode"; }
+       
+       virtual void printTree(int indent) const;
+       
+       inline void setData(ASTNode * data) { m_data = data; }
+       inline ASTNode * getData() { return m_data; }
+       
+       inline void setTarget(ASTNode * target) { m_target = target; }
+       inline ASTNode * getTarget() { return m_target; }
+       
+       inline void setDCDLoad(bool isDCD) { m_isDCDLoad = isDCD; }
+       inline bool isDCDLoad() const { return m_isDCDLoad; }
+       
+protected:
+       smart_ptr<ASTNode> m_data;
+       smart_ptr<ASTNode> m_target;
+       bool m_isDCDLoad;
+};
+
+/*!
+ * \brief AST node for a call statement.
+ */
+class CallStatementASTNode : public StatementASTNode
+{
+public:
+       //! Possible sub-types of call statements.
+       typedef enum {
+               kCallType,
+               kJumpType
+       } call_type_t;
+       
+public:
+       CallStatementASTNode(call_type_t callType=kCallType)
+       :       StatementASTNode(), m_type(callType), m_target(), m_arg(), m_isHAB(false)
+       {
+       }
+       
+       CallStatementASTNode(call_type_t callType, ASTNode * target, ASTNode * arg)
+       :       StatementASTNode(), m_type(callType), m_target(target), m_arg(arg), m_isHAB(false)
+       {
+       }
+       
+       CallStatementASTNode(const CallStatementASTNode & other);
+       
+       virtual ASTNode * clone() const { return new CallStatementASTNode(*this); }
+
+       virtual std::string nodeName() const { return "CallStatementASTNode"; }
+       
+       virtual void printTree(int indent) const;
+       
+       inline void setCallType(call_type_t callType) { m_type = callType; }
+       inline call_type_t getCallType() { return m_type; }
+       
+       inline void setTarget(ASTNode * target) { m_target = target; }
+       inline ASTNode * getTarget() { return m_target; }
+       
+       inline void setArgument(ASTNode * arg) { m_arg = arg; }
+       inline ASTNode * getArgument() { return m_arg; }
+       
+       inline void setIsHAB(bool isHAB) { m_isHAB = isHAB; }
+       inline bool isHAB() const { return m_isHAB; }
+       
+protected:
+       call_type_t m_type;
+       smart_ptr<ASTNode> m_target;    //!< This becomes the IVT address in HAB mode.
+       smart_ptr<ASTNode> m_arg;
+       bool m_isHAB;
+};
+
+/*!
+ *
+ */
+class SourceASTNode : public ASTNode
+{
+public:
+       SourceASTNode(std::string * name) : ASTNode(), m_name(name) {}
+       SourceASTNode(const SourceASTNode & other);
+       
+       virtual ASTNode * clone() const { return new SourceASTNode(*this); }
+
+       virtual std::string nodeName() const { return "SourceASTNode"; }
+       
+       virtual void printTree(int indent) const;
+       
+       inline std::string * getSourceName() { return m_name; }
+       
+protected:
+       smart_ptr<std::string> m_name;
+};
+
+/*!
+ * \brief List of section matches for a particular source name.
+ */
+class SectionMatchListASTNode : public ASTNode
+{
+public:
+       SectionMatchListASTNode(ListASTNode * sections)
+       :       ASTNode(), m_sections(sections), m_source()
+       {
+       }
+       
+       SectionMatchListASTNode(ListASTNode * sections, std::string * source)
+       :       ASTNode(), m_sections(sections), m_source(source)
+       {
+       }
+       
+       SectionMatchListASTNode(const SectionMatchListASTNode & other);
+       
+       virtual ASTNode * clone() const { return new SectionMatchListASTNode(*this); }
+
+       virtual std::string nodeName() const { return "SectionMatchListASTNode"; }
+       
+       virtual void printTree(int indent) const;
+       
+       inline ListASTNode * getSections() { return m_sections; }
+       inline std::string * getSourceName() { return m_source; }
+       
+protected:
+       smart_ptr<ListASTNode> m_sections;
+       smart_ptr<std::string> m_source;
+};
+
+/*!
+ * \brief AST node for a section glob.
+ *
+ * Can be assigned an include or exclude action for when this node is part of a
+ * SectionMatchListASTNode.
+ */
+class SectionASTNode : public ASTNode
+{
+public:
+       //! Possible actions for a section match list.
+       typedef enum
+       {
+               kInclude,       //!< Include sections matched by this node.
+               kExclude        //!< Exclude sections matched by this node.
+       } match_action_t;
+       
+public:
+       SectionASTNode(std::string * name)
+       :       ASTNode(), m_action(kInclude), m_name(name), m_source()
+       {
+       }
+       
+       SectionASTNode(std::string * name, match_action_t action)
+       :       ASTNode(), m_action(action), m_name(name), m_source()
+       {
+       }
+       
+       SectionASTNode(std::string * name, std::string * source)
+       :       ASTNode(), m_action(kInclude), m_name(name), m_source(source)
+       {
+       }
+       
+       SectionASTNode(const SectionASTNode & other);
+       
+       virtual ASTNode * clone() const { return new SectionASTNode(*this); }
+
+       virtual std::string nodeName() const { return "SectionASTNode"; }
+       
+       virtual void printTree(int indent) const;
+       
+       inline match_action_t getAction() { return m_action; }
+       inline std::string * getSectionName() { return m_name; }
+       inline std::string * getSourceName() { return m_source; }
+       
+protected:
+       match_action_t m_action;
+       smart_ptr<std::string> m_name;
+       smart_ptr<std::string> m_source;
+};
+
+/*!
+ *
+ */
+class SymbolASTNode : public ASTNode
+{
+public:
+       SymbolASTNode()
+       :       ASTNode(), m_symbol(), m_source()
+       {
+       }
+
+       SymbolASTNode(std::string * symbol, std::string * source=0)
+       :       ASTNode(), m_symbol(symbol), m_source(source)
+       {
+       }
+       
+       SymbolASTNode(const SymbolASTNode & other);
+       
+       virtual ASTNode * clone() const { return new SymbolASTNode(*this); }
+
+       virtual std::string nodeName() const { return "SymbolASTNode"; }
+       
+       virtual void printTree(int indent) const;
+       
+       inline void setSymbolName(std::string * symbol) { m_symbol = symbol; }
+       inline std::string * getSymbolName() { return m_symbol; }
+       
+       inline void setSource(std::string * source) { m_source = source; }
+       inline std::string * getSource() { return m_source; }
+
+protected:
+       smart_ptr<std::string> m_symbol;        //!< Required.
+       smart_ptr<std::string> m_source;        //!< Optional, may be NULL;
+};
+
+/*!
+ * If the end of the range is NULL, then only a single address was specified.
+ */
+class AddressRangeASTNode : public ASTNode
+{
+public:
+       AddressRangeASTNode()
+       :       ASTNode(), m_begin(), m_end()
+       {
+       }
+       
+       AddressRangeASTNode(ASTNode * begin, ASTNode * end)
+       :       ASTNode(), m_begin(begin), m_end(end)
+       {
+       }
+       
+       AddressRangeASTNode(const AddressRangeASTNode & other);
+       
+       virtual ASTNode * clone() const { return new AddressRangeASTNode(*this); }
+
+       virtual std::string nodeName() const { return "AddressRangeASTNode"; }
+       
+       virtual void printTree(int indent) const;
+       
+       inline void setBegin(ASTNode * begin) { m_begin = begin; }
+       inline ASTNode * getBegin() { return m_begin; }
+       
+       inline void setEnd(ASTNode * end) { m_end = end; }
+       inline ASTNode * getEnd() { return m_end; }
+       
+protected:
+       smart_ptr<ASTNode> m_begin;
+       smart_ptr<ASTNode> m_end;
+};
+
+/*!
+ *
+ */
+class NaturalLocationASTNode : public ASTNode
+{
+public:
+       NaturalLocationASTNode()
+       :       ASTNode()
+       {
+       }
+       
+       NaturalLocationASTNode(const NaturalLocationASTNode & other)
+       :       ASTNode(other)
+       {
+       }
+       
+       virtual ASTNode * clone() const { return new NaturalLocationASTNode(*this); }
+
+       virtual std::string nodeName() const { return "NaturalLocationASTNode"; }
+};
+
+/*!
+ *
+ */
+class FromStatementASTNode : public StatementASTNode
+{
+public:
+       FromStatementASTNode() : StatementASTNode() {}
+       FromStatementASTNode(std::string * source, ListASTNode * statements);
+       FromStatementASTNode(const FromStatementASTNode & other);
+       
+       virtual ASTNode * clone() const { return new FromStatementASTNode(*this); }
+
+       virtual std::string nodeName() const { return "FromStatementASTNode"; }
+       
+       virtual void printTree(int indent) const;
+       
+       inline void setSourceName(std::string * source) { m_source = source; }
+       inline std::string * getSourceName() { return m_source; }
+       
+       inline void setStatements(ListASTNode * statements) { m_statements = statements; }
+       inline ListASTNode * getStatements() { return m_statements; }
+
+protected:
+       smart_ptr<std::string> m_source;
+       smart_ptr<ListASTNode> m_statements;
+};
+
+}; // namespace elftosb
+
+#endif // _ElftosbAST_h_
diff --git a/tools/elftosb/elftosb2/ElftosbErrors.h b/tools/elftosb/elftosb2/ElftosbErrors.h
new file mode 100644 (file)
index 0000000..abb546a
--- /dev/null
@@ -0,0 +1,29 @@
+/*
+ * File:       ConversionController.h
+ *
+ * Copyright (c) Freescale Semiconductor, Inc. All rights reserved.
+ * See included license file for license details.
+ */
+#if !defined(_ElftosbErrors_h_)
+#define _ElftosbErrors_h_
+
+#include <string>
+#include <stdexcept>
+
+namespace elftosb
+{
+
+/*!
+ * \brief A semantic error discovered while processing the command file AST.
+ */
+class semantic_error : public std::runtime_error
+{
+public:
+       explicit semantic_error(const std::string & msg)
+       :       std::runtime_error(msg)
+       {}
+};
+
+}; // namespace elftosb
+
+#endif // _ElftosbErrors_h_
diff --git a/tools/elftosb/elftosb2/ElftosbLexer.cpp b/tools/elftosb/elftosb2/ElftosbLexer.cpp
new file mode 100644 (file)
index 0000000..b1ba327
--- /dev/null
@@ -0,0 +1,149 @@
+/*
+ * File:       ElftosbLexer.cpp
+ *
+ * Copyright (c) Freescale Semiconductor, Inc. All rights reserved.
+ * See included license file for license details.
+ */
+#include "ElftosbLexer.h"
+#include <algorithm>
+#include "HexValues.h"
+
+using namespace elftosb;
+
+ElftosbLexer::ElftosbLexer(istream & inputStream)
+:      yyFlexLexer(&inputStream), m_line(1), m_blob(0), m_blobFirstLine(0)
+{
+}
+
+void ElftosbLexer::getSymbolValue(YYSTYPE * value)
+{
+       if (!value)
+       {
+               return;
+       }
+       *value = m_symbolValue;
+}
+
+void ElftosbLexer::addSourceName(std::string * ident)
+{
+       m_sources.push_back(*ident);
+}
+
+bool ElftosbLexer::isSourceName(std::string * ident)
+{
+       string_vector_t::iterator it = find(m_sources.begin(), m_sources.end(), *ident);
+       return it != m_sources.end();
+}
+
+void ElftosbLexer::LexerError(const char * msg)
+{
+       throw elftosb::lexical_error(msg);
+}
+
+//! Reads the \a in string and writes to the \a out string. These strings can be the same
+//! string since the read head is always in front of the write head.
+//!
+//! \param[in] in Input string containing C-style escape sequences.
+//! \param[out] out Output string. All escape sequences in the input string have been converted
+//!            to the actual characters. May point to the same string as \a in.
+//! \return The length of the resulting \a out string. This length is necessary because
+//!            the string may have contained escape sequences that inserted null characters.
+int ElftosbLexer::processStringEscapes(const char * in, char * out)
+{
+       int count = 0;
+       while (*in)
+       {
+               switch (*in)
+               {
+                       case '\\':
+                       {
+                               // start of an escape sequence
+                               char c = *++in;
+                               switch (c)
+                               {
+                                       case 0: // end of the string, bail
+                                               break;
+                                       case 'x':
+                                       {
+                                               // start of a hex char escape sequence
+                                               
+                                               // read high and low nibbles, checking for end of string
+                                               char hi = *++in;
+                                               if (hi == 0) break;
+                                               char lo = *++in;
+                                               if (lo == 0) break;
+                                               
+                                               if (isHexDigit(hi) && isHexDigit(lo))
+                                               {
+                                                       if (hi >= '0' && hi <= '9')
+                                                               c = (hi - '0') << 4;
+                                                       else if (hi >= 'A' && hi <= 'F')
+                                                               c = (hi - 'A' + 10) << 4;
+                                                       else if (hi >= 'a' && hi <= 'f')
+                                                               c = (hi - 'a' + 10) << 4;
+                                                       
+                                                       if (lo >= '0' && lo <= '9')
+                                                               c |= lo - '0';
+                                                       else if (lo >= 'A' && lo <= 'F')
+                                                               c |= lo - 'A' + 10;
+                                                       else if (lo >= 'a' && lo <= 'f')
+                                                               c |= lo - 'a' + 10;
+                                                               
+                                                       *out++ = c;
+                                                       count++;
+                                               }
+                                               else
+                                               {
+                                                       // not hex digits, the \x must have wanted an 'x' char
+                                                       *out++ = 'x';
+                                                       *out++ = hi;
+                                                       *out++ = lo;
+                                                       count += 3;
+                                               }
+                                               break;
+                                       }
+                                       case 'n':
+                                               *out++ = '\n';
+                                               count++;
+                                               break;
+                                       case 't':
+                                               *out++ = '\t';
+                                               count++;
+                                               break;
+                                       case 'r':
+                                               *out++ = '\r';
+                                               count++;
+                                               break;
+                                       case 'b':
+                                               *out++ = '\b';
+                                               count++;
+                                               break;
+                                       case 'f':
+                                               *out++ = '\f';
+                                               count++;
+                                               break;
+                                       case '0':
+                                               *out++ = '\0';
+                                               count++;
+                                               break;
+                                       default:
+                                               *out++ = c;
+                                               count++;
+                                               break;
+                               }
+                               break;
+                       }
+                       
+                       default:
+                               // copy all other chars directly
+                               *out++ = *in++;
+                               count++;
+               }
+       }
+       
+       // place terminating null char on output
+       *out = 0;
+       return count;
+}
+
+
diff --git a/tools/elftosb/elftosb2/ElftosbLexer.h b/tools/elftosb/elftosb2/ElftosbLexer.h
new file mode 100644 (file)
index 0000000..04a16f9
--- /dev/null
@@ -0,0 +1,97 @@
+/*
+ * File:       ElftosbLexer.h
+ *
+ * Copyright (c) Freescale Semiconductor, Inc. All rights reserved.
+ * See included license file for license details.
+ */
+
+// This header just wraps the standard flex C++ header to make it easier to include
+// without having to worry about redefinitions of the class name every time.
+
+#if !defined(_ElftosbLexer_h_)
+#define _ElftosbLexer_h_
+
+#include "ElftosbAST.h"
+#include "FlexLexer.h"
+#include "elftosb_parser.tab.hpp"
+#include <vector>
+#include <string>
+#include <stdexcept>
+#include "Blob.h"
+
+using namespace std;
+
+namespace elftosb
+{
+
+/*!
+ * \brief Exception class for syntax errors.
+ */
+class syntax_error : public std::runtime_error
+{
+public:
+       explicit syntax_error(const std::string & __arg) : std::runtime_error(__arg) {}
+};
+
+/*!
+ * \brief Exception class for lexical errors.
+ */
+class lexical_error : public std::runtime_error
+{
+public:
+       explicit lexical_error(const std::string & __arg) : std::runtime_error(__arg) {}
+};
+
+/*!
+ * \brief Lexical scanner class for elftosb command files.
+ *
+ * This class is a subclass of the standard C++ lexer class produced by
+ * Flex. It's primary purpose is to provide a clean way to report values
+ * for symbols, without using the yylval global. This is necessary because
+ * the parser produced by Bison is a "pure" parser.
+ *
+ * In addition, this class manages a list of source names generated by
+ * parsing. The lexer uses this list to determine if an identifier is
+ * a source name or a constant identifier.
+ */
+class ElftosbLexer : public yyFlexLexer
+{
+public:
+       //! \brief Constructor.
+       ElftosbLexer(istream & inputStream);
+
+       //! \brief Lexer interface. Returns one token.
+       virtual int yylex();
+       
+       //! \brief Returns the value for the most recently produced token in \a value.
+       virtual void getSymbolValue(YYSTYPE * value);
+       
+       //! \brief Returns the current token's location in \a loc.
+       inline token_loc_t & getLocation() { return m_location; }
+       
+       //! \name Source names
+       //@{
+       void addSourceName(std::string * ident);
+       bool isSourceName(std::string * ident);
+       //@}
+
+protected:
+       YYSTYPE m_symbolValue;  //!< Value for the current token.
+       int m_line;     //!< Current line number.
+       token_loc_t m_location; //!< Location for the current token.
+       Blob * m_blob;  //!< The binary object value as its being constructed.
+       int m_blobFirstLine;    //!< Line number for the first character of a blob.
+
+       typedef std::vector<std::string> string_vector_t;
+       string_vector_t m_sources;      //!< Vector of source identifiers;
+       
+       //! \brief Throw an elftosb::lexical_error exception.
+       virtual void LexerError(const char * msg);
+
+       //! \brief Process a string containing escape sequences.
+       int processStringEscapes(const char * in, char * out);
+};
+
+}; // namespace elftosb
+
+#endif // _ElftosbLexer_h_
diff --git a/tools/elftosb/elftosb2/EncoreBootImageGenerator.cpp b/tools/elftosb/elftosb2/EncoreBootImageGenerator.cpp
new file mode 100644 (file)
index 0000000..9bb65c2
--- /dev/null
@@ -0,0 +1,297 @@
+/*
+ * File:       EncoreBootImageGenerator.cpp
+ *
+ * Copyright (c) Freescale Semiconductor, Inc. All rights reserved.
+ * See included license file for license details.
+ */
+
+#include "EncoreBootImageGenerator.h"
+#include "Logging.h"
+
+#define kFlagsOption "flags"
+#define kSectionFlagsOption "sectionFlags"
+#define kProductVersionOption "productVersion"
+#define kComponentVersionOption "componentVersion"
+#define kAlignmentOption "alignment"
+#define kCleartextOption "cleartext"
+
+using namespace elftosb;
+
+BootImage * EncoreBootImageGenerator::generate()
+{
+       EncoreBootImage * image = new EncoreBootImage();
+       
+       // process each output section
+       section_vector_t::iterator it = m_sections.begin();
+       for (; it != m_sections.end(); ++it)
+       {
+               OutputSection * section = *it;
+               
+               OperationSequenceSection * opSection = dynamic_cast<OperationSequenceSection*>(section);
+               if (opSection)
+               {
+                       processOperationSection(opSection, image);
+                       continue;
+               }
+               
+               BinaryDataSection * dataSection = dynamic_cast<BinaryDataSection*>(section);
+               if (dataSection)
+               {
+                       processDataSection(dataSection, image);
+                       continue;
+               }
+               
+               Log::log(Logger::WARNING, "warning: unexpected output section type\n");
+       }
+       
+       // handle global options that affect the image
+       processOptions(image);
+       
+       return image;
+}
+
+void EncoreBootImageGenerator::processOptions(EncoreBootImage * image)
+{
+       // bail if no option context was set
+       if (!m_options)
+       {
+               return;
+       }
+       
+       if (m_options->hasOption(kFlagsOption))
+       {
+        const IntegerValue * intValue = dynamic_cast<const IntegerValue *>(m_options->getOption(kFlagsOption));
+               if (intValue)
+               {
+                       image->setFlags(intValue->getValue());
+               }
+        else
+        {
+            Log::log(Logger::WARNING, "warning: flags option is an unexpected type\n");
+        }
+       }
+       
+    // handle common options
+       processVersionOptions(image);
+       processDriveTagOption(image);
+}
+
+void EncoreBootImageGenerator::processSectionOptions(EncoreBootImage::Section * imageSection, OutputSection * modelSection)
+{
+       // Get options context for this output section.
+       const OptionContext * context = modelSection->getOptions();
+       if (!context)
+       {
+               return;
+       }
+       
+       // Check for and handle "sectionFlags" option.
+       if (context->hasOption(kSectionFlagsOption))
+       {
+               const Value * value = context->getOption(kSectionFlagsOption);
+        const IntegerValue * intValue = dynamic_cast<const IntegerValue *>(value);
+               if (intValue)
+               {
+                       // set explicit flags for this section
+                       imageSection->setFlags(intValue->getValue());
+               }
+        else
+        {
+            Log::log(Logger::WARNING, "warning: sectionFlags option is an unexpected type\n");
+        }
+       }
+       
+       // Check for and handle "alignment" option.
+       if (context->hasOption(kAlignmentOption))
+       {
+               const Value * value = context->getOption(kAlignmentOption);
+        const IntegerValue * intValue = dynamic_cast<const IntegerValue *>(value);
+               if (intValue)
+               {
+                       // verify alignment value
+                       if (intValue->getValue() < EncoreBootImage::BOOT_IMAGE_MINIMUM_SECTION_ALIGNMENT)
+                       {
+                               Log::log(Logger::WARNING, "warning: alignment option value must be 16 or greater\n");
+                       }
+                       
+                       imageSection->setAlignment(intValue->getValue());
+               }
+        else
+        {
+            Log::log(Logger::WARNING, "warning: alignment option is an unexpected type\n");
+        }
+       }
+       
+       // Check for and handle "cleartext" option.
+       if (context->hasOption(kCleartextOption))
+       {
+               const Value * value = context->getOption(kCleartextOption);
+        const IntegerValue * intValue = dynamic_cast<const IntegerValue *>(value);
+               if (intValue)
+               {
+                       bool leaveUnencrypted = intValue->getValue() != 0;
+                       imageSection->setLeaveUnencrypted(leaveUnencrypted);
+               }
+        else
+        {
+            Log::log(Logger::WARNING, "warning: cleartext option is an unexpected type\n");
+        }
+       }
+}
+
+void EncoreBootImageGenerator::processOperationSection(OperationSequenceSection * section, EncoreBootImage * image)
+{
+       EncoreBootImage::BootSection * newSection = new EncoreBootImage::BootSection(section->getIdentifier());
+       
+       OperationSequence & sequence = section->getSequence();
+       OperationSequence::iterator_t it = sequence.begin();
+       for (; it != sequence.end(); ++it)
+       {
+               Operation * op = *it;
+               
+               LoadOperation * loadOp = dynamic_cast<LoadOperation*>(op);
+               if (loadOp)
+               {
+                       processLoadOperation(loadOp, newSection);
+                       continue;
+               }
+               
+               ExecuteOperation * execOp = dynamic_cast<ExecuteOperation*>(op);
+               if (execOp)
+               {
+                       processExecuteOperation(execOp, newSection);
+                       continue;
+               }
+               
+               BootModeOperation * modeOp = dynamic_cast<BootModeOperation*>(op);
+               if (modeOp)
+               {
+                       processBootModeOperation(modeOp, newSection);
+                       continue;
+               }
+               
+               Log::log(Logger::WARNING, "warning: unexpected operation type\n");
+       }
+       
+       // Deal with options that apply to sections.
+       processSectionOptions(newSection, section);
+       
+       // add the boot section to the image
+       image->addSection(newSection);
+}
+
+void EncoreBootImageGenerator::processLoadOperation(LoadOperation * op, EncoreBootImage::BootSection * section)
+{
+       DataSource * source = op->getSource();
+       DataTarget * target = op->getTarget();
+       
+       // other sources get handled the same way
+       unsigned segmentCount = source->getSegmentCount();
+       unsigned index = 0;
+       for (; index < segmentCount; ++index)
+       {
+               DataSource::Segment * segment = source->getSegmentAt(index);
+               DataTarget::AddressRange range = target->getRangeForSegment(*source, *segment);
+               unsigned rangeLength = range.m_end - range.m_begin;
+               
+               // handle a pattern segment as a special case to create a fill command
+               DataSource::PatternSegment * patternSegment = dynamic_cast<DataSource::PatternSegment*>(segment);
+               if (patternSegment)
+               {
+                       SizedIntegerValue & pattern = patternSegment->getPattern();
+                       
+                       EncoreBootImage::FillCommand * command = new EncoreBootImage::FillCommand();
+                       command->setAddress(range.m_begin);
+                       command->setFillCount(rangeLength);
+                       setFillPatternFromValue(*command, pattern);
+                       
+                       section->addCommand(command);
+                       continue;
+               }
+               
+               // get the data from the segment
+               uint8_t * data = new uint8_t[rangeLength];
+               segment->getData(0, rangeLength, data);
+               
+               // create the boot command
+               EncoreBootImage::LoadCommand * command = new EncoreBootImage::LoadCommand();
+               command->setData(data, rangeLength); // Makes a copy of the data buffer.
+               command->setLoadAddress(range.m_begin);
+               command->setDCD(op->isDCDLoad());
+               
+               section->addCommand(command);
+        
+        // Free the segment buffer.
+        delete [] data;
+       }
+}
+
+void EncoreBootImageGenerator::setFillPatternFromValue(EncoreBootImage::FillCommand & command, SizedIntegerValue & pattern)
+{
+       uint32_t u32PatternValue = pattern.getValue() & pattern.getWordSizeMask();
+       switch (pattern.getWordSize())
+       {
+               case kWordSize:
+               {
+                       command.setPattern(u32PatternValue);
+                       break;
+               }
+               
+               case kHalfWordSize:
+               {
+                       uint16_t u16PatternValue = static_cast<uint16_t>(u32PatternValue);
+                       command.setPattern(u16PatternValue);
+                       break;
+               }
+               
+               case kByteSize:
+               {
+                       uint8_t u8PatternValue = static_cast<uint8_t>(u32PatternValue);
+                       command.setPattern(u8PatternValue);
+               }
+       }
+}
+
+void EncoreBootImageGenerator::processExecuteOperation(ExecuteOperation * op, EncoreBootImage::BootSection * section)
+{
+       DataTarget * target = op->getTarget();
+       uint32_t arg = static_cast<uint32_t>(op->getArgument());
+       
+       EncoreBootImage::JumpCommand * command;
+       switch (op->getExecuteType())
+       {
+               case ExecuteOperation::kJump:
+                       command = new EncoreBootImage::JumpCommand();
+                       break;
+               
+               case ExecuteOperation::kCall:
+                       command = new EncoreBootImage::CallCommand();
+                       break;
+       }
+       
+       command->setAddress(target->getBeginAddress());
+       command->setArgument(arg);
+       command->setIsHAB(op->isHAB());
+       
+       section->addCommand(command);
+}
+
+void EncoreBootImageGenerator::processBootModeOperation(BootModeOperation * op, EncoreBootImage::BootSection * section)
+{
+       EncoreBootImage::ModeCommand * command = new EncoreBootImage::ModeCommand();
+       command->setBootMode(op->getBootMode());
+       
+       section->addCommand(command);
+}
+
+void EncoreBootImageGenerator::processDataSection(BinaryDataSection * section, EncoreBootImage * image)
+{
+       EncoreBootImage::DataSection * dataSection = new EncoreBootImage::DataSection(section->getIdentifier());
+       dataSection->setData(section->getData(), section->getLength());
+       
+       // Handle alignment option.
+       processSectionOptions(dataSection, section);
+       
+       image->addSection(dataSection);
+}
+
diff --git a/tools/elftosb/elftosb2/EncoreBootImageGenerator.h b/tools/elftosb/elftosb2/EncoreBootImageGenerator.h
new file mode 100644 (file)
index 0000000..f0466bb
--- /dev/null
@@ -0,0 +1,57 @@
+/*
+ * File:       EncoreBootImageGenerator.h
+ *
+ * Copyright (c) Freescale Semiconductor, Inc. All rights reserved.
+ * See included license file for license details.
+ */
+#if !defined(_EncoreBootImageGenerator_h_)
+#define _EncoreBootImageGenerator_h_
+
+#include "BootImageGenerator.h"
+#include "EncoreBootImage.h"
+
+namespace elftosb
+{
+
+/*!
+ * \brief Generator for Encore boot images.
+ *
+ * Takes the abstract model of the output file and processes it into a
+ * concrete boot image for the STMP37xx.
+ *
+ * In order to enable full i.mx28 support, you must call the setSupportHAB() method and
+ * pass true.
+ */
+class EncoreBootImageGenerator : public BootImageGenerator
+{
+public:
+       //! \brief Default constructor.
+       EncoreBootImageGenerator() : BootImageGenerator() {}
+       
+       //! \brief Builds the resulting boot image from previously added output sections.
+       virtual BootImage * generate();
+    
+    //! \brief Enable or disable HAB support.
+    void setSupportHAB(bool supportHAB) { m_supportHAB = supportHAB; }
+       
+protected:
+    
+    bool m_supportHAB;  //!< True if HAB features are enabled.
+    
+       void processOptions(EncoreBootImage * image);
+       void processSectionOptions(EncoreBootImage::Section * imageSection, OutputSection * modelSection);
+       
+       void processOperationSection(OperationSequenceSection * section, EncoreBootImage * image);
+       void processDataSection(BinaryDataSection * section, EncoreBootImage * image);
+
+       void processLoadOperation(LoadOperation * op, EncoreBootImage::BootSection * section);
+       void processExecuteOperation(ExecuteOperation * op, EncoreBootImage::BootSection * section);
+       void processBootModeOperation(BootModeOperation * op, EncoreBootImage::BootSection * section);
+       
+       void setFillPatternFromValue(EncoreBootImage::FillCommand & command, SizedIntegerValue & pattern);
+};
+
+}; // namespace elftosb
+
+#endif // _EncoreBootImageGenerator_h_
+
diff --git a/tools/elftosb/elftosb2/FlexLexer.h b/tools/elftosb/elftosb2/FlexLexer.h
new file mode 100644 (file)
index 0000000..8b26ef2
--- /dev/null
@@ -0,0 +1,208 @@
+// -*-C++-*-
+// FlexLexer.h -- define interfaces for lexical analyzer classes generated
+// by flex
+
+// Copyright (c) 1993 The Regents of the University of California.
+// All rights reserved.
+//
+// This code is derived from software contributed to Berkeley by
+// Kent Williams and Tom Epperly.
+//
+//  Redistribution and use in source and binary forms, with or without
+//  modification, are permitted provided that the following conditions
+//  are met:
+
+//  1. Redistributions of source code must retain the above copyright
+//  notice, this list of conditions and the following disclaimer.
+//  2. Redistributions in binary form must reproduce the above copyright
+//  notice, this list of conditions and the following disclaimer in the
+//  documentation and/or other materials provided with the distribution.
+
+//  Neither the name of the University nor the names of its contributors
+//  may be used to endorse or promote products derived from this software
+//  without specific prior written permission.
+
+//  THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
+//  IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
+//  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+//  PURPOSE.
+
+// This file defines FlexLexer, an abstract class which specifies the
+// external interface provided to flex C++ lexer objects, and yyFlexLexer,
+// which defines a particular lexer class.
+//
+// If you want to create multiple lexer classes, you use the -P flag
+// to rename each yyFlexLexer to some other xxFlexLexer.  You then
+// include <FlexLexer.h> in your other sources once per lexer class:
+//
+//     #undef yyFlexLexer
+//     #define yyFlexLexer xxFlexLexer
+//     #include <FlexLexer.h>
+//
+//     #undef yyFlexLexer
+//     #define yyFlexLexer zzFlexLexer
+//     #include <FlexLexer.h>
+//     ...
+
+#ifndef __FLEX_LEXER_H
+// Never included before - need to define base class.
+#define __FLEX_LEXER_H
+
+#include <iostream>
+#  ifndef FLEX_STD
+#    define FLEX_STD std::
+#  endif
+
+extern "C++" {
+
+struct yy_buffer_state;
+typedef int yy_state_type;
+
+class FlexLexer {
+public:
+       virtual ~FlexLexer()    { }
+
+       const char* YYText() const      { return yytext; }
+       int YYLeng()    const   { return yyleng; }
+
+       virtual void
+               yy_switch_to_buffer( struct yy_buffer_state* new_buffer ) = 0;
+       virtual struct yy_buffer_state*
+               yy_create_buffer( FLEX_STD istream* s, int size ) = 0;
+       virtual void yy_delete_buffer( struct yy_buffer_state* b ) = 0;
+       virtual void yyrestart( FLEX_STD istream* s ) = 0;
+
+       virtual int yylex() = 0;
+
+       // Call yylex with new input/output sources.
+       int yylex( FLEX_STD istream* new_in, FLEX_STD ostream* new_out = 0 )
+               {
+               switch_streams( new_in, new_out );
+               return yylex();
+               }
+
+       // Switch to new input/output streams.  A nil stream pointer
+       // indicates "keep the current one".
+       virtual void switch_streams( FLEX_STD istream* new_in = 0,
+                                       FLEX_STD ostream* new_out = 0 ) = 0;
+
+       int lineno() const              { return yylineno; }
+
+       int debug() const               { return yy_flex_debug; }
+       void set_debug( int flag )      { yy_flex_debug = flag; }
+
+protected:
+       char* yytext;
+       int yyleng;
+       int yylineno;           // only maintained if you use %option yylineno
+       int yy_flex_debug;      // only has effect with -d or "%option debug"
+};
+
+}
+#endif // FLEXLEXER_H
+
+//#if defined(yyFlexLexer) || ! defined(yyFlexLexerOnce)
+// had to disable the 'defined(yyFlexLexer)' part because it was causing duplicate class defs
+#if ! defined(yyFlexLexerOnce)
+// Either this is the first time through (yyFlexLexerOnce not defined),
+// or this is a repeated include to define a different flavor of
+// yyFlexLexer, as discussed in the flex manual.
+#define yyFlexLexerOnce
+
+extern "C++" {
+
+class yyFlexLexer : public FlexLexer {
+public:
+       // arg_yyin and arg_yyout default to the cin and cout, but we
+       // only make that assignment when initializing in yylex().
+       yyFlexLexer( FLEX_STD istream* arg_yyin = 0, FLEX_STD ostream* arg_yyout = 0 );
+
+       virtual ~yyFlexLexer();
+
+       void yy_switch_to_buffer( struct yy_buffer_state* new_buffer );
+       struct yy_buffer_state* yy_create_buffer( FLEX_STD istream* s, int size );
+       void yy_delete_buffer( struct yy_buffer_state* b );
+       void yyrestart( FLEX_STD istream* s );
+
+       void yypush_buffer_state( struct yy_buffer_state* new_buffer );
+       void yypop_buffer_state();
+
+       virtual int yylex();
+       virtual void switch_streams( FLEX_STD istream* new_in, FLEX_STD ostream* new_out = 0 );
+       virtual int yywrap();
+
+protected:
+       virtual int LexerInput( char* buf, int max_size );
+       virtual void LexerOutput( const char* buf, int size );
+       virtual void LexerError( const char* msg );
+
+       void yyunput( int c, char* buf_ptr );
+       int yyinput();
+
+       void yy_load_buffer_state();
+       void yy_init_buffer( struct yy_buffer_state* b, FLEX_STD istream* s );
+       void yy_flush_buffer( struct yy_buffer_state* b );
+
+       int yy_start_stack_ptr;
+       int yy_start_stack_depth;
+       int* yy_start_stack;
+
+       void yy_push_state( int new_state );
+       void yy_pop_state();
+       int yy_top_state();
+
+       yy_state_type yy_get_previous_state();
+       yy_state_type yy_try_NUL_trans( yy_state_type current_state );
+       int yy_get_next_buffer();
+
+       FLEX_STD istream* yyin; // input source for default LexerInput
+       FLEX_STD ostream* yyout;        // output sink for default LexerOutput
+
+       // yy_hold_char holds the character lost when yytext is formed.
+       char yy_hold_char;
+
+       // Number of characters read into yy_ch_buf.
+       int yy_n_chars;
+
+       // Points to current character in buffer.
+       char* yy_c_buf_p;
+
+       int yy_init;            // whether we need to initialize
+       int yy_start;           // start state number
+
+       // Flag which is used to allow yywrap()'s to do buffer switches
+       // instead of setting up a fresh yyin.  A bit of a hack ...
+       int yy_did_buffer_switch_on_eof;
+
+
+       size_t yy_buffer_stack_top; /**< index of top of stack. */
+       size_t yy_buffer_stack_max; /**< capacity of stack. */
+       struct yy_buffer_state ** yy_buffer_stack; /**< Stack as an array. */
+       void yyensure_buffer_stack(void);
+
+       // The following are not always needed, but may be depending
+       // on use of certain flex features (like REJECT or yymore()).
+
+       yy_state_type yy_last_accepting_state;
+       char* yy_last_accepting_cpos;
+
+       yy_state_type* yy_state_buf;
+       yy_state_type* yy_state_ptr;
+
+       char* yy_full_match;
+       int* yy_full_state;
+       int yy_full_lp;
+
+       int yy_lp;
+       int yy_looking_for_trail_begin;
+
+       int yy_more_flag;
+       int yy_more_len;
+       int yy_more_offset;
+       int yy_prev_more_offset;
+};
+
+}
+
+#endif // yyFlexLexer || ! yyFlexLexerOnce
+
diff --git a/tools/elftosb/elftosb2/elftosb.cpp b/tools/elftosb/elftosb2/elftosb.cpp
new file mode 100644 (file)
index 0000000..f358bd9
--- /dev/null
@@ -0,0 +1,700 @@
+/*
+ * File:       elftosb.cpp
+ *
+ * Copyright (c) Freescale Semiconductor, Inc. All rights reserved.
+ * See included license file for license details.
+ */
+
+#include "stdafx.h"
+#include <iostream>
+#include <fstream>
+#include <sstream>
+#include <stdlib.h>
+#include <stdexcept>
+#include "ConversionController.h"
+#include "options.h"
+#include "Version.h"
+#include "EncoreBootImage.h"
+#include "smart_ptr.h"
+#include "Logging.h"
+#include "EncoreBootImageGenerator.h"
+#include "SearchPath.h"
+#include "format_string.h"
+
+//! An array of strings.
+typedef std::vector<std::string> string_vector_t;
+
+//! The tool's name.
+const char k_toolName[] = "elftosb";
+
+//! Current version number for the tool.
+const char k_version[] = "2.6.1";
+
+//! Copyright string.
+const char k_copyright[] = "Copyright (c) 2004-2010 Freescale Semiconductor, Inc.\nAll rights reserved.";
+
+static const char * k_optionsDefinition[] = {
+       "?|help",
+       "v|version",
+       "f:chip-family <family>",
+       "c:command <file>",
+       "o:output <file>",
+       "P:product <version>",
+       "C:component <version>",
+       "k:key <file>",
+       "z|zero-key",
+       "D:define <const>",
+       "O:option <option>",
+       "d|debug",
+       "q|quiet",
+       "V|verbose",
+       "p:search-path <path>",
+       NULL
+};
+
+//! Help string.
+const char k_usageText[] = "\nOptions:\n\
+  -?/--help                    Show this help\n\
+  -v/--version                 Display tool version\n\
+  -f/--chip-family <family>    Select the chip family (default is 37xx)\n\
+  -c/--command <file>          Use this command file\n\
+  -o/--output <file>           Write output to this file\n\
+  -p/--search-path <path>      Add a search path used to find input files\n\
+  -P/--product <version        Set product version\n\
+  -C/--component <version>     Set component version\n\
+  -k/--key <file>              Add OTP key, enable encryption\n\
+  -z/--zero-key                Add default key of all zeroes\n\
+  -D/--define <const>=<int>    Define or override a constant value\n\
+  -O/--option <name>=<value>   Set or override a processing option\n\
+  -d/--debug                   Enable debug output\n\
+  -q/--quiet                   Output only warnings and errors\n\
+  -V/--verbose                 Print extra detailed log information\n\n";
+
+// prototypes
+int main(int argc, char* argv[], char* envp[]);
+
+/*!
+ * \brief Class that encapsulates the elftosb tool.
+ *
+ * A single global logger instance is created during object construction. It is
+ * never freed because we need it up to the last possible minute, when an
+ * exception could be thrown.
+ */
+class elftosbTool
+{
+protected:
+       //! Supported chip families.
+       enum chip_family_t
+       {
+               k37xxFamily,    //!< 37xx series.
+               kMX28Family,    //!< Catskills series.
+       };
+       
+       /*!
+        * \brief A structure describing an entry in the table of chip family names.
+        */
+       struct FamilyNameTableEntry
+       {
+               const char * const name;
+               chip_family_t family;
+       };
+       
+       //! \brief Table that maps from family name strings to chip family constants.
+       static const FamilyNameTableEntry kFamilyNameTable[];
+       
+       int m_argc;                                                     //!< Number of command line arguments.
+       char ** m_argv;                                         //!< String value for each command line argument.
+       StdoutLogger * m_logger;                        //!< Singleton logger instance.
+       string_vector_t m_keyFilePaths;         //!< Paths to OTP key files.
+       string_vector_t m_positionalArgs;       //!< Arguments coming after explicit options.
+       bool m_isVerbose;                                       //!< Whether the verbose flag was turned on.
+       bool m_useDefaultKey;                                   //!< Include a default (zero) crypto key.
+       const char * m_commandFilePath;         //!< Path to the elftosb command file.
+       const char * m_outputFilePath;          //!< Path to the output .sb file.
+       const char * m_searchPath;                      //!< Optional search path for input files.
+       elftosb::version_t m_productVersion;    //!< Product version specified on command line.
+       elftosb::version_t m_componentVersion;  //!< Component version specified on command line.
+       bool m_productVersionSpecified;         //!< True if the product version was specified on the command line.
+       bool m_componentVersionSpecified;               //!< True if the component version was specified on the command line.
+       chip_family_t m_family;                         //!< Chip family that the output file is formatted for.
+       elftosb::ConversionController m_controller;     //!< Our conversion controller instance.
+               
+public:
+       /*!
+        * Constructor.
+        *
+        * Creates the singleton logger instance.
+        */
+       elftosbTool(int argc, char * argv[])
+       :       m_argc(argc),
+               m_argv(argv),
+               m_logger(0),
+               m_keyFilePaths(),
+               m_positionalArgs(),
+               m_isVerbose(false),
+               m_useDefaultKey(false),
+               m_commandFilePath(NULL),
+               m_outputFilePath(NULL),
+               m_searchPath(NULL),
+               m_productVersion(),
+               m_componentVersion(),
+               m_productVersionSpecified(false),
+               m_componentVersionSpecified(false),
+               m_family(k37xxFamily),
+               m_controller()
+       {
+               // create logger instance
+               m_logger = new StdoutLogger();
+               m_logger->setFilterLevel(Logger::INFO);
+               Log::setLogger(m_logger);
+       }
+       
+       /*!
+        * Destructor.
+        */
+       ~elftosbTool()
+       {
+       }
+       
+       /*!
+        * \brief Searches the family name table.
+        *
+        * \retval true The \a name was found in the table, and \a family is valid.
+        * \retval false No matching family name was found. The \a family argument is not modified.
+        */
+       bool lookupFamilyName(const char * name, chip_family_t * family)
+       {
+               // Create a local read-write copy of the argument string.
+               std::string familyName(name);
+               
+               // Convert the argument string to lower case for case-insensitive comparison.
+               for (int n=0; n < familyName.length(); n++)
+               {
+                       familyName[n] = tolower(familyName[n]);
+               }
+               
+        // Exit the loop if we hit the NULL terminator entry.
+               const FamilyNameTableEntry * entry = &kFamilyNameTable[0];
+               for (; entry->name; entry++)
+               {
+                       // Compare lowercased name with the table entry.
+                       if (familyName == entry->name)
+                       {
+                               *family = entry->family;
+                               return true;
+                       }
+               }
+               
+               // Failed to find a matching name.
+               return false;
+       }
+       
+       /*!
+        * Reads the command line options passed into the constructor.
+        *
+        * This method can return a return code to its caller, which will cause the
+        * tool to exit immediately with that return code value. Normally, though, it
+        * will return -1 to signal that the tool should continue to execute and
+        * all options were processed successfully.
+        *
+        * The Options class is used to parse command line options. See
+        * #k_optionsDefinition for the list of options and #k_usageText for the
+        * descriptive help for each option.
+        *
+        * \retval -1 The options were processed successfully. Let the tool run normally.
+        * \return A zero or positive result is a return code value that should be
+        *              returned from the tool as it exits immediately.
+        */
+       int processOptions()
+       {
+               Options options(*m_argv, k_optionsDefinition);
+               OptArgvIter iter(--m_argc, ++m_argv);
+               
+               // process command line options
+               int optchar;
+               const char * optarg;
+               while (optchar = options(iter, optarg))
+               {
+                       switch (optchar)
+                       {
+                               case '?':
+                                       printUsage(options);
+                                       return 0;
+                               
+                               case 'v':
+                                       printf("%s %s\n%s\n", k_toolName, k_version, k_copyright);
+                                       return 0;
+                               
+                               case 'f':
+                                       if (!lookupFamilyName(optarg, &m_family))
+                                       {
+                                               Log::log(Logger::ERROR, "error: unknown chip family '%s'\n", optarg);
+                                               printUsage(options);
+                                               return 0;
+                                       }
+                                       break;
+                                       
+                               case 'c':
+                                       m_commandFilePath = optarg;
+                                       break;
+                                       
+                               case 'o':
+                                       m_outputFilePath = optarg;
+                                       break;
+                                       
+                               case 'P':
+                                       m_productVersion.set(optarg);
+                                       m_productVersionSpecified = true;
+                                       break;
+                                       
+                               case 'C':
+                                       m_componentVersion.set(optarg);
+                                       m_componentVersionSpecified = true;
+                                       break;
+                                       
+                               case 'k':
+                                       m_keyFilePaths.push_back(optarg);
+                                       break;
+                               
+                               case 'z':
+                                       m_useDefaultKey = true;
+                                       break;
+                                       
+                               case 'D':
+                                       overrideVariable(optarg);
+                                       break;
+
+                               case 'O':
+                                       overrideOption(optarg);
+                                       break;
+                                       
+                               case 'd':
+                                       Log::getLogger()->setFilterLevel(Logger::DEBUG);
+                                       break;
+                                       
+                               case 'q':
+                                       Log::getLogger()->setFilterLevel(Logger::WARNING);
+                                       break;
+                                       
+                               case 'V':
+                                       m_isVerbose = true;
+                                       break;
+                               
+                               case 'p':
+                               {
+                                       std::string newSearchPath(optarg);
+                                       PathSearcher::getGlobalSearcher().addSearchPath(newSearchPath);
+                                       break;
+                               }
+                                       
+                               default:
+                                       Log::log(Logger::ERROR, "error: unrecognized option\n\n");
+                                       printUsage(options);
+                                       return 0;
+                       }
+               }
+               
+               // handle positional args
+               if (iter.index() < m_argc)
+               {
+                       Log::SetOutputLevel leveler(Logger::DEBUG);
+                       Log::log("positional args:\n");
+                       int i;
+                       for (i = iter.index(); i < m_argc; ++i)
+                       {
+                               Log::log("%d: %s\n", i - iter.index(), m_argv[i]);
+                               m_positionalArgs.push_back(m_argv[i]);
+                       }
+               }
+               
+               // all is well
+               return -1;
+       }
+
+       /*!
+        * Prints help for the tool.
+        */
+       void printUsage(Options & options)
+       {
+               options.usage(std::cout, "files...");
+               printf(k_usageText, k_toolName);
+       }
+       
+       /*!
+        * \brief Core of the tool.
+        *
+        * Calls processOptions() to handle command line options before performing the
+        * real work the tool does.
+        */
+       int run()
+       {
+               try
+               {
+                       // read command line options
+                       int result;
+                       if ((result = processOptions()) != -1)
+                       {
+                               return result;
+                       }
+                       
+                       // set verbose logging
+                       setVerboseLogging();
+                       
+                       // check argument values
+                       checkArguments();
+
+                       // set up the controller
+                       m_controller.setCommandFilePath(m_commandFilePath);
+                       
+                       // add external paths to controller
+                       string_vector_t::iterator it = m_positionalArgs.begin();
+                       for (; it != m_positionalArgs.end(); ++it)
+                       {
+                               m_controller.addExternalFilePath(*it);
+                       }
+                       
+                       // run conversion
+                       convert();
+               }
+               catch (std::exception & e)
+               {
+                       Log::log(Logger::ERROR, "error: %s\n", e.what());
+                       return 1;
+               }
+               catch (...)
+               {
+                       Log::log(Logger::ERROR, "error: unexpected exception\n");
+                       return 1;
+               }
+               
+               return 0;
+       }
+       
+       /*!
+        * \brief Validate arguments that can be checked.
+        * \exception std::runtime_error Thrown if an argument value fails to pass validation.
+        */
+       void checkArguments()
+       {
+               if (m_commandFilePath == NULL)
+               {
+                       throw std::runtime_error("no command file was specified");
+               }
+               if (m_outputFilePath == NULL)
+               {
+                       throw std::runtime_error("no output file was specified");
+               }
+       }
+       
+       /*!
+        * \brief Turns on verbose logging.
+        */
+       void setVerboseLogging()
+       {
+               if (m_isVerbose)
+               {
+                       // verbose only affects the INFO and DEBUG filter levels
+                       // if the user has selected quiet mode, it overrides verbose
+                       switch (Log::getLogger()->getFilterLevel())
+                       {
+                               case Logger::INFO:
+                                       Log::getLogger()->setFilterLevel(Logger::INFO2);
+                                       break;
+                               case Logger::DEBUG:
+                                       Log::getLogger()->setFilterLevel(Logger::DEBUG2);
+                                       break;
+                       }
+               }
+       }
+
+       /*!
+        * \brief Returns the integer value for a string.
+        *
+        * Metric multiplier prefixes are supported.
+        */
+       uint32_t parseIntValue(const char * value)
+       {
+               // Accept 'true'/'yes' and 'false'/'no' as integer values.
+               if ((strcmp(value, "true") == 0) || (strcmp(value, "yes") == 0))
+               {
+                       return 1;
+               }
+               else if ((strcmp(value, "false") == 0) || (strcmp(value, "no") == 0))
+               {
+                       return 0;
+               }
+               
+               uint32_t intValue = strtoul(value, NULL, 0);
+               unsigned multiplier;
+               switch (value[strlen(value) - 1])
+               {
+                       case 'G':
+                               multiplier = 1024 * 1024 * 1024;
+                               break;
+                       case 'M':
+                               multiplier = 1024 * 1024;
+                               break;
+                       case 'K':
+                               multiplier = 1024;
+                               break;
+                       default:
+                               multiplier = 1;
+               }
+               intValue *= multiplier;
+               return intValue;
+       }
+       
+       /*!
+        * \brief Parses the -D option to override a constant value.
+        */
+       void overrideVariable(const char * optarg)
+       {
+               // split optarg into two strings
+               std::string constName(optarg);
+               int i;
+               for (i=0; i < strlen(optarg); ++i)
+               {
+                       if (optarg[i] == '=')
+                       {
+                               constName.resize(i++);
+                               break;
+                       }
+               }
+               
+               uint32_t constValue = parseIntValue(&optarg[i]);
+               
+               elftosb::EvalContext & context = m_controller.getEvalContext();
+               context.setVariable(constName, constValue);
+               context.lockVariable(constName);
+       }
+
+       /*!
+        * \brief
+        */
+       void overrideOption(const char * optarg)
+       {
+               // split optarg into two strings
+               std::string optionName(optarg);
+               int i;
+               for (i=0; i < strlen(optarg); ++i)
+               {
+                       if (optarg[i] == '=')
+                       {
+                               optionName.resize(i++);
+                               break;
+                       }
+               }
+               
+               // handle quotes for option value
+               const char * valuePtr = &optarg[i];
+               bool isString = false;
+               int len;
+               if (valuePtr[0] == '"')
+               {
+                       // remember that the value is a string and get rid of the opening quote
+                       isString = true;
+                       valuePtr++;
+
+                       // remove trailing quote if present
+                       len = strlen(valuePtr);
+                       if (valuePtr[len] == '"')
+                       {
+                               len--;
+                       }
+               }
+
+               elftosb::Value * value;
+               if (isString)
+               {
+                       std::string stringValue(valuePtr);
+                       stringValue.resize(len);        // remove trailing quote
+                       value = new elftosb::StringValue(stringValue);
+               }
+               else
+               {
+                       value = new elftosb::IntegerValue(parseIntValue(valuePtr));
+               }
+
+               // Set and lock the option in the controller
+               m_controller.setOption(optionName, value);
+               m_controller.lockOption(optionName);
+       }
+       
+       /*!
+        * \brief Do the conversion.
+        * \exception std::runtime_error This exception is thrown if the conversion controller does
+        *              not produce a boot image, or if the output file cannot be opened. Other errors
+        *              internal to the conversion controller may also produce this exception.
+        */
+       void convert()
+       {
+               // create a generator for the chosen chip family
+               smart_ptr<elftosb::BootImageGenerator> generator;
+               switch (m_family)
+               {
+                       case k37xxFamily:
+                               generator = new elftosb::EncoreBootImageGenerator;
+                               elftosb::g_enableHABSupport = false;
+                               break;
+
+                       case kMX28Family:
+                               generator = new elftosb::EncoreBootImageGenerator;
+                               elftosb::g_enableHABSupport = true;
+                               break;
+               }
+               
+               // process input and get a boot image
+               m_controller.run();
+               smart_ptr<elftosb::BootImage> image = m_controller.generateOutput(generator);
+               if (!image)
+               {
+                       throw std::runtime_error("failed to produce output!");
+               }
+               
+               // set version numbers if they were provided on the command line
+               if (m_productVersionSpecified)
+               {
+                       image->setProductVersion(m_productVersion);
+               }
+               if (m_componentVersionSpecified)
+               {
+                       image->setComponentVersion(m_componentVersion);
+               }
+               
+               // special handling for each family
+               switch (m_family)
+               {
+                       case k37xxFamily:
+                       case kMX28Family:
+                       {
+                               // add OTP keys
+                               elftosb::EncoreBootImage * encoreImage = dynamic_cast<elftosb::EncoreBootImage*>(image.get());
+                               if (encoreImage)
+                               {
+                                       // add keys
+                                       addCryptoKeys(encoreImage);
+                                       
+                                       // print debug image
+                                       encoreImage->debugPrint();
+                               }
+                               break;
+                       }
+               }
+               
+               // write output
+               std::ofstream outputStream(m_outputFilePath, std::ios_base::binary | std::ios_base::out | std::ios_base::trunc);
+               if (outputStream.is_open())
+               {
+                       image->writeToStream(outputStream);
+               }
+               else
+               {
+                       throw std::runtime_error(format_string("could not open output file %s", m_outputFilePath));
+               }
+       }
+       
+       /*!
+        * \brief
+        */
+       void addCryptoKeys(elftosb::EncoreBootImage * encoreImage)
+       {
+               string_vector_t::iterator it = m_keyFilePaths.begin();
+               for (; it != m_keyFilePaths.end(); ++it)
+               {
+                       std::string & keyPath = *it;
+                       
+                       std::string actualPath;
+                       bool found = PathSearcher::getGlobalSearcher().search(keyPath, PathSearcher::kFindFile, true, actualPath);
+                       if (!found)
+                       {
+                               throw std::runtime_error(format_string("unable to find key file %s\n", keyPath.c_str()));
+                       }
+                       
+                       std::ifstream keyStream(actualPath.c_str(), std::ios_base::in);
+                       if (!keyStream.is_open())
+                       {
+                               throw std::runtime_error(format_string("unable to read key file %s\n", keyPath.c_str()));
+                       }
+                       keyStream.seekg(0);
+                       
+                       try
+                       {
+                               // read as many keys as possible from the stream
+                               while (true)
+                               {
+                                       AESKey<128> key(keyStream);
+                                       encoreImage->addKey(key);
+                                       
+                                       // dump key bytes
+                                       dumpKey(key);
+                               }
+                       }
+                       catch (...)
+                       {
+                               // ignore the exception -- there are just no more keys in the stream
+                       }
+               }
+               
+               // add the default key of all zero bytes if requested
+               if (m_useDefaultKey)
+               {
+                       AESKey<128> defaultKey;
+                       encoreImage->addKey(defaultKey);
+               }
+       }
+       
+       /*!
+        * \brief Write the value of each byte of the \a key to the log.
+        */
+       void dumpKey(const AESKey<128> & key)
+       {
+               // dump key bytes
+               Log::log(Logger::DEBUG, "key bytes: ");
+               AESKey<128>::key_t the_key;
+               key.getKey(&the_key);
+               int q;
+               for (q=0; q<16; q++)
+               {
+                       Log::log(Logger::DEBUG, "%02x ", the_key[q]);
+               }
+               Log::log(Logger::DEBUG, "\n");
+       }
+
+};
+
+const elftosbTool::FamilyNameTableEntry elftosbTool::kFamilyNameTable[] =
+       {
+               { "37xx", k37xxFamily },
+               { "377x", k37xxFamily },
+               { "378x", k37xxFamily },
+               { "mx23", k37xxFamily },
+               { "imx23", k37xxFamily },
+               { "i.mx23", k37xxFamily },
+               { "mx28", kMX28Family },
+               { "imx28", kMX28Family },
+               { "i.mx28", kMX28Family },
+               
+               // Null terminator entry.
+               { NULL, k37xxFamily }
+       };
+
+/*!
+ * Main application entry point. Creates an sbtool instance and lets it take over.
+ */
+int main(int argc, char* argv[], char* envp[])
+{
+       try
+       {
+               return elftosbTool(argc, argv).run();
+       }
+       catch (...)
+       {
+               Log::log(Logger::ERROR, "error: unexpected exception\n");
+               return 1;
+       }
+
+       return 0;
+}
+
+
+
diff --git a/tools/elftosb/elftosb2/elftosb2.vcproj b/tools/elftosb/elftosb2/elftosb2.vcproj
new file mode 100644 (file)
index 0000000..4de5589
--- /dev/null
@@ -0,0 +1,585 @@
+<?xml version="1.0" encoding="Windows-1252"?>\r
+<VisualStudioProject\r
+       ProjectType="Visual C++"\r
+       Version="9.00"\r
+       Name="elftosb2"\r
+       ProjectGUID="{ACBF9A30-8865-4DAA-B686-D8DC823CBF5C}"\r
+       RootNamespace="elftosb2"\r
+       Keyword="Win32Proj"\r
+       TargetFrameworkVersion="131072"\r
+       >\r
+       <Platforms>\r
+               <Platform\r
+                       Name="Win32"\r
+               />\r
+       </Platforms>\r
+       <ToolFiles>\r
+       </ToolFiles>\r
+       <Configurations>\r
+               <Configuration\r
+                       Name="Debug|Win32"\r
+                       OutputDirectory="Debug"\r
+                       IntermediateDirectory="Debug"\r
+                       ConfigurationType="1"\r
+                       InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"\r
+                       CharacterSet="2"\r
+                       >\r
+                       <Tool\r
+                               Name="VCPreBuildEventTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCCustomBuildTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCXMLDataGeneratorTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCWebServiceProxyGeneratorTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCMIDLTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCCLCompilerTool"\r
+                               Optimization="0"\r
+                               AdditionalIncludeDirectories=".;..\winsupport;..\common"\r
+                               PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"\r
+                               MinimalRebuild="true"\r
+                               BasicRuntimeChecks="3"\r
+                               RuntimeLibrary="1"\r
+                               ForceConformanceInForLoopScope="true"\r
+                               RuntimeTypeInfo="true"\r
+                               UsePrecompiledHeader="0"\r
+                               BrowseInformation="1"\r
+                               WarningLevel="2"\r
+                               Detect64BitPortabilityProblems="true"\r
+                               DebugInformationFormat="4"\r
+                               DisableSpecificWarnings="4355"\r
+                       />\r
+                       <Tool\r
+                               Name="VCManagedResourceCompilerTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCResourceCompilerTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCPreLinkEventTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCLinkerTool"\r
+                               OutputFile="$(OutDir)/elftosb.exe"\r
+                               LinkIncremental="2"\r
+                               GenerateDebugInformation="true"\r
+                               ProgramDatabaseFile="$(OutDir)/elftosb.pdb"\r
+                               SubSystem="1"\r
+                               RandomizedBaseAddress="1"\r
+                               DataExecutionPrevention="0"\r
+                               TargetMachine="1"\r
+                       />\r
+                       <Tool\r
+                               Name="VCALinkTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCManifestTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCXDCMakeTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCBscMakeTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCFxCopTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCAppVerifierTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCPostBuildEventTool"\r
+                       />\r
+               </Configuration>\r
+               <Configuration\r
+                       Name="Release|Win32"\r
+                       OutputDirectory="Release"\r
+                       IntermediateDirectory="Release"\r
+                       ConfigurationType="1"\r
+                       InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"\r
+                       CharacterSet="2"\r
+                       >\r
+                       <Tool\r
+                               Name="VCPreBuildEventTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCCustomBuildTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCXMLDataGeneratorTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCWebServiceProxyGeneratorTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCMIDLTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCCLCompilerTool"\r
+                               PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"\r
+                               RuntimeLibrary="0"\r
+                               UsePrecompiledHeader="0"\r
+                               WarningLevel="3"\r
+                               Detect64BitPortabilityProblems="true"\r
+                               DebugInformationFormat="3"\r
+                       />\r
+                       <Tool\r
+                               Name="VCManagedResourceCompilerTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCResourceCompilerTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCPreLinkEventTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCLinkerTool"\r
+                               OutputFile="$(OutDir)/elftosb2.exe"\r
+                               LinkIncremental="1"\r
+                               GenerateDebugInformation="true"\r
+                               SubSystem="1"\r
+                               OptimizeReferences="2"\r
+                               EnableCOMDATFolding="2"\r
+                               RandomizedBaseAddress="1"\r
+                               DataExecutionPrevention="0"\r
+                               TargetMachine="1"\r
+                       />\r
+                       <Tool\r
+                               Name="VCALinkTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCManifestTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCXDCMakeTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCBscMakeTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCFxCopTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCAppVerifierTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCPostBuildEventTool"\r
+                       />\r
+               </Configuration>\r
+       </Configurations>\r
+       <References>\r
+       </References>\r
+       <Files>\r
+               <Filter\r
+                       Name="Source Files"\r
+                       Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"\r
+                       UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"\r
+                       >\r
+                       <Filter\r
+                               Name="common"\r
+                               >\r
+                               <File\r
+                                       RelativePath="..\common\AESKey.cpp"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath="..\common\Blob.cpp"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath="..\common\crc.cpp"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath="..\common\DataSource.cpp"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath="..\common\DataSourceImager.cpp"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath="..\common\DataTarget.cpp"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath="..\common\ELFSourceFile.cpp"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath="..\common\EncoreBootImage.cpp"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath="..\common\EvalContext.cpp"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath="..\common\ExcludesListMatcher.cpp"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath="..\common\format_string.cpp"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath="..\common\GHSSecInfo.cpp"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath="..\common\GlobMatcher.cpp"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath="..\common\HexValues.cpp"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath="..\common\IVTDataSource.cpp"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath="..\common\Logging.cpp"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath="..\common\Operation.cpp"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath="..\common\OptionDictionary.cpp"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath="..\common\options.cpp"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath="..\common\OutputSection.cpp"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath="..\common\Random.cpp"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath="..\common\rijndael.cpp"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath="..\common\RijndaelCBCMAC.cpp"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath="..\common\SearchPath.cpp"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath="..\common\SHA1.cpp"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath="..\common\SourceFile.cpp"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath="..\common\SRecordSourceFile.cpp"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath="..\common\stdafx.cpp"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath="..\common\StELFFile.cpp"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath="..\common\StExecutableImage.cpp"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath="..\common\StSRecordFile.cpp"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath="..\common\Value.cpp"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath="..\common\Version.cpp"\r
+                                       >\r
+                               </File>\r
+                       </Filter>\r
+                       <Filter\r
+                               Name="elftosb"\r
+                               >\r
+                               <File\r
+                                       RelativePath=".\BootImageGenerator.cpp"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath=".\ConversionController.cpp"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath=".\elftosb.cpp"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath=".\elftosb_lexer.cpp"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath=".\elftosb_parser.tab.cpp"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath=".\ElftosbAST.cpp"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath=".\ElftosbLexer.cpp"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath=".\EncoreBootImageGenerator.cpp"\r
+                                       >\r
+                               </File>\r
+                       </Filter>\r
+               </Filter>\r
+               <Filter\r
+                       Name="Header Files"\r
+                       Filter="h;hpp;hxx;hm;inl;inc;xsd"\r
+                       UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"\r
+                       >\r
+                       <Filter\r
+                               Name="common"\r
+                               >\r
+                               <File\r
+                                       RelativePath="..\common\AESKey.h"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath="..\common\Blob.h"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath="..\common\BootImage.h"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath="..\common\crc.h"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath="..\common\DataSource.h"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath="..\common\DataSourceImager.h"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath="..\common\DataTarget.h"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath="..\common\ELF.h"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath="..\common\ELFSourceFile.h"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath="..\common\EncoreBootImage.h"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath="..\common\EndianUtilities.h"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath="..\common\EvalContext.h"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath="..\common\ExcludesListMatcher.h"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath="..\common\format_string.h"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath="..\common\GHSSecInfo.h"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath="..\common\GlobMatcher.h"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath="..\common\HexValues.h"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath="..\common\int_size.h"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath="..\common\IVTDataSource.h"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath="..\common\Logging.h"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath="..\common\Operation.h"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath="..\common\OptionContext.h"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath="..\common\OptionDictionary.h"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath="..\common\options.h"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath="..\common\OutputSection.h"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath="..\common\Random.h"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath="..\common\rijndael.h"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath="..\common\RijndaelCBCMAC.h"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath="..\common\SearchPath.h"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath="..\common\SHA1.h"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath="..\common\smart_ptr.h"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath="..\common\SourceFile.h"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath="..\common\SRecordSourceFile.h"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath="..\common\stdafx.h"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath="..\common\StELFFile.h"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath="..\common\StExecutableImage.h"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath="..\common\StringMatcher.h"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath="..\common\StSRecordFile.h"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath="..\common\Value.h"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath="..\common\Version.h"\r
+                                       >\r
+                               </File>\r
+                       </Filter>\r
+                       <Filter\r
+                               Name="elftosb"\r
+                               >\r
+                               <File\r
+                                       RelativePath=".\BootImageGenerator.h"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath=".\ConversionController.h"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath=".\crypto.h"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath=".\default_rom_key.h"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath=".\elftosb.h"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath=".\elftosb_parser.tab.hpp"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath=".\ElftosbAST.h"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath=".\ElftosbErrors.h"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath=".\ElftosbLexer.h"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath=".\EncoreBootImageGenerator.h"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath=".\FlexLexer.h"\r
+                                       >\r
+                               </File>\r
+                       </Filter>\r
+               </Filter>\r
+               <Filter\r
+                       Name="Resource Files"\r
+                       Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"\r
+                       UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"\r
+                       >\r
+               </Filter>\r
+       </Files>\r
+       <Globals>\r
+       </Globals>\r
+</VisualStudioProject>\r
diff --git a/tools/elftosb/elftosb2/elftosb_lexer.cpp b/tools/elftosb/elftosb2/elftosb_lexer.cpp
new file mode 100644 (file)
index 0000000..3b87842
--- /dev/null
@@ -0,0 +1,2241 @@
+#line 2 "/Users/creed/projects/fsl/fromsvr/elftosb/build/elftosb.build/Debug/elftosb.build/DerivedSources/elftosb_lexer.cpp"
+
+#line 4 "/Users/creed/projects/fsl/fromsvr/elftosb/build/elftosb.build/Debug/elftosb.build/DerivedSources/elftosb_lexer.cpp"
+
+#define  YY_INT_ALIGNED short int
+
+/* A lexical scanner generated by flex */
+
+#define FLEX_SCANNER
+#define YY_FLEX_MAJOR_VERSION 2
+#define YY_FLEX_MINOR_VERSION 5
+#define YY_FLEX_SUBMINOR_VERSION 35
+#if YY_FLEX_SUBMINOR_VERSION > 0
+#define FLEX_BETA
+#endif
+
+    /* The c++ scanner is a mess. The FlexLexer.h header file relies on the
+     * following macro. This is required in order to pass the c++-multiple-scanners
+     * test in the regression suite. We get reports that it breaks inheritance.
+     * We will address this in a future release of flex, or omit the C++ scanner
+     * altogether.
+     */
+    #define yyFlexLexer yyFlexLexer
+
+/* First, we deal with  platform-specific or compiler-specific issues. */
+
+/* begin standard C headers. */
+
+/* end standard C headers. */
+
+/* flex integer type definitions */
+
+#ifndef FLEXINT_H
+#define FLEXINT_H
+
+/* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */
+
+#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
+
+/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,
+ * if you want the limit (max/min) macros for int types. 
+ */
+#ifndef __STDC_LIMIT_MACROS
+#define __STDC_LIMIT_MACROS 1
+#endif
+
+#include <inttypes.h>
+typedef int8_t flex_int8_t;
+typedef uint8_t flex_uint8_t;
+typedef int16_t flex_int16_t;
+typedef uint16_t flex_uint16_t;
+typedef int32_t flex_int32_t;
+typedef uint32_t flex_uint32_t;
+#else
+typedef signed char flex_int8_t;
+typedef short int flex_int16_t;
+typedef int flex_int32_t;
+typedef unsigned char flex_uint8_t; 
+typedef unsigned short int flex_uint16_t;
+typedef unsigned int flex_uint32_t;
+#endif /* ! C99 */
+
+/* Limits of integral types. */
+#ifndef INT8_MIN
+#define INT8_MIN               (-128)
+#endif
+#ifndef INT16_MIN
+#define INT16_MIN              (-32767-1)
+#endif
+#ifndef INT32_MIN
+#define INT32_MIN              (-2147483647-1)
+#endif
+#ifndef INT8_MAX
+#define INT8_MAX               (127)
+#endif
+#ifndef INT16_MAX
+#define INT16_MAX              (32767)
+#endif
+#ifndef INT32_MAX
+#define INT32_MAX              (2147483647)
+#endif
+#ifndef UINT8_MAX
+#define UINT8_MAX              (255U)
+#endif
+#ifndef UINT16_MAX
+#define UINT16_MAX             (65535U)
+#endif
+#ifndef UINT32_MAX
+#define UINT32_MAX             (4294967295U)
+#endif
+
+#endif /* ! FLEXINT_H */
+
+/* begin standard C++ headers. */
+#include <iostream> 
+#include <errno.h>
+#include <cstdlib>
+#include <cstring>
+/* end standard C++ headers. */
+
+#ifdef __cplusplus
+
+/* The "const" storage-class-modifier is valid. */
+#define YY_USE_CONST
+
+#else  /* ! __cplusplus */
+
+/* C99 requires __STDC__ to be defined as 1. */
+#if defined (__STDC__)
+
+#define YY_USE_CONST
+
+#endif /* defined (__STDC__) */
+#endif /* ! __cplusplus */
+
+#ifdef YY_USE_CONST
+#define yyconst const
+#else
+#define yyconst
+#endif
+
+/* Returned upon end-of-file. */
+#define YY_NULL 0
+
+/* Promotes a possibly negative, possibly signed char to an unsigned
+ * integer for use as an array index.  If the signed char is negative,
+ * we want to instead treat it as an 8-bit unsigned char, hence the
+ * double cast.
+ */
+#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
+
+/* Enter a start condition.  This macro really ought to take a parameter,
+ * but we do it the disgusting crufty way forced on us by the ()-less
+ * definition of BEGIN.
+ */
+#define BEGIN (yy_start) = 1 + 2 *
+
+/* Translate the current start state into a value that can be later handed
+ * to BEGIN to return to the state.  The YYSTATE alias is for lex
+ * compatibility.
+ */
+#define YY_START (((yy_start) - 1) / 2)
+#define YYSTATE YY_START
+
+/* Action number for EOF rule of a given start state. */
+#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
+
+/* Special action meaning "start processing a new file". */
+#define YY_NEW_FILE yyrestart( yyin  )
+
+#define YY_END_OF_BUFFER_CHAR 0
+
+/* Size of default input buffer. */
+#ifndef YY_BUF_SIZE
+#define YY_BUF_SIZE 16384
+#endif
+
+/* The state buf must be large enough to hold one state per character in the main buffer.
+ */
+#define YY_STATE_BUF_SIZE   ((YY_BUF_SIZE + 2) * sizeof(yy_state_type))
+
+#ifndef YY_TYPEDEF_YY_BUFFER_STATE
+#define YY_TYPEDEF_YY_BUFFER_STATE
+typedef struct yy_buffer_state *YY_BUFFER_STATE;
+#endif
+
+#ifndef YY_TYPEDEF_YY_SIZE_T
+#define YY_TYPEDEF_YY_SIZE_T
+typedef size_t yy_size_t;
+#endif
+
+extern yy_size_t yyleng;
+
+#define EOB_ACT_CONTINUE_SCAN 0
+#define EOB_ACT_END_OF_FILE 1
+#define EOB_ACT_LAST_MATCH 2
+
+    /* Note: We specifically omit the test for yy_rule_can_match_eol because it requires
+     *       access to the local variable yy_act. Since yyless() is a macro, it would break
+     *       existing scanners that call yyless() from OUTSIDE yylex. 
+     *       One obvious solution it to make yy_act a global. I tried that, and saw
+     *       a 5% performance hit in a non-yylineno scanner, because yy_act is
+     *       normally declared as a register variable-- so it is not worth it.
+     */
+    #define  YY_LESS_LINENO(n) \
+            do { \
+                int yyl;\
+                for ( yyl = n; yyl < yyleng; ++yyl )\
+                    if ( yytext[yyl] == '\n' )\
+                        --yylineno;\
+            }while(0)
+    
+/* Return all but the first "n" matched characters back to the input stream. */
+#define yyless(n) \
+       do \
+               { \
+               /* Undo effects of setting up yytext. */ \
+        int yyless_macro_arg = (n); \
+        YY_LESS_LINENO(yyless_macro_arg);\
+               *yy_cp = (yy_hold_char); \
+               YY_RESTORE_YY_MORE_OFFSET \
+               (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \
+               YY_DO_BEFORE_ACTION; /* set up yytext again */ \
+               } \
+       while ( 0 )
+
+#define unput(c) yyunput( c, (yytext_ptr)  )
+
+#ifndef YY_STRUCT_YY_BUFFER_STATE
+#define YY_STRUCT_YY_BUFFER_STATE
+struct yy_buffer_state
+       {
+
+       std::istream* yy_input_file;
+
+       char *yy_ch_buf;                /* input buffer */
+       char *yy_buf_pos;               /* current position in input buffer */
+
+       /* Size of input buffer in bytes, not including room for EOB
+        * characters.
+        */
+       yy_size_t yy_buf_size;
+
+       /* Number of characters read into yy_ch_buf, not including EOB
+        * characters.
+        */
+       yy_size_t yy_n_chars;
+
+       /* Whether we "own" the buffer - i.e., we know we created it,
+        * and can realloc() it to grow it, and should free() it to
+        * delete it.
+        */
+       int yy_is_our_buffer;
+
+       /* Whether this is an "interactive" input source; if so, and
+        * if we're using stdio for input, then we want to use getc()
+        * instead of fread(), to make sure we stop fetching input after
+        * each newline.
+        */
+       int yy_is_interactive;
+
+       /* Whether we're considered to be at the beginning of a line.
+        * If so, '^' rules will be active on the next match, otherwise
+        * not.
+        */
+       int yy_at_bol;
+
+    int yy_bs_lineno; /**< The line count. */
+    int yy_bs_column; /**< The column count. */
+    
+       /* Whether to try to fill the input buffer when we reach the
+        * end of it.
+        */
+       int yy_fill_buffer;
+
+       int yy_buffer_status;
+
+#define YY_BUFFER_NEW 0
+#define YY_BUFFER_NORMAL 1
+       /* When an EOF's been seen but there's still some text to process
+        * then we mark the buffer as YY_EOF_PENDING, to indicate that we
+        * shouldn't try reading from the input source any more.  We might
+        * still have a bunch of tokens to match, though, because of
+        * possible backing-up.
+        *
+        * When we actually see the EOF, we change the status to "new"
+        * (via yyrestart()), so that the user can continue scanning by
+        * just pointing yyin at a new input file.
+        */
+#define YY_BUFFER_EOF_PENDING 2
+
+       };
+#endif /* !YY_STRUCT_YY_BUFFER_STATE */
+
+/* We provide macros for accessing buffer states in case in the
+ * future we want to put the buffer states in a more general
+ * "scanner state".
+ *
+ * Returns the top of the stack, or NULL.
+ */
+#define YY_CURRENT_BUFFER ( (yy_buffer_stack) \
+                          ? (yy_buffer_stack)[(yy_buffer_stack_top)] \
+                          : NULL)
+
+/* Same as previous macro, but useful when we know that the buffer stack is not
+ * NULL or when we need an lvalue. For internal use only.
+ */
+#define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)]
+
+void *yyalloc (yy_size_t  );
+void *yyrealloc (void *,yy_size_t  );
+void yyfree (void *  );
+
+#define yy_new_buffer yy_create_buffer
+
+#define yy_set_interactive(is_interactive) \
+       { \
+       if ( ! YY_CURRENT_BUFFER ){ \
+        yyensure_buffer_stack (); \
+               YY_CURRENT_BUFFER_LVALUE =    \
+            yy_create_buffer( yyin, YY_BUF_SIZE ); \
+       } \
+       YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \
+       }
+
+#define yy_set_bol(at_bol) \
+       { \
+       if ( ! YY_CURRENT_BUFFER ){\
+        yyensure_buffer_stack (); \
+               YY_CURRENT_BUFFER_LVALUE =    \
+            yy_create_buffer( yyin, YY_BUF_SIZE ); \
+       } \
+       YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \
+       }
+
+#define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)
+
+/* Begin user sect3 */
+#define YY_SKIP_YYWRAP
+
+typedef unsigned char YY_CHAR;
+
+#define yytext_ptr yytext
+
+#include <FlexLexer.h>
+
+int yyFlexLexer::yywrap() { return 1; }
+int yyFlexLexer::yylex()
+       {
+       LexerError( "yyFlexLexer::yylex invoked but %option yyclass used" );
+       return 0;
+       }
+
+#define YY_DECL int ElftosbLexer::yylex()
+
+/* Done after the current pattern has been matched and before the
+ * corresponding action - sets up yytext.
+ */
+#define YY_DO_BEFORE_ACTION \
+       (yytext_ptr) = yy_bp; \
+       yyleng = (size_t) (yy_cp - yy_bp); \
+       (yy_hold_char) = *yy_cp; \
+       *yy_cp = '\0'; \
+       (yy_c_buf_p) = yy_cp;
+
+#define YY_NUM_RULES 74
+#define YY_END_OF_BUFFER 75
+/* This struct is not used in this scanner,
+   but its presence is necessary. */
+struct yy_trans_info
+       {
+       flex_int32_t yy_verify;
+       flex_int32_t yy_nxt;
+       };
+static yyconst flex_int16_t yy_accept[218] =
+    {   0,
+        0,    0,    0,    0,    0,    0,   75,   73,   70,   71,
+       71,   64,   73,   73,   73,   49,   54,   73,   34,   35,
+       47,   45,   39,   46,   42,   48,   27,   27,   40,   41,
+       57,   38,   43,   26,   36,   37,   51,   26,   26,   26,
+       26,   26,   26,   26,   26,   26,   26,   26,   26,   26,
+       26,   26,   26,   26,   32,   55,   33,   50,   73,   73,
+       72,   70,   71,   72,   71,   61,    0,   65,    0,    0,
+       69,   29,   62,    0,    0,   56,   44,   30,    0,    0,
+       27,   27,    0,    0,   52,   59,   60,   58,   53,   26,
+       23,   26,   26,   26,   26,   26,   26,   26,   26,   26,
+
+       26,   26,   13,   26,   26,   26,   26,   26,   25,   26,
+       26,   26,   26,   26,   26,   26,   26,   31,   63,   66,
+       67,   68,    0,    0,   28,    0,    0,   27,   27,   26,
+       26,   20,   26,   26,   26,   26,   26,   26,   26,   21,
+       26,   22,   26,   26,   26,   26,    8,   26,   26,   26,
+       26,   26,   24,    0,    0,   28,    0,    0,    0,   11,
+       26,   26,   14,   26,   26,   26,   26,    7,   16,   10,
+        9,   12,   26,   26,   26,   26,   26,    0,    0,    0,
+        0,   28,    0,   26,   26,   18,   26,   26,   26,   26,
+       26,   26,   26,   28,    0,   28,    0,   26,   26,    6,
+
+       26,   26,   26,   19,   26,   26,    0,   26,   15,    4,
+        1,    5,    3,   17,   26,    2,    0
+    } ;
+
+static yyconst flex_int32_t yy_ec[256] =
+    {   0,
+        1,    1,    1,    1,    1,    1,    1,    1,    2,    3,
+        1,    1,    4,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    2,    5,    6,    7,    8,    9,   10,   11,   12,
+       13,   14,   15,   16,   17,   18,   19,   20,   21,   22,
+       22,   22,   22,   22,   22,   22,   22,   23,   24,   25,
+       26,   27,   28,    1,   29,   29,   30,   29,   31,   29,
+       32,   33,   33,   33,   32,   33,   32,   33,   33,   33,
+       33,   33,   34,   33,   33,   33,   33,   33,   33,   33,
+       35,    1,   36,   37,   33,    1,   38,   39,   40,   41,
+
+       42,   43,   44,   45,   46,   47,   33,   48,   49,   50,
+       51,   52,   33,   53,   54,   55,   56,   57,   58,   59,
+       60,   61,   62,   63,   64,   65,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1
+    } ;
+
+static yyconst flex_int32_t yy_meta[66] =
+    {   0,
+        1,    1,    2,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    3,    1,    1,    3,    3,    1,    4,
+        4,    4,    1,    1,    1,    1,    1,    3,    4,    4,
+        4,    5,    5,    5,    3,    3,    3,    4,    4,    4,
+        4,    4,    4,    5,    5,    5,    5,    5,    5,    5,
+        5,    5,    5,    5,    5,    5,    5,    5,    5,    5,
+        5,    1,    1,    1,    1
+    } ;
+
+static yyconst flex_int16_t yy_base[231] =
+    {   0,
+        0,    0,   64,  127,   67,   73,  384,  385,  385,  385,
+      380,  356,   66,  378,    0,  385,  370,  348,  385,  385,
+      364,  385,  385,  385,  359,   59,   78,   94,  385,  385,
+       57,  350,   62,    0,  385,  385,  385,  191,   41,   69,
+       60,   74,  337,   75,  318,  322,  321,  320,  318,  331,
+       92,  315,  329,  324,  303,  301,  385,  385,    0,  299,
+      385,  385,  359,  342,  385,  385,  115,  385,  129,  357,
+      385,    0,  385,  111,  128,  385,  385,  385,  356,  121,
+      152,  385,   70,    0,  385,  385,  385,  385,  385,    0,
+      385,  310,  307,  315,  312,  300,  300,  297,  303,  302,
+
+      298,  309,    0,  304,  291,  296,  306,  302,    0,  287,
+      283,  300,  278,  282,  281,  283,  281,  385,  385,  385,
+      385,  385,  145,  113,  130,  200,  202,  218,  148,  286,
+      279,    0,  286,  289,  279,  287,  274,  272,  277,    0,
+      274,    0,  272,  282,  280,  275,    0,  265,  277,  265,
+      275,  266,    0,  146,  284,  283,  102,  148,  210,    0,
+      258,  262,    0,  258,  257,  267,  266,    0,    0,    0,
+        0,    0,  256,  257,  247,  253,  242,  270,  153,  160,
+      211,  212,  213,  214,  209,    0,  199,  195,  196,  189,
+      194,  194,  185,  385,  200,  198,  151,  162,  148,    0,
+
+      134,  132,  135,    0,  129,  111,  214,   90,    0,    0,
+        0,    0,    0,    0,   86,    0,  385,  256,  261,  266,
+      271,  274,  279,  281,   97,  286,   70,  291,  296,  301
+    } ;
+
+static yyconst flex_int16_t yy_def[231] =
+    {   0,
+      217,    1,  218,  218,  219,  219,  217,  217,  217,  217,
+      217,  217,  220,  221,  222,  217,  217,  223,  217,  217,
+      217,  217,  217,  217,  217,  217,  217,  217,  217,  217,
+      217,  217,  217,  224,  217,  217,  217,  224,  224,  224,
+      224,  224,   38,  224,  224,  224,  224,  224,  224,  224,
+      224,  224,   38,  224,  217,  217,  217,  217,  225,  217,
+      217,  217,  217,  217,  217,  217,  220,  217,  220,  221,
+      217,  222,  217,  226,  226,  217,  217,  217,  221,  217,
+      217,  217,  217,  227,  217,  217,  217,  217,  217,  224,
+      217,  224,  224,  224,  224,  224,  224,  224,  224,  224,
+
+      224,  224,  224,  224,  224,  224,  224,  224,  224,  224,
+      224,  224,  224,  224,  224,  224,  224,  217,  217,  217,
+      217,  217,  220,  228,  228,  228,  228,  217,  227,  224,
+      224,  224,  224,  224,  224,  224,  224,  224,  224,  224,
+      224,  224,  224,  224,  224,  224,  224,  224,  224,  224,
+      224,  224,  224,  220,  229,  229,  229,  229,  230,  224,
+      224,  224,  224,  224,  224,  224,  224,  224,  224,  224,
+      224,  224,  224,  224,  224,  224,  224,  217,  217,  217,
+      228,  228,  228,  224,  224,  224,  224,  224,  224,  224,
+      224,  224,  224,  217,  217,  229,  229,  224,  224,  224,
+
+      224,  224,  224,  224,  224,  224,  228,  224,  224,  224,
+      224,  224,  224,  224,  224,  224,    0,  217,  217,  217,
+      217,  217,  217,  217,  217,  217,  217,  217,  217,  217
+    } ;
+
+static yyconst flex_int16_t yy_nxt[451] =
+    {   0,
+        8,    9,   10,   11,   12,   13,   14,   15,   16,   17,
+       18,   19,   20,   21,   22,   23,   24,   25,   26,   27,
+       28,   28,   29,   30,   31,   32,   33,    8,   34,   34,
+       34,   34,   34,   34,   35,   36,   37,   34,   38,   39,
+       40,   41,   42,   34,   43,   44,   45,   46,   47,   48,
+       49,   34,   50,   51,   52,   34,   34,   53,   34,   54,
+       34,   55,   56,   57,   58,    9,   10,   11,   62,   10,
+       63,   68,   78,  129,   62,   10,   63,   79,   92,   80,
+       64,   85,   86,   59,   59,   59,   64,   88,   89,  128,
+      128,   93,   59,   59,   59,   80,   69,   81,   81,   81,
+
+      120,   59,   59,   59,   59,   59,   59,   96,   94,   82,
+       95,   99,   97,   81,   81,   81,   83,  103,   98,  100,
+       68,  125,   80,  156,  104,   82,  101,   60,    9,   10,
+       11,  105,  179,  112,   68,  180,   84,  113,  125,  216,
+      156,  126,  114,  157,  215,   69,   59,   59,   59,   80,
+       68,   68,   82,   80,  214,   59,   59,   59,  126,   69,
+      157,  127,  123,  194,   59,   59,   59,   59,   59,   59,
+      194,   81,   81,   81,  154,   69,   69,  181,  179,   82,
+      207,  179,  213,   82,  212,  211,  195,  210,  209,  155,
+       60,   91,   91,   91,   91,   91,   91,   91,   91,   91,
+
+       91,   91,   91,   91,   91,   91,   91,   91,   91,   91,
+      156,  208,  156,   91,   91,   91,   91,   91,   91,   80,
+      182,  196,  196,  196,  196,   91,   91,   91,  179,  178,
+      157,  159,  157,  158,  206,  205,  204,  128,  128,  203,
+      183,  157,  157,  157,  157,  202,  197,  201,  200,   82,
+      199,  198,   91,   91,   91,   91,    8,    8,    8,    8,
+        8,   61,   61,   61,   61,   61,   67,   67,   67,   67,
+       67,   70,   70,   70,   70,   70,   72,   72,   72,   74,
+      194,   74,   74,   74,   90,   90,  124,  193,  124,  124,
+      124,  155,  192,  155,  155,  155,  178,  191,  178,  178,
+
+      178,  181,  190,  181,  181,  181,  189,  188,  109,  187,
+      186,  185,  184,  179,  179,  177,  153,  176,  175,  174,
+      173,  172,  171,  170,  169,  168,  167,  166,  165,  164,
+      163,  162,  161,  160,  153,  152,  151,  150,  149,  148,
+      147,  146,  145,  144,  143,  142,  141,  140,  139,  138,
+      137,  136,  135,  134,  133,  132,  131,  130,   71,   71,
+      122,   65,  121,  119,  118,  117,  116,  115,  111,  110,
+      109,  108,  107,  106,  102,   87,   77,   76,   75,   73,
+       71,   66,   65,  217,    7,  217,  217,  217,  217,  217,
+      217,  217,  217,  217,  217,  217,  217,  217,  217,  217,
+
+      217,  217,  217,  217,  217,  217,  217,  217,  217,  217,
+      217,  217,  217,  217,  217,  217,  217,  217,  217,  217,
+      217,  217,  217,  217,  217,  217,  217,  217,  217,  217,
+      217,  217,  217,  217,  217,  217,  217,  217,  217,  217,
+      217,  217,  217,  217,  217,  217,  217,  217,  217,  217
+    } ;
+
+static yyconst flex_int16_t yy_chk[451] =
+    {   0,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    3,    3,    3,    5,    5,
+        5,   13,   26,  227,    6,    6,    6,   26,   39,   27,
+        5,   31,   31,    3,    3,    3,    6,   33,   33,   83,
+       83,   39,    3,    3,    3,   28,   13,   27,   27,   27,
+
+      225,    3,    3,    3,    3,    3,    3,   41,   40,   27,
+       40,   42,   41,   28,   28,   28,   27,   44,   41,   42,
+       67,   74,   80,  124,   44,   28,   42,    3,    4,    4,
+        4,   44,  157,   51,   69,  157,   27,   51,   75,  215,
+      125,   74,   51,  124,  208,   67,    4,    4,    4,  129,
+      123,  154,   80,   81,  206,    4,    4,    4,   75,   69,
+      125,   75,   69,  179,    4,    4,    4,    4,    4,    4,
+      180,   81,   81,   81,  123,  123,  154,  158,  158,  129,
+      197,  197,  205,   81,  203,  202,  179,  201,  199,  180,
+        4,   38,   38,   38,   38,   38,   38,   38,   38,   38,
+
+       38,   38,   38,   38,   38,   38,   38,   38,   38,   38,
+      126,  198,  127,   38,   38,   38,   38,   38,   38,  128,
+      159,  181,  182,  183,  207,   38,   38,   38,  196,  195,
+      126,  127,  127,  126,  193,  192,  191,  128,  128,  190,
+      159,  181,  182,  183,  207,  189,  183,  188,  187,  128,
+      185,  184,   38,   38,   38,   38,  218,  218,  218,  218,
+      218,  219,  219,  219,  219,  219,  220,  220,  220,  220,
+      220,  221,  221,  221,  221,  221,  222,  222,  222,  223,
+      178,  223,  223,  223,  224,  224,  226,  177,  226,  226,
+      226,  228,  176,  228,  228,  228,  229,  175,  229,  229,
+
+      229,  230,  174,  230,  230,  230,  173,  167,  166,  165,
+      164,  162,  161,  156,  155,  152,  151,  150,  149,  148,
+      146,  145,  144,  143,  141,  139,  138,  137,  136,  135,
+      134,  133,  131,  130,  117,  116,  115,  114,  113,  112,
+      111,  110,  108,  107,  106,  105,  104,  102,  101,  100,
+       99,   98,   97,   96,   95,   94,   93,   92,   79,   70,
+       64,   63,   60,   56,   55,   54,   53,   52,   50,   49,
+       48,   47,   46,   45,   43,   32,   25,   21,   18,   17,
+       14,   12,   11,    7,  217,  217,  217,  217,  217,  217,
+      217,  217,  217,  217,  217,  217,  217,  217,  217,  217,
+
+      217,  217,  217,  217,  217,  217,  217,  217,  217,  217,
+      217,  217,  217,  217,  217,  217,  217,  217,  217,  217,
+      217,  217,  217,  217,  217,  217,  217,  217,  217,  217,
+      217,  217,  217,  217,  217,  217,  217,  217,  217,  217,
+      217,  217,  217,  217,  217,  217,  217,  217,  217,  217
+    } ;
+
+/* Table of booleans, true if rule could match eol. */
+static yyconst flex_int32_t yy_rule_can_match_eol[75] =
+    {   0,
+0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
+    0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
+    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
+    0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0,     };
+
+/* The intent behind this definition is that it'll catch
+ * any uses of REJECT which flex missed.
+ */
+#define REJECT reject_used_but_not_detected
+#define yymore() yymore_used_but_not_detected
+#define YY_MORE_ADJ 0
+#define YY_RESTORE_YY_MORE_OFFSET
+#line 1 "/Users/creed/projects/fsl/fromsvr/elftosb/elftosb2/elftosb_lexer.l"
+/* %option prefix="Elftosb" */
+#line 10 "/Users/creed/projects/fsl/fromsvr/elftosb/elftosb2/elftosb_lexer.l"
+#include "ElftosbLexer.h"
+#include <stdlib.h>
+#include <limits.h>
+#include <string>
+#include "HexValues.h"
+#include "Value.h"
+
+using namespace elftosb;
+
+//! Always executed before all other actions when a token is matched.
+//! This action just assign the first and last lines of the token to
+//! the current line. In most cases this is correct.
+#define YY_USER_ACTION do {                                                                    \
+                                                       m_location.m_firstLine = m_line;                \
+                                                       m_location.m_lastLine = m_line;         \
+                                               } while (0);
+
+/* start conditions */
+
+#line 628 "/Users/creed/projects/fsl/fromsvr/elftosb/build/elftosb.build/Debug/elftosb.build/DerivedSources/elftosb_lexer.cpp"
+
+#define INITIAL 0
+#define blob 1
+#define mlcmt 2
+
+#ifndef YY_NO_UNISTD_H
+/* Special case for "unistd.h", since it is non-ANSI. We include it way
+ * down here because we want the user's section 1 to have been scanned first.
+ * The user has a chance to override it with an option.
+ */
+#include <unistd.h>
+#endif
+
+#ifndef YY_EXTRA_TYPE
+#define YY_EXTRA_TYPE void *
+#endif
+
+#ifndef yytext_ptr
+static void yy_flex_strncpy (char *,yyconst char *,int );
+#endif
+
+#ifdef YY_NEED_STRLEN
+static int yy_flex_strlen (yyconst char * );
+#endif
+
+#ifndef YY_NO_INPUT
+
+#endif
+
+/* Amount of stuff to slurp up with each read. */
+#ifndef YY_READ_BUF_SIZE
+#define YY_READ_BUF_SIZE 8192
+#endif
+
+/* Copy whatever the last rule matched to the standard output. */
+#ifndef ECHO
+#define ECHO LexerOutput( yytext, yyleng )
+#endif
+
+/* Gets input and stuffs it into "buf".  number of characters read, or YY_NULL,
+ * is returned in "result".
+ */
+#ifndef YY_INPUT
+#define YY_INPUT(buf,result,max_size) \
+\
+       if ( (result = LexerInput( (char *) buf, max_size )) < 0 ) \
+               YY_FATAL_ERROR( "input in flex scanner failed" );
+
+#endif
+
+/* No semi-colon after return; correct usage is to write "yyterminate();" -
+ * we don't want an extra ';' after the "return" because that will cause
+ * some compilers to complain about unreachable statements.
+ */
+#ifndef yyterminate
+#define yyterminate() return YY_NULL
+#endif
+
+/* Number of entries by which start-condition stack grows. */
+#ifndef YY_START_STACK_INCR
+#define YY_START_STACK_INCR 25
+#endif
+
+/* Report a fatal error. */
+#ifndef YY_FATAL_ERROR
+#define YY_FATAL_ERROR(msg) LexerError( msg )
+#endif
+
+/* end tables serialization structures and prototypes */
+
+/* Default declaration of generated scanner - a define so the user can
+ * easily add parameters.
+ */
+#ifndef YY_DECL
+#define YY_DECL_IS_OURS 1
+#define YY_DECL int yyFlexLexer::yylex()
+#endif /* !YY_DECL */
+
+/* Code executed at the beginning of each rule, after yytext and yyleng
+ * have been set up.
+ */
+#ifndef YY_USER_ACTION
+#define YY_USER_ACTION
+#endif
+
+/* Code executed at the end of each rule. */
+#ifndef YY_BREAK
+#define YY_BREAK break;
+#endif
+
+#define YY_RULE_SETUP \
+       YY_USER_ACTION
+
+/** The main scanner function which does all the work.
+ */
+YY_DECL
+{
+       register yy_state_type yy_current_state;
+       register char *yy_cp, *yy_bp;
+       register int yy_act;
+    
+#line 38 "/Users/creed/projects/fsl/fromsvr/elftosb/elftosb2/elftosb_lexer.l"
+
+
+#line 733 "/Users/creed/projects/fsl/fromsvr/elftosb/build/elftosb.build/Debug/elftosb.build/DerivedSources/elftosb_lexer.cpp"
+
+       if ( !(yy_init) )
+               {
+               (yy_init) = 1;
+
+#ifdef YY_USER_INIT
+               YY_USER_INIT;
+#endif
+
+               if ( ! (yy_start) )
+                       (yy_start) = 1; /* first start state */
+
+               if ( ! yyin )
+                       yyin = & std::cin;
+
+               if ( ! yyout )
+                       yyout = & std::cout;
+
+               if ( ! YY_CURRENT_BUFFER ) {
+                       yyensure_buffer_stack ();
+                       YY_CURRENT_BUFFER_LVALUE =
+                               yy_create_buffer( yyin, YY_BUF_SIZE );
+               }
+
+               yy_load_buffer_state(  );
+               }
+
+       while ( 1 )             /* loops until end-of-file is reached */
+               {
+               yy_cp = (yy_c_buf_p);
+
+               /* Support of yytext. */
+               *yy_cp = (yy_hold_char);
+
+               /* yy_bp points to the position in yy_ch_buf of the start of
+                * the current run.
+                */
+               yy_bp = yy_cp;
+
+               yy_current_state = (yy_start);
+yy_match:
+               do
+                       {
+                       register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
+                       if ( yy_accept[yy_current_state] )
+                               {
+                               (yy_last_accepting_state) = yy_current_state;
+                               (yy_last_accepting_cpos) = yy_cp;
+                               }
+                       while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
+                               {
+                               yy_current_state = (int) yy_def[yy_current_state];
+                               if ( yy_current_state >= 218 )
+                                       yy_c = yy_meta[(unsigned int) yy_c];
+                               }
+                       yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
+                       ++yy_cp;
+                       }
+               while ( yy_current_state != 217 );
+               yy_cp = (yy_last_accepting_cpos);
+               yy_current_state = (yy_last_accepting_state);
+
+yy_find_action:
+               yy_act = yy_accept[yy_current_state];
+
+               YY_DO_BEFORE_ACTION;
+
+               if ( yy_act != YY_END_OF_BUFFER && yy_rule_can_match_eol[yy_act] )
+                       {
+                       int yyl;
+                       for ( yyl = 0; yyl < yyleng; ++yyl )
+                               if ( yytext[yyl] == '\n' )
+                                          
+    yylineno++;
+;
+                       }
+
+do_action:     /* This label is used only to access EOF actions. */
+
+               switch ( yy_act )
+       { /* beginning of action switch */
+                       case 0: /* must back up */
+                       /* undo the effects of YY_DO_BEFORE_ACTION */
+                       *yy_cp = (yy_hold_char);
+                       yy_cp = (yy_last_accepting_cpos);
+                       yy_current_state = (yy_last_accepting_state);
+                       goto yy_find_action;
+
+case 1:
+YY_RULE_SETUP
+#line 40 "/Users/creed/projects/fsl/fromsvr/elftosb/elftosb2/elftosb_lexer.l"
+{ return TOK_OPTIONS; }
+       YY_BREAK
+case 2:
+YY_RULE_SETUP
+#line 41 "/Users/creed/projects/fsl/fromsvr/elftosb/elftosb2/elftosb_lexer.l"
+{ return TOK_CONSTANTS; }
+       YY_BREAK
+case 3:
+YY_RULE_SETUP
+#line 42 "/Users/creed/projects/fsl/fromsvr/elftosb/elftosb2/elftosb_lexer.l"
+{ return TOK_SOURCES; }
+       YY_BREAK
+case 4:
+YY_RULE_SETUP
+#line 43 "/Users/creed/projects/fsl/fromsvr/elftosb/elftosb2/elftosb_lexer.l"
+{ return TOK_FILTERS; }
+       YY_BREAK
+case 5:
+YY_RULE_SETUP
+#line 44 "/Users/creed/projects/fsl/fromsvr/elftosb/elftosb2/elftosb_lexer.l"
+{ return TOK_SECTION; }
+       YY_BREAK
+case 6:
+YY_RULE_SETUP
+#line 45 "/Users/creed/projects/fsl/fromsvr/elftosb/elftosb2/elftosb_lexer.l"
+{ return TOK_EXTERN; }
+       YY_BREAK
+case 7:
+YY_RULE_SETUP
+#line 46 "/Users/creed/projects/fsl/fromsvr/elftosb/elftosb2/elftosb_lexer.l"
+{ return TOK_FROM; }
+       YY_BREAK
+case 8:
+YY_RULE_SETUP
+#line 47 "/Users/creed/projects/fsl/fromsvr/elftosb/elftosb2/elftosb_lexer.l"
+{ return TOK_RAW; }
+       YY_BREAK
+case 9:
+YY_RULE_SETUP
+#line 48 "/Users/creed/projects/fsl/fromsvr/elftosb/elftosb2/elftosb_lexer.l"
+{ return TOK_LOAD; }
+       YY_BREAK
+case 10:
+YY_RULE_SETUP
+#line 49 "/Users/creed/projects/fsl/fromsvr/elftosb/elftosb2/elftosb_lexer.l"
+{ return TOK_JUMP; }
+       YY_BREAK
+case 11:
+YY_RULE_SETUP
+#line 50 "/Users/creed/projects/fsl/fromsvr/elftosb/elftosb2/elftosb_lexer.l"
+{ return TOK_CALL; }
+       YY_BREAK
+case 12:
+YY_RULE_SETUP
+#line 51 "/Users/creed/projects/fsl/fromsvr/elftosb/elftosb2/elftosb_lexer.l"
+{ return TOK_MODE; }
+       YY_BREAK
+case 13:
+YY_RULE_SETUP
+#line 52 "/Users/creed/projects/fsl/fromsvr/elftosb/elftosb2/elftosb_lexer.l"
+{ return TOK_IF; }
+       YY_BREAK
+case 14:
+YY_RULE_SETUP
+#line 53 "/Users/creed/projects/fsl/fromsvr/elftosb/elftosb2/elftosb_lexer.l"
+{ return TOK_ELSE; }
+       YY_BREAK
+case 15:
+YY_RULE_SETUP
+#line 54 "/Users/creed/projects/fsl/fromsvr/elftosb/elftosb2/elftosb_lexer.l"
+{ return TOK_DEFINED; }
+       YY_BREAK
+case 16:
+YY_RULE_SETUP
+#line 55 "/Users/creed/projects/fsl/fromsvr/elftosb/elftosb2/elftosb_lexer.l"
+{ return TOK_INFO; }
+       YY_BREAK
+case 17:
+YY_RULE_SETUP
+#line 56 "/Users/creed/projects/fsl/fromsvr/elftosb/elftosb2/elftosb_lexer.l"
+{ return TOK_WARNING; }
+       YY_BREAK
+case 18:
+YY_RULE_SETUP
+#line 57 "/Users/creed/projects/fsl/fromsvr/elftosb/elftosb2/elftosb_lexer.l"
+{ return TOK_ERROR; }
+       YY_BREAK
+case 19:
+YY_RULE_SETUP
+#line 58 "/Users/creed/projects/fsl/fromsvr/elftosb/elftosb2/elftosb_lexer.l"
+{ return TOK_SIZEOF; }
+       YY_BREAK
+case 20:
+YY_RULE_SETUP
+#line 59 "/Users/creed/projects/fsl/fromsvr/elftosb/elftosb2/elftosb_lexer.l"
+{ return TOK_DCD; }
+       YY_BREAK
+case 21:
+YY_RULE_SETUP
+#line 60 "/Users/creed/projects/fsl/fromsvr/elftosb/elftosb2/elftosb_lexer.l"
+{ return TOK_HAB; }
+       YY_BREAK
+case 22:
+YY_RULE_SETUP
+#line 61 "/Users/creed/projects/fsl/fromsvr/elftosb/elftosb2/elftosb_lexer.l"
+{ return TOK_IVT; }
+       YY_BREAK
+case 23:
+/* rule 23 can match eol */
+*yy_cp = (yy_hold_char); /* undo effects of setting up yytext */
+(yy_c_buf_p) = yy_cp = yy_bp + 1;
+YY_DO_BEFORE_ACTION; /* set up yytext again */
+YY_RULE_SETUP
+#line 63 "/Users/creed/projects/fsl/fromsvr/elftosb/elftosb2/elftosb_lexer.l"
+{      // must be followed by any non-ident char
+                                                                               int_size_t theSize;
+                                                                               switch (yytext[0])
+                                                                               {
+                                                                                       case 'w':
+                                                                                               theSize = kWordSize;
+                                                                                               break;
+                                                                                       case 'h':
+                                                                                               theSize = kHalfWordSize;
+                                                                                               break;
+                                                                                       case 'b':
+                                                                                               theSize = kByteSize;
+                                                                                               break;
+                                                                               }
+                                                                               m_symbolValue.m_int = new elftosb::SizedIntegerValue(0, theSize);
+                                                                               return TOK_INT_SIZE;
+                                                                       }
+       YY_BREAK
+case 24:
+YY_RULE_SETUP
+#line 81 "/Users/creed/projects/fsl/fromsvr/elftosb/elftosb2/elftosb_lexer.l"
+{
+                                                                               m_symbolValue.m_int = new elftosb::SizedIntegerValue(1, kWordSize);
+                                                                               return TOK_INT_LITERAL;
+                                                                       }
+       YY_BREAK
+case 25:
+YY_RULE_SETUP
+#line 86 "/Users/creed/projects/fsl/fromsvr/elftosb/elftosb2/elftosb_lexer.l"
+{
+                                                                               m_symbolValue.m_int = new elftosb::SizedIntegerValue(0, kWordSize);
+                                                                               return TOK_INT_LITERAL;
+                                                                       }
+       YY_BREAK
+case 26:
+YY_RULE_SETUP
+#line 91 "/Users/creed/projects/fsl/fromsvr/elftosb/elftosb2/elftosb_lexer.l"
+{
+                                                                               m_symbolValue.m_str = new std::string(yytext);
+                                                                               if (isSourceName(m_symbolValue.m_str))
+                                                                               {
+                                                                                       return TOK_SOURCE_NAME;
+                                                                               }
+                                                                               else
+                                                                               {
+                                                                                       return TOK_IDENT;
+                                                                               }
+                                                                       }
+       YY_BREAK
+case 27:
+YY_RULE_SETUP
+#line 103 "/Users/creed/projects/fsl/fromsvr/elftosb/elftosb2/elftosb_lexer.l"
+{
+                                                                               int base = 0;
+                                                                               uint32_t value;
+                                                                               int mult;
+                                                                               
+                                                                               // check for binary number
+                                                                               if (yytext[0] == '0' && yytext[1] == 'b')
+                                                                               {
+                                                                                       base = 2;               // this is a binary number
+                                                                                       yytext += 2;    // skip over the "0b"
+                                                                               }
+                                                                               
+                                                                               // convert value
+                                                                               value = (uint32_t)strtoul(yytext, NULL, base);
+                                                                               
+                                                                               // find multiplier
+                                                                               switch (yytext[strlen(yytext) - 1])
+                                                                               {
+                                                                                       case 'G':
+                                                                                               mult = 1024 * 1024 * 1024;
+                                                                                               break;
+                                                                                       case 'M':
+                                                                                               mult = 1024 * 1024;
+                                                                                               break;
+                                                                                       case 'K':
+                                                                                               mult = 1024;
+                                                                                               break;
+                                                                                       default:
+                                                                                               mult = 1;
+                                                                                               break;
+                                                                               }
+                                                                               
+                                                                               // set resulting symbol value
+                                                                               m_symbolValue.m_int = new elftosb::SizedIntegerValue(value * mult, kWordSize);
+                                                                               return TOK_INT_LITERAL;
+                                                                       }
+       YY_BREAK
+case 28:
+YY_RULE_SETUP
+#line 140 "/Users/creed/projects/fsl/fromsvr/elftosb/elftosb2/elftosb_lexer.l"
+{
+                                                                               uint32_t value = 0;
+                                                                               int_size_t theSize;
+                                                                               int len = strlen(yytext);
+                                                                               if (len >= 3)
+                                                                               {
+                                                                                       value = yytext[1];
+                                                                                       theSize = kByteSize;
+                                                                               }
+                                                                               if (len >= 4)
+                                                                               {
+                                                                                       value = (value << 8) | yytext[2];
+                                                                                       theSize = kHalfWordSize;
+                                                                               }
+                                                                               if (len >= 6)
+                                                                               {
+                                                                                       value = (value << 8) | yytext[3];
+                                                                                       value = (value << 8) | yytext[4];
+                                                                                       theSize = kWordSize;
+                                                                               }
+                                                                               m_symbolValue.m_int = new elftosb::SizedIntegerValue(value, theSize);
+                                                                               return TOK_INT_LITERAL;
+                                                                       }
+       YY_BREAK
+case 29:
+YY_RULE_SETUP
+#line 164 "/Users/creed/projects/fsl/fromsvr/elftosb/elftosb2/elftosb_lexer.l"
+{
+                                                                               // remove $ from string
+                                                                               m_symbolValue.m_str = new std::string(&yytext[1]);
+                                                                               return TOK_SECTION_NAME;
+                                                                       }
+       YY_BREAK
+case 30:
+YY_RULE_SETUP
+#line 171 "/Users/creed/projects/fsl/fromsvr/elftosb/elftosb2/elftosb_lexer.l"
+{ BEGIN(mlcmt); }
+       YY_BREAK
+case 31:
+YY_RULE_SETUP
+#line 173 "/Users/creed/projects/fsl/fromsvr/elftosb/elftosb2/elftosb_lexer.l"
+{
+                                                                               m_blob = new Blob();
+                                                                               m_blobFirstLine = yylineno;
+                                                                               BEGIN(blob);
+                                                                       }
+       YY_BREAK
+case 32:
+YY_RULE_SETUP
+#line 179 "/Users/creed/projects/fsl/fromsvr/elftosb/elftosb2/elftosb_lexer.l"
+{ return '{'; }
+       YY_BREAK
+case 33:
+YY_RULE_SETUP
+#line 181 "/Users/creed/projects/fsl/fromsvr/elftosb/elftosb2/elftosb_lexer.l"
+{ return '}'; }
+       YY_BREAK
+case 34:
+YY_RULE_SETUP
+#line 183 "/Users/creed/projects/fsl/fromsvr/elftosb/elftosb2/elftosb_lexer.l"
+{ return '('; }
+       YY_BREAK
+case 35:
+YY_RULE_SETUP
+#line 185 "/Users/creed/projects/fsl/fromsvr/elftosb/elftosb2/elftosb_lexer.l"
+{ return ')'; }
+       YY_BREAK
+case 36:
+YY_RULE_SETUP
+#line 187 "/Users/creed/projects/fsl/fromsvr/elftosb/elftosb2/elftosb_lexer.l"
+{ return '['; }
+       YY_BREAK
+case 37:
+YY_RULE_SETUP
+#line 189 "/Users/creed/projects/fsl/fromsvr/elftosb/elftosb2/elftosb_lexer.l"
+{ return ']'; }
+       YY_BREAK
+case 38:
+YY_RULE_SETUP
+#line 191 "/Users/creed/projects/fsl/fromsvr/elftosb/elftosb2/elftosb_lexer.l"
+{ return '='; }
+       YY_BREAK
+case 39:
+YY_RULE_SETUP
+#line 193 "/Users/creed/projects/fsl/fromsvr/elftosb/elftosb2/elftosb_lexer.l"
+{ return ','; }
+       YY_BREAK
+case 40:
+YY_RULE_SETUP
+#line 195 "/Users/creed/projects/fsl/fromsvr/elftosb/elftosb2/elftosb_lexer.l"
+{ return ':'; }
+       YY_BREAK
+case 41:
+YY_RULE_SETUP
+#line 197 "/Users/creed/projects/fsl/fromsvr/elftosb/elftosb2/elftosb_lexer.l"
+{ return ';'; }
+       YY_BREAK
+case 42:
+YY_RULE_SETUP
+#line 199 "/Users/creed/projects/fsl/fromsvr/elftosb/elftosb2/elftosb_lexer.l"
+{ return '.'; }
+       YY_BREAK
+case 43:
+YY_RULE_SETUP
+#line 201 "/Users/creed/projects/fsl/fromsvr/elftosb/elftosb2/elftosb_lexer.l"
+{ return '>'; }
+       YY_BREAK
+case 44:
+YY_RULE_SETUP
+#line 203 "/Users/creed/projects/fsl/fromsvr/elftosb/elftosb2/elftosb_lexer.l"
+{ return TOK_DOT_DOT; }
+       YY_BREAK
+case 45:
+YY_RULE_SETUP
+#line 205 "/Users/creed/projects/fsl/fromsvr/elftosb/elftosb2/elftosb_lexer.l"
+{ return '+'; }
+       YY_BREAK
+case 46:
+YY_RULE_SETUP
+#line 207 "/Users/creed/projects/fsl/fromsvr/elftosb/elftosb2/elftosb_lexer.l"
+{ return '-'; }
+       YY_BREAK
+case 47:
+YY_RULE_SETUP
+#line 209 "/Users/creed/projects/fsl/fromsvr/elftosb/elftosb2/elftosb_lexer.l"
+{ return '*'; }
+       YY_BREAK
+case 48:
+YY_RULE_SETUP
+#line 211 "/Users/creed/projects/fsl/fromsvr/elftosb/elftosb2/elftosb_lexer.l"
+{ return '/'; }
+       YY_BREAK
+case 49:
+YY_RULE_SETUP
+#line 213 "/Users/creed/projects/fsl/fromsvr/elftosb/elftosb2/elftosb_lexer.l"
+{ return '%'; }
+       YY_BREAK
+case 50:
+YY_RULE_SETUP
+#line 215 "/Users/creed/projects/fsl/fromsvr/elftosb/elftosb2/elftosb_lexer.l"
+{ return '~'; }
+       YY_BREAK
+case 51:
+YY_RULE_SETUP
+#line 217 "/Users/creed/projects/fsl/fromsvr/elftosb/elftosb2/elftosb_lexer.l"
+{ return '^'; }
+       YY_BREAK
+case 52:
+YY_RULE_SETUP
+#line 219 "/Users/creed/projects/fsl/fromsvr/elftosb/elftosb2/elftosb_lexer.l"
+{ return TOK_LSHIFT; }
+       YY_BREAK
+case 53:
+YY_RULE_SETUP
+#line 221 "/Users/creed/projects/fsl/fromsvr/elftosb/elftosb2/elftosb_lexer.l"
+{ return TOK_RSHIFT; }
+       YY_BREAK
+case 54:
+YY_RULE_SETUP
+#line 223 "/Users/creed/projects/fsl/fromsvr/elftosb/elftosb2/elftosb_lexer.l"
+{ return '&'; }
+       YY_BREAK
+case 55:
+YY_RULE_SETUP
+#line 225 "/Users/creed/projects/fsl/fromsvr/elftosb/elftosb2/elftosb_lexer.l"
+{ return '|'; }
+       YY_BREAK
+case 56:
+YY_RULE_SETUP
+#line 227 "/Users/creed/projects/fsl/fromsvr/elftosb/elftosb2/elftosb_lexer.l"
+{ return TOK_POWER; }
+       YY_BREAK
+case 57:
+YY_RULE_SETUP
+#line 229 "/Users/creed/projects/fsl/fromsvr/elftosb/elftosb2/elftosb_lexer.l"
+{ return '<'; }
+       YY_BREAK
+case 58:
+YY_RULE_SETUP
+#line 231 "/Users/creed/projects/fsl/fromsvr/elftosb/elftosb2/elftosb_lexer.l"
+{ return TOK_GEQ; }
+       YY_BREAK
+case 59:
+YY_RULE_SETUP
+#line 233 "/Users/creed/projects/fsl/fromsvr/elftosb/elftosb2/elftosb_lexer.l"
+{ return TOK_LEQ; }
+       YY_BREAK
+case 60:
+YY_RULE_SETUP
+#line 235 "/Users/creed/projects/fsl/fromsvr/elftosb/elftosb2/elftosb_lexer.l"
+{ return TOK_EQ; }
+       YY_BREAK
+case 61:
+YY_RULE_SETUP
+#line 237 "/Users/creed/projects/fsl/fromsvr/elftosb/elftosb2/elftosb_lexer.l"
+{ return TOK_NEQ; }
+       YY_BREAK
+case 62:
+YY_RULE_SETUP
+#line 239 "/Users/creed/projects/fsl/fromsvr/elftosb/elftosb2/elftosb_lexer.l"
+{ return TOK_AND; }
+       YY_BREAK
+case 63:
+YY_RULE_SETUP
+#line 241 "/Users/creed/projects/fsl/fromsvr/elftosb/elftosb2/elftosb_lexer.l"
+{ return TOK_OR; }
+       YY_BREAK
+case 64:
+YY_RULE_SETUP
+#line 243 "/Users/creed/projects/fsl/fromsvr/elftosb/elftosb2/elftosb_lexer.l"
+{ return '!'; }
+       YY_BREAK
+case 65:
+/* rule 65 can match eol */
+YY_RULE_SETUP
+#line 245 "/Users/creed/projects/fsl/fromsvr/elftosb/elftosb2/elftosb_lexer.l"
+{
+                                                                               // get rid of quotes
+                                                                               yytext++;
+                                                                               yytext[strlen(yytext) - 1] = 0;
+//                                                                             processStringEscapes(yytext, yytext);
+                                                                               m_symbolValue.m_str = new std::string(yytext);
+                                                                               return TOK_STRING_LITERAL;
+                                                                       }
+       YY_BREAK
+case 66:
+YY_RULE_SETUP
+#line 254 "/Users/creed/projects/fsl/fromsvr/elftosb/elftosb2/elftosb_lexer.l"
+{
+                                                                               uint8_t x = (hexCharToInt(yytext[0]) << 4) | hexCharToInt(yytext[1]);
+                                                                               m_blob->append(&x, 1);
+                                                                       }
+       YY_BREAK
+case 67:
+YY_RULE_SETUP
+#line 259 "/Users/creed/projects/fsl/fromsvr/elftosb/elftosb2/elftosb_lexer.l"
+{
+                                                                               BEGIN(INITIAL);
+                                                                               m_symbolValue.m_blob = m_blob;
+                                                                               m_blob = NULL;
+                                                                               m_location.m_firstLine = m_blobFirstLine;
+                                                                               return TOK_BLOB;
+                                                                       }
+       YY_BREAK
+case 68:
+YY_RULE_SETUP
+#line 267 "/Users/creed/projects/fsl/fromsvr/elftosb/elftosb2/elftosb_lexer.l"
+{
+                                        // end of multi-line comment, return to initial state
+                                        BEGIN(INITIAL);
+                                    }
+       YY_BREAK
+case 69:
+*yy_cp = (yy_hold_char); /* undo effects of setting up yytext */
+(yy_c_buf_p) = yy_cp -= 1;
+YY_DO_BEFORE_ACTION; /* set up yytext again */
+YY_RULE_SETUP
+#line 273 "/Users/creed/projects/fsl/fromsvr/elftosb/elftosb2/elftosb_lexer.l"
+/* absorb single-line comment */
+       YY_BREAK
+case 70:
+YY_RULE_SETUP
+#line 275 "/Users/creed/projects/fsl/fromsvr/elftosb/elftosb2/elftosb_lexer.l"
+/* eat up whitespace in all states */
+       YY_BREAK
+case 71:
+/* rule 71 can match eol */
+YY_RULE_SETUP
+#line 277 "/Users/creed/projects/fsl/fromsvr/elftosb/elftosb2/elftosb_lexer.l"
+{
+                                                                               /* eat up whitespace and count lines in all states */
+                                                                               m_line++;
+                                                                       }
+       YY_BREAK
+case 72:
+YY_RULE_SETUP
+#line 282 "/Users/creed/projects/fsl/fromsvr/elftosb/elftosb2/elftosb_lexer.l"
+/* ignore all other chars in a multi-line comment */
+       YY_BREAK
+case 73:
+YY_RULE_SETUP
+#line 284 "/Users/creed/projects/fsl/fromsvr/elftosb/elftosb2/elftosb_lexer.l"
+{
+                                                                               /* all other chars produce errors */
+                                                                               char msg[50];
+                                                                               sprintf(msg, "unexpected character '%c' on line %d", yytext[0], m_line);
+                                                                               LexerError(msg);
+                                                                       }
+       YY_BREAK
+case 74:
+YY_RULE_SETUP
+#line 291 "/Users/creed/projects/fsl/fromsvr/elftosb/elftosb2/elftosb_lexer.l"
+ECHO;
+       YY_BREAK
+#line 1325 "/Users/creed/projects/fsl/fromsvr/elftosb/build/elftosb.build/Debug/elftosb.build/DerivedSources/elftosb_lexer.cpp"
+case YY_STATE_EOF(INITIAL):
+case YY_STATE_EOF(blob):
+case YY_STATE_EOF(mlcmt):
+       yyterminate();
+
+       case YY_END_OF_BUFFER:
+               {
+               /* Amount of text matched not including the EOB char. */
+               int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1;
+
+               /* Undo the effects of YY_DO_BEFORE_ACTION. */
+               *yy_cp = (yy_hold_char);
+               YY_RESTORE_YY_MORE_OFFSET
+
+               if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )
+                       {
+                       /* We're scanning a new file or input source.  It's
+                        * possible that this happened because the user
+                        * just pointed yyin at a new source and called
+                        * yylex().  If so, then we have to assure
+                        * consistency between YY_CURRENT_BUFFER and our
+                        * globals.  Here is the right place to do so, because
+                        * this is the first action (other than possibly a
+                        * back-up) that will match for the new input source.
+                        */
+                       (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
+                       YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin;
+                       YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;
+                       }
+
+               /* Note that here we test for yy_c_buf_p "<=" to the position
+                * of the first EOB in the buffer, since yy_c_buf_p will
+                * already have been incremented past the NUL character
+                * (since all states make transitions on EOB to the
+                * end-of-buffer state).  Contrast this with the test
+                * in input().
+                */
+               if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
+                       { /* This was really a NUL. */
+                       yy_state_type yy_next_state;
+
+                       (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text;
+
+                       yy_current_state = yy_get_previous_state(  );
+
+                       /* Okay, we're now positioned to make the NUL
+                        * transition.  We couldn't have
+                        * yy_get_previous_state() go ahead and do it
+                        * for us because it doesn't know how to deal
+                        * with the possibility of jamming (and we don't
+                        * want to build jamming into it because then it
+                        * will run more slowly).
+                        */
+
+                       yy_next_state = yy_try_NUL_trans( yy_current_state );
+
+                       yy_bp = (yytext_ptr) + YY_MORE_ADJ;
+
+                       if ( yy_next_state )
+                               {
+                               /* Consume the NUL. */
+                               yy_cp = ++(yy_c_buf_p);
+                               yy_current_state = yy_next_state;
+                               goto yy_match;
+                               }
+
+                       else
+                               {
+                               yy_cp = (yy_last_accepting_cpos);
+                               yy_current_state = (yy_last_accepting_state);
+                               goto yy_find_action;
+                               }
+                       }
+
+               else switch ( yy_get_next_buffer(  ) )
+                       {
+                       case EOB_ACT_END_OF_FILE:
+                               {
+                               (yy_did_buffer_switch_on_eof) = 0;
+
+                               if ( yywrap(  ) )
+                                       {
+                                       /* Note: because we've taken care in
+                                        * yy_get_next_buffer() to have set up
+                                        * yytext, we can now set up
+                                        * yy_c_buf_p so that if some total
+                                        * hoser (like flex itself) wants to
+                                        * call the scanner after we return the
+                                        * YY_NULL, it'll still work - another
+                                        * YY_NULL will get returned.
+                                        */
+                                       (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ;
+
+                                       yy_act = YY_STATE_EOF(YY_START);
+                                       goto do_action;
+                                       }
+
+                               else
+                                       {
+                                       if ( ! (yy_did_buffer_switch_on_eof) )
+                                               YY_NEW_FILE;
+                                       }
+                               break;
+                               }
+
+                       case EOB_ACT_CONTINUE_SCAN:
+                               (yy_c_buf_p) =
+                                       (yytext_ptr) + yy_amount_of_matched_text;
+
+                               yy_current_state = yy_get_previous_state(  );
+
+                               yy_cp = (yy_c_buf_p);
+                               yy_bp = (yytext_ptr) + YY_MORE_ADJ;
+                               goto yy_match;
+
+                       case EOB_ACT_LAST_MATCH:
+                               (yy_c_buf_p) =
+                               &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)];
+
+                               yy_current_state = yy_get_previous_state(  );
+
+                               yy_cp = (yy_c_buf_p);
+                               yy_bp = (yytext_ptr) + YY_MORE_ADJ;
+                               goto yy_find_action;
+                       }
+               break;
+               }
+
+       default:
+               YY_FATAL_ERROR(
+                       "fatal flex scanner internal error--no action found" );
+       } /* end of action switch */
+               } /* end of scanning one token */
+} /* end of yylex */
+
+/* The contents of this function are C++ specific, so the () macro is not used.
+ */
+yyFlexLexer::yyFlexLexer( std::istream* arg_yyin, std::ostream* arg_yyout )
+{
+       yyin = arg_yyin;
+       yyout = arg_yyout;
+       yy_c_buf_p = 0;
+       yy_init = 0;
+       yy_start = 0;
+       yy_flex_debug = 0;
+       yylineno = 1;   // this will only get updated if %option yylineno
+
+       yy_did_buffer_switch_on_eof = 0;
+
+       yy_looking_for_trail_begin = 0;
+       yy_more_flag = 0;
+       yy_more_len = 0;
+       yy_more_offset = yy_prev_more_offset = 0;
+
+       yy_start_stack_ptr = yy_start_stack_depth = 0;
+       yy_start_stack = NULL;
+
+       yy_buffer_stack = 0;
+       yy_buffer_stack_top = 0;
+       yy_buffer_stack_max = 0;
+
+       yy_state_buf = 0;
+
+}
+
+/* The contents of this function are C++ specific, so the () macro is not used.
+ */
+yyFlexLexer::~yyFlexLexer()
+{
+       delete [] yy_state_buf;
+       yyfree(yy_start_stack  );
+       yy_delete_buffer( YY_CURRENT_BUFFER );
+       yyfree(yy_buffer_stack  );
+}
+
+/* The contents of this function are C++ specific, so the () macro is not used.
+ */
+void yyFlexLexer::switch_streams( std::istream* new_in, std::ostream* new_out )
+{
+       if ( new_in )
+               {
+               yy_delete_buffer( YY_CURRENT_BUFFER );
+               yy_switch_to_buffer( yy_create_buffer( new_in, YY_BUF_SIZE  ) );
+               }
+
+       if ( new_out )
+               yyout = new_out;
+}
+
+#ifdef YY_INTERACTIVE
+int yyFlexLexer::LexerInput( char* buf, int /* max_size */ )
+#else
+int yyFlexLexer::LexerInput( char* buf, int max_size )
+#endif
+{
+       if ( yyin->eof() || yyin->fail() )
+               return 0;
+
+#ifdef YY_INTERACTIVE
+       yyin->get( buf[0] );
+
+       if ( yyin->eof() )
+               return 0;
+
+       if ( yyin->bad() )
+               return -1;
+
+       return 1;
+
+#else
+       (void) yyin->read( buf, max_size );
+
+       if ( yyin->bad() )
+               return -1;
+       else
+               return yyin->gcount();
+#endif
+}
+
+void yyFlexLexer::LexerOutput( const char* buf, int size )
+{
+       (void) yyout->write( buf, size );
+}
+
+/* yy_get_next_buffer - try to read in a new buffer
+ *
+ * Returns a code representing an action:
+ *     EOB_ACT_LAST_MATCH -
+ *     EOB_ACT_CONTINUE_SCAN - continue scanning from current position
+ *     EOB_ACT_END_OF_FILE - end of file
+ */
+int yyFlexLexer::yy_get_next_buffer()
+{
+       register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
+       register char *source = (yytext_ptr);
+       register int number_to_move, i;
+       int ret_val;
+
+       if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] )
+               YY_FATAL_ERROR(
+               "fatal flex scanner internal error--end of buffer missed" );
+
+       if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 )
+               { /* Don't try to fill the buffer, so this is an EOF. */
+               if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 )
+                       {
+                       /* We matched a single character, the EOB, so
+                        * treat this as a final EOF.
+                        */
+                       return EOB_ACT_END_OF_FILE;
+                       }
+
+               else
+                       {
+                       /* We matched some text prior to the EOB, first
+                        * process it.
+                        */
+                       return EOB_ACT_LAST_MATCH;
+                       }
+               }
+
+       /* Try to read more data. */
+
+       /* First move last chars to start of buffer. */
+       number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1;
+
+       for ( i = 0; i < number_to_move; ++i )
+               *(dest++) = *(source++);
+
+       if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )
+               /* don't do the read, it's not guaranteed to return an EOF,
+                * just force an EOF
+                */
+               YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0;
+
+       else
+               {
+                       yy_size_t num_to_read =
+                       YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
+
+               while ( num_to_read <= 0 )
+                       { /* Not enough room in the buffer - grow it. */
+
+                       /* just a shorter name for the current buffer */
+                       YY_BUFFER_STATE b = YY_CURRENT_BUFFER;
+
+                       int yy_c_buf_p_offset =
+                               (int) ((yy_c_buf_p) - b->yy_ch_buf);
+
+                       if ( b->yy_is_our_buffer )
+                               {
+                               yy_size_t new_size = b->yy_buf_size * 2;
+
+                               if ( new_size <= 0 )
+                                       b->yy_buf_size += b->yy_buf_size / 8;
+                               else
+                                       b->yy_buf_size *= 2;
+
+                               b->yy_ch_buf = (char *)
+                                       /* Include room in for 2 EOB chars. */
+                                       yyrealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2  );
+                               }
+                       else
+                               /* Can't grow it, we don't own it. */
+                               b->yy_ch_buf = 0;
+
+                       if ( ! b->yy_ch_buf )
+                               YY_FATAL_ERROR(
+                               "fatal error - scanner input buffer overflow" );
+
+                       (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset];
+
+                       num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size -
+                                               number_to_move - 1;
+
+                       }
+
+               if ( num_to_read > YY_READ_BUF_SIZE )
+                       num_to_read = YY_READ_BUF_SIZE;
+
+               /* Read in more data. */
+               YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
+                       (yy_n_chars), num_to_read );
+
+               YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
+               }
+
+       if ( (yy_n_chars) == 0 )
+               {
+               if ( number_to_move == YY_MORE_ADJ )
+                       {
+                       ret_val = EOB_ACT_END_OF_FILE;
+                       yyrestart( yyin  );
+                       }
+
+               else
+                       {
+                       ret_val = EOB_ACT_LAST_MATCH;
+                       YY_CURRENT_BUFFER_LVALUE->yy_buffer_status =
+                               YY_BUFFER_EOF_PENDING;
+                       }
+               }
+
+       else
+               ret_val = EOB_ACT_CONTINUE_SCAN;
+
+       if ((yy_size_t) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
+               /* Extend the array by 50%, plus the number we really need. */
+               yy_size_t new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1);
+               YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size  );
+               if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
+                       YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
+       }
+
+       (yy_n_chars) += number_to_move;
+       YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR;
+       YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR;
+
+       (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];
+
+       return ret_val;
+}
+
+/* yy_get_previous_state - get the state just before the EOB char was reached */
+
+    yy_state_type yyFlexLexer::yy_get_previous_state()
+{
+       register yy_state_type yy_current_state;
+       register char *yy_cp;
+    
+       yy_current_state = (yy_start);
+
+       for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp )
+               {
+               register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
+               if ( yy_accept[yy_current_state] )
+                       {
+                       (yy_last_accepting_state) = yy_current_state;
+                       (yy_last_accepting_cpos) = yy_cp;
+                       }
+               while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
+                       {
+                       yy_current_state = (int) yy_def[yy_current_state];
+                       if ( yy_current_state >= 218 )
+                               yy_c = yy_meta[(unsigned int) yy_c];
+                       }
+               yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
+               }
+
+       return yy_current_state;
+}
+
+/* yy_try_NUL_trans - try to make a transition on the NUL character
+ *
+ * synopsis
+ *     next_state = yy_try_NUL_trans( current_state );
+ */
+    yy_state_type yyFlexLexer::yy_try_NUL_trans( yy_state_type yy_current_state )
+{
+       register int yy_is_jam;
+       register char *yy_cp = (yy_c_buf_p);
+
+       register YY_CHAR yy_c = 1;
+       if ( yy_accept[yy_current_state] )
+               {
+               (yy_last_accepting_state) = yy_current_state;
+               (yy_last_accepting_cpos) = yy_cp;
+               }
+       while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
+               {
+               yy_current_state = (int) yy_def[yy_current_state];
+               if ( yy_current_state >= 218 )
+                       yy_c = yy_meta[(unsigned int) yy_c];
+               }
+       yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
+       yy_is_jam = (yy_current_state == 217);
+
+       return yy_is_jam ? 0 : yy_current_state;
+}
+
+    void yyFlexLexer::yyunput( int c, register char* yy_bp)
+{
+       register char *yy_cp;
+    
+    yy_cp = (yy_c_buf_p);
+
+       /* undo effects of setting up yytext */
+       *yy_cp = (yy_hold_char);
+
+       if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
+               { /* need to shift things up to make room */
+               /* +2 for EOB chars. */
+               register yy_size_t number_to_move = (yy_n_chars) + 2;
+               register char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[
+                                       YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2];
+               register char *source =
+                               &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move];
+
+               while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
+                       *--dest = *--source;
+
+               yy_cp += (int) (dest - source);
+               yy_bp += (int) (dest - source);
+               YY_CURRENT_BUFFER_LVALUE->yy_n_chars =
+                       (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_buf_size;
+
+               if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
+                       YY_FATAL_ERROR( "flex scanner push-back overflow" );
+               }
+
+       *--yy_cp = (char) c;
+
+    if ( c == '\n' ){
+        --yylineno;
+    }
+
+       (yytext_ptr) = yy_bp;
+       (yy_hold_char) = *yy_cp;
+       (yy_c_buf_p) = yy_cp;
+}
+
+    int yyFlexLexer::yyinput()
+{
+       int c;
+    
+       *(yy_c_buf_p) = (yy_hold_char);
+
+       if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR )
+               {
+               /* yy_c_buf_p now points to the character we want to return.
+                * If this occurs *before* the EOB characters, then it's a
+                * valid NUL; if not, then we've hit the end of the buffer.
+                */
+               if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
+                       /* This was really a NUL. */
+                       *(yy_c_buf_p) = '\0';
+
+               else
+                       { /* need more input */
+                       yy_size_t offset = (yy_c_buf_p) - (yytext_ptr);
+                       ++(yy_c_buf_p);
+
+                       switch ( yy_get_next_buffer(  ) )
+                               {
+                               case EOB_ACT_LAST_MATCH:
+                                       /* This happens because yy_g_n_b()
+                                        * sees that we've accumulated a
+                                        * token and flags that we need to
+                                        * try matching the token before
+                                        * proceeding.  But for input(),
+                                        * there's no matching to consider.
+                                        * So convert the EOB_ACT_LAST_MATCH
+                                        * to EOB_ACT_END_OF_FILE.
+                                        */
+
+                                       /* Reset buffer status. */
+                                       yyrestart( yyin );
+
+                                       /*FALLTHROUGH*/
+
+                               case EOB_ACT_END_OF_FILE:
+                                       {
+                                       if ( yywrap(  ) )
+                                               return 0;
+
+                                       if ( ! (yy_did_buffer_switch_on_eof) )
+                                               YY_NEW_FILE;
+#ifdef __cplusplus
+                                       return yyinput();
+#else
+                                       return input();
+#endif
+                                       }
+
+                               case EOB_ACT_CONTINUE_SCAN:
+                                       (yy_c_buf_p) = (yytext_ptr) + offset;
+                                       break;
+                               }
+                       }
+               }
+
+       c = *(unsigned char *) (yy_c_buf_p);    /* cast for 8-bit char's */
+       *(yy_c_buf_p) = '\0';   /* preserve yytext */
+       (yy_hold_char) = *++(yy_c_buf_p);
+
+       if ( c == '\n' )
+                  
+    yylineno++;
+;
+
+       return c;
+}
+
+/** Immediately switch to a different input stream.
+ * @param input_file A readable stream.
+ * 
+ * @note This function does not reset the start condition to @c INITIAL .
+ */
+    void yyFlexLexer::yyrestart( std::istream* input_file )
+{
+    
+       if ( ! YY_CURRENT_BUFFER ){
+        yyensure_buffer_stack ();
+               YY_CURRENT_BUFFER_LVALUE =
+            yy_create_buffer( yyin, YY_BUF_SIZE );
+       }
+
+       yy_init_buffer( YY_CURRENT_BUFFER, input_file );
+       yy_load_buffer_state(  );
+}
+
+/** Switch to a different input buffer.
+ * @param new_buffer The new input buffer.
+ * 
+ */
+    void yyFlexLexer::yy_switch_to_buffer( YY_BUFFER_STATE new_buffer )
+{
+    
+       /* TODO. We should be able to replace this entire function body
+        * with
+        *              yypop_buffer_state();
+        *              yypush_buffer_state(new_buffer);
+     */
+       yyensure_buffer_stack ();
+       if ( YY_CURRENT_BUFFER == new_buffer )
+               return;
+
+       if ( YY_CURRENT_BUFFER )
+               {
+               /* Flush out information for old buffer. */
+               *(yy_c_buf_p) = (yy_hold_char);
+               YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
+               YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
+               }
+
+       YY_CURRENT_BUFFER_LVALUE = new_buffer;
+       yy_load_buffer_state(  );
+
+       /* We don't actually know whether we did this switch during
+        * EOF (yywrap()) processing, but the only time this flag
+        * is looked at is after yywrap() is called, so it's safe
+        * to go ahead and always set it.
+        */
+       (yy_did_buffer_switch_on_eof) = 1;
+}
+
+    void yyFlexLexer::yy_load_buffer_state()
+{
+       (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
+       (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;
+       yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file;
+       (yy_hold_char) = *(yy_c_buf_p);
+}
+
+/** Allocate and initialize an input buffer state.
+ * @param file A readable stream.
+ * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE.
+ * 
+ * @return the allocated buffer state.
+ */
+    YY_BUFFER_STATE yyFlexLexer::yy_create_buffer( std::istream* file, int size )
+{
+       YY_BUFFER_STATE b;
+    
+       b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state )  );
+       if ( ! b )
+               YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
+
+       b->yy_buf_size = size;
+
+       /* yy_ch_buf has to be 2 characters longer than the size given because
+        * we need to put in 2 end-of-buffer characters.
+        */
+       b->yy_ch_buf = (char *) yyalloc(b->yy_buf_size + 2  );
+       if ( ! b->yy_ch_buf )
+               YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
+
+       b->yy_is_our_buffer = 1;
+
+       yy_init_buffer( b, file );
+
+       return b;
+}
+
+/** Destroy the buffer.
+ * @param b a buffer created with yy_create_buffer()
+ * 
+ */
+    void yyFlexLexer::yy_delete_buffer( YY_BUFFER_STATE b )
+{
+    
+       if ( ! b )
+               return;
+
+       if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */
+               YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0;
+
+       if ( b->yy_is_our_buffer )
+               yyfree((void *) b->yy_ch_buf  );
+
+       yyfree((void *) b  );
+}
+
+/* Initializes or reinitializes a buffer.
+ * This function is sometimes called more than once on the same buffer,
+ * such as during a yyrestart() or at EOF.
+ */
+    void yyFlexLexer::yy_init_buffer( YY_BUFFER_STATE b, std::istream* file )
+
+{
+       int oerrno = errno;
+    
+       yy_flush_buffer( b );
+
+       b->yy_input_file = file;
+       b->yy_fill_buffer = 1;
+
+    /* If b is the current buffer, then yy_init_buffer was _probably_
+     * called from yyrestart() or through yy_get_next_buffer.
+     * In that case, we don't want to reset the lineno or column.
+     */
+    if (b != YY_CURRENT_BUFFER){
+        b->yy_bs_lineno = 1;
+        b->yy_bs_column = 0;
+    }
+
+       b->yy_is_interactive = 0;
+       errno = oerrno;
+}
+
+/** Discard all buffered characters. On the next scan, YY_INPUT will be called.
+ * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER.
+ * 
+ */
+    void yyFlexLexer::yy_flush_buffer( YY_BUFFER_STATE b )
+{
+       if ( ! b )
+               return;
+
+       b->yy_n_chars = 0;
+
+       /* We always need two end-of-buffer characters.  The first causes
+        * a transition to the end-of-buffer state.  The second causes
+        * a jam in that state.
+        */
+       b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
+       b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
+
+       b->yy_buf_pos = &b->yy_ch_buf[0];
+
+       b->yy_at_bol = 1;
+       b->yy_buffer_status = YY_BUFFER_NEW;
+
+       if ( b == YY_CURRENT_BUFFER )
+               yy_load_buffer_state(  );
+}
+
+/** Pushes the new state onto the stack. The new state becomes
+ *  the current state. This function will allocate the stack
+ *  if necessary.
+ *  @param new_buffer The new state.
+ *  
+ */
+void yyFlexLexer::yypush_buffer_state (YY_BUFFER_STATE new_buffer)
+{
+       if (new_buffer == NULL)
+               return;
+
+       yyensure_buffer_stack();
+
+       /* This block is copied from yy_switch_to_buffer. */
+       if ( YY_CURRENT_BUFFER )
+               {
+               /* Flush out information for old buffer. */
+               *(yy_c_buf_p) = (yy_hold_char);
+               YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
+               YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
+               }
+
+       /* Only push if top exists. Otherwise, replace top. */
+       if (YY_CURRENT_BUFFER)
+               (yy_buffer_stack_top)++;
+       YY_CURRENT_BUFFER_LVALUE = new_buffer;
+
+       /* copied from yy_switch_to_buffer. */
+       yy_load_buffer_state(  );
+       (yy_did_buffer_switch_on_eof) = 1;
+}
+
+/** Removes and deletes the top of the stack, if present.
+ *  The next element becomes the new top.
+ *  
+ */
+void yyFlexLexer::yypop_buffer_state (void)
+{
+       if (!YY_CURRENT_BUFFER)
+               return;
+
+       yy_delete_buffer(YY_CURRENT_BUFFER );
+       YY_CURRENT_BUFFER_LVALUE = NULL;
+       if ((yy_buffer_stack_top) > 0)
+               --(yy_buffer_stack_top);
+
+       if (YY_CURRENT_BUFFER) {
+               yy_load_buffer_state(  );
+               (yy_did_buffer_switch_on_eof) = 1;
+       }
+}
+
+/* Allocates the stack if it does not exist.
+ *  Guarantees space for at least one push.
+ */
+void yyFlexLexer::yyensure_buffer_stack(void)
+{
+       yy_size_t num_to_alloc;
+    
+       if (!(yy_buffer_stack)) {
+
+               /* First allocation is just for 2 elements, since we don't know if this
+                * scanner will even need a stack. We use 2 instead of 1 to avoid an
+                * immediate realloc on the next call.
+         */
+               num_to_alloc = 1;
+               (yy_buffer_stack) = (struct yy_buffer_state**)yyalloc
+                                                               (num_to_alloc * sizeof(struct yy_buffer_state*)
+                                                               );
+               if ( ! (yy_buffer_stack) )
+                       YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
+                                                                 
+               memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*));
+                               
+               (yy_buffer_stack_max) = num_to_alloc;
+               (yy_buffer_stack_top) = 0;
+               return;
+       }
+
+       if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){
+
+               /* Increase the buffer to prepare for a possible push. */
+               int grow_size = 8 /* arbitrary grow size */;
+
+               num_to_alloc = (yy_buffer_stack_max) + grow_size;
+               (yy_buffer_stack) = (struct yy_buffer_state**)yyrealloc
+                                                               ((yy_buffer_stack),
+                                                               num_to_alloc * sizeof(struct yy_buffer_state*)
+                                                               );
+               if ( ! (yy_buffer_stack) )
+                       YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
+
+               /* zero only the new slots.*/
+               memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*));
+               (yy_buffer_stack_max) = num_to_alloc;
+       }
+}
+
+    void yyFlexLexer::yy_push_state( int new_state )
+{
+       if ( (yy_start_stack_ptr) >= (yy_start_stack_depth) )
+               {
+               yy_size_t new_size;
+
+               (yy_start_stack_depth) += YY_START_STACK_INCR;
+               new_size = (yy_start_stack_depth) * sizeof( int );
+
+               if ( ! (yy_start_stack) )
+                       (yy_start_stack) = (int *) yyalloc(new_size  );
+
+               else
+                       (yy_start_stack) = (int *) yyrealloc((void *) (yy_start_stack),new_size  );
+
+               if ( ! (yy_start_stack) )
+                       YY_FATAL_ERROR( "out of memory expanding start-condition stack" );
+               }
+
+       (yy_start_stack)[(yy_start_stack_ptr)++] = YY_START;
+
+       BEGIN(new_state);
+}
+
+    void yyFlexLexer::yy_pop_state()
+{
+       if ( --(yy_start_stack_ptr) < 0 )
+               YY_FATAL_ERROR( "start-condition stack underflow" );
+
+       BEGIN((yy_start_stack)[(yy_start_stack_ptr)]);
+}
+
+    int yyFlexLexer::yy_top_state()
+{
+       return (yy_start_stack)[(yy_start_stack_ptr) - 1];
+}
+
+#ifndef YY_EXIT_FAILURE
+#define YY_EXIT_FAILURE 2
+#endif
+
+void yyFlexLexer::LexerError( yyconst char msg[] )
+{
+       std::cerr << msg << std::endl;
+       exit( YY_EXIT_FAILURE );
+}
+
+/* Redefine yyless() so it works in section 3 code. */
+
+#undef yyless
+#define yyless(n) \
+       do \
+               { \
+               /* Undo effects of setting up yytext. */ \
+        int yyless_macro_arg = (n); \
+        YY_LESS_LINENO(yyless_macro_arg);\
+               yytext[yyleng] = (yy_hold_char); \
+               (yy_c_buf_p) = yytext + yyless_macro_arg; \
+               (yy_hold_char) = *(yy_c_buf_p); \
+               *(yy_c_buf_p) = '\0'; \
+               yyleng = yyless_macro_arg; \
+               } \
+       while ( 0 )
+
+/* Accessor  methods (get/set functions) to struct members. */
+
+/*
+ * Internal utility routines.
+ */
+
+#ifndef yytext_ptr
+static void yy_flex_strncpy (char* s1, yyconst char * s2, int n )
+{
+       register int i;
+       for ( i = 0; i < n; ++i )
+               s1[i] = s2[i];
+}
+#endif
+
+#ifdef YY_NEED_STRLEN
+static int yy_flex_strlen (yyconst char * s )
+{
+       register int n;
+       for ( n = 0; s[n]; ++n )
+               ;
+
+       return n;
+}
+#endif
+
+void *yyalloc (yy_size_t  size )
+{
+       return (void *) malloc( size );
+}
+
+void *yyrealloc  (void * ptr, yy_size_t  size )
+{
+       /* The cast to (char *) in the following accommodates both
+        * implementations that use char* generic pointers, and those
+        * that use void* generic pointers.  It works with the latter
+        * because both ANSI C and C++ allow castless assignment from
+        * any pointer type to void*, and deal with argument conversions
+        * as though doing an assignment.
+        */
+       return (void *) realloc( (char *) ptr, size );
+}
+
+void yyfree (void * ptr )
+{
+       free( (char *) ptr );   /* see yyrealloc() for (char *) cast */
+}
+
+#define YYTABLES_NAME "yytables"
+
+#line 291 "/Users/creed/projects/fsl/fromsvr/elftosb/elftosb2/elftosb_lexer.l"
+
+
+
+// verbatim code copied to the bottom of the output
+
+
+
diff --git a/tools/elftosb/elftosb2/elftosb_lexer.l b/tools/elftosb/elftosb2/elftosb_lexer.l
new file mode 100644 (file)
index 0000000..23272b7
--- /dev/null
@@ -0,0 +1,299 @@
+/*
+ * Copyright (c) Freescale Semiconductor, Inc. All rights reserved.
+ * See included license file for license details.
+ */
+
+%option c++
+/* %option prefix="Elftosb" */
+%option yylineno
+%option never-interactive
+%option yyclass="ElftosbLexer"
+%option noyywrap
+
+%{
+#include "ElftosbLexer.h"
+#include <stdlib.h>
+#include <limits.h>
+#include <string>
+#include "HexValues.h"
+#include "Value.h"
+
+using namespace elftosb;
+
+//! Always executed before all other actions when a token is matched.
+//! This action just assign the first and last lines of the token to
+//! the current line. In most cases this is correct.
+#define YY_USER_ACTION do {                                                                    \
+                                                       m_location.m_firstLine = m_line;                \
+                                                       m_location.m_lastLine = m_line;         \
+                                               } while (0);
+
+%}
+
+DIGIT          [0-9]
+HEXDIGIT       [0-9a-fA-F]
+BINDIGIT       [0-1]
+IDENT          [a-zA-Z_][a-zA-Z0-9_]*
+ESC                    \\(x{HEXDIGIT}{2}|.)
+
+/* start conditions */
+%x blob mlcmt
+
+%%
+
+options                        { return TOK_OPTIONS; }
+constants              { return TOK_CONSTANTS; }
+sources                        { return TOK_SOURCES; }
+filters                        { return TOK_FILTERS; }
+section                        { return TOK_SECTION; }
+extern                 { return TOK_EXTERN; }
+from                   { return TOK_FROM; }
+raw                            { return TOK_RAW; }
+load                   { return TOK_LOAD; }
+jump                   { return TOK_JUMP; }
+call                   { return TOK_CALL; }
+mode                   { return TOK_MODE; }
+if                             { return TOK_IF; }
+else                   { return TOK_ELSE; }
+defined                        { return TOK_DEFINED; }
+info                   { return TOK_INFO; }
+warning                        { return TOK_WARNING; }
+error                  { return TOK_ERROR; }
+sizeof                 { return TOK_SIZEOF; }
+dcd                            { return TOK_DCD; }
+hab                            { return TOK_HAB; }
+ivt             { return TOK_IVT; }
+
+[whb]/[^a-zA-Z_0-9]                                    {       // must be followed by any non-ident char
+                                                                               int_size_t theSize;
+                                                                               switch (yytext[0])
+                                                                               {
+                                                                                       case 'w':
+                                                                                               theSize = kWordSize;
+                                                                                               break;
+                                                                                       case 'h':
+                                                                                               theSize = kHalfWordSize;
+                                                                                               break;
+                                                                                       case 'b':
+                                                                                               theSize = kByteSize;
+                                                                                               break;
+                                                                               }
+                                                                               m_symbolValue.m_int = new elftosb::SizedIntegerValue(0, theSize);
+                                                                               return TOK_INT_SIZE;
+                                                                       }
+                                                                       
+true|yes                                                       {
+                                                                               m_symbolValue.m_int = new elftosb::SizedIntegerValue(1, kWordSize);
+                                                                               return TOK_INT_LITERAL;
+                                                                       }
+
+false|no                                                       {
+                                                                               m_symbolValue.m_int = new elftosb::SizedIntegerValue(0, kWordSize);
+                                                                               return TOK_INT_LITERAL;
+                                                                       }
+
+{IDENT}                                                                {
+                                                                               m_symbolValue.m_str = new std::string(yytext);
+                                                                               if (isSourceName(m_symbolValue.m_str))
+                                                                               {
+                                                                                       return TOK_SOURCE_NAME;
+                                                                               }
+                                                                               else
+                                                                               {
+                                                                                       return TOK_IDENT;
+                                                                               }
+                                                                       }
+
+({DIGIT}+|0x{HEXDIGIT}+|0b{BINDIGIT}+)([ \t]*[GMK])?                   {
+                                                                               int base = 0;
+                                                                               uint32_t value;
+                                                                               int mult;
+                                                                               
+                                                                               // check for binary number
+                                                                               if (yytext[0] == '0' && yytext[1] == 'b')
+                                                                               {
+                                                                                       base = 2;               // this is a binary number
+                                                                                       yytext += 2;    // skip over the "0b"
+                                                                               }
+                                                                               
+                                                                               // convert value
+                                                                               value = (uint32_t)strtoul(yytext, NULL, base);
+                                                                               
+                                                                               // find multiplier
+                                                                               switch (yytext[strlen(yytext) - 1])
+                                                                               {
+                                                                                       case 'G':
+                                                                                               mult = 1024 * 1024 * 1024;
+                                                                                               break;
+                                                                                       case 'M':
+                                                                                               mult = 1024 * 1024;
+                                                                                               break;
+                                                                                       case 'K':
+                                                                                               mult = 1024;
+                                                                                               break;
+                                                                                       default:
+                                                                                               mult = 1;
+                                                                                               break;
+                                                                               }
+                                                                               
+                                                                               // set resulting symbol value
+                                                                               m_symbolValue.m_int = new elftosb::SizedIntegerValue(value * mult, kWordSize);
+                                                                               return TOK_INT_LITERAL;
+                                                                       }
+
+\'(.|ESC)\'|\'(.|ESC){2}\'|\'(.|ESC){4}\'              {
+                                                                               uint32_t value = 0;
+                                                                               int_size_t theSize;
+                                                                               int len = strlen(yytext);
+                                                                               if (len >= 3)
+                                                                               {
+                                                                                       value = yytext[1];
+                                                                                       theSize = kByteSize;
+                                                                               }
+                                                                               if (len >= 4)
+                                                                               {
+                                                                                       value = (value << 8) | yytext[2];
+                                                                                       theSize = kHalfWordSize;
+                                                                               }
+                                                                               if (len >= 6)
+                                                                               {
+                                                                                       value = (value << 8) | yytext[3];
+                                                                                       value = (value << 8) | yytext[4];
+                                                                                       theSize = kWordSize;
+                                                                               }
+                                                                               m_symbolValue.m_int = new elftosb::SizedIntegerValue(value, theSize);
+                                                                               return TOK_INT_LITERAL;
+                                                                       }
+
+\$[\.\*a-zA-Z0-9_\[\]\^\?\-]+                                  {
+                                                                               // remove $ from string
+                                                                               m_symbolValue.m_str = new std::string(&yytext[1]);
+                                                                               return TOK_SECTION_NAME;
+                                                                       }
+
+
+"/*"                                { BEGIN(mlcmt); }
+
+"{{"                                                           {
+                                                                               m_blob = new Blob();
+                                                                               m_blobFirstLine = yylineno;
+                                                                               BEGIN(blob);
+                                                                       }
+
+"{"                                                                    { return '{'; }
+
+"}"                                                                    { return '}'; }
+
+"("                                                                    { return '('; }
+
+")"                                                                    { return ')'; }
+
+"["                                                                    { return '['; }
+
+"]"                                                                    { return ']'; }
+
+"="                                                                    { return '='; }
+
+","                                                                    { return ','; }
+
+":"                                                                    { return ':'; }
+
+";"                                                                    { return ';'; }
+
+"."                                                                    { return '.'; }
+
+">"                                                                    { return '>'; }
+
+".."                                                           { return TOK_DOT_DOT; }
+
+"+"                                                                    { return '+'; }
+
+"-"                                                                    { return '-'; }
+
+"*"                                                                    { return '*'; }
+
+"/"                                                                    { return '/'; }
+
+"%"                                                                    { return '%'; }
+
+"~"                                                                    { return '~'; }
+
+"^"                                                                    { return '^'; }
+
+"<<"                                                           { return TOK_LSHIFT; }
+
+">>"                                                           { return TOK_RSHIFT; }
+
+"&"                                                                    { return '&'; }
+
+"|"                                                                    { return '|'; }
+
+"**"                                                           { return TOK_POWER; }
+
+"<"                                                                    { return '<'; }
+
+">="                                                           { return TOK_GEQ; }
+
+"<="                                                           { return TOK_LEQ; }
+
+"=="                                                           { return TOK_EQ; }
+
+"!="                                                           { return TOK_NEQ; }
+
+"&&"                                                           { return TOK_AND; }
+
+"||"                                                           { return TOK_OR; }
+
+"!"                                                                    { return '!'; }
+
+\"(ESC|[^\"])*\"                                       {
+                                                                               // get rid of quotes
+                                                                               yytext++;
+                                                                               yytext[strlen(yytext) - 1] = 0;
+//                                                                             processStringEscapes(yytext, yytext);
+                                                                               m_symbolValue.m_str = new std::string(yytext);
+                                                                               return TOK_STRING_LITERAL;
+                                                                       }
+
+<blob>{HEXDIGIT}{2}                                    {
+                                                                               uint8_t x = (hexCharToInt(yytext[0]) << 4) | hexCharToInt(yytext[1]);
+                                                                               m_blob->append(&x, 1);
+                                                                       }
+
+<blob>"}}"                                                     {
+                                                                               BEGIN(INITIAL);
+                                                                               m_symbolValue.m_blob = m_blob;
+                                                                               m_blob = NULL;
+                                                                               m_location.m_firstLine = m_blobFirstLine;
+                                                                               return TOK_BLOB;
+                                                                       }
+
+<mlcmt>\*\/                         {
+                                        // end of multi-line comment, return to initial state
+                                        BEGIN(INITIAL);
+                                    }
+
+
+(#|\/\/).*$                                                    /* absorb single-line comment */
+
+<*>[ \t]                                                       /* eat up whitespace in all states */
+
+<*>(\r\n|\r|\n)                                                {
+                                                                               /* eat up whitespace and count lines in all states */
+                                                                               m_line++;
+                                                                       }
+
+<mlcmt>.                            /* ignore all other chars in a multi-line comment */
+
+<*>.                                                           {
+                                                                               /* all other chars produce errors */
+                                                                               char msg[50];
+                                                                               sprintf(msg, "unexpected character '%c' on line %d", yytext[0], m_line);
+                                                                               LexerError(msg);
+                                                                       }
+
+%%
+
+// verbatim code copied to the bottom of the output
+
+
diff --git a/tools/elftosb/elftosb2/elftosb_parser.tab.cpp b/tools/elftosb/elftosb2/elftosb_parser.tab.cpp
new file mode 100644 (file)
index 0000000..731ca45
--- /dev/null
@@ -0,0 +1,2955 @@
+/* A Bison parser, made by GNU Bison 2.1.  */
+
+/* Skeleton parser for Yacc-like parsing with Bison,
+   Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, 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, or (at your option)
+   any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You 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.  */
+
+/* As a special exception, when this file is copied by Bison into a
+   Bison output file, you may use that output file without restriction.
+   This special exception was added by the Free Software Foundation
+   in version 1.24 of Bison.  */
+
+/* Written by Richard Stallman by simplifying the original so called
+   ``semantic'' parser.  */
+
+/* All symbols defined below should begin with yy or YY, to avoid
+   infringing on user name space.  This should be done even for local
+   variables, as they might otherwise be expanded by user macros.
+   There are some unavoidable exceptions within include files to
+   define necessary library symbols; they are noted "INFRINGES ON
+   USER NAME SPACE" below.  */
+
+/* Identify Bison output.  */
+#define YYBISON 1
+
+/* Bison version.  */
+#define YYBISON_VERSION "2.1"
+
+/* Skeleton name.  */
+#define YYSKELETON_NAME "yacc.c"
+
+/* Pure parsers.  */
+#define YYPURE 1
+
+/* Using locations.  */
+#define YYLSP_NEEDED 1
+
+
+
+/* Tokens.  */
+#ifndef YYTOKENTYPE
+# define YYTOKENTYPE
+   /* Put the tokens into the symbol table, so that GDB and other debuggers
+      know about them.  */
+   enum yytokentype {
+     TOK_IDENT = 258,
+     TOK_STRING_LITERAL = 259,
+     TOK_INT_LITERAL = 260,
+     TOK_SECTION_NAME = 261,
+     TOK_SOURCE_NAME = 262,
+     TOK_BLOB = 263,
+     TOK_DOT_DOT = 264,
+     TOK_AND = 265,
+     TOK_OR = 266,
+     TOK_GEQ = 267,
+     TOK_LEQ = 268,
+     TOK_EQ = 269,
+     TOK_NEQ = 270,
+     TOK_POWER = 271,
+     TOK_LSHIFT = 272,
+     TOK_RSHIFT = 273,
+     TOK_INT_SIZE = 274,
+     TOK_OPTIONS = 275,
+     TOK_CONSTANTS = 276,
+     TOK_SOURCES = 277,
+     TOK_FILTERS = 278,
+     TOK_SECTION = 279,
+     TOK_EXTERN = 280,
+     TOK_FROM = 281,
+     TOK_RAW = 282,
+     TOK_LOAD = 283,
+     TOK_JUMP = 284,
+     TOK_CALL = 285,
+     TOK_MODE = 286,
+     TOK_IF = 287,
+     TOK_ELSE = 288,
+     TOK_DEFINED = 289,
+     TOK_INFO = 290,
+     TOK_WARNING = 291,
+     TOK_ERROR = 292,
+     TOK_SIZEOF = 293,
+     TOK_DCD = 294,
+     TOK_HAB = 295,
+     TOK_IVT = 296,
+     UNARY_OP = 297
+   };
+#endif
+/* Tokens.  */
+#define TOK_IDENT 258
+#define TOK_STRING_LITERAL 259
+#define TOK_INT_LITERAL 260
+#define TOK_SECTION_NAME 261
+#define TOK_SOURCE_NAME 262
+#define TOK_BLOB 263
+#define TOK_DOT_DOT 264
+#define TOK_AND 265
+#define TOK_OR 266
+#define TOK_GEQ 267
+#define TOK_LEQ 268
+#define TOK_EQ 269
+#define TOK_NEQ 270
+#define TOK_POWER 271
+#define TOK_LSHIFT 272
+#define TOK_RSHIFT 273
+#define TOK_INT_SIZE 274
+#define TOK_OPTIONS 275
+#define TOK_CONSTANTS 276
+#define TOK_SOURCES 277
+#define TOK_FILTERS 278
+#define TOK_SECTION 279
+#define TOK_EXTERN 280
+#define TOK_FROM 281
+#define TOK_RAW 282
+#define TOK_LOAD 283
+#define TOK_JUMP 284
+#define TOK_CALL 285
+#define TOK_MODE 286
+#define TOK_IF 287
+#define TOK_ELSE 288
+#define TOK_DEFINED 289
+#define TOK_INFO 290
+#define TOK_WARNING 291
+#define TOK_ERROR 292
+#define TOK_SIZEOF 293
+#define TOK_DCD 294
+#define TOK_HAB 295
+#define TOK_IVT 296
+#define UNARY_OP 297
+
+
+
+
+/* Copy the first part of user declarations.  */
+#line 14 "/Users/creed/projects/fsl/fromsvr/elftosb/elftosb2/elftosb_parser.y"
+
+#include "ElftosbLexer.h"
+#include "ElftosbAST.h"
+#include "Logging.h"
+#include "Blob.h"
+#include "format_string.h"
+#include "Value.h"
+#include "ConversionController.h"
+
+using namespace elftosb;
+
+//! Our special location type.
+#define YYLTYPE token_loc_t
+
+// this indicates that we're using our own type. it should be unset automatically
+// but that's not working for some reason with the .hpp file.
+#if defined(YYLTYPE_IS_TRIVIAL)
+       #undef YYLTYPE_IS_TRIVIAL
+       #define YYLTYPE_IS_TRIVIAL 0
+#endif
+
+//! Default location action
+#define YYLLOC_DEFAULT(Current, Rhs, N)        \
+       do {            \
+               if (N)  \
+               {               \
+                       (Current).m_firstLine = YYRHSLOC(Rhs, 1).m_firstLine;   \
+                       (Current).m_lastLine = YYRHSLOC(Rhs, N).m_lastLine;             \
+               }               \
+               else    \
+               {               \
+                       (Current).m_firstLine = (Current).m_lastLine = YYRHSLOC(Rhs, 0).m_lastLine;     \
+               }               \
+       } while (0)
+
+//! Forward declaration of yylex().
+static int yylex(YYSTYPE * lvalp, YYLTYPE * yylloc, ElftosbLexer * lexer);
+
+// Forward declaration of error handling function.
+static void yyerror(YYLTYPE * yylloc, ElftosbLexer * lexer, CommandFileASTNode ** resultAST, const char * error);
+
+
+
+/* Enabling traces.  */
+#ifndef YYDEBUG
+# define YYDEBUG 0
+#endif
+
+/* Enabling verbose error messages.  */
+#ifdef YYERROR_VERBOSE
+# undef YYERROR_VERBOSE
+# define YYERROR_VERBOSE 1
+#else
+# define YYERROR_VERBOSE 1
+#endif
+
+/* Enabling the token table.  */
+#ifndef YYTOKEN_TABLE
+# define YYTOKEN_TABLE 0
+#endif
+
+#if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
+#line 58 "/Users/creed/projects/fsl/fromsvr/elftosb/elftosb2/elftosb_parser.y"
+typedef union YYSTYPE {
+       int m_num;
+       elftosb::SizedIntegerValue * m_int;
+       Blob * m_blob;
+       std::string * m_str;
+       elftosb::ASTNode * m_ast;       // must use full name here because this is put into *.tab.hpp
+} YYSTYPE;
+/* Line 196 of yacc.c.  */
+#line 220 "/Users/creed/projects/fsl/fromsvr/elftosb/build/elftosb.build/Debug/elftosb.build/DerivedSources/elftosb_parser.tab.cpp"
+# define yystype YYSTYPE /* obsolescent; will be withdrawn */
+# define YYSTYPE_IS_DECLARED 1
+# define YYSTYPE_IS_TRIVIAL 1
+#endif
+
+#if ! defined (YYLTYPE) && ! defined (YYLTYPE_IS_DECLARED)
+typedef struct YYLTYPE
+{
+  int first_line;
+  int first_column;
+  int last_line;
+  int last_column;
+} YYLTYPE;
+# define yyltype YYLTYPE /* obsolescent; will be withdrawn */
+# define YYLTYPE_IS_DECLARED 1
+# define YYLTYPE_IS_TRIVIAL 1
+#endif
+
+
+/* Copy the second part of user declarations.  */
+
+
+/* Line 219 of yacc.c.  */
+#line 244 "/Users/creed/projects/fsl/fromsvr/elftosb/build/elftosb.build/Debug/elftosb.build/DerivedSources/elftosb_parser.tab.cpp"
+
+#if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)
+# define YYSIZE_T __SIZE_TYPE__
+#endif
+#if ! defined (YYSIZE_T) && defined (size_t)
+# define YYSIZE_T size_t
+#endif
+#if ! defined (YYSIZE_T) && (defined (__STDC__) || defined (__cplusplus))
+# include <stddef.h> /* INFRINGES ON USER NAME SPACE */
+# define YYSIZE_T size_t
+#endif
+#if ! defined (YYSIZE_T)
+# define YYSIZE_T unsigned int
+#endif
+
+#ifndef YY_
+# if YYENABLE_NLS
+#  if ENABLE_NLS
+#   include <libintl.h> /* INFRINGES ON USER NAME SPACE */
+#   define YY_(msgid) dgettext ("bison-runtime", msgid)
+#  endif
+# endif
+# ifndef YY_
+#  define YY_(msgid) msgid
+# endif
+#endif
+
+#if ! defined (yyoverflow) || YYERROR_VERBOSE
+
+/* The parser invokes alloca or malloc; define the necessary symbols.  */
+
+# ifdef YYSTACK_USE_ALLOCA
+#  if YYSTACK_USE_ALLOCA
+#   ifdef __GNUC__
+#    define YYSTACK_ALLOC __builtin_alloca
+#   else
+#    define YYSTACK_ALLOC alloca
+#    if defined (__STDC__) || defined (__cplusplus)
+#     include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
+#     define YYINCLUDED_STDLIB_H
+#    endif
+#   endif
+#  endif
+# endif
+
+# ifdef YYSTACK_ALLOC
+   /* Pacify GCC's `empty if-body' warning. */
+#  define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
+#  ifndef YYSTACK_ALLOC_MAXIMUM
+    /* The OS might guarantee only one guard page at the bottom of the stack,
+       and a page size can be as small as 4096 bytes.  So we cannot safely
+       invoke alloca (N) if N exceeds 4096.  Use a slightly smaller number
+       to allow for a few compiler-allocated temporary stack slots.  */
+#   define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2005 */
+#  endif
+# else
+#  define YYSTACK_ALLOC YYMALLOC
+#  define YYSTACK_FREE YYFREE
+#  ifndef YYSTACK_ALLOC_MAXIMUM
+#   define YYSTACK_ALLOC_MAXIMUM ((YYSIZE_T) -1)
+#  endif
+#  ifdef __cplusplus
+extern "C" {
+#  endif
+#  ifndef YYMALLOC
+#   define YYMALLOC malloc
+#   if (! defined (malloc) && ! defined (YYINCLUDED_STDLIB_H) \
+       && (defined (__STDC__) || defined (__cplusplus)))
+void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
+#   endif
+#  endif
+#  ifndef YYFREE
+#   define YYFREE free
+#   if (! defined (free) && ! defined (YYINCLUDED_STDLIB_H) \
+       && (defined (__STDC__) || defined (__cplusplus)))
+void free (void *); /* INFRINGES ON USER NAME SPACE */
+#   endif
+#  endif
+#  ifdef __cplusplus
+}
+#  endif
+# endif
+#endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */
+
+
+#if (! defined (yyoverflow) \
+     && (! defined (__cplusplus) \
+        || (defined (YYLTYPE_IS_TRIVIAL) && YYLTYPE_IS_TRIVIAL \
+             && defined (YYSTYPE_IS_TRIVIAL) && YYSTYPE_IS_TRIVIAL)))
+
+/* A type that is properly aligned for any stack member.  */
+union yyalloc
+{
+  short int yyss;
+  YYSTYPE yyvs;
+    YYLTYPE yyls;
+};
+
+/* The size of the maximum gap between one aligned stack and the next.  */
+# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
+
+/* The size of an array large to enough to hold all stacks, each with
+   N elements.  */
+# define YYSTACK_BYTES(N) \
+     ((N) * (sizeof (short int) + sizeof (YYSTYPE) + sizeof (YYLTYPE)) \
+      + 2 * YYSTACK_GAP_MAXIMUM)
+
+/* Copy COUNT objects from FROM to TO.  The source and destination do
+   not overlap.  */
+# ifndef YYCOPY
+#  if defined (__GNUC__) && 1 < __GNUC__
+#   define YYCOPY(To, From, Count) \
+      __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
+#  else
+#   define YYCOPY(To, From, Count)             \
+      do                                       \
+       {                                       \
+         YYSIZE_T yyi;                         \
+         for (yyi = 0; yyi < (Count); yyi++)   \
+           (To)[yyi] = (From)[yyi];            \
+       }                                       \
+      while (0)
+#  endif
+# endif
+
+/* Relocate STACK from its old location to the new one.  The
+   local variables YYSIZE and YYSTACKSIZE give the old and new number of
+   elements in the stack, and YYPTR gives the new location of the
+   stack.  Advance YYPTR to a properly aligned location for the next
+   stack.  */
+# define YYSTACK_RELOCATE(Stack)                                       \
+    do                                                                 \
+      {                                                                        \
+       YYSIZE_T yynewbytes;                                            \
+       YYCOPY (&yyptr->Stack, Stack, yysize);                          \
+       Stack = &yyptr->Stack;                                          \
+       yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
+       yyptr += yynewbytes / sizeof (*yyptr);                          \
+      }                                                                        \
+    while (0)
+
+#endif
+
+#if defined (__STDC__) || defined (__cplusplus)
+   typedef signed char yysigned_char;
+#else
+   typedef short int yysigned_char;
+#endif
+
+/* YYFINAL -- State number of the termination state. */
+#define YYFINAL  13
+/* YYLAST -- Last index in YYTABLE.  */
+#define YYLAST   418
+
+/* YYNTOKENS -- Number of terminals. */
+#define YYNTOKENS  66
+/* YYNNTS -- Number of nonterminals. */
+#define YYNNTS  52
+/* YYNRULES -- Number of rules. */
+#define YYNRULES  133
+/* YYNRULES -- Number of states. */
+#define YYNSTATES  238
+
+/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX.  */
+#define YYUNDEFTOK  2
+#define YYMAXUTOK   297
+
+#define YYTRANSLATE(YYX)                                               \
+  ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
+
+/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX.  */
+static const unsigned char yytranslate[] =
+{
+       0,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+       2,     2,     2,    26,     2,     2,     2,    64,    23,     2,
+       9,    10,    62,    60,    16,    61,    20,    63,     2,     2,
+       2,     2,     2,     2,     2,     2,     2,     2,    18,    17,
+      25,    15,    19,     2,     2,     2,     2,     2,     2,     2,
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+       2,    13,     2,    14,    59,     2,     2,     2,     2,     2,
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+       2,     2,     2,    11,    24,    12,    22,     2,     2,     2,
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+       2,     2,     2,     2,     2,     2,     1,     2,     3,     4,
+       5,     6,     7,     8,    21,    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,    65
+};
+
+#if YYDEBUG
+/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
+   YYRHS.  */
+static const unsigned short int yyprhs[] =
+{
+       0,     0,     3,     6,     8,    11,    13,    15,    17,    22,
+      27,    29,    32,    35,    36,    40,    45,    47,    50,    54,
+      55,    59,    66,    70,    71,    73,    77,    81,    83,    86,
+      93,    96,    97,    99,   100,   104,   108,   110,   113,   116,
+     118,   120,   121,   123,   126,   129,   131,   132,   134,   136,
+     138,   140,   145,   147,   148,   150,   152,   154,   156,   160,
+     165,   167,   169,   171,   175,   177,   180,   183,   184,   186,
+     188,   193,   195,   196,   200,   205,   207,   209,   211,   213,
+     217,   220,   221,   227,   230,   233,   236,   239,   246,   251,
+     254,   255,   257,   261,   263,   265,   267,   271,   275,   279,
+     283,   287,   291,   295,   299,   302,   307,   311,   316,   318,
+     322,   325,   327,   329,   331,   335,   339,   343,   347,   351,
+     355,   359,   363,   367,   371,   375,   377,   381,   385,   390,
+     395,   400,   403,   406
+};
+
+/* YYRHS -- A `-1'-separated list of the rules' RHS. */
+static const yysigned_char yyrhs[] =
+{
+      67,     0,    -1,    68,    82,    -1,    69,    -1,    68,    69,
+      -1,    70,    -1,    71,    -1,    75,    -1,    37,    11,    72,
+      12,    -1,    38,    11,    72,    12,    -1,    73,    -1,    72,
+      73,    -1,    74,    17,    -1,    -1,     3,    15,   111,    -1,
+      39,    11,    76,    12,    -1,    77,    -1,    76,    77,    -1,
+      78,    79,    17,    -1,    -1,     3,    15,     4,    -1,     3,
+      15,    42,     9,   113,    10,    -1,     9,    80,    10,    -1,
+      -1,    81,    -1,    80,    16,    81,    -1,     3,    15,   111,
+      -1,    83,    -1,    82,    83,    -1,    41,     9,   113,    84,
+      10,    86,    -1,    17,    85,    -1,    -1,    80,    -1,    -1,
+      30,    94,    17,    -1,    11,    87,    12,    -1,    88,    -1,
+      87,    88,    -1,    91,    17,    -1,   105,    -1,   108,    -1,
+      -1,    90,    -1,    89,    90,    -1,    91,    17,    -1,   108,
+      -1,    -1,    92,    -1,   101,    -1,   106,    -1,   107,    -1,
+      45,    93,    94,    97,    -1,    56,    -1,    -1,   113,    -1,
+       4,    -1,     7,    -1,    95,    -1,    95,    43,     7,    -1,
+       7,    13,    95,    14,    -1,     8,    -1,    99,    -1,    96,
+      -1,    95,    16,    96,    -1,     6,    -1,    22,     6,    -1,
+      19,    98,    -1,    -1,    20,    -1,   110,    -1,    58,     9,
+     100,    10,    -1,    80,    -1,    -1,   102,   103,   104,    -1,
+      57,   102,   110,   104,    -1,    47,    -1,    46,    -1,     7,
+      -1,   113,    -1,     9,   113,    10,    -1,     9,    10,    -1,
+      -1,    43,     7,    11,    89,    12,    -1,    48,   113,    -1,
+      52,     4,    -1,    53,     4,    -1,    54,     4,    -1,    49,
+     112,    11,    87,    12,   109,    -1,    50,    11,    87,    12,
+      -1,    50,   108,    -1,    -1,   113,    -1,   113,    21,   113,
+      -1,   112,    -1,     4,    -1,   113,    -1,   112,    25,   112,
+      -1,   112,    19,   112,    -1,   112,    29,   112,    -1,   112,
+      30,   112,    -1,   112,    31,   112,    -1,   112,    32,   112,
+      -1,   112,    27,   112,    -1,   112,    28,   112,    -1,    26,
+     112,    -1,     3,     9,     7,    10,    -1,     9,   112,    10,
+      -1,    51,     9,     3,    10,    -1,   115,    -1,     7,    18,
+       3,    -1,    18,     3,    -1,   117,    -1,     3,    -1,   114,
+      -1,   115,    60,   115,    -1,   115,    61,   115,    -1,   115,
+      62,   115,    -1,   115,    63,   115,    -1,   115,    64,   115,
+      -1,   115,    33,   115,    -1,   115,    23,   115,    -1,   115,
+      24,   115,    -1,   115,    59,   115,    -1,   115,    34,   115,
+      -1,   115,    35,   115,    -1,   116,    -1,   115,    20,    36,
+      -1,     9,   115,    10,    -1,    55,     9,   114,    10,    -1,
+      55,     9,     3,    10,    -1,    55,     9,     7,    10,    -1,
+      60,   115,    -1,    61,   115,    -1,     5,    -1
+};
+
+/* YYRLINE[YYN] -- source line where rule number YYN was defined.  */
+static const unsigned short int yyrline[] =
+{
+       0,   162,   162,   172,   178,   186,   187,   188,   191,   197,
+     203,   209,   216,   217,   220,   227,   233,   239,   247,   259,
+     262,   267,   275,   276,   280,   286,   294,   301,   307,   314,
+     329,   334,   340,   345,   351,   357,   365,   371,   379,   380,
+     381,   382,   385,   391,   399,   400,   401,   404,   405,   406,
+     407,   410,   433,   443,   445,   449,   454,   459,   464,   469,
+     474,   479,   484,   490,   498,   503,   510,   515,   521,   526,
+     532,   544,   545,   548,   577,   614,   615,   618,   623,   630,
+     631,   632,   635,   642,   649,   654,   659,   666,   677,   681,
+     688,   691,   696,   703,   707,   714,   718,   725,   732,   739,
+     746,   753,   760,   767,   774,   779,   784,   789,   796,   799,
+     804,   812,   816,   821,   832,   839,   846,   853,   860,   867,
+     874,   881,   888,   895,   902,   909,   913,   918,   923,   928,
+     933,   940,   944,   951
+};
+#endif
+
+#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
+/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
+   First, the terminals, then, starting at YYNTOKENS, nonterminals. */
+static const char *const yytname[] =
+{
+  "$end", "error", "$undefined", "\"identifier\"", "\"string\"",
+  "\"integer\"", "\"section name\"", "\"source name\"",
+  "\"binary object\"", "'('", "')'", "'{'", "'}'", "'['", "']'", "'='",
+  "','", "';'", "':'", "'>'", "'.'", "\"..\"", "'~'", "'&'", "'|'", "'<'",
+  "'!'", "\"&&\"", "\"||\"", "\">=\"", "\"<=\"", "\"==\"", "\"!=\"",
+  "\"**\"", "\"<<\"", "\">>\"", "\"integer size\"", "\"options\"",
+  "\"constants\"", "\"sources\"", "\"filters\"", "\"section\"",
+  "\"extern\"", "\"from\"", "\"raw\"", "\"load\"", "\"jump\"", "\"call\"",
+  "\"mode\"", "\"if\"", "\"else\"", "\"defined\"", "\"info\"",
+  "\"warning\"", "\"error\"", "\"sizeof\"", "\"dcd\"", "\"hab\"",
+  "\"ivt\"", "'^'", "'+'", "'-'", "'*'", "'/'", "'%'", "UNARY_OP",
+  "$accept", "command_file", "blocks_list", "pre_section_block",
+  "options_block", "constants_block", "const_def_list",
+  "const_def_list_elem", "const_def", "sources_block", "source_def_list",
+  "source_def_list_elem", "source_def", "source_attrs_opt",
+  "source_attr_list", "source_attr_list_elem", "section_defs",
+  "section_def", "section_options_opt", "source_attr_list_opt",
+  "section_contents", "full_stmt_list", "full_stmt_list_elem",
+  "basic_stmt_list", "basic_stmt_list_elem", "basic_stmt", "load_stmt",
+  "dcd_opt", "load_data", "section_list", "section_list_elem",
+  "load_target_opt", "load_target", "ivt_def", "assignment_list_opt",
+  "call_stmt", "call_or_jump", "call_target", "call_arg_opt", "from_stmt",
+  "mode_stmt", "message_stmt", "if_stmt", "else_opt", "address_or_range",
+  "const_expr", "bool_expr", "int_const_expr", "symbol_ref", "expr",
+  "unary_expr", "int_value", 0
+};
+#endif
+
+# ifdef YYPRINT
+/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
+   token YYLEX-NUM.  */
+static const unsigned short int yytoknum[] =
+{
+       0,   256,   257,   258,   259,   260,   261,   262,   263,    40,
+      41,   123,   125,    91,    93,    61,    44,    59,    58,    62,
+      46,   264,   126,    38,   124,    60,    33,   265,   266,   267,
+     268,   269,   270,   271,   272,   273,   274,   275,   276,   277,
+     278,   279,   280,   281,   282,   283,   284,   285,   286,   287,
+     288,   289,   290,   291,   292,   293,   294,   295,   296,    94,
+      43,    45,    42,    47,    37,   297
+};
+# endif
+
+/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives.  */
+static const unsigned char yyr1[] =
+{
+       0,    66,    67,    68,    68,    69,    69,    69,    70,    71,
+      72,    72,    73,    73,    74,    75,    76,    76,    77,    77,
+      78,    78,    79,    79,    80,    80,    81,    82,    82,    83,
+      84,    84,    85,    85,    86,    86,    87,    87,    88,    88,
+      88,    88,    89,    89,    90,    90,    90,    91,    91,    91,
+      91,    92,    93,    93,    94,    94,    94,    94,    94,    94,
+      94,    94,    95,    95,    96,    96,    97,    97,    98,    98,
+      99,   100,   100,   101,   101,   102,   102,   103,   103,   104,
+     104,   104,   105,   106,   107,   107,   107,   108,   109,   109,
+     109,   110,   110,   111,   111,   112,   112,   112,   112,   112,
+     112,   112,   112,   112,   112,   112,   112,   112,   113,   114,
+     114,   115,   115,   115,   115,   115,   115,   115,   115,   115,
+     115,   115,   115,   115,   115,   115,   115,   115,   115,   115,
+     115,   116,   116,   117
+};
+
+/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN.  */
+static const unsigned char yyr2[] =
+{
+       0,     2,     2,     1,     2,     1,     1,     1,     4,     4,
+       1,     2,     2,     0,     3,     4,     1,     2,     3,     0,
+       3,     6,     3,     0,     1,     3,     3,     1,     2,     6,
+       2,     0,     1,     0,     3,     3,     1,     2,     2,     1,
+       1,     0,     1,     2,     2,     1,     0,     1,     1,     1,
+       1,     4,     1,     0,     1,     1,     1,     1,     3,     4,
+       1,     1,     1,     3,     1,     2,     2,     0,     1,     1,
+       4,     1,     0,     3,     4,     1,     1,     1,     1,     3,
+       2,     0,     5,     2,     2,     2,     2,     6,     4,     2,
+       0,     1,     3,     1,     1,     1,     3,     3,     3,     3,
+       3,     3,     3,     3,     2,     4,     3,     4,     1,     3,
+       2,     1,     1,     1,     3,     3,     3,     3,     3,     3,
+       3,     3,     3,     3,     3,     1,     3,     3,     4,     4,
+       4,     2,     2,     1
+};
+
+/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
+   STATE-NUM when YYTABLE doesn't specify something else to do.  Zero
+   means the default is an error.  */
+static const unsigned char yydefact[] =
+{
+       0,     0,     0,     0,     0,     0,     3,     5,     6,     7,
+      13,    13,    19,     1,     0,     4,     2,    27,     0,     0,
+      10,     0,     0,     0,     0,    16,    23,     0,    28,     0,
+       8,    11,    12,     9,     0,    15,    17,     0,     0,   112,
+     133,     0,     0,     0,     0,     0,     0,    31,   113,   108,
+     125,   111,   112,    94,     0,     0,     0,    14,    93,    95,
+      20,     0,     0,     0,    24,    18,     0,     0,   110,     0,
+     131,   132,    33,     0,     0,     0,     0,     0,     0,     0,
+       0,     0,     0,     0,     0,     0,     0,     0,   108,   104,
+       0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
+       0,    22,     0,   109,   127,     0,     0,     0,    32,    30,
+       0,   126,   120,   121,   119,   123,   124,   122,   114,   115,
+     116,   117,   118,     0,   106,     0,    97,    96,   102,   103,
+      98,    99,   100,   101,     0,    26,    25,   129,   130,   128,
+      41,     0,    29,   105,   107,    21,     0,    53,    76,    75,
+       0,     0,     0,     0,     0,     0,     0,    36,     0,    47,
+      48,     0,    39,    49,    50,    40,    55,    64,    56,    60,
+       0,     0,     0,    57,    62,    61,    54,     0,    52,     0,
+      83,     0,    84,    85,    86,     0,    35,    37,    38,    77,
+      81,    78,     0,    65,    72,    34,     0,     0,    46,    67,
+      41,    81,    91,     0,    73,     0,    71,     0,    63,    58,
+       0,    42,     0,    45,     0,    51,     0,    74,     0,    80,
+       0,    59,    70,    82,    43,    44,    68,    66,    69,    90,
+      92,    79,     0,    87,    41,    89,     0,    88
+};
+
+/* YYDEFGOTO[NTERM-NUM]. */
+static const short int yydefgoto[] =
+{
+      -1,     4,     5,     6,     7,     8,    19,    20,    21,     9,
+      24,    25,    26,    38,    63,    64,    16,    17,    73,   109,
+     142,   156,   157,   210,   211,   158,   159,   179,   172,   173,
+     174,   215,   227,   175,   207,   160,   161,   190,   204,   162,
+     163,   164,   165,   233,   201,    57,    58,    59,    48,    49,
+      50,    51
+};
+
+/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
+   STATE-NUM.  */
+#define YYPACT_NINF -181
+static const short int yypact[] =
+{
+     128,    17,    25,    48,    69,   123,  -181,  -181,  -181,  -181,
+      96,    96,   101,  -181,    80,  -181,    68,  -181,   112,    85,
+    -181,   115,    89,   114,    91,  -181,   124,    30,  -181,    47,
+    -181,  -181,  -181,  -181,    11,  -181,  -181,   134,   125,  -181,
+    -181,   133,    30,   140,   144,    30,    30,   153,  -181,   225,
+    -181,  -181,   148,  -181,    61,    61,   162,  -181,   359,  -181,
+    -181,   164,   159,    22,  -181,  -181,   172,   121,  -181,     9,
+    -181,  -181,   134,   168,   143,    30,    30,    30,    30,    30,
+      30,    30,    30,    30,    30,    30,   179,   303,   121,  -181,
+     194,    61,    61,    61,    61,    61,    61,    61,    61,    30,
+      47,  -181,   134,  -181,  -181,   188,     4,   200,   199,  -181,
+      56,  -181,   241,   231,   236,    86,    86,   247,    76,    76,
+     196,   196,   196,   208,  -181,   210,  -181,  -181,   373,   373,
+    -181,  -181,  -181,  -181,   216,  -181,  -181,  -181,  -181,  -181,
+     314,     2,  -181,  -181,  -181,  -181,   220,   175,  -181,  -181,
+      30,    61,   228,   230,   237,    28,   147,  -181,   223,  -181,
+    -181,   108,  -181,  -181,  -181,  -181,  -181,  -181,    92,  -181,
+     240,   243,   233,    15,  -181,  -181,  -181,   242,  -181,     2,
+    -181,   345,  -181,  -181,  -181,    30,  -181,  -181,  -181,   133,
+     246,  -181,     7,  -181,   134,  -181,     7,   250,   361,   244,
+     314,   246,   248,    16,  -181,   104,   199,   252,  -181,  -181,
+     190,  -181,   251,  -181,    75,  -181,   160,  -181,    30,  -181,
+     261,  -181,  -181,  -181,  -181,  -181,  -181,  -181,  -181,   222,
+    -181,  -181,     6,  -181,   314,  -181,   176,  -181
+};
+
+/* YYPGOTO[NTERM-NUM].  */
+static const short int yypgoto[] =
+{
+    -181,  -181,  -181,   268,  -181,  -181,   266,   106,  -181,  -181,
+    -181,   254,  -181,  -181,   -70,   177,  -181,   267,  -181,  -181,
+    -181,  -151,  -155,  -181,   107,  -180,  -181,  -181,   127,   122,
+     129,  -181,  -181,  -181,  -181,  -181,   163,  -181,   118,  -181,
+    -181,  -181,   -21,  -181,   109,   221,   -51,   -27,   257,   270,
+    -181,  -181
+};
+
+/* YYTABLE[YYPACT[STATE-NUM]].  What to do in state STATE-NUM.  If
+   positive, shift that token.  If negative, reduce the rule which
+   number is the opposite.  If zero, do what YYDEFACT says.
+   If YYTABLE_NINF, syntax error.  */
+#define YYTABLE_NINF -1
+static const unsigned char yytable[] =
+{
+      47,   187,   108,    87,    89,    39,   166,    40,   167,   168,
+     169,    42,   105,   167,   138,    60,   106,   234,   212,    39,
+      43,    40,    66,    41,   170,    42,   219,    43,    10,   170,
+     212,   196,   101,    39,    43,    40,    11,    41,   102,    42,
+     126,   127,   128,   129,   130,   131,   132,   133,    43,   216,
+      52,    53,    40,    61,    41,   151,    54,    44,   197,    12,
+     171,   187,    45,    46,    52,    43,    40,   140,    41,    13,
+      54,    44,   134,    55,   148,   149,    45,    46,    39,    43,
+      40,   187,    41,   236,    42,    44,   141,    55,    18,    27,
+      45,    46,    18,    43,    23,   226,    74,    30,    56,    18,
+     181,    33,    44,    35,    23,   192,    74,    45,    46,    14,
+      66,    39,    56,    40,   176,   189,    44,    42,   221,    77,
+     196,    45,    46,   180,   206,    31,    43,    29,    31,    34,
+      44,   104,    32,    37,   191,    45,    46,    62,    83,    84,
+      85,    74,    65,    68,    75,    76,    81,    82,    83,    84,
+      85,    66,   176,    69,    77,    78,    79,    86,   202,   186,
+       1,     2,     3,    44,    14,     1,     2,     3,    45,    46,
+      72,    90,   229,    99,   100,   103,   220,   213,   110,   111,
+      80,    81,    82,    83,    84,    85,   123,   202,   237,   213,
+     146,   230,   147,   148,   149,   150,   151,   125,   137,   152,
+     153,   154,   223,   146,   155,   147,   148,   149,   150,   151,
+     139,   235,   152,   153,   154,   102,    74,   155,   143,   146,
+     144,   147,   148,   149,   150,   151,   145,   177,   152,   153,
+     154,   178,   182,   155,   183,   147,   148,   149,   150,   151,
+     188,   184,   152,   153,   154,    74,   193,   155,    75,    76,
+     195,    74,   194,   198,    75,   203,    74,   209,    77,    78,
+      79,    74,   222,   214,    77,    78,    79,    74,   225,   218,
+      75,   231,   232,    15,    77,    78,    79,    22,    36,   136,
+      77,    78,    79,    28,    80,    81,    82,    83,    84,    85,
+      80,    81,    82,    83,    84,    85,    81,    82,    83,    84,
+      85,    81,    82,    83,    84,    85,   199,    81,    82,    83,
+      84,    85,    67,   124,   205,    70,    71,   224,   185,   217,
+       0,   135,    91,   228,    88,   208,   107,     0,    92,     0,
+      93,    94,    95,    96,    97,    98,     0,     0,     0,     0,
+       0,     0,     0,     0,     0,   112,   113,   114,   115,   116,
+     117,   118,   119,   120,   121,   122,   200,   146,     0,   147,
+     148,   149,   150,   151,    91,     0,   152,   153,   154,     0,
+      92,   155,    93,    94,    95,    96,    97,    98,    91,     0,
+       0,     0,     0,     0,    92,     0,    93,    94,    95,    96,
+      97,    98,    91,     0,     0,     0,     0,     0,    92,     0,
+       0,     0,    95,    96,    97,    98,   147,   148,   149,   150,
+     151,     0,     0,   152,   153,   154,     0,     0,   155
+};
+
+static const short int yycheck[] =
+{
+      27,   156,    72,    54,    55,     3,     4,     5,     6,     7,
+       8,     9,     3,     6,    10,     4,     7,    11,   198,     3,
+      18,     5,    18,     7,    22,     9,    10,    18,    11,    22,
+     210,    16,    10,     3,    18,     5,    11,     7,    16,     9,
+      91,    92,    93,    94,    95,    96,    97,    98,    18,   200,
+       3,     4,     5,    42,     7,    49,     9,    55,    43,    11,
+      58,   216,    60,    61,     3,    18,     5,    11,     7,     0,
+       9,    55,    99,    26,    46,    47,    60,    61,     3,    18,
+       5,   236,     7,   234,     9,    55,    30,    26,     3,     9,
+      60,    61,     3,    18,     3,    20,    20,    12,    51,     3,
+     151,    12,    55,    12,     3,    13,    20,    60,    61,    41,
+      18,     3,    51,     5,   141,     7,    55,     9,    14,    33,
+      16,    60,    61,   150,   194,    19,    18,    15,    22,    15,
+      55,    10,    17,     9,   161,    60,    61,     3,    62,    63,
+      64,    20,    17,     3,    23,    24,    60,    61,    62,    63,
+      64,    18,   179,     9,    33,    34,    35,     9,   185,    12,
+      37,    38,    39,    55,    41,    37,    38,    39,    60,    61,
+      17,     9,    12,     9,    15,     3,   203,   198,    10,    36,
+      59,    60,    61,    62,    63,    64,     7,   214,    12,   210,
+      43,   218,    45,    46,    47,    48,    49,     3,    10,    52,
+      53,    54,    12,    43,    57,    45,    46,    47,    48,    49,
+      10,   232,    52,    53,    54,    16,    20,    57,    10,    43,
+      10,    45,    46,    47,    48,    49,    10,     7,    52,    53,
+      54,    56,     4,    57,     4,    45,    46,    47,    48,    49,
+      17,     4,    52,    53,    54,    20,     6,    57,    23,    24,
+      17,    20,     9,    11,    23,     9,    20,     7,    33,    34,
+      35,    20,    10,    19,    33,    34,    35,    20,    17,    21,
+      23,    10,    50,     5,    33,    34,    35,    11,    24,   102,
+      33,    34,    35,    16,    59,    60,    61,    62,    63,    64,
+      59,    60,    61,    62,    63,    64,    60,    61,    62,    63,
+      64,    60,    61,    62,    63,    64,   179,    60,    61,    62,
+      63,    64,    42,    10,   192,    45,    46,   210,   155,   201,
+      -1,   100,    19,   214,    54,   196,    69,    -1,    25,    -1,
+      27,    28,    29,    30,    31,    32,    -1,    -1,    -1,    -1,
+      -1,    -1,    -1,    -1,    -1,    75,    76,    77,    78,    79,
+      80,    81,    82,    83,    84,    85,    11,    43,    -1,    45,
+      46,    47,    48,    49,    19,    -1,    52,    53,    54,    -1,
+      25,    57,    27,    28,    29,    30,    31,    32,    19,    -1,
+      -1,    -1,    -1,    -1,    25,    -1,    27,    28,    29,    30,
+      31,    32,    19,    -1,    -1,    -1,    -1,    -1,    25,    -1,
+      -1,    -1,    29,    30,    31,    32,    45,    46,    47,    48,
+      49,    -1,    -1,    52,    53,    54,    -1,    -1,    57
+};
+
+/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
+   symbol of state STATE-NUM.  */
+static const unsigned char yystos[] =
+{
+       0,    37,    38,    39,    67,    68,    69,    70,    71,    75,
+      11,    11,    11,     0,    41,    69,    82,    83,     3,    72,
+      73,    74,    72,     3,    76,    77,    78,     9,    83,    15,
+      12,    73,    17,    12,    15,    12,    77,     9,    79,     3,
+       5,     7,     9,    18,    55,    60,    61,   113,   114,   115,
+     116,   117,     3,     4,     9,    26,    51,   111,   112,   113,
+       4,    42,     3,    80,    81,    17,    18,   115,     3,     9,
+     115,   115,    17,    84,    20,    23,    24,    33,    34,    35,
+      59,    60,    61,    62,    63,    64,     9,   112,   115,   112,
+       9,    19,    25,    27,    28,    29,    30,    31,    32,     9,
+      15,    10,    16,     3,    10,     3,     7,   114,    80,    85,
+      10,    36,   115,   115,   115,   115,   115,   115,   115,   115,
+     115,   115,   115,     7,    10,     3,   112,   112,   112,   112,
+     112,   112,   112,   112,   113,   111,    81,    10,    10,    10,
+      11,    30,    86,    10,    10,    10,    43,    45,    46,    47,
+      48,    49,    52,    53,    54,    57,    87,    88,    91,    92,
+     101,   102,   105,   106,   107,   108,     4,     6,     7,     8,
+      22,    58,    94,    95,    96,    99,   113,     7,    56,    93,
+     113,   112,     4,     4,     4,   102,    12,    88,    17,     7,
+     103,   113,    13,     6,     9,    17,    16,    43,    11,    94,
+      11,   110,   113,     9,   104,    95,    80,   100,    96,     7,
+      89,    90,    91,   108,    19,    97,    87,   104,    21,    10,
+     113,    14,    10,    12,    90,    17,    20,    98,   110,    12,
+     113,    10,    50,   109,    11,   108,    87,    12
+};
+
+#define yyerrok                (yyerrstatus = 0)
+#define yyclearin      (yychar = YYEMPTY)
+#define YYEMPTY                (-2)
+#define YYEOF          0
+
+#define YYACCEPT       goto yyacceptlab
+#define YYABORT                goto yyabortlab
+#define YYERROR                goto yyerrorlab
+
+
+/* Like YYERROR except do call yyerror.  This remains here temporarily
+   to ease the transition to the new meaning of YYERROR, for GCC.
+   Once GCC version 2 has supplanted version 1, this can go.  */
+
+#define YYFAIL         goto yyerrlab
+
+#define YYRECOVERING()  (!!yyerrstatus)
+
+#define YYBACKUP(Token, Value)                                 \
+do                                                             \
+  if (yychar == YYEMPTY && yylen == 1)                         \
+    {                                                          \
+      yychar = (Token);                                                \
+      yylval = (Value);                                                \
+      yytoken = YYTRANSLATE (yychar);                          \
+      YYPOPSTACK;                                              \
+      goto yybackup;                                           \
+    }                                                          \
+  else                                                         \
+    {                                                          \
+      yyerror (&yylloc, lexer, resultAST, YY_("syntax error: cannot back up")); \
+      YYERROR;                                                 \
+    }                                                          \
+while (0)
+
+
+#define YYTERROR       1
+#define YYERRCODE      256
+
+
+/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
+   If N is 0, then set CURRENT to the empty location which ends
+   the previous symbol: RHS[0] (always defined).  */
+
+#define YYRHSLOC(Rhs, K) ((Rhs)[K])
+#ifndef YYLLOC_DEFAULT
+# define YYLLOC_DEFAULT(Current, Rhs, N)                               \
+    do                                                                 \
+      if (N)                                                           \
+       {                                                               \
+         (Current).first_line   = YYRHSLOC (Rhs, 1).first_line;        \
+         (Current).first_column = YYRHSLOC (Rhs, 1).first_column;      \
+         (Current).last_line    = YYRHSLOC (Rhs, N).last_line;         \
+         (Current).last_column  = YYRHSLOC (Rhs, N).last_column;       \
+       }                                                               \
+      else                                                             \
+       {                                                               \
+         (Current).first_line   = (Current).last_line   =              \
+           YYRHSLOC (Rhs, 0).last_line;                                \
+         (Current).first_column = (Current).last_column =              \
+           YYRHSLOC (Rhs, 0).last_column;                              \
+       }                                                               \
+    while (0)
+#endif
+
+
+/* YY_LOCATION_PRINT -- Print the location on the stream.
+   This macro was not mandated originally: define only if we know
+   we won't break user code: when these are the locations we know.  */
+
+#ifndef YY_LOCATION_PRINT
+# if YYLTYPE_IS_TRIVIAL
+#  define YY_LOCATION_PRINT(File, Loc)                 \
+     fprintf (File, "%d.%d-%d.%d",                     \
+              (Loc).first_line, (Loc).first_column,    \
+              (Loc).last_line,  (Loc).last_column)
+# else
+#  define YY_LOCATION_PRINT(File, Loc) ((void) 0)
+# endif
+#endif
+
+
+/* YYLEX -- calling `yylex' with the right arguments.  */
+
+#ifdef YYLEX_PARAM
+# define YYLEX yylex (&yylval, &yylloc, YYLEX_PARAM)
+#else
+# define YYLEX yylex (&yylval, &yylloc, lexer)
+#endif
+
+/* Enable debugging if requested.  */
+#if YYDEBUG
+
+# ifndef YYFPRINTF
+#  include <stdio.h> /* INFRINGES ON USER NAME SPACE */
+#  define YYFPRINTF fprintf
+# endif
+
+# define YYDPRINTF(Args)                       \
+do {                                           \
+  if (yydebug)                                 \
+    YYFPRINTF Args;                            \
+} while (0)
+
+# define YY_SYMBOL_PRINT(Title, Type, Value, Location)         \
+do {                                                           \
+  if (yydebug)                                                 \
+    {                                                          \
+      YYFPRINTF (stderr, "%s ", Title);                                \
+      yysymprint (stderr,                                      \
+                  Type, Value, Location);      \
+      YYFPRINTF (stderr, "\n");                                        \
+    }                                                          \
+} while (0)
+
+/*------------------------------------------------------------------.
+| yy_stack_print -- Print the state stack from its BOTTOM up to its |
+| TOP (included).                                                   |
+`------------------------------------------------------------------*/
+
+#if defined (__STDC__) || defined (__cplusplus)
+static void
+yy_stack_print (short int *bottom, short int *top)
+#else
+static void
+yy_stack_print (bottom, top)
+    short int *bottom;
+    short int *top;
+#endif
+{
+  YYFPRINTF (stderr, "Stack now");
+  for (/* Nothing. */; bottom <= top; ++bottom)
+    YYFPRINTF (stderr, " %d", *bottom);
+  YYFPRINTF (stderr, "\n");
+}
+
+# define YY_STACK_PRINT(Bottom, Top)                           \
+do {                                                           \
+  if (yydebug)                                                 \
+    yy_stack_print ((Bottom), (Top));                          \
+} while (0)
+
+
+/*------------------------------------------------.
+| Report that the YYRULE is going to be reduced.  |
+`------------------------------------------------*/
+
+#if defined (__STDC__) || defined (__cplusplus)
+static void
+yy_reduce_print (int yyrule)
+#else
+static void
+yy_reduce_print (yyrule)
+    int yyrule;
+#endif
+{
+  int yyi;
+  unsigned long int yylno = yyrline[yyrule];
+  YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu), ",
+             yyrule - 1, yylno);
+  /* Print the symbols being reduced, and their result.  */
+  for (yyi = yyprhs[yyrule]; 0 <= yyrhs[yyi]; yyi++)
+    YYFPRINTF (stderr, "%s ", yytname[yyrhs[yyi]]);
+  YYFPRINTF (stderr, "-> %s\n", yytname[yyr1[yyrule]]);
+}
+
+# define YY_REDUCE_PRINT(Rule)         \
+do {                                   \
+  if (yydebug)                         \
+    yy_reduce_print (Rule);            \
+} while (0)
+
+/* Nonzero means print parse trace.  It is left uninitialized so that
+   multiple parsers can coexist.  */
+int yydebug;
+#else /* !YYDEBUG */
+# define YYDPRINTF(Args)
+# define YY_SYMBOL_PRINT(Title, Type, Value, Location)
+# define YY_STACK_PRINT(Bottom, Top)
+# define YY_REDUCE_PRINT(Rule)
+#endif /* !YYDEBUG */
+
+
+/* YYINITDEPTH -- initial size of the parser's stacks.  */
+#ifndef        YYINITDEPTH
+# define YYINITDEPTH 200
+#endif
+
+/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
+   if the built-in stack extension method is used).
+
+   Do not make this value too large; the results are undefined if
+   YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
+   evaluated with infinite-precision integer arithmetic.  */
+
+#ifndef YYMAXDEPTH
+# define YYMAXDEPTH 10000
+#endif
+
+\f
+
+#if YYERROR_VERBOSE
+
+# ifndef yystrlen
+#  if defined (__GLIBC__) && defined (_STRING_H)
+#   define yystrlen strlen
+#  else
+/* Return the length of YYSTR.  */
+static YYSIZE_T
+#   if defined (__STDC__) || defined (__cplusplus)
+yystrlen (const char *yystr)
+#   else
+yystrlen (yystr)
+     const char *yystr;
+#   endif
+{
+  const char *yys = yystr;
+
+  while (*yys++ != '\0')
+    continue;
+
+  return yys - yystr - 1;
+}
+#  endif
+# endif
+
+# ifndef yystpcpy
+#  if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE)
+#   define yystpcpy stpcpy
+#  else
+/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
+   YYDEST.  */
+static char *
+#   if defined (__STDC__) || defined (__cplusplus)
+yystpcpy (char *yydest, const char *yysrc)
+#   else
+yystpcpy (yydest, yysrc)
+     char *yydest;
+     const char *yysrc;
+#   endif
+{
+  char *yyd = yydest;
+  const char *yys = yysrc;
+
+  while ((*yyd++ = *yys++) != '\0')
+    continue;
+
+  return yyd - 1;
+}
+#  endif
+# endif
+
+# ifndef yytnamerr
+/* Copy to YYRES the contents of YYSTR after stripping away unnecessary
+   quotes and backslashes, so that it's suitable for yyerror.  The
+   heuristic is that double-quoting is unnecessary unless the string
+   contains an apostrophe, a comma, or backslash (other than
+   backslash-backslash).  YYSTR is taken from yytname.  If YYRES is
+   null, do not copy; instead, return the length of what the result
+   would have been.  */
+static YYSIZE_T
+yytnamerr (char *yyres, const char *yystr)
+{
+  if (*yystr == '"')
+    {
+      size_t yyn = 0;
+      char const *yyp = yystr;
+
+      for (;;)
+       switch (*++yyp)
+         {
+         case '\'':
+         case ',':
+           goto do_not_strip_quotes;
+
+         case '\\':
+           if (*++yyp != '\\')
+             goto do_not_strip_quotes;
+           /* Fall through.  */
+         default:
+           if (yyres)
+             yyres[yyn] = *yyp;
+           yyn++;
+           break;
+
+         case '"':
+           if (yyres)
+             yyres[yyn] = '\0';
+           return yyn;
+         }
+    do_not_strip_quotes: ;
+    }
+
+  if (! yyres)
+    return yystrlen (yystr);
+
+  return yystpcpy (yyres, yystr) - yyres;
+}
+# endif
+
+#endif /* YYERROR_VERBOSE */
+
+\f
+
+#if YYDEBUG
+/*--------------------------------.
+| Print this symbol on YYOUTPUT.  |
+`--------------------------------*/
+
+#if defined (__STDC__) || defined (__cplusplus)
+static void
+yysymprint (FILE *yyoutput, int yytype, YYSTYPE *yyvaluep, YYLTYPE *yylocationp)
+#else
+static void
+yysymprint (yyoutput, yytype, yyvaluep, yylocationp)
+    FILE *yyoutput;
+    int yytype;
+    YYSTYPE *yyvaluep;
+    YYLTYPE *yylocationp;
+#endif
+{
+  /* Pacify ``unused variable'' warnings.  */
+  (void) yyvaluep;
+  (void) yylocationp;
+
+  if (yytype < YYNTOKENS)
+    YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
+  else
+    YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
+
+  YY_LOCATION_PRINT (yyoutput, *yylocationp);
+  YYFPRINTF (yyoutput, ": ");
+
+# ifdef YYPRINT
+  if (yytype < YYNTOKENS)
+    YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
+# endif
+  switch (yytype)
+    {
+      default:
+        break;
+    }
+  YYFPRINTF (yyoutput, ")");
+}
+
+#endif /* ! YYDEBUG */
+/*-----------------------------------------------.
+| Release the memory associated to this symbol.  |
+`-----------------------------------------------*/
+
+#if defined (__STDC__) || defined (__cplusplus)
+static void
+yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, YYLTYPE *yylocationp)
+#else
+static void
+yydestruct (yymsg, yytype, yyvaluep, yylocationp)
+    const char *yymsg;
+    int yytype;
+    YYSTYPE *yyvaluep;
+    YYLTYPE *yylocationp;
+#endif
+{
+  /* Pacify ``unused variable'' warnings.  */
+  (void) yyvaluep;
+  (void) yylocationp;
+
+  if (!yymsg)
+    yymsg = "Deleting";
+  YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
+
+  switch (yytype)
+    {
+      case 3: /* "\"identifier\"" */
+#line 158 "/Users/creed/projects/fsl/fromsvr/elftosb/elftosb2/elftosb_parser.y"
+        { delete (yyvaluep->m_str); };
+#line 1209 "/Users/creed/projects/fsl/fromsvr/elftosb/build/elftosb.build/Debug/elftosb.build/DerivedSources/elftosb_parser.tab.cpp"
+        break;
+      case 4: /* "\"string\"" */
+#line 158 "/Users/creed/projects/fsl/fromsvr/elftosb/elftosb2/elftosb_parser.y"
+        { delete (yyvaluep->m_str); };
+#line 1214 "/Users/creed/projects/fsl/fromsvr/elftosb/build/elftosb.build/Debug/elftosb.build/DerivedSources/elftosb_parser.tab.cpp"
+        break;
+      case 5: /* "\"integer\"" */
+#line 158 "/Users/creed/projects/fsl/fromsvr/elftosb/elftosb2/elftosb_parser.y"
+        { delete (yyvaluep->m_int); };
+#line 1219 "/Users/creed/projects/fsl/fromsvr/elftosb/build/elftosb.build/Debug/elftosb.build/DerivedSources/elftosb_parser.tab.cpp"
+        break;
+      case 6: /* "\"section name\"" */
+#line 158 "/Users/creed/projects/fsl/fromsvr/elftosb/elftosb2/elftosb_parser.y"
+        { delete (yyvaluep->m_str); };
+#line 1224 "/Users/creed/projects/fsl/fromsvr/elftosb/build/elftosb.build/Debug/elftosb.build/DerivedSources/elftosb_parser.tab.cpp"
+        break;
+      case 7: /* "\"source name\"" */
+#line 158 "/Users/creed/projects/fsl/fromsvr/elftosb/elftosb2/elftosb_parser.y"
+        { delete (yyvaluep->m_str); };
+#line 1229 "/Users/creed/projects/fsl/fromsvr/elftosb/build/elftosb.build/Debug/elftosb.build/DerivedSources/elftosb_parser.tab.cpp"
+        break;
+      case 8: /* "\"binary object\"" */
+#line 158 "/Users/creed/projects/fsl/fromsvr/elftosb/elftosb2/elftosb_parser.y"
+        { delete (yyvaluep->m_blob); };
+#line 1234 "/Users/creed/projects/fsl/fromsvr/elftosb/build/elftosb.build/Debug/elftosb.build/DerivedSources/elftosb_parser.tab.cpp"
+        break;
+      case 36: /* "\"integer size\"" */
+#line 158 "/Users/creed/projects/fsl/fromsvr/elftosb/elftosb2/elftosb_parser.y"
+        { delete (yyvaluep->m_int); };
+#line 1239 "/Users/creed/projects/fsl/fromsvr/elftosb/build/elftosb.build/Debug/elftosb.build/DerivedSources/elftosb_parser.tab.cpp"
+        break;
+
+      default:
+        break;
+    }
+}
+\f
+
+/* Prevent warnings from -Wmissing-prototypes.  */
+
+#ifdef YYPARSE_PARAM
+# if defined (__STDC__) || defined (__cplusplus)
+int yyparse (void *YYPARSE_PARAM);
+# else
+int yyparse ();
+# endif
+#else /* ! YYPARSE_PARAM */
+#if defined (__STDC__) || defined (__cplusplus)
+int yyparse (ElftosbLexer * lexer, CommandFileASTNode ** resultAST);
+#else
+int yyparse ();
+#endif
+#endif /* ! YYPARSE_PARAM */
+
+
+
+
+
+
+/*----------.
+| yyparse.  |
+`----------*/
+
+#ifdef YYPARSE_PARAM
+# if defined (__STDC__) || defined (__cplusplus)
+int yyparse (void *YYPARSE_PARAM)
+# else
+int yyparse (YYPARSE_PARAM)
+  void *YYPARSE_PARAM;
+# endif
+#else /* ! YYPARSE_PARAM */
+#if defined (__STDC__) || defined (__cplusplus)
+int
+yyparse (ElftosbLexer * lexer, CommandFileASTNode ** resultAST)
+#else
+int
+yyparse (lexer, resultAST)
+    ElftosbLexer * lexer;
+    CommandFileASTNode ** resultAST;
+#endif
+#endif
+{
+  /* The look-ahead symbol.  */
+int yychar;
+
+/* The semantic value of the look-ahead symbol.  */
+YYSTYPE yylval;
+
+/* Number of syntax errors so far.  */
+int yynerrs;
+/* Location data for the look-ahead symbol.  */
+YYLTYPE yylloc;
+
+  int yystate;
+  int yyn;
+  int yyresult;
+  /* Number of tokens to shift before error messages enabled.  */
+  int yyerrstatus;
+  /* Look-ahead token as an internal (translated) token number.  */
+  int yytoken = 0;
+
+  /* Three stacks and their tools:
+     `yyss': related to states,
+     `yyvs': related to semantic values,
+     `yyls': related to locations.
+
+     Refer to the stacks thru separate pointers, to allow yyoverflow
+     to reallocate them elsewhere.  */
+
+  /* The state stack.  */
+  short int yyssa[YYINITDEPTH];
+  short int *yyss = yyssa;
+  short int *yyssp;
+
+  /* The semantic value stack.  */
+  YYSTYPE yyvsa[YYINITDEPTH];
+  YYSTYPE *yyvs = yyvsa;
+  YYSTYPE *yyvsp;
+
+  /* The location stack.  */
+  YYLTYPE yylsa[YYINITDEPTH];
+  YYLTYPE *yyls = yylsa;
+  YYLTYPE *yylsp;
+  /* The locations where the error started and ended. */
+  YYLTYPE yyerror_range[2];
+
+#define YYPOPSTACK   (yyvsp--, yyssp--, yylsp--)
+
+  YYSIZE_T yystacksize = YYINITDEPTH;
+
+  /* The variables used to return semantic value and location from the
+     action routines.  */
+  YYSTYPE yyval;
+  YYLTYPE yyloc;
+
+  /* When reducing, the number of symbols on the RHS of the reduced
+     rule.  */
+  int yylen;
+
+  YYDPRINTF ((stderr, "Starting parse\n"));
+
+  yystate = 0;
+  yyerrstatus = 0;
+  yynerrs = 0;
+  yychar = YYEMPTY;            /* Cause a token to be read.  */
+
+  /* Initialize stack pointers.
+     Waste one element of value and location stack
+     so that they stay on the same level as the state stack.
+     The wasted elements are never initialized.  */
+
+  yyssp = yyss;
+  yyvsp = yyvs;
+  yylsp = yyls;
+#if YYLTYPE_IS_TRIVIAL
+  /* Initialize the default location before parsing starts.  */
+  yylloc.first_line   = yylloc.last_line   = 1;
+  yylloc.first_column = yylloc.last_column = 0;
+#endif
+
+  goto yysetstate;
+
+/*------------------------------------------------------------.
+| yynewstate -- Push a new state, which is found in yystate.  |
+`------------------------------------------------------------*/
+ yynewstate:
+  /* In all cases, when you get here, the value and location stacks
+     have just been pushed. so pushing a state here evens the stacks.
+     */
+  yyssp++;
+
+ yysetstate:
+  *yyssp = yystate;
+
+  if (yyss + yystacksize - 1 <= yyssp)
+    {
+      /* Get the current used size of the three stacks, in elements.  */
+      YYSIZE_T yysize = yyssp - yyss + 1;
+
+#ifdef yyoverflow
+      {
+       /* Give user a chance to reallocate the stack. Use copies of
+          these so that the &'s don't force the real ones into
+          memory.  */
+       YYSTYPE *yyvs1 = yyvs;
+       short int *yyss1 = yyss;
+       YYLTYPE *yyls1 = yyls;
+
+       /* Each stack pointer address is followed by the size of the
+          data in use in that stack, in bytes.  This used to be a
+          conditional around just the two extra args, but that might
+          be undefined if yyoverflow is a macro.  */
+       yyoverflow (YY_("memory exhausted"),
+                   &yyss1, yysize * sizeof (*yyssp),
+                   &yyvs1, yysize * sizeof (*yyvsp),
+                   &yyls1, yysize * sizeof (*yylsp),
+                   &yystacksize);
+       yyls = yyls1;
+       yyss = yyss1;
+       yyvs = yyvs1;
+      }
+#else /* no yyoverflow */
+# ifndef YYSTACK_RELOCATE
+      goto yyexhaustedlab;
+# else
+      /* Extend the stack our own way.  */
+      if (YYMAXDEPTH <= yystacksize)
+       goto yyexhaustedlab;
+      yystacksize *= 2;
+      if (YYMAXDEPTH < yystacksize)
+       yystacksize = YYMAXDEPTH;
+
+      {
+       short int *yyss1 = yyss;
+       union yyalloc *yyptr =
+         (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
+       if (! yyptr)
+         goto yyexhaustedlab;
+       YYSTACK_RELOCATE (yyss);
+       YYSTACK_RELOCATE (yyvs);
+       YYSTACK_RELOCATE (yyls);
+#  undef YYSTACK_RELOCATE
+       if (yyss1 != yyssa)
+         YYSTACK_FREE (yyss1);
+      }
+# endif
+#endif /* no yyoverflow */
+
+      yyssp = yyss + yysize - 1;
+      yyvsp = yyvs + yysize - 1;
+      yylsp = yyls + yysize - 1;
+
+      YYDPRINTF ((stderr, "Stack size increased to %lu\n",
+                 (unsigned long int) yystacksize));
+
+      if (yyss + yystacksize - 1 <= yyssp)
+       YYABORT;
+    }
+
+  YYDPRINTF ((stderr, "Entering state %d\n", yystate));
+
+  goto yybackup;
+
+/*-----------.
+| yybackup.  |
+`-----------*/
+yybackup:
+
+/* Do appropriate processing given the current state.  */
+/* Read a look-ahead token if we need one and don't already have one.  */
+/* yyresume: */
+
+  /* First try to decide what to do without reference to look-ahead token.  */
+
+  yyn = yypact[yystate];
+  if (yyn == YYPACT_NINF)
+    goto yydefault;
+
+  /* Not known => get a look-ahead token if don't already have one.  */
+
+  /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol.  */
+  if (yychar == YYEMPTY)
+    {
+      YYDPRINTF ((stderr, "Reading a token: "));
+      yychar = YYLEX;
+    }
+
+  if (yychar <= YYEOF)
+    {
+      yychar = yytoken = YYEOF;
+      YYDPRINTF ((stderr, "Now at end of input.\n"));
+    }
+  else
+    {
+      yytoken = YYTRANSLATE (yychar);
+      YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
+    }
+
+  /* If the proper action on seeing token YYTOKEN is to reduce or to
+     detect an error, take that action.  */
+  yyn += yytoken;
+  if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
+    goto yydefault;
+  yyn = yytable[yyn];
+  if (yyn <= 0)
+    {
+      if (yyn == 0 || yyn == YYTABLE_NINF)
+       goto yyerrlab;
+      yyn = -yyn;
+      goto yyreduce;
+    }
+
+  if (yyn == YYFINAL)
+    YYACCEPT;
+
+  /* Shift the look-ahead token.  */
+  YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
+
+  /* Discard the token being shifted unless it is eof.  */
+  if (yychar != YYEOF)
+    yychar = YYEMPTY;
+
+  *++yyvsp = yylval;
+  *++yylsp = yylloc;
+
+  /* Count tokens shifted since error; after three, turn off error
+     status.  */
+  if (yyerrstatus)
+    yyerrstatus--;
+
+  yystate = yyn;
+  goto yynewstate;
+
+
+/*-----------------------------------------------------------.
+| yydefault -- do the default action for the current state.  |
+`-----------------------------------------------------------*/
+yydefault:
+  yyn = yydefact[yystate];
+  if (yyn == 0)
+    goto yyerrlab;
+  goto yyreduce;
+
+
+/*-----------------------------.
+| yyreduce -- Do a reduction.  |
+`-----------------------------*/
+yyreduce:
+  /* yyn is the number of a rule to reduce with.  */
+  yylen = yyr2[yyn];
+
+  /* If YYLEN is nonzero, implement the default value of the action:
+     `$$ = $1'.
+
+     Otherwise, the following line sets YYVAL to garbage.
+     This behavior is undocumented and Bison
+     users should not rely upon it.  Assigning to YYVAL
+     unconditionally makes the parser a bit smaller, and it avoids a
+     GCC warning that YYVAL may be used uninitialized.  */
+  yyval = yyvsp[1-yylen];
+
+  /* Default location. */
+  YYLLOC_DEFAULT (yyloc, yylsp - yylen, yylen);
+  YY_REDUCE_PRINT (yyn);
+  switch (yyn)
+    {
+        case 2:
+#line 163 "/Users/creed/projects/fsl/fromsvr/elftosb/elftosb2/elftosb_parser.y"
+    {
+                                                       CommandFileASTNode * commandFile = new CommandFileASTNode();
+                                                       commandFile->setBlocks(dynamic_cast<ListASTNode*>((yyvsp[-1].m_ast)));
+                                                       commandFile->setSections(dynamic_cast<ListASTNode*>((yyvsp[0].m_ast)));
+                                                       commandFile->setLocation((yylsp[-1]), (yylsp[0]));
+                                                       *resultAST = commandFile;
+                                               ;}
+    break;
+
+  case 3:
+#line 173 "/Users/creed/projects/fsl/fromsvr/elftosb/elftosb2/elftosb_parser.y"
+    {
+                                                       ListASTNode * list = new ListASTNode();
+                                                       list->appendNode((yyvsp[0].m_ast));
+                                                       (yyval.m_ast) = list;
+                                               ;}
+    break;
+
+  case 4:
+#line 179 "/Users/creed/projects/fsl/fromsvr/elftosb/elftosb2/elftosb_parser.y"
+    {
+                                                       dynamic_cast<ListASTNode*>((yyvsp[-1].m_ast))->appendNode((yyvsp[0].m_ast));
+                                                       (yyval.m_ast) = (yyvsp[-1].m_ast);
+                                               ;}
+    break;
+
+  case 5:
+#line 186 "/Users/creed/projects/fsl/fromsvr/elftosb/elftosb2/elftosb_parser.y"
+    { (yyval.m_ast) = (yyvsp[0].m_ast); ;}
+    break;
+
+  case 6:
+#line 187 "/Users/creed/projects/fsl/fromsvr/elftosb/elftosb2/elftosb_parser.y"
+    { (yyval.m_ast) = (yyvsp[0].m_ast); ;}
+    break;
+
+  case 7:
+#line 188 "/Users/creed/projects/fsl/fromsvr/elftosb/elftosb2/elftosb_parser.y"
+    { (yyval.m_ast) = (yyvsp[0].m_ast); ;}
+    break;
+
+  case 8:
+#line 192 "/Users/creed/projects/fsl/fromsvr/elftosb/elftosb2/elftosb_parser.y"
+    {
+                                                               (yyval.m_ast) = new OptionsBlockASTNode(dynamic_cast<ListASTNode *>((yyvsp[-1].m_ast)));
+                                                       ;}
+    break;
+
+  case 9:
+#line 198 "/Users/creed/projects/fsl/fromsvr/elftosb/elftosb2/elftosb_parser.y"
+    {
+                                                               (yyval.m_ast) = new ConstantsBlockASTNode(dynamic_cast<ListASTNode *>((yyvsp[-1].m_ast)));
+                                                       ;}
+    break;
+
+  case 10:
+#line 204 "/Users/creed/projects/fsl/fromsvr/elftosb/elftosb2/elftosb_parser.y"
+    {
+                                                               ListASTNode * list = new ListASTNode();
+                                                               list->appendNode((yyvsp[0].m_ast));
+                                                               (yyval.m_ast) = list;
+                                                       ;}
+    break;
+
+  case 11:
+#line 210 "/Users/creed/projects/fsl/fromsvr/elftosb/elftosb2/elftosb_parser.y"
+    {
+                                                               dynamic_cast<ListASTNode*>((yyvsp[-1].m_ast))->appendNode((yyvsp[0].m_ast));
+                                                               (yyval.m_ast) = (yyvsp[-1].m_ast);
+                                                       ;}
+    break;
+
+  case 12:
+#line 216 "/Users/creed/projects/fsl/fromsvr/elftosb/elftosb2/elftosb_parser.y"
+    { (yyval.m_ast) = (yyvsp[-1].m_ast); ;}
+    break;
+
+  case 13:
+#line 217 "/Users/creed/projects/fsl/fromsvr/elftosb/elftosb2/elftosb_parser.y"
+    { (yyval.m_ast) = NULL; ;}
+    break;
+
+  case 14:
+#line 221 "/Users/creed/projects/fsl/fromsvr/elftosb/elftosb2/elftosb_parser.y"
+    {
+                                                               (yyval.m_ast) = new AssignmentASTNode((yyvsp[-2].m_str), (yyvsp[0].m_ast));
+                                                               (yyval.m_ast)->setLocation((yylsp[-2]), (yylsp[0]));
+                                                       ;}
+    break;
+
+  case 15:
+#line 228 "/Users/creed/projects/fsl/fromsvr/elftosb/elftosb2/elftosb_parser.y"
+    {
+                                                       (yyval.m_ast) = new SourcesBlockASTNode(dynamic_cast<ListASTNode *>((yyvsp[-1].m_ast)));
+                                               ;}
+    break;
+
+  case 16:
+#line 234 "/Users/creed/projects/fsl/fromsvr/elftosb/elftosb2/elftosb_parser.y"
+    {
+                                                       ListASTNode * list = new ListASTNode();
+                                                       list->appendNode((yyvsp[0].m_ast));
+                                                       (yyval.m_ast) = list;
+                                               ;}
+    break;
+
+  case 17:
+#line 240 "/Users/creed/projects/fsl/fromsvr/elftosb/elftosb2/elftosb_parser.y"
+    {
+                                                       dynamic_cast<ListASTNode*>((yyvsp[-1].m_ast))->appendNode((yyvsp[0].m_ast));
+                                                       (yyval.m_ast) = (yyvsp[-1].m_ast);
+                                               ;}
+    break;
+
+  case 18:
+#line 248 "/Users/creed/projects/fsl/fromsvr/elftosb/elftosb2/elftosb_parser.y"
+    {
+                                                               // tell the lexer that this is the name of a source file
+                                                               SourceDefASTNode * node = dynamic_cast<SourceDefASTNode*>((yyvsp[-2].m_ast));
+                                                               if ((yyvsp[-1].m_ast))
+                                                               {
+                                                                       node->setAttributes(dynamic_cast<ListASTNode*>((yyvsp[-1].m_ast)));
+                                                               }
+                                                               node->setLocation(node->getLocation(), (yylsp[0]));
+                                                               lexer->addSourceName(node->getName());
+                                                               (yyval.m_ast) = (yyvsp[-2].m_ast);
+                                                       ;}
+    break;
+
+  case 19:
+#line 259 "/Users/creed/projects/fsl/fromsvr/elftosb/elftosb2/elftosb_parser.y"
+    { (yyval.m_ast) = NULL; ;}
+    break;
+
+  case 20:
+#line 263 "/Users/creed/projects/fsl/fromsvr/elftosb/elftosb2/elftosb_parser.y"
+    {
+                                                               (yyval.m_ast) = new PathSourceDefASTNode((yyvsp[-2].m_str), (yyvsp[0].m_str));
+                                                               (yyval.m_ast)->setLocation((yylsp[-2]), (yylsp[0]));
+                                                       ;}
+    break;
+
+  case 21:
+#line 268 "/Users/creed/projects/fsl/fromsvr/elftosb/elftosb2/elftosb_parser.y"
+    {
+                                                               (yyval.m_ast) = new ExternSourceDefASTNode((yyvsp[-5].m_str), dynamic_cast<ExprASTNode*>((yyvsp[-1].m_ast)));
+                                                               (yyval.m_ast)->setLocation((yylsp[-5]), (yylsp[0]));
+                                                       ;}
+    break;
+
+  case 22:
+#line 275 "/Users/creed/projects/fsl/fromsvr/elftosb/elftosb2/elftosb_parser.y"
+    { (yyval.m_ast) = (yyvsp[-1].m_ast); ;}
+    break;
+
+  case 23:
+#line 276 "/Users/creed/projects/fsl/fromsvr/elftosb/elftosb2/elftosb_parser.y"
+    { (yyval.m_ast) = NULL; ;}
+    break;
+
+  case 24:
+#line 281 "/Users/creed/projects/fsl/fromsvr/elftosb/elftosb2/elftosb_parser.y"
+    {
+                                                               ListASTNode * list = new ListASTNode();
+                                                               list->appendNode((yyvsp[0].m_ast));
+                                                               (yyval.m_ast) = list;
+                                                       ;}
+    break;
+
+  case 25:
+#line 287 "/Users/creed/projects/fsl/fromsvr/elftosb/elftosb2/elftosb_parser.y"
+    {
+                                                               dynamic_cast<ListASTNode*>((yyvsp[-2].m_ast))->appendNode((yyvsp[0].m_ast));
+                                                               (yyval.m_ast) = (yyvsp[-2].m_ast);
+                                                       ;}
+    break;
+
+  case 26:
+#line 295 "/Users/creed/projects/fsl/fromsvr/elftosb/elftosb2/elftosb_parser.y"
+    {
+                                                               (yyval.m_ast) = new AssignmentASTNode((yyvsp[-2].m_str), (yyvsp[0].m_ast));
+                                                               (yyval.m_ast)->setLocation((yylsp[-2]), (yylsp[0]));
+                                                       ;}
+    break;
+
+  case 27:
+#line 302 "/Users/creed/projects/fsl/fromsvr/elftosb/elftosb2/elftosb_parser.y"
+    {
+                                                               ListASTNode * list = new ListASTNode();
+                                                               list->appendNode((yyvsp[0].m_ast));
+                                                               (yyval.m_ast) = list;
+                                                       ;}
+    break;
+
+  case 28:
+#line 308 "/Users/creed/projects/fsl/fromsvr/elftosb/elftosb2/elftosb_parser.y"
+    {
+                                                               dynamic_cast<ListASTNode*>((yyvsp[-1].m_ast))->appendNode((yyvsp[0].m_ast));
+                                                               (yyval.m_ast) = (yyvsp[-1].m_ast);
+                                                       ;}
+    break;
+
+  case 29:
+#line 315 "/Users/creed/projects/fsl/fromsvr/elftosb/elftosb2/elftosb_parser.y"
+    {
+                                                               SectionContentsASTNode * sectionNode = dynamic_cast<SectionContentsASTNode*>((yyvsp[0].m_ast));
+                                                               if (sectionNode)
+                                                               {
+                                                                       ExprASTNode * exprNode = dynamic_cast<ExprASTNode*>((yyvsp[-3].m_ast));
+                                                                       sectionNode->setSectionNumberExpr(exprNode);
+                                                                       sectionNode->setOptions(dynamic_cast<ListASTNode*>((yyvsp[-2].m_ast)));
+                                                                       sectionNode->setLocation((yylsp[-5]), sectionNode->getLocation());
+                                                               }
+                                                               (yyval.m_ast) = (yyvsp[0].m_ast);
+                                                       ;}
+    break;
+
+  case 30:
+#line 330 "/Users/creed/projects/fsl/fromsvr/elftosb/elftosb2/elftosb_parser.y"
+    {
+                                                               (yyval.m_ast) = (yyvsp[0].m_ast);
+                                                       ;}
+    break;
+
+  case 31:
+#line 334 "/Users/creed/projects/fsl/fromsvr/elftosb/elftosb2/elftosb_parser.y"
+    {
+                                                               (yyval.m_ast) = NULL;
+                                                       ;}
+    break;
+
+  case 32:
+#line 341 "/Users/creed/projects/fsl/fromsvr/elftosb/elftosb2/elftosb_parser.y"
+    {
+                                                               (yyval.m_ast) = (yyvsp[0].m_ast);
+                                                       ;}
+    break;
+
+  case 33:
+#line 345 "/Users/creed/projects/fsl/fromsvr/elftosb/elftosb2/elftosb_parser.y"
+    {
+                                                               (yyval.m_ast) = NULL;
+                                                       ;}
+    break;
+
+  case 34:
+#line 352 "/Users/creed/projects/fsl/fromsvr/elftosb/elftosb2/elftosb_parser.y"
+    {
+                                                               DataSectionContentsASTNode * dataSection = new DataSectionContentsASTNode((yyvsp[-1].m_ast));
+                                                               dataSection->setLocation((yylsp[-2]), (yylsp[0]));
+                                                               (yyval.m_ast) = dataSection;
+                                                       ;}
+    break;
+
+  case 35:
+#line 358 "/Users/creed/projects/fsl/fromsvr/elftosb/elftosb2/elftosb_parser.y"
+    {
+                                                               ListASTNode * listNode = dynamic_cast<ListASTNode*>((yyvsp[-1].m_ast));
+                                                               (yyval.m_ast) = new BootableSectionContentsASTNode(listNode);
+                                                               (yyval.m_ast)->setLocation((yylsp[-2]), (yylsp[0]));
+                                                       ;}
+    break;
+
+  case 36:
+#line 366 "/Users/creed/projects/fsl/fromsvr/elftosb/elftosb2/elftosb_parser.y"
+    {
+                                                               ListASTNode * list = new ListASTNode();
+                                                               list->appendNode((yyvsp[0].m_ast));
+                                                               (yyval.m_ast) = list;
+                                                       ;}
+    break;
+
+  case 37:
+#line 372 "/Users/creed/projects/fsl/fromsvr/elftosb/elftosb2/elftosb_parser.y"
+    {
+                                                               dynamic_cast<ListASTNode*>((yyvsp[-1].m_ast))->appendNode((yyvsp[0].m_ast));
+                                                               (yyval.m_ast) = (yyvsp[-1].m_ast);
+                                                       ;}
+    break;
+
+  case 38:
+#line 379 "/Users/creed/projects/fsl/fromsvr/elftosb/elftosb2/elftosb_parser.y"
+    { (yyval.m_ast) = (yyvsp[-1].m_ast); ;}
+    break;
+
+  case 39:
+#line 380 "/Users/creed/projects/fsl/fromsvr/elftosb/elftosb2/elftosb_parser.y"
+    { (yyval.m_ast) = (yyvsp[0].m_ast); ;}
+    break;
+
+  case 40:
+#line 381 "/Users/creed/projects/fsl/fromsvr/elftosb/elftosb2/elftosb_parser.y"
+    { (yyval.m_ast) = (yyvsp[0].m_ast); ;}
+    break;
+
+  case 41:
+#line 382 "/Users/creed/projects/fsl/fromsvr/elftosb/elftosb2/elftosb_parser.y"
+    { (yyval.m_ast) = NULL; ;}
+    break;
+
+  case 42:
+#line 386 "/Users/creed/projects/fsl/fromsvr/elftosb/elftosb2/elftosb_parser.y"
+    {
+                                                               ListASTNode * list = new ListASTNode();
+                                                               list->appendNode((yyvsp[0].m_ast));
+                                                               (yyval.m_ast) = list;
+                                                       ;}
+    break;
+
+  case 43:
+#line 392 "/Users/creed/projects/fsl/fromsvr/elftosb/elftosb2/elftosb_parser.y"
+    {
+                                                               dynamic_cast<ListASTNode*>((yyvsp[-1].m_ast))->appendNode((yyvsp[0].m_ast));
+                                                               (yyval.m_ast) = (yyvsp[-1].m_ast);
+                                                       ;}
+    break;
+
+  case 44:
+#line 399 "/Users/creed/projects/fsl/fromsvr/elftosb/elftosb2/elftosb_parser.y"
+    { (yyval.m_ast) = (yyvsp[-1].m_ast); ;}
+    break;
+
+  case 45:
+#line 400 "/Users/creed/projects/fsl/fromsvr/elftosb/elftosb2/elftosb_parser.y"
+    { (yyval.m_ast) = (yyvsp[0].m_ast); ;}
+    break;
+
+  case 46:
+#line 401 "/Users/creed/projects/fsl/fromsvr/elftosb/elftosb2/elftosb_parser.y"
+    { (yyval.m_ast) = NULL; ;}
+    break;
+
+  case 47:
+#line 404 "/Users/creed/projects/fsl/fromsvr/elftosb/elftosb2/elftosb_parser.y"
+    { (yyval.m_ast) = (yyvsp[0].m_ast); ;}
+    break;
+
+  case 48:
+#line 405 "/Users/creed/projects/fsl/fromsvr/elftosb/elftosb2/elftosb_parser.y"
+    { (yyval.m_ast) = (yyvsp[0].m_ast); ;}
+    break;
+
+  case 49:
+#line 406 "/Users/creed/projects/fsl/fromsvr/elftosb/elftosb2/elftosb_parser.y"
+    { (yyval.m_ast) = (yyvsp[0].m_ast); ;}
+    break;
+
+  case 50:
+#line 407 "/Users/creed/projects/fsl/fromsvr/elftosb/elftosb2/elftosb_parser.y"
+    { (yyval.m_ast) = (yyvsp[0].m_ast); ;}
+    break;
+
+  case 51:
+#line 411 "/Users/creed/projects/fsl/fromsvr/elftosb/elftosb2/elftosb_parser.y"
+    {
+                                                               LoadStatementASTNode * stmt = new LoadStatementASTNode();
+                                                               stmt->setData((yyvsp[-1].m_ast));
+                                                               stmt->setTarget((yyvsp[0].m_ast));
+                                                               // set dcd load flag if the "dcd" keyword was present.
+                                                               if ((yyvsp[-2].m_num))
+                                                               {
+                                                                       stmt->setDCDLoad(true);
+                                                               }
+                                                               // set char locations for the statement
+                                                               if ((yyvsp[0].m_ast))
+                                                               {
+                                                                       stmt->setLocation((yylsp[-3]), (yylsp[0]));
+                                                               }
+                                                               else
+                                                               {
+                                                                       stmt->setLocation((yylsp[-3]), (yylsp[-1]));
+                                                               }
+                                                               (yyval.m_ast) = stmt;
+                                                       ;}
+    break;
+
+  case 52:
+#line 434 "/Users/creed/projects/fsl/fromsvr/elftosb/elftosb2/elftosb_parser.y"
+    {
+                                                               if (!elftosb::g_enableHABSupport)
+                                                               {
+                                                                       yyerror(&yylloc, lexer, resultAST, "HAB features not supported with the selected family");
+                                                                       YYABORT;
+                                                               }
+                                                               
+                                                               (yyval.m_num) = 1;
+                                                       ;}
+    break;
+
+  case 53:
+#line 443 "/Users/creed/projects/fsl/fromsvr/elftosb/elftosb2/elftosb_parser.y"
+    { (yyval.m_num) = 0; ;}
+    break;
+
+  case 54:
+#line 446 "/Users/creed/projects/fsl/fromsvr/elftosb/elftosb2/elftosb_parser.y"
+    {
+                                                               (yyval.m_ast) = (yyvsp[0].m_ast);
+                                                       ;}
+    break;
+
+  case 55:
+#line 450 "/Users/creed/projects/fsl/fromsvr/elftosb/elftosb2/elftosb_parser.y"
+    {
+                                                               (yyval.m_ast) = new StringConstASTNode((yyvsp[0].m_str));
+                                                               (yyval.m_ast)->setLocation((yylsp[0]));
+                                                       ;}
+    break;
+
+  case 56:
+#line 455 "/Users/creed/projects/fsl/fromsvr/elftosb/elftosb2/elftosb_parser.y"
+    {
+                                                               (yyval.m_ast) = new SourceASTNode((yyvsp[0].m_str));
+                                                               (yyval.m_ast)->setLocation((yylsp[0]));
+                                                       ;}
+    break;
+
+  case 57:
+#line 460 "/Users/creed/projects/fsl/fromsvr/elftosb/elftosb2/elftosb_parser.y"
+    {
+                                                               (yyval.m_ast) = new SectionMatchListASTNode(dynamic_cast<ListASTNode*>((yyvsp[0].m_ast)));
+                                                               (yyval.m_ast)->setLocation((yylsp[0]));
+                                                       ;}
+    break;
+
+  case 58:
+#line 465 "/Users/creed/projects/fsl/fromsvr/elftosb/elftosb2/elftosb_parser.y"
+    {
+                                                               (yyval.m_ast) = new SectionMatchListASTNode(dynamic_cast<ListASTNode*>((yyvsp[-2].m_ast)), (yyvsp[0].m_str));
+                                                               (yyval.m_ast)->setLocation((yylsp[-2]), (yylsp[0]));
+                                                       ;}
+    break;
+
+  case 59:
+#line 470 "/Users/creed/projects/fsl/fromsvr/elftosb/elftosb2/elftosb_parser.y"
+    {
+                                                               (yyval.m_ast) = new SectionMatchListASTNode(dynamic_cast<ListASTNode*>((yyvsp[-1].m_ast)), (yyvsp[-3].m_str));
+                                                               (yyval.m_ast)->setLocation((yylsp[-3]), (yylsp[0]));
+                                                       ;}
+    break;
+
+  case 60:
+#line 475 "/Users/creed/projects/fsl/fromsvr/elftosb/elftosb2/elftosb_parser.y"
+    {
+                                                               (yyval.m_ast) = new BlobConstASTNode((yyvsp[0].m_blob));
+                                                               (yyval.m_ast)->setLocation((yylsp[0]));
+                                                       ;}
+    break;
+
+  case 61:
+#line 480 "/Users/creed/projects/fsl/fromsvr/elftosb/elftosb2/elftosb_parser.y"
+    {
+                                                       ;}
+    break;
+
+  case 62:
+#line 485 "/Users/creed/projects/fsl/fromsvr/elftosb/elftosb2/elftosb_parser.y"
+    {
+                                                               ListASTNode * list = new ListASTNode();
+                                                               list->appendNode((yyvsp[0].m_ast));
+                                                               (yyval.m_ast) = list;
+                                                       ;}
+    break;
+
+  case 63:
+#line 491 "/Users/creed/projects/fsl/fromsvr/elftosb/elftosb2/elftosb_parser.y"
+    {
+                                                               dynamic_cast<ListASTNode*>((yyvsp[-2].m_ast))->appendNode((yyvsp[0].m_ast));
+                                                               (yyval.m_ast) = (yyvsp[-2].m_ast);
+                                                       ;}
+    break;
+
+  case 64:
+#line 499 "/Users/creed/projects/fsl/fromsvr/elftosb/elftosb2/elftosb_parser.y"
+    {
+                                                               (yyval.m_ast) = new SectionASTNode((yyvsp[0].m_str), SectionASTNode::kInclude);
+                                                               (yyval.m_ast)->setLocation((yylsp[0]));
+                                                       ;}
+    break;
+
+  case 65:
+#line 504 "/Users/creed/projects/fsl/fromsvr/elftosb/elftosb2/elftosb_parser.y"
+    {
+                                                               (yyval.m_ast) = new SectionASTNode((yyvsp[0].m_str), SectionASTNode::kExclude);
+                                                               (yyval.m_ast)->setLocation((yylsp[-1]), (yylsp[0]));
+                                                       ;}
+    break;
+
+  case 66:
+#line 511 "/Users/creed/projects/fsl/fromsvr/elftosb/elftosb2/elftosb_parser.y"
+    {
+                                                               (yyval.m_ast) = (yyvsp[0].m_ast);
+                                                       ;}
+    break;
+
+  case 67:
+#line 515 "/Users/creed/projects/fsl/fromsvr/elftosb/elftosb2/elftosb_parser.y"
+    {
+                                                               (yyval.m_ast) = new NaturalLocationASTNode();
+//                                                             $$->setLocation();
+                                                       ;}
+    break;
+
+  case 68:
+#line 522 "/Users/creed/projects/fsl/fromsvr/elftosb/elftosb2/elftosb_parser.y"
+    {
+                                                               (yyval.m_ast) = new NaturalLocationASTNode();
+                                                               (yyval.m_ast)->setLocation((yylsp[0]));
+                                                       ;}
+    break;
+
+  case 69:
+#line 527 "/Users/creed/projects/fsl/fromsvr/elftosb/elftosb2/elftosb_parser.y"
+    {
+                                                               (yyval.m_ast) = (yyvsp[0].m_ast);
+                                                       ;}
+    break;
+
+  case 70:
+#line 533 "/Users/creed/projects/fsl/fromsvr/elftosb/elftosb2/elftosb_parser.y"
+    {
+                                                               IVTConstASTNode * ivt = new IVTConstASTNode();
+                                                               if ((yyvsp[-1].m_ast))
+                                                               {
+                                                                       ivt->setFieldAssignments(dynamic_cast<ListASTNode*>((yyvsp[-1].m_ast)));
+                                                               }
+                                                               ivt->setLocation((yylsp[-3]), (yylsp[0]));
+                                                               (yyval.m_ast) = ivt;
+                                                       ;}
+    break;
+
+  case 71:
+#line 544 "/Users/creed/projects/fsl/fromsvr/elftosb/elftosb2/elftosb_parser.y"
+    { (yyval.m_ast) = (yyvsp[0].m_ast); ;}
+    break;
+
+  case 72:
+#line 545 "/Users/creed/projects/fsl/fromsvr/elftosb/elftosb2/elftosb_parser.y"
+    { (yyval.m_ast) = NULL; ;}
+    break;
+
+  case 73:
+#line 549 "/Users/creed/projects/fsl/fromsvr/elftosb/elftosb2/elftosb_parser.y"
+    {
+                                                               CallStatementASTNode * stmt = new CallStatementASTNode();
+                                                               switch ((yyvsp[-2].m_num))
+                                                               {
+                                                                       case 1:
+                                                                               stmt->setCallType(CallStatementASTNode::kCallType);
+                                                                               break;
+                                                                       case 2:
+                                                                               stmt->setCallType(CallStatementASTNode::kJumpType);
+                                                                               break;
+                                                                       default:
+                                                                               yyerror(&yylloc, lexer, resultAST, "invalid call_or_jump value");
+                                                                               YYABORT;
+                                                                               break;
+                                                               }
+                                                               stmt->setTarget((yyvsp[-1].m_ast));
+                                                               stmt->setArgument((yyvsp[0].m_ast));
+                                                               stmt->setIsHAB(false);
+                                                               if ((yyvsp[0].m_ast))
+                                                               {
+                                                                       stmt->setLocation((yylsp[-2]), (yylsp[0]));
+                                                               }
+                                                               else
+                                                               {
+                                                                       stmt->setLocation((yylsp[-2]), (yylsp[-1]));
+                                                               }
+                                                               (yyval.m_ast) = stmt;
+                                                       ;}
+    break;
+
+  case 74:
+#line 578 "/Users/creed/projects/fsl/fromsvr/elftosb/elftosb2/elftosb_parser.y"
+    {
+                                                               if (!elftosb::g_enableHABSupport)
+                                                               {
+                                                                       yyerror(&yylloc, lexer, resultAST, "HAB features not supported with the selected family");
+                                                                       YYABORT;
+                                                               }
+                                                               
+                                                               CallStatementASTNode * stmt = new CallStatementASTNode();
+                                                               switch ((yyvsp[-2].m_num))
+                                                               {
+                                                                       case 1:
+                                                                               stmt->setCallType(CallStatementASTNode::kCallType);
+                                                                               break;
+                                                                       case 2:
+                                                                               stmt->setCallType(CallStatementASTNode::kJumpType);
+                                                                               break;
+                                                                       default:
+                                                                               yyerror(&yylloc, lexer, resultAST, "invalid call_or_jump value");
+                                                                               YYABORT;
+                                                                               break;
+                                                               }
+                                                               stmt->setTarget((yyvsp[-1].m_ast));
+                                                               stmt->setArgument((yyvsp[0].m_ast));
+                                                               stmt->setIsHAB(true);
+                                                               if ((yyvsp[0].m_ast))
+                                                               {
+                                                                       stmt->setLocation((yylsp[-3]), (yylsp[0]));
+                                                               }
+                                                               else
+                                                               {
+                                                                       stmt->setLocation((yylsp[-3]), (yylsp[-1]));
+                                                               }
+                                                               (yyval.m_ast) = stmt;
+                                                       ;}
+    break;
+
+  case 75:
+#line 614 "/Users/creed/projects/fsl/fromsvr/elftosb/elftosb2/elftosb_parser.y"
+    { (yyval.m_num) = 1; ;}
+    break;
+
+  case 76:
+#line 615 "/Users/creed/projects/fsl/fromsvr/elftosb/elftosb2/elftosb_parser.y"
+    { (yyval.m_num) = 2; ;}
+    break;
+
+  case 77:
+#line 619 "/Users/creed/projects/fsl/fromsvr/elftosb/elftosb2/elftosb_parser.y"
+    {
+                                                               (yyval.m_ast) = new SymbolASTNode(NULL, (yyvsp[0].m_str));
+                                                               (yyval.m_ast)->setLocation((yylsp[0]));
+                                                       ;}
+    break;
+
+  case 78:
+#line 624 "/Users/creed/projects/fsl/fromsvr/elftosb/elftosb2/elftosb_parser.y"
+    {
+                                                               (yyval.m_ast) = new AddressRangeASTNode((yyvsp[0].m_ast), NULL);
+                                                               (yyval.m_ast)->setLocation((yyvsp[0].m_ast));
+                                                       ;}
+    break;
+
+  case 79:
+#line 630 "/Users/creed/projects/fsl/fromsvr/elftosb/elftosb2/elftosb_parser.y"
+    { (yyval.m_ast) = (yyvsp[-1].m_ast); ;}
+    break;
+
+  case 80:
+#line 631 "/Users/creed/projects/fsl/fromsvr/elftosb/elftosb2/elftosb_parser.y"
+    { (yyval.m_ast) = NULL; ;}
+    break;
+
+  case 81:
+#line 632 "/Users/creed/projects/fsl/fromsvr/elftosb/elftosb2/elftosb_parser.y"
+    { (yyval.m_ast) = NULL; ;}
+    break;
+
+  case 82:
+#line 636 "/Users/creed/projects/fsl/fromsvr/elftosb/elftosb2/elftosb_parser.y"
+    {
+                                                               (yyval.m_ast) = new FromStatementASTNode((yyvsp[-3].m_str), dynamic_cast<ListASTNode*>((yyvsp[-1].m_ast)));
+                                                               (yyval.m_ast)->setLocation((yylsp[-4]), (yylsp[0]));
+                                                       ;}
+    break;
+
+  case 83:
+#line 643 "/Users/creed/projects/fsl/fromsvr/elftosb/elftosb2/elftosb_parser.y"
+    {
+                                                               (yyval.m_ast) = new ModeStatementASTNode(dynamic_cast<ExprASTNode*>((yyvsp[0].m_ast)));
+                                                               (yyval.m_ast)->setLocation((yylsp[-1]), (yylsp[0]));
+                                                       ;}
+    break;
+
+  case 84:
+#line 650 "/Users/creed/projects/fsl/fromsvr/elftosb/elftosb2/elftosb_parser.y"
+    {
+                                                               (yyval.m_ast) = new MessageStatementASTNode(MessageStatementASTNode::kInfo, (yyvsp[0].m_str));
+                                                               (yyval.m_ast)->setLocation((yylsp[-1]), (yylsp[0]));
+                                                       ;}
+    break;
+
+  case 85:
+#line 655 "/Users/creed/projects/fsl/fromsvr/elftosb/elftosb2/elftosb_parser.y"
+    {
+                                                               (yyval.m_ast) = new MessageStatementASTNode(MessageStatementASTNode::kWarning, (yyvsp[0].m_str));
+                                                               (yyval.m_ast)->setLocation((yylsp[-1]), (yylsp[0]));
+                                                       ;}
+    break;
+
+  case 86:
+#line 660 "/Users/creed/projects/fsl/fromsvr/elftosb/elftosb2/elftosb_parser.y"
+    {
+                                                               (yyval.m_ast) = new MessageStatementASTNode(MessageStatementASTNode::kError, (yyvsp[0].m_str));
+                                                               (yyval.m_ast)->setLocation((yylsp[-1]), (yylsp[0]));
+                                                       ;}
+    break;
+
+  case 87:
+#line 667 "/Users/creed/projects/fsl/fromsvr/elftosb/elftosb2/elftosb_parser.y"
+    {
+                                                               IfStatementASTNode * ifStmt = new IfStatementASTNode();
+                                                               ifStmt->setConditionExpr(dynamic_cast<ExprASTNode*>((yyvsp[-4].m_ast)));
+                                                               ifStmt->setIfStatements(dynamic_cast<ListASTNode*>((yyvsp[-2].m_ast)));
+                                                               ifStmt->setElseStatements(dynamic_cast<ListASTNode*>((yyvsp[0].m_ast)));
+                                                               ifStmt->setLocation((yylsp[-5]), (yylsp[0]));
+                                                               (yyval.m_ast) = ifStmt;
+                                                       ;}
+    break;
+
+  case 88:
+#line 678 "/Users/creed/projects/fsl/fromsvr/elftosb/elftosb2/elftosb_parser.y"
+    {
+                                                               (yyval.m_ast) = (yyvsp[-1].m_ast);
+                                                       ;}
+    break;
+
+  case 89:
+#line 682 "/Users/creed/projects/fsl/fromsvr/elftosb/elftosb2/elftosb_parser.y"
+    {
+                                                               ListASTNode * list = new ListASTNode();
+                                                               list->appendNode((yyvsp[0].m_ast));
+                                                               (yyval.m_ast) = list;
+                                                               (yyval.m_ast)->setLocation((yylsp[-1]), (yylsp[0]));
+                                                       ;}
+    break;
+
+  case 90:
+#line 688 "/Users/creed/projects/fsl/fromsvr/elftosb/elftosb2/elftosb_parser.y"
+    { (yyval.m_ast) = NULL; ;}
+    break;
+
+  case 91:
+#line 692 "/Users/creed/projects/fsl/fromsvr/elftosb/elftosb2/elftosb_parser.y"
+    {
+                                                               (yyval.m_ast) = new AddressRangeASTNode((yyvsp[0].m_ast), NULL);
+                                                               (yyval.m_ast)->setLocation((yyvsp[0].m_ast));
+                                                       ;}
+    break;
+
+  case 92:
+#line 697 "/Users/creed/projects/fsl/fromsvr/elftosb/elftosb2/elftosb_parser.y"
+    {
+                                                               (yyval.m_ast) = new AddressRangeASTNode((yyvsp[-2].m_ast), (yyvsp[0].m_ast));
+                                                               (yyval.m_ast)->setLocation((yylsp[-2]), (yylsp[0]));
+                                                       ;}
+    break;
+
+  case 93:
+#line 704 "/Users/creed/projects/fsl/fromsvr/elftosb/elftosb2/elftosb_parser.y"
+    {
+                                                               (yyval.m_ast) = (yyvsp[0].m_ast);
+                                                       ;}
+    break;
+
+  case 94:
+#line 708 "/Users/creed/projects/fsl/fromsvr/elftosb/elftosb2/elftosb_parser.y"
+    {
+                                                               (yyval.m_ast) = new StringConstASTNode((yyvsp[0].m_str));
+                                                               (yyval.m_ast)->setLocation((yylsp[0]));
+                                                       ;}
+    break;
+
+  case 95:
+#line 715 "/Users/creed/projects/fsl/fromsvr/elftosb/elftosb2/elftosb_parser.y"
+    {
+                                                       (yyval.m_ast) = (yyvsp[0].m_ast);
+                                               ;}
+    break;
+
+  case 96:
+#line 719 "/Users/creed/projects/fsl/fromsvr/elftosb/elftosb2/elftosb_parser.y"
+    {
+                                                       ExprASTNode * left = dynamic_cast<ExprASTNode*>((yyvsp[-2].m_ast));
+                                                       ExprASTNode * right = dynamic_cast<ExprASTNode*>((yyvsp[0].m_ast));
+                                                       (yyval.m_ast) = new BinaryOpExprASTNode(left, BinaryOpExprASTNode::kLessThan, right);
+                                                       (yyval.m_ast)->setLocation((yylsp[-2]), (yylsp[0]));
+                                               ;}
+    break;
+
+  case 97:
+#line 726 "/Users/creed/projects/fsl/fromsvr/elftosb/elftosb2/elftosb_parser.y"
+    {
+                                                       ExprASTNode * left = dynamic_cast<ExprASTNode*>((yyvsp[-2].m_ast));
+                                                       ExprASTNode * right = dynamic_cast<ExprASTNode*>((yyvsp[0].m_ast));
+                                                       (yyval.m_ast) = new BinaryOpExprASTNode(left, BinaryOpExprASTNode::kGreaterThan, right);
+                                                       (yyval.m_ast)->setLocation((yylsp[-2]), (yylsp[0]));
+                                               ;}
+    break;
+
+  case 98:
+#line 733 "/Users/creed/projects/fsl/fromsvr/elftosb/elftosb2/elftosb_parser.y"
+    {
+                                                       ExprASTNode * left = dynamic_cast<ExprASTNode*>((yyvsp[-2].m_ast));
+                                                       ExprASTNode * right = dynamic_cast<ExprASTNode*>((yyvsp[0].m_ast));
+                                                       (yyval.m_ast) = new BinaryOpExprASTNode(left, BinaryOpExprASTNode::kGreaterThanEqual, right);
+                                                       (yyval.m_ast)->setLocation((yylsp[-2]), (yylsp[0]));
+                                               ;}
+    break;
+
+  case 99:
+#line 740 "/Users/creed/projects/fsl/fromsvr/elftosb/elftosb2/elftosb_parser.y"
+    {
+                                                       ExprASTNode * left = dynamic_cast<ExprASTNode*>((yyvsp[-2].m_ast));
+                                                       ExprASTNode * right = dynamic_cast<ExprASTNode*>((yyvsp[0].m_ast));
+                                                       (yyval.m_ast) = new BinaryOpExprASTNode(left, BinaryOpExprASTNode::kLessThanEqual, right);
+                                                       (yyval.m_ast)->setLocation((yylsp[-2]), (yylsp[0]));
+                                               ;}
+    break;
+
+  case 100:
+#line 747 "/Users/creed/projects/fsl/fromsvr/elftosb/elftosb2/elftosb_parser.y"
+    {
+                                                       ExprASTNode * left = dynamic_cast<ExprASTNode*>((yyvsp[-2].m_ast));
+                                                       ExprASTNode * right = dynamic_cast<ExprASTNode*>((yyvsp[0].m_ast));
+                                                       (yyval.m_ast) = new BinaryOpExprASTNode(left, BinaryOpExprASTNode::kEqual, right);
+                                                       (yyval.m_ast)->setLocation((yylsp[-2]), (yylsp[0]));
+                                               ;}
+    break;
+
+  case 101:
+#line 754 "/Users/creed/projects/fsl/fromsvr/elftosb/elftosb2/elftosb_parser.y"
+    {
+                                                       ExprASTNode * left = dynamic_cast<ExprASTNode*>((yyvsp[-2].m_ast));
+                                                       ExprASTNode * right = dynamic_cast<ExprASTNode*>((yyvsp[0].m_ast));
+                                                       (yyval.m_ast) = new BinaryOpExprASTNode(left, BinaryOpExprASTNode::kNotEqual, right);
+                                                       (yyval.m_ast)->setLocation((yylsp[-2]), (yylsp[0]));
+                                               ;}
+    break;
+
+  case 102:
+#line 761 "/Users/creed/projects/fsl/fromsvr/elftosb/elftosb2/elftosb_parser.y"
+    {
+                                                       ExprASTNode * left = dynamic_cast<ExprASTNode*>((yyvsp[-2].m_ast));
+                                                       ExprASTNode * right = dynamic_cast<ExprASTNode*>((yyvsp[0].m_ast));
+                                                       (yyval.m_ast) = new BinaryOpExprASTNode(left, BinaryOpExprASTNode::kBooleanAnd, right);
+                                                       (yyval.m_ast)->setLocation((yylsp[-2]), (yylsp[0]));
+                                               ;}
+    break;
+
+  case 103:
+#line 768 "/Users/creed/projects/fsl/fromsvr/elftosb/elftosb2/elftosb_parser.y"
+    {
+                                                       ExprASTNode * left = dynamic_cast<ExprASTNode*>((yyvsp[-2].m_ast));
+                                                       ExprASTNode * right = dynamic_cast<ExprASTNode*>((yyvsp[0].m_ast));
+                                                       (yyval.m_ast) = new BinaryOpExprASTNode(left, BinaryOpExprASTNode::kBooleanOr, right);
+                                                       (yyval.m_ast)->setLocation((yylsp[-2]), (yylsp[0]));
+                                               ;}
+    break;
+
+  case 104:
+#line 775 "/Users/creed/projects/fsl/fromsvr/elftosb/elftosb2/elftosb_parser.y"
+    {
+                                                       (yyval.m_ast) = new BooleanNotExprASTNode(dynamic_cast<ExprASTNode*>((yyvsp[0].m_ast)));
+                                                       (yyval.m_ast)->setLocation((yylsp[-1]), (yylsp[0]));
+                                               ;}
+    break;
+
+  case 105:
+#line 780 "/Users/creed/projects/fsl/fromsvr/elftosb/elftosb2/elftosb_parser.y"
+    {
+                                                       (yyval.m_ast) = new SourceFileFunctionASTNode((yyvsp[-3].m_str), (yyvsp[-1].m_str));
+                                                       (yyval.m_ast)->setLocation((yylsp[-3]), (yylsp[0]));
+                                               ;}
+    break;
+
+  case 106:
+#line 785 "/Users/creed/projects/fsl/fromsvr/elftosb/elftosb2/elftosb_parser.y"
+    {
+                                                       (yyval.m_ast) = (yyvsp[-1].m_ast);
+                                                       (yyval.m_ast)->setLocation((yylsp[-2]), (yylsp[0]));
+                                               ;}
+    break;
+
+  case 107:
+#line 790 "/Users/creed/projects/fsl/fromsvr/elftosb/elftosb2/elftosb_parser.y"
+    {
+                                                       (yyval.m_ast) = new DefinedOperatorASTNode((yyvsp[-1].m_str));
+                                                       (yyval.m_ast)->setLocation((yylsp[-3]), (yylsp[0]));
+                                               ;}
+    break;
+
+  case 108:
+#line 796 "/Users/creed/projects/fsl/fromsvr/elftosb/elftosb2/elftosb_parser.y"
+    { (yyval.m_ast) = (yyvsp[0].m_ast); ;}
+    break;
+
+  case 109:
+#line 800 "/Users/creed/projects/fsl/fromsvr/elftosb/elftosb2/elftosb_parser.y"
+    {
+                                                               (yyval.m_ast) = new SymbolASTNode((yyvsp[0].m_str), (yyvsp[-2].m_str));
+                                                               (yyval.m_ast)->setLocation((yylsp[-2]), (yylsp[0]));
+                                                       ;}
+    break;
+
+  case 110:
+#line 805 "/Users/creed/projects/fsl/fromsvr/elftosb/elftosb2/elftosb_parser.y"
+    {
+                                                               (yyval.m_ast) = new SymbolASTNode((yyvsp[0].m_str));
+                                                               (yyval.m_ast)->setLocation((yylsp[-1]), (yylsp[0]));
+                                                       ;}
+    break;
+
+  case 111:
+#line 813 "/Users/creed/projects/fsl/fromsvr/elftosb/elftosb2/elftosb_parser.y"
+    {
+                                                               (yyval.m_ast) = (yyvsp[0].m_ast);
+                                                       ;}
+    break;
+
+  case 112:
+#line 817 "/Users/creed/projects/fsl/fromsvr/elftosb/elftosb2/elftosb_parser.y"
+    {
+                                                               (yyval.m_ast) = new VariableExprASTNode((yyvsp[0].m_str));
+                                                               (yyval.m_ast)->setLocation((yylsp[0]));
+                                                       ;}
+    break;
+
+  case 113:
+#line 822 "/Users/creed/projects/fsl/fromsvr/elftosb/elftosb2/elftosb_parser.y"
+    {
+                                                               (yyval.m_ast) = new SymbolRefExprASTNode(dynamic_cast<SymbolASTNode*>((yyvsp[0].m_ast)));
+                                                               (yyval.m_ast)->setLocation((yylsp[0]));
+                                                       ;}
+    break;
+
+  case 114:
+#line 833 "/Users/creed/projects/fsl/fromsvr/elftosb/elftosb2/elftosb_parser.y"
+    {
+                                                               ExprASTNode * left = dynamic_cast<ExprASTNode*>((yyvsp[-2].m_ast));
+                                                               ExprASTNode * right = dynamic_cast<ExprASTNode*>((yyvsp[0].m_ast));
+                                                               (yyval.m_ast) = new BinaryOpExprASTNode(left, BinaryOpExprASTNode::kAdd, right);
+                                                               (yyval.m_ast)->setLocation((yylsp[-2]), (yylsp[0]));
+                                                       ;}
+    break;
+
+  case 115:
+#line 840 "/Users/creed/projects/fsl/fromsvr/elftosb/elftosb2/elftosb_parser.y"
+    {
+                                                               ExprASTNode * left = dynamic_cast<ExprASTNode*>((yyvsp[-2].m_ast));
+                                                               ExprASTNode * right = dynamic_cast<ExprASTNode*>((yyvsp[0].m_ast));
+                                                               (yyval.m_ast) = new BinaryOpExprASTNode(left, BinaryOpExprASTNode::kSubtract, right);
+                                                               (yyval.m_ast)->setLocation((yylsp[-2]), (yylsp[0]));
+                                                       ;}
+    break;
+
+  case 116:
+#line 847 "/Users/creed/projects/fsl/fromsvr/elftosb/elftosb2/elftosb_parser.y"
+    {
+                                                               ExprASTNode * left = dynamic_cast<ExprASTNode*>((yyvsp[-2].m_ast));
+                                                               ExprASTNode * right = dynamic_cast<ExprASTNode*>((yyvsp[0].m_ast));
+                                                               (yyval.m_ast) = new BinaryOpExprASTNode(left, BinaryOpExprASTNode::kMultiply, right);
+                                                               (yyval.m_ast)->setLocation((yylsp[-2]), (yylsp[0]));
+                                                       ;}
+    break;
+
+  case 117:
+#line 854 "/Users/creed/projects/fsl/fromsvr/elftosb/elftosb2/elftosb_parser.y"
+    {
+                                                               ExprASTNode * left = dynamic_cast<ExprASTNode*>((yyvsp[-2].m_ast));
+                                                               ExprASTNode * right = dynamic_cast<ExprASTNode*>((yyvsp[0].m_ast));
+                                                               (yyval.m_ast) = new BinaryOpExprASTNode(left, BinaryOpExprASTNode::kDivide, right);
+                                                               (yyval.m_ast)->setLocation((yylsp[-2]), (yylsp[0]));
+                                                       ;}
+    break;
+
+  case 118:
+#line 861 "/Users/creed/projects/fsl/fromsvr/elftosb/elftosb2/elftosb_parser.y"
+    {
+                                                               ExprASTNode * left = dynamic_cast<ExprASTNode*>((yyvsp[-2].m_ast));
+                                                               ExprASTNode * right = dynamic_cast<ExprASTNode*>((yyvsp[0].m_ast));
+                                                               (yyval.m_ast) = new BinaryOpExprASTNode(left, BinaryOpExprASTNode::kModulus, right);
+                                                               (yyval.m_ast)->setLocation((yylsp[-2]), (yylsp[0]));
+                                                       ;}
+    break;
+
+  case 119:
+#line 868 "/Users/creed/projects/fsl/fromsvr/elftosb/elftosb2/elftosb_parser.y"
+    {
+                                                               ExprASTNode * left = dynamic_cast<ExprASTNode*>((yyvsp[-2].m_ast));
+                                                               ExprASTNode * right = dynamic_cast<ExprASTNode*>((yyvsp[0].m_ast));
+                                                               (yyval.m_ast) = new BinaryOpExprASTNode(left, BinaryOpExprASTNode::kPower, right);
+                                                               (yyval.m_ast)->setLocation((yylsp[-2]), (yylsp[0]));
+                                                       ;}
+    break;
+
+  case 120:
+#line 875 "/Users/creed/projects/fsl/fromsvr/elftosb/elftosb2/elftosb_parser.y"
+    {
+                                                               ExprASTNode * left = dynamic_cast<ExprASTNode*>((yyvsp[-2].m_ast));
+                                                               ExprASTNode * right = dynamic_cast<ExprASTNode*>((yyvsp[0].m_ast));
+                                                               (yyval.m_ast) = new BinaryOpExprASTNode(left, BinaryOpExprASTNode::kBitwiseAnd, right);
+                                                               (yyval.m_ast)->setLocation((yylsp[-2]), (yylsp[0]));
+                                                       ;}
+    break;
+
+  case 121:
+#line 882 "/Users/creed/projects/fsl/fromsvr/elftosb/elftosb2/elftosb_parser.y"
+    {
+                                                               ExprASTNode * left = dynamic_cast<ExprASTNode*>((yyvsp[-2].m_ast));
+                                                               ExprASTNode * right = dynamic_cast<ExprASTNode*>((yyvsp[0].m_ast));
+                                                               (yyval.m_ast) = new BinaryOpExprASTNode(left, BinaryOpExprASTNode::kBitwiseOr, right);
+                                                               (yyval.m_ast)->setLocation((yylsp[-2]), (yylsp[0]));
+                                                       ;}
+    break;
+
+  case 122:
+#line 889 "/Users/creed/projects/fsl/fromsvr/elftosb/elftosb2/elftosb_parser.y"
+    {
+                                                               ExprASTNode * left = dynamic_cast<ExprASTNode*>((yyvsp[-2].m_ast));
+                                                               ExprASTNode * right = dynamic_cast<ExprASTNode*>((yyvsp[0].m_ast));
+                                                               (yyval.m_ast) = new BinaryOpExprASTNode(left, BinaryOpExprASTNode::kBitwiseXor, right);
+                                                               (yyval.m_ast)->setLocation((yylsp[-2]), (yylsp[0]));
+                                                       ;}
+    break;
+
+  case 123:
+#line 896 "/Users/creed/projects/fsl/fromsvr/elftosb/elftosb2/elftosb_parser.y"
+    {
+                                                               ExprASTNode * left = dynamic_cast<ExprASTNode*>((yyvsp[-2].m_ast));
+                                                               ExprASTNode * right = dynamic_cast<ExprASTNode*>((yyvsp[0].m_ast));
+                                                               (yyval.m_ast) = new BinaryOpExprASTNode(left, BinaryOpExprASTNode::kShiftLeft, right);
+                                                               (yyval.m_ast)->setLocation((yylsp[-2]), (yylsp[0]));
+                                                       ;}
+    break;
+
+  case 124:
+#line 903 "/Users/creed/projects/fsl/fromsvr/elftosb/elftosb2/elftosb_parser.y"
+    {
+                                                               ExprASTNode * left = dynamic_cast<ExprASTNode*>((yyvsp[-2].m_ast));
+                                                               ExprASTNode * right = dynamic_cast<ExprASTNode*>((yyvsp[0].m_ast));
+                                                               (yyval.m_ast) = new BinaryOpExprASTNode(left, BinaryOpExprASTNode::kShiftRight, right);
+                                                               (yyval.m_ast)->setLocation((yylsp[-2]), (yylsp[0]));
+                                                       ;}
+    break;
+
+  case 125:
+#line 910 "/Users/creed/projects/fsl/fromsvr/elftosb/elftosb2/elftosb_parser.y"
+    {
+                                                               (yyval.m_ast) = (yyvsp[0].m_ast);
+                                                       ;}
+    break;
+
+  case 126:
+#line 914 "/Users/creed/projects/fsl/fromsvr/elftosb/elftosb2/elftosb_parser.y"
+    {
+                                                               (yyval.m_ast) = new IntSizeExprASTNode(dynamic_cast<ExprASTNode*>((yyvsp[-2].m_ast)), (yyvsp[0].m_int)->getWordSize());
+                                                               (yyval.m_ast)->setLocation((yylsp[-2]), (yylsp[0]));
+                                                       ;}
+    break;
+
+  case 127:
+#line 919 "/Users/creed/projects/fsl/fromsvr/elftosb/elftosb2/elftosb_parser.y"
+    {
+                                                               (yyval.m_ast) = (yyvsp[-1].m_ast);
+                                                               (yyval.m_ast)->setLocation((yylsp[-2]), (yylsp[0]));
+                                                       ;}
+    break;
+
+  case 128:
+#line 924 "/Users/creed/projects/fsl/fromsvr/elftosb/elftosb2/elftosb_parser.y"
+    {
+                                                       (yyval.m_ast) = new SizeofOperatorASTNode(dynamic_cast<SymbolASTNode*>((yyvsp[-1].m_ast)));
+                                                       (yyval.m_ast)->setLocation((yylsp[-3]), (yylsp[0]));
+                                               ;}
+    break;
+
+  case 129:
+#line 929 "/Users/creed/projects/fsl/fromsvr/elftosb/elftosb2/elftosb_parser.y"
+    {
+                                                       (yyval.m_ast) = new SizeofOperatorASTNode((yyvsp[-1].m_str));
+                                                       (yyval.m_ast)->setLocation((yylsp[-3]), (yylsp[0]));
+                                               ;}
+    break;
+
+  case 130:
+#line 934 "/Users/creed/projects/fsl/fromsvr/elftosb/elftosb2/elftosb_parser.y"
+    {
+                                                       (yyval.m_ast) = new SizeofOperatorASTNode((yyvsp[-1].m_str));
+                                                       (yyval.m_ast)->setLocation((yylsp[-3]), (yylsp[0]));
+                                               ;}
+    break;
+
+  case 131:
+#line 941 "/Users/creed/projects/fsl/fromsvr/elftosb/elftosb2/elftosb_parser.y"
+    {
+                                                               (yyval.m_ast) = (yyvsp[0].m_ast);
+                                                       ;}
+    break;
+
+  case 132:
+#line 945 "/Users/creed/projects/fsl/fromsvr/elftosb/elftosb2/elftosb_parser.y"
+    {
+                                                               (yyval.m_ast) = new NegativeExprASTNode(dynamic_cast<ExprASTNode*>((yyvsp[0].m_ast)));
+                                                               (yyval.m_ast)->setLocation((yylsp[-1]), (yylsp[0]));
+                                                       ;}
+    break;
+
+  case 133:
+#line 952 "/Users/creed/projects/fsl/fromsvr/elftosb/elftosb2/elftosb_parser.y"
+    {
+                                                               (yyval.m_ast) = new IntConstExprASTNode((yyvsp[0].m_int)->getValue(), (yyvsp[0].m_int)->getWordSize());
+                                                               (yyval.m_ast)->setLocation((yylsp[0]));
+                                                       ;}
+    break;
+
+
+      default: break;
+    }
+
+/* Line 1126 of yacc.c.  */
+#line 2663 "/Users/creed/projects/fsl/fromsvr/elftosb/build/elftosb.build/Debug/elftosb.build/DerivedSources/elftosb_parser.tab.cpp"
+\f
+  yyvsp -= yylen;
+  yyssp -= yylen;
+  yylsp -= yylen;
+
+  YY_STACK_PRINT (yyss, yyssp);
+
+  *++yyvsp = yyval;
+  *++yylsp = yyloc;
+
+  /* Now `shift' the result of the reduction.  Determine what state
+     that goes to, based on the state we popped back to and the rule
+     number reduced by.  */
+
+  yyn = yyr1[yyn];
+
+  yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
+  if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
+    yystate = yytable[yystate];
+  else
+    yystate = yydefgoto[yyn - YYNTOKENS];
+
+  goto yynewstate;
+
+
+/*------------------------------------.
+| yyerrlab -- here on detecting error |
+`------------------------------------*/
+yyerrlab:
+  /* If not already recovering from an error, report this error.  */
+  if (!yyerrstatus)
+    {
+      ++yynerrs;
+#if YYERROR_VERBOSE
+      yyn = yypact[yystate];
+
+      if (YYPACT_NINF < yyn && yyn < YYLAST)
+       {
+         int yytype = YYTRANSLATE (yychar);
+         YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
+         YYSIZE_T yysize = yysize0;
+         YYSIZE_T yysize1;
+         int yysize_overflow = 0;
+         char *yymsg = 0;
+#        define YYERROR_VERBOSE_ARGS_MAXIMUM 5
+         char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
+         int yyx;
+
+#if 0
+         /* This is so xgettext sees the translatable formats that are
+            constructed on the fly.  */
+         YY_("syntax error, unexpected %s");
+         YY_("syntax error, unexpected %s, expecting %s");
+         YY_("syntax error, unexpected %s, expecting %s or %s");
+         YY_("syntax error, unexpected %s, expecting %s or %s or %s");
+         YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
+#endif
+         char *yyfmt;
+         char const *yyf;
+         static char const yyunexpected[] = "syntax error, unexpected %s";
+         static char const yyexpecting[] = ", expecting %s";
+         static char const yyor[] = " or %s";
+         char yyformat[sizeof yyunexpected
+                       + sizeof yyexpecting - 1
+                       + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
+                          * (sizeof yyor - 1))];
+         char const *yyprefix = yyexpecting;
+
+         /* Start YYX at -YYN if negative to avoid negative indexes in
+            YYCHECK.  */
+         int yyxbegin = yyn < 0 ? -yyn : 0;
+
+         /* Stay within bounds of both yycheck and yytname.  */
+         int yychecklim = YYLAST - yyn;
+         int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
+         int yycount = 1;
+
+         yyarg[0] = yytname[yytype];
+         yyfmt = yystpcpy (yyformat, yyunexpected);
+
+         for (yyx = yyxbegin; yyx < yyxend; ++yyx)
+           if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
+             {
+               if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
+                 {
+                   yycount = 1;
+                   yysize = yysize0;
+                   yyformat[sizeof yyunexpected - 1] = '\0';
+                   break;
+                 }
+               yyarg[yycount++] = yytname[yyx];
+               yysize1 = yysize + yytnamerr (0, yytname[yyx]);
+               yysize_overflow |= yysize1 < yysize;
+               yysize = yysize1;
+               yyfmt = yystpcpy (yyfmt, yyprefix);
+               yyprefix = yyor;
+             }
+
+         yyf = YY_(yyformat);
+         yysize1 = yysize + yystrlen (yyf);
+         yysize_overflow |= yysize1 < yysize;
+         yysize = yysize1;
+
+         if (!yysize_overflow && yysize <= YYSTACK_ALLOC_MAXIMUM)
+           yymsg = (char *) YYSTACK_ALLOC (yysize);
+         if (yymsg)
+           {
+             /* Avoid sprintf, as that infringes on the user's name space.
+                Don't have undefined behavior even if the translation
+                produced a string with the wrong number of "%s"s.  */
+             char *yyp = yymsg;
+             int yyi = 0;
+             while ((*yyp = *yyf))
+               {
+                 if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
+                   {
+                     yyp += yytnamerr (yyp, yyarg[yyi++]);
+                     yyf += 2;
+                   }
+                 else
+                   {
+                     yyp++;
+                     yyf++;
+                   }
+               }
+             yyerror (&yylloc, lexer, resultAST, yymsg);
+             YYSTACK_FREE (yymsg);
+           }
+         else
+           {
+             yyerror (&yylloc, lexer, resultAST, YY_("syntax error"));
+             goto yyexhaustedlab;
+           }
+       }
+      else
+#endif /* YYERROR_VERBOSE */
+       yyerror (&yylloc, lexer, resultAST, YY_("syntax error"));
+    }
+
+  yyerror_range[0] = yylloc;
+
+  if (yyerrstatus == 3)
+    {
+      /* If just tried and failed to reuse look-ahead token after an
+        error, discard it.  */
+
+      if (yychar <= YYEOF)
+        {
+         /* Return failure if at end of input.  */
+         if (yychar == YYEOF)
+           YYABORT;
+        }
+      else
+       {
+         yydestruct ("Error: discarding", yytoken, &yylval, &yylloc);
+         yychar = YYEMPTY;
+       }
+    }
+
+  /* Else will try to reuse look-ahead token after shifting the error
+     token.  */
+  goto yyerrlab1;
+
+
+/*---------------------------------------------------.
+| yyerrorlab -- error raised explicitly by YYERROR.  |
+`---------------------------------------------------*/
+yyerrorlab:
+
+  /* Pacify compilers like GCC when the user code never invokes
+     YYERROR and the label yyerrorlab therefore never appears in user
+     code.  */
+  if (0)
+     goto yyerrorlab;
+
+  yyerror_range[0] = yylsp[1-yylen];
+  yylsp -= yylen;
+  yyvsp -= yylen;
+  yyssp -= yylen;
+  yystate = *yyssp;
+  goto yyerrlab1;
+
+
+/*-------------------------------------------------------------.
+| yyerrlab1 -- common code for both syntax error and YYERROR.  |
+`-------------------------------------------------------------*/
+yyerrlab1:
+  yyerrstatus = 3;     /* Each real token shifted decrements this.  */
+
+  for (;;)
+    {
+      yyn = yypact[yystate];
+      if (yyn != YYPACT_NINF)
+       {
+         yyn += YYTERROR;
+         if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
+           {
+             yyn = yytable[yyn];
+             if (0 < yyn)
+               break;
+           }
+       }
+
+      /* Pop the current state because it cannot handle the error token.  */
+      if (yyssp == yyss)
+       YYABORT;
+
+      yyerror_range[0] = *yylsp;
+      yydestruct ("Error: popping", yystos[yystate], yyvsp, yylsp);
+      YYPOPSTACK;
+      yystate = *yyssp;
+      YY_STACK_PRINT (yyss, yyssp);
+    }
+
+  if (yyn == YYFINAL)
+    YYACCEPT;
+
+  *++yyvsp = yylval;
+
+  yyerror_range[1] = yylloc;
+  /* Using YYLLOC is tempting, but would change the location of
+     the look-ahead.  YYLOC is available though. */
+  YYLLOC_DEFAULT (yyloc, yyerror_range - 1, 2);
+  *++yylsp = yyloc;
+
+  /* Shift the error token. */
+  YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
+
+  yystate = yyn;
+  goto yynewstate;
+
+
+/*-------------------------------------.
+| yyacceptlab -- YYACCEPT comes here.  |
+`-------------------------------------*/
+yyacceptlab:
+  yyresult = 0;
+  goto yyreturn;
+
+/*-----------------------------------.
+| yyabortlab -- YYABORT comes here.  |
+`-----------------------------------*/
+yyabortlab:
+  yyresult = 1;
+  goto yyreturn;
+
+#ifndef yyoverflow
+/*-------------------------------------------------.
+| yyexhaustedlab -- memory exhaustion comes here.  |
+`-------------------------------------------------*/
+yyexhaustedlab:
+  yyerror (&yylloc, lexer, resultAST, YY_("memory exhausted"));
+  yyresult = 2;
+  /* Fall through.  */
+#endif
+
+yyreturn:
+  if (yychar != YYEOF && yychar != YYEMPTY)
+     yydestruct ("Cleanup: discarding lookahead",
+                yytoken, &yylval, &yylloc);
+  while (yyssp != yyss)
+    {
+      yydestruct ("Cleanup: popping",
+                 yystos[*yyssp], yyvsp, yylsp);
+      YYPOPSTACK;
+    }
+#ifndef yyoverflow
+  if (yyss != yyssa)
+    YYSTACK_FREE (yyss);
+#endif
+  return yyresult;
+}
+
+
+#line 958 "/Users/creed/projects/fsl/fromsvr/elftosb/elftosb2/elftosb_parser.y"
+
+
+/* code goes here */
+
+static int yylex(YYSTYPE * lvalp, YYLTYPE * yylloc, ElftosbLexer * lexer)
+{
+       int token = lexer->yylex();
+       *yylloc = lexer->getLocation();
+       lexer->getSymbolValue(lvalp);
+       return token;
+}
+
+static void yyerror(YYLTYPE * yylloc, ElftosbLexer * lexer, CommandFileASTNode ** resultAST, const char * error)
+{
+       throw syntax_error(format_string("line %d: %s\n", yylloc->m_firstLine, error));
+}
+
+
diff --git a/tools/elftosb/elftosb2/elftosb_parser.tab.hpp b/tools/elftosb/elftosb2/elftosb_parser.tab.hpp
new file mode 100644 (file)
index 0000000..4ee45c4
--- /dev/null
@@ -0,0 +1,152 @@
+/* A Bison parser, made by GNU Bison 2.1.  */
+
+/* Skeleton parser for Yacc-like parsing with Bison,
+   Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, 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, or (at your option)
+   any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You 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.  */
+
+/* As a special exception, when this file is copied by Bison into a
+   Bison output file, you may use that output file without restriction.
+   This special exception was added by the Free Software Foundation
+   in version 1.24 of Bison.  */
+
+/* Tokens.  */
+#ifndef YYTOKENTYPE
+# define YYTOKENTYPE
+   /* Put the tokens into the symbol table, so that GDB and other debuggers
+      know about them.  */
+   enum yytokentype {
+     TOK_IDENT = 258,
+     TOK_STRING_LITERAL = 259,
+     TOK_INT_LITERAL = 260,
+     TOK_SECTION_NAME = 261,
+     TOK_SOURCE_NAME = 262,
+     TOK_BLOB = 263,
+     TOK_DOT_DOT = 264,
+     TOK_AND = 265,
+     TOK_OR = 266,
+     TOK_GEQ = 267,
+     TOK_LEQ = 268,
+     TOK_EQ = 269,
+     TOK_NEQ = 270,
+     TOK_POWER = 271,
+     TOK_LSHIFT = 272,
+     TOK_RSHIFT = 273,
+     TOK_INT_SIZE = 274,
+     TOK_OPTIONS = 275,
+     TOK_CONSTANTS = 276,
+     TOK_SOURCES = 277,
+     TOK_FILTERS = 278,
+     TOK_SECTION = 279,
+     TOK_EXTERN = 280,
+     TOK_FROM = 281,
+     TOK_RAW = 282,
+     TOK_LOAD = 283,
+     TOK_JUMP = 284,
+     TOK_CALL = 285,
+     TOK_MODE = 286,
+     TOK_IF = 287,
+     TOK_ELSE = 288,
+     TOK_DEFINED = 289,
+     TOK_INFO = 290,
+     TOK_WARNING = 291,
+     TOK_ERROR = 292,
+     TOK_SIZEOF = 293,
+     TOK_DCD = 294,
+     TOK_HAB = 295,
+     TOK_IVT = 296,
+     UNARY_OP = 297
+   };
+#endif
+/* Tokens.  */
+#define TOK_IDENT 258
+#define TOK_STRING_LITERAL 259
+#define TOK_INT_LITERAL 260
+#define TOK_SECTION_NAME 261
+#define TOK_SOURCE_NAME 262
+#define TOK_BLOB 263
+#define TOK_DOT_DOT 264
+#define TOK_AND 265
+#define TOK_OR 266
+#define TOK_GEQ 267
+#define TOK_LEQ 268
+#define TOK_EQ 269
+#define TOK_NEQ 270
+#define TOK_POWER 271
+#define TOK_LSHIFT 272
+#define TOK_RSHIFT 273
+#define TOK_INT_SIZE 274
+#define TOK_OPTIONS 275
+#define TOK_CONSTANTS 276
+#define TOK_SOURCES 277
+#define TOK_FILTERS 278
+#define TOK_SECTION 279
+#define TOK_EXTERN 280
+#define TOK_FROM 281
+#define TOK_RAW 282
+#define TOK_LOAD 283
+#define TOK_JUMP 284
+#define TOK_CALL 285
+#define TOK_MODE 286
+#define TOK_IF 287
+#define TOK_ELSE 288
+#define TOK_DEFINED 289
+#define TOK_INFO 290
+#define TOK_WARNING 291
+#define TOK_ERROR 292
+#define TOK_SIZEOF 293
+#define TOK_DCD 294
+#define TOK_HAB 295
+#define TOK_IVT 296
+#define UNARY_OP 297
+
+
+
+
+#if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
+#line 58 "/Users/creed/projects/fsl/fromsvr/elftosb/elftosb2/elftosb_parser.y"
+typedef union YYSTYPE {
+       int m_num;
+       elftosb::SizedIntegerValue * m_int;
+       Blob * m_blob;
+       std::string * m_str;
+       elftosb::ASTNode * m_ast;       // must use full name here because this is put into *.tab.hpp
+} YYSTYPE;
+/* Line 1447 of yacc.c.  */
+#line 130 "/Users/creed/projects/fsl/fromsvr/elftosb/build/elftosb.build/Debug/elftosb.build/DerivedSources/elftosb_parser.tab.hpp"
+# define yystype YYSTYPE /* obsolescent; will be withdrawn */
+# define YYSTYPE_IS_DECLARED 1
+# define YYSTYPE_IS_TRIVIAL 1
+#endif
+
+
+
+#if ! defined (YYLTYPE) && ! defined (YYLTYPE_IS_DECLARED)
+typedef struct YYLTYPE
+{
+  int first_line;
+  int first_column;
+  int last_line;
+  int last_column;
+} YYLTYPE;
+# define yyltype YYLTYPE /* obsolescent; will be withdrawn */
+# define YYLTYPE_IS_DECLARED 1
+# define YYLTYPE_IS_TRIVIAL 1
+#endif
+
+
+
+
diff --git a/tools/elftosb/elftosb2/elftosb_parser.y b/tools/elftosb/elftosb2/elftosb_parser.y
new file mode 100644 (file)
index 0000000..7c33652
--- /dev/null
@@ -0,0 +1,978 @@
+/*
+ * Copyright (c) Freescale Semiconductor, Inc. All rights reserved.
+ * See included license file for license details.
+ */
+
+/* write header with token defines */
+%defines
+
+/* make it reentrant */
+%pure-parser
+
+/* put more info in error messages */
+%error-verbose
+
+/* enable location processing */
+%locations
+
+%{
+#include "ElftosbLexer.h"
+#include "ElftosbAST.h"
+#include "Logging.h"
+#include "Blob.h"
+#include "format_string.h"
+#include "Value.h"
+#include "ConversionController.h"
+
+using namespace elftosb;
+
+//! Our special location type.
+#define YYLTYPE token_loc_t
+
+// this indicates that we're using our own type. it should be unset automatically
+// but that's not working for some reason with the .hpp file.
+#if defined(YYLTYPE_IS_TRIVIAL)
+       #undef YYLTYPE_IS_TRIVIAL
+       #define YYLTYPE_IS_TRIVIAL 0
+#endif
+
+//! Default location action
+#define YYLLOC_DEFAULT(Current, Rhs, N)        \
+       do {            \
+               if (N)  \
+               {               \
+                       (Current).m_firstLine = YYRHSLOC(Rhs, 1).m_firstLine;   \
+                       (Current).m_lastLine = YYRHSLOC(Rhs, N).m_lastLine;             \
+               }               \
+               else    \
+               {               \
+                       (Current).m_firstLine = (Current).m_lastLine = YYRHSLOC(Rhs, 0).m_lastLine;     \
+               }               \
+       } while (0)
+
+//! Forward declaration of yylex().
+static int yylex(YYSTYPE * lvalp, YYLTYPE * yylloc, ElftosbLexer * lexer);
+
+// Forward declaration of error handling function.
+static void yyerror(YYLTYPE * yylloc, ElftosbLexer * lexer, CommandFileASTNode ** resultAST, const char * error);
+
+%}
+
+/* symbol types */
+%union {
+       int m_num;
+       elftosb::SizedIntegerValue * m_int;
+       Blob * m_blob;
+       std::string * m_str;
+       elftosb::ASTNode * m_ast;       // must use full name here because this is put into *.tab.hpp
+}
+
+/* extra parameters for the parser and lexer */
+%parse-param   {ElftosbLexer * lexer}
+%parse-param   {CommandFileASTNode ** resultAST}
+%lex-param             {ElftosbLexer * lexer}
+
+/* token definitions */
+%token <m_str> TOK_IDENT                       "identifier"
+%token <m_str> TOK_STRING_LITERAL      "string"
+%token <m_int> TOK_INT_LITERAL         "integer"
+%token <m_str> TOK_SECTION_NAME                "section name"
+%token <m_str> TOK_SOURCE_NAME         "source name"
+%token <m_blob> TOK_BLOB                       "binary object"
+%token '('
+%token ')'
+%token '{'
+%token '}'
+%token '['
+%token ']'
+%token '='
+%token ','
+%token ';'
+%token ':'
+%token '>'
+%token '.'
+%token TOK_DOT_DOT                             ".."
+%token '~'
+%token '&'
+%token '|'
+%token '<'
+%token '>'
+%token '!'
+%token TOK_AND                                 "&&"
+%token TOK_OR                                  "||"
+%token TOK_GEQ                                 ">="
+%token TOK_LEQ                                 "<="
+%token TOK_EQ                                  "=="
+%token TOK_NEQ                                 "!="
+%token TOK_POWER                               "**"
+%token TOK_LSHIFT                              "<<"
+%token TOK_RSHIFT                              ">>"
+%token <m_int> TOK_INT_SIZE            "integer size"
+%token TOK_OPTIONS             "options"
+%token TOK_CONSTANTS   "constants"
+%token TOK_SOURCES             "sources"
+%token TOK_FILTERS             "filters"
+%token TOK_SECTION             "section"
+%token TOK_EXTERN              "extern"
+%token TOK_FROM                        "from"
+%token TOK_RAW                 "raw"
+%token TOK_LOAD                        "load"
+%token TOK_JUMP                        "jump"
+%token TOK_CALL                        "call"
+%token TOK_MODE                        "mode"
+%token TOK_IF                  "if"
+%token TOK_ELSE                        "else"
+%token TOK_DEFINED             "defined"
+%token TOK_INFO                        "info"
+%token TOK_WARNING             "warning"
+%token TOK_ERROR               "error"
+%token TOK_SIZEOF              "sizeof"
+%token TOK_DCD                 "dcd"
+%token TOK_HAB                 "hab"
+%token TOK_IVT                 "ivt"
+
+/* operator precedence */
+%left "&&" "||"
+%left '>' '<' ">=" "<=" "==" "!="
+%left '|'
+%left '^'
+%left '&'
+%left "<<" ">>"
+%left "**"
+%left '+' '-'
+%left '*' '/' '%'
+%left '.'
+%right UNARY_OP
+
+/* nonterminal types - most nonterminal symbols are subclasses of ASTNode */
+%type <m_ast> command_file blocks_list pre_section_block options_block const_def_list const_def_list_elem
+%type <m_ast> const_def const_expr expr int_const_expr unary_expr int_value constants_block
+%type <m_ast> sources_block source_def_list source_def_list_elem source_def
+%type <m_ast> section_defs section_def section_contents full_stmt_list full_stmt_list_elem
+%type <m_ast> basic_stmt load_stmt call_stmt from_stmt load_data load_target call_target
+%type <m_ast> address_or_range load_target_opt call_arg_opt basic_stmt_list basic_stmt_list_elem
+%type <m_ast> source_attr_list source_attr_list_elem source_attrs_opt
+%type <m_ast> section_list section_list_elem symbol_ref mode_stmt
+%type <m_ast> section_options_opt source_attr_list_opt
+%type <m_ast> if_stmt else_opt message_stmt
+%type <m_ast> bool_expr ivt_def assignment_list_opt
+
+%type <m_num> call_or_jump dcd_opt
+
+%destructor { delete $$; } TOK_IDENT TOK_STRING_LITERAL TOK_SECTION_NAME TOK_SOURCE_NAME TOK_BLOB TOK_INT_SIZE TOK_INT_LITERAL
+
+%%
+
+command_file   :       blocks_list section_defs
+                                               {
+                                                       CommandFileASTNode * commandFile = new CommandFileASTNode();
+                                                       commandFile->setBlocks(dynamic_cast<ListASTNode*>($1));
+                                                       commandFile->setSections(dynamic_cast<ListASTNode*>($2));
+                                                       commandFile->setLocation(@1, @2);
+                                                       *resultAST = commandFile;
+                                               }
+                               ;
+
+blocks_list            :       pre_section_block
+                                               {
+                                                       ListASTNode * list = new ListASTNode();
+                                                       list->appendNode($1);
+                                                       $$ = list;
+                                               }
+                               |       blocks_list pre_section_block
+                                               {
+                                                       dynamic_cast<ListASTNode*>($1)->appendNode($2);
+                                                       $$ = $1;
+                                               }
+                               ;
+
+pre_section_block
+                               :       options_block                   { $$ = $1; }
+                               |       constants_block                 { $$ = $1; }
+                               |       sources_block                   { $$ = $1; }
+                               ;
+
+options_block          :       "options" '{' const_def_list '}'
+                                                       {
+                                                               $$ = new OptionsBlockASTNode(dynamic_cast<ListASTNode *>($3));
+                                                       }
+                                       ;
+
+constants_block                :       "constants" '{' const_def_list '}'
+                                                       {
+                                                               $$ = new ConstantsBlockASTNode(dynamic_cast<ListASTNode *>($3));
+                                                       }
+                                       ;
+
+const_def_list         :       const_def_list_elem
+                                                       {
+                                                               ListASTNode * list = new ListASTNode();
+                                                               list->appendNode($1);
+                                                               $$ = list;
+                                                       }
+                                       |       const_def_list const_def_list_elem
+                                                       {
+                                                               dynamic_cast<ListASTNode*>($1)->appendNode($2);
+                                                               $$ = $1;
+                                                       }
+                                       ;
+
+const_def_list_elem    :       const_def ';'           { $$ = $1; }
+                                       |       /* empty */                     { $$ = NULL; }
+                                       ;
+
+const_def                      :       TOK_IDENT '=' const_expr
+                                                       {
+                                                               $$ = new AssignmentASTNode($1, $3);
+                                                               $$->setLocation(@1, @3);
+                                                       }
+                                       ;
+
+sources_block  :       "sources" '{' source_def_list '}'
+                                               {
+                                                       $$ = new SourcesBlockASTNode(dynamic_cast<ListASTNode *>($3));
+                                               }
+                               ;
+
+source_def_list        :       source_def_list_elem
+                                               {
+                                                       ListASTNode * list = new ListASTNode();
+                                                       list->appendNode($1);
+                                                       $$ = list;
+                                               }
+                               |       source_def_list source_def_list_elem
+                                               {
+                                                       dynamic_cast<ListASTNode*>($1)->appendNode($2);
+                                                       $$ = $1;
+                                               }
+                               ;
+
+source_def_list_elem
+                               :               source_def source_attrs_opt ';'
+                                                       {
+                                                               // tell the lexer that this is the name of a source file
+                                                               SourceDefASTNode * node = dynamic_cast<SourceDefASTNode*>($1);
+                                                               if ($2)
+                                                               {
+                                                                       node->setAttributes(dynamic_cast<ListASTNode*>($2));
+                                                               }
+                                                               node->setLocation(node->getLocation(), @3);
+                                                               lexer->addSourceName(node->getName());
+                                                               $$ = $1;
+                                                       }
+                               |               /* empty */             { $$ = NULL; }
+                               ;
+
+source_def             :               TOK_IDENT '=' TOK_STRING_LITERAL
+                                                       {
+                                                               $$ = new PathSourceDefASTNode($1, $3);
+                                                               $$->setLocation(@1, @3);
+                                                       }
+                               |               TOK_IDENT '=' "extern" '(' int_const_expr ')'
+                                                       {
+                                                               $$ = new ExternSourceDefASTNode($1, dynamic_cast<ExprASTNode*>($5));
+                                                               $$->setLocation(@1, @6);
+                                                       }
+                               ;
+
+source_attrs_opt
+                               :               '(' source_attr_list ')'                { $$ = $2; }
+                               |               /* empty */                                             { $$ = NULL; }
+                               ;
+
+source_attr_list
+                               :               source_attr_list_elem
+                                                       {
+                                                               ListASTNode * list = new ListASTNode();
+                                                               list->appendNode($1);
+                                                               $$ = list;
+                                                       }
+                               |               source_attr_list ',' source_attr_list_elem
+                                                       {
+                                                               dynamic_cast<ListASTNode*>($1)->appendNode($3);
+                                                               $$ = $1;
+                                                       }
+                               ;
+                                               
+source_attr_list_elem
+                               :               TOK_IDENT '=' const_expr
+                                                       {
+                                                               $$ = new AssignmentASTNode($1, $3);
+                                                               $$->setLocation(@1, @3);
+                                                       }
+                               ;
+
+section_defs   :               section_def
+                                                       {
+                                                               ListASTNode * list = new ListASTNode();
+                                                               list->appendNode($1);
+                                                               $$ = list;
+                                                       }
+                               |               section_defs section_def
+                                                       {
+                                                               dynamic_cast<ListASTNode*>($1)->appendNode($2);
+                                                               $$ = $1;
+                                                       }
+                               ;
+
+section_def            :               "section" '(' int_const_expr section_options_opt ')' section_contents
+                                                       {
+                                                               SectionContentsASTNode * sectionNode = dynamic_cast<SectionContentsASTNode*>($6);
+                                                               if (sectionNode)
+                                                               {
+                                                                       ExprASTNode * exprNode = dynamic_cast<ExprASTNode*>($3);
+                                                                       sectionNode->setSectionNumberExpr(exprNode);
+                                                                       sectionNode->setOptions(dynamic_cast<ListASTNode*>($4));
+                                                                       sectionNode->setLocation(@1, sectionNode->getLocation());
+                                                               }
+                                                               $$ = $6;
+                                                       }
+                               ;
+
+section_options_opt
+                               :               ';' source_attr_list_opt
+                                                       {
+                                                               $$ = $2;
+                                                       }
+                               |               /* empty */
+                                                       {
+                                                               $$ = NULL;
+                                                       }
+                               ;
+
+source_attr_list_opt
+                               :               source_attr_list
+                                                       {
+                                                               $$ = $1;
+                                                       }
+                               |               /* empty */
+                                                       {
+                                                               $$ = NULL;
+                                                       }
+                               ;
+
+section_contents
+                               :               "<=" load_data ';'
+                                                       {
+                                                               DataSectionContentsASTNode * dataSection = new DataSectionContentsASTNode($2);
+                                                               dataSection->setLocation(@1, @3);
+                                                               $$ = dataSection;
+                                                       }
+                               |               '{' full_stmt_list '}'
+                                                       {
+                                                               ListASTNode * listNode = dynamic_cast<ListASTNode*>($2);
+                                                               $$ = new BootableSectionContentsASTNode(listNode);
+                                                               $$->setLocation(@1, @3);
+                                                       }
+                               ;
+
+full_stmt_list :               full_stmt_list_elem
+                                                       {
+                                                               ListASTNode * list = new ListASTNode();
+                                                               list->appendNode($1);
+                                                               $$ = list;
+                                                       }
+                               |               full_stmt_list full_stmt_list_elem
+                                                       {
+                                                               dynamic_cast<ListASTNode*>($1)->appendNode($2);
+                                                               $$ = $1;
+                                                       }
+                               ;
+
+full_stmt_list_elem
+                               :               basic_stmt ';'          { $$ = $1; }
+                               |               from_stmt                       { $$ = $1; }
+                               |               if_stmt                         { $$ = $1; }
+                               |               /* empty */                     { $$ = NULL; }
+                               ;
+
+basic_stmt_list        :               basic_stmt_list_elem
+                                                       {
+                                                               ListASTNode * list = new ListASTNode();
+                                                               list->appendNode($1);
+                                                               $$ = list;
+                                                       }
+                               |               basic_stmt_list basic_stmt_list_elem
+                                                       {
+                                                               dynamic_cast<ListASTNode*>($1)->appendNode($2);
+                                                               $$ = $1;
+                                                       }
+                               ;
+
+basic_stmt_list_elem
+                               :               basic_stmt ';'          { $$ = $1; }
+                               |               if_stmt                         { $$ = $1; }
+                               |               /* empty */                     { $$ = NULL; }
+                               ;
+
+basic_stmt             :               load_stmt               { $$ = $1; }
+                               |               call_stmt               { $$ = $1; }
+                               |               mode_stmt               { $$ = $1; }
+                               |               message_stmt    { $$ = $1; }
+                               ;
+
+load_stmt              :               "load" dcd_opt load_data load_target_opt
+                                                       {
+                                                               LoadStatementASTNode * stmt = new LoadStatementASTNode();
+                                                               stmt->setData($3);
+                                                               stmt->setTarget($4);
+                                                               // set dcd load flag if the "dcd" keyword was present.
+                                                               if ($2)
+                                                               {
+                                                                       stmt->setDCDLoad(true);
+                                                               }
+                                                               // set char locations for the statement
+                                                               if ($4)
+                                                               {
+                                                                       stmt->setLocation(@1, @4);
+                                                               }
+                                                               else
+                                                               {
+                                                                       stmt->setLocation(@1, @3);
+                                                               }
+                                                               $$ = stmt;
+                                                       }
+                               ;
+
+dcd_opt                        :               "dcd"
+                                                       {
+                                                               if (!elftosb::g_enableHABSupport)
+                                                               {
+                                                                       yyerror(&yylloc, lexer, resultAST, "HAB features not supported with the selected family");
+                                                                       YYABORT;
+                                                               }
+                                                               
+                                                               $$ = 1;
+                                                       }
+                               |               /* empty */                     { $$ = 0; }
+
+load_data              :               int_const_expr
+                                                       {
+                                                               $$ = $1;
+                                                       }
+                               |               TOK_STRING_LITERAL
+                                                       {
+                                                               $$ = new StringConstASTNode($1);
+                                                               $$->setLocation(@1);
+                                                       }
+                               |               TOK_SOURCE_NAME
+                                                       {
+                                                               $$ = new SourceASTNode($1);
+                                                               $$->setLocation(@1);
+                                                       }
+                               |               section_list
+                                                       {
+                                                               $$ = new SectionMatchListASTNode(dynamic_cast<ListASTNode*>($1));
+                                                               $$->setLocation(@1);
+                                                       }
+                               |               section_list "from" TOK_SOURCE_NAME
+                                                       {
+                                                               $$ = new SectionMatchListASTNode(dynamic_cast<ListASTNode*>($1), $3);
+                                                               $$->setLocation(@1, @3);
+                                                       }
+                               |               TOK_SOURCE_NAME '[' section_list ']'
+                                                       {
+                                                               $$ = new SectionMatchListASTNode(dynamic_cast<ListASTNode*>($3), $1);
+                                                               $$->setLocation(@1, @4);
+                                                       }
+                               |               TOK_BLOB
+                                                       {
+                                                               $$ = new BlobConstASTNode($1);
+                                                               $$->setLocation(@1);
+                                                       }
+                               |               ivt_def
+                                                       {
+                                                       }
+                               ;
+
+section_list   :               section_list_elem
+                                                       {
+                                                               ListASTNode * list = new ListASTNode();
+                                                               list->appendNode($1);
+                                                               $$ = list;
+                                                       }
+                               |               section_list ',' section_list_elem
+                                                       {
+                                                               dynamic_cast<ListASTNode*>($1)->appendNode($3);
+                                                               $$ = $1;
+                                                       }
+                               ;
+
+section_list_elem
+                               :               TOK_SECTION_NAME
+                                                       {
+                                                               $$ = new SectionASTNode($1, SectionASTNode::kInclude);
+                                                               $$->setLocation(@1);
+                                                       }
+                               |               '~' TOK_SECTION_NAME
+                                                       {
+                                                               $$ = new SectionASTNode($2, SectionASTNode::kExclude);
+                                                               $$->setLocation(@1, @2);
+                                                       }
+                               ;
+
+load_target_opt        :               '>' load_target
+                                                       {
+                                                               $$ = $2;
+                                                       }
+                               |               /* empty */
+                                                       {
+                                                               $$ = new NaturalLocationASTNode();
+//                                                             $$->setLocation();
+                                                       }
+                               ;
+
+load_target            :               '.'
+                                                       {
+                                                               $$ = new NaturalLocationASTNode();
+                                                               $$->setLocation(@1);
+                                                       }
+                               |               address_or_range
+                                                       {
+                                                               $$ = $1;
+                                                       }
+                               ;
+
+ivt_def                        :               "ivt" '(' assignment_list_opt ')'
+                                                       {
+                                                               IVTConstASTNode * ivt = new IVTConstASTNode();
+                                                               if ($3)
+                                                               {
+                                                                       ivt->setFieldAssignments(dynamic_cast<ListASTNode*>($3));
+                                                               }
+                                                               ivt->setLocation(@1, @4);
+                                                               $$ = ivt;
+                                                       }
+                               ;
+
+assignment_list_opt    :       source_attr_list                { $$ = $1; }
+                                       |       /* empty */                             { $$ = NULL; }
+                                       ;
+
+call_stmt              :               call_or_jump call_target call_arg_opt
+                                                       {
+                                                               CallStatementASTNode * stmt = new CallStatementASTNode();
+                                                               switch ($1)
+                                                               {
+                                                                       case 1:
+                                                                               stmt->setCallType(CallStatementASTNode::kCallType);
+                                                                               break;
+                                                                       case 2:
+                                                                               stmt->setCallType(CallStatementASTNode::kJumpType);
+                                                                               break;
+                                                                       default:
+                                                                               yyerror(&yylloc, lexer, resultAST, "invalid call_or_jump value");
+                                                                               YYABORT;
+                                                                               break;
+                                                               }
+                                                               stmt->setTarget($2);
+                                                               stmt->setArgument($3);
+                                                               stmt->setIsHAB(false);
+                                                               if ($3)
+                                                               {
+                                                                       stmt->setLocation(@1, @3);
+                                                               }
+                                                               else
+                                                               {
+                                                                       stmt->setLocation(@1, @2);
+                                                               }
+                                                               $$ = stmt;
+                                                       }
+                               |               "hab" call_or_jump address_or_range call_arg_opt
+                                                       {
+                                                               if (!elftosb::g_enableHABSupport)
+                                                               {
+                                                                       yyerror(&yylloc, lexer, resultAST, "HAB features not supported with the selected family");
+                                                                       YYABORT;
+                                                               }
+                                                               
+                                                               CallStatementASTNode * stmt = new CallStatementASTNode();
+                                                               switch ($2)
+                                                               {
+                                                                       case 1:
+                                                                               stmt->setCallType(CallStatementASTNode::kCallType);
+                                                                               break;
+                                                                       case 2:
+                                                                               stmt->setCallType(CallStatementASTNode::kJumpType);
+                                                                               break;
+                                                                       default:
+                                                                               yyerror(&yylloc, lexer, resultAST, "invalid call_or_jump value");
+                                                                               YYABORT;
+                                                                               break;
+                                                               }
+                                                               stmt->setTarget($3);
+                                                               stmt->setArgument($4);
+                                                               stmt->setIsHAB(true);
+                                                               if ($4)
+                                                               {
+                                                                       stmt->setLocation(@1, @4);
+                                                               }
+                                                               else
+                                                               {
+                                                                       stmt->setLocation(@1, @3);
+                                                               }
+                                                               $$ = stmt;
+                                                       }
+                               ;
+
+call_or_jump   :               "call"          { $$ = 1; }
+                               |               "jump"          { $$ = 2; }
+                               ;
+
+call_target            :               TOK_SOURCE_NAME
+                                                       {
+                                                               $$ = new SymbolASTNode(NULL, $1);
+                                                               $$->setLocation(@1);
+                                                       }
+                               |               int_const_expr
+                                                       {
+                                                               $$ = new AddressRangeASTNode($1, NULL);
+                                                               $$->setLocation($1);
+                                                       }
+                               ;
+
+call_arg_opt   :               '(' int_const_expr ')'          { $$ = $2; }
+                               |               '(' ')'                                         { $$ = NULL; }
+                               |               /* empty */                                     { $$ = NULL; }
+                               ;
+
+from_stmt              :               "from" TOK_SOURCE_NAME '{' basic_stmt_list '}'
+                                                       {
+                                                               $$ = new FromStatementASTNode($2, dynamic_cast<ListASTNode*>($4));
+                                                               $$->setLocation(@1, @5);
+                                                       }
+                               ;
+
+mode_stmt              :               "mode" int_const_expr
+                                                       {
+                                                               $$ = new ModeStatementASTNode(dynamic_cast<ExprASTNode*>($2));
+                                                               $$->setLocation(@1, @2);
+                                                       }
+                               ;
+
+message_stmt   :               "info" TOK_STRING_LITERAL
+                                                       {
+                                                               $$ = new MessageStatementASTNode(MessageStatementASTNode::kInfo, $2);
+                                                               $$->setLocation(@1, @2);
+                                                       }
+                               |               "warning" TOK_STRING_LITERAL
+                                                       {
+                                                               $$ = new MessageStatementASTNode(MessageStatementASTNode::kWarning, $2);
+                                                               $$->setLocation(@1, @2);
+                                                       }
+                               |               "error" TOK_STRING_LITERAL
+                                                       {
+                                                               $$ = new MessageStatementASTNode(MessageStatementASTNode::kError, $2);
+                                                               $$->setLocation(@1, @2);
+                                                       }
+                               ;
+
+if_stmt                        :               "if" bool_expr '{' full_stmt_list '}' else_opt
+                                                       {
+                                                               IfStatementASTNode * ifStmt = new IfStatementASTNode();
+                                                               ifStmt->setConditionExpr(dynamic_cast<ExprASTNode*>($2));
+                                                               ifStmt->setIfStatements(dynamic_cast<ListASTNode*>($4));
+                                                               ifStmt->setElseStatements(dynamic_cast<ListASTNode*>($6));
+                                                               ifStmt->setLocation(@1, @6);
+                                                               $$ = ifStmt;
+                                                       }
+                               ;
+
+else_opt               :               "else" '{' full_stmt_list '}'
+                                                       {
+                                                               $$ = $3;
+                                                       }
+                               |               "else" if_stmt
+                                                       {
+                                                               ListASTNode * list = new ListASTNode();
+                                                               list->appendNode($2);
+                                                               $$ = list;
+                                                               $$->setLocation(@1, @2);
+                                                       }
+                               |               /* empty */                     { $$ = NULL; }
+                               ;
+
+address_or_range       :       int_const_expr
+                                                       {
+                                                               $$ = new AddressRangeASTNode($1, NULL);
+                                                               $$->setLocation($1);
+                                                       }
+                                       |       int_const_expr ".." int_const_expr
+                                                       {
+                                                               $$ = new AddressRangeASTNode($1, $3);
+                                                               $$->setLocation(@1, @3);
+                                                       }
+                                       ;
+
+const_expr             :       bool_expr
+                                                       {
+                                                               $$ = $1;
+                                                       }
+                               |       TOK_STRING_LITERAL
+                                                       {
+                                                               $$ = new StringConstASTNode($1);
+                                                               $$->setLocation(@1);
+                                                       }
+                               ;
+
+bool_expr              :       int_const_expr
+                                               {
+                                                       $$ = $1;
+                                               }
+                               |       bool_expr '<' bool_expr
+                                               {
+                                                       ExprASTNode * left = dynamic_cast<ExprASTNode*>($1);
+                                                       ExprASTNode * right = dynamic_cast<ExprASTNode*>($3);
+                                                       $$ = new BinaryOpExprASTNode(left, BinaryOpExprASTNode::kLessThan, right);
+                                                       $$->setLocation(@1, @3);
+                                               }
+                               |       bool_expr '>' bool_expr
+                                               {
+                                                       ExprASTNode * left = dynamic_cast<ExprASTNode*>($1);
+                                                       ExprASTNode * right = dynamic_cast<ExprASTNode*>($3);
+                                                       $$ = new BinaryOpExprASTNode(left, BinaryOpExprASTNode::kGreaterThan, right);
+                                                       $$->setLocation(@1, @3);
+                                               }
+                               |       bool_expr ">=" bool_expr
+                                               {
+                                                       ExprASTNode * left = dynamic_cast<ExprASTNode*>($1);
+                                                       ExprASTNode * right = dynamic_cast<ExprASTNode*>($3);
+                                                       $$ = new BinaryOpExprASTNode(left, BinaryOpExprASTNode::kGreaterThanEqual, right);
+                                                       $$->setLocation(@1, @3);
+                                               }
+                               |       bool_expr "<=" bool_expr
+                                               {
+                                                       ExprASTNode * left = dynamic_cast<ExprASTNode*>($1);
+                                                       ExprASTNode * right = dynamic_cast<ExprASTNode*>($3);
+                                                       $$ = new BinaryOpExprASTNode(left, BinaryOpExprASTNode::kLessThanEqual, right);
+                                                       $$->setLocation(@1, @3);
+                                               }
+                               |       bool_expr "==" bool_expr
+                                               {
+                                                       ExprASTNode * left = dynamic_cast<ExprASTNode*>($1);
+                                                       ExprASTNode * right = dynamic_cast<ExprASTNode*>($3);
+                                                       $$ = new BinaryOpExprASTNode(left, BinaryOpExprASTNode::kEqual, right);
+                                                       $$->setLocation(@1, @3);
+                                               }
+                               |       bool_expr "!=" bool_expr
+                                               {
+                                                       ExprASTNode * left = dynamic_cast<ExprASTNode*>($1);
+                                                       ExprASTNode * right = dynamic_cast<ExprASTNode*>($3);
+                                                       $$ = new BinaryOpExprASTNode(left, BinaryOpExprASTNode::kNotEqual, right);
+                                                       $$->setLocation(@1, @3);
+                                               }
+                               |       bool_expr "&&" bool_expr
+                                               {
+                                                       ExprASTNode * left = dynamic_cast<ExprASTNode*>($1);
+                                                       ExprASTNode * right = dynamic_cast<ExprASTNode*>($3);
+                                                       $$ = new BinaryOpExprASTNode(left, BinaryOpExprASTNode::kBooleanAnd, right);
+                                                       $$->setLocation(@1, @3);
+                                               }
+                               |       bool_expr "||" bool_expr
+                                               {
+                                                       ExprASTNode * left = dynamic_cast<ExprASTNode*>($1);
+                                                       ExprASTNode * right = dynamic_cast<ExprASTNode*>($3);
+                                                       $$ = new BinaryOpExprASTNode(left, BinaryOpExprASTNode::kBooleanOr, right);
+                                                       $$->setLocation(@1, @3);
+                                               }
+                               |       '!' bool_expr %prec UNARY_OP
+                                               {
+                                                       $$ = new BooleanNotExprASTNode(dynamic_cast<ExprASTNode*>($2));
+                                                       $$->setLocation(@1, @2);
+                                               }
+                               |       TOK_IDENT '(' TOK_SOURCE_NAME ')'
+                                               {
+                                                       $$ = new SourceFileFunctionASTNode($1, $3);
+                                                       $$->setLocation(@1, @4);
+                                               }
+                               |       '(' bool_expr ')'
+                                               {
+                                                       $$ = $2;
+                                                       $$->setLocation(@1, @3);
+                                               }
+                               |       "defined" '(' TOK_IDENT ')'
+                                               {
+                                                       $$ = new DefinedOperatorASTNode($3);
+                                                       $$->setLocation(@1, @4);
+                                               }
+                               ;
+
+int_const_expr :       expr                            { $$ = $1; }
+                               ;
+
+symbol_ref             :       TOK_SOURCE_NAME ':' TOK_IDENT
+                                                       {
+                                                               $$ = new SymbolASTNode($3, $1);
+                                                               $$->setLocation(@1, @3);
+                                                       }
+                               |       ':' TOK_IDENT
+                                                       {
+                                                               $$ = new SymbolASTNode($2);
+                                                               $$->setLocation(@1, @2);
+                                                       }
+                               ;
+
+
+expr                   :               int_value
+                                                       {
+                                                               $$ = $1;
+                                                       }
+                               |               TOK_IDENT
+                                                       {
+                                                               $$ = new VariableExprASTNode($1);
+                                                               $$->setLocation(@1);
+                                                       }
+                               |               symbol_ref
+                                                       {
+                                                               $$ = new SymbolRefExprASTNode(dynamic_cast<SymbolASTNode*>($1));
+                                                               $$->setLocation(@1);
+                                                       }
+/*                             |               expr '..' expr
+                                                       {
+                                                               ExprASTNode * left = dynamic_cast<ExprASTNode*>($1);
+                                                               ExprASTNode * right = dynamic_cast<ExprASTNode*>($3);
+                                                               $$ = new RangeExprASTNode(left, right);
+                                                       }
+*/                             |               expr '+' expr
+                                                       {
+                                                               ExprASTNode * left = dynamic_cast<ExprASTNode*>($1);
+                                                               ExprASTNode * right = dynamic_cast<ExprASTNode*>($3);
+                                                               $$ = new BinaryOpExprASTNode(left, BinaryOpExprASTNode::kAdd, right);
+                                                               $$->setLocation(@1, @3);
+                                                       }
+                               |               expr '-' expr
+                                                       {
+                                                               ExprASTNode * left = dynamic_cast<ExprASTNode*>($1);
+                                                               ExprASTNode * right = dynamic_cast<ExprASTNode*>($3);
+                                                               $$ = new BinaryOpExprASTNode(left, BinaryOpExprASTNode::kSubtract, right);
+                                                               $$->setLocation(@1, @3);
+                                                       }
+                               |               expr '*' expr
+                                                       {
+                                                               ExprASTNode * left = dynamic_cast<ExprASTNode*>($1);
+                                                               ExprASTNode * right = dynamic_cast<ExprASTNode*>($3);
+                                                               $$ = new BinaryOpExprASTNode(left, BinaryOpExprASTNode::kMultiply, right);
+                                                               $$->setLocation(@1, @3);
+                                                       }
+                               |               expr '/' expr
+                                                       {
+                                                               ExprASTNode * left = dynamic_cast<ExprASTNode*>($1);
+                                                               ExprASTNode * right = dynamic_cast<ExprASTNode*>($3);
+                                                               $$ = new BinaryOpExprASTNode(left, BinaryOpExprASTNode::kDivide, right);
+                                                               $$->setLocation(@1, @3);
+                                                       }
+                               |               expr '%' expr
+                                                       {
+                                                               ExprASTNode * left = dynamic_cast<ExprASTNode*>($1);
+                                                               ExprASTNode * right = dynamic_cast<ExprASTNode*>($3);
+                                                               $$ = new BinaryOpExprASTNode(left, BinaryOpExprASTNode::kModulus, right);
+                                                               $$->setLocation(@1, @3);
+                                                       }
+                               |               expr "**" expr
+                                                       {
+                                                               ExprASTNode * left = dynamic_cast<ExprASTNode*>($1);
+                                                               ExprASTNode * right = dynamic_cast<ExprASTNode*>($3);
+                                                               $$ = new BinaryOpExprASTNode(left, BinaryOpExprASTNode::kPower, right);
+                                                               $$->setLocation(@1, @3);
+                                                       }
+                               |               expr '&' expr
+                                                       {
+                                                               ExprASTNode * left = dynamic_cast<ExprASTNode*>($1);
+                                                               ExprASTNode * right = dynamic_cast<ExprASTNode*>($3);
+                                                               $$ = new BinaryOpExprASTNode(left, BinaryOpExprASTNode::kBitwiseAnd, right);
+                                                               $$->setLocation(@1, @3);
+                                                       }
+                               |               expr '|' expr
+                                                       {
+                                                               ExprASTNode * left = dynamic_cast<ExprASTNode*>($1);
+                                                               ExprASTNode * right = dynamic_cast<ExprASTNode*>($3);
+                                                               $$ = new BinaryOpExprASTNode(left, BinaryOpExprASTNode::kBitwiseOr, right);
+                                                               $$->setLocation(@1, @3);
+                                                       }
+                               |               expr '^' expr
+                                                       {
+                                                               ExprASTNode * left = dynamic_cast<ExprASTNode*>($1);
+                                                               ExprASTNode * right = dynamic_cast<ExprASTNode*>($3);
+                                                               $$ = new BinaryOpExprASTNode(left, BinaryOpExprASTNode::kBitwiseXor, right);
+                                                               $$->setLocation(@1, @3);
+                                                       }
+                               |               expr "<<" expr
+                                                       {
+                                                               ExprASTNode * left = dynamic_cast<ExprASTNode*>($1);
+                                                               ExprASTNode * right = dynamic_cast<ExprASTNode*>($3);
+                                                               $$ = new BinaryOpExprASTNode(left, BinaryOpExprASTNode::kShiftLeft, right);
+                                                               $$->setLocation(@1, @3);
+                                                       }
+                               |               expr ">>" expr
+                                                       {
+                                                               ExprASTNode * left = dynamic_cast<ExprASTNode*>($1);
+                                                               ExprASTNode * right = dynamic_cast<ExprASTNode*>($3);
+                                                               $$ = new BinaryOpExprASTNode(left, BinaryOpExprASTNode::kShiftRight, right);
+                                                               $$->setLocation(@1, @3);
+                                                       }
+                               |               unary_expr
+                                                       {
+                                                               $$ = $1;
+                                                       }
+                               |               expr '.' TOK_INT_SIZE   
+                                                       {
+                                                               $$ = new IntSizeExprASTNode(dynamic_cast<ExprASTNode*>($1), $3->getWordSize());
+                                                               $$->setLocation(@1, @3);
+                                                       }
+                               |               '(' expr ')'
+                                                       {
+                                                               $$ = $2;
+                                                               $$->setLocation(@1, @3);
+                                                       }
+                               |       "sizeof" '(' symbol_ref ')'
+                                               {
+                                                       $$ = new SizeofOperatorASTNode(dynamic_cast<SymbolASTNode*>($3));
+                                                       $$->setLocation(@1, @4);
+                                               }
+                               |       "sizeof" '(' TOK_IDENT ')'
+                                               {
+                                                       $$ = new SizeofOperatorASTNode($3);
+                                                       $$->setLocation(@1, @4);
+                                               }
+                               |       "sizeof" '(' TOK_SOURCE_NAME ')'
+                                               {
+                                                       $$ = new SizeofOperatorASTNode($3);
+                                                       $$->setLocation(@1, @4);
+                                               }
+                               ;
+
+unary_expr             :               '+' expr %prec UNARY_OP
+                                                       {
+                                                               $$ = $2;
+                                                       }
+                               |               '-' expr %prec UNARY_OP
+                                                       {
+                                                               $$ = new NegativeExprASTNode(dynamic_cast<ExprASTNode*>($2));
+                                                               $$->setLocation(@1, @2);
+                                                       }
+                               ;
+
+int_value              :               TOK_INT_LITERAL
+                                                       {
+                                                               $$ = new IntConstExprASTNode($1->getValue(), $1->getWordSize());
+                                                               $$->setLocation(@1);
+                                                       }
+                               ;
+
+%%
+
+/* code goes here */
+
+static int yylex(YYSTYPE * lvalp, YYLTYPE * yylloc, ElftosbLexer * lexer)
+{
+       int token = lexer->yylex();
+       *yylloc = lexer->getLocation();
+       lexer->getSymbolValue(lvalp);
+       return token;
+}
+
+static void yyerror(YYLTYPE * yylloc, ElftosbLexer * lexer, CommandFileASTNode ** resultAST, const char * error)
+{
+       throw syntax_error(format_string("line %d: %s\n", yylloc->m_firstLine, error));
+}
+
diff --git a/tools/elftosb/encryptgpk/encryptgpk.cpp b/tools/elftosb/encryptgpk/encryptgpk.cpp
new file mode 100644 (file)
index 0000000..e389fef
--- /dev/null
@@ -0,0 +1,442 @@
+/*
+ * File:       encryptgpk.cpp
+ *
+ * Copyright (c) Freescale Semiconductor, Inc. All rights reserved.
+ * See included license file for license details.
+ */
+
+#include "stdafx.h"
+#include <iostream>
+#include <fstream>
+#include <sstream>
+#include <stdlib.h>
+#include <stdexcept>
+#include <stdio.h>
+#include "options.h"
+#include "EncoreBootImage.h"
+#include "smart_ptr.h"
+#include "Logging.h"
+#include "format_string.h"
+#include "Blob.h"
+#include "Random.h"
+#include "rijndael.h"
+
+using namespace elftosb;
+
+//! Size in bytes of the unencrypted group private key.
+#define GPK_LENGTH (40)
+
+//! Size in bytes of the encrypted output data. This size must be modulo 16, the chunk size for the
+//! AES-128 crypto algorithm. The group private key is inserted at offset 16.
+#define OUTPUT_DATA_LENGTH (64)
+
+//! Position in the output data of the first byte of the group private key.
+#define OUTPUT_DATA_GPK_OFFSET (16)
+
+//! The tool's name.
+const char k_toolName[] = "encryptgpk";
+
+//! Current version number for the tool.
+const char k_version[] = "1.0.2";
+
+//! Copyright string.
+const char k_copyright[] = "Copyright (c) 2008 Freescale Semiconductor. All rights reserved.";
+
+//! Default output array name.
+const char k_defaultArrayName[] = "_endDisplay";
+
+//! Definition of command line options.
+static const char * k_optionsDefinition[] = {
+       "?|help",
+       "v|version",
+       "k:key <file>",
+       "z|zero-key",
+       "o:output",
+       "p:prefix",
+       "a:array",
+       "d|debug",
+       "q|quiet",
+       "V|verbose",
+       NULL
+};
+
+//! Help string.
+const char k_usageText[] = "\nOptions:\n\
+  -?/--help                    Show this help\n\
+  -v/--version                 Display tool version\n\
+  -k/--key <file>              Add OTP key used for decryption\n\
+  -z/--zero-key                Add default key of all zeroes\n\
+  -o/--output <file>           Write output to this file\n\
+  -p/--prefix <prefix>         Set the output array prefix\n\
+  -a/--array <name>            Specify the output array name\n\
+  -d/--debug                   Enable debug output\n\
+  -q/--quiet                   Output only warnings and errors\n\
+  -V/--verbose                 Print extra detailed log information\n\n";
+
+//! Init vector used for CBC encrypting the output data.
+static const uint8_t kInitVector[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 };
+
+//! An array of strings.
+typedef std::vector<std::string> string_vector_t;
+
+// prototypes
+int main(int argc, char* argv[], char* envp[]);
+
+/*!
+ * \brief Class that encapsulates the sbtool interface.
+ *
+ * A single global logger instance is created during object construction. It is
+ * never freed because we need it up to the last possible minute, when an
+ * exception could be thrown.
+ */
+class encryptgpk
+{
+protected:
+       int m_argc;                                                     //!< Number of command line arguments.
+       char ** m_argv;                                         //!< String value for each command line argument.
+       StdoutLogger * m_logger;                        //!< Singleton logger instance.
+       string_vector_t m_keyFilePaths;         //!< Paths to OTP key files.
+       string_vector_t m_positionalArgs;       //!< Arguments coming after explicit options.
+       bool m_isVerbose;                                       //!< Whether the verbose flag was turned on.
+       bool m_useDefaultKey;                                   //!< Include a default (zero) crypto key.
+       std::string m_outputPath;                       //!< Path to output file.
+       std::string m_gpkPath;                          //!< Path to input group private key file.
+       std::string m_outputPrefix;                     //!< Prefix to the output array.
+       std::string m_arrayName;                        //!< Output array's name.
+       
+public:
+       /*!
+        * Constructor.
+        *
+        * Creates the singleton logger instance.
+        */
+       encryptgpk(int argc, char * argv[])
+       :       m_argc(argc),
+               m_argv(argv),
+               m_logger(0),
+               m_keyFilePaths(),
+               m_positionalArgs(),
+               m_isVerbose(false),
+               m_useDefaultKey(false),
+               m_outputPath(),
+               m_gpkPath(),
+               m_outputPrefix(),
+               m_arrayName(k_defaultArrayName)
+       {
+               // create logger instance
+               m_logger = new StdoutLogger();
+               m_logger->setFilterLevel(Logger::INFO);
+               Log::setLogger(m_logger);
+       }
+       
+       /*!
+        * Destructor.
+        */
+       ~encryptgpk()
+       {
+       }
+       
+       /*!
+        * Reads the command line options passed into the constructor.
+        *
+        * This method can return a return code to its caller, which will cause the
+        * tool to exit immediately with that return code value. Normally, though, it
+        * will return -1 to signal that the tool should continue to execute and
+        * all options were processed successfully.
+        *
+        * The Options class is used to parse command line options. See
+        * #k_optionsDefinition for the list of options and #k_usageText for the
+        * descriptive help for each option.
+        *
+        * \retval -1 The options were processed successfully. Let the tool run normally.
+        * \return A zero or positive result is a return code value that should be
+        *              returned from the tool as it exits immediately.
+        */
+       int processOptions()
+       {
+               Options options(*m_argv, k_optionsDefinition);
+               OptArgvIter iter(--m_argc, ++m_argv);
+               
+               // process command line options
+               int optchar;
+               const char * optarg;
+               while (optchar = options(iter, optarg))
+               {
+                       switch (optchar)
+                       {
+                               case '?':
+                                       printUsage(options);
+                                       return 0;
+                               
+                               case 'v':
+                                       printf("%s %s\n%s\n", k_toolName, k_version, k_copyright);
+                                       return 0;
+                                       
+                               case 'k':
+                                       m_keyFilePaths.push_back(optarg);
+                                       break;
+                               
+                               case 'z':
+                                       m_useDefaultKey = true;
+                                       break;
+                               
+                               case 'o':
+                                       m_outputPath = optarg;
+                                       break;
+
+                               case 'p':
+                                       m_outputPrefix = optarg;
+                                       break;
+
+                               case 'a':
+                                       m_arrayName = optarg;
+                                       break;
+                               
+                               case 'd':
+                                       Log::getLogger()->setFilterLevel(Logger::DEBUG);
+                                       break;
+                                       
+                               case 'q':
+                                       Log::getLogger()->setFilterLevel(Logger::WARNING);
+                                       break;
+                                       
+                               case 'V':
+                                       m_isVerbose = true;
+                                       break;
+                               
+                               default:
+                                       Log::log(Logger::ERROR, "error: unrecognized option\n\n");
+                                       printUsage(options);
+                                       return 1;
+                       }
+               }
+               
+               // handle positional args
+               if (iter.index() < m_argc)
+               {
+//                     Log::SetOutputLevel leveler(Logger::DEBUG);
+//                     Log::log("positional args:\n");
+                       int i;
+                       for (i = iter.index(); i < m_argc; ++i)
+                       {
+//                             Log::log("%d: %s\n", i - iter.index(), m_argv[i]);
+                               m_positionalArgs.push_back(m_argv[i]);
+                       }
+               }
+               
+               // all is well
+               return -1;
+       }
+
+       /*!
+        * Prints help for the tool.
+        */
+       void printUsage(Options & options)
+       {
+               options.usage(std::cout, "gpk-file");
+               printf(k_usageText, k_toolName);
+       }
+       
+       /*!
+        * Core of the tool. Calls processOptions() to handle command line options
+        * before performing the real work the tool does.
+        */
+       int run()
+       {
+               try
+               {
+                       // read command line options
+                       int result;
+                       if ((result = processOptions()) != -1)
+                       {
+                               return result;
+                       }
+                       
+                       // set verbose logging
+                       setVerboseLogging();
+                       
+                       // make sure a file was provided
+                       if (m_positionalArgs.size() < 1)
+                       {
+                               throw std::runtime_error("no input file path was provided");
+                       }
+
+                       // Make sure at least one key was specified.
+                       if (m_keyFilePaths.size() == 0 && m_useDefaultKey == false)
+                       {
+                               throw std::runtime_error("no crypto key was specified");
+                       }
+                       
+                       // Do the work.
+                       generateOutput();
+               }
+               catch (std::exception & e)
+               {
+                       Log::log(Logger::ERROR, "error: %s\n", e.what());
+                       return 1;
+               }
+               catch (...)
+               {
+                       Log::log(Logger::ERROR, "error: unexpected exception\n");
+                       return 1;
+               }
+               
+               return 0;
+       }
+
+       /*!
+        * \brief Builds the output data blob, encrypts it, and writes it to the output file.
+        */
+       void generateOutput()
+       {
+               // Create the output data blob and set it to the correct size.
+               Blob data;
+               data.setLength(OUTPUT_DATA_LENGTH);
+               
+               // Fill it with random values.
+               RandomNumberGenerator rng;
+               rng.generateBlock(data.getData(), OUTPUT_DATA_LENGTH);
+
+               // Read the GPK and overlay it into the output data.
+               // The first positional arg is the GPK file path.
+               Blob gpk = readGPK(m_positionalArgs[0]);
+               memcpy(data.getData() + OUTPUT_DATA_GPK_OFFSET, gpk.getData(), GPK_LENGTH);
+
+               // This is the key object for our crypto key.
+               AESKey<128> cryptoKey = readKeyFile();
+
+               // Read the key file.
+               // Encrypt the output data block.
+               Rijndael cipher;
+               cipher.init(Rijndael::CBC, Rijndael::Encrypt, cryptoKey, Rijndael::Key16Bytes, (uint8_t *)&kInitVector);
+               cipher.blockEncrypt(data.getData(), OUTPUT_DATA_LENGTH * 8, data.getData());
+
+               // Open the output file.
+               std::ofstream outputStream(m_outputPath.c_str(), std::ios_base::out | std::ios_base::trunc);
+               if (!outputStream.is_open())
+               {
+                       throw std::runtime_error(format_string("could not open output file %s", m_outputPath.c_str()));
+               }
+               
+               writeCArray(outputStream, data);
+       }
+
+       /*!
+        * \brief Reads the group private key binary data.
+        */
+       Blob readGPK(std::string & path)
+       {
+               std::ifstream stream(path.c_str(), std::ios_base::in | std::ios_base::binary);
+               if (!stream.is_open())
+               {
+                       throw std::runtime_error("could not open group private key file");
+               }
+
+               Blob gpk;
+               gpk.setLength(GPK_LENGTH);
+
+               stream.read((char *)gpk.getData(), GPK_LENGTH);
+
+               return gpk;
+       }
+
+       /*!
+        * \brief Returns a key object based on the user's specified key.
+        */
+       AESKey<128> readKeyFile()
+       {
+               if (m_keyFilePaths.size() > 0)
+               {
+                       // Open the key file.
+                       std::string & keyPath = m_keyFilePaths[0];
+                       std::ifstream keyStream(keyPath.c_str(), std::ios_base::in);
+                       if (!keyStream.is_open())
+                       {
+                               throw std::runtime_error(format_string("unable to read key file %s\n", keyPath.c_str()));
+                       }
+                       keyStream.seekg(0);
+                       
+                       // Read the first key in the file.
+                       AESKey<128> key(keyStream);
+                       return key;
+               }
+
+               // Otherwise, create a zero key and return it.
+               AESKey<128> defaultKey;
+               return defaultKey;
+
+       }
+
+       /*!
+        * \brief Writes the given data blob as an array in a C source file.
+        */
+       void writeCArray(std::ofstream & stream, const Blob & data)
+       {
+               const uint8_t * dataPtr = data.getData();
+               unsigned length = data.getLength();
+
+               // Write first line.
+               std::string text = format_string("%s%sunsigned char %s[%d] = {", m_outputPrefix.c_str(), m_outputPrefix.size() > 0 ? " " : "", m_arrayName.c_str(), length);
+               stream.write(text.c_str(), text.size());
+               
+               // Write each word of the array.
+               unsigned i = 0;
+               while (i < length)
+               {
+                       // Insert a comma at the end of the previous line unless this is the first word we're outputting.
+                       text = format_string("%s\n    0x%02x", i == 0 ? "" : ",", (*dataPtr++) & 0xff);
+                       stream.write(text.c_str(), text.size());
+
+                       i++;
+               }
+
+               // Write last line, terminating the array.
+               text = "\n};\n\n";
+               stream.write(text.c_str(), text.size());
+       }
+       
+       /*!
+        * \brief Turns on verbose logging.
+        */
+       void setVerboseLogging()
+       {
+               if (m_isVerbose)
+               {
+                       // verbose only affects the INFO and DEBUG filter levels
+                       // if the user has selected quiet mode, it overrides verbose
+                       switch (Log::getLogger()->getFilterLevel())
+                       {
+                               case Logger::INFO:
+                                       Log::getLogger()->setFilterLevel(Logger::INFO2);
+                                       break;
+                               case Logger::DEBUG:
+                                       Log::getLogger()->setFilterLevel(Logger::DEBUG2);
+                                       break;
+                       }
+               }
+       }
+
+};
+
+/*!
+ * Main application entry point. Creates an sbtool instance and lets it take over.
+ */
+int main(int argc, char* argv[], char* envp[])
+{
+       try
+       {
+               return encryptgpk(argc, argv).run();
+       }
+       catch (...)
+       {
+               Log::log(Logger::ERROR, "error: unexpected exception\n");
+               return 1;
+       }
+
+       return 0;
+}
+
+
+
+
+
diff --git a/tools/elftosb/encryptgpk/encryptgpk.vcproj b/tools/elftosb/encryptgpk/encryptgpk.vcproj
new file mode 100644 (file)
index 0000000..8f5cd24
--- /dev/null
@@ -0,0 +1,349 @@
+<?xml version="1.0" encoding="Windows-1252"?>\r
+<VisualStudioProject\r
+       ProjectType="Visual C++"\r
+       Version="9.00"\r
+       Name="encryptgpk"\r
+       ProjectGUID="{5C28390B-78FC-4484-BBB5-E425F9852CCE}"\r
+       Keyword="Win32Proj"\r
+       TargetFrameworkVersion="131072"\r
+       >\r
+       <Platforms>\r
+               <Platform\r
+                       Name="Win32"\r
+               />\r
+       </Platforms>\r
+       <ToolFiles>\r
+       </ToolFiles>\r
+       <Configurations>\r
+               <Configuration\r
+                       Name="Debug|Win32"\r
+                       OutputDirectory="Debug"\r
+                       IntermediateDirectory="Debug"\r
+                       ConfigurationType="1"\r
+                       InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"\r
+                       CharacterSet="2"\r
+                       >\r
+                       <Tool\r
+                               Name="VCPreBuildEventTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCCustomBuildTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCXMLDataGeneratorTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCWebServiceProxyGeneratorTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCMIDLTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCCLCompilerTool"\r
+                               Optimization="0"\r
+                               AdditionalIncludeDirectories="..\winsupport;..\common"\r
+                               PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"\r
+                               MinimalRebuild="true"\r
+                               BasicRuntimeChecks="3"\r
+                               RuntimeLibrary="1"\r
+                               UsePrecompiledHeader="0"\r
+                               WarningLevel="3"\r
+                               Detect64BitPortabilityProblems="true"\r
+                               DebugInformationFormat="4"\r
+                       />\r
+                       <Tool\r
+                               Name="VCManagedResourceCompilerTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCResourceCompilerTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCPreLinkEventTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCLinkerTool"\r
+                               OutputFile="$(OutDir)/encryptgpk.exe"\r
+                               LinkIncremental="2"\r
+                               GenerateDebugInformation="true"\r
+                               ProgramDatabaseFile="$(OutDir)/encryptgpk.pdb"\r
+                               SubSystem="1"\r
+                               RandomizedBaseAddress="1"\r
+                               DataExecutionPrevention="0"\r
+                               TargetMachine="1"\r
+                       />\r
+                       <Tool\r
+                               Name="VCALinkTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCManifestTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCXDCMakeTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCBscMakeTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCFxCopTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCAppVerifierTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCPostBuildEventTool"\r
+                       />\r
+               </Configuration>\r
+               <Configuration\r
+                       Name="Release|Win32"\r
+                       OutputDirectory="Release"\r
+                       IntermediateDirectory="Release"\r
+                       ConfigurationType="1"\r
+                       InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"\r
+                       CharacterSet="2"\r
+                       >\r
+                       <Tool\r
+                               Name="VCPreBuildEventTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCCustomBuildTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCXMLDataGeneratorTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCWebServiceProxyGeneratorTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCMIDLTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCCLCompilerTool"\r
+                               AdditionalIncludeDirectories="..\winsupport;..\common"\r
+                               PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"\r
+                               RuntimeLibrary="0"\r
+                               UsePrecompiledHeader="0"\r
+                               WarningLevel="3"\r
+                               Detect64BitPortabilityProblems="true"\r
+                               DebugInformationFormat="3"\r
+                       />\r
+                       <Tool\r
+                               Name="VCManagedResourceCompilerTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCResourceCompilerTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCPreLinkEventTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCLinkerTool"\r
+                               OutputFile="$(OutDir)/encryptgpk.exe"\r
+                               LinkIncremental="1"\r
+                               GenerateDebugInformation="true"\r
+                               SubSystem="1"\r
+                               OptimizeReferences="2"\r
+                               EnableCOMDATFolding="2"\r
+                               RandomizedBaseAddress="1"\r
+                               DataExecutionPrevention="0"\r
+                               TargetMachine="1"\r
+                       />\r
+                       <Tool\r
+                               Name="VCALinkTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCManifestTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCXDCMakeTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCBscMakeTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCFxCopTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCAppVerifierTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCPostBuildEventTool"\r
+                       />\r
+               </Configuration>\r
+       </Configurations>\r
+       <References>\r
+       </References>\r
+       <Files>\r
+               <Filter\r
+                       Name="Source Files"\r
+                       Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"\r
+                       UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"\r
+                       >\r
+                       <File\r
+                               RelativePath=".\encryptgpk.cpp"\r
+                               >\r
+                       </File>\r
+                       <Filter\r
+                               Name="common"\r
+                               >\r
+                               <File\r
+                                       RelativePath="..\common\AESKey.cpp"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath="..\common\Blob.cpp"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath="..\common\crc.cpp"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath="..\common\format_string.cpp"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath="..\common\HexValues.cpp"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath="..\common\Logging.cpp"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath="..\common\options.cpp"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath="..\common\Random.cpp"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath="..\common\rijndael.cpp"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath="..\common\RijndaelCBCMAC.cpp"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath="..\common\SearchPath.cpp"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath="..\common\SHA1.cpp"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath="..\common\stdafx.cpp"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath="..\common\Value.cpp"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath="..\common\Version.cpp"\r
+                                       >\r
+                               </File>\r
+                       </Filter>\r
+               </Filter>\r
+               <Filter\r
+                       Name="Header Files"\r
+                       Filter="h;hpp;hxx;hm;inl;inc;xsd"\r
+                       UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"\r
+                       >\r
+                       <Filter\r
+                               Name="common"\r
+                               >\r
+                               <File\r
+                                       RelativePath="..\common\AESKey.h"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath="..\common\Blob.h"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath="..\common\BootImage.h"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath="..\common\crc.h"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath="..\common\ELF.h"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath="..\common\EndianUtilities.h"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath="..\common\format_string.h"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath="..\common\HexValues.h"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath="..\common\int_size.h"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath="..\common\Logging.h"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath="..\common\options.h"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath="..\common\Random.h"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath="..\common\rijndael.h"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath="..\common\RijndaelCBCMAC.h"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath="..\common\SearchPath.h"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath="..\common\SHA1.h"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath="..\common\smart_ptr.h"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath="..\common\stdafx.h"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath="..\common\Value.h"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath="..\common\Version.h"\r
+                                       >\r
+                               </File>\r
+                       </Filter>\r
+               </Filter>\r
+               <Filter\r
+                       Name="Resource Files"\r
+                       Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"\r
+                       UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"\r
+                       >\r
+               </Filter>\r
+       </Files>\r
+       <Globals>\r
+       </Globals>\r
+</VisualStudioProject>\r
diff --git a/tools/elftosb/keygen/Doxyfile b/tools/elftosb/keygen/Doxyfile
new file mode 100644 (file)
index 0000000..0b20ed1
--- /dev/null
@@ -0,0 +1,250 @@
+# Doxyfile 1.3.9
+
+#---------------------------------------------------------------------------
+# Project related configuration options
+#---------------------------------------------------------------------------
+PROJECT_NAME           = sbtool
+PROJECT_NUMBER         = 1.0
+OUTPUT_DIRECTORY       = .
+CREATE_SUBDIRS         = YES
+OUTPUT_LANGUAGE        = English
+USE_WINDOWS_ENCODING   = YES
+BRIEF_MEMBER_DESC      = YES
+REPEAT_BRIEF           = YES
+ABBREVIATE_BRIEF       = "The $name class" \
+                         "The $name widget" \
+                         "The $name file" \
+                         is \
+                         provides \
+                         specifies \
+                         contains \
+                         represents \
+                         a \
+                         an \
+                         the
+ALWAYS_DETAILED_SEC    = NO
+INLINE_INHERITED_MEMB  = NO
+FULL_PATH_NAMES        = NO
+STRIP_FROM_PATH        = "/Users/creed/projects/elftosb/sbtool" \
+                                                "/Users/creed/projects/sgtl/elftosb/sbtool" \
+                                                "/Users/creed/projects/elftosb/common" \
+                                                "/Users/creed/projects/sgtl/elftosb/common"
+STRIP_FROM_INC_PATH    = 
+SHORT_NAMES            = NO
+JAVADOC_AUTOBRIEF      = NO
+MULTILINE_CPP_IS_BRIEF = NO
+DETAILS_AT_TOP         = YES
+INHERIT_DOCS           = YES
+DISTRIBUTE_GROUP_DOC   = NO
+TAB_SIZE               = 4
+ALIASES                = 
+OPTIMIZE_OUTPUT_FOR_C  = NO
+OPTIMIZE_OUTPUT_JAVA   = NO
+SUBGROUPING            = YES
+#---------------------------------------------------------------------------
+# Build related configuration options
+#---------------------------------------------------------------------------
+EXTRACT_ALL            = YES
+EXTRACT_PRIVATE        = YES
+EXTRACT_STATIC         = YES
+EXTRACT_LOCAL_CLASSES  = YES
+EXTRACT_LOCAL_METHODS  = NO
+HIDE_UNDOC_MEMBERS     = NO
+HIDE_UNDOC_CLASSES     = NO
+HIDE_FRIEND_COMPOUNDS  = NO
+HIDE_IN_BODY_DOCS      = NO
+INTERNAL_DOCS          = NO
+CASE_SENSE_NAMES       = NO
+HIDE_SCOPE_NAMES       = NO
+SHOW_INCLUDE_FILES     = YES
+INLINE_INFO            = YES
+SORT_MEMBER_DOCS       = YES
+SORT_BRIEF_DOCS        = NO
+SORT_BY_SCOPE_NAME     = NO
+GENERATE_TODOLIST      = YES
+GENERATE_TESTLIST      = YES
+GENERATE_BUGLIST       = YES
+GENERATE_DEPRECATEDLIST= YES
+ENABLED_SECTIONS       = 
+MAX_INITIALIZER_LINES  = 30
+SHOW_USED_FILES        = YES
+SHOW_DIRECTORIES       = YES
+#---------------------------------------------------------------------------
+# configuration options related to warning and progress messages
+#---------------------------------------------------------------------------
+QUIET                  = NO
+WARNINGS               = YES
+WARN_IF_UNDOCUMENTED   = YES
+WARN_IF_DOC_ERROR      = YES
+WARN_FORMAT            = "$file:$line: $text"
+WARN_LOGFILE           = 
+#---------------------------------------------------------------------------
+# configuration options related to the input files
+#---------------------------------------------------------------------------
+INPUT                  = . ../common
+FILE_PATTERNS          = *.c \
+                         *.cc \
+                         *.cxx \
+                         *.cpp \
+                         *.c++ \
+                         *.java \
+                         *.ii \
+                         *.ixx \
+                         *.ipp \
+                         *.i++ \
+                         *.inl \
+                         *.h \
+                         *.hh \
+                         *.hxx \
+                         *.hpp \
+                         *.h++ \
+                         *.idl \
+                         *.odl \
+                         *.cs \
+                         *.php \
+                         *.php3 \
+                         *.inc \
+                         *.m \
+                         *.mm
+RECURSIVE              = NO
+EXCLUDE                = 
+EXCLUDE_SYMLINKS       = NO
+EXCLUDE_PATTERNS       = 
+EXAMPLE_PATH           = 
+EXAMPLE_PATTERNS       = *
+EXAMPLE_RECURSIVE      = NO
+IMAGE_PATH             = 
+INPUT_FILTER           = 
+FILTER_PATTERNS        = 
+FILTER_SOURCE_FILES    = NO
+#---------------------------------------------------------------------------
+# configuration options related to source browsing
+#---------------------------------------------------------------------------
+SOURCE_BROWSER         = NO
+INLINE_SOURCES         = NO
+STRIP_CODE_COMMENTS    = YES
+REFERENCED_BY_RELATION = NO
+REFERENCES_RELATION    = NO
+VERBATIM_HEADERS       = NO
+#---------------------------------------------------------------------------
+# configuration options related to the alphabetical class index
+#---------------------------------------------------------------------------
+ALPHABETICAL_INDEX     = NO
+COLS_IN_ALPHA_INDEX    = 5
+IGNORE_PREFIX          = 
+#---------------------------------------------------------------------------
+# configuration options related to the HTML output
+#---------------------------------------------------------------------------
+GENERATE_HTML          = YES
+HTML_OUTPUT            = html
+HTML_FILE_EXTENSION    = .html
+HTML_HEADER            = 
+HTML_FOOTER            = 
+HTML_STYLESHEET        = 
+HTML_ALIGN_MEMBERS     = YES
+GENERATE_HTMLHELP      = NO
+CHM_FILE               = 
+HHC_LOCATION           = 
+GENERATE_CHI           = NO
+BINARY_TOC             = NO
+TOC_EXPAND             = NO
+DISABLE_INDEX          = NO
+ENUM_VALUES_PER_LINE   = 4
+GENERATE_TREEVIEW      = YES
+TREEVIEW_WIDTH         = 250
+#---------------------------------------------------------------------------
+# configuration options related to the LaTeX output
+#---------------------------------------------------------------------------
+GENERATE_LATEX         = NO
+LATEX_OUTPUT           = latex
+LATEX_CMD_NAME         = latex
+MAKEINDEX_CMD_NAME     = makeindex
+COMPACT_LATEX          = NO
+PAPER_TYPE             = a4wide
+EXTRA_PACKAGES         = 
+LATEX_HEADER           = 
+PDF_HYPERLINKS         = NO
+USE_PDFLATEX           = NO
+LATEX_BATCHMODE        = NO
+LATEX_HIDE_INDICES     = NO
+#---------------------------------------------------------------------------
+# configuration options related to the RTF output
+#---------------------------------------------------------------------------
+GENERATE_RTF           = NO
+RTF_OUTPUT             = rtf
+COMPACT_RTF            = NO
+RTF_HYPERLINKS         = NO
+RTF_STYLESHEET_FILE    = 
+RTF_EXTENSIONS_FILE    = 
+#---------------------------------------------------------------------------
+# configuration options related to the man page output
+#---------------------------------------------------------------------------
+GENERATE_MAN           = NO
+MAN_OUTPUT             = man
+MAN_EXTENSION          = .3
+MAN_LINKS              = NO
+#---------------------------------------------------------------------------
+# configuration options related to the XML output
+#---------------------------------------------------------------------------
+GENERATE_XML           = NO
+XML_OUTPUT             = xml
+XML_SCHEMA             = 
+XML_DTD                = 
+XML_PROGRAMLISTING     = YES
+#---------------------------------------------------------------------------
+# configuration options for the AutoGen Definitions output
+#---------------------------------------------------------------------------
+GENERATE_AUTOGEN_DEF   = NO
+#---------------------------------------------------------------------------
+# configuration options related to the Perl module output
+#---------------------------------------------------------------------------
+GENERATE_PERLMOD       = NO
+PERLMOD_LATEX          = NO
+PERLMOD_PRETTY         = YES
+PERLMOD_MAKEVAR_PREFIX = 
+#---------------------------------------------------------------------------
+# Configuration options related to the preprocessor   
+#---------------------------------------------------------------------------
+ENABLE_PREPROCESSING   = YES
+MACRO_EXPANSION        = NO
+EXPAND_ONLY_PREDEF     = NO
+SEARCH_INCLUDES        = YES
+INCLUDE_PATH           = 
+INCLUDE_FILE_PATTERNS  = 
+PREDEFINED             = 
+EXPAND_AS_DEFINED      = 
+SKIP_FUNCTION_MACROS   = YES
+#---------------------------------------------------------------------------
+# Configuration::additions related to external references   
+#---------------------------------------------------------------------------
+TAGFILES               = 
+GENERATE_TAGFILE       = 
+ALLEXTERNALS           = NO
+EXTERNAL_GROUPS        = YES
+PERL_PATH              = /usr/bin/perl
+#---------------------------------------------------------------------------
+# Configuration options related to the dot tool   
+#---------------------------------------------------------------------------
+CLASS_DIAGRAMS         = NO
+HIDE_UNDOC_RELATIONS   = YES
+HAVE_DOT               = NO
+CLASS_GRAPH            = YES
+COLLABORATION_GRAPH    = YES
+UML_LOOK               = NO
+TEMPLATE_RELATIONS     = NO
+INCLUDE_GRAPH          = YES
+INCLUDED_BY_GRAPH      = YES
+CALL_GRAPH             = NO
+GRAPHICAL_HIERARCHY    = YES
+DOT_IMAGE_FORMAT       = png
+DOT_PATH               = 
+DOTFILE_DIRS           = 
+MAX_DOT_GRAPH_WIDTH    = 1024
+MAX_DOT_GRAPH_HEIGHT   = 1024
+MAX_DOT_GRAPH_DEPTH    = 1000
+GENERATE_LEGEND        = YES
+DOT_CLEANUP            = YES
+#---------------------------------------------------------------------------
+# Configuration::additions related to the search engine   
+#---------------------------------------------------------------------------
+SEARCHENGINE           = NO
diff --git a/tools/elftosb/keygen/keygen.cpp b/tools/elftosb/keygen/keygen.cpp
new file mode 100644 (file)
index 0000000..b1b8362
--- /dev/null
@@ -0,0 +1,346 @@
+/*
+ * File:       keygen.cpp
+ *
+ * Copyright (c) Freescale Semiconductor, Inc. All rights reserved.
+ * See included license file for license details.
+ */
+
+#include "stdafx.h"
+#include <iostream>
+#include <fstream>
+#include <sstream>
+#include <stdlib.h>
+#include <stdexcept>
+#include <string>
+#include <vector>
+#include "options.h"
+#include "smart_ptr.h"
+#include "Logging.h"
+#include "AESKey.h"
+
+//! The tool's name.
+const char k_toolName[] = "keygen";
+
+//! Current version number for the tool.
+const char k_version[] = "1.0";
+
+//! Copyright string.
+const char k_copyright[] = "Copyright (c) 2006-2009 Freescale Semiconductor, Inc.\nAll rights reserved.";
+
+//! Definition of command line options.
+static const char * k_optionsDefinition[] = {
+       "?|help",
+       "v|version",
+       "q|quiet",
+       "V|verbose",
+       "n:number <int>",
+       NULL
+};
+
+//! Help string.
+const char k_usageText[] = "\nOptions:\n\
+  -?/--help                    Show this help\n\
+  -v/--version                 Display tool version\n\
+  -q/--quiet                   Output only warnings and errors\n\
+  -V/--verbose                 Print extra detailed log information\n\
+  -n/--number <int>            Number of keys to generate per file (default=1)\n\n";
+
+//! An array of strings.
+typedef std::vector<std::string> string_vector_t;
+
+// prototypes
+int main(int argc, char* argv[], char* envp[]);
+
+/*!
+ * \brief Class that encapsulates the keygen interface.
+ *
+ * A single global logger instance is created during object construction. It is
+ * never freed because we need it up to the last possible minute, when an
+ * exception could be thrown.
+ */
+class keygen
+{
+protected:
+       int m_argc;                                                     //!< Number of command line arguments.
+       char ** m_argv;                                         //!< String value for each command line argument.
+       StdoutLogger * m_logger;                        //!< Singleton logger instance.
+       string_vector_t m_positionalArgs;       //!< Arguments coming after explicit options.
+       bool m_isVerbose;                                       //!< Whether the verbose flag was turned on.
+       int m_keyCount;                                         //!< Number of keys to generate.
+       
+public:
+       /*!
+        * Constructor.
+        *
+        * Creates the singleton logger instance.
+        */
+       keygen(int argc, char * argv[])
+       :       m_argc(argc),
+               m_argv(argv),
+               m_logger(0),
+               m_positionalArgs(),
+               m_isVerbose(false),
+               m_keyCount(1)
+       {
+               // create logger instance
+               m_logger = new StdoutLogger();
+               m_logger->setFilterLevel(Logger::INFO);
+               Log::setLogger(m_logger);
+       }
+       
+       /*!
+        * Destructor.
+        */
+       ~keygen()
+       {
+       }
+       
+       /*!
+        * Reads the command line options passed into the constructor.
+        *
+        * This method can return a return code to its caller, which will cause the
+        * tool to exit immediately with that return code value. Normally, though, it
+        * will return -1 to signal that the tool should continue to execute and
+        * all options were processed successfully.
+        *
+        * The Options class is used to parse command line options. See
+        * #k_optionsDefinition for the list of options and #k_usageText for the
+        * descriptive help for each option.
+        *
+        * \retval -1 The options were processed successfully. Let the tool run normally.
+        * \return A zero or positive result is a return code value that should be
+        *              returned from the tool as it exits immediately.
+        */
+       int processOptions()
+       {
+               Options options(*m_argv, k_optionsDefinition);
+               OptArgvIter iter(--m_argc, ++m_argv);
+               
+               // process command line options
+               int optchar;
+               const char * optarg;
+               while (optchar = options(iter, optarg))
+               {
+                       switch (optchar)
+                       {
+                               case '?':
+                                       printUsage(options);
+                                       return 0;
+                               
+                               case 'v':
+                                       printf("%s %s\n%s\n", k_toolName, k_version, k_copyright);
+                                       return 0;
+                                       
+                               case 'd':
+                                       Log::getLogger()->setFilterLevel(Logger::DEBUG);
+                                       break;
+                                       
+                               case 'q':
+                                       Log::getLogger()->setFilterLevel(Logger::WARNING);
+                                       break;
+                                       
+                               case 'V':
+                                       m_isVerbose = true;
+                                       break;
+                               
+                               case 'n':
+                                       m_keyCount = strtol(optarg, NULL, 0);
+                                       break;
+                               
+                               default:
+                                       Log::log(Logger::ERROR, "error: unrecognized option\n\n");
+                                       printUsage(options);
+                                       return 1;
+                       }
+               }
+               
+               // handle positional args
+               if (iter.index() < m_argc)
+               {
+//                     Log::SetOutputLevel leveler(Logger::DEBUG);
+//                     Log::log("positional args:\n");
+                       int i;
+                       for (i = iter.index(); i < m_argc; ++i)
+                       {
+//                             Log::log("%d: %s\n", i - iter.index(), m_argv[i]);
+                               m_positionalArgs.push_back(m_argv[i]);
+                       }
+               }
+               
+               // all is well
+               return -1;
+       }
+
+       /*!
+        * Prints help for the tool.
+        */
+       void printUsage(Options & options)
+       {
+               options.usage(std::cout, "key-files...");
+               printf(k_usageText, k_toolName);
+       }
+       
+       /*!
+        * Core of the tool. Calls processOptions() to handle command line options
+        * before performing the real work the tool does.
+        */
+       int run()
+       {
+               try
+               {
+                       // read command line options
+                       int result;
+                       if ((result = processOptions()) != -1)
+                       {
+                               return result;
+                       }
+                       
+                       // set verbose logging
+                       setVerboseLogging();
+                       
+                       // make sure a file was provided
+                       if (m_positionalArgs.size() < 1)
+                       {
+                               throw std::runtime_error("no output file path was provided");
+                       }
+                       
+                       // generate key files
+                       string_vector_t::const_iterator it = m_positionalArgs.begin();
+                       for (; it != m_positionalArgs.end(); ++it)
+                       {
+                               generateKeyFile(*it);
+                       }
+               }
+               catch (std::exception & e)
+               {
+                       Log::log(Logger::ERROR, "error: %s\n", e.what());
+                       return 1;
+               }
+               catch (...)
+               {
+                       Log::log(Logger::ERROR, "error: unexpected exception\n");
+                       return 1;
+               }
+               
+               return 0;
+       }
+       
+       /*!
+        * \brief Turns on verbose logging.
+        */
+       void setVerboseLogging()
+       {
+               if (m_isVerbose)
+               {
+                       // verbose only affects the INFO and DEBUG filter levels
+                       // if the user has selected quiet mode, it overrides verbose
+                       switch (Log::getLogger()->getFilterLevel())
+                       {
+                               case Logger::INFO:
+                                       Log::getLogger()->setFilterLevel(Logger::INFO2);
+                                       break;
+                               case Logger::DEBUG:
+                                       Log::getLogger()->setFilterLevel(Logger::DEBUG2);
+                                       break;
+                       }
+               }
+       }
+       
+       /*!
+        * \brief Opens the file at \a path and writes a random key file.
+        *
+        * Each key file will have #m_keyCount number of keys written into it,
+        * each on a line by itself.
+        */
+       void generateKeyFile(const std::string & path)
+       {
+               std::ofstream outputStream(path.c_str(), std::ios_base::binary | std::ios_base::out | std::ios_base::trunc);
+               if (outputStream.is_open())
+               {
+                       int i;
+                       for (i = 0; i < m_keyCount; ++i)
+                       {
+                               AESKey<128> key;
+                               key.randomize();
+                               key.writeToStream(outputStream);
+                               
+                               // put a newline after the key
+                               outputStream.write("\n", 1);
+                               
+                               // dump it
+                               dumpKey(key);
+                       }
+                       
+                       Log::log(Logger::INFO, "wrote key file %s\n", path.c_str());
+               }
+               else
+               {
+                       throw std::runtime_error("could not open output file");
+               }
+       }
+       
+       /*!
+        * \brief Write the value of each byte of the \a key to the log.
+        */
+       void dumpKey(const AESKey<128> & key)
+       {
+               // dump key bytes
+               Log::log(Logger::INFO2, "key bytes: ");
+               AESKey<128>::key_t the_key;
+               key.getKey(&the_key);
+               int q;
+               for (q=0; q<16; q++)
+               {
+                       Log::log(Logger::INFO2, "%02x ", the_key[q]);
+               }
+               Log::log(Logger::INFO2, "\n");
+       }
+       
+       /*!
+        * \brief Log an array of bytes as hex.
+        */
+       void logHexArray(Logger::log_level_t level, const uint8_t * bytes, unsigned count)
+       {
+               Log::SetOutputLevel leveler(level);
+//             Log::log("    ");
+               unsigned i;
+               for (i = 0; i < count; ++i, ++bytes)
+               {
+                       if ((i % 16 == 0) && (i < count - 1))
+                       {
+                               if (i != 0)
+                               {
+                                       Log::log("\n");
+                               }
+                               Log::log("    0x%04x: ", i);
+                       }
+                       Log::log("%02x ", *bytes & 0xff);
+               }
+               
+               Log::log("\n");
+       }
+
+};
+
+/*!
+ * Main application entry point. Creates an sbtool instance and lets it take over.
+ */
+int main(int argc, char* argv[], char* envp[])
+{
+       try
+       {
+               return keygen(argc, argv).run();
+       }
+       catch (...)
+       {
+               Log::log(Logger::ERROR, "error: unexpected exception\n");
+               return 1;
+       }
+
+       return 0;
+}
+
+
+
+
+
diff --git a/tools/elftosb/keygen/keygen.vcproj b/tools/elftosb/keygen/keygen.vcproj
new file mode 100644 (file)
index 0000000..eda4af3
--- /dev/null
@@ -0,0 +1,478 @@
+<?xml version="1.0" encoding="Windows-1252"?>\r
+<VisualStudioProject\r
+       ProjectType="Visual C++"\r
+       Version="9.00"\r
+       Name="keygen"\r
+       ProjectGUID="{09633A11-9AB3-4118-B83A-5D6CAFDBE74F}"\r
+       Keyword="Win32Proj"\r
+       TargetFrameworkVersion="131072"\r
+       >\r
+       <Platforms>\r
+               <Platform\r
+                       Name="Win32"\r
+               />\r
+       </Platforms>\r
+       <ToolFiles>\r
+       </ToolFiles>\r
+       <Configurations>\r
+               <Configuration\r
+                       Name="Debug|Win32"\r
+                       OutputDirectory="Debug"\r
+                       IntermediateDirectory="Debug"\r
+                       ConfigurationType="1"\r
+                       InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"\r
+                       CharacterSet="2"\r
+                       >\r
+                       <Tool\r
+                               Name="VCPreBuildEventTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCCustomBuildTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCXMLDataGeneratorTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCWebServiceProxyGeneratorTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCMIDLTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCCLCompilerTool"\r
+                               Optimization="0"\r
+                               AdditionalIncludeDirectories="..\winsupport;..\elftosb2;..\common"\r
+                               PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"\r
+                               MinimalRebuild="true"\r
+                               BasicRuntimeChecks="3"\r
+                               RuntimeLibrary="1"\r
+                               RuntimeTypeInfo="true"\r
+                               UsePrecompiledHeader="0"\r
+                               WarningLevel="2"\r
+                               Detect64BitPortabilityProblems="true"\r
+                               DebugInformationFormat="4"\r
+                               DisableSpecificWarnings="4355"\r
+                       />\r
+                       <Tool\r
+                               Name="VCManagedResourceCompilerTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCResourceCompilerTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCPreLinkEventTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCLinkerTool"\r
+                               OutputFile="$(OutDir)/keygen.exe"\r
+                               LinkIncremental="2"\r
+                               GenerateDebugInformation="true"\r
+                               ProgramDatabaseFile="$(OutDir)/keygen.pdb"\r
+                               SubSystem="1"\r
+                               RandomizedBaseAddress="1"\r
+                               DataExecutionPrevention="0"\r
+                               TargetMachine="1"\r
+                       />\r
+                       <Tool\r
+                               Name="VCALinkTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCManifestTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCXDCMakeTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCBscMakeTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCFxCopTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCAppVerifierTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCPostBuildEventTool"\r
+                       />\r
+               </Configuration>\r
+               <Configuration\r
+                       Name="Release|Win32"\r
+                       OutputDirectory="Release"\r
+                       IntermediateDirectory="Release"\r
+                       ConfigurationType="1"\r
+                       InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"\r
+                       CharacterSet="2"\r
+                       >\r
+                       <Tool\r
+                               Name="VCPreBuildEventTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCCustomBuildTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCXMLDataGeneratorTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCWebServiceProxyGeneratorTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCMIDLTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCCLCompilerTool"\r
+                               PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"\r
+                               RuntimeLibrary="0"\r
+                               UsePrecompiledHeader="0"\r
+                               WarningLevel="3"\r
+                               Detect64BitPortabilityProblems="true"\r
+                               DebugInformationFormat="3"\r
+                       />\r
+                       <Tool\r
+                               Name="VCManagedResourceCompilerTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCResourceCompilerTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCPreLinkEventTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCLinkerTool"\r
+                               OutputFile="$(OutDir)/keygen.exe"\r
+                               LinkIncremental="1"\r
+                               GenerateDebugInformation="true"\r
+                               SubSystem="1"\r
+                               OptimizeReferences="2"\r
+                               EnableCOMDATFolding="2"\r
+                               RandomizedBaseAddress="1"\r
+                               DataExecutionPrevention="0"\r
+                               TargetMachine="1"\r
+                       />\r
+                       <Tool\r
+                               Name="VCALinkTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCManifestTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCXDCMakeTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCBscMakeTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCFxCopTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCAppVerifierTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCPostBuildEventTool"\r
+                       />\r
+               </Configuration>\r
+       </Configurations>\r
+       <References>\r
+       </References>\r
+       <Files>\r
+               <Filter\r
+                       Name="Source Files"\r
+                       Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"\r
+                       UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"\r
+                       >\r
+                       <Filter\r
+                               Name="keygen"\r
+                               >\r
+                               <File\r
+                                       RelativePath=".\keygen.cpp"\r
+                                       >\r
+                               </File>\r
+                       </Filter>\r
+                       <Filter\r
+                               Name="common"\r
+                               >\r
+                               <File\r
+                                       RelativePath="..\common\AESKey.cpp"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath="..\common\AESKey.h"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath="..\common\Blob.cpp"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath="..\common\Blob.h"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath="..\common\BootImage.h"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath="..\common\crc.cpp"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath="..\common\crc.h"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath="..\common\DataSource.cpp"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath="..\common\DataSource.h"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath="..\common\DataTarget.cpp"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath="..\common\DataTarget.h"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath="..\common\ELF.h"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath="..\common\ELFSourceFile.cpp"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath="..\common\ELFSourceFile.h"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath="..\common\EncoreBootImage.cpp"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath="..\common\EncoreBootImage.h"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath="..\common\EndianUtilities.h"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath="..\common\EvalContext.cpp"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath="..\common\EvalContext.h"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath="..\common\format_string.cpp"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath="..\common\format_string.h"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath="..\common\GHSSecInfo.cpp"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath="..\common\GHSSecInfo.h"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath="..\common\GlobMatcher.cpp"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath="..\common\GlobMatcher.h"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath="..\common\HexValues.cpp"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath="..\common\HexValues.h"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath="..\common\int_size.h"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath="..\common\Logging.cpp"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath="..\common\Logging.h"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath="..\common\Operation.cpp"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath="..\common\Operation.h"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath="..\common\OptionContext.h"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath="..\common\OptionDictionary.cpp"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath="..\common\OptionDictionary.h"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath="..\common\options.cpp"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath="..\common\options.h"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath="..\common\OutputSection.cpp"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath="..\common\OutputSection.h"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath="..\common\Random.cpp"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath="..\common\Random.h"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath="..\common\rijndael.cpp"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath="..\common\rijndael.h"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath="..\common\RijndaelCBCMAC.cpp"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath="..\common\RijndaelCBCMAC.h"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath="..\common\SearchPath.cpp"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath="..\common\SearchPath.h"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath="..\common\SHA1.cpp"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath="..\common\SHA1.h"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath="..\common\smart_ptr.h"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath="..\common\SourceFile.cpp"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath="..\common\SourceFile.h"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath="..\common\SRecordSourceFile.cpp"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath="..\common\SRecordSourceFile.h"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath="..\common\stdafx.cpp"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath="..\common\stdafx.h"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath="..\common\StELFFile.cpp"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath="..\common\StELFFile.h"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath="..\common\StExecutableImage.cpp"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath="..\common\StExecutableImage.h"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath="..\common\StringMatcher.h"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath="..\common\StSRecordFile.cpp"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath="..\common\StSRecordFile.h"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath="..\common\Value.cpp"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath="..\common\Value.h"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath="..\common\Version.cpp"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath="..\common\Version.h"\r
+                                       >\r
+                               </File>\r
+                       </Filter>\r
+               </Filter>\r
+               <Filter\r
+                       Name="Header Files"\r
+                       Filter="h;hpp;hxx;hm;inl;inc;xsd"\r
+                       UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"\r
+                       >\r
+               </Filter>\r
+               <Filter\r
+                       Name="Resource Files"\r
+                       Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"\r
+                       UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"\r
+                       >\r
+               </Filter>\r
+       </Files>\r
+       <Globals>\r
+       </Globals>\r
+</VisualStudioProject>\r
diff --git a/tools/elftosb/makefile b/tools/elftosb/makefile
new file mode 100644 (file)
index 0000000..a98e71b
--- /dev/null
@@ -0,0 +1,32 @@
+#*******************************************************************************
+#                               makefile
+# Description:
+#   gnu make makefile for elftosb executable
+#*******************************************************************************
+#                               Environment
+
+# UNAMES is going to be set to either "Linux" or "CYGWIN_NT-5.1"
+UNAMES = $(shell uname -s)
+
+ifeq ("${UNAMES}", "Linux")
+
+SRC_DIR = $(shell pwd)
+BUILD_DIR = bld/linux
+
+else 
+ifeq ("${UNAMES}", "CYGWIN_NT-5.1")
+
+SRC_DIR = $(shell pwd)
+BUILD_DIR = bld/cygwin
+
+endif
+endif
+
+
+#*******************************************************************************
+#                                 Targets
+
+all clean elftosb sbtool keygen:
+       @mkdir -p ${BUILD_DIR};
+       make -C ${BUILD_DIR} -f ${SRC_DIR}/makefile.rules SRC_DIR=${SRC_DIR} $@;
diff --git a/tools/elftosb/makefile.rules b/tools/elftosb/makefile.rules
new file mode 100644 (file)
index 0000000..9cd649e
--- /dev/null
@@ -0,0 +1,178 @@
+#*******************************************************************************
+#                               makefile.rules
+# Description:
+#   gnu make makefile rules for elftosb executable.  make needs to be called
+#   with the following command:
+#
+#   make -C ${BUILD_DIR} -f ${SRC_DIR}/makefile.rules SRC_DIR=${SRC_DIR} $@;
+#
+#   SRC_DIR needs to be passed in.  It is assumed that make is running in
+#   the build directory.
+
+#*******************************************************************************
+#                               Environment
+
+# UNAMES is going to be set to either "Linux" or "CYGWIN_NT-5.1"
+UNAMES = $(shell uname -s)
+
+#*******************************************************************************
+#                               Directories
+
+#*******************************************************************************
+#                               Paths
+
+# search path for source files. make finds them automatically.
+VPATH = \
+       ${SRC_DIR}/common       \
+       ${SRC_DIR}/elftosb2 \
+       ${SRC_DIR}/sbtool       \
+       ${SRC_DIR}/keygen
+
+# include directories
+INC_PATH =                      \
+    -I${SRC_DIR}/elftosb2        \
+    -I${SRC_DIR}/keygen   \
+    -I${SRC_DIR}/sbtool      \
+       -I${SRC_DIR}/common
+
+#*******************************************************************************
+#                               Build flags
+# gcc Compiler flags
+#    -g                                                : Produce debugging information.
+
+CFLAGS     = -g $(INC_PATH) -D${UNAMES}
+
+#*******************************************************************************
+#                               File lists
+
+OBJ_FILES_COMMON =                     \
+       AESKey.o        \
+       Blob.o  \
+       crc.o   \
+       DataSource.o    \
+       DataTarget.o    \
+       ELFSourceFile.o \
+       EncoreBootImage.o       \
+       EvalContext.o   \
+       GHSSecInfo.o    \
+       GlobMatcher.o   \
+       HexValues.o \
+       Logging.o       \
+       Operation.o \
+       OptionDictionary.o      \
+       options.o       \
+       OutputSection.o \
+       Random.o        \
+       RijndaelCBCMAC.o        \
+       rijndael.o      \
+       SHA1.o  \
+       SourceFile.o    \
+       SRecordSourceFile.o \
+       stdafx.o        \
+       StELFFile.o \
+       StExecutableImage.o \
+       StSRecordFile.o \
+       Value.o \
+       Version.o \
+       format_string.o \
+       ExcludesListMatcher.o \
+       SearchPath.o    \
+       DataSourceImager.o \
+       IVTDataSource.o
+
+OBJ_FILES_ELFTOSB2 =           \
+       ${OBJ_FILES_COMMON} \
+       BootImageGenerator.o    \
+       ConversionController.o  \
+       ElftosbAST.o    \
+       elftosb.o       \
+       elftosb_lexer.o \
+       ElftosbLexer.o  \
+       elftosb_parser.tab.o    \
+       EncoreBootImageGenerator.o
+
+OBJ_FILES_SBTOOL =                     \
+       ${OBJ_FILES_COMMON} \
+       EncoreBootImageReader.o \
+       sbtool.o
+
+OBJ_FILES_KEYGEN =                     \
+       ${OBJ_FILES_COMMON} \
+       keygen.o
+
+
+LIBS =     -lstdc++
+
+
+ifeq ("${UNAMES}", "Linux")
+EXEC_FILE_ELFTOSB2 = elftosb
+EXEC_FILE_SBTOOL = sbtool
+EXEC_FILE_KEYGEN = keygen
+else 
+ifeq ("${UNAMES}", "CYGWIN_NT-5.1")
+EXEC_FILE_ELFTOSB2 = elftosb.exe
+EXEC_FILE_SBTOOL = sbtool.exe
+EXEC_FILE_KEYGEN = keygen.exe
+endif # ifeq ("${UNAMES}", "CYGWIN_NT-5.1")
+endif # ifeq ("${UNAMES}", "Linux")
+
+
+#*******************************************************************************
+#                                 Targets
+
+all: elftosb sbtool keygen
+
+# Uncomment the next line to print out the environment variables.
+all: exec_always
+
+exec_always:
+       @echo "SRC_DIR = ${SRC_DIR}"
+       @echo "OBJ_FILES = ${OBJ_FILES_ELFTOSB2}"
+       @echo "LIBS = ${LIBS}"
+       @echo "EXEC_FILE = ${EXEC_FILE}"
+       @echo "BUILD_DIR = ${BUILD_DIR}"
+
+clean:
+       rm -f ${OBJ_FILES_ELFTOSB2} ${OBJ_FILES_SBTOOL} ${OBJ_FILES_KEYGEN} \
+               ${EXEC_FILE_ELFTOSB2} ${EXEC_FILE_SBTOOL} ${EXEC_FILE_KEYGEN}
+
+elftosb: ${OBJ_FILES_ELFTOSB2}
+       gcc ${OBJ_FILES_ELFTOSB2} ${LIBS} -o ${EXEC_FILE_ELFTOSB2}
+
+sbtool: ${OBJ_FILES_SBTOOL}
+       gcc ${OBJ_FILES_SBTOOL} ${LIBS} -o ${EXEC_FILE_SBTOOL}
+
+keygen: ${OBJ_FILES_KEYGEN}
+       gcc ${OBJ_FILES_KEYGEN} ${LIBS} -o ${EXEC_FILE_KEYGEN}
+
+
+#ifeq ("${UNAMES}", "Linux")
+#ifeq ("${UNAMES}", "Linux")
+# Use default rules for creating all the .o files from the .c files.  Only
+# for linux
+.SUFFIXES : .c .cpp
+
+.c.o :
+       gcc ${CFLAGS} -c $<
+
+.cpp.o :
+       gcc ${CFLAGS} -c $<
+
+#endif
+
+#*******************************************************************************
+#                       Automatic dependency generation
+
+%.d: %.c
+       @set -e; \
+       $(CC) -MM $(CFLAGS) $< | \
+       sed 's/\($*\)\.o[ :]*/\1.o $@ : /g' > $@; \
+       [ -s $@ ]  || rm -f $@
+
+%.d: %.cpp
+       @set -e; \
+       $(CC) -MM $(CFLAGS) $< | \
+       sed 's/\($*\)\.o[ :]*/\1.o $@ : /g' > $@; \
+       [ -s $@ ]  || rm -f $@
+
+#*******************************************************************************
diff --git a/tools/elftosb/sbtool/Doxyfile b/tools/elftosb/sbtool/Doxyfile
new file mode 100644 (file)
index 0000000..0b20ed1
--- /dev/null
@@ -0,0 +1,250 @@
+# Doxyfile 1.3.9
+
+#---------------------------------------------------------------------------
+# Project related configuration options
+#---------------------------------------------------------------------------
+PROJECT_NAME           = sbtool
+PROJECT_NUMBER         = 1.0
+OUTPUT_DIRECTORY       = .
+CREATE_SUBDIRS         = YES
+OUTPUT_LANGUAGE        = English
+USE_WINDOWS_ENCODING   = YES
+BRIEF_MEMBER_DESC      = YES
+REPEAT_BRIEF           = YES
+ABBREVIATE_BRIEF       = "The $name class" \
+                         "The $name widget" \
+                         "The $name file" \
+                         is \
+                         provides \
+                         specifies \
+                         contains \
+                         represents \
+                         a \
+                         an \
+                         the
+ALWAYS_DETAILED_SEC    = NO
+INLINE_INHERITED_MEMB  = NO
+FULL_PATH_NAMES        = NO
+STRIP_FROM_PATH        = "/Users/creed/projects/elftosb/sbtool" \
+                                                "/Users/creed/projects/sgtl/elftosb/sbtool" \
+                                                "/Users/creed/projects/elftosb/common" \
+                                                "/Users/creed/projects/sgtl/elftosb/common"
+STRIP_FROM_INC_PATH    = 
+SHORT_NAMES            = NO
+JAVADOC_AUTOBRIEF      = NO
+MULTILINE_CPP_IS_BRIEF = NO
+DETAILS_AT_TOP         = YES
+INHERIT_DOCS           = YES
+DISTRIBUTE_GROUP_DOC   = NO
+TAB_SIZE               = 4
+ALIASES                = 
+OPTIMIZE_OUTPUT_FOR_C  = NO
+OPTIMIZE_OUTPUT_JAVA   = NO
+SUBGROUPING            = YES
+#---------------------------------------------------------------------------
+# Build related configuration options
+#---------------------------------------------------------------------------
+EXTRACT_ALL            = YES
+EXTRACT_PRIVATE        = YES
+EXTRACT_STATIC         = YES
+EXTRACT_LOCAL_CLASSES  = YES
+EXTRACT_LOCAL_METHODS  = NO
+HIDE_UNDOC_MEMBERS     = NO
+HIDE_UNDOC_CLASSES     = NO
+HIDE_FRIEND_COMPOUNDS  = NO
+HIDE_IN_BODY_DOCS      = NO
+INTERNAL_DOCS          = NO
+CASE_SENSE_NAMES       = NO
+HIDE_SCOPE_NAMES       = NO
+SHOW_INCLUDE_FILES     = YES
+INLINE_INFO            = YES
+SORT_MEMBER_DOCS       = YES
+SORT_BRIEF_DOCS        = NO
+SORT_BY_SCOPE_NAME     = NO
+GENERATE_TODOLIST      = YES
+GENERATE_TESTLIST      = YES
+GENERATE_BUGLIST       = YES
+GENERATE_DEPRECATEDLIST= YES
+ENABLED_SECTIONS       = 
+MAX_INITIALIZER_LINES  = 30
+SHOW_USED_FILES        = YES
+SHOW_DIRECTORIES       = YES
+#---------------------------------------------------------------------------
+# configuration options related to warning and progress messages
+#---------------------------------------------------------------------------
+QUIET                  = NO
+WARNINGS               = YES
+WARN_IF_UNDOCUMENTED   = YES
+WARN_IF_DOC_ERROR      = YES
+WARN_FORMAT            = "$file:$line: $text"
+WARN_LOGFILE           = 
+#---------------------------------------------------------------------------
+# configuration options related to the input files
+#---------------------------------------------------------------------------
+INPUT                  = . ../common
+FILE_PATTERNS          = *.c \
+                         *.cc \
+                         *.cxx \
+                         *.cpp \
+                         *.c++ \
+                         *.java \
+                         *.ii \
+                         *.ixx \
+                         *.ipp \
+                         *.i++ \
+                         *.inl \
+                         *.h \
+                         *.hh \
+                         *.hxx \
+                         *.hpp \
+                         *.h++ \
+                         *.idl \
+                         *.odl \
+                         *.cs \
+                         *.php \
+                         *.php3 \
+                         *.inc \
+                         *.m \
+                         *.mm
+RECURSIVE              = NO
+EXCLUDE                = 
+EXCLUDE_SYMLINKS       = NO
+EXCLUDE_PATTERNS       = 
+EXAMPLE_PATH           = 
+EXAMPLE_PATTERNS       = *
+EXAMPLE_RECURSIVE      = NO
+IMAGE_PATH             = 
+INPUT_FILTER           = 
+FILTER_PATTERNS        = 
+FILTER_SOURCE_FILES    = NO
+#---------------------------------------------------------------------------
+# configuration options related to source browsing
+#---------------------------------------------------------------------------
+SOURCE_BROWSER         = NO
+INLINE_SOURCES         = NO
+STRIP_CODE_COMMENTS    = YES
+REFERENCED_BY_RELATION = NO
+REFERENCES_RELATION    = NO
+VERBATIM_HEADERS       = NO
+#---------------------------------------------------------------------------
+# configuration options related to the alphabetical class index
+#---------------------------------------------------------------------------
+ALPHABETICAL_INDEX     = NO
+COLS_IN_ALPHA_INDEX    = 5
+IGNORE_PREFIX          = 
+#---------------------------------------------------------------------------
+# configuration options related to the HTML output
+#---------------------------------------------------------------------------
+GENERATE_HTML          = YES
+HTML_OUTPUT            = html
+HTML_FILE_EXTENSION    = .html
+HTML_HEADER            = 
+HTML_FOOTER            = 
+HTML_STYLESHEET        = 
+HTML_ALIGN_MEMBERS     = YES
+GENERATE_HTMLHELP      = NO
+CHM_FILE               = 
+HHC_LOCATION           = 
+GENERATE_CHI           = NO
+BINARY_TOC             = NO
+TOC_EXPAND             = NO
+DISABLE_INDEX          = NO
+ENUM_VALUES_PER_LINE   = 4
+GENERATE_TREEVIEW      = YES
+TREEVIEW_WIDTH         = 250
+#---------------------------------------------------------------------------
+# configuration options related to the LaTeX output
+#---------------------------------------------------------------------------
+GENERATE_LATEX         = NO
+LATEX_OUTPUT           = latex
+LATEX_CMD_NAME         = latex
+MAKEINDEX_CMD_NAME     = makeindex
+COMPACT_LATEX          = NO
+PAPER_TYPE             = a4wide
+EXTRA_PACKAGES         = 
+LATEX_HEADER           = 
+PDF_HYPERLINKS         = NO
+USE_PDFLATEX           = NO
+LATEX_BATCHMODE        = NO
+LATEX_HIDE_INDICES     = NO
+#---------------------------------------------------------------------------
+# configuration options related to the RTF output
+#---------------------------------------------------------------------------
+GENERATE_RTF           = NO
+RTF_OUTPUT             = rtf
+COMPACT_RTF            = NO
+RTF_HYPERLINKS         = NO
+RTF_STYLESHEET_FILE    = 
+RTF_EXTENSIONS_FILE    = 
+#---------------------------------------------------------------------------
+# configuration options related to the man page output
+#---------------------------------------------------------------------------
+GENERATE_MAN           = NO
+MAN_OUTPUT             = man
+MAN_EXTENSION          = .3
+MAN_LINKS              = NO
+#---------------------------------------------------------------------------
+# configuration options related to the XML output
+#---------------------------------------------------------------------------
+GENERATE_XML           = NO
+XML_OUTPUT             = xml
+XML_SCHEMA             = 
+XML_DTD                = 
+XML_PROGRAMLISTING     = YES
+#---------------------------------------------------------------------------
+# configuration options for the AutoGen Definitions output
+#---------------------------------------------------------------------------
+GENERATE_AUTOGEN_DEF   = NO
+#---------------------------------------------------------------------------
+# configuration options related to the Perl module output
+#---------------------------------------------------------------------------
+GENERATE_PERLMOD       = NO
+PERLMOD_LATEX          = NO
+PERLMOD_PRETTY         = YES
+PERLMOD_MAKEVAR_PREFIX = 
+#---------------------------------------------------------------------------
+# Configuration options related to the preprocessor   
+#---------------------------------------------------------------------------
+ENABLE_PREPROCESSING   = YES
+MACRO_EXPANSION        = NO
+EXPAND_ONLY_PREDEF     = NO
+SEARCH_INCLUDES        = YES
+INCLUDE_PATH           = 
+INCLUDE_FILE_PATTERNS  = 
+PREDEFINED             = 
+EXPAND_AS_DEFINED      = 
+SKIP_FUNCTION_MACROS   = YES
+#---------------------------------------------------------------------------
+# Configuration::additions related to external references   
+#---------------------------------------------------------------------------
+TAGFILES               = 
+GENERATE_TAGFILE       = 
+ALLEXTERNALS           = NO
+EXTERNAL_GROUPS        = YES
+PERL_PATH              = /usr/bin/perl
+#---------------------------------------------------------------------------
+# Configuration options related to the dot tool   
+#---------------------------------------------------------------------------
+CLASS_DIAGRAMS         = NO
+HIDE_UNDOC_RELATIONS   = YES
+HAVE_DOT               = NO
+CLASS_GRAPH            = YES
+COLLABORATION_GRAPH    = YES
+UML_LOOK               = NO
+TEMPLATE_RELATIONS     = NO
+INCLUDE_GRAPH          = YES
+INCLUDED_BY_GRAPH      = YES
+CALL_GRAPH             = NO
+GRAPHICAL_HIERARCHY    = YES
+DOT_IMAGE_FORMAT       = png
+DOT_PATH               = 
+DOTFILE_DIRS           = 
+MAX_DOT_GRAPH_WIDTH    = 1024
+MAX_DOT_GRAPH_HEIGHT   = 1024
+MAX_DOT_GRAPH_DEPTH    = 1000
+GENERATE_LEGEND        = YES
+DOT_CLEANUP            = YES
+#---------------------------------------------------------------------------
+# Configuration::additions related to the search engine   
+#---------------------------------------------------------------------------
+SEARCHENGINE           = NO
diff --git a/tools/elftosb/sbtool/EncoreBootImageReader.cpp b/tools/elftosb/sbtool/EncoreBootImageReader.cpp
new file mode 100644 (file)
index 0000000..b6eb474
--- /dev/null
@@ -0,0 +1,370 @@
+/*
+ * File:       EncoreBootImageReader.cpp
+ *
+ * Copyright (c) Freescale Semiconductor, Inc. All rights reserved.
+ * See included license file for license details.
+ */
+
+#include "EncoreBootImageReader.h"
+#include "SHA1.h"
+#include "rijndael.h"
+#include "RijndaelCBCMAC.h"
+#include <assert.h>
+#include "EndianUtilities.h"
+#include "Logging.h"
+
+using namespace elftosb;
+
+//! \post Stream head points to just after the image header.
+//! \exception read_error Thrown if the image header is invalid.
+void EncoreBootImageReader::readImageHeader()
+{
+       // seek to beginning of the stream/file and read the plaintext header
+       m_stream.seekg(0, std::ios_base::beg);
+       if (m_stream.read((char *)&m_header, sizeof(m_header)).bad())
+       {
+               throw read_error("failed to read image header");
+       }
+       
+       m_header.m_flags = ENDIAN_LITTLE_TO_HOST_U16(m_header.m_flags);
+       m_header.m_imageBlocks = ENDIAN_LITTLE_TO_HOST_U32(m_header.m_imageBlocks);
+       m_header.m_firstBootTagBlock = ENDIAN_LITTLE_TO_HOST_U32(m_header.m_firstBootTagBlock);
+       m_header.m_firstBootableSectionID = ENDIAN_LITTLE_TO_HOST_U32(m_header.m_firstBootableSectionID);
+       m_header.m_keyCount = ENDIAN_LITTLE_TO_HOST_U16(m_header.m_keyCount);
+       m_header.m_keyDictionaryBlock = ENDIAN_LITTLE_TO_HOST_U16(m_header.m_keyDictionaryBlock);
+       m_header.m_headerBlocks = ENDIAN_LITTLE_TO_HOST_U16(m_header.m_headerBlocks);
+       m_header.m_sectionCount = ENDIAN_LITTLE_TO_HOST_U16(m_header.m_sectionCount);
+       m_header.m_sectionHeaderSize = ENDIAN_LITTLE_TO_HOST_U16(m_header.m_sectionHeaderSize);
+       m_header.m_timestamp = ENDIAN_LITTLE_TO_HOST_U64(m_header.m_timestamp);
+
+//     m_header.m_componentVersion.m_major = ENDIAN_BIG_TO_HOST_U16(m_header.m_componentVersion.m_major);
+//     m_header.m_componentVersion.m_minor = ENDIAN_BIG_TO_HOST_U16(m_header.m_componentVersion.m_minor);
+//     m_header.m_componentVersion.m_revision = ENDIAN_BIG_TO_HOST_U16(m_header.m_componentVersion.m_revision);
+
+//     m_header.m_productVersion.m_major = ENDIAN_BIG_TO_HOST_U16(m_header.m_productVersion.m_major);
+//     m_header.m_productVersion.m_minor = ENDIAN_BIG_TO_HOST_U16(m_header.m_productVersion.m_minor);
+//     m_header.m_productVersion.m_revision = ENDIAN_BIG_TO_HOST_U16(m_header.m_productVersion.m_revision);
+       
+       // check header signature 1
+       if (m_header.m_signature[0] != 'S' || m_header.m_signature[1] != 'T' || m_header.m_signature[2] != 'M' || m_header.m_signature[3] != 'P')
+       {
+               throw read_error("invalid signature 1");
+       }
+
+       // check header signature 2 for version 1.1 and greater
+       if ((m_header.m_majorVersion > 1 || (m_header.m_majorVersion == 1 && m_header.m_minorVersion >= 1)) && (m_header.m_signature2[0] != 's' || m_header.m_signature2[1] != 'g' || m_header.m_signature2[2] != 't' || m_header.m_signature2[3] != 'l'))
+       {
+//             throw read_error("invalid signature 2");
+               Log::log(Logger::WARNING, "warning: invalid signature 2\n");
+       }
+}
+
+//! \pre The image header must have already been read with a call to readImageHeader().
+//!
+void EncoreBootImageReader::computeHeaderDigest(sha1_digest_t & digest)
+{
+       CSHA1 hash;
+       hash.Reset();
+       hash.Update((uint8_t *)&m_header.m_signature, sizeof(m_header) - sizeof(sha1_digest_t));
+       hash.Final();
+       hash.GetHash(digest);
+}
+
+//! \pre The image header must have already been read.
+//! \pre The DEK must have been found already.
+//! \post The stream head is at the end of the digest.
+void EncoreBootImageReader::readImageDigest()
+{
+       unsigned digestPosition = sizeOfCipherBlocks(m_header.m_imageBlocks - 2);
+       m_stream.seekg(digestPosition, std::ios_base::beg);
+       
+       // read the two cipher blocks containing the digest, including padding
+       cipher_block_t digestBlocks[2];
+       if (m_stream.read((char *)&digestBlocks, sizeof(digestBlocks)).bad())
+       {
+               throw read_error("failed to read image digest");
+       }
+       
+       // decrypt the digest
+       if (isEncrypted())
+       {
+               Rijndael cipher;
+               cipher.init(Rijndael::CBC, Rijndael::Decrypt, m_dek, Rijndael::Key16Bytes, m_header.m_iv);
+               cipher.blockDecrypt((uint8_t *)&digestBlocks, sizeof(digestBlocks) * 8, (uint8_t *)&digestBlocks);
+       }
+       
+       // copy the digest out of the padded blocks
+       memcpy(m_digest, &digestBlocks, sizeof(m_digest));
+}
+
+//! \pre The image header must have already been read with a call to readImageHeader().
+//! \post The stream head is at the end of the image minus the last two cipher blocks.
+//! \param digest Where to store the resulting digest.
+//! \exception read_error Thrown if the image header is invalid.
+void EncoreBootImageReader::computeImageDigest(sha1_digest_t & digest)
+{
+       m_stream.seekg(0, std::ios_base::beg);
+       
+       CSHA1 hash;
+       hash.Reset();
+       
+       unsigned blockCount = m_header.m_imageBlocks - 2; // exclude digest at end of image
+       while (blockCount--)
+       {
+               cipher_block_t block;
+               if (m_stream.read((char *)&block, sizeof(block)).bad())
+               {
+                       throw read_error("failed to read block while computing image digest");
+               }
+               hash.Update(block, sizeof(block));
+       }
+       
+       hash.Final();
+       hash.GetHash(digest);
+}
+
+//! \pre Image header must have been read before this method is called.
+//!
+void EncoreBootImageReader::readSectionTable()
+{
+       // seek to the table
+       m_stream.seekg(sizeOfCipherBlocks(m_header.m_headerBlocks), std::ios_base::beg);
+       
+       unsigned sectionCount = m_header.m_sectionCount;
+       while (sectionCount--)
+       {
+               EncoreBootImage::section_header_t header;
+               if (m_stream.read((char *)&header, sizeof(header)).bad())
+               {
+                       throw read_error("failed to read section header");
+               }
+               
+               // swizzle section header
+               header.m_tag = ENDIAN_LITTLE_TO_HOST_U32(header.m_tag);
+               header.m_offset = ENDIAN_LITTLE_TO_HOST_U32(header.m_offset);
+               header.m_length = ENDIAN_LITTLE_TO_HOST_U32(header.m_length);
+               header.m_flags = ENDIAN_LITTLE_TO_HOST_U32(header.m_flags);
+               
+               m_sections.push_back(header);
+       }
+}
+
+//! Requires that an OTP key has been provided as the sole argument. Passing the
+//! key into this method lets the caller search the key dictionary for any number
+//! of keys and determine which are valid. If \a kek is found in the dictionary,
+//! the decrypted DEK is saved and true is returned. A result of false means
+//! that \a kek was not found.
+//!
+//! \pre The image header and section table must have been read already.
+//! \post The stream head points somewhere inside the key dictionary, or just after it.
+//! \post If the search was successful, the #m_dek member will contain the decrypted
+//!            session key. Otherwise #m_dek is not modified.
+//! \param kek Search for this KEK in the dictionary.
+//! \retval true The DEK was found and decrypted. True is also returned when the
+//!            image is not encrypted at all.
+//! \retval false No matching key entry was found. The image cannot be decrypted.
+bool EncoreBootImageReader::readKeyDictionary(const AESKey<128> & kek)
+{
+       // do nothing if the image is not encrypted
+       if (!isEncrypted())
+       {
+               return true;
+       }
+       
+       // first compute a CBC-MAC over the image header with our KEK
+       RijndaelCBCMAC mac(kek);
+       mac.update((const uint8_t *)&m_header, sizeof(m_header));
+       
+       // run the CBC-MAC over each entry in the section table too
+       section_array_t::iterator it = m_sections.begin();
+       for (; it != m_sections.end(); ++it)
+       {
+               mac.update((const uint8_t *)&(*it), sizeof(EncoreBootImage::section_header_t));
+       }
+       
+       // get the CBC-MAC result
+       mac.finalize();
+       const RijndaelCBCMAC::block_t & macResult = mac.getMAC();
+       
+       // seek to the key dictionary
+       m_stream.seekg(sizeOfCipherBlocks(m_header.m_keyDictionaryBlock), std::ios_base::beg);
+       
+       // decipher each key entry
+       unsigned entries = m_header.m_keyCount;
+       while (entries--)
+       {
+               // read the entry
+               EncoreBootImage::dek_dictionary_entry_t entry;
+               if (m_stream.read((char *)&entry, sizeof(entry)).bad())
+               {
+                       throw read_error("failed to read key dictionary entry");
+               }
+               
+               // compare the CBC-MAC we computed with the one in this entry
+               if (memcmp(macResult, entry.m_mac, sizeof(cipher_block_t)) == 0)
+               {
+                       // it's a match! now decrypt this entry's key in place
+                       Rijndael cipher;
+                       cipher.init(Rijndael::CBC, Rijndael::Decrypt, kek, Rijndael::Key16Bytes, m_header.m_iv);
+                       cipher.blockDecrypt(entry.m_dek, sizeof(entry.m_dek) * 8, entry.m_dek);
+                       
+                       m_dek = entry.m_dek;
+                       memset(entry.m_dek, 0, sizeof(entry.m_dek)); // wipe the key value from memory
+                       return true;
+               }
+       }
+       
+       // if we exit the loop normally then no matching MAC was found
+       return false;
+}
+
+//! Before the boot tag is added to the #m_bootTags member, some basic checks are performed.
+//! The command tag field is checked to make sure it matches #ROM_TAG_CMD. And
+//! the checksum field is verified to be sure it's correct.
+//!
+//! After the call to this method returns, the array of boot tags is accessible
+//! with the getBootTags() method. The array is sorted in the order in which
+//! the boot tags appeared in the image.
+//!
+//! \pre Image header must have been read.
+//! \pre Key dictionary must have been read and a valid DEK found.
+//! \post The stream head is left pointing just after the last boot tag.
+//! \exception read_error A failure to read the boot tag, or a failure on one
+//!            of the consistency checks will cause this exception to be thrown.
+void EncoreBootImageReader::readBootTags()
+{
+       assert(m_header.m_firstBootTagBlock != 0);
+       
+       unsigned bootTagOffset = m_header.m_firstBootTagBlock;
+       
+       while (1)
+       {
+               // seek to this boot tag and read it into a temporary buffer
+               EncoreBootImage::boot_command_t header;
+               m_stream.seekg(sizeOfCipherBlocks(bootTagOffset), std::ios_base::beg);
+               if (m_stream.read((char *)&header, sizeof(header)).bad())
+               {
+                       throw read_error("failed to read boot tag");
+               }
+               
+               // swizzle to command header
+               header.m_flags = ENDIAN_LITTLE_TO_HOST_U16(header.m_flags);
+               header.m_address = ENDIAN_LITTLE_TO_HOST_U32(header.m_address);
+               header.m_count = ENDIAN_LITTLE_TO_HOST_U32(header.m_count);
+               header.m_data = ENDIAN_LITTLE_TO_HOST_U32(header.m_data);
+               
+               // decrypt in place
+               if (isEncrypted())
+               {
+                       Rijndael cipher;
+                       cipher.init(Rijndael::CBC, Rijndael::Decrypt, m_dek, Rijndael::Key16Bytes, m_header.m_iv);
+                       cipher.blockDecrypt((uint8_t *)&header, sizeof(header) * 8, (uint8_t *)&header);
+               }
+               
+               // perform some basic checks
+               if (header.m_tag != EncoreBootImage::ROM_TAG_CMD)
+               {
+                       throw read_error("boot tag is wrong command type");
+               }
+               
+               uint8_t checksum = calculateCommandChecksum(header);
+               if (checksum != header.m_checksum)
+               {
+                       throw read_error("boot tag checksum is invalid");
+               }
+               
+               // save this boot tag
+               m_bootTags.push_back(header);
+               
+               // and finally, update offset and break out of loop
+               bootTagOffset += header.m_count + 1; // include this boot tag in offset
+               if (header.m_flags & EncoreBootImage::ROM_LAST_TAG || bootTagOffset >= m_header.m_imageBlocks - 2)
+               {
+                       break;
+               }
+       }
+}
+
+uint8_t EncoreBootImageReader::calculateCommandChecksum(EncoreBootImage::boot_command_t & header)
+{
+       uint8_t * bytes = reinterpret_cast<uint8_t *>(&header);
+       uint8_t checksum = 0x5a;
+       int i;
+       
+       // start at one to skip checksum field
+       for (i = 1; i < sizeof(header); ++i)
+       {
+               checksum += bytes[i];
+       }
+       
+       return checksum;
+}
+
+//! \param index The index of the section to read.
+//!
+//! \pre Both the image header and section table must have been read already before
+//!            calling this method.
+//! \exception read_error This exception is raised if the stream reports an error while
+//!            trying to read from the section.
+EncoreBootImage::Section * EncoreBootImageReader::readSection(unsigned index)
+{
+       // look up section header
+       assert(index < m_sections.size());
+       EncoreBootImage::section_header_t & header = m_sections[index];
+       
+       // seek to the section
+       m_stream.seekg(sizeOfCipherBlocks(header.m_offset), std::ios_base::beg);
+       
+       uint8_t * contents = NULL;
+       try
+       {
+               // allocate memory for the section contents and read the whole thing
+               unsigned contentLength = sizeOfCipherBlocks(header.m_length);
+               contents = new uint8_t[contentLength];
+               if (m_stream.read((char *)contents, contentLength).bad())
+               {
+                       throw read_error("failed to read section");
+               }
+               
+               // decrypt the entire section at once, if the image is encrypted and
+               // the cleartext flag is not set
+               if (isEncrypted() && (header.m_flags & EncoreBootImage::ROM_SECTION_CLEARTEXT) == 0)
+               {
+                       Rijndael cipher;
+                       cipher.init(Rijndael::CBC, Rijndael::Decrypt, m_dek, Rijndael::Key16Bytes, m_header.m_iv);
+                       cipher.blockDecrypt(contents, contentLength * 8, contents);
+               }
+               
+               // create section object
+               EncoreBootImage::Section * resultSection = NULL;
+               if (header.m_flags & EncoreBootImage::ROM_SECTION_BOOTABLE)
+               {
+                       // a boot command section.
+                       EncoreBootImage::BootSection * bootSection = new EncoreBootImage::BootSection(header.m_tag);
+                       
+                       bootSection->fillFromData((cipher_block_t *)contents, header.m_length);
+                       
+                       resultSection = bootSection;
+               }
+               else
+               {
+                       // this is a raw data section
+                       EncoreBootImage::DataSection * dataSection = new EncoreBootImage::DataSection(header.m_tag);
+                       dataSection->setDataNoCopy(contents, contentLength);
+                       contents = NULL;
+                       resultSection = dataSection;
+               }
+               
+               return resultSection;
+       }
+       catch (...)
+       {
+               if (contents)
+               {
+                       delete [] contents;
+               }
+               throw;
+       }
+}
+
+
diff --git a/tools/elftosb/sbtool/EncoreBootImageReader.h b/tools/elftosb/sbtool/EncoreBootImageReader.h
new file mode 100644 (file)
index 0000000..6150a92
--- /dev/null
@@ -0,0 +1,117 @@
+/*
+ * File:       EncoreBootImageReader.h
+ *
+ * Copyright (c) Freescale Semiconductor, Inc. All rights reserved.
+ * See included license file for license details.
+ */
+#if !defined(_EncoreBootImageReader_h_)
+#define _EncoreBootImageReader_h_
+
+#include "EncoreBootImage.h"
+
+namespace elftosb
+{
+
+/*!
+ * \brief Reads a Piano/Encore boot image from an input stream.
+ */
+class EncoreBootImageReader
+{
+public:
+       /*!
+        * \brief Exception class used for error found while reading a boot image.
+        */
+       class read_error : public std::runtime_error
+       {
+       public:
+               //! \brief Constructor.
+               read_error(const std::string & msg) : std::runtime_error(msg) {}
+       };
+       
+       //! \brief An array of section headers.
+       typedef std::vector<EncoreBootImage::section_header_t> section_array_t;
+       
+       //! \brief An array of boot tags.
+       typedef std::vector<EncoreBootImage::boot_command_t> boot_tag_array_t;
+       
+public:
+       //! \brief Default constructor.
+       EncoreBootImageReader(std::istream & stream) : m_stream(stream) {}
+       
+       //! \brief Destructor.
+       virtual ~EncoreBootImageReader() {}
+       
+       //! \name Decryption key
+       //! These methods provide access to the Data Encryption Key (DEK). Normally
+       //! the DEK is discovered using the readKeyDictionary() method.
+       //@{
+       inline void setKey(const AESKey<128> & key) { m_dek = key; }
+       inline const AESKey<128> & getKey() const { return m_dek; }
+       //@}
+       
+       //! \name Readers
+       //! This group of methods is responsible for reading and parsing different
+       //! pieces and parts of the boot image file.
+       //@{
+       //! \brief Reads the header from the image.
+       void readImageHeader();
+       
+       //! \brief Computes the actual SHA-1 digest of the image header.
+       void computeHeaderDigest(sha1_digest_t & digest);
+       
+       //! \brief Reads the digest at the end of the image.
+       void readImageDigest();
+       
+       //! \brief Run a SHA-1 digest over the entire image.
+       void computeImageDigest(sha1_digest_t & digest);
+       
+       //! \brief Read the plaintext section table entries.
+       void readSectionTable();
+       
+       //! \brief Reads the key dictionary, if the image is encrypted.
+       bool readKeyDictionary(const AESKey<128> & kek);
+       
+       //! \brief
+       void readBootTags();
+       
+       //! \brief
+       EncoreBootImage::Section * readSection(unsigned index);
+       //@}
+       
+       //! \name Accessors
+       //! Information retrieved with reader methods is accessible through
+       //! these methods.
+       //@{
+       //! \brief Returns whether the image is encrypted or not.
+       //! \pre The header must have been read already.
+       inline bool isEncrypted() const { return m_header.m_keyCount > 0; }
+       
+       //! \brief Returns a reference to the image's header.
+       const EncoreBootImage::boot_image_header_t & getHeader() const { return m_header; }
+       
+       //! \brief Returns a reference to the SHA-1 digest read from the image.
+       const sha1_digest_t & getDigest() const { return m_digest; }
+       
+       //! \brief Returns a reference to the STL container holding the section headers.
+       inline const section_array_t & getSections() const { return m_sections; }
+       
+       //! \brief Returns a reference to the STL container holding the boot tags.
+       inline const boot_tag_array_t & getBootTags() const { return m_bootTags; }
+       //@}
+       
+protected:
+       std::istream & m_stream;        //!< The input stream to read the image from.
+       AESKey<128> m_dek;      //!< DEK (data encryption key) read from the key dictionary.
+       EncoreBootImage::boot_image_header_t m_header;  //!< Header from the boot image.
+       sha1_digest_t m_digest; //!< SHA-1 digest as read from the image.
+       section_array_t m_sections;     //!< The section table.
+       boot_tag_array_t m_bootTags;    //!< The array of boot tags read from the image.
+       
+protected:
+       //! \brief Calculates the 8-bit checksum on a boot command header.
+       uint8_t calculateCommandChecksum(EncoreBootImage::boot_command_t & header);
+};
+
+}; // namespace elftosb
+
+#endif // _EncoreBootImageReader_h_
diff --git a/tools/elftosb/sbtool/sbtool.cpp b/tools/elftosb/sbtool/sbtool.cpp
new file mode 100644 (file)
index 0000000..c83cee2
--- /dev/null
@@ -0,0 +1,626 @@
+/*
+ * File:       sbtool.cpp
+ *
+ * Copyright (c) Freescale Semiconductor, Inc. All rights reserved.
+ * See included license file for license details.
+ */
+
+#include "stdafx.h"
+#include <iostream>
+#include <fstream>
+#include <sstream>
+#include <stdlib.h>
+#include <stdexcept>
+#include <stdio.h>
+#include "options.h"
+#include "EncoreBootImage.h"
+#include "smart_ptr.h"
+#include "Logging.h"
+#include "EncoreBootImageReader.h"
+#include "format_string.h"
+
+using namespace elftosb;
+
+//! The tool's name.
+const char k_toolName[] = "sbtool";
+
+//! Current version number for the tool.
+const char k_version[] = "1.1.4";
+
+//! Copyright string.
+const char k_copyright[] = "Copyright (c) 2006-2010 Freescale Semiconductor, Inc.\nAll rights reserved.";
+
+//! Definition of command line options.
+static const char * k_optionsDefinition[] = {
+       "?|help",
+       "v|version",
+       "k:key <file>",
+       "z|zero-key",
+       "x:extract",
+       "b|binary",
+       "d|debug",
+       "q|quiet",
+       "V|verbose",
+       NULL
+};
+
+//! Help string.
+const char k_usageText[] = "\nOptions:\n\
+  -?/--help                    Show this help\n\
+  -v/--version                 Display tool version\n\
+  -k/--key <file>              Add OTP key used for decryption\n\
+  -z/--zero-key                Add default key of all zeroes\n\
+  -x/--extract <index>         Extract section number <index>\n\
+  -b/--binary                  Extract section data as binary\n\
+  -d/--debug                   Enable debug output\n\
+  -q/--quiet                   Output only warnings and errors\n\
+  -V/--verbose                 Print extra detailed log information\n\n";
+
+//! An array of strings.
+typedef std::vector<std::string> string_vector_t;
+
+// prototypes
+int main(int argc, char* argv[], char* envp[]);
+
+/*!
+ * \brief Class that encapsulates the sbtool interface.
+ *
+ * A single global logger instance is created during object construction. It is
+ * never freed because we need it up to the last possible minute, when an
+ * exception could be thrown.
+ */
+class sbtool
+{
+protected:
+       int m_argc;                                                     //!< Number of command line arguments.
+       char ** m_argv;                                         //!< String value for each command line argument.
+       StdoutLogger * m_logger;                        //!< Singleton logger instance.
+       string_vector_t m_keyFilePaths;         //!< Paths to OTP key files.
+       string_vector_t m_positionalArgs;       //!< Arguments coming after explicit options.
+       bool m_isVerbose;                                       //!< Whether the verbose flag was turned on.
+       bool m_useDefaultKey;                                   //!< Include a default (zero) crypto key.
+       bool m_doExtract;                                       //!< True if extract mode is on.
+       unsigned m_sectionIndex;                                //!< Index of section to extract.
+       bool m_extractBinary;                           //!< True if extraction output is binary, false for hex.
+       smart_ptr<EncoreBootImageReader> m_reader;      //!< Boot image reader object.
+       
+public:
+       /*!
+        * Constructor.
+        *
+        * Creates the singleton logger instance.
+        */
+       sbtool(int argc, char * argv[])
+       :       m_argc(argc),
+               m_argv(argv),
+               m_logger(0),
+               m_keyFilePaths(),
+               m_positionalArgs(),
+               m_isVerbose(false),
+               m_useDefaultKey(false),
+               m_doExtract(false),
+               m_sectionIndex(0),
+               m_extractBinary(false),
+               m_reader()
+       {
+               // create logger instance
+               m_logger = new StdoutLogger();
+               m_logger->setFilterLevel(Logger::INFO);
+               Log::setLogger(m_logger);
+       }
+       
+       /*!
+        * Destructor.
+        */
+       ~sbtool()
+       {
+       }
+       
+       /*!
+        * Reads the command line options passed into the constructor.
+        *
+        * This method can return a return code to its caller, which will cause the
+        * tool to exit immediately with that return code value. Normally, though, it
+        * will return -1 to signal that the tool should continue to execute and
+        * all options were processed successfully.
+        *
+        * The Options class is used to parse command line options. See
+        * #k_optionsDefinition for the list of options and #k_usageText for the
+        * descriptive help for each option.
+        *
+        * \retval -1 The options were processed successfully. Let the tool run normally.
+        * \return A zero or positive result is a return code value that should be
+        *              returned from the tool as it exits immediately.
+        */
+       int processOptions()
+       {
+               Options options(*m_argv, k_optionsDefinition);
+               OptArgvIter iter(--m_argc, ++m_argv);
+               
+               // process command line options
+               int optchar;
+               const char * optarg;
+               while (optchar = options(iter, optarg))
+               {
+                       switch (optchar)
+                       {
+                               case '?':
+                                       printUsage(options);
+                                       return 0;
+                               
+                               case 'v':
+                                       printf("%s %s\n%s\n", k_toolName, k_version, k_copyright);
+                                       return 0;
+                                       
+                               case 'k':
+                                       m_keyFilePaths.push_back(optarg);
+                                       break;
+                               
+                               case 'z':
+                                       m_useDefaultKey = true;
+                                       break;
+                               
+                               case 'x':
+                                       m_doExtract = true;
+                                       m_sectionIndex = strtoul(optarg, NULL, 0);
+                                       break;
+                               
+                               case 'b':
+                                       m_extractBinary = true;
+                                       Log::getLogger()->setFilterLevel(Logger::WARNING);
+                                       break;
+                                       
+                               case 'd':
+                                       Log::getLogger()->setFilterLevel(Logger::DEBUG);
+                                       break;
+                                       
+                               case 'q':
+                                       Log::getLogger()->setFilterLevel(Logger::WARNING);
+                                       break;
+                                       
+                               case 'V':
+                                       m_isVerbose = true;
+                                       break;
+                               
+                               default:
+                                       Log::log(Logger::ERROR, "error: unrecognized option\n\n");
+                                       printUsage(options);
+                                       return 1;
+                       }
+               }
+               
+               // handle positional args
+               if (iter.index() < m_argc)
+               {
+//                     Log::SetOutputLevel leveler(Logger::DEBUG);
+//                     Log::log("positional args:\n");
+                       int i;
+                       for (i = iter.index(); i < m_argc; ++i)
+                       {
+//                             Log::log("%d: %s\n", i - iter.index(), m_argv[i]);
+                               m_positionalArgs.push_back(m_argv[i]);
+                       }
+               }
+               
+               // all is well
+               return -1;
+       }
+
+       /*!
+        * Prints help for the tool.
+        */
+       void printUsage(Options & options)
+       {
+               options.usage(std::cout, "sb-file");
+               printf(k_usageText, k_toolName);
+       }
+       
+       /*!
+        * Core of the tool. Calls processOptions() to handle command line options
+        * before performing the real work the tool does.
+        */
+       int run()
+       {
+               try
+               {
+                       // read command line options
+                       int result;
+                       if ((result = processOptions()) != -1)
+                       {
+                               return result;
+                       }
+                       
+                       // set verbose logging
+                       setVerboseLogging();
+                       
+                       // make sure a file was provided
+                       if (m_positionalArgs.size() < 1)
+                       {
+                               throw std::runtime_error("no sb file path was provided");
+                       }
+                       
+                       // read the boot image
+                       readBootImage();
+               }
+               catch (std::exception & e)
+               {
+                       Log::log(Logger::ERROR, "error: %s\n", e.what());
+                       return 1;
+               }
+               catch (...)
+               {
+                       Log::log(Logger::ERROR, "error: unexpected exception\n");
+                       return 1;
+               }
+               
+               return 0;
+       }
+       
+       /*!
+        * \brief Turns on verbose logging.
+        */
+       void setVerboseLogging()
+       {
+               if (m_isVerbose)
+               {
+                       // verbose only affects the INFO and DEBUG filter levels
+                       // if the user has selected quiet mode, it overrides verbose
+                       switch (Log::getLogger()->getFilterLevel())
+                       {
+                               case Logger::INFO:
+                                       Log::getLogger()->setFilterLevel(Logger::INFO2);
+                                       break;
+                               case Logger::DEBUG:
+                                       Log::getLogger()->setFilterLevel(Logger::DEBUG2);
+                                       break;
+                       }
+               }
+       }
+       
+       /*!
+        * \brief Opens and reads the boot image identified on the command line.
+        * \pre At least one position argument must be present.
+        */
+       void readBootImage()
+       {
+               Log::SetOutputLevel infoLevel(Logger::INFO);
+               
+               // open the sb file stream
+               std::ifstream sbStream(m_positionalArgs[0].c_str(), std::ios_base::binary | std::ios_base::in);
+               if (!sbStream.is_open())
+               {
+                       throw std::runtime_error("failed to open input file");
+               }
+               
+               // create the boot image reader
+               m_reader = new EncoreBootImageReader(sbStream);
+               
+               // read image header
+               m_reader->readImageHeader();
+               const EncoreBootImage::boot_image_header_t & header = m_reader->getHeader();
+               if (header.m_majorVersion > 1)
+               {
+                       throw std::runtime_error(format_string("boot image format version is too new (format version %d.%d)\n", header.m_majorVersion, header.m_minorVersion));
+               }
+               Log::log("---- Boot image header ----\n");
+               dumpImageHeader(header);
+               
+               // compute SHA-1 over image header and test against the digest stored in the header
+               sha1_digest_t computedDigest;
+               m_reader->computeHeaderDigest(computedDigest);
+               if (compareDigests(computedDigest, m_reader->getHeader().m_digest))
+               {
+                       Log::log("Header digest is correct.\n");
+               }
+               else
+               {
+                       Log::log(Logger::WARNING, "warning: stored SHA-1 header digest does not match the actual header digest\n");
+                       Log::log(Logger::WARNING, "\n---- Actual SHA-1 digest of image header ----\n");
+                       logHexArray(Logger::WARNING, (uint8_t *)&computedDigest, sizeof(computedDigest));
+               }
+               
+               // read the section table
+               m_reader->readSectionTable();
+               const EncoreBootImageReader::section_array_t & sectionTable = m_reader->getSections();
+               EncoreBootImageReader::section_array_t::const_iterator it = sectionTable.begin();
+               Log::log("\n---- Section table ----\n");
+               unsigned n = 0;
+               for (; it != sectionTable.end(); ++it, ++n)
+               {
+                       const EncoreBootImage::section_header_t & sectionHeader = *it;
+                       Log::log("Section %d:\n", n);
+                       dumpSectionHeader(sectionHeader);
+               }
+               
+               // read the key dictionary
+               // XXX need to support multiple keys, not just the first!
+               if (m_reader->isEncrypted())
+               {
+                       Log::log("\n---- Key dictionary ----\n");
+                       if (m_keyFilePaths.size() > 0 || m_useDefaultKey)
+                       {
+                               if (m_keyFilePaths.size() > 0)
+                               {
+                                       std::string & keyPath = m_keyFilePaths[0];
+                                       std::ifstream keyStream(keyPath.c_str(), std::ios_base::binary | std::ios_base::in);
+                                       if (!keyStream.is_open())
+                                       {
+                                               Log::log(Logger::WARNING, "warning: unable to read key %s\n", keyPath.c_str());
+                                       }
+                                       AESKey<128> kek(keyStream);
+                               
+                                       // search for this key in the key dictionary
+                                       if (!m_reader->readKeyDictionary(kek))
+                                       {
+                                               throw std::runtime_error("the provided key is not valid for this encrypted boot image");
+                                       }
+                                       
+                                       Log::log("\nKey %s was found in key dictionary.\n", keyPath.c_str());
+                               }
+                               else
+                               {
+                                       // default key of zero, overriden if -k was used
+                                       AESKey<128> defaultKek;
+                               
+                                       // search for this key in the key dictionary
+                                       if (!m_reader->readKeyDictionary(defaultKek))
+                                       {
+                                               throw std::runtime_error("the default key is not valid for this encrypted boot image");
+                                       }
+                                       
+                                       Log::log("\nDefault key was found in key dictionary.\n");
+                               }
+                               
+                               // print out the DEK
+                               AESKey<128> dek = m_reader->getKey();
+                               std::stringstream dekStringStream(std::ios_base::in | std::ios_base::out);
+                               dek.writeToStream(dekStringStream);
+                               std::string dekString = dekStringStream.str();
+//                             Log::log("\nData encryption key: %s\n", dekString.c_str());
+                               Log::log("\nData encryption key:\n");
+                               logHexArray(Logger::INFO, (const uint8_t *)&dek.getKey(), sizeof(AESKey<128>::key_t));
+                       }
+                       else
+                       {
+                               throw std::runtime_error("the image is encrypted but no key was provided");
+                       }
+               }
+               
+               // read the SHA-1 digest over the entire image. this is done after
+               // reading the key dictionary because the digest is encrypted in
+               // encrypted boot images.
+               m_reader->readImageDigest();
+               const sha1_digest_t & embeddedDigest = m_reader->getDigest();
+               Log::log("\n---- SHA-1 digest of entire image ----\n");
+               logHexArray(Logger::INFO, (const uint8_t *)&embeddedDigest, sizeof(embeddedDigest));
+               
+               // compute the digest over the entire image and compare
+               m_reader->computeImageDigest(computedDigest);
+               if (compareDigests(computedDigest, embeddedDigest))
+               {
+                       Log::log("Image digest is correct.\n");
+               }
+               else
+               {
+                       Log::log(Logger::WARNING, "warning: stored SHA-1 digest does not match the actual digest\n");
+                       Log::log(Logger::WARNING, "\n---- Actual SHA-1 digest of entire image ----\n");
+                       logHexArray(Logger::WARNING, (uint8_t *)&computedDigest, sizeof(computedDigest));
+               }
+               
+               // read the boot tags
+               m_reader->readBootTags();
+               Log::log("\n---- Boot tags ----\n");
+               unsigned block = header.m_firstBootTagBlock;
+               const EncoreBootImageReader::boot_tag_array_t & tags = m_reader->getBootTags();
+               EncoreBootImageReader::boot_tag_array_t::const_iterator tagIt = tags.begin();
+               for (n = 0; tagIt != tags.end(); ++tagIt, ++n)
+               {
+                       const EncoreBootImage::boot_command_t & command = *tagIt;
+                       Log::log("%04u: @ block %06u | id=0x%08x | length=%06u | flags=0x%08x\n", n, block, command.m_address, command.m_count, command.m_data);
+                                       
+                       if (command.m_data & EncoreBootImage::ROM_SECTION_BOOTABLE)
+                       {
+                               Log::log("        0x1 = ROM_SECTION_BOOTABLE\n");
+                       }
+                       
+                       if (command.m_data & EncoreBootImage::ROM_SECTION_CLEARTEXT)
+                       {
+                               Log::log("        0x2 = ROM_SECTION_CLEARTEXT\n");
+                       }
+                       
+                       block += command.m_count + 1;
+               }
+        
+        // now read all of the sections
+               Log::log(Logger::INFO2, "\n---- Sections ----\n");
+        for (n = 0; n < header.m_sectionCount; ++n)
+        {
+            EncoreBootImage::Section * section = m_reader->readSection(n);
+            section->debugPrint();
+                       
+                       // Check if this is the section the user wants to extract.
+                       if (m_doExtract && n == m_sectionIndex)
+                       {
+                               extractSection(section);
+                       }
+        }
+       }
+       
+       //! \brief Dumps the contents of a section to stdout.
+       //!
+       //! If #m_extractBinary is true then the contents are written as
+       //! raw binary to stdout. Otherwise the data is formatted using
+       //! logHexArray().
+       void extractSection(EncoreBootImage::Section * section)
+       {
+               // Allocate buffer to hold section data.
+               unsigned blockCount = section->getBlockCount();
+               unsigned dataLength = sizeOfCipherBlocks(blockCount);
+               smart_array_ptr<uint8_t> buffer = new uint8_t[dataLength];
+               cipher_block_t * data = reinterpret_cast<cipher_block_t *>(buffer.get());
+               
+               // Read section data into the buffer one block at a time.
+               unsigned offset;
+               for (offset = 0; offset < blockCount;)
+               {
+                       unsigned blocksRead = section->getBlocks(offset, 1, data);
+                       offset += blocksRead;
+                       data += blocksRead;
+               }
+               
+               // Print header.
+               Log::log(Logger::INFO, "\nSection %d contents:\n", m_sectionIndex);
+               
+               // Now dump the extracted data to stdout.
+               if (m_extractBinary)
+               {
+                       if (fwrite(buffer.get(), 1, dataLength, stdout) != dataLength)
+                       {
+                               throw std::runtime_error(format_string("failed to write data to stdout (%d)", ferror(stdout)));
+                       }
+               }
+               else
+               {
+                       // Use the warning log level so the data will be visible even in quiet mode.
+                       logHexArray(Logger::WARNING, buffer, dataLength);
+               }
+       }
+       
+       //! \brief Compares two SHA-1 digests and returns whether they are equal.
+       //! \retval true The two digests are equal.
+       //! \retval false The \a a and \a b digests are different from each other.
+       bool compareDigests(const sha1_digest_t & a, const sha1_digest_t & b)
+       {
+               return memcmp(a, b, sizeof(sha1_digest_t)) == 0;
+       }
+       
+       /*
+       struct boot_image_header_t
+       {
+               union
+               {
+                       sha1_digest_t m_digest;         //!< SHA-1 digest of image header. Also used as the crypto IV.
+                       struct
+                       {
+                               cipher_block_t m_iv;    //!< The first four bytes of the digest form the initialization vector.
+                               uint8_t m_extra[4];             //!< The leftover top four bytes of the SHA-1 digest.
+                       };
+               };
+               uint8_t m_signature[4];                 //!< 'STMP', see #ROM_IMAGE_HEADER_SIGNATURE.
+               uint16_t m_version;                             //!< Version of the boot image format, see #ROM_BOOT_IMAGE_VERSION.
+               uint16_t m_flags;                               //!< Flags or options associated with the entire image.
+               uint32_t m_imageBlocks;                 //!< Size of entire image in blocks.
+               uint32_t m_firstBootTagBlock;   //!< Offset from start of file to the first boot tag, in blocks.
+               section_id_t m_firstBootableSectionID;  //!< ID of section to start booting from.
+               uint16_t m_keyCount;                    //!< Number of entries in DEK dictionary.
+               uint16_t m_keyDictionaryBlock;  //!< Starting block number for the key dictionary.
+               uint16_t m_headerBlocks;                //!< Size of this header, including this size word, in blocks.
+               uint16_t m_sectionCount;                //!< Number of section headers in this table.
+               uint16_t m_sectionHeaderSize;   //!< Size in blocks of a section header.
+               uint8_t m_padding0[6];                  //!< Padding to align #m_timestamp to long word.
+               uint64_t m_timestamp;                   //!< Timestamp when image was generated in microseconds since 1-1-2000.
+               version_t m_productVersion;             //!< Product version.
+               version_t m_componentVersion;   //!< Component version.
+               uint16_t m_driveTag;
+               uint8_t m_padding1[6];          //!< Padding to round up to next cipher block.
+       };
+       */
+       void dumpImageHeader(const EncoreBootImage::boot_image_header_t & header)
+       {
+               version_t vers;
+
+               Log::SetOutputLevel infoLevel(Logger::INFO);
+               Log::log("Signature 1:           %c%c%c%c\n", header.m_signature[0], header.m_signature[1], header.m_signature[2], header.m_signature[3]);
+               Log::log("Signature 2:           %c%c%c%c\n", header.m_signature2[0], header.m_signature2[1], header.m_signature2[2], header.m_signature2[3]);
+               Log::log("Format version:        %d.%d\n", header.m_majorVersion, header.m_minorVersion);
+               Log::log("Flags:                 0x%04x\n", header.m_flags);
+               Log::log("Image blocks:          %u\n", header.m_imageBlocks);
+               Log::log("First boot tag block:  %u\n", header.m_firstBootTagBlock);
+               Log::log("First boot section ID: 0x%08x\n", header.m_firstBootableSectionID);
+               Log::log("Key count:             %u\n", header.m_keyCount);
+               Log::log("Key dictionary block:  %u\n", header.m_keyDictionaryBlock);
+               Log::log("Header blocks:         %u\n", header.m_headerBlocks);
+               Log::log("Section count:         %u\n", header.m_sectionCount);
+               Log::log("Section header size:   %u\n", header.m_sectionHeaderSize);
+               Log::log("Timestamp:             %llu\n", header.m_timestamp);
+               vers = header.m_productVersion;
+               vers.fixByteOrder();
+               Log::log("Product version:       %x.%x.%x\n", vers.m_major, vers.m_minor, vers.m_revision);
+               vers = header.m_componentVersion;
+               vers.fixByteOrder();
+               Log::log("Component version:     %x.%x.%x\n", vers.m_major, vers.m_minor, vers.m_revision);
+               if (header.m_majorVersion == 1 && header.m_minorVersion >= 1)
+               {
+                       Log::log("Drive tag:             0x%04x\n", header.m_driveTag);
+               }
+               Log::log("SHA-1 digest of header:\n");
+               logHexArray(Logger::INFO, (uint8_t *)&header.m_digest, sizeof(header.m_digest));
+       }
+       
+       void dumpSectionHeader(const EncoreBootImage::section_header_t & header)
+       {
+               Log::SetOutputLevel infoLevel(Logger::INFO);
+               Log::log("    Identifier: 0x%x\n", header.m_tag);
+               Log::log("    Offset:     %d block%s (%d bytes)\n", header.m_offset, header.m_offset!=1?"s":"", sizeOfCipherBlocks(header.m_offset));
+               Log::log("    Length:     %d block%s (%d bytes)\n", header.m_length, header.m_length!=1?"s":"", sizeOfCipherBlocks(header.m_length));
+               Log::log("    Flags:      0x%08x\n", header.m_flags);
+               
+               if (header.m_flags & EncoreBootImage::ROM_SECTION_BOOTABLE)
+               {
+                       Log::log("                0x1 = ROM_SECTION_BOOTABLE\n");
+               }
+               
+               if (header.m_flags & EncoreBootImage::ROM_SECTION_CLEARTEXT)
+               {
+                       Log::log("                0x2 = ROM_SECTION_CLEARTEXT\n");
+               }
+       }
+       
+       /*!
+        * \brief Log an array of bytes as hex.
+        */
+       void logHexArray(Logger::log_level_t level, const uint8_t * bytes, unsigned count)
+       {
+               Log::SetOutputLevel leveler(level);
+
+               unsigned i;
+               for (i = 0; i < count; ++i, ++bytes)
+               {
+                       if ((i % 16 == 0) && (i < count - 1))
+                       {
+                               if (i != 0)
+                               {
+                                       Log::log("\n");
+                               }
+                               Log::log("    0x%08x: ", i);
+                       }
+                       Log::log("%02x ", *bytes & 0xff);
+               }
+               
+               Log::log("\n");
+       }
+
+};
+
+/*!
+ * Main application entry point. Creates an sbtool instance and lets it take over.
+ */
+int main(int argc, char* argv[], char* envp[])
+{
+       try
+       {
+               return sbtool(argc, argv).run();
+       }
+       catch (...)
+       {
+               Log::log(Logger::ERROR, "error: unexpected exception\n");
+               return 1;
+       }
+
+       return 0;
+}
+
+
+
+
+
diff --git a/tools/elftosb/sbtool/sbtool.vcproj b/tools/elftosb/sbtool/sbtool.vcproj
new file mode 100644 (file)
index 0000000..f2b24d8
--- /dev/null
@@ -0,0 +1,495 @@
+<?xml version="1.0" encoding="Windows-1252"?>\r
+<VisualStudioProject\r
+       ProjectType="Visual C++"\r
+       Version="9.00"\r
+       Name="sbtool"\r
+       ProjectGUID="{5C9AC9F0-C755-4BBB-B65B-78C5262A87D2}"\r
+       Keyword="Win32Proj"\r
+       TargetFrameworkVersion="131072"\r
+       >\r
+       <Platforms>\r
+               <Platform\r
+                       Name="Win32"\r
+               />\r
+       </Platforms>\r
+       <ToolFiles>\r
+       </ToolFiles>\r
+       <Configurations>\r
+               <Configuration\r
+                       Name="Debug|Win32"\r
+                       OutputDirectory="Debug"\r
+                       IntermediateDirectory="Debug"\r
+                       ConfigurationType="1"\r
+                       InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"\r
+                       CharacterSet="2"\r
+                       >\r
+                       <Tool\r
+                               Name="VCPreBuildEventTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCCustomBuildTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCXMLDataGeneratorTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCWebServiceProxyGeneratorTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCMIDLTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCCLCompilerTool"\r
+                               Optimization="0"\r
+                               AdditionalIncludeDirectories="..\elftosb2;..\winsupport;..\common"\r
+                               PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"\r
+                               MinimalRebuild="true"\r
+                               BasicRuntimeChecks="3"\r
+                               RuntimeLibrary="1"\r
+                               RuntimeTypeInfo="true"\r
+                               UsePrecompiledHeader="0"\r
+                               BrowseInformation="1"\r
+                               WarningLevel="2"\r
+                               Detect64BitPortabilityProblems="true"\r
+                               DebugInformationFormat="4"\r
+                               DisableSpecificWarnings="4355"\r
+                       />\r
+                       <Tool\r
+                               Name="VCManagedResourceCompilerTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCResourceCompilerTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCPreLinkEventTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCLinkerTool"\r
+                               OutputFile="$(OutDir)/sbtool.exe"\r
+                               LinkIncremental="2"\r
+                               GenerateDebugInformation="true"\r
+                               ProgramDatabaseFile="$(OutDir)/sbtool.pdb"\r
+                               SubSystem="1"\r
+                               RandomizedBaseAddress="1"\r
+                               DataExecutionPrevention="0"\r
+                               TargetMachine="1"\r
+                       />\r
+                       <Tool\r
+                               Name="VCALinkTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCManifestTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCXDCMakeTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCBscMakeTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCFxCopTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCAppVerifierTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCPostBuildEventTool"\r
+                       />\r
+               </Configuration>\r
+               <Configuration\r
+                       Name="Release|Win32"\r
+                       OutputDirectory="Release"\r
+                       IntermediateDirectory="Release"\r
+                       ConfigurationType="1"\r
+                       InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"\r
+                       CharacterSet="2"\r
+                       >\r
+                       <Tool\r
+                               Name="VCPreBuildEventTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCCustomBuildTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCXMLDataGeneratorTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCWebServiceProxyGeneratorTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCMIDLTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCCLCompilerTool"\r
+                               PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"\r
+                               RuntimeLibrary="0"\r
+                               UsePrecompiledHeader="0"\r
+                               WarningLevel="3"\r
+                               Detect64BitPortabilityProblems="true"\r
+                               DebugInformationFormat="3"\r
+                       />\r
+                       <Tool\r
+                               Name="VCManagedResourceCompilerTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCResourceCompilerTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCPreLinkEventTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCLinkerTool"\r
+                               OutputFile="$(OutDir)/sbtool.exe"\r
+                               LinkIncremental="1"\r
+                               GenerateDebugInformation="true"\r
+                               SubSystem="1"\r
+                               OptimizeReferences="2"\r
+                               EnableCOMDATFolding="2"\r
+                               RandomizedBaseAddress="1"\r
+                               DataExecutionPrevention="0"\r
+                               TargetMachine="1"\r
+                       />\r
+                       <Tool\r
+                               Name="VCALinkTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCManifestTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCXDCMakeTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCBscMakeTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCFxCopTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCAppVerifierTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCPostBuildEventTool"\r
+                       />\r
+               </Configuration>\r
+       </Configurations>\r
+       <References>\r
+       </References>\r
+       <Files>\r
+               <Filter\r
+                       Name="Source Files"\r
+                       Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"\r
+                       UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"\r
+                       >\r
+                       <Filter\r
+                               Name="sbtool"\r
+                               >\r
+                               <File\r
+                                       RelativePath=".\EncoreBootImageReader.cpp"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath=".\sbtool.cpp"\r
+                                       >\r
+                               </File>\r
+                       </Filter>\r
+                       <Filter\r
+                               Name="common"\r
+                               >\r
+                               <File\r
+                                       RelativePath="..\common\AESKey.cpp"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath="..\common\AESKey.h"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath="..\common\Blob.cpp"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath="..\common\Blob.h"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath="..\common\BootImage.h"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath="..\common\crc.cpp"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath="..\common\crc.h"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath="..\common\DataSource.cpp"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath="..\common\DataSource.h"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath="..\common\DataTarget.cpp"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath="..\common\DataTarget.h"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath="..\common\ELF.h"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath="..\common\ELFSourceFile.cpp"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath="..\common\ELFSourceFile.h"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath="..\common\EncoreBootImage.cpp"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath="..\common\EncoreBootImage.h"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath="..\common\EndianUtilities.h"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath="..\common\EvalContext.cpp"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath="..\common\EvalContext.h"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath="..\common\format_string.cpp"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath="..\common\format_string.h"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath="..\common\GHSSecInfo.cpp"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath="..\common\GHSSecInfo.h"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath="..\common\GlobMatcher.cpp"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath="..\common\GlobMatcher.h"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath="..\common\HexValues.cpp"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath="..\common\HexValues.h"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath="..\common\int_size.h"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath="..\common\Logging.cpp"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath="..\common\Logging.h"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath="..\common\Operation.cpp"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath="..\common\Operation.h"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath="..\common\OptionContext.h"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath="..\common\OptionDictionary.cpp"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath="..\common\OptionDictionary.h"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath="..\common\options.cpp"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath="..\common\options.h"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath="..\common\OutputSection.cpp"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath="..\common\OutputSection.h"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath="..\common\Random.cpp"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath="..\common\Random.h"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath="..\common\rijndael.cpp"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath="..\common\rijndael.h"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath="..\common\RijndaelCBCMAC.cpp"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath="..\common\RijndaelCBCMAC.h"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath="..\common\SearchPath.cpp"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath="..\common\SHA1.cpp"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath="..\common\SHA1.h"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath="..\common\smart_ptr.h"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath="..\common\SourceFile.cpp"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath="..\common\SourceFile.h"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath="..\common\SRecordSourceFile.cpp"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath="..\common\SRecordSourceFile.h"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath="..\common\stdafx.cpp"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath="..\common\stdafx.h"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath="..\common\StELFFile.cpp"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath="..\common\StELFFile.h"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath="..\common\StExecutableImage.cpp"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath="..\common\StExecutableImage.h"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath="..\common\StringMatcher.h"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath="..\common\StSRecordFile.cpp"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath="..\common\StSRecordFile.h"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath="..\common\Value.cpp"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath="..\common\Value.h"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath="..\common\Version.cpp"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath="..\common\Version.h"\r
+                                       >\r
+                               </File>\r
+                       </Filter>\r
+               </Filter>\r
+               <Filter\r
+                       Name="Header Files"\r
+                       Filter="h;hpp;hxx;hm;inl;inc;xsd"\r
+                       UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"\r
+                       >\r
+                       <Filter\r
+                               Name="sbtol"\r
+                               >\r
+                               <File\r
+                                       RelativePath=".\EncoreBootImageReader.h"\r
+                                       >\r
+                               </File>\r
+                       </Filter>\r
+                       <Filter\r
+                               Name="common"\r
+                               >\r
+                               <File\r
+                                       RelativePath="..\common\SearchPath.h"\r
+                                       >\r
+                               </File>\r
+                       </Filter>\r
+               </Filter>\r
+               <Filter\r
+                       Name="Resource Files"\r
+                       Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"\r
+                       UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"\r
+                       >\r
+               </Filter>\r
+       </Files>\r
+       <Globals>\r
+       </Globals>\r
+</VisualStudioProject>\r
diff --git a/tools/elftosb/stdafx.h b/tools/elftosb/stdafx.h
new file mode 100644 (file)
index 0000000..ce80458
--- /dev/null
@@ -0,0 +1,66 @@
+#ifndef stdafx_h_
+#define stdafx_h_
+
+// stdafx.h : include file for standard system include files,
+// or project specific include files that are used frequently, but
+// are changed infrequently
+//
+
+// Default to external release.
+#ifndef SGTL_INTERNAL
+    #define SGTL_INTERNAL 0
+#endif
+
+#include <iostream>
+#include <stdexcept>
+
+#if defined(WIN32)
+//#include <tchar.h>
+    
+    // define this macro for use in VC++
+    #if !defined(__LITTLE_ENDIAN__)
+        #define __LITTLE_ENDIAN__ 1
+    #endif // !defined(__LITTLE_ENDIAN__)
+#endif // defined(WIN32)
+
+#if defined(Linux)
+// For Linux systems only, types.h only defines the signed
+// integer types.  This is not professional code.
+// Update: They are defined in the header files in the more recent version of redhat enterprise gcc.
+#include "/usr/include/sys/types.h"
+//typedef unsigned long uint32_t;
+//typedef unsigned short uint16_t;
+//typedef unsigned char uint8_t;
+
+//#define TCHAR char
+//#define _tmain main
+
+    // give a default endian in case one is not defined on Linux (it should be, though)
+    #if !defined(__LITTLE_ENDIAN__) && !defined(__BIG_ENDIAN__)
+        #define __LITTLE_ENDIAN__ 1
+    #endif // !defined(__LITTLE_ENDIAN__) && !defined(__BIG_ENDIAN__)
+
+#endif // defined(Linux)
+
+
+#if !defined(Linux)
+// redefine missing typedefs from stdint.h or syst/types.h
+
+typedef unsigned long uint32_t;
+typedef unsigned short uint16_t;
+typedef unsigned char uint8_t;
+
+typedef long int32_t;
+typedef short int16_t;
+typedef char int8_t;
+#endif // !defined(Linux)
+
+#if !defined(TRUE)
+    #define TRUE 1
+#endif // !defined(TRUE)
+
+#if !defined(FALSE)
+    #define FALSE 0
+#endif // !defined(FALSE)
+
+#endif // stdafx_h_
diff --git a/tools/elftosb/test_elftosb.bat b/tools/elftosb/test_elftosb.bat
new file mode 100644 (file)
index 0000000..4f512be
--- /dev/null
@@ -0,0 +1,12 @@
+
+mkdir test_output
+
+.\elftosb2\Debug\elftosb -Vdz -p bdfiles -p test_files -fmx28 -c simple.e -o test_output\output1.sb plugin_hello redboot_gcc.srec hostlink
+.\sbtool\Debug\sbtool -Vdz test_output\output1.sb > test_output\output1.txt
+
+.\elftosb2\Debug\elftosb -Vdz -p bdfiles -p test_files -fmx28 -c habtest.bd -o test_output\output2.sb plugin_hello redboot_gcc.srec hostlink
+.\sbtool\Debug\sbtool -Vdz test_output\output2.sb > test_output\output2.txt
+
+.\elftosb2\Debug\elftosb -Vdz -p bdfiles -p test_files -fmx28 -c basic_test_cmd.e -o test_output\output3.sb plugin_hello redboot_gcc.srec hostlink sd_player_gcc
+.\sbtool\Debug\sbtool -Vdz test_output\output2.sb > test_output\output3.txt
+
diff --git a/tools/elftosb/test_elftosb.sh b/tools/elftosb/test_elftosb.sh
new file mode 100755 (executable)
index 0000000..54bcde0
--- /dev/null
@@ -0,0 +1,26 @@
+#! /bin/bash
+
+# Tool paths
+if [ -d /System/Library/CoreServices ]; then
+    Elftosb=./build/Debug/elftosb
+    Sbtool=./build/Debug/sbtool
+else
+    Elftosb=./bld/linux/elftosb
+    Sbtool=./bld/linux/sbtool
+fi
+
+# Create test output file directory
+mkdir -p test_output
+
+# simple.e
+$Elftosb -Vdz -p bdfiles -p test_files -fmx28 -c simple.e -o test_output/output1.sb plugin_hello redboot_gcc.srec hostlink
+$Sbtool -Vdz test_output/output1.sb > test_output/output1.txt
+
+# habtest.bd
+$Elftosb -Vdz -p bdfiles -p test_files -fmx28 -c habtest.bd -o test_output/output2.sb plugin_hello redboot_gcc.srec hostlink
+$Sbtool -Vdz test_output/output2.sb > test_output/output2.txt
+
+# basic_test_cmd.e
+$Elftosb -Vdz -p bdfiles -p test_files -fmx28 -c basic_test_cmd.e -o test_output/output3.sb plugin_hello redboot_gcc.srec hostlink sd_player_gcc
+$Sbtool -Vdz test_output/output3.sb > test_output/output3.txt
+
diff --git a/tools/elftosb/test_files/hello_NOR_arm b/tools/elftosb/test_files/hello_NOR_arm
new file mode 100644 (file)
index 0000000..aef70bc
Binary files /dev/null and b/tools/elftosb/test_files/hello_NOR_arm differ
diff --git a/tools/elftosb/test_files/hello_NOR_arm.map b/tools/elftosb/test_files/hello_NOR_arm.map
new file mode 100644 (file)
index 0000000..65b4d14
--- /dev/null
@@ -0,0 +1,38 @@
+Link Date:     Wed Dec 15 10:06:16 2004\r
+Host OS:       GHS_WIN32\r
+Version:       ELXR 4.0 (c) 1998-2003 Green Hills Software    Build: Aug  3 2004\r
+\r
+\r
+Load Map Wed Dec 15 10:06:16 2004\r
+Image Summary\r
+\r
+  Section              Base      Size(hex)    Size(dec)  SecOffs\r
+  .text                70000000  00000100          256   00000a0\r
+  .rodata              70000100  00000020           32   00001a0\r
+  .NOR.data            70000120  00000000            0   00001c0\r
+  .data                00000040  00000000            0   00001c0\r
+  .bss                 00000040  00000000            0   00001c0\r
+  .nor.bss             0003d000  00000005            5   00001c0\r
+\f\r
+Load Map Wed Dec 15 10:06:16 2004\r
+Module Summary\r
+\r
+  Origin+Size    Section          Module\r
+70000000+000090  .text            main_NOR.o\r
+70000100+000020  .rodata          main_NOR.o\r
+0003d000+000005  .nor.bss         main_NOR.o\r
+70000090+000070  .text            tool_lib.a(sim_tools.o)\r
+\f\r
+Load Map Wed Dec 15 10:06:16 2004\r
+Global Symbols (sorted alphabetically)\r
+\r
+                  70002800 __ghs_norend\r
+                  70000000 __ghs_norstart\r
+                  0003cfc0 __ghs_ramend\r
+                  00000040 __ghs_ramstart\r
+ .text            70000000 _start\r
+ .nor.bss         0003d000 i\r
+ .text            70000090 sim_write\r
+ .nor.bss         0003d004 szHelloWorldString\r
+ .rodata          70000100 szNORHelloWorldString\r
+ .text            700000c0 test_exit\r
diff --git a/tools/elftosb/test_files/hello_NOR_mixed b/tools/elftosb/test_files/hello_NOR_mixed
new file mode 100644 (file)
index 0000000..7a7fb6b
Binary files /dev/null and b/tools/elftosb/test_files/hello_NOR_mixed differ
diff --git a/tools/elftosb/test_files/hello_NOR_mixed.map b/tools/elftosb/test_files/hello_NOR_mixed.map
new file mode 100644 (file)
index 0000000..c34358c
--- /dev/null
@@ -0,0 +1,39 @@
+Link Date:     Wed Dec 15 10:14:22 2004\r
+Host OS:       GHS_WIN32\r
+Version:       ELXR 4.0 (c) 1998-2003 Green Hills Software    Build: Aug  3 2004\r
+\r
+\r
+Load Map Wed Dec 15 10:14:22 2004\r
+Image Summary\r
+\r
+  Section              Base      Size(hex)    Size(dec)  SecOffs\r
+  .text                70000000  00000114          276   00000a0\r
+  .rodata              70000114  00000020           32   00001b4\r
+  .NOR.data            70000134  00000000            0   00001d4\r
+  .data                00000040  00000000            0   00001d4\r
+  .bss                 00000040  00000000            0   00001d4\r
+  .nor.bss             0003d000  00000005            5   00001d4\r
+\f\r
+Load Map Wed Dec 15 10:14:22 2004\r
+Module Summary\r
+\r
+  Origin+Size    Section          Module\r
+70000000+0000a4  .text            main_NOR.o\r
+70000114+000020  .rodata          main_NOR.o\r
+0003d000+000005  .nor.bss         main_NOR.o\r
+700000a4+000070  .text            tool_lib.a(sim_tools.o)\r
+\f\r
+Load Map Wed Dec 15 10:14:22 2004\r
+Global Symbols (sorted alphabetically)\r
+\r
+                  70002800 __ghs_norend\r
+                  70000000 __ghs_norstart\r
+                  0003cfc0 __ghs_ramend\r
+                  00000040 __ghs_ramstart\r
+ .text            70000014 _start\r
+ .text            70000000 a_thumb_routine\r
+ .nor.bss         0003d000 i\r
+ .text            700000a4 sim_write\r
+ .nor.bss         0003d004 szHelloWorldString\r
+ .rodata          70000114 szNORHelloWorldString\r
+ .text            700000d4 test_exit\r
diff --git a/tools/elftosb/test_files/hello_NOR_thumb b/tools/elftosb/test_files/hello_NOR_thumb
new file mode 100644 (file)
index 0000000..9c15fd3
Binary files /dev/null and b/tools/elftosb/test_files/hello_NOR_thumb differ
diff --git a/tools/elftosb/test_files/hello_NOR_thumb.map b/tools/elftosb/test_files/hello_NOR_thumb.map
new file mode 100644 (file)
index 0000000..3ba9f5d
--- /dev/null
@@ -0,0 +1,38 @@
+Link Date:     Wed Dec 15 10:09:42 2004\r
+Host OS:       GHS_WIN32\r
+Version:       ELXR 4.0 (c) 1998-2003 Green Hills Software    Build: Aug  3 2004\r
+\r
+\r
+Load Map Wed Dec 15 10:09:42 2004\r
+Image Summary\r
+\r
+  Section              Base      Size(hex)    Size(dec)  SecOffs\r
+  .text                70000000  000000a0          160   00000a0\r
+  .rodata              700000a0  00000020           32   0000140\r
+  .NOR.data            700000c0  00000000            0   0000160\r
+  .data                00000040  00000000            0   0000160\r
+  .bss                 00000040  00000000            0   0000160\r
+  .nor.bss             0003d000  00000005            5   0000160\r
+\f\r
+Load Map Wed Dec 15 10:09:42 2004\r
+Module Summary\r
+\r
+  Origin+Size    Section          Module\r
+70000000+00005c  .text            main_NOR.o\r
+700000a0+000020  .rodata          main_NOR.o\r
+0003d000+000005  .nor.bss         main_NOR.o\r
+7000005c+000044  .text            tool_lib.a(sim_tools.o)\r
+\f\r
+Load Map Wed Dec 15 10:09:42 2004\r
+Global Symbols (sorted alphabetically)\r
+\r
+                  70002800 __ghs_norend\r
+                  70000000 __ghs_norstart\r
+                  0003cfc0 __ghs_ramend\r
+                  00000040 __ghs_ramstart\r
+ .text            70000000 _start\r
+ .nor.bss         0003d000 i\r
+ .text            7000005c sim_write\r
+ .nor.bss         0003d004 szHelloWorldString\r
+ .rodata          700000a0 szNORHelloWorldString\r
+ .text            70000072 test_exit\r
diff --git a/tools/elftosb/test_files/hostlink b/tools/elftosb/test_files/hostlink
new file mode 100644 (file)
index 0000000..d2d7a94
Binary files /dev/null and b/tools/elftosb/test_files/hostlink differ
diff --git a/tools/elftosb/test_files/player_linfix.elf b/tools/elftosb/test_files/player_linfix.elf
new file mode 100644 (file)
index 0000000..9c66a01
Binary files /dev/null and b/tools/elftosb/test_files/player_linfix.elf differ
diff --git a/tools/elftosb/test_files/plugin_complex b/tools/elftosb/test_files/plugin_complex
new file mode 100644 (file)
index 0000000..10e2d7f
Binary files /dev/null and b/tools/elftosb/test_files/plugin_complex differ
diff --git a/tools/elftosb/test_files/plugin_hello b/tools/elftosb/test_files/plugin_hello
new file mode 100644 (file)
index 0000000..4b44083
Binary files /dev/null and b/tools/elftosb/test_files/plugin_hello differ
diff --git a/tools/elftosb/test_files/redboot_gcc.srec b/tools/elftosb/test_files/redboot_gcc.srec
new file mode 100644 (file)
index 0000000..0b74418
--- /dev/null
@@ -0,0 +1,3397 @@
+S02B00002F686F6D652F6376616E63652F32303035303530342F626C642F333630302F726564626F6F745F5276\r
+S21402600018F09FE518F09FE518F09FE518F09FE559\r
+S21402601018F09FE50000000018F09FE518F09FE5D5\r
+S214026020406002003C630200606302008C63020070\r
+S214026030A863020000000000CC640200886402002C\r
+S214026040100F11EE020AC0E30400C0E3010AC0E327\r
+S2140260500100C0E398159FE5010000E094159FE556\r
+S214026060010080E1100F01EE0000A0E10000A0E1B7\r
+S2140260700000A0E10000A0E10000A0E10000A0E115\r
+S2140260800000A0E10000A0E10000A0E3160F07EE6A\r
+S214026090150F07EE60059FE50311A0E3001080E5EB\r
+S2140260A058059FE50F16A0E3001080E550059FE512\r
+S2140260B00A16A0E3001080E548059FE548159FE50F\r
+S2140260C0001080E544059FE544159FE5001080E535\r
+S2140260D040059FE540159FE5001080E53C059FE5DD\r
+S2140260E03C159FE5001080E538059FE5031CA0E3FC\r
+S2140260F0001080E530059FE5011CA0E3001080E556\r
+S21402610028059FE50010E0E3001080E520059FE5E6\r
+S2140261100010E0E3001080E5E0049FE514159FE51B\r
+S214026120001080E510059FE50110A0E3001080E551\r
+S21402613008059FE50010A0E3001080E5FC049FE53B\r
+S2140261400410A0E3001080E5F4049FE50510A0E328\r
+S214026150001080E5EC049FE5EC149FE5001080E556\r
+S214026160E8049FE51316A0E3001080E5E0049FE52F\r
+S214026170D910A0E3001080E5D8049FE5D8149FE567\r
+S214026180001080E5D4049FE5011BA0E3001080E523\r
+S214026190CC049FE52310A0E3001080E5A201A0E353\r
+S2140261A0C0149FE5001080E5BC149FE5BC049FE583\r
+S2140261B0001080E5B8049FE5001080E5B4049FE572\r
+S2140261C0001080E5B0049FE5001080E5AC049FE572\r
+S2140261D0001080E5A8049FE5001080E5A4049FE572\r
+S2140261E0001080E5A0049FE5001080E59C049FE572\r
+S2140261F0001080E598049FE5001080E594049FE572\r
+S214026200001080E590049FE5001080E58C049FE571\r
+S214026210001080E588049FE5001080E584049FE571\r
+S214026220001080E580049FE5001080E59201A0E35F\r
+S2140262300318A0E3001080E570049FE50110A0E3B8\r
+S214026240001080E568049FE50010A0E3001080E5DA\r
+S214026250001080E50000A0E358149FE5082091E5B1\r
+S214026260082080E50000A0E368139FE5282091E55A\r
+S214026270282080E5182091E5182080E5382091E551\r
+S214026280382080E51C2091E51C2080E53C2091E525\r
+S2140262903C2080E50C2091E50C2080E52C2091E541\r
+S2140262A02C2080E5102091E5102080E5302091E535\r
+S2140262B0302080E5ECD29FE5D200A0E300F029E191\r
+S2140262C0E4D29FE5DB00A0E300F029E1D8D29FE507\r
+S2140262D0D300A0E300F029E100F069E1C4D29FE513\r
+S2140262E0CC129FE5CC229FE50000A0E3020051E11C\r
+S2140262F00200000A040081E4020051E1FCFFFF9A5A\r
+S214026300EC0A00EB4B1000EB0000A0E3A4139FE5A1\r
+S214026310042091E5042080E5242091E5242080E5F0\r
+S214026320031400EBD00A00EB531900EBFEFFFFEA62\r
+S2140263300000A0E300F0A0E10BB0ADDE6CD29FE55A\r
+S2140263403F002DE900104FE1200011E304004E0249\r
+S21402635002004E120120A0E30D30A0E1180000EA70\r
+S21402636000012DE944829FE53F0028E90830A0E1BC\r
+S2140263700001BDE800104FE1200011E304004E02C8\r
+S21402638002004E120220A0E30D0000EA1CD29FE596\r
+S2140263903F002DE904004EE200104FE10320A0E387\r
+S2140263A00D30A0E1060000EA00D29FE53F002DE98D\r
+S2140263B004004EE200104FE10420A0E30D30A0E1FD\r
+S2140263C0FFFFFFEA00400FE11F40C4E3134084E3EF\r
+S2140263D004F029E10D50A0E10E40A0E1C0D19FE5F6\r
+S2140263E00D0055E10200008AB0419FE5040055E128\r
+S2140263F005D0A08137002DE90D00A0E100200FE1B5\r
+S214026400C01081E32010C1E301F029E1007F20E9FA\r
+S21402641002F029E100D0A0E13F0093E8FF002DE959\r
+S21402642040109DE51F1001E2130051E34C109D053C\r
+S21402643034108D050D00A0E1660A00EB40009DE5D4\r
+S2140264401F1000E2130051E300F069E1FFFFDD08D0\r
+S21402645020208DE200100FE1C00080E32000C0E3A0\r
+S21402646000F029E1007F92E801F029E14C009DE569\r
+S21402647020008DE548009DE524008DE53C009DE565\r
+S21402648028008DE5FFE0DDE80180A0E328929FE585\r
+S214026490008089E500804FE11F9008E2120059E370\r
+S2140264A00200001A408088E308F069E104F05EE228\r
+S2140264B0F4D09FE500410DE9D280A0E308F029E17F\r
+S2140264C0E4D09FE500601DE90DF069E1D8D09FE5B4\r
+S2140264D03F002DE904004EE200104FE10620A0E343\r
+S2140264E00D30A0E100400FE11F40C4E3134084E3F7\r
+S2140264F004F029E10D50A0E10E40A0E137002DE99D\r
+S2140265000D00A0E100200FE1C01081E32010C1E3DE\r
+S21402651001F029E1007F20E902F029E100D0A0E1A4\r
+S2140265203F0093E8FF002DE940109DE51F1001E2B1\r
+S214026530130051E34C109D0534108D050D90A0E11B\r
+S2140265400900A0E1B00A00EB0040A0E10400A0E1CF\r
+S21402655068219FE5009082E5010070E30200001AC0\r
+S2140265600900A0E13D0A00EB060000EA5C109FE588\r
+S214026570041191E750209FE5046192E70920A0E10B\r
+S2140265800FE0A0E106F0A0E1ABFFFFEA0EF0A0E10B\r
+S21402659000000FE10EF0A0E10D00A0E10EF0A0E178\r
+S2140265A0203503002045030020550300A0340300D5\r
+S2140265B0203503001C340300048503000485030011\r
+S2140265C0C02D0300C02D03001C340300C42D03009D\r
+S2140265D0C82E0300CC2F030000600200C02D03006B\r
+S2140265E065436F73203A20004D61792020392032AE\r
+S2140265F030303500FFF30500780005000880018082\r
+S2140266001883018014830180188001800000FFFF38\r
+S214026610148001800000555528800180C0F00300D8\r
+S214026620248001804050010028810180248101805D\r
+S2140266301882018028820180FFFF0F00B0000480CC\r
+S214026640000002800001028010010280070707078F\r
+S21402665090000280A0000280C0000280F83333332C\r
+S214026660D0000280B0000280000003C00F0F0F0FA0\r
+S2140266706800008078000080880000809800008013\r
+S214026680A8000080B8000080C8000080D800008003\r
+S214026690E8000080F80000800801008018010080F1\r
+S2140266A028010080380100804801008058010080DF\r
+S2140266B00880038000C0018000600200C031030031\r
+S2140266C0E08203000DC0A0E130D82DE9E4409FE54A\r
+S2140266D004B04CE20C5194E5000055E30A0000BAFF\r
+S2140266E01800001A183194E5000053E32600001A39\r
+S2140266F0C0409FE5103194E5FF0053E3070000CA4F\r
+S214026700183194E5000053E30100001A0000E0E3AC\r
+S21402671030A81BE9A0009FE5071700EBFAFFFFEA87\r
+S214026720080084E2452F84E2080184E5011CA0E308\r
+S2140267300FE0A0E104F094E5000050E3100184E5C8\r
+S2140267400C0184E5070000DA68109FE50C3191E53C\r
+S214026750082191E5013043E20C3181E50100D2E4E3\r
+S214026760082181E530A81BE9E4FFFFAA140194E59D\r
+S214026770003094E50FE0A0E110F093E50010A0E1F0\r
+S21402678038009FE5EC1600EBDCFFFFEA202194E5DB\r
+S2140267902C309FE52C009FE50310D2E7012082E211\r
+S2140267A0202184E5E41600EB203194E5060053E34D\r
+S2140267B020518485CDFFFFEAC06F030080230300CB\r
+S2140267C0401603009C310300501603000DC0A0E1E2\r
+S2140267D0F0DD2DE97C509FE50140A0E104B04CE2DB\r
+S2140267E00510A0E10260A0E10370A0E100A0A0E114\r
+S2140267F00FE0A0E100F094E50080A0E10000A0E335\r
+S214026800000058E1451F45E2090000BA0C2094E555\r
+S214026810013CA0E3144105E5103181E5186181E5EC\r
+S2140268201C7181E5200181E50C0181E5042081E5EA\r
+S214026830F0AD1BE9000095E50FE0A0E110F094E54D\r
+S21402684000109AE50020A0E10C009FE5BA1600EBC6\r
+S2140268500800A0E1F0AD1BE9D47003005416030053\r
+S21402686010309FE5102193E5081083E20C2183E5A2\r
+S214026870081183E50EF0A0E1C06F03000DC0A0E191\r
+S21402688000D82DE920309FE504B04CE2002093E5C5\r
+S21402689018109FE5083092E5000053E300A81B0994\r
+S2140268A00FE0A0E103F0A0E100A81BE9C06F03001F\r
+S2140268B0C46602000DC0A0E100D82DE914309FE5A1\r
+S2140268C004B04CE2450F83E2002093E50FE0A0E11E\r
+S2140268D004F092E500A81BE9C06F03000DC0A0E11A\r
+S2140268E0000052E3F0D82DE904B04CE20070A0E1BB\r
+S2140268F00150A0E10060A0E3014042E2090000DA94\r
+S2140269000FE0A0E107F0A0E1000050E30430A0E1B0\r
+S214026910014044E2030000BA000053E30100C5E46C\r
+S214026920016086E2F5FFFFCA0600A0E1F0A81BE9B7\r
+S2140269300DC0A0E1F0DF2DE904B04CE251DF4DE2DC\r
+S2140269403420A0E30090A0E160110BE55C104BE25E\r
+S214026950E1FFFFEB00A0A0E3340050E30010E0E309\r
+S21402696064A10BE568110BE5F8029F150200000A08\r
+S214026970711600EB0A00A0E1F0AF1BE9BC345BE144\r
+S2140269800080A0E1020053E3DC029F15F7FFFF1A26\r
+S214026990B0235BE1080052E3B000008A40301BE5FA\r
+S2140269A0030050E1A300003A0070A0E30238A0E121\r
+S2140269B0230857E10C0000AA574F4BE20410A0E14F\r
+S2140269C00900A0E12020A0E3C3FFFFEB200050E374\r
+S2140269D0017087E2208088E2204084E29300001A59\r
+S2140269E0B0235BE1020057E1F3FFFFBA60311BE51B\r
+S2140269F0000053E360A11B050D00000A0238A0E167\r
+S214026A002338B0E100A0E0E30700000A0370A0E12B\r
+S214026A1028104BE2343111E5010053E37F00000AEF\r
+S214026A20017057E2201081E2F9FFFF1A60111BE5A0\r
+S214026A3001A06AE00070A0E30238A0E1230857E153\r
+S214026A400C0000AA28304BE26C310BE56C111BE5FA\r
+S214026A50343111E5010053E33000000A0238A0E1A8\r
+S214026A60017087E2230857E16C311BE5203083E290\r
+S214026A706C310BE5F4FFFFBA60111BE5000051E331\r
+S214026A801C00000A68111BE564311BE5DC619FE50A\r
+S214026A90032061E044301BE5D4519FE5033061E0FA\r
+S214026AA060111BE5CC419FE5033081E0022081E0C6\r
+S214026AB0002085E5003084E5001086E50000A0E3AE\r
+S214026AC06DFFFFEB00005AE30600001A001094E583\r
+S214026AD0002096E5003095E59C019FE5161600EB32\r
+S214026AE00100A0E3F0AF1BE90A10A0E18C019FE5CC\r
+S214026AF0111600EBF4FFFFEA68311BE56C619FE5B7\r
+S214026B006C519FE56C419FE5003086E564111BE5FC\r
+S214026B1044301BE5001085E5003084E5E6FFFFEA19\r
+S214026B20284111E568311BE5302111E5040053E1E7\r
+S214026B300430A021020058E168310BE5245111E52A\r
+S214026B400A4084E02A00009A053082E0080053E1F9\r
+S214026B5008306220034084202300003A000055E3F8\r
+S214026B60015045E2130000DA0400A0E13E1900EBF2\r
+S214026B70000050E30060A0E1018088E21300000AF2\r
+S214026B800FE0A0E109F0A0E1000050E30520A0E13B\r
+S214026B90015045E2090000BA0100C4E464111BE595\r
+S214026BA004306AE0030051E10310A031000052E312\r
+S214026BB064110BE5EBFFFFCAB0235BE1A6FFFFEA19\r
+S214026BC0BC009FE5DC1500EB0000A0E3F0AF1BE97C\r
+S214026BD00100A0E328FFFFEB0410A0E1A4009FE55C\r
+S214026BE0D51500EB0600A0E1F0AF1BE998009FE583\r
+S214026BF0F3FFFFEAD8FFFF2A6C611BE50FE0A0E176\r
+S214026C0009F0A0E1000050E3018088E2EBFFFFBA42\r
+S214026C10303116E5030058E1F7FFFF3ACEFFFFEAF0\r
+S214026C20283111E503005AE103A0A0217BFFFFEA09\r
+S214026C3058009FE5E2FFFFEA0FE0A0E109F0A0E1BD\r
+S214026C40000050E3018088E2DCFFFFBA40301BE51B\r
+S214026C50030058E1F7FFFF3AB0235BE151FFFFEA7A\r
+S214026C602C009FE541FFFFEA6C1603008416030022\r
+S214026C70E0840300A083030040840300A8160300F8\r
+S214026C80D0160300E8160300041703004C1703008F\r
+S214026C9080170300A01703000DC0A0E1000051E317\r
+S214026CA0F0D92DE904B04CE20080A0E10260A0E138\r
+S214026CB00070A0E3015041E2440000DA0FE0A0E1D8\r
+S214026CC008F0A0E1FF4000E20FE0A0E108F0A0E13A\r
+S214026CD041C044E2302044E2FF300CE2050053E3B8\r
+S214026CE009005283FF0000E20020A0E30200009A9F\r
+S214026CF0613044E2050053E30000008A0120A0E36D\r
+S214026D00000052E33300000A41E040E2302040E255\r
+S214026D10FF300EE2050053E3090052830020A0E391\r
+S214026D200200009A613040E2050053E30000008A48\r
+S214026D300120A0E3000052E32600000A302044E2CD\r
+S214026D40FF3002E2090053E30010A0E30774A0E15B\r
+S214026D500210A0910600009A613044E2050053E357\r
+S214026D60571044920200009AFF300CE2050053E3EB\r
+S214026D7037104492302040E2FF3002E2090053E32B\r
+S214026D8001C2A0E10010A0E30210A0910600009A42\r
+S214026D90613040E2050053E3571040920200009A29\r
+S214026DA0FF300EE2050053E337104092000056E330\r
+S214026DB00030961501208CE102308310027087E1C4\r
+S214026DC000308615000055E3015045E2BAFFFFCABF\r
+S214026DD00700A0E1F0A91BE90000E0E3F0A91BE927\r
+S214026DE00DC0A0E1F0DF2DE904B04CE20080A0E384\r
+S214026DF01CD04DE20060A0E10100A0E330100BE5DC\r
+S214026E000010E0E338000BE53C800BE540800BE524\r
+S214026E1044100BE50FE0A0E106F0A0E1000050E30D\r
+S214026E200040A0E1690000DA530054E3AC00001A07\r
+S214026E300FE0A0E106F0A0E128A04BE20050A0E39C\r
+S214026E4004502AE50030A0E10110A0E30600A0E10C\r
+S214026E500A20A0E1FF7003E28EFFFFEB050050E17F\r
+S214026E600040A0E1028088E2960000BA303047E295\r
+S214026E70018088E2090053E303F19F975C0000EA71\r
+S214026E809C6F0200A86E0200A86E0200A86E0200A6\r
+S214026E90F46F0200F46F0200F46F0200107002003A\r
+S214026EA010700200107002000A20A0E12F1047E2C4\r
+S214026EB00600A0E177FFFFEB38201BE5073088E0ED\r
+S214026EC0000052E30050A0E12F8043E234000BE5BD\r
+S214026ED00700000A30301BE50020A0E3000053E361\r
+S214026EE030101B05030060103C000B153C100B0510\r
+S214026EF038200BE53C301BE544101BE5035085E0CB\r
+S214026F00053063E0030051E10310A0210500A0E173\r
+S214026F1044100BE5541800EB000050E30090A0E18B\r
+S214026F202C00000A042067E02E4082E2000054E3B0\r
+S214026F30048088E02D4082E2070000DA0600A0E125\r
+S214026F400110A0E30A20A0E152FFFFEB000054E389\r
+S214026F500100C5E4014044E2F7FFFFCA0020A0E3B7\r
+S214026F600600A0E10110A0E34AFFFFEB2C205BE540\r
+S214026F700030E0E1FF4003E2020054E12C200BE582\r
+S214026F80018088E20A00001A3C201BE540301BE51F\r
+S214026F90050062E0030050E140000B850FE0A0E12F\r
+S214026FA006F0A0E10A0050E399FFFF0A018088E29A\r
+S214026FB0F9FFFFEA0100A0E32FFEFFEB34101BE50A\r
+S214026FC02C201BE50430A0E12C019FE5DA1400EB2F\r
+S214026FD00000A0E3F0AF1BE90100A0E326FEFFEBF2\r
+S214026FE00510A0E114019FE5D31400EB0900A0E10F\r
+S214026FF0F0AF1BE90100A0E31FFEFFEB00019FE5D7\r
+S2140270000810A0E10720A0E1CB1400EBEFFFFFEA97\r
+S2140270103B1067E20600A0E10A20A0E11DFFFFEB9D\r
+S2140270200050A0E130001BE5000050E31C00000AFF\r
+S21402703044101BE540001BE5052061E0003061E0DE\r
+S21402704030101BE5BC709FE5BC609FE5BC409FE529\r
+S214027050012082E0033081E0003086E5002084E5EE\r
+S214027060001087E50000A0E303FEFFEB3C001BE5F3\r
+S214027070000050E30600001A001094E5002097E591\r
+S214027080003096E588009FE5AB1400EB000096E51D\r
+S214027090F0AF1BE90010A0E178009FE5A61400EB14\r
+S2140270A0F4FFFFEA5C709FE55C609FE55C409FE54D\r
+S2140270B044201BE540301BE5002087E5003086E5CE\r
+S2140270C0005084E5E6FFFFEA0100A0E3EAFDFFEBDD\r
+S2140270D00810A0E140009FE5971400EB0500A0E130\r
+S2140270E0F0AF1BE90100A0E3E3FDFFEB2C009FE5F8\r
+S2140270F00810A0E10420A0E1C2FFFFEABC170300CB\r
+S214027100F817030044180300E0840300A08303007A\r
+S21402711040840300A8160300D0160300701803006C\r
+S214027120941803000DC0A0E1F0DD2DE904B04CE296\r
+S2140271300040A0E3DCE39FE5D0504BE2E4D04DE212\r
+S2140271400060A0E10420A0E1E0C04BE20170A0E1F3\r
+S2140271500500A0E17610A0E30230A0E300C08DE5B2\r
+S21402716008E08DE5E8400BE5F8400BE504408DE5C8\r
+S2140271708A1C00EBA0E39FE50420A0E1E4C04BE2FA\r
+S214027180B8004BE27210A0E30230A0E300C08DE527\r
+S21402719010408DE9811C00EBE8C04BE200C08DE593\r
+S2140271A078C39FE50430A0E1ECE04BE2A0004BE29E\r
+S2140271B06210A0E30120A0E304E08DE508C08DE59F\r
+S2140271C0761C00EBF0C04BE20120A0E300C08DE588\r
+S2140271D04CC39FE50230A0E1F4E04BE288004BE2AC\r
+S2140271E06D10A0E304E08DE508C08DE56B1C00EB96\r
+S2140271F004C0A0E30480A0E100C08DE504A0A0E1E5\r
+S21402720020C39FE5014084E20600A0E1F8E04BE2DD\r
+S2140272100710A0E10420A0E10530A0E104E08DE51E\r
+S2140272200CC08DE508408DE5651C00EB080050E1BA\r
+S2140272300860A0E1F0AD1B09F4301BE5080053E13D\r
+S214027240B200000AE0429FE5E0329FE50450A0E16A\r
+S214027250030054E10C00000AF0001BE5941E00EB4C\r
+S214027260001094E50020A0E1F0001BE5A21700EB59\r
+S214027270000050E304A094050300000AAC329FE528\r
+S214027280144084E2030054E1F2FFFF1A00005AE3BE\r
+S2140272908B00000A083094E50C1094E5E0201BE50C\r
+S2140272A0000051E3032002E0E0200BE50200000AA2\r
+S2140272B0F8301BE5000053E37B00000AEC301BE5C8\r
+S2140272C0000053E36D00001AE4301BE5000053E3B0\r
+S2140272D00200000AEC301BE5000053E36400000ADB\r
+S2140272E0F8201BE50030E0E3000054E3D4300BE561\r
+S2140272F0DC200BE510C094155B00000ADC004BE2B4\r
+S2140273000A10A0E1E0201BE50030A0E3D8C00BE5A0\r
+S2140273102DFDFFEB000050E30050A0E1F0AD1BB9DD\r
+S214027320E4301BE5000053E3E8401B150070A01391\r
+S2140273302900001A0360A0E124404BE2E0FCFFEBC8\r
+S214027340000050E3016086E20050A0E1030000BAAC\r
+S214027350030056E3040044E5014084E2F6FFFF9A88\r
+S214027360000055E30E0000BA3CFDFFEB27004BE29F\r
+S214027370BC119FE50320A0E3E61D00EB000050E3EE\r
+S2140273801100000A28305BE5530053E30600000AAA\r
+S2140273900100A0E338FDFFEB98019FE528101BE5EE\r
+S2140273A0E51300EB42FDFFEBF0AD1BE927305BE592\r
+S2140273B0303043E2090053E3F4FFFF8AE8101BE58E\r
+S2140273C074019FE585FEFFEBF5FFFFEAE8101BE57B\r
+S2140273D064019FE555FDFFEBF1FFFFEAB8FCFFEB0A\r
+S2140273E00050A0E1000055E30400A0E10C0000BA42\r
+S2140273F01D1700EB000050E30100001A000056E3E0\r
+S2140274000100000A0150C4E4F3FFFFEA0100A0E312\r
+S21402741019FDFFEB0410A0E120019FE5C61300EB67\r
+S2140274200070E0E3E8101BE514319FE514219FE5A8\r
+S214027430001083E510319FE50000A0E3001082E50E\r
+S214027440004083E50CFDFFEB000057E30480A0E15B\r
+S214027450D3FFFF1AE8101BE5012044E20130A0E149\r
+S214027460E8009FE5B41300EBCDFFFFEA04C0A0E1FD\r
+S214027470A1FFFFEAD8009FE5AF1300EBF0AD1BE9D2\r
+S214027480E8001BE5F81600EB000050E38DFFFF1A3C\r
+S214027490E8101BE5BC009FE5831A00EB000050E3F2\r
+S2140274A0F0AD1B090160A0E386FFFFEAA8009FE596\r
+S2140274B0A11300EBA4109FE5A4009FE59E1300EB2A\r
+S2140274C0F0AD1BE9F0101BE598009FE59A1300EB60\r
+S2140274D058309FE50540A0E1030055E10600000A8A\r
+S2140274E00350A0E1001094E57C009FE5144084E27E\r
+S2140274F0911300EB050054E1F9FFFF1A6C009FE5BB\r
+S2140275008D1300EB00005AE361FFFF1AF0AD1BE992\r
+S2140275105C009FE5D7FFFFEAC0180300C818030007\r
+S214027520D8180300E818030010190300F03303000C\r
+S214027530183403001C19030020190300C466020055\r
+S2140275404019030040840300E0840300A083030084\r
+S2140275507C190300A8190300CC190300001A0300C3\r
+S2140275604C310300141A0300241A03007C2503007E\r
+S214027570802303004C1A03000DC0A0E110D82DE9A9\r
+S21402758028409FE504B04CE204D04DE2003094E57A\r
+S21402759011104BE2000093E51C2093E50FE0A0E1FA\r
+S2140275A002F0A0E1000050E310A81B09F6FFFFEA74\r
+S2140275B0205503000DC0A0E1F0D82DE954639FE5E5\r
+S2140275C004B04CE204D04DE20050A0E3303496E51D\r
+S2140275D00570A0E1050053E10540A0E1C500001AD0\r
+S2140275E01D604BE22C339FE50610A0E1002093E5D8\r
+S2140275F0014084E2000092E51C3092E50FE0A0E133\r
+S21402760003F0A0E1000050E3B300000A1D105BE5A2\r
+S214027610013041E2170053E303F19F97210000EA8D\r
+S2140276208076020090760200A87602008C7802002D\r
+S214027630A8760200A8760200A8760200A8760200C3\r
+S214027640A8760200A8760200A8760200A8760200B3\r
+S214027650A8760200A8760200A8760200A8760200A3\r
+S214027660A8760200A8760200A8760200A876020093\r
+S214027670A8760200A8760200A8760200B878020071\r
+S21402768090229FE51C3492E5013083E21C3482E5A9\r
+S21402769080229FE5020051E3203492050150A0E3C8\r
+S2140276A00530830020348205000055E3CCFFFF0A34\r
+S2140276B060429FE5003094E5011B84E2000093E5FA\r
+S2140276C0081081E21C2093E50FE0A0E102F0A0E1A1\r
+S2140276D0000050E30100001A0200E0E3F0A81BE9F4\r
+S2140276E0003094E5011B84E2000093E5091081E274\r
+S2140276F01C2093E50FE0A0E102F0A0E1000050E3B9\r
+S214027700F4FFFF0A1D205BE50050A0E3010052E3F0\r
+S214027710012BA0138020A003043084E2020055E16E\r
+S214027720043484E5102484E50E0000AA003094E5B3\r
+S2140277300610A0E1000093E51C2093E50FE0A0E10F\r
+S21402774002F0A0E1000050E3041085E0015085E25B\r
+S214027750E0FFFF0A103494E51D205BE5030055E1C7\r
+S2140277600420C1E5F0FFFFBAA8419FE5003094E58A\r
+S214027770011B84E2000093E50A1081E21C2093E5D7\r
+S2140277800FE0A0E102F0A0E1000050E3D1FFFF0A03\r
+S214027790283494E5000053E33100001A74419FE553\r
+S2140277A074319FE574119FE50320D4E70130D4E7D6\r
+S2140277B0032022E0FF0052E30200000A6DFFFFEB07\r
+S2140277C00500E0E3F0A81BE9280494E5000050E376\r
+S2140277D01700001A103494E50050A0E1030050E1AF\r
+S2140277E0090000AA04C0A0E10310A0E10C2085E075\r
+S2140277F00430D2E5015085E2003083E00338A0E190\r
+S214027800010055E14308A0E1F7FFFFBA04119FE526\r
+S2140278100C319FE5FF0000E20320D1E7000052E1B1\r
+S2140278200100000A0600E0E3F0A81BE90000A0E35E\r
+S214027830F0A81BE9101494E5040084E2B61D00EBE0\r
+S214027840DC309FE5DC209FE50310D4E70230D4E766\r
+S2140278500008A0E1013483E1200853E1F2FFFF0AA9\r
+S214027860EFFFFFEA003094E5011B84E2000093E597\r
+S2140278700B1081E21C2093E50FE0A0E102F0A0E1EC\r
+S214027880000050E393FFFF0AC3FFFFEA010054E340\r
+S21402789084FFFF1A7C309FE50610A0E3002093E5E4\r
+S2140278A0000092E50C3092E50FE0A0E103F0A0E1C3\r
+S2140278B00300E0E3F0A81BE958209FE5017087E289\r
+S2140278C0243492E5030057E3013083E2243482E550\r
+S2140278D00400E003F0A81B0972FFFFEA25FFFFEB96\r
+S2140278E044309FE544009FE5482093E50FE0A0E181\r
+S2140278F002F0A0E177FFFFEA003096E50610A0E36B\r
+S214027900000093E50C2093E50FE0A0E102F0A0E171\r
+S214027910305486E531FFFFEA2055030008040000D4\r
+S214027920090400000A0400000B04000050000000D6\r
+S21402793090D003000DC0A0E1F0D92DE978419FE573\r
+S21402794004B04CE2343094E50060A0E10000E0E3CD\r
+S2140279500180A0E10FE0A0E103F0A0E1082096E597\r
+S2140279600050A0E1000052E3343094A5343094B5C0\r
+S2140279700200A0A10FE0A0E103F0A0E138119FE50C\r
+S21402798038419FE5142091E50500A0E1343091E5E9\r
+S214027990002084E50FE0A0E103F0A0E1002094E5DA\r
+S2140279A00710A0E3000092E514C092E57D2EA0E346\r
+S2140279B00FE0A0E10CF0A0E10030A0E30120A0E37C\r
+S2140279C0282484E5103484E52C3484E5303484E5B8\r
+S2140279D0042096E50A70A0E3243484E5142484E5A2\r
+S2140279E0183484E51C3484E5203484E50460A0E180\r
+S2140279F01350A0E3EEFEFFEB0040A0E1000054E3CC\r
+S214027A00BC009FE52000000A030074E30800000A99\r
+S214027A10050074E30530A0E1015045E20100000ACA\r
+S214027A20000053E3F2FFFFCA0000E0E3004088E5EF\r
+S214027A30F0A91BE9017047E2000057E37C309FD5AE\r
+S214027A400020A0D3282483D56C309FE5482093E5F8\r
+S214027A500FE0A0E102F0A0E1281496E5003096E5DA\r
+S214027A60000051E3000093E51510A0030C2093E5F7\r
+S214027A704310A0130FE0A0E102F0A0E1183496E54F\r
+S214027A80013083E2183486E5E0FFFFEA2C109FE51A\r
+S214027A9030309FE50400A0E10320D1E7104481E5E1\r
+S214027AA0000052E30130A0033034810518309FE510\r
+S214027AB00120A0E30320C1E7F0A91BE95000000063\r
+S214027AC02055030020A10700080400000C04000053\r
+S214027AD00DC0A0E1F0DF2DE904B04CE2A0C29FE5A4\r
+S214027AE00170A0E12C149CE5000057E30030A0D3FF\r
+S214027AF00130A0C3000051E30030A013013003029E\r
+S214027B00000053E30080A0E10290A0E100A0A0E301\r
+S214027B104000000A10349CE5000053E33000001ACF\r
+S214027B205C529FE51360A0E3A1FEFFEB50C29FE507\r
+S214027B300040A0E1000054E30C00A0E144E29FE50F\r
+S214027B400E00001A40329FE50610A0E30320DCE791\r
+S214027B500E30DCE7030052E16B00000A24329FE598\r
+S214027B6024229FE50300DCE70230DCE7010040E266\r
+S214027B70FF0000E2000053E10740E0135C00000A49\r
+S214027B80050074E31000000A040074E33500000ADE\r
+S214027B90281495E5003095E5000051E3000093E5D2\r
+S214027BA01510A0030C2093E54310A0130FE0A0E1EC\r
+S214027BB002F0A0E1183495E5013083E2183485E539\r
+S214027BC0000056E3016046E2D6FFFFCA000054E317\r
+S214027BD0AC319FB50020E0B3004089B5102483B5D0\r
+S214027BE00C0000BA98519FE52C1495E5000051E36D\r
+S214027BF00A00000A000057E30030A0D30130A0C3F9\r
+S214027C00000051E30030A01301300302000053E3EA\r
+S214027C1005C0A0E1BEFFFF1A0A00A0E1F0AF1BE913\r
+S214027C20104495E5041495E5070054E10740A0A129\r
+S214027C300800A0E10420A0E1951200EB103495E5BF\r
+S214027C40042495E5033064E0042082E02C1495E5D4\r
+S214027C50103485E5042485E5077064E0048088E036\r
+S214027C6004A08AE0E2FFFFEA14519FE50660A0E363\r
+S214027C70003095E50610A0E1000093E50C2093E5A0\r
+S214027C800FE0A0E102F0A0E1143495E5020053E310\r
+S214027C900200000A0130A0E32C3485E5CAFFFFEAA1\r
+S214027CA0281495E5003095E5000051E3000093E5C1\r
+S214027CB01510A0030C2093E54310A0130FE0A0E1DB\r
+S214027CC002F0A0E1183495E5013083E2183485E528\r
+S214027CD037FEFFEB003095E50040A0E10610A0E17C\r
+S214027CE0000093E50C2093E50FE0A0E102F0A0E18E\r
+S214027CF0E7FFFFEA00309CE5000093E50C2093E5E1\r
+S214027D000FE0A0E102F0A0E1ACFFFFEA04149CE55C\r
+S214027D1010C49CE5013083E20120A0E30E30C0E7E8\r
+S214027D20302480E50C1081E0013051E51A0053E35F\r
+S214027D30A5FFFF1A023051E51A0053E3A2FFFF1A0D\r
+S214027D40033051E51A0053E39FFFFF1A00005CE37D\r
+S214027D509DFFFF0A0010A0E1103491E5012043E2E6\r
+S214027D60000052E3102481E597FFFF0A043491E5F0\r
+S214027D70023083E0012053E51A0052E3F5FFFF0AC2\r
+S214027D8091FFFFEA205503000C04000008040000DF\r
+S214027D900DC0A0E110D82DE904B04CE238C09FE532\r
+S214027DA008D04DE234009FE528E49CE518449CE5A3\r
+S214027DB000005EE324E49CE524109FE51C249CE579\r
+S214027DC00010A01120349CE518009FE500E08DE528\r
+S214027DD004408DE5581100EB10A81BE9205503005E\r
+S214027DE0641A0300681A0300701A03000DC0A0E1AB\r
+S214027DF0000050E330D82DE904B04CE20140A0E187\r
+S214027E003A00000A0C519FE5143495E5013043E22E\r
+S214027E10010053E330A81B89003095E51840A0E323\r
+S214027E20000093E50410A0E10C2093E50FE0A0E12A\r
+S214027E3002F0A0E1003095E50410A0E1000093E511\r
+S214027E400C2093E50FE0A0E102F0A0E1003095E5FA\r
+S214027E500410A0E1000093E50C2093E50FE0A0E1FA\r
+S214027E6002F0A0E1003095E50410A0E1000093E5E1\r
+S214027E700C2093E50FE0A0E102F0A0E1003095E5CA\r
+S214027E80104044E2000093E50410A0E10C2093E5C4\r
+S214027E900FE0A0E102F0A0E1003095E50410A0E1B9\r
+S214027EA0000093E50C2093E50FE0A0E102F0A0E1CC\r
+S214027EB0003095E50410A0E1000093E50C2093E560\r
+S214027EC00FE0A0E102F0A0E1003095E50410A0E189\r
+S214027ED0000093E50C2093E50FE0A0E102F0A0E19C\r
+S214027EE0A4FDFFEB0130A0E32C3485E530A81BE9A6\r
+S214027EF00FE0A0E104F0A0E1010070E3FBFFFFCA7F\r
+S214027F0014309FE514009FE5482093E50FE0A0E1BA\r
+S214027F1002F0A0E130A81BE9205503005000000043\r
+S214027F2090D00300080080E2070050E300F19F971C\r
+S214027F30090000EA647F02006C7F0200747F020080\r
+S214027F407C7F0200847F02008C7F0200947F020006\r
+S214027F50547F020040009FE50EF0A0E13C009FE542\r
+S214027F600EF0A0E138009FE50EF0A0E134009FE598\r
+S214027F700EF0A0E130009FE50EF0A0E12C009FE598\r
+S214027F800EF0A0E128009FE50EF0A0E124009FE598\r
+S214027F900EF0A0E120009FE50EF0A0E1B41A030067\r
+S214027FA0C81A0300D81A0300F01A0300041B0300C1\r
+S214027FB0141B0300201B03002C1B0300381B0300AA\r
+S214027FC00DC0A0E170D82DE904B04CE250D04DE2CD\r
+S214027FD04CC04BE248404BE200C08DE52CC19FE509\r
+S214027FE050E04BE20060A0E10150A0E10400A0E1F5\r
+S214027FF06210A0E30120A0E30030A0E304E08DE5D8\r
+S21402800008C08DE5E51800EB54C04BE200C08DE5D4\r
+S214028010FCC09FE558E04BE230004BE26C10A0E358\r
+S2140280200120A0E30030A0E304E08DE508C08DE562\r
+S214028030DA1800EB02C0A0E300C08DE5D4C09FE5CD\r
+S2140280400430A0E10510A0E10040A0E30600A0E194\r
+S2140280500120A0E308408DE50CC08DE504408DE5C7\r
+S214028060D71800EB040050E170A81B0950301BE53E\r
+S214028070A4009FE5040053E10200000A58301BE505\r
+S214028080040053E11600001A90309FE590209FE509\r
+S21402809000E093E5003092E503005EE10A00003A54\r
+S2140280A080309FE580209FE500C093E5003092E592\r
+S2140280B003005CE10400002A0C005EE10E10A0E161\r
+S2140280C00C20A0E10C306EE00100003A9A1000EBA2\r
+S2140280D070A81BE954009FE554300BE54CE00BE515\r
+S2140280E0951000EB54101BE54C001BE5711B00EBD2\r
+S2140280F054C01BE50010A0E10C20A0E10130A0E175\r
+S2140281002C009FE500C08DE58B1000EB70A81BE9E4\r
+S214028110441C0300541C0300681B03006C1B030072\r
+S214028120E084030000840300A0830300408303006E\r
+S214028130901B0300B01B03000DC0A0E1F0D82DE990\r
+S21402814004B04CE2C4D04DE2B0C04BE2AC504BE2BD\r
+S21402815000C08DE520C29FE5B4E04BE20060A0E1DE\r
+S2140281600170A0E10500A0E16210A0E30120A0E3F7\r
+S2140281700030A0E304E08DE508C08DE5871800EB2B\r
+S214028180B8C04BE200C08DE5F0C19FE5BCE04BE213\r
+S21402819094004BE26C10A0E30120A0E30030A0E3C1\r
+S2140281A004E08DE508C08DE57C1800EBC0C04BE20C\r
+S2140281B000C08DE5C8C19FE5C4E04BE27C004BE2FF\r
+S2140281C07010A0E30120A0E30030A0E30040A0E38B\r
+S2140281D004E08DE508C08DE5701800EBA4E19FE58C\r
+S2140281E0C8C04BE264004BE23410A0E30420A0E1D6\r
+S2140281F00230A0E300C08DE510408DE9671800EB61\r
+S21402820084E19FE5CCC04BE24C004BE23210A0E387\r
+S2140282100420A0E10230A0E300C08DE510408DE905\r
+S2140282205E1800EB64E19FE5D0C04BE234004BE2FF\r
+S2140282303110A0E30420A0E10230A0E300C08DE5E7\r
+S21402824010408DE9551800EB06C0A0E300C08DE58E\r
+S2140282503CC19FE50600A0E10710A0E10530A0E1C1\r
+S2140282600120A0E308408DE50CC08DE504408DE5B5\r
+S214028270531800EB040050E1F0A81B09B4301BE5CC\r
+S214028280040053E10200000ABC301BE5040053E17F\r
+S2140282900200001AFC009FE5271000EBF0A81BE97D\r
+S2140282A0C4301BE5000053E3C0300B05D0301BE59D\r
+S2140282B0000053E30F00000AB8301BE5013043E22A\r
+S2140282C0000053E3B8300BE5F0A81BB9B0101BE56D\r
+S2140282D0C0205BE5013081E2B0300BE50020C1E54D\r
+S2140282E0B8301BE5013043E2000053E3B8300BE53B\r
+S2140282F0F0A81BB9F4FFFFEACC301BE5000053E3FD\r
+S2140283000F00000AB8301BE5023043E2000053E3D8\r
+S214028310B8300BE5F0A81BB9B00C5BE1B8201BE542\r
+S214028320B0101BE5022042E2023081E2000052E376\r
+S214028330B0300BE5B000C1E1B8200BE5F0A81BB9E0\r
+S214028340F5FFFFEAB8301BE5043043E2000053E3D2\r
+S214028350B8300BE5F0A81BB9C0001BE5B0101BE552\r
+S2140283600320A0E1042052E2040081E4B8200B4579\r
+S214028370B0100B45F0A81B49F9FFFFEA441C0300A6\r
+S214028380541C0300001D0300081D03001C1D0300EF\r
+S214028390301D0300681B03005C1C03000DC0A0E137\r
+S2140283A0F0D82DE904B04CE2BC429FE5AC504BE25B\r
+S2140283B0C4D04DE2B0C04BE2B4E04BE20060A0E1B4\r
+S2140283C00170A0E10500A0E17310A0E30120A0E384\r
+S2140283D00030A0E300508DE808408DE5EF1700EB73\r
+S2140283E0B8C04BE200C08DE580C29FE5BCE04BE220\r
+S2140283F094004BE26C10A0E30120A0E30030A0E35F\r
+S21402840004E08DE508C08DE5E41700EBC0C04BE242\r
+S214028410C4E04BE27C004BE26410A0E30120A0E340\r
+S2140284200030A0E300508DE808408DE5DB1700EB36\r
+S2140284300040A0E338E29FE5C8C04BE264004BE28E\r
+S2140284403410A0E30420A0E10230A0E300C08DE5D2\r
+S21402845010408DE9D11700EB18E29FE5CCC04BE245\r
+S2140284604C004BE23210A0E30420A0E10230A0E36D\r
+S21402847000C08DE510408DE9C81700EBF8E19FE5D6\r
+S214028480D0C04BE234004BE23110A0E30420A0E15E\r
+S2140284900230A0E300C08DE510408DE9BF1700EB67\r
+S2140284A006C0A0E300C08DE5D0C19FE50600A0E1AE\r
+S2140284B00710A0E10530A0E10120A0E308408DE509\r
+S2140284C00CC08DE504408DE5BD1700EB040050E1BD\r
+S2140284D0F0A81B09B4301BE5040053E10500000AAE\r
+S2140284E0C4301BE5040053E10200000ABC301BE561\r
+S2140284F0040053E10200001A84019FE58E0F00EB90\r
+S214028500F0A81BE9D0301BE5000053E31E00000A6A\r
+S214028510B8301BE5013043E2000053E3B8300BE508\r
+S214028520F0A81BB9B0E01BE5C0401BE501308EE2A7\r
+S214028530012084E2B0300BE5C0200BE50010DEE53A\r
+S2140285400030D4E5030051E10500001AB8301BE5FF\r
+S214028550013043E2000053E3B8300BE5F0A81BB944\r
+S214028560EFFFFFEAB0E00BE5C0400BE50020DEE5DA\r
+S21402857000C0D4E50C019FE50E10A0E10430A0E196\r
+S21402858000C08DE56C0F00EBF0A81BE9CC301BE5B4\r
+S214028590000053E31C00000AB8301BE5023043E239\r
+S2140285A0000053E3B8300BE5F0A81BB9B0C01BE5DA\r
+S2140285B0C0E01BE5B040DCE1B050DEE102208CE218\r
+S2140285C002308EE2050054E1B0200BE5C0300BE528\r
+S2140285D00500001AB8301BE5023043E2000053E300\r
+S2140285E0B8300BE5F0A81BB9EFFFFFEA98009FE54D\r
+S2140285F00C10A0E10420A0E10E30A0E100508DE5B1\r
+S214028600B0C00BE5C0E00BE5DDFFFFEAB8301BE5C6\r
+S214028610043043E2000053E3B8300BE5F0A81BB980\r
+S214028620B0C01BE5C0E01BE500409CE500509EE59F\r
+S21402863004208CE204308EE2050054E1B0200BE503\r
+S214028640C0300BE50500001AB8301BE5043043E2E3\r
+S214028650000053E3B8300BE5F0A81BB9EFFFFFEAC2\r
+S21402866028009FE50C10A0E1E1FFFFEA441C03008E\r
+S214028670541C0300081D03001C1D0300301D0300CC\r
+S214028680681B0300441D03007C1D0300A81D030095\r
+S214028690D41D03000DC0A0E1F0D92DE904B04CE2D0\r
+S2140286A00180A0E388429FE5B0504BE2C4D04DE281\r
+S2140286B0B4C04BE2B8E04BE20060A0E10170A0E17A\r
+S2140286C00500A0E17310A0E30820A0E10030A0E3BB\r
+S2140286D000508DE808408DE5301700EBBCC04BE239\r
+S2140286E000C08DE54CC29FE5C0E04BE298004BE22D\r
+S2140286F06C10A0E30820A0E10030A0E304E08DE5C2\r
+S21402870008C08DE5251700EBC4C04BE2C8E04BE27B\r
+S21402871080004BE26410A0E30820A0E10030A0E352\r
+S21402872000508DE808408DE51C1700EB0040A0E3E2\r
+S21402873004E29FE5CCC04BE268004BE23410A0E3B3\r
+S2140287400420A0E10230A0E300C08DE510408DE9D0\r
+S214028750121700EBE4E19FE5D0C04BE250004BE27B\r
+S2140287603210A0E30420A0E10230A0E300C08DE5B1\r
+S21402877010408DE9091700EBC4E19FE5D4C04BE237\r
+S21402878038004BE23110A0E30420A0E10230A0E35F\r
+S21402879000C08DE510408DE9001700EB06C0A0E38F\r
+S2140287A000C08DE59CC19FE50600A0E10710A0E190\r
+S2140287B00530A0E10820A0E108408DE50CC08DE55B\r
+S2140287C004408DE5FE1600EB040050E1F0A91B09FB\r
+S2140287D0B8301BE5040053E10C00000AC8301BE564\r
+S2140287E0040053E10900000AC0301BE5040053E10F\r
+S2140287F00600000ACC201BE5D0E01BE5D4C01BE532\r
+S2140288000E3082E00C3083E0080053E1020000DA0A\r
+S21402881034019FE5C80E00EBF0A91BE900005EE3F9\r
+S214028820BC301B150280A013013083120130C31323\r
+S2140288300700001A000052E30100001A00005CE381\r
+S2140288400400001ABC301BE50480A0E3033083E278\r
+S2140288500330C3E3BC300BE5B4101BE5C4201BE5B4\r
+S214028860BC301BE5010052E1030081E00800009ADB\r
+S214028870000052E10600002A033068E0010068E0CA\r
+S214028880032082E0031081E0C4200BE5B4100BE560\r
+S214028890008068E200005CE30D00000A000051E17F\r
+S2140288A0F0A91B090010D1E5C4301BE50010C3E592\r
+S2140288B0B4201BE5C4301BE5081082E0083083E0D4\r
+S2140288C0000051E1C4300BE5B4100BE5F0A91B091A\r
+S2140288D0F3FFFFEA00005EE30B00000A000051E12E\r
+S2140288E0F0A91B09C4301BE5B020D1E1081081E0D5\r
+S2140288F0B020C3E1000051E1083083E0C4300BE54C\r
+S214028900B4100BE5F0A91B09F5FFFFEA000051E1E0\r
+S214028910F0A91B09C4201BE5083091E6000051E1CE\r
+S214028920083082E6B4100B05C4200B05F0A91B091B\r
+S214028930F8FFFFEA441C0300541C0300981E0300C1\r
+S214028940AC1E0300C01E0300681B03005C1E03006F\r
+S2140289500DC0A0E1F0DF2DE904B04CE2C0D04DE23C\r
+S214028960BCC04BE2B8504BE200C08DE5E8C29FE5C2\r
+S214028970C0E04BE20060A0E10170A0E10500A0E1CA\r
+S2140289806210A0E30120A0E30030A0E304E08DE53E\r
+S21402899008C08DE5811600EBC4C04BE200C08DE531\r
+S2140289A0B8C29FE5C8E04BE2A0004BE26C10A0E321\r
+S2140289B00120A0E30030A0E30040A0E304E08DE540\r
+S2140289C008C08DE5751600EB94E29FE5CCC04BE23D\r
+S2140289D088004BE27310A0E30420A0E10230A0E37B\r
+S2140289E000C08DE510408DE96C1600EB74E29FE541\r
+S2140289F0D0C04BE270004BE23410A0E30420A0E1AA\r
+S214028A000230A0E300C08DE510408DE9631600EB4E\r
+S214028A1054E29FE5D4C04BE258004BE23210A0E38A\r
+S214028A200420A0E10230A0E300C08DE510408DE9ED\r
+S214028A305A1600EB34E29FE5D8C04BE240004BE208\r
+S214028A403110A0E30420A0E10230A0E300C08DE5CF\r
+S214028A5010408DE9511600EB06C0A0E300C08DE57C\r
+S214028A600CC29FE50600A0E10710A0E10530A0E1D8\r
+S214028A700120A0E308408DE50CC08DE504408DE59D\r
+S214028A804F1600EB040050E1F0AF1B09C0301BE5A7\r
+S214028A90040053E1DCA19F15C8101B156900001ADB\r
+S214028AA0D0A19FE500309AE5040053E16700000A72\r
+S214028AB0C8101BE5BC300BE5000051E36100001A4C\r
+S214028AC0B4919FE50110A0E3002099E5C8100BE5DC\r
+S214028AD0C4200BE5D0301BE5000053E30420A013AE\r
+S214028AE00700001AD4301BE5000053E30220A0134F\r
+S214028AF00300001AD8301BE5000053E30200000A08\r
+S214028B000120A0E374319FE50020C3E5000051E395\r
+S214028B10CC301BE52020A003C4200B05000053E345\r
+S214028B203100000AC4201BE50080A0E3020058E1E1\r
+S214028B300400003ABC301BE5002089E5023083E0E1\r
+S214028B4000308AE5F0AF1BE9100052E30270A03154\r
+S214028B501070A023BC201BE5056087E2022088E097\r
+S214028B600610A0E118019FE5F30D00EBBC201BE503\r
+S214028B700050A0E3081082E08531A0E13133A0E185\r
+S214028B80015085E2FF3003E2030055E3036086E00E\r
+S214028B90F8FFFFDA0050A0E3070055E1090000AA3B\r
+S214028BA0083082E00540D3E7D8009FE50410A0E134\r
+S214028BB0015085E2E00D00EB070055E1046086E017\r
+S214028BC0BC201BB5F5FFFFBA0610E0E1FF1001E27C\r
+S214028BD0B4009FE5D80D00EBC4201BE5078088E0B3\r
+S214028BE0020058E1D7FFFF3AD1FFFFEA8C309FE53B\r
+S214028BF00030D3E5020053E30E00000A070000CA65\r
+S214028C00010053E30100000AC4201BE5C8FFFFEA87\r
+S214028C10BC001BE5C4101BE52C0E00EBF9FFFFEAB7\r
+S214028C20040053E3F7FFFF1ABC001BE5C4101BE564\r
+S214028C30530E00EBF3FFFFEABC001BE5C4101BE576\r
+S214028C40810E00EBEFFFFFEA2C909FE5A0FFFFEA04\r
+S214028C5038009FE5B80D00EBF0AF1BE9441C03009B\r
+S214028C60541C0300901F0300B41F0300C81F030018\r
+S214028C70DC1F0300681B0300545903005859030005\r
+S214028C80B8310300001F03000C1F0300141F03006B\r
+S214028C901C1F030004E02DE504E09DE42BFFFFEA21\r
+S214028CA00DC0A0E110D82DE90030A0E10140A0E1FE\r
+S214028CB0A0109FE5020053E304B04CE298009FE543\r
+S214028CC00120A0E10100000A10681BE99A0D00EAE3\r
+S214028CD088109FE5040094E5F01000EB000050E3D6\r
+S214028CE07C109FE50900001A00200FE100400FE10A\r
+S214028CF0C04084E304F029E100300FE1C04002E204\r
+S214028D00C030C3E3043083E103F029E110A81BE975\r
+S214028D10040094E5E11000EB000050E344009FE5F8\r
+S214028D200900001A00200FE100400FE1C04084E372\r
+S214028D3004F029E100300FE1C04002E2C030C3E394\r
+S214028D40043083E103F029E110A81BE9041094E53E\r
+S214028D5010681BE9780D00EA1C200300202003009F\r
+S214028D60C8210300482003004C20030004E02DE540\r
+S214028D702C309FE52CE09FE5002093E528C09FE578\r
+S214028D800C3092E50C109EE50C308CE50C1082E55A\r
+S214028D90103092E510009EE510308CE5100082E55A\r
+S214028DA004F09DE4BC310300206002005C5903001D\r
+S214028DB018009FE518309FE50C1090E5002093E51B\r
+S214028DC00C1082E5103090E5103082E50EF0A0E13E\r
+S214028DD05C590300BC3103000DC0A0E130D82DE978\r
+S214028DE06C209FE504B04CE2003092E564509FE5AB\r
+S214028DF0000053E30040A0E10400000A443090E57E\r
+S214028E00040053E3003092053C30800530A81B096D\r
+S214028E10003095E5013083E2010053E3003085E53A\r
+S214028E200900000A30309FE5004083E5FF0200EBB0\r
+S214028E30003095E5013043E2000053E3003085E55B\r
+S214028E4030A81B19D9FFFFEB30A81BE9C6FFFFEBC2\r
+S214028E50F3FFFFEAF43103007C590300E0810300CC\r
+S214028E6004E02DE504E09DE4DAFFFFEA0DC0A0E190\r
+S214028E7030D82DE924309FE524409FE504B04CE22B\r
+S214028E80030054E130A81B390350A0E10FE0A0E133\r
+S214028E9004F014E4050054E130A81B39FAFFFFEA97\r
+S214028EA018340300183403000000A0E30EF0A0E11B\r
+S214028EB0FEDEFFE70EF0A0E10DC0A0E100D82DE92E\r
+S214028EC004B04CE2430000EB00681BE94B0900EAE1\r
+S214028ED02C309FE52CC09FE52C209FE50311A0E3D4\r
+S214028EE0001083E50030A0E3000082E500308CE548\r
+S214028EF018209FE518309FE5002083E500008CE5EA\r
+S214028F000EF0A0E1088006803080068080590300BB\r
+S214028F10CC400000208006801C309FE51C209FE588\r
+S214028F200209A0E3000083E5001082E54231A0E3D7\r
+S214028F300110A0E3001083E50EF0A0E12880068071\r
+S214028F408059030014309FE514209FE5B210D3E148\r
+S214028F50003092E5033061E0003080E50EF0A0E1DB\r
+S214028F6030800680805903000DC0A0E170D82DE93C\r
+S214028F7004B04CE20050A0E108D04DE21C004BE2E7\r
+S214028F80855085E0EEFFFFEB000055E30040A0E3CE\r
+S214028F9070A81B9920604BE20600A0E1E8FFFFEBF9\r
+S214028FA020001BE51C101BE5010050E120209F3528\r
+S214028FB000306120003092351C000BE50330613032\r
+S214028FC000308330034084E0040055E170A81B990A\r
+S214028FD0F0FFFFEA805903000DC0A0E110D82DE98A\r
+S214028FE004B04CE20040A0E30400A0E1014084E2A9\r
+S214028FF0130000EB3F0054E3FAFFFFDA04009FE59C\r
+S21402900010681BE9B1FFFFEAC05D00002C209FE557\r
+S21402901002C1A0E3001092E54000A0E3000051E385\r
+S21402902000309C050030A013C32FA001223F83000E\r
+S2140290304301A0010030821500108C050EF0A0E15D\r
+S214029040C0310300C01FA0E1211F80E04111A0E152\r
+S214029050010140E08001A0E10430A0E308209FE582\r
+S2140290601330A0E1013282E70EF0A0E16800008032\r
+S214029070C01FA0E1211F80E04111A0E1010140E0F4\r
+S2140290808001A0E10430A0E308209FE51330A0E1B0\r
+S214029090013282E70EF0A0E1640000800EF0A0E14B\r
+S2140290A00EF0A0E108309FE50F0000E20000D3E7D3\r
+S2140290B00EF0A0E16420030004E02DE518209FE5F1\r
+S2140290C0000092E5000050E30030E0C3003082C5A5\r
+S2140290D004F09DC404E09DE4930500EADC3103003D\r
+S2140290E0FF0000E2613040E2302040E2050053E338\r
+S2140290F0FF1002E2573040E20600009A090051E3F0\r
+S21402910041C040E20230A0E10200009A05005CE3A2\r
+S214029110373040E20030E0830300A0E10EF0A0E129\r
+S2140291200DC0A0E130D82DE90030A0E304B04CE237\r
+S21402913014D04DE20350A0E128404BE220000BE59C\r
+S21402914018304BE517304BE5DAFFFFEB0410A0E1D1\r
+S214029150FF0000E2090000EB0030A0E1010053E34B\r
+S2140291602D00A0E330A81B09020073E3F5FFFF1AE7\r
+S214029170610500EB18504BE517504BE5F1FFFFEA8F\r
+S2140291800DC0A0E170D82DE91040D1E504B04CE244\r
+S214029190000054E30150A0E10B00001A240050E343\r
+S2140291A00200000A0420A0E10200A0E170A81BE968\r
+S2140291B00030E0E30120A0E3043081E51020C1E5A1\r
+S2140291C00C4081E5004081E5F5FFFFEA010054E32B\r
+S2140291D03800000A020054E32E00000A030054E39B\r
+S2140291E00030A0131030C1150020E013EDFFFF1A67\r
+S2140291F0FF0000E2B9FFFFEB043095E51160D5E50C\r
+S214029200002083E1000056E3042085E50120E013F8\r
+S214029210E4FFFF1A0030D5E5020053E10400000A1D\r
+S2140292202D00A0E3340500EB0020E0E31060C5E566\r
+S214029230DCFFFFEA2B00A0E32F0500EB082095E5F4\r
+S2140292400230D2E53A0053E30100000A0120A0E30F\r
+S214029250D4FFFFEA0000D2E50C6095E5260500EB98\r
+S214029260083095E50100D3E5230500EB060054E13E\r
+S2140292700400A0E1F4FFFF8A083095E50020D3E75A\r
+S214029280003083E0010080E2060050E1032043E55F\r
+S214029290F8FFFF9AECFFFFEAFF0000E28FFFFFEB0A\r
+S2140292A00330A0E30002A0E10020A0E31030C5E5F1\r
+S2140292B0040085E5BBFFFFEA0CC091E5020B5CE308\r
+S2140292C00030A0031140C1051030C1050800000A95\r
+S2140292D0230050E30800000A003091E5081091E5EB\r
+S2140292E0003083E001208CE2003085E50C00C1E707\r
+S2140292F00C2085E50020A0E3AAFFFFEA083091E5EE\r
+S2140293000020A0E30210A0E30C20C3E71010C5E57E\r
+S214029310F7FFFFEA0DC0A0E1F0D92DE974809FE5C2\r
+S21402932004B04CE20070A0E10060A0E32400A0E3D9\r
+S214029330F10400EB0640D7E70650A0E1060054E130\r
+S2140293400B00001A2300A0E3EB0400EB2602D8E78A\r
+S214029350E90400EB0F3006E20300D8E7E60400EB70\r
+S21402936054FFFFEB7F0000E22B0050E3F0A91B093D\r
+S214029370ECFFFFEA0400A0E1015085E2DE0400EB08\r
+S214029380043086E00540D7E7FF6003E2000054E3BE\r
+S214029390F7FFFF1AEAFFFFEA642003000DC0A0E110\r
+S2140293A0F0D92DE948119FE504B04CE204D04DE215\r
+S2140293B00020A0E3003091E5000053E334319FE53E\r
+S2140293C0002083E5F0A91BD90180A0E128319FE5A2\r
+S2140293D0002093E5000052E320319F050140A003E0\r
+S2140293E0002093050010D20524104B051700000A32\r
+S2140293F0003091E5030053E30400009AFC309FE539\r
+S214029400002093E5030012E30440A0030900000ACB\r
+S214029410DC309FE5002093E5010052E30400009A49\r
+S214029420D8309FE5002093E5010012E30240A00336\r
+S2140294300000000A0140A0E3C0309FE524704BE222\r
+S214029440001093E50700A0E10420A0E1130600EB5C\r
+S214029450A0209FE5001092E5000051E3F0A91B1939\r
+S214029460040051E101E0A0E1160000AA90009FE589\r
+S21402947090609FE50250A0E124704BE20730DEE7E1\r
+S214029480001090E50FC003E22332A0E10320D6E7E6\r
+S21402949001E08EE20120C1E4003095E5001080E58F\r
+S2140294A0000053E3F0A91B190C30D6E70130C1E4E3\r
+S2140294B0002095E5001080E5000052E3F0A91B1994\r
+S2140294C004005EE1ECFFFFBA30109FE5002098E54D\r
+S2140294D0003091E5022064E0043083E0000052E3AD\r
+S2140294E0003081E5002088E50810A0E1F0A91BD92C\r
+S2140294F0B5FFFFEA84590300E031030090590300E8\r
+S214029500885903008C590300642003000DC0A0E1B3\r
+S21402951030D82DE904B04CE260C09FE50050A0E3CD\r
+S21402952000108CE558109FE5050053E1000081E528\r
+S21402953050009FE550409FE5002080E54C209FE5C7\r
+S214029540003082E50B00000A005084E592FFFFEB34\r
+S214029550003094E50500A0E1050053E130A81B1990\r
+S21402956018109FE50030A0E3002091E50030C2E528\r
+S214029570000091E530A81BE987FFFFEBF7FFFFEA43\r
+S2140295808C5903008859030084590300E031030014\r
+S2140295909059030054309FE50DC0A0E170D82DE924\r
+S2140295A0000083E548009FE548309FE548509FE568\r
+S2140295B048609FE50040A0E3002080E50120A0E38C\r
+S2140295C0002083E5004085E504B04CE2001086E505\r
+S2140295D071FFFFEB005095E50400A0E1040055E1A1\r
+S2140295E0003096050050C3050000960570A81BE9DA\r
+S2140295F0885903008459030090590300E0310300A0\r
+S2140296008C5903000DC0A0E1F0DD2DE984019FE531\r
+S21402961004B04CE204D04DE20060A0E3002090E5E6\r
+S21402962074319FE5060052E1006083E5F0AD1BD978\r
+S21402963068319FE5002093E50010D2E5060051E16F\r
+S214029640F0AD1B0900A0A0E154319FE5002093E590\r
+S214029650000052E31000000A003090E5030053E3D6\r
+S2140296600400009A3C319FE5002093E5030012E3D4\r
+S2140296700470A0030900000A18319FE5002093E554\r
+S214029680010052E30400009A18319FE5002093E59A\r
+S214029690010012E30270A0030000000A0170A0E3BA\r
+S2140296A00050A0E3070055E11A0000AAEC409FE52F\r
+S2140296B0E4809FE5003094E50100D3E4003084E5C1\r
+S2140296C0FF0000E285FEFFEB003098E50002A0E115\r
+S2140296D0000053E3FF6000E2F0AD1B19003094E592\r
+S2140296E00100D3E4003084E5FF0000E27BFEFFEBDE\r
+S2140296F0003098E5000086E1000053E3FF6000E2D8\r
+S214029700F0AD1B1928304BE20360C5E7015085E235\r
+S214029710070055E1E6FFFFBA84309FE5002093E597\r
+S214029720000052E31500001A78409FE5003094E5E9\r
+S2140297300060C3E560309FE5002093E5000052E339\r
+S214029740F0AD1B1900209AE5003094E5022067E090\r
+S214029750073083E0000052E3003084E500208AE50B\r
+S2140297600A00A0E1F0AD1BD930309FE5002093E55A\r
+S2140297700010D2E5000051E3F0AD1B09B1FFFFEA8D\r
+S21402978020409FE528004BE2001094E50720A0E168\r
+S214029790570500EBE6FFFFEA84590300E0310300B9\r
+S2140297A088590300905903008C5903000DC0A0E1AC\r
+S2140297B030D82DE904B04CE254C09FE50050A0E337\r
+S2140297C000008CE54C009FE5050053E1001080E5A3\r
+S2140297D044109FE544409FE5002081E540209FE538\r
+S2140297E0003082E50800000A005084E584FFFFEBA3\r
+S2140297F0003094E50500A0E1050053E130A81B19EE\r
+S21402980010309FE5000093E530A81BE97CFFFFEBD4\r
+S214029810FAFFFFEA885903008C59030084590300B3\r
+S214029820E0310300905903004C309FE50DC0A0E1E3\r
+S21402983070D82DE9000083E540009FE540309FE5A3\r
+S214029840002080E53C609FE53C509FE50120A0E3B8\r
+S2140298500040A0E3002083E504B04CE2001086E559\r
+S214029860004085E566FFFFEB003095E50400A0E1C9\r
+S214029870040053E10000960570A81BE9885903000E\r
+S21402988084590300905903008C590300E031030009\r
+S2140298900DC0A0E100D82DE904B04CE2520400EB62\r
+S2140298A008309FE50120A0E3002083E500A81BE91D\r
+S2140298B0C43103000DC0A0E170D82DE90060A0E31A\r
+S2140298C0002090E5006081E50030D2E504B04CE26D\r
+S2140298D0060053E10050A0E10140A0E10100001A99\r
+S2140298E00600A0E170A81BE90000D2E5FBFDFFEB35\r
+S2140298F0000050E3F9FFFFBA001095E5003094E54A\r
+S214029900012081E2033280E1003084E5002085E513\r
+S2140299100130D1E5016086E2000053E3F1FFFF1A51\r
+S214029920EEFFFFEA0DC0A0E170D82DE90060A0E3CB\r
+S214029930002090E5006081E50030D2E504B04CE2FC\r
+S214029940060053E10050A0E10140A0E10100001A28\r
+S2140299500600A0E170A81BE90000D2E5DFFDFFEBE0\r
+S214029960000050E3F9FFFFBA001095E5003094E5D9\r
+S214029970012081E2033280E1003084E5002085E5A3\r
+S2140299800130D1E5016086E2000053E3F1FFFF1AE1\r
+S214029990EEFFFFEA000051E33030A00370402DE9ED\r
+S2140299A00130C0040140A0E10050A0E30220A00361\r
+S2140299B00030C0051800000A073082E2C32FA0E17B\r
+S2140299C0A23E83E0C3C1B0E11200000A8C31A0E1DE\r
+S2140299D04C609FE508E043E2342EB0E10030A0037D\r
+S2140299E00130A01301005CE301308303000053E35F\r
+S2140299F0FF2002E22232D6170F1002E20120D6170B\r
+S214029A000130C014025085120120C01401C05CE26D\r
+S214029A1008E04EE2EFFFFF1A0520A0E10200A0E1F7\r
+S214029A207080BDE8642003000EF0A0E10EF0A0E115\r
+S214029A300DC0A0E130D82DE9FC209FE50050A0E340\r
+S214029A40003092E504B04CE2050053E13600001AFD\r
+S214029A506F1500EB000050E32900001ADC209FE59A\r
+S214029A60003092E5000053E30030A0130250A0132A\r
+S214029A7000308215000055E31D00000AED1700EBCA\r
+S214029A80000050E31800001AE91700EBE6FFFFEBB0\r
+S214029A90D31700EB0300A0E33E0400EB0300A0E3B1\r
+S214029AA03A0400EB000055E30600000A90409FE5EA\r
+S214029AB0003094E50500A0E10FE0A0E103F0A0E18C\r
+S214029AC0000050E3F9FFFF1AD81700EB74209FE559\r
+S214029AD0003092E5000053E330A81B09003092E5FF\r
+S214029AE00FE0A0E103F0A0E130A81BE9DC1700EBD1\r
+S214029AF0E4FFFFEA411500EB311500EB0050A0E150\r
+S214029B00DDFFFFEA531800EB000050E30050A0E12F\r
+S214029B10D1FFFFCAECFFFFAA2C309FE5002093E599\r
+S214029B200FE0A0E102F0A0E1E7FFFFEA003092E5D5\r
+S214029B300FE0A0E103F0A0E1C4FFFFEAD831030082\r
+S214029B40C0820300C8310300D4310300CC310300C5\r
+S214029B500DC0A0E1F0DD2DE904B04CE22CD04DE2C0\r
+S214029B600020A0E10030D0E50170A0E1700053E3D0\r
+S214029B700000A0E31AA0A0E34A00000A0A0050E18F\r
+S214029B800050A0E1F0AD1BA9106045E2070056E3C5\r
+S214029B900180A0E33D00009A40319FE5003093E546\r
+S214029BA0000053E33400000A50404BE20500A0E1F7\r
+S214029BB00410A0E10FE0A0E103F0A0E10080A0E124\r
+S214029BC0070056E30400A0E10F00008A0010A0E39D\r
+S214029BD024204BE20730A0E3013053E21C1042E59A\r
+S214029BE0012082E2FBFFFF5A44004BE20410A0E190\r
+S214029BF000C0A0E10320A0E30130D1E4012042E24C\r
+S214029C00010072E30130CCE4FAFFFF1A000058E3C9\r
+S214029C101100001A070056E31730A0930730A083FE\r
+S214029C20010073E30720A0E17810A0E30300000A16\r
+S214029C30013043E2010073E30110C2E4FBFFFF1AA6\r
+S214029C40070056E30870878218708792015085E2F3\r
+S214029C500A0055E1F0AD1BA9CAFFFFEA070056E36A\r
+S214029C600710A0E10C20A0930420A0830030A0E3FC\r
+S214029C7025FEFFEB0070A0E1F3FFFFEA0500A0E17E\r
+S214029C80111500EB50404BE250000BE5CBFFFFEA0C\r
+S214029C9044404BE20500A0E10410A0E1291500EBC8\r
+S214029CA00400A0E1D8FFFFEA013082E248004BE25E\r
+S214029CB04C104BE248300BE5FDFEFFEB000050E394\r
+S214029CC04C001B1501A08012ABFFFF1A0700A0E193\r
+S214029CD00C109FE50820A0E36D0A00EBF0AD1BE92F\r
+S214029CE000790300782003000DC0A0E1F0DD2DE925\r
+S214029CF004B04CE22CD04DE201A0A0E10030D0E549\r
+S214029D00010080E2500053E348000BE51A60A0E32E\r
+S214029D100000A0E32B00000A060050E10040A0E18C\r
+S214029D20180000AA0070A0E344804BE2105044E200\r
+S214029D30070055E30810A0E10730A0E150700BE5DC\r
+S214029D401500008A070055E30C20A0930420A08388\r
+S214029D5048001BE594FEFFEB0400A0E10810A0E11A\r
+S214029D600F1500EB070055E348301B8548301B955E\r
+S214029D70014084E20830838218308392060054E160\r
+S214029D8048300BE5E8FFFFBA78109FE50A00A0E12D\r
+S214029D900320A0E33E0A00EBF0AD1BE9070055E303\r
+S214029DA050104BE20C20A0930420A08348001BE531\r
+S214029DB00030A0E37CFEFFEB0400A0E150101BE5A0\r
+S214029DC0D11400EBE6FFFFEA48004BE24C104BE2F0\r
+S214029DD0B7FEFFEB000050E30600000A48301BE522\r
+S214029DE00120D3E43D0052E34C001B0548300BE54E\r
+S214029DF001608002C7FFFF0A0C109FE50A00A0E17F\r
+S214029E000420A0E3E2FFFFEA802003008420030090\r
+S214029E100DC0A0E170D82DE964359FE50050A0E39F\r
+S214029E2004B04CE2B4D04DE20040A0E10050C3E5DD\r
+S214029E300020D0E53F3042E2340053E303F19F971F\r
+S214029E40F20000EA189F020010A20200649F0200BD\r
+S214029E50789F020048A20200E49F020010A20200BD\r
+S214029E6010A2020050A10200549F020010A202009B\r
+S214029E7010A2020010A2020010A2020008A0020015\r
+S214029E8010A2020010A2020050A102005CA1020071\r
+S214029E9010A2020048A20200549F020010A2020072\r
+S214029EA010A2020010A2020068A1020010A2020084\r
+S214029EB010A2020010A2020010A2020010A20200CB\r
+S214029EC010A2020010A2020010A2020010A20200BB\r
+S214029ED070A1020048A2020010A2020010A2020014\r
+S214029EE010A2020020A2020010A2020010A202008B\r
+S214029EF010A20200EC9F020010A20200A8A102001B\r
+S214029F0010A2020010A2020020A202002CA202004E\r
+S214029F1038A2020048A20200381400EB281400EB14\r
+S214029F2060249FE54032A0E10F3003E20F0000E21A\r
+S214029F304C149FE500C0D2E70300D2E70030A0E34E\r
+S214029F405320A0E30330C1E50020C1E50100C1E5CE\r
+S214029F5002C0C1E528049FE5EDFCFFEB0000A0E38C\r
+S214029F6070A81BE918049FE51C149FE50420A0E3D3\r
+S214029F70C70900EBF6FFFFEA013080E2C4104BE2AD\r
+S214029F80C0004BE2C0300BE549FEFFEB000050E399\r
+S214029F90F3FFFF0AC0201BE50130D2E42C0053E396\r
+S214029FA0C0200BE5EEFFFF1A0130D2E4430053E374\r
+S214029FB0C0200BE50600000A0010A0E3C4001BE563\r
+S214029FC0630300EBB8039FE5C0139FE50320A0E3FD\r
+S214029FD0E6FFFFEA0010A0E3C4001BE55E0300EB09\r
+S214029FE0F7FFFFEA98039FE5C9FCFFEBDA0100EBF7\r
+S214029FF09C339FE5002093E50FE0A0E102F0A0E18C\r
+S21402A0000000E0E370A81BE9A8604BE2013084E29E\r
+S21402A010AC104BE20600A0E1A8300BE540FEFFEBD9\r
+S21402A020000050E30400000AA8301BE50120D3E438\r
+S21402A0302C0052E3A8300BE50200000A40039FE51D\r
+S21402A04050139FE5C8FFFFEA0600A0E1B0104BE2FE\r
+S21402A05017FEFFEB000050E3F7FFFF0AA8001BE520\r
+S21402A0600130D0E43A0053E3A8000BE5F2FFFF1AF2\r
+S21402A070B0301BE5020B53E30320A0E1B8FFFF2A32\r
+S21402A080000055E32B00000A000053E32400000AF8\r
+S21402A09098504BE20040A0E3020054E11000002A70\r
+S21402A0A018104BE2A8201BE5014084E20130D2E4FE\r
+S21402A0B0803041E57D0053E3A8200BE50130D20451\r
+S21402A0C02030830380304105A8200B057F0054E32F\r
+S21402A0D0011081E20200008AB0301BE5030054E161\r
+S21402A0E0EFFFFF3A0500A0E1AC101BE50420A0E15B\r
+S21402A0F0FF0200EB040050E10800001AB0201BE546\r
+S21402A100AC301BE5022064E0043083E0000052E33A\r
+S21402A110AC300BE5B0200BE5DDFFFF1AA8FFFFEA27\r
+S21402A120B0201BE5000052E3A5FFFF0A50029FE5A0\r
+S21402A13064129FE58CFFFFEAAC101BE50320A0E14A\r
+S21402A140B8FDFFEB000050E39DFFFF1AF6FFFFEAA3\r
+S21402A1502C129FE5E3FEFFEB7DFFFFEA010080E2A3\r
+S21402A1605A0100EB7AFFFFEA0150A0E3A5FFFFEADF\r
+S21402A170013080E2CC104BE2C8004BE2C8300BE55F\r
+S21402A180CBFDFFEB000050E3F4019F050C129F0588\r
+S21402A19075FFFF0AF4019FE55DFCFFEBCC001BE5B3\r
+S21402A1A0790100EB6AFFFFEA9C504BE2013080E245\r
+S21402A1B0A0104BE20500A0E19C300BE5D8FDFFEBBA\r
+S21402A1C0000050E366FFFF0A9C301BE50120D3E443\r
+S21402A1D02C0052E39C300BE561FFFF1A0500A0E15C\r
+S21402A1E0A4104BE2B2FDFFEB000050E35CFFFF0A57\r
+S21402A1F08C419FE5A0001BE5A4201BE50410A0E10E\r
+S21402A200E3FCFFEB000050E351FFFF1AC6FFFFEA34\r
+S21402A2106C119FE54B2FA0E3CB0200EB4CFFFFEA4D\r
+S21402A2205C119FE549FEFFEB49FFFFEA010080E271\r
+S21402A230D90000EB46FFFFEA64219FE550319FE517\r
+S21402A240002083E542FFFFEA013080E20050A0E3EF\r
+S21402A250530052E343005213B4300BE5B8500BE5FB\r
+S21402A2603D00000AB4504BE20500A0E1BC104BE2F0\r
+S21402A270ABFDFFEB000050E33400001A0300A0E33E\r
+S21402A280440200EB0300A0E3400200EBB8501BE5DB\r
+S21402A290000055E30500000A08219FE5003092E51C\r
+S21402A2A0000053E32000001A000055E31900001ACC\r
+S21402A2B0621600EB000050E36330A0130030C415B2\r
+S21402A2C0E4309F150120A013002083150030D4E54A\r
+S21402A2D0530053E3730053130700000A0100A0E380\r
+S21402A2E0D0FDFFEB0300A0E32A0200EB0300A0E38D\r
+S21402A2F0260200EB180100EB40FFFFEA0500A0E192\r
+S21402A300C8FDFFEBA4209FE5A4309FE5002083E56F\r
+S21402A310831500EBF2FFFFEA0950A0E30500A0E177\r
+S21402A320B8500BE54F0000EB0BFFFFEA0500A0E17B\r
+S21402A330003092E50FE0A0E103F0A0E1000050E358\r
+S21402A340B8501B150050A001B8000B05D5FFFFEA58\r
+S21402A350BC001BE5491300EBC7FFFFEAB4504BE213\r
+S21402A360B8104BE20500A0E151FDFFEBB4201BE55F\r
+S21402A3700030D2E53B0053E301308202B4300B05D5\r
+S21402A380B8FFFFEA00710300642003008820030080\r
+S21402A39080200300CC3103008C20030090200300B1\r
+S21402A3A09420030068AA0200D03103001C32030086\r
+S21402A3B020810300E83103000DC0A0E110D82DE98A\r
+S21402A3C014409FE504B04CE20410A0E1B00100EB9B\r
+S21402A3D00400A0E110681BE9CDFBFFEA0071030050\r
+S21402A3E00DC0A0E110D82DE93C309FE504B04CE248\r
+S21402A3F0002093E5000052E3090000BA2C409FE5D6\r
+S21402A4000400A0E145FBFFEB0400A0E17FFEFFEBAA\r
+S21402A410000050E3F9FFFF0A0000E0E1A00FA0E110\r
+S21402A42010A81BE9E3FFFFEBF3FFFFEADC310300B2\r
+S21402A430087903000EF0A0E10DC0A0E100D82DE9D6\r
+S21402A44004B04CE211FDFFEB7C0100EB2B00A0E315\r
+S21402A45000681BE9A80000EA04309FE5000083E5D7\r
+S21402A4600EF0A0E1DC31030010402DE938109FE524\r
+S21402A4704032A0E134209FE50F3003E20F0000E2F5\r
+S21402A4800040D1E703C0D1E75830A0E30030C2E570\r
+S21402A4900200A0E1583043E201C0C2E50240C2E534\r
+S21402A4A00330C2E51040BDE899FBFFEA64200300D2\r
+S21402A4B0007103000DC0A0E1F0D92DE9C8809FE528\r
+S21402A4C004B04CE204D04DE20140A0E100E098E581\r
+S21402A4D00260A0E100005EE30050A0E11000001A56\r
+S21402A4E00130A0E3A4C09FE5A4709FE5003088E594\r
+S21402A4F00E00A0E1003CA0E10810A0E3000053E338\r
+S21402A5008320A0E10C2022B0011051E20230A0E12B\r
+S21402A510F9FFFF1A002187E7010080E2FF0050E3FF\r
+S21402A520F3FFFF9A014044E268309FE50020A0E373\r
+S21402A530010074E3002083E51100000A50809FE5C5\r
+S21402A54021704BE20510A0E10120A0E30700A0E184\r
+S21402A550D20100EB3C309FE5014044E2002093E547\r
+S21402A560015085E2000052E30500001A21305BE547\r
+S21402A570010074E3263C23E0032198E7066422E008\r
+S21402A580EFFFFF1A0600A0E1F0A91BE9E431030081\r
+S21402A590B71DC10494590300E03103000DC0A0E1C9\r
+S21402A5A070D82DE918419FE50030A0E304B04CE2D4\r
+S21402A5B00CD04DE20020A0E10030C4E50030D0E52A\r
+S21402A5C01C000BE5430053E30D00000A0030D2E501\r
+S21402A5D04C0053E370A81B09060000CA430053E36D\r
+S21402A5E070A81B090200A0E1D4109FE54B2FA0E340\r
+S21402A5F0D10100EB70A81BE9500053E3F8FFFF1AE5\r
+S21402A60070A81BE90130D0E5520053E3EEFFFF1AB3\r
+S21402A6100250D0E5430055E3EBFFFF1A0330D0E5C6\r
+S21402A6203A0053E3E8FFFF1A043080E218604BE278\r
+S21402A630043026E520104BE20600A0E1B8FCFFEB52\r
+S21402A640000050E370A81B091C301BE50120D3E470\r
+S21402A6502C0052E31C300BE570A81B190600A0E183\r
+S21402A66024104BE292FCFFEB000050E370A81B099B\r
+S21402A67024101BE520001BE50020E0E38CFFFFEB27\r
+S21402A68040309FE50010A0E1006093E5000056E32D\r
+S21402A6900400000A0400A0E12C109FE50420A0E3B9\r
+S21402A6A0FB0700EB70A81BE9010084E22020A0E370\r
+S21402A6B0B7FCFFEB040080E00050C4E50160C0E593\r
+S21402A6C070A81BE900710300E03103008820030034\r
+S21402A6D00DC0A0E100D82DE904B04CE200C0D0E5E0\r
+S21402A6E04B2FA0E370005CE308109FE500A81B094F\r
+S21402A6F0930100EB00A81BE9007103000DC0A0E166\r
+S21402A70000D82DE91C309FE5FF1000E2182093E5E3\r
+S21402A71004B04CE2000092E50C3092E50FE0A0E1B6\r
+S21402A72003F0A0E100A81BE9500000000DC0A0E164\r
+S21402A73000D82DE91C309FE504B04CE2182093E5C2\r
+S21402A740000092E5103092E50FE0A0E103F0A0E1F0\r
+S21402A750FF0000E200A81BE9500000000DC0A0E1C7\r
+S21402A76000D82DE91C309FE504B04CE2182093E592\r
+S21402A7700810A0E3000092E5143092E50FE0A0E195\r
+S21402A78003F0A0E100A81BE9500000000DC0A0E104\r
+S21402A79000D82DE920309FE50020A0E1181093E5AF\r
+S21402A7A004B04CE2000091E5143091E50010A0E3FD\r
+S21402A7B00FE0A0E103F0A0E100A81BE950000000B2\r
+S21402A7C00DC0A0E1000050E300D82DE904B04CE231\r
+S21402A7D068E09FE50E00000A00309EE50510A0E343\r
+S21402A7E0013043E2000053E300308EE500A81BC9A7\r
+S21402A7F04C309FE50020A0E318C093E500208EE5CC\r
+S21402A80000009CE514309CE50FE0A0E103F0A0E117\r
+S21402A81000A81BE900309EE50410A0E3013083E2A5\r
+S21402A820010053E300308EE500A81B1910309FE5A7\r
+S21402A830182093E5000092E5143092E5F1FFFFEA56\r
+S21402A840EC310300500000000DC0A0E100D82DE955\r
+S21402A85010309FE504B04CE2542093E50FE0A0E1EF\r
+S21402A86002F0A0E100A81BE95000000004E02DE57C\r
+S21402A87004009FE504E09DE4001200EA48A80200F6\r
+S21402A8800DC0A0E110D82DE90000A0E304B04CE210\r
+S21402A890CAFFFFEBBC309FE5BCE09FE5002093E5D6\r
+S21402A8A00000A0E3003192E700318EE7010080E26B\r
+S21402A8B00A0050E3FAFFFFDA98309FE59CC09FE556\r
+S21402A8C0001093E50040A0E32C2091E51700A0E3DA\r
+S21402A8D02C208EE5303091E530308EE5342091E53F\r
+S21402A8E034208EE5383091E538308EE53C2091E50F\r
+S21402A8F03C208EE5403091E5A4308EE5010050E222\r
+S21402A90004408CE4FCFFFF5A54C09FE548209FE5B4\r
+S21402A91000309CE50010A0E3000053E344309FE5BE\r
+S21402A920A0108EE5002083E50500001A0F00A0E3C4\r
+S21402A930E51100EB7A1400EB2C309FE5000083E56E\r
+S21402A94010A81BE900108CE50F00A0E3DE1100EB57\r
+S21402A950731400EBF4FFFFEAE0810300208103009A\r
+S21402A960608103001C320300E8310300C08203004A\r
+S21402A97004E02DE560309FE560C09FE5001093E59A\r
+S21402A9800020A0E302319CE7023181E7012082E247\r
+S21402A9900A0052E3FAFFFFDA3C309FE52C209CE5E2\r
+S21402A9A0001093E50100A0E32C2081E530309CE501\r
+S21402A9B0303081E534209CE5342081E538309CE552\r
+S21402A9C0383081E53C209CE53C2081E5A4309CE5BE\r
+S21402A9D0403081E504E09DE478FFFFEAE081030071\r
+S21402A9E0208103000000A0E30EF0A0E12C209FE5EA\r
+S21402A9F02C309FE52C109FE5002083E528309FE54C\r
+S21402AA0028209FE5001083E524309FE524109FE56B\r
+S21402AA10002083E520309FE5001083E50EF0A0E1DC\r
+S21402AA20E4A90200D03103006CA80200CC31030076\r
+S21402AA3080A80200D831030070A90200D4310300B6\r
+S21402AA4004E02DE518209FE5003092E5000053E370\r
+S21402AA5004F09D140130A0E3003082E504E09DE49A\r
+S21402AA60A81500EAF03103000DC0A0E100D82DE9D8\r
+S21402AA7018309FE504B04CE2403093E5000053E303\r
+S21402AA8000A81B090FE0A0E103F0A0E100A81BE963\r
+S21402AA90500000000DC0A0E1F0D92DE95430A0E32B\r
+S21402AAA004B04CE20040A0E30180A0E108D04DE2F1\r
+S21402AAB00060A0E14002A0E128400BE50130C8E4B6\r
+S21402AAC00150A0E176F9FFEB0100C5E50600A0E122\r
+S21402AAD073F9FFEB018088E20100C8E40400A0E1FC\r
+S21402AAE06FF9FFEB0100C8E40F00A0E36CF9FFEB7F\r
+S21402AAF03A70A0E30100C8E40170C8E40F00A0E3C6\r
+S21402AB00711100EB20504BE2040025E50810A0E18D\r
+S21402AB100420A0E30430A0E10500A0E17AFAFFEBEE\r
+S21402AB200420A0E10010A0E10430A0E128004BE2DE\r
+S21402AB3075FAFFEB3B60A0E30080A0E10160C8E489\r
+S21402AB400400A0E156F9FFEB0100C8E40D00A0E303\r
+S21402AB5053F9FFEB0100C8E40170C8E40D00A0E35E\r
+S21402AB60591100EB0810A0E100C0A0E10420A0E308\r
+S21402AB700500A0E10430A0E124C00BE562FAFFEB79\r
+S21402AB800080A0E10160C8E40040C8E5F0A91BE926\r
+S21402AB900000A0E30EF0A0E10000A0E30EF0A0E1AA\r
+S21402ABA010402DE9E4E09FE501C0A0E100309EE5FB\r
+S21402ABB0000053E33300000AD4309FE5D4409FE5FB\r
+S21402ABC0D4209FE50110A0E3001083E5002084E571\r
+S21402ABD000309EE5000053E31000000A0E10A0E1CC\r
+S21402ABE000309EE5030053E31200009A03001CE3C4\r
+S21402ABF01000001A030010E30E00001A042090E46E\r
+S21402AC0004208CE400309EE5043043E200308EE5FA\r
+S21402AC1078E09FE500309EE5000053E3EFFFFF1A61\r
+S21402AC206C309FE50020A0E3002083E50030A0E31F\r
+S21402AC30003084E51080BDE850209FE5003092E5A4\r
+S21402AC40010053E30900009A01001CE30700001A02\r
+S21402AC50010010E30500001A003092E5B2E0D0E0F1\r
+S21402AC60023043E2B2E0CCE0003082E5E7FFFFEAE2\r
+S21402AC700120D0E40120CCE4003091E5013043E22B\r
+S21402AC80003081E5E1FFFFEA08409FE5E6FFFFEAC4\r
+S21402AC90945D0300E0310300F43103002CAC0200A3\r
+S21402ACA00DC0A0E10130A0E1070171E330D82DE923\r
+S21402ACB00240A0E104B04CE2022081E02C509FE565\r
+S21402ACC00010A0E10300A0E10200008A1D0272E368\r
+S21402ACD00030A0E30300008A004085E5AFFFFFEBEB\r
+S21402ACE0003095E5043063E00300A0E130A81BE9DC\r
+S21402ACF0945D03000DC0A0E1070171E330D82DE991\r
+S21402AD00023081E004B04CE228509FE50240A0E108\r
+S21402AD100200008A1D0273E30030A0E30300008AEB\r
+S21402AD20004085E59DFFFFEB003095E5043063E0CB\r
+S21402AD300300A0E130A81BE9945D03000000A0E335\r
+S21402AD400EF0A0E10000A0E30EF0A0E10000A0E3F8\r
+S21402AD500EF0A0E10100A0E30EF0A0E10100A0E3E6\r
+S21402AD600EF0A0E104E02DE504E09DE47DF8FFEAA4\r
+S21402AD700732A0E303F0A0E10000A0E30EF0A0E19A\r
+S21402AD80020070E30DC0A0E1D8309F05D8209F05D1\r
+S21402AD9070D82DE904B04CE200C0A0E30040A0E168\r
+S21402ADA00160A0E30C10A0E118C083050000820534\r
+S21402ADB00500000A210000CA030070E30C40A0014F\r
+S21402ADC00000000A014084E20110A0E3000051E303\r
+S21402ADD01800000A8C509FE5183095E5000053E3F2\r
+S21402ADE00500000A000093E50410A0E3143093E582\r
+S21402ADF00FE0A0E103F0A0E100C0A0E16C309FE507\r
+S21402AE0000005CE3843283E0183085E558309FE525\r
+S21402AE100510A013004083E5183095E50410A00342\r
+S21402AE200000931500009305143093151430930513\r
+S21402AE300FE0A0E103F0A0E10600A0E170A81BE984\r
+S21402AE40010070E3DEFFFF1A1C309FE5000093E569\r
+S21402AE50000050E3016040C2DBFFFFCA0260E0036D\r
+S21402AE600060A011D8FFFFEA50000000F83103008E\r
+S21402AE70985D0300020070E37C309F057C209F05EE\r
+S21402AE800010A0E301C0A0E31410830500008205B1\r
+S21402AE900500000A0E0000CA030070E30100A001CC\r
+S21402AEA00000000A010080E20110A0E3000051E366\r
+S21402AEB00500000A48309FE53C209FE53C109FE5D0\r
+S21402AEC0803283E0143082E5000081E50C00A0E1C8\r
+S21402AED00EF0A0E1010070E3F1FFFF1A1C309FE5BF\r
+S21402AEE0003093E5000053E301C043C2EEFFFFCA01\r
+S21402AEF002C0E00303C0A011EBFFFFEA500000000F\r
+S21402AF00FC310300985D03000EF0A0E10EF0A0E114\r
+S21402AF100DC0A0E100D82DE91C309FE504B04CE23C\r
+S21402AF20182093E5000092E5103092E50FE0A0E1CC\r
+S21402AF3003F0A0E1FF0000E200A81BE950000000B9\r
+S21402AF400DC0A0E1F0DF2DE9AC319FE504B04CE284\r
+S21402AF5004D04DE2A4219FE5001093E5186092E527\r
+S21402AF60000051E3F0AF1B0900900FE100400FE133\r
+S21402AF70C04084E304F029E184019FE5C71200EB98\r
+S21402AF80000096E52410A0E30C3096E50FE0A0E161\r
+S21402AF9003F0A0E1000096E54F10A0E30C3096E522\r
+S21402AFA00FE0A0E103F0A0E14C319FE50070A0E3C2\r
+S21402AFB0002093E54F80A0E3020057E1190000AAA3\r
+S21402AFC040A19FE540319FE5000096E50720D3E7C4\r
+S21402AFD0017087E22232A0E10340DAE70F2002E2A4\r
+S21402AFE00250DAE70410A0E10C3096E50FE0A0E18B\r
+S21402AFF003F0A0E1000096E50510A0E10C3096E50E\r
+S21402B0000FE0A0E103F0A0E1EC309FE5044088E009\r
+S21402B010002093E5FF8004E2055088E0020057E135\r
+S21402B020FF8005E2E6FFFFBA000096E52310A0E3E4\r
+S21402B0300C3096E50FE0A0E103F0A0E1C4309FE5F6\r
+S21402B040000096E52812D3E70C3096E50FE0A0E163\r
+S21402B05003F0A0E1AC309FE50F2008E20210D3E730\r
+S21402B060000096E50C3096E50FE0A0E103F0A0E1C3\r
+S21402B070000096E5103096E50FE0A0E103F0A0E1AF\r
+S21402B080FF0000E22B0050E329004BE50B00000A0C\r
+S21402B09029004BE20110A0E31C0100EB000050E384\r
+S21402B0A058309F150120A013442083150300001A70\r
+S21402B0B029305BE52D0053E3B0FFFF0AEBFFFFEA02\r
+S21402B0C034309FE50020A0E3002083E530009FE5B2\r
+S21402B0D0931200EB00300FE1C04009E2C030C3E338\r
+S21402B0E0043083E103F029E10190A0E3000059E374\r
+S21402B0F0019049E2F0AF1B09FBFFFFEA00320300B2\r
+S21402B10050000000ECB0020098200300D85D030057\r
+S21402B110FF1001E20D0051E304E02DE52CC09FE58F\r
+S21402B12004F09D0400209CE524309FE50A0051E3CC\r
+S21402B1300310C2E7012082E200208CE50100000A2B\r
+S21402B140640052E304F09D1404E09DE47BFFFFEAF2\r
+S21402B15000320300D85D03000DC0A0E1000052E3F8\r
+S21402B16070D82DE904B04CE20060A0E10150A0E1E5\r
+S21402B170014042E270A81B090110D5E40600A0E1D6\r
+S21402B180FF1001E2E1FFFFEB000054E3014044E25E\r
+S21402B19070A81B09F7FFFFEA0DC0A0E1000052E30A\r
+S21402B1A070D82DE904B04CE20060A0E10150A0E1A5\r
+S21402B1B0014042E270A81B090600A0E153FFFFEB24\r
+S21402B1C0000054E30100C5E4014044E270A81B09F4\r
+S21402B1D0F8FFFFEA0DC0A0E10E002DE900D82DE928\r
+S21402B1E010B04CE204309BE5080053E30100000A6D\r
+S21402B1F00000A0E300A81BE950FFFFEBFBFFFFEAFD\r
+S21402B2000DC0A0E130D82DE964409FE504B04CE2C1\r
+S21402B210343094E50000E0E30FE0A0E103F0A0E1A3\r
+S21402B220343094E50050A0E10200E0E30FE0A0E134\r
+S21402B23003F0A0E1141094E538309FE538209FE52E\r
+S21402B240043081E534309FE5082081E50C3081E545\r
+S21402B2502C209FE52C309FE5102081E5143081E5F7\r
+S21402B260342094E50500A0E10FE0A0E102F0A0E1A1\r
+S21402B27030A81BE95000000058B1020098B1020045\r
+S21402B28010B1020010AF0200D4B102000DC0A0E15E\r
+S21402B29000D82DE930209FE504B04CE20030D2E51C\r
+S21402B2A00200E0E3000053E300A81B190130A0E30C\r
+S21402B2B00030C2E514209FE5343092E50FE0A0E1AD\r
+S21402B2C003F0A0E100681BE9CCFFFFEA04320300AA\r
+S21402B2D0500000000DC0A0E100D82DE94C209FE5EB\r
+S21402B2E0FF0000E2143092E50010A0E1000053E3F4\r
+S21402B2F0183092050010A00104B04CE2000093E55D\r
+S21402B3000C3093E50FE0A0E103F0A0E11C209FE5DE\r
+S21402B3100010A0E3443092E50100A0E1010053E1F1\r
+S21402B32000A81B09441082E500681BE9820000EAB7\r
+S21402B330500000000DC0A0E100D82DE944009FE5B2\r
+S21402B34004B04CE2182090E5003090E50338A0E106\r
+S21402B3502338A0E10C3043E2330053E300A81B89F4\r
+S21402B3604130A0E3000052E30510A0E3003080E580\r
+S21402B37000A81B09000092E5143092E50FE0A0E158\r
+S21402B38003F0A0E100A81BE9500000000DC0A0E1F8\r
+S21402B39010D82DE95C309FE504B04CE204D04DE2B3\r
+S21402B3A00040A0E318C093E50020A0E104005CE1A1\r
+S21402B3B00130A0E114400BE514104BE20700000A2E\r
+S21402B3C000009CE518C09CE50FE0A0E10CF0A0E1AF\r
+S21402B3D014301BE50040A0E1000053E30100001A10\r
+S21402B3E00400A0E110A81BE90C309FE5000093E5DD\r
+S21402B3F0510000EBF9FFFFEA50000000E082030074\r
+S21402B4000DC0A0E1D8109FE5D8209FE530D82DE9E1\r
+S21402B4100030A0E304B04CE2032181E7013083E26E\r
+S21402B4203F0053E3FBFFFFDAB4109FE5B8309FE519\r
+S21402B430B8209FE5003081E5B4309FE5402081E5E5\r
+S21402B440483081E5AC209FE5AC309FE50000A0E3E4\r
+S21402B450A8409FE58CE09FE5202081E500C0A0E1A2\r
+S21402B4601C3081E54C0081E5380081E50020A0E330\r
+S21402B4708C11A0E1023081E0012082E2070052E353\r
+S21402B48003E184E7FAFFFFDA01C08CE201005CE325\r
+S21402B490F5FFFFDA68309FE568209FE540409FE5AC\r
+S21402B4A00150E0E3303084E50500A0E1342084E575\r
+S21402B4B032FEFFEB0500A0E16DFEFFEB111300EB81\r
+S21402B4C00000A0E32DFEFFEB0000A0E368FEFFEB0A\r
+S21402B4D034209FE50030A0E3443084E58C2084E5E8\r
+S21402B4E030A81BE95000000078AD020016000800E4\r
+S21402B4F070AD020064AD020008AF02000CAF02009D\r
+S21402B500985D030080AD020074AE0200A4FB020048\r
+S21402B510000051E30600000A011041E20130D0E7C4\r
+S21402B520030053E30100A0030EF0A001000051E364\r
+S21402B530F8FFFF1A0000A0E30EF0A0E10DC0A0E1A4\r
+S21402B54000D82DE940309FE50120A0E3002083E5E6\r
+S21402B55038309FE5000050E304B04CE230009F050F\r
+S21402B5603C0090158C2093E50FE0A0E102F0A0E1EC\r
+S21402B57014309FE5002093E5000052E3012042E2EA\r
+S21402B580002083E500A81BD9F8FFFFEA008303002A\r
+S21402B5905000000070B502000DC0A0E130D82DE9C1\r
+S21402B5A080209FE504B04CE2003092E50040A0E126\r
+S21402B5B00338A0E12338A0E1410053E30150A0E1A3\r
+S21402B5C000C0E0E30D00000A0C0054E10510A0E103\r
+S21402B5D00400A0E10500000A0400A0E10510A0E1B5\r
+S21402B5E030F6FFEB0030A0E10300A0E130A81BE933\r
+S21402B5F065FFFFEB003050E2FAFFFF1AF5FFFFEAA5\r
+S21402B600183092E50610A0E3000053E3EDFFFF0AB0\r
+S21402B610000093E5143093E50FE0A0E103F0A0E10B\r
+S21402B62000C0A0E1E7FFFFEA500000000DC0A0E165\r
+S21402B63010D82DE9FF4000E20A0054E304B04CE2C1\r
+S21402B6400D00A0E30200000A0400A0E110681BE956\r
+S21402B6501FFFFFEA1EFFFFEBFAFFFFEA04E02DE5FD\r
+S21402B660FF0000E204E09DE4EFFFFFEA04309FE5FE\r
+S21402B670000083E50EF0A0E1083203000DC0A0E151\r
+S21402B68010D82DE90040A0E10000D0E504B04CE25D\r
+S21402B690000050E310A81B09FF0000E2E2FFFFEBE8\r
+S21402B6A00100F4E5000050E310A81B09F9FFFFEAC9\r
+S21402B6B00DC0A0E100D82DE904B04CE200C0A0E322\r
+S21402B6C004D04DE20C30A0E11010A0E32B20A0E342\r
+S21402B6D000C08DE54B0000EB00A81BE90DC0A0E101\r
+S21402B6E0F0DF2DE904B04CE224D04DE20160A0E187\r
+S21402B6F00050A0E104C09BE54C300BE500005CE383\r
+S21402B7002070A0033070A01328304BE21F40A0E345\r
+S21402B710014054E2207043E5013083E2FBFFFF5A0A\r
+S21402B720063095E10040A0E33030A00301408402D9\r
+S21402B73048304B051700000A063095E11500000A4E\r
+S21402B7400280A0E10090A0E328A04BE20930A0E12D\r
+S21402B7500820A0E10610A0E10500A0E1CE1500EB4E\r
+S21402B7609C209FE5014084E200C0D2E70610A0E1DB\r
+S21402B7700500A0E10930A0E10820A0E120C04AE5CA\r
+S21402B7803A1400EB0160A0E10050A0E1063090E11F\r
+S21402B79001A08AE2ECFFFF1A08309BE54C201BE56D\r
+S21402B7A0030054E10340A0B12D0052E301404412CD\r
+S21402B7B00900000A000054E3F0AF1BB928204BE250\r
+S21402B7C0023084E0200053E5014044E296FFFFEB9E\r
+S21402B7D0000054E3F0AF1BB9F7FFFFEA28304BE254\r
+S21402B7E0042083E0213052E5070053E128304B0263\r
+S21402B7F001404402042083004C301BE5203042E521\r
+S21402B800EBFFFFEAAC2003000DC0A0E170D82DE9E3\r
+S21402B81004B04CE208D04DE201C0A0E10260A0E113\r
+S21402B8200040A0E10050A0E30C20A0E104C09BE58C\r
+S21402B83003E0A0E10510A0E10400A0E10630A0E1CB\r
+S21402B84000E08DE504C08DE5A3FFFFEB70A81BE9C1\r
+S21402B85000C0A0E1000050E304E02DE50100A0E3F3\r
+S21402B8600C00A00104F09D040030DCE50C10A0E101\r
+S21402B870000053E304F09D0448E09FE5FF2003E246\r
+S21402B88001306CE00E0053E10000A0A30D0052E36D\r
+S21402B8900A0052130400000A080052E3203042E273\r
+S21402B8A00100000A5E0053E30000A083000050E39C\r
+S21402B8B0011081E204F09D040030D1E5000053E35C\r
+S21402B8C004F09D04ECFFFFEA010800000DC0A0E1B1\r
+S21402B8D0F0DF2DE90150A0E10040A0E1051094E15F\r
+S21402B8E004B04CE250D04DE23030A00378604BE218\r
+S21402B8F00270A0E100A0A0E377604B0278304B050F\r
+S21402B9001500000A052094E11300000A0380A0E156\r
+S21402B910C89FA0E10930A0E10820A0E10510A0E13F\r
+S21402B9200400A0E15C1500EB04309BE5000083E018\r
+S21402B9300030D0E50510A0E10400A0E10130C6E425\r
+S21402B9400930A0E10820A0E1C81300EB0150A0E1F5\r
+S21402B9500040A0E1051094E1EDFFFF1A78204BE2CB\r
+S21402B960020056E10500000A013076E578104BE247\r
+S21402B970010056E101A08AE20130C7E4F9FFFF1A8E\r
+S21402B9800030A0E30030C7E50A00A0E1F0AF1BE9F3\r
+S21402B9900DC0A0E1F0DF2DE904B04CE26CD04DE220\r
+S21402B9A00260A0E16C000BE50200A0E10190A0E1BC\r
+S21402B9B070300BE5A5FFFFEB0080A0E3000050E32C\r
+S21402B9C00020A0E30010A0E368004BE280304BE2C8\r
+S21402B9D078000BE5060003E90870A0E11102000AF0\r
+S21402B9E00020D6E50110D6E4000052E3FF5001E243\r
+S21402B9F00C00000A250055E30C00000A0500A0E131\r
+S21402BA000910A0E16C201BE50FE0A0E102F0A0E126\r
+S21402BA10018088E20020D6E50110D6E4000052E359\r
+S21402BA20FF5001E2F2FFFF1A0800A0E1F0AF1BE9A7\r
+S21402BA300130D6E400C0A0E3FF5003E22D0055E338\r
+S21402BA4080C00BE50130D6040140A003FF5003027C\r
+S21402BA5080400B05300055E30130D60401E0A00318\r
+S21402BA60FF500302303045E27CE00B057CC00B152C\r
+S21402BA70090053E30C00A0E10CA0A0E10700008A35\r
+S21402BA800110D6E40A218AE0822085E0FF5001E216\r
+S21402BA90303045E2090053E330A042E2F7FFFF9A56\r
+S21402BAA02E0055E3D101000A0020A0E36C0055E306\r
+S21402BAB074200BE5C501000A7A0055E30130D6046E\r
+S21402BAC0FF500302423045E2360053E303F19F97EC\r
+S21402BAD0440000EAB0BB0200E8BB0200B0BB0200B2\r
+S21402BAE0E8BB0200E8BB0200E8BB0200E8BB0200BB\r
+S21402BAF0E8BB0200E8BB0200E8BB0200E8BB0200AB\r
+S21402BB00E8BB0200E8BB0200E8BB0200E8BB02009A\r
+S21402BB10E8BB0200E8BB0200E8BB0200E8BB02008A\r
+S21402BB20B0BB0200E8BB0200E8BB0200B0BB0200EA\r
+S21402BB30E8BB0200E8BB0200E8BB0200E8BB02006A\r
+S21402BB40E8BB0200E8BB0200E8BB0200E8BB02005A\r
+S21402BB50E8BB0200B0BB0200E8BB0200B0BB0200BA\r
+S21402BB60E8BB0200E8BB0200E8BB0200E8BB02003A\r
+S21402BB70E8BB0200E8BB0200E8BB0200E8BB02002A\r
+S21402BB80E8BB0200E8BB0200E8BB0200B0BB020052\r
+S21402BB90E8BB0200E8BB0200E8BB0200E8BB02000A\r
+S21402BBA0B0BB0200E8BB0200E8BB0200B0BB02006A\r
+S21402BBB0000050E37C01000A70301BE580404BE237\r
+S21402BBC0060093E808E083E2060004E970E00BE56D\r
+S21402BBD0440055E3640055136B01001A84101BE5FC\r
+S21402BBE0000051E3600100BA253045E2530053E3FA\r
+S21402BBF003F19F974F0100EAF8BF020038C1020026\r
+S21402BC0038C1020038C1020038C1020038C1020041\r
+S21402BC1038C1020038C1020038C1020038C1020031\r
+S21402BC2038C1020038C1020038C1020038C1020021\r
+S21402BC3038C1020038C1020038C1020038C1020011\r
+S21402BC4038C1020038C1020038C1020038C1020001\r
+S21402BC5038C1020038C1020038C1020038C10200F1\r
+S21402BC6038C1020038C1020038C1020018C0020002\r
+S21402BC7084C002007CBD020038C1020038C1020046\r
+S21402BC8038C1020038C1020038C1020038C10200C1\r
+S21402BC9038C1020038C1020038C1020038C10200B1\r
+S21402BCA038C1020038C1020038C1020038C10200A1\r
+S21402BCB0B0C0020038C102007CBD020038C10200DA\r
+S21402BCC038C102007CBD020038C1020038C1020041\r
+S21402BCD038C1020038C1020038C1020038C1020071\r
+S21402BCE038C1020038C1020038C1020018C0020082\r
+S21402BCF084C002007CBD020038C1020038C10200C6\r
+S21402BD0038C1020038C1020038C1020038C1020040\r
+S21402BD1038C1020038C1020038C1020038C1020030\r
+S21402BD2038C1020048BD020038C1020038C1020014\r
+S21402BD30B0C0020038C102007CBD020038C1020059\r
+S21402BD4038C102007CBD02003000A0E30910A0E169\r
+S21402BD506C201BE50FE0A0E102F0A0E10140A0E3A9\r
+S21402BD607800A0E30910A0E16C301BE50FE0A0E12B\r
+S21402BD7003F0A0E108A0A0E37C400BE5443045E2D6\r
+S21402BD80340053E303F19F973C0000EA60BE0200D2\r
+S21402BD9080BE020080BE020080BE020080BE02009C\r
+S21402BDA080BE020080BE020080BE020080BE02008C\r
+S21402BDB080BE020080BE020080BE020080BE02007C\r
+S21402BDC080BE020080BE020080BE020080BE02006C\r
+S21402BDD060BE020080BE020080BE0200C8BF020033\r
+S21402BDE080BE020080BE020080BE020080BE02004C\r
+S21402BDF080BE020080BE020080BE020080BE02003C\r
+S21402BE0080BE020080BE020080BE020060BE02004B\r
+S21402BE1080BE020080BE020080BE020080BE02001B\r
+S21402BE2080BE020080BE020080BE020080BE02000B\r
+S21402BE3080BE020080BE020080BE0200E0BF02009A\r
+S21402BE4080BE020080BE020080BE020080BE0200EB\r
+S21402BE5060BE020080BE020080BE0200E0BF02009A\r
+S21402BE6080C04BE203001CE924C49FE568204BE235\r
+S21402BE700A30A0E300C08DE593FEFFEB0070A0E160\r
+S21402BE8068304BE2014047E278300BE590400BE524\r
+S21402BE9074001BE57C101BE5000050E30A4067E0D7\r
+S21402BEA001404412000051E32050A0030300000AA0\r
+S21402BEB074201BE53050A0E3000052E33800001A5D\r
+S21402BEC080E01BE500005EE30B00001A000054E36E\r
+S21402BED0014044E2080000DA0500A0E10910A0E1F2\r
+S21402BEE06C201BE50FE0A0E102F0A0E1000054E3A5\r
+S21402BEF0018088E2014044E2F6FFFFCA74301BE587\r
+S21402BF00000053E31F00001A000057E390701BE581\r
+S21402BF100C0000DA78E01BE50910A0E10130DEE44F\r
+S21402BF206C201BE5FF5003E278E00BE50500A0E17C\r
+S21402BF300FE0A0E102F0A0E1000057E3018088E2F2\r
+S21402BF40017047E2F2FFFFCA80301BE5000053E3B0\r
+S21402BF50AFFEFF0A000054E3014044E2ACFEFFDA03\r
+S21402BF602000A0E30910A0E16CC01BE50FE0A0E1F1\r
+S21402BF700CF0A0E1000054E3018088E2014044E2B4\r
+S21402BF80F6FFFFCAA2FEFFEA0300A0E10910A0E145\r
+S21402BF906CC01BE50FE0A0E10CF0A0E1018088E296\r
+S21402BFA0D8FFFFEA0200A0E10910A0E16C301BE511\r
+S21402BFB00FE0A0E103F0A0E1018088E200C0A0E368\r
+S21402BFC074C00BE5BDFFFFEA80204BE2C4C29FE5CA\r
+S21402BFD0030012E91030A0E368204BE2A4FFFFEA58\r
+S21402BFE080E04BE203001EE9ACC29FE568204BE20C\r
+S21402BFF01030A0E39EFFFFEA2500A0E30910A0E1AF\r
+S21402C0006C201BE50FE0A0E102F0A0E1013047E260\r
+S21402C01090300BE59DFFFFEA00705AE20200001A1C\r
+S21402C020000050E32070A0034070A01301E047E236\r
+S21402C0300040A0E30E0054E190E00BE58CE00BE537\r
+S21402C0400C0000AA68504BE280304BE2030013E972\r
+S21402C0500420A0E1F11100EB010010E33130A0E36F\r
+S21402C0602E30A0030130C5E48CC01BE5014084E2FB\r
+S21402C0700C0054E1F3FFFFBA68E04BE278E00BE510\r
+S21402C08082FFFFEA70301BE50910A0E10050D3E5FD\r
+S21402C0906C401BE50500A0E10FE0A0E104F0A0E182\r
+S21402C0A070C01BE504C08CE270C00BE557FEFFEAC9\r
+S21402C0B070301BE570C01BE5003093E504C08CE2CF\r
+S21402C0C0000053E3D4E19F0578300BE570C00BE522\r
+S21402C0D078E00B050300000A78001BE5DBFDFFEBAA\r
+S21402C0E0000050E30C00000A78101BE50070A0E385\r
+S21402C0F00730D1E7070053E100E0E00390E00B05CC\r
+S21402C10062FFFF0A78201BE5017087E20730D2E75C\r
+S21402C110000053E3FAFFFF1ABBFFFFEA80019FE528\r
+S21402C12055FDFFEB78001BE560FDFFEB74019FE514\r
+S21402C13078000BE5EBFFFFEA2500A0E30910A0E17B\r
+S21402C1406C401BE50FE0A0E104F0A0E10500A0E1D1\r
+S21402C1500910A0E10FE0A0E104F0A0E1028088E26D\r
+S21402C16001C047E290C00BE548FFFFEA80404BE281\r
+S21402C1700C0014E92DC0A0E3002072E20030E3E2D6\r
+S21402C1800C0004E974C00BE596FEFFEA80C04BE2A1\r
+S21402C19006001CE9F0308FE2180093E8031001E075\r
+S21402C1A0042002E006000CE98EFEFFEA70301BE572\r
+S21402C1B080E04BE2002093E5041083E20230A0E127\r
+S21402C1C0C34FA0E118000EE970100BE57FFEFFEAF0\r
+S21402C1D00130D6E401C0A0E3FF5003E26C0055E351\r
+S21402C1E00130D6040C00A001FF50030231FEFFEA24\r
+S21402C1F00120D6E47C101BE5FF5002E2303045E217\r
+S21402C200011081E2090053E37C100BE525FEFF8A4C\r
+S21402C2100130D6E4FF5003E2302045E2090052E343\r
+S21402C220FAFFFF9A1FFEFFEA7C009FE512FDFFEB76\r
+S21402C2300600A0E11DFDFFEB70009FE50740A0E3AE\r
+S21402C2400DFDFFEB2000A0E3F7FCFFEB70301BE5D3\r
+S21402C250002093E504C083E20200A0E10010A0E300\r
+S21402C26080304BE2030003E988001BE570C00BE553\r
+S21402C2700EFDFFEB014054E2F1FFFF5A30009FE54E\r
+S21402C280FDFCFFEB0000A0E3F0AF1BE9FFFFFFFFA2\r
+S21402C29000000000C0200300AC200300CC200300F6\r
+S21402C2A0E0200300E8200300401C0300FC200300FB\r
+S21402C2B014210300182103000C0091E9020053E147\r
+S21402C2C001C0A0E1FF0000E20EF0A0A1003091E55F\r
+S21402C2D00100C3E4003081E50010A0E30010C3E5CE\r
+S21402C2E008209CE5012082E208208CE50EF0A0E101\r
+S21402C2F00DC0A0E10E002DE900D82DE910B04CE2E9\r
+S21402C3000CD04DE200C0A0E101EBA0E318C00BE5A3\r
+S21402C31018104BE200C0A0E304209BE508308BE235\r
+S21402C32010009FE514E00BE510C00BE597FDFFEB50\r
+S21402C33010001BE500A81BE9B8C202000DC0A0E170\r
+S21402C3400F002DE900D82DE918309FE514B04CE215\r
+S21402C350000093E504209BE508308BE20010A0E382\r
+S21402C3608AFDFFEB00A81BE90832030004E02DE576\r
+S21402C37014309FE50020A0E1000093E50130A0E123\r
+S21402C3800010A0E304E09DE480FDFFEA083203000B\r
+S21402C3900DC0A0E1010052E1F0D92DE90260A0E152\r
+S21402C3A002606180000056E304B04CE20170A0E136\r
+S21402C3B00050A0E10380A0E1F0A91BD9000058E3D9\r
+S21402C3C007106810C0009F15BC009F050710A0014B\r
+S21402C3D00FE0A0E105F0A0E10040A0E3060054E172\r
+S21402C3E0A8009FE5240000AA0410D7E70FE0A0E10A\r
+S21402C3F005F0A0E1070054E394009FE51B00000A45\r
+S21402C400014084E20F0054E3F3FFFFDA84009FE565\r
+S21402C4100FE0A0E105F0A0E10040A0E3060054E131\r
+S21402C4202010A0A3030000AA0410D7E7203041E2A0\r
+S21402C4305E0053E32E10A0835C009FE5014084E279\r
+S21402C4400FE0A0E105F0A0E10F0054E3F2FFFFDAEF\r
+S21402C45048009FE5106046E20FE0A0E105F0A0E18B\r
+S21402C460000056E3107087E2F0A91BD9D2FFFFEA5C\r
+S21402C4700FE0A0E105F0A0E1E0FFFFEA20009FE563\r
+S21402C4800FE0A0E105F0A0E1D9FFFFEA1C210300BE\r
+S21402C490242103004C2103002C2103003021030039\r
+S21402C4A0342103003821030010402DE900C0A0E12A\r
+S21402C4B00140A0E110009FE50230A0E10C10A0E1CF\r
+S21402C4C00420A0E11040BDE8B0FFFFEA3CC3020032\r
+S21402C4D004E02DE50020A0E304E09DE4F1FFFFEA7E\r
+S21402C4E00DC0A0E1000051E1F0D92DE90150A0E114\r
+S21402C4F001506080000055E304B04CE20060A0E109\r
+S21402C5000280A0E1F0A91BD9000058E306106810CB\r
+S21402C5105C009F1558009F050610A00186FFFFEBE2\r
+S21402C520C53FA0E1237F85E00040A0E3470154E138\r
+S21402C53040009FE50B0000AA041196E77EFFFFEB82\r
+S21402C540014084E2030054E3F7FFFFDA28009FE588\r
+S21402C550105045E278FFFFEB000055E3106086E2DC\r
+S21402C560F0A91BD9E7FFFFEA10009FE572FFFFEB79\r
+S21402C570F2FFFFEA1C2103003C2103008023030094\r
+S21402C5804421030004E02DE50020A0E304E09DE43E\r
+S21402C590D2FFFFEA0DC0A0E1000051E1F0D92DE97B\r
+S21402C5A00150A0E101506080000055E304B04CE267\r
+S21402C5B00060A0E10280A0E1F0A91BD9000058E3C8\r
+S21402C5C0061068106C009F1568009F050610A001F3\r
+S21402C5D059FFFFEB0040A0E3C57FA0E1A73F85E03F\r
+S21402C5E0C30054E150009FE58420A0E14C009FA5C3\r
+S21402C5F00E0000AAB61092E14FFFFFEB030054E3D1\r
+S21402C6003C009FE50900000A014084E2070054E36B\r
+S21402C610F1FFFFDA2C009FE5105045E246FFFFEBE4\r
+S21402C620000055E3106086E2F0A91BD9E2FFFFEA9C\r
+S21402C63041FFFFEBF3FFFFEA1C210300502103003A\r
+S21402C640482103004C2103008023030004E02DE56B\r
+S21402C6500020A0E304E09DE4CDFFFFEA14309FE54E\r
+S21402C66004E02DE5030051E10100500304F09D149F\r
+S21402C67004E09DE404FBFFEA7427000004E02DE5D5\r
+S21402C68008109FE50100A0E304E09DE4F2FFFFEA44\r
+S21402C69074270000030052E302C0A0E104E02DE587\r
+S21402C6A00020A0E10200009A003081E1030013E3BB\r
+S21402C6B00800000A01C04CE201007CE304F09D047D\r
+S21402C6C00130D1E401C04CE201007CE30130C2E457\r
+S21402C6D004F09D04F9FFFFEA0F005CE300E0A0E12E\r
+S21402C6E00A00009A043091E410C04CE204308EE452\r
+S21402C6F0042091E40F005CE304208EE4043091E40D\r
+S21402C70004308EE4042091E404208EE4F4FFFF8AD1\r
+S21402C71003005CE30400009A043091E404C04CE297\r
+S21402C72003005CE304308EE4FAFFFF8A01C04CE2A9\r
+S21402C73001007CE30E20A0E104F09D040130D1E468\r
+S21402C74001C04CE201007CE30130C2E404F09D0427\r
+S21402C750F9FFFFEA0EF0A0E10DC0A0E100D82DE936\r
+S21402C76058309FE504B04CE2380093E5F2FEFFEB4A\r
+S21402C7704C109FE54C309FE54C209FE54C009FE512\r
+S21402C780EDFEFFEB48009FE5EBFEFFEB44309FE536\r
+S21402C79044009FE5001093E5002090E53C009FE5ED\r
+S21402C7A0E5FEFFEB38309FE538009FE5060093E88C\r
+S21402C7B0E1FEFFEB30009FE500681BE9DEFEFFEAC4\r
+S21402C7C05000000000220300681B0300082203003A\r
+S21402C7D01022030028220300008403004083030083\r
+S21402C7E058220300608403006822030070220300BC\r
+S21402C7F00DC0A0E170D82DE92C309FE52C409FE5B6\r
+S21402C80004B04CE2030054E10050A0E170A81B09FA\r
+S21402C8100360A0E10500A0E10FE0A0E104F094E4CB\r
+S21402C820060054E170A81B09F9FFFFEAF033030083\r
+S21402C830F03303000DC0A0E110D82DE9FF4000E25E\r
+S21402C8400A0054E304B04CE20D00A0E30200000A22\r
+S21402C8500400A0E110681BE98E0200EA8D0200EBDC\r
+S21402C860FAFFFFEA04E02DE508009FE50110A0E3C9\r
+S21402C87004E09DE4CF0900EA445F03000DC0A0E196\r
+S21402C880F0DF2DE9FC229FE5FC429FE5FC329FE5A6\r
+S21402C89004B04CE204D04DE2F4029FE50050E0E31F\r
+S21402C8A0383084E5542084E56FFBFFEB76FAFFEB25\r
+S21402C8B0343094E50500A0E10FE0A0E103F0A0E12A\r
+S21402C8C00060A0E3343094E50090A0E10600A0E109\r
+S21402C8D00FE0A0E103F0A0E1B8229FE5B8329FE5A1\r
+S21402C8E00170A0E3006083E5007082E5483094E5BD\r
+S21402C8F0A8029FE50FE0A0E103F0A0E1A0329FE5C9\r
+S21402C900A0229FE5A0029FE50117A0E3006083E551\r
+S21402C910001082E594329FE594229FE501C760E20B\r
+S21402C92000C083E5005082E588329FE588229FE5B5\r
+S21402C930001083E5000082E580329FE50FE0A0E16B\r
+S21402C94003F0A0E178429FE578329FE5030054E1C8\r
+S21402C9500400000A0350A0E10FE0A0E104F094E412\r
+S21402C960050054E1FBFFFF1A4C329FE534229FE597\r
+S21402C970004093E500C092E54C329FE50000A0E33C\r
+S21402C9800010A0E1101083E872FFFFEB3C829FE5E7\r
+S21402C9902CA04BE2000057E30200000A30029FE59B\r
+S21402C9A065FEFFEB0070A0E328429FE50150A0E37E\r
+S21402C9B00400A0E1011CA0E30A20A0E3005088E5E1\r
+S21402C9C0120500EB0030A0E3010070E30060A0E176\r
+S21402C9D0003088E5EEFFFF0A030050E13500000A4A\r
+S21402C9E00400A0E1011CA0E33C0800EB0030D4E503\r
+S21402C9F02C400BE53D0053E3230053130700001AB7\r
+S21402CA003D0053E30100000A0170A0E3E0FFFFEAE5\r
+S21402CA10021084E2C0019FE547FEFFEBF9FFFFEA42\r
+S21402CA20000053E3F7FFFF0AB0619FE5B0519FE5B0\r
+S21402CA300610A0E10520A0E10A00A0E1AE0500EB89\r
+S21402CA400040A0E1000054E398019FE51500000AAB\r
+S21402CA5094319FE594219FE5003082E5520900EB70\r
+S21402CA600030A0E1000053E384019FE50510A0E139\r
+S21402CA700800000A30FEFFEB70319FE50020A0E3BD\r
+S21402CA80002083E52C301BE50020D3E5000052E3AE\r
+S21402CA90E6FFFF1ADBFFFFEA000096E50FE0A0E1E3\r
+S21402CAA00CF094E5F3FFFFEA001095E544019FE5DC\r
+S21402CAB021FEFFEBF2FFFFEACC309FE5342093E540\r
+S21402CAC034319FE5005083E50FE0A0E102F0A0E1DB\r
+S21402CAD0B4209FE50410A0E3143092E5000093E52D\r
+S21402CAE0142093E50FE0A0E102F0A0E198309FE564\r
+S21402CAF00900A0E1342093E50FE0A0E102F0A0E1F6\r
+S21402CB00A0309FE50600A0E1002093E50F10C2E3E7\r
+S21402CB1050E041E200018EE7010080E20A0050E3A5\r
+S21402CB20FBFFFFDAD4309FE578C09FE5D0209FE573\r
+S21402CB3000308EE51330A0E334108EE53C208EE5FF\r
+S21402CB4040308EE50C00A0E138208EE500E08CE552\r
+S21402CB50B0109FE5050900EB2C409FE598309FE555\r
+S21402CB600020A0E3002083E5301094E50000E0E317\r
+S21402CB700FE0A0E101F0A0E1343094E50FE0A0E17F\r
+S21402CB8003F0A0E182FFFFEA7CCD02005000000025\r
+S21402CB90D030030034C80200208403002083030040\r
+S21402CBA0400D030000840300A084030008850300F0\r
+S21402CBB0E083030040840300408303008084030074\r
+S21402CBC054C70200F0330300F0330300608403000E\r
+S21402CBD0008503007C2203003C5E03006020030005\r
+S21402CBE0C083030060830300445F030064C802003E\r
+S21402CBF0F431030088220300B4220300C084030039\r
+S21402CC00B08E02004CCD02003C5F03000DC0A0E1D6\r
+S21402CC10F0D92DE9000052E304B04CE204D04DE214\r
+S21402CC200250A0E10040A0E10160A0E10370A0E193\r
+S21402CC300080A0E30200000A0200A0E11C0800EB4C\r
+S21402CC400080A0E1060054E1F0A91B09000055E2AD\r
+S21402CC500820A0E10130A0E30400000A001094E5D9\r
+S21402CC60250100EB000050E30030A0130130A003C2\r
+S21402CC70000053E30720A0E144009FE50300001AEA\r
+S21402CC80184084E2060054E1F0A91B09EEFFFFEA11\r
+S21402CC90021094E9003094E500C08DE5A6FDFFEB96\r
+S21402CCA0100094E50020A0E3020050E102005511B6\r
+S21402CCB0F2FFFF0A141094E5003094E5D2FFFFEB72\r
+S21402CCC0EEFFFFEAD82203000DC0A0E130D82DE91E\r
+S21402CCD004B04CE20040A0E314E04BE20150A0E3B3\r
+S21402CCE050C09FE514D04DE20520A0E10430A0E13B\r
+S21402CCF004402EE504E08DE50CC08DE500408DE590\r
+S21402CD0008508DE5AE0500EB0020A0E1040052E1DC\r
+S21402CD1024009FE524109FE524309FE50100001AB9\r
+S21402CD2085FDFFEB30A81BE918009FE518201BE5E0\r
+S21402CD30B5FFFFEB30A81BE9E8220300F022030050\r
+S21402CD40F0330300681B0300A03203000DC0A0E10D\r
+S21402CD5010D82DE904B04CE200300FE100400FE19C\r
+S21402CD60C04084E304F029E10FE0A0E100F0A0E176\r
+S21402CD7000009FE5840800EB3C5F030018309FE547\r
+S21402CD800DC0A0E10020A0E100D82DE90C009FE52F\r
+S21402CD9004B04CE2002083E57B0800EB405F030012\r
+S21402CDA03C5F03000DC0A0E1F0D82DE928329FE5D4\r
+S21402CDB004B04CE224C29FE570D04DE20040A0E3EE\r
+S21402CDC064504BE200E093E500408CE570C04BE215\r
+S21402CDD000C08DE508C29FE50060A0E10170A0E1F9\r
+S21402CDE00500A0E17710A0E30120A0E30430A0E153\r
+S21402CDF07CE00BE574E04BE204E08DE508C08DE5CF\r
+S21402CE0078400BE5650500EBD8E19FE578C04BE27C\r
+S21402CE104C004BE26310A0E30420A0E10230A0E342\r
+S21402CE2000C08DE510408DE95C0500EB02C0A0E372\r
+S21402CE3000C08DE5B0C19FE57CE04BE20600A0E1B4\r
+S21402CE400710A0E10530A0E10120A0E304E08DE593\r
+S21402CE5008408DE50CC08DE5590500EB040050E155\r
+S21402CE60F0A81B097C101BE5010071E35700000ABD\r
+S21402CE7074301BE5000053E31100000A70201BE526\r
+S21402CE8068019FE5823262E0033182E08341A0E1DD\r
+S21402CE9029FDFFEB090054E3090000DA6C504BE26F\r
+S21402CEA00500A0E10810A0E30A20A0E3D70300EBE8\r
+S21402CEB0020070E30A4044E2F0A81B09090054E3AA\r
+S21402CEC0F6FFFFCA28419FE50000E0E3343094E510\r
+S21402CED00FE0A0E103F0A0E1343094E50050A0E1B9\r
+S21402CEE00000A0E30FE0A0E103F0A0E1146094E5E7\r
+S21402CEF00410A0E3000096E5143096E50FE0A0E1EA\r
+S21402CF0003F0A0E1343094E50500A0E10FE0A0E1D3\r
+S21402CF1003F0A0E1146094E50910A0E3000096E592\r
+S21402CF20143096E50FE0A0E103F0A0E100500FE117\r
+S21402CF3000400FE1C04084E304F029E1B4309FE5ED\r
+S21402CF400010A0E3002093E50F00C2E350E040E2A9\r
+S21402CF5001118EE7011081E20A0051E3FBFFFFDABE\r
+S21402CF607C301BE58CC09FE58C209FE500308EE56B\r
+S21402CF701330A0E334008EE53C208EE50C00A0E1E1\r
+S21402CF8038208EE540308EE500E08CE56C109FE59B\r
+S21402CF90F60700EB000096E50A10A0E3142096E5DB\r
+S21402CFA00FE0A0E102F0A0E100300FE1C04005E290\r
+S21402CFB0C030C3E3043083E103F029E140209FE55B\r
+S21402CFC040009FE5001092E5DBFCFFEBF0A81BE9B2\r
+S21402CFD034009FE5D8FCFFEBF0A81BE94084030071\r
+S21402CFE0F431030004230300142303002C2303005C\r
+S21402CFF04023030050000000A08403004CCD020032\r
+S21402D0003C5F0300405F030084230300A823030061\r
+S21402D0100DC0A0E110D82DE938409FE504B04CE2DF\r
+S21402D02034009FE5C4FCFFEB483094E52C009FE5F6\r
+S21402D0300FE0A0E103F0A0E124009FE5BEFCFFEBB9\r
+S21402D040403094E50FE0A0E103F0A0E114009FE574\r
+S21402D05010681BE9B8FCFFEA50000000C823030072\r
+S21402D060400D030080230300D823030028209FE5F9\r
+S21402D070003092E50010A0E3010073E30400000A0A\r
+S21402D080030050E10200003A043092E5030050E14A\r
+S21402D090011081320100A0E10EF0A0E160840300DD\r
+S21402D0A010402DE90040A0E10130D4E4FF0003E285\r
+S21402D0B0412040E2190052E3203080E2FF00039252\r
+S21402D0C00130D1E4FFC000E2FF3003E2412043E238\r
+S21402D0D0190052E320E083E2FF300E92FF0003E2E3\r
+S21402D0E000005CE10C0060101080BD1800005CE3DC\r
+S21402D0F00C00A001EBFFFF1A1080BDE8000052E30F\r
+S21402D10010402DE90040A0E102E0A0E10200A001EB\r
+S21402D1101080BD080130D4E4FF0003E2412040E263\r
+S21402D120190052E3203080E2FF0003920130D1E47E\r
+S21402D130FFC000E2FF0003E2412040E2203080E22E\r
+S21402D140190052E3FF000392FF0000E200005CE1D8\r
+S21402D1500C0060101080BD1800005CE30100000A9D\r
+S21402D16001E05EE2EAFFFF1A0000A0E31080BDE8DD\r
+S21402D1700DC0A0E1F0D82DE9F4609FE504B04CE2C2\r
+S21402D18004D04DE20040A0E1343096E50000E0E332\r
+S21402D1900150A0E10FE0A0E103F0A0E1020054E399\r
+S21402D1A00070A0E10C00000AC8009FE562FCFFEBDD\r
+S21402D1B0C4309FE5002093E5000052E30710A0115B\r
+S21402D1C0B8009F150200001AB4009FE55AFCFFEB58\r
+S21402D1D0F0A81BE958FCFFEBF0A81BE9040095E554\r
+S21402D1E0A0109FE50320A0E34A0600EB000050E3F0\r
+S21402D1F084309F05000083050300001A88309FE5EF\r
+S21402D2000120A0E3002083E5F0A81BE90020A0E3AC\r
+S21402D21020104BE2040095E50230A0E1180500EB71\r
+S21402D220000050E30410950560009F05E8FFFF0A22\r
+S21402D23020001BE5000050E30A00001A343096E591\r
+S21402D2400FE0A0E103F0A0E1302096E520001BE508\r
+S21402D2500FE0A0E102F0A0E120301BE5070053E159\r
+S21402D260E5FFFF1AF0A81BE9041095E520009FE5EC\r
+S21402D270D7FFFFEA50000000482403002083030083\r
+S21402D280682403006C240300702403002084030037\r
+S21402D29074240300942403000DC0A0E1F0D82DE905\r
+S21402D2A090309FE50020A0E1006093E504B04CE2D8\r
+S21402D2B0000056E380709FE50000E0E3FF5002E2C4\r
+S21402D2C00900000A143097E50510A0E1000053E3B8\r
+S21402D2D0183097050510A001000093E50C3093E581\r
+S21402D2E00FE0A0E103F0A0E1F0A81BE9343097E5D7\r
+S21402D2F00FE0A0E103F0A0E1343097E50040A0E1A2\r
+S21402D3000600A0E10FE0A0E103F0A0E1143097E5EB\r
+S21402D3100510A0E1000093E50C3093E50FE0A0E1D4\r
+S21402D32003F0A0E1342097E50400A0E10FE0A0E1BD\r
+S21402D33002F0A0E1F0A81BE92083030050000000E1\r
+S21402D3400DC0A0E110D82DE928209FE50040A0E1FD\r
+S21402D350143092E504B04CE2000053E31830920514\r
+S21402D360000093E5103093E50FE0A0E103F0A0E1A2\r
+S21402D3700000C4E510A81BE9500000000DC0A0E1A3\r
+S21402D380F0DD2DE910319FE50040A0E3002093E593\r
+S21402D39004B04CE2040052E10060A0E10E00000A74\r
+S21402D3A0F8209FE5143092E5000053E3183092050A\r
+S21402D3B0000093150010A0011C3093150000930581\r
+S21402D3C00610A0111C3093050FE0A0E103F0A0E1C7\r
+S21402D3D00040A0E10400A0E1F0AD1BE9BC709FE5AF\r
+S21402D3E00000E0E3343097E50FE0A0E103F0A0E1AF\r
+S21402D3F0AC309FE500A0A0E1002093E50450A0E138\r
+S21402D400020054E1150000AA0080A0E3343097E53C\r
+S21402D4100800A0E10FE0A0E103F0A0E1143097E5D8\r
+S21402D4200610A0E1000093E51C3093E50FE0A0E1B2\r
+S21402D43003F0A0E1080050E1015085E20040A0E1BF\r
+S21402D4400200000A0030D6E5080053E10900001A7F\r
+S21402D4504C309FE5002093E5020055E1E9FFFFBA54\r
+S21402D4600A00A0E134309FE5342093E50FE0A0E106\r
+S21402D47002F0A0E1D6FFFFEA1C309FE50120A0E300\r
+S21402D480002083E5301097E50800A0E10FE0A0E158\r
+S21402D49001F0A0E10800A0E1F1FFFFEA208303000B\r
+S21402D4A050000000845F03000DC0A0E1F0D82DE913\r
+S21402D4B0C4309FE5C4609FE5005093E50040A0E1BC\r
+S21402D4C0000055E304B04CE20670A0E10000E0E381\r
+S21402D4D01100000A143096E50710A0E3000053E39B\r
+S21402D4E00420A0E100009315143093150FE0A0115C\r
+S21402D4F003F0A011183097E50420A0E1000053E3E2\r
+S21402D5000710A0E3F0A81B09000093E5143093E58A\r
+S21402D5100FE0A0E103F0A0E1F0A81BE9343096E5A5\r
+S21402D5200FE0A0E103F0A0E154309FE50070A0E117\r
+S21402D530004083E50500A0E1343096E50FE0A0E167\r
+S21402D54003F0A0E1143096E50140A0E3000053E3A7\r
+S21402D5500710A0E30420A0E10000931514309315F1\r
+S21402D5600FE0A01103F0A011343096E50700A0E109\r
+S21402D5700FE0A0E103F0A0E1F0A81BE9208303007E\r
+S21402D58050000000845F03000DC0A0E1F0DF2DE92B\r
+S21402D5905C389FE504B04CE20CD04DE200A0A0E15E\r
+S21402D5A00070A0E10000D0E5003093E5000050E3F3\r
+S21402D5B030100BE50280A0E134300BE50090A0E3CA\r
+S21402D5C00500000A0030A0E1FF0003E231FFFFEB96\r
+S21402D5D00130F7E5000053E3FAFFFF1A0750A0E117\r
+S21402D5E00A0057E10030A0130130A003000058E300\r
+S21402D5F00030A0D3013003C2000053E3F901000A51\r
+S21402D600320058E30840A0B13240A0A30400A0E1D3\r
+S21402D610A4FFFFEB000058E3080000DA29604BE2A3\r
+S21402D6200600A0E154FFFFEB000050E30090A0E1EB\r
+S21402D630E901001A088064E0000058E3F7FFFFCA19\r
+S21402D640000059E3E001000A0030A0E30030C7E51D\r
+S21402D65029005BE5013040E20020A0E17E0053E3B2\r
+S21402D66003F19F97A80100EA3CD9020074D9020090\r
+S21402D67094D90200ACD9020010DA020030DA0200B5\r
+S21402D6800CDD020014DD02000CDD02009CDA020052\r
+S21402D6904CDA02000CDD02009CDA020080DB02009B\r
+S21402D6A00CDD020064D802000CDD02000CDD020074\r
+S21402D6B00CDD02000CDD02000CDD02000CDD0200B7\r
+S21402D6C00CDD02000CDD02000CDD02000CDD0200A7\r
+S21402D6D00CDD02000CDD02000CDD02000CDD020097\r
+S21402D6E00CDD02000CDD02000CDD02000CDD020087\r
+S21402D6F00CDD020010DC02000CDD02000CDD020074\r
+S21402D7000CDD02000CDD02000CDD02000CDD020066\r
+S21402D71010DC02000CDD02000CDD02000CDD020053\r
+S21402D7200CDD02000CDD02000CDD02000CDD020046\r
+S21402D7300CDD02000CDD02000CDD02000CDD020036\r
+S21402D7400CDD02000CDD02000CDD02000CDD020026\r
+S21402D7500CDD02000CDD02000CDD02000CDD020016\r
+S21402D7600CDD02000CDD02000CDD02000CDD020006\r
+S21402D7700CDD02000CDD02000CDD02000CDD0200F6\r
+S21402D7800CDD02000CDD02000CDD02000CDD0200E6\r
+S21402D7900CDD02000CDD02000CDD02000CDD0200D6\r
+S21402D7A00CDD02000CDD02000CDD02000CDD0200C6\r
+S21402D7B00CDD02000CDD02000CDD02000CDD0200B6\r
+S21402D7C00CDD02000CDD02000CDD02000CDD0200A6\r
+S21402D7D00CDD02000CDD02000CDD02000CDD020096\r
+S21402D7E00CDD02000CDD02000CDD02000CDD020086\r
+S21402D7F00CDD02000CDD02000CDD02000CDD020076\r
+S21402D8000CDD02000CDD02000CDD02000CDD020065\r
+S21402D8100CDD02000CDD02000CDD02000CDD020055\r
+S21402D8200CDD02000CDD02000CDD02000CDD020045\r
+S21402D8300CDD02000CDD02000CDD02000CDD020035\r
+S21402D8400CDD02000CDD02000CDD02000CDD020025\r
+S21402D8500CDD02000CDD02000CDD02000CDD020015\r
+S21402D86014DD020034101BE5000051E32D0000BA5F\r
+S21402D8700A0055E10800000A0800A0E385FEFFEB57\r
+S21402D8802000A0E383FEFFEB015045E20800A0E380\r
+S21402D89080FEFFEB0A0055E1F6FFFF1A34301BE567\r
+S21402D8A050159FE50A00A0E1031481E0DA0400EBBC\r
+S21402D8B00000D5E5000050E31400001A34101BE502\r
+S21402D8C00570A0E1011051E22C359F4534100BE59E\r
+S21402D8D00030934529005B4534300B450000004A72\r
+S21402D8E029005BE514659FE530101BE50000C6E5E0\r
+S21402D8F001208AE0013042E2030055E137FFFF1AB9\r
+S21402D9000030A0E3013042E530001BE5F0AF1BE932\r
+S21402D910FF0000E25FFEFFEB0100F5E5000050E3CA\r
+S21402D920FAFFFF1AE4FFFFEA0700A0E359FEFFEB47\r
+S21402D930C8649FE529005BE5EAFFFFEA0A0055E1B5\r
+S21402D9400800000A0A0057E1014047E20500000A03\r
+S21402D9500800A0E34FFEFFEB0A0054E1014044E258\r
+S21402D960FAFFFF1A29005BE590649FE50A50A0E1E2\r
+S21402D970DCFFFFEA0A0055E1D9FFFF0A0800A0E330\r
+S21402D98044FEFFEB74649FE529005BE5015045E227\r
+S21402D990D4FFFFEA68049FE567FAFFEB0030A0E3D6\r
+S21402D9A00100E0E30030CAE5F0AF1BE9070055E1ED\r
+S21402D9B0CBFFFF0A017047E2070055E10540A0E1F0\r
+S21402D9C00500000A0130D4E50130C4E4FF0003E29A\r
+S21402D9D030FEFFEB070054E1F9FFFF1A2000A0E338\r
+S21402D9E02CFEFFEB0800A0E32AFEFFEB050054E145\r
+S21402D9F0014044E2B9FFFF0A0800A0E325FEFFEB60\r
+S21402DA00050054E1014044E2FAFFFF1AB3FFFFEAC1\r
+S21402DA10070055E1B2FFFF0A0100D5E4FF0000E26D\r
+S21402DA201CFEFFEB070055E1FAFFFF1AABFFFFEA09\r
+S21402DA30070055E10100D514C0639F15FF000012D0\r
+S21402DA40A7FFFF0A13FEFFEBB9FFFFEA070055E147\r
+S21402DA50A3FFFF0A014085E22000A0E30DFEFFEBD4\r
+S21402DA60070054E1014084E2FAFFFF1A014044E253\r
+S21402DA70050054E10400000A0800A0E3014044E265\r
+S21402DA8004FEFFEB050054E1FAFFFF1A29005BE5EE\r
+S21402DA9068639FE50570A0E192FFFFEAFF2002E2BD\r
+S21402DAA00A0052E354639F152F00000A0D0052E34A\r
+S21402DAB00600001A0030D6E50A0053E30300001AF7\r
+S21402DAC00030A0E30300A0E129304BE585FFFFEA22\r
+S21402DAD030339FE5002093E5000052E31C00001A55\r
+S21402DAE024339FE50000C6E5002093E5000052E3DC\r
+S21402DAF00100001A0100A0E3F0AF1BE90A00A0E152\r
+S21402DB00050100EB0030DAE5000053E3F8FFFF0AF8\r
+S21402DB10DC229FE5E0129FE5003092E5D4029FE505\r
+S21402DB20013083E2100053E3003082E50030A003A8\r
+S21402DB3000308205002092E5003091E5020480E084\r
+S21402DB40030052E1002081C50A10A0E1320400EB76\r
+S21402DB50E7FFFFEA0D00A0E3CEFDFFEB0A00A0E31D\r
+S21402DB60CCFDFFEB29005BE5DCFFFFEA8C629FE55C\r
+S21402DB700030D6E50D0053E3CBFFFF1ACFFFFFEAD6\r
+S21402DB8034301BE5000053E366FFFFBA013083E240\r
+S21402DB9034300BE560329FE534101BE5002093E538\r
+S21402DBA0020051E10010A0C30A0055E134100BE553\r
+S21402DBB00800000A0800A0E3B6FDFFEB2000A0E381\r
+S21402DBC0B4FDFFEB015045E20800A0E3B1FDFFEB18\r
+S21402DBD00A0055E1F6FFFF1A34301BE514129FE5E2\r
+S21402DBE00A00A0E1031481E00B0400EB0000D5E577\r
+S21402DBF0000050E3A4FFFF0AFF0000E2A5FDFFEBD2\r
+S21402DC000100F5E5000050E3FAFFFF1A9EFFFFEA67\r
+S21402DC100A0055E13800000AE0619FE50030D6E5CB\r
+S21402DC205C0053E33400001A070055E10150450238\r
+S21402DC300570A0010500000A0800A0E395FDFFEBB1\r
+S21402DC4029305BE5013065E529005BE57CFFFFEAEC\r
+S21402DC50070055E10900000A050057E10030A0E37D\r
+S21402DC600740A0E10130E7E50300000A013054E571\r
+S21402DC70013044E4050054E1FBFFFF1A29005BE58E\r
+S21402DC8080319FE5002093E5000052E31600001A5B\r
+S21402DC90070055E11100000A0100C5E4070055E13E\r
+S21402DCA00540A0E10400000A0100D4E4FF0000E2FF\r
+S21402DCB078FDFFEB070054E1FAFFFF1A050054E176\r
+S21402DCC0014044E21AFFFF0A0800A0E371FDFFEBE1\r
+S21402DCD0050054E1014044E2FAFFFF1A14FFFFEA8E\r
+S21402DCE00100C5E429005BE569FFFFEAFF0000E2E8\r
+S21402DCF068FDFFEB29005BE5E4FFFFEAFF0002E2B6\r
+S21402DD00D4F1FFEB0000A0E3F0AF1BE9EC609FE567\r
+S21402DD10CEFFFFEA0A0055E1F1FEFF0A070055E1D1\r
+S21402DD201A00000A017047E2015045E20800A0E32B\r
+S21402DD3058FDFFEB070055E10540A0E10760A0E1B2\r
+S21402DD400500000A0130D4E50130C4E4FF0003E216\r
+S21402DD5050FDFFEB060054E1F9FFFF1A2000A0E396\r
+S21402DD604CFDFFEB0800A0E34AFDFFEB050054E183\r
+S21402DD70014044E2D9FEFF0A0800A0E345FDFFEB9E\r
+S21402DD80050054E1014044E2FAFFFF1AD3FEFFEA1F\r
+S21402DD9070309FE5002093E5000052E30200001A6F\r
+S21402DDA0017047E2015045E2CDFEFFEA0800A0E31B\r
+S21402DDB038FDFFEB2000A0E336FDFFEB0800A0E3F2\r
+S21402DDC034FDFFEB29005BE5F4FFFFEA0100A0E368\r
+S21402DDD086FAFFEB0000E0E3F0AF1BE90000A0E3E9\r
+S21402DDE082FAFFEB15FEFFEA29004BE253FDFFEB3A\r
+S21402DDF014FEFFEA0C320300885F030010320300B1\r
+S21402DE0014320300B82403002084030000850300B4\r
+S21402DE1004E02DE50030A0E30030C0E504E09DE418\r
+S21402DE20D8FDFFEA0DC0A0E110D82DE90130A0E12F\r
+S21402DE3004B04CE208D04DE20210A0E10040A0E19E\r
+S21402DE400300A0E148F9FFEB54009FE53AF9FFEB27\r
+S21402DE500420A0E118004BE20810A0E3EBFFFFEB62\r
+S21402DE60000050E3070000DA18205BE5590052E391\r
+S21402DE700030A0130130A003790052E30300A01182\r
+S21402DE800100830310A81BE9010070E314009FE55C\r
+S21402DE900100000A0000A0E310A81BE926F9FFEB28\r
+S21402DEA0FBFFFFEABC240300D02403000DC0A0E160\r
+S21402DEB00F002DE900D82DE914B04CE204109BE5C2\r
+S21402DEC008208BE20000A0E3D5FFFFEB00A81BE9C9\r
+S21402DED000C0D0E530304CE2090053E30010A0E366\r
+S21402DEE00C20A0E10800008A01C0F0E5013181E0C3\r
+S21402DEF0FF2002E230104CE2832082E0090051E368\r
+S21402DF00301042E20C20A0E1F6FFFF9AFF001CE36D\r
+S21402DF100100A0010000E0130EF0A0E10DC0A0E198\r
+S21402DF20F0DD2DE900719FE50030D0E5002097E591\r
+S21402DF30210053E304B04CE20040A0E1016082E21B\r
+S21402DF40F0AD1B190130D0E5000053E3F0AD1B091C\r
+S21402DF50000056E3240000DA0320A0E3CC109FE57D\r
+S21402DF60EC0200EB000050E32900000A018084E284\r
+S21402DF700800A0E1D5FFFFEB000050E30050A0E14F\r
+S21402DF80050000BA003097E5030050E1A0109FD5C7\r
+S21402DF900400A0D1051481D01B0000DA0800A0E11D\r
+S21402DFA0430300EB8C309FE5000056E300A0A0E19F\r
+S21402DFB0005093E50C0000DA74309FE50810A0E1EB\r
+S21402DFC0057483E00700A0E10A20A0E15C0300EBF1\r
+S21402DFD0000050E30A00000A015055E248309F450F\r
+S21402DFE000509345016056E2F2FFFF1A0410A0E1CA\r
+S21402DFF044009FE5D0F8FFEB0030A0E30030C4E514\r
+S21402E000F0AD1BE90400A0E10710A0E1F06D1BE9EA\r
+S21402E010010300EA1C309FE514109FE5002093E5FB\r
+S21402E0200400A0E1021481E0F7FFFFEA10320300C9\r
+S21402E030E0240300885F03000C320300E42403009C\r
+S21402E0400DC0A0E170D82DE99C309FE59C209FE58D\r
+S21402E050001093E5003092E504B04CE2010053E173\r
+S21402E060016081E21300000A80309FE50050A0E3C1\r
+S21402E070002093E5060055E1014082E270A81BA944\r
+S21402E0806C209FE50510A0E1042482E064009FE571\r
+S21402E090A9F8FFEB50309FE5014084E2002093E5AB\r
+S21402E0A0015085E2020054E10040A0C3060055E19B\r
+S21402E0B070A81BA9F1FFFFEA0050A0E3060055E195\r
+S21402E0C070A81BA928409FE50510A0E10420A0E146\r
+S21402E0D020009FE5015085E297F8FFEB060055E128\r
+S21402E0E0014C84E270A81BA9F6FFFFEA1032030077\r
+S21402E0F00C320300885F0300FC2403000DC0A0E17D\r
+S21402E100F0DD2DE9004090E50050A0E30030D4E5B4\r
+S21402E1100180A0E1050053E104B04CE20070A0E1EA\r
+S21402E1200260A0E105A0A0E10310A0E12000000A21\r
+S21402E130FF3003E2200053E35000000AFF3011E2F2\r
+S21402E1401B00000A3B0053E30030A00301A0A0031B\r
+S21402E1500030C4051600000A0F0055E3054186D7B5\r
+S21402E160015085D2410000CA0010D4E5000051E3F8\r
+S21402E1700130A0E10B00000AFF3003E2200053E367\r
+S21402E1803600000A3B0053E30600000A220053E36F\r
+S21402E190014084121000000A0010D4E5000051E38A\r
+S21402E1A00130A0E1F3FFFF1AFF0011E30130A0E106\r
+S21402E1B0DEFFFF1A00005AE3013084120030871592\r
+S21402E1C000408705002096E5C0009FE5C0109FE549\r
+S21402E1D0005088E5F06D1BE9300000EA052186E074\r
+S21402E1E0043012E5040053E10140840204400205B3\r
+S21402E1F00010D405FF2011E20030A0030130A01366\r
+S21402E200220052E30030A00301300312000053E361\r
+S21402E2100420A0E10130A0E10800000AFF3003E27A\r
+S21402E2205C0053E30110F4050110C2E40110F4E5AA\r
+S21402E230000051E3220051130130A0E1F6FFFF1A5D\r
+S21402E240FF0011E30200001A48009FE53AF8FFEBD0\r
+S21402E250D0FFFFEA040052E10030A0130030C215DE\r
+S21402E2600030A0E30030C4E50110F4E5CDFFFFEA7C\r
+S21402E27024009FE50410A0E12FF8FFEBB9FFFFEAA8\r
+S21402E2800110F4E5200051E3FCFFFF0AAAFFFFEAB3\r
+S21402E290A0320300F03303001C25030030250300E0\r
+S21402E2A00DC0A0E1F0DD2DE90050A0E104B04CE283\r
+S21402E2B00200A0E10170A0E10260A0E17C0200EB96\r
+S21402E2C0070055E10540A0E10080A0E10800000A31\r
+S21402E2D0001094E50600A0E10820A0E186FBFFEB13\r
+S21402E2E0000050E30400000A184084E2070054E1EC\r
+S21402E2F0F6FFFF1A0000A0E3F0AD1BE9000094E56C\r
+S21402E3006B0200EB080050E11700009A070055E187\r
+S21402E31001A0A0E31200000A050054E10820A0E1D3\r
+S21402E3200600A0E10B00000A001095E572FBFFEB69\r
+S21402E330000050E30030A0E10600001A00005AE395\r
+S21402E3400610A0E148009FE50D00001A001095E5B2\r
+S21402E35040009FE5F8F7FFEB185085E2070055E10D\r
+S21402E360ECFFFF1A00005AE30100000A0400A0E1D5\r
+S21402E370F0AD1BE920009FE5EFF7FFEB0A00A0E1F6\r
+S21402E380F0AD1BE9002094E503A0A0E1EAF7FFEB5D\r
+S21402E390EDFFFFEA582503007C25030080230300D7\r
+S21402E3A008C09DE50C0080E904209DE500309DE54F\r
+S21402E3B014C080E50010C0E50C3080E5102080E532\r
+S21402E3C00EF0A0E10DC0A0E1F0DF2DE904B04CE2B2\r
+S21402E3D010D04DE200A0A0E30CE09BE504909BE584\r
+S21402E3E001005EE300C0A01301C0A00308E09BE5A5\r
+S21402E3F030300BE500005EE300C0A00301C00C1243\r
+S21402E40000005CE30130A0E300A08E1509005AE18B\r
+S21402E4102C000BE50180A0E134300BE530401BE513\r
+S21402E4200F0000AA0AC0A0E10910A0E1103094E58E\r
+S21402E430000053E300C08315040094E5000050E397\r
+S21402E4400400001A083094E5000053E38500000A31\r
+S21402E450020053E38300000A011051E2184084E2EE\r
+S21402E460F1FFFF1A2CC01BE50250A0E10C0052E19E\r
+S21402E470140000AA051198E70030D1E52D0053E3F9\r
+S21402E4802B00000A08309BE5000053E32300000A35\r
+S21402E49000005AE31B00001A0CE09BE500005EE356\r
+S21402E4A00A00000A01005EE30531980708209B0572\r
+S21402E4B00030820501A0A0E32CC01BE5015085E2D6\r
+S21402E4C00C0055E1EAFFFFBA34001BE5F0AF1BE98A\r
+S21402E4D00C209BE5050198E708109BE50230A0E1B9\r
+S21402E4E0670000EB000050E30040A0E1F0FFFF1AD7\r
+S21402E4F0051198E778019FE510209BE58EF7FFEB64\r
+S21402E50034400BE5EAFFFFEA68019FE510109BE541\r
+S21402E51089F7FFEB00C0A0E334C00BE5DDFFFFEA9E\r
+S21402E52054019FE584F7FFEB08309BE534300BE59A\r
+S21402E530E0FFFFEA0060A0E3090056E10170D1E5C2\r
+S21402E54030401BE50610A0E1060000AA0030D4E524\r
+S21402E550011081E2070053E10900000A090051E1B7\r
+S21402E560184084E2F8FFFFBA000056E3D1FFFF1A14\r
+S21402E5700710A0E104019FE56FF7FFEB34600BE59F\r
+S21402E580CCFFFFEA103094E5000053E30200000AD5\r
+S21402E590003093E5000053E32C00001A043094E5A3\r
+S21402E5A0000053E31F00000A050198E7082094E5DF\r
+S21402E5B00230D0E53D0053E3053188100360800247\r
+S21402E5C00460931501508512000052E30700000A0A\r
+S21402E5D0010052E30C30940500608305102094E598\r
+S21402E5E00130A0E3003082E50160A0E3DDFFFFEA30\r
+S21402E5F00C1094E50600A0E10230A0E1200000EB3A\r
+S21402E600000050E338000BE5F3FFFF1A142094E5F0\r
+S21402E6100610A0E158009FE547F7FFEB38201BE500\r
+S21402E62034200BE5ECFFFFEA083094E5000053E3E4\r
+S21402E6300C2094050030920501308302E8FFFF0AA1\r
+S21402E640020053E3E7FFFF1A0C2094E5E3FFFFEA1C\r
+S21402E650141094E51C009FE537F7FFEB00E0A0E3FB\r
+S21402E66034E00BE5CCFFFFEA0C3094E5000083E5CE\r
+S21402E67078FFFFEA94250300BC250300DC2503008F\r
+S21402E68010260300F0452DE900C0D0E50180A0E188\r
+S21402E69020005CE30270A0E103A0A0E10140A0E339\r
+S21402E6A00A50A0E30060A0E34C00000AFF001CE34F\r
+S21402E6B00C30A0E12800000A000054E30200000A21\r
+S21402E6C0FF3003E2300053E33B00000AFFE00CE2B7\r
+S21402E6D030C04EE241104EE2FF200CE2FF3001E273\r
+S21402E6E0050053E3090052830040A0E3010080E2E4\r
+S21402E6F00420A0E10200009A61304EE2050053E3D6\r
+S21402E7000000008A0120A0E3000052E31700000A7E\r
+S21402E710FF300CE2090053E30020A0E30C20A09196\r
+S21402E7200600009A61304EE2050053E357204E92EF\r
+S21402E7300200009AFF3001E2050053E337204E92B2\r
+S21402E740050052E1090000AA0030D0E5952626E031\r
+S21402E750000053E303C0A0E1D6FFFF1A000057E310\r
+S21402E76000008715006088E50100A0E3F085BDE89B\r
+S21402E77000005AE30E00000A00C0DAE50A30A0E103\r
+S21402E780FF200CE2000052E30700000A0E0052E1EE\r
+S21402E7900500000A01C0F3E5FF200CE2000052E388\r
+S21402E7A00100000A0E0052E1F9FFFF1AFF001CE307\r
+S21402E7B0E9FFFF1A0000A0E3F085BDE80120D0E5DE\r
+S21402E7C0413042E2190053E320308292FF20039246\r
+S21402E7D0780052E302C0F0051050A003BAFFFFEA29\r
+S21402E7E001C0F0E520005CE3FCFFFF0AAEFFFFEA93\r
+S21402E7F00DC0A0E130D82DE90040A0E10150A0E113\r
+S21402E80004B04CE20410A0E164009FE523FAFFEB9B\r
+S21402E8100030A0E1000053E358309F050500A0E158\r
+S21402E8200020930550109FE5FF2F820203208202EC\r
+S21402E8300A00000A0410A0E140009FE517FAFFEB69\r
+S21402E8400030A0E1000053E30500A0E128109FE598\r
+S21402E8500000A01330A81B1918309FE5042093E58A\r
+S21402E860FF2FC2E30320C2E3A0F6FFEB0500A0E100\r
+S21402E87030A81BE9482603006084030054260300E0\r
+S21402E880582603000DC0A0E1F0DF2DE904B04CE2EB\r
+S21402E89028D04DE20070A0E14C100BE50280A0E10A\r
+S21402E8A0030100EB0010A0E3000050E30060A0E1CB\r
+S21402E8B00740A0E150100BE51900000A0020D7E53A\r
+S21402E8C0010052E11600000AFF3002E2250053E37F\r
+S21402E8D0014084E20010D4151300000A220053E31C\r
+S21402E8E0000058030B00001AFF2011E20030A003BC\r
+S21402E8F00130A013220052E30030A00301300312BD\r
+S21402E900000053E30300000A0110F4E5000051E39F\r
+S21402E91022005113FBFFFF1AFF0011E30120A0E1C2\r
+S21402E920E8FFFF1A50001BE5F0AF1BE90010D4E524\r
+S21402E9307B0051E3E8FFFF1A019084E20210F4E53F\r
+S21402E940000051E37D0051130300000A0110F4E5B4\r
+S21402E950000051E37D005113FBFFFF1AFF5011E246\r
+S21402E9605500000A0020A0E304A0A0E10900A0E1EF\r
+S21402E9700120C4E448104BE29CFFFFEB000050E38A\r
+S21402E9800050A0E14500000AC90000EB4C101BE550\r
+S21402E990003086E0010053E100A0A0E1380000AAA2\r
+S21402E9A00900A0E1C20000EB0A3060E00400A0E12A\r
+S21402E9B0026043E2BE0000EB010056E3000084E082\r
+S21402E9C0010040E21F0000DA011044E20020A0E34A\r
+S21402E9D0010050E10620C0E70400000A062080E09D\r
+S21402E9E0013050E4010050E1013042E5FAFFFF1A1F\r
+S21402E9F00020D5E5024049E2000052E30600000A84\r
+S21402EA00FF3002E2250053E30800000A0120C4E4B6\r
+S21402EA100120F5E5000052E3F8FFFF1A0700A0E127\r
+S21402EA20A30000EB0A1074E70060A0E1B9FFFFEA5A\r
+S21402EA300130D5E550101BE57B0053E30110A0031F\r
+S21402EA4050100BE5F0FFFFEA000056E3E7FFFFCAAF\r
+S21402EA50013044E2000053E10500000A061084E09B\r
+S21402EA600120D4E4013044E2000053E1012041E5F4\r
+S21402EA70F9FFFF1A062084E00030A0E3013042E5E9\r
+S21402EA80DAFFFFEA0910A0E144009FE52AF6FFEB51\r
+S21402EA900020A0E30000A0E30020C7E5F0AF1BE9DA\r
+S21402EAA00910A0E12C009FE523F6FFEB7C30A0E3E3\r
+S21402EAB00030CAE50010D4E596FFFFEA0910A0E18F\r
+S21402EAC014009FE51CF6FFEB0500A0E10050C7E529\r
+S21402EAD0F0AF1BE9642603007C260300942603009D\r
+S21402EAE00DC0A0E170D82DE904B04CE20060A0E1B0\r
+S21402EAF00150A0E10040A0E30420A0E10600A0E14E\r
+S21402EB000510A0E15EFFFFEB000050E3014084E247\r
+S21402EB1070A81B09F7FFFFEA030052E310402DE935\r
+S21402EB2002C0A0E10200009A013080E1030013E374\r
+S21402EB300F00000A01C04CE201007CE30800000A54\r
+S21402EB400020D0E50030D1E501C04CE2030052E1DE\r
+S21402EB50010080E2011081E20300001A01007CE35A\r
+S21402EB60F6FFFF1A0000A0E31080BDE8020063E093\r
+S21402EB701080BDE8040052E300E0A0E10140A0E1FD\r
+S21402EB801600009A00209EE5003094E5030052E14C\r
+S21402EB900D00000A01C04CE201007CE30E00A0E179\r
+S21402EBA00410A0E10800000A0020D0E50030D1E5FC\r
+S21402EBB001C04CE2030052E1010080E2011081E252\r
+S21402EBC0E9FFFF1A01007CE3F6FFFF1A04C04CE2DD\r
+S21402EBD004005CE304E08EE2044084E2E8FFFF8A7D\r
+S21402EBE001C04CE201007CE30E00A0E10410A0E1AB\r
+S21402EBF0DBFFFF0A0020D0E50030D1E501C04CE281\r
+S21402EC00030052E1010080E2011081E2D6FFFF1A02\r
+S21402EC1001007CE3F6FFFF1AD1FFFFEA003081E134\r
+S21402EC20030013E330402DE90020A0E10040A0E1FC\r
+S21402EC300500000A0130D1E4000053E30130C2E4CB\r
+S21402EC40FBFFFF1A0400A0E13080BDE858309FE5C4\r
+S21402EC5000E091E5000093E550209FE50E3060E06D\r
+S21402EC60005092E50E30C3E1050013E104C0A0E1B6\r
+S21402EC700700001A0E20A0E105E0A0E104208CE4C3\r
+S21402EC800420B1E5023060E00230C3E10E0013E179\r
+S21402EC90F9FFFF0A0C20A0E10130D1E4000053E3A3\r
+S21402ECA00130C2E4FBFFFF1AE5FFFFEAB0260300CD\r
+S21402ECB0B8260300030010E304E02DE500E0A0E11F\r
+S21402ECC00700000A0030D0E5000053E30200000A05\r
+S21402ECD00130F0E5000053E3FCFFFF1A00006EE08F\r
+S21402ECE004F09DE450309FE5001090E500C093E5E7\r
+S21402ECF048209FE501306CE0002092E50130C3E138\r
+S21402ED00020013E10500001A0210A0E10420B0E59B\r
+S21402ED1002306CE00230C3E1010013E1FAFFFF0AA1\r
+S21402ED200030D0E5000053E3EBFFFF0A0130F0E5C8\r
+S21402ED30000053E3FCFFFF1AE7FFFFEAB0260300DA\r
+S21402ED40B8260300000052E330402DE902C0A0E1DD\r
+S21402ED500200A0013080BD08013080E1030013E309\r
+S21402ED601F00000A01C042E201007CE31700000A0D\r
+S21402ED700020D0E50030D1E502E0A0E1020053E138\r
+S21402ED800300000AFF2002E2FF3003E2020063E013\r
+S21402ED903080BDE800005CE301C04CE20E00000AD1\r
+S21402EDA0FF001EE3010080E20B00000A01007CE384\r
+S21402EDB0011081E20500000A0020D0E50030D1E50E\r
+S21402EDC002E0A0E1020053E1F1FFFF0AECFFFFEAD6\r
+S21402EDD00020D0E50030D1E5E9FFFFEA0000A0E31D\r
+S21402EDE03080BDE8030052E300E0A0E10140A0E16C\r
+S21402EDF00300009A001090E5003094E5030051E10C\r
+S21402EE001700000A00005CE30E00A0E10410A0E177\r
+S21402EE1001C04CE20F00000A00E0DEE50030D4E557\r
+S21402EE200E0053E10E20A011D5FFFF1A00005CE38E\r
+S21402EE3001C04CE2E8FFFF0AFF001EE3E6FFFF0AFE\r
+S21402EE400120F0E50130F1E502E0A0E1020053E125\r
+S21402EE50F5FFFF0ACAFFFFEA0020DEE50030D4E530\r
+S21402EE60C7FFFFEA44509FE544009FE504C05CE20A\r
+S21402EE70D9FFFF0A003095E5002090E5013063E0F7\r
+S21402EE800130C3E1020013E1D3FFFF1A03005CE383\r
+S21402EE9004E08EE2044084E2D9FFFF9A00109EE569\r
+S21402EEA0003094E5030051E1EFFFFF0AD4FFFFEACA\r
+S21402EEB0B0260300B826030010402DE900E0A0E3C8\r
+S21402EEC001005EE1070000AA48409FE501C0A0E1FC\r
+S21402EED00130D0E401C05CE22E3C23E0032194E73B\r
+S21402EEE00EE422E0F9FFFF1A000051E30600000AD2\r
+S21402EEF020009FE52E3C21E0FF3003E2032190E74D\r
+S21402EF002114B0E10EE422E0F9FFFF1A0EE0E0E180\r
+S21402EF100E00A0E11080BDE8C02603000130A0E18B\r
+S21402EF200010A0E3030051E104E02DE50B0000AA67\r
+S21402EF3034E09FE503C0A0E10130D0E40118A0E16F\r
+S21402EF40213C23E08330A0E1BE2093E101C05CE2D5\r
+S21402EF50212422E00228A0E14218A0E1F5FFFF1AD0\r
+S21402EF600108A0E12008A0E104F09DE4C02A030005\r
+S21402EF7014C04DE200602CE90CD0A0E1FF1F2DE981\r
+S21402EF8000200FE140208DE500D081E500B090E53D\r
+S21402EF9000000FE1C00080E300F029E140009BE59D\r
+S21402EFA000F069E1FF7F9BE80EF0B0E1F07F80E8B9\r
+S21402EFB00000A0E30EF0A0E1F07F90E80100A0E1DF\r
+S21402EFC00EF0A0E1030040E2040050E300F19F9738\r
+S21402EFD0060000EAE8EF0200E8EF0200E8EF0200AF\r
+S21402EFE0F8EF0200F8EF02000A00A0E30EF0A0E13C\r
+S21402EFF00500A0E30EF0A0E10200A0E30EF0A0E1FF\r
+S21402F00008309FE5002093E5440092E50EF0A0E16B\r
+S21402F010E08103000DC0A0E110D82DE90F00A0E3A7\r
+S21402F02004B04CE2280000EB0040A0E11900A0E387\r
+S21402F030250000EB38309FE500C0A0E1002093E5F4\r
+S21402F0400000A0E3441092E5020051E310A81B1949\r
+S21402F05020001CE3B020D41118309F150020940520\r
+S21402F06014309F05030052E10000A0130100A00324\r
+S21402F07010A81BE9E081030018DF0000010018EF6A\r
+S21402F08004E02DE50010A0E10F00A0E304E09DE4FB\r
+S21402F0901D0000EA0F0050E30031A0E10800009ACC\r
+S21402F0A0803080E00331A0E1170050E3803043E275\r
+S21402F0B00300009A0031A0E1190050E3403083E2D9\r
+S21402F0C00030E0830300A0E10EF0A0E10DC0A0E155\r
+S21402F0D010D82DE904B04CE20040A0E1ECFFFFEBB3\r
+S21402F0E0104044E2010070E3070054130030E0E3EE\r
+S21402F0F010309F852001A0E1002093850031928781\r
+S21402F1000300A0E110A81BE9E83103000DC0A0E14E\r
+S21402F11030D82DE904B04CE20150A0E10040A0E155\r
+S21402F120DBFFFFEB104044E2010070E307005413DC\r
+S21402F1300C309F852011A0E1002093850151828723\r
+S21402F14030A81BE9E83103000DC0A0E130D82DE954\r
+S21402F15004B04CE20150A0E10040A0E1CCFFFFEB7E\r
+S21402F16000C0A0E101007CE3104044E20500A0E1FB\r
+S21402F1700800000A24309FE5070054E3001093E5D8\r
+S21402F1800C20A0930420A0830C1081E040F5FFEB36\r
+S21402F1900100A0E330A81BE90000A0E330A81BE9A9\r
+S21402F1A0E83103000DC0A0E130D82DE904B04CE2EE\r
+S21402F1B00150A0E10040A0E1B5FFFFEB010070E3C3\r
+S21402F1C000C0A0E1104044E20510A0E10800000AD9\r
+S21402F1D024309FE5070054E3000093E50C20A0933B\r
+S21402F1E00420A0830C0080E029F5FFEB0100A0E3D9\r
+S21402F1F030A81BE90000A0E330A81BE9E8310300B1\r
+S21402F200100F10EE2008A0E1FF0000E2040050E319\r
+S21402F2100000A0930100A0830EF0A0E10DC0A0E1C3\r
+S21402F22010D82DE90040A0E104B04CE21900A0E39A\r
+S21402F230A5FFFFEB243EA0E10020A0E30F0053E36E\r
+S21402F24003F19F97110000EA88F2020098F202008A\r
+S21402F250A4F20200ACF20200B4F20200BCF2020017\r
+S21402F260C8F20200D0F20200D8F20200ECF202006B\r
+S21402F270FCF202001CF302003CF3020060F3020000\r
+S21402F2807CF3020084F30200203FA0E1012003E2A7\r
+S21402F2900200A0E110A81BE9203FA0E1013023E212\r
+S21402F2A0F9FFFFEAA03EA0E1F7FFFFEAA03EA0E1D9\r
+S21402F2B0F9FFFFEAA02FA0E1F4FFFFEA0020E0E159\r
+S21402F2C0A22FA0E1F1FFFFEA203EA0E1EEFFFFEA57\r
+S21402F2D0203EA0E1F0FFFFEA063200E2020253E31C\r
+S21402F2E00020A0130120A003E8FFFFEA063200E296\r
+S21402F2F0022253E20120A013E4FFFFEA092200E201\r
+S21402F300000052E30030A0130130A003090252E3CA\r
+S21402F3100320A01101208303DCFFFFEA092200E29A\r
+S21402F320010252E30030A0130130A003020152E3AF\r
+S21402F3300320A01101208303D4FFFFEA202FA0E1BF\r
+S21402F340012022E2093200E2000053E309025313CD\r
+S21402F350012002E20020A01301200202CBFFFFEAF6\r
+S21402F360202FA0E1093200E2010253E30201531307\r
+S21402F370012002E201208203C4FFFFEA0120A0E38B\r
+S21402F380C2FFFFEA0E3404E20A0453E30020A0138D\r
+S21402F3900120A003BDFFFFEA0DC0A0E130D82DE991\r
+S21402F3A00040A0E104B04CE20F0000E246FFFFEB93\r
+S21402F3B0100014E33E3D04020050A0E1C303A00186\r
+S21402F3C01800001A603004E2C332A0E1030053E3DF\r
+S21402F3D003F19F97040000EAE8F30200F4F3020048\r
+S21402F3E0FCF3020004F402001550A0E10500A0E1BF\r
+S21402F3F030A81BE93550A0E1FBFFFFEA5550A0E11B\r
+S21402F400F9FFFFEA000050E37550A011F6FFFF1A5D\r
+S21402F4101900A0E32CFFFFEBA550A0E1020210E3C7\r
+S21402F42002518513F0FFFFEA0F0C04E24004A0E14C\r
+S21402F43025FFFFEBE2FFFFEA033301E20DC0A0E186\r
+S21402F440233DA0E1F0D82DE904B04CE20150A0E142\r
+S21402F4500040A0E1030053E303F19F97620000EA35\r
+S21402F46070F40200F4F502009CF6020048F702006F\r
+S21402F4700F32C1E3F0229FE52F30C3E3020053E1CF\r
+S21402F4805600000A0F3A01E20F0A53E3046080E2D4\r
+S21402F4900100000A0600A0E1F0A81BE9CC329FE5B5\r
+S21402F4A0CC229FE5033001E0020053E1F8FFFF0A99\r
+S21402F4B00F4801E22408A0E103FFFFEB0F0854E324\r
+S21402F4C00070A0E108708002020415E30F3C0512EA\r
+S21402F4D0A333A011FF4005127443A0113A00000A9C\r
+S21402F4E01E3605E2A33AA0E10F0053E303F19F970D\r
+S21402F4F0E7FFFFEA34F502003CF5020044F502009D\r
+S21402F5004CF5020054F502005CF5020078F50200A4\r
+S21402F51098F5020094F4020094F4020094F40200B7\r
+S21402F52094F40200ACF50200B4F50200BCF5020049\r
+S21402F530C4F50200046007E0D5FFFFEA046027E096\r
+S21402F540D3FFFFEA076064E0D1FFFFEA046067E0EA\r
+S21402F550CFFFFFEA046087E0CDFFFFEA1900A0E3D1\r
+S21402F560D9FEFFEBA00EA0E1043087E0010000E226\r
+S21402F570006083E0C6FFFFEA1900A0E3D2FEFFEBBD\r
+S21402F580073064E0A00EA0E1010000E2003083E054\r
+S21402F590016043E2BEFFFFEA1900A0E3CAFEFFEBEA\r
+S21402F5A0043067E0A00EA0E1F6FFFFEA046087E100\r
+S21402F5B0B7FFFFEA0460A0E1B5FFFFEA0460C7E117\r
+S21402F5C0B3FFFFEA0460E0E1B1FFFFEA050AA0E14B\r
+S21402F5D0200AA0E16FFFFFEB0040A0E1BFFFFFEAB9\r
+S21402F5E00F0001E2F0681BE9B7FEFFEA0000A0E3A5\r
+S21402F5F0F0A81BE97C219FE5023001E0020053E1FE\r
+S21402F6000400000A010611E30200000A0F3A01E2B2\r
+S21402F6100F0A53E30100000A040084E2F0A81BE983\r
+S21402F6200F4801E22408A0E1A7FEFFEB0F0854E30F\r
+S21402F6300070A0E108708002010415E30800000AC9\r
+S21402F640020415E30800001A020515E3053AA011A4\r
+S21402F650053AA001233AA011233AA00103708710AD\r
+S21402F66007706300000097E5F0A81BE9020515E3A2\r
+S21402F6700400000A050AA0E1200AA0E145FFFFEB0C\r
+S21402F680007087E0F6FFFFEA050AA0E1200AA0E183\r
+S21402F69040FFFFEB077060E0F1FFFFEA026411E251\r
+S21402F6A01700001A010611E3DAFFFF0A020911E346\r
+S21402F6B0D8FFFF0A0F4801E22408A0E182FEFFEB12\r
+S21402F6C00F0854E30070A0E1087080020508A0E16C\r
+S21402F6D00620A0E12008A0E10630A0E10110A0E388\r
+S21402F6E011C310E0013083E2012082120E0053E3C0\r
+S21402F6F0FAFFFFDA020515E302718710047047026B\r
+S21402F700D7FFFFEA0100A0E1C3FEFFEB000050E3D3\r
+S21402F710C0FFFF0AFF34C5E30301A0E1020515E3BB\r
+S21402F7203F038013FE3405E2002084E0FA0453E32C\r
+S21402F730086082E256FFFF1A010415E30260861390\r
+S21402F740016086E352FFFFEA033401E2030453E357\r
+S21402F750B0FFFF1A0100A0E1AFFEFFEB000050E38E\r
+S21402F7600800A013F0A81B19AAFFFFEA10FF2F013A\r
+S21402F7700000BF0F00000F01100000020118A0E1F8\r
+S21402F780213EA0E10DC0A0E1022080E2043043E267\r
+S21402F79070D82DE904B04CE20060A0E1015082E38B\r
+S21402F7A04148A0E10B0053E303F19F970F0000EAE4\r
+S21402F7B0E0F70200F0F70200F0F70200F0F70200AE\r
+S21402F7C0F0F70200F0F70200F0F702000CF8020071\r
+S21402F7D0F0F7020064F80200A8F80200CCF8020073\r
+S21402F7E038319FE5033004E0470C53E30100000A7A\r
+S21402F7F00500A0E170A81BE9780004E2A001A0E1E0\r
+S21402F80031FEFFEB0050A0E1F8FFFFEA0F3C04E2F6\r
+S21402F8100D0C53E3F5FFFF1A0D00A0E32AFEFFEBE3\r
+S21402F8200438A0E10020A0E10000A0E32318A0E134\r
+S21402F83000C0A0E1513CA0E1010013E301C08CE24C\r
+S21402F8400400801207005CE3F9FFFFDA005092E73B\r
+S21402F8506AFEFFEB000050E3E4FFFF1A015085E367\r
+S21402F860E2FFFFEA0F3C04E2030AA0E10F0250E3C4\r
+S21402F8700850A003DDFFFF0A67FEFFEB000050E31F\r
+S21402F880DAFFFF0AFF3004E2800014E38300A0E1FF\r
+S21402F890800BE011A00BE011003086E0043083E21A\r
+S21402F8A0015083E3D1FFFFEA020B14E3CFFFFF1AF6\r
+S21402F8B0843AA0E1A33AA0E1010B14E38300A0E19D\r
+S21402F8C0800AE011A00AE011F2FFFFEA020B14E33D\r
+S21402F8D0C6FFFF1A843AA0E1010B14E3A33AA0E1A3\r
+S21402F8E0F240D6E10306A0E18004E0113A3B04E2CE\r
+S21402F8F0A004E0113A0B53E3BCFFFF1A843AA0E1DE\r
+S21402F900A33AA0E1830080E1002086E0010A14E326\r
+S21402F910045082E20350C503B4FFFF0ACEFFFFEA9B\r
+S21402F92007FF00000DC0A0E170D82DE90F00A0E38C\r
+S21402F93004B04CE2E4FDFFEB0050A0E11900A0E3A6\r
+S21402F940E1FDFFEB0030A0E1200013E30500A0E19B\r
+S21402F95078609FE51000000AB010D5E186FFFFEB45\r
+S21402F960000086E5000096E5010010E30110C0E302\r
+S21402F970B020D11158309F1500309005B020C31129\r
+S21402F98050209F0550209F1550109F05003082057D\r
+S21402F990B020C1110010800570A81BE9004095E553\r
+S21402F9A028609FE50400A0E11BFEFFEB0030A0E10B\r
+S21402F9B00410A0E1000053E3044085E20500A0E144\r
+S21402F9C000408605E6FFFF0A9AFEFFEBE3FFFFEA2A\r
+S21402F9D0183203008C6F0300886F0300BEBEFFFF61\r
+S21402F9E0FEDEFFE738309FE5001093E5000051E3A6\r
+S21402F9F00EF0A001010011E328309F1528309F0564\r
+S21402FA00B030D3110120C1E300209305B030C211FB\r
+S21402FA100C309FE5002081050020A0E3002083E54E\r
+S21402FA200EF0A0E1183203008C6F0300886F03000B\r
+S21402FA300EF0A0E10EF0A0E10DC0A0E100D82DE985\r
+S21402FA400F00A0E304B04CE29FFDFFEB0C309FE5F5\r
+S21402FA50030050E10000A0130100A00300A81BE968\r
+S21402FA60B08E02000DC0A0E110D82DE90F00A0E371\r
+S21402FA7004B04CE294FDFFEB0040A0E11900A0E3C5\r
+S21402FA8091FDFFEB200010E3024084120440840242\r
+S21402FA900410A0E10F00A0E310681BE99AFDFFEA3C\r
+S21402FAA00DC0A0E100D82DE964109FE50020A0E378\r
+S21402FAB0003091E504B04CE2000053E354309FE579\r
+S21402FAC0002083E500A81B19010010E30A00000AC3\r
+S21402FAD0000081E50100C0E3B030D0E1B430C1E1FE\r
+S21402FAE034309FE5B030C0E10300A0E329ECFFEB21\r
+S21402FAF00300A0E300681BE924ECFFEA000081E5AE\r
+S21402FB00002090E514309FE5042081E5003080E572\r
+S21402FB10F4FFFFEA906F03001C320300BEBEFFFF35\r
+S21402FB20FEDEFFE70DC0A0E100D82DE968309FE5B4\r
+S21402FB300010A0E3003093E504B04CE2010053E16C\r
+S21402FB4058C09FE50400001A00209CE50310A0E1BF\r
+S21402FB500130C2E3030050E10100000A0100A0E107\r
+S21402FB6000A81BE9010012E304309C05B4C0DC11B6\r
+S21402FB700030800524309FE50020A0E3B0C0C0110D\r
+S21402FB80002083E50300A0E302ECFFEB0300A0E302\r
+S21402FB90FEEBFFEB0110A0E3EFFFFFEA1C320300CF\r
+S21402FBA0906F03000DC0A0E130D82DE97C509FE590\r
+S21402FBB07C309FE5001095E50020A0E3000051E3AD\r
+S21402FBC00040A0E104B04CE2002083E50100A0E181\r
+S21402FBD00300000AD2FFFFEB001095E5000051E398\r
+S21402FBE030A81B191900A0E337FDFFEB013084E3B0\r
+S21402FBF0200010E300308515B030D4110040850592\r
+S21402FC00B430C5110020940528309F1528309F0572\r
+S21402FC1004208505B030C411003084050300A0E33B\r
+S21402FC20DCEBFFEB0300A0E330681BE9D7EBFFEA4F\r
+S21402FC30906F03001C320300BEBEFFFFFEDEFFE72E\r
+S21402FC400C309FE5000093E5000050E20100A0138F\r
+S21402FC500EF0A0E1906F03000DC0A0E1F0D92DE9EF\r
+S21402FC600000A0E304B04CE214D04DE216FDFFEB18\r
+S21402FC700040A0E10100A0E313FDFFEB0070A0E14D\r
+S21402FC800200A0E310FDFFEB0060A0E10300A0E38A\r
+S21402FC900DFDFFEB0050A0E10D00A0E30AFDFFEB17\r
+S21402FCA00030A0E11900A0E3048093E506FDFFEB17\r
+S21402FCB00030A0E11F3003E2130053E30C00A0E380\r
+S21402FCC00E00A01300FDFFEB0010A0E10F00A0E362\r
+S21402FCD00DFDFFEBFA0F54E30710A0E10620A0E1AA\r
+S21402FCE00530A0E10400A0E102C0A0E30900000A7A\r
+S21402FCF024C04BE228404BE200118DE808408DE517\r
+S21402FD00350200EB0030A0E10000A0E3000053E162\r
+S21402FD1005C0A0030100001A0C00A0E1F0A91BE92F\r
+S21402FD2024101BE5F8FCFFEB28C01BE5F9FFFFEAF1\r
+S21402FD30001090E50030A0E3303081E51A20A0E301\r
+S21402FD40033083E2242081E5283081E50C309FE5EC\r
+S21402FD50562082E22C2081E5303081E50EF0A0E1CB\r
+S21402FD6001030000000090E5FF1001E2183090E564\r
+S21402FD70200013E3FCFFFF1A0A0051E3001080E59F\r
+S21402FD800EF0A011183090E5200013E30D30A0030A\r
+S21402FD90003080050EF0A001F9FFFFEA003090E582\r
+S21402FDA06400A0E3010050E2182093E50EF0A001E3\r
+S21402FDB0100012E3FAFFFF1A003093E50100A0E3F9\r
+S21402FDC00030C1E50EF0A0E10DC0A0E130D82DE96B\r
+S21402FDD004B04CE204D04DE20040A0E115504BE2E4\r
+S21402FDE00400A0E10510A0E1EBFFFFEB000050E3EA\r
+S21402FDF015005B1530A81B19F8FFFFEA0DC0A0E13D\r
+S21402FE00000052E370D82DE904B04CE20060A0E195\r
+S21402FE100150A0E1014042E270A81B090110D5E49E\r
+S21402FE200600A0E1FF1001E2CDFFFFEB000054E365\r
+S21402FE30014044E270A81B09F7FFFFEA0DC0A0E1EB\r
+S21402FE40000052E370D82DE904B04CE20060A0E155\r
+S21402FE500150A0E1014042E270A81B090600A0E1A1\r
+S21402FE60D8FFFFEB000054E30100C5E4014044E282\r
+S21402FE7070A81B09F8FFFFEA0DC0A0E1F0D82DE933\r
+S21402FE80043090E550709FE5033183E004B04CE205\r
+S21402FE900060A0E10150A0E18340A0E10510A0E1CE\r
+S21402FEA00600A0E1BCFFFFEB0030A0E1000053E338\r
+S21402FEB06400A0E3014044E20500001A010074E376\r
+S21402FEC00300000A483097E50FE0A0E103F0A0E146\r
+S21402FED0F1FFFFEA0300A0E1F0A81BE950000000D2\r
+S21402FEE00DC0A0E10E002DE910D82DE910B04CE2AD\r
+S21402FEF004309BE50040A0E3043043E2030053E3F2\r
+S21402FF0003F19F970B0000EA40FF020018FF020071\r
+S21402FF1064FF02006CFF0200001090E558309FE577\r
+S21402FF2050C0A0E30120A0E3002083E538C081E5AD\r
+S21402FF30080090E54DE4FFEB0400A0E110A81BE9E1\r
+S21402FF4034209FE5001090E50030A0E3004092E5E3\r
+S21402FF50003082E5383081E5080090E538E4FFEBB2\r
+S21402FF60F4FFFFEA084090E5F2FFFFEA08309BE55F\r
+S21402FF70044090E5043080E5EEFFFFEA38320300E5\r
+S21402FF800DC0A0E1F0D82DE904B04CE204D04DE259\r
+S21402FF900040A0E1080090E50170A0E10160A0E346\r
+S21402FFA0990000EB4231A0E3006083E5004094E54F\r
+S21402FFB00050A0E3005087E5183094E51C004BE2A1\r
+S21402FFC0100013E30610A0E10100000A0500A0E1FC\r
+S21402FFD0F0A81BE9003094E50650A0E1013060E588\r
+S21402FFE04AEDFFEB000050E300608715F6FFFFEADC\r
+S21402FFF00DC0A0E1F0DF2DE9E0509FE504B04CE231\r
+S21403000004D04DE20000E0E3343095E50FE0A0E1D4\r
+S21403001003F0A0E1C8409FE52C000BE5080094E53B\r
+S21403002007E4FFEB140094E505E4FFEB0400A0E10E\r
+S2140300303EFFFFEBAC009FE53CFFFFEB343095E55E\r
+S2140300400000A0E30FE0A0E103F0A0E1143095E583\r
+S21403005094209FE5004083E590609FE5042083E5B8\r
+S2140300608C709FE58C809FE58CA09FE58C909FE528\r
+S2140300708C209FE50100A0E3082083E50C6083E560\r
+S214030080107083E5148083E518A083E51C9083E550\r
+S214030090342095E50FE0A0E102F0A0E1143095E5E9\r
+S2140300A040209FE52C001BE5002083E538209FE5D4\r
+S2140300B0042083E548209FE5082083E50C6083E55C\r
+S2140300C0107083E5148083E518A083E51C9083E510\r
+S2140300D0342095E50FE0A0E102F0A0E1F0AF1BE9C4\r
+S2140300E050000000203203002C320300FCFD020007\r
+S2140300F064FD0200C8FD0200E0FE020080FF02006D\r
+S21403010078FE02003CFE020004E02DE518209FE581\r
+S214030110003092E5000053E304F09D140130A0E3A1\r
+S214030120003082E504E09DE4B0FFFFEA3C320300C2\r
+S21403013004E02DE50CC09DE500E0A0E308308CE567\r
+S21403014004309DE500008CE50C308CE508309DE519\r
+S21403015004108CE510208CE514E08CE518E08CE5A3\r
+S21403016000C083E504F09DE40DC0A0E110D82DE99E\r
+S2140301700040A0E1041094E5000090E504B04CE2D2\r
+S214030180C6E3FFEB001094E534009FE534309FE5AB\r
+S214030190012190E7030052E110A81B19083094E5EB\r
+S2140301A0013180E7000094E5102094E518309FE5C0\r
+S2140301B0002183E7001094E510309FE5014183E7B3\r
+S2140301C010A81BE9C42D030098B50200C82E03002F\r
+S2140301D0CC2F03000DC0A0E130D82DE904B04CE2CB\r
+S2140301E000500FE100400FE1C04084E304F029E132\r
+S2140301F09EE3FFEB00300FE1C04005E2C030C3E3EF\r
+S214030200043083E103F029E130A81BE904E02DE57F\r
+S21403021004E09DE4A0E3FFEA0EF0A0E10DC0A0E138\r
+S21403022070D82DE904B04CE268C09FE50040A0E317\r
+S2140302300130A0E360009CE85C209FE5035095E056\r
+S214030240001092E50460A6E01C00A0E360008CE8C2\r
+S21403025030E3FFEB1C00A0E3EBFFFFEB3C309FE536\r
+S2140302600010A0E3002093E5010052E10700000A16\r
+S2140302702C309FE50100A0E1003093E5010053E137\r
+S214030280341093153C0093150FE0A0E102F0A0E1B3\r
+S2140302900100A0E370A81BE9883203009032030034\r
+S2140302A094320300E08203000DC0A0E110D82DE9CC\r
+S2140302B048309FE50CD04DE204B04CE240409FE549\r
+S2140302C0000093E501E3FFEB0010A0E334C09FE5D5\r
+S2140302D034E09FE534309FE50120A0E11C00A0E355\r
+S2140302E000C08DE510408DE990FFFFEB000094E51C\r
+S2140302F09CFFFFEB1C00A0E310681BE9B4FFFFEABA\r
+S21403030090320300986F0300180203009C6F0300EB\r
+S2140303101C0203000DC0A0E1F0D82DE90040A0E3C5\r
+S214030320020054E104B04CE20250A0E10160A0E1F7\r
+S214030330120000AA4C709FE5143097E5000053E3C3\r
+S21403034018309705000093E5103093E50FE0A0E121\r
+S21403035003F0A0E1FF0000E20D0050E30A00501393\r
+S214030360042086000030A0030400C6E70130C2055F\r
+S2140303700200000A014084E2050054E1EDFFFFBAE3\r
+S2140303800400A0E1F0A81BE9500000000DC0A0E1A6\r
+S214030390000052E370D82DE904B04CE20260A0E1FD\r
+S2140303A00140A0E10250A0E1130000DA0010D4E5FA\r
+S2140303B09C009FE50A0051E30D20A0E31900000A04\r
+S2140303C08C009FE5FF2001E2143090E50210A0E1C7\r
+S2140303D0000053E3183090050210A001000093E5D7\r
+S2140303E0015045E20C3093E50FE0A0E103F0A0E1F5\r
+S2140303F0000055E3014084E2EBFFFFCA50209FE56F\r
+S2140304000810A0E3143092E5000053E31830920579\r
+S214030410000093E5143093E50FE0A0E103F0A0E1BC\r
+S2140304200600A0E170A81BE9143090E50210A0E1D5\r
+S214030430000053E3183090050210A001000093E576\r
+S2140304400C3093E50FE0A0E103F0A0E10010D4E543\r
+S214030450DAFFFFEA500000000400E0E30EF0A0E13C\r
+S2140304600000A0E30EF0A0E10400E0E30EF0A0E13C\r
+S2140304700DC0A0E170D82DE96C209FE504B04CE2D6\r
+S214030480003092E50060A0E1000053E31200000A8A\r
+S214030490000056E30E00000A50309FE550C09FE56B\r
+S2140304A0030093E800209CE501E2A0E1205E8EE1D4\r
+S2140304B00042A0E1004054E00150C5E005C1A0E1C0\r
+S2140304C00030A0E3241F8CE10401A0E1E70000EB69\r
+S2140304D0000086E50000A0E370A81BE90130A0E356\r
+S2140304E0003082E56FFFFFEBE8FFFFEA9C32030074\r
+S2140304F0883203009832030004E02DE51C209FE5B4\r
+S214030500000051E314209F0500309215000082E599\r
+S2140305100000A0E30030811504E09DE4D3FFFFEA6A\r
+S214030520943203000DC0A0E1F0DF2DE90060A0E1E6\r
+S21403053004B04CE20000A0E30170A0E1CBFFFFEBA8\r
+S214030540020076E3FA6FA0031700000A000056E3E2\r
+S2140305500030A0D30130A0C358309F05FA6FA0E344\r
+S214030560006093051000000A000053E348A09FE5CF\r
+S2140305700090A0E3FA8FA0E338C09FE50A00000AC4\r
+S21403058030009AE834009FE534109FE500209CE590\r
+S214030590000081E5940881E00030A0E3951821E08F\r
+S2140305A000608CE5B10000EB03008AE8000057E327\r
+S2140305B000608715F0AF1BE998320300883203000A\r
+S2140305C0C05D00009032030008309FE50020A0E3E2\r
+S2140305D0002083E50EF0A0E1943203000DC0A0E1F5\r
+S2140305E030D82DE904B04CE20CC09BE50040A0E3F4\r
+S2140305F0110050E302E0A0E10150A0E10320A0E1D6\r
+S21403060000408CE55A00000A3C00008A050050E3CF\r
+S2140306103600000A2300008A020050E31D00000A89\r
+S2140306201000008A010050E30100000A0000A0E366\r
+S21403063030A81BE90030E0E3B4219FE500308CE5E9\r
+S214030640003092E50140A0E1000053E30530A0131B\r
+S2140306500040A01100308C1508309BE50100A0E394\r
+S214030660004083E530A81BE9030050E30600000AB8\r
+S214030670040050E3ECFFFF1A0100A0E10E10A0E116\r
+S21403068023FFFFEB0040A0E1F2FFFFEA0100A0E139\r
+S21403069072FFFFEBFAFFFFEA0100A0E10E10A0E1F4\r
+S2140306A06CFFFFEBF6FFFFEA070050E30400000AC7\r
+S2140306B00A00003A0A0050E30300000A0F0050E362\r
+S2140306C0D9FFFF1A5740E0E3E2FFFFEA013AA0E34F\r
+S2140306D0022AA0E32C308EE504208EE5DDFFFFEA38\r
+S2140306E00100A0E10E10A0E15EFFFFEBE4FFFFEACE\r
+S2140306F00100A0E10E10A0E123FFFFEBE0FFFFEAFD\r
+S214030700F0309FE5030050E13500000A1B00008A25\r
+S214030710140050E31600000A0200008A130050E398\r
+S214030720CCFFFF0AC0FFFFEACC309FE5030050E191\r
+S2140307300600000AFA3F83E2030050E1BAFFFF1AFD\r
+S2140307400100A0E10E10A0E16AFFFFEBC1FFFFEA84\r
+S214030750A8309FE5A8209FE5001093E5003092E5BA\r
+S2140307600140A0E3013063E0003085E500108EE52C\r
+S214030770B8FFFFEA0500A0E13CFFFFEBC0FFFFEA7E\r
+S21403078080309FE5030050E11300000A0700008A4B\r
+S21403079074309FE5030050E10200000A6C309FE5C9\r
+S2140307A0030050E1C5FFFFEA86FFFFEBA9FFFFEA60\r
+S2140307B05C309FE5030050E10500000A54309FE5D6\r
+S2140307C0030050E198FFFF1A4C309FE5003081E5A7\r
+S2140307D0A0FFFFEA0040E0E39EFFFFEA0140A0E33C\r
+S2140307E09CFFFFEA0100A0E10E10A0E14CFFFFEB27\r
+S2140307F098FFFFEAC0840300D2070000E903000065\r
+S2140308004083030000840300BA0B0000D3070000F4\r
+S214030810B90B0000BB0B0000ADBA0000403203006A\r
+S214030820000052E370402DE920C062E20140A0E1DF\r
+S2140308300030A0E10060A0E30050A0E30800000A37\r
+S21403084000005CE33032A0E100E06CE2C16FA0D1AF\r
+S214030850515EA0D15162A0C1115C83C10640A0E1E4\r
+S2140308600530A0E10410A0E10300A0E17080BDE81C\r
+S2140308700DC0A0E100D82DE904B04CE204D04DE24F\r
+S21403088000C0A0E300C08DE5000000EB00A81BE954\r
+S2140308900DC0A0E1F0DF2DE904B04CE20060A0E358\r
+S2140308A00050A0E330C04BE230D04DE2004053E2AC\r
+S2140308B00090A0E160008CE860000CE90260A0E113\r
+S2140308C00150A0E1D700001A010052E15400009A3B\r
+S2140308D0010852E30210A0E14D00002AFF0052E394\r
+S2140308E00800A0830000A093A8259FE53110A0E18F\r
+S2140308F00130D2E7003083E0203073E240300BE56E\r
+S2140309000500000A40201BE5203063E23933A0E1EE\r
+S214030910155283E11662A0E11992A0E12678A0E1C0\r
+S2140309200710A0E10500A0E10E0300EB0710A0E10D\r
+S2140309300040A0E10500A0E1E40200EB06A8A0E168\r
+S2140309402AA8A0E19A0002E02938A0E1044883E13E\r
+S214030950020054E10080A0E10500002A064094E06E\r
+S214030960018040E20200002A020054E1018048327E\r
+S21403097006408430044062E00710A0E10400A0E1D2\r
+S214030980F80200EB0710A0E10050A0E10400A0E18C\r
+S214030990CE0200EB9A0002E00938A0E12338A0E17A\r
+S2140309A0055883E1020055E10500002A065095E04C\r
+S2140309B0010040E20200002A020055E1065085309D\r
+S2140309C00100403208C880E1059062E000A0A0E381\r
+S2140309D004309BE5000053E30800000A40401BE593\r
+S2140309E00050A0E33994A0E138900BE534500BE5B2\r
+S2140309F030204BE20C0012E904409BE50C0084E82F\r
+S214030A0030C00BE52CA00BE530604BE2030096E804\r
+S214030A10F0AF1BE9010452E31800A0231000A03333\r
+S214030A20B0FFFFEA000052E30300001A0210A0E141\r
+S214030A300100A0E3A50200EB0060A0E1010856E375\r
+S214030A407400002AFF0056E30800A0830000A0936A\r
+S214030A5040249FE53610A0E10130D2E7003083E062\r
+S214030A60203073E240300BE50550660001A0A0037A\r
+S214030A702688A0013800000A40401BE540301BE5ED\r
+S214030A801664A0E1203063E235A3A0E12688A0E146\r
+S214030A9006C8A0E12CC8A0E13C300BE50A00A0E1A3\r
+S214030AA03933A0E10810A0E1155483E148C00BE5F3\r
+S214030AB0AC0200EB0810A0E10070A0E10A00A0E180\r
+S214030AC0820200EB48201BE52538A0E1900202E0F5\r
+S214030AD0077883E1020057E100A0A0E11994A0E1A2\r
+S214030AE044800BE50500002A067097E001A040E26B\r
+S214030AF00200002A020057E101A04A32067087303E\r
+S214030B00077062E044101BE50700A0E1950200EBC6\r
+S214030B1044101BE50040A0E10700A0E16B0200EBD8\r
+S214030B2048201BE50538A0E1900202E02338A0E147\r
+S214030B30044883E1020054E10500002A064094E0DD\r
+S214030B40010040E20200002A020054E101004032A4\r
+S214030B50064084300AA880E1045062E00628A0E13B\r
+S214030B602228A0E10810A0E10500A0E14C200BE537\r
+S214030B707C0200EB0810A0E10040A0E10500A0E124\r
+S214030B80520200EB4C201BE52938A0E1900202E05C\r
+S214030B90044883E1020054E10070A0E10500002A46\r
+S214030BA0064094E0017040E20200002A020054E18D\r
+S214030BB00170473206408430044062E00810A0E12A\r
+S214030BC00400A0E1670200EB0810A0E10050A0E1DA\r
+S214030BD00400A0E13D0200EB4C201BE50938A0E130\r
+S214030BE0900202E02338A0E1055883E1020055E1B4\r
+S214030BF00500002A065095E0010040E20200002AA4\r
+S214030C00020055E1065085300100403207C880E1F6\r
+S214030C10059062E06DFFFFEA010456E31800A02387\r
+S214030C201000A03389FFFFEA010054E10A00009A8E\r
+S214030C3004309BE500A0A0E3000053E30AC0A0E154\r
+S214030C406EFFFF0A38000BE534100BE530404BE22D\r
+S214030C50300014E9300083E868FFFFEA010854E334\r
+S214030C608800002AFF0054E30800A0830000A09336\r
+S214030C7020229FE53410A0E10130D2E7003083E064\r
+S214030C80203073E240300BE51200001A040055E1F1\r
+S214030C900600599140C01B350300003A06C059E0D0\r
+S214030CA00450C5E00C90A0E101C0A0E304209BE53E\r
+S214030CB000A0A0E3000052E350FFFF0A34500BE508\r
+S214030CC038900BE530304BE2180013E90250A0E1F0\r
+S214030CD0180082E849FFFFEA40C01BE540201BE5F9\r
+S214030CE020C06CE2363CA0E1144283E12438A0E144\r
+S214030CF035ACA0E150300BE53CC00BE5393CA0E138\r
+S214030D0004C8A0E12CC8A0E10A00A0E150101BE52E\r
+S214030D10155283E154C00BE5120200EB50101BE59D\r
+S214030D200080A0E10A00A0E1E80100EB54201BE5E7\r
+S214030D3000A0A0E1920A0AE02538A0E1088883E132\r
+S214030D4040301BE50A0058E158000BE51663A0E1A6\r
+S214030D501993A0E10700002A01C040E2048098E04E\r
+S214030D6058C00BE50300002A0A0058E101C04C32C4\r
+S214030D7058C00B350480883008806AE050101BE5A5\r
+S214030D800800A0E1F70100EB50101BE50070A0E19E\r
+S214030D900800A0E1CD0100EB54A01BE50538A0E157\r
+S214030DA0900A0AE02338A0E1077883E10A0057E1B6\r
+S214030DB00500002A047097E0010040E20200002AC2\r
+S214030DC00A0057E1010040320470873058201BE5C3\r
+S214030DD007706AE002C880E12C18A0E12608A0E1AB\r
+S214030DE00128CCE10038C6E192030EE0910303E04C\r
+S214030DF0900202E0910000E0022093E001088022C6\r
+S214030E0002E89EE02208A0E0070050E10600008A00\r
+S214030E100030A0130130A00309005EE10030A09368\r
+S214030E2001300382000053E30300000A06305EE04D\r
+S214030E300400C0E003E0A0E101C04CE204409BE5EF\r
+S214030E4000A0A0E3000054E3ECFEFF0A40201BE5ED\r
+S214030E500E6059E00050C7E03C401BE53632A0E187\r
+S214030E60153483E13552A0E134500BE538300BE5F9\r
+S214030E7030504BE20690A0E104209BE5600015E9A4\r
+S214030E80600082E8DDFEFFEA010454E31800A023B5\r
+S214030E901000A03375FFFFEAC02C03000DC0A0E1CD\r
+S214030EA000D82DE904B04CE20CD04DE214C04BE25E\r
+S214030EB000C08DE5020000EB10304BE2030013E8A0\r
+S214030EC000A81BE90DC0A0E1F0DF2DE904B04CE259\r
+S214030ED00060A0E30050A0E330C04BE230D04DE208\r
+S214030EE0004053E20090A0E160008CE860000CE94B\r
+S214030EF00260A0E10150A0E1D700001A010052E110\r
+S214030F005400009A010852E30210A0E14D00002AA3\r
+S214030F10FF0052E30800A0830000A093A8259FE5E6\r
+S214030F203110A0E10130D2E7003083E0203073E2D5\r
+S214030F3040300BE50500000A40201BE5203063E245\r
+S214030F403933A0E1155283E11662A0E11992A0E1BC\r
+S214030F502678A0E10710A0E10500A0E1810100EBDF\r
+S214030F600710A0E10040A0E10500A0E1570100EB57\r
+S214030F7006A8A0E12AA8A0E19A0002E02938A0E189\r
+S214030F80044883E1020054E10080A0E10500002A42\r
+S214030F90064094E0018040E20200002A020054E189\r
+S214030FA00180483206408430044062E00710A0E126\r
+S214030FB00400A0E16B0100EB0710A0E10050A0E1E4\r
+S214030FC00400A0E1410100EB9A0002E00938A0E129\r
+S214030FD02338A0E1055883E1020055E10500002A05\r
+S214030FE0065095E0010040E20200002A020055E1A7\r
+S214030FF0065085300100403208C880E1059062E063\r
+S21403100000A0A0E304309BE5000053E30800000AB9\r
+S21403101040401BE50050A0E33994A0E138900BE56F\r
+S21403102034500BE530204BE20C0012E904409BE5FC\r
+S2140310300C0084E830C00BE52CA00BE530604BE2D7\r
+S214031040030096E8F0AF1BE9010452E31800A0235F\r
+S2140310501000A033B0FFFFEA000052E30300001ABB\r
+S2140310600210A0E10100A0E3180100EB0060A0E17C\r
+S214031070010856E37400002AFF0056E30800A08325\r
+S2140310800000A09340249FE53610A0E10130D2E78C\r
+S214031090003083E0203073E240300BE505506600F5\r
+S2140310A001A0A0032688A0013800000A40401BE5E3\r
+S2140310B040301BE51664A0E1203063E235A3A0E1CF\r
+S2140310C02688A0E106C8A0E12CC8A0E13C300BE5C9\r
+S2140310D00A00A0E13933A0E10810A0E1155483E12A\r
+S2140310E048C00BE51F0100EB0810A0E10070A0E16B\r
+S2140310F00A00A0E1F50000EB48201BE52538A0E137\r
+S214031100900202E0077883E1020057E100A0A0E125\r
+S2140311101994A0E144800BE50500002A067097E0C9\r
+S21403112001A040E20200002A020057E101A04A3271\r
+S21403113006708730077062E044101BE50700A0E1E5\r
+S214031140080100EB44101BE50040A0E10700A0E106\r
+S214031150DE0000EB48201BE50538A0E1900202E024\r
+S2140311602338A0E1044883E1020054E10500002A85\r
+S214031170064094E0010040E20200002A020054E127\r
+S21403118001004032064084300AA880E1045062E041\r
+S2140311900628A0E12228A0E10810A0E10500A0E1AE\r
+S2140311A04C200BE5EF0000EB0810A0E10040A0E1A7\r
+S2140311B00500A0E1C50000EB4C201BE52938A0E1A3\r
+S2140311C0900202E0044883E1020054E10070A0E1CB\r
+S2140311D00500002A064094E0017040E20200002A5F\r
+S2140311E0020054E10170473206408430044062E056\r
+S2140311F00810A0E10400A0E1DA0000EB0810A0E16B\r
+S2140312000050A0E10400A0E1B00000EB4C201BE579\r
+S2140312100938A0E1900202E02338A0E1055883E1F3\r
+S214031220020055E10500002A065095E0010040E261\r
+S2140312300200002A020055E10650853001004032C4\r
+S21403124007C880E1059062E06DFFFFEA010456E3FC\r
+S2140312501800A0231000A03389FFFFEA010054E121\r
+S2140312600A00009A04309BE500A0A0E3000053E3C5\r
+S2140312700AC0A0E16EFFFF0A38000BE534100BE549\r
+S21403128030404BE2300014E9300083E868FFFFEAA1\r
+S214031290010854E38800002AFF0054E30800A083F3\r
+S2140312A00000A09320229FE53410A0E10130D2E78E\r
+S2140312B0003083E0203073E240300BE51200001A62\r
+S2140312C0040055E10600599140C01B350300003A5F\r
+S2140312D006C059E00450C5E00C90A0E101C0A0E3AD\r
+S2140312E004209BE500A0A0E3000052E350FFFF0AA2\r
+S2140312F034500BE538900BE530304BE2180013E919\r
+S2140313000250A0E1180082E849FFFFEA40C01BE54F\r
+S21403131040201BE520C06CE2363CA0E1144283E18A\r
+S2140313202438A0E135ACA0E150300BE53CC00BE51A\r
+S214031330393CA0E104C8A0E12CC8A0E10A00A0E162\r
+S21403134050101BE5155283E154C00BE5850000EBF6\r
+S21403135050101BE50080A0E10A00A0E15B0000EB53\r
+S21403136054201BE500A0A0E1920A0AE02538A0E17C\r
+S214031370088883E140301BE50A0058E158000BE576\r
+S2140313801663A0E11993A0E10700002A01C040E21A\r
+S214031390048098E058C00BE50300002A0A0058E1D1\r
+S2140313A001C04C3258C00B350480883008806AE090\r
+S2140313B050101BE50800A0E16A0000EB50101BE587\r
+S2140313C00070A0E10800A0E1400000EB54A01BE57C\r
+S2140313D00538A0E1900A0AE02338A0E1077883E104\r
+S2140313E00A0057E10500002A047097E0010040E276\r
+S2140313F00200002A0A0057E10100403204708730D9\r
+S21403140058201BE507706AE002C880E12C18A0E1AB\r
+S2140314102608A0E10128CCE10038C6E192030EE0DD\r
+S214031420910303E0900202E0910000E0022093E0C3\r
+S2140314300108802202E89EE02208A0E0070050E1AF\r
+S2140314400600008A0030A0130130A00309005EE105\r
+S2140314500030A09301300382000053E30300000A28\r
+S21403146006305EE00400C0E003E0A0E101C04CE209\r
+S21403147004409BE500A0A0E3000054E3ECFEFF0A53\r
+S21403148040201BE50E6059E00050C7E03C401BE5DA\r
+S2140314903632A0E1153483E13552A0E134500BE532\r
+S2140314A038300BE530504BE20690A0E104209BE574\r
+S2140314B0600015E9600082E8DDFEFFEA010454E3FC\r
+S2140314C01800A0231000A03375FFFFEAC02C03000A\r
+S2140314D0000051E31F00000A0130A0E30020A0E350\r
+S2140314E0010050E11900003A010251E300005131B6\r
+S2140314F00112A0310332A031FAFFFF3A020151E391\r
+S214031500000051318110A0318330A031FAFFFF3A39\r
+S214031510010050E10100402003208221A10050E198\r
+S214031520A1004020A3208221210150E12101402077\r
+S21403153023218221A10150E1A1014020A321822180\r
+S214031540000050E32332B0112112A011EFFFFF1A5F\r
+S2140315500200A0E10EF0A0E104E02DE5310000EB6F\r
+S2140315600000A0E30080BDE8000051E32900000A64\r
+S214031570010051E3010050110000A0030EF0A0315A\r
+S2140315800130A0E3010251E3000051310112A03102\r
+S2140315900332A031FAFFFF3A020151E30000513152\r
+S2140315A08110A0318330A031FAFFFF3A0020A0E378\r
+S2140315B0010050E101004020A10050E1A1004020BD\r
+S2140315C0E3208221210150E1210140206321822171\r
+S2140315D0A10150E1A1014020E321822103C0A0E143\r
+S2140315E0000050E32332B0112112A011EEFFFF1AC0\r
+S2140315F00E2212E207001C130500000AEC0112E19A\r
+S214031600A10180106C0112E121018010EC0012E1AF\r
+S214031610A10080100EF0A0E104E02DE5010000EB30\r
+S2100316200000A0E30080BDE80EF0A0E18F\r
+S21403162C6C6F6164000000004C6F6164206120667F\r
+S21403163C696C6500492F4F206572726F723A2025CC\r
+S21403164C730A00002563080043616E2774206C6FD1\r
+S21403165C616420272573273A2025730A00000000AF\r
+S21403166C43616E2774207265616420454C4620687E\r
+S21403167C65616465720A00004F6E6C792061627353\r
+S21403168C6F6C75746520454C4620696D6167657390\r
+S21403169C20737570706F727465640A00456E74728D\r
+S2140316AC7920706F696E743A2025702C20616464FF\r
+S2140316BC726573732072616E67653A2025702D25EB\r
+S2140316CC700A000041646472657373206F666673F8\r
+S2140316DC6574203D2025700A0000000053686F7265\r
+S2140316EC7420646174612072656164696E67204559\r
+S2140316FC4C462066696C65002A2A2A2041626F7262\r
+S21403170C742120417474656D707420746F206C6F33\r
+S21403171C616420454C46206461746120746F2061BB\r
+S21403172C6464726573733A202570207768696368FE\r
+S21403173C206973206E6F7420696E2052414D0A0027\r
+S21403174C43616E2774206C6F616420454C4620669B\r
+S21403175C696C65202D2070726F6772616D206865E9\r
+S21403176C6164657273206F7574206F66206F726484\r
+S21403177C65720A0043616E277420726561642045A6\r
+S21403178C4C462070726F6772616D20686561646584\r
+S21403179C720A0000546F6F206D616E792070726F41\r
+S2140317AC6772616D20686561646572730A00000078\r
+S2140317BC2A2A2A205761726E696E67212043686550\r
+S2140317CC636B73756D206661696C757265202D206D\r
+S2140317DC416464723A20256C782C202530326C5880\r
+S2140317EC203C3E202530326C580A00002A2A2A2038\r
+S2140317FC41626F72742120417474656D7074207429\r
+S21403180C6F206C6F616420532D7265636F72642056\r
+S21403181C746F20616464726573733A2025702C2090\r
+S21403182C7768696368206973206E6F7420696E200D\r
+S21403183C52414D0A00000000496E76616C696420C3\r
+S21403184C532D7265636F7264206174206F666673C2\r
+S21403185C6574203078256C782C20747970653A2062\r
+S21403186C25780A0042616420532D7265636F726497\r
+S21403187C20636F756E74206174206F66667365746F\r
+S21403188C2025700A00000000496E76616C6964209E\r
+S21403189C532D7265636F7264206174206F66667372\r
+S2140318AC65742025702C20696E7075743A20256338\r
+S2140318BC0A000000766572626F7365006C6F616474\r
+S2140318CC2072617720646174610000006C6F616440\r
+S2140318DC206164647265737300000000646F776E36\r
+S2140318EC6C6F6164206D6F64652028544654502CCD\r
+S2140318FC2078797A4D4F44454D2C206F72206469BD\r
+S21403190C736B290066696C65206E616D650000005B\r
+S21403191C454C4600556E7265636F676E697A6564EF\r
+S21403192C20696D61676520747970653A2030782577\r
+S21403193C6C780A002A2A2A2041626F72742120527C\r
+S21403194C41572064617461207370696C6C73206FEB\r
+S21403195C766572206C696D6974206F662075736585\r
+S21403196C722052414D2061742025700A000000003D\r
+S21403197C5261772066696C65206C6F6164656420C0\r
+S21403198C25702D25702C20617373756D6564206529\r
+S21403199C6E7472792061742025700A005261772068\r
+S2140319AC6C6F616420726571756972657320612052\r
+S2140319BC6D656D6F727920616464726573730A006A\r
+S2140319CC53706563696669656420616464726573E4\r
+S2140319DC732028257029206973206E6F7420626526\r
+S2140319EC6C696576656420746F20626520696E2069\r
+S2140319FC52414D0046696C65206E616D65207265BB\r
+S214031A0C7175697265640A0075736167653A206C53\r
+S214031A1C6F61642025730A00496E76616C696420D5\r
+S214031A2C276D6F6465273A2025732E202056616C2C\r
+S214031A3C6964206D6F646573206172653A000000FB\r
+S214031A4C4E6F2064656661756C742070726F746F6C\r
+S214031A5C636F6C210A00000043524300436B73759B\r
+S214031A6C6D00000078797A4D6F64656D202D202506\r
+S214031A7C73206D6F64652C20256428534F48292FDB\r
+S214031A8C256428535458292F25642843414E29206E\r
+S214031A9C7061636B6574732C202564207265747295\r
+S214031AAC6965730A0000000043616E277420616346\r
+S214031ABC636573732066696C65000000556E6B6E08\r
+S214031ACC6F776E206572726F72000000426C6F63E4\r
+S214031ADC6B2073657175656E6365206572726F72C4\r
+S214031AEC000000004352432F636865636B73756D88\r
+S214031AFC206572726F720000496E76616C696420A1\r
+S214031B0C6672616D696E670043616E63656C6C65C6\r
+S214031B1C64000000456E64206F662066696C650081\r
+S214031B2C54696D6564206F7574000000536F727290\r
+S214031B3C792C207A4D6F64656D206E6F74206176F8\r
+S214031B4C61696C61626C652079657400786D6F648D\r
+S214031B5C656D0000796D6F64656D00000000000014\r
+S214031B6C75736167653A20636B73756D202D622000\r
+S214031B7C3C616464723E202D6C203C6C656E67740D\r
+S214031B8C683E0A00436F6D707574696E6720636BED\r
+S214031B9C73756D20666F7220617265612025702DDA\r
+S214031BAC25700A00504F53495820636B73756D208C\r
+S214031BBC3D20256C7520256C75202830782530380B\r
+S214031BCC6C782030782530386C78290A00000000B1\r
+S214031BDC636B73756D000000436F6D7075746520D1\r
+S214031BEC6120333262697420636865636B73756D49\r
+S214031BFC205B504F53495820616C676F7269746849\r
+S214031C0C6D5D20666F7220612072616E6765206F52\r
+S214031C1C66206D656D6F7279000000002D62203CA6\r
+S214031C2C6C6F636174696F6E3E202D6C203C6C6523\r
+S214031C3C6E6774683E0000006261736520616464BD\r
+S214031C4C72657373000000006C656E677468000041\r
+S214031C5C75736167653A206D66696C6C202D62201E\r
+S214031C6C3C616464723E202D6C203C6C656E67741C\r
+S214031C7C683E205B2D70203C7061747465726E3EFA\r
+S214031C8C5D205B2D317C2D327C2D345D0A000000EB\r
+S214031C9C6D66696C6C00000046696C6C2061206292\r
+S214031CAC6C6F636B206F66206D656D6F7279207732\r
+S214031CBC6974682061207061747465726E0000002C\r
+S214031CCC2D62203C6C6F636174696F6E3E202D6CC5\r
+S214031CDC203C6C656E6774683E202D70203C7061EA\r
+S214031CEC747465726E3E205B2D317C2D327C2D34E4\r
+S214031CFC5D0000007061747465726E0066696C6CCE\r
+S214031D0C2033322062697420756E69747300000088\r
+S214031D1C66696C6C2031362062697420756E697442\r
+S214031D2C7300000066696C6C203820626974207539\r
+S214031D3C6E6974730000000075736167653A206DF5\r
+S214031D4C636D70202D73203C616464723E202D6499\r
+S214031D5C203C616464723E202D6C203C6C656E677F\r
+S214031D6C74683E205B2D317C2D327C2D345D0A004D\r
+S214031D7C4275666665727320646F6E2774206D6198\r
+S214031D8C746368202D2025703D3078253032782CEE\r
+S214031D9C2025703D3078253032780A004275666609\r
+S214031DAC65727320646F6E2774206D61746368208C\r
+S214031DBC2D2025703D3078253034782C2025703D29\r
+S214031DCC3078253034780A0042756666657273205F\r
+S214031DDC646F6E2774206D61746368202D202570E4\r
+S214031DEC3D3078253038782C2025703D30782530DA\r
+S214031DFC38780A006D636D7000000000436F6D70D9\r
+S214031E0C6172652074776F20626C6F636B73206FDF\r
+S214031E1C66206D656D6F7279000000002D73203C93\r
+S214031E2C6C6F636174696F6E3E202D64203C6C6F1F\r
+S214031E3C636174696F6E3E202D6C203C6C656E6717\r
+S214031E4C74683E205B2D317C2D327C2D345D000076\r
+S214031E5C75736167653A206D636F7079202D7320F7\r
+S214031E6C3C616464723E202D64203C616464723E63\r
+S214031E7C202D6C203C6C656E6774683E205B2D31A0\r
+S214031E8C7C2D327C2D345D0A00000000636F707964\r
+S214031E9C2033322062697420646174610000000090\r
+S214031EAC636F7079203136206269742064617461C3\r
+S214031EBC00000000636F7079203820626974206418\r
+S214031ECC617461006D636F7079000000436F707905\r
+S214031EDC206D656D6F72792066726F6D206F6E65FF\r
+S214031EEC206164647265737320746F20616E6F7403\r
+S214031EFC6865720053332530325825303858000045\r
+S214031F0C2530325800000000253032580A000000F5\r
+S214031F1C44756D702077686174205B6C6F636174B5\r
+S214031F2C696F6E5D3F0A000064756D7000000000FB\r
+S214031F3C446973706C617920286865782064756DC4\r
+S214031F4C702920612072616E6765206F66206D654F\r
+S214031F5C6D6F7279000000002D62203C6C6F63611C\r
+S214031F6C74696F6E3E205B2D6C203C6C656E6774DB\r
+S214031F7C683E5D205B2D735D205B2D317C327C349B\r
+S214031F8C5D00000064756D70206461746120757368\r
+S214031F9C696E67204D6F726F746F6C6120532D7270\r
+S214031FAC65636F726473000064756D702033322042\r
+S214031FBC62697420756E69747300000064756D70C5\r
+S214031FCC2031362062697420756E697473000000C4\r
+S214031FDC64756D7020382062697420756E6974732D\r
+S214031FEC0000000063616368650000004D616E616C\r
+S214031FFC6765206D616368696E65206361636865F8\r
+S21403200C730000005B4F4E207C204F46465D00005D\r
+S21403201C4F666600446174612063616368653A20A9\r
+S21403202C25732C20496E737472756374696F6E20F6\r
+S21403203C63616368653A2025730A00006F66660061\r
+S21403204C496E76616C6964206361636865206D6FA5\r
+S21403205C64653A2025730A0030313233343536370B\r
+S21403206C383961626364656600000000494E564168\r
+S21403207C4C4944004F4B0000503031004530310082\r
+S21403208C4530320045303300423031003031323384\r
+S21403209C3435363738394142434445460000000050\r
+S2140320AC303132333435363738394142434445467A\r
+S2140320BC00000000303132333435363738390000FF\r
+S2140320CC303132333435363738396162636465669A\r
+S2140320DC000000003C6E756C6C3E00003C4E6F744A\r
+S2140320EC206120737472696E673A203078000000A2\r
+S2140320FC3C42616420666F726D61742073747269FE\r
+S21403210C6E673A2000000000203A00003E0A0000EA\r
+S21403211C253038583A20000025303258200000006D\r
+S21403212C207C0000256300007C0A00002020200091\r
+S21403213C2530385820000000202020202020202086\r
+S21403214C200000002530345820000000766572739A\r
+S21403215C696F6E00446973706C61792052656442D2\r
+S21403216C6F6F742076657273696F6E20696E666F17\r
+S21403217C726D6174696F6E0068656C7000000000A8\r
+S21403218C48656C702061626F75742068656C703F6F\r
+S21403219C000000005B3C746F7069633E5D000000DA\r
+S2140321AC676F00004578656375746520636F6465B7\r
+S2140321BC2061742061206C6F636174696F6E00001C\r
+S2140321CC5B2D77203C74696D656F75743E5D205B83\r
+S2140321DC656E7472795D0000726573657400000039\r
+S2140321EC5265736574207468652073797374656DB2\r
+S2140321FC00000000453336303000000041524D20BD\r
+S21403220C39000000506C6174666F726D3A2025734A\r
+S21403221C20282573292025730A000000436F707944\r
+S21403222C72696768742028432920323030302C209A\r
+S21403223C323030312C20323030322C205265642030\r
+S21403224C4861742C20496E632E0A0A0052414D3A9B\r
+S21403225C2025702D25702C20000000005B25702D8A\r
+S21403226C25705D0020617661696C61626C650A009D\r
+S21403227C526564426F6F743E200000002A2A206366\r
+S21403228C6F6D6D616E642061626F7274202D2069B0\r
+S21403229C6C6C6567616C206D656D6F72792061631C\r
+S2140322AC636573733F0A00002A2A204572726F72A5\r
+S2140322BC3A20496C6C6567616C20636F6D6D616E5B\r
+S2140322CC643A20222573220A0000000025730A2094\r
+S2140322DC2025732025732025730A00003C746F7029\r
+S2140322EC69633E00496E76616C696420617267753A\r
+S2140322FC6D656E740A000000776169742074696DED\r
+S21403230C656F757400000000676F2077697468202A\r
+S21403231C63616368657320656E61626C6564000057\r
+S21403232C7374617274696E67206164647265737327\r
+S21403233C0000000041626F757420746F2073746123\r
+S21403234C727420657865637574696F6E206174208A\r
+S21403235C2570202D2061626F727420776974682053\r
+S21403236C5E432077697468696E2025642073656301\r
+S21403237C6F6E64730A0000000A50726F6772616DA9\r
+S21403238C20636F6D706C6574656420776974682060\r
+S21403239C7374617475732025640A00004E6F206590\r
+S2140323AC6E74727920706F696E74206B6E6F776EB5\r
+S2140323BC202D2061626F727465640A002E2E2E2007\r
+S2140323CC526573657474696E672E00002121206F45\r
+S2140323DC6F70732C205245534554206E6F742077C0\r
+S2140323EC6F726B696E67206F6E20746869732070EA\r
+S2140323FC6C6174666F726D0A000000006368616E30\r
+S21403240C6E656C00446973706C61792F73776974AD\r
+S21403241C636820636F6E736F6C65206368616E6EA2\r
+S21403242C656C00005B2D317C3C6368616E6E656C7D\r
+S21403243C206E756D6265723E5D00000043757272A8\r
+S21403244C656E7420636F6E736F6C65206368616E64\r
+S21403245C6E656C2069643A200000000025640A004F\r
+S21403246C2D310A002D3100002A2A204572726F7214\r
+S21403247C3A20696E76616C6964206368616E6E657A\r
+S21403248C6C20272573270A002A2A4572726F723A24\r
+S21403249C20626164206368616E6E656C206E756D78\r
+S2140324AC62657220272573270A0000005E430A0024\r
+S2140324BC202D20636F6E74696E75652028792F6ED8\r
+S2140324CC293F2000202A2A2054696D6564206F75E5\r
+S2140324DC74210A002121000025733A206576656E67\r
+S2140324EC74206E6F7420666F756E640A00000000AD\r
+S2140324FC2533642025730A00446973706C61792054\r
+S21403250C636F6D6D616E6420686973746F727900A6\r
+S21403251C556E62616C616E63656420737472696E6A\r
+S21403252C67210A00546F6F206D616E7920617267A4\r
+S21403253C756D656E7473202D2073746F707065647F\r
+S21403254C2061743A20272573270A0000416D6269BF\r
+S21403255C67756F757320636F6D6D616E64202725C9\r
+S21403256C73272C2063686F69636573206172653A01\r
+S21403257C2025730055736167653A0A00202025737E\r
+S21403258C25732025730A00002A2A204572726F725F\r
+S21403259C3A20696E76616C6964206E756D6265723D\r
+S2140325AC202725732720666F722025730A000000E8\r
+S2140325BC2A2A204572726F723A20257320616C7238\r
+S2140325CC65616479207370656369666965640A007E\r
+S2140325DC2A2A204572726F723A206E6F20646566E3\r
+S2140325EC61756C742F6E6F6E2D666C6167206172ED\r
+S2140325FC67756D656E747320737570706F72746522\r
+S21403260C640A00002A2A204572726F723A20696E99\r
+S21403261C76616C696420666C616720272563270ADC\r
+S21403262C000000007275650052554500616C7365B9\r
+S21403263C00000000414C534500000000465245453F\r
+S21403264C4D454D4C4F000000257000004652454545\r
+S21403265C4D454D48490000004E6F20726F6F6D203C\r
+S21403266C746F20657870616E6420272573270A00C3\r
+S21403267C416C6961732027257327206E6F74206461\r
+S21403268C6566696E65640A00496E76616C696420DA\r
+S21403269C6D6163726F2F616C6961732027257327D5\r
+S2140326AC0A00000001010101010101018080808004\r
+S2140326BC8080808000000000B71DC1046E3B820939\r
+S2140326CCD926430DDC7604136B6BC517B24D861AED\r
+S2140326DC0550471EB8ED08260FF0C922D6D68A2F0A\r
+S2140326EC61CB4B2B649B0C35D386CD310AA08E3C29\r
+S2140326FCBDBD4F3870DB114CC7C6D0481EE09345A2\r
+S21403270CA9FD5241ACAD155F1BB0D45BC296975670\r
+S21403271C758B5652C836196A7F2BD86EA60D9B63DB\r
+S21403272C11105A6714401D79A35DDC7D7A7B9F706C\r
+S21403273CCD665E74E0B6239857ABE29C8E8DA19162\r
+S21403274C399060953CC0278B8BDDE68F52FBA582B8\r
+S21403275CE5E66486585B2BBEEF46EABA3660A9B745\r
+S21403276C817D68B3842D2FAD3330EEA9EA16ADA464\r
+S21403277C5D0B6CA0906D32D42770F3D0FE56B0DD93\r
+S21403278C494B71D94C1B36C7FB06F7C32220B4CE74\r
+S21403279C953D75CA28803AF29F9DFBF646BBB8FB5F\r
+S2140327ACF1A679FFF4F63EE143EBFFE59ACDBCE8E0\r
+S2140327BC2DD07DEC77708634C06D4730194B043DB5\r
+S2140327CCAE56C539AB0682271C1B4323C53D002ECC\r
+S2140327DC7220C12ACF9D8E1278804F16A1A60C1B91\r
+S2140327EC16BBCD1F13EB8A01A4F64B057DD0080848\r
+S2140327FCCACDC90C07AB9778B0B6567C69901571E1\r
+S21403280CDE8DD475DBDD936B6CC0526FB5E611624F\r
+S21403281C02FBD066BF469F5E085B5E5AD17D1D5792\r
+S21403282C6660DC5363309B4DD42D5A490D0B19440B\r
+S21403283CBA16D84097C6A5AC20DB64A8F9FD27A525\r
+S21403284C4EE0E6A14BB0A1BFFCAD60BB258B23B617\r
+S21403285C9296E2B22F2BAD8A98366C8E41102F834C\r
+S21403286CF60DEE87F35DA9994440689D9D662B9003\r
+S21403287C2A7BEA94E71DB4E0500075E4892636E912\r
+S21403288C3E3BF7ED3B6BB0F38C7671F7555032FA53\r
+S21403289CE24DF3FE5FF0BCC6E8ED7DC231CB3ECF16\r
+S2140328AC86D6FFCB8386B8D5349B79D1EDBD3ADC7F\r
+S2140328BC5AA0FBD8EEE00C6959FDCD6D80DB8E601B\r
+S2140328CC37C64F643296087A858BC97E5CAD8A739D\r
+S2140328DCEBB04B77560D044FE110C54B3836864696\r
+S2140328EC8F2B47428A7B005C3D66C158E440825579\r
+S2140328FC535D43519E3B1D252926DC21F0009F2C5E\r
+S21403290C471D5E28424D1936F550D8322C769B3F20\r
+S21403291C9B6B5A3B26D6150391CBD40748ED970AE7\r
+S21403292CFFF0560EFAA011104DBDD014949B9319BC\r
+S21403293C2386521D0E562FF1B94BEEF5606DADF88E\r
+S21403294CD7706CFCD2202BE2653DEAE6BC1BA9EBE8\r
+S21403295C0B0668EFB6BB27D701A6E6D3D880A5DE51\r
+S21403296C6F9D64DA6ACD23C4DDD0E2C004F6A1CD34\r
+S21403297CB3EB60C97E8D3EBDC990FFB910B6BCB42F\r
+S21403298CA7AB7DB0A2FB3AAE15E6FBAACCC0B8A7A4\r
+S21403299C7BDD79A3C660369B717DF79FA85BB492EB\r
+S2140329AC1F4675961A163288AD0BF38C742DB081B0\r
+S2140329BCC330718599908A5D2E8D4B59F7AB0854AD\r
+S2140329CC40B6C95045E68E4EF2FB4F4A2BDD0C47FC\r
+S2140329DC9CC0CD43217D827B9660437F4F4600721D\r
+S2140329ECF85BC176FD0B86684A16476C9330046118\r
+S2140329FC242DC565E94B9B115E565A15877019181D\r
+S214032A0C306DD81C353D9F0282205E065B061D0B7F\r
+S214032A1CEC1BDC0F51A69337E6BB52333F9D113E9E\r
+S214032A2C8880D03A8DD097243ACD5620E3EB152DDB\r
+S214032A3C54F6D4297926A9C5CE3B68C1171D2BCCD1\r
+S214032A4CA000EAC8A550ADD6124D6CD2CB6B2FDFC7\r
+S214032A5C7C76EEDBC1CBA1E376D660E7AFF023EA58\r
+S214032A6C18EDE2EE1DBDA5F0AAA064F4738627F953\r
+S214032A7CC49BE6FD09FDB889BEE0798D67C63A802E\r
+S214032A8CD0DBFB84D58BBC9A62967D9EBBB03E9303\r
+S214032A9C0CADFF97B110B0AF060D71ABDF2B32A6A2\r
+S214032AAC6836F3A26D66B4BCDA7B75B8035D36B5CF\r
+S214032ABCB440F7B100002110422063308440A55087\r
+S214032ACCC660E770088129914AA16BB18CC1ADD160\r
+S214032ADCCEE1EFF13112100273325222B552944208\r
+S214032AECF772D662399318837BB35AA3BDD39CC3B0\r
+S214032AFCFFF3DEE36224433420040114E664C77454\r
+S214032B0CA44485546AA54BB528850995EEE5CFF5FF\r
+S214032B1CACC58DD55336722611163006D776F666A7\r
+S214032B2C9556B4465BB77AA719973887DFF7FEE74F\r
+S214032B3C9DD7BCC7C448E5588668A7784008611873\r
+S214032B4C02282338CCC9EDD98EE9AFF9488969999F\r
+S214032B5C0AA92BB9F55AD44AB77A966A711A500A47\r
+S214032B6C333A122AFDDBDCCBBFFB9EEB799B588BEF\r
+S214032B7C3BBB1AABA66C877CE44CC55C222C033C93\r
+S214032B8C600C411CAEED8FFDECCDCDDD2AAD0BBD3F\r
+S214032B9C688D499D977EB66ED55EF44E133E322EE7\r
+S214032BAC511E700E9FFFBEEFDDDFFCCF1BBF3AAF8F\r
+S214032BBC599F788F8891A981CAB1EBA10CD12DC1ED\r
+S214032BCC4EF16FE18010A100C230E3200450254083\r
+S214032BDC46706760B9839893FBA3DAB33DC31CD3E3\r
+S214032BEC7FE35EF3B1029012F322D23235421452D3\r
+S214032BFC77625672EAB5CBA5A89589856EF54FE52F\r
+S214032C0C2CD50DC5E234C324A01481046674476422\r
+S214032C1C24540544DBA7FAB79987B8975FE77EF782\r
+S214032C2C1DC73CD7D326F2369106B0165766767672\r
+S214032C3C154634564CD96DC90EF92FE9C899E9894E\r
+S214032C4C8AB9ABA94458654806782768C018E108C2\r
+S214032C5C8238A3287DCB5CDB3FEB1EFBF98BD89B22\r
+S214032C6CBBAB9ABB754A545A376A167AF10AD01A12\r
+S214032C7CB32A923A2EFD0FED6CDD4DCDAABD8BAD6E\r
+S214032C8CE89DC98D267C076C645C454CA23C832C62\r
+S214032C9CE01CC10C1FEF3EFF5DCF7CDF9BAFBABFC2\r
+S214032CACD98FF89F176E367E554E745E932EB23EB2\r
+S214032CBCD10EF01E000102020303030304040404F2\r
+S214032CCC04040404050505050505050505050505A4\r
+S214032CDC0505050506060606060606060606060684\r
+S214032CEC0606060606060606060606060606060670\r
+S214032CFC0606060607070707070707070707070754\r
+S214032D0C070707070707070707070707070707073F\r
+S214032D1C070707070707070707070707070707072F\r
+S214032D2C070707070707070707070707070707071F\r
+S214032D3C0707070708080808080808080808080803\r
+S214032D4C08080808080808080808080808080808EF\r
+S214032D5C08080808080808080808080808080808DF\r
+S214032D6C08080808080808080808080808080808CF\r
+S214032D7C08080808080808080808080808080808BF\r
+S214032D8C08080808080808080808080808080808AF\r
+S214032D9C080808080808080808080808080808089F\r
+S214032DAC080808080808080808080808080808088F\r
+S208032DBC08080808EB\r
+S214032DC00000000098B5020098B5020098B502000E\r
+S214032DD098B5020098B5020098B5020098B50200AF\r
+S214032DE098B5020098B5020098B5020098B502009F\r
+S214032DF098B5020098B5020098B5020098B502008F\r
+S214032E0098B5020098B5020098B5020098B502007E\r
+S214032E1098B5020098B5020098B5020098B502006E\r
+S214032E2098B5020098B5020098B5020098B502005E\r
+S214032E3098B5020098B5020098B5020098B502004E\r
+S214032E4098B5020098B5020098B5020098B502003E\r
+S214032E5098B5020098B5020098B5020098B502002E\r
+S214032E6098B5020098B5020098B5020098B502001E\r
+S214032E7098B5020098B5020098B5020098B502000E\r
+S214032E8098B5020098B5020098B5020098B50200FE\r
+S214032E9098B5020098B5020098B5020098B50200EE\r
+S214032EA098B5020098B5020098B5020098B50200DE\r
+S214032EB098B5020098B5020098B5020098B50200CE\r
+S214032EC098B5020098B5020000000000000000005C\r
+S214032ED000000000000000000000000000000000EA\r
+S214032EE000000000000000000000000000000000DA\r
+S214032EF000000000000000000000000000000000CA\r
+S214032F0000000000000000000000000000000000B9\r
+S214032F1000000000000000000000000000000000A9\r
+S214032F200000000000000000000000000000000099\r
+S214032F300000000000000000000000000000000089\r
+S214032F400000000000000000000000000000000079\r
+S214032F500000000000000000000000000000000069\r
+S214032F600000000000000000000000000000000059\r
+S214032F700000000000000000000000000000000049\r
+S214032F800000000000000000000000000000000039\r
+S214032F900000000000000000000000000000000029\r
+S214032FA00000000000000000000000000000000019\r
+S214032FB00000000000000000000000000000000009\r
+S214032FC000000000000000000000000000000000F9\r
+S214032FD000000000000000000000000000000000E9\r
+S214032FE000000000000000000000000000000000D9\r
+S214032FF000000000000000000000000000000000C9\r
+S21403300000000000000000000000000000000000B8\r
+S21403301000000000000000000000000000000000A8\r
+S2140330200000000000000000000000000000000098\r
+S2140330300000000000000000000000000000000088\r
+S2140330400000000000000000000000000000000078\r
+S2140330500000000000000000000000000000000068\r
+S2140330600000000000000000000000000000000058\r
+S2140330700000000000000000000000000000000048\r
+S2140330800000000000000000000000000000000038\r
+S2140330900000000000000000000000000000000028\r
+S2140330A00000000000000000000000000000000018\r
+S2140330B00000000000000000000000000000000008\r
+S2140330C000000000000000000000000000000000F8\r
+S2140330D00A526564426F6F7428746D2920626F6F9D\r
+S2140330E074737472617020616E64206465627567C0\r
+S2140330F020656E7669726F6E6D656E74205B5241E5\r
+S2140331004D5D0A4E6F6E2D636572746966696564FC\r
+S2140331102072656C656173652C2076657273696FC2\r
+S2140331206E20554E4B4E4F574E202D206275696CC0\r
+S214033130742031313A34343A35312C204D617920BC\r
+S214033140203920323030350A0A0000005B2D725DCC\r
+S214033150205B2D765D205B2D68203C686F73743E84\r
+S2140331605D205B2D6D203C7661726965733E5D2044\r
+S2140331700A20202020202020205B2D62203C626134\r
+S21403318073655F616464726573733E5D203C666954\r
+S2140331906C655F6E616D653E000000007C2F2D5CE4\r
+S2140331A07C2D000034790200907D0200EC7D020045\r
+S2140331B0D07A0200247F02000100000020000000F5\r
+S2140331C00000000000000000E0A3020034A4020098\r
+S2140331D0000000000000000000000000FFFFFFFFEB\r
+S2140331E00000000000000000208103000000000033\r
+S2140331F00000000000000000FEFFFFFFFEFFFFFFD1\r
+S21403320000000000000000005CB60200FFFFFFFFA6\r
+S214033210FFFFFFFF000000000000000000000000AA\r
+S21403322000000780E80300000000000000C00680DE\r
+S214033230E803000017000000000000000000000084\r
+S2140332400200000000000000000000000000000074\r
+S2140332500000000000000000000000000000000066\r
+S2140332600000000000000000000000000000000056\r
+S2140332700000000000000000000000000000000046\r
+S2140332800000000000000000000000000000000036\r
+S214033290C05D000000000000E8030000000000001E\r
+S2140332A0F01F0300F81F030010200300A08C020089\r
+S2140332B000000000000000000824030010240300A0\r
+S2140332C03024030070D1020000000000000000005C\r
+S2140332D0DC1B0300E41B0300281C0300C07F020062\r
+S2140332E00000000000000000341F03003C1F030022\r
+S2140332F0641F030050890200000000000000000065\r
+S214033300AC210300B0210300CC210300A4CD0200AE\r
+S2140333100000000000000000842103008C2103004D\r
+S214033320A0210300C8CC020000000000000000003B\r
+S2140333301425030004250300681B030040E0020075\r
+S21403334000000000000000002C16030034160300E3\r
+S2140333504C3103002471020000000000000000004E\r
+S214033360001E0300081E0300281E03009C830200A1\r
+S2140333700000000000000000D01E0300D81E03005B\r
+S214033380281E0300948602000000000000000000D0\r
+S2140333909C1C0300A41C0300CC1C03003881020001\r
+S2140333A00000000000000000E4210300EC210300FD\r
+S2140333B0681B030010D0020000000000000000009D\r
+S2140333C05821030060210300681B030058C702004E\r
+S2140333D00000000000000000F82003003C1F03006C\r
+S2140333E0641F0300948C020000000000000000002D\r
+S2140333F0581B0300A4310300000000000000000077\r
+S21403340001000000601B0300A4310300000000005D\r
+S21003341000000000020000007CC6020062\r
+S80402604059\r
diff --git a/tools/elftosb/test_files/rom_nand_ldr_profile b/tools/elftosb/test_files/rom_nand_ldr_profile
new file mode 100644 (file)
index 0000000..2ac9ed7
Binary files /dev/null and b/tools/elftosb/test_files/rom_nand_ldr_profile differ
diff --git a/tools/elftosb/test_files/sd_player_gcc b/tools/elftosb/test_files/sd_player_gcc
new file mode 100644 (file)
index 0000000..ba1fb08
Binary files /dev/null and b/tools/elftosb/test_files/sd_player_gcc differ
diff --git a/tools/elftosb/test_files/sd_player_gcc.srec b/tools/elftosb/test_files/sd_player_gcc.srec
new file mode 100644 (file)
index 0000000..3155c7c
--- /dev/null
@@ -0,0 +1,11250 @@
+S011000073645F706C617965722E7372656350\r
+S3150000680018F09FE518F09FE518F09FE518F09FE552\r
+S3150000681018F09FE50000000018F09FE518F09FE5CE\r
+S3150000682040680000546A0000786A0000A46A00000C\r
+S31500006830C06A000000000000CC6B0000886B0000FE\r
+S31500006840100F11EE020AC0E30400C0E3010AC0E320\r
+S315000068500100C0E368159FE5010000E064159FE5AF\r
+S31500006860010080E1100F01EE0000A0E10000A0E1B0\r
+S315000068700000A0E10000A0E10000A0E10000A0E10E\r
+S315000068800000A0E10000A0E10000A0E3160F07EE63\r
+S31500006890150F07EEA201A0E32C159FE5001080E579\r
+S315000068A028159FE528059FE5001080E524059FE54E\r
+S315000068B0001080E520059FE5001080E51C059FE59A\r
+S315000068C0001080E518059FE5001080E514059FE59A\r
+S315000068D0001080E510059FE5001080E50C059FE59A\r
+S315000068E0001080E508059FE5001080E504059FE59A\r
+S315000068F0001080E500059FE5001080E5FC049FE59B\r
+S31500006900001080E5F8049FE5001080E5F4049FE59B\r
+S31500006910001080E5F0049FE5001080E5EC049FE59B\r
+S31500006920001080E59201A0E30318A0E3001080E5C3\r
+S31500006930DC049FE50010A0E3001080E5001080E570\r
+S3150000694000700FE11F7007E2130057E30700000A0B\r
+S315000069500000A0E3BC149FE5042091E5042080E537\r
+S31500006960242091E5242080E5082091E5082080E593\r
+S3150000697028049FE5001090E5000051E3FDFFFF1A93\r
+S31500006980C8109FE5001080E50000A0E308149FE50D\r
+S31500006990130057E30100000A282091E5282080E52E\r
+S315000069A0182091E5182080E5382091E5382080E50B\r
+S315000069B01C2091E51C2080E53C2091E53C2080E5EB\r
+S315000069C00C2091E50C2080E52C2091E52C2080E51B\r
+S315000069D0102091E5102080E5302091E5302080E5FB\r
+S315000069E084D39FE5D200A0E300F029E17CD39FE5A4\r
+S315000069F0DB00A0E300F029E170D39FE5D300A0E31C\r
+S31500006A0000F029E100F069E19CD39FE564139FE55E\r
+S31500006A1064239FE50000A0E3020051E10200000AA2\r
+S31500006A20040081E4020051E1FCFFFF9A845100EB6F\r
+S31500006A30462D00EB495100EBDC139FE501D0A0E1A8\r
+S31500006A400F2F00EBFEFFFFEA0000A0E300F0A0E13D\r
+S31500006A500BB0ADDE18D39FE53F002DE900104FE1E6\r
+S31500006A60200011E304004E0202004E120120A0E3B2\r
+S31500006A700D30A0E1180000EA00012DE9F0829FE543\r
+S31500006A803F0028E90830A0E10001BDE800104FE111\r
+S31500006A90200011E304004E0202004E120220A0E381\r
+S31500006AA00D0000EAC8D29FE53F002DE904004EE242\r
+S31500006AB000104FE10320A0E30D30A0E1060000EA3C\r
+S31500006AC0ACD29FE53F002DE904004EE200104FE1F5\r
+S31500006AD00420A0E30D30A0E1FFFFFFEA00400FE134\r
+S31500006AE01F40C4E3134084E304F029E10D50A0E104\r
+S31500006AF00E40A0E137002DE90D00A0E100200FE1D6\r
+S31500006B00C01081E32010C1E301F029E1007F20E9F4\r
+S31500006B1002F029E100D0A0E13F0093E8FF002DE953\r
+S31500006B2040109DE51F1001E2130051E34C109D0536\r
+S31500006B3034108D050D00A0E1F55000EB40009DE5F9\r
+S31500006B401F1000E2130051E300F069E1FFFFDD08CA\r
+S31500006B5020208DE200100FE1C00080E32000C0E39A\r
+S31500006B6000F029E1007F92E801F029E14C009DE563\r
+S31500006B7020008DE548009DE524008DE53C009DE55F\r
+S31500006B8028008DE5FFE0DDE80180A0E38C929FE51B\r
+S31500006B90008089E500804FE11F9008E2120059E36A\r
+S31500006BA00200001A408088E308F069E104F05EE222\r
+S31500006BB0B8D19FE500410DE9D280A0E308F029E1B4\r
+S31500006BC0A8D19FE500601DE90DF069E19CD19FE524\r
+S31500006BD03F002DE904004EE200104FE10620A0E33D\r
+S31500006BE00D30A0E100400FE11F40C4E3134084E3F1\r
+S31500006BF004F029E10D50A0E10E40A0E137002DE997\r
+S31500006C000D00A0E100200FE1C01081E32010C1E3D8\r
+S31500006C1001F029E1007F20E902F029E100D0A0E19E\r
+S31500006C203F0093E8FF002DE940109DE51F1001E2AB\r
+S31500006C30130051E34C109D0534108D050D90A0E115\r
+S31500006C4060219FE5000092E5011080E2001082E5D8\r
+S31500006C50000050E30D10A0014CD19F0502002D0944\r
+S31500006C603C319FE5004093E5014084E2004083E526\r
+S31500006C700900A0E1535100EB0040A0E10400A0E1AF\r
+S31500006C809C219FE5009082E5010070E30200001A56\r
+S31500006C900900A0E1B05000EB060000EAF0109FE505\r
+S31500006CA0041191E7E4209FE5046192E70920A0E141\r
+S31500006CB00FE0A0E106F0A0E1E8209FE500100FE15B\r
+S31500006CC0C03081E303F029E1003092E5013053E260\r
+S31500006CD0003082E500D09D0501F029E1010074E352\r
+S31500006CE00300000AAC109FE5041191E70920A0E11A\r
+S31500006CF0B93A00EB90FFFFEA30402DE900400FE182\r
+S31500006D00C02084E3C050C4E302F029E10D30A0E1C5\r
+S31500006D1094D09FE508002DE988209FE5003092E594\r
+S31500006D20013083E2003082E505F029E18A3A00EB82\r
+S31500006D3000100FE1C02081E302F029E164209FE505\r
+S31500006D40003092E5013043E2003082E500D09DE557\r
+S31500006D5004F029E13080BDE80EF0A0E100000FE16B\r
+S31500006D600EF0A0E10D00A0E10EF0A0E170350200EA\r
+S31500006D70E0220200602302006022020064B20200E8\r
+S31500006D8064B2020000140200001402006022020035\r
+S31500006D9004140200081502000C1602000068000028\r
+S31500006DA000140200F4200200603302006033020087\r
+S31500006DB065436F73203A20004F63742020342032DD\r
+S31500006DC030303500FFF3050078000500000003C0F1\r
+S31500006DD00F0F0F0F68000080780000808800008089\r
+S31500006DE098000080A8000080B8000080C8000080DD\r
+S31500006DF0D8000080E8000080F800008008010080CC\r
+S31500006E0018010080280100803801008048010080B8\r
+S31500006E105801008000C00180006800007035020043\r
+S31500006E206021020020B202000DC0A0E130D82DE999\r
+S31500006E3004B04CE260D04DE274004BE2C0109FE516\r
+S31500006E406020A0E30F49A0E3663200EB0400A0E156\r
+S31500006E50100F02EE0000E0E3100F03EE0400A0E1C5\r
+S31500006E600129A0E30010A0E38E3200EB0050A0E35E\r
+S31500006E7014E04BE25C301EE500C0A0E303005CE1D9\r
+S31500006E801400002A60201EE50C2082E0023194E7FF\r
+S31500006E9054101EE5233AA0E1013683E16336A0E1F2\r
+S31500006EA0023184E760101EE50C1081E0013194E7A1\r
+S31500006EB058201EE5FF34C3E30C2082E00F36C3E3FF\r
+S31500006EC0023A83E1013184E75C301EE501C08CE2C1\r
+S31500006ED003005CE1EAFFFF3A015085E2050055E355\r
+S31500006EE010E08EE2E2FFFF9A100F11EE010A80E336\r
+S31500006EF0040080E3020080E3010080E3100F01EE4E\r
+S31500006F0030A81BE92C0802000130A0E10010A0E324\r
+S31500006F10010010E3A000A0E10200001A011081E2C6\r
+S31500006F20200051E3F9FFFFDA1301A0E10EF0A0E122\r
+S31500006F300130A0E10010A0E3010010E3A000A0E1F1\r
+S31500006F400200001A011081E2200051E3F9FFFFDA86\r
+S31500006F503301A0E10EF0A0E10DC0A0E170D82DE94B\r
+S31500006F600048A0E104B04CE208D04DE24448A0E15C\r
+S31500006F700150A0E10260A0E10030A0E37AFF17EE25\r
+S31500006F80FDFFFF1A9A3F07EE0419A0E101C0A0E336\r
+S31500006F902118A0E11C204BE2043083E2C000A0E3EC\r
+S31500006FA000C08DE5231F00EB0030A0E37AFF17EE4B\r
+S31500006FB0FDFFFF1A9A3F07EE1C301BE50500A0E116\r
+S31500006FC00530C3E10610A0E11C300BE5CDFFFFEB59\r
+S31500006FD01C301BE518204BE2003083E1043022E52B\r
+S31500006FE00030A0E37AFF17EEFDFFFF1A9A3F07EE87\r
+S31500006FF00449A0E12448A0E101C0A0E30410A0E1F7\r
+S31500007000043083E2C000A0E300C08DE5B61E00EBAD\r
+S315000070100030A0E37AFF17EEFDFFFF1A9A3F07EE56\r
+S3150000702070A81BE90DC0A0E110D82DE90008A0E169\r
+S3150000703004B04CE208D04DE24008A0E10140A0E1D6\r
+S315000070400030A0E37AFF17EEFDFFFF1A9A3F07EE26\r
+S315000070500009A0E12008A0E10010A0E101C0A0E322\r
+S3150000706014204BE2043083E2C000A0E300C08DE5AB\r
+S31500007070F01E00EB0030A0E37AFF17EEFDFFFF1ACB\r
+S315000070809A3F07EE0400A0E114101BE5A7FFFFEBF3\r
+S3150000709010A81BE90DC0A0E110D82DE994429FE588\r
+S315000070A0003094E5013083E2030053E3003084E5C9\r
+S315000070B00030A0C3003084C504B04CE2672000EB6A\r
+S315000070C0003094E5030053E303F19F97100000EAB4\r
+S315000070D0E0700000AC720000D8720000047300007B\r
+S315000070E00040E0E350229FE50410A0E10000A0E389\r
+S315000070F098FFFFEB44229FE50410A0E10100A0E306\r
+S3150000710094FFFFEB38229FE50010A0E33800A0E3D0\r
+S31500007110DF1500EB0713A0E30120A0E30600A0E3C0\r
+S315000071208CFFFFEB0A00A0E3260F00EB1A00A0E39A\r
+S315000071307F10A0E3BAFFFFEB630050E3020000DA22\r
+S31500007140640050E35400000A530000CA0713A0E38A\r
+S315000071500520A0E30600A0E37EFFFFEB0A00A0E304\r
+S31500007160180F00EB1A00A0E37F10A0E3ACFFFFEBC3\r
+S31500007170630050E3020000DA640050E34600000AB0\r
+S31500007180450000CA0400A0E30C10A0E30220A0E31F\r
+S3150000719070FFFFEB1D00A0E3FF14A0E3A0FFFFEBD1\r
+S315000071A0180050E3380000DA190050E33600000AF0\r
+S315000071B01D00A0E3FF14A0E399FFFFEBE60050E3F8\r
+S315000071C0020000DAE70050E32F00000A2E0000CA92\r
+S315000071D070419FE50219A0E30120A0E30200A0E3AD\r
+S315000071E05CFFFFEB0500A0E3F60E00EB58219FE5E0\r
+S315000071F00410A0E10200A0E356FFFFEB0300A0E3AA\r
+S31500007200F00E00EB44219FE50410A0E10200A0E38C\r
+S3150000721050FFFFEB0300A0E3EA0E00EB30219FE5F1\r
+S315000072200410A0E10200A0E34AFFFFEB0400A0E384\r
+S31500007230E40E00EB1C219FE50410A0E10200A0E390\r
+S3150000724044FFFFEB0A00A0E3DE0E00EB08219FE5FA\r
+S315000072500410A0E10200A0E33EFFFFEB1900A0E34B\r
+S31500007260D80E00EBF4209FE50410A0E10200A0E395\r
+S3150000727038FFFFEB0110A0E31700A0E30120A0E117\r
+S3150000728034FFFFEB10681BE9B51F00EA0200A0E31C\r
+S315000072900219A0E30020A0E3F4FFFFEA0400A0E344\r
+S315000072A00C10A0E30020A0E3B8FFFFEA0040E0E3F3\r
+S315000072B0AC209FE50410A0E10000A0E325FFFFEB52\r
+S315000072C0A0209FE50410A0E10100A0E321FFFFEB51\r
+S315000072D094209FE58BFFFFEA0040E0E38C209FE5CA\r
+S315000072E00410A0E10000A0E31AFFFFEB80209FE559\r
+S315000072F00410A0E10100A0E316FFFFEB74209FE558\r
+S3150000730080FFFFEA0040E0E36C209FE50000A0E379\r
+S315000073100410A0E10FFFFFEB0410A0E15C209FE545\r
+S315000073200100A0E30BFFFFEB54209FE53800A0E32C\r
+S315000073300010A0E375FFFFEA28170200F64E0400CE\r
+S3150000734004F7111C8C080200FFFF0000A582000054\r
+S3150000735095830000748400003585000032860000A5\r
+S3150000736010880000014F0400F0BC5E1C9808020063\r
+S31500007370165104008FE03E1CA40802001A510400B6\r
+S3150000738097D15C1CB00802000DC0A0E170D82DE9B1\r
+S3150000739004B04CE20050A0E1B01F00EBCCC19FE569\r
+S315000073A0CC319FE5CC419FE585C08CE00060E0E3F1\r
+S315000073B000C083E5852194E70000A0E30610A0E164\r
+S315000073C0854184E0E3FEFFEB042094E50610A0E18E\r
+S315000073D00100A0E3DFFEFFEB0713A0E30120A0E31B\r
+S315000073E00600A0E3DBFEFFEB0A00A0E3750E00EB50\r
+S315000073F01A00A0E37F10A0E309FFFFEB630050E350\r
+S315000074000200009A640050E35400000A5300008A08\r
+S315000074100713A0E30520A0E30600A0E3CDFEFFEBE3\r
+S315000074200A00A0E3670E00EB1A00A0E37F10A0E3BA\r
+S31500007430FBFEFFEB630050E30200009A640050E39A\r
+S315000074404600000A4500008A0400A0E30C10A0E3F1\r
+S315000074500220A0E3BFFEFFEB1D00A0E3FF14A0E3A4\r
+S31500007460EFFEFFEB180050E33800009A190050E3D6\r
+S315000074703600000A1D00A0E3FF14A0E3E8FEFFEBC0\r
+S31500007480E60050E30200009AE70050E32F00000AEE\r
+S315000074902E00008AE0409FE50219A0E30120A0E348\r
+S315000074A00200A0E3ABFEFFEB0500A0E3450E00EBF8\r
+S315000074B0C8209FE50410A0E10200A0E3A5FEFFEBB3\r
+S315000074C00300A0E33F0E00EBB4209FE50410A0E10B\r
+S315000074D00200A0E39FFEFFEB0300A0E3390E00EBE2\r
+S315000074E0A0209FE50410A0E10200A0E399FEFFEBB7\r
+S315000074F00400A0E3330E00EB8C209FE50410A0E10E\r
+S315000075000200A0E393FEFFEB0A00A0E32D0E00EBC2\r
+S3150000751078209FE50410A0E10200A0E38DFEFFEBBA\r
+S315000075201900A0E3270E00EB64209FE50410A0E1FC\r
+S315000075300200A0E387FEFFEB0110A0E31700A0E323\r
+S315000075400120A0E183FEFFEB70681BE9041F00EA3F\r
+S315000075500200A0E30219A0E30020A0E3F4FFFFEA83\r
+S315000075600400A0E30C10A0E30020A0E3B8FFFFEAAC\r
+S315000075707103000010170200B01C0200FFFF00009C\r
+S31500007580A582000095830000748400003585000004\r
+S3150000759032860000108800004C309FE54C209FE5A5\r
+S315000075A0803083E09203C1E00DC0A0E110D82DE940\r
+S315000075B0C32FA0E104B04CE2412162E0021182E057\r
+S315000075C030404BE220D04DE2813043E00400A0E1A0\r
+S315000075D01C109FE5CE4200EB0420A0E10010A0E3C2\r
+S315000075E03800A0E3AA1400EB10A81BE97103000001\r
+S315000075F067666666BC0802000DC0A0E1F0DF2DE9F3\r
+S3150000760004B04CE220D04DE2141F00EBD0319FE5D0\r
+S315000076100020A0E3B020C3E1011082E20138A0E11E\r
+S315000076200228A0E11D0853E3B8319FE5C227A0E177\r
+S315000076300040A0E3B34082E10120A0E1F5FFFFDABC\r
+S315000076409C319FE500C0E0E3B0C0C3E198319FE5FF\r
+S3150000765098219FE51000A0E30410A0E1B040C3E12B\r
+S315000076608B1400EB88919FE504A0A0E1AA3F8AE075\r
+S3150000767080419FE5C380A0E10060E0E3882194E7B4\r
+S315000076800000A0E30610A0E1884184E031FEFFEB94\r
+S31500007690042094E50100A0E30610A0E12DFEFFEB17\r
+S315000076A00610A0E11C00A0E35DFEFFEB48719FE51C\r
+S315000076B0070000E01F2000E2A032A0E10610A0E1D2\r
+S315000076C01C00A0E31352A0E155FEFFEB2C419FE501\r
+S315000076D0070000E0043000E01F2000E2A332A0E132\r
+S315000076E00610A0E11C00A0E3135285E04CFEFFEB60\r
+S315000076F0070000E0044000E01F2000E2A432A0E101\r
+S31500007700135285E0F8309FE5952383E0D0009FE58E\r
+S31500007710A330A0E10F0053E30050A0E1029089E2FC\r
+S3150000772002A08AE20600009AB030D0E1013083E27E\r
+S315000077300328A0E1AC109FE5C227A0E1B18082E159\r
+S31500007740B030C0E1F020D5E11D0052E30200000A8E\r
+S31500007750B0309FE5030059E1C3FFFFDA48404BE232\r
+S31500007760A4109FE50400A0E1694200EB0420A0E11B\r
+S315000077701000A0E30010A0E3451400EBB030D5E103\r
+S315000077800338A0E14308B0E11300000AA33F80E0FC\r
+S3150000779050409FE50130C3E3B40093E1F9FEFFEBEF\r
+S315000077A0B020D5E10228A0E1A23FA0E1423883E063\r
+S315000077B00130C3E3B40093E176FFFFEBB030D5E1CF\r
+S315000077C00338A0E1A32FA0E1432882E018309FE50B\r
+S315000077D0C220A0E1B020C3E1F0AF1BE9E9FEFFEB58\r
+S315000077E0F0AF1BE92C17020000B102002E170200B1\r
+S315000077F0CC08020071030000B01C0200FFFF00006D\r
+S31500007800E0FF0000ABAAAAAA38040000D8080200CC\r
+S315000078100DC0A0E130D82DE954309FE5F010D3E13A\r
+S31500007820010071E304B04CE248509FE548409FE5F3\r
+S3150000783030A81B09B030D4E1013083E20328A0E16F\r
+S31500007840420851E1B030C4E10030A003B030C401B9\r
+S31500007850F030D4E18330A0E1B50093E1C9FEFFEB3F\r
+S31500007860F030D4E18330A0E1B50093E130681BE944\r
+S3150000787048FFFFEA2C17020000B102002E17020093\r
+S315000078800DC0A0E130D82DE954209FE5F030D2E1BB\r
+S31500007890010073E304B04CE248509FE548409FE581\r
+S315000078A0B020D2E130A81B09B030D4E1013043E268\r
+S315000078B0020913E3012042E2B030C4E1B020C41152\r
+S315000078C0F030D4E18330A0E1B50093E1ADFEFFEBEB\r
+S315000078D0F030D4E18330A0E1B50093E130681BE9D4\r
+S315000078E02CFFFFEA2C17020000B102002E1702003F\r
+S315000078F00DC0A0E110D82DE904B04CE20040E0E351\r
+S31500007900241C00EB0410A0E10226A0E30A00A0E379\r
+S3150000791090FDFFEB0100A0E32A0D00EB08239FE595\r
+S315000079201700A0E30410A0E18AFDFFEBFC229FE50F\r
+S315000079300000A0E30410A0E186FDFFEBF0229FE526\r
+S315000079400100A0E30410A0E182FDFFEBE4229FE525\r
+S315000079500200A0E30410A0E17EFDFFEBD8229FE524\r
+S315000079600400A0E30410A0E17AFDFFEBCC229FE522\r
+S315000079700500A0E30410A0E176FDFFEBC0229FE521\r
+S315000079800600A0E30410A0E172FDFFEBB4229FE520\r
+S315000079900700A0E30410A0E16EFDFFEBA8229FE51F\r
+S315000079A00800A0E30410A0E16AFDFFEB9C229FE51E\r
+S315000079B00900A0E30410A0E166FDFFEB90229FE51D\r
+S315000079C01100A0E30410A0E162FDFFEB84229FE515\r
+S315000079D01200A0E30410A0E15EFDFFEB0D00A0E3A2\r
+S315000079E00410A0E10623A0E35AFDFFEB0E00A0E37E\r
+S315000079F00410A0E17524A0E356FDFFEB58229FE595\r
+S31500007A000A00A0E30410A0E152FDFFEB0B00A0E387\r
+S31500007A100410A0E10124A0E34EFDFFEB0C00A0E35F\r
+S31500007A200410A0E1722CA0E34AFDFFEB0F00A0E3D7\r
+S31500007A300410A0E1332AA0E346FDFFEB0D00A0E30E\r
+S31500007A40021AA0E30120A0E342FDFFEB0410A0E12F\r
+S31500007A501E00A0E33F20A0E33EFDFFEB0114A0E3E0\r
+S31500007A600120A0E31700A0E33AFDFFEB0300A0E32B\r
+S31500007A70D40C00EB1700A0E30118A0E30120A0E35B\r
+S31500007A8034FDFFEB1100A0E30119A0E30020A0E301\r
+S31500007A9030FDFFEB0713A0E30120A0E30600A0E3FF\r
+S31500007AA02CFDFFEB0A00A0E3C60C00EB1A00A0E3D6\r
+S31500007AB07F10A0E35AFDFFEB630050E30200009A3B\r
+S31500007AC0640050E35400000A5300008A0713A0E341\r
+S31500007AD00520A0E30600A0E31EFDFFEB0A00A0E3DD\r
+S31500007AE0B80C00EB1A00A0E37F10A0E34CFDFFEBFF\r
+S31500007AF0630050E30200009A640050E34600000A67\r
+S31500007B004500008A0400A0E30C10A0E30220A0E3D5\r
+S31500007B1010FDFFEB1D00A0E3FF14A0E340FDFFEB0B\r
+S31500007B20180050E33800009A190050E33600000AA6\r
+S31500007B301D00A0E3FF14A0E339FDFFEBE60050E3D0\r
+S31500007B400200009AE70050E32F00000A2E00008A88\r
+S31500007B5008419FE50219A0E30120A0E30200A0E38B\r
+S31500007B60FCFCFFEB0500A0E3960C00EBF0209FE584\r
+S31500007B700410A0E10200A0E3F6FCFFEB0300A0E383\r
+S31500007B80900C00EBDC209FE50410A0E10200A0E3CE\r
+S31500007B90F0FCFFEB0300A0E38A0C00EBC8209FE596\r
+S31500007BA00410A0E10200A0E3EAFCFFEB0400A0E35E\r
+S31500007BB0840C00EBB4209FE50410A0E10200A0E3D2\r
+S31500007BC0E4FCFFEB0A00A0E37E0C00EBA0209FE59F\r
+S31500007BD00410A0E10200A0E3DEFCFFEB1900A0E325\r
+S31500007BE0780C00EB8C209FE50410A0E10200A0E3D6\r
+S31500007BF0D8FCFFEB0110A0E31700A0E30120A0E1F1\r
+S31500007C00D4FCFFEB561D00EB10A81BE90200A0E315\r
+S31500007C100219A0E30020A0E3F4FFFFEA0400A0E3BA\r
+S31500007C200C10A0E30020A0E3B8FFFFEA1002010059\r
+S31500007C30F64E040004F7111CB60100000800B89FB8\r
+S31500007C4044E406850D19001C52F05B5206D1007003\r
+S31500007C50CBC2000002DB0C00500014002D223000C5\r
+S31500007C60FFFF0000A58200009583000074840000D9\r
+S31500007C703585000032860000108800000DC0A0E1A6\r
+S31500007C8070D82DE9630050E304B04CE250D04DE2C9\r
+S31500007C900060A0E368604BE59600000A040051E32B\r
+S31500007CA001F19F97710000EA707E0000707E00006F\r
+S31500007CB0BC7C0000707E0000747E00000B0050E368\r
+S31500007CC000F19F97690000EA447D00004C7D0000AA\r
+S31500007CD0707E0000547D00005C7D0000947D0000F5\r
+S31500007CE0F87C0000D87D0000E47D0000107E0000D6\r
+S31500007CF04C7E0000707E000080429FE5001094E5F7\r
+S31500007D00000051E378229F150800001A74229FE5AF\r
+S31500007D101800A0E3DE1200EB6C329FE56C229FE5B3\r
+S31500007D20003082E50130A0E3003084E570A81BE94D\r
+S31500007D301800A0E30010A0E3D51200EB0030A0E38A\r
+S31500007D40F8FFFFEA2BFEFFEB70A81BE9AFFEFFEB87\r
+S31500007D5070A81BE9C9FEFFEB70A81BE930C29FE5BE\r
+S31500007D6000109CE5000051E30030A0130310A011A1\r
+S31500007D7020229F151800A0130200001A18229FE562\r
+S31500007D801800A0E30130A0E300308CE5C01200EB40\r
+S31500007D9070A81BE9700E00EB0A4080E2FC119FE51B\r
+S31500007DA040504BE20420A0E10500A0E10448A0E118\r
+S31500007DB0D74000EB2448A0E10520A0E10010A0E395\r
+S31500007DC01000A0E3B21200EB0410A0E10100A0E352\r
+S31500007DD01A1000EB70A81BE95F0E00EB0A4040E2A8\r
+S31500007DE0EDFFFFEAB8C19FE500109CE5000051E3F6\r
+S31500007DF00030A0130310A011A8219F152800A0137E\r
+S31500007E00E0FFFF1AA0219FE52800A0E3DCFFFFEAC0\r
+S31500007E1098319FE5001093E5000051E30500000A44\r
+S31500007E208C219FE50010A0E31800A0E3981200EB58\r
+S31500007E300A1D00EB70A81BE978219FE51800A0E356\r
+S31500007E40931200EBC61C00EB70A81BE968419FE586\r
+S31500007E50001094E5000051E360219F15B3FFFF1A5F\r
+S31500007E605C219FE51800A0E3891200EBACFFFFEA56\r
+S31500007E7070A81BE9013040E2060053E303F19F9727\r
+S31500007E80FAFFFFEA4C7D0000707E0000547D000082\r
+S31500007E90707E0000A07E0000707E0000B47E0000B0\r
+S31500007EA02D0E00EB1C119FE50A4080E240504BE28C\r
+S31500007EB0BBFFFFEA280E00EB40504BE20A4040E2CF\r
+S31500007EC00420A0E100119FE50500A0E10448A0E11F\r
+S31500007ED08F4000EB2448A0E10010A0E30520A0E1BC\r
+S31500007EE01000A0E36A1200EB0410A0E10100A0E379\r
+S31500007EF0D20F00EBDDFFFFEAD0009FE5003090E5F2\r
+S31500007F00813083E0370E53E3003080E5C0309FD5E3\r
+S31500007F10003080D5B8309FE5002090E5030052E19F\r
+S31500007F20C63043C2003080C5A8209FE5003090E5EA\r
+S31500007F309203C1E0C32FA0E1412162E0374E43E244\r
+S31500007F40021182E040504BE2014044E2813043E0BE\r
+S31500007F500500A0E180109FE5A44F84E06C4000EB93\r
+S31500007F60C440A0E10610A0E10520A0E13800A0E38E\r
+S31500007F70471200EB0400A0E102FDFFEB70A81BE92D\r
+S31500007F801C170200E8080200F80802000000406022\r
+S31500007F90241702001417020008090200180902003B\r
+S31500007FA028090200181702003409020040090200DD\r
+S31500007FB0A41C02004C0902005C0902002017020002\r
+S31500007FC06C0902008009020094090200A00902005F\r
+S31500007FD0101702003704000067666666BC080200D8\r
+S31500007FE00DC0A0E1F0D92DE904B04CE224D04DE259\r
+S31500007FF00170A0E10040A0E1C51C00EB000050E3C9\r
+S315000080000010A0E14D00000A40319FE5005093E5C5\r
+S31500008010000055E34000001A2781A0E1651B00EB34\r
+S31500008020080055E10560A0E10410A0E11000002A57\r
+S31500008030F2E0D0E018319FE5F2C0D0E0002093E5F1\r
+S315000080400C308EE0000052E3C350A0E1B250C410E1\r
+S31500008050B2E0C4000E306CE0C330A0E1016086E2FD\r
+S31500008060B230C410B2C0C400080056E1040080E279\r
+S31500008070EEFFFF3ADC309FE5003093E5000053E366\r
+S31500008080D4309F15B030C111D0309F15B230C11118\r
+S31500008090CC309FE5003093E5000053E30400001A5E\r
+S315000080A00030A0E37AFF17EEFDFFFF1A9A3F07EEB6\r
+S315000080B0F0A91BE9AC409FE50728A0E1000094E584\r
+S315000080C02228A0E10130A0E3471600EB003094E53A\r
+S315000080D00120C7E3023083E08C209FE5020053E1D4\r
+S315000080E0003084E584309F8500308485002094E547\r
+S315000080F044404BE29F2482E2032582E270109FE512\r
+S315000081000400A0E1024000EB0420A0E10010A0E37F\r
+S315000081102000A0E3DE1100EBE0FFFFEA251B00EBE9\r
+S315000081200030A0E37AFF17EEFDFFFF1A9A3F07EE35\r
+S315000081300410A0E10720A0E1791C00EBD7FFFFEABD\r
+S315000081400400A0E10720A0E1D62D00EBD3FFFFEA53\r
+S315000081502017020014170200181702000380FFFF01\r
+S31500008160FD7F00001C170200241702000000D061EA\r
+S3150000817000004060AC0902000DC0A0E110D82DE956\r
+S3150000818004B04CE214D04DE2921600EB25FBFFEB57\r
+S31500008190882100EBC31000EB0000A0E39C209FE5C4\r
+S315000081A00010A0E1BA1100EB94209FE50010A0E3B7\r
+S315000081B00800A0E3B61100EB0020A0E384109FE5C1\r
+S315000081C0020AA0E3C80F00EBA01B00EB1700A0E318\r
+S315000081D0FC0A00EB0400A0E30010A0E3170F00EB7D\r
+S315000081E0C2FDFFEB60009FE5BD1500EB01FDFFEB57\r
+S315000081F0F80A00EB7D0FA0E3F20A00EB0010E0E3C3\r
+S315000082001C00A0E386FBFFEB0028A0E12228A0E1EA\r
+S315000082101F3002E224404BE2A222A0E11223A0E199\r
+S315000082200400A0E124109FE5B93F00EB0420A0E183\r
+S315000082300010A0E33000A0E3951100EBEBFFFFEA8E\r
+S31500008240B8090200C809020044AC00007C7C0000AA\r
+S31500008250D80902000DC0A0E100D82DE904B04CE217\r
+S3150000826008D04DE20030A0E10120A0E1BE304BE194\r
+S31500008270B0214BE1FE305BE1000053E30200001A3F\r
+S315000082802C309FE514300BE5010000EA24309FE511\r
+S3150000829014300BE5FE305BE1FEC05BE118009FE5A4\r
+S315000082A014101BE50320A0E10C30A0E1772C00EBB5\r
+S315000082B000A81BE9E4090200EC090200F409020027\r
+S315000082C00DC0A0E100D82DE904B04CE228D04DE263\r
+S315000082D010000BE514100BE518200BE51C300BE520\r
+S315000082E010201BE514301BE5003082E510301BE53D\r
+S315000082F0003093E520300BE520201BE518301BE508\r
+S31500008300032022E01C301BE5033002E024300BE59D\r
+S3150000831024301BE5000053E31300000A18301BE568\r
+S3150000832000308DE51C301BE504308DE504309BE5FF\r
+S3150000833008308DE540009FE508109BE510201BE501\r
+S3150000834020301BE5512C00EB30109FE52C309FE5CB\r
+S31500008350002093E504309BE5033082E1003081E59F\r
+S315000083600130A0E328300BE5010000EA0030A0E36D\r
+S3150000837028300BE528001BE500A81BE9240A0200AB\r
+S31500008380301702000DC0A0E100D82DE904B04CE280\r
+S3150000839028D04DE210000BE514100BE518200BE574\r
+S315000083A01C300BE510301BE5003093E520300BE563\r
+S315000083B020201BE514301BE5032022E018301BE5C6\r
+S315000083C0033002E024300BE524301BE5000053E3C4\r
+S315000083D01300000A14301BE500308DE518301BE54C\r
+S315000083E004308DE51C301BE508308DE540009FE527\r
+S315000083F004109BE510201BE520301BE5232C00EB29\r
+S3150000840030109FE52C309FE5002093E51C301BE5DE\r
+S31500008410033082E1003081E50130A0E328300BE52E\r
+S31500008420010000EA0030A0E328300BE528001BE538\r
+S3150000843000A81BE9980A0200301702000DC0A0E14F\r
+S3150000844000D82DE904B04CE204D04DE210000BE553\r
+S3150000845014209FE510301BE5003082E50C209FE5D7\r
+S315000084600130A0E3003082E500A81BE938170200BE\r
+S31500008470341702000DC0A0E100D82DE904B04CE28B\r
+S3150000848008D04DE270319FE5003093E5000053E3DC\r
+S315000084900300000A60319FE5003093E510300BE5DC\r
+S315000084A0010000EA54019FE510000BE550319FE5FD\r
+S315000084B0003093E5000053E30600000A40319FE5D3\r
+S315000084C00020A0E3002083E52C319FE534019FE5E1\r
+S315000084D0001093E5ED2B00EB2C319FE510101BE50A\r
+S315000084E09123C3E04327A0E110001BE5C03FA0E1B4\r
+S315000084F0021063E00130A0E10332A0E1013083E025\r
+S315000085000331A0E1013083E08330A0E1013083E054\r
+S315000085100321A0E1023083E08331A0E1013083E052\r
+S315000085208331A0E110101BE5010063E00030A0E1FB\r
+S315000085308330A0E1003083E08321A0E1023083E0B4\r
+S315000085400332A0E1033060E08311A0E1011063E093\r
+S315000085500112A0E1011060E0AC309FE510201BE5A0\r
+S315000085609203C3E04327A0E110001BE5C03FA0E152\r
+S31500008570020063E00030A0E18330A0E1003083E038\r
+S315000085800322A0E1023083E08330A0E1003083E0E3\r
+S315000085908322A0E1023083E0011063E010100BE5B6\r
+S315000085A010101BE5000051E3020000AA10201BE595\r
+S315000085B0062142E210200BE510301BE50231C3E331\r
+S315000085C010300BE510001BE5000050E30200000A26\r
+S315000085D010101BE514100BE5010000EA1C209FE5B6\r
+S315000085E014200BE514001BE50C309FE5000083E525\r
+S315000085F010301BE50300A0E100A81BE938170200B4\r
+S3150000860024D95B0734170200080B0200C989475EAC\r
+S315000086100DC0A0E100D82DE904B04CE21CD04DE21B\r
+S3150000862010000BE514100BE518200BE510301BE5C8\r
+S31500008630000053E3030000BA10301BE53F0053E38C\r
+S31500008640000000CA020000EA0130A0E31C300BE57E\r
+S31500008650250000EA98309FE510201BE5023193E7DC\r
+S31500008660000053E30200000A0230A0E31C300BE5D1\r
+S315000086701D0000EA78109FE510201BE514301BE56D\r
+S31500008680023181E70030A0E300308DE510301BE5B4\r
+S315000086900321A0E15C309FE5023083E004308DE5E4\r
+S315000086A010201BE50230A0E18331A0E1033062E037\r
+S315000086B00321A0E140309FE5023083E008308DE5DC\r
+S315000086C010001BE50010A0E318201BE514301BE585\r
+S315000086D0EE2D00EB1C209FE510301BE5030192E711\r
+S315000086E0FF2D00EB0030A0E31C300BE51C001BE562\r
+S315000086F000A81BE970350200903D020074360200A6\r
+S315000087000DC0A0E100D82DE904B04CE208D04DE23E\r
+S3150000871010000BE510301BE5000053E3030000BA20\r
+S3150000872010301BE53F0053E3000000CA020000EAD8\r
+S315000087300130A0E314300BE50D0000EA38109FE588\r
+S3150000874010201BE50030A0E3023181E72C209FE5D5\r
+S3150000875010301BE5030192E7E42D00EB1C209FE59A\r
+S3150000876010301BE5030192E7DA2D00EB0030A0E3A1\r
+S3150000877014300BE514001BE500A81BE97035020058\r
+S31500008780903D02000DC0A0E100D82DE904B04CE2F6\r
+S315000087901CD04DE210000BE514100BE54030A0E3B1\r
+S315000087A018300BE5D4309FE5003093E5000053E325\r
+S315000087B00200000A0230A0E31C300BE52D0000EA9F\r
+S315000087C0B8209FE510301BE5003082E50030A0E3BD\r
+S315000087D000308DE518301BE50321A0E1A0309FE5B0\r
+S315000087E0023083E004308DE518201BE50230A0E15D\r
+S315000087F08331A0E1033062E00321A0E184309FE5EC\r
+S31500008800023083E008308DE518001BE50010A0E378\r
+S3150000881014201BE510301BE59C2D00EB68209FE51E\r
+S3150000882018301BE5032192E760309FE5030052E113\r
+S315000088300E00001A50109FE518201BE510301BE5AE\r
+S31500008840023181E748109FE518201BE514301BE52F\r
+S31500008850023181E73C009FE518101BE518301BE547\r
+S315000088600321A0E118309FE5023083E0013180E763\r
+S315000088700030A0E31C300BE51C001BE500A81BE93B\r
+S3150000888070360200903D02007436020004140200A5\r
+S31500008890A8210100081502000C1602000DC0A0E177\r
+S315000088A000D82DE904B04CE204D04DE24030A0E3FC\r
+S315000088B010300BE564209FE50030A0E3003082E530\r
+S315000088C05C009FE510101BE558209FE510301BE566\r
+S315000088D0033192E7012190E7083093E5030052E166\r
+S315000088E00B00001A38109FE510201BE538309FE575\r
+S315000088F0023181E734109FE510201BE50030A0E32C\r
+S31500008900023181E728109FE510201BE50030A0E327\r
+S31500008910023181E70030A0E30300A0E100A81BE9D3\r
+S315000089207036020004140200903D0200A8210100E6\r
+S31500008930081502000C1602000DC0A0E100D82DE9B2\r
+S3150000894004B04CE218D04DE210000BE514100BE514\r
+S3150000895018200BE51C300BE510301BE5000053E337\r
+S31500008960030000BA10301BE53F0053E3000000CAC5\r
+S31500008970020000EA0130A0E324300BE5230000EA00\r
+S3150000898010201BE5C23FA0E1233FA0E1033082E0B7\r
+S315000089904321A0E10231A0E3603083E2023293E793\r
+S315000089A020300BE510201BE5C23FA0E1233FA0E1EC\r
+S315000089B0033082E04331A0E10331A0E1023063E0FD\r
+S315000089C08321A0E120301BE53332A0E120300BE506\r
+S315000089D014201BE520301BE52331A0E1013003E222\r
+S315000089E0003082E518201BE520301BE5A331A0E10D\r
+S315000089F0013003E2003082E51C201BE520301BE538\r
+S31500008A00033003E2003082E50030A0E324300BE5BA\r
+S31500008A1024001BE500A81BE90DC0A0E100D82DE944\r
+S31500008A2004B04CE20CD04DE210000BE50B30E0E355\r
+S31500008A300C004BE2033080E0060083E810201BE5C3\r
+S31500008A400030A0E3003082E510201BE50030A0E3F3\r
+S31500008A500430C2E510201BE50739A0E3823183E22A\r
+S31500008A60003093E5083082E510201BE510301BE549\r
+S31500008A70083093E50C3082E510201BE51030A0E3AA\r
+S31500008A80033082E00020A0E30010A0E3060083E8A4\r
+S31500008A9010201BE51830A0E3032082E00B30E0E352\r
+S31500008AA00C004BE2033080E0030093E8030082E809\r
+S31500008AB010201BE50030A0E32030C2E500A81BE92A\r
+S31500008AC00DC0A0E110D82DE904B04CE20CD04DE267\r
+S31500008AD014000BE514201BE50739A0E3823183E27D\r
+S31500008AE0003093E50C3082E514301BE514201BE5BD\r
+S31500008AF00C1093E5083092E5030051E11700002AB7\r
+S31500008B0014201BE50130A0E30430C2E514201BE568\r
+S31500008B101030A0E303C082E014301BE5003093E57B\r
+S31500008B200310A0E10020A0E30140A0E10030A0E393\r
+S31500008B3014201BE514101BE50C0092E5082091E5B6\r
+S31500008B40002062E0012042E20210A0E10020A0E342\r
+S31500008B50013083E1024084E118008CE8240000EA39\r
+S31500008B6014301BE514201BE50C1093E5083092E544\r
+S31500008B70030051E11E00003A14301BE50430D3E532\r
+S31500008B80010053E30700001A14201BE514301BE50F\r
+S31500008B90003093E5013083E2003082E514201BE5C6\r
+S31500008BA00030A0E30430C2E514201BE51030A0E33A\r
+S31500008BB003C082E014301BE5003093E50310A0E10A\r
+S31500008BC00020A0E30140A0E10030A0E314201BE553\r
+S31500008BD014101BE50C0092E5082091E5002062E0E8\r
+S31500008BE00210A0E10020A0E3013083E1024084E10D\r
+S31500008BF018008CE814201BE51830A0E3032082E05F\r
+S31500008C0018200BE514201BE51030A0E3032082E0BA\r
+S31500008C101C200BE518101BE5042091E51C101BE534\r
+S31500008C20043091E5030052E10E00008A18301BE57E\r
+S31500008C30042093E51C101BE5043091E5030052E186\r
+S31500008C400500001A18301BE5002093E51C101BE5F3\r
+S31500008C50003091E5030052E10200008A14301BE562\r
+S31500008C600120A0E32020C3E514301BE52030D3E526\r
+S31500008C700300A0E110A81BE90DC0A0E100D82DE972\r
+S31500008C8004B04CE22CD04DE210304BE2030003E876\r
+S31500008C9038304BE20300A0E110304BE2060013E847\r
+S31500008CA05CFFFFEB38304BE20300A0E183FFFFEBF4\r
+S31500008CB00030A0E1FF3003E2000053E3F8FFFF0AB3\r
+S31500008CC000A81BE90DC0A0E100D82DE904B04CE2D4\r
+S31500008CD004D04DE210000BE510301BE5050053E310\r
+S31500008CE00100008A04009FE5E82900EB00A81BE9C3\r
+S31500008CF0480B02000DC0A0E100D82DE904B04CE2FB\r
+S31500008D0004D04DE210000BE510301BE5050053E3DF\r
+S31500008D100100008A04009FE5DC2900EB00A81BE99E\r
+S31500008D20900B02000DC0A0E100D82DE904B04CE282\r
+S31500008D3004D04DE210000BE510301BE5050053E3AF\r
+S31500008D400100008A04009FE5D02900EB00A81BE97A\r
+S31500008D50E40B02000DC0A0E100D82DE904B04CE2FE\r
+S31500008D6030D04DE20231A0E3013783E2003093E5D3\r
+S31500008D7010300BE58231A0E3013783E2003093E542\r
+S31500008D8014300BE5C231A0E3013783E2003093E5EE\r
+S31500008D9018300BE50231A0E3013783E2403083E26D\r
+S31500008DA0003093E51C300BE50231A0E3013783E286\r
+S31500008DB0803083E2003093E520300BE50231A0E3FA\r
+S31500008DC0013783E2903083E2003093E524300BE5EF\r
+S31500008DD00231A0E3013783E2A03083E2003093E55D\r
+S31500008DE028300BE50231A0E3013783E2B03083E29D\r
+S31500008DF0003093E52C300BE50231A0E3013783E226\r
+S31500008E00C03083E2003093E530300BE50231A0E359\r
+S31500008E10013783E2703083E2003093E534300BE5AE\r
+S31500008E200E305BE5013003E2000053E30400000A64\r
+S31500008E30B0315BE1833BA0E1A33BA0E1B6334BE15C\r
+S31500008E40010000EA0030A0E3B6334BE1B6335BE144\r
+S31500008E50B4229FE5B030C2E1AC229FE513305BE55A\r
+S31500008E602332A0E1FF3003E2013003E20230C2E523\r
+S31500008E7016305BE52332A0E1FF3003E2013003E266\r
+S31500008E80000053E31800000A16305BE5033003E2E6\r
+S31500008E90030053E303F19F97160000EAAC8E00002F\r
+S31500008EA0BC8E0000CC8E0000DC8E000058329FE5A0\r
+S31500008EB00120A0E30320C3E50E0000EA48329FE547\r
+S31500008EC00220A0E30320C3E50A0000EA38329FE54A\r
+S31500008ED00420A0E30320C3E5060000EA28329FE54C\r
+S31500008EE00820A0E30320C3E5020000EA18329FE54C\r
+S31500008EF00020A0E30320C3E50C229FE5B4315BE12B\r
+S31500008F00033BA0E1233BA0E1B430C2E1F8219FE599\r
+S31500008F1018305BE51F3003E20630C2E5E8219FE525\r
+S31500008F20BC315BE1033BA0E1233BA0E1B231C2E1EE\r
+S31500008F3021305BE5A333A0E1FF3003E2000053E3F9\r
+S31500008F400400001AB4325BE1033BA0E1233BA0E13D\r
+S31500008F50B8334BE1010000EA0030A0E3B8334BE13F\r
+S31500008F60B8335BE1A0219FE5B830C2E11D305BE577\r
+S31500008F70A333A0E1FF3003E2000053E30400001A2C\r
+S31500008F80B0325BE1833BA0E1A33BA0E1BA334BE106\r
+S31500008F90010000EA0030A0E3BA334BE1BA335BE1EB\r
+S31500008FA064219FE5BA30C2E12D305BE5A333A0E131\r
+S31500008FB0FF3003E2000053E30600000A48219FE564\r
+S31500008FC00030A0E3BC30C2E13C219FE50030A0E3C5\r
+S31500008FD0BE30C2E1160000EA2D305BE5A332A0E107\r
+S31500008FE0FF3003E2013003E2000053E30600000A0B\r
+S31500008FF014219FE50030A0E3BC30C2E108219FE5C3\r
+S315000090000130A0E3BE30C2E1090000EAF8209FE586\r
+S31500009010BE325BE1833BA0E1A33BA0E1BC30C2E1F1\r
+S31500009020E4209FE5B0335BE1033BA0E1233BA0E1F5\r
+S31500009030BE30C2E129305BE5A333A0E1FF3003E295\r
+S31500009040000053E30300001A2C305BE5073003E20F\r
+S315000090503B304BE5010000EA0030A0E33B304BE536\r
+S315000090603B305BE5A0209FE50730C2E50030A0E37A\r
+S3150000907094209FE51130C2E50E305BE52331A0E177\r
+S31500009080FF3003E2013003E2000053E30D00000A63\r
+S3150000909031305BE5A333A0E1FF3003E2000053E388\r
+S315000090A00800001A31305BE52333A0E1FF3003E20C\r
+S315000090B0013003E2000053E30200001A0130A0E38E\r
+S315000090C044209FE51130C2E525305BE5A333A0E1DE\r
+S315000090D0FF3003E2000053E30300001A28305BE58B\r
+S315000090E0073003E23C304BE5010000EA0030A0E324\r
+S315000090F03C304BE53C205BE50C309FE51020C3E59A\r
+S315000091000030A0E30300A0E100A81BE9943E0200A2\r
+S315000091100DC0A0E100D82DE904B04CE208D04DE224\r
+S3150000912010000BE50030A0E314300BE514301BE50E\r
+S31500009130040053E30000009A090000EA10001BE552\r
+S3150000914014101BE524209FE514301BE5033192E73C\r
+S31500009150013180E714301BE5013083E214300BE562\r
+S31500009160F1FFFFEA0030A0E30300A0E100A81BE93D\r
+S31500009170943E02000DC0A0E100D82DE904B04CE2F7\r
+S315000091801CD04DE210000BE5D0319FE5B030D3E1A5\r
+S3150000919014300BE510301BE5B030D3E118300BE589\r
+S315000091A00030A0E31C300BE518301BE5000053E34C\r
+S315000091B00400000A14301BE5000053E30100001A06\r
+S315000091C00130A0E31C300BE50030A0E320300BE5B6\r
+S315000091D018301BE5000053E30400001A14301BE5A9\r
+S315000091E0000053E30100000A0130A0E320300BE544\r
+S315000091F018201BE514301BE5030052E10030A09354\r
+S315000092000130A08324300BE518201BE514301BE544\r
+S31500009210030052E10030A0230130A03328300BE5D3\r
+S315000092201C301BE5000053E30200000A10001BE59A\r
+S31500009230FE0000EB400000EA20301BE5000053E38F\r
+S315000092400200000A10001BE53B0100EB3A0000EAB1\r
+S3150000925024301BE5000053E30200000A10001BE562\r
+S31500009260770100EB340000EA28301BE5000053E3E9\r
+S315000092700200000A10001BE5AC0100EB2E0000EA1C\r
+S3150000928010301BE5B231D3E10300A0E1EC0300EBA3\r
+S3150000929010301BE5BC20D3E110301BE5BE30D3E116\r
+S315000092A00200A0E10310A0E10020A0E3580200EBB9\r
+S315000092B010301BE51030D3E50300A0E1320200EBCD\r
+S315000092C010301BE5BA30D3E10300A0E10010A0E3A3\r
+S315000092D0A10200EB10301BE5B830D3E10300A0E19A\r
+S315000092E00010A0E3D20200EB10301BE50730D3E5F7\r
+S315000092F00300A0E10010A0E3030300EB10301BE520\r
+S315000093000620D3E510301BE50330D3E50200A0E1CB\r
+S315000093100310A0E10020A0E3300300EB10301BE5B2\r
+S31500009320B420D3E110301BE50230D3E50200A0E102\r
+S315000093300310A0E10020A0E3870300EB10301BE53B\r
+S315000093401130D3E518001BE514101BE50320A0E13E\r
+S31500009350E90300EB0030A0E30300A0E100A81BE94D\r
+S31500009360943E02000DC0A0E100D82DE904B04CE205\r
+S3150000937008D04DE210000BE514100BE514301BE588\r
+S31500009380B030D3E1000053E30800000A10301BE5BB\r
+S31500009390050053E30A00008A14301BE5B030D3E120\r
+S315000093A040029FE50310A0E1382800EB040000EA24\r
+S315000093B010301BE5050053E30100008A28029FE5F3\r
+S315000093C0322800EB10301BE5050053E30400008A49\r
+S315000093D014301BE5B430D3E110029FE50310A0E181\r
+S315000093E02A2800EB10301BE5050053E30400008A31\r
+S315000093F014301BE50630D3E5F4019FE50310A0E128\r
+S31500009400222800EB10301BE5050053E30400008A18\r
+S3150000941014301BE5B231D3E1D8019FE50310A0E17A\r
+S315000094201A2800EB14301BE50730D3E5000053E3A0\r
+S315000094300800000A10301BE5050053E30A00008A05\r
+S3150000944014301BE50730D3E5AC019FE50310A0E11E\r
+S315000094500E2800EB040000EA10301BE5050053E37C\r
+S315000094600100008A94019FE5082800EB14301BE5F3\r
+S31500009470B830D3E1000053E30800000A10301BE5C2\r
+S31500009480050053E30A00008A14301BE5B830D3E127\r
+S315000094906C019FE50310A0E1FC2700EB040000EA45\r
+S315000094A010301BE5050053E30100008A54019FE5D7\r
+S315000094B0F62700EB14301BE5BA30D3E1000053E386\r
+S315000094C00800000A10301BE5050053E30A00008A75\r
+S315000094D014301BE5BA30D3E12C019FE50310A0E15F\r
+S315000094E0EA2700EB040000EA10301BE5050053E311\r
+S315000094F00100008A14019FE5E42700EB14301BE508\r
+S315000095001030D3E5000053E30800000A10301BE5D5\r
+S31500009510050053E30A00008A14301BE51030D3E53A\r
+S31500009520EC009FE50310A0E1D82700EB040000EA59\r
+S3150000953010301BE5050053E30100008AD4009FE5C7\r
+S31500009540D22700EB10301BE5050053E30400008A28\r
+S3150000955014301BE5BC30D3E1BC009FE50310A0E14D\r
+S31500009560CA2700EB10301BE5050053E30400008A10\r
+S3150000957014301BE5BE30D3E1A0009FE50310A0E147\r
+S31500009580C22700EB10301BE5050053E30400008AF8\r
+S3150000959014301BE51130D3E584009FE50310A0E1EC\r
+S315000095A0BA2700EB10301BE5050053E30400008AE0\r
+S315000095B014301BE50330D3E568009FE50310A0E1F6\r
+S315000095C0B22700EB10301BE5050053E30400008AC8\r
+S315000095D014301BE50230D3E54C009FE50310A0E1F3\r
+S315000095E0AA2700EB00A81BE9540C0200640C020039\r
+S315000095F0740C0200880C02009C0C0200B00C0200E5\r
+S31500009600C40C0200D80C0200EC0C0200000D020093\r
+S31500009610140D0200280D02003C0D0200500D020040\r
+S31500009620600D0200700D0200840D0200A00D020004\r
+S315000096300DC0A0E100D82DE904B04CE204D04DE203\r
+S3150000964010000BE510301BE5B030D3E10300A0E1BC\r
+S31500009650190100EBF00000EBF000A0E3F80200EBCC\r
+S3150000966010301BE5B420D3E110301BE50230D3E502\r
+S315000096700200A0E10310A0E10020A0E3B60200EB87\r
+S3150000968010301BE50620D3E510301BE50330D3E58B\r
+S315000096900200A0E10310A0E10020A0E34F0200EBCE\r
+S315000096A010301BE50730D3E50300A0E10010A0E36E\r
+S315000096B0150200EB10301BE5BC20D3E110301BE592\r
+S315000096C0BE30D3E10200A0E10310A0E10020A0E338\r
+S315000096D04F0100EB10301BE51030D3E50300A0E18D\r
+S315000096E0290100EB10301BE5BA30D3E10300A0E1FD\r
+S315000096F00010A0E3980100EB10301BE5B830D3E171\r
+S315000097000300A0E10010A0E3C90100EBD10000EBCB\r
+S315000097102231A0E3013783E20228A0E3002083E59B\r
+S3150000972010301BE5B231D3E10300A0E1C40200EB27\r
+S315000097300030A0E30300A0E100A81BE90DC0A0E1F2\r
+S3150000974000D82DE904B04CE204D04DE210000BE540\r
+S31500009750F000A0E3BA0200EB1231A0E3013783E286\r
+S315000097600228A0E3002083E510301BE5B030D3E1EA\r
+S315000097700300A0E1D00000EB10301BE5B420D3E1DC\r
+S3150000978010301BE50230D3E50200A0E10310A0E192\r
+S315000097900020A0E3700200EB10301BE50620D3E5A5\r
+S315000097A010301BE50330D3E50200A0E10310A0E171\r
+S315000097B00020A0E3090200EBA60000EB10301BE539\r
+S315000097C0B231D3E10300A0E19D0200EB10301BE5AE\r
+S315000097D0BC20D3E110301BE5BE30D3E10200A0E18E\r
+S315000097E00310A0E10020A0E3090100EB10301BE507\r
+S315000097F01030D3E50300A0E1E30000EB10301BE5D9\r
+S31500009800BA30D3E10300A0E10010A0E3520100EB5F\r
+S3150000981010301BE5B830D3E10300A0E10010A0E34F\r
+S31500009820830100EB10301BE50730D3E50300A0E110\r
+S315000098300010A0E3B40100EB0030A0E30300A0E1B8\r
+S3150000984000A81BE90DC0A0E100D82DE904B04CE248\r
+S3150000985004D04DE210000BE510301BE5B231D3E128\r
+S315000098600300A0E1760200EB10301BE5B420D3E143\r
+S3150000987010301BE50230D3E50200A0E10310A0E1A1\r
+S315000098800020A0E3340200EB10301BE50620D3E5F0\r
+S3150000989010301BE50330D3E50200A0E10310A0E180\r
+S315000098A00020A0E3CD0100EB10301BE50730D3E527\r
+S315000098B00300A0E10010A0E3930100EB10301BE5CC\r
+S315000098C0BC20D3E110301BE5BE30D3E10200A0E19D\r
+S315000098D00310A0E10020A0E3CD0000EB10301BE553\r
+S315000098E01030D3E50300A0E1A70000EB10301BE524\r
+S315000098F0BA30D3E10300A0E10010A0E3160100EBAB\r
+S3150000990010301BE5B830D3E10300A0E10010A0E35E\r
+S31500009910470100EB10301BE5B030D3E10300A0E1B6\r
+S31500009920650000EB0030A0E30300A0E100A81BE9FE\r
+S315000099300DC0A0E100D82DE904B04CE204D04DE200\r
+S3150000994010000BE510301BE5B231D3E10300A0E1B6\r
+S315000099503B0200EB10301BE5B420D3E110301BE5D1\r
+S315000099600230D3E50200A0E10310A0E10120A0E34C\r
+S31500009970F90100EB10301BE50620D3E510301BE59E\r
+S315000099800330D3E50200A0E10310A0E10120A0E32B\r
+S31500009990920100EB10301BE50730D3E50300A0E190\r
+S315000099A00110A0E3580100EB10301BE5BC20D3E109\r
+S315000099B010301BE5BE30D3E10200A0E10310A0E1A8\r
+S315000099C00120A0E3920000EB10301BE51030D3E538\r
+S315000099D00300A0E16C0000EB10301BE5BA30D3E1C8\r
+S315000099E00300A0E10110A0E3DB0000EB10301BE553\r
+S315000099F0B830D3E10300A0E10110A0E30C0100EBB5\r
+S31500009A0010301BE5B030D3E10300A0E12A0000EBE3\r
+S31500009A100030A0E30300A0E100A81BE90DC0A0E10F\r
+S31500009A2000D82DE904B04CE20000A0E14231A0E3E9\r
+S31500009A30013783E20330D3E5FF3003E2A333A0E12D\r
+S31500009A40FF3003E2000053E3F7FFFF0A0030A0E314\r
+S31500009A500300A0E100A81BE90DC0A0E100D82DE994\r
+S31500009A6004B04CE20000A0E18231A0E3013783E2BA\r
+S31500009A700330D3E5FF3003E2A332A0E1FF3003E277\r
+S31500009A80013003E2000053E3F6FFFF1AC231A0E300\r
+S31500009A90013783E20330D3E5FF3003E2A332A0E1CE\r
+S31500009AA0FF3003E2013003E2000053E3EDFFFF1A4B\r
+S31500009AB00030A0E30300A0E100A81BE90DC0A0E16F\r
+S31500009AC000D82DE904B04CE20CD04DE210000BE5B5\r
+S31500009AD010301BE5000053E31900000A0231A0E331\r
+S31500009AE0013783E2003093E514300BE514101BE5D3\r
+S31500009AF018100BE510301BE5832BA0E118101BE5B1\r
+S31500009B00A134A0E1023083E1E33BA0E118300BE58C\r
+S31500009B1018301BE514300BE512305BE5013083E3AA\r
+S31500009B2012304BE50231A0E3013783E214201BE536\r
+S31500009B30002083E54C209FE5B0315BE1B030C2E107\r
+S31500009B400D0000EA0231A0E3013783E2003093E51D\r
+S31500009B5014300BE512305BE50130C3E312304BE500\r
+S31500009B600231A0E3013783E214201BE5002083E5E0\r
+S31500009B7010209FE50030A0E3B030C2E10030A0E342\r
+S31500009B800300A0E100A81BE9943E02000DC0A0E17D\r
+S31500009B9000D82DE904B04CE208D04DE210000BE5E8\r
+S31500009BA068309FE51030D3E514300BE510201BE537\r
+S31500009BB014301BE5030052E11100000A10301BE5CA\r
+S31500009BC0000053E30600000A0231A0E3013783E2F6\r
+S31500009BD0A03083E210201BE5072002E2002083E587\r
+S31500009BE0040000EA0231A0E3013783E2A03083E2F9\r
+S31500009BF00221A0E3002083E510209FE510305BE5FD\r
+S31500009C001030C2E50030A0E30300A0E100A81BE984\r
+S31500009C10943E02000DC0A0E100D82DE904B04CE24C\r
+S31500009C2014D04DE210000BE514100BE518200BE5DF\r
+S31500009C3020319FE5BC30D3E11C300BE514319FE5A4\r
+S31500009C40BE30D3E120300BE510201BE51C301BE5B0\r
+S31500009C50030052E10400001A14201BE520301BE526\r
+S31500009C60030052E10000001A370000EA10301BE53D\r
+S31500009C70000053E30800001A14301BE5000053E30C\r
+S31500009C800500001A0231A0E3013783E2803083E247\r
+S31500009C900221A0E3002083E5250000EA10301BE541\r
+S31500009CA0030053E31A00009A10301BE5820053E3C9\r
+S31500009CB01700008A14301BE5040053E31400009AD1\r
+S31500009CC014301BE5030C53E31100008A0221A0E3C4\r
+S31500009CD0012782E2802082E218301BE5033FA0E1E3\r
+S31500009CE0011103E210301BE50338A0E1FE34C3E3A3\r
+S31500009CF02338A0E10338A0E1031081E114301BE50D\r
+S31500009D00033BA0E1233BA0E1033081E1003082E583\r
+S31500009D10070000EA0221A0E3012782E2802082E216\r
+S31500009D2018301BE5033FA0E1013103E2023283E371\r
+S31500009D30003082E51C209FE5B0315BE1BC30C2E11A\r
+S31500009D4010209FE5B4315BE1BE30C2E10030A0E3F4\r
+S31500009D500300A0E100A81BE9943E02000DC0A0E1AB\r
+S31500009D6000D82DE904B04CE214D04DE210000BE50A\r
+S31500009D7014100BE5B4309FE5BA30D3E118300BE58B\r
+S31500009D8010201BE518301BE5030052E12400000AF1\r
+S31500009D9010301BE5000053E31900000A14301BE5E0\r
+S31500009DA0000053E30600000A18201BE510301BE5EF\r
+S31500009DB0030052E10030A0930130A08320300BE570\r
+S31500009DC0010000EA0030A0E320300BE520301BE55F\r
+S31500009DD01C300BE50221A0E3012782E2802082E20B\r
+S31500009DE01C301BE5033FA0E1011103E210301BE527\r
+S31500009DF0833BA0E1A33BA0E1033081E1003082E593\r
+S31500009E00040000EA0231A0E3013783E2803083E2F6\r
+S31500009E100221A0E3002083E510209FE5B0315BE13D\r
+S31500009E20BA30C2E10030A0E30300A0E100A81BE9BC\r
+S31500009E30943E02000DC0A0E100D82DE904B04CE22A\r
+S31500009E4014D04DE210000BE514100BE5B4309FE57D\r
+S31500009E50B830D3E118300BE510201BE518301BE5B0\r
+S31500009E60030052E12400000A10301BE5000053E312\r
+S31500009E701900000A14301BE5000053E30600000A2F\r
+S31500009E8018201BE510301BE5030052E10030A093BB\r
+S31500009E900130A08320300BE5010000EA0030A0E38A\r
+S31500009EA020300BE520301BE51C300BE50221A0E33A\r
+S31500009EB0012782E2902082E21C301BE5033FA0E1ED\r
+S31500009EC0011103E210301BE5033BA0E1233BA0E1B7\r
+S31500009ED0033081E1003082E5040000EA0231A0E3AC\r
+S31500009EE0013783E2903083E20221A0E3002083E57C\r
+S31500009EF010209FE5B0315BE1B830C2E10030A0E34D\r
+S31500009F000300A0E100A81BE9943E02000DC0A0E1F9\r
+S31500009F1000D82DE904B04CE214D04DE210000BE558\r
+S31500009F2014100BE5B0309FE50730D3E518300BE58C\r
+S31500009F3010201BE518301BE5030052E12300000A40\r
+S31500009F4010301BE5000053E31800000A14301BE52F\r
+S31500009F50000053E30600000A18201BE510301BE53D\r
+S31500009F60030052E10030A0930130A08320300BE5BE\r
+S31500009F70010000EA0030A0E320300BE520301BE5AD\r
+S31500009F801C300BE50221A0E3012782E2B02082E229\r
+S31500009F901C301BE5033FA0E1011103E210301BE575\r
+S31500009FA0073003E2033081E1003082E5040000EA75\r
+S31500009FB00231A0E3013783E2B03083E20221A0E35D\r
+S31500009FC0002083E510209FE510305BE50730C2E5F1\r
+S31500009FD00030A0E30300A0E100A81BE9943E0200C4\r
+S31500009FE00DC0A0E100D82DE904B04CE224D04DE22A\r
+S31500009FF010000BE514100BE518200BE554319FE516\r
+S3150000A0000630D3E51C300BE510201BE51C301BE5A4\r
+S3150000A010030052E10500001A38319FE50320D3E51D\r
+S3150000A02014301BE5020053E10000001A460000EA66\r
+S3150000A03018301BE5000053E30600000A1C201BE550\r
+S3150000A04010301BE5030052E10030A0930130A083DD\r
+S3150000A0502C300BE5010000EA0030A0E32C300BE5C4\r
+S3150000A0602C301BE520300BE514301BE5000053E3D4\r
+S3150000A0700030A0030130A01324300BE514301BE59B\r
+S3150000A080010053E31400000A14301BE5020053E3F9\r
+S3150000A0900E00000A14301BE5040053E30800000A12\r
+S3150000A0A014301BE5080053E30200001A0330A0E356\r
+S3150000A0B030300BE50A0000EA0030E0E330300BE513\r
+S3150000A0C0070000EA0230A0E330300BE5040000EAA6\r
+S3150000A0D00130A0E330300BE5010000EA0030A0E3D8\r
+S3150000A0E030300BE530301BE528300BE5C211A0E31C\r
+S3150000A0F0011781E220301BE5033FA0E1012103E2C5\r
+S3150000A10024301BE5033AA0E1013603E2032082E195\r
+S3150000A11028301BE50338A0E1033803E2032082E17F\r
+S3150000A12010301BE51F3003E2033082E1F63683E38D\r
+S3150000A130003081E51C209FE510305BE50630C2E566\r
+S3150000A14010209FE514305BE50330C2E50030A0E344\r
+S3150000A1500300A0E100A81BE9943E02000DC0A0E1A7\r
+S3150000A16000D82DE904B04CE218D04DE210000BE502\r
+S3150000A17014100BE518200BE5C0309FE5B430D3E191\r
+S3150000A1801C300BE510201BE51C301BE5030052E1DB\r
+S3150000A1900500001AA4309FE50220D3E514301BE524\r
+S3150000A1A0020053E10000001A210000EA18301BE506\r
+S3150000A1B0000053E30600000A1C201BE510301BE5D7\r
+S3150000A1C0030052E10030A0930130A08324300BE558\r
+S3150000A1D0010000EA0030A0E324300BE524301BE543\r
+S3150000A1E020300BE58221A0E3012782E220301BE527\r
+S3150000A1F0033FA0E1011103E214301BE50336A0E1A1\r
+S3150000A200013A03E2031081E110301BE5033BA0E1B4\r
+S3150000A210233BA0E1033081E1003082E51C209FE56D\r
+S3150000A220B0315BE1B430C2E110209FE514305BE54C\r
+S3150000A2300230C2E50030A0E30300A0E100A81BE95C\r
+S3150000A240943E02000DC0A0E100D82DE904B04CE216\r
+S3150000A25008D04DE210000BE598309FE5B231D3E10E\r
+S3150000A26014300BE510201BE514301BE5030052E10A\r
+S3150000A2701D00000A0221A0E3012782E2402082E2BB\r
+S3150000A2800231A0E3013783E2403083E2003093E5F8\r
+S3150000A290FF3FC3E30330C3E3003082E50221A0E3BE\r
+S3150000A2A0012782E2402082E210301BE5031BA0E179\r
+S3150000A2B0211BA0E110301BE5033BA0E1233BA0E1FD\r
+S3150000A2C00300E0E10231A0E3013783E2403083E29C\r
+S3150000A2D0003093E5033000E0033081E1003082E591\r
+S3150000A2E010209FE5B0315BE1B231C2E10030A0E35E\r
+S3150000A2F00300A0E100A81BE9943E02000DC0A0E106\r
+S3150000A30000D82DE904B04CE20CD04DE210000BE56C\r
+S3150000A31014100BE518200BE5B0309FE51120D3E5AE\r
+S3150000A32018301BE5020053E10400001A10201BE55B\r
+S3150000A33014301BE5030052E10000001A200000EA79\r
+S3150000A34018301BE5000053E31100000A10301BE52E\r
+S3150000A3501E0E53E30E00001A10201BE514301BE5F9\r
+S3150000A360030052E10000000AABFDFFEB1231A0E34F\r
+S3150000A370013783E20127A0E3002083E50231A0E351\r
+S3150000A380013783E2703083E20020A0E3002083E5FA\r
+S3150000A390080000EA0231A0E3013783E2703083E26D\r
+S3150000A3A00321A0E3002083E52231A0E3013783E205\r
+S3150000A3B00127A0E3002083E510209FE518305BE528\r
+S3150000A3C01130C2E50030A0E30300A0E100A81BE9BC\r
+S3150000A3D0943E02000DC0A0E100D82DE904B04CE285\r
+S3150000A3E008D04DE210000BE50030A0E314300BE579\r
+S3150000A3F010204BE2003092E50010D3E5013083E2F5\r
+S3150000A400003082E5FF3001E2000053E30000001A4D\r
+S3150000A410030000EA14301BE5013083E214300BE53B\r
+S3150000A420F2FFFFEA14301BE50300A0E100A81BE9D8\r
+S3150000A4300DC0A0E100D82DE904B04CE208D04DE2F1\r
+S3150000A44010000BE50130A0E111304BE5B4214BE1E2\r
+S3150000A450B4315BE1013043E2B4314BE10338A0E1B2\r
+S3150000A4602328A0E1FF3CA0E3FF3083E2030052E192\r
+S3150000A4700000001A070000EA10004BE2003090E5E9\r
+S3150000A4800310A0E111205BE50020C1E5013083E265\r
+S3150000A490003080E5EDFFFFEA00A81BE90DC0A0E152\r
+S3150000A4A000D82DE904B04CE210D04DE210000BE5C7\r
+S3150000A4B014100BE50230A0E1B6314BE10030A0E309\r
+S3150000A4C01C300BE5B6315BE1013043E2B6314BE1BE\r
+S3150000A4D00338A0E12328A0E1FF3CA0E3FF3083E29C\r
+S3150000A4E0030052E10000001A0F0000EA10004BE2E0\r
+S3150000A4F0002090E514104BE2003091E500C0D3E552\r
+S3150000A500013083E2003081E50030D2E5012082E2AD\r
+S3150000A510002080E5FF2003E2FF300CE2030052E159\r
+S3150000A520E7FFFF0A0130A0E31C300BE51C301BE5FA\r
+S3150000A5300300A0E100A81BE90DC0A0E100D82DE9A9\r
+S3150000A54004B04CE20CD04DE210000BE50B30E0E31A\r
+S3150000A5500C004BE2033080E0060083E810201BE588\r
+S3150000A5600231A0E3073983E2B03083E2003093E59D\r
+S3150000A570103082E510201BE50830A0E3033082E0AE\r
+S3150000A5800020A0E30010A0E3060083E810201BE5EE\r
+S3150000A5900B30E0E30C004BE2033080E0030093E86D\r
+S3150000A5A0030082E810201BE50030A0E3143082E5AA\r
+S3150000A5B000A81BE90DC0A0E110D82DE904B04CE2BB\r
+S3150000A5C008D04DE214000BE50231A0E3073983E21F\r
+S3150000A5D0B03083E2003093E518300BE514301BE50C\r
+S3150000A5E018201BE5103093E5030052E11000002A05\r
+S3150000A5F014201BE50830A0E303C082E014201BE50D\r
+S3150000A6000830A0E3030082E014301BE518201BE5A8\r
+S3150000A610103093E5023063E00310A0E10020A0E3D0\r
+S3150000A620180090E8013093E00240A4E018008CE89E\r
+S3150000A630140000EA14301BE518201BE5103093E5E2\r
+S3150000A640030052E10F00003A14201BE50830A0E396\r
+S3150000A65003C082E014201BE50830A0E3030082E07B\r
+S3150000A66014301BE518201BE5103093E5023063E03B\r
+S3150000A6700310A0E10020A0E3180090E8013093E069\r
+S3150000A6800240A4E018008CE814201BE518301BE5F6\r
+S3150000A690103082E514201BE50830A0E3033082E089\r
+S3150000A6A0180093E80410A0E10300A0E110A81BE93C\r
+S3150000A6B00DC0A0E100D82DE904B04CE210D04DE267\r
+S3150000A6C010000BE510201BE514200BE510001BE520\r
+S3150000A6D0B7FFFFEB20304BE2030083E914201BE5B4\r
+S3150000A6E0043092E518201BE5020053E10E00008AB3\r
+S3150000A6F014201BE5043092E518201BE5020053E107\r
+S3150000A7000600001A14201BE5003092E51C201BE50C\r
+S3150000A710020053E10400008A14201BE5003092E594\r
+S3150000A72010201BE50130A0E3143082E510301BE554\r
+S3150000A730143093E50300A0E100A81BE90DC0A0E1D9\r
+S3150000A74000D82DE904B04CE220D04DE210304BE2A7\r
+S3150000A750030003E82C304BE20300A0E110304BE28B\r
+S3150000A760060013E873FFFFEB2C304BE20300A0E179\r
+S3150000A770CEFFFFEB0030A0E1000053E3F9FFFF0A34\r
+S3150000A78000A81BE90DC0A0E130D82DE90040A0E1EA\r
+S3150000A79004B04CE2B000A0E37E3500EB0050A0E12F\r
+S3150000A7A0084084E2000055E30400A0E10530A0E182\r
+S3150000A7B00A00000A773500EB0030A0E300C0A0E1F4\r
+S3150000A7C00310A0E1A020A0E30500A0E1A03085E5EC\r
+S3150000A7D0AC3085E5A4C085E5322400EB0530A0E168\r
+S3150000A7E00300A0E130A81BE90DC0A0E110D82DE9B7\r
+S3150000A7F00040A0E104B04CE2AC0090E50FE0A0E11F\r
+S3150000A800A8F094E5A00094E5952400EBA40094E557\r
+S3150000A810713500EB0400A0E110681BE96E3500EA13\r
+S3150000A8200DC0A0E1F0DD2DE9000053E30360A0E1D7\r
+S3150000A830026BA00304B04CE210D04DE20080A0E110\r
+S3150000A8400600A0E101A0A0E10270A0E104509BE592\r
+S3150000A850CBFFFFEB000050E30040A0E108309BE592\r
+S3150000A860BC109FE50020A0E1A0E080E22500000AE0\r
+S3150000A870000055E3A4C090E50C50A003A88080E535\r
+S3150000A880AC7080E50500A0E100C08DE540408DE993\r
+S3150000A8900C408DE55A2400EBA03094E5000053E30C\r
+S3150000A8A00300A0E11000000A010073E30500000A9E\r
+S3150000A8B000005AE30100000A0400A0E1F0AD1BE924\r
+S3150000A8C07A2400EBFBFFFFEA58309FE558109FE51E\r
+S3150000A8D0000093E554209FE554309FE55FC0A0E358\r
+S3150000A8E000C08DE5DC3900EBD63500EB34309FE552\r
+S3150000A8F034109FE5000093E538209FE530309FE552\r
+S3150000A9005EC0A0E3F5FFFFEA18309FE518109FE54B\r
+S3150000A910000093E520209FE514309FE555C0A0E395\r
+S3150000A920EEFFFFEAE8A700009C120200BC0D020041\r
+S3150000A930E40D0200080E0200600E0200800E020006\r
+S3150000A9400DC0A0E110D82DE91400A0E304B04CE23C\r
+S3150000A95004D04DE20F3500EB000050E30040A0E1CB\r
+S3150000A9600500000A7D2600EB0400A0E10110A0E32B\r
+S3150000A970912600EB0400A0E110A81BE91C309FE51E\r
+S3150000A9806FC0A0E3000093E514109FE514209FE537\r
+S3150000A99014309FE500C08DE5AF3900EBA93500EB1B\r
+S3150000A9A09C120200BC0D0200940E0200080E02006A\r
+S3150000A9B00DC0A0E110D82DE9000050E304B04CE230\r
+S3150000A9C004D04DE20040A0E10300000A682600EB37\r
+S3150000A9D00400A0E110681BE9FF3400EA1C309FE583\r
+S3150000A9E078C0A0E3000093E514109FE514209FE5CE\r
+S3150000A9F014309FE500C08DE5973900EB913500EBEB\r
+S3150000AA009C120200BC0D0200940E0200080E020009\r
+S3150000AA100DC0A0E130D82DE904B04CE204D04DE2DF\r
+S3150000AA200040A0E10800A0E3DA3400EB000050E3A8\r
+S3150000AA300050A0E10410A0E10200000AEA2500EBA4\r
+S3150000AA400500A0E130A81BE91C309FE59EC0A0E3ED\r
+S3150000AA50000093E514109FE514209FE514309FE550\r
+S3150000AA6000C08DE57C3900EB763500EB9C120200C8\r
+S3150000AA70BC0D0200A40E0200080E02000DC0A0E1EB\r
+S3150000AA8010D82DE9000050E304B04CE204D04DE2AA\r
+S3150000AA900040A0E10300000AD82500EB0400A0E175\r
+S3150000AAA010681BE9CC3400EA1C309FE5A5C0A0E382\r
+S3150000AAB0000093E514109FE514209FE514309FE5F0\r
+S3150000AAC000C08DE5643900EB5E3500EB9C12020098\r
+S3150000AAD0BC0D0200A40E0200080E02000DC0A0E18B\r
+S3150000AAE010D82DE90800A0E304B04CE204D04DE2F2\r
+S3150000AAF0A83400EB000050E30040A0E10200000A89\r
+S3150000AB00D42500EB0400A0E110A81BE91C309FE54A\r
+S3150000AB10D4C0A0E3000093E514109FE514209FE540\r
+S3150000AB2014309FE500C08DE54B3900EB453500EB51\r
+S3150000AB309C120200BC0D0200B40E0200080E0200B8\r
+S3150000AB400DC0A0E110D82DE9000050E304B04CE29E\r
+S3150000AB5004D04DE20040A0E10300000AC32500EB4B\r
+S3150000AB600400A0E110681BE99B3400EA1C309FE555\r
+S3150000AB70DBC0A0E3000093E514109FE514209FE5D9\r
+S3150000AB8014309FE500C08DE5333900EB2D3500EB21\r
+S3150000AB909C120200BC0D0200B40E0200080E020058\r
+S3150000ABA00DC0A0E110D82DE93C00A0E304B04CE2B2\r
+S3150000ABB0783400EB000050E30040A0E1041080E28E\r
+S3150000ABC00030A0E10100000A5C2500EB0430A0E1A2\r
+S3150000ABD00300A0E110A81BE90DC0A0E110D82DE9E3\r
+S3150000ABE0000050E304B04CE204D04DE20040A0E186\r
+S3150000ABF00400000A000090E5592500EB0400A0E1DE\r
+S3150000AC0010681BE9743400EA1C309FE51CC09FE500\r
+S3150000AC10000093E518109FE518209FE518309FE582\r
+S3150000AC2000C08DE50C3900EB063500EB9C120200E6\r
+S3150000AC3021010000BC0D0200C40E0200080E020035\r
+S3150000AC400DC0A0E100D82DE9000050E304B04CE2AD\r
+S3150000AC5004D04DE20200000AA00090E500681BE95E\r
+S3150000AC608F2300EA1C309FE521C0A0E3000093E596\r
+S3150000AC7014109FE514209FE514309FE500C08DE574\r
+S3150000AC80F53800EBEF3400EB9C120200BC0D02001D\r
+S3150000AC90800E0200080E02000DC0A0E100D82DE9CA\r
+S3150000ACA0000050E304B04CE204D04DE20200000A7A\r
+S3150000ACB0A00090E500681BE97C2300EA1C309FE5B4\r
+S3150000ACC027C0A0E3000093E514109FE514209FE53C\r
+S3150000ACD014309FE500C08DE5DF3800EBD93400EB7A\r
+S3150000ACE09C120200BC0D0200800E0200080E02003B\r
+S3150000ACF00DC0A0E100D82DE9000050E304B04CE2FD\r
+S3150000AD0004D04DE20200000AA00090E500681BE9AD\r
+S3150000AD10722300EA1C309FE52DC0A0E3000093E5F6\r
+S3150000AD2014109FE514209FE514309FE500C08DE5C3\r
+S3150000AD30C93800EBC33400EB9C120200BC0D0200C4\r
+S3150000AD40800E0200080E02000DC0A0E100D82DE919\r
+S3150000AD50000050E304B04CE204D04DE20200000AC9\r
+S3150000AD60A00090E500681BE93D2300EA1C309FE542\r
+S3150000AD7033C0A0E3000093E514109FE514209FE57F\r
+S3150000AD8014309FE500C08DE5B33800EBAD3400EB21\r
+S3150000AD909C120200BC0D0200800E0200080E02008A\r
+S3150000ADA004E02DE5A00090E504E09DE44E2300EAD2\r
+S3150000ADB004E02DE504E09DE4262300EA04E02DE509\r
+S3150000ADC004E09DE4522300EA04E02DE50010A0E330\r
+S3150000ADD004E09DE4602300EA04E02DE504E09DE440\r
+S3150000ADE0442300EA0DC0A0E100D82DE9000050E39D\r
+S3150000ADF004B04CE204D04DE20100000A00681BE9F1\r
+S3150000AE005E2500EA1C309FE57FC0A0E3000093E5C5\r
+S3150000AE1014109FE514209FE514309FE500C08DE5D2\r
+S3150000AE208D3800EB873400EB9C120200BC0D02004B\r
+S3150000AE30940E0200080E02000DC0A0E100D82DE914\r
+S3150000AE40000050E304B04CE204D04DE20100000AD9\r
+S3150000AE5000681BE94C2500EA1C309FE585C0A0E38D\r
+S3150000AE60000093E514109FE514209FE514309FE53C\r
+S3150000AE7000C08DE5783800EB723400EB9C120200BE\r
+S3150000AE80BC0D0200940E0200080E02000DC0A0E1E7\r
+S3150000AE9000D82DE9000050E304B04CE204D04DE2A6\r
+S3150000AEA00200000A3B2500EB00681BE9112300EABB\r
+S3150000AEB01C309FE58BC0A0E3000093E514109FE5CE\r
+S3150000AEC014209FE514309FE500C08DE5623800EB45\r
+S3150000AED05C3400EB9C120200BC0D0200940E0200D2\r
+S3150000AEE0080E02000DC0A0E100D82DE9000050E3D5\r
+S3150000AEF004B04CE204D04DE20100000A00681BE9F0\r
+S3150000AF00272500EA1C309FE592C0A0E3000093E5E8\r
+S3150000AF1014109FE514209FE514309FE500C08DE5D1\r
+S3150000AF204D3800EB473400EB9C120200BC0D0200CA\r
+S3150000AF30940E0200080E02000DC0A0E100D82DE913\r
+S3150000AF40000050E304B04CE204D04DE20200000AD7\r
+S3150000AF50B62400EB00681BE9E62200EA1C309FE5F8\r
+S3150000AF60ADC0A0E3000093E514109FE514209FE513\r
+S3150000AF7014309FE500C08DE5373800EB313400EB27\r
+S3150000AF809C120200BC0D0200A40E0200080E020074\r
+S3150000AF900DC0A0E100D82DE9000050E304B04CE25A\r
+S3150000AFA004D04DE20100000A00681BE9962400EA7D\r
+S3150000AFB01C309FE5B4C0A0E3000093E514109FE5A4\r
+S3150000AFC014209FE514309FE500C08DE5223800EB84\r
+S3150000AFD01C3400EB9C120200BC0D0200A40E020001\r
+S3150000AFE0080E02000DC0A0E100D82DE9000050E3D4\r
+S3150000AFF004B04CE204D04DE20100000A00681BE9EF\r
+S3150000B000872400EA1C309FE5BAC0A0E3000093E560\r
+S3150000B01014109FE514209FE514309FE500C08DE5D0\r
+S3150000B0200D3800EB073400EB9C120200BC0D020049\r
+S3150000B030A40E0200080E02000DC0A0E170D82DE992\r
+S3150000B040000050E304B04CE204D04DE20050A0E111\r
+S3150000B0500160A0E10700000A0D2400EB0140A0E119\r
+S3150000B0600030A0E1061093E00500A0E10020A4E274\r
+S3150000B07070681BE9672400EA1C309FE5C0C0A0E3A6\r
+S3150000B080000093E514109FE514209FE514309FE51A\r
+S3150000B09000C08DE5F03700EBEA3300EB9C120200AE\r
+S3150000B0A0BC0D0200A40E0200080E02000DC0A0E1B5\r
+S3150000B0B000D82DE9000050E304B04CE208D04DE280\r
+S3150000B0C010104BE20200000A5B2400EB10001BE5A7\r
+S3150000B0D000A81BE91C309FE5C7C0A0E3000093E56C\r
+S3150000B0E014109FE514209FE514309FE500C08DE500\r
+S3150000B0F0D93700EBD33300EB9C120200BC0D0200E3\r
+S3150000B100A40E0200080E02000DC0A0E100D82DE931\r
+S3150000B110000050E304B04CE204D04DE20100000A06\r
+S3150000B12000681BE9542400EA1C309FE5E3C0A0E355\r
+S3150000B130000093E514109FE514209FE514309FE569\r
+S3150000B14000C08DE5C43700EBBE3300EB9C12020055\r
+S3150000B150BC0D0200B40E0200080E02000DC0A0E1F4\r
+S3150000B16000D82DE9000050E304B04CE204D04DE2D3\r
+S3150000B1700100000A00681BE9422400EA1C309FE532\r
+S3150000B180EAC0A0E3000093E514109FE514209FE5B4\r
+S3150000B19014309FE500C08DE5AF3700EBA93300EB17\r
+S3150000B1A09C120200BC0D0200B40E0200080E020042\r
+S3150000B1B00DC0A0E100D82DE9000050E304B04CE238\r
+S3150000B1C004D04DE2FF2002E20100000A00681BE9FC\r
+S3150000B1D02F2400EA1C309FE5F1C0A0E3000093E5B0\r
+S3150000B1E014109FE514209FE514309FE500C08DE5FF\r
+S3150000B1F0993700EB933300EB9C120200BC0D020062\r
+S3150000B200B40E0200080E02000DC0A0E1F0DF2DE929\r
+S3150000B210000050E304B04CE204D04DE20050A0E13F\r
+S3150000B2200380A0E10160A0E1FF7002E20D00000AC8\r
+S3150000B230972300EB0140A0E10030A0E1089093E0E5\r
+S3150000B24000A0A4E20500A0E10A50A0E10940A0E1A7\r
+S3150000B2500610A0E10430A0E10720A0E100508DE532\r
+S3150000B260162400EBF0AF1BE91C309FE5F9C0A0E304\r
+S3150000B270000093E514109FE514209FE514309FE528\r
+S3150000B28000C08DE5743700EB6E3300EB9C120200B4\r
+S3150000B290BC0D0200B40E0200080E02000DC0A0E1B3\r
+S3150000B2A000D82DE9000050E304B04CE204D04DE292\r
+S3150000B2B0FF2002E20100000A00681BE9162400EAEA\r
+S3150000B2C01C309FE501CCA0E3000093E514109FE538\r
+S3150000B2D014209FE514309FE500C08DE55E3700EB36\r
+S3150000B2E0583300EB9C120200BC0D0200B40E0200A3\r
+S3150000B2F0080E02000DC0A0E100D82DE9000050E3C1\r
+S3150000B30004B04CE204D04DE20100000A00681BE9DB\r
+S3150000B3100C2400EA1C309FE51CC09FE5000093E565\r
+S3150000B32018109FE518209FE518309FE500C08DE5B1\r
+S3150000B330493700EB433300EB9C1202000601000084\r
+S3150000B340BC0D0200B40E0200080E02000DC0A0E102\r
+S3150000B35000D82DE9000050E304B04CE204D04DE2E1\r
+S3150000B3600100000A00681BE9F82300EA1C309FE58B\r
+S3150000B37043CFA0E3000093E514109FE514209FE55A\r
+S3150000B38014309FE500C08DE5333700EB2D3300EB1D\r
+S3150000B3909C120200BC0D0200B40E0200080E020050\r
+S3150000B3A00DC0A0E100D82DE9000050E304B04CE246\r
+S3150000B3B004D04DE20200000A000090E500681BE997\r
+S3150000B3C06A2300EA1C309FE54ACFA0E3000093E51C\r
+S3150000B3D014109FE514209FE514309FE500C08DE50D\r
+S3150000B3E01D3700EB173300EB9C120200BC0D020068\r
+S3150000B3F0D80E0200080E02000DC0A0E1F0D82DE91B\r
+S3150000B400000050E304B04CE204D04DE20150A0E14C\r
+S3150000B4100800000A004090E51D2300EB056090E05F\r
+S3150000B4200070A1E20720A0E10610A0E10400A0E15F\r
+S3150000B430F0681BE9502300EA1C309FE51CC09FE51D\r
+S3150000B440000093E518109FE518209FE518309FE54A\r
+S3150000B45000C08DE5003700EBFA3200EB9C120200CB\r
+S3150000B4602E010000BC0D0200D80E0200080E0200DC\r
+S3150000B4700DC0A0E100D82DE9000050E304B04CE275\r
+S3150000B48004D04DE20200000A000090E500681BE9C6\r
+S3150000B4903C2300EA1C309FE51CC09FE5000093E5B5\r
+S3150000B4A018109FE518209FE518309FE500C08DE530\r
+S3150000B4B0E93600EBE33200EB9C1202003601000095\r
+S3150000B4C0BC0D0200D80E0200080E02000DC0A0E15D\r
+S3150000B4D000D82DE9000050E304B04CE204D04DE260\r
+S3150000B4E00200000A000090E500681BE9282300EA34\r
+S3150000B4F01C309FE54FCFA0E3000093E514109FE5B5\r
+S3150000B50014209FE514309FE500C08DE5D23600EB90\r
+S3150000B510CC3200EB9C120200BC0D0200D80E0200D9\r
+S3150000B520080E02000DC0A0E100D82DE9000050E38E\r
+S3150000B53004B04CE204D04DE20200000A000090E59F\r
+S3150000B54000681BE9152300EA1C309FE51CC09FE537\r
+S3150000B550000093E518109FE518209FE518309FE539\r
+S3150000B56000C08DE5BC3600EBB63200EB9C12020043\r
+S3150000B57042010000BC0D0200D80E0200080E0200B7\r
+S3150000B5800DC0A0E170D82DE9000050E304B04CE2F4\r
+S3150000B59004D04DE20250A0E10160A0E10700000ADC\r
+S3150000B5A0004090E5BA2200EB052090E00030A1E2D1\r
+S3150000B5B00400A0E10610A0E170681BE9FA2200EA87\r
+S3150000B5C01C309FE552CFA0E3000093E514109FE5E1\r
+S3150000B5D014209FE514309FE500C08DE59E3600EBF4\r
+S3150000B5E0983200EB9C120200BC0D0200D80E02003D\r
+S3150000B5F0080E02000DC0A0E100D82DE9000050E3BE\r
+S3150000B60004B04CE204D04DE20200000A000090E5CE\r
+S3150000B61000681BE9E72200EA1C309FE51CC09FE595\r
+S3150000B620000093E518109FE518209FE518309FE568\r
+S3150000B63000C08DE5883600EB823200EB9C120200DA\r
+S3150000B6404E010000BC0D0200D80E0200080E0200DA\r
+S3150000B6500DC0A0E100D82DE9000050E304B04CE293\r
+S3150000B66004D04DE20200000A000090E500681BE9E4\r
+S3150000B670D32200EA1C309FE555CFA0E3000093E5F6\r
+S3150000B68014109FE514209FE514309FE500C08DE55A\r
+S3150000B690713600EB6B3200EB9C120200BC0D02000F\r
+S3150000B6A0D80E0200080E02000DC0A0E100D82DE958\r
+S3150000B6B0000050E304B04CE204D04DE20200000A60\r
+S3150000B6C0000090E500681BE9BF2200EA1C309FE5F8\r
+S3150000B6D01CC09FE5000093E518109FE518209FE524\r
+S3150000B6E018309FE500C08DE55B3600EB553200EB68\r
+S3150000B6F09C1202005A010000BC0D0200D80E020086\r
+S3150000B700080E02000DC0A0E100D82DE9000050E3AC\r
+S3150000B71004B04CE204D04DE20200000A000090E5BD\r
+S3150000B72000681BE9AC2200EA1C309FE516CEA0E3B8\r
+S3150000B730000093E514109FE514209FE514309FE563\r
+S3150000B74000C08DE5443600EB3E3200EB9C12020051\r
+S3150000B750BC0D0200D80E0200080E020004309FE560\r
+S3150000B760000093E50EF0A0E14C1702000DC0A0E129\r
+S3150000B77010D82DE930309FE5003093E50040A0E178\r
+S3150000B78004B04CE20300A0E1A82200EB1C309FE5C8\r
+S3150000B7900228A0E3002083E50400A0E1043043E290\r
+S3150000B7A0002083E510681BE9E62100EA4417020041\r
+S3150000B7B0184002800DC0A0E110D82DE904B04CE27B\r
+S3150000B7C00040A0E1D92100EB0400A0E1E32100EB59\r
+S3150000B7D00209A0E3300900EB30109FE530009FE539\r
+S3150000B7E00238A0E3003081E50220A0E3023843E2FC\r
+S3150000B7F0003080E5002081E5423183E2002080E5CB\r
+S3150000B800012042E2002083E50300A0E310A81BE923\r
+S3150000B81018400280144002800DC0A0E170D82DE9C6\r
+S3150000B820A110A0E18130A0E104619FE504519FE5EC\r
+S3150000B830012083E0033080E0FCE09FE5FC409FE5CB\r
+S3150000B84004B04CE2022080E001C8A0E10CD04DE239\r
+S3150000B8500EC08CE3083086E5E4309FE5082085E5D8\r
+S3150000B860011080E00228A0E3081084E5002083E5AB\r
+S3150000B87000E085E504C085E510108EE808008EE539\r
+S3150000B88000E084E504C084E5201086E8022842E250\r
+S3150000B890AC309FE5003093E5020813E30200000A8E\r
+S3150000B8A0012082E2090052E3F8FFFF9A0A0052E300\r
+S3150000B8B01C00000A80E09FE588C09FE500E08CE55B\r
+S3150000B8C084C09FE50010A0E380409FE500C08DE5A1\r
+S3150000B8D07CC09FE50120A0E178309FE50500A0E34C\r
+S3150000B8E010108DE9692100EB000094E57C2100EB46\r
+S3150000B8F064109FE564C09FE50230A0E30228A0E340\r
+S3150000B900003081E50500A0E300308CE5002081E5EC\r
+S3150000B91000208CE58B2100EB44309FE50120A0E35D\r
+S3150000B9200020C3E570A81BE938009FE5D71E00EB91\r
+S3150000B930DFFFFFEA200000603000006000000060CA\r
+S3150000B9401000006000400280B04002806CB700002A\r
+S3150000B950C43E0200A83E0200B4B7000018400280B0\r
+S3150000B96014400280E0400280E40E020054329FE55B\r
+S3150000B970030050E150329FE5F0472DE94C229FE548\r
+S3150000B9804CE29FE501A0A0E300A083E50060A0E3F0\r
+S3150000B99040329FE50090A0E10301A0E300008EE5A0\r
+S3150000B9A0006082E50221A0E3042003E4006083E551\r
+S3150000B9B024329FE5040003E4006083E52040A0E311\r
+S3150000B9C0093983E214229FE500408EE5344083E482\r
+S3150000B9D0002083E508229FE5043043E2002083E54A\r
+S3150000B9E000229FE5013AA0E3003082E5F8319FE5A9\r
+S3150000B9F01070A0E3046083E6007083E5ECC19FE568\r
+S3150000BA00EC319FE5047002E4006082E50187A0E363\r
+S3150000BA1000308CE5072082E00154A0E3703043E259\r
+S3150000BA20003082E5CC019FE500808CE5008082E550\r
+S3150000BA3000508CE5005082E50FC0A0E30420A0E38F\r
+S3150000BA405E00000A4300008AFA0D59E33E00000A30\r
+S3150000BA502D00008AA0319FE5030059E12500000A68\r
+S3150000BA601F00008A7D0D59E31800000A0C38A0E17A\r
+S3150000BA70063C83E1003083E1000051E3023E83E1AE\r
+S3150000BA8078119FE578219FE5041002E4003082E5F5\r
+S3150000BA9070319FE50204A0E3040003E4000083E59F\r
+S3150000BAA01C2042024030A0030030820504204202DE\r
+S3150000BAB00030820518319FE52020A0E3002083E5B1\r
+S3150000BAC0202042E2043043E2002083E5F087BDE80F\r
+S3150000BAD00A20A0E10360A0E317C0A0E30E0CA0E3D8\r
+S3150000BAE0E1FFFFEA20319FE5030059E10A20A001AA\r
+S3150000BAF00360A003DCFFFFEA0A20A0E10360A0E3E5\r
+S3150000BB0011C0A0E33700A0E3D7FFFFEAFC309FE5B2\r
+S3150000BB10030059E10A20A0010A60A001D2FFFF0A32\r
+S3150000BB200500008AE8309FE5030059E1CEFFFF1AC1\r
+S3150000BB300A20A0E10A60A0E1F0FFFFEA7D0C59E3CC\r
+S3150000BB40C9FFFF1A0A20A0E1E2FFFFEA0A20A0E1EE\r
+S3150000BB500A60A0E1DFFFFFEAB8309FE5030059E184\r
+S3150000BB600220A003C0FFFF0A0D00008AFA0C59E369\r
+S3150000BB700900000A0300008A9C309FE5030059E192\r
+S3150000BB800A20A001B8FFFFEA90309FE5030059E1C3\r
+S3150000BB90B5FFFF1A0220A0E3D8FFFFEA0220A0E3C8\r
+S3150000BBA0CCFFFFEA78309FE5030059E1D3FFFF0A97\r
+S3150000BBB0ADFFFF8A7D0B59E3D0FFFF0AAAFFFFEA1C\r
+S3150000BBC00A20A0E1CDFFFFEA44AC0000B0C003802C\r
+S3150000BBD00480048008800480E88004800840028095\r
+S3150000BBE0FF01FF0100010001788004807480048059\r
+S3150000BBF088800480F0100000FF130000112B000065\r
+S3150000BC00FF1F1F772880048038800480E02E000004\r
+S3150000BC10C05D0000225600000077010080BB0000D6\r
+S3150000BC208858010010B1020030402DE974309FE5BC\r
+S3150000BC30001093E5000051E36C409FE56CE09FE542\r
+S3150000BC406C509FE50100A0E368C09FE53080BD18F9\r
+S3150000BC50000083E560309FE500E084E5003085E57F\r
+S3150000BC6058309FE5040003E4001083E50128A0E3B3\r
+S3150000BC701C3043E2042003E44C1003E4040003E414\r
+S3150000BC80000083E500E084E500309CE500209CE5AB\r
+S3150000BC900338A0E1FF3803E2FF2002E2023083E12D\r
+S3150000BCA0003085E53080BDE85017020038800480FA\r
+S3150000BCB0FF01FF01348004804817020000010001E3\r
+S3150000BCC0788004801C309FE50120A0E3002083E5F6\r
+S3150000BCD014309FE50010A0E3001083E50C309FE5CB\r
+S3150000BCE0001083E50EF0A0E10880048050170200E2\r
+S3150000BCF0048004800DC0A0E110D82DE904B04CE208\r
+S3150000BD000040A0E10400A0E11E10A0E3B9FDFFEB96\r
+S3150000BD102028B0E10008A0E14008A0E10400000AE4\r
+S3150000BD20040052E33D00000A380000CA010052E355\r
+S3150000BD303000000AEC109FE5ECC09FE5002091E57D\r
+S3150000BD4000309CE5030052E1EDFFFF0A002091E57B\r
+S3150000BD5000309CE5022063E0000052E3002062B25E\r
+S3150000BD600C0052E3C4309FC50400A0E39203C3C095\r
+S3150000BD70C20F43C0002091E500309CE5030052E16C\r
+S3150000BD801400003A003091E5033060E0003081E5B0\r
+S3150000BD90002091E500309CE5030052E10100002AF5\r
+S3150000BDA000309CE5003081E584209FE584309FE5E6\r
+S3150000BDB0002083E5003091E5002091E50338A0E1FD\r
+S3150000BDC0FF2002E2FF3803E2023083E168209FE5AC\r
+S3150000BDD0003082E5CAFFFFEA003091E5003083E0DB\r
+S3150000BDE0003081E5002091E500309CE5030052E13A\r
+S3150000BDF0ECFFFF9AE9FFFFEA0038A0E12308A0E183\r
+S3150000BE00F70050E320309F9500008395C8FFFFEAB6\r
+S3150000BE10050052E3C6FFFF1AA9FFFFEBC4FFFFEAC6\r
+S3150000BE2080FFFFEBC2FFFFEA481702004C17020033\r
+S3150000BE3056555555FF01FF01388004803480048033\r
+S3150000BE4004E02DE524309FE5003093E50118A0E1DC\r
+S3150000BE500020A0E12118A0E1000053E30300A0E1C7\r
+S3150000BE60021881E104F09D0404E09DE4ACFDFFEAC4\r
+S3150000BE70601702000DC0A0E1F0D82DE904B04CE235\r
+S3150000BE800050A0E1360100EB02CA60E2FFCECCE32F\r
+S3150000BE900FC0CCE300005CE3F0A81B09082095E581\r
+S3150000BEA0083095E503308CE0020A53E308309585A7\r
+S3150000BEB00C40A0E1024A638204605CE0083095050C\r
+S3150000BEC0043083000860851508308505083095E53F\r
+S3150000BED0020A53E308309525047095E5023A632279\r
+S3150000BEE008308525000054E3020087E00800001AA8\r
+S3150000BEF0000056E3F0A81B090700A0E10610A0E128\r
+S3150000BF0036F0FFEB0500A0E10610A0E1F0681BE9A2\r
+S3150000BF102F0100EA0410A0E130F0FFEB0500A0E1DC\r
+S3150000BF200410A0E12A0100EBF0FFFFEA0DC0A0E13A\r
+S3150000BF30F0DD2DE904B04CE20CC090E5027A6CE22B\r
+S3150000BF400280A0E10040A0E10708A0E1046094E5BA\r
+S3150000BF5020E8A0E108008CE00228A0E1020A50E3F4\r
+S3150000BF600150A0E10100A0E10130A0E30C1086E041\r
+S3150000BF702228A0E108A067E00CC086E00D00008A38\r
+S3150000BF80990600EB0C3094E5083083E00C3084E52C\r
+S3150000BF900C3094E5020A53E30C309425023A43220E\r
+S3150000BFA00C3084250400A0E10810A0E1180100EB84\r
+S3150000BFB00800A0E1F0AD1BE90C10A0E10E20A0E105\r
+S3150000BFC00500A0E10130A0E3870600EB0A28A0E106\r
+S3150000BFD0070085E02228A0E10610A0E10130A0E3D9\r
+S3150000BFE0810600EB0CA084E5EDFFFFEA0DC0A0E1A1\r
+S3150000BFF010D82DE904B04CE20040A0E110309FE5D6\r
+S3150000C000000093E5E1FBFFEB0400A0E198FFFFEBE6\r
+S3150000C010F9FFFFEA401702000DC0A0E1F0D92DE9B3\r
+S3150000C02004B04CE20040A0E10180A0E1007090E580\r
+S3150000C030B90000EB141094E5010050E1003061E016\r
+S3150000C0400060A0E3023A61320060A031000058E3CC\r
+S3150000C0500060A013023AA01314608415060073E171\r
+S3150000C0600050A0E1011087E00400A0E10320A0E158\r
+S3150000C0700100001A145084E5F0A91BE9AAFFFFEBA2\r
+S3150000C080000056E30620A0E10400A0E1F8FFFF0A45\r
+S3150000C090001094E5A4FFFFEBF5FFFFEA0DC0A0E159\r
+S3150000C0A010D82DE904B04CE20040A0E134309FE501\r
+S3150000C0B0003093E5000053E32800A0E30100001AD6\r
+S3150000C0C040FBFFEBF8FFFFEA0300A0E1AFFBFFEB4D\r
+S3150000C0D00400A0E10010A0E3CEFFFFEB0400A0E106\r
+S3150000C0E063FFFFEBF0FFFFEA441702000DC0A0E17B\r
+S3150000C0F0F0DF2DE904B04CE2CCC19FE508D04DE25B\r
+S3150000C1000070A0E100509CE5000055E30180A0E12D\r
+S3150000C11002A0A0E1F0AF1B19B0419FE5003094E505\r
+S3150000C1200190A0E3000053E300908CE56200000A52\r
+S3150000C13002FAFFEB98319FE50020A0E1002083E59D\r
+S3150000C1400500A0E131FAFFEB88619FE588319FE5A4\r
+S3150000C15000C0A0E100C083E51820A0E30600A0E12E\r
+S3150000C1600510A0E1CF1D00EB70019FE570319FE542\r
+S3150000C170000050E3040086E5003086E54C00000A26\r
+S3150000C180000053E34800000A000050E33F00000AA5\r
+S3150000C190000053E33400000A48419FE50510A0E182\r
+S3150000C1A00420A0E1BF1D00EB0420A0E10510A0E1E2\r
+S3150000C1B0000096E5BB1D00EB2C319FE5012047E210\r
+S3150000C1C000C096E5002083E520319FE50C00A0E144\r
+S3150000C1D000C083E50710A0E18EFDFFEB0A10A0E189\r
+S3150000C1E00800A0E1E0FDFFEB0600A0E120FFFFEB69\r
+S3150000C1F00910A0E10600A0E186FFFFEB0600A0E122\r
+S3150000C2001BFFFFEB0510A0E10620A0E10530A0E131\r
+S3150000C210DC009FE500508DE504508DE57FF9FFEBCE\r
+S3150000C2200620A0E10510A0E10530A0E1C4009FE5CD\r
+S3150000C23000508DE504508DE578F9FFEB57FAFFEBDA\r
+S3150000C240B4C09FE500E0A0E100E08CE50510A0E1A8\r
+S3150000C2500E20A0E10530A0E1A0009FE500508DE58D\r
+S3150000C26004508DE56DF9FFEBF0AF1BE990309FE5CB\r
+S3150000C27090109FE5000093E58C209FE58C309FE5AC\r
+S3150000C2808CC09FE500C08DE5733300EB6D2F00EB8E\r
+S3150000C2906C309FE56C109FE5000093E574209FE5E8\r
+S3150000C2A068309FE5A6CFA0E3F5FFFFEA0000FDFF9B\r
+S3150000C2B0B4FFFFEA0000FDFFB0FFFFEA0500A0E1C2\r
+S3150000C2C0D2F9FFEB000084E598FFFFEA541702005D\r
+S3150000C2D0441702003C17020040B10200401702005A\r
+S3150000C2E0C83E0200CA5E0200022000005817020083\r
+S3150000C2F05C170200ECBF00009CC000006017020043\r
+S3150000C300F4BC00009C120200BC0D02001C0F0200CF\r
+S3150000C310400F020099020000980F020030309FE59E\r
+S3150000C320000093E5000050E30EF0A00124309FE5E5\r
+S3150000C330003093E520309FE5002093E51C309FE513\r
+S3150000C340003093E5033062E0FF0EC3E30F00C0E365\r
+S3150000C3500EF0A0E154170200004102805C170200B3\r
+S3150000C360D04002800DC0A0E130D82DE924409FE5E1\r
+S3150000C370003094E504B04CE20050A0E10300A0E1D7\r
+S3150000C38097FAFFEB000094E5104095E5BEFAFFEB47\r
+S3150000C3900400A0E130A81BE93C1702000DC0A0E193\r
+S3150000C3A070D82DE924509FE5003095E50060A0E1A6\r
+S3150000C3B004B04CE20300A0E10140A0E188FAFFEBE3\r
+S3150000C3C0000095E5104086E570681BE9AEFAFFEAC5\r
+S3150000C3D03C1702000DC0A0E170D82DE92C509FE556\r
+S3150000C3E0003095E50060A0E104B04CE20300A0E156\r
+S3150000C3F00140A0E17AFAFFEB103096E5000095E5E2\r
+S3150000C400043083E0103086E570681BE99EFAFFEA87\r
+S3150000C4103C1702000DC0A0E170D82DE93C409FE515\r
+S3150000C420003094E50060A0E104B04CE20300A0E116\r
+S3150000C4300150A0E16AFAFFEB103096E5033065E0A3\r
+S3150000C440103086E5103096E5000094E5000053E3D1\r
+S3150000C4500030A0B3103086B570681BE98AFAFFEA8F\r
+S3150000C4603C1702000DC0A0E110D82DE930409FE531\r
+S3150000C470003094E50000A0E3000053E104B04CE274\r
+S3150000C48010A81B09510000EB000094E554FAFFEBDD\r
+S3150000C490000094E545F9FFEB0030A0E3003084E5A9\r
+S3150000C4A010A81BE96C1702000DC0A0E170D82DE999\r
+S3150000C4B0E4409FE504B04CE204D04DE2003094E540\r
+S3150000C4C0000053E32800000A000094E5000050E352\r
+S3150000C4D02800000A42FAFFEBC0509FE55B0300EB21\r
+S3150000C4E0BC309FE5BC609FE5003085E5B8309FE530\r
+S3150000C4F0B8109FE5003086E50040A0E3003091E5E6\r
+S3150000C500004081E5A8309FE5002091E5033082E1F7\r
+S3150000C510003081E55F0300EB0A00A0E3D00200EBE8\r
+S3150000C5200138A0E3003085E5003086E584509FE5BC\r
+S3150000C5300430D5E7FF0053E30500000A0500D4E701\r
+S3150000C540014084E22E0300EB0430D5E7FF0053E3FD\r
+S3150000C550F9FFFF1A40309FE5000093E54AFAFFEB2A\r
+S3150000C5600000A0E370681BE9180000EAF3F8FFEB8F\r
+S3150000C570000084E5D3FFFFEA3C309FE53CC09FE521\r
+S3150000C580000093E538109FE538209FE538309FE599\r
+S3150000C59000C08DE5B03200EBAA2E00EB6C1702004E\r
+S3150000C5A008000680FFFF6E000400068001000A00F6\r
+S3150000C5B01000068005050505741702009C1202008E\r
+S3150000C5C075010000BC0D0200C00F0200D40F02006E\r
+S3150000C5D004E02DE50010A0E10000A0E304E09DE4E6\r
+S3150000C5E0040000EA04E02DE50010A0E1FF00A0E34E\r
+S3150000C5F004E09DE4FFFFFFEA3C209FE5FF30A0E357\r
+S3150000C60004E02DE5003082E530209FE5213E83E2FF\r
+S3150000C610FF0000E2013053E20100C2E4FCFFFF5AD2\r
+S3150000C6201C209FE56130A0E3013053E20100C2E423\r
+S3150000C630FCFFFF5A04E09DE4890100EA701702003E\r
+S3150000C64050000060600300600DC0A0E1F0DF2DE93E\r
+S3150000C6500280A0E1A12FA0E1000058E3012082D3CF\r
+S3150000C66004B04CE2000052E30370A0E104609BE5D5\r
+S3150000C6700B00001A000056E30030A0C30130A0D31F\r
+S3150000C6803F0051E3013083C3000053E30400001A66\r
+S3150000C690610057E30030A0D30130A0C3A73F93E168\r
+S3150000C6A00100000A0000A0E3F0AF1BE9083081E0BA\r
+S3150000C6B0400053E3063087E0408061C2620053E3E6\r
+S3150000C6C0626067C208A081E0000050E3FF90A013FB\r
+S3150000C6D00090A0030A0051E10150A0E11C0000AA4D\r
+S3150000C6E078E09FE5C501A0E101C0A0E3073005E2BF\r
+S3150000C6F01C33A0E1802160E000109EE5FF4003E2CC\r
+S3150000C700822162E058309FE51C1081E1822087E09B\r
+S3150000C7100400E0E1000056E304C009E000108EE5E5\r
+S3150000C720032082E0FF4000E2060000BA011086E224\r
+S3150000C7300030D2E5033004E003308CE1011051E211\r
+S3150000C7400130C2E4F9FFFF1A015085E20A0055E103\r
+S3150000C750E2FFFFBA420100EB0800A0E1F0AF1BE9DF\r
+S3150000C76070170200500000600DC0A0E110D82DE93E\r
+S3150000C7700140A0E10010A0E10000A0E304B04CE2FB\r
+S3150000C78004D04DE262C0A0E30420A0E10030A0E1A5\r
+S3150000C79000C08DE5ABFFFFEB0400A0E110A81BE98C\r
+S3150000C7A0F0452DE9202042E2FF2002E2D4409FE539\r
+S3150000C7B05F0052E3C001A0E10150A0E100C094E592\r
+S3150000C7C01F20A083801160E0811161E0026182E098\r
+S3150000C7D00120A0E38110A0E112C08CE1610055E3C5\r
+S3150000C7E0058081E000C084E59CA09FE59C709FE5E4\r
+S3150000C7F0025085E00340A0E11E0000CA0A30D6E7D9\r
+S3150000C800610055E305C081E00A2086E0015085E21B\r
+S3150000C8100730C8E7170000CA0130D2E5610055E3CA\r
+S3150000C820050081E00730CCE7015085E2110000CA1F\r
+S3150000C8300230D2E5610055E305C081E00730C0E76C\r
+S3150000C840015085E20B0000CA0330D2E5610055E3D2\r
+S3150000C850050081E00730CCE7015085E2050000CAFB\r
+S3150000C8600430D2E5610055E30730C0E7051081E0EA\r
+S3150000C8700030A0D30730C1D7010054E3F085BD18BE\r
+S3150000C880F045BDE8F60000EA701702007F170200C7\r
+S3150000C890500000600DC0A0E1F0D82DE90250A0E1E3\r
+S3150000C8A00020D2E5000052E304B04CE20070A0E1A3\r
+S3150000C8B00140A0E10060A0E30200001AE80000EBDE\r
+S3150000C8C00600A0E1F0A81BE90410A0E10030A0E3F7\r
+S3150000C8D00700A0E1B1FFFFEB0120F5E5016086E26C\r
+S3150000C8E0630056E30030A0C30130A0D3FF2002E26C\r
+S3150000C8F0000052E30030A00301300312000053E3AE\r
+S3150000C900064084E2EFFFFF1AEBFFFFEA0DC0A0E14D\r
+S3150000C910F0DF2DE90280A0E1072082E2C221A0E13A\r
+S3150000C920201081E20050A0E304B04CE23CD04DE27E\r
+S3150000C9301F10C1E3020055E144200BE53C000BE566\r
+S3150000C94040300BE5C161A0E1700000AA0090A0E3B1\r
+S3150000C950060059E140701BE55F0000AA28304BE253\r
+S3150000C96007C0A0E30020A0E301C05CE2082043E585\r
+S3150000C970013083E2FAFFFF5A8501A0E1080050E189\r
+S3150000C98002C0A0E148000BE50C0000AA3C101BE524\r
+S3150000C990093081E0963022E028104BE20030D2E5E3\r
+S3150000C9A001C08CE2010080E207005CE3080050D180\r
+S3150000C9B0083041E5062082E0011081E2F6FFFFBA69\r
+S3150000C9C048201BE5000052E180E0A0E300C0A0E3A0\r
+S3150000C9D02E0000AA29305BE52A105BE52B205BE5DB\r
+S3150000C9E04C304BE550104BE554204BE52C305BE5C5\r
+S3150000C9F02D105BE52E205BE558304BE55C104BE5D2\r
+S3150000CA0060204BE52FA05BE528404BE24C105BE530\r
+S3150000CA1001300EE050105BE501200EE054105BE59E\r
+S3150000CA20833082E101200EE058105BE5833082E11D\r
+S3150000CA3001200EE05C105BE5833082E101200EE010\r
+S3150000CA4060105BE5833082E101200EE0833082E1F5\r
+S3150000CA5030205BE50A100EE002200EE0833081E113\r
+S3150000CA60833082E148201BE507106CE201C08CE2AE\r
+S3150000CA7002208CE03331A0E1000052E164200BE596\r
+S3150000CA80AEE0A0E1103044E5014084E2DEFFFFBAEB\r
+S3150000CA9028004BE207C0A0E304109BE5C13FA0E1DC\r
+S3150000CAA0A33E81E0C33185E0833163E0101050E599\r
+S3150000CAB0833163E060209FE5833087E001C05CE25C\r
+S3150000CAC00210C3E7017087E2010080E2F1FFFF5A1E\r
+S3150000CAD0019089E2060059E19FFFFFBA04209BE519\r
+S3150000CAE038009FE5C23FA0E1A33E82E0001090E53A\r
+S3150000CAF0C33185E00120A0E3121381E144301BE538\r
+S3150000CB00015085E2030055E1001080E58EFFFFBA73\r
+S3150000CB10530000EB0000A0E3F0AF1BE950000060FB\r
+S3150000CB20701702000DC0A0E1F0DF2DE904B04CE261\r
+S3150000CB3004D04DE21FC081E204509BE501E0A0E174\r
+S3150000CB400380A0E10270A0E1073005E2022085E043\r
+S3150000CB50FF10A0E31FC0CCE35113A0E1012042E285\r
+S3150000CB600E3088E00CC06EE0620058E3400055D3FA\r
+S3150000CB700040A0E1C2A1A0E1016043E22CC00BE5A8\r
+S3150000CB80FF9001E2220000CA00005EE3000057C3E6\r
+S3150000CB901F0000DAC501A0E10A0050E11B0000CA2F\r
+S3150000CBA0803160E0833163E083C0A0E10C50A0E1F6\r
+S3150000CBB00A0050E11800000A060058E108E0A0E16A\r
+S3150000CBC0060000CA90309FE50120D4E4033085E0DA\r
+S3150000CBD00E20C3E701E08EE206005EE1F8FFFFDA11\r
+S3150000CBE078109FE5002091E50130A0E3132082E153\r
+S3150000CBF0030080E02C301BE50A0050E1002081E5AF\r
+S3150000CC00034084E062C08CE2625085E2E7FFFFDA0F\r
+S3150000CC10130000EB0000A0E3F0AF1BE9060058E1AB\r
+S3150000CC2008E0A0E1EDFFFFCA2C109FE501108CE0A3\r
+S3150000CC300E20D1E70920C2E10E20C1E70130D4E47D\r
+S3150000CC40033009E0032082E10E20C1E701E08EE215\r
+S3150000CC5006005EE1F3FFFFDAE0FFFFEA5000006046\r
+S3150000CC60701702000DC0A0E1F0D82DE9EC329FE567\r
+S3150000CC7004B04CE204D04DE20060A0E3000093E56E\r
+S3150000CC8057F8FFEBD8329FE5003093E5000053E3F9\r
+S3150000CC90D0329FE50050D3E56100001A060055E149\r
+S3150000CCA00600000A0670A0E1010015E30A00001A5A\r
+S3150000CCB0A550B0E1077087E2016086E2F9FFFF1A2E\r
+S3150000CCC098329FE5000093E598329FE50020A0E3A7\r
+S3150000CCD0002083E5F0681BE96BF8FFEA8601A0E116\r
+S3150000CCE0FA0000EB0000A0E3130100EB78329FE5A9\r
+S3150000CCF0003093E5010053E31800000A6200A0E348\r
+S3150000CD00E40000EB64229FE50138A0E3043002E46E\r
+S3150000CD10003082E50040A0E354229FE5873167E0BA\r
+S3150000CD20832082E00400D2E7014084E2340100EB74\r
+S3150000CD30610054E3F7FFFFDA38329FE5003093E5F0\r
+S3150000CD40010813E3D9FFFF0A6A1B00EB24329FE5B3\r
+S3150000CD50003093E5010813E3FAFFFF1AD3FFFFEA59\r
+S3150000CD606240A0E308329FE5872167E0014044E284\r
+S3150000CD70822083E00420D2E7033084E0313E83E260\r
+S3150000CD80000054E30020C3E5F5FFFF1A650100EB40\r
+S3150000CD90000050E31F00001ADC219FE5DC319FE50F\r
+S3150000CDA0002083E51020A0E37A3F43E2002083E5DC\r
+S3150000CDB0CC119FE5043043E2004083E50130A0E357\r
+S3150000CDC00030C1E50230D1E5000053E3F62F82E2E0\r
+S3150000CDD00D00000AA8319FE50230D3E5000053E3B9\r
+S3150000CDE0012042E20800000A000052E3F8FFFF1AA1\r
+S3150000CDF090319FE590119FE5000093E58C219FE51A\r
+S3150000CE008C319FE58CC19FE54E0000EA000052E39D\r
+S3150000CE10A6FFFF1AF5FFFFEA40319FE5000093E504\r
+S3150000CE20ABFFFFEAFF5015E20060A0E3A3FFFF0A95\r
+S3150000CE300670A0E1010015E30400001AA550B0E158\r
+S3150000CE40627087E2016086E2F9FFFF1A9BFFFFEA44\r
+S3150000CE50070066E28001A0E19C0000EB0000A0E371\r
+S3150000CE60B50000EB30019FE5311E40E2011087E07E\r
+S3150000CE706220A0E34A0000EBEC309FE5004093E51A\r
+S3150000CE80010054E31600000A6200A0E3810000EBF3\r
+S3150000CE90D8209FE50138A0E3043002E4003082E5A3\r
+S3150000CEA00040A0E3F0309FE50300D4E7014084E2B0\r
+S3150000CEB0D30000EB610054E3F9FFFFDAB4309FE5DD\r
+S3150000CEC0003093E5010813E3DBFFFF0A091B00EBC3\r
+S3150000CED0A0309FE5003093E5010813E3FAFFFF1A3F\r
+S3150000CEE0D5FFFFEA0F0100EB000050E3C9FFFF1A70\r
+S3150000CEF08C109FE580209FE580309FE5002083E52C\r
+S3150000CF000040C1E50230D1E5000053E3FA2FA0E36B\r
+S3150000CF100F00000A68309FE50230D3E5000053E3B6\r
+S3150000CF20012042E20A00000A000052E3F8FFFF1A5D\r
+S3150000CF3050309FE550109FE5000093E54C209FE59B\r
+S3150000CF404C309FE554C09FE500C08DE5423000EBB4\r
+S3150000CF503C2C00EB000052E3B7FFFF1AF3FFFFEA99\r
+S3150000CF606C170200641702007017020068170200AF\r
+S3150000CF700800068050000060000006804000006047\r
+S3150000CF8000420280304202809C120200BC0D020068\r
+S3150000CF9028100200D40F020018040000600300608D\r
+S3150000CFA05C040000F0412DE9023081E00240A0E17E\r
+S3150000CFB0000052E3022080E00060A0E10150A0E101\r
+S3150000CFC0018043E2017042E2F081BDD801C0D5E4A0\r
+S3150000CFD001E058E402200CE202300EE201100CE2FD\r
+S3150000CFE001000EE28222A0E18332A0E1812382E1E8\r
+S3150000CFF0803383E104100CE204000EE2812182E119\r
+S3150000D000803183E108100CE208000EE2812082E103\r
+S3150000D010803083E110100CE210000EE2A12082E1C4\r
+S3150000D020A03083E120100CE220000EE2A12182E173\r
+S3150000D030A03183E140100CE240000EE2A12282E121\r
+S3150000D040A03283E1024044E2AC2382E1AE3383E1C5\r
+S3150000D050000054E30130C6E4012047E4F081BDD866\r
+S3150000D060D9FFFFEA20209FE520309FE5003082E5CA\r
+S3150000D070013783E2003082E50008A0E110309FE529\r
+S3150000D0802008A0E1000083E50EF0A0E1080006807C\r
+S3150000D090FFFF00000400068024209FE524309FE562\r
+S3150000D0A0FF04C0E3003082E5013783E2003082E509\r
+S3150000D0B0FB08C0E310309FE5010780E3000083E52D\r
+S3150000D0C00EF0A0E108000680FFFF000004000680C5\r
+S3150000D0D00DC0A0E110D82DE904B04CE2C041A0E19A\r
+S3150000D0E00100A0E3DEFFFFEB44309FE50128A0E34B\r
+S3150000D0F00F4004E2002083E5B04084E3043043E2BD\r
+S3150000D100002083E50400A0E13D0000EB24309FE50C\r
+S3150000D110003093E5010813E310A81B09751A00EB0C\r
+S3150000D12010309FE5003093E5010813E310A81B09B2\r
+S3150000D130F9FFFFEA08000680000006800DC0A0E1A6\r
+S3150000D14010D82DE904B04CE20040A0E10200A0E3B3\r
+S3150000D150C3FFFFEB50309FE50128A0E34402A0E1A6\r
+S3150000D160002083E50F0000E2043043E2002083E55F\r
+S3150000D170100080E30F4004E2210000EB0400A0E170\r
+S3150000D1801F0000EB24309FE5003093E5010813E310\r
+S3150000D19010A81B09571A00EB10309FE5003093E5E5\r
+S3150000D1A0010813E310A81B09F9FFFFEA080006802F\r
+S3150000D1B00000068070402DE93C609FE5C1CFA0E1EC\r
+S3150000D1C0AC1E81E0005096E5C111A0E101C0A0E3CC\r
+S3150000D1D0814161E01C5185E120109FE5844164E0B6\r
+S3150000D1E0841081E00C0053E10020C1E7005086E581\r
+S3150000D1F07080BD187040BDE899FEFFEA7017020006\r
+S3150000D200500000600DC0A0E110D82DE934309FE534\r
+S3150000D2100330D3E5010013E304B04CE2FF4000E223\r
+S3150000D2200200000A20309FE50040C3E510A81BE974\r
+S3150000D230301A00EB0C309FE50330D3E5010013E311\r
+S3150000D240FAFFFF0AF6FFFFEA0000068020000680CC\r
+S3150000D25034209FE534109FE500C0A0E30201A0E35F\r
+S3150000D2600131A0E3003082E500C081E520309FE572\r
+S3150000D270000082E5000081E5003093E50331A0E37C\r
+S3150000D280003082E500C081E50EF0A0E108000680CE\r
+S3150000D290040006800000068044209FE544109FE5B8\r
+S3150000D2A00136A0E3003082E5003081E5003082E5FA\r
+S3150000D2B034309FE50000A0E3000081E5000083E52F\r
+S3150000D2C024309FE5003093E5010053E3FBFFFF9A0E\r
+S3150000D2D00C209FE50136A0E3043002E4003082E52D\r
+S3150000D2E00EF0A0E10800068004000680B0C00180B0\r
+S3150000D2F0003180E0033183E00301A0E1000050E348\r
+S3150000D3000EF0A0D118209FE50137A0E3003082E59A\r
+S3150000D310010050E2042042E2003082E50EF0A00156\r
+S3150000D320F7FFFFEA080006800DC0A0E100D82DE94E\r
+S3150000D33070309FE50126A0E304B04CE204D04DE234\r
+S3150000D340002083E5003093E5010613E30A20A0E3FD\r
+S3150000D3500700000A4C309FE5003093E5010613E311\r
+S3150000D360012042E20200000A000052E3F8FFFF1A21\r
+S3150000D370030000EA000052E30100000A0000A0E3F7\r
+S3150000D38000A81BE920309FE520C09FE5000093E53B\r
+S3150000D3901C109FE51C209FE51C309FE500C08DE515\r
+S3150000D3A02D2F00EB272B00EB004002809C12020081\r
+S3150000D3B0BE050000BC0D020028100200D40F0200BA\r
+S3150000D3C00DC0A0E100D82DE904B04CE2E31A00EB51\r
+S3150000D3D01C209FE50138A0E3003082E50110A0E3A0\r
+S3150000D3E04231A0E3001082E50300A0E3001083E5CC\r
+S3150000D3F000A81BE918000580010070E300C0A0E347\r
+S3150000D4002200000AB4109FE5002191E7020212E310\r
+S3150000D41001C0A0130532A0130200001A010112E395\r
+S3150000D4200F00000A0231A0E3003181E70020A0E3EB\r
+S3150000D430000052E184109FE50400000A023191E7E2\r
+S3150000D440020213E30332A0030231810701C0A003E5\r
+S3150000D450012082E20C0052E3F4FFFFDA0C00A0E1A7\r
+S3150000D4600EF0A0E1000052E3EFFFFFAA012082E2E6\r
+S3150000D4700238A0E12338A0E10E0053E30932A0836D\r
+S3150000D480002181E70031818701C0A083E6FFFFEA22\r
+S3150000D4900C20A0E124109FE5023191E7070173E318\r
+S3150000D4A00332A0830232A093023181E7012082E297\r
+S3150000D4B001C0A0830C0052E3F5FFFFDAE6FFFFEAA6\r
+S3150000D4C060B102000DC0A0E170D82DE9FC309FE5E7\r
+S3150000D4D0B020D3E1F8309FE5B020C3E1F4309FE5FA\r
+S3150000D4E0002093E5022AA0E1222AA0E1000052E3EF\r
+S3150000D4F004B04CE20050E0E30060A0E32900000A1B\r
+S3150000D500603083E2001093E5011AA0E1823262E006\r
+S3150000D510211AA0E1033182E0060051E18301A0E176\r
+S3150000D5202000000AAF3F00EBAC309FE5030050E15E\r
+S3150000D5300E00008A06C0A0E10610A0E19C209FE52F\r
+S3150000D540B23091E1030050E1023081E01A1081E22D\r
+S3150000D5500300003AB230D3E1030050E10C50A09131\r
+S3150000D5600200009A01C08CE20A005CE3F2FFFFDAD7\r
+S3150000D5706C409FE5003094E5030055E10D00000A7C\r
+S3150000D580005084E5000056E30300001A40309FE592\r
+S3150000D590B030D3E1000053E30200000A44309FE5B7\r
+S3150000D5A0000093E5211B00EB3C309FE50128A0E33A\r
+S3150000D5B0002083E570A81BE90500A0E18DFFFFEBC5\r
+S3150000D5C06230E0E30060A0E1003084E5ECFFFFEAB2\r
+S3150000D5D010800680B81A020050000580A2030000E1\r
+S3150000D5E060190200BC1A0200B41A02001400058079\r
+S3150000D5F00DC0A0E110D82DE904B04CE2F4309FE54F\r
+S3150000D6006410A0E3000093E58AF6FFEB000050E308\r
+S3150000D6102F00000AE0309FE500C093E500005CE3C0\r
+S3150000D6200B00000AD4209FE5B030D2E1000053E39E\r
+S3150000D6300700000AB010D2E10030A0E30118A0E113\r
+S3150000D6404118A0E1B030C2E16300A0E30FE0A0E121\r
+S3150000D6500CF0A0E10040A0E3A4109FE5042191E7AF\r
+S3150000D660010212E30E00000A8C309FE5003093E5BC\r
+S3150000D6700122C2E3000053E3042181E70800000A07\r
+S3150000D680010152E30400A0010210A0030800000AF1\r
+S3150000D6900A00008A020252E30400A0010110A0035E\r
+S3150000D6A00300000A014084E20C0054E3E9FFFFDABC\r
+S3150000D6B0D1FFFFEA0FE0A0E103F0A0E1F8FFFFEAE7\r
+S3150000D6C0020152E30400A0010410A003F4FFFF1AB4\r
+S3150000D6D0F7FFFFEA20309FE5003093E5000053E3B3\r
+S3150000D6E0C5FFFF0A0010A0E10000E0E30FE0A0E1A3\r
+S3150000D6F003F0A0E1C0FFFFEAB41A0200C01A02005C\r
+S3150000D700B81A020060B102002C209FE52C309FE57C\r
+S3150000D7102C109FE5003082E5313E43E2003081E582\r
+S3150000D720033BA0E3003082E5013B43E2003081E5A4\r
+S3150000D73010309FE5B030D3E10EF0A0E108800680FE\r
+S3150000D7407713000004800680108006800DC0A0E1DB\r
+S3150000D750F0DF2DE904B04CE240C19FE50CD04DE26C\r
+S3150000D7600040A0E338519FE500C08DE534C19FE538\r
+S3150000D7700410A0E10420A0E12C319FE52500A0E3E0\r
+S3150000D78020108DE9C11900EB000095E5D41900EBD6\r
+S3150000D79018319FE518119FE5032CA0E3002083E5CF\r
+S3150000D7A0013BA0E3004081E5003081E504319FE5BF\r
+S3150000D7B00000E0E3000083E5FC609FE5FCA09FE538\r
+S3150000D7C0FC909FE5603083E2000083E5F4709FE5FE\r
+S3150000D7D01358A0E30186A0E30135A0E300508AE5D3\r
+S3150000D7E0008089E5003086E5033083E0004087E568\r
+S3150000D7F0D4209FE5003086E5D0309FE5004087E5E0\r
+S3150000D800002083E50124A0E3AC3043E2002083E559\r
+S3150000D810C120A0E3203043E2002083E5B9FFFFEBFF\r
+S3150000D820AC309FE50226A0E39C8003E400508AE525\r
+S3150000D830005089E5042003E4002083E594209FE559\r
+S3150000D840003092E57F37C3E30338C3E3003082E557\r
+S3150000D850003092E5C63883E3003082E5003092E579\r
+S3150000D860013CC3E3003082E5003092E5013C83E3EE\r
+S3150000D870003082E560309FE5003093E55C309FE53F\r
+S3150000D880003093E50130A0E3003086E52500A0E3F3\r
+S3150000D8900138A0E3003087E5F06F1BE9A91900EA1B\r
+S3150000D8A0C4D40000E87E0200CC7E0200C0D3000093\r
+S3150000D8B0F8000080F40000805800058018000580FC\r
+S3150000D8C0380105803401058014000580140001C16B\r
+S3150000D8D0D0000580D40005805040048050000580AB\r
+S3150000D8E0B00005800DC0A0E130D82DE9A4509FE519\r
+S3150000D8F004B04CE208D04DE20020A0E1004095E5DE\r
+S3150000D900000054E330A81B198C309FE50400A0E109\r
+S3150000D910002083E53DF4FFEB000050E3000085E5C1\r
+S3150000D9201300000A0400A0E170309FE50222A0E384\r
+S3150000D930002183E7010080E20C0050E3F9FFFFDAE3\r
+S3150000D94000C0A0E30C20A0E10C30A0E10C10A0E187\r
+S3150000D9504C009FE500C08DE504C08DE5AFF3FFEBFD\r
+S3150000D96040309FE50321A0E3002083E530681BE9F2\r
+S3150000D97075FFFFEA30309FE530C09FE5000093E574\r
+S3150000D9802C109FE52C209FE52C309FE500C08DE5EF\r
+S3150000D990B12D00EBAB2900EBB41A0200C01A02004D\r
+S3150000D9A060B10200F0D50000080005809C1202005C\r
+S3150000D9B0D7010000BC0D02002C100200401002002E\r
+S3150000D9C00DC0A0E110D82DE918409FE5003094E580\r
+S3150000D9D0000053E304B04CE210A81B19D7F3FFEB89\r
+S3150000D9E0000084E510A81BE9C41A02000DC0A0E1DE\r
+S3150000D9F0F0DD2DE934A19FE504B04CE204D04DE200\r
+S3150000DA000228A0E100C09AE500005CE30080A0E1E6\r
+S3150000DA100170A0E10360A0E14248A0E13A00000ADB\r
+S3150000DA20040053E308319FE50121A0E3002083E5CC\r
+S3150000DA300C00A011EAF4FF1B0418A0E1F4209FE5F6\r
+S3150000DA402118A0E10138A0E110C082E20040A0E365\r
+S3150000DA50410D83E3023083E3104082E5090080E351\r
+S3150000DA6004308CE5D0309FE508708CE5004082E5F7\r
+S3150000DA70040082E5088082E50C1082E50317A0E326\r
+S3150000DA801C1183E470C083E4782103E40820A0E33A\r
+S3150000DA90042003E4004083E50150A0E34F3F83E206\r
+S3150000DAA07050C3E40050C3E5000056E38C409FE588\r
+S3150000DAB000009A051000000A84309FE5014054E2F8\r
+S3150000DAC0003093E50E00000A080013E30300001A75\r
+S3150000DAD0020056E3F7FFFF1A061800EBF5FFFFEA10\r
+S3150000DAE0040056E3F0AD1B0940309FE5000093E5C6\r
+S3150000DAF044309FE50121A0E3002083E5F06D1BE99A\r
+S3150000DB00E1F4FFEA0000FDFFF4FFFFEA34309FE591\r
+S3150000DB1018C0A0E3000093E52C109FE52C209FE59C\r
+S3150000DB202C309FE500C08DE54B2D00EB452900EB21\r
+S3150000DB30C41A020008400080D00300600440008040\r
+S3150000DB4060E31600104000809C120200BC0D02002B\r
+S3150000DB5098100200AC1002000DC0A0E168309FE5ED\r
+S3150000DB6010D82DE91EE040E204B04CE2932ECCE042\r
+S3150000DB7058409FE5CEEFA0E10F00B4E8CCE06EE0A0\r
+S3150000DB8024C04BE214D04DE28EE08EE00F00ACE8EC\r
+S3150000DB903C109FE5003094E50EE1A0E101008EE027\r
+S3150000DBA00820D0E500308CE5B1E09EE11E204BE573\r
+S3150000DBB0B4E24BE1B400D0E1B0024BE164ECFFEB20\r
+S3150000DBC024004BE26AEDFFEB10A81BE96766666668\r
+S3150000DBD008110200C81A02000DC0A0E130D82DE9D4\r
+S3150000DBE08C109FE58CE09FE504B04CE288509FE5E1\r
+S3150000DBF088C09FE588309FE50341A0E30020A0E3AD\r
+S3150000DC00004081E500208CE500408EE5002085E59A\r
+S3150000DC10004083E56C309FE5004081E500208CE5FF\r
+S3150000DC2000408EE5002085E5012082E2002083E5A4\r
+S3150000DC3054009FE51A0000EB50309FE53F24A0E317\r
+S3150000DC40002083E548309FE51C20A0E3044003E460\r
+S3150000DC50002083E53C309FE51D2042E2002083E55D\r
+S3150000DC600D2C82E2103083E2002083E530681BE948\r
+S3150000DC7052FFFFEA0840008008400180044001800E\r
+S3150000DC80044000800880018040000480FFFF0000FF\r
+S3150000DC901883018008400680188101800EF0A0E1FB\r
+S3150000DCA00EF0A0E10EF0A0E134309FE50020E0E3A5\r
+S3150000DCB0002083E5630050E3043043E20008A0E15E\r
+S3150000DCC0000083E50EF0A081012882E2143083E291\r
+S3150000DCD0002083E56420A0E3043043E2002083E5CE\r
+S3150000DCE00EF0A0E1584006800DC0A0E110D82DE945\r
+S3150000DCF004B04CE2991800EB60009FE5002090E527\r
+S3150000DD005C309FE5012082E20810A0E3001083E565\r
+S3150000DD10002080E50040A0E348309FE5842193E79A\r
+S3150000DD20000052E30400A0E1014084E20600001A6C\r
+S3150000DD30090054E3F7FFFFDA0120A0E34231A0E334\r
+S3150000DD40002083E50300A0E310A81BE90C309FE543\r
+S3150000DD50001093E50FE0A0E102F0A0E1F3FFFFEA77\r
+S3150000DD60841C020008C005800C7F02000DC0A0E1E3\r
+S3150000DD7010D82DE904B04CE20040A0E334309FE512\r
+S3150000DD80843183E0042093E5000052E30400A0E11F\r
+S3150000DD90014084E20200001A090054E310A81BC9DE\r
+S3150000DDA0F5FFFFEA10309FE5001093E50FE0A0E1D4\r
+S3150000DDB002F0A0E1F7FFFFEA0C7F0200841C0200DC\r
+S3150000DDC00DC0A0E130D82DE9BC309FE50321A0E3CA\r
+S3150000DDD004B04CE20CD04DE20050A0E1082083E4F0\r
+S3150000DDE0003093E5023113E20300A00130A81B09BD\r
+S3150000DDF098409FE5400000EB003094E5000053E3B7\r
+S3150000DE001E00000A0000A0E384309FE50010A0E396\r
+S3150000DE10802183E0801183E7010080E2090050E35E\r
+S3150000DE20041082E5F7FFFF9A68C09FE568409FE50A\r
+S3150000DE3000C08DE564C09FE50120A0E160309FE54C\r
+S3150000DE403000A0E310108DE9101800EB000094E5F7\r
+S3150000DE50231800EB4C309FE50420A0E33000A0E33C\r
+S3150000DE60002083E5371800EB000055E30100001A97\r
+S3150000DE700100A0E330A81BE9130000EBFBFFFFEA5B\r
+S3150000DE80AEF2FFEB000084E5DDFFFFEA08C0058087\r
+S3150000DE908C1C02000C7F02006CDD0000087F020073\r
+S3150000DEA0EC7E0200E8DC00002401008004309FE5DF\r
+S3150000DEB0000093E50EF0A0E1841C020004309FE50B\r
+S3150000DEC0000093E50EF0A0E120C0058020309FE51C\r
+S3150000DED00120A0E3002083E518309FE5072082E2B9\r
+S3150000DEE0002083E5062042E2043043E2002083E579\r
+S3150000DEF00EF0A0E1881C020008C005801C209FE5EA\r
+S3150000DF000230A0E3003082E5063083E2003082E58D\r
+S3150000DF100C309FE50020A0E3002083E50EF0A0E191\r
+S3150000DF2008C00580881C020004309FE5000093E5C8\r
+S3150000DF300EF0A0E1881C020034209FE50000A0E35B\r
+S3150000DF4030309FE5803193E7000053E30200001A6A\r
+S3150000DF50003092E5000053E30EF0A001010080E2DC\r
+S3150000DF60090050E3082082E20000E0C30EF0A0C1E1\r
+S3150000DF70F2FFFFEA107F02000C7F02000DC0A0E155\r
+S3150000DF80F0D92DE96C809FE5003098E504B04CE2AD\r
+S3150000DF900060A0E10300A0E10150A0E190F3FFEBD7\r
+S3150000DFA054309FE5004093E5000054E30070E0E341\r
+S3150000DFB00E00001ADFFFFFEB40209FE5010070E333\r
+S3150000DFC0803182E004608315805182170070A011B1\r
+S3150000DFD0000054E30300001A000098E5AAF3FFEBE3\r
+S3150000DFE00700A0E1F0A91BE9B7FFFFEBF9FFFFEA85\r
+S3150000DFF0C1FFFFEBEEFFFFEA8C1C0200881C02004B\r
+S3150000E0000C7F02000DC0A0E1090050E370D82DE995\r
+S3150000E01004B04CE254609FE50050A0E170A81B8953\r
+S3150000E020000096E56EF3FFEB44309FE5004093E574\r
+S3150000E030000054E30B00001A38109FE50020A0E30F\r
+S3150000E040853181E0000054E3042083E5852181E7E2\r
+S3150000E0500200001A000096E570681BE98AF3FFEAE1\r
+S3150000E06099FFFFEBFAFFFFEAA3FFFFEBF1FFFFEAE1\r
+S3150000E0708C1C0200881C02000C7F0200F0452DE972\r
+S3150000E0801C70DDE59CE09FE50338A0E1000057E346\r
+S3150000E0904338A0E102A0A0E18C209FE523C4A0E1C3\r
+S3150000E0A00130CE150230CE050030A0E3FF0000E2BD\r
+S3150000E0B0003082E574309FE5016080E2015080E225\r
+S3150000E0C0FF8001E2083883E10000CE150000CE058E\r
+S3150000E0D00250CE1501C0CE050360CE05000057E301\r
+S3150000E0E0043082E548009FE548309F1548309F057B\r
+S3150000E0F0131888E3043080E508A082E524309FE504\r
+S3150000E1000C1082E5002080E524209FE5000057E3FF\r
+S3150000E110083082E524309F1524309F050E40A0E18B\r
+S3150000E1200C3082E5F085BDE8100400605004006004\r
+S3150000E130CA1000006004006086100200861003000A\r
+S3150000E14002002B0003002B0030402DE90CE0DDE53A\r
+S3150000E1500338A0E100005EE30250A0E1FF0000E208\r
+S3150000E160FF4001E243C8A0E12600000AB4309FE563\r
+S3150000E170012080E201C0C3E50220C3E50000C3E53B\r
+S3150000E180A4109FE50030A0E3A0C09FE5003081E524\r
+S3150000E1909C309FE500005EE398209FE504308CE507\r
+S3150000E1A094309F1594309F05042882E1042081E570\r
+S3150000E1B008308CE574209FE584309FE5210684E3D2\r
+S3150000E1C000005EE3020880E30C3082E5085081E53A\r
+S3150000E1D070309F1570309F050C0081E500108CE5AE\r
+S3150000E1E068109FE50C0081E838309FE55C209FE5CC\r
+S3150000E1F000005EE3083082E554309F1554309F05D9\r
+S3150000E2000C3082E53080BDE818309FE5011080E2D1\r
+S3150000E2102C24A0E10120C3E50310C3E50000C3E5FB\r
+S3150000E22002C0C3E5D5FFFFEA1004006020040060C9\r
+S3150000E2303004006086100100C9100000120400605E\r
+S3150000E2401304006001002B008610020086100300F4\r
+S3150000E2504004006002000B0003000B000DC0A0E1AB\r
+S3150000E26000D82DE904B04CE23C1700EB30209FE5C6\r
+S3150000E27030109FE50830A0E3003082E5003081E5EC\r
+S3150000E2800237A0E3003082E5023743E2003081E541\r
+S3150000E2900120A0E3423183E2002083E50300A0E3EE\r
+S3150000E2A000A81BE9184002801440028004E02DE516\r
+S3150000E2B010309FE5003093E5000053E204F09D0422\r
+S3150000E2C004E09DE4D91700EA901C020040109FE587\r
+S3150000E2D040009FE50830A0E30227A0E3003081E577\r
+S3150000E2E0003080E5002081E52C309FE5002080E5A8\r
+S3150000E2F028209FE5002083E524309FE50020A0E349\r
+S3150000E300002083E51C309FE5062A82E2002083E593\r
+S3150000E3100EF0A0E11840028014400280488005807B\r
+S3150000E320FFFF0000A0B10200448005800DC0A0E1FF\r
+S3150000E33000D82DE904B04CE2081700EB28309FE521\r
+S3150000E340002093E524309FE5002083E520309FE5FB\r
+S3150000E350FF2CA0E3002083E50120A0E34231A0E3E7\r
+S3150000E360002083E50300A0E300A81BE940800580A8\r
+S3150000E370A0B102004880058004E02DE510309FE53D\r
+S3150000E380003093E5000053E204F09D0404E09DE4B0\r
+S3150000E390A61700EA941C02000DC0A0E130D82DE9B2\r
+S3150000E3A004B04CE2B4C09FE50CD04DE20010A0E3EF\r
+S3150000E3B0AC409FE500C08DE5A8C09FE50120A0E127\r
+S3150000E3C0A4309FE51A00A0E310108DE9AF1600EB0C\r
+S3150000E3D0000094E5C21600EB90209FE590109FE5A3\r
+S3150000E3E00830A0E3003082E588509FE5003081E5E3\r
+S3150000E3F00237A0E3003082E50040A0E3013743E2A4\r
+S3150000E400004081E51A00A0E3003085E5CD1600EB5B\r
+S3150000E41064C09FE50410A0E100C08DE55C409FE567\r
+S3150000E4205CC09FE50120A0E158309FE51B00A0E3FA\r
+S3150000E43010108DE9951600EB000094E5A81600EB88\r
+S3150000E44044209FE544309FE51B00A0E3002083E5C0\r
+S3150000E4500133A0E3003085E530681BE9B91600EA10\r
+S3150000E460ACE20000787F02005C7F02005CE2000004\r
+S3150000E4701840028014400280C400008078E3000047\r
+S3150000E480987F02007C7F02002CE30000FFFF000063\r
+S3150000E490488005800311A0E3A221A0E30231A0E396\r
+S3150000E4A004E02DE5003082E5013083E0003082E5AE\r
+S3150000E4B034309FE5522182E2201383E4002083E575\r
+S3150000E4C028309FE528209FE5281083E4002083E577\r
+S3150000E4D04020A0E3183083E2002083E514309FE556\r
+S3150000E4E0001083E504E09DE43E0000EA0880018018\r
+S3150000E4F008800580FE000001084002804C309FE540\r
+S3150000E5000227A0E3002083E5022742E240309FE590\r
+S3150000E510003093E5020713E30200000A012082E2BD\r
+S3150000E520130052E3F8FFFF9A140052E324309F15BC\r
+S3150000E5300010A0130820A013002083150100A003DB\r
+S3150000E540043043120100A011001083150EF0A0E163\r
+S3150000E55004400280004002801840028040209FE56F\r
+S3150000E5600231A0E3003082E538309FE5002093E5D4\r
+S3150000E570032082E22C309FE5003093E5030052E150\r
+S3150000E580FBFFFF8A20309FE50321A0E3002083E5FF\r
+S3150000E59018209FE5283083E2002083E50000A0E3F1\r
+S3150000E5A00EF0A0E104800580B0C0018008800580DF\r
+S3150000E5B0FE00000124309FE54020A0E3002083E513\r
+S3150000E5C02F2042E2183083E2002083E510209FE5E9\r
+S3150000E5D0603043E2002083E50000A0E30EF0A0E1F6\r
+S3150000E5E04880058001001B210DC0A0E100D82DE95F\r
+S3150000E5F004B04CE2C0FFFFEB000050E30100A013A3\r
+S3150000E60000A81B19D4FFFFEB000050E30200A01383\r
+S3150000E61000A81B1984209FE50330D2E5400013E3D0\r
+S3150000E6200300A00300A81B090330D2E5A333B0E121\r
+S3150000E6300400A00300A81B0964309FE51120A0E395\r
+S3150000E640002083E55C209FE5603043E2402083E4C0\r
+S3150000E6500030D3E5400013E30700001AFA0F50E339\r
+S3150000E660010080E20500A08300A81B8938309FE5E1\r
+S3150000E6700030D3E5400013E3F7FFFF0A9EFFFFEBF0\r
+S3150000E680000050E30600A01300A81B19B2FFFFEB21\r
+S3150000E690000050E30700A0130000A00300A81BE938\r
+S3150000E6A0808005806080058001001B2140800580F8\r
+S3150000E6B00DC0A0E110D82DE904B04CE28EFFFFEBAF\r
+S3150000E6C0000050E30040A0E10500000A34309FE559\r
+S3150000E6D0000093E5ECF1FFEB0030A0E30300A0E1BE\r
+S3150000E6E010A81BE99CFFFFEB000050E30130A0E3FC\r
+S3150000E6F0F9FFFF0A0C309FE5000093E5E2F1FFEB1E\r
+S3150000E7000430A0E1F4FFFFEA981C02000DC0A0E16E\r
+S3150000E710F0DD2DE90150A0E10340A0E114319FE5B1\r
+S3150000E72004B04CE204D04DE20558A0E10448A0E153\r
+S3150000E730001093E54558A0E12439A0E10060A0E16E\r
+S3150000E7404448A0E10558A0E10280A0E10470DBE5A1\r
+S3150000E7500100A0E1FF6006E22558A0E1FF4004E2C7\r
+S3150000E76002A083E29EF1FFEB0530A0E10600A0E1E6\r
+S3150000E7700410A0E10820A0E100708DE571FEFFEB1A\r
+S3150000E7800030A0E37AFF17EEFDFFFF1A9A3F07EE6F\r
+S3150000E790173F07EE0040A0E3C4FFFFEB000050E385\r
+S3150000E7A00100A003F0AD1B09C7FEFFEB88309FE513\r
+S3150000E7B088209FE5000093E584309FE5302083E4C0\r
+S3150000E7C00120A0E30020C3E50A10A0E119F2FFEB47\r
+S3150000E7D0000050E36C309F050020930568309F05CC\r
+S3150000E7E00020830560309FE50030D3E5200013E369\r
+S3150000E7F00A10A0E10900000A014084E2090054E37E\r
+S3150000E800E4FFFF9A2C309FE5000093E59EF1FFEBB5\r
+S3150000E810090054E30000A0930100A083F0AD1BE9BA\r
+S3150000E82028309FE5000093E502F2FFEB000050E37D\r
+S3150000E830F0FFFF0AF2FFFFEA981C0200941C020098\r
+S3150000E840400400609041028040800580A0B1020033\r
+S3150000E850901C02000DC0A0E1F0DD2DE90150A0E101\r
+S3150000E8600340A0E110319FE504B04CE204D04DE234\r
+S3150000E8700558A0E10448A0E1001093E54558A0E141\r
+S3150000E8802439A0E10060A0E14448A0E10558A0E1D8\r
+S3150000E8900280A0E10470DBE50100A0E1FF6006E272\r
+S3150000E8A02558A0E1FF4004E202A083E24CF1FFEB11\r
+S3150000E8B00530A0E10600A0E10410A0E10820A0E1D7\r
+S3150000E8C000708DE5ECFDFFEB0030A0E37AFF17EE5C\r
+S3150000E8D0FDFFFF1A9A3F07EE0040A0E373FFFFEB30\r
+S3150000E8E0000050E30100A003F0AD1B0976FEFFEB2C\r
+S3150000E8F088309FE588209FE5000093E584309FE5FA\r
+S3150000E900302083E40120A0E30020C3E50A10A0E143\r
+S3150000E910C8F1FFEB000050E36C309F050020930523\r
+S3150000E92068309F050020830560309FE50030D3E501\r
+S3150000E930200013E30A10A0E10900000A014084E266\r
+S3150000E940090054E3E4FFFF9A2C309FE5000093E5AD\r
+S3150000E9504DF1FFEB090054E30000A0930100A083F2\r
+S3150000E960F0AD1BE928309FE5000093E5B1F1FFEB20\r
+S3150000E970000050E3F0FFFF0AF2FFFFEA981C0200D6\r
+S3150000E980941C020060040060904102804080058073\r
+S3150000E990A0B10200901C02000DC0A0E170D82DE9C4\r
+S3150000E9A094609FE5003096E5000053E304B04CE226\r
+S3150000E9B00100A01370A81B1980409FE5000094E594\r
+S3150000E9C0000050E31900000A74409FE5000094E53A\r
+S3150000E9D0000050E31200000A68509FE5003095E5FC\r
+S3150000E9E0000053E30B00000A000095E5FCF0FFEB86\r
+S3150000E9F068FEFFEBA6FEFFEB000050E30040A0E13F\r
+S3150000EA000130A013000095E5003086151EF1FFEBDE\r
+S3150000EA100400A0E170A81BE9C8EFFFEB000085E544\r
+S3150000EA20F0FFFFEAF9EFFFEB000084E5E9FFFFEAFC\r
+S3150000EA30F6EFFFEB000084E5E2FFFFEA9C1C020014\r
+S3150000EA40901C0200941C0200981C02000DC0A0E15C\r
+S3150000EA50F0D92DE904B04CE204D04DE202C8A0E1A1\r
+S3150000EA604CC8A0E10380A0E10320A0E1F430DBE183\r
+S3150000EA70FFE001E20C18A0E10CC8A0E12C78A0E1AF\r
+S3150000EA8003C8A0E12C58A0E10338A0E1FF0010E381\r
+S3150000EA902368A0E10E00A0E12118A0E10530A0E165\r
+S3150000EAA008C0DBE50040A0E30500000A00C08DE5D4\r
+S3150000EAB067FFFFEB040050E10540A0010400A0E160\r
+S3150000EAC0F0A91BE90E00A0E10710A0E10820A0E1D3\r
+S3150000EAD00630A0E100C08DE50BFFFFEB000050E320\r
+S3150000EAE00640A0010040A013F3FFFFEA0DC0A0E11D\r
+S3150000EAF00118A0E1F0DF2DE94168A0E104B04CE285\r
+S3150000EB0006C8A0E12C1BA0E1011366E0401081E2DB\r
+S3150000EB100118A0E108D04DE20338A0E14158B0E168\r
+S3150000EB200270A0E1FFA000E24348A0E10490DBE50B\r
+S3150000EB300080A0E32C28A0E11200000A0438A0E11E\r
+S3150000EB40230855E14358A0C105C8A0E10730A0E15C\r
+S3150000EB502CC8A0E10100A0E30A10A0E100C08DE5E9\r
+S3150000EB6004908DE5B8FFFFEB063085E0042065E0F4\r
+S3150000EB700338A0E10228A0E10080A0E14368A0E1FB\r
+S3150000EB804248A0E1057087E00438A0E1000058E3A0\r
+S3150000EB90000053132338A0E10400000A400053E3A9\r
+S3150000EBA00E00008A0438A0E123C8B0E10100001A73\r
+S3150000EBB00800A0E1F0AF1BE90628A0E12228A0E1A9\r
+S3150000EBC00A10A0E10730A0E10100A0E300C08DE536\r
+S3150000EBD004908DE59CFFFFEB000088E0F0AF1BE999\r
+S3150000EBE00628A0E10730A0E12228A0E140C0A0E36A\r
+S3150000EBF00100A0E30A10A0E100C08DE504908DE5B8\r
+S3150000EC0091FFFFEB402044E2403086E20228A0E17B\r
+S3150000EC100338A0E1000050E34368A0E1407087E2BA\r
+S3150000EC204248A0E1E1FFFF0A010552E3008088E0C7\r
+S3150000EC30EAFFFF8ADAFFFFEA0DC0A0E10118A0E1B2\r
+S3150000EC40F0DF2DE94168A0E104B04CE206C8A0E17E\r
+S3150000EC502C1BA0E1011366E0401081E20118A0E13F\r
+S3150000EC6008D04DE20338A0E14158B0E10270A0E1BE\r
+S3150000EC70FFA000E24348A0E10490DBE50080A0E3AA\r
+S3150000EC802C28A0E11200000A0438A0E1230855E16F\r
+S3150000EC904358A0C105C8A0E10730A0E12CC8A0E1F7\r
+S3150000ECA00800A0E10A10A0E100C08DE504908DE502\r
+S3150000ECB065FFFFEB063085E0042065E00338A0E140\r
+S3150000ECC00228A0E10080A0E14368A0E14248A0E15B\r
+S3150000ECD0057087E00438A0E1000058E300005313F4\r
+S3150000ECE02338A0E10400000A400053E30E00008A26\r
+S3150000ECF00438A0E123C8B0E10100001A0800A0E131\r
+S3150000ED00F0AF1BE90628A0E12228A0E10A10A0E145\r
+S3150000ED100730A0E10000A0E300C08DE504908DE57A\r
+S3150000ED2049FFFFEB000088E0F0AF1BE90628A0E1F1\r
+S3150000ED300730A0E12228A0E140C0A0E30000A0E344\r
+S3150000ED400A10A0E100C08DE504908DE53EFFFFEBC3\r
+S3150000ED50402044E2403086E20228A0E10338A0E1E8\r
+S3150000ED60000050E34368A0E1407087E24248A0E11A\r
+S3150000ED70E1FFFF0A010552E3008088E0EAFFFF8A0F\r
+S3150000ED80DAFFFFEA28209FE50010A0E30330A0E3A6\r
+S3150000ED901C1082E5203082E514309FE5010183E7EF\r
+S3150000EDA0011081E2050051E3020A80E20EF0A0C1E3\r
+S3150000EDB0F8FFFFEAC0B102000030A0E37AFF17EEC9\r
+S3150000EDC0FDFFFF1A9A3F07EE34109FE51C2091E5E0\r
+S3150000EDD01C3091E5013083E21C3081E51C3091E561\r
+S3150000EDE000C0A0E3050053E3020191E71CC0818542\r
+S3150000EDF07AFF17EEFDFFFF1A0030A0E39A3F07EEF9\r
+S3150000EE000EF0A0E1C0B102000DC0A0E110D82DE9BE\r
+S3150000EE100010A0E104B04CE20030A0E37AFF17EE48\r
+S3150000EE20FDFFFF1A9A3F07EE30409FE5203094E53C\r
+S3150000EE30022AA0E3030194E70130A0E3EAFAFFEB1C\r
+S3150000EE40203094E5013083E2203084E5203094E5DB\r
+S3150000EE50050053E30030A0832030848510A81BE909\r
+S3150000EE60C0B102000DC0A0E100D82DE904B04CE20B\r
+S3150000EE703A1400EB0120A0E34231A0E3002083E531\r
+S3150000EE800300A0E300A81BE90EF0A0E10DC0A0E17D\r
+S3150000EE9000D82DE904B04CE2301400EB30109FE5A9\r
+S3150000EEA030009FE50236A0E3003081E52020A0E394\r
+S3150000EEB0023643E2003080E5002081E5423183E2FC\r
+S3150000EEC0002080E51F2042E2002083E50300A0E346\r
+S3150000EED000A81BE918400280144002800DC0A0E182\r
+S3150000EEE000D82DE928309FE5000093E5000050E3A7\r
+S3150000EEF004B04CE20400001A18209FE50236A0E395\r
+S3150000EF00043002E4003082E500A81BE9C71400EBD8\r
+S3150000EF10F8FFFFEAA81C0200184002802C309FE58B\r
+S3150000EF20000093E5000050E30EF0A00120309FE5BD\r
+S3150000EF30003093E51C309FE51C209FE5003093E5EB\r
+S3150000EF40033062E0FF0EC3E30F00C0E30EF0A0E162\r
+S3150000EF50A41C0200C042028090420280700400603D\r
+S3150000EF6000009FE50EF0A0E17004006084C09FE5FC\r
+S3150000EF7084209FE584309FE5D202A0E3021A8CE24A\r
+S3150000EF80081083E5002083E5040083E5003082E570\r
+S3150000EF90011082E90030A0E37AFF17EEFDFFFF1AA9\r
+S3150000EFA09A3F07EE58009FE558C09FE558309FE509\r
+S3150000EFB00226A0E32010A0E3002083E5001080E5F0\r
+S3150000EFC000108CE5002080E500208CE52C209FE5D4\r
+S3150000EFD09B3F83E2002083E50120A0E3303083E2FB\r
+S3150000EFE00020C3E50030A0E37AFF17EEFDFFFF1A0D\r
+S3150000EFF09A3F07EE0EF0A0E1700400607004016015\r
+S3150000F000800401601840028014400280044002809F\r
+S3150000F0100DC0A0E100D82DE904B04CE220309FE5F8\r
+S3150000F020000093E5D9EFFFEBBBFFFFEB0030A0E15B\r
+S3150000F030020A53E30C009FE50C009F3571FFFFEBBE\r
+S3150000F040F5FFFFEAA81C020070040060702400604F\r
+S3150000F0500DC0A0E170D82DE9B4309FE504B04CE2B4\r
+S3150000F0600CD04DE2AC509FE5004093E5000054E221\r
+S3150000F070A4609FE570A81B1964EEFFEB9C309FE52A\r
+S3150000F0800020A0E1002083E50410A0E10420A0E117\r
+S3150000F0900430A0E188009FE500408DE504408DE541\r
+S3150000F0A0DEEDFFEB7CC09FE500C08DE578C09FE5F7\r
+S3150000F0B00410A0E10420A0E170309FE53100A0E338\r
+S3150000F0C020108DE9711300EB000095E5841300EB29\r
+S3150000F0D05CC09FE500C08DE558C09FE50420A0E117\r
+S3150000F0E00410A0E150309FE53200A0E340108DE906\r
+S3150000F0F0661300EB000096E5791300EB3C309FE5C4\r
+S3150000F100012BA0E33100A0E3002083E570681BE932\r
+S3150000F1108C1300EAAC1C0200B87F0200D87F020004\r
+S3150000F120A81C020010F00000DCEE00009C7F02002C\r
+S3150000F1308CEE000088EE0000BC7F020064EE00004A\r
+S3150000F1402401008004E02DE510309FE5003093E5B2\r
+S3150000F150000053E204F09D0404E09DE48BEFFFEA17\r
+S3150000F160A81C02000DC0A0E110D82DE9CC309FE507\r
+S3150000F170004093E5000054E304B04CE20400000AAA\r
+S3150000F1800030A0E37AFF17EEFDFFFF1A9A3F07EE65\r
+S3150000F19010A81BE9A8009FE5F9FEFFEB0129A0E3F3\r
+S3150000F1A0A0009FE50410A0E1BE1100EB98209FE5AA\r
+S3150000F1B00231A0E3043002E4003082E56330A0E3CC\r
+S3150000F1C00000A0E1013053E2FCFFFF5A78209FE5E2\r
+S3150000F1D00131A0E3043002E4003082E56330A0E3AD\r
+S3150000F1E00000A0E1013053E2FCFFFF5A5EFFFFEB97\r
+S3150000F1F058309FE50228A0E3002083E50000A0E345\r
+S3150000F200403083E2000083E50E20A0E3383043E27D\r
+S3150000F210002083E538109FE538309FE5003081E512\r
+S3150000F2200232A0E3003081E52C309FE5000083E543\r
+S3150000F23008309FE50D2042E2002083E5CFFFFFEA7C\r
+S3150000F240A41C02007044006070040060084007803F\r
+S3150000F250004007800440078001800000A01C0200D7\r
+S3150000F26094309FE5003093E5010053E30400000A63\r
+S3150000F2700030A0E37AFF17EEFDFFFF1A9A3F07EE74\r
+S3150000F2800EF0A0E174209FE574309FE5003082E522\r
+S3150000F2900232A0E3003082E568309FE50211A0E368\r
+S3150000F2A0001082E5001083E56330A0E30000A0E1D2\r
+S3150000F2B0013053E2FCFFFF5A40209FE50131A0E3F5\r
+S3150000F2C0043002E4003082E56330A0E30000A0E1F0\r
+S3150000F2D0013053E2FCFFFF5A2C309FE50226A0E3E3\r
+S3150000F2E0002083E510309FE50010A0E3001083E5C1\r
+S3150000F2F018309FE5001083E5DCFFFFEAA41C02003E\r
+S3150000F3000840078001800000044007800440028016\r
+S3150000F310A01C020004309FE5000093E50EF0A0E17A\r
+S3150000F320A41C0200F0472DE92221A0E13CD04DE2C9\r
+S3150000F33000208DE500309DE50020A0E3030052E1AA\r
+S3150000F34030208DE538008DE534108DE5EE02002A7B\r
+S3150000F350543F9FE5544F9FE5F010D3E1503F9FE5A2\r
+S3150000F360F000D3E1F030D4E1930101E0448F9FE552\r
+S3150000F370F020D8E1403F9FE5900202E0F030D3E173\r
+S3150000F38024308DE5343F9FE538909DE5F030D3E19C\r
+S3150000F390F2C0D9E01C308DE524309DE58110A0E156\r
+S3150000F3A09C1323E0F200D9E01C409DE58220A0E1F9\r
+S3150000F3B0902424E020308DE5043F9FE5F0A0D3E1C2\r
+S3150000F3C0003F9FE5F030D3E1FC8E9FE514308DE5DC\r
+S3150000F3D0F83E9FE518408DE5F020D8E1F0E0D3E156\r
+S3150000F3E038908DE5E83E9FE5E89E9FE5E84E9FE56F\r
+S3150000F3F0E88E9FE5F050D3E1F010D9E1F030D4E18A\r
+S3150000F40024909DE5F040D8E120809DE5D07E9FE5E3\r
+S3150000F410998222E018808DE2000398E8C46E9FE589\r
+S3150000F420998121E02CC08DE514909DE5F0C0D7E1CF\r
+S3150000F43028008DE5990C0CE0F000D6E1930E0EE065\r
+S3150000F440940503E09A0000E08C1041E0011063E0AF\r
+S3150000F450603E9FE5802042E002206EE04CCE9FE5B4\r
+S3150000F460B0E0D3E1803E9FE5B000DCE1B040D7E1FB\r
+S3150000F470B0C0D6E1001083E538909DE5F280D9E072\r
+S3150000F480283E9FE538908DE52C909DE5B090C3E130\r
+S3150000F490203E9FE528909DE5B090C3E14C3E9FE558\r
+S3150000F4A0C227A0E1B020C3E1443E9FE5C157A0E1D9\r
+S3150000F4B0B050C3E13C3E9FE5003093E5000053E3C6\r
+S3150000F4C0B020C6E1302E9F050538A001B020D2013C\r
+S3150000F4D04338A00192030300203E9F151C2E9F0572\r
+S3150000F4E0C337A001B030C201B050C311103E9FE532\r
+S3150000F4F0D41D9FE5003093E5B000C1E1000053E361\r
+S3150000F500D01D9FE5F43D9F15B0E0C1E10010A013AA\r
+S3150000F510C40D9FE5B010C311E83D9FE5B0C0C0E142\r
+S3150000F520003093E538009DE5B0CD9FE5020080E20E\r
+S3150000F530000053E3B040CCE1B050C7E138008DE5A0\r
+S3150000F5409304001AC03D9FE5B020D3E19C3D9FE5A2\r
+S3150000F550F000D3E1A43D9FE5F030D3E1930201E052\r
+S3150000F560900203E0742F9FE5C337A0E1B030C2E1FB\r
+S3150000F570703F9FE5C117A0E1B010C3E15C6F9FE546\r
+S3150000F580607F9FE5F030D6E1F000D7E1031060E040\r
+S3150000F590003083E0A33F83E0702D9FE5C340A0E1E8\r
+S3150000F5A06C3D9FE5002092E5A11F81E0B040C3E1DC\r
+S3150000F5B0603D9FE5C150A0E1000052E3B050C3E1B9\r
+S3150000F5C07004001A50CD9FE550ED9FE500109CE5B4\r
+S3150000F5D000009EE50438A0E10528A0E1433881E05B\r
+S3150000F5E0422880E0413443E0402442E0431444E0B2\r
+S3150000F5F0420445E0B010C6E1B000C7E100308CE53A\r
+S3150000F60000208EE5180D9FE5183D9FE5001093E557\r
+S3150000F610003090E5030051E10C3D9F150120A01339\r
+S3150000F6200020831500CD9FE500309CE5000053E3E4\r
+S3150000F630001080E50A00000A000051E34504001AA4\r
+S3150000F6408C0E9FE58C3E9FE5B020D3E1B030D0E133\r
+S3150000F650033062E0020913E3B030C0E100108C15FC\r
+S3150000F660B010C011681E9FE5703E9FE5F020D3E103\r
+S3150000F670F030D1E1920303E034209DE5C337A0E1E9\r
+S3150000F680B230C2E05C3E9FE534208DE5F030D3E138\r
+S3150000F690F020D1E1920303E030408DE2100294E8BD\r
+S3150000F6A0C337A0E1B230C9E0070014E334908DE51A\r
+S3150000F6B00F02001A743C9FE50828A0E1A22AA0E1E7\r
+S3150000F6C01F1008E21201A0E164CC9FE5B020C3E15F\r
+S3150000F6D0603C9FE5010650E3B010C3E100008CE5F5\r
+S3150000F6E0E83D9F2514C0A0233800002A020750E3F6\r
+S3150000F6F0D83D9F251300A023F803002A010750E3F5\r
+S3150000F700C83D9F251210A023FA03002A020850E3E1\r
+S3150000F710B83D9F251120A023FC03002A010850E3D1\r
+S3150000F720A83D9F251040A023FE03002A020950E3AE\r
+S3150000F730983D9F250F80A0230204002A010950E36B\r
+S3150000F740883D9F250E90A0230004002A020A50E35C\r
+S3150000F750783D9F250DC0A0231C00002A010A50E316\r
+S3150000F760683D9F250C00A023DC03002A020B50E312\r
+S3150000F770583D9F250B10A023DE03002A00309CE590\r
+S3150000F780010B53E3443D9F250A20A023DF03002AF3\r
+S3150000F790020C53E3343D9F250940A023E103002AD0\r
+S3150000F7A0FF0053E3243D9F850880A083E503008A7C\r
+S3150000F7B07F0053E3143D9F850790A083E303008AEF\r
+S3150000F7C03F0053E3C103009A003D9FE506C0A0E356\r
+S3150000F7D0B0C0C3E1583B9FE5004093E5EC3C9FE594\r
+S3150000F7E0B020D3E1841084E0823082E0313283E0BD\r
+S3150000F7F0033043E2409B9FE5020913E300C0A013D8\r
+S3150000F800B030C9E1B0C0C911300B9FE5B0C0D9E135\r
+S3150000F810B030D0E101C08CE2247B9FE50C0083E090\r
+S3150000F820206B9FE5A30140E0B050D7E1183B9FE570\r
+S3150000F8302442A0E1B010D6E10028A0E1B0E0D3E177\r
+S3150000F840853044E0031081E0A2A9A0E1FC3A9FE5DF\r
+S3150000F8500A24A0E1B020C3E1F43A9FE5B010C3E169\r
+S3150000F860F03A9FE5D41A9FE5B0A0C3E1E83A9FE5D8\r
+S3150000F87000005EE3B050C6E1B040C7E1B0C0C9E1E8\r
+S3150000F880B000C1E1B040C3E18F01001ACC3A9FE558\r
+S3150000F8900A2CA0E1B000D3E12218A0E1000051E15A\r
+S3150000F8A0BC3A9F85BC3A9F95B020D3E1FF3C62E20B\r
+S3150000F8B0FF3083E2910303E0903222E0901A9FE545\r
+S3150000F8C0A43A9FE5A04A9FE5002083E5F030D1E108\r
+S3150000F8D0B220D4E1000053E3803A9FE5B020C3E1B3\r
+S3150000F8E0883A9FE5B020C3E1B030D1E1003063B281\r
+S3150000F8F0B030C1B1782A9FE5B030D1E1B020D2E175\r
+S3150000F900033062E06C2A9FE5020913E3B030C2E1DE\r
+S3150000F9100030A013B030C2115C0A9FE5B020D2E1DE\r
+S3150000F920B030D0E1022083E0A32142E04C3A9FE5CB\r
+S3150000F9300218A0E1B0E0D3E1A119A0E1403A9FE5A9\r
+S3150000F9400E0051E1B010C3E1383A9F85383A9F95D1\r
+S3150000F950B020C0E1B020D3E1FF3C62E201C0A0E1EB\r
+S3150000F960FF3083E29C0303E09E3223E0003084E50F\r
+S3150000F9700C3A9FE5F0C99FE5B010D3E10C3A9FE53C\r
+S3150000F980B220DCE1B000D3E1F0399FE5B020C3E15D\r
+S3150000F990FC399FE5000051E1B020C3E1F4399F85B1\r
+S3150000F9A0F4399F95B020D3E1FF3C62E2FF3083E259\r
+S3150000F9B0910303E0903223E000308CE5DC399FE5CB\r
+S3150000F9C0B020D3E1C8399FE5B030D3E1930202E01D\r
+S3150000F9D0CC399FE5B010D3E190399FE5B0C0D3E1B3\r
+S3150000F9E084399FE51221A0E1B210D3E1B4399FE535\r
+S3150000F9F0B010C3E194399FE5B010C3E1A8399FE583\r
+S3150000FA00B030D3E1910303E0A0099FE5C2274CE0A3\r
+S3150000FA10020912E3B020C0E194299FE5B020D2E1AB\r
+S3150000FA201332A0E18C299FE5C3374CE00040A013B8\r
+S3150000FA30B030C2E1B040C011020913E378399FE546\r
+S3150000FA40F010D0E1B030D3E10080A013B080C21135\r
+S3150000FA50030051E164299FD50E0000DA60399FE565\r
+S3150000FA60B000D3E1000051E158399FB5B020D3B1C1\r
+S3150000FA70003061B0930201B04C399FB5B020D3B1CC\r
+S3150000FA8048399FB5513243B044299FB5B030C2B111\r
+S3150000FA90020000BA34299FE534399FE5B020C3E15E\r
+S3150000FAA030399FE5003093E5000053E31700001A54\r
+S3150000FAB000399FE5F010D3E11C399FE5B030D3E162\r
+S3150000FAC0030051E1F4289FD50E0000DA0C399FE5BA\r
+S3150000FAD0B000D3E1000051E104399FB5B020D3B1A5\r
+S3150000FAE0003061B0930201B0F8389FB5B020D3B1B1\r
+S3150000FAF0D8389FB5513243B0EC289FB5B030C2B16B\r
+S3150000FB00020000BAC4289FE5DC389FE5B020C3E1B7\r
+S3150000FB10A0389FE5D110D3E1D0389FE5B020D3E1DE\r
+S3150000FB20022061E0020912E3D0079FE50090A013CE\r
+S3150000FB30B020C0E1B8389FE5B090C011B010C3E165\r
+S3150000FB40B030D0E1143063E2020913E38C299FE55B\r
+S3150000FB5000C0A013B030C2E1B0C0C211F020D2E1A3\r
+S3150000FB600E0052E3823282C088289FC5832182C05C\r
+S3150000FB70050000CA090052E3C70200DA023182E03A\r
+S3150000FB8074289FE5033383E0832082E054399FE5A0\r
+S3150000FB90B020C3E14CC99FE5B030DCE158279FE5B2\r
+S3150000FBA0020913E3B030C2E10239E013B030C211EA\r
+S3150000FBB0F8379FE5D110D3E140389FE5B020D3E177\r
+S3150000FBC03C389FE5022061E0020912E32C079FE51D\r
+S3150000FBD0B010C3E10010A013B020C0E1B010C011F6\r
+S3150000FBE0B030D0E1F4289FE5143063E2020913E354\r
+S3150000FBF0B030C2E10030A013B030C211F030D2E113\r
+S3150000FC00100053E3833183C0503043C2090000CA59\r
+S3150000FC100C0053E3833083C08330A0C1213043C23C\r
+S3150000FC20040000CA080053E30331A0C18330A0D109\r
+S3150000FC30083043C2093083D2B030CCE1A4389FE506\r
+S3150000FC40F030D3E1032183E0BC169FE5823183E0E7\r
+S3150000FC50010A13E38331A0E1B030C1E10239E013B8\r
+S3150000FC60B030C1119C379FE5B020D1E1030052E1CD\r
+S3150000FC7001308392B030C1918C379FE5003093E517\r
+S3150000FC80000053E39000001A48379FE5002093E5F3\r
+S3150000FC90010052E378369F0574369F150240A01383\r
+S3150000FCA0B020C301B040C31164369FE5F020D3E114\r
+S3150000FCB048169FE50030A0E3020053E1B030C1E1F1\r
+S3150000FCC07D0000AAF030D1E1000053E300279F0534\r
+S3150000FCD014279F1504389FE5B020D2E1B020C3E178\r
+S3150000FCE0F8379FE5F020D3E120379FE5030052E186\r
+S3150000FCF0D70000CA18279FE5CC379FE5B020C3E19F\r
+S3150000FD00BC379FE50D2042E2B020C3E104279FE502\r
+S3150000FD1074379FE5B020C3E190379FE50110A0E35B\r
+S3150000FD2098279FE5B010C3E164379FE5B020C3E193\r
+S3150000FD306C279FE55C379FE5B020C3E1D8269FE599\r
+S3150000FD4074379FE5B020C3E15C379FE5CC269FE57D\r
+S3150000FD50B020C3E158379FE50200A0E3B000C3E13D\r
+S3150000FD6060379FE58A8EE0E3B080C3E144379FE5C4\r
+S3150000FD70B010C3E120379FE5B000C3E17C359FE5B5\r
+S3150000FD80F030D3E1000053E37200001A4C379FE5D0\r
+S3150000FD90F010D3E1813361E0033161E0031181E0CA\r
+S3150000FDA014379FE5F0E0D3E11C379FE5F0C0D3E1BF\r
+S3150000FDB00C379FE5011161E0F000D3E18111A0E16C\r
+S3150000FDC0CC369FE5C117A0E1F030D3E10128A0E1D0\r
+S3150000FDD02228A0E1920306E0E8369FE5920005E0BE\r
+S3150000FDE0F000D3E1A0369FE5920E07E0920C04E006\r
+S3150000FDF0F0E0D3E19C369FE5F0C0D3E1A8369FE55D\r
+S3150000FE00F020D3E1AC369FE5B090D3E19C369FE578\r
+S3150000FE10B030D3E110308DE57C369FE5B0A0D3E15C\r
+S3150000FE208C369FE5B030D3E18440A0E1C777A0E1EE\r
+S3150000FE300C308DE5440880E00738A0E1432882E0D5\r
+S3150000FE408550A0E110309DE5990000E045E88EE080\r
+S3150000FE50930E0EE08660A0E146C88CE09A0C0CE09A\r
+S3150000FE600C409DE5940202E04C349FE5B000C3E1EE\r
+S3150000FE7034349FE5B0E0C3E144349FE5B0C0C3E14C\r
+S3150000FE8048349FE5B020C3E194359FE5B010C3E147\r
+S3150000FE9050369FE564149FE5B070C3E1B020D1E110\r
+S3150000FEA06C349FE5012082E2F000D3E10238A0E144\r
+S3150000FEB0430850E1B020C1E181FFFFCA14359FE538\r
+S3150000FEC0003093E5010053E31100000A78049FE532\r
+S3150000FED0B020D0E14C359FE5012082E293C2C1E01B\r
+S3150000FEE0C23FA0E1413163E0033183E0832042E079\r
+S3150000FEF0B020C0E130009DE500109DE5010080E2E4\r
+S3150000FF00010050E130008DE510FDFF3A3CD08DE256\r
+S3150000FF10F087BDE8A0239FE5A0339FE5B020D2E19E\r
+S3150000FF20B020C3E180239FE584339FE5B020D2E172\r
+S3150000FF30B020C3E188239FE588339FE5B020D2E156\r
+S3150000FF40B020C3E184239FE584339FE5B020D2E14E\r
+S3150000FF50B020C3E1DCFFFFEA80359FE5F010D3E176\r
+S3150000FF60813361E0033161E0031181E048359FE5AB\r
+S3150000FF70F0E0D3E150359FE5011161E0F0C0D3E137\r
+S3150000FF803C359FE58111A0E1F000D3E1C117A0E166\r
+S3150000FF90FC349FE50128A0E12228A0E1F030D3E15E\r
+S3150000FFA0920C04E0920306E018359FE5920005E006\r
+S3150000FFB0F000D3E1D0349FE5920E07E0F0E0D3E104\r
+S3150000FFC0D0349FE5F0C0D3E1DC349FE5F020D3E1E7\r
+S3150000FFD0E0349FE5B080D3E1D0349FE5B030D3E183\r
+S3150000FFE008308DE5B0349FE58440A0E1B0A0D3E1B0\r
+S3150000FFF0440880E0B8349FE5980000E08550A0E111\r
+S3150001000008809DE5B030D3E145E88EE08660A0E149\r
+S31500010010980E0EE004308DE5C777A0E146C88CE066\r
+S315000100200738A0E19A0C0CE004909DE5432882E094\r
+S31500010030990202E084329FE5B000C3E170329FE588\r
+S31500010040B0E0C3E17C329FE5B0C0C3E180329FE5F9\r
+S315000100508BFFFFEA7D0D52E3220000AAB0239FE544\r
+S3150001006064349FE5B020C3E154349FE50D2042E29C\r
+S31500010070B020C3E19C239FE50C349FE5B020C3E18A\r
+S3150001008038249FE508349FE5B020C3E110249FE59D\r
+S3150001009000349FE5B020C3E18C239FE518349FE52A\r
+S315000100A0B020C3E100349FE580239FE5B020C3E182\r
+S315000100B0FC339FE50110A0E3B010C3E104349FE5D2\r
+S315000100C08A9EE0E3B090C3E1E8339FE5B010C3E157\r
+S315000100D0D8339FE5B010C3E1BC339FE502C0A0E36E\r
+S315000100E0B0C0C3E124FFFFEA44339FE5030052E1B8\r
+S315000100F0210000CA3C239FE5CC339FE5B020C3E134\r
+S3150001010034239FE5BC339FE5B020C3E12C239FE553\r
+S31500010110AC339FE5B020C3E124239FE568339FE517\r
+S31500010120B020C3E194239FE564339FE5B020C3E18A\r
+S315000101306C239FE55C339FE5B020C3E178339FE5EF\r
+S31500010140DD2F82E2B020C3E15C339FE5F4229FE517\r
+S31500010150B020C3E158339FE50110A0E3B010C3E11D\r
+S3150001016050339FE5B010C3E140339FE5B010C3E1C2\r
+S3150001017024339FE50200A0E3FEFEFFEAC8329FE5B5\r
+S31500010180030052E1220000CAA8229FE538339FE509\r
+S31500010190B020C3E1A0229FE528339FE5B020C3E14B\r
+S315000101A098229FE518339FE5B020C3E190229FE591\r
+S315000101B0D4329FE5B020C3E100239FE5D0329FE50D\r
+S315000101C0B020C3E1D8229FE5C8329FE5B020C3E144\r
+S315000101D078229FE5D0329FE5B020C3E1D0329FE57A\r
+S315000101E00110A0E3B010C3E1C8329FE5B010C3E12E\r
+S315000101F0B8329FE5B010C3E19C329FE50210A0E33F\r
+S31500010200B010C3E1B0329FE5B420E0E3B020C3E112\r
+S31500010210D9FEFFEA38329FE5030052E1B20000CA77\r
+S3150001022038229FE5A0329FE5B020C3E130229FE549\r
+S3150001023090329FE5B020C3E134229FE580329FE5ED\r
+S31500010240B020C3E120229FE53C329FE5B020C3E107\r
+S3150001025068229FE538329FE5B020C3E140229FE541\r
+S3150001026030329FE5B020C3E12C329FE50210A0E3B6\r
+S31500010270E0219FE5B010C3E13C329FE5B020C3E128\r
+S3150001028024329FE5D0219FE5B020C3E124329FE5CA\r
+S31500010290B010C3E114329FE5B010C3E110329FE5FF\r
+S315000102A00140A0E3B040C3E1B3FEFFEA24800200AF\r
+S315000102B0328002002C8002003A8002002280020075\r
+S315000102C02A800200268002002E800200348002006D\r
+S315000102D028800200308002003C8002003880020043\r
+S315000102E0408002003E8002003680020074800200D7\r
+S315000102F04280020044800200B88002001C80020095\r
+S3150001030078800200B4800200BC8002001A800200DC\r
+S31500010310C48002007E80020080800200DC7F020031\r
+S31500010320E07F020068800200648002006C800200A7\r
+S31500010330EE7F0200E47F0200F07F0200E87F020008\r
+S31500010340EA7F0200FE7F020000800200FA7F0200BF\r
+S31500010350F47F020002800200EC7F0200FC7F0200B3\r
+S31500010360F87F020082800200848002007080020011\r
+S31500010370F67F02008E8002001080020004800200D7\r
+S315000103800A80020006800200868002008880020040\r
+S315000103900E800200088002008A8002008C80020022\r
+S315000103A090800200948002000C800200928002007C\r
+S315000103B012800200968002001480020098800200DA\r
+S315000103C0881300009A800200A4800200A680020021\r
+S315000103D06842000016800200B08002009C80020084\r
+S315000103E09E800200A8800200AA80020018800200F6\r
+S315000103F0A28002001E8002005F6B0000BC54000058\r
+S31500010400A080020020800200CC0C0000C080020007\r
+S315000104106F1700005656000063F7FFFFA89FFFFF06\r
+S31500010420B22D00005E800200676666660186FFFFE8\r
+S31500010430244800000F270000116F000066EEFFFF41\r
+S315000104402E6F000018EEFFFFDF300000DF2E0000E8\r
+S31500010450F3160000AF3600002B380000ECF7FFFF63\r
+S31500010460734700008AEEFFFF5F7800000BEEFFFF87\r
+S315000104704F4600001D4800001F640000A3CAFFFF8D\r
+S31500010480A460000040DCFFFF9A6000004C8002007F\r
+S315000104904ADCFFFF568002005280020054800200AF\r
+S315000104A0B64B0000B1C2FFFF69D0FFFF58800200C2\r
+S315000104B04E8002005A800200488002005C800200E1\r
+S315000104C09E7B000050800200468002004A800200A6\r
+S315000104D0F27F020060800200C880020042800200B2\r
+S315000104E07A800200788002007C800200FA0D52E3D5\r
+S315000104F0220000AA9C201FE534301FE5B020C3E18D\r
+S31500010500A4201FE544301FE5B020C3E1A0201FE56C\r
+S3150001051054301FE5B020C3E1B4201FE598301FE534\r
+S31500010520B020C3E16C201FE59C301FE5B020C3E17C\r
+S3150001053094201FE5A4301FE5B020C3E1A8301FE5D4\r
+S315000105400210A0E3B010C3E1E8201FE598301FE5D3\r
+S31500010550B020C3E1A4301FE5B010C3E1B4301FE5FC\r
+S31500010560B010C3E1C0301FE5C38DE0E3B080C3E145\r
+S31500010570C4301FE50190A0E3B090C3E1FEFDFFEAA0\r
+S3150001058018311FE5030052E1210000CA14211FE5BD\r
+S31500010590CC301FE5B020C3E11C211FE5DC301FE58F\r
+S315000105A0B020C3E124211FE5EC301FE5B020C3E1F3\r
+S315000105B028211FE530311FE5B020C3E104211FE5E5\r
+S315000105C034311FE5B020C3E12C211FE53C311FE585\r
+S315000105D0B020C3E164211FE524311FE5B020C3E14A\r
+S315000105E03C311FE570211FE5B020C3E140311FE515\r
+S315000105F00210A0E3B010C3E148311FE5B010C3E11A\r
+S3150001060058311FE5B010C3E174311FE5B010C3E1E5\r
+S31500010610D9FDFFEA9C211FE554311FE5B020C3E156\r
+S31500010620A4211FE564311FE5B020C3E1AC211FE51C\r
+S3150001063074311FE5B020C3E1B0211FE5B8311FE5D4\r
+S31500010640B020C3E18C211FE5BC311FE5B020C3E119\r
+S31500010650B4211FE5C4311FE5B020C3E1C8311FE550\r
+S315000106600210A0E3CC211FE5B010C3E1B8311FE5AC\r
+S31500010670B020C3E1D0311FE5D8211FE5B020C3E189\r
+S31500010680D0311FE5B010C3E1E0311FE5B010C3E181\r
+S31500010690E4311FE504C0A0E390FEFFEA040052E343\r
+S315000106A0823162C0823262D0033283C0833182D00A\r
+S315000106B0033262C0033263D08F3D83C2023083D0DE\r
+S315000106C0E0211FE50E3083C2B030C2E130FDFFEA02\r
+S315000106D01F0053E30300009A10321FE50500A0E353\r
+S315000106E0B000C3E13AFCFFEA0F0053E30300009AAE\r
+S315000106F028321FE50410A0E3B010C3E134FCFFEA81\r
+S31500010700070053E30300009A40321FE50320A0E3EC\r
+S31500010710B020C3E12EFCFFEA030053E30300009A75\r
+S3150001072058321FE50240A0E3B040C3E128FCFFEACE\r
+S31500010730010053E36C321F950090A0930300009AC9\r
+S3150001074078321FE50180A0E3B080C3E120FCFFEA17\r
+S31500010750B090C3E11EFCFFEA8C121FE58C321FE547\r
+S31500010760B020D3E1B030D1E1023083E0020913E3D6\r
+S31500010770B030C1E10239E013B030C1110030A0132D\r
+S3150001078000308C15B6FBFFEAB040C6E1B050C7E1B8\r
+S315000107909BFBFFEAC0221FE5C0321FE5B020D2E174\r
+S315000107A0B020C3E1C8221FE5C8321FE5B020D2E15F\r
+S315000107B0B020C3E170FBFFEA58239FE50030A0E3B8\r
+S315000107C0F0402DE9B030C2E14C239FE5B030C2E1E3\r
+S315000107D048239FE5003082E544239FE5B030C2E11E\r
+S315000107E040239FE5B030C2E13C239FE5B030C2E132\r
+S315000107F038239FE5B030C2E134239FE5B030C2E132\r
+S3150001080030239FE5B030C2E12C239FE5B030C2E131\r
+S3150001081028239FE5B030C2E124239FE5B030C2E131\r
+S3150001082020239FE5B030C2E11C239FE5B030C2E131\r
+S3150001083018239FE5B030C2E114239FE5B030C2E131\r
+S3150001084010239FE5B030C2E10C239FE5B030C2E131\r
+S3150001085008239FE5B030C2E104239FE5B030C2E131\r
+S3150001086000239FE5B030C2E1FC229FE5B030C2E132\r
+S31500010870F8229FE5B030C2E1F4229FE5B030C2E133\r
+S31500010880F0229FE5B030C2E1EC229FE5B030C2E133\r
+S31500010890E8229FE5B030C2E1E4229FE5B030C2E133\r
+S315000108A0E0229FE5B030C2E1DC229FE5B030C2E133\r
+S315000108B0D8229FE5B030C2E1D4229FE5B030C2E133\r
+S315000108C0D0229FE5B030C2E1CC229FE5CC129FE554\r
+S315000108D0B030C2E1C8229FE5C8C29FE5B010C2E1AF\r
+S315000108E0C4229FE5C4E29FE5B0C0C2E1C0229FE5F4\r
+S315000108F0C0429FE5B0E0C2E1BC229FE5B040C2E143\r
+S31500010900B8229FE5B030C2E1B4229FE5B030C2E122\r
+S31500010910B0229FE5B030C2E1AC229FE5B030C2E122\r
+S31500010920A8229FE5B030C2E1A4229FE5B030C2E122\r
+S31500010930A0229FE5B030C2E19C229FE5B030C2E122\r
+S3150001094098229FE5B030C2E194229FE5B030C2E122\r
+S3150001095090229FE5B030C2E18C229FE5B030C2E122\r
+S3150001096088229FE5B030C2E184229FE5B030C2E122\r
+S3150001097080229FE5B030C2E17C229FE5B030C2E122\r
+S3150001098078229FE5B030C2E174229FE5B030C2E122\r
+S3150001099070229FE5B030C2E16C229FE5B030C2E122\r
+S315000109A068229FE50209E0E3B000C2E160229FE50B\r
+S315000109B0B000C2E15C229FE5003082E558229FE546\r
+S315000109C0003082E554229FE5B030C2E150229FE516\r
+S315000109D0B010C2E14C229FE5B0C0C2E148229FE5BA\r
+S315000109E0B0E0C2E144229FE544129FE5B040C2E176\r
+S315000109F040229FE5B010C2E13C129FE53C229FE5F3\r
+S31500010A00B010C2E138229FE538129FE538529FE5C2\r
+S31500010A10B010C2E134229FE5B050C2E130229FE519\r
+S31500010A20B000C2E12C229FE50A60A0E3B060C2E1FA\r
+S31500010A3024229FE5003082E520229FE50170A0E394\r
+S31500010A40007082E518229FE5B050C2E114229FE5AD\r
+S31500010A50B000C2E110229FE5B030C2E10C229FE551\r
+S31500010A60B030C2E108229FE5B060C2E104229FE5F1\r
+S31500010A70003082E500229FE5003082E5FC219FE5FA\r
+S31500010A80003082E5F8219FE5003082E5F4219FE5FB\r
+S31500010A90003082E5F0319FE5B070C3E1EC319FE5AE\r
+S31500010AA09420E0E3B020C3E1E4319FE56420A0E3B4\r
+S31500010AB0B020C3E1DC319FE51B20A0E3B020C3E1F8\r
+S31500010AC0D4319FE5022BA0E3B020C3E1CC319FE5F1\r
+S31500010AD0072BA0E3B020C3E1C4319FE52F20A0E39B\r
+S31500010AE0B020C3E1BC319FE5272CA0E3B020C3E1D0\r
+S31500010AF0B4319FE5312CA0E3B020C3E1AC319FE5D1\r
+S31500010B00962EA0E3B020C3E1A4319FE54B2DA0E3CF\r
+S31500010B10B020C3E1F080BDE800B20200F0B10200EE\r
+S31500010B20E47F0200EE7F0200F07F0200EA7F02000E\r
+S31500010B30EC7F0200F27F0200E87F0200F47F0200F0\r
+S31500010B40F67F0200F87F0200FA7F0200FC7F0200B6\r
+S31500010B50FE7F020000800200028002000480020083\r
+S31500010B6006800200088002000A8002000C80020052\r
+S31500010B700E80020010800200128002001480020022\r
+S31500010B8016800200188002003280020034800200C2\r
+S31500010B9036800200388002003A8002003C80020062\r
+S31500010BA0764900002A8002007C4900002C80020060\r
+S31500010BB0CF3E00002E800200752B0000308002001F\r
+S31500010BC03E80020040800200428002004480020012\r
+S31500010BD046800200488002004A8002004C800200E2\r
+S31500010BE04E800200508002005280020054800200B2\r
+S31500010BF056800200588002005A8002005C80020082\r
+S31500010C005E800200AC800200AE8002001E800200FF\r
+S31500010C101A8002001C800200688002006C800200BB\r
+S31500010C2060800200228002002480020026800200E9\r
+S31500010C30288002005CEDFFFF8280020042FAFFFF7E\r
+S31500010C4084800200888002001CFDFFFF0FCCFFFF9D\r
+S31500010C508A80020092800200AA800200C4800200FB\r
+S31500010C606480020086800200908002009480020067\r
+S31500010C7096800200A6800200B0800200B4800200C5\r
+S31500010C80B8800200BC800200C0800200C880020059\r
+S31500010C908C8002008E800200A080020098800200F3\r
+S31500010CA09A800200A28002009C8002009E800200BF\r
+S31500010CB0A4800200A880020014309FE504E02DE51F\r
+S31500010CC0030051E10100500304F09D1404E09DE48A\r
+S31500010CD0800500EA68BF000014309FE504E02DE5B9\r
+S31500010CE0030051E10100500304F09D1404E09DE46A\r
+S31500010CF0ED0200EA20CB000004E02DE508109FE597\r
+S31500010D000100A0E304E09DE4EAFFFFEA68BF0000FA\r
+S31500010D100DC0A0E1F0D82DE9205090E504B04CE2D9\r
+S31500010D20000055E30040A0E1F0A81B19303094E51E\r
+S31500010D30446080E2000053E30600A0E1847084E28F\r
+S31500010D400E00001A703094E5642084E2000053E33B\r
+S31500010D500700A0E10200001A0130A0E3203084E57B\r
+S31500010D60F0A81BE9385082E5345082E57B0D00EB93\r
+S31500010D707C0084E20710A0E1920D00EBF5FFFFEA8B\r
+S31500010D805C5084E5585084E5605084E5730D00EBB2\r
+S31500010D903C0084E20610A0E18A0D00EB303094E5B8\r
+S31500010DA0C32FA0E1223F83E04331A0E1383084E53F\r
+S31500010DB0E3FFFFEA0DC0A0E1F0DF2DE9146090E545\r
+S31500010DC004B04CE2248086E2440086E202A0A0E15F\r
+S31500010DD00150A0E1007096E5004092E5670D00EB39\r
+S31500010DE00C3098E50090A0E3090053E1389088E5BE\r
+S31500010DF01000001A090054E1014044E2090000DA3A\r
+S31500010E000010D5E50600A0E10FE0A0E100F097E5AE\r
+S31500010E10000050E3F9FFFF0A000054E3015085E2A8\r
+S31500010E20014044E2F5FFFFCA200088E2590D00EBBC\r
+S31500010E300900A0E1F0AF1BE9C40A00EB000054E38E\r
+S31500010E40150000DA043098E50C2098E501C083E22C\r
+S31500010E50101098E502005CE100C0A003020051E118\r
+S31500010E600600A0E11100000A043098E50110D5E45E\r
+S31500010E70002098E5014044E20310C2E7013083E215\r
+S31500010E80043088E504C088E5103098E5013083E236\r
+S31500010E90103088E5000054E3E9FFFFCA0600A0E12F\r
+S31500010EA00FE0A0E10CF097E5C10A00EBDDFFFFEAD8\r
+S31500010EB00130A0E3343088E50FE0A0E10CF097E5BE\r
+S31500010EC0343098E5180088E2000053E30A00001A5E\r
+S31500010ED0383098E5000053E3EDFFFF0A00309AE54C\r
+S31500010EE00020A0E3033064E00390E0E300308AE5EC\r
+S31500010EF0342088E5382088E5E7FFFFEA3C3098E5AD\r
+S31500010F00043083E03C3088E5360D00EB000050E309\r
+S31500010F100130A003383088053C3098E5033064E0A1\r
+S31500010F203C3088E5E9FFFFEA0DC0A0E1F0DF2DE9DD\r
+S31500010F30145090E504B04CE2644085E2840085E2F9\r
+S31500010F400280A0E10160A0E100A095E50B0D00EB98\r
+S31500010F500C3094E50070A0E3070053E10790A0E18F\r
+S31500010F60387084E51000001A003098E5017087E2B8\r
+S31500010F70030059E10300003A200084E2050D00EB6D\r
+S31500010F800900A0E1F0AF1BE90500A0E10FE0A0E137\r
+S31500010F9004F09AE50100C6E4002098E5020057E155\r
+S31500010FA0017087E2F7FFFF3AF2FFFFEA670A00EBFB\r
+S31500010FB0003098E5030057E11700002A103094E548\r
+S31500010FC00150A0E3000053E3180084E2140000DAA4\r
+S31500010FD0081094E5003094E5057087E00120D3E719\r
+S31500010FE00120C6E4083094E50C1094E5053083E051\r
+S31500010FF0083084E5082094E5010052E10030A003A1\r
+S3150001100008308405103094E5013043E2103084E560\r
+S31500011010003098E5030057E1E7FFFF3A640A00EB69\r
+S31500011020D4FFFFEA345084E5EE0C00EB000050E3F8\r
+S3150001103038508405383094E5000053E3F3FFFF0A86\r
+S315000110400030A0E30390E0E3007088E5343084E5E6\r
+S31500011050383084E5F0FFFFEA0100A0E30EF0A0E1DD\r
+S315000110600DC0A0E1F0DD2DE9011C41E2145090E52F\r
+S31500011070011041E204B04CE20370A0E102C0A0E11C\r
+S315000110800080A0E3244085E2646085E200A095E546\r
+S31500011090100051E301F19F97920000EAE010010070\r
+S315000110A018110100941101002C120100A81201006F\r
+S315000110B0E8120100E8120100E8120100E81201003D\r
+S315000110C0E8120100E8120100E8120100E81201002D\r
+S315000110D0E8120100E8120100E8120100F012010015\r
+S315000110E0003093E5130053E30800009A0CE085E213\r
+S315000110F00F00BEE80F00ACE800309EE51420A0E327\r
+S3150001110000308CE5002087E50800A0E1F0AD1BE981\r
+S315000111101500E0E3F0AD1BE90C3094E5000053E364\r
+S31500011120F8FFFF0A207084E20700A0E1930C00EBB0\r
+S31500011130060A00EB3C3094E5000053E31000000A78\r
+S31500011140185084E20160A0E3346084E50500A0E163\r
+S31500011150A40C00EB3C3094E5000050E30380E0036F\r
+S31500011160000053E3F7FFFF1A103094E5000053E344\r
+S31500011170F4FFFFCA0E0A00EB0700A0E1850C00EBA5\r
+S31500011180E0FFFFEA103094E5000053E3EBFFFFCAEE\r
+S31500011190F7FFFFEA0C3094E5000053E3D9FFFF0A9D\r
+S315000111A0206084E20600A0E1740C00EBE70900EB85\r
+S315000111B0103094E5000053E3080000DA0030A0E3A4\r
+S315000111C0103084E5102094E50500A0E1042084E5B3\r
+S315000111D0043094E5083084E50FE0A0E110F09AE5CB\r
+S315000111E00020A0E30230A0E10500A0E13C119FE54B\r
+S315000111F00FE0A0E108F09AE5343094E5000053E3EE\r
+S315000112000200001AEA0900EB0600A0E1DAFFFFEA94\r
+S315000112100130A0E3383084E5180084E2780C00EB55\r
+S315000112200030A0E3343084E5F5FFFFEA0C3096E5A3\r
+S31500011230000053E3B3FFFF0A204086E20400A0E169\r
+S315000112404E0C00EBC10900EB343096E5000053E388\r
+S315000112500D00001A0020A0E3102086E5103096E567\r
+S315000112600500A0E1043086E5041096E50230A0E110\r
+S31500011270081086E5411FA0E30FE0A0E108F09AE51A\r
+S31500011280CB0900EB0400A0E1BBFFFFEA0130A0E3BC\r
+S31500011290383086E5180086E2590C00EB0030A0E3F1\r
+S315000112A0343086E5EAFFFFEA0C3096E5000053E3A9\r
+S315000112B00700001A0C3094E5000053E391FFFF0A82\r
+S315000112C00130A0E3180084E2383084E54C0C00EBD1\r
+S315000112D08CFFFFEA0130A0E3180086E2383086E58C\r
+S315000112E0470C00EBF2FFFFEA1580E0E385FFFFEA1A\r
+S315000112F0003093E50F0053E384FFFF9A1030A0E31B\r
+S31500011300003087E50C3096E5000053E3003082E5B6\r
+S315000113101030961504308CE50C3094E5000053E34B\r
+S3150001132008308CE5103094150C308CE575FFFFEA1A\r
+S31500011330030100000DC0A0E110D82DE9144090E58D\r
+S3150001134004B04CE20400A0E100C094E50FE0A0E186\r
+S3150001135008F09CE510A81BE90DC0A0E170D82DE9A5\r
+S31500011360244080E2103094E504B04CE2000053E3DF\r
+S315000113700050A0E1006090E5150000DA002094E538\r
+S31500011380083094E50500A0E10310D2E70FE0A0E1E3\r
+S3150001139000F096E5000050E31800000A083094E5D5\r
+S315000113A00C1094E5013083E2083084E5082094E5C9\r
+S315000113B0010052E10030A00308308405103094E5A5\r
+S315000113C0013043E2103084E5102094E5000052E339\r
+S315000113D0E9FFFFCA0500A0E10FE0A0E110F096E5E4\r
+S315000113E0343094E5000053E370A81B090030A0E3F4\r
+S315000113F0180084E2343084E570681BE9000C00EAC9\r
+S315000114000C3094E5102094E5141094E5033062E065\r
+S31500011410010053E170A81BB9343094E5000053E391\r
+S31500011420340084151800841270A81B09F1FFFFEA25\r
+S3150001143010402DE964C080E210209CE50C309CE54B\r
+S315000114400040A0E1030052E118008CE2FF1001E226\r
+S315000114500C0000AA683094E5642094E50310C2E705\r
+S31500011460013083E2683084E504209CE50C309CE57C\r
+S31500011470030052E10030A00304308C0510309CE5D6\r
+S31500011480013083E210308CE534309CE5000053E3F3\r
+S315000114901080BD080030A0E334308CE51040BDE873\r
+S315000114A0D70B00EA142090E50530A0E30100A0E384\r
+S315000114B0090082E80EF0A0E1002090E5143092E5E3\r
+S315000114C00000A0E3081083E50EF0A0E10DC0A0E145\r
+S315000114D0F0DF2DE904B04CE24CD04DE20030A0E340\r
+S315000114E0006092E5140090E50350A0E1060053E187\r
+S315000114F06C300BE50390A0E1083090E502A0A0E175\r
+S3150001150070000BE50170A0E174300BE50880E0E3A3\r
+S31500011510015085E21400002A0130D7E474001BE56E\r
+S31500011520FF4003E20A0054E368104BE26C204BE2F1\r
+S315000115301900000A6C301BE528E04BE20EC083E07F\r
+S31500011540013083E23E0053E340404CE56C300BE54D\r
+S31500011550070000CA060055E10500000A0530A0E1B2\r
+S31500011560060053E1015085E2EAFFFF3A0800A0E1D7\r
+S31500011570F0AF1BE9AC0300EB000050E30080A0E1F3\r
+S3150001158000908A15F8FFFF1A6C301BE500609AE59A\r
+S31500011590039089E06C000BE5EFFFFFEA70C01BE5E5\r
+S315000115A000309CE5010013E3E1FFFF0A6C301BE507\r
+S315000115B028C04BE20CE083E0013083E20DC0A0E3DA\r
+S315000115C040C04EE56C300BE5D9FFFFEA0DC0A0E146\r
+S315000115D0F0DF2DE904B04CE208D04DE20040A0E373\r
+S315000115E0003092E5145090E5030054E10270A0E149\r
+S315000115F00190A0E1086095E51B00002A29804BE2D5\r
+S3150001160030A04BE20130A0E30600A0E10810A0E102\r
+S315000116100A20A0E130300BE5960300EB000050E311\r
+S315000116204100001A29305BE50430C9E7042095E53D\r
+S31500011630014084E2080012E30210A0E10700001A4B\r
+S31500011640FF3003E20A0053E32500000A1A0000CA2C\r
+S31500011650080053E30E00000A040012E30500001A15\r
+S31500011660003097E5030054E1E5FFFF3A0000A0E3EF\r
+S31500011670004087E5F0AF1BE90600A0E10810A0E1F4\r
+S315000116800A20A0E10130A0E330300BE5660300EB50\r
+S31500011690F2FFFFEA024054E20040A043EFFFFF4A97\r
+S315000116A0040012E30600A01184109F150A20A01160\r
+S315000116B00330A013F3FFFF1AE8FFFFEA0D0053E31F\r
+S315000116C00100000A7F0053E3E1FFFFEA020012E393\r
+S315000116D0E2FFFF1A010012E30A30A01329304B156D\r
+S315000116E004109515040011E30B00000A003095E57E\r
+S315000116F0010013E30230A0130130A0030600A0117C\r
+S315000117000A20A0112C109F150600A0010810A001A7\r
+S315000117100A20A00130300BE5430300EB29305BE5DD\r
+S31500011720042089E00000A0E3013042E5004087E59E\r
+S31500011730F0AF1BE93C1102004011020004E02DE567\r
+S31500011740143090E5080093E504E09DE4860300EA81\r
+S315000117500DC0A0E130D82DE914E090E54C009FE5DD\r
+S3150001176004B04CE2000051E103C0A0E10240A0E157\r
+S3150001177008009EE50050A0E30300000A880300EB81\r
+S315000117800050A0E10500A0E130A81BE9003093E577\r
+S315000117901500E0E3070053E330A81B990C009EE80F\r
+S315000117A00C0084E80830A0E300308CE5F4FFFFEA82\r
+S315000117B0010200000DC0A0E130D82DE914E090E54A\r
+S315000117C040009FE504B04CE2000051E10240A0E177\r
+S315000117D008009EE50050A0E30300000A850300EB24\r
+S315000117E00050A0E10500A0E130A81BE9003093E517\r
+S315000117F01500E0E3080053E330A81B190C0092E83A\r
+S315000118000C008EE8F6FFFFEA810200000EF0A0E16F\r
+S315000118100DC0A0E100D82DE904B04CE2140090E51A\r
+S31500011820F9FFFFEB0100A0E300A81BE90DC0A0E151\r
+S31500011830FF1001E200D82DE90100A0E104B04CE25D\r
+S315000118409B0100EB0100A0E300A81BE90DC0A0E18C\r
+S3150001185000D82DE904B04CE204D04DE20D004BE274\r
+S31500011860AB0100EB0D005BE500A81BE92C309FE501\r
+S315000118700120A0E10DC0A0E1030052E100D82DE94D\r
+S315000118801C009FE504B04CE218109FE51500E0131B\r
+S3150001189000A81B19FD0600EB0000A0E300A81BE948\r
+S315000118A081010000441102004811020004E02DE507\r
+S315000118B01C209FE51C009FE5003092E5013083E284\r
+S315000118C0010053E3003082E504F09D1404E09DE439\r
+S315000118D0150D00EAD4200200ECAE020004E02DE56D\r
+S315000118E008109FE50100A0E304E09DE4F9FCFFEA8E\r
+S315000118F020CB00000DC0A0E1F0D92DE904B04CE2E7\r
+S3150001190008D04DE20050A0E1FA8FA0E324704BE22B\r
+S3150001191028604BE27D0F55E380409FC5070000CA52\r
+S31500011920053185E0033183E0033263E00343A0E13F\r
+S315000119300400A0E1FA1FA0E3D02E00EB0040A0E1D5\r
+S315000119400700A0E1F02500EB0600A0E1EE2500EB83\r
+S3150001195028004BE2030090E8011040E0000051E34B\r
+S3150001196028100BE55D1C81B2C01081B228100BB5A1\r
+S31500011970040051E1F3FFFFBA980103E020209FE53F\r
+S31500011980C31FA0E19203C3E0C33471E005506310A5\r
+S3150001199001504502000055E3F0A91BD9DCFFFFEA1F\r
+S315000119A0E02E0000F11976050732A0E303F0A0E16D\r
+S315000119B00EF0A0E10EF0A0E10DC0A0E100D82DE9E6\r
+S315000119C01C309FE504B04CE2182093E5000092E537\r
+S315000119D0103092E50FE0A0E103F0A0E1FF0000E284\r
+S315000119E000A81BE9500000000DC0A0E1F0DF2DE9C1\r
+S315000119F09C319FE504B04CE208D04DE294219FE56D\r
+S31500011A00001093E5186092E5000051E3F0AF1B0961\r
+S31500011A1000200FE100400FE1C04084E304F029E11A\r
+S31500011A2030200BE54F90A0E3000096E52410A0E3DB\r
+S31500011A300C3096E50FE0A0E103F0A0E1000096E589\r
+S31500011A400910A0E10C3096E50FE0A0E103F0A0E15A\r
+S31500011A503C319FE50070A0E3002093E50980A0E1F9\r
+S31500011A60020057E1190000AA2CA19FE52C319FE540\r
+S31500011A70000096E50720D3E7017087E22232A0E154\r
+S31500011A800340DAE70F2002E20250DAE70410A0E190\r
+S31500011A900C3096E50FE0A0E103F0A0E1000096E529\r
+S31500011AA00510A0E10C3096E50FE0A0E103F0A0E1FE\r
+S31500011AB0DC309FE5044088E0002093E5FF8004E2E6\r
+S31500011AC0055088E0020057E1FF8005E2E6FFFFBA14\r
+S31500011AD0000096E52310A0E30C3096E50FE0A0E1A7\r
+S31500011AE003F0A0E1B0309FE5000096E52812D3E7A8\r
+S31500011AF00C3096E50FE0A0E103F0A0E198309FE5F8\r
+S31500011B000F2008E20210D3E7000096E50C3096E5B7\r
+S31500011B100FE0A0E103F0A0E1000096E5102096E5B4\r
+S31500011B200FE0A0E102F0A0E10030A0E1FF3003E206\r
+S31500011B302B0053E329004BE20110A0E329304BE5CA\r
+S31500011B400900000A750100EB000050E344309F15BF\r
+S31500011B500120A013442083150300001A29305BE5F8\r
+S31500011B602D0053E3AFFFFF0AEAFFFFEA20209FE5BE\r
+S31500011B700010A0E3001082E530201BE500300FE1E4\r
+S31500011B80C04002E2C030C3E3043083E103F029E13F\r
+S31500011B90F0AF1BE9D8200200500000005C110200E2\r
+S31500011BA0E4800200FF1001E20D0051E304E02DE59F\r
+S31500011BB02CC09FE504F09D0400209CE524309FE5A0\r
+S31500011BC00A0051E30310C2E7012082E200208CE5FE\r
+S31500011BD00100000A640052E304F09D1404E09DE450\r
+S31500011BE080FFFFEAD8200200E48002000DC0A0E1D8\r
+S31500011BF0000052E370D82DE904B04CE20060A0E188\r
+S31500011C000150A0E1014042E270A81B090110D5E490\r
+S31500011C100600A0E1FF1001E2E1FFFFEB000054E343\r
+S31500011C20014044E270A81B09F7FFFFEA0DC0A0E1DD\r
+S31500011C30000052E370D82DE904B04CE20060A0E147\r
+S31500011C400150A0E1014042E270A81B090600A0E193\r
+S31500011C5058FFFFEB000054E30100C5E4014044E2F4\r
+S31500011C6070A81B09F8FFFFEA0DC0A0E10E002DE9DF\r
+S31500011C7000D82DE910B04CE204309BE5080053E38F\r
+S31500011C800100000A0000A0E300A81BE955FFFFEBD5\r
+S31500011C90FBFFFFEA0DC0A0E130D82DE964409FE5C6\r
+S31500011CA004B04CE2343094E50000E0E30FE0A0E13B\r
+S31500011CB003F0A0E1343094E50050A0E10200E0E336\r
+S31500011CC00FE0A0E103F0A0E1141094E538309FE5A0\r
+S31500011CD038209FE5043081E534309FE5082081E511\r
+S31500011CE00C3081E52C209FE52C309FE5102081E505\r
+S31500011CF0143081E5342094E50500A0E10FE0A0E170\r
+S31500011D0002F0A0E130A81BE950000000EC1B010025\r
+S31500011D102C1C0100A41B0100B8190100681C01005C\r
+S31500011D200DC0A0E100D82DE91C309FE504B04CE2BE\r
+S31500011D30182093E5000092E5103092E50FE0A0E14E\r
+S31500011D4003F0A0E1FF0000E200A81BE9500000003B\r
+S31500011D500DC0A0E100D82DE91C309FE504B04CE28E\r
+S31500011D60182093E5FF1001E2000092E50C3092E5A0\r
+S31500011D700FE0A0E103F0A0E100A81BE9500000007C\r
+S31500011D800DC0A0E1000052E370D82DE904B04CE289\r
+S31500011D900060A0E10150A0E1014042E270A81B09E8\r
+S31500011DA00110D5E40600A0E1FF1001E2E7FFFFEB19\r
+S31500011DB0000054E3014044E270A81B09F7FFFFEA63\r
+S31500011DC00DC0A0E1000052E370D82DE904B04CE249\r
+S31500011DD00060A0E10150A0E1014042E270A81B09A8\r
+S31500011DE00600A0E1CDFFFFEB000054E30100C5E4CE\r
+S31500011DF0014044E270A81B09F8FFFFEA0E002DE935\r
+S31500011E000000A0E30CD08DE20EF0A0E10DC0A0E130\r
+S31500011E1030D82DE964409FE504B04CE2343094E5B6\r
+S31500011E200000E0E30FE0A0E103F0A0E1343094E527\r
+S31500011E300050A0E10200E0E30FE0A0E103F0A0E121\r
+S31500011E40141094E538309FE538209FE5043081E58C\r
+S31500011E5034309FE5082081E50C3081E52C209FE593\r
+S31500011E602C309FE5102081E5143081E5342094E57E\r
+S31500011E700500A0E10FE0A0E102F0A0E130A81BE916\r
+S31500011E8050000000801D0100C01D0100501D010011\r
+S31500011E90201D0100FC1D010010209FE50030D2E548\r
+S31500011EA0000053E30130A0030030C2050EF0A0E1AB\r
+S31500011EB0DC2002000DC0A0E100D82DE94C209FE5F1\r
+S31500011EC0FF0000E2143092E50010A0E1000053E3A8\r
+S31500011ED0183092050010A00104B04CE2000093E511\r
+S31500011EE00C3093E50FE0A0E103F0A0E11C209FE593\r
+S31500011EF00010A0E3443092E50100A0E1010053E1A6\r
+S31500011F0000A81B09441082E500681BE98E0000EA5F\r
+S31500011F10500000000DC0A0E110D82DE928209FE552\r
+S31500011F200040A0E1143092E504B04CE2000053E316\r
+S31500011F3018309205000093E5103093E50FE0A0E11B\r
+S31500011F4003F0A0E10000C4E510A81BE95000000061\r
+S31500011F500DC0A0E100D82DE944009FE504B04CE294\r
+S31500011F60182090E5003090E50338A0E12338A0E180\r
+S31500011F700C3043E2330053E300A81B894130A0E350\r
+S31500011F80000052E30510A0E3003080E500A81B091C\r
+S31500011F90000092E5143092E50FE0A0E103F0A0E124\r
+S31500011FA000A81BE9500000000DC0A0E110D82DE9E2\r
+S31500011FB05C309FE504B04CE204D04DE20040A0E362\r
+S31500011FC018C093E50020A0E104005CE10130A0E126\r
+S31500011FD014400BE514104BE20700000A00009CE5D3\r
+S31500011FE018C09CE50FE0A0E10CF0A0E114301BE560\r
+S31500011FF00040A0E1000053E30100001A0400A0E143\r
+S3150001200010A81BE90C309FE5000093E54E0000EB9C\r
+S31500012010F9FFFFEA5000000020B202000DC0A0E166\r
+S3150001202070D82DE99C209FE504B04CE204D04DE226\r
+S315000120300030A0E3185092E50040A0E1000055E30E\r
+S315000120401C300BE50160A0E1010040E20500000A39\r
+S31500012050003092E50610A0E30338A0E12338A0E1A1\r
+S31500012060410053E31200000A000054E10420A0E1FC\r
+S315000120700630A0E11C104BE20100000A0000A0E3BB\r
+S3150001208070A81BE9000095E518C095E50FE0A0E1F1\r
+S315000120900CF0A0E11C301BE5000053E3F6FFFF0A3C\r
+S315000120A024309FE5000093E5270000EB0100A0E343\r
+S315000120B070A81BE9000095E5143095E50FE0A0E155\r
+S315000120C003F0A0E1E7FFFFEA5000000020B20200A2\r
+S315000120D034109FE504E02DE530309FE530209FE583\r
+S315000120E0403081E52C309FE5482081E528209FE599\r
+S315000120F0203081E50100A0E10030A0E31C2081E54C\r
+S315000121004C3081E504E09DE4A11500EA5000000091\r
+S31500012110A8190100F4180100B0190100B419010051\r
+S31500012120000051E30600000A011041E20130D0E748\r
+S31500012130030053E30100A0030EF0A001000051E3E8\r
+S31500012140F8FFFF1A0000A0E30EF0A0E10DC0A0E128\r
+S3150001215000D82DE940309FE50120A0E3002083E56A\r
+S3150001216038309FE5000050E304B04CE230009F0593\r
+S315000121703C0090158C2093E50FE0A0E102F0A0E170\r
+S3150001218014309FE5002093E5000052E3012042E26E\r
+S31500012190002083E500A81BD9F8FFFFEA40B2020040\r
+S315000121A050000000802101000DC0A0E130D82DE9CA\r
+S315000121B080209FE504B04CE2003092E50040A0E1AA\r
+S315000121C00338A0E12338A0E1410053E30150A0E127\r
+S315000121D000C0E0E30D00000A0C0054E10510A0E187\r
+S315000121E00400A0E10500000A0400A0E10510A0E139\r
+S315000121F0692300EB0030A0E10300A0E130A81BE950\r
+S3150001220068FFFFEB003050E2FAFFFF1AF5FFFFEA25\r
+S31500012210183092E50610A0E3000053E3EDFFFF0A34\r
+S31500012220000093E5143093E50FE0A0E103F0A0E18F\r
+S3150001223000C0A0E1E7FFFFEA5000000004E02DE541\r
+S3150001224000C0D0E502E0A0E100005CE30C20A0E1C3\r
+S315000122500F00000A0030D1E5000053E30C00000A2C\r
+S31500012260FF2002E2FF3003E2030052E1011081E2A6\r
+S31500012270010080E21400001A00C0D0E500005CE312\r
+S315000122800C20A0E10200000A0030D1E5000053E372\r
+S31500012290F2FFFF1AFF001CE30400000A013051E5BA\r
+S315000122A02F0053E30130A00300008E050700000A4A\r
+S315000122B0FF001CE30400001A0030D1E5000053E3DF\r
+S315000122C000008E050130A0030000000A0030A0E3E3\r
+S315000122D00300A0E104F09DE40DC0A0E110D82DE9B2\r
+S315000122E060309FE504B04CE2002093E5000052E324\r
+S315000122F010A81B1950409FE550309FE5030054E19B\r
+S315000123000C00000A0400A0E10FE0A0E10CF094E546\r
+S31500012310000050E3183094151830940501308313EA\r
+S315000123200130C303183084E520309FE51C4084E268\r
+S31500012330030054E1F2FFFF1A08309FE50120A0E3F4\r
+S31500012340002083E510A81BE9E0200200D02102004D\r
+S31500012350082202000DC0A0E170D82DE9C0209FE53A\r
+S31500012360C0309FE504B04CE20CD04DE2030052E1CF\r
+S315000123700040A0E10160A0E124200BE50C00000A69\r
+S315000123801C504BE2001092E50400A0E10520A0E1FB\r
+S31500012390A9FFFFEB000050E30700001A24201BE50C\r
+S315000123A080309FE51C2082E2030052E124200BE5E8\r
+S315000123B0F3FFFF1A0100E0E370A81BE924201BE5E7\r
+S315000123C0040092E5000050E320000B050E00001A00\r
+S315000123D0103092E5000053E30200001A0000A0E36A\r
+S315000123E0002086E570A81BE920101BE51C201BE5D3\r
+S315000123F024004BE20FE0A0E103F0A0E1000050E36E\r
+S3150001240070A81B1924201BE5F3FFFFEA20104BE2FD\r
+S31500012410CFFFFFEB000050E370A81B1924201BE53A\r
+S31500012420EAFFFFEAD0210200082202000DC0A0E166\r
+S3150001243010D82DE9084090E504B04CE2003094E54F\r
+S31500012440C9E0E0E3000053E302C0A0E10700000A8F\r
+S31500012450000052E30200000A00309CE500E053E26E\r
+S315000124600200000A0FE0A0E100F094E500E0A0E11F\r
+S315000124700E00A0E110A81BE90DC0A0E110D82DE9BE\r
+S31500012480084090E504B04CE2043094E5C9E0E0E38D\r
+S31500012490000053E302C0A0E10700000A000052E376\r
+S315000124A00200000A00309CE500E053E20200000A47\r
+S315000124B00FE0A0E104F094E500E0A0E10E00A0E148\r
+S315000124C010A81BE90DC0A0E130D82DE9085090E510\r
+S315000124D000E0A0E1080095E504B04CE2000050E3FD\r
+S315000124E0C940E0E302C0A0E10800000A000052E38F\r
+S315000124F00E00A0E10200000A00C09CE500405CE27B\r
+S315000125000200000A0FE0A0E108F095E50040A0E115\r
+S315000125100400A0E130A81BE90DC0A0E130D82DE9E7\r
+S31500012520085090E500E0A0E10C0095E504B04CE20E\r
+S31500012530000050E3C940E0E302C0A0E10800000A40\r
+S31500012540000052E30E00A0E10200000A00C09CE573\r
+S3150001255000405CE20200000A0FE0A0E10CF095E504\r
+S315000125600040A0E10400A0E130A81BE90DC0A0E1F4\r
+S3150001257000D82DE904B04CE208C090E5C9E0E0E3DB\r
+S3150001258010309CE5000053E30100001A0E00A0E1A3\r
+S3150001259000A81BE90FE0A0E103F0A0E100E0A0E143\r
+S315000125A0F9FFFFEA0DC0A0E130D82DE9085090E50A\r
+S315000125B000E0A0E1140095E504B04CE2000050E310\r
+S315000125C0C940E0E303C0A0E10800000A000053E3AC\r
+S315000125D00E00A0E10200000A00C09CE500405CE29A\r
+S315000125E00200000A0FE0A0E114F095E50040A0E129\r
+S315000125F00400A0E130A81BE90DC0A0E130D82DE907\r
+S31500012600085090E500E0A0E1180095E504B04CE221\r
+S31500012610000050E3C940E0E303C0A0E10800000A5E\r
+S31500012620000053E30E00A0E10200000A00C09CE591\r
+S3150001263000405CE20200000A0FE0A0E118F095E517\r
+S315000126400040A0E10400A0E130A81BE9C900E0E3D5\r
+S315000126500EF0A0E1C900E0E30EF0A0E1C900E0E35D\r
+S315000126600EF0A0E1C900E0E30EF0A0E1C900E0E34D\r
+S315000126700EF0A0E1C900E0E30EF0A0E1C900E0E33D\r
+S315000126800EF0A0E10DC0A0E100D82DE904B04CE2A6\r
+S31500012690020000EB020000EB020000EBE40E00EB8F\r
+S315000126A00EF0A0E10EF0A0E10EF0A0E10DC0A0E158\r
+S315000126B010D82DE9FF4000E20A0054E304B04CE2D1\r
+S315000126C00D00A0E30200000A0400A0E110681BE966\r
+S315000126D0F7FDFFEAF6FDFFEBFAFFFFEA04E02DE561\r
+S315000126E0FF0000E204E09DE4EFFFFFEA0EF0A0E147\r
+S315000126F004309FE5000083E50EF0A0E1E42002002E\r
+S315000127000DC0A0E110D82DE90040A0E10000D0E500\r
+S3150001271004B04CE2000050E310A81B09FF0000E2E0\r
+S31500012720E1FFFFEB0100F4E5000050E310A81B09EF\r
+S31500012730F9FFFFEA0DC0A0E100D82DE9000050E342\r
+S3150001274004B04CE200C0A0E304D04DE22D20A0E38A\r
+S31500012750000060B22B20A0A30C30A0E10A10A0E378\r
+S3150001276000C08DE5560000EB00A81BE90DC0A0E1F5\r
+S3150001277000D82DE904B04CE200C0A0E304D04DE23C\r
+S315000127800C30A0E11010A0E32B20A0E300C08DE5E2\r
+S315000127904B0000EB00A81BE90DC0A0E1F0DF2DE91D\r
+S315000127A004B04CE224D04DE20160A0E10050A0E16A\r
+S315000127B004C09BE54C300BE500005CE32070A003F0\r
+S315000127C03070A01328304BE21F40A0E3014054E2D1\r
+S315000127D0207043E5013083E2FBFFFF5A063095E1A5\r
+S315000127E00040A0E33030A0030140840248304B058D\r
+S315000127F01700000A063095E11500000A0280A0E1E3\r
+S315000128000090A0E328A04BE20930A0E10820A0E156\r
+S315000128100610A0E10500A0E13E2D00EB9C209FE5FE\r
+S31500012820014084E200C0D2E70610A0E10500A0E164\r
+S315000128300930A0E10820A0E120C04AE5A02B00EB69\r
+S315000128400160A0E10050A0E1063090E101A08AE21A\r
+S31500012850ECFFFF1A08309BE54C201BE5030054E111\r
+S315000128600340A0B12D0052E3014044120900000AC1\r
+S31500012870000054E3F0AF1BB928204BE2023084E09C\r
+S31500012880200053E5014044E287FFFFEB000054E3DB\r
+S31500012890F0AF1BB9F7FFFFEA28304BE2042083E0D3\r
+S315000128A0213052E5070053E128304B020140440232\r
+S315000128B0042083004C301BE5203042E5EBFFFFEAA4\r
+S315000128C0701102000DC0A0E170D82DE904B04CE2F0\r
+S315000128D008D04DE201C0A0E10260A0E10040A0E104\r
+S315000128E00050A0E30C20A0E104C09BE503E0A0E1B9\r
+S315000128F00510A0E10400A0E10630A0E100E08DE5AD\r
+S3150001290004C08DE5A3FFFFEB70A81BE900C0A0E1A1\r
+S31500012910000050E304E02DE50100A0E30C00A00156\r
+S3150001292004F09D040030DCE50C10A0E1000053E347\r
+S3150001293004F09D0448E09FE5FF2003E201306CE0CE\r
+S315000129400E0053E10000A0A30D0052E30A0052134A\r
+S315000129500400000A080052E3203042E20100000AA6\r
+S315000129605E0053E30000A083000050E3011081E202\r
+S3150001297004F09D040030D1E5000053E304F09D040A\r
+S31500012980ECFFFFEA010800000DC0A0E1F0DF2DE930\r
+S315000129900150A0E10040A0E1051094E104B04CE231\r
+S315000129A050D04DE23030A00378604BE20270A0E1D6\r
+S315000129B000A0A0E377604B0278304B051500000AB2\r
+S315000129C0052094E11300000A0380A0E1C89FA0E15D\r
+S315000129D00930A0E10820A0E10510A0E10400A0E172\r
+S315000129E0CC2C00EB04309BE5000083E00030D0E501\r
+S315000129F00510A0E10400A0E10130C6E40930A0E120\r
+S31500012A000820A0E12E2B00EB0150A0E10040A0E13F\r
+S31500012A10051094E1EDFFFF1A78204BE2020056E122\r
+S31500012A200500000A013076E578104BE2010056E117\r
+S31500012A3001A08AE20130C7E4F9FFFF1A0030A0E3E2\r
+S31500012A400030C7E50A00A0E1F0AF1BE90DC0A0E127\r
+S31500012A50F0DF2DE904B04CE26CD04DE20260A0E15A\r
+S31500012A606C000BE50200A0E10190A0E170300BE5DE\r
+S31500012A70A5FFFFEB0080A0E3000050E30020A0E3E8\r
+S31500012A800010A0E368004BE280304BE278000BE5D2\r
+S31500012A90060003E90870A0E11102000A0020D6E54C\r
+S31500012AA00110D6E4000052E3FF5001E20C00000AD7\r
+S31500012AB0250055E30C00000A0500A0E10910A0E17C\r
+S31500012AC06C201BE50FE0A0E102F0A0E1018088E2A5\r
+S31500012AD00020D6E50110D6E4000052E3FF5001E2E2\r
+S31500012AE0F2FFFF1A0800A0E1F0AF1BE90130D6E4BE\r
+S31500012AF000C0A0E3FF5003E22D0055E380C00BE5C3\r
+S31500012B000130D6040140A003FF50030280400B05AB\r
+S31500012B10300055E30130D60401E0A003FF50030263\r
+S31500012B20303045E27CE00B057CC00B15090053E310\r
+S31500012B300C00A0E10CA0A0E10700008A0110D6E478\r
+S31500012B400A218AE0822085E0FF5001E2303045E229\r
+S31500012B50090053E330A042E2F7FFFF9A2E0055E346\r
+S31500012B60D101000A0020A0E36C0055E374200BE5B7\r
+S31500012B70C501000A7A0055E30130D604FF5003026D\r
+S31500012B80423045E2360053E303F19F97440000EAE1\r
+S31500012B906C2C0100A42C01006C2C0100A42C01005A\r
+S31500012BA0A42C0100A42C0100A42C0100A42C0100DA\r
+S31500012BB0A42C0100A42C0100A42C0100A42C0100CA\r
+S31500012BC0A42C0100A42C0100A42C0100A42C0100BA\r
+S31500012BD0A42C0100A42C0100A42C01006C2C0100E2\r
+S31500012BE0A42C0100A42C01006C2C0100A42C0100D2\r
+S31500012BF0A42C0100A42C0100A42C0100A42C01008A\r
+S31500012C00A42C0100A42C0100A42C0100A42C010079\r
+S31500012C106C2C0100A42C01006C2C0100A42C0100D9\r
+S31500012C20A42C0100A42C0100A42C0100A42C010059\r
+S31500012C30A42C0100A42C0100A42C0100A42C010049\r
+S31500012C40A42C0100A42C01006C2C0100A42C010071\r
+S31500012C50A42C0100A42C0100A42C01006C2C010061\r
+S31500012C60A42C0100A42C01006C2C0100000050E3EF\r
+S31500012C707C01000A70301BE580404BE2060093E8B8\r
+S31500012C8008E083E2060004E970E00BE5440055E341\r
+S31500012C90640055136B01001A84101BE5000051E313\r
+S31500012CA0600100BA253045E2530053E303F19F97D3\r
+S31500012CB04F0100EAB4300100F4310100F4310100A2\r
+S31500012CC0F4310100F4310100F4310100F431010065\r
+S31500012CD0F4310100F4310100F4310100F431010055\r
+S31500012CE0F4310100F4310100F4310100F431010045\r
+S31500012CF0F4310100F4310100F4310100F431010035\r
+S31500012D00F4310100F4310100F4310100F431010024\r
+S31500012D10F4310100F4310100F4310100F431010014\r
+S31500012D20F4310100F4310100D430010040310100D9\r
+S31500012D30382E0100F4310100F4310100F4310100B3\r
+S31500012D40F4310100F4310100F4310100F4310100E4\r
+S31500012D50F4310100F4310100F4310100F4310100D4\r
+S31500012D60F4310100F4310100F43101006C3101004C\r
+S31500012D70F4310100382E0100F4310100F431010073\r
+S31500012D80382E0100F4310100F4310100F431010063\r
+S31500012D90F4310100F4310100F4310100F431010094\r
+S31500012DA0F4310100F4310100D43001004031010059\r
+S31500012DB0382E0100F4310100F4310100F431010033\r
+S31500012DC0F4310100F4310100F4310100F431010064\r
+S31500012DD0F4310100F4310100F4310100F431010054\r
+S31500012DE0042E0100F4310100F43101006C310100BF\r
+S31500012DF0F4310100382E0100F4310100F4310100F3\r
+S31500012E00382E01003000A0E30910A0E16C201BE57B\r
+S31500012E100FE0A0E102F0A0E10140A0E37800A0E309\r
+S31500012E200910A0E16C301BE50FE0A0E103F0A0E181\r
+S31500012E3008A0A0E37C400BE5443045E2340053E3AF\r
+S31500012E4003F19F973C0000EA1C2F01003C2F010073\r
+S31500012E503C2F01003C2F01003C2F01003C2F0100BB\r
+S31500012E603C2F01003C2F01003C2F01003C2F0100AB\r
+S31500012E703C2F01003C2F01003C2F01003C2F01009B\r
+S31500012E803C2F01003C2F01003C2F01001C2F0100AB\r
+S31500012E903C2F01003C2F0100843001003C2F010032\r
+S31500012EA03C2F01003C2F01003C2F01003C2F01006B\r
+S31500012EB03C2F01003C2F01003C2F01003C2F01005B\r
+S31500012EC03C2F01003C2F01001C2F01003C2F01006B\r
+S31500012ED03C2F01003C2F01003C2F01003C2F01003B\r
+S31500012EE03C2F01003C2F01003C2F01003C2F01002B\r
+S31500012EF03C2F01003C2F01009C3001003C2F0100BA\r
+S31500012F003C2F01003C2F01003C2F01001C2F01002A\r
+S31500012F103C2F01003C2F01009C30010080C04BE298\r
+S31500012F2003001CE924C49FE568204BE20A30A0E3B4\r
+S31500012F3000C08DE593FEFFEB0070A0E168304BE227\r
+S31500012F40014047E278300BE590400BE574001BE544\r
+S31500012F507C101BE5000050E30A4067E00140441283\r
+S31500012F60000051E32050A0030300000A74201BE572\r
+S31500012F703050A0E3000052E33800001A80E01BE560\r
+S31500012F8000005EE30B00001A000054E3014044E236\r
+S31500012F90080000DA0500A0E10910A0E16C201BE59C\r
+S31500012FA00FE0A0E102F0A0E1000054E3018088E215\r
+S31500012FB0014044E2F6FFFFCA74301BE5000053E30B\r
+S31500012FC01F00001A000057E390701BE50C0000DAA1\r
+S31500012FD078E01BE50910A0E10130DEE46C201BE579\r
+S31500012FE0FF5003E278E00BE50500A0E10FE0A0E168\r
+S31500012FF002F0A0E1000057E3018088E2017047E298\r
+S31500013000F2FFFFCA80301BE5000053E3AFFEFF0A63\r
+S31500013010000054E3014044E2ACFEFFDA2000A0E3E5\r
+S315000130200910A0E16CC01BE50FE0A0E10CF0A0E1E6\r
+S31500013030000054E3018088E2014044E2F6FFFFCA42\r
+S31500013040A2FEFFEA0300A0E10910A0E16CC01BE5A6\r
+S315000130500FE0A0E10CF0A0E1018088E2D8FFFFEAD1\r
+S315000130600200A0E10910A0E16C301BE50FE0A0E130\r
+S3150001307003F0A0E1018088E200C0A0E374C00BE583\r
+S31500013080BDFFFFEA80204BE2C4C29FE5030012E9BF\r
+S315000130901030A0E368204BE2A4FFFFEA80E04BE298\r
+S315000130A003001EE9ACC29FE568204BE21030A0E3A5\r
+S315000130B09EFFFFEA2500A0E30910A0E16C201BE5B5\r
+S315000130C00FE0A0E102F0A0E1013047E290300BE50C\r
+S315000130D09DFFFFEA00705AE20200001A000050E369\r
+S315000130E02070A0034070A01301E047E20040A0E376\r
+S315000130F00E0054E190E00BE58CE00BE50C0000AA14\r
+S3150001310068504BE280304BE2030013E90420A0E152\r
+S315000131103C2900EB010010E33130A0E32E30A0037F\r
+S315000131200130C5E48CC01BE5014084E20C0054E18A\r
+S31500013130F3FFFFBA68E04BE278E00BE582FFFFEAB6\r
+S3150001314070301BE50910A0E10050D3E56C401BE58A\r
+S315000131500500A0E10FE0A0E104F0A0E170C01BE5CD\r
+S3150001316004C08CE270C00BE557FEFFEA70301BE528\r
+S3150001317070C01BE5003093E504C08CE2000053E308\r
+S31500013180D4E19F0578300BE570C00BE578E00B05BF\r
+S315000131900300000A78001BE5DBFDFFEB000050E3AE\r
+S315000131A00C00000A78101BE50070A0E30730D1E798\r
+S315000131B0070053E100E0E00390E00B0562FFFF0A20\r
+S315000131C078201BE5017087E20730D2E7000053E360\r
+S315000131D0FAFFFF1ABBFFFFEA80019FE547FDFFEB00\r
+S315000131E078001BE560FDFFEB74019FE578000BE5B8\r
+S315000131F0EBFFFFEA2500A0E30910A0E16C401BE507\r
+S315000132000FE0A0E104F0A0E10500A0E10910A0E1B2\r
+S315000132100FE0A0E104F0A0E1028088E201C047E2EC\r
+S3150001322090C00BE548FFFFEA80404BE20C0014E931\r
+S315000132302DC0A0E3002072E20030E3E20C0004E9B5\r
+S3150001324074C00BE596FEFFEA80C04BE206001CE95E\r
+S31500013250F0308FE2180093E8031001E0042002E049\r
+S3150001326006000CE98EFEFFEA70301BE580E04BE2BA\r
+S31500013270002093E5041083E20230A0E1C34FA0E1F0\r
+S3150001328018000EE970100BE57FFEFFEA0130D6E467\r
+S3150001329001C0A0E3FF5003E26C0055E30130D60400\r
+S315000132A00C00A001FF50030231FEFFEA0120D6E423\r
+S315000132B07C101BE5FF5002E2303045E2011081E24D\r
+S315000132C0090053E37C100BE525FEFF8A0130D6E4A5\r
+S315000132D0FF5003E2302045E2090052E3FAFFFF9A6C\r
+S315000132E01FFEFFEA7C009FE504FDFFEB0600A0E15F\r
+S315000132F01DFDFFEB70009FE50740A0E3FFFCFFEB20\r
+S315000133002000A0E3E8FCFFEB70301BE5002093E50D\r
+S3150001331004C083E20200A0E10010A0E380304BE28A\r
+S31500013320030003E988001BE570C00BE50EFDFFEB0A\r
+S31500013330014054E2F1FFFF5A30009FE5EFFCFFEB3D\r
+S315000133400000A0E3F0AF1BE9FFFFFFFF0000000054\r
+S31500013350841102007011020090110200A4110200F2\r
+S31500013360AC110200C0110200C4110200DC110200FE\r
+S31500013370E01102000C0091E9020053E101C0A0E155\r
+S31500013380FF0000E20EF0A0A1003091E50100C3E4C8\r
+S31500013390003081E50010A0E30010C3E508209CE59C\r
+S315000133A0012082E208208CE50EF0A0E10DC0A0E12B\r
+S315000133B00E002DE900D82DE910B04CE20CD04DE2FB\r
+S315000133C000C0A0E101EBA0E318C00BE518104BE229\r
+S315000133D000C0A0E304209BE508308BE210009FE5C6\r
+S315000133E014E00BE510C00BE597FDFFEB10001BE5A4\r
+S315000133F000A81BE9743301000DC0A0E10C002DE902\r
+S3150001340010D82DE90CB04CE20CD04DE200C0A0E181\r
+S315000134100140A0E100E0A0E31C104BE204209BE583\r
+S3150001342008308BE214009FE51CC00BE514E00BE5A8\r
+S3150001343018400BE584FDFFEB14001BE510A81BE902\r
+S31500013440743301000DC0A0E110D82DE904B04CE29F\r
+S3150001345001C0A0E100E0A0E10CD04DE20230A0E104\r
+S315000134601C104BE20C20A0E10040A0E301CBA0E33D\r
+S3150001347014009FE51CE00BE518C00BE514400BE5B5\r
+S3150001348071FDFFEB14001BE510A81BE97433010065\r
+S315000134900DC0A0E10F002DE900D82DE918309FE5F8\r
+S315000134A014B04CE2000093E504209BE508308BE262\r
+S315000134B00010A0E364FDFFEB00A81BE9E420020075\r
+S315000134C004E02DE514309FE50020A0E1000093E51E\r
+S315000134D00130A0E10010A0E304E09DE45AFDFFEAFB\r
+S315000134E0E42002000DC0A0E1010052E1F0D92DE96E\r
+S315000134F00260A0E102606180000056E304B04CE284\r
+S315000135000170A0E10050A0E10380A0E1F0A91BD960\r
+S31500013510000058E307106810C0009F15BC009F0506\r
+S315000135200710A0010FE0A0E105F0A0E10040A0E333\r
+S31500013530060054E1A8009FE5240000AA0410D7E77D\r
+S315000135400FE0A0E105F0A0E1070054E394009FE538\r
+S315000135501B00000A014084E20F0054E3F3FFFFDA87\r
+S3150001356084009FE50FE0A0E105F0A0E10040A0E3A3\r
+S31500013570060054E12010A0A3030000AA0410D7E717\r
+S31500013580203041E25E0053E32E10A0835C009FE5EC\r
+S31500013590014084E20FE0A0E105F0A0E10F0054E351\r
+S315000135A0F2FFFFDA48009FE5106046E20FE0A0E176\r
+S315000135B005F0A0E1000056E3107087E2F0A91BD9DF\r
+S315000135C0D2FFFFEA0FE0A0E105F0A0E1E0FFFFEA8C\r
+S315000135D020009FE50FE0A0E105F0A0E1D9FFFFEA99\r
+S315000135E0E4110200EC11020010120200F4110200B3\r
+S315000135F0F8110200FC1102006809020010402DE9D1\r
+S3150001360000C0A0E10140A0E110009FE50230A0E169\r
+S315000136100C10A0E10420A0E11040BDE8B0FFFFEAD4\r
+S315000136209034010004E02DE50020A0E304E09DE4D0\r
+S31500013630F1FFFFEA0DC0A0E1000051E1F0D92DE94B\r
+S315000136400150A0E101506080000055E304B04CE256\r
+S315000136500060A0E10280A0E1F0A91BD9000058E3B7\r
+S31500013660061068105C009F1558009F050610A00102\r
+S3150001367086FFFFEBC53FA0E1237F85E00040A0E385\r
+S31500013680470154E140009FE50B0000AA041196E7AB\r
+S315000136907EFFFFEB014084E2030054E3F7FFFFDA0C\r
+S315000136A028009FE5105045E278FFFFEB000055E347\r
+S315000136B0106086E2F0A91BD9E7FFFFEA10009FE53B\r
+S315000136C072FFFFEBF2FFFFEAE411020000120200B3\r
+S315000136D0180F02000812020004E02DE50020A0E305\r
+S315000136E004E09DE4D2FFFFEA0DC0A0E1000051E134\r
+S315000136F0F0D92DE90150A0E101506080000055E3A9\r
+S3150001370004B04CE20060A0E10280A0E1F0A91BD95F\r
+S31500013710000058E3061068106C009F1568009F05AD\r
+S315000137200610A00159FFFFEB0040A0E3C57FA0E111\r
+S31500013730A73F85E0C30054E150009FE58420A0E146\r
+S315000137404C009FA50E0000AAB61092E14FFFFFEBB9\r
+S31500013750030054E33C009FE50900000A014084E2AE\r
+S31500013760070054E3F1FFFFDA2C009FE5105045E214\r
+S3150001377046FFFFEB000055E3106086E2F0A91BD976\r
+S31500013780E2FFFFEA41FFFFEBF3FFFFEAE41102006C\r
+S31500013790141202000C12020010120200180F02008D\r
+S315000137A004E02DE50020A0E304E09DE4CDFFFFEA5F\r
+S315000137B014309FE504E02DE5030051E101005003BB\r
+S315000137C004F09D1404E09DE4B2F9FFEA74270000B9\r
+S315000137D004E02DE508109FE50100A0E304E09DE467\r
+S315000137E0F2FFFFEA74270000030052E302C0A0E1E2\r
+S315000137F004E02DE50020A0E10200009A003081E1FD\r
+S31500013800030013E30800000A01C04CE201007CE357\r
+S3150001381004F09D040130D1E401C04CE201007CE3D7\r
+S315000138200130C2E404F09D04F9FFFFEA0F005CE3F6\r
+S3150001383000E0A0E10A00009A043091E410C04CE2D5\r
+S3150001384004308EE4042091E40F005CE304208EE44E\r
+S31500013850043091E404308EE4042091E404208EE4E3\r
+S31500013860F4FFFF8A03005CE30400009A043091E44C\r
+S3150001387004C04CE203005CE304308EE4FAFFFF8AE5\r
+S3150001388001C04CE201007CE30E20A0E104F09D049E\r
+S315000138900130D1E401C04CE201007CE30130C2E415\r
+S315000138A004F09D04F9FFFFEA030052E30030A0E1B2\r
+S315000138B00100009A030010E30700000A012042E21A\r
+S315000138C0010072E30EF0A001012042E2010072E361\r
+S315000138D00110C3E40EF0A001FAFFFFEAFF1001E2B6\r
+S315000138E001C481E10F0052E30030A0E10CC88CE174\r
+S315000138F00600009A04C083E404C083E4102042E277\r
+S3150001390004C083E40F0052E304C083E4F8FFFF8A96\r
+S31500013910030052E30300009A042042E2030052E34B\r
+S3150001392004C083E4FBFFFF8A000052E30EF0A0010E\r
+S31500013930012052E20110C3E40EF0A001FBFFFFEAF1\r
+S315000139400DC0A0E100D82DE904B04CE2380A00EB25\r
+S315000139500C209FE5003092E5013083E2003082E5DC\r
+S315000139600EF0A0E1F42002000DC0A0E100D82DE97F\r
+S3150001397004B04CE234209FE5003092E5013083E249\r
+S31500013980003082E5003092E5010053E300A81B995F\r
+S31500013990003092E5013053E20300A0E100308215C8\r
+S315000139A00000000A00A81BE9E40900EBFCFFFFEA9E\r
+S315000139B0F42002000DC0A0E100D82DE92C209FE5DE\r
+S315000139C004B04CE2003092E5000053E300A81B0965\r
+S315000139D0003092E5013053E20300A0E10030821588\r
+S315000139E00000000A00A81BE9D40900EBFCFFFFEA6E\r
+S315000139F0F420020004309FE5000093E50EF0A0E1FB\r
+S31500013A00F42002000DC0A0E130D82DE904B04CE24B\r
+S31500013A100CD04DE201C0A0E110509BE50340A0E1AE\r
+S31500013A2002E0A0E100408DE50C20A0E108409BE505\r
+S31500013A3004C09BE50010A0E10E30A0E10500A0E165\r
+S31500013A4004C08DE508408DE5F60200EB0C309BE5E0\r
+S31500013A50005083E530A81BE904E02DE504E09DE470\r
+S31500013A60170500EA0DC0A0E110D82DE9383090E520\r
+S31500013A7004B04CE2100053E30040A0E10400000A48\r
+S31500013A80280500EB383094E50000A0E3100053E36D\r
+S31500013A9010A81B190400A0E16E0300EB0100A0E3CE\r
+S31500013AA010A81BE904E02DE504E09DE47F0400EA8B\r
+S31500013AB00DC0A0E110D82DE9383090E504B04CE2F4\r
+S31500013AC0100053E30040A0E10200000A0400A0E157\r
+S31500013AD010681BE9940400EA0F0300EBFAFFFFEA02\r
+S31500013AE004E02DE504E09DE40E0500EA04E02DE581\r
+S31500013AF004E09DE4D10400EA04E02DE50C309FE5E5\r
+S31500013B00000093E51C0080E204E09DE4DA0800EA87\r
+S31500013B100C8A020004309FE5000093E50EF0A0E157\r
+S31500013B200C8A020000009FE50EF0A0E15089020018\r
+S31500013B3004E02DE504E09DE4360500EA343090E525\r
+S31500013B40000053E330009015240090050EF0A0E12B\r
+S31500013B50240090E50EF0A0E10EF0A0E104E02DE5D1\r
+S31500013B6010309FE50120A0E10010A0E1000093E5DF\r
+S31500013B7004E09DE4760500EA0C8A0200000090E567\r
+S31500013B800EF0A0E1040090E50EF0A0E10DC0A0E169\r
+S31500013B9010D82DE904B04CE20140A0E3A8209FE52E\r
+S31500013BA0003092E5043083E0003082E500C090E504\r
+S31500013BB000005CE31B00000AB824DCE1B030D1E16F\r
+S31500013BC0030052E10C00000A0030A0E3003080E55A\r
+S31500013BD0B030C1E10340A0E16C209FE5003092E5E1\r
+S31500013BE0010053E2000082150100000A0400A0E171\r
+S31500013BF010A81BE9510900EBFBFFFFEA4C309FE5DA\r
+S31500013C00002093E502005CE19C309C150030A00386\r
+S31500013C10000053E300308015B834D311B030C11120\r
+S31500013C20ECFFFF1AE7FFFFEA20309FE5003093E53E\r
+S31500013C30000053E39C3093150C30A001003080E561\r
+S31500013C40B8C4D3E1B0C0C1E1E2FFFFEAF42002004B\r
+S31500013C50E82002000DC0A0E10008A0E110D82DE97E\r
+S31500013C604008A0E104B04CE274209FE5003092E5E3\r
+S31500013C70013083E2003082E568309FE5003093E54C\r
+S31500013C80000053E39C309315004053E20B00000AF9\r
+S31500013C900038A0E14C109FE52308A0E1B834D4E137\r
+S31500013CA00020A0E3000053E10400000A003091E582\r
+S31500013CB0030054E19C209415004052E2F6FFFF1ADE\r
+S31500013CC01C209FE5003092E5010053E200008215B9\r
+S31500013CD00100000A0400A0E110A81BE9170900EB86\r
+S31500013CE0FBFFFFEAF4200200E82002000DC0A0E17C\r
+S31500013CF00118A0E110D82DE94118A0E104B04CE269\r
+S31500013D000140A0E302C0A0E198209FE5003092E5C2\r
+S31500013D10043083E0003082E5B824D0E10138A0E127\r
+S31500013D20230852E10900000A0040A0E374209FE540\r
+S31500013D30003092E5010053E2000082150100000AFD\r
+S31500013D400400A0E110A81BE9FC0800EBFBFFFFEA59\r
+S31500013D5000005CE3F3FFFF0AB410CCE100008CE540\r
+S31500013D60383090E508308CE5982090E50C208CE5FC\r
+S31500013D70343090E5000053E330309015243090053F\r
+S31500013D8010308CE5243090E514308CE5002090E568\r
+S31500013D900030A0E318208CE5041090E520308CE576\r
+S31500013DA01C108CE5E0FFFFEAF420020004E02DE59B\r
+S31500013DB004E09DE4220500EA04E02DE504E09DE42B\r
+S31500013DC03E0500EA0C209FE5003092E5003183E0D4\r
+S31500013DD0800093E50EF0A0E10C8A020010209FE519\r
+S31500013DE0003092E5003183E0803083E20300A0E1F8\r
+S31500013DF00EF0A0E10C8A02000C209FE5003092E54E\r
+S31500013E00003183E0801083E50EF0A0E10C8A020008\r
+S31500013E100DC0A0E130D82DE904B04CE200C0A0E10C\r
+S31500013E2001E0A0E10C10A0E128C09FE508D04DE219\r
+S31500013E300240A0E10E20A0E100E09CE504C09BE564\r
+S31500013E400350A0E110009FE50430A0E120108DE8A9\r
+S31500013E50D30500EB30A81BE90C8A0200F0890200A9\r
+S31500013E6004E02DE510309FE50010A0E1002093E568\r
+S31500013E7008009FE504E09DE4D60500EA0C8A0200ED\r
+S31500013E80F089020004E02DE504E09DE4E10400EA86\r
+S31500013E900DC0A0E130D82DE904B04CE208D04DE2C6\r
+S31500013EA001C0A0E10C509BE502E0A0E10C20A0E1DD\r
+S31500013EB004C09BE50340A0E10010A0E10E30A0E1A3\r
+S31500013EC00500A0E110108DE8F30500EB08309BE535\r
+S31500013ED0005083E530A81BE904E02DE504E09DE4EC\r
+S31500013EE0FA0500EA04E02DE504E09DE45A0600EA3D\r
+S31500013EF004E02DE504E09DE4720600EA04E02DE508\r
+S31500013F0004E09DE4840600EA04E02DE50020A0E338\r
+S31500013F1004E09DE4850600EA04E02DE504E09DE465\r
+S31500013F20940600EA04E02DE504E09DE4A80600EA13\r
+S31500013F3004E02DE504E09DE4BC0600EA04E02DE57D\r
+S31500013F4004E09DE4C70600EA04E02DE504E09DE4F3\r
+S31500013F50C70600EA04E02DE504E09DE4D20600EA86\r
+S31500013F6004E02DE504E09DE4D20600EA04E02DE537\r
+S31500013F7004E09DE4D20600EA0EF0A0E10000A0E311\r
+S31500013F800EF0A0E10DC0A0E130D82DE90140A0E17D\r
+S31500013F900050A0E104B04CE20110A0E30400A0E14E\r
+S31500013FA0B91C00EB004085E530A81BE904E02DE5CE\r
+S31500013FB004E09DE4D31C00EA030090E90EF0A0E1C1\r
+S31500013FC0060080E90EF0A0E104E02DE50110A0E372\r
+S31500013FD004E09DE4E11C00EA04E02DE504E09DE433\r
+S31500013FE0DE1C00EA0DC0A0E130D82DE904B04CE298\r
+S31500013FF00340A0E108D04DE220304BE20250A0E19F\r
+S315000140001C000BE518100BE5060093E90400A0E17E\r
+S315000140108F1D00EB004085E530A81BE904E02DE586\r
+S3150001402004E09DE4981D00EA000081E50EF0A0E1A0\r
+S3150001403004402DE508D04DE206008DE818009DE804\r
+S31500014040100080E2180080E808D08DE21000BDE87B\r
+S315000140500EF0A0E104402DE5101081E2180091E870\r
+S3150001406008D04DE218008DE804309DE5043080E566\r
+S3150001407000209DE5002080E508D08DE21000BDE816\r
+S315000140800EF0A0E104309FE5000093E50EF0A0E1FB\r
+S315000140906421020008309FE5002093E5030092E9C0\r
+S315000140A00EF0A0E1642102000DC0A0E130D82DE997\r
+S315000140B004B04CE204509BE501C0A0E102E0A0E19E\r
+S315000140C00340A0E10010A0E10C20A0E10E30A0E128\r
+S315000140D00500A0E1B51F00EB005084E530A81BE9FF\r
+S315000140E004E02DE504E09DE4D41F00EA04D04DE28E\r
+S315000140F030402DE904D04DE210308DE510308DE2CF\r
+S31500014100300093E80430A0E114508DE504D08DE22F\r
+S315000141103040BDE804D08DE2D71F00EA04E02DE56A\r
+S3150001412004E09DE4512000EA04E02DE504E09DE46D\r
+S315000141301C2000EA04E02DE504E09DE4342000EAB9\r
+S315000141400DC0A0E130D82DE90050A0E104B04CE249\r
+S315000141500100A0E10140A0E1370B00EB004085E53D\r
+S3150001416030A81BE904E02DE504E09DE4380B00EAE4\r
+S3150001417004E02DE504E09DE4380B00EA04E02DE5BA\r
+S3150001418004E09DE43E0B00EA04E02DE504E09DE435\r
+S31500014190460B00EA04E02DE504E09DE4550B00EA38\r
+S315000141A004E02DE504E09DE4490B00EA04E02DE579\r
+S315000141B004E09DE4490B00EA04E02DE504E09DE4FA\r
+S315000141C0490B00EA040090E50EF0A0E1080090E535\r
+S315000141D0000050E20100A0130EF0A0E10C0090E5F2\r
+S315000141E0000050E20100A0130EF0A0E10DC0A0E115\r
+S315000141F000D82DE904B04CE29E0800EB00A81BE9AB\r
+S3150001420004E02DE504E09DE4A10800EA04E02DE5C3\r
+S3150001421004E09DE4A20800EA04E02DE504E09DE443\r
+S31500014220DA0800EA04E02DE504E09DE42E0900EA3F\r
+S3150001423004E02DE504E09DE4430900EA0DC0A0E198\r
+S3150001424010D82DE904B04CE20140A0E15E0900EB73\r
+S31500014250000084E510A81BE90DC0A0E100D82DE9F6\r
+S315000142600010A0E304B04CE25C0900EB00A81BE9D6\r
+S3150001427004E02DE504E09DE4800900EA04E02DE573\r
+S3150001428004E09DE4B50900EA04E02DE504E09DE4BF\r
+S315000142909F0900EA000051E30230A0E104E02DE5A8\r
+S315000142A0FF2002E20100000AFC0013E30100000AFC\r
+S315000142B00000A0E304F09DE404E09DE4F50900EAB2\r
+S315000142C004D04DE230402DE904D04DE210308DE5A9\r
+S315000142D0000051E310308DE202C0A0E1300093E806\r
+S315000142E0FF2002E20200000AFC001CE30430A0E108\r
+S315000142F00400000A0000A0E304D08DE23040BDE8CE\r
+S3150001430004D08DE20EF0A0E114508DE504D08DE2CB\r
+S315000143103040BDE804D08DE2320A00EA000051E3E4\r
+S315000143200230A0E104E02DE5FF2002E20100000ACF\r
+S31500014330FC0013E30100000A0000A0E304F09DE481\r
+S3150001434004E09DE4930A00EA000090E50EF0A0E186\r
+S31500014350040090E5000050E20100A0130EF0A0E178\r
+S315000143600DC0A0E100D82DE904B04CE2F10A00EB42\r
+S3150001437000A81BE904E02DE504E09DE4060B00EA34\r
+S3150001438004E02DE504E09DE4070B00EA04E02DE5D9\r
+S3150001439004E09DE4680B00EA04E02DE504E09DE4F9\r
+S315000143A0900B00EA04E02DE504E09DE4CF0B00EA62\r
+S315000143B004E02DE504E09DE4E80B00EA04E02DE5C8\r
+S315000143C004E09DE4F60B00EA0DC0A0E100D82DE95A\r
+S315000143D004B04CE2060C00EB00A81BE904E02DE555\r
+S315000143E004E09DE4110C00EA04E02DE5001090E5DF\r
+S315000143F004E09DE4110C00EA04E02DE504E09DE4EF\r
+S315000144003B0C00EA04E02DE504E09DE4550C00EACE\r
+S3150001441004E02DE500C090E50230A0E10120A0E115\r
+S315000144200C10A0E104E09DE4700C00EA0030A0E36A\r
+S31500014430000051E3003080E5013083120030801521\r
+S315000144400EF0A0E10EF0A0E10130A0E3003080E51E\r
+S315000144500EF0A0E10030A0E3003080E50EF0A0E10F\r
+S31500014460003090E50120A0E3000053E30030A0E313\r
+S315000144700230A001002080050300A0E10EF0A0E1BA\r
+S31500014480000090E50EF0A0E104402DE500300FE1BB\r
+S3150001449000400FE1C04084E304F029E10120A0E3DC\r
+S315000144A0003081E5002080E51000BDE80EF0A0E1B6\r
+S315000144B00030A0E304402DE5003080E500300FE137\r
+S315000144C0C04001E2C030C3E3043083E103F029E1D7\r
+S315000144D01000BDE80EF0A0E144309FE50DC0A0E15B\r
+S315000144E00510A0E310D82DE938209FE5001083E5DB\r
+S315000144F034309FE50040A0E10000A0E3000082E522\r
+S3150001450004B04CE2004083E520309FE5000083E5DE\r
+S31500014510140094E50FE0A0E110F094E5680200EBC9\r
+S31500014520FAFFFFEA088A0200108A02000C8A0200DA\r
+S31500014530F42002000DC0A0E1F0D82DE904B04CE250\r
+S3150001454008C09BE50C409BE50060A0E104E08CE01F\r
+S315000145500050A0E300C086E508C086E51C0080E2A5\r
+S31500014560102086E5143086E50120A0E10CE086E501\r
+S31500014570044086E50610A0E1185086E504709BE527\r
+S315000145803F0700EB8C309FE54C4086E2001093E537\r
+S3150001459084209FE50400A0E10430A0E1741E00EB35\r
+S315000145A078109FE50430A0E3B000D1E10120A0E33B\r
+S315000145B001C080E2286084E5383086E53C2086E546\r
+S315000145C07C5086E5405086E5785086E50630A0E1C8\r
+S315000145D0B0C0C1E1042082E2B804C6E10510A0E141\r
+S315000145E0012052E2801083E5043083E2FBFFFF5A8B\r
+S315000145F00600A0E1987086E55E2D00EB0610A0E1AD\r
+S315000146001C009FE5E10500EB0600A0E10610A0E114\r
+S31500014610F0681BE9422D00EA6421020018530100EB\r
+S31500014620EC200200148A02000DC0A0E1F0D82DE9A9\r
+S3150001463004B04CE208C09BE50C409BE50060A0E19C\r
+S3150001464004E08CE00050A0E300C086E508C086E5E2\r
+S315000146501C0080E2102086E5143086E50120A0E1E9\r
+S315000146600CE086E5044086E50610A0E1185086E5D3\r
+S3150001467004709BE5020700EB8C309FE54C4086E217\r
+S31500014680001093E584209FE50400A0E10430A0E139\r
+S31500014690371E00EB78109FE50430A0E3B000D1E1AE\r
+S315000146A00120A0E301C080E2286084E5383086E578\r
+S315000146B03C2086E57C5086E5405086E5785086E5C7\r
+S315000146C00630A0E1B0C0C1E1042082E2B804C6E12F\r
+S315000146D00510A0E1012052E2801083E5043083E257\r
+S315000146E0FBFFFF5A0600A0E1987086E5212D00EB3D\r
+S315000146F00610A0E11C009FE5A40500EB0600A0E161\r
+S315000147000610A0E1F0681BE9052D00EA642102000C\r
+S3150001471018530100EC200200148A02000DC0A0E12A\r
+S3150001472030D82DE90050A0E10CD04DE204B04CE2A6\r
+S315000147304C0080E2B61E00EB0510A0E138009FE5B3\r
+S31500014740930500EB343095E598C095E5000053E3F9\r
+S3150001475000E095E5044095E5301095152410950582\r
+S31500014760102095E5143095E50500A0E100508DE88F\r
+S3150001477008408DE5ABFFFFEB30A81BE9148A020068\r
+S315000147800DC0A0E110D82DE90040A0E104B04CE233\r
+S31500014790B4009FE50410A0E17D0500EBAC309FE578\r
+S315000147A0002093E5012082E2002083E5A0309FE509\r
+S315000147B0001093E50300A0E19C2091E5040052E17D\r
+S315000147C01900000A003090E50210A0E1030052E151\r
+S315000147D0F8FFFF1A74209FE5003092E5010053E2CD\r
+S315000147E0000082150E00000A0030A0E34C0084E2AE\r
+S315000147F0B834C4E1021E00EB1C0094E51C1084E2EF\r
+S31500014800010050E110A81B09043091E5043080E550\r
+S31500014810042091E5041081E5000082E51C1084E581\r
+S3150001482010A81BE9450600EBEEFFFFEA20009FE515\r
+S315000148309C3094E5002090E59C3081E5040052E12E\r
+S315000148409C30940500308005E1FFFFEA148A0200DE\r
+S31500014850F4200200E82002000DC0A0E110D82DE9E5\r
+S315000148600040A0E104B04CE2B4009FE50410A0E1D1\r
+S31500014870470500EBAC309FE5002093E5012082E27D\r
+S31500014880002083E5A0309FE5001093E50300A0E139\r
+S315000148909C2091E5040052E11900000A003090E5E0\r
+S315000148A00210A0E1030052E1F8FFFF1A74209FE510\r
+S315000148B0003092E5010053E2000082150E00000A65\r
+S315000148C00030A0E34C0084E2B834C4E1CC1D00EB17\r
+S315000148D01C0094E51C1084E2010050E110A81B099C\r
+S315000148E0043091E5043080E5042091E5041081E56A\r
+S315000148F0000082E51C1084E510A81BE90F0600EBF9\r
+S31500014900EEFFFFEA20009FE59C3094E5002090E54C\r
+S315000149109C3081E5040052E19C309405003080050D\r
+S31500014920E1FFFFEA148A0200F4200200E8200200F7\r
+S315000149300DC0A0E130D82DE95C309FE504B04CE212\r
+S31500014940004093E554509FE5003095E5013083E240\r
+S31500014950003085E5383094E544009FE5000053E3D7\r
+S315000149600410A0E10900000A013083E3383084E530\r
+S31500014970003095E5013053E20300A0E100308515D2\r
+S315000149800000000A30A81BE9EC0500EBFCFFFFEA7A\r
+S31500014990BE0400EB383094E5F2FFFFEA0C8A020010\r
+S315000149A0F4200200148A02000DC0A0E130D82DE9DE\r
+S315000149B004B04CE20040A0E180309FE5002093E581\r
+S315000149C0012082E2002083E5383090E51C5080E228\r
+S315000149D0030013E30320C3E30900000A382080E53E\r
+S315000149E00C3095E50010A0E1000053E20F00001A1B\r
+S315000149F0383094E50410A0E1000053E340009FE540\r
+S31500014A000800000A34209FE5003092E5013053E2A8\r
+S31500014A100300A0E1003082150000000A30A81BE95E\r
+S31500014A20C60500EBFCFFFFEA750400EBF4FFFFEAA5\r
+S31500014A309F0500EB0030A0E30C3085E5EBFFFFEAB4\r
+S31500014A40F4200200148A02000DC0A0E110D82DE95D\r
+S31500014A5004B04CE284C09FE500409CE580209FE5C0\r
+S31500014A60003092E5013083E2003082E5400094E5B2\r
+S31500014A70000050E3013040E20E00000A403084E5B8\r
+S31500014A805C209FE5003092E5013053E20300A0E18E\r
+S31500014A90003082150500000A7C3094E5053043E2BA\r
+S31500014AA0010053E310A81B8910681BE9040100EA01\r
+S31500014AB0A20500EBF7FFFFEA00109CE50130A0E339\r
+S31500014AC0783081E500209CE57C0082E597FFFFEBCD\r
+S31500014AD0383094E5023083E3383084E5E7FFFFEAB6\r
+S31500014AE00C8A0200F42002000DC0A0E1F0DF2DE9DE\r
+S31500014AF0E8809FE504B04CE204D04DE20170A0E1EC\r
+S31500014B000060A0E1005098E5D4A09FE500309AE549\r
+S31500014B10013083E200308AE5404095E50390A0E349\r
+S31500014B20003054E2012044E20E00000A402085E5EF\r
+S31500014B30AC209FE5003092E5013053E20300A0E18D\r
+S31500014B40003082150500000A7C3095E5053043E208\r
+S31500014B50010053E3F0AF1B89F06F1BE9D80000EAAF\r
+S31500014B60760500EBF7FFFFEA78209FE5000092E566\r
+S31500014B70060090E900C098E5061091E078908CE572\r
+S31500014B80000098E50720A2E07C4080E5000098E55A\r
+S31500014B9000408DE54C0080E2371D00EB7C3095E549\r
+S31500014BA0000053E3E1FFFF1A003098E5789083E5B2\r
+S31500014BB0002098E57C4082E55CFFFFEB383095E507\r
+S31500014BC000009AE5023083E3383085E55B0500EBAA\r
+S31500014BD0000098E54C0080E28D1D00EBD3FFFFEA53\r
+S31500014BE00C8A0200F4200200642102000DC0A0E13B\r
+S31500014BF000D82DE904B04CE25C309FE5002093E536\r
+S31500014C00012082E2002083E5383090E5020013E3BB\r
+S31500014C104030900501308302403080050800001ABB\r
+S31500014C2034209FE5003092E5013053E20300A0E114\r
+S31500014C30003082150000000A00A81BE93F0500EBC1\r
+S31500014C40FCFFFFEA0730A0E30020A0E37C3080E50B\r
+S31500014C50782080E553FFFFEBF0FFFFEAF420020026\r
+S31500014C600DC0A0E110D82DE904B04CE238209FE533\r
+S31500014C70003092E5013083E2003082E50030A0E3A6\r
+S31500014C80404090E5403080E5003092E5013053E246\r
+S31500014C900300A0E1003082150100000A0400A0E132\r
+S31500014CA010A81BE9250500EBFBFFFFEAF420020033\r
+S31500014CB00DC0A0E130D82DE904B04CE20040A0E1DE\r
+S31500014CC05C509FE5003095E5013083E2003085E5D3\r
+S31500014CD03C3090E5382090E5013083E2000052E354\r
+S31500014CE040009FE50410A0E13C3084E50900000A7C\r
+S31500014CF0043082E3383084E5003095E5013053E233\r
+S31500014D000300A0E1003085150000000A30A81BE968\r
+S31500014D100A0500EBFCFFFFEADC0300EB382094E513\r
+S31500014D20F2FFFFEAF4200200148A02000DC0A0E19E\r
+S31500014D3000D82DE904B04CE200C0A0E170209FE547\r
+S31500014D40003092E5013083E2003082E53C3090E5A7\r
+S31500014D50010053E30B00000A000053E3013043E274\r
+S31500014D603C30801548209FE5003092E5013053E242\r
+S31500014D700300A0E1003082150000000A00A81BE92B\r
+S31500014D80EE0400EBFCFFFFEA382090E50030A0E3DB\r
+S31500014D900420C2E3030052E10010A0E13C3080E5AB\r
+S31500014DA038208CE50C009FE5EDFFFF1A940300EB1C\r
+S31500014DB0EBFFFFEAF4200200148A02000DC0A0E115\r
+S31500014DC000D82DE904B04CE200C0A0E164309FE5B3\r
+S31500014DD0002093E5012082E2002083E53C3090E546\r
+S31500014DE0000053E30800000A382090E50030A0E3F4\r
+S31500014DF00420C2E3030052E10010A0E13C3080E54B\r
+S31500014E0038208CE530009FE50800000A24209FE544\r
+S31500014E10003092E5013053E20300A0E10030821533\r
+S31500014E200000000A00A81BE9C40400EBFCFFFFEA2E\r
+S31500014E30730300EBF4FFFFEAF4200200148A020078\r
+S31500014E400DC0A0E100D82DE904B04CE26C309FE51D\r
+S31500014E50002093E5012082E2002083E5783090E589\r
+S31500014E60070053E303F19F970B0000EAA04E0100F0\r
+S31500014E708C4E01008C4E01008C4E0100A04E0100AB\r
+S31500014E80A04E0100A04E0100A04E01000030A0E39B\r
+S31500014E900420A0E3783080E57C2080E5C1FEFFEBAD\r
+S31500014EA018209FE5003092E5010053E200008215CB\r
+S31500014EB00000000A00A81BE9A00400EBFCFFFFEAC2\r
+S31500014EC0F42002000DC0A0E130D82DE948209FE56D\r
+S31500014ED004B04CE2004092E540509FE5003095E574\r
+S31500014EE0013083E2003085E5000092E54C0080E266\r
+S31500014EF0C71C00EB383094E524009FE5100053E30E\r
+S31500014F000410A0E11030A013383084155F03001B94\r
+S31500014F10000095E530681BE9880400EA0C8A020066\r
+S31500014F20F4200200148A02000DC0A0E110D82DE978\r
+S31500014F30D4309FE504B04CE2002093E50040A0E1A7\r
+S31500014F40020050E12E00000AC0209FE5003092E5E4\r
+S31500014F50013083E2003082E50400A0E196FFFFEB19\r
+S31500014F604C0084E2AA1C00EB7C3094E5060053E376\r
+S31500014F701000000A783094E5070053E303F19F9788\r
+S31500014F800C0000EAA44F0100F04F0100F04F0100B0\r
+S31500014F90F04F0100C04F0100C04F0100C04F01009A\r
+S31500014FA0C04F0100383094E5000053E30B00000ABE\r
+S31500014FB01030A0E3383084E50400A0E179FEFFEB70\r
+S31500014FC048209FE5003092E5010053E2000082157A\r
+S31500014FD00000000A10A81BE9580400EBFCFFFFEAD9\r
+S31500014FE00410A0E128009FE5280300EBEFFFFFEA8C\r
+S31500014FF00030A0E30620A0E3783084E57C2084E538\r
+S31500015000ECFFFFEAAEFFFFEBCEFFFFEA0C8A0200E0\r
+S31500015010F4200200148A02000DC0A0E1F0D92DE9A6\r
+S3150001502004B04CE20040A0E10150A0E110219FE54F\r
+S31500015030003092E5013083E2003082E5383090E5B8\r
+S315000150400070A0E3070053E13800000A010013E3F2\r
+S315000150503400000A1C6080E20C7096E5000057E3FC\r
+S315000150603000000A0700A0E10410A0E1100400EBE3\r
+S31500015070D0809FE50030A0E30C3086E50800A0E172\r
+S315000150800410A0E1420300EB343094E5000053E341\r
+S315000150900300000A243094E5305084E5050053E10D\r
+S315000150A0000000DA245084E50800A0E10410A0E124\r
+S315000150B0360300EB383094E5000053E31500000A8F\r
+S315000150C0010013E30300000A000057E30700A011E3\r
+S315000150D00410A011D103001B6C309FE5002093E55D\r
+S315000150E0020054E164309F050120A00300208305DE\r
+S315000150F00400A0110E03001B44209FE5003092E539\r
+S31500015100010053E2000082150000000AF0A91BE924\r
+S315000151100A0400EBFCFFFFEA0800A0E10410A0E18D\r
+S31500015120B70200EBEBFFFFEA18809FE5D2FFFFEA2B\r
+S3150001513010809FE50010A0E10800A0E1D30200EB7A\r
+S31500015140CDFFFFEAF4200200148A02000C8A020055\r
+S31500015150108A02000DC0A0E1F0D92DE904B04CE29D\r
+S3150001516004D04DE20080A0E10260A0E10150A0E17F\r
+S3150001517094709FE5003097E5013083E2003087E5C2\r
+S31500015180EAFDFFEB84309FE584C09FE5000093E5CF\r
+S315000151900230A0E3060090E900E09CE50040A0E3B0\r
+S315000151A078308EE500009CE5051091E07C4080E5B5\r
+S315000151B000009CE50620A2E00430A0E14C0080E25C\r
+S315000151C000408DE5AC1B00EB003097E5013053E262\r
+S315000151D00300A0E1003087150900000A30309FE581\r
+S315000151E0000093E54C0080E2091C00EB7C3098E559\r
+S315000151F0053043E2010053E3F0A91B89F0691BE97D\r
+S315000152002FFFFFEACD0300EBF3FFFFEAF4200200D4\r
+S31500015210642102000C8A02001CC09FE510402DE9A2\r
+S3150001522000409CE50030A0E1040053E10C009FE53D\r
+S315000152301080BD181040BDE8EB0000EA0C8A0200A0\r
+S31500015240F08902000DC0A0E170D82DE904B04CE24E\r
+S3150001525060509FE5003095E5013083E2003085E539\r
+S3150001526054409FE50020E0E3003094E5000053E25E\r
+S315000152700100001A0200A0E170A81BE9481700EB23\r
+S31500015280003094E50120A0E31230C3E10060A0E103\r
+S31500015290003084E5003095E5013053E20300A0E1DA\r
+S315000152A0003085150100000A0620A0E1F0FFFFEAA3\r
+S315000152B0A20300EBFBFFFFEAF4200200F02002004C\r
+S315000152C00DC0A0E100D82DE904B04CE23CC09FE539\r
+S315000152D000309CE5013083E200308CE530109FE51B\r
+S315000152E00120A0E3003091E5123083E1003081E531\r
+S315000152F000309CE5013053E20300A0E100308C153B\r
+S315000153000000000A00A81BE98C0300EBFCFFFFEA82\r
+S31500015310F4200200F02002000DC0A0E100D82DE922\r
+S3150001532004B04CE2280091E57C209FE5003092E52F\r
+S31500015330013083E2003082E5783090E5070053E3DF\r
+S3150001534003F19F970B0000EA7C5301007C53010097\r
+S31500015350685301009C5301007C5301007C530100FA\r
+S315000153607C5301007C5301000030A0E30720A0E339\r
+S31500015370783080E57C2080E58AFDFFEB28209FE5DB\r
+S31500015380003092E5010053E2000082150000000A98\r
+S3150001539000A81BE9690300EBFCFFFFEA0030A0E36C\r
+S315000153A0783080E50320A0E3F1FFFFEAF420020054\r
+S315000153B00C209FE5003092E5013083E2003082E562\r
+S315000153C0FBFFFFEA4C8902000DC0A0E130D82DE9B0\r
+S315000153D064409FE504B04CE2004064E0C442A0E1B1\r
+S315000153E0843084E0033283E0033483E0033883E0CE\r
+S315000153F048C09FE548E09FE50CD04DE2034184E0BB\r
+S3150001540084E58EE000C08DE538209FE502CBA0E360\r
+S315000154101F10A0E30030A0E30050A0E104E08DE5F9\r
+S3150001542008C08DE542FCFFEB1C009FE50510A0E1DD\r
+S315000154300420A0E130681BE94D0200EA5089020010\r
+S315000154401C1202004C810200B0530100148A0200B2\r
+S315000154500DC0A0E130D82DE964409FE504B04CE2CF\r
+S31500015460004064E0C442A0E1843084E0033283E07A\r
+S31500015470033483E0033883E048C09FE548E09FE5B5\r
+S315000154800CD04DE2034184E084E58EE000C08DE559\r
+S3150001549038209FE502CBA0E31F10A0E30030A0E374\r
+S315000154A00050A0E104E08DE508C08DE520FCFFEB8E\r
+S315000154B01C009FE50510A0E10420A0E130681BE96E\r
+S315000154C02B0200EA508902001C1202004C810200E4\r
+S315000154D0B0530100148A02000DC0A0E170D82DE975\r
+S315000154E058609FE504B04CE2060051E1010050030B\r
+S315000154F00050A0E10140A0E10D00000A060054E1C0\r
+S315000155000000550370A81B1934009FE5000050E305\r
+S3150001551070A81B090050A0E1A04080E2050054E1FB\r
+S31500015520A04044E20400A0E170A81B0993FCFFEB34\r
+S31500015530F9FFFFEA08009FE5C4FFFFEBEEFFFFEA74\r
+S31500015540983A00005089020004E02DE508109FE515\r
+S315000155500100A0E304E09DE4DEFFFFEA983A0000C3\r
+S3150001556004E02DE508109FE50000A0E304E09DE4BA\r
+S31500015570D8FFFFEA983A00000EF0A0E108209FE567\r
+S315000155800030A0E30C0080E80EF0A0E178550100A0\r
+S3150001559008209FE50030A0E30C0080E80EF0A0E1B2\r
+S315000155A07855010004E02DE504E09DE50310A0E136\r
+S315000155B000005EE30030901508C09DE500308E15B1\r
+S315000155C000005CE30430901500308C15041080E572\r
+S315000155D0002080E504F09DE408209FE50030A0E36B\r
+S315000155E00C0080E80EF0A0E1785501000DC0A0E1A5\r
+S315000155F000D82DE90030A0E104B04CE2040090E5AA\r
+S315000156000FE0A0E100F093E500A81BE904E02DE519\r
+S3150001561014309FE500C0A0E1000093E50120A0E160\r
+S315000156200C10A0E104E09DE4FAFEFFEA0C8A0200F8\r
+S315000156301C309FE50020A0E1030051E10100520367\r
+S3150001564004E02DE50C009FE504F09D1404E09DE4C3\r
+S31500015650CEFFFFEAE02E0000F089020004E02DE50E\r
+S3150001566008109FE50100A0E304E09DE4EFFFFFEAD7\r
+S31500015670E02E0000060080E804109DE500209DE56F\r
+S3150001568000C0A0E314C080E5082080E50C1080E589\r
+S31500015690103080E518C080E50EF0A0E1060080E834\r
+S315000156A004109DE500209DE500C0A0E314C080E53F\r
+S315000156B0082080E50C1080E5103080E518C080E5F3\r
+S315000156C00EF0A0E104E02DE504E09DE47D0000EA92\r
+S315000156D004E02DE504E09DE47A0000EA0DC0A0E1B6\r
+S315000156E070D82DE96C509FE50060A0E3063195E77F\r
+S315000156F004B04CE2060053E170A81B0900000FE15B\r
+S3150001570000400FE1C04084E304F029E100C095E5C3\r
+S315000157100020A0E318309CE5063185E714109CE5CE\r
+S3150001572014208CE500300FE1C04000E2C030C3E335\r
+S31500015730043083E103F029E100009CE510209CE59B\r
+S315000157400FE0A0E10CF09CE5003095E5000053E385\r
+S3150001575070A81B09E8FFFFEA048A020004E02DE5B0\r
+S3150001576004E09DE4DCFFFFEA04E02DE504E09DE4AE\r
+S3150001577060C5FFEA04402DE500100FE100400FE18E\r
+S31500015780C04084E304F029E1143090E538C09FE578\r
+S31500015790013083E2143080E5142090E5010052E3E4\r
+S315000157A000209C050030A0031820800503018C070A\r
+S315000157B000300FE1C04001E2C030C3E3043083E1B1\r
+S315000157C003F029E11000BDE80EF0A0E1048A020011\r
+S315000157D004E02DE504E09DE4E5FFFFEAA000A0E179\r
+S315000157E0010000E2000051E30000A00301000012E5\r
+S315000157F00DC0A0E1000050E310D82DE90100A0E1A1\r
+S3150001580004B04CE20240A0E10F00001A40309FE5CF\r
+S31500015810002093E5184082E538209FE5003092E5A7\r
+S31500015820013053E20300A0E1003082150400000AB2\r
+S315000158301C309FE50020A0E3001093E5182081E5C8\r
+S3150001584010A81BE93D0200EBF8FFFFEAC8FFFFEBDA\r
+S31500015850EDFFFFEA0C8A0200F42002000DC0A0E170\r
+S3150001586010D82DE90040A0E1041094E5000090E570\r
+S3150001587004B04CE2791600EB001094E534009FE584\r
+S3150001588034309FE5012190E7030052E110A81B196E\r
+S31500015890083094E5013180E7000094E5102094E595\r
+S315000158A018309FE5002183E7001094E510309FE54D\r
+S315000158B0014183E710A81BE904140200A821010095\r
+S315000158C0081502000C160200001090E538C09FE58D\r
+S315000158D0082090E501319CE704E02DE5020053E143\r
+S315000158E000E0A0E304F09D1420309FE501318CE730\r
+S315000158F0002090E518309FE502E183E7001090E56E\r
+S3150001590010309FE501E183E704F09DE404140200F1\r
+S31500015910A8210100081502000C16020008309FE5B7\r
+S31500015920002193E7002081E50EF0A0E120000000B0\r
+S3150001593010402DE900C00FE100400FE1C04084E3B3\r
+S3150001594004F029E128E09FE5000052E300319E17AB\r
+S315000159501CE09F050030821500118EE700300FE133\r
+S31500015960C0400CE2C030C3E3043083E103F029E117\r
+S315000159701080BDE82000000004402DE544009FE5AD\r
+S3150001598000C0A0E30C3190E70C0053E10800001AB7\r
+S3150001599000200FE100400FE1C04084E304F029E15B\r
+S315000159A024309FE50110A0E3002083E51C309FE52C\r
+S315000159B0001083E5003090E5013083E20C3180E789\r
+S315000159C01000BDE80EF0A0E1F8890200008A02008D\r
+S315000159D0FC89020004402DE544109FE50020A0E368\r
+S315000159E0023191E7013043E2023181E7022191E779\r
+S315000159F0000052E30800001A28309FE528109FE5B1\r
+S31500015A00002083E5022191E700300FE1C04002E268\r
+S31500015A10C030C3E3043083E103F029E11000BDE89F\r
+S31500015A200EF0A0E1F8890200FC890200008A02005A\r
+S31500015A300DC0A0E130D82DE904B04CE200500FE1D1\r
+S31500015A4000400FE1C04084E304F029E1EB1500EBCF\r
+S31500015A5000300FE1C04005E2C030C3E3043083E10A\r
+S31500015A6003F029E130A81BE904E02DE504E09DE4FB\r
+S31500015A70E21500EA0DC0A0E130D82DE904B04CE2F0\r
+S31500015A8000500FE100400FE1C04084E304F029E13A\r
+S31500015A90E51500EB00300FE1C04005E2C030C3E37D\r
+S31500015AA0043083E103F029E130A81BE904E02DE588\r
+S31500015AB004E09DE4DC1500EA04E02DE504E09DE444\r
+S31500015AC0E41500EA04E02DE504E09DE4E21500EAB0\r
+S31500015AD014309FE5030051E1010050030C309F058E\r
+S31500015AE00020A003002083050EF0A0E1E02E0000B7\r
+S31500015AF0FC89020004E02DE508109FE50100A0E302\r
+S31500015B0004E09DE4F1FFFFEAE02E000004E02DE54C\r
+S31500015B1008109FE50000A0E304E09DE4EBFFFFEA27\r
+S31500015B20E02E000044309FE50120A0E3002083E53C\r
+S31500015B30042080E21F30A0E30010A0E3013043E21D\r
+S31500015B40010073E3041082E4FBFFFF1A20309FE596\r
+S31500015B500020A0E30110A0E3002080E5021183E705\r
+S31500015B6010309FE50500A0E3020183E70EF0A0E1F6\r
+S31500015B70F4200200108A0200088A020044309FE5E0\r
+S31500015B800120A0E3002083E5042080E21F30A0E38A\r
+S31500015B900010A0E3013043E2010073E3041082E444\r
+S31500015BA0FBFFFF1A20309FE50020A0E30110A0E3D0\r
+S31500015BB0002080E5021183E710309FE50500A0E390\r
+S31500015BC0020183E70EF0A0E1F4200200108A020030\r
+S31500015BD0088A02000DC0A0E110D82DE90040A0E11D\r
+S31500015BE004B04CE2000090E5ED1400EB004184E0C6\r
+S31500015BF0043094E5000053E31C0043E20300A001D6\r
+S31500015C0010A81BE90DC0A0E1F0D92DE9247091E59A\r
+S31500015C10283091E5074180E0000053E304B04CE2EF\r
+S31500015C200160A0E10050A0E1048084E21400001AA2\r
+S31500015C30043094E5000053E3003095050120A003EC\r
+S31500015C401237830100308505001098E5000056E300\r
+S31500015C501C0086120600A001000051E304309115D4\r
+S31500015C600010801504308015042091150000880568\r
+S31500015C7004008115000082150600A0E1F0691BE908\r
+S31500015C802B0000EA0300A0E1090100EBE7FFFFEAB0\r
+S31500015C9010402DE9244091E5000051E3043180E0F4\r
+S31500015CA004E083E21CC0811201C0A00100109EE540\r
+S31500015CB001005CE100309C1504209C15042083152D\r
+S31500015CC004109C1504C08C150030811500C08C157C\r
+S31500015CD000109E150500000A000051E300309005F2\r
+S31500015CE00120A0031234C301003080051080BDE8F5\r
+S31500015CF0000051E3F7FFFF0A00C091E501005CE1F6\r
+S31500015D000030A0030310A00100308E05F1FFFF0A49\r
+S31500015D10043091E504308CE5042091E5041081E519\r
+S31500015D2000C082E5001081E50C10A0E100C08EE5FF\r
+S31500015D30E8FFFFEA30C09FE5241090E500209CE5CE\r
+S31500015D40243092E5010053E1030000CA00309CE5CE\r
+S31500015D50382093E5000052E30EF0A0010C309FE5D8\r
+S31500015D600120A0E3002083E50EF0A0E10C8A0200E9\r
+S31500015D70108A020004E02DE50C309FE50100A0E148\r
+S31500015D80021183E704E09DE4E7FBFFEA0C8A0200C7\r
+S31500015D900EF0A0E10EF0A0E10100A0E30EF0A0E1FB\r
+S31500015DA004E02DE518209FE5003092E5013043E23D\r
+S31500015DB0000053E3003082E504F09D1404E09DE405\r
+S31500015DC0000000EA088A020004E02DE56C309FE538\r
+S31500015DD000C0A0E30C2193E764309FE50C0052E17B\r
+S31500015DE0001093E504F09D14383091E50C0053E161\r
+S31500015DF004F09D14242091E548309FE50CE0A0E1D4\r
+S31500015E00020183E0042090E50C0052E10300000A40\r
+S31500015E10003092E5002053E2043080E51CE0421296\r
+S31500015E2001005EE120309F150120A013002083159B\r
+S31500015E3008309FE50520A0E30C2183E704F09DE4EB\r
+S31500015E40088A02000C8A0200148A0200108A0200E3\r
+S31500015E5004E02DE504009FE504E09DE4D9FFFFEA97\r
+S31500015E60148A0200030080E9000080E50EF0A0E13B\r
+S31500015E70030080E9000080E50EF0A0E104E02DE5D5\r
+S31500015E8074209FE5003092E5013083E2003082E51F\r
+S31500015E901C0040E2383090E5000053E31100001A7F\r
+S31500015EA0242090E554309FE5021183E0042091E51A\r
+S31500015EB0000052E30400000A003092E5002053E29C\r
+S31500015EC01CC042E2043081E50000001A02C0A0E1D4\r
+S31500015ED000005CE128309F1528309F050120A013A2\r
+S31500015EE00520A003002083E50C309FE5000093E523\r
+S31500015EF0010040E204E09DE4900000EAF420020083\r
+S31500015F00148A0200108A0200088A02000DC0A0E16C\r
+S31500015F1000D82DE904B04CE254209FE5003092E50B\r
+S31500015F20013083E2003082E548309FE5002183E0BD\r
+S31500015F30043092E5000053E30400000A0030931593\r
+S31500015F400430821530309FE50120A0E3002083E56F\r
+S31500015F501C209FE5003092E5013053E20300A0E1E9\r
+S31500015F60003082150000000A00A81BE9730000EB4F\r
+S31500015F70FCFFFFEAF4200200148A0200108A0200E4\r
+S31500015F800DC0A0E100D82DE904B04CE200C0A0E1AB\r
+S31500015F9080209FE5003092E5013083E2003082E502\r
+S31500015FA00C1090E51C2040E2000051E30C00000AB1\r
+S31500015FB0000052E30030A0110030A003003081E55B\r
+S31500015FC050209FE5003092E5013053E20300A0E145\r
+S31500015FD0003082150000000A00A81BE9570000EBFB\r
+S31500015FE0FCFFFFEA003090E50200A0E10C0053E15E\r
+S31500015FF0F2FFFF0A000052E3243092E518209FE5E4\r
+S315000160000C10A0110010A003032182E0041082E508\r
+S3150001601047FFFFEBE9FFFFEAF4200200148A0200C2\r
+S3150001602004E02DE500C090E5000051E31CE081E2AB\r
+S3150001603001E0A00100005CE304309C1500C08E1550\r
+S3150001604004308E1504209C1500E0800504E08C15B3\r
+S3150001605000E08215280081E504F09DE400C0A0E17E\r
+S31500016060000090E5000050E30020A0010B00000AAB\r
+S31500016070001090E5000051E1043090150030A003B6\r
+S31500016080043081150420901500308C05001082150E\r
+S315000160901C2040E2040080150000801500108C15BC\r
+S315000160A0000052E30030A0130200A0E1283082155F\r
+S315000160B00EF0A0E10030A0E3283081E5003090E544\r
+S315000160C0000051E31CC081E201C0A00103005CE1B4\r
+S315000160D000309C1504209C150420831504109C1582\r
+S315000160E004C08C150030811500C08C150EF0A0116E\r
+S315000160F000005CE30EF0A00100109CE50C0051E1EC\r
+S3150001610004309C150030A0030430811504209C1531\r
+S31500016110003080050010821504C08C1500C08C1556\r
+S31500016120001080150EF0A0E1000090E5000050E39C\r
+S315000161301C3040E20030A0010300A0E10EF0A0E116\r
+S315000161400DC0A0E170D82DE904B04CE20050A0E1E9\r
+S31500016150000055E30300001AB8309FE5052193E7D7\r
+S31500016160000052E32900001AAC609FE5004096E565\r
+S31500016170383094E5000053E30300001A9C309FE594\r
+S31500016180002093E5000052E31100000A90009FE50C\r
+S315000161908FFEFFEB000054E10700000A84209FE513\r
+S315000161A00C0080E2003092E50C1084E2013083E2BB\r
+S315000161B0003082E58D1300EB004086E568309FE5EF\r
+S315000161C00520A0E3002083E550309FE50010A0E301\r
+S315000161D0001083E5000055E30900001A4C109FE505\r
+S315000161E0005081E52C309FE5052193E7000052E33D\r
+S315000161F000309115013083120030811570A81B09FA\r
+S31500016200D2FFFFEA24309FE5005083E570A81BE921\r
+S3150001621054FDFFEBD3FFFFEA048A02000C8A020059\r
+S31500016220108A0200148A0200988A0200088A020073\r
+S31500016230F42002000DC0A0E100D82DE904B04CE223\r
+S31500016240FFFFFFEB0DC0A0E100D82DE924009FE57B\r
+S3150001625004B04CE25EFEFFEB1C309FE51C209FE57F\r
+S3150001626000C0A0E10010A0E3001083E50C0080E26D\r
+S3150001627000C082E5641300EB148A0200108A020052\r
+S315000162800C8A02000DC0A0E110D82DE90210A0E190\r
+S3150001629004B04CE20040A0E1F1FEFFEB0030A0E3C8\r
+S315000162A0183084E50C3084E5103084E510A81BE92C\r
+S315000162B00DC0A0E110D82DE90210A0E104B04CE216\r
+S315000162C00040A0E1E6FEFFEB0030A0E3183084E5D4\r
+S315000162D00C3084E5103084E510A81BE90DC0A0E15F\r
+S315000162E070D82DE9086090E50050A0E1060051E163\r
+S315000162F004B04CE21C0040E270A81BA90030A0E3E8\r
+S31500016300184095E5183085E542FBFFEB000054E3A4\r
+S315000163100130A0E314608505183085E570A81BE9F6\r
+S3150001632004E02DE5003092E50120A0E1000053E3F1\r
+S3150001633004F09D04241091E504E09DE4E6FFFFEAE4\r
+S3150001634010402DE9104090E500C0A0E1000054E3A3\r
+S315000163501C0040E21080BD1818309CE5000053E394\r
+S315000163601080BD0814209CE508309CE50210A0E1D0\r
+S31500016370020053E118408CE51080BDA81040BDE82D\r
+S3150001638024FBFFEA04E02DE50120A0E1241091E5BC\r
+S3150001639004E09DE4D0FFFFEA04E02DE504E09DE47E\r
+S315000163A0DEFFFFEA04E02DE504E09DE4E3FFFFEAFA\r
+S315000163B004E02DE50020A0E304E09DE4C6FFFFEA2A\r
+S315000163C004E02DE504E09DE4DCFFFFEA0DC0A0E159\r
+S315000163D070D82DE958609FE504B04CE2060051E102\r
+S315000163E0010050030050A0E10140A0E10D00000AA8\r
+S315000163F0060054E10000550370A81B1934009FE5FF\r
+S31500016400040070E370A81B09045080E2844080E216\r
+S31500016410040055E1044044E20400A0E170A81B0910\r
+S31500016420F92500EBF9FFFFEA08009FE5BCFDFFEB4C\r
+S31500016430EEFFFFEAF82A0000148A020004E02DE5C7\r
+S3150001644008109FE50100A0E304E09DE4DEFFFFEAFA\r
+S31500016450F82A000004E02DE508109FE50000A0E3FE\r
+S3150001646004E09DE4D8FFFFEAF82A00000030A0E32B\r
+S315000164700A0080E80EF0A0E10030A0E30A0080E8FF\r
+S315000164800EF0A0E104E02DE5040080E204E09DE4C5\r
+S31500016490DD2500EA04E02DE5040080E204E09DE448\r
+S315000164A0D92500EA0DC0A0E1F0DF2DE9D4109FE562\r
+S315000164B004B04CE20040A0E101A0A0E3006091E538\r
+S315000164C0C4209FE5003092E50A3083E0003082E582\r
+S315000164D0002090E5000052E31C00001A0180A0E1B3\r
+S315000164E0047080E20A90A0E1002098E50050A0E344\r
+S315000164F0789082E5003098E57C5083E50BF9FFEB57\r
+S315000165000700A0E10610A0E1C4FEFFEB78309FE58D\r
+S31500016510000093E509FFFFEB7C3096E5040053E3A9\r
+S31500016520040000BA050053E305A0A0D1010000DA7A\r
+S31500016530060053E31100000A002094E5000052E32F\r
+S315000165400030A01301300A02000053E3E5FFFF1AF1\r
+S3150001655000005AE3013042120030841528209FE5DD\r
+S31500016560003092E5010053E2000082150100000AA5\r
+S315000165700A00A0E1F0AF1BE9F0FEFFEBFBFFFFEA2B\r
+S315000165804FFAFFEBEBFFFFEA0C8A0200F420020050\r
+S315000165900DC0A0E1F0DD2DE944419FE504B04CE2D8\r
+S315000165A004D04DE20060A0E1005094E50170A0E343\r
+S315000165B030019FE5003090E5073083E0003080E54B\r
+S315000165C0000094E50330A0E3783080E500E094E52F\r
+S315000165D000C0A0E37CC08EE5000094E50C30A0E18C\r
+S315000165E04C0080E200C08DE5A31600EB7C3095E5FA\r
+S315000165F0000053E3003096050200000A003096E5DC\r
+S31500016600007053E20170A013000053E30030A013A1\r
+S3150001661001300702000053E31E00000AC0809FE517\r
+S31500016620044086E203A0A0E3003098E578A083E564\r
+S31500016630002098E50030A0E37C3082E5BBF8FFEB53\r
+S315000166400400A0E10510A0E174FEFFEB94309FE584\r
+S31500016650000093E5B9FEFFEB7C3095E5033043E29C\r
+S31500016660030053E303F19F97040000EA7C660100EF\r
+S315000166707C6601007C660100DC6601000070A0E317\r
+S31500016680003096E5000053E30030A0130130070205\r
+S31500016690000053E3E3FFFF1A44309FE5000093E552\r
+S315000166A04C0080E2DA1600EB000057E30030961545\r
+S315000166B0013043120030861528209FE5003092E50F\r
+S315000166C0010053E2000082150100000A0700A0E163\r
+S315000166D0F0AD1BE999FEFFEBFBFFFFEAF8F9FFEBD3\r
+S315000166E0E6FFFFEA0C8A0200F42002000DC0A0E1D9\r
+S315000166F010D82DE904B04CE20140A0E344309FE5F7\r
+S31500016700002093E5042082E0002083E5003090E537\r
+S31500016710000053E3013043E2003080C50040A0D3BE\r
+S3150001672020209FE5003092E5013053E20300A0E10D\r
+S31500016730003082150100000A0400A0E110A81BE93F\r
+S315000167407EFEFFEBFBFFFFEAF42002000DC0A0E195\r
+S3150001675030D82DE90010A0E104B04CE264509FE569\r
+S31500016760003095E5013083E2003085E5003090E5A3\r
+S31500016770013083E2043080E4042091E5000052E315\r
+S315000167800040A0130140A003000054E30700000AE3\r
+S31500016790003095E5013053E20300A0E10030851594\r
+S315000167A00000000A30A81BE964FEFFEBFCFFFFEACC\r
+S315000167B029FEFFEB0730A0E37C3080E5784080E5D9\r
+S315000167C078F8FFEBF1FFFFEAF4200200000090E504\r
+S315000167D00EF0A0E10030A0E30A0080E80EF0A0E18F\r
+S315000167E00030A0E30A0080E80EF0A0E10DC0A0E1B0\r
+S315000167F0F0D92DE904B04CE20040A0E178309FE5E4\r
+S31500016800002093E5012082E2002083E5043090E533\r
+S31500016810048080E2000053E30030A0130130A0039E\r
+S31500016820000053E30850A0E10900001A0370A0E13B\r
+S315000168300560A0E30500A0E107FEFFEB7C6080E5B3\r
+S31500016840787080E557F8FFEB043094E5000053E3D8\r
+S31500016850F7FFFF1A20209FE5003092E5010053E281\r
+S31500016860000082150200000A0800A0E1F0691BE998\r
+S31500016870E52400EA31FEFFEBFAFFFFEAF42002000D\r
+S315000168800DC0A0E1F0D92DE904B04CE20040A0E131\r
+S3150001689078309FE5002093E5012082E2002083E520\r
+S315000168A0043090E5048080E2000053E30030A01339\r
+S315000168B00130A003000053E30850A0E10900001ACB\r
+S315000168C00370A0E10560A0E30500A0E1E2FDFFEB96\r
+S315000168D07C6080E5787080E532F8FFEB043094E562\r
+S315000168E0000053E3F7FFFF1A20209FE5003092E5F1\r
+S315000168F0010053E2000082150200000A0800A0E12F\r
+S31500016900F0691BE9C02400EA0CFEFFEBFAFFFFEA7F\r
+S31500016910F42002000DC0A0E100D82DE904B04CE23C\r
+S3150001692034209FE5003092E5013083E2003082E5B4\r
+S31500016930003090E5013003E0003080E5003092E55B\r
+S31500016940013053E20300A0E1003082150000000A85\r
+S3150001695000A81BE9F9FDFFEBFCFFFFEAF4200200AA\r
+S315000169600DC0A0E1F0DD2DE904B04CE204D04DE20A\r
+S315000169700050A0E118219FE5003092E5013083E245\r
+S31500016980003082E5042090E5003090E5000052E3F6\r
+S315000169900020A0130120A003013083E1000052E38F\r
+S315000169A0003080E52700001A24804BE2042028E508\r
+S315000169B0047080E207A0A0E30700A0E1A6FDFFEBBB\r
+S315000169C0444090E500C0A0E1002094E5000052E3B8\r
+S315000169D000E095050300000A00E095E50E3002E0AF\r
+S315000169E0020053E10400000A043094E50C10A0E112\r
+S315000169F00E0013E10800A0E12300000A0060A0E3F5\r
+S31500016A007CA08CE50C00A0E178608CE5E5F7FFEB56\r
+S31500016A100C3094E5002095E5060053E1082084E555\r
+S31500016A2000608515043095E5000053E3E1FFFF1A88\r
+S31500016A3028301BE50840A0E1000053E30900001AD5\r
+S31500016A400800A0E1702400EB44209FE5003092E5A8\r
+S31500016A50010053E2000082150000000AF0AD1BE9B7\r
+S31500016A60B6FDFFEBFCFFFFEA0400A0E17AFDFFEBB8\r
+S31500016A700010A0E10700A0E168FDFFEB28301BE54F\r
+S31500016A80000053E3F7FFFF1AECFFFFEA63FDFFEB9C\r
+S31500016A90E3FFFFEAF42002000DC0A0E1F0DD2DE9DD\r
+S31500016AA004B04CE210D04DE20250A0E10080A0E11A\r
+S31500016AB00170A0E1FF2002E220619FE5003096E52A\r
+S31500016AC0013083E2003086E5B20000EB000050E3BE\r
+S31500016AD00040A0E10700000A003096E5010053E2FC\r
+S31500016AE0000086150100000A0400A0E1F0AD1BE9D3\r
+S31500016AF092FDFFEBFBFFFFEA023005E2E0009FE5B6\r
+S31500016B00000053E30730A0010030A013006090E5B8\r
+S31500016B100720A0110020A00334300BE5011005E287\r
+S31500016B2034304BE22C400BE530200BE528100BE509\r
+S31500016B30443086E52C301BE50140A0E3000053E319\r
+S31500016B401B00001A047088E204A0A0E10080A0E105\r
+S31500016B50002098E50050A0E378A082E5003098E592\r
+S31500016B607C5083E571F7FFEB0700A0E10610A0E179\r
+S31500016B702AFDFFEB64309FE5000093E56FFDFFEB17\r
+S31500016B807C3096E5040053E3040000BA050053E3A4\r
+S31500016B900540A0D1010000DA060053E30D00000A0A\r
+S31500016BA0000054E30200000A2C301BE5000053E309\r
+S31500016BB0E6FFFF0A24209FE5003092E5010053E23B\r
+S31500016BC0000082150100000A2C001BE5F0AD1BE94F\r
+S31500016BD05AFDFFEBFBFFFFEAB9F8FFEBEFFFFFEA18\r
+S31500016BE0F42002000C8A02000DC0A0E104D04DE29F\r
+S31500016BF0F0DD2DE908B04CE214D04DE20260A0E1CF\r
+S31500016C0000A0A0E104308BE50170A0E1FF2002E2C3\r
+S31500016C1078419FE5003094E5013083E2003084E558\r
+S31500016C205C0000EB000050E30050A0E10700000A01\r
+S31500016C30003094E5010053E2000084150100000ACA\r
+S31500016C400500A0E1F0AD1BE93CFDFFEBFBFFFFEA10\r
+S31500016C503C819FE5023006E2000053E3004098E5DF\r
+S31500016C600730A0010030A0130720A0110020A003C7\r
+S31500016C7034300BE5011006E234304BE230200BE5EF\r
+S31500016C8028100BE52C000BE5443084E5002098E53F\r
+S31500016C900360A0E3786082E5001098E50030A0E18A\r
+S31500016CA07C0081E5000098E506009BE94C0080E246\r
+S31500016CB000508DE5F01400EB7C3094E5000053E3C1\r
+S31500016CC00050A0130150A003000055E32000000A64\r
+S31500016CD02C301BE5000053E31D00001A04708AE204\r
+S31500016CE006A0A0E10860A0E1003096E578A083E562\r
+S31500016CF0002096E50030A0E37C3082E50BF7FFEB40\r
+S31500016D000700A0E10410A0E1C4FCFFEB7C309FE585\r
+S31500016D10000093E509FDFFEB7C3094E5033043E287\r
+S31500016D20030053E303F19F97040000EA3C6D010061\r
+S31500016D303C6D01003C6D0100886D01000050A0E32F\r
+S31500016D40000055E30200000A2C301BE5000053E366\r
+S31500016D50E4FFFF0A38309FE5000093E54C0080E22E\r
+S31500016D602B1500EB24209FE5003092E5010053E24C\r
+S31500016D70000082150100000A2C001BE5B0FFFFEAA6\r
+S31500016D80EEFCFFEBFBFFFFEA4DF8FFEBEBFFFFEA43\r
+S31500016D90F42002000C8A02000DC0A0E110D82DE9F2\r
+S31500016DA004B04CE2FFE002E201C0A0E178109FE5E9\r
+S31500016DB0003091E5013083E2003081E5020012E303\r
+S31500016DC00040A0E31000000A003090E50C0013E13A\r
+S31500016DD00340A011000054E30200000A01001EE373\r
+S31500016DE00030A013003080153C209FE5003092E56D\r
+S31500016DF0010053E2000082150100000A0400A0E12F\r
+S31500016E0010A81BE9CDFCFFEBFBFFFFEA00005CE3EA\r
+S31500016E10EFFFFF0A002090E50C3002E003005CE181\r
+S31500016E200240A0010040A013E9FFFFEAF42002009E\r
+S31500016E3004E02DE504E09DE4882300EA04E02DE565\r
+S31500016E4004E09DE4852300EA04E02DE504E09DE4E9\r
+S31500016E50882300EA04E02DE504E09DE4852300EAA9\r
+S31500016E600DC0A0E100D82DE904B04CE204D04DE2FA\r
+S31500016E7010104BE2B82300EB000050E310001B1585\r
+S31500016E8000A81BE90DC0A0E100D82DE904B04CE231\r
+S31500016E9004D04DE20230A0E10120A0E110104BE246\r
+S31500016EA0042400EB000050E310001B1500A81BE9A9\r
+S31500016EB00DC0A0E100D82DE904B04CE204D04DE2AA\r
+S31500016EC010104BE2502400EB000050E310001B159C\r
+S31500016ED000A81BE904E02DE504E09DE4722400EA24\r
+S31500016EE004E02DE504E09DE4BC2400EA04E02DE580\r
+S31500016EF004E09DE4192500EA0DC0A0E100D82DE9C2\r
+S31500016F0004B04CE204D04DE210104BE2472500EBF1\r
+S31500016F10000050E310001B1500A81BE90020A0E3A8\r
+S31500016F200130A0E30C3080E5042080E5082080E5EF\r
+S31500016F300020C0E50EF0A0E10020A0E30130A0E3AF\r
+S31500016F400C3080E5042080E5082080E50020C0E5BE\r
+S31500016F500EF0A0E10030A0E3103080E50C1080E5D2\r
+S31500016F60083080E50030C0E5043080E50EF0A0E190\r
+S31500016F700030A0E3103080E50C1080E5083080E594\r
+S31500016F800030C0E5043080E50EF0A0E104E02DE517\r
+S31500016F90080080E204E09DE41B2300EA04E02DE5FD\r
+S31500016FA0080080E204E09DE4172300EA0DC0A0E199\r
+S31500016FB0F0DF2DE978619FE504B04CE20040A0E1E5\r
+S31500016FC001A0A0E3005096E568219FE5003092E517\r
+S31500016FD00A3083E0003082E50C3090E5000053E38F\r
+S31500016FE01C208512103092150A308310103082153C\r
+S31500016FF00C309015020053E34900000A0030D4E535\r
+S31500017000000053E33A00000A0680A0E1087084E21A\r
+S315000170100A90A0E1003098E50060A0E3789083E54E\r
+S31500017020002098E57C6082E540F6FFEB0510A0E1C3\r
+S315000170300700A0E1F9FBFFEB0C3094E50510A0E198\r
+S31500017040010053E33200000AE8309FE5000093E5B2\r
+S315000170503AFCFFEB7C3095E5040053E3040000BAEB\r
+S31500017060050053E306A0A0D1010000DA060053E3B0\r
+S315000170702500000A0030D4E5000053E31C00000A95\r
+S3150001708000005AE3E2FFFF1A0C3094E5000053E3D7\r
+S315000170901C208512103092150130431210308215D2\r
+S315000170A00C309415010053E30D00000A020053E36E\r
+S315000170B00800000A7C209FE5003092E5010053E2BA\r
+S315000170C0000082150100000A0A00A0E1F0AF1BE9E9\r
+S315000170D01AFCFFEBFBFFFFEA1C0085E2B7FCFFEBA6\r
+S315000170E0F3FFFFEA1C0085E2ADFCFFEB0C3094E5F3\r
+S315000170F0EDFFFFEA00005AE30130A01304508415A6\r
+S315000171000030C415EAFFFF1ADEFFFFEA6CF7FFEB5A\r
+S31500017110D7FFFFEA040094E51C0080E298FCFFEB30\r
+S31500017120C8FFFFEA101094E51C0085E29FFCFFEB07\r
+S31500017130B1FFFFEA0C8A0200F42002000DC0A0E1B3\r
+S3150001714010D82DE904B04CE20140A0E300C0A0E153\r
+S3150001715088309FE5002093E5042082E0002083E546\r
+S315000171600030D0E5000053E31A00001A70309FE5A5\r
+S315000171700C1090E5002093E5000051E31CE082E24B\r
+S315000171800040CCE504208CE510309E151C0082E2FF\r
+S315000171900430831010308E150C109C15020051E33B\r
+S315000171A00900000A34209FE5003092E5013053E2E0\r
+S315000171B00300A0E1003082150100000A0400A0E1ED\r
+S315000171C010A81BE9DDFBFFEBFBFFFFEA10109CE5B6\r
+S315000171D076FCFFEBF2FFFFEA0040A0E3F0FFFFEAD7\r
+S315000171E0F42002000C8A02000DC0A0E1F0D82DE9BE\r
+S315000171F004B04CE20040A0E1EC309FE5002093E5AD\r
+S31500017200012082E2002083E5083090E5087080E2E3\r
+S31500017210000053E30060A0130160A003000056E3E1\r
+S315000172202000000A0C3094E5000053E30500000A33\r
+S31500017230042094E51C2082E2103092E5013043E2FD\r
+S31500017240103082E50C3094E5010053E31000000A8A\r
+S31500017250020053E30A00000A0030A0E3043084E58B\r
+S315000172600030C4E580209FE5003092E5010053E23D\r
+S31500017270000082150000000AF0A81BE9AFFBFFEB36\r
+S31500017280FCFFFFEA040094E51C0080E24BFCFFEBE7\r
+S31500017290F0FFFFEA040094E51C0080E240FCFFEBEE\r
+S315000172A00C3094E5E9FFFFEA0700A0E16AFBFFEB7A\r
+S315000172B00C3094E50050A0E1010053E30500000AFB\r
+S315000172C00730A0E3786085E57C3085E50500A0E11F\r
+S315000172D0B4F5FFEBD2FFFFEA041094E51C0080E24F\r
+S315000172E00720A0E12BFCFFEBF4FFFFEAF4200200EC\r
+S315000172F00DC0A0E130D82DE904B04CE20040A0E178\r
+S3150001730054309FE5002093E5012082E2002083E5C9\r
+S31500017310083090E5085080E2000053E30700001AA8\r
+S3150001732034209FE5003092E5010053E2000082150A\r
+S315000173300000000A30A81BE980FBFFEBFCFFFFEA17\r
+S315000173400500A0E144FBFFEBBCF6FFEB083094E53A\r
+S31500017350000053E3F9FFFF1AF0FFFFEAF4200200F1\r
+S315000173600DC0A0E100D82DE904B04CE22C209FE528\r
+S31500017370003092E5013083E2003082E5101080E5AD\r
+S31500017380003092E5013053E20300A0E1003082159E\r
+S315000173900000000A00A81BE968FBFFEBFCFFFFEAFF\r
+S315000173A0F42002000DC0A0E100D82DE904B04CE2A2\r
+S315000173B02C209FE5003092E5013083E2003082E522\r
+S315000173C00C1080E5003092E5013053E20300A0E1A4\r
+S315000173D0003082150000000A00A81BE957FBFFEBED\r
+S315000173E0FCFFFFEAF42002000030A0E30A0080E877\r
+S315000173F00EF0A0E10030A0E30A0080E80EF0A0E163\r
+S315000174000030A0E3003080E5043080E50EF0A0E115\r
+S315000174100030A0E3003080E5043080E50EF0A0E105\r
+S3150001742004E02DE5040080E204E09DE4F62100EA93\r
+S3150001743004E02DE5040080E204E09DE4F22100EA87\r
+S315000174400DC0A0E1F0DF2DE99C409FE504B04CE2C0\r
+S315000174500060A0E10180A0E101A0A0E3007094E535\r
+S3150001746088509FE5003095E50A3083E0003085E5D8\r
+S315000174700100A0E15BFFFFEB002094E50090A0E393\r
+S3150001748078A082E5003094E5046086E27C9083E58D\r
+S3150001749026F5FFEB0600A0E10710A0E1DFFAFFEBFE\r
+S315000174A0000095E5010040E224FBFFEB7C3097E507\r
+S315000174B0040053E3040000BA050053E309A0A0D178\r
+S315000174C0010000DA060053E30500000A0800A0E106\r
+S315000174D0B5FEFFEB000050E30A00A011F0AF1B1947\r
+S315000174E0F9FFFFEA76F6FFEBF7FFFFEA0C8A0200E7\r
+S315000174F0F42002000DC0A0E130D82DE904B04CE221\r
+S315000175005C509FE5003095E5013083E2003085E56A\r
+S31500017510043090E5040080E2000053E30040A0132C\r
+S315000175200140A003000054E30700000A003095E57E\r
+S31500017530013053E20300A0E1003085150000000A86\r
+S3150001754030A81BE9FDFAFFEBFCFFFFEAC2FAFFEBED\r
+S315000175500730A0E37C3080E5784080E511F5FFEB4C\r
+S31500017560F1FFFFEAF42002000DC0A0E1F0D82DE9F9\r
+S3150001757004B04CE20040A0E16C309FE5002093E5A9\r
+S31500017580012082E2002083E5043090E5045080E288\r
+S31500017590000053E30030A0130130A003000053E3C1\r
+S315000175A00900001A0370A0E10760A0E30500A0E14D\r
+S315000175B0A9FAFFEB7C6080E5787080E5F9F4FFEBD2\r
+S315000175C0043094E5000053E3F7FFFF1A18209FE506\r
+S315000175D0003092E5010053E2000082150000000A26\r
+S315000175E0F0A81BE9D5FAFFEBFCFFFFEAF420020045\r
+S315000175F00DC0A0E1F0DF2DE9E8809FE504B04CE283\r
+S315000176000CD04DE20350A0E10240A0E10130A0E31D\r
+S315000176102C000BE50160A0E130300BE5007098E528\r
+S31500017620C4909FE5003099E5013083E2003089E599\r
+S315000176300100A0E1EBFEFFEBBCF4FFEB002098E5B7\r
+S315000176400330A0E3783082E5001098E500A0A0E3BE\r
+S315000176507CA081E5000098E50A30A0E10520A0E1C3\r
+S315000176600410A0E14C0080E200A08DE5821200EB3F\r
+S315000176707C3097E50A0053E11500000A000099E500\r
+S31500017680010040E2ADFAFFEB000098E54C0080E214\r
+S31500017690DF1200EB7C1097E5030051E3040000BA0A\r
+S315000176A0050051E330A00BD5010000DA060051E3D5\r
+S315000176B00500000A0600A0E13BFEFFEB000050E3D7\r
+S315000176C030001B15F0AF1B19F9FFFFEAFCF5FFEBC4\r
+S315000176D0F7FFFFEA2C301BE50710A0E1040083E267\r
+S315000176E04EFAFFEBE4FFFFEA0C8A0200F4200200E7\r
+S315000176F00DC0A0E100D82DE90130A0E104B04CE2B3\r
+S31500017700070050E300F19F97090000EA2C7701007A\r
+S315000177103C7701004877010054770100607701004A\r
+S31500017720707701007C770100887701000100A0E3F2\r
+S3150001773000A81BE90000A0E300A81BE9000091E5F1\r
+S31500017740200000EB00A81BE9000091E54E0000EBCC\r
+S3150001775000A81BE9070091E8630000EB00A81BE9FC\r
+S31500017760041091E5000093E5B90000EB00A81BE9C0\r
+S31500017770070091E80D0100EB00A81BE9070091E85D\r
+S31500017780390100EB00A81BE9070091E8600100EB55\r
+S3150001779000A81BE904309FE53C3080E50EF0A0E12E\r
+S315000177A0F07601000030A0E12004A0E10324A0E16D\r
+S315000177B0FF0C00E2230C80E1FF2802E2020080E1D7\r
+S315000177C0030C80E10EF0A0E11F30A0E3003080E55C\r
+S315000177D00100A0E30EF0A0E10020A0E30DC0A0E1AE\r
+S315000177E0010070E30200501110D82DE90030A0E12C\r
+S315000177F004B04CE20140A0E104208105002081058E\r
+S3150001780010A81B09F804D0E1003081E50008A0E1C9\r
+S315000178102008A0E1E2FFFFEB040084E510A81BE9C4\r
+S315000178200DC0A0E100D82DE904B04CE2040090E5BA\r
+S31500017830DBFFFFEB4C309FE50008A0E1003093E54C\r
+S315000178404028A0E1000053E39C309315000053E269\r
+S3150001785000A81B090238A0E128C09FE52318A0E172\r
+S31500017860B834D0E10020A0E3010053E100A81B09D0\r
+S3150001787000309CE5030050E19C209015000052E287\r
+S3150001788000A81B09F5FFFFEAE82002000DC0A0E1F0\r
+S3150001789000D82DE914309FE50010A0E104B04CE2B8\r
+S315000178A0000093E5CBFFFFEB0100A0E300A81BE975\r
+S315000178B00C8A02000DC0A0E100D82DE904B04CE20B\r
+S315000178C0D6FFFFEB000050E30030A0E1B834D01141\r
+S315000178D00300A0E100A81BE908309FE5002093E51D\r
+S315000178E0B804D2E10EF0A0E10C8A02000DC0A0E1BD\r
+S315000178F0000050E330D82DE90040A0E104B04CE28D\r
+S315000179000100A0E10250A0E10800000A48309FE50D\r
+S31500017910003093E5000053E39C0093150300A0019A\r
+S315000179200510A0E1ABFFFFEB0100A0E330A81BE9C6\r
+S31500017930BAFFFFEB000050E330A81B0918309FE5A2\r
+S31500017940002093E5020050E19C0090150400A0017F\r
+S31500017950000050E3F1FFFF1A30A81BE9E8200200FE\r
+S315000179600130D1E4000053E30130C0E401004002DC\r
+S315000179700EF0A001F9FFFFEA0DC0A0E1F0DF2DE94D\r
+S31500017980000051E30140A0E12B90A0E3004061B269\r
+S31500017990029089B2000054E304B04CE210D04DE2EB\r
+S315000179A00050A0E33030A0030060A0E10280A0E116\r
+S315000179B088A09FE50150850238304B050D00000A6D\r
+S315000179C028704BE20400A0E10810A0E1D71600EBF5\r
+S315000179D00030DAE70810A0E10400A0E1103047E525\r
+S315000179E0A61600EB000050E30040A0E1017087E21B\r
+S315000179F0015085E2F2FFFF1A2D0059E328204B02C0\r
+S31500017A00053082000150451210904305000055E3F0\r
+S31500017A10060000BA28304BE2032085E0103052E51B\r
+S31500017A20015055E20130C6E4012042E2FAFFFF5A55\r
+S31500017A300030A0E30030C6E50600A0E1F0AF1BE987\r
+S31500017A407011020004E02DE50A20A0E304E09DE4A4\r
+S31500017A50C8FFFFEA0DC0A0E170D82DE904B04CE2E1\r
+S31500017A600150A0E16DFFFFEB000050E30040A0E1F3\r
+S31500017A7070A81B090130A0E3083085E5381090E5B0\r
+S31500017A80F8609FE5040011E30600A0E13700001A43\r
+S31500017A900430C1E3100053E303F19F972F0000EA7E\r
+S31500017AA0E47A0100447B01004C7B01004C7B010020\r
+S31500017AB0607B0100607B0100607B0100607B01004F\r
+S31500017AC0547B0100607B0100607B0100607B01004B\r
+S31500017AD0607B0100607B0100607B0100607B01002F\r
+S31500017AE0687B010098309FE5002093E5040052E190\r
+S31500017AF090109F050300000A040011E388109F15EA\r
+S31500017B0088109F050100401294FFFFEB80109FE54E\r
+S31500017B1092FFFFEB343094E5000053E330109415E7\r
+S31500017B2024109405C6FFFFEB0C6085E5982094E5CB\r
+S31500017B300030A0E30100A0E3143085E5102085E5BF\r
+S31500017B4070A81BE94C109FE5EEFFFFEA48109FE580\r
+S31500017B50ECFFFFEA44109FE50600A0E1E9FFFFEA1A\r
+S31500017B603C109FE5E7FFFFEA38109FE5F9FFFFEAC2\r
+S31500017B7034109FE579FFFFEB381094E5C3FFFFEA68\r
+S31500017B809C8A02000C8A02008C120200C8080200BC\r
+S31500017B902812020030120200401202004C120200AA\r
+S31500017BA05C120200681202007812020080120200C2\r
+S31500017BB00DC0A0E130D82DE904B04CE20240A0E1AD\r
+S31500017BC016FFFFEB000050E330A81B0994309FE538\r
+S31500017BD0002093E5020050E10000A00330A81B0934\r
+S31500017BE0183090E5000053E30C0090050300A01146\r
+S31500017BF0000050E330A81B0900C0A0E30C3190E758\r
+S31500017C000C3184E701C08CE20A005CE3FAFFFFDA7B\r
+S31500017C102C3090E540E084E22C3084E5302090E57C\r
+S31500017C200050A0E3302084E5341090E517C0A0E3AE\r
+S31500017C30341084E5383090E5383084E53C2090E511\r
+S31500017C403C2084E5403090E5A43084E501C05CE247\r
+S31500017C5004508EE4FCFFFF5A0030A0E30100A0E3CC\r
+S31500017C60A03084E530A81BE90C8A02000DC0A0E112\r
+S31500017C7010D82DE904B04CE20240A0E1E7FEFFEB8B\r
+S31500017C80000050E31F00000A80309FE5002093E5C5\r
+S31500017C90020050E10010A0031800000A183090E518\r
+S31500017CA0000053E30C0090050300A011000050E30F\r
+S31500017CB00020A0131300000A023194E7023180E785\r
+S31500017CC0012082E20A0052E3FAFFFFDA2C2094E552\r
+S31500017CD00110A0E32C2080E5303094E5303080E5BA\r
+S31500017CE0342094E5342080E5383094E5383080E559\r
+S31500017CF03C2094E53C2080E5A43094E5403080E5C5\r
+S31500017D000100A0E110A81BE90010A0E1FBFFFFEABA\r
+S31500017D100C8A02000DC0A0E110D82DE904B04CE296\r
+S31500017D200140A0E1BDFEFFEB000050E310A81B09D6\r
+S31500017D3058309FE5002093E5020050E10000A013B2\r
+S31500017D4010A81B19000054E30500000A40209FE516\r
+S31500017D50003092E5013083E2003082E50100A0E3C4\r
+S31500017D6010A81BE928209FE5003092E5000053E3A7\r
+S31500017D70F9FFFF0A003092E5010053E300309285D6\r
+S31500017D80004082950130438200308285F2FFFFEA8E\r
+S31500017D900C8A0200F42002000DC0A0E110D82DE9E2\r
+S31500017DA02C309FE50010A0E104B04CE2000093E501\r
+S31500017DB020209FE5003092E5013083E2003082E524\r
+S31500017DC0F31100EB0040A0E1272200EB0400A0E143\r
+S31500017DD010A81BE9FC200200F42002000020A0E309\r
+S31500017DE00DC0A0E1020050E100D82DE90010A0E18C\r
+S31500017DF004B04CE200A81B0908309FE5000093E59A\r
+S31500017E00D42100EB00A81BE9FC2002000DC0A0E173\r
+S31500017E1030D82DE9910004E004B04CE20400A0E161\r
+S31500017E20DCFFFFEB000050E30050A0E10420A0E1DD\r
+S31500017E300010A0E39BEEFF1B0500A0E130A81BE9A3\r
+S31500017E400DC0A0E170D82DE9000050E304B04CE26A\r
+S31500017E5004D04DE20050A0E10140A0E11B00000A60\r
+S31500017E60002054E21C304BE20010A0E10200001A8F\r
+S31500017E70D9FFFFEB0400A0E170A81BE958C09FE5FC\r
+S31500017E8000009CE5A02100EB0060A0E1000056E3A4\r
+S31500017E900400A0E10100000A0600A0E170A81BE9A8\r
+S31500017EA0BCFFFFEB000050E30060A0E10510A0E17C\r
+S31500017EB0F8FFFF0A1C201BE5040052E10420A02163\r
+S31500017EC048EEFFEB0500A0E1C3FFFFEBF1FFFFEA80\r
+S31500017ED00100A0E1AFFFFFEB70A81BE9FC20020047\r
+S31500017EE00DC0A0E110D82DE92C20A0E304B04CE28E\r
+S31500017EF02CD04DE20010A0E30040A0E169EEFFEBBB\r
+S31500017F000020A0E30030E0E320204BE58C209FE534\r
+S31500017F1014304BE53C300BE538300BE534300BE5DE\r
+S31500017F2030300BE52C300BE528300BE524300BE522\r
+S31500017F301C300BE518300BE5000092E560209FE54B\r
+S31500017F40003092E5013083E2003082E53C204BE2CD\r
+S31500017F505E10A0E3131400EBC32100EB38301BE5E0\r
+S31500017F600400A0E1000053E3003084C534301BE572\r
+S31500017F70000053E3043084C530301BE5000053E3B1\r
+S31500017F801C3084C52C301BE5000053E3203084C52A\r
+S31500017F9024301BE5000053E3283084C510A81BE9F3\r
+S31500017FA0FC200200F42002000DC0A0E170D82DE9EA\r
+S31500017FB050609FE550309FE5060051E101005003F6\r
+S31500017FC00050A0E10140A0E10F2963E20310A0E106\r
+S31500017FD004B04CE234009FE50030A0E30500000A3E\r
+S31500017FE0060054E10000550320009FE570A81B1907\r
+S31500017FF070681BE9B12100EA14C09FE50FE0A0E11A\r
+S315000180000CF0A0E1F5FFFFEA98B7000068B20200A4\r
+S31500018010D88A0200A006020004E02DE508109FE5BB\r
+S315000180200100A0E304E09DE4DEFFFFEA98B700004B\r
+S3150001803004E02DE508109FE50000A0E304E09DE4BF\r
+S31500018040D8FFFFEA98B700000DC0A0E100D82DE9DE\r
+S315000180500600A0E304B04CE2C02100EBFEFFFFEAFC\r
+S315000180600DC0A0E170D82DE960609FE504B04CE237\r
+S31500018070060051E1010050030CD04DE20050A0E191\r
+S315000180800140A0E148009FE548209FE50A10A0E3D2\r
+S315000180900030A0E30500000A060054E10000550384\r
+S315000180A02C009FE570A81B1970681BE9E9F1FFEA2E\r
+S315000180B024C09FE524E09FE500C08DE502CAA0E348\r
+S315000180C004E08DE508C08DE556F1FFEBF1FFFFEA0F\r
+S315000180D020CB0000ECAE0200B8D1010094120200E0\r
+S315000180E0EC8E020004E02DE508109FE50100A0E3F7\r
+S315000180F004E09DE4D9FFFFEA20CB000004E02DE572\r
+S3150001810008109FE50000A0E304E09DE4D3FFFFEA29\r
+S3150001811020CB00000DC0A0E10E002DE900D82DE90D\r
+S3150001812010B04CE20211E0E304209BE508308BE23B\r
+S31500018130870300EB00A81BE90DC0A0E1F0D82DE9EB\r
+S31500018140E4709FE504B04CE210D04DE2070051E126\r
+S31500018150010050030060A0E10150A0E12200000AE5\r
+S31500018160070055E101005603C0209F05C0309F0559\r
+S3150001817008208305070055E100005603F0A81B19E6\r
+S31500018180A8409FE5043094E5000053E30600001A79\r
+S3150001819098409FE52C0084E27FFBFFEB0C4084E2D4\r
+S315000181A00400A0E1F0681BE9952100EA2C5084E265\r
+S315000181B00500A0E17CFBFFEB000050E3F3FFFF0AA3\r
+S315000181C0043094E5000053E30200001A0500A0E123\r
+S315000181D004FCFFEBEDFFFFEA0400A0E17B0200EBEC\r
+S315000181E00030A0E3043084E5F7FFFFEA0020A0E3B6\r
+S315000181F00230A0E10110A0E338009FE53A0000EB50\r
+S315000182000040A0E30010A0E107C0E0E31C009FE5E9\r
+S315000182100430A0E10120A0E310108DE808408DE5AF\r
+S315000182200C408DE55A0000EBCCFFFFEA22CB0000A3\r
+S315000182308CAF0200042102001C11020004E02DE5AE\r
+S3150001824008109FE50100A0E304E09DE4B9FFFFEA01\r
+S3150001825022CB000004E02DE508109FE50000A0E315\r
+S3150001826004E09DE4B3FFFFEA22CB00000DC0A0E1CC\r
+S3150001827070D82DE938609FE50050A0E1060051E174\r
+S315000182800100500304B04CE20140A0E124009FE547\r
+S315000182900500000A060054E10000550314009FE59D\r
+S315000182A070A81B1970681BE93BFBFFEA21FBFFEB7A\r
+S315000182B0F7FFFFEA20CB0000D0AF020004E02DE576\r
+S315000182C008109FE50100A0E304E09DE4E6FFFFEA54\r
+S315000182D020CB000004E02DE508109FE50000A0E397\r
+S315000182E004E09DE4E0FFFFEA20CB00000DC0A0E121\r
+S315000182F000D82DE904B04CE20C104BE20030A0E3AB\r
+S3150001830004D04DE2043021E511E8FFEB10001BE536\r
+S3150001831000A81BE90DC0A0E1F0DF2DE904B04CE295\r
+S3150001832014D04DE20040A0E110009BE50C909BE5C6\r
+S315000183302C000BE500C0A0E30C0084E20CC084E530\r
+S3150001834010C080E504C080E508C080E50CC080E56A\r
+S315000183500180A0E102A0A0E10910A0E12C201BE50B\r
+S315000183600350A0E1C0009BE9BB0200EB2C0084E2B4\r
+S31500018370F0FAFFEB2CC01BE50400A0E10810A0E118\r
+S315000183800A20A0E10530A0E1C0128BE9F06F1BE9DC\r
+S315000183901F0000EA0DC0A0E1F0DF2DE904B04CE2B8\r
+S315000183A014D04DE20040A0E110009BE50C909BE546\r
+S315000183B02C000BE500C0A0E30C0084E20CC084E5B0\r
+S315000183C010C080E504C080E508C080E50CC080E5EA\r
+S315000183D00180A0E102A0A0E10910A0E12C201BE58B\r
+S315000183E00350A0E1C0009BE99B0200EB2C0084E254\r
+S315000183F0D0FAFFEB2CC01BE50400A0E10810A0E1B8\r
+S315000184000A20A0E10530A0E1C0128BE9F06F1BE95B\r
+S31500018410FFFFFFEA04E02DE502C0A0E1010052E3FF\r
+S315000184200020A0E3041080E5242080E503E0A0E11C\r
+S3150001843008109DE53D00000A370000CA02005CE114\r
+S315000184402430D005023083030200000A1630A0E36F\r
+S31500018450003080E504F09DE42430C0E52420D0E519\r
+S31500018460040012E37F3002120320A0112430C0154C\r
+S31500018470020012E3823CE011A33CE0112430C01556\r
+S315000184800320A01104309DE50920C2E3000053E357\r
+S315000184900830A0130030A003032082E100005EE350\r
+S315000184A0012082130030A0E3040071E3283080E547\r
+S315000184B0003080E52420C0E51500000A0F0000CA3F\r
+S315000184C0080071E3E0FFFF1A6030C2E32430C0E523\r
+S315000184D02430D0E5200013E304F09D040C2080E253\r
+S315000184E0043092E5000053E3083092150030E003B2\r
+S315000184F0010073E304F09D140C30A0E3D3FFFFEAFF\r
+S31500018500020071E3D0FFFF1A203082E34030C3E35B\r
+S31500018510EDFFFFEA603082E3EBFFFFEA02005CE376\r
+S31500018520C9FFFF1A2430D0E5063083E3C9FFFFEA0D\r
+S315000185302430D0E5043083E3C6FFFFEA0DC0A0E195\r
+S31500018540F0DD2DE90040A0E30C6080E210D04DE2A1\r
+S3150001855004B04CE20070A0E10280A0E101A0A0E11C\r
+S315000185600C4080E50210A0E1044086E50320A0E16D\r
+S31500018570084086E50C4086E5104086E50600A0E148\r
+S315000185800350A0E1340200EB2C0087E269FAFFEB0D\r
+S315000185900430A0E101C0E0E30410A0E10700A0E17E\r
+S315000185A00A20A0E104C08DE50C508DE500408DE563\r
+S315000185B008808DE596FFFFEB003097E5040053E157\r
+S315000185C0F0AD1B1904005AE10C3096050830830002\r
+S315000185D00C308605F0AD1B0901005AE31630A013D5\r
+S315000185E000308715F0AD1BE90DC0A0E1F0DD2DE9E6\r
+S315000185F00040A0E30C6080E210D04DE204B04CE2F2\r
+S315000186000070A0E10280A0E101A0A0E10C4080E59C\r
+S315000186100210A0E1044086E50320A0E1084086E5BA\r
+S315000186200C4086E5104086E50600A0E10350A0E176\r
+S31500018630090200EB2C0087E23EFAFFEB0430A0E1D1\r
+S3150001864001C0E0E30410A0E10700A0E10A20A0E1D7\r
+S3150001865004C08DE50C508DE500408DE508808DE563\r
+S315000186606BFFFFEB003097E5040053E1F0AD1B19FA\r
+S3150001867004005AE10C309605083083000C3086055B\r
+S31500018680F0AD1B0901005AE31630A013003087151F\r
+S31500018690F0AD1BE90DC0A0E170D82DE92C6080E298\r
+S315000186A004B04CE208D04DE20040A0E10600A0E192\r
+S315000186B03DFAFFEB000050E30900A00370A81B0977\r
+S315000186C02430D4E5020013E34800000A205013E2E7\r
+S315000186D02B00001A2530D4E5010013E32020840283\r
+S315000186E00130A00320300B051C200B052100001AC8\r
+S315000186F0040094E51C101BE520204BE25DE7FFEB2F\r
+S315000187002430D4E50050A0E1200013E31200000A52\r
+S315000187100C3084E20C2093E520101BE5012082E059\r
+S315000187200C2083E50600A0E1AEFAFFEB000055E35D\r
+S315000187300700001A20301BE5000053E32430D4055E\r
+S315000187402430D415013083030130C3130B50A00329\r
+S315000187502430C4E50500A0E170A81BE92530D4E565\r
+S3150001876020201BE50130C3E3000052E301308313EF\r
+S315000187702530C4E5EAFFFFEA0600A0E199FAFFEB1E\r
+S31500018780F3FFFFEA0400A0E1100100EB2430D4E579\r
+S31500018790000050E3833CE0E1A33CE0E10050A0E1AE\r
+S315000187A02430C4E5F3FFFF1A0400A0E18D1200EBAB\r
+S315000187B0000050E30050A0E1EEFFFF1A0C2084E216\r
+S315000187C0043092E5000053E3081092150010E0030F\r
+S315000187D00C2092E5013083E0035062E0000055E38E\r
+S315000187E01C200BE520500BE5C0FFFF1AE1FFFFEA55\r
+S315000187F00600A0E17BFAFFEB1600A0E370A81BE9D7\r
+S315000188000DC0A0E1F0DD2DE90350A0E12CA080E22E\r
+S315000188100030A0E304B04CE20040A0E1003085E561\r
+S315000188200A00A0E10180A0E10260A0E1DEF9FFEB10\r
+S31500018830000050E30900A003F0AD1B092420D4E594\r
+S31500018840020012E35000000A2232A0E1013003E2E5\r
+S31500018850000056E30030A00301300312000053E389\r
+S315000188600900000A0830D4E5016046E20130C8E497\r
+S31500018870002095E5012082E2002085E52430D4E53B\r
+S315000188801030C3E32430C4E50320A0E1200012E345\r
+S315000188902E00000A800012E32300000A0C7084E215\r
+S315000188A00C2087E20C0092E8033042E0101097E5B5\r
+S315000188B0030056E10360A021000056E30700001AF9\r
+S315000188C0002095E5283094E50A00A0E1023083E016\r
+S315000188D0283084E543FAFFEB0000A0E3F0AD1BE985\r
+S315000188E00620A0E10800A0E1BEEBFFEB043097E50E\r
+S315000188F0041097E5000053E308209715103097E51B\r
+S315000189000020E003063083E0022081E0020053E10B\r
+S31500018910103087E50C10870510108705003095E5A6\r
+S31500018920063083E0003085E5E4FFFFEA0400A0E1BC\r
+S31500018930A60000EB000050E30070A0E1D6FFFF0A9D\r
+S315000189400A00A0E127FAFFEB0700A0E1F0AD1BE961\r
+S315000189502530D4E5013003E2000056E30030A003E0\r
+S3150001896001300312000053E3D4FFFF0A2030D4E59F\r
+S315000189700120A0E30030C8E5002085E52530D4E5D7\r
+S315000189800130C3E32530C4E5CCFFFFEA0A00A0E1CC\r
+S3150001899014FAFFEB1600A0E3F0AD1BE90DC0A0E150\r
+S315000189A0F0D82DE92C5080E204B04CE20040A0E161\r
+S315000189B00500A0E10160A0E17BF9FFEB000050E3B7\r
+S315000189C00070A0E30900A003F0A81B092430D4E538\r
+S315000189D0020013E33F00000A100013E33300001AFC\r
+S315000189E0200013E32500000A800013E31F00000A9C\r
+S315000189F0000057E31700001A0C1084E20C2081E2F4\r
+S31500018A000C0092E8033042E0102091E5000053E3A8\r
+S31500018A101400000A0030D2E50030C6E5042091E5D5\r
+S31500018A20103091E5000052E3040091E5082091150C\r
+S31500018A300020E003013083E2022080E0020053E1DE\r
+S31500018A40103081E50C00810510008105283094E580\r
+S31500018A50013083E2283084E50500A0E1E1F9FFEB6E\r
+S31500018A600700A0E1F0A81BE90B70A0E3F9FFFFEAFC\r
+S31500018A700400A0E1550000EB0070A0E1DBFFFFEA76\r
+S31500018A802530D4E5010013E3F6FFFF0A2030D4E5D3\r
+S31500018A900030C6E52520D4E5283094E50120C2E35F\r
+S31500018AA0013083E2283084E52520C4E5E9FFFFEAA9\r
+S31500018AB00830D4E50500A0E10030C6E52420D4E560\r
+S31500018AC0283094E51020C2E3013083E2283084E5A2\r
+S31500018AD02420C4E5E0FFFFEA0500A0E1C1F9FFEBB0\r
+S31500018AE01600A0E3F0A81BE90DC0A0E1F0D82DE91E\r
+S31500018AF02C5080E204B04CE20040A0E10500A0E168\r
+S31500018B000170A0E128F9FFEB000050E30060A0E34B\r
+S31500018B100900A003F0A81B092430D4E5020013E3E1\r
+S31500018B202600000A200013E32000001A000056E385\r
+S31500018B301500001A2430D4E5833CE0E1A33CE0E1D2\r
+S31500018B40100013E32430C4E50830D4150500A01144\r
+S31500018B500030C7150B00001A200013E30E00000AAF\r
+S31500018B600C3084E20C1083E2060091E8022041E019\r
+S31500018B70100093E5000052E30030D0150400001AFE\r
+S31500018B800B60A0E30500A0E196F9FFEB0600A0E16A\r
+S31500018B90F0A81BE90030C7E5F9FFFFEA2530D4E567\r
+S31500018BA0010013E3F5FFFF0A2030D4E5F8FFFFEAE1\r
+S31500018BB00400A0E1050000EB0060A0E1DAFFFFEA96\r
+S31500018BC00500A0E187F9FFEB1600A0E3F0A81BE979\r
+S31500018BD00DC0A0E170D82DE904B04CE204D04DE2FD\r
+S31500018BE00050A0E32430D0E50040A0E1800013E36B\r
+S31500018BF00500A0E170A81B19040013E30C6084E2D0\r
+S31500018C001600A0E370A81B090C1086E20A0091E881\r
+S31500018C10033041E018204BE2000053E30500A0E1D8\r
+S31500018C20101096E570A81B09040094E5043022E5AE\r
+S31500018C30FDE5FFEB000050E30050A0E128109FE5A1\r
+S31500018C400020A0E10030A0E10400000A043096E50E\r
+S31500018C500500A0E10C3086E5103086E570A81BE919\r
+S31500018C60040094E54EE6FFEBF7FFFFEA0201000080\r
+S31500018C700DC0A0E1F0DF2DE90090A0E304B04CE2C5\r
+S31500018C8010D04DE20060A0E12C0080E2009083E567\r
+S31500018C9003A0A0E134000BE50170A0E10280A0E190\r
+S31500018CA0C1F8FFEB090050E10900A003F0AF1B0971\r
+S31500018CB02430D6E5040013E36300000A800013E3C1\r
+S31500018CC00C508612043095150C308515103085151B\r
+S31500018CD02430D615200013E37F3003E22430C6E5A5\r
+S31500018CE05000000A000058E338900BE53500000AF1\r
+S31500018CF00C5086E2041095E50C3095E5000051E331\r
+S31500018D00082095150020E00330300BE538001BE5FF\r
+S31500018D10021081E00C2095E5003050E20130A013ED\r
+S31500018D20020051E101308303000053E3011062E0C8\r
+S31500018D302F00001A000059E32500001A2430D6E559\r
+S31500018D40010058E10840A0310140A021400013E391\r
+S31500018D500C00000A040059E10920A0E10500002ADF\r
+S31500018D600230D7E70A0053E30200000A012082E23B\r
+S31500018D70040052E1F9FFFF3A040052E10130A01369\r
+S31500018D800140821238300B150710A0E10420A0E142\r
+S31500018D9030001BE593EAFFEB00309AE5048058E0CA\r
+S31500018DA0043083E000308AE50C2095E5047087E005\r
+S31500018DB0042082E00C2085E5283096E5043083E026\r
+S31500018DC0283086E5CAFFFF1A38001BE5000050E38C\r
+S31500018DD00300001A34001BE502F9FFEB0900A0E1CC\r
+S31500018DE0F0AF1BE90600A0E178FFFFEB0090A0E1E0\r
+S31500018DF0F7FFFFEA0600A0E174FFFFEB041095E51B\r
+S31500018E000C3095E5000051E3082095150020E0039C\r
+S31500018E1030300BE5021081E00C2095E50090A0E1D1\r
+S31500018E20011062E0C2FFFFEA28204BE2040096E54A\r
+S31500018E300710A0E1048022E57BE5FFEB2C301BE562\r
+S31500018E400090A0E100308AE5E1FFFFEA34001BE56E\r
+S31500018E50E4F8FFEB1600A0E3F0AF1BE90DC0A0E1BB\r
+S31500018E60000052E370D82DE904B04CE20250A0E1B3\r
+S31500018E700040A0E10160A0E10E00000A003090E58B\r
+S31500018E80000053E30600001A045084E5043094E51B\r
+S31500018E900000A0E3086084E50C3084E5103084E529\r
+S31500018EA070A81BE9040090E5CBFBFFEB0030A0E3C3\r
+S31500018EB0003084E5F3FFFFEA083090E5030051E155\r
+S31500018EC0F1FFFF0A0100A0E1B2FBFFEB000050E356\r
+S31500018ED00050A0E10C00A00370A81B09003094E526\r
+S31500018EE0000053E30200001A0130A0E3280084E8E1\r
+S31500018EF0E5FFFFEA040094E5B7FBFFEBF9FFFFEAA4\r
+S31500018F0010402DE9003092E500C0A0E303005CE1CA\r
+S31500018F1002E0A0E10140A0E1140090E50900002A69\r
+S31500018F200C10D4E7002090E501C08CE20010C2E5E8\r
+S31500018F30003090E500209EE5013083E202005CE10D\r
+S31500018F40003080E5F5FFFF3A00C08EE50000A0E3A2\r
+S31500018F501080BDE80DC0A0E1F0D92DE904B04CE2C6\r
+S31500018F6070D04DE207C0E0E3E4E09FE504C08DE583\r
+S31500018F70E0C09FE50070A0E37C804BE20140A0E1E8\r
+S31500018F800250A0E180000BE50360A0E13C104BE23A\r
+S31500018F900800A0E10730A0E10120A0E33CC00BE5F9\r
+S31500018FA034E00BE580C04BE201EAA0E328C00BE503\r
+S31500018FB024E00BE500708DE538700BE530700BE5AC\r
+S31500018FC02C700BE508708DE50C708DE5F0FCFFEB60\r
+S31500018FD00410A0E10520A0E10630A0E10800A0E10F\r
+S31500018FE0260000EB80301BE50040A0E10070C3E5E0\r
+S31500018FF078301BE550004BE2070053E150504BE23D\r
+S315000190000500001A0500A0E1E3F7FFEB0C0088E27A\r
+S31500019010FB1D00EB0400A0E1F0A91BE9E2F7FFEB61\r
+S31500019020070050E150504B02F5FFFF0A78301BE56F\r
+S315000190300800A0E1070053E10200001A0500A0E1C3\r
+S3150001904068F8FFEBEEFFFFEAE0FEFFEB78700BE559\r
+S31500019050F9FFFFEA24210200A01202000DC0A0E1DF\r
+S315000190600E002DE900D82DE910B04CE20211E0E323\r
+S3150001907004209BE508308BE2000000EB00A81BE909\r
+S315000190800DC0A0E1F0DF2DE904B04CE21DDE4DE29A\r
+S3150001909000C0A0E30280A0E1D8C10BE5B4010BE555\r
+S315000190A0B8110BE5BC310BE5C4C10BE50030D8E5C1\r
+S315000190B00870A0E1004053E20140A013000054E310\r
+S315000190C00800000A250053E3048088E00180480275\r
+S315000190D00400000A0030D8E5004053E20140A01325\r
+S315000190E0000054E3F6FFFF1A075058E0EC03001A9C\r
+S315000190F0C4C11BE5B8E11BE50E005CE10030A0B37D\r
+S315000191000130A0A3000054E3013083D3000053E3F0\r
+S31500019110C501001AC8310BE5010C4BE2C80050E548\r
+S31500019120C0310BE529004BE50110F8E50090E0E3BD\r
+S31500019130CC310BE5DC310BE5FFA001E2018088E2D1\r
+S3150001914020304AE25A0053E303F19F97C80300EA2D\r
+S31500019150BC92010074A0010074A00100DC92010020\r
+S3150001916074A0010074A0010074A0010074A00100A4\r
+S3150001917074A0010074A00100F09201002C9301007B\r
+S3150001918074A00100189301003493010074A001003A\r
+S31500019190B4930100C8930100C8930100C89301006C\r
+S315000191A0C8930100C8930100C8930100C893010048\r
+S315000191B0C8930100C893010074A0010074A00100C6\r
+S315000191C074A0010074A0010074A0010074A0010044\r
+S315000191D074A0010074A0010074A0010074A0010034\r
+S315000191E0F49301002C9E010074A001002C9E010045\r
+S315000191F074A0010074A0010074A0010074A0010014\r
+S31500019200F89B010074A0010074A00100089C0100F4\r
+S3150001921074A0010074A0010074A0010074A00100F3\r
+S3150001922074A00100A49C010074A0010074A00100B7\r
+S31500019230489D010074A0010074A0010074A0010002\r
+S3150001924074A0010074A0010074A0010074A00100C3\r
+S3150001925074A0010074A0010074A00100009E010029\r
+S31500019260009401002C9E01002C9E01002C9E010001\r
+S31500019270D49E01000094010074A0010074A00100B5\r
+S31500019280E89E010074A00100109F0100149C0100DA\r
+S31500019290BC9F0100F49F010074A0010004A001001D\r
+S315000192A074A00100B09C010074A0010074A001002B\r
+S315000192B068A0010074A0010094A0010029305BE5BB\r
+S315000192C0000053E32030A0030100000A0010D8E596\r
+S315000192D098FFFFEA29304BE5FBFFFFEAC0311BE5AA\r
+S315000192E00010D8E5013083E3C0310BE591FFFFEAB9\r
+S315000192F0BC311BE5BCC11BE5003093E504C08CE223\r
+S31500019300000053E3C8310BE5BCC10BE5EEFFFFAA34\r
+S31500019310003063E2C8310BE5C0E11BE50010D8E57A\r
+S3150001932004E08EE3C0E10BE582FFFFEA2B30A0E308\r
+S31500019330E7FFFFEA0130D8E4FFA003E22A005AE37F\r
+S315000193401000000A30304AE2090053E30040A0E36E\r
+S315000193500700008A0110D8E4042184E082208AE013\r
+S31500019360FFA001E230304AE2090053E3304042E215\r
+S31500019370F7FFFF9A0030E0E3030054E10490A0A157\r
+S315000193800390A0B16DFFFFEABC311BE5BC011BE5F3\r
+S31500019390004093E50010D8E50030E0E3040080E2E8\r
+S315000193A0030054E10490A0A10390A0B1BC010BE518\r
+S315000193B060FFFFEAC0211BE50010D8E5802082E3AB\r
+S315000193C0C0210BE55BFFFFEA0040A0E30110D8E4F2\r
+S315000193D0042184E082208AE0FFA001E230304AE2E3\r
+S315000193E0090053E3304042E2C8410B8553FFFF8A2F\r
+S315000193F0F5FFFFEAC0E11BE510E08EE3C0E10BE5F6\r
+S31500019400C0011BE5200010E3E101000ABC311BE5A8\r
+S31500019410600093E8081083E2BC110BE5000056E3F7\r
+S31500019420D60100BA0120A0E3000059E3C0111BA533\r
+S31500019430CC910BE58010C1A3C0110BA5CCC11BE5D6\r
+S31500019440063095E10030A0E30130A01300005CE393\r
+S3150001945001308313010013E32C704BE29901000ADA\r
+S31500019460010052E3AA01000A9B0100CA000052E36F\r
+S315000194708301000A7C7C9FE50700A0E1270600EB3B\r
+S31500019480D4010BE529305BE5D4C11BE5DCE11BE525\r
+S31500019490000053E30E908CE0019089120200001A3D\r
+S315000194A0C0011BE5020010E302908912CC111BE5F5\r
+S315000194B0C0211BE5010059E10910A0A1842012E297\r
+S315000194C0D0110BE5E0210BE52E00001AC8C11BE502\r
+S315000194D00C2061E0000052E3E4210BE5290000DAEB\r
+S315000194E0100052E30240A0E1610100DAB8E11BE598\r
+S315000194F0C4011BE50E6060E0015046E2100055E331\r
+S315000195001050A023F01B9FE5B4011BE50520A0E147\r
+S31500019510063D4BE280510BE5D4FDFFEB000050E325\r
+S31500019520104044E2C000001A80311BE50F0053E3EE\r
+S31500019530CD00009A100054E3F1FFFFCA01C046E2D4\r
+S3150001954004005CE104C0A021AC1B9FE50C20A0E156\r
+S31500019550B4011BE5613F4BE284C10BE5C3FDFFEBA3\r
+S31500019560000050E3B000001A84311BE5040053E10A\r
+S31500019570AA00003AC4C11BE5E4E11BE529305BE51D\r
+S315000195800EC08CE0C4C10BE5FF0013E32301001AF2\r
+S31500019590C0311BE5020013E30401001AE0011BE5DB\r
+S315000195A0800050E3CC00000ACCC11BE50CA069E0A9\r
+S315000195B000005AE3280000DA10005AE30A40A0E14D\r
+S315000195C0C10000DAB8E11BE5C4011BE5669F4BE269\r
+S315000195D00E6060E0015046E2100055E31050A023F2\r
+S315000195E0181B9FE5B4011BE50520A0E10930A0E1A8\r
+S315000195F098510BE59DFDFFEB000050E3104044E25E\r
+S315000196008900001A98311BE50F0053E39600009A72\r
+S31500019610100054E3F1FFFFCA01C046E204005CE119\r
+S3150001962004C0A021D41A9FE50C20A0E1B4011BE5DA\r
+S31500019630673F4BE29CC10BE58CFDFFEB000050E35D\r
+S315000196407900001A9C311BE5040053E17300003ACE\r
+S31500019650C4311BE50A3083E0C4310BE5C4011BE5C7\r
+S31500019660B8E11BE5D4111BE50EC060E001C04CE278\r
+S3150001967001005CE101C0A0210C20A0E10710A0E1DE\r
+S31500019680B4011BE51A3E4BE2A0C10BE577FDFFEBEA\r
+S31500019690000050E36400001AA0311BE5D4211BE54C\r
+S315000196A0020053E18400003AC4311BE5DC411BE5AD\r
+S315000196B0023083E0000054E3C4310BE5230000DAF5\r
+S315000196C0100054E3780000DAB8C11BE5697F4BE26C\r
+S315000196D00C6063E0015046E2100055E31050A023F0\r
+S315000196E0181A9FE5B4011BE50520A0E10730A0E1AA\r
+S315000196F0A4510BE55DFDFFEB000050E3104044E291\r
+S315000197004900001AA4311BE50F0053E36200009AD9\r
+S31500019710100054E3F1FFFFCA01C046E204005CE118\r
+S3150001972004C0A021D4199FE50C20A0E1B4011BE5DA\r
+S315000197306A3F4BE2A8C10BE54CFDFFEB000050E38D\r
+S315000197403900001AA8311BE5040053E14E00003A26\r
+S31500019750C4211BE5C0111BE5DC311BE5040011E347\r
+S31500019760032082E0C4210BE54FFEFF0AC8C11BE5B9\r
+S31500019770D0E11BE50C706EE0000057E34AFEFFDA0C\r
+S31500019780100057E30740A0E13B0000DAB8011BE5F2\r
+S315000197906BAF4BE2006062E0015046E2100055E318\r
+S315000197A01050A02350199FE5B4011BE50520A0E147\r
+S315000197B00A30A0E1AC510BE52CFDFFEB000050E3B4\r
+S315000197C0104044E21800001AAC311BE50F0053E3C8\r
+S315000197D02500009A100054E3F1FFFFCA01C046E2DA\r
+S315000197E004005CE104C0A0210C199FE50C20A0E156\r
+S315000197F0B4011BE51B3E4BE2B0C10BE51BFDFFEBC4\r
+S31500019800000050E30800001AB0311BE5040053E1E3\r
+S31500019810C4311B2507308320C4310B2522FEFF2AC4\r
+S31500019820C4E11BE503E08EE0C4E10BE5B4C11BE531\r
+S315000198302C508CE20500A0E1DBF5FFEB000050E3C4\r
+S315000198400940A0030300001AC4011BE5000054E30C\r
+S315000198500000E013F0AF1BE9B4111BE50500A0E120\r
+S31500019860004091E55FF6FFEBF6FFFFEAC4011BE559\r
+S31500019870030080E0C4010BE5EBFFFFEAB8111BE52D\r
+S31500019880C4211BE5016062E0D3FFFFEAC4111BE5B9\r
+S31500019890031081E0C4110BE5E3FFFFEAC4211BE5D8\r
+S315000198A0032082E0C4210BE5DFFFFFEAB8E11BE5F7\r
+S315000198B0C4011BE50E6060E096FFFFEAC4C11BE52B\r
+S315000198C003C08CE0C4C10BE5D7FFFFEAB8111BE565\r
+S315000198D0C4211BE5016062E04EFFFFEAC8111BE5EA\r
+S315000198E0D0311BE5012063E0000052E3E8210BE5DE\r
+S315000198F02CFFFFDA100052E30240A0E1270000DA54\r
+S31500019900B8C11BE5C4E11BE519AE4BE20C606EE084\r
+S31500019910015046E2100055E31050A023DC179FE5E5\r
+S31500019920B4011BE50520A0E10A30A0E190510BE549\r
+S31500019930CEFCFFEB000050E3104044E2BAFFFF1AF1\r
+S3150001994090311BE50F0053E3D3FFFF9A100054E358\r
+S31500019950F1FFFFCA01C046E204005CE104C0A02198\r
+S3150001996098179FE50C20A0E1B4011BE5653F4BE28A\r
+S3150001997094C10BE5BDFCFFEB000050E3AAFFFF1A03\r
+S3150001998094311BE5040053E1BFFFFF3AC4211BE5F7\r
+S31500019990E8311BE5032082E0C4210BE501FFFFEA64\r
+S315000199A0B8011BE5C4111BE5006061E0E8FFFFEAB1\r
+S315000199B0B8C11BE5C4E11BE53050A0E30C406EE0E5\r
+S315000199C03CC79FE528E04BE2B4011BE5014044E2B8\r
+S315000199D00C50CEE72CE79FE5020054E30240A0239A\r
+S315000199E028C04BE20EA0CCE70420A0E15D1F4BE2AC\r
+S315000199F0633F4BE28C410BE59CFCFFEB000050E31F\r
+S31500019A0089FFFF1A8C311BE5010053E3AAFFFF9A78\r
+S31500019A10C4E11BE502E08EE2C4E10BE5DEFEFFEAEE\r
+S31500019A20B8011BE5C4111BE5623F4BE200C061E0D2\r
+S31500019A3001C04CE201005CE301C0A0230C20A0E1BF\r
+S31500019A40B4011BE529104BE288C10BE587FCFFEB4E\r
+S31500019A50000050E374FFFF1A88311BE5000053E351\r
+S31500019A60C4211B1501208212C4210B15CAFEFF1A3F\r
+S31500019A706DFFFFEAB8111BE5C4211BE5016062E039\r
+S31500019A80ADFEFFEAA531A0E1861E83E1A621A0E194\r
+S31500019A90070005E20260A0E10150A0E1300080E28A\r
+S31500019AA006E095E1010067E5F5FFFF1AC0111BE528\r
+S31500019AB0010011E30300000A300050E33030A01327\r
+S31500019AC00000000A013067E528004BE2003067E03C\r
+S31500019AD0043043E2D4310BE569FEFFEA020052E3AA\r
+S31500019AE063FEFF1A2512A0E1D8C11BE50F2005E28E\r
+S31500019AF0063E81E12642A0E10200DCE70460A0E126\r
+S31500019B000350A0E106E095E1010067E5F4FFFF1AC5\r
+S31500019B10ECFFFFEA000056E31400009A0610A0E1EC\r
+S31500019B200500A0E10030A0E30A20A0E3791000EBD4\r
+S31500019B30300080E2010067E50030A0E30A20A0E3DF\r
+S31500019B400610A0E10500A0E1DD0E00EB0160A0E139\r
+S31500019B500050A0E1000056E3EFFFFF8A0100001A62\r
+S31500019B60090050E3ECFFFF8A303085E2D4FFFFEABB\r
+S31500019B70FCFFFF1A090055E3E7FFFF8AF9FFFFEA39\r
+S31500019B802D30A0E329304BE5005075E20060E6E296\r
+S31500019B9023FEFFEAC0211BE5100012E30F00001AA5\r
+S31500019BA0C0C11BE540001CE30500000ABC311BE5F2\r
+S31500019BB0F050D3E104E083E2C56FA0E1BCE10BE51F\r
+S31500019BC015FEFFEAC0011BE5020C10E3BC311B15B3\r
+S31500019BD00410831200209315BC110B150200001A04\r
+S31500019BE0BC311BE5042093E4BC310BE50250A0E136\r
+S31500019BF0C56FA0E108FEFFEAC0311BE50010D8E5FC\r
+S31500019C00083083E3B7FDFFEAC0E11BE510E08EE310\r
+S31500019C10C0E10BE5C0011BE5200010E30700000AC7\r
+S31500019C20BC311BE5600093E8081083E2BC110BE52B\r
+S31500019C300020A0E30030A0E329304BE5F9FDFFEA5F\r
+S31500019C40C0211BE5100012E30F00001AC0C11BE57D\r
+S31500019C5040001CE30500000ABC311BE5B050D3E10E\r
+S31500019C6004E083E20060A0E3BCE10BE5EFFFFFEA5D\r
+S31500019C70C0011BE5020C10E3BC311B150410831255\r
+S31500019C8000209315BC110B150200001ABC311BE50F\r
+S31500019C90042093E4BC310BE50250A0E10060A0E38F\r
+S31500019CA0E2FFFFEAC0211BE5102082E3C0210BE59C\r
+S31500019CB0C0311BE5200013E30500000ABC311BE59A\r
+S31500019CC0600093E808C083E2BCC10BE50120A0E374\r
+S31500019CD0D7FFFFEAC0E11BE510001EE3BC311B15EF\r
+S31500019CE00400831200209315BC010B151200001A03\r
+S31500019CF0C0111BE5400011E30500000ABC311BE55C\r
+S31500019D00B050D3E1042083E20060A0E3BC210BE55F\r
+S31500019D10EDFFFFEAC0311BE5020C13E3BC311B1555\r
+S31500019D20BC311B0504C0831204E083020020931595\r
+S31500019D3000209305BCC10B15BCE10B050250A0E147\r
+S31500019D400060A0E3E0FFFFEABC039FE5D8010BE555\r
+S31500019D50C0211BE5200012E30B00000ABC311BE504\r
+S31500019D60600093E8083083E2BC310BE5C0E11BE5F6\r
+S31500019D700220A0E301001EE3ADFFFF0A060095E104\r
+S31500019D8002E08E11C0E10B15A9FFFFEAC0C11BE578\r
+S31500019D9010001CE3BC311B1504E08312002093154F\r
+S31500019DA0BCE10B151200001AC0011BE5400010E3CF\r
+S31500019DB00500000ABC311BE5B050D3E1041083E273\r
+S31500019DC00060A0E3BC110BE5E7FFFFEAC0211BE53C\r
+S31500019DD0020C12E3BC311B15BC311B050020931587\r
+S31500019DE004C083020430831200209305BC310B1595\r
+S31500019DF0BCC10B050250A0E10060A0E3DAFFFFEA57\r
+S31500019E00BC311BE5177E4BE20020D3E501C0A0E380\r
+S31500019E10043083E2BC310BE5D4C10BE50020C7E574\r
+S31500019E200030A0E329304BE595FDFFEABC311BE587\r
+S31500019E300F0059E308C083E2030093E8BCC10BE5B8\r
+S31500019E40200000DA67005AE347005A130200001A9D\r
+S31500019E50C0E11BE501001EE30100000A0F9049E283\r
+S31500019E60DC910BE50F90A0E3177E4BE20030A0E3F7\r
+S31500019E700030C7E5534FE0E328304BE204E083E0CE\r
+S31500019E802CC04BE2C0311BE50920A0E10CC08DE5D9\r
+S31500019E9008708DE500E08DE504A08DE5150100EB68\r
+S31500019EA028C04BE2D4010BE50430DCE7000053E3A4\r
+S31500019EB02D30A01329304B150030D7E5000053E3B0\r
+S31500019EC0017087026EFDFFEA010079E30690A003A7\r
+S31500019ED0E4FFFFEAC0C11BE50010D8E540C08CE3F2\r
+S31500019EE0C0C10BE593FCFFEA0010D8E56C0051E315\r
+S31500019EF0C0011B1510008013C0010B158DFCFF1A44\r
+S31500019F00C0E11BE50110F8E520E08EE304FDFFEA60\r
+S31500019F10C0E11BE520001EE31D00001AC0E11BE5A0\r
+S31500019F2010001EE30B00001AC0211BE5400012E3DE\r
+S31500019F300F00001AC0E11BE5020C1EE30500001A22\r
+S31500019F40BC311BE5C4C11BE5042093E4BC310BE520\r
+S31500019F5000C082E554FCFFEABC311BE5C4111BE5D8\r
+S31500019F60002093E5040083E2BC010BE5001082E5C5\r
+S31500019F704DFCFFEABC311BE501CC4BE2002093E529\r
+S31500019F80B4CC5CE1043083E2BC310BE5B0C0C2E184\r
+S31500019F9045FCFFEABC311BE5BCC11BE5000093E5AE\r
+S31500019FA0C4311BE504C08CE20310A0E1C12FA0E17E\r
+S31500019FB0BCC10BE5060080E83BFCFFEABC311BE5B2\r
+S31500019FC0C0011BE5002093E540C19FE50250A0E1D9\r
+S31500019FD00060A0E30220A0E304E083E2020080E146\r
+S31500019FE078A0A0E3D8C10BE5BCE10BE5C0010BE508\r
+S31500019FF00FFFFFEAC0211BE50010D8E5202082E310\r
+S3150001A000EEFCFFEABC311BE5007093E5041083E228\r
+S3150001A010FC309FE5000057E30370A001000059E3FF\r
+S3150001A020BC110BE50B0000BA0700A0E10010A0E38C\r
+S3150001A0300920A0E1F80200EB000050E30300000A4A\r
+S3150001A040000067E0090050E1D4010BE573FFFFDA78\r
+S3150001A050D4910BE571FFFFEA0700A0E12F0300EBA6\r
+S3150001A060D4010BE56DFFFFEAA0109FE5D8110BE5C2\r
+S3150001A07036FFFFEA00005AE3EBFDFF0A0030A0E3DA\r
+S3150001A080177E4BE200A0C7E529304BE5013083E29C\r
+S3150001A0908FFEFFEAC0211BE50010D8E5022C82E302\r
+S3150001A0A0C6FCFFEAC4011BE5B8E11BE50710A0E108\r
+S3150001A0B00EC060E001C04CE205005CE105C0A021D4\r
+S3150001A0C00C20A0E1B4011BE55F3F4BE27CC10BE52F\r
+S3150001A0D0E6FAFFEB000050E3D3FDFF1A7C311BE5E6\r
+S3150001A0E0050053E1C4211B2505208220C4210B252F\r
+S3150001A0F0FEFBFF2AE4FDFFEAA8120200402102004E\r
+S3150001A10050210200B4FEFFFFB5FEFFFF70110200F1\r
+S3150001A11090110200C41202000DC0A0E1F0DD2DE98C\r
+S3150001A12004B04CE208D04DE20280A0E10350A0E168\r
+S3150001A130412F8FE20C0092E80170A0E10060A0E1DE\r
+S3150001A1409D1300EB000050E304409BE50CA09BE54A\r
+S3150001A1500800DBE53000001A300040E2321400EB63\r
+S3150001A16030304BE2030083E930C04BE2D0208FE26E\r
+S3150001A1700C0092E803009CE9B61300EB000050E3E3\r
+S3150001A180170000DA3010A0E30020D4E52E0052E3D8\r
+S3150001A19001207405012082E2FF3002E2390053E317\r
+S3150001A1A00020C4E50C00009A050054E1011044E4C6\r
+S3150001A1B0F4FFFF1A000058E33130A00301304505D2\r
+S3150001A1C0015045020400000A3120A0E30020C5E544\r
+S3150001A1D0003098E5013083E2003088E50500A0E112\r
+S3150001A1E0F0AD1BE90030DAE52D0053E3FAFFFF1A63\r
+S3150001A1F00010A0E30020D4E52E0052E301207405EF\r
+S3150001A200FF3002E2300053E3F3FFFF1A050054E189\r
+S3150001A210014044E20010CA05F5FFFFEA28208FE25B\r
+S3150001A2200C0092E80710A0E10600A0E1631100EB23\r
+S3150001A2302C204BE2EE0200EBCAFFFFEA0000000011\r
+S3150001A2400000000000001040000000000000244053\r
+S3150001A2500000000010402DE9000051E30120C0E498\r
+S3150001A2602D30A0B32B30A0A301C0A0E100C061B284\r
+S3150001A2700130C0B40130C0A409005CE33030A0D382\r
+S3150001A2804DDF4DE20130C0D403208CD04DEF8DE27D\r
+S3150001A2900120C0D4140000DA54409FE5942CC3E099\r
+S3150001A2A0CC2FA0E1432162E0021182E081104CE053\r
+S3150001A2B0301081E2090052E302C0A0E101106EE50F\r
+S3150001A2C0F5FFFFCA303082E201306EE54D3F8DE287\r
+S3150001A2D003005EE10400002A0130DEE44D2F8DE229\r
+S3150001A2E002005EE10130C0E4FAFFFF3A4DDF8DE284\r
+S3150001A2F01080BDE8676666660DC0A0E1F0DF2DE956\r
+S3150001A30004B04CE22CD04DE20280A0E104209BE592\r
+S3150001A3100150A0E10040A0E1000050E30040A0E3AD\r
+S3150001A32040300BE50170A0E10060A0E10040C2E50C\r
+S3150001A330050000AA281400EB04C09BE52D30A0E31C\r
+S3150001A3400170A0E10060A0E10030CCE50710A0E1BA\r
+S3150001A3500600A0E1950200EB000050E30E02000AA0\r
+S3150001A3600C309BE50710A0E10600A0E1013083E275\r
+S3150001A37030204BE248400BE50C308BE53C400BE5C9\r
+S3150001A3809B0200EB10C09BE50C709BE501A0A0E1D0\r
+S3150001A3900090A0E101604CE230104BE2300091E800\r
+S3150001A3A09F2F8FE20C0092E80510A0E10400A0E1C6\r
+S3150001A3B0011300EB00C0A0E100005CE3252E8FE253\r
+S3150001A3C00C0092E80510A0E10400A0E11100000ACA\r
+S3150001A3D00F1200EB30204BE2850200EB38C04BE256\r
+S3150001A3E003008CE8222E8FE20C0092E8AE1000EBFF\r
+S3150001A3F0872F8FE20C0092E8F01000EBBA1300EB06\r
+S3150001A4003C301BE5300080E2014083E2010046E476\r
+S3150001A4103C400BE5DFFFFFEA08209BE5453042E2C1\r
+S3150001A420220053E303F19F97680000EA2CA601007E\r
+S3150001A430D0A5010038A90100D0A50100D0A50100D1\r
+S3150001A440D0A50100D0A50100D0A50100D0A501002D\r
+S3150001A450D0A50100D0A50100D0A50100D0A501001D\r
+S3150001A460D0A50100D0A50100D0A50100D0A501000D\r
+S3150001A470D0A50100D0A50100D0A50100D0A50100FD\r
+S3150001A480D0A50100D0A50100D0A50100D0A50100ED\r
+S3150001A490D0A50100D0A50100D0A50100D0A50100DD\r
+S3150001A4A0D0A50100D0A50100D0A501002CA6010070\r
+S3150001A4B0B8A4010038A901003C301BE5000053E3B4\r
+S3150001A4C00C709B053030A0030130C7040800000A58\r
+S3150001A4D010309BE5016086E2030056E10400002A84\r
+S3150001A4E00130D6E410C09BE50130C7E40C0056E10B\r
+S3150001A4F0FAFFFF3A000058E30200001A40101BE57C\r
+S3150001A500010011E30100000A2E30A0E30130C7E487\r
+S3150001A510432F8FE20C0092E80A10A0E10900A0E1A6\r
+S3150001A520A51200EB000050E32000000A000058E3EA\r
+S3150001A5301700000A38504BE2D4208FE20C0092E853\r
+S3150001A5400A10A0E10900A0E19C1000EB0520A0E1A2\r
+S3150001A550270200EB01A0A0E10090A0E1030095E82D\r
+S3150001A560611300EB00C0A0E130C08CE2018058E22B\r
+S3150001A570AC208FE20C0092E80A10A0E10900A0E1EC\r
+S3150001A58001C0C7E40200000A8B1200EB000050E391\r
+S3150001A590E8FFFF1A88208FE20C0092E80A10A0E17A\r
+S3150001A5A00900A0E1841200EB000050E30A00001A42\r
+S3150001A5B0018048E2010078E30400000A3030A0E39C\r
+S3150001A5C0018048E2010078E30130C7E4FBFFFF1A8E\r
+S3150001A5D00C109BE5070061E0F0AF1BE901C047E203\r
+S3150001A5E00040A0E300C08DE504C09BE50A10A0E190\r
+S3150001A5F00900A0E10420A0E10C309BE510108DE9D3\r
+S3150001A600C4FEFFEB0C008BE5E8FFFFEAE17A843F2D\r
+S3150001A6107B14AE470000244000000000E2361A3FDA\r
+S3150001A6202D431CEB00000000000000003C401BE530\r
+S3150001A630000054E38600000A0130F6E50C709BE544\r
+S3150001A640000058E30130C7E40200001A40101BE580\r
+S3150001A650010011E30300000A0C209BE52E30A0E364\r
+S3150001A6600130C2E5017087E2000058E30D00000ADF\r
+S3150001A67010309BE5016086E2030056E10700002ADF\r
+S3150001A6800030D6E5018058E20130C7E40500000A32\r
+S3150001A69010C09BE5016086E20C0056E1F7FFFF3A28\r
+S3150001A6A0000058E30300001A10109BE5016086E2E2\r
+S3150001A6B0010056E15700003A3C301BE5014043E2F8\r
+S3150001A6C03C400BE5A8204FE20C0092E80A10A0E1FD\r
+S3150001A6D00900A0E1381200EB000050E32000000A57\r
+S3150001A6E0000058E31700000A38504BE2E0204FE221\r
+S3150001A6F00C0092E80A10A0E10900A0E12F1000EB7E\r
+S3150001A7000520A0E1BA0100EB01A0A0E10090A0E1C3\r
+S3150001A710030095E8F41200EB00C0A0E130C08CE222\r
+S3150001A720018058E2422F4FE20C0092E80A10A0E1A4\r
+S3150001A7300900A0E101C0C7E40200000A1E1200EBF5\r
+S3150001A740000050E3E8FFFF1A4B2F4FE20C0092E89E\r
+S3150001A7500A10A0E10900A0E1171200EB000050E386\r
+S3150001A7601F00001A018048E2010078E30400000A94\r
+S3150001A7703030A0E3018048E2010078E30130C7E40C\r
+S3150001A780FBFFFF1A48101BE5000051E30E00000A0B\r
+S3150001A79040201BE5013022E2010013E30A00000A12\r
+S3150001A7A00C309BE5030057E10030D7950200009A73\r
+S3150001A7B0013077E5300053E3F8FFFF0AFF3003E28B\r
+S3150001A7C02E0053E301704702017087E20700A0E102\r
+S3150001A7D03C101BE508209BE59DFEFFEB0070A0E108\r
+S3150001A7E07AFFFFEA01C047E200C08DE504C09BE5A0\r
+S3150001A7F000E0A0E30A10A0E10900A0E13C204BE241\r
+S3150001A8000C309BE504E08DE508C08DE541FEFFEBCC\r
+S3150001A8100C008BE5D2FFFFEA01C047E2029C4FE242\r
+S3150001A820000699E800E0D6E500C08DE504C09BE589\r
+S3150001A8303C204BE20C309BE50A10A0E10900A0E1A7\r
+S3150001A84004E08DE508C08DE532FEFFEB0C008BE5DB\r
+S3150001A85098FFFFEA8E2F4FE20C0092E80A10A0E162\r
+S3150001A8600900A0E1D41100EB000050E32400000A26\r
+S3150001A8700040E0E338504BE23C400BE50560A0E1C7\r
+S3150001A8809D2F4FE20C0092E80A10A0E10900A0E119\r
+S3150001A890CA0F00EB0520A0E1550100EB0A2D4FE29E\r
+S3150001A8A00C0092E801A0A0E10090A0E1030095E868\r
+S3150001A8B0C11100EB000050E33C301B05014043028F\r
+S3150001A8C03C400B05EDFFFF0A030096E8861200EBFC\r
+S3150001A8D00C709BE5300080E2000058E30100C7E4FC\r
+S3150001A8E00200001A40101BE5010011E374FFFF0A84\r
+S3150001A8F00C209BE52E30A0E3017087E20130C2E512\r
+S3150001A9006FFFFFEA0C709BE53030A0E3000058E3CF\r
+S3150001A9100130C7E40200001A40301BE5010013E3D1\r
+S3150001A92067FFFF0A0CC09BE52E30A0E30130CCE5A2\r
+S3150001A930017087E262FFFFEA000058E33C501BE525\r
+S3150001A94001808802080055E10540A0E18B0000CA9C\r
+S3150001A950000055E31200001ACF2F4FE20C0092E8D7\r
+S3150001A9600A10A0E10900A0E1931100EB000050E3F9\r
+S3150001A9700600000A0A10A0E10900A0E1DA2F4FE261\r
+S3150001A9800C0092E8011200EB000050E37B0000BAD4\r
+S3150001A990000055E30C709B053030A0030130C7045D\r
+S3150001A9A00900000A10209BE5016086E2020056E1DB\r
+S3150001A9B00500002A0130D6E410C09BE5018048E27B\r
+S3150001A9C00C0056E10130C7E4F9FFFF3A000058E3F5\r
+S3150001A9D040201B15016002120300001A40101BE5FE\r
+S3150001A9E0016011E244800B050300000A2E30A0E34A\r
+S3150001A9F00130C7E42D3043E244300BE53E2E4FE2F1\r
+S3150001AA000C0092E80A10A0E10900A0E16A1100EB2E\r
+S3150001AA10000050E33400000A000058E32B00000A4E\r
+S3150001AA2038504BE21E2E8FE20C0092E80A10A0E18C\r
+S3150001AA300900A0E1610F00EB0520A0E1EC0000EBAD\r
+S3150001AA4001A0A0E10090A0E1030095E8261200EB29\r
+S3150001AA50300080E20100C7E4030095E81B2E8FE277\r
+S3150001AA600C0092E82D1100EB000050E3ECFFFF0A09\r
+S3150001AA70018058E2662F8FE20C0092E80A10A0E1ED\r
+S3150001AA800900A0E11100000A4B1100EB00C0A0E192\r
+S3150001AA9000005CE3172E8FE20C0092E80A10A0E199\r
+S3150001AAA00900A0E10900000A440F00EB0520A0E11E\r
+S3150001AAB0CF0000EB01A0A0E10090A0E1030095E822\r
+S3150001AAC0091200EB300080E20100C7E4E7FFFFEA6C\r
+S3150001AAD04F2F8FE20C0092E80A10A0E10900A0E1D5\r
+S3150001AAE0351100EB000050E31800001A000056E390\r
+S3150001AAF00800000A018048E2010078E3B3FEFF0A7C\r
+S3150001AB003030A0E3018048E2010078E30130C7E478\r
+S3150001AB10FBFFFF1AADFEFFEA44101BE5000051E3FF\r
+S3150001AB20AAFEFF0A0C209BE5020057E10030D795EB\r
+S3150001AB300200009A013077E5300053E3F8FFFF0A7F\r
+S3150001AB40FF3003E22E0053E3017087129FFEFFEAF6\r
+S3150001AB5001C047E20040A0E300C08DE504C09BE5CB\r
+S3150001AB600A10A0E10900A0E10420A0E10C309BE558\r
+S3150001AB7010108DE967FDFFEB0C008BE5DAFFFFEAAC\r
+S3150001AB8008C09BE50110A0E302C04CE2018048E247\r
+S3150001AB9008C08BE548100BE5A4FEFFEA08C09BE55B\r
+S3150001ABA00710A0E10600A0E165304CE2020053E384\r
+S3150001ABB02040A0930040A083810000EB000050E3F9\r
+S3150001ABC00800000A0C709BE54E2084E20120C7E4D0\r
+S3150001ABD00C109BE5413084E2017087E20130C1E54A\r
+S3150001ABE00120C7E479FEFFEA0C709BE5493084E257\r
+S3150001ABF00130C7E40CC09BE54E3084E2462084E276\r
+S3150001AC00017087E20130CCE5F4FFFFEA0000244041\r
+S3150001AC10000000000000000000000000030052E3F5\r
+S3150001AC2070402DE902C0A0E1FF1001E20400009A84\r
+S3150001AC30033010E20320A00100E0A0010340A001BF\r
+S3150001AC400B00000A01C04CE201007CE30600000A89\r
+S3150001AC500030D0E501C04CE2010053E17080BD082F\r
+S3150001AC6001007CE3010080E2F8FFFF1A0000A0E387\r
+S3150001AC707080BDE8012082E2030052E3044481E0D2\r
+S3150001AC80FBFFFF9A04005CE31600009A84309FE5FF\r
+S3150001AC9084209FE5006093E5005092E500209EE543\r
+S3150001ACA0042022E0023066E00230C3E1050013E130\r
+S3150001ACB00800000A0E00A0E10020A0E30030D0E564\r
+S3150001ACC0012082E2010053E17080BD08030052E3D6\r
+S3150001ACD0010080E2F8FFFF9A04C04CE204005CE345\r
+S3150001ACE004E08EE2ECFFFF8A01C04CE201007CE346\r
+S3150001ACF00E00A0E1DCFFFF0A0030D0E501C04CE206\r
+S3150001AD00010053E17080BD0801007CE3010080E28F\r
+S3150001AD10F8FFFF1AD4FFFFEACC120200D412020098\r
+S3150001AD20030010E304E02DE500E0A0E10700000ABE\r
+S3150001AD300030D0E5000053E30200000A0130F0E5DF\r
+S3150001AD40000053E3FCFFFF1A00006EE004F09DE4EF\r
+S3150001AD5050309FE5001090E500C093E548209FE53F\r
+S3150001AD6001306CE0002092E50130C3E1020013E1FD\r
+S3150001AD700500001A0210A0E10420B0E502306CE0E3\r
+S3150001AD800230C3E1010013E1FAFFFF0A0030D0E50A\r
+S3150001AD90000053E3EBFFFF0A0130F0E5000053E347\r
+S3150001ADA0FCFFFF1AE7FFFFEACC120200D4120200F1\r
+S3150001ADB00201C0E3020180E2010680E2A00FA0E1E8\r
+S3150001ADC00EF0A0E108D04DE203008DE809009DE8F0\r
+S3150001ADD0002063E2023083E10201C0E3A30F80E1B8\r
+S3150001ADE07F0460E20F0680E2A00FA0E108D08DE2A9\r
+S3150001ADF00EF0A0E10DC0A0E170D82DE904B04CE23F\r
+S3150001AE0020304BE208D04DE20260A0E1030083E866\r
+S3150001AE1020C01BE5D8309FE51CE01BE54C3A03E05A\r
+S3150001AE20FF3F43E2033043E2130053E31E0000CA2F\r
+S3150001AE30000053E3160000BAB8209FE55223A0E1B3\r
+S3150001AE4002300CE00EE093E102310C0220300B05DA\r
+S3150001AE501CE00B050A00000A0230CCE10020A0E349\r
+S3150001AE60003086E5042086E50C0096E8260E00EB08\r
+S3150001AE700150A0E10040A0E10510A0E10400A0E11D\r
+S3150001AE8070A81BE920304BE2300093E8030086E806\r
+S3150001AE90F8FFFFEA02210CE20030A0E30150A0E135\r
+S3150001AEA00040A0E10C0086E8F2FFFFEA330053E31D\r
+S3150001AEB002310CC20020A0C320300BC51C200BC5DB\r
+S3150001AEC0EFFFFFCA142043E20030E0E33322A0E1A2\r
+S3150001AED002401EE00230CE1100C0861504308615F0\r
+S3150001AEE0E0FFFF1A02310CE220300BE51C400BE5B6\r
+S3150001AEF0E3FFFFEAFF070000FFFF0F000C309FE5AD\r
+S3150001AF00002093E5000093E5880080E20EF0A0E1C1\r
+S3150001AF100C8A02000DC0A0E100D82DE904B04CE274\r
+S3150001AF2030C09FE50020A0E100309CE50010A0E1C3\r
+S3150001AF30000053E3440090050400000A440090E534\r
+S3150001AF40040050E300309C053C30820500A81B0933\r
+S3150001AF50ADE9FFEB00A81BE960B202000EF0A0E12B\r
+S3150001AF600DC0A0E130D82DE924309FE524409FE5AE\r
+S3150001AF7004B04CE2030054E130A81B390350A0E1B0\r
+S3150001AF800FE0A0E104F014E4050054E130A81B39F8\r
+S3150001AF90FAFFFFEA08220200382202000000A0E3BD\r
+S3150001AFA00EF0A0E10020A0E10000A0E35230A0E1F4\r
+S3150001AFB0010013E30EF0A011010080E21F0050E32F\r
+S3150001AFC00000E0C30EF0A0C1F7FFFFEA0020A0E1F8\r
+S3150001AFD01F00A0E35230A0E1010013E30EF0A0111F\r
+S3150001AFE0010050E20000E0430EF0A041F8FFFFEA45\r
+S3150001AFF014C04DE200602CE90CD0A0E1FF1F2DE941\r
+S3150001B00000200FE140208DE500D081E500B090E5FC\r
+S3150001B01000000FE1C00080E300F029E140009BE55C\r
+S3150001B02000F069E1FF7F9BE80EF0B0E1F07F80E878\r
+S3150001B0300000A0E30EF0A0E1F07F90E80100A0E19E\r
+S3150001B0400EF0A0E10DC0A0E100D82DE904B04CE25C\r
+S3150001B050520000EB00681BE91CDCFFEA00100FE15F\r
+S3150001B0601F10C1E3131081E301F029E10010A0E3F1\r
+S3150001B070171F07EE9A1F07EE171F08EE101F11EE96\r
+S3150001B080011AC1E30710C1E3101F01EE0000A0E1A0\r
+S3150001B09000F0A0E1FEFFFFEA2C309FE52CC09FE502\r
+S3150001B0A02C209FE50311A0E3001083E50030A0E307\r
+S3150001B0B0000082E500308CE518209FE518309FE5F9\r
+S3150001B0C0002083E500008CE50EF0A0E108800680F3\r
+S3150001B0D030800680E4AF0200CC400000208006806C\r
+S3150001B0E01C309FE51C209FE50209A0E3000083E5D3\r
+S3150001B0F0001082E54231A0E30110A0E3001083E5D0\r
+S3150001B1000EF0A0E128800680E4AF020014309FE52E\r
+S3150001B11014209FE5B210D3E1003092E5033061E0DF\r
+S3150001B120003080E50EF0A0E130800680E4AF020039\r
+S3150001B1300DC0A0E170D82DE9803080E004B04CE26A\r
+S3150001B14008D04DE28351A0E11C004BE2EEFFFFEB7C\r
+S3150001B150000055E30040A0E370A81B9920604BE274\r
+S3150001B1600600A0E1E8FFFFEB20001BE51C101BE534\r
+S3150001B170010050E120209F350030612000309235DA\r
+S3150001B1801C000BE50330613000308330034084E05E\r
+S3150001B190040055E170A81B99F0FFFFEAE4AF020035\r
+S3150001B1A00DC0A0E110D82DE904B04CE20040A0E3A7\r
+S3150001B1B00400A0E1014084E2100000EB3F0054E3EB\r
+S3150001B1C010A81BC9F9FFFFEA2C209FE502C1A0E3E5\r
+S3150001B1D0001092E54000A0E3000051E300309C0519\r
+S3150001B1E00030A013C32FA001223F83004301A00119\r
+S3150001B1F00030821500108C050EF0A0E160210200DE\r
+S3150001B200C01FA0E1211F80E04111A0E1010140E042\r
+S3150001B2108001A0E10430A0E308209FE51330A0E1FE\r
+S3150001B220013282E70EF0A0E168000080C01FA0E1B4\r
+S3150001B230211F80E04111A0E1010140E08001A0E170\r
+S3150001B2400430A0E308209FE51330A0E1013282E734\r
+S3150001B2500EF0A0E1640000800EF0A0E10EF0A0E186\r
+S3150001B2600EF0A0E10EF0A0E104402DE50030A0E3D0\r
+S3150001B270003080E50040A0E30030A0E30C1080E53B\r
+S3150001B280180080E91000BDE80EF0A0E104402DE5AC\r
+S3150001B2900030A0E3003080E50040A0E30030A0E3E9\r
+S3150001B2A00C1080E5180080E91000BDE80EF0A0E161\r
+S3150001B2B0003090E504E02DE5000053E304F09D0421\r
+S3150001B2C000E0A0E3001053E204F09D0400C091E504\r
+S3150001B2D001005CE1043091150E10A00104308C15BB\r
+S3150001B2E0042091150410811500C0821500108115E6\r
+S3150001B2F00C10A01100E0800500C08015000051E38C\r
+S3150001B30004F09D04F0FFFFEA003090E504E02DE52E\r
+S3150001B310000053E304F09D0400E0A0E3001053E2B3\r
+S3150001B32004F09D0400C091E501005CE10430911533\r
+S3150001B3300E10A00104308C150420911504108115FE\r
+S3150001B34000C08215001081150C10A01100E08005C7\r
+S3150001B35000C08015000051E304F09D04F0FFFFEAF0\r
+S3150001B3600DC0A0E1F0D82DE9017041E2010077E3BB\r
+S3150001B37004B04CE20060A0E1F0A81B095C219FE546\r
+S3150001B380003092E5013083E2003082E5060096E95D\r
+S3150001B3900C0096E5003091E00040A2E2180086E933\r
+S3150001B3A0000096E500E0A0E3005050E21300000A19\r
+S3150001B3B014C085E2083096E504209CE5001095E569\r
+S3150001B3C0030052E10600008A083096E5030052E1C7\r
+S3150001B3D01A00001A042096E5143095E5020053E19F\r
+S3150001B3E01500009A000051E11100000A010055E123\r
+S3150001B3F00150A0E10E00000A000055E3EBFFFF1A21\r
+S3150001B40000005EE3E5FFFF1AD0209FE5003092E5DC\r
+S3150001B410010053E2000082150300000A017047E2B1\r
+S3150001B420010077E3F0A81B09D3FFFFEA43EBFFEB2B\r
+S3150001B430F9FFFFEA0050A0E3EEFFFFEA043096E5CC\r
+S3150001B440000055E104309515043081150420951549\r
+S3150001B4500450851500108215005085151400000A48\r
+S3150001B4601C1085E21C0095E5043091E5030090E18E\r
+S3150001B4700600001A240085E5101095E50500A0E1F7\r
+S3150001B4800FE0A0E10CF095E501E0A0E3DBFFFFEAA8\r
+S3150001B490060091E818009CE80600A0E1013093E05F\r
+S3150001B4A00240A4E018008CE80510A0E10C0000EBB6\r
+S3150001B4B0F0FFFFEA050051E1043095150030A003C5\r
+S3150001B4C0043081150420951500308605001082157B\r
+S3150001B4D0045085150050851500108615DFFFFFEA1B\r
+S3150001B4E0F42002000DC0A0E1F0D82DE90130A0E35F\r
+S3150001B4F0243081E5147081E2042097E5083090E557\r
+S3150001B50004B04CE2030052E10150A0E10060A0E169\r
+S3150001B5101800008A083090E5030052E11F00000A76\r
+S3150001B520101095E50500A0E10FE0A0E10CF095E50E\r
+S3150001B5301C1085E21C2095E5043091E5032092E17B\r
+S3150001B5400200000A243095E5000053E30200001AC8\r
+S3150001B5500030A0E3243085E5F0A81BE9180097E840\r
+S3150001B560060091E80500A0E1013093E00240A4E065\r
+S3150001B570180087E8E40200EB001096E5000051E3AD\r
+S3150001B5800430911500108515043085150420911598\r
+S3150001B590005086050450811500508215F0A81BE95C\r
+S3150001B5A0142091E5043090E5030052E1F1FFFF8A92\r
+S3150001B5B0043090E5D9FFFFEA003090E501C0A0E133\r
+S3150001B5C0030051E1003091150420911504208315E3\r
+S3150001B5D00410911504C08C150030811500C08C151E\r
+S3150001B5E00200000A0030A0E324308CE50EF0A0E151\r
+S3150001B5F0000051E3FAFFFF0A001091E50C0051E14A\r
+S3150001B60004309C150030A0030430811504209C15DC\r
+S3150001B610003080050010821504C08C1500C08C1501\r
+S3150001B62000108015EEFFFFEA0DC0A0E170D82DE9EC\r
+S3150001B6300260A0E10150A0E104B04CE20110A0E3D8\r
+S3150001B6400040A0E107FFFFEB104084E2600084E8C0\r
+S3150001B65070A81BE90DC0A0E170D82DE90260A0E138\r
+S3150001B6600150A0E104B04CE20110A0E30040A0E1CA\r
+S3150001B670FCFEFFEB104084E2600084E870A81BE941\r
+S3150001B68004E02DE504E09DE408FFFFEA04E02DE572\r
+S3150001B69004E09DE405FFFFEA0DC0A0E104D04DE200\r
+S3150001B6A0F0DF2DE908B04CE238D04DE230C04BE274\r
+S3150001B6B004308BE50C308BE2300093E802A0A0E168\r
+S3150001B6C00190A0E130000CE814C08BE218009CE860\r
+S3150001B6D040504BE2180085E93CE01BE534301BE5A0\r
+S3150001B6E004C09BE5991382E09C4E85E040304BE215\r
+S3150001B6F050C04BE2060003E830008CE90230A0E1BD\r
+S3150001B70030101BE504209BE538401BE5913923E009\r
+S3150001B710945222E00EC0A0E134501BE508E09BE5FF\r
+S3150001B7209A3525E09E2C2CE02C000BE50000A0E3C9\r
+S3150001B73040500BE548C00BE554000BE540104BE2C9\r
+S3150001B740180011E80060A0E30150A0E3053003E012\r
+S3150001B750064004E0043093E11D00001A50204BE23C\r
+S3150001B760180092E9053003E0064004E0043093E155\r
+S3150001B7701700001A44301BE540E01BE5A320A0E1B9\r
+S3150001B7808E3F82E1AE40A0E140104BE2180001E895\r
+S3150001B7904CC01BE540304BE2060013E8AC00A0E1CB\r
+S3150001B7A048C01BE5051001E0062002E08C3F80E160\r
+S3150001B7B0AC40A0E150E04BE2021091E118008EE9A5\r
+S3150001B7C0053003E0064004E00100001A043093E16D\r
+S3150001B7D0E7FFFF0A0010A0E350100BE550301BE510\r
+S3150001B7E040404BE28320A0E1EC369FE5030014E8DC\r
+S3150001B7F0B36092E10070A0E30730A0E10620A0E16A\r
+S3150001B800AF0700EB0190A0E10080A0E1981682E06D\r
+S3150001B810972823E044501BE5993622E0050051E1C3\r
+S3150001B8208101000A50001BE5010080E22F0050E370\r
+S3150001B83050000BE5E8FFFF9A40104BE2000611E8C5\r
+S3150001B84050104BE20030A0E30120A0E340404BE260\r
+S3150001B850030091E90C0084E900005AE330404BE211\r
+S3150001B86003008BE90C0004E80200008AF800001AC4\r
+S3150001B870010859E3F600009A04E09BE508C09BE540\r
+S3150001B88038001BE5AE30A0E18020A0E100005CE1BC\r
+S3150001B890AC10A0E18C0F83E104C09BE53CE01BE505\r
+S3150001B8A001302CE2AE5F82E18E40A0E1013003E27D\r
+S3150001B8B00020A0E30200008A0200001A0E005CE1EB\r
+S3150001B8C00000009A0120A0E3023013E040C04B12B1\r
+S3150001B8D003008B1930008C19E6FFFF1A08E09BE57F\r
+S3150001B8E038001BE503C0A0E100005EE10400008A08\r
+S3150001B8F00400001A04109BE53C201BE5020051E1FF\r
+S3150001B9000000009A01C0A0E30030A0E300005CE360\r
+S3150001B91050300BE51D00000A50401BE5B8359FE588\r
+S3150001B9208420A0E1B35092E103009BE90060A0E30B\r
+S3150001B9300630A0E10520A0E160C00BE5600700EB41\r
+S3150001B94060C01BE500005CE30500000A907588E015\r
+S3150001B950968023E004E09BE5913528E00E0057E14F\r
+S3150001B9600C01000A50301BE5013083E250300BE533\r
+S3150001B9702F0053E30030A0830130A09300005CE365\r
+S3150001B9800030A00301300312000053E3E1FFFF1A68\r
+S3150001B99030009BE9A4CDA0E18502A0E130E01BE5E2\r
+S3150001B9A0013029E20E005AE1013003E20020A0E352\r
+S3150001B9B00300008A0300001A34101BE5010059E157\r
+S3150001B9C00000009A0120A0E3020013E11800000A1A\r
+S3150001B9D000408CE104209BE504005AE18232A0E19B\r
+S3150001B9E00200008A1200001A030059E11000009AB1\r
+S3150001B9F0A920A0E130E01BE58A3F82E1AA40A0E14F\r
+S3150001BA0034201BE504A0A0E10390A0E18E10A0E183\r
+S3150001BA10A24F81E18230A0E130504BE200005AE3AF\r
+S3150001BA20180005E8DCFFFF8A0100001A010859E346\r
+S3150001BA30D9FFFF2A30301BE500C0A0E303005AE11D\r
+S3150001BA400300008A1600001A34401BE5040059E180\r
+S3150001BA501300009A08509BE504E09BE50532A0E13E\r
+S3150001BA602E2E83E102005AE10E12A0E10C00A0E1A4\r
+S3150001BA700200008A0200001A010059E10000009A42\r
+S3150001BA800100A0E300005AE30030A0E30200008AAF\r
+S3150001BA900200001A010859E30000009A0130A0E3F0\r
+S3150001BAA003C000E00010A0E300005CE350100BE5CA\r
+S3150001BAB03300000A50301BE50A10A0E10900A0E19D\r
+S3150001BAC08320A0E110349FE5B36092E160C00BE5ED\r
+S3150001BAD00070A0E30730A0E10620A0E1F80600EB24\r
+S3150001BAE060C01BE50020A0E300005CE31200000A31\r
+S3150001BAF008409BE504C09BE50432A0E12C5E83E18E\r
+S3150001BB00050051E10C42A0E10200008A0200001A80\r
+S3150001BB10040050E10000009A0120A0E3000051E377\r
+S3150001BB200030A0E30200008A0200001A010850E377\r
+S3150001BB300000009A0130A0E3032002E000C052E2B7\r
+S3150001BB400400000A904685E0975023E0090054E17D\r
+S3150001BB50913625E05C00000A50301BE5013083E296\r
+S3150001BB6050300BE52F0053E30030A0830130A09342\r
+S3150001BB7000005CE30030A00301300312000053E330\r
+S3150001BB80CBFFFF1A010019E31000000A44401BE530\r
+S3150001BB900020A0E3040059E14700000A00005AE32F\r
+S3150001BBA00030A0E30200008A0200001A010859E3EE\r
+S3150001BBB00000009A0130A0E3033002E0010013E324\r
+S3150001BBC00200000A54C01BE501005CE3330000DA01\r
+S3150001BBD004409BE5010014E31D00000A4CC01BE56F\r
+S3150001BBE00020A0E30C0054E12700000A08109BE5A1\r
+S3150001BBF00030A0E3000051E30300008A0300001AAD\r
+S3150001BC0004409BE5010854E30000009A0130A0E3DB\r
+S3150001BC10033002E0010013E30D00000A54501BE556\r
+S3150001BC20010055E30A0000CA18009BE90010E0E391\r
+S3150001BC300000E0E3003093E00140A4E050504BE205\r
+S3150001BC40180085E954C01BE501C08CE254C00BE520\r
+S3150001BC50B9FEFFEA2C301BE530009BE90006A3E89C\r
+S3150001BC602CE01BE5300083E830404BE2180014E875\r
+S3150001BC7010208EE2180082E840304BE20C0093E976\r
+S3150001BC8018108EE20C0081E8F0AF1BE908E09BE595\r
+S3150001BC9048001BE500005EE10120A003D2FFFFEA98\r
+S3150001BCA00010E0E30000E0E3090090E00A10A1E0E3\r
+S3150001BCB040304BE2030003E8E2FFFFEA40501BE598\r
+S3150001BCC005005AE10120A003B3FFFFEA0A0055E18E\r
+S3150001BCD0A0FFFF1A34201BE530504BE2923684E078\r
+S3150001BCE0974222E030401BE501A0A0E10090A0E1CF\r
+S3150001BCF0962424E0180005E80730A0E10620A0E11B\r
+S3150001BD006F0600EB04005AE100C0A0E30300008ABD\r
+S3150001BD101600001A34E01BE50E0059E11300009AE3\r
+S3150001BD2008209BE504E09BE50232A0E12E5E83E15B\r
+S3150001BD30050051E10E42A0E10C20A0E10200008ABB\r
+S3150001BD400200001A040050E10000009A0120A0E35D\r
+S3150001BD50000051E30030A0E30200008A0200001A4D\r
+S3150001BD60010850E30000009A0130A0E303C002E09D\r
+S3150001BD7000005CE377FFFF0A904685E0975023E0D9\r
+S3150001BD80090054E1913625E072FFFF1A0A0055E1D8\r
+S3150001BD90CFFFFF0A6FFFFFEA08209BE5020058E18B\r
+S3150001BDA0EFFEFF1A3CC01BE540E04BE29C3584E008\r
+S3150001BDB00C20A0E1964222E038401BE503008BE906\r
+S3150001BDC0952424E018008EE90630A0E10520A0E1C3\r
+S3150001BDD03B0600EB08209BE500C0A0E3040052E10E\r
+S3150001BDE00400008A0400001A04309BE53C401BE570\r
+S3150001BDF0040053E10000009A01C0A0E300005CE3E7\r
+S3150001BE00D7FEFF0A907588E0968023E004E09BE563\r
+S3150001BE10913528E00E0057E1D1FEFF1A08209BE577\r
+S3150001BE20020058E1DEFFFF0ACDFEFFEA40C01BE536\r
+S3150001BE300C0052E17AFEFF1A50E04BE20730A0E116\r
+S3150001BE400620A0E103009EE91D0600EB60204BE2FF\r
+S3150001BE50904685E0030082E95C101BE54CC01BE5BA\r
+S3150001BE60975121E058501BE50C0054E10730A0E141\r
+S3150001BE700620A0E1961525E069FEFF1A48E01BE5BC\r
+S3150001BE800E0055E166FEFF1A60404BE2300094E970\r
+S3150001BE9050C04BE240004BE2000300E830008CE961\r
+S3150001BEA00910A0E10800A0E1050600EB0190A0E160\r
+S3150001BEB00080A0E1981682E0972823E044C01BE5A4\r
+S3150001BEC0993622E00C0051E155FEFF1A40E01BE5D0\r
+S3150001BED00E0052E1D7FFFF0A51FEFFEA6821020078\r
+S3150001BEE00DC0A0E1F0D82DE904B04CE214D04DE22A\r
+S3150001BEF00CE08DE2106090E5144090E50070A0E33F\r
+S3150001BF000050A0E30300A0E130008DE900C0A0E3EA\r
+S3150001BF10C0008EE80130A0E300C08DE5DDFDFFEB3A\r
+S3150001BF20F0A81BE90DC0A0E1F0DB2DE904B04CE25D\r
+S3150001BF3014D04DE20290A0E10180A0E1146090E5E9\r
+S3150001BF40104090E50070A0E30300A0E10050A0E3DB\r
+S3150001BF500130A0E10CC08DE20020A0E30110A0E3B6\r
+S3150001BF6030008DE9C0008CE800908DE5C9FDFFEB3E\r
+S3150001BF70F0AB1BE910402DE900C0A0E314E080E21C\r
+S3150001BF801C4080E20C2080E5103080E50030A0E303\r
+S3150001BF900020A0E3040080E5000080E524C080E5E0\r
+S3150001BFA0081080E50C008EE80C0084E81080BDE8DE\r
+S3150001BFB010402DE900C0A0E314E080E21C4080E2BD\r
+S3150001BFC00C2080E5103080E50030A0E30020A0E3DE\r
+S3150001BFD0040080E5000080E524C080E5081080E5C6\r
+S3150001BFE00C008EE80C0084E81080BDE8000080E5B6\r
+S3150001BFF0040080E50EF0A0E1000080E5040080E584\r
+S3150001C0000EF0A0E10DC0A0E110D82DE90040A0E19D\r
+S3150001C01004B04CE27E0000EB001094E5040051E10F\r
+S3150001C02010A81B09043094E5043081E5042094E549\r
+S3150001C030044084E5001082E5004084E510A81BE970\r
+S3150001C0400DC0A0E110D82DE90040A0E104B04CE2FA\r
+S3150001C0506F0000EB001094E5040051E110A81B09E4\r
+S3150001C060043094E5043081E5042094E5044084E538\r
+S3150001C070001082E5004084E510A81BE90DC0A0E18F\r
+S3150001C08004D04DE2F0D82DE908B04CE204308BE53E\r
+S3150001C0900040A0E10260A0E10150A0E164709FE5CB\r
+S3150001C0A0003097E5013083E2003087E5243090E5E2\r
+S3150001C0B00010A0E1000053E30F00001A143084E2DF\r
+S3150001C0C01C2084E2080094E50410A0E1600083E8E6\r
+S3150001C0D018009BE9180082E801FDFFEB003097E5A7\r
+S3150001C0E0013053E20300A0E1003087150000000A89\r
+S3150001C0F0F0A81BE911E8FFEBFCFFFFEA080090E559\r
+S3150001C1002CFDFFEBECFFFFEAF42002000DC0A0E1DD\r
+S3150001C110F0DF2DE91C2080E21C3090E504B04CE2F2\r
+S3150001C12004C092E503E0A0E10C309EE114A080E298\r
+S3150001C130F0AF1B09081090E5C00092E8300091E9C4\r
+S3150001C14000039AE8064094E00750A5E0084054E051\r
+S3150001C1500950C5E005005CE10730A0E10620A0E139\r
+S3150001C1600200003AF0AF1B1904005EE1F0AF1B2993\r
+S3150001C1700010E0E30000E0E3004094E00150A5E098\r
+S3150001C1800510A0E10400A0E14D0500EB963084E026\r
+S3150001C190914622E0972024E0038098E00490A9E0EC\r
+S3150001C1A000038AE8F0AF1BE90DC0A0E130D82DE904\r
+S3150001C1B004B04CE20040A0E150509FE5003095E507\r
+S3150001C1C0013083E2003085E5243090E5000053E339\r
+S3150001C1D00700000A003095E5013053E20300A0E1B3\r
+S3150001C1E0003085150000000A30A81BE9D3E7FFEBF4\r
+S3150001C1F0FCFFFFEAC4FFFFEB0130A0E3080094E572\r
+S3150001C200243084E50410A0E1B5FCFFEBF0FFFFEA62\r
+S3150001C210F42002000DC0A0E110D82DE904B04CE2D3\r
+S3150001C22044409FE5003094E5013083E2003084E527\r
+S3150001C230243090E50010A0E1000053E30700001A46\r
+S3150001C240003094E5013053E20300A0E1003084158B\r
+S3150001C2500000000A10A81BE9B8E7FFEBFCFFFFEAA4\r
+S3150001C260080090E5D3FCFFEBF4FFFFEAF42002009F\r
+S3150001C2700DC0A0E130D82DE904B04CE248C09FE5DD\r
+S3150001C28000309CE5013083E200308CE5000051E38B\r
+S3150001C2901C3080E2140080E23000901830008118D2\r
+S3150001C2A0000052E3030093180300821800309CE556\r
+S3150001C2B0013053E20300A0E100308C150000000AB2\r
+S3150001C2C030A81BE99DE7FFEBFCFFFFEAF420020023\r
+S3150001C2D00DC0A0E170D82DE95C309FE508D04DE294\r
+S3150001C2E004B04CE20050A0E1060093E8186080E239\r
+S3150001C2F048409FE5CBFCFFEB44C09FE50530A0E13C\r
+S3150001C3001C10A0E30120A0E30600A0E100C08DE51A\r
+S3150001C31004408DE5E0E4FFEB28009FE55DFBFFEBC4\r
+S3150001C3200600A0E14CE5FFEB1C00A0E3D0E5FFEB26\r
+S3150001C33014309FE5005083E570A81BE9C82102006F\r
+S3150001C340FCC30100D0C30100C05D000064210200EE\r
+S3150001C3500DC0A0E170D82DE95C309FE508D04DE213\r
+S3150001C36004B04CE20050A0E1060093E8186080E2B8\r
+S3150001C37048409FE5ABFCFFEB44C09FE50530A0E1DB\r
+S3150001C3801C10A0E30120A0E30600A0E100C08DE59A\r
+S3150001C39004408DE5C0E4FFEB28009FE53DFBFFEB84\r
+S3150001C3A00600A0E12CE5FFEB1C00A0E3B0E5FFEBE6\r
+S3150001C3B014309FE5005083E570A81BE9C8210200EF\r
+S3150001C3C0FCC30100D0C30100C05D0000642102006E\r
+S3150001C3D00DC0A0E100D82DE918109FE504B04CE28C\r
+S3150001C3E01C00A0E33DFBFFEB1C00A0E3B1E5FFEB66\r
+S3150001C3F00300A0E300A81BE9C05D00000DC0A0E199\r
+S3150001C40000D82DE90200A0E104B04CE2D3FBFFEB1A\r
+S3150001C41004009FE500681BE960E6FFEA148A020052\r
+S3150001C4200DC0A0E1F0D82DE944609FE544709FE579\r
+S3150001C430060051E1010050030040A0E104B04CE2C6\r
+S3150001C4400150A0E10700A0E10700000A060055E13E\r
+S3150001C45000005403180087E2F0A81B199BE4FFEBC8\r
+S3150001C4600700A0E1F0681BE984FCFFEAB7FFFFEBD8\r
+S3150001C470F5FFFFEAB0360000E8AF020004E02DE563\r
+S3150001C48008109FE50100A0E304E09DE4E3FFFFEA55\r
+S3150001C490B036000004E02DE508109FE50000A0E39A\r
+S3150001C4A004E09DE4DDFFFFEAB03600000030A0E3C2\r
+S3150001C4B010402DE9001080E50140A0E1042080E54F\r
+S3150001C4C00C3080E5083080E503E0A0E100C0A0E182\r
+S3150001C4D001E08EE208308CE27F005EE310308CE5ED\r
+S3150001C4E014308CE503C0A0E1F8FFFF9A073014E28F\r
+S3150001C4F0081063120310A001103081E2020053E11B\r
+S3150001C50004309095012084900030A08301308393FC\r
+S3150001C5100030808504308295102080951080BDE81A\r
+S3150001C5200030A0E310402DE9001080E50140A0E1B4\r
+S3150001C530042080E50C3080E5083080E503E0A0E1C9\r
+S3150001C54000C0A0E101E08EE208308CE27F005EE3EC\r
+S3150001C55010308CE514308CE503C0A0E1F8FFFF9A9A\r
+S3150001C560073014E2081063120310A001103081E2B3\r
+S3150001C570020053E104309095012084900030A0839D\r
+S3150001C5800130839300308085043082951020809598\r
+S3150001C5901080BDE8F0472DE90050A0E1000090E5CC\r
+S3150001C5A0000050E30070A0011800000A000051E3EA\r
+S3150001C5B09D0000BA0B1081E2160051E30740C1C38A\r
+S3150001C5C01040A0D37E0F54E3DE00002AA471A0E13F\r
+S3150001C5D0873185E0080083E20CE090E500005EE12A\r
+S3150001C5E00C00000A04309EE50C609EE50120C3E3C1\r
+S3150001C5F002208EE0043092E508009EE5013083E3D7\r
+S3150001C60008708EE2080086E5043082E50C6080E55C\r
+S3150001C6100700A0E1F087BDE808008EE20CE090E596\r
+S3150001C62000005EE1EEFFFF1A027087E218E095E571\r
+S3150001C630108085E208005EE12800000A04309EE5CC\r
+S3150001C6400120C3E302C064E00F005CE30A0000DAE4\r
+S3150001C65004108EE0012084E301308CE308708EE241\r
+S3150001C66004208EE5181085E50CC081E7080181E9F3\r
+S3150001C6701C1085E50C8081E5E4FFFFEA00005CE320\r
+S3150001C6801C8085E5188085E5050000BA02208EE04C\r
+S3150001C690043092E508708EE2013083E3043082E5CE\r
+S3150001C6A0DAFFFFEA020C52E37700002AA211A0E1A9\r
+S3150001C6B0813185E0086083E20C2095E52111A0E136\r
+S3150001C6C00130A0E3080096E5132182E10C2085E5FF\r
+S3150001C6D00C608EE508008EE50CE080E508E086E555\r
+S3150001C6E0C73FA0E1233F87E00CA095E50120A0E329\r
+S3150001C6F04331A0E11263A0E10A0056E10A20A0E15C\r
+S3150001C7003600008A0A0016E10800001A8660A0E1D8\r
+S3150001C7100330C7E30A0016E1047083E20300001A3E\r
+S3150001C7208660A0E1020016E1047087E2FBFFFF0AC2\r
+S3150001C730873185E0080083E20790A0E10010A0E1BF\r
+S3150001C7400CE091E501005EE10900000A04309EE576\r
+S3150001C7500120C3E302C064E00F005CE33D0000CAB0\r
+S3150001C76000005CE3320000AA0CE09EE501005EE1F8\r
+S3150001C770F5FFFF1A017087E2030017E3081081E253\r
+S3150001C780EEFFFF1A0620E0E1030019E302300A007A\r
+S3150001C790080040E2019049E203A0A0010C308505A2\r
+S3150001C7A00200000A083090E5000053E1F5FFFF0A98\r
+S3150001C7B08660A0E10A0056E10800008A000056E3FF\r
+S3150001C7C00600000A0A0016E1D8FFFF1A8660A0E1FA\r
+S3150001C7D00A0016E1047087E2FBFFFF0AD3FFFFEAB6\r
+S3150001C7E0101095E5042091E50120C2E302C064E042\r
+S3150001C7F00F005CE30030A0C30130A0D3040052E176\r
+S3150001C80001308333000053E301E0A00101208C03D2\r
+S3150001C810041081000130840304308E051010850553\r
+S3150001C8200420810508708E0278FFFF0A0070A0E3DC\r
+S3150001C83076FFFFEA02208EE0043092E50C609EE569\r
+S3150001C84008009EE5013083E308708EE2043082E53C\r
+S3150001C850080086E56CFFFFEA08009EE50C609EE590\r
+S3150001C86004108EE0012084E301308CE3080086E5A4\r
+S3150001C87004208EE5181085E508708EE20CC081E76C\r
+S3150001C880080181E90C6080E578FFFFEAA214B0E1B6\r
+S3150001C890A211A0011300000A040051E32233A09162\r
+S3150001C8A0381083920F00009A140051E35B108192B5\r
+S3150001C8B00C00009A540051E32236A0916E10839227\r
+S3150001C8C00800009A550F51E3A237A0917710839281\r
+S3150001C8D00400009A24319FE5030051E12239A09119\r
+S3150001C8E07C1083927E10A083813185E0086083E20B\r
+S3150001C8F0080096E5060050E10C00000A043090E5B8\r
+S3150001C9000130C3E3030052E10600002A080090E566\r
+S3150001C910060050E10300000A043090E50130C3E34C\r
+S3150001C920030052E1F8FFFF3A0C6090E567FFFFEA6A\r
+S3150001C9300C3095E52111A0E10120A0E3123183E13C\r
+S3150001C9400C3085E561FFFFEAA424B0E1A471A001E2\r
+S3150001C9501300000A040052E32433A0913870839235\r
+S3150001C9600F00009A140052E35B7082920C00009A49\r
+S3150001C970540052E32436A0916E7083920800009A07\r
+S3150001C980550F52E3A437A091777083920400009A61\r
+S3150001C99068309FE5030052E12439A0917C708392AF\r
+S3150001C9A07E70A083873185E0081083E20CE091E573\r
+S3150001C9B001005EE10900000A04309EE50120C3E39F\r
+S3150001C9C002C064E00F005CE30A0000CA00005CE3F9\r
+S3150001C9D0040000AA0CE09EE501005EE1F5FFFF1AE6\r
+S3150001C9E0017087E210FFFFEA02208EE0043092E533\r
+S3150001C9F00C609EE5FFFEFFEA017047E2F7FFFFEAE2\r
+S3150001CA0054050000000051E3F0412DE90070A0E15A\r
+S3150001CA100100A001F081BD08085041E204C095E57E\r
+S3150001CA20102090E50140CCE304E085E004309EE56A\r
+S3150001CA3002005EE10160C3E36900000A01302CE2F5\r
+S3150001CA40010013E304608EE50080A0E30900000AFB\r
+S3150001CA50081011E5103080E2055061E0082095E5E7\r
+S3150001CA60014084E0030052E10C0095150180880223\r
+S3150001CA70082080150C00821506208EE00430D2E5D0\r
+S3150001CA80013023E2010013E30A00000A000058E323\r
+S3150001CA90064084E008209E150300001A08209EE542\r
+S3150001CAA0103087E2030052E14700000A0C009EE5C0\r
+S3150001CAB0082080E50C0082E5013084E3000058E39C\r
+S3150001CAC0043085E5044085E70E00001A020C54E3A4\r
+S3150001CAD00E00002AA411A0E1813187E0080083E25B\r
+S3150001CAE00C2097E52111A0E10130A0E308C090E5F3\r
+S3150001CAF0132182E10C2087E50C0085E508C085E558\r
+S3150001CB000C508CE5085080E50100A0E3F081BDE8FA\r
+S3150001CB10A414B0E1A411A0011300000A040051E31A\r
+S3150001CB202433A091381083920F00009A140051E328\r
+S3150001CB305B1081920C00009A540051E32436A091B7\r
+S3150001CB406E1083920800009A550F51E3A437A09105\r
+S3150001CB50771083920400009AC4309FE5030051E1E7\r
+S3150001CB602439A0917C1083927E10A083813187E0C5\r
+S3150001CB70080083E208C090E500005CE10C00000AB1\r
+S3150001CB8004309CE50130C3E3030054E10600002AAA\r
+S3150001CB9008C09CE500005CE10300000A04309CE546\r
+S3150001CBA00130C3E3030054E1F8FFFF3A0C009CE5B2\r
+S3150001CBB0D0FFFFEA0C3097E52111A0E10120A0E3A7\r
+S3150001CBC0123183E10C3087E5CAFFFFEA0180A0E359\r
+S3150001CBD01C5087E5185087E50C2085E5082085E57A\r
+S3150001CBE0B4FFFFEA01302CE2010013E3064084E0C2\r
+S3150001CBF00600000A081011E5055061E00C0095E5F4\r
+S3150001CC0008C095E5014084E008C080E50C008CE58C\r
+S3150001CC10013084E30100A0E3105087E5043085E587\r
+S3150001CC20F081BDE8540500000DC0A0E1F0DF2DE95B\r
+S3150001CC30084041E20180A0E1041094E5000053E3BD\r
+S3150001CC400150C1E30B2082E204B04CE203C0A0E133\r
+S3150001CC500430451200308C15160052E30090A0E115\r
+S3150001CC600770C2C30500A0E11070A0D304E0A0E1E3\r
+S3150001CC70070050E108608EA2180000AA105099E53D\r
+S3150001CC8000C08EE005005CE1C400000A04109CE5CA\r
+S3150001CC900120C1E302208CE00430D2E5013023E219\r
+S3150001CCA0013013E203C0A0010360A0012800000ABD\r
+S3150001CCB005005CE10160C1E3A900000A001086E0FD\r
+S3150001CCC0070051E1220000BA08309CE50C209CE5E2\r
+S3150001CCD00150A0E108608EE2083082E50C2083E570\r
+S3150001CCE0050067E00F0050E30900008A043094E56F\r
+S3150001CCF0051084E0013003E2053083E1043084E568\r
+S3150001CD00042091E5012082E3042081E50600A0E1EB\r
+S3150001CD10F0AF1BE9043094E5071084E0013003E22B\r
+S3150001CD20073083E1012080E3043084E5000081E0DF\r
+S3150001CD30042081E5043090E5081081E2013083E3A7\r
+S3150001CD40043080E50020A0E30900A0E12CFFFFEB01\r
+S3150001CD50EDFFFFEA0430DEE5013023E2010013E3D3\r
+S3150001CD604200000A00209EE500005CE30EA062E09E\r
+S3150001CD7004309AE501E0C3E33600000A05005CE1F0\r
+S3150001CD803C00000A0E3086E0001083E0070051E106\r
+S3150001CD90300000BA08309CE50C209CE504C040E256\r
+S3150001CDA0083082E50C2083E50C209AE508309AE5E7\r
+S3150001CDB024005CE30A40A0E1083082E50C2083E50B\r
+S3150001CDC00150A0E108608AE21D00008A13005CE3BD\r
+S3150001CDD00800A0E10610A0E11200009A043090E4D8\r
+S3150001CDE01B005CE308308AE5042098E5040080E234\r
+S3150001CDF00C208AE510108AE20A00009A043090E4B9\r
+S3150001CE0023005CE310308AE5042090E418108AE2DE\r
+S3150001CE1014208AE50420908420108A8218208A85AD\r
+S3150001CE20043090841C308A85043090E4043081E417\r
+S3150001CE30042090E4042081E4003090E5003081E58F\r
+S3150001CE40A6FFFFEA0810A0E10C20A0E10600A0E180\r
+S3150001CE5064DAFFEBA1FFFFEA00005AE30300000AD0\r
+S3150001CE6000108EE0070051E104C040A2CDFFFFAAE9\r
+S3150001CE700000A0E3F0AF1BE90E3086E0006083E01E\r
+S3150001CE80102087E2020056E1F2FFFFBA0C209AE574\r
+S3150001CE9008309AE504C040E224005CE30A40A0E1C0\r
+S3150001CEA0083082E50C2083E508508AE22700008AD3\r
+S3150001CEB013005CE30800A0E10510A0E11200009A4E\r
+S3150001CEC0043090E41B005CE308308AE5042098E511\r
+S3150001CED0040080E20C208AE510108AE20A00009A1A\r
+S3150001CEE0043090E423005CE310308AE5042090E4EA\r
+S3150001CEF018108AE214208AE50420908420108A8280\r
+S3150001CF0018208A85043090841C308A85043090E488\r
+S3150001CF10043081E4042090E4042081E4003090E5AB\r
+S3150001CF20003081E5063067E007108AE0013083E3CF\r
+S3150001CF30043081E504209AE50500A0E1012002E222\r
+S3150001CF40072082E104208AE5101089E5F0AF1BE98C\r
+S3150001CF500810A0E10C20A0E10500A0E121DAFFEB19\r
+S3150001CF60EFFFFFEA002086E0103087E2030052E17E\r
+S3150001CF7077FFFFBA023067E007108EE0013083E3E6\r
+S3150001CF80043081E504209EE508008EE2012002E2DC\r
+S3150001CF90072082E1101089E504208EE5F0AF1BE938\r
+S3150001CFA004109CE541FFFFEA0118A0E1170711E310\r
+S3150001CFB0F0402DE90060A0E10250A0E14178A0E136\r
+S3150001CFC02200000A103090E57E40A0E3042093E59C\r
+S3150001CFD0100080E201E0C2E30F005EE30010A0D37F\r
+S3150001CFE00110A0C30E20A0E10CC090E500005CE199\r
+S3150001CFF00800000A04309CE50CC09CE50130C3E33F\r
+S3150001D000030052E10320A0B100005CE103E08EE0E1\r
+S3150001D010011081E2F6FFFF1A014054E2080080E2A6\r
+S3150001D020F0FFFF5A080017E3043096150720C2E304\r
+S3150001D03003306E100C3085150730CEE3143043E211\r
+S3150001D040142042E2103085E5081085E5182085E5B3\r
+S3150001D050003096E5003085E5203085E5042096E52B\r
+S3150001D0601830A0E32830C5E5042085E5242085E5B0\r
+S3150001D070F080BDE818109FE50030A0E30120A0E391\r
+S3150001D080032181E7013083E2110053E30EF0A08111\r
+S3150001D090FAFFFFEA1CB0020018109FE50030A0E37A\r
+S3150001D0A00120A0E3032181E7013083E2110053E36C\r
+S3150001D0B00EF0A081FAFFFFEA1CB002000DC0A0E14C\r
+S3150001D0C000D82DE9FA0F80E204B04CE2300000EB03\r
+S3150001D0D004E02DE504009FE504E09DE4B2E7FFEAE4\r
+S3150001D0E064B0020004E02DE504009FE504E09DE440\r
+S3150001D0F03CE8FFEA64B002000DC0A0E170D82DE95A\r
+S3150001D10050609FE50050A0E1060051E10100500387\r
+S3150001D11004B04CE20140A0E13C009FE50B00000A8F\r
+S3150001D120060054E10100550330009FE50500000AA1\r
+S3150001D130060054E1000055031C009FE570A81B1969\r
+S3150001D14070681BE994E7FFEAD2FFFFEBF7FFFFEAFE\r
+S3150001D15078E7FFEBF1FFFFEA20CB000064B00200A5\r
+S3150001D16078B0020004E02DE508109FE50100A0E378\r
+S3150001D17004E09DE4DFFFFFEA20CB000004E02DE59B\r
+S3150001D18008109FE50000A0E304E09DE4D9FFFFEA53\r
+S3150001D19020CB00000DC0A0E110D82DE904B04CE26F\r
+S3150001D1A00040A0E1720000EB0000A0E34D0000EB9F\r
+S3150001D1B00400A0E1690000EB0DC0A0E130D82DE923\r
+S3150001D1C01C309FE504B04CE2300093E814104BE2AA\r
+S3150001D1D008D04DE20100A0E3300021E9E5ABFFEB09\r
+S3150001D1E0EBFFFFEBE41202000DC0A0E1F0DF2DE939\r
+S3150001D1F004B04CE224D04DE20090A0E12020A0E34F\r
+S3150001D20048004BE20010A0E30080A0E3A5D9FFEBA4\r
+S3150001D2104C800BE500A0A0E3000058E30A50A0E112\r
+S3150001D2201F00001A28604BE2203016E5000053E388\r
+S3150001D2301600001AA8309FE5054193E7090054E15D\r
+S3150001D240000054130F00000A2430D4E5800013E3D4\r
+S3150001D2500E00001A4C301BE5000053E32C708402CB\r
+S3150001D2601900001A0700A0E1B3E7FFEB000050E345\r
+S3150001D2701200000A0400A0E154EEFFEB0080A0E1D9\r
+S3150001D2800700A0E1D7E7FFEB0130A0E3203006E578\r
+S3150001D290015085E2070055E300005893046086E2D9\r
+S3150001D2A0E0FFFF0A000058E30030A01301300A0234\r
+S3150001D2B0000053E30800A001F0AF1B09D4FFFFEA09\r
+S3150001D2C001A0A0E34CA00BE5F0FFFFEA2C7084E27D\r
+S3150001D2D00700A0E134E7FFEB000050E3E4FFFF1A8B\r
+S3150001D2E0DFFFFFEA042102000DC0A0E1000050E3C8\r
+S3150001D2F030D82DE904B04CE20040A0E12C5080E288\r
+S3150001D3001300000A0500A0E127E7FFEB0030A0E1CA\r
+S3150001D310000053E30400A0E10940A0E30700001A5E\r
+S3150001D320000054E30430A0E10200000AF2F6FFEB2C\r
+S3150001D3300030E0E3004080E50300A0E130A81BE9EE\r
+S3150001D34022EEFFEB0040A0E10500A0E1A5E7FFEB1F\r
+S3150001D350F2FFFFEAA3FFFFEB0040A0E1EFFFFFEAC8\r
+S3150001D3600DC0A0E100D82DE904B04CE2D4DEFFEBFC\r
+S3150001D370FEFFFFEA0DC0A0E130D82DE928309FE578\r
+S3150001D38004B04CE2004093E5000054E330A81B09C9\r
+S3150001D39018309FE5045183E00FE0A0E104F035E584\r
+S3150001D3A0014054E230A81B09FAFFFFEAFCB0020073\r
+S3150001D3B07CB0020024C09FE50130A0E300209CE57B\r
+S3150001D3C01F0052E3031082E014309F9500108C95E4\r
+S3150001D3D0020183970030A0930300A0E10EF0A0E1C3\r
+S3150001D3E0FCB002007CB00200000051E31F00000AFD\r
+S3150001D3F00130A0E30020A0E3010050E11900003A4A\r
+S3150001D400010251E3000051310112A0310332A03172\r
+S3150001D410FAFFFF3A020151E3000051318110A031B8\r
+S3150001D4208330A031FAFFFF3A010050E101004020AC\r
+S3150001D43003208221A10050E1A1004020A3208221E6\r
+S3150001D440210150E12101402023218221A10150E146\r
+S3150001D450A1014020A3218221000050E32332B01113\r
+S3150001D4602112A011EFFFFF1A0200A0E10EF0A0E1C8\r
+S3150001D47004E02DE5620000EB0000A0E30080BDE8BA\r
+S3150001D48001C020E00130A0E30020A0E3000051E349\r
+S3150001D490001061422100000A000050E300006042D2\r
+S3150001D4A0010050E11900003A010251E30000513137\r
+S3150001D4B00112A0310332A031FAFFFF3A020151E312\r
+S3150001D4C0000051318110A0318330A031FAFFFF3ABB\r
+S3150001D4D0010050E10100402003208221A10050E11A\r
+S3150001D4E0A1004020A3208221210150E121014020F9\r
+S3150001D4F023218221A10150E1A1014020A321822102\r
+S3150001D500000050E32332B0112112A011EFFFFF1AE0\r
+S3150001D5100200A0E100005CE3000060420EF0A0E121\r
+S3150001D52004E02DE5360000EB0000A0E30080BDE835\r
+S3150001D530000051E3001061422D00000A04002DE5B0\r
+S3150001D540000050E300006042010050E12400003A6F\r
+S3150001D5500130A0E3010251E3000051310112A03173\r
+S3150001D5600332A031FAFFFF3A020151E300005131C3\r
+S3150001D5708110A0318330A031FAFFFF3A0020A0E3E9\r
+S3150001D580010050E101004020A10050E1A10040202E\r
+S3150001D590E3208221210150E12101402063218221E2\r
+S3150001D5A0A10150E1A1014020E321822103C0A0E1B4\r
+S3150001D5B0000050E32332B0112112A011EEFFFF1A31\r
+S3150001D5C00E2212E207001C130500000AEC0112E10B\r
+S3150001D5D0A10180106C0112E121018010EC0012E121\r
+S3150001D5E0A100801004C09DE400005CE300006042DD\r
+S3150001D5F00EF0A0E104E02DE5010000EB0000A0E340\r
+S3150001D6000080BDE80EF0A0E1000052E370402DE974\r
+S3150001D61020C062E20140A0E10030A0E10060A0E389\r
+S3150001D6200050A0E30800000A00005CE33032A0E1EC\r
+S3150001D63000E06CE2C16FA0D1515EA0D15162A0C1E0\r
+S3150001D640115C83C10640A0E10530A0E10410A0E110\r
+S3150001D6500300A0E17080BDE80DC0A0E130D82DE93E\r
+S3150001D6604C208FE20C0092E804B04CE20150A0E19C\r
+S3150001D6700040A0E19E0600EB00C0A0E100005CE3D3\r
+S3150001D6800510A0E10400A0E12C208FE20C0092E835\r
+S3150001D690030000BA040400EB130700EB020180E269\r
+S3150001D6A030A81BE90510A0E10400A0E10E0700EB7C\r
+S3150001D6B030A81BE90000E041000000000000E0C1C5\r
+S3150001D6C0000000000DC0A0E100D82DE904B04CE235\r
+S3150001D6D004D04DE200C0A0E300C08DE5000000EBE0\r
+S3150001D6E000A81BE90DC0A0E1F0DF2DE904B04CE272\r
+S3150001D6F00060A0E30050A0E330C04BE230D04DE221\r
+S3150001D700004053E20090A0E160008CE860000CE963\r
+S3150001D7100260A0E10150A0E1DE00001A010052E121\r
+S3150001D7205600009A010852E30210A0E14F00002AB8\r
+S3150001D730FF0052E30800A0830000A093D0259FE5D7\r
+S3150001D7403110A0E10130D2E7003083E0203073E2EE\r
+S3150001D75040300BE50500000A40101BE5203063E26E\r
+S3150001D7603933A0E1155183E11661A0E11991A0E1D8\r
+S3150001D7702678A0E1FF3CA0E3FF3083E20710A0E199\r
+S3150001D7800500A0E103A006E02A0700EB0710A0E1CF\r
+S3150001D7900040A0E10500A0E112FFFFEB9A0001E0C5\r
+S3150001D7A02938A0E1044883E1010054E10080A0E1A9\r
+S3150001D7B00500002A064094E0018040E20200002AAA\r
+S3150001D7C0010054E10180483206408430044061E0A2\r
+S3150001D7D00400A0E10710A0E1160700EB0710A0E185\r
+S3150001D7E00050A0E10400A0E1FEFEFFEB9A0001E07B\r
+S3150001D7F0FF3CA0E3FF3083E2033009E0055883E1F3\r
+S3150001D800010055E10500002A065095E0010040E2BD\r
+S3150001D8100200002A010055E1065085300100403220\r
+S3150001D82008C880E1059061E000A0A0E304509BE5F3\r
+S3150001D830000055E30800000A40601BE50010A0E364\r
+S3150001D8403996A0E138900BE534100BE530204BE218\r
+S3150001D8500C0012E90540A0E10C0084E830C00BE59C\r
+S3150001D8602CA00BE530404BE2030094E8F0AF1BE936\r
+S3150001D870010452E31800A0231000A033AEFFFFEA13\r
+S3150001D880000052E30300001A0210A0E10100A0E328\r
+S3150001D890D4FEFFEB0060A0E1010856E37900002AFF\r
+S3150001D8A0FF0056E30800A0830000A09360249FE5D3\r
+S3150001D8B03610A0E10130D2E7003083E0203073E278\r
+S3150001D8C040300BE50550660001A0A0032688A001A3\r
+S3150001D8D03B00000A40301BE540201BE51663A0E132\r
+S3150001D8E0202062E2FF3CA0E335A2A0E12688A0E168\r
+S3150001D8F040401BE5FF3083E2033006E03C200BE5A8\r
+S3150001D9000A00A0E13922A0E10810A0E1155482E144\r
+S3150001D91048300BE5C70600EB0810A0E10070A0E156\r
+S3150001D9200A00A0E1AFFEFFEB48201BE5900202E0F2\r
+S3150001D9302538A0E1077883E1020057E100A0A0E1C4\r
+S3150001D9401994A0E144800BE50500002A067097E0D2\r
+S3150001D95001A040E20200002A020057E101A04A327A\r
+S3150001D96006708730077062E044101BE50700A0E1EE\r
+S3150001D970B00600EB44101BE50040A0E10700A0E162\r
+S3150001D98098FEFFEB48201BE5900202E0FF3CA0E376\r
+S3150001D990FF3083E2033005E0044883E1020054E1ED\r
+S3150001D9A00500002A064094E0010040E20200002A38\r
+S3150001D9B0020054E101004032064084300AA880E1A9\r
+S3150001D9C0045062E0FF3CA0E3FF3083E2033006E04F\r
+S3150001D9D00810A0E10500A0E14C300BE5950600EB2F\r
+S3150001D9E00810A0E10040A0E10500A0E17DFEFFEBEB\r
+S3150001D9F04C101BE5900101E02938A0E1044883E1C0\r
+S3150001DA00010054E10070A0E10500002A064094E0FF\r
+S3150001DA10017040E20200002A010054E10170473220\r
+S3150001DA2006408430044061E00400A0E10810A0E152\r
+S3150001DA30800600EB0810A0E10050A0E10400A0E17F\r
+S3150001DA4068FEFFEB4C101BE5900101E0FF3CA0E3F3\r
+S3150001DA50FF3083E2033009E0055883E1010055E117\r
+S3150001DA600500002A065095E0010040E20200002A66\r
+S3150001DA70010055E1065085300100403207C880E1BA\r
+S3150001DA80059061E068FFFFEA010456E31800A02350\r
+S3150001DA901000A03384FFFFEA010054E10B00009A55\r
+S3150001DAA004309BE500A0A0E3000053E30AC0A0E117\r
+S3150001DAB069FFFF0A38000BE534100BE530404BE2F5\r
+S3150001DAC0300014E90360A0E1300083E862FFFFEA59\r
+S3150001DAD0010854E38A00002AFF0054E30800A083EA\r
+S3150001DAE00000A09328229FE53410A0E10130D2E77F\r
+S3150001DAF0003083E0203073E240300BE51100001A5C\r
+S3150001DB00040055E10600599140C01B350300003A57\r
+S3150001DB1006C059E00450C5E00C90A0E101C0A0E3A5\r
+S3150001DB2004109BE5000051E300A0A0E34AFFFF0AB1\r
+S3150001DB3038900BE534500BE530204BE20C0012E92E\r
+S3150001DB400140A0E143FFFFEA40301BE540C01BE571\r
+S3150001DB50203063E23C300BE53633A0E1144C83E11F\r
+S3150001DB603C101BE52428A0E1FF3CA0E335A1A0E180\r
+S3150001DB7050200BE5FF3083E23921A0E1033004E0B8\r
+S3150001DB800A00A0E150101BE5155C82E154300BE55B\r
+S3150001DB90280600EB50101BE50080A0E10A00A0E179\r
+S3150001DBA010FEFFEB54301BE500A0A0E1930A0AE04A\r
+S3150001DBB02538A0E140C01BE5088883E10A0058E149\r
+S3150001DBC058000BE5166CA0E1199CA0E10700002A9C\r
+S3150001DBD0011040E2048098E058100BE50300002A8A\r
+S3150001DBE00A0058E10110413258100B350480883083\r
+S3150001DBF008806AE050101BE50800A0E10D0600EB65\r
+S3150001DC0050101BE50070A0E10800A0E1F5FDFFEB57\r
+S3150001DC1054A01BE5900A0AE0FF3CA0E3FF3083E233\r
+S3150001DC20033005E0077883E10A0057E10500002A81\r
+S3150001DC30047097E0010040E20200002A0A0057E161\r
+S3150001DC40010040320470873058201BE507706AE0F6\r
+S3150001DC5002C880E12C18A0E12608A0E10128CCE148\r
+S3150001DC600038C6E192030EE0910303E0900202E060\r
+S3150001DC70910000E0022093E00108802202E89EE084\r
+S3150001DC802208A0E0070050E10600008A0030A01338\r
+S3150001DC900130A00309005EE10030A0930130038248\r
+S3150001DCA0000053E30300000A06305EE00400C0E012\r
+S3150001DCB003E0A0E101C04CE204409BE5000054E30F\r
+S3150001DCC000A0A0E3E4FEFF0A40101BE50E6059E048\r
+S3150001DCD00050C7E03C201BE53631A0E1153283E157\r
+S3150001DCE03551A0E138300BE534500BE530304BE2CD\r
+S3150001DCF0180013E904509BE5180085E80690A0E199\r
+S3150001DD00D5FEFFEA010454E31800A0231000A03356\r
+S3150001DD1073FFFFEA001302000DC0A0E100D82DE950\r
+S3150001DD2004B04CE20CD04DE214C04BE200C08DE5CC\r
+S3150001DD30020000EB10304BE2030013E800A81BE9D8\r
+S3150001DD400DC0A0E1F0DF2DE904B04CE20060A0E3D4\r
+S3150001DD500050A0E330C04BE230D04DE2004053E228\r
+S3150001DD600090A0E160008CE860000CE90260A0E18F\r
+S3150001DD700150A0E1DE00001A010052E15600009AAE\r
+S3150001DD80010852E30210A0E14F00002AFF0052E30E\r
+S3150001DD900800A0830000A093D0259FE53110A0E1E3\r
+S3150001DDA00130D2E7003083E0203073E240300BE5EA\r
+S3150001DDB00500000A40101BE5203063E23933A0E17B\r
+S3150001DDC0155183E11661A0E11991A0E12678A0E140\r
+S3150001DDD0FF3CA0E3FF3083E20710A0E10500A0E1CC\r
+S3150001DDE003A006E0930500EB0710A0E10040A0E1C7\r
+S3150001DDF00500A0E17BFDFFEB9A0001E02938A0E1D7\r
+S3150001DE00044883E1010054E10080A0E10500002AF5\r
+S3150001DE10064094E0018040E20200002A010054E13C\r
+S3150001DE200180483206408430044061E00400A0E1EC\r
+S3150001DE300710A0E17F0500EB0710A0E10050A0E16B\r
+S3150001DE400400A0E167FDFFEB9A0001E0FF3CA0E3BF\r
+S3150001DE50FF3083E2033009E0055883E1010055E113\r
+S3150001DE600500002A065095E0010040E20200002A62\r
+S3150001DE70010055E1065085300100403208C880E1B5\r
+S3150001DE80059061E000A0A0E304509BE5000055E386\r
+S3150001DE900800000A40601BE50010A0E33996A0E1E6\r
+S3150001DEA038900BE534100BE530204BE20C0012E9FB\r
+S3150001DEB00540A0E10C0084E830C00BE52CA00BE581\r
+S3150001DEC030404BE2030094E8F0AF1BE9010452E352\r
+S3150001DED01800A0231000A033AEFFFFEA000052E3B2\r
+S3150001DEE00300001A0210A0E10100A0E33DFDFFEBD3\r
+S3150001DEF00060A0E1010856E37900002AFF0056E31D\r
+S3150001DF000800A0830000A09360249FE53610A0E1DD\r
+S3150001DF100130D2E7003083E0203073E240300BE578\r
+S3150001DF200550660001A0A0032688A0013B00000A57\r
+S3150001DF3040301BE540201BE51663A0E1202062E28C\r
+S3150001DF40FF3CA0E335A2A0E12688A0E140401BE505\r
+S3150001DF50FF3083E2033006E03C200BE50A00A0E136\r
+S3150001DF603922A0E10810A0E1155482E148300BE501\r
+S3150001DF70300500EB0810A0E10070A0E10A00A0E165\r
+S3150001DF8018FDFFEB48201BE5900202E02538A0E1D1\r
+S3150001DF90077883E1020057E100A0A0E11994A0E10E\r
+S3150001DFA044800BE50500002A067097E001A040E2D7\r
+S3150001DFB00200002A020057E101A04A3206708730AA\r
+S3150001DFC0077062E044101BE50700A0E1190500EBAC\r
+S3150001DFD044101BE50040A0E10700A0E101FDFFEBB5\r
+S3150001DFE048201BE5900202E0FF3CA0E3FF3083E2FC\r
+S3150001DFF0033005E0044883E1020054E10500002AEC\r
+S3150001E000064094E0010040E20200002A020054E1C9\r
+S3150001E01001004032064084300AA880E1045062E0E3\r
+S3150001E020FF3CA0E3FF3083E2033006E00810A0E1E5\r
+S3150001E0300500A0E14C300BE5FE0400EB0810A0E161\r
+S3150001E0400040A0E10500A0E1E6FCFFEB4C101BE55A\r
+S3150001E050900101E02938A0E1044883E1010054E17F\r
+S3150001E0600070A0E10500002A064094E0017040E23C\r
+S3150001E0700200002A010054E1017047320640843053\r
+S3150001E080044061E00400A0E10810A0E1E90400EB0E\r
+S3150001E0900810A0E10050A0E10400A0E1D1FCFFEBD3\r
+S3150001E0A04C101BE5900101E0FF3CA0E3FF3083E249\r
+S3150001E0B0033009E0055883E1010055E10500002A16\r
+S3150001E0C0065095E0010040E20200002A010055E1F8\r
+S3150001E0D0065085300100403207C880E1059061E0B5\r
+S3150001E0E068FFFFEA010456E31800A0231000A033DD\r
+S3150001E0F084FFFFEA010054E10B00009A04309BE51E\r
+S3150001E10000A0A0E3000053E30AC0A0E169FFFF0AF3\r
+S3150001E11038000BE534100BE530404BE2300014E9D2\r
+S3150001E1200360A0E1300083E862FFFFEA010854E3DF\r
+S3150001E1308A00002AFF0054E30800A0830000A09390\r
+S3150001E14028229FE53410A0E10130D2E7003083E0B8\r
+S3150001E150203073E240300BE51100001A040055E14E\r
+S3150001E1600600599140C01B350300003A06C059E02C\r
+S3150001E1700450C5E00C90A0E101C0A0E304109BE5AA\r
+S3150001E180000051E300A0A0E34AFFFF0A38900BE527\r
+S3150001E19034500BE530204BE20C0012E90140A0E1BE\r
+S3150001E1A043FFFFEA40301BE540C01BE5203063E238\r
+S3150001E1B03C300BE53633A0E1144C83E13C101BE502\r
+S3150001E1C02428A0E1FF3CA0E335A1A0E150200BE506\r
+S3150001E1D0FF3083E23921A0E1033004E00A00A0E127\r
+S3150001E1E050101BE5155C82E154300BE5910400EB00\r
+S3150001E1F050101BE50080A0E10A00A0E179FCFFEBCD\r
+S3150001E20054301BE500A0A0E1930A0AE02538A0E1FD\r
+S3150001E21040C01BE5088883E10A0058E158000BE578\r
+S3150001E220166CA0E1199CA0E10700002A011040E24A\r
+S3150001E230048098E058100BE50300002A0A0058E113\r
+S3150001E2400110413258100B350480883008806AE08D\r
+S3150001E25050101BE50800A0E1760400EB50101BE509\r
+S3150001E2600070A0E10800A0E15EFCFFEB54A01BE5F5\r
+S3150001E270900A0AE0FF3CA0E3FF3083E2033005E0A9\r
+S3150001E280077883E10A0057E10500002A047097E048\r
+S3150001E290010040E20200002A0A0057E10100403273\r
+S3150001E2A00470873058201BE507706AE002C880E1D8\r
+S3150001E2B02C18A0E12608A0E10128CCE10038C6E12E\r
+S3150001E2C092030EE0910303E0900202E0910000E068\r
+S3150001E2D0022093E00108802202E89EE02208A0E0E5\r
+S3150001E2E0070050E10600008A0030A0130130A003A8\r
+S3150001E2F009005EE10030A09301300382000053E380\r
+S3150001E3000300000A06305EE00400C0E003E0A0E17D\r
+S3150001E31001C04CE204409BE5000054E300A0A0E3E9\r
+S3150001E320E4FEFF0A40101BE50E6059E00050C7E00D\r
+S3150001E3303C201BE53631A0E1153283E13551A0E1E0\r
+S3150001E34038300BE534500BE530304BE2180013E959\r
+S3150001E35004509BE5180085E80690A0E1D5FEFFEA8A\r
+S3150001E360010454E31800A0231000A03373FFFFEA51\r
+S3150001E370001302000DC0A0E1F0DF2DE904B04CE26C\r
+S3150001E38010D04DE20170A0E10280A0E10060A0E1A1\r
+S3150001E390FB0000EB000050E30100000A0600A0E1CB\r
+S3150001E3A0F0AF1BE90700A0E1F50000EB000050E328\r
+S3150001E3B00100000A0700A0E1F0AF1BE90600A0E199\r
+S3150001E3C0F40000EB000050E30900000A0700A0E199\r
+S3150001E3D0F00000EB000050E3EFFFFF0A042097E591\r
+S3150001E3E0043096E5020053E1EBFFFF0AF06F1BE9EB\r
+S3150001E3F0E00000EA0700A0E1E60000EB000050E3C0\r
+S3150001E400EBFFFF1A0700A0E1E70000EB000050E375\r
+S3150001E4100F00000A0600A0E1E30000EB000050E354\r
+S3150001E420DDFFFF0A06E0A0E10F00BEE808C0A0E19B\r
+S3150001E4300F00ACE800309EE500308CE5042096E53F\r
+S3150001E440043097E50800A0E1032002E0042088E5F6\r
+S3150001E450F0AF1BE90600A0E1D30000EB000050E39A\r
+S3150001E460D3FFFF1A0C2086E208E096E508C097E57F\r
+S3150001E470030092E830404BE20E306CE0030084E882\r
+S3150001E480000053E3003063B23F0053E30C3087E2F0\r
+S3150001E490000693E87A0000CA0C005EE10C0000DA7F\r
+S3150001E4A00EC06CE00010A0E30100A0E3A930A0E1DA\r
+S3150001E4B001500AE0004009E08A1F83E1AA20A0E199\r
+S3150001E4C001C05CE2019084E102A085E1F4FFFF1A3C\r
+S3150001E4D00EC0A0E10E005CE1140000DA30404BE210\r
+S3150001E4E00C0094E80050A0E30140A0E3042002E000\r
+S3150001E4F0053003E030504BE20C0005E930104BE2E9\r
+S3150001E500220091E8A100A0E130204BE2853F80E1A5\r
+S3150001E510030012E901E08EE2A540A0E1030080E1DB\r
+S3150001E520041081E10E005CE1030082E8EAFFFFCA04\r
+S3150001E530040096E5043097E5030050E14800000A1F\r
+S3150001E540000050E34100000A30204BE2030092E84C\r
+S3150001E550000059E00110CAE0000051E3340000BA9E\r
+S3150001E5600C7088E20030A0E3084088E9030087E8E0\r
+S3150001E570060097E80040E0E30030E0E3031091E095\r
+S3150001E5800420A2E01F0272E31100008A2500000A9E\r
+S3150001E590180097E88420A0E1A34F82E10010E0E390\r
+S3150001E5A00000E0E38330A0E1082098E5030090E055\r
+S3150001E5B00410A1E0012042E21F0271E3082088E570\r
+S3150001E5C0180087E80200008AF0FFFF1A020070E3D4\r
+S3150001E5D0EEFFFF9A043097E50320A0E31E0273E3E2\r
+S3150001E5E0002088E50D00009A060097E80040A0E3A8\r
+S3150001E5F00130A0E3A1C0A0E1035001E0046002E004\r
+S3150001E600080098E5823F8CE1A240A0E1031085E174\r
+S3150001E610042086E1010080E2060087E8080088E51B\r
+S3150001E6200800A0E1F0AF1BE9020071E3D7FFFF9AF2\r
+S3150001E630E7FFFFEA003070E20040E1E20C7088E299\r
+S3150001E6400120A0E3180087E8044088E9C7FFFFEA34\r
+S3150001E65030304BE2030093E8090050E00A10C1E0B4\r
+S3150001E660BCFFFFEA30104BE2300091E8094094E02C\r
+S3150001E6700A50A5E00C7088E2300087E8014088E97D\r
+S3150001E680D3FFFFEA0C005EE100A0A0C30090A0C387\r
+S3150001E690A6FFFFCA0040A0E30030A0E330504BE2E2\r
+S3150001E6A0180085E80CE0A0E1A0FFFFEA0DC0A0E19B\r
+S3150001E6B0F0D92DE904B04CE264C04BE234804BE260\r
+S3150001E6C04CD04DE20150A0E10040A0E16C604BE26C\r
+S3150001E6D00C00A0E10810A0E148704BE230008CE884\r
+S3150001E6E00C0086E83C0400EB0600A0E10710A0E15F\r
+S3150001E6F0390400EB0710A0E15C204BE20800A0E121\r
+S3150001E7001BFFFFEB8F0300EBF0A91BE90DC0A0E196\r
+S3150001E710F0D92DE904B04CE264C04BE234804BE2FF\r
+S3150001E7204CD04DE20150A0E10040A0E16C604BE20B\r
+S3150001E7300C00A0E10810A0E148704BE230008CE823\r
+S3150001E7400C0086E8240400EB0600A0E10710A0E116\r
+S3150001E750210400EB44301BE50710A0E1013023E260\r
+S3150001E7605C204BE20800A0E144300BE500FFFFEB23\r
+S3150001E770740300EBF0A91BE900009FE50EF0A0E190\r
+S3150001E780EC120200000090E5010050E30000A083B6\r
+S3150001E7900100A0930EF0A0E1000090E5040050E313\r
+S3150001E7A00000A0130100A0030EF0A0E1000090E517\r
+S3150001E7B0020050E30000A0130100A0030EF0A0E147\r
+S3150001E7C00DC0A0E1F0D92DE904B04CE264C04BE2E2\r
+S3150001E7D034804BE24CD04DE20150A0E10040A0E173\r
+S3150001E7E06C604BE20C00A0E10810A0E148704BE21E\r
+S3150001E7F030008CE80C0086E8F70300EB0600A0E188\r
+S3150001E8000710A0E1F40300EB0710A0E15C204BE246\r
+S3150001E8100800A0E1010000EB4A0300EBF0A91BE9A7\r
+S3150001E8200DC0A0E1F0DF2DE904B04CE248D04DE285\r
+S3150001E8300160A0E10240A0E10050A0E1E50000EB8B\r
+S3150001E840000050E300A0A0E30090A0E30600000A48\r
+S3150001E850042096E5043095E50500A0E1023053E079\r
+S3150001E8600130A013043085E5F0AF1BE90600A0E1F5\r
+S3150001E870D80000EB000050E30600000A043095E5DD\r
+S3150001E880042096E50600A0E1023053E00130A01312\r
+S3150001E890043086E5F0AF1BE90500A0E1D20000EBEC\r
+S3150001E8A0000050E30500000A0600A0E1D30000EBDA\r
+S3150001E8B0000050E3E5FFFF0AF06F1BE9C20000EA22\r
+S3150001E8C00600A0E1C80000EB000050E30400000AC6\r
+S3150001E8D00500A0E1C90000EB000050E3E6FFFF0AD6\r
+S3150001E8E0F4FFFFEA0500A0E1C40000EB000050E3DD\r
+S3150001E8F0D6FFFF1A0600A0E1C00000EB000050E3BE\r
+S3150001E90034000BE5DCFFFF1A0C3086E2060093E8C3\r
+S3150001E9100CE095E50210A0E1912E83E040704BE2F8\r
+S3150001E9200C0007E80C0085E20C0090E80370A0E1FA\r
+S3150001E9300CC096E540004BE268700BE5800110E8DB\r
+S3150001E94068001BE5907CA8E040201BE5080052E129\r
+S3150001E950912083E050004BE250104BE2000601E8A3\r
+S3150001E9600C0080E99C9E8AE00300008A0600001ADA\r
+S3150001E97044201BE5070052E10300009A8E0F8FE247\r
+S3150001E980030090E850204BE2030002E80710A0E1E3\r
+S3150001E9900020A0E30030A0E340100BE544300BE576\r
+S3150001E9A040004BE2030010E8090090E00A10A1E0E4\r
+S3150001E9B060204BE201005AE1030082E90200008A6D\r
+S3150001E9C00800001A000059E10600009A50C04BE207\r
+S3150001E9D000061CE80020A0E30110A0E3019099E0E5\r
+S3150001E9E002A0AAE000060CE80800A0E10010A0E3DE\r
+S3150001E9F050804BE201A0A0E10090A0E1800198E9DE\r
+S3150001EA00080096E5041096E550604BE2082095E56E\r
+S3150001EA10043095E5600016E8079099E008A0AAE0A1\r
+S3150001EA2060704BE2059099E006A0AAE0002082E022\r
+S3150001EA30800197E9013053E00130A013042082E2FE\r
+S3150001EA4030C04BE21E027AE3043084E5082084E5F7\r
+S3150001EA5080018CE81B00009A0080A0E30170A0E30E\r
+S3150001EA60A920A0E130101BE58A2F82E1AAC0A0E10E\r
+S3150001EA70080094E564200BE560C00BE5A120A0E148\r
+S3150001EA802C301BE5071009E060C04BE2010080E273\r
+S3150001EA90000051E3835F82E1A360A0E100061CE868\r
+S3150001EAA0080084E50500000A452F8FE20C0092E874\r
+S3150001EAB0031086E1020085E130304BE2030083E872\r
+S3150001EAC01E027AE3E5FFFF8A1F027AE31F00008A2E\r
+S3150001EAD030304BE2880093E887C0A0E1A3CF8CE1F8\r
+S3150001EAE030204BE2800192E86CC00BE5D0108FE23A\r
+S3150001EAF0060091E883C0A0E170C00BE5080094E52B\r
+S3150001EB00017007E070104BE28A30A0E1028008E054\r
+S3150001EB10060091E8A96F83E1010040E28950A0E176\r
+S3150001EB2030304BE2087097E1060083E8080084E57F\r
+S3150001EB3006A0A0E10590A0E10030A0130120A013DA\r
+S3150001EB400290891103A08A111F027AE3DFFFFF9A5F\r
+S3150001EB50FF2009E20030A0E3800052E30500000A2D\r
+S3150001EB600C3084E20320A0E30400A0E1000683E860\r
+S3150001EB70002084E5F0AF1BE9000053E3F7FFFF1A1D\r
+S3150001EB800020A0E3011CA0E3091001E00A2002E035\r
+S3150001EB90021091E10300001A30304BE2280093E89D\r
+S3150001EBA0053093E1EDFFFF0A0020A0E38010A0E30A\r
+S3150001EBB0019099E002A0AAE0E8FFFFEA0000000048\r
+S3150001EBC001000000000000000000008000009FE539\r
+S3150001EBD00EF0A0E1EC120200000090E5010050E306\r
+S3150001EBE00000A0830100A0930EF0A0E1000090E5D3\r
+S3150001EBF0040050E30000A0130100A0030EF0A0E101\r
+S3150001EC00000090E5020050E30000A0130100A003FC\r
+S3150001EC100EF0A0E10DC0A0E1F0D92DE904B04CE25F\r
+S3150001EC2050C04BE234804BE238D04DE20150A0E1B6\r
+S3150001EC300040A0E158604BE20C00A0E10810A0E101\r
+S3150001EC4048704BE230008CE80C0086E8E20200EBEB\r
+S3150001EC500600A0E10710A0E1DF0200EB0710A0E12A\r
+S3150001EC600800A0E1010000EB360200EBF0A91BE968\r
+S3150001EC700DC0A0E1F0DB2DE904B04CE220D04DE25D\r
+S3150001EC800140A0E10050A0E1950000EB000050E337\r
+S3150001EC900100000A0500A0E1F0AB1BE90400A0E1B8\r
+S3150001ECA08F0000EB000050E30400A011F0AB1B192C\r
+S3150001ECB0043095E5042094E5023023E0043085E52F\r
+S3150001ECC00500A0E18B0000EB000050E30500000AFF\r
+S3150001ECD0002094E5003095E5020053E1ECFFFF1AB0\r
+S3150001ECE0F06B1BE97B0000EA0500A0E1860000EB62\r
+S3150001ECF0000050E30060A0E1F4FFFF1A0400A0E168\r
+S3150001ED007C0000EB000050E30600000A0C3085E2AF\r
+S3150001ED100020A0E30010A0E30500A0E1060083E8BF\r
+S3150001ED20086085E5F0AB1BE90400A0E1760000EB85\r
+S3150001ED30000050E30430A0130500A0110030851532\r
+S3150001ED40F0AB1B190C3084E2030093E830204BE250\r
+S3150001ED50030002E80CC085E2082095E5083094E539\r
+S3150001ED6000039CE8020063E0090051E1080085E523\r
+S3150001ED700300008A0900001A34301BE5080053E13C\r
+S3150001ED800600009A013040E28900A0E1A82F80E147\r
+S3150001ED908810A0E1083085E50290A0E10180A0E19C\r
+S3150001EDA04A0F8FE2030090E830204BE2030082E92C\r
+S3150001EDB00040A0E30030A0E340004BE2180080E9E8\r
+S3150001EDC02C104BE2120091E830201BE5A130A0E1A6\r
+S3150001EDD0843F83E1A400A0E1090052E144300BE540\r
+S3150001EDE040000BE50F00008A0200001A34101BE5F3\r
+S3150001EDF0080051E10B00008A30304BE20C0013E8A9\r
+S3150001EE00028058E00390C9E040204BE230304BE2EB\r
+S3150001EE10030092E90C0093E9031081E1020080E10D\r
+S3150001EE2040304BE2030083E940004BE2030010E867\r
+S3150001EE308930A0E130204BE2030082E9A87F83E11B\r
+S3150001EE408860A0E1011090E10790A0E10680A0E1B1\r
+S3150001EE50DAFFFF1A3C305BE50040A0E3800053E394\r
+S3150001EE600300000A40204BE2060092E906008CE806\r
+S3150001EE7087FFFFEA000054E3F9FFFF1A40004BE267\r
+S3150001EE80180090E90020A0E3011CA0E3013003E093\r
+S3150001EE90024004E0043093E10600000A0040A0E3CA\r
+S3150001EEA08030A0E3060090E9031091E00420A2E07F\r
+S3150001EEB0060080E9EAFFFFEA098098E1E8FFFF0A18\r
+S3150001EEC00040A0E38030A0E340004BE2F4FFFFEAFC\r
+S3150001EED0000000000000001000009FE50EF0A0E118\r
+S3150001EEE0EC120200000090E5010050E30000A0834F\r
+S3150001EEF00100A0930EF0A0E1000090E5040050E3AC\r
+S3150001EF000000A0130100A0030EF0A0E1000090E5AF\r
+S3150001EF10020050E30000A0130100A0030EF0A0E1DF\r
+S3150001EF200DC0A0E1F0D92DE904B04CE250C04BE28E\r
+S3150001EF3034804BE238D04DE20150A0E10040A0E11F\r
+S3150001EF4048704BE20C00A0E158604BE20810A0E1CA\r
+S3150001EF5030008CE80C0086E81F0200EB0600A0E1F9\r
+S3150001EF600710A0E11C0200EB0800A0E10D0000EB78\r
+S3150001EF700030A0E1000053E30700A0E10100000A10\r
+S3150001EF800100A0E3F0A91BE9060000EB0030A0E1B7\r
+S3150001EF90000053E30800A0E10710A0E1F7FFFF1A04\r
+S3150001EFA05D0200EBF0A91BE9000090E5010050E3CA\r
+S3150001EFB00000A0830100A0930EF0A0E10DC0A0E126\r
+S3150001EFC0F0D92DE904B04CE250C04BE234804BE25B\r
+S3150001EFD038D04DE20150A0E10040A0E148704BE27B\r
+S3150001EFE00C00A0E158604BE20810A0E130008CE86B\r
+S3150001EFF00C0086E8F80100EB0600A0E10710A0E18D\r
+S3150001F000F50100EB0800A0E10D0000EB0030A0E1E6\r
+S3150001F010000053E30700A0E10100000A0100A0E39C\r
+S3150001F020F0A91BE9060000EB0030A0E1000053E364\r
+S3150001F0300800A0E10710A0E1F7FFFF1A360200EB76\r
+S3150001F040F0A91BE9000090E5010050E30000A08350\r
+S3150001F0500100A0930EF0A0E10DC0A0E1F0D92DE9C9\r
+S3150001F06004B04CE250C04BE234804BE238D04DE262\r
+S3150001F0700150A0E10040A0E148704BE20C00A0E184\r
+S3150001F08058604BE20810A0E130008CE80C0086E8DD\r
+S3150001F090D10100EB0600A0E10710A0E1CE0100EBD3\r
+S3150001F0A00800A0E10D0000EB0030A0E1000053E3F1\r
+S3150001F0B00700A0E10100000A0000E0E3F0A91BE956\r
+S3150001F0C0060000EB0030A0E1000053E30800A0E1D8\r
+S3150001F0D00710A0E1F7FFFF1A0F0200EBF0A91BE9E9\r
+S3150001F0E0000090E5010050E30000A0830100A09319\r
+S3150001F0F00EF0A0E10DC0A0E1F0D92DE904B04CE27B\r
+S3150001F10050C04BE234804BE238D04DE20150A0E1D1\r
+S3150001F1100040A0E148704BE20C00A0E158604BE2D0\r
+S3150001F1200810A0E130008CE80C0086E8AA0100EB8B\r
+S3150001F1300600A0E10710A0E1A70100EB0800A0E18D\r
+S3150001F1400D0000EB0030A0E1000053E30700A0E151\r
+S3150001F1500100000A0000E0E3F0A91BE9060000EB4C\r
+S3150001F1600030A0E1000053E30800A0E10710A0E190\r
+S3150001F170F7FFFF1AE80100EBF0A91BE9000090E593\r
+S3150001F180010050E30000A0830100A0930EF0A0E16E\r
+S3150001F1900DC0A0E1F0D92DE904B04CE250C04BE21C\r
+S3150001F1A034804BE238D04DE20150A0E10040A0E1AD\r
+S3150001F1B048704BE20C00A0E158604BE20810A0E158\r
+S3150001F1C030008CE80C0086E8830100EB0600A0E124\r
+S3150001F1D00710A0E1800100EB0800A0E10D0000EBA3\r
+S3150001F1E00030A0E1000053E30700A0E10100000A9E\r
+S3150001F1F00100A0E3F0A91BE9060000EB0030A0E145\r
+S3150001F200000053E30800A0E10710A0E1F7FFFF1A91\r
+S3150001F210C10100EBF0A91BE9000090E5010050E3F4\r
+S3150001F2200000A0830100A0930EF0A0E10DC0A0E1B3\r
+S3150001F23010D82DE90330A0E304B04CE2000050E3FE\r
+S3150001F24014D04DE2A02FA0E120200BE524300BE5E0\r
+S3150001F2500130430224300B051B00000A3C30A0E3B9\r
+S3150001F260000052E31C300BE50030A001C34FA001A2\r
+S3150001F2700300000A020150E300306012C34FA011DF\r
+S3150001F2801400000A10204BE2180002E914301BE5B5\r
+S3150001F2901F0273E30C00008A10204BE2180012E9EA\r
+S3150001F2A08420A0E1A34F82E18330A0E110204BE24C\r
+S3150001F2B0180002E914201BE51C301BE51F0272E34E\r
+S3150001F2C0013043E21C300BE5F2FFFF9A24004BE2CA\r
+S3150001F2D09C0000EB10A81BE904008FE2030090E8F4\r
+S3150001F2E010A81BE90000E0C1000000000DC0A0E16C\r
+S3150001F2F030D82DE904B04CE20140A0E10030A0E194\r
+S3150001F30030204BE228504BE21CD04DE20200A0E136\r
+S3150001F3100510A0E1180082E82F0100EB0500A0E12D\r
+S3150001F320280000EB000050E30040A0E10000A0131C\r
+S3150001F33030A81B190500A0E1180000EB000050E3FE\r
+S3150001F3400400A01130A81B190500A0E1180000EB6C\r
+S3150001F350000050E30400001A20301BE5000053E3CF\r
+S3150001F36030A81BB91E0053E3040000DA24301BE564\r
+S3150001F370000053E30201E0030201A01330A81BE9D8\r
+S3150001F3803C2063E220304BE2030093E9590000EB95\r
+S3150001F39024301BE5000053E30000601230A81BE98E\r
+S3150001F3A0000090E5010050E30000A0830100A09356\r
+S3150001F3B00EF0A0E1000090E5040050E30000A01368\r
+S3150001F3C00100A0030EF0A0E1000090E5020050E369\r
+S3150001F3D00000A0130100A0030EF0A0E10DC0A0E102\r
+S3150001F3E010D82DE904B04CE22CC04BE224404BE28C\r
+S3150001F3F00130A0E10020A0E11CD04DE20C00A0E10B\r
+S3150001F4000410A0E10C008CE8F30000EB0400A0E17D\r
+S3150001F410020000EB0400A0E14A0000EB10A81BE982\r
+S3150001F420043090E5000053E30030A0130130A0033F\r
+S3150001F430043080E50EF0A0E1000051E32900000A46\r
+S3150001F440010051E3010050110000A0030EF0A031AC\r
+S3150001F4500130A0E3010251E3000051310112A03154\r
+S3150001F4600332A031FAFFFF3A020151E300005131A4\r
+S3150001F4708110A0318330A031FAFFFF3A0020A0E3CA\r
+S3150001F480010050E101004020A10050E1A10040200F\r
+S3150001F490E3208221210150E12101402063218221C3\r
+S3150001F4A0A10150E1A1014020E321822103C0A0E195\r
+S3150001F4B0000050E32332B0112112A011EEFFFF1A12\r
+S3150001F4C00E2212E207001C130500000AEC0112E1EC\r
+S3150001F4D0A10180106C0112E121018010EC0012E102\r
+S3150001F4E0A10080100EF0A0E104E02DE544F8FFEB49\r
+S3150001F4F00000A0E30080BDE8000052E370402DE962\r
+S3150001F50020C062E20140A0E10030A0E10060A0E37A\r
+S3150001F5100050A0E30800000A00005CE33032A0E1DD\r
+S3150001F52000E06CE20060A0D3315EA0D13162A0C1DF\r
+S3150001F530115C83C10640A0E10530A0E10410A0E101\r
+S3150001F5400300A0E17080BDE80DC0A0E1F0DD2DE96A\r
+S3150001F5500C3080E204B04CE208D04DE20040A0E15C\r
+S3150001F560600093E8048090E58C0000EB000050E316\r
+S3150001F5700070A0E31C00000A863F8FE2180093E8A2\r
+S3150001F5807F7E87E2035085E1046086E10F7087E2A2\r
+S3150001F59028301BE5233AA0E1063683E16336A0E174\r
+S3150001F5A028300BE5B6225BE17F3EA0E30F3083E214\r
+S3150001F5B00322C2E1033007E0032282E1B6224BE1D6\r
+S3150001F5C025305BE5011008E28030C3E3813383E136\r
+S3150001F5D025304BE528201BE528500BE52C200BE5B3\r
+S3150001F5E030304BE2030093E9F0AD1BE90400A0E1E2\r
+S3150001F5F06F0000EB000050E30400000A7F7EA0E3E9\r
+S3150001F6000F7087E20060A0E30050A0E3DFFFFFEA8E\r
+S3150001F6100400A0E16B0000EB000050E3F8FFFF1AC5\r
+S3150001F620063095E1D9FFFF0A080094E5FF3FE0E3C4\r
+S3150001F630013043E2030050E1350000AABFA360E2B6\r
+S3150001F640FFA78AE2FFAB8AE238005AE31C0000DA20\r
+S3150001F6500060A0E30050A0E3FF3005E20040A0E314\r
+S3150001F660800053E30B00000A0040A0E37F30A0E3D3\r
+S3150001F670035095E00460A6E0010256E32524A0E1CB\r
+S3150001F6800170A023063C82E12644A0E10460A0E1CA\r
+S3150001F6900350A0E1BDFFFFEA000054E3F1FFFF1AAA\r
+S3150001F6A00020A0E3011CA0E3013005E0024006E0D2\r
+S3150001F6B0043093E1EFFFFF0A0040A0E38030A0E3AE\r
+S3150001F6C0EAFFFFEA0A20A0E10010A0E30100A0E39F\r
+S3150001F6D0FF0000EB0040E0E30030E0E3003093E0A0\r
+S3150001F6E00140A4E0042006E0031005E0021091E1C8\r
+S3150001F6F00610A0E10500A0E10A20A0E10040A00358\r
+S3150001F7000140A0137BFFFFEB045080E1C46F81E150\r
+S3150001F710D0FFFFEA010B50E3B7FFFFAAFF3005E276\r
+S3150001F7200040A0E3FF7F80E2800053E3037087E29D\r
+S3150001F7300D00000A0040A0E37F30A0E3035095E0EE\r
+S3150001F7400460A6E01E0276E30500009AA520A0E16A\r
+S3150001F750863F82E1A640A0E1017087E20460A0E154\r
+S3150001F7600350A0E12524A0E1C5FFFFEA000054E310\r
+S3150001F770EFFFFF1A0020A0E3011CA0E3013005E022\r
+S3150001F780024006E0043093E1EDFFFF0A0040A0E3EA\r
+S3150001F7908030A0E3E8FFFFEA000000000000080057\r
+S3150001F7A0000090E5010050E30000A0830100A09352\r
+S3150001F7B00EF0A0E1000090E5040050E30000A01364\r
+S3150001F7C00100A0030EF0A0E1000090E5020050E365\r
+S3150001F7D00000A0130100A0030EF0A0E1F0402DE906\r
+S3150001F7E000C090E508D04DE204C08DE5B620DDE10C\r
+S3150001F7F00730DDE57F4EA0E3040090E50F4084E28B\r
+S3150001F800A333A0E1FF64CCE3227214E0043081E566\r
+S3150001F81001E0A0E10050A0E100008DE50F66C6E31E\r
+S3150001F8201E00001A060090E10230A0031900000A2A\r
+S3150001F8300614A0E10534A0E1254C81E10460A0E1B4\r
+S3150001F8400350A0E1FF2FE0E3012042E20330A0E3F1\r
+S3150001F8501F0276E308208EE500308EE50900008A56\r
+S3150001F8608610A0E108209EE5A54F81E18530A0E143\r
+S3150001F8700460A0E10350A0E1012042E21F0276E309\r
+S3150001F88008208EE5F5FFFF9A0C308EE2600083E8D2\r
+S3150001F89008D08DE2F080BDE800308EE5FBFFFFEA7F\r
+S3150001F8A0040057E10D00000A0624A0E1204C82E184\r
+S3150001F8B00034A0E150108FE2060091E8FF0F47E205\r
+S3150001F8C0030040E2015083E1026084E10C308EE2E4\r
+S3150001F8D008008EE5600083E80330A0E3EDFFFFEA50\r
+S3150001F8E0060090E10430A003EAFFFF0A20108FE230\r
+S3150001F8F0060091E8013005E0024006E0043093E19C\r
+S3150001F9000130A01300308EE5DEFFFFEA00000000A3\r
+S3150001F9100000001000000000000008000DC0A0E17A\r
+S3150001F92070D82DE904B04CE20140A0E10050A0E1FD\r
+S3150001F930580000EB000050E30100000A0100A0E3BB\r
+S3150001F94070A81BE90400A0E1520000EB000050E39F\r
+S3150001F950F9FFFF1A0500A0E1530000EB000050E398\r
+S3150001F9600600000A0400A0E14F0000EB000050E38E\r
+S3150001F97004209415043095150200631070A81B1914\r
+S3150001F9800500A0E1480000EB000050E30400000A76\r
+S3150001F990043095E5000053E30100A0030000E013E5\r
+S3150001F9A070A81BE90400A0E13F0000EB000050E352\r
+S3150001F9B00060A0E10400000A043094E5000053E36E\r
+S3150001F9C00000E0030100A01370A81BE90500A0E1F7\r
+S3150001F9D03A0000EB000050E30300000A0400A0E136\r
+S3150001F9E0360000EB000050E32800001A0500A0E1F4\r
+S3150001F9F0320000EB000050E3EEFFFF1A0400A0E125\r
+S3150001FA002E0000EB000050E3E0FFFF1A041095E51D\r
+S3150001FA10043094E5030051E10100000A000051E3BE\r
+S3150001FA20DCFFFFEA082095E5083094E5030052E182\r
+S3150001FA30F9FFFFCA130000BA0CC085E20C0084E28C\r
+S3150001FA4004209CE5043090E5030052E1F2FFFF8AB1\r
+S3150001FA500300001A0C2095E50C3094E5030052E1F1\r
+S3150001FA60EDFFFF8A042090E504309CE5030052E196\r
+S3150001FA700400008A0500001A0C2094E50C3095E577\r
+S3150001FA80030052E10100009A000051E3CBFFFFEAB7\r
+S3150001FA900000A0E370A81BE9000090E5010050E317\r
+S3150001FAA00000A0830100A0930EF0A0E1000090E504\r
+S3150001FAB0040050E30000A0130100A0030EF0A0E132\r
+S3150001FAC0000090E5020050E30000A0130100A0032E\r
+S3150001FAD00EF0A0E1000052E370402DE920C062E281\r
+S3150001FAE00140A0E10030A0E10060A0E30050A0E3E6\r
+S3150001FAF00800000A00005CE31132A0E100E06CE2BC\r
+S3150001FB000050A0D3106EA0D11052A0C1306C83C199\r
+S3150001FB100640A0E10530A0E10410A0E10300A0E148\r
+S3150001FB207080BDE80C3090E504E02DE50FE0C3E3FD\r
+S3150001FB3050C04EE20020A0E3113482E3113883E382\r
+S3150001FB4002318CE7012082E20A0052E3F9FFFFDA73\r
+S3150001FB501C209FE51330A0E300108CE534E08CE512\r
+S3150001FB603C208CE540308CE538208CE50CC080E5E6\r
+S3150001FB7004F09DE4D84401000DC0A0E100D82DE9B0\r
+S3150001FB8004B04CE278209FE5003092E5013083E233\r
+S3150001FB90003082E56C309FE5002093E5000052E3DA\r
+S3150001FBA09C0080050C00000A0310A0E1020050E150\r
+S3150001FBB00900000A9C2092E5003091E5030052E11C\r
+S3150001FBC0F9FFFF1A020050E138309F150010931516\r
+S3150001FBD09C2091159C2080159C00811524309FE561\r
+S3150001FBE0000083E518209FE5003092E5010053E20D\r
+S3150001FBF0000082150000000A00A81BE94FD9FFEB9F\r
+S3150001FC00FCFFFFEAF4200200E8200200001090E564\r
+S3150001FC1004E02DE5000051E304F09D0400E0A0E3BB\r
+S3150001FC2004F09D0400C091E501005CE104309115EA\r
+S3150001FC300E10A00104308C150420911504108115B5\r
+S3150001FC4000C08215001081150C10A01100E080057E\r
+S3150001FC5000C08015000051E304F09D04F0FFFFEAA7\r
+S3150001FC600030A0E3043080E5083080E50C3080E503\r
+S3150001FC70003080E50EF0A0E10DC0A0E1F0DD2DE938\r
+S3150001FC8004B04CE20040A0E1C8309FE5002093E5B6\r
+S3150001FC90012082E2002083E5083090E508A080E299\r
+S3150001FCA0000053E30030A0130130A003000053E32A\r
+S3150001FCB00A50A0E10900001A0370A0E10560A0E363\r
+S3150001FCC00500A0E1E4D8FFEB7C6080E5787080E573\r
+S3150001FCD034D3FFEB083094E5000053E3F7FFFF1A36\r
+S3150001FCE00C3094E50C8084E2000053E30030A0134D\r
+S3150001FCF00130A003000053E30850A0E10900001AF7\r
+S3150001FD000370A0E10560A0E30500A0E1D2D8FFEBF6\r
+S3150001FD107C6080E5787080E522D3FFEB0C3094E5BA\r
+S3150001FD20000053E3F7FFFF1A28209FE5003092E514\r
+S3150001FD30010053E2000082150400000A0800A0E158\r
+S3150001FD40B1FFFFEB0A00A0E1F06D1BE9AEFFFFEA90\r
+S3150001FD50FAD8FFEBF8FFFFEAF42002000DC0A0E19C\r
+S3150001FD60F0D92DE944219FE504B04CE20050A0E111\r
+S3150001FD7001C0A0E1007092E534619FE5003096E58F\r
+S3150001FD80013083E2003086E5040090E5000050E38F\r
+S3150001FD902C0000DA002095E5010040E2023185E001\r
+S3150001FDA0101093E5012082E2090052E30030A0C35E\r
+S3150001FDB0040085E500108CE5002085E5003085C549\r
+S3150001FDC00C3095E50C0085E2000053E30040A013DA\r
+S3150001FDD00140A003000054E30800000AD0209FE57B\r
+S3150001FDE0003092E5010053E2000082150100000A8D\r
+S3150001FDF00100A0E3F0A91BE9D0D8FFEBFBFFFFEA66\r
+S3150001FE0095D8FFEB0C0095E8032082E0043095E5D8\r
+S3150001FE10441090E5013083E2043085E5090052E3A0\r
+S3150001FE20003091E50A2042C200C0A0E1022185E02E\r
+S3150001FE300710A0E3103082E57C108CE578408CE554\r
+S3150001FE40D8D2FFEBE4FFFFEA441087E5003092E5E4\r
+S3150001FE500140A0E3784083E5002092E50080A0E31D\r
+S3150001FE607C8082E5B1D2FFEB0710A0E1080085E2B4\r
+S3150001FE706AD8FFEB000096E5010040E2AFD8FFEB40\r
+S3150001FE807C1097E5040051E3040000BA050051E334\r
+S3150001FE900840A0D1010000DA060051E30100000A82\r
+S3150001FEA00400A0E1F0A91BE905D4FFEBFBFFFFEA83\r
+S3150001FEB00C8A0200F42002000DC0A0E1F0DF2DE95A\r
+S3150001FEC038A19FE504B04CE204D04DE20190A0E1D7\r
+S3150001FED00360A0E10250A0E10040A0E100809AE5A4\r
+S3150001FEE01C719FE5003097E5013083E2003087E51C\r
+S3150001FEF004C090E500005CE3150000DA002090E5FF\r
+S3150001FF0001C04CE2023180E0012082E2101093E54B\r
+S3150001FF10090052E30030A0C304C080E5001089E562\r
+S3150001FF20002080E5003080C5D8309FE50FE0A0E1D4\r
+S3150001FF3003F0A0E1003097E5010053E200008715C8\r
+S3150001FF400100000A0100A0E3F0AF1BE97BD8FFEB3B\r
+S3150001FF50FBFFFFEA00209AE50330A0E3783082E553\r
+S3150001FF6000109AE500C0A0E37CC081E500009AE597\r
+S3150001FF700C30A0E14C0080E20620A0E10510A0E1D2\r
+S3150001FF8000C08DE53CF0FFEB7C3098E5000053E3C3\r
+S3150001FF901400000A000097E50140A0E3010040E2D9\r
+S3150001FFA066D8FFEB00009AE54C0080E298F0FFEB83\r
+S3150001FFB07C3098E5033043E2030053E303F19F9756\r
+S3150001FFC0040000EAD4FF0100D4FF0100D4FF0100C0\r
+S3150001FFD0E0FF01000040A0E30400A0E1F0AF1BE94F\r
+S3150001FFE0B7D3FFEBFBFFFFEA449088E54FD2FFEB67\r
+S3150001FFF0080084E20810A0E108D8FFEBE4FFFFEA5D\r
+S315000200000C8A0200F4200200980402000DC0A0E14E\r
+S3150002001010D82DE904B04CE201E0A0E180309FE562\r
+S31500020020002093E5012082E2002083E5043090E57A\r
+S31500020030000053E30040A0D30140A0C3000054E3F4\r
+S31500020040012043E20C00000A003090E5042080E51E\r
+S31500020050032180E0101092E5013083E2090053E3A8\r
+S3150002006000108EE5003080E50030A0C3003080C568\r
+S3150002007030309FE50FE0A0E103F0A0E120209FE5EC\r
+S31500020080003092E5013053E20300A0E10030821510\r
+S315000200900100000A0400A0E110A81BE927D8FFEB23\r
+S315000200A0FBFFFFEAF4200200980402000DC0A0E163\r
+S315000200B0F0D92DE904B04CE218C19FE504D04DE217\r
+S315000200C024100BE50050A0E100709CE508619FE555\r
+S315000200D0003096E5013083E2003086E5041090E5B3\r
+S315000200E00A0051E32000000A083090E5080080E289\r
+S315000200F0000053E30040A0130140A003000054E3B4\r
+S315000201001000000A003095E5012081E2013083E00B\r
+S31500020110090053E30A3043C2042085E5032185E042\r
+S3150002012024301BE5103082E5003096E5010053E2EB\r
+S31500020130000086150100000A0100A0E3F0A91BE9F0\r
+S31500020140FED7FFEBFBFFFFEAC3D7FFEB24301BE52D\r
+S3150002015044C090E50720A0E300308CE57C2080E5D2\r
+S31500020160784080E50FD2FFEBEEFFFFEA24304BE248\r
+S31500020170443087E500209CE50140A0E3784082E513\r
+S3150002018000309CE50080A0E37C8083E5E7D1FFEBAD\r
+S315000201900710A0E10C0085E2A0D7FFEB000096E570\r
+S315000201A0010040E2E5D7FFEB7C1097E5040051E33E\r
+S315000201B0040000BA050051E30840A0D1010000DAAC\r
+S315000201C0060051E30100000A0400A0E1F0A91BE9C0\r
+S315000201D03BD3FFEBFBFFFFEA0C8A0200F42002008E\r
+S315000201E00DC0A0E1F0DD2DE968A19FE504B04CE267\r
+S315000201F008D04DE228100BE50040A0E10360A0E123\r
+S315000202000250A0E100809AE54C719FE5003097E527\r
+S31500020210013083E2003087E5041090E50A0051E3DD\r
+S315000202202000000A083090E5080080E2000053E34F\r
+S315000202300050A0130150A003000055E31000000A6D\r
+S31500020240003094E5012081E2013083E0090053E3A6\r
+S315000202500A3043C2042084E5032184E028301BE5EA\r
+S31500020260103082E5003097E5010053E20000871561\r
+S315000202700100000A0100A0E3F0AD1BE9AFD7FFEBD6\r
+S31500020280FBFFFFEA74D7FFEB28301BE544C090E57D\r
+S315000202900720A0E300308CE57C2080E5785080E5DD\r
+S315000202A0C0D1FFEBEEFFFFEA00209AE50330A0E3A0\r
+S315000202B0783082E500109AE500C0A0E37CC081E5B3\r
+S315000202C000009AE50C30A0E14C0080E20620A0E195\r
+S315000202D00510A0E100C08DE567EFFFEB7C3098E5E5\r
+S315000202E0000053E31400000A000097E50140A0E372\r
+S315000202F0010040E291D7FFEB00009AE54C0080E254\r
+S31500020300C3EFFFEB7C3098E5033043E2030053E38F\r
+S3150002031003F19F97040000EA280302002803020063\r
+S3150002032028030200340302000040A0E30400A0E117\r
+S31500020330F0AD1BE9E2D2FFEBFBFFFFEA28304BE20E\r
+S31500020340443088E579D1FFEB0C0084E20810A0E185\r
+S3150002035032D7FFEBE3FFFFEA0C8A0200F420020029\r
+S315000203600DC0A0E170D82DE904B04CE20160A0E115\r
+S31500020370B4409FE5003094E5013083E2003084E525\r
+S31500020380041090E50A0051E31F00000A083090E5C8\r
+S31500020390082080E2000053E30050A0130150A0039E\r
+S315000203A0000055E30F00000A003090E5012081E2CB\r
+S315000203B0013083E0090053E30A3043C2033180E08F\r
+S315000203C0042080E5106083E5003094E5010053E2E5\r
+S315000203D0000084150100000A0100A0E370A81BE9D1\r
+S315000203E056D7FFEBFBFFFFEA0200A0E11AD7FFEBAD\r
+S315000203F0443090E50720A0E3006083E57C2080E599\r
+S31500020400785080E567D1FFEBEEFFFFEA003094E516\r
+S31500020410010053E2000084150100000A0000A0E377\r
+S3150002042070A81BE945D7FFEBFBFFFFEAF4200200A9\r
+S315000204300DC0A0E110D82DE904B04CE250C09FE5F2\r
+S3150002044000309CE5013083E200308CE5043090E513\r
+S31500020450000053E30040A0D30140A0C3000054E3D0\r
+S31500020460003090150331801010209315002081155D\r
+S3150002047000309CE5013053E20300A0E100308C1508\r
+S315000204800100000A0400A0E110A81BE92BD7FFEB2C\r
+S31500020490FBFFFFEAF42002000DC0A0E130D82DE9EF\r
+S315000204A00C3090E50040A0E1000053E30050A01399\r
+S315000204B00150A003000055E304B04CE20C0080E2B8\r
+S315000204C030A81B19E4D6FFEB0C0094E8032082E067\r
+S315000204D0043094E5441090E5013083E2043084E56B\r
+S315000204E0090052E3003091E50A2042C200C0A0E1B1\r
+S315000204F0022184E00710A0E3103082E57C108CE52F\r
+S3150002050078508CE530681BE926D1FFEA0DC0A0E1E0\r
+S3150002051030D82DE904B04CE234409FE500C094E5A2\r
+S3150002052001C08CE200C084E5BEF1FFEB0050A0E101\r
+S31500020530003094E5013053E20300A0E10030841557\r
+S315000205400100000A0500A0E130A81BE9FBD6FFEB7B\r
+S31500020550FBFFFFEAF42002000DC0A0E1F0DF2DE967\r
+S3150002056004B04CE208D04DE20070A0E1F4309FE501\r
+S3150002057000C093E501C08CE200C083E520F1FFEBE9\r
+S3150002058030000BE5103497E5000053E30030A0136A\r
+S315000205900130A003000053E31D00001A28A04BE21D\r
+S315000205A004302AE5418E87E20790A0E30800A0E125\r
+S315000205B0A9D6FFEB446090E50040A0E1001096E565\r
+S315000205C00700A0E1F2EFFFEB0050A0E1000055E3C7\r
+S315000205D00400A0E10410A0E11F00000A0030A0E31D\r
+S315000205E0783084E57C9084E5EED0FFEB045086E516\r
+S315000205F0103497E5000053E3EBFFFF1A2C301BE59E\r
+S315000206000A40A0E1000053E30A00001A0A00A0E132\r
+S315000206107DFDFFEB4C209FE5003092E5010053E2A1\r
+S31500020620000082150100000A30001BE5F0AF1BE94D\r
+S31500020630C2D6FFEBFBFFFFEA0400A0E186D6FFEB82\r
+S315000206400010A0E10800A0E174D6FFEB2C301BE5F8\r
+S31500020650000053E3F7FFFF1AEBFFFFEA0A00A0E1EF\r
+S315000206606ED6FFEBE1FFFFEAF42002000DC0A0E127\r
+S3150002067000D82DE904B04CE21C209FE5003092E53B\r
+S31500020680013053E20300A0E1003082150000000AA7\r
+S3150002069000A81BE9A9D6FFEBFCFFFFEAF420020043\r
+S315000206A00DC0A0E110D82DE904B04CE20040A0E153\r
+S315000206B09AEFFFEB0030A0E3103484E510A81BE9A3\r
+S315000206C00DC0A0E1F0D92DE904B04CE20040A0E152\r
+S315000206D080309FE5002093E5012082E2002083E539\r
+S315000206E0103490E5418E80E2000053E30030A013FF\r
+S315000206F00130A003000053E30850A0E10900001AEC\r
+S315000207000370A0E10560A0E30500A0E152D6FFEB6D\r
+S315000207107C6080E5787080E5A2D0FFEB103494E52A\r
+S31500020720000053E3F7FFFF1A28209FE5003092E509\r
+S31500020730010053E2000082150400000A0800A0E14D\r
+S3150002074014309FE50FE0A0E103F0A0E1F0A91BE958\r
+S315000207507AD6FFEBF8FFFFEAF42002000CFC010058\r
+S31500020760013040E20DC0A0E1100053E330D82DE97C\r
+S3150002077004B04CE20040A0E10500009ADEE9FFEB7E\r
+S315000207800020E0E31630A0E3003080E50200A0E19D\r
+S3150002079030A81BE94DF2FFEB000050E30300001AFC\r
+S315000207A0D5E9FFEB0020E0E30430A0E3F5FFFFEA22\r
+S315000207B048209FE5045192E7010055E30B00000A29\r
+S315000207C0020055E30700000A0130A0E3043182E784\r
+S315000207D043F2FFEB0400A0E10FE0A0E105F0A0E187\r
+S315000207E00020A0E3E8FFFFEA3DF2FFEBFBFFFFEA92\r
+S315000207F03BF2FFEB0400A0E12FF2FFEBF7FFFFEA6B\r
+S315000208001CB0020004E02DE50030A0E1040090E5F2\r
+S31500020810000050E304F09D04003093E5000053E32A\r
+S3110002082004F09D0404E09DE46BDDFFEA99\r
+S3150002082C0000000001000000000000000E0C000099\r
+S3150002083C000600000100000000060000020C000089\r
+S3150002084C010600001E000000010600000E0C00004E\r
+S3150002085C1F060000010000001F060000020C00002B\r
+S3150002086C000800000100000000080000020C000055\r
+S3150002087CFF0F000001000000FF0F00000200000045\r
+S3150002088C39332E3720666D202020000039342E375E\r
+S3150002089C20666D202020000039362E3720666D200A\r
+S315000208AC2020000039372E3120666D2020200000D2\r
+S315000208BC25642E256420666D202020200000000071\r
+S315000208CC5363616E6E696E672E2E2E00256420733D\r
+S315000208DC746174696F6E7320202000005265636F19\r
+S315000208EC7264696E672053746F7020005265636F71\r
+S315000208FC7264696E67205374617274004C50522B89\r
+S3150002090C4C4D52204D6F6465202020005374657245\r
+S3150002091C656F204D6F64652020202000566F6C3A5F\r
+S3150002092C20253033640000004D61726B6572204FD6\r
+S3150002093C666600004D61726B6572204F6E20000078\r
+S3150002094C445249204F666620202020202020200079\r
+S3150002095C445249204F6E20202020202020202000A7\r
+S3150002096C426C61636B20426F78204F6666202020B2\r
+S3150002097C20000000426C61636B20426F78204F6E40\r
+S3150002098C2020202020000000564F4C2B20253033EF\r
+S3150002099C64000000564F4C2D2025303364000000B5\r
+S315000209AC5265633A202530386400000053544D508A\r
+S315000209BC3336303020506C61796572005354464D93\r
+S315000209CC20313030302044656D6F00005369676EFC\r
+S315000209DC616C3D25303564005041535300000000D4\r
+S315000209EC4641494C000000000A746573745F6578D1\r
+S315000209FC69742025732072657475726E20636F6438\r
+S31500020A0C6520646563203D20256420686578203D59\r
+S31500020A1C2025780A0A0000004572726F723A20206D\r
+S31500020A2C25732052656769737465722077726974CF\r
+S31500020A3C65206661696C6564206174206164647208\r
+S31500020A4C65737320307825782E200A095265616405\r
+S31500020A5C2076616C3A20307825782C2045787065A2\r
+S31500020A6C637465642076616C3A2030782578204D63\r
+S31500020A7C61736B2030782578204572726F724269E9\r
+S31500020A8C74733A20307825780A0000004572726F2A\r
+S31500020A9C723A202025732052656769737465722039\r
+S31500020AAC52656164206661696C65642061742061BB\r
+S31500020ABC64647265737320307825782E200A095285\r
+S31500020ACC6561642076616C3A20307825782C204555\r
+S31500020ADC787065637465642076616C3A203078258B\r
+S31500020AEC78204D61736B2030782578204572726FB1\r
+S31500020AFC724269747320307825780A004E65772025\r
+S31500020B0C7472616E64282920736565643A203078A4\r
+S31500020B1C25780A001800000000000000C05D0000E5\r
+S31500020B2C0000000000366E010000000000A8D4553B\r
+S31500020B3C000000000060D71D140000004272617AAA\r
+S31500020B4C6F2076657273696F6E20696E666F726D51\r
+S31500020B5C6174696F6E20697320756E617661696C5A\r
+S31500020B6C61626C6520696E2074686973207379738F\r
+S31500020B7C74656D20636F6E66696775726174696FF1\r
+S31500020B8C6E2E0A004272617A6F2062697466696C13\r
+S31500020B9C6520696E636C7564657320696E666F7227\r
+S31500020BAC6D6174696F6E20697320756E6176616909\r
+S31500020BBC6C61626C6520696E207468697320737946\r
+S31500020BCC7374656D20636F6E66696775726174699D\r
+S31500020BDC6F6E2E0A000000004272617A6F20626903\r
+S31500020BEC7466696C6520696E666F726D6174696F85\r
+S31500020BFC6E20697320756E617661696C61626C65D3\r
+S31500020C0C20696E20746869732073797374656D201C\r
+S31500020C1C636F6E66696775726174696F6E2E0A0010\r
+S31500020C2C00000000010001000000000000000000AE\r
+S31500020C3C00000100E0010000140001011400140080\r
+S31500020C4C0000000004000100706C6C5F6672657136\r
+S31500020C5C203D2025640A0000706C6C206469736167\r
+S31500020C6C626C65640A000000637075636C6B5F648A\r
+S31500020C7C6976203D2025640A0000000068627573BF\r
+S31500020C8C636C6B5F646976203D2025640A00000064\r
+S31500020C9C78627573636C6B5F646976203D2025649C\r
+S31500020CAC0A000000656D69636C6B5F646976203DB2\r
+S31500020CBC2025640A00000000656D69636C6B206474\r
+S31500020CCC697361626C65640A0000000067706D6985\r
+S31500020CDC636C6B5F646976203D2025640A00000014\r
+S31500020CEC67706D69636C6B2064697361626C6564B1\r
+S31500020CFC0A000000737370636C6B5F646976203D47\r
+S31500020D0C2025640A00000000737370636C6B206408\r
+S31500020D1C697361626C65640A000000007370646931\r
+S31500020D2C66636C6B5F646976203D2025640A00005D\r
+S31500020D3C7370646966636C6B2064697361626C655B\r
+S31500020D4C640A000069726F765F646976203D20251D\r
+S31500020D5C640A000069725F646976203D2025640A84\r
+S31500020D6C000000007573625F656E61626C65203D02\r
+S31500020D7C2025640A0000000068627573636C6B5F61\r
+S31500020D8C6175746F736C6F775F72617465203D2049\r
+S31500020D9C25640A00637075636C6B5F696E746572A9\r
+S31500020DAC727570745F77616974203D2025640A0040\r
+S31500020DBC5573657220617373657274696F6E206602\r
+S31500020DCC61696C65643A20222573222C2061742099\r
+S31500020DDC25733A25640A0000655468726561644499\r
+S31500020DEC6174612D3E7468726561645F68616E64DC\r
+S31500020DFC6C6520213D202D31000000002F686F6D9F\r
+S31500020E0C652F616D617274696E2F72657662312F10\r
+S31500020E1C73746D70333630302F76616C69642F744F\r
+S31500020E2C657374732F73616E64626F782F616D6173\r
+S31500020E3C7274696E2F756E69742F6272617A6F2F76\r
+S31500020E4C73645F706C617965722F65746872656123\r
+S31500020E5C642E630065546872656164446174612D25\r
+S31500020E6C3E7468726561645F68616E646C652021AC\r
+S31500020E7C3D2030006554687265616444617461207A\r
+S31500020E8C213D204E554C4C006D7574657820213DE4\r
+S31500020E9C204E554C4C00000073656D6120213D209F\r
+S31500020EAC4E554C4C00000000666C616720213D20BB\r
+S31500020EBC4E554C4C00000000654D61696C426F78D2\r
+S31500020ECC20213D204E554C4C00000000654D6169B9\r
+S31500020EDC6C426F78000000000A4552524F523A207B\r
+S31500020EEC54696D656F75742077616974696E6720D4\r
+S31500020EFC666F7220444D41204368616E6E656C28A4\r
+S31500020F0C732920746F2052657365742E0A000000D3\r
+S31500020F1C6461634465636F646572446174612E64D3\r
+S31500020F2C616342756666657220213D204E554C4CB6\r
+S31500020F3C000000002F686F6D652F616D6172746918\r
+S31500020F4C6E2F72657662312F73746D703336303054\r
+S31500020F5C2F76616C69642F74657374732F73616E6B\r
+S31500020F6C64626F782F616D617274696E2F756E692A\r
+S31500020F7C742F6272617A6F2F73645F706C6179651C\r
+S31500020F8C722F656173796461632E630064616344D5\r
+S31500020F9C65636F646572446174612E6465636F6424\r
+S31500020FAC657242756666657220213D204E554C4C23\r
+S31500020FBC000000006C63646D7574657820213D2019\r
+S31500020FCC4E554C4C000000002F686F6D652F616DFD\r
+S31500020FDC617274696E2F72657662312F73746D70DD\r
+S31500020FEC333630302F76616C69642F746573747383\r
+S31500020FFC2F73616E64626F782F616D617274696EA4\r
+S3150002100C2F756E69742F6272617A6F2F73645F70BB\r
+S3150002101C6C617965722F6C63642E6300300000007C\r
+S3150002102C646174615F726561647920213D204E555D\r
+S3150002103C4C4C00002F686F6D652F616D617274697F\r
+S3150002104C6E2F72657662312F73746D703336303053\r
+S3150002105C2F76616C69642F74657374732F73616E6A\r
+S3150002106C64626F782F616D617274696E2F756E6929\r
+S3150002107C742F6272617A6F2F73645F706C6179651B\r
+S3150002108C722F627574746F6E732E6300646D616D6C\r
+S3150002109C7574657820213D204E554C4C000000009D\r
+S315000210AC2F686F6D652F616D617274696E2F726533\r
+S315000210BC7662312F73746D70333630302F76616CE5\r
+S315000210CC69642F74657374732F73616E64626F78BF\r
+S315000210DC2F616D617274696E2F756E69742F6272EF\r
+S315000210EC617A6F2F73645F706C617965722F646DB0\r
+S315000210FC615F6D656D6370792E630000E00100001F\r
+S3150002110C05000C01000000000000000000000100B8\r
+S3150002111C2F6465762F747479646961670000000028\r
+S3150002112C2F6465762F68616C646961670000000044\r
+S3150002113C082008000D0A000025730A0068616C6419\r
+S3150002114C6961675F7365745F636F6E6669670000DA\r
+S3150002115C30313233343536373839414243444546D9\r
+S3150002116C00000000303132333435363738394142DB\r
+S3150002117C43444546000000003031323334353637AD\r
+S3150002118C383900003031323334353637383961620A\r
+S3150002119C63646566000000003C6E756C6C3E000074\r
+S315000211AC3C4E6F74206120737472696E673A2030FC\r
+S315000211BC780000003E0000003C42616420666F72BB\r
+S315000211CC6D617420737472696E673A2000000000B8\r
+S315000211DC203A00003E0A0000253038583A2000001A\r
+S315000211EC2530325820000000207C000025630000C8\r
+S315000211FC7C0A0000253038582000000020202020D0\r
+S3150002120C2020202020000000253034582000000029\r
+S3150002121C49646C6520546872656164007265616428\r
+S3150002122C790000002C205072696F726974793A2029\r
+S3150002123C00000000736C656570696E670000000043\r
+S3150002124C636F756E74656420736C6565700000005F\r
+S3150002125C6372656174696E6700000000756E6B6E71\r
+S3150002126C6F776E207374617465000000657869741B\r
+S3150002127C6564000073757370656E6465642B00009B\r
+S3150002128C72756E6E696E67006D61696E00000000A4\r
+S3150002129C8CAF020073747264657600006275672007\r
+S315000212AC696E2076667072696E74663A2062616443\r
+S315000212BC2062617365000000286E756C6C29000053\r
+S315000212CC0101010101010101808080808080808002\r
+S315000212DC0000F03F00000000C808020000000000F9\r
+S315000212EC00000000000000000000000000000000EA\r
+S315000212FC00000000000102020303030304040404B9\r
+S3150002130C040404040505050505050505050505057D\r
+S3150002131C050505050606060606060606060606065D\r
+S3150002132C0606060606060606060606060606060649\r
+S3150002133C060606060707070707070707070707072D\r
+S3150002134C0707070707070707070707070707070719\r
+S3150002135C0707070707070707070707070707070709\r
+S3150002136C07070707070707070707070707070707F9\r
+S3150002137C07070707080808080808080808080808DD\r
+S3150002138C08080808080808080808080808080808C9\r
+S3150002139C08080808080808080808080808080808B9\r
+S315000213AC08080808080808080808080808080808A9\r
+S315000213BC0808080808080808080808080808080899\r
+S315000213CC0808080808080808080808080808080889\r
+S315000213DC0808080808080808080808080808080879\r
+S315000213EC0808080808080808080808080808080869\r
+S309000213FC08080808C5\r
+S3150002140000000000A8210100A8210100A821010076\r
+S31500021410A8210100A8210100A8210100A82101009C\r
+S31500021420A8210100A8210100A8210100A82101008C\r
+S31500021430A8210100A8210100A8210100A82101007C\r
+S31500021440A8210100A8210100A8210100A82101006C\r
+S31500021450A8210100A8210100A8210100A82101005C\r
+S31500021460A8210100A8210100A8210100A82101004C\r
+S31500021470A8210100A8210100A8210100A82101003C\r
+S31500021480A8210100A8210100A8210100A82101002C\r
+S31500021490A8210100A8210100A8210100A82101001C\r
+S315000214A0A8210100A8210100A8210100A82101000C\r
+S315000214B0A8210100A8210100A8210100A8210100FC\r
+S315000214C0A8210100A8210100A8210100A8210100EC\r
+S315000214D0A8210100A8210100A8210100A8210100DC\r
+S315000214E0A8210100A8210100A8210100A8210100CC\r
+S315000214F0A8210100A8210100A8210100A8210100BC\r
+S31500021500A8210100A821010000000000000000003F\r
+S3150002151000000000000000000000000000000000C3\r
+S3150002152000000000000000000000000000000000B3\r
+S3150002153000000000000000000000000000000000A3\r
+S315000215400000000000000000000000000000000093\r
+S315000215500000000000000000000000000000000083\r
+S315000215600000000000000000000000000000000073\r
+S315000215700000000000000000000000000000000063\r
+S315000215800000000000000000000000000000000053\r
+S315000215900000000000000000000000000000000043\r
+S315000215A00000000000000000000000000000000033\r
+S315000215B00000000000000000000000000000000023\r
+S315000215C00000000000000000000000000000000013\r
+S315000215D00000000000000000000000000000000003\r
+S315000215E000000000000000000000000000000000F3\r
+S315000215F000000000000000000000000000000000E3\r
+S3150002160000000000000000000000000000000000D2\r
+S3150002161000000000000000000000000000000000C2\r
+S3150002162000000000000000000000000000000000B2\r
+S3150002163000000000000000000000000000000000A2\r
+S315000216400000000000000000000000000000000092\r
+S315000216500000000000000000000000000000000082\r
+S315000216600000000000000000000000000000000072\r
+S315000216700000000000000000000000000000000062\r
+S315000216800000000000000000000000000000000052\r
+S315000216900000000000000000000000000000000042\r
+S315000216A00000000000000000000000000000000032\r
+S315000216B00000000000000000000000000000000022\r
+S315000216C00000000000000000000000000000000012\r
+S315000216D00000000000000000000000000000000002\r
+S315000216E000000000000000000000000000000000F2\r
+S315000216F000000000000000000000000000000000E2\r
+S3150002170000000000000000000000000000000000D1\r
+S31500021710A903000001000000000000000000000014\r
+S31500021720010000000000406000000000FFFF000012\r
+S31500021730000000000100000001000000000000009F\r
+S315000217400000000000000000D0000000D0000000F1\r
+S315000217500000000000000000000000000000000081\r
+S315000217600000000000000000010000000000000070\r
+S31500021770000000002F40A6A4C823A08121AFFF00CD\r
+S315000217800000000000065F06000003000300147E4E\r
+S31500021790147E14002E6B3A006636186C667749364C\r
+S315000217A050480000040703001C6341000041631C0B\r
+S315000217B00066187E186600103810000080E060008F\r
+S315000217C0000808080000606000006030180C063E41\r
+S315000217D0615D433E02017F0000426151494642413A\r
+S315000217E0494936001C127F102F454549313E4B4967\r
+S315000217F0493003611109073649494936464949299B\r
+S315000218001E0036360000008076360008142241009B\r
+S315000218101414141400412214080002016D05033C3D\r
+S31500021820425A1A1C7C1211127C7F494949363E41A2\r
+S315000218304141227F4141413E7F494949417F090950\r
+S3150002184009013E414949717F0808087F41417F41AC\r
+S315000218504170417F01007F081422417F4040404091\r
+S315000218607F020C027F7F021C207F3E4141413E7F68\r
+S31500021870090909063E4141617E7F091929462E4919\r
+S3150002188049493201017F01013F4040403F031C604C\r
+S315000218901C030F700C700F6314081463030C700C96\r
+S315000218A0036151494543007F414100060C183060EF\r
+S315000218B00041417F000406030604404040404003C5\r
+S315000218C00704000038442478007F2844380038444E\r
+S315000218D04444003844283F003854544800107C12CF\r
+S315000218E012004C4A4A3C007E1008700000007A0042\r
+S315000218F00020403A00007E1824000000007E00000E\r
+S3150002190078083008787C0804780038444438007E29\r
+S3150002191012221C001C12127E007C080404005C5475\r
+S31500021920740000087E4820003C40407C001C204099\r
+S31500021930201C3C4038403C44281028440C90503C23\r
+S315000219400064544C44000836414100000077000010\r
+S315000219504141360800020102010002016D05030041\r
+S315000219602E008200000000000000000000000000BF\r
+S31500021970000000000000000000008300C900000013\r
+S31500021980000000000000000000000000000000004F\r
+S3150002199000000000CA002201000000000000000052\r
+S315000219A0000000000000000000000000000023010B\r
+S315000219B0840100000000000000000000000000009A\r
+S315000219C000000000000000008501CE0100000000BA\r
+S315000219D000000000000000000000000000000000FF\r
+S315000219E00000CF011E0200000000000000000000FF\r
+S315000219F00000000000000000000000001F026F024D\r
+S31500021A0000000000000000000000000000000000CE\r
+S31500021A100000000000007002BB020000000000008F\r
+S31500021A2000000000000000000000000000000000AE\r
+S31500021A30BC021203000000000000000000000000CB\r
+S31500021A40000000000000000000001303690300000C\r
+S31500021A50000000000000000000000000000000007E\r
+S31500021A60000000006A03A20300000000000000005C\r
+S31500021A70000000000000000000000000000000005E\r
+S31500021A80000000000000000000000000000000004E\r
+S31500021A90000000000000000000000000000000003E\r
+S31500021AA0000000000000000000000000000000002E\r
+S31500021AB00000000000000000000000009DFFFFFF84\r
+S31500021AC00000000000000000E0010000100000001D\r
+S31500021AD002000000C70100000D0000000200000025\r
+S31500021AE0E00100000C00000002000000C20100003C\r
+S31500021AF00A00000002000000C20100000900000006\r
+S31500021B0003000000B8010000080000000300000006\r
+S31500021B10E00100000800000003000000C701000009\r
+S31500021B200700000003000000A401000006000000F8\r
+S31500021B3003000000C20100000600000004000000CD\r
+S31500021B40E00100000600000004000000A9010000F8\r
+S31500021B500500000004000000C201000005000000AC\r
+S31500021B6004000000DB010000050000000400000084\r
+S31500021B70900100000400000005000000A40100001E\r
+S31500021B800400000005000000B80100000400000087\r
+S31500021B9005000000CC010000040000000500000062\r
+S31500021BA0E0010000040000000500000077010000CB\r
+S31500021BB0030000000600000086010000030000008A\r
+S31500021BC00600000095010000030000000600000068\r
+S31500021BD0A40100000300000006000000B30100009B\r
+S31500021BE00300000006000000C2010000030000001E\r
+S31500021BF007000000D10100000300000007000000FA\r
+S31500021C00E001000003000000070000004A01000096\r
+S31500021C10020000000700000054010000020000005C\r
+S31500021C20070000005E01000002000000080000003C\r
+S31500021C3068010000020000000800000072010000B6\r
+S31500021C4002000000080000007C0100000200000003\r
+S31500021C5008000000860100000200000008000000E3\r
+S31500021C609001000002000000090000009A01000035\r
+S31500021C700200000009000000A401000002000000AA\r
+S31500021C800900000000000000000000000000000043\r
+S31500021C90000000000000000000000000000000003C\r
+S31500021CA0000000000000000000000000000000002C\r
+S31500021CB0BA4A0400FB39D11BBC4A04003D69E11B48\r
+S31500021CC0BE4A04007F98F11BC14A0400C2C7011C28\r
+S31500021CD0C34A040004F7111CC54A04004626221C06\r
+S31500021CE0C74A04008955321CC94A0400CB84421CE7\r
+S31500021CF0CB4A04000DB4521CCD4A040050E3621CC8\r
+S31500021D00C04C0400A969B31BD24C0400E32BC31BCD\r
+S31500021D10D44C04001DEED21BD64C040056B0E21B76\r
+S31500021D20D84C04009072F21BDA4C0400CA34021C2E\r
+S31500021D30DC4C040004F7111CDE4C04003EB9211CE5\r
+S31500021D40E14C0400787B311CE34C0400B13D411C9C\r
+S31500021D50E54C0400EBFF501CE74C040025C2601C56\r
+S31500021D60E94E04004FD6B51BEB4E04001831C51BD5\r
+S31500021D70ED4E0400E18BD41BE04E0400AAE6E31B01\r
+S31500021D80F24E04007241F31BF44E04003B9C021C0B\r
+S31500021D90F64E040004F7111CF84E0400CD51211C26\r
+S31500021DA0FA4E040096AC301CFC4E04005E07401C42\r
+S31500021DB0FE4E040027624F1C014F0400F0BC5E1C5D\r
+S31500021DC003510400EE23B81B05510400711CC71B06\r
+S31500021DD007510400F514D61B09510400790DE51BC1\r
+S31500021DE00B510400FD05F41B0D51040080FE021C7C\r
+S31500021DF00051040004F7111C1251040088EF201C44\r
+S31500021E00145104000BE82F1C165104008FE03E1CEF\r
+S31500021E101851040013D94D1C1A51040097D15C1CA9\r
+S31500021E201C530400C954BA1B1E530400D3EFC81B2B\r
+S31500021E3021530400DC8AD71B23530400E625E61B44\r
+S31500021E4025530400F0C0F41B27530400FA5B031C5D\r
+S31500021E502953040004F7111C2B5304000E92201C74\r
+S31500021E602D530400182D2F1C2053040022C83D1C9C\r
+S31500021E70325304002C634C1C3453040035FE5A1CA6\r
+S31500021E8036550400EF6ABC1B38550400F2ACCA1B77\r
+S31500021E903A550400F6EED81B3C550400F930E71B10\r
+S31500021EA03E550400FD72F51B4155040000B5031CA6\r
+S31500021EB04355040004F7111C455504000839201C3B\r
+S31500021EC0475504000B7B2E1C495504000FBD3C1CD4\r
+S31500021ED04B55040012FF4A1C4D5504001641591C6D\r
+S31500021EE0405704003C68BE1B525704005E55CC1B8B\r
+S31500021EF0545704007F42DA1B56570400A02FE81BF2\r
+S31500021F0058570400C11CF61B5A570400E309041C67\r
+S31500021F105C57040004F7111C5E57040025E41F1CDD\r
+S31500021F206157040046D12D1C6357040068BE3B1C52\r
+S31500021F306557040089AB491C67570400AA98571CC9\r
+S31500021F4069590400644EC01B6B5904007FEACD1B1D\r
+S31500021F506D5904009986DB1B60590400B422E91B03\r
+S31500021F6072590400CFBEF61B74590400E95A041CC8\r
+S31500021F707659040004F7111C785904001F931F1C9C\r
+S31500021F807A590400392F2D1C7C59040054CB3A1C73\r
+S31500021F907E5904006F67481C815904008903561C48\r
+S31500021FA0835B0400F01EC21B855B04009E6DCF1B83\r
+S31500021FB0875B04004CBCDC1B895B0400FA0AEA1B43\r
+S31500021FC08B5B0400A859F71B8D5B040056A8041C02\r
+S31500021FD0805B040004F7111CB40D0100280F0100F8\r
+S31500021FE05C26010064260100581001006010010001\r
+S31500021FF034130100100D01005813010030140100C2\r
+S31500022000CC140100CC1501005C26010064260100F7\r
+S315000220103C17010050170100B41701002C180100EB\r
+S315000220204C1801006C1801000000000000000000BE\r
+S315000220301C200200F41F0200DC80020012000000D5\r
+S31500022040010000000000000008000000000000007F\r
+S315000220500000000000000000000000000000000078\r
+S315000220600000000000000000000000000000000068\r
+S315000220700000000000000000000000000000000058\r
+S315000220800000000000000000000000000000000048\r
+S315000220900000000000000000000000000000000038\r
+S315000220A00000000000000000000000000000000028\r
+S315000220B00000000000000000000000000000000018\r
+S315000220C00000000000000000000000000000000008\r
+S315000220D000000000000000000000000000000000F8\r
+S315000220E000000000DC2601000000000001000000E4\r
+S315000220F0300000000100000064210200D88A0200BC\r
+S3150002210000000000000000000000000000000000C7\r
+S3150002211000000000000000000000000000000000B7\r
+S3150002212000000000008F0100000000005C26010094\r
+S31500022130642601000000000000000000000000000C\r
+S315000221402020202020202020202020202020202087\r
+S315000221503030303030303030303030303030303077\r
+S3150002216000000000000000000300050007000B004D\r
+S315000221700D001100130017001D001F002500290085\r
+S315000221802B002F0035003B003D004300470049006D\r
+S315000221904F00530059006100650067006B006D0037\r
+S315000221A071007F00830089008B00950097009D00D7\r
+S315000221B0A300A700AD00B300B500BF00C100C50073\r
+S315000221C0C700EF001D02830600E1F505640000006A\r
+S315000221D01C1102002C11020000200200A4140100AE\r
+S315000221E0B8140100D0800200001000002C11020079\r
+S315000221F000000000D81F02001018010000000000B5\r
+S3150002220030200200001000003C820100DC180100B0\r
+S31500022210E4800100BC82010064D10100F80C0100D7\r
+S3150002222018800100485501007CC401005C5601007B\r
+S31500022230F45A01003C640100D037010054820100C7\r
+S31500022240FC800100D48201007CD1010030800100B3\r
+S315000222506055010094C401000C5B01005464010046\r
+S31560000000000000000000000000000000000000008A\r
+S31560000010000000000000000000000000000000007A\r
+S31560000020000000000000000000000000000000006A\r
+S31560000030000000000000000000000000000000005A\r
+S3156000004000000000CA1062006003006062001E00CB\r
+S31560000050000000000000000000000000000000003A\r
+S31560000060000000000000000000000000000000002A\r
+S31560000070000000000000000000000000000000001A\r
+S31560000080000000000000000000000000000000000A\r
+S3156000009000000000000000000000000000000000FA\r
+S315600000A000000000000000000000000000000000EA\r
+S315600000B000000000000000000000000000000000DA\r
+S315600000C000000000000000000000000000000000CA\r
+S315600000D000000000000000000000000000000000BA\r
+S315600000E000000000000000000000000000000000AA\r
+S315600000F0000000000000000000000000000000009A\r
+S315600001000000000000000000000000000000000089\r
+S315600001100000000000000000000000000000000079\r
+S315600001200000000000000000000000000000000069\r
+S315600001300000000000000000000000000000000059\r
+S315600001400000000000000000000000000000000049\r
+S315600001500000000000000000000000000000000039\r
+S315600001600000000000000000000000000000000029\r
+S315600001700000000000000000000000000000000019\r
+S315600001800000000000000000000000000000000009\r
+S3156000019000000000000000000000000000000000F9\r
+S315600001A000000000000000000000000000000000E9\r
+S315600001B000000000000000000000000000000000D9\r
+S315600001C000000000000000000000000000000000C9\r
+S315600001D000000000000000000000000000000000B9\r
+S315600001E000000000000000000000000000000000A9\r
+S315600001F00000000000000000000000000000000099\r
+S315600002000000000000000000000000000000000088\r
+S315600002100000000000000000000000000000000078\r
+S315600002200000000000000000000000000000000068\r
+S315600002300000000000000000000000000000000058\r
+S315600002400000000000000000000000000000000048\r
+S315600002500000000000000000000000000000000038\r
+S315600002600000000000000000000000000000000028\r
+S315600002700000000000000000000000000000000018\r
+S315600002800000000000000000000000000000000008\r
+S3156000029000000000000000000000000000000000F8\r
+S315600002A000000000000000000000000000000000E8\r
+S315600002B000000000000000000000000000000000D8\r
+S315600002C000000000000000000000000000000000C8\r
+S315600002D000000000000000000000000000000000B8\r
+S315600002E000000000000000000000000000000000A8\r
+S315600002F00000000000000000000000000000000098\r
+S315600003000000000000000000000000000000000087\r
+S315600003100000000000000000000000000000000077\r
+S315600003200000000000000000000000000000000067\r
+S315600003300000000000000000000000000000000057\r
+S315600003400000000000000000000000000000000047\r
+S315600003500000000000000000000000000000000037\r
+S315600003600000000000000000000000000000000027\r
+S315600003700000000000000000000000000000000017\r
+S315600003800000000000000000000000000000000007\r
+S3156000039000000000000000000000000000000000F7\r
+S315600003A000000000000000000000000000000000E7\r
+S315600003B000000000000000000000000000000000D7\r
+S315600003C000000000000000000000000000000000C7\r
+S315600003D000000000000000000000000000000000B7\r
+S315600003E000000000000000000000000000000000A7\r
+S315600003F00000000000000000000000000000000097\r
+S315600004000000000000000000000000000000000086\r
+S315600004100000000000000000000000000000000076\r
+S315600004200000000000000000000000000000000066\r
+S315600004300000000000000000000000000000000056\r
+S315600004400000000000000000000000000000000046\r
+S315600004500000000000000000000000000000000036\r
+S315600004600000000000000000000000000000000026\r
+S315600004700000000000000000000000000000000016\r
+S315600004800000000000000000000000000000000006\r
+S3156000049000000000000000000000000000000000F6\r
+S315600004A000000000000000000000000000000000E6\r
+S315600004B000000000000000000000000000000000D6\r
+S315600004C000000000000000000000000000000000C6\r
+S315600004D000000000000000000000000000000000B6\r
+S315600004E000000000000000000000000000000000A6\r
+S315600004F00000000000000000000000000000000096\r
+S315600005000000000000000000000000000000000085\r
+S315600005100000000000000000000000000000000075\r
+S315600005200000000000000000000000000000000065\r
+S315600005300000000000000000000000000000000055\r
+S315600005400000000000000000000000000000000045\r
+S315600005500000000000000000000000000000000035\r
+S315600005600000000000000000000000000000000025\r
+S315600005700000000000000000000000000000000015\r
+S315600005800000000000000000000000000000000005\r
+S3156000059000000000000000000000000000000000F5\r
+S315600005A000000000000000000000000000000000E5\r
+S315600005B000000000000000000000000000000000D5\r
+S315600005C000000000000000000000000000000000C5\r
+S315600005D000000000000000000000000000000000B5\r
+S315600005E000000000000000000000000000000000A5\r
+S315600005F00000000000000000000000000000000095\r
+S315600006000000000000000000000000000000000084\r
+S315600006100000000000000000000000000000000074\r
+S315600006200000000000000000000000000000000064\r
+S315600006300000000000000000000000000000000054\r
+S315600006400000000000000000000000000000000044\r
+S315600006500000000000000000000000000000000034\r
+S315600006600000000000000000000000000000000024\r
+S315600006700000000000000000000000000000000014\r
+S315600006800000000000000000000000000000000004\r
+S3156000069000000000000000000000000000000000F4\r
+S315600006A000000000000000000000000000000000E4\r
+S315600006B000000000000000000000000000000000D4\r
+S315600006C000000000000000000000000000000000C4\r
+S315600006D000000000000000000000000000000000B4\r
+S315600006E000000000000000000000000000000000A4\r
+S315600006F00000000000000000000000000000000094\r
+S315600007000000000000000000000000000000000083\r
+S315600007100000000000000000000000000000000073\r
+S315600007200000000000000000000000000000000063\r
+S315600007300000000000000000000000000000000053\r
+S315600007400000000000000000000000000000000043\r
+S315600007500000000000000000000000000000000033\r
+S315600007600000000000000000000000000000000023\r
+S315600007700000000000000000000000000000000013\r
+S315600007800000000000000000000000000000000003\r
+S3156000079000000000000000000000000000000000F3\r
+S315600007A000000000000000000000000000000000E3\r
+S315600007B000000000000000000000000000000000D3\r
+S315600007C000000000000000000000000000000000C3\r
+S315600007D000000000000000000000000000000000B3\r
+S315600007E000000000000000000000000000000000A3\r
+S315600007F00000000000000000000000000000000093\r
+S315600008000000000000000000000000000000000082\r
+S315600008100000000000000000000000000000000072\r
+S315600008200000000000000000000000000000000062\r
+S315600008300000000000000000000000000000000052\r
+S315600008400000000000000000000000000000000042\r
+S315600008500000000000000000000000000000000032\r
+S315600008600000000000000000000000000000000022\r
+S315600008700000000000000000000000000000000012\r
+S315600008800000000000000000000000000000000002\r
+S3156000089000000000000000000000000000000000F2\r
+S315600008A000000000000000000000000000000000E2\r
+S315600008B000000000000000000000000000000000D2\r
+S315600008C000000000000000000000000000000000C2\r
+S315600008D000000000000000000000000000000000B2\r
+S315600008E000000000000000000000000000000000A2\r
+S315600008F00000000000000000000000000000000092\r
+S315600009000000000000000000000000000000000081\r
+S315600009100000000000000000000000000000000071\r
+S315600009200000000000000000000000000000000061\r
+S315600009300000000000000000000000000000000051\r
+S315600009400000000000000000000000000000000041\r
+S315600009500000000000000000000000000000000031\r
+S315600009600000000000000000000000000000000021\r
+S315600009700000000000000000000000000000000011\r
+S315600009800000000000000000000000000000000001\r
+S3156000099000000000000000000000000000000000F1\r
+S315600009A000000000000000000000000000000000E1\r
+S315600009B000000000000000000000000000000000D1\r
+S315600009C000000000000000000000000000000000C1\r
+S315600009D000000000000000000000000000000000B1\r
+S315600009E000000000000000000000000000000000A1\r
+S315600009F00000000000000000000000000000000091\r
+S31560000A000000000000000000000000000000000080\r
+S31560000A100000000000000000000000000000000070\r
+S31560000A200000000000000000000000000000000060\r
+S31560000A300000000000000000000000000000000050\r
+S31560000A400000000000000000000000000000000040\r
+S31560000A500000000000000000000000000000000030\r
+S31560000A600000000000000000000000000000000020\r
+S31560000A700000000000000000000000000000000010\r
+S31560000A800000000000000000000000000000000000\r
+S31560000A9000000000000000000000000000000000F0\r
+S31560000AA000000000000000000000000000000000E0\r
+S31560000AB000000000000000000000000000000000D0\r
+S31560000AC000000000000000000000000000000000C0\r
+S31560000AD000000000000000000000000000000000B0\r
+S31560000AE000000000000000000000000000000000A0\r
+S31560000AF00000000000000000000000000000000090\r
+S31560000B00000000000000000000000000000000007F\r
+S31560000B10000000000000000000000000000000006F\r
+S31560000B20000000000000000000000000000000005F\r
+S31560000B30000000000000000000000000000000004F\r
+S31560000B40000000000000000000000000000000003F\r
+S31560000B50000000000000000000000000000000002F\r
+S31560000B60000000000000000000000000000000001F\r
+S31560000B70000000000000000000000000000000000F\r
+S31560000B8000000000000000000000000000000000FF\r
+S31560000B9000000000000000000000000000000000EF\r
+S31560000BA000000000000000000000000000000000DF\r
+S31560000BB000000000000000000000000000000000CF\r
+S31560000BC000000000000000000000000000000000BF\r
+S31560000BD000000000000000000000000000000000AF\r
+S31560000BE0000000000000000000000000000000009F\r
+S31560000BF0000000000000000000000000000000008F\r
+S31560000C00000000000000000000000000000000007E\r
+S31560000C10000000000000000000000000000000006E\r
+S31560000C20000000000000000000000000000000005E\r
+S31560000C30000000000000000000000000000000004E\r
+S31560000C40000000000000000000000000000000003E\r
+S31560000C50000000000000000000000000000000002E\r
+S31560000C60000000000000000000000000000000001E\r
+S31560000C70000000000000000000000000000000000E\r
+S31560000C8000000000000000000000000000000000FE\r
+S31560000C9000000000000000000000000000000000EE\r
+S31560000CA000000000000000000000000000000000DE\r
+S31560000CB000000000000000000000000000000000CE\r
+S31560000CC000000000000000000000000000000000BE\r
+S31560000CD000000000000000000000000000000000AE\r
+S31560000CE0000000000000000000000000000000009E\r
+S31560000CF0000000000000000000000000000000008E\r
+S31560000D00000000000000000000000000000000007D\r
+S31560000D10000000000000000000000000000000006D\r
+S31560000D20000000000000000000000000000000005D\r
+S31560000D30000000000000000000000000000000004D\r
+S31560000D40000000000000000000000000000000003D\r
+S31560000D50000000000000000000000000000000002D\r
+S31560000D60000000000000000000000000000000001D\r
+S31560000D70000000000000000000000000000000000D\r
+S31560000D8000000000000000000000000000000000FD\r
+S31560000D9000000000000000000000000000000000ED\r
+S31560000DA000000000000000000000000000000000DD\r
+S31560000DB000000000000000000000000000000000CD\r
+S31560000DC000000000000000000000000000000000BD\r
+S31560000DD000000000000000000000000000000000AD\r
+S31560000DE0000000000000000000000000000000009D\r
+S31560000DF0000000000000000000000000000000008D\r
+S31560000E00000000000000000000000000000000007C\r
+S31560000E10000000000000000000000000000000006C\r
+S31560000E20000000000000000000000000000000005C\r
+S31560000E30000000000000000000000000000000004C\r
+S31560000E40000000000000000000000000000000003C\r
+S31560000E50000000000000000000000000000000002C\r
+S31560000E60000000000000000000000000000000001C\r
+S31560000E70000000000000000000000000000000000C\r
+S31560000E8000000000000000000000000000000000FC\r
+S31560000E9000000000000000000000000000000000EC\r
+S31560000EA000000000000000000000000000000000DC\r
+S31560000EB000000000000000000000000000000000CC\r
+S31560000EC000000000000000000000000000000000BC\r
+S31560000ED000000000000000000000000000000000AC\r
+S31560000EE0000000000000000000000000000000009C\r
+S31560000EF0000000000000000000000000000000008C\r
+S31560000F00000000000000000000000000000000007B\r
+S31560000F10000000000000000000000000000000006B\r
+S31560000F20000000000000000000000000000000005B\r
+S31560000F30000000000000000000000000000000004B\r
+S31560000F40000000000000000000000000000000003B\r
+S31560000F50000000000000000000000000000000002B\r
+S31560000F60000000000000000000000000000000001B\r
+S31560000F70000000000000000000000000000000000B\r
+S31560000F8000000000000000000000000000000000FB\r
+S31560000F9000000000000000000000000000000000EB\r
+S31560000FA000000000000000000000000000000000DB\r
+S31560000FB000000000000000000000000000000000CB\r
+S31560000FC000000000000000000000000000000000BB\r
+S31560000FD000000000000000000000000000000000AB\r
+S31560000FE0000000000000000000000000000000009B\r
+S31560000FF0000000000000000000000000000000008B\r
+S31560001000000000000000000000000000000000007A\r
+S31560001010000000000000000000000000000000006A\r
+S31560001020000000000000000000000000000000005A\r
+S31560001030000000000000000000000000000000004A\r
+S31560001040000000000000000000000000000000003A\r
+S31560001050000000000000000000000000000000002A\r
+S31560001060000000000000000000000000000000001A\r
+S31560001070000000000000000000000000000000000A\r
+S3156000108000000000000000000000000000000000FA\r
+S3156000109000000000000000000000000000000000EA\r
+S315600010A000000000000000000000000000000000DA\r
+S315600010B000000000000000000000000000000000CA\r
+S315600010C000000000000000000000000000000000BA\r
+S315600010D000000000000000000000000000000000AA\r
+S315600010E0000000000000000000000000000000009A\r
+S315600010F0000000000000000000000000000000008A\r
+S315600011000000000000000000000000000000000079\r
+S315600011100000000000000000000000000000000069\r
+S315600011200000000000000000000000000000000059\r
+S315600011300000000000000000000000000000000049\r
+S315600011400000000000000000000000000000000039\r
+S315600011500000000000000000000000000000000029\r
+S315600011600000000000000000000000000000000019\r
+S315600011700000000000000000000000000000000009\r
+S3156000118000000000000000000000000000000000F9\r
+S3156000119000000000000000000000000000000000E9\r
+S315600011A000000000000000000000000000000000D9\r
+S315600011B000000000000000000000000000000000C9\r
+S315600011C000000000000000000000000000000000B9\r
+S315600011D000000000000000000000000000000000A9\r
+S315600011E00000000000000000000000000000000099\r
+S315600011F00000000000000000000000000000000089\r
+S315600012000000000000000000000000000000000078\r
+S315600012100000000000000000000000000000000068\r
+S315600012200000000000000000000000000000000058\r
+S315600012300000000000000000000000000000000048\r
+S315600012400000000000000000000000000000000038\r
+S315600012500000000000000000000000000000000028\r
+S315600012600000000000000000000000000000000018\r
+S315600012700000000000000000000000000000000008\r
+S3156000128000000000000000000000000000000000F8\r
+S3156000129000000000000000000000000000000000E8\r
+S315600012A000000000000000000000000000000000D8\r
+S315600012B000000000000000000000000000000000C8\r
+S315600012C000000000000000000000000000000000B8\r
+S315600012D000000000000000000000000000000000A8\r
+S315600012E00000000000000000000000000000000098\r
+S315600012F00000000000000000000000000000000088\r
+S315600013000000000000000000000000000000000077\r
+S315600013100000000000000000000000000000000067\r
+S315600013200000000000000000000000000000000057\r
+S315600013300000000000000000000000000000000047\r
+S315600013400000000000000000000000000000000037\r
+S315600013500000000000000000000000000000000027\r
+S315600013600000000000000000000000000000000017\r
+S315600013700000000000000000000000000000000007\r
+S3156000138000000000000000000000000000000000F7\r
+S3156000139000000000000000000000000000000000E7\r
+S315600013A000000000000000000000000000000000D7\r
+S315600013B000000000000000000000000000000000C7\r
+S315600013C000000000000000000000000000000000B7\r
+S315600013D000000000000000000000000000000000A7\r
+S315600013E00000000000000000000000000000000097\r
+S315600013F00000000000000000000000000000000087\r
+S315600014000000000000000000000000000000000076\r
+S315600014100000000000000000000000000000000066\r
+S315600014200000000000000000000000000000000056\r
+S315600014300000000000000000000000000000000046\r
+S315600014400000000000000000000000000000000036\r
+S315600014500000000000000000000000000000000026\r
+S315600014600000000000000000000000000000000016\r
+S315600014700000000000000000000000000000000006\r
+S3156000148000000000000000000000000000000000F6\r
+S3156000149000000000000000000000000000000000E6\r
+S315600014A000000000000000000000000000000000D6\r
+S315600014B000000000000000000000000000000000C6\r
+S315600014C000000000000000000000000000000000B6\r
+S315600014D000000000000000000000000000000000A6\r
+S315600014E00000000000000000000000000000000096\r
+S315600014F00000000000000000000000000000000086\r
+S315600015000000000000000000000000000000000075\r
+S315600015100000000000000000000000000000000065\r
+S315600015200000000000000000000000000000000055\r
+S315600015300000000000000000000000000000000045\r
+S315600015400000000000000000000000000000000035\r
+S315600015500000000000000000000000000000000025\r
+S315600015600000000000000000000000000000000015\r
+S315600015700000000000000000000000000000000005\r
+S3156000158000000000000000000000000000000000F5\r
+S3156000159000000000000000000000000000000000E5\r
+S315600015A000000000000000000000000000000000D5\r
+S315600015B000000000000000000000000000000000C5\r
+S315600015C000000000000000000000000000000000B5\r
+S315600015D000000000000000000000000000000000A5\r
+S315600015E00000000000000000000000000000000095\r
+S315600015F00000000000000000000000000000000085\r
+S315600016000000000000000000000000000000000074\r
+S315600016100000000000000000000000000000000064\r
+S315600016200000000000000000000000000000000054\r
+S315600016300000000000000000000000000000000044\r
+S315600016400000000000000000000000000000000034\r
+S315600016500000000000000000000000000000000024\r
+S315600016600000000000000000000000000000000014\r
+S315600016700000000000000000000000000000000004\r
+S3156000168000000000000000000000000000000000F4\r
+S3156000169000000000000000000000000000000000E4\r
+S315600016A000000000000000000000000000000000D4\r
+S315600016B000000000000000000000000000000000C4\r
+S315600016C000000000000000000000000000000000B4\r
+S315600016D000000000000000000000000000000000A4\r
+S315600016E00000000000000000000000000000000094\r
+S315600016F00000000000000000000000000000000084\r
+S315600017000000000000000000000000000000000073\r
+S315600017100000000000000000000000000000000063\r
+S315600017200000000000000000000000000000000053\r
+S315600017300000000000000000000000000000000043\r
+S315600017400000000000000000000000000000000033\r
+S315600017500000000000000000000000000000000023\r
+S315600017600000000000000000000000000000000013\r
+S315600017700000000000000000000000000000000003\r
+S3156000178000000000000000000000000000000000F3\r
+S3156000179000000000000000000000000000000000E3\r
+S315600017A000000000000000000000000000000000D3\r
+S315600017B000000000000000000000000000000000C3\r
+S315600017C000000000000000000000000000000000B3\r
+S315600017D000000000000000000000000000000000A3\r
+S315600017E00000000000000000000000000000000093\r
+S315600017F00000000000000000000000000000000083\r
+S315600018000000000000000000000000000000000072\r
+S315600018100000000000000000000000000000000062\r
+S315600018200000000000000000000000000000000052\r
+S315600018300000000000000000000000000000000042\r
+S315600018400000000000000000000000000000000032\r
+S315600018500000000000000000000000000000000022\r
+S315600018600000000000000000000000000000000012\r
+S315600018700000000000000000000000000000000002\r
+S3156000188000000000000000000000000000000000F2\r
+S3156000189000000000000000000000000000000000E2\r
+S315600018A000000000000000000000000000000000D2\r
+S315600018B000000000000000000000000000000000C2\r
+S315600018C000000000000000000000000000000000B2\r
+S315600018D000000000000000000000000000000000A2\r
+S315600018E00000000000000000000000000000000092\r
+S315600018F00000000000000000000000000000000082\r
+S315600019000000000000000000000000000000000071\r
+S315600019100000000000000000000000000000000061\r
+S315600019200000000000000000000000000000000051\r
+S315600019300000000000000000000000000000000041\r
+S315600019400000000000000000000000000000000031\r
+S315600019500000000000000000000000000000000021\r
+S315600019600000000000000000000000000000000011\r
+S315600019700000000000000000000000000000000001\r
+S3156000198000000000000000000000000000000000F1\r
+S3156000199000000000000000000000000000000000E1\r
+S315600019A000000000000000000000000000000000D1\r
+S315600019B000000000000000000000000000000000C1\r
+S315600019C000000000000000000000000000000000B1\r
+S315600019D000000000000000000000000000000000A1\r
+S315600019E00000000000000000000000000000000091\r
+S315600019F00000000000000000000000000000000081\r
+S31560001A000000000000000000000000000000000070\r
+S31560001A100000000000000000000000000000000060\r
+S31560001A200000000000000000000000000000000050\r
+S31560001A300000000000000000000000000000000040\r
+S31560001A400000000000000000000000000000000030\r
+S31560001A500000000000000000000000000000000020\r
+S31560001A600000000000000000000000000000000010\r
+S31560001A700000000000000000000000000000000000\r
+S31560001A8000000000000000000000000000000000F0\r
+S31560001A9000000000000000000000000000000000E0\r
+S31560001AA000000000000000000000000000000000D0\r
+S31560001AB000000000000000000000000000000000C0\r
+S31560001AC000000000000000000000000000000000B0\r
+S31560001AD000000000000000000000000000000000A0\r
+S31560001AE00000000000000000000000000000000090\r
+S31560001AF00000000000000000000000000000000080\r
+S31560001B00000000000000000000000000000000006F\r
+S31560001B10000000000000000000000000000000005F\r
+S31560001B20000000000000000000000000000000004F\r
+S31560001B30000000000000000000000000000000003F\r
+S31560001B40000000000000000000000000000000002F\r
+S31560001B50000000000000000000000000000000001F\r
+S31560001B60000000000000000000000000000000000F\r
+S31560001B7000000000000000000000000000000000FF\r
+S31560001B8000000000000000000000000000000000EF\r
+S31560001B9000000000000000000000000000000000DF\r
+S31560001BA000000000000000000000000000000000CF\r
+S31560001BB000000000000000000000000000000000BF\r
+S31560001BC000000000000000000000000000000000AF\r
+S31560001BD0000000000000000000000000000000009F\r
+S31560001BE0000000000000000000000000000000008F\r
+S31560001BF0000000000000000000000000000000007F\r
+S31560001C00000000000000000000000000000000006E\r
+S31560001C10000000000000000000000000000000005E\r
+S31560001C20000000000000000000000000000000004E\r
+S31560001C30000000000000000000000000000000003E\r
+S31560001C40000000000000000000000000000000002E\r
+S31560001C50000000000000000000000000000000001E\r
+S31560001C60000000000000000000000000000000000E\r
+S31560001C7000000000000000000000000000000000FE\r
+S31560001C8000000000000000000000000000000000EE\r
+S31560001C9000000000000000000000000000000000DE\r
+S31560001CA000000000000000000000000000000000CE\r
+S31560001CB000000000000000000000000000000000BE\r
+S31560001CC000000000000000000000000000000000AE\r
+S31560001CD0000000000000000000000000000000009E\r
+S31560001CE0000000000000000000000000000000008E\r
+S31560001CF0000000000000000000000000000000007E\r
+S31560001D00000000000000000000000000000000006D\r
+S31560001D10000000000000000000000000000000005D\r
+S31560001D20000000000000000000000000000000004D\r
+S31560001D30000000000000000000000000000000003D\r
+S31560001D40000000000000000000000000000000002D\r
+S31560001D50000000000000000000000000000000001D\r
+S31560001D60000000000000000000000000000000000D\r
+S31560001D7000000000000000000000000000000000FD\r
+S31560001D8000000000000000000000000000000000ED\r
+S31560001D9000000000000000000000000000000000DD\r
+S31560001DA000000000000000000000000000000000CD\r
+S31560001DB000000000000000000000000000000000BD\r
+S31560001DC000000000000000000000000000000000AD\r
+S31560001DD0000000000000000000000000000000009D\r
+S31560001DE0000000000000000000000000000000008D\r
+S31560001DF0000000000000000000000000000000007D\r
+S31560001E00000000000000000000000000000000006C\r
+S31560001E10000000000000000000000000000000005C\r
+S31560001E20000000000000000000000000000000004C\r
+S31560001E30000000000000000000000000000000003C\r
+S31560001E40000000000000000000000000000000002C\r
+S31560001E50000000000000000000000000000000001C\r
+S31560001E60000000000000000000000000000000000C\r
+S31560001E7000000000000000000000000000000000FC\r
+S31560001E8000000000000000000000000000000000EC\r
+S31560001E9000000000000000000000000000000000DC\r
+S31560001EA000000000000000000000000000000000CC\r
+S31560001EB000000000000000000000000000000000BC\r
+S31560001EC000000000000000000000000000000000AC\r
+S31560001ED0000000000000000000000000000000009C\r
+S31560001EE0000000000000000000000000000000008C\r
+S31560001EF0000000000000000000000000000000007C\r
+S31560001F00000000000000000000000000000000006B\r
+S31560001F10000000000000000000000000000000005B\r
+S31560001F20000000000000000000000000000000004B\r
+S31560001F30000000000000000000000000000000003B\r
+S31560001F40000000000000000000000000000000002B\r
+S31560001F50000000000000000000000000000000001B\r
+S31560001F60000000000000000000000000000000000B\r
+S31560001F7000000000000000000000000000000000FB\r
+S31560001F8000000000000000000000000000000000EB\r
+S31560001F9000000000000000000000000000000000DB\r
+S31560001FA000000000000000000000000000000000CB\r
+S31560001FB000000000000000000000000000000000BB\r
+S31560001FC000000000000000000000000000000000AB\r
+S31560001FD0000000000000000000000000000000009B\r
+S31560001FE0000000000000000000000000000000008B\r
+S31560001FF0000000000000000000000000000000007B\r
+S31560002000000000000000000000000000000000006A\r
+S31560002010000000000000000000000000000000005A\r
+S31560002020000000000000000000000000000000004A\r
+S31560002030000000000000000000000000000000003A\r
+S31560002040000000000000000000000000000000002A\r
+S31560002050000000000000000000000000000000001A\r
+S31560002060000000000000000000000000000000000A\r
+S3156000207000000000000000000000000000000000FA\r
+S3156000208000000000000000000000000000000000EA\r
+S3156000209000000000000000000000000000000000DA\r
+S315600020A000000000000000000000000000000000CA\r
+S315600020B000000000000000000000000000000000BA\r
+S315600020C000000000000000000000000000000000AA\r
+S315600020D0000000000000000000000000000000009A\r
+S315600020E0000000000000000000000000000000008A\r
+S315600020F0000000000000000000000000000000007A\r
+S315600021000000000000000000000000000000000069\r
+S315600021100000000000000000000000000000000059\r
+S315600021200000000000000000000000000000000049\r
+S315600021300000000000000000000000000000000039\r
+S315600021400000000000000000000000000000000029\r
+S315600021500000000000000000000000000000000019\r
+S315600021600000000000000000000000000000000009\r
+S3156000217000000000000000000000000000000000F9\r
+S3156000218000000000000000000000000000000000E9\r
+S3156000219000000000000000000000000000000000D9\r
+S315600021A000000000000000000000000000000000C9\r
+S315600021B000000000000000000000000000000000B9\r
+S315600021C000000000000000000000000000000000A9\r
+S315600021D00000000000000000000000000000000099\r
+S315600021E00000000000000000000000000000000089\r
+S315600021F00000000000000000000000000000000079\r
+S315600022000000000000000000000000000000000068\r
+S315600022100000000000000000000000000000000058\r
+S315600022200000000000000000000000000000000048\r
+S315600022300000000000000000000000000000000038\r
+S315600022400000000000000000000000000000000028\r
+S315600022500000000000000000000000000000000018\r
+S315600022600000000000000000000000000000000008\r
+S3156000227000000000000000000000000000000000F8\r
+S3156000228000000000000000000000000000000000E8\r
+S3156000229000000000000000000000000000000000D8\r
+S315600022A000000000000000000000000000000000C8\r
+S315600022B000000000000000000000000000000000B8\r
+S315600022C000000000000000000000000000000000A8\r
+S315600022D00000000000000000000000000000000098\r
+S315600022E00000000000000000000000000000000088\r
+S315600022F00000000000000000000000000000000078\r
+S315600023000000000000000000000000000000000067\r
+S315600023100000000000000000000000000000000057\r
+S315600023200000000000000000000000000000000047\r
+S315600023300000000000000000000000000000000037\r
+S315600023400000000000000000000000000000000027\r
+S315600023500000000000000000000000000000000017\r
+S315600023600000000000000000000000000000000007\r
+S3156000237000000000000000000000000000000000F7\r
+S3156000238000000000000000000000000000000000E7\r
+S3156000239000000000000000000000000000000000D7\r
+S315600023A000000000000000000000000000000000C7\r
+S315600023B000000000000000000000000000000000B7\r
+S315600023C000000000000000000000000000000000A7\r
+S315600023D00000000000000000000000000000000097\r
+S315600023E00000000000000000000000000000000087\r
+S315600023F00000000000000000000000000000000077\r
+S315600024000000000000000000000000000000000066\r
+S315600024100000000000000000000000000000000056\r
+S315600024200000000000000000000000000000000046\r
+S315600024300000000000000000000000000000000036\r
+S315600024400000000000000000000000000000000026\r
+S315600024500000000000000000000000000000000016\r
+S315600024600000000000000000000000000000000006\r
+S3156000247000000000000000000000000000000000F6\r
+S3156000248000000000000000000000000000000000E6\r
+S3156000249000000000000000000000000000000000D6\r
+S315600024A000000000000000000000000000000000C6\r
+S315600024B000000000000000000000000000000000B6\r
+S315600024C000000000000000000000000000000000A6\r
+S315600024D00000000000000000000000000000000096\r
+S315600024E00000000000000000000000000000000086\r
+S315600024F00000000000000000000000000000000076\r
+S315600025000000000000000000000000000000000065\r
+S315600025100000000000000000000000000000000055\r
+S315600025200000000000000000000000000000000045\r
+S315600025300000000000000000000000000000000035\r
+S315600025400000000000000000000000000000000025\r
+S315600025500000000000000000000000000000000015\r
+S315600025600000000000000000000000000000000005\r
+S3156000257000000000000000000000000000000000F5\r
+S3156000258000000000000000000000000000000000E5\r
+S3156000259000000000000000000000000000000000D5\r
+S315600025A000000000000000000000000000000000C5\r
+S315600025B000000000000000000000000000000000B5\r
+S315600025C000000000000000000000000000000000A5\r
+S315600025D00000000000000000000000000000000095\r
+S315600025E00000000000000000000000000000000085\r
+S315600025F00000000000000000000000000000000075\r
+S315600026000000000000000000000000000000000064\r
+S315600026100000000000000000000000000000000054\r
+S315600026200000000000000000000000000000000044\r
+S315600026300000000000000000000000000000000034\r
+S315600026400000000000000000000000000000000024\r
+S315600026500000000000000000000000000000000014\r
+S315600026600000000000000000000000000000000004\r
+S3156000267000000000000000000000000000000000F4\r
+S3156000268000000000000000000000000000000000E4\r
+S3156000269000000000000000000000000000000000D4\r
+S315600026A000000000000000000000000000000000C4\r
+S315600026B000000000000000000000000000000000B4\r
+S315600026C000000000000000000000000000000000A4\r
+S315600026D00000000000000000000000000000000094\r
+S315600026E00000000000000000000000000000000084\r
+S315600026F00000000000000000000000000000000074\r
+S315600027000000000000000000000000000000000063\r
+S315600027100000000000000000000000000000000053\r
+S315600027200000000000000000000000000000000043\r
+S315600027300000000000000000000000000000000033\r
+S315600027400000000000000000000000000000000023\r
+S315600027500000000000000000000000000000000013\r
+S315600027600000000000000000000000000000000003\r
+S3156000277000000000000000000000000000000000F3\r
+S3156000278000000000000000000000000000000000E3\r
+S3156000279000000000000000000000000000000000D3\r
+S315600027A000000000000000000000000000000000C3\r
+S315600027B000000000000000000000000000000000B3\r
+S315600027C000000000000000000000000000000000A3\r
+S315600027D00000000000000000000000000000000093\r
+S315600027E00000000000000000000000000000000083\r
+S315600027F00000000000000000000000000000000073\r
+S315600028000000000000000000000000000000000062\r
+S315600028100000000000000000000000000000000052\r
+S315600028200000000000000000000000000000000042\r
+S315600028300000000000000000000000000000000032\r
+S315600028400000000000000000000000000000000022\r
+S315600028500000000000000000000000000000000012\r
+S315600028600000000000000000000000000000000002\r
+S3156000287000000000000000000000000000000000F2\r
+S3156000288000000000000000000000000000000000E2\r
+S3156000289000000000000000000000000000000000D2\r
+S315600028A000000000000000000000000000000000C2\r
+S315600028B000000000000000000000000000000000B2\r
+S315600028C000000000000000000000000000000000A2\r
+S315600028D00000000000000000000000000000000092\r
+S315600028E00000000000000000000000000000000082\r
+S315600028F00000000000000000000000000000000072\r
+S315600029000000000000000000000000000000000061\r
+S315600029100000000000000000000000000000000051\r
+S315600029200000000000000000000000000000000041\r
+S315600029300000000000000000000000000000000031\r
+S315600029400000000000000000000000000000000021\r
+S315600029500000000000000000000000000000000011\r
+S315600029600000000000000000000000000000000001\r
+S3156000297000000000000000000000000000000000F1\r
+S3156000298000000000000000000000000000000000E1\r
+S3156000299000000000000000000000000000000000D1\r
+S315600029A000000000000000000000000000000000C1\r
+S315600029B000000000000000000000000000000000B1\r
+S315600029C000000000000000000000000000000000A1\r
+S315600029D00000000000000000000000000000000091\r
+S315600029E00000000000000000000000000000000081\r
+S315600029F00000000000000000000000000000000071\r
+S31560002A000000000000000000000000000000000060\r
+S31560002A100000000000000000000000000000000050\r
+S31560002A200000000000000000000000000000000040\r
+S31560002A300000000000000000000000000000000030\r
+S31560002A400000000000000000000000000000000020\r
+S31560002A500000000000000000000000000000000010\r
+S31560002A600000000000000000000000000000000000\r
+S31560002A7000000000000000000000000000000000F0\r
+S31560002A8000000000000000000000000000000000E0\r
+S31560002A9000000000000000000000000000000000D0\r
+S31560002AA000000000000000000000000000000000C0\r
+S31560002AB000000000000000000000000000000000B0\r
+S31560002AC000000000000000000000000000000000A0\r
+S31560002AD00000000000000000000000000000000090\r
+S31560002AE00000000000000000000000000000000080\r
+S31560002AF00000000000000000000000000000000070\r
+S31560002B00000000000000000000000000000000005F\r
+S31560002B10000000000000000000000000000000004F\r
+S31560002B20000000000000000000000000000000003F\r
+S31560002B30000000000000000000000000000000002F\r
+S31560002B40000000000000000000000000000000001F\r
+S31560002B50000000000000000000000000000000000F\r
+S31560002B6000000000000000000000000000000000FF\r
+S31560002B7000000000000000000000000000000000EF\r
+S31560002B8000000000000000000000000000000000DF\r
+S31560002B9000000000000000000000000000000000CF\r
+S31560002BA000000000000000000000000000000000BF\r
+S31560002BB000000000000000000000000000000000AF\r
+S31560002BC0000000000000000000000000000000009F\r
+S31560002BD0000000000000000000000000000000008F\r
+S31560002BE0000000000000000000000000000000007F\r
+S31560002BF0000000000000000000000000000000006F\r
+S31560002C00000000000000000000000000000000005E\r
+S31560002C10000000000000000000000000000000004E\r
+S31560002C20000000000000000000000000000000003E\r
+S31560002C30000000000000000000000000000000002E\r
+S31560002C40000000000000000000000000000000001E\r
+S31560002C50000000000000000000000000000000000E\r
+S31560002C6000000000000000000000000000000000FE\r
+S31560002C7000000000000000000000000000000000EE\r
+S31560002C8000000000000000000000000000000000DE\r
+S31560002C9000000000000000000000000000000000CE\r
+S31560002CA000000000000000000000000000000000BE\r
+S31560002CB000000000000000000000000000000000AE\r
+S31560002CC0000000000000000000000000000000009E\r
+S31560002CD0000000000000000000000000000000008E\r
+S31560002CE0000000000000000000000000000000007E\r
+S31560002CF0000000000000000000000000000000006E\r
+S31560002D00000000000000000000000000000000005D\r
+S31560002D10000000000000000000000000000000004D\r
+S31560002D20000000000000000000000000000000003D\r
+S31560002D30000000000000000000000000000000002D\r
+S31560002D40000000000000000000000000000000001D\r
+S31560002D50000000000000000000000000000000000D\r
+S31560002D6000000000000000000000000000000000FD\r
+S31560002D7000000000000000000000000000000000ED\r
+S31560002D8000000000000000000000000000000000DD\r
+S31560002D9000000000000000000000000000000000CD\r
+S31560002DA000000000000000000000000000000000BD\r
+S31560002DB000000000000000000000000000000000AD\r
+S31560002DC0000000000000000000000000000000009D\r
+S31560002DD0000000000000000000000000000000008D\r
+S31560002DE0000000000000000000000000000000007D\r
+S31560002DF0000000000000000000000000000000006D\r
+S31560002E00000000000000000000000000000000005C\r
+S31560002E10000000000000000000000000000000004C\r
+S31560002E20000000000000000000000000000000003C\r
+S31560002E30000000000000000000000000000000002C\r
+S31560002E40000000000000000000000000000000001C\r
+S31560002E50000000000000000000000000000000000C\r
+S31560002E6000000000000000000000000000000000FC\r
+S31560002E7000000000000000000000000000000000EC\r
+S31560002E8000000000000000000000000000000000DC\r
+S31560002E9000000000000000000000000000000000CC\r
+S31560002EA000000000000000000000000000000000BC\r
+S31560002EB000000000000000000000000000000000AC\r
+S31560002EC0000000000000000000000000000000009C\r
+S31560002ED0000000000000000000000000000000008C\r
+S31560002EE0000000000000000000000000000000007C\r
+S31560002EF0000000000000000000000000000000006C\r
+S31560002F00000000000000000000000000000000005B\r
+S31560002F10000000000000000000000000000000004B\r
+S31560002F20000000000000000000000000000000003B\r
+S31560002F30000000000000000000000000000000002B\r
+S31560002F40000000000000000000000000000000001B\r
+S31560002F50000000000000000000000000000000000B\r
+S31560002F6000000000000000000000000000000000FB\r
+S31560002F7000000000000000000000000000000000EB\r
+S31560002F8000000000000000000000000000000000DB\r
+S31560002F9000000000000000000000000000000000CB\r
+S31560002FA000000000000000000000000000000000BB\r
+S31560002FB000000000000000000000000000000000AB\r
+S31560002FC0000000000000000000000000000000009B\r
+S31560002FD0000000000000000000000000000000008B\r
+S31560002FE0000000000000000000000000000000007B\r
+S31560002FF0000000000000000000000000000000006B\r
+S31560003000000000000000000000000000000000005A\r
+S31560003010000000000000000000000000000000004A\r
+S31560003020000000000000000000000000000000003A\r
+S31560003030000000000000000000000000000000002A\r
+S31560003040000000000000000000000000000000001A\r
+S31560003050000000000000000000000000000000000A\r
+S3156000306000000000000000000000000000000000FA\r
+S3156000307000000000000000000000000000000000EA\r
+S3156000308000000000000000000000000000000000DA\r
+S3156000309000000000000000000000000000000000CA\r
+S315600030A000000000000000000000000000000000BA\r
+S315600030B000000000000000000000000000000000AA\r
+S315600030C0000000000000000000000000000000009A\r
+S315600030D0000000000000000000000000000000008A\r
+S315600030E0000000000000000000000000000000007A\r
+S315600030F0000000000000000000000000000000006A\r
+S315600031000000000000000000000000000000000059\r
+S315600031100000000000000000000000000000000049\r
+S315600031200000000000000000000000000000000039\r
+S315600031300000000000000000000000000000000029\r
+S315600031400000000000000000000000000000000019\r
+S315600031500000000000000000000000000000000009\r
+S3156000316000000000000000000000000000000000F9\r
+S3156000317000000000000000000000000000000000E9\r
+S3156000318000000000000000000000000000000000D9\r
+S3156000319000000000000000000000000000000000C9\r
+S315600031A000000000000000000000000000000000B9\r
+S315600031B000000000000000000000000000000000A9\r
+S315600031C00000000000000000000000000000000099\r
+S315600031D00000000000000000000000000000000089\r
+S315600031E00000000000000000000000000000000079\r
+S315600031F00000000000000000000000000000000069\r
+S315600032000000000000000000000000000000000058\r
+S315600032100000000000000000000000000000000048\r
+S315600032200000000000000000000000000000000038\r
+S315600032300000000000000000000000000000000028\r
+S315600032400000000000000000000000000000000018\r
+S315600032500000000000000000000000000000000008\r
+S3156000326000000000000000000000000000000000F8\r
+S3156000327000000000000000000000000000000000E8\r
+S3156000328000000000000000000000000000000000D8\r
+S3156000329000000000000000000000000000000000C8\r
+S315600032A000000000000000000000000000000000B8\r
+S315600032B000000000000000000000000000000000A8\r
+S315600032C00000000000000000000000000000000098\r
+S315600032D00000000000000000000000000000000088\r
+S315600032E00000000000000000000000000000000078\r
+S315600032F00000000000000000000000000000000068\r
+S315600033000000000000000000000000000000000057\r
+S315600033100000000000000000000000000000000047\r
+S315600033200000000000000000000000000000000037\r
+S315600033300000000000000000000000000000000027\r
+S315600033400000000000000000000000000000000017\r
+S315600033500000000000000000000000000000000007\r
+S3156000336000000000000000000000000000000000F7\r
+S3156000337000000000000000000000000000000000E7\r
+S3156000338000000000000000000000000000000000D7\r
+S3156000339000000000000000000000000000000000C7\r
+S315600033A000000000000000000000000000000000B7\r
+S315600033B000000000000000000000000000000000A7\r
+S315600033C00000000000000000000000000000000097\r
+S315600033D00000000000000000000000000000000087\r
+S315600033E00000000000000000000000000000000077\r
+S315600033F00000000000000000000000000000000067\r
+S315600034000000000000000000000000000000000056\r
+S315600034100000000000000000000000000000000046\r
+S315600034200000000000000000000000000000000036\r
+S315600034300000000000000000000000000000000026\r
+S315600034400000000000000000000000000000000016\r
+S315600034500000000000000000000000000000000006\r
+S3156000346000000000000000000000000000000000F6\r
+S3156000347000000000000000000000000000000000E6\r
+S3156000348000000000000000000000000000000000D6\r
+S3156000349000000000000000000000000000000000C6\r
+S315600034A000000000000000000000000000000000B6\r
+S315600034B000000000000000000000000000000000A6\r
+S315600034C00000000000000000000000000000000096\r
+S315600034D00000000000000000000000000000000086\r
+S315600034E00000000000000000000000000000000076\r
+S315600034F00000000000000000000000000000000066\r
+S315600035000000000000000000000000000000000055\r
+S315600035100000000000000000000000000000000045\r
+S315600035200000000000000000000000000000000035\r
+S315600035300000000000000000000000000000000025\r
+S315600035400000000000000000000000000000000015\r
+S315600035500000000000000000000000000000000005\r
+S3156000356000000000000000000000000000000000F5\r
+S3156000357000000000000000000000000000000000E5\r
+S3156000358000000000000000000000000000000000D5\r
+S3156000359000000000000000000000000000000000C5\r
+S315600035A000000000000000000000000000000000B5\r
+S315600035B000000000000000000000000000000000A5\r
+S315600035C00000000000000000000000000000000095\r
+S315600035D00000000000000000000000000000000085\r
+S315600035E00000000000000000000000000000000075\r
+S315600035F00000000000000000000000000000000065\r
+S315600036000000000000000000000000000000000054\r
+S315600036100000000000000000000000000000000044\r
+S315600036200000000000000000000000000000000034\r
+S315600036300000000000000000000000000000000024\r
+S315600036400000000000000000000000000000000014\r
+S315600036500000000000000000000000000000000004\r
+S3156000366000000000000000000000000000000000F4\r
+S3156000367000000000000000000000000000000000E4\r
+S3156000368000000000000000000000000000000000D4\r
+S3156000369000000000000000000000000000000000C4\r
+S315600036A000000000000000000000000000000000B4\r
+S315600036B000000000000000000000000000000000A4\r
+S315600036C00000000000000000000000000000000094\r
+S315600036D00000000000000000000000000000000084\r
+S315600036E00000000000000000000000000000000074\r
+S315600036F00000000000000000000000000000000064\r
+S315600037000000000000000000000000000000000053\r
+S315600037100000000000000000000000000000000043\r
+S315600037200000000000000000000000000000000033\r
+S315600037300000000000000000000000000000000023\r
+S315600037400000000000000000000000000000000013\r
+S315600037500000000000000000000000000000000003\r
+S3156000376000000000000000000000000000000000F3\r
+S3156000377000000000000000000000000000000000E3\r
+S3156000378000000000000000000000000000000000D3\r
+S3156000379000000000000000000000000000000000C3\r
+S315600037A000000000000000000000000000000000B3\r
+S315600037B000000000000000000000000000000000A3\r
+S315600037C00000000000000000000000000000000093\r
+S315600037D00000000000000000000000000000000083\r
+S315600037E00000000000000000000000000000000073\r
+S315600037F00000000000000000000000000000000063\r
+S315600038000000000000000000000000000000000052\r
+S315600038100000000000000000000000000000000042\r
+S315600038200000000000000000000000000000000032\r
+S315600038300000000000000000000000000000000022\r
+S315600038400000000000000000000000000000000012\r
+S315600038500000000000000000000000000000000002\r
+S3156000386000000000000000000000000000000000F2\r
+S3156000387000000000000000000000000000000000E2\r
+S3156000388000000000000000000000000000000000D2\r
+S3156000389000000000000000000000000000000000C2\r
+S315600038A000000000000000000000000000000000B2\r
+S315600038B000000000000000000000000000000000A2\r
+S315600038C00000000000000000000000000000000092\r
+S315600038D00000000000000000000000000000000082\r
+S315600038E00000000000000000000000000000000072\r
+S315600038F00000000000000000000000000000000062\r
+S315600039000000000000000000000000000000000051\r
+S315600039100000000000000000000000000000000041\r
+S315600039200000000000000000000000000000000031\r
+S315600039300000000000000000000000000000000021\r
+S315600039400000000000000000000000000000000011\r
+S315600039500000000000000000000000000000000001\r
+S3156000396000000000000000000000000000000000F1\r
+S3156000397000000000000000000000000000000000E1\r
+S3156000398000000000000000000000000000000000D1\r
+S3156000399000000000000000000000000000000000C1\r
+S315600039A000000000000000000000000000000000B1\r
+S315600039B000000000000000000000000000000000A1\r
+S315600039C00000000000000000000000000000000091\r
+S315600039D00000000000000000000000000000000081\r
+S315600039E00000000000000000000000000000000071\r
+S315600039F00000000000000000000000000000000061\r
+S31560003A000000000000000000000000000000000050\r
+S31560003A100000000000000000000000000000000040\r
+S31560003A200000000000000000000000000000000030\r
+S31560003A300000000000000000000000000000000020\r
+S31560003A400000000000000000000000000000000010\r
+S31560003A500000000000000000000000000000000000\r
+S31560003A6000000000000000000000000000000000F0\r
+S31560003A7000000000000000000000000000000000E0\r
+S31560003A8000000000000000000000000000000000D0\r
+S31560003A9000000000000000000000000000000000C0\r
+S31560003AA000000000000000000000000000000000B0\r
+S31560003AB000000000000000000000000000000000A0\r
+S31560003AC00000000000000000000000000000000090\r
+S31560003AD00000000000000000000000000000000080\r
+S31560003AE00000000000000000000000000000000070\r
+S31560003AF00000000000000000000000000000000060\r
+S31560003B00000000000000000000000000000000004F\r
+S31560003B10000000000000000000000000000000003F\r
+S31560003B20000000000000000000000000000000002F\r
+S31560003B30000000000000000000000000000000001F\r
+S31560003B40000000000000000000000000000000000F\r
+S31560003B5000000000000000000000000000000000FF\r
+S31560003B6000000000000000000000000000000000EF\r
+S31560003B7000000000000000000000000000000000DF\r
+S31560003B8000000000000000000000000000000000CF\r
+S31560003B9000000000000000000000000000000000BF\r
+S31560003BA000000000000000000000000000000000AF\r
+S31560003BB0000000000000000000000000000000009F\r
+S31560003BC0000000000000000000000000000000008F\r
+S31560003BD0000000000000000000000000000000007F\r
+S31560003BE0000000000000000000000000000000006F\r
+S31560003BF0000000000000000000000000000000005F\r
+S31560003C00000000000000000000000000000000004E\r
+S31560003C10000000000000000000000000000000003E\r
+S31560003C20000000000000000000000000000000002E\r
+S31560003C30000000000000000000000000000000001E\r
+S31560003C40000000000000000000000000000000000E\r
+S31560003C5000000000000000000000000000000000FE\r
+S31560003C6000000000000000000000000000000000EE\r
+S31560003C7000000000000000000000000000000000DE\r
+S31560003C8000000000000000000000000000000000CE\r
+S31560003C9000000000000000000000000000000000BE\r
+S31560003CA000000000000000000000000000000000AE\r
+S31560003CB0000000000000000000000000000000009E\r
+S31560003CC0000000000000000000000000000000008E\r
+S31560003CD0000000000000000000000000000000007E\r
+S31560003CE0000000000000000000000000000000006E\r
+S31560003CF0000000000000000000000000000000005E\r
+S31560003D00000000000000000000000000000000004D\r
+S31560003D10000000000000000000000000000000003D\r
+S31560003D20000000000000000000000000000000002D\r
+S31560003D30000000000000000000000000000000001D\r
+S31560003D40000000000000000000000000000000000D\r
+S31560003D5000000000000000000000000000000000FD\r
+S31560003D6000000000000000000000000000000000ED\r
+S31560003D7000000000000000000000000000000000DD\r
+S31560003D8000000000000000000000000000000000CD\r
+S31560003D9000000000000000000000000000000000BD\r
+S31560003DA000000000000000000000000000000000AD\r
+S31560003DB0000000000000000000000000000000009D\r
+S31560003DC0000000000000000000000000000000008D\r
+S31560003DD0000000000000000000000000000000007D\r
+S31560003DE0000000000000000000000000000000006D\r
+S31560003DF0000000000000000000000000000000005D\r
+S31560003E00000000000000000000000000000000004C\r
+S31560003E10000000000000000000000000000000003C\r
+S31560003E20000000000000000000000000000000002C\r
+S31560003E30000000000000000000000000000000001C\r
+S31560003E40000000000000000000000000000000000C\r
+S31560003E5000000000000000000000000000000000FC\r
+S31560003E6000000000000000000000000000000000EC\r
+S31560003E7000000000000000000000000000000000DC\r
+S31560003E8000000000000000000000000000000000CC\r
+S31560003E9000000000000000000000000000000000BC\r
+S31560003EA000000000000000000000000000000000AC\r
+S31560003EB0000000000000000000000000000000009C\r
+S31560003EC0000000000000000000000000000000008C\r
+S31560003ED0000000000000000000000000000000007C\r
+S31560003EE0000000000000000000000000000000006C\r
+S31560003EF0000000000000000000000000000000005C\r
+S31560003F00000000000000000000000000000000004B\r
+S31560003F10000000000000000000000000000000003B\r
+S31560003F20000000000000000000000000000000002B\r
+S31560003F30000000000000000000000000000000001B\r
+S31560003F40000000000000000000000000000000000B\r
+S31560003F5000000000000000000000000000000000FB\r
+S31560003F6000000000000000000000000000000000EB\r
+S31560003F7000000000000000000000000000000000DB\r
+S31560003F8000000000000000000000000000000000CB\r
+S31560003F9000000000000000000000000000000000BB\r
+S31560003FA000000000000000000000000000000000AB\r
+S31560003FB0000000000000000000000000000000009B\r
+S31560003FC0000000000000000000000000000000008B\r
+S31560003FD0000000000000000000000000000000007B\r
+S31560003FE0000000000000000000000000000000006B\r
+S31560003FF0000000000000000000000000000000005B\r
+S31560004000000000000000000000000000000000004A\r
+S31560004010000000000000000000000000000000003A\r
+S31560004020000000000000000000000000000000002A\r
+S31560004030000000000000000000000000000000001A\r
+S31560004040000000000000000000000000000000000A\r
+S3156000405000000000000000000000000000000000FA\r
+S3156000406000000000000000000000000000000000EA\r
+S3156000407000000000000000000000000000000000DA\r
+S3156000408000000000000000000000000000000000CA\r
+S3156000409000000000000000000000000000000000BA\r
+S315600040A000000000000000000000000000000000AA\r
+S315600040B0000000000000000000000000000000009A\r
+S315600040C0000000000000000000000000000000008A\r
+S315600040D0000000000000000000000000000000007A\r
+S315600040E0000000000000000000000000000000006A\r
+S315600040F0000000000000000000000000000000005A\r
+S315600041000000000000000000000000000000000049\r
+S315600041100000000000000000000000000000000039\r
+S315600041200000000000000000000000000000000029\r
+S315600041300000000000000000000000000000000019\r
+S315600041400000000000000000000000000000000009\r
+S3156000415000000000000000000000000000000000F9\r
+S3156000416000000000000000000000000000000000E9\r
+S3156000417000000000000000000000000000000000D9\r
+S3156000418000000000000000000000000000000000C9\r
+S3156000419000000000000000000000000000000000B9\r
+S315600041A000000000000000000000000000000000A9\r
+S315600041B00000000000000000000000000000000099\r
+S315600041C00000000000000000000000000000000089\r
+S315600041D00000000000000000000000000000000079\r
+S315600041E00000000000000000000000000000000069\r
+S315600041F00000000000000000000000000000000059\r
+S315600042000000000000000000000000000000000048\r
+S315600042100000000000000000000000000000000038\r
+S315600042200000000000000000000000000000000028\r
+S315600042300000000000000000000000000000000018\r
+S315600042400000000000000000000000000000000008\r
+S3156000425000000000000000000000000000000000F8\r
+S3156000426000000000000000000000000000000000E8\r
+S3156000427000000000000000000000000000000000D8\r
+S3156000428000000000000000000000000000000000C8\r
+S3156000429000000000000000000000000000000000B8\r
+S315600042A000000000000000000000000000000000A8\r
+S315600042B00000000000000000000000000000000098\r
+S315600042C00000000000000000000000000000000088\r
+S315600042D00000000000000000000000000000000078\r
+S315600042E00000000000000000000000000000000068\r
+S315600042F00000000000000000000000000000000058\r
+S315600043000000000000000000000000000000000047\r
+S315600043100000000000000000000000000000000037\r
+S315600043200000000000000000000000000000000027\r
+S315600043300000000000000000000000000000000017\r
+S315600043400000000000000000000000000000000007\r
+S3156000435000000000000000000000000000000000F7\r
+S3156000436000000000000000000000000000000000E7\r
+S3156000437000000000000000000000000000000000D7\r
+S3156000438000000000000000000000000000000000C7\r
+S3156000439000000000000000000000000000000000B7\r
+S315600043A000000000000000000000000000000000A7\r
+S315600043B00000000000000000000000000000000097\r
+S315600043C00000000000000000000000000000000087\r
+S315600043D00000000000000000000000000000000077\r
+S315600043E00000000000000000000000000000000067\r
+S315600043F00000000000000000000000000000000057\r
+S315600044000000000000000000000000000000000046\r
+S315600044100000000000000000000000000000000036\r
+S315600044200000000000000000000000000000000026\r
+S315600044300000000000000000000000000000000016\r
+S315600044400000000000000000000000000000000006\r
+S3156000445000000000000000000000000000000000F6\r
+S3156000446000000000000000000000000000000000E6\r
+S3156000447000000000000000000000000000000000D6\r
+S3156000448000000000000000000000000000000000C6\r
+S3156000449000000000000000000000000000000000B6\r
+S315600044A000000000000000000000000000000000A6\r
+S315600044B00000000000000000000000000000000096\r
+S315600044C00000000000000000000000000000000086\r
+S315600044D00000000000000000000000000000000076\r
+S315600044E00000000000000000000000000000000066\r
+S315600044F00000000000000000000000000000000056\r
+S315600045000000000000000000000000000000000045\r
+S315600045100000000000000000000000000000000035\r
+S315600045200000000000000000000000000000000025\r
+S315600045300000000000000000000000000000000015\r
+S315600045400000000000000000000000000000000005\r
+S3156000455000000000000000000000000000000000F5\r
+S3156000456000000000000000000000000000000000E5\r
+S3156000457000000000000000000000000000000000D5\r
+S3156000458000000000000000000000000000000000C5\r
+S3156000459000000000000000000000000000000000B5\r
+S315600045A000000000000000000000000000000000A5\r
+S315600045B00000000000000000000000000000000095\r
+S315600045C00000000000000000000000000000000085\r
+S315600045D00000000000000000000000000000000075\r
+S315600045E00000000000000000000000000000000065\r
+S315600045F00000000000000000000000000000000055\r
+S315600046000000000000000000000000000000000044\r
+S315600046100000000000000000000000000000000034\r
+S315600046200000000000000000000000000000000024\r
+S315600046300000000000000000000000000000000014\r
+S315600046400000000000000000000000000000000004\r
+S3156000465000000000000000000000000000000000F4\r
+S3156000466000000000000000000000000000000000E4\r
+S3156000467000000000000000000000000000000000D4\r
+S3156000468000000000000000000000000000000000C4\r
+S3156000469000000000000000000000000000000000B4\r
+S315600046A000000000000000000000000000000000A4\r
+S315600046B00000000000000000000000000000000094\r
+S315600046C00000000000000000000000000000000084\r
+S315600046D00000000000000000000000000000000074\r
+S315600046E00000000000000000000000000000000064\r
+S315600046F00000000000000000000000000000000054\r
+S315600047000000000000000000000000000000000043\r
+S315600047100000000000000000000000000000000033\r
+S315600047200000000000000000000000000000000023\r
+S315600047300000000000000000000000000000000013\r
+S315600047400000000000000000000000000000000003\r
+S3156000475000000000000000000000000000000000F3\r
+S3156000476000000000000000000000000000000000E3\r
+S3156000477000000000000000000000000000000000D3\r
+S3156000478000000000000000000000000000000000C3\r
+S3156000479000000000000000000000000000000000B3\r
+S315600047A000000000000000000000000000000000A3\r
+S315600047B00000000000000000000000000000000093\r
+S315600047C00000000000000000000000000000000083\r
+S315600047D00000000000000000000000000000000073\r
+S315600047E00000000000000000000000000000000063\r
+S315600047F00000000000000000000000000000000053\r
+S315600048000000000000000000000000000000000042\r
+S315600048100000000000000000000000000000000032\r
+S315600048200000000000000000000000000000000022\r
+S315600048300000000000000000000000000000000012\r
+S315600048400000000000000000000000000000000002\r
+S3156000485000000000000000000000000000000000F2\r
+S3156000486000000000000000000000000000000000E2\r
+S3156000487000000000000000000000000000000000D2\r
+S3156000488000000000000000000000000000000000C2\r
+S3156000489000000000000000000000000000000000B2\r
+S315600048A000000000000000000000000000000000A2\r
+S315600048B00000000000000000000000000000000092\r
+S315600048C00000000000000000000000000000000082\r
+S315600048D00000000000000000000000000000000072\r
+S315600048E00000000000000000000000000000000062\r
+S315600048F00000000000000000000000000000000052\r
+S315600049000000000000000000000000000000000041\r
+S315600049100000000000000000000000000000000031\r
+S315600049200000000000000000000000000000000021\r
+S315600049300000000000000000000000000000000011\r
+S315600049400000000000000000000000000000000001\r
+S3156000495000000000000000000000000000000000F1\r
+S3156000496000000000000000000000000000000000E1\r
+S3156000497000000000000000000000000000000000D1\r
+S3156000498000000000000000000000000000000000C1\r
+S3156000499000000000000000000000000000000000B1\r
+S315600049A000000000000000000000000000000000A1\r
+S315600049B00000000000000000000000000000000091\r
+S315600049C00000000000000000000000000000000081\r
+S315600049D00000000000000000000000000000000071\r
+S315600049E00000000000000000000000000000000061\r
+S315600049F00000000000000000000000000000000051\r
+S31560004A000000000000000000000000000000000040\r
+S31560004A100000000000000000000000000000000030\r
+S31560004A200000000000000000000000000000000020\r
+S31560004A300000000000000000000000000000000010\r
+S31560004A400000000000000000000000000000000000\r
+S31560004A5000000000000000000000000000000000F0\r
+S31560004A6000000000000000000000000000000000E0\r
+S31560004A7000000000000000000000000000000000D0\r
+S31560004A8000000000000000000000000000000000C0\r
+S31560004A9000000000000000000000000000000000B0\r
+S31560004AA000000000000000000000000000000000A0\r
+S31560004AB00000000000000000000000000000000090\r
+S31560004AC00000000000000000000000000000000080\r
+S31560004AD00000000000000000000000000000000070\r
+S31560004AE00000000000000000000000000000000060\r
+S31560004AF00000000000000000000000000000000050\r
+S31560004B00000000000000000000000000000000003F\r
+S31560004B10000000000000000000000000000000002F\r
+S31560004B20000000000000000000000000000000001F\r
+S31560004B30000000000000000000000000000000000F\r
+S31560004B4000000000000000000000000000000000FF\r
+S31560004B5000000000000000000000000000000000EF\r
+S31560004B6000000000000000000000000000000000DF\r
+S31560004B7000000000000000000000000000000000CF\r
+S31560004B8000000000000000000000000000000000BF\r
+S31560004B9000000000000000000000000000000000AF\r
+S31560004BA0000000000000000000000000000000009F\r
+S31560004BB0000000000000000000000000000000008F\r
+S31560004BC0000000000000000000000000000000007F\r
+S31560004BD0000000000000000000000000000000006F\r
+S31560004BE0000000000000000000000000000000005F\r
+S31560004BF0000000000000000000000000000000004F\r
+S31560004C00000000000000000000000000000000003E\r
+S31560004C10000000000000000000000000000000002E\r
+S31560004C20000000000000000000000000000000001E\r
+S31560004C30000000000000000000000000000000000E\r
+S31560004C4000000000000000000000000000000000FE\r
+S31560004C5000000000000000000000000000000000EE\r
+S31560004C6000000000000000000000000000000000DE\r
+S31560004C7000000000000000000000000000000000CE\r
+S31560004C8000000000000000000000000000000000BE\r
+S31560004C9000000000000000000000000000000000AE\r
+S31560004CA0000000000000000000000000000000009E\r
+S31560004CB0000000000000000000000000000000008E\r
+S31560004CC0000000000000000000000000000000007E\r
+S31560004CD0000000000000000000000000000000006E\r
+S31560004CE0000000000000000000000000000000005E\r
+S31560004CF0000000000000000000000000000000004E\r
+S31560004D00000000000000000000000000000000003D\r
+S31560004D10000000000000000000000000000000002D\r
+S31560004D20000000000000000000000000000000001D\r
+S31560004D30000000000000000000000000000000000D\r
+S31560004D4000000000000000000000000000000000FD\r
+S31560004D5000000000000000000000000000000000ED\r
+S31560004D6000000000000000000000000000000000DD\r
+S31560004D7000000000000000000000000000000000CD\r
+S31560004D8000000000000000000000000000000000BD\r
+S31560004D9000000000000000000000000000000000AD\r
+S31560004DA0000000000000000000000000000000009D\r
+S31560004DB0000000000000000000000000000000008D\r
+S31560004DC0000000000000000000000000000000007D\r
+S31560004DD0000000000000000000000000000000006D\r
+S31560004DE0000000000000000000000000000000005D\r
+S31560004DF0000000000000000000000000000000004D\r
+S31560004E00000000000000000000000000000000003C\r
+S31560004E10000000000000000000000000000000002C\r
+S31560004E20000000000000000000000000000000001C\r
+S31560004E30000000000000000000000000000000000C\r
+S31560004E4000000000000000000000000000000000FC\r
+S31560004E5000000000000000000000000000000000EC\r
+S31560004E6000000000000000000000000000000000DC\r
+S31560004E7000000000000000000000000000000000CC\r
+S31560004E8000000000000000000000000000000000BC\r
+S31560004E9000000000000000000000000000000000AC\r
+S31560004EA0000000000000000000000000000000009C\r
+S31560004EB0000000000000000000000000000000008C\r
+S31560004EC0000000000000000000000000000000007C\r
+S31560004ED0000000000000000000000000000000006C\r
+S31560004EE0000000000000000000000000000000005C\r
+S31560004EF0000000000000000000000000000000004C\r
+S31560004F00000000000000000000000000000000003B\r
+S31560004F10000000000000000000000000000000002B\r
+S31560004F20000000000000000000000000000000001B\r
+S31560004F30000000000000000000000000000000000B\r
+S31560004F4000000000000000000000000000000000FB\r
+S31560004F5000000000000000000000000000000000EB\r
+S31560004F6000000000000000000000000000000000DB\r
+S31560004F7000000000000000000000000000000000CB\r
+S31560004F8000000000000000000000000000000000BB\r
+S31560004F9000000000000000000000000000000000AB\r
+S31560004FA0000000000000000000000000000000009B\r
+S31560004FB0000000000000000000000000000000008B\r
+S31560004FC0000000000000000000000000000000007B\r
+S31560004FD0000000000000000000000000000000006B\r
+S31560004FE0000000000000000000000000000000005B\r
+S31560004FF0000000000000000000000000000000004B\r
+S31560005000000000000000000000000000000000003A\r
+S31560005010000000000000000000000000000000002A\r
+S31560005020000000000000000000000000000000001A\r
+S31560005030000000000000000000000000000000000A\r
+S3156000504000000000000000000000000000000000FA\r
+S3156000505000000000000000000000000000000000EA\r
+S3156000506000000000000000000000000000000000DA\r
+S3156000507000000000000000000000000000000000CA\r
+S3156000508000000000000000000000000000000000BA\r
+S3156000509000000000000000000000000000000000AA\r
+S315600050A0000000000000000000000000000000009A\r
+S315600050B0000000000000000000000000000000008A\r
+S315600050C0000000000000000000000000000000007A\r
+S315600050D0000000000000000000000000000000006A\r
+S315600050E0000000000000000000000000000000005A\r
+S315600050F0000000000000000000000000000000004A\r
+S315600051000000000000000000000000000000000039\r
+S315600051100000000000000000000000000000000029\r
+S315600051200000000000000000000000000000000019\r
+S315600051300000000000000000000000000000000009\r
+S3156000514000000000000000000000000000000000F9\r
+S3156000515000000000000000000000000000000000E9\r
+S3156000516000000000000000000000000000000000D9\r
+S3156000517000000000000000000000000000000000C9\r
+S3156000518000000000000000000000000000000000B9\r
+S3156000519000000000000000000000000000000000A9\r
+S315600051A00000000000000000000000000000000099\r
+S315600051B00000000000000000000000000000000089\r
+S315600051C00000000000000000000000000000000079\r
+S315600051D00000000000000000000000000000000069\r
+S315600051E00000000000000000000000000000000059\r
+S315600051F00000000000000000000000000000000049\r
+S315600052000000000000000000000000000000000038\r
+S315600052100000000000000000000000000000000028\r
+S315600052200000000000000000000000000000000018\r
+S315600052300000000000000000000000000000000008\r
+S3156000524000000000000000000000000000000000F8\r
+S3156000525000000000000000000000000000000000E8\r
+S3156000526000000000000000000000000000000000D8\r
+S3156000527000000000000000000000000000000000C8\r
+S3156000528000000000000000000000000000000000B8\r
+S3156000529000000000000000000000000000000000A8\r
+S315600052A00000000000000000000000000000000098\r
+S315600052B00000000000000000000000000000000088\r
+S315600052C00000000000000000000000000000000078\r
+S315600052D00000000000000000000000000000000068\r
+S315600052E00000000000000000000000000000000058\r
+S315600052F00000000000000000000000000000000048\r
+S315600053000000000000000000000000000000000037\r
+S315600053100000000000000000000000000000000027\r
+S315600053200000000000000000000000000000000017\r
+S315600053300000000000000000000000000000000007\r
+S3156000534000000000000000000000000000000000F7\r
+S3156000535000000000000000000000000000000000E7\r
+S3156000536000000000000000000000000000000000D7\r
+S3156000537000000000000000000000000000000000C7\r
+S3156000538000000000000000000000000000000000B7\r
+S3156000539000000000000000000000000000000000A7\r
+S315600053A00000000000000000000000000000000097\r
+S315600053B00000000000000000000000000000000087\r
+S315600053C00000000000000000000000000000000077\r
+S315600053D00000000000000000000000000000000067\r
+S315600053E00000000000000000000000000000000057\r
+S315600053F00000000000000000000000000000000047\r
+S315600054000000000000000000000000000000000036\r
+S315600054100000000000000000000000000000000026\r
+S315600054200000000000000000000000000000000016\r
+S315600054300000000000000000000000000000000006\r
+S3156000544000000000000000000000000000000000F6\r
+S3156000545000000000000000000000000000000000E6\r
+S3156000546000000000000000000000000000000000D6\r
+S3156000547000000000000000000000000000000000C6\r
+S3156000548000000000000000000000000000000000B6\r
+S3156000549000000000000000000000000000000000A6\r
+S315600054A00000000000000000000000000000000096\r
+S315600054B00000000000000000000000000000000086\r
+S315600054C00000000000000000000000000000000076\r
+S315600054D00000000000000000000000000000000066\r
+S315600054E00000000000000000000000000000000056\r
+S315600054F00000000000000000000000000000000046\r
+S315600055000000000000000000000000000000000035\r
+S315600055100000000000000000000000000000000025\r
+S315600055200000000000000000000000000000000015\r
+S315600055300000000000000000000000000000000005\r
+S3156000554000000000000000000000000000000000F5\r
+S3156000555000000000000000000000000000000000E5\r
+S3156000556000000000000000000000000000000000D5\r
+S3156000557000000000000000000000000000000000C5\r
+S3156000558000000000000000000000000000000000B5\r
+S3156000559000000000000000000000000000000000A5\r
+S315600055A00000000000000000000000000000000095\r
+S315600055B00000000000000000000000000000000085\r
+S315600055C00000000000000000000000000000000075\r
+S315600055D00000000000000000000000000000000065\r
+S315600055E00000000000000000000000000000000055\r
+S315600055F00000000000000000000000000000000045\r
+S315600056000000000000000000000000000000000034\r
+S315600056100000000000000000000000000000000024\r
+S315600056200000000000000000000000000000000014\r
+S315600056300000000000000000000000000000000004\r
+S3156000564000000000000000000000000000000000F4\r
+S3156000565000000000000000000000000000000000E4\r
+S3156000566000000000000000000000000000000000D4\r
+S3156000567000000000000000000000000000000000C4\r
+S3156000568000000000000000000000000000000000B4\r
+S3156000569000000000000000000000000000000000A4\r
+S315600056A00000000000000000000000000000000094\r
+S315600056B00000000000000000000000000000000084\r
+S315600056C00000000000000000000000000000000074\r
+S315600056D00000000000000000000000000000000064\r
+S315600056E00000000000000000000000000000000054\r
+S315600056F00000000000000000000000000000000044\r
+S315600057000000000000000000000000000000000033\r
+S315600057100000000000000000000000000000000023\r
+S315600057200000000000000000000000000000000013\r
+S315600057300000000000000000000000000000000003\r
+S3156000574000000000000000000000000000000000F3\r
+S3156000575000000000000000000000000000000000E3\r
+S3156000576000000000000000000000000000000000D3\r
+S3156000577000000000000000000000000000000000C3\r
+S3156000578000000000000000000000000000000000B3\r
+S3156000579000000000000000000000000000000000A3\r
+S315600057A00000000000000000000000000000000093\r
+S315600057B00000000000000000000000000000000083\r
+S315600057C00000000000000000000000000000000073\r
+S315600057D00000000000000000000000000000000063\r
+S315600057E00000000000000000000000000000000053\r
+S315600057F00000000000000000000000000000000043\r
+S315600058000000000000000000000000000000000032\r
+S315600058100000000000000000000000000000000022\r
+S315600058200000000000000000000000000000000012\r
+S315600058300000000000000000000000000000000002\r
+S3156000584000000000000000000000000000000000F2\r
+S3156000585000000000000000000000000000000000E2\r
+S3156000586000000000000000000000000000000000D2\r
+S3156000587000000000000000000000000000000000C2\r
+S3156000588000000000000000000000000000000000B2\r
+S3156000589000000000000000000000000000000000A2\r
+S315600058A00000000000000000000000000000000092\r
+S315600058B00000000000000000000000000000000082\r
+S315600058C00000000000000000000000000000000072\r
+S315600058D00000000000000000000000000000000062\r
+S315600058E00000000000000000000000000000000052\r
+S315600058F00000000000000000000000000000000042\r
+S315600059000000000000000000000000000000000031\r
+S315600059100000000000000000000000000000000021\r
+S315600059200000000000000000000000000000000011\r
+S315600059300000000000000000000000000000000001\r
+S3156000594000000000000000000000000000000000F1\r
+S3156000595000000000000000000000000000000000E1\r
+S3156000596000000000000000000000000000000000D1\r
+S3156000597000000000000000000000000000000000C1\r
+S3156000598000000000000000000000000000000000B1\r
+S3156000599000000000000000000000000000000000A1\r
+S315600059A00000000000000000000000000000000091\r
+S315600059B00000000000000000000000000000000081\r
+S315600059C00000000000000000000000000000000071\r
+S315600059D00000000000000000000000000000000061\r
+S315600059E00000000000000000000000000000000051\r
+S315600059F00000000000000000000000000000000041\r
+S31560005A000000000000000000000000000000000030\r
+S31560005A100000000000000000000000000000000020\r
+S31560005A200000000000000000000000000000000010\r
+S31560005A300000000000000000000000000000000000\r
+S31560005A4000000000000000000000000000000000F0\r
+S31560005A5000000000000000000000000000000000E0\r
+S31560005A6000000000000000000000000000000000D0\r
+S31560005A7000000000000000000000000000000000C0\r
+S31560005A8000000000000000000000000000000000B0\r
+S31560005A9000000000000000000000000000000000A0\r
+S31560005AA00000000000000000000000000000000090\r
+S31560005AB00000000000000000000000000000000080\r
+S31560005AC00000000000000000000000000000000070\r
+S31560005AD00000000000000000000000000000000060\r
+S31560005AE00000000000000000000000000000000050\r
+S31560005AF00000000000000000000000000000000040\r
+S31560005B00000000000000000000000000000000002F\r
+S31560005B10000000000000000000000000000000001F\r
+S31560005B20000000000000000000000000000000000F\r
+S31560005B3000000000000000000000000000000000FF\r
+S31560005B4000000000000000000000000000000000EF\r
+S31560005B5000000000000000000000000000000000DF\r
+S31560005B6000000000000000000000000000000000CF\r
+S31560005B7000000000000000000000000000000000BF\r
+S31560005B8000000000000000000000000000000000AF\r
+S31560005B90000000000000000000000000000000009F\r
+S31560005BA0000000000000000000000000000000008F\r
+S31560005BB0000000000000000000000000000000007F\r
+S31560005BC0000000000000000000000000000000006F\r
+S31560005BD0000000000000000000000000000000005F\r
+S31560005BE0000000000000000000000000000000004F\r
+S31560005BF0000000000000000000000000000000003F\r
+S31560005C00000000000000000000000000000000002E\r
+S31560005C10000000000000000000000000000000001E\r
+S31560005C20000000000000000000000000000000000E\r
+S31560005C3000000000000000000000000000000000FE\r
+S31560005C4000000000000000000000000000000000EE\r
+S31560005C5000000000000000000000000000000000DE\r
+S31560005C6000000000000000000000000000000000CE\r
+S31560005C7000000000000000000000000000000000BE\r
+S31560005C8000000000000000000000000000000000AE\r
+S31560005C90000000000000000000000000000000009E\r
+S31560005CA0000000000000000000000000000000008E\r
+S31560005CB0000000000000000000000000000000007E\r
+S31560005CC0000000000000000000000000000000006E\r
+S31560005CD0000000000000000000000000000000005E\r
+S31560005CE0000000000000000000000000000000004E\r
+S31560005CF0000000000000000000000000000000003E\r
+S31560005D00000000000000000000000000000000002D\r
+S31560005D10000000000000000000000000000000001D\r
+S31560005D20000000000000000000000000000000000D\r
+S31560005D3000000000000000000000000000000000FD\r
+S31560005D4000000000000000000000000000000000ED\r
+S31560005D5000000000000000000000000000000000DD\r
+S31560005D6000000000000000000000000000000000CD\r
+S31560005D7000000000000000000000000000000000BD\r
+S31560005D8000000000000000000000000000000000AD\r
+S31560005D90000000000000000000000000000000009D\r
+S31560005DA0000000000000000000000000000000008D\r
+S31560005DB0000000000000000000000000000000007D\r
+S31560005DC0000000000000000000000000000000006D\r
+S31560005DD0000000000000000000000000000000005D\r
+S31560005DE0000000000000000000000000000000004D\r
+S31560005DF0000000000000000000000000000000003D\r
+S31560005E00000000000000000000000000000000002C\r
+S31560005E10000000000000000000000000000000001C\r
+S31560005E20000000000000000000000000000000000C\r
+S31560005E3000000000000000000000000000000000FC\r
+S31560005E4000000000000000000000000000000000EC\r
+S31560005E5000000000000000000000000000000000DC\r
+S31560005E6000000000000000000000000000000000CC\r
+S31560005E7000000000000000000000000000000000BC\r
+S31560005E8000000000000000000000000000000000AC\r
+S31560005E90000000000000000000000000000000009C\r
+S31560005EA0000000000000000000000000000000008C\r
+S31560005EB0000000000000000000000000000000007C\r
+S31560005EC0000000000000000000000000000000006C\r
+S31560005ED0000000000000000000000000000000005C\r
+S31560005EE0000000000000000000000000000000004C\r
+S31560005EF0000000000000000000000000000000003C\r
+S31560005F00000000000000000000000000000000002B\r
+S31560005F10000000000000000000000000000000001B\r
+S31560005F20000000000000000000000000000000000B\r
+S31560005F3000000000000000000000000000000000FB\r
+S31560005F4000000000000000000000000000000000EB\r
+S31560005F5000000000000000000000000000000000DB\r
+S31560005F6000000000000000000000000000000000CB\r
+S31560005F7000000000000000000000000000000000BB\r
+S31560005F8000000000000000000000000000000000AB\r
+S31560005F90000000000000000000000000000000009B\r
+S31560005FA0000000000000000000000000000000008B\r
+S31560005FB0000000000000000000000000000000007B\r
+S31560005FC0000000000000000000000000000000006B\r
+S31560005FD0000000000000000000000000000000005B\r
+S31560005FE0000000000000000000000000000000004B\r
+S31560005FF0000000000000000000000000000000003B\r
+S31560006000000000000000000000000000000000002A\r
+S31560006010000000000000000000000000000000001A\r
+S31560006020000000000000000000000000000000000A\r
+S3156000603000000000000000000000000000000000FA\r
+S3156000604000000000000000000000000000000000EA\r
+S3156000605000000000000000000000000000000000DA\r
+S3156000606000000000000000000000000000000000CA\r
+S3156000607000000000000000000000000000000000BA\r
+S3156000608000000000000000000000000000000000AA\r
+S31560006090000000000000000000000000000000009A\r
+S315600060A0000000000000000000000000000000008A\r
+S315600060B0000000000000000000000000000000007A\r
+S315600060C0000000000000000000000000000000006A\r
+S315600060D0000000000000000000000000000000005A\r
+S315600060E0000000000000000000000000000000004A\r
+S315600060F0000000000000000000000000000000003A\r
+S315600061000000000000000000000000000000000029\r
+S315600061100000000000000000000000000000000019\r
+S315600061200000000000000000000000000000000009\r
+S3156000613000000000000000000000000000000000F9\r
+S3156000614000000000000000000000000000000000E9\r
+S3156000615000000000000000000000000000000000D9\r
+S3156000616000000000000000000000000000000000C9\r
+S3156000617000000000000000000000000000000000B9\r
+S3156000618000000000000000000000000000000000A9\r
+S315600061900000000000000000000000000000000099\r
+S315600061A00000000000000000000000000000000089\r
+S315600061B00000000000000000000000000000000079\r
+S315600061C00000000000000000000000000000000069\r
+S315600061D00000000000000000000000000000000059\r
+S315600061E00000000000000000000000000000000049\r
+S315600061F00000000000000000000000000000000039\r
+S315600062000000000000000000000000000000000028\r
+S315600062100000000000000000000000000000000018\r
+S315600062200000000000000000000000000000000008\r
+S3156000623000000000000000000000000000000000F8\r
+S3156000624000000000000000000000000000000000E8\r
+S3156000625000000000000000000000000000000000D8\r
+S3156000626000000000000000000000000000000000C8\r
+S3156000627000000000000000000000000000000000B8\r
+S3156000628000000000000000000000000000000000A8\r
+S315600062900000000000000000000000000000000098\r
+S315600062A00000000000000000000000000000000088\r
+S315600062B00000000000000000000000000000000078\r
+S315600062C00000000000000000000000000000000068\r
+S315600062D00000000000000000000000000000000058\r
+S315600062E00000000000000000000000000000000048\r
+S315600062F00000000000000000000000000000000038\r
+S315600063000000000000000000000000000000000027\r
+S315600063100000000000000000000000000000000017\r
+S315600063200000000000000000000000000000000007\r
+S3156000633000000000000000000000000000000000F7\r
+S3156000634000000000000000000000000000000000E7\r
+S3156000635000000000000000000000000000000000D7\r
+S3156000636000000000000000000000000000000000C7\r
+S3156000637000000000000000000000000000000000B7\r
+S3156000638000000000000000000000000000000000A7\r
+S315600063900000000000000000000000000000000097\r
+S315600063A00000000000000000000000000000000087\r
+S315600063B00000000000000000000000000000000077\r
+S315600063C00000000000000000000000000000000067\r
+S315600063D00000000000000000000000000000000057\r
+S315600063E00000000000000000000000000000000047\r
+S315600063F00000000000000000000000000000000037\r
+S315600064000000000000000000000000000000000026\r
+S315600064100000000000000000000000000000000016\r
+S315600064200000000000000000000000000000000006\r
+S3156000643000000000000000000000000000000000F6\r
+S3156000644000000000000000000000000000000000E6\r
+S3156000645000000000000000000000000000000000D6\r
+S3156000646000000000000000000000000000000000C6\r
+S3156000647000000000000000000000000000000000B6\r
+S3156000648000000000000000000000000000000000A6\r
+S315600064900000000000000000000000000000000096\r
+S315600064A00000000000000000000000000000000086\r
+S315600064B00000000000000000000000000000000076\r
+S315600064C00000000000000000000000000000000066\r
+S315600064D00000000000000000000000000000000056\r
+S315600064E00000000000000000000000000000000046\r
+S315600064F00000000000000000000000000000000036\r
+S315600065000000000000000000000000000000000025\r
+S315600065100000000000000000000000000000000015\r
+S315600065200000000000000000000000000000000005\r
+S3156000653000000000000000000000000000000000F5\r
+S3156000654000000000000000000000000000000000E5\r
+S3156000655000000000000000000000000000000000D5\r
+S3156000656000000000000000000000000000000000C5\r
+S3156000657000000000000000000000000000000000B5\r
+S3156000658000000000000000000000000000000000A5\r
+S315600065900000000000000000000000000000000095\r
+S315600065A00000000000000000000000000000000085\r
+S315600065B00000000000000000000000000000000075\r
+S315600065C00000000000000000000000000000000065\r
+S315600065D00000000000000000000000000000000055\r
+S315600065E00000000000000000000000000000000045\r
+S315600065F00000000000000000000000000000000035\r
+S315600066000000000000000000000000000000000024\r
+S315600066100000000000000000000000000000000014\r
+S315600066200000000000000000000000000000000004\r
+S3156000663000000000000000000000000000000000F4\r
+S3156000664000000000000000000000000000000000E4\r
+S3156000665000000000000000000000000000000000D4\r
+S3156000666000000000000000000000000000000000C4\r
+S3156000667000000000000000000000000000000000B4\r
+S3156000668000000000000000000000000000000000A4\r
+S315600066900000000000000000000000000000000094\r
+S315600066A00000000000000000000000000000000084\r
+S315600066B00000000000000000000000000000000074\r
+S315600066C00000000000000000000000000000000064\r
+S315600066D00000000000000000000000000000000054\r
+S315600066E00000000000000000000000000000000044\r
+S315600066F00000000000000000000000000000000034\r
+S315600067000000000000000000000000000000000023\r
+S315600067100000000000000000000000000000000013\r
+S315600067200000000000000000000000000000000003\r
+S3156000673000000000000000000000000000000000F3\r
+S3156000674000000000000000000000000000000000E3\r
+S3156000675000000000000000000000000000000000D3\r
+S3156000676000000000000000000000000000000000C3\r
+S3156000677000000000000000000000000000000000B3\r
+S3156000678000000000000000000000000000000000A3\r
+S315600067900000000000000000000000000000000093\r
+S315600067A00000000000000000000000000000000083\r
+S315600067B00000000000000000000000000000000073\r
+S315600067C00000000000000000000000000000000063\r
+S315600067D00000000000000000000000000000000053\r
+S315600067E00000000000000000000000000000000043\r
+S315600067F00000000000000000000000000000000033\r
+S315600068000000000000000000000000000000000022\r
+S315600068100000000000000000000000000000000012\r
+S315600068200000000000000000000000000000000002\r
+S3156000683000000000000000000000000000000000F2\r
+S3156000684000000000000000000000000000000000E2\r
+S3156000685000000000000000000000000000000000D2\r
+S3156000686000000000000000000000000000000000C2\r
+S3156000687000000000000000000000000000000000B2\r
+S3156000688000000000000000000000000000000000A2\r
+S315600068900000000000000000000000000000000092\r
+S315600068A00000000000000000000000000000000082\r
+S315600068B00000000000000000000000000000000072\r
+S315600068C00000000000000000000000000000000062\r
+S315600068D00000000000000000000000000000000052\r
+S315600068E00000000000000000000000000000000042\r
+S315600068F00000000000000000000000000000000032\r
+S315600069000000000000000000000000000000000021\r
+S315600069100000000000000000000000000000000011\r
+S315600069200000000000000000000000000000000001\r
+S3156000693000000000000000000000000000000000F1\r
+S3156000694000000000000000000000000000000000E1\r
+S3156000695000000000000000000000000000000000D1\r
+S3156000696000000000000000000000000000000000C1\r
+S3156000697000000000000000000000000000000000B1\r
+S3156000698000000000000000000000000000000000A1\r
+S315600069900000000000000000000000000000000091\r
+S315600069A00000000000000000000000000000000081\r
+S315600069B00000000000000000000000000000000071\r
+S315600069C00000000000000000000000000000000061\r
+S315600069D00000000000000000000000000000000051\r
+S315600069E00000000000000000000000000000000041\r
+S315600069F00000000000000000000000000000000031\r
+S31560006A000000000000000000000000000000000020\r
+S31560006A100000000000000000000000000000000010\r
+S31560006A200000000000000000000000000000000000\r
+S31560006A3000000000000000000000000000000000F0\r
+S31560006A4000000000000000000000000000000000E0\r
+S31560006A5000000000000000000000000000000000D0\r
+S31560006A6000000000000000000000000000000000C0\r
+S31560006A7000000000000000000000000000000000B0\r
+S31560006A8000000000000000000000000000000000A0\r
+S31560006A900000000000000000000000000000000090\r
+S31560006AA00000000000000000000000000000000080\r
+S31560006AB00000000000000000000000000000000070\r
+S31560006AC00000000000000000000000000000000060\r
+S31560006AD00000000000000000000000000000000050\r
+S31560006AE00000000000000000000000000000000040\r
+S31560006AF00000000000000000000000000000000030\r
+S31560006B00000000000000000000000000000000001F\r
+S31560006B10000000000000000000000000000000000F\r
+S31560006B2000000000000000000000000000000000FF\r
+S31560006B3000000000000000000000000000000000EF\r
+S31560006B4000000000000000000000000000000000DF\r
+S31560006B5000000000000000000000000000000000CF\r
+S31560006B6000000000000000000000000000000000BF\r
+S31560006B7000000000000000000000000000000000AF\r
+S31560006B80000000000000000000000000000000009F\r
+S31560006B90000000000000000000000000000000008F\r
+S31560006BA0000000000000000000000000000000007F\r
+S31560006BB0000000000000000000000000000000006F\r
+S31560006BC0000000000000000000000000000000005F\r
+S31560006BD0000000000000000000000000000000004F\r
+S31560006BE0000000000000000000000000000000003F\r
+S31560006BF0000000000000000000000000000000002F\r
+S31560006C00000000000000000000000000000000001E\r
+S31560006C10000000000000000000000000000000000E\r
+S31560006C2000000000000000000000000000000000FE\r
+S31560006C3000000000000000000000000000000000EE\r
+S31560006C4000000000000000000000000000000000DE\r
+S31560006C5000000000000000000000000000000000CE\r
+S31560006C6000000000000000000000000000000000BE\r
+S31560006C7000000000000000000000000000000000AE\r
+S31560006C80000000000000000000000000000000009E\r
+S31560006C90000000000000000000000000000000008E\r
+S31560006CA0000000000000000000000000000000007E\r
+S31560006CB0000000000000000000000000000000006E\r
+S31560006CC0000000000000000000000000000000005E\r
+S31560006CD0000000000000000000000000000000004E\r
+S31560006CE0000000000000000000000000000000003E\r
+S31560006CF0000000000000000000000000000000002E\r
+S31560006D00000000000000000000000000000000001D\r
+S31560006D10000000000000000000000000000000000D\r
+S31560006D2000000000000000000000000000000000FD\r
+S31560006D3000000000000000000000000000000000ED\r
+S31560006D4000000000000000000000000000000000DD\r
+S31560006D5000000000000000000000000000000000CD\r
+S31560006D6000000000000000000000000000000000BD\r
+S31560006D7000000000000000000000000000000000AD\r
+S31560006D80000000000000000000000000000000009D\r
+S31560006D90000000000000000000000000000000008D\r
+S31560006DA0000000000000000000000000000000007D\r
+S31560006DB0000000000000000000000000000000006D\r
+S31560006DC0000000000000000000000000000000005D\r
+S31560006DD0000000000000000000000000000000004D\r
+S31560006DE0000000000000000000000000000000003D\r
+S31560006DF0000000000000000000000000000000002D\r
+S31560006E00000000000000000000000000000000001C\r
+S31560006E10000000000000000000000000000000000C\r
+S31560006E2000000000000000000000000000000000FC\r
+S31560006E3000000000000000000000000000000000EC\r
+S31560006E4000000000000000000000000000000000DC\r
+S31560006E5000000000000000000000000000000000CC\r
+S31560006E6000000000000000000000000000000000BC\r
+S31560006E7000000000000000000000000000000000AC\r
+S31560006E80000000000000000000000000000000009C\r
+S31560006E90000000000000000000000000000000008C\r
+S31560006EA0000000000000000000000000000000007C\r
+S31560006EB0000000000000000000000000000000006C\r
+S31560006EC0000000000000000000000000000000005C\r
+S31560006ED0000000000000000000000000000000004C\r
+S31560006EE0000000000000000000000000000000003C\r
+S31560006EF0000000000000000000000000000000002C\r
+S31560006F00000000000000000000000000000000001B\r
+S31560006F10000000000000000000000000000000000B\r
+S31560006F2000000000000000000000000000000000FB\r
+S31560006F3000000000000000000000000000000000EB\r
+S31560006F4000000000000000000000000000000000DB\r
+S31560006F5000000000000000000000000000000000CB\r
+S31560006F6000000000000000000000000000000000BB\r
+S31560006F7000000000000000000000000000000000AB\r
+S31560006F80000000000000000000000000000000009B\r
+S31560006F90000000000000000000000000000000008B\r
+S31560006FA0000000000000000000000000000000007B\r
+S31560006FB0000000000000000000000000000000006B\r
+S31560006FC0000000000000000000000000000000005B\r
+S31560006FD0000000000000000000000000000000004B\r
+S31560006FE0000000000000000000000000000000003B\r
+S31560006FF0000000000000000000000000000000002B\r
+S31560007000000000000000000000000000000000001A\r
+S31560007010000000000000000000000000000000000A\r
+S3156000702000000000000000000000000000000000FA\r
+S3156000703000000000000000000000000000000000EA\r
+S3156000704000000000000000000000000000000000DA\r
+S3156000705000000000000000000000000000000000CA\r
+S3156000706000000000000000000000000000000000BA\r
+S3156000707000000000000000000000000000000000AA\r
+S31560007080000000000000000000000000000000009A\r
+S31560007090000000000000000000000000000000008A\r
+S315600070A0000000000000000000000000000000007A\r
+S315600070B0000000000000000000000000000000006A\r
+S315600070C0000000000000000000000000000000005A\r
+S315600070D0000000000000000000000000000000004A\r
+S315600070E0000000000000000000000000000000003A\r
+S315600070F0000000000000000000000000000000002A\r
+S315600071000000000000000000000000000000000019\r
+S315600071100000000000000000000000000000000009\r
+S3156000712000000000000000000000000000000000F9\r
+S3156000713000000000000000000000000000000000E9\r
+S3156000714000000000000000000000000000000000D9\r
+S3156000715000000000000000000000000000000000C9\r
+S3156000716000000000000000000000000000000000B9\r
+S3156000717000000000000000000000000000000000A9\r
+S315600071800000000000000000000000000000000099\r
+S315600071900000000000000000000000000000000089\r
+S315600071A00000000000000000000000000000000079\r
+S315600071B00000000000000000000000000000000069\r
+S315600071C00000000000000000000000000000000059\r
+S315600071D00000000000000000000000000000000049\r
+S315600071E00000000000000000000000000000000039\r
+S315600071F00000000000000000000000000000000029\r
+S315600072000000000000000000000000000000000018\r
+S315600072100000000000000000000000000000000008\r
+S3156000722000000000000000000000000000000000F8\r
+S3156000723000000000000000000000000000000000E8\r
+S3156000724000000000000000000000000000000000D8\r
+S3156000725000000000000000000000000000000000C8\r
+S3156000726000000000000000000000000000000000B8\r
+S3156000727000000000000000000000000000000000A8\r
+S315600072800000000000000000000000000000000098\r
+S315600072900000000000000000000000000000000088\r
+S315600072A00000000000000000000000000000000078\r
+S315600072B00000000000000000000000000000000068\r
+S315600072C00000000000000000000000000000000058\r
+S315600072D00000000000000000000000000000000048\r
+S315600072E00000000000000000000000000000000038\r
+S315600072F00000000000000000000000000000000028\r
+S315600073000000000000000000000000000000000017\r
+S315600073100000000000000000000000000000000007\r
+S3156000732000000000000000000000000000000000F7\r
+S3156000733000000000000000000000000000000000E7\r
+S3156000734000000000000000000000000000000000D7\r
+S3156000735000000000000000000000000000000000C7\r
+S3156000736000000000000000000000000000000000B7\r
+S3156000737000000000000000000000000000000000A7\r
+S315600073800000000000000000000000000000000097\r
+S315600073900000000000000000000000000000000087\r
+S315600073A00000000000000000000000000000000077\r
+S315600073B00000000000000000000000000000000067\r
+S315600073C00000000000000000000000000000000057\r
+S315600073D00000000000000000000000000000000047\r
+S315600073E00000000000000000000000000000000037\r
+S315600073F00000000000000000000000000000000027\r
+S315600074000000000000000000000000000000000016\r
+S315600074100000000000000000000000000000000006\r
+S3156000742000000000000000000000000000000000F6\r
+S3156000743000000000000000000000000000000000E6\r
+S3156000744000000000000000000000000000000000D6\r
+S3156000745000000000000000000000000000000000C6\r
+S3156000746000000000000000000000000000000000B6\r
+S3156000747000000000000000000000000000000000A6\r
+S315600074800000000000000000000000000000000096\r
+S315600074900000000000000000000000000000000086\r
+S315600074A00000000000000000000000000000000076\r
+S315600074B00000000000000000000000000000000066\r
+S315600074C00000000000000000000000000000000056\r
+S315600074D00000000000000000000000000000000046\r
+S315600074E00000000000000000000000000000000036\r
+S315600074F00000000000000000000000000000000026\r
+S315600075000000000000000000000000000000000015\r
+S315600075100000000000000000000000000000000005\r
+S3156000752000000000000000000000000000000000F5\r
+S3156000753000000000000000000000000000000000E5\r
+S3156000754000000000000000000000000000000000D5\r
+S3156000755000000000000000000000000000000000C5\r
+S3156000756000000000000000000000000000000000B5\r
+S3156000757000000000000000000000000000000000A5\r
+S315600075800000000000000000000000000000000095\r
+S315600075900000000000000000000000000000000085\r
+S315600075A00000000000000000000000000000000075\r
+S315600075B00000000000000000000000000000000065\r
+S315600075C00000000000000000000000000000000055\r
+S315600075D00000000000000000000000000000000045\r
+S315600075E00000000000000000000000000000000035\r
+S315600075F00000000000000000000000000000000025\r
+S315600076000000000000000000000000000000000014\r
+S315600076100000000000000000000000000000000004\r
+S3156000762000000000000000000000000000000000F4\r
+S3156000763000000000000000000000000000000000E4\r
+S3156000764000000000000000000000000000000000D4\r
+S3156000765000000000000000000000000000000000C4\r
+S3156000766000000000000000000000000000000000B4\r
+S3156000767000000000000000000000000000000000A4\r
+S315600076800000000000000000000000000000000094\r
+S315600076900000000000000000000000000000000084\r
+S315600076A00000000000000000000000000000000074\r
+S315600076B00000000000000000000000000000000064\r
+S315600076C00000000000000000000000000000000054\r
+S315600076D00000000000000000000000000000000044\r
+S315600076E00000000000000000000000000000000034\r
+S315600076F00000000000000000000000000000000024\r
+S315600077000000000000000000000000000000000013\r
+S315600077100000000000000000000000000000000003\r
+S3156000772000000000000000000000000000000000F3\r
+S3156000773000000000000000000000000000000000E3\r
+S3156000774000000000000000000000000000000000D3\r
+S3156000775000000000000000000000000000000000C3\r
+S3156000776000000000000000000000000000000000B3\r
+S3156000777000000000000000000000000000000000A3\r
+S315600077800000000000000000000000000000000093\r
+S315600077900000000000000000000000000000000083\r
+S315600077A00000000000000000000000000000000073\r
+S315600077B00000000000000000000000000000000063\r
+S315600077C00000000000000000000000000000000053\r
+S315600077D00000000000000000000000000000000043\r
+S315600077E00000000000000000000000000000000033\r
+S315600077F00000000000000000000000000000000023\r
+S315600078000000000000000000000000000000000012\r
+S315600078100000000000000000000000000000000002\r
+S3156000782000000000000000000000000000000000F2\r
+S3156000783000000000000000000000000000000000E2\r
+S3156000784000000000000000000000000000000000D2\r
+S3156000785000000000000000000000000000000000C2\r
+S3156000786000000000000000000000000000000000B2\r
+S3156000787000000000000000000000000000000000A2\r
+S315600078800000000000000000000000000000000092\r
+S315600078900000000000000000000000000000000082\r
+S315600078A00000000000000000000000000000000072\r
+S315600078B00000000000000000000000000000000062\r
+S315600078C00000000000000000000000000000000052\r
+S315600078D00000000000000000000000000000000042\r
+S315600078E00000000000000000000000000000000032\r
+S315600078F00000000000000000000000000000000022\r
+S315600079000000000000000000000000000000000011\r
+S315600079100000000000000000000000000000000001\r
+S3156000792000000000000000000000000000000000F1\r
+S3156000793000000000000000000000000000000000E1\r
+S3156000794000000000000000000000000000000000D1\r
+S3156000795000000000000000000000000000000000C1\r
+S3156000796000000000000000000000000000000000B1\r
+S3156000797000000000000000000000000000000000A1\r
+S315600079800000000000000000000000000000000091\r
+S315600079900000000000000000000000000000000081\r
+S315600079A00000000000000000000000000000000071\r
+S315600079B00000000000000000000000000000000061\r
+S315600079C00000000000000000000000000000000051\r
+S315600079D00000000000000000000000000000000041\r
+S315600079E00000000000000000000000000000000031\r
+S315600079F00000000000000000000000000000000021\r
+S31560007A000000000000000000000000000000000010\r
+S31560007A100000000000000000000000000000000000\r
+S31560007A2000000000000000000000000000000000F0\r
+S31560007A3000000000000000000000000000000000E0\r
+S31560007A4000000000000000000000000000000000D0\r
+S31560007A5000000000000000000000000000000000C0\r
+S31560007A6000000000000000000000000000000000B0\r
+S31560007A7000000000000000000000000000000000A0\r
+S31560007A800000000000000000000000000000000090\r
+S31560007A900000000000000000000000000000000080\r
+S31560007AA00000000000000000000000000000000070\r
+S31560007AB00000000000000000000000000000000060\r
+S31560007AC00000000000000000000000000000000050\r
+S31560007AD00000000000000000000000000000000040\r
+S31560007AE00000000000000000000000000000000030\r
+S31560007AF00000000000000000000000000000000020\r
+S31560007B00000000000000000000000000000000000F\r
+S31560007B1000000000000000000000000000000000FF\r
+S31560007B2000000000000000000000000000000000EF\r
+S31560007B3000000000000000000000000000000000DF\r
+S31560007B4000000000000000000000000000000000CF\r
+S31560007B5000000000000000000000000000000000BF\r
+S31560007B6000000000000000000000000000000000AF\r
+S31560007B70000000000000000000000000000000009F\r
+S31560007B80000000000000000000000000000000008F\r
+S31560007B90000000000000000000000000000000007F\r
+S31560007BA0000000000000000000000000000000006F\r
+S31560007BB0000000000000000000000000000000005F\r
+S31560007BC0000000000000000000000000000000004F\r
+S31560007BD0000000000000000000000000000000003F\r
+S31560007BE0000000000000000000000000000000002F\r
+S31560007BF0000000000000000000000000000000001F\r
+S31560007C00000000000000000000000000000000000E\r
+S31560007C1000000000000000000000000000000000FE\r
+S31560007C2000000000000000000000000000000000EE\r
+S31560007C3000000000000000000000000000000000DE\r
+S31560007C4000000000000000000000000000000000CE\r
+S31560007C5000000000000000000000000000000000BE\r
+S31560007C6000000000000000000000000000000000AE\r
+S31560007C70000000000000000000000000000000009E\r
+S31560007C80000000000000000000000000000000008E\r
+S31560007C90000000000000000000000000000000007E\r
+S31560007CA0000000000000000000000000000000006E\r
+S31560007CB0000000000000000000000000000000005E\r
+S31560007CC0000000000000000000000000000000004E\r
+S31560007CD0000000000000000000000000000000003E\r
+S31560007CE0000000000000000000000000000000002E\r
+S31560007CF0000000000000000000000000000000001E\r
+S31560007D00000000000000000000000000000000000D\r
+S31560007D1000000000000000000000000000000000FD\r
+S31560007D2000000000000000000000000000000000ED\r
+S31560007D3000000000000000000000000000000000DD\r
+S31560007D4000000000000000000000000000000000CD\r
+S31560007D5000000000000000000000000000000000BD\r
+S31560007D6000000000000000000000000000000000AD\r
+S31560007D70000000000000000000000000000000009D\r
+S31560007D80000000000000000000000000000000008D\r
+S31560007D90000000000000000000000000000000007D\r
+S31560007DA0000000000000000000000000000000006D\r
+S31560007DB0000000000000000000000000000000005D\r
+S31560007DC0000000000000000000000000000000004D\r
+S31560007DD0000000000000000000000000000000003D\r
+S31560007DE0000000000000000000000000000000002D\r
+S31560007DF0000000000000000000000000000000001D\r
+S31560007E00000000000000000000000000000000000C\r
+S31560007E1000000000000000000000000000000000FC\r
+S31560007E2000000000000000000000000000000000EC\r
+S31560007E3000000000000000000000000000000000DC\r
+S31560007E4000000000000000000000000000000000CC\r
+S31560007E5000000000000000000000000000000000BC\r
+S31560007E6000000000000000000000000000000000AC\r
+S31560007E70000000000000000000000000000000009C\r
+S31560007E80000000000000000000000000000000008C\r
+S31560007E90000000000000000000000000000000007C\r
+S31560007EA0000000000000000000000000000000006C\r
+S31560007EB0000000000000000000000000000000005C\r
+S31560007EC0000000000000000000000000000000004C\r
+S31560007ED0000000000000000000000000000000003C\r
+S31560007EE0000000000000000000000000000000002C\r
+S31560007EF0000000000000000000000000000000001C\r
+S31560007F00000000000000000000000000000000000B\r
+S31560007F1000000000000000000000000000000000FB\r
+S31560007F2000000000000000000000000000000000EB\r
+S31560007F3000000000000000000000000000000000DB\r
+S31560007F4000000000000000000000000000000000CB\r
+S31560007F5000000000000000000000000000000000BB\r
+S31560007F6000000000000000000000000000000000AB\r
+S31560007F70000000000000000000000000000000009B\r
+S31560007F80000000000000000000000000000000008B\r
+S31560007F90000000000000000000000000000000007B\r
+S31560007FA0000000000000000000000000000000006B\r
+S31560007FB0000000000000000000000000000000005B\r
+S31560007FC0000000000000000000000000000000004B\r
+S31560007FD0000000000000000000000000000000003B\r
+S31560007FE0000000000000000000000000000000002B\r
+S31560007FF0000000000000000000000000000000001B\r
+S31560008000000000000000000000000000000000000A\r
+S3156000801000000000000000000000000000000000FA\r
+S3156000802000000000000000000000000000000000EA\r
+S3156000803000000000000000000000000000000000DA\r
+S3156000804000000000000000000000000000000000CA\r
+S3156000805000000000000000000000000000000000BA\r
+S3156000806000000000000000000000000000000000AA\r
+S31560008070000000000000000000000000000000009A\r
+S31560008080000000000000000000000000000000008A\r
+S31560008090000000000000000000000000000000007A\r
+S315600080A0000000000000000000000000000000006A\r
+S315600080B0000000000000000000000000000000005A\r
+S315600080C0000000000000000000000000000000004A\r
+S315600080D0000000000000000000000000000000003A\r
+S315600080E0000000000000000000000000000000002A\r
+S315600080F0000000000000000000000000000000001A\r
+S315600081000000000000000000000000000000000009\r
+S3156000811000000000000000000000000000000000F9\r
+S3156000812000000000000000000000000000000000E9\r
+S3156000813000000000000000000000000000000000D9\r
+S3156000814000000000000000000000000000000000C9\r
+S3156000815000000000000000000000000000000000B9\r
+S3156000816000000000000000000000000000000000A9\r
+S315600081700000000000000000000000000000000099\r
+S315600081800000000000000000000000000000000089\r
+S315600081900000000000000000000000000000000079\r
+S315600081A00000000000000000000000000000000069\r
+S315600081B00000000000000000000000000000000059\r
+S315600081C00000000000000000000000000000000049\r
+S315600081D00000000000000000000000000000000039\r
+S315600081E00000000000000000000000000000000029\r
+S315600081F00000000000000000000000000000000019\r
+S315600082000000000000000000000000000000000008\r
+S3156000821000000000000000000000000000000000F8\r
+S3156000822000000000000000000000000000000000E8\r
+S3156000823000000000000000000000000000000000D8\r
+S3156000824000000000000000000000000000000000C8\r
+S3156000825000000000000000000000000000000000B8\r
+S3156000826000000000000000000000000000000000A8\r
+S315600082700000000000000000000000000000000098\r
+S315600082800000000000000000000000000000000088\r
+S315600082900000000000000000000000000000000078\r
+S315600082A00000000000000000000000000000000068\r
+S315600082B00000000000000000000000000000000058\r
+S315600082C00000000000000000000000000000000048\r
+S315600082D00000000000000000000000000000000038\r
+S315600082E00000000000000000000000000000000028\r
+S315600082F00000000000000000000000000000000018\r
+S315600083000000000000000000000000000000000007\r
+S3156000831000000000000000000000000000000000F7\r
+S3156000832000000000000000000000000000000000E7\r
+S3156000833000000000000000000000000000000000D7\r
+S3156000834000000000000000000000000000000000C7\r
+S3156000835000000000000000000000000000000000B7\r
+S3156000836000000000000000000000000000000000A7\r
+S315600083700000000000000000000000000000000097\r
+S315600083800000000000000000000000000000000087\r
+S315600083900000000000000000000000000000000077\r
+S315600083A00000000000000000000000000000000067\r
+S315600083B00000000000000000000000000000000057\r
+S315600083C00000000000000000000000000000000047\r
+S315600083D00000000000000000000000000000000037\r
+S315600083E00000000000000000000000000000000027\r
+S315600083F00000000000000000000000000000000017\r
+S315600084000000000000000000000000000000000006\r
+S3156000841000000000000000000000000000000000F6\r
+S3156000842000000000000000000000000000000000E6\r
+S3156000843000000000000000000000000000000000D6\r
+S3156000844000000000000000000000000000000000C6\r
+S3156000845000000000000000000000000000000000B6\r
+S3156000846000000000000000000000000000000000A6\r
+S315600084700000000000000000000000000000000096\r
+S315600084800000000000000000000000000000000086\r
+S315600084900000000000000000000000000000000076\r
+S315600084A00000000000000000000000000000000066\r
+S315600084B00000000000000000000000000000000056\r
+S315600084C00000000000000000000000000000000046\r
+S315600084D00000000000000000000000000000000036\r
+S315600084E00000000000000000000000000000000026\r
+S315600084F00000000000000000000000000000000016\r
+S315600085000000000000000000000000000000000005\r
+S3156000851000000000000000000000000000000000F5\r
+S3156000852000000000000000000000000000000000E5\r
+S3156000853000000000000000000000000000000000D5\r
+S3156000854000000000000000000000000000000000C5\r
+S3156000855000000000000000000000000000000000B5\r
+S3156000856000000000000000000000000000000000A5\r
+S315600085700000000000000000000000000000000095\r
+S315600085800000000000000000000000000000000085\r
+S315600085900000000000000000000000000000000075\r
+S315600085A00000000000000000000000000000000065\r
+S315600085B00000000000000000000000000000000055\r
+S315600085C00000000000000000000000000000000045\r
+S315600085D00000000000000000000000000000000035\r
+S315600085E00000000000000000000000000000000025\r
+S315600085F00000000000000000000000000000000015\r
+S315600086000000000000000000000000000000000004\r
+S3156000861000000000000000000000000000000000F4\r
+S3156000862000000000000000000000000000000000E4\r
+S3156000863000000000000000000000000000000000D4\r
+S3156000864000000000000000000000000000000000C4\r
+S3156000865000000000000000000000000000000000B4\r
+S3156000866000000000000000000000000000000000A4\r
+S315600086700000000000000000000000000000000094\r
+S315600086800000000000000000000000000000000084\r
+S315600086900000000000000000000000000000000074\r
+S315600086A00000000000000000000000000000000064\r
+S315600086B00000000000000000000000000000000054\r
+S315600086C00000000000000000000000000000000044\r
+S315600086D00000000000000000000000000000000034\r
+S315600086E00000000000000000000000000000000024\r
+S315600086F00000000000000000000000000000000014\r
+S315600087000000000000000000000000000000000003\r
+S3156000871000000000000000000000000000000000F3\r
+S3156000872000000000000000000000000000000000E3\r
+S3156000873000000000000000000000000000000000D3\r
+S3156000874000000000000000000000000000000000C3\r
+S3156000875000000000000000000000000000000000B3\r
+S3156000876000000000000000000000000000000000A3\r
+S315600087700000000000000000000000000000000093\r
+S315600087800000000000000000000000000000000083\r
+S315600087900000000000000000000000000000000073\r
+S315600087A00000000000000000000000000000000063\r
+S315600087B00000000000000000000000000000000053\r
+S315600087C00000000000000000000000000000000043\r
+S315600087D00000000000000000000000000000000033\r
+S315600087E00000000000000000000000000000000023\r
+S315600087F00000000000000000000000000000000013\r
+S315600088000000000000000000000000000000000002\r
+S3156000881000000000000000000000000000000000F2\r
+S3156000882000000000000000000000000000000000E2\r
+S3156000883000000000000000000000000000000000D2\r
+S3156000884000000000000000000000000000000000C2\r
+S3156000885000000000000000000000000000000000B2\r
+S3156000886000000000000000000000000000000000A2\r
+S315600088700000000000000000000000000000000092\r
+S315600088800000000000000000000000000000000082\r
+S315600088900000000000000000000000000000000072\r
+S315600088A00000000000000000000000000000000062\r
+S315600088B00000000000000000000000000000000052\r
+S315600088C00000000000000000000000000000000042\r
+S315600088D00000000000000000000000000000000032\r
+S315600088E00000000000000000000000000000000022\r
+S315600088F00000000000000000000000000000000012\r
+S315600089000000000000000000000000000000000001\r
+S3156000891000000000000000000000000000000000F1\r
+S3156000892000000000000000000000000000000000E1\r
+S3156000893000000000000000000000000000000000D1\r
+S3156000894000000000000000000000000000000000C1\r
+S3156000895000000000000000000000000000000000B1\r
+S3156000896000000000000000000000000000000000A1\r
+S315600089700000000000000000000000000000000091\r
+S315600089800000000000000000000000000000000081\r
+S315600089900000000000000000000000000000000071\r
+S315600089A00000000000000000000000000000000061\r
+S315600089B00000000000000000000000000000000051\r
+S315600089C00000000000000000000000000000000041\r
+S315600089D00000000000000000000000000000000031\r
+S315600089E00000000000000000000000000000000021\r
+S315600089F00000000000000000000000000000000011\r
+S31560008A000000000000000000000000000000000000\r
+S31560008A1000000000000000000000000000000000F0\r
+S31560008A2000000000000000000000000000000000E0\r
+S31560008A3000000000000000000000000000000000D0\r
+S31560008A4000000000000000000000000000000000C0\r
+S31560008A5000000000000000000000000000000000B0\r
+S31560008A6000000000000000000000000000000000A0\r
+S31560008A700000000000000000000000000000000090\r
+S31560008A800000000000000000000000000000000080\r
+S31560008A900000000000000000000000000000000070\r
+S31560008AA00000000000000000000000000000000060\r
+S31560008AB00000000000000000000000000000000050\r
+S31560008AC00000000000000000000000000000000040\r
+S31560008AD00000000000000000000000000000000030\r
+S31560008AE00000000000000000000000000000000020\r
+S31560008AF00000000000000000000000000000000010\r
+S31560008B0000000000000000000000000000000000FF\r
+S31560008B1000000000000000000000000000000000EF\r
+S31560008B2000000000000000000000000000000000DF\r
+S31560008B3000000000000000000000000000000000CF\r
+S31560008B4000000000000000000000000000000000BF\r
+S31560008B5000000000000000000000000000000000AF\r
+S31560008B60000000000000000000000000000000009F\r
+S31560008B70000000000000000000000000000000008F\r
+S31560008B80000000000000000000000000000000007F\r
+S31560008B90000000000000000000000000000000006F\r
+S31560008BA0000000000000000000000000000000005F\r
+S31560008BB0000000000000000000000000000000004F\r
+S31560008BC0000000000000000000000000000000003F\r
+S31560008BD0000000000000000000000000000000002F\r
+S31560008BE0000000000000000000000000000000001F\r
+S31560008BF0000000000000000000000000000000000F\r
+S31560008C0000000000000000000000000000000000FE\r
+S31560008C1000000000000000000000000000000000EE\r
+S31560008C2000000000000000000000000000000000DE\r
+S31560008C3000000000000000000000000000000000CE\r
+S31560008C4000000000000000000000000000000000BE\r
+S31560008C5000000000000000000000000000000000AE\r
+S31560008C60000000000000000000000000000000009E\r
+S31560008C70000000000000000000000000000000008E\r
+S31560008C80000000000000000000000000000000007E\r
+S31560008C90000000000000000000000000000000006E\r
+S31560008CA0000000000000000000000000000000005E\r
+S31560008CB0000000000000000000000000000000004E\r
+S31560008CC0000000000000000000000000000000003E\r
+S31560008CD0000000000000000000000000000000002E\r
+S31560008CE0000000000000000000000000000000001E\r
+S31560008CF0000000000000000000000000000000000E\r
+S31560008D0000000000000000000000000000000000FD\r
+S31560008D1000000000000000000000000000000000ED\r
+S31560008D2000000000000000000000000000000000DD\r
+S31560008D3000000000000000000000000000000000CD\r
+S31560008D4000000000000000000000000000000000BD\r
+S31560008D5000000000000000000000000000000000AD\r
+S31560008D60000000000000000000000000000000009D\r
+S31560008D70000000000000000000000000000000008D\r
+S31560008D80000000000000000000000000000000007D\r
+S31560008D90000000000000000000000000000000006D\r
+S31560008DA0000000000000000000000000000000005D\r
+S31560008DB0000000000000000000000000000000004D\r
+S31560008DC0000000000000000000000000000000003D\r
+S31560008DD0000000000000000000000000000000002D\r
+S31560008DE0000000000000000000000000000000001D\r
+S31560008DF0000000000000000000000000000000000D\r
+S31560008E0000000000000000000000000000000000FC\r
+S31560008E1000000000000000000000000000000000EC\r
+S31560008E2000000000000000000000000000000000DC\r
+S31560008E3000000000000000000000000000000000CC\r
+S31560008E4000000000000000000000000000000000BC\r
+S31560008E5000000000000000000000000000000000AC\r
+S31560008E60000000000000000000000000000000009C\r
+S31560008E70000000000000000000000000000000008C\r
+S31560008E80000000000000000000000000000000007C\r
+S31560008E90000000000000000000000000000000006C\r
+S31560008EA0000000000000000000000000000000005C\r
+S31560008EB0000000000000000000000000000000004C\r
+S31560008EC0000000000000000000000000000000003C\r
+S31560008ED0000000000000000000000000000000002C\r
+S31560008EE0000000000000000000000000000000001C\r
+S31560008EF0000000000000000000000000000000000C\r
+S31560008F0000000000000000000000000000000000FB\r
+S31560008F1000000000000000000000000000000000EB\r
+S31560008F2000000000000000000000000000000000DB\r
+S31560008F3000000000000000000000000000000000CB\r
+S31560008F4000000000000000000000000000000000BB\r
+S31560008F5000000000000000000000000000000000AB\r
+S31560008F60000000000000000000000000000000009B\r
+S31560008F70000000000000000000000000000000008B\r
+S31560008F80000000000000000000000000000000007B\r
+S31560008F90000000000000000000000000000000006B\r
+S31560008FA0000000000000000000000000000000005B\r
+S31560008FB0000000000000000000000000000000004B\r
+S31560008FC0000000000000000000000000000000003B\r
+S31560008FD0000000000000000000000000000000002B\r
+S31560008FE0000000000000000000000000000000001B\r
+S31560008FF0000000000000000000000000000000000B\r
+S3156000900000000000000000000000000000000000FA\r
+S3156000901000000000000000000000000000000000EA\r
+S3156000902000000000000000000000000000000000DA\r
+S3156000903000000000000000000000000000000000CA\r
+S3156000904000000000000000000000000000000000BA\r
+S3156000905000000000000000000000000000000000AA\r
+S31560009060000000000000000000000000000000009A\r
+S31560009070000000000000000000000000000000008A\r
+S31560009080000000000000000000000000000000007A\r
+S31560009090000000000000000000000000000000006A\r
+S315600090A0000000000000000000000000000000005A\r
+S315600090B0000000000000000000000000000000004A\r
+S315600090C0000000000000000000000000000000003A\r
+S315600090D0000000000000000000000000000000002A\r
+S315600090E0000000000000000000000000000000001A\r
+S315600090F0000000000000000000000000000000000A\r
+S3156000910000000000000000000000000000000000F9\r
+S3156000911000000000000000000000000000000000E9\r
+S3156000912000000000000000000000000000000000D9\r
+S3156000913000000000000000000000000000000000C9\r
+S3156000914000000000000000000000000000000000B9\r
+S3156000915000000000000000000000000000000000A9\r
+S315600091600000000000000000000000000000000099\r
+S315600091700000000000000000000000000000000089\r
+S315600091800000000000000000000000000000000079\r
+S315600091900000000000000000000000000000000069\r
+S315600091A00000000000000000000000000000000059\r
+S315600091B00000000000000000000000000000000049\r
+S315600091C00000000000000000000000000000000039\r
+S315600091D00000000000000000000000000000000029\r
+S315600091E00000000000000000000000000000000019\r
+S315600091F00000000000000000000000000000000009\r
+S3156000920000000000000000000000000000000000F8\r
+S3156000921000000000000000000000000000000000E8\r
+S3156000922000000000000000000000000000000000D8\r
+S3156000923000000000000000000000000000000000C8\r
+S3156000924000000000000000000000000000000000B8\r
+S3156000925000000000000000000000000000000000A8\r
+S315600092600000000000000000000000000000000098\r
+S315600092700000000000000000000000000000000088\r
+S315600092800000000000000000000000000000000078\r
+S315600092900000000000000000000000000000000068\r
+S315600092A00000000000000000000000000000000058\r
+S315600092B00000000000000000000000000000000048\r
+S315600092C00000000000000000000000000000000038\r
+S315600092D00000000000000000000000000000000028\r
+S315600092E00000000000000000000000000000000018\r
+S315600092F00000000000000000000000000000000008\r
+S3156000930000000000000000000000000000000000F7\r
+S3156000931000000000000000000000000000000000E7\r
+S3156000932000000000000000000000000000000000D7\r
+S3156000933000000000000000000000000000000000C7\r
+S3156000934000000000000000000000000000000000B7\r
+S3156000935000000000000000000000000000000000A7\r
+S315600093600000000000000000000000000000000097\r
+S315600093700000000000000000000000000000000087\r
+S315600093800000000000000000000000000000000077\r
+S315600093900000000000000000000000000000000067\r
+S315600093A00000000000000000000000000000000057\r
+S315600093B00000000000000000000000000000000047\r
+S315600093C00000000000000000000000000000000037\r
+S315600093D00000000000000000000000000000000027\r
+S315600093E00000000000000000000000000000000017\r
+S315600093F00000000000000000000000000000000007\r
+S3156000940000000000000000000000000000000000F6\r
+S3156000941000000000000000000000000000000000E6\r
+S3156000942000000000000000000000000000000000D6\r
+S3156000943000000000000000000000000000000000C6\r
+S3156000944000000000000000000000000000000000B6\r
+S3156000945000000000000000000000000000000000A6\r
+S315600094600000000000000000000000000000000096\r
+S315600094700000000000000000000000000000000086\r
+S315600094800000000000000000000000000000000076\r
+S315600094900000000000000000000000000000000066\r
+S315600094A00000000000000000000000000000000056\r
+S315600094B00000000000000000000000000000000046\r
+S315600094C00000000000000000000000000000000036\r
+S315600094D00000000000000000000000000000000026\r
+S315600094E00000000000000000000000000000000016\r
+S315600094F00000000000000000000000000000000006\r
+S3156000950000000000000000000000000000000000F5\r
+S3156000951000000000000000000000000000000000E5\r
+S3156000952000000000000000000000000000000000D5\r
+S3156000953000000000000000000000000000000000C5\r
+S3156000954000000000000000000000000000000000B5\r
+S3156000955000000000000000000000000000000000A5\r
+S315600095600000000000000000000000000000000095\r
+S315600095700000000000000000000000000000000085\r
+S315600095800000000000000000000000000000000075\r
+S315600095900000000000000000000000000000000065\r
+S315600095A00000000000000000000000000000000055\r
+S315600095B00000000000000000000000000000000045\r
+S315600095C00000000000000000000000000000000035\r
+S315600095D00000000000000000000000000000000025\r
+S315600095E00000000000000000000000000000000015\r
+S315600095F00000000000000000000000000000000005\r
+S3156000960000000000000000000000000000000000F4\r
+S3156000961000000000000000000000000000000000E4\r
+S3156000962000000000000000000000000000000000D4\r
+S3156000963000000000000000000000000000000000C4\r
+S3156000964000000000000000000000000000000000B4\r
+S3156000965000000000000000000000000000000000A4\r
+S315600096600000000000000000000000000000000094\r
+S315600096700000000000000000000000000000000084\r
+S315600096800000000000000000000000000000000074\r
+S315600096900000000000000000000000000000000064\r
+S315600096A00000000000000000000000000000000054\r
+S315600096B00000000000000000000000000000000044\r
+S315600096C00000000000000000000000000000000034\r
+S315600096D00000000000000000000000000000000024\r
+S315600096E00000000000000000000000000000000014\r
+S315600096F00000000000000000000000000000000004\r
+S3156000970000000000000000000000000000000000F3\r
+S3156000971000000000000000000000000000000000E3\r
+S3156000972000000000000000000000000000000000D3\r
+S3156000973000000000000000000000000000000000C3\r
+S3156000974000000000000000000000000000000000B3\r
+S3156000975000000000000000000000000000000000A3\r
+S315600097600000000000000000000000000000000093\r
+S315600097700000000000000000000000000000000083\r
+S315600097800000000000000000000000000000000073\r
+S315600097900000000000000000000000000000000063\r
+S315600097A00000000000000000000000000000000053\r
+S315600097B00000000000000000000000000000000043\r
+S315600097C00000000000000000000000000000000033\r
+S315600097D00000000000000000000000000000000023\r
+S315600097E00000000000000000000000000000000013\r
+S315600097F00000000000000000000000000000000003\r
+S3156000980000000000000000000000000000000000F2\r
+S3156000981000000000000000000000000000000000E2\r
+S3156000982000000000000000000000000000000000D2\r
+S3156000983000000000000000000000000000000000C2\r
+S3156000984000000000000000000000000000000000B2\r
+S3156000985000000000000000000000000000000000A2\r
+S315600098600000000000000000000000000000000092\r
+S315600098700000000000000000000000000000000082\r
+S315600098800000000000000000000000000000000072\r
+S315600098900000000000000000000000000000000062\r
+S315600098A00000000000000000000000000000000052\r
+S315600098B00000000000000000000000000000000042\r
+S315600098C00000000000000000000000000000000032\r
+S315600098D00000000000000000000000000000000022\r
+S315600098E00000000000000000000000000000000012\r
+S315600098F00000000000000000000000000000000002\r
+S3156000990000000000000000000000000000000000F1\r
+S3156000991000000000000000000000000000000000E1\r
+S3156000992000000000000000000000000000000000D1\r
+S3156000993000000000000000000000000000000000C1\r
+S3156000994000000000000000000000000000000000B1\r
+S3156000995000000000000000000000000000000000A1\r
+S315600099600000000000000000000000000000000091\r
+S315600099700000000000000000000000000000000081\r
+S315600099800000000000000000000000000000000071\r
+S315600099900000000000000000000000000000000061\r
+S315600099A00000000000000000000000000000000051\r
+S315600099B00000000000000000000000000000000041\r
+S315600099C00000000000000000000000000000000031\r
+S315600099D00000000000000000000000000000000021\r
+S315600099E00000000000000000000000000000000011\r
+S315600099F00000000000000000000000000000000001\r
+S31560009A0000000000000000000000000000000000F0\r
+S31560009A1000000000000000000000000000000000E0\r
+S31560009A2000000000000000000000000000000000D0\r
+S31560009A3000000000000000000000000000000000C0\r
+S31560009A4000000000000000000000000000000000B0\r
+S31560009A5000000000000000000000000000000000A0\r
+S31560009A600000000000000000000000000000000090\r
+S31560009A700000000000000000000000000000000080\r
+S31560009A800000000000000000000000000000000070\r
+S31560009A900000000000000000000000000000000060\r
+S31560009AA00000000000000000000000000000000050\r
+S31560009AB00000000000000000000000000000000040\r
+S31560009AC00000000000000000000000000000000030\r
+S31560009AD00000000000000000000000000000000020\r
+S31560009AE00000000000000000000000000000000010\r
+S31560009AF00000000000000000000000000000000000\r
+S31560009B0000000000000000000000000000000000EF\r
+S31560009B1000000000000000000000000000000000DF\r
+S31560009B2000000000000000000000000000000000CF\r
+S31560009B3000000000000000000000000000000000BF\r
+S31560009B4000000000000000000000000000000000AF\r
+S31560009B50000000000000000000000000000000009F\r
+S31560009B60000000000000000000000000000000008F\r
+S31560009B70000000000000000000000000000000007F\r
+S31560009B80000000000000000000000000000000006F\r
+S31560009B90000000000000000000000000000000005F\r
+S31560009BA0000000000000000000000000000000004F\r
+S31560009BB0000000000000000000000000000000003F\r
+S31560009BC0000000000000000000000000000000002F\r
+S31560009BD0000000000000000000000000000000001F\r
+S31560009BE0000000000000000000000000000000000F\r
+S31560009BF000000000000000000000000000000000FF\r
+S31560009C0000000000000000000000000000000000EE\r
+S31560009C1000000000000000000000000000000000DE\r
+S31560009C2000000000000000000000000000000000CE\r
+S31560009C3000000000000000000000000000000000BE\r
+S31560009C4000000000000000000000000000000000AE\r
+S31560009C50000000000000000000000000000000009E\r
+S31560009C60000000000000000000000000000000008E\r
+S31560009C70000000000000000000000000000000007E\r
+S31560009C80000000000000000000000000000000006E\r
+S31560009C90000000000000000000000000000000005E\r
+S31560009CA0000000000000000000000000000000004E\r
+S31560009CB0000000000000000000000000000000003E\r
+S31560009CC0000000000000000000000000000000002E\r
+S31560009CD0000000000000000000000000000000001E\r
+S31560009CE0000000000000000000000000000000000E\r
+S31560009CF000000000000000000000000000000000FE\r
+S31560009D0000000000000000000000000000000000ED\r
+S31560009D1000000000000000000000000000000000DD\r
+S31560009D2000000000000000000000000000000000CD\r
+S31560009D3000000000000000000000000000000000BD\r
+S31560009D4000000000000000000000000000000000AD\r
+S31560009D50000000000000000000000000000000009D\r
+S31560009D60000000000000000000000000000000008D\r
+S31560009D70000000000000000000000000000000007D\r
+S31560009D80000000000000000000000000000000006D\r
+S31560009D90000000000000000000000000000000005D\r
+S31560009DA0000000000000000000000000000000004D\r
+S31560009DB0000000000000000000000000000000003D\r
+S31560009DC0000000000000000000000000000000002D\r
+S31560009DD0000000000000000000000000000000001D\r
+S31560009DE0000000000000000000000000000000000D\r
+S31560009DF000000000000000000000000000000000FD\r
+S31560009E0000000000000000000000000000000000EC\r
+S31560009E1000000000000000000000000000000000DC\r
+S31560009E2000000000000000000000000000000000CC\r
+S31560009E3000000000000000000000000000000000BC\r
+S31560009E4000000000000000000000000000000000AC\r
+S31560009E50000000000000000000000000000000009C\r
+S31560009E60000000000000000000000000000000008C\r
+S31560009E70000000000000000000000000000000007C\r
+S31560009E80000000000000000000000000000000006C\r
+S31560009E90000000000000000000000000000000005C\r
+S31560009EA0000000000000000000000000000000004C\r
+S31560009EB0000000000000000000000000000000003C\r
+S31560009EC0000000000000000000000000000000002C\r
+S31560009ED0000000000000000000000000000000001C\r
+S31560009EE0000000000000000000000000000000000C\r
+S31560009EF000000000000000000000000000000000FC\r
+S31560009F0000000000000000000000000000000000EB\r
+S31560009F1000000000000000000000000000000000DB\r
+S31560009F2000000000000000000000000000000000CB\r
+S31560009F3000000000000000000000000000000000BB\r
+S31560009F4000000000000000000000000000000000AB\r
+S31560009F50000000000000000000000000000000009B\r
+S31560009F60000000000000000000000000000000008B\r
+S31560009F70000000000000000000000000000000007B\r
+S31560009F80000000000000000000000000000000006B\r
+S31560009F90000000000000000000000000000000005B\r
+S31560009FA0000000000000000000000000000000004B\r
+S31560009FB0000000000000000000000000000000003B\r
+S31560009FC0000000000000000000000000000000002B\r
+S31560009FD0000000000000000000000000000000001B\r
+S31560009FE0000000000000000000000000000000000B\r
+S31560009FF000000000000000000000000000000000FB\r
+S3156000A00000000000000000000000000000000000EA\r
+S3156000A01000000000000000000000000000000000DA\r
+S3156000A02000000000000000000000000000000000CA\r
+S3156000A03000000000000000000000000000000000BA\r
+S3156000A04000000000000000000000000000000000AA\r
+S3156000A050000000000000000000000000000000009A\r
+S3156000A060000000000000000000000000000000008A\r
+S3156000A070000000000000000000000000000000007A\r
+S3156000A080000000000000000000000000000000006A\r
+S3156000A090000000000000000000000000000000005A\r
+S3156000A0A0000000000000000000000000000000004A\r
+S3156000A0B0000000000000000000000000000000003A\r
+S3156000A0C0000000000000000000000000000000002A\r
+S3156000A0D0000000000000000000000000000000001A\r
+S3156000A0E0000000000000000000000000000000000A\r
+S3156000A0F000000000000000000000000000000000FA\r
+S3156000A10000000000000000000000000000000000E9\r
+S3156000A11000000000000000000000000000000000D9\r
+S3156000A12000000000000000000000000000000000C9\r
+S3156000A13000000000000000000000000000000000B9\r
+S3156000A14000000000000000000000000000000000A9\r
+S3156000A1500000000000000000000000000000000099\r
+S3156000A1600000000000000000000000000000000089\r
+S3156000A1700000000000000000000000000000000079\r
+S3156000A1800000000000000000000000000000000069\r
+S3156000A1900000000000000000000000000000000059\r
+S3156000A1A00000000000000000000000000000000049\r
+S3156000A1B00000000000000000000000000000000039\r
+S3156000A1C00000000000000000000000000000000029\r
+S3156000A1D00000000000000000000000000000000019\r
+S3156000A1E00000000000000000000000000000000009\r
+S3156000A1F000000000000000000000000000000000F9\r
+S3156000A20000000000000000000000000000000000E8\r
+S3156000A21000000000000000000000000000000000D8\r
+S3156000A22000000000000000000000000000000000C8\r
+S3156000A23000000000000000000000000000000000B8\r
+S3156000A24000000000000000000000000000000000A8\r
+S3156000A2500000000000000000000000000000000098\r
+S3156000A2600000000000000000000000000000000088\r
+S3156000A2700000000000000000000000000000000078\r
+S3156000A2800000000000000000000000000000000068\r
+S3156000A2900000000000000000000000000000000058\r
+S3156000A2A00000000000000000000000000000000048\r
+S3156000A2B00000000000000000000000000000000038\r
+S3156000A2C00000000000000000000000000000000028\r
+S3156000A2D00000000000000000000000000000000018\r
+S3156000A2E00000000000000000000000000000000008\r
+S3156000A2F000000000000000000000000000000000F8\r
+S3156000A30000000000000000000000000000000000E7\r
+S3156000A31000000000000000000000000000000000D7\r
+S3156000A32000000000000000000000000000000000C7\r
+S3156000A33000000000000000000000000000000000B7\r
+S3156000A34000000000000000000000000000000000A7\r
+S3156000A3500000000000000000000000000000000097\r
+S3156000A3600000000000000000000000000000000087\r
+S3156000A3700000000000000000000000000000000077\r
+S3156000A3800000000000000000000000000000000067\r
+S3156000A3900000000000000000000000000000000057\r
+S3156000A3A00000000000000000000000000000000047\r
+S3156000A3B00000000000000000000000000000000037\r
+S3156000A3C00000000000000000000000000000000027\r
+S3156000A3D00000000000000000000000000000000017\r
+S3156000A3E00000000000000000000000000000000007\r
+S3156000A3F000000000000000000000000000000000F7\r
+S3156000A40000000000000000000000000000000000E6\r
+S3156000A41000000000000000000000000000000000D6\r
+S3156000A42000000000000000000000000000000000C6\r
+S3156000A43000000000000000000000000000000000B6\r
+S3156000A44000000000000000000000000000000000A6\r
+S3156000A4500000000000000000000000000000000096\r
+S3156000A4600000000000000000000000000000000086\r
+S3156000A4700000000000000000000000000000000076\r
+S3156000A4800000000000000000000000000000000066\r
+S3156000A4900000000000000000000000000000000056\r
+S3156000A4A00000000000000000000000000000000046\r
+S3156000A4B00000000000000000000000000000000036\r
+S3156000A4C00000000000000000000000000000000026\r
+S3156000A4D00000000000000000000000000000000016\r
+S3156000A4E00000000000000000000000000000000006\r
+S3156000A4F000000000000000000000000000000000F6\r
+S3156000A50000000000000000000000000000000000E5\r
+S3156000A51000000000000000000000000000000000D5\r
+S3156000A52000000000000000000000000000000000C5\r
+S3156000A53000000000000000000000000000000000B5\r
+S3156000A54000000000000000000000000000000000A5\r
+S3156000A5500000000000000000000000000000000095\r
+S3156000A5600000000000000000000000000000000085\r
+S3156000A5700000000000000000000000000000000075\r
+S3156000A5800000000000000000000000000000000065\r
+S3156000A5900000000000000000000000000000000055\r
+S3156000A5A00000000000000000000000000000000045\r
+S3156000A5B00000000000000000000000000000000035\r
+S3156000A5C00000000000000000000000000000000025\r
+S3156000A5D00000000000000000000000000000000015\r
+S3156000A5E00000000000000000000000000000000005\r
+S3156000A5F000000000000000000000000000000000F5\r
+S3156000A60000000000000000000000000000000000E4\r
+S3156000A61000000000000000000000000000000000D4\r
+S3156000A62000000000000000000000000000000000C4\r
+S3156000A63000000000000000000000000000000000B4\r
+S3156000A64000000000000000000000000000000000A4\r
+S3156000A6500000000000000000000000000000000094\r
+S3156000A6600000000000000000000000000000000084\r
+S3156000A6700000000000000000000000000000000074\r
+S3156000A6800000000000000000000000000000000064\r
+S3156000A6900000000000000000000000000000000054\r
+S3156000A6A00000000000000000000000000000000044\r
+S3156000A6B00000000000000000000000000000000034\r
+S3156000A6C00000000000000000000000000000000024\r
+S3156000A6D00000000000000000000000000000000014\r
+S3156000A6E00000000000000000000000000000000004\r
+S3156000A6F000000000000000000000000000000000F4\r
+S3156000A70000000000000000000000000000000000E3\r
+S3156000A71000000000000000000000000000000000D3\r
+S3156000A72000000000000000000000000000000000C3\r
+S3156000A73000000000000000000000000000000000B3\r
+S3156000A74000000000000000000000000000000000A3\r
+S3156000A7500000000000000000000000000000000093\r
+S3156000A7600000000000000000000000000000000083\r
+S3156000A7700000000000000000000000000000000073\r
+S3156000A7800000000000000000000000000000000063\r
+S3156000A7900000000000000000000000000000000053\r
+S3156000A7A00000000000000000000000000000000043\r
+S3156000A7B00000000000000000000000000000000033\r
+S3156000A7C00000000000000000000000000000000023\r
+S3156000A7D00000000000000000000000000000000013\r
+S3156000A7E00000000000000000000000000000000003\r
+S3156000A7F000000000000000000000000000000000F3\r
+S3156000A80000000000000000000000000000000000E2\r
+S3156000A81000000000000000000000000000000000D2\r
+S3156000A82000000000000000000000000000000000C2\r
+S3156000A83000000000000000000000000000000000B2\r
+S3156000A84000000000000000000000000000000000A2\r
+S3156000A8500000000000000000000000000000000092\r
+S3156000A8600000000000000000000000000000000082\r
+S3156000A8700000000000000000000000000000000072\r
+S3156000A8800000000000000000000000000000000062\r
+S3156000A8900000000000000000000000000000000052\r
+S3156000A8A00000000000000000000000000000000042\r
+S3156000A8B00000000000000000000000000000000032\r
+S3156000A8C00000000000000000000000000000000022\r
+S3156000A8D00000000000000000000000000000000012\r
+S3156000A8E00000000000000000000000000000000002\r
+S3156000A8F000000000000000000000000000000000F2\r
+S3156000A90000000000000000000000000000000000E1\r
+S3156000A91000000000000000000000000000000000D1\r
+S3156000A92000000000000000000000000000000000C1\r
+S3156000A93000000000000000000000000000000000B1\r
+S3156000A94000000000000000000000000000000000A1\r
+S3156000A9500000000000000000000000000000000091\r
+S3156000A9600000000000000000000000000000000081\r
+S3156000A9700000000000000000000000000000000071\r
+S3156000A9800000000000000000000000000000000061\r
+S3156000A9900000000000000000000000000000000051\r
+S3156000A9A00000000000000000000000000000000041\r
+S3156000A9B00000000000000000000000000000000031\r
+S3156000A9C00000000000000000000000000000000021\r
+S3156000A9D00000000000000000000000000000000011\r
+S3156000A9E00000000000000000000000000000000001\r
+S3156000A9F000000000000000000000000000000000F1\r
+S3156000AA0000000000000000000000000000000000E0\r
+S3156000AA1000000000000000000000000000000000D0\r
+S3156000AA2000000000000000000000000000000000C0\r
+S3156000AA3000000000000000000000000000000000B0\r
+S3156000AA4000000000000000000000000000000000A0\r
+S3156000AA500000000000000000000000000000000090\r
+S3156000AA600000000000000000000000000000000080\r
+S3156000AA700000000000000000000000000000000070\r
+S3156000AA800000000000000000000000000000000060\r
+S3156000AA900000000000000000000000000000000050\r
+S3156000AAA00000000000000000000000000000000040\r
+S3156000AAB00000000000000000000000000000000030\r
+S3156000AAC00000000000000000000000000000000020\r
+S3156000AAD00000000000000000000000000000000010\r
+S3156000AAE00000000000000000000000000000000000\r
+S3156000AAF000000000000000000000000000000000F0\r
+S3156000AB0000000000000000000000000000000000DF\r
+S3156000AB1000000000000000000000000000000000CF\r
+S3156000AB2000000000000000000000000000000000BF\r
+S3156000AB3000000000000000000000000000000000AF\r
+S3156000AB40000000000000000000000000000000009F\r
+S3156000AB50000000000000000000000000000000008F\r
+S3156000AB60000000000000000000000000000000007F\r
+S3156000AB70000000000000000000000000000000006F\r
+S3156000AB80000000000000000000000000000000005F\r
+S3156000AB90000000000000000000000000000000004F\r
+S3156000ABA0000000000000000000000000000000003F\r
+S3156000ABB0000000000000000000000000000000002F\r
+S3156000ABC0000000000000000000000000000000001F\r
+S3156000ABD0000000000000000000000000000000000F\r
+S3156000ABE000000000000000000000000000000000FF\r
+S3156000ABF000000000000000000000000000000000EF\r
+S3156000AC0000000000000000000000000000000000DE\r
+S3156000AC1000000000000000000000000000000000CE\r
+S3156000AC2000000000000000000000000000000000BE\r
+S3156000AC3000000000000000000000000000000000AE\r
+S3156000AC40000000000000000000000000000000009E\r
+S3156000AC50000000000000000000000000000000008E\r
+S3156000AC60000000000000000000000000000000007E\r
+S3156000AC70000000000000000000000000000000006E\r
+S3156000AC80000000000000000000000000000000005E\r
+S3156000AC90000000000000000000000000000000004E\r
+S3156000ACA0000000000000000000000000000000003E\r
+S3156000ACB0000000000000000000000000000000002E\r
+S3156000ACC0000000000000000000000000000000001E\r
+S3156000ACD0000000000000000000000000000000000E\r
+S3156000ACE000000000000000000000000000000000FE\r
+S3156000ACF000000000000000000000000000000000EE\r
+S3156000AD0000000000000000000000000000000000DD\r
+S3156000AD1000000000000000000000000000000000CD\r
+S3156000AD2000000000000000000000000000000000BD\r
+S3156000AD3000000000000000000000000000000000AD\r
+S3156000AD40000000000000000000000000000000009D\r
+S3156000AD50000000000000000000000000000000008D\r
+S3156000AD60000000000000000000000000000000007D\r
+S3156000AD70000000000000000000000000000000006D\r
+S3156000AD80000000000000000000000000000000005D\r
+S3156000AD90000000000000000000000000000000004D\r
+S3156000ADA0000000000000000000000000000000003D\r
+S3156000ADB0000000000000000000000000000000002D\r
+S3156000ADC0000000000000000000000000000000001D\r
+S3156000ADD0000000000000000000000000000000000D\r
+S3156000ADE000000000000000000000000000000000FD\r
+S3156000ADF000000000000000000000000000000000ED\r
+S3156000AE0000000000000000000000000000000000DC\r
+S3156000AE1000000000000000000000000000000000CC\r
+S3156000AE2000000000000000000000000000000000BC\r
+S3156000AE3000000000000000000000000000000000AC\r
+S3156000AE40000000000000000000000000000000009C\r
+S3156000AE50000000000000000000000000000000008C\r
+S3156000AE60000000000000000000000000000000007C\r
+S3156000AE70000000000000000000000000000000006C\r
+S3156000AE80000000000000000000000000000000005C\r
+S3156000AE90000000000000000000000000000000004C\r
+S3156000AEA0000000000000000000000000000000003C\r
+S3156000AEB0000000000000000000000000000000002C\r
+S3156000AEC0000000000000000000000000000000001C\r
+S3156000AED0000000000000000000000000000000000C\r
+S3156000AEE000000000000000000000000000000000FC\r
+S3156000AEF000000000000000000000000000000000EC\r
+S3156000AF0000000000000000000000000000000000DB\r
+S3156000AF1000000000000000000000000000000000CB\r
+S3156000AF2000000000000000000000000000000000BB\r
+S3156000AF3000000000000000000000000000000000AB\r
+S3156000AF40000000000000000000000000000000009B\r
+S3156000AF50000000000000000000000000000000008B\r
+S3156000AF60000000000000000000000000000000007B\r
+S3156000AF70000000000000000000000000000000006B\r
+S3156000AF80000000000000000000000000000000005B\r
+S3156000AF90000000000000000000000000000000004B\r
+S3156000AFA0000000000000000000000000000000003B\r
+S3156000AFB0000000000000000000000000000000002B\r
+S3156000AFC0000000000000000000000000000000001B\r
+S3156000AFD0000000000000000000000000000000000B\r
+S3156000AFE000000000000000000000000000000000FB\r
+S3156000AFF000000000000000000000000000000000EB\r
+S3156000B00000000000000000000000000000000000DA\r
+S3156000B01000000000000000000000000000000000CA\r
+S3156000B02000000000000000000000000000000000BA\r
+S3156000B03000000000000000000000000000000000AA\r
+S3156000B040000000000000000000000000000000009A\r
+S3156000B050000000000000000000000000000000008A\r
+S3156000B060000000000000000000000000000000007A\r
+S3156000B070000000000000000000000000000000006A\r
+S3156000B080000000000000000000000000000000005A\r
+S3156000B090000000000000000000000000000000004A\r
+S3156000B0A0000000000000000000000000000000003A\r
+S3156000B0B0000000000000000000000000000000002A\r
+S3156000B0C0000000000000000000000000000000001A\r
+S3156000B0D0000000000000000000000000000000000A\r
+S3156000B0E000000000000000000000000000000000FA\r
+S3156000B0F000000000000000000000000000000000EA\r
+S3156000B10000000000000000000000000000000000D9\r
+S3156000B11000000000000000000000000000000000C9\r
+S3156000B12000000000000000000000000000000000B9\r
+S3156000B13000000000000000000000000000000000A9\r
+S3156000B1400000000000000000000000000000000099\r
+S3156000B1500000000000000000000000000000000089\r
+S3156000B1600000000000000000000000000000000079\r
+S3156000B1700000000000000000000000000000000069\r
+S3156000B1800000000000000000000000000000000059\r
+S3156000B1900000000000000000000000000000000049\r
+S3156000B1A00000000000000000000000000000000039\r
+S3156000B1B00000000000000000000000000000000029\r
+S3156000B1C00000000000000000000000000000000019\r
+S3156000B1D00000000000000000000000000000000009\r
+S3156000B1E000000000000000000000000000000000F9\r
+S3156000B1F000000000000000000000000000000000E9\r
+S3156000B20000000000000000000000000000000000D8\r
+S3156000B21000000000000000000000000000000000C8\r
+S3156000B22000000000000000000000000000000000B8\r
+S3156000B23000000000000000000000000000000000A8\r
+S3156000B2400000000000000000000000000000000098\r
+S3156000B2500000000000000000000000000000000088\r
+S3156000B2600000000000000000000000000000000078\r
+S3156000B2700000000000000000000000000000000068\r
+S3156000B2800000000000000000000000000000000058\r
+S3156000B2900000000000000000000000000000000048\r
+S3156000B2A00000000000000000000000000000000038\r
+S3156000B2B00000000000000000000000000000000028\r
+S3156000B2C00000000000000000000000000000000018\r
+S3156000B2D00000000000000000000000000000000008\r
+S3156000B2E000000000000000000000000000000000F8\r
+S3156000B2F000000000000000000000000000000000E8\r
+S3156000B30000000000000000000000000000000000D7\r
+S3156000B31000000000000000000000000000000000C7\r
+S3156000B32000000000000000000000000000000000B7\r
+S3156000B33000000000000000000000000000000000A7\r
+S3156000B3400000000000000000000000000000000097\r
+S3156000B3500000000000000000000000000000000087\r
+S3156000B3600000000000000000000000000000000077\r
+S3156000B3700000000000000000000000000000000067\r
+S3156000B3800000000000000000000000000000000057\r
+S3156000B3900000000000000000000000000000000047\r
+S3156000B3A00000000000000000000000000000000037\r
+S3156000B3B00000000000000000000000000000000027\r
+S3156000B3C00000000000000000000000000000000017\r
+S3156000B3D00000000000000000000000000000000007\r
+S3156000B3E000000000000000000000000000000000F7\r
+S3156000B3F000000000000000000000000000000000E7\r
+S3156000B40000000000000000000000000000000000D6\r
+S3156000B41000000000000000000000000000000000C6\r
+S3156000B42000000000000000000000000000000000B6\r
+S3156000B43000000000000000000000000000000000A6\r
+S3156000B4400000000000000000000000000000000096\r
+S3156000B4500000000000000000000000000000000086\r
+S3156000B4600000000000000000000000000000000076\r
+S3156000B4700000000000000000000000000000000066\r
+S3156000B4800000000000000000000000000000000056\r
+S3156000B4900000000000000000000000000000000046\r
+S3156000B4A00000000000000000000000000000000036\r
+S3156000B4B00000000000000000000000000000000026\r
+S3156000B4C00000000000000000000000000000000016\r
+S3156000B4D00000000000000000000000000000000006\r
+S3156000B4E000000000000000000000000000000000F6\r
+S3156000B4F000000000000000000000000000000000E6\r
+S3156000B50000000000000000000000000000000000D5\r
+S3156000B51000000000000000000000000000000000C5\r
+S3156000B52000000000000000000000000000000000B5\r
+S3156000B53000000000000000000000000000000000A5\r
+S3156000B5400000000000000000000000000000000095\r
+S3156000B5500000000000000000000000000000000085\r
+S3156000B5600000000000000000000000000000000075\r
+S3156000B5700000000000000000000000000000000065\r
+S3156000B5800000000000000000000000000000000055\r
+S3156000B5900000000000000000000000000000000045\r
+S3156000B5A00000000000000000000000000000000035\r
+S3156000B5B00000000000000000000000000000000025\r
+S3156000B5C00000000000000000000000000000000015\r
+S3156000B5D00000000000000000000000000000000005\r
+S3156000B5E000000000000000000000000000000000F5\r
+S3156000B5F000000000000000000000000000000000E5\r
+S3156000B60000000000000000000000000000000000D4\r
+S3156000B61000000000000000000000000000000000C4\r
+S3156000B62000000000000000000000000000000000B4\r
+S3156000B63000000000000000000000000000000000A4\r
+S3156000B6400000000000000000000000000000000094\r
+S3156000B6500000000000000000000000000000000084\r
+S3156000B6600000000000000000000000000000000074\r
+S3156000B6700000000000000000000000000000000064\r
+S3156000B6800000000000000000000000000000000054\r
+S3156000B6900000000000000000000000000000000044\r
+S3156000B6A00000000000000000000000000000000034\r
+S3156000B6B00000000000000000000000000000000024\r
+S3156000B6C00000000000000000000000000000000014\r
+S3156000B6D00000000000000000000000000000000004\r
+S3156000B6E000000000000000000000000000000000F4\r
+S3156000B6F000000000000000000000000000000000E4\r
+S3156000B70000000000000000000000000000000000D3\r
+S3156000B71000000000000000000000000000000000C3\r
+S3156000B72000000000000000000000000000000000B3\r
+S3156000B73000000000000000000000000000000000A3\r
+S3156000B7400000000000000000000000000000000093\r
+S3156000B7500000000000000000000000000000000083\r
+S3156000B7600000000000000000000000000000000073\r
+S3156000B7700000000000000000000000000000000063\r
+S3156000B7800000000000000000000000000000000053\r
+S3156000B7900000000000000000000000000000000043\r
+S3156000B7A00000000000000000000000000000000033\r
+S3156000B7B00000000000000000000000000000000023\r
+S3156000B7C00000000000000000000000000000000013\r
+S3156000B7D00000000000000000000000000000000003\r
+S3156000B7E000000000000000000000000000000000F3\r
+S3156000B7F000000000000000000000000000000000E3\r
+S3156000B80000000000000000000000000000000000D2\r
+S3156000B81000000000000000000000000000000000C2\r
+S3156000B82000000000000000000000000000000000B2\r
+S3156000B83000000000000000000000000000000000A2\r
+S3156000B8400000000000000000000000000000000092\r
+S3156000B8500000000000000000000000000000000082\r
+S3156000B8600000000000000000000000000000000072\r
+S3156000B8700000000000000000000000000000000062\r
+S3156000B8800000000000000000000000000000000052\r
+S3156000B8900000000000000000000000000000000042\r
+S3156000B8A00000000000000000000000000000000032\r
+S3156000B8B00000000000000000000000000000000022\r
+S3156000B8C00000000000000000000000000000000012\r
+S3156000B8D00000000000000000000000000000000002\r
+S3156000B8E000000000000000000000000000000000F2\r
+S3156000B8F000000000000000000000000000000000E2\r
+S3156000B90000000000000000000000000000000000D1\r
+S3156000B91000000000000000000000000000000000C1\r
+S3156000B92000000000000000000000000000000000B1\r
+S3156000B93000000000000000000000000000000000A1\r
+S3156000B9400000000000000000000000000000000091\r
+S3156000B9500000000000000000000000000000000081\r
+S3156000B9600000000000000000000000000000000071\r
+S3156000B9700000000000000000000000000000000061\r
+S3156000B9800000000000000000000000000000000051\r
+S3156000B9900000000000000000000000000000000041\r
+S3156000B9A00000000000000000000000000000000031\r
+S3156000B9B00000000000000000000000000000000021\r
+S3156000B9C00000000000000000000000000000000011\r
+S3156000B9D00000000000000000000000000000000001\r
+S3156000B9E000000000000000000000000000000000F1\r
+S3156000B9F000000000000000000000000000000000E1\r
+S3156000BA0000000000000000000000000000000000D0\r
+S3156000BA1000000000000000000000000000000000C0\r
+S3156000BA2000000000000000000000000000000000B0\r
+S3156000BA3000000000000000000000000000000000A0\r
+S3156000BA400000000000000000000000000000000090\r
+S3156000BA500000000000000000000000000000000080\r
+S3156000BA600000000000000000000000000000000070\r
+S3156000BA700000000000000000000000000000000060\r
+S3156000BA800000000000000000000000000000000050\r
+S3156000BA900000000000000000000000000000000040\r
+S3156000BAA00000000000000000000000000000000030\r
+S3156000BAB00000000000000000000000000000000020\r
+S3156000BAC00000000000000000000000000000000010\r
+S3156000BAD00000000000000000000000000000000000\r
+S3156000BAE000000000000000000000000000000000F0\r
+S3156000BAF000000000000000000000000000000000E0\r
+S3156000BB0000000000000000000000000000000000CF\r
+S3156000BB1000000000000000000000000000000000BF\r
+S3156000BB2000000000000000000000000000000000AF\r
+S3156000BB30000000000000000000000000000000009F\r
+S3156000BB40000000000000000000000000000000008F\r
+S3156000BB50000000000000000000000000000000007F\r
+S3156000BB60000000000000000000000000000000006F\r
+S3156000BB70000000000000000000000000000000005F\r
+S3156000BB80000000000000000000000000000000004F\r
+S3156000BB90000000000000000000000000000000003F\r
+S3156000BBA0000000000000000000000000000000002F\r
+S3156000BBB0000000000000000000000000000000001F\r
+S3156000BBC0000000000000000000000000000000000F\r
+S3156000BBD000000000000000000000000000000000FF\r
+S3156000BBE000000000000000000000000000000000EF\r
+S3156000BBF000000000000000000000000000000000DF\r
+S3156000BC0000000000000000000000000000000000CE\r
+S3156000BC1000000000000000000000000000000000BE\r
+S3156000BC2000000000000000000000000000000000AE\r
+S3156000BC30000000000000000000000000000000009E\r
+S3156000BC40000000000000000000000000000000008E\r
+S3156000BC50000000000000000000000000000000007E\r
+S3156000BC60000000000000000000000000000000006E\r
+S3156000BC70000000000000000000000000000000005E\r
+S3156000BC80000000000000000000000000000000004E\r
+S3156000BC90000000000000000000000000000000003E\r
+S3156000BCA0000000000000000000000000000000002E\r
+S3156000BCB0000000000000000000000000000000001E\r
+S3156000BCC0000000000000000000000000000000000E\r
+S3156000BCD000000000000000000000000000000000FE\r
+S3156000BCE000000000000000000000000000000000EE\r
+S3156000BCF000000000000000000000000000000000DE\r
+S3156000BD0000000000000000000000000000000000CD\r
+S3156000BD1000000000000000000000000000000000BD\r
+S3156000BD2000000000000000000000000000000000AD\r
+S3156000BD30000000000000000000000000000000009D\r
+S3156000BD40000000000000000000000000000000008D\r
+S3156000BD50000000000000000000000000000000007D\r
+S3156000BD60000000000000000000000000000000006D\r
+S3156000BD70000000000000000000000000000000005D\r
+S3156000BD80000000000000000000000000000000004D\r
+S3156000BD90000000000000000000000000000000003D\r
+S3156000BDA0000000000000000000000000000000002D\r
+S3156000BDB0000000000000000000000000000000001D\r
+S3156000BDC0000000000000000000000000000000000D\r
+S3156000BDD000000000000000000000000000000000FD\r
+S3156000BDE000000000000000000000000000000000ED\r
+S3156000BDF000000000000000000000000000000000DD\r
+S3156000BE0000000000000000000000000000000000CC\r
+S3156000BE1000000000000000000000000000000000BC\r
+S3156000BE2000000000000000000000000000000000AC\r
+S3156000BE30000000000000000000000000000000009C\r
+S3156000BE40000000000000000000000000000000008C\r
+S3156000BE50000000000000000000000000000000007C\r
+S3156000BE60000000000000000000000000000000006C\r
+S3156000BE70000000000000000000000000000000005C\r
+S3156000BE80000000000000000000000000000000004C\r
+S3156000BE90000000000000000000000000000000003C\r
+S3156000BEA0000000000000000000000000000000002C\r
+S3156000BEB0000000000000000000000000000000001C\r
+S3156000BEC0000000000000000000000000000000000C\r
+S3156000BED000000000000000000000000000000000FC\r
+S3156000BEE000000000000000000000000000000000EC\r
+S3156000BEF000000000000000000000000000000000DC\r
+S3156000BF0000000000000000000000000000000000CB\r
+S3156000BF1000000000000000000000000000000000BB\r
+S3156000BF2000000000000000000000000000000000AB\r
+S3156000BF30000000000000000000000000000000009B\r
+S3156000BF40000000000000000000000000000000008B\r
+S3156000BF50000000000000000000000000000000007B\r
+S3156000BF60000000000000000000000000000000006B\r
+S3156000BF70000000000000000000000000000000005B\r
+S3156000BF80000000000000000000000000000000004B\r
+S3156000BF90000000000000000000000000000000003B\r
+S3156000BFA0000000000000000000000000000000002B\r
+S3156000BFB0000000000000000000000000000000001B\r
+S3156000BFC0000000000000000000000000000000000B\r
+S3156000BFD000000000000000000000000000000000FB\r
+S3156000BFE000000000000000000000000000000000EB\r
+S3156000BFF000000000000000000000000000000000DB\r
+S3156000C00000000000000000000000000000000000CA\r
+S3156000C01000000000000000000000000000000000BA\r
+S3156000C02000000000000000000000000000000000AA\r
+S3156000C030000000000000000000000000000000009A\r
+S3156000C040000000000000000000000000000000008A\r
+S3156000C050000000000000000000000000000000007A\r
+S3156000C060000000000000000000000000000000006A\r
+S3156000C070000000000000000000000000000000005A\r
+S3156000C080000000000000000000000000000000004A\r
+S3156000C090000000000000000000000000000000003A\r
+S3156000C0A0000000000000000000000000000000002A\r
+S3156000C0B0000000000000000000000000000000001A\r
+S3156000C0C0000000000000000000000000000000000A\r
+S3156000C0D000000000000000000000000000000000FA\r
+S3156000C0E000000000000000000000000000000000EA\r
+S3156000C0F000000000000000000000000000000000DA\r
+S3156000C10000000000000000000000000000000000C9\r
+S3156000C11000000000000000000000000000000000B9\r
+S3156000C12000000000000000000000000000000000A9\r
+S3156000C1300000000000000000000000000000000099\r
+S3156000C1400000000000000000000000000000000089\r
+S3156000C1500000000000000000000000000000000079\r
+S3156000C1600000000000000000000000000000000069\r
+S3156000C1700000000000000000000000000000000059\r
+S3156000C1800000000000000000000000000000000049\r
+S3156000C1900000000000000000000000000000000039\r
+S3156000C1A00000000000000000000000000000000029\r
+S3156000C1B00000000000000000000000000000000019\r
+S3156000C1C00000000000000000000000000000000009\r
+S3156000C1D000000000000000000000000000000000F9\r
+S3156000C1E000000000000000000000000000000000E9\r
+S3156000C1F000000000000000000000000000000000D9\r
+S3156000C20000000000000000000000000000000000C8\r
+S3156000C21000000000000000000000000000000000B8\r
+S3156000C22000000000000000000000000000000000A8\r
+S3156000C2300000000000000000000000000000000098\r
+S3156000C2400000000000000000000000000000000088\r
+S3156000C2500000000000000000000000000000000078\r
+S3156000C2600000000000000000000000000000000068\r
+S3156000C2700000000000000000000000000000000058\r
+S3156000C2800000000000000000000000000000000048\r
+S3156000C2900000000000000000000000000000000038\r
+S3156000C2A00000000000000000000000000000000028\r
+S3156000C2B00000000000000000000000000000000018\r
+S3156000C2C00000000000000000000000000000000008\r
+S3156000C2D000000000000000000000000000000000F8\r
+S3156000C2E000000000000000000000000000000000E8\r
+S3156000C2F000000000000000000000000000000000D8\r
+S3156000C30000000000000000000000000000000000C7\r
+S3156000C31000000000000000000000000000000000B7\r
+S3156000C32000000000000000000000000000000000A7\r
+S3156000C3300000000000000000000000000000000097\r
+S3156000C3400000000000000000000000000000000087\r
+S3156000C3500000000000000000000000000000000077\r
+S3156000C3600000000000000000000000000000000067\r
+S3156000C3700000000000000000000000000000000057\r
+S3156000C3800000000000000000000000000000000047\r
+S3156000C3900000000000000000000000000000000037\r
+S3156000C3A00000000000000000000000000000000027\r
+S3156000C3B00000000000000000000000000000000017\r
+S3156000C3C00000000000000000000000000000000007\r
+S3156000C3D000000000000000000000000000000000F7\r
+S3156000C3E000000000000000000000000000000000E7\r
+S3156000C3F000000000000000000000000000000000D7\r
+S3156000C40000000000000000000000000000000000C6\r
+S3156000C41000000000000000000000000000000000B6\r
+S3156000C42000000000000000000000000000000000A6\r
+S3156000C4300000000000000000000000000000000096\r
+S3156000C4400000000000000000000000000000000086\r
+S3156000C4500000000000000000000000000000000076\r
+S3156000C4600000000000000000000000000000000066\r
+S3156000C4700000000000000000000000000000000056\r
+S3156000C4800000000000000000000000000000000046\r
+S3156000C4900000000000000000000000000000000036\r
+S3156000C4A00000000000000000000000000000000026\r
+S3156000C4B00000000000000000000000000000000016\r
+S3156000C4C00000000000000000000000000000000006\r
+S3156000C4D000000000000000000000000000000000F6\r
+S3156000C4E000000000000000000000000000000000E6\r
+S3156000C4F000000000000000000000000000000000D6\r
+S3156000C50000000000000000000000000000000000C5\r
+S3156000C51000000000000000000000000000000000B5\r
+S3156000C52000000000000000000000000000000000A5\r
+S3156000C5300000000000000000000000000000000095\r
+S3156000C5400000000000000000000000000000000085\r
+S3156000C5500000000000000000000000000000000075\r
+S3156000C5600000000000000000000000000000000065\r
+S3156000C5700000000000000000000000000000000055\r
+S3156000C5800000000000000000000000000000000045\r
+S3156000C5900000000000000000000000000000000035\r
+S3156000C5A00000000000000000000000000000000025\r
+S3156000C5B00000000000000000000000000000000015\r
+S3156000C5C00000000000000000000000000000000005\r
+S3156000C5D000000000000000000000000000000000F5\r
+S3156000C5E000000000000000000000000000000000E5\r
+S3156000C5F000000000000000000000000000000000D5\r
+S3156000C60000000000000000000000000000000000C4\r
+S3156000C61000000000000000000000000000000000B4\r
+S3156000C62000000000000000000000000000000000A4\r
+S3156000C6300000000000000000000000000000000094\r
+S3156000C6400000000000000000000000000000000084\r
+S3156000C6500000000000000000000000000000000074\r
+S3156000C6600000000000000000000000000000000064\r
+S3156000C6700000000000000000000000000000000054\r
+S3156000C6800000000000000000000000000000000044\r
+S3156000C6900000000000000000000000000000000034\r
+S3156000C6A00000000000000000000000000000000024\r
+S3156000C6B00000000000000000000000000000000014\r
+S3156000C6C00000000000000000000000000000000004\r
+S3156000C6D000000000000000000000000000000000F4\r
+S3156000C6E000000000000000000000000000000000E4\r
+S3156000C6F000000000000000000000000000000000D4\r
+S3156000C70000000000000000000000000000000000C3\r
+S3156000C71000000000000000000000000000000000B3\r
+S3156000C72000000000000000000000000000000000A3\r
+S3156000C7300000000000000000000000000000000093\r
+S3156000C7400000000000000000000000000000000083\r
+S3156000C7500000000000000000000000000000000073\r
+S3156000C7600000000000000000000000000000000063\r
+S3156000C7700000000000000000000000000000000053\r
+S3156000C7800000000000000000000000000000000043\r
+S3156000C7900000000000000000000000000000000033\r
+S3156000C7A00000000000000000000000000000000023\r
+S3156000C7B00000000000000000000000000000000013\r
+S3156000C7C00000000000000000000000000000000003\r
+S3156000C7D000000000000000000000000000000000F3\r
+S3156000C7E000000000000000000000000000000000E3\r
+S3156000C7F000000000000000000000000000000000D3\r
+S3156000C80000000000000000000000000000000000C2\r
+S3156000C81000000000000000000000000000000000B2\r
+S3156000C82000000000000000000000000000000000A2\r
+S3156000C8300000000000000000000000000000000092\r
+S3156000C8400000000000000000000000000000000082\r
+S3156000C8500000000000000000000000000000000072\r
+S3156000C8600000000000000000000000000000000062\r
+S3156000C8700000000000000000000000000000000052\r
+S3156000C8800000000000000000000000000000000042\r
+S3156000C8900000000000000000000000000000000032\r
+S3156000C8A00000000000000000000000000000000022\r
+S3156000C8B00000000000000000000000000000000012\r
+S3156000C8C00000000000000000000000000000000002\r
+S3156000C8D000000000000000000000000000000000F2\r
+S3156000C8E000000000000000000000000000000000E2\r
+S3156000C8F000000000000000000000000000000000D2\r
+S3156000C90000000000000000000000000000000000C1\r
+S3156000C91000000000000000000000000000000000B1\r
+S3156000C92000000000000000000000000000000000A1\r
+S3156000C9300000000000000000000000000000000091\r
+S3156000C9400000000000000000000000000000000081\r
+S3156000C9500000000000000000000000000000000071\r
+S3156000C9600000000000000000000000000000000061\r
+S3156000C9700000000000000000000000000000000051\r
+S3156000C9800000000000000000000000000000000041\r
+S3156000C9900000000000000000000000000000000031\r
+S3156000C9A00000000000000000000000000000000021\r
+S3156000C9B00000000000000000000000000000000011\r
+S3156000C9C00000000000000000000000000000000001\r
+S3156000C9D000000000000000000000000000000000F1\r
+S3156000C9E000000000000000000000000000000000E1\r
+S3156000C9F000000000000000000000000000000000D1\r
+S3156000CA0000000000000000000000000000000000C0\r
+S3156000CA1000000000000000000000000000000000B0\r
+S3156000CA2000000000000000000000000000000000A0\r
+S3156000CA300000000000000000000000000000000090\r
+S3156000CA400000000000000000000000000000000080\r
+S3156000CA500000000000000000000000000000000070\r
+S3156000CA600000000000000000000000000000000060\r
+S3156000CA700000000000000000000000000000000050\r
+S3156000CA800000000000000000000000000000000040\r
+S3156000CA900000000000000000000000000000000030\r
+S3156000CAA00000000000000000000000000000000020\r
+S3156000CAB00000000000000000000000000000000010\r
+S3156000CAC00000000000000000000000000000000000\r
+S3156000CAD000000000000000000000000000000000F0\r
+S3156000CAE000000000000000000000000000000000E0\r
+S3156000CAF000000000000000000000000000000000D0\r
+S3156000CB0000000000000000000000000000000000BF\r
+S3156000CB1000000000000000000000000000000000AF\r
+S3156000CB20000000000000000000000000000000009F\r
+S3156000CB30000000000000000000000000000000008F\r
+S3156000CB40000000000000000000000000000000007F\r
+S3156000CB50000000000000000000000000000000006F\r
+S3156000CB60000000000000000000000000000000005F\r
+S3156000CB70000000000000000000000000000000004F\r
+S3156000CB80000000000000000000000000000000003F\r
+S3156000CB90000000000000000000000000000000002F\r
+S3156000CBA0000000000000000000000000000000001F\r
+S3156000CBB0000000000000000000000000000000000F\r
+S3156000CBC000000000000000000000000000000000FF\r
+S3156000CBD000000000000000000000000000000000EF\r
+S3156000CBE000000000000000000000000000000000DF\r
+S3156000CBF000000000000000000000000000000000CF\r
+S3156000CC0000000000000000000000000000000000BE\r
+S3156000CC1000000000000000000000000000000000AE\r
+S3156000CC20000000000000000000000000000000009E\r
+S3156000CC30000000000000000000000000000000008E\r
+S3156000CC40000000000000000000000000000000007E\r
+S3156000CC50000000000000000000000000000000006E\r
+S3156000CC60000000000000000000000000000000005E\r
+S3156000CC70000000000000000000000000000000004E\r
+S3156000CC80000000000000000000000000000000003E\r
+S3156000CC90000000000000000000000000000000002E\r
+S3156000CCA0000000000000000000000000000000001E\r
+S3156000CCB0000000000000000000000000000000000E\r
+S3156000CCC000000000000000000000000000000000FE\r
+S3156000CCD000000000000000000000000000000000EE\r
+S3156000CCE000000000000000000000000000000000DE\r
+S3156000CCF000000000000000000000000000000000CE\r
+S3156000CD0000000000000000000000000000000000BD\r
+S3156000CD1000000000000000000000000000000000AD\r
+S3156000CD20000000000000000000000000000000009D\r
+S3156000CD30000000000000000000000000000000008D\r
+S3156000CD40000000000000000000000000000000007D\r
+S3156000CD50000000000000000000000000000000006D\r
+S3156000CD60000000000000000000000000000000005D\r
+S3156000CD70000000000000000000000000000000004D\r
+S3156000CD80000000000000000000000000000000003D\r
+S3156000CD90000000000000000000000000000000002D\r
+S3156000CDA0000000000000000000000000000000001D\r
+S3156000CDB0000000000000000000000000000000000D\r
+S3156000CDC000000000000000000000000000000000FD\r
+S3156000CDD000000000000000000000000000000000ED\r
+S3156000CDE000000000000000000000000000000000DD\r
+S3156000CDF000000000000000000000000000000000CD\r
+S3156000CE0000000000000000000000000000000000BC\r
+S3156000CE1000000000000000000000000000000000AC\r
+S3156000CE20000000000000000000000000000000009C\r
+S3156000CE30000000000000000000000000000000008C\r
+S3156000CE40000000000000000000000000000000007C\r
+S3156000CE50000000000000000000000000000000006C\r
+S3156000CE60000000000000000000000000000000005C\r
+S3156000CE70000000000000000000000000000000004C\r
+S3156000CE80000000000000000000000000000000003C\r
+S3156000CE90000000000000000000000000000000002C\r
+S3156000CEA0000000000000000000000000000000001C\r
+S3156000CEB0000000000000000000000000000000000C\r
+S3156000CEC000000000000000000000000000000000FC\r
+S3156000CED000000000000000000000000000000000EC\r
+S3156000CEE000000000000000000000000000000000DC\r
+S3156000CEF000000000000000000000000000000000CC\r
+S3156000CF0000000000000000000000000000000000BB\r
+S3156000CF1000000000000000000000000000000000AB\r
+S3156000CF20000000000000000000000000000000009B\r
+S3156000CF30000000000000000000000000000000008B\r
+S3156000CF40000000000000000000000000000000007B\r
+S3156000CF50000000000000000000000000000000006B\r
+S3156000CF60000000000000000000000000000000005B\r
+S3156000CF70000000000000000000000000000000004B\r
+S3156000CF80000000000000000000000000000000003B\r
+S3156000CF90000000000000000000000000000000002B\r
+S3156000CFA0000000000000000000000000000000001B\r
+S3156000CFB0000000000000000000000000000000000B\r
+S3156000CFC000000000000000000000000000000000FB\r
+S3156000CFD000000000000000000000000000000000EB\r
+S3156000CFE000000000000000000000000000000000DB\r
+S3156000CFF000000000000000000000000000000000CB\r
+S3156000D00000000000000000000000000000000000BA\r
+S3156000D01000000000000000000000000000000000AA\r
+S3156000D020000000000000000000000000000000009A\r
+S3156000D030000000000000000000000000000000008A\r
+S3156000D040000000000000000000000000000000007A\r
+S3156000D050000000000000000000000000000000006A\r
+S3156000D060000000000000000000000000000000005A\r
+S3156000D070000000000000000000000000000000004A\r
+S3156000D080000000000000000000000000000000003A\r
+S3156000D090000000000000000000000000000000002A\r
+S3156000D0A0000000000000000000000000000000001A\r
+S3156000D0B0000000000000000000000000000000000A\r
+S3156000D0C000000000000000000000000000000000FA\r
+S3156000D0D000000000000000000000000000000000EA\r
+S3156000D0E000000000000000000000000000000000DA\r
+S3156000D0F000000000000000000000000000000000CA\r
+S3156000D10000000000000000000000000000000000B9\r
+S3156000D11000000000000000000000000000000000A9\r
+S3156000D1200000000000000000000000000000000099\r
+S3156000D1300000000000000000000000000000000089\r
+S3156000D1400000000000000000000000000000000079\r
+S3156000D1500000000000000000000000000000000069\r
+S3156000D1600000000000000000000000000000000059\r
+S3156000D1700000000000000000000000000000000049\r
+S3156000D1800000000000000000000000000000000039\r
+S3156000D1900000000000000000000000000000000029\r
+S3156000D1A00000000000000000000000000000000019\r
+S3156000D1B00000000000000000000000000000000009\r
+S3156000D1C000000000000000000000000000000000F9\r
+S3156000D1D000000000000000000000000000000000E9\r
+S3156000D1E000000000000000000000000000000000D9\r
+S3156000D1F000000000000000000000000000000000C9\r
+S3156000D20000000000000000000000000000000000B8\r
+S3156000D21000000000000000000000000000000000A8\r
+S3156000D2200000000000000000000000000000000098\r
+S3156000D2300000000000000000000000000000000088\r
+S3156000D2400000000000000000000000000000000078\r
+S3156000D2500000000000000000000000000000000068\r
+S3156000D2600000000000000000000000000000000058\r
+S3156000D2700000000000000000000000000000000048\r
+S3156000D2800000000000000000000000000000000038\r
+S3156000D2900000000000000000000000000000000028\r
+S3156000D2A00000000000000000000000000000000018\r
+S3156000D2B00000000000000000000000000000000008\r
+S3156000D2C000000000000000000000000000000000F8\r
+S3156000D2D000000000000000000000000000000000E8\r
+S3156000D2E000000000000000000000000000000000D8\r
+S3156000D2F000000000000000000000000000000000C8\r
+S3156000D30000000000000000000000000000000000B7\r
+S3156000D31000000000000000000000000000000000A7\r
+S3156000D3200000000000000000000000000000000097\r
+S3156000D3300000000000000000000000000000000087\r
+S3156000D3400000000000000000000000000000000077\r
+S3156000D3500000000000000000000000000000000067\r
+S3156000D3600000000000000000000000000000000057\r
+S3156000D3700000000000000000000000000000000047\r
+S3156000D3800000000000000000000000000000000037\r
+S3156000D3900000000000000000000000000000000027\r
+S3156000D3A00000000000000000000000000000000017\r
+S3156000D3B00000000000000000000000000000000007\r
+S3156000D3C000000000000000000000000000000000F7\r
+S3156000D3D000000000000000000000000000000000E7\r
+S3156000D3E000000000000000000000000000000000D7\r
+S3156000D3F000000000000000000000000000000000C7\r
+S3156000D40000000000000000000000000000000000B6\r
+S3156000D41000000000000000000000000000000000A6\r
+S3156000D4200000000000000000000000000000000096\r
+S3156000D4300000000000000000000000000000000086\r
+S3156000D4400000000000000000000000000000000076\r
+S3156000D4500000000000000000000000000000000066\r
+S3156000D4600000000000000000000000000000000056\r
+S3156000D4700000000000000000000000000000000046\r
+S3156000D4800000000000000000000000000000000036\r
+S3156000D4900000000000000000000000000000000026\r
+S3156000D4A00000000000000000000000000000000016\r
+S3156000D4B00000000000000000000000000000000006\r
+S3156000D4C000000000000000000000000000000000F6\r
+S3156000D4D000000000000000000000000000000000E6\r
+S3156000D4E000000000000000000000000000000000D6\r
+S3156000D4F000000000000000000000000000000000C6\r
+S3156000D50000000000000000000000000000000000B5\r
+S3156000D51000000000000000000000000000000000A5\r
+S3156000D5200000000000000000000000000000000095\r
+S3156000D5300000000000000000000000000000000085\r
+S3156000D5400000000000000000000000000000000075\r
+S3156000D5500000000000000000000000000000000065\r
+S3156000D5600000000000000000000000000000000055\r
+S3156000D5700000000000000000000000000000000045\r
+S3156000D5800000000000000000000000000000000035\r
+S3156000D5900000000000000000000000000000000025\r
+S3156000D5A00000000000000000000000000000000015\r
+S3156000D5B00000000000000000000000000000000005\r
+S3156000D5C000000000000000000000000000000000F5\r
+S3156000D5D000000000000000000000000000000000E5\r
+S3156000D5E000000000000000000000000000000000D5\r
+S3156000D5F000000000000000000000000000000000C5\r
+S3156000D60000000000000000000000000000000000B4\r
+S3156000D61000000000000000000000000000000000A4\r
+S3156000D6200000000000000000000000000000000094\r
+S3156000D6300000000000000000000000000000000084\r
+S3156000D6400000000000000000000000000000000074\r
+S3156000D6500000000000000000000000000000000064\r
+S3156000D6600000000000000000000000000000000054\r
+S3156000D6700000000000000000000000000000000044\r
+S3156000D6800000000000000000000000000000000034\r
+S3156000D6900000000000000000000000000000000024\r
+S3156000D6A00000000000000000000000000000000014\r
+S3156000D6B00000000000000000000000000000000004\r
+S3156000D6C000000000000000000000000000000000F4\r
+S3156000D6D000000000000000000000000000000000E4\r
+S3156000D6E000000000000000000000000000000000D4\r
+S3156000D6F000000000000000000000000000000000C4\r
+S3156000D70000000000000000000000000000000000B3\r
+S3156000D71000000000000000000000000000000000A3\r
+S3156000D7200000000000000000000000000000000093\r
+S3156000D7300000000000000000000000000000000083\r
+S3156000D7400000000000000000000000000000000073\r
+S3156000D7500000000000000000000000000000000063\r
+S3156000D7600000000000000000000000000000000053\r
+S3156000D7700000000000000000000000000000000043\r
+S3156000D7800000000000000000000000000000000033\r
+S3156000D7900000000000000000000000000000000023\r
+S3156000D7A00000000000000000000000000000000013\r
+S3156000D7B00000000000000000000000000000000003\r
+S3156000D7C000000000000000000000000000000000F3\r
+S3156000D7D000000000000000000000000000000000E3\r
+S3156000D7E000000000000000000000000000000000D3\r
+S3156000D7F000000000000000000000000000000000C3\r
+S3156000D80000000000000000000000000000000000B2\r
+S3156000D81000000000000000000000000000000000A2\r
+S3156000D8200000000000000000000000000000000092\r
+S3156000D8300000000000000000000000000000000082\r
+S3156000D8400000000000000000000000000000000072\r
+S3156000D8500000000000000000000000000000000062\r
+S3156000D8600000000000000000000000000000000052\r
+S3156000D8700000000000000000000000000000000042\r
+S3156000D8800000000000000000000000000000000032\r
+S3156000D8900000000000000000000000000000000022\r
+S3156000D8A00000000000000000000000000000000012\r
+S3156000D8B00000000000000000000000000000000002\r
+S3156000D8C000000000000000000000000000000000F2\r
+S3156000D8D000000000000000000000000000000000E2\r
+S3156000D8E000000000000000000000000000000000D2\r
+S3156000D8F000000000000000000000000000000000C2\r
+S3156000D90000000000000000000000000000000000B1\r
+S3156000D91000000000000000000000000000000000A1\r
+S3156000D9200000000000000000000000000000000091\r
+S3156000D9300000000000000000000000000000000081\r
+S3156000D9400000000000000000000000000000000071\r
+S3156000D9500000000000000000000000000000000061\r
+S3156000D9600000000000000000000000000000000051\r
+S3156000D9700000000000000000000000000000000041\r
+S3156000D9800000000000000000000000000000000031\r
+S3156000D9900000000000000000000000000000000021\r
+S3156000D9A00000000000000000000000000000000011\r
+S3156000D9B00000000000000000000000000000000001\r
+S3156000D9C000000000000000000000000000000000F1\r
+S3156000D9D000000000000000000000000000000000E1\r
+S3156000D9E000000000000000000000000000000000D1\r
+S3156000D9F000000000000000000000000000000000C1\r
+S3156000DA0000000000000000000000000000000000B0\r
+S3156000DA1000000000000000000000000000000000A0\r
+S3156000DA200000000000000000000000000000000090\r
+S3156000DA300000000000000000000000000000000080\r
+S3156000DA400000000000000000000000000000000070\r
+S3156000DA500000000000000000000000000000000060\r
+S3156000DA600000000000000000000000000000000050\r
+S3156000DA700000000000000000000000000000000040\r
+S3156000DA800000000000000000000000000000000030\r
+S3156000DA900000000000000000000000000000000020\r
+S3156000DAA00000000000000000000000000000000010\r
+S3156000DAB00000000000000000000000000000000000\r
+S3156000DAC000000000000000000000000000000000F0\r
+S3156000DAD000000000000000000000000000000000E0\r
+S3156000DAE000000000000000000000000000000000D0\r
+S3156000DAF000000000000000000000000000000000C0\r
+S3156000DB0000000000000000000000000000000000AF\r
+S3156000DB10000000000000000000000000000000009F\r
+S3156000DB20000000000000000000000000000000008F\r
+S3156000DB30000000000000000000000000000000007F\r
+S3156000DB40000000000000000000000000000000006F\r
+S3156000DB50000000000000000000000000000000005F\r
+S3156000DB60000000000000000000000000000000004F\r
+S3156000DB70000000000000000000000000000000003F\r
+S3156000DB80000000000000000000000000000000002F\r
+S3156000DB90000000000000000000000000000000001F\r
+S3156000DBA0000000000000000000000000000000000F\r
+S3156000DBB000000000000000000000000000000000FF\r
+S3156000DBC000000000000000000000000000000000EF\r
+S3156000DBD000000000000000000000000000000000DF\r
+S3156000DBE000000000000000000000000000000000CF\r
+S3156000DBF000000000000000000000000000000000BF\r
+S3156000DC0000000000000000000000000000000000AE\r
+S3156000DC10000000000000000000000000000000009E\r
+S3156000DC20000000000000000000000000000000008E\r
+S3156000DC30000000000000000000000000000000007E\r
+S3156000DC40000000000000000000000000000000006E\r
+S3156000DC50000000000000000000000000000000005E\r
+S3156000DC60000000000000000000000000000000004E\r
+S3156000DC70000000000000000000000000000000003E\r
+S3156000DC80000000000000000000000000000000002E\r
+S3156000DC90000000000000000000000000000000001E\r
+S3156000DCA0000000000000000000000000000000000E\r
+S3156000DCB000000000000000000000000000000000FE\r
+S3156000DCC000000000000000000000000000000000EE\r
+S3156000DCD000000000000000000000000000000000DE\r
+S3156000DCE000000000000000000000000000000000CE\r
+S3156000DCF000000000000000000000000000000000BE\r
+S3156000DD0000000000000000000000000000000000AD\r
+S3156000DD10000000000000000000000000000000009D\r
+S3156000DD20000000000000000000000000000000008D\r
+S3156000DD30000000000000000000000000000000007D\r
+S3156000DD40000000000000000000000000000000006D\r
+S3156000DD50000000000000000000000000000000005D\r
+S3156000DD60000000000000000000000000000000004D\r
+S3156000DD70000000000000000000000000000000003D\r
+S3156000DD80000000000000000000000000000000002D\r
+S3156000DD90000000000000000000000000000000001D\r
+S3156000DDA0000000000000000000000000000000000D\r
+S3156000DDB000000000000000000000000000000000FD\r
+S3156000DDC000000000000000000000000000000000ED\r
+S3156000DDD000000000000000000000000000000000DD\r
+S3156000DDE000000000000000000000000000000000CD\r
+S3156000DDF000000000000000000000000000000000BD\r
+S3156000DE0000000000000000000000000000000000AC\r
+S3156000DE10000000000000000000000000000000009C\r
+S3156000DE20000000000000000000000000000000008C\r
+S3156000DE30000000000000000000000000000000007C\r
+S3156000DE40000000000000000000000000000000006C\r
+S3156000DE50000000000000000000000000000000005C\r
+S3156000DE60000000000000000000000000000000004C\r
+S3156000DE70000000000000000000000000000000003C\r
+S3156000DE80000000000000000000000000000000002C\r
+S3156000DE90000000000000000000000000000000001C\r
+S3156000DEA0000000000000000000000000000000000C\r
+S3156000DEB000000000000000000000000000000000FC\r
+S3156000DEC000000000000000000000000000000000EC\r
+S3156000DED000000000000000000000000000000000DC\r
+S3156000DEE000000000000000000000000000000000CC\r
+S3156000DEF000000000000000000000000000000000BC\r
+S3156000DF0000000000000000000000000000000000AB\r
+S3156000DF10000000000000000000000000000000009B\r
+S3156000DF20000000000000000000000000000000008B\r
+S3156000DF30000000000000000000000000000000007B\r
+S3156000DF40000000000000000000000000000000006B\r
+S3156000DF50000000000000000000000000000000005B\r
+S3156000DF60000000000000000000000000000000004B\r
+S3156000DF70000000000000000000000000000000003B\r
+S3156000DF80000000000000000000000000000000002B\r
+S3156000DF90000000000000000000000000000000001B\r
+S3156000DFA0000000000000000000000000000000000B\r
+S3156000DFB000000000000000000000000000000000FB\r
+S3156000DFC000000000000000000000000000000000EB\r
+S3156000DFD000000000000000000000000000000000DB\r
+S3156000DFE000000000000000000000000000000000CB\r
+S3156000DFF000000000000000000000000000000000BB\r
+S3156000E00000000000000000000000000000000000AA\r
+S3156000E010000000000000000000000000000000009A\r
+S3156000E020000000000000000000000000000000008A\r
+S3156000E030000000000000000000000000000000007A\r
+S3156000E040000000000000000000000000000000006A\r
+S3156000E050000000000000000000000000000000005A\r
+S3156000E060000000000000000000000000000000004A\r
+S3156000E070000000000000000000000000000000003A\r
+S3156000E080000000000000000000000000000000002A\r
+S3156000E090000000000000000000000000000000001A\r
+S3156000E0A0000000000000000000000000000000000A\r
+S3156000E0B000000000000000000000000000000000FA\r
+S3156000E0C000000000000000000000000000000000EA\r
+S3156000E0D000000000000000000000000000000000DA\r
+S3156000E0E000000000000000000000000000000000CA\r
+S3156000E0F000000000000000000000000000000000BA\r
+S3156000E10000000000000000000000000000000000A9\r
+S3156000E1100000000000000000000000000000000099\r
+S3156000E1200000000000000000000000000000000089\r
+S3156000E1300000000000000000000000000000000079\r
+S3156000E1400000000000000000000000000000000069\r
+S3156000E1500000000000000000000000000000000059\r
+S3156000E1600000000000000000000000000000000049\r
+S3156000E1700000000000000000000000000000000039\r
+S3156000E1800000000000000000000000000000000029\r
+S3156000E1900000000000000000000000000000000019\r
+S3156000E1A00000000000000000000000000000000009\r
+S3156000E1B000000000000000000000000000000000F9\r
+S3156000E1C000000000000000000000000000000000E9\r
+S3156000E1D000000000000000000000000000000000D9\r
+S3156000E1E000000000000000000000000000000000C9\r
+S3156000E1F000000000000000000000000000000000B9\r
+S3156000E20000000000000000000000000000000000A8\r
+S3156000E2100000000000000000000000000000000098\r
+S3156000E2200000000000000000000000000000000088\r
+S3156000E2300000000000000000000000000000000078\r
+S3156000E2400000000000000000000000000000000068\r
+S3156000E2500000000000000000000000000000000058\r
+S3156000E2600000000000000000000000000000000048\r
+S3156000E2700000000000000000000000000000000038\r
+S3156000E2800000000000000000000000000000000028\r
+S3156000E2900000000000000000000000000000000018\r
+S3156000E2A00000000000000000000000000000000008\r
+S3156000E2B000000000000000000000000000000000F8\r
+S3156000E2C000000000000000000000000000000000E8\r
+S3156000E2D000000000000000000000000000000000D8\r
+S3156000E2E000000000000000000000000000000000C8\r
+S3156000E2F000000000000000000000000000000000B8\r
+S3156000E30000000000000000000000000000000000A7\r
+S3156000E3100000000000000000000000000000000097\r
+S3156000E3200000000000000000000000000000000087\r
+S3156000E3300000000000000000000000000000000077\r
+S3156000E3400000000000000000000000000000000067\r
+S3156000E3500000000000000000000000000000000057\r
+S3156000E3600000000000000000000000000000000047\r
+S3156000E3700000000000000000000000000000000037\r
+S3156000E3800000000000000000000000000000000027\r
+S3156000E3900000000000000000000000000000000017\r
+S3156000E3A00000000000000000000000000000000007\r
+S3156000E3B000000000000000000000000000000000F7\r
+S3156000E3C000000000000000000000000000000000E7\r
+S3156000E3D000000000000000000000000000000000D7\r
+S3156000E3E000000000000000000000000000000000C7\r
+S3156000E3F000000000000000000000000000000000B7\r
+S3156000E40000000000000000000000000000000000A6\r
+S3156000E4100000000000000000000000000000000096\r
+S3156000E4200000000000000000000000000000000086\r
+S3156000E4300000000000000000000000000000000076\r
+S3156000E4400000000000000000000000000000000066\r
+S3156000E4500000000000000000000000000000000056\r
+S3156000E4600000000000000000000000000000000046\r
+S3156000E4700000000000000000000000000000000036\r
+S3156000E4800000000000000000000000000000000026\r
+S3156000E4900000000000000000000000000000000016\r
+S3156000E4A00000000000000000000000000000000006\r
+S3156000E4B000000000000000000000000000000000F6\r
+S3156000E4C000000000000000000000000000000000E6\r
+S3156000E4D000000000000000000000000000000000D6\r
+S3156000E4E000000000000000000000000000000000C6\r
+S3156000E4F000000000000000000000000000000000B6\r
+S3156000E50000000000000000000000000000000000A5\r
+S3156000E5100000000000000000000000000000000095\r
+S3156000E5200000000000000000000000000000000085\r
+S3156000E5300000000000000000000000000000000075\r
+S3156000E5400000000000000000000000000000000065\r
+S3156000E5500000000000000000000000000000000055\r
+S3156000E5600000000000000000000000000000000045\r
+S3156000E5700000000000000000000000000000000035\r
+S3156000E5800000000000000000000000000000000025\r
+S3156000E5900000000000000000000000000000000015\r
+S3156000E5A00000000000000000000000000000000005\r
+S3156000E5B000000000000000000000000000000000F5\r
+S3156000E5C000000000000000000000000000000000E5\r
+S3156000E5D000000000000000000000000000000000D5\r
+S3156000E5E000000000000000000000000000000000C5\r
+S3156000E5F000000000000000000000000000000000B5\r
+S3156000E60000000000000000000000000000000000A4\r
+S3156000E6100000000000000000000000000000000094\r
+S3156000E6200000000000000000000000000000000084\r
+S3156000E6300000000000000000000000000000000074\r
+S3156000E6400000000000000000000000000000000064\r
+S3156000E6500000000000000000000000000000000054\r
+S3156000E6600000000000000000000000000000000044\r
+S3156000E6700000000000000000000000000000000034\r
+S3156000E6800000000000000000000000000000000024\r
+S3156000E6900000000000000000000000000000000014\r
+S3156000E6A00000000000000000000000000000000004\r
+S3156000E6B000000000000000000000000000000000F4\r
+S3156000E6C000000000000000000000000000000000E4\r
+S3156000E6D000000000000000000000000000000000D4\r
+S3156000E6E000000000000000000000000000000000C4\r
+S3156000E6F000000000000000000000000000000000B4\r
+S3156000E70000000000000000000000000000000000A3\r
+S3156000E7100000000000000000000000000000000093\r
+S3156000E7200000000000000000000000000000000083\r
+S3156000E7300000000000000000000000000000000073\r
+S3156000E7400000000000000000000000000000000063\r
+S3156000E7500000000000000000000000000000000053\r
+S3156000E7600000000000000000000000000000000043\r
+S3156000E7700000000000000000000000000000000033\r
+S3156000E7800000000000000000000000000000000023\r
+S3156000E7900000000000000000000000000000000013\r
+S3156000E7A00000000000000000000000000000000003\r
+S3156000E7B000000000000000000000000000000000F3\r
+S3156000E7C000000000000000000000000000000000E3\r
+S3156000E7D000000000000000000000000000000000D3\r
+S3156000E7E000000000000000000000000000000000C3\r
+S3156000E7F000000000000000000000000000000000B3\r
+S3156000E80000000000000000000000000000000000A2\r
+S3156000E8100000000000000000000000000000000092\r
+S3156000E8200000000000000000000000000000000082\r
+S3156000E8300000000000000000000000000000000072\r
+S3156000E8400000000000000000000000000000000062\r
+S3156000E8500000000000000000000000000000000052\r
+S3156000E8600000000000000000000000000000000042\r
+S3156000E8700000000000000000000000000000000032\r
+S3156000E8800000000000000000000000000000000022\r
+S3156000E8900000000000000000000000000000000012\r
+S3156000E8A00000000000000000000000000000000002\r
+S3156000E8B000000000000000000000000000000000F2\r
+S3156000E8C000000000000000000000000000000000E2\r
+S3156000E8D000000000000000000000000000000000D2\r
+S3156000E8E000000000000000000000000000000000C2\r
+S3156000E8F000000000000000000000000000000000B2\r
+S3156000E90000000000000000000000000000000000A1\r
+S3156000E9100000000000000000000000000000000091\r
+S3156000E9200000000000000000000000000000000081\r
+S3156000E9300000000000000000000000000000000071\r
+S3156000E9400000000000000000000000000000000061\r
+S3156000E9500000000000000000000000000000000051\r
+S3156000E9600000000000000000000000000000000041\r
+S3156000E9700000000000000000000000000000000031\r
+S3156000E9800000000000000000000000000000000021\r
+S3156000E9900000000000000000000000000000000011\r
+S3156000E9A00000000000000000000000000000000001\r
+S3156000E9B000000000000000000000000000000000F1\r
+S3156000E9C000000000000000000000000000000000E1\r
+S3156000E9D000000000000000000000000000000000D1\r
+S3156000E9E000000000000000000000000000000000C1\r
+S3156000E9F000000000000000000000000000000000B1\r
+S3156000EA0000000000000000000000000000000000A0\r
+S3156000EA100000000000000000000000000000000090\r
+S3156000EA200000000000000000000000000000000080\r
+S3156000EA300000000000000000000000000000000070\r
+S3156000EA400000000000000000000000000000000060\r
+S3156000EA500000000000000000000000000000000050\r
+S3156000EA600000000000000000000000000000000040\r
+S3156000EA700000000000000000000000000000000030\r
+S3156000EA800000000000000000000000000000000020\r
+S3156000EA900000000000000000000000000000000010\r
+S3156000EAA00000000000000000000000000000000000\r
+S3156000EAB000000000000000000000000000000000F0\r
+S3156000EAC000000000000000000000000000000000E0\r
+S3156000EAD000000000000000000000000000000000D0\r
+S3156000EAE000000000000000000000000000000000C0\r
+S3156000EAF000000000000000000000000000000000B0\r
+S3156000EB00000000000000000000000000000000009F\r
+S3156000EB10000000000000000000000000000000008F\r
+S3156000EB20000000000000000000000000000000007F\r
+S3156000EB30000000000000000000000000000000006F\r
+S3156000EB40000000000000000000000000000000005F\r
+S3156000EB50000000000000000000000000000000004F\r
+S3156000EB60000000000000000000000000000000003F\r
+S3156000EB70000000000000000000000000000000002F\r
+S3156000EB80000000000000000000000000000000001F\r
+S3156000EB90000000000000000000000000000000000F\r
+S3156000EBA000000000000000000000000000000000FF\r
+S3156000EBB000000000000000000000000000000000EF\r
+S3156000EBC000000000000000000000000000000000DF\r
+S3156000EBD000000000000000000000000000000000CF\r
+S3156000EBE000000000000000000000000000000000BF\r
+S3156000EBF000000000000000000000000000000000AF\r
+S3156000EC00000000000000000000000000000000009E\r
+S3156000EC10000000000000000000000000000000008E\r
+S3156000EC20000000000000000000000000000000007E\r
+S3156000EC30000000000000000000000000000000006E\r
+S3156000EC40000000000000000000000000000000005E\r
+S3156000EC50000000000000000000000000000000004E\r
+S3156000EC60000000000000000000000000000000003E\r
+S3156000EC70000000000000000000000000000000002E\r
+S3156000EC80000000000000000000000000000000001E\r
+S3156000EC90000000000000000000000000000000000E\r
+S3156000ECA000000000000000000000000000000000FE\r
+S3156000ECB000000000000000000000000000000000EE\r
+S3156000ECC000000000000000000000000000000000DE\r
+S3156000ECD000000000000000000000000000000000CE\r
+S3156000ECE000000000000000000000000000000000BE\r
+S3156000ECF000000000000000000000000000000000AE\r
+S3156000ED00000000000000000000000000000000009D\r
+S3156000ED10000000000000000000000000000000008D\r
+S3156000ED20000000000000000000000000000000007D\r
+S3156000ED30000000000000000000000000000000006D\r
+S3156000ED40000000000000000000000000000000005D\r
+S3156000ED50000000000000000000000000000000004D\r
+S3156000ED60000000000000000000000000000000003D\r
+S3156000ED70000000000000000000000000000000002D\r
+S3156000ED80000000000000000000000000000000001D\r
+S3156000ED90000000000000000000000000000000000D\r
+S3156000EDA000000000000000000000000000000000FD\r
+S3156000EDB000000000000000000000000000000000ED\r
+S3156000EDC000000000000000000000000000000000DD\r
+S3156000EDD000000000000000000000000000000000CD\r
+S3156000EDE000000000000000000000000000000000BD\r
+S3156000EDF000000000000000000000000000000000AD\r
+S3156000EE00000000000000000000000000000000009C\r
+S3156000EE10000000000000000000000000000000008C\r
+S3156000EE20000000000000000000000000000000007C\r
+S3156000EE30000000000000000000000000000000006C\r
+S3156000EE40000000000000000000000000000000005C\r
+S3156000EE50000000000000000000000000000000004C\r
+S3156000EE60000000000000000000000000000000003C\r
+S3156000EE70000000000000000000000000000000002C\r
+S3156000EE80000000000000000000000000000000001C\r
+S3156000EE90000000000000000000000000000000000C\r
+S3156000EEA000000000000000000000000000000000FC\r
+S3156000EEB000000000000000000000000000000000EC\r
+S3156000EEC000000000000000000000000000000000DC\r
+S3156000EED000000000000000000000000000000000CC\r
+S3156000EEE000000000000000000000000000000000BC\r
+S3156000EEF000000000000000000000000000000000AC\r
+S3156000EF00000000000000000000000000000000009B\r
+S3156000EF10000000000000000000000000000000008B\r
+S3156000EF20000000000000000000000000000000007B\r
+S3156000EF30000000000000000000000000000000006B\r
+S3156000EF40000000000000000000000000000000005B\r
+S3156000EF50000000000000000000000000000000004B\r
+S3156000EF60000000000000000000000000000000003B\r
+S3156000EF70000000000000000000000000000000002B\r
+S3156000EF80000000000000000000000000000000001B\r
+S3156000EF90000000000000000000000000000000000B\r
+S3156000EFA000000000000000000000000000000000FB\r
+S3156000EFB000000000000000000000000000000000EB\r
+S3156000EFC000000000000000000000000000000000DB\r
+S3156000EFD000000000000000000000000000000000CB\r
+S3156000EFE000000000000000000000000000000000BB\r
+S3156000EFF000000000000000000000000000000000AB\r
+S3156000F000000000000000000000000000000000009A\r
+S3156000F010000000000000000000000000000000008A\r
+S3156000F020000000000000000000000000000000007A\r
+S3156000F030000000000000000000000000000000006A\r
+S3156000F040000000000000000000000000000000005A\r
+S3156000F050000000000000000000000000000000004A\r
+S3156000F060000000000000000000000000000000003A\r
+S3156000F070000000000000000000000000000000002A\r
+S3156000F080000000000000000000000000000000001A\r
+S3156000F090000000000000000000000000000000000A\r
+S3156000F0A000000000000000000000000000000000FA\r
+S3156000F0B000000000000000000000000000000000EA\r
+S3156000F0C000000000000000000000000000000000DA\r
+S3156000F0D000000000000000000000000000000000CA\r
+S3156000F0E000000000000000000000000000000000BA\r
+S3156000F0F000000000000000000000000000000000AA\r
+S3156000F1000000000000000000000000000000000099\r
+S3156000F1100000000000000000000000000000000089\r
+S3156000F1200000000000000000000000000000000079\r
+S3156000F1300000000000000000000000000000000069\r
+S3156000F1400000000000000000000000000000000059\r
+S3156000F1500000000000000000000000000000000049\r
+S3156000F1600000000000000000000000000000000039\r
+S3156000F1700000000000000000000000000000000029\r
+S3156000F1800000000000000000000000000000000019\r
+S3156000F1900000000000000000000000000000000009\r
+S3156000F1A000000000000000000000000000000000F9\r
+S3156000F1B000000000000000000000000000000000E9\r
+S3156000F1C000000000000000000000000000000000D9\r
+S3156000F1D000000000000000000000000000000000C9\r
+S3156000F1E000000000000000000000000000000000B9\r
+S3156000F1F000000000000000000000000000000000A9\r
+S3156000F2000000000000000000000000000000000098\r
+S3156000F2100000000000000000000000000000000088\r
+S3156000F2200000000000000000000000000000000078\r
+S3156000F2300000000000000000000000000000000068\r
+S3156000F2400000000000000000000000000000000058\r
+S3156000F2500000000000000000000000000000000048\r
+S3156000F2600000000000000000000000000000000038\r
+S3156000F2700000000000000000000000000000000028\r
+S3156000F2800000000000000000000000000000000018\r
+S3156000F2900000000000000000000000000000000008\r
+S3156000F2A000000000000000000000000000000000F8\r
+S3156000F2B000000000000000000000000000000000E8\r
+S3156000F2C000000000000000000000000000000000D8\r
+S3156000F2D000000000000000000000000000000000C8\r
+S3156000F2E000000000000000000000000000000000B8\r
+S3156000F2F000000000000000000000000000000000A8\r
+S3156000F3000000000000000000000000000000000097\r
+S3156000F3100000000000000000000000000000000087\r
+S3156000F3200000000000000000000000000000000077\r
+S3156000F3300000000000000000000000000000000067\r
+S3156000F3400000000000000000000000000000000057\r
+S3156000F3500000000000000000000000000000000047\r
+S3156000F3600000000000000000000000000000000037\r
+S3156000F3700000000000000000000000000000000027\r
+S3156000F3800000000000000000000000000000000017\r
+S3156000F3900000000000000000000000000000000007\r
+S3156000F3A000000000000000000000000000000000F7\r
+S3156000F3B000000000000000000000000000000000E7\r
+S3156000F3C000000000000000000000000000000000D7\r
+S3156000F3D000000000000000000000000000000000C7\r
+S3156000F3E000000000000000000000000000000000B7\r
+S3156000F3F000000000000000000000000000000000A7\r
+S3156000F4000000000000000000000000000000000096\r
+S3156000F4100000000000000000000000000000000086\r
+S3156000F4200000000000000000000000000000000076\r
+S3156000F4300000000000000000000000000000000066\r
+S3156000F4400000000000000000000000000000000056\r
+S3156000F4500000000000000000000000000000000046\r
+S3156000F4600000000000000000000000000000000036\r
+S3156000F4700000000000000000000000000000000026\r
+S3156000F4800000000000000000000000000000000016\r
+S3156000F4900000000000000000000000000000000006\r
+S3156000F4A000000000000000000000000000000000F6\r
+S3156000F4B000000000000000000000000000000000E6\r
+S3156000F4C000000000000000000000000000000000D6\r
+S3156000F4D000000000000000000000000000000000C6\r
+S3156000F4E000000000000000000000000000000000B6\r
+S3156000F4F000000000000000000000000000000000A6\r
+S3156000F5000000000000000000000000000000000095\r
+S3156000F5100000000000000000000000000000000085\r
+S3156000F5200000000000000000000000000000000075\r
+S3156000F5300000000000000000000000000000000065\r
+S3156000F5400000000000000000000000000000000055\r
+S3156000F5500000000000000000000000000000000045\r
+S3156000F5600000000000000000000000000000000035\r
+S3156000F5700000000000000000000000000000000025\r
+S3156000F5800000000000000000000000000000000015\r
+S3156000F5900000000000000000000000000000000005\r
+S3156000F5A000000000000000000000000000000000F5\r
+S3156000F5B000000000000000000000000000000000E5\r
+S3156000F5C000000000000000000000000000000000D5\r
+S3156000F5D000000000000000000000000000000000C5\r
+S3156000F5E000000000000000000000000000000000B5\r
+S3156000F5F000000000000000000000000000000000A5\r
+S3156000F6000000000000000000000000000000000094\r
+S3156000F6100000000000000000000000000000000084\r
+S3156000F6200000000000000000000000000000000074\r
+S3156000F6300000000000000000000000000000000064\r
+S3156000F6400000000000000000000000000000000054\r
+S3156000F6500000000000000000000000000000000044\r
+S3156000F6600000000000000000000000000000000034\r
+S3156000F6700000000000000000000000000000000024\r
+S3156000F6800000000000000000000000000000000014\r
+S3156000F6900000000000000000000000000000000004\r
+S3156000F6A000000000000000000000000000000000F4\r
+S3156000F6B000000000000000000000000000000000E4\r
+S3156000F6C000000000000000000000000000000000D4\r
+S3156000F6D000000000000000000000000000000000C4\r
+S3156000F6E000000000000000000000000000000000B4\r
+S3156000F6F000000000000000000000000000000000A4\r
+S3156000F7000000000000000000000000000000000093\r
+S3156000F7100000000000000000000000000000000083\r
+S3156000F7200000000000000000000000000000000073\r
+S3156000F7300000000000000000000000000000000063\r
+S3156000F7400000000000000000000000000000000053\r
+S3156000F7500000000000000000000000000000000043\r
+S3156000F7600000000000000000000000000000000033\r
+S3156000F7700000000000000000000000000000000023\r
+S3156000F7800000000000000000000000000000000013\r
+S3156000F7900000000000000000000000000000000003\r
+S3156000F7A000000000000000000000000000000000F3\r
+S3156000F7B000000000000000000000000000000000E3\r
+S3156000F7C000000000000000000000000000000000D3\r
+S3156000F7D000000000000000000000000000000000C3\r
+S3156000F7E000000000000000000000000000000000B3\r
+S3156000F7F000000000000000000000000000000000A3\r
+S3156000F8000000000000000000000000000000000092\r
+S3156000F8100000000000000000000000000000000082\r
+S3156000F8200000000000000000000000000000000072\r
+S3156000F8300000000000000000000000000000000062\r
+S3156000F8400000000000000000000000000000000052\r
+S3156000F8500000000000000000000000000000000042\r
+S3156000F8600000000000000000000000000000000032\r
+S3156000F8700000000000000000000000000000000022\r
+S3156000F8800000000000000000000000000000000012\r
+S3156000F8900000000000000000000000000000000002\r
+S3156000F8A000000000000000000000000000000000F2\r
+S3156000F8B000000000000000000000000000000000E2\r
+S3156000F8C000000000000000000000000000000000D2\r
+S3156000F8D000000000000000000000000000000000C2\r
+S3156000F8E000000000000000000000000000000000B2\r
+S3156000F8F000000000000000000000000000000000A2\r
+S3156000F9000000000000000000000000000000000091\r
+S3156000F9100000000000000000000000000000000081\r
+S3156000F9200000000000000000000000000000000071\r
+S3156000F9300000000000000000000000000000000061\r
+S3156000F9400000000000000000000000000000000051\r
+S3156000F9500000000000000000000000000000000041\r
+S3156000F9600000000000000000000000000000000031\r
+S3156000F9700000000000000000000000000000000021\r
+S3156000F9800000000000000000000000000000000011\r
+S3156000F9900000000000000000000000000000000001\r
+S3156000F9A000000000000000000000000000000000F1\r
+S3156000F9B000000000000000000000000000000000E1\r
+S3156000F9C000000000000000000000000000000000D1\r
+S3156000F9D000000000000000000000000000000000C1\r
+S3156000F9E000000000000000000000000000000000B1\r
+S3156000F9F000000000000000000000000000000000A1\r
+S3156000FA000000000000000000000000000000000090\r
+S3156000FA100000000000000000000000000000000080\r
+S3156000FA200000000000000000000000000000000070\r
+S3156000FA300000000000000000000000000000000060\r
+S3156000FA400000000000000000000000000000000050\r
+S3156000FA500000000000000000000000000000000040\r
+S3156000FA600000000000000000000000000000000030\r
+S3156000FA700000000000000000000000000000000020\r
+S3156000FA800000000000000000000000000000000010\r
+S3156000FA900000000000000000000000000000000000\r
+S3156000FAA000000000000000000000000000000000F0\r
+S3156000FAB000000000000000000000000000000000E0\r
+S3156000FAC000000000000000000000000000000000D0\r
+S3156000FAD000000000000000000000000000000000C0\r
+S3156000FAE000000000000000000000000000000000B0\r
+S3156000FAF000000000000000000000000000000000A0\r
+S3156000FB00000000000000000000000000000000008F\r
+S3156000FB10000000000000000000000000000000007F\r
+S3156000FB20000000000000000000000000000000006F\r
+S3156000FB30000000000000000000000000000000005F\r
+S3156000FB40000000000000000000000000000000004F\r
+S3156000FB50000000000000000000000000000000003F\r
+S3156000FB60000000000000000000000000000000002F\r
+S3156000FB70000000000000000000000000000000001F\r
+S3156000FB80000000000000000000000000000000000F\r
+S3156000FB9000000000000000000000000000000000FF\r
+S3156000FBA000000000000000000000000000000000EF\r
+S3156000FBB000000000000000000000000000000000DF\r
+S3156000FBC000000000000000000000000000000000CF\r
+S3156000FBD000000000000000000000000000000000BF\r
+S3156000FBE000000000000000000000000000000000AF\r
+S3156000FBF0000000000000000000000000000000009F\r
+S3156000FC00000000000000000000000000000000008E\r
+S3156000FC10000000000000000000000000000000007E\r
+S3156000FC20000000000000000000000000000000006E\r
+S3156000FC30000000000000000000000000000000005E\r
+S3156000FC40000000000000000000000000000000004E\r
+S3156000FC50000000000000000000000000000000003E\r
+S3156000FC60000000000000000000000000000000002E\r
+S3156000FC70000000000000000000000000000000001E\r
+S3156000FC80000000000000000000000000000000000E\r
+S3156000FC9000000000000000000000000000000000FE\r
+S3156000FCA000000000000000000000000000000000EE\r
+S3156000FCB000000000000000000000000000000000DE\r
+S3156000FCC000000000000000000000000000000000CE\r
+S3156000FCD000000000000000000000000000000000BE\r
+S3156000FCE000000000000000000000000000000000AE\r
+S3156000FCF0000000000000000000000000000000009E\r
+S3156000FD00000000000000000000000000000000008D\r
+S3156000FD10000000000000000000000000000000007D\r
+S3156000FD20000000000000000000000000000000006D\r
+S3156000FD30000000000000000000000000000000005D\r
+S3156000FD40000000000000000000000000000000004D\r
+S3156000FD50000000000000000000000000000000003D\r
+S3156000FD60000000000000000000000000000000002D\r
+S3156000FD70000000000000000000000000000000001D\r
+S3156000FD80000000000000000000000000000000000D\r
+S3156000FD9000000000000000000000000000000000FD\r
+S3156000FDA000000000000000000000000000000000ED\r
+S3156000FDB000000000000000000000000000000000DD\r
+S3156000FDC000000000000000000000000000000000CD\r
+S3156000FDD000000000000000000000000000000000BD\r
+S3156000FDE000000000000000000000000000000000AD\r
+S3156000FDF0000000000000000000000000000000009D\r
+S3156000FE00000000000000000000000000000000008C\r
+S3156000FE10000000000000000000000000000000007C\r
+S3156000FE20000000000000000000000000000000006C\r
+S3156000FE30000000000000000000000000000000005C\r
+S3156000FE40000000000000000000000000000000004C\r
+S3156000FE50000000000000000000000000000000003C\r
+S3156000FE60000000000000000000000000000000002C\r
+S3156000FE70000000000000000000000000000000001C\r
+S3156000FE80000000000000000000000000000000000C\r
+S3156000FE9000000000000000000000000000000000FC\r
+S3156000FEA000000000000000000000000000000000EC\r
+S3156000FEB000000000000000000000000000000000DC\r
+S3156000FEC000000000000000000000000000000000CC\r
+S3156000FED000000000000000000000000000000000BC\r
+S3156000FEE000000000000000000000000000000000AC\r
+S3156000FEF0000000000000000000000000000000009C\r
+S3156000FF00000000000000000000000000000000008B\r
+S3156000FF10000000000000000000000000000000007B\r
+S3156000FF20000000000000000000000000000000006B\r
+S3156000FF30000000000000000000000000000000005B\r
+S3156000FF40000000000000000000000000000000004B\r
+S3156000FF50000000000000000000000000000000003B\r
+S3156000FF60000000000000000000000000000000002B\r
+S3156000FF70000000000000000000000000000000001B\r
+S3156000FF80000000000000000000000000000000000B\r
+S3156000FF9000000000000000000000000000000000FB\r
+S3156000FFA000000000000000000000000000000000EB\r
+S3156000FFB000000000000000000000000000000000DB\r
+S3156000FFC000000000000000000000000000000000CB\r
+S3156000FFD000000000000000000000000000000000BB\r
+S3156000FFE000000000000000000000000000000000AB\r
+S3156000FFF0000000000000000000000000000000009B\r
+S315600100000000000000000000000000000000000089\r
+S315600100100000000000000000000000000000000079\r
+S315600100200000000000000000000000000000000069\r
+S315600100300000000000000000000000000000000059\r
+S315600100400000000000000000000000000000000049\r
+S315600100500000000000000000000000000000000039\r
+S315600100600000000000000000000000000000000029\r
+S315600100700000000000000000000000000000000019\r
+S315600100800000000000000000000000000000000009\r
+S3156001009000000000000000000000000000000000F9\r
+S315600100A000000000000000000000000000000000E9\r
+S315600100B000000000000000000000000000000000D9\r
+S315600100C000000000000000000000000000000000C9\r
+S315600100D000000000000000000000000000000000B9\r
+S315600100E000000000000000000000000000000000A9\r
+S315600100F00000000000000000000000000000000099\r
+S315600101000000000000000000000000000000000088\r
+S315600101100000000000000000000000000000000078\r
+S315600101200000000000000000000000000000000068\r
+S315600101300000000000000000000000000000000058\r
+S315600101400000000000000000000000000000000048\r
+S315600101500000000000000000000000000000000038\r
+S315600101600000000000000000000000000000000028\r
+S315600101700000000000000000000000000000000018\r
+S315600101800000000000000000000000000000000008\r
+S3156001019000000000000000000000000000000000F8\r
+S315600101A000000000000000000000000000000000E8\r
+S315600101B000000000000000000000000000000000D8\r
+S315600101C000000000000000000000000000000000C8\r
+S315600101D000000000000000000000000000000000B8\r
+S315600101E000000000000000000000000000000000A8\r
+S315600101F00000000000000000000000000000000098\r
+S315600102000000000000000000000000000000000087\r
+S315600102100000000000000000000000000000000077\r
+S315600102200000000000000000000000000000000067\r
+S315600102300000000000000000000000000000000057\r
+S315600102400000000000000000000000000000000047\r
+S315600102500000000000000000000000000000000037\r
+S315600102600000000000000000000000000000000027\r
+S315600102700000000000000000000000000000000017\r
+S315600102800000000000000000000000000000000007\r
+S3156001029000000000000000000000000000000000F7\r
+S315600102A000000000000000000000000000000000E7\r
+S315600102B000000000000000000000000000000000D7\r
+S315600102C000000000000000000000000000000000C7\r
+S315600102D000000000000000000000000000000000B7\r
+S315600102E000000000000000000000000000000000A7\r
+S315600102F00000000000000000000000000000000097\r
+S315600103000000000000000000000000000000000086\r
+S315600103100000000000000000000000000000000076\r
+S315600103200000000000000000000000000000000066\r
+S315600103300000000000000000000000000000000056\r
+S315600103400000000000000000000000000000000046\r
+S315600103500000000000000000000000000000000036\r
+S315600103600000000000000000000000000000000026\r
+S315600103700000000000000000000000000000000016\r
+S315600103800000000000000000000000000000000006\r
+S3156001039000000000000000000000000000000000F6\r
+S315600103A000000000000000000000000000000000E6\r
+S315600103B000000000000000000000000000000000D6\r
+S315600103C000000000000000000000000000000000C6\r
+S315600103D000000000000000000000000000000000B6\r
+S315600103E000000000000000000000000000000000A6\r
+S315600103F00000000000000000000000000000000096\r
+S315600104000000000000000000000000000000000085\r
+S315600104100000000000000000000000000000000075\r
+S315600104200000000000000000000000000000000065\r
+S315600104300000000000000000000000000000000055\r
+S315600104400000000000000000000000000000000045\r
+S315600104500000000000000000000000000000000035\r
+S315600104600000000000000000000000000000000025\r
+S315600104700000000000000000000000000000000015\r
+S315600104800000000000000000000000000000000005\r
+S7050000684052\r
diff --git a/tools/elftosb/test_files/test0.key b/tools/elftosb/test_files/test0.key
new file mode 100644 (file)
index 0000000..19af2fa
--- /dev/null
@@ -0,0 +1 @@
+F8B5A7C69EE6F795513B12227163A79C
diff --git a/tools/elftosb/winsupport/unistd.h b/tools/elftosb/winsupport/unistd.h
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/tools/gcc-version.sh b/tools/gcc-version.sh
new file mode 100755 (executable)
index 0000000..debecb5
--- /dev/null
@@ -0,0 +1,32 @@
+#!/bin/sh
+#
+# gcc-version [-p] gcc-command
+#
+# Prints the gcc version of `gcc-command' in a canonical 4-digit form
+# such as `0295' for gcc-2.95, `0303' for gcc-3.3, etc.
+#
+# With the -p option, prints the patchlevel as well, for example `029503' for
+# gcc-2.95.3, `030301' for gcc-3.3.1, etc.
+#
+
+if [ "$1" = "-p" ] ; then
+       with_patchlevel=1;
+       shift;
+fi
+
+compiler="$*"
+
+if [ ${#compiler} -eq 0 ]; then
+       echo "Error: No compiler specified."
+       printf "Usage:\n\t$0 <gcc-command>\n"
+       exit 1
+fi
+
+MAJOR=$(echo __GNUC__ | $compiler -E -xc - | tail -n 1)
+MINOR=$(echo __GNUC_MINOR__ | $compiler -E -xc - | tail -n 1)
+if [ "x$with_patchlevel" != "x" ] ; then
+       PATCHLEVEL=$(echo __GNUC_PATCHLEVEL__ | $compiler -E -xc - | tail -n 1)
+       printf "%02d%02d%02d\\n" $MAJOR $MINOR $PATCHLEVEL
+else
+       printf "%02d%02d\\n" $MAJOR $MINOR
+fi
diff --git a/tools/logos/karo.bmp b/tools/logos/karo.bmp
new file mode 100644 (file)
index 0000000..001cca7
Binary files /dev/null and b/tools/logos/karo.bmp differ